@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
@@ -6,7 +6,7 @@ import { b as LlmRoute } from '../capabilities-BtJQTbnw.cjs';
6
6
  export { C as CapabilityId, L as LlmClient, c as LlmRouteChoice, a as LlmRouteRequest, W as WorkflowResolution, d as WorkflowResolutionFailure, e as WorkflowResolver, f as capabilityStatus, g as getLlmClient, h as getWorkflowResolver, i as isResolutionFailure, r as registerLlmClient, j as registerWorkflowResolver } from '../capabilities-BtJQTbnw.cjs';
7
7
  import * as react from 'react';
8
8
  import { ComponentType, ReactNode } from 'react';
9
- export { c as categoryAccent, d as defaultConfigFor, g as getNodeKind, k as kindIds, l as listNodeKinds, o as onNodeKindsChanged, r as registerNodeKind, a as resolveKindId, v as validateConfig } from '../registry-Ru5jIS5H.cjs';
9
+ export { N as NodeKindPresentation, c as categoryAccent, b as clearNodeKindOverrides, d as defaultConfigFor, g as getNodeKind, k as kindIds, l as listNodeKinds, o as onNodeKindsChanged, e as overrideNodeKind, r as registerNodeKind, a as resolveKindId, v as validateConfig } from '../registry-BADFn97n.cjs';
10
10
 
11
11
  /**
12
12
  * Connection validation — the single rule that decides whether an edge between
@@ -6,7 +6,7 @@ import { b as LlmRoute } from '../capabilities-CkhKj_U_.js';
6
6
  export { C as CapabilityId, L as LlmClient, c as LlmRouteChoice, a as LlmRouteRequest, W as WorkflowResolution, d as WorkflowResolutionFailure, e as WorkflowResolver, f as capabilityStatus, g as getLlmClient, h as getWorkflowResolver, i as isResolutionFailure, r as registerLlmClient, j as registerWorkflowResolver } from '../capabilities-CkhKj_U_.js';
7
7
  import * as react from 'react';
8
8
  import { ComponentType, ReactNode } from 'react';
9
- export { c as categoryAccent, d as defaultConfigFor, g as getNodeKind, k as kindIds, l as listNodeKinds, o as onNodeKindsChanged, r as registerNodeKind, a as resolveKindId, v as validateConfig } from '../registry-Df2-bTXZ.js';
9
+ export { N as NodeKindPresentation, c as categoryAccent, b as clearNodeKindOverrides, d as defaultConfigFor, g as getNodeKind, k as kindIds, l as listNodeKinds, o as onNodeKindsChanged, e as overrideNodeKind, r as registerNodeKind, a as resolveKindId, v as validateConfig } from '../registry-DYbFLEcW.js';
10
10
 
11
11
  /**
12
12
  * Connection validation — the single rule that decides whether an edge between
@@ -1,5 +1,17 @@
1
1
  import { d as NodeKindDefinition } from './types-D8Dezh9v.cjs';
2
2
 
3
+ /**
4
+ * The presentation fields a consumer may override on someone else's node kind.
5
+ *
6
+ * Deliberately excludes everything behavioural — `executor`, `inputs`,
7
+ * `outputs`, `configSchema`, `sideEffects`. An "override" that could change
8
+ * those is not an override, it is a fork wearing a friendly name, and it would
9
+ * desync the graph from the runtime that executes it.
10
+ *
11
+ * `category` IS included: which drawer a node appears in is presentation, and a
12
+ * consumer regrouping their palette is the same kind of act as renaming.
13
+ */
14
+ type NodeKindPresentation = Partial<Pick<NodeKindDefinition, "label" | "description" | "icon" | "accent" | "category">>;
3
15
  /**
4
16
  * registerNodeKind — install a node kind in the global registry. Returns
5
17
  * an `unregister` function. Calling with the same name replaces the prior
@@ -20,6 +32,34 @@ declare function registerNodeKind<TC = any, TI = any, TO = any>(definition: Node
20
32
  * documents written before namespacing keep opening.
21
33
  */
22
34
  declare function resolveKindId(id: string): string | null;
