@statelyai/flow 0.13.4 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/README.md +5 -1
  2. package/dist/esm/index.d.ts +13 -2
  3. package/dist/esm/index.d.ts.map +1 -0
  4. package/dist/esm/index.js +39 -14
  5. package/dist/esm/index.js.map +1 -0
  6. package/dist/esm/layout/dagre.d.ts +2 -1
  7. package/dist/esm/layout/dagre.d.ts.map +1 -0
  8. package/dist/esm/layout/dagre.js +2 -0
  9. package/dist/esm/layout/dagre.js.map +1 -0
  10. package/dist/esm/layout/elk.d.ts +2 -1
  11. package/dist/esm/layout/elk.d.ts.map +1 -0
  12. package/dist/esm/layout/elk.js +2 -0
  13. package/dist/esm/layout/elk.js.map +1 -0
  14. package/dist/esm/layout/stately.d.ts +2 -1
  15. package/dist/esm/layout/stately.d.ts.map +1 -0
  16. package/dist/esm/layout/stately.js +2 -0
  17. package/dist/esm/layout/stately.js.map +1 -0
  18. package/dist/esm/shared.d.ts +2 -1
  19. package/dist/esm/shared.d.ts.map +1 -0
  20. package/dist/esm/shared.js +2 -0
  21. package/dist/esm/shared.js.map +1 -0
  22. package/package.json +4 -3
  23. package/src/__fixtures__/nested.ts +106 -0
  24. package/src/appearances.test.ts +428 -0
  25. package/src/appearances.ts +144 -0
  26. package/src/authoritative-route.ts +14 -0
  27. package/src/changeSet.test.ts +132 -0
  28. package/src/changeSet.ts +337 -0
  29. package/src/config.ts +41 -0
  30. package/src/configure.test.ts +212 -0
  31. package/src/connection-lifetime.ts +1 -0
  32. package/src/connectionPreview.test.ts +102 -0
  33. package/src/connectionPreview.ts +82 -0
  34. package/src/content.ts +203 -0
  35. package/src/createFlow.fit-frame.test.ts +256 -0
  36. package/src/createFlow.modern.test.ts +743 -0
  37. package/src/createFlow.test.ts +632 -0
  38. package/src/createFlow.ts +3463 -0
  39. package/src/createFlow.view.test.ts +212 -0
  40. package/src/createFlow.viewport-controls.test.ts +221 -0
  41. package/src/edge-geometry.ts +318 -0
  42. package/src/engine.cache.test.ts +728 -0
  43. package/src/engine.hierarchy.test.ts +1023 -0
  44. package/src/engine.test.ts +1965 -0
  45. package/src/engine.ts +3385 -0
  46. package/src/entity-changes.test.ts +309 -0
  47. package/src/entity-changes.ts +395 -0
  48. package/src/examples/flow-based-math.test.ts +25 -0
  49. package/src/examples/flow-based-math.ts +210 -0
  50. package/src/external-edit.test.ts +337 -0
  51. package/src/external-edit.ts +358 -0
  52. package/src/factories.test.ts +104 -0
  53. package/src/factories.ts +70 -0
  54. package/src/geometry.ts +13 -0
  55. package/src/graph-index.test.ts +56 -0
  56. package/src/graph-index.ts +194 -0
  57. package/src/hierarchy.test.ts +175 -0
  58. package/src/hierarchy.ts +330 -0
  59. package/src/highlights.test.ts +130 -0
  60. package/src/index.ts +469 -0
  61. package/src/input/index.ts +615 -0
  62. package/src/input/input.test.ts +2577 -0
  63. package/src/input/keymap.ts +111 -0
  64. package/src/input/modes.ts +1715 -0
  65. package/src/input/reparent.test.ts +214 -0
  66. package/src/layout/dagre.ts +138 -0
  67. package/src/layout/elk.ts +1382 -0
  68. package/src/layout/index.ts +12 -0
  69. package/src/layout/layout.test.ts +1248 -0
  70. package/src/layout/shared.ts +260 -0
  71. package/src/layout/stately-globals.d.ts +9 -0
  72. package/src/layout/stately.test.ts +246 -0
  73. package/src/layout/stately.ts +528 -0
  74. package/src/layout-animation.test.ts +223 -0
  75. package/src/layout-contract.test.ts +414 -0
  76. package/src/marker.test.ts +23 -0
  77. package/src/marker.ts +23 -0
  78. package/src/measurement-anchor.test.ts +232 -0
  79. package/src/minimap.test.ts +96 -0
  80. package/src/minimap.ts +137 -0
  81. package/src/nested-fixture.test.ts +178 -0
  82. package/src/port-measurement.test.ts +27 -0
  83. package/src/port-measurements.test.ts +187 -0
  84. package/src/profile.ts +124 -0
  85. package/src/projections.test.ts +103 -0
  86. package/src/projections.ts +295 -0
  87. package/src/render-invalidation.test.ts +62 -0
  88. package/src/render-invalidation.ts +55 -0
  89. package/src/renderer-geometry.test.ts +356 -0
  90. package/src/renderer-transactions.test.ts +234 -0
  91. package/src/routing/avoid.ts +417 -0
  92. package/src/routing/index.test.ts +361 -0
  93. package/src/routing/index.ts +366 -0
  94. package/src/routing/readTracking.test.ts +103 -0
  95. package/src/routing/readTracking.ts +233 -0
  96. package/src/selection-commands.test.ts +355 -0
  97. package/src/serialize.test.ts +167 -0
  98. package/src/serialize.ts +254 -0
  99. package/src/shapes/index.test.ts +45 -0
  100. package/src/shapes/index.ts +142 -0
  101. package/src/snap.test.ts +123 -0
  102. package/src/snap.ts +395 -0
  103. package/src/spatial.test.ts +676 -0
  104. package/src/spatial.ts +457 -0
  105. package/src/store/index.ts +4121 -0
  106. package/src/store.test.ts +2903 -0
  107. package/src/toolbar.test.ts +31 -0
  108. package/src/toolbar.ts +62 -0
  109. package/src/types.test.ts +15 -0
  110. package/src/types.ts +487 -0
  111. package/src/validation.ts +558 -0
  112. package/src/view.ts +172 -0
  113. package/src/viewport/animate.ts +285 -0
  114. package/src/viewport/index.ts +296 -0
  115. package/src/viewport.test.ts +569 -0
