@fragiola/flow-vue 0.0.0-stage → 0.1.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.
@@ -0,0 +1,893 @@
1
+ import { a as ElementRef, i as AsProp, n as PrimitiveProps, o as RenderSlot, r as SlotFunction, s as RenderSlotProps, t as FlowComponent } from "./primitive-ryVigrQO.js";
2
+ import { AnyTypes, BackgroundPattern, BackgroundVariant, Connection, CreateId, DefaultEdgeOptions, ENGINE_EVENT_CALLBACKS, EdgePath, EdgeToolbarPosition, FitPadding, FitViewPayload, FlowEdge, FlowEdgeInput, FlowEngine, FlowEngineEventOf, FlowEngineOptions, FlowFeatures, FlowModel, FlowNode, FlowNodeInput, FlowTypes, HandleSide, HandleType, InternalNode, KeyPressKeys, KeyPressTarget, NodeConnection, NodeData, NodeToolbarPosition, PartAttributes, Rect, Viewport, XY } from "@fragiola/flow";
3
+ import { ComputedRef, MaybeRefOrGetter, Ref } from "vue";
4
+ export * from "@fragiola/flow";
5
+ interface BackgroundState {
6
+ /** the pattern's tile on the screen, at the current viewport */
7
+ readonly pattern: BackgroundPattern;
8
+ }
9
+ interface BackgroundProps extends PrimitiveProps {
10
+ /** the marks: `dots` (default), `lines` or `cross` */
11
+ variant?: BackgroundVariant | undefined;
12
+ /** the distance between two marks, in flow units; default 20 (`[x, y]` for two) */
13
+ gap?: number | readonly [number, number] | undefined;
14
+ /** dots: a dot's diameter (flow units); lines: the stroke width (screen pixels); cross: a bar's length */
15
+ size?: number | undefined;
16
+ /** the pattern's shift from the flow's origin, in flow units */
17
+ offset?: number | readonly [number, number] | undefined;
18
+ }
19
+ interface BackgroundSlots extends RenderSlot<BackgroundState> {}
20
+ /**
21
+ * The flow's background (`data-flow-part="background"`): an SVG pattern of dots, lines or crosses
22
+ * that pans and zooms with the viewport (`background-pattern`), inside `Flow.Root` before
23
+ * `Flow.Viewport`. The marks are drawn in `currentColor`: set the `color` (and the background
24
+ * itself) in your style.
25
+ */
26
+ declare const Background: FlowComponent<BackgroundProps, BackgroundSlots>;
27
+ interface ConnectionLineState {
28
+ /** the connection being drawn */
29
+ readonly connection: Connection;
30
+ /** the drop would add the edge: `data-valid` */
31
+ readonly valid: boolean;
32
+ /** the drop would be refused (`model.can("edge.add")`, a middleware's veto): `data-invalid` */
33
+ readonly invalid: boolean;
34
+ }
35
+ interface ConnectionLineProps extends PrimitiveProps {}
36
+ interface ConnectionLineSlots extends RenderSlot<ConnectionLineState> {
37
+ /**
38
+ * draws the line, in flow coordinates (`v-slot="{ connection }"`); default an unfilled
39
+ * `<path>` of the connection's path (`data-flow-part="connection-path"`)
40
+ */
41
+ default?: SlotFunction<{
42
+ connection: Connection;
43
+ }>;
44
+ }
45
+ /**
46
+ * The connection being drawn (`data-flow-part="connection-line"`, `data-valid` / `data-invalid`,
47
+ * `connection()`): an SVG inside `Flow.Viewport`, rendered only while a connection is under way.
48
+ */
49
+ declare const ConnectionLine: FlowComponent<ConnectionLineProps, ConnectionLineSlots>;
50
+ /** The state of `Flow.Controls` (none: its buttons have their own). */
51
+ type ControlsState = Record<never, never>;
52
+ interface ControlsProps extends PrimitiveProps {}
53
+ interface ControlsSlots extends RenderSlot<ControlsState> {
54
+ /** its buttons: `Flow.ZoomIn`, `Flow.ZoomOut`, `Flow.FitView`, `Flow.ToggleInteractive`, … */
55
+ default?: SlotFunction<Record<never, never>>;
56
+ }
57
+ /**
58
+ * A group of the viewport's buttons (`data-flow-part="controls"`): `Flow.ZoomIn`, `Flow.ZoomOut`,
59
+ * `Flow.FitView`, `Flow.ToggleInteractive`, or your own. Inside `Flow.Root`, outside
60
+ * `Flow.Viewport`; presses and the wheel over it are left to it. Place it with your style.
61
+ */
62
+ declare const Controls: FlowComponent<ControlsProps, ControlsSlots>;
63
+ /** What an edge shows: its state on screen. */
64
+ interface EdgeState<T extends FlowTypes = AnyTypes> {
65
+ readonly edgeId: string;
66
+ /** the edge, as the model holds it */
67
+ readonly edge: FlowEdge<T>;
68
+ /**
69
+ * its path, label point and ends (`edge-path-by`), once both its nodes have a size; an app
70
+ * type gets the bezier path, and its ends to draw its own
71
+ */
72
+ readonly path: EdgePath | undefined;
73
+ /** `data-selected` (`selection()`) */
74
+ readonly selected: boolean;
75
+ /** one of its ends is being moved (`reconnection()`) */
76
+ readonly reconnecting: boolean;
77
+ /** it takes DOM focus (`keyboard()`): `tabindex="0"` */
78
+ readonly focusable: boolean;
79
+ readonly attributes: PartAttributes;
80
+ }
81
+ /** What goes on an edge's element (an SVG group). */
82
+ type EdgeElementProps = {
83
+ tabindex: number | undefined;
84
+ } & Readonly<Record<`data-${string}`, string | undefined>>;
85
+ interface UseEdgeResult<T extends FlowTypes = AnyTypes> {
86
+ state: ComputedRef<EdgeState<T>>;
87
+ /** what goes on the edge's element (`v-bind`): its attributes and `tabindex` */
88
+ props: ComputedRef<EdgeElementProps>;
89
+ }
90
+ /** An edge's state and the props of its element, for an edge drawn by hand (`Flow.Edge` uses it). */
91
+ export declare function useEdge<T extends FlowTypes = AnyTypes>(edge: MaybeRefOrGetter<FlowEdge<T>>): UseEdgeResult<T>;
92
+ interface EdgeProps<T extends FlowTypes = AnyTypes> extends PrimitiveProps {
93
+ /** the edge it draws: the one `Flow.Edges` gives its slot */
94
+ edge: FlowEdge<T>;
95
+ }
96
+ interface EdgeSlots<T extends FlowTypes = AnyTypes> extends RenderSlot<EdgeState<T>> {
97
+ /** its parts: default a `Flow.EdgePath` */
98
+ default?: SlotFunction<{
99
+ state: EdgeState<T>;
100
+ }>;
101
+ }
102
+ /**
103
+ * One edge (`data-flow-part="edge"`, `data-flow-id`): an SVG group inside `Flow.Edges`, drawn once
104
+ * both its nodes have a size (before the engine, the sizes its document gives: a server render
105
+ * draws it). Mounted again in another render level's layer, it takes back the focus it had. It renders its default slot (`Flow.EdgePath` by default,
106
+ * `Flow.EdgeLabel`, `Flow.ReconnectAnchor`); a press on its stroke selects it (`selection()`).
107
+ */
108
+ declare const Edge: FlowComponent<EdgeProps, EdgeSlots>;
109
+ interface EdgeLabelState {
110
+ readonly edgeId: string;
111
+ /** the edge's path, label point and ends */
112
+ readonly path: EdgePath;
113
+ /** `data-selected` (`selection()`) */
114
+ readonly selected: boolean;
115
+ }
116
+ interface EdgeLabelProps extends PrimitiveProps {
117
+ /** the edge; default the enclosing `Flow.Edge`'s */
118
+ edgeId?: string | undefined;
119
+ }
120
+ interface EdgeLabelSlots extends RenderSlot<EdgeLabelState> {
121
+ default?: SlotFunction<{
122
+ state: EdgeLabelState;
123
+ }>;
124
+ }
125
+ /**
126
+ * An edge's label (`data-flow-part="edge-label"`): HTML, centred on the path's label point in
127
+ * flow coordinates, in the HTML layer of `Flow.Edges` (SVG holds no HTML: it renders there, not
128
+ * where it is written). It renders only its default slot; a press on it selects its edge.
129
+ */
130
+ declare const EdgeLabel: FlowComponent<EdgeLabelProps, EdgeLabelSlots>;
131
+ interface EdgePathState {
132
+ readonly edgeId: string;
133
+ /** the edge's path, label point and ends */
134
+ readonly path: EdgePath;
135
+ /** `data-selected` (`selection()`) */
136
+ readonly selected: boolean;
137
+ }
138
+ interface EdgePathProps extends PrimitiveProps {
139
+ /** the edge; default the enclosing `Flow.Edge`'s */
140
+ edgeId?: string | undefined;
141
+ }
142
+ interface EdgePathSlots extends RenderSlot<EdgePathState> {
143
+ /** the path's SVG content (an `<animate>`, a `<title>`), as React's children */
144
+ default?: SlotFunction<{
145
+ state: EdgePathState;
146
+ }>;
147
+ }
148
+ /**
149
+ * An edge's path (`data-flow-part="edge-path"`): an SVG `<path>` whose `d` is the engine's
150
+ * (`edge-path-by`, D9; before the engine exists, the static geometry's), unfilled. A `d` of your own draws an app type (from `state.path`'s ends).
151
+ * Several may share an edge: a wide transparent one is a bigger press target. Its default slot
152
+ * renders inside the `<path>` (an `<animate>`, a `<title>`), as React's children.
153
+ */
154
+ declare const EdgePath$1: FlowComponent<EdgePathProps, EdgePathSlots>;
155
+ interface EdgeToolbarState {
156
+ readonly edgeId: string;
157
+ /** the point of the edge it stands at */
158
+ readonly position: "label" | "source" | "target";
159
+ /** where it is anchored (its `alignX` / `alignY` point), in pixels relative to the root */
160
+ readonly anchor: EdgeToolbarPosition;
161
+ }
162
+ interface EdgeToolbarProps extends PrimitiveProps {
163
+ /** its edge; default the enclosing `Flow.Edge`'s */
164
+ edgeId?: string | undefined;
165
+ /** the point of the edge it stands at: its label point, its source or its target end; default `"label"` */
166
+ position?: "label" | "source" | "target" | undefined;
167
+ /** a flow point it stands at instead (absolute flow coordinates); wins over `position` */
168
+ point?: XY | undefined;
169
+ /** a screen offset from that point, in pixels; default `{ x: 0, y: 0 }` */
170
+ offset?: XY | undefined;
171
+ /** which of its edges goes at the point across: its left (`"start"`), centre (default) or right */
172
+ alignX?: "start" | "center" | "end" | undefined;
173
+ /** which of its edges goes at the point down: its top (`"start"`), centre (default) or bottom */
174
+ alignY?: "start" | "center" | "end" | undefined;
175
+ /** whether it is shown; default while its edge is selected (`selection()`) */
176
+ open?: boolean | undefined;
177
+ }
178
+ interface EdgeToolbarSlots extends RenderSlot<EdgeToolbarState> {
179
+ /** your buttons */
180
+ default?: SlotFunction<{
181
+ state: EdgeToolbarState;
182
+ }>;
183
+ }
184
+ /**
185
+ * A toolbar on an edge (`data-flow-part="toolbar"`, `data-flow-id` its edge's id), outside the
186
+ * zoom: rendered in `Flow.Root` (a `Teleport`), centred at the point `edge-toolbar-by` gives (the
187
+ * edge's label point or one of its ends), so it keeps its size at any zoom. Inside `Flow.Edges`
188
+ * (SVG) it renders from the edges' HTML layer, whose `Teleport` creates HTML. Presses and the
189
+ * wheel over it are left to it. It renders only its default slot (your buttons).
190
+ */
191
+ declare const EdgeToolbar: FlowComponent<EdgeToolbarProps, EdgeToolbarSlots>;
192
+ interface EdgesState {
193
+ /** how many edges are drawn */
194
+ count: number;
195
+ }
196
+ interface EdgesProps extends PrimitiveProps {}
197
+ interface EdgesSlots<T extends FlowTypes = AnyTypes> extends RenderSlot<EdgesState> {
198
+ /**
199
+ * draws one edge (`v-slot="{ edge }"`): usually a `Flow.Edge` (an SVG group) with its path and
200
+ * label. Each edge's slot renders again when its edge changes, or a reactive value it reads
201
+ * does
202
+ */
203
+ default?: SlotFunction<{
204
+ edge: FlowEdge<T>;
205
+ }>;
206
+ }
207
+ /**
208
+ * The layer of the edges (`data-flow-part="edges"`), inside `Flow.Viewport`, before `Flow.Nodes`:
209
+ * an SVG (`data-flow-part="edges"` too) where the default slot draws each edge, once both its
210
+ * nodes have a size (before the engine exists, from the document's sizes: a server render draws
211
+ * them; with `onlyRenderVisible`, none: the view is not known yet), in the engine's drawing order (`drawn-edges`: by stack value), and the HTML layer edge
212
+ * labels render in. When some edges stand above nodes (`render-layers`, `zIndexMode`), each level
213
+ * gets its own layer (`data-flow-part="edges-layer"`, `data-level`, at the level's `z-index`) with
214
+ * its SVG and its labels, between the nodes below and above it. It lets presses through to the
215
+ * pane; the edges' own parts take them.
216
+ *
217
+ * ```vue
218
+ * <Flow.Edges v-slot="{ edge }"><Flow.Edge :edge="edge" /></Flow.Edges>
219
+ * ```
220
+ */
221
+ declare const Edges: FlowComponent<EdgesProps, EdgesSlots>;
222
+ /** What a control button shows. */
223
+ interface ControlButtonState {
224
+ /** the engine refuses its action now (a zoom at its limit, `fit-view` before a size) */
225
+ readonly disabled: boolean;
226
+ }
227
+ interface FitViewProps extends PrimitiveProps {
228
+ /** disabled even when the engine would run its action */
229
+ disabled?: boolean | undefined;
230
+ /**
231
+ * how long its viewport change animates, in milliseconds (the root's `easing`); default 0: at
232
+ * once. The attribute's text is its number (`duration="300"`)
233
+ */
234
+ duration?: number | `${number}` | undefined;
235
+ /**
236
+ * the room kept free on every side: a share of the root's size, `"<n>px"`, or each side's
237
+ * (`{ top, right, bottom, left }`); default the engine's 0.1
238
+ */
239
+ padding?: FitPadding | undefined;
240
+ /** only these nodes; default every node that is not hidden */
241
+ nodeIds?: string[] | undefined;
242
+ /** without `nodeIds`, the hidden nodes of known size too; default false */
243
+ includeHidden?: boolean | undefined;
244
+ /** the least zoom it may pick (within the root's limits); default the root's `minZoom` */
245
+ minZoom?: number | `${number}` | undefined;
246
+ /** the greatest zoom it may pick (within the root's limits); default the root's `maxZoom` */
247
+ maxZoom?: number | `${number}` | undefined;
248
+ }
249
+ interface FitViewSlots extends RenderSlot<ControlButtonState> {
250
+ /** its content (an icon, a label) */
251
+ default?: SlotFunction<{
252
+ state: ControlButtonState;
253
+ }>;
254
+ }
255
+ /**
256
+ * A button (`data-flow-part="fit-view"`): Fits every node in the root, or its `nodeIds` (`fit-view`, with its props as the payload), disabled before a node is measured. It renders only its default slot (an icon,
257
+ * a label).
258
+ */
259
+ declare const FitView: FlowComponent<FitViewProps, FitViewSlots>;
260
+ interface UseHandleOptions {
261
+ /** whether edges start (`source`) or end (`target`) here */
262
+ type: HandleType;
263
+ /** the side of the node it sits on: the direction its edges leave or enter by */
264
+ side: HandleSide;
265
+ /** its id among the node's handles of its type (none: the node's default handle) */
266
+ handleId?: string | undefined;
267
+ /** whether a connection may start or end here; default true */
268
+ connectable?: boolean | undefined;
269
+ /** whether a connection may start here (a drag, a tap, a key); default true */
270
+ connectableStart?: boolean | undefined;
271
+ /** whether a connection may end here (be its target); default true */
272
+ connectableEnd?: boolean | undefined;
273
+ /** its node; default the enclosing `Flow.Node`'s */
274
+ nodeId?: string | undefined;
275
+ }
276
+ /** What a handle shows. */
277
+ interface HandleState {
278
+ readonly nodeId: string;
279
+ readonly handleId: string | undefined;
280
+ readonly type: HandleType;
281
+ readonly side: HandleSide;
282
+ /** a connection may start or end here (its flag and its node's): `data-connectable` */
283
+ readonly connectable: boolean;
284
+ /** a connection may start here: `data-connectable-start` */
285
+ readonly connectableStart: boolean;
286
+ /** a connection may end here: `data-connectable-end` */
287
+ readonly connectableEnd: boolean;
288
+ /** the connection under way starts here (`connection()`): `data-connecting` */
289
+ readonly connecting: boolean;
290
+ /** the connection under way would end here and be accepted: `data-valid` */
291
+ readonly valid: boolean;
292
+ /** the connection under way would end here and be refused: `data-invalid` */
293
+ readonly invalid: boolean;
294
+ readonly attributes: PartAttributes;
295
+ }
296
+ /** What goes on a handle's element. */
297
+ type HandleElementProps = {
298
+ /** the template ref that registers the element with the engine (D8) */
299
+ ref: ElementRef;
300
+ } & Readonly<Record<`data-${string}`, string | undefined>>;
301
+ interface UseHandleResult {
302
+ state: ComputedRef<HandleState>;
303
+ /** what goes on the handle's element (`v-bind`): its attributes and its template ref */
304
+ props: ComputedRef<HandleElementProps>;
305
+ }
306
+ /**
307
+ * A handle's state and the props of its element, for a handle rendered by hand (`Flow.Handle`
308
+ * uses it): registered with the engine, which measures its centre relative to its node.
309
+ */
310
+ export declare function useHandle(options: MaybeRefOrGetter<UseHandleOptions>): UseHandleResult;
311
+ interface HandleProps extends PrimitiveProps, UseHandleOptions {}
312
+ interface HandleSlots extends RenderSlot<HandleState> {
313
+ default?: SlotFunction<{
314
+ state: HandleState;
315
+ }>;
316
+ }
317
+ /**
318
+ * A node's connection point (`data-flow-part="handle"`, `data-handle-type`, `data-side`), inside
319
+ * `Flow.Node`: registered with the engine (D8), which measures its centre; with `connection()`, a
320
+ * press on it draws a connection. Absolutely positioned at the middle of its `side` by default;
321
+ * your `style` may place it elsewhere on the node. Give it its size and look.
322
+ */
323
+ declare const Handle: FlowComponent<HandleProps, HandleSlots>;
324
+ /** What a node shows: its state on screen. */
325
+ interface NodeState<T extends FlowTypes = AnyTypes> {
326
+ readonly nodeId: string;
327
+ /** the node, as the model holds it */
328
+ readonly node: FlowNode<T>;
329
+ /** its top-left corner in absolute flow coordinates (its parents' positions added) */
330
+ readonly x: number;
331
+ readonly y: number;
332
+ /** `data-selected` (`selection()`) */
333
+ readonly selected: boolean;
334
+ /** `data-dragging` (`drag()`) */
335
+ readonly dragging: boolean;
336
+ /** `data-resizing` (`resize()`) */
337
+ readonly resizing: boolean;
338
+ /** its size is known (measured or given): `data-measured` */
339
+ readonly measured: boolean;
340
+ /** it takes DOM focus (`keyboard()`): `tabindex="0"` */
341
+ readonly focusable: boolean;
342
+ /** the attributes its element carries (`data-flow-part`, `data-flow-id`, the state) */
343
+ readonly attributes: PartAttributes;
344
+ }
345
+ /** What goes on a node's element. */
346
+ type NodeElementProps = {
347
+ /** the template ref that registers the element with the engine (measured) */
348
+ ref: ElementRef;
349
+ tabindex: number | undefined;
350
+ /** absolute, at its position, with the document's size when given */
351
+ style: Record<string, string>;
352
+ } & Readonly<Record<`data-${string}`, string | undefined>>;
353
+ interface UseNodeResult<T extends FlowTypes = AnyTypes> {
354
+ state: ComputedRef<NodeState<T>>;
355
+ /**
356
+ * what goes on the node's element (`v-bind`): its attributes, `tabindex`, its structural style
357
+ * and the template ref that registers it with the engine
358
+ */
359
+ props: ComputedRef<NodeElementProps>;
360
+ }
361
+ /**
362
+ * A node's state and the props of its element, for a node rendered by hand (`Flow.Node` uses it).
363
+ * Bind `props` on the element (the engine resolves presses from its attributes), in a render that
364
+ * reads `props.value`.
365
+ */
366
+ export declare function useNode<T extends FlowTypes = AnyTypes>(node: MaybeRefOrGetter<FlowNode<T>>): UseNodeResult<T>;
367
+ interface NodeProps<T extends FlowTypes = AnyTypes> extends PrimitiveProps {
368
+ /** the node it renders: the one `Flow.Nodes` gives its slot */
369
+ node: FlowNode<T>;
370
+ }
371
+ interface NodeSlots<T extends FlowTypes = AnyTypes> extends RenderSlot<NodeState<T>> {
372
+ /** the node's content: `Flow.Handle`s, a resizer, a toolbar */
373
+ default?: SlotFunction<{
374
+ state: NodeState<T>;
375
+ }>;
376
+ }
377
+ /**
378
+ * One node (`data-flow-part="node"`, `data-flow-id`), absolutely positioned at its place in the
379
+ * viewport (a structural `transform`), registered with the engine, which measures it and resolves
380
+ * presses on it (drag, select, connect from its handles). It renders only its default slot: the
381
+ * content, `Flow.Handle`s, a resizer, a toolbar.
382
+ */
383
+ declare const Node: FlowComponent<NodeProps, NodeSlots>;
384
+ interface NodeToolbarState {
385
+ /** its node (undefined for several nodes' toolbar) */
386
+ readonly nodeId: string | undefined;
387
+ /** the nodes it stands beside: `nodeIds`, or its one node */
388
+ readonly nodeIds: readonly string[];
389
+ /** where it is anchored, in pixels relative to the root */
390
+ readonly position: NodeToolbarPosition;
391
+ readonly side: HandleSide;
392
+ }
393
+ interface NodeToolbarProps extends PrimitiveProps {
394
+ /** its node; default the enclosing `Flow.Node`'s */
395
+ nodeId?: string | undefined;
396
+ /**
397
+ * several nodes it stands beside (their bounds), instead of one; when not empty it wins over
398
+ * `nodeId`, and the toolbar is shown by default while every one of them is selected
399
+ */
400
+ nodeIds?: readonly string[] | undefined;
401
+ /** the node's side it stands on; default `"top"` */
402
+ side?: HandleSide | undefined;
403
+ /** where along that side; default `"center"` */
404
+ align?: "start" | "center" | "end" | undefined;
405
+ /** the gap between the node and the toolbar, in pixels; default 10 */
406
+ offset?: number | undefined;
407
+ /** whether it is shown; default while its node (every node of `nodeIds`) is selected (`selection()`) */
408
+ open?: boolean | undefined;
409
+ }
410
+ interface NodeToolbarSlots extends RenderSlot<NodeToolbarState> {
411
+ /** your buttons */
412
+ default?: SlotFunction<{
413
+ state: NodeToolbarState;
414
+ }>;
415
+ }
416
+ /**
417
+ * A toolbar next to a node, or beside several nodes' bounds (`nodeIds`; `data-flow-part="toolbar"`),
418
+ * outside the zoom: rendered in
419
+ * `Flow.Root` (a `Teleport`), at the anchor `node-toolbar-by` gives, so it keeps its size at any
420
+ * zoom. Presses and the wheel over it are left to it. It renders only its default slot (your
421
+ * buttons).
422
+ */
423
+ declare const NodeToolbar: FlowComponent<NodeToolbarProps, NodeToolbarSlots>;
424
+ interface NodesState {
425
+ /** how many nodes are rendered */
426
+ count: number;
427
+ }
428
+ interface NodesProps extends PrimitiveProps {}
429
+ interface NodesSlots<T extends FlowTypes = AnyTypes> extends RenderSlot<NodesState> {
430
+ /**
431
+ * renders one node (`v-slot="{ node }"`): usually a `Flow.Node` with its content and handles.
432
+ * Each node's slot renders again when its node changes, or a reactive value it reads does
433
+ */
434
+ default?: SlotFunction<{
435
+ node: FlowNode<T>;
436
+ }>;
437
+ }
438
+ /**
439
+ * The layer of the nodes (`data-flow-part="nodes"`), inside `Flow.Viewport`: renders its default
440
+ * slot for each node that is not hidden (with `onlyRenderVisible`, each one in view,
441
+ * `visible-nodes`; with it, none before the engine knows the view: the server render and the
442
+ * first client render), in drawing order, keyed by its id (a node keeps its element when it moves).
443
+ * You render each node. It is its own stacking context (`isolation`), but while some edges stand
444
+ * above nodes (several `render-layers`), when the nodes' z-indexes interleave with the edges'
445
+ * layers.
446
+ *
447
+ * ```vue
448
+ * <Flow.Nodes v-slot="{ node }"><Flow.Node :node="node">…</Flow.Node></Flow.Nodes>
449
+ * ```
450
+ */
451
+ declare const Nodes: FlowComponent<NodesProps, NodesSlots>;
452
+ interface NodesSelectionState {
453
+ /** the rectangle around the selected nodes, in flow coordinates */
454
+ readonly rect: Rect;
455
+ /** the selection is being dragged by it: `data-dragging` */
456
+ readonly dragging: boolean;
457
+ }
458
+ interface NodesSelectionProps extends PrimitiveProps {}
459
+ interface NodesSelectionSlots extends RenderSlot<NodesSelectionState> {
460
+ default?: SlotFunction<{
461
+ state: NodesSelectionState;
462
+ }>;
463
+ }
464
+ /**
465
+ * The rectangle around the selected nodes (`data-flow-part="nodes-selection"`, `selection()`),
466
+ * inside `Flow.Viewport` next to `Flow.Nodes` (it is in flow coordinates): rendered at
467
+ * `selection-rect`, while two or more nodes are selected by a box (or always, with
468
+ * `selection({ rect: "always" })`). A press on it drags the selection (`drag()`), its context
469
+ * menu is the selection's. With `keyboard()` it takes focus (`tabindex`), and its keys are a
470
+ * focused selected node's: the arrows move the selection, the delete keys remove it, Escape clears
471
+ * it. Give it its look.
472
+ */
473
+ declare const NodesSelection: FlowComponent<NodesSelectionProps, NodesSelectionSlots>;
474
+ interface ReconnectAnchorState {
475
+ readonly edgeId: string;
476
+ /** which end of the edge it moves */
477
+ readonly end: "source" | "target";
478
+ /** the edge's path and ends */
479
+ readonly path: EdgePath;
480
+ /** this edge's end is being moved */
481
+ readonly reconnecting: boolean;
482
+ }
483
+ interface ReconnectAnchorProps extends PrimitiveProps {
484
+ /** which end of the edge it moves */
485
+ end: "source" | "target";
486
+ /** the edge; default the enclosing `Flow.Edge`'s */
487
+ edgeId?: string | undefined;
488
+ }
489
+ interface ReconnectAnchorSlots extends RenderSlot<ReconnectAnchorState> {}
490
+ /**
491
+ * An edge end's grab area (`data-flow-part="reconnect-anchor"`, `data-end`): an SVG circle at the
492
+ * end, inside `Flow.Edge`. With `reconnection()`, a press on it moves that end to another handle;
493
+ * an end its edge's `reconnectable` keeps fixed (`false`, or the other end's name) draws none.
494
+ * Transparent by default; give it its radius (`r`, default 10) and look.
495
+ */
496
+ declare const ReconnectAnchor: FlowComponent<ReconnectAnchorProps, ReconnectAnchorSlots>;
497
+ /** What a flow ref gives once its `Flow.Root` is mounted: the root's model and engine. */
498
+ interface FlowRefValue<T extends FlowTypes = AnyTypes, F extends FlowFeatures = readonly []> {
499
+ readonly model: FlowModel<T, F>;
500
+ readonly engine: FlowEngine<T, F>;
501
+ }
502
+ declare const flowRefBrand: unique symbol;
503
+ /**
504
+ * Access to a `Flow.Root` from outside it (a toolbar, a menu, a test): pass it as the root's
505
+ * `flow-ref`; `value` is the root's model and engine while it is mounted, `null` otherwise.
506
+ * `value` is reactive, so a render that reads it re-renders when the root mounts or unmounts.
507
+ *
508
+ * It is not a Vue ref: a template does not unwrap it, so `:flow-ref="flow"` passes the flow ref
509
+ * itself, and the template reads `flow.value`, as a script does.
510
+ */
511
+ interface FlowRef<T extends FlowTypes = AnyTypes, F extends FlowFeatures = readonly []> {
512
+ /** the root's model and engine while it is mounted, `null` otherwise */
513
+ readonly value: FlowRefValue<T, F> | null;
514
+ /** only `createFlowRef` and `useFlowRef` make a flow ref */
515
+ readonly [flowRefBrand]: true;
516
+ }
517
+ /**
518
+ * Creates a flow ref anywhere (a module, a test, `setup`, where `useFlowRef` says the same).
519
+ *
520
+ * ```ts
521
+ * const flow = createFlowRef<Types, typeof features>();
522
+ * // <Flow.Root :flow-ref="flow" :features="features" :default-nodes="nodes">…</Flow.Root>
523
+ * flow.value?.engine.run("fit-view");
524
+ * ```
525
+ */
526
+ export declare function createFlowRef<T extends FlowTypes = AnyTypes, F extends FlowFeatures = readonly []>(): FlowRef<T, F>;
527
+ interface RootState {
528
+ /** the gestures and keys may change the flow (`set-interactive`, `data-interactive`) */
529
+ interactive: boolean;
530
+ /** the viewport is being panned (`data-panning`) */
531
+ panning: boolean;
532
+ /** nodes are being dragged (`drag()`, `data-dragging`) */
533
+ dragging: boolean;
534
+ /** a connection is being drawn (`connection()`, `data-connecting`) */
535
+ connecting: boolean;
536
+ /** a box selection is being drawn (`selection()`, `data-selecting`) */
537
+ selecting: boolean;
538
+ }
539
+ /** The engine's options a root takes as props: each one that changes applies at once. */
540
+ type RootEngineProps = Omit<Pick<FlowEngineOptions, "minZoom" | "maxZoom" | "translateExtent" | "panOnDrag" | "panOnScroll" | "zoomOnScroll" | "zoomOnPinch" | "zoomOnDoubleClick" | "zoomStep" | "interactive" | "onlyRenderVisible" | "pathOptions" | "autoPan" | "panActivationKey" | "panOnScrollMode" | "panOnScrollSpeed" | "zoomActivationKey" | "easing" | "nodeOrigin" | "nodeExtent" | "elevateNodesOnSelect" | "elevateEdgesOnSelect" | "paneClickDistance" | "nodeClickDistance" | "preventScrolling" | "nodesFocusable" | "edgesFocusable" | "zIndexMode">, "panOnScrollSpeed" | "paneClickDistance" | "nodeClickDistance"> & {
541
+ /** the factor of the wheel's pixels when it pans; the attribute's text is its number */
542
+ panOnScrollSpeed?: number | `${number}` | undefined;
543
+ /**
544
+ * how far (px) a press on the pane may move and still be a click; the attribute's text is its
545
+ * number
546
+ */
547
+ paneClickDistance?: number | `${number}` | undefined;
548
+ /**
549
+ * how far (px) a press on a node may move and still be a click; the attribute's text is its
550
+ * number
551
+ */
552
+ nodeClickDistance?: number | `${number}` | undefined;
553
+ };
554
+ interface RootProps<T extends FlowTypes = AnyTypes, F extends FlowFeatures = readonly []> extends PrimitiveProps, RootEngineProps {
555
+ /**
556
+ * the flow model. Its middleware (`model.use`) sees every command the flow runs, and its
557
+ * listeners (`model.subscribe`) every change. Give it, or let the root create one from
558
+ * `nodes` / `defaultNodes` and `edges` / `defaultEdges`. Another model remounts the flow
559
+ */
560
+ model?: FlowModel<T, F> | undefined;
561
+ /** the nodes of the model the root creates (read once, at mount) */
562
+ defaultNodes?: readonly FlowNodeInput<T>[] | undefined;
563
+ /** the edges of the model the root creates (read once, at mount) */
564
+ defaultEdges?: readonly FlowEdgeInput<T>[] | undefined;
565
+ /**
566
+ * controlled nodes (`v-model:nodes`): a new list brings the model to it with the commands a
567
+ * user would run (`model.get("commands-to")`, one `batch`); every change of the model's nodes
568
+ * emits `update:nodes`. Give every node its id
569
+ */
570
+ nodes?: readonly FlowNode<T>[] | undefined;
571
+ /** controlled edges (`v-model:edges`), as `nodes` */
572
+ edges?: readonly FlowEdge<T>[] | undefined;
573
+ /**
574
+ * the opt-in features of the model the root creates (read once, at mount):
575
+ * `[selection(), drag(), connection()]`, each from its entry (`@fragiola/flow-vue/drag`). A
576
+ * `model` has its own
577
+ */
578
+ features?: F | undefined;
579
+ /** the id generator of the model the root creates (read once, at mount) */
580
+ createId?: CreateId | undefined;
581
+ /**
582
+ * the fields every `edge.add` of the model the root creates fills in where it leaves them out
583
+ * (read once, at mount: the model option `defaultEdgeOptions`)
584
+ */
585
+ defaultEdgeOptions?: DefaultEdgeOptions<T> | undefined;
586
+ /** controlled viewport (`v-model:viewport`): a new value is set on the engine (`set-viewport`) */
587
+ viewport?: Viewport | undefined;
588
+ /** the viewport the flow starts at (read once, at mount); default `{ x: 0, y: 0, zoom: 1 }` */
589
+ defaultViewport?: Viewport | undefined;
590
+ /** fits the nodes once their sizes are known, again once measured (read once, at mount) */
591
+ fitView?: boolean | FitViewPayload | undefined;
592
+ /** access to the model and the engine from outside the root (`useFlowRef`, `createFlowRef`) */
593
+ flowRef?: FlowRef<T, F> | undefined;
594
+ }
595
+ interface RootSlots extends RenderSlot<RootState> {
596
+ /** the flow: `Flow.Background`, `Flow.Viewport`, `Flow.Controls`, `MiniMap`, … */
597
+ default?: SlotFunction<{
598
+ state: RootState;
599
+ }>;
600
+ }
601
+ type Callbacks = typeof ENGINE_EVENT_CALLBACKS;
602
+ /**
603
+ * The root's engine events, one per entry of `ENGINE_EVENT_CALLBACKS`, named by the callback with
604
+ * its first letter lowercased (`nodeClick`, `moveStart`, `init`, `connectCancel`, …), each emitted
605
+ * with the event: `@node-click` in a template, `onNodeClick` in `h()` or TSX.
606
+ */
607
+ type RootEventEmits = { [K in keyof Callbacks as Uncapitalize<Callbacks[K]>]: (event: FlowEngineEventOf<K>) => void; };
608
+ /**
609
+ * The events of `Flow.Root`: the controlled values, for `v-model` (or `@update:…`), and one per
610
+ * engine event (`RootEventEmits`).
611
+ */
612
+ type RootEmits<T extends FlowTypes = AnyTypes> = {
613
+ /** the model's nodes, after every command that changes them (a drag step too) */
614
+ "update:nodes": (nodes: readonly FlowNode<T>[]) => void;
615
+ /** the model's edges, after every command that changes them */
616
+ "update:edges": (edges: readonly FlowEdge<T>[]) => void;
617
+ /** every viewport change, by a gesture (`gesture: true`) or an action */
618
+ "update:viewport": (viewport: Viewport, gesture: boolean) => void;
619
+ } & RootEventEmits;
620
+ /**
621
+ * The flow (`data-flow-part="root"`): owns the model (unless given) and the engine, attaches the
622
+ * engine to its element (the engine listens to it: pointer, wheel, keys, focus) and re-renders
623
+ * when the flow changes. It renders only its default slot; no provider is needed above it. Give
624
+ * it a size (the flow fills it). Another `model` remounts the flow. It takes any features; give
625
+ * it your registry and features with `typedFlow<Types, typeof features>().Root`.
626
+ */
627
+ declare const Root: FlowComponent<RootProps<AnyTypes, FlowFeatures>, RootSlots, RootEmits>;
628
+ interface SelectionBoxState {
629
+ /** the box, in pixels relative to the root */
630
+ readonly box: Rect;
631
+ }
632
+ interface SelectionBoxProps extends PrimitiveProps {}
633
+ interface SelectionBoxSlots extends RenderSlot<SelectionBoxState> {
634
+ default?: SlotFunction<{
635
+ state: SelectionBoxState;
636
+ }>;
637
+ }
638
+ /**
639
+ * The box selection being drawn (`data-flow-part="selection-box"`, `selection()`): absolutely
640
+ * positioned in `Flow.Root` (outside `Flow.Viewport`: it is in screen pixels), rendered only
641
+ * while a box is drawn. Give it its look.
642
+ */
643
+ declare const SelectionBox: FlowComponent<SelectionBoxProps, SelectionBoxSlots>;
644
+ interface ToggleInteractiveState {
645
+ /**
646
+ * the flow is not locked: it is interactive and one of dragging, connecting and selecting at
647
+ * least is on (`interactive-by`)
648
+ */
649
+ readonly interactive: boolean;
650
+ }
651
+ interface ToggleInteractiveProps extends PrimitiveProps {}
652
+ interface ToggleInteractiveSlots extends RenderSlot<ToggleInteractiveState> {
653
+ /** its content (an icon, a label) */
654
+ default?: SlotFunction<{
655
+ state: ToggleInteractiveState;
656
+ }>;
657
+ }
658
+ /**
659
+ * A toggle button (`data-flow-part="toggle-interactive"`, `aria-pressed` while the flow is locked,
660
+ * `data-interactive`): locks and unlocks the flow, React Flow's interactive button: locking turns
661
+ * dragging, connecting and selecting off (`set-interactive { drag, connect, select }`), unlocking
662
+ * turns them and `interactive` on; pan and zoom stay. It renders only its default slot.
663
+ */
664
+ declare const ToggleInteractive: FlowComponent<ToggleInteractiveProps, ToggleInteractiveSlots>;
665
+ interface ViewportState {
666
+ /** the viewport: the pan (`x`, `y`, pixels) and the zoom */
667
+ viewport: Viewport;
668
+ }
669
+ interface ViewportProps extends PrimitiveProps {}
670
+ interface ViewportSlots extends RenderSlot<ViewportState> {
671
+ /** what is in flow coordinates: `Flow.Edges`, `Flow.Nodes`, `Flow.ConnectionLine` */
672
+ default?: SlotFunction<{
673
+ state: ViewportState;
674
+ }>;
675
+ }
676
+ /**
677
+ * The pannable, zoomable layer (`data-flow-part="viewport"`): what is inside is in flow
678
+ * coordinates (`Flow.Edges`, `Flow.Nodes`, `Flow.ConnectionLine`). The engine writes its
679
+ * `transform` itself (D4), never Vue: a pan or a zoom re-renders nothing inside it, nor the
680
+ * viewport itself unless its state is read (its `render` slot, a `class` or `style` function).
681
+ */
682
+ declare const Viewport$1: FlowComponent<ViewportProps, ViewportSlots>;
683
+ interface ZoomInProps extends PrimitiveProps {
684
+ /** disabled even when the engine would run its action */
685
+ disabled?: boolean | undefined;
686
+ /**
687
+ * how long its viewport change animates, in milliseconds (the root's `easing`); default 0: at
688
+ * once. The attribute's text is its number (`duration="300"`)
689
+ */
690
+ duration?: number | `${number}` | undefined;
691
+ }
692
+ interface ZoomInSlots extends RenderSlot<ControlButtonState> {
693
+ /** its content (an icon, a label) */
694
+ default?: SlotFunction<{
695
+ state: ControlButtonState;
696
+ }>;
697
+ }
698
+ /**
699
+ * A button (`data-flow-part="zoom-in"`): Zooms in by a step around the root's centre (`zoom-in`), disabled at the greatest zoom. It renders only its default slot (an icon,
700
+ * a label).
701
+ */
702
+ declare const ZoomIn: FlowComponent<ZoomInProps, ZoomInSlots>;
703
+ interface ZoomOutProps extends PrimitiveProps {
704
+ /** disabled even when the engine would run its action */
705
+ disabled?: boolean | undefined;
706
+ /**
707
+ * how long its viewport change animates, in milliseconds (the root's `easing`); default 0: at
708
+ * once. The attribute's text is its number (`duration="300"`)
709
+ */
710
+ duration?: number | `${number}` | undefined;
711
+ }
712
+ interface ZoomOutSlots extends RenderSlot<ControlButtonState> {
713
+ /** its content (an icon, a label) */
714
+ default?: SlotFunction<{
715
+ state: ControlButtonState;
716
+ }>;
717
+ }
718
+ /**
719
+ * A button (`data-flow-part="zoom-out"`): Zooms out by a step around the root's centre (`zoom-out`), disabled at the least zoom. It renders only its default slot (an icon,
720
+ * a label).
721
+ */
722
+ declare const ZoomOut: FlowComponent<ZoomOutProps, ZoomOutSlots>;
723
+ /**
724
+ * The connection being drawn from a handle (`connection()`), or null, as a computed ref that
725
+ * changes with it: where it starts and ends, the handle it would end at and whether the drop would
726
+ * be accepted (`status`).
727
+ */
728
+ export declare function useConnection(): ComputedRef<Connection | null>;
729
+ /**
730
+ * Every edge of the enclosing `Flow.Root`, in drawing order, as a computed ref that changes on
731
+ * every change of one (the model's frozen list, never made reactive).
732
+ */
733
+ export declare function useEdges<T extends FlowTypes = AnyTypes>(): ComputedRef<readonly FlowEdge<T>[]>;
734
+ interface UseFlowResult<T extends FlowTypes = AnyTypes, F extends FlowFeatures = readonly []> {
735
+ /**
736
+ * the model of the enclosing `Flow.Root`: the flow's document and its rules. Change it with
737
+ * `model.run("node.move", { nodeId, position })`, read it with `model.get` / `model.is`
738
+ */
739
+ model: FlowModel<T, F>;
740
+ /**
741
+ * the engine of the flow on screen: screen actions (`engine.run("fit-view")`), screen facts
742
+ * (`engine.get("viewport")`) and its events (`engine.subscribe`). It is there from `setup`;
743
+ * before the root is mounted (and on the server) an action is refused and a read is empty
744
+ */
745
+ engine: FlowEngine<T, F>;
746
+ }
747
+ /**
748
+ * The model and the engine of the enclosing `Flow.Root`. Pass the registry and the features as the
749
+ * type arguments (`useFlow<Types, typeof features>()`): a child cannot infer them through
750
+ * injection. Call it in `setup`: another model remounts the root, so the values never change for
751
+ * a component.
752
+ */
753
+ export declare function useFlow<T extends FlowTypes = AnyTypes, F extends FlowFeatures = readonly []>(): UseFlowResult<T, F>;
754
+ /**
755
+ * A flow ref for this component: pass it as a `Flow.Root`'s `flow-ref`, and read `flow.value` in
756
+ * the template (a toolbar next to the flow, which re-renders when the root mounts) or in handlers.
757
+ * A template does not unwrap a flow ref: it reads `flow.value`, as a script does.
758
+ *
759
+ * ```vue
760
+ * <script setup lang="ts">
761
+ * const flow = useFlowRef<Types>();
762
+ * </script>
763
+ * <template>
764
+ * <button type="button" :disabled="!flow.value" @click="flow.value?.engine.run('fit-view')">
765
+ * Fit
766
+ * </button>
767
+ * <Flow.Root :flow-ref="flow" :default-nodes="nodes">…</Flow.Root>
768
+ * </template>
769
+ * ```
770
+ */
771
+ export declare function useFlowRef<T extends FlowTypes = AnyTypes, F extends FlowFeatures = readonly []>(): FlowRef<T, F>;
772
+ /**
773
+ * A value selected from the model and the engine of the enclosing `Flow.Root`, as a computed ref
774
+ * that triggers its readers only when it changes (`equal`, default `Object.is`): `selector` runs
775
+ * again on every change of the model and every view change of the engine (a measurement, the
776
+ * viewport, a gesture), and when a reactive value it reads changes. Pass the registry and the
777
+ * features as the type arguments after the selected value's (`useFlowStore<number, Types, typeof
778
+ * features>(…)`). Keep a selector that builds an object or an array with an `equal` that compares
779
+ * it (`sameFlowValue`), or it changes on every change.
780
+ */
781
+ export declare function useFlowStore<S, T extends FlowTypes = AnyTypes, F extends FlowFeatures = readonly []>(selector: (flow: UseFlowResult<T, F>) => S, equal?: (a: S, b: S) => boolean): ComputedRef<S>;
782
+ /**
783
+ * A node as the engine knows it on screen (`internal-node-by`), as a computed ref: the document's
784
+ * node, its absolute position and box (`nodeOrigin` applied), whether its size is known, its
785
+ * z-index and its handles with their centres; undefined while it does not exist or before the root
786
+ * is mounted. It changes only when one of them changes (compared by value): a pan does not. The
787
+ * id may be a ref or a getter.
788
+ */
789
+ export declare function useInternalNode<T extends FlowTypes = AnyTypes>(nodeId: MaybeRefOrGetter<string>): ComputedRef<InternalNode<T> | undefined>;
790
+ interface UseKeyPressOptions {
791
+ /** where the keys are read: a window, a document or an element; default the root's window */
792
+ target?: KeyPressTarget | null | undefined;
793
+ }
794
+ /**
795
+ * Whether a key, or a combo of keys, is held, as a ref that changes with it. `keys` is a combo or
796
+ * several (any of them): key names joined by `+`, held at once (`"Shift"`, `"Meta+s"`,
797
+ * `["Meta+z", "Control+z"]`); a name is a `KeyboardEvent.key` or `.code`, without case
798
+ * (`watchKeyPress`). The keys are read on `target`, by default the window of the enclosing
799
+ * `Flow.Root`'s element (never the global one): false before the root is mounted, or outside a
800
+ * root without a `target`. The keys and the options may be refs or getters.
801
+ */
802
+ export declare function useKeyPress(keys: MaybeRefOrGetter<KeyPressKeys>, options?: MaybeRefOrGetter<UseKeyPressOptions>): Readonly<Ref<boolean>>;
803
+ interface UseNodeConnectionsOptions {
804
+ /** the node; default the enclosing `Flow.Node`'s */
805
+ id?: string | undefined;
806
+ /** only the connections at this handle of it */
807
+ handleId?: string | undefined;
808
+ /** only those that start (`"source"`) or end (`"target"`) at it */
809
+ type?: HandleType | undefined;
810
+ }
811
+ /**
812
+ * The connections at a node (`node-connections-by`), as a computed ref: each edge that starts or
813
+ * ends at it, as its `edgeId`, `source`, `sourceHandle`, `target` and `targetHandle`, in the
814
+ * document's order. It changes only when they change (an edge added, removed or reconnected
815
+ * there), not when a node moves or an edge's data changes. The options may be a ref or a getter;
816
+ * outside a `Flow.Node`, give an `id`.
817
+ */
818
+ export declare function useNodeConnections(options?: MaybeRefOrGetter<UseNodeConnectionsOptions>): ComputedRef<readonly NodeConnection[]>;
819
+ /**
820
+ * The id of the node the component renders inside (`Flow.Node`), as a computed ref, or null
821
+ * outside one: a custom node's piece reads its own node without being given its id.
822
+ */
823
+ export declare function useNodeId(): ComputedRef<string | null>;
824
+ /**
825
+ * Every node of the enclosing `Flow.Root`, in drawing order, as a computed ref that changes on
826
+ * every change of one (the model's frozen list, never made reactive).
827
+ */
828
+ export declare function useNodes<T extends FlowTypes = AnyTypes>(): ComputedRef<readonly FlowNode<T>[]>;
829
+ /**
830
+ * A node's id, type and data (`nodes-data-by`), as a computed ref, or null while it does not
831
+ * exist; given several ids, each existing one's in the order given. It changes only when one of
832
+ * them changes (its type or its data, compared by value), not when a node moves or another
833
+ * changes. The ids may be a ref or a getter.
834
+ */
835
+ export declare function useNodesData<T extends FlowTypes = AnyTypes>(nodeId: MaybeRefOrGetter<string>): ComputedRef<NodeData<T> | null>;
836
+ export declare function useNodesData<T extends FlowTypes = AnyTypes>(nodeIds: MaybeRefOrGetter<readonly string[]>): ComputedRef<readonly NodeData<T>[]>;
837
+ interface UseOnViewportChangeOptions {
838
+ /** the viewport starts changing (`viewport-change-start`): a pan, a zoom, an animation */
839
+ onStart?: ((viewport: Viewport, gesture: boolean) => void) | undefined;
840
+ /** each change of the viewport (`viewport-change`) */
841
+ onChange?: ((viewport: Viewport, gesture: boolean) => void) | undefined;
842
+ /** the viewport stopped changing (`viewport-change-end`) */
843
+ onEnd?: ((viewport: Viewport, gesture: boolean) => void) | undefined;
844
+ }
845
+ /**
846
+ * Calls back on the viewport's changes of the enclosing `Flow.Root` (the engine's events), without
847
+ * rendering anything: `gesture` is true for a pan, the wheel, a pinch or auto-pan, false for an
848
+ * action. `options` is a value, a ref or a getter, and its callbacks are read at each event (a
849
+ * reactive object's, a ref's or a getter's latest).
850
+ */
851
+ export declare function useOnViewportChange(options: MaybeRefOrGetter<UseOnViewportChangeOptions>): void;
852
+ /** What is selected. */
853
+ interface FlowSelection<T extends FlowTypes = AnyTypes> {
854
+ readonly nodes: readonly FlowNode<T>[];
855
+ readonly edges: readonly FlowEdge<T>[];
856
+ }
857
+ /**
858
+ * The selected nodes and edges of the enclosing `Flow.Root` (`selection()`; none without it), as a
859
+ * computed ref that changes with them: a panel showing the selection, a Delete button.
860
+ */
861
+ export declare function useSelection<T extends FlowTypes = AnyTypes>(): ComputedRef<FlowSelection<T>>;
862
+ /**
863
+ * The viewport of the enclosing `Flow.Root` (`{ x, y, zoom }`), as a computed ref that changes
864
+ * with it: a zoom level readout, a control's state. Change it with `engine.run("set-viewport")`.
865
+ */
866
+ export declare function useViewport(): ComputedRef<Viewport>;
867
+ declare namespace parts_d_exports {
868
+ export { Background, ConnectionLine, Controls, Edge, EdgeLabel, EdgePath$1 as EdgePath, EdgeToolbar, Edges, FitView, Handle, Node, NodeToolbar, Nodes, NodesSelection, ReconnectAnchor, Root, SelectionBox, ToggleInteractive, Viewport$1 as Viewport, ZoomIn, ZoomOut };
869
+ }
870
+ /**
871
+ * The `Flow` primitives typed by the registry `T` and the features `F`: the root's model, lists
872
+ * and features, and the nodes and edges the slots give and the parts take. The others are the
873
+ * same as `Flow`'s.
874
+ */
875
+ type TypedFlow<T extends FlowTypes = AnyTypes, F extends FlowFeatures = readonly []> = Omit<typeof parts_d_exports, "Root" | "Nodes" | "Node" | "Edges" | "Edge"> & {
876
+ Root: FlowComponent<RootProps<T, F>, RootSlots, RootEmits<T>>;
877
+ Nodes: FlowComponent<NodesProps, NodesSlots<T>>;
878
+ Node: FlowComponent<NodeProps<T>, NodeSlots<T>>;
879
+ Edges: FlowComponent<EdgesProps, EdgesSlots<T>>;
880
+ Edge: FlowComponent<EdgeProps<T>, EdgeSlots<T>>;
881
+ };
882
+ /**
883
+ * The `Flow` primitives typed by your registry and features: what React writes as type arguments
884
+ * (`<Flow.Nodes<Types>>`), which a Vue template cannot pass. The same components, typed:
885
+ *
886
+ * ```ts
887
+ * const Flow = typedFlow<Types, typeof features>();
888
+ * // <Flow.Nodes v-slot="{ node }">: `node.data` is the registry's
889
+ * ```
890
+ */
891
+ export declare function typedFlow<T extends FlowTypes = AnyTypes, F extends FlowFeatures = readonly []>(): TypedFlow<T, F>;
892
+ export { type AsProp, type BackgroundProps, type BackgroundSlots, type BackgroundState, type ConnectionLineProps, type ConnectionLineSlots, type ConnectionLineState, type ControlButtonState, type ControlsProps, type ControlsSlots, type ControlsState, type EdgeElementProps, type EdgeLabelProps, type EdgeLabelSlots, type EdgeLabelState, type EdgePathProps, type EdgePathSlots, type EdgePathState, type EdgeProps, type EdgeSlots, type EdgeState, type EdgeToolbarProps, type EdgeToolbarSlots, type EdgeToolbarState, type EdgesProps, type EdgesSlots, type EdgesState, type ElementRef, type FitViewProps, type FitViewSlots, parts_d_exports as Flow, type FlowComponent, type FlowRef, type FlowRefValue, type FlowSelection, type HandleElementProps, type HandleProps, type HandleSlots, type HandleState, type NodeElementProps, type NodeProps, type NodeSlots, type NodeState, type NodeToolbarProps, type NodeToolbarSlots, type NodeToolbarState, type NodesProps, type NodesSelectionProps, type NodesSelectionSlots, type NodesSelectionState, type NodesSlots, type NodesState, type PrimitiveProps, type ReconnectAnchorProps, type ReconnectAnchorSlots, type ReconnectAnchorState, type RenderSlot, type RenderSlotProps, type RootEmits, type RootEngineProps, type RootEventEmits, type RootProps, type RootSlots, type RootState, type SelectionBoxProps, type SelectionBoxSlots, type SelectionBoxState, type SlotFunction, type ToggleInteractiveProps, type ToggleInteractiveSlots, type ToggleInteractiveState, type TypedFlow, type UseEdgeResult, type UseFlowResult, type UseHandleOptions, type UseHandleResult, type UseKeyPressOptions, type UseNodeConnectionsOptions, type UseNodeResult, type UseOnViewportChangeOptions, type ViewportProps, type ViewportSlots, type ViewportState, type ZoomInProps, type ZoomInSlots, type ZoomOutProps, type ZoomOutSlots };
893
+ //# sourceMappingURL=index.d.ts.map