@particle-academy/fancy-flow 0.34.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 (64) hide show
  1. package/dist/{capabilities-BLOeLACV.d.cts → capabilities-BtJQTbnw.d.cts} +1 -1
  2. package/dist/{capabilities-BH7zmSQQ.d.ts → capabilities-CkhKj_U_.d.ts} +1 -1
  3. package/dist/{chunk-N5ICD2WZ.js → chunk-3BKU4SQZ.js} +3 -3
  4. package/dist/{chunk-N5ICD2WZ.js.map → chunk-3BKU4SQZ.js.map} +1 -1
  5. package/dist/{chunk-EBE3FEAJ.js → chunk-A6RFLGWV.js} +4 -4
  6. package/dist/{chunk-EBE3FEAJ.js.map → chunk-A6RFLGWV.js.map} +1 -1
  7. package/dist/{chunk-Q6IPK64P.js → chunk-PVROYW7C.js} +32 -5
  8. package/dist/chunk-PVROYW7C.js.map +1 -0
  9. package/dist/{chunk-FKOXQP76.js → chunk-QZTGV3ZL.js} +3 -3
  10. package/dist/{chunk-FKOXQP76.js.map → chunk-QZTGV3ZL.js.map} +1 -1
  11. package/dist/{chunk-THU5LW22.js → chunk-UX65ML3J.js} +4 -4
  12. package/dist/{chunk-THU5LW22.js.map → chunk-UX65ML3J.js.map} +1 -1
  13. package/dist/{chunk-RE7T5GKQ.js → chunk-VLATLVGH.js} +3 -3
  14. package/dist/{chunk-RE7T5GKQ.js.map → chunk-VLATLVGH.js.map} +1 -1
  15. package/dist/engine.cjs +10 -2
  16. package/dist/engine.cjs.map +1 -1
  17. package/dist/engine.d.cts +7 -238
  18. package/dist/engine.d.ts +7 -238
  19. package/dist/engine.js +5 -5
  20. package/dist/index.cjs +163 -4
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +65 -8
  23. package/dist/index.d.ts +65 -8
  24. package/dist/index.js +142 -13
  25. package/dist/index.js.map +1 -1
  26. package/dist/layout/index.d.cts +1 -1
  27. package/dist/layout/index.d.ts +1 -1
  28. package/dist/llm/prism.d.cts +2 -2
  29. package/dist/llm/prism.d.ts +2 -2
  30. package/dist/llm/vercel-ai.d.cts +2 -2
  31. package/dist/llm/vercel-ai.d.ts +2 -2
  32. package/dist/registry/index.d.cts +6 -6
  33. package/dist/registry/index.d.ts +6 -6
  34. package/dist/registry-BADFn97n.d.cts +85 -0
  35. package/dist/registry-DYbFLEcW.d.ts +85 -0
  36. package/dist/registry.cjs +31 -2
  37. package/dist/registry.cjs.map +1 -1
  38. package/dist/registry.js +3 -3
  39. package/dist/{run-cohort-DitsaYgS.d.cts → run-cohort-Bjv2ZU6g.d.cts} +1 -1
  40. package/dist/{run-cohort-CV7EcwGG.d.ts → run-cohort-BnP6ErHi.d.ts} +1 -1
  41. package/dist/runtime/index.d.cts +3 -3
  42. package/dist/runtime/index.d.ts +3 -3
  43. package/dist/runtime.cjs +7 -1
  44. package/dist/runtime.cjs.map +1 -1
  45. package/dist/runtime.js +4 -4
  46. package/dist/schema/index.d.cts +1 -1
  47. package/dist/schema/index.d.ts +1 -1
  48. package/dist/schema.cjs +7 -1
  49. package/dist/schema.cjs.map +1 -1
  50. package/dist/schema.js +2 -2
  51. package/dist/styles.css +103 -0
  52. package/dist/styles.css.map +1 -1
  53. package/dist/{types-DEmDSByY.d.cts → types-D6lsIGoe.d.ts} +251 -2
  54. package/dist/{types-Bj_ZHwqG.d.ts → types-D8Dezh9v.d.cts} +251 -2
  55. package/dist/{types-CMSrWVYM.d.cts → types-sOmpCitB.d.cts} +1 -1
  56. package/dist/{types-CMSrWVYM.d.ts → types-sOmpCitB.d.ts} +1 -1
  57. package/dist/ux.cjs.map +1 -1
  58. package/dist/ux.d.cts +2 -2
  59. package/dist/ux.d.ts +2 -2
  60. package/dist/ux.js +1 -1
  61. package/package.json +181 -181
  62. package/dist/chunk-Q6IPK64P.js.map +0 -1
  63. package/dist/registry-Dd1Q66uP.d.ts +0 -45
  64. package/dist/registry-qv4gRiuQ.d.cts +0 -45
