@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/runtime.js CHANGED
@@ -1,6 +1,6 @@
1
- export { applyOutputsToNodes, applyStatusesToNodes, createHistory, useFlowHistory, useFlowRun, useFlowState } from './chunk-OK7KJLWA.js';
2
- export { runCohort } from './chunk-VUU3CDBT.js';
3
- export { RunIdentity, escapeSegment, runFlow } from './chunk-4GO2CHAY.js';
1
+ export { applyOutputsToNodes, applyStatusesToNodes, createHistory, useFlowHistory, useFlowRun, useFlowState } from './chunk-FG3C7LIG.js';
2
+ export { runCohort } from './chunk-WCFRKXH5.js';
3
+ export { RunIdentity, escapeSegment, runFlow } from './chunk-CIBW5ATA.js';
4
4
  import './chunk-F5RPRB7A.js';
5
5
  import './chunk-USL4FMFU.js';
6
6
  //# sourceMappingURL=runtime.js.map
package/dist/schema.cjs CHANGED
@@ -9,6 +9,59 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
9
  var ReactExports__default = /*#__PURE__*/_interopDefault(ReactExports);
10
10
 
11
11
  // src/registry/builtin.ts
12
+
13
+ // src/components/FlowEditor/human-fields.ts
14
+ var HUMAN_FIELD_TYPE_ALIASES = {
15
+ text: "text",
16
+ string: "text",
17
+ str: "text",
18
+ input: "text",
19
+ textarea: "textarea",
20
+ long_text: "textarea",
21
+ longtext: "textarea",
22
+ "long-text": "textarea",
23
+ multiline: "textarea",
24
+ paragraph: "textarea",
25
+ markdown: "textarea",
26
+ number: "number",
27
+ numeric: "number",
28
+ integer: "number",
29
+ int: "number",
30
+ float: "number",
31
+ decimal: "number",
32
+ select: "select",
33
+ enum: "select",
34
+ choice: "select",
35
+ choices: "select",
36
+ dropdown: "select",
37
+ options: "select",
38
+ radio: "select",
39
+ switch: "switch",
40
+ bool: "switch",
41
+ boolean: "switch",
42
+ checkbox: "switch",
43
+ toggle: "switch",
44
+ date: "date",
45
+ datetime: "datetime",
46
+ "datetime-local": "datetime",
47
+ datetimelocal: "datetime",
48
+ timestamp: "datetime",
49
+ time: "time",
50
+ email: "email",
51
+ "e-mail": "email",
52
+ url: "url",
53
+ uri: "url",
54
+ link: "url",
55
+ tel: "tel",
56
+ phone: "tel",
57
+ telephone: "tel",
58
+ password: "password",
59
+ secret: "password"
60
+ };
61
+ function humanFieldType(raw) {
62
+ if (typeof raw !== "string") return "text";
63
+ return HUMAN_FIELD_TYPE_ALIASES[raw.trim().toLowerCase()] ?? "text";
64
+ }
12
65
  function RichInputPreview({ config }) {
13
66
  const title = typeof config.title === "string" && config.title.trim() !== "" ? config.title : "Untitled step";
14
67
  config.document;
@@ -9348,7 +9401,7 @@ async function runFlow(graph, executors, onEvent = () => {
9348
9401
  const exec = pickExecutor(executors, node);
9349
9402
  if (!exec) {
9350
9403
  const tried = executorLookupIds(node);
9351
- 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.`;
9404
+ const msg = `No executor registered for kind=${node.type} \u2014 tried ${tried.map((id2) => `"${id2}"`).join(", ")}. Key your registry by one of those.`;
9352
9405
  errors.push(msg);
9353
9406
  onEvent({ type: "node-status", nodeId: node.id, status: "error", text: msg });
9354
9407
  onEvent({ type: "log", nodeId: node.id, level: "error", message: msg });
@@ -9444,30 +9497,28 @@ function collectInputs(node, incoming, portValues, initial, props, declaresProps
9444
9497
  function executorLookupIds(node) {
9445
9498
  const ids = [node.id];
9446
9499
  if (node.type) ids.push(node.type);
9447
- const declared = node.data?.kind;
9448
- const kindName = typeof declared === "string" && declared !== "" ? declared : node.type;
9449
- if (kindName && kindName !== node.type) ids.push(kindName);
9450
- for (const name of [kindName, node.type]) {
9451
- const kind = name ? getNodeKind(name) : null;
9452
- if (!kind) continue;
9453
- for (const id2 of kindIds(kind)) ids.push(id2);
9500
+ const typeKind = node.type ? getNodeKind(node.type) : null;
9501
+ if (typeKind) {
9502
+ for (const id2 of kindIds(typeKind)) ids.push(id2);
9503
+ } else {
9504
+ const declared = node.data?.kind;
9505
+ const kindName = typeof declared === "string" && declared !== "" ? declared : null;
9506
+ if (kindName) {
9507
+ ids.push(kindName);
9508
+ const dataKind = getNodeKind(kindName);
9509
+ if (dataKind) {
9510
+ for (const id2 of kindIds(dataKind)) ids.push(id2);
9511
+ }
9512
+ }
9454
9513
  }
9514
+ ids.push("*");
9455
9515
  return [...new Set(ids)];
9456
9516
  }
9457
9517
  function pickExecutor(executors, node) {
9458
- if (executors[node.id]) return executors[node.id];
9459
- if (node.type && executors[node.type]) return executors[node.type];
9460
- const declared = node.data?.kind;
9461
- const kindName = typeof declared === "string" && declared !== "" ? declared : node.type;
9462
- if (kindName && kindName !== node.type && executors[kindName]) return executors[kindName];
9463
- for (const name of [kindName, node.type]) {
9464
- const kind = name ? getNodeKind(name) : null;
9465
- if (!kind) continue;
9466
- for (const id2 of kindIds(kind)) {
9467
- if (executors[id2]) return executors[id2];
9468
- }
9518
+ for (const id2 of executorLookupIds(node)) {
9519
+ if (executors[id2]) return executors[id2];
9469
9520
  }
9470
- return executors["*"];
9521
+ return void 0;
9471
9522
  }
9472
9523
  function activatedPorts(node, result) {
9473
9524
  if (result && typeof result === "object") {
@@ -9578,6 +9629,20 @@ var subflowExecutor = async (ctx) => {
9578
9629
  };
9579
9630
 
9580
9631
  // src/registry/builtin.ts
9632
+ var HUMAN_FIELD_OUTPUT_TYPE = {
9633
+ text: "string",
9634
+ textarea: "string",
9635
+ select: "string",
9636
+ date: "string",
9637
+ datetime: "string",
9638
+ time: "string",
9639
+ email: "string",
9640
+ url: "string",
9641
+ tel: "string",
9642
+ password: "string",
9643
+ number: "number",
9644
+ switch: "boolean"
9645
+ };
9581
9646
  function casePorts(cases) {
9582
9647
  const byPort = /* @__PURE__ */ new Map();
9583
9648
  if (cases && typeof cases === "object" && !Array.isArray(cases)) {
@@ -9675,7 +9740,17 @@ var KINDS = [
9675
9740
  name: "@particle-academy/user_input",
9676
9741
  // The keys an author declared on THIS node — the case a static list cannot
9677
9742
  // express, and the one issue #5 named.
9678
- outputShape: (config) => (config.fields ?? []).filter((f) => typeof f.key === "string" && f.key !== "").map((f) => ({ path: f.key, type: "string", description: f.label })),
9743
+ //
9744
+ // The TYPE comes from the same normalizer the form renders with, so the
9745
+ // variable picker agrees with what the run actually resolves. It used to say
9746
+ // `string` for every field, which was wrong the moment a field was a number
9747
+ // or a switch — the picker told an author `{{ $json.age }}` was text while
9748
+ // the form handed the next node a number.
9749
+ outputShape: (config) => (config.fields ?? []).filter((f) => typeof f.key === "string" && f.key !== "").map((f) => ({
9750
+ path: f.key,
9751
+ type: HUMAN_FIELD_OUTPUT_TYPE[humanFieldType(f.type)],
9752
+ description: f.label
9753
+ })),
9679
9754
  aliases: ["user_input", "@fancy/user_input"],
9680
9755
  pausesForHuman: "input",
9681
9756
  category: "human",
@@ -9702,14 +9777,38 @@ var KINDS = [
9702
9777
  key: "type",
9703
9778
  label: "Type",
9704
9779
  default: "text",
9780
+ // Every control `HumanPrompt` can render. A type the form supports
9781
+ // but the panel cannot select is reachable only by hand-editing the
9782
+ // workflow JSON — which is the audience this panel exists for.
9705
9783
  options: [
9706
9784
  { value: "text", label: "Text" },
9707
9785
  { value: "textarea", label: "Long text" },
9708
9786
  { value: "number", label: "Number" },
9709
9787
  { value: "select", label: "Select" },
9710
- { value: "switch", label: "Switch" }
9788
+ { value: "switch", label: "Switch (yes / no)" },
9789
+ { value: "date", label: "Date" },
9790
+ { value: "datetime", label: "Date + time" },
9791
+ { value: "time", label: "Time" },
9792
+ { value: "email", label: "Email" },
9793
+ { value: "url", label: "URL" },
9794
+ { value: "tel", label: "Phone" },
9795
+ { value: "password", label: "Password" }
9711
9796
  ]
9712
9797
  },
9798
+ {
9799
+ // Without this a panel-authored select had nothing to choose from,
9800
+ // so it rendered an empty dropdown — the type was declarable and
9801
+ // unusable in the same breath.
9802
+ type: "keyvalue",
9803
+ key: "options",
9804
+ label: "Choices",
9805
+ description: "Select fields only. Left is the value the flow receives, right is what the person sees.",
9806
+ keyLabel: "Value",
9807
+ valueLabel: "Label",
9808
+ keyPlaceholder: "small",
9809
+ valuePlaceholder: "Small",
9810
+ addLabel: "Add choice"
9811
+ },
9713
9812
  { type: "switch", key: "required", label: "Required", default: false }
9714
9813
  ],
9715
9814
  default: [{ key: "answer", label: "Your answer", type: "textarea", required: true }]