35
+ /**
36
+ * Rename or re-describe a kind you did not author.
37
+ *
38
+ * Before this existed the only way to relabel a builtin was `registerNodeKind`
39
+ * with a full definition — which REPLACES the kind, so a consumer wanting
40
+ * "Call an API" instead of "HTTP Request" had to re-declare that node's
41
+ * configSchema, ports, executor and renderer, and silently forfeited whatever
42
+ * the builtin gained in the next release. In practice nobody renamed a node,
43
+ * and the palette could not be localised at all.
44
+ *
45
+ * ```ts
46
+ * const undo = overrideNodeKind("@particle-academy/http_request", {
47
+ * label: "Call an API",
48
+ * description: "Fetch or post JSON to a URL",
49
+ * });
50
+ * ```
51
+ *
52
+ * Applies at `getNodeKind()` and `listNodeKinds()`, so one call reaches the
53
+ * palette, the node cards on the canvas, `FlowViewer`, and anything else that
54
+ * reads the registry. Returns an unsubscribe, matching `registerNodeKind`.
55
+ *
56
+ * Patching an unregistered id is allowed and takes effect if that kind is
57
+ * registered later — order of module side effects is not something a consumer
58
+ * should have to reason about.
59
+ */
60
+ declare function overrideNodeKind(name: string, patch: NodeKindPresentation): () => void;
61
+ /** Remove every presentation override. Mostly for tests. */
62
+ declare function clearNodeKindOverrides(): void;
23
63
  /** Get a single kind by canonical id or alias, or null. */
24
64
  declare function getNodeKind(name: string): NodeKindDefinition | null;
25
65
  /** Every id a kind answers to — canonical first. Used to key node-type maps. */
