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