@particle-academy/fancy-flow 0.35.0 → 0.36.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.
Files changed (42) hide show
  1. package/dist/{chunk-N5ICD2WZ.js → chunk-3BKU4SQZ.js} +3 -3
  2. package/dist/{chunk-N5ICD2WZ.js.map → chunk-3BKU4SQZ.js.map} +1 -1
  3. package/dist/{chunk-EBE3FEAJ.js → chunk-A6RFLGWV.js} +4 -4
  4. package/dist/{chunk-EBE3FEAJ.js.map → chunk-A6RFLGWV.js.map} +1 -1
  5. package/dist/{chunk-Q6IPK64P.js → chunk-PVROYW7C.js} +32 -5
  6. package/dist/chunk-PVROYW7C.js.map +1 -0
  7. package/dist/{chunk-FKOXQP76.js → chunk-QZTGV3ZL.js} +3 -3
  8. package/dist/{chunk-FKOXQP76.js.map → chunk-QZTGV3ZL.js.map} +1 -1
  9. package/dist/{chunk-THU5LW22.js → chunk-UX65ML3J.js} +4 -4
  10. package/dist/{chunk-THU5LW22.js.map → chunk-UX65ML3J.js.map} +1 -1
  11. package/dist/{chunk-RE7T5GKQ.js → chunk-VLATLVGH.js} +3 -3
  12. package/dist/{chunk-RE7T5GKQ.js.map → chunk-VLATLVGH.js.map} +1 -1
  13. package/dist/engine.cjs +10 -2
  14. package/dist/engine.cjs.map +1 -1
  15. package/dist/engine.d.cts +1 -1
  16. package/dist/engine.d.ts +1 -1
  17. package/dist/engine.js +5 -5
  18. package/dist/index.cjs +163 -4
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +59 -2
  21. package/dist/index.d.ts +59 -2
  22. package/dist/index.js +142 -13
  23. package/dist/index.js.map +1 -1
  24. package/dist/registry/index.d.cts +1 -1
  25. package/dist/registry/index.d.ts +1 -1
  26. package/dist/{registry-Ru5jIS5H.d.cts → registry-BADFn97n.d.cts} +41 -1
  27. package/dist/{registry-Df2-bTXZ.d.ts → registry-DYbFLEcW.d.ts} +41 -1
  28. package/dist/registry.cjs +31 -2
  29. package/dist/registry.cjs.map +1 -1
  30. package/dist/registry.js +3 -3
  31. package/dist/runtime.cjs +7 -1
  32. package/dist/runtime.cjs.map +1 -1
  33. package/dist/runtime.js +4 -4
  34. package/dist/schema.cjs +7 -1
  35. package/dist/schema.cjs.map +1 -1
  36. package/dist/schema.js +2 -2
  37. package/dist/styles.css +103 -0
  38. package/dist/styles.css.map +1 -1
  39. package/dist/ux.cjs.map +1 -1
  40. package/dist/ux.js +1 -1
  41. package/package.json +181 -181
  42. package/dist/chunk-Q6IPK64P.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -14,7 +14,7 @@ export { D as DocumentConfigField, K as KeyValueConfigField, L as LEGACY_PAUSE_P
14
14
  import { FlowRunFeedEntry } from './runtime/index.cjs';
15
15
  export { HistoryController, UseFlowHistoryReturn, UseFlowRunOptions, UseFlowRunReturn, UseFlowStateReturn, applyOutputsToNodes, applyStatusesToNodes, createHistory, useFlowHistory, useFlowRun, useFlowState } from './runtime/index.cjs';
16
16
  export { C as CohortGuard, a as CohortOptions, b as CohortPolicy, c as CohortResult, R as RunOptions, d as RunResult, r as runCohort, e as runFlow } from './run-cohort-Bjv2ZU6g.cjs';
17
- export { c as categoryAccent, d as defaultConfigFor, g as getNodeKind, l as listNodeKinds, o as onNodeKindsChanged, r as registerNodeKind, v as validateConfig } from './registry-Ru5jIS5H.cjs';
17
+ export { N as NodeKindPresentation, c as categoryAccent, b as clearNodeKindOverrides, d as defaultConfigFor, g as getNodeKind, l as listNodeKinds, o as onNodeKindsChanged, e as overrideNodeKind, r as registerNodeKind, v as validateConfig } from './registry-BADFn97n.cjs';
18
18
  import './capabilities-BtJQTbnw.cjs';
19
19
 
20
20
  type FlowCanvasProps = Omit<ReactFlowProps<FlowNode, Edge>, "nodes" | "edges" | "height"> & {
@@ -346,6 +346,63 @@ declare function paletteDropHandlers(onDrop: (kindName: string, evt: React.DragE
346
346
  onDrop: (e: React.DragEvent) => void;
347
347
  };
348
348
 
349
+ /** Outcome of one node in a run, for annotating the graph after the fact. */
350
+ type FlowNodeStatus = "ok" | "running" | "failed" | "skipped" | "pending";
351
+ interface FlowViewerClassNames {
352
+ root?: string;
353
+ list?: string;
354
+ row?: string;
355
+ rowIndex?: string;
356
+ rowTitle?: string;
357
+ rowDescription?: string;
358
+ rowStatus?: string;
359
+ }
360
+ interface FlowViewerProps {
361
+ /** The graph to show. */
362
+ graph: FlowGraph;
363
+ /**
364
+ * `canvas` draws the graph. `list` renders the nodes as rows — for a docs
365
+ * page, a narrow column, print, or an audit view, where a pan-zoom surface is
366
+ * the wrong shape and often not usable at all.
367
+ */
368
+ variant?: "canvas" | "list";
369
+ /** Canvas height. Ignored by `list`. Default 480. */
370
+ height?: number | string;
371
+ /** Canvas minimap. Default false. */
372
+ showMinimap?: boolean;
373
+ /** Canvas pan/zoom/fit controls. Default true. */
374
+ showControls?: boolean;
375
+ /**
376
+ * Per-node run outcome, keyed by node id. Lets the same component serve
377
+ * "here is the workflow" and "here is what happened on Tuesday".
378
+ */
379
+ statuses?: Record<string, FlowNodeStatus>;
380
+ /** Controlled selection. */
381
+ selectedNodeId?: string | null;
382
+ /** Omit and nothing is clickable — a viewer with no handler is inert. */
383
+ onSelectNode?: (node: FlowNode) => void;
384
+ className?: string;
385
+ classNames?: FlowViewerClassNames;
386
+ style?: CSSProperties;
387
+ /** Rendered when the graph has no nodes. */
388
+ empty?: ReactNode;
389
+ }
390
+ /**
391
+ * FlowViewer — a workflow, read-only.
392
+ *
393
+ * **Read-only by construction, not by configuration.** There is no prop that
394
+ * makes this editable, because a viewer that can be switched into an editor is
395
+ * a viewer somebody eventually switches into an editor by accident. Before this
396
+ * existed the only way to show a flow was `FlowEditor` (the whole editor) or
397
+ * `FlowCanvas` plus four React Flow flags a consumer had to know to pass —
398
+ * assembly, not an affordance, and nothing stopped the next person shipping a
399
+ * fully editable canvas where they wanted a picture.
400
+ *
401
+ * Node titles come from the registry, so `overrideNodeKind()` renames apply
402
+ * here too.
403
+ */
404
+ declare function FlowViewer({ graph, variant, height, showMinimap, showControls, statuses, selectedNodeId, onSelectNode, className, classNames, style, empty, }: FlowViewerProps): react.JSX.Element;
405
+
349
406
  type NodeConfigPanelProps = {
350
407
  /** Currently-selected node — pass null to render the empty state. */
351
408
  node: FlowNode | null;
@@ -579,4 +636,4 @@ type FlowRunFeedProps = {
579
636
  */
580
637
  declare function FlowRunFeed({ entries, showHeader, title, running, className, style }: FlowRunFeedProps): react.JSX.Element;
581
638
 
582
- export { ActionNode, type AlignEdge, AutoLayoutOptions, 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, LaneNode, 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, alignNodes, cloneSubgraph, defaultNodeTypes, defineNode, distributeNodes, paletteDropHandlers, reconnectEdge, useFlowEditor, useFlowEditorOptional };
639
+ export { ActionNode, type AlignEdge, AutoLayoutOptions, 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, type FlowNodeStatus, FlowRunControls, type FlowRunControlsProps, FlowRunFeed, FlowRunFeedEntry, type FlowRunFeedProps, FlowViewer, type FlowViewerClassNames, type FlowViewerProps, LaneNode, 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, alignNodes, cloneSubgraph, defaultNodeTypes, defineNode, distributeNodes, paletteDropHandlers, reconnectEdge, useFlowEditor, useFlowEditorOptional };
package/dist/index.d.ts CHANGED
@@ -14,7 +14,7 @@ export { D as DocumentConfigField, K as KeyValueConfigField, L as LEGACY_PAUSE_P
14
14
  import { FlowRunFeedEntry } from './runtime/index.js';
15
15
  export { HistoryController, UseFlowHistoryReturn, UseFlowRunOptions, UseFlowRunReturn, UseFlowStateReturn, applyOutputsToNodes, applyStatusesToNodes, createHistory, useFlowHistory, useFlowRun, useFlowState } from './runtime/index.js';
16
16
  export { C as CohortGuard, a as CohortOptions, b as CohortPolicy, c as CohortResult, R as RunOptions, d as RunResult, r as runCohort, e as runFlow } from './run-cohort-BnP6ErHi.js';
17
- export { c as categoryAccent, d as defaultConfigFor, g as getNodeKind, l as listNodeKinds, o as onNodeKindsChanged, r as registerNodeKind, v as validateConfig } from './registry-Df2-bTXZ.js';
17
+ export { N as NodeKindPresentation, c as categoryAccent, b as clearNodeKindOverrides, d as defaultConfigFor, g as getNodeKind, l as listNodeKinds, o as onNodeKindsChanged, e as overrideNodeKind, r as registerNodeKind, v as validateConfig } from './registry-DYbFLEcW.js';
18
18
  import './capabilities-CkhKj_U_.js';
19
19
 
20
20
  type FlowCanvasProps = Omit<ReactFlowProps<FlowNode, Edge>, "nodes" | "edges" | "height"> & {
@@ -346,6 +346,63 @@ declare function paletteDropHandlers(onDrop: (kindName: string, evt: React.DragE
346
346
  onDrop: (e: React.DragEvent) => void;
347
347
  };
348
348
 
349
+ /** Outcome of one node in a run, for annotating the graph after the fact. */
350
+ type FlowNodeStatus = "ok" | "running" | "failed" | "skipped" | "pending";
351
+ interface FlowViewerClassNames {
352
+ root?: string;
353
+ list?: string;
354
+ row?: string;
355
+ rowIndex?: string;
356
+ rowTitle?: string;
357
+ rowDescription?: string;
358
+ rowStatus?: string;
359
+ }
360
+ interface FlowViewerProps {
361
+ /** The graph to show. */
362
+ graph: FlowGraph;
363
+ /**
364
+ * `canvas` draws the graph. `list` renders the nodes as rows — for a docs
365
+ * page, a narrow column, print, or an audit view, where a pan-zoom surface is
366
+ * the wrong shape and often not usable at all.
367
+ */
368
+ variant?: "canvas" | "list";
369
+ /** Canvas height. Ignored by `list`. Default 480. */
370
+ height?: number | string;
371
+ /** Canvas minimap. Default false. */
372
+ showMinimap?: boolean;
373
+ /** Canvas pan/zoom/fit controls. Default true. */
374
+ showControls?: boolean;
375
+ /**
376
+ * Per-node run outcome, keyed by node id. Lets the same component serve
377
+ * "here is the workflow" and "here is what happened on Tuesday".
378
+ */
379
+ statuses?: Record<string, FlowNodeStatus>;
380
+ /** Controlled selection. */
381
+ selectedNodeId?: string | null;
382
+ /** Omit and nothing is clickable — a viewer with no handler is inert. */
383
+ onSelectNode?: (node: FlowNode) => void;
384
+ className?: string;
385
+ classNames?: FlowViewerClassNames;
386
+ style?: CSSProperties;
387
+ /** Rendered when the graph has no nodes. */
388
+ empty?: ReactNode;
389
+ }
390
+ /**
391
+ * FlowViewer — a workflow, read-only.
392
+ *
393
+ * **Read-only by construction, not by configuration.** There is no prop that
394
+ * makes this editable, because a viewer that can be switched into an editor is
395
+ * a viewer somebody eventually switches into an editor by accident. Before this
396
+ * existed the only way to show a flow was `FlowEditor` (the whole editor) or
397
+ * `FlowCanvas` plus four React Flow flags a consumer had to know to pass —
398
+ * assembly, not an affordance, and nothing stopped the next person shipping a
399
+ * fully editable canvas where they wanted a picture.
400
+ *
401
+ * Node titles come from the registry, so `overrideNodeKind()` renames apply
402
+ * here too.
403
+ */
404
+ declare function FlowViewer({ graph, variant, height, showMinimap, showControls, statuses, selectedNodeId, onSelectNode, className, classNames, style, empty, }: FlowViewerProps): react.JSX.Element;
405
+
349
406
  type NodeConfigPanelProps = {
350
407
  /** Currently-selected node — pass null to render the empty state. */
351
408
  node: FlowNode | null;
@@ -579,4 +636,4 @@ type FlowRunFeedProps = {
579
636
  */
580
637
  declare function FlowRunFeed({ entries, showHeader, title, running, className, style }: FlowRunFeedProps): react.JSX.Element;
581
638
 
582
- export { ActionNode, type AlignEdge, AutoLayoutOptions, 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, LaneNode, 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, alignNodes, cloneSubgraph, defaultNodeTypes, defineNode, distributeNodes, paletteDropHandlers, reconnectEdge, useFlowEditor, useFlowEditorOptional };
639
+ export { ActionNode, type AlignEdge, AutoLayoutOptions, 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, type FlowNodeStatus, FlowRunControls, type FlowRunControlsProps, FlowRunFeed, FlowRunFeedEntry, type FlowRunFeedProps, FlowViewer, type FlowViewerClassNames, type FlowViewerProps, LaneNode, 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, alignNodes, cloneSubgraph, defaultNodeTypes, defineNode, distributeNodes, paletteDropHandlers, reconnectEdge, useFlowEditor, useFlowEditorOptional };
package/dist/index.js CHANGED
@@ -1,17 +1,17 @@
1
- import { useFlowState, useFlowRun, useFlowHistory, applyOutputsToNodes, applyStatusesToNodes } from './chunk-EBE3FEAJ.js';
2
- export { applyOutputsToNodes, applyStatusesToNodes, createHistory, useFlowHistory, useFlowRun, useFlowState } from './chunk-EBE3FEAJ.js';
3
- export { runCohort } from './chunk-FKOXQP76.js';
4
- import { buildNodeTypes, FlowEditorProvider, registerBuiltinKinds, NoteNode, createConnectionValidator } from './chunk-THU5LW22.js';
5
- export { ANY_PORT_TYPE, BUILTIN_KINDS, LaneNode, NoteNode, RegistryNode, buildNodeTypes, createConnectionValidator, defaultPortCompatibility, registerBuiltinKinds, useFlowEditor, useFlowEditorOptional } from './chunk-THU5LW22.js';
1
+ import { useFlowState, useFlowRun, useFlowHistory, applyOutputsToNodes, applyStatusesToNodes } from './chunk-A6RFLGWV.js';
2
+ export { applyOutputsToNodes, applyStatusesToNodes, createHistory, useFlowHistory, useFlowRun, useFlowState } from './chunk-A6RFLGWV.js';
3
+ export { runCohort } from './chunk-QZTGV3ZL.js';
4
+ import { buildNodeTypes, FlowEditorProvider, registerBuiltinKinds, NoteNode, createConnectionValidator } from './chunk-UX65ML3J.js';
5
+ export { ANY_PORT_TYPE, BUILTIN_KINDS, LaneNode, NoteNode, RegistryNode, buildNodeTypes, createConnectionValidator, defaultPortCompatibility, registerBuiltinKinds, useFlowEditor, useFlowEditorOptional } from './chunk-UX65ML3J.js';
6
6
  import { ReactFlowProvider, useReactFlow, addEdge, applyEdgeChanges, applyNodeChanges, Position, Handle, reconnectEdge, index, BackgroundVariant, Background, Controls, MiniMap, ViewportPortal } from './chunk-OWENS2H5.js';
7
7
  export { LEGACY_PAUSE_PREFIXES, PAUSE_PREFIX, decodePause, encodePause, isPause, pauseForHuman } from './chunk-UEOE6B52.js';
8
8
  import './chunk-USL4FMFU.js';
9
- export { runFlow } from './chunk-RE7T5GKQ.js';
10
- import { workflowToBlob, importWorkflow, exportWorkflow } from './chunk-N5ICD2WZ.js';
11
- export { WORKFLOW_SCHEMA_URL, WORKFLOW_SCHEMA_VERSION, exportWorkflow, importWorkflow, migrateSchema, workflowToBlob } from './chunk-N5ICD2WZ.js';
9
+ export { runFlow } from './chunk-VLATLVGH.js';
10
+ import { workflowToBlob, importWorkflow, exportWorkflow } from './chunk-3BKU4SQZ.js';
11
+ export { WORKFLOW_SCHEMA_URL, WORKFLOW_SCHEMA_VERSION, exportWorkflow, importWorkflow, migrateSchema, workflowToBlob } from './chunk-3BKU4SQZ.js';
12
12
  export { resolveNodePorts, resolvePortSpec } from './chunk-TITD5W4Y.js';
13
- import { onNodeKindsChanged, listNodeKinds, getNodeKind, defaultConfigFor, validateConfig, categoryAccent } from './chunk-Q6IPK64P.js';
14
- export { categoryAccent, defaultConfigFor, getNodeKind, listNodeKinds, onNodeKindsChanged, registerNodeKind, validateConfig } from './chunk-Q6IPK64P.js';
13
+ import { onNodeKindsChanged, listNodeKinds, getNodeKind, defaultConfigFor, validateConfig, categoryAccent } from './chunk-PVROYW7C.js';
14
+ export { categoryAccent, clearNodeKindOverrides, defaultConfigFor, getNodeKind, listNodeKinds, onNodeKindsChanged, overrideNodeKind, registerNodeKind, validateConfig } from './chunk-PVROYW7C.js';
15
15
  import { getRichInputAdapter } from './chunk-F5RPRB7A.js';
16
16
  export { RichInputPreview, getRichInputAdapter, isRichInputEnabled, onRichInputAdapterChanged, registerRichInputAdapter } from './chunk-F5RPRB7A.js';
17
17
  import { memo, forwardRef, useState, useMemo, useEffect, useCallback, useRef, useImperativeHandle, useId } from 'react';
@@ -192,13 +192,13 @@ function alignNodes(nodes, edge) {
192
192
  const maxR = Math.max(...nodes.map((n) => n.position.x + nodeW(n)));
193
193
  const minT = Math.min(...nodes.map((n) => n.position.y));
194
194
  const maxB = Math.max(...nodes.map((n) => n.position.y + nodeH(n)));
195
- const cx = (minL + maxR) / 2;
195
+ const cx2 = (minL + maxR) / 2;
196
196
  const cy = (minT + maxB) / 2;
197
197
  return nodes.map((n) => {
198
198
  let { x, y } = n.position;
199
199
  if (edge === "left") x = minL;
200
200
  else if (edge === "right") x = maxR - nodeW(n);
201
- else if (edge === "hcenter") x = cx - nodeW(n) / 2;
201
+ else if (edge === "hcenter") x = cx2 - nodeW(n) / 2;
202
202
  else if (edge === "top") y = minT;
203
203
  else if (edge === "bottom") y = maxB - nodeH(n);
204
204
  else if (edge === "vcenter") y = cy - nodeH(n) / 2;
@@ -1927,6 +1927,135 @@ function EdgeLabelEditor({
1927
1927
  }
1928
1928
  );
1929
1929
  }
1930
+ var STATUS_LABEL = {
1931
+ ok: "ok",
1932
+ running: "running",
1933
+ failed: "failed",
1934
+ skipped: "skipped",
1935
+ pending: "pending"
1936
+ };
1937
+ function FlowViewer({
1938
+ graph,
1939
+ variant = "canvas",
1940
+ height = 480,
1941
+ showMinimap = false,
1942
+ showControls = true,
1943
+ statuses,
1944
+ selectedNodeId = null,
1945
+ onSelectNode,
1946
+ className,
1947
+ classNames = {},
1948
+ style,
1949
+ empty
1950
+ }) {
1951
+ const nodeTypes = useMemo(() => buildNodeTypes(), []);
1952
+ const rows = useMemo(
1953
+ () => graph.nodes.map((node, index2) => {
1954
+ const kind = getNodeKind(node.data?.kind ?? node.type ?? "");
1955
+ return {
1956
+ node,
1957
+ index: index2,
1958
+ title: kind?.label ?? node.data?.label ?? node.data?.kind ?? node.id,
1959
+ description: kind?.description ?? null,
1960
+ accent: kind?.accent ?? categoryAccent(kind?.category ?? "custom"),
1961
+ status: statuses?.[node.id] ?? null
1962
+ };
1963
+ }),
1964
+ [graph.nodes, statuses]
1965
+ );
1966
+ if (graph.nodes.length === 0) {
1967
+ return /* @__PURE__ */ jsx("div", { className: cx("ff-viewer ff-viewer--empty", className, classNames.root), style, children: empty ?? /* @__PURE__ */ jsx("span", { className: "ff-viewer__empty", children: "This flow has no nodes." }) });
1968
+ }
1969
+ if (variant === "list") {
1970
+ return /* @__PURE__ */ jsx(
1971
+ "div",
1972
+ {
1973
+ className: cx("ff-viewer ff-viewer--list", className, classNames.root),
1974
+ style,
1975
+ "data-flow-viewer": "list",
1976
+ children: /* @__PURE__ */ jsx("ol", { className: cx("ff-viewer__list", classNames.list), children: rows.map(({ node, index: index2, title, description, accent, status }) => {
1977
+ const selected = node.id === selectedNodeId;
1978
+ const Row = onSelectNode ? "button" : "div";
1979
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
1980
+ Row,
1981
+ {
1982
+ ...onSelectNode ? { type: "button", onClick: () => onSelectNode(node) } : {},
1983
+ className: cx(
1984
+ "ff-viewer__row",
1985
+ selected && "ff-viewer__row--selected",
1986
+ onSelectNode && "ff-viewer__row--interactive",
1987
+ classNames.row
1988
+ ),
1989
+ "data-flow-viewer-node": node.id,
1990
+ "data-flow-viewer-status": status ?? void 0,
1991
+ "aria-current": selected || void 0,
1992
+ children: [
1993
+ /* @__PURE__ */ jsx(
1994
+ "span",
1995
+ {
1996
+ className: cx("ff-viewer__index", classNames.rowIndex),
1997
+ style: { backgroundColor: accent },
1998
+ "aria-hidden": true,
1999
+ children: index2 + 1
2000
+ }
2001
+ ),
2002
+ /* @__PURE__ */ jsxs("span", { className: "ff-viewer__body", children: [
2003
+ /* @__PURE__ */ jsx("span", { className: cx("ff-viewer__title", classNames.rowTitle), children: title }),
2004
+ description && /* @__PURE__ */ jsx("span", { className: cx("ff-viewer__desc", classNames.rowDescription), children: description })
2005
+ ] }),
2006
+ status && /* @__PURE__ */ jsx(
2007
+ "span",
2008
+ {
2009
+ className: cx(
2010
+ "ff-viewer__status",
2011
+ `ff-viewer__status--${status}`,
2012
+ classNames.rowStatus
2013
+ ),
2014
+ children: STATUS_LABEL[status]
2015
+ }
2016
+ )
2017
+ ]
2018
+ }
2019
+ ) }, node.id);
2020
+ }) })
2021
+ }
2022
+ );
2023
+ }
2024
+ return /* @__PURE__ */ jsx(
2025
+ "div",
2026
+ {
2027
+ className: cx("ff-viewer ff-viewer--canvas", className, classNames.root),
2028
+ style,
2029
+ "data-flow-viewer": "canvas",
2030
+ children: /* @__PURE__ */ jsx(
2031
+ FlowCanvas,
2032
+ {
2033
+ nodes: graph.nodes,
2034
+ edges: graph.edges,
2035
+ nodeTypes,
2036
+ height,
2037
+ showControls,
2038
+ showMinimap,
2039
+ nodesDraggable: false,
2040
+ nodesConnectable: false,
2041
+ nodesFocusable: Boolean(onSelectNode),
2042
+ edgesFocusable: false,
2043
+ elementsSelectable: Boolean(onSelectNode),
2044
+ deleteKeyCode: null,
2045
+ selectionKeyCode: null,
2046
+ multiSelectionKeyCode: null,
2047
+ connectOnClick: false,
2048
+ zoomOnScroll: false,
2049
+ onNodeClick: onSelectNode ? (_, node) => onSelectNode(node) : void 0,
2050
+ fitView: true
2051
+ }
2052
+ )
2053
+ }
2054
+ );
2055
+ }
2056
+ function cx(...parts) {
2057
+ return parts.filter(Boolean).join(" ");
2058
+ }
1930
2059
  function defineNode(render) {
1931
2060
  function Wrapped(props) {
1932
2061
  return render({
@@ -1961,6 +2090,6 @@ function NodePort({ side, type, id, style, title, className }) {
1961
2090
  // src/index.ts
1962
2091
  registerBuiltinKinds();
1963
2092
 
1964
- export { ActionNode, ConfigFieldRenderer, DecisionNode, FlowCanvas, FlowEditor, FlowRunControls, FlowRunFeed, NodeConfigPanel, NodePalette, NodePort, NodeShell, OutputNode, SubgraphNode, TriggerNode, alignNodes, cloneSubgraph, defaultNodeTypes, defineNode, distributeNodes, paletteDropHandlers, reconnectEdge2 as reconnectEdge };
2093
+ export { ActionNode, ConfigFieldRenderer, DecisionNode, FlowCanvas, FlowEditor, FlowRunControls, FlowRunFeed, FlowViewer, NodeConfigPanel, NodePalette, NodePort, NodeShell, OutputNode, SubgraphNode, TriggerNode, alignNodes, cloneSubgraph, defaultNodeTypes, defineNode, distributeNodes, paletteDropHandlers, reconnectEdge2 as reconnectEdge };
1965
2094
  //# sourceMappingURL=index.js.map
1966
2095
  //# sourceMappingURL=index.js.map