@@ -42,4 +82,4 @@ declare function validateConfig(kind: NodeKindDefinition, config: Record<string,
42
82
  /** Default accents per category. */
43
83
  declare function categoryAccent(category: string): string;
44
84
 
45
- export { resolveKindId as a, categoryAccent as c, defaultConfigFor as d, getNodeKind as g, kindIds as k, listNodeKinds as l, onNodeKindsChanged as o, registerNodeKind as r, validateConfig as v };
85
+ export { type NodeKindPresentation as N, resolveKindId as a, clearNodeKindOverrides as b, categoryAccent as c, defaultConfigFor as d, overrideNodeKind as e, getNodeKind as g, kindIds as k, listNodeKinds as l, onNodeKindsChanged as o, registerNodeKind as r, validateConfig as v };
@@ -1,5 +1,17 @@
1
1
  import { d as NodeKindDefinition } from './types-D6lsIGoe.js';
2
2
 
3
+ /**
4
+ * The presentation fields a consumer may override on someone else's node kind.
5
+ *
6
+ * Deliberately excludes everything behavioural — `executor`, `inputs`,
7
+ * `outputs`, `configSchema`, `sideEffects`. An "override" that could change
8
+ * those is not an override, it is a fork wearing a friendly name, and it would
9
+ * desync the graph from the runtime that executes it.
10
+ *
11
+ * `category` IS included: which drawer a node appears in is presentation, and a
12
+ * consumer regrouping their palette is the same kind of act as renaming.
13
+ */
14
+ type NodeKindPresentation = Partial<Pick<NodeKindDefinition, "label" | "description" | "icon" | "accent" | "category">>;
3
15
  /**
4
16
  * registerNodeKind — install a node kind in the global registry. Returns
5
17
  * an `unregister` function. Calling with the same name replaces the prior
@@ -20,6 +32,34 @@ declare function registerNodeKind<TC = any, TI = any, TO = any>(definition: Node
20
32
  * documents written before namespacing keep opening.
21
33
  */
22
34
  declare function resolveKindId(id: string): string | null;
35
+ /**
36
+ * Rename or re-describe a kind you did not author.
37
+ *
38
+ * Before this existed the only way to relabel a builtin was `registerNodeKind`
39
+ * with a full definition — which REPLACES the kind, so a consumer wanting
40
+ * "Call an API" instead of "HTTP Request" had to re-declare that node's
41
+ * configSchema, ports, executor and renderer, and silently forfeited whatever
42
+ * the builtin gained in the next release. In practice nobody renamed a node,
43
+ * and the palette could not be localised at all.
44
+ *
45
+ * ```ts
46
+ * const undo = overrideNodeKind("@particle-academy/http_request", {
47
+ * label: "Call an API",
48
+ * description: "Fetch or post JSON to a URL",
49
+ * });
50
+ * ```
51
+ *
52
+ * Applies at `getNodeKind()` and `listNodeKinds()`, so one call reaches the
53
+ * palette, the node cards on the canvas, `FlowViewer`, and anything else that
54
+ * reads the registry. Returns an unsubscribe, matching `registerNodeKind`.
55
+ *
56
+ * Patching an unregistered id is allowed and takes effect if that kind is
57
+ * registered later — order of module side effects is not something a consumer
58
+ * should have to reason about.
59
+ */
60
+ declare function overrideNodeKind(name: string, patch: NodeKindPresentation): () => void;
61
+ /** Remove every presentation override. Mostly for tests. */
62
+ declare function clearNodeKindOverrides(): void;
23
63
  /** Get a single kind by canonical id or alias, or null. */
24
64
  declare function getNodeKind(name: string): NodeKindDefinition | null;
25
65
  /** Every id a kind answers to — canonical first. Used to key node-type maps. */
@@ -42,4 +82,4 @@ declare function validateConfig(kind: NodeKindDefinition, config: Record<string,
42
82
  /** Default accents per category. */
43
83
  declare function categoryAccent(category: string): string;
44
84
 
45
- export { resolveKindId as a, categoryAccent as c, defaultConfigFor as d, getNodeKind as g, kindIds as k, listNodeKinds as l, onNodeKindsChanged as o, registerNodeKind as r, validateConfig as v };
85
+ export { type NodeKindPresentation as N, resolveKindId as a, clearNodeKindOverrides as b, categoryAccent as c, defaultConfigFor as d, overrideNodeKind as e, getNodeKind as g, kindIds as k, listNodeKinds as l, onNodeKindsChanged as o, registerNodeKind as r, validateConfig as v };
package/dist/registry.cjs CHANGED
@@ -35,6 +35,7 @@ function resolveNodePorts(node, kind) {
35
35
  var kinds = /* @__PURE__ */ new Map();
36
36
  var aliases = /* @__PURE__ */ new Map();
37
37
  var listeners = /* @__PURE__ */ new Set();
38
+ var overrides = /* @__PURE__ */ new Map();
38
39
  function registerNodeKind(definition) {
39
40
  kinds.set(definition.name, definition);
40
41
  for (const alias of definition.aliases ?? []) aliases.set(alias, definition.name);
@@ -54,15 +55,41 @@ function resolveKindId(id2) {
54
55
  const canonical = aliases.get(id2);
55
56
  return canonical && kinds.has(canonical) ? canonical : null;
56
57
  }
58
+ function overrideNodeKind(name, patch) {
59
+ const canonical = resolveKindId(name) ?? name;
60
+ const previous = overrides.get(canonical);
61
+ overrides.set(canonical, { ...previous, ...patch });
62
+ notify();
63
+ return () => {
64
+ if (previous) {
65
+ overrides.set(canonical, previous);
66
+ } else {
67
+ overrides.delete(canonical);
68
+ }
69
+ notify();
70
+ };
71
+ }
72
+ function clearNodeKindOverrides() {
73
+ if (overrides.size === 0) return;
74
+ overrides.clear();
75
+ notify();
76
+ }
77
+ function withOverride(kind) {
78
+ if (!kind) return null;
79
+ const patch = overrides.get(kind.name);
80
+ return patch ? { ...kind, ...patch } : kind;
81
+ }
57
82
  function getNodeKind(name) {
58
83
  const canonical = resolveKindId(name);
59
- return canonical ? kinds.get(canonical) ?? null : null;
84
+ return canonical ? withOverride(kinds.get(canonical)) : null;
60
85
  }
61
86
  function kindIds(kind) {
62
87
  return [kind.name, ...kind.aliases ?? []];
63
88
  }
64
89
  function listNodeKinds(category) {
65
- const all = Array.from(kinds.values());
90
+ const all = Array.from(kinds.values()).map(
91
+ (k) => withOverride(k)
92
+ );
66
93
  return category ? all.filter((k) => k.category === category) : all;
67
94
  }
68
95
  function onNodeKindsChanged(listener) {
@@ -10681,6 +10708,7 @@ exports.RichInputPreview = RichInputPreview;
10681
10708
  exports.buildNodeTypes = buildNodeTypes;
10682
10709
  exports.capabilityStatus = capabilityStatus;
10683
10710
  exports.categoryAccent = categoryAccent;
10711
+ exports.clearNodeKindOverrides = clearNodeKindOverrides;
10684
10712
  exports.createConnectionValidator = createConnectionValidator;
10685
10713
  exports.declaredRoutes = declaredRoutes;
10686
10714
  exports.decodePause = decodePause;
@@ -10701,6 +10729,7 @@ exports.llmRouterExecutor = llmRouterExecutor;
10701
10729
  exports.nodeConfig = nodeConfig;
10702
10730
  exports.onNodeKindsChanged = onNodeKindsChanged;
10703
10731
  exports.onRichInputAdapterChanged = onRichInputAdapterChanged;
10732
+ exports.overrideNodeKind = overrideNodeKind;
10704
10733
  exports.pauseForHuman = pauseForHuman;
10705
10734
  exports.registerBuiltinKinds = registerBuiltinKinds;
10706
10735
  exports.registerLlmClient = registerLlmClient;