@powerhousedao/workflow 6.2.3-dev.27 → 6.2.3-dev.28

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 (111) hide show
  1. package/dist/{node/BlockSelector-COZm6-ev.mjs → browser/BlockSelector-D24DIiSX.js} +45 -12
  2. package/dist/browser/{BlockSelector-QQgOCVH3.js.map → BlockSelector-D24DIiSX.js.map} +1 -1
  3. package/dist/browser/{PieceMarkdown-C8Gv88TV.js → PieceMarkdown-B8EEaQgT.js} +2 -2
  4. package/dist/browser/{PieceMarkdown-C8Gv88TV.js.map → PieceMarkdown-B8EEaQgT.js.map} +1 -1
  5. package/dist/browser/{connection-form-XKR4zQgQ.js → connection-form-D-NETdDQ.js} +3 -3
  6. package/dist/browser/{connection-form-XKR4zQgQ.js.map → connection-form-D-NETdDQ.js.map} +1 -1
  7. package/dist/browser/{data-tree-DKrDFeQg.js → data-tree-DA4sc7B7.js} +2 -2
  8. package/dist/browser/{data-tree-DKrDFeQg.js.map → data-tree-DA4sc7B7.js.map} +1 -1
  9. package/dist/browser/{editor-YZw296bf.js → editor-B6N0PCuZ.js} +754 -417
  10. package/dist/browser/editor-B6N0PCuZ.js.map +1 -0
  11. package/dist/browser/{editor-C_E_JTp6.js → editor-BkdwuOC-.js} +4 -4
  12. package/dist/browser/{editor-C_E_JTp6.js.map → editor-BkdwuOC-.js.map} +1 -1
  13. package/dist/browser/{editor-fjwq-8Yq.js → editor-CZ5NvCyv.js} +4 -4
  14. package/dist/browser/{editor-fjwq-8Yq.js.map → editor-CZ5NvCyv.js.map} +1 -1
  15. package/dist/browser/editors/connection-editor/module.js +1 -1
  16. package/dist/browser/editors/workflow-editor/module.js +1 -1
  17. package/dist/browser/editors/workflow-studio/module.js +1 -1
  18. package/dist/browser/index.js +1 -1
  19. package/dist/browser/{runtime-api-xwvg5PzA.js → runtime-api-DDMQc4PB.js} +136 -40
  20. package/dist/browser/runtime-api-DDMQc4PB.js.map +1 -0
  21. package/dist/browser/{trigger-text-CdNxQOHw.js → trigger-text-CUv5Z2Uk.js} +4 -4
  22. package/dist/browser/{trigger-text-CdNxQOHw.js.map → trigger-text-CUv5Z2Uk.js.map} +1 -1
  23. package/dist/{browser/BlockSelector-QQgOCVH3.js → node/BlockSelector-CTmmpYxu.mjs} +45 -12
  24. package/dist/node/{BlockSelector-COZm6-ev.mjs.map → BlockSelector-CTmmpYxu.mjs.map} +1 -1
  25. package/dist/node/{PieceMarkdown-DIxZY5aG.mjs → PieceMarkdown-BMhBGa4t.mjs} +2 -2
  26. package/dist/node/{PieceMarkdown-DIxZY5aG.mjs.map → PieceMarkdown-BMhBGa4t.mjs.map} +1 -1
  27. package/dist/node/{connection-form-BLduFusc.mjs → connection-form-C9vbfSnA.mjs} +3 -3
  28. package/dist/node/{connection-form-BLduFusc.mjs.map → connection-form-C9vbfSnA.mjs.map} +1 -1
  29. package/dist/node/{data-tree-CmiGqG7C.mjs → data-tree-CbqpF3lC.mjs} +2 -2
  30. package/dist/node/{data-tree-CmiGqG7C.mjs.map → data-tree-CbqpF3lC.mjs.map} +1 -1
  31. package/dist/node/{editor-CN4PEGrW.mjs → editor-By9BHI8e.mjs} +4 -4
  32. package/dist/node/{editor-CN4PEGrW.mjs.map → editor-By9BHI8e.mjs.map} +1 -1
  33. package/dist/node/{editor-B2ZoeGue.mjs → editor-DP36YDk5.mjs} +754 -417
  34. package/dist/node/editor-DP36YDk5.mjs.map +1 -0
  35. package/dist/node/{editor-CyNBEKoj.mjs → editor-StBssjcQ.mjs} +4 -4
  36. package/dist/node/{editor-CyNBEKoj.mjs.map → editor-StBssjcQ.mjs.map} +1 -1
  37. package/dist/node/editors/connection-editor/module.mjs +1 -1
  38. package/dist/node/editors/workflow-editor/module.mjs +1 -1
  39. package/dist/node/editors/workflow-studio/module.mjs +1 -1
  40. package/dist/node/index.mjs +1 -1
  41. package/dist/node/pieces/reactor/descriptor.json +72 -16
  42. package/dist/node/pieces/reactor/index.mjs +317 -22
  43. package/dist/node/pieces/reactor/index.mjs.map +1 -1
  44. package/dist/node/{runtime-api-xwvg5PzA.mjs → runtime-api-DDMQc4PB.mjs} +136 -40
  45. package/dist/node/runtime-api-DDMQc4PB.mjs.map +1 -0
  46. package/dist/node/{trigger-text-qj_U3Qzd.mjs → trigger-text-Bzq6VfOQ.mjs} +4 -4
  47. package/dist/node/{trigger-text-qj_U3Qzd.mjs.map → trigger-text-Bzq6VfOQ.mjs.map} +1 -1
  48. package/dist/style.css +59 -3
  49. package/dist/types/editors/shared/controls.d.ts +8 -0
  50. package/dist/types/editors/shared/controls.d.ts.map +1 -1
  51. package/dist/types/editors/shared/icons.d.ts +2 -0
  52. package/dist/types/editors/shared/icons.d.ts.map +1 -1
  53. package/dist/types/editors/workflow-editor/runtime-api.d.ts +2 -1
  54. package/dist/types/editors/workflow-editor/runtime-api.d.ts.map +1 -1
  55. package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts.map +1 -1
  56. package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts +3 -2
  57. package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts.map +1 -1
  58. package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts.map +1 -1
  59. package/dist/types/editors/workflow-editor/ui/blocks.d.ts +2 -0
  60. package/dist/types/editors/workflow-editor/ui/blocks.d.ts.map +1 -1
  61. package/dist/types/editors/workflow-editor/ui/forms.d.ts +42 -5
  62. package/dist/types/editors/workflow-editor/ui/forms.d.ts.map +1 -1
  63. package/dist/types/editors/workflow-editor/ui/piece-source.d.ts +1 -0
  64. package/dist/types/editors/workflow-editor/ui/piece-source.d.ts.map +1 -1
  65. package/dist/types/editors/workflow-editor/ui/prop-controls.d.ts +61 -0
  66. package/dist/types/editors/workflow-editor/ui/prop-controls.d.ts.map +1 -0
  67. package/dist/types/editors/workflow-editor/ui/prop-layout.d.ts +12 -0
  68. package/dist/types/editors/workflow-editor/ui/prop-layout.d.ts.map +1 -0
  69. package/dist/types/pieces/reactor/lib/actions/document-create.d.ts +3 -1
  70. package/dist/types/pieces/reactor/lib/actions/document-create.d.ts.map +1 -1
  71. package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts +2 -1
  72. package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts.map +1 -1
  73. package/dist/types/pieces/reactor/lib/input-props.d.ts +5 -0
  74. package/dist/types/pieces/reactor/lib/input-props.d.ts.map +1 -0
  75. package/dist/types/pieces/reactor/lib/input-props.test.d.ts +2 -0
  76. package/dist/types/pieces/reactor/lib/input-props.test.d.ts.map +1 -0
  77. package/dist/types/pieces/reactor/lib/input-schema.d.ts +22 -0
  78. package/dist/types/pieces/reactor/lib/input-schema.d.ts.map +1 -0
  79. package/dist/types/pieces/reactor/lib/input-schema.test.d.ts +2 -0
  80. package/dist/types/pieces/reactor/lib/input-schema.test.d.ts.map +1 -0
  81. package/dist/types/pieces/reactor/lib/reactor.d.ts +13 -1
  82. package/dist/types/pieces/reactor/lib/reactor.d.ts.map +1 -1
  83. package/dist/types/pieces/reactor/lib/schema-text.d.ts +7 -0
  84. package/dist/types/pieces/reactor/lib/schema-text.d.ts.map +1 -0
  85. package/dist/types/pieces/reactor/lib/schema-text.test.d.ts +2 -0
  86. package/dist/types/pieces/reactor/lib/schema-text.test.d.ts.map +1 -0
  87. package/dist/types/scripts/ui-stack.d.ts +22 -0
  88. package/dist/types/scripts/ui-stack.d.ts.map +1 -1
  89. package/dist/types/test/ui/harness/prop-controls.d.ts +6 -0
  90. package/dist/types/test/ui/harness/prop-controls.d.ts.map +1 -0
  91. package/dist/types/test/ui/prop-controls.spec.d.ts +2 -0
  92. package/dist/types/test/ui/prop-controls.spec.d.ts.map +1 -0
  93. package/dist/types/test/ui/reactor-steps.spec.d.ts +2 -0
  94. package/dist/types/test/ui/reactor-steps.spec.d.ts.map +1 -0
  95. package/package.json +8 -8
  96. package/dist/browser/editor-YZw296bf.js.map +0 -1
  97. package/dist/browser/runtime-api-xwvg5PzA.js.map +0 -1
  98. package/dist/node/editor-B2ZoeGue.mjs.map +0 -1
  99. package/dist/node/runtime-api-xwvg5PzA.mjs.map +0 -1
  100. package/dist/types/editors/workflow-editor/ui/ActionListEditor.d.ts +0 -6
  101. package/dist/types/editors/workflow-editor/ui/ActionListEditor.d.ts.map +0 -1
  102. package/dist/types/editors/workflow-editor/ui/Autocomplete.d.ts +0 -20
  103. package/dist/types/editors/workflow-editor/ui/Autocomplete.d.ts.map +0 -1
  104. package/dist/types/editors/workflow-editor/ui/action-template.d.ts +0 -2
  105. package/dist/types/editors/workflow-editor/ui/action-template.d.ts.map +0 -1
  106. package/dist/types/editors/workflow-editor/ui/action-template.test.d.ts +0 -2
  107. package/dist/types/editors/workflow-editor/ui/action-template.test.d.ts.map +0 -1
  108. package/dist/types/editors/workflow-editor/ui/reactor-piece-form.d.ts +0 -5
  109. package/dist/types/editors/workflow-editor/ui/reactor-piece-form.d.ts.map +0 -1
  110. package/dist/types/editors/workflow-editor/ui/reactor-piece-form.test.d.ts +0 -2
  111. package/dist/types/editors/workflow-editor/ui/reactor-piece-form.test.d.ts.map +0 -1