package/dist/index.cjs CHANGED
@@ -1724,6 +1724,7 @@ var init_layout = __esm({
1724
1724
  var kinds = /* @__PURE__ */ new Map();
1725
1725
  var aliases = /* @__PURE__ */ new Map();
1726
1726
  var listeners = /* @__PURE__ */ new Set();
1727
+ var overrides = /* @__PURE__ */ new Map();
1727
1728
  function registerNodeKind(definition) {
1728
1729
  kinds.set(definition.name, definition);
1729
1730
  for (const alias of definition.aliases ?? []) aliases.set(alias, definition.name);
@@ -1743,15 +1744,41 @@ function resolveKindId(id2) {
1743
1744
  const canonical = aliases.get(id2);
1744
1745
  return canonical && kinds.has(canonical) ? canonical : null;
1745
1746
  }
1747
+ function overrideNodeKind(name, patch) {
1748
+ const canonical = resolveKindId(name) ?? name;
1749
+ const previous = overrides.get(canonical);
1750
+ overrides.set(canonical, { ...previous, ...patch });
1751
+ notify();
1752
+ return () => {
1753
+ if (previous) {
1754
+ overrides.set(canonical, previous);
1755
+ } else {
1756
+ overrides.delete(canonical);
1757
+ }
1758
+ notify();
1759
+ };
1760
+ }
1761
+ function clearNodeKindOverrides() {
1762
+ if (overrides.size === 0) return;
1763
+ overrides.clear();
1764
+ notify();
1765
+ }
1766
+ function withOverride(kind) {
1767
+ if (!kind) return null;
1768
+ const patch = overrides.get(kind.name);
1769
+ return patch ? { ...kind, ...patch } : kind;
1770
+ }
1746
1771
  function getNodeKind(name) {
1747
1772
  const canonical = resolveKindId(name);
1748
- return canonical ? kinds.get(canonical) ?? null : null;
1773
+ return canonical ? withOverride(kinds.get(canonical)) : null;
1749
1774
  }
1750
1775
  function kindIds(kind) {
1751
1776
  return [kind.name, ...kind.aliases ?? []];
1752
1777
  }
1753
1778
  function listNodeKinds(category) {
1754
- const all = Array.from(kinds.values());
1779
+ const all = Array.from(kinds.values()).map(
1780
+ (k2) => withOverride(k2)
1781
+ );
1755
1782
  return category ? all.filter((k2) => k2.category === category) : all;
1756
1783
  }
1757
1784
  function onNodeKindsChanged(listener) {
@@ -12384,13 +12411,13 @@ function alignNodes(nodes, edge) {
12384
12411
  const maxR = Math.max(...nodes.map((n) => n.position.x + nodeW(n)));
12385
12412
  const minT = Math.min(...nodes.map((n) => n.position.y));
12386
12413
  const maxB = Math.max(...nodes.map((n) => n.position.y + nodeH(n)));
12387
- const cx = (minL + maxR) / 2;
12414
+ const cx2 = (minL + maxR) / 2;
12388
12415
  const cy = (minT + maxB) / 2;
12389
12416
  return nodes.map((n) => {
12390
12417
  let { x: x2, y } = n.position;
12391
12418
  if (edge === "left") x2 = minL;
12392
12419
  else if (edge === "right") x2 = maxR - nodeW(n);
12393
- else if (edge === "hcenter") x2 = cx - nodeW(n) / 2;
12420
+ else if (edge === "hcenter") x2 = cx2 - nodeW(n) / 2;
12394
12421
  else if (edge === "top") y = minT;
12395
12422
  else if (edge === "bottom") y = maxB - nodeH(n);
12396
12423
  else if (edge === "vcenter") y = cy - nodeH(n) / 2;
@@ -14668,6 +14695,135 @@ function EdgeLabelEditor({
14668
14695
  }
14669
14696
  );
14670
14697
  }
14698
+ var STATUS_LABEL = {
14699
+ ok: "ok",
14700
+ running: "running",
14701
+ failed: "failed",
14702
+ skipped: "skipped",
14703
+ pending: "pending"
14704
+ };
14705
+ function FlowViewer({
14706
+ graph,
14707
+ variant = "canvas",
14708
+ height = 480,
14709
+ showMinimap = false,
14710
+ showControls = true,
14711
+ statuses,
14712
+ selectedNodeId = null,
14713
+ onSelectNode,
14714
+ className,
14715
+ classNames = {},
14716
+ style: style2,
14717
+ empty: empty2
14718
+ }) {
14719
+ const nodeTypes = ReactExports.useMemo(() => buildNodeTypes(), []);
14720
+ const rows = ReactExports.useMemo(
14721
+ () => graph.nodes.map((node, index2) => {
14722
+ const kind = getNodeKind(node.data?.kind ?? node.type ?? "");
14723
+ return {
14724
+ node,
14725
+ index: index2,
14726
+ title: kind?.label ?? node.data?.label ?? node.data?.kind ?? node.id,
14727
+ description: kind?.description ?? null,
14728
+ accent: kind?.accent ?? categoryAccent(kind?.category ?? "custom"),
14729
+ status: statuses?.[node.id] ?? null
14730
+ };
14731
+ }),
14732
+ [graph.nodes, statuses]
14733
+ );
14734
+ if (graph.nodes.length === 0) {
14735
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cx("ff-viewer ff-viewer--empty", className, classNames.root), style: style2, children: empty2 ?? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ff-viewer__empty", children: "This flow has no nodes." }) });
14736
+ }
14737
+ if (variant === "list") {
14738
+ return /* @__PURE__ */ jsxRuntime.jsx(
14739
+ "div",
14740
+ {
14741
+ className: cx("ff-viewer ff-viewer--list", className, classNames.root),
14742
+ style: style2,
14743
+ "data-flow-viewer": "list",
14744
+ children: /* @__PURE__ */ jsxRuntime.jsx("ol", { className: cx("ff-viewer__list", classNames.list), children: rows.map(({ node, index: index2, title, description, accent, status }) => {
14745
+ const selected2 = node.id === selectedNodeId;
14746
+ const Row = onSelectNode ? "button" : "div";
14747
+ return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
14748
+ Row,
14749
+ {
14750
+ ...onSelectNode ? { type: "button", onClick: () => onSelectNode(node) } : {},
14751
+ className: cx(
14752
+ "ff-viewer__row",
14753
+ selected2 && "ff-viewer__row--selected",
14754
+ onSelectNode && "ff-viewer__row--interactive",
14755
+ classNames.row
14756
+ ),
14757
+ "data-flow-viewer-node": node.id,
14758
+ "data-flow-viewer-status": status ?? void 0,
14759
+ "aria-current": selected2 || void 0,
14760
+ children: [
14761
+ /* @__PURE__ */ jsxRuntime.jsx(
14762
+ "span",
14763
+ {
14764
+ className: cx("ff-viewer__index", classNames.rowIndex),
14765
+ style: { backgroundColor: accent },
14766
+ "aria-hidden": true,
14767
+ children: index2 + 1
14768
+ }
14769
+ ),
14770
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ff-viewer__body", children: [
14771
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: cx("ff-viewer__title", classNames.rowTitle), children: title }),
14772
+ description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cx("ff-viewer__desc", classNames.rowDescription), children: description })
14773
+ ] }),
14774
+ status && /* @__PURE__ */ jsxRuntime.jsx(
14775
+ "span",
14776
+ {
14777
+ className: cx(
14778
+ "ff-viewer__status",
14779
+ `ff-viewer__status--${status}`,
14780
+ classNames.rowStatus
14781
+ ),
14782
+ children: STATUS_LABEL[status]
14783
+ }
14784
+ )
14785
+ ]
14786
+ }
14787
+ ) }, node.id);
14788
+ }) })
14789
+ }
14790
+ );
14791
+ }
14792
+ return /* @__PURE__ */ jsxRuntime.jsx(
14793
+ "div",
14794
+ {
14795
+ className: cx("ff-viewer ff-viewer--canvas", className, classNames.root),
14796
+ style: style2,
14797
+ "data-flow-viewer": "canvas",
14798
+ children: /* @__PURE__ */ jsxRuntime.jsx(
14799
+ FlowCanvas,
14800
+ {
14801
+ nodes: graph.nodes,
14802
+ edges: graph.edges,
14803
+ nodeTypes,
14804
+ height,
14805
+ showControls,
14806
+ showMinimap,
14807
+ nodesDraggable: false,
14808
+ nodesConnectable: false,
14809
+ nodesFocusable: Boolean(onSelectNode),
14810
+ edgesFocusable: false,
14811
+ elementsSelectable: Boolean(onSelectNode),
14812
+ deleteKeyCode: null,
14813
+ selectionKeyCode: null,
14814
+ multiSelectionKeyCode: null,
14815
+ connectOnClick: false,
14816
+ zoomOnScroll: false,
14817
+ onNodeClick: onSelectNode ? (_2, node) => onSelectNode(node) : void 0,
14818
+ fitView: true
14819
+ }
14820
+ )
14821
+ }
14822
+ );
14823
+ }
14824
+ function cx(...parts) {
14825
+ return parts.filter(Boolean).join(" ");
14826
+ }
14671
14827
  function defineNode(render) {
14672
14828
  function Wrapped(props) {
14673
14829
  return render({
@@ -14761,6 +14917,7 @@ exports.FlowCanvas = FlowCanvas;
14761
14917
  exports.FlowEditor = FlowEditor;
14762
14918
  exports.FlowRunControls = FlowRunControls;
14763
14919
  exports.FlowRunFeed = FlowRunFeed;
14920
+ exports.FlowViewer = FlowViewer;
14764
14921
  exports.LEGACY_PAUSE_PREFIXES = LEGACY_PAUSE_PREFIXES;
14765
14922
  exports.LaneNode = LaneNode;
14766
14923
  exports.NodeConfigPanel = NodeConfigPanel;
@@ -14781,6 +14938,7 @@ exports.applyOutputsToNodes = applyOutputsToNodes;
14781
14938
  exports.applyStatusesToNodes = applyStatusesToNodes;
14782
14939
  exports.buildNodeTypes = buildNodeTypes;
14783
14940
  exports.categoryAccent = categoryAccent;
14941
+ exports.clearNodeKindOverrides = clearNodeKindOverrides;
14784
14942
  exports.cloneSubgraph = cloneSubgraph;
14785
14943
  exports.createConnectionValidator = createConnectionValidator;
14786
14944
  exports.createHistory = createHistory;
@@ -14801,6 +14959,7 @@ exports.listNodeKinds = listNodeKinds;
14801
14959
  exports.migrateSchema = migrateSchema;
14802
14960
  exports.onNodeKindsChanged = onNodeKindsChanged;
14803
14961
  exports.onRichInputAdapterChanged = onRichInputAdapterChanged;
14962
+ exports.overrideNodeKind = overrideNodeKind;
14804
14963
  exports.paletteDropHandlers = paletteDropHandlers;
14805
14964
  exports.pauseForHuman = pauseForHuman;
14806
14965
  exports.reconnectEdge = reconnectEdge3;