@particle-academy/fancy-flow 0.52.0 → 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-JOXMAWAI.js → chunk-CIBW5ATA.js} +148 -5
  2. package/dist/chunk-CIBW5ATA.js.map +1 -0
  3. package/dist/{chunk-PEX3ZGCO.js → chunk-FG3C7LIG.js} +3 -3
  4. package/dist/{chunk-PEX3ZGCO.js.map → chunk-FG3C7LIG.js.map} +1 -1
  5. package/dist/{chunk-PU3CLTAG.js → chunk-FH6MWLKD.js} +3 -3
  6. package/dist/{chunk-PU3CLTAG.js.map → chunk-FH6MWLKD.js.map} +1 -1
  7. package/dist/{chunk-PWIHOR57.js → chunk-FTGVVKWX.js} +4 -4
  8. package/dist/{chunk-PWIHOR57.js.map → chunk-FTGVVKWX.js.map} +1 -1
  9. package/dist/{chunk-I7ZDPY7C.js → chunk-VWANLNL5.js} +3 -3
  10. package/dist/{chunk-I7ZDPY7C.js.map → chunk-VWANLNL5.js.map} +1 -1
  11. package/dist/{chunk-RR7A6IUW.js → chunk-WCFRKXH5.js} +3 -3
  12. package/dist/{chunk-RR7A6IUW.js.map → chunk-WCFRKXH5.js.map} +1 -1
  13. package/dist/durable.cjs +103 -2
  14. package/dist/durable.cjs.map +1 -1
  15. package/dist/durable.js +1 -1
  16. package/dist/engine.cjs +103 -2
  17. package/dist/engine.cjs.map +1 -1
  18. package/dist/engine.js +3 -3
  19. package/dist/index.cjs +218 -37
  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 +103 -2
  24. package/dist/registry.cjs.map +1 -1
  25. package/dist/registry.js +2 -2
  26. package/dist/runtime.cjs +103 -2
  27. package/dist/runtime.cjs.map +1 -1
  28. package/dist/runtime.js +3 -3
  29. package/dist/schema.cjs +103 -2
  30. package/dist/schema.cjs.map +1 -1
  31. package/dist/schema.js +2 -2
  32. package/dist/screens.cjs +103 -2
  33. package/dist/screens.cjs.map +1 -1
  34. package/dist/screens.js +4 -4
  35. package/dist/ux.cjs +103 -2
  36. package/dist/ux.cjs.map +1 -1
  37. package/dist/ux.js +1 -1
  38. package/package.json +1 -1
  39. package/dist/chunk-JOXMAWAI.js.map +0 -1
@@ -9037,6 +9037,101 @@ function NodeToolbar({ nodeId, children: children2, className, style: style2, is
9037
9037
  };
9038
9038
  return jsx(NodeToolbarPortal, { children: jsx("div", { style: wrapperStyle2, className: cc(["react-flow__node-toolbar", className]), ...rest, "data-id": nodesArray.reduce((acc, node) => `${acc}${node.id} `, "").trim(), children: children2 }) });
9039
9039
  }