@@ -1,17 +1,17 @@
1
1
  import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __exportAll, t as __commonJSMin } from "./rolldown-runtime-BMI-E3GI.mjs";
2
2
  import { o as planFromAuth, t as connectorIdForPiece } from "./piece-auth-Z4mZEOtL.mjs";
3
- import { S as REACTOR_PIECE, _ as rotateSecret, a as fetchConnections, b as testTrigger, d as fetchWebhookEndpoint, h as loadBlockOptions, i as fetchBlockOutputTree, l as fetchRuns, m as invalidateConnections, p as getBlockForm, r as createSecret, s as fetchPieceCatalog, u as fetchSecretStat } from "./runtime-api-xwvg5PzA.mjs";
3
+ import { S as TRIGGER_PRESETS, _ as rotateSecret, a as fetchConnections, b as testTrigger, d as fetchWebhookEndpoint, h as loadBlockOptions, i as fetchBlockOutputTree, l as fetchRuns, m as invalidateConnections, p as getBlockForm, r as createSecret, s as fetchPieceCatalog, u as fetchSecretStat, x as STEP_PRESETS } from "./runtime-api-DDMQc4PB.mjs";
4
4
  import { y as actions } from "./module-BMwJQh65.mjs";
5
5
  import { t as useConnectionDocumentById } from "./connection-D544oqVW.mjs";
6
6
  import { y as actions$1 } from "./module-DuxxhgKs.mjs";
7
7
  import { t as useSelectedWorkflowDocument } from "./workflow-C-uuQPnf.mjs";
8
- import { A as FieldError, B as textInputClass, E as toneOf, F as Select, H as DocumentErrorBoundary, I as Switch, L as Tabs, M as Hint, N as IconButton, O as useSyncWorkflowRuntimeUrl, P as Segmented, R as invalidClass, S as formatWhen, V as Icon, a as pieceLogo, d as RUN_TONE, h as TONE_TEXT, i as pieceDisplayName, j as FieldLabel, k as Button, m as TONE_DOT, n as BlockSelector, o as useBlockMeta, r as blockMeta, s as usePieceLogos, t as BlockLogo, v as formatAbsolute, y as formatDuration, z as textAreaClass } from "./BlockSelector-COZm6-ev.mjs";
9
- import { a as BackButton, i as connectionCallbacks, o as UndoRedo, t as ConnectionForm } from "./connection-form-BLduFusc.mjs";
10
- import { a as draftFromConfig, c as DataViewer, d as flowOrder, f as layoutWorkflow, i as configFromDraft, l as acyclicTargets, m as reachableFrom, n as describeSchedule, o as switchKind, r as describeTrigger, s as timezoneOf, t as describeCron, u as attachableSteps } from "./trigger-text-qj_U3Qzd.mjs";
8
+ import { A as FieldError, B as textInputClass, E as toneOf, F as Select, H as isIconName, I as Switch, L as Tabs, M as Hint, N as IconButton, O as useSyncWorkflowRuntimeUrl, P as Segmented, R as invalidClass, S as formatWhen, U as DocumentErrorBoundary, V as Icon, a as pieceLogo, d as RUN_TONE, h as TONE_TEXT, i as pieceDisplayName, j as FieldLabel, k as Button, m as TONE_DOT, n as BlockSelector, o as useBlockMeta, r as blockMeta, s as usePieceLogos, t as BlockLogo, v as formatAbsolute, y as formatDuration, z as textAreaClass } from "./BlockSelector-CTmmpYxu.mjs";
9
+ import { a as BackButton, i as connectionCallbacks, o as UndoRedo, t as ConnectionForm } from "./connection-form-C9vbfSnA.mjs";
10
+ import { a as draftFromConfig, c as DataViewer, d as flowOrder, f as layoutWorkflow, i as configFromDraft, l as acyclicTargets, m as reachableFrom, n as describeSchedule, o as switchKind, r as describeTrigger, s as timezoneOf, t as describeCron, u as attachableSteps } from "./trigger-text-Bzq6VfOQ.mjs";
11
11
  import { generateId } from "document-model";
12
12
  import { addDocument, useFileNodesInSelectedDrive, useSelectedDocumentId, useSelectedDriveId } from "@powerhousedao/reactor-browser";
13
13
  import * as React$12 from "react";
14
- import React, { Suspense, createContext, forwardRef, lazy, memo, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
14
+ import React, { Fragment, Suspense, createContext, forwardRef, lazy, memo, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
15
15
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
16
16
  import * as ReactDOM$1 from "react-dom";
17
17
  import ReactDOM, { createPortal } from "react-dom";
@@ -7605,261 +7605,555 @@ function ConnectionField(props) {
7605
7605
  });
7606
7606
  }
7607
7607
  //#endregion
