StaticregisterRegisters a node handler for a specific type.
The type of the node.
The handler responsible for managing the node type.
StaticadapterRetrieves the node handler for a given type.
The type of the node to retrieve the handler for.
The node handler for the specified type, or undefined if no handler is registered for that type.
StaticunregisterUnregisters a node handler for a specific type.
The type of the node to unregister the handler for.
StaticregisteredRetrieves a list of all registered node types in the registry.
An array of strings representing the registered node types.
StaticregisterStaticgetStaticisChecks if the node type represents a connection.
The type of the node.
True if the node type is a connection, false otherwise.
StaticisChecks if the node type represents a container.
The type of the node.
True if the node type is a container, false otherwise.
StaticcreateStatichasChecks if the node type has text.
The type of the node.
True if the node type has text, false otherwise.
StaticisChecks if the node type supports single-line text rendering.
The type of the node.
True if the node type supports single-line text rendering, false otherwise.
StaticisChecks if the node type requires a multistep creation process.
The type of the node.
True if the node type requires multistep creation, false otherwise.
StaticcanChecks if the node type supports drag creation.
The type of the node.
True if the node type supports drag creation, false otherwise.
StaticcanChecks if the node type can be rotated.
The type of the node.
True if the node type can be rotated, false otherwise.
StaticcanChecks if the node type can snap to a grid or guides.
The type of the node.
True if the node type can snap to a grid or guides, false otherwise.
StaticcanChecks if the specified node can connect from/to the given handle.
The node instance.
The connection handle.
The direction of the connection ('from' or 'to').
Optionaltarget: Partial<INode>True if the node can connect from/to the handle, false otherwise.
StaticafterInvokes the afterResize method of the node handler for the specified node type. This method is called after a node has been resized to allow the handler to perform any necessary adjustments or updates.
The node instance that was resized.
The handle that was used to resize the node.
NodeRegistry is a central registry for managing different types of node handlers. It allows for registering, retrieving, and unregistering node handlers based on their type. This enables the diagram system to support various node types and their associated behaviors in a modular way.
Handlers should be registered with a unique type string that identifies the kind of node they handle. The registry can then be queried to retrieve the appropriate handler for a given node type when needed. This design promotes extensibility and separation of concerns within the diagram system.
Example usage: const rectangleHandler = new RectangleHandler(); rectangleHandler.register(); // Registers the handler with the NodeRegistry
const handler = NodeRegistry.get('rectangle'); // Retrieves the handler for 'rectangle' nodes if (handler) { handler.render(node, context); // Uses the handler to render a node }