@getartisanflow/alpineflow 0.1.0-alpha

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.
Files changed (196) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +88 -0
  3. package/dist/alpineflow-collab.esm.js +465 -0
  4. package/dist/alpineflow-collab.esm.js.map +1 -0
  5. package/dist/alpineflow-collab.js +247 -0
  6. package/dist/alpineflow-collab.js.map +1 -0
  7. package/dist/alpineflow-dagre.esm.js +1661 -0
  8. package/dist/alpineflow-dagre.esm.js.map +1 -0
  9. package/dist/alpineflow-dagre.js +1655 -0
  10. package/dist/alpineflow-dagre.js.map +1 -0
  11. package/dist/alpineflow-elk.esm.js +47378 -0
  12. package/dist/alpineflow-elk.esm.js.map +1 -0
  13. package/dist/alpineflow-elk.js +47373 -0
  14. package/dist/alpineflow-elk.js.map +1 -0
  15. package/dist/alpineflow-force.esm.js +599 -0
  16. package/dist/alpineflow-force.esm.js.map +1 -0
  17. package/dist/alpineflow-force.js +477 -0
  18. package/dist/alpineflow-force.js.map +1 -0
  19. package/dist/alpineflow-hierarchy.esm.js +398 -0
  20. package/dist/alpineflow-hierarchy.esm.js.map +1 -0
  21. package/dist/alpineflow-hierarchy.js +393 -0
  22. package/dist/alpineflow-hierarchy.js.map +1 -0
  23. package/dist/alpineflow-theme.css +473 -0
  24. package/dist/alpineflow-whiteboard.esm.js +922 -0
  25. package/dist/alpineflow-whiteboard.esm.js.map +1 -0
  26. package/dist/alpineflow-whiteboard.js +922 -0
  27. package/dist/alpineflow-whiteboard.js.map +1 -0
  28. package/dist/alpineflow.bundle.esm.js +12604 -0
  29. package/dist/alpineflow.bundle.esm.js.map +1 -0
  30. package/dist/alpineflow.css +1415 -0
  31. package/dist/alpineflow.esm.js +158 -0
  32. package/dist/alpineflow.esm.js.map +1 -0
  33. package/dist/alpineflow.js +5 -0
  34. package/dist/alpineflow.js.map +1 -0
  35. package/dist/export-DjmXOnKD.js +76 -0
  36. package/dist/export-DjmXOnKD.js.map +1 -0
  37. package/dist/geometry-DZSZoYHE.js +82 -0
  38. package/dist/geometry-DZSZoYHE.js.map +1 -0
  39. package/dist/index-C0N1DL3G.js +11728 -0
  40. package/dist/index-C0N1DL3G.js.map +1 -0
  41. package/dist/index-L3Zm-CoX.js +513 -0
  42. package/dist/index-L3Zm-CoX.js.map +1 -0
  43. package/dist/registry-CChkuoVJ.js +15 -0
  44. package/dist/registry-CChkuoVJ.js.map +1 -0
  45. package/dist/store-CaFAFEdD.js +9 -0
  46. package/dist/store-CaFAFEdD.js.map +1 -0
  47. package/dist/timer-B39XOBYL.js +124 -0
  48. package/dist/timer-B39XOBYL.js.map +1 -0
  49. package/dist/types/lib/collab.cdn.d.ts +1 -0
  50. package/dist/types/lib/collab.d.ts +2 -0
  51. package/dist/types/lib/core.cdn.d.ts +1 -0
  52. package/dist/types/lib/core.d.ts +2 -0
  53. package/dist/types/lib/dagre.cdn.d.ts +1 -0
  54. package/dist/types/lib/dagre.d.ts +1 -0
  55. package/dist/types/lib/elk.cdn.d.ts +1 -0
  56. package/dist/types/lib/elk.d.ts +1 -0
  57. package/dist/types/lib/force.cdn.d.ts +1 -0
  58. package/dist/types/lib/force.d.ts +1 -0
  59. package/dist/types/lib/hierarchy.cdn.d.ts +1 -0
  60. package/dist/types/lib/hierarchy.d.ts +1 -0
  61. package/dist/types/lib/whiteboard.cdn.d.ts +1 -0
  62. package/dist/types/lib/whiteboard.d.ts +1 -0
  63. package/dist/types/src/animate/animator.d.ts +57 -0
  64. package/dist/types/src/animate/easing.d.ts +4 -0
  65. package/dist/types/src/animate/edge-transitions.d.ts +22 -0
  66. package/dist/types/src/animate/engine.d.ts +37 -0
  67. package/dist/types/src/animate/index.d.ts +10 -0
  68. package/dist/types/src/animate/interpolators.d.ts +14 -0
  69. package/dist/types/src/animate/paths.d.ts +64 -0
  70. package/dist/types/src/animate/timeline.d.ts +149 -0
  71. package/dist/types/src/collab/awareness.d.ts +40 -0
  72. package/dist/types/src/collab/bridge.d.ts +36 -0
  73. package/dist/types/src/collab/directives/flow-cursors.d.ts +16 -0
  74. package/dist/types/src/collab/index.d.ts +19 -0
  75. package/dist/types/src/collab/providers/in-memory.d.ts +41 -0
  76. package/dist/types/src/collab/providers/reverb.d.ts +59 -0
  77. package/dist/types/src/collab/providers/websocket.d.ts +33 -0
  78. package/dist/types/src/collab/store.d.ts +22 -0
  79. package/dist/types/src/collab/types.d.ts +55 -0
  80. package/dist/types/src/core/__fixtures__/nodes.d.ts +42 -0
  81. package/dist/types/src/core/announcer.d.ts +21 -0
  82. package/dist/types/src/core/auto-pan.d.ts +37 -0
  83. package/dist/types/src/core/child-layout.d.ts +18 -0
  84. package/dist/types/src/core/child-validation.d.ts +23 -0
  85. package/dist/types/src/core/clipboard.d.ts +29 -0
  86. package/dist/types/src/core/collapse.d.ts +54 -0
  87. package/dist/types/src/core/color-mode.d.ts +11 -0
  88. package/dist/types/src/core/compute.d.ts +33 -0
  89. package/dist/types/src/core/connections.d.ts +32 -0
  90. package/dist/types/src/core/constants.d.ts +18 -0
  91. package/dist/types/src/core/controls-panel.d.ts +23 -0
  92. package/dist/types/src/core/debug.d.ts +10 -0
  93. package/dist/types/src/core/deep-merge.d.ts +10 -0
  94. package/dist/types/src/core/drag.d.ts +63 -0
  95. package/dist/types/src/core/edge-paths/avoidant.d.ts +25 -0
  96. package/dist/types/src/core/edge-paths/bezier.d.ts +26 -0
  97. package/dist/types/src/core/edge-paths/editable.d.ts +22 -0
  98. package/dist/types/src/core/edge-paths/index.d.ts +7 -0
  99. package/dist/types/src/core/edge-paths/orthogonal.d.ts +27 -0
  100. package/dist/types/src/core/edge-paths/smoothstep.d.ts +22 -0
  101. package/dist/types/src/core/edge-paths/straight.d.ts +12 -0
  102. package/dist/types/src/core/edge-paths/utils.d.ts +30 -0
  103. package/dist/types/src/core/edge-utils.d.ts +57 -0
  104. package/dist/types/src/core/export.d.ts +12 -0
  105. package/dist/types/src/core/floating-edge.d.ts +33 -0
  106. package/dist/types/src/core/geometry.d.ts +79 -0
  107. package/dist/types/src/core/gradients.d.ts +30 -0
  108. package/dist/types/src/core/graph.d.ts +38 -0
  109. package/dist/types/src/core/helper-lines.d.ts +32 -0
  110. package/dist/types/src/core/history.d.ts +19 -0
  111. package/dist/types/src/core/index.d.ts +17 -0
  112. package/dist/types/src/core/intersection.d.ts +30 -0
  113. package/dist/types/src/core/keyboard-shortcuts.d.ts +45 -0
  114. package/dist/types/src/core/lasso-hit-test.d.ts +25 -0
  115. package/dist/types/src/core/lasso.d.ts +10 -0
  116. package/dist/types/src/core/layout/dagre.d.ts +11 -0
  117. package/dist/types/src/core/layout/elk.d.ts +13 -0
  118. package/dist/types/src/core/layout/force.d.ts +15 -0
  119. package/dist/types/src/core/layout/hierarchy.d.ts +13 -0
  120. package/dist/types/src/core/long-press.d.ts +11 -0
  121. package/dist/types/src/core/markers.d.ts +49 -0
  122. package/dist/types/src/core/minimap.d.ts +18 -0
  123. package/dist/types/src/core/node-flags.d.ts +19 -0
  124. package/dist/types/src/core/pan-zoom.d.ts +62 -0
  125. package/dist/types/src/core/proximity-connect.d.ts +25 -0
  126. package/dist/types/src/core/registry.d.ts +16 -0
  127. package/dist/types/src/core/render-plan.d.ts +52 -0
  128. package/dist/types/src/core/resize.d.ts +31 -0
  129. package/dist/types/src/core/rotation.d.ts +8 -0
  130. package/dist/types/src/core/selection-box.d.ts +14 -0
  131. package/dist/types/src/core/shapes.d.ts +10 -0
  132. package/dist/types/src/core/sub-flow.d.ts +61 -0
  133. package/dist/types/src/core/svg-path.d.ts +5 -0
  134. package/dist/types/src/core/types.d.ts +1238 -0
  135. package/dist/types/src/core/wire-bridge.d.ts +36 -0
  136. package/dist/types/src/index.d.ts +43 -0
  137. package/dist/types/src/layout/dagre.d.ts +2 -0
  138. package/dist/types/src/layout/elk.d.ts +2 -0
  139. package/dist/types/src/layout/force.d.ts +2 -0
  140. package/dist/types/src/layout/hierarchy.d.ts +2 -0
  141. package/dist/types/src/plugin/connection-utils.d.ts +54 -0
  142. package/dist/types/src/plugin/data/__test-utils.d.ts +9 -0
  143. package/dist/types/src/plugin/data/canvas-animation.d.ts +62 -0
  144. package/dist/types/src/plugin/data/canvas-collapse.d.ts +35 -0
  145. package/dist/types/src/plugin/data/canvas-compute.d.ts +6 -0
  146. package/dist/types/src/plugin/data/canvas-condense.d.ts +19 -0
  147. package/dist/types/src/plugin/data/canvas-config.d.ts +4 -0
  148. package/dist/types/src/plugin/data/canvas-context.d.ts +570 -0
  149. package/dist/types/src/plugin/data/canvas-dom.d.ts +13 -0
  150. package/dist/types/src/plugin/data/canvas-edges.d.ts +37 -0
  151. package/dist/types/src/plugin/data/canvas-history.d.ts +53 -0
  152. package/dist/types/src/plugin/data/canvas-layout.d.ts +151 -0
  153. package/dist/types/src/plugin/data/canvas-nodes.d.ts +73 -0
  154. package/dist/types/src/plugin/data/canvas-rows.d.ts +13 -0
  155. package/dist/types/src/plugin/data/canvas-selection.d.ts +45 -0
  156. package/dist/types/src/plugin/data/canvas-validation.d.ts +21 -0
  157. package/dist/types/src/plugin/data/canvas-viewport.d.ts +111 -0
  158. package/dist/types/src/plugin/data/flow-canvas.d.ts +2 -0
  159. package/dist/types/src/plugin/directives/flow-action.d.ts +12 -0
  160. package/dist/types/src/plugin/directives/flow-animate.d.ts +2 -0
  161. package/dist/types/src/plugin/directives/flow-arrow-draw.d.ts +2 -0
  162. package/dist/types/src/plugin/directives/flow-circle-draw.d.ts +2 -0
  163. package/dist/types/src/plugin/directives/flow-collapse.d.ts +2 -0
  164. package/dist/types/src/plugin/directives/flow-condense.d.ts +2 -0
  165. package/dist/types/src/plugin/directives/flow-context-menu.d.ts +2 -0
  166. package/dist/types/src/plugin/directives/flow-detail.d.ts +2 -0
  167. package/dist/types/src/plugin/directives/flow-devtools.d.ts +2 -0
  168. package/dist/types/src/plugin/directives/flow-drag-handle.d.ts +2 -0
  169. package/dist/types/src/plugin/directives/flow-draggable.d.ts +2 -0
  170. package/dist/types/src/plugin/directives/flow-edge-toolbar.d.ts +2 -0
  171. package/dist/types/src/plugin/directives/flow-edge.d.ts +7 -0
  172. package/dist/types/src/plugin/directives/flow-eraser.d.ts +2 -0
  173. package/dist/types/src/plugin/directives/flow-filter.d.ts +9 -0
  174. package/dist/types/src/plugin/directives/flow-follow.d.ts +9 -0
  175. package/dist/types/src/plugin/directives/flow-freehand.d.ts +2 -0
  176. package/dist/types/src/plugin/directives/flow-handle-connectable.d.ts +12 -0
  177. package/dist/types/src/plugin/directives/flow-handle-limit.d.ts +9 -0
  178. package/dist/types/src/plugin/directives/flow-handle-validate.d.ts +10 -0
  179. package/dist/types/src/plugin/directives/flow-handle.d.ts +29 -0
  180. package/dist/types/src/plugin/directives/flow-highlighter.d.ts +2 -0
  181. package/dist/types/src/plugin/directives/flow-loading.d.ts +2 -0
  182. package/dist/types/src/plugin/directives/flow-node-toolbar.d.ts +2 -0
  183. package/dist/types/src/plugin/directives/flow-node.d.ts +10 -0
  184. package/dist/types/src/plugin/directives/flow-panel.d.ts +2 -0
  185. package/dist/types/src/plugin/directives/flow-rectangle-draw.d.ts +2 -0
  186. package/dist/types/src/plugin/directives/flow-resizer.d.ts +2 -0
  187. package/dist/types/src/plugin/directives/flow-rotate.d.ts +11 -0
  188. package/dist/types/src/plugin/directives/flow-row-select.d.ts +2 -0
  189. package/dist/types/src/plugin/directives/flow-snapshot.d.ts +14 -0
  190. package/dist/types/src/plugin/directives/flow-text-tool.d.ts +2 -0
  191. package/dist/types/src/plugin/directives/flow-timeline.d.ts +2 -0
  192. package/dist/types/src/plugin/directives/flow-viewport.d.ts +2 -0
  193. package/dist/types/src/plugin/magics/flow.d.ts +2 -0
  194. package/dist/types/src/plugin/store.d.ts +2 -0
  195. package/dist/types/src/whiteboard/index.d.ts +2 -0
  196. package/package.json +153 -0
