@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,151 @@
1
+ import type { CanvasContext } from './canvas-context';
2
+ import type { FlowNode, Dimensions } from '../../core/types';
3
+ import type { ElkAlgorithm, ElkDirection } from '../../core/layout/elk';
4
+ import type { HierarchyLayoutType, HierarchyDirection } from '../../core/layout/hierarchy';
5
+ export declare function createLayoutMixin(ctx: CanvasContext): {
6
+ /**
7
+ * Debounced trigger for automatic layout.
8
+ *
9
+ * Skips when no autoLayout config is set, dependencies haven't loaded,
10
+ * or the auto-layout has permanently failed.
11
+ */
12
+ _scheduleAutoLayout(): void;
13
+ /**
14
+ * Execute the configured auto-layout algorithm.
15
+ *
16
+ * Delegates to the appropriate layout engine method based on
17
+ * `config.autoLayout.algorithm`. Catches errors and sets
18
+ * `_autoLayoutFailed` to prevent repeated attempts.
19
+ */
20
+ _runAutoLayout(): Promise<void>;
21
+ /**
22
+ * Apply computed layout positions to nodes with optional animation.
23
+ *
24
+ * When duration > 0, delegates to ctx.animate() for smooth transitions.
25
+ * When duration === 0, applies positions directly (instant).
26
+ * Calls `_adjustHandlePositions` when requested, and triggers fitView.
27
+ */
28
+ _applyLayout(positions: Map<string, {
29
+ x: number;
30
+ y: number;
31
+ }>, options?: {
32
+ adjustHandles?: boolean;
33
+ handleDirection?: string;
34
+ fitView?: boolean;
35
+ duration?: number;
36
+ }): void;
37
+ /**
38
+ * Update handle positions on nodes and DOM elements to match a layout
39
+ * direction (TB, LR, BT, RL, DOWN, RIGHT, UP, LEFT).
40
+ *
41
+ * Skips handles that have an explicit position set via
42
+ * `data-flow-handle-explicit`.
43
+ */
44
+ _adjustHandlePositions(direction: string): void;
45
+ /**
46
+ * Compute and apply child layout for a parent node.
47
+ *
48
+ * Recursively lays out nested layout parents bottom-up (unless `shallow`
49
+ * is true). Applies computed positions, dimension overrides with
50
+ * min/max constraint clamping, and auto-sizes the parent.
51
+ */
52
+ /**
53
+ * Compute and apply child layout for a parent node.
54
+ *
55
+ * Supports both the legacy positional signature and a new options object:
56
+ *
57
+ * layoutChildren(parentId) // full layout
58
+ * layoutChildren(parentId, excludeId, shallow) // legacy (backward compat)
59
+ * layoutChildren(parentId, { ... }) // options object
60
+ *
61
+ * Options:
62
+ * - excludeId: skip applying position/dimensions but still count in computation
63
+ * - omitFromComputation: fully remove node from child list (old parent shrinks)
64
+ * - includeNode: add a virtual child to computation (new parent grows)
65
+ * - shallow: don't recurse into nested layout children
66
+ * - stretchedSize: externally-provided size for stretch propagation
67
+ */
68
+ layoutChildren(parentId: string, optsOrExcludeId?: string | {
69
+ excludeId?: string;
70
+ omitFromComputation?: string;
71
+ includeNode?: FlowNode;
72
+ shallow?: boolean;
73
+ stretchedSize?: Dimensions;
74
+ }, shallowArg?: boolean, stretchedSizeArg?: Dimensions): void;
75
+ /**
76
+ * Walk up from a parent through ancestor layout parents, calling
77
+ * layoutChildren(shallow) at each level so parent resizes propagate
78
+ * through the hierarchy (e.g. Column grows -> Row adjusts -> Step adjusts).
79
+ */
80
+ propagateLayoutUp(startParentId: string, opts?: {
81
+ excludeId?: string;
82
+ omitFromComputation?: string;
83
+ includeNode?: FlowNode;
84
+ }): void;
85
+ /**
86
+ * Reorder a child within its layout parent.
87
+ *
88
+ * Reassigns order values for all siblings, then runs layoutChildren
89
+ * and emits a `child-reorder` event.
90
+ */
91
+ reorderChild(nodeId: string, newOrder: number): void;
92
+ /**
93
+ * Apply Dagre (directed acyclic graph) layout.
94
+ *
95
+ * Requires the dagre addon to be registered via `Alpine.plugin(AlpineFlowDagre)`.
96
+ */
97
+ layout(options?: {
98
+ direction?: "TB" | "LR" | "BT" | "RL";
99
+ nodesep?: number;
100
+ ranksep?: number;
101
+ adjustHandles?: boolean;
102
+ fitView?: boolean;
103
+ duration?: number;
104
+ }): void;
105
+ /**
106
+ * Apply force-directed layout.
107
+ *
108
+ * Requires the force addon to be registered via `Alpine.plugin(AlpineFlowForce)`.
109
+ */
110
+ forceLayout(options?: {
111
+ strength?: number;
112
+ distance?: number;
113
+ charge?: number;
114
+ iterations?: number;
115
+ center?: {
116
+ x: number;
117
+ y: number;
118
+ };
119
+ fitView?: boolean;
120
+ duration?: number;
121
+ }): void;
122
+ /**
123
+ * Apply hierarchy/tree layout.
124
+ *
125
+ * Requires the hierarchy addon to be registered via `Alpine.plugin(AlpineFlowHierarchy)`.
126
+ */
127
+ treeLayout(options?: {
128
+ layoutType?: HierarchyLayoutType;
129
+ direction?: HierarchyDirection;
130
+ nodeWidth?: number;
131
+ nodeHeight?: number;
132
+ adjustHandles?: boolean;
133
+ fitView?: boolean;
134
+ duration?: number;
135
+ }): void;
136
+ /**
137
+ * Apply ELK (Eclipse Layout Kernel) layout.
138
+ *
139
+ * Requires the elk addon to be registered via `Alpine.plugin(AlpineFlowElk)`.
140
+ * Note: elkLayout is async because ELK's layout() returns a Promise.
141
+ */
142
+ elkLayout(options?: {
143
+ algorithm?: ElkAlgorithm;
144
+ direction?: ElkDirection;
145
+ nodeSpacing?: number;
146
+ layerSpacing?: number;
147
+ adjustHandles?: boolean;
148
+ fitView?: boolean;
149
+ duration?: number;
150
+ }): Promise<void>;
151
+ };
@@ -0,0 +1,73 @@
1
+ import type { CanvasContext } from './canvas-context';
2
+ import type { FlowNode, FlowEdge } from '../../core/types';
3
+ export declare function createNodesMixin(ctx: CanvasContext): {
4
+ /**
5
+ * Add one or more nodes to the canvas.
6
+ *
7
+ * - Normalizes single node or array input.
8
+ * - When `options.center` is set, stashes intended positions off-screen
9
+ * so the directive can measure dimensions without a visible flash,
10
+ * then repositions after measurement via double-rAF.
11
+ * - Validates child constraints before accepting each node.
12
+ * - Captures history, sorts topologically, rebuilds node map.
13
+ * - Pushes collab updates when a collaboration bridge is active.
14
+ * - Runs child layout for any layout parents that received new children.
15
+ * - Schedules auto-layout after the mutation.
16
+ */
17
+ addNodes(newNodes: FlowNode | FlowNode[], options?: {
18
+ center?: boolean;
19
+ }): void;
20
+ /**
21
+ * Remove one or more nodes by ID.
22
+ *
23
+ * - Normalizes single ID or array input.
24
+ * - Validates child constraints before allowing removal.
25
+ * - Cascades removal to all descendants.
26
+ * - Removes connected edges and optionally creates reconnection bridges.
27
+ * - Cleans up selection state and initial dimensions.
28
+ * - Pushes collab updates when a collaboration bridge is active.
29
+ * - Re-layouts any layout parents that lost children.
30
+ * - Schedules auto-layout after the mutation.
31
+ */
32
+ removeNodes(ids: string | string[]): void;
33
+ /**
34
+ * Look up a node by ID.
35
+ */
36
+ getNode(id: string): FlowNode | undefined;
37
+ /**
38
+ * Get all nodes connected via outgoing edges from the given node.
39
+ */
40
+ getOutgoers(nodeId: string): FlowNode[];
41
+ /**
42
+ * Get all nodes connected via incoming edges to the given node.
43
+ */
44
+ getIncomers(nodeId: string): FlowNode[];
45
+ /**
46
+ * Get all edges connected to a node (both incoming and outgoing).
47
+ */
48
+ getConnectedEdges(nodeId: string): FlowEdge[];
49
+ /**
50
+ * Check if two nodes are connected by an edge.
51
+ * When `directed` is true, only checks source→target direction.
52
+ */
53
+ areNodesConnected(nodeA: string, nodeB: string, directed?: boolean): boolean;
54
+ /**
55
+ * Apply a node-level filter predicate.
56
+ * Nodes that fail the predicate get `filtered = true`.
57
+ */
58
+ setNodeFilter(predicate: (node: FlowNode) => boolean): void;
59
+ /**
60
+ * Clear node filter — restore all nodes to visible.
61
+ */
62
+ clearNodeFilter(): void;
63
+ /**
64
+ * Get nodes whose bounding rect overlaps the given node.
65
+ * Accepts either a FlowNode object or a node ID string.
66
+ */
67
+ getIntersectingNodes(nodeOrId: FlowNode | string, partially?: boolean): FlowNode[];
68
+ /**
69
+ * Check if two nodes' bounding rects overlap.
70
+ * Accepts either FlowNode objects or node ID strings.
71
+ */
72
+ isNodeIntersecting(nodeOrId: FlowNode | string, targetOrId: FlowNode | string, partially?: boolean): boolean;
73
+ };
@@ -0,0 +1,13 @@
1
+ import type { CanvasContext } from './canvas-context';
2
+ import type { RowFilter } from '../../core/types';
3
+ export declare function createRowsMixin(ctx: CanvasContext): {
4
+ selectRow(rowId: string): void;
5
+ deselectRow(rowId: string): void;
6
+ toggleRowSelect(rowId: string): void;
7
+ getSelectedRows(): string[];
8
+ isRowSelected(rowId: string): boolean;
9
+ deselectAllRows(): void;
10
+ setRowFilter(nodeId: string, filter: RowFilter): void;
11
+ getRowFilter(nodeId: string): RowFilter;
12
+ getVisibleRows(nodeId: string, schema: any[]): any[];
13
+ };
@@ -0,0 +1,45 @@
1
+ import type { CanvasContext } from './canvas-context';
2
+ export declare function createSelectionMixin(ctx: CanvasContext): {
3
+ /**
4
+ * Clear all node, edge, and row selections.
5
+ *
6
+ * - Sets `selected = false` on each selected node/edge data object.
7
+ * - Clears `selectedNodes`, `selectedEdges`, and `selectedRows` Sets.
8
+ * - Removes `.flow-node-selected`, `.flow-edge-selected`, and
9
+ * `.flow-row-selected` CSS classes from the DOM.
10
+ * - Emits a `selection-change` event.
11
+ */
12
+ deselectAll(): void;
13
+ /**
14
+ * Delete currently selected nodes and edges.
15
+ *
16
+ * - Filters out non-deletable nodes/edges (where `deletable === false`).
17
+ * - Cascades edge deletion for edges connected to deleted nodes.
18
+ * - Validates child removal constraints before deleting child nodes.
19
+ * - Supports an async `onBeforeDelete` callback that can cancel or
20
+ * modify the set of items to delete.
21
+ * - Wraps the entire operation in a single history step.
22
+ */
23
+ _deleteSelected(): Promise<void>;
24
+ /**
25
+ * Copy currently selected nodes and their internal edges to the
26
+ * module-level clipboard. Emits a `copy` event.
27
+ */
28
+ copy(): void;
29
+ /**
30
+ * Paste nodes/edges from the clipboard with new IDs and an
31
+ * accumulating 20 px offset.
32
+ *
33
+ * - Deselects all current selection first.
34
+ * - Pushes new nodes (topologically sorted) and edges directly.
35
+ * - Selects all pasted items.
36
+ * - Applies `.flow-node-selected` / `.flow-edge-selected` CSS classes
37
+ * after Alpine renders the new DOM elements.
38
+ */
39
+ paste(): void;
40
+ /**
41
+ * Copy selected nodes to the clipboard, then delete them.
42
+ * Emits a `cut` event.
43
+ */
44
+ cut(): Promise<void>;
45
+ };
@@ -0,0 +1,21 @@
1
+ import type { CanvasContext } from './canvas-context';
2
+ import type { ChildValidation } from '../../core/types';
3
+ export declare function createValidationMixin(ctx: CanvasContext): {
4
+ _getChildValidation(parentId: string): ChildValidation | undefined;
5
+ _recomputeChildValidation(): void;
6
+ validateParent(nodeId: string): {
7
+ valid: boolean;
8
+ errors: string[];
9
+ };
10
+ validateAll(): Map<string, {
11
+ valid: boolean;
12
+ errors: string[];
13
+ }>;
14
+ getValidationErrors(nodeId: string): string[];
15
+ /**
16
+ * Reparent a node into a new parent (or detach from current parent).
17
+ * Handles position conversion and child validation.
18
+ * Returns true on success, false if validation rejects the operation.
19
+ */
20
+ reparentNode(nodeId: string, newParentId: string | null): boolean;
21
+ };
@@ -0,0 +1,111 @@
1
+ import type { CanvasContext } from './canvas-context';
2
+ import type { Viewport, XYPosition } from '../../core/types';
3
+ export declare function createViewportMixin(ctx: CanvasContext): {
4
+ /**
5
+ * Convert screen coordinates (e.g. from a pointer event) to flow
6
+ * coordinates, accounting for the current viewport pan and zoom.
7
+ */
8
+ screenToFlowPosition(x: number, y: number): XYPosition;
9
+ /**
10
+ * Convert flow coordinates to screen coordinates, accounting for the
11
+ * current viewport pan and zoom.
12
+ */
13
+ flowToScreenPosition(x: number, y: number): XYPosition;
14
+ /**
15
+ * Fit all visible nodes into the viewport.
16
+ *
17
+ * Defers via `requestAnimationFrame` if any node lacks measured
18
+ * dimensions (up to 10 retries) to give the DOM time to render.
19
+ */
20
+ fitView(options?: {
21
+ padding?: number;
22
+ duration?: number;
23
+ }, _retries?: number): void;
24
+ /**
25
+ * Fit a specific rectangle into the viewport.
26
+ *
27
+ * If `duration` is specified, the transition is animated via
28
+ * `ctx.animate()` (cross-mixin dependency). Otherwise the viewport
29
+ * is set directly via `ctx._panZoom`.
30
+ */
31
+ fitBounds(rect: {
32
+ x: number;
33
+ y: number;
34
+ width: number;
35
+ height: number;
36
+ }, options?: {
37
+ padding?: number;
38
+ duration?: number;
39
+ }): void;
40
+ /**
41
+ * Get the bounding rectangle of the specified nodes (or all visible
42
+ * nodes if no IDs are provided).
43
+ */
44
+ getNodesBounds(nodeIds?: string[]): {
45
+ x: number;
46
+ y: number;
47
+ width: number;
48
+ height: number;
49
+ };
50
+ /**
51
+ * Compute the viewport (pan + zoom) that frames the given bounds
52
+ * within the container, respecting min/max zoom and padding.
53
+ */
54
+ getViewportForBounds(bounds: {
55
+ x: number;
56
+ y: number;
57
+ width: number;
58
+ height: number;
59
+ }, padding?: number): Viewport;
60
+ /**
61
+ * Set the viewport programmatically (pan and/or zoom).
62
+ */
63
+ setViewport(viewport: Partial<Viewport>, options?: {
64
+ duration?: number;
65
+ }): void;
66
+ /**
67
+ * Zoom in by `ZOOM_STEP_FACTOR`, clamped to `maxZoom`.
68
+ */
69
+ zoomIn(options?: {
70
+ duration?: number;
71
+ }): void;
72
+ /**
73
+ * Zoom out by `ZOOM_STEP_FACTOR`, clamped to `minZoom`.
74
+ */
75
+ zoomOut(options?: {
76
+ duration?: number;
77
+ }): void;
78
+ /**
79
+ * Center the viewport on flow coordinate `(x, y)` at the given zoom
80
+ * level (defaults to the current zoom).
81
+ */
82
+ setCenter(x: number, y: number, zoom?: number, options?: {
83
+ duration?: number;
84
+ }): void;
85
+ /**
86
+ * Pan the viewport by a delta `(dx, dy)`.
87
+ */
88
+ panBy(dx: number, dy: number, options?: {
89
+ duration?: number;
90
+ }): void;
91
+ /**
92
+ * Toggle pan/zoom interactivity on and off.
93
+ */
94
+ toggleInteractive(): void;
95
+ /**
96
+ * The current resolved color mode ('light' | 'dark' | undefined).
97
+ */
98
+ readonly colorMode: "light" | "dark" | undefined;
99
+ /**
100
+ * Get the current width and height of the container element.
101
+ */
102
+ getContainerDimensions(): {
103
+ width: number;
104
+ height: number;
105
+ };
106
+ /**
107
+ * Reset all panels by dispatching a `flow-panel-reset` CustomEvent
108
+ * on the container and emitting a `panel-reset` event.
109
+ */
110
+ resetPanels(): void;
111
+ };
@@ -0,0 +1,2 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ export declare function registerFlowCanvas(Alpine: Alpine): void;
@@ -0,0 +1,12 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ export interface ActionDef {
3
+ method: string;
4
+ disabledWhen?: (canvas: any) => boolean;
5
+ aria?: 'disabled' | 'pressed';
6
+ passExpression?: boolean;
7
+ }
8
+ export declare const ACTION_MAP: Record<string, ActionDef>;
9
+ export declare function getActionDef(actionName: string): ActionDef | null;
10
+ export declare function isActionDisabled(actionName: string, canvas: any): boolean;
11
+ export declare function getAriaAttr(actionName: string): 'disabled' | 'pressed' | null;
12
+ export declare function registerFlowActionDirective(Alpine: Alpine): void;
@@ -0,0 +1,2 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ export declare function registerFlowAnimateDirective(Alpine: Alpine): void;
@@ -0,0 +1,2 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ export declare function registerFlowArrowDrawDirective(Alpine: Alpine): void;
@@ -0,0 +1,2 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ export declare function registerFlowCircleDrawDirective(Alpine: Alpine): void;
@@ -0,0 +1,2 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ export declare function registerFlowCollapseDirective(Alpine: Alpine): void;
@@ -0,0 +1,2 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ export declare function registerFlowCondenseDirective(Alpine: Alpine): void;
@@ -0,0 +1,2 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ export declare function registerFlowContextMenuDirective(Alpine: Alpine): void;
@@ -0,0 +1,2 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ export declare function registerFlowDetailDirective(Alpine: Alpine): void;
@@ -0,0 +1,2 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ export declare function registerFlowDevtoolsDirective(Alpine: Alpine): void;
@@ -0,0 +1,2 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ export declare function registerFlowDragHandleDirective(Alpine: Alpine): void;
@@ -0,0 +1,2 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ export declare function registerFlowDraggableDirective(Alpine: Alpine): void;
@@ -0,0 +1,2 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ export declare function registerFlowEdgeToolbarDirective(Alpine: Alpine): void;
@@ -0,0 +1,7 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ import type { FlowNode, HandlePosition } from '../../core/types';
3
+ /**
4
+ * Look up a handle's declared position from the DOM.
5
+ */
6
+ export declare function resolveHandlePosition(container: Element, nodeId: string, handleId: string | undefined, handleType: 'source' | 'target', node?: FlowNode): HandlePosition;
7
+ export declare function registerFlowEdgeDirective(Alpine: Alpine): void;
@@ -0,0 +1,2 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ export declare function registerFlowEraserDirective(Alpine: Alpine): void;
@@ -0,0 +1,9 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ type FilterArg = 'node' | 'row';
3
+ export interface FilterParseResult {
4
+ type: FilterArg;
5
+ isClear: boolean;
6
+ }
7
+ export declare function parseFilterDirective(arg: string, modifiers: string[]): FilterParseResult | null;
8
+ export declare function registerFlowFilterDirective(Alpine: Alpine): void;
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ interface FollowOptions {
3
+ target: string;
4
+ zoom?: number;
5
+ speed?: number;
6
+ }
7
+ export declare function parseFollowExpression(value: unknown): FollowOptions | null;
8
+ export declare function registerFlowFollowDirective(Alpine: Alpine): void;
9
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ export declare function registerFlowFreehandDirective(Alpine: Alpine): void;
@@ -0,0 +1,12 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ /** Expando property: can this handle initiate a connection drag? */
3
+ export declare const HANDLE_CONNECTABLE_START_KEY = "_flowHandleConnectableStart";
4
+ /** Expando property: can this handle receive a connection? */
5
+ export declare const HANDLE_CONNECTABLE_END_KEY = "_flowHandleConnectableEnd";
6
+ declare global {
7
+ interface HTMLElement {
8
+ [HANDLE_CONNECTABLE_START_KEY]?: boolean;
9
+ [HANDLE_CONNECTABLE_END_KEY]?: boolean;
10
+ }
11
+ }
12
+ export declare function registerFlowHandleConnectableDirective(Alpine: Alpine): void;
@@ -0,0 +1,9 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ /** Expando property name for the connection limit on handle elements. */
3
+ export declare const HANDLE_LIMIT_KEY = "_flowHandleLimit";
4
+ declare global {
5
+ interface HTMLElement {
6
+ [HANDLE_LIMIT_KEY]?: number;
7
+ }
8
+ }
9
+ export declare function registerFlowHandleLimitDirective(Alpine: Alpine): void;
@@ -0,0 +1,10 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ import type { Connection } from '../../core/types';
3
+ /** Expando property name for the validator function on handle elements. */
4
+ export declare const HANDLE_VALIDATE_KEY = "_flowHandleValidate";
5
+ declare global {
6
+ interface HTMLElement {
7
+ [HANDLE_VALIDATE_KEY]?: (connection: Connection) => boolean;
8
+ }
9
+ }
10
+ export declare function registerFlowHandleValidateDirective(Alpine: Alpine): void;
@@ -0,0 +1,29 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ import type { Connection } from '../../core/types';
3
+ /**
4
+ * Run per-handle validators for a connection.
5
+ * Looks up source and target handle elements by node ID and handle ID,
6
+ * reads the expando validator, and calls it. Returns false if either rejects.
7
+ */
8
+ export declare function runHandleValidators(containerEl: HTMLElement, connection: Connection): boolean;
9
+ /**
10
+ * Check connection limits on source and target handles.
11
+ * Counts existing edges matching each handle and rejects if at/over the limit.
12
+ */
13
+ export declare function checkHandleLimits(containerEl: HTMLElement, connection: Connection, edges: {
14
+ source: string;
15
+ target: string;
16
+ sourceHandle?: string;
17
+ targetHandle?: string;
18
+ }[]): boolean;
19
+ /**
20
+ * Apply .flow-handle-valid / .flow-handle-invalid classes to all target handles
21
+ * in the container based on the validation chain for a hypothetical connection
22
+ * from the given source.
23
+ */
24
+ export declare function applyValidationClasses(containerEl: HTMLElement, sourceNodeId: string, sourceHandleId: string, canvas: any, excludeEdgeId?: string): void;
25
+ /**
26
+ * Remove .flow-handle-valid / .flow-handle-invalid from all target handles.
27
+ */
28
+ export declare function clearValidationClasses(containerEl: HTMLElement): void;
29
+ export declare function registerFlowHandleDirective(Alpine: Alpine): void;
@@ -0,0 +1,2 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ export declare function registerFlowHighlighterDirective(Alpine: Alpine): void;
@@ -0,0 +1,2 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ export declare function registerFlowLoadingDirective(Alpine: Alpine): void;
@@ -0,0 +1,2 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ export declare function registerFlowNodeToolbarDirective(Alpine: Alpine): void;
@@ -0,0 +1,10 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ /** Check if the easy-connect modifier key is held. */
3
+ export declare function isEasyConnectKey(e: PointerEvent | {
4
+ altKey: boolean;
5
+ metaKey: boolean;
6
+ shiftKey: boolean;
7
+ }, key: 'alt' | 'meta' | 'shift'): boolean;
8
+ /** Find the nearest source handle to a screen coordinate within a node element. */
9
+ export declare function findNearestSourceHandle(nodeEl: HTMLElement, clientX: number, clientY: number): HTMLElement | null;
10
+ export declare function registerFlowNodeDirective(Alpine: Alpine): void;
@@ -0,0 +1,2 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ export declare function registerFlowPanelDirective(Alpine: Alpine): void;
@@ -0,0 +1,2 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ export declare function registerFlowRectangleDrawDirective(Alpine: Alpine): void;
@@ -0,0 +1,2 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ export declare function registerFlowResizerDirective(Alpine: Alpine): void;
@@ -0,0 +1,11 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ /**
3
+ * Compute the rotation angle (0-360) from a pointer position relative to a center point.
4
+ * 0° = directly above center (12 o'clock), clockwise.
5
+ */
6
+ export declare function computeRotationAngle(pointerX: number, pointerY: number, centerX: number, centerY: number): number;
7
+ /**
8
+ * Snap an angle to the nearest increment.
9
+ */
10
+ export declare function snapAngle(angle: number, increment: number): number;
11
+ export declare function registerFlowRotateDirective(Alpine: Alpine): void;
@@ -0,0 +1,2 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ export declare function registerFlowRowSelectDirective(Alpine: Alpine): void;
@@ -0,0 +1,14 @@
1
+ import type { Alpine } from 'alpinejs';
2
+ type SnapshotAction = 'save' | 'restore';
3
+ export interface SnapshotParseResult {
4
+ action: SnapshotAction;
5
+ persist: boolean;
6
+ }
7
+ export declare function parseSnapshotDirective(arg: string, modifiers: string[]): SnapshotParseResult | null;
8
+ export declare function saveSnapshot(key: string, data: object): void;
9
+ export declare function getSnapshot(key: string): object | null;
10
+ export declare function hasSnapshot(key: string): boolean;
11
+ export declare function clearAllSnapshots(): void;
12
+ export declare function getLocalStorageKey(key: string): string;
13
+ export declare function registerFlowSnapshotDirective(Alpine: Alpine): void;
14
+ export {};