@powerhousedao/workflow 6.2.3-dev.49 → 6.2.3-dev.51
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/browser/{BlockSelector-D9Wg49c_.js → BlockSelector-CzJnQWsh.js} +1179 -256
- package/dist/browser/BlockSelector-CzJnQWsh.js.map +1 -0
- package/dist/browser/assets/{entry-CnkwwnNv.js → entry-BETsJgYg.js} +3 -2
- package/dist/browser/assets/{projection-entry-CAGnE-12.js → projection-entry-CdlLTrjU.js} +3 -2
- package/dist/browser/{connection-form-Deth9pL1.js → connection-form-cCgfAa1A.js} +3 -3
- package/dist/browser/{connection-form-Deth9pL1.js.map → connection-form-cCgfAa1A.js.map} +1 -1
- package/dist/browser/{data-tree-Cw9dKR16.js → data-tree-S_SwaRve.js} +2 -2
- package/dist/browser/{data-tree-Cw9dKR16.js.map → data-tree-S_SwaRve.js.map} +1 -1
- package/dist/browser/document-models/index.js +2 -2
- package/dist/browser/document-models/workflow/index.js +2 -2
- package/dist/browser/{document-models-B7IwLbfO.js → document-models-B08jDa_s.js} +27 -3
- package/dist/browser/{document-models-B7IwLbfO.js.map → document-models-B08jDa_s.js.map} +1 -1
- package/dist/browser/{editor-B1KotawV.js → editor-CQyfDOIN.js} +61 -31
- package/dist/browser/editor-CQyfDOIN.js.map +1 -0
- package/dist/browser/{editor-8y31-Vvp.js → editor-CVXRNht0.js} +5 -5
- package/dist/browser/{editor-8y31-Vvp.js.map → editor-CVXRNht0.js.map} +1 -1
- package/dist/{node/editor-CGF4AwQw.mjs → browser/editor-CbpyTAEC.js} +7 -7
- package/dist/{node/editor-CGF4AwQw.mjs.map → browser/editor-CbpyTAEC.js.map} +1 -1
- package/dist/browser/editors/connection-editor/module.js +1 -1
- package/dist/browser/editors/workflow-editor/module.js +1 -1
- package/dist/browser/editors/workflow-studio/module.js +1 -1
- package/dist/browser/index.js +33 -10
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/{module-D4UiG9ii.js → module-ozS5EVRx.js} +2 -2
- package/dist/browser/module-ozS5EVRx.js.map +1 -0
- package/dist/browser/reactor/index.js +2 -2
- package/dist/browser/{runtime-queries-IZG_nonR.js → runtime-queries-2hn7fcKn.js} +18 -12
- package/dist/browser/runtime-queries-2hn7fcKn.js.map +1 -0
- package/dist/browser/{trigger-text-CZvKJJxp.js → trigger-text-Cfyx8tMq.js} +5 -5
- package/dist/browser/{trigger-text-CZvKJJxp.js.map → trigger-text-Cfyx8tMq.js.map} +1 -1
- package/dist/browser/{upgrade-manifests-C_9cyumV.js → upgrade-manifests-DHGmgHKW.js} +2 -2
- package/dist/browser/{upgrade-manifests-C_9cyumV.js.map → upgrade-manifests-DHGmgHKW.js.map} +1 -1
- package/dist/browser/{workflow-DFLQ2cFr.js → workflow-DoewHe4K.js} +2 -2
- package/dist/browser/{workflow-DFLQ2cFr.js.map → workflow-DoewHe4K.js.map} +1 -1
- package/dist/node/{BlockSelector-DTy0Bxvb.mjs → BlockSelector-g9m3yaJj.mjs} +1179 -256
- package/dist/node/BlockSelector-g9m3yaJj.mjs.map +1 -0
- package/dist/node/{connection-form-Bj7pbTyf.mjs → connection-form-h0PidbTI.mjs} +3 -3
- package/dist/node/{connection-form-Bj7pbTyf.mjs.map → connection-form-h0PidbTI.mjs.map} +1 -1
- package/dist/node/{data-tree-UIM5O3VM.mjs → data-tree-CKKeR7qj.mjs} +2 -2
- package/dist/node/{data-tree-UIM5O3VM.mjs.map → data-tree-CKKeR7qj.mjs.map} +1 -1
- package/dist/node/document-models/index.mjs +2 -2
- package/dist/node/document-models/workflow/index.mjs +2 -2
- package/dist/node/{editor-CoNRLOuV.mjs → editor-BAbYXi7T.mjs} +5 -5
- package/dist/node/{editor-CoNRLOuV.mjs.map → editor-BAbYXi7T.mjs.map} +1 -1
- package/dist/node/{editor-Bz2ZN5MI.mjs → editor-DCsT8WsQ.mjs} +61 -31
- package/dist/node/editor-DCsT8WsQ.mjs.map +1 -0
- package/dist/{browser/editor-7K-gL3BU.js → node/editor-EeTeVS3A.mjs} +7 -7
- package/dist/node/editor-EeTeVS3A.mjs.map +1 -0
- package/dist/node/editors/connection-editor/module.mjs +1 -1
- package/dist/node/editors/workflow-editor/module.mjs +1 -1
- package/dist/node/editors/workflow-studio/module.mjs +1 -1
- package/dist/node/index.mjs +58 -11
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/{module-BsqRZox1.mjs → module-uKdoLIga.mjs} +2 -2
- package/dist/node/module-uKdoLIga.mjs.map +1 -0
- package/dist/node/pieces/reactor/descriptor.json +1 -1
- package/dist/node/pieces/reactor/package.json +1 -1
- package/dist/node/{runtime-queries-BM6I7dDA.mjs → runtime-queries-BtTx8FU3.mjs} +18 -12
- package/dist/node/runtime-queries-BtTx8FU3.mjs.map +1 -0
- package/dist/node/{trigger-text-ARkrvW6N.mjs → trigger-text-CtSXg0KB.mjs} +5 -5
- package/dist/node/{trigger-text-ARkrvW6N.mjs.map → trigger-text-CtSXg0KB.mjs.map} +1 -1
- package/dist/node/{upgrade-manifests-CYZfts3a.mjs → upgrade-manifests-D-pLniUG.mjs} +2 -2
- package/dist/node/{upgrade-manifests-CYZfts3a.mjs.map → upgrade-manifests-D-pLniUG.mjs.map} +1 -1
- package/dist/node/{workflow-BpfdBHyS.mjs → workflow-Dy-309pE.mjs} +2 -2
- package/dist/node/{workflow-BpfdBHyS.mjs.map → workflow-Dy-309pE.mjs.map} +1 -1
- package/dist/powerhouse.manifest.json +26 -2
- package/dist/style.css +99 -28
- package/dist/types/ai/tools.d.ts +4 -4
- package/dist/types/ai/tools.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts +13 -6
- package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/runtime-api.d.ts +2 -1
- package/dist/types/editors/workflow-editor/runtime-api.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/runtime-client.d.ts +26 -5
- package/dist/types/editors/workflow-editor/runtime-client.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/runtime-context.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts +15 -2
- package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/CanvasContextMenu.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/PickerPopover.d.ts +12 -0
- package/dist/types/editors/workflow-editor/ui/PickerPopover.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/ScheduleBuilder.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/StepTest.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/VirtualList.d.ts +14 -0
- package/dist/types/editors/workflow-editor/ui/VirtualList.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/ap-nodes.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/block-picker-layout.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/block-picker-layout.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/forms.d.ts +1 -1
- package/dist/types/editors/workflow-editor/ui/forms.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/picker-placement.d.ts +19 -0
- package/dist/types/editors/workflow-editor/ui/picker-placement.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/picker-recent.d.ts +4 -0
- package/dist/types/editors/workflow-editor/ui/picker-recent.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/piece-source.d.ts +23 -3
- package/dist/types/editors/workflow-editor/ui/piece-source.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/query-keys.d.ts +2 -2
- package/dist/types/editors/workflow-editor/ui/query-keys.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/step-test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/step-test.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/RunsTable.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/run-format.d.ts +4 -0
- package/dist/types/editors/workflow-studio/components/run-format.d.ts.map +1 -1
- package/dist/types/scripts/ui-stack.d.ts +1 -1
- package/dist/types/scripts/ui-stack.d.ts.map +1 -1
- package/package.json +10 -10
- package/dist/browser/BlockSelector-D9Wg49c_.js.map +0 -1
- package/dist/browser/editor-7K-gL3BU.js.map +0 -1
- package/dist/browser/editor-B1KotawV.js.map +0 -1
- package/dist/browser/module-D4UiG9ii.js.map +0 -1
- package/dist/browser/runtime-queries-IZG_nonR.js.map +0 -1
- package/dist/node/BlockSelector-DTy0Bxvb.mjs.map +0 -1
- package/dist/node/editor-Bz2ZN5MI.mjs.map +0 -1
- package/dist/node/module-BsqRZox1.mjs.map +0 -1
- package/dist/node/runtime-queries-BM6I7dDA.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as isCoreBlock, A as keepPreviousData, B as Subscribable, C as infiniteQueryBehavior, D as focusManager, E as pendingThenable, F as resolveStaleTime, G as BRANCH_BLOCK, H as createRuntimeClient, I as shallowEqualObjects, L as shouldThrowError, M as replaceData, N as replaceEqualDeep, O as isServer, P as resolveEnabled, Q as WEBHOOK_TRIGGER, R as timeUntilStale, S as hasPreviousPage, T as notifyManager, U as isSyncingError, W as ASSERT_BLOCK, Y as SCHEDULE_TRIGGER, _ as runtimeKeys, a as pieceActionsQuery, b as QueryClient, c as runQuery, d as secretStatQuery, et as pinBlock, g as queryKind, gt as scheduleConfigIssue, h as blockRefKey, j as noop, k as isValidTimeout, lt as checkTriggerStrategy, m as SHARED_STALE_MS, n as catalogQuery, nt as stepBlock, o as pieceTriggersQuery, p as RESOLVER_STALE_MS, q as MANUAL_TRIGGER, r as createRuntimeQueryClient, s as runPagesQuery, u as runsQuery, w as fetchState, x as hasNextPage, z as timeoutManager } from "./runtime-queries-
|
|
2
|
-
import { Rt as blockKey, zt as compareVersions } from "./module-
|
|
1
|
+
import { $ as isCoreBlock, A as keepPreviousData, B as Subscribable, C as infiniteQueryBehavior, D as focusManager, E as pendingThenable, F as resolveStaleTime, G as BRANCH_BLOCK, H as createRuntimeClient, I as shallowEqualObjects, L as shouldThrowError, M as replaceData, N as replaceEqualDeep, O as isServer, P as resolveEnabled, Q as WEBHOOK_TRIGGER, R as timeUntilStale, S as hasPreviousPage, T as notifyManager, U as isSyncingError, W as ASSERT_BLOCK, Y as SCHEDULE_TRIGGER, _ as runtimeKeys, a as pieceActionsQuery, b as QueryClient, c as runQuery, d as secretStatQuery, et as pinBlock, g as queryKind, gt as scheduleConfigIssue, h as blockRefKey, j as noop, k as isValidTimeout, lt as checkTriggerStrategy, m as SHARED_STALE_MS, n as catalogQuery, nt as stepBlock, o as pieceTriggersQuery, p as RESOLVER_STALE_MS, q as MANUAL_TRIGGER, r as createRuntimeQueryClient, s as runPagesQuery, u as runsQuery, w as fetchState, x as hasNextPage, z as timeoutManager } from "./runtime-queries-2hn7fcKn.js";
|
|
2
|
+
import { Rt as blockKey, zt as compareVersions } from "./module-ozS5EVRx.js";
|
|
3
3
|
import * as React$1 from "react";
|
|
4
4
|
import { Component, Fragment, createContext, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
5
5
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -5585,7 +5585,7 @@ function Tooltip(props) {
|
|
|
5585
5585
|
})]
|
|
5586
5586
|
});
|
|
5587
5587
|
}
|
|
5588
|
-
function Tabs(props) {
|
|
5588
|
+
function Tabs$1(props) {
|
|
5589
5589
|
return /* @__PURE__ */ jsx("div", {
|
|
5590
5590
|
role: "tablist",
|
|
5591
5591
|
className: "flex gap-4",
|
|
@@ -5994,7 +5994,7 @@ function usePieceSource() {
|
|
|
5994
5994
|
return useContext(PieceSourceContext);
|
|
5995
5995
|
}
|
|
5996
5996
|
//#endregion
|
|
5997
|
-
//#region ../reactor/dist/drive-container-types-
|
|
5997
|
+
//#region ../reactor/dist/drive-container-types-BAfFzBOf.js
|
|
5998
5998
|
const DRIVE_COLLECTION_PREFIX = "drive.";
|
|
5999
5999
|
/**
|
|
6000
6000
|
* Identifies the collection a remote synchronizes. Collections are drive-level
|
|
@@ -6021,6 +6021,16 @@ var DriveCollectionId = class DriveCollectionId {
|
|
|
6021
6021
|
* The single deserializer for the wire/storage form. `branch` may contain
|
|
6022
6022
|
* dots, while `driveId` is a dot-free document id, so the drive id is the
|
|
6023
6023
|
* final dot-delimited segment.
|
|
6024
|
+
*
|
|
6025
|
+
* That asymmetry is a real constraint, not a convention: a drive id
|
|
6026
|
+
* containing a dot does NOT survive `key` -> `fromKey`, because the split
|
|
6027
|
+
* takes the LAST dot and so hands the tail of the drive id back as the drive
|
|
6028
|
+
* id and everything before it as the branch. The key format is the wire and
|
|
6029
|
+
* storage representation of existing `document_collections` rows, so it
|
|
6030
|
+
* cannot be changed; callers that accept a drive id or branch from outside
|
|
6031
|
+
* (a UI field, an RPC payload) must reject dots in the drive id at their own
|
|
6032
|
+
* boundary. The round-trip is verifiable without parsing rules:
|
|
6033
|
+
* `DriveCollectionId.fromKey(id.key).key === id.key`.
|
|
6024
6034
|
*/
|
|
6025
6035
|
static fromKey(key) {
|
|
6026
6036
|
if (!key.startsWith(DRIVE_COLLECTION_PREFIX)) throw new Error(`Unsupported collection id: ${key}`);
|
|
@@ -6078,6 +6088,7 @@ function useWorkflowRuntimeUrl() {
|
|
|
6078
6088
|
//#endregion
|
|
6079
6089
|
//#region editors/workflow-editor/runtime-context.tsx
|
|
6080
6090
|
const RuntimeContext = createContext(null);
|
|
6091
|
+
const SEARCH_STALE_MS = 3e5;
|
|
6081
6092
|
function runtimePieceSource(client, queryClient) {
|
|
6082
6093
|
return {
|
|
6083
6094
|
loadCatalog: () => queryClient.fetchQuery(catalogQuery(client)),
|
|
@@ -6087,7 +6098,16 @@ function runtimePieceSource(client, queryClient) {
|
|
|
6087
6098
|
}),
|
|
6088
6099
|
loadActions: (packageName) => queryClient.fetchQuery(pieceActionsQuery(client, packageName)),
|
|
6089
6100
|
loadTriggers: (packageName) => queryClient.fetchQuery(pieceTriggersQuery(client, packageName)),
|
|
6090
|
-
|
|
6101
|
+
searchPieces: async (query, filter) => {
|
|
6102
|
+
const key = runtimeKeys.searchPieces(client.url, query, filter);
|
|
6103
|
+
const result = await queryClient.fetchQuery({
|
|
6104
|
+
queryKey: key,
|
|
6105
|
+
queryFn: () => client.searchPieces(query, filter),
|
|
6106
|
+
staleTime: SEARCH_STALE_MS
|
|
6107
|
+
});
|
|
6108
|
+
if (result.status !== "ready") queryClient.removeQueries({ queryKey: key });
|
|
6109
|
+
return result;
|
|
6110
|
+
}
|
|
6091
6111
|
};
|
|
6092
6112
|
}
|
|
6093
6113
|
function RuntimeProvider(props) {
|
|
@@ -6747,7 +6767,8 @@ const RUN_TONE = {
|
|
|
6747
6767
|
const STEP_TONE = {
|
|
6748
6768
|
...RUN_TONE,
|
|
6749
6769
|
SKIPPED: "idle",
|
|
6750
|
-
REPLAYED: "run"
|
|
6770
|
+
REPLAYED: "run",
|
|
6771
|
+
INDETERMINATE: "warn"
|
|
6751
6772
|
};
|
|
6752
6773
|
function runTone(run) {
|
|
6753
6774
|
if (run.status === "SUCCEEDED" && (run.warningNotes?.length ?? 0) > 0) return "warn";
|
|
@@ -6843,6 +6864,10 @@ function runStats(runs) {
|
|
|
6843
6864
|
successRate: finished === 0 ? null : Math.round(succeeded / finished * 100)
|
|
6844
6865
|
};
|
|
6845
6866
|
}
|
|
6867
|
+
const RUN_DEADLINE_ERROR_NAME = "RunDeadlineExceeded";
|
|
6868
|
+
function canRerun(run) {
|
|
6869
|
+
return run.status === "FAILED" || run.status === "CANCELLED" && run.errorName === RUN_DEADLINE_ERROR_NAME;
|
|
6870
|
+
}
|
|
6846
6871
|
//#endregion
|
|
6847
6872
|
//#region editors/workflow-editor/ui/block-meta.ts
|
|
6848
6873
|
const CORE_META = {
|
|
@@ -7101,6 +7126,197 @@ function VersionSummary(props) {
|
|
|
7101
7126
|
});
|
|
7102
7127
|
}
|
|
7103
7128
|
//#endregion
|
|
7129
|
+
//#region editors/workflow-editor/ui/picker-placement.ts
|
|
7130
|
+
const MARGIN = 8;
|
|
7131
|
+
const GAP = 6;
|
|
7132
|
+
const MIN_HEIGHT = 240;
|
|
7133
|
+
function pickerPlacement(anchor, size, viewport) {
|
|
7134
|
+
const width = Math.min(size.width, viewport.width - 16);
|
|
7135
|
+
const below = viewport.height - anchor.bottom - GAP - MARGIN;
|
|
7136
|
+
const above = anchor.top - GAP - MARGIN;
|
|
7137
|
+
const downward = below >= Math.min(size.height, MIN_HEIGHT) || below >= above;
|
|
7138
|
+
const height = Math.max(Math.min(size.height, downward ? below : above), Math.min(size.height, MIN_HEIGHT));
|
|
7139
|
+
const centre = (anchor.left + anchor.right) / 2;
|
|
7140
|
+
const left = Math.min(Math.max(centre - width / 2, MARGIN), viewport.width - width - MARGIN);
|
|
7141
|
+
const top = downward ? Math.min(anchor.bottom + GAP, viewport.height - height - MARGIN) : Math.max(anchor.top - GAP - height, MARGIN);
|
|
7142
|
+
return {
|
|
7143
|
+
left,
|
|
7144
|
+
top: Math.max(top, MARGIN),
|
|
7145
|
+
width,
|
|
7146
|
+
height,
|
|
7147
|
+
above: !downward
|
|
7148
|
+
};
|
|
7149
|
+
}
|
|
7150
|
+
//#endregion
|
|
7151
|
+
//#region editors/workflow-editor/ui/PickerPopover.tsx
|
|
7152
|
+
const PICKER_SIZE = {
|
|
7153
|
+
width: 640,
|
|
7154
|
+
height: 480
|
|
7155
|
+
};
|
|
7156
|
+
function PickerPopover(props) {
|
|
7157
|
+
const [placement, setPlacement] = useState(null);
|
|
7158
|
+
const { anchor, onClose } = props;
|
|
7159
|
+
useLayoutEffect(() => {
|
|
7160
|
+
const place = () => {
|
|
7161
|
+
const rect = anchor.current?.getBoundingClientRect();
|
|
7162
|
+
if (!rect) return;
|
|
7163
|
+
setPlacement(pickerPlacement(rect, PICKER_SIZE, {
|
|
7164
|
+
width: window.innerWidth,
|
|
7165
|
+
height: window.innerHeight
|
|
7166
|
+
}));
|
|
7167
|
+
};
|
|
7168
|
+
place();
|
|
7169
|
+
const onWheel = (event) => {
|
|
7170
|
+
const target = event.target;
|
|
7171
|
+
if (!(target instanceof Element && target.closest("[data-selector-open]"))) onClose();
|
|
7172
|
+
};
|
|
7173
|
+
window.addEventListener("resize", onClose);
|
|
7174
|
+
window.addEventListener("wheel", onWheel, {
|
|
7175
|
+
capture: true,
|
|
7176
|
+
passive: true
|
|
7177
|
+
});
|
|
7178
|
+
return () => {
|
|
7179
|
+
window.removeEventListener("resize", onClose);
|
|
7180
|
+
window.removeEventListener("wheel", onWheel, { capture: true });
|
|
7181
|
+
};
|
|
7182
|
+
}, [anchor, onClose]);
|
|
7183
|
+
const host = anchor.current?.closest(".react-flow")?.parentElement ?? document.body;
|
|
7184
|
+
if (!placement) return null;
|
|
7185
|
+
return createPortal(/* @__PURE__ */ jsx("div", {
|
|
7186
|
+
"data-selector-open": "true",
|
|
7187
|
+
className: "nodrag nopan nowheel fixed z-50 motion-safe:animate-[wf-picker-in_120ms_ease-out]",
|
|
7188
|
+
style: placement.above ? {
|
|
7189
|
+
left: placement.left,
|
|
7190
|
+
bottom: window.innerHeight - placement.top - placement.height,
|
|
7191
|
+
transformOrigin: "bottom center"
|
|
7192
|
+
} : {
|
|
7193
|
+
left: placement.left,
|
|
7194
|
+
top: placement.top,
|
|
7195
|
+
transformOrigin: "top center"
|
|
7196
|
+
},
|
|
7197
|
+
children: props.children(placement)
|
|
7198
|
+
}), host);
|
|
7199
|
+
}
|
|
7200
|
+
//#endregion
|
|
7201
|
+
//#region editors/workflow-editor/ui/picker-recent.ts
|
|
7202
|
+
const STORAGE_KEY = "ph-workflow-picker-recent:v1";
|
|
7203
|
+
const MAX_RECENT = 6;
|
|
7204
|
+
function isStoredPick(value) {
|
|
7205
|
+
const entry = value;
|
|
7206
|
+
const block = entry?.block;
|
|
7207
|
+
return typeof entry?.label === "string" && typeof block?.pieceName === "string" && typeof block.name === "string" && (block.kind === "action" || block.kind === "trigger");
|
|
7208
|
+
}
|
|
7209
|
+
function readAll() {
|
|
7210
|
+
try {
|
|
7211
|
+
const raw = window.localStorage.getItem(STORAGE_KEY);
|
|
7212
|
+
const parsed = raw ? JSON.parse(raw) : [];
|
|
7213
|
+
return Array.isArray(parsed) ? parsed.filter(isStoredPick) : [];
|
|
7214
|
+
} catch {
|
|
7215
|
+
return [];
|
|
7216
|
+
}
|
|
7217
|
+
}
|
|
7218
|
+
function recentPicks(kind) {
|
|
7219
|
+
return readAll().filter((entry) => entry.block.kind === kind).map((entry) => ({
|
|
7220
|
+
label: entry.label,
|
|
7221
|
+
description: entry.description ?? "",
|
|
7222
|
+
block: entry.block,
|
|
7223
|
+
defaultConfig: {}
|
|
7224
|
+
}));
|
|
7225
|
+
}
|
|
7226
|
+
function rememberPick(preset) {
|
|
7227
|
+
const { pieceName, kind, name } = preset.block;
|
|
7228
|
+
const entry = {
|
|
7229
|
+
label: preset.label,
|
|
7230
|
+
description: preset.description,
|
|
7231
|
+
block: {
|
|
7232
|
+
pieceName,
|
|
7233
|
+
kind,
|
|
7234
|
+
name
|
|
7235
|
+
}
|
|
7236
|
+
};
|
|
7237
|
+
const same = (other) => other.block.pieceName === pieceName && other.block.kind === kind && other.block.name === name;
|
|
7238
|
+
const all = readAll();
|
|
7239
|
+
const ofKind = all.filter((other) => other.block.kind === kind);
|
|
7240
|
+
const others = all.filter((other) => other.block.kind !== kind);
|
|
7241
|
+
const next = [entry, ...ofKind.filter((other) => !same(other))].slice(0, MAX_RECENT);
|
|
7242
|
+
try {
|
|
7243
|
+
window.localStorage.setItem(STORAGE_KEY, JSON.stringify([...next, ...others]));
|
|
7244
|
+
} catch {}
|
|
7245
|
+
}
|
|
7246
|
+
//#endregion
|
|
7247
|
+
//#region editors/workflow-editor/ui/VirtualList.tsx
|
|
7248
|
+
const OVERSCAN = 6;
|
|
7249
|
+
function rowOffsets(heights) {
|
|
7250
|
+
const offsets = [0];
|
|
7251
|
+
for (const height of heights) offsets.push(offsets.at(-1) + height);
|
|
7252
|
+
return offsets;
|
|
7253
|
+
}
|
|
7254
|
+
function visibleRange(offsets, scrollTop, height, overscan = OVERSCAN) {
|
|
7255
|
+
const count = offsets.length - 1;
|
|
7256
|
+
let start = 0;
|
|
7257
|
+
while (start < count && offsets[start + 1] <= scrollTop) start++;
|
|
7258
|
+
let end = start;
|
|
7259
|
+
while (end < count && offsets[end] < scrollTop + height) end++;
|
|
7260
|
+
return [Math.max(0, start - overscan), Math.min(count, end + overscan)];
|
|
7261
|
+
}
|
|
7262
|
+
function VirtualList(props) {
|
|
7263
|
+
const ref = useRef(null);
|
|
7264
|
+
const [scrollTop, setScrollTop] = useState(0);
|
|
7265
|
+
const [height, setHeight] = useState(400);
|
|
7266
|
+
const offsets = useMemo(() => rowOffsets(props.items.map(props.heightOf)), [props.items, props.heightOf]);
|
|
7267
|
+
useLayoutEffect(() => {
|
|
7268
|
+
const element = ref.current;
|
|
7269
|
+
if (!element) return;
|
|
7270
|
+
const observer = new ResizeObserver(() => setHeight(element.clientHeight));
|
|
7271
|
+
observer.observe(element);
|
|
7272
|
+
setHeight(element.clientHeight);
|
|
7273
|
+
return () => observer.disconnect();
|
|
7274
|
+
}, []);
|
|
7275
|
+
useEffect(() => {
|
|
7276
|
+
if (ref.current) ref.current.scrollTop = 0;
|
|
7277
|
+
}, [props.resetKey]);
|
|
7278
|
+
useEffect(() => {
|
|
7279
|
+
const element = ref.current;
|
|
7280
|
+
const index = props.activeIndex;
|
|
7281
|
+
if (!element || index === void 0 || index < 0) return;
|
|
7282
|
+
const top = offsets.at(index);
|
|
7283
|
+
const bottom = offsets.at(index + 1);
|
|
7284
|
+
if (top === void 0 || bottom === void 0) return;
|
|
7285
|
+
if (top < element.scrollTop) element.scrollTop = top;
|
|
7286
|
+
else if (bottom > element.scrollTop + element.clientHeight) element.scrollTop = bottom - element.clientHeight;
|
|
7287
|
+
}, [props.activeIndex, offsets]);
|
|
7288
|
+
const [start, end] = visibleRange(offsets, scrollTop, height);
|
|
7289
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7290
|
+
ref,
|
|
7291
|
+
id: props.id,
|
|
7292
|
+
role: "listbox",
|
|
7293
|
+
"aria-label": props.label,
|
|
7294
|
+
className: `min-h-0 overflow-y-auto ${props.className ?? ""}`,
|
|
7295
|
+
onScroll: (event) => setScrollTop(event.currentTarget.scrollTop),
|
|
7296
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
7297
|
+
role: "presentation",
|
|
7298
|
+
style: {
|
|
7299
|
+
height: offsets.at(-1),
|
|
7300
|
+
position: "relative"
|
|
7301
|
+
},
|
|
7302
|
+
children: props.items.slice(start, end).map((item, i) => {
|
|
7303
|
+
const index = start + i;
|
|
7304
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7305
|
+
role: "presentation",
|
|
7306
|
+
style: {
|
|
7307
|
+
position: "absolute",
|
|
7308
|
+
top: offsets[index],
|
|
7309
|
+
left: 0,
|
|
7310
|
+
right: 0,
|
|
7311
|
+
height: offsets[index + 1] - offsets[index]
|
|
7312
|
+
},
|
|
7313
|
+
children: props.render(item, index)
|
|
7314
|
+
}, props.keyOf(item, index));
|
|
7315
|
+
})
|
|
7316
|
+
})
|
|
7317
|
+
});
|
|
7318
|
+
}
|
|
7319
|
+
//#endregion
|
|
7104
7320
|
//#region editors/workflow-editor/ui/BlockSelector.tsx
|
|
7105
7321
|
const ROW_LOGO = 24;
|
|
7106
7322
|
const CORE_TILE = {
|
|
@@ -7205,33 +7421,55 @@ function LogoFrame(props) {
|
|
|
7205
7421
|
});
|
|
7206
7422
|
}
|
|
7207
7423
|
function Row(props) {
|
|
7208
|
-
return /* @__PURE__ */ jsxs("
|
|
7209
|
-
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7424
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7425
|
+
...optionAttributes(props.option),
|
|
7426
|
+
role: "option",
|
|
7427
|
+
"aria-selected": (props.active ?? false) || (props.selected ?? false),
|
|
7428
|
+
"aria-disabled": props.disabled,
|
|
7429
|
+
className: `group mx-1.5 my-px flex h-[calc(100%-2px)] cursor-pointer items-center gap-2.5 rounded-md px-2 text-left ${rowTone(props.active, props.selected)} ${props.disabled ? "cursor-not-allowed opacity-50" : ""}`,
|
|
7430
|
+
title: props.title,
|
|
7431
|
+
onClick: props.disabled ? void 0 : props.onClick,
|
|
7432
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
7213
7433
|
onMouseEnter: props.onHover,
|
|
7214
|
-
onFocus: props.onHover,
|
|
7215
7434
|
children: [
|
|
7216
|
-
|
|
7435
|
+
/* @__PURE__ */ jsx("span", {
|
|
7436
|
+
"aria-hidden": "true",
|
|
7437
|
+
className: "contents",
|
|
7438
|
+
children: props.logo
|
|
7439
|
+
}),
|
|
7217
7440
|
/* @__PURE__ */ jsxs("span", {
|
|
7218
7441
|
className: "min-w-0",
|
|
7219
7442
|
children: [/* @__PURE__ */ jsx("span", {
|
|
7220
|
-
className: "block truncate text-
|
|
7443
|
+
className: "block truncate text-[13px] font-medium leading-[18px] text-foreground",
|
|
7221
7444
|
children: props.label
|
|
7222
7445
|
}), /* @__PURE__ */ jsx("span", {
|
|
7223
|
-
className:
|
|
7446
|
+
className: `text-xs leading-4 text-muted-foreground ${props.tall ? "line-clamp-2" : "block truncate"}`,
|
|
7224
7447
|
children: props.description
|
|
7225
7448
|
})]
|
|
7226
7449
|
}),
|
|
7227
7450
|
props.version ? /* @__PURE__ */ jsxs("span", {
|
|
7228
|
-
className: `ml-auto shrink-0 pl-2 text-[
|
|
7451
|
+
className: `ml-auto shrink-0 pl-2 text-[11px] tabular-nums text-muted-foreground ${props.versionNote ? "" : props.active ? "" : "hidden group-hover:inline"}`,
|
|
7229
7452
|
title: props.versionNote ?? `Pinned to version ${props.version}`,
|
|
7230
7453
|
children: ["v", props.version]
|
|
7231
7454
|
}) : null
|
|
7232
7455
|
]
|
|
7233
7456
|
});
|
|
7234
7457
|
}
|
|
7458
|
+
function rowTone(active, selected) {
|
|
7459
|
+
if (active) return "bg-wf-run/10 ring-1 ring-inset ring-wf-run/25";
|
|
7460
|
+
if (selected) return "bg-card shadow-sm ring-1 ring-foreground/10";
|
|
7461
|
+
return "hover:bg-foreground/[0.05]";
|
|
7462
|
+
}
|
|
7463
|
+
function optionId(list, index) {
|
|
7464
|
+
return `${list}-${index}`;
|
|
7465
|
+
}
|
|
7466
|
+
function optionAttributes(place) {
|
|
7467
|
+
return place ? {
|
|
7468
|
+
id: optionId(place.list, place.index),
|
|
7469
|
+
"aria-posinset": place.index + 1,
|
|
7470
|
+
"aria-setsize": place.size
|
|
7471
|
+
} : {};
|
|
7472
|
+
}
|
|
7235
7473
|
function shownVersion(pieceName, version) {
|
|
7236
7474
|
return isCoreBlock({ pieceName }) ? void 0 : version;
|
|
7237
7475
|
}
|
|
@@ -7241,16 +7479,11 @@ function useVersionNote(catalog) {
|
|
|
7241
7479
|
if (!piece || !version) return void 0;
|
|
7242
7480
|
const others = [...new Set(draft.filter((block) => block.pieceName === piece && block.pieceVersion !== version).map((block) => `v${block.pieceVersion}`))];
|
|
7243
7481
|
if (others.length > 0) return `Other steps of this workflow use ${others.join(", ")}`;
|
|
7482
|
+
if (piece === "@powerhousedao/piece-reactor") return void 0;
|
|
7244
7483
|
const published = catalog?.find((entry) => entry.name === piece)?.publishedVersion;
|
|
7245
7484
|
return published && published !== version ? `A local build; v${published} is published` : void 0;
|
|
7246
7485
|
};
|
|
7247
7486
|
}
|
|
7248
|
-
function SectionLabel(props) {
|
|
7249
|
-
return /* @__PURE__ */ jsx("div", {
|
|
7250
|
-
className: "px-3 pb-0.5 pt-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/60",
|
|
7251
|
-
children: props.children
|
|
7252
|
-
});
|
|
7253
|
-
}
|
|
7254
7487
|
const CATEGORY_LABELS = {
|
|
7255
7488
|
ARTIFICIAL_INTELLIGENCE: "AI",
|
|
7256
7489
|
UNIVERSAL_AI: "AI",
|
|
@@ -7270,8 +7503,6 @@ const CATEGORY_LABELS = {
|
|
|
7270
7503
|
PAYMENT_PROCESSING: "Payments",
|
|
7271
7504
|
HUMAN_RESOURCES: "HR"
|
|
7272
7505
|
};
|
|
7273
|
-
const CORE_CHIP = "Core";
|
|
7274
|
-
const POWERHOUSE_CHIP = "Powerhouse";
|
|
7275
7506
|
const AI_CHIP = "AI";
|
|
7276
7507
|
function categoryLabel(id) {
|
|
7277
7508
|
return CATEGORY_LABELS[id] ?? id.toLowerCase().replaceAll("_", " ").replace(/^\w/, (char) => char.toUpperCase());
|
|
@@ -7279,111 +7510,84 @@ function categoryLabel(id) {
|
|
|
7279
7510
|
function chipsOf(piece) {
|
|
7280
7511
|
return new Set(piece.categories.map(categoryLabel));
|
|
7281
7512
|
}
|
|
7513
|
+
function categoriesOfChip(chip, pieces) {
|
|
7514
|
+
return [...new Set(pieces.flatMap((piece) => piece.categories))].filter((id) => categoryLabel(id) === chip);
|
|
7515
|
+
}
|
|
7282
7516
|
function orderChips(pieces) {
|
|
7283
7517
|
const counts = /* @__PURE__ */ new Map();
|
|
7284
7518
|
for (const piece of pieces) for (const chip of chipsOf(piece)) counts.set(chip, (counts.get(chip) ?? 0) + 1);
|
|
7285
7519
|
const rest = [...counts.entries()].filter(([chip]) => chip !== AI_CHIP).sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])).map(([chip]) => chip);
|
|
7286
|
-
return [
|
|
7287
|
-
CORE_CHIP,
|
|
7288
|
-
POWERHOUSE_CHIP,
|
|
7289
|
-
...counts.has(AI_CHIP) ? [AI_CHIP] : [],
|
|
7290
|
-
...rest
|
|
7291
|
-
];
|
|
7520
|
+
return [...counts.has(AI_CHIP) ? [AI_CHIP] : [], ...rest];
|
|
7292
7521
|
}
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
|
|
7300
|
-
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
});
|
|
7331
|
-
const block = {
|
|
7332
|
-
pieceName: entry.pieceName,
|
|
7333
|
-
pieceVersion: entry.pieceVersion,
|
|
7334
|
-
kind,
|
|
7335
|
-
name: entry.name
|
|
7336
|
-
};
|
|
7337
|
-
return /* @__PURE__ */ jsx(Row, {
|
|
7338
|
-
logo: /* @__PURE__ */ jsx(LogoFrame, {
|
|
7339
|
-
src: props.piece.logoUrl,
|
|
7340
|
-
alt: props.piece.displayName,
|
|
7341
|
-
size: ROW_LOGO
|
|
7342
|
-
}),
|
|
7343
|
-
label: entry.displayName,
|
|
7344
|
-
description: unavailable ?? entry.description,
|
|
7345
|
-
disabled: unavailable !== void 0,
|
|
7346
|
-
version: shownVersion(entry.pieceName, entry.pieceVersion),
|
|
7347
|
-
versionNote: props.versionNote(props.piece.name, entry.pieceVersion),
|
|
7348
|
-
onHover: unavailable === void 0 ? () => props.onHover(block) : void 0,
|
|
7349
|
-
onClick: () => props.onPick({
|
|
7350
|
-
label: entry.displayName,
|
|
7351
|
-
block,
|
|
7352
|
-
description: entry.description,
|
|
7353
|
-
defaultConfig: {}
|
|
7354
|
-
})
|
|
7355
|
-
}, entry.name);
|
|
7356
|
-
})]
|
|
7357
|
-
});
|
|
7522
|
+
const TAB_LABELS = {
|
|
7523
|
+
all: "All",
|
|
7524
|
+
core: "Core",
|
|
7525
|
+
powerhouse: "Powerhouse",
|
|
7526
|
+
activepieces: "Integrations"
|
|
7527
|
+
};
|
|
7528
|
+
const TAB_SOURCES = {
|
|
7529
|
+
all: void 0,
|
|
7530
|
+
core: [],
|
|
7531
|
+
powerhouse: ["local", "registry"],
|
|
7532
|
+
activepieces: ["activepieces"]
|
|
7533
|
+
};
|
|
7534
|
+
function inTab(tab, piece) {
|
|
7535
|
+
const sources = TAB_SOURCES[tab];
|
|
7536
|
+
return sources === void 0 || sources.includes(piece.source ?? "activepieces");
|
|
7537
|
+
}
|
|
7538
|
+
function folded(text) {
|
|
7539
|
+
return text.normalize("NFKD").replace(/\p{M}/gu, "").toLowerCase();
|
|
7540
|
+
}
|
|
7541
|
+
function queryTokens(query) {
|
|
7542
|
+
return folded(query).split(/[^\p{L}\p{N}]+/u).filter(Boolean);
|
|
7543
|
+
}
|
|
7544
|
+
function matchesQuery(text, tokens) {
|
|
7545
|
+
const lowered = folded(text);
|
|
7546
|
+
return tokens.every((token) => lowered.includes(token));
|
|
7547
|
+
}
|
|
7548
|
+
function escapeRegExp(text) {
|
|
7549
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7550
|
+
}
|
|
7551
|
+
function Highlight(props) {
|
|
7552
|
+
if (props.tokens.length === 0) return /* @__PURE__ */ jsx(Fragment$1, { children: props.text });
|
|
7553
|
+
const pattern = new RegExp(`(?<![\\p{L}\\p{N}])(${props.tokens.map(escapeRegExp).join("|")})`, "giu");
|
|
7554
|
+
const parts = props.text.split(pattern);
|
|
7555
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: parts.map((part, i) => i % 2 === 1 ? /* @__PURE__ */ jsx("mark", {
|
|
7556
|
+
className: "bg-transparent font-semibold text-inherit",
|
|
7557
|
+
children: part
|
|
7558
|
+
}, i) : part) });
|
|
7358
7559
|
}
|
|
7359
7560
|
const SEARCH_MIN_CHARS = 2;
|
|
7360
7561
|
const SEARCH_DEBOUNCE_MS = 250;
|
|
7361
7562
|
const INDEXING_RETRY_MS = 2e3;
|
|
7362
|
-
function
|
|
7563
|
+
function usePieceSearch(query, filter) {
|
|
7363
7564
|
const [state, setState] = useState({ kind: "idle" });
|
|
7364
7565
|
const [attempt, setAttempt] = useState(0);
|
|
7365
7566
|
const trimmed = query.trim();
|
|
7366
|
-
const
|
|
7367
|
-
const
|
|
7567
|
+
const search = usePieceSource()?.searchPieces;
|
|
7568
|
+
const active = filter !== null && search !== void 0 && trimmed.length >= SEARCH_MIN_CHARS;
|
|
7569
|
+
const filterKey = JSON.stringify(filter);
|
|
7570
|
+
const key = `${trimmed}\n${filterKey}`;
|
|
7368
7571
|
useEffect(() => {
|
|
7369
|
-
if (!active
|
|
7572
|
+
if (!active) {
|
|
7370
7573
|
setState({ kind: "idle" });
|
|
7371
7574
|
return;
|
|
7372
7575
|
}
|
|
7373
7576
|
let alive = true;
|
|
7374
7577
|
let retry;
|
|
7375
7578
|
const timer = setTimeout(() => {
|
|
7376
|
-
|
|
7377
|
-
search(trimmed).then((result) => {
|
|
7579
|
+
search(trimmed, JSON.parse(filterKey)).then((result) => {
|
|
7378
7580
|
if (!alive) return;
|
|
7379
7581
|
setState({
|
|
7380
7582
|
kind: "done",
|
|
7583
|
+
key,
|
|
7381
7584
|
result
|
|
7382
7585
|
});
|
|
7383
7586
|
if (result.status === "indexing") retry = setTimeout(() => setAttempt((value) => value + 1), INDEXING_RETRY_MS);
|
|
7384
7587
|
}, (error) => {
|
|
7385
7588
|
if (alive) setState({
|
|
7386
7589
|
kind: "error",
|
|
7590
|
+
key,
|
|
7387
7591
|
message: error instanceof Error ? error.message : String(error)
|
|
7388
7592
|
});
|
|
7389
7593
|
});
|
|
@@ -7396,32 +7600,431 @@ function useBlockSearch(query, enabled) {
|
|
|
7396
7600
|
}, [
|
|
7397
7601
|
active,
|
|
7398
7602
|
trimmed,
|
|
7603
|
+
filterKey,
|
|
7604
|
+
key,
|
|
7399
7605
|
attempt,
|
|
7400
7606
|
search
|
|
7401
7607
|
]);
|
|
7402
|
-
|
|
7608
|
+
if (!active) return { kind: "idle" };
|
|
7609
|
+
if (state.kind === "idle") return { kind: "loading" };
|
|
7610
|
+
if (state.kind === "error") return state.key === key ? {
|
|
7611
|
+
kind: "error",
|
|
7612
|
+
message: state.message
|
|
7613
|
+
} : { kind: "loading" };
|
|
7614
|
+
return {
|
|
7615
|
+
kind: "done",
|
|
7616
|
+
result: state.result,
|
|
7617
|
+
stale: state.key !== key
|
|
7618
|
+
};
|
|
7619
|
+
}
|
|
7620
|
+
function rovingFocus(event) {
|
|
7621
|
+
const delta = event.key === "ArrowRight" ? 1 : event.key === "ArrowLeft" ? -1 : 0;
|
|
7622
|
+
if (delta === 0) return;
|
|
7623
|
+
event.preventDefault();
|
|
7624
|
+
const buttons = [...event.currentTarget.querySelectorAll("button")];
|
|
7625
|
+
const at = buttons.indexOf(document.activeElement);
|
|
7626
|
+
buttons.at((at + delta) % buttons.length)?.focus();
|
|
7403
7627
|
}
|
|
7404
7628
|
function Chip(props) {
|
|
7405
7629
|
return /* @__PURE__ */ jsx("button", {
|
|
7406
7630
|
type: "button",
|
|
7407
|
-
|
|
7408
|
-
|
|
7631
|
+
"aria-pressed": props.active,
|
|
7632
|
+
tabIndex: props.tabStop ? 0 : -1,
|
|
7633
|
+
className: `shrink-0 rounded-full border px-2.5 py-0.5 text-[11px] font-medium focus-visible:outline-2 focus-visible:outline-wf-run ${props.active ? "border-wf-run/40 bg-wf-run/10 text-wf-run" : "border-foreground/10 text-muted-foreground hover:border-foreground/25 hover:text-foreground"}`,
|
|
7634
|
+
onClick: (event) => props.onClick(event.detail === 0),
|
|
7409
7635
|
children: props.label
|
|
7410
7636
|
});
|
|
7411
7637
|
}
|
|
7638
|
+
function ChipBar(props) {
|
|
7639
|
+
const ref = useRef(null);
|
|
7640
|
+
const [more, setMore] = useState({
|
|
7641
|
+
left: false,
|
|
7642
|
+
right: false
|
|
7643
|
+
});
|
|
7644
|
+
const measure = () => {
|
|
7645
|
+
const element = ref.current;
|
|
7646
|
+
if (!element) return;
|
|
7647
|
+
const left = element.scrollLeft > 1;
|
|
7648
|
+
const right = element.scrollLeft + element.clientWidth < element.scrollWidth - 1;
|
|
7649
|
+
setMore((previous) => previous.left === left && previous.right === right ? previous : {
|
|
7650
|
+
left,
|
|
7651
|
+
right
|
|
7652
|
+
});
|
|
7653
|
+
};
|
|
7654
|
+
useLayoutEffect(() => {
|
|
7655
|
+
const element = ref.current;
|
|
7656
|
+
if (!element) return;
|
|
7657
|
+
const observer = new ResizeObserver(measure);
|
|
7658
|
+
observer.observe(element);
|
|
7659
|
+
return () => observer.disconnect();
|
|
7660
|
+
}, []);
|
|
7661
|
+
const fade = (side) => /* @__PURE__ */ jsx("span", {
|
|
7662
|
+
"aria-hidden": "true",
|
|
7663
|
+
className: "pointer-events-none absolute inset-y-0 w-14",
|
|
7664
|
+
style: {
|
|
7665
|
+
[side]: 0,
|
|
7666
|
+
background: `linear-gradient(to ${side === "left" ? "right" : "left"}, var(--card), transparent)`
|
|
7667
|
+
}
|
|
7668
|
+
});
|
|
7669
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7670
|
+
className: "relative shrink-0 border-b border-foreground/10",
|
|
7671
|
+
children: [
|
|
7672
|
+
/* @__PURE__ */ jsx("div", {
|
|
7673
|
+
ref,
|
|
7674
|
+
role: "toolbar",
|
|
7675
|
+
"aria-label": "Categories",
|
|
7676
|
+
className: "flex gap-1.5 overflow-x-auto whitespace-nowrap px-3 py-2 [scrollbar-width:none]",
|
|
7677
|
+
onKeyDown: rovingFocus,
|
|
7678
|
+
onScroll: measure,
|
|
7679
|
+
children: props.children
|
|
7680
|
+
}),
|
|
7681
|
+
more.left ? fade("left") : null,
|
|
7682
|
+
more.right ? fade("right") : null
|
|
7683
|
+
]
|
|
7684
|
+
});
|
|
7685
|
+
}
|
|
7686
|
+
function Tabs(props) {
|
|
7687
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7688
|
+
role: "tablist",
|
|
7689
|
+
"aria-label": "Piece sources",
|
|
7690
|
+
className: "inline-flex gap-0.5 rounded-md bg-foreground/[0.05] p-0.5",
|
|
7691
|
+
onKeyDown: (event) => {
|
|
7692
|
+
rovingFocus(event);
|
|
7693
|
+
const tab = document.activeElement?.dataset.tab;
|
|
7694
|
+
if (tab && tab !== props.active) props.onSelect(tab, true);
|
|
7695
|
+
},
|
|
7696
|
+
children: props.tabs.map((tab) => /* @__PURE__ */ jsx("button", {
|
|
7697
|
+
type: "button",
|
|
7698
|
+
role: "tab",
|
|
7699
|
+
"data-tab": tab,
|
|
7700
|
+
"aria-selected": props.active === tab,
|
|
7701
|
+
tabIndex: props.active === tab ? 0 : -1,
|
|
7702
|
+
className: `rounded px-2.5 py-1 text-xs font-medium focus-visible:outline-2 focus-visible:outline-wf-run ${props.active === tab ? "bg-card text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"}`,
|
|
7703
|
+
onClick: (event) => props.onSelect(tab, event.detail === 0),
|
|
7704
|
+
children: TAB_LABELS[tab]
|
|
7705
|
+
}, tab))
|
|
7706
|
+
});
|
|
7707
|
+
}
|
|
7708
|
+
function Status(props) {
|
|
7709
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7710
|
+
role: "status",
|
|
7711
|
+
className: `px-4 py-2.5 text-xs ${props.error ? "text-wf-fail" : "text-muted-foreground"}`,
|
|
7712
|
+
children: props.children
|
|
7713
|
+
});
|
|
7714
|
+
}
|
|
7715
|
+
const ROW_HEIGHT = 46;
|
|
7716
|
+
const BLOCK_HEIGHT = 60;
|
|
7717
|
+
const HEADER_LOGO = 36;
|
|
7718
|
+
const HEADER_HEIGHT = 38;
|
|
7719
|
+
const MORE_HEIGHT = 28;
|
|
7720
|
+
const GROUP_BLOCKS = 4;
|
|
7721
|
+
const HOVER_PREVIEW_MS = 120;
|
|
7722
|
+
const searchRowHeight = (row) => row.type === "entry" ? BLOCK_HEIGHT : row.type === "more" ? MORE_HEIGHT : HEADER_HEIGHT;
|
|
7723
|
+
const sourceHeight = () => ROW_HEIGHT;
|
|
7724
|
+
const entryHeight = () => BLOCK_HEIGHT;
|
|
7725
|
+
function listTile(icon, color) {
|
|
7726
|
+
return (size) => /* @__PURE__ */ jsx(CoreTile, {
|
|
7727
|
+
tile: {
|
|
7728
|
+
icon,
|
|
7729
|
+
color
|
|
7730
|
+
},
|
|
7731
|
+
size
|
|
7732
|
+
});
|
|
7733
|
+
}
|
|
7734
|
+
function EntryRow(props) {
|
|
7735
|
+
const { entry } = props;
|
|
7736
|
+
return /* @__PURE__ */ jsx(Row, {
|
|
7737
|
+
logo: props.indent ? /* @__PURE__ */ jsx("span", {
|
|
7738
|
+
className: "shrink-0",
|
|
7739
|
+
style: { width: ROW_LOGO }
|
|
7740
|
+
}) : entry.logo,
|
|
7741
|
+
label: /* @__PURE__ */ jsx(Highlight, {
|
|
7742
|
+
text: entry.label,
|
|
7743
|
+
tokens: props.tokens
|
|
7744
|
+
}),
|
|
7745
|
+
title: entry.description || entry.label,
|
|
7746
|
+
description: entry.unavailable ?? /* @__PURE__ */ jsx(Highlight, {
|
|
7747
|
+
text: entry.description,
|
|
7748
|
+
tokens: props.tokens
|
|
7749
|
+
}),
|
|
7750
|
+
disabled: entry.unavailable !== void 0,
|
|
7751
|
+
active: props.active,
|
|
7752
|
+
tall: true,
|
|
7753
|
+
option: props.option,
|
|
7754
|
+
version: entry.version,
|
|
7755
|
+
versionNote: entry.versionNote,
|
|
7756
|
+
onHover: () => {
|
|
7757
|
+
props.onActivate();
|
|
7758
|
+
if (entry.unavailable === void 0) entry.warm?.();
|
|
7759
|
+
},
|
|
7760
|
+
onClick: entry.pick
|
|
7761
|
+
});
|
|
7762
|
+
}
|
|
7763
|
+
function SourceRow(props) {
|
|
7764
|
+
const { source } = props;
|
|
7765
|
+
if (source.kind === "list") return /* @__PURE__ */ jsx(Row, {
|
|
7766
|
+
logo: source.logo(ROW_LOGO),
|
|
7767
|
+
label: source.title,
|
|
7768
|
+
description: source.subtitle,
|
|
7769
|
+
active: props.active,
|
|
7770
|
+
selected: props.selected,
|
|
7771
|
+
option: props.option,
|
|
7772
|
+
onHover: props.onActivate,
|
|
7773
|
+
onClick: props.onOpen
|
|
7774
|
+
});
|
|
7775
|
+
const { piece } = source;
|
|
7776
|
+
const count = props.mode === "triggers" ? piece.triggerCount : piece.actionCount;
|
|
7777
|
+
const noun = props.mode === "triggers" ? "trigger" : "action";
|
|
7778
|
+
return /* @__PURE__ */ jsx(Row, {
|
|
7779
|
+
logo: /* @__PURE__ */ jsx(LogoFrame, {
|
|
7780
|
+
src: piece.logoUrl,
|
|
7781
|
+
alt: piece.displayName,
|
|
7782
|
+
size: ROW_LOGO
|
|
7783
|
+
}),
|
|
7784
|
+
label: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Highlight, {
|
|
7785
|
+
text: piece.displayName,
|
|
7786
|
+
tokens: props.tokens
|
|
7787
|
+
}), piece.deprecated ? " (deprecated)" : ""] }),
|
|
7788
|
+
title: piece.description || piece.displayName,
|
|
7789
|
+
description: piece.unsupported ?? `${count} ${noun}${count === 1 ? "" : "s"}`,
|
|
7790
|
+
active: props.active,
|
|
7791
|
+
selected: props.selected,
|
|
7792
|
+
option: props.option,
|
|
7793
|
+
onHover: props.onActivate,
|
|
7794
|
+
onClick: props.onOpen
|
|
7795
|
+
});
|
|
7796
|
+
}
|
|
7797
|
+
function usePieceEntries(piece, mode) {
|
|
7798
|
+
const pieceSource = usePieceSource();
|
|
7799
|
+
const [state, setState] = useState(null);
|
|
7800
|
+
const name = piece?.name;
|
|
7801
|
+
useEffect(() => {
|
|
7802
|
+
if (!name || !pieceSource) return;
|
|
7803
|
+
let cancelled = false;
|
|
7804
|
+
(mode === "triggers" ? pieceSource.loadTriggers(name) : pieceSource.loadActions(name)).then((entries) => {
|
|
7805
|
+
if (!cancelled) setState({
|
|
7806
|
+
name,
|
|
7807
|
+
entries,
|
|
7808
|
+
error: null
|
|
7809
|
+
});
|
|
7810
|
+
}, (error) => {
|
|
7811
|
+
if (!cancelled) setState({
|
|
7812
|
+
name,
|
|
7813
|
+
entries: null,
|
|
7814
|
+
error: error instanceof Error ? error.message : String(error)
|
|
7815
|
+
});
|
|
7816
|
+
});
|
|
7817
|
+
return () => {
|
|
7818
|
+
cancelled = true;
|
|
7819
|
+
};
|
|
7820
|
+
}, [
|
|
7821
|
+
name,
|
|
7822
|
+
mode,
|
|
7823
|
+
pieceSource
|
|
7824
|
+
]);
|
|
7825
|
+
return state && state.name === name ? {
|
|
7826
|
+
entries: state.entries,
|
|
7827
|
+
error: state.error
|
|
7828
|
+
} : {
|
|
7829
|
+
entries: null,
|
|
7830
|
+
error: null
|
|
7831
|
+
};
|
|
7832
|
+
}
|
|
7833
|
+
function EntriesPane(props) {
|
|
7834
|
+
const { source } = props;
|
|
7835
|
+
const entries = source?.kind === "list" ? source.entries : props.pieceEntries;
|
|
7836
|
+
const kind = props.mode === "triggers" ? "trigger" : "action";
|
|
7837
|
+
const title = source?.kind === "list" ? source.title : source?.piece.displayName;
|
|
7838
|
+
const about = source?.kind === "list" ? source.subtitle : source?.piece.description;
|
|
7839
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7840
|
+
className: "flex min-h-0 min-w-0 flex-1 flex-col",
|
|
7841
|
+
children: [source && props.showHeader ? /* @__PURE__ */ jsxs("div", {
|
|
7842
|
+
className: "flex shrink-0 items-start gap-3 border-b border-foreground/10 px-4 py-3",
|
|
7843
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
7844
|
+
"aria-hidden": "true",
|
|
7845
|
+
className: "contents",
|
|
7846
|
+
children: source.kind === "list" ? source.logo(HEADER_LOGO) : /* @__PURE__ */ jsx(LogoFrame, {
|
|
7847
|
+
src: source.piece.logoUrl,
|
|
7848
|
+
alt: "",
|
|
7849
|
+
size: HEADER_LOGO
|
|
7850
|
+
})
|
|
7851
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
7852
|
+
className: "min-w-0",
|
|
7853
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
7854
|
+
className: "truncate text-sm font-semibold leading-5 text-foreground",
|
|
7855
|
+
children: title
|
|
7856
|
+
}), about ? /* @__PURE__ */ jsx("div", {
|
|
7857
|
+
className: "line-clamp-2 text-xs leading-4 text-muted-foreground",
|
|
7858
|
+
title: about,
|
|
7859
|
+
children: about
|
|
7860
|
+
}) : null]
|
|
7861
|
+
})]
|
|
7862
|
+
}) : null, !source ? /* @__PURE__ */ jsxs(Status, { children: [
|
|
7863
|
+
"Pick a piece to see its ",
|
|
7864
|
+
kind,
|
|
7865
|
+
"s"
|
|
7866
|
+
] }) : props.pieceError ? /* @__PURE__ */ jsx(Status, {
|
|
7867
|
+
error: true,
|
|
7868
|
+
children: props.pieceError
|
|
7869
|
+
}) : entries === null ? /* @__PURE__ */ jsx(Status, { children: "Loading…" }) : entries.length === 0 ? /* @__PURE__ */ jsxs(Status, { children: [
|
|
7870
|
+
"No ",
|
|
7871
|
+
kind,
|
|
7872
|
+
"s"
|
|
7873
|
+
] }) : /* @__PURE__ */ jsx(VirtualList, {
|
|
7874
|
+
id: props.listId,
|
|
7875
|
+
resetKey: source.id,
|
|
7876
|
+
label: `${title ?? ""} ${kind}s`,
|
|
7877
|
+
className: "flex-1 py-1",
|
|
7878
|
+
items: entries,
|
|
7879
|
+
heightOf: entryHeight,
|
|
7880
|
+
keyOf: (entry) => entry.key,
|
|
7881
|
+
activeIndex: props.activeIndex,
|
|
7882
|
+
render: (entry, index) => /* @__PURE__ */ jsx(EntryRow, {
|
|
7883
|
+
entry,
|
|
7884
|
+
tokens: props.tokens,
|
|
7885
|
+
active: index === props.activeIndex,
|
|
7886
|
+
option: {
|
|
7887
|
+
list: props.listId,
|
|
7888
|
+
index,
|
|
7889
|
+
size: entries.length
|
|
7890
|
+
},
|
|
7891
|
+
onActivate: () => props.onActivate(index)
|
|
7892
|
+
})
|
|
7893
|
+
})]
|
|
7894
|
+
});
|
|
7895
|
+
}
|
|
7896
|
+
function SearchList(props) {
|
|
7897
|
+
const size = props.rows.length;
|
|
7898
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7899
|
+
className: "flex min-h-0 flex-1 flex-col",
|
|
7900
|
+
children: [props.status, /* @__PURE__ */ jsx(VirtualList, {
|
|
7901
|
+
id: props.listId,
|
|
7902
|
+
label: "Search results",
|
|
7903
|
+
resetKey: props.resetKey,
|
|
7904
|
+
className: `flex-1 py-1 ${props.stale ? "opacity-60" : ""}`,
|
|
7905
|
+
items: props.rows,
|
|
7906
|
+
heightOf: searchRowHeight,
|
|
7907
|
+
keyOf: (row, index) => row.type === "entry" ? `e:${row.entry.key}` : row.type === "piece" ? `p:${row.match.pieceName}` : row.type === "list" ? `l:${row.source.id}` : `m:${row.pieceName}:${index}`,
|
|
7908
|
+
activeIndex: props.activeIndex,
|
|
7909
|
+
render: (row, index) => {
|
|
7910
|
+
const active = index === props.activeIndex;
|
|
7911
|
+
const activate = () => props.onActivate(index);
|
|
7912
|
+
const option = {
|
|
7913
|
+
list: props.listId,
|
|
7914
|
+
index,
|
|
7915
|
+
size
|
|
7916
|
+
};
|
|
7917
|
+
if (row.type === "entry") return /* @__PURE__ */ jsx(EntryRow, {
|
|
7918
|
+
entry: row.entry,
|
|
7919
|
+
tokens: props.tokens,
|
|
7920
|
+
active,
|
|
7921
|
+
option,
|
|
7922
|
+
indent: true,
|
|
7923
|
+
onActivate: activate
|
|
7924
|
+
});
|
|
7925
|
+
if (row.type === "more") return /* @__PURE__ */ jsxs("div", {
|
|
7926
|
+
...optionAttributes(option),
|
|
7927
|
+
role: "option",
|
|
7928
|
+
"aria-selected": active,
|
|
7929
|
+
className: `mx-1.5 my-px flex h-[calc(100%-2px)] cursor-pointer items-center rounded-md pl-[42px] text-xs text-muted-foreground hover:text-foreground ${rowTone(active)}`,
|
|
7930
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
7931
|
+
onMouseEnter: activate,
|
|
7932
|
+
onClick: () => props.onExpand(row.pieceName),
|
|
7933
|
+
children: [row.hidden, " more…"]
|
|
7934
|
+
});
|
|
7935
|
+
const header = row.type === "piece" ? {
|
|
7936
|
+
logo: /* @__PURE__ */ jsx(LogoFrame, {
|
|
7937
|
+
src: row.match.logoUrl,
|
|
7938
|
+
alt: row.match.displayName,
|
|
7939
|
+
size: 20
|
|
7940
|
+
}),
|
|
7941
|
+
label: row.match.displayName,
|
|
7942
|
+
note: row.match.deprecated ? "Deprecated" : row.match.unsupported ?? void 0,
|
|
7943
|
+
kind: props.kind,
|
|
7944
|
+
open: () => props.onOpenPiece(row.match.pieceName)
|
|
7945
|
+
} : {
|
|
7946
|
+
logo: row.source.logo(20),
|
|
7947
|
+
label: row.source.title,
|
|
7948
|
+
note: void 0,
|
|
7949
|
+
kind: props.kind,
|
|
7950
|
+
open: () => props.onOpenList(row.source.id)
|
|
7951
|
+
};
|
|
7952
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7953
|
+
...optionAttributes(option),
|
|
7954
|
+
role: "option",
|
|
7955
|
+
"aria-selected": active,
|
|
7956
|
+
title: `Open ${header.label}`,
|
|
7957
|
+
className: `group mx-1.5 mt-1 flex h-[calc(100%-4px)] cursor-pointer items-center gap-2.5 rounded-md px-2 text-left ${rowTone(active)}`,
|
|
7958
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
7959
|
+
onMouseEnter: activate,
|
|
7960
|
+
onClick: header.open,
|
|
7961
|
+
children: [
|
|
7962
|
+
/* @__PURE__ */ jsx("span", {
|
|
7963
|
+
"aria-hidden": "true",
|
|
7964
|
+
className: "contents",
|
|
7965
|
+
children: header.logo
|
|
7966
|
+
}),
|
|
7967
|
+
/* @__PURE__ */ jsx("span", {
|
|
7968
|
+
className: "truncate text-[13px] font-semibold text-foreground",
|
|
7969
|
+
children: /* @__PURE__ */ jsx(Highlight, {
|
|
7970
|
+
text: header.label,
|
|
7971
|
+
tokens: props.tokens
|
|
7972
|
+
})
|
|
7973
|
+
}),
|
|
7974
|
+
header.note ? /* @__PURE__ */ jsx("span", {
|
|
7975
|
+
className: "truncate text-[11px] text-muted-foreground",
|
|
7976
|
+
children: header.note
|
|
7977
|
+
}) : null,
|
|
7978
|
+
/* @__PURE__ */ jsxs("span", {
|
|
7979
|
+
className: `ml-auto flex shrink-0 items-center gap-0.5 text-[11px] text-muted-foreground ${active ? "" : "opacity-0 group-hover:opacity-100"}`,
|
|
7980
|
+
children: [
|
|
7981
|
+
"All ",
|
|
7982
|
+
header.kind,
|
|
7983
|
+
"s",
|
|
7984
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
7985
|
+
name: "chevron",
|
|
7986
|
+
size: 12
|
|
7987
|
+
})
|
|
7988
|
+
]
|
|
7989
|
+
})
|
|
7990
|
+
]
|
|
7991
|
+
});
|
|
7992
|
+
}
|
|
7993
|
+
})]
|
|
7994
|
+
});
|
|
7995
|
+
}
|
|
7412
7996
|
function BlockSelector(props) {
|
|
7413
7997
|
const [query, setQuery] = useState("");
|
|
7998
|
+
const [tab, setTab] = useState("all");
|
|
7414
7999
|
const [chip, setChip] = useState(null);
|
|
7415
8000
|
const [catalog, setCatalog] = useState(null);
|
|
7416
|
-
const [
|
|
8001
|
+
const [selectedId, setSelectedId] = useState(null);
|
|
8002
|
+
const [paneState, setPane] = useState("sources");
|
|
8003
|
+
const [entryIndex, setEntryIndex] = useState(-1);
|
|
8004
|
+
const [rowIndex, setRowIndex] = useState(-1);
|
|
8005
|
+
const [expanded, setExpanded] = useState(/* @__PURE__ */ new Set());
|
|
7417
8006
|
const containerRef = useRef(null);
|
|
8007
|
+
const inputRef = useRef(null);
|
|
8008
|
+
const baseId = useId();
|
|
8009
|
+
const listIds = {
|
|
8010
|
+
sources: `${baseId}-sources`,
|
|
8011
|
+
entries: `${baseId}-entries`,
|
|
8012
|
+
results: `${baseId}-results`
|
|
8013
|
+
};
|
|
8014
|
+
const pointerMoved = useRef(false);
|
|
8015
|
+
const hoverTimer = useRef(void 0);
|
|
8016
|
+
const { anchor, onClose } = props;
|
|
7418
8017
|
useEffect(() => {
|
|
7419
8018
|
const handler = (event) => {
|
|
7420
|
-
|
|
8019
|
+
const target = event.target;
|
|
8020
|
+
if (containerRef.current?.contains(target)) return;
|
|
8021
|
+
if (anchor?.current?.contains(target)) return;
|
|
8022
|
+
onClose();
|
|
7421
8023
|
};
|
|
7422
|
-
window.addEventListener("
|
|
7423
|
-
return () => window.removeEventListener("
|
|
7424
|
-
}, [
|
|
8024
|
+
window.addEventListener("pointerdown", handler, true);
|
|
8025
|
+
return () => window.removeEventListener("pointerdown", handler, true);
|
|
8026
|
+
}, [anchor, onClose]);
|
|
8027
|
+
useEffect(() => () => clearTimeout(hoverTimer.current), []);
|
|
7425
8028
|
const anySource = usePieceSource();
|
|
7426
8029
|
const pieceSource = props.showPieces ? anySource : void 0;
|
|
7427
8030
|
const [catalogRound, setCatalogRound] = useState(0);
|
|
@@ -7456,176 +8059,496 @@ function BlockSelector(props) {
|
|
|
7456
8059
|
const pinned = (preset) => pinBlock(preset.block, installed);
|
|
7457
8060
|
const pick = (preset) => {
|
|
7458
8061
|
const block = pinned(preset);
|
|
7459
|
-
if (block)
|
|
8062
|
+
if (!block) return;
|
|
8063
|
+
rememberPick(preset);
|
|
8064
|
+
props.onPick({
|
|
7460
8065
|
...preset,
|
|
7461
8066
|
block
|
|
7462
8067
|
});
|
|
7463
8068
|
};
|
|
7464
8069
|
const prefetch = useBlockFormPrefetch();
|
|
7465
8070
|
const mode = props.pieceMode ?? "actions";
|
|
7466
|
-
const
|
|
7467
|
-
const
|
|
7468
|
-
const
|
|
7469
|
-
const
|
|
7470
|
-
const
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
8071
|
+
const kind = mode === "triggers" ? "trigger" : "action";
|
|
8072
|
+
const tokens = queryTokens(query);
|
|
8073
|
+
const searching = query.trim().length >= SEARCH_MIN_CHARS;
|
|
8074
|
+
const showCatalog = pieceSource !== void 0 && tab !== "core";
|
|
8075
|
+
const tabs = pieceSource ? [
|
|
8076
|
+
"all",
|
|
8077
|
+
"core",
|
|
8078
|
+
"powerhouse",
|
|
8079
|
+
"activepieces"
|
|
8080
|
+
] : [
|
|
8081
|
+
"all",
|
|
8082
|
+
"core",
|
|
8083
|
+
"powerhouse"
|
|
8084
|
+
];
|
|
8085
|
+
const modePieces = useMemo(() => {
|
|
8086
|
+
const presetCounts = /* @__PURE__ */ new Map();
|
|
8087
|
+
for (const preset of props.presets) {
|
|
8088
|
+
const name = preset.block.pieceName;
|
|
8089
|
+
presetCounts.set(name, (presetCounts.get(name) ?? 0) + 1);
|
|
8090
|
+
}
|
|
8091
|
+
return (catalog?.pieces ?? []).filter((entry) => {
|
|
8092
|
+
return (mode === "triggers" ? entry.triggerCount : entry.actionCount) > (presetCounts.get(entry.name) ?? 0);
|
|
8093
|
+
});
|
|
8094
|
+
}, [
|
|
8095
|
+
catalog,
|
|
8096
|
+
mode,
|
|
8097
|
+
props.presets
|
|
8098
|
+
]);
|
|
8099
|
+
const tabPieces = useMemo(() => modePieces.filter((entry) => inTab(tab, entry)), [modePieces, tab]);
|
|
8100
|
+
const chips = useMemo(() => orderChips(tabPieces), [tabPieces]);
|
|
8101
|
+
const showChips = showCatalog && (tab === "activepieces" || tab === "powerhouse") && chips.length > 1;
|
|
8102
|
+
const activeChip = showChips && chip !== null && chips.includes(chip) ? chip : null;
|
|
8103
|
+
const searchFilter = useMemo(() => showCatalog ? {
|
|
8104
|
+
kind,
|
|
8105
|
+
...TAB_SOURCES[tab] ? { sources: TAB_SOURCES[tab] } : {},
|
|
8106
|
+
...activeChip ? { categories: categoriesOfChip(activeChip, tabPieces) } : {}
|
|
8107
|
+
} : null, [
|
|
8108
|
+
showCatalog,
|
|
8109
|
+
kind,
|
|
8110
|
+
tab,
|
|
8111
|
+
activeChip,
|
|
8112
|
+
tabPieces
|
|
8113
|
+
]);
|
|
8114
|
+
const search = usePieceSearch(query, searchFilter);
|
|
8115
|
+
const presetEntry = (preset) => {
|
|
7479
8116
|
const block = pinned(preset);
|
|
7480
|
-
return
|
|
8117
|
+
return {
|
|
8118
|
+
key: `${blockKey(preset.block)} ${preset.label}`,
|
|
7481
8119
|
logo: /* @__PURE__ */ jsx(BlockLogo, {
|
|
7482
8120
|
block: preset.block,
|
|
7483
8121
|
size: ROW_LOGO
|
|
7484
8122
|
}),
|
|
7485
8123
|
label: preset.label,
|
|
7486
|
-
description:
|
|
7487
|
-
|
|
8124
|
+
description: preset.description,
|
|
8125
|
+
unavailable: block ? void 0 : catalog === null ? "Loading…" : "Not installed on this runtime",
|
|
7488
8126
|
version: shownVersion(preset.block.pieceName, block?.pieceVersion),
|
|
7489
8127
|
versionNote: versionNote(preset.block.pieceName, block?.pieceVersion),
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
}
|
|
8128
|
+
pick: () => pick(preset),
|
|
8129
|
+
warm: block ? () => prefetch(block) : void 0
|
|
8130
|
+
};
|
|
8131
|
+
};
|
|
8132
|
+
const blockEntry = (entry, logo) => {
|
|
8133
|
+
const block = {
|
|
8134
|
+
pieceName: entry.pieceName,
|
|
8135
|
+
pieceVersion: entry.pieceVersion,
|
|
8136
|
+
kind,
|
|
8137
|
+
name: entry.name
|
|
8138
|
+
};
|
|
8139
|
+
return {
|
|
8140
|
+
key: blockKey(block),
|
|
8141
|
+
logo,
|
|
8142
|
+
label: entry.displayName,
|
|
8143
|
+
description: entry.description,
|
|
8144
|
+
unavailable: blockUnavailable({
|
|
8145
|
+
...entry,
|
|
8146
|
+
kind
|
|
8147
|
+
}),
|
|
8148
|
+
version: shownVersion(entry.pieceName, entry.pieceVersion),
|
|
8149
|
+
versionNote: versionNote(entry.pieceName, entry.pieceVersion),
|
|
8150
|
+
pick: () => pick({
|
|
8151
|
+
label: entry.displayName,
|
|
8152
|
+
block,
|
|
8153
|
+
description: entry.description,
|
|
8154
|
+
defaultConfig: {}
|
|
8155
|
+
}),
|
|
8156
|
+
warm: () => prefetch(block)
|
|
8157
|
+
};
|
|
8158
|
+
};
|
|
8159
|
+
const lists = (() => {
|
|
8160
|
+
if (activeChip !== null) return [];
|
|
8161
|
+
const result = [];
|
|
8162
|
+
const add = (id, title, subtitle, logo, entries) => {
|
|
8163
|
+
if (entries.length > 0) result.push({
|
|
8164
|
+
kind: "list",
|
|
8165
|
+
id,
|
|
8166
|
+
title,
|
|
8167
|
+
subtitle,
|
|
8168
|
+
logo,
|
|
8169
|
+
entries
|
|
8170
|
+
});
|
|
8171
|
+
};
|
|
8172
|
+
if (tab === "all") {
|
|
8173
|
+
if (props.onAttach) add("attach", "Detached steps", "Re-attach a step at this point", listTile("branch", "#64748b"), (props.attachSteps ?? []).map((step) => ({
|
|
8174
|
+
key: `attach ${step.id}`,
|
|
8175
|
+
logo: /* @__PURE__ */ jsx(BlockLogo, {
|
|
8176
|
+
block: stepBlock(step),
|
|
8177
|
+
size: ROW_LOGO
|
|
8178
|
+
}),
|
|
8179
|
+
label: step.name,
|
|
8180
|
+
description: `{{steps.${step.key}}} · detached`,
|
|
8181
|
+
pick: () => props.onAttach?.(step.id)
|
|
8182
|
+
})));
|
|
8183
|
+
}
|
|
8184
|
+
if (tab === "all" || tab === "core") add("core", "Core", "Built into the workflow engine", listTile("bolt", "#2563eb"), props.presets.filter((preset) => preset.group !== "powerhouse").map(presetEntry));
|
|
8185
|
+
if (tab === "all" || tab === "powerhouse") {
|
|
8186
|
+
const reactorPreset = props.presets.find((preset) => preset.group === "powerhouse");
|
|
8187
|
+
add("powerhouse", "Documents", "Read and change documents on this reactor", (size) => reactorPreset ? /* @__PURE__ */ jsx(BlockLogo, {
|
|
8188
|
+
block: reactorPreset.block,
|
|
8189
|
+
size
|
|
8190
|
+
}) : null, props.presets.filter((preset) => preset.group === "powerhouse").map(presetEntry));
|
|
8191
|
+
}
|
|
8192
|
+
if (tab === "all") {
|
|
8193
|
+
const recent = recentPicks(kind).filter((preset) => isCoreBlock(preset.block) || installed(preset.block.pieceName));
|
|
8194
|
+
add("recent", "Recently used", `Your last ${kind}s`, listTile("clock", "#64748b"), recent.map((preset) => {
|
|
8195
|
+
const entry = presetEntry(preset);
|
|
8196
|
+
const reason = catalog?.pieces.find((piece) => piece.name === preset.block.pieceName)?.unsupported;
|
|
8197
|
+
return reason ? {
|
|
8198
|
+
...entry,
|
|
8199
|
+
unavailable: reason
|
|
8200
|
+
} : entry;
|
|
8201
|
+
}));
|
|
8202
|
+
}
|
|
8203
|
+
return result;
|
|
8204
|
+
})();
|
|
8205
|
+
const sources = (() => {
|
|
8206
|
+
const listSources = lists.map((list) => ({
|
|
8207
|
+
...list,
|
|
8208
|
+
entries: list.entries.filter((entry) => matchesQuery(`${entry.label} ${entry.description}`, tokens))
|
|
8209
|
+
})).filter((list) => list.entries.length > 0);
|
|
8210
|
+
const pieceSources = showCatalog ? tabPieces.filter((entry) => (activeChip === null || chipsOf(entry).has(activeChip)) && matchesQuery(`${entry.displayName} ${entry.name} ${entry.description}`, tokens)).map((piece) => ({
|
|
8211
|
+
kind: "piece",
|
|
8212
|
+
id: piece.name,
|
|
8213
|
+
piece
|
|
8214
|
+
})) : [];
|
|
8215
|
+
return [...listSources, ...pieceSources];
|
|
8216
|
+
})();
|
|
8217
|
+
const selected = sources.find((source) => source.id === selectedId) ?? sources.at(0);
|
|
8218
|
+
const sourceIndex = selected ? sources.indexOf(selected) : -1;
|
|
8219
|
+
const selectedPiece = selected?.kind === "piece" ? selected.piece : void 0;
|
|
8220
|
+
const loaded = usePieceEntries(selectedPiece, mode);
|
|
8221
|
+
const pieceEntries = selectedPiece && loaded.entries ? loaded.entries.map((entry) => blockEntry(entry, /* @__PURE__ */ jsx(LogoFrame, {
|
|
8222
|
+
src: selectedPiece.logoUrl,
|
|
8223
|
+
alt: selectedPiece.displayName,
|
|
8224
|
+
size: ROW_LOGO
|
|
8225
|
+
}))) : null;
|
|
8226
|
+
const entries = selected?.kind === "list" ? selected.entries : pieceEntries ?? [];
|
|
8227
|
+
const entryAt = entries.length === 0 ? -1 : Math.min(entryIndex, entries.length - 1);
|
|
8228
|
+
const presetKeys = new Set(props.presets.map((preset) => `${preset.block.pieceName} ${preset.block.name}`));
|
|
8229
|
+
const rows = [];
|
|
8230
|
+
if (searching) {
|
|
8231
|
+
for (const source of sources) {
|
|
8232
|
+
if (source.kind !== "list" || source.id === "recent") continue;
|
|
8233
|
+
rows.push({
|
|
8234
|
+
type: "list",
|
|
8235
|
+
source
|
|
8236
|
+
});
|
|
8237
|
+
for (const entry of source.entries) rows.push({
|
|
8238
|
+
type: "entry",
|
|
8239
|
+
entry
|
|
8240
|
+
});
|
|
8241
|
+
}
|
|
8242
|
+
const groups = search.kind === "done" ? search.result.pieces.map((match) => ({
|
|
8243
|
+
...match,
|
|
8244
|
+
blocks: match.blocks.filter((hit) => !presetKeys.has(`${hit.pieceName} ${hit.name}`))
|
|
8245
|
+
})).filter((match) => match.blocks.length > 0) : [];
|
|
8246
|
+
for (const match of groups) {
|
|
8247
|
+
rows.push({
|
|
8248
|
+
type: "piece",
|
|
8249
|
+
match
|
|
8250
|
+
});
|
|
8251
|
+
const shown = groups.length <= 2 || expanded.has(match.pieceName) ? match.blocks : match.blocks.slice(0, GROUP_BLOCKS);
|
|
8252
|
+
const logo = /* @__PURE__ */ jsx(LogoFrame, {
|
|
8253
|
+
src: match.logoUrl,
|
|
8254
|
+
alt: match.displayName,
|
|
8255
|
+
size: ROW_LOGO
|
|
8256
|
+
});
|
|
8257
|
+
for (const hit of shown) rows.push({
|
|
8258
|
+
type: "entry",
|
|
8259
|
+
entry: blockEntry(hit, logo)
|
|
8260
|
+
});
|
|
8261
|
+
if (shown.length < match.blocks.length) rows.push({
|
|
8262
|
+
type: "more",
|
|
8263
|
+
pieceName: match.pieceName,
|
|
8264
|
+
hidden: match.blocks.length - shown.length
|
|
8265
|
+
});
|
|
8266
|
+
}
|
|
8267
|
+
const partial = !pieceSource?.searchPieces || search.kind === "done" && search.result.status !== "ready";
|
|
8268
|
+
if (showCatalog && partial) {
|
|
8269
|
+
const grouped = new Set(groups.map((match) => match.pieceName));
|
|
8270
|
+
const named = (source) => source.kind === "piece" && matchesQuery(source.piece.displayName, tokens) ? 0 : 1;
|
|
8271
|
+
for (const source of [...sources].sort((a, b) => named(a) - named(b))) {
|
|
8272
|
+
if (source.kind !== "piece" || grouped.has(source.id)) continue;
|
|
8273
|
+
rows.push({
|
|
8274
|
+
type: "piece",
|
|
8275
|
+
match: {
|
|
8276
|
+
pieceName: source.piece.name,
|
|
8277
|
+
pieceVersion: source.piece.version ?? "",
|
|
8278
|
+
displayName: source.piece.displayName,
|
|
8279
|
+
description: source.piece.description,
|
|
8280
|
+
logoUrl: source.piece.logoUrl,
|
|
8281
|
+
categories: source.piece.categories,
|
|
8282
|
+
source: source.piece.source ?? "activepieces",
|
|
8283
|
+
namedPiece: true,
|
|
8284
|
+
blocks: []
|
|
8285
|
+
}
|
|
8286
|
+
});
|
|
8287
|
+
}
|
|
8288
|
+
}
|
|
8289
|
+
}
|
|
8290
|
+
const activeRow = rowIndex < 0 ? rows.findIndex((row) => row.type === "entry") : Math.min(rowIndex, rows.length - 1);
|
|
8291
|
+
const twoPane = showCatalog || sources.length > 1;
|
|
8292
|
+
const pane = twoPane ? paneState : "entries";
|
|
8293
|
+
const selectSource = (id) => {
|
|
8294
|
+
setSelectedId(id);
|
|
8295
|
+
setPane("sources");
|
|
8296
|
+
setEntryIndex(-1);
|
|
8297
|
+
};
|
|
8298
|
+
const openSource = (id) => {
|
|
8299
|
+
setSelectedId(id);
|
|
8300
|
+
setPane("entries");
|
|
8301
|
+
setEntryIndex(0);
|
|
8302
|
+
};
|
|
8303
|
+
const openPiece = (pieceName) => {
|
|
8304
|
+
if (!modePieces.some((piece) => piece.name === pieceName)) {
|
|
8305
|
+
setExpanded(/* @__PURE__ */ new Set([...expanded, pieceName]));
|
|
8306
|
+
return;
|
|
8307
|
+
}
|
|
8308
|
+
setQuery("");
|
|
8309
|
+
setChip(null);
|
|
8310
|
+
if (tab !== "all") setTab("all");
|
|
8311
|
+
openSource(pieceName);
|
|
8312
|
+
inputRef.current?.focus();
|
|
8313
|
+
};
|
|
8314
|
+
const hoverSource = (id) => {
|
|
8315
|
+
if (!pointerMoved.current) return;
|
|
8316
|
+
clearTimeout(hoverTimer.current);
|
|
8317
|
+
hoverTimer.current = setTimeout(() => selectSource(id), HOVER_PREVIEW_MS);
|
|
8318
|
+
};
|
|
8319
|
+
const step = (index, delta, count) => count === 0 ? index : Math.min(Math.max(index + delta, 0), count - 1);
|
|
8320
|
+
const onKeyDown = (event) => {
|
|
8321
|
+
const key = event.key;
|
|
8322
|
+
if (key !== "Escape" && event.target !== inputRef.current) return;
|
|
8323
|
+
if (key === "Escape") {
|
|
8324
|
+
event.stopPropagation();
|
|
8325
|
+
if (query !== "") setQuery("");
|
|
8326
|
+
else if (twoPane && pane === "entries" && !searching) setPane("sources");
|
|
8327
|
+
else onClose();
|
|
8328
|
+
return;
|
|
8329
|
+
}
|
|
8330
|
+
const delta = key === "ArrowDown" ? 1 : key === "ArrowUp" ? -1 : 0;
|
|
8331
|
+
if (searching) {
|
|
8332
|
+
if (delta !== 0) {
|
|
8333
|
+
event.preventDefault();
|
|
8334
|
+
setRowIndex(Math.max(step(activeRow, delta, rows.length), 0));
|
|
8335
|
+
return;
|
|
8336
|
+
}
|
|
8337
|
+
if (key === "Enter") {
|
|
8338
|
+
event.preventDefault();
|
|
8339
|
+
if (search.kind === "done" && search.stale) return;
|
|
8340
|
+
const row = rows.at(activeRow);
|
|
8341
|
+
if (!row) return;
|
|
8342
|
+
if (row.type === "entry") {
|
|
8343
|
+
if (row.entry.unavailable === void 0) row.entry.pick();
|
|
8344
|
+
} else if (row.type === "piece") openPiece(row.match.pieceName);
|
|
8345
|
+
else if (row.type === "list") openSource(row.source.id);
|
|
8346
|
+
else setExpanded(/* @__PURE__ */ new Set([...expanded, row.pieceName]));
|
|
8347
|
+
}
|
|
8348
|
+
return;
|
|
8349
|
+
}
|
|
8350
|
+
const sideways = query === "";
|
|
8351
|
+
if (pane === "sources") {
|
|
8352
|
+
if (delta !== 0) {
|
|
8353
|
+
event.preventDefault();
|
|
8354
|
+
const next = sources.at(step(sourceIndex, delta, sources.length));
|
|
8355
|
+
if (next) selectSource(next.id);
|
|
8356
|
+
} else if (key === "Enter" || sideways && key === "ArrowRight") {
|
|
8357
|
+
event.preventDefault();
|
|
8358
|
+
if (selected) openSource(selected.id);
|
|
8359
|
+
}
|
|
8360
|
+
return;
|
|
8361
|
+
}
|
|
8362
|
+
if (delta !== 0) {
|
|
8363
|
+
event.preventDefault();
|
|
8364
|
+
setEntryIndex(step(entryIndex, delta, entries.length));
|
|
8365
|
+
} else if (sideways && key === "ArrowLeft") {
|
|
8366
|
+
event.preventDefault();
|
|
8367
|
+
setPane("sources");
|
|
8368
|
+
} else if (key === "Enter") {
|
|
8369
|
+
event.preventDefault();
|
|
8370
|
+
const entry = entryAt < 0 ? void 0 : entries.at(entryAt);
|
|
8371
|
+
if (entry && entry.unavailable === void 0) entry.pick();
|
|
8372
|
+
}
|
|
7493
8373
|
};
|
|
7494
|
-
const
|
|
7495
|
-
const
|
|
7496
|
-
const
|
|
7497
|
-
const
|
|
8374
|
+
const width = props.width ?? (pieceSource ? PICKER_SIZE.width : 360);
|
|
8375
|
+
const activeList = searching ? listIds.results : pane === "entries" ? listIds.entries : listIds.sources;
|
|
8376
|
+
const activeIndex = searching ? activeRow : pane === "entries" ? entryAt : sourceIndex;
|
|
8377
|
+
const activeOption = activeIndex >= 0 ? optionId(activeList, activeIndex) : void 0;
|
|
8378
|
+
const searchStatus = search.kind === "loading" || search.kind === "done" && search.stale ? /* @__PURE__ */ jsx(Status, { children: "Searching…" }) : search.kind === "error" ? /* @__PURE__ */ jsx(Status, {
|
|
8379
|
+
error: true,
|
|
8380
|
+
children: search.message
|
|
8381
|
+
}) : search.kind === "done" && search.result.status === "indexing" ? /* @__PURE__ */ jsx(Status, { children: "Still indexing the catalog: pieces are matched by name until it is ready." }) : search.kind === "done" && search.result.status === "error" ? /* @__PURE__ */ jsxs(Status, {
|
|
8382
|
+
error: true,
|
|
8383
|
+
children: [search.result.error ?? "Search failed", "; pieces are matched by name."]
|
|
8384
|
+
}) : rows.length === 0 ? /* @__PURE__ */ jsxs(Status, { children: [
|
|
8385
|
+
"No matching ",
|
|
8386
|
+
kind,
|
|
8387
|
+
"s"
|
|
8388
|
+
] }) : null;
|
|
8389
|
+
const compact = !twoPane && !searching;
|
|
8390
|
+
const height = props.height ?? PICKER_SIZE.height;
|
|
7498
8391
|
return /* @__PURE__ */ jsxs("div", {
|
|
7499
8392
|
ref: containerRef,
|
|
7500
|
-
className: "nodrag nopan nowheel
|
|
8393
|
+
className: "nodrag nopan nowheel flex flex-col overflow-hidden rounded-lg border border-solid border-foreground/10 bg-card shadow-xl",
|
|
8394
|
+
style: compact ? {
|
|
8395
|
+
width,
|
|
8396
|
+
maxHeight: height
|
|
8397
|
+
} : {
|
|
8398
|
+
width,
|
|
8399
|
+
height
|
|
8400
|
+
},
|
|
7501
8401
|
onClick: (event) => event.stopPropagation(),
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
children: chips.map((label) => /* @__PURE__ */ jsx(Chip, {
|
|
7516
|
-
label,
|
|
7517
|
-
active: chip === label,
|
|
7518
|
-
onClick: () => setChip(chip === label ? null : label)
|
|
7519
|
-
}, label))
|
|
7520
|
-
}) : null] })]
|
|
7521
|
-
}), piece ? /* @__PURE__ */ jsx(PieceEntries, {
|
|
7522
|
-
piece,
|
|
7523
|
-
mode,
|
|
7524
|
-
onPick: pick,
|
|
7525
|
-
onHover: prefetch,
|
|
7526
|
-
onBack: () => setPiece(null),
|
|
7527
|
-
versionNote
|
|
7528
|
-
}) : /* @__PURE__ */ jsxs("div", {
|
|
7529
|
-
className: "max-h-80 overflow-y-auto py-1",
|
|
7530
|
-
children: [
|
|
7531
|
-
filteredAttach.length > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(SectionLabel, { children: "Attach existing step" }), filteredAttach.map((step) => /* @__PURE__ */ jsx(Row, {
|
|
7532
|
-
logo: /* @__PURE__ */ jsx(BlockLogo, {
|
|
7533
|
-
block: stepBlock(step),
|
|
7534
|
-
size: ROW_LOGO
|
|
7535
|
-
}),
|
|
7536
|
-
label: step.name,
|
|
7537
|
-
description: `{{steps.${step.key}}} · detached`,
|
|
7538
|
-
onClick: () => props.onAttach?.(step.id)
|
|
7539
|
-
}, step.id))] }) : null,
|
|
7540
|
-
corePresets.length > 0 && labelPresets ? /* @__PURE__ */ jsx(SectionLabel, { children: "Core" }) : null,
|
|
7541
|
-
corePresets.map(presetRow),
|
|
7542
|
-
powerhousePresets.length > 0 && labelPresets ? /* @__PURE__ */ jsx(SectionLabel, { children: "Powerhouse" }) : null,
|
|
7543
|
-
powerhousePresets.map(presetRow),
|
|
7544
|
-
searchActive ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(SectionLabel, { children: mode === "triggers" ? "Triggers" : "Actions & triggers" }), search.kind === "loading" ? /* @__PURE__ */ jsx("div", {
|
|
7545
|
-
className: "px-3 py-1 text-xs text-muted-foreground/80",
|
|
7546
|
-
children: "Searching…"
|
|
7547
|
-
}) : search.kind === "error" ? /* @__PURE__ */ jsx("div", {
|
|
7548
|
-
className: "px-3 py-1 text-xs text-wf-fail",
|
|
7549
|
-
children: search.message
|
|
7550
|
-
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [hits.map((hit) => {
|
|
7551
|
-
const unavailable = blockUnavailable(hit);
|
|
7552
|
-
const block = {
|
|
7553
|
-
pieceName: hit.pieceName,
|
|
7554
|
-
pieceVersion: hit.pieceVersion,
|
|
7555
|
-
kind: hit.kind,
|
|
7556
|
-
name: hit.name
|
|
7557
|
-
};
|
|
7558
|
-
return /* @__PURE__ */ jsx(Row, {
|
|
7559
|
-
logo: /* @__PURE__ */ jsx(LogoFrame, {
|
|
7560
|
-
src: hit.logoUrl,
|
|
7561
|
-
alt: hit.pieceDisplayName,
|
|
7562
|
-
size: ROW_LOGO
|
|
8402
|
+
onKeyDown,
|
|
8403
|
+
onMouseMove: () => {
|
|
8404
|
+
pointerMoved.current = true;
|
|
8405
|
+
},
|
|
8406
|
+
children: [
|
|
8407
|
+
/* @__PURE__ */ jsxs("div", {
|
|
8408
|
+
className: "shrink-0 border-b border-foreground/10",
|
|
8409
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
8410
|
+
className: "flex items-center gap-2 px-3.5 pt-3 text-muted-foreground",
|
|
8411
|
+
children: [
|
|
8412
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
8413
|
+
name: "search",
|
|
8414
|
+
size: 15
|
|
7563
8415
|
}),
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
8416
|
+
/* @__PURE__ */ jsx("input", {
|
|
8417
|
+
ref: inputRef,
|
|
8418
|
+
autoFocus: true,
|
|
8419
|
+
role: "combobox",
|
|
8420
|
+
"aria-expanded": true,
|
|
8421
|
+
"aria-autocomplete": "list",
|
|
8422
|
+
"aria-label": `Search ${props.title.toLowerCase()}`,
|
|
8423
|
+
"aria-controls": activeList,
|
|
8424
|
+
"aria-activedescendant": activeOption,
|
|
8425
|
+
className: "min-w-0 flex-1 bg-transparent py-1 text-sm text-foreground outline-none placeholder:text-muted-foreground",
|
|
8426
|
+
placeholder: pieceSource ? `Search pieces and ${kind}s…` : "Search…",
|
|
8427
|
+
value: query,
|
|
8428
|
+
onChange: (event) => {
|
|
8429
|
+
setQuery(event.target.value);
|
|
8430
|
+
setRowIndex(-1);
|
|
8431
|
+
setExpanded(/* @__PURE__ */ new Set());
|
|
8432
|
+
}
|
|
8433
|
+
}),
|
|
8434
|
+
/* @__PURE__ */ jsx("span", {
|
|
8435
|
+
className: "shrink-0 truncate text-xs",
|
|
8436
|
+
children: props.title
|
|
7575
8437
|
})
|
|
7576
|
-
|
|
7577
|
-
}),
|
|
7578
|
-
className: "px-3
|
|
7579
|
-
children:
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
8438
|
+
]
|
|
8439
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
8440
|
+
className: "px-3 pb-2.5 pt-2",
|
|
8441
|
+
children: /* @__PURE__ */ jsx(Tabs, {
|
|
8442
|
+
tabs,
|
|
8443
|
+
active: tab,
|
|
8444
|
+
onSelect: (next, fromKeyboard) => {
|
|
8445
|
+
setTab(next);
|
|
8446
|
+
setChip(null);
|
|
8447
|
+
setSelectedId(null);
|
|
8448
|
+
setPane("sources");
|
|
8449
|
+
if (!fromKeyboard) inputRef.current?.focus();
|
|
8450
|
+
}
|
|
8451
|
+
})
|
|
8452
|
+
})]
|
|
8453
|
+
}),
|
|
8454
|
+
showChips && catalog && !catalog.error ? /* @__PURE__ */ jsx(ChipBar, { children: chips.map((label, index) => /* @__PURE__ */ jsx(Chip, {
|
|
8455
|
+
label,
|
|
8456
|
+
active: activeChip === label,
|
|
8457
|
+
tabStop: activeChip === null ? index === 0 : activeChip === label,
|
|
8458
|
+
onClick: (fromKeyboard) => {
|
|
8459
|
+
setChip(activeChip === label ? null : label);
|
|
8460
|
+
setSelectedId(null);
|
|
8461
|
+
if (!fromKeyboard) inputRef.current?.focus();
|
|
8462
|
+
}
|
|
8463
|
+
}, label)) }) : null,
|
|
8464
|
+
searching ? /* @__PURE__ */ jsx(SearchList, {
|
|
8465
|
+
rows,
|
|
8466
|
+
tokens,
|
|
8467
|
+
activeIndex: activeRow,
|
|
8468
|
+
onActivate: (index) => {
|
|
8469
|
+
if (pointerMoved.current) setRowIndex(index);
|
|
8470
|
+
},
|
|
8471
|
+
onOpenPiece: openPiece,
|
|
8472
|
+
onOpenList: (id) => {
|
|
8473
|
+
setQuery("");
|
|
8474
|
+
openSource(id);
|
|
8475
|
+
},
|
|
8476
|
+
onExpand: (name) => setExpanded(/* @__PURE__ */ new Set([...expanded, name])),
|
|
8477
|
+
status: searchStatus,
|
|
8478
|
+
kind,
|
|
8479
|
+
listId: listIds.results,
|
|
8480
|
+
resetKey: `${query} ${JSON.stringify(searchFilter)}`,
|
|
8481
|
+
stale: search.kind === "done" && search.stale
|
|
8482
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
8483
|
+
className: "flex min-h-0 flex-1",
|
|
8484
|
+
children: [twoPane ? /* @__PURE__ */ jsxs("div", {
|
|
8485
|
+
className: "flex w-56 shrink-0 flex-col border-r border-foreground/10 bg-foreground/[0.025]",
|
|
7585
8486
|
children: [
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
8487
|
+
catalog?.error ? /* @__PURE__ */ jsxs("div", {
|
|
8488
|
+
className: "flex items-center gap-2 px-3 py-2 text-xs text-wf-fail",
|
|
8489
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
8490
|
+
className: "min-w-0 flex-1",
|
|
8491
|
+
children: catalog.error
|
|
8492
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
8493
|
+
type: "button",
|
|
8494
|
+
className: "shrink-0 cursor-pointer rounded border border-solid border-foreground/15 bg-card px-1.5 py-0.5 text-foreground hover:border-foreground/25",
|
|
8495
|
+
onClick: () => {
|
|
8496
|
+
setCatalog(null);
|
|
8497
|
+
setCatalogRound((round) => round + 1);
|
|
8498
|
+
},
|
|
8499
|
+
children: "Retry"
|
|
8500
|
+
})]
|
|
8501
|
+
}) : null,
|
|
8502
|
+
/* @__PURE__ */ jsx(VirtualList, {
|
|
8503
|
+
id: listIds.sources,
|
|
8504
|
+
label: "Pieces",
|
|
8505
|
+
resetKey: `${tab} ${activeChip ?? ""} ${query}`,
|
|
8506
|
+
className: "flex-1 py-1",
|
|
8507
|
+
items: sources,
|
|
8508
|
+
heightOf: sourceHeight,
|
|
8509
|
+
keyOf: (source) => `${source.kind}:${source.id}`,
|
|
8510
|
+
activeIndex: sourceIndex,
|
|
8511
|
+
render: (source, index) => /* @__PURE__ */ jsx(SourceRow, {
|
|
8512
|
+
source,
|
|
8513
|
+
tokens,
|
|
8514
|
+
mode,
|
|
8515
|
+
active: pane === "sources" && index === sourceIndex,
|
|
8516
|
+
selected: index === sourceIndex,
|
|
8517
|
+
option: {
|
|
8518
|
+
list: listIds.sources,
|
|
8519
|
+
index,
|
|
8520
|
+
size: sources.length
|
|
8521
|
+
},
|
|
8522
|
+
onActivate: () => hoverSource(source.id),
|
|
8523
|
+
onOpen: () => {
|
|
8524
|
+
clearTimeout(hoverTimer.current);
|
|
8525
|
+
openSource(source.id);
|
|
8526
|
+
inputRef.current?.focus();
|
|
8527
|
+
}
|
|
8528
|
+
})
|
|
8529
|
+
}),
|
|
8530
|
+
showCatalog && catalog === null ? /* @__PURE__ */ jsx(Status, { children: "Loading catalog…" }) : sources.length === 0 ? /* @__PURE__ */ jsx(Status, { children: tab === "powerhouse" && tokens.length === 0 ? "No registry pieces on this runtime" : "No matching pieces" }) : null
|
|
7589
8531
|
]
|
|
7590
|
-
}) : null
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
|
|
7594
|
-
|
|
7595
|
-
|
|
7596
|
-
|
|
7597
|
-
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
})]
|
|
7608
|
-
}) : filteredPieces.map((entry) => /* @__PURE__ */ jsx(Row, {
|
|
7609
|
-
logo: /* @__PURE__ */ jsx(LogoFrame, {
|
|
7610
|
-
src: entry.logoUrl,
|
|
7611
|
-
alt: entry.displayName,
|
|
7612
|
-
size: ROW_LOGO
|
|
7613
|
-
}),
|
|
7614
|
-
label: entry.deprecated ? `${entry.displayName} (deprecated)` : entry.displayName,
|
|
7615
|
-
description: entry.unsupported ?? (mode === "triggers" ? `${entry.triggerCount} trigger${entry.triggerCount === 1 ? "" : "s"} · ${entry.description}` : `${entry.actionCount} action${entry.actionCount === 1 ? "" : "s"} · ${entry.description}`),
|
|
7616
|
-
version: shownVersion(entry.name, entry.version),
|
|
7617
|
-
versionNote: versionNote(entry.name, entry.version),
|
|
7618
|
-
onClick: () => setPiece(entry)
|
|
7619
|
-
}, entry.name))] }) : null,
|
|
7620
|
-
corePresets.length + powerhousePresets.length === 0 && filteredPieces.length === 0 && filteredAttach.length === 0 && !searchActive ? /* @__PURE__ */ jsx("div", {
|
|
7621
|
-
className: "px-3 py-2 text-xs text-muted-foreground/80",
|
|
7622
|
-
children: "No matches"
|
|
7623
|
-
}) : null
|
|
7624
|
-
]
|
|
7625
|
-
})]
|
|
8532
|
+
}) : null, /* @__PURE__ */ jsx(EntriesPane, {
|
|
8533
|
+
source: selected,
|
|
8534
|
+
mode,
|
|
8535
|
+
pieceEntries,
|
|
8536
|
+
pieceError: selected?.kind === "piece" ? loaded.error : null,
|
|
8537
|
+
tokens,
|
|
8538
|
+
activeIndex: pane === "entries" ? entryAt : -1,
|
|
8539
|
+
listId: listIds.entries,
|
|
8540
|
+
showHeader: twoPane,
|
|
8541
|
+
onActivate: (index) => {
|
|
8542
|
+
if (!pointerMoved.current) return;
|
|
8543
|
+
setPane("entries");
|
|
8544
|
+
setEntryIndex(index);
|
|
8545
|
+
}
|
|
8546
|
+
})]
|
|
8547
|
+
})
|
|
8548
|
+
]
|
|
7626
8549
|
});
|
|
7627
8550
|
}
|
|
7628
8551
|
//#endregion
|
|
7629
|
-
export {
|
|
8552
|
+
export { useTestStepRunner as $, runStats as A, Switch as At, useBlockForms as B, DocumentLoadError as Bt, canRerun as C, Button as Ct, formatMs as D, IconButton as Dt, formatDuration as E, Hint as Et, toneOf as F, textAreaClass as Ft, useDesignTime as G, useBlockResolutions as H, useQuery as Ht, workflowHealth as I, textInputClass as It, useDynamicPrefetch as J, useDynamicCache as K, DesignTimeProvider as L, Icon as Lt, runTimeline as M, Toggle as Mt, runTone as N, Tooltip as Nt, formatTrigger as O, Segmented as Ot, statusLabel as P, invalidClass as Pt, useRunById as Q, useBlockForm as R, isIconName as Rt, TONE_TEXT as S, useSecretStat as St, formatAbsolute as T, FieldLabel as Tt, useCachedBlockForm as U, useBlockPorts as V, errorMessage as Vt, useConnectionList as W, useOptionSearch as X, useLatestRun as Y, useResolvedProp as Z, CONNECTION_TONE as _, useRunPagesQuery as _t, BlockResolutionsProvider as a, parsePropList as at, STEP_TONE as b, useRuntime as bt, runsDifferentVersion as c, storedSchema as ct, versionBadge as d, withSetting as dt, useTestTrigger as et, blockMeta as f, workflowReadiness as ft, usePieceLogos as g, usePieceCatalog as gt, useBlockMeta as h, useOAuthRedirectUri as ht, PickerPopover as i, isPropVisible as it, runStatusLabel as j, Tabs$1 as jt, formatWhen as k, Select as kt, updateVersion as l, stripOptions as lt, pieceLogo as m, useOAuthAttempt as mt, BlockSelector as n, blockMissing as nt, VersionSummary as o, resolverInputFor as ot, pieceDisplayName as p, WorkflowRuntimeProvider as pt, useDynamicLookup as q, PICKER_SIZE as r, isEmptyValue as rt, resolutionText as s, settingFor as st, BlockLogo as t, useWebhookEndpoint as tt, useResolution as u, undeclaredPortIssues as ut, RUN_STATUSES as v, useRunQuery as vt, durationMs as w, FieldError as wt, TONE_DOT as x, useRuntimeActions as xt, RUN_TONE as y, useRunsQuery as yt, useBlockFormLoader as z, DocumentErrorBoundary as zt };
|
|
7630
8553
|
|
|
7631
|
-
//# sourceMappingURL=BlockSelector-
|
|
8554
|
+
//# sourceMappingURL=BlockSelector-CzJnQWsh.js.map
|