@particle-academy/fancy-flow 0.52.0 → 0.54.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/{ConfigFieldRenderer-Bc9Txnql.d.cts → HumanPrompt-CPl-Spmp.d.cts} +75 -1
- package/dist/{ConfigFieldRenderer-Bt3RGT7Z.d.ts → HumanPrompt-DlJSFi3F.d.ts} +75 -1
- package/dist/{chunk-JOXMAWAI.js → chunk-CIBW5ATA.js} +148 -5
- package/dist/chunk-CIBW5ATA.js.map +1 -0
- package/dist/{chunk-PEX3ZGCO.js → chunk-FG3C7LIG.js} +3 -3
- package/dist/{chunk-PEX3ZGCO.js.map → chunk-FG3C7LIG.js.map} +1 -1
- package/dist/{chunk-PU3CLTAG.js → chunk-FH6MWLKD.js} +3 -3
- package/dist/{chunk-PU3CLTAG.js.map → chunk-FH6MWLKD.js.map} +1 -1
- package/dist/{chunk-PWIHOR57.js → chunk-FTGVVKWX.js} +4 -4
- package/dist/{chunk-PWIHOR57.js.map → chunk-FTGVVKWX.js.map} +1 -1
- package/dist/{chunk-I7ZDPY7C.js → chunk-VWANLNL5.js} +3 -3
- package/dist/{chunk-I7ZDPY7C.js.map → chunk-VWANLNL5.js.map} +1 -1
- package/dist/{chunk-RR7A6IUW.js → chunk-WCFRKXH5.js} +3 -3
- package/dist/{chunk-RR7A6IUW.js.map → chunk-WCFRKXH5.js.map} +1 -1
- package/dist/durable.cjs +103 -2
- package/dist/durable.cjs.map +1 -1
- package/dist/durable.js +1 -1
- package/dist/engine.cjs +103 -2
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.js +3 -3
- package/dist/fields/react-fancy.cjs +66 -0
- package/dist/fields/react-fancy.cjs.map +1 -1
- package/dist/fields/react-fancy.d.cts +35 -2
- package/dist/fields/react-fancy.d.ts +35 -2
- package/dist/fields/react-fancy.js +67 -2
- package/dist/fields/react-fancy.js.map +1 -1
- package/dist/index.cjs +245 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.js +111 -53
- package/dist/index.js.map +1 -1
- package/dist/registry.cjs +103 -2
- package/dist/registry.cjs.map +1 -1
- package/dist/registry.js +2 -2
- package/dist/runtime.cjs +103 -2
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.js +3 -3
- package/dist/schema.cjs +103 -2
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.js +2 -2
- package/dist/screens.cjs +103 -2
- package/dist/screens.cjs.map +1 -1
- package/dist/screens.js +4 -4
- package/dist/ux.cjs +103 -2
- package/dist/ux.cjs.map +1 -1
- package/dist/ux.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-JOXMAWAI.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -5,8 +5,8 @@ import { ConnectionValidatorOptions } from './registry/index.cjs';
|
|
|
5
5
|
export { ANY_PORT_TYPE, BUILTIN_KINDS, PortCompatibility, RegistryNode, RichInputAdapter, RichInputPreview, buildNodeTypes, createConnectionValidator, defaultPortCompatibility, getRichInputAdapter, isRichInputEnabled, onRichInputAdapterChanged, registerBuiltinKinds, registerRichInputAdapter, resolveNodePorts, resolvePortSpec } from './registry/index.cjs';
|
|
6
6
|
import { a as FlowNode, F as FlowGraph, g as NodeRunStatus, E as ExecutorRegistry } from './types-JFYjPJAG.cjs';
|
|
7
7
|
export { A as ActionNodeData, B as BaseNodeData, D as DecisionNodeData, d as FlowEdge, e as FlowNodeData, f as FlowNodeKind, N as NodeExecutor, h as NoteNodeData, O as OutputNodeData, P as PortDescriptor, R as RunEvent, S as SubgraphNodeData, T as TriggerNodeData } from './types-JFYjPJAG.cjs';
|
|
8
|
-
import { C as ConfigFieldRenderFn } from './
|
|
9
|
-
export { a as ConfigFieldRenderContext, b as ConfigFieldRenderer, c as ConfigFieldRendererProps } from './
|
|
8
|
+
import { C as ConfigFieldRenderFn, H as HumanFieldRenderers } from './HumanPrompt-CPl-Spmp.cjs';
|
|
9
|
+
export { a as ConfigFieldRenderContext, b as ConfigFieldRenderer, c as ConfigFieldRendererProps } from './HumanPrompt-CPl-Spmp.cjs';
|
|
10
10
|
import { WorkflowSchema, WorkflowMetadata } from './schema/index.cjs';
|
|
11
11
|
export { ImportIssue, ImportOptions, ImportResult, WORKFLOW_SCHEMA_URL, WORKFLOW_SCHEMA_VERSION, WorkflowSchemaEdge, WorkflowSchemaNode, exportWorkflow, importWorkflow, migrateSchema, workflowToBlob } from './schema/index.cjs';
|
|
12
12
|
import { AutoLayoutOptions } from './layout/index.cjs';
|
|
@@ -321,6 +321,17 @@ type FlowEditorProps = {
|
|
|
321
321
|
value?: FlowGraph;
|
|
322
322
|
/** Executor registry passed to runFlow. Each kind name maps to an executor. */
|
|
323
323
|
executors?: ExecutorRegistry;
|
|
324
|
+
/**
|
|
325
|
+
* Host controls for the `user_input` / `human_approval` pause form, keyed by
|
|
326
|
+
* canonical field type. A renderer returning `null` declines that field and
|
|
327
|
+
* falls through to the built-in, so a PARTIAL map is safe to spread.
|
|
328
|
+
*
|
|
329
|
+
* The built-ins are native `--ff-*`-themed elements because react-fancy is an
|
|
330
|
+
* OPTIONAL peer and this component ships in the main entry. A host that has
|
|
331
|
+
* react-fancy opts into its primitives with
|
|
332
|
+
* `humanFieldRenderers` from `@particle-academy/fancy-flow/fields/react-fancy`.
|
|
333
|
+
*/
|
|
334
|
+
humanFieldRenderers?: HumanFieldRenderers;
|
|
324
335
|
/** Saved metadata for export. */
|
|
325
336
|
metadata?: WorkflowMetadata;
|
|
326
337
|
/** Show the palette sidebar. Default true. */
|
package/dist/index.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ import { ConnectionValidatorOptions } from './registry/index.js';
|
|
|
5
5
|
export { ANY_PORT_TYPE, BUILTIN_KINDS, PortCompatibility, RegistryNode, RichInputAdapter, RichInputPreview, buildNodeTypes, createConnectionValidator, defaultPortCompatibility, getRichInputAdapter, isRichInputEnabled, onRichInputAdapterChanged, registerBuiltinKinds, registerRichInputAdapter, resolveNodePorts, resolvePortSpec } from './registry/index.js';
|
|
6
6
|
import { a as FlowNode, F as FlowGraph, g as NodeRunStatus, E as ExecutorRegistry } from './types-JFYjPJAG.js';
|
|
7
7
|
export { A as ActionNodeData, B as BaseNodeData, D as DecisionNodeData, d as FlowEdge, e as FlowNodeData, f as FlowNodeKind, N as NodeExecutor, h as NoteNodeData, O as OutputNodeData, P as PortDescriptor, R as RunEvent, S as SubgraphNodeData, T as TriggerNodeData } from './types-JFYjPJAG.js';
|
|
8
|
-
import { C as ConfigFieldRenderFn } from './
|
|
9
|
-
export { a as ConfigFieldRenderContext, b as ConfigFieldRenderer, c as ConfigFieldRendererProps } from './
|
|
8
|
+
import { C as ConfigFieldRenderFn, H as HumanFieldRenderers } from './HumanPrompt-DlJSFi3F.js';
|
|
9
|
+
export { a as ConfigFieldRenderContext, b as ConfigFieldRenderer, c as ConfigFieldRendererProps } from './HumanPrompt-DlJSFi3F.js';
|
|
10
10
|
import { WorkflowSchema, WorkflowMetadata } from './schema/index.js';
|
|
11
11
|
export { ImportIssue, ImportOptions, ImportResult, WORKFLOW_SCHEMA_URL, WORKFLOW_SCHEMA_VERSION, WorkflowSchemaEdge, WorkflowSchemaNode, exportWorkflow, importWorkflow, migrateSchema, workflowToBlob } from './schema/index.js';
|
|
12
12
|
import { AutoLayoutOptions } from './layout/index.js';
|
|
@@ -321,6 +321,17 @@ type FlowEditorProps = {
|
|
|
321
321
|
value?: FlowGraph;
|
|
322
322
|
/** Executor registry passed to runFlow. Each kind name maps to an executor. */
|
|
323
323
|
executors?: ExecutorRegistry;
|
|
324
|
+
/**
|
|
325
|
+
* Host controls for the `user_input` / `human_approval` pause form, keyed by
|
|
326
|
+
* canonical field type. A renderer returning `null` declines that field and
|
|
327
|
+
* falls through to the built-in, so a PARTIAL map is safe to spread.
|
|
328
|
+
*
|
|
329
|
+
* The built-ins are native `--ff-*`-themed elements because react-fancy is an
|
|
330
|
+
* OPTIONAL peer and this component ships in the main entry. A host that has
|
|
331
|
+
* react-fancy opts into its primitives with
|
|
332
|
+
* `humanFieldRenderers` from `@particle-academy/fancy-flow/fields/react-fancy`.
|
|
333
|
+
*/
|
|
334
|
+
humanFieldRenderers?: HumanFieldRenderers;
|
|
324
335
|
/** Saved metadata for export. */
|
|
325
336
|
metadata?: WorkflowMetadata;
|
|
326
337
|
/** Show the palette sidebar. Default true. */
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { removeNodes, removeEdges, cloneSubgraph, alignNodes, distributeNodes, reconnectEdge, assignToLane, removeFromLane, duplicateNode, setEdgeLabel, FlowCanvas } from './chunk-
|
|
2
|
-
export { ActionNode, DecisionNode, FlowCanvas, FlowViewer, NodeShell, OutputNode, SubgraphNode, TriggerNode, alignNodes, cloneSubgraph, defaultNodeTypes, distributeNodes, reconnectEdge } from './chunk-
|
|
3
|
-
import { useFlowState, useFlowRun, useFlowHistory, applyOutputsToNodes, applyStatusesToNodes } from './chunk-
|
|
4
|
-
export { applyOutputsToNodes, applyStatusesToNodes, createHistory, useFlowHistory, useFlowRun, useFlowState } from './chunk-
|
|
5
|
-
export { runCohort } from './chunk-
|
|
1
|
+
import { removeNodes, removeEdges, cloneSubgraph, alignNodes, distributeNodes, reconnectEdge, assignToLane, removeFromLane, duplicateNode, setEdgeLabel, FlowCanvas } from './chunk-FTGVVKWX.js';
|
|
2
|
+
export { ActionNode, DecisionNode, FlowCanvas, FlowViewer, NodeShell, OutputNode, SubgraphNode, TriggerNode, alignNodes, cloneSubgraph, defaultNodeTypes, distributeNodes, reconnectEdge } from './chunk-FTGVVKWX.js';
|
|
3
|
+
import { useFlowState, useFlowRun, useFlowHistory, applyOutputsToNodes, applyStatusesToNodes } from './chunk-FG3C7LIG.js';
|
|
4
|
+
export { applyOutputsToNodes, applyStatusesToNodes, createHistory, useFlowHistory, useFlowRun, useFlowState } from './chunk-FG3C7LIG.js';
|
|
5
|
+
export { runCohort } from './chunk-WCFRKXH5.js';
|
|
6
6
|
export { evaluateConfig, evaluateExpression, resolvePath, text, truthy } from './chunk-BHM5HGXH.js';
|
|
7
|
-
import { buildNodeTypes } from './chunk-
|
|
8
|
-
export { ANY_PORT_TYPE, RegistryNode, buildNodeTypes, createConnectionValidator, defaultPortCompatibility } from './chunk-
|
|
7
|
+
import { buildNodeTypes } from './chunk-VWANLNL5.js';
|
|
8
|
+
export { ANY_PORT_TYPE, RegistryNode, buildNodeTypes, createConnectionValidator, defaultPortCompatibility } from './chunk-VWANLNL5.js';
|
|
9
9
|
export { LEGACY_PAUSE_PREFIXES, PAUSE_PREFIX, decodePause, encodePause, isPause, pauseForHuman } from './chunk-UEOE6B52.js';
|
|
10
|
-
import { workflowToBlob, importWorkflow, exportWorkflow } from './chunk-
|
|
11
|
-
export { WORKFLOW_SCHEMA_URL, WORKFLOW_SCHEMA_VERSION, exportWorkflow, importWorkflow, migrateSchema, workflowToBlob } from './chunk-
|
|
12
|
-
import { ReactFlowProvider, useReactFlow, onNodeKindsChanged, listNodeKinds, getNodeKind, defaultConfigFor, FlowEditorProvider, addEdge, applyEdgeChanges, applyNodeChanges, Position, ensureBuiltinKinds, validateConfig, categoryAccent, Handle } from './chunk-
|
|
13
|
-
export { BUILTIN_KINDS, LaneNode, NoteNode, categoryAccent, clearNodeKindOverrides, defaultConfigFor, ensureBuiltinKinds, getNodeKind, listNodeKinds, onNodeKindsChanged, overrideNodeKind, registerBuiltinKinds, registerNodeKind, resolveNodePorts, resolvePortSpec, runFlow, useFlowEditor, useFlowEditorOptional, validateConfig } from './chunk-
|
|
10
|
+
import { workflowToBlob, importWorkflow, exportWorkflow } from './chunk-FH6MWLKD.js';
|
|
11
|
+
export { WORKFLOW_SCHEMA_URL, WORKFLOW_SCHEMA_VERSION, exportWorkflow, importWorkflow, migrateSchema, workflowToBlob } from './chunk-FH6MWLKD.js';
|
|
12
|
+
import { ReactFlowProvider, useReactFlow, humanInputFields, onNodeKindsChanged, listNodeKinds, getNodeKind, defaultConfigFor, FlowEditorProvider, addEdge, applyEdgeChanges, applyNodeChanges, Position, ensureBuiltinKinds, validateConfig, categoryAccent, Handle } from './chunk-CIBW5ATA.js';
|
|
13
|
+
export { BUILTIN_KINDS, LaneNode, NoteNode, categoryAccent, clearNodeKindOverrides, defaultConfigFor, ensureBuiltinKinds, getNodeKind, listNodeKinds, onNodeKindsChanged, overrideNodeKind, registerBuiltinKinds, registerNodeKind, resolveNodePorts, resolvePortSpec, runFlow, useFlowEditor, useFlowEditorOptional, validateConfig } from './chunk-CIBW5ATA.js';
|
|
14
14
|
import { getRichInputAdapter } from './chunk-F5RPRB7A.js';
|
|
15
15
|
export { RichInputPreview, getRichInputAdapter, isRichInputEnabled, onRichInputAdapterChanged, registerRichInputAdapter } from './chunk-F5RPRB7A.js';
|
|
16
16
|
import './chunk-USL4FMFU.js';
|
|
@@ -974,27 +974,35 @@ function formatTime(at) {
|
|
|
974
974
|
const d = new Date(at);
|
|
975
975
|
return `${d.getMinutes().toString().padStart(2, "0")}:${d.getSeconds().toString().padStart(2, "0")}.${Math.floor(d.getMilliseconds() / 100)}`;
|
|
976
976
|
}
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
if (fields.length) return fields;
|
|
989
|
-
const title = typeof config?.title === "string" && config.title ? config.title : "Your answer";
|
|
990
|
-
return [{ key: "value", label: title, type: "textarea", required: true }];
|
|
991
|
-
}
|
|
977
|
+
var INPUT_TYPE = {
|
|
978
|
+
text: "text",
|
|
979
|
+
number: "number",
|
|
980
|
+
date: "date",
|
|
981
|
+
datetime: "datetime-local",
|
|
982
|
+
time: "time",
|
|
983
|
+
email: "email",
|
|
984
|
+
url: "url",
|
|
985
|
+
tel: "tel",
|
|
986
|
+
password: "password"
|
|
987
|
+
};
|
|
992
988
|
function initialValues(fields) {
|
|
993
989
|
const v = {};
|
|
994
|
-
for (const f of fields)
|
|
990
|
+
for (const f of fields) {
|
|
991
|
+
if (f.type === "switch") {
|
|
992
|
+
v[f.key] = !!f.default;
|
|
993
|
+
} else if (f.type === "number") {
|
|
994
|
+
v[f.key] = typeof f.default === "number" ? f.default : f.default === void 0 || f.default === "" ? "" : Number(f.default);
|
|
995
|
+
} else {
|
|
996
|
+
v[f.key] = f.default ?? "";
|
|
997
|
+
}
|
|
998
|
+
}
|
|
995
999
|
return v;
|
|
996
1000
|
}
|
|
997
|
-
function HumanPrompt({
|
|
1001
|
+
function HumanPrompt({
|
|
1002
|
+
request,
|
|
1003
|
+
onCancel,
|
|
1004
|
+
fieldRenderers
|
|
1005
|
+
}) {
|
|
998
1006
|
const firstRef = useRef(null);
|
|
999
1007
|
useEffect(() => {
|
|
1000
1008
|
firstRef.current?.focus();
|
|
@@ -1006,7 +1014,7 @@ function HumanPrompt({ request, onCancel }) {
|
|
|
1006
1014
|
}, [onCancel]);
|
|
1007
1015
|
return /* @__PURE__ */ jsx("div", { className: "ff-prompt-overlay", role: "dialog", "aria-modal": "true", "aria-label": request.title, children: /* @__PURE__ */ jsxs("div", { className: "ff-prompt", onClick: (e) => e.stopPropagation(), children: [
|
|
1008
1016
|
/* @__PURE__ */ jsx("div", { className: "ff-prompt__title", children: request.title }),
|
|
1009
|
-
request.kind === "approval" ? /* @__PURE__ */ jsx(ApprovalBody, { request, onCancel }) : /* @__PURE__ */ jsx(InputBody, { request, onCancel, firstRef })
|
|
1017
|
+
request.kind === "approval" ? /* @__PURE__ */ jsx(ApprovalBody, { request, onCancel }) : /* @__PURE__ */ jsx(InputBody, { request, onCancel, firstRef, fieldRenderers })
|
|
1010
1018
|
] }) });
|
|
1011
1019
|
}
|
|
1012
1020
|
function ApprovalBody({ request, onCancel }) {
|
|
@@ -1022,10 +1030,13 @@ function ApprovalBody({ request, onCancel }) {
|
|
|
1022
1030
|
function InputBody({
|
|
1023
1031
|
request,
|
|
1024
1032
|
onCancel,
|
|
1025
|
-
firstRef
|
|
1033
|
+
firstRef,
|
|
1034
|
+
fieldRenderers
|
|
1026
1035
|
}) {
|
|
1027
1036
|
const [values, setValues] = useState(() => initialValues(request.fields));
|
|
1028
1037
|
const set = (k, v) => setValues((prev) => ({ ...prev, [k]: v }));
|
|
1038
|
+
const uid = useId();
|
|
1039
|
+
const fieldId = (key) => `${uid}-${key}`;
|
|
1029
1040
|
const missing = request.fields.filter((f) => f.required && (values[f.key] === void 0 || values[f.key] === ""));
|
|
1030
1041
|
const submit = () => {
|
|
1031
1042
|
if (missing.length === 0) request.resolve(values);
|
|
@@ -1044,12 +1055,22 @@ function InputBody({
|
|
|
1044
1055
|
}
|
|
1045
1056
|
},
|
|
1046
1057
|
children: [
|
|
1047
|
-
/* @__PURE__ */ jsx("div", { className: "ff-prompt__fields", children: request.fields.map((f, i) => /* @__PURE__ */ jsxs("
|
|
1048
|
-
/* @__PURE__ */ jsxs("
|
|
1058
|
+
/* @__PURE__ */ jsx("div", { className: "ff-prompt__fields", children: request.fields.map((f, i) => /* @__PURE__ */ jsxs("div", { className: "ff-prompt__field", children: [
|
|
1059
|
+
/* @__PURE__ */ jsxs("label", { className: "ff-prompt__label", htmlFor: fieldId(f.key), children: [
|
|
1049
1060
|
f.label ?? f.key,
|
|
1050
|
-
f.required && /* @__PURE__ */ jsx("span", { className: "ff-prompt__req", children: " *" })
|
|
1061
|
+
f.required && /* @__PURE__ */ jsx("span", { className: "ff-prompt__req", "aria-hidden": "true", children: " *" })
|
|
1051
1062
|
] }),
|
|
1052
|
-
|
|
1063
|
+
/* @__PURE__ */ jsx(
|
|
1064
|
+
FieldControl,
|
|
1065
|
+
{
|
|
1066
|
+
field: f,
|
|
1067
|
+
id: fieldId(f.key),
|
|
1068
|
+
value: values[f.key],
|
|
1069
|
+
onChange: (v) => set(f.key, v),
|
|
1070
|
+
autoFocusRef: i === 0 ? firstRef : void 0,
|
|
1071
|
+
renderers: fieldRenderers
|
|
1072
|
+
}
|
|
1073
|
+
)
|
|
1053
1074
|
] }, f.key)) }),
|
|
1054
1075
|
/* @__PURE__ */ jsxs("div", { className: "ff-prompt__actions", children: [
|
|
1055
1076
|
/* @__PURE__ */ jsx("button", { type: "button", className: "ff-prompt__btn ff-prompt__btn--ghost", onClick: onCancel, children: "Cancel" }),
|
|
@@ -1059,45 +1080,74 @@ function InputBody({
|
|
|
1059
1080
|
}
|
|
1060
1081
|
);
|
|
1061
1082
|
}
|
|
1062
|
-
function
|
|
1063
|
-
|
|
1064
|
-
|
|
1083
|
+
function FieldControl({
|
|
1084
|
+
field,
|
|
1085
|
+
id,
|
|
1086
|
+
value,
|
|
1087
|
+
onChange,
|
|
1088
|
+
autoFocusRef,
|
|
1089
|
+
renderers
|
|
1090
|
+
}) {
|
|
1091
|
+
const override = renderers?.[field.type ?? "text"];
|
|
1092
|
+
if (override) {
|
|
1093
|
+
const rendered = override({ field, id, value, onChange, autoFocusRef });
|
|
1094
|
+
if (rendered !== null && rendered !== void 0) return /* @__PURE__ */ jsx(Fragment, { children: rendered });
|
|
1095
|
+
}
|
|
1096
|
+
const handle = { id, "data-ff-field": field.key };
|
|
1097
|
+
if (field.type === "textarea") {
|
|
1065
1098
|
return /* @__PURE__ */ jsx(
|
|
1066
1099
|
"textarea",
|
|
1067
1100
|
{
|
|
1068
|
-
...
|
|
1069
|
-
|
|
1101
|
+
...handle,
|
|
1102
|
+
className: "ff-prompt__input",
|
|
1103
|
+
placeholder: field.placeholder,
|
|
1104
|
+
ref: autoFocusRef,
|
|
1070
1105
|
rows: 3,
|
|
1071
1106
|
value: String(value ?? ""),
|
|
1072
1107
|
onChange: (e) => onChange(e.target.value)
|
|
1073
1108
|
}
|
|
1074
1109
|
);
|
|
1075
1110
|
}
|
|
1076
|
-
if (
|
|
1111
|
+
if (field.type === "switch") {
|
|
1077
1112
|
return /* @__PURE__ */ jsx(
|
|
1078
1113
|
"input",
|
|
1079
1114
|
{
|
|
1115
|
+
...handle,
|
|
1080
1116
|
type: "checkbox",
|
|
1081
1117
|
className: "ff-prompt__switch",
|
|
1118
|
+
ref: autoFocusRef,
|
|
1082
1119
|
checked: !!value,
|
|
1083
1120
|
onChange: (e) => onChange(e.target.checked)
|
|
1084
1121
|
}
|
|
1085
1122
|
);
|
|
1086
1123
|
}
|
|
1087
|
-
if (
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1124
|
+
if (field.type === "select") {
|
|
1125
|
+
const options = field.options ?? [];
|
|
1126
|
+
return /* @__PURE__ */ jsxs(
|
|
1127
|
+
"select",
|
|
1128
|
+
{
|
|
1129
|
+
...handle,
|
|
1130
|
+
className: "ff-prompt__input",
|
|
1131
|
+
ref: autoFocusRef,
|
|
1132
|
+
value: String(value ?? ""),
|
|
1133
|
+
onChange: (e) => onChange(e.target.value),
|
|
1134
|
+
children: [
|
|
1135
|
+
/* @__PURE__ */ jsx("option", { value: "", disabled: true, children: options.length ? "Choose\u2026" : "No choices configured" }),
|
|
1136
|
+
options.map((o) => /* @__PURE__ */ jsx("option", { value: o.value, children: o.label }, o.value))
|
|
1137
|
+
]
|
|
1138
|
+
}
|
|
1139
|
+
);
|
|
1092
1140
|
}
|
|
1093
1141
|
return /* @__PURE__ */ jsx(
|
|
1094
1142
|
"input",
|
|
1095
1143
|
{
|
|
1096
|
-
...
|
|
1097
|
-
|
|
1098
|
-
|
|
1144
|
+
...handle,
|
|
1145
|
+
className: "ff-prompt__input",
|
|
1146
|
+
placeholder: field.placeholder,
|
|
1147
|
+
ref: autoFocusRef,
|
|
1148
|
+
type: INPUT_TYPE[field.type ?? "text"] ?? "text",
|
|
1099
1149
|
value: String(value ?? ""),
|
|
1100
|
-
onChange: (e) => onChange(
|
|
1150
|
+
onChange: (e) => onChange(field.type === "number" ? e.target.value === "" ? "" : Number(e.target.value) : e.target.value)
|
|
1101
1151
|
}
|
|
1102
1152
|
);
|
|
1103
1153
|
}
|
|
@@ -1130,6 +1180,7 @@ function FlowEditorInner({
|
|
|
1130
1180
|
onDelete,
|
|
1131
1181
|
onEdgeDelete,
|
|
1132
1182
|
confirmDelete,
|
|
1183
|
+
humanFieldRenderers,
|
|
1133
1184
|
apiRef
|
|
1134
1185
|
}) {
|
|
1135
1186
|
const internal = useFlowState(initial);
|
|
@@ -1666,10 +1717,17 @@ function FlowEditorInner({
|
|
|
1666
1717
|
}
|
|
1667
1718
|
),
|
|
1668
1719
|
showFeed && (slots.feed ? slots.feed(api) : /* @__PURE__ */ jsx(FlowRunFeed, { entries: runner.feed, running: api.running, className: "ff-editor__feed" })),
|
|
1669
|
-
prompt && /* @__PURE__ */ jsx(
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1720
|
+
prompt && /* @__PURE__ */ jsx(
|
|
1721
|
+
HumanPrompt,
|
|
1722
|
+
{
|
|
1723
|
+
request: prompt,
|
|
1724
|
+
onCancel: () => {
|
|
1725
|
+
setPrompt(null);
|
|
1726
|
+
runner.cancel();
|
|
1727
|
+
},
|
|
1728
|
+
fieldRenderers: humanFieldRenderers
|
|
1729
|
+
}
|
|
1730
|
+
)
|
|
1673
1731
|
] }),
|
|
1674
1732
|
showPanel && (slots.panel ? slots.panel(api) : /* @__PURE__ */ jsxs("div", { className: "ff-editor__panel-wrap", children: [
|
|
1675
1733
|
/* @__PURE__ */ jsx(
|