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