@particle-academy/fancy-flow 0.5.3 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +125 -1
- package/dist/engine.d.cts +2 -2
- package/dist/engine.d.ts +2 -2
- package/dist/index.cjs +223 -127
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +131 -13
- package/dist/index.d.ts +131 -13
- package/dist/index.js +228 -134
- package/dist/index.js.map +1 -1
- package/dist/registry/index.d.cts +3 -3
- package/dist/registry/index.d.ts +3 -3
- package/dist/runtime/index.d.cts +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/schema/index.d.cts +1 -1
- package/dist/schema/index.d.ts +1 -1
- package/dist/styles.css +30 -1
- package/dist/styles.css.map +1 -1
- package/dist/{types-TemTtb04.d.cts → types-BS3Gwnkq.d.cts} +1 -1
- package/dist/{types-TemTtb04.d.ts → types-BS3Gwnkq.d.ts} +1 -1
- package/dist/{types-D5RERHIP.d.cts → types-C0wdN6QX.d.cts} +1 -1
- package/dist/{types-BodwZiST.d.ts → types-DnMe9Vsf.d.ts} +1 -1
- package/dist/ux.d.cts +2 -2
- package/dist/ux.d.ts +2 -2
- package/package.json +5 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, CSSProperties, ComponentType } from 'react';
|
|
3
3
|
import { ReactFlowProps, Edge, BackgroundVariant, NodeProps, NodeTypes } from '@xyflow/react';
|
|
4
|
-
import { F as FlowNode, a as FlowGraph, E as ExecutorRegistry } from './types-
|
|
5
|
-
export { A as ActionNodeData, B as BaseNodeData, D as DecisionNodeData,
|
|
6
|
-
import { WorkflowMetadata } from './schema/index.cjs';
|
|
7
|
-
export { ImportIssue, ImportOptions, ImportResult, WORKFLOW_SCHEMA_URL, WORKFLOW_SCHEMA_VERSION,
|
|
8
|
-
import { N as NodeCategory, a as NodeKindDefinition, C as ConfigField } from './types-
|
|
9
|
-
export { R as RenderBodyContext } from './types-
|
|
4
|
+
import { F as FlowNode, a as FlowGraph, b as NodeRunStatus, E as ExecutorRegistry } from './types-BS3Gwnkq.cjs';
|
|
5
|
+
export { A as ActionNodeData, B as BaseNodeData, D as DecisionNodeData, c as FlowEdge, d as FlowNodeData, e as FlowNodeKind, N as NodeExecutor, f as NoteNodeData, O as OutputNodeData, P as PortDescriptor, R as RunEvent, S as SubgraphNodeData, T as TriggerNodeData } from './types-BS3Gwnkq.cjs';
|
|
6
|
+
import { WorkflowSchema, WorkflowMetadata } from './schema/index.cjs';
|
|
7
|
+
export { ImportIssue, ImportOptions, ImportResult, WORKFLOW_SCHEMA_URL, WORKFLOW_SCHEMA_VERSION, WorkflowSchemaEdge, WorkflowSchemaNode, exportWorkflow, importWorkflow, workflowToBlob } from './schema/index.cjs';
|
|
8
|
+
import { N as NodeCategory, a as NodeKindDefinition, C as ConfigField } from './types-C0wdN6QX.cjs';
|
|
9
|
+
export { R as RenderBodyContext } from './types-C0wdN6QX.cjs';
|
|
10
10
|
import { FlowRunFeedEntry } from './runtime/index.cjs';
|
|
11
11
|
export { UseFlowRunOptions, UseFlowRunReturn, UseFlowStateReturn, applyStatusesToNodes, useFlowRun, useFlowState } from './runtime/index.cjs';
|
|
12
12
|
export { BUILTIN_KINDS, RegistryNode, buildNodeTypes, categoryAccent, defaultConfigFor, getNodeKind, listNodeKinds, onNodeKindsChanged, registerBuiltinKinds, registerNodeKind, validateConfig } from './registry/index.cjs';
|
|
@@ -39,6 +39,107 @@ type FlowCanvasProps = Omit<ReactFlowProps<FlowNode, Edge>, "nodes" | "edges" |
|
|
|
39
39
|
*/
|
|
40
40
|
declare function FlowCanvas({ nodes, edges, background, showControls, showMinimap, height, toolbar, nodeTypes, edgeTypes, className, style, ...rest }: FlowCanvasProps): react.JSX.Element;
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Everything the editor knows and can do, handed to every extension point.
|
|
44
|
+
*
|
|
45
|
+
* This is the seam that makes `<FlowEditor>` composable instead of fixed: it is
|
|
46
|
+
* passed to custom actions and slots, returned from `useFlowEditor()` inside
|
|
47
|
+
* any child, and exposed on the editor `ref` so a host can drive the editor
|
|
48
|
+
* imperatively (or an MCP bridge can drive it for an agent).
|
|
49
|
+
*/
|
|
50
|
+
type FlowEditorApi = {
|
|
51
|
+
/** The current graph. */
|
|
52
|
+
graph: FlowGraph;
|
|
53
|
+
nodes: FlowNode[];
|
|
54
|
+
edges: Edge[];
|
|
55
|
+
/** Currently selected node id, or null. */
|
|
56
|
+
selectedId: string | null;
|
|
57
|
+
/** Currently selected node, or null. */
|
|
58
|
+
selected: FlowNode | null;
|
|
59
|
+
/** True while a run is in flight. */
|
|
60
|
+
running: boolean;
|
|
61
|
+
/** Per-node run status, keyed by node id. */
|
|
62
|
+
statuses: Record<string, NodeRunStatus>;
|
|
63
|
+
select: (id: string | null) => void;
|
|
64
|
+
/** Add a node of `kind` at an optional flow position. Returns the new id. */
|
|
65
|
+
addNode: (kind: string, position?: {
|
|
66
|
+
x: number;
|
|
67
|
+
y: number;
|
|
68
|
+
}) => string | null;
|
|
69
|
+
/** Replace one node (matched by id). */
|
|
70
|
+
updateNode: (node: FlowNode) => void;
|
|
71
|
+
/** Delete nodes by id, pruning every edge attached to them. */
|
|
72
|
+
deleteNodes: (ids: string[]) => void;
|
|
73
|
+
/** Delete the current selection (no-op when nothing is selected). */
|
|
74
|
+
deleteSelected: () => void;
|
|
75
|
+
/** Delete edges by id. */
|
|
76
|
+
deleteEdges: (ids: string[]) => void;
|
|
77
|
+
/** Copy a node (offset slightly) and select the copy. Returns the new id. */
|
|
78
|
+
duplicateNode: (id: string) => string | null;
|
|
79
|
+
/** Replace the whole graph. */
|
|
80
|
+
setGraph: (graph: FlowGraph) => void;
|
|
81
|
+
run: () => void;
|
|
82
|
+
cancel: () => void;
|
|
83
|
+
reset: () => void;
|
|
84
|
+
/** The current graph as a WorkflowSchema (what `export` downloads). */
|
|
85
|
+
toWorkflow: () => WorkflowSchema;
|
|
86
|
+
/** Download the workflow as JSON. */
|
|
87
|
+
exportWorkflow: () => void;
|
|
88
|
+
/** Open a file picker and load a workflow. */
|
|
89
|
+
importWorkflow: () => void;
|
|
90
|
+
fitView: () => void;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* A declarative toolbar button. JSON-friendly on purpose — a host (or an
|
|
94
|
+
* agent) can describe editor affordances as data rather than JSX.
|
|
95
|
+
*/
|
|
96
|
+
type FlowEditorAction = {
|
|
97
|
+
/** Stable id — also the `data-action` handle, so agents never guess DOM. */
|
|
98
|
+
id: string;
|
|
99
|
+
label: ReactNode;
|
|
100
|
+
/** Native tooltip. */
|
|
101
|
+
title?: string;
|
|
102
|
+
/** Where it sits relative to the built-in buttons. Default "end". */
|
|
103
|
+
placement?: "start" | "end";
|
|
104
|
+
/** Disable when this returns true. Re-evaluated on every render. */
|
|
105
|
+
disabled?: (api: FlowEditorApi) => boolean;
|
|
106
|
+
/** Hide entirely when this returns false. */
|
|
107
|
+
visible?: (api: FlowEditorApi) => boolean;
|
|
108
|
+
/** Only enabled when a node is selected. Sugar over `disabled`. */
|
|
109
|
+
requiresSelection?: boolean;
|
|
110
|
+
onSelect: (api: FlowEditorApi) => void;
|
|
111
|
+
};
|
|
112
|
+
/** Which built-in toolbar affordances to render. All default to true. */
|
|
113
|
+
type FlowEditorBuiltins = {
|
|
114
|
+
run?: boolean;
|
|
115
|
+
delete?: boolean;
|
|
116
|
+
export?: boolean;
|
|
117
|
+
import?: boolean;
|
|
118
|
+
count?: boolean;
|
|
119
|
+
};
|
|
120
|
+
/** Replaceable regions. Each receives the editor API. */
|
|
121
|
+
type FlowEditorSlots = {
|
|
122
|
+
/** Replace the ENTIRE toolbar (built-ins and actions are not rendered). */
|
|
123
|
+
toolbar?: (api: FlowEditorApi) => ReactNode;
|
|
124
|
+
/** Replace the left palette. */
|
|
125
|
+
palette?: (api: FlowEditorApi) => ReactNode;
|
|
126
|
+
/** Replace the right config panel. */
|
|
127
|
+
panel?: (api: FlowEditorApi) => ReactNode;
|
|
128
|
+
/** Appended inside the config panel, under the fields — per-node actions. */
|
|
129
|
+
panelFooter?: (api: FlowEditorApi) => ReactNode;
|
|
130
|
+
/** Replace the run feed. */
|
|
131
|
+
feed?: (api: FlowEditorApi) => ReactNode;
|
|
132
|
+
/** Rendered over the canvas when the graph is empty. */
|
|
133
|
+
empty?: (api: FlowEditorApi) => ReactNode;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Read the editor API from any child of `<FlowEditor>`. Throws outside one, so
|
|
137
|
+
* a misplaced custom control fails loudly instead of silently doing nothing.
|
|
138
|
+
*/
|
|
139
|
+
declare function useFlowEditor(): FlowEditorApi;
|
|
140
|
+
/** Non-throwing variant, for components that may render outside an editor. */
|
|
141
|
+
declare function useFlowEditorOptional(): FlowEditorApi | null;
|
|
142
|
+
|
|
42
143
|
type FlowEditorProps = {
|
|
43
144
|
initial?: FlowGraph;
|
|
44
145
|
/** Controlled mode — host owns the graph state. When set, takes precedence
|
|
@@ -56,20 +157,37 @@ type FlowEditorProps = {
|
|
|
56
157
|
showFeed?: boolean;
|
|
57
158
|
/** Total editor height. Default 720. */
|
|
58
159
|
height?: number;
|
|
59
|
-
/**
|
|
160
|
+
/** Extra toolbar content, appended after the built-ins. Prefer `actions`
|
|
161
|
+
* (declarative + agent-emittable); this stays for back-compat. */
|
|
60
162
|
extraToolbar?: ReactNode;
|
|
163
|
+
/** Declarative custom toolbar buttons. */
|
|
164
|
+
actions?: FlowEditorAction[];
|
|
165
|
+
/** Turn built-in toolbar affordances off individually. */
|
|
166
|
+
builtins?: FlowEditorBuiltins;
|
|
167
|
+
/** Replace whole regions of the editor. */
|
|
168
|
+
slots?: FlowEditorSlots;
|
|
169
|
+
/** Forwarded to `<FlowCanvas>` / React Flow — snapToGrid, minimap, context
|
|
170
|
+
* menus, edge types, and anything else xyflow accepts. */
|
|
171
|
+
canvasProps?: Partial<Omit<FlowCanvasProps, "nodes" | "edges">>;
|
|
61
172
|
/** Called whenever the graph changes — host can persist. */
|
|
62
173
|
onChange?: (graph: FlowGraph) => void;
|
|
174
|
+
/** Called when the selected node changes. */
|
|
175
|
+
onSelectionChange?: (node: FlowNode | null) => void;
|
|
176
|
+
/** Called after nodes are deleted, with the deleted ids. */
|
|
177
|
+
onDelete?: (ids: string[]) => void;
|
|
63
178
|
className?: string;
|
|
64
179
|
style?: CSSProperties;
|
|
65
180
|
};
|
|
66
181
|
/**
|
|
67
|
-
* FlowEditor —
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
182
|
+
* FlowEditor — batteries-included workflow editor, but not a black box.
|
|
183
|
+
*
|
|
184
|
+
* Defaults compose NodePalette + FlowCanvas + NodeConfigPanel + run controls +
|
|
185
|
+
* feed. Every part is replaceable: pass `actions` for custom toolbar buttons,
|
|
186
|
+
* `slots` to swap a whole region, `canvasProps` to reach React Flow, or grab
|
|
187
|
+
* the {@link FlowEditorApi} from `ref` / `useFlowEditor()` and build your own
|
|
188
|
+
* chrome around the primitives.
|
|
71
189
|
*/
|
|
72
|
-
declare
|
|
190
|
+
declare const FlowEditor: react.ForwardRefExoticComponent<FlowEditorProps & react.RefAttributes<FlowEditorApi>>;
|
|
73
191
|
|
|
74
192
|
type NodePaletteProps = {
|
|
75
193
|
/** Filter to only these categories. */
|
|
@@ -271,4 +389,4 @@ type FlowRunFeedProps = {
|
|
|
271
389
|
/** FlowRunFeed — scrolling log panel. Auto-scrolls to bottom on new entries. */
|
|
272
390
|
declare function FlowRunFeed({ entries, className, style }: FlowRunFeedProps): react.JSX.Element;
|
|
273
391
|
|
|
274
|
-
export { ActionNode, ConfigField, ConfigFieldRenderer, type ConfigFieldRendererProps, DecisionNode, ExecutorRegistry, FlowCanvas, type FlowCanvasProps, FlowEditor, type FlowEditorProps, FlowGraph, FlowNode, type FlowNodeRenderProps, FlowRunControls, type FlowRunControlsProps, FlowRunFeed, FlowRunFeedEntry, type FlowRunFeedProps, NodeCategory, NodeConfigPanel, type NodeConfigPanelProps, NodeKindDefinition, NodePalette, type NodePaletteProps, NodePort, type NodePortProps, type NodePortSide, type NodePortType, NodeShell, type NodeShellProps, NoteNode, OutputNode, SubgraphNode, TriggerNode, WorkflowMetadata, defaultNodeTypes, defineNode, paletteDropHandlers };
|
|
392
|
+
export { ActionNode, ConfigField, ConfigFieldRenderer, type ConfigFieldRendererProps, DecisionNode, ExecutorRegistry, FlowCanvas, type FlowCanvasProps, FlowEditor, type FlowEditorAction, type FlowEditorApi, type FlowEditorBuiltins, type FlowEditorProps, type FlowEditorSlots, FlowGraph, FlowNode, type FlowNodeRenderProps, FlowRunControls, type FlowRunControlsProps, FlowRunFeed, FlowRunFeedEntry, type FlowRunFeedProps, NodeCategory, NodeConfigPanel, type NodeConfigPanelProps, NodeKindDefinition, NodePalette, type NodePaletteProps, NodePort, type NodePortProps, type NodePortSide, type NodePortType, NodeRunStatus, NodeShell, type NodeShellProps, NoteNode, OutputNode, SubgraphNode, TriggerNode, WorkflowMetadata, WorkflowSchema, defaultNodeTypes, defineNode, paletteDropHandlers, useFlowEditor, useFlowEditorOptional };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, CSSProperties, ComponentType } from 'react';
|
|
3
3
|
import { ReactFlowProps, Edge, BackgroundVariant, NodeProps, NodeTypes } from '@xyflow/react';
|
|
4
|
-
import { F as FlowNode, a as FlowGraph, E as ExecutorRegistry } from './types-
|
|
5
|
-
export { A as ActionNodeData, B as BaseNodeData, D as DecisionNodeData,
|
|
6
|
-
import { WorkflowMetadata } from './schema/index.js';
|
|
7
|
-
export { ImportIssue, ImportOptions, ImportResult, WORKFLOW_SCHEMA_URL, WORKFLOW_SCHEMA_VERSION,
|
|
8
|
-
import { N as NodeCategory, a as NodeKindDefinition, C as ConfigField } from './types-
|
|
9
|
-
export { R as RenderBodyContext } from './types-
|
|
4
|
+
import { F as FlowNode, a as FlowGraph, b as NodeRunStatus, E as ExecutorRegistry } from './types-BS3Gwnkq.js';
|
|
5
|
+
export { A as ActionNodeData, B as BaseNodeData, D as DecisionNodeData, c as FlowEdge, d as FlowNodeData, e as FlowNodeKind, N as NodeExecutor, f as NoteNodeData, O as OutputNodeData, P as PortDescriptor, R as RunEvent, S as SubgraphNodeData, T as TriggerNodeData } from './types-BS3Gwnkq.js';
|
|
6
|
+
import { WorkflowSchema, WorkflowMetadata } from './schema/index.js';
|
|
7
|
+
export { ImportIssue, ImportOptions, ImportResult, WORKFLOW_SCHEMA_URL, WORKFLOW_SCHEMA_VERSION, WorkflowSchemaEdge, WorkflowSchemaNode, exportWorkflow, importWorkflow, workflowToBlob } from './schema/index.js';
|
|
8
|
+
import { N as NodeCategory, a as NodeKindDefinition, C as ConfigField } from './types-DnMe9Vsf.js';
|
|
9
|
+
export { R as RenderBodyContext } from './types-DnMe9Vsf.js';
|
|
10
10
|
import { FlowRunFeedEntry } from './runtime/index.js';
|
|
11
11
|
export { UseFlowRunOptions, UseFlowRunReturn, UseFlowStateReturn, applyStatusesToNodes, useFlowRun, useFlowState } from './runtime/index.js';
|
|
12
12
|
export { BUILTIN_KINDS, RegistryNode, buildNodeTypes, categoryAccent, defaultConfigFor, getNodeKind, listNodeKinds, onNodeKindsChanged, registerBuiltinKinds, registerNodeKind, validateConfig } from './registry/index.js';
|
|
@@ -39,6 +39,107 @@ type FlowCanvasProps = Omit<ReactFlowProps<FlowNode, Edge>, "nodes" | "edges" |
|
|
|
39
39
|
*/
|
|
40
40
|
declare function FlowCanvas({ nodes, edges, background, showControls, showMinimap, height, toolbar, nodeTypes, edgeTypes, className, style, ...rest }: FlowCanvasProps): react.JSX.Element;
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Everything the editor knows and can do, handed to every extension point.
|
|
44
|
+
*
|
|
45
|
+
* This is the seam that makes `<FlowEditor>` composable instead of fixed: it is
|
|
46
|
+
* passed to custom actions and slots, returned from `useFlowEditor()` inside
|
|
47
|
+
* any child, and exposed on the editor `ref` so a host can drive the editor
|
|
48
|
+
* imperatively (or an MCP bridge can drive it for an agent).
|
|
49
|
+
*/
|
|
50
|
+
type FlowEditorApi = {
|
|
51
|
+
/** The current graph. */
|
|
52
|
+
graph: FlowGraph;
|
|
53
|
+
nodes: FlowNode[];
|
|
54
|
+
edges: Edge[];
|
|
55
|
+
/** Currently selected node id, or null. */
|
|
56
|
+
selectedId: string | null;
|
|
57
|
+
/** Currently selected node, or null. */
|
|
58
|
+
selected: FlowNode | null;
|
|
59
|
+
/** True while a run is in flight. */
|
|
60
|
+
running: boolean;
|
|
61
|
+
/** Per-node run status, keyed by node id. */
|
|
62
|
+
statuses: Record<string, NodeRunStatus>;
|
|
63
|
+
select: (id: string | null) => void;
|
|
64
|
+
/** Add a node of `kind` at an optional flow position. Returns the new id. */
|
|
65
|
+
addNode: (kind: string, position?: {
|
|
66
|
+
x: number;
|
|
67
|
+
y: number;
|
|
68
|
+
}) => string | null;
|
|
69
|
+
/** Replace one node (matched by id). */
|
|
70
|
+
updateNode: (node: FlowNode) => void;
|
|
71
|
+
/** Delete nodes by id, pruning every edge attached to them. */
|
|
72
|
+
deleteNodes: (ids: string[]) => void;
|
|
73
|
+
/** Delete the current selection (no-op when nothing is selected). */
|
|
74
|
+
deleteSelected: () => void;
|
|
75
|
+
/** Delete edges by id. */
|
|
76
|
+
deleteEdges: (ids: string[]) => void;
|
|
77
|
+
/** Copy a node (offset slightly) and select the copy. Returns the new id. */
|
|
78
|
+
duplicateNode: (id: string) => string | null;
|
|
79
|
+
/** Replace the whole graph. */
|
|
80
|
+
setGraph: (graph: FlowGraph) => void;
|
|
81
|
+
run: () => void;
|
|
82
|
+
cancel: () => void;
|
|
83
|
+
reset: () => void;
|
|
84
|
+
/** The current graph as a WorkflowSchema (what `export` downloads). */
|
|
85
|
+
toWorkflow: () => WorkflowSchema;
|
|
86
|
+
/** Download the workflow as JSON. */
|
|
87
|
+
exportWorkflow: () => void;
|
|
88
|
+
/** Open a file picker and load a workflow. */
|
|
89
|
+
importWorkflow: () => void;
|
|
90
|
+
fitView: () => void;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* A declarative toolbar button. JSON-friendly on purpose — a host (or an
|
|
94
|
+
* agent) can describe editor affordances as data rather than JSX.
|
|
95
|
+
*/
|
|
96
|
+
type FlowEditorAction = {
|
|
97
|
+
/** Stable id — also the `data-action` handle, so agents never guess DOM. */
|
|
98
|
+
id: string;
|
|
99
|
+
label: ReactNode;
|
|
100
|
+
/** Native tooltip. */
|
|
101
|
+
title?: string;
|
|
102
|
+
/** Where it sits relative to the built-in buttons. Default "end". */
|
|
103
|
+
placement?: "start" | "end";
|
|
104
|
+
/** Disable when this returns true. Re-evaluated on every render. */
|
|
105
|
+
disabled?: (api: FlowEditorApi) => boolean;
|
|
106
|
+
/** Hide entirely when this returns false. */
|
|
107
|
+
visible?: (api: FlowEditorApi) => boolean;
|
|
108
|
+
/** Only enabled when a node is selected. Sugar over `disabled`. */
|
|
109
|
+
requiresSelection?: boolean;
|
|
110
|
+
onSelect: (api: FlowEditorApi) => void;
|
|
111
|
+
};
|
|
112
|
+
/** Which built-in toolbar affordances to render. All default to true. */
|
|
113
|
+
type FlowEditorBuiltins = {
|
|
114
|
+
run?: boolean;
|
|
115
|
+
delete?: boolean;
|
|
116
|
+
export?: boolean;
|
|
117
|
+
import?: boolean;
|
|
118
|
+
count?: boolean;
|
|
119
|
+
};
|
|
120
|
+
/** Replaceable regions. Each receives the editor API. */
|
|
121
|
+
type FlowEditorSlots = {
|
|
122
|
+
/** Replace the ENTIRE toolbar (built-ins and actions are not rendered). */
|
|
123
|
+
toolbar?: (api: FlowEditorApi) => ReactNode;
|
|
124
|
+
/** Replace the left palette. */
|
|
125
|
+
palette?: (api: FlowEditorApi) => ReactNode;
|
|
126
|
+
/** Replace the right config panel. */
|
|
127
|
+
panel?: (api: FlowEditorApi) => ReactNode;
|
|
128
|
+
/** Appended inside the config panel, under the fields — per-node actions. */
|
|
129
|
+
panelFooter?: (api: FlowEditorApi) => ReactNode;
|
|
130
|
+
/** Replace the run feed. */
|
|
131
|
+
feed?: (api: FlowEditorApi) => ReactNode;
|
|
132
|
+
/** Rendered over the canvas when the graph is empty. */
|
|
133
|
+
empty?: (api: FlowEditorApi) => ReactNode;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Read the editor API from any child of `<FlowEditor>`. Throws outside one, so
|
|
137
|
+
* a misplaced custom control fails loudly instead of silently doing nothing.
|
|
138
|
+
*/
|
|
139
|
+
declare function useFlowEditor(): FlowEditorApi;
|
|
140
|
+
/** Non-throwing variant, for components that may render outside an editor. */
|
|
141
|
+
declare function useFlowEditorOptional(): FlowEditorApi | null;
|
|
142
|
+
|
|
42
143
|
type FlowEditorProps = {
|
|
43
144
|
initial?: FlowGraph;
|
|
44
145
|
/** Controlled mode — host owns the graph state. When set, takes precedence
|
|
@@ -56,20 +157,37 @@ type FlowEditorProps = {
|
|
|
56
157
|
showFeed?: boolean;
|
|
57
158
|
/** Total editor height. Default 720. */
|
|
58
159
|
height?: number;
|
|
59
|
-
/**
|
|
160
|
+
/** Extra toolbar content, appended after the built-ins. Prefer `actions`
|
|
161
|
+
* (declarative + agent-emittable); this stays for back-compat. */
|
|
60
162
|
extraToolbar?: ReactNode;
|
|
163
|
+
/** Declarative custom toolbar buttons. */
|
|
164
|
+
actions?: FlowEditorAction[];
|
|
165
|
+
/** Turn built-in toolbar affordances off individually. */
|
|
166
|
+
builtins?: FlowEditorBuiltins;
|
|
167
|
+
/** Replace whole regions of the editor. */
|
|
168
|
+
slots?: FlowEditorSlots;
|
|
169
|
+
/** Forwarded to `<FlowCanvas>` / React Flow — snapToGrid, minimap, context
|
|
170
|
+
* menus, edge types, and anything else xyflow accepts. */
|
|
171
|
+
canvasProps?: Partial<Omit<FlowCanvasProps, "nodes" | "edges">>;
|
|
61
172
|
/** Called whenever the graph changes — host can persist. */
|
|
62
173
|
onChange?: (graph: FlowGraph) => void;
|
|
174
|
+
/** Called when the selected node changes. */
|
|
175
|
+
onSelectionChange?: (node: FlowNode | null) => void;
|
|
176
|
+
/** Called after nodes are deleted, with the deleted ids. */
|
|
177
|
+
onDelete?: (ids: string[]) => void;
|
|
63
178
|
className?: string;
|
|
64
179
|
style?: CSSProperties;
|
|
65
180
|
};
|
|
66
181
|
/**
|
|
67
|
-
* FlowEditor —
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
182
|
+
* FlowEditor — batteries-included workflow editor, but not a black box.
|
|
183
|
+
*
|
|
184
|
+
* Defaults compose NodePalette + FlowCanvas + NodeConfigPanel + run controls +
|
|
185
|
+
* feed. Every part is replaceable: pass `actions` for custom toolbar buttons,
|
|
186
|
+
* `slots` to swap a whole region, `canvasProps` to reach React Flow, or grab
|
|
187
|
+
* the {@link FlowEditorApi} from `ref` / `useFlowEditor()` and build your own
|
|
188
|
+
* chrome around the primitives.
|
|
71
189
|
*/
|
|
72
|
-
declare
|
|
190
|
+
declare const FlowEditor: react.ForwardRefExoticComponent<FlowEditorProps & react.RefAttributes<FlowEditorApi>>;
|
|
73
191
|
|
|
74
192
|
type NodePaletteProps = {
|
|
75
193
|
/** Filter to only these categories. */
|
|
@@ -271,4 +389,4 @@ type FlowRunFeedProps = {
|
|
|
271
389
|
/** FlowRunFeed — scrolling log panel. Auto-scrolls to bottom on new entries. */
|
|
272
390
|
declare function FlowRunFeed({ entries, className, style }: FlowRunFeedProps): react.JSX.Element;
|
|
273
391
|
|
|
274
|
-
export { ActionNode, ConfigField, ConfigFieldRenderer, type ConfigFieldRendererProps, DecisionNode, ExecutorRegistry, FlowCanvas, type FlowCanvasProps, FlowEditor, type FlowEditorProps, FlowGraph, FlowNode, type FlowNodeRenderProps, FlowRunControls, type FlowRunControlsProps, FlowRunFeed, FlowRunFeedEntry, type FlowRunFeedProps, NodeCategory, NodeConfigPanel, type NodeConfigPanelProps, NodeKindDefinition, NodePalette, type NodePaletteProps, NodePort, type NodePortProps, type NodePortSide, type NodePortType, NodeShell, type NodeShellProps, NoteNode, OutputNode, SubgraphNode, TriggerNode, WorkflowMetadata, defaultNodeTypes, defineNode, paletteDropHandlers };
|
|
392
|
+
export { ActionNode, ConfigField, ConfigFieldRenderer, type ConfigFieldRendererProps, DecisionNode, ExecutorRegistry, FlowCanvas, type FlowCanvasProps, FlowEditor, type FlowEditorAction, type FlowEditorApi, type FlowEditorBuiltins, type FlowEditorProps, type FlowEditorSlots, FlowGraph, FlowNode, type FlowNodeRenderProps, FlowRunControls, type FlowRunControlsProps, FlowRunFeed, FlowRunFeedEntry, type FlowRunFeedProps, NodeCategory, NodeConfigPanel, type NodeConfigPanelProps, NodeKindDefinition, NodePalette, type NodePaletteProps, NodePort, type NodePortProps, type NodePortSide, type NodePortType, NodeRunStatus, NodeShell, type NodeShellProps, NoteNode, OutputNode, SubgraphNode, TriggerNode, WorkflowMetadata, WorkflowSchema, defaultNodeTypes, defineNode, paletteDropHandlers, useFlowEditor, useFlowEditorOptional };
|