@statelyai/flow 0.4.0 → 0.5.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.
- package/README.md +244 -36
- package/dist/esm/index.d.ts +1478 -199
- package/dist/esm/index.js +5759 -632
- package/package.json +9 -7
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ExtractEvents } from "@xstate/store";
|
|
2
2
|
import { EntityRect, Graph, GraphEdge, GraphNode, GraphPort, PortDirection, VisualEdge, VisualEdge as VisualEdge$1, VisualGraph, VisualGraphConfig, VisualNode, VisualNode as VisualNode$1, VisualPort, VisualPort as VisualPort$1 } from "@statelyai/graph";
|
|
3
|
-
|
|
4
3
|
//#region src/hierarchy.d.ts
|
|
5
4
|
type GroupContentSide = 'top' | 'left' | 'bottom' | 'right';
|
|
6
5
|
type GroupInsets = {
|
|
@@ -49,7 +48,8 @@ declare function isDerivedGroup(node: FlowNode): boolean;
|
|
|
49
48
|
*/
|
|
50
49
|
declare function deriveGroupGeometry(contentSize: Size, childrenBounds: Rect | null, layout: Extract<GroupLayout, {
|
|
51
50
|
type: 'derived';
|
|
52
|
-
}>,
|
|
51
|
+
}>,
|
|
52
|
+
/** Anchor (stored node position) used only when there are no children. */
|
|
53
53
|
anchor?: Point): GroupGeometry;
|
|
54
54
|
/**
|
|
55
55
|
* Geometry for a `fixed` group: stored bounds are authoritative; the content
|
|
@@ -78,6 +78,11 @@ type Size = {
|
|
|
78
78
|
height: number;
|
|
79
79
|
};
|
|
80
80
|
type Rect = Point & Size;
|
|
81
|
+
/** Anchor retained when an auto-sized node's DOM measurement changes. */
|
|
82
|
+
type FlowAutoSizeAnchor = 'top-left' | 'center' | {
|
|
83
|
+
x: number;
|
|
84
|
+
y: number;
|
|
85
|
+
};
|
|
81
86
|
type Viewport = {
|
|
82
87
|
/** Pan offset x (canvas → screen translation) */
|
|
83
88
|
x: number;
|
|
@@ -96,6 +101,8 @@ type FlowPort<TPortData = unknown> = VisualPort$1<TPortData> & {
|
|
|
96
101
|
* Visual position = { x + dx, y + dy }
|
|
97
102
|
*/
|
|
98
103
|
type FlowNodeAttributes = {
|
|
104
|
+
/** Application-defined node/rendering kind. `type` remains the structural `node` discriminant. */
|
|
105
|
+
kind?: string;
|
|
99
106
|
dx?: number;
|
|
100
107
|
dy?: number;
|
|
101
108
|
style?: StyleOverrides;
|
|
@@ -108,6 +115,12 @@ type FlowNodeAttributes = {
|
|
|
108
115
|
* authored `width`/`height` only seed geometry until the first measurement.
|
|
109
116
|
*/
|
|
110
117
|
autoSize?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Visual anchor retained as DOM-owned dimensions change. Fractions are
|
|
120
|
+
* relative to the node box (`0` = start, `1` = end). Defaults to
|
|
121
|
+
* `top-left`; `center` is shorthand for `{ x: 0.5, y: 0.5 }`.
|
|
122
|
+
*/
|
|
123
|
+
autoSizeAnchor?: FlowAutoSizeAnchor;
|
|
111
124
|
/**
|
|
112
125
|
* Last DOM-measured size (à la React Flow's `node.measured`), written by the
|
|
113
126
|
* measurement observer for `autoSize` nodes only. A *derived* overlay kept
|
|
@@ -120,6 +133,8 @@ type FlowNodeAttributes = {
|
|
|
120
133
|
measured?: {
|
|
121
134
|
width: number;
|
|
122
135
|
height: number;
|
|
136
|
+
/** Derived position correction excluded from serialization. */
|
|
137
|
+
anchorOffset?: Point;
|
|
123
138
|
};
|
|
124
139
|
/**
|
|
125
140
|
* Marks this node as a group and configures how its bounds relate to its
|
|
@@ -129,12 +144,23 @@ type FlowNodeAttributes = {
|
|
|
129
144
|
* authoritative and children can be clamped inside. See `GroupLayout`.
|
|
130
145
|
*/
|
|
131
146
|
group?: GroupLayout;
|
|
147
|
+
/** Entity flag wins over global `FlowConfig.visible`; default true. */
|
|
132
148
|
hidden?: boolean;
|
|
149
|
+
/** Entity flag wins over global `FlowConfig.selectable`; default true. */
|
|
133
150
|
selectable?: boolean;
|
|
151
|
+
/** Whether renderers include the entity in keyboard focus order; default true. */
|
|
152
|
+
focusable?: boolean;
|
|
153
|
+
/** Entity flag wins over global `FlowConfig.draggable`; default true. */
|
|
134
154
|
draggable?: boolean;
|
|
155
|
+
/** Entity flag wins over global `FlowConfig.connectable`; default true. */
|
|
135
156
|
connectable?: boolean;
|
|
157
|
+
/** Entity flag wins over global `FlowConfig.deletable`; default true. */
|
|
136
158
|
deletable?: boolean;
|
|
159
|
+
/** Entity flag wins over global `FlowConfig.resizable`; default false. */
|
|
137
160
|
resizable?: boolean;
|
|
161
|
+
zIndex?: number;
|
|
162
|
+
/** Framework-neutral resize constraints consumed by the core resize reducer. */
|
|
163
|
+
resize?: ResizeConstraints;
|
|
138
164
|
};
|
|
139
165
|
/** Flow edge label — positioned like a node, lives on edge */
|
|
140
166
|
type FlowEdgeLabel<TData = unknown> = {
|
|
@@ -142,6 +168,11 @@ type FlowEdgeLabel<TData = unknown> = {
|
|
|
142
168
|
y: number;
|
|
143
169
|
dx?: number;
|
|
144
170
|
dy?: number;
|
|
171
|
+
/**
|
|
172
|
+
* DOM-driven sizing: the rendered label owns its live size. Authored
|
|
173
|
+
* `width`/`height` remain fallback graph data; measurements stay transient.
|
|
174
|
+
*/
|
|
175
|
+
autoSize?: boolean;
|
|
145
176
|
width: number;
|
|
146
177
|
height: number;
|
|
147
178
|
style?: StyleOverrides;
|
|
@@ -151,9 +182,9 @@ type FlowEdgeLabel<TData = unknown> = {
|
|
|
151
182
|
* Label anchor: determines base position of edge label before dx/dy offset.
|
|
152
183
|
* - number (0..1): interpolation along source→target centers (0.5 = midpoint)
|
|
153
184
|
* - 'fixed': uses label's own x/y, ignores node positions
|
|
154
|
-
* - function: custom anchor returning center point given source/target bounds
|
|
185
|
+
* - function: custom anchor returning center point given source/target bounds and edge
|
|
155
186
|
*/
|
|
156
|
-
type LabelAnchor = number | 'fixed' | ((sourceBounds: Rect, targetBounds: Rect) => Point);
|
|
187
|
+
type LabelAnchor = number | 'fixed' | ((sourceBounds: Rect, targetBounds: Rect, edge: FlowEdge) => Point);
|
|
157
188
|
/** Edge marker type */
|
|
158
189
|
type MarkerType = 'arrow' | 'arrow-closed' | 'circle' | 'none' | (string & {});
|
|
159
190
|
/** Edge visual style — read by renderer */
|
|
@@ -170,18 +201,28 @@ type FlowEdgeAttributes<TLabelData = unknown> = {
|
|
|
170
201
|
dy?: number;
|
|
171
202
|
label?: FlowEdgeLabel<TLabelData> | null;
|
|
172
203
|
labelAnchor?: LabelAnchor;
|
|
204
|
+
waypoints?: Point[];
|
|
173
205
|
sourcePort?: string | null;
|
|
174
206
|
targetPort?: string | null;
|
|
175
207
|
kind?: string;
|
|
176
208
|
style?: FlowEdgeStyle;
|
|
209
|
+
/** Entity flag wins over global `FlowConfig.visible`; default true. */
|
|
177
210
|
hidden?: boolean;
|
|
211
|
+
/** Entity flag wins over global `FlowConfig.selectable`; default true. */
|
|
178
212
|
selectable?: boolean;
|
|
213
|
+
/** Whether renderers include the entity in keyboard focus order; default true. */
|
|
214
|
+
focusable?: boolean;
|
|
215
|
+
/** Entity flag wins over global `FlowConfig.draggable`; default true. */
|
|
179
216
|
draggable?: boolean;
|
|
217
|
+
/** Entity flag wins over global `FlowConfig.connectable`; default true. */
|
|
180
218
|
connectable?: boolean;
|
|
219
|
+
/** Entity flag wins over global `FlowConfig.reconnectable`; default true. */
|
|
181
220
|
reconnectable?: boolean;
|
|
221
|
+
/** Entity flag wins over global `FlowConfig.deletable`; default true. */
|
|
182
222
|
deletable?: boolean;
|
|
223
|
+
zIndex?: number;
|
|
183
224
|
};
|
|
184
|
-
type
|
|
225
|
+
type FlowEntityRef = {
|
|
185
226
|
kind: 'node';
|
|
186
227
|
id: string;
|
|
187
228
|
node: FlowNode;
|
|
@@ -202,14 +243,22 @@ type FlowAddressable = {
|
|
|
202
243
|
blockType: string;
|
|
203
244
|
data?: unknown;
|
|
204
245
|
};
|
|
246
|
+
/** @deprecated Use `FlowEntityRef`. */
|
|
247
|
+
type FlowAddressable = FlowEntityRef;
|
|
205
248
|
/** A flow node: VisualNode + flow attributes */
|
|
206
249
|
type FlowNode<TData = any> = VisualNode$1<TData> & FlowNodeAttributes;
|
|
207
|
-
/**
|
|
250
|
+
/**
|
|
251
|
+
* A flow edge: VisualEdge + flow attributes.
|
|
252
|
+
*
|
|
253
|
+
* `x`/`y`/`width`/`height` are inherited from the graph visual model and
|
|
254
|
+
* reserved for compatibility. Flow renderers route edges from endpoints;
|
|
255
|
+
* positioned edge content belongs on `label`.
|
|
256
|
+
*/
|
|
208
257
|
type FlowEdge<TEdgeData = any, TLabelData = any> = Omit<VisualEdge$1<TEdgeData>, 'label'> & FlowEdgeAttributes<TLabelData>;
|
|
209
258
|
/** A flow graph: VisualGraph with FlowNode/FlowEdge */
|
|
210
|
-
type FlowGraph<TNodeData = any, TEdgeData = any> = Omit<VisualGraphConfig<TNodeData, TEdgeData>, 'nodes' | 'edges'> & {
|
|
259
|
+
type FlowGraph<TNodeData = any, TEdgeData = any, TLabelData = any> = Omit<VisualGraphConfig<TNodeData, TEdgeData>, 'nodes' | 'edges'> & {
|
|
211
260
|
nodes: FlowNode<TNodeData>[];
|
|
212
|
-
edges: FlowEdge<TEdgeData>[];
|
|
261
|
+
edges: FlowEdge<TEdgeData, TLabelData>[];
|
|
213
262
|
};
|
|
214
263
|
/** Direction of the graph layout */
|
|
215
264
|
type EdgeDirection = 'up' | 'down' | 'left' | 'right';
|
|
@@ -218,9 +267,10 @@ type StyleOverrides = {
|
|
|
218
267
|
customWidth?: number;
|
|
219
268
|
customHeight?: number;
|
|
220
269
|
};
|
|
270
|
+
/** @deprecated Use profile mode names (`context.mode`) instead. */
|
|
221
271
|
type InteractionMode = 'default' | 'pan' | 'connect' | 'select';
|
|
222
272
|
type SelectionMode = 'partial' | 'full';
|
|
223
|
-
type CanvasState = 'idle' | 'panning' | 'dragging' | 'connecting' | 'resizing' | 'selecting'
|
|
273
|
+
type CanvasState = 'idle' | 'panning' | 'dragging' | 'connecting' | 'resizing' | 'selecting';
|
|
224
274
|
type ConnectionState = {
|
|
225
275
|
sourceId: string;
|
|
226
276
|
sourcePort: string | null;
|
|
@@ -233,10 +283,24 @@ type ConnectionState = {
|
|
|
233
283
|
pointerPosition: Point;
|
|
234
284
|
/** Thresholded activation state for drag-based connections */
|
|
235
285
|
active: boolean;
|
|
286
|
+
/** Whether adapters should project the generic connection preview. */
|
|
287
|
+
preview?: boolean;
|
|
236
288
|
/** canConnect result for current target */
|
|
237
289
|
isValid: boolean;
|
|
290
|
+
/** Optional reason for the current invalid connection target. */
|
|
291
|
+
invalidReason?: string;
|
|
292
|
+
/** Edge id while reconnecting an existing edge endpoint. */
|
|
293
|
+
reconnectingEdgeId?: string | null;
|
|
294
|
+
/** Which endpoint is being dragged while reconnecting. */
|
|
295
|
+
reconnectingEnd?: 'source' | 'target' | null;
|
|
238
296
|
};
|
|
239
297
|
type ResizeHandle = 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
298
|
+
type ResizeConstraints = {
|
|
299
|
+
min?: Partial<Size>;
|
|
300
|
+
max?: Partial<Size>;
|
|
301
|
+
/** true preserves the node's current aspect ratio; a number uses width / height. */
|
|
302
|
+
aspect?: boolean | number;
|
|
303
|
+
};
|
|
240
304
|
type AutoLayoutState = {
|
|
241
305
|
status: 'idle' | 'pending' | 'running';
|
|
242
306
|
algorithm: string | null;
|
|
@@ -251,13 +315,17 @@ type EntityVisualState = {
|
|
|
251
315
|
disabled: boolean;
|
|
252
316
|
dragging: boolean;
|
|
253
317
|
resizing: boolean;
|
|
254
|
-
editing: boolean;
|
|
255
318
|
};
|
|
256
319
|
type Direction = 'top' | 'bottom' | 'left' | 'right';
|
|
257
320
|
type PathData = {
|
|
258
321
|
points: Point[];
|
|
259
322
|
sourceDirection: Direction;
|
|
260
323
|
targetDirection: Direction;
|
|
324
|
+
/**
|
|
325
|
+
* Optional router-owned SVG `d` override for custom curves or rounded paths.
|
|
326
|
+
* `points` remain required for bounds, endpoints, and interaction geometry.
|
|
327
|
+
*/
|
|
328
|
+
svgPath?: string;
|
|
261
329
|
};
|
|
262
330
|
/** Edge path result from engine — may contain two segments if edge has a label */
|
|
263
331
|
type EdgePathData = {
|
|
@@ -268,49 +336,46 @@ type ShapeHandler = {
|
|
|
268
336
|
hitTest: (point: Point, bounds: Rect) => boolean;
|
|
269
337
|
edgeAnchor: (bounds: Rect, direction: Direction) => Point;
|
|
270
338
|
};
|
|
271
|
-
type EntityColorSet = {
|
|
272
|
-
fill: string;
|
|
273
|
-
stroke: string;
|
|
274
|
-
text: string;
|
|
275
|
-
};
|
|
276
|
-
type EdgeStyleConfig = {
|
|
277
|
-
dashArray?: number[];
|
|
278
|
-
width: number;
|
|
279
|
-
};
|
|
280
|
-
type FlowTheme = {
|
|
281
|
-
colors: {
|
|
282
|
-
entity: Record<string, EntityColorSet>;
|
|
283
|
-
selection: string;
|
|
284
|
-
connection: string;
|
|
285
|
-
connectionValid: string;
|
|
286
|
-
connectionInvalid: string;
|
|
287
|
-
highlight: string;
|
|
288
|
-
focus: string;
|
|
289
|
-
canvas: string;
|
|
290
|
-
grid: string;
|
|
291
|
-
};
|
|
292
|
-
edgeStyles: Record<string, EdgeStyleConfig>;
|
|
293
|
-
spacing: {
|
|
294
|
-
gridSize: number;
|
|
295
|
-
snapSize: number;
|
|
296
|
-
portSize: number;
|
|
297
|
-
selectionPadding: number;
|
|
298
|
-
};
|
|
299
|
-
};
|
|
300
339
|
/** A behavior predicate: function or `false` to disable globally */
|
|
301
340
|
type BehaviorPredicate<TEntity = unknown, TState = unknown> = ((entity: TEntity, flowState: TState) => boolean) | false;
|
|
302
341
|
type FlowConfig<TEntity = unknown, TState = unknown> = {
|
|
342
|
+
/** Entity `selectable` flag wins, then this predicate, then default true. */
|
|
303
343
|
selectable: BehaviorPredicate<TEntity, TState>;
|
|
344
|
+
/** Entity `focusable` flag wins, then this predicate, then default true. */
|
|
345
|
+
focusable: BehaviorPredicate<TEntity, TState>;
|
|
346
|
+
/** Entity `draggable` flag wins, then this predicate, then default true. */
|
|
304
347
|
draggable: BehaviorPredicate<TEntity, TState>;
|
|
348
|
+
/** Entity `connectable` flag wins, then this predicate, then default true. */
|
|
305
349
|
connectable: BehaviorPredicate<TEntity, TState>;
|
|
350
|
+
/** Entity `reconnectable` flag wins, then this predicate, then default true. */
|
|
306
351
|
reconnectable: BehaviorPredicate<TEntity, TState>;
|
|
352
|
+
/** Entity `deletable` flag wins, then this predicate, then default true. */
|
|
307
353
|
deletable: BehaviorPredicate<TEntity, TState>;
|
|
354
|
+
/** Entity `resizable` flag wins, then this predicate, then default false. */
|
|
308
355
|
resizable: BehaviorPredicate<TEntity, TState>;
|
|
356
|
+
/** Entity `hidden` flag wins, then this predicate, then default true. */
|
|
309
357
|
visible: BehaviorPredicate<TEntity, TState>;
|
|
310
358
|
};
|
|
359
|
+
type ViewportSpringOptions = {
|
|
360
|
+
stiffness?: number;
|
|
361
|
+
damping?: number;
|
|
362
|
+
mass?: number;
|
|
363
|
+
};
|
|
311
364
|
type ViewportAnimationOptions = {
|
|
312
365
|
duration?: number;
|
|
313
366
|
easing?: (t: number) => number;
|
|
367
|
+
/**
|
|
368
|
+
* Screen-space point to keep visually fixed during the animation (the focal
|
|
369
|
+
* anchor of the zoom). Defaults to the target viewport's frame of reference,
|
|
370
|
+
* which keeps a fit/zoomTo target centered without swimming.
|
|
371
|
+
*/
|
|
372
|
+
center?: Point;
|
|
373
|
+
/**
|
|
374
|
+
* When set, drive the animation with a spring integrator instead of
|
|
375
|
+
* duration/easing lerp. Runs until settled. Sensible near-critically-damped
|
|
376
|
+
* defaults are used for any omitted field.
|
|
377
|
+
*/
|
|
378
|
+
spring?: ViewportSpringOptions;
|
|
314
379
|
};
|
|
315
380
|
type FitViewOptions = ViewportAnimationOptions & {
|
|
316
381
|
padding?: number;
|
|
@@ -319,33 +384,164 @@ type FitViewOptions = ViewportAnimationOptions & {
|
|
|
319
384
|
nodes?: Array<string | {
|
|
320
385
|
id: string;
|
|
321
386
|
}>;
|
|
387
|
+
/** Screen-space target frame. Defaults to the full viewport. */
|
|
388
|
+
frame?: Rect;
|
|
322
389
|
};
|
|
323
390
|
//#endregion
|
|
391
|
+
//#region src/projections.d.ts
|
|
392
|
+
type GraphDecoration<TDecoration = unknown> = TDecoration | readonly TDecoration[];
|
|
393
|
+
type GraphNodeAttrs<TStyle extends object = object, TDecoration = unknown> = {
|
|
394
|
+
className?: string;
|
|
395
|
+
style?: TStyle;
|
|
396
|
+
color?: string;
|
|
397
|
+
opacity?: number;
|
|
398
|
+
badge?: GraphDecoration<TDecoration>;
|
|
399
|
+
tooltip?: GraphDecoration<TDecoration>;
|
|
400
|
+
};
|
|
401
|
+
type GraphEdgeAttrs<TStyle extends object = object, TDecoration = unknown> = {
|
|
402
|
+
className?: string;
|
|
403
|
+
style?: TStyle;
|
|
404
|
+
color?: string;
|
|
405
|
+
opacity?: number;
|
|
406
|
+
strokeWidth?: number;
|
|
407
|
+
label?: TDecoration;
|
|
408
|
+
badge?: GraphDecoration<TDecoration>;
|
|
409
|
+
tooltip?: GraphDecoration<TDecoration>;
|
|
410
|
+
};
|
|
411
|
+
type GraphProjection<TNodeDatum = unknown, TEdgeDatum = unknown> = {
|
|
412
|
+
id: string;
|
|
413
|
+
label?: string;
|
|
414
|
+
nodes?: Record<string, TNodeDatum>;
|
|
415
|
+
edges?: Record<string, TEdgeDatum>;
|
|
416
|
+
};
|
|
417
|
+
type GraphProjectionMapper<TNodeDatum = unknown, TEdgeDatum = unknown, TStyle extends object = object, TDecoration = unknown> = {
|
|
418
|
+
getNodeAttrs?: (args: {
|
|
419
|
+
node: FlowNode;
|
|
420
|
+
datum: TNodeDatum;
|
|
421
|
+
projection: GraphProjection<TNodeDatum, TEdgeDatum>;
|
|
422
|
+
graph: FlowGraph;
|
|
423
|
+
}) => GraphNodeAttrs<TStyle, TDecoration> | null;
|
|
424
|
+
getEdgeAttrs?: (args: {
|
|
425
|
+
edge: FlowEdge;
|
|
426
|
+
datum: TEdgeDatum;
|
|
427
|
+
projection: GraphProjection<TNodeDatum, TEdgeDatum>;
|
|
428
|
+
graph: FlowGraph;
|
|
429
|
+
}) => GraphEdgeAttrs<TStyle, TDecoration> | null;
|
|
430
|
+
};
|
|
431
|
+
type ActiveGraphProjection<TNodeDatum = unknown, TEdgeDatum = unknown, TStyle extends object = object, TDecoration = unknown> = {
|
|
432
|
+
projection: GraphProjection<TNodeDatum, TEdgeDatum>;
|
|
433
|
+
mapper: GraphProjectionMapper<TNodeDatum, TEdgeDatum, TStyle, TDecoration>;
|
|
434
|
+
priority?: number;
|
|
435
|
+
};
|
|
436
|
+
type ComposedGraphProjectionAttrs<TStyle extends object = object, TDecoration = unknown> = {
|
|
437
|
+
nodes: Map<string, GraphNodeAttrs<TStyle, TDecoration>>;
|
|
438
|
+
edges: Map<string, GraphEdgeAttrs<TStyle, TDecoration>>;
|
|
439
|
+
};
|
|
440
|
+
declare function sortActiveGraphProjections<TStyle extends object = object, TDecoration = unknown>(active: readonly ActiveGraphProjection<any, any, TStyle, TDecoration>[]): ActiveGraphProjection<any, any, TStyle, TDecoration>[];
|
|
441
|
+
declare function mergeGraphNodeAttrs<TStyle extends object = object, TDecoration = unknown>(base: GraphNodeAttrs<TStyle, TDecoration> | undefined, next: GraphNodeAttrs<TStyle, TDecoration> | null | undefined): GraphNodeAttrs<TStyle, TDecoration>;
|
|
442
|
+
declare function mergeGraphEdgeAttrs<TStyle extends object = object, TDecoration = unknown>(base: GraphEdgeAttrs<TStyle, TDecoration> | undefined, next: GraphEdgeAttrs<TStyle, TDecoration> | null | undefined): GraphEdgeAttrs<TStyle, TDecoration>;
|
|
443
|
+
declare function getProjectedNodeAttrs<TStyle extends object = object, TDecoration = unknown>(args: {
|
|
444
|
+
graph: FlowGraph;
|
|
445
|
+
node: FlowNode;
|
|
446
|
+
projections?: readonly ActiveGraphProjection<any, any, TStyle, TDecoration>[];
|
|
447
|
+
}): GraphNodeAttrs<TStyle, TDecoration>;
|
|
448
|
+
declare function getProjectedEdgeAttrs<TStyle extends object = object, TDecoration = unknown>(args: {
|
|
449
|
+
graph: FlowGraph;
|
|
450
|
+
edge: FlowEdge;
|
|
451
|
+
projections?: readonly ActiveGraphProjection<any, any, TStyle, TDecoration>[];
|
|
452
|
+
}): GraphEdgeAttrs<TStyle, TDecoration>;
|
|
453
|
+
declare function composeGraphProjectionAttrs<TStyle extends object = object, TDecoration = unknown>(args: {
|
|
454
|
+
graph: FlowGraph;
|
|
455
|
+
projections?: readonly ActiveGraphProjection<any, any, TStyle, TDecoration>[];
|
|
456
|
+
}): ComposedGraphProjectionAttrs<TStyle, TDecoration>;
|
|
457
|
+
//#endregion
|
|
458
|
+
//#region src/view.d.ts
|
|
459
|
+
type FlowViewScope = Readonly<{
|
|
460
|
+
/** Null addresses the graph's virtual root. */
|
|
461
|
+
parentId: string | null;
|
|
462
|
+
/** Descendant levels to expose. Zero is empty; null is unlimited. */
|
|
463
|
+
depth: number | null;
|
|
464
|
+
}>;
|
|
465
|
+
type FlowViewSelectionPolicy = 'prune' | 'clear';
|
|
466
|
+
type FlowViewEndpoint = Readonly<{
|
|
467
|
+
originalId: string;
|
|
468
|
+
viewId: string;
|
|
469
|
+
boundary: boolean;
|
|
470
|
+
}>;
|
|
471
|
+
type FlowViewBoundaryEndpoints = Readonly<{
|
|
472
|
+
edgeId: string;
|
|
473
|
+
source: FlowViewEndpoint;
|
|
474
|
+
target: FlowViewEndpoint;
|
|
475
|
+
}>;
|
|
476
|
+
type FlowViewEntities<TNodeData = any, TEdgeData = any, TLabelData = any> = Readonly<{
|
|
477
|
+
nodes: readonly FlowGraph<TNodeData, TEdgeData, TLabelData>['nodes'][number][];
|
|
478
|
+
edges: readonly FlowGraph<TNodeData, TEdgeData, TLabelData>['edges'][number][];
|
|
479
|
+
boundaryEndpoints: readonly FlowViewBoundaryEndpoints[];
|
|
480
|
+
}>;
|
|
481
|
+
type DeriveFlowViewOptions<TNodeData, TEdgeData, TLabelData> = {
|
|
482
|
+
nodes?: readonly FlowGraph<TNodeData, TEdgeData, TLabelData>['nodes'][number][];
|
|
483
|
+
edges?: readonly FlowGraph<TNodeData, TEdgeData, TLabelData>['edges'][number][];
|
|
484
|
+
edgeOwner?: (edge: FlowGraph<TNodeData, TEdgeData, TLabelData>['edges'][number]) => string | null;
|
|
485
|
+
};
|
|
486
|
+
/** Derive a structural view without mutating the canonical graph. */
|
|
487
|
+
declare function deriveFlowView<TNodeData = any, TEdgeData = any, TLabelData = any>(graph: FlowGraph<TNodeData, TEdgeData, TLabelData>, scope: FlowViewScope, options?: DeriveFlowViewOptions<TNodeData, TEdgeData, TLabelData>): FlowViewEntities<TNodeData, TEdgeData, TLabelData>;
|
|
488
|
+
//#endregion
|
|
489
|
+
//#region src/routing/avoid.d.ts
|
|
490
|
+
type AvoidRouterOptions = {
|
|
491
|
+
margin?: number;
|
|
492
|
+
maxGridLines?: number;
|
|
493
|
+
};
|
|
494
|
+
declare const avoidRouter: EdgeRouter;
|
|
495
|
+
declare function configureAvoidRouter(options?: AvoidRouterOptions): EdgeRouter;
|
|
496
|
+
//#endregion
|
|
324
497
|
//#region src/routing/index.d.ts
|
|
325
|
-
type
|
|
498
|
+
type EdgeRouterGraph<TNodeData = any, TEdgeData = any, TLabelData = any> = Omit<FlowGraph<TNodeData, TEdgeData, TLabelData>, 'nodes' | 'edges'> & {
|
|
499
|
+
readonly nodes: readonly FlowNode<TNodeData>[];
|
|
500
|
+
readonly edges: readonly FlowEdge<TEdgeData, TLabelData>[];
|
|
501
|
+
};
|
|
502
|
+
type EdgeRouterContext<TEdgeData = any, TLabelData = any, TNodeData = any> = {
|
|
503
|
+
/** Exact canonical or caller-provided projection graph currently being routed. */
|
|
504
|
+
graph: EdgeRouterGraph<TNodeData, TEdgeData, TLabelData>;
|
|
505
|
+
/**
|
|
506
|
+
* Current visual bounds for a node or positioned edge label in `graph`.
|
|
507
|
+
* Results are detached read-only values; looking up an edge never routes it.
|
|
508
|
+
*/
|
|
509
|
+
getEntityBounds: (id: string) => Readonly<Rect> | undefined;
|
|
326
510
|
sourceBounds: Rect;
|
|
327
511
|
targetBounds: Rect;
|
|
328
512
|
sourceDirection: Direction;
|
|
329
513
|
targetDirection: Direction;
|
|
330
514
|
sourcePoint?: Point;
|
|
331
515
|
targetPoint?: Point;
|
|
332
|
-
|
|
516
|
+
waypoints?: readonly Point[];
|
|
517
|
+
/**
|
|
518
|
+
* Sibling node bounds that custom routers can use for obstacle avoidance.
|
|
519
|
+
*
|
|
520
|
+
* @experimental Population rules may change as built-in obstacle routing lands.
|
|
521
|
+
*/
|
|
333
522
|
obstacles: Rect[];
|
|
334
523
|
};
|
|
335
|
-
type EdgeRouter = (edge:
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
524
|
+
type EdgeRouter<TEdgeData = any, TLabelData = any, TNodeData = any> = (edge: Readonly<FlowEdge<TEdgeData, TLabelData>>, context: EdgeRouterContext<TEdgeData, TLabelData, TNodeData>) => PathData;
|
|
525
|
+
type BezierRouterOptions = {
|
|
526
|
+
curvature?: number;
|
|
527
|
+
minOffset?: number;
|
|
528
|
+
};
|
|
529
|
+
type StepRouterOptions = {
|
|
530
|
+
offset?: number;
|
|
531
|
+
};
|
|
339
532
|
declare const straightRouter: EdgeRouter;
|
|
340
533
|
declare const stepRouter: EdgeRouter;
|
|
341
534
|
declare const bezierRouter: EdgeRouter;
|
|
535
|
+
declare function configureBezierRouter(options?: BezierRouterOptions): EdgeRouter;
|
|
536
|
+
declare function configureStepRouter(options?: StepRouterOptions): EdgeRouter;
|
|
342
537
|
/**
|
|
343
|
-
* Determine the
|
|
344
|
-
*
|
|
538
|
+
* Determine the side of `from` that faces `to`, based on relative centers.
|
|
539
|
+
* The returned direction is from the perspective of `from`.
|
|
345
540
|
*/
|
|
346
541
|
declare function bestDirection(from: Rect, to: Rect): Direction;
|
|
347
542
|
/**
|
|
348
|
-
* Convert PathData
|
|
543
|
+
* Convert PathData to an SVG path `d` attribute. A valid router-provided
|
|
544
|
+
* `svgPath` takes precedence over point-derived geometry.
|
|
349
545
|
* Handles 2 points (line), 3 points (quadratic), 4 points (cubic bezier).
|
|
350
546
|
*/
|
|
351
547
|
declare function pathToSVG(path: PathData): string;
|
|
@@ -387,10 +583,7 @@ interface SnapOptions {
|
|
|
387
583
|
*
|
|
388
584
|
* Returns null if no snap is within threshold.
|
|
389
585
|
*/
|
|
390
|
-
declare function getSnapLines(rect: Rect, otherRects: Rect[], {
|
|
391
|
-
threshold,
|
|
392
|
-
enableSpacing
|
|
393
|
-
}?: SnapOptions): SnapResult | null;
|
|
586
|
+
declare function getSnapLines(rect: Rect, otherRects: Rect[], { threshold, enableSpacing }?: SnapOptions): SnapResult | null;
|
|
394
587
|
//#endregion
|
|
395
588
|
//#region src/engine.d.ts
|
|
396
589
|
type ProposedConnection = {
|
|
@@ -399,13 +592,61 @@ type ProposedConnection = {
|
|
|
399
592
|
sourcePort?: string | null;
|
|
400
593
|
targetPort?: string | null;
|
|
401
594
|
};
|
|
595
|
+
type FlowConnectionMode = 'strict' | 'loose';
|
|
596
|
+
type FlowConnectionOptions = {
|
|
597
|
+
/** Magnet radius in canvas pixels. Default 24. */
|
|
598
|
+
radius?: number;
|
|
599
|
+
/**
|
|
600
|
+
* In strict mode only ports can be connection targets. Loose mode, the
|
|
601
|
+
* default/current behavior, falls back to node body targets.
|
|
602
|
+
*/
|
|
603
|
+
mode?: FlowConnectionMode;
|
|
604
|
+
};
|
|
605
|
+
type ConnectionCandidateSource = {
|
|
606
|
+
nodeId: string;
|
|
607
|
+
port: string | null;
|
|
608
|
+
};
|
|
609
|
+
type ConnectionCandidate = {
|
|
610
|
+
nodeId: string;
|
|
611
|
+
portName: string | null;
|
|
612
|
+
position: Point;
|
|
613
|
+
isValid: boolean;
|
|
614
|
+
};
|
|
615
|
+
type ConnectionCandidateOptions = FlowConnectionOptions & {
|
|
616
|
+
source?: ConnectionCandidateSource;
|
|
617
|
+
};
|
|
618
|
+
type ConnectionValidationContext = {
|
|
619
|
+
graph: FlowStoreContext['graph'];
|
|
620
|
+
context: FlowStoreContext;
|
|
621
|
+
source: FlowNode;
|
|
622
|
+
target: FlowNode;
|
|
623
|
+
sourcePort: VisualPort | null;
|
|
624
|
+
targetPort: VisualPort | null;
|
|
625
|
+
connection: FlowStoreContext['connection'];
|
|
626
|
+
};
|
|
627
|
+
type ConnectionValidationResult = boolean | {
|
|
628
|
+
valid: boolean;
|
|
629
|
+
reason?: string;
|
|
630
|
+
};
|
|
402
631
|
type FlowEngineOptions = {
|
|
403
632
|
/** Default edge router (default: bezierRouter) */
|
|
404
633
|
edgeRouter?: EdgeRouter;
|
|
405
634
|
/** Default label anchor (default: 'fixed' — labels use their own x/y) */
|
|
406
635
|
labelAnchor?: LabelAnchor;
|
|
636
|
+
/**
|
|
637
|
+
* Override the rect an edge routes from while preserving its graph source.
|
|
638
|
+
* Return null/undefined to keep the normal source node/port bounds.
|
|
639
|
+
*/
|
|
640
|
+
resolveEdgeSourceBounds?: (context: EdgeSourceBoundsContext) => Rect | null | undefined;
|
|
407
641
|
/** Connection validation hook */
|
|
408
|
-
canConnect?: (proposed: ProposedConnection) =>
|
|
642
|
+
canConnect?: (proposed: ProposedConnection, context: ConnectionValidationContext) => ConnectionValidationResult;
|
|
643
|
+
/** Connection magnet radius and port-strict/loose targeting behavior. */
|
|
644
|
+
connection?: FlowConnectionOptions;
|
|
645
|
+
/** Elevate selected entities above same-depth/same-zIndex siblings. */
|
|
646
|
+
elevateOnSelect?: {
|
|
647
|
+
nodes?: boolean;
|
|
648
|
+
edges?: boolean;
|
|
649
|
+
};
|
|
409
650
|
/** Global behavior config */
|
|
410
651
|
config?: Partial<FlowConfig>;
|
|
411
652
|
/** Custom visibility function */
|
|
@@ -419,6 +660,16 @@ type FlowEngineOptions = {
|
|
|
419
660
|
*/
|
|
420
661
|
edgeOwner?: (edge: FlowEdge, context: FlowStoreContext) => string | null | undefined;
|
|
421
662
|
};
|
|
663
|
+
type EdgeSourceBoundsContext = {
|
|
664
|
+
edge: FlowEdge;
|
|
665
|
+
graph: FlowStoreContext['graph'];
|
|
666
|
+
context: FlowStoreContext;
|
|
667
|
+
source: FlowNode;
|
|
668
|
+
target: FlowNode;
|
|
669
|
+
sourceBounds: Rect;
|
|
670
|
+
targetBounds: Rect;
|
|
671
|
+
getEdgeLabelBounds: (edgeId: string) => Rect | null;
|
|
672
|
+
};
|
|
422
673
|
type RenderableEntitiesOptions = {
|
|
423
674
|
cull?: 'none' | 'viewport';
|
|
424
675
|
overscan?: number;
|
|
@@ -426,62 +677,121 @@ type RenderableEntitiesOptions = {
|
|
|
426
677
|
type EdgePathOptions = {
|
|
427
678
|
graph?: FlowStoreContext['graph'];
|
|
428
679
|
};
|
|
429
|
-
declare function createFlowEngine(store: FlowStore,
|
|
430
|
-
store:
|
|
680
|
+
declare function createFlowEngine(store: FlowStore, initialOptions?: FlowEngineOptions): {
|
|
681
|
+
store: import("@xstate/store").Store<FlowStoreContext, {
|
|
431
682
|
createNode: {
|
|
432
683
|
node: FlowNode;
|
|
433
684
|
} & {
|
|
434
685
|
transactionId?: string;
|
|
686
|
+
origin?: string;
|
|
435
687
|
};
|
|
436
688
|
deleteNode: {
|
|
437
689
|
id: string;
|
|
438
690
|
} & {
|
|
439
691
|
transactionId?: string;
|
|
692
|
+
origin?: string;
|
|
440
693
|
};
|
|
694
|
+
updateNode: FlowUpdateNodeEvent;
|
|
441
695
|
updateNodeData: {
|
|
442
696
|
id: string;
|
|
443
697
|
data: Record<string, unknown>;
|
|
444
698
|
} & {
|
|
445
699
|
transactionId?: string;
|
|
700
|
+
origin?: string;
|
|
446
701
|
};
|
|
447
702
|
createEdge: {
|
|
448
703
|
edge: FlowEdge;
|
|
449
704
|
} & {
|
|
450
705
|
transactionId?: string;
|
|
706
|
+
origin?: string;
|
|
451
707
|
};
|
|
452
708
|
deleteEdge: {
|
|
453
709
|
id: string;
|
|
454
710
|
} & {
|
|
455
711
|
transactionId?: string;
|
|
712
|
+
origin?: string;
|
|
713
|
+
};
|
|
714
|
+
deleteEntities: {
|
|
715
|
+
nodeIds?: string[];
|
|
716
|
+
edgeIds?: string[];
|
|
717
|
+
} & {
|
|
718
|
+
transactionId?: string;
|
|
719
|
+
origin?: string;
|
|
456
720
|
};
|
|
721
|
+
updateEdge: FlowUpdateEdgeEvent;
|
|
457
722
|
updateEdgeData: {
|
|
458
723
|
id: string;
|
|
459
724
|
data: Record<string, unknown>;
|
|
460
725
|
} & {
|
|
461
726
|
transactionId?: string;
|
|
727
|
+
origin?: string;
|
|
462
728
|
};
|
|
463
729
|
deleteSelected: undefined;
|
|
464
730
|
setGraph: {
|
|
465
731
|
graph: FlowGraph;
|
|
466
732
|
};
|
|
733
|
+
replaceGraph: {
|
|
734
|
+
graph: FlowGraph;
|
|
735
|
+
graphChanged?: boolean;
|
|
736
|
+
layoutAnimationOffsets?: Map<string, Point>;
|
|
737
|
+
} & ({
|
|
738
|
+
transactionId?: string;
|
|
739
|
+
origin?: string;
|
|
740
|
+
} & {
|
|
741
|
+
retention?: FlowGraphRetentionPolicy;
|
|
742
|
+
history?: FlowGraphHistoryPolicy;
|
|
743
|
+
});
|
|
744
|
+
setLayoutAnimationOffsets: {
|
|
745
|
+
offsets: Map<string, Point>;
|
|
746
|
+
};
|
|
747
|
+
clearLayoutAnimation: undefined;
|
|
748
|
+
loadDocument: {
|
|
749
|
+
graph: FlowGraph;
|
|
750
|
+
collapsedNodeIds: string[];
|
|
751
|
+
viewport: Viewport;
|
|
752
|
+
} & {
|
|
753
|
+
transactionId?: string;
|
|
754
|
+
origin?: string;
|
|
755
|
+
};
|
|
756
|
+
setCollapsedNodes: {
|
|
757
|
+
ids: string[];
|
|
758
|
+
};
|
|
467
759
|
reset: undefined;
|
|
468
760
|
reparentNode: {
|
|
469
761
|
id: string;
|
|
470
762
|
parentId: string | null;
|
|
471
763
|
} & {
|
|
472
764
|
transactionId?: string;
|
|
765
|
+
origin?: string;
|
|
766
|
+
};
|
|
767
|
+
collapseNode: {
|
|
768
|
+
id: string;
|
|
769
|
+
} & {
|
|
770
|
+
transactionId?: string;
|
|
771
|
+
origin?: string;
|
|
772
|
+
};
|
|
773
|
+
expandNode: {
|
|
774
|
+
id: string;
|
|
775
|
+
} & {
|
|
776
|
+
transactionId?: string;
|
|
777
|
+
origin?: string;
|
|
473
778
|
};
|
|
474
779
|
dragStart: {
|
|
475
780
|
id: string;
|
|
476
781
|
} & {
|
|
477
782
|
transactionId?: string;
|
|
783
|
+
origin?: string;
|
|
478
784
|
};
|
|
479
785
|
dragMove: {
|
|
480
786
|
dx: number;
|
|
481
787
|
dy: number;
|
|
482
788
|
};
|
|
483
789
|
dragEnd: undefined;
|
|
484
|
-
|
|
790
|
+
dragCancel: undefined;
|
|
791
|
+
commitDrag: {
|
|
792
|
+
transactionId?: string;
|
|
793
|
+
origin?: string;
|
|
794
|
+
} | undefined;
|
|
485
795
|
select: {
|
|
486
796
|
ids: string[];
|
|
487
797
|
mode?: "single" | "multi";
|
|
@@ -496,6 +806,7 @@ declare function createFlowEngine(store: FlowStore, options?: FlowEngineOptions)
|
|
|
496
806
|
point: Point;
|
|
497
807
|
};
|
|
498
808
|
selectionBoxEnd: undefined;
|
|
809
|
+
selectionBoxCancel: undefined;
|
|
499
810
|
focus: {
|
|
500
811
|
entityId: string;
|
|
501
812
|
};
|
|
@@ -522,7 +833,16 @@ declare function createFlowEngine(store: FlowStore, options?: FlowEngineOptions)
|
|
|
522
833
|
updateParentNodeId: {
|
|
523
834
|
parentNodeId: string | null;
|
|
524
835
|
};
|
|
836
|
+
setViewScope: {
|
|
837
|
+
parentNodeId: string | null;
|
|
838
|
+
depth: number | null;
|
|
839
|
+
selection: FlowViewSelectionPolicy;
|
|
840
|
+
visibleEntityIds: string[];
|
|
841
|
+
};
|
|
525
842
|
setViewport: Viewport;
|
|
843
|
+
setFitFrame: {
|
|
844
|
+
frame: Rect | null;
|
|
845
|
+
};
|
|
526
846
|
panBy: Point;
|
|
527
847
|
zoomTo: {
|
|
528
848
|
zoom: number;
|
|
@@ -546,6 +866,9 @@ declare function createFlowEngine(store: FlowStore, options?: FlowEngineOptions)
|
|
|
546
866
|
autoPanThreshold?: number;
|
|
547
867
|
autoPanSpeed?: number;
|
|
548
868
|
};
|
|
869
|
+
updateSettings: Partial<FlowRuntimeSettings>;
|
|
870
|
+
configure: Partial<FlowStoreOptions>;
|
|
871
|
+
bumpConfigRevision: undefined;
|
|
549
872
|
setTranslateExtent: {
|
|
550
873
|
extent: [Point, Point] | null;
|
|
551
874
|
};
|
|
@@ -559,6 +882,7 @@ declare function createFlowEngine(store: FlowStore, options?: FlowEngineOptions)
|
|
|
559
882
|
panStart: Point;
|
|
560
883
|
pan: Point;
|
|
561
884
|
panEnd: undefined;
|
|
885
|
+
panCancel: undefined;
|
|
562
886
|
setCanvasState: {
|
|
563
887
|
state: CanvasState;
|
|
564
888
|
};
|
|
@@ -566,15 +890,22 @@ declare function createFlowEngine(store: FlowStore, options?: FlowEngineOptions)
|
|
|
566
890
|
sourceId: string;
|
|
567
891
|
sourcePort: string | null;
|
|
568
892
|
position: Point;
|
|
893
|
+
active?: boolean;
|
|
894
|
+
reconnectingEdgeId?: string | null;
|
|
895
|
+
reconnectingEnd?: "source" | "target" | null;
|
|
896
|
+
preview?: boolean;
|
|
569
897
|
};
|
|
570
898
|
connectionMove: {
|
|
571
899
|
position: Point;
|
|
572
900
|
targetId?: string | null;
|
|
573
901
|
targetPort?: string | null;
|
|
574
902
|
isValid?: boolean;
|
|
903
|
+
invalidReason?: string;
|
|
904
|
+
active?: boolean;
|
|
575
905
|
};
|
|
576
906
|
connectionEnd: {
|
|
577
907
|
target?: ConnectEndTarget;
|
|
908
|
+
reconnectedEdgeId?: string;
|
|
578
909
|
} | undefined;
|
|
579
910
|
cancelConnection: undefined;
|
|
580
911
|
setConnectionClickStartHandle: {
|
|
@@ -586,18 +917,25 @@ declare function createFlowEngine(store: FlowStore, options?: FlowEngineOptions)
|
|
|
586
917
|
handle: ResizeHandle;
|
|
587
918
|
} & {
|
|
588
919
|
transactionId?: string;
|
|
920
|
+
origin?: string;
|
|
589
921
|
};
|
|
590
922
|
resizeMove: Point;
|
|
591
923
|
resizeEnd: undefined;
|
|
592
924
|
resizeCancel: undefined;
|
|
925
|
+
paneClicked: FlowPaneGestureEvent;
|
|
926
|
+
paneContextMenu: FlowPaneGestureEvent;
|
|
927
|
+
entityClicked: FlowEntityGestureEvent;
|
|
928
|
+
entityDoubleClicked: FlowEntityGestureEvent;
|
|
929
|
+
entityContextMenu: FlowEntityGestureEvent;
|
|
593
930
|
reconnectEdge: {
|
|
594
931
|
edgeId: string;
|
|
595
932
|
newSourceId?: string;
|
|
596
933
|
newTargetId?: string;
|
|
597
|
-
newSourcePort?: string;
|
|
598
|
-
newTargetPort?: string;
|
|
934
|
+
newSourcePort?: string | null;
|
|
935
|
+
newTargetPort?: string | null;
|
|
599
936
|
} & {
|
|
600
937
|
transactionId?: string;
|
|
938
|
+
origin?: string;
|
|
601
939
|
};
|
|
602
940
|
setMode: {
|
|
603
941
|
mode: string;
|
|
@@ -619,6 +957,7 @@ declare function createFlowEngine(store: FlowStore, options?: FlowEngineOptions)
|
|
|
619
957
|
factor?: number;
|
|
620
958
|
} & {
|
|
621
959
|
transactionId?: string;
|
|
960
|
+
origin?: string;
|
|
622
961
|
};
|
|
623
962
|
requestLayout: {
|
|
624
963
|
algorithm?: string;
|
|
@@ -634,6 +973,7 @@ declare function createFlowEngine(store: FlowStore, options?: FlowEngineOptions)
|
|
|
634
973
|
}>;
|
|
635
974
|
} & {
|
|
636
975
|
transactionId?: string;
|
|
976
|
+
origin?: string;
|
|
637
977
|
};
|
|
638
978
|
updateMeasurements: {
|
|
639
979
|
measurements: Array<{
|
|
@@ -648,74 +988,148 @@ declare function createFlowEngine(store: FlowStore, options?: FlowEngineOptions)
|
|
|
648
988
|
positions: Map<string, Point>;
|
|
649
989
|
} & {
|
|
650
990
|
transactionId?: string;
|
|
991
|
+
origin?: string;
|
|
651
992
|
};
|
|
993
|
+
reportError: FlowErrorEvent;
|
|
652
994
|
} & {
|
|
653
995
|
undo: null;
|
|
654
996
|
redo: null;
|
|
655
|
-
},
|
|
997
|
+
} & Record<never, never>, import("@xstate/store").ExtractEvents<{
|
|
656
998
|
layoutRequested: LayoutRequestedEvent;
|
|
657
999
|
connectionEnded: ConnectionEndedEvent;
|
|
658
1000
|
graphChanged: FlowGraphChangedEvent;
|
|
659
1001
|
viewportChanged: FlowViewportChangedEvent;
|
|
660
1002
|
selectionChanged: FlowSelectionChangedEvent;
|
|
1003
|
+
viewChanged: FlowViewChangedEvent;
|
|
661
1004
|
entitiesDeleted: FlowEntitiesDeletedEvent;
|
|
1005
|
+
dragStarted: FlowDragStartedEvent;
|
|
1006
|
+
dragMoved: FlowDragMovedEvent;
|
|
1007
|
+
dragEnded: FlowDragEndedEvent;
|
|
1008
|
+
resizeStarted: FlowResizeStartedEvent;
|
|
1009
|
+
resizeEnded: FlowResizeEndedEvent;
|
|
1010
|
+
connectStarted: FlowConnectStartedEvent;
|
|
1011
|
+
connectMoved: FlowConnectMovedEvent;
|
|
1012
|
+
paneClicked: FlowPaneGestureEvent;
|
|
1013
|
+
paneContextMenu: FlowPaneGestureEvent;
|
|
1014
|
+
entityClicked: FlowEntityGestureEvent;
|
|
1015
|
+
entityDoubleClicked: FlowEntityGestureEvent;
|
|
1016
|
+
entityContextMenu: FlowEntityGestureEvent;
|
|
662
1017
|
error: FlowErrorEvent;
|
|
663
1018
|
}>>;
|
|
664
|
-
trigger:
|
|
1019
|
+
trigger: import("@xstate/store").TriggerObject<{
|
|
665
1020
|
createNode: {
|
|
666
1021
|
node: FlowNode;
|
|
667
1022
|
} & {
|
|
668
1023
|
transactionId?: string;
|
|
1024
|
+
origin?: string;
|
|
669
1025
|
};
|
|
670
1026
|
deleteNode: {
|
|
671
1027
|
id: string;
|
|
672
1028
|
} & {
|
|
673
1029
|
transactionId?: string;
|
|
1030
|
+
origin?: string;
|
|
674
1031
|
};
|
|
1032
|
+
updateNode: FlowUpdateNodeEvent;
|
|
675
1033
|
updateNodeData: {
|
|
676
1034
|
id: string;
|
|
677
1035
|
data: Record<string, unknown>;
|
|
678
1036
|
} & {
|
|
679
1037
|
transactionId?: string;
|
|
1038
|
+
origin?: string;
|
|
680
1039
|
};
|
|
681
1040
|
createEdge: {
|
|
682
1041
|
edge: FlowEdge;
|
|
683
1042
|
} & {
|
|
684
1043
|
transactionId?: string;
|
|
1044
|
+
origin?: string;
|
|
685
1045
|
};
|
|
686
1046
|
deleteEdge: {
|
|
687
1047
|
id: string;
|
|
688
1048
|
} & {
|
|
689
1049
|
transactionId?: string;
|
|
1050
|
+
origin?: string;
|
|
690
1051
|
};
|
|
1052
|
+
deleteEntities: {
|
|
1053
|
+
nodeIds?: string[];
|
|
1054
|
+
edgeIds?: string[];
|
|
1055
|
+
} & {
|
|
1056
|
+
transactionId?: string;
|
|
1057
|
+
origin?: string;
|
|
1058
|
+
};
|
|
1059
|
+
updateEdge: FlowUpdateEdgeEvent;
|
|
691
1060
|
updateEdgeData: {
|
|
692
1061
|
id: string;
|
|
693
1062
|
data: Record<string, unknown>;
|
|
694
1063
|
} & {
|
|
695
1064
|
transactionId?: string;
|
|
1065
|
+
origin?: string;
|
|
696
1066
|
};
|
|
697
1067
|
deleteSelected: undefined;
|
|
698
1068
|
setGraph: {
|
|
699
1069
|
graph: FlowGraph;
|
|
700
1070
|
};
|
|
1071
|
+
replaceGraph: {
|
|
1072
|
+
graph: FlowGraph;
|
|
1073
|
+
graphChanged?: boolean;
|
|
1074
|
+
layoutAnimationOffsets?: Map<string, Point>;
|
|
1075
|
+
} & ({
|
|
1076
|
+
transactionId?: string;
|
|
1077
|
+
origin?: string;
|
|
1078
|
+
} & {
|
|
1079
|
+
retention?: FlowGraphRetentionPolicy;
|
|
1080
|
+
history?: FlowGraphHistoryPolicy;
|
|
1081
|
+
});
|
|
1082
|
+
setLayoutAnimationOffsets: {
|
|
1083
|
+
offsets: Map<string, Point>;
|
|
1084
|
+
};
|
|
1085
|
+
clearLayoutAnimation: undefined;
|
|
1086
|
+
loadDocument: {
|
|
1087
|
+
graph: FlowGraph;
|
|
1088
|
+
collapsedNodeIds: string[];
|
|
1089
|
+
viewport: Viewport;
|
|
1090
|
+
} & {
|
|
1091
|
+
transactionId?: string;
|
|
1092
|
+
origin?: string;
|
|
1093
|
+
};
|
|
1094
|
+
setCollapsedNodes: {
|
|
1095
|
+
ids: string[];
|
|
1096
|
+
};
|
|
701
1097
|
reset: undefined;
|
|
702
1098
|
reparentNode: {
|
|
703
1099
|
id: string;
|
|
704
1100
|
parentId: string | null;
|
|
705
1101
|
} & {
|
|
706
1102
|
transactionId?: string;
|
|
1103
|
+
origin?: string;
|
|
1104
|
+
};
|
|
1105
|
+
collapseNode: {
|
|
1106
|
+
id: string;
|
|
1107
|
+
} & {
|
|
1108
|
+
transactionId?: string;
|
|
1109
|
+
origin?: string;
|
|
1110
|
+
};
|
|
1111
|
+
expandNode: {
|
|
1112
|
+
id: string;
|
|
1113
|
+
} & {
|
|
1114
|
+
transactionId?: string;
|
|
1115
|
+
origin?: string;
|
|
707
1116
|
};
|
|
708
1117
|
dragStart: {
|
|
709
1118
|
id: string;
|
|
710
1119
|
} & {
|
|
711
1120
|
transactionId?: string;
|
|
1121
|
+
origin?: string;
|
|
712
1122
|
};
|
|
713
1123
|
dragMove: {
|
|
714
1124
|
dx: number;
|
|
715
1125
|
dy: number;
|
|
716
1126
|
};
|
|
717
1127
|
dragEnd: undefined;
|
|
718
|
-
|
|
1128
|
+
dragCancel: undefined;
|
|
1129
|
+
commitDrag: {
|
|
1130
|
+
transactionId?: string;
|
|
1131
|
+
origin?: string;
|
|
1132
|
+
} | undefined;
|
|
719
1133
|
select: {
|
|
720
1134
|
ids: string[];
|
|
721
1135
|
mode?: "single" | "multi";
|
|
@@ -730,6 +1144,7 @@ declare function createFlowEngine(store: FlowStore, options?: FlowEngineOptions)
|
|
|
730
1144
|
point: Point;
|
|
731
1145
|
};
|
|
732
1146
|
selectionBoxEnd: undefined;
|
|
1147
|
+
selectionBoxCancel: undefined;
|
|
733
1148
|
focus: {
|
|
734
1149
|
entityId: string;
|
|
735
1150
|
};
|
|
@@ -756,7 +1171,16 @@ declare function createFlowEngine(store: FlowStore, options?: FlowEngineOptions)
|
|
|
756
1171
|
updateParentNodeId: {
|
|
757
1172
|
parentNodeId: string | null;
|
|
758
1173
|
};
|
|
1174
|
+
setViewScope: {
|
|
1175
|
+
parentNodeId: string | null;
|
|
1176
|
+
depth: number | null;
|
|
1177
|
+
selection: FlowViewSelectionPolicy;
|
|
1178
|
+
visibleEntityIds: string[];
|
|
1179
|
+
};
|
|
759
1180
|
setViewport: Viewport;
|
|
1181
|
+
setFitFrame: {
|
|
1182
|
+
frame: Rect | null;
|
|
1183
|
+
};
|
|
760
1184
|
panBy: Point;
|
|
761
1185
|
zoomTo: {
|
|
762
1186
|
zoom: number;
|
|
@@ -780,6 +1204,9 @@ declare function createFlowEngine(store: FlowStore, options?: FlowEngineOptions)
|
|
|
780
1204
|
autoPanThreshold?: number;
|
|
781
1205
|
autoPanSpeed?: number;
|
|
782
1206
|
};
|
|
1207
|
+
updateSettings: Partial<FlowRuntimeSettings>;
|
|
1208
|
+
configure: Partial<FlowStoreOptions>;
|
|
1209
|
+
bumpConfigRevision: undefined;
|
|
783
1210
|
setTranslateExtent: {
|
|
784
1211
|
extent: [Point, Point] | null;
|
|
785
1212
|
};
|
|
@@ -793,6 +1220,7 @@ declare function createFlowEngine(store: FlowStore, options?: FlowEngineOptions)
|
|
|
793
1220
|
panStart: Point;
|
|
794
1221
|
pan: Point;
|
|
795
1222
|
panEnd: undefined;
|
|
1223
|
+
panCancel: undefined;
|
|
796
1224
|
setCanvasState: {
|
|
797
1225
|
state: CanvasState;
|
|
798
1226
|
};
|
|
@@ -800,15 +1228,22 @@ declare function createFlowEngine(store: FlowStore, options?: FlowEngineOptions)
|
|
|
800
1228
|
sourceId: string;
|
|
801
1229
|
sourcePort: string | null;
|
|
802
1230
|
position: Point;
|
|
1231
|
+
active?: boolean;
|
|
1232
|
+
reconnectingEdgeId?: string | null;
|
|
1233
|
+
reconnectingEnd?: "source" | "target" | null;
|
|
1234
|
+
preview?: boolean;
|
|
803
1235
|
};
|
|
804
1236
|
connectionMove: {
|
|
805
1237
|
position: Point;
|
|
806
1238
|
targetId?: string | null;
|
|
807
1239
|
targetPort?: string | null;
|
|
808
1240
|
isValid?: boolean;
|
|
1241
|
+
invalidReason?: string;
|
|
1242
|
+
active?: boolean;
|
|
809
1243
|
};
|
|
810
1244
|
connectionEnd: {
|
|
811
1245
|
target?: ConnectEndTarget;
|
|
1246
|
+
reconnectedEdgeId?: string;
|
|
812
1247
|
} | undefined;
|
|
813
1248
|
cancelConnection: undefined;
|
|
814
1249
|
setConnectionClickStartHandle: {
|
|
@@ -820,18 +1255,25 @@ declare function createFlowEngine(store: FlowStore, options?: FlowEngineOptions)
|
|
|
820
1255
|
handle: ResizeHandle;
|
|
821
1256
|
} & {
|
|
822
1257
|
transactionId?: string;
|
|
1258
|
+
origin?: string;
|
|
823
1259
|
};
|
|
824
1260
|
resizeMove: Point;
|
|
825
1261
|
resizeEnd: undefined;
|
|
826
1262
|
resizeCancel: undefined;
|
|
1263
|
+
paneClicked: FlowPaneGestureEvent;
|
|
1264
|
+
paneContextMenu: FlowPaneGestureEvent;
|
|
1265
|
+
entityClicked: FlowEntityGestureEvent;
|
|
1266
|
+
entityDoubleClicked: FlowEntityGestureEvent;
|
|
1267
|
+
entityContextMenu: FlowEntityGestureEvent;
|
|
827
1268
|
reconnectEdge: {
|
|
828
1269
|
edgeId: string;
|
|
829
1270
|
newSourceId?: string;
|
|
830
1271
|
newTargetId?: string;
|
|
831
|
-
newSourcePort?: string;
|
|
832
|
-
newTargetPort?: string;
|
|
1272
|
+
newSourcePort?: string | null;
|
|
1273
|
+
newTargetPort?: string | null;
|
|
833
1274
|
} & {
|
|
834
1275
|
transactionId?: string;
|
|
1276
|
+
origin?: string;
|
|
835
1277
|
};
|
|
836
1278
|
setMode: {
|
|
837
1279
|
mode: string;
|
|
@@ -853,6 +1295,7 @@ declare function createFlowEngine(store: FlowStore, options?: FlowEngineOptions)
|
|
|
853
1295
|
factor?: number;
|
|
854
1296
|
} & {
|
|
855
1297
|
transactionId?: string;
|
|
1298
|
+
origin?: string;
|
|
856
1299
|
};
|
|
857
1300
|
requestLayout: {
|
|
858
1301
|
algorithm?: string;
|
|
@@ -868,6 +1311,7 @@ declare function createFlowEngine(store: FlowStore, options?: FlowEngineOptions)
|
|
|
868
1311
|
}>;
|
|
869
1312
|
} & {
|
|
870
1313
|
transactionId?: string;
|
|
1314
|
+
origin?: string;
|
|
871
1315
|
};
|
|
872
1316
|
updateMeasurements: {
|
|
873
1317
|
measurements: Array<{
|
|
@@ -882,27 +1326,37 @@ declare function createFlowEngine(store: FlowStore, options?: FlowEngineOptions)
|
|
|
882
1326
|
positions: Map<string, Point>;
|
|
883
1327
|
} & {
|
|
884
1328
|
transactionId?: string;
|
|
1329
|
+
origin?: string;
|
|
885
1330
|
};
|
|
1331
|
+
reportError: FlowErrorEvent;
|
|
886
1332
|
} & {
|
|
887
1333
|
undo: null;
|
|
888
1334
|
redo: null;
|
|
889
|
-
}
|
|
1335
|
+
} & Record<never, never>>;
|
|
890
1336
|
getContext: () => FlowStoreContext;
|
|
1337
|
+
setOptions: (partial: Partial<FlowEngineOptions>, replace?: boolean) => void;
|
|
891
1338
|
getNode: (id: string) => FlowNode | undefined;
|
|
892
1339
|
getEdge: (id: string) => FlowEdge | undefined;
|
|
893
1340
|
getEntity: (id: string) => FlowNode | FlowEdge | undefined;
|
|
894
|
-
getAddressable: (id: string) =>
|
|
895
|
-
|
|
896
|
-
|
|
1341
|
+
getAddressable: (id: string) => FlowEntityRef | undefined;
|
|
1342
|
+
getEntityRef: (id: string) => FlowEntityRef | undefined;
|
|
1343
|
+
getOwnerEntity: (id: string) => FlowNode | FlowEdge | undefined;
|
|
1344
|
+
getBounds: (id: string) => Rect | undefined;
|
|
897
1345
|
screenToCanvas: (screenPoint: Point) => Point;
|
|
898
1346
|
canvasToScreen: (canvasPoint: Point) => Point;
|
|
899
1347
|
entityAtPoint: (canvasPoint: Point) => FlowNode | FlowEdge | null;
|
|
900
1348
|
entityIdAtPoint: (canvasPoint: Point) => string | null;
|
|
1349
|
+
getConnectionCandidate: (pointer: Point, options?: ConnectionCandidateOptions) => ConnectionCandidate | null;
|
|
901
1350
|
getEdgePath: (edgeId: string) => PathData | null;
|
|
902
1351
|
getEdgePathBounds: (edgeId: string) => Rect | null;
|
|
903
1352
|
getEdgeLabelBounds: (edgeId: string) => Rect | null;
|
|
904
1353
|
getAllEdgePaths: (options?: EdgePathOptions) => Map<string, EdgePathData>;
|
|
1354
|
+
getEdgeSourceDependents: (edgeId: string) => readonly string[];
|
|
1355
|
+
visualPosition: (nodeOrId: FlowNode | string) => Point;
|
|
1356
|
+
visualBounds: (nodeOrId: FlowNode | string) => Rect;
|
|
1357
|
+
/** @deprecated Use `visualPosition`. */
|
|
905
1358
|
resolvedPosition: (nodeOrId: FlowNode | string) => Point;
|
|
1359
|
+
/** @deprecated Use `visualBounds`. */
|
|
906
1360
|
resolvedBounds: (nodeOrId: FlowNode | string) => Rect;
|
|
907
1361
|
/**
|
|
908
1362
|
* All highlights on an entity as `{ kind, meta }` entries. Returns a
|
|
@@ -941,6 +1395,10 @@ declare function createFlowEngine(store: FlowStore, options?: FlowEngineOptions)
|
|
|
941
1395
|
/** Group geometry (overall bounds, content block, child area), or null. */
|
|
942
1396
|
getGroupGeometry: (nodeOrId: FlowNode | string) => GroupGeometry | null;
|
|
943
1397
|
getGraphBounds: () => Rect;
|
|
1398
|
+
getIncomers: (nodeId: string) => FlowNode[];
|
|
1399
|
+
getOutgoers: (nodeId: string) => FlowNode[];
|
|
1400
|
+
getConnectedEdges: (nodeIds: Iterable<string>) => FlowEdge[];
|
|
1401
|
+
getNeighbors: (nodeId: string) => FlowNode[];
|
|
944
1402
|
getSelectionBounds: () => Rect | null;
|
|
945
1403
|
entitiesInRect: (rect: Rect) => string[];
|
|
946
1404
|
getPortPosition: (nodeId: string, portName: string) => Point | null;
|
|
@@ -950,9 +1408,14 @@ declare function createFlowEngine(store: FlowStore, options?: FlowEngineOptions)
|
|
|
950
1408
|
target: Point;
|
|
951
1409
|
} | null;
|
|
952
1410
|
validateConnection: (proposed: ProposedConnection) => boolean;
|
|
1411
|
+
validateConnectionDetailed: (proposed: ProposedConnection) => {
|
|
1412
|
+
valid: boolean;
|
|
1413
|
+
reason?: string;
|
|
1414
|
+
};
|
|
953
1415
|
resolveEntityConfig: (entityOrId: FlowNode | FlowEdge | string) => {
|
|
954
1416
|
hidden: boolean;
|
|
955
1417
|
selectable: boolean;
|
|
1418
|
+
focusable: boolean;
|
|
956
1419
|
draggable: boolean;
|
|
957
1420
|
connectable: boolean;
|
|
958
1421
|
reconnectable: boolean;
|
|
@@ -963,6 +1426,11 @@ declare function createFlowEngine(store: FlowStore, options?: FlowEngineOptions)
|
|
|
963
1426
|
nodes: FlowNode[];
|
|
964
1427
|
edges: FlowEdge[];
|
|
965
1428
|
};
|
|
1429
|
+
/** Deterministic paint order. Later items should paint above earlier ones. */
|
|
1430
|
+
getEntityOrder: () => {
|
|
1431
|
+
nodes: FlowNode[];
|
|
1432
|
+
edges: FlowEdge[];
|
|
1433
|
+
};
|
|
966
1434
|
/**
|
|
967
1435
|
* Renderable (visible, optionally viewport-culled) entities. Memoized per
|
|
968
1436
|
* (store snapshot, cull/overscan) so several render layers can share one
|
|
@@ -983,18 +1451,59 @@ declare function createFlowEngine(store: FlowStore, options?: FlowEngineOptions)
|
|
|
983
1451
|
};
|
|
984
1452
|
type FlowEngine = ReturnType<typeof createFlowEngine>;
|
|
985
1453
|
//#endregion
|
|
1454
|
+
//#region src/input/keymap.d.ts
|
|
1455
|
+
type FlowKeyBinding = string | string[] | null;
|
|
1456
|
+
type FlowMultiSelectModifier = 'shift' | 'meta' | 'ctrl' | 'alt';
|
|
1457
|
+
type FlowKeymap = {
|
|
1458
|
+
delete: FlowKeyBinding;
|
|
1459
|
+
undo: FlowKeyBinding;
|
|
1460
|
+
redo: FlowKeyBinding;
|
|
1461
|
+
selectAll: FlowKeyBinding;
|
|
1462
|
+
cancel: FlowKeyBinding;
|
|
1463
|
+
nudgeUp: FlowKeyBinding;
|
|
1464
|
+
nudgeDown: FlowKeyBinding;
|
|
1465
|
+
nudgeLeft: FlowKeyBinding;
|
|
1466
|
+
nudgeRight: FlowKeyBinding;
|
|
1467
|
+
nudgeLargeModifier: 'shift' | 'meta' | 'ctrl' | 'alt' | null;
|
|
1468
|
+
/**
|
|
1469
|
+
* Modifier(s) that turn a click into an additive (multi) select. A single
|
|
1470
|
+
* modifier or an array of them; multi-select fires when ANY listed modifier
|
|
1471
|
+
* is held. `null` disables multi-select entirely. The default is the explicit
|
|
1472
|
+
* legacy set `['shift','meta','ctrl']`; set exactly `'shift'` for shift-only.
|
|
1473
|
+
*/
|
|
1474
|
+
multiSelectModifier: FlowMultiSelectModifier | FlowMultiSelectModifier[] | null;
|
|
1475
|
+
panActivation: FlowKeyBinding;
|
|
1476
|
+
};
|
|
1477
|
+
declare const defaultKeymap: FlowKeymap;
|
|
1478
|
+
declare function resolveKeymap(keymap?: Partial<FlowKeymap>): FlowKeymap;
|
|
1479
|
+
declare function matchesKeyBinding(event: {
|
|
1480
|
+
key: string;
|
|
1481
|
+
modifiers: {
|
|
1482
|
+
shift: boolean;
|
|
1483
|
+
meta: boolean;
|
|
1484
|
+
ctrl: boolean;
|
|
1485
|
+
alt: boolean;
|
|
1486
|
+
};
|
|
1487
|
+
}, binding: FlowKeyBinding): boolean;
|
|
1488
|
+
//#endregion
|
|
986
1489
|
//#region src/input/modes.d.ts
|
|
987
1490
|
declare function keyboardMode(options?: {
|
|
1491
|
+
/** @deprecated Use `keymap.delete = null`. */
|
|
988
1492
|
allowDelete?: boolean;
|
|
1493
|
+
/** @deprecated Use `keymap.undo = null` and `keymap.redo = null`. */
|
|
989
1494
|
allowUndo?: boolean;
|
|
1495
|
+
keymap?: Partial<FlowKeymap>;
|
|
990
1496
|
}): FlowInputMode;
|
|
991
1497
|
declare function keyboardNavMode(options?: {
|
|
992
1498
|
allowMove?: boolean;
|
|
993
1499
|
step?: number;
|
|
994
1500
|
shiftStep?: number;
|
|
1501
|
+
keymap?: Partial<FlowKeymap>;
|
|
995
1502
|
}): FlowInputMode;
|
|
996
1503
|
declare function wheelMode(): FlowInputMode;
|
|
997
1504
|
declare function panMode(): FlowInputMode;
|
|
1505
|
+
declare function pinchMode(): FlowInputMode;
|
|
1506
|
+
declare function resizeMode(): FlowInputMode;
|
|
998
1507
|
type ReparentDropContext = {
|
|
999
1508
|
/** Top-level dragged nodes (descendants of dragged nodes excluded). */
|
|
1000
1509
|
nodes: FlowNode[];
|
|
@@ -1041,8 +1550,9 @@ type ReparentOptions = {
|
|
|
1041
1550
|
decide?: (drop: ReparentDropContext, ctx: FlowInputModeContext) => ReparentDecision;
|
|
1042
1551
|
};
|
|
1043
1552
|
declare function entityPressMode(options?: {
|
|
1044
|
-
drag?: boolean;
|
|
1553
|
+
drag?: boolean | ((event: FlowPointerInputEvent, context: FlowInputModeContext) => boolean);
|
|
1045
1554
|
reparent?: boolean | ReparentOptions;
|
|
1555
|
+
keymap?: Partial<FlowKeymap>;
|
|
1046
1556
|
}): FlowInputMode;
|
|
1047
1557
|
type ConnectModeOptions = {
|
|
1048
1558
|
/**
|
|
@@ -1062,11 +1572,48 @@ type ConnectModeOptions = {
|
|
|
1062
1572
|
}, ctx: FlowInputModeContext) => boolean;
|
|
1063
1573
|
};
|
|
1064
1574
|
declare function connectMode(options?: ConnectModeOptions): FlowInputMode;
|
|
1575
|
+
type ReconnectModeOptions = {
|
|
1576
|
+
/**
|
|
1577
|
+
* Mutate the Flow graph after a valid drop. Disable for controlled graphs
|
|
1578
|
+
* whose domain store consumes `connectionEnded` and owns the mutation.
|
|
1579
|
+
* Defaults to true.
|
|
1580
|
+
*/
|
|
1581
|
+
commit?: boolean;
|
|
1582
|
+
/** Render Flow's generic preview edge. Disable when an external store owns
|
|
1583
|
+
* temporary preview geometry. Defaults to true. */
|
|
1584
|
+
preview?: boolean;
|
|
1585
|
+
/**
|
|
1586
|
+
* Delay reconnect activation until pointer travel crosses a screen-pixel
|
|
1587
|
+
* threshold. `true` uses the store's `connectionDragThreshold`; a number
|
|
1588
|
+
* uses that exact threshold. Defaults to immediate activation.
|
|
1589
|
+
*/
|
|
1590
|
+
dragThreshold?: boolean | number;
|
|
1591
|
+
isValid?: (args: {
|
|
1592
|
+
edge: FlowEdge;
|
|
1593
|
+
end: 'source' | 'target';
|
|
1594
|
+
target: FlowInputTarget;
|
|
1595
|
+
point: Point;
|
|
1596
|
+
}, ctx: FlowInputModeContext) => boolean;
|
|
1597
|
+
};
|
|
1598
|
+
declare function reconnectMode(options?: ReconnectModeOptions): FlowInputMode;
|
|
1065
1599
|
declare function hoverMode(): FlowInputMode;
|
|
1066
1600
|
declare function panePressMode(): FlowInputMode;
|
|
1601
|
+
type BoxSelectModeOptions = {
|
|
1602
|
+
/**
|
|
1603
|
+
* Whether a pane pointer-down should begin a box select. Default: only with
|
|
1604
|
+
* a multi modifier (shift/ctrl/meta) held, so a plain pane drag still pans.
|
|
1605
|
+
* Pass `() => true` for a selection-first canvas where every pane drag boxes
|
|
1606
|
+
* (and the modifier instead adds to the existing selection).
|
|
1607
|
+
*/
|
|
1608
|
+
enabled?: (event: FlowPointerInputEvent) => boolean;
|
|
1609
|
+
keymap?: Partial<FlowKeymap>;
|
|
1610
|
+
};
|
|
1611
|
+
declare function boxSelectMode(options?: BoxSelectModeOptions): FlowInputMode;
|
|
1067
1612
|
/** Interactive default: full editing gestures. */
|
|
1613
|
+
declare function defaultInputModesForKeymap(keymap?: Partial<FlowKeymap>): FlowInputMode[];
|
|
1068
1614
|
declare const defaultInputModes: FlowInputMode[];
|
|
1069
1615
|
/** Readonly: select and navigate, no mutation gestures. */
|
|
1616
|
+
declare function readonlyInputModesForKeymap(keymap?: Partial<FlowKeymap>): FlowInputMode[];
|
|
1070
1617
|
declare const readonlyInputModes: FlowInputMode[];
|
|
1071
1618
|
//#endregion
|
|
1072
1619
|
//#region src/input/index.d.ts
|
|
@@ -1081,7 +1628,7 @@ type FlowInputTarget = {
|
|
|
1081
1628
|
} | {
|
|
1082
1629
|
kind: 'entity';
|
|
1083
1630
|
id: string;
|
|
1084
|
-
part?: 'label';
|
|
1631
|
+
part?: 'label' | `resize-handle:${string}` | `edge-endpoint:${string}` | (string & {});
|
|
1085
1632
|
/**
|
|
1086
1633
|
* Drag-handle gating (set by adapters from `data-flow-drag-handle`
|
|
1087
1634
|
* markers): when the entity declares a handle, drags only start from
|
|
@@ -1100,8 +1647,11 @@ type FlowInputTarget = {
|
|
|
1100
1647
|
type FlowPointerInputEvent = {
|
|
1101
1648
|
kind: 'pointer.down' | 'pointer.move' | 'pointer.up' | 'pointer.cancel';
|
|
1102
1649
|
pointerId: number;
|
|
1650
|
+
pointerType: 'mouse' | 'pen' | 'touch';
|
|
1103
1651
|
/** Pressed button for down events (0 left, 1 middle); -1 for moves. */
|
|
1104
1652
|
button: number;
|
|
1653
|
+
/** Native click count from PointerEvent.detail; 2 means double-click. */
|
|
1654
|
+
detail?: number;
|
|
1105
1655
|
/** Pointer position in canvas (graph/world) coordinates. */
|
|
1106
1656
|
point: Point;
|
|
1107
1657
|
/** Pointer position in container-relative screen pixels. */
|
|
@@ -1109,6 +1659,17 @@ type FlowPointerInputEvent = {
|
|
|
1109
1659
|
target: FlowInputTarget;
|
|
1110
1660
|
modifiers: FlowInputModifiers;
|
|
1111
1661
|
};
|
|
1662
|
+
type FlowPinchInputEvent = {
|
|
1663
|
+
kind: 'pinch.start' | 'pinch.move' | 'pinch.end';
|
|
1664
|
+
/** Pinch center in canvas (graph/world) coordinates. */
|
|
1665
|
+
center: Point;
|
|
1666
|
+
/** Pinch center in container-relative screen pixels. */
|
|
1667
|
+
screenCenter: Point;
|
|
1668
|
+
/** Distance between the first two active touch pointers in screen pixels. */
|
|
1669
|
+
distance: number;
|
|
1670
|
+
pointerCount: number;
|
|
1671
|
+
modifiers: FlowInputModifiers;
|
|
1672
|
+
};
|
|
1112
1673
|
type FlowWheelInputEvent = {
|
|
1113
1674
|
kind: 'wheel';
|
|
1114
1675
|
deltaX: number;
|
|
@@ -1127,7 +1688,7 @@ type FlowKeyInputEvent = {
|
|
|
1127
1688
|
editableTarget: boolean;
|
|
1128
1689
|
modifiers: FlowInputModifiers;
|
|
1129
1690
|
};
|
|
1130
|
-
type FlowInputEvent = FlowPointerInputEvent | FlowWheelInputEvent | FlowKeyInputEvent;
|
|
1691
|
+
type FlowInputEvent = FlowPointerInputEvent | FlowPinchInputEvent | FlowWheelInputEvent | FlowKeyInputEvent;
|
|
1131
1692
|
type FlowTriggerMap = FlowStore['trigger'];
|
|
1132
1693
|
type FlowTriggerName = keyof FlowTriggerMap & string;
|
|
1133
1694
|
type FlowTriggerCommand = {
|
|
@@ -1150,6 +1711,7 @@ type FlowInputModeContext = {
|
|
|
1150
1711
|
engine: FlowEngine;
|
|
1151
1712
|
/** Runtime-tracked transient input state (lives outside the store). */
|
|
1152
1713
|
input: {
|
|
1714
|
+
panKeyHeld: boolean; /** @deprecated Use panKeyHeld. */
|
|
1153
1715
|
spaceHeld: boolean;
|
|
1154
1716
|
};
|
|
1155
1717
|
};
|
|
@@ -1200,6 +1762,10 @@ type FlowInputRuntimeOptions = {
|
|
|
1200
1762
|
* interactive set, or the readonly set when `context.mode === 'readonly'`.
|
|
1201
1763
|
*/
|
|
1202
1764
|
modes?: FlowInputMode[] | ((context: FlowStoreContext) => FlowInputMode[]);
|
|
1765
|
+
/** Keymap used by the built-in runtime state such as panActivation. */
|
|
1766
|
+
keymap?: Partial<FlowKeymap>;
|
|
1767
|
+
/** Profile policies resolved for the current mode. */
|
|
1768
|
+
policies?: FlowPolicies | ((context: FlowStoreContext) => FlowPolicies);
|
|
1203
1769
|
};
|
|
1204
1770
|
type FlowInputRuntime = {
|
|
1205
1771
|
/** Feed one normalized event; apply resulting commands to the store. */
|
|
@@ -1211,13 +1777,14 @@ type FlowInputRuntime = {
|
|
|
1211
1777
|
};
|
|
1212
1778
|
declare function createFlowInputRuntime(options: FlowInputRuntimeOptions): FlowInputRuntime;
|
|
1213
1779
|
/** Default mode resolution: follow the store's `context.mode`. */
|
|
1214
|
-
declare function defaultModesForContext(context: FlowStoreContext): FlowInputMode[];
|
|
1780
|
+
declare function defaultModesForContext(context: FlowStoreContext, keymap?: Partial<FlowKeymap>): FlowInputMode[];
|
|
1215
1781
|
/**
|
|
1216
1782
|
* Mode resolution driven by a store profile: the active store mode's
|
|
1217
1783
|
* `input.modes` wins, then the profile-level `input.modes`, then the
|
|
1218
1784
|
* built-in defaults.
|
|
1219
1785
|
*/
|
|
1220
1786
|
declare function profileModesForContext(profile: FlowProfile): (context: FlowStoreContext) => FlowInputMode[];
|
|
1787
|
+
declare function profilePoliciesForContext(profile: FlowProfile): (context: FlowStoreContext) => FlowPolicies;
|
|
1221
1788
|
/**
|
|
1222
1789
|
* Per-frame auto-pan step while a drag or connection gesture is near the
|
|
1223
1790
|
* container edge. Returns the `calcAutoPan` screen-space delta (negate it for
|
|
@@ -1270,19 +1837,32 @@ type FlowSettings = {
|
|
|
1270
1837
|
snapGrid?: [number, number];
|
|
1271
1838
|
};
|
|
1272
1839
|
type FlowPolicies = {
|
|
1273
|
-
canSelect?:
|
|
1274
|
-
canFocus?:
|
|
1275
|
-
canHover?:
|
|
1276
|
-
canEdit?:
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1840
|
+
canSelect?: boolean;
|
|
1841
|
+
canFocus?: boolean;
|
|
1842
|
+
canHover?: boolean;
|
|
1843
|
+
canEdit?: boolean;
|
|
1844
|
+
canCreate?: boolean;
|
|
1845
|
+
canDelete?: boolean;
|
|
1846
|
+
canMove?: boolean;
|
|
1847
|
+
canResize?: boolean;
|
|
1848
|
+
canConnect?: boolean;
|
|
1849
|
+
canReconnect?: boolean;
|
|
1850
|
+
canReparent?: boolean;
|
|
1851
|
+
canCopy?: boolean;
|
|
1852
|
+
canPaste?: boolean;
|
|
1853
|
+
canExport?: boolean;
|
|
1854
|
+
canUndo?: boolean;
|
|
1855
|
+
canRedo?: boolean;
|
|
1856
|
+
canPan?: boolean;
|
|
1857
|
+
canZoom?: boolean;
|
|
1858
|
+
};
|
|
1859
|
+
/** @experimental Rule slots are intentionally loose until the profile API stabilizes. */
|
|
1281
1860
|
type FlowRules = {
|
|
1282
1861
|
delete?: unknown[];
|
|
1283
1862
|
move?: unknown[];
|
|
1284
1863
|
reparent?: unknown[];
|
|
1285
1864
|
};
|
|
1865
|
+
/** @experimental Resolver slots are intentionally loose until the profile API stabilizes. */
|
|
1286
1866
|
type FlowResolvers = {
|
|
1287
1867
|
blocks?: unknown;
|
|
1288
1868
|
bounds?: unknown;
|
|
@@ -1292,8 +1872,11 @@ type FlowResolvers = {
|
|
|
1292
1872
|
type FlowModeDefinition = {
|
|
1293
1873
|
on?: FlowTransitions;
|
|
1294
1874
|
input?: FlowInputProfile;
|
|
1875
|
+
/** @experimental */
|
|
1295
1876
|
policies?: Partial<FlowPolicies>;
|
|
1877
|
+
/** @experimental */
|
|
1296
1878
|
rules?: Partial<FlowRules>;
|
|
1879
|
+
/** @experimental */
|
|
1297
1880
|
settings?: Partial<FlowSettings>;
|
|
1298
1881
|
};
|
|
1299
1882
|
type FlowProfile = {
|
|
@@ -1301,9 +1884,13 @@ type FlowProfile = {
|
|
|
1301
1884
|
on?: FlowTransitions;
|
|
1302
1885
|
input?: FlowInputProfile;
|
|
1303
1886
|
modes: Record<string, FlowModeDefinition>;
|
|
1887
|
+
/** @experimental */
|
|
1304
1888
|
resolvers?: FlowResolvers;
|
|
1889
|
+
/** @experimental */
|
|
1305
1890
|
policies?: FlowPolicies;
|
|
1891
|
+
/** @experimental */
|
|
1306
1892
|
rules?: FlowRules;
|
|
1893
|
+
/** @experimental */
|
|
1307
1894
|
settings?: FlowSettings;
|
|
1308
1895
|
};
|
|
1309
1896
|
declare function defineFlowProfile<TProfile extends FlowProfile>(profile: TProfile): TProfile;
|
|
@@ -1311,17 +1898,28 @@ declare const defaultFlowProfile: {
|
|
|
1311
1898
|
defaultMode: string;
|
|
1312
1899
|
modes: {
|
|
1313
1900
|
interactive: {};
|
|
1314
|
-
readonly: {
|
|
1901
|
+
readonly: {
|
|
1902
|
+
policies: {
|
|
1903
|
+
canEdit: false;
|
|
1904
|
+
};
|
|
1905
|
+
};
|
|
1315
1906
|
};
|
|
1316
1907
|
};
|
|
1317
1908
|
//#endregion
|
|
1318
1909
|
//#region src/store/index.d.ts
|
|
1910
|
+
/**
|
|
1911
|
+
* Decides whether an entity is captured by the box-select rectangle.
|
|
1912
|
+
* `box` and `bounds` are both in canvas coordinates.
|
|
1913
|
+
*/
|
|
1914
|
+
type BoxSelectionTest = (box: Rect, bounds: Rect) => boolean;
|
|
1319
1915
|
type FlowStoreContext = {
|
|
1320
1916
|
graph: FlowGraph;
|
|
1321
1917
|
parentNodeId: string | null;
|
|
1322
1918
|
depth: number | null;
|
|
1323
1919
|
viewport: Viewport;
|
|
1324
1920
|
viewportSize: Size;
|
|
1921
|
+
/** Persistent screen-space target for fit/center commands; null = full viewport. */
|
|
1922
|
+
fitFrame: Rect | null;
|
|
1325
1923
|
viewportStack: Viewport[];
|
|
1326
1924
|
minZoom: number;
|
|
1327
1925
|
maxZoom: number;
|
|
@@ -1329,8 +1927,19 @@ type FlowStoreContext = {
|
|
|
1329
1927
|
nodeExtent: [Point, Point] | null;
|
|
1330
1928
|
selection: Set<string>;
|
|
1331
1929
|
selectionBox: [Point, Point] | null;
|
|
1930
|
+
/** Selection snapshot when a box gesture began, so shift-drag adds to it. */
|
|
1931
|
+
selectionBoxBase: ReadonlySet<string> | null;
|
|
1932
|
+
/**
|
|
1933
|
+
* Predicate deciding whether an entity (by its bounds) falls inside the
|
|
1934
|
+
* box-select rectangle. Defaults to the `selectionMode` behavior (partial =
|
|
1935
|
+
* any overlap, full = fully contained), but apps can supply any rule — e.g.
|
|
1936
|
+
* a "≥75% overlap" test — without the package hardcoding the modes.
|
|
1937
|
+
*/
|
|
1938
|
+
boxSelectionTest: BoxSelectionTest | null;
|
|
1332
1939
|
/** Entities currently under the pointer (driven by the input runtime). */
|
|
1333
1940
|
hoveredEntityIds: Set<string>;
|
|
1941
|
+
/** Group nodes whose descendants are hidden by the engine. */
|
|
1942
|
+
collapsedNodeIds: Set<string>;
|
|
1334
1943
|
/**
|
|
1335
1944
|
* Semantic highlights: kind → (entity id → metadata). Kinds are
|
|
1336
1945
|
* user-defined strings; metadata is user-defined (e.g. heatmap weights,
|
|
@@ -1355,6 +1964,7 @@ type FlowStoreContext = {
|
|
|
1355
1964
|
autoPanSpeed: number;
|
|
1356
1965
|
connection: ConnectionState | null;
|
|
1357
1966
|
connectOnClick: boolean;
|
|
1967
|
+
connectionDragThreshold: number;
|
|
1358
1968
|
connectionClickStartHandle: {
|
|
1359
1969
|
nodeId: string;
|
|
1360
1970
|
port: string | null;
|
|
@@ -1373,7 +1983,28 @@ type FlowStoreContext = {
|
|
|
1373
1983
|
snapThreshold: number;
|
|
1374
1984
|
enableSpacingGuides: boolean;
|
|
1375
1985
|
autoLayout: AutoLayoutState;
|
|
1986
|
+
/** Transient visual offsets for an in-flight layout animation. */
|
|
1987
|
+
layoutAnimation: {
|
|
1988
|
+
status: "idle" | "running";
|
|
1989
|
+
offsets: Map<string, Point>;
|
|
1990
|
+
};
|
|
1376
1991
|
colorMode: FlowColorMode;
|
|
1992
|
+
/**
|
|
1993
|
+
* Default edge label anchor (mirrors the engine's default). Movement
|
|
1994
|
+
* planning needs it to know whether a label auto-follows its endpoints
|
|
1995
|
+
* (numeric/function anchors) or sits at a fixed position that must be
|
|
1996
|
+
* carried along with a rigidly-dragged subtree.
|
|
1997
|
+
*/
|
|
1998
|
+
labelAnchor: LabelAnchor;
|
|
1999
|
+
/**
|
|
2000
|
+
* Monotonic counter bumped whenever engine options change at runtime (via
|
|
2001
|
+
* `flow.configure({ engine })`). Engine option changes mutate the engine and
|
|
2002
|
+
* clear its memo caches but produce no graph/viewport change, so store
|
|
2003
|
+
* subscribers (React's `useSyncExternalStore`) would never re-derive. Bumping
|
|
2004
|
+
* this emits a fresh context reference so consumers recompute against the
|
|
2005
|
+
* newly-configured engine. Visual-only — not undoable.
|
|
2006
|
+
*/
|
|
2007
|
+
configRevision: number;
|
|
1377
2008
|
};
|
|
1378
2009
|
type FlowColorMode = "light" | "dark" | "system";
|
|
1379
2010
|
/** kind → (entity id → metadata) */
|
|
@@ -1382,6 +2013,14 @@ type FlowHighlightEntry = {
|
|
|
1382
2013
|
id: string;
|
|
1383
2014
|
meta?: unknown;
|
|
1384
2015
|
};
|
|
2016
|
+
/**
|
|
2017
|
+
* Store creation options.
|
|
2018
|
+
*
|
|
2019
|
+
* Runtime-updatable through `flow.configure({ store })` / `updateSettings`:
|
|
2020
|
+
* drag threshold, movement constraint, auto-pan settings, snap-line settings,
|
|
2021
|
+
* box-selection test, and default label anchor. Other options are
|
|
2022
|
+
* construct-only or have dedicated runtime events.
|
|
2023
|
+
*/
|
|
1385
2024
|
type FlowStoreOptions = {
|
|
1386
2025
|
minZoom?: number;
|
|
1387
2026
|
maxZoom?: number;
|
|
@@ -1400,20 +2039,15 @@ type FlowStoreOptions = {
|
|
|
1400
2039
|
enableSpacingGuides?: boolean;
|
|
1401
2040
|
connectOnClick?: boolean;
|
|
1402
2041
|
colorMode?: FlowColorMode;
|
|
2042
|
+
/** Default edge label anchor; should mirror the engine's `labelAnchor`. */
|
|
2043
|
+
labelAnchor?: LabelAnchor;
|
|
2044
|
+
/** See `FlowStoreContext.boxSelectionTest`. */
|
|
2045
|
+
boxSelectionTest?: BoxSelectionTest;
|
|
1403
2046
|
connectionDragThreshold?: number;
|
|
1404
2047
|
selectionMode?: SelectionMode;
|
|
1405
2048
|
historyLimit?: number;
|
|
1406
2049
|
mode?: string;
|
|
1407
2050
|
profile?: FlowProfile;
|
|
1408
|
-
beforeDelete?: (payload: {
|
|
1409
|
-
graph: FlowGraph;
|
|
1410
|
-
reason: "deleteNode" | "deleteEdge" | "deleteSelected";
|
|
1411
|
-
nodes: FlowNode[];
|
|
1412
|
-
edges: FlowEdge[];
|
|
1413
|
-
}) => false | {
|
|
1414
|
-
nodes?: FlowNode[];
|
|
1415
|
-
edges?: FlowEdge[];
|
|
1416
|
-
} | void;
|
|
1417
2051
|
/**
|
|
1418
2052
|
* Controls what happens to edges when a node is deleted.
|
|
1419
2053
|
* - 'cascade' (default): delete all edges connected to the node
|
|
@@ -1425,6 +2059,7 @@ type FlowStoreOptions = {
|
|
|
1425
2059
|
edges: FlowEdge[];
|
|
1426
2060
|
});
|
|
1427
2061
|
};
|
|
2062
|
+
type FlowRuntimeSettings = Pick<FlowStoreOptions, "dragThreshold" | "constrainNodeMovement" | "autoPanOnDrag" | "autoPanThreshold" | "autoPanSpeed" | "enableSnapLines" | "snapThreshold" | "enableSpacingGuides" | "boxSelectionTest" | "labelAnchor">;
|
|
1428
2063
|
type LayoutRequestedEvent = {
|
|
1429
2064
|
algorithm: string;
|
|
1430
2065
|
graph: FlowGraph;
|
|
@@ -1443,12 +2078,14 @@ type ConnectEndTarget = {
|
|
|
1443
2078
|
kind: "none";
|
|
1444
2079
|
};
|
|
1445
2080
|
type ConnectionEndedEvent = {
|
|
2081
|
+
status: "connected" | "cancelled" | "invalid";
|
|
1446
2082
|
source: {
|
|
1447
2083
|
nodeId: string;
|
|
1448
2084
|
port: string | null;
|
|
1449
2085
|
};
|
|
1450
2086
|
target: ConnectEndTarget;
|
|
1451
2087
|
connection: ConnectionState;
|
|
2088
|
+
reconnectedEdgeId?: string;
|
|
1452
2089
|
};
|
|
1453
2090
|
type FlowGraphChangedEvent = {
|
|
1454
2091
|
graph: FlowGraph;
|
|
@@ -1462,6 +2099,10 @@ type FlowSelectionChangedEvent = {
|
|
|
1462
2099
|
selection: Set<string>;
|
|
1463
2100
|
event: FlowEventObject;
|
|
1464
2101
|
};
|
|
2102
|
+
type FlowViewChangedEvent = {
|
|
2103
|
+
scope: FlowViewScope;
|
|
2104
|
+
event: FlowEventObject;
|
|
2105
|
+
};
|
|
1465
2106
|
type FlowEntitiesDeletedEvent = {
|
|
1466
2107
|
ids: string[];
|
|
1467
2108
|
event: FlowEventObject;
|
|
@@ -1470,13 +2111,68 @@ type FlowErrorEvent = {
|
|
|
1470
2111
|
error: unknown;
|
|
1471
2112
|
event?: FlowEventObject;
|
|
1472
2113
|
};
|
|
2114
|
+
type FlowGestureModifiers = {
|
|
2115
|
+
shift: boolean;
|
|
2116
|
+
meta: boolean;
|
|
2117
|
+
ctrl: boolean;
|
|
2118
|
+
alt: boolean;
|
|
2119
|
+
};
|
|
2120
|
+
type FlowDragStartedEvent = {
|
|
2121
|
+
ids: string[];
|
|
2122
|
+
positions: Record<string, Point>;
|
|
2123
|
+
};
|
|
2124
|
+
type FlowDragMovedEvent = FlowDragStartedEvent & {
|
|
2125
|
+
delta: Point;
|
|
2126
|
+
};
|
|
2127
|
+
type FlowDragEndedEvent = FlowDragStartedEvent;
|
|
2128
|
+
type FlowResizeStartedEvent = {
|
|
2129
|
+
id: string;
|
|
2130
|
+
handle: ResizeHandle;
|
|
2131
|
+
bounds: Rect;
|
|
2132
|
+
};
|
|
2133
|
+
type FlowResizeEndedEvent = {
|
|
2134
|
+
id: string;
|
|
2135
|
+
bounds: Rect;
|
|
2136
|
+
};
|
|
2137
|
+
type FlowConnectStartedEvent = {
|
|
2138
|
+
sourceId: string;
|
|
2139
|
+
sourcePort: string | null;
|
|
2140
|
+
point: Point;
|
|
2141
|
+
};
|
|
2142
|
+
type FlowConnectMovedEvent = {
|
|
2143
|
+
point: Point;
|
|
2144
|
+
targetId: string | null;
|
|
2145
|
+
targetPort: string | null;
|
|
2146
|
+
isValid: boolean;
|
|
2147
|
+
invalidReason?: string;
|
|
2148
|
+
};
|
|
2149
|
+
type FlowPaneGestureEvent = {
|
|
2150
|
+
point: Point;
|
|
2151
|
+
modifiers: FlowGestureModifiers;
|
|
2152
|
+
};
|
|
2153
|
+
type FlowEntityGestureEvent = FlowPaneGestureEvent & {
|
|
2154
|
+
id: string;
|
|
2155
|
+
};
|
|
1473
2156
|
type FlowEmittedPayloadMap = {
|
|
1474
2157
|
layoutRequested: LayoutRequestedEvent;
|
|
1475
2158
|
connectionEnded: ConnectionEndedEvent;
|
|
1476
2159
|
graphChanged: FlowGraphChangedEvent;
|
|
1477
2160
|
viewportChanged: FlowViewportChangedEvent;
|
|
1478
2161
|
selectionChanged: FlowSelectionChangedEvent;
|
|
2162
|
+
viewChanged: FlowViewChangedEvent;
|
|
1479
2163
|
entitiesDeleted: FlowEntitiesDeletedEvent;
|
|
2164
|
+
dragStarted: FlowDragStartedEvent;
|
|
2165
|
+
dragMoved: FlowDragMovedEvent;
|
|
2166
|
+
dragEnded: FlowDragEndedEvent;
|
|
2167
|
+
resizeStarted: FlowResizeStartedEvent;
|
|
2168
|
+
resizeEnded: FlowResizeEndedEvent;
|
|
2169
|
+
connectStarted: FlowConnectStartedEvent;
|
|
2170
|
+
connectMoved: FlowConnectMovedEvent;
|
|
2171
|
+
paneClicked: FlowPaneGestureEvent;
|
|
2172
|
+
paneContextMenu: FlowPaneGestureEvent;
|
|
2173
|
+
entityClicked: FlowEntityGestureEvent;
|
|
2174
|
+
entityDoubleClicked: FlowEntityGestureEvent;
|
|
2175
|
+
entityContextMenu: FlowEntityGestureEvent;
|
|
1480
2176
|
error: FlowErrorEvent;
|
|
1481
2177
|
};
|
|
1482
2178
|
type FlowEventPayloadMap = {
|
|
@@ -1486,6 +2182,7 @@ type FlowEventPayloadMap = {
|
|
|
1486
2182
|
deleteNode: {
|
|
1487
2183
|
id: string;
|
|
1488
2184
|
} & TransactionMetadata;
|
|
2185
|
+
updateNode: FlowUpdateNodeEvent;
|
|
1489
2186
|
updateNodeData: {
|
|
1490
2187
|
id: string;
|
|
1491
2188
|
data: Record<string, unknown>;
|
|
@@ -1496,6 +2193,11 @@ type FlowEventPayloadMap = {
|
|
|
1496
2193
|
deleteEdge: {
|
|
1497
2194
|
id: string;
|
|
1498
2195
|
} & TransactionMetadata;
|
|
2196
|
+
deleteEntities: {
|
|
2197
|
+
nodeIds?: string[];
|
|
2198
|
+
edgeIds?: string[];
|
|
2199
|
+
} & TransactionMetadata;
|
|
2200
|
+
updateEdge: FlowUpdateEdgeEvent;
|
|
1499
2201
|
updateEdgeData: {
|
|
1500
2202
|
id: string;
|
|
1501
2203
|
data: Record<string, unknown>;
|
|
@@ -1504,11 +2206,34 @@ type FlowEventPayloadMap = {
|
|
|
1504
2206
|
setGraph: {
|
|
1505
2207
|
graph: FlowGraph;
|
|
1506
2208
|
};
|
|
2209
|
+
replaceGraph: {
|
|
2210
|
+
graph: FlowGraph;
|
|
2211
|
+
graphChanged?: boolean;
|
|
2212
|
+
layoutAnimationOffsets?: Map<string, Point>;
|
|
2213
|
+
} & ReplaceGraphMetadata;
|
|
2214
|
+
setLayoutAnimationOffsets: {
|
|
2215
|
+
offsets: Map<string, Point>;
|
|
2216
|
+
};
|
|
2217
|
+
clearLayoutAnimation: undefined;
|
|
2218
|
+
loadDocument: {
|
|
2219
|
+
graph: FlowGraph;
|
|
2220
|
+
collapsedNodeIds: string[];
|
|
2221
|
+
viewport: Viewport;
|
|
2222
|
+
} & TransactionMetadata;
|
|
2223
|
+
setCollapsedNodes: {
|
|
2224
|
+
ids: string[];
|
|
2225
|
+
};
|
|
1507
2226
|
reset: undefined;
|
|
1508
2227
|
reparentNode: {
|
|
1509
2228
|
id: string;
|
|
1510
2229
|
parentId: string | null;
|
|
1511
2230
|
} & TransactionMetadata;
|
|
2231
|
+
collapseNode: {
|
|
2232
|
+
id: string;
|
|
2233
|
+
} & TransactionMetadata;
|
|
2234
|
+
expandNode: {
|
|
2235
|
+
id: string;
|
|
2236
|
+
} & TransactionMetadata;
|
|
1512
2237
|
dragStart: {
|
|
1513
2238
|
id: string;
|
|
1514
2239
|
} & TransactionMetadata;
|
|
@@ -1517,7 +2242,8 @@ type FlowEventPayloadMap = {
|
|
|
1517
2242
|
dy: number;
|
|
1518
2243
|
};
|
|
1519
2244
|
dragEnd: undefined;
|
|
1520
|
-
|
|
2245
|
+
dragCancel: undefined;
|
|
2246
|
+
commitDrag: TransactionMetadata | undefined;
|
|
1521
2247
|
select: {
|
|
1522
2248
|
ids: string[];
|
|
1523
2249
|
mode?: "single" | "multi";
|
|
@@ -1532,6 +2258,7 @@ type FlowEventPayloadMap = {
|
|
|
1532
2258
|
point: Point;
|
|
1533
2259
|
};
|
|
1534
2260
|
selectionBoxEnd: undefined;
|
|
2261
|
+
selectionBoxCancel: undefined;
|
|
1535
2262
|
focus: {
|
|
1536
2263
|
entityId: string;
|
|
1537
2264
|
};
|
|
@@ -1559,7 +2286,16 @@ type FlowEventPayloadMap = {
|
|
|
1559
2286
|
updateParentNodeId: {
|
|
1560
2287
|
parentNodeId: string | null;
|
|
1561
2288
|
};
|
|
2289
|
+
setViewScope: {
|
|
2290
|
+
parentNodeId: string | null;
|
|
2291
|
+
depth: number | null;
|
|
2292
|
+
selection: FlowViewSelectionPolicy;
|
|
2293
|
+
visibleEntityIds: string[];
|
|
2294
|
+
};
|
|
1562
2295
|
setViewport: Viewport;
|
|
2296
|
+
setFitFrame: {
|
|
2297
|
+
frame: Rect | null;
|
|
2298
|
+
};
|
|
1563
2299
|
panBy: Point;
|
|
1564
2300
|
zoomTo: {
|
|
1565
2301
|
zoom: number;
|
|
@@ -1583,6 +2319,9 @@ type FlowEventPayloadMap = {
|
|
|
1583
2319
|
autoPanThreshold?: number;
|
|
1584
2320
|
autoPanSpeed?: number;
|
|
1585
2321
|
};
|
|
2322
|
+
updateSettings: Partial<FlowRuntimeSettings>;
|
|
2323
|
+
configure: Partial<FlowStoreOptions>;
|
|
2324
|
+
bumpConfigRevision: undefined;
|
|
1586
2325
|
setTranslateExtent: {
|
|
1587
2326
|
extent: [Point, Point] | null;
|
|
1588
2327
|
};
|
|
@@ -1596,6 +2335,7 @@ type FlowEventPayloadMap = {
|
|
|
1596
2335
|
panStart: Point;
|
|
1597
2336
|
pan: Point;
|
|
1598
2337
|
panEnd: undefined;
|
|
2338
|
+
panCancel: undefined;
|
|
1599
2339
|
setCanvasState: {
|
|
1600
2340
|
state: CanvasState;
|
|
1601
2341
|
};
|
|
@@ -1603,15 +2343,22 @@ type FlowEventPayloadMap = {
|
|
|
1603
2343
|
sourceId: string;
|
|
1604
2344
|
sourcePort: string | null;
|
|
1605
2345
|
position: Point;
|
|
2346
|
+
active?: boolean;
|
|
2347
|
+
reconnectingEdgeId?: string | null;
|
|
2348
|
+
reconnectingEnd?: "source" | "target" | null;
|
|
2349
|
+
preview?: boolean;
|
|
1606
2350
|
};
|
|
1607
2351
|
connectionMove: {
|
|
1608
2352
|
position: Point;
|
|
1609
2353
|
targetId?: string | null;
|
|
1610
2354
|
targetPort?: string | null;
|
|
1611
2355
|
isValid?: boolean;
|
|
2356
|
+
invalidReason?: string;
|
|
2357
|
+
active?: boolean;
|
|
1612
2358
|
};
|
|
1613
2359
|
connectionEnd: {
|
|
1614
2360
|
target?: ConnectEndTarget;
|
|
2361
|
+
reconnectedEdgeId?: string;
|
|
1615
2362
|
} | undefined;
|
|
1616
2363
|
cancelConnection: undefined;
|
|
1617
2364
|
setConnectionClickStartHandle: {
|
|
@@ -1625,12 +2372,17 @@ type FlowEventPayloadMap = {
|
|
|
1625
2372
|
resizeMove: Point;
|
|
1626
2373
|
resizeEnd: undefined;
|
|
1627
2374
|
resizeCancel: undefined;
|
|
2375
|
+
paneClicked: FlowPaneGestureEvent;
|
|
2376
|
+
paneContextMenu: FlowPaneGestureEvent;
|
|
2377
|
+
entityClicked: FlowEntityGestureEvent;
|
|
2378
|
+
entityDoubleClicked: FlowEntityGestureEvent;
|
|
2379
|
+
entityContextMenu: FlowEntityGestureEvent;
|
|
1628
2380
|
reconnectEdge: {
|
|
1629
2381
|
edgeId: string;
|
|
1630
2382
|
newSourceId?: string;
|
|
1631
2383
|
newTargetId?: string;
|
|
1632
|
-
newSourcePort?: string;
|
|
1633
|
-
newTargetPort?: string;
|
|
2384
|
+
newSourcePort?: string | null;
|
|
2385
|
+
newTargetPort?: string | null;
|
|
1634
2386
|
} & TransactionMetadata;
|
|
1635
2387
|
setMode: {
|
|
1636
2388
|
mode: string;
|
|
@@ -1676,67 +2428,631 @@ type FlowEventPayloadMap = {
|
|
|
1676
2428
|
bakeLabelPositions: {
|
|
1677
2429
|
positions: Map<string, Point>;
|
|
1678
2430
|
} & TransactionMetadata;
|
|
2431
|
+
reportError: FlowErrorEvent;
|
|
1679
2432
|
};
|
|
2433
|
+
type FlowNodePatch = Partial<Omit<FlowNode, "id" | "type" | "parentId">>;
|
|
2434
|
+
type FlowEdgePatch = Partial<Omit<FlowEdge, "id" | "type" | "sourceId" | "targetId" | "sourcePort" | "targetPort">>;
|
|
2435
|
+
type FlowNodeUpdater = (node: FlowNode) => FlowNode;
|
|
2436
|
+
type FlowEdgeUpdater = (edge: FlowEdge) => FlowEdge;
|
|
2437
|
+
type FlowUpdateNodeEvent = {
|
|
2438
|
+
id: string;
|
|
2439
|
+
patch?: FlowNodePatch;
|
|
2440
|
+
updater?: FlowNodeUpdater;
|
|
2441
|
+
} & TransactionMetadata;
|
|
2442
|
+
type FlowUpdateEdgeEvent = {
|
|
2443
|
+
id: string;
|
|
2444
|
+
patch?: FlowEdgePatch;
|
|
2445
|
+
updater?: FlowEdgeUpdater;
|
|
2446
|
+
} & TransactionMetadata;
|
|
1680
2447
|
type TransactionMetadata = {
|
|
1681
2448
|
transactionId?: string;
|
|
2449
|
+
origin?: string;
|
|
1682
2450
|
};
|
|
1683
|
-
|
|
2451
|
+
type FlowGraphRetentionPolicy = "preserve" | "reset";
|
|
2452
|
+
type FlowGraphHistoryPolicy = "reset" | "ignore" | "record";
|
|
2453
|
+
type ReplaceGraphMetadata = TransactionMetadata & {
|
|
2454
|
+
retention?: FlowGraphRetentionPolicy;
|
|
2455
|
+
history?: FlowGraphHistoryPolicy;
|
|
2456
|
+
};
|
|
2457
|
+
declare function createFlowStore(initialGraph?: FlowGraph, options?: FlowStoreOptions): import("@xstate/store").Store<FlowStoreContext, FlowEventPayloadMap & {
|
|
1684
2458
|
undo: null;
|
|
1685
2459
|
redo: null;
|
|
1686
|
-
},
|
|
2460
|
+
} & Record<never, never>, ExtractEvents<FlowEmittedPayloadMap>>;
|
|
1687
2461
|
type FlowStore = ReturnType<typeof createFlowStore>;
|
|
2462
|
+
declare function areNodesMeasured(context: FlowStoreContext): boolean;
|
|
2463
|
+
//#endregion
|
|
2464
|
+
//#region src/factories.d.ts
|
|
2465
|
+
declare function createNode<TData = any>(opts: Partial<FlowNode<TData>> & {
|
|
2466
|
+
id: string;
|
|
2467
|
+
}): FlowNode<TData>;
|
|
2468
|
+
declare function createEdge<TEdgeData = any, TLabelData = any>(opts: Omit<Partial<FlowEdge<TEdgeData, TLabelData>>, 'label'> & Pick<FlowEdge<TEdgeData, TLabelData>, 'id' | 'sourceId' | 'targetId'> & {
|
|
2469
|
+
label?: Partial<FlowEdgeLabel<TLabelData>> & {
|
|
2470
|
+
width: number;
|
|
2471
|
+
height: number;
|
|
2472
|
+
};
|
|
2473
|
+
}): FlowEdge<TEdgeData, TLabelData>;
|
|
2474
|
+
declare function createGraph<TNodeData = any, TEdgeData = any>(opts: Partial<FlowGraph<TNodeData, TEdgeData>> & {
|
|
2475
|
+
nodes: FlowNode<TNodeData>[];
|
|
2476
|
+
edges: FlowEdge<TEdgeData>[];
|
|
2477
|
+
}): FlowGraph<TNodeData, TEdgeData>;
|
|
2478
|
+
declare function createPort<TData = any>(opts: Partial<FlowPort<TData>> & Pick<FlowPort<TData>, 'name' | 'side' | 'direction'>): FlowPort<TData>;
|
|
2479
|
+
//#endregion
|
|
2480
|
+
//#region src/viewport/animate.d.ts
|
|
2481
|
+
type ViewportAnimationFrame = (callback: (time: number) => void) => number;
|
|
2482
|
+
type ViewportAnimationCancelFrame = (id: number) => void;
|
|
2483
|
+
type ViewportAnimationControls = {
|
|
2484
|
+
cancel: () => void;
|
|
2485
|
+
done: Promise<void>;
|
|
2486
|
+
};
|
|
2487
|
+
type AnimateViewportOptions = ViewportAnimationOptions & {
|
|
2488
|
+
raf?: ViewportAnimationFrame;
|
|
2489
|
+
cancelRaf?: ViewportAnimationCancelFrame;
|
|
2490
|
+
};
|
|
2491
|
+
declare function animateViewport(store: FlowStore, target: Viewport, options?: AnimateViewportOptions): ViewportAnimationControls;
|
|
2492
|
+
//#endregion
|
|
2493
|
+
//#region src/viewport/index.d.ts
|
|
2494
|
+
/** Create a default viewport (origin, no zoom) */
|
|
2495
|
+
declare function createViewport(x?: number, y?: number, zoom?: number): Viewport;
|
|
2496
|
+
/**
|
|
2497
|
+
* Convert viewport to SVG transform string.
|
|
2498
|
+
* Use on the root <g> wrapping all entities.
|
|
2499
|
+
*
|
|
2500
|
+
* @example
|
|
2501
|
+
* <g transform={toSVGTransform(viewport)}>...</g>
|
|
2502
|
+
*/
|
|
2503
|
+
declare function toSVGTransform(viewport: Viewport): string;
|
|
2504
|
+
/**
|
|
2505
|
+
* Convert viewport + container size to an SVG viewBox string.
|
|
2506
|
+
*
|
|
2507
|
+
* @example
|
|
2508
|
+
* <svg viewBox={toViewBox(viewport, { width: 800, height: 600 })}>...</svg>
|
|
2509
|
+
*/
|
|
2510
|
+
declare function toViewBox(viewport: Viewport, size: Size): string;
|
|
2511
|
+
/** Convert a screen-space point to canvas-space */
|
|
2512
|
+
declare function screenToCanvas(point: Point, viewport: Viewport): Point;
|
|
2513
|
+
/** Convert a canvas-space point to screen-space */
|
|
2514
|
+
declare function canvasToScreen(point: Point, viewport: Viewport): Point;
|
|
2515
|
+
/** Get the canvas-space bounding rect of what's visible on screen */
|
|
2516
|
+
declare function getVisibleBounds(viewport: Viewport, size: Size): Rect;
|
|
2517
|
+
/**
|
|
2518
|
+
* Compute a viewport that fits the given bounds into the given screen size.
|
|
2519
|
+
*/
|
|
2520
|
+
declare function viewportForBounds(bounds: Rect, size: Size, options?: FitViewOptions): Viewport;
|
|
2521
|
+
/** Pan viewport by a delta */
|
|
2522
|
+
declare function panBy(viewport: Viewport, delta: Point): Viewport;
|
|
2523
|
+
/** Zoom to a specific level, keeping a screen-space point fixed */
|
|
2524
|
+
declare function zoomTo(viewport: Viewport, zoom: number, center: Point): Viewport;
|
|
2525
|
+
/** Clamp zoom to min/max bounds */
|
|
2526
|
+
declare function clampZoom(zoom: number, minZoom: number, maxZoom: number): number;
|
|
2527
|
+
/** Viewport that places the given canvas point at the center of the screen. */
|
|
2528
|
+
declare function viewportCenteredOn(center: Point, size: Size, zoom: number, frame?: Rect): Viewport;
|
|
2529
|
+
/** Validate and clone a positive finite screen-space fit frame. */
|
|
2530
|
+
declare function validateFitFrame(frame: Rect): Rect;
|
|
2531
|
+
//#endregion
|
|
2532
|
+
//#region src/validation.d.ts
|
|
2533
|
+
type FlowResult<T, TError = FlowGraphValidationError> = {
|
|
2534
|
+
ok: true;
|
|
2535
|
+
value: T;
|
|
2536
|
+
} | {
|
|
2537
|
+
ok: false;
|
|
2538
|
+
error: TError;
|
|
2539
|
+
};
|
|
2540
|
+
type FlowValidationIssue = {
|
|
2541
|
+
code: string;
|
|
2542
|
+
path: string;
|
|
2543
|
+
message: string;
|
|
2544
|
+
};
|
|
2545
|
+
declare class FlowGraphValidationError extends Error {
|
|
2546
|
+
readonly issues: readonly FlowValidationIssue[];
|
|
2547
|
+
constructor(issues: readonly FlowValidationIssue[]);
|
|
2548
|
+
}
|
|
2549
|
+
interface StandardSchemaV1Like<TOutput = unknown> {
|
|
2550
|
+
readonly '~standard': {
|
|
2551
|
+
readonly validate: (value: unknown) => {
|
|
2552
|
+
value: TOutput;
|
|
2553
|
+
issues?: undefined;
|
|
2554
|
+
} | {
|
|
2555
|
+
value?: undefined;
|
|
2556
|
+
issues: readonly {
|
|
2557
|
+
message: string;
|
|
2558
|
+
path?: unknown;
|
|
2559
|
+
}[];
|
|
2560
|
+
} | Promise<unknown>;
|
|
2561
|
+
};
|
|
2562
|
+
}
|
|
2563
|
+
type FlowDataKind = 'node' | 'edge' | 'label';
|
|
2564
|
+
type FlowDataSchema<TData = unknown> = {
|
|
2565
|
+
version: number;
|
|
2566
|
+
schema?: StandardSchemaV1Like<TData>;
|
|
2567
|
+
migrate?: (data: unknown, versions: {
|
|
2568
|
+
fromVersion: number;
|
|
2569
|
+
toVersion: number;
|
|
2570
|
+
}) => TData;
|
|
2571
|
+
remap?: (data: TData, context: {
|
|
2572
|
+
idMap: ReadonlyMap<string, string>;
|
|
2573
|
+
}) => TData;
|
|
2574
|
+
};
|
|
2575
|
+
type FlowDataSchemas<TNodeData = unknown, TEdgeData = unknown, TLabelData = unknown> = {
|
|
2576
|
+
node?: FlowDataSchema<TNodeData>;
|
|
2577
|
+
edge?: FlowDataSchema<TEdgeData>;
|
|
2578
|
+
label?: FlowDataSchema<TLabelData>;
|
|
2579
|
+
};
|
|
2580
|
+
type FlowDataVersions = Partial<Record<FlowDataKind, number>>;
|
|
2581
|
+
declare function cloneJsonSafe<T>(value: T, path?: string): T;
|
|
2582
|
+
declare function validateAndCloneGraph<TNodeData = unknown, TEdgeData = unknown, TLabelData = unknown>(input: unknown, schemas?: FlowDataSchemas<TNodeData, TEdgeData, TLabelData>): FlowGraph<TNodeData, TEdgeData, TLabelData>;
|
|
2583
|
+
declare function validateViewport(input: unknown, path?: string): Viewport;
|
|
2584
|
+
//#endregion
|
|
2585
|
+
//#region src/serialize.d.ts
|
|
2586
|
+
type FlowSerialized<TNodeData = any, TEdgeData = any, TLabelData = any> = {
|
|
2587
|
+
version: 1;
|
|
2588
|
+
graph: FlowGraph<TNodeData, TEdgeData, TLabelData>;
|
|
2589
|
+
viewport: Viewport;
|
|
2590
|
+
collapsedNodeIds?: string[];
|
|
2591
|
+
dataVersions?: FlowDataVersions;
|
|
2592
|
+
};
|
|
2593
|
+
declare function parseFlowSerialized<TNodeData = any, TEdgeData = any, TLabelData = any>(input: unknown, schemas?: FlowDataSchemas<TNodeData, TEdgeData, TLabelData>): FlowSerialized<TNodeData, TEdgeData, TLabelData>;
|
|
2594
|
+
declare function serializeFlowGraph<TNodeData = any, TEdgeData = any, TLabelData = any>(graph: FlowGraph<TNodeData, TEdgeData, TLabelData>): FlowGraph<TNodeData, TEdgeData, TLabelData>;
|
|
2595
|
+
//#endregion
|
|
2596
|
+
//#region src/changeSet.d.ts
|
|
2597
|
+
type FlowPatch<TNodeData = any, TEdgeData = any, TLabelData = any> = {
|
|
2598
|
+
op: 'addNode';
|
|
2599
|
+
node: FlowNode<TNodeData>;
|
|
2600
|
+
} | {
|
|
2601
|
+
op: 'updateNode';
|
|
2602
|
+
id: string;
|
|
2603
|
+
before: FlowNode<TNodeData>;
|
|
2604
|
+
after: FlowNode<TNodeData>;
|
|
2605
|
+
} | {
|
|
2606
|
+
op: 'deleteNode';
|
|
2607
|
+
node: FlowNode<TNodeData>;
|
|
2608
|
+
} | {
|
|
2609
|
+
op: 'addEdge';
|
|
2610
|
+
edge: FlowEdge<TEdgeData, TLabelData>;
|
|
2611
|
+
} | {
|
|
2612
|
+
op: 'updateEdge';
|
|
2613
|
+
id: string;
|
|
2614
|
+
before: FlowEdge<TEdgeData, TLabelData>;
|
|
2615
|
+
after: FlowEdge<TEdgeData, TLabelData>;
|
|
2616
|
+
} | {
|
|
2617
|
+
op: 'deleteEdge';
|
|
2618
|
+
edge: FlowEdge<TEdgeData, TLabelData>;
|
|
2619
|
+
} | {
|
|
2620
|
+
op: 'updateGraph';
|
|
2621
|
+
before: Omit<FlowGraph<TNodeData, TEdgeData, TLabelData>, 'nodes' | 'edges'>;
|
|
2622
|
+
after: Omit<FlowGraph<TNodeData, TEdgeData, TLabelData>, 'nodes' | 'edges'>;
|
|
2623
|
+
};
|
|
2624
|
+
type FlowEntityUpdate<TEntity> = {
|
|
2625
|
+
id: string;
|
|
2626
|
+
before: TEntity;
|
|
2627
|
+
after: TEntity;
|
|
2628
|
+
};
|
|
2629
|
+
type FlowChangeSet<TNodeData = any, TEdgeData = any, TLabelData = any> = {
|
|
2630
|
+
version: 1;
|
|
2631
|
+
origin?: string;
|
|
2632
|
+
transactionId?: string;
|
|
2633
|
+
revision: number;
|
|
2634
|
+
nodes: {
|
|
2635
|
+
added: FlowNode<TNodeData>[];
|
|
2636
|
+
removed: FlowNode<TNodeData>[];
|
|
2637
|
+
updated: FlowEntityUpdate<FlowNode<TNodeData>>[];
|
|
2638
|
+
};
|
|
2639
|
+
edges: {
|
|
2640
|
+
added: FlowEdge<TEdgeData, TLabelData>[];
|
|
2641
|
+
removed: FlowEdge<TEdgeData, TLabelData>[];
|
|
2642
|
+
updated: FlowEntityUpdate<FlowEdge<TEdgeData, TLabelData>>[];
|
|
2643
|
+
};
|
|
2644
|
+
forward: FlowPatch<TNodeData, TEdgeData, TLabelData>[];
|
|
2645
|
+
inverse: FlowPatch<TNodeData, TEdgeData, TLabelData>[];
|
|
2646
|
+
};
|
|
2647
|
+
declare function createFlowChangeSet<TNodeData = any, TEdgeData = any, TLabelData = any>(before: FlowGraph<TNodeData, TEdgeData, TLabelData>, after: FlowGraph<TNodeData, TEdgeData, TLabelData>, metadata: {
|
|
2648
|
+
origin?: string;
|
|
2649
|
+
transactionId?: string;
|
|
2650
|
+
revision: number;
|
|
2651
|
+
}): FlowChangeSet<TNodeData, TEdgeData, TLabelData> | null;
|
|
2652
|
+
declare function applyFlowPatches<TNodeData = any, TEdgeData = any, TLabelData = any>(graph: FlowGraph<TNodeData, TEdgeData, TLabelData>, patches: readonly FlowPatch<TNodeData, TEdgeData, TLabelData>[], options?: {
|
|
2653
|
+
strict?: boolean;
|
|
2654
|
+
schemas?: FlowDataSchemas<TNodeData, TEdgeData, TLabelData>;
|
|
2655
|
+
}): FlowResult<FlowGraph<TNodeData, TEdgeData, TLabelData>>;
|
|
2656
|
+
//#endregion
|
|
2657
|
+
//#region src/content.d.ts
|
|
2658
|
+
type FlowContent<TNodeData = any, TEdgeData = any, TLabelData = any> = {
|
|
2659
|
+
type: 'stately-flow-content';
|
|
2660
|
+
version: 1;
|
|
2661
|
+
nodes: FlowNode<TNodeData>[];
|
|
2662
|
+
edges: FlowEdge<TEdgeData, TLabelData>[];
|
|
2663
|
+
dataVersions?: FlowDataVersions;
|
|
2664
|
+
};
|
|
2665
|
+
type FlowContentInsertResult<TNodeData = any, TEdgeData = any, TLabelData = any> = {
|
|
2666
|
+
graph: FlowGraph<TNodeData, TEdgeData, TLabelData>;
|
|
2667
|
+
nodeIds: string[];
|
|
2668
|
+
edgeIds: string[];
|
|
2669
|
+
idMap: ReadonlyMap<string, string>;
|
|
2670
|
+
};
|
|
2671
|
+
declare function extractFlowContent<TNodeData = any, TEdgeData = any, TLabelData = any>(graph: FlowGraph<TNodeData, TEdgeData, TLabelData>, targets: Iterable<string>, schemas?: FlowDataSchemas<TNodeData, TEdgeData, TLabelData>): FlowContent<TNodeData, TEdgeData, TLabelData> | null;
|
|
2672
|
+
declare function insertFlowContent<TNodeData = any, TEdgeData = any, TLabelData = any>(graph: FlowGraph<TNodeData, TEdgeData, TLabelData>, content: unknown, options: {
|
|
2673
|
+
point?: Point;
|
|
2674
|
+
preservePosition?: boolean;
|
|
2675
|
+
schemas?: FlowDataSchemas<TNodeData, TEdgeData, TLabelData>;
|
|
2676
|
+
createId: (kind: 'node' | 'edge', sourceId: string, attempt: number) => string;
|
|
2677
|
+
}): FlowContentInsertResult<TNodeData, TEdgeData, TLabelData>;
|
|
1688
2678
|
//#endregion
|
|
1689
2679
|
//#region src/createFlow.d.ts
|
|
1690
|
-
type
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
2680
|
+
type LayoutDiagnostic = {
|
|
2681
|
+
message: string;
|
|
2682
|
+
severity?: 'info' | 'warning' | 'error';
|
|
2683
|
+
code?: string;
|
|
2684
|
+
entityId?: string;
|
|
2685
|
+
};
|
|
2686
|
+
type LayoutEdgeRoute = {
|
|
2687
|
+
waypoints: readonly Point[];
|
|
2688
|
+
};
|
|
2689
|
+
type LayoutResult = {
|
|
2690
|
+
positions: ReadonlyMap<string, Point>;
|
|
2691
|
+
nodeSizes?: ReadonlyMap<string, Size>;
|
|
2692
|
+
nodeBounds?: ReadonlyMap<string, Rect>;
|
|
2693
|
+
edgeLabelPositions?: ReadonlyMap<string, Point>;
|
|
2694
|
+
edgeLabelBounds?: ReadonlyMap<string, Rect>;
|
|
2695
|
+
edgeRoutes?: ReadonlyMap<string, LayoutEdgeRoute | readonly Point[]>;
|
|
2696
|
+
diagnostics?: readonly LayoutDiagnostic[];
|
|
2697
|
+
quality?: Readonly<Record<string, unknown>>;
|
|
2698
|
+
metadata?: Readonly<Record<string, unknown>>;
|
|
2699
|
+
source?: string;
|
|
2700
|
+
/** Fixed entities listed here may be changed by this result. */
|
|
2701
|
+
overrideFixedEntityIds?: ReadonlySet<string>;
|
|
2702
|
+
};
|
|
2703
|
+
type LayoutPositions = Map<string, Point>;
|
|
2704
|
+
type FlowAbortSignal = {
|
|
2705
|
+
readonly aborted: boolean;
|
|
2706
|
+
addEventListener: (type: 'abort', listener: () => void, options?: {
|
|
2707
|
+
once?: boolean;
|
|
2708
|
+
}) => void;
|
|
2709
|
+
removeEventListener: (type: 'abort', listener: () => void) => void;
|
|
2710
|
+
};
|
|
2711
|
+
type LayoutRunOptions = {
|
|
2712
|
+
signal?: FlowAbortSignal;
|
|
2713
|
+
/** Apply even if the graph changed while the algorithm was running. */
|
|
2714
|
+
force?: boolean;
|
|
2715
|
+
scope?: FlowViewScope;
|
|
2716
|
+
previousResult?: LayoutResult | null;
|
|
2717
|
+
fixedEntityIds?: ReadonlySet<string>;
|
|
2718
|
+
pinnedEntityIds?: ReadonlySet<string>;
|
|
2719
|
+
source?: string;
|
|
2720
|
+
metadata?: Readonly<Record<string, unknown>>;
|
|
2721
|
+
animation?: LayoutAnimationOptions;
|
|
2722
|
+
};
|
|
2723
|
+
type LayoutAnimationOptions = {
|
|
2724
|
+
duration?: number;
|
|
2725
|
+
easing?: (progress: number) => number;
|
|
2726
|
+
};
|
|
2727
|
+
type LayoutAnimationControls = {
|
|
2728
|
+
cancel: () => void;
|
|
2729
|
+
done: Promise<void>;
|
|
2730
|
+
};
|
|
2731
|
+
type LayoutApplyOptions = FlowTransactionOptions & {
|
|
2732
|
+
fixedEntityIds?: ReadonlySet<string>;
|
|
2733
|
+
pinnedEntityIds?: ReadonlySet<string>;
|
|
2734
|
+
overrideFixedEntityIds?: ReadonlySet<string>;
|
|
2735
|
+
animation?: LayoutAnimationOptions;
|
|
2736
|
+
};
|
|
2737
|
+
type LayoutRunResult = {
|
|
2738
|
+
applied: boolean;
|
|
2739
|
+
result: LayoutResult;
|
|
2740
|
+
source?: string;
|
|
2741
|
+
diagnostics?: readonly LayoutDiagnostic[];
|
|
2742
|
+
animation: LayoutAnimationControls;
|
|
2743
|
+
};
|
|
2744
|
+
type LayoutAlgorithm<TNodeData = any, TEdgeData = any, TLabelData = any> = (graph: Readonly<FlowGraph<TNodeData, TEdgeData, TLabelData>>, options: Readonly<LayoutRunOptions> & {
|
|
2745
|
+
signal: FlowAbortSignal;
|
|
2746
|
+
}) => Promise<LayoutResult | LayoutPositions>;
|
|
2747
|
+
type FlowProjectionListener = (projections: readonly ActiveGraphProjection[]) => void;
|
|
2748
|
+
type FlowTransactionOptions = {
|
|
2749
|
+
transactionId?: string;
|
|
2750
|
+
origin?: string;
|
|
2751
|
+
};
|
|
2752
|
+
type FlowReplaceGraphOptions = FlowTransactionOptions & {
|
|
2753
|
+
/**
|
|
2754
|
+
* `preserve` keeps state addressed to surviving entity ids and prunes stale
|
|
2755
|
+
* references. `reset` clears selection and other session-scoped graph state.
|
|
2756
|
+
* Defaults to `preserve`.
|
|
2757
|
+
*/
|
|
2758
|
+
retention?: FlowGraphRetentionPolicy;
|
|
2759
|
+
/**
|
|
2760
|
+
* `reset` clears controller undo/redo history, `ignore` keeps existing
|
|
2761
|
+
* history without recording this replacement, and `record` creates an undo
|
|
2762
|
+
* step. Defaults to `reset` for authoritative external synchronization.
|
|
2763
|
+
*/
|
|
2764
|
+
history?: FlowGraphHistoryPolicy;
|
|
2765
|
+
};
|
|
2766
|
+
type FlowCreateIdContext = {
|
|
2767
|
+
kind: 'node' | 'edge';
|
|
2768
|
+
reason: 'create' | 'content';
|
|
2769
|
+
sourceId?: string;
|
|
2770
|
+
attempt: number;
|
|
2771
|
+
};
|
|
2772
|
+
type CreateNodeInput<TNodeData = any> = Omit<Parameters<typeof createNode<TNodeData>>[0], 'id'> & {
|
|
2773
|
+
id?: string;
|
|
2774
|
+
};
|
|
2775
|
+
type CreateEdgeInput<TEdgeData = any, TLabelData = any> = Omit<Parameters<typeof createEdge<TEdgeData, TLabelData>>[0], 'id'> & {
|
|
2776
|
+
id?: string;
|
|
2777
|
+
};
|
|
2778
|
+
type FlowNodesApi<TNodeData = any> = {
|
|
2779
|
+
create: (input: CreateNodeInput<TNodeData>, options?: FlowTransactionOptions) => FlowNode<TNodeData>;
|
|
2780
|
+
delete: (id: string, options?: FlowTransactionOptions) => boolean;
|
|
2781
|
+
update: (id: string, patchOrUpdater: FlowNodePatch | FlowNodeUpdater, options?: FlowTransactionOptions) => FlowNode<TNodeData>;
|
|
2782
|
+
setData: (id: string, data: (TNodeData extends object ? Partial<TNodeData> : never) | ((current: TNodeData, node: FlowNode<TNodeData>) => TNodeData), options?: FlowTransactionOptions) => FlowNode<TNodeData>;
|
|
2783
|
+
reparent: (id: string, parentId: string | null, options?: FlowTransactionOptions) => FlowNode<TNodeData>;
|
|
2784
|
+
collapse: (id: string, options?: FlowTransactionOptions) => void;
|
|
2785
|
+
expand: (id: string, options?: FlowTransactionOptions) => void;
|
|
2786
|
+
};
|
|
2787
|
+
type FlowEdgesApi<TEdgeData = any, TLabelData = any> = {
|
|
2788
|
+
create: (input: CreateEdgeInput<TEdgeData, TLabelData>, options?: FlowTransactionOptions) => FlowEdge<TEdgeData, TLabelData>;
|
|
2789
|
+
delete: (id: string, options?: FlowTransactionOptions) => boolean;
|
|
2790
|
+
update: (id: string, patchOrUpdater: FlowEdgePatch | FlowEdgeUpdater, options?: FlowTransactionOptions) => FlowEdge<TEdgeData, TLabelData>;
|
|
2791
|
+
setData: (id: string, data: (TEdgeData extends object ? Partial<TEdgeData> : never) | ((current: TEdgeData, edge: FlowEdge<TEdgeData, TLabelData>) => TEdgeData), options?: FlowTransactionOptions) => FlowEdge<TEdgeData, TLabelData>;
|
|
2792
|
+
reconnect: (edgeId: string, patch: {
|
|
2793
|
+
newSourceId?: string;
|
|
2794
|
+
newTargetId?: string;
|
|
2795
|
+
newSourcePort?: string | null;
|
|
2796
|
+
newTargetPort?: string | null;
|
|
2797
|
+
}, options?: FlowTransactionOptions) => FlowEdge<TEdgeData, TLabelData>;
|
|
2798
|
+
};
|
|
2799
|
+
type FlowSelectionAlignment = 'left' | 'right' | 'top' | 'bottom' | 'center-x' | 'center-y';
|
|
2800
|
+
type FlowSelectionDistribution = 'horizontal' | 'vertical';
|
|
2801
|
+
type FlowSelectionDuplicateResult = {
|
|
2802
|
+
nodeIds: string[];
|
|
2803
|
+
edgeIds: string[];
|
|
2804
|
+
idMap: ReadonlyMap<string, string>;
|
|
2805
|
+
};
|
|
2806
|
+
type FlowSelectionApi = {
|
|
2807
|
+
set: (ids: string[], mode?: 'single' | 'multi') => void;
|
|
2808
|
+
all: (options?: {
|
|
2809
|
+
includeHidden?: boolean;
|
|
2810
|
+
}) => void;
|
|
2811
|
+
clear: () => void;
|
|
2812
|
+
delete: () => boolean;
|
|
2813
|
+
duplicate: (options?: {
|
|
2814
|
+
offset?: Point;
|
|
2815
|
+
}) => FlowSelectionDuplicateResult | null;
|
|
2816
|
+
align: (alignment: FlowSelectionAlignment) => boolean;
|
|
2817
|
+
distribute: (distribution: FlowSelectionDistribution) => boolean;
|
|
2818
|
+
};
|
|
2819
|
+
type FlowViewApi<TNodeData = any, TEdgeData = any, TLabelData = any> = {
|
|
2820
|
+
getScope: () => FlowViewScope;
|
|
2821
|
+
setScope: (scope: FlowViewScope, options?: {
|
|
2822
|
+
selection?: FlowViewSelectionPolicy;
|
|
2823
|
+
}) => void;
|
|
2824
|
+
getEntities: (options?: {
|
|
2825
|
+
includeHidden?: boolean;
|
|
2826
|
+
}) => FlowViewEntities<TNodeData, TEdgeData, TLabelData>;
|
|
2827
|
+
getBoundaryEndpoints: (edgeId: string) => FlowViewBoundaryEndpoints | undefined;
|
|
2828
|
+
contains: (id: string, options?: {
|
|
2829
|
+
includeHidden?: boolean;
|
|
2830
|
+
}) => boolean;
|
|
2831
|
+
};
|
|
2832
|
+
type FlowViewportApi = {
|
|
2833
|
+
set: (viewport: FlowStoreContext['viewport'], options?: ViewportAnimationOptions) => ViewportAnimationControls;
|
|
2834
|
+
panBy: (point: Point, options?: ViewportAnimationOptions) => ViewportAnimationControls;
|
|
2835
|
+
zoomTo: (zoom: number, center?: Point, options?: ViewportAnimationOptions) => ViewportAnimationControls;
|
|
2836
|
+
zoomBy: (factor: number, center?: Point, options?: ViewportAnimationOptions) => ViewportAnimationControls;
|
|
2837
|
+
fit: (options?: FitViewOptions & {
|
|
2838
|
+
includeHidden?: boolean;
|
|
2839
|
+
}) => ViewportAnimationControls;
|
|
2840
|
+
fitBounds: (bounds: Rect, options?: Omit<FitViewOptions, 'nodes'>) => ViewportAnimationControls;
|
|
2841
|
+
centerOn: (point: Point, options?: Omit<ViewportAnimationOptions, 'center'> & {
|
|
2842
|
+
zoom?: number;
|
|
2843
|
+
frame?: Rect;
|
|
2844
|
+
}) => ViewportAnimationControls;
|
|
2845
|
+
getFitFrame: () => Readonly<Rect>;
|
|
2846
|
+
setFitFrame: (frame: Rect | null) => void;
|
|
2847
|
+
};
|
|
2848
|
+
type FlowLayoutApi<TNodeData = any, TEdgeData = any, TLabelData = any> = {
|
|
2849
|
+
run: (layout?: LayoutAlgorithm<TNodeData, TEdgeData, TLabelData>, options?: LayoutRunOptions) => Promise<LayoutRunResult>;
|
|
2850
|
+
apply: (result: LayoutResult, options?: LayoutApplyOptions) => LayoutAnimationControls;
|
|
2851
|
+
request: (algorithm?: string) => void;
|
|
2852
|
+
};
|
|
2853
|
+
type FlowHistoryApi = {
|
|
2854
|
+
undo: () => void;
|
|
2855
|
+
redo: () => void;
|
|
2856
|
+
canUndo: () => boolean;
|
|
2857
|
+
canRedo: () => boolean;
|
|
2858
|
+
};
|
|
2859
|
+
type FlowConnection = {
|
|
2860
|
+
edge: FlowEdge;
|
|
2861
|
+
source: {
|
|
2862
|
+
nodeId: string;
|
|
2863
|
+
port: string | null;
|
|
2864
|
+
};
|
|
2865
|
+
target: {
|
|
2866
|
+
nodeId: string;
|
|
2867
|
+
port: string | null;
|
|
2868
|
+
};
|
|
2869
|
+
};
|
|
2870
|
+
type FlowConnectionsApi = {
|
|
2871
|
+
get: (input: {
|
|
2872
|
+
nodeId: string;
|
|
2873
|
+
port?: string | null;
|
|
2874
|
+
direction?: 'in' | 'out' | 'both';
|
|
2875
|
+
}) => FlowConnection[];
|
|
2876
|
+
};
|
|
2877
|
+
type FlowContentApi<TNodeData = any, TEdgeData = any, TLabelData = any> = {
|
|
2878
|
+
extract: (targets?: Iterable<string>) => FlowContent<TNodeData, TEdgeData, TLabelData> | null;
|
|
2879
|
+
insert: (content: unknown, options?: {
|
|
2880
|
+
point?: Point;
|
|
2881
|
+
preservePosition?: boolean;
|
|
2882
|
+
}) => FlowResult<{
|
|
2883
|
+
nodeIds: string[];
|
|
2884
|
+
edgeIds: string[];
|
|
2885
|
+
idMap: ReadonlyMap<string, string>;
|
|
2886
|
+
changeSet: FlowChangeSet<TNodeData, TEdgeData, TLabelData>;
|
|
2887
|
+
}>;
|
|
2888
|
+
};
|
|
2889
|
+
type FlowCapabilityCommand = 'create' | 'move' | 'resize' | 'connect' | 'reconnect' | 'reparent' | 'delete' | 'cut' | 'paste' | 'undo' | 'redo' | 'copy' | 'export' | 'select' | 'pan' | 'zoom';
|
|
2890
|
+
type FlowCapabilityResult = {
|
|
2891
|
+
allowed: true;
|
|
2892
|
+
} | {
|
|
2893
|
+
allowed: false;
|
|
2894
|
+
reason: {
|
|
2895
|
+
code: 'readonly' | 'policy' | 'entity' | 'empty' | 'history';
|
|
2896
|
+
command: FlowCapabilityCommand;
|
|
2897
|
+
};
|
|
2898
|
+
};
|
|
2899
|
+
type FlowHighlightsApi = {
|
|
2900
|
+
set: (kind: string, entries: FlowHighlightEntry[]) => void;
|
|
2901
|
+
add: (kind: string, entries: FlowHighlightEntry[]) => void;
|
|
2902
|
+
remove: (kind: string, ids: string[]) => void;
|
|
2903
|
+
clear: (kind?: string) => void;
|
|
2904
|
+
};
|
|
2905
|
+
type FlowProjectionsApi = {
|
|
2906
|
+
get: () => readonly ActiveGraphProjection[];
|
|
2907
|
+
set: (projections: readonly ActiveGraphProjection[]) => void;
|
|
2908
|
+
add: (projection: ActiveGraphProjection) => void;
|
|
2909
|
+
remove: (id: string) => void;
|
|
2910
|
+
clear: () => void;
|
|
2911
|
+
subscribe: (listener: FlowProjectionListener) => () => void;
|
|
2912
|
+
getAttrs: () => ComposedGraphProjectionAttrs;
|
|
2913
|
+
};
|
|
2914
|
+
type FlowConfigureOptions = {
|
|
2915
|
+
engine?: Partial<FlowEngineOptions>;
|
|
2916
|
+
store?: Partial<FlowStoreOptions>;
|
|
2917
|
+
defaultEdgeOptions?: Partial<CreateEdgeInput> | null;
|
|
2918
|
+
/**
|
|
2919
|
+
* Runtime toggle for auto-creating an edge when a connection gesture ends on a
|
|
2920
|
+
* node. See {@link CreateFlowOptions.createEdgeOnConnect}.
|
|
2921
|
+
*/
|
|
2922
|
+
createEdgeOnConnect?: boolean;
|
|
2923
|
+
layout?: LayoutAlgorithm | null;
|
|
2924
|
+
historyLimit?: number;
|
|
2925
|
+
};
|
|
2926
|
+
type FlowConfiguration = {
|
|
2927
|
+
engine: FlowEngineOptions;
|
|
2928
|
+
store: FlowStoreOptions;
|
|
2929
|
+
defaultEdgeOptions: Partial<CreateEdgeInput> | null;
|
|
2930
|
+
createEdgeOnConnect: boolean;
|
|
2931
|
+
layout: LayoutAlgorithm | null;
|
|
2932
|
+
historyLimit: number;
|
|
2933
|
+
};
|
|
2934
|
+
type FlowCommitEvent<TNodeData = any, TEdgeData = any, TLabelData = any> = {
|
|
2935
|
+
type: 'commit';
|
|
2936
|
+
changeSet: FlowChangeSet<TNodeData, TEdgeData, TLabelData>;
|
|
2937
|
+
origin?: string;
|
|
2938
|
+
transactionId?: string;
|
|
2939
|
+
revision: number;
|
|
2940
|
+
};
|
|
2941
|
+
type FlowTransactionDraft<TNodeData = any, TEdgeData = any, TLabelData = any> = {
|
|
2942
|
+
nodes: Omit<FlowNodesApi<TNodeData>, 'collapse' | 'expand'>;
|
|
2943
|
+
edges: FlowEdgesApi<TEdgeData, TLabelData>;
|
|
2944
|
+
};
|
|
2945
|
+
interface CreateFlowOptions<TNodeData = any, TEdgeData = any, TLabelData = any> {
|
|
1695
2946
|
/** Initial graph owned by the controller. */
|
|
1696
|
-
graph?: FlowGraph<TNodeData, TEdgeData>;
|
|
1697
|
-
/**
|
|
1698
|
-
layout?: LayoutAlgorithm<TNodeData, TEdgeData> | null;
|
|
1699
|
-
/** Store creation options. */
|
|
2947
|
+
graph?: FlowGraph<TNodeData, TEdgeData, TLabelData>;
|
|
2948
|
+
/** Construct-only default layout algorithm used by `flow.layout.run()`. */
|
|
2949
|
+
layout?: LayoutAlgorithm<TNodeData, TEdgeData, TLabelData> | null;
|
|
2950
|
+
/** Store creation options; runtime settings can later change via `flow.configure({ store })`. */
|
|
1700
2951
|
store?: FlowStoreOptions;
|
|
1701
|
-
/** Engine
|
|
2952
|
+
/** Engine options; runtime-updatable via `flow.configure({ engine })`. */
|
|
1702
2953
|
engine?: FlowEngineOptions;
|
|
2954
|
+
/** Default options merged into controller-created edges; runtime-updatable via `flow.configure`. */
|
|
2955
|
+
defaultEdgeOptions?: Partial<CreateEdgeInput<TEdgeData, TLabelData>>;
|
|
2956
|
+
/** Initial active visual projections; runtime-updatable via `flow.projections`. */
|
|
2957
|
+
projections?: readonly ActiveGraphProjection[];
|
|
1703
2958
|
/** Optional listener for completed connection gestures. */
|
|
1704
2959
|
onConnectionEnd?: (event: ConnectionEndedEvent) => void;
|
|
2960
|
+
/**
|
|
2961
|
+
* When `true`, the controller auto-creates an edge whenever a connection
|
|
2962
|
+
* gesture ends on a valid target node (applying {@link CreateFlowOptions.defaultEdgeOptions},
|
|
2963
|
+
* and skipping reconnection gestures). Defaults to `false`: `connectionEnded`
|
|
2964
|
+
* is then a pure notification (`onConnectionEnd` still fires), leaving edge
|
|
2965
|
+
* creation to the consumer via `flow.edges.create(...)`. Runtime-updatable via
|
|
2966
|
+
* `flow.configure`.
|
|
2967
|
+
*/
|
|
2968
|
+
createEdgeOnConnect?: boolean;
|
|
2969
|
+
/** Creates opaque entity ids when `create()` is called without an explicit id. */
|
|
2970
|
+
createId?: (context: FlowCreateIdContext) => string;
|
|
2971
|
+
/** Optional Standard Schema-compatible contracts for application data. */
|
|
2972
|
+
dataSchemas?: FlowDataSchemas<TNodeData, TEdgeData, TLabelData>;
|
|
1705
2973
|
}
|
|
1706
|
-
interface FlowController {
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
2974
|
+
interface FlowController<TNodeData = any, TEdgeData = any, TLabelData = any> {
|
|
2975
|
+
internals: {
|
|
2976
|
+
store: FlowStore;
|
|
2977
|
+
engine: FlowEngine;
|
|
2978
|
+
};
|
|
2979
|
+
on: FlowStore['on'] & ((type: 'commit', listener: (event: FlowCommitEvent<TNodeData, TEdgeData, TLabelData>) => void) => {
|
|
2980
|
+
unsubscribe: () => void;
|
|
2981
|
+
});
|
|
1711
2982
|
destroy: () => void;
|
|
1712
2983
|
getContext: () => FlowStoreContext;
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
2984
|
+
getSnapshot: () => FlowStoreContext;
|
|
2985
|
+
subscribe: {
|
|
2986
|
+
(listener: (context: FlowStoreContext) => void): () => void;
|
|
2987
|
+
<TSelected>(selector: (context: FlowStoreContext) => TSelected, listener: (selected: TSelected, previous: TSelected) => void, options?: {
|
|
2988
|
+
equals?: (a: TSelected, b: TSelected) => boolean;
|
|
2989
|
+
emitInitial?: boolean;
|
|
2990
|
+
}): () => void;
|
|
2991
|
+
};
|
|
2992
|
+
configure: (options: FlowConfigureOptions | ((current: Readonly<FlowConfiguration>) => FlowConfiguration)) => void;
|
|
2993
|
+
getConfiguration: () => Readonly<FlowConfiguration>;
|
|
2994
|
+
toJSON: () => FlowSerialized<TNodeData, TEdgeData, TLabelData>;
|
|
2995
|
+
load: (data: unknown) => FlowResult<void>;
|
|
2996
|
+
replaceGraph: (graph: FlowGraph<TNodeData, TEdgeData, TLabelData>, options?: FlowReplaceGraphOptions) => FlowChangeSet<TNodeData, TEdgeData, TLabelData> | null;
|
|
2997
|
+
transaction: <TValue>(callback: (draft: FlowTransactionDraft<TNodeData, TEdgeData, TLabelData>) => TValue, options?: FlowTransactionOptions) => {
|
|
2998
|
+
value: TValue;
|
|
2999
|
+
changeSet: FlowChangeSet<TNodeData, TEdgeData, TLabelData> | null;
|
|
3000
|
+
};
|
|
3001
|
+
applyChangeSet: (changeSet: FlowChangeSet<TNodeData, TEdgeData, TLabelData>, options?: {
|
|
3002
|
+
strict?: boolean;
|
|
3003
|
+
origin?: string;
|
|
3004
|
+
transactionId?: string;
|
|
3005
|
+
}) => FlowResult<FlowChangeSet<TNodeData, TEdgeData, TLabelData> | null>;
|
|
3006
|
+
getNode: (id: string) => FlowNode<TNodeData> | undefined;
|
|
3007
|
+
getEdge: (id: string) => FlowEdge<TEdgeData, TLabelData> | undefined;
|
|
3008
|
+
getEntity: (id: string) => FlowNode<TNodeData> | FlowEdge<TEdgeData, TLabelData> | undefined;
|
|
3009
|
+
getEntityRef: (id: string) => FlowEntityRef | undefined;
|
|
3010
|
+
/** @deprecated Use `getEntityRef()`. */
|
|
3011
|
+
getAddressable: (id: string) => FlowEntityRef | undefined;
|
|
3012
|
+
getOwnerEntity: (id: string) => FlowNode<TNodeData> | FlowEdge<TEdgeData, TLabelData> | undefined;
|
|
3013
|
+
getBounds: (id: string) => Rect | undefined;
|
|
1720
3014
|
screenToCanvas: (point: Point) => Point;
|
|
1721
3015
|
canvasToScreen: (point: Point) => Point;
|
|
1722
3016
|
getAllEdgePaths: (options?: EdgePathOptions) => Map<string, EdgePathData>;
|
|
3017
|
+
getConnectionCandidate: (pointer: Point, options?: ConnectionCandidateOptions) => ConnectionCandidate | null;
|
|
1723
3018
|
getGraphBounds: () => Rect;
|
|
3019
|
+
getIncomers: (nodeId: string) => FlowNode[];
|
|
3020
|
+
getOutgoers: (nodeId: string) => FlowNode[];
|
|
3021
|
+
getConnectedEdges: (nodeIds: Iterable<string>) => FlowEdge[];
|
|
3022
|
+
getNeighbors: (nodeId: string) => FlowNode[];
|
|
1724
3023
|
getSelectionBounds: () => Rect | null;
|
|
1725
3024
|
getRenderableEntities: (options?: RenderableEntitiesOptions) => {
|
|
1726
3025
|
nodes: FlowNode[];
|
|
1727
3026
|
edges: FlowEdge[];
|
|
1728
3027
|
};
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
3028
|
+
getEntityOrder: () => {
|
|
3029
|
+
nodes: FlowNode[];
|
|
3030
|
+
edges: FlowEdge[];
|
|
3031
|
+
};
|
|
3032
|
+
check: (command: FlowCapabilityCommand, input?: {
|
|
3033
|
+
id?: string;
|
|
3034
|
+
}) => FlowCapabilityResult;
|
|
3035
|
+
can: (command: FlowCapabilityCommand, input?: {
|
|
3036
|
+
id?: string;
|
|
3037
|
+
}) => boolean;
|
|
3038
|
+
mode: {
|
|
3039
|
+
get: () => string;
|
|
3040
|
+
set: (mode: string) => void;
|
|
3041
|
+
};
|
|
3042
|
+
nodes: FlowNodesApi<TNodeData>;
|
|
3043
|
+
edges: FlowEdgesApi<TEdgeData, TLabelData>;
|
|
3044
|
+
selection: FlowSelectionApi;
|
|
3045
|
+
view: FlowViewApi<TNodeData, TEdgeData, TLabelData>;
|
|
3046
|
+
viewport: FlowViewportApi;
|
|
3047
|
+
layout: FlowLayoutApi<TNodeData, TEdgeData, TLabelData>;
|
|
3048
|
+
history: FlowHistoryApi;
|
|
3049
|
+
highlights: FlowHighlightsApi;
|
|
3050
|
+
projections: FlowProjectionsApi;
|
|
3051
|
+
connections: FlowConnectionsApi;
|
|
3052
|
+
content: FlowContentApi<TNodeData, TEdgeData, TLabelData>;
|
|
1738
3053
|
}
|
|
1739
|
-
declare function createFlow<TNodeData = any, TEdgeData = any>(options?: CreateFlowOptions<TNodeData, TEdgeData>): FlowController
|
|
3054
|
+
declare function createFlow<TNodeData = any, TEdgeData = any, TLabelData = any>(options?: CreateFlowOptions<TNodeData, TEdgeData, TLabelData>): FlowController<TNodeData, TEdgeData, TLabelData>;
|
|
3055
|
+
declare function fromJSON<TNodeData = any, TEdgeData = any, TLabelData = any>(data: unknown, options?: Omit<CreateFlowOptions<TNodeData, TEdgeData, TLabelData>, 'graph'>): FlowController<TNodeData, TEdgeData, TLabelData>;
|
|
1740
3056
|
//#endregion
|
|
1741
3057
|
//#region src/connectionPreview.d.ts
|
|
1742
3058
|
declare const CONNECTION_PREVIEW_NODE_ID = "flow:connection-preview-node";
|
|
@@ -1756,24 +3072,27 @@ type ConnectionPreviewGraphOptions = {
|
|
|
1756
3072
|
declare function createConnectionPreviewGraph<TNodeData = any, TEdgeData = any>(graph: FlowGraph<TNodeData, TEdgeData>, connection: ConnectionState | null, options?: ConnectionPreviewGraphOptions): FlowGraph<TNodeData | ConnectionPreviewData, TEdgeData | ConnectionPreviewData>;
|
|
1757
3073
|
//#endregion
|
|
1758
3074
|
//#region src/spatial.d.ts
|
|
1759
|
-
/**
|
|
1760
|
-
declare function
|
|
1761
|
-
/**
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
*
|
|
1768
|
-
*
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
declare function
|
|
3075
|
+
/** Visual position: layout position + drag offset. */
|
|
3076
|
+
declare function visualPosition(node: FlowNode): Point;
|
|
3077
|
+
/** @deprecated Use `visualPosition`. */
|
|
3078
|
+
declare const resolvedPosition: typeof visualPosition;
|
|
3079
|
+
declare function visualBounds(node: FlowNode): Rect;
|
|
3080
|
+
/** @deprecated Use `visualBounds`. */
|
|
3081
|
+
declare const resolvedBounds: typeof visualBounds;
|
|
3082
|
+
/**
|
|
3083
|
+
* Size used for edge-label geometry. `autoSize` labels retain authored
|
|
3084
|
+
* dimensions as a fallback while a transient DOM measurement owns the live
|
|
3085
|
+
* size. The measurement never becomes authored graph data.
|
|
3086
|
+
*/
|
|
3087
|
+
declare function resolvedEdgeLabelSize(label: NonNullable<FlowEdge['label']>, measurement?: Rect): Size;
|
|
3088
|
+
/** Fixed-position visual bounds for an edge label. */
|
|
3089
|
+
declare function resolvedEdgeLabelBounds(edge: FlowEdge, measurement?: Rect): Rect | null;
|
|
3090
|
+
/** Visual bounds with grid snap and/or entity snap-line offset. */
|
|
3091
|
+
declare function snappedBounds(node: FlowNode, grid: [number, number] | null,
|
|
3092
|
+
/** Optional snap offset from entity snap lines (snapRect.x - selectionRect.x) */
|
|
1774
3093
|
snapOffset?: Point | null): Rect;
|
|
1775
3094
|
/** Compute bounding rect of all nodes + edge labels (resolved positions) */
|
|
1776
|
-
declare function getGraphBounds(nodes: FlowNode[], edges?: FlowEdge[]): Rect;
|
|
3095
|
+
declare function getGraphBounds(nodes: FlowNode[], edges?: FlowEdge[], measurements?: ReadonlyMap<string, Rect>): Rect;
|
|
1777
3096
|
/** AABB intersection test */
|
|
1778
3097
|
declare function rectsIntersect(a: Rect, b: Rect): boolean;
|
|
1779
3098
|
/** Smallest axis-aligned rect containing both `a` and `b`. */
|
|
@@ -1785,7 +3104,7 @@ declare function snapPointToGrid(point: Point, gridSize: number): Point;
|
|
|
1785
3104
|
/** Normalize a box (two points) into a Rect with positive width/height */
|
|
1786
3105
|
declare function boxToRect(p1: Point, p2: Point): Rect;
|
|
1787
3106
|
/** Get bounding rect of specific entities by id */
|
|
1788
|
-
declare function getSelectionBounds(nodes: FlowNode[], edges: FlowEdge[], selection: Set<string>): Rect | null;
|
|
3107
|
+
declare function getSelectionBounds(nodes: FlowNode[], edges: FlowEdge[], selection: Set<string>, measurements?: ReadonlyMap<string, Rect>): Rect | null;
|
|
1789
3108
|
/** Determine select mode from a pointer/keyboard event */
|
|
1790
3109
|
declare function selectMode(e: {
|
|
1791
3110
|
shiftKey?: boolean;
|
|
@@ -1892,43 +3211,6 @@ type AnchorTransform = {
|
|
|
1892
3211
|
*/
|
|
1893
3212
|
declare function getAnchorTransform(bounds: Rect, viewport: Viewport, anchor: AnchorSpec): AnchorTransform;
|
|
1894
3213
|
//#endregion
|
|
1895
|
-
//#region src/viewport/index.d.ts
|
|
1896
|
-
/** Create a default viewport (origin, no zoom) */
|
|
1897
|
-
declare function createViewport(x?: number, y?: number, zoom?: number): Viewport;
|
|
1898
|
-
/**
|
|
1899
|
-
* Convert viewport to SVG transform string.
|
|
1900
|
-
* Use on the root <g> wrapping all entities.
|
|
1901
|
-
*
|
|
1902
|
-
* @example
|
|
1903
|
-
* <g transform={toSVGTransform(viewport)}>...</g>
|
|
1904
|
-
*/
|
|
1905
|
-
declare function toSVGTransform(viewport: Viewport): string;
|
|
1906
|
-
/**
|
|
1907
|
-
* Convert viewport + container size to an SVG viewBox string.
|
|
1908
|
-
*
|
|
1909
|
-
* @example
|
|
1910
|
-
* <svg viewBox={toViewBox(viewport, { width: 800, height: 600 })}>...</svg>
|
|
1911
|
-
*/
|
|
1912
|
-
declare function toViewBox(viewport: Viewport, size: Size): string;
|
|
1913
|
-
/** Convert a screen-space point to canvas-space */
|
|
1914
|
-
declare function screenToCanvas(point: Point, viewport: Viewport): Point;
|
|
1915
|
-
/** Convert a canvas-space point to screen-space */
|
|
1916
|
-
declare function canvasToScreen(point: Point, viewport: Viewport): Point;
|
|
1917
|
-
/** Get the canvas-space bounding rect of what's visible on screen */
|
|
1918
|
-
declare function getVisibleBounds(viewport: Viewport, size: Size): Rect;
|
|
1919
|
-
/**
|
|
1920
|
-
* Compute a viewport that fits the given bounds into the given screen size.
|
|
1921
|
-
*/
|
|
1922
|
-
declare function viewportForBounds(bounds: Rect, size: Size, options?: FitViewOptions): Viewport;
|
|
1923
|
-
/** Pan viewport by a delta */
|
|
1924
|
-
declare function panBy(viewport: Viewport, delta: Point): Viewport;
|
|
1925
|
-
/** Zoom to a specific level, keeping a screen-space point fixed */
|
|
1926
|
-
declare function zoomTo(viewport: Viewport, zoom: number, center: Point): Viewport;
|
|
1927
|
-
/** Clamp zoom to min/max bounds */
|
|
1928
|
-
declare function clampZoom(zoom: number, minZoom: number, maxZoom: number): number;
|
|
1929
|
-
/** Viewport that places the given canvas point at the center of the screen. */
|
|
1930
|
-
declare function viewportCenteredOn(center: Point, size: Size, zoom: number): Viewport;
|
|
1931
|
-
//#endregion
|
|
1932
3214
|
//#region src/toolbar.d.ts
|
|
1933
3215
|
type ToolbarPlacementInput = {
|
|
1934
3216
|
/** Anchor rect in container-relative screen px (canvas rect × viewport). */
|
|
@@ -1980,8 +3262,18 @@ type MinimapProjection = {
|
|
|
1980
3262
|
declare function getMinimapProjection(options: MinimapProjectionOptions): MinimapProjection;
|
|
1981
3263
|
//#endregion
|
|
1982
3264
|
//#region src/graph-index.d.ts
|
|
3265
|
+
type EdgeAdjacencyIndex = {
|
|
3266
|
+
bySource: Map<string, FlowEdge[]>;
|
|
3267
|
+
byTarget: Map<string, FlowEdge[]>;
|
|
3268
|
+
byNode: Map<string, FlowEdge[]>;
|
|
3269
|
+
};
|
|
1983
3270
|
declare function indexNodes(nodes: FlowNode[]): Map<string, FlowNode>;
|
|
1984
3271
|
declare function indexEdges(edges: FlowEdge[]): Map<string, FlowEdge>;
|
|
3272
|
+
declare function indexEdgeAdjacency(edges: FlowEdge[]): EdgeAdjacencyIndex;
|
|
3273
|
+
declare function getIncomers(graph: FlowGraph, nodeId: string): FlowNode[];
|
|
3274
|
+
declare function getOutgoers(graph: FlowGraph, nodeId: string): FlowNode[];
|
|
3275
|
+
declare function getConnectedEdges(graph: FlowGraph, nodeIds: Iterable<string>): FlowEdge[];
|
|
3276
|
+
declare function getNeighbors(graph: FlowGraph, nodeId: string): FlowNode[];
|
|
1985
3277
|
/** parentId → child nodes, cached on array identity. Self-parents ignored. */
|
|
1986
3278
|
declare function indexChildren(nodes: FlowNode[]): Map<string, FlowNode[]>;
|
|
1987
3279
|
/**
|
|
@@ -2003,7 +3295,10 @@ type FlowEntityChangeNotifier = {
|
|
|
2003
3295
|
/** Detach the underlying store subscription and drop all listeners. */
|
|
2004
3296
|
destroy(): void;
|
|
2005
3297
|
};
|
|
2006
|
-
|
|
3298
|
+
type FlowEntityChangeNotifierOptions = {
|
|
3299
|
+
getEdgeDependents?: (edgeId: string) => Iterable<string>;
|
|
3300
|
+
};
|
|
3301
|
+
declare function createEntityChangeNotifier(store: FlowStore, options?: FlowEntityChangeNotifierOptions): FlowEntityChangeNotifier;
|
|
2007
3302
|
//#endregion
|
|
2008
3303
|
//#region src/config.d.ts
|
|
2009
3304
|
/** Default config: everything enabled */
|
|
@@ -2016,20 +3311,4 @@ declare const readonlyConfig: Partial<FlowConfig>;
|
|
|
2016
3311
|
*/
|
|
2017
3312
|
declare function resolveBehavior<TEntity, TState>(predicate: ((entity: TEntity, state: TState) => boolean) | false | undefined, entity: TEntity, state: TState, defaultValue?: boolean): boolean;
|
|
2018
3313
|
//#endregion
|
|
2019
|
-
|
|
2020
|
-
declare function createNode<TData = any>(opts: Partial<FlowNode<TData>> & {
|
|
2021
|
-
id: string;
|
|
2022
|
-
}): FlowNode<TData>;
|
|
2023
|
-
declare function createEdge<TEdgeData = any, TLabelData = any>(opts: Omit<Partial<FlowEdge<TEdgeData, TLabelData>>, 'label'> & Pick<FlowEdge<TEdgeData, TLabelData>, 'id' | 'sourceId' | 'targetId'> & {
|
|
2024
|
-
label?: Partial<FlowEdgeLabel<TLabelData>> & {
|
|
2025
|
-
width: number;
|
|
2026
|
-
height: number;
|
|
2027
|
-
};
|
|
2028
|
-
}): FlowEdge<TEdgeData, TLabelData>;
|
|
2029
|
-
declare function createGraph<TNodeData = any, TEdgeData = any>(opts: Partial<FlowGraph<TNodeData, TEdgeData>> & {
|
|
2030
|
-
nodes: FlowNode<TNodeData>[];
|
|
2031
|
-
edges: FlowEdge<TEdgeData>[];
|
|
2032
|
-
}): FlowGraph<TNodeData, TEdgeData>;
|
|
2033
|
-
declare function createPort<TData = any>(opts: Partial<FlowPort<TData>> & Pick<FlowPort<TData>, 'name' | 'side' | 'direction'>): FlowPort<TData>;
|
|
2034
|
-
//#endregion
|
|
2035
|
-
export { type AnchorSpec, type AnchorTransform, type AutoLayoutState, type BehaviorPredicate, CONNECTION_PREVIEW_EDGE_ID, CONNECTION_PREVIEW_NODE_ID, type CanvasState, type ConnectEndTarget, type ConnectModeOptions, type ConnectionEndedEvent, type ConnectionPreviewData, type ConnectionPreviewGraphOptions, type ConnectionState, type CreateFlowOptions, type Direction, type EdgeDirection, type EdgePathData, type EdgePathOptions, type EdgeRouter, type EdgeRouterContext, type EdgeStyleConfig, type EntityColorSet, type EntityRect, type EntityVisualState, type FitViewOptions, type FlowAddressable, type FlowColorMode, type FlowCommand, type FlowConfig, type FlowController, type FlowEdge, type FlowEdgeAttributes, type FlowEdgeLabel, type FlowEdgeStyle, type FlowEngine, type FlowEngineOptions, type FlowEntitiesDeletedEvent, type FlowEntityChangeNotifier, type FlowErrorEvent, type FlowEventObject, type FlowGraph, type FlowGraphChangedEvent, type FlowHighlightEntry, type FlowHighlights, type FlowInputEffects, type FlowInputEvent, type FlowInputMode, type FlowInputModeContext, type FlowInputModifiers, type FlowInputProfile, type FlowInputReaction, type FlowInputRuntime, type FlowInputRuntimeOptions, type FlowInputSessionHandlers, type FlowInputTarget, type FlowKeyInputEvent, type FlowModeDefinition, type FlowNode, type FlowNodeAttributes, type FlowOrigin, type FlowPointerInputEvent, type FlowPolicies, type FlowPort, type FlowProfile, type FlowResolvers, type FlowRules, type FlowSelectionChangedEvent, type FlowSessionResult, type FlowSettings, type FlowStore, type FlowStoreContext, type FlowStoreOptions, type FlowTheme, type FlowTransition, type FlowTransitions, type FlowTriggerCommand, type FlowTriggerName, type FlowViewportChangedEvent, type FlowWheelInputEvent, type Graph, type GraphEdge, type GraphNode, type GraphPort, type GroupContentSide, type GroupGeometry, type GroupInsets, type GroupLayout, type InteractionMode, type LabelAnchor, type LayoutAlgorithm, type LayoutRequestedEvent, type MarkerType, type MinimapProjection, type MinimapProjectionOptions, type PathData, type Point, type PortDirection, type ProposedConnection, type Rect, type RenderableEntitiesOptions, type ReparentDecision, type ReparentDropContext, type ReparentOptions, type ResizeHandle, type SelectionMode, type ShapeHandler, type Side, type Size, type SnapLine, type SnapOptions, type SnapResult, type SpacingGuide, type StyleOverrides, type ToolbarPlacement, type ToolbarPlacementInput, type Viewport, type ViewportAnimationOptions, type VisualEdge, type VisualGraph, type VisualNode, type VisualPort, type WheelInteraction, type WheelInteractionOptions, bestDirection, bezierRouter, boxToRect, calcAutoPan, canvasToScreen, clampZoom, connectMode, constrainViewport, createConnectionPreviewGraph, createEdge, createEntityChangeNotifier, createFlow, createFlowEngine, createFlowInputRuntime, createFlowStore, createGraph, createNode, createPort, createViewport, defaultConfig, defaultFlowProfile, defaultInputModes, defaultModesForContext, defineFlowProfile, deriveGroupGeometry, entityPressMode, fixedGroupGeometry, getAnchorTransform, getAutoPanDelta, getEdgeOwner, getGraphBounds, getMinimapProjection, getSelectionBounds, getShape, getShapeOrDefault, getSnapLines, getToolbarPlacement, getVisibleBounds, hoverMode, indexChildren, indexEdges, indexNodes, isDerivedGroup, isGroup, isTrackpadPinch, keyboardMode, keyboardNavMode, nodeDepths, normalizeWheelPan, panBy, panMode, panePressMode, pathToSVG, preventDefault, profileModesForContext, readonlyConfig, readonlyInputModes, rectContains, rectsIntersect, registerShape, resolveBehavior, resolveGroupPadding, resolvedBounds, resolvedPosition, screenToCanvas, selectMode, snapPointToGrid, snapToGrid, snappedBounds, stepRouter, straightRouter, toSVGTransform, toViewBox, trigger, unionRect, viewportCenteredOn, viewportForBounds, wheelInteraction, wheelMode, wheelZoomDelta, zoomTo };
|
|
3314
|
+
export { type ActiveGraphProjection, type AnchorSpec, type AnchorTransform, type AnimateViewportOptions, type AutoLayoutState, type AvoidRouterOptions, type BehaviorPredicate, type BezierRouterOptions, type BoxSelectModeOptions, type BoxSelectionTest, CONNECTION_PREVIEW_EDGE_ID, CONNECTION_PREVIEW_NODE_ID, type CanvasState, type ComposedGraphProjectionAttrs, type ConnectEndTarget, type ConnectModeOptions, type ConnectionCandidate, type ConnectionCandidateOptions, type ConnectionCandidateSource, type ConnectionEndedEvent, type ConnectionPreviewData, type ConnectionPreviewGraphOptions, type ConnectionState, type ConnectionValidationContext, type ConnectionValidationResult, type CreateEdgeInput, type CreateFlowOptions, type CreateNodeInput, type Direction, type EdgeAdjacencyIndex, type EdgeDirection, type EdgePathData, type EdgePathOptions, type EdgeRouter, type EdgeRouterContext, type EdgeRouterGraph, type EdgeSourceBoundsContext, type EntityRect, type EntityVisualState, type FitViewOptions, type FlowAbortSignal, type FlowAddressable, type FlowAutoSizeAnchor, type FlowCapabilityCommand, type FlowCapabilityResult, type FlowChangeSet, type FlowColorMode, type FlowCommand, type FlowCommitEvent, type FlowConfig, type FlowConfiguration, type FlowConfigureOptions, type FlowConnectMovedEvent, type FlowConnectStartedEvent, type FlowConnection, type FlowConnectionMode, type FlowConnectionOptions, type FlowConnectionsApi, type FlowContent, type FlowContentApi, type FlowContentInsertResult, type FlowController, type FlowCreateIdContext, type FlowDataSchema, type FlowDataSchemas, type FlowDataVersions, type FlowDragEndedEvent, type FlowDragMovedEvent, type FlowDragStartedEvent, type FlowEdge, type FlowEdgeAttributes, type FlowEdgeLabel, type FlowEdgePatch, type FlowEdgeStyle, type FlowEdgeUpdater, type FlowEdgesApi, type FlowEngine, type FlowEngineOptions, type FlowEntitiesDeletedEvent, type FlowEntityChangeNotifier, type FlowEntityChangeNotifierOptions, type FlowEntityGestureEvent, type FlowEntityRef, type FlowEntityUpdate, type FlowErrorEvent, type FlowEventObject, type FlowGestureModifiers, type FlowGraph, type FlowGraphChangedEvent, type FlowGraphHistoryPolicy, type FlowGraphRetentionPolicy, FlowGraphValidationError, type FlowHighlightEntry, type FlowHighlights, type FlowHighlightsApi, type FlowHistoryApi, type FlowInputEffects, type FlowInputEvent, type FlowInputMode, type FlowInputModeContext, type FlowInputModifiers, type FlowInputProfile, type FlowInputReaction, type FlowInputRuntime, type FlowInputRuntimeOptions, type FlowInputSessionHandlers, type FlowInputTarget, type FlowKeyBinding, type FlowKeyInputEvent, type FlowKeymap, type FlowLayoutApi, type FlowModeDefinition, type FlowNode, type FlowNodeAttributes, type FlowNodePatch, type FlowNodeUpdater, type FlowNodesApi, type FlowOrigin, type FlowPaneGestureEvent, type FlowPatch, type FlowPinchInputEvent, type FlowPointerInputEvent, type FlowPolicies, type FlowPort, type FlowProfile, type FlowProjectionListener, type FlowProjectionsApi, type FlowReplaceGraphOptions, type FlowResizeEndedEvent, type FlowResizeStartedEvent, type FlowResolvers, type FlowResult, type FlowRules, type FlowRuntimeSettings, type FlowSelectionAlignment, type FlowSelectionApi, type FlowSelectionChangedEvent, type FlowSelectionDistribution, type FlowSelectionDuplicateResult, type FlowSerialized, type FlowSessionResult, type FlowSettings, type FlowStore, type FlowStoreContext, type FlowStoreOptions, type FlowTransactionDraft, type FlowTransactionOptions, type FlowTransition, type FlowTransitions, type FlowTriggerCommand, type FlowTriggerName, type FlowUpdateEdgeEvent, type FlowUpdateNodeEvent, type FlowValidationIssue, type FlowViewApi, type FlowViewBoundaryEndpoints, type FlowViewChangedEvent, type FlowViewEndpoint, type FlowViewEntities, type FlowViewScope, type FlowViewSelectionPolicy, type FlowViewportApi, type FlowViewportChangedEvent, type FlowWheelInputEvent, type Graph, type GraphDecoration, type GraphEdge, type GraphEdgeAttrs, type GraphNode, type GraphNodeAttrs, type GraphPort, type GraphProjection, type GraphProjectionMapper, type GroupContentSide, type GroupGeometry, type GroupInsets, type GroupLayout, type InteractionMode, type LabelAnchor, type LayoutAlgorithm, type LayoutAnimationControls, type LayoutAnimationOptions, type LayoutApplyOptions, type LayoutDiagnostic, type LayoutEdgeRoute, type LayoutPositions, type LayoutRequestedEvent, type LayoutResult, type LayoutRunOptions, type LayoutRunResult, type MarkerType, type MinimapProjection, type MinimapProjectionOptions, type PathData, type Point, type PortDirection, type ProposedConnection, type ReconnectModeOptions, type Rect, type RenderableEntitiesOptions, type ReparentDecision, type ReparentDropContext, type ReparentOptions, type ResizeConstraints, type ResizeHandle, type SelectionMode, type ShapeHandler, type Side, type Size, type SnapLine, type SnapOptions, type SnapResult, type SpacingGuide, type StandardSchemaV1Like, type StepRouterOptions, type StyleOverrides, type ToolbarPlacement, type ToolbarPlacementInput, type Viewport, type ViewportAnimationCancelFrame, type ViewportAnimationControls, type ViewportAnimationFrame, type ViewportAnimationOptions, type VisualEdge, type VisualGraph, type VisualNode, type VisualPort, type WheelInteraction, type WheelInteractionOptions, animateViewport, applyFlowPatches, areNodesMeasured, avoidRouter, bestDirection, bezierRouter, boxSelectMode, boxToRect, calcAutoPan, canvasToScreen, clampZoom, cloneJsonSafe, composeGraphProjectionAttrs, configureAvoidRouter, configureBezierRouter, configureStepRouter, connectMode, constrainViewport, createConnectionPreviewGraph, createEdge, createEntityChangeNotifier, createFlow, createFlowChangeSet, createFlowEngine, createFlowInputRuntime, createFlowStore, createGraph, createNode, createPort, createViewport, defaultConfig, defaultFlowProfile, defaultInputModes, defaultInputModesForKeymap, defaultKeymap, defaultModesForContext, defineFlowProfile, deriveFlowView, deriveGroupGeometry, entityPressMode, extractFlowContent, fixedGroupGeometry, fromJSON, getAnchorTransform, getAutoPanDelta, getConnectedEdges, getEdgeOwner, getGraphBounds, getIncomers, getMinimapProjection, getNeighbors, getOutgoers, getProjectedEdgeAttrs, getProjectedNodeAttrs, getSelectionBounds, getShape, getShapeOrDefault, getSnapLines, getToolbarPlacement, getVisibleBounds, hoverMode, indexChildren, indexEdgeAdjacency, indexEdges, indexNodes, insertFlowContent, isDerivedGroup, isGroup, isTrackpadPinch, keyboardMode, keyboardNavMode, matchesKeyBinding, mergeGraphEdgeAttrs, mergeGraphNodeAttrs, nodeDepths, normalizeWheelPan, panBy, panMode, panePressMode, parseFlowSerialized, pathToSVG, pinchMode, preventDefault, profileModesForContext, profilePoliciesForContext, readonlyConfig, readonlyInputModes, readonlyInputModesForKeymap, reconnectMode, rectContains, rectsIntersect, registerShape, resizeMode, resolveBehavior, resolveGroupPadding, resolveKeymap, resolvedBounds, resolvedEdgeLabelBounds, resolvedEdgeLabelSize, resolvedPosition, screenToCanvas, selectMode, serializeFlowGraph, snapPointToGrid, snapToGrid, snappedBounds, sortActiveGraphProjections, stepRouter, straightRouter, toSVGTransform, toViewBox, trigger, unionRect, validateAndCloneGraph, validateFitFrame, validateViewport, viewportCenteredOn, viewportForBounds, visualBounds, visualPosition, wheelInteraction, wheelMode, wheelZoomDelta, zoomTo };
|