import * as solid_js from 'solid-js'; import { JSX, ParentProps, ParentComponent, Accessor } from 'solid-js'; import * as _xyflow_system from '@xyflow/system'; import { NodeProps as NodeProps$1, NodeBase, InternalNodeBase, EdgeBase, EdgePosition, BezierPathOptions, StepPathOptions, SmoothStepPathOptions, DefaultEdgeOptionsBase, OnReconnect, HandleType, FinalConnectionState, PanOnScrollMode as PanOnScrollMode$1, Position as Position$1, FitViewOptionsBase, ResizeControlVariant as ResizeControlVariant$1, ConnectionMode as ConnectionMode$1, SelectionMode as SelectionMode$1, ConnectionLineType as ConnectionLineType$2, OnBeforeDeleteBase, Connection, XYPosition, Handle as Handle$1, PanelPosition, Viewport, OnMove, OnMoveStart, OnMoveEnd, HandleProps as HandleProps$1, MarkerProps as MarkerProps$1, ShouldResize, OnResizeStart, OnResize, OnResizeEnd, ControlPosition, Align, NodeOrigin, SnapGrid, CoordinateExtent, ColorMode, ProOptions, IsValidConnection, OnError, OnConnectStart, OnConnectEnd, OnReconnectStart, OnReconnectEnd, AriaLabelConfig, ConnectionState, NodeConnection, ZoomInOut, ViewportHelperFunctionOptions, SetCenterOptions, Rect, FitBoundsOptions, HandleConnection, UpdateNodeInternals } from '@xyflow/system'; export { Align, AriaLabelConfig, BezierPathOptions, Box, ColorMode, ColorModeClass, Connection, ConnectionLineType, ConnectionMode, ControlLinePosition, ControlPosition, CoordinateExtent, Dimensions, EdgeMarker, EdgeMarkerType, FitBounds, FitBoundsOptions, GetBezierPathParams, GetSmoothStepPathParams, GetStraightPathParams, HandleConnection, IsValidConnection, MarkerType, NodeConnection, NodeOrigin, OnConnect, OnConnectEnd, OnConnectStart, OnConnectStartParams, OnError, OnMove, OnMoveEnd, OnMoveStart, OnReconnect, OnReconnectEnd, OnReconnectStart, OnResize, OnResizeEnd, OnResizeStart, OnSelectionDrag, PanOnScrollMode, PanelPosition, Position, ProOptions, Rect, ResizeControlVariant, ResizeDragEvent, ResizeParams, ResizeParamsWithDirection, SelectionMode, SelectionRect, SetCenter, SetCenterOptions, SetViewport, ShouldResize, SmoothStepPathOptions, SnapGrid, Transform, Viewport, ViewportHelperFunctionOptions, XYPosition, XYZPosition, addEdge, getBezierEdgeCenter, getBezierPath, getConnectedEdges, getEdgeCenter, getIncomers, getNodesBounds, getOutgoers, getSmoothStepPath, getStraightPath, getViewportForBounds } from '@xyflow/system'; import { Store, SetStoreFunction } from 'solid-js/store'; /** * The node data structure that gets used for internal nodes. * There are some data structures added under node.internal * that are needed for tracking some properties * @public */ type InternalNode = InternalNodeBase; /** * The node data structure that gets used for the nodes prop. * @public */ type Node = NodeBase & { class?: string; style?: JSX.CSSProperties; focusable?: boolean; /** * The ARIA role attribute for the node element, used for accessibility. * @default "group" */ ariaRole?: JSX.HTMLAttributes["role"]; /** * General escape hatch for adding custom attributes to the node's DOM element. */ domAttributes?: Omit, "id" | "style" | "class" | "draggable" | "role" | "aria-label" | keyof JSX.HTMLAttributes>; }; type NodeProps = NodeProps$1>; /** * Map of node types to their components. */ type NodeTypes = { [K in string]: { bivarianceHack(props: NodeProps, string | undefined>): JSX.Element; }["bivarianceHack"]; }; type BuiltInNode = Node<{ label: string; }, "input" | "output" | "default"> | Node, "group">; type BuiltInNodeTypes = { input: (props: NodeProps<{ label: string; }, "input">) => JSX.Element; output: (props: NodeProps<{ label: string; }, "output">) => JSX.Element; default: (props: NodeProps<{ label: string; }, "default">) => JSX.Element; group: (props: NodeProps, "group">) => JSX.Element; }; type UnknownStruct = Record; /** * An `Edge` is the complete description with everything Svelte Flow needs to know in order to * render it. * @public */ type Edge = EdgeBase & { label?: string; labelStyle?: JSX.CSSProperties; style?: JSX.CSSProperties; class?: string; focusable?: boolean; /** * The ARIA role attribute for the edge, used for accessibility. * @default "group" */ ariaRole?: JSX.HTMLAttributes["role"]; /** * General escape hatch for adding custom attributes to the edge's DOM element. */ domAttributes?: Omit, "id" | "style" | "class" | "role" | "aria-label">; }; /** * Props passed to edge components. This is the main interface that custom edge components should implement. */ type EdgeProps = Omit, "sourceHandle" | "targetHandle"> & EdgePosition & { markerStart?: string; markerEnd?: string; sourceHandleId?: string | null; targetHandleId?: string | null; }; /** * Props for built-in edge components that render the actual SVG path. */ type BaseEdgeProps = { /** SVG path of the edge */ path: string; /** The x coordinate of the label */ labelX?: number; /** The y coordinate of the label */ labelY?: number; /** Marker at start of edge */ markerStart?: string; /** Marker at end of edge */ markerEnd?: string; /** CSS class for the edge */ class?: string; /** Edge label */ label?: string; /** Styles for the edge label */ labelStyle?: JSX.CSSProperties; /** Styles for the edge path */ style?: JSX.CSSProperties; /** Interaction width for edge selection */ interactionWidth?: number; } & JSX.SvgSVGAttributes; /** * Props for built-in edge components (these match the actual component implementations) */ type BezierEdgeProps = EdgeProps, "default"> & { pathOptions?: BezierPathOptions; }; type StraightEdgeProps = Omit, "straight">, "sourcePosition" | "targetPosition">; type StepEdgeProps = EdgeProps, "step"> & { pathOptions?: StepPathOptions; }; type SmoothStepEdgeProps = EdgeProps, "smoothstep"> & { pathOptions?: SmoothStepPathOptions; }; /** * Built-in edge types with their component signatures */ type BuiltInEdgeTypes = { default: (props: BezierEdgeProps) => JSX.Element; straight: (props: StraightEdgeProps) => JSX.Element; step: (props: StepEdgeProps) => JSX.Element; smoothstep: (props: SmoothStepEdgeProps) => JSX.Element; }; /** * Union of all built-in edge props */ type BuiltInEdge = BezierEdgeProps | StraightEdgeProps | StepEdgeProps | SmoothStepEdgeProps; /** * Map of edge types to their components. */ type EdgeTypes = { [K in string]: { bivarianceHack(props: EdgeProps, string | undefined>): JSX.Element; }["bivarianceHack"]; }; type DefaultEdgeOptions = DefaultEdgeOptionsBase; type NodeEventWithPointer = ({ node, event, }: { node: NodeType; event: T; }) => void; type NodesEventWithPointer = ({ nodes, event, }: { nodes: NodeType[]; event: T; }) => void; type NodeTargetEventWithPointer = ({ targetNode, nodes, event, }: { targetNode: NodeType | null; nodes: NodeType[]; event: T; }) => void; type NodeEvents = { /** This event handler is called when a user clicks on a node. */ onNodeClick?: NodeEventWithPointer; /** This event handler is called when a user right-clicks on a node. */ onNodeContextMenu?: NodeEventWithPointer; /** This event handler is called when a user drags a node. */ onNodeDrag?: NodeTargetEventWithPointer; /** This event handler is called when a user starts to drag a node. */ onNodeDragStart?: NodeTargetEventWithPointer; /** This event handler is called when a user stops dragging a node. */ onNodeDragStop?: NodeTargetEventWithPointer; /** This event handler is called when the pointer of a user enters a node. */ onNodePointerEnter?: NodeEventWithPointer; /** This event handler is called when the pointer of a user leaves a node. */ onNodePointerLeave?: NodeEventWithPointer; /** This event handler is called when the pointer of a user moves over a node. */ onNodePointerMove?: NodeEventWithPointer; }; type NodeSelectionEvents = { /** This event handler is called when a user right-clicks the selection box. */ onSelectionContextMenu?: NodesEventWithPointer; /** This event handler is called when a user clicks the selection box. */ onSelectionClick?: NodesEventWithPointer; }; type PaneEvents = { /** This event handler is called when a user clicks the pane. */ onPaneClick?: ({ event }: { event: MouseEvent; }) => void; /** This event handler is called when a user right-clicks the pane. */ onPaneContextMenu?: ({ event }: { event: PointerEvent; }) => void; }; type EdgeEvents = { /** This event handler is called when a user clicks an edge. */ onEdgeClick?: ({ edge, event }: { edge: EdgeType; event: MouseEvent; }) => void; /** This event handler is called when a user right-clicks an edge. */ onEdgeContextMenu?: ({ edge, event }: { edge: EdgeType; event: PointerEvent; }) => void; /** This event handler is called when the pointer of a user enters an edge. */ onEdgePointerEnter?: ({ edge, event }: { edge: EdgeType; event: PointerEvent; }) => void; /** This event handler is called when the pointer of a user enters an edge. */ onEdgePointerLeave?: ({ edge, event }: { edge: EdgeType; event: PointerEvent; }) => void; }; type DeleteEvents = { onNodesDelete?: (nodes: NodeType[]) => void; onEdgesDelete?: (edges: EdgeType[]) => void; }; type EdgeReconnectEvents = { /** * This handler is called when the source or target of a reconnectable edge is dragged from the * current node. It will fire even if the edge's source or target do not end up changing. * You can use the `reconnectEdge` utility to convert the connection to a new edge. */ onReconnect?: OnReconnect; /** * This event fires when the user begins dragging the source or target of an editable edge. */ onReconnectStart?: (event: MouseEvent | TouchEvent, edge: EdgeType, handleType: HandleType) => void; /** * This event fires when the user releases the source or target of an editable edge. It is called * even if an edge update does not occur. */ onReconnectEnd?: (event: MouseEvent | TouchEvent, edge: EdgeType, handleType: HandleType, connectionState: FinalConnectionState) => void; }; type OnSelectionDrag = (event: MouseEvent, nodes: NodeType[]) => void; type Position = `${Position$1}`; type ConnectionMode = `${ConnectionMode$1}`; type ConnectionLineType$1 = `${ConnectionLineType$2}`; type SelectionMode = `${SelectionMode$1}`; type PanOnScrollMode = `${PanOnScrollMode$1}`; type ResizeControlVariant = `${ResizeControlVariant$1}`; type ShortcutModifier = "alt" | "ctrl" | "meta" | "shift"; type ShortcutModifierDefinition = null | false | ShortcutModifier | (ShortcutModifier | ShortcutModifier[])[]; type KeyModifier = ShortcutModifierDefinition; type KeyDefinitionObject = { key: string; modifier?: KeyModifier; }; type KeyDefinition = string | KeyDefinitionObject; type ConnectionData = { connectionPosition: XYPosition | null; connectionStartHandle: Handle$1 | null; connectionEndHandle: Handle$1 | null; connectionStatus: string | null; }; type FitViewOptions = FitViewOptionsBase; type OnDelete = (params: { nodes: NodeType[]; edges: EdgeType[]; }) => void; type EdgeConnection = Connection & { id: string; }; /** Callback that gets called before a handle connection is created. */ type OnBeforeEdgeConnect = (connection: EdgeConnection) => EdgeType | EdgeConnection | undefined; /** Callback that gets called after a handle connection is created. */ type OnEdgeConnect = (connection: EdgeConnection) => void; type OnBeforeReconnect = (newEdge: EdgeType, oldEdge: EdgeType) => EdgeType | undefined; type OnBeforeDelete = OnBeforeDeleteBase; type OnSelectionChange = (params: { nodes: NodeType[]; edges: EdgeType[]; }) => void; type NodeGraph = { readonly nodes: NodeType[]; readonly edges: EdgeType[]; }; type OnEdgeCreate = (connection: Connection) => EdgeType | Connection; type EdgeRendererProps = EdgeEvents & { readonly defaultEdgeOptions?: DefaultEdgeOptions; readonly reconnectRadius: number; }; declare const EdgeRenderer: (props: EdgeRendererProps) => solid_js.JSX.Element; type NodeRendererProps = NodeEvents & { readonly nodeClickDistance: number; }; declare const NodeRenderer: (props: NodeRendererProps) => solid_js.JSX.Element; type PaneProps = PaneEvents & { readonly panOnDrag?: boolean | number[]; readonly selectionOnDrag?: boolean; readonly onSelectionStart?: (event: PointerEvent) => void; readonly onSelectionEnd?: (event: PointerEvent) => void; }; declare const Pane: (props: ParentProps) => JSX.Element; type PanelProps = Omit, "style"> & { /** Set position of the panel * @example 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' */ readonly position?: PanelPosition; readonly style?: JSX.CSSProperties; readonly "data-testid"?: string; readonly "data-message"?: string; }; declare const Panel: (props: ParentProps) => JSX.Element; declare const ViewportPortal: (props: ParentProps) => solid_js.JSX.Element; type ZoomProps = { readonly initialViewport?: Viewport; readonly panOnScrollMode: PanOnScrollMode; readonly onMove?: OnMove; readonly onMoveStart?: OnMoveStart; readonly onMoveEnd?: OnMoveEnd; readonly onViewportInitialized?: () => void; readonly preventScrolling: boolean; readonly zoomOnScroll: boolean; readonly zoomOnDoubleClick: boolean; readonly zoomOnPinch: boolean; readonly panOnScroll: boolean; readonly panOnDrag: boolean | number[]; readonly paneClickDistance: number; }; declare const Zoom: (props: ParentProps) => solid_js.JSX.Element; type ConnectionLineType = `${ConnectionLineType$2}`; /** * If you want to render a custom component for connection lines, you can set the * `connectionLineComponent` prop on the [``](/api-reference/react-flow#connection-connectionLineComponent) * component. The `ConnectionLineComponentProps` are passed to your custom component. * * @public */ type ConnectionLineComponentProps = { readonly connectionLineStyle?: JSX.CSSProperties; readonly connectionLineType: ConnectionLineType; readonly fromNode: InternalNode; readonly fromHandle: Handle$1; readonly fromX: number; readonly fromY: number; readonly toX: number; readonly toY: number; readonly fromPosition: Position; readonly toPosition: Position; readonly connectionStatus: "valid" | "invalid" | null; readonly toNode: InternalNode | null; readonly toHandle: Handle$1 | null; }; type ConnectionLineProps = { readonly style: JSX.CSSProperties; readonly type: ConnectionLineType; readonly component: (props: ConnectionLineComponentProps) => JSX.Element; readonly containerStyle: string | JSX.CSSProperties; }; declare const ConnectionLine: (props: ParentProps>>) => JSX.Element; declare const BaseEdge: (props: ParentProps) => solid_js.JSX.Element; declare const BezierEdge: (props: BezierEdgeProps) => solid_js.JSX.Element; declare const BezierEdgeInternal: (props: BezierEdgeProps) => solid_js.JSX.Element; type EdgeLabelProps = { readonly x?: number; readonly y?: number; readonly width?: number; readonly height?: number; readonly selectEdgeOnClick?: boolean; readonly transparent?: boolean; readonly style?: JSX.CSSProperties; } & Omit, "style">; declare const EdgeLabel: (props: ParentProps) => JSX.Element; declare const EdgeLabelRenderer: (props: ParentProps) => solid_js.JSX.Element; type EdgeReconnectAnchorProps = { readonly type: HandleType; readonly class?: string; readonly style?: JSX.CSSProperties; readonly position?: XYPosition; readonly size?: number; readonly reconnecting?: boolean; } & Omit, "style">; declare const EdgeReconnectAnchor: (props: ParentProps) => JSX.Element; type EdgeWrapperProps = EdgeEvents & { readonly edgeId: string; }; declare const EdgeWrapper: (props: EdgeWrapperProps) => solid_js.JSX.Element; declare const SmoothStepEdge: (props: SmoothStepEdgeProps) => solid_js.JSX.Element; declare const SmoothStepEdgeInternal: (props: SmoothStepEdgeProps) => solid_js.JSX.Element; declare const StepEdge: (props: StepEdgeProps) => solid_js.JSX.Element; declare const StepEdgeInternal: (props: StepEdgeProps) => solid_js.JSX.Element; declare const StraightEdge: (props: StraightEdgeProps) => solid_js.JSX.Element; declare const StraightEdgeInternal: (props: Omit) => solid_js.JSX.Element; type HandleProps = Omit & { readonly position: Position; readonly class?: string; readonly style?: JSX.CSSProperties; readonly onConnect?: (connections: Connection[]) => void; readonly onDisconnect?: (connections: Connection[]) => void; } & Omit, "style">; declare const Handle: (props: ParentProps) => JSX.Element; type MarkerProps = MarkerProps$1 & { readonly markerUnits?: "strokeWidth" | "userSpaceOnUse"; readonly strokeWidth?: number; }; declare const Marker: (props: MarkerProps) => JSX.Element; declare const MarkerDefinition: () => solid_js.JSX.Element; declare const DefaultNode: (props: NodeProps<{ label: string; }, "default">) => solid_js.JSX.Element; declare const GroupNode: (props: NodeProps>) => solid_js.JSX.Element; declare const InputNode: (props: NodeProps<{ label: string; }>) => solid_js.JSX.Element; type NodeWrapperProps = NodeEvents & { readonly nodeId: string; readonly resizeObserver: ResizeObserver; readonly nodeClickDistance: number; }; declare const NodeWrapper: (props: NodeWrapperProps) => solid_js.JSX.Element; declare const OutputNode: (props: NodeProps<{ label: string; }>) => solid_js.JSX.Element; type BackgroundVariant = "lines" | "dots" | "cross"; type BackgroundProps = { readonly id?: string; /** Variant of the pattern * @example 'lines', 'dots', 'cross' */ readonly variant?: BackgroundVariant; /** Color of the background */ readonly bgColor?: string; /** Color of the pattern */ readonly patternColor?: string; /** Class applied to the pattern */ readonly patternClass?: string; /** Class applied to the container */ readonly class?: string; /** Gap between repetitions of the pattern */ readonly gap?: number | [number, number]; /** Size of a single pattern element */ readonly size?: number; /** Line width of the Line pattern */ readonly lineWidth?: number; /** Style applied to the container */ readonly style?: JSX.CSSProperties; }; declare const Background: (props: BackgroundProps) => JSX.Element; type ControlButtonProps = Omit, "onClick"> & { readonly class?: string; readonly bgColor?: string; readonly bgColorHover?: string; readonly color?: string; readonly colorHover?: string; readonly borderColor?: string; readonly onClick?: JSX.EventHandler; }; declare const ControlButton: (props: ParentProps) => JSX.Element; type ControlsOrientation = "horizontal" | "vertical"; type ControlsProps = { /** Position of the controls on the pane * @example PanelPosition.TopLeft, PanelPosition.TopRight, * PanelPosition.BottomLeft, PanelPosition.BottomRight */ readonly position?: PanelPosition; /** Show button for zoom in/out */ readonly showZoom?: boolean; /** Show button for fit view */ readonly showFitView?: boolean; /** Show button for toggling interactivity */ readonly showLock?: boolean; readonly buttonBgColor?: string; readonly buttonBgColorHover?: string; readonly buttonColor?: string; readonly buttonColorHover?: string; readonly buttonBorderColor?: string; readonly style?: JSX.CSSProperties; readonly orientation?: ControlsOrientation; readonly fitViewOptions?: FitViewOptions; readonly beforeControls?: JSX.Element; readonly afterControls?: JSX.Element; } & Omit, "style">; declare const Controls: (props: ParentProps) => JSX.Element; type GetMiniMapNodeAttribute = (node: NodeType) => string; type MiniMapProps = Omit, "style"> & { /** Background color of minimap */ readonly bgColor?: string; /** Color of nodes on the minimap */ readonly nodeColor?: string | GetMiniMapNodeAttribute; /** Stroke color of nodes on the minimap */ readonly nodeStrokeColor?: string | GetMiniMapNodeAttribute; /** Class applied to nodes on the minimap */ readonly nodeClass?: string | GetMiniMapNodeAttribute; /** Border radius of nodes on the minimap */ readonly nodeBorderRadius?: number; /** Stroke width of nodes on the minimap */ readonly nodeStrokeWidth?: number; /** Color of the mask representing viewport */ readonly maskColor?: string; /** Stroke color of the mask representing viewport */ readonly maskStrokeColor?: string; /** Stroke width of the mask representing viewport */ readonly maskStrokeWidth?: number; /** Position of the minimap on the pane * @example PanelPosition.TopLeft, PanelPosition.TopRight, * PanelPosition.BottomLeft, PanelPosition.BottomRight */ readonly position?: PanelPosition; /** Style applied to container */ readonly style?: JSX.CSSProperties; /** The aria-label applied to container */ readonly ariaLabel?: string | null; /** Width of minimap */ readonly width?: number; /** Height of minimap */ readonly height?: number; readonly pannable?: boolean; readonly zoomable?: boolean; /** Invert the direction when panning the minimap viewport */ readonly inversePan?: boolean; /** Step size for zooming in/out */ readonly zoomStep?: number; }; declare const MiniMap: (props: ParentProps>>) => JSX.Element; type NodeResizerProps = { /** Id of the node it is resizing * @remarks optional if used inside custom node */ readonly nodeId?: string; /** Class applied to handle */ readonly handleClass?: string; /** Style applied to handle */ readonly handleStyle?: JSX.CSSProperties; /** Class applied to line */ readonly lineClass?: string; /** Style applied to line */ readonly lineStyle?: JSX.CSSProperties; /** Are the controls visible */ readonly visible?: boolean; /** Minimum width of node */ readonly minWidth?: number; /** Minimum height of node */ readonly minHeight?: number; /** Maximum width of node */ readonly maxWidth?: number; /** Maximum height of node */ readonly maxHeight?: number; /** Keep aspect ratio when resizing */ readonly keepAspectRatio?: boolean; /** Automatically scale the node when resizing */ readonly autoScale?: boolean; /** Callback to determine if node should resize */ readonly shouldResize?: ShouldResize; /** Callback called when resizing starts */ readonly onResizeStart?: OnResizeStart; /** Callback called when resizing */ readonly onResize?: OnResize; /** Callback called when resizing ends */ readonly onResizeEnd?: OnResizeEnd; } & Omit, "onResize" | "style">; declare const NodeResizer: (props: Partial) => JSX.Element; type NodeResizerSubProps = Pick; type ResizeControlProps = NodeResizerSubProps & { /** Position of control * @example ControlPosition.TopLeft, ControlPosition.TopRight, * ControlPosition.BottomLeft, ControlPosition.BottomRight */ readonly position?: ControlPosition; /** Variant of control * @example ResizeControlVariant.Handle, ResizeControlVariant.Line */ readonly variant?: ResizeControlVariant; readonly style?: JSX.CSSProperties; } & Omit, "onResize" | "style">; declare const ResizeControl: (props: ParentProps) => JSX.Element; type NodeToolbarProps = Omit, "style"> & { /** The id of the node, or array of ids the toolbar should be displayed at */ readonly nodeId: string | string[]; /** Position of the toolbar relative to the node * @example Position.TopLeft, Position.TopRight, * Position.BottomLeft, Position.BottomRight */ readonly position: Position; /** Align the toolbar relative to the node * @example Align.Start, Align.Center, Align.End */ readonly align: Align; /** Offset the toolbar from the node */ readonly offset: number; /** If true, node toolbar is visible even if node is not selected */ readonly isVisible: boolean; /** Style of the toolbar */ readonly style: Omit; }; declare const NodeToolbar: ParentComponent>; type NodeSelectionProps = NodeSelectionEvents & Pick, "onNodeDrag" | "onNodeDragStart" | "onNodeDragStop">; declare const NodeSelection: (props: NodeSelectionProps) => solid_js.JSX.Element; type SelectionProps = { readonly x?: number; readonly y?: number; readonly width?: number | string; readonly height?: number | string; readonly isVisible?: boolean; }; declare const Selection: (props: SelectionProps) => solid_js.JSX.Element; type SolidFlowProps = NodeEvents & NodeSelectionEvents & EdgeEvents & DeleteEvents & PaneEvents & { /** * The id of the flow. This is necessary if you want to render multiple flows. */ readonly id?: string; /** Sets a fixed width for the flow */ readonly width?: number; /** Sets a fixed height for the flow */ readonly height?: number; /** * An store of nodes to render in a flow. * @example * const [nodes] = createStore([ * { * id: 'node-1', * type: 'input', * data: { label: 'Node 1' }, * position: { x: 250, y: 50 } * } * ]); */ readonly nodes?: Store; /** * An store of edges to render in a flow. * @example * const [edges] = createStore([ * { * id: 'edge-1-2', * source: 'node-1', * target: 'node-2', * } * ]); */ readonly edges?: Store; /** * Custom node types to be available in a flow. * Solid Flow matches a node's type to a component in the nodeTypes object. * @example * import CustomNode from './CustomNode'; * * const nodeTypes = { nameOfNodeType: CustomNode }; */ readonly nodeTypes?: NodeTypes; /** * Custom edge types to be available in a flow. * Solid Flow matches an edge's type to a component in the edgeTypes object. * @example * import CustomEdge from './CustomEdge'; * * const edgeTypes = { nameOfEdgeType: CustomEdge }; */ readonly edgeTypes?: EdgeTypes; /** Pressing down this key you can select multiple elements with a selection box. * @default 'Shift' */ readonly selectionKey?: KeyDefinition | KeyDefinition[] | null; /** If a key is set, you can pan the viewport while that key is held down even if panOnScroll is set to false. * * By setting this prop to null you can disable this functionality. * @default 'Space' */ readonly panActivationKey?: KeyDefinition | KeyDefinition[] | null; /** Pressing down this key deletes all selected nodes & edges. * @default 'Backspace' */ readonly deleteKey?: KeyDefinition | KeyDefinition[] | null; /** Pressing down this key you can select multiple elements by clicking. * @default 'Meta' for macOS, "Ctrl" for other systems */ readonly multiSelectionKey?: KeyDefinition | KeyDefinition[] | null; /** If a key is set, you can zoom the viewport while that key is held down even if panOnScroll is set to false. * * By setting this prop to null you can disable this functionality. * @default 'Meta' for macOS, "Ctrl" for other systems * */ readonly zoomActivationKey?: KeyDefinition | KeyDefinition[] | null; /** If set, initial viewport will show all nodes & edges */ readonly fitView?: boolean; /** * Options to be used in combination with fitView * @example * const fitViewOptions = { * padding: 0.1, * includeHiddenNodes: false, * minZoom: 0.1, * maxZoom: 1, * duration: 200, * nodes: [{id: 'node-1'}, {id: 'node-2'}], // nodes to fit * }; */ readonly fitViewOptions?: FitViewOptions; /** * Defines nodes relative position to its coordinates * @default [0, 0] * @example * [0, 0] // default, top left * [0.5, 0.5] // center * [1, 1] // bottom right */ readonly nodeOrigin?: NodeOrigin; /** * With a threshold greater than zero you can control the distinction between node drag and click events. * If threshold equals 1, you need to drag the node 1 pixel before a drag event is fired. * @default 1 */ readonly nodeDragThreshold?: number; /** * Distance that the mouse can move between mousedown/up that will trigger a click * @default 0 */ readonly paneClickDistance?: number; /** Distance that the mouse can move between mousedown/up that will trigger a click * @default 0 */ readonly nodeClickDistance?: number; /** * The threshold in pixels that the mouse must move before a connection line starts to drag. * This is useful to prevent accidental connections when clicking on a handle. * @default 1 */ readonly connectionDragThreshold?: number; /** Minimum zoom level * @default 0.5 */ readonly minZoom?: number; /** Maximum zoom level * @default 2 */ readonly maxZoom?: number; /** * Sets the initial position and zoom of the viewport. * If a default viewport is provided but fitView is enabled, the default viewport will be ignored. * @default { zoom: 1, position: { x: 0, y: 0 } } * @example * const initialViewport = { * zoom: 0.5, * position: { x: 0, y: 0 } * }; */ readonly initialViewport?: Viewport; /** Custom viewport to be used instead of internal one */ readonly viewport?: Store; /** * The radius around a handle where you drop a connection line to create a new edge. * @default 20 */ readonly connectionRadius?: number; /** * 'strict' connection mode will only allow you to connect source handles to target handles. * 'loose' connection mode will allow you to connect handles of any type to one another. * @default 'strict' */ readonly connectionMode?: ConnectionMode; /** Provide a custom snippet to be used insted of the default connection line */ readonly connectionLineComponent?: (props: ConnectionLineComponentProps) => JSX.Element; /** Styles to be applied to the connection line */ readonly connectionLineStyle?: JSX.CSSProperties; /** Styles to be applied to the container of the connection line */ readonly connectionLineContainerStyle?: JSX.CSSProperties; /** * When set to "partial", when the user creates a selection box by click and dragging * nodes that are only partially in the box are still selected. * @default 'full' */ readonly selectionMode?: SelectionMode; /** * Controls if nodes should be automatically selected when being dragged */ readonly selectNodesOnDrag?: boolean; /** * Grid all nodes will snap to * @example [20, 20] */ readonly snapGrid?: SnapGrid; /** Color of edge markers * You can pass `null` to use the CSS variable `--xy-edge-stroke` for the marker color. * @example "#b1b1b7" */ readonly defaultMarkerColor?: string; /** * Controls if all nodes should be draggable * @default true */ readonly nodesDraggable?: boolean; /** * When `true`, the viewport will pan when a node is focused. * @default true */ readonly autoPanOnNodeFocus?: boolean; /** * Controls if all nodes should be connectable to each other * @default true */ readonly nodesConnectable?: boolean; /** Controls if all elements should (nodes & edges) be selectable * @default true */ readonly elementsSelectable?: boolean; /** * When `true`, focus between nodes can be cycled with the `Tab` key and selected with the `Enter` * key. This option can be overridden by individual nodes by setting their `focusable` prop. * @default true */ readonly nodesFocusable?: boolean; /** * When `true`, focus between edges can be cycled with the `Tab` key and selected with the `Enter` * key. This option can be overridden by individual edges by setting their `focusable` prop. * @default true */ readonly edgesFocusable?: boolean; /** * By default the viewport extends infinitely. You can use this prop to set a boundary. * The first pair of coordinates is the top left boundary and the second pair is the bottom right. * @default @default [[-∞, -∞], [+∞, +∞]] * @example [[-1000, -10000], [1000, 1000]] */ readonly translateExtent?: CoordinateExtent; /** * By default the nodes can be placed anywhere. You can use this prop to set a boundary. * The first pair of coordinates is the top left boundary and the second pair is the bottom right. * @default [[-∞, -∞], [+∞, +∞]] * @example [[-1000, -10000], [1000, 1000]] */ readonly nodeExtent?: CoordinateExtent; /** * Disabling this prop will allow the user to scroll the page even when their pointer is over the flow. * @default true */ readonly preventScrolling?: boolean; /** * Controls if the viewport should zoom by scrolling inside the container. * @default true */ readonly zoomOnScroll?: boolean; /** * Controls if the viewport should zoom by double clicking somewhere on the flow * @default true */ readonly zoomOnDoubleClick?: boolean; /** * Controls if the viewport should zoom by pinching on a touch screen * @default true */ readonly zoomOnPinch?: boolean; /** * Controls if the viewport should pan by scrolling inside the container * Can be limited to a specific direction with panOnScrollMode * @default false */ readonly panOnScroll?: boolean; /** * This prop is used to limit the direction of panning when panOnScroll is enabled. * The "free" option allows panning in any direction. * @default "free" * @example "horizontal" | "vertical" */ readonly panOnScrollMode?: PanOnScrollMode; /** * Enableing this prop allows users to pan the viewport by clicking and dragging. * You can also set this prop to an array of numbers to limit which mouse buttons can activate panning. * @default true * @example [0, 2] // allows panning with the left and right mouse buttons * [0, 1, 2, 3, 4] // allows panning with all mouse buttons */ readonly panOnDrag?: boolean | number[]; /** * Select multiple elements with a selection box, without pressing down selectionKey. * @default false */ readonly selectionOnDrag?: boolean; /** * You can enable this optimization to instruct Solid Flow to only render nodes and edges that would be visible in the viewport. * This might improve performance when you have a large number of nodes and edges but also adds an overhead. * @default false */ readonly onlyRenderVisibleElements?: boolean; /** * You can enable this prop to automatically pan the viewport while making a new connection. * @default true */ readonly autoPanOnConnect?: boolean; /** * You can enable this prop to automatically pan the viewport while dragging a node. * @default true */ readonly autoPanOnNodeDrag?: boolean; /** * Defaults to be applied to all new edges that are added to the flow. * Properties on a new edge will override these defaults if they exist. * @example * const defaultEdgeOptions = { * type: 'customEdgeType', * animated: true * } */ readonly defaultEdgeOptions?: DefaultEdgeOptions; /** * Controls color scheme used for styling the flow * @default 'system' * @example 'system' | 'light' | 'dark' */ readonly colorMode?: ColorMode; /** Fallback color mode for SSR if colorMode is set to 'system' */ readonly colorModeSSR?: Omit; /** Class to be applied to the flow container */ readonly class?: string; /** Styles to be applied to the flow container */ readonly style?: JSX.CSSProperties; /** Choose from the built-in edge types to be used for connections * @default 'default' | ConnectionLineType.Bezier * @example 'straight' | 'default' | 'step' | 'smoothstep' | 'bezier' * @example ConnectionLineType.Straight | ConnectionLineType.Default | ConnectionLineType.Step | ConnectionLineType.SmoothStep | ConnectionLineType.Bezier */ readonly connectionLineType?: ConnectionLineType$1; /** Enabling this option will raise the z-index of nodes when they are selected. * @default true */ readonly elevateNodesOnSelect?: boolean; /** * Enabling this option will raise the z-index of edges when they are selected, * or when the connected nodes are selected. * @default true */ readonly elevateEdgesOnSelect?: boolean; /** * You can use this prop to disable keyboard accessibility features such as selecting nodes or * moving selected nodes with the arrow keys. * @default false */ readonly disableKeyboardA11y?: boolean; /** * If a node is draggable, clicking and dragging that node will move it around the canvas. Adding * the `"nodrag"` class prevents this behavior and this prop allows you to change the name of that * class. * @default "nodrag" */ readonly noDragClass?: string; /** * Typically, scrolling the mouse wheel when the mouse is over the canvas will zoom the viewport. * Adding the `"nowheel"` class to an element n the canvas will prevent this behavior and this prop * allows you to change the name of that class. * @default "nowheel" */ readonly noWheelClass?: string; /** * If an element in the canvas does not stop mouse events from propagating, clicking and dragging * that element will pan the viewport. Adding the `"nopan"` class prevents this behavior and this * prop allows you to change the name of that class. * @default "nopan" */ readonly noPanClass?: string; /** Toggles ability to make connections via clicking the handles */ readonly clickConnect?: boolean; /** * This callback can be used to validate a new connection. * If you return `false`, the edge will not be added to your flow. * If you have custom connection logic its preferred to use this callback over the * `isValidConnection` prop on the handle component for performance reasons. */ /** * Set position of the attribution * @default 'bottom-right' * @example 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' */ readonly attributionPosition?: PanelPosition; /** * By default, we render a small attribution in the corner of your flows that links back to the project. * You are free to remove this attribution but we ask that you take a quick look at our * {@link https://svelteflow.dev/learn/troubleshooting/remove-attribution | removing attribution guide} * before doing so. */ readonly proOptions?: ProOptions; readonly isValidConnection?: IsValidConnection; /** This event handler is called when the user begins to pan or zoom the viewport */ readonly onMoveStart?: OnMoveStart; /** This event handler is called when the user pans or zooms the viewport */ readonly onMove?: OnMove; /** This event handler is called when the user stops panning or zooming the viewport */ readonly onMoveEnd?: OnMoveEnd; /** * Ocassionally something may happen that causes Solid Flow to throw an error. * Instead of exploding your application, we log a message to the console and then call this event handler. * You might use it for additional logging or to show a message to the user. */ readonly onFlowError?: OnError; /** This handler gets called when the user deletes nodes or edges. * @example * onDelete={({nodes, edges}) => { * console.log('deleted nodes:', nodes); * console.log('deleted edges:', edges); * }} */ readonly onDelete?: OnDelete; /** This handler gets called before the user deletes nodes or edges and provides a way to abort the deletion by returning false. */ readonly onBeforeDelete?: OnBeforeDelete; /** This handler gets called when a new edge is created. You can use it to modify the newly created edge. */ readonly onBeforeConnect?: OnBeforeEdgeConnect; /** This event gets fired when a connection successfully completes and an edge is created. */ readonly onConnect?: OnEdgeConnect; /** When a user starts to drag a connection line, this event gets fired. */ readonly onConnectStart?: OnConnectStart; /** When a user stops dragging a connection line, this event gets fired. */ readonly onConnectEnd?: OnConnectEnd; /** This event gets fired when after an edge was reconnected*/ readonly onReconnect?: OnReconnect; /** This event gets fired when a user starts to reconnect an edge */ readonly onReconnectStart?: OnReconnectStart; /** This event gets fired when a user stops reconnecting an edge */ readonly onReconnectEnd?: OnReconnectEnd; /** This handler gets called when an edge is reconnected. You can use it to modify the edge before the update is applied. */ readonly onBeforeReconnect?: OnBeforeReconnect; /** A connection is started by clicking on a handle */ readonly onClickConnectStart?: OnConnectStart; /** A connection is finished by clicking on a handle */ readonly onClickConnectEnd?: OnConnectEnd; /** This handler gets called when the flow is finished initializing */ readonly onInit?: () => void; /** This event handler gets called when the selected nodes & edges change */ readonly onSelectionChange?: OnSelectionChange; /** This event handler gets called when a user starts to drag a selection box. */ readonly onSelectionDragStart?: OnSelectionDrag; /** This event handler gets called when a user drags a selection box. */ readonly onSelectionDrag?: OnSelectionDrag; /** This event handler gets called when a user stops dragging a selection box. */ readonly onSelectionDragStop?: OnSelectionDrag; /** This event handler gets called when the user starts to drag a selection box */ readonly onSelectionStart?: (event: PointerEvent) => void; /** This event handler gets called when the user finishes dragging a selection box */ readonly onSelectionEnd?: (event: PointerEvent) => void; /** * Configuration for customizable labels, descriptions, and UI text. Provided keys will override the corresponding defaults. * Allows localization, customization of ARIA descriptions, control labels, minimap labels, and other UI strings. */ readonly ariaLabelConfig?: Partial; }; type SolidFlowComponentProps = ParentProps> & Omit, "style" | "onselectionchange" | "onSelectionChange">; declare const SolidFlow: (props: SolidFlowComponentProps) => JSX.Element; declare const SolidFlowProvider: (props: ParentProps>) => solid_js.JSX.Element; type ExtractEdgeInfo = T extends (props: EdgeProps) => unknown ? { data: TData; type: TType; } : never; type AllEdgeTypes = TUserEdgeTypes extends Record ? BuiltInEdgeTypes : BuiltInEdgeTypes & TUserEdgeTypes; type EdgesInput = { [K in keyof AllEdgeTypes]: Edge[K]>["data"], ExtractEdgeInfo[K]>["type"]>; }[keyof AllEdgeTypes]; /** * Creates a type-safe reactive store of edges for use in Solid Flow. * * This utility function provides full type safety and autocomplete for creating edges, * combining both built-in edge types (default, straight, step, smoothstep) and custom user-defined * edge types. When a specific edge type is selected, TypeScript automatically infers the * required data structure and validates the edge configuration. * * @template TUserEdgeTypes - The user's custom edge types map (optional) * @param edges - Array of edge configurations to create * @returns A SolidJS store tuple [store, setStore] with properly typed Edge objects * * @example * ```typescript * // Using only built-in edge types (no generic parameter needed) * const [builtInEdges, setBuiltInEdges] = createEdgeStore([ * { * id: "1", * source: "1", * target: "2", * type: "default", * data: { label: "Start" } * }, * { * id: "2", * source: "2", * target: "3", * type: "default", * data: { label: "Process" } * } * ]); * ``` * * @example * ```typescript * // Using custom edge types (requires generic parameter) * const customEdgeTypes = { * textEdge: (props: EdgeProps<{ content: string }, "textEdge">) => *
{props.data.content}
, * numberEdge: (props: EdgeProps<{ value: number }, "numberEdge">) => *
{props.data.value}
* } satisfies EdgeTypes; * * const [mixedEdges, setMixedEdges] = createEdgeStore([ * { * id: "1", * source: "1", * target: "2", * type: "default", // Built-in type * data: { label: "Input" } * }, * { * id: "2", * source: "2", * target: "3", * type: "textEdge", // Custom type - gets autocomplete * data: { content: "Custom text edge" } // Type-safe data * }, * { * id: "3", * source: "3", * target: "4", * type: "numberEdge", // Another custom type * data: { value: 42 }, // Type-safe data * style: { "background-color": "lightblue" } // All Edge properties available * } * ]); * ``` * * @remarks * - Provides autocomplete for the `type` field with all available node types * - Validates `data` structure based on the selected node type * - Supports all Node properties (style, draggable, hidden, etc.) * - Works seamlessly with both built-in and custom node types * - Type errors prevent invalid type names or incorrect data structures */ declare const createEdgeStore: >(edges: EdgesInput[]) => readonly [Store[]>, SetStoreFunction[]>]; type ExtractNodeInfo = T extends (props: NodeProps) => unknown ? { data: TData; type: TType; } : never; type AllNodeTypes = TUserNodeTypes extends Record ? BuiltInNodeTypes : BuiltInNodeTypes & TUserNodeTypes; type NodesInput = { [K in keyof AllNodeTypes]: Node[K]>["data"], ExtractNodeInfo[K]>["type"]>; }[keyof AllNodeTypes]; /** * Creates a type-safe reactive store of nodes for use in Solid Flow. * * This utility function provides full type safety and autocomplete for creating nodes, * combining both built-in node types (input, output, default, group) and custom user-defined * node types. When a specific node type is selected, TypeScript automatically infers the * required data structure and validates the node configuration. * * @template TUserNodeTypes - The user's custom node types map (optional) * @param nodes - Array of node configurations to create * @returns A SolidJS store tuple [store, setStore] with properly typed Node objects * * @example * ```typescript * // Using only built-in node types (no generic parameter needed) * const [builtInNodes, setBuiltInNodes] = createNodeStore([ * { * id: "1", * position: { x: 0, y: 0 }, * type: "input", * data: { label: "Start" } * }, * { * id: "2", * position: { x: 200, y: 100 }, * type: "default", * data: { label: "Process" } * } * ]); * ``` * * @example * ```typescript * // Using custom node types (requires generic parameter) * const customNodeTypes = { * textNode: (props: NodeProps<{ content: string }, "textNode">) => *
{props.data.content}
, * numberNode: (props: NodeProps<{ value: number }, "numberNode">) => *
{props.data.value}
* } satisfies NodeTypes; * * const [mixedNodes, setMixedNodes] = createNodeStore([ * { * id: "1", * position: { x: 0, y: 0 }, * type: "input", // Built-in type * data: { label: "Input" } * }, * { * id: "2", * position: { x: 100, y: 100 }, * type: "textNode", // Custom type - gets autocomplete * data: { content: "Custom text node" } // Type-safe data * }, * { * id: "3", * position: { x: 200, y: 200 }, * type: "numberNode", // Another custom type * data: { value: 42 }, // Type-safe data * style: { "background-color": "lightblue" } // All Node properties available * } * ]); * ``` * * @remarks * - Provides autocomplete for the `type` field with all available node types * - Validates `data` structure based on the selected node type * - Supports all Node properties (style, draggable, hidden, etc.) * - Works seamlessly with both built-in and custom node types * - Type errors prevent invalid type names or incorrect data structures */ declare const createNodeStore: >(nodes: NodesInput[]) => readonly [Store[]>, SetStoreFunction[]>]; /** * Hook for receiving the current connection. * * @public * @returns current connection as a readable store */ declare function useConnection(): Accessor; /** * Hook for getting the current nodes from the store. * * @public * @returns store with an array of nodes */ declare function useNodes(): () => NodeType[]; /** * Hook for getting the current edges from the store. * * @public * @returns store with an array of edges */ declare function useEdges(): () => EdgeType[]; /** * Hook for getting the current viewport from the store. * * @public * @returns store with the viewport object */ declare function useViewport(): () => _xyflow_system.Viewport; declare function useHandleEdgeSelect(): (id: string) => void; /** * Hook to get an internal node by id. * * @public * @param id - the node id * @returns an accessor with an internal node or undefined */ declare function useInternalNode(id: Accessor): Accessor; type UseNodeConnectionsParams = { id?: string; handleType?: HandleType; handleId?: string; }; /** * Hook to retrieve all edges connected to a node. Can be filtered by handle type and id. * * @public * @param param.id - node id - optional if called inside a custom node * @param param.handleType - filter by handle type 'source' or 'target' * @param param.handleId - filter by handle id (this is only needed if the node has multiple handles of the same type) * @todo @param param.onConnect - gets called when a connection is established * @todo @param param.onDisconnect - gets called when a connection is removed * @returns an array with connections */ declare const useNodeConnections: (params: Accessor) => Accessor; type NodeData = Pick; /** * Hook for receiving data of one or multiple nodes * * @param nodeId - The id (or ids) of the node to get the data from * @returns A memo with an array of data objects */ declare function useNodesData(nodeId: Accessor): Accessor | undefined>; declare function useNodesData(nodeIds: Accessor): Accessor[]>; /** * Hook for accessing the SvelteFlow instance. * * @public * @returns A set of helper functions */ declare function useSolidFlow(): { /** * Zooms viewport in by 1.2. * * @param options.duration - optional duration. If set, a transition will be applied */ zoomIn: ZoomInOut; /** * Zooms viewport out by 1 / 1.2. * * @param options.duration - optional duration. If set, a transition will be applied */ zoomOut: ZoomInOut; /** * Returns an internal node by id. * * @param id - the node id * @returns the node or undefined if no node was found */ getInternalNode: (id: string) => InternalNode | undefined; /** * Returns a node by id. * * @param id - the node id * @returns the node or undefined if no node was found */ getNode: (id: string) => NodeType | undefined; /** * Returns nodes. * * @returns nodes array */ getNodes: (ids?: string[]) => NodeType[]; /** * Returns an edge by id. * * @param id - the edge id * @returns the edge or undefined if no edge was found */ getEdge: (id: string) => EdgeType | undefined; /** * Returns edges. * * @returns edges array */ getEdges: (ids?: string[]) => EdgeType[]; /** * Add one or many nodes to your existing nodes array. * * @param payload - the nodes to add */ addNodes: (payload: NodeType[] | NodeType) => void; /** * Add one or many edges to your existing edges array. * * @param payload - the edges to add */ addEdges: (payload: EdgeType[] | EdgeType) => void; /** * Sets the current zoom level. * * @param zoomLevel - the zoom level to set * @param options.duration - optional duration. If set, a transition will be applied */ setZoom: (zoomLevel: number, options?: ViewportHelperFunctionOptions) => Promise; /** * Returns the current zoom level. * * @returns current zoom as a number */ getZoom: () => number; /** * Sets the center of the view to the given position. * * @param x - x position * @param y - y position * @param options.zoom - optional zoom */ setCenter: (x: number, y: number, options?: SetCenterOptions) => Promise; /** * Sets the current viewport. * * @param viewport - the viewport to set * @param options.duration - optional duration. If set, a transition will be applied */ setViewport: (viewport: Viewport, options?: ViewportHelperFunctionOptions) => Promise; /** * Returns the current viewport. * * @returns Viewport */ getViewport: () => Viewport; /** * Fits the view. * * @param options.padding - optional padding * @param options.includeHiddenNodes - optional includeHiddenNodes * @param options.minZoom - optional minZoom * @param options.maxZoom - optional maxZoom * @param options.duration - optional duration. If set, a transition will be applied * @param options.nodes - optional nodes to fit the view to */ fitView: (options?: FitViewOptions) => Promise; /** * Returns all nodes that intersect with the given node or rect. * * @param node - the node or rect to check for intersections * @param partially - if true, the node is considered to be intersecting if it partially overlaps with the passed node or rect * @param nodes - optional nodes array to check for intersections * * @returns an array of intersecting nodes */ getIntersectingNodes: (nodeOrRect: NodeType | { id: NodeType["id"]; } | Rect, partially?: boolean, nodesToIntersect?: NodeType[]) => NodeType[]; /** * Checks if the given node or rect intersects with the passed rect. * * @param node - the node or rect to check for intersections * @param area - the rect to check for intersections * @param partially - if true, the node is considered to be intersecting if it partially overlaps with the passed react * * @returns true if the node or rect intersects with the given area */ isNodeIntersecting: (nodeOrRect: NodeType | { id: NodeType["id"]; } | Rect, area: Rect, partially?: boolean) => boolean; /** * Fits the view to the given bounds . * * @param bounds - the bounds ({ x: number, y: number, width: number, height: number }) to fit the view to * @param options.padding - optional padding */ fitBounds: (bounds: Rect, options?: FitBoundsOptions) => Promise; /** * Deletes nodes and edges. * * @param params.nodes - optional nodes array to delete * @param params.edges - optional edges array to delete * * @returns a promise that resolves with the deleted nodes and edges */ deleteElements: ({ nodes, edges, }: { nodes?: (Partial & { id: string; })[]; edges?: (Partial & { id: string; })[]; }) => Promise<{ deletedNodes: NodeType[]; deletedEdges: EdgeType[]; }>; /** * Converts a screen / client position to a flow position. * * @param clientPosition - the screen / client position. When you are working with events you can use event.clientX and event.clientY * @param options.snapToGrid - if true, the converted position will be snapped to the grid * @returns position as { x: number, y: number } * * @example * const flowPosition = screenToFlowPosition({ x: event.clientX, y: event.clientY }) */ screenToFlowPosition: (clientPosition: XYPosition, options?: { snapToGrid: boolean; }) => XYPosition; /** * Converts a flow position to a screen / client position. * * @param flowPosition - the screen / client position. When you are working with events you can use event.clientX and event.clientY * @returns position as { x: number, y: number } * * @example * const clientPosition = flowToScreenPosition({ x: node.position.x, y: node.position.y }) */ flowToScreenPosition: (flowPosition: XYPosition) => XYPosition; /** * Updates a node. * * @param id - id of the node to update * @param nodeUpdate - the node update as an object or a function that receives the current node and returns the node update * @param options.replace - if true, the node is replaced with the node update, otherwise the changes get merged * * @example * updateNode('node-1', (node) => ({ position: { x: node.position.x + 10, y: node.position.y } })); */ updateNode: (id: string, nodeUpdate: Partial | ((node: NodeType) => Partial), options?: { replace: boolean; }) => void; /** * Updates the data attribute of a node. * * @param id - id of the node to update * @param dataUpdate - the data update as an object or a function that receives the current data and returns the data update * @param options.replace - if true, the data is replaced with the data update, otherwise the changes get merged * * @example * updateNodeData('node-1', { label: 'A new label' }); */ updateNodeData: (id: string, dataUpdate: Partial | ((node: NodeType) => Partial), options?: { replace: boolean; }) => void; /** * Returns the nodes, edges and the viewport as a JSON object. * * @returns the nodes, edges and the viewport as a JSON object */ /** * Updates an edge. * * @param id - id of the edge to update * @param edgeUpdate - the edge update as an object or a function that receives the current edge and returns the edge update * @param options.replace - if true, the edge is replaced with the edge update, otherwise the changes get merged * * @example * updateNode('node-1', (node) => ({ position: { x: node.position.x + 10, y: node.position.y } })); */ updateEdge: (id: string, edgeUpdate: Partial | ((edge: EdgeType) => Partial), options?: { replace: boolean; }) => void; toObject: () => { nodes: NodeType[]; edges: EdgeType[]; viewport: Viewport; }; /** * Returns the bounds of the given nodes or node ids. * * @param nodes - the nodes or node ids to calculate the bounds for * * @returns the bounds of the given nodes */ getNodesBounds: (nodes: (NodeType | InternalNode | string)[]) => Rect; /** Gets all connections for a given handle belonging to a specific node. * * @param type - handle type 'source' or 'target' * @param id - the handle id (this is only needed if you have multiple handles of the same type, meaning you have to provide a unique id for each handle) * @param nodeId - the node id the handle belongs to * @returns an array with handle connections */ getHandleConnections: ({ type, id, nodeId, }: { type: HandleType; nodeId: string; id?: string | null; }) => HandleConnection[]; }; /** * Hook for updating node internals. * * @public * @returns function for updating node internals */ declare function useUpdateNodeInternals(): UpdateNodeInternals; export { Background, type BackgroundProps, type BackgroundVariant, BaseEdge, BezierEdge, BezierEdgeInternal, type BezierEdgeProps, type BuiltInEdge, type BuiltInNode, type BuiltInNodeTypes, type ConnectionData, ConnectionLine, type ConnectionLineComponentProps, ControlButton, Controls, type DefaultEdgeOptions, DefaultNode, type DeleteEvents, type Edge, type EdgeConnection, type EdgeEvents, EdgeLabel, EdgeLabelRenderer, type EdgeProps, EdgeReconnectAnchor, type EdgeReconnectEvents, EdgeRenderer, type EdgeTypes, EdgeWrapper, type FitViewOptions, GroupNode, Handle, InputNode, type InternalNode, type KeyDefinition, type KeyDefinitionObject, type KeyModifier, Marker, MarkerDefinition, MiniMap, type Node, type NodeEvents, type NodeGraph, type NodeProps, NodeRenderer, NodeResizer, NodeSelection, type NodeSelectionEvents, NodeToolbar, type NodeToolbarProps, type NodeTypes, NodeWrapper, type OnBeforeDelete, type OnBeforeEdgeConnect, type OnBeforeReconnect, type OnDelete, type OnEdgeConnect, type OnEdgeCreate, type OnSelectionChange, OutputNode, Pane, type PaneEvents, Panel, ResizeControl, Selection, type ShortcutModifier, type ShortcutModifierDefinition, SmoothStepEdge, SmoothStepEdgeInternal, type SmoothStepEdgeProps, SolidFlow, SolidFlowProvider, StepEdge, StepEdgeInternal, type StepEdgeProps, StraightEdge, StraightEdgeInternal, type StraightEdgeProps, ViewportPortal, Zoom, createEdgeStore, createNodeStore, useConnection, useEdges, useHandleEdgeSelect, useInternalNode, useNodeConnections, useNodes, useNodesData, useSolidFlow, useUpdateNodeInternals, useViewport };