@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,570 @@
1
+ import type { FlowNode, FlowEdge, Viewport, XYPosition, Dimensions, FlowCanvasConfig, PendingReconnection, AnimateTargets, AnimateOptions, FlowAnimationHandle, FollowOptions, ParticleHandle, PatchableConfig, ChildValidation, RowFilter, ShapeDefinition, ToImageOptions } from '../../core/types';
2
+ import type { FlowHistory } from '../../core/history';
3
+ import type { FlowTimeline } from '../../animate/timeline';
4
+ import type { Animator } from '../../animate/animator';
5
+ import type { EngineHandle } from '../../animate/engine';
6
+ import type { PanZoomInstance } from '../../core/pan-zoom';
7
+ import type { MiniMapInstance } from '../../core/minimap';
8
+ import type { ControlsPanelInstance } from '../../core/controls-panel';
9
+ import type { SelectionBoxInstance } from '../../core/selection-box';
10
+ import type { LassoInstance } from '../../core/lasso';
11
+ import type { ColorModeHandle } from '../../core/color-mode';
12
+ import type { FlowAnnouncer } from '../../core/announcer';
13
+ import type { ComputeEngine } from '../../core/compute';
14
+ import type { CollapseState } from '../../core/collapse';
15
+ import type { KeyboardShortcuts } from '../../core/keyboard-shortcuts';
16
+ export interface ActiveParticle {
17
+ circle: SVGCircleElement;
18
+ pathEl: SVGPathElement;
19
+ t0: number;
20
+ ms: number;
21
+ safetyTimer: ReturnType<typeof setTimeout>;
22
+ onComplete?: () => void;
23
+ }
24
+ export interface ContextMenuState {
25
+ show: boolean;
26
+ type: string | null;
27
+ x: number;
28
+ y: number;
29
+ node: FlowNode | null;
30
+ edge: FlowEdge | null;
31
+ position: XYPosition | null;
32
+ nodes: FlowNode[] | null;
33
+ }
34
+ export interface CanvasContext {
35
+ /** Unique instance ID for SVG marker dedup, etc. */
36
+ _id: string;
37
+ /** Reactive array of nodes */
38
+ nodes: FlowNode[];
39
+ /** Reactive array of edges */
40
+ edges: FlowEdge[];
41
+ /** Current viewport state (pan offset + zoom level) */
42
+ viewport: Viewport;
43
+ /** Whether the canvas has completed initialization and first node measurement */
44
+ ready: boolean;
45
+ /** User-controlled loading flag */
46
+ _userLoading: boolean;
47
+ /** Custom text for the default loading indicator */
48
+ _loadingText: string;
49
+ /** Auto-injected loading overlay element */
50
+ _autoLoadingOverlay: HTMLElement | null;
51
+ /** True when the canvas is still initializing OR the user has set loading */
52
+ readonly isLoading: boolean;
53
+ /** Whether interactivity (pan/zoom/drag) is enabled */
54
+ isInteractive: boolean;
55
+ /** Currently active connection drag, or null */
56
+ pendingConnection: {
57
+ source: string;
58
+ sourceHandle?: string;
59
+ position: XYPosition;
60
+ } | null;
61
+ /** Currently active edge reconnection drag, or null */
62
+ _pendingReconnection: PendingReconnection | null;
63
+ /** Set of selected node IDs */
64
+ selectedNodes: Set<string>;
65
+ /** Set of selected edge IDs */
66
+ selectedEdges: Set<string>;
67
+ /** Set of selected row IDs (format: nodeId.attrId) */
68
+ selectedRows: Set<string>;
69
+ /** Context menu state */
70
+ contextMenu: ContextMenuState;
71
+ /** Node lookup map (id -> node) */
72
+ _nodeMap: Map<string, FlowNode>;
73
+ /** Stores each node's originally configured dimensions (before layout stretch) */
74
+ _initialDimensions: Map<string, Dimensions>;
75
+ /** Edge lookup map (id -> edge) */
76
+ _edgeMap: Map<string, FlowEdge>;
77
+ /** Cached child validation errors per parent node ID */
78
+ _validationErrorCache: Map<string, string[]>;
79
+ /** Saved pre-collapse state per group node ID */
80
+ _collapseState: Map<string, CollapseState>;
81
+ /** Stored config (stripped of collab to avoid circular refs) */
82
+ _config: FlowCanvasConfig;
83
+ /** Resolved keyboard shortcuts */
84
+ _shortcuts: Required<KeyboardShortcuts>;
85
+ /** Shape registry (built-in + custom shapes) */
86
+ _shapeRegistry: Record<string, ShapeDefinition>;
87
+ /** Root container element */
88
+ _container: HTMLElement | null;
89
+ /** Viewport wrapper element (.flow-viewport) */
90
+ _viewportEl: HTMLElement | null;
91
+ /** SVG element holding marker <defs> */
92
+ _markerDefsEl: SVGSVGElement | null;
93
+ /** Cached CSSStyleDeclaration for the container */
94
+ _containerStyles: CSSStyleDeclaration | null;
95
+ /** Map of node DOM elements (id -> element) */
96
+ _nodeElements: Map<string, HTMLElement>;
97
+ /** Map of edge SVG elements (id -> svg) */
98
+ _edgeSvgElements: Map<string, SVGSVGElement>;
99
+ /** Pan/zoom controller */
100
+ _panZoom: PanZoomInstance | null;
101
+ /** Undo/redo history stack */
102
+ _history: FlowHistory | null;
103
+ /** Screen reader announcer */
104
+ _announcer: FlowAnnouncer | null;
105
+ /** Node-to-node compute engine */
106
+ _computeEngine: ComputeEngine;
107
+ /** Debounce timer for auto-compute */
108
+ _computeDebounceTimer: ReturnType<typeof setTimeout> | null;
109
+ /** Animator for smooth property interpolation */
110
+ _animator: Animator | null;
111
+ /** Minimap instance */
112
+ _minimap: MiniMapInstance | null;
113
+ /** Controls panel instance */
114
+ _controls: ControlsPanelInstance | null;
115
+ /** Selection box instance */
116
+ _selectionBox: SelectionBoxInstance | null;
117
+ /** Lasso selection instance */
118
+ _lasso: LassoInstance | null;
119
+ /** Color mode controller */
120
+ _colorModeHandle: ColorModeHandle | null;
121
+ /** Whether the canvas is locked during a timeline animation */
122
+ _animationLocked: boolean;
123
+ /** Set of active FlowTimeline instances */
124
+ _activeTimelines: Set<FlowTimeline>;
125
+ /** Registry of named animations (x-flow-animate) */
126
+ _animationRegistry: Map<string, Record<string, unknown>[]>;
127
+ /** Engine handle for the active follow() viewport tracking */
128
+ _followHandle: EngineHandle | null;
129
+ /** Set of active particle entries for the shared animation loop */
130
+ _activeParticles: Set<ActiveParticle>;
131
+ /** Engine handle for the particle tick loop */
132
+ _particleEngineHandle: EngineHandle | null;
133
+ /** Current selection tool type */
134
+ _selectionTool: 'box' | 'lasso';
135
+ /** Pointer-down handler for selection drag */
136
+ _onSelectionPointerDown: ((e: PointerEvent) => void) | null;
137
+ /** Pointer-move handler for selection drag */
138
+ _onSelectionPointerMove: ((e: PointerEvent) => void) | null;
139
+ /** Pointer-up handler for selection drag */
140
+ _onSelectionPointerUp: ((e: PointerEvent) => void) | null;
141
+ /** Whether shift was held at selection box start */
142
+ _selectionShiftHeld: boolean;
143
+ /** Effective selection containment mode (partial or full) */
144
+ _selectionEffectiveMode: 'partial' | 'full';
145
+ /** Suppress the next canvas click after a selection box drag */
146
+ _suppressNextCanvasClick: boolean;
147
+ /** Cleanup function for long-press listener */
148
+ _longPressCleanup: (() => void) | null;
149
+ /** Whether touch selection mode is currently active */
150
+ _touchSelectionMode: boolean;
151
+ /** Cleanup function for touch selection mode listeners */
152
+ _touchSelectionCleanup: (() => void) | null;
153
+ /** Keydown handler reference */
154
+ _onKeyDown: ((e: KeyboardEvent) => void) | null;
155
+ /** Container pointerdown handler reference */
156
+ _onContainerPointerDown: ((e: PointerEvent) => void) | null;
157
+ /** Canvas click handler reference */
158
+ _onCanvasClick: ((e: MouseEvent) => void) | null;
159
+ /** Canvas context menu handler reference */
160
+ _onCanvasContextMenu: ((e: MouseEvent) => void) | null;
161
+ /** Context menu backdrop element */
162
+ _contextMenuBackdrop: HTMLElement | null;
163
+ /** Registered context menu event listeners */
164
+ _contextMenuListeners: Array<{
165
+ event: string;
166
+ handler: EventListener;
167
+ }>;
168
+ /** Dragover handler for drop zone */
169
+ _onDropZoneDragOver: ((e: DragEvent) => void) | null;
170
+ /** Drop handler for drop zone */
171
+ _onDropZoneDrop: ((e: DragEvent) => void) | null;
172
+ /** Whether this canvas instance is the currently active/focused one */
173
+ _active: boolean;
174
+ /** Current semantic zoom level */
175
+ _zoomLevel: 'far' | 'medium' | 'close';
176
+ /** Set of node IDs currently visible in the viewport */
177
+ _visibleNodeIds: Set<string>;
178
+ /** Background config (variant or layer array) */
179
+ _background: FlowCanvasConfig['background'];
180
+ /** Background gap override */
181
+ _backgroundGap: number | null;
182
+ /** Pattern color override */
183
+ _patternColorOverride: string | null;
184
+ /** Compute background style for the container */
185
+ backgroundStyle(): {
186
+ backgroundImage: string;
187
+ backgroundSize: string;
188
+ backgroundPosition: string;
189
+ };
190
+ /** Whether this canvas was hydrated from a pre-rendered static diagram */
191
+ _hydratedFromStatic: boolean;
192
+ /** Reactive tick bumped each frame during layout animation so edges re-measure DOM */
193
+ _layoutAnimTick: number;
194
+ /** rAF handle for layout animation tick */
195
+ _layoutAnimFrame: number;
196
+ /** Debounce timer for auto-layout */
197
+ _autoLayoutTimer: ReturnType<typeof setTimeout> | null;
198
+ /** Whether auto-layout has completed dependency loading */
199
+ _autoLayoutReady: boolean;
200
+ /** Whether auto-layout has permanently failed (dependency missing) */
201
+ _autoLayoutFailed: boolean;
202
+ /** Emit an event: debug log, config callback, DOM CustomEvent, announcer */
203
+ _emit(event: string, detail?: any): void;
204
+ /** Route a warning through onError callback and console.warn */
205
+ _warn(code: string, message: string): void;
206
+ /** Emit a selection-change event with current selected node/edge/row IDs */
207
+ _emitSelectionChange(): void;
208
+ /** Rebuild node lookup map from current nodes array */
209
+ _rebuildNodeMap(): void;
210
+ /** Rebuild edge lookup map from current edges array */
211
+ _rebuildEdgeMap(): void;
212
+ /** Capture a history snapshot before a mutation */
213
+ _captureHistory(): void;
214
+ /** Suspend history capture (e.g. during animation) */
215
+ _suspendHistory(): void;
216
+ /** Resume history capture after suspension */
217
+ _resumeHistory(): void;
218
+ /** Resolve child validation rules for a parent node */
219
+ _getChildValidation(parentId: string): ChildValidation | undefined;
220
+ /** Recompute child validation errors for all parent nodes */
221
+ _recomputeChildValidation(): void;
222
+ /** Sync animation lock state from active timelines */
223
+ _syncAnimationState(): void;
224
+ /** Apply background CSS to the container element */
225
+ _applyBackground(): void;
226
+ /** Toggle CSS display on off-screen nodes/edges (viewport culling) */
227
+ _applyCulling(): void;
228
+ /** Get set of currently visible node IDs */
229
+ _getVisibleNodeIds(): Set<string>;
230
+ /** Apply zoom level attribute to container */
231
+ _applyZoomLevel(zoom: number): void;
232
+ /** Get absolute position of a node (resolves parentId chain) */
233
+ getAbsolutePosition(nodeId: string): XYPosition;
234
+ /** Set up SVG <defs> for edge markers */
235
+ _setupMarkerDefs(): void;
236
+ /** Update SVG marker definitions based on current edges */
237
+ _updateMarkerDefs(): void;
238
+ /** Write node positions directly to DOM elements (bypassing Alpine effects) */
239
+ _flushNodePositions(nodeIds: Set<string>): void;
240
+ /** Write node styles directly to DOM elements (bypassing Alpine effects) */
241
+ _flushNodeStyles(nodeIds: Set<string>): void;
242
+ /** Write edge color/strokeWidth directly to SVG elements (bypassing Alpine effects) */
243
+ _flushEdgeStyles(edgeIds: Set<string>): void;
244
+ /** Push current viewport state to the DOM (transform, background, culling) */
245
+ _flushViewport(): void;
246
+ /** Recompute SVG paths, label positions, and gradients for affected edges */
247
+ _refreshEdgePaths(movedNodeIds: Set<string>): void;
248
+ /** Hydrate from a pre-rendered static diagram */
249
+ _hydrateFromStatic(): void;
250
+ /** Debounced trigger for automatic layout */
251
+ _scheduleAutoLayout(): void;
252
+ /** Execute the configured auto-layout algorithm */
253
+ _runAutoLayout(): Promise<void>;
254
+ /** Get effective background gap (from config, CSS variable, or default) */
255
+ _getBackgroundGap(): number;
256
+ /** Resolve background config to array of layer definitions */
257
+ _resolveBackgroundLayers(): Array<{
258
+ variant: 'dots' | 'lines' | 'cross';
259
+ gap: number;
260
+ color: string;
261
+ }>;
262
+ /** Apply computed layout positions to nodes with optional animation */
263
+ _applyLayout(positions: Map<string, {
264
+ x: number;
265
+ y: number;
266
+ }>, options?: {
267
+ adjustHandles?: boolean;
268
+ handleDirection?: string;
269
+ fitView?: boolean;
270
+ duration?: number;
271
+ }): void;
272
+ /** Update handle positions to match layout direction */
273
+ _adjustHandlePositions(direction: string): void;
274
+ /** Delete currently selected nodes/edges (keyboard-initiated) */
275
+ _deleteSelected(): Promise<void>;
276
+ /** Engine tick callback for processing active particles */
277
+ _tickParticles(): boolean;
278
+ /** Internal implementation for config patching */
279
+ _applyConfigPatch(changes: Record<string, any>): void;
280
+ /** Get a node by ID */
281
+ getNode(id: string): FlowNode | undefined;
282
+ /** Get an edge by ID */
283
+ getEdge(id: string): FlowEdge | undefined;
284
+ /** Get the visible <path> element for an edge */
285
+ getEdgePathElement(id: string): SVGPathElement | null;
286
+ /** Get the container element for an edge (SVG group or parent) */
287
+ getEdgeElement(id: string): SVGElement | HTMLElement | null;
288
+ /** Add one or more nodes */
289
+ addNodes(newNodes: FlowNode | FlowNode[], options?: {
290
+ center?: boolean;
291
+ }): void;
292
+ /** Remove nodes by ID */
293
+ removeNodes(ids: string | string[]): void;
294
+ /** Add one or more edges */
295
+ addEdges(newEdges: FlowEdge | FlowEdge[]): void;
296
+ /** Remove edges by ID */
297
+ removeEdges(ids: string | string[]): void;
298
+ /** Get outgoing connected nodes */
299
+ getOutgoers(nodeId: string): FlowNode[];
300
+ /** Get incoming connected nodes */
301
+ getIncomers(nodeId: string): FlowNode[];
302
+ /** Get all edges connected to a node */
303
+ getConnectedEdges(nodeId: string): FlowEdge[];
304
+ /** Check if two nodes are connected */
305
+ areNodesConnected(nodeA: string, nodeB: string, directed?: boolean): boolean;
306
+ /** Register a compute function for a node type */
307
+ registerCompute(nodeType: string, definition: {
308
+ compute: (inputs: Record<string, any>, nodeData: Record<string, any>) => Record<string, any>;
309
+ }): void;
310
+ /** Run compute propagation through the graph */
311
+ compute(startNodeId?: string): Map<string, Record<string, any>>;
312
+ /** Validate a single parent node */
313
+ validateParent(nodeId: string): {
314
+ valid: boolean;
315
+ errors: string[];
316
+ };
317
+ /** Validate all parent nodes */
318
+ validateAll(): Map<string, {
319
+ valid: boolean;
320
+ errors: string[];
321
+ }>;
322
+ /** Get cached validation errors for a node */
323
+ getValidationErrors(nodeId: string): string[];
324
+ /** Reparent a node into a new parent (or detach) */
325
+ reparentNode(nodeId: string, newParentId: string | null): boolean;
326
+ /** Run child layout for a parent node */
327
+ layoutChildren(parentId: string, optsOrExcludeId?: string | {
328
+ excludeId?: string;
329
+ omitFromComputation?: string;
330
+ includeNode?: FlowNode;
331
+ shallow?: boolean;
332
+ stretchedSize?: Dimensions;
333
+ }, shallow?: boolean, stretchedSize?: Dimensions): void;
334
+ /** Walk up ancestor layout parents, calling layoutChildren(shallow) at each level */
335
+ propagateLayoutUp(startParentId: string, opts?: {
336
+ excludeId?: string;
337
+ omitFromComputation?: string;
338
+ includeNode?: FlowNode;
339
+ }): void;
340
+ /** Reorder a child within its layout parent */
341
+ reorderChild(nodeId: string, newOrder: number): void;
342
+ /** Set a node's rotation angle in degrees */
343
+ rotateNode(id: string, angle: number): void;
344
+ /** Collapse a node */
345
+ collapseNode(id: string, options?: {
346
+ animate?: boolean;
347
+ recursive?: boolean;
348
+ }): void;
349
+ /** Expand a collapsed node */
350
+ expandNode(id: string, options?: {
351
+ animate?: boolean;
352
+ }): void;
353
+ /** Toggle collapse state */
354
+ toggleNode(id: string, options?: {
355
+ animate?: boolean;
356
+ recursive?: boolean;
357
+ }): void;
358
+ /** Check if a node is collapsed */
359
+ isCollapsed(id: string): boolean;
360
+ /** Get count of collapse targets */
361
+ getCollapseTargetCount(id: string): number;
362
+ /** Get descendant count for a node */
363
+ getDescendantCount(id: string): number;
364
+ /** Condense a node (summary view) */
365
+ condenseNode(id: string): void;
366
+ /** Uncondense a node (full row view) */
367
+ uncondenseNode(id: string): void;
368
+ /** Toggle condensed state */
369
+ toggleCondense(id: string): void;
370
+ /** Check if a node is condensed */
371
+ isCondensed(id: string): boolean;
372
+ /** Select a row by ID */
373
+ selectRow(rowId: string): void;
374
+ /** Deselect a row by ID */
375
+ deselectRow(rowId: string): void;
376
+ /** Toggle row selection */
377
+ toggleRowSelect(rowId: string): void;
378
+ /** Get all selected row IDs */
379
+ getSelectedRows(): string[];
380
+ /** Check if a row is selected */
381
+ isRowSelected(rowId: string): boolean;
382
+ /** Deselect all rows */
383
+ deselectAllRows(): void;
384
+ /** Set row filter for a node */
385
+ setRowFilter(nodeId: string, filter: RowFilter): void;
386
+ /** Get row filter for a node */
387
+ getRowFilter(nodeId: string): RowFilter;
388
+ /** Get visible rows based on filter and edges */
389
+ getVisibleRows(nodeId: string, schema: any[]): any[];
390
+ /** Apply a node-level filter predicate */
391
+ setNodeFilter(predicate: (node: FlowNode) => boolean): void;
392
+ /** Clear node filter */
393
+ clearNodeFilter(): void;
394
+ /** Deselect all nodes, edges, and rows */
395
+ deselectAll(): void;
396
+ /** Convert screen coordinates to flow coordinates */
397
+ screenToFlowPosition(x: number, y: number): XYPosition;
398
+ /** Convert flow coordinates to screen coordinates */
399
+ flowToScreenPosition(x: number, y: number): XYPosition;
400
+ /** Fit all nodes into the viewport */
401
+ fitView(options?: {
402
+ padding?: number;
403
+ duration?: number;
404
+ }, _retries?: number): void;
405
+ /** Fit a specific rectangle into the viewport */
406
+ fitBounds(rect: {
407
+ x: number;
408
+ y: number;
409
+ width: number;
410
+ height: number;
411
+ }, options?: {
412
+ padding?: number;
413
+ duration?: number;
414
+ }): void;
415
+ /** Get bounding rectangle of nodes */
416
+ getNodesBounds(nodeIds?: string[]): {
417
+ x: number;
418
+ y: number;
419
+ width: number;
420
+ height: number;
421
+ };
422
+ /** Compute viewport that frames given bounds */
423
+ getViewportForBounds(bounds: {
424
+ x: number;
425
+ y: number;
426
+ width: number;
427
+ height: number;
428
+ }, padding?: number): Viewport;
429
+ /** Get container dimensions */
430
+ getContainerDimensions(): {
431
+ width: number;
432
+ height: number;
433
+ };
434
+ /** Current resolved color mode */
435
+ readonly colorMode: 'light' | 'dark' | undefined;
436
+ /** Get nodes whose bounding rect overlaps the given node */
437
+ getIntersectingNodes(nodeOrId: FlowNode | string, partially?: boolean): FlowNode[];
438
+ /** Check if two nodes' bounding rects overlap */
439
+ isNodeIntersecting(nodeOrId: FlowNode | string, targetOrId: FlowNode | string, partially?: boolean): boolean;
440
+ /** Set viewport programmatically */
441
+ setViewport(viewport: Partial<Viewport>, options?: {
442
+ duration?: number;
443
+ }): void;
444
+ /** Zoom in by a step factor */
445
+ zoomIn(options?: {
446
+ duration?: number;
447
+ }): void;
448
+ /** Zoom out by a step factor */
449
+ zoomOut(options?: {
450
+ duration?: number;
451
+ }): void;
452
+ /** Center the viewport on a coordinate */
453
+ setCenter(x: number, y: number, zoom?: number, options?: {
454
+ duration?: number;
455
+ }): void;
456
+ /** Pan by a delta */
457
+ panBy(dx: number, dy: number, options?: {
458
+ duration?: number;
459
+ }): void;
460
+ /** Toggle interactivity */
461
+ toggleInteractive(): void;
462
+ /** Close the context menu */
463
+ closeContextMenu(): void;
464
+ /** Reset panels */
465
+ resetPanels(): void;
466
+ /** Copy selection to clipboard */
467
+ copy(): void;
468
+ /** Paste from clipboard */
469
+ paste(): void;
470
+ /** Cut selection */
471
+ cut(): Promise<void>;
472
+ /** Undo the last structural change */
473
+ undo(): void;
474
+ /** Redo the last undone change */
475
+ redo(): void;
476
+ /** Whether an undo operation is available */
477
+ readonly canUndo: boolean;
478
+ /** Whether a redo operation is available */
479
+ readonly canRedo: boolean;
480
+ /** Collaboration instance */
481
+ readonly collab: any;
482
+ /** Set the user-controlled loading state */
483
+ setLoading(value: boolean): void;
484
+ /** Update runtime config options */
485
+ patchConfig(changes: Partial<PatchableConfig>): void;
486
+ /** Update nodes, edges, and/or viewport. Duration 0 = instant (default). */
487
+ update(targets: AnimateTargets, options?: AnimateOptions): FlowAnimationHandle;
488
+ /** Animate nodes, edges, and/or viewport. Defaults to 300ms smooth transition. */
489
+ animate(targets: AnimateTargets, options?: AnimateOptions): FlowAnimationHandle;
490
+ /** Create a new timeline wired to this canvas */
491
+ timeline(): FlowTimeline;
492
+ /** Register a named animation */
493
+ registerAnimation(name: string, steps: any[]): void;
494
+ /** Unregister a named animation */
495
+ unregisterAnimation(name: string): void;
496
+ /** Play a named animation */
497
+ playAnimation(name: string): Promise<void>;
498
+ /** Track a target with the viewport camera */
499
+ follow(target: string | FlowAnimationHandle | ParticleHandle | XYPosition, options?: FollowOptions): FlowAnimationHandle;
500
+ /** Fire a particle along an edge path */
501
+ sendParticle(edgeId: string, options?: Record<string, any>): ParticleHandle | undefined;
502
+ /** Dagre layout */
503
+ layout(options?: {
504
+ direction?: 'TB' | 'LR' | 'BT' | 'RL';
505
+ nodesep?: number;
506
+ ranksep?: number;
507
+ adjustHandles?: boolean;
508
+ fitView?: boolean;
509
+ duration?: number;
510
+ }): Promise<void>;
511
+ /** Force-directed layout */
512
+ forceLayout(options?: {
513
+ strength?: number;
514
+ distance?: number;
515
+ charge?: number;
516
+ iterations?: number;
517
+ center?: {
518
+ x: number;
519
+ y: number;
520
+ };
521
+ fitView?: boolean;
522
+ duration?: number;
523
+ }): Promise<void>;
524
+ /** Hierarchy/tree layout */
525
+ treeLayout(options?: {
526
+ layoutType?: string;
527
+ direction?: string;
528
+ nodeWidth?: number;
529
+ nodeHeight?: number;
530
+ adjustHandles?: boolean;
531
+ fitView?: boolean;
532
+ duration?: number;
533
+ }): Promise<void>;
534
+ /** ELK layout */
535
+ elkLayout(options?: {
536
+ algorithm?: string;
537
+ direction?: string;
538
+ nodeSpacing?: number;
539
+ layerSpacing?: number;
540
+ adjustHandles?: boolean;
541
+ fitView?: boolean;
542
+ duration?: number;
543
+ }): Promise<void>;
544
+ /** Serialize flow state */
545
+ toObject(): {
546
+ nodes: FlowNode[];
547
+ edges: FlowEdge[];
548
+ viewport: Viewport;
549
+ };
550
+ /** Restore flow state from a saved object */
551
+ fromObject(obj: {
552
+ nodes?: FlowNode[];
553
+ edges?: FlowEdge[];
554
+ viewport?: Partial<Viewport>;
555
+ }): void;
556
+ /** Reset to initial config state */
557
+ $reset(): void;
558
+ /** Clear all nodes and edges */
559
+ $clear(): void;
560
+ /** Export as image */
561
+ toImage(options?: ToImageOptions): Promise<string>;
562
+ /** Alpine reactive $el — captured as _container during init */
563
+ $el: HTMLElement;
564
+ /** Alpine $nextTick */
565
+ $nextTick(callback: () => void): void;
566
+ /** Alpine $watch */
567
+ $watch(property: string, callback: (value: any) => void): void;
568
+ /** Alpine $store */
569
+ $store: Record<string, any>;
570
+ }
@@ -0,0 +1,13 @@
1
+ import type { CanvasContext } from './canvas-context';
2
+ export declare function createDomMixin(ctx: CanvasContext, Alpine: any): {
3
+ /** Write node positions directly to DOM elements (bypassing Alpine effects). */
4
+ _flushNodePositions(nodeIds: Set<string>): void;
5
+ /** Write node styles directly to DOM elements (bypassing Alpine effects). */
6
+ _flushNodeStyles(nodeIds: Set<string>): void;
7
+ /** Write edge color/strokeWidth directly to SVG elements (bypassing Alpine effects). */
8
+ _flushEdgeStyles(edgeIds: Set<string>): void;
9
+ /** Push current viewport state to the DOM (transform, background, culling). */
10
+ _flushViewport(): void;
11
+ /** Recompute SVG paths, label positions, and gradients for edges connected to the given node IDs. */
12
+ _refreshEdgePaths(movedNodeIds: Set<string>): void;
13
+ };
@@ -0,0 +1,37 @@
1
+ import type { CanvasContext } from './canvas-context';
2
+ import type { FlowEdge } from '../../core/types';
3
+ export declare function createEdgesMixin(ctx: CanvasContext): {
4
+ /**
5
+ * Add one or more edges to the canvas.
6
+ *
7
+ * - Normalizes single edge or array input.
8
+ * - Merges `defaultEdgeOptions` from config (edge-specific props override defaults).
9
+ * - Captures history before mutation.
10
+ * - Pushes collab updates when a collaboration bridge is active.
11
+ * - Schedules auto-layout after the mutation.
12
+ */
13
+ addEdges(newEdges: FlowEdge | FlowEdge[]): void;
14
+ /**
15
+ * Remove one or more edges by ID.
16
+ *
17
+ * - Normalizes single ID or array input.
18
+ * - Filters edges, rebuilds edge map, deselects removed edges.
19
+ * - Captures history before mutation.
20
+ * - Pushes collab updates when a collaboration bridge is active.
21
+ * - Schedules auto-layout after the mutation.
22
+ */
23
+ removeEdges(ids: string | string[]): void;
24
+ /**
25
+ * Look up an edge by ID.
26
+ */
27
+ getEdge(id: string): FlowEdge | undefined;
28
+ /**
29
+ * Get the visible SVG `<path>` element for an edge.
30
+ * The visible path is the second `<path>` child (the first is the interaction hit area).
31
+ */
32
+ getEdgePathElement(id: string): SVGPathElement | null;
33
+ /**
34
+ * Get the container element (SVG group) for an edge.
35
+ */
36
+ getEdgeElement(id: string): SVGElement | HTMLElement | null;
37
+ };
@@ -0,0 +1,53 @@
1
+ import type { CanvasContext } from './canvas-context';
2
+ import type { FlowNode, FlowEdge, Viewport } from '../../core/types';
3
+ export declare function createHistoryMixin(ctx: CanvasContext): {
4
+ /**
5
+ * Serialize the current canvas state (nodes, edges, viewport) as a
6
+ * deep-cloned plain object. Emits a `save` event with the snapshot.
7
+ */
8
+ toObject(): {
9
+ nodes: FlowNode[];
10
+ edges: FlowEdge[];
11
+ viewport: Viewport;
12
+ };
13
+ /**
14
+ * Restore canvas state from a saved object.
15
+ *
16
+ * - Deep-clones incoming nodes/edges to avoid shared references.
17
+ * - Sorts nodes topologically for correct parent-before-child ordering.
18
+ * - Rebuilds node and edge lookup maps.
19
+ * - Applies viewport if provided.
20
+ * - Deselects all, emits `restore`, and schedules auto-layout.
21
+ */
22
+ fromObject(obj: {
23
+ nodes?: FlowNode[];
24
+ edges?: FlowEdge[];
25
+ viewport?: Partial<Viewport>;
26
+ }): void;
27
+ /**
28
+ * Reset the canvas to its initial configuration state.
29
+ */
30
+ $reset(): void;
31
+ /**
32
+ * Clear all nodes and edges, resetting the viewport to origin.
33
+ */
34
+ $clear(): void;
35
+ /**
36
+ * Undo the last structural change by popping a snapshot from the
37
+ * history past stack. Rebuilds maps and deselects all after applying.
38
+ */
39
+ undo(): void;
40
+ /**
41
+ * Redo the last undone change by popping a snapshot from the
42
+ * history future stack. Rebuilds maps and deselects all after applying.
43
+ */
44
+ redo(): void;
45
+ /**
46
+ * Whether an undo operation is available.
47
+ */
48
+ readonly canUndo: boolean;
49
+ /**
50
+ * Whether a redo operation is available.
51
+ */
52
+ readonly canRedo: boolean;
53
+ };