@@ -0,0 +1,1238 @@
1
+ import type { EasingName } from '../animate/easing';
2
+ import type { PathFunction } from '../animate/paths';
3
+ import type { CollabConfig, CollabInstance } from '../collab/types';
4
+ /** 2D coordinate */
5
+ export interface XYPosition {
6
+ x: number;
7
+ y: number;
8
+ }
9
+ /** Viewport state: pan offset + zoom level */
10
+ export interface Viewport {
11
+ x: number;
12
+ y: number;
13
+ zoom: number;
14
+ }
15
+ /** Bounding box for nodes/viewport calculations */
16
+ export interface Rect {
17
+ x: number;
18
+ y: number;
19
+ width: number;
20
+ height: number;
21
+ }
22
+ /** Dimensions of a measured DOM element */
23
+ export interface Dimensions {
24
+ width: number;
25
+ height: number;
26
+ }
27
+ /** Coordinate extent: [[minX, minY], [maxX, maxY]] */
28
+ export type CoordinateExtent = [[number, number], [number, number]];
29
+ /** Row filter: preset name or custom predicate. */
30
+ export type RowFilter = 'all' | 'connected' | 'unconnected' | ((row: any) => boolean);
31
+ export interface FlowNode<T = Record<string, any>> {
32
+ id: string;
33
+ position: XYPosition;
34
+ data: T;
35
+ /** Node type — maps to a rendering template. Default: 'default' */
36
+ type?: string;
37
+ /** Width/height, populated after DOM measurement */
38
+ dimensions?: Dimensions;
39
+ /** Minimum width/height constraints. Applied during layout and resize. */
40
+ minDimensions?: Partial<Dimensions>;
41
+ /** Maximum width/height constraints. Applied during layout and resize. */
42
+ maxDimensions?: Partial<Dimensions>;
43
+ /** Anchor point on the node that `position` refers to.
44
+ * [0,0] = top-left (default), [0.5, 0.5] = center, [1,1] = bottom-right. */
45
+ nodeOrigin?: [number, number];
46
+ /** Can this node be dragged? Default: true */
47
+ draggable?: boolean;
48
+ /** Can edges connect to this node? Default: true */
49
+ connectable?: boolean;
50
+ /** Handle visibility mode. Default: 'visible'.
51
+ * 'hidden' hides all handles, 'hover' shows on node hover,
52
+ * 'select' shows when node is selected. */
53
+ handles?: 'visible' | 'hidden' | 'hover' | 'select';
54
+ /** Can this node be selected? Default: true */
55
+ selectable?: boolean;
56
+ /** Can this node be resized via x-flow-resizer? Default: true */
57
+ resizable?: boolean;
58
+ /** Can this node receive keyboard focus? Default: follows `nodesFocusable` config (true). */
59
+ focusable?: boolean;
60
+ /** Override the ARIA role for this node. Default: 'group' */
61
+ ariaRole?: string;
62
+ /** Override the auto-generated aria-label for this node. */
63
+ ariaLabel?: string;
64
+ /** Arbitrary DOM attributes to apply to this node's element (e.g. data-*, aria-describedby). */
65
+ domAttributes?: Record<string, string>;
66
+ /** Hide this node from rendering. Connected edges are also hidden. Default: false */
67
+ hidden?: boolean;
68
+ /** Whether this node's connected nodes are collapsed (hidden). Default: false */
69
+ collapsed?: boolean;
70
+ /** Whether this node's internal rows are condensed (summary view). Default: false */
71
+ condensed?: boolean;
72
+ /** Filter which rows are visible. Preset: 'all' (default), 'connected', 'unconnected'.
73
+ * Custom: a predicate `(row) => boolean` — rows returning false are hidden. */
74
+ rowFilter?: RowFilter;
75
+ /** Whether this node is excluded by a node-level filter. CSS-driven visibility. */
76
+ filtered?: boolean;
77
+ /** Dimensions to use when this group node is collapsed.
78
+ * Only meaningful on group nodes. Default: { width: 150, height: 60 } */
79
+ collapsedDimensions?: Dimensions;
80
+ /** Can this node be deleted via keyboard (Delete/Backspace)? Default: true */
81
+ deletable?: boolean;
82
+ /** Fully freeze this node — prevents drag, delete, connect, reconnect,
83
+ * select, and resize. Shows dashed border (.flow-node-locked).
84
+ * Individual flags (draggable, deletable, etc.) override locked when
85
+ * set explicitly. Default: false */
86
+ locked?: boolean;
87
+ /** When reconnectOnDelete is enabled globally, set to false to skip
88
+ * reconnection for this node. Default: true (inherits canvas config). */
89
+ reconnectOnDelete?: boolean;
90
+ /** Is this node currently selected? */
91
+ selected?: boolean;
92
+ /** Optional CSS class(es) */
93
+ class?: string;
94
+ /** Optional inline styles */
95
+ style?: string | Record<string, string>;
96
+ /** Parent node ID — position becomes relative to parent's top-left corner */
97
+ parentId?: string;
98
+ /** Clamp child within parent bounds during drag, or provide coordinate boundaries.
99
+ * 'parent' is only used when parentId is set. CoordinateExtent works for any node. */
100
+ extent?: 'parent' | CoordinateExtent;
101
+ /** Grow parent dimensions when child reaches edge. Only used when parentId is set. */
102
+ expandParent?: boolean;
103
+ /** Explicit z-index. For children: computed = parentZ + 1 + zIndex */
104
+ zIndex?: number;
105
+ /** Default position for source handles. Handles without a position modifier inherit this. */
106
+ sourcePosition?: HandlePosition;
107
+ /** Default position for target handles. Handles without a position modifier inherit this. */
108
+ targetPosition?: HandlePosition;
109
+ /** Node shape variant. Applies shape CSS class and shape-aware edge connections. */
110
+ shape?: NodeShape | string;
111
+ /** Rotation angle in degrees. CSS transform applied by x-flow-node. Default: 0 */
112
+ rotation?: number;
113
+ /** When true, this node accepts other nodes dropped onto it as children. */
114
+ droppable?: boolean;
115
+ /**
116
+ * Optional predicate to filter which nodes may be dropped into this node.
117
+ * Called with the dragged node during drop-target detection. If it returns
118
+ * false the node is skipped as a target. Works with both `droppable` and
119
+ * `childLayout` nodes.
120
+ */
121
+ acceptsDrop?: (node: FlowNode) => boolean;
122
+ /** Opt-in layout for this node's children. Implies preventChildEscape: true.
123
+ * Children are auto-arranged and the parent auto-sizes to fit. */
124
+ childLayout?: ChildLayout;
125
+ /** Sort order within a layout parent. Lower = first. Auto-assigned on drop. */
126
+ order?: number;
127
+ /** Current child validation errors (populated by _recomputeChildValidation). */
128
+ _validationErrors?: string[];
129
+ }
130
+ /** Configuration for automatic child arrangement within a parent node. */
131
+ export interface ChildLayout {
132
+ /** Arrangement direction. */
133
+ direction: 'vertical' | 'horizontal' | 'grid';
134
+ /** How children stretch to fill the parent.
135
+ * Default: 'width' for vertical, 'height' for horizontal, 'both' for grid. */
136
+ stretch?: 'none' | 'width' | 'height' | 'both';
137
+ /** Space between children in px. Default: 8 */
138
+ gap?: number;
139
+ /** Inner padding of the parent in px. Default: 12 */
140
+ padding?: number;
141
+ /** Extra top offset for a parent label/header in px. Default: 0 (auto 30 when parent has data.label) */
142
+ headerHeight?: number;
143
+ /** Grid-only: number of columns. Default: 2 */
144
+ columns?: number;
145
+ /** Swap threshold for drag-to-reorder (0–1), inspired by SortableJS.
146
+ * Controls how far past a sibling the dragged node must move before
147
+ * swapping. Uses directional inversion so both up/down (or left/right)
148
+ * require the same penetration fraction. 0.5 = midpoint. Default: 0.5
149
+ * @see https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction */
150
+ swapThreshold?: number;
151
+ }
152
+ /** Validation result from a child operation check. */
153
+ export interface ChildValidationResult {
154
+ valid: boolean;
155
+ rule?: string;
156
+ message?: string;
157
+ }
158
+ /** Validation rules for parent nodes constraining their children. */
159
+ export interface ChildValidation {
160
+ /** Minimum number of children. Parent is invalid below this count. */
161
+ minChildren?: number;
162
+ /** Maximum number of children. Adding beyond this count is rejected. */
163
+ maxChildren?: number;
164
+ /** Shorthand for minChildren: 1. Parent is invalid when empty. */
165
+ requiredChildren?: boolean;
166
+ /** Whitelist of allowed child node types. Unlisted types are rejected. */
167
+ allowedChildTypes?: string[];
168
+ /** Prevent children from being dragged out of this parent. */
169
+ preventChildEscape?: boolean;
170
+ /** Per-type min/max constraints. Keys are node type strings. */
171
+ childTypeConstraints?: Record<string, {
172
+ min?: number;
173
+ max?: number;
174
+ }>;
175
+ /** Custom validator. Return true to allow, or a string error message to reject. */
176
+ validateChild?: (child: FlowNode, siblings: FlowNode[]) => boolean | string;
177
+ }
178
+ /** Detail passed to onChildValidationFail callback. */
179
+ export interface ChildValidationFailDetail {
180
+ parent: FlowNode;
181
+ child: FlowNode;
182
+ operation: 'add' | 'remove' | 'move-in' | 'move-out';
183
+ rule: string;
184
+ message: string;
185
+ }
186
+ export type EdgeType = 'bezier' | 'smoothstep' | 'straight' | 'floating' | 'orthogonal' | 'avoidant' | 'editable';
187
+ /** Edge animation mode */
188
+ export type EdgeAnimationMode = 'none' | 'dash' | 'pulse' | 'dot';
189
+ import type { MarkerType, MarkerConfig } from './markers';
190
+ /** Two-color linear gradient for edge strokes. */
191
+ export interface EdgeGradient {
192
+ from: string;
193
+ to: string;
194
+ }
195
+ export interface FlowEdge<T = Record<string, any>> {
196
+ id: string;
197
+ source: string;
198
+ target: string;
199
+ /** Which handle on the source node (default: 'source') */
200
+ sourceHandle?: string;
201
+ /** Which handle on the target node (default: 'target') */
202
+ targetHandle?: string;
203
+ /** Edge path type. Default: 'bezier'. Custom strings are looked up in edgeTypes registry. */
204
+ type?: EdgeType | (string & {});
205
+ /** Path rendering style for floating edges. Only used when type is 'floating'. Default: 'bezier' */
206
+ pathType?: 'bezier' | 'smoothstep' | 'straight';
207
+ /** Whether/how this edge is animated. true or 'dash' for scrolling dashes,
208
+ * 'pulse' for opacity breathing, 'dot' for traveling circle. Default: false */
209
+ animated?: boolean | EdgeAnimationMode;
210
+ /** Animation cycle duration (CSS time value, e.g. '1s', '300ms').
211
+ * Overrides the CSS variable for this edge. */
212
+ animationDuration?: string;
213
+ /** Is this edge currently selected? */
214
+ selected?: boolean;
215
+ /** Can this edge be reconnected by dragging its endpoints? Default: true.
216
+ * Set to 'source' or 'target' to allow only one end to be dragged. */
217
+ reconnectable?: boolean | 'source' | 'target';
218
+ /** Hide this edge from rendering. Default: false */
219
+ hidden?: boolean;
220
+ /** Can this edge be deleted via keyboard (Delete/Backspace)? Default: true */
221
+ deletable?: boolean;
222
+ /** Can this edge receive keyboard focus? Default: follows `edgesFocusable` config (true). */
223
+ focusable?: boolean;
224
+ /** Override the ARIA role for this edge. Default: 'group' */
225
+ ariaRole?: string;
226
+ /** Override the auto-generated aria-label for this edge. */
227
+ ariaLabel?: string;
228
+ /** Arbitrary DOM attributes to apply to this edge's element (e.g. data-*, aria-describedby). */
229
+ domAttributes?: Record<string, string>;
230
+ /** Arbitrary data attached to the edge */
231
+ data?: T;
232
+ /** When labels become visible. 'always' (default) = always shown, 'hover' = on hover or
233
+ * when selected, 'selected' = only when selected. Applies to all labels (center, start, end). */
234
+ labelVisibility?: 'always' | 'hover' | 'selected';
235
+ /** Optional label displayed on the edge */
236
+ label?: string;
237
+ /** Position of the center label along the path (0 = source, 1 = target). Default: 0.5 */
238
+ labelPosition?: number;
239
+ /** Optional label displayed near the source end of the edge */
240
+ labelStart?: string;
241
+ /** Offset along edge path in flow coordinates (scales with zoom). Default: 30 */
242
+ labelStartOffset?: number;
243
+ /** Optional label displayed near the target end of the edge */
244
+ labelEnd?: string;
245
+ /** Offset along edge path in flow coordinates (scales with zoom). Default: 30 */
246
+ labelEndOffset?: number;
247
+ /** SVG marker at the start of the edge (arrowhead, etc.) */
248
+ markerStart?: MarkerType | MarkerConfig;
249
+ /** SVG marker at the end of the edge (arrowhead, etc.) */
250
+ markerEnd?: MarkerType | MarkerConfig;
251
+ /**
252
+ * Stroke color. Accepts a solid color string or a gradient object.
253
+ * When omitted, CSS rules apply (default via --flow-edge-stroke).
254
+ *
255
+ * @example
256
+ * color: '#ef4444' // solid red
257
+ * color: { from: '#22c55e', to: '#ef4444' } // green-to-red gradient
258
+ *
259
+ * // TODO(future): Radial gradients — { type: 'radial', from, to }
260
+ * // TODO(future): Multi-stop gradients — array of { offset, color }
261
+ * // TODO(future): Path-following gradients — gradient curves along edge path
262
+ */
263
+ color?: string | EdgeGradient;
264
+ /** Direction of gradient color flow. Only applies when `color` is an EdgeGradient object. Default: 'source-target'. */
265
+ gradientDirection?: 'source-target' | 'target-source';
266
+ /** Visible stroke width in SVG units. Default: 1.5 */
267
+ strokeWidth?: number;
268
+ /** Invisible hit area width for click/hover detection (SVG units). Default: 20 */
269
+ interactionWidth?: number;
270
+ /** Optional CSS class(es) */
271
+ class?: string;
272
+ /** Optional inline styles */
273
+ style?: string | Record<string, string>;
274
+ /** Particle/dot fill color. Overrides --flow-edge-dot-fill for this edge.
275
+ * Also used as the default color for particles sent along this edge. */
276
+ particleColor?: string;
277
+ /** Particle/dot radius (unitless SVG). Overrides --flow-edge-dot-size for this edge. */
278
+ particleSize?: number;
279
+ /** User-placed waypoints for editable edges. Array of {x, y} in flow coordinates. */
280
+ controlPoints?: {
281
+ x: number;
282
+ y: number;
283
+ }[];
284
+ /** How to render the path between control points. Only used with type: 'editable'.
285
+ * Default: 'bezier' */
286
+ pathStyle?: 'linear' | 'step' | 'smoothstep' | 'catmull-rom' | 'bezier';
287
+ /** Whether to always show control point handles (vs only when selected). Default: false */
288
+ showControlPoints?: boolean;
289
+ }
290
+ /** Runtime check: does `obj` look like a FlowNode? */
291
+ export declare function isNode(obj: unknown): obj is FlowNode;
292
+ /** Runtime check: does `obj` look like a FlowEdge? */
293
+ export declare function isEdge(obj: unknown): obj is FlowEdge;
294
+ export type HandleType = 'source' | 'target';
295
+ export type HandlePosition = 'top' | 'right' | 'bottom' | 'left' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
296
+ export interface HandleConfig {
297
+ type: HandleType;
298
+ position: HandlePosition;
299
+ id?: string;
300
+ }
301
+ export interface Connection {
302
+ source: string;
303
+ sourceHandle?: string;
304
+ target: string;
305
+ targetHandle?: string;
306
+ }
307
+ export interface PendingConnection {
308
+ source: string;
309
+ sourceHandle?: string;
310
+ /** Current mouse/pointer position in flow coordinates */
311
+ position: XYPosition;
312
+ }
313
+ export interface PendingReconnection {
314
+ edge: FlowEdge;
315
+ draggedEnd: HandleType;
316
+ anchorPosition: XYPosition;
317
+ position: XYPosition;
318
+ }
319
+ /** Props passed to the custom connection line renderer. */
320
+ export interface ConnectionLineProps {
321
+ fromX: number;
322
+ fromY: number;
323
+ toX: number;
324
+ toY: number;
325
+ source: string;
326
+ sourceHandle?: string;
327
+ connectionLineType: string;
328
+ connectionLineStyle: {
329
+ stroke: string;
330
+ strokeWidth: number;
331
+ strokeDasharray: string;
332
+ };
333
+ }
334
+ export interface FlowEvents {
335
+ 'node-click': {
336
+ node: FlowNode;
337
+ event: MouseEvent;
338
+ };
339
+ 'node-drag-start': {
340
+ node: FlowNode;
341
+ };
342
+ 'node-drag': {
343
+ node: FlowNode;
344
+ position: XYPosition;
345
+ };
346
+ 'node-drag-end': {
347
+ node: FlowNode;
348
+ position: XYPosition;
349
+ };
350
+ 'node-resize-start': {
351
+ node: FlowNode;
352
+ dimensions: Dimensions;
353
+ };
354
+ 'node-resize': {
355
+ node: FlowNode;
356
+ dimensions: Dimensions;
357
+ };
358
+ 'node-resize-end': {
359
+ node: FlowNode;
360
+ dimensions: Dimensions;
361
+ };
362
+ 'edge-click': {
363
+ edge: FlowEdge;
364
+ event: MouseEvent;
365
+ };
366
+ 'connect-start': {
367
+ source: string;
368
+ sourceHandle?: string;
369
+ };
370
+ 'connect': {
371
+ connection: Connection;
372
+ };
373
+ 'multi-connect': {
374
+ connections: Connection[];
375
+ };
376
+ 'connect-end': {
377
+ connection: Connection | null;
378
+ source: string;
379
+ sourceHandle?: string;
380
+ position: XYPosition;
381
+ };
382
+ 'reconnect-start': {
383
+ edge: FlowEdge;
384
+ handleType: HandleType;
385
+ };
386
+ 'reconnect': {
387
+ oldEdge: FlowEdge;
388
+ newConnection: Connection;
389
+ };
390
+ 'reconnect-end': {
391
+ edge: FlowEdge;
392
+ successful: boolean;
393
+ };
394
+ 'viewport-change': {
395
+ viewport: Viewport;
396
+ };
397
+ 'viewport-move-start': {
398
+ viewport: Viewport;
399
+ };
400
+ 'viewport-move': {
401
+ viewport: Viewport;
402
+ };
403
+ 'viewport-move-end': {
404
+ viewport: Viewport;
405
+ };
406
+ 'pane-click': {
407
+ event: MouseEvent;
408
+ position: XYPosition;
409
+ };
410
+ 'node-context-menu': {
411
+ node: FlowNode;
412
+ event: MouseEvent;
413
+ };
414
+ 'edge-context-menu': {
415
+ edge: FlowEdge;
416
+ event: MouseEvent;
417
+ };
418
+ 'pane-context-menu': {
419
+ event: MouseEvent;
420
+ position: XYPosition;
421
+ };
422
+ 'selection-context-menu': {
423
+ nodes: FlowNode[];
424
+ event: MouseEvent;
425
+ };
426
+ 'selection-change': {
427
+ nodes: string[];
428
+ edges: string[];
429
+ rows: string[];
430
+ };
431
+ 'nodes-change': {
432
+ type: 'add' | 'remove';
433
+ nodes: FlowNode[];
434
+ };
435
+ 'edges-change': {
436
+ type: 'add' | 'remove';
437
+ edges: FlowEdge[];
438
+ };
439
+ 'node-collapse': {
440
+ node: FlowNode;
441
+ descendants: string[];
442
+ };
443
+ 'node-expand': {
444
+ node: FlowNode;
445
+ descendants: string[];
446
+ };
447
+ 'node-condense': {
448
+ node: FlowNode;
449
+ };
450
+ 'node-uncondense': {
451
+ node: FlowNode;
452
+ };
453
+ 'row-select': {
454
+ rowId: string;
455
+ nodeId: string;
456
+ attrId: string;
457
+ };
458
+ 'row-deselect': {
459
+ rowId: string;
460
+ nodeId: string;
461
+ attrId: string;
462
+ };
463
+ 'row-selection-change': {
464
+ selectedRows: string[];
465
+ };
466
+ 'node-filter-change': {
467
+ filtered: FlowNode[];
468
+ visible: FlowNode[];
469
+ };
470
+ 'helper-lines-change': {
471
+ horizontal: number[];
472
+ vertical: number[];
473
+ };
474
+ 'nodes-patch': {
475
+ patches: Record<string, DeepPartial<FlowNode>>;
476
+ };
477
+ 'edges-patch': {
478
+ patches: Record<string, DeepPartial<FlowEdge>>;
479
+ };
480
+ 'init': undefined;
481
+ 'destroy': undefined;
482
+ }
483
+ /** Per-overlay visibility options for toImage(). All default to false (excluded). */
484
+ export interface ToImageOverlays {
485
+ /** Include toolbar and other .canvas-overlay elements. Default: false */
486
+ toolbar?: boolean;
487
+ /** Include minimap (.flow-minimap). Default: false */
488
+ minimap?: boolean;
489
+ /** Include controls panel (.flow-controls). Default: false */
490
+ controls?: boolean;
491
+ /** Include flow panels (.flow-panel). Default: false */
492
+ panels?: boolean;
493
+ }
494
+ export interface ToImageOptions {
495
+ /** Image width in pixels. Default: 1920 */
496
+ width?: number;
497
+ /** Image height in pixels. Default: 1080 */
498
+ height?: number;
499
+ /** Padding as fraction of bounds. Default: 0.1 */
500
+ padding?: number;
501
+ /** Background color. Default: computed --flow-bg-color */
502
+ background?: string;
503
+ /** Export scope. 'all' fits every non-hidden node; 'viewport' captures current view. Default: 'all' */
504
+ scope?: 'all' | 'viewport';
505
+ /** When provided, triggers a browser download with this filename. */
506
+ filename?: string;
507
+ /** Include UI overlays in the image. `true` includes all overlays; an object enables
508
+ * specific overlays individually. Selection box is always excluded. Default: false */
509
+ includeOverlays?: boolean | ToImageOverlays;
510
+ }
511
+ /** Recursive partial — every nested object key becomes optional. */
512
+ export type DeepPartial<T> = {
513
+ [P in keyof T]?: T[P] extends (infer U)[] ? U[] : T[P] extends object ? DeepPartial<T[P]> : T[P];
514
+ };
515
+ /** Configuration for automatic layout on structural changes. */
516
+ export interface AutoLayoutConfig {
517
+ /** Which layout algorithm to use. */
518
+ algorithm: 'dagre' | 'force' | 'hierarchy' | 'elk';
519
+ /** Debounce delay in ms before re-layout triggers. Default: 50 */
520
+ debounce?: number;
521
+ /** Animation duration in ms. Default: 300 */
522
+ duration?: number;
523
+ /** Auto-fit viewport after layout. Default: true */
524
+ fitView?: boolean;
525
+ direction?: 'TB' | 'LR' | 'BT' | 'RL';
526
+ nodesep?: number;
527
+ ranksep?: number;
528
+ adjustHandles?: boolean;
529
+ strength?: number;
530
+ distance?: number;
531
+ charge?: number;
532
+ iterations?: number;
533
+ layoutType?: 'tree' | 'cluster';
534
+ nodeWidth?: number;
535
+ nodeHeight?: number;
536
+ elkAlgorithm?: 'layered' | 'force' | 'mrtree' | 'radial' | 'stress';
537
+ nodeSpacing?: number;
538
+ layerSpacing?: number;
539
+ }
540
+ /** Subset of FlowCanvasConfig that is safe to update at runtime. */
541
+ export interface PatchableConfig {
542
+ minZoom?: number;
543
+ maxZoom?: number;
544
+ pannable?: boolean;
545
+ zoomable?: boolean;
546
+ snapToGrid?: false | [number, number];
547
+ nodeExtent?: CoordinateExtent;
548
+ background?: 'dots' | 'lines' | 'cross' | 'none' | BackgroundLayer[];
549
+ backgroundGap?: number;
550
+ patternColor?: string;
551
+ panOnScroll?: boolean;
552
+ panOnScrollDirection?: 'both' | 'vertical' | 'horizontal';
553
+ panOnScrollSpeed?: number;
554
+ debug?: boolean;
555
+ autoPanOnNodeDrag?: boolean;
556
+ autoPanOnConnect?: boolean;
557
+ autoPanSpeed?: number;
558
+ connectionSnapRadius?: number;
559
+ edgesReconnectable?: boolean;
560
+ reconnectSnapRadius?: number;
561
+ minimapNodeColor?: string | ((node: FlowNode) => string);
562
+ minimapMaskColor?: string;
563
+ minimapPannable?: boolean;
564
+ minimapZoomable?: boolean;
565
+ defaultInteractionWidth?: number;
566
+ preventOverlap?: boolean | number;
567
+ reconnectOnDelete?: boolean;
568
+ preventCycles?: boolean;
569
+ colorMode?: 'light' | 'dark' | 'system';
570
+ selectionMode?: 'partial' | 'full';
571
+ selectionTool?: 'box' | 'lasso';
572
+ lassoSelectsEdges?: boolean;
573
+ loading?: boolean;
574
+ loadingText?: string;
575
+ childValidationRules?: Record<string, ChildValidation>;
576
+ autoLayout?: AutoLayoutConfig | false;
577
+ nodeOrigin?: [number, number];
578
+ }
579
+ /** A single background pattern layer. */
580
+ export interface BackgroundLayer {
581
+ /** Pattern type: 'dots' (radial), 'lines' (grid), or 'cross' (plus signs). */
582
+ variant: 'dots' | 'lines' | 'cross';
583
+ /** Grid spacing in pixels. Default: uses --flow-bg-pattern-gap or 20. */
584
+ gap?: number;
585
+ /** Pattern color. Default: uses --flow-bg-pattern-color. */
586
+ color?: string;
587
+ }
588
+ /** Built-in node shape names. */
589
+ export type NodeShape = 'circle' | 'diamond' | 'hexagon' | 'parallelogram' | 'triangle' | 'cylinder' | 'stadium';
590
+ /** Definition for a custom (or built-in) node shape. */
591
+ export interface ShapeDefinition {
592
+ /** CSS clip-path value applied to the node element. Not needed for built-in shapes. */
593
+ clipPath?: string;
594
+ /**
595
+ * Compute the edge connection point for a handle position on this shape.
596
+ * Returns { x, y } relative to the node's top-left origin.
597
+ * Falls back to rectangular bounding box if not provided.
598
+ */
599
+ perimeterPoint: (width: number, height: number, position: HandlePosition) => {
600
+ x: number;
601
+ y: number;
602
+ };
603
+ }
604
+ /** Options for fire-and-forget edge particles. */
605
+ export interface ParticleOptions {
606
+ /** Particle fill color. Falls back to edge.particleColor → --flow-edge-dot-fill. */
607
+ color?: string;
608
+ /** Particle radius in SVG user units (scales with zoom). Falls back to edge.particleSize → --flow-edge-dot-size. */
609
+ size?: number;
610
+ /** Travel duration (CSS time value). Falls back to edge.animationDuration → --flow-edge-dot-duration. */
611
+ duration?: string;
612
+ /** CSS class(es) to add to the circle element. */
613
+ class?: string;
614
+ /** Called when the particle reaches the target and is removed. */
615
+ onComplete?: () => void;
616
+ }
617
+ /** Handle returned by sendParticle() for tracking a particle's position. */
618
+ export interface ParticleHandle {
619
+ /** Get the particle's current SVG position, or null if it has completed. */
620
+ getCurrentPosition(): XYPosition | null;
621
+ /** Stop and remove the particle immediately. */
622
+ stop(): void;
623
+ /** Resolves when the particle finishes (naturally or via stop()). */
624
+ readonly finished: Promise<void>;
625
+ }
626
+ export interface FlowCanvasConfig {
627
+ nodes?: FlowNode[];
628
+ edges?: FlowEdge[];
629
+ /** Initial viewport state */
630
+ viewport?: Partial<Viewport>;
631
+ /** ARIA label for the flow container. Default: 'Flow diagram' */
632
+ ariaLabel?: string;
633
+ /** Minimum zoom level. Default: 0.5 */
634
+ minZoom?: number;
635
+ /** Maximum zoom level. Default: 2 */
636
+ maxZoom?: number;
637
+ /** Enable panning. Default: true */
638
+ pannable?: boolean;
639
+ /** Enable zooming. Default: true */
640
+ zoomable?: boolean;
641
+ /** Only render nodes/edges visible in the viewport. Default: false */
642
+ viewportCulling?: boolean;
643
+ /** Buffer in flow-coordinate pixels around viewport for culling. Default: 100 */
644
+ cullingBuffer?: number;
645
+ /** Default anchor point for all nodes. [0,0] = top-left (default), [0.5,0.5] = center.
646
+ * Per-node `nodeOrigin` overrides this. */
647
+ nodeOrigin?: [number, number];
648
+ /** Default properties merged into edges created at runtime (drag-connect, click-to-connect, edge-drop).
649
+ * Edge-specific properties override these defaults. Does not affect initial config edges. */
650
+ defaultEdgeOptions?: Partial<FlowEdge>;
651
+ /** Default invisible hit area width for edges. Default: 20 */
652
+ defaultInteractionWidth?: number;
653
+ /** Snap node positions to grid. false or [gridX, gridY] */
654
+ snapToGrid?: false | [number, number];
655
+ /** Alignment guides during drag. true for defaults, object to configure, false/omitted to disable. */
656
+ helperLines?: boolean | {
657
+ /** Snap dragged node to alignment. Default: true */
658
+ snap?: boolean;
659
+ /** Distance threshold in flow pixels to trigger alignment. Default: 5 */
660
+ threshold?: number;
661
+ };
662
+ /** Viewport pan boundaries [[minX, minY], [maxX, maxY]]. Default: unbounded */
663
+ translateExtent?: CoordinateExtent;
664
+ /** Global node position boundaries [[minX, minY], [maxX, maxY]]. Default: unbounded */
665
+ nodeExtent?: CoordinateExtent;
666
+ /** Enable debug logging to console. Default: false */
667
+ debug?: boolean;
668
+ /** Background pattern. A string shorthand, array of layers, or 'none'. Default: 'dots' */
669
+ background?: 'dots' | 'lines' | 'cross' | 'none' | BackgroundLayer[];
670
+ /** Grid spacing in pixels. Overrides --flow-bg-pattern-gap. Default: 20 */
671
+ backgroundGap?: number;
672
+ /** Pattern color (dot or line stroke). Overrides --flow-bg-pattern-color. Supports rgba for opacity. */
673
+ patternColor?: string;
674
+ /** Pan viewport on mouse wheel instead of zooming. Ctrl/Cmd+wheel zooms. Default: false */
675
+ panOnScroll?: boolean;
676
+ /** Which axes scroll-panning applies to. Default: 'both' */
677
+ panOnScrollDirection?: 'both' | 'vertical' | 'horizontal';
678
+ /** Multiplier for scroll pan sensitivity. Default: 1 */
679
+ panOnScrollSpeed?: number;
680
+ /** Custom connection validator. Return false to reject. Called after built-in checks. */
681
+ isValidConnection?: (connection: Connection) => boolean;
682
+ /** Show a minimap panel. Default: false */
683
+ minimap?: boolean;
684
+ /** Allow panning by clicking/dragging the minimap. Default: false */
685
+ minimapPannable?: boolean;
686
+ /** Allow zooming by scrolling on the minimap. Default: false */
687
+ minimapZoomable?: boolean;
688
+ /** Position on canvas. Default: 'bottom-right' */
689
+ minimapPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
690
+ /** Fill color for minimap node rects. Can be per-node function. */
691
+ minimapNodeColor?: string | ((node: FlowNode) => string);
692
+ /** Mask color for area outside viewport. Default: 'rgba(0,0,0,0.3)' */
693
+ minimapMaskColor?: string;
694
+ /** Show a controls panel. Default: false */
695
+ controls?: boolean;
696
+ /** Position on canvas. Default: 'bottom-left' */
697
+ controlsPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
698
+ /** Layout direction. Default: 'vertical' */
699
+ controlsOrientation?: 'vertical' | 'horizontal';
700
+ /** Show zoom in/out buttons. Default: true */
701
+ controlsShowZoom?: boolean;
702
+ /** Show fit view button. Default: true */
703
+ controlsShowFitView?: boolean;
704
+ /** Show interactivity toggle. Default: true */
705
+ controlsShowInteractive?: boolean;
706
+ /** Show reset-panels button. Default: false */
707
+ controlsShowResetPanels?: boolean;
708
+ /** CSS selector for external container. When set, panel renders there instead of inside the canvas. */
709
+ controlsContainer?: string;
710
+ /** Auto-pan when dragging nodes near canvas edge. Default: true */
711
+ autoPanOnNodeDrag?: boolean;
712
+ /** Auto-pan when drawing connections near canvas edge. Default: true */
713
+ autoPanOnConnect?: boolean;
714
+ /** Auto-pan speed multiplier. Default: 15 */
715
+ autoPanSpeed?: number;
716
+ /** Allow nodes to receive keyboard focus via Tab. Default: true */
717
+ nodesFocusable?: boolean;
718
+ /** Allow edges to receive keyboard focus via Tab. Default: true */
719
+ edgesFocusable?: boolean;
720
+ /** Disable arrow-key movement for selected nodes (Tab/Enter still work). Default: false */
721
+ disableKeyboardA11y?: boolean;
722
+ /** Screen reader announcements. true (default) = on, false = off,
723
+ * or object with formatMessage callback for custom messages. */
724
+ announcements?: boolean | {
725
+ formatMessage?: (event: string, detail: Record<string, any>) => string | null;
726
+ };
727
+ /** Compute mode. 'manual' (default) = explicit $flow.compute() calls,
728
+ * 'auto' = re-propagate on node/edge changes (debounced). */
729
+ computeMode?: 'auto' | 'manual';
730
+ /** Customize keyboard shortcuts. Omit a key for default, set to null to disable. */
731
+ keyboardShortcuts?: import('./keyboard-shortcuts').KeyboardShortcuts;
732
+ /** Selection containment mode. 'partial' selects on any overlap (default), 'full' requires entire node inside box. */
733
+ selectionMode?: 'partial' | 'full';
734
+ /** Start selection box on plain left-click drag (no modifier needed). Pair with panOnDrag: [2] for whiteboard UX. Default: false */
735
+ selectionOnDrag?: boolean;
736
+ /** Selection tool: 'box' for rectangular, 'lasso' for freeform. Default: 'box' */
737
+ selectionTool?: 'box' | 'lasso';
738
+ /** Whether lasso selection also selects edges. Default: false */
739
+ lassoSelectsEdges?: boolean;
740
+ /** Bump z-index of selected nodes so they render above unselected nodes. Default: true */
741
+ elevateNodesOnSelect?: boolean;
742
+ /** Action triggered by long-press on touch devices. Default: 'context-menu' */
743
+ longPressAction?: 'context-menu' | 'select' | null;
744
+ /** Duration in ms before long-press triggers. Default: 500 */
745
+ longPressDuration?: number;
746
+ /** Enable two-finger-tap to toggle touch selection mode. Default: true */
747
+ touchSelectionMode?: boolean;
748
+ /** Zoom-level thresholds for contextual zoom / level-of-detail rendering.
749
+ * Sets `data-zoom-level` attribute on the container (`'far'`, `'medium'`, `'close'`).
750
+ * Provide custom thresholds or `false` to disable. Default: `{ far: 0.4, medium: 0.75 }` */
751
+ zoomLevels?: false | {
752
+ far?: number;
753
+ medium?: number;
754
+ };
755
+ /** Allow edge endpoints to be dragged to different handles. Default: true */
756
+ edgesReconnectable?: boolean;
757
+ /** Proximity radius (in flow pixels) for snapping to endpoints. Default: 10 */
758
+ reconnectSnapRadius?: number;
759
+ /** Pixel radius for snapping connections to nearby handles. 0 disables. Default: 20 */
760
+ connectionSnapRadius?: number;
761
+ /** Enable click-to-connect: click source handle, then click target handle. Default: true */
762
+ connectOnClick?: boolean;
763
+ /** Type of path used for the temporary connection drag line.
764
+ * Default: 'straight' */
765
+ connectionLineType?: 'bezier' | 'smoothstep' | 'straight' | 'step';
766
+ /** Style overrides for the temporary connection drag line. */
767
+ connectionLineStyle?: {
768
+ stroke?: string;
769
+ strokeWidth?: number;
770
+ strokeDasharray?: string;
771
+ };
772
+ /** Full custom renderer for the temp connection line.
773
+ * When set, overrides connectionLineType. Must return an SVG element. */
774
+ connectionLine?: (props: ConnectionLineProps) => SVGElement;
775
+ /** When enabled, dragging from a selected node's source handle creates
776
+ * connection lines from ALL selected nodes' source handles to the cursor.
777
+ * On drop, valid connections are created in a single batch. Default: false */
778
+ multiConnect?: boolean;
779
+ /** Enable connecting by holding a modifier key and dragging from node body. Default: false */
780
+ easyConnect?: boolean;
781
+ /** Modifier key for easy connect. Default: 'alt' */
782
+ easyConnectKey?: 'alt' | 'meta' | 'shift';
783
+ /** Auto-create edges when dragging nodes near each other. Default: false */
784
+ proximityConnect?: boolean;
785
+ /** Distance threshold in flow pixels for proximity connect. Default: 150 */
786
+ proximityConnectDistance?: number;
787
+ /** Show visual confirmation before creating proximity edge. Default: false */
788
+ proximityConnectConfirm?: boolean;
789
+ /** Callback to validate or reject a proximity connection.
790
+ * Return false to prevent the edge from being created. */
791
+ onProximityConnect?: (detail: {
792
+ source: string;
793
+ target: string;
794
+ distance: number;
795
+ }) => boolean | void;
796
+ /** CSS class that prevents node dragging when on or inside the event target. Default: 'nodrag' */
797
+ noDragClassName?: string;
798
+ /** CSS class that prevents canvas pan/zoom when on or inside the event target. Default: 'nopan' */
799
+ noPanClassName?: string;
800
+ /** CSS class that prevents wheel zoom when on or inside the event target. Default: undefined (disabled) */
801
+ noWheelClassName?: string;
802
+ /** Which mouse buttons trigger panning. true = left button (default), false = disabled,
803
+ * array of button indices (0=left, 1=middle, 2=right). */
804
+ panOnDrag?: boolean | number[];
805
+ /** Key code that temporarily enables panning when held (e.g. 'Space'). Default: 'Space'.
806
+ * Set to null to disable. Shows grab cursor while held. */
807
+ panActivationKeyCode?: string | null;
808
+ /** Key code that forces zoom-on-wheel when held, overriding panOnScroll. Default: null.
809
+ * Ctrl/Meta always force zoom when panOnScroll is active. */
810
+ zoomActivationKeyCode?: string | null;
811
+ /** Connection mode. 'strict' (default) = source handles only connect to target handles.
812
+ * 'loose' = source handles can connect to any handle type. */
813
+ connectionMode?: 'strict' | 'loose';
814
+ /** Auto-pan viewport when a node receives keyboard focus. Default: false */
815
+ autoPanOnNodeFocus?: boolean;
816
+ /** Map node type strings to template selectors or render functions.
817
+ * String values are CSS selectors for <template> elements.
818
+ * Function values receive (node, el) and should populate el's content. */
819
+ nodeTypes?: Record<string, string | ((node: FlowNode, el: HTMLElement) => void)>;
820
+ /** Per-type child validation rules. Keys are node type strings (e.g. 'group').
821
+ * Merged with node.data.childValidation per-instance overrides (shallow). */
822
+ childValidationRules?: Record<string, ChildValidation>;
823
+ /** Called when an automatic child validation check rejects an operation. */
824
+ onChildValidationFail?: (detail: ChildValidationFailDetail) => void;
825
+ /** Custom shape definitions. Merged with built-in shapes (circle, diamond, hexagon, etc.).
826
+ * Each entry provides a perimeterPoint function and optional clipPath CSS. */
827
+ shapeTypes?: Record<string, ShapeDefinition>;
828
+ /** Map edge type strings to custom path generator functions.
829
+ * Receives the same params as built-in generators, returns { path, labelPosition }. */
830
+ edgeTypes?: Record<string, (params: {
831
+ sourceX: number;
832
+ sourceY: number;
833
+ sourcePosition: string;
834
+ targetX: number;
835
+ targetY: number;
836
+ targetPosition: string;
837
+ }) => {
838
+ path: string;
839
+ labelPosition: {
840
+ x: number;
841
+ y: number;
842
+ };
843
+ }>;
844
+ /** Enable undo/redo history tracking. Default: false */
845
+ history?: boolean;
846
+ /** Max snapshots to retain. Default: 50 */
847
+ historyMaxSize?: number;
848
+ /** Called when a node is clicked */
849
+ onNodeClick?: (detail: FlowEvents['node-click']) => void;
850
+ /** Called when node drag starts */
851
+ onNodeDragStart?: (detail: FlowEvents['node-drag-start']) => void;
852
+ /** Called continuously during node drag */
853
+ onNodeDrag?: (detail: FlowEvents['node-drag']) => void;
854
+ /** Called when node drag ends */
855
+ onNodeDragEnd?: (detail: FlowEvents['node-drag-end']) => void;
856
+ /** Called when node resize starts */
857
+ onNodeResizeStart?: (detail: FlowEvents['node-resize-start']) => void;
858
+ /** Called continuously during node resize */
859
+ onNodeResize?: (detail: FlowEvents['node-resize']) => void;
860
+ /** Called when node resize ends */
861
+ onNodeResizeEnd?: (detail: FlowEvents['node-resize-end']) => void;
862
+ /** Called when an edge is clicked */
863
+ onEdgeClick?: (detail: FlowEvents['edge-click']) => void;
864
+ /** Called when an edge reconnection drag starts */
865
+ onReconnectStart?: (detail: FlowEvents['reconnect-start']) => void;
866
+ /** Called when an edge is successfully reconnected */
867
+ onReconnect?: (detail: FlowEvents['reconnect']) => void;
868
+ /** Called when an edge reconnection drag ends (success or cancel) */
869
+ onReconnectEnd?: (detail: FlowEvents['reconnect-end']) => void;
870
+ /** Called when a connection drag starts */
871
+ onConnectStart?: (detail: FlowEvents['connect-start']) => void;
872
+ /** Called when a connection is successfully created */
873
+ onConnect?: (detail: FlowEvents['connect']) => void;
874
+ /** Called when multiple connections are created in a single multi-connect drag */
875
+ onMultiConnect?: (detail: FlowEvents['multi-connect']) => void;
876
+ /** Called when a connection drag ends (success or cancel) */
877
+ onConnectEnd?: (detail: FlowEvents['connect-end']) => void;
878
+ /** Called when the viewport changes (pan/zoom) */
879
+ onViewportChange?: (detail: FlowEvents['viewport-change']) => void;
880
+ /** Called when a user gesture (pan/zoom) starts */
881
+ onViewportMoveStart?: (detail: FlowEvents['viewport-move-start']) => void;
882
+ /** Called each frame during a user gesture (pan/zoom) */
883
+ onViewportMove?: (detail: FlowEvents['viewport-move']) => void;
884
+ /** Called when a user gesture (pan/zoom) ends */
885
+ onViewportMoveEnd?: (detail: FlowEvents['viewport-move-end']) => void;
886
+ /** Called when the canvas background is clicked */
887
+ onPaneClick?: (detail: FlowEvents['pane-click']) => void;
888
+ /** Called when a node is right-clicked */
889
+ onNodeContextMenu?: (detail: FlowEvents['node-context-menu']) => void;
890
+ /** Called when an edge is right-clicked */
891
+ onEdgeContextMenu?: (detail: FlowEvents['edge-context-menu']) => void;
892
+ /** Called when the pane background is right-clicked */
893
+ onPaneContextMenu?: (detail: FlowEvents['pane-context-menu']) => void;
894
+ /** Called when right-clicking with multiple nodes selected */
895
+ onSelectionContextMenu?: (detail: FlowEvents['selection-context-menu']) => void;
896
+ /** Called when node or edge selection changes */
897
+ onSelectionChange?: (detail: FlowEvents['selection-change']) => void;
898
+ /** Called when nodes are added or removed */
899
+ onNodesChange?: (detail: FlowEvents['nodes-change']) => void;
900
+ /** Called when edges are added or removed */
901
+ onEdgesChange?: (detail: FlowEvents['edges-change']) => void;
902
+ /** Called when nodes are patched */
903
+ onNodesPatch?: (detail: FlowEvents['nodes-patch']) => void;
904
+ /** Called when edges are patched */
905
+ onEdgesPatch?: (detail: FlowEvents['edges-patch']) => void;
906
+ /** Called after the canvas is fully initialized */
907
+ onInit?: () => void;
908
+ /** Called when the canvas is being destroyed */
909
+ onDestroy?: () => void;
910
+ /** Called when a node is collapsed */
911
+ onNodeCollapse?: (detail: FlowEvents['node-collapse']) => void;
912
+ /** Called when a node is expanded */
913
+ onNodeExpand?: (detail: FlowEvents['node-expand']) => void;
914
+ /** Called when a node is condensed */
915
+ onNodeCondense?: (detail: FlowEvents['node-condense']) => void;
916
+ /** Called when a node is uncondensed */
917
+ onNodeUncondense?: (detail: FlowEvents['node-uncondense']) => void;
918
+ /** Called before user-initiated deletion (keyboard Delete/Backspace or cut).
919
+ * Receives the nodes and edges about to be deleted (already filtered by `deletable`).
920
+ * Cascaded edges (connected to deleted nodes) are included.
921
+ * Return the subset to actually delete, or `false` to cancel entirely.
922
+ * Async — supports confirm dialogs, server validation, etc.
923
+ * Does NOT intercept programmatic `removeNodes()`/`removeEdges()` calls. */
924
+ onBeforeDelete?: (detail: {
925
+ nodes: FlowNode[];
926
+ edges: FlowEdge[];
927
+ }) => Promise<{
928
+ nodes: FlowNode[];
929
+ edges: FlowEdge[];
930
+ } | false>;
931
+ /** Prevent dragged nodes from overlapping others. Default: false.
932
+ * Pass a number for custom gap in pixels. */
933
+ preventOverlap?: boolean | number;
934
+ /** Auto-bridge predecessors to successors when deleting middle nodes. Default: false */
935
+ reconnectOnDelete?: boolean;
936
+ /** Reject interactive connections that would create a directed cycle. Default: false */
937
+ preventCycles?: boolean;
938
+ /** Auto-layout on structural changes. Pass config to enable. Default: undefined (disabled) */
939
+ autoLayout?: AutoLayoutConfig;
940
+ /** Color mode for this flow instance. Default: undefined (no color mode management).
941
+ * 'system' tracks OS preference via matchMedia. Adds/removes `.dark` class on the container. */
942
+ colorMode?: 'light' | 'dark' | 'system';
943
+ /** Automatically call fitView() after init. Default: false */
944
+ fitViewOnInit?: boolean;
945
+ /** Show loading overlay until setLoading(false) is called. Default: false */
946
+ loading?: boolean;
947
+ /** Custom text for the default loading indicator. Default: 'Loading…' */
948
+ loadingText?: string;
949
+ /** Enable real-time collaboration. Requires yjs peer dependency. */
950
+ collab?: CollabConfig;
951
+ /** Map of AlpineFlow event names to Livewire method names.
952
+ * When $wire is available, these events auto-call $wire.methodName()
953
+ * with extracted payload arguments. Set by WireFlow Blade component. */
954
+ wireEvents?: Record<string, string>;
955
+ /** Enable drag-and-drop onto canvas. When set, the container accepts drops from
956
+ * `x-flow-draggable` elements (or any source using `application/alpineflow` MIME).
957
+ * Return a FlowNode to add it, or falsy to cancel.
958
+ *
959
+ * @param detail.data - The value set by x-flow-draggable (string or parsed object)
960
+ * @param detail.position - Drop coordinates already converted via screenToFlowPosition
961
+ * @param detail.targetNode - The FlowNode under the cursor at drop time, or null if dropped on empty space */
962
+ onDrop?: (detail: {
963
+ data: any;
964
+ position: XYPosition;
965
+ targetNode: FlowNode | null;
966
+ }) => FlowNode | null | undefined | false;
967
+ /** Called when a connection is dropped on empty canvas space. Return a FlowNode to auto-create
968
+ * it and connect it to the source. Return null to cancel. The auto-created edge uses defaults
969
+ * and respects `isValidConnection`. For custom edges, use `onConnectEnd` instead. */
970
+ onEdgeDrop?: (detail: {
971
+ source: string;
972
+ sourceHandle?: string;
973
+ position: XYPosition;
974
+ }) => FlowNode | null;
975
+ /** Customize the ghost node preview shown during connection drag (requires `onEdgeDrop`).
976
+ * Return a string for label text, an HTMLElement for custom content, or null to hide.
977
+ * When not set, a default "New Node" placeholder is shown. */
978
+ edgeDropPreview?: (detail: {
979
+ source: string;
980
+ sourceHandle?: string;
981
+ }) => string | HTMLElement | null;
982
+ /** Global error/warning handler. When set, internal warnings are routed through
983
+ * this callback instead of (or in addition to) console.warn. */
984
+ onError?: (code: string, message: string) => void;
985
+ /** Minimum pixel distance before a node drag starts. Default: 0 (immediate) */
986
+ nodeDragThreshold?: number;
987
+ /** Zoom in on double-click. Default: true */
988
+ zoomOnDoubleClick?: boolean;
989
+ /** Automatically select nodes when they start being dragged. Default: true */
990
+ selectNodesOnDrag?: boolean;
991
+ }
992
+ /** Per-element timing override (prefixed with _ to avoid collision with data properties). */
993
+ export interface ElementTimingOverrides {
994
+ _duration?: number;
995
+ _easing?: EasingName | ((t: number) => number);
996
+ }
997
+ /** Node animation targets. */
998
+ export type AnimateNodeTarget = {
999
+ position?: Partial<XYPosition>;
1000
+ /** Path function or SVG path string for curved motion. Overrides `position`. */
1001
+ followPath?: PathFunction | string;
1002
+ /** Optional visible guide path overlay for string-based followPath. */
1003
+ guidePath?: {
1004
+ visible?: boolean;
1005
+ class?: string;
1006
+ autoRemove?: boolean;
1007
+ };
1008
+ data?: Record<string, any>;
1009
+ class?: string;
1010
+ style?: string | Record<string, string>;
1011
+ dimensions?: Partial<Dimensions>;
1012
+ selected?: boolean;
1013
+ zIndex?: number;
1014
+ } & ElementTimingOverrides;
1015
+ /** Edge animation targets. */
1016
+ export type AnimateEdgeTarget = {
1017
+ color?: string | {
1018
+ from: string;
1019
+ to: string;
1020
+ };
1021
+ label?: string;
1022
+ strokeWidth?: number;
1023
+ animated?: boolean;
1024
+ class?: string;
1025
+ } & ElementTimingOverrides;
1026
+ /** Viewport animation target. */
1027
+ export type AnimateViewportTarget = {
1028
+ pan?: Partial<XYPosition>;
1029
+ zoom?: number;
1030
+ } & ElementTimingOverrides;
1031
+ /** Targets for update() and animate(). */
1032
+ export interface AnimateTargets {
1033
+ nodes?: Record<string, AnimateNodeTarget>;
1034
+ edges?: Record<string, AnimateEdgeTarget>;
1035
+ viewport?: AnimateViewportTarget;
1036
+ }
1037
+ /** Options for update() and animate(). */
1038
+ export interface AnimateOptions {
1039
+ /** Duration in ms. 0 = instant snap. Default: 300. */
1040
+ duration?: number;
1041
+ /** Easing preset or custom function. Default: 'easeInOut'. */
1042
+ easing?: EasingName | ((t: number) => number);
1043
+ /** Delay before starting in ms. Default: 0. */
1044
+ delay?: number;
1045
+ /** true = loop forever, 'reverse' = ping-pong. Default: false. */
1046
+ loop?: boolean | 'reverse';
1047
+ /** Called each frame with progress 0–1. */
1048
+ onProgress?: (progress: number) => void;
1049
+ /** Called when animation completes. */
1050
+ onComplete?: () => void;
1051
+ }
1052
+ /** Handle returned by animate(). */
1053
+ export interface FlowAnimationHandle {
1054
+ pause(): void;
1055
+ resume(): void;
1056
+ stop(): void;
1057
+ reverse(): void;
1058
+ readonly finished: Promise<void>;
1059
+ /** @internal Node IDs targeted by this animation (used by follow()). */
1060
+ _targetNodeIds?: string[];
1061
+ }
1062
+ /** Options for follow(). */
1063
+ export interface FollowOptions {
1064
+ zoom?: number;
1065
+ padding?: number;
1066
+ easing?: EasingName | ((t: number) => number);
1067
+ }
1068
+ export interface FlowInstance {
1069
+ /** Reactive array of nodes */
1070
+ nodes: FlowNode[];
1071
+ /** Reactive array of edges */
1072
+ edges: FlowEdge[];
1073
+ /** Current viewport state */
1074
+ viewport: Viewport;
1075
+ /** Add one or more nodes */
1076
+ addNodes(nodes: FlowNode | FlowNode[]): void;
1077
+ /** Remove nodes by ID */
1078
+ removeNodes(ids: string | string[]): void;
1079
+ /** Add one or more edges */
1080
+ addEdges(edges: FlowEdge | FlowEdge[]): void;
1081
+ /** Remove edges by ID */
1082
+ removeEdges(ids: string | string[]): void;
1083
+ /** Get a node by ID */
1084
+ getNode(id: string): FlowNode | undefined;
1085
+ /** Get an edge by ID */
1086
+ getEdge(id: string): FlowEdge | undefined;
1087
+ /** Convert screen coordinates to flow coordinates */
1088
+ screenToFlowPosition(x: number, y: number): XYPosition;
1089
+ /** Convert flow coordinates to screen coordinates */
1090
+ flowToScreenPosition(x: number, y: number): XYPosition;
1091
+ /** Fit all nodes into the viewport */
1092
+ fitView(options?: {
1093
+ padding?: number;
1094
+ duration?: number;
1095
+ }): void;
1096
+ /** Zoom/pan the viewport to frame a specific rectangle in flow coordinates. */
1097
+ fitBounds(rect: Rect, options?: {
1098
+ padding?: number;
1099
+ duration?: number;
1100
+ }): void;
1101
+ /** Get the bounding rectangle of specific nodes, or all visible nodes if omitted. */
1102
+ getNodesBounds(nodeIds?: string[]): Rect;
1103
+ /** Compute a viewport that frames the given bounds rectangle. Does not apply it.
1104
+ * Uses config's minZoom/maxZoom and the container dimensions. */
1105
+ getViewportForBounds(bounds: Rect, padding?: number): Viewport;
1106
+ /** Set viewport programmatically */
1107
+ setViewport(viewport: Partial<Viewport>, options?: {
1108
+ duration?: number;
1109
+ }): void;
1110
+ /** Zoom in by a step factor (default 1.2) */
1111
+ zoomIn(options?: {
1112
+ duration?: number;
1113
+ }): void;
1114
+ /** Zoom out by a step factor (default 1.2) */
1115
+ zoomOut(options?: {
1116
+ duration?: number;
1117
+ }): void;
1118
+ /** Center the viewport on a flow coordinate, optionally setting zoom. */
1119
+ setCenter(x: number, y: number, zoom?: number, options?: {
1120
+ duration?: number;
1121
+ }): void;
1122
+ /** Pan the viewport by a delta in flow coordinates. */
1123
+ panBy(dx: number, dy: number, options?: {
1124
+ duration?: number;
1125
+ }): void;
1126
+ /** Toggle interactivity (pannable + zoomable + node dragging) */
1127
+ toggleInteractive(): void;
1128
+ /** Whether interactivity is currently enabled */
1129
+ isInteractive: boolean;
1130
+ /** Get the absolute position of a node (resolves parentId chain) */
1131
+ getAbsolutePosition(nodeId: string): XYPosition;
1132
+ /** Serialize entire flow state to a plain JSON-serializable object. */
1133
+ toObject(): {
1134
+ nodes: FlowNode[];
1135
+ edges: FlowEdge[];
1136
+ viewport: Viewport;
1137
+ };
1138
+ /** Restore flow state from a previously saved object. */
1139
+ fromObject(obj: {
1140
+ nodes?: FlowNode[];
1141
+ edges?: FlowEdge[];
1142
+ viewport?: Partial<Viewport>;
1143
+ }): void;
1144
+ /** Reset the canvas to the initial config state (nodes, edges, viewport). */
1145
+ $reset(): void;
1146
+ /** Clear all nodes and edges, reset viewport to origin. */
1147
+ $clear(): void;
1148
+ /** Undo the last structural change (requires history: true) */
1149
+ undo(): void;
1150
+ /** Redo the last undone change (requires history: true) */
1151
+ redo(): void;
1152
+ /** Whether an undo operation is available */
1153
+ canUndo: boolean;
1154
+ /** Whether a redo operation is available */
1155
+ canRedo: boolean;
1156
+ /** Export the canvas as a PNG image. Returns a data URL. */
1157
+ toImage(options?: ToImageOptions): Promise<string>;
1158
+ /** Animate nodes, edges, and/or viewport with smooth interpolation.
1159
+ * Duration 0 = instant snap (replaces old patch()).
1160
+ *
1161
+ * @example
1162
+ * // Instant update (default duration: 0)
1163
+ * $flow.update({ nodes: { n1: { position: { x: 500, y: 200 } } } })
1164
+ *
1165
+ * // Update with custom transition
1166
+ * $flow.update({ nodes: { n1: { data: { label: 'Updated' } } } }, { duration: 500 })
1167
+ */
1168
+ update(targets: AnimateTargets, options?: AnimateOptions): FlowAnimationHandle;
1169
+ /** Animate nodes, edges, and/or viewport with smooth transitions.
1170
+ * Convenience wrapper around `update()` that defaults to 300ms duration.
1171
+ *
1172
+ * @example
1173
+ * // Smooth transition (default 300ms)
1174
+ * $flow.animate({ nodes: { n1: { position: { x: 500, y: 200 } } } })
1175
+ */
1176
+ animate(targets: AnimateTargets, options?: AnimateOptions): FlowAnimationHandle;
1177
+ /** Track a target with the viewport camera. Returns a handle to stop tracking.
1178
+ * Only affects viewport — all node/edge animations continue independently.
1179
+ */
1180
+ follow(target: string | FlowAnimationHandle | ParticleHandle | XYPosition, options?: FollowOptions): FlowAnimationHandle;
1181
+ /** Fire a particle along an edge path. Returns a handle for tracking, or undefined if the particle couldn't be created. */
1182
+ sendParticle(edgeId: string, options?: ParticleOptions): ParticleHandle | undefined;
1183
+ /** Condense a node — switch to summary view hiding internal rows */
1184
+ condenseNode(id: string): void;
1185
+ /** Uncondense a node — restore full row view */
1186
+ uncondenseNode(id: string): void;
1187
+ /** Toggle condensed state of a node */
1188
+ toggleCondense(id: string): void;
1189
+ /** Check if a node is condensed */
1190
+ isCondensed(id: string): boolean;
1191
+ /** Select a row by ID (nodeId.attrId format) */
1192
+ selectRow(rowId: string): void;
1193
+ /** Deselect a row by ID */
1194
+ deselectRow(rowId: string): void;
1195
+ /** Toggle row selection */
1196
+ toggleRowSelect(rowId: string): void;
1197
+ /** Get all selected row IDs */
1198
+ getSelectedRows(): string[];
1199
+ /** Check if a row is selected */
1200
+ isRowSelected(rowId: string): boolean;
1201
+ /** Deselect all rows */
1202
+ deselectAllRows(): void;
1203
+ /** Set row filter for a node. Accepts a preset or a custom predicate. */
1204
+ setRowFilter(nodeId: string, filter: RowFilter): void;
1205
+ /** Get row filter for a node */
1206
+ getRowFilter(nodeId: string): RowFilter;
1207
+ /** Get visible rows for a node based on its rowFilter and current edges */
1208
+ getVisibleRows(nodeId: string, schema: any[]): any[];
1209
+ /** Apply a filter predicate to all nodes. Nodes failing the predicate get `filtered: true`. */
1210
+ setNodeFilter(predicate: (node: FlowNode) => boolean): void;
1211
+ /** Clear node filter — sets `filtered: false` on all nodes. */
1212
+ clearNodeFilter(): void;
1213
+ /** Update runtime config options (zoom limits, background, colorMode, etc.). */
1214
+ patchConfig(changes: Partial<PatchableConfig>): void;
1215
+ /** Current resolved color mode, or undefined if not managed. */
1216
+ readonly colorMode?: 'light' | 'dark';
1217
+ /** Return all nodes whose bounding rect overlaps the given node.
1218
+ * `partially` (default true) — any overlap counts. If false, only full containment. */
1219
+ getIntersectingNodes(nodeOrId: FlowNode | string, partially?: boolean): FlowNode[];
1220
+ /** Check if two nodes' bounding rects overlap. */
1221
+ isNodeIntersecting(nodeOrId: FlowNode | string, targetOrId: FlowNode | string, partially?: boolean): boolean;
1222
+ /** Get nodes connected via outgoing edges from this node. */
1223
+ getOutgoers(nodeId: string): FlowNode[];
1224
+ /** Get nodes connected via incoming edges to this node. */
1225
+ getIncomers(nodeId: string): FlowNode[];
1226
+ /** Get all edges connected to a node (incoming and outgoing). */
1227
+ getConnectedEdges(nodeId: string): FlowEdge[];
1228
+ /** Check if two nodes are directly connected by an edge. */
1229
+ areNodesConnected(nodeA: string, nodeB: string, directed?: boolean): boolean;
1230
+ /** Register a compute function for a node type. */
1231
+ registerCompute(nodeType: string, definition: {
1232
+ compute: (inputs: Record<string, any>, nodeData: Record<string, any>) => Record<string, any>;
1233
+ }): void;
1234
+ /** Run compute propagation through the graph. If startNodeId is given, only recompute downstream from that node. */
1235
+ compute(startNodeId?: string): Map<string, Record<string, any>>;
1236
+ /** Collaboration instance. Only present when collab config is provided. */
1237
+ readonly collab?: CollabInstance;
1238
+ }