@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/schema.js CHANGED
@@ -1,5 +1,5 @@
1
- export { WORKFLOW_SCHEMA_URL, WORKFLOW_SCHEMA_VERSION, exportWorkflow, importWorkflow, migrateSchema, workflowToBlob } from './chunk-SPINP4EJ.js';
2
- import './chunk-4GO2CHAY.js';
1
+ export { WORKFLOW_SCHEMA_URL, WORKFLOW_SCHEMA_VERSION, exportWorkflow, importWorkflow, migrateSchema, workflowToBlob } from './chunk-FH6MWLKD.js';
2
+ import './chunk-CIBW5ATA.js';
3
3
  import './chunk-F5RPRB7A.js';
4
4
  import './chunk-USL4FMFU.js';
5
5
  //# sourceMappingURL=schema.js.map
package/dist/screens.cjs CHANGED
@@ -9196,6 +9196,59 @@ function SubgraphNodeInner(props) {
9196
9196
  ] }) });
9197
9197
  }
9198
9198
  var SubgraphNode = ReactExports.memo(SubgraphNodeInner);
9199
+
9200
+ // src/components/FlowEditor/human-fields.ts
9201
+ var HUMAN_FIELD_TYPE_ALIASES = {
9202
+ text: "text",
9203
+ string: "text",
9204
+ str: "text",
9205
+ input: "text",
9206
+ textarea: "textarea",
9207
+ long_text: "textarea",
9208
+ longtext: "textarea",
9209
+ "long-text": "textarea",
9210
+ multiline: "textarea",
9211
+ paragraph: "textarea",
9212
+ markdown: "textarea",
9213
+ number: "number",
9214
+ numeric: "number",
9215
+ integer: "number",
9216
+ int: "number",
9217
+ float: "number",
9218
+ decimal: "number",
9219
+ select: "select",
9220
+ enum: "select",
9221
+ choice: "select",
9222
+ choices: "select",
9223
+ dropdown: "select",
9224
+ options: "select",
9225
+ radio: "select",
9226
+ switch: "switch",
9227
+ bool: "switch",
9228
+ boolean: "switch",
9229
+ checkbox: "switch",
9230
+ toggle: "switch",
9231
+ date: "date",
9232
+ datetime: "datetime",
9233
+ "datetime-local": "datetime",
9234
+ datetimelocal: "datetime",
9235
+ timestamp: "datetime",
9236
+ time: "time",
9237
+ email: "email",
9238
+ "e-mail": "email",
9239
+ url: "url",
9240
+ uri: "url",
9241
+ link: "url",
9242
+ tel: "tel",
9243
+ phone: "tel",
9244
+ telephone: "tel",
9245
+ password: "password",
9246
+ secret: "password"
9247
+ };
9248
+ function humanFieldType(raw) {
9249
+ if (typeof raw !== "string") return "text";
9250
+ return HUMAN_FIELD_TYPE_ALIASES[raw.trim().toLowerCase()] ?? "text";
9251
+ }
9199
9252
  function RichInputPreview({ config }) {
9200
9253
  const title = typeof config.title === "string" && config.title.trim() !== "" ? config.title : "Untitled step";
9201
9254
  config.document;
@@ -9533,7 +9586,7 @@ async function runFlow(graph, executors, onEvent = () => {
9533
9586
  const exec = pickExecutor(executors, node);
9534
9587
  if (!exec) {
9535
9588
  const tried = executorLookupIds(node);
9536
- 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.`;
9589
+ const msg = `No executor registered for kind=${node.type} \u2014 tried ${tried.map((id2) => `"${id2}"`).join(", ")}. Key your registry by one of those.`;
9537
9590
  errors.push(msg);
9538
9591
  onEvent({ type: "node-status", nodeId: node.id, status: "error", text: msg });
9539
9592
  onEvent({ type: "log", nodeId: node.id, level: "error", message: msg });
@@ -9629,30 +9682,28 @@ function collectInputs(node, incoming, portValues, initial, props, declaresProps
9629
9682
  function executorLookupIds(node) {
9630
9683
  const ids = [node.id];
9631
9684
  if (node.type) ids.push(node.type);
9632
- const declared = node.data?.kind;
9633
- const kindName = typeof declared === "string" && declared !== "" ? declared : node.type;
9634
- if (kindName && kindName !== node.type) ids.push(kindName);
9635
- for (const name of [kindName, node.type]) {
9636
- const kind = name ? getNodeKind(name) : null;
9637
- if (!kind) continue;
9638
- for (const id2 of kindIds(kind)) ids.push(id2);
9685
+ const typeKind = node.type ? getNodeKind(node.type) : null;
9686
+ if (typeKind) {
9687
+ for (const id2 of kindIds(typeKind)) ids.push(id2);
9688
+ } else {
9689
+ const declared = node.data?.kind;
9690
+ const kindName = typeof declared === "string" && declared !== "" ? declared : null;
9691
+ if (kindName) {
9692
+ ids.push(kindName);
9693
+ const dataKind = getNodeKind(kindName);
9694
+ if (dataKind) {
9695
+ for (const id2 of kindIds(dataKind)) ids.push(id2);
9696
+ }
9697
+ }
9639
9698
  }
9699
+ ids.push("*");
9640
9700
  return [...new Set(ids)];
9641
9701
  }
9642
9702
  function pickExecutor(executors, node) {
9643
- if (executors[node.id]) return executors[node.id];
9644
- if (node.type && executors[node.type]) return executors[node.type];
9645
- const declared = node.data?.kind;
9646
- const kindName = typeof declared === "string" && declared !== "" ? declared : node.type;
9647
- if (kindName && kindName !== node.type && executors[kindName]) return executors[kindName];
9648
- for (const name of [kindName, node.type]) {
9649
- const kind = name ? getNodeKind(name) : null;
9650
- if (!kind) continue;
9651
- for (const id2 of kindIds(kind)) {
9652
- if (executors[id2]) return executors[id2];
9653
- }
9703
+ for (const id2 of executorLookupIds(node)) {
9704
+ if (executors[id2]) return executors[id2];
9654
9705
  }
9655
- return executors["*"];
9706
+ return void 0;
9656
9707
  }
9657
9708
  function activatedPorts(node, result) {
9658
9709
  if (result && typeof result === "object") {
@@ -9763,6 +9814,20 @@ var subflowExecutor = async (ctx) => {
9763
9814
  };
9764
9815
 
9765
9816
  // src/registry/builtin.ts
9817
+ var HUMAN_FIELD_OUTPUT_TYPE = {
9818
+ text: "string",
9819
+ textarea: "string",
9820
+ select: "string",
9821
+ date: "string",
9822
+ datetime: "string",
9823
+ time: "string",
9824
+ email: "string",
9825
+ url: "string",
9826
+ tel: "string",
9827
+ password: "string",
9828
+ number: "number",
9829
+ switch: "boolean"
9830
+ };
9766
9831
  function casePorts(cases) {
9767
9832
  const byPort = /* @__PURE__ */ new Map();
9768
9833
  if (cases && typeof cases === "object" && !Array.isArray(cases)) {
@@ -9860,7 +9925,17 @@ var KINDS = [
9860
9925
  name: "@particle-academy/user_input",
9861
9926
  // The keys an author declared on THIS node — the case a static list cannot
9862
9927
  // express, and the one issue #5 named.
9863
- outputShape: (config) => (config.fields ?? []).filter((f) => typeof f.key === "string" && f.key !== "").map((f) => ({ path: f.key, type: "string", description: f.label })),
9928
+ //
9929
+ // The TYPE comes from the same normalizer the form renders with, so the
9930
+ // variable picker agrees with what the run actually resolves. It used to say
9931
+ // `string` for every field, which was wrong the moment a field was a number
9932
+ // or a switch — the picker told an author `{{ $json.age }}` was text while
9933
+ // the form handed the next node a number.
9934
+ outputShape: (config) => (config.fields ?? []).filter((f) => typeof f.key === "string" && f.key !== "").map((f) => ({
9935
+ path: f.key,
9936
+ type: HUMAN_FIELD_OUTPUT_TYPE[humanFieldType(f.type)],
9937
+ description: f.label
9938
+ })),
9864
9939
  aliases: ["user_input", "@fancy/user_input"],
9865
9940
  pausesForHuman: "input",
9866
9941
  category: "human",
@@ -9887,14 +9962,38 @@ var KINDS = [
9887
9962
  key: "type",
9888
9963
  label: "Type",
9889
9964
  default: "text",
9965
+ // Every control `HumanPrompt` can render. A type the form supports
9966
+ // but the panel cannot select is reachable only by hand-editing the
9967
+ // workflow JSON — which is the audience this panel exists for.
9890
9968
  options: [
9891
9969
  { value: "text", label: "Text" },
9892
9970
  { value: "textarea", label: "Long text" },
9893
9971
  { value: "number", label: "Number" },
9894
9972
  { value: "select", label: "Select" },
9895
- { value: "switch", label: "Switch" }
9973
+ { value: "switch", label: "Switch (yes / no)" },
9974
+ { value: "date", label: "Date" },
9975
+ { value: "datetime", label: "Date + time" },
9976
+ { value: "time", label: "Time" },
9977
+ { value: "email", label: "Email" },
9978
+ { value: "url", label: "URL" },
9979
+ { value: "tel", label: "Phone" },
9980
+ { value: "password", label: "Password" }
9896
9981
  ]
9897
9982
  },
9983
+ {
9984
+ // Without this a panel-authored select had nothing to choose from,
9985
+ // so it rendered an empty dropdown — the type was declarable and
9986
+ // unusable in the same breath.
9987
+ type: "keyvalue",
9988
+ key: "options",
9989
+ label: "Choices",
9990
+ description: "Select fields only. Left is the value the flow receives, right is what the person sees.",
9991
+ keyLabel: "Value",
9992
+ valueLabel: "Label",
9993
+ keyPlaceholder: "small",
9994
+ valuePlaceholder: "Small",
9995
+ addLabel: "Add choice"
9996
+ },
9898
9997
  { type: "switch", key: "required", label: "Required", default: false }
9899
9998
  ],
9900
9999
  default: [{ key: "answer", label: "Your answer", type: "textarea", required: true }]