9040
+
9041
+ // src/components/FlowEditor/human-fields.ts
9042
+ var HUMAN_FIELD_TYPE_ALIASES = {
9043
+ text: "text",
9044
+ string: "text",
9045
+ str: "text",
9046
+ input: "text",
9047
+ textarea: "textarea",
9048
+ long_text: "textarea",
9049
+ longtext: "textarea",
9050
+ "long-text": "textarea",
9051
+ multiline: "textarea",
9052
+ paragraph: "textarea",
9053
+ markdown: "textarea",
9054
+ number: "number",
9055
+ numeric: "number",
9056
+ integer: "number",
9057
+ int: "number",
9058
+ float: "number",
9059
+ decimal: "number",
9060
+ select: "select",
9061
+ enum: "select",
9062
+ choice: "select",
9063
+ choices: "select",
9064
+ dropdown: "select",
9065
+ options: "select",
9066
+ radio: "select",
9067
+ switch: "switch",
9068
+ bool: "switch",
9069
+ boolean: "switch",
9070
+ checkbox: "switch",
9071
+ toggle: "switch",
9072
+ date: "date",
9073
+ datetime: "datetime",
9074
+ "datetime-local": "datetime",
9075
+ datetimelocal: "datetime",
9076
+ timestamp: "datetime",
9077
+ time: "time",
9078
+ email: "email",
9079
+ "e-mail": "email",
9080
+ url: "url",
9081
+ uri: "url",
9082
+ link: "url",
9083
+ tel: "tel",
9084
+ phone: "tel",
9085
+ telephone: "tel",
9086
+ password: "password",
9087
+ secret: "password"
9088
+ };
9089
+ function humanFieldType(raw) {
9090
+ if (typeof raw !== "string") return "text";
9091
+ return HUMAN_FIELD_TYPE_ALIASES[raw.trim().toLowerCase()] ?? "text";
9092
+ }
9093
+ function humanFieldOptions(raw) {
9094
+ const entries = [];
9095
+ if (Array.isArray(raw)) {
9096
+ for (const item of raw) {
9097
+ if (typeof item === "string" || typeof item === "number") {
9098
+ const value = String(item);
9099
+ if (value !== "") entries.push({ value, label: value });
9100
+ continue;
9101
+ }
9102
+ if (item && typeof item === "object") {
9103
+ const value = item.value;
9104
+ if (value === void 0 || value === null || value === "") continue;
9105
+ const label = item.label;
9106
+ entries.push({
9107
+ value: String(value),
9108
+ label: typeof label === "string" && label !== "" ? label : String(value)
9109
+ });
9110
+ }
9111
+ }
9112
+ } else if (raw && typeof raw === "object") {
9113
+ for (const [value, label] of Object.entries(raw)) {
9114
+ if (value === "") continue;
9115
+ entries.push({ value, label: typeof label === "string" && label !== "" ? label : value });
9116
+ }
9117
+ }
9118
+ return entries.length ? entries : void 0;
9119
+ }
9120
+ function humanInputFields(config) {
9121
+ const raw = Array.isArray(config?.fields) ? config.fields : [];
9122
+ const fields = raw.filter((f) => f && typeof f === "object" && typeof f.key === "string" && f.key).map((f) => ({
9123
+ key: f.key,
9124
+ label: typeof f.label === "string" && f.label ? f.label : f.key,
9125
+ type: humanFieldType(f.type),
9126
+ required: !!f.required,
9127
+ placeholder: typeof f.placeholder === "string" ? f.placeholder : void 0,
9128
+ options: humanFieldOptions(f.options ?? f.choices),
9129
+ default: f.default
9130
+ }));
9131
+ if (fields.length) return fields;
9132
+ const title = typeof config?.title === "string" && config.title ? config.title : "Your answer";
9133
+ return [{ key: "value", label: title, type: "textarea", required: true }];
9134
+ }
9040
9135
  var FlowEditorContext = createContext(null);
9041
9136
  var FlowEditorProvider = FlowEditorContext.Provider;
