Node Operations
addNodes
$flow.addNodes(nodes: FlowNode | FlowNode[], options?: { center?: boolean }): void
Add one or more nodes to the canvas. Accepts a single node or an array.
When options.center is set, nodes are placed off-screen for measurement, then repositioned centered on their intended position after dimensions are known.
Validates child constraints before accepting each node. Captures history, sorts topologically, rebuilds the node map, pushes collab updates, runs child layout, and schedules auto-layout.
removeNodes
$flow.removeNodes(ids: string | string[]): void
Remove one or more nodes by ID. Cascades removal to all descendants (via parentId hierarchy). Removes connected edges and optionally creates reconnection bridges (when reconnectOnDelete is enabled). Validates child constraints before allowing removal.
getNode
$flow.getNode(id: string): FlowNode | undefined
Look up a node by ID. Returns the reactive node object or undefined.
getNodesBounds
$flow.getNodesBounds(nodeIds?: string[]): { x: number; y: number; width: number; height: number }
Get the bounding rectangle of the specified nodes. When no IDs are provided, returns bounds for all visible (non-hidden) nodes.
getOutgoers
$flow.getOutgoers(nodeId: string): FlowNode[]
Get all nodes connected via outgoing edges from the given node.
getIncomers
$flow.getIncomers(nodeId: string): FlowNode[]
Get all nodes connected via incoming edges to the given node.
getConnectedEdges
$flow.getConnectedEdges(nodeId: string): FlowEdge[]
Get all edges connected to a node (both incoming and outgoing).
areNodesConnected
$flow.areNodesConnected(nodeA: string, nodeB: string, directed?: boolean): boolean
Check if two nodes are connected by an edge. When directed is true (default: false), only checks source-to-target direction.
getIntersectingNodes
$flow.getIntersectingNodes(nodeOrId: FlowNode | string, partially?: boolean): FlowNode[]
Get nodes whose bounding rectangle overlaps the given node. Accepts either a FlowNode object or a node ID string. When partially is false, requires full containment.
isNodeIntersecting
$flow.isNodeIntersecting(nodeOrId: FlowNode | string, targetOrId: FlowNode | string, partially?: boolean): boolean
Check if two nodes' bounding rectangles overlap. Accepts either FlowNode objects or node ID strings.