@@ -0,0 +1,130 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { createFlowStore } from './store';
3
+ import { createFlowEngine } from './engine';
4
+ import { createEntityChangeNotifier } from './entity-changes';
5
+ import { createNode, createEdge, createGraph } from './factories';
6
+
7
+ function makeRig() {
8
+ const store = createFlowStore(
9
+ createGraph({
10
+ nodes: [
11
+ createNode({ id: 'a' }),
12
+ createNode({ id: 'b', x: 300 }),
13
+ createNode({ id: 'c', x: 600 }),
14
+ ],
15
+ edges: [createEdge({ id: 'ab', sourceId: 'a', targetId: 'b' })],
16
+ }),
17
+ );
18
+ return { store, engine: createFlowEngine(store), ctx: () => store.getSnapshot().context };
19
+ }
20
+
21
+ describe('hover state', () => {
22
+ it('setHover/clearHover update the hovered set', () => {
23
+ const { store, ctx, engine } = makeRig();
24
+ store.trigger.setHover({ ids: ['a'] });
25
+ expect(engine.isHovered('a')).toBe(true);
26
+ store.trigger.setHover({ ids: ['b'] });
27
+ expect(engine.isHovered('a')).toBe(false);
28
+ store.trigger.clearHover();
29
+ expect(ctx().hoveredEntityIds.size).toBe(0);
30
+ });
31
+
32
+ it('is a no-op (same context identity) when the hover set is unchanged', () => {
33
+ const { store, ctx } = makeRig();
34
+ store.trigger.setHover({ ids: ['a'] });
35
+ const before = ctx();
36
+ store.trigger.setHover({ ids: ['a'] });
37
+ expect(ctx()).toBe(before); // zero downstream work
38
+ store.trigger.clearHover();
39
+ const cleared = ctx();
40
+ store.trigger.clearHover();
41
+ expect(ctx()).toBe(cleared);
42
+ });
43
+
44
+ it('notifies exactly the entities entering/leaving hover', () => {
45
+ const { store } = makeRig();
46
+ const notifier = createEntityChangeNotifier(store);
47
+ const counts: Record<string, number> = { a: 0, b: 0, c: 0 };
48
+ for (const id of Object.keys(counts)) notifier.subscribe(id, () => counts[id]++);
49
+
50
+ store.trigger.setHover({ ids: ['a'] });
51
+ expect(counts).toEqual({ a: 1, b: 0, c: 0 });
52
+ store.trigger.setHover({ ids: ['b'] });
53
+ expect(counts).toEqual({ a: 2, b: 1, c: 0 });
54
+ });
55
+ });
56
+
57
+ describe('highlights with metadata', () => {
58
+ it('set/add/remove/clear by kind, with metadata round-tripping', () => {
59
+ const { store, engine } = makeRig();
60
+ store.trigger.setHighlights({
61
+ kind: 'heat',
62
+ entries: [
63
+ { id: 'a', meta: { weight: 0.9, color: '#f00' } },
64
+ { id: 'b', meta: { weight: 0.2 } },
65
+ ],
66
+ });
67
+ store.trigger.addHighlights({ kind: 'search', entries: [{ id: 'a' }] });
68
+
69
+ expect(engine.getHighlights('a')).toEqual([
70
+ { kind: 'heat', meta: { weight: 0.9, color: '#f00' } },
71
+ { kind: 'search', meta: undefined },
72
+ ]);
73
+ expect(engine.getHighlights('b')).toEqual([
74
+ { kind: 'heat', meta: { weight: 0.2 } },
75
+ ]);
76
+ expect(engine.getHighlights('c')).toEqual([]);
77
+
78
+ store.trigger.removeHighlights({ kind: 'heat', ids: ['a'] });
79
+ expect(engine.getHighlights('a')).toEqual([{ kind: 'search', meta: undefined }]);
80
+
81
+ store.trigger.clearHighlights({ kind: 'search' });
82
+ expect(engine.getHighlights('a')).toEqual([]);
83
+ expect(engine.getHighlights('b')).toHaveLength(1);
84
+
85
+ store.trigger.clearHighlights();
86
+ expect(engine.getHighlights('b')).toEqual([]);
87
+ });
88
+
89
+ it('setHighlights replaces the whole kind bucket (bulk heatmap update)', () => {
90
+ const { store, engine } = makeRig();
91
+ store.trigger.setHighlights({ kind: 'heat', entries: [{ id: 'a', meta: 1 }] });
92
+ store.trigger.setHighlights({ kind: 'heat', entries: [{ id: 'b', meta: 2 }] });
93
+ expect(engine.getHighlights('a')).toEqual([]);
94
+ expect(engine.getHighlights('b')).toEqual([{ kind: 'heat', meta: 2 }]);
95
+ });
96
+
97
+ it('getHighlights is referentially stable across unrelated transitions', () => {
98
+ const { store, engine } = makeRig();
99
+ store.trigger.setHighlights({ kind: 'heat', entries: [{ id: 'a', meta: 1 }] });
100
+ const first = engine.getHighlights('a');
101
+ const emptyFirst = engine.getHighlights('c');
102
+
103
+ store.trigger.select({ ids: ['b'] }); // unrelated transition
104
+ expect(engine.getHighlights('a')).toBe(first);
105
+ expect(engine.getHighlights('c')).toBe(emptyFirst); // shared empty constant
106
+ });
107
+
108
+ it('notifies only entities in changed kind buckets', () => {
109
+ const { store } = makeRig();
110
+ const notifier = createEntityChangeNotifier(store);
111
+ const counts: Record<string, number> = { a: 0, b: 0, c: 0 };
112
+ for (const id of Object.keys(counts)) notifier.subscribe(id, () => counts[id]++);
113
+
114
+ store.trigger.setHighlights({ kind: 'heat', entries: [{ id: 'a', meta: 1 }, { id: 'b', meta: 2 }] });
115
+ expect(counts).toEqual({ a: 1, b: 1, c: 0 });
116
+
117
+ store.trigger.setHighlights({ kind: 'other', entries: [{ id: 'c' }] });
118
+ expect(counts).toEqual({ a: 1, b: 1, c: 1 }); // heat bucket untouched
119
+ });
120
+
121
+ it('deleting an entity prunes its hover/highlight state', () => {
122
+ const { store, ctx } = makeRig();
123
+ store.trigger.setHover({ ids: ['a'] });
124
+ store.trigger.setHighlights({ kind: 'heat', entries: [{ id: 'a', meta: 1 }] });
125
+
126
+ store.trigger.deleteNode({ id: 'a' });
127
+ expect(ctx().hoveredEntityIds.has('a')).toBe(false);
128
+ expect(ctx().highlights.size).toBe(0);
129
+ });
130
+ });
package/src/index.ts ADDED
@@ -0,0 +1,469 @@
1
+ // @statelyai/flow
2
+ //
3
+ // Framework-agnostic flow visualization engine.
4
+ // Built on @statelyai/graph VisualGraph + @xstate/store.
5
+
6
+ // Types
7
+ export type {
8
+ // Graph (re-exported from @statelyai/graph)
9
+ Graph,
10
+ GraphNode,
11
+ GraphEdge,
12
+ GraphPort,
13
+ EdgeRouting,
14
+ PortDirection,
15
+ VisualGraph,
16
+ VisualNode,
17
+ VisualEdge,
18
+ VisualPort,
19
+ EntityRect,
20
+ // Flow entity types
21
+ FlowNode,
22
+ FlowEdge,
23
+ FlowAddressable,
24
+ FlowEntityRef,
25
+ FlowGraph,
26
+ FlowAutoSizeAnchor,
27
+ FlowNodeAttributes,
28
+ FlowEdgeAttributes,
29
+ FlowEdgeLabel,
30
+ LabelAnchor,
31
+ // Geometry
32
+ Point,
33
+ Size,
34
+ Rect,
35
+ // Viewport
36
+ Viewport,
37
+ ViewportAnimationOptions,
38
+ FitViewOptions,
39
+ // Style
40
+ StyleOverrides,
41
+ FlowEdgeStyle,
42
+ MarkerType,
43
+ // Ports
44
+ FlowPort,
45
+ Side,
46
+ // Resize
47
+ ResizeHandle,
48
+ ResizeConstraints,
49
+ // Edges
50
+ EdgeDirection,
51
+ // Canvas
52
+ InteractionMode,
53
+ SelectionMode,
54
+ CanvasState,
55
+ ConnectionState,
56
+ AutoLayoutState,
57
+ // Visual state
58
+ EntityVisualState,
59
+ // Routing
60
+ Direction,
61
+ PathData,
62
+ EdgePathData,
63
+ // Shapes
64
+ ShapeHandler,
65
+ // Config
66
+ BehaviorPredicate,
67
+ FlowConfig,
68
+ } from "./types";
69
+ export { markerToSVG } from "./marker";
70
+
71
+ // Graph projections (derived graph-addressed visual data)
72
+ export {
73
+ composeGraphProjectionAttrs,
74
+ getProjectedEdgeAttrs,
75
+ getProjectedNodeAttrs,
76
+ mergeGraphEdgeAttrs,
77
+ mergeGraphNodeAttrs,
78
+ sortActiveGraphProjections,
79
+ } from "./projections";
80
+ export type {
81
+ ActiveGraphProjection,
82
+ ComposedGraphProjectionAttrs,
83
+ GraphDecoration,
84
+ GraphEdgeAttrs,
85
+ GraphNodeAttrs,
86
+ GraphProjection,
87
+ GraphProjectionMapper,
88
+ } from "./projections";
89
+
90
+ // Store
91
+ export { areNodesMeasured, createFlowStore } from "./store";
92
+ export type {
93
+ FlowStore,
94
+ FlowStoreContext,
95
+ FlowStoreOptions,
96
+ FlowRuntimeSettings,
97
+ FlowEdgePatch,
98
+ FlowEdgeUpdater,
99
+ FlowNodePatch,
100
+ FlowNodeUpdater,
101
+ FlowUpdateEdgeEvent,
102
+ FlowUpdateNodeEvent,
103
+ FlowGraphHistoryPolicy,
104
+ FlowGraphRetentionPolicy,
105
+ BoxSelectionTest,
106
+ FlowColorMode,
107
+ ConnectEndTarget,
108
+ ConnectionEndedEvent,
109
+ FlowHighlightEntry,
110
+ FlowHighlights,
111
+ FlowEntitiesDeletedEvent,
112
+ FlowConnectMovedEvent,
113
+ FlowConnectStartedEvent,
114
+ FlowDragEndedEvent,
115
+ FlowDragMovedEvent,
116
+ FlowDragStartedEvent,
117
+ FlowEntityGestureEvent,
118
+ FlowErrorEvent,
119
+ FlowGestureModifiers,
120
+ FlowGraphChangedEvent,
121
+ FlowPaneGestureEvent,
122
+ FlowResizeEndedEvent,
123
+ FlowResizeStartedEvent,
124
+ FlowSelectionChangedEvent,
125
+ FlowViewportChangedEvent,
126
+ FlowViewChangedEvent,
127
+ LayoutRequestedEvent,
128
+ } from "./store";
129
+
130
+ // Structural graph views
131
+ export { deriveFlowView } from "./view";
132
+ export type {
133
+ FlowViewBoundaryEndpoints,
134
+ FlowViewEndpoint,
135
+ FlowViewEntities,
136
+ FlowViewScope,
137
+ FlowViewSelectionPolicy,
138
+ } from "./view";
139
+
140
+ // Profiles
141
+ export {
142
+ defaultFlowProfile,
143
+ defineFlowProfile,
144
+ } from "./profile";
145
+ export type {
146
+ FlowEventObject,
147
+ FlowInputProfile,
148
+ FlowModeDefinition,
149
+ FlowOrigin,
150
+ FlowPolicies,
151
+ FlowProfile,
152
+ FlowResolvers,
153
+ FlowRules,
154
+ FlowSettings,
155
+ FlowTransition,
156
+ FlowTransitions,
157
+ } from "./profile";
158
+
159
+ // Controller
160
+ export { createFlow, fromJSON } from "./createFlow";
161
+ export type {
162
+ CreateEdgeInput,
163
+ FlowConfigureOptions,
164
+ CreateFlowOptions,
165
+ FlowAbortSignal,
166
+ FlowCommitEvent,
167
+ FlowConfiguration,
168
+ FlowCapabilityResult,
169
+ FlowCapabilityCommand,
170
+ FlowConnection,
171
+ FlowConnectionsApi,
172
+ FlowContentApi,
173
+ FlowCreateIdContext,
174
+ FlowTransactionDraft,
175
+ CreateNodeInput,
176
+ FlowEdgesApi,
177
+ FlowHighlightsApi,
178
+ FlowHistoryApi,
179
+ FlowLayoutApi,
180
+ FlowNodesApi,
181
+ FlowProjectionListener,
182
+ FlowProjectionsApi,
183
+ FlowReplaceGraphOptions,
184
+ FlowSelectionAlignment,
185
+ FlowSelectionApi,
186
+ FlowSelectionDistribution,
187
+ FlowSelectionDuplicateResult,
188
+ FlowTransactionOptions,
189
+ FlowGeometryOptions,
190
+ FlowContentSizeOptions,
191
+ FlowMeasurement,
192
+ FlowMeasurementsApi,
193
+ FlowViewApi,
194
+ FlowViewportApi,
195
+ FlowController,
196
+ LayoutAlgorithm,
197
+ LayoutAnimationControls,
198
+ LayoutAnimationOptions,
199
+ LayoutApplyOptions,
200
+ LayoutDiagnostic,
201
+ LayoutEdgeRoute,
202
+ LayoutPositions,
203
+ LayoutResult,
204
+ LayoutRunOptions,
205
+ LayoutRunResult,
206
+ } from "./createFlow";
207
+
208
+ // Serialization
209
+ export { serializeFlowGraph } from "./serialize";
210
+ export type { FlowSerialized } from "./serialize";
211
+ export { parseFlowSerialized } from "./serialize";
212
+ export {
213
+ cloneJsonSafe,
214
+ validateAndCloneGraph,
215
+ validateViewport,
216
+ FlowGraphValidationError,
217
+ } from "./validation";
218
+ export type {
219
+ FlowDataSchema,
220
+ FlowDataSchemas,
221
+ FlowDataVersions,
222
+ FlowResult,
223
+ FlowValidationIssue,
224
+ StandardSchemaV1Like,
225
+ } from "./validation";
226
+ export { applyFlowPatches, createFlowChangeSet } from "./changeSet";
227
+ export type { FlowChangeSet, FlowEntityUpdate, FlowPatch } from "./changeSet";
228
+ export { extractFlowContent, insertFlowContent } from "./content";
229
+ export type { FlowContent, FlowContentInsertResult } from "./content";
230
+
231
+ // Engine (high-level API wrapping store)
232
+ export { createFlowEngine } from "./engine";
233
+ export type {
234
+ ConnectionCandidate,
235
+ ConnectionCandidateOptions,
236
+ ConnectionCandidateSource,
237
+ ConnectionValidationContext,
238
+ ConnectionValidationResult,
239
+ EdgeSourceBoundsContext,
240
+ FlowConnectionMode,
241
+ FlowConnectionOptions,
242
+ FlowEngine,
243
+ FlowEngineOptions,
244
+ EdgePathOptions,
245
+ ProposedConnection,
246
+ RenderableEntitiesOptions,
247
+ } from "./engine";
248
+
249
+ // Connection preview helpers
250
+ export {
251
+ CONNECTION_PREVIEW_EDGE_ID,
252
+ CONNECTION_PREVIEW_NODE_ID,
253
+ createConnectionPreviewGraph,
254
+ } from "./connectionPreview";
255
+ export type {
256
+ ConnectionPreviewData,
257
+ ConnectionPreviewGraphOptions,
258
+ } from "./connectionPreview";
259
+
260
+ // Spatial helpers
261
+ export {
262
+ resolvedPosition,
263
+ resolvedBounds,
264
+ resolvedEdgeLabelBounds,
265
+ resolvedEdgeLabelSize,
266
+ visualPosition,
267
+ visualBounds,
268
+ resolvedSelectionBounds,
269
+ snappedBounds,
270
+ getGraphBounds,
271
+ getSelectionBounds,
272
+ rectsIntersect,
273
+ snapToGrid,
274
+ snapPointToGrid,
275
+ boxToRect,
276
+ selectMode,
277
+ rectContains,
278
+ unionRect,
279
+ getAnchorTransform,
280
+ wheelZoomDelta,
281
+ wheelInteraction,
282
+ normalizeWheelPan,
283
+ isTrackpadPinch,
284
+ constrainViewport,
285
+ calcAutoPan,
286
+ } from "./spatial";
287
+ export type {
288
+ AnchorSpec,
289
+ AnchorTransform,
290
+ WheelInteraction,
291
+ WheelInteractionOptions,
292
+ } from "./spatial";
293
+
294
+ // Viewport utilities
295
+ export {
296
+ createViewport,
297
+ toSVGTransform,
298
+ toViewBox,
299
+ screenToCanvas,
300
+ canvasToScreen,
301
+ getVisibleBounds,
302
+ viewportForBounds,
303
+ viewportCenteredOn,
304
+ validateFitFrame,
305
+ fitFrameAroundExclusions,
306
+ panBy,
307
+ zoomTo,
308
+ clampZoom,
309
+ animateViewport,
310
+ } from "./viewport";
311
+ export type {
312
+ FitViewExclusion,
313
+ FitViewExclusionSide,
314
+ ResolvedFitViewExclusion,
315
+ AnimateViewportOptions,
316
+ ViewportAnimationCancelFrame,
317
+ ViewportAnimationControls,
318
+ ViewportAnimationFrame,
319
+ } from "./viewport";
320
+
321
+ // Toolbar placement (rendering lives in adapters/userland)
322
+ export { getToolbarPlacement } from "./toolbar";
323
+ export type { ToolbarPlacement, ToolbarPlacementInput } from "./toolbar";
324
+
325
+ // Minimap projection (rendering lives in adapters/userland)
326
+ export {
327
+ getMinimapProjection,
328
+ getMinimapViewportCenter,
329
+ } from "./minimap";
330
+ export type {
331
+ MinimapProjection,
332
+ MinimapProjectionOptions,
333
+ MinimapViewportCenterOptions,
334
+ } from "./minimap";
335
+
336
+ // Group hierarchy (policy-driven parent/child geometry)
337
+ export {
338
+ deriveGroupGeometry,
339
+ fixedGroupGeometry,
340
+ getEdgeOwner,
341
+ isDerivedGroup,
342
+ isGroup,
343
+ resolveGroupPadding,
344
+ } from "./hierarchy";
345
+ export type {
346
+ GroupContentSide,
347
+ GroupGeometry,
348
+ GroupInsets,
349
+ GroupLayout,
350
+ } from "./hierarchy";
351
+
352
+ // Graph indices and traversal helpers (cached on array identity)
353
+ export {
354
+ getConnectedEdges,
355
+ getIncomers,
356
+ getNeighbors,
357
+ getOutgoers,
358
+ indexChildren,
359
+ indexEdgeAdjacency,
360
+ nodeDepths,
361
+ } from "./graph-index";
362
+ export type { EdgeAdjacencyIndex } from "./graph-index";
363
+
364
+ // Shapes
365
+ export { registerShape, getShape, getShapeOrDefault } from "./shapes";
366
+
367
+ // Edge routing
368
+ export {
369
+ straightRouter,
370
+ stepRouter,
371
+ bezierRouter,
372
+ configureBezierRouter,
373
+ configureStepRouter,
374
+ avoidRouter,
375
+ configureAvoidRouter,
376
+ bestDirection,
377
+ pathToSVG,
378
+ } from "./routing";
379
+ export type {
380
+ AvoidRouterOptions,
381
+ BezierRouterOptions,
382
+ EdgeRouter,
383
+ EdgeRouterContext,
384
+ EdgeRouterGraph,
385
+ StepRouterOptions,
386
+ } from "./routing";
387
+
388
+ // Snap lines (Figma-style alignment guides)
389
+ export { getSnapLines } from "./snap";
390
+ export type { SnapLine, SpacingGuide, SnapResult, SnapOptions } from "./snap";
391
+
392
+ // Input runtime (framework-neutral gesture recognition)
393
+ export {
394
+ createFlowInputRuntime,
395
+ defaultModesForContext,
396
+ profileModesForContext,
397
+ profilePoliciesForContext,
398
+ defaultKeymap,
399
+ matchesKeyBinding,
400
+ resolveKeymap,
401
+ getAutoPanDelta,
402
+ defaultInputModes,
403
+ defaultInputModesForKeymap,
404
+ readonlyInputModes,
405
+ readonlyInputModesForKeymap,
406
+ keyboardMode,
407
+ keyboardNavMode,
408
+ wheelMode,
409
+ pinchMode,
410
+ panMode,
411
+ connectMode,
412
+ portPressMode,
413
+ reconnectMode,
414
+ entityPressMode,
415
+ boxSelectMode,
416
+ panePressMode,
417
+ hoverMode,
418
+ trigger,
419
+ preventDefault,
420
+ } from "./input";
421
+ export type {
422
+ ConnectModeOptions,
423
+ ReconnectModeOptions,
424
+ BoxSelectModeOptions,
425
+ ReparentDecision,
426
+ ReparentDropContext,
427
+ ReparentOptions,
428
+ FlowCommand,
429
+ FlowInputEffects,
430
+ FlowInputEvent,
431
+ FlowInputMode,
432
+ FlowInputModeContext,
433
+ FlowInputModifiers,
434
+ FlowInputReaction,
435
+ FlowInputRuntime,
436
+ FlowInputRuntimeOptions,
437
+ FlowInputSessionHandlers,
438
+ FlowInputTarget,
439
+ FlowKeyBinding,
440
+ FlowKeyInputEvent,
441
+ FlowKeymap,
442
+ FlowPointerInputEvent,
443
+ FlowPinchInputEvent,
444
+ FlowSessionResult,
445
+ FlowTriggerCommand,
446
+ FlowTriggerName,
447
+ FlowWheelInputEvent,
448
+ } from "./input";
449
+
450
+ // Entity-change notifier (O(changed) dispatch for per-entity subscribers)
451
+ export { createEntityChangeNotifier } from "./entity-changes";
452
+ export type {
453
+ FlowEntityChangeNotifier,
454
+ FlowEntityChangeNotifierOptions,
455
+ } from "./entity-changes";
456
+
457
+ // Graph indices (id → entity maps cached on array identity)
458
+ export { indexNodes, indexEdges } from "./graph-index";
459
+
460
+ // Config presets
461
+ export { defaultConfig, readonlyConfig, resolveBehavior } from "./config";
462
+
463
+ export * from "./appearances";
464
+
465
+ // Factory functions
466
+ export { createNode, createEdge, createGraph, createPort } from "./factories";
467
+
468
+ export type { FlowExternalEdit, FlowExternalEditOperation } from './external-edit';
469
+ export type { FlowRenderApi, FlowRenderInvalidation } from './render-invalidation';