@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.cts
ADDED
|
@@ -0,0 +1,1240 @@
|
|
|
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';
|
|
7
|
+
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
8
|
+
import { MemoExoticComponent } from 'react';
|
|
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';
|
|
15
|
+
|
|
16
|
+
/** Add a child under `parentAddress`. Returns the new node's address. */
|
|
17
|
+
export declare function addChild(json: SqueedJson, parentAddress: string, child: any, key?: string): {
|
|
18
|
+
json: SqueedJson;
|
|
19
|
+
address: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export declare function addConnection(json: SqueedJson, sourceAddress: string, connection: SqueedConnection): SqueedJson;
|
|
23
|
+
|
|
24
|
+
/** "root.a.b.#" → ["a", "b"] */
|
|
25
|
+
export declare function addressToPath(address: string): string[];
|
|
26
|
+
|
|
27
|
+
/** `$target` cross-link (the compiler supports one per node; an existing one is replaced) */
|
|
28
|
+
export declare const addTargetEdge: (json: SqueedJson, sourceAddress: string, targetAddress: string, label?: string) => SqueedJson;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* For hand-built graphs (no Squeed JSON): hide everything downstream of a node whose
|
|
32
|
+
* `data.config.collapsed` is true, plus the edges touching hidden nodes.
|
|
33
|
+
*/
|
|
34
|
+
export declare function applyCollapsed(nodes: FlowDiagramNode[], edges: FlowDiagramEdge[]): {
|
|
35
|
+
nodes: FlowDiagramNode[];
|
|
36
|
+
edges: FlowDiagramEdge[];
|
|
37
|
+
};
|
|
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
|
+
|
|
43
|
+
export declare type BackgroundPattern = "dot" | "steel" | "grid" | "none";
|
|
44
|
+
|
|
45
|
+
export declare type BackgroundVariant = BackgroundPattern | "transparent";
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Wrap consumer callbacks so every toolbar/edit event is applied to `json`
|
|
49
|
+
* with Squeed `$` keys and delivered via `onJsonChange`. Granular callbacks
|
|
50
|
+
* still fire first (for logging/analytics) — consumers must not also mutate.
|
|
51
|
+
*/
|
|
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
|
+
}>;
|
|
58
|
+
|
|
59
|
+
/** Props passed to custom bottom bar renderer */
|
|
60
|
+
export declare interface BottomBarRenderProps {
|
|
61
|
+
zoomIn: () => void;
|
|
62
|
+
zoomOut: () => void;
|
|
63
|
+
resetZoom: () => void;
|
|
64
|
+
direction: FlowDirection;
|
|
65
|
+
isZoomMode: boolean;
|
|
66
|
+
setIsZoomMode: (v: boolean) => void;
|
|
67
|
+
isMultiSelectMode: boolean;
|
|
68
|
+
setIsMultiSelectMode: (v: boolean) => void;
|
|
69
|
+
isDragMode: boolean;
|
|
70
|
+
setIsDragMode: (v: boolean) => void;
|
|
71
|
+
isEdgeHandlesEnabled: boolean;
|
|
72
|
+
setIsEdgeHandlesEnabled: (v: boolean) => void;
|
|
73
|
+
isArrayNodeMode: boolean;
|
|
74
|
+
setIsArrayNodeMode: (v: boolean) => void;
|
|
75
|
+
selectedNodeIds: string[];
|
|
76
|
+
selectedNodeData: any[];
|
|
77
|
+
selectedEdgeId: string | null;
|
|
78
|
+
selectedEdgeData: any;
|
|
79
|
+
onNodeDeselect: () => void;
|
|
80
|
+
onEdgeDeselect: () => void;
|
|
81
|
+
callbacks: FlowDiagramCallbacks;
|
|
82
|
+
}
|
|
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
|
+
|
|
99
|
+
export declare interface CompileOptions {
|
|
100
|
+
title?: string;
|
|
101
|
+
/** Root in the middle, children fan out both ways (direction "C") */
|
|
102
|
+
isCenter?: boolean;
|
|
103
|
+
hideDefaultObject?: boolean;
|
|
104
|
+
separateObjectKeys?: boolean;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* `createFlowDiagram` + post-pass:
|
|
109
|
+
* - deterministic edge ids (`source->target[#n]`) so selection survives regeneration
|
|
110
|
+
* - honors `$isEdgeDashed` / `$edgeColor`, which the compiler doesn't read
|
|
111
|
+
* - `$label` wins over the compiler's shared-config `headerTitle` (it leaks the previous node's title)
|
|
112
|
+
*/
|
|
113
|
+
export declare function compileSqueed(json: SqueedJson, opts?: CompileOptions): {
|
|
114
|
+
nodes: FlowDiagramNode[];
|
|
115
|
+
edges: FlowDiagramEdge[];
|
|
116
|
+
};
|
|
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
|
+
|
|
129
|
+
export declare const contentObjTheme: (color: any) => {
|
|
130
|
+
background: any;
|
|
131
|
+
highlight: string;
|
|
132
|
+
border: string;
|
|
133
|
+
property: string;
|
|
134
|
+
boolean: string;
|
|
135
|
+
string: string;
|
|
136
|
+
number: string;
|
|
137
|
+
};
|
|
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
|
+
|
|
170
|
+
export declare function createFlowDiagram(jsnObjct: any, path?: string, nodes?: any[], edges?: any[], activeLabel?: string, flowConfig?: any, nodeConfig?: any): {
|
|
171
|
+
nodes: any[];
|
|
172
|
+
edges: any[];
|
|
173
|
+
};
|
|
174
|
+
|
|
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 }: {
|
|
238
|
+
[x: string]: any;
|
|
239
|
+
name: any;
|
|
240
|
+
svg?: boolean;
|
|
241
|
+
}) => JSX_2.Element;
|
|
242
|
+
|
|
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;
|
|
251
|
+
}): JSX_2.Element;
|
|
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
|
+
|
|
276
|
+
/** Event callbacks for the flow diagram */
|
|
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;
|
|
287
|
+
/** Fires when a node is clicked/selected */
|
|
288
|
+
onNodeSelect?: (nodeId: string, nodeData: any, modifiers?: NodeSelectionModifiers) => void;
|
|
289
|
+
onBackgroundClick?: () => void;
|
|
290
|
+
/** Fires when selection is cleared */
|
|
291
|
+
onNodeDeselect?: () => void;
|
|
292
|
+
/** Fires on double-click of a node */
|
|
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;
|
|
297
|
+
/** Fires when a node is created via edge drawing into empty space */
|
|
298
|
+
onNodeCreate?: (params: {
|
|
299
|
+
type: string;
|
|
300
|
+
position: any;
|
|
301
|
+
sourceNodeId?: string;
|
|
302
|
+
isArrayMode?: boolean;
|
|
303
|
+
}) => void;
|
|
304
|
+
/** Fires when a node is deleted */
|
|
305
|
+
onNodeDelete?: (nodeId: string, nodeData: any) => void;
|
|
306
|
+
/** Fires when a node label is edited inline */
|
|
307
|
+
onNodeLabelChange?: (nodeId: string, newLabel: string) => void;
|
|
308
|
+
onNodeContentChange?: (nodeId: string, content: string) => void;
|
|
309
|
+
/** Fires when a node's collapse toggle is clicked */
|
|
310
|
+
onNodeCollapse?: (nodeId: string, collapsed: boolean) => void;
|
|
311
|
+
/** Fires when a node's color is changed via the toolbar */
|
|
312
|
+
onNodeColorChange?: (nodeId: string, colorType: "text" | "bg", color: string) => void;
|
|
313
|
+
/** Fires when a node's icon is changed via the toolbar */
|
|
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;
|
|
323
|
+
/** Fires when a hover overlay action is clicked */
|
|
324
|
+
onNodeHoverAction?: (actionId: string, nodeId: string, nodeData: any) => void;
|
|
325
|
+
/** Fires when a new edge is drawn between two nodes */
|
|
326
|
+
onEdgeCreate?: (sourceId: string, targetId: string, properties?: FlowEdgeProperties) => void;
|
|
327
|
+
/** Fires when an edge is clicked/selected */
|
|
328
|
+
onEdgeSelect?: (edgeId: string, edgeData: any) => void;
|
|
329
|
+
/** Fires when edge selection is cleared */
|
|
330
|
+
onEdgeDeselect?: () => void;
|
|
331
|
+
/** Fires when an edge is removed */
|
|
332
|
+
onEdgeRemove?: (edgeId: string, edgeData: any) => void;
|
|
333
|
+
/** Fires when the user deletes an edge from the selection toolbar */
|
|
334
|
+
onEdgeDelete?: (edgeId: string, edgeData: any) => void;
|
|
335
|
+
/** Fires when an edge's color is changed */
|
|
336
|
+
onEdgeColorChange?: (edgeId: string, color: string) => void;
|
|
337
|
+
onEdgeTypeChange?: (edgeId: string, type: string | undefined) => void;
|
|
338
|
+
onEdgeIconChange?: (edgeId: string, icon: string) => void;
|
|
339
|
+
/** Fires when an edge's label is changed */
|
|
340
|
+
onEdgeLabelChange?: (edgeId: string, newLabel: string) => void;
|
|
341
|
+
/** Fires when an edge's style is changed (solid, dashed, animated) */
|
|
342
|
+
onEdgeStyleChange?: (edgeId: string, style: "solid" | "dashed" | "animated") => void;
|
|
343
|
+
/** Fires when the viewport (pan/zoom) changes */
|
|
344
|
+
onViewportChange?: (viewport: {
|
|
345
|
+
pan: {
|
|
346
|
+
x: number;
|
|
347
|
+
y: number;
|
|
348
|
+
};
|
|
349
|
+
zoom: number;
|
|
350
|
+
}) => void;
|
|
351
|
+
/** Fires when the flow direction changes via bottom bar */
|
|
352
|
+
onDirectionChange?: (direction: FlowDirection) => void;
|
|
353
|
+
onThemeColorChange?: (color: string) => void;
|
|
354
|
+
onEdgeModeChange?: (mode: EdgeMode) => void;
|
|
355
|
+
onWorkflowContractChange?: (contract: WorkflowContract | undefined) => void;
|
|
356
|
+
/** Fires when array/set mode toggles in bottom bar */
|
|
357
|
+
onArrayModeChange?: (isArrayMode: boolean) => void;
|
|
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;
|
|
362
|
+
/**
|
|
363
|
+
* Fires with the updated Squeed JSON after any toolbar/inline edit. The SDK applies the
|
|
364
|
+
* edit with `$` schema keys; store the result and pass it back as `json`.
|
|
365
|
+
*/
|
|
366
|
+
onJsonChange?: (json: Record<string, any> | any[], change: SqueedChangeInfo) => void;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/** Configuration for the flow diagram appearance and behavior */
|
|
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>;
|
|
380
|
+
/** Layout direction: "LR", "RL", "TB", "BT" */
|
|
381
|
+
direction?: FlowDirection;
|
|
382
|
+
nodeAlignment?: NodeAlignment;
|
|
383
|
+
edgeMode?: EdgeMode;
|
|
384
|
+
compactPropertyLayout?: boolean;
|
|
385
|
+
nodeViewModes?: Record<string, NodeViewMode>;
|
|
386
|
+
workflowContract?: WorkflowContract;
|
|
387
|
+
/** Layout algorithm */
|
|
388
|
+
layout?: LayoutAlgorithm;
|
|
389
|
+
/** Theme accent color (Chakra token e.g. "blue.500") */
|
|
390
|
+
themeColor?: string;
|
|
391
|
+
/** Light or dark mode */
|
|
392
|
+
colorMode?: "light" | "dark";
|
|
393
|
+
/** Background pattern style */
|
|
394
|
+
backgroundPattern?: BackgroundPattern;
|
|
395
|
+
/** Background color override */
|
|
396
|
+
backgroundColor?: string;
|
|
397
|
+
/** Edge/line color override */
|
|
398
|
+
edgeColor?: string;
|
|
399
|
+
/** Default style for all compound/container nodes (per-node `viewProps` override it) */
|
|
400
|
+
parentNodeStyle?: ParentNodeStyle;
|
|
401
|
+
/** Min zoom level (default: 0.01) */
|
|
402
|
+
minZoom?: number;
|
|
403
|
+
/** Max zoom level (default: 1.5) */
|
|
404
|
+
maxZoom?: number;
|
|
405
|
+
/** Initial viewport position and zoom */
|
|
406
|
+
initialViewport?: {
|
|
407
|
+
pan: {
|
|
408
|
+
x: number;
|
|
409
|
+
y: number;
|
|
410
|
+
};
|
|
411
|
+
zoom: number;
|
|
412
|
+
};
|
|
413
|
+
/** Enable edge drawing handles (default: true) */
|
|
414
|
+
edgeHandles?: boolean;
|
|
415
|
+
/** Disable all interactions */
|
|
416
|
+
readOnly?: boolean;
|
|
417
|
+
/** Enable inline node label editing */
|
|
418
|
+
editable?: boolean;
|
|
419
|
+
/** Actions rendered in the node hover overlay */
|
|
420
|
+
nodeOverlayActions?: NodeOverlayAction[];
|
|
421
|
+
/** Custom render function for node hover overlay */
|
|
422
|
+
renderNodeOverlay?: (props: NodeOverlayProps) => React.ReactNode;
|
|
423
|
+
/** Custom render function for multi-select toolbar */
|
|
424
|
+
renderSelectedNodeToolbar?: (props: SelectedNodeToolbarProps) => React.ReactNode;
|
|
425
|
+
/** Custom render function for edge selection toolbar */
|
|
426
|
+
renderSelectedEdgeToolbar?: (props: SelectedEdgeToolbarProps) => React.ReactNode;
|
|
427
|
+
/** Custom render function to replace the entire built-in bottom bar */
|
|
428
|
+
renderBottomBar?: (props: BottomBarRenderProps) => React.ReactNode;
|
|
429
|
+
/** Built-in node/edge selection toolbars (bottom bar swaps to them on select). `false` disables. */
|
|
430
|
+
selectionToolbar?: SelectionToolbarConfig | false;
|
|
431
|
+
/** Custom node view components to override SDK defaults. Keys: objectView, arrayView, text, parentContainer */
|
|
432
|
+
customViews?: Record<string, React.ComponentType<any>>;
|
|
433
|
+
/** Disable built-in keyboard shortcuts (Z/M/D) when the consumer handles its own */
|
|
434
|
+
disableKeyboardShortcuts?: boolean;
|
|
435
|
+
/** Externally controlled zoom mode (overrides internal state when provided) */
|
|
436
|
+
isZoomMode?: boolean;
|
|
437
|
+
/** Externally controlled multi-select mode (overrides internal state when provided) */
|
|
438
|
+
isMultiSelectMode?: boolean;
|
|
439
|
+
/** Externally controlled edge draw mode (overrides internal state when provided) */
|
|
440
|
+
isEdgeHandlesEnabled?: boolean;
|
|
441
|
+
/** Externally controlled drag/pan mode (overrides internal state when provided) */
|
|
442
|
+
isDragMode?: boolean;
|
|
443
|
+
}
|
|
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
|
+
|
|
495
|
+
export declare interface FlowDiagramEdge {
|
|
496
|
+
data: {
|
|
497
|
+
id: string;
|
|
498
|
+
type?: BuiltInEdgeType | (string & {});
|
|
499
|
+
source: string;
|
|
500
|
+
target: string;
|
|
501
|
+
sourceProperty?: string;
|
|
502
|
+
targetProperty?: string;
|
|
503
|
+
connection?: SqueedConnectionRef;
|
|
504
|
+
collapsedEndpoints?: {
|
|
505
|
+
source: string;
|
|
506
|
+
target: string;
|
|
507
|
+
};
|
|
508
|
+
label?: string;
|
|
509
|
+
icon?: string;
|
|
510
|
+
/** Chakra token or hex; overrides the theme/edgeColor line color for this edge */
|
|
511
|
+
color?: string;
|
|
512
|
+
isInverted?: boolean;
|
|
513
|
+
isEdgeAnimated?: boolean;
|
|
514
|
+
edgeAnimationVariant?: EdgeAnimationVariant;
|
|
515
|
+
isEdgeDashed?: boolean;
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
export declare interface FlowDiagramNode {
|
|
520
|
+
data: {
|
|
521
|
+
id: string;
|
|
522
|
+
label?: string;
|
|
523
|
+
text?: string;
|
|
524
|
+
code?: string;
|
|
525
|
+
type: string;
|
|
526
|
+
parent?: string;
|
|
527
|
+
headerTitle?: string;
|
|
528
|
+
description?: Record<string, any>;
|
|
529
|
+
viewProps?: any;
|
|
530
|
+
config?: Record<string, any>;
|
|
531
|
+
isNodeAnimated?: boolean;
|
|
532
|
+
nodeAnimationVariant?: NodeAnimationVariant;
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/** Top-level props for the FlowDiagram component */
|
|
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;
|
|
542
|
+
/** Title shown on the root node */
|
|
543
|
+
title?: string;
|
|
544
|
+
/**
|
|
545
|
+
* Squeed JSON document. When provided, nodes/edges are compiled from it and every
|
|
546
|
+
* edit is reported through `callbacks.onJsonChange`. Takes precedence over nodes/edges.
|
|
547
|
+
*/
|
|
548
|
+
json?: Record<string, any> | any[];
|
|
549
|
+
forms?: StateForms;
|
|
550
|
+
/** Pre-computed nodes */
|
|
551
|
+
nodes?: FlowDiagramNode[];
|
|
552
|
+
/** Pre-computed edges */
|
|
553
|
+
edges?: FlowDiagramEdge[];
|
|
554
|
+
/** Diagram configuration */
|
|
555
|
+
config?: FlowDiagramConfig;
|
|
556
|
+
/** Event callbacks */
|
|
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;
|
|
561
|
+
/** CSS class name */
|
|
562
|
+
className?: string;
|
|
563
|
+
/** Inline styles */
|
|
564
|
+
style?: React.CSSProperties;
|
|
565
|
+
}
|
|
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
|
+
|
|
575
|
+
/** "C" = center: root in the middle, children fan out both ways (generate with `isCntr: true`); laid out as LR */
|
|
576
|
+
export declare type FlowDirection = "LR" | "RL" | "TB" | "BT" | "C";
|
|
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
|
+
|
|
742
|
+
export declare const getChakraColorHex: (color?: any, opacity?: any) => any;
|
|
743
|
+
|
|
744
|
+
export declare const getColorVariant: (color: string) => {
|
|
745
|
+
primary: string;
|
|
746
|
+
secondary: string;
|
|
747
|
+
light: string;
|
|
748
|
+
} | {
|
|
749
|
+
secondary: string;
|
|
750
|
+
primary?: undefined;
|
|
751
|
+
light?: undefined;
|
|
752
|
+
};
|
|
753
|
+
|
|
754
|
+
export declare function getDarkerHexColor(hex: string, factor?: number): string;
|
|
755
|
+
|
|
756
|
+
export declare function getNode(json: SqueedJson, address: string): any;
|
|
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
|
+
|
|
773
|
+
export declare type LayoutAlgorithm = "dagre" | "elk" | "tidytree" | "concentric" | "cose";
|
|
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
|
+
|
|
812
|
+
/** Actions shown in the hover overlay above nodes */
|
|
813
|
+
export declare interface NodeOverlayAction {
|
|
814
|
+
id: string;
|
|
815
|
+
icon: any;
|
|
816
|
+
label: string;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
/** Props passed to custom node overlay renderer */
|
|
820
|
+
export declare interface NodeOverlayProps {
|
|
821
|
+
nodeId: string;
|
|
822
|
+
nodeData: any;
|
|
823
|
+
isRoot: boolean;
|
|
824
|
+
isParent: boolean;
|
|
825
|
+
isHovered: boolean;
|
|
826
|
+
setIsHovered: (v: boolean) => void;
|
|
827
|
+
}
|
|
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
|
+
|
|
867
|
+
/**
|
|
868
|
+
* Style for compound (container) nodes. Set per node via `data.viewProps`,
|
|
869
|
+
* or for all containers via `config.parentNodeStyle` (per-node wins).
|
|
870
|
+
* Colors accept Chakra tokens ("purple.500") or hex.
|
|
871
|
+
*/
|
|
872
|
+
export declare interface ParentNodeStyle {
|
|
873
|
+
outline?: boolean;
|
|
874
|
+
/** Fill color; also the default border/label color (default: themeColor) */
|
|
875
|
+
bgColor?: string;
|
|
876
|
+
/** Fill opacity 0–1 (default 0.4) */
|
|
877
|
+
bgOpacity?: number;
|
|
878
|
+
borderColor?: string;
|
|
879
|
+
/** px (default 6) */
|
|
880
|
+
borderWidth?: number;
|
|
881
|
+
borderStyle?: "solid" | "dashed" | "dotted" | "double";
|
|
882
|
+
/** Corner radius px (default 50) */
|
|
883
|
+
borderRadius?: number;
|
|
884
|
+
/** Label color (default: bgColor) */
|
|
885
|
+
textColor?: string;
|
|
886
|
+
/** Label size px (default 70) */
|
|
887
|
+
fontSize?: number;
|
|
888
|
+
/** Inner padding px (default 120) */
|
|
889
|
+
padding?: number;
|
|
890
|
+
/** Label placement (default "top") */
|
|
891
|
+
labelPosition?: "top" | "center" | "bottom";
|
|
892
|
+
}
|
|
893
|
+
|
|
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. */
|
|
920
|
+
export declare function removeEdge(json: SqueedJson, edge: RenderedEdgeRef): {
|
|
921
|
+
json: SqueedJson;
|
|
922
|
+
removed: boolean;
|
|
923
|
+
};
|
|
924
|
+
|
|
925
|
+
export declare function removeNode(json: SqueedJson, address: string): SqueedJson;
|
|
926
|
+
|
|
927
|
+
export declare interface RenderedEdgeRef extends FlowEdgeProperties {
|
|
928
|
+
source: string;
|
|
929
|
+
target: string;
|
|
930
|
+
isInverted?: boolean | null;
|
|
931
|
+
connection?: SqueedConnectionRef;
|
|
932
|
+
collapsedEndpoints?: {
|
|
933
|
+
source: string;
|
|
934
|
+
target: string;
|
|
935
|
+
};
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
/**
|
|
939
|
+
* Resolve which JSON node carries an edge's keys.
|
|
940
|
+
* parent→child edges (implicit hierarchy) are configured on the child;
|
|
941
|
+
* `$target` cross-links are configured on the source node.
|
|
942
|
+
*/
|
|
943
|
+
export declare function resolveEdgeOwner(edge: RenderedEdgeRef): {
|
|
944
|
+
address: string;
|
|
945
|
+
kind: "hierarchy" | "target" | "connection";
|
|
946
|
+
};
|
|
947
|
+
|
|
948
|
+
export declare function resolveStateView(view: SqueedJson, state: SqueedJson): SqueedJson;
|
|
949
|
+
|
|
950
|
+
declare interface RuntimeReference {
|
|
951
|
+
path: string;
|
|
952
|
+
label: string;
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
/** Props passed to custom edge selection toolbar renderer */
|
|
956
|
+
export declare interface SelectedEdgeToolbarProps {
|
|
957
|
+
edgeId: string;
|
|
958
|
+
edgeData: any;
|
|
959
|
+
onDeselect: () => void;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
/** Props passed to custom node selection toolbar renderer */
|
|
963
|
+
export declare interface SelectedNodeToolbarProps {
|
|
964
|
+
selectedNodeIds: string[];
|
|
965
|
+
selectedNodeData: any[];
|
|
966
|
+
onDeselect: () => void;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
/** Built-in selection toolbars (shown in the bottom bar when a node/edge is selected) */
|
|
970
|
+
export declare interface SelectionToolbarConfig {
|
|
971
|
+
/** Swatches offered for node/edge colors (Chakra tokens or hex). Default: 9 Chakra 500s */
|
|
972
|
+
palette?: string[];
|
|
973
|
+
/** Hide individual controls */
|
|
974
|
+
hide?: Array<"label" | "typeView" | "color" | "textColor" | "borderColor" | "style" | "outline" | "animation" | "icon" | "collapse" | "delete">;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
export declare const setCollapsed: (json: SqueedJson, address: string, collapsed: boolean) => SqueedJson;
|
|
978
|
+
|
|
979
|
+
export declare function setEdgeProp(json: SqueedJson, edge: RenderedEdgeRef, key: SqueedEdgeKey, value: any): SqueedJson;
|
|
980
|
+
|
|
981
|
+
export declare const setEdgeStyle: (json: SqueedJson, edge: RenderedEdgeRef, style: "solid" | "dashed" | "animated") => SqueedJson;
|
|
982
|
+
|
|
983
|
+
export declare function setNodeProp(json: SqueedJson, address: string, key: SqueedNodeKey, value: any): SqueedJson;
|
|
984
|
+
|
|
985
|
+
/** What changed in the Squeed document (delivered alongside the new JSON) */
|
|
986
|
+
export declare interface SqueedChange {
|
|
987
|
+
type: "documentReplace" | "form" | "nodeLabel" | "nodeContent" | "nodeColor" | "nodeStyle" | "nodeIcon" | "nodeOutline" | "nodeAnimation" | "nodeCollapse" | "nodeCreate" | "nodeDelete" | "edgeLabel" | "edgeStyle" | "edgeColor" | "edgeCreate" | "edgeDelete";
|
|
988
|
+
/** Node address affected (new node's address for nodeCreate) */
|
|
989
|
+
address?: string;
|
|
990
|
+
edge?: RenderedEdgeRef;
|
|
991
|
+
/** `$` key written, when a single key changed */
|
|
992
|
+
key?: string;
|
|
993
|
+
value?: unknown;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
/** Describes the edit behind an `onJsonChange` */
|
|
997
|
+
export declare interface SqueedChangeInfo {
|
|
998
|
+
type: "nodeLabel" | "nodeContent" | "nodeColor" | "nodeStyle" | "nodeIcon" | "nodeOutline" | "nodeAnimation" | "nodeCollapse" | "nodeCreate" | "nodeDelete" | "edgeLabel" | "edgeStyle" | "edgeColor" | "edgeCreate" | "edgeDelete";
|
|
999
|
+
address?: string;
|
|
1000
|
+
edge?: FlowEdgeProperties & {
|
|
1001
|
+
source: string;
|
|
1002
|
+
target: string;
|
|
1003
|
+
isInverted?: boolean | null;
|
|
1004
|
+
connection?: SqueedConnectionRef;
|
|
1005
|
+
};
|
|
1006
|
+
key?: string;
|
|
1007
|
+
value?: unknown;
|
|
1008
|
+
}
|
|
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
|
+
|
|
1026
|
+
/** Schema keys that describe the edge *into* a node (parent → child) */
|
|
1027
|
+
export declare type SqueedEdgeKey = "$edgeIcon" | "$edgeType" | "$sourceLabel" | "$isEdgeAnimated" | "$edgeAnimationVariant" | "$isEdgeDashed" | "$edgeColor";
|
|
1028
|
+
|
|
1029
|
+
/**
|
|
1030
|
+
* Squeed JSON = the source document `createFlowDiagram` compiles into nodes/edges.
|
|
1031
|
+
* Node ids are JSON addresses ("root.a.b"); these helpers translate toolbar edits
|
|
1032
|
+
* back into `$`-prefixed schema keys at that address. All functions are immutable.
|
|
1033
|
+
*/
|
|
1034
|
+
export declare type SqueedJson = Record<string, any> | any[];
|
|
1035
|
+
|
|
1036
|
+
/** Schema keys that live on a node */
|
|
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;
|
|
1157
|
+
|
|
1158
|
+
/** Immutable update of the node at `address` (root address updates the document itself) */
|
|
1159
|
+
export declare function updateNode(json: SqueedJson, address: string, fn: (node: any) => any): SqueedJson;
|
|
1160
|
+
|
|
1161
|
+
export declare function useCustomColors(theme?: any): {
|
|
1162
|
+
canvas: string;
|
|
1163
|
+
background: string;
|
|
1164
|
+
backgroundSecondary: string;
|
|
1165
|
+
darkBackgroundSecondary: string;
|
|
1166
|
+
border: string;
|
|
1167
|
+
darkColor: string;
|
|
1168
|
+
backgroundWhiteColor: string;
|
|
1169
|
+
borderSecondary: string;
|
|
1170
|
+
colorActive: string;
|
|
1171
|
+
colorInactive: string;
|
|
1172
|
+
iconColor: string;
|
|
1173
|
+
moreIconColor: string;
|
|
1174
|
+
colorText: string;
|
|
1175
|
+
themedColorText: string;
|
|
1176
|
+
logoColor: any;
|
|
1177
|
+
logoColorSecondary: any;
|
|
1178
|
+
darkColorActive: string;
|
|
1179
|
+
greenColor: string;
|
|
1180
|
+
};
|
|
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
|
+
|
|
1200
|
+
/**
|
|
1201
|
+
* Hook that stops all event propagation on a DOM element.
|
|
1202
|
+
* Use this on any interactive element inside a node (inputs, textareas, forms)
|
|
1203
|
+
* to prevent cytoscape from intercepting mouse/keyboard events.
|
|
1204
|
+
*
|
|
1205
|
+
* @param active - Only attach listeners when true (e.g. when editing)
|
|
1206
|
+
* @returns ref to attach to the wrapper element
|
|
1207
|
+
*
|
|
1208
|
+
* @example
|
|
1209
|
+
* const inputRef = useStopPropagation<HTMLDivElement>(isEditing);
|
|
1210
|
+
* return <div ref={inputRef}><input /></div>;
|
|
1211
|
+
*/
|
|
1212
|
+
export declare function useStopPropagation<T extends HTMLElement>(active?: boolean): MutableRefObject<T>;
|
|
1213
|
+
|
|
1214
|
+
export declare function useThemeContentColors(color: any): {
|
|
1215
|
+
bgColor: any;
|
|
1216
|
+
highlightColor: string;
|
|
1217
|
+
borderColor: string;
|
|
1218
|
+
textColor: string;
|
|
1219
|
+
propertyColor: string;
|
|
1220
|
+
secondary: string;
|
|
1221
|
+
bgColorFaint: any;
|
|
1222
|
+
highlightColorFaint: string;
|
|
1223
|
+
};
|
|
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
|
+
|
|
1240
|
+
export { }
|