9042
9137
  function useFlowEditor() {
@@ -9651,6 +9746,20 @@ var subflowExecutor = async (ctx) => {
9651
9746
  };
9652
9747
 
9653
9748
  // src/registry/builtin.ts
9749
+ var HUMAN_FIELD_OUTPUT_TYPE = {
9750
+ text: "string",
9751
+ textarea: "string",
9752
+ select: "string",
9753
+ date: "string",
9754
+ datetime: "string",
9755
+ time: "string",
9756
+ email: "string",
9757
+ url: "string",
9758
+ tel: "string",
9759
+ password: "string",
9760
+ number: "number",
9761
+ switch: "boolean"
9762
+ };
9654
9763
  function casePorts(cases) {
9655
9764
  const byPort = /* @__PURE__ */ new Map();
9656
9765
  if (cases && typeof cases === "object" && !Array.isArray(cases)) {
@@ -9748,7 +9857,17 @@ var KINDS = [
9748
9857
  name: "@particle-academy/user_input",
9749
9858
  // The keys an author declared on THIS node — the case a static list cannot
9750
9859
  // express, and the one issue #5 named.
9751
- outputShape: (config) => (config.fields ?? []).filter((f) => typeof f.key === "string" && f.key !== "").map((f) => ({ path: f.key, type: "string", description: f.label })),
9860
+ //
9861
+ // The TYPE comes from the same normalizer the form renders with, so the
9862
+ // variable picker agrees with what the run actually resolves. It used to say
9863
+ // `string` for every field, which was wrong the moment a field was a number
9864
+ // or a switch — the picker told an author `{{ $json.age }}` was text while
9865
+ // the form handed the next node a number.
9866
+ outputShape: (config) => (config.fields ?? []).filter((f) => typeof f.key === "string" && f.key !== "").map((f) => ({
9867
+ path: f.key,
9868
+ type: HUMAN_FIELD_OUTPUT_TYPE[humanFieldType(f.type)],
9869
+ description: f.label
9870
+ })),
9752
9871
  aliases: ["user_input", "@fancy/user_input"],
9753
9872
  pausesForHuman: "input",
9754
9873
  category: "human",
@@ -9775,14 +9894,38 @@ var KINDS = [
9775
9894
  key: "type",
9776
9895
  label: "Type",
9777
9896
  default: "text",
9897
+ // Every control `HumanPrompt` can render. A type the form supports
9898
+ // but the panel cannot select is reachable only by hand-editing the
9899
+ // workflow JSON — which is the audience this panel exists for.
9778
9900
  options: [
9779
9901
  { value: "text", label: "Text" },
9780
9902
  { value: "textarea", label: "Long text" },
9781
9903
  { value: "number", label: "Number" },
9782
9904
  { value: "select", label: "Select" },
9783
- { value: "switch", label: "Switch" }
9905
+ { value: "switch", label: "Switch (yes / no)" },
9906
+ { value: "date", label: "Date" },
9907
+ { value: "datetime", label: "Date + time" },
9908
+ { value: "time", label: "Time" },
9909
+ { value: "email", label: "Email" },
9910
+ { value: "url", label: "URL" },
9911
+ { value: "tel", label: "Phone" },
9912
+ { value: "password", label: "Password" }
9784
9913
  ]
9785
9914
  },
9915
+ {
9916
+ // Without this a panel-authored select had nothing to choose from,
9917
+ // so it rendered an empty dropdown — the type was declarable and
9918
+ // unusable in the same breath.
9919
+ type: "keyvalue",
9920
+ key: "options",
9921
+ label: "Choices",
9922
+ description: "Select fields only. Left is the value the flow receives, right is what the person sees.",
9923
+ keyLabel: "Value",
9924
+ valueLabel: "Label",
9925
+ keyPlaceholder: "small",
9926
+ valuePlaceholder: "Small",
9927
+ addLabel: "Add choice"
9928
+ },
9786
9929
  { type: "switch", key: "required", label: "Required", default: false }
9787
9930
  ],
9788
9931
  default: [{ key: "answer", label: "Your answer", type: "textarea", required: true }]
@@ -10704,6 +10847,6 @@ function LaneNodeInner(props) {
10704
10847
  }
10705
10848
  var LaneNode = memo(LaneNodeInner);
10706
10849
 
10707
- export { BUILTIN_KINDS, Background, BackgroundVariant, Controls, DEFAULT_MAX_DEPTH, FlowEditorProvider, Handle, LaneNode, MiniMap, NodeResizer, NodeToolbar, NoteNode, Position, ReactFlowProvider, RunIdentity, ViewportPortal, addEdge2 as addEdge, applyEdgeChanges, applyNodeChanges, categoryAccent, clearNodeKindOverrides, declaredRoutes, defaultConfigFor, ensureBuiltinKinds, escapeSegment, getNodeKind, index, kindIds, listNodeKinds, llmRouterExecutor, nodeConfig, onNodeKindsChanged, overrideNodeKind, reconnectEdge2 as reconnectEdge, registerBuiltinKinds, registerNodeKind, resolveFallbackPort, resolveKindId, resolveNodePorts, resolvePortSpec, runFlow, subflowExecutor, subflowMode, subflowPorts, useFlowEditor, useFlowEditorOptional, useReactFlow, validateConfig };
10708
- //# sourceMappingURL=chunk-JOXMAWAI.js.map
10709
- //# sourceMappingURL=chunk-JOXMAWAI.js.map
10850
+ export { BUILTIN_KINDS, Background, BackgroundVariant, Controls, DEFAULT_MAX_DEPTH, FlowEditorProvider, Handle, LaneNode, MiniMap, NodeResizer, NodeToolbar, NoteNode, Position, ReactFlowProvider, RunIdentity, ViewportPortal, addEdge2 as addEdge, applyEdgeChanges, applyNodeChanges, categoryAccent, clearNodeKindOverrides, declaredRoutes, defaultConfigFor, ensureBuiltinKinds, escapeSegment, getNodeKind, humanInputFields, index, kindIds, listNodeKinds, llmRouterExecutor, nodeConfig, onNodeKindsChanged, overrideNodeKind, reconnectEdge2 as reconnectEdge, registerBuiltinKinds, registerNodeKind, resolveFallbackPort, resolveKindId, resolveNodePorts, resolvePortSpec, runFlow, subflowExecutor, subflowMode, subflowPorts, useFlowEditor, useFlowEditorOptional, useReactFlow, validateConfig };
10851
+ //# sourceMappingURL=chunk-CIBW5ATA.js.map
10852
+ //# sourceMappingURL=chunk-CIBW5ATA.js.map