@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/durable.cjs CHANGED
@@ -112,6 +112,59 @@ var InMemoryClaimStore = class {
112
112
  function isSettled(status) {
113
113
  return status !== void 0 && SETTLED.includes(status);
114
114
  }
115
+
116
+ // src/components/FlowEditor/human-fields.ts
117
+ var HUMAN_FIELD_TYPE_ALIASES = {
118
+ text: "text",
119
+ string: "text",
120
+ str: "text",
121
+ input: "text",
122
+ textarea: "textarea",
123
+ long_text: "textarea",
124
+ longtext: "textarea",
125
+ "long-text": "textarea",
126
+ multiline: "textarea",
127
+ paragraph: "textarea",
128
+ markdown: "textarea",
129
+ number: "number",
130
+ numeric: "number",
131
+ integer: "number",
132
+ int: "number",
133
+ float: "number",
134
+ decimal: "number",
135
+ select: "select",
136
+ enum: "select",
137
+ choice: "select",
138
+ choices: "select",
139
+ dropdown: "select",
140
+ options: "select",
141
+ radio: "select",
142
+ switch: "switch",
143
+ bool: "switch",
144
+ boolean: "switch",
145
+ checkbox: "switch",
146
+ toggle: "switch",
147
+ date: "date",
148
+ datetime: "datetime",
149
+ "datetime-local": "datetime",
150
+ datetimelocal: "datetime",
151
+ timestamp: "datetime",
152
+ time: "time",
153
+ email: "email",
154
+ "e-mail": "email",
155
+ url: "url",
156
+ uri: "url",
157
+ link: "url",
158
+ tel: "tel",
159
+ phone: "tel",
160
+ telephone: "tel",
161
+ password: "password",
162
+ secret: "password"
163
+ };
164
+ function humanFieldType(raw) {
165
+ if (typeof raw !== "string") return "text";
166
+ return HUMAN_FIELD_TYPE_ALIASES[raw.trim().toLowerCase()] ?? "text";
167
+ }
115
168
  function RichInputPreview({ config }) {
116
169
  const title = typeof config.title === "string" && config.title.trim() !== "" ? config.title : "Untitled step";
117
170
  config.document;
@@ -9451,7 +9504,7 @@ async function runFlow(graph, executors, onEvent = () => {
9451
9504
  const exec = pickExecutor(executors, node);
9452
9505
  if (!exec) {
9453
9506
  const tried = executorLookupIds(node);
9454
- 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.`;
9507
+ const msg = `No executor registered for kind=${node.type} \u2014 tried ${tried.map((id2) => `"${id2}"`).join(", ")}. Key your registry by one of those.`;
9455
9508
  errors.push(msg);
9456
9509
  onEvent({ type: "node-status", nodeId: node.id, status: "error", text: msg });
9457
9510
  onEvent({ type: "log", nodeId: node.id, level: "error", message: msg });
@@ -9547,30 +9600,28 @@ function collectInputs(node, incoming, portValues, initial, props, declaresProps
9547
9600
  function executorLookupIds(node) {
9548
9601
  const ids = [node.id];
9549
9602
  if (node.type) ids.push(node.type);
9550
- const declared = node.data?.kind;
9551
- const kindName = typeof declared === "string" && declared !== "" ? declared : node.type;
9552
- if (kindName && kindName !== node.type) ids.push(kindName);
9553
- for (const name of [kindName, node.type]) {
9554
- const kind = name ? getNodeKind(name) : null;
9555
- if (!kind) continue;
9556
- for (const id2 of kindIds(kind)) ids.push(id2);
9603
+ const typeKind = node.type ? getNodeKind(node.type) : null;
9604
+ if (typeKind) {
9605
+ for (const id2 of kindIds(typeKind)) ids.push(id2);
9606
+ } else {
9607
+ const declared = node.data?.kind;
9608
+ const kindName = typeof declared === "string" && declared !== "" ? declared : null;
9609
+ if (kindName) {
9610
+ ids.push(kindName);
9611
+ const dataKind = getNodeKind(kindName);
9612
+ if (dataKind) {
9613
+ for (const id2 of kindIds(dataKind)) ids.push(id2);
9614
+ }
9615
+ }
9557
9616
  }
9617
+ ids.push("*");
9558
9618
  return [...new Set(ids)];
9559
9619
  }
9560
9620
  function pickExecutor(executors, node) {
9561
- if (executors[node.id]) return executors[node.id];
9562
- if (node.type && executors[node.type]) return executors[node.type];
9563
- const declared = node.data?.kind;
9564
- const kindName = typeof declared === "string" && declared !== "" ? declared : node.type;
9565
- if (kindName && kindName !== node.type && executors[kindName]) return executors[kindName];
9566
- for (const name of [kindName, node.type]) {
9567
- const kind = name ? getNodeKind(name) : null;
9568
- if (!kind) continue;
9569
- for (const id2 of kindIds(kind)) {
9570
- if (executors[id2]) return executors[id2];
9571
- }
9621
+ for (const id2 of executorLookupIds(node)) {
9622
+ if (executors[id2]) return executors[id2];
9572
9623
  }
9573
- return executors["*"];
9624
+ return void 0;
9574
9625
  }
9575
9626
  function activatedPorts(node, result) {
9576
9627
  if (result && typeof result === "object") {
@@ -9681,6 +9732,20 @@ var subflowExecutor = async (ctx) => {
9681
9732
  };
9682
9733
 
9683
9734
  // src/registry/builtin.ts
9735
+ var HUMAN_FIELD_OUTPUT_TYPE = {
9736
+ text: "string",
9737
+ textarea: "string",
9738
+ select: "string",
9739
+ date: "string",
9740
+ datetime: "string",
9741
+ time: "string",
9742
+ email: "string",
9743
+ url: "string",
9744
+ tel: "string",
9745
+ password: "string",
9746
+ number: "number",
9747
+ switch: "boolean"
9748
+ };
9684
9749
  function casePorts(cases) {
9685
9750
  const byPort = /* @__PURE__ */ new Map();
9686
9751
  if (cases && typeof cases === "object" && !Array.isArray(cases)) {
@@ -9778,7 +9843,17 @@ var KINDS = [
9778
9843
  name: "@particle-academy/user_input",
9779
9844
  // The keys an author declared on THIS node — the case a static list cannot
9780
9845
  // express, and the one issue #5 named.
9781
- outputShape: (config) => (config.fields ?? []).filter((f) => typeof f.key === "string" && f.key !== "").map((f) => ({ path: f.key, type: "string", description: f.label })),
9846
+ //
9847
+ // The TYPE comes from the same normalizer the form renders with, so the
9848
+ // variable picker agrees with what the run actually resolves. It used to say
9849
+ // `string` for every field, which was wrong the moment a field was a number
9850
+ // or a switch — the picker told an author `{{ $json.age }}` was text while
9851
+ // the form handed the next node a number.
9852
+ outputShape: (config) => (config.fields ?? []).filter((f) => typeof f.key === "string" && f.key !== "").map((f) => ({
9853
+ path: f.key,
9854
+ type: HUMAN_FIELD_OUTPUT_TYPE[humanFieldType(f.type)],
9855
+ description: f.label
9856
+ })),
9782
9857
  aliases: ["user_input", "@fancy/user_input"],
9783
9858
  pausesForHuman: "input",
9784
9859
  category: "human",
@@ -9805,14 +9880,38 @@ var KINDS = [
9805
9880
  key: "type",
9806
9881
  label: "Type",
9807
9882
  default: "text",
9883
+ // Every control `HumanPrompt` can render. A type the form supports
9884
+ // but the panel cannot select is reachable only by hand-editing the
9885
+ // workflow JSON — which is the audience this panel exists for.
9808
9886
  options: [
9809
9887
  { value: "text", label: "Text" },
9810
9888
  { value: "textarea", label: "Long text" },
9811
9889
  { value: "number", label: "Number" },
9812
9890
  { value: "select", label: "Select" },
9813
- { value: "switch", label: "Switch" }
9891
+ { value: "switch", label: "Switch (yes / no)" },
9892
+ { value: "date", label: "Date" },
9893
+ { value: "datetime", label: "Date + time" },
9894
+ { value: "time", label: "Time" },
9895
+ { value: "email", label: "Email" },
9896
+ { value: "url", label: "URL" },
9897
+ { value: "tel", label: "Phone" },
9898
+ { value: "password", label: "Password" }
9814
9899
  ]
9815
9900
  },
9901
+ {
9902
+ // Without this a panel-authored select had nothing to choose from,
9903
+ // so it rendered an empty dropdown — the type was declarable and
9904
+ // unusable in the same breath.
9905
+ type: "keyvalue",
9906
+ key: "options",
9907
+ label: "Choices",
9908
+ description: "Select fields only. Left is the value the flow receives, right is what the person sees.",
9909
+ keyLabel: "Value",
9910
+ valueLabel: "Label",
9911
+ keyPlaceholder: "small",
9912
+ valuePlaceholder: "Small",
9913
+ addLabel: "Add choice"
9914
+ },
9816
9915
  { type: "switch", key: "required", label: "Required", default: false }
9817
9916
  ],
9818
9917
  default: [{ key: "answer", label: "Your answer", type: "textarea", required: true }]