@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.
- package/dist/{chunk-4GO2CHAY.js → chunk-CIBW5ATA.js} +166 -25
- package/dist/chunk-CIBW5ATA.js.map +1 -0
- package/dist/{chunk-OK7KJLWA.js → chunk-FG3C7LIG.js} +3 -3
- package/dist/{chunk-OK7KJLWA.js.map → chunk-FG3C7LIG.js.map} +1 -1
- package/dist/{chunk-SPINP4EJ.js → chunk-FH6MWLKD.js} +3 -3
- package/dist/{chunk-SPINP4EJ.js.map → chunk-FH6MWLKD.js.map} +1 -1
- package/dist/{chunk-OECW2E5D.js → chunk-FTGVVKWX.js} +4 -4
- package/dist/{chunk-OECW2E5D.js.map → chunk-FTGVVKWX.js.map} +1 -1
- package/dist/{chunk-RSRXKZ52.js → chunk-VWANLNL5.js} +3 -3
- package/dist/{chunk-RSRXKZ52.js.map → chunk-VWANLNL5.js.map} +1 -1
- package/dist/{chunk-VUU3CDBT.js → chunk-WCFRKXH5.js} +3 -3
- package/dist/{chunk-VUU3CDBT.js.map → chunk-WCFRKXH5.js.map} +1 -1
- package/dist/durable.cjs +121 -22
- package/dist/durable.cjs.map +1 -1
- package/dist/durable.js +1 -1
- package/dist/engine.cjs +122 -23
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.js +3 -3
- package/dist/index.cjs +236 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +84 -46
- package/dist/index.js.map +1 -1
- package/dist/registry.cjs +121 -22
- package/dist/registry.cjs.map +1 -1
- package/dist/registry.js +2 -2
- package/dist/runtime.cjs +122 -23
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.js +3 -3
- package/dist/schema.cjs +121 -22
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.js +2 -2
- package/dist/screens.cjs +121 -22
- package/dist/screens.cjs.map +1 -1
- package/dist/screens.js +4 -4
- package/dist/ux.cjs +121 -22
- package/dist/ux.cjs.map +1 -1
- package/dist/ux.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-4GO2CHAY.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() {
|
|
@@ -9423,7 +9518,7 @@ async function runFlow(graph, executors, onEvent = () => {
|
|
|
9423
9518
|
const exec = pickExecutor(executors, node);
|
|
9424
9519
|
if (!exec) {
|
|
9425
9520
|
const tried = executorLookupIds(node);
|
|
9426
|
-
const msg = `No executor registered for kind=${node.type} \u2014 tried ${tried.map((id2) => `"${id2}"`).join(", ")}
|
|
9521
|
+
const msg = `No executor registered for kind=${node.type} \u2014 tried ${tried.map((id2) => `"${id2}"`).join(", ")}. Key your registry by one of those.`;
|
|
9427
9522
|
errors.push(msg);
|
|
9428
9523
|
onEvent({ type: "node-status", nodeId: node.id, status: "error", text: msg });
|
|
9429
9524
|
onEvent({ type: "log", nodeId: node.id, level: "error", message: msg });
|
|
@@ -9519,30 +9614,28 @@ function collectInputs(node, incoming, portValues, initial, props, declaresProps
|
|
|
9519
9614
|
function executorLookupIds(node) {
|
|
9520
9615
|
const ids = [node.id];
|
|
9521
9616
|
if (node.type) ids.push(node.type);
|
|
9522
|
-
const
|
|
9523
|
-
|
|
9524
|
-
|
|
9525
|
-
|
|
9526
|
-
const
|
|
9527
|
-
|
|
9528
|
-
|
|
9617
|
+
const typeKind = node.type ? getNodeKind(node.type) : null;
|
|
9618
|
+
if (typeKind) {
|
|
9619
|
+
for (const id2 of kindIds(typeKind)) ids.push(id2);
|
|
9620
|
+
} else {
|
|
9621
|
+
const declared = node.data?.kind;
|
|
9622
|
+
const kindName = typeof declared === "string" && declared !== "" ? declared : null;
|
|
9623
|
+
if (kindName) {
|
|
9624
|
+
ids.push(kindName);
|
|
9625
|
+
const dataKind = getNodeKind(kindName);
|
|
9626
|
+
if (dataKind) {
|
|
9627
|
+
for (const id2 of kindIds(dataKind)) ids.push(id2);
|
|
9628
|
+
}
|
|
9629
|
+
}
|
|
9529
9630
|
}
|
|
9631
|
+
ids.push("*");
|
|
9530
9632
|
return [...new Set(ids)];
|
|
9531
9633
|
}
|
|
9532
9634
|
function pickExecutor(executors, node) {
|
|
9533
|
-
|
|
9534
|
-
|
|
9535
|
-
const declared = node.data?.kind;
|
|
9536
|
-
const kindName = typeof declared === "string" && declared !== "" ? declared : node.type;
|
|
9537
|
-
if (kindName && kindName !== node.type && executors[kindName]) return executors[kindName];
|
|
9538
|
-
for (const name of [kindName, node.type]) {
|
|
9539
|
-
const kind = name ? getNodeKind(name) : null;
|
|
9540
|
-
if (!kind) continue;
|
|
9541
|
-
for (const id2 of kindIds(kind)) {
|
|
9542
|
-
if (executors[id2]) return executors[id2];
|
|
9543
|
-
}
|
|
9635
|
+
for (const id2 of executorLookupIds(node)) {
|
|
9636
|
+
if (executors[id2]) return executors[id2];
|
|
9544
9637
|
}
|
|
9545
|
-
return
|
|
9638
|
+
return void 0;
|
|
9546
9639
|
}
|
|
9547
9640
|
function activatedPorts(node, result) {
|
|
9548
9641
|
if (result && typeof result === "object") {
|
|
@@ -9653,6 +9746,20 @@ var subflowExecutor = async (ctx) => {
|
|
|
9653
9746
|
};
|
|
9654
9747
|
|
|
9655
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
|
+
};
|
|
9656
9763
|
function casePorts(cases) {
|
|
9657
9764
|
const byPort = /* @__PURE__ */ new Map();
|
|
9658
9765
|
if (cases && typeof cases === "object" && !Array.isArray(cases)) {
|
|
@@ -9750,7 +9857,17 @@ var KINDS = [
|
|
|
9750
9857
|
name: "@particle-academy/user_input",
|
|
9751
9858
|
// The keys an author declared on THIS node — the case a static list cannot
|
|
9752
9859
|
// express, and the one issue #5 named.
|
|
9753
|
-
|
|
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
|
+
})),
|
|
9754
9871
|
aliases: ["user_input", "@fancy/user_input"],
|
|
9755
9872
|
pausesForHuman: "input",
|
|
9756
9873
|
category: "human",
|
|
@@ -9777,14 +9894,38 @@ var KINDS = [
|
|
|
9777
9894
|
key: "type",
|
|
9778
9895
|
label: "Type",
|
|
9779
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.
|
|
9780
9900
|
options: [
|
|
9781
9901
|
{ value: "text", label: "Text" },
|
|
9782
9902
|
{ value: "textarea", label: "Long text" },
|
|
9783
9903
|
{ value: "number", label: "Number" },
|
|
9784
9904
|
{ value: "select", label: "Select" },
|
|
9785
|
-
{ 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" }
|
|
9786
9913
|
]
|
|
9787
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
|
+
},
|
|
9788
9929
|
{ type: "switch", key: "required", label: "Required", default: false }
|
|
9789
9930
|
],
|
|
9790
9931
|
default: [{ key: "answer", label: "Your answer", type: "textarea", required: true }]
|
|
@@ -10706,6 +10847,6 @@ function LaneNodeInner(props) {
|
|
|
10706
10847
|
}
|
|
10707
10848
|
var LaneNode = memo(LaneNodeInner);
|
|
10708
10849
|
|
|
10709
|
-
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 };
|
|
10710
|
-
//# sourceMappingURL=chunk-
|
|
10711
|
-
//# sourceMappingURL=chunk-
|
|
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
|