@squeed/flow-sdk 1.1.16 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +876 -118
- package/THIRD_PARTY_NOTICES.txt +121 -0
- package/dist/index-CPKLNAh1.js +461 -0
- package/dist/index-CPKLNAh1.js.map +1 -0
- package/dist/index-sHQXTNv9.cjs +3 -0
- package/dist/index-sHQXTNv9.cjs.map +1 -0
- package/dist/index.cjs +177 -353
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1240 -0
- package/dist/index.d.ts +777 -21
- package/dist/index.js +16100 -31299
- package/dist/index.js.map +1 -1
- package/package.json +44 -19
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
|
+
import { Context } from 'react';
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
3
|
+
import { DetailedHTMLProps } from 'react';
|
|
4
|
+
import { ForwardRefExoticComponent } from 'react';
|
|
5
|
+
import { IconButtonProps } from '@chakra-ui/react';
|
|
6
|
+
import { InputHTMLAttributes } from 'react';
|
|
1
7
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
8
|
+
import { MemoExoticComponent } from 'react';
|
|
2
9
|
import { MutableRefObject } from 'react';
|
|
10
|
+
import { ReactNode } from 'react';
|
|
11
|
+
import { ReactPortal } from 'react';
|
|
12
|
+
import { RefAttributes } from 'react';
|
|
13
|
+
import { StyledComponent } from '@emotion/styled';
|
|
14
|
+
import { Theme } from '@emotion/react';
|
|
3
15
|
|
|
4
16
|
/** Add a child under `parentAddress`. Returns the new node's address. */
|
|
5
17
|
export declare function addChild(json: SqueedJson, parentAddress: string, child: any, key?: string): {
|
|
@@ -7,6 +19,8 @@ export declare function addChild(json: SqueedJson, parentAddress: string, child:
|
|
|
7
19
|
address: string;
|
|
8
20
|
};
|
|
9
21
|
|
|
22
|
+
export declare function addConnection(json: SqueedJson, sourceAddress: string, connection: SqueedConnection): SqueedJson;
|
|
23
|
+
|
|
10
24
|
/** "root.a.b.#" → ["a", "b"] */
|
|
11
25
|
export declare function addressToPath(address: string): string[];
|
|
12
26
|
|
|
@@ -22,14 +36,25 @@ export declare function applyCollapsed(nodes: FlowDiagramNode[], edges: FlowDiag
|
|
|
22
36
|
edges: FlowDiagramEdge[];
|
|
23
37
|
};
|
|
24
38
|
|
|
39
|
+
export declare function applyFormChange(data: SqueedJson, request: Omit<FormChange, "data" | "previousValue">, handler?: (event: FormChange) => FormEdit[] | void): SqueedJson;
|
|
40
|
+
|
|
41
|
+
export declare function applyStateEdits(state: SqueedJson, edits: readonly FormEdit[]): SqueedJson;
|
|
42
|
+
|
|
25
43
|
export declare type BackgroundPattern = "dot" | "steel" | "grid" | "none";
|
|
26
44
|
|
|
45
|
+
export declare type BackgroundVariant = BackgroundPattern | "transparent";
|
|
46
|
+
|
|
27
47
|
/**
|
|
28
48
|
* Wrap consumer callbacks so every toolbar/edit event is applied to `json`
|
|
29
49
|
* with Squeed `$` keys and delivered via `onJsonChange`. Granular callbacks
|
|
30
50
|
* still fire first (for logging/analytics) — consumers must not also mutate.
|
|
31
51
|
*/
|
|
32
|
-
export declare function bindSqueedCallbacks(json: SqueedJson, compiledEdges: FlowDiagramEdge[], callbacks: FlowDiagramCallbacks, onJsonChange?: (json: SqueedJson, change: SqueedChange) => void): FlowDiagramCallbacks;
|
|
52
|
+
export declare function bindSqueedCallbacks(json: SqueedJson, compiledEdges: FlowDiagramEdge[], callbacks: FlowDiagramCallbacks, onJsonChange?: (json: SqueedJson, change: SqueedChange) => void, formSchema?: FormSchema): FlowDiagramCallbacks;
|
|
53
|
+
|
|
54
|
+
export declare const BottomBar: MemoExoticComponent< {
|
|
55
|
+
(): JSX_2.Element;
|
|
56
|
+
displayName: string;
|
|
57
|
+
}>;
|
|
33
58
|
|
|
34
59
|
/** Props passed to custom bottom bar renderer */
|
|
35
60
|
export declare interface BottomBarRenderProps {
|
|
@@ -56,6 +81,21 @@ export declare interface BottomBarRenderProps {
|
|
|
56
81
|
callbacks: FlowDiagramCallbacks;
|
|
57
82
|
}
|
|
58
83
|
|
|
84
|
+
/** Centre + size, model units (matches cytoscape's node position/width/height) */
|
|
85
|
+
declare interface Box {
|
|
86
|
+
x: number;
|
|
87
|
+
y: number;
|
|
88
|
+
w: number;
|
|
89
|
+
h: number;
|
|
90
|
+
outline?: Point[];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export declare type BuiltInEdgeType = "straight" | "bezier" | "orthogonal" | "rounded-orthogonal";
|
|
94
|
+
|
|
95
|
+
export declare function CompactPropertyLayoutToggle({ label, }?: {
|
|
96
|
+
label?: string;
|
|
97
|
+
}): JSX_2.Element;
|
|
98
|
+
|
|
59
99
|
export declare interface CompileOptions {
|
|
60
100
|
title?: string;
|
|
61
101
|
/** Root in the middle, children fan out both ways (direction "C") */
|
|
@@ -75,6 +115,17 @@ export declare function compileSqueed(json: SqueedJson, opts?: CompileOptions):
|
|
|
75
115
|
edges: FlowDiagramEdge[];
|
|
76
116
|
};
|
|
77
117
|
|
|
118
|
+
export declare function connectionIssue(contract: WorkflowContract, edge: FlowDiagramEdge["data"]): string | undefined;
|
|
119
|
+
|
|
120
|
+
export declare function ConnectionsOnlyToggle({ checked, onChange, disabled, label, }: ConnectionsOnlyToggleProps): JSX_2.Element;
|
|
121
|
+
|
|
122
|
+
export declare interface ConnectionsOnlyToggleProps {
|
|
123
|
+
checked: boolean;
|
|
124
|
+
onChange: (checked: boolean) => void;
|
|
125
|
+
disabled?: boolean;
|
|
126
|
+
label?: string;
|
|
127
|
+
}
|
|
128
|
+
|
|
78
129
|
export declare const contentObjTheme: (color: any) => {
|
|
79
130
|
background: any;
|
|
80
131
|
highlight: string;
|
|
@@ -85,28 +136,164 @@ export declare const contentObjTheme: (color: any) => {
|
|
|
85
136
|
number: string;
|
|
86
137
|
};
|
|
87
138
|
|
|
139
|
+
declare interface ContractPort {
|
|
140
|
+
kind: "input" | "config" | "output" | "error";
|
|
141
|
+
resourceType?: string;
|
|
142
|
+
multiple?: boolean;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export declare interface ContractProperty {
|
|
146
|
+
type: ContractType;
|
|
147
|
+
optional: boolean;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export declare type ContractType = {
|
|
151
|
+
kind: "json";
|
|
152
|
+
} | {
|
|
153
|
+
kind: "string" | "number" | "integer" | "boolean" | "null";
|
|
154
|
+
} | {
|
|
155
|
+
kind: "literal";
|
|
156
|
+
value: string | number | boolean | null;
|
|
157
|
+
} | {
|
|
158
|
+
kind: "union";
|
|
159
|
+
types: ContractType[];
|
|
160
|
+
} | {
|
|
161
|
+
kind: "array";
|
|
162
|
+
items: ContractType;
|
|
163
|
+
} | {
|
|
164
|
+
kind: "object";
|
|
165
|
+
properties: Record<string, ContractProperty>;
|
|
166
|
+
additionalProperties?: ContractType;
|
|
167
|
+
ports?: Record<string, ContractPort>;
|
|
168
|
+
};
|
|
169
|
+
|
|
88
170
|
export declare function createFlowDiagram(jsnObjct: any, path?: string, nodes?: any[], edges?: any[], activeLabel?: string, flowConfig?: any, nodeConfig?: any): {
|
|
89
171
|
nodes: any[];
|
|
90
172
|
edges: any[];
|
|
91
173
|
};
|
|
92
174
|
|
|
93
|
-
export declare
|
|
175
|
+
export declare function createFlowDocumentActions(options: FlowDocumentActionOptions): {
|
|
176
|
+
replaceJson(value: unknown): SqueedJson;
|
|
177
|
+
replaceState(value: unknown): SqueedJson;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
export declare function createFormNode(document: SqueedJson, source: string, schema?: FormSchema): {
|
|
181
|
+
address: string;
|
|
182
|
+
json: SqueedJson;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export declare function createJsonPlayback<Document>(options: JsonStreamOptions<Document> & {
|
|
186
|
+
source: string;
|
|
187
|
+
durationMs?: number;
|
|
188
|
+
tickMs?: number;
|
|
189
|
+
onChange: (state: JsonPlaybackState) => void;
|
|
190
|
+
onError: (error: unknown) => void;
|
|
191
|
+
}): {
|
|
192
|
+
play(): void;
|
|
193
|
+
pause(): void;
|
|
194
|
+
seek(next: number): void;
|
|
195
|
+
dispose(): void;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export declare function createJsonStream<Document>(options: JsonStreamOptions<Document>): {
|
|
199
|
+
snapshot: (text: string) => void;
|
|
200
|
+
append(chunk: string): void;
|
|
201
|
+
flush: () => void;
|
|
202
|
+
finish(): Document;
|
|
203
|
+
cancel(): void;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
export declare interface CustomEdgeContext {
|
|
207
|
+
edge: FlowDiagramEdge["data"];
|
|
208
|
+
source: Box;
|
|
209
|
+
target: Box;
|
|
210
|
+
sourcePoint: Point;
|
|
211
|
+
targetPoint: Point;
|
|
212
|
+
direction: FlowDirection;
|
|
213
|
+
sourceY?: number;
|
|
214
|
+
targetY?: number;
|
|
215
|
+
inverted: boolean;
|
|
216
|
+
defaultGeometry: CustomEdgeGeometry;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export declare type CustomEdgeFactory = (context: CustomEdgeContext) => CustomEdgeGeometry | null;
|
|
220
|
+
|
|
221
|
+
export declare interface CustomEdgeGeometry {
|
|
222
|
+
d: string;
|
|
223
|
+
arrow?: string;
|
|
224
|
+
label: {
|
|
225
|
+
x: number;
|
|
226
|
+
y: number;
|
|
227
|
+
angle: number;
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export declare const DEFAULT_PALETTE: string[];
|
|
232
|
+
|
|
233
|
+
export declare function DiagramAppearanceControls(): JSX_2.Element;
|
|
234
|
+
|
|
235
|
+
export declare function downloadSvg(canvas: HTMLElement, filename?: string): Promise<void>;
|
|
236
|
+
|
|
237
|
+
export declare const DynamicIcon: ({ name, svg, ...props }: {
|
|
94
238
|
[x: string]: any;
|
|
95
239
|
name: any;
|
|
240
|
+
svg?: boolean;
|
|
96
241
|
}) => JSX_2.Element;
|
|
97
242
|
|
|
98
|
-
export declare
|
|
99
|
-
|
|
243
|
+
export declare type EdgeAnimationVariant = "dashed" | "traveling";
|
|
244
|
+
|
|
245
|
+
export declare type EdgeMode = "auto" | "nodes" | "properties" | "workflow";
|
|
246
|
+
|
|
247
|
+
/** Bottom-bar contents while an edge is selected */
|
|
248
|
+
export declare function EdgeTools({ edgeId, onClose, }: {
|
|
249
|
+
edgeId: string;
|
|
250
|
+
onClose: () => void;
|
|
100
251
|
}): JSX_2.Element;
|
|
101
252
|
|
|
253
|
+
export declare const EditableLabel: ({ nodeId, label, color, fontWeight, fontSize, wrap, isEditing, onEditStart, onEditEnd, }: EditableLabelProps) => JSX_2.Element;
|
|
254
|
+
|
|
255
|
+
declare interface EditableLabelProps {
|
|
256
|
+
nodeId: string;
|
|
257
|
+
label: string;
|
|
258
|
+
color: string;
|
|
259
|
+
fontWeight?: string;
|
|
260
|
+
fontSize?: string;
|
|
261
|
+
wrap?: boolean;
|
|
262
|
+
isEditing: boolean;
|
|
263
|
+
onEditStart: () => void;
|
|
264
|
+
onEditEnd: () => void;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export declare function ErrorToast({ message, onDismiss, }: {
|
|
268
|
+
message: string;
|
|
269
|
+
onDismiss: () => void;
|
|
270
|
+
}): ReactPortal;
|
|
271
|
+
|
|
272
|
+
export declare function exportSvg(canvas: HTMLElement): Promise<string>;
|
|
273
|
+
|
|
274
|
+
export declare function FlowDiagram({ loading, loader, ...props }: FlowDiagramProps): JSX_2.Element;
|
|
275
|
+
|
|
102
276
|
/** Event callbacks for the flow diagram */
|
|
103
277
|
export declare interface FlowDiagramCallbacks {
|
|
278
|
+
onAllNodesIconLabelChange?: (enabled: boolean) => void;
|
|
279
|
+
onNodeCreateRequest?: (request: FlowNodeCreationRequest) => boolean;
|
|
280
|
+
onFormSchemaChange?: (schema: FormSchema | undefined) => void;
|
|
281
|
+
onFormChange?: (event: FormChange) => FormEdit[] | void;
|
|
282
|
+
resolveFormOptions?: (request: FormOptionsRequest) => Promise<FormOption[]> | FormOption[];
|
|
283
|
+
onSpacingChange?: (spacing: NodeSpacing) => void;
|
|
284
|
+
onEdgeRadiusChange?: (radius: number) => void;
|
|
285
|
+
onCompactPropertyLayoutChange?: (enabled: boolean) => void;
|
|
286
|
+
onBackgroundVariantChange?: (variant: BackgroundVariant) => void;
|
|
104
287
|
/** Fires when a node is clicked/selected */
|
|
105
|
-
onNodeSelect?: (nodeId: string, nodeData: any) => void;
|
|
288
|
+
onNodeSelect?: (nodeId: string, nodeData: any, modifiers?: NodeSelectionModifiers) => void;
|
|
289
|
+
onBackgroundClick?: () => void;
|
|
106
290
|
/** Fires when selection is cleared */
|
|
107
291
|
onNodeDeselect?: () => void;
|
|
108
292
|
/** Fires on double-click of a node */
|
|
109
293
|
onNodeDoubleClick?: (nodeId: string, nodeData: any) => void;
|
|
294
|
+
onNodeViewModeChange?: (nodeId: string, mode: NodeViewMode) => void;
|
|
295
|
+
onNodeViewToggle?: (nodeId: string) => void;
|
|
296
|
+
onNodeTypeViewChange?: (nodeId: string, view: NodeTypeView | undefined) => void;
|
|
110
297
|
/** Fires when a node is created via edge drawing into empty space */
|
|
111
298
|
onNodeCreate?: (params: {
|
|
112
299
|
type: string;
|
|
@@ -118,16 +305,25 @@ export declare interface FlowDiagramCallbacks {
|
|
|
118
305
|
onNodeDelete?: (nodeId: string, nodeData: any) => void;
|
|
119
306
|
/** Fires when a node label is edited inline */
|
|
120
307
|
onNodeLabelChange?: (nodeId: string, newLabel: string) => void;
|
|
308
|
+
onNodeContentChange?: (nodeId: string, content: string) => void;
|
|
121
309
|
/** Fires when a node's collapse toggle is clicked */
|
|
122
310
|
onNodeCollapse?: (nodeId: string, collapsed: boolean) => void;
|
|
123
311
|
/** Fires when a node's color is changed via the toolbar */
|
|
124
312
|
onNodeColorChange?: (nodeId: string, colorType: "text" | "bg", color: string) => void;
|
|
125
313
|
/** Fires when a node's icon is changed via the toolbar */
|
|
126
314
|
onNodeIconChange?: (nodeId: string, iconName: string) => void;
|
|
315
|
+
onNodeOutlineChange?: (nodeId: string, outline: boolean) => void;
|
|
316
|
+
onNodeBorderColorChange?: (nodeId: string, color: string) => void;
|
|
317
|
+
onNodeBorderStyleChange?: (nodeId: string, style: "solid" | "dashed") => void;
|
|
318
|
+
onNodeBorderWidthChange?: (nodeId: string, width: number | undefined) => void;
|
|
319
|
+
onNodeBorderRadiusChange?: (nodeId: string, radius: number | undefined) => void;
|
|
320
|
+
onNodeAnimationChange?: (nodeId: string, animated: boolean) => void;
|
|
321
|
+
onNodeAnimationVariantChange?: (nodeId: string, variant: NodeAnimationVariant) => void;
|
|
322
|
+
onEdgeAnimationVariantChange?: (edgeId: string, variant: EdgeAnimationVariant) => void;
|
|
127
323
|
/** Fires when a hover overlay action is clicked */
|
|
128
324
|
onNodeHoverAction?: (actionId: string, nodeId: string, nodeData: any) => void;
|
|
129
325
|
/** Fires when a new edge is drawn between two nodes */
|
|
130
|
-
onEdgeCreate?: (sourceId: string, targetId: string) => void;
|
|
326
|
+
onEdgeCreate?: (sourceId: string, targetId: string, properties?: FlowEdgeProperties) => void;
|
|
131
327
|
/** Fires when an edge is clicked/selected */
|
|
132
328
|
onEdgeSelect?: (edgeId: string, edgeData: any) => void;
|
|
133
329
|
/** Fires when edge selection is cleared */
|
|
@@ -138,6 +334,8 @@ export declare interface FlowDiagramCallbacks {
|
|
|
138
334
|
onEdgeDelete?: (edgeId: string, edgeData: any) => void;
|
|
139
335
|
/** Fires when an edge's color is changed */
|
|
140
336
|
onEdgeColorChange?: (edgeId: string, color: string) => void;
|
|
337
|
+
onEdgeTypeChange?: (edgeId: string, type: string | undefined) => void;
|
|
338
|
+
onEdgeIconChange?: (edgeId: string, icon: string) => void;
|
|
141
339
|
/** Fires when an edge's label is changed */
|
|
142
340
|
onEdgeLabelChange?: (edgeId: string, newLabel: string) => void;
|
|
143
341
|
/** Fires when an edge's style is changed (solid, dashed, animated) */
|
|
@@ -152,10 +350,15 @@ export declare interface FlowDiagramCallbacks {
|
|
|
152
350
|
}) => void;
|
|
153
351
|
/** Fires when the flow direction changes via bottom bar */
|
|
154
352
|
onDirectionChange?: (direction: FlowDirection) => void;
|
|
353
|
+
onThemeColorChange?: (color: string) => void;
|
|
354
|
+
onEdgeModeChange?: (mode: EdgeMode) => void;
|
|
355
|
+
onWorkflowContractChange?: (contract: WorkflowContract | undefined) => void;
|
|
155
356
|
/** Fires when array/set mode toggles in bottom bar */
|
|
156
357
|
onArrayModeChange?: (isArrayMode: boolean) => void;
|
|
157
|
-
/** Fires
|
|
158
|
-
|
|
358
|
+
/** Fires once the renderer is ready with the engine handle (zoom/pan/fit/coordinate helpers) */
|
|
359
|
+
onInit?: (engine: FlowEngine) => void;
|
|
360
|
+
/** Fires after layout and measurement settle; viewport-only changes do not trigger it. */
|
|
361
|
+
onLayoutComplete?: (engine: FlowEngine) => void;
|
|
159
362
|
/**
|
|
160
363
|
* Fires with the updated Squeed JSON after any toolbar/inline edit. The SDK applies the
|
|
161
364
|
* edit with `$` schema keys; store the result and pass it back as `json`.
|
|
@@ -165,8 +368,22 @@ export declare interface FlowDiagramCallbacks {
|
|
|
165
368
|
|
|
166
369
|
/** Configuration for the flow diagram appearance and behavior */
|
|
167
370
|
export declare interface FlowDiagramConfig {
|
|
371
|
+
bottomBarExtra?: React.ReactNode;
|
|
372
|
+
/** Animate fit/center/focus actions for 300ms by default. Per-action flags override this; reduced motion stays instant. */
|
|
373
|
+
animateViewport?: boolean;
|
|
374
|
+
formSchema?: FormSchema;
|
|
375
|
+
spacing?: NodeSpacing;
|
|
376
|
+
edgeRadius?: number;
|
|
377
|
+
backgroundVariant?: BackgroundVariant;
|
|
378
|
+
edgeType?: BuiltInEdgeType | (string & {});
|
|
379
|
+
customEdgeTypes?: Record<string, CustomEdgeFactory>;
|
|
168
380
|
/** Layout direction: "LR", "RL", "TB", "BT" */
|
|
169
381
|
direction?: FlowDirection;
|
|
382
|
+
nodeAlignment?: NodeAlignment;
|
|
383
|
+
edgeMode?: EdgeMode;
|
|
384
|
+
compactPropertyLayout?: boolean;
|
|
385
|
+
nodeViewModes?: Record<string, NodeViewMode>;
|
|
386
|
+
workflowContract?: WorkflowContract;
|
|
170
387
|
/** Layout algorithm */
|
|
171
388
|
layout?: LayoutAlgorithm;
|
|
172
389
|
/** Theme accent color (Chakra token e.g. "blue.500") */
|
|
@@ -225,16 +442,76 @@ export declare interface FlowDiagramConfig {
|
|
|
225
442
|
isDragMode?: boolean;
|
|
226
443
|
}
|
|
227
444
|
|
|
445
|
+
export declare interface FlowDiagramContextValue {
|
|
446
|
+
allNodesIconLabel: boolean;
|
|
447
|
+
setAllNodesIconLabel: (enabled: boolean) => void;
|
|
448
|
+
nodeViewModes: Record<string, NodeViewMode>;
|
|
449
|
+
setNodeViewMode: (nodeId: string, mode: NodeViewMode) => void;
|
|
450
|
+
spacing: number;
|
|
451
|
+
edgeRadius: number | undefined;
|
|
452
|
+
setEdgeRadius: (radius: number) => void;
|
|
453
|
+
setSpacing: (spacing: NodeSpacing) => void;
|
|
454
|
+
backgroundVariant: BackgroundVariant;
|
|
455
|
+
setBackgroundVariant: (variant: BackgroundVariant) => void;
|
|
456
|
+
setEdgeMode: (mode: EdgeMode) => void;
|
|
457
|
+
compactPropertyLayout: boolean;
|
|
458
|
+
setCompactPropertyLayout: (enabled: boolean) => void;
|
|
459
|
+
workflowContract?: WorkflowContract;
|
|
460
|
+
setWorkflowContract: (contract: WorkflowContract | undefined) => void;
|
|
461
|
+
themeColor: string;
|
|
462
|
+
setThemeColor: (color: string) => void;
|
|
463
|
+
backgroundSelected: boolean;
|
|
464
|
+
setBackgroundSelected: (selected: boolean) => void;
|
|
465
|
+
edgeColor: string;
|
|
466
|
+
colorMode: "light" | "dark";
|
|
467
|
+
direction: string;
|
|
468
|
+
nodeAlignment: NodeAlignment;
|
|
469
|
+
edgeMode: EdgeMode;
|
|
470
|
+
parentNodeStyle?: ParentNodeStyle;
|
|
471
|
+
selectedNodeIds: string[];
|
|
472
|
+
setSelectedNodeIds: (ids: string[]) => void;
|
|
473
|
+
selectedEdgeId: string | null;
|
|
474
|
+
setSelectedEdgeId: (id: string | null) => void;
|
|
475
|
+
isZoomMode: boolean;
|
|
476
|
+
setIsZoomMode: (v: boolean) => void;
|
|
477
|
+
isMultiSelectMode: boolean;
|
|
478
|
+
setIsMultiSelectMode: (v: boolean) => void;
|
|
479
|
+
isDragMode: boolean;
|
|
480
|
+
setIsDragMode: (v: boolean) => void;
|
|
481
|
+
isEdgeHandlesEnabled: boolean;
|
|
482
|
+
setIsEdgeHandlesEnabled: (v: boolean) => void;
|
|
483
|
+
isArrayNodeMode: boolean;
|
|
484
|
+
setIsArrayNodeMode: (v: boolean) => void;
|
|
485
|
+
isPinned: boolean;
|
|
486
|
+
setIsPinned: (v: boolean) => void;
|
|
487
|
+
isPerformanceMode: boolean;
|
|
488
|
+
setIsPerformanceMode: (v: boolean) => void;
|
|
489
|
+
engineRef: React.MutableRefObject<FlowEngine | null>;
|
|
490
|
+
callbacks: FlowDiagramCallbacks;
|
|
491
|
+
config: FlowDiagramConfig;
|
|
492
|
+
readOnly: boolean;
|
|
493
|
+
}
|
|
494
|
+
|
|
228
495
|
export declare interface FlowDiagramEdge {
|
|
229
496
|
data: {
|
|
230
497
|
id: string;
|
|
498
|
+
type?: BuiltInEdgeType | (string & {});
|
|
231
499
|
source: string;
|
|
232
500
|
target: string;
|
|
501
|
+
sourceProperty?: string;
|
|
502
|
+
targetProperty?: string;
|
|
503
|
+
connection?: SqueedConnectionRef;
|
|
504
|
+
collapsedEndpoints?: {
|
|
505
|
+
source: string;
|
|
506
|
+
target: string;
|
|
507
|
+
};
|
|
233
508
|
label?: string;
|
|
509
|
+
icon?: string;
|
|
234
510
|
/** Chakra token or hex; overrides the theme/edgeColor line color for this edge */
|
|
235
511
|
color?: string;
|
|
236
512
|
isInverted?: boolean;
|
|
237
513
|
isEdgeAnimated?: boolean;
|
|
514
|
+
edgeAnimationVariant?: EdgeAnimationVariant;
|
|
238
515
|
isEdgeDashed?: boolean;
|
|
239
516
|
};
|
|
240
517
|
}
|
|
@@ -251,11 +528,17 @@ export declare interface FlowDiagramNode {
|
|
|
251
528
|
description?: Record<string, any>;
|
|
252
529
|
viewProps?: any;
|
|
253
530
|
config?: Record<string, any>;
|
|
531
|
+
isNodeAnimated?: boolean;
|
|
532
|
+
nodeAnimationVariant?: NodeAnimationVariant;
|
|
254
533
|
};
|
|
255
534
|
}
|
|
256
535
|
|
|
257
536
|
/** Top-level props for the FlowDiagram component */
|
|
258
537
|
export declare interface FlowDiagramProps {
|
|
538
|
+
/** Show the loader while the host fetches data; initial compilation waits until false. */
|
|
539
|
+
loading?: boolean;
|
|
540
|
+
/** Custom loading content. Defaults to an accessible status message. Also shown while new JSON is prepared. */
|
|
541
|
+
loader?: React.ReactNode;
|
|
259
542
|
/** Title shown on the root node */
|
|
260
543
|
title?: string;
|
|
261
544
|
/**
|
|
@@ -263,6 +546,7 @@ export declare interface FlowDiagramProps {
|
|
|
263
546
|
* edit is reported through `callbacks.onJsonChange`. Takes precedence over nodes/edges.
|
|
264
547
|
*/
|
|
265
548
|
json?: Record<string, any> | any[];
|
|
549
|
+
forms?: StateForms;
|
|
266
550
|
/** Pre-computed nodes */
|
|
267
551
|
nodes?: FlowDiagramNode[];
|
|
268
552
|
/** Pre-computed edges */
|
|
@@ -271,33 +555,260 @@ export declare interface FlowDiagramProps {
|
|
|
271
555
|
config?: FlowDiagramConfig;
|
|
272
556
|
/** Event callbacks */
|
|
273
557
|
callbacks?: FlowDiagramCallbacks;
|
|
558
|
+
showBottomBar?: boolean;
|
|
559
|
+
/** Custom controls rendered inside the diagram and form providers, even when showBottomBar is false. */
|
|
560
|
+
children?: React.ReactNode;
|
|
274
561
|
/** CSS class name */
|
|
275
562
|
className?: string;
|
|
276
563
|
/** Inline styles */
|
|
277
564
|
style?: React.CSSProperties;
|
|
278
565
|
}
|
|
279
566
|
|
|
567
|
+
export declare function FlowDiagramProvider({ config, callbacks, nodes, edges, children, }: {
|
|
568
|
+
config: FlowDiagramConfig;
|
|
569
|
+
callbacks: FlowDiagramCallbacks;
|
|
570
|
+
nodes?: FlowDiagramNode[];
|
|
571
|
+
edges?: FlowDiagramEdge[];
|
|
572
|
+
children: React.ReactNode;
|
|
573
|
+
}): JSX_2.Element;
|
|
574
|
+
|
|
280
575
|
/** "C" = center: root in the middle, children fan out both ways (generate with `isCntr: true`); laid out as LR */
|
|
281
576
|
export declare type FlowDirection = "LR" | "RL" | "TB" | "BT" | "C";
|
|
282
577
|
|
|
578
|
+
export declare interface FlowDocumentActionOptions {
|
|
579
|
+
json?: SqueedJson;
|
|
580
|
+
state?: SqueedJson;
|
|
581
|
+
readOnly?: boolean;
|
|
582
|
+
onJsonChange?: (json: SqueedJson, change: SqueedChange) => void;
|
|
583
|
+
onStateChange?: StateForms["onChange"];
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
export declare interface FlowEdgeProperties {
|
|
587
|
+
sourceProperty?: string;
|
|
588
|
+
targetProperty?: string;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
/** Handle passed to `callbacks.onInit`. */
|
|
592
|
+
export declare interface FlowEngine {
|
|
593
|
+
zoom(): number;
|
|
594
|
+
/** Set zoom keeping the current pan (like cytoscape `cy.zoom(level)`) */
|
|
595
|
+
zoom(level: number): void;
|
|
596
|
+
pan(): Point;
|
|
597
|
+
pan(p: Point): void;
|
|
598
|
+
/** Zoom keeping the model point under `renderedPoint` (container px) fixed */
|
|
599
|
+
zoomAt(level: number, renderedPoint: Point): void;
|
|
600
|
+
/** Fit all elements into the container with `padding` rendered px */
|
|
601
|
+
fit(padding?: number, animate?: boolean): void;
|
|
602
|
+
/** Explicit alias for fit: fit and centre all elements with screen-pixel padding. */
|
|
603
|
+
centerAndFit(padding?: number, animate?: boolean): void;
|
|
604
|
+
/** Centre all elements at the current zoom */
|
|
605
|
+
center(animate?: boolean): void;
|
|
606
|
+
/** Fit one currently laid-out node; padding is in screen pixels (default 50). */
|
|
607
|
+
focusNode(id: string, padding?: number, animate?: boolean): void;
|
|
608
|
+
/** Fit laid-out hierarchy descendants and outgoing reachable nodes. Does not expand collapsed nodes. Animate overrides config.animateViewport. */
|
|
609
|
+
focusBranch(id: string, padding?: number, animate?: boolean): void;
|
|
610
|
+
focusConnections(id: string, padding?: number, animate?: boolean): void;
|
|
611
|
+
isolateConnections(id: string, padding?: number, animate?: boolean): void;
|
|
612
|
+
/** Temporarily show only this branch and fit it, preserving graph data. */
|
|
613
|
+
isolateBranch(id: string, padding?: number, animate?: boolean): void;
|
|
614
|
+
/** End isolation and restore the viewport saved when isolation began. */
|
|
615
|
+
restoreView(animate?: boolean): void;
|
|
616
|
+
/** Hide/show edge paths, labels and hit targets without changing graph data. */
|
|
617
|
+
setEdgesVisible(visible: boolean): void;
|
|
618
|
+
clientToModel(clientX: number, clientY: number): Point;
|
|
619
|
+
modelToClient(p: Point): Point;
|
|
620
|
+
getNodeBox(id: string): Box | undefined;
|
|
621
|
+
setNodePosition(id: string, position: Point | undefined, options?: {
|
|
622
|
+
persist?: boolean;
|
|
623
|
+
}): boolean;
|
|
624
|
+
onViewportChange(fn: (vp: ViewportState) => void): () => void;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
export declare interface FlowNodeCreationRequest {
|
|
628
|
+
sourceNodeId: string;
|
|
629
|
+
sourceProperty?: string;
|
|
630
|
+
reverse: boolean;
|
|
631
|
+
position: {
|
|
632
|
+
x: number;
|
|
633
|
+
y: number;
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
export declare function FlowPort({ id, role, side, position, placement, children, style, }: FlowPortProps): JSX_2.Element;
|
|
638
|
+
|
|
639
|
+
export declare interface FlowPortProps {
|
|
640
|
+
id: string;
|
|
641
|
+
role: "source" | "target";
|
|
642
|
+
side?: PortSide;
|
|
643
|
+
position?: number;
|
|
644
|
+
placement?: "config";
|
|
645
|
+
children?: ReactNode;
|
|
646
|
+
style?: CSSProperties;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
export declare const FlowView: MemoExoticComponent<({ nodes, edges }: FlowViewProps) => JSX_2.Element>;
|
|
650
|
+
|
|
651
|
+
declare interface FlowViewProps {
|
|
652
|
+
nodes: FlowDiagramNode[];
|
|
653
|
+
edges: FlowDiagramEdge[];
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
export declare interface FormBinding {
|
|
657
|
+
$type: string;
|
|
658
|
+
$fields?: Record<string, FormFieldConfig>;
|
|
659
|
+
$create?: FormCreation;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
export declare interface FormChange extends FormRequest {
|
|
663
|
+
previousValue: unknown;
|
|
664
|
+
value: unknown;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
export declare type FormCondition = {
|
|
668
|
+
$address: string;
|
|
669
|
+
} & ({
|
|
670
|
+
$equals: FormValue;
|
|
671
|
+
} | {
|
|
672
|
+
$in: FormValue[];
|
|
673
|
+
});
|
|
674
|
+
|
|
675
|
+
export declare interface FormCreation {
|
|
676
|
+
$address: string;
|
|
677
|
+
$type: string;
|
|
678
|
+
$label?: string;
|
|
679
|
+
$icon?: string;
|
|
680
|
+
$edgeLabel?: string;
|
|
681
|
+
$defaults?: Record<string, unknown>;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
export declare const FormDocumentContext: Context< {
|
|
685
|
+
setSchema?: (schema: FormSchema | undefined) => void;
|
|
686
|
+
data?: SqueedJson;
|
|
687
|
+
viewData?: SqueedJson;
|
|
688
|
+
bindings?: StateForms["bindings"];
|
|
689
|
+
editable?: boolean;
|
|
690
|
+
schema?: FormSchema;
|
|
691
|
+
renderForm?: StateForms["renderForm"];
|
|
692
|
+
structured?: StructuredForms;
|
|
693
|
+
references?: StateForms["references"];
|
|
694
|
+
callbacks: FlowDiagramCallbacks;
|
|
695
|
+
}>;
|
|
696
|
+
|
|
697
|
+
export declare type FormEdit = {
|
|
698
|
+
op: "set";
|
|
699
|
+
address: string;
|
|
700
|
+
value: unknown;
|
|
701
|
+
} | {
|
|
702
|
+
op: "remove";
|
|
703
|
+
address: string;
|
|
704
|
+
};
|
|
705
|
+
|
|
706
|
+
export declare interface FormFieldConfig {
|
|
707
|
+
$label?: string;
|
|
708
|
+
$section?: string;
|
|
709
|
+
$control?: "input" | "textarea" | "select" | "pills" | "checkbox";
|
|
710
|
+
$visibleWhen?: FormCondition;
|
|
711
|
+
$requiredWhen?: FormCondition;
|
|
712
|
+
$options?: {
|
|
713
|
+
$source: "callback";
|
|
714
|
+
$dependsOn?: string[];
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
export declare interface FormOption {
|
|
719
|
+
label: string;
|
|
720
|
+
value: FormValue;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
export declare interface FormOptionsRequest extends FormRequest {
|
|
724
|
+
signal: AbortSignal;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
export declare interface FormRequest {
|
|
728
|
+
address: string;
|
|
729
|
+
nodeAddress: string;
|
|
730
|
+
nodeId?: string;
|
|
731
|
+
data: SqueedJson;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
export declare type FormSchema = Record<string, Extract<ContractType, {
|
|
735
|
+
kind: "object";
|
|
736
|
+
}>>;
|
|
737
|
+
|
|
738
|
+
export declare type FormValue = string | number | boolean | null;
|
|
739
|
+
|
|
740
|
+
export declare function formValueError(type: ContractType, value: unknown, required: boolean): string | undefined;
|
|
741
|
+
|
|
283
742
|
export declare const getChakraColorHex: (color?: any, opacity?: any) => any;
|
|
284
743
|
|
|
285
744
|
export declare const getColorVariant: (color: string) => {
|
|
286
|
-
secondary: string;
|
|
287
|
-
primary?: undefined;
|
|
288
|
-
light?: undefined;
|
|
289
|
-
} | {
|
|
290
745
|
primary: string;
|
|
291
746
|
secondary: string;
|
|
292
747
|
light: string;
|
|
748
|
+
} | {
|
|
749
|
+
secondary: string;
|
|
750
|
+
primary?: undefined;
|
|
751
|
+
light?: undefined;
|
|
293
752
|
};
|
|
294
753
|
|
|
295
754
|
export declare function getDarkerHexColor(hex: string, factor?: number): string;
|
|
296
755
|
|
|
297
756
|
export declare function getNode(json: SqueedJson, address: string): any;
|
|
298
757
|
|
|
758
|
+
export declare interface JsonPlaybackState {
|
|
759
|
+
position: number;
|
|
760
|
+
total: number;
|
|
761
|
+
playing: boolean;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
export declare interface JsonStreamOptions<Document> {
|
|
765
|
+
parse: (source: string) => Document;
|
|
766
|
+
repair: (source: string) => string;
|
|
767
|
+
preview: (document: Document) => void;
|
|
768
|
+
commit: (document: Document) => void;
|
|
769
|
+
intervalMs?: number;
|
|
770
|
+
maxBytes?: number;
|
|
771
|
+
}
|
|
772
|
+
|
|
299
773
|
export declare type LayoutAlgorithm = "dagre" | "elk" | "tidytree" | "concentric" | "cose";
|
|
300
774
|
|
|
775
|
+
export declare const NODE_TYPE_VIEWS: readonly ["", "icon-label", "object", "text"];
|
|
776
|
+
|
|
777
|
+
export declare type NodeAlignment = "leading" | "center" | "trailing";
|
|
778
|
+
|
|
779
|
+
export declare type NodeAnimationVariant = "traveling" | "pulse";
|
|
780
|
+
|
|
781
|
+
export declare function NodeBorderRadiusControl({ ids, showDivider, }: {
|
|
782
|
+
ids: string[];
|
|
783
|
+
showDivider?: boolean;
|
|
784
|
+
}): JSX_2.Element;
|
|
785
|
+
|
|
786
|
+
export declare function NodeConfigSummary({ nodeAddress, expanded, }: {
|
|
787
|
+
nodeAddress: string;
|
|
788
|
+
expanded?: boolean;
|
|
789
|
+
}): JSX_2.Element;
|
|
790
|
+
|
|
791
|
+
export declare function NodeForm({ nodeAddress }: {
|
|
792
|
+
nodeAddress: string;
|
|
793
|
+
}): JSX_2.Element;
|
|
794
|
+
|
|
795
|
+
export declare function NodeFormPopover({ nodeAddress, active, label, open, onClose, children, filter, height, }: {
|
|
796
|
+
nodeAddress: string;
|
|
797
|
+
active: boolean;
|
|
798
|
+
label: string;
|
|
799
|
+
open?: boolean;
|
|
800
|
+
onClose?: () => void;
|
|
801
|
+
children?: ReactNode;
|
|
802
|
+
filter?: ReactNode;
|
|
803
|
+
height?: number;
|
|
804
|
+
}): JSX_2.Element;
|
|
805
|
+
|
|
806
|
+
export declare function NodeIconPicker({ nodeId, edgeId, value, }: {
|
|
807
|
+
nodeId?: string;
|
|
808
|
+
edgeId?: string;
|
|
809
|
+
value?: string;
|
|
810
|
+
}): JSX_2.Element;
|
|
811
|
+
|
|
301
812
|
/** Actions shown in the hover overlay above nodes */
|
|
302
813
|
export declare interface NodeOverlayAction {
|
|
303
814
|
id: string;
|
|
@@ -315,12 +826,51 @@ export declare interface NodeOverlayProps {
|
|
|
315
826
|
setIsHovered: (v: boolean) => void;
|
|
316
827
|
}
|
|
317
828
|
|
|
829
|
+
export declare interface NodeSelectionModifiers {
|
|
830
|
+
shiftKey: boolean;
|
|
831
|
+
ctrlKey: boolean;
|
|
832
|
+
metaKey: boolean;
|
|
833
|
+
altKey: boolean;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
export declare type NodeSpacing = number | "compact" | "normal" | "spacious";
|
|
837
|
+
|
|
838
|
+
/** Bottom-bar contents while one or more nodes are selected */
|
|
839
|
+
export declare function NodeTools({ ids, onClose, }: {
|
|
840
|
+
ids: string[];
|
|
841
|
+
onClose: () => void;
|
|
842
|
+
}): JSX_2.Element;
|
|
843
|
+
|
|
844
|
+
export declare type NodeTypeView = Exclude<(typeof NODE_TYPE_VIEWS)[number], "">;
|
|
845
|
+
|
|
846
|
+
export declare const NodeView: MemoExoticComponent<({ data: nodeData, children, isInverted, isParent, }: NodeViewProps) => JSX_2.Element>;
|
|
847
|
+
|
|
848
|
+
declare interface NodeViewChildArgs {
|
|
849
|
+
id: string;
|
|
850
|
+
data: any;
|
|
851
|
+
isActive: boolean;
|
|
852
|
+
isLowZoom: boolean;
|
|
853
|
+
isEditing: boolean;
|
|
854
|
+
onEditStart: () => void;
|
|
855
|
+
onEditEnd: () => void;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
declare type NodeViewMode = "default" | "properties" | "icon-label";
|
|
859
|
+
|
|
860
|
+
declare interface NodeViewProps {
|
|
861
|
+
data: any;
|
|
862
|
+
isInverted?: boolean;
|
|
863
|
+
isParent?: boolean;
|
|
864
|
+
children: (args: NodeViewChildArgs) => React.ReactNode;
|
|
865
|
+
}
|
|
866
|
+
|
|
318
867
|
/**
|
|
319
868
|
* Style for compound (container) nodes. Set per node via `data.viewProps`,
|
|
320
869
|
* or for all containers via `config.parentNodeStyle` (per-node wins).
|
|
321
870
|
* Colors accept Chakra tokens ("purple.500") or hex.
|
|
322
871
|
*/
|
|
323
872
|
export declare interface ParentNodeStyle {
|
|
873
|
+
outline?: boolean;
|
|
324
874
|
/** Fill color; also the default border/label color (default: themeColor) */
|
|
325
875
|
bgColor?: string;
|
|
326
876
|
/** Fill opacity 0–1 (default 0.4) */
|
|
@@ -341,7 +891,32 @@ export declare interface ParentNodeStyle {
|
|
|
341
891
|
labelPosition?: "top" | "center" | "bottom";
|
|
342
892
|
}
|
|
343
893
|
|
|
344
|
-
|
|
894
|
+
export declare function parseFlowDocument(source: string): SqueedJson;
|
|
895
|
+
|
|
896
|
+
export declare function parseJsonContract(source: string, name: string): WorkflowContract;
|
|
897
|
+
|
|
898
|
+
export declare function parseTypeScriptContract(source: string, name: string): Promise<WorkflowContract>;
|
|
899
|
+
|
|
900
|
+
export declare function parseTypeScriptForm(source: string, name: string, typeName?: string, options?: {
|
|
901
|
+
allowJson?: boolean;
|
|
902
|
+
}): Promise<Extract<ContractType, {
|
|
903
|
+
kind: "object";
|
|
904
|
+
}>>;
|
|
905
|
+
|
|
906
|
+
declare interface Point {
|
|
907
|
+
x: number;
|
|
908
|
+
y: number;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
declare type PortSide = "top" | "right" | "bottom" | "left";
|
|
912
|
+
|
|
913
|
+
export declare function projectJsonPlaybackPreview(partial: SqueedJson, document: SqueedJson): SqueedJson;
|
|
914
|
+
|
|
915
|
+
export declare function readFormSchema(file: Pick<File, "name" | "size" | "text">, typeNames: string[]): Promise<FormSchema>;
|
|
916
|
+
|
|
917
|
+
export declare function readWorkflowContract(file: File): Promise<WorkflowContract>;
|
|
918
|
+
|
|
919
|
+
/** Removes explicit edges or suppresses a hierarchy edge without deleting its child. */
|
|
345
920
|
export declare function removeEdge(json: SqueedJson, edge: RenderedEdgeRef): {
|
|
346
921
|
json: SqueedJson;
|
|
347
922
|
removed: boolean;
|
|
@@ -349,10 +924,15 @@ export declare function removeEdge(json: SqueedJson, edge: RenderedEdgeRef): {
|
|
|
349
924
|
|
|
350
925
|
export declare function removeNode(json: SqueedJson, address: string): SqueedJson;
|
|
351
926
|
|
|
352
|
-
export declare interface RenderedEdgeRef {
|
|
927
|
+
export declare interface RenderedEdgeRef extends FlowEdgeProperties {
|
|
353
928
|
source: string;
|
|
354
929
|
target: string;
|
|
355
930
|
isInverted?: boolean | null;
|
|
931
|
+
connection?: SqueedConnectionRef;
|
|
932
|
+
collapsedEndpoints?: {
|
|
933
|
+
source: string;
|
|
934
|
+
target: string;
|
|
935
|
+
};
|
|
356
936
|
}
|
|
357
937
|
|
|
358
938
|
/**
|
|
@@ -362,9 +942,16 @@ export declare interface RenderedEdgeRef {
|
|
|
362
942
|
*/
|
|
363
943
|
export declare function resolveEdgeOwner(edge: RenderedEdgeRef): {
|
|
364
944
|
address: string;
|
|
365
|
-
kind: "hierarchy" | "target";
|
|
945
|
+
kind: "hierarchy" | "target" | "connection";
|
|
366
946
|
};
|
|
367
947
|
|
|
948
|
+
export declare function resolveStateView(view: SqueedJson, state: SqueedJson): SqueedJson;
|
|
949
|
+
|
|
950
|
+
declare interface RuntimeReference {
|
|
951
|
+
path: string;
|
|
952
|
+
label: string;
|
|
953
|
+
}
|
|
954
|
+
|
|
368
955
|
/** Props passed to custom edge selection toolbar renderer */
|
|
369
956
|
export declare interface SelectedEdgeToolbarProps {
|
|
370
957
|
edgeId: string;
|
|
@@ -384,7 +971,7 @@ export declare interface SelectionToolbarConfig {
|
|
|
384
971
|
/** Swatches offered for node/edge colors (Chakra tokens or hex). Default: 9 Chakra 500s */
|
|
385
972
|
palette?: string[];
|
|
386
973
|
/** Hide individual controls */
|
|
387
|
-
hide?: Array<"label" | "color" | "textColor" | "style" | "icon" | "collapse" | "delete">;
|
|
974
|
+
hide?: Array<"label" | "typeView" | "color" | "textColor" | "borderColor" | "style" | "outline" | "animation" | "icon" | "collapse" | "delete">;
|
|
388
975
|
}
|
|
389
976
|
|
|
390
977
|
export declare const setCollapsed: (json: SqueedJson, address: string, collapsed: boolean) => SqueedJson;
|
|
@@ -397,7 +984,7 @@ export declare function setNodeProp(json: SqueedJson, address: string, key: Sque
|
|
|
397
984
|
|
|
398
985
|
/** What changed in the Squeed document (delivered alongside the new JSON) */
|
|
399
986
|
export declare interface SqueedChange {
|
|
400
|
-
type: "nodeLabel" | "nodeColor" | "nodeIcon" | "nodeCollapse" | "nodeCreate" | "nodeDelete" | "edgeLabel" | "edgeStyle" | "edgeColor" | "edgeCreate" | "edgeDelete";
|
|
987
|
+
type: "documentReplace" | "form" | "nodeLabel" | "nodeContent" | "nodeColor" | "nodeStyle" | "nodeIcon" | "nodeOutline" | "nodeAnimation" | "nodeCollapse" | "nodeCreate" | "nodeDelete" | "edgeLabel" | "edgeStyle" | "edgeColor" | "edgeCreate" | "edgeDelete";
|
|
401
988
|
/** Node address affected (new node's address for nodeCreate) */
|
|
402
989
|
address?: string;
|
|
403
990
|
edge?: RenderedEdgeRef;
|
|
@@ -408,19 +995,36 @@ export declare interface SqueedChange {
|
|
|
408
995
|
|
|
409
996
|
/** Describes the edit behind an `onJsonChange` */
|
|
410
997
|
export declare interface SqueedChangeInfo {
|
|
411
|
-
type: "nodeLabel" | "nodeColor" | "nodeIcon" | "nodeCollapse" | "nodeCreate" | "nodeDelete" | "edgeLabel" | "edgeStyle" | "edgeColor" | "edgeCreate" | "edgeDelete";
|
|
998
|
+
type: "nodeLabel" | "nodeContent" | "nodeColor" | "nodeStyle" | "nodeIcon" | "nodeOutline" | "nodeAnimation" | "nodeCollapse" | "nodeCreate" | "nodeDelete" | "edgeLabel" | "edgeStyle" | "edgeColor" | "edgeCreate" | "edgeDelete";
|
|
412
999
|
address?: string;
|
|
413
|
-
edge?: {
|
|
1000
|
+
edge?: FlowEdgeProperties & {
|
|
414
1001
|
source: string;
|
|
415
1002
|
target: string;
|
|
416
1003
|
isInverted?: boolean | null;
|
|
1004
|
+
connection?: SqueedConnectionRef;
|
|
417
1005
|
};
|
|
418
1006
|
key?: string;
|
|
419
1007
|
value?: unknown;
|
|
420
1008
|
}
|
|
421
1009
|
|
|
1010
|
+
export declare interface SqueedConnection extends FlowEdgeProperties {
|
|
1011
|
+
animationVariant?: EdgeAnimationVariant;
|
|
1012
|
+
icon?: string;
|
|
1013
|
+
target: string;
|
|
1014
|
+
type?: string;
|
|
1015
|
+
id?: string;
|
|
1016
|
+
label?: string;
|
|
1017
|
+
color?: string;
|
|
1018
|
+
style?: "solid" | "dashed" | "animated";
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
export declare interface SqueedConnectionRef {
|
|
1022
|
+
address: string;
|
|
1023
|
+
key: string;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
422
1026
|
/** Schema keys that describe the edge *into* a node (parent → child) */
|
|
423
|
-
export declare type SqueedEdgeKey = "$sourceLabel" | "$isEdgeAnimated" | "$isEdgeDashed" | "$edgeColor";
|
|
1027
|
+
export declare type SqueedEdgeKey = "$edgeIcon" | "$edgeType" | "$sourceLabel" | "$isEdgeAnimated" | "$edgeAnimationVariant" | "$isEdgeDashed" | "$edgeColor";
|
|
424
1028
|
|
|
425
1029
|
/**
|
|
426
1030
|
* Squeed JSON = the source document `createFlowDiagram` compiles into nodes/edges.
|
|
@@ -430,7 +1034,126 @@ export declare type SqueedEdgeKey = "$sourceLabel" | "$isEdgeAnimated" | "$isEdg
|
|
|
430
1034
|
export declare type SqueedJson = Record<string, any> | any[];
|
|
431
1035
|
|
|
432
1036
|
/** Schema keys that live on a node */
|
|
433
|
-
export declare type SqueedNodeKey = "$label" | "$bgColor" | "$textColor" | "$borderColor" | "$borderRadius" | "$fontSize" | "$icon" | "$content" | "$media" | "$collapsed" | "$parent";
|
|
1037
|
+
export declare type SqueedNodeKey = "$view" | "$label" | "$subtitle" | "$form" | "$bgColor" | "$textColor" | "$borderColor" | "$borderStyle" | "$borderWidth" | "$borderRadius" | "$fontSize" | "$icon" | "$content" | "$media" | "$collapsed" | "$parent" | "$outline" | "$isNodeAnimated" | "$nodeAnimationVariant" | "$connections" | "$ports";
|
|
1038
|
+
|
|
1039
|
+
export declare interface StateFormBinding {
|
|
1040
|
+
address: string;
|
|
1041
|
+
type: string;
|
|
1042
|
+
schemaType?: string;
|
|
1043
|
+
portResources?: Record<string, string>;
|
|
1044
|
+
resourceType?: string;
|
|
1045
|
+
fields?: Record<string, FormFieldConfig>;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
export declare interface StateForms {
|
|
1049
|
+
structured?: boolean;
|
|
1050
|
+
references?: RuntimeReference[];
|
|
1051
|
+
/** Controlled resource data. Replace immutably to update forms, summaries and view references. */
|
|
1052
|
+
state: SqueedJson;
|
|
1053
|
+
bindings: Record<string, StateFormBinding>;
|
|
1054
|
+
renderForm?: (nodeAddress: string) => ReactNode | undefined;
|
|
1055
|
+
/** Receives user form edits after dependent edits. External state replacements do not echo here. */
|
|
1056
|
+
onStateChange?: (state: SqueedJson, change: FormChange) => void;
|
|
1057
|
+
/** Compatibility alias; onStateChange takes precedence when both are supplied. */
|
|
1058
|
+
onChange?: (state: SqueedJson, change: FormChange) => void;
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
declare interface StructuredForms {
|
|
1062
|
+
sourceSchema: FormSchema;
|
|
1063
|
+
sourceBindings: Record<string, StateFormBinding>;
|
|
1064
|
+
nodes: FlowDiagramNode[];
|
|
1065
|
+
edges: FlowDiagramEdge[];
|
|
1066
|
+
schema: FormSchema;
|
|
1067
|
+
bindings: Record<string, StateFormBinding>;
|
|
1068
|
+
slots: Map<string, StructuredSlot>;
|
|
1069
|
+
containers: Map<string, StructuredNode>;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
declare interface StructuredNode {
|
|
1073
|
+
address: string;
|
|
1074
|
+
type: ContractType;
|
|
1075
|
+
declared: ContractType;
|
|
1076
|
+
scalar: boolean;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
declare interface StructuredSlot {
|
|
1080
|
+
address: string;
|
|
1081
|
+
owner: string;
|
|
1082
|
+
field: string;
|
|
1083
|
+
type: ContractType;
|
|
1084
|
+
label: string;
|
|
1085
|
+
nodeId: string;
|
|
1086
|
+
present: boolean;
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
export declare function SvgExportButton(): JSX_2.Element;
|
|
1090
|
+
|
|
1091
|
+
export declare function Swatches({ colors, value, label, onPick, onReset, includeTransparent, }: {
|
|
1092
|
+
colors: string[];
|
|
1093
|
+
value?: string;
|
|
1094
|
+
label: string;
|
|
1095
|
+
onPick: (c: string) => void;
|
|
1096
|
+
onReset?: () => void;
|
|
1097
|
+
includeTransparent?: boolean;
|
|
1098
|
+
}): JSX_2.Element;
|
|
1099
|
+
|
|
1100
|
+
export declare const TEXT_PALETTE: string[];
|
|
1101
|
+
|
|
1102
|
+
export declare const ToolbarCloseButton: ForwardRefExoticComponent<Omit<Omit<IconButtonProps & RefAttributes<HTMLButtonElement>, "children">, "ref"> & RefAttributes<HTMLButtonElement>>;
|
|
1103
|
+
|
|
1104
|
+
export declare function ToolbarCommitInput({ value, placeholder, ariaLabel, width, type, min, onCommit, }: {
|
|
1105
|
+
value: string;
|
|
1106
|
+
placeholder: string;
|
|
1107
|
+
ariaLabel: string;
|
|
1108
|
+
width?: string;
|
|
1109
|
+
type?: "text" | "number";
|
|
1110
|
+
min?: number;
|
|
1111
|
+
onCommit: (v: string) => void;
|
|
1112
|
+
}): JSX_2.Element;
|
|
1113
|
+
|
|
1114
|
+
export declare function ToolbarDivider(): JSX_2.Element;
|
|
1115
|
+
|
|
1116
|
+
export declare const ToolbarIconButton: ForwardRefExoticComponent<Omit<IconButtonProps & RefAttributes<HTMLButtonElement> & {
|
|
1117
|
+
icon: React.ReactElement;
|
|
1118
|
+
}, "ref"> & RefAttributes<HTMLButtonElement>>;
|
|
1119
|
+
|
|
1120
|
+
export declare const ToolbarRangeInput: StyledComponent< {
|
|
1121
|
+
theme?: Theme;
|
|
1122
|
+
as?: React.ElementType;
|
|
1123
|
+
}, DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, {}>;
|
|
1124
|
+
|
|
1125
|
+
export declare function ToolbarScrollContainer({ children, background, border, }: {
|
|
1126
|
+
children: ReactNode;
|
|
1127
|
+
background: string;
|
|
1128
|
+
border: string;
|
|
1129
|
+
}): JSX_2.Element;
|
|
1130
|
+
|
|
1131
|
+
export declare function ToolbarSelect({ children, value, onValueChange, disabled, style, title, icon, popupContent, labelCase, "aria-label": label, }: {
|
|
1132
|
+
children: ReactNode;
|
|
1133
|
+
value: string;
|
|
1134
|
+
onValueChange: (value: string) => void;
|
|
1135
|
+
disabled?: boolean;
|
|
1136
|
+
style?: CSSProperties;
|
|
1137
|
+
title?: string;
|
|
1138
|
+
icon?: ReactNode;
|
|
1139
|
+
popupContent?: ReactNode;
|
|
1140
|
+
labelCase?: "title" | "preserve";
|
|
1141
|
+
"aria-label": string;
|
|
1142
|
+
}): JSX_2.Element;
|
|
1143
|
+
|
|
1144
|
+
export declare function ToolbarTooltip({ label, children, }: {
|
|
1145
|
+
label: string;
|
|
1146
|
+
children: React.ReactElement;
|
|
1147
|
+
}): JSX_2.Element;
|
|
1148
|
+
|
|
1149
|
+
export declare const TooltipIconButton: ({ icon, label, onClick, color, boxSize, ...props }: {
|
|
1150
|
+
[x: string]: any;
|
|
1151
|
+
icon: any;
|
|
1152
|
+
label: any;
|
|
1153
|
+
onClick: any;
|
|
1154
|
+
color: any;
|
|
1155
|
+
boxSize?: number;
|
|
1156
|
+
}) => JSX_2.Element;
|
|
434
1157
|
|
|
435
1158
|
/** Immutable update of the node at `address` (root address updates the document itself) */
|
|
436
1159
|
export declare function updateNode(json: SqueedJson, address: string, fn: (node: any) => any): SqueedJson;
|
|
@@ -456,6 +1179,24 @@ export declare function useCustomColors(theme?: any): {
|
|
|
456
1179
|
greenColor: string;
|
|
457
1180
|
};
|
|
458
1181
|
|
|
1182
|
+
export declare function useFlowData(): {
|
|
1183
|
+
nodeById: Map<string, FlowDiagramNode>;
|
|
1184
|
+
edgeById: Map<string, FlowDiagramEdge>;
|
|
1185
|
+
parentIds: Set<string>;
|
|
1186
|
+
};
|
|
1187
|
+
|
|
1188
|
+
export declare function useFlowDiagramContext(): FlowDiagramContextValue;
|
|
1189
|
+
|
|
1190
|
+
export declare function useNodeViewActions(): {
|
|
1191
|
+
allNodesIconLabel: boolean;
|
|
1192
|
+
setAllNodesIconLabel: (enabled: boolean) => void;
|
|
1193
|
+
getNodeViewMode: (nodeId: string) => NodeViewMode;
|
|
1194
|
+
showNodeProperties: (nodeId: string) => void;
|
|
1195
|
+
restoreNodeView: (nodeId: string) => void;
|
|
1196
|
+
toggleNodeView: (nodeId: string) => void;
|
|
1197
|
+
setNodeViewMode: (nodeId: string, mode: NodeViewMode) => void;
|
|
1198
|
+
};
|
|
1199
|
+
|
|
459
1200
|
/**
|
|
460
1201
|
* Hook that stops all event propagation on a DOM element.
|
|
461
1202
|
* Use this on any interactive element inside a node (inputs, textareas, forms)
|
|
@@ -481,4 +1222,19 @@ export declare function useThemeContentColors(color: any): {
|
|
|
481
1222
|
highlightColorFaint: string;
|
|
482
1223
|
};
|
|
483
1224
|
|
|
1225
|
+
declare interface ViewportState {
|
|
1226
|
+
pan: Point;
|
|
1227
|
+
zoom: number;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
export declare interface WorkflowContract {
|
|
1231
|
+
name: string;
|
|
1232
|
+
nodes: Record<string, ContractProperty>;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
export declare function WorkflowControls({ showDivider, compact, }?: {
|
|
1236
|
+
showDivider?: boolean;
|
|
1237
|
+
compact?: boolean;
|
|
1238
|
+
}): JSX_2.Element;
|
|
1239
|
+
|
|
484
1240
|
export { }
|