@fragiola/flow 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.
- package/CHANGELOG.md +16 -0
- package/LICENSE +21 -0
- package/README.md +25 -2
- package/dist/connect-session-nyEp02_P.js +375 -0
- package/dist/connect-session-nyEp02_P.js.map +1 -0
- package/dist/connection.d.ts +31 -0
- package/dist/connection.js +60 -0
- package/dist/connection.js.map +1 -0
- package/dist/core-queries-BPNbcM6k.js +452 -0
- package/dist/core-queries-BPNbcM6k.js.map +1 -0
- package/dist/document-schema-CPK5xkyO.js +369 -0
- package/dist/document-schema-CPK5xkyO.js.map +1 -0
- package/dist/drag.d.ts +19 -0
- package/dist/drag.js +175 -0
- package/dist/drag.js.map +1 -0
- package/dist/index.d.ts +876 -0
- package/dist/index.js +5711 -0
- package/dist/index.js.map +1 -0
- package/dist/keyboard-links-CVaTtlZg.js +8 -0
- package/dist/keyboard-links-CVaTtlZg.js.map +1 -0
- package/dist/keyboard.d.ts +40 -0
- package/dist/keyboard.js +342 -0
- package/dist/keyboard.js.map +1 -0
- package/dist/minimap.d.ts +26 -0
- package/dist/minimap.js +206 -0
- package/dist/minimap.js.map +1 -0
- package/dist/node-moves-DyWe-4dj.js +36 -0
- package/dist/node-moves-DyWe-4dj.js.map +1 -0
- package/dist/part-attributes-DuBltA__.js +71 -0
- package/dist/part-attributes-DuBltA__.js.map +1 -0
- package/dist/path-format-2OU7Eiyy.js +43 -0
- package/dist/path-format-2OU7Eiyy.js.map +1 -0
- package/dist/reconnection.d.ts +15 -0
- package/dist/reconnection.js +138 -0
- package/dist/reconnection.js.map +1 -0
- package/dist/rect-CmoREaR6.js +92 -0
- package/dist/rect-CmoREaR6.js.map +1 -0
- package/dist/resize.d.ts +33 -0
- package/dist/resize.js +316 -0
- package/dist/resize.js.map +1 -0
- package/dist/rules-DLOMrPBG.js +102 -0
- package/dist/rules-DLOMrPBG.js.map +1 -0
- package/dist/selection.d.ts +38 -0
- package/dist/selection.js +392 -0
- package/dist/selection.js.map +1 -0
- package/dist/subflows.d.ts +9 -0
- package/dist/subflows.js +237 -0
- package/dist/subflows.js.map +1 -0
- package/dist/types-CLHcZVCb.d.ts +2660 -0
- package/dist/viewport-math-B-9Pn2kN.js +69 -0
- package/dist/viewport-math-B-9Pn2kN.js.map +1 -0
- package/package.json +94 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,876 @@
|
|
|
1
|
+
import { $ as NodeToolbarPosition, $n as FlowDocumentJson, $t as CommandListener, A as ViewportEasing, An as NO_GESTURE_ATTRIBUTE, At as ModelGetKey, B as EngineActionResult, Bn as flag, Bt as QueryArgs, C as PartPayloadMap, Cn as DIRECTION_ATTRIBUTE, Ct as CommandArgs, D as FlowEngineOptions, Dn as ID_ATTRIBUTE, Dt as createFlowModel, E as FlowEngine, En as FlowPart, Et as FlowModelOptions, F as EdgeToolbarPayload, Fn as ResizeHandleAttributeOptions, Ft as ModelIsMap, G as EngineIsKey, Gn as DeclaredHandle, Gt as CommandContext, H as EngineGetMap, Hn as resizeHandleAttributes, Ht as IdKind, I as EdgeToolbarPosition, In as ResizeHandleDirection, It as ModelIsPayload, J as FitViewPayload, Jn as EdgeFlags, Jt as CommandContextGetMap, K as EngineIsMap, Kn as EdgeDataOf, Kt as CommandContextBase, L as EngineActionKey, Ln as ResizeHandleVariant, Lt as NoPayload, M as BackgroundPatternPayload, Mn as PART_ATTRIBUTE, Mt as ModelGetPayload, N as BackgroundVariant, Nn as POSITION_ATTRIBUTE, Nt as ModelGetResult, O as PanOnScrollMode, On as LEVEL_ATTRIBUTE, Ot as DispatchOptions, P as Connection, Pn as PartAttributes, Pt as ModelIsKey, Q as NodeToolbarPayload, Qn as FlowDocument, Qt as CommandInfo, R as EngineActionMap, Rn as VARIANT_ATTRIBUTE, Rt as NodeConnection, S as HandleRegistration, Sn as OwnedBy, St as PathOptions, T as ViewChange, Tn as END_ATTRIBUTE, Tt as FlowModel, U as EngineGetPayload, Un as AnyTypes, Ut as BatchEntry, V as EngineGetKey, Vn as partAttributes, Vt as CreateId, W as EngineGetResult, Wn as BuiltInEdgeType, Wt as BatchStep, X as IntersectingNodesPayload, Xn as EdgePathOptions, Xt as CommandErrorCode, Y as InternalNode, Yn as EdgeOf, Yt as CommandError, Z as MinimapView, Zn as EdgeTypeOf, Zt as CommandEvent, _ as CommandDefinition, _n as JsonValue, _r as PathResult, _t as SelectionDragStep, a as EngineGetKeyOf, an as EdgeFlagsPayload, ar as FlowTypes, at as InteractivityPayload, b as FlowEngineAdapter, bn as FeatureKeyKind, bt as RenderLayer, c as FeatureEngineHost, cn as NodeFlagsPayload, cr as NodeFlags, ct as ViewportForBoundsOptions, d as FeatureNamesOf, dn as ResultOf, dr as SelectionFields, dt as ConnectionEnd, en as CommandMap, er as FlowEdge, et as SelectionBox, f as FlowFeature, fn as RunOptions, fr as SubflowFields, ft as FlowEngineEvent, g as ModelIsKeyOf, gn as JsonSchemaType, gr as PathEnds, gt as MoveSource, h as ModelGetKeyOf, hn as JsonSchema, hr as HandleSide, ht as FlowPointerInfo, i as EngineActionKeyOf, in as EdgeDataPatchOf, ir as FlowNodeInput, it as Interactivity, j as BackgroundPattern, jn as NO_WHEEL_ATTRIBUTE, jt as ModelGetMap, k as createFlowEngine, kn as MutablePartAttributes, kt as HandleType, l as FeatureGesture, ln as PayloadOf, lr as NodeOf, lt as viewportForBounds, m as FlowReader, mn as SelectionResult, mr as EdgePath, mt as FlowEngineEventType, n as AnyFlowFeature, nn as CommandResult, nr as FlowJson, nt as ZoomStepPayload, o as EngineIsKeyOf, on as Middleware, or as NodeDataOf, ot as FitPadding, p as FlowFeatures, pn as SelectionMode, pr as XY, pt as FlowEngineEventOf, q as EngineIsPayload, qn as EdgeFields, qt as CommandContextGetKey, r as CommandNameOf, rn as ConnectionPayload, rr as FlowNode, rt as InteractionKind, s as FeatureEngine, sn as NodeDataPatchOf, sr as NodeFields, st as PaddingValue, t as AllowedKeys, tn as CommandName, tr as FlowEdgeInput, tt as ViewportForBoundsPayload, u as FeatureModel, un as RemovedResult, ur as NodeTypeOf, ut as ConnectionDrop, v as Failure, vn as ValidationIssue, vr as Rect, vt as AutoPanGesture, w as PressTarget, wn as DRAG_HANDLE_ATTRIBUTE, wt as DefaultEdgeOptions, x as FlowHandle, xn as FeatureName, xt as ZIndexMode, y as ReduceContext, yn as FEATURE_KEYS, yr as Viewport, yt as AutoPanOptions, z as EngineActionPayload, zn as edgesLayerAttributes, zt as NodeData } from "./types-CLHcZVCb.js";
|
|
2
|
+
/** The vetoed result a middleware returns to stop a command. */
|
|
3
|
+
export declare function veto(message?: string): {
|
|
4
|
+
readonly ok: false;
|
|
5
|
+
readonly error: CommandError;
|
|
6
|
+
};
|
|
7
|
+
/** A node, as a document or `node.add` gives it. */
|
|
8
|
+
export declare const nodeSchema: {
|
|
9
|
+
readonly type: "object";
|
|
10
|
+
readonly description: "a node";
|
|
11
|
+
readonly properties: {
|
|
12
|
+
readonly draggable: {
|
|
13
|
+
readonly type: "boolean";
|
|
14
|
+
readonly description: "it may be moved (`node.move`); default true";
|
|
15
|
+
};
|
|
16
|
+
readonly selectable: {
|
|
17
|
+
readonly type: "boolean";
|
|
18
|
+
readonly description: "it may be selected (`selection.set`); default true";
|
|
19
|
+
};
|
|
20
|
+
readonly connectable: {
|
|
21
|
+
readonly type: "boolean";
|
|
22
|
+
readonly description: "edges may start or end at it (`edge.add`, `edge.reconnect`); default true";
|
|
23
|
+
};
|
|
24
|
+
readonly deletable: {
|
|
25
|
+
readonly type: "boolean";
|
|
26
|
+
readonly description: "it may be removed (`node.remove`, `selection.remove`); default true";
|
|
27
|
+
};
|
|
28
|
+
readonly hidden: {
|
|
29
|
+
readonly type: "boolean";
|
|
30
|
+
readonly description: "it is not shown; default false";
|
|
31
|
+
};
|
|
32
|
+
readonly focusable: {
|
|
33
|
+
readonly type: "boolean";
|
|
34
|
+
readonly description: "it takes DOM focus (with the keyboard feature); default true";
|
|
35
|
+
};
|
|
36
|
+
readonly id: {
|
|
37
|
+
readonly type: "string";
|
|
38
|
+
readonly minLength: 1;
|
|
39
|
+
readonly description: "its id; generated when missing";
|
|
40
|
+
};
|
|
41
|
+
readonly type: {
|
|
42
|
+
readonly type: "string";
|
|
43
|
+
readonly minLength: 1;
|
|
44
|
+
readonly description: "its type, from the app's registry";
|
|
45
|
+
};
|
|
46
|
+
readonly position: {
|
|
47
|
+
readonly type: "object";
|
|
48
|
+
readonly properties: {
|
|
49
|
+
readonly x: {
|
|
50
|
+
readonly type: "number";
|
|
51
|
+
readonly description: "the horizontal coordinate";
|
|
52
|
+
};
|
|
53
|
+
readonly y: {
|
|
54
|
+
readonly type: "number";
|
|
55
|
+
readonly description: "the vertical coordinate";
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
readonly required: readonly ["x", "y"];
|
|
59
|
+
readonly additionalProperties: false;
|
|
60
|
+
readonly description: "its top-left corner, in flow coordinates (relative to its parent with sub-flows)";
|
|
61
|
+
};
|
|
62
|
+
readonly data: {
|
|
63
|
+
readonly type: "object";
|
|
64
|
+
readonly description: "the app's data, a JSON object typed by the node or edge type";
|
|
65
|
+
};
|
|
66
|
+
readonly width: {
|
|
67
|
+
readonly type: "number";
|
|
68
|
+
readonly minimum: 0;
|
|
69
|
+
readonly description: "its width, when the document gives one";
|
|
70
|
+
};
|
|
71
|
+
readonly height: {
|
|
72
|
+
readonly type: "number";
|
|
73
|
+
readonly minimum: 0;
|
|
74
|
+
readonly description: "its height, when the document gives one";
|
|
75
|
+
};
|
|
76
|
+
readonly initialWidth: {
|
|
77
|
+
readonly type: "number";
|
|
78
|
+
readonly minimum: 0;
|
|
79
|
+
readonly description: "its width until it is measured; width wins";
|
|
80
|
+
};
|
|
81
|
+
readonly initialHeight: {
|
|
82
|
+
readonly type: "number";
|
|
83
|
+
readonly minimum: 0;
|
|
84
|
+
readonly description: "its height until it is measured; height wins";
|
|
85
|
+
};
|
|
86
|
+
readonly handles: {
|
|
87
|
+
readonly type: "array";
|
|
88
|
+
readonly items: {
|
|
89
|
+
readonly type: "object";
|
|
90
|
+
readonly description: "a handle the node declares, used until a handle of that type and id is measured";
|
|
91
|
+
readonly properties: {
|
|
92
|
+
readonly id: {
|
|
93
|
+
readonly type: "string";
|
|
94
|
+
readonly minLength: 1;
|
|
95
|
+
readonly description: "its id among the node's handles of its type; none: the default handle";
|
|
96
|
+
};
|
|
97
|
+
readonly type: {
|
|
98
|
+
readonly enum: readonly ["source", "target"];
|
|
99
|
+
readonly description: "edges start (source) or end (target) at it";
|
|
100
|
+
};
|
|
101
|
+
readonly position: {
|
|
102
|
+
readonly enum: readonly ["top", "right", "bottom", "left"];
|
|
103
|
+
readonly description: "the side of the node it sits on";
|
|
104
|
+
};
|
|
105
|
+
readonly x: {
|
|
106
|
+
readonly type: "number";
|
|
107
|
+
readonly description: "its box's left edge, relative to the node box's left edge";
|
|
108
|
+
};
|
|
109
|
+
readonly y: {
|
|
110
|
+
readonly type: "number";
|
|
111
|
+
readonly description: "its box's top edge, relative to the node box's top edge";
|
|
112
|
+
};
|
|
113
|
+
readonly width: {
|
|
114
|
+
readonly type: "number";
|
|
115
|
+
readonly minimum: 0;
|
|
116
|
+
readonly description: "its box's width; default 0";
|
|
117
|
+
};
|
|
118
|
+
readonly height: {
|
|
119
|
+
readonly type: "number";
|
|
120
|
+
readonly minimum: 0;
|
|
121
|
+
readonly description: "its box's height; default 0";
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
readonly required: readonly ["type", "position", "x", "y"];
|
|
125
|
+
readonly additionalProperties: false;
|
|
126
|
+
};
|
|
127
|
+
readonly description: "its handles, declared for its edges to be drawn before it is measured";
|
|
128
|
+
};
|
|
129
|
+
readonly sourcePosition: {
|
|
130
|
+
readonly enum: readonly ["top", "right", "bottom", "left"];
|
|
131
|
+
readonly description: "the side its edges leave by when no handle gives one; default bottom";
|
|
132
|
+
};
|
|
133
|
+
readonly targetPosition: {
|
|
134
|
+
readonly enum: readonly ["top", "right", "bottom", "left"];
|
|
135
|
+
readonly description: "the side its edges enter by when no handle gives one; default top";
|
|
136
|
+
};
|
|
137
|
+
readonly origin: {
|
|
138
|
+
readonly type: "object";
|
|
139
|
+
readonly properties: {
|
|
140
|
+
readonly x: {
|
|
141
|
+
readonly type: "number";
|
|
142
|
+
readonly description: "the horizontal coordinate";
|
|
143
|
+
};
|
|
144
|
+
readonly y: {
|
|
145
|
+
readonly type: "number";
|
|
146
|
+
readonly description: "the vertical coordinate";
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
readonly required: readonly ["x", "y"];
|
|
150
|
+
readonly additionalProperties: false;
|
|
151
|
+
readonly description: "the point of its box its position stands at, as shares of its size, over the engine's nodeOrigin";
|
|
152
|
+
};
|
|
153
|
+
readonly zIndex: {
|
|
154
|
+
readonly type: "integer";
|
|
155
|
+
readonly description: "its place in the stacking order of its layer (nodes among nodes, edges among edges): a greater one is drawn above; default 0";
|
|
156
|
+
};
|
|
157
|
+
readonly selected: {
|
|
158
|
+
readonly type: "boolean";
|
|
159
|
+
readonly description: "it is selected (requires the selection feature)";
|
|
160
|
+
};
|
|
161
|
+
readonly parentId: {
|
|
162
|
+
readonly type: "string";
|
|
163
|
+
readonly minLength: 1;
|
|
164
|
+
readonly description: "the node it lives in, its position relative to it (requires the subflows feature)";
|
|
165
|
+
};
|
|
166
|
+
readonly extent: {
|
|
167
|
+
readonly anyOf: readonly [{
|
|
168
|
+
readonly const: "parent";
|
|
169
|
+
}, {
|
|
170
|
+
readonly type: "object";
|
|
171
|
+
readonly description: "a rectangle in flow coordinates: its top-left corner and its size";
|
|
172
|
+
readonly properties: {
|
|
173
|
+
readonly x: {
|
|
174
|
+
readonly type: "number";
|
|
175
|
+
readonly description: "its left edge";
|
|
176
|
+
};
|
|
177
|
+
readonly y: {
|
|
178
|
+
readonly type: "number";
|
|
179
|
+
readonly description: "its top edge";
|
|
180
|
+
};
|
|
181
|
+
readonly width: {
|
|
182
|
+
readonly type: "number";
|
|
183
|
+
readonly minimum: 0;
|
|
184
|
+
readonly description: "its width";
|
|
185
|
+
};
|
|
186
|
+
readonly height: {
|
|
187
|
+
readonly type: "number";
|
|
188
|
+
readonly minimum: 0;
|
|
189
|
+
readonly description: "its height";
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
readonly required: readonly ["x", "y", "width", "height"];
|
|
193
|
+
readonly additionalProperties: false;
|
|
194
|
+
}];
|
|
195
|
+
readonly description: '"parent": it stays inside its parent\'s box; a rectangle (x, y, width, height): it stays inside it, in the coordinates of its position (requires the subflows feature)';
|
|
196
|
+
};
|
|
197
|
+
readonly expandParent: {
|
|
198
|
+
readonly type: "boolean";
|
|
199
|
+
readonly description: "its parent grows to keep it inside (requires the subflows feature)";
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
readonly required: readonly ["type", "position", "data"];
|
|
203
|
+
readonly additionalProperties: false;
|
|
204
|
+
};
|
|
205
|
+
/** An edge, as a document or `edge.add` gives it. */
|
|
206
|
+
export declare const edgeSchema: {
|
|
207
|
+
readonly type: "object";
|
|
208
|
+
readonly description: "an edge between two nodes";
|
|
209
|
+
readonly properties: {
|
|
210
|
+
readonly selectable: {
|
|
211
|
+
readonly type: "boolean";
|
|
212
|
+
readonly description: "it may be selected (`selection.set`); default true";
|
|
213
|
+
};
|
|
214
|
+
readonly deletable: {
|
|
215
|
+
readonly type: "boolean";
|
|
216
|
+
readonly description: "it may be removed (`edge.remove`, `selection.remove`); default true";
|
|
217
|
+
};
|
|
218
|
+
readonly hidden: {
|
|
219
|
+
readonly type: "boolean";
|
|
220
|
+
readonly description: "it is not shown; default false";
|
|
221
|
+
};
|
|
222
|
+
readonly reconnectable: {
|
|
223
|
+
readonly anyOf: readonly [{
|
|
224
|
+
readonly type: "boolean";
|
|
225
|
+
}, {
|
|
226
|
+
readonly const: "source";
|
|
227
|
+
}, {
|
|
228
|
+
readonly const: "target";
|
|
229
|
+
}];
|
|
230
|
+
readonly description: 'its ends may be moved to other nodes or handles (`edge.reconnect`): both (true), none (false), or only its "source" or its "target" end; default true';
|
|
231
|
+
};
|
|
232
|
+
readonly focusable: {
|
|
233
|
+
readonly type: "boolean";
|
|
234
|
+
readonly description: "it takes DOM focus (with the keyboard feature); default true";
|
|
235
|
+
};
|
|
236
|
+
readonly animated: {
|
|
237
|
+
readonly type: "boolean";
|
|
238
|
+
readonly description: "it is drawn animated (the app's CSS animates its data-animated parts); default false";
|
|
239
|
+
};
|
|
240
|
+
readonly id: {
|
|
241
|
+
readonly type: "string";
|
|
242
|
+
readonly minLength: 1;
|
|
243
|
+
readonly description: "its id; generated when missing";
|
|
244
|
+
};
|
|
245
|
+
readonly source: {
|
|
246
|
+
readonly type: "string";
|
|
247
|
+
readonly minLength: 1;
|
|
248
|
+
readonly description: "the id of the node it starts at";
|
|
249
|
+
};
|
|
250
|
+
readonly target: {
|
|
251
|
+
readonly type: "string";
|
|
252
|
+
readonly minLength: 1;
|
|
253
|
+
readonly description: "the id of the node it ends at";
|
|
254
|
+
};
|
|
255
|
+
readonly sourceHandle: {
|
|
256
|
+
readonly type: "string";
|
|
257
|
+
readonly minLength: 1;
|
|
258
|
+
readonly description: "the source node's handle it starts at; none: the node's default source handle";
|
|
259
|
+
};
|
|
260
|
+
readonly targetHandle: {
|
|
261
|
+
readonly type: "string";
|
|
262
|
+
readonly minLength: 1;
|
|
263
|
+
readonly description: "the target node's handle it ends at; none: the node's default target handle";
|
|
264
|
+
};
|
|
265
|
+
readonly type: {
|
|
266
|
+
readonly type: "string";
|
|
267
|
+
readonly minLength: 1;
|
|
268
|
+
readonly description: 'how it is drawn: "bezier" (the default), "simplebezier", "smoothstep", "step", "straight" or an app type';
|
|
269
|
+
};
|
|
270
|
+
readonly data: {
|
|
271
|
+
readonly type: "object";
|
|
272
|
+
readonly description: "the app's data, a JSON object typed by the node or edge type";
|
|
273
|
+
};
|
|
274
|
+
readonly zIndex: {
|
|
275
|
+
readonly type: "integer";
|
|
276
|
+
readonly description: "its place in the stacking order of its layer (nodes among nodes, edges among edges): a greater one is drawn above; default 0";
|
|
277
|
+
};
|
|
278
|
+
readonly pathOptions: {
|
|
279
|
+
readonly type: "object";
|
|
280
|
+
readonly description: "the shape of its path, over the engine's path options: each built-in type reads its own keys (bezier: curvature; smoothstep: borderRadius, offset, stepPosition, centerX, centerY; step: the same but borderRadius)";
|
|
281
|
+
readonly properties: {
|
|
282
|
+
readonly curvature: {
|
|
283
|
+
readonly type: "number";
|
|
284
|
+
readonly description: "bezier: the share of the distance a control point stands out by";
|
|
285
|
+
};
|
|
286
|
+
readonly borderRadius: {
|
|
287
|
+
readonly type: "number";
|
|
288
|
+
readonly minimum: 0;
|
|
289
|
+
readonly description: "smoothstep: the corners' radius, in flow units";
|
|
290
|
+
};
|
|
291
|
+
readonly offset: {
|
|
292
|
+
readonly type: "number";
|
|
293
|
+
readonly description: "smoothstep and step: how far an end stands out before turning, in flow units";
|
|
294
|
+
};
|
|
295
|
+
readonly stepPosition: {
|
|
296
|
+
readonly type: "number";
|
|
297
|
+
readonly minimum: 0;
|
|
298
|
+
readonly description: "smoothstep and step: where the turn sits between the source (0) and the target (1); above 1 counts as 1";
|
|
299
|
+
};
|
|
300
|
+
readonly centerX: {
|
|
301
|
+
readonly type: "number";
|
|
302
|
+
readonly description: "smoothstep and step: the x of a vertical turn, in flow coordinates";
|
|
303
|
+
};
|
|
304
|
+
readonly centerY: {
|
|
305
|
+
readonly type: "number";
|
|
306
|
+
readonly description: "smoothstep and step: the y of a horizontal turn, in flow coordinates";
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
readonly additionalProperties: false;
|
|
310
|
+
};
|
|
311
|
+
readonly selected: {
|
|
312
|
+
readonly type: "boolean";
|
|
313
|
+
readonly description: "it is selected (requires the selection feature)";
|
|
314
|
+
};
|
|
315
|
+
};
|
|
316
|
+
readonly required: readonly ["source", "target"];
|
|
317
|
+
readonly additionalProperties: false;
|
|
318
|
+
};
|
|
319
|
+
/** A flow document, version 1. */
|
|
320
|
+
export declare const flowDocumentSchema: {
|
|
321
|
+
readonly type: "object";
|
|
322
|
+
readonly title: "Flow document";
|
|
323
|
+
readonly description: "a flow: its nodes and the edges between them";
|
|
324
|
+
readonly properties: {
|
|
325
|
+
readonly version: {
|
|
326
|
+
readonly const: 1;
|
|
327
|
+
readonly description: "the document format's version";
|
|
328
|
+
};
|
|
329
|
+
readonly nodes: {
|
|
330
|
+
readonly type: "array";
|
|
331
|
+
readonly items: {
|
|
332
|
+
readonly type: "object";
|
|
333
|
+
readonly description: "a node";
|
|
334
|
+
readonly properties: {
|
|
335
|
+
readonly draggable: {
|
|
336
|
+
readonly type: "boolean";
|
|
337
|
+
readonly description: "it may be moved (`node.move`); default true";
|
|
338
|
+
};
|
|
339
|
+
readonly selectable: {
|
|
340
|
+
readonly type: "boolean";
|
|
341
|
+
readonly description: "it may be selected (`selection.set`); default true";
|
|
342
|
+
};
|
|
343
|
+
readonly connectable: {
|
|
344
|
+
readonly type: "boolean";
|
|
345
|
+
readonly description: "edges may start or end at it (`edge.add`, `edge.reconnect`); default true";
|
|
346
|
+
};
|
|
347
|
+
readonly deletable: {
|
|
348
|
+
readonly type: "boolean";
|
|
349
|
+
readonly description: "it may be removed (`node.remove`, `selection.remove`); default true";
|
|
350
|
+
};
|
|
351
|
+
readonly hidden: {
|
|
352
|
+
readonly type: "boolean";
|
|
353
|
+
readonly description: "it is not shown; default false";
|
|
354
|
+
};
|
|
355
|
+
readonly focusable: {
|
|
356
|
+
readonly type: "boolean";
|
|
357
|
+
readonly description: "it takes DOM focus (with the keyboard feature); default true";
|
|
358
|
+
};
|
|
359
|
+
readonly id: {
|
|
360
|
+
readonly type: "string";
|
|
361
|
+
readonly minLength: 1;
|
|
362
|
+
readonly description: "its id; generated when missing";
|
|
363
|
+
};
|
|
364
|
+
readonly type: {
|
|
365
|
+
readonly type: "string";
|
|
366
|
+
readonly minLength: 1;
|
|
367
|
+
readonly description: "its type, from the app's registry";
|
|
368
|
+
};
|
|
369
|
+
readonly position: {
|
|
370
|
+
readonly type: "object";
|
|
371
|
+
readonly properties: {
|
|
372
|
+
readonly x: {
|
|
373
|
+
readonly type: "number";
|
|
374
|
+
readonly description: "the horizontal coordinate";
|
|
375
|
+
};
|
|
376
|
+
readonly y: {
|
|
377
|
+
readonly type: "number";
|
|
378
|
+
readonly description: "the vertical coordinate";
|
|
379
|
+
};
|
|
380
|
+
};
|
|
381
|
+
readonly required: readonly ["x", "y"];
|
|
382
|
+
readonly additionalProperties: false;
|
|
383
|
+
readonly description: "its top-left corner, in flow coordinates (relative to its parent with sub-flows)";
|
|
384
|
+
};
|
|
385
|
+
readonly data: {
|
|
386
|
+
readonly type: "object";
|
|
387
|
+
readonly description: "the app's data, a JSON object typed by the node or edge type";
|
|
388
|
+
};
|
|
389
|
+
readonly width: {
|
|
390
|
+
readonly type: "number";
|
|
391
|
+
readonly minimum: 0;
|
|
392
|
+
readonly description: "its width, when the document gives one";
|
|
393
|
+
};
|
|
394
|
+
readonly height: {
|
|
395
|
+
readonly type: "number";
|
|
396
|
+
readonly minimum: 0;
|
|
397
|
+
readonly description: "its height, when the document gives one";
|
|
398
|
+
};
|
|
399
|
+
readonly initialWidth: {
|
|
400
|
+
readonly type: "number";
|
|
401
|
+
readonly minimum: 0;
|
|
402
|
+
readonly description: "its width until it is measured; width wins";
|
|
403
|
+
};
|
|
404
|
+
readonly initialHeight: {
|
|
405
|
+
readonly type: "number";
|
|
406
|
+
readonly minimum: 0;
|
|
407
|
+
readonly description: "its height until it is measured; height wins";
|
|
408
|
+
};
|
|
409
|
+
readonly handles: {
|
|
410
|
+
readonly type: "array";
|
|
411
|
+
readonly items: {
|
|
412
|
+
readonly type: "object";
|
|
413
|
+
readonly description: "a handle the node declares, used until a handle of that type and id is measured";
|
|
414
|
+
readonly properties: {
|
|
415
|
+
readonly id: {
|
|
416
|
+
readonly type: "string";
|
|
417
|
+
readonly minLength: 1;
|
|
418
|
+
readonly description: "its id among the node's handles of its type; none: the default handle";
|
|
419
|
+
};
|
|
420
|
+
readonly type: {
|
|
421
|
+
readonly enum: readonly ["source", "target"];
|
|
422
|
+
readonly description: "edges start (source) or end (target) at it";
|
|
423
|
+
};
|
|
424
|
+
readonly position: {
|
|
425
|
+
readonly enum: readonly ["top", "right", "bottom", "left"];
|
|
426
|
+
readonly description: "the side of the node it sits on";
|
|
427
|
+
};
|
|
428
|
+
readonly x: {
|
|
429
|
+
readonly type: "number";
|
|
430
|
+
readonly description: "its box's left edge, relative to the node box's left edge";
|
|
431
|
+
};
|
|
432
|
+
readonly y: {
|
|
433
|
+
readonly type: "number";
|
|
434
|
+
readonly description: "its box's top edge, relative to the node box's top edge";
|
|
435
|
+
};
|
|
436
|
+
readonly width: {
|
|
437
|
+
readonly type: "number";
|
|
438
|
+
readonly minimum: 0;
|
|
439
|
+
readonly description: "its box's width; default 0";
|
|
440
|
+
};
|
|
441
|
+
readonly height: {
|
|
442
|
+
readonly type: "number";
|
|
443
|
+
readonly minimum: 0;
|
|
444
|
+
readonly description: "its box's height; default 0";
|
|
445
|
+
};
|
|
446
|
+
};
|
|
447
|
+
readonly required: readonly ["type", "position", "x", "y"];
|
|
448
|
+
readonly additionalProperties: false;
|
|
449
|
+
};
|
|
450
|
+
readonly description: "its handles, declared for its edges to be drawn before it is measured";
|
|
451
|
+
};
|
|
452
|
+
readonly sourcePosition: {
|
|
453
|
+
readonly enum: readonly ["top", "right", "bottom", "left"];
|
|
454
|
+
readonly description: "the side its edges leave by when no handle gives one; default bottom";
|
|
455
|
+
};
|
|
456
|
+
readonly targetPosition: {
|
|
457
|
+
readonly enum: readonly ["top", "right", "bottom", "left"];
|
|
458
|
+
readonly description: "the side its edges enter by when no handle gives one; default top";
|
|
459
|
+
};
|
|
460
|
+
readonly origin: {
|
|
461
|
+
readonly type: "object";
|
|
462
|
+
readonly properties: {
|
|
463
|
+
readonly x: {
|
|
464
|
+
readonly type: "number";
|
|
465
|
+
readonly description: "the horizontal coordinate";
|
|
466
|
+
};
|
|
467
|
+
readonly y: {
|
|
468
|
+
readonly type: "number";
|
|
469
|
+
readonly description: "the vertical coordinate";
|
|
470
|
+
};
|
|
471
|
+
};
|
|
472
|
+
readonly required: readonly ["x", "y"];
|
|
473
|
+
readonly additionalProperties: false;
|
|
474
|
+
readonly description: "the point of its box its position stands at, as shares of its size, over the engine's nodeOrigin";
|
|
475
|
+
};
|
|
476
|
+
readonly zIndex: {
|
|
477
|
+
readonly type: "integer";
|
|
478
|
+
readonly description: "its place in the stacking order of its layer (nodes among nodes, edges among edges): a greater one is drawn above; default 0";
|
|
479
|
+
};
|
|
480
|
+
readonly selected: {
|
|
481
|
+
readonly type: "boolean";
|
|
482
|
+
readonly description: "it is selected (requires the selection feature)";
|
|
483
|
+
};
|
|
484
|
+
readonly parentId: {
|
|
485
|
+
readonly type: "string";
|
|
486
|
+
readonly minLength: 1;
|
|
487
|
+
readonly description: "the node it lives in, its position relative to it (requires the subflows feature)";
|
|
488
|
+
};
|
|
489
|
+
readonly extent: {
|
|
490
|
+
readonly anyOf: readonly [{
|
|
491
|
+
readonly const: "parent";
|
|
492
|
+
}, {
|
|
493
|
+
readonly type: "object";
|
|
494
|
+
readonly description: "a rectangle in flow coordinates: its top-left corner and its size";
|
|
495
|
+
readonly properties: {
|
|
496
|
+
readonly x: {
|
|
497
|
+
readonly type: "number";
|
|
498
|
+
readonly description: "its left edge";
|
|
499
|
+
};
|
|
500
|
+
readonly y: {
|
|
501
|
+
readonly type: "number";
|
|
502
|
+
readonly description: "its top edge";
|
|
503
|
+
};
|
|
504
|
+
readonly width: {
|
|
505
|
+
readonly type: "number";
|
|
506
|
+
readonly minimum: 0;
|
|
507
|
+
readonly description: "its width";
|
|
508
|
+
};
|
|
509
|
+
readonly height: {
|
|
510
|
+
readonly type: "number";
|
|
511
|
+
readonly minimum: 0;
|
|
512
|
+
readonly description: "its height";
|
|
513
|
+
};
|
|
514
|
+
};
|
|
515
|
+
readonly required: readonly ["x", "y", "width", "height"];
|
|
516
|
+
readonly additionalProperties: false;
|
|
517
|
+
}];
|
|
518
|
+
readonly description: '"parent": it stays inside its parent\'s box; a rectangle (x, y, width, height): it stays inside it, in the coordinates of its position (requires the subflows feature)';
|
|
519
|
+
};
|
|
520
|
+
readonly expandParent: {
|
|
521
|
+
readonly type: "boolean";
|
|
522
|
+
readonly description: "its parent grows to keep it inside (requires the subflows feature)";
|
|
523
|
+
};
|
|
524
|
+
};
|
|
525
|
+
readonly required: readonly ["type", "position", "data"];
|
|
526
|
+
readonly additionalProperties: false;
|
|
527
|
+
};
|
|
528
|
+
readonly description: "the nodes, in drawing order";
|
|
529
|
+
};
|
|
530
|
+
readonly edges: {
|
|
531
|
+
readonly type: "array";
|
|
532
|
+
readonly items: {
|
|
533
|
+
readonly type: "object";
|
|
534
|
+
readonly description: "an edge between two nodes";
|
|
535
|
+
readonly properties: {
|
|
536
|
+
readonly selectable: {
|
|
537
|
+
readonly type: "boolean";
|
|
538
|
+
readonly description: "it may be selected (`selection.set`); default true";
|
|
539
|
+
};
|
|
540
|
+
readonly deletable: {
|
|
541
|
+
readonly type: "boolean";
|
|
542
|
+
readonly description: "it may be removed (`edge.remove`, `selection.remove`); default true";
|
|
543
|
+
};
|
|
544
|
+
readonly hidden: {
|
|
545
|
+
readonly type: "boolean";
|
|
546
|
+
readonly description: "it is not shown; default false";
|
|
547
|
+
};
|
|
548
|
+
readonly reconnectable: {
|
|
549
|
+
readonly anyOf: readonly [{
|
|
550
|
+
readonly type: "boolean";
|
|
551
|
+
}, {
|
|
552
|
+
readonly const: "source";
|
|
553
|
+
}, {
|
|
554
|
+
readonly const: "target";
|
|
555
|
+
}];
|
|
556
|
+
readonly description: 'its ends may be moved to other nodes or handles (`edge.reconnect`): both (true), none (false), or only its "source" or its "target" end; default true';
|
|
557
|
+
};
|
|
558
|
+
readonly focusable: {
|
|
559
|
+
readonly type: "boolean";
|
|
560
|
+
readonly description: "it takes DOM focus (with the keyboard feature); default true";
|
|
561
|
+
};
|
|
562
|
+
readonly animated: {
|
|
563
|
+
readonly type: "boolean";
|
|
564
|
+
readonly description: "it is drawn animated (the app's CSS animates its data-animated parts); default false";
|
|
565
|
+
};
|
|
566
|
+
readonly id: {
|
|
567
|
+
readonly type: "string";
|
|
568
|
+
readonly minLength: 1;
|
|
569
|
+
readonly description: "its id; generated when missing";
|
|
570
|
+
};
|
|
571
|
+
readonly source: {
|
|
572
|
+
readonly type: "string";
|
|
573
|
+
readonly minLength: 1;
|
|
574
|
+
readonly description: "the id of the node it starts at";
|
|
575
|
+
};
|
|
576
|
+
readonly target: {
|
|
577
|
+
readonly type: "string";
|
|
578
|
+
readonly minLength: 1;
|
|
579
|
+
readonly description: "the id of the node it ends at";
|
|
580
|
+
};
|
|
581
|
+
readonly sourceHandle: {
|
|
582
|
+
readonly type: "string";
|
|
583
|
+
readonly minLength: 1;
|
|
584
|
+
readonly description: "the source node's handle it starts at; none: the node's default source handle";
|
|
585
|
+
};
|
|
586
|
+
readonly targetHandle: {
|
|
587
|
+
readonly type: "string";
|
|
588
|
+
readonly minLength: 1;
|
|
589
|
+
readonly description: "the target node's handle it ends at; none: the node's default target handle";
|
|
590
|
+
};
|
|
591
|
+
readonly type: {
|
|
592
|
+
readonly type: "string";
|
|
593
|
+
readonly minLength: 1;
|
|
594
|
+
readonly description: 'how it is drawn: "bezier" (the default), "simplebezier", "smoothstep", "step", "straight" or an app type';
|
|
595
|
+
};
|
|
596
|
+
readonly data: {
|
|
597
|
+
readonly type: "object";
|
|
598
|
+
readonly description: "the app's data, a JSON object typed by the node or edge type";
|
|
599
|
+
};
|
|
600
|
+
readonly zIndex: {
|
|
601
|
+
readonly type: "integer";
|
|
602
|
+
readonly description: "its place in the stacking order of its layer (nodes among nodes, edges among edges): a greater one is drawn above; default 0";
|
|
603
|
+
};
|
|
604
|
+
readonly pathOptions: {
|
|
605
|
+
readonly type: "object";
|
|
606
|
+
readonly description: "the shape of its path, over the engine's path options: each built-in type reads its own keys (bezier: curvature; smoothstep: borderRadius, offset, stepPosition, centerX, centerY; step: the same but borderRadius)";
|
|
607
|
+
readonly properties: {
|
|
608
|
+
readonly curvature: {
|
|
609
|
+
readonly type: "number";
|
|
610
|
+
readonly description: "bezier: the share of the distance a control point stands out by";
|
|
611
|
+
};
|
|
612
|
+
readonly borderRadius: {
|
|
613
|
+
readonly type: "number";
|
|
614
|
+
readonly minimum: 0;
|
|
615
|
+
readonly description: "smoothstep: the corners' radius, in flow units";
|
|
616
|
+
};
|
|
617
|
+
readonly offset: {
|
|
618
|
+
readonly type: "number";
|
|
619
|
+
readonly description: "smoothstep and step: how far an end stands out before turning, in flow units";
|
|
620
|
+
};
|
|
621
|
+
readonly stepPosition: {
|
|
622
|
+
readonly type: "number";
|
|
623
|
+
readonly minimum: 0;
|
|
624
|
+
readonly description: "smoothstep and step: where the turn sits between the source (0) and the target (1); above 1 counts as 1";
|
|
625
|
+
};
|
|
626
|
+
readonly centerX: {
|
|
627
|
+
readonly type: "number";
|
|
628
|
+
readonly description: "smoothstep and step: the x of a vertical turn, in flow coordinates";
|
|
629
|
+
};
|
|
630
|
+
readonly centerY: {
|
|
631
|
+
readonly type: "number";
|
|
632
|
+
readonly description: "smoothstep and step: the y of a horizontal turn, in flow coordinates";
|
|
633
|
+
};
|
|
634
|
+
};
|
|
635
|
+
readonly additionalProperties: false;
|
|
636
|
+
};
|
|
637
|
+
readonly selected: {
|
|
638
|
+
readonly type: "boolean";
|
|
639
|
+
readonly description: "it is selected (requires the selection feature)";
|
|
640
|
+
};
|
|
641
|
+
};
|
|
642
|
+
readonly required: readonly ["source", "target"];
|
|
643
|
+
readonly additionalProperties: false;
|
|
644
|
+
};
|
|
645
|
+
readonly description: "the edges, in drawing order";
|
|
646
|
+
};
|
|
647
|
+
};
|
|
648
|
+
readonly required: readonly ["version", "nodes", "edges"];
|
|
649
|
+
readonly additionalProperties: false;
|
|
650
|
+
};
|
|
651
|
+
/** A flow document that cannot be loaded: every problem found, each with its JSON path. */
|
|
652
|
+
export declare class FlowValidationError extends Error {
|
|
653
|
+
/** every problem found, each with its JSON path (RFC 6901) */
|
|
654
|
+
readonly issues: readonly ValidationIssue[];
|
|
655
|
+
constructor(issues: readonly ValidationIssue[]);
|
|
656
|
+
}
|
|
657
|
+
/** Whether `value` has a node's shape: a string `id`, a `position` point, no `source` or `target`. */
|
|
658
|
+
export declare function isNode<T extends FlowTypes = AnyTypes>(value: unknown): value is FlowNode<T>;
|
|
659
|
+
/** Whether `value` has an edge's shape: a string `id`, `source` and `target`. */
|
|
660
|
+
export declare function isEdge<T extends FlowTypes = AnyTypes>(value: unknown): value is FlowEdge<T>;
|
|
661
|
+
/** What `validateFlow` checks against: the features the document will be loaded with. */
|
|
662
|
+
interface ValidateFlowOptions {
|
|
663
|
+
/** the features installed (a field of one not given is an issue); default none */
|
|
664
|
+
features?: FlowFeatures | undefined;
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Every problem of a flow document, each with its JSON path, or none: what `createFlowModel`
|
|
668
|
+
* would throw a `FlowValidationError` with. It never throws for a document (only for a features
|
|
669
|
+
* list `createFlowModel` would refuse too: a feature twice, or one missing a requirement).
|
|
670
|
+
*/
|
|
671
|
+
export declare function validateFlow(json: unknown, options?: ValidateFlowOptions): readonly ValidationIssue[];
|
|
672
|
+
/** The engine events a root calls back, each with its callback's name (after `on`). */
|
|
673
|
+
export declare const ENGINE_EVENT_CALLBACKS: Readonly<{
|
|
674
|
+
readonly "viewport-change-start": "MoveStart";
|
|
675
|
+
readonly "viewport-change-end": "MoveEnd";
|
|
676
|
+
readonly ready: "Init";
|
|
677
|
+
readonly "node-click": "NodeClick";
|
|
678
|
+
readonly "node-double-click": "NodeDoubleClick";
|
|
679
|
+
readonly "node-context-menu": "NodeContextMenu";
|
|
680
|
+
readonly "edge-click": "EdgeClick";
|
|
681
|
+
readonly "edge-double-click": "EdgeDoubleClick";
|
|
682
|
+
readonly "edge-context-menu": "EdgeContextMenu";
|
|
683
|
+
readonly "pane-click": "PaneClick";
|
|
684
|
+
readonly "pane-double-click": "PaneDoubleClick";
|
|
685
|
+
readonly "pane-context-menu": "PaneContextMenu";
|
|
686
|
+
readonly "selection-context-menu": "SelectionContextMenu";
|
|
687
|
+
readonly "box-select-start": "SelectionStart";
|
|
688
|
+
readonly "box-select": "SelectionEnd";
|
|
689
|
+
readonly "drag-start": "NodeDragStart";
|
|
690
|
+
readonly "nodes-move": "NodesMove";
|
|
691
|
+
readonly "drag-cancel": "NodeDragCancel";
|
|
692
|
+
readonly "selection-drag-start": "SelectionDragStart";
|
|
693
|
+
readonly "selection-drag": "SelectionDrag";
|
|
694
|
+
readonly "selection-drag-end": "SelectionDragStop";
|
|
695
|
+
readonly "connect-start": "ConnectStart";
|
|
696
|
+
readonly "connect-target": "ConnectTarget";
|
|
697
|
+
readonly connect: "Connect";
|
|
698
|
+
readonly "connect-cancel": "ConnectCancel";
|
|
699
|
+
readonly "reconnect-start": "ReconnectStart";
|
|
700
|
+
readonly reconnect: "Reconnect";
|
|
701
|
+
readonly "reconnect-cancel": "ReconnectCancel";
|
|
702
|
+
readonly "resize-start": "ResizeStart";
|
|
703
|
+
readonly resize: "ResizeEnd";
|
|
704
|
+
readonly "resize-cancel": "ResizeCancel";
|
|
705
|
+
readonly remove: "Delete";
|
|
706
|
+
}>;
|
|
707
|
+
/** An engine event a root calls back. */
|
|
708
|
+
type CallbackEventType = keyof typeof ENGINE_EVENT_CALLBACKS;
|
|
709
|
+
/** A callback's name after `on` (`NodeClick`). */
|
|
710
|
+
type EventCallbackName = (typeof ENGINE_EVENT_CALLBACKS)[CallbackEventType];
|
|
711
|
+
/**
|
|
712
|
+
* The keys `watchKeyPress` waits for: a combo, or several (any of them). A combo is key names
|
|
713
|
+
* joined by `+`, all held at once: `"Shift"`, `"Meta+s"`, `"Control+Shift+z"`. A name is a
|
|
714
|
+
* `KeyboardEvent.key` (`"a"`, `"Shift"`, `"Delete"`, `" "` for Space) or a `KeyboardEvent.code`
|
|
715
|
+
* (`"KeyA"`, `"Space"`), compared without case.
|
|
716
|
+
*/
|
|
717
|
+
type KeyPressKeys = string | readonly string[];
|
|
718
|
+
/** What `watchKeyPress` listens to: a window, a document or an element. */
|
|
719
|
+
interface KeyPressTarget {
|
|
720
|
+
addEventListener(type: string, listener: (event: Event) => void, options?: boolean | AddEventListenerOptions): void;
|
|
721
|
+
removeEventListener(type: string, listener: (event: Event) => void, options?: boolean | EventListenerOptions): void;
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Calls `onChange(pressed)` whenever one of the combos of `keys` starts or stops being held,
|
|
725
|
+
* reading `keydown` and `keyup` on `target` (a window, a document or an element). The keys held
|
|
726
|
+
* are forgotten when the target's window loses focus, and when Meta is released (its platform
|
|
727
|
+
* swallows the other keys' `keyup` while it is held). Returns the function that stops listening.
|
|
728
|
+
*/
|
|
729
|
+
export declare function watchKeyPress(target: KeyPressTarget, keys: KeyPressKeys, onChange: (pressed: boolean) => void): () => void;
|
|
730
|
+
/** Options of {@link bezierPath}. */
|
|
731
|
+
interface BezierPathOptions extends PathEnds {
|
|
732
|
+
/** the share of the distance along a side its control point stands out by; default 0.5 */
|
|
733
|
+
readonly curvature?: number | undefined;
|
|
734
|
+
}
|
|
735
|
+
/** What {@link bezierPath} returns: its path, its label point and how far that lies from the source. */
|
|
736
|
+
interface BezierPathResult extends PathResult {
|
|
737
|
+
/** the distance across (x) and down (y) from the source to the label point, both positive */
|
|
738
|
+
readonly labelOffset: XY;
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* A bezier edge's path from `source` to `target`, its label point (the curve's middle,
|
|
742
|
+
* `t = 0.5`) and that point's offset from the source.
|
|
743
|
+
*/
|
|
744
|
+
export declare function bezierPath(options: BezierPathOptions): BezierPathResult;
|
|
745
|
+
/** The middle of two ends, and the distance across (x) and down (y) from it to either end. */
|
|
746
|
+
interface EdgeCenter {
|
|
747
|
+
/** the point halfway between the ends, in flow coordinates */
|
|
748
|
+
readonly center: XY;
|
|
749
|
+
/** half the distance between the ends across (x) and down (y), both positive */
|
|
750
|
+
readonly offset: XY;
|
|
751
|
+
}
|
|
752
|
+
/** The point halfway between an edge's `source` and `target`, and how far each end lies from it. */
|
|
753
|
+
export declare function edgeCenter(source: XY, target: XY): EdgeCenter;
|
|
754
|
+
/** Options of {@link simpleBezierPath}: the two ends and their sides. */
|
|
755
|
+
interface SimpleBezierPathOptions extends PathEnds {}
|
|
756
|
+
/**
|
|
757
|
+
* A simple bezier edge's path from `source` to `target`, and its label point (the curve's middle,
|
|
758
|
+
* `t = 0.5`).
|
|
759
|
+
*/
|
|
760
|
+
export declare function simpleBezierPath(options: SimpleBezierPathOptions): PathResult;
|
|
761
|
+
/** Where the turn between two ends facing each other goes (`smoothStepPath`, `stepPath`). */
|
|
762
|
+
interface StepTurnOptions {
|
|
763
|
+
/**
|
|
764
|
+
* where the turn sits between the source (0) and the target (1), along the ends' axis (across
|
|
765
|
+
* it when the target is behind), counted from the points `offset` out from each end so that
|
|
766
|
+
* 0 and 1 keep the stand-out; default 0.5 (also for a value that is not a finite number)
|
|
767
|
+
*/
|
|
768
|
+
readonly stepPosition?: number | undefined;
|
|
769
|
+
/** the turn's x (flow units) when it runs vertically, over `stepPosition` (when finite) */
|
|
770
|
+
readonly centerX?: number | undefined;
|
|
771
|
+
/** the turn's y (flow units) when it runs horizontally, over `stepPosition` (when finite) */
|
|
772
|
+
readonly centerY?: number | undefined;
|
|
773
|
+
}
|
|
774
|
+
/** Options of {@link smoothStepPath}. */
|
|
775
|
+
interface SmoothStepPathOptions extends PathEnds, StepTurnOptions {
|
|
776
|
+
/** the radius of each rounded corner, in flow units; default 5 */
|
|
777
|
+
readonly borderRadius?: number | undefined;
|
|
778
|
+
/** how far each end stands out from its node before the route turns, in flow units; default 20 */
|
|
779
|
+
readonly offset?: number | undefined;
|
|
780
|
+
}
|
|
781
|
+
/** Options of {@link stepPath}. */
|
|
782
|
+
interface StepPathOptions extends PathEnds, StepTurnOptions {
|
|
783
|
+
/** how far each end stands out from its node before the route turns, in flow units; default 20 */
|
|
784
|
+
readonly offset?: number | undefined;
|
|
785
|
+
}
|
|
786
|
+
/** A smooth step edge's path (orthogonal, rounded corners) and its label point. */
|
|
787
|
+
export declare function smoothStepPath(options: SmoothStepPathOptions): PathResult;
|
|
788
|
+
/** A step edge's path (orthogonal, square corners) and its label point. */
|
|
789
|
+
export declare function stepPath(options: StepPathOptions): PathResult;
|
|
790
|
+
/** The engine options the static geometry follows (give it the root's, so both agree). */
|
|
791
|
+
interface StaticGeometryOptions {
|
|
792
|
+
/** the point of a node's box its position stands at, as shares of its size; default top-left */
|
|
793
|
+
readonly nodeOrigin?: XY | undefined;
|
|
794
|
+
/** the shape of the built-in edge paths (an edge's own `pathOptions` go over them) */
|
|
795
|
+
readonly pathOptions?: PathOptions | undefined;
|
|
796
|
+
/** how stack values are worked out; default `"auto"` */
|
|
797
|
+
readonly zIndexMode?: ZIndexMode | undefined;
|
|
798
|
+
/** a selected node is raised; default true */
|
|
799
|
+
readonly elevateNodesOnSelect?: boolean | undefined;
|
|
800
|
+
/** a selected edge is raised; default false in `"basic"`, true in `"auto"` */
|
|
801
|
+
readonly elevateEdgesOnSelect?: boolean | undefined;
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* A flow's geometry from its document alone (frozen plain data, keyed by id), as the engine's reads
|
|
805
|
+
* give it before anything is measured.
|
|
806
|
+
*/
|
|
807
|
+
interface StaticGeometry {
|
|
808
|
+
/** every node's box in absolute flow coordinates, its size 0 when unknown (`node-rect-by`) */
|
|
809
|
+
readonly nodeRects: Readonly<Record<string, Rect>>;
|
|
810
|
+
/** every node's structural `z-index` (`node-z-index-by`) */
|
|
811
|
+
readonly nodeZIndexes: Readonly<Record<string, number>>;
|
|
812
|
+
/** the path of each edge whose two nodes have a known size (`edge-path-by`); others are absent */
|
|
813
|
+
readonly edgePaths: Readonly<Record<string, EdgePath>>;
|
|
814
|
+
/** the ids of the edges to draw, in drawing order (`drawn-edges`, without `onlyRenderVisible`) */
|
|
815
|
+
readonly drawnEdges: readonly string[];
|
|
816
|
+
/** the levels to draw (`render-layers`) */
|
|
817
|
+
readonly layers: readonly RenderLayer[];
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* The geometry of a flow's document without an engine: what an adapter renders on the server and
|
|
821
|
+
* in its first client render, before the engine measures anything.
|
|
822
|
+
*/
|
|
823
|
+
export declare function staticGeometry<T extends FlowTypes = AnyTypes>(flow: {
|
|
824
|
+
readonly nodes: readonly FlowNode<T>[];
|
|
825
|
+
readonly edges: readonly FlowEdge<T>[];
|
|
826
|
+
}, options?: StaticGeometryOptions): StaticGeometry;
|
|
827
|
+
/** Options of {@link straightPath}: its two ends (the sides do not change a straight line). */
|
|
828
|
+
interface StraightPathOptions {
|
|
829
|
+
readonly source: XY;
|
|
830
|
+
readonly target: XY;
|
|
831
|
+
}
|
|
832
|
+
/** A straight edge's path and its label point (the middle of the line). */
|
|
833
|
+
export declare function straightPath(options: StraightPathOptions): PathResult;
|
|
834
|
+
/**
|
|
835
|
+
* The TypeScript type a schema of the {@link JsonSchema} subset describes. Used by the type tests to
|
|
836
|
+
* check each command's hand-written schema against its payload type, so the two cannot drift. It
|
|
837
|
+
* does not follow `$ref`.
|
|
838
|
+
*/
|
|
839
|
+
type FromSchema<S> = S extends {
|
|
840
|
+
readonly const: infer C;
|
|
841
|
+
} ? C : S extends {
|
|
842
|
+
readonly enum: readonly (infer E)[];
|
|
843
|
+
} ? E : S extends {
|
|
844
|
+
readonly anyOf: readonly (infer A)[];
|
|
845
|
+
} ? FromSchema<A> : S extends {
|
|
846
|
+
readonly oneOf: readonly (infer A)[];
|
|
847
|
+
} ? FromSchema<A> : S extends {
|
|
848
|
+
readonly type: "object";
|
|
849
|
+
} ? ObjectFromSchema<S> : S extends {
|
|
850
|
+
readonly type: "array";
|
|
851
|
+
readonly items: infer I;
|
|
852
|
+
} ? FromSchema<I>[] : S extends {
|
|
853
|
+
readonly type: "string";
|
|
854
|
+
} ? string : S extends {
|
|
855
|
+
readonly type: "number" | "integer";
|
|
856
|
+
} ? number : S extends {
|
|
857
|
+
readonly type: "boolean";
|
|
858
|
+
} ? boolean : S extends {
|
|
859
|
+
readonly type: "null";
|
|
860
|
+
} ? null : unknown;
|
|
861
|
+
type RequiredKeys<S> = S extends {
|
|
862
|
+
readonly required: readonly (infer R)[];
|
|
863
|
+
} ? R : never;
|
|
864
|
+
type Simplify<T> = { [K in keyof T]: T[K]; } & {};
|
|
865
|
+
type ObjectFromSchema<S> = S extends {
|
|
866
|
+
readonly properties: infer P;
|
|
867
|
+
} ? Simplify<{ -readonly [K in keyof P as K extends RequiredKeys<S> ? K : never]: FromSchema<P[K]>; } & { -readonly [K in keyof P as K extends RequiredKeys<S> ? never : K]?: FromSchema<P[K]>; }> : Record<string, unknown>;
|
|
868
|
+
/**
|
|
869
|
+
* Whether two values read from the model or the engine are the same: the same value
|
|
870
|
+
* (`Object.is`), or arrays of the same values in order, or plain records with the same keys and
|
|
871
|
+
* values, compared all the way down. Anything else (a DOM event, a class instance, a function)
|
|
872
|
+
* is the same only when it is the very same.
|
|
873
|
+
*/
|
|
874
|
+
export declare function sameFlowValue(a: unknown, b: unknown): boolean;
|
|
875
|
+
export { type AllowedKeys, type AnyFlowFeature, type AnyTypes, type AutoPanGesture, type AutoPanOptions, type BackgroundPattern, type BackgroundPatternPayload, type BackgroundVariant, type BatchEntry, type BatchStep, type BezierPathOptions, type BezierPathResult, type BuiltInEdgeType, type CallbackEventType, type CommandArgs, type CommandContext, type CommandContextBase, type CommandContextGetKey, type CommandContextGetMap, type CommandDefinition, type CommandError, type CommandErrorCode, type CommandEvent, type CommandInfo, type CommandListener, type CommandMap, type CommandName, type CommandNameOf, type CommandResult, type Connection, type ConnectionDrop, type ConnectionEnd, type ConnectionPayload, type CreateId, DIRECTION_ATTRIBUTE, DRAG_HANDLE_ATTRIBUTE, type DeclaredHandle, type DefaultEdgeOptions, type DispatchOptions, END_ATTRIBUTE, type EdgeCenter, type EdgeDataOf, type EdgeDataPatchOf, type EdgeFields, type EdgeFlags, type EdgeFlagsPayload, type EdgeOf, type EdgePath, type EdgePathOptions, type EdgeToolbarPayload, type EdgeToolbarPosition, type EdgeTypeOf, type EngineActionKey, type EngineActionKeyOf, type EngineActionMap, type EngineActionPayload, type EngineActionResult, type EngineGetKey, type EngineGetKeyOf, type EngineGetMap, type EngineGetPayload, type EngineGetResult, type EngineIsKey, type EngineIsKeyOf, type EngineIsMap, type EngineIsPayload, type EventCallbackName, FEATURE_KEYS, type Failure, type FeatureEngine, type FeatureEngineHost, type FeatureGesture, type FeatureKeyKind, type FeatureModel, type FeatureName, type FeatureNamesOf, type FitPadding, type FitViewPayload, type FlowDocument, type FlowDocumentJson, type FlowEdge, type FlowEdgeInput, type FlowEngine, type FlowEngineAdapter, type FlowEngineEvent, type FlowEngineEventOf, type FlowEngineEventType, type FlowEngineOptions, type FlowFeature, type FlowFeatures, type FlowHandle, type FlowJson, type FlowModel, type FlowModelOptions, type FlowNode, type FlowNodeInput, type FlowPart, type FlowPointerInfo, type FlowReader, type FlowTypes, type FromSchema, type HandleRegistration, type HandleSide, type HandleType, ID_ATTRIBUTE, type IdKind, type InteractionKind, type Interactivity, type InteractivityPayload, type InternalNode, type IntersectingNodesPayload, type JsonSchema, type JsonSchemaType, type JsonValue, type KeyPressKeys, type KeyPressTarget, LEVEL_ATTRIBUTE, type Middleware, type MinimapView, type ModelGetKey, type ModelGetKeyOf, type ModelGetMap, type ModelGetPayload, type ModelGetResult, type ModelIsKey, type ModelIsKeyOf, type ModelIsMap, type ModelIsPayload, type MoveSource, type MutablePartAttributes, NO_GESTURE_ATTRIBUTE, NO_WHEEL_ATTRIBUTE, type NoPayload, type NodeConnection, type NodeData, type NodeDataOf, type NodeDataPatchOf, type NodeFields, type NodeFlags, type NodeFlagsPayload, type NodeOf, type NodeToolbarPayload, type NodeToolbarPosition, type NodeTypeOf, type OwnedBy, PART_ATTRIBUTE, POSITION_ATTRIBUTE, type PaddingValue, type PanOnScrollMode, type PartAttributes, type PartPayloadMap, type PathEnds, type PathOptions, type PathResult, type PayloadOf, type PressTarget, type QueryArgs, type Rect, type ReduceContext, type RemovedResult, type RenderLayer, type ResizeHandleAttributeOptions, type ResizeHandleDirection, type ResizeHandleVariant, type ResultOf, type RunOptions, type SelectionBox, type SelectionDragStep, type SelectionFields, type SelectionMode, type SelectionResult, type SimpleBezierPathOptions, type SmoothStepPathOptions, type StaticGeometry, type StaticGeometryOptions, type StepPathOptions, type StepTurnOptions, type StraightPathOptions, type SubflowFields, VARIANT_ATTRIBUTE, type ValidateFlowOptions, type ValidationIssue, type ViewChange, type Viewport, type ViewportEasing, type ViewportForBoundsOptions, type ViewportForBoundsPayload, type XY, type ZIndexMode, type ZoomStepPayload, createFlowEngine, createFlowModel, edgesLayerAttributes, flag, partAttributes, resizeHandleAttributes, viewportForBounds };
|
|
876
|
+
//# sourceMappingURL=index.d.ts.map
|