@particle-academy/fancy-flow 0.51.1 → 0.53.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 (39) hide show
  1. package/dist/{chunk-4GO2CHAY.js → chunk-CIBW5ATA.js} +166 -25
  2. package/dist/chunk-CIBW5ATA.js.map +1 -0
  3. package/dist/{chunk-OK7KJLWA.js → chunk-FG3C7LIG.js} +3 -3
  4. package/dist/{chunk-OK7KJLWA.js.map → chunk-FG3C7LIG.js.map} +1 -1
  5. package/dist/{chunk-SPINP4EJ.js → chunk-FH6MWLKD.js} +3 -3
  6. package/dist/{chunk-SPINP4EJ.js.map → chunk-FH6MWLKD.js.map} +1 -1
  7. package/dist/{chunk-OECW2E5D.js → chunk-FTGVVKWX.js} +4 -4
  8. package/dist/{chunk-OECW2E5D.js.map → chunk-FTGVVKWX.js.map} +1 -1
  9. package/dist/{chunk-RSRXKZ52.js → chunk-VWANLNL5.js} +3 -3
  10. package/dist/{chunk-RSRXKZ52.js.map → chunk-VWANLNL5.js.map} +1 -1
  11. package/dist/{chunk-VUU3CDBT.js → chunk-WCFRKXH5.js} +3 -3
  12. package/dist/{chunk-VUU3CDBT.js.map → chunk-WCFRKXH5.js.map} +1 -1
  13. package/dist/durable.cjs +121 -22
  14. package/dist/durable.cjs.map +1 -1
  15. package/dist/durable.js +1 -1
  16. package/dist/engine.cjs +122 -23
  17. package/dist/engine.cjs.map +1 -1
  18. package/dist/engine.js +3 -3
  19. package/dist/index.cjs +236 -57
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.js +84 -46
  22. package/dist/index.js.map +1 -1
  23. package/dist/registry.cjs +121 -22
  24. package/dist/registry.cjs.map +1 -1
  25. package/dist/registry.js +2 -2
  26. package/dist/runtime.cjs +122 -23
  27. package/dist/runtime.cjs.map +1 -1
  28. package/dist/runtime.js +3 -3
  29. package/dist/schema.cjs +121 -22
  30. package/dist/schema.cjs.map +1 -1
  31. package/dist/schema.js +2 -2
  32. package/dist/screens.cjs +121 -22
  33. package/dist/screens.cjs.map +1 -1
  34. package/dist/screens.js +4 -4
  35. package/dist/ux.cjs +121 -22
  36. package/dist/ux.cjs.map +1 -1
  37. package/dist/ux.js +1 -1
  38. package/package.json +2 -2
  39. package/dist/chunk-4GO2CHAY.js.map +0 -1
package/dist/registry.cjs CHANGED
@@ -30,6 +30,59 @@ function resolveNodePorts(node, kind) {
30
30
  outputs: data?.outputs ?? resolvePortSpec(kind?.outputs, config)
31
31
  };
32
32
  }
33
+
34
+ // src/components/FlowEditor/human-fields.ts
35
+ var HUMAN_FIELD_TYPE_ALIASES = {
36
+ text: "text",
37
+ string: "text",
38
+ str: "text",
39
+ input: "text",
40
+ textarea: "textarea",
41
+ long_text: "textarea",
42
+ longtext: "textarea",
43
+ "long-text": "textarea",
44
+ multiline: "textarea",
45
+ paragraph: "textarea",
46
+ markdown: "textarea",
47
+ number: "number",
48
+ numeric: "number",
49
+ integer: "number",
50
+ int: "number",
51
+ float: "number",
52
+ decimal: "number",
53
+ select: "select",
54
+ enum: "select",
55
+ choice: "select",
56
+ choices: "select",
57
+ dropdown: "select",
58
+ options: "select",
59
+ radio: "select",
60
+ switch: "switch",
61
+ bool: "switch",
62
+ boolean: "switch",
63
+ checkbox: "switch",
64
+ toggle: "switch",
65
+ date: "date",
66
+ datetime: "datetime",
67
+ "datetime-local": "datetime",
68
+ datetimelocal: "datetime",
69
+ timestamp: "datetime",
70
+ time: "time",
71
+ email: "email",
72
+ "e-mail": "email",
73
+ url: "url",
74
+ uri: "url",
75
+ link: "url",
76
+ tel: "tel",
77
+ phone: "tel",
78
+ telephone: "tel",
79
+ password: "password",
80
+ secret: "password"
81
+ };
82
+ function humanFieldType(raw) {
83
+ if (typeof raw !== "string") return "text";
84
+ return HUMAN_FIELD_TYPE_ALIASES[raw.trim().toLowerCase()] ?? "text";
85
+ }
33
86
  var adapter = null;
