@particle-academy/fancy-flow 0.17.0 → 0.18.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/dist/{chunk-532A5QA3.js → chunk-FSC64BPD.js} +37 -3
- package/dist/chunk-FSC64BPD.js.map +1 -0
- package/dist/index.cjs +50 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/dist/registry/index.d.cts +52 -3
- package/dist/registry/index.d.ts +52 -3
- package/dist/registry.cjs +111 -74
- package/dist/registry.cjs.map +1 -1
- package/dist/registry.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-532A5QA3.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
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 { ConnectionValidatorOptions } from './registry/index.cjs';
|
|
5
|
+
export { ANY_PORT_TYPE, BUILTIN_KINDS, PortCompatibility, RegistryNode, RichInputAdapter, RichInputPreview, buildNodeTypes, categoryAccent, createConnectionValidator, defaultConfigFor, defaultPortCompatibility, getNodeKind, getRichInputAdapter, isRichInputEnabled, listNodeKinds, onNodeKindsChanged, onRichInputAdapterChanged, registerBuiltinKinds, registerNodeKind, registerRichInputAdapter, resolveNodePorts, resolvePortSpec, validateConfig } from './registry/index.cjs';
|
|
4
6
|
import { b as FlowNode, F as FlowGraph, e as NodeRunStatus, E as ExecutorRegistry } from './types-sOmpCitB.cjs';
|
|
5
7
|
export { A as ActionNodeData, B as BaseNodeData, D as DecisionNodeData, a as FlowEdge, c as FlowNodeData, d 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-sOmpCitB.cjs';
|
|
6
8
|
import { WorkflowSchema, WorkflowMetadata } from './schema/index.cjs';
|
|
@@ -9,7 +11,6 @@ import { N as NodeCategory, a as NodeKindDefinition, C as ConfigField } from './
|
|
|
9
11
|
export { D as DocumentConfigField, K as KeyValueConfigField, P as PortSpec, R as RenderBodyContext, d as RepeaterConfigField, e as RepeaterRowField } from './types-D_jOR3Z2.cjs';
|
|
10
12
|
import { FlowRunFeedEntry } from './runtime/index.cjs';
|
|
11
13
|
export { UseFlowRunOptions, UseFlowRunReturn, UseFlowStateReturn, applyStatusesToNodes, useFlowRun, useFlowState } from './runtime/index.cjs';
|
|
12
|
-
export { BUILTIN_KINDS, RegistryNode, RichInputAdapter, RichInputPreview, buildNodeTypes, categoryAccent, defaultConfigFor, getNodeKind, getRichInputAdapter, isRichInputEnabled, listNodeKinds, onNodeKindsChanged, onRichInputAdapterChanged, registerBuiltinKinds, registerNodeKind, registerRichInputAdapter, resolveNodePorts, resolvePortSpec, validateConfig } from './registry/index.cjs';
|
|
13
14
|
export { R as RunOptions, a as RunResult, r as runFlow } from './run-flow-VKm57Hcj.cjs';
|
|
14
15
|
export { L as LEGACY_PAUSE_PREFIXES, a as PAUSE_PREFIX, P as PauseAwaiting, b as PauseSignal, d as decodePause, e as encodePause, i as isPause, p as pauseForHuman } from './pause-9iT4tCEV.cjs';
|
|
15
16
|
import './capabilities-ChE3Xi8R.cjs';
|
|
@@ -25,6 +26,14 @@ type FlowCanvasProps = Omit<ReactFlowProps<FlowNode, Edge>, "nodes" | "edges" |
|
|
|
25
26
|
showMinimap?: boolean;
|
|
26
27
|
/** Pixel height; FlowCanvas expects a sized container. Default 600. */
|
|
27
28
|
height?: number | string;
|
|
29
|
+
/**
|
|
30
|
+
* Enforce port-type compatibility on new connections. `true` (default) uses
|
|
31
|
+
* the built-in validator: a connection is refused only when both ports
|
|
32
|
+
* declare a concrete, differing `type` (so untyped graphs are unaffected),
|
|
33
|
+
* and self-loops are blocked. Pass options to tune the rule, or `false` to
|
|
34
|
+
* disable. An `isValidConnection` you pass yourself always takes precedence.
|
|
35
|
+
*/
|
|
36
|
+
validateConnections?: boolean | ConnectionValidatorOptions;
|
|
28
37
|
/** Optional toolbar / palette etc. rendered above the canvas. */
|
|
29
38
|
toolbar?: ReactNode;
|
|
30
39
|
className?: string;
|
|
@@ -39,7 +48,7 @@ type FlowCanvasProps = Omit<ReactFlowProps<FlowNode, Edge>, "nodes" | "edges" |
|
|
|
39
48
|
* (xyflow's standard pattern). The surrounding `useFlowState` hook in
|
|
40
49
|
* `runtime/use-flow-state.ts` is a convenience that wires those for you.
|
|
41
50
|
*/
|
|
42
|
-
declare function FlowCanvas({ nodes, edges, background, showControls, showMinimap, height, toolbar, nodeTypes, edgeTypes, className, style, ...rest }: FlowCanvasProps): react.JSX.Element;
|
|
51
|
+
declare function FlowCanvas({ nodes, edges, background, showControls, showMinimap, height, validateConnections, isValidConnection, toolbar, nodeTypes, edgeTypes, className, style, ...rest }: FlowCanvasProps): react.JSX.Element;
|
|
43
52
|
|
|
44
53
|
/**
|
|
45
54
|
* Everything the editor knows and can do, handed to every extension point.
|
|
@@ -444,4 +453,4 @@ type FlowRunFeedProps = {
|
|
|
444
453
|
/** FlowRunFeed — scrolling log panel. Auto-scrolls to bottom on new entries. */
|
|
445
454
|
declare function FlowRunFeed({ entries, className, style }: FlowRunFeedProps): react.JSX.Element;
|
|
446
455
|
|
|
447
|
-
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 };
|
|
456
|
+
export { ActionNode, ConfigField, ConfigFieldRenderer, type ConfigFieldRendererProps, ConnectionValidatorOptions, 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,6 +1,8 @@
|
|
|
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 { ConnectionValidatorOptions } from './registry/index.js';
|
|
5
|
+
export { ANY_PORT_TYPE, BUILTIN_KINDS, PortCompatibility, RegistryNode, RichInputAdapter, RichInputPreview, buildNodeTypes, categoryAccent, createConnectionValidator, defaultConfigFor, defaultPortCompatibility, getNodeKind, getRichInputAdapter, isRichInputEnabled, listNodeKinds, onNodeKindsChanged, onRichInputAdapterChanged, registerBuiltinKinds, registerNodeKind, registerRichInputAdapter, resolveNodePorts, resolvePortSpec, validateConfig } from './registry/index.js';
|
|
4
6
|
import { b as FlowNode, F as FlowGraph, e as NodeRunStatus, E as ExecutorRegistry } from './types-sOmpCitB.js';
|
|
5
7
|
export { A as ActionNodeData, B as BaseNodeData, D as DecisionNodeData, a as FlowEdge, c as FlowNodeData, d 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-sOmpCitB.js';
|
|
6
8
|
import { WorkflowSchema, WorkflowMetadata } from './schema/index.js';
|
|
@@ -9,7 +11,6 @@ import { N as NodeCategory, a as NodeKindDefinition, C as ConfigField } from './
|
|
|
9
11
|
export { D as DocumentConfigField, K as KeyValueConfigField, P as PortSpec, R as RenderBodyContext, d as RepeaterConfigField, e as RepeaterRowField } from './types-NerkPtHS.js';
|
|
10
12
|
import { FlowRunFeedEntry } from './runtime/index.js';
|
|
11
13
|
export { UseFlowRunOptions, UseFlowRunReturn, UseFlowStateReturn, applyStatusesToNodes, useFlowRun, useFlowState } from './runtime/index.js';
|
|
12
|
-
export { BUILTIN_KINDS, RegistryNode, RichInputAdapter, RichInputPreview, buildNodeTypes, categoryAccent, defaultConfigFor, getNodeKind, getRichInputAdapter, isRichInputEnabled, listNodeKinds, onNodeKindsChanged, onRichInputAdapterChanged, registerBuiltinKinds, registerNodeKind, registerRichInputAdapter, resolveNodePorts, resolvePortSpec, validateConfig } from './registry/index.js';
|
|
13
14
|
export { R as RunOptions, a as RunResult, r as runFlow } from './run-flow-ChBi6q-W.js';
|
|
14
15
|
export { L as LEGACY_PAUSE_PREFIXES, a as PAUSE_PREFIX, P as PauseAwaiting, b as PauseSignal, d as decodePause, e as encodePause, i as isPause, p as pauseForHuman } from './pause-9iT4tCEV.js';
|
|
15
16
|
import './capabilities-DUhAc-EJ.js';
|
|
@@ -25,6 +26,14 @@ type FlowCanvasProps = Omit<ReactFlowProps<FlowNode, Edge>, "nodes" | "edges" |
|
|
|
25
26
|
showMinimap?: boolean;
|
|
26
27
|
/** Pixel height; FlowCanvas expects a sized container. Default 600. */
|
|
27
28
|
height?: number | string;
|
|
29
|
+
/**
|
|
30
|
+
* Enforce port-type compatibility on new connections. `true` (default) uses
|
|
31
|
+
* the built-in validator: a connection is refused only when both ports
|
|
32
|
+
* declare a concrete, differing `type` (so untyped graphs are unaffected),
|
|
33
|
+
* and self-loops are blocked. Pass options to tune the rule, or `false` to
|
|
34
|
+
* disable. An `isValidConnection` you pass yourself always takes precedence.
|
|
35
|
+
*/
|
|
36
|
+
validateConnections?: boolean | ConnectionValidatorOptions;
|
|
28
37
|
/** Optional toolbar / palette etc. rendered above the canvas. */
|
|
29
38
|
toolbar?: ReactNode;
|
|
30
39
|
className?: string;
|
|
@@ -39,7 +48,7 @@ type FlowCanvasProps = Omit<ReactFlowProps<FlowNode, Edge>, "nodes" | "edges" |
|
|
|
39
48
|
* (xyflow's standard pattern). The surrounding `useFlowState` hook in
|
|
40
49
|
* `runtime/use-flow-state.ts` is a convenience that wires those for you.
|
|
41
50
|
*/
|
|
42
|
-
declare function FlowCanvas({ nodes, edges, background, showControls, showMinimap, height, toolbar, nodeTypes, edgeTypes, className, style, ...rest }: FlowCanvasProps): react.JSX.Element;
|
|
51
|
+
declare function FlowCanvas({ nodes, edges, background, showControls, showMinimap, height, validateConnections, isValidConnection, toolbar, nodeTypes, edgeTypes, className, style, ...rest }: FlowCanvasProps): react.JSX.Element;
|
|
43
52
|
|
|
44
53
|
/**
|
|
45
54
|
* Everything the editor knows and can do, handed to every extension point.
|
|
@@ -444,4 +453,4 @@ type FlowRunFeedProps = {
|
|
|
444
453
|
/** FlowRunFeed — scrolling log panel. Auto-scrolls to bottom on new entries. */
|
|
445
454
|
declare function FlowRunFeed({ entries, className, style }: FlowRunFeedProps): react.JSX.Element;
|
|
446
455
|
|
|
447
|
-
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 };
|
|
456
|
+
export { ActionNode, ConfigField, ConfigFieldRenderer, type ConfigFieldRendererProps, ConnectionValidatorOptions, 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.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useFlowState, useFlowRun, applyStatusesToNodes } from './chunk-MFMRTRPO.js';
|
|
2
2
|
export { applyStatusesToNodes, useFlowRun, useFlowState } from './chunk-MFMRTRPO.js';
|
|
3
|
-
import { buildNodeTypes, registerBuiltinKinds } from './chunk-
|
|
4
|
-
export { BUILTIN_KINDS, RegistryNode, buildNodeTypes, registerBuiltinKinds } from './chunk-
|
|
3
|
+
import { buildNodeTypes, registerBuiltinKinds, createConnectionValidator } from './chunk-FSC64BPD.js';
|
|
4
|
+
export { ANY_PORT_TYPE, BUILTIN_KINDS, RegistryNode, buildNodeTypes, createConnectionValidator, defaultPortCompatibility, registerBuiltinKinds } from './chunk-FSC64BPD.js';
|
|
5
5
|
import { ReactFlowProvider, useReactFlow, addEdge, applyEdgeChanges, applyNodeChanges, Position, Handle, index, BackgroundVariant, Background, Controls, MiniMap } from './chunk-NF6NPY5N.js';
|
|
6
6
|
export { LEGACY_PAUSE_PREFIXES, PAUSE_PREFIX, decodePause, encodePause, isPause, pauseForHuman } from './chunk-UEOE6B52.js';
|
|
7
7
|
export { runFlow } from './chunk-L4AX73Q6.js';
|
|
@@ -151,6 +151,8 @@ function FlowCanvas({
|
|
|
151
151
|
showControls = true,
|
|
152
152
|
showMinimap = false,
|
|
153
153
|
height = 600,
|
|
154
|
+
validateConnections = true,
|
|
155
|
+
isValidConnection,
|
|
154
156
|
toolbar,
|
|
155
157
|
nodeTypes,
|
|
156
158
|
edgeTypes,
|
|
@@ -162,6 +164,16 @@ function FlowCanvas({
|
|
|
162
164
|
() => ({ ...defaultNodeTypes, ...nodeTypes ?? {} }),
|
|
163
165
|
[nodeTypes]
|
|
164
166
|
);
|
|
167
|
+
const nodesRef = useRef(nodes);
|
|
168
|
+
nodesRef.current = nodes;
|
|
169
|
+
const builtinValidator = useMemo(
|
|
170
|
+
() => validateConnections === false ? void 0 : createConnectionValidator(
|
|
171
|
+
() => nodesRef.current,
|
|
172
|
+
validateConnections === true ? void 0 : validateConnections
|
|
173
|
+
),
|
|
174
|
+
[validateConnections]
|
|
175
|
+
);
|
|
176
|
+
const resolvedIsValidConnection = isValidConnection ?? builtinValidator;
|
|
165
177
|
const mergedEdgeTypes = useMemo(
|
|
166
178
|
() => edgeTypes ? { ...edgeTypes } : void 0,
|
|
167
179
|
[edgeTypes]
|
|
@@ -181,6 +193,7 @@ function FlowCanvas({
|
|
|
181
193
|
proOptions: { hideAttribution: true },
|
|
182
194
|
zoomActivationKeyCode: "Shift",
|
|
183
195
|
preventScrolling: false,
|
|
196
|
+
isValidConnection: resolvedIsValidConnection,
|
|
184
197
|
...rest,
|
|
185
198
|
children: [
|
|
186
199
|
background !== "none" && /* @__PURE__ */ jsx(Background, { variant: background, gap: 20, size: 1, color: "rgba(0,0,0,0.18)" }),
|