@dschz/solid-flow 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1582 @@
1
+ import * as solid_js from 'solid-js';
2
+ import { JSX, ParentProps, ParentComponent, Accessor } from 'solid-js';
3
+ import * as _xyflow_system from '@xyflow/system';
4
+ 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';
5
+ 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';
6
+ import { Store, SetStoreFunction } from 'solid-js/store';
7
+
8
+ /**
9
+ * The node data structure that gets used for internal nodes.
10
+ * There are some data structures added under node.internal
11
+ * that are needed for tracking some properties
12
+ * @public
13
+ */
14
+ type InternalNode<NodeType extends Node = Node> = InternalNodeBase<NodeType>;
15
+ /**
16
+ * The node data structure that gets used for the nodes prop.
17
+ * @public
18
+ */
19
+ type Node<NodeData extends UnknownStruct = UnknownStruct, NodeType extends string | undefined = string | undefined> = NodeBase<NodeData, NodeType> & {
20
+ class?: string;
21
+ style?: JSX.CSSProperties;
22
+ focusable?: boolean;
23
+ /**
24
+ * The ARIA role attribute for the node element, used for accessibility.
25
+ * @default "group"
26
+ */
27
+ ariaRole?: JSX.HTMLAttributes<HTMLDivElement>["role"];
28
+ /**
29
+ * General escape hatch for adding custom attributes to the node's DOM element.
30
+ */
31
+ domAttributes?: Omit<JSX.HTMLAttributes<HTMLDivElement>, "id" | "style" | "class" | "draggable" | "role" | "aria-label" | keyof JSX.HTMLAttributes<HTMLDivElement>>;
32
+ };
33
+ type NodeProps<TData extends UnknownStruct = UnknownStruct, TType extends string | undefined = string | undefined> = NodeProps$1<Node<TData, TType>>;
34
+ /**
35
+ * Map of node types to their components.
36
+ */
37
+ type NodeTypes = {
38
+ [K in string]: {
39
+ bivarianceHack(props: NodeProps<Record<string, unknown>, string | undefined>): JSX.Element;
40
+ }["bivarianceHack"];
41
+ };
42
+ type BuiltInNode = Node<{
43
+ label: string;
44
+ }, "input" | "output" | "default"> | Node<Record<string, never>, "group">;
45
+ type BuiltInNodeTypes = {
46
+ input: (props: NodeProps<{
47
+ label: string;
48
+ }, "input">) => JSX.Element;
49
+ output: (props: NodeProps<{
50
+ label: string;
51
+ }, "output">) => JSX.Element;
52
+ default: (props: NodeProps<{
53
+ label: string;
54
+ }, "default">) => JSX.Element;
55
+ group: (props: NodeProps<Record<string, never>, "group">) => JSX.Element;
56
+ };
57
+
58
+ type UnknownStruct = Record<string, unknown>;
59
+
60
+ /**
61
+ * An `Edge` is the complete description with everything Svelte Flow needs to know in order to
62
+ * render it.
63
+ * @public
64
+ */
65
+ type Edge<EdgeData extends UnknownStruct = UnknownStruct, EdgeType extends string | undefined = string | undefined> = EdgeBase<EdgeData, EdgeType> & {
66
+ label?: string;
67
+ labelStyle?: JSX.CSSProperties;
68
+ style?: JSX.CSSProperties;
69
+ class?: string;
70
+ focusable?: boolean;
71
+ /**
72
+ * The ARIA role attribute for the edge, used for accessibility.
73
+ * @default "group"
74
+ */
75
+ ariaRole?: JSX.HTMLAttributes<HTMLElement>["role"];
76
+ /**
77
+ * General escape hatch for adding custom attributes to the edge's DOM element.
78
+ */
79
+ domAttributes?: Omit<JSX.SvgSVGAttributes<SVGGElement>, "id" | "style" | "class" | "role" | "aria-label">;
80
+ };
81
+ /**
82
+ * Props passed to edge components. This is the main interface that custom edge components should implement.
83
+ */
84
+ type EdgeProps<EdgeData extends UnknownStruct = UnknownStruct, EdgeType extends string | undefined = string | undefined> = Omit<Edge<EdgeData, EdgeType>, "sourceHandle" | "targetHandle"> & EdgePosition & {
85
+ markerStart?: string;
86
+ markerEnd?: string;
87
+ sourceHandleId?: string | null;
88
+ targetHandleId?: string | null;
89
+ };
90
+ /**
91
+ * Props for built-in edge components that render the actual SVG path.
92
+ */
93
+ type BaseEdgeProps = {
94
+ /** SVG path of the edge */
95
+ path: string;
96
+ /** The x coordinate of the label */
97
+ labelX?: number;
98
+ /** The y coordinate of the label */
99
+ labelY?: number;
100
+ /** Marker at start of edge */
101
+ markerStart?: string;
102
+ /** Marker at end of edge */
103
+ markerEnd?: string;
104
+ /** CSS class for the edge */
105
+ class?: string;
106
+ /** Edge label */
107
+ label?: string;
108
+ /** Styles for the edge label */
109
+ labelStyle?: JSX.CSSProperties;
110
+ /** Styles for the edge path */
111
+ style?: JSX.CSSProperties;
112
+ /** Interaction width for edge selection */
113
+ interactionWidth?: number;
114
+ } & JSX.SvgSVGAttributes<SVGPathElement>;
115
+ /**
116
+ * Props for built-in edge components (these match the actual component implementations)
117
+ */
118
+ type BezierEdgeProps = EdgeProps<Record<string, unknown>, "default"> & {
119
+ pathOptions?: BezierPathOptions;
120
+ };
121
+ type StraightEdgeProps = Omit<EdgeProps<Record<string, unknown>, "straight">, "sourcePosition" | "targetPosition">;
122
+ type StepEdgeProps = EdgeProps<Record<string, unknown>, "step"> & {
123
+ pathOptions?: StepPathOptions;
124
+ };
125
+ type SmoothStepEdgeProps = EdgeProps<Record<string, unknown>, "smoothstep"> & {
126
+ pathOptions?: SmoothStepPathOptions;
127
+ };
128
+ /**
129
+ * Built-in edge types with their component signatures
130
+ */
131
+ type BuiltInEdgeTypes = {
132
+ default: (props: BezierEdgeProps) => JSX.Element;
133
+ straight: (props: StraightEdgeProps) => JSX.Element;
134
+ step: (props: StepEdgeProps) => JSX.Element;
135
+ smoothstep: (props: SmoothStepEdgeProps) => JSX.Element;
136
+ };
137
+ /**
138
+ * Union of all built-in edge props
139
+ */
140
+ type BuiltInEdge = BezierEdgeProps | StraightEdgeProps | StepEdgeProps | SmoothStepEdgeProps;
141
+ /**
142
+ * Map of edge types to their components.
143
+ */
144
+ type EdgeTypes = {
145
+ [K in string]: {
146
+ bivarianceHack(props: EdgeProps<Record<string, unknown>, string | undefined>): JSX.Element;
147
+ }["bivarianceHack"];
148
+ };
149
+ type DefaultEdgeOptions = DefaultEdgeOptionsBase<Edge>;
150
+
151
+ type NodeEventWithPointer<T = PointerEvent, NodeType extends Node = Node> = ({ node, event, }: {
152
+ node: NodeType;
153
+ event: T;
154
+ }) => void;
155
+ type NodesEventWithPointer<T = PointerEvent, NodeType extends Node = Node> = ({ nodes, event, }: {
156
+ nodes: NodeType[];
157
+ event: T;
158
+ }) => void;
159
+ type NodeTargetEventWithPointer<T = PointerEvent, NodeType extends Node = Node> = ({ targetNode, nodes, event, }: {
160
+ targetNode: NodeType | null;
161
+ nodes: NodeType[];
162
+ event: T;
163
+ }) => void;
164
+ type NodeEvents<NodeType extends Node = Node> = {
165
+ /** This event handler is called when a user clicks on a node. */
166
+ onNodeClick?: NodeEventWithPointer<MouseEvent | TouchEvent, NodeType>;
167
+ /** This event handler is called when a user right-clicks on a node. */
168
+ onNodeContextMenu?: NodeEventWithPointer<MouseEvent, NodeType>;
169
+ /** This event handler is called when a user drags a node. */
170
+ onNodeDrag?: NodeTargetEventWithPointer<MouseEvent | TouchEvent, NodeType>;
171
+ /** This event handler is called when a user starts to drag a node. */
172
+ onNodeDragStart?: NodeTargetEventWithPointer<MouseEvent | TouchEvent, NodeType>;
173
+ /** This event handler is called when a user stops dragging a node. */
174
+ onNodeDragStop?: NodeTargetEventWithPointer<MouseEvent | TouchEvent, NodeType>;
175
+ /** This event handler is called when the pointer of a user enters a node. */
176
+ onNodePointerEnter?: NodeEventWithPointer<PointerEvent, NodeType>;
177
+ /** This event handler is called when the pointer of a user leaves a node. */
178
+ onNodePointerLeave?: NodeEventWithPointer<PointerEvent, NodeType>;
179
+ /** This event handler is called when the pointer of a user moves over a node. */
180
+ onNodePointerMove?: NodeEventWithPointer<PointerEvent, NodeType>;
181
+ };
182
+ type NodeSelectionEvents<NodeType extends Node = Node> = {
183
+ /** This event handler is called when a user right-clicks the selection box. */
184
+ onSelectionContextMenu?: NodesEventWithPointer<PointerEvent, NodeType>;
185
+ /** This event handler is called when a user clicks the selection box. */
186
+ onSelectionClick?: NodesEventWithPointer<MouseEvent, NodeType>;
187
+ };
188
+ type PaneEvents = {
189
+ /** This event handler is called when a user clicks the pane. */
190
+ onPaneClick?: ({ event }: {
191
+ event: MouseEvent;
192
+ }) => void;
193
+ /** This event handler is called when a user right-clicks the pane. */
194
+ onPaneContextMenu?: ({ event }: {
195
+ event: PointerEvent;
196
+ }) => void;
197
+ };
198
+ type EdgeEvents<EdgeType extends Edge = Edge> = {
199
+ /** This event handler is called when a user clicks an edge. */
200
+ onEdgeClick?: ({ edge, event }: {
201
+ edge: EdgeType;
202
+ event: MouseEvent;
203
+ }) => void;
204
+ /** This event handler is called when a user right-clicks an edge. */
205
+ onEdgeContextMenu?: ({ edge, event }: {
206
+ edge: EdgeType;
207
+ event: PointerEvent;
208
+ }) => void;
209
+ /** This event handler is called when the pointer of a user enters an edge. */
210
+ onEdgePointerEnter?: ({ edge, event }: {
211
+ edge: EdgeType;
212
+ event: PointerEvent;
213
+ }) => void;
214
+ /** This event handler is called when the pointer of a user enters an edge. */
215
+ onEdgePointerLeave?: ({ edge, event }: {
216
+ edge: EdgeType;
217
+ event: PointerEvent;
218
+ }) => void;
219
+ };
220
+ type DeleteEvents<NodeType extends Node = Node, EdgeType extends Edge = Edge> = {
221
+ onNodesDelete?: (nodes: NodeType[]) => void;
222
+ onEdgesDelete?: (edges: EdgeType[]) => void;
223
+ };
224
+ type EdgeReconnectEvents<EdgeType extends Edge = Edge> = {
225
+ /**
226
+ * This handler is called when the source or target of a reconnectable edge is dragged from the
227
+ * current node. It will fire even if the edge's source or target do not end up changing.
228
+ * You can use the `reconnectEdge` utility to convert the connection to a new edge.
229
+ */
230
+ onReconnect?: OnReconnect<EdgeType>;
231
+ /**
232
+ * This event fires when the user begins dragging the source or target of an editable edge.
233
+ */
234
+ onReconnectStart?: (event: MouseEvent | TouchEvent, edge: EdgeType, handleType: HandleType) => void;
235
+ /**
236
+ * This event fires when the user releases the source or target of an editable edge. It is called
237
+ * even if an edge update does not occur.
238
+ */
239
+ onReconnectEnd?: (event: MouseEvent | TouchEvent, edge: EdgeType, handleType: HandleType, connectionState: FinalConnectionState) => void;
240
+ };
241
+ type OnSelectionDrag<NodeType extends Node = Node> = (event: MouseEvent, nodes: NodeType[]) => void;
242
+
243
+ type Position = `${Position$1}`;
244
+ type ConnectionMode = `${ConnectionMode$1}`;
245
+ type ConnectionLineType$1 = `${ConnectionLineType$2}`;
246
+ type SelectionMode = `${SelectionMode$1}`;
247
+ type PanOnScrollMode = `${PanOnScrollMode$1}`;
248
+ type ResizeControlVariant = `${ResizeControlVariant$1}`;
249
+ type ShortcutModifier = "alt" | "ctrl" | "meta" | "shift";
250
+ type ShortcutModifierDefinition = null | false | ShortcutModifier | (ShortcutModifier | ShortcutModifier[])[];
251
+ type KeyModifier = ShortcutModifierDefinition;
252
+ type KeyDefinitionObject = {
253
+ key: string;
254
+ modifier?: KeyModifier;
255
+ };
256
+ type KeyDefinition = string | KeyDefinitionObject;
257
+ type ConnectionData = {
258
+ connectionPosition: XYPosition | null;
259
+ connectionStartHandle: Handle$1 | null;
260
+ connectionEndHandle: Handle$1 | null;
261
+ connectionStatus: string | null;
262
+ };
263
+ type FitViewOptions<NodeType extends Node = Node> = FitViewOptionsBase<NodeType>;
264
+ type OnDelete<NodeType extends Node = Node, EdgeType extends Edge = Edge> = (params: {
265
+ nodes: NodeType[];
266
+ edges: EdgeType[];
267
+ }) => void;
268
+ type EdgeConnection = Connection & {
269
+ id: string;
270
+ };
271
+ /** Callback that gets called before a handle connection is created. */
272
+ type OnBeforeEdgeConnect<EdgeType extends Edge = Edge> = (connection: EdgeConnection) => EdgeType | EdgeConnection | undefined;
273
+ /** Callback that gets called after a handle connection is created. */
274
+ type OnEdgeConnect = (connection: EdgeConnection) => void;
275
+ type OnBeforeReconnect<EdgeType extends Edge = Edge> = (newEdge: EdgeType, oldEdge: EdgeType) => EdgeType | undefined;
276
+ type OnBeforeDelete<NodeType extends Node = Node, EdgeType extends Edge = Edge> = OnBeforeDeleteBase<NodeType, EdgeType>;
277
+ type OnSelectionChange<NodeType extends Node = Node, EdgeType extends Edge = Edge> = (params: {
278
+ nodes: NodeType[];
279
+ edges: EdgeType[];
280
+ }) => void;
281
+ type NodeGraph<NodeType extends Node = Node, EdgeType extends Edge = Edge> = {
282
+ readonly nodes: NodeType[];
283
+ readonly edges: EdgeType[];
284
+ };
285
+ type OnEdgeCreate<EdgeType extends Edge = Edge> = (connection: Connection) => EdgeType | Connection;
286
+
287
+ type EdgeRendererProps<EdgeType extends Edge = Edge> = EdgeEvents<EdgeType> & {
288
+ readonly defaultEdgeOptions?: DefaultEdgeOptions;
289
+ readonly reconnectRadius: number;
290
+ };
291
+ declare const EdgeRenderer: <NodeType extends Node = Node, EdgeType extends Edge = Edge>(props: EdgeRendererProps<EdgeType>) => solid_js.JSX.Element;
292
+
293
+ type NodeRendererProps<NodeType extends Node = Node> = NodeEvents<NodeType> & {
294
+ readonly nodeClickDistance: number;
295
+ };
296
+ declare const NodeRenderer: <NodeType extends Node = Node>(props: NodeRendererProps<NodeType>) => solid_js.JSX.Element;
297
+
298
+ type PaneProps = PaneEvents & {
299
+ readonly panOnDrag?: boolean | number[];
300
+ readonly selectionOnDrag?: boolean;
301
+ readonly onSelectionStart?: (event: PointerEvent) => void;
302
+ readonly onSelectionEnd?: (event: PointerEvent) => void;
303
+ };
304
+ declare const Pane: <NodeType extends Node = Node, EdgeType extends Edge = Edge>(props: ParentProps<PaneProps>) => JSX.Element;
305
+
306
+ type PanelProps = Omit<JSX.HTMLAttributes<HTMLDivElement>, "style"> & {
307
+ /** Set position of the panel
308
+ * @example 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'
309
+ */
310
+ readonly position?: PanelPosition;
311
+ readonly style?: JSX.CSSProperties;
312
+ readonly "data-testid"?: string;
313
+ readonly "data-message"?: string;
314
+ };
315
+ declare const Panel: (props: ParentProps<PanelProps>) => JSX.Element;
316
+
317
+ declare const ViewportPortal: (props: ParentProps) => solid_js.JSX.Element;
318
+
319
+ type ZoomProps = {
320
+ readonly initialViewport?: Viewport;
321
+ readonly panOnScrollMode: PanOnScrollMode;
322
+ readonly onMove?: OnMove;
323
+ readonly onMoveStart?: OnMoveStart;
324
+ readonly onMoveEnd?: OnMoveEnd;
325
+ readonly onViewportInitialized?: () => void;
326
+ readonly preventScrolling: boolean;
327
+ readonly zoomOnScroll: boolean;
328
+ readonly zoomOnDoubleClick: boolean;
329
+ readonly zoomOnPinch: boolean;
330
+ readonly panOnScroll: boolean;
331
+ readonly panOnDrag: boolean | number[];
332
+ readonly paneClickDistance: number;
333
+ };
334
+ declare const Zoom: (props: ParentProps<ZoomProps>) => solid_js.JSX.Element;
335
+
336
+ type ConnectionLineType = `${ConnectionLineType$2}`;
337
+ /**
338
+ * If you want to render a custom component for connection lines, you can set the
339
+ * `connectionLineComponent` prop on the [`<SolidFlow />`](/api-reference/react-flow#connection-connectionLineComponent)
340
+ * component. The `ConnectionLineComponentProps` are passed to your custom component.
341
+ *
342
+ * @public
343
+ */
344
+ type ConnectionLineComponentProps<NodeType extends Node = Node> = {
345
+ readonly connectionLineStyle?: JSX.CSSProperties;
346
+ readonly connectionLineType: ConnectionLineType;
347
+ readonly fromNode: InternalNode<NodeType>;
348
+ readonly fromHandle: Handle$1;
349
+ readonly fromX: number;
350
+ readonly fromY: number;
351
+ readonly toX: number;
352
+ readonly toY: number;
353
+ readonly fromPosition: Position;
354
+ readonly toPosition: Position;
355
+ readonly connectionStatus: "valid" | "invalid" | null;
356
+ readonly toNode: InternalNode<NodeType> | null;
357
+ readonly toHandle: Handle$1 | null;
358
+ };
359
+
360
+ type ConnectionLineProps<NodeType extends Node = Node> = {
361
+ readonly style: JSX.CSSProperties;
362
+ readonly type: ConnectionLineType;
363
+ readonly component: (props: ConnectionLineComponentProps<NodeType>) => JSX.Element;
364
+ readonly containerStyle: string | JSX.CSSProperties;
365
+ };
366
+ declare const ConnectionLine: <NodeType extends Node = Node>(props: ParentProps<Partial<ConnectionLineProps<NodeType>>>) => JSX.Element;
367
+
368
+ declare const BaseEdge: (props: ParentProps<BaseEdgeProps>) => solid_js.JSX.Element;
369
+
370
+ declare const BezierEdge: (props: BezierEdgeProps) => solid_js.JSX.Element;
371
+
372
+ declare const BezierEdgeInternal: (props: BezierEdgeProps) => solid_js.JSX.Element;
373
+
374
+ type EdgeLabelProps = {
375
+ readonly x?: number;
376
+ readonly y?: number;
377
+ readonly width?: number;
378
+ readonly height?: number;
379
+ readonly selectEdgeOnClick?: boolean;
380
+ readonly transparent?: boolean;
381
+ readonly style?: JSX.CSSProperties;
382
+ } & Omit<JSX.HTMLAttributes<HTMLDivElement>, "style">;
383
+ declare const EdgeLabel: (props: ParentProps<EdgeLabelProps>) => JSX.Element;
384
+
385
+ declare const EdgeLabelRenderer: (props: ParentProps) => solid_js.JSX.Element;
386
+
387
+ type EdgeReconnectAnchorProps = {
388
+ readonly type: HandleType;
389
+ readonly class?: string;
390
+ readonly style?: JSX.CSSProperties;
391
+ readonly position?: XYPosition;
392
+ readonly size?: number;
393
+ readonly reconnecting?: boolean;
394
+ } & Omit<JSX.HTMLAttributes<HTMLDivElement>, "style">;
395
+ declare const EdgeReconnectAnchor: (props: ParentProps<EdgeReconnectAnchorProps>) => JSX.Element;
396
+
397
+ type EdgeWrapperProps<EdgeType extends Edge = Edge> = EdgeEvents<EdgeType> & {
398
+ readonly edgeId: string;
399
+ };
400
+ declare const EdgeWrapper: <NodeType extends Node = Node, EdgeType extends Edge = Edge>(props: EdgeWrapperProps<EdgeType>) => solid_js.JSX.Element;
401
+
402
+ declare const SmoothStepEdge: (props: SmoothStepEdgeProps) => solid_js.JSX.Element;
403
+
404
+ declare const SmoothStepEdgeInternal: (props: SmoothStepEdgeProps) => solid_js.JSX.Element;
405
+
406
+ declare const StepEdge: (props: StepEdgeProps) => solid_js.JSX.Element;
407
+
408
+ declare const StepEdgeInternal: (props: StepEdgeProps) => solid_js.JSX.Element;
409
+
410
+ declare const StraightEdge: (props: StraightEdgeProps) => solid_js.JSX.Element;
411
+
412
+ declare const StraightEdgeInternal: (props: Omit<StraightEdgeProps, "sourcePosition" | "targetPosition">) => solid_js.JSX.Element;
413
+
414
+ type HandleProps = Omit<HandleProps$1, "position"> & {
415
+ readonly position: Position;
416
+ readonly class?: string;
417
+ readonly style?: JSX.CSSProperties;
418
+ readonly onConnect?: (connections: Connection[]) => void;
419
+ readonly onDisconnect?: (connections: Connection[]) => void;
420
+ } & Omit<JSX.HTMLAttributes<HTMLDivElement>, "style">;
421
+ declare const Handle: <NodeType extends Node = Node, EdgeType extends Edge = Edge>(props: ParentProps<HandleProps>) => JSX.Element;
422
+
423
+ type MarkerProps = MarkerProps$1 & {
424
+ readonly markerUnits?: "strokeWidth" | "userSpaceOnUse";
425
+ readonly strokeWidth?: number;
426
+ };
427
+ declare const Marker: (props: MarkerProps) => JSX.Element;
428
+
429
+ declare const MarkerDefinition: () => solid_js.JSX.Element;
430
+
431
+ declare const DefaultNode: (props: NodeProps<{
432
+ label: string;
433
+ }, "default">) => solid_js.JSX.Element;
434
+
435
+ declare const GroupNode: (props: NodeProps<Record<string, never>>) => solid_js.JSX.Element;
436
+
437
+ declare const InputNode: (props: NodeProps<{
438
+ label: string;
439
+ }>) => solid_js.JSX.Element;
440
+
441
+ type NodeWrapperProps<NodeType extends Node = Node> = NodeEvents<NodeType> & {
442
+ readonly nodeId: string;
443
+ readonly resizeObserver: ResizeObserver;
444
+ readonly nodeClickDistance: number;
445
+ };
446
+ declare const NodeWrapper: <NodeType extends Node = Node>(props: NodeWrapperProps<NodeType>) => solid_js.JSX.Element;
447
+
448
+ declare const OutputNode: (props: NodeProps<{
449
+ label: string;
450
+ }>) => solid_js.JSX.Element;
451
+
452
+ type BackgroundVariant = "lines" | "dots" | "cross";
453
+
454
+ type BackgroundProps = {
455
+ readonly id?: string;
456
+ /** Variant of the pattern
457
+ * @example 'lines', 'dots', 'cross'
458
+ */
459
+ readonly variant?: BackgroundVariant;
460
+ /** Color of the background */
461
+ readonly bgColor?: string;
462
+ /** Color of the pattern */
463
+ readonly patternColor?: string;
464
+ /** Class applied to the pattern */
465
+ readonly patternClass?: string;
466
+ /** Class applied to the container */
467
+ readonly class?: string;
468
+ /** Gap between repetitions of the pattern */
469
+ readonly gap?: number | [number, number];
470
+ /** Size of a single pattern element */
471
+ readonly size?: number;
472
+ /** Line width of the Line pattern */
473
+ readonly lineWidth?: number;
474
+ /** Style applied to the container */
475
+ readonly style?: JSX.CSSProperties;
476
+ };
477
+ declare const Background: (props: BackgroundProps) => JSX.Element;
478
+
479
+ type ControlButtonProps = Omit<JSX.ButtonHTMLAttributes<HTMLButtonElement>, "onClick"> & {
480
+ readonly class?: string;
481
+ readonly bgColor?: string;
482
+ readonly bgColorHover?: string;
483
+ readonly color?: string;
484
+ readonly colorHover?: string;
485
+ readonly borderColor?: string;
486
+ readonly onClick?: JSX.EventHandler<HTMLButtonElement, MouseEvent>;
487
+ };
488
+ declare const ControlButton: (props: ParentProps<ControlButtonProps>) => JSX.Element;
489
+
490
+ type ControlsOrientation = "horizontal" | "vertical";
491
+ type ControlsProps = {
492
+ /** Position of the controls on the pane
493
+ * @example PanelPosition.TopLeft, PanelPosition.TopRight,
494
+ * PanelPosition.BottomLeft, PanelPosition.BottomRight
495
+ */
496
+ readonly position?: PanelPosition;
497
+ /** Show button for zoom in/out */
498
+ readonly showZoom?: boolean;
499
+ /** Show button for fit view */
500
+ readonly showFitView?: boolean;
501
+ /** Show button for toggling interactivity */
502
+ readonly showLock?: boolean;
503
+ readonly buttonBgColor?: string;
504
+ readonly buttonBgColorHover?: string;
505
+ readonly buttonColor?: string;
506
+ readonly buttonColorHover?: string;
507
+ readonly buttonBorderColor?: string;
508
+ readonly style?: JSX.CSSProperties;
509
+ readonly orientation?: ControlsOrientation;
510
+ readonly fitViewOptions?: FitViewOptions;
511
+ readonly beforeControls?: JSX.Element;
512
+ readonly afterControls?: JSX.Element;
513
+ } & Omit<JSX.HTMLAttributes<HTMLDivElement>, "style">;
514
+ declare const Controls: (props: ParentProps<ControlsProps>) => JSX.Element;
515
+
516
+ type GetMiniMapNodeAttribute<NodeType extends Node> = (node: NodeType) => string;
517
+ type MiniMapProps<NodeType extends Node> = Omit<JSX.HTMLAttributes<HTMLDivElement>, "style"> & {
518
+ /** Background color of minimap */
519
+ readonly bgColor?: string;
520
+ /** Color of nodes on the minimap */
521
+ readonly nodeColor?: string | GetMiniMapNodeAttribute<NodeType>;
522
+ /** Stroke color of nodes on the minimap */
523
+ readonly nodeStrokeColor?: string | GetMiniMapNodeAttribute<NodeType>;
524
+ /** Class applied to nodes on the minimap */
525
+ readonly nodeClass?: string | GetMiniMapNodeAttribute<NodeType>;
526
+ /** Border radius of nodes on the minimap */
527
+ readonly nodeBorderRadius?: number;
528
+ /** Stroke width of nodes on the minimap */
529
+ readonly nodeStrokeWidth?: number;
530
+ /** Color of the mask representing viewport */
531
+ readonly maskColor?: string;
532
+ /** Stroke color of the mask representing viewport */
533
+ readonly maskStrokeColor?: string;
534
+ /** Stroke width of the mask representing viewport */
535
+ readonly maskStrokeWidth?: number;
536
+ /** Position of the minimap on the pane
537
+ * @example PanelPosition.TopLeft, PanelPosition.TopRight,
538
+ * PanelPosition.BottomLeft, PanelPosition.BottomRight
539
+ */
540
+ readonly position?: PanelPosition;
541
+ /** Style applied to container */
542
+ readonly style?: JSX.CSSProperties;
543
+ /** The aria-label applied to container */
544
+ readonly ariaLabel?: string | null;
545
+ /** Width of minimap */
546
+ readonly width?: number;
547
+ /** Height of minimap */
548
+ readonly height?: number;
549
+ readonly pannable?: boolean;
550
+ readonly zoomable?: boolean;
551
+ /** Invert the direction when panning the minimap viewport */
552
+ readonly inversePan?: boolean;
553
+ /** Step size for zooming in/out */
554
+ readonly zoomStep?: number;
555
+ };
556
+ declare const MiniMap: <NodeType extends Node>(props: ParentProps<Partial<MiniMapProps<NodeType>>>) => JSX.Element;
557
+
558
+ type NodeResizerProps = {
559
+ /** Id of the node it is resizing
560
+ * @remarks optional if used inside custom node
561
+ */
562
+ readonly nodeId?: string;
563
+ /** Class applied to handle */
564
+ readonly handleClass?: string;
565
+ /** Style applied to handle */
566
+ readonly handleStyle?: JSX.CSSProperties;
567
+ /** Class applied to line */
568
+ readonly lineClass?: string;
569
+ /** Style applied to line */
570
+ readonly lineStyle?: JSX.CSSProperties;
571
+ /** Are the controls visible */
572
+ readonly visible?: boolean;
573
+ /** Minimum width of node */
574
+ readonly minWidth?: number;
575
+ /** Minimum height of node */
576
+ readonly minHeight?: number;
577
+ /** Maximum width of node */
578
+ readonly maxWidth?: number;
579
+ /** Maximum height of node */
580
+ readonly maxHeight?: number;
581
+ /** Keep aspect ratio when resizing */
582
+ readonly keepAspectRatio?: boolean;
583
+ /** Automatically scale the node when resizing */
584
+ readonly autoScale?: boolean;
585
+ /** Callback to determine if node should resize */
586
+ readonly shouldResize?: ShouldResize;
587
+ /** Callback called when resizing starts */
588
+ readonly onResizeStart?: OnResizeStart;
589
+ /** Callback called when resizing */
590
+ readonly onResize?: OnResize;
591
+ /** Callback called when resizing ends */
592
+ readonly onResizeEnd?: OnResizeEnd;
593
+ } & Omit<JSX.HTMLAttributes<HTMLDivElement>, "onResize" | "style">;
594
+ declare const NodeResizer: (props: Partial<NodeResizerProps>) => JSX.Element;
595
+
596
+ type NodeResizerSubProps = Pick<NodeResizerProps, "nodeId" | "minWidth" | "minHeight" | "maxWidth" | "maxHeight" | "autoScale" | "keepAspectRatio" | "shouldResize" | "onResizeStart" | "onResize" | "onResizeEnd">;
597
+ type ResizeControlProps = NodeResizerSubProps & {
598
+ /** Position of control
599
+ * @example ControlPosition.TopLeft, ControlPosition.TopRight,
600
+ * ControlPosition.BottomLeft, ControlPosition.BottomRight
601
+ */
602
+ readonly position?: ControlPosition;
603
+ /** Variant of control
604
+ * @example ResizeControlVariant.Handle, ResizeControlVariant.Line
605
+ */
606
+ readonly variant?: ResizeControlVariant;
607
+ readonly style?: JSX.CSSProperties;
608
+ } & Omit<JSX.HTMLAttributes<HTMLDivElement>, "onResize" | "style">;
609
+ declare const ResizeControl: <NodeType extends Node = Node>(props: ParentProps<ResizeControlProps>) => JSX.Element;
610
+
611
+ type NodeToolbarProps = Omit<JSX.HTMLAttributes<HTMLDivElement>, "style"> & {
612
+ /** The id of the node, or array of ids the toolbar should be displayed at */
613
+ readonly nodeId: string | string[];
614
+ /** Position of the toolbar relative to the node
615
+ * @example Position.TopLeft, Position.TopRight,
616
+ * Position.BottomLeft, Position.BottomRight
617
+ */
618
+ readonly position: Position;
619
+ /** Align the toolbar relative to the node
620
+ * @example Align.Start, Align.Center, Align.End
621
+ */
622
+ readonly align: Align;
623
+ /** Offset the toolbar from the node */
624
+ readonly offset: number;
625
+ /** If true, node toolbar is visible even if node is not selected */
626
+ readonly isVisible: boolean;
627
+ /** Style of the toolbar */
628
+ readonly style: Omit<JSX.CSSProperties, "z-index" | "position" | "transform">;
629
+ };
630
+ declare const NodeToolbar: ParentComponent<Partial<NodeToolbarProps>>;
631
+
632
+ type NodeSelectionProps<NodeType extends Node = Node> = NodeSelectionEvents<NodeType> & Pick<NodeEvents<NodeType>, "onNodeDrag" | "onNodeDragStart" | "onNodeDragStop">;
633
+ declare const NodeSelection: <NodeType extends Node = Node>(props: NodeSelectionProps<NodeType>) => solid_js.JSX.Element;
634
+
635
+ type SelectionProps = {
636
+ readonly x?: number;
637
+ readonly y?: number;
638
+ readonly width?: number | string;
639
+ readonly height?: number | string;
640
+ readonly isVisible?: boolean;
641
+ };
642
+ declare const Selection: (props: SelectionProps) => solid_js.JSX.Element;
643
+
644
+ type SolidFlowProps<NodeType extends Node = Node, EdgeType extends Edge = Edge> = NodeEvents<NodeType> & NodeSelectionEvents<NodeType> & EdgeEvents<EdgeType> & DeleteEvents<NodeType, EdgeType> & PaneEvents & {
645
+ /**
646
+ * The id of the flow. This is necessary if you want to render multiple flows.
647
+ */
648
+ readonly id?: string;
649
+ /** Sets a fixed width for the flow */
650
+ readonly width?: number;
651
+ /** Sets a fixed height for the flow */
652
+ readonly height?: number;
653
+ /**
654
+ * An store of nodes to render in a flow.
655
+ * @example
656
+ * const [nodes] = createStore([
657
+ * {
658
+ * id: 'node-1',
659
+ * type: 'input',
660
+ * data: { label: 'Node 1' },
661
+ * position: { x: 250, y: 50 }
662
+ * }
663
+ * ]);
664
+ */
665
+ readonly nodes?: Store<NodeType[]>;
666
+ /**
667
+ * An store of edges to render in a flow.
668
+ * @example
669
+ * const [edges] = createStore([
670
+ * {
671
+ * id: 'edge-1-2',
672
+ * source: 'node-1',
673
+ * target: 'node-2',
674
+ * }
675
+ * ]);
676
+ */
677
+ readonly edges?: Store<EdgeType[]>;
678
+ /**
679
+ * Custom node types to be available in a flow.
680
+ * Solid Flow matches a node's type to a component in the nodeTypes object.
681
+ * @example
682
+ * import CustomNode from './CustomNode';
683
+ *
684
+ * const nodeTypes = { nameOfNodeType: CustomNode };
685
+ */
686
+ readonly nodeTypes?: NodeTypes;
687
+ /**
688
+ * Custom edge types to be available in a flow.
689
+ * Solid Flow matches an edge's type to a component in the edgeTypes object.
690
+ * @example
691
+ * import CustomEdge from './CustomEdge';
692
+ *
693
+ * const edgeTypes = { nameOfEdgeType: CustomEdge };
694
+ */
695
+ readonly edgeTypes?: EdgeTypes;
696
+ /** Pressing down this key you can select multiple elements with a selection box.
697
+ * @default 'Shift'
698
+ */
699
+ readonly selectionKey?: KeyDefinition | KeyDefinition[] | null;
700
+ /** If a key is set, you can pan the viewport while that key is held down even if panOnScroll is set to false.
701
+ *
702
+ * By setting this prop to null you can disable this functionality.
703
+ * @default 'Space'
704
+ */
705
+ readonly panActivationKey?: KeyDefinition | KeyDefinition[] | null;
706
+ /** Pressing down this key deletes all selected nodes & edges.
707
+ * @default 'Backspace'
708
+ */
709
+ readonly deleteKey?: KeyDefinition | KeyDefinition[] | null;
710
+ /** Pressing down this key you can select multiple elements by clicking.
711
+ * @default 'Meta' for macOS, "Ctrl" for other systems
712
+ */
713
+ readonly multiSelectionKey?: KeyDefinition | KeyDefinition[] | null;
714
+ /** If a key is set, you can zoom the viewport while that key is held down even if panOnScroll is set to false.
715
+ *
716
+ * By setting this prop to null you can disable this functionality.
717
+ * @default 'Meta' for macOS, "Ctrl" for other systems
718
+ * */
719
+ readonly zoomActivationKey?: KeyDefinition | KeyDefinition[] | null;
720
+ /** If set, initial viewport will show all nodes & edges */
721
+ readonly fitView?: boolean;
722
+ /**
723
+ * Options to be used in combination with fitView
724
+ * @example
725
+ * const fitViewOptions = {
726
+ * padding: 0.1,
727
+ * includeHiddenNodes: false,
728
+ * minZoom: 0.1,
729
+ * maxZoom: 1,
730
+ * duration: 200,
731
+ * nodes: [{id: 'node-1'}, {id: 'node-2'}], // nodes to fit
732
+ * };
733
+ */
734
+ readonly fitViewOptions?: FitViewOptions<NodeType>;
735
+ /**
736
+ * Defines nodes relative position to its coordinates
737
+ * @default [0, 0]
738
+ * @example
739
+ * [0, 0] // default, top left
740
+ * [0.5, 0.5] // center
741
+ * [1, 1] // bottom right
742
+ */
743
+ readonly nodeOrigin?: NodeOrigin;
744
+ /**
745
+ * With a threshold greater than zero you can control the distinction between node drag and click events.
746
+ * If threshold equals 1, you need to drag the node 1 pixel before a drag event is fired.
747
+ * @default 1
748
+ */
749
+ readonly nodeDragThreshold?: number;
750
+ /**
751
+ * Distance that the mouse can move between mousedown/up that will trigger a click
752
+ * @default 0
753
+ */
754
+ readonly paneClickDistance?: number;
755
+ /** Distance that the mouse can move between mousedown/up that will trigger a click
756
+ * @default 0
757
+ */
758
+ readonly nodeClickDistance?: number;
759
+ /**
760
+ * The threshold in pixels that the mouse must move before a connection line starts to drag.
761
+ * This is useful to prevent accidental connections when clicking on a handle.
762
+ * @default 1
763
+ */
764
+ readonly connectionDragThreshold?: number;
765
+ /** Minimum zoom level
766
+ * @default 0.5
767
+ */
768
+ readonly minZoom?: number;
769
+ /** Maximum zoom level
770
+ * @default 2
771
+ */
772
+ readonly maxZoom?: number;
773
+ /**
774
+ * Sets the initial position and zoom of the viewport.
775
+ * If a default viewport is provided but fitView is enabled, the default viewport will be ignored.
776
+ * @default { zoom: 1, position: { x: 0, y: 0 } }
777
+ * @example
778
+ * const initialViewport = {
779
+ * zoom: 0.5,
780
+ * position: { x: 0, y: 0 }
781
+ * };
782
+ */
783
+ readonly initialViewport?: Viewport;
784
+ /** Custom viewport to be used instead of internal one */
785
+ readonly viewport?: Store<Viewport>;
786
+ /**
787
+ * The radius around a handle where you drop a connection line to create a new edge.
788
+ * @default 20
789
+ */
790
+ readonly connectionRadius?: number;
791
+ /**
792
+ * 'strict' connection mode will only allow you to connect source handles to target handles.
793
+ * 'loose' connection mode will allow you to connect handles of any type to one another.
794
+ * @default 'strict'
795
+ */
796
+ readonly connectionMode?: ConnectionMode;
797
+ /** Provide a custom snippet to be used insted of the default connection line */
798
+ readonly connectionLineComponent?: (props: ConnectionLineComponentProps<NodeType>) => JSX.Element;
799
+ /** Styles to be applied to the connection line */
800
+ readonly connectionLineStyle?: JSX.CSSProperties;
801
+ /** Styles to be applied to the container of the connection line */
802
+ readonly connectionLineContainerStyle?: JSX.CSSProperties;
803
+ /**
804
+ * When set to "partial", when the user creates a selection box by click and dragging
805
+ * nodes that are only partially in the box are still selected.
806
+ * @default 'full'
807
+ */
808
+ readonly selectionMode?: SelectionMode;
809
+ /**
810
+ * Controls if nodes should be automatically selected when being dragged
811
+ */
812
+ readonly selectNodesOnDrag?: boolean;
813
+ /**
814
+ * Grid all nodes will snap to
815
+ * @example [20, 20]
816
+ */
817
+ readonly snapGrid?: SnapGrid;
818
+ /** Color of edge markers
819
+ * You can pass `null` to use the CSS variable `--xy-edge-stroke` for the marker color.
820
+ * @example "#b1b1b7"
821
+ */
822
+ readonly defaultMarkerColor?: string;
823
+ /**
824
+ * Controls if all nodes should be draggable
825
+ * @default true
826
+ */
827
+ readonly nodesDraggable?: boolean;
828
+ /**
829
+ * When `true`, the viewport will pan when a node is focused.
830
+ * @default true
831
+ */
832
+ readonly autoPanOnNodeFocus?: boolean;
833
+ /**
834
+ * Controls if all nodes should be connectable to each other
835
+ * @default true
836
+ */
837
+ readonly nodesConnectable?: boolean;
838
+ /** Controls if all elements should (nodes & edges) be selectable
839
+ * @default true
840
+ */
841
+ readonly elementsSelectable?: boolean;
842
+ /**
843
+ * When `true`, focus between nodes can be cycled with the `Tab` key and selected with the `Enter`
844
+ * key. This option can be overridden by individual nodes by setting their `focusable` prop.
845
+ * @default true
846
+ */
847
+ readonly nodesFocusable?: boolean;
848
+ /**
849
+ * When `true`, focus between edges can be cycled with the `Tab` key and selected with the `Enter`
850
+ * key. This option can be overridden by individual edges by setting their `focusable` prop.
851
+ * @default true
852
+ */
853
+ readonly edgesFocusable?: boolean;
854
+ /**
855
+ * By default the viewport extends infinitely. You can use this prop to set a boundary.
856
+ * The first pair of coordinates is the top left boundary and the second pair is the bottom right.
857
+ * @default @default [[-∞, -∞], [+∞, +∞]]
858
+ * @example [[-1000, -10000], [1000, 1000]]
859
+ */
860
+ readonly translateExtent?: CoordinateExtent;
861
+ /**
862
+ * By default the nodes can be placed anywhere. You can use this prop to set a boundary.
863
+ * The first pair of coordinates is the top left boundary and the second pair is the bottom right.
864
+ * @default [[-∞, -∞], [+∞, +∞]]
865
+ * @example [[-1000, -10000], [1000, 1000]]
866
+ */
867
+ readonly nodeExtent?: CoordinateExtent;
868
+ /**
869
+ * Disabling this prop will allow the user to scroll the page even when their pointer is over the flow.
870
+ * @default true
871
+ */
872
+ readonly preventScrolling?: boolean;
873
+ /**
874
+ * Controls if the viewport should zoom by scrolling inside the container.
875
+ * @default true
876
+ */
877
+ readonly zoomOnScroll?: boolean;
878
+ /**
879
+ * Controls if the viewport should zoom by double clicking somewhere on the flow
880
+ * @default true
881
+ */
882
+ readonly zoomOnDoubleClick?: boolean;
883
+ /**
884
+ * Controls if the viewport should zoom by pinching on a touch screen
885
+ * @default true
886
+ */
887
+ readonly zoomOnPinch?: boolean;
888
+ /**
889
+ * Controls if the viewport should pan by scrolling inside the container
890
+ * Can be limited to a specific direction with panOnScrollMode
891
+ * @default false
892
+ */
893
+ readonly panOnScroll?: boolean;
894
+ /**
895
+ * This prop is used to limit the direction of panning when panOnScroll is enabled.
896
+ * The "free" option allows panning in any direction.
897
+ * @default "free"
898
+ * @example "horizontal" | "vertical"
899
+ */
900
+ readonly panOnScrollMode?: PanOnScrollMode;
901
+ /**
902
+ * Enableing this prop allows users to pan the viewport by clicking and dragging.
903
+ * You can also set this prop to an array of numbers to limit which mouse buttons can activate panning.
904
+ * @default true
905
+ * @example [0, 2] // allows panning with the left and right mouse buttons
906
+ * [0, 1, 2, 3, 4] // allows panning with all mouse buttons
907
+ */
908
+ readonly panOnDrag?: boolean | number[];
909
+ /**
910
+ * Select multiple elements with a selection box, without pressing down selectionKey.
911
+ * @default false
912
+ */
913
+ readonly selectionOnDrag?: boolean;
914
+ /**
915
+ * You can enable this optimization to instruct Solid Flow to only render nodes and edges that would be visible in the viewport.
916
+ * This might improve performance when you have a large number of nodes and edges but also adds an overhead.
917
+ * @default false
918
+ */
919
+ readonly onlyRenderVisibleElements?: boolean;
920
+ /**
921
+ * You can enable this prop to automatically pan the viewport while making a new connection.
922
+ * @default true
923
+ */
924
+ readonly autoPanOnConnect?: boolean;
925
+ /**
926
+ * You can enable this prop to automatically pan the viewport while dragging a node.
927
+ * @default true
928
+ */
929
+ readonly autoPanOnNodeDrag?: boolean;
930
+ /**
931
+ * Defaults to be applied to all new edges that are added to the flow.
932
+ * Properties on a new edge will override these defaults if they exist.
933
+ * @example
934
+ * const defaultEdgeOptions = {
935
+ * type: 'customEdgeType',
936
+ * animated: true
937
+ * }
938
+ */
939
+ readonly defaultEdgeOptions?: DefaultEdgeOptions;
940
+ /**
941
+ * Controls color scheme used for styling the flow
942
+ * @default 'system'
943
+ * @example 'system' | 'light' | 'dark'
944
+ */
945
+ readonly colorMode?: ColorMode;
946
+ /** Fallback color mode for SSR if colorMode is set to 'system' */
947
+ readonly colorModeSSR?: Omit<ColorMode, "system">;
948
+ /** Class to be applied to the flow container */
949
+ readonly class?: string;
950
+ /** Styles to be applied to the flow container */
951
+ readonly style?: JSX.CSSProperties;
952
+ /** Choose from the built-in edge types to be used for connections
953
+ * @default 'default' | ConnectionLineType.Bezier
954
+ * @example 'straight' | 'default' | 'step' | 'smoothstep' | 'bezier'
955
+ * @example ConnectionLineType.Straight | ConnectionLineType.Default | ConnectionLineType.Step | ConnectionLineType.SmoothStep | ConnectionLineType.Bezier
956
+ */
957
+ readonly connectionLineType?: ConnectionLineType$1;
958
+ /** Enabling this option will raise the z-index of nodes when they are selected.
959
+ * @default true
960
+ */
961
+ readonly elevateNodesOnSelect?: boolean;
962
+ /**
963
+ * Enabling this option will raise the z-index of edges when they are selected,
964
+ * or when the connected nodes are selected.
965
+ * @default true
966
+ */
967
+ readonly elevateEdgesOnSelect?: boolean;
968
+ /**
969
+ * You can use this prop to disable keyboard accessibility features such as selecting nodes or
970
+ * moving selected nodes with the arrow keys.
971
+ * @default false
972
+ */
973
+ readonly disableKeyboardA11y?: boolean;
974
+ /**
975
+ * If a node is draggable, clicking and dragging that node will move it around the canvas. Adding
976
+ * the `"nodrag"` class prevents this behavior and this prop allows you to change the name of that
977
+ * class.
978
+ * @default "nodrag"
979
+ */
980
+ readonly noDragClass?: string;
981
+ /**
982
+ * Typically, scrolling the mouse wheel when the mouse is over the canvas will zoom the viewport.
983
+ * Adding the `"nowheel"` class to an element n the canvas will prevent this behavior and this prop
984
+ * allows you to change the name of that class.
985
+ * @default "nowheel"
986
+ */
987
+ readonly noWheelClass?: string;
988
+ /**
989
+ * If an element in the canvas does not stop mouse events from propagating, clicking and dragging
990
+ * that element will pan the viewport. Adding the `"nopan"` class prevents this behavior and this
991
+ * prop allows you to change the name of that class.
992
+ * @default "nopan"
993
+ */
994
+ readonly noPanClass?: string;
995
+ /** Toggles ability to make connections via clicking the handles */
996
+ readonly clickConnect?: boolean;
997
+ /**
998
+ * This callback can be used to validate a new connection.
999
+ * If you return `false`, the edge will not be added to your flow.
1000
+ * If you have custom connection logic its preferred to use this callback over the
1001
+ * `isValidConnection` prop on the handle component for performance reasons.
1002
+ */
1003
+ /**
1004
+ * Set position of the attribution
1005
+ * @default 'bottom-right'
1006
+ * @example 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'
1007
+ */
1008
+ readonly attributionPosition?: PanelPosition;
1009
+ /**
1010
+ * By default, we render a small attribution in the corner of your flows that links back to the project.
1011
+ * You are free to remove this attribution but we ask that you take a quick look at our
1012
+ * {@link https://svelteflow.dev/learn/troubleshooting/remove-attribution | removing attribution guide}
1013
+ * before doing so.
1014
+ */
1015
+ readonly proOptions?: ProOptions;
1016
+ readonly isValidConnection?: IsValidConnection;
1017
+ /** This event handler is called when the user begins to pan or zoom the viewport */
1018
+ readonly onMoveStart?: OnMoveStart;
1019
+ /** This event handler is called when the user pans or zooms the viewport */
1020
+ readonly onMove?: OnMove;
1021
+ /** This event handler is called when the user stops panning or zooming the viewport */
1022
+ readonly onMoveEnd?: OnMoveEnd;
1023
+ /**
1024
+ * Ocassionally something may happen that causes Solid Flow to throw an error.
1025
+ * Instead of exploding your application, we log a message to the console and then call this event handler.
1026
+ * You might use it for additional logging or to show a message to the user.
1027
+ */
1028
+ readonly onFlowError?: OnError;
1029
+ /** This handler gets called when the user deletes nodes or edges.
1030
+ * @example
1031
+ * onDelete={({nodes, edges}) => {
1032
+ * console.log('deleted nodes:', nodes);
1033
+ * console.log('deleted edges:', edges);
1034
+ * }}
1035
+ */
1036
+ readonly onDelete?: OnDelete<NodeType, EdgeType>;
1037
+ /** This handler gets called before the user deletes nodes or edges and provides a way to abort the deletion by returning false. */
1038
+ readonly onBeforeDelete?: OnBeforeDelete<NodeType, EdgeType>;
1039
+ /** This handler gets called when a new edge is created. You can use it to modify the newly created edge. */
1040
+ readonly onBeforeConnect?: OnBeforeEdgeConnect<EdgeType>;
1041
+ /** This event gets fired when a connection successfully completes and an edge is created. */
1042
+ readonly onConnect?: OnEdgeConnect;
1043
+ /** When a user starts to drag a connection line, this event gets fired. */
1044
+ readonly onConnectStart?: OnConnectStart;
1045
+ /** When a user stops dragging a connection line, this event gets fired. */
1046
+ readonly onConnectEnd?: OnConnectEnd;
1047
+ /** This event gets fired when after an edge was reconnected*/
1048
+ readonly onReconnect?: OnReconnect<EdgeType>;
1049
+ /** This event gets fired when a user starts to reconnect an edge */
1050
+ readonly onReconnectStart?: OnReconnectStart<EdgeType>;
1051
+ /** This event gets fired when a user stops reconnecting an edge */
1052
+ readonly onReconnectEnd?: OnReconnectEnd<EdgeType>;
1053
+ /** This handler gets called when an edge is reconnected. You can use it to modify the edge before the update is applied. */
1054
+ readonly onBeforeReconnect?: OnBeforeReconnect<EdgeType>;
1055
+ /** A connection is started by clicking on a handle */
1056
+ readonly onClickConnectStart?: OnConnectStart;
1057
+ /** A connection is finished by clicking on a handle */
1058
+ readonly onClickConnectEnd?: OnConnectEnd;
1059
+ /** This handler gets called when the flow is finished initializing */
1060
+ readonly onInit?: () => void;
1061
+ /** This event handler gets called when the selected nodes & edges change */
1062
+ readonly onSelectionChange?: OnSelectionChange<NodeType, EdgeType>;
1063
+ /** This event handler gets called when a user starts to drag a selection box. */
1064
+ readonly onSelectionDragStart?: OnSelectionDrag<NodeType>;
1065
+ /** This event handler gets called when a user drags a selection box. */
1066
+ readonly onSelectionDrag?: OnSelectionDrag<NodeType>;
1067
+ /** This event handler gets called when a user stops dragging a selection box. */
1068
+ readonly onSelectionDragStop?: OnSelectionDrag<NodeType>;
1069
+ /** This event handler gets called when the user starts to drag a selection box */
1070
+ readonly onSelectionStart?: (event: PointerEvent) => void;
1071
+ /** This event handler gets called when the user finishes dragging a selection box */
1072
+ readonly onSelectionEnd?: (event: PointerEvent) => void;
1073
+ /**
1074
+ * Configuration for customizable labels, descriptions, and UI text. Provided keys will override the corresponding defaults.
1075
+ * Allows localization, customization of ARIA descriptions, control labels, minimap labels, and other UI strings.
1076
+ */
1077
+ readonly ariaLabelConfig?: Partial<AriaLabelConfig>;
1078
+ };
1079
+
1080
+ type SolidFlowComponentProps<NodeType extends Node = Node, EdgeType extends Edge = Edge> = ParentProps<SolidFlowProps<NodeType, EdgeType>> & Omit<JSX.HTMLAttributes<HTMLDivElement>, "style" | "onselectionchange" | "onSelectionChange">;
1081
+ declare const SolidFlow: <NodeType extends Node = Node, EdgeType extends Edge = Edge>(props: SolidFlowComponentProps<NodeType, EdgeType>) => JSX.Element;
1082
+
1083
+ declare const SolidFlowProvider: <NodeType extends Node = Node, EdgeType extends Edge = Edge>(props: ParentProps<SolidFlowProps<NodeType, EdgeType>>) => solid_js.JSX.Element;
1084
+
1085
+ type ExtractEdgeInfo<T> = T extends (props: EdgeProps<infer TData, infer TType>) => unknown ? {
1086
+ data: TData;
1087
+ type: TType;
1088
+ } : never;
1089
+ type AllEdgeTypes<TUserEdgeTypes extends EdgeTypes> = TUserEdgeTypes extends Record<string, never> ? BuiltInEdgeTypes : BuiltInEdgeTypes & TUserEdgeTypes;
1090
+ type EdgesInput<TUserEdgeTypes extends EdgeTypes> = {
1091
+ [K in keyof AllEdgeTypes<TUserEdgeTypes>]: Edge<ExtractEdgeInfo<AllEdgeTypes<TUserEdgeTypes>[K]>["data"], ExtractEdgeInfo<AllEdgeTypes<TUserEdgeTypes>[K]>["type"]>;
1092
+ }[keyof AllEdgeTypes<TUserEdgeTypes>];
1093
+ /**
1094
+ * Creates a type-safe reactive store of edges for use in Solid Flow.
1095
+ *
1096
+ * This utility function provides full type safety and autocomplete for creating edges,
1097
+ * combining both built-in edge types (default, straight, step, smoothstep) and custom user-defined
1098
+ * edge types. When a specific edge type is selected, TypeScript automatically infers the
1099
+ * required data structure and validates the edge configuration.
1100
+ *
1101
+ * @template TUserEdgeTypes - The user's custom edge types map (optional)
1102
+ * @param edges - Array of edge configurations to create
1103
+ * @returns A SolidJS store tuple [store, setStore] with properly typed Edge objects
1104
+ *
1105
+ * @example
1106
+ * ```typescript
1107
+ * // Using only built-in edge types (no generic parameter needed)
1108
+ * const [builtInEdges, setBuiltInEdges] = createEdgeStore([
1109
+ * {
1110
+ * id: "1",
1111
+ * source: "1",
1112
+ * target: "2",
1113
+ * type: "default",
1114
+ * data: { label: "Start" }
1115
+ * },
1116
+ * {
1117
+ * id: "2",
1118
+ * source: "2",
1119
+ * target: "3",
1120
+ * type: "default",
1121
+ * data: { label: "Process" }
1122
+ * }
1123
+ * ]);
1124
+ * ```
1125
+ *
1126
+ * @example
1127
+ * ```typescript
1128
+ * // Using custom edge types (requires generic parameter)
1129
+ * const customEdgeTypes = {
1130
+ * textEdge: (props: EdgeProps<{ content: string }, "textEdge">) =>
1131
+ * <div>{props.data.content}</div>,
1132
+ * numberEdge: (props: EdgeProps<{ value: number }, "numberEdge">) =>
1133
+ * <div>{props.data.value}</div>
1134
+ * } satisfies EdgeTypes;
1135
+ *
1136
+ * const [mixedEdges, setMixedEdges] = createEdgeStore<typeof customEdgeTypes>([
1137
+ * {
1138
+ * id: "1",
1139
+ * source: "1",
1140
+ * target: "2",
1141
+ * type: "default", // Built-in type
1142
+ * data: { label: "Input" }
1143
+ * },
1144
+ * {
1145
+ * id: "2",
1146
+ * source: "2",
1147
+ * target: "3",
1148
+ * type: "textEdge", // Custom type - gets autocomplete
1149
+ * data: { content: "Custom text edge" } // Type-safe data
1150
+ * },
1151
+ * {
1152
+ * id: "3",
1153
+ * source: "3",
1154
+ * target: "4",
1155
+ * type: "numberEdge", // Another custom type
1156
+ * data: { value: 42 }, // Type-safe data
1157
+ * style: { "background-color": "lightblue" } // All Edge properties available
1158
+ * }
1159
+ * ]);
1160
+ * ```
1161
+ *
1162
+ * @remarks
1163
+ * - Provides autocomplete for the `type` field with all available node types
1164
+ * - Validates `data` structure based on the selected node type
1165
+ * - Supports all Node properties (style, draggable, hidden, etc.)
1166
+ * - Works seamlessly with both built-in and custom node types
1167
+ * - Type errors prevent invalid type names or incorrect data structures
1168
+ */
1169
+ declare const createEdgeStore: <TUserEdgeTypes extends EdgeTypes = Record<string, never>>(edges: EdgesInput<TUserEdgeTypes>[]) => readonly [Store<EdgesInput<TUserEdgeTypes>[]>, SetStoreFunction<EdgesInput<TUserEdgeTypes>[]>];
1170
+
1171
+ type ExtractNodeInfo<T> = T extends (props: NodeProps<infer TData, infer TType>) => unknown ? {
1172
+ data: TData;
1173
+ type: TType;
1174
+ } : never;
1175
+ type AllNodeTypes<TUserNodeTypes extends NodeTypes> = TUserNodeTypes extends Record<string, never> ? BuiltInNodeTypes : BuiltInNodeTypes & TUserNodeTypes;
1176
+ type NodesInput<TUserNodeTypes extends NodeTypes> = {
1177
+ [K in keyof AllNodeTypes<TUserNodeTypes>]: Node<ExtractNodeInfo<AllNodeTypes<TUserNodeTypes>[K]>["data"], ExtractNodeInfo<AllNodeTypes<TUserNodeTypes>[K]>["type"]>;
1178
+ }[keyof AllNodeTypes<TUserNodeTypes>];
1179
+ /**
1180
+ * Creates a type-safe reactive store of nodes for use in Solid Flow.
1181
+ *
1182
+ * This utility function provides full type safety and autocomplete for creating nodes,
1183
+ * combining both built-in node types (input, output, default, group) and custom user-defined
1184
+ * node types. When a specific node type is selected, TypeScript automatically infers the
1185
+ * required data structure and validates the node configuration.
1186
+ *
1187
+ * @template TUserNodeTypes - The user's custom node types map (optional)
1188
+ * @param nodes - Array of node configurations to create
1189
+ * @returns A SolidJS store tuple [store, setStore] with properly typed Node objects
1190
+ *
1191
+ * @example
1192
+ * ```typescript
1193
+ * // Using only built-in node types (no generic parameter needed)
1194
+ * const [builtInNodes, setBuiltInNodes] = createNodeStore([
1195
+ * {
1196
+ * id: "1",
1197
+ * position: { x: 0, y: 0 },
1198
+ * type: "input",
1199
+ * data: { label: "Start" }
1200
+ * },
1201
+ * {
1202
+ * id: "2",
1203
+ * position: { x: 200, y: 100 },
1204
+ * type: "default",
1205
+ * data: { label: "Process" }
1206
+ * }
1207
+ * ]);
1208
+ * ```
1209
+ *
1210
+ * @example
1211
+ * ```typescript
1212
+ * // Using custom node types (requires generic parameter)
1213
+ * const customNodeTypes = {
1214
+ * textNode: (props: NodeProps<{ content: string }, "textNode">) =>
1215
+ * <div>{props.data.content}</div>,
1216
+ * numberNode: (props: NodeProps<{ value: number }, "numberNode">) =>
1217
+ * <div>{props.data.value}</div>
1218
+ * } satisfies NodeTypes;
1219
+ *
1220
+ * const [mixedNodes, setMixedNodes] = createNodeStore<typeof customNodeTypes>([
1221
+ * {
1222
+ * id: "1",
1223
+ * position: { x: 0, y: 0 },
1224
+ * type: "input", // Built-in type
1225
+ * data: { label: "Input" }
1226
+ * },
1227
+ * {
1228
+ * id: "2",
1229
+ * position: { x: 100, y: 100 },
1230
+ * type: "textNode", // Custom type - gets autocomplete
1231
+ * data: { content: "Custom text node" } // Type-safe data
1232
+ * },
1233
+ * {
1234
+ * id: "3",
1235
+ * position: { x: 200, y: 200 },
1236
+ * type: "numberNode", // Another custom type
1237
+ * data: { value: 42 }, // Type-safe data
1238
+ * style: { "background-color": "lightblue" } // All Node properties available
1239
+ * }
1240
+ * ]);
1241
+ * ```
1242
+ *
1243
+ * @remarks
1244
+ * - Provides autocomplete for the `type` field with all available node types
1245
+ * - Validates `data` structure based on the selected node type
1246
+ * - Supports all Node properties (style, draggable, hidden, etc.)
1247
+ * - Works seamlessly with both built-in and custom node types
1248
+ * - Type errors prevent invalid type names or incorrect data structures
1249
+ */
1250
+ declare const createNodeStore: <TUserNodeTypes extends NodeTypes = Record<string, never>>(nodes: NodesInput<TUserNodeTypes>[]) => readonly [Store<NodesInput<TUserNodeTypes>[]>, SetStoreFunction<NodesInput<TUserNodeTypes>[]>];
1251
+
1252
+ /**
1253
+ * Hook for receiving the current connection.
1254
+ *
1255
+ * @public
1256
+ * @returns current connection as a readable store
1257
+ */
1258
+ declare function useConnection(): Accessor<ConnectionState>;
1259
+
1260
+ /**
1261
+ * Hook for getting the current nodes from the store.
1262
+ *
1263
+ * @public
1264
+ * @returns store with an array of nodes
1265
+ */
1266
+ declare function useNodes<NodeType extends Node = Node>(): () => NodeType[];
1267
+ /**
1268
+ * Hook for getting the current edges from the store.
1269
+ *
1270
+ * @public
1271
+ * @returns store with an array of edges
1272
+ */
1273
+ declare function useEdges<EdgeType extends Edge = Edge>(): () => EdgeType[];
1274
+ /**
1275
+ * Hook for getting the current viewport from the store.
1276
+ *
1277
+ * @public
1278
+ * @returns store with the viewport object
1279
+ */
1280
+ declare function useViewport(): () => _xyflow_system.Viewport;
1281
+
1282
+ declare function useHandleEdgeSelect(): (id: string) => void;
1283
+
1284
+ /**
1285
+ * Hook to get an internal node by id.
1286
+ *
1287
+ * @public
1288
+ * @param id - the node id
1289
+ * @returns an accessor with an internal node or undefined
1290
+ */
1291
+ declare function useInternalNode(id: Accessor<string>): Accessor<InternalNode | undefined>;
1292
+
1293
+ type UseNodeConnectionsParams = {
1294
+ id?: string;
1295
+ handleType?: HandleType;
1296
+ handleId?: string;
1297
+ };
1298
+ /**
1299
+ * Hook to retrieve all edges connected to a node. Can be filtered by handle type and id.
1300
+ *
1301
+ * @public
1302
+ * @param param.id - node id - optional if called inside a custom node
1303
+ * @param param.handleType - filter by handle type 'source' or 'target'
1304
+ * @param param.handleId - filter by handle id (this is only needed if the node has multiple handles of the same type)
1305
+ * @todo @param param.onConnect - gets called when a connection is established
1306
+ * @todo @param param.onDisconnect - gets called when a connection is removed
1307
+ * @returns an array with connections
1308
+ */
1309
+ declare const useNodeConnections: (params: Accessor<UseNodeConnectionsParams>) => Accessor<NodeConnection[]>;
1310
+
1311
+ type NodeData<NodeType extends Node> = Pick<NodeType, "id" | "data" | "type">;
1312
+ /**
1313
+ * Hook for receiving data of one or multiple nodes
1314
+ *
1315
+ * @param nodeId - The id (or ids) of the node to get the data from
1316
+ * @returns A memo with an array of data objects
1317
+ */
1318
+ declare function useNodesData<NodeType extends Node = Node>(nodeId: Accessor<string | undefined | null>): Accessor<NodeData<NodeType> | undefined>;
1319
+ declare function useNodesData<NodeType extends Node = Node>(nodeIds: Accessor<string[] | undefined | null>): Accessor<NodeData<NodeType>[]>;
1320
+
1321
+ /**
1322
+ * Hook for accessing the SvelteFlow instance.
1323
+ *
1324
+ * @public
1325
+ * @returns A set of helper functions
1326
+ */
1327
+ declare function useSolidFlow<NodeType extends Node = Node, EdgeType extends Edge = Edge>(): {
1328
+ /**
1329
+ * Zooms viewport in by 1.2.
1330
+ *
1331
+ * @param options.duration - optional duration. If set, a transition will be applied
1332
+ */
1333
+ zoomIn: ZoomInOut;
1334
+ /**
1335
+ * Zooms viewport out by 1 / 1.2.
1336
+ *
1337
+ * @param options.duration - optional duration. If set, a transition will be applied
1338
+ */
1339
+ zoomOut: ZoomInOut;
1340
+ /**
1341
+ * Returns an internal node by id.
1342
+ *
1343
+ * @param id - the node id
1344
+ * @returns the node or undefined if no node was found
1345
+ */
1346
+ getInternalNode: (id: string) => InternalNode<NodeType> | undefined;
1347
+ /**
1348
+ * Returns a node by id.
1349
+ *
1350
+ * @param id - the node id
1351
+ * @returns the node or undefined if no node was found
1352
+ */
1353
+ getNode: (id: string) => NodeType | undefined;
1354
+ /**
1355
+ * Returns nodes.
1356
+ *
1357
+ * @returns nodes array
1358
+ */
1359
+ getNodes: (ids?: string[]) => NodeType[];
1360
+ /**
1361
+ * Returns an edge by id.
1362
+ *
1363
+ * @param id - the edge id
1364
+ * @returns the edge or undefined if no edge was found
1365
+ */
1366
+ getEdge: (id: string) => EdgeType | undefined;
1367
+ /**
1368
+ * Returns edges.
1369
+ *
1370
+ * @returns edges array
1371
+ */
1372
+ getEdges: (ids?: string[]) => EdgeType[];
1373
+ /**
1374
+ * Add one or many nodes to your existing nodes array.
1375
+ *
1376
+ * @param payload - the nodes to add
1377
+ */
1378
+ addNodes: (payload: NodeType[] | NodeType) => void;
1379
+ /**
1380
+ * Add one or many edges to your existing edges array.
1381
+ *
1382
+ * @param payload - the edges to add
1383
+ */
1384
+ addEdges: (payload: EdgeType[] | EdgeType) => void;
1385
+ /**
1386
+ * Sets the current zoom level.
1387
+ *
1388
+ * @param zoomLevel - the zoom level to set
1389
+ * @param options.duration - optional duration. If set, a transition will be applied
1390
+ */
1391
+ setZoom: (zoomLevel: number, options?: ViewportHelperFunctionOptions) => Promise<boolean>;
1392
+ /**
1393
+ * Returns the current zoom level.
1394
+ *
1395
+ * @returns current zoom as a number
1396
+ */
1397
+ getZoom: () => number;
1398
+ /**
1399
+ * Sets the center of the view to the given position.
1400
+ *
1401
+ * @param x - x position
1402
+ * @param y - y position
1403
+ * @param options.zoom - optional zoom
1404
+ */
1405
+ setCenter: (x: number, y: number, options?: SetCenterOptions) => Promise<boolean>;
1406
+ /**
1407
+ * Sets the current viewport.
1408
+ *
1409
+ * @param viewport - the viewport to set
1410
+ * @param options.duration - optional duration. If set, a transition will be applied
1411
+ */
1412
+ setViewport: (viewport: Viewport, options?: ViewportHelperFunctionOptions) => Promise<boolean>;
1413
+ /**
1414
+ * Returns the current viewport.
1415
+ *
1416
+ * @returns Viewport
1417
+ */
1418
+ getViewport: () => Viewport;
1419
+ /**
1420
+ * Fits the view.
1421
+ *
1422
+ * @param options.padding - optional padding
1423
+ * @param options.includeHiddenNodes - optional includeHiddenNodes
1424
+ * @param options.minZoom - optional minZoom
1425
+ * @param options.maxZoom - optional maxZoom
1426
+ * @param options.duration - optional duration. If set, a transition will be applied
1427
+ * @param options.nodes - optional nodes to fit the view to
1428
+ */
1429
+ fitView: (options?: FitViewOptions<NodeType>) => Promise<boolean>;
1430
+ /**
1431
+ * Returns all nodes that intersect with the given node or rect.
1432
+ *
1433
+ * @param node - the node or rect to check for intersections
1434
+ * @param partially - if true, the node is considered to be intersecting if it partially overlaps with the passed node or rect
1435
+ * @param nodes - optional nodes array to check for intersections
1436
+ *
1437
+ * @returns an array of intersecting nodes
1438
+ */
1439
+ getIntersectingNodes: (nodeOrRect: NodeType | {
1440
+ id: NodeType["id"];
1441
+ } | Rect, partially?: boolean, nodesToIntersect?: NodeType[]) => NodeType[];
1442
+ /**
1443
+ * Checks if the given node or rect intersects with the passed rect.
1444
+ *
1445
+ * @param node - the node or rect to check for intersections
1446
+ * @param area - the rect to check for intersections
1447
+ * @param partially - if true, the node is considered to be intersecting if it partially overlaps with the passed react
1448
+ *
1449
+ * @returns true if the node or rect intersects with the given area
1450
+ */
1451
+ isNodeIntersecting: (nodeOrRect: NodeType | {
1452
+ id: NodeType["id"];
1453
+ } | Rect, area: Rect, partially?: boolean) => boolean;
1454
+ /**
1455
+ * Fits the view to the given bounds .
1456
+ *
1457
+ * @param bounds - the bounds ({ x: number, y: number, width: number, height: number }) to fit the view to
1458
+ * @param options.padding - optional padding
1459
+ */
1460
+ fitBounds: (bounds: Rect, options?: FitBoundsOptions) => Promise<boolean>;
1461
+ /**
1462
+ * Deletes nodes and edges.
1463
+ *
1464
+ * @param params.nodes - optional nodes array to delete
1465
+ * @param params.edges - optional edges array to delete
1466
+ *
1467
+ * @returns a promise that resolves with the deleted nodes and edges
1468
+ */
1469
+ deleteElements: ({ nodes, edges, }: {
1470
+ nodes?: (Partial<NodeType> & {
1471
+ id: string;
1472
+ })[];
1473
+ edges?: (Partial<EdgeType> & {
1474
+ id: string;
1475
+ })[];
1476
+ }) => Promise<{
1477
+ deletedNodes: NodeType[];
1478
+ deletedEdges: EdgeType[];
1479
+ }>;
1480
+ /**
1481
+ * Converts a screen / client position to a flow position.
1482
+ *
1483
+ * @param clientPosition - the screen / client position. When you are working with events you can use event.clientX and event.clientY
1484
+ * @param options.snapToGrid - if true, the converted position will be snapped to the grid
1485
+ * @returns position as { x: number, y: number }
1486
+ *
1487
+ * @example
1488
+ * const flowPosition = screenToFlowPosition({ x: event.clientX, y: event.clientY })
1489
+ */
1490
+ screenToFlowPosition: (clientPosition: XYPosition, options?: {
1491
+ snapToGrid: boolean;
1492
+ }) => XYPosition;
1493
+ /**
1494
+ * Converts a flow position to a screen / client position.
1495
+ *
1496
+ * @param flowPosition - the screen / client position. When you are working with events you can use event.clientX and event.clientY
1497
+ * @returns position as { x: number, y: number }
1498
+ *
1499
+ * @example
1500
+ * const clientPosition = flowToScreenPosition({ x: node.position.x, y: node.position.y })
1501
+ */
1502
+ flowToScreenPosition: (flowPosition: XYPosition) => XYPosition;
1503
+ /**
1504
+ * Updates a node.
1505
+ *
1506
+ * @param id - id of the node to update
1507
+ * @param nodeUpdate - the node update as an object or a function that receives the current node and returns the node update
1508
+ * @param options.replace - if true, the node is replaced with the node update, otherwise the changes get merged
1509
+ *
1510
+ * @example
1511
+ * updateNode('node-1', (node) => ({ position: { x: node.position.x + 10, y: node.position.y } }));
1512
+ */
1513
+ updateNode: (id: string, nodeUpdate: Partial<NodeType> | ((node: NodeType) => Partial<NodeType>), options?: {
1514
+ replace: boolean;
1515
+ }) => void;
1516
+ /**
1517
+ * Updates the data attribute of a node.
1518
+ *
1519
+ * @param id - id of the node to update
1520
+ * @param dataUpdate - the data update as an object or a function that receives the current data and returns the data update
1521
+ * @param options.replace - if true, the data is replaced with the data update, otherwise the changes get merged
1522
+ *
1523
+ * @example
1524
+ * updateNodeData('node-1', { label: 'A new label' });
1525
+ */
1526
+ updateNodeData: (id: string, dataUpdate: Partial<NodeType["data"]> | ((node: NodeType) => Partial<NodeType["data"]>), options?: {
1527
+ replace: boolean;
1528
+ }) => void;
1529
+ /**
1530
+ * Returns the nodes, edges and the viewport as a JSON object.
1531
+ *
1532
+ * @returns the nodes, edges and the viewport as a JSON object
1533
+ */
1534
+ /**
1535
+ * Updates an edge.
1536
+ *
1537
+ * @param id - id of the edge to update
1538
+ * @param edgeUpdate - the edge update as an object or a function that receives the current edge and returns the edge update
1539
+ * @param options.replace - if true, the edge is replaced with the edge update, otherwise the changes get merged
1540
+ *
1541
+ * @example
1542
+ * updateNode('node-1', (node) => ({ position: { x: node.position.x + 10, y: node.position.y } }));
1543
+ */
1544
+ updateEdge: (id: string, edgeUpdate: Partial<EdgeType> | ((edge: EdgeType) => Partial<EdgeType>), options?: {
1545
+ replace: boolean;
1546
+ }) => void;
1547
+ toObject: () => {
1548
+ nodes: NodeType[];
1549
+ edges: EdgeType[];
1550
+ viewport: Viewport;
1551
+ };
1552
+ /**
1553
+ * Returns the bounds of the given nodes or node ids.
1554
+ *
1555
+ * @param nodes - the nodes or node ids to calculate the bounds for
1556
+ *
1557
+ * @returns the bounds of the given nodes
1558
+ */
1559
+ getNodesBounds: (nodes: (NodeType | InternalNode<NodeType> | string)[]) => Rect;
1560
+ /** Gets all connections for a given handle belonging to a specific node.
1561
+ *
1562
+ * @param type - handle type 'source' or 'target'
1563
+ * @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)
1564
+ * @param nodeId - the node id the handle belongs to
1565
+ * @returns an array with handle connections
1566
+ */
1567
+ getHandleConnections: ({ type, id, nodeId, }: {
1568
+ type: HandleType;
1569
+ nodeId: string;
1570
+ id?: string | null;
1571
+ }) => HandleConnection[];
1572
+ };
1573
+
1574
+ /**
1575
+ * Hook for updating node internals.
1576
+ *
1577
+ * @public
1578
+ * @returns function for updating node internals
1579
+ */
1580
+ declare function useUpdateNodeInternals(): UpdateNodeInternals;
1581
+
1582
+ 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 };