34
87
  var listeners = /* @__PURE__ */ new Set();
35
88
  function registerRichInputAdapter(next) {
@@ -9490,7 +9543,7 @@ async function runFlow(graph, executors, onEvent = () => {
9490
9543
  const exec = pickExecutor(executors, node);
9491
9544
  if (!exec) {
9492
9545
  const tried = executorLookupIds(node);
9493
- const msg = `No executor registered for kind=${node.type} \u2014 tried ${tried.map((id2) => `"${id2}"`).join(", ")} and the wildcard "*". Key your registry by one of those.`;
9546
+ const msg = `No executor registered for kind=${node.type} \u2014 tried ${tried.map((id2) => `"${id2}"`).join(", ")}. Key your registry by one of those.`;
9494
9547
  errors.push(msg);
9495
9548
  onEvent({ type: "node-status", nodeId: node.id, status: "error", text: msg });
9496
9549
  onEvent({ type: "log", nodeId: node.id, level: "error", message: msg });
@@ -9586,30 +9639,28 @@ function collectInputs(node, incoming, portValues, initial, props, declaresProps
9586
9639
  function executorLookupIds(node) {
9587
9640
  const ids = [node.id];
9588
9641
  if (node.type) ids.push(node.type);
9589
- const declared = node.data?.kind;
9590
- const kindName = typeof declared === "string" && declared !== "" ? declared : node.type;
9591
- if (kindName && kindName !== node.type) ids.push(kindName);
9592
- for (const name of [kindName, node.type]) {
9593
- const kind = name ? getNodeKind(name) : null;
9594
- if (!kind) continue;
9595
- for (const id2 of kindIds(kind)) ids.push(id2);
9642
+ const typeKind = node.type ? getNodeKind(node.type) : null;
9643
+ if (typeKind) {
9644
+ for (const id2 of kindIds(typeKind)) ids.push(id2);
9645
+ } else {
9646
+ const declared = node.data?.kind;
9647
+ const kindName = typeof declared === "string" && declared !== "" ? declared : null;
9648
+ if (kindName) {
9649
+ ids.push(kindName);
9650
+ const dataKind = getNodeKind(kindName);
9651
+ if (dataKind) {
9652
+ for (const id2 of kindIds(dataKind)) ids.push(id2);
9653
+ }
9654
+ }
9596
9655
  }
9656
+ ids.push("*");
9597
9657
  return [...new Set(ids)];
9598
9658
  }
9599
9659
  function pickExecutor(executors, node) {
9600
- if (executors[node.id]) return executors[node.id];
9601
- if (node.type && executors[node.type]) return executors[node.type];
9602
- const declared = node.data?.kind;
9603
- const kindName = typeof declared === "string" && declared !== "" ? declared : node.type;
9604
- if (kindName && kindName !== node.type && executors[kindName]) return executors[kindName];
9605
- for (const name of [kindName, node.type]) {
9606
- const kind = name ? getNodeKind(name) : null;
9607
- if (!kind) continue;
9608
- for (const id2 of kindIds(kind)) {
9609
- if (executors[id2]) return executors[id2];
9610
- }
9660
+ for (const id2 of executorLookupIds(node)) {
9661
+ if (executors[id2]) return executors[id2];
9611
9662
  }
9612
- return executors["*"];
9663
+ return void 0;
9613
9664
  }
9614
9665
  function activatedPorts(node, result) {
9615
9666
  if (result && typeof result === "object") {
@@ -9720,6 +9771,20 @@ var subflowExecutor = async (ctx) => {
9720
9771
  };
9721
9772
 
9722
9773
  // src/registry/builtin.ts
9774
+ var HUMAN_FIELD_OUTPUT_TYPE = {
9775
+ text: "string",
9776
+ textarea: "string",
9777
+ select: "string",
9778
+ date: "string",
9779
+ datetime: "string",
9780
+ time: "string",
9781
+ email: "string",
9782
+ url: "string",
9783
+ tel: "string",
9784
+ password: "string",
9785
+ number: "number",
9786
+ switch: "boolean"
9787
+ };
9723
9788
  function casePorts(cases) {
9724
9789
  const byPort = /* @__PURE__ */ new Map();
9725
9790
  if (cases && typeof cases === "object" && !Array.isArray(cases)) {
@@ -9817,7 +9882,17 @@ var KINDS = [
9817
9882
  name: "@particle-academy/user_input",
9818
9883
  // The keys an author declared on THIS node — the case a static list cannot
9819
9884
  // express, and the one issue #5 named.
9820
- outputShape: (config) => (config.fields ?? []).filter((f) => typeof f.key === "string" && f.key !== "").map((f) => ({ path: f.key, type: "string", description: f.label })),
9885
+ //
9886
+ // The TYPE comes from the same normalizer the form renders with, so the
9887
+ // variable picker agrees with what the run actually resolves. It used to say
9888
+ // `string` for every field, which was wrong the moment a field was a number
9889
+ // or a switch — the picker told an author `{{ $json.age }}` was text while
9890
+ // the form handed the next node a number.
9891
+ outputShape: (config) => (config.fields ?? []).filter((f) => typeof f.key === "string" && f.key !== "").map((f) => ({
9892
+ path: f.key,
9893
+ type: HUMAN_FIELD_OUTPUT_TYPE[humanFieldType(f.type)],
9894
+ description: f.label
9895
+ })),
9821
9896
  aliases: ["user_input", "@fancy/user_input"],
9822
9897
  pausesForHuman: "input",
9823
9898
  category: "human",
@@ -9844,14 +9919,38 @@ var KINDS = [
9844
9919
  key: "type",
9845
9920
  label: "Type",
9846
9921
  default: "text",
9922
+ // Every control `HumanPrompt` can render. A type the form supports
9923
+ // but the panel cannot select is reachable only by hand-editing the
9924
+ // workflow JSON — which is the audience this panel exists for.
9847
9925
  options: [
9848
9926
  { value: "text", label: "Text" },
9849
9927
  { value: "textarea", label: "Long text" },
9850
9928
  { value: "number", label: "Number" },
9851
9929
  { value: "select", label: "Select" },
9852
- { value: "switch", label: "Switch" }
9930
+ { value: "switch", label: "Switch (yes / no)" },
9931
+ { value: "date", label: "Date" },
9932
+ { value: "datetime", label: "Date + time" },
9933
+ { value: "time", label: "Time" },
9934
+ { value: "email", label: "Email" },
9935
+ { value: "url", label: "URL" },
9936
+ { value: "tel", label: "Phone" },
9937
+ { value: "password", label: "Password" }
9853
9938
  ]
9854
9939
  },
9940
+ {
9941
+ // Without this a panel-authored select had nothing to choose from,
9942
+ // so it rendered an empty dropdown — the type was declarable and
9943
+ // unusable in the same breath.
9944
+ type: "keyvalue",
9945
+ key: "options",
9946
+ label: "Choices",
9947
+ description: "Select fields only. Left is the value the flow receives, right is what the person sees.",
9948
+ keyLabel: "Value",
9949
+ valueLabel: "Label",
9950
+ keyPlaceholder: "small",
9951
+ valuePlaceholder: "Small",
9952
+ addLabel: "Add choice"
9953
+ },
9855
9954
  { type: "switch", key: "required", label: "Required", default: false }
9856
9955
  ],
9857
9956
  default: [{ key: "answer", label: "Your answer", type: "textarea", required: true }]