7608
- //#region editors/workflow-editor/ui/action-template.ts
7609
- function pascalCase(actionType) {
7610
- return actionType.toLowerCase().split(/[_\s]+/).filter(Boolean).map((part) => part[0].toUpperCase() + part.slice(1)).join("");
7611
- }
7612
- function placeholderFor(type) {
7613
- const bare = type.replace(/!/g, "").trim();
7614
- if (bare.startsWith("[")) return [];
7615
- switch (bare) {
7616
- case "Int":
7617
- case "Float": return 0;
7618
- case "Boolean": return false;
7619
- case "String":
7620
- case "OID":
7621
- case "PHID":
7622
- case "OLabel":
7623
- case "URL":
7624
- case "DateTime":
7625
- case "Date":
7626
- case "EmailAddress":
7627
- case "EthereumAddress":
7628
- case "Currency": return "";
7629
- default: return null;
7630
- }
7608
+ //#region editors/workflow-editor/ui/validation.ts
7609
+ function isEmptyValue(value) {
7610
+ if (value === void 0 || value === null) return true;
7611
+ if (typeof value === "string") return value.trim() === "";
7612
+ if (Array.isArray(value)) return value.length === 0;
7613
+ return false;
7631
7614
  }
7632
- function inputTemplateFromSchema(schema, actionType) {
7633
- const rootName = `${pascalCase(actionType)}Input`;
7634
- const body = new RegExp(`input\\s+${rootName}\\s*\\{([^}]*)\\}`).exec(schema)?.[1];
7635
- if (!body) return null;
7636
- const template = {};
7637
- for (const line of body.split("\n")) {
7638
- const cleaned = line.replace(/#.*$/, "").replace(/"[^"]*"/g, "").trim();
7639
- const fieldMatch = /^(\w+)\s*:\s*([\w[\]!]+)/.exec(cleaned);
7640
- if (!fieldMatch) continue;
7641
- const [, name, type] = fieldMatch;
7642
- if (name === "_") continue;
7643
- template[name] = type.endsWith("!") ? placeholderFor(type) : null;
7644
- }
7645
- return Object.keys(template).length > 0 ? template : {};
7615
+ function isPropVisible(prop, config) {
7616
+ const rule = prop.showWhen;
7617
+ if (!rule) return true;
7618
+ const value = config[rule.prop] ?? void 0;
7619
+ if (value === void 0 && rule.unlessSet && config[rule.unlessSet] !== void 0) return false;
7620
+ return rule.oneOf.includes(value);
7621
+ }
7622
+ function missingRequired(props, config) {
7623
+ const record = config !== null && typeof config === "object" && !Array.isArray(config) ? config : {};
7624
+ return props.filter((prop) => prop.required && prop.type !== "MARKDOWN" && isPropVisible(prop, record) && isEmptyValue(record[prop.name] ?? prop.defaultValue)).map((prop) => prop.displayName);
7625
+ }
7626
+ function missingForBlock(form, config, connectionId) {
7627
+ if (!form || form === "loading") return [];
7628
+ const missing = missingRequired(form.props, config);
7629
+ if (form.auth === "required" && !connectionId) missing.unshift("Connection");
7630
+ return missing;
7646
7631
  }
7647
7632
  //#endregion
7648
- //#region editors/workflow-editor/ui/Autocomplete.tsx
7649
- function parseAutocompleteResult(result) {
7650
- const record = result;
7651
- if (!record || !Array.isArray(record.options)) return { options: [] };
7652
- return {
7653
- options: record.options.filter((option) => typeof option.value === "string").map((option) => ({
7654
- label: typeof option.label === "string" ? option.label : option.value,
7655
- value: option.value,
7656
- inputSchema: typeof option.inputSchema === "string" ? option.inputSchema : void 0
7657
- })),
7658
- placeholder: record.placeholder
7659
- };
7633
+ //#region editors/workflow-editor/ui/prop-controls.tsx
7634
+ const CALLOUT = {
7635
+ INFO: { box: "rounded bg-muted px-2 py-1.5" },
7636
+ WARNING: {
7637
+ box: "rounded border border-solid border-wf-warn/40 bg-wf-warn/10 px-2 py-1.5",
7638
+ icon: "alert"
7639
+ },
7640
+ TIP: {
7641
+ box: "rounded border border-solid border-wf-ok/30 bg-wf-ok/10 px-2 py-1.5",
7642
+ icon: "bolt"
7643
+ },
7644
+ BORDERLESS: { box: "" }
7645
+ };
7646
+ /** A MARKDOWN prop's text, styled by the piece's `variant` (INFO default). */
7647
+ function MarkdownCallout(props) {
7648
+ const callout = CALLOUT[props.variant ?? "INFO"] ?? CALLOUT.INFO;
7649
+ return /* @__PURE__ */ jsxs("div", {
7650
+ className: `flex gap-2 ${callout.box}`,
7651
+ "data-variant": props.variant ?? "INFO",
7652
+ children: [callout.icon ? /* @__PURE__ */ jsx(Icon, {
7653
+ name: callout.icon,
7654
+ className: `mt-0.5 h-3.5 w-3.5 shrink-0 ${callout.icon === "alert" ? "text-wf-warn" : "text-wf-ok"}`
7655
+ }) : null, /* @__PURE__ */ jsx("div", {
7656
+ className: "min-w-0 flex-1",
7657
+ children: props.children
7658
+ })]
7659
+ });
7660
7660
  }
7661
- const inputClass$2 = "w-full rounded border border-foreground/15 px-2 py-1.5 text-sm text-foreground";
7662
- function AutocompleteInput(props) {
7663
- const listId = useId();
7664
- const [text, setText] = useState(props.value);
7665
- const [prevValue, setPrevValue] = useState(props.value);
7666
- if (props.value !== prevValue) {
7667
- setPrevValue(props.value);
7668
- setText(props.value);
7661
+ /** An option's icon, when the piece names one this editor draws. */
7662
+ function optionIcon(name) {
7663
+ return isIconName(name) ? /* @__PURE__ */ jsx(Icon, {
7664
+ name,
7665
+ className: "h-3.5 w-3.5 shrink-0 text-muted-foreground"
7666
+ }) : void 0;
7667
+ }
7668
+ /** STATIC_DROPDOWN with `display: 'cards'`: one selectable card per option. */
7669
+ function OptionCards(props) {
7670
+ const current = props.keyOf(props.value);
7671
+ return /* @__PURE__ */ jsx("div", {
7672
+ id: props.id,
7673
+ role: "radiogroup",
7674
+ className: `grid grid-cols-2 gap-2 ${props.invalid ? "rounded-md ring-1 ring-wf-warn/60" : ""}`,
7675
+ children: props.options.map((option) => {
7676
+ const key = props.keyOf(option.value);
7677
+ const selected = key === current;
7678
+ return /* @__PURE__ */ jsxs("button", {
7679
+ type: "button",
7680
+ role: "radio",
7681
+ "aria-checked": selected,
7682
+ className: `flex min-w-0 flex-col items-start gap-1 rounded-lg border border-solid p-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 ${selected ? "border-foreground/40 bg-accent" : "border-foreground/10 hover:border-foreground/25"}`,
7683
+ onClick: () => props.onChange(selected && props.clearable ? void 0 : option.value),
7684
+ children: [/* @__PURE__ */ jsxs("span", {
7685
+ className: "flex items-center gap-1.5 text-[13px] font-medium text-foreground",
7686
+ children: [optionIcon(option.icon), option.label]
7687
+ }), option.description ? /* @__PURE__ */ jsx("span", {
7688
+ className: "text-xs leading-snug text-muted-foreground",
7689
+ children: option.description
7690
+ }) : null]
7691
+ }, key);
7692
+ })
7693
+ });
7694
+ }
7695
+ /** The declared bounds, for the hint and the check: "Between 0 and 5". */
7696
+ function numberRangeText(min, max) {
7697
+ if (min !== void 0 && max !== void 0) return `Between ${min} and ${max}`;
7698
+ if (min !== void 0) return `At least ${min}`;
7699
+ if (max !== void 0) return `At most ${max}`;
7700
+ return null;
7701
+ }
7702
+ function numberRangeError(value, min, max) {
7703
+ if (typeof value !== "number") return null;
7704
+ if (min !== void 0 && value < min || max !== void 0 && value > max) return `${numberRangeText(min, max)}.`;
7705
+ return null;
7706
+ }
7707
+ /** NUMBER with `display: 'stepper'`: − value +, still accepting expressions. */
7708
+ function NumberStepper(props) {
7709
+ const step = props.step ?? 1;
7710
+ const numeric = typeof props.value === "number" ? props.value : void 0;
7711
+ const clamp = (next) => Math.min(props.max ?? Infinity, Math.max(props.min ?? -Infinity, next));
7712
+ const bump = (direction) => props.onCommit(clamp((numeric ?? props.min ?? 0) + direction * step));
7713
+ const text = props.value === void 0 || props.value === null ? "" : String(props.value);
7714
+ return /* @__PURE__ */ jsxs("div", {
7715
+ className: "flex items-center gap-1",
7716
+ children: [
7717
+ /* @__PURE__ */ jsx(IconButton, {
7718
+ icon: "minus",
7719
+ label: "Decrease",
7720
+ disabled: numeric !== void 0 && props.min !== void 0 && numeric <= props.min,
7721
+ onClick: () => bump(-1)
7722
+ }),
7723
+ /* @__PURE__ */ jsx("input", {
7724
+ id: props.id,
7725
+ className: `${textInputClass} w-24 text-center tabular-nums ${props.invalid ? invalidClass : ""}`,
7726
+ defaultValue: text,
7727
+ inputMode: "decimal",
7728
+ spellCheck: false,
7729
+ onFocus: props.onFocus,
7730
+ onBlur: (event) => {
7731
+ const raw = event.target.value.trim();
7732
+ if (raw === "") return props.onCommit(void 0);
7733
+ if (hasExpressions(raw)) return props.onCommit(raw);
7734
+ const parsed = Number(raw);
7735
+ props.onCommit(Number.isFinite(parsed) ? parsed : raw);
7736
+ }
7737
+ }, text),
7738
+ /* @__PURE__ */ jsx(IconButton, {
7739
+ icon: "plus",
7740
+ label: "Increase",
7741
+ disabled: numeric !== void 0 && props.max !== void 0 && numeric >= props.max,
7742
+ onClick: () => bump(1)
7743
+ })
7744
+ ]
7745
+ });
7746
+ }
7747
+ const DATE_PRESETS = [
7748
+ {
7749
+ value: "any_time",
7750
+ label: "Any time"
7751
+ },
7752
+ {
7753
+ value: "last_24_hours",
7754
+ label: "Last 24 hours"
7755
+ },
7756
+ {
7757
+ value: "last_7_days",
7758
+ label: "Last 7 days"
7759
+ },
7760
+ {
7761
+ value: "last_30_days",
7762
+ label: "Last 30 days"
7763
+ },
7764
+ {
7765
+ value: "last_90_days",
7766
+ label: "Last 90 days"
7767
+ },
7768
+ {
7769
+ value: "this_month",
7770
+ label: "This month"
7771
+ },
7772
+ {
7773
+ value: "custom",
7774
+ label: "Custom"
7669
7775
  }
7670
- const [result, setResult] = useState(null);
7671
- const [error, setError] = useState(null);
7672
- const [loading, setLoading] = useState(false);
7673
- const refresh = () => {
7674
- if (!props.loadOptions || loading) return;
7675
- setLoading(true);
7676
- props.loadOptions().then((raw) => {
7677
- setResult(parseAutocompleteResult(raw));
7678
- setError(null);
7679
- setLoading(false);
7680
- }, (loadError) => {
7681
- setError(loadError instanceof Error ? loadError.message : String(loadError));
7682
- setLoading(false);
7683
- });
7684
- };
7685
- return /* @__PURE__ */ jsxs("div", { children: [
7686
- /* @__PURE__ */ jsx("input", {
7776
+ ];
7777
+ function toLocalInput(iso) {
7778
+ if (!iso) return "";
7779
+ const date = new Date(iso);
7780
+ if (Number.isNaN(date.getTime())) return "";
7781
+ const pad = (n) => String(n).padStart(2, "0");
7782
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}`;
7783
+ }
7784
+ function fromLocalInput(local) {
7785
+ if (!local) return void 0;
7786
+ const date = new Date(local);
7787
+ return Number.isNaN(date.getTime()) ? void 0 : date.toISOString();
7788
+ }
7789
+ function asDateRange(value) {
7790
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
7791
+ }
7792
+ function DateRangeField(props) {
7793
+ const range = asDateRange(props.value);
7794
+ const setPreset = (preset) => props.onCommit(preset === "" ? void 0 : preset === "custom" ? {
7795
+ preset,
7796
+ after: range.after,
7797
+ before: range.before
7798
+ } : { preset });
7799
+ return /* @__PURE__ */ jsxs("div", {
7800
+ className: "flex flex-col gap-2",
7801
+ children: [props.dropdown ? /* @__PURE__ */ jsx(Select, {
7687
7802
  id: props.id,
7688
- className: props.className ?? inputClass$2,
7689
- value: text,
7690
- list: listId,
7691
- placeholder: result?.placeholder ?? props.placeholder,
7803
+ options: DATE_PRESETS,
7804
+ value: range.preset ?? "",
7805
+ onChange: setPreset,
7806
+ invalid: props.invalid,
7807
+ clearable: props.clearable,
7808
+ placeholder: "Choose a range"
7809
+ }) : /* @__PURE__ */ jsx("div", {
7810
+ id: props.id,
7811
+ role: "radiogroup",
7812
+ className: "flex flex-wrap gap-1.5",
7813
+ children: DATE_PRESETS.map((preset) => {
7814
+ const selected = range.preset === preset.value;
7815
+ return /* @__PURE__ */ jsx("button", {
7816
+ type: "button",
7817
+ role: "radio",
7818
+ "aria-checked": selected,
7819
+ className: `h-7 rounded-full border border-solid px-2.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 ${selected ? "border-foreground bg-foreground text-background" : "border-foreground/15 text-muted-foreground hover:text-foreground"}`,
7820
+ onClick: () => setPreset(selected && props.clearable ? "" : preset.value),
7821
+ children: preset.label
7822
+ }, preset.value);
7823
+ })
7824
+ }), range.preset === "custom" ? /* @__PURE__ */ jsx("div", {
7825
+ className: "grid grid-cols-2 gap-2",
7826
+ children: ["after", "before"].map((edge) => /* @__PURE__ */ jsxs("label", {
7827
+ className: "flex flex-col gap-1 text-xs text-muted-foreground",
7828
+ children: [edge === "after" ? "From" : "To", /* @__PURE__ */ jsx("input", {
7829
+ type: "datetime-local",
7830
+ className: textInputClass,
7831
+ defaultValue: toLocalInput(range[edge]),
7832
+ onBlur: (event) => props.onCommit({
7833
+ ...range,
7834
+ [edge]: fromLocalInput(event.target.value)
7835
+ })
7836
+ })]
7837
+ }, edge))
7838
+ }) : null]
7839
+ });
7840
+ }
7841
+ const HEX = /^#[0-9a-f]{6}$/i;
7842
+ /** COLOR: a swatch picker beside a text field that also takes expressions. */
7843
+ function ColorField(props) {
7844
+ const text = typeof props.value === "string" ? props.value : "";
7845
+ const [draft, setDraft] = useState(null);
7846
+ const swatchRef = useRef(null);
7847
+ const onCommit = props.onCommit;
7848
+ useEffect(() => {
7849
+ const swatch = swatchRef.current;
7850
+ if (!swatch) return;
7851
+ const commit = () => {
7852
+ setDraft(null);
7853
+ onCommit(swatch.value);
7854
+ };
7855
+ swatch.addEventListener("change", commit);
7856
+ return () => swatch.removeEventListener("change", commit);
7857
+ }, [onCommit]);
7858
+ return /* @__PURE__ */ jsxs("div", {
7859
+ className: "flex items-center gap-2",
7860
+ children: [/* @__PURE__ */ jsx("input", {
7861
+ ref: swatchRef,
7862
+ type: "color",
7863
+ "aria-label": "Pick a colour",
7864
+ className: "h-9 w-10 shrink-0 cursor-pointer rounded-md border border-solid border-foreground/15 bg-card p-1",
7865
+ value: draft ?? (HEX.test(text) ? text : "#000000"),
7866
+ onChange: (event) => setDraft(event.target.value)
7867
+ }), /* @__PURE__ */ jsx("input", {
7868
+ id: props.id,
7869
+ className: `${textInputClass} font-mono text-xs ${props.invalid ? invalidClass : ""}`,
7870
+ defaultValue: text,
7871
+ placeholder: "#1d63d6 or {{steps.…}}",
7692
7872
  spellCheck: false,
7693
- onFocus: refresh,
7694
- onChange: (event) => {
7695
- const next = event.target.value;
7696
- setText(next);
7697
- const picked = result?.options.find((option) => option.value === next);
7698
- if (picked) {
7699
- props.onCommit(next);
7700
- props.onPick?.(picked);
7701
- }
7702
- },
7703
- onBlur: () => {
7704
- if (text !== props.value) props.onCommit(text);
7873
+ onFocus: props.onFocus,
7874
+ onBlur: (event) => {
7875
+ const raw = event.target.value.trim();
7876
+ props.onCommit(raw === "" ? void 0 : raw);
7705
7877
  }
7706
- }),
7707
- /* @__PURE__ */ jsx("datalist", {
7708
- id: listId,
7709
- children: (result?.options ?? []).map((option) => /* @__PURE__ */ jsx("option", {
7710
- value: option.value,
7711
- children: option.label
7712
- }, option.value))
7713
- }),
7714
- error ? /* @__PURE__ */ jsx("p", {
7715
- className: "mt-0.5 text-[11px] text-wf-fail",
7716
- children: error
7717
- }) : null
7718
- ] });
7878
+ }, text)]
7879
+ });
7880
+ }
7881
+ function richTextMode(format) {
7882
+ const value = typeof format === "string" ? format.toLowerCase() : "";
7883
+ if (value === "html") return "html";
7884
+ if (value === "markdown" || value === "md") return "markdown";
7885
+ return "plain";
7719
7886
  }
7720
7887
  //#endregion
7721
- //#region editors/workflow-editor/ui/ActionListEditor.tsx
7722
- function toRows(value) {
7723
- if (!Array.isArray(value)) return [];
7724
- return value.map((entry) => {
7725
- const record = entry ?? {};
7888
+ //#region editors/workflow-editor/ui/prop-layout.tsx
7889
+ const PLACED = /* @__PURE__ */ new Set([
7890
+ "section",
7891
+ "tabs",
7892
+ "builder",
7893
+ "footer"
7894
+ ]);
7895
+ function chipText(value) {
7896
+ if (typeof value === "string") return value;
7897
+ if (typeof value === "number" || typeof value === "boolean") return String(value);
7898
+ if (Array.isArray(value)) return value.map(chipText).join(", ");
7899
+ return "set";
7900
+ }
7901
+ /** Consecutive `width: 'half'` fields share a row, two at a time. */
7902
+ function Rows(props) {
7903
+ const rows = [];
7904
+ let pending = null;
7905
+ const flush = () => {
7906
+ if (pending) rows.push(/* @__PURE__ */ jsx(Fragment, { children: pending.node }, pending.prop.name));
7907
+ pending = null;
7908
+ };
7909
+ for (const item of props.items) {
7910
+ if (item.prop.width !== "half") {
7911
+ flush();
7912
+ rows.push(/* @__PURE__ */ jsx(Fragment, { children: item.node }, item.prop.name));
7913
+ continue;
7914
+ }
7915
+ if (!pending) {
7916
+ pending = item;
7917
+ continue;
7918
+ }
7919
+ const first = pending;
7920
+ pending = null;
7921
+ rows.push(/* @__PURE__ */ jsxs("div", {
7922
+ className: "grid grid-cols-1 gap-4 min-[420px]:grid-cols-2",
7923
+ children: [/* @__PURE__ */ jsx("div", {
7924
+ className: "min-w-0",
7925
+ children: first.node
7926
+ }), /* @__PURE__ */ jsx("div", {
7927
+ className: "min-w-0",
7928
+ children: item.node
7929
+ })]
7930
+ }, `${first.prop.name}+${item.prop.name}`));
7931
+ }
7932
+ flush();
7933
+ return /* @__PURE__ */ jsx(Fragment$1, { children: rows });
7934
+ }
7935
+ function RevealCard(props) {
7936
+ const open = props.layout.values[props.checkbox.name] === true;
7937
+ return /* @__PURE__ */ jsxs("div", {
7938
+ className: "flex flex-col gap-4",
7939
+ children: [props.layout.renderField(props.checkbox), open && props.revealed.length > 0 ? /* @__PURE__ */ jsx("div", {
7940
+ className: "flex flex-col gap-4 border-l-2 border-solid border-foreground/10 pl-3",
7941
+ children: /* @__PURE__ */ jsx(Rows, { items: props.revealed.map((prop) => ({
7942
+ prop,
7943
+ node: props.layout.renderField(prop)
7944
+ })) })
7945
+ }) : null]
7946
+ });
7947
+ }
7948
+ function FieldList(props) {
7949
+ const byName = new Map(props.members.map((prop) => [prop.name, prop]));
7950
+ const revealedBy = /* @__PURE__ */ new Map();
7951
+ for (const prop of props.members) for (const name of prop.reveals ?? []) if (byName.has(name)) revealedBy.set(name, prop);
7952
+ const items = props.members.filter((prop) => !revealedBy.has(prop.name)).map((prop) => {
7953
+ const revealed = (prop.reveals ?? []).map((name) => byName.get(name)).filter((entry) => entry !== void 0);
7726
7954
  return {
7727
- type: typeof record.type === "string" ? record.type : "",
7728
- input: record.input ?? {}
7955
+ prop,
7956
+ node: revealed.length > 0 ? /* @__PURE__ */ jsx(RevealCard, {
7957
+ checkbox: prop,
7958
+ revealed,
7959
+ layout: props.layout
7960
+ }) : props.layout.renderField(prop)
7729
7961
  };
7730
7962
  });
7963
+ return /* @__PURE__ */ jsx(Rows, { items });
7731
7964
  }
7732
- function stringifyInput(input) {
7733
- try {
7734
- return JSON.stringify(input ?? {}, null, 2);
7735
- } catch {
7736
- return "{}";
7737
- }
7965
+ function GroupHeading(props) {
7966
+ const { group } = props;
7967
+ if (!group.label && !group.description) return null;
7968
+ return /* @__PURE__ */ jsxs("div", {
7969
+ className: "flex flex-col gap-0.5",
7970
+ children: [group.label ? /* @__PURE__ */ jsxs("span", {
7971
+ className: "flex items-center gap-1.5 text-[13px] font-semibold text-foreground",
7972
+ children: [isIconName(group.icon) ? /* @__PURE__ */ jsx(Icon, {
7973
+ name: group.icon,
7974
+ className: "h-3.5 w-3.5 text-muted-foreground"
7975
+ }) : null, group.label]
7976
+ }) : null, group.description ? /* @__PURE__ */ jsx("span", {
7977
+ className: "text-xs text-muted-foreground",
7978
+ children: group.description
7979
+ }) : null]
7980
+ });
7738
7981
  }
7739
- const INVALID = Symbol("invalid");
7740
- function parseInput(text) {
7741
- if (text.trim() === "") return {};
7742
- try {
7743
- return JSON.parse(text);
7744
- } catch {
7745
- return INVALID;
7746
- }
7982
+ function Section$1(props) {
7983
+ return /* @__PURE__ */ jsxs("section", {
7984
+ "aria-label": props.group.label,
7985
+ className: "flex flex-col gap-4 rounded-lg border border-solid border-foreground/10 p-4",
7986
+ children: [/* @__PURE__ */ jsx(GroupHeading, { group: props.group }), /* @__PURE__ */ jsx(FieldList, {
7987
+ members: props.members,
7988
+ layout: props.layout
7989
+ })]
7990
+ });
7747
7991
  }
7748
- const inputClass$1 = "w-full rounded border border-foreground/15 px-2 py-1.5 text-sm text-foreground";
7749
- function ActionRowEditor(props) {
7750
- const { row } = props;
7751
- const [jsonText, setJsonText] = useState(() => stringifyInput(row.input));
7752
- const [prevInput, setPrevInput] = useState(row.input);
7753
- if (row.input !== prevInput) {
7754
- setPrevInput(row.input);
7755
- setJsonText(stringifyInput(row.input));
7756
- }
7757
- const [jsonError, setJsonError] = useState(null);
7992
+ function TabbedGroup(props) {
7993
+ const [active, setActive] = useState(props.members[0]?.name ?? "");
7994
+ const current = props.members.find((prop) => prop.name === active) ?? props.members[0];
7995
+ if (!current) return null;
7758
7996
  return /* @__PURE__ */ jsxs("div", {
7759
- className: "rounded border border-foreground/10 p-2",
7997
+ className: "flex flex-col gap-3",
7760
7998
  children: [
7761
- /* @__PURE__ */ jsxs("div", {
7999
+ /* @__PURE__ */ jsx(GroupHeading, { group: props.group }),
8000
+ /* @__PURE__ */ jsx("div", {
8001
+ className: "border-b border-solid border-foreground/10",
8002
+ children: /* @__PURE__ */ jsx(Tabs, {
8003
+ value: current.name,
8004
+ onChange: setActive,
8005
+ tabs: props.members.map((prop) => ({
8006
+ value: prop.name,
8007
+ label: prop.displayName,
8008
+ badge: isEmptyValue(props.layout.values[prop.name]) ? void 0 : /* @__PURE__ */ jsx("span", {
8009
+ "aria-label": "has a value",
8010
+ className: "h-1.5 w-1.5 rounded-full bg-wf-run"
8011
+ })
8012
+ }))
8013
+ })
8014
+ }),
8015
+ props.layout.renderField(current)
8016
+ ]
8017
+ });
8018
+ }
8019
+ function BuilderGroups(props) {
8020
+ const members = props.groups.flatMap((group) => group.props.map((name) => props.byName.get(name)).filter((prop) => prop !== void 0));
8021
+ const [added, setAdded] = useState([]);
8022
+ const inUse = members.filter((prop) => prop.required || added.includes(prop.name) || !isEmptyValue(props.layout.values[prop.name]));
8023
+ const available = members.filter((prop) => !inUse.includes(prop));
8024
+ return /* @__PURE__ */ jsxs("div", {
8025
+ className: "flex flex-col gap-3",
8026
+ children: [
8027
+ props.groups.map((group) => /* @__PURE__ */ jsx(GroupHeading, { group }, group.key)),
8028
+ inUse.map((prop) => /* @__PURE__ */ jsxs("div", {
7762
8029
  className: "flex items-start gap-1",
7763
8030
  children: [/* @__PURE__ */ jsx("div", {
7764
- className: "grow",
7765
- children: /* @__PURE__ */ jsx(AutocompleteInput, {
7766
- className: `${inputClass$1} font-mono text-xs`,
7767
- value: row.type,
7768
- placeholder: "Action type",
7769
- loadOptions: props.loadActionTypes,
7770
- onCommit: (type) => props.onChange({
7771
- ...row,
7772
- type
7773
- }),
7774
- onPick: (option) => {
7775
- const empty = row.input === null || row.input === void 0 || typeof row.input === "object" && Object.keys(row.input).length === 0;
7776
- const template = option.inputSchema ? inputTemplateFromSchema(option.inputSchema, option.value) : null;
7777
- props.onChange({
7778
- type: option.value,
7779
- input: empty && template ? template : row.input
7780
- });
7781
- }
7782
- })
7783
- }), /* @__PURE__ */ jsx("button", {
7784
- type: "button",
7785
- className: "shrink-0 rounded border border-foreground/10 px-2 py-1 text-xs text-muted-foreground/80 hover:text-wf-fail",
7786
- onClick: props.onRemove,
7787
- title: "Remove action",
7788
- children: "✕"
8031
+ className: "min-w-0 flex-1",
8032
+ children: props.layout.renderField(prop)
8033
+ }), prop.required ? null : /* @__PURE__ */ jsx(IconButton, {
8034
+ icon: "close",
8035
+ label: `Remove ${prop.displayName}`,
8036
+ className: "mt-7",
8037
+ onClick: () => {
8038
+ setAdded((names) => names.filter((name) => name !== prop.name));
8039
+ props.layout.onCommit(prop.name, void 0);
8040
+ }
7789
8041
  })]
7790
- }),
7791
- /* @__PURE__ */ jsx("textarea", {
7792
- className: `${inputClass$1} mt-1 min-h-16 font-mono text-xs`,
7793
- value: jsonText,
7794
- spellCheck: false,
7795
- onChange: (event) => setJsonText(event.target.value),
7796
- onBlur: () => {
7797
- const input = parseInput(jsonText);
7798
- if (input === INVALID) {
7799
- setJsonError("Invalid JSON — input not saved");
7800
- return;
8042
+ }, prop.name)),
8043
+ available.length > 0 ? /* @__PURE__ */ jsx("div", {
8044
+ className: "max-w-60",
8045
+ children: /* @__PURE__ */ jsx(Select, {
8046
+ options: available.map((prop) => ({
8047
+ value: prop.name,
8048
+ label: prop.displayName,
8049
+ description: prop.description
8050
+ })),
8051
+ value: "",
8052
+ placeholder: "Add filter",
8053
+ onChange: (name) => {
8054
+ if (name) setAdded((names) => [...names, name]);
7801
8055
  }
7802
- props.onChange({
7803
- ...row,
7804
- input
7805
- });
7806
- setJsonError(null);
7807
- }
7808
- }),
7809
- jsonError ? /* @__PURE__ */ jsx("p", {
7810
- className: "mt-0.5 text-[11px] text-wf-fail",
7811
- children: jsonError
8056
+ })
7812
8057
  }) : null
7813
8058
  ]
7814
8059
  });
7815
8060
  }
7816
- function ActionListEditor(props) {
7817
- const rows = toRows(props.value);
7818
- const commit = (next) => {
7819
- props.onCommit(next.length > 0 ? next : void 0);
7820
- };
7821
- return /* @__PURE__ */ jsxs("div", {
7822
- className: "flex flex-col gap-2",
7823
- children: [rows.map((row, index) => /* @__PURE__ */ jsx(ActionRowEditor, {
7824
- row,
7825
- loadActionTypes: props.loadActionTypes,
7826
- onChange: (next) => commit(rows.map((entry, i) => i === index ? next : entry)),
7827
- onRemove: () => commit(rows.filter((_, i) => i !== index))
7828
- }, index)), /* @__PURE__ */ jsx("button", {
7829
- type: "button",
7830
- className: "self-start rounded border border-foreground/15 px-2 py-1 text-xs font-medium text-muted-foreground",
7831
- onClick: () => commit([...rows, {
7832
- type: "",
7833
- input: {}
7834
- }]),
7835
- children: "+ Add action"
7836
- })]
8061
+ function Summary(props) {
8062
+ const set = props.members.filter((prop) => !isEmptyValue(props.layout.values[prop.name]));
8063
+ if (set.length === 0) return null;
8064
+ return /* @__PURE__ */ jsx("div", {
8065
+ className: "flex flex-wrap gap-1.5",
8066
+ "aria-label": "Filters in use",
8067
+ children: set.map((prop) => /* @__PURE__ */ jsxs("span", {
8068
+ className: "inline-flex h-6 max-w-full items-center gap-1 rounded-full bg-muted pl-2.5 pr-1 text-xs text-foreground",
8069
+ children: [/* @__PURE__ */ jsxs("span", {
8070
+ className: "truncate",
8071
+ children: [
8072
+ prop.displayName,
8073
+ ": ",
8074
+ chipText(props.layout.values[prop.name])
8075
+ ]
8076
+ }), /* @__PURE__ */ jsx("button", {
8077
+ type: "button",
8078
+ "aria-label": `Clear ${prop.displayName}`,
8079
+ className: "flex h-4 w-4 items-center justify-center rounded-full text-muted-foreground hover:bg-foreground/10 hover:text-foreground",
8080
+ onClick: () => props.layout.onCommit(prop.name, void 0),
8081
+ children: /* @__PURE__ */ jsx(Icon, {
8082
+ name: "close",
8083
+ className: "h-3 w-3"
8084
+ })
8085
+ })]
8086
+ }, prop.name))
7837
8087
  });
7838
8088
  }
7839
- //#endregion
7840
- //#region editors/workflow-editor/ui/validation.ts
7841
- function isEmptyValue(value) {
7842
- if (value === void 0 || value === null) return true;
7843
- if (typeof value === "string") return value.trim() === "";
7844
- if (Array.isArray(value)) return value.length === 0;
7845
- return false;
7846
- }
7847
- function isPropVisible(prop, config) {
7848
- const rule = prop.showWhen;
7849
- if (!rule) return true;
7850
- const value = config[rule.prop] ?? void 0;
7851
- if (value === void 0 && rule.unlessSet && config[rule.unlessSet] !== void 0) return false;
7852
- return rule.oneOf.includes(value);
7853
- }
7854
- function missingRequired(props, config) {
7855
- const record = config !== null && typeof config === "object" && !Array.isArray(config) ? config : {};
7856
- return props.filter((prop) => prop.required && prop.type !== "MARKDOWN" && isPropVisible(prop, record) && isEmptyValue(record[prop.name] ?? prop.defaultValue)).map((prop) => prop.displayName);
7857
- }
7858
- function missingForBlock(form, config, connectionId) {
7859
- if (!form || form === "loading") return [];
7860
- const missing = missingRequired(form.props, config);
7861
- if (form.auth === "required" && !connectionId) missing.unshift("Connection");
7862
- return missing;
8089
+ function PropLayout(props) {
8090
+ const groups = (props.groups ?? []).filter((group) => PLACED.has(group.display) || group.display === "summary");
8091
+ const byName = new Map(props.props.map((prop) => [prop.name, prop]));
8092
+ const groupOf = /* @__PURE__ */ new Map();
8093
+ for (const group of groups) {
8094
+ if (!PLACED.has(group.display)) continue;
8095
+ for (const name of group.props) if (byName.has(name) && !groupOf.has(name)) groupOf.set(name, group);
8096
+ }
8097
+ const membersOf = (group) => group.props.map((name) => byName.get(name)).filter((prop) => prop !== void 0);
8098
+ const builderGroups = groups.filter((group) => group.display === "builder");
8099
+ const summaries = groups.filter((group) => group.display === "summary");
8100
+ const sectionMembers = groups.filter((group) => group.display === "section").flatMap(membersOf);
8101
+ const blocks = [];
8102
+ let loose = [];
8103
+ const flushLoose = () => {
8104
+ if (loose.length === 0) return;
8105
+ blocks.push(/* @__PURE__ */ jsx(FieldList, {
8106
+ members: loose,
8107
+ layout: props
8108
+ }, `loose:${loose[0].name}`));
8109
+ loose = [];
8110
+ };
8111
+ const summarised = summaries.length > 0 && sectionMembers.length > 0;
8112
+ const placed = /* @__PURE__ */ new Set();
8113
+ for (const prop of props.props) {
8114
+ const group = groupOf.get(prop.name);
8115
+ if (!group) {
8116
+ loose.push(prop);
8117
+ continue;
8118
+ }
8119
+ const key = group.display === "builder" ? "builder" : group.key;
8120
+ if (placed.has(key)) continue;
8121
+ placed.add(key);
8122
+ flushLoose();
8123
+ if (group.display === "builder") blocks.push(/* @__PURE__ */ jsx(BuilderGroups, {
8124
+ groups: builderGroups,
8125
+ byName,
8126
+ layout: props
8127
+ }, "builder"));
8128
+ else if (group.display === "tabs") blocks.push(/* @__PURE__ */ jsx(TabbedGroup, {
8129
+ group,
8130
+ members: membersOf(group),
8131
+ layout: props
8132
+ }, group.key));
8133
+ else if (group.display === "footer") blocks.push(/* @__PURE__ */ jsxs("div", {
8134
+ className: "flex flex-col gap-4 border-t border-solid border-foreground/10 pt-4",
8135
+ children: [/* @__PURE__ */ jsx(GroupHeading, { group }), /* @__PURE__ */ jsx(FieldList, {
8136
+ members: membersOf(group),
8137
+ layout: props
8138
+ })]
8139
+ }, group.key));
8140
+ else {
8141
+ if (summarised && !placed.has("summary")) {
8142
+ placed.add("summary");
8143
+ blocks.push(/* @__PURE__ */ jsx(Summary, {
8144
+ members: sectionMembers,
8145
+ layout: props
8146
+ }, "summary"));
8147
+ }
8148
+ blocks.push(/* @__PURE__ */ jsx(Section$1, {
8149
+ group,
8150
+ members: membersOf(group),
8151
+ layout: props
8152
+ }, group.key));
8153
+ }
8154
+ }
8155
+ flushLoose();
8156
+ return /* @__PURE__ */ jsx(Fragment$1, { children: blocks });
7863
8157
  }
7864
8158
  //#endregion
7865
8159
  //#region editors/workflow-editor/ui/PropertyForm.tsx
@@ -7885,7 +8179,9 @@ function parseDropdownResult(result) {
7885
8179
  return {
7886
8180
  options: record.options.map((option) => ({
7887
8181
  label: stringifyValue$1(option.label ?? option.value),
7888
- value: option.value
8182
+ value: option.value,
8183
+ ...typeof option.description === "string" && option.description ? { description: option.description } : {},
8184
+ ...typeof option.icon === "string" ? { icon: option.icon } : {}
7889
8185
  })),
7890
8186
  placeholder: record.placeholder,
7891
8187
  disabled: record.disabled
@@ -7936,7 +8232,7 @@ function useResolvedProp(load, parse, key) {
7936
8232
  reload: () => setAttempt((value) => value + 1)
7937
8233
  };
7938
8234
  }
7939
- const PieceMarkdown = lazy(() => import("./PieceMarkdown-DIxZY5aG.mjs"));
8235
+ const PieceMarkdown = lazy(() => import("./PieceMarkdown-BMhBGa4t.mjs"));
7940
8236
  const NO_ENDPOINT = "[no endpoint yet — see Endpoint URL above]";
7941
8237
  function fillPiecePlaceholders(text, values) {
7942
8238
  return text.replace(/\{\{\s*webhookUrl\s*\}\}/g, values.webhookUrl ?? NO_ENDPOINT).replace(/\{\{\s*webhookTimeoutSeconds\s*\}\}/g, values.webhookTimeoutSeconds === void 0 ? "{{webhookTimeoutSeconds}}" : String(values.webhookTimeoutSeconds));
@@ -7960,6 +8256,7 @@ function FieldShell(props) {
7960
8256
  htmlFor: props.htmlFor,
7961
8257
  className: "flex min-w-0 items-baseline gap-1.5 text-[13px] font-medium text-foreground",
7962
8258
  children: [
8259
+ optionIcon(prop.icon),
7963
8260
  /* @__PURE__ */ jsx("span", {
7964
8261
  className: "truncate",
7965
8262
  children: prop.displayName
@@ -8009,7 +8306,9 @@ function OptionSelect(props) {
8009
8306
  id: props.id,
8010
8307
  options: props.options.map((option) => ({
8011
8308
  value: keyOf(option.value),
8012
- label: option.label
8309
+ label: option.label,
8310
+ description: option.description,
8311
+ icon: optionIcon(option.icon)
8013
8312
  })),
8014
8313
  value: keyOf(props.value),
8015
8314
  onChange: (key) => props.onChange(key === "" ? void 0 : byKey.get(key)?.value ?? key),
@@ -8019,7 +8318,10 @@ function OptionSelect(props) {
8019
8318
  disabled: props.disabled,
8020
8319
  onRefresh: props.onRefresh,
8021
8320
  clearable: props.clearable,
8022
- emptyText: props.emptyText
8321
+ emptyText: props.emptyText,
8322
+ searchable: props.searchable,
8323
+ actions: props.actions,
8324
+ onQueryChange: props.onQueryChange
8023
8325
  });
8024
8326
  }
8025
8327
  function ArrayRows(props) {
@@ -8134,6 +8436,15 @@ function localInputToIso(value) {
8134
8436
  const date = new Date(value);
8135
8437
  return Number.isNaN(date.getTime()) ? value : date.toISOString();
8136
8438
  }
8439
+ function isDropdownType(type) {
8440
+ return type === "DROPDOWN" || type === "MULTI_SELECT_DROPDOWN";
8441
+ }
8442
+ const SEARCH_DEBOUNCE_MS = 300;
8443
+ const FLIPS_TO_TEXT = /* @__PURE__ */ new Set([
8444
+ "DATE_TIME",
8445
+ "OBJECT",
8446
+ "DROPDOWN"
8447
+ ]);
8137
8448
  const TEXT_MODE_TYPES = /* @__PURE__ */ new Set([
8138
8449
  "SHORT_TEXT",
8139
8450
  "LONG_TEXT",
@@ -8142,7 +8453,8 @@ const TEXT_MODE_TYPES = /* @__PURE__ */ new Set([
8142
8453
  "FILE",
8143
8454
  "JSON",
8144
8455
  "DATE_TIME",
8145
- "OBJECT"
8456
+ "OBJECT",
8457
+ "DROPDOWN"
8146
8458
  ]);
8147
8459
  const SECRET_REF_PREFIX = "secret://v1:";
8148
8460
  function SecretRefField(props) {
@@ -8255,7 +8567,7 @@ function PropField(props) {
8255
8567
  stepId: props.scopeStepId,
8256
8568
  label: prop.displayName,
8257
8569
  insert: (expression) => {
8258
- if ((prop.type === "DATE_TIME" || prop.type === "OBJECT") && !textMode) {
8570
+ if (FLIPS_TO_TEXT.has(prop.type) && !textMode) {
8259
8571
  setTextMode(true);
8260
8572
  setDraft(expression);
8261
8573
  onCommit(expression);
@@ -8274,6 +8586,33 @@ function PropField(props) {
8274
8586
  const dynamicLoad = props.loadOptions && prop.hasDynamicResolver ? () => props.loadOptions(prop.name) : void 0;
8275
8587
  const dropdown = useResolvedProp(prop.type === "DROPDOWN" || prop.type === "MULTI_SELECT_DROPDOWN" ? dynamicLoad : void 0, parseDropdownResult, props.refresherKey);
8276
8588
  const dynamic = useResolvedProp(prop.type === "DYNAMIC" ? dynamicLoad : void 0, parseDescriptorList, props.refresherKey);
8589
+ const [search, setSearch] = useState({
8590
+ query: "",
8591
+ result: null
8592
+ });
8593
+ const searchTimer = useRef(void 0);
8594
+ const [picked, setPicked] = useState(null);
8595
+ const loadOptions = props.loadOptions;
8596
+ const onSearch = prop.refreshOnSearch && loadOptions ? (query) => {
8597
+ clearTimeout(searchTimer.current);
8598
+ if (query.trim() === "") {
8599
+ setSearch({
8600
+ query: "",
8601
+ result: null
8602
+ });
8603
+ return;
8604
+ }
8605
+ setSearch((current) => ({
8606
+ ...current,
8607
+ query
8608
+ }));
8609
+ searchTimer.current = setTimeout(() => {
8610
+ loadOptions(prop.name, query).then((raw) => setSearch((current) => current.query === query ? {
8611
+ query,
8612
+ result: parseDropdownResult(raw)
8613
+ } : current), () => void 0);
8614
+ }, SEARCH_DEBOUNCE_MS);
8615
+ } : void 0;
8277
8616
  const retryButton = (state, reload) => /* @__PURE__ */ jsx(IconButton, {
8278
8617
  icon: "retry",
8279
8618
  label: "Reload",
@@ -8304,36 +8643,17 @@ function PropField(props) {
8304
8643
  invalid,
8305
8644
  secrets: props.secrets
8306
8645
  });
8307
- case "PH_AUTOCOMPLETE": return /* @__PURE__ */ jsx(FieldShell, {
8308
- htmlFor: fieldId,
8309
- prop,
8310
- invalid,
8311
- children: /* @__PURE__ */ jsx(AutocompleteInput, {
8312
- id: fieldId,
8313
- className: `${textInputClass} ${invalid ? invalidClass : ""}`,
8314
- value: typeof value === "string" ? value : stringifyValue$1(value),
8315
- onCommit: (next) => onCommit(next === "" ? void 0 : next),
8316
- loadOptions: props.loadOptions ? () => props.loadOptions(prop.name) : void 0
8317
- })
8318
- });
8319
- case "PH_ACTIONS": return /* @__PURE__ */ jsx(FieldShell, {
8320
- htmlFor: fieldId,
8321
- prop,
8322
- invalid,
8323
- children: /* @__PURE__ */ jsx(ActionListEditor, {
8324
- value,
8325
- onCommit,
8326
- loadActionTypes: props.loadOptions ? () => props.loadOptions("actionType") : void 0
8327
- })
8328
- });
8329
8646
  case "MARKDOWN": {
8330
8647
  const markdown = fillPiecePlaceholders(stringifyValue$1(prop.description ?? prop.defaultValue ?? prop.displayName), { webhookUrl: props.webhookUrl });
8331
- return /* @__PURE__ */ jsx(Suspense, {
8332
- fallback: /* @__PURE__ */ jsx("p", {
8333
- className: "whitespace-pre-wrap rounded-md bg-muted px-3 py-2 text-xs text-muted-foreground",
8334
- children: markdown
8335
- }),
8336
- children: /* @__PURE__ */ jsx(PieceMarkdown, { text: markdown })
8648
+ return /* @__PURE__ */ jsx(MarkdownCallout, {
8649
+ variant: prop.variant,
8650
+ children: /* @__PURE__ */ jsx(Suspense, {
8651
+ fallback: /* @__PURE__ */ jsx("p", {
8652
+ className: "whitespace-pre-wrap text-xs text-muted-foreground",
8653
+ children: markdown
8654
+ }),
8655
+ children: /* @__PURE__ */ jsx(PieceMarkdown, { text: markdown })
8656
+ })
8337
8657
  });
8338
8658
  }
8339
8659
  case "CHECKBOX": return /* @__PURE__ */ jsx(Switch, {
@@ -8342,18 +8662,42 @@ function PropField(props) {
8342
8662
  label: prop.displayName,
8343
8663
  description: prop.description
8344
8664
  });
8345
- case "NUMBER": return /* @__PURE__ */ jsx(FieldShell, {
8346
- htmlFor: fieldId,
8347
- prop,
8348
- invalid,
8349
- picker,
8350
- children: textInput({ commit: (raw) => {
8351
- const trimmed = raw.trim();
8352
- if (trimmed === "") return onCommit(void 0);
8353
- const parsed = Number(trimmed);
8354
- onCommit(Number.isFinite(parsed) ? parsed : trimmed);
8355
- } })
8356
- });
8665
+ case "NUMBER": {
8666
+ const rangeError = numberRangeError(value, prop.min, prop.max);
8667
+ if (prop.display === "stepper") return /* @__PURE__ */ jsx(FieldShell, {
8668
+ htmlFor: fieldId,
8669
+ prop,
8670
+ invalid,
8671
+ picker,
8672
+ error: rangeError,
8673
+ children: /* @__PURE__ */ jsx(NumberStepper, {
8674
+ id: fieldId,
8675
+ value,
8676
+ min: prop.min,
8677
+ max: prop.max,
8678
+ step: prop.step,
8679
+ invalid: invalid || rangeError !== null,
8680
+ onCommit,
8681
+ onFocus: field.focus
8682
+ })
8683
+ });
8684
+ return /* @__PURE__ */ jsx(FieldShell, {
8685
+ htmlFor: fieldId,
8686
+ prop,
8687
+ invalid,
8688
+ picker,
8689
+ error: rangeError,
8690
+ children: textInput({
8691
+ placeholder: prop.placeholder ?? numberRangeText(prop.min, prop.max) ?? void 0,
8692
+ commit: (raw) => {
8693
+ const trimmed = raw.trim();
8694
+ if (trimmed === "") return onCommit(void 0);
8695
+ const parsed = Number(trimmed);
8696
+ onCommit(Number.isFinite(parsed) ? parsed : trimmed);
8697
+ }
8698
+ })
8699
+ });
8700
+ }
8357
8701
  case "SECRET_TEXT": return /* @__PURE__ */ jsx(FieldShell, {
8358
8702
  htmlFor: fieldId,
8359
8703
  prop,
@@ -8410,7 +8754,21 @@ function PropField(props) {
8410
8754
  });
8411
8755
  case "STATIC_DROPDOWN": {
8412
8756
  const options = prop.staticOptions ?? [];
8413
- if (prop.required !== true && prop.defaultValue !== void 0 && options.length >= 2 && options.length <= 3 && options.every((option) => option.label.length <= 22)) return /* @__PURE__ */ jsx(FieldShell, {
8757
+ if (prop.display === "cards") return /* @__PURE__ */ jsx(FieldShell, {
8758
+ htmlFor: fieldId,
8759
+ prop,
8760
+ invalid,
8761
+ children: /* @__PURE__ */ jsx(OptionCards, {
8762
+ id: fieldId,
8763
+ options,
8764
+ value,
8765
+ keyOf: stringifyValue$1,
8766
+ onChange: onCommit,
8767
+ invalid,
8768
+ clearable: !prop.required
8769
+ })
8770
+ });
8771
+ if (!prop.staticDisabled && prop.required !== true && prop.defaultValue !== void 0 && options.length >= 2 && options.length <= 3 && options.every((option) => option.label.length <= 22)) return /* @__PURE__ */ jsx(FieldShell, {
8414
8772
  htmlFor: fieldId,
8415
8773
  prop,
8416
8774
  invalid: false,
@@ -8433,7 +8791,8 @@ function PropField(props) {
8433
8791
  value,
8434
8792
  onChange: onCommit,
8435
8793
  invalid,
8436
- placeholder: prop.placeholder,
8794
+ placeholder: prop.staticPlaceholder ?? prop.placeholder,
8795
+ disabled: prop.staticDisabled && isEmptyValue(value),
8437
8796
  clearable: !prop.required
8438
8797
  })
8439
8798
  });
@@ -8451,26 +8810,59 @@ function PropField(props) {
8451
8810
  })
8452
8811
  });
8453
8812
  case "DROPDOWN": {
8454
- const result = dropdown.state.kind === "ready" ? dropdown.state.result : null;
8455
- const current = stringifyValue$1(value);
8813
+ if (textMode) return /* @__PURE__ */ jsx(FieldShell, {
8814
+ htmlFor: fieldId,
8815
+ prop,
8816
+ invalid,
8817
+ picker: /* @__PURE__ */ jsxs(Fragment$1, { children: [picker, /* @__PURE__ */ jsx("button", {
8818
+ type: "button",
8819
+ className: "inline-flex h-6 shrink-0 items-center rounded-md px-1.5 text-xs font-medium text-muted-foreground hover:bg-accent hover:text-foreground",
8820
+ onClick: () => {
8821
+ setTextMode(false);
8822
+ if (hasExpressions(value)) onCommit(void 0);
8823
+ },
8824
+ children: "Pick from list"
8825
+ })] }),
8826
+ children: textInput({
8827
+ mono: true,
8828
+ placeholder: "{{steps.…}} or an id",
8829
+ commit: (raw) => onCommit(raw.trim() === "" ? void 0 : raw)
8830
+ })
8831
+ });
8832
+ const result = search.result ?? (dropdown.state.kind === "ready" ? dropdown.state.result : null);
8833
+ const listed = result?.options ?? [];
8834
+ const options = picked !== null && stringifyValue$1(picked.value) === stringifyValue$1(value) && !listed.some((option) => stringifyValue$1(option.value) === stringifyValue$1(value)) ? [...listed, picked] : listed;
8456
8835
  return /* @__PURE__ */ jsx(FieldShell, {
8457
8836
  htmlFor: fieldId,
8458
8837
  prop,
8459
8838
  invalid,
8460
8839
  error: loadError(dropdown.state),
8461
- picker: optionsUnavailable ? /* @__PURE__ */ jsx(AvailableSoon, {}) : void 0,
8840
+ picker: optionsUnavailable ? /* @__PURE__ */ jsx(AvailableSoon, {}) : picker,
8462
8841
  children: /* @__PURE__ */ jsx(OptionSelect, {
8463
8842
  id: fieldId,
8464
- options: result?.options ?? [],
8843
+ options,
8465
8844
  value,
8466
- onChange: onCommit,
8845
+ onChange: (next) => {
8846
+ setPicked(listed.find((option) => stringifyValue$1(option.value) === stringifyValue$1(next)) ?? null);
8847
+ onCommit(next);
8848
+ },
8467
8849
  invalid,
8468
8850
  loading: dropdown.state.kind === "loading",
8469
- disabled: result?.disabled && !current || optionsUnavailable,
8851
+ disabled: result?.disabled && !stringifyValue$1(value) || optionsUnavailable,
8470
8852
  onRefresh: dynamicLoad ? dropdown.reload : void 0,
8471
8853
  clearable: !prop.required,
8854
+ searchable: true,
8855
+ onQueryChange: onSearch,
8856
+ actions: [{
8857
+ label: "Use data from an earlier step",
8858
+ icon: "braces",
8859
+ onSelect: () => {
8860
+ setTextMode(true);
8861
+ field.focus();
8862
+ }
8863
+ }],
8472
8864
  emptyText: result?.placeholder ?? "Nothing to choose from yet. Some lists need a connection first.",
8473
- placeholder: optionsUnavailable ? "Options for nested fields are available soon" : result?.placeholder ?? prop.placeholder
8865
+ placeholder: optionsUnavailable ? "Options for nested fields are available soon" : result?.placeholder ?? prop.placeholder ?? "Choose…"
8474
8866
  })
8475
8867
  });
8476
8868
  }
@@ -8532,7 +8924,7 @@ function PropField(props) {
8532
8924
  })
8533
8925
  }) : fields ? /* @__PURE__ */ jsx("p", {
8534
8926
  className: "text-xs text-muted-foreground",
8535
- children: "No properties for the current selection."
8927
+ children: props.waitingOn ? `Pick ${props.waitingOn} first; its fields show here.` : "No properties for the current selection."
8536
8928
  }) : null
8537
8929
  });
8538
8930
  }
@@ -8606,19 +8998,51 @@ function PropField(props) {
8606
8998
  invalid
8607
8999
  })
8608
9000
  });
9001
+ case "DATE_RANGE": return /* @__PURE__ */ jsx(FieldShell, {
9002
+ htmlFor: fieldId,
9003
+ prop,
9004
+ invalid,
9005
+ children: /* @__PURE__ */ jsx(DateRangeField, {
9006
+ id: fieldId,
9007
+ value,
9008
+ dropdown: prop.display === "dropdown",
9009
+ invalid,
9010
+ clearable: !prop.required,
9011
+ onCommit
9012
+ })
9013
+ });
9014
+ case "COLOR": return /* @__PURE__ */ jsx(FieldShell, {
9015
+ htmlFor: fieldId,
9016
+ prop,
9017
+ invalid,
9018
+ picker,
9019
+ children: /* @__PURE__ */ jsx(ColorField, {
9020
+ id: fieldId,
9021
+ value,
9022
+ invalid,
9023
+ onCommit,
9024
+ onFocus: field.focus
9025
+ })
9026
+ });
9027
+ case "RICH_TEXT":
8609
9028
  case "LONG_TEXT":
9029
+ case "CUSTOM":
8610
9030
  case "JSON": {
8611
- const isJson = prop.type === "JSON";
9031
+ const isJson = prop.type === "JSON" || prop.type === "CUSTOM";
9032
+ const mode = prop.type === "RICH_TEXT" ? richTextMode(prop.formatProperty ? props.config?.[prop.formatProperty] : "") : null;
8612
9033
  return /* @__PURE__ */ jsxs(FieldShell, {
8613
9034
  htmlFor: fieldId,
8614
9035
  prop,
8615
9036
  invalid,
8616
- picker,
9037
+ picker: mode ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
9038
+ className: "rounded bg-muted px-1.5 text-[11px] text-muted-foreground",
9039
+ children: mode === "html" ? "HTML" : mode === "markdown" ? "Markdown" : "Plain text"
9040
+ }), picker] }) : picker,
8617
9041
  error: jsonError,
8618
9042
  children: [/* @__PURE__ */ jsx("textarea", {
8619
9043
  id: fieldId,
8620
9044
  ref: fieldRef,
8621
- className: `${textAreaClass} ${isJson ? "font-mono text-xs" : ""} ${invalid ? invalidClass : ""}`,
9045
+ className: `${textAreaClass} ${isJson || mode === "html" ? "font-mono text-xs" : ""} ${mode ? "min-h-32" : ""} ${invalid ? invalidClass : ""}`,
8622
9046
  defaultValue: stringifyValue$1(value),
8623
9047
  placeholder: prop.placeholder,
8624
9048
  spellCheck: false,
@@ -8674,6 +9098,9 @@ function PropertyForm(props) {
8674
9098
  const next = { ...current };
8675
9099
  if (value === void 0) delete next[name];
8676
9100
  else next[name] = value;
9101
+ if (value !== current[name]) {
9102
+ for (const dependent of props.props) if (isDropdownType(dependent.type) && dependent.refreshers?.includes(name)) delete next[dependent.name];
9103
+ }
8677
9104
  setCurrent(next);
8678
9105
  props.onChange(next);
8679
9106
  };
@@ -8686,16 +9113,24 @@ function PropertyForm(props) {
8686
9113
  prop,
8687
9114
  value: current[prop.name] ?? prop.defaultValue,
8688
9115
  onCommit: (value) => commitField(prop.name, value),
8689
- loadOptions: props.loadOptions ? (propName) => props.loadOptions(propName, current) : void 0,
9116
+ loadOptions: props.loadOptions ? (propName, searchValue) => props.loadOptions(propName, current, searchValue) : void 0,
9117
+ config: current,
8690
9118
  secrets: props.secrets,
8691
9119
  scopeStepId: props.scopeStepId,
8692
9120
  refresherKey: refresherKeyFor(prop, current, props.connectionId),
9121
+ waitingOn: props.props.find((sibling) => prop.refreshers?.includes(sibling.name) && isEmptyValue(current[sibling.name]))?.displayName,
8693
9122
  nested: props.nested,
8694
9123
  webhookUrl: props.webhookUrl
8695
9124
  }, prop.name);
8696
9125
  return /* @__PURE__ */ jsxs("div", {
8697
9126
  className: `flex flex-col ${props.nested ? "gap-4" : "gap-5"}`,
8698
- children: [essential.map(field), advanced.length > 0 ? /* @__PURE__ */ jsxs("div", {
9127
+ children: [/* @__PURE__ */ jsx(PropLayout, {
9128
+ props: essential,
9129
+ groups: props.groups,
9130
+ values: current,
9131
+ renderField: field,
9132
+ onCommit: commitField
9133
+ }), advanced.length > 0 ? /* @__PURE__ */ jsxs("div", {
8699
9134
  className: "flex flex-col gap-5 border-t border-solid border-foreground/10 pt-4",
8700
9135
  children: [/* @__PURE__ */ jsxs("button", {
8701
9136
  type: "button",
@@ -8716,7 +9151,13 @@ function PropertyForm(props) {
8716
9151
  }), /* @__PURE__ */ jsx("div", {
8717
9152
  hidden: !showAdvanced,
8718
9153
  className: "flex flex-col gap-5",
8719
- children: advanced.map(field)
9154
+ children: /* @__PURE__ */ jsx(PropLayout, {
9155
+ props: advanced,
9156
+ groups: props.groups,
9157
+ values: current,
9158
+ renderField: field,
9159
+ onCommit: commitField
9160
+ })
8720
9161
  })]
8721
9162
  }) : null]
8722
9163
  });
@@ -9092,19 +9533,33 @@ function ConfigSection(props) {
9092
9533
  return /* @__PURE__ */ jsxs("div", {
9093
9534
  className: "flex flex-col gap-5",
9094
9535
  children: [
9536
+ form?.description || form?.classification === "DESTRUCTIVE" ? /* @__PURE__ */ jsxs("div", {
9537
+ className: "flex flex-col gap-2",
9538
+ children: [form.classification === "DESTRUCTIVE" ? /* @__PURE__ */ jsxs("span", {
9539
+ className: "inline-flex items-center gap-1 self-start rounded-full bg-wf-fail/10 px-2 py-0.5 text-[11px] font-medium text-wf-fail",
9540
+ children: [/* @__PURE__ */ jsx(Icon, {
9541
+ name: "alert",
9542
+ className: "h-3 w-3"
9543
+ }), "Changes or deletes data"]
9544
+ }) : null, form.description ? /* @__PURE__ */ jsx("p", {
9545
+ className: "text-[13px] leading-relaxed text-muted-foreground",
9546
+ children: form.description
9547
+ }) : null]
9548
+ }) : null,
9095
9549
  props.formError ? /* @__PURE__ */ jsx("p", {
9096
9550
  className: "rounded-md bg-wf-fail/10 px-3 py-2 text-xs text-wf-fail",
9097
9551
  children: props.formError
9098
9552
  }) : null,
9099
9553
  form && form.props.length > 0 ? /* @__PURE__ */ jsx(PropertyForm, {
9100
9554
  props: form.props,
9555
+ groups: form.propertyGroups,
9101
9556
  value: configRecord,
9102
9557
  onChange: props.onChange,
9103
9558
  scopeStepId: props.scopeStepId,
9104
9559
  connectionId: props.connectionId,
9105
9560
  secrets: props.designTime?.secrets,
9106
9561
  webhookUrl: props.webhookUrl,
9107
- loadOptions: props.designTime ? (propName, current) => props.designTime.loadOptions(props.blockType, propName, current, props.connectionId) : void 0
9562
+ loadOptions: props.designTime ? (propName, current, searchValue) => props.designTime.loadOptions(props.blockType, propName, current, props.connectionId, searchValue) : void 0
9108
9563
  }) : null,
9109
9564
  form && form.props.length === 0 ? /* @__PURE__ */ jsx("p", {
9110
9565
  className: "text-[13px] text-muted-foreground",
@@ -9582,7 +10037,9 @@ function StepSettings(props) {
9582
10037
  });
9583
10038
  }
9584
10039
  }),
10040
+ props.errorHandling?.retryOnFailure?.defaultValue ? /* @__PURE__ */ jsx(Hint, { children: "This piece suggests retrying the step when it fails." }) : null,
9585
10041
  /* @__PURE__ */ jsxs("fieldset", {
10042
+ hidden: props.errorHandling?.retryOnFailure?.hide === true,
9586
10043
  disabled: true,
9587
10044
  className: "m-0 flex min-w-0 flex-col gap-4 rounded-lg border border-dashed border-foreground/15 p-3",
9588
10045
  children: [/* @__PURE__ */ jsx("legend", {
@@ -9835,6 +10292,7 @@ function StepPanel(props) {
9835
10292
  step,
9836
10293
  model: props.model,
9837
10294
  callbacks,
10295
+ errorHandling: form && form !== "loading" ? form.errorHandling : void 0,
9838
10296
  onRemoved: props.onClose
9839
10297
  })
9840
10298
  })]
@@ -21086,127 +21544,6 @@ function ResizeControl({ nodeId, position, variant = ResizeControlVariant.Handle
21086
21544
  }
21087
21545
  memo(ResizeControl);
21088
21546
  //#endregion
21089
- //#region editors/workflow-editor/ui/blocks.ts
21090
- const TRIGGER_PRESETS = [
21091
- {
21092
- label: "Manual",
21093
- blockType: "core#manual",
21094
- group: "core",
21095
- description: "Fired on demand with a payload.",
21096
- defaultConfig: {}
21097
- },
21098
- {
21099
- label: "Schedule",
21100
- blockType: "core#schedule",
21101
- group: "core",
21102
- description: "Fires on a cron expression or fixed interval.",
21103
- defaultConfig: {
21104
- mode: "cron",
21105
- cron: "0 9 * * 1-5",
21106
- timezone: "UTC"
21107
- }
21108
- },
21109
- {
21110
- label: "Webhook",
21111
- blockType: "core#webhook",
21112
- group: "core",
21113
- description: "Fires when a provider POSTs to this workflow's URL.",
21114
- defaultConfig: {
21115
- methods: "POST",
21116
- scheme: "none",
21117
- responseMode: "async"
21118
- }
21119
- },
21120
- {
21121
- label: "Document event",
21122
- blockType: `${REACTOR_PIECE}#trigger:document-event`,
21123
- group: "powerhouse",
21124
- description: "Fires when a matching document operation lands.",
21125
- defaultConfig: {}
21126
- },
21127
- {
21128
- label: "Document created",
21129
- blockType: `${REACTOR_PIECE}#trigger:document-created`,
21130
- group: "powerhouse",
21131
- description: "Fires when a document is added to a drive.",
21132
- defaultConfig: {}
21133
- },
21134
- {
21135
- label: "Document deleted",
21136
- blockType: `${REACTOR_PIECE}#trigger:document-deleted`,
21137
- group: "powerhouse",
21138
- description: "Fires when a document is removed from a drive.",
21139
- defaultConfig: {}
21140
- }
21141
- ];
21142
- const STEP_PRESETS = [
21143
- {
21144
- label: "Branch",
21145
- blockType: "core#branch",
21146
- group: "core",
21147
- description: "Routes true/false on a condition.",
21148
- defaultConfig: { condition: "{{trigger.payload.ok}}" }
21149
- },
21150
- {
21151
- label: "Assert",
21152
- blockType: "core#assert",
21153
- group: "core",
21154
- description: "Fails the run when a value is blank, rejected or not allowed.",
21155
- defaultConfig: {
21156
- value: "",
21157
- allowValues: []
21158
- }
21159
- },
21160
- {
21161
- label: "Create document",
21162
- blockType: `${REACTOR_PIECE}#document-create`,
21163
- group: "powerhouse",
21164
- description: "Creates a Powerhouse document.",
21165
- defaultConfig: {
21166
- documentType: "",
21167
- name: ""
21168
- }
21169
- },
21170
- {
21171
- label: "Dispatch actions",
21172
- blockType: `${REACTOR_PIECE}#document-dispatch`,
21173
- group: "powerhouse",
21174
- description: "Sends actions to a document.",
21175
- defaultConfig: {
21176
- documentId: "",
21177
- actions: []
21178
- }
21179
- },
21180
- {
21181
- label: "Get document",
21182
- blockType: `${REACTOR_PIECE}#document-get`,
21183
- group: "powerhouse",
21184
- description: "Reads a document's current state.",
21185
- defaultConfig: { documentId: "" }
21186
- },
21187
- {
21188
- label: "Find documents",
21189
- blockType: `${REACTOR_PIECE}#document-find`,
21190
- group: "powerhouse",
21191
- description: "Lists documents by type and name.",
21192
- defaultConfig: { documentType: "" }
21193
- },
21194
- {
21195
- label: "List document types",
21196
- blockType: `${REACTOR_PIECE}#document-types`,
21197
- group: "powerhouse",
21198
- description: "Document models installed on this reactor.",
21199
- defaultConfig: {}
21200
- },
21201
- {
21202
- label: "Get document schema",
21203
- blockType: `${REACTOR_PIECE}#document-schema`,
21204
- group: "powerhouse",
21205
- description: "Action and state schemas of a document type.",
21206
- defaultConfig: { documentType: "" }
21207
- }
21208
- ];
21209
- //#endregion
21210
21547
  //#region editors/workflow-editor/ui/step-drag.ts
21211
21548
  function moveRejection(model, move) {
21212
21549
  if (move.stepId === move.toParentId) return "self";
@@ -22052,4 +22389,4 @@ function Editor() {
22052
22389
  //#endregion
22053
22390
  export { Editor as default };
22054
22391
 
22055
- //# sourceMappingURL=editor-B2ZoeGue.mjs.map
22392
+ //# sourceMappingURL=editor-DP36YDk5.mjs.map