@oomol-lab/open-flow 0.1.0-beta.81 → 0.1.0-beta.82
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/README.md +35 -0
- package/dist/browser/{FlowCanvas-CrsiDHK8.js → FlowCanvas-Dew2fmoT.js} +55 -274
- package/dist/browser/{createResourceDialog-CS3u9ga9.js → createResourceDialog-bdOJa5Zk.js} +2 -1
- package/dist/browser/{exportPng-BOPfjeEi.js → exportPng-Cjdb6COo.js} +2 -2
- package/dist/browser/{flowChanges-CFj5pL4Y.js → flowChanges-URBEd4DI.js} +2583 -71
- package/dist/browser/{flowWorkspace-BeQaeJ3e.js → flowWorkspace-BlXx-yAn.js} +440 -2578
- package/dist/browser/{markdownContent-CAG_CQfH.js → markdownContent-D8G_oNOe.js} +18 -41
- package/dist/browser/{markdownContent-frwDfQQU.js → markdownContent-IS8xXDoc.js} +18 -40
- package/dist/browser/preview.css +88 -80
- package/dist/browser/preview.js +150 -60
- package/dist/browser/ui.css +8 -0
- package/dist/browser/{dist-CHwj9BhV.js → videoLink-NAWDmBtf.js} +35 -1
- package/dist/browser/workbench-contract.d.ts +6 -0
- package/dist/browser/workbench.css +259 -251
- package/dist/browser/workbench.d.ts +2 -0
- package/dist/browser/workbench.js +289 -137
- package/dist/browser/{ContentIcon-CMn0c-kl.js → wrapLayout-DZvW9dBs.js} +4397 -4152
- package/dist/command/index.js +43 -41
- package/dist/common/authoring.d.ts +1 -1
- package/dist/common/control-api-conformance.js +306 -2
- package/dist/common/control-api.d.ts +20 -0
- package/dist/common/control-api.js +306 -4
- package/dist/common/control-requests.d.ts +3 -5
- package/dist/common/control-requests.js +5 -7
- package/dist/common/flow-encoding.d.ts +1 -0
- package/dist/common/flow-encoding.js +167 -1
- package/dist/common/flow-semantics.js +20 -0
- package/dist/common/flow-workflowBundle.d.ts +27 -0
- package/dist/common/flow-workflowFile.d.ts +2 -0
- package/dist/common/flow-workflowReferences.d.ts +4 -0
- package/dist/common/mcp.d.ts +2 -0
- package/dist/common/mcp.js +312 -4
- package/dist/render/browser/licenses.md +4047 -0
- package/dist/render/browser/runtime.css +14877 -0
- package/dist/render/browser/runtime.js +266765 -0
- package/dist/render/common/png.d.ts +24 -0
- package/dist/render/node/index.d.ts +11 -0
- package/dist/render/node/index.js +9491 -0
- package/dist/render/node/licenses.md +75 -0
- package/package.json +12 -2
- package/src/control/common/api.ts +50 -0
- package/src/control/common/flowDecoders.ts +2 -0
- package/src/control/common/mcp.ts +4 -4
- package/src/control/common/requests.ts +12 -1
- package/src/flow/common/encoding.ts +1 -0
- package/src/flow/common/workflowBundle.ts +117 -0
- package/src/flow/common/workflowFile.ts +4 -0
- package/src/flow/common/workflowReferences.ts +20 -0
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as
|
|
1
|
+
import { o as __toESM, r as __exportAll, t as __commonJSMin } from "./rolldown-runtime-CEgmsyvS.js";
|
|
2
|
+
import { A as DropdownMenuLabel, D as DropdownMenuContent, E as DropdownMenuCheckboxItem, F as DropdownMenuSubContent, I as DropdownMenuSubTrigger, L as DropdownMenuTrigger, M as DropdownMenuRadioItem, N as DropdownMenuSeparator, O as DropdownMenuGroup, P as DropdownMenuSub, Q as waitBranchDescription, S as IconifyProvider, T as DropdownMenu, _ as ContentIcon, c as PopoverDescription, d as PopoverTitle, f as PopoverTrigger, g as Z$1, h as VirtualScrollArea, j as DropdownMenuRadioGroup, k as DropdownMenuItem, l as PopoverHeader, lt as Checkbox, m as ScrollArea, o as Popover, p as NativeScrollArea, r as Textarea, s as PopoverContent, u as PopoverPanelContent, ut as useAriaLabelledBy } from "./wrapLayout-DZvW9dBs.js";
|
|
3
3
|
import { i as compute, l as val } from "./dist-bO8nvHFH.js";
|
|
4
4
|
import { c as useLang, l as useTranslate, o as I18nProvider, r as isPlainObject, s as useI18n, u as useVal } from "./dist-BFmpkX4P.js";
|
|
5
|
-
import { A as string, Bn as transitionStatusMapping, Cr as cn,
|
|
5
|
+
import { A as string, Bn as transitionStatusMapping, Cr as cn, Er as useRenderElement, Fr as formatErrorMessage, In as useTransitionStatus, Ir as mergeProps, Ln as useOpenChangeComplete, Lr as useIsoLayoutEffect, Mr as useButton, Nn as useLabelableId, Or as EMPTY_OBJECT, Qt as useStore, Sr as buttonVariants, Un as useValueChanged, Wn as createChangeEventDetails, _r as fieldValidityMapping, a as createTooltipHandle, br as useControlled, c as TooltipPositioner, d as TooltipRoot, dr as useFormContext, fr as useRegisterFieldControl, i as TooltipTrigger, jr as useMergedRefs, l as TooltipPortal, mr as useBaseUiId, mt as triggerOpenStateMapping, n as TooltipContent, nn as require_builtin_esm_external_require_react, o as TooltipArrow, p as timeZoneOffsetMinutes, pr as useFieldRootContext, qn as clearPress, r as TooltipProvider, rr as none, s as TooltipPopup, t as Tooltip, u as TooltipTrigger$1, ur as useLabelableContext, vr as visuallyHidden, wr as cva, xr as Button$1, yr as visuallyHiddenInput, zr as useStableCallback } from "./tooltip-BDcVTNpu.js";
|
|
6
6
|
import { $ as waitAutoContinueSchema, A as comparisonIssue, At as variableInputCompatible, Bt as SelectChevron, Ct as limitDecisionQuestions, D as nodeSystemOutputPorts, Dt as matchesSchema, E as nodeErrorSchema, F as operatorsForType, Gt as SelectTrigger, Ht as SelectGroup, It as skipDuplicatesConfigSchema, J as webhookResponseAllowsBody, K as webhookHeaderValuePort, Kt as SelectValue, L as unaryOperator, O as supportsNodeErrorHandling, Ot as portsAssignable, P as operandHandle, Q as workflowOutputsPort, R as valueType, Rt as dequal, St as defaultDecisionQuestion, T as workflowToolNameIssue, Tt as webhookSupportsBody, U as decodeRevisionContent, Ut as SelectItem, Vt as SelectContent, Wt as SelectSeparator, X as webhookResponseTimeout, Y as webhookResponseInputs, Z as webhookStatusCodePort, _t as isHttpHost, a as DialogFooter, an as ChevronDown, at as httpHeaderSchema, b as nodeNameIssue, bt as decisionQuestionIssues, c as DialogTrigger, d as Field, et as defaultNodeRetry, f as FieldDescription, h as FieldLabel, i as DialogDescription, in as Input, kt as schemaObject, l as Icon, lt as httpRequestIssues, m as FieldGroup, nt as retryConfigurationSchema, o as DialogHeader, ot as httpQuerySchema, p as FieldError, pt as httpHeaderNameIssue, q as webhookHeadersPort, r as DialogContent, rn as Label, rt as supportsNodeRetry, s as DialogTitle, t as Dialog, tt as nodeRetryLimits, u as Spinner, ut as httpRequestTask, vt as decisionLimits, wt as webhookMethods, xt as decisionTask, zt as Select$1 } from "./dialog-CFlvkliO.js";
|
|
7
|
-
import { C as
|
|
8
|
-
import { $ as resourceValue, $
|
|
9
|
-
import { r as resolveUiLanguage } from "./languages-gYzoQqCi.js";
|
|
7
|
+
import { C as isMac, S as toManifestNodeId, _ as E$1, a as CanvasNodeIcon, b as toViewEdge, c as collapseAllNested, d as IconStack, f as selectableTimeZones, g as cronDescription, h as timeZoneOffset, i as pasteVideoLink, l as formatDuration, m as timeZoneLongLabel, n as setAddItemId, o as defaultTriggerIcon, p as timeZoneLabel, s as JSONViewer, t as FlowCanvas, u as useDebouncedValue, v as CanvasTooltip, w as isSameViewport, x as toManifestHandleName, y as CanvasStore } from "./FlowCanvas-Dew2fmoT.js";
|
|
8
|
+
import { $ as resourceValue, $t as WorkflowExportDialog, A as schemaForEditor, An as TabsTrigger, Ar as serverAddress, B as datePickerValue, Bn as EmptyMedia, Br as ApiError, Cn as selectors, Cr as inputValue, D as defaultValueEditorSchema, Dn as Tabs, Dr as openApiTask, Dt as diagnosticMessage, E as supportsFeishuChatFilter, En as IconPickerButton, Er as openApiFieldIssues, F as calendarChange, Fn as InputGroupInput, Fr as workflowCandidateGroup, G as indexAddNodeOptions, Gn as SourceSelect, H as isDateFormat, Hn as Badge, Hr as eventSourceKind, I as calendarDate, In as Empty, Ir as workflowCapability, Jn as EventSourceSetup, Kn as createI18n, L as dateFromTimeZone, Ln as EmptyContent, Lr as workflowSelectionTask, M as getDefaultValue, Mn as followWorkbenchLink, Mr as sameWorkflowInterface, N as isUnconstrainedSchema, Nn as InputGroup, Nr as workflowAgentTool, O as editorComponent, On as TabsContent, Or as securityOptions, Ot as diagnosticNodeId, P as typeOfSchema, Pn as InputGroupAddon, Q as resourceData, R as dateInTimeZone, Rn as EmptyDescription, Sn as ComboboxRoot, Sr as triggerConfigValues, St as revisionView, T as feishuResourceKind, Tn as useComboboxRootContext, Tr as object$1, V as dateTimeWall, Vn as EmptyTitle, Vr as controlErrorCode, Wn as SourceForm, Y as connectorActionPresentation, Yn as errorNotice, Z as observeResource, Zt as dequal$1, _n as ComboboxList, _t as actionSummary, ar as webhookResponseDiagnostics, bn as ComboboxInputGroup, bt as canCancelRun, cn as selectionMenuItemClass, dn as valueEditor_module_default, dr as isJsonObject, dt as loadJson, en as WorkflowExportMenuItem, er as decodeResultList, fn as ComboboxItemIndicator, ft as designerGraph, gn as ComboboxPortal, gt as triggerNodeIcon, hn as ComboboxPositioner, ht as semanticNodeIcon, ir as resolutionOutputPorts, it as decodeAppCatalogResponse, j as valueForEditor, jr as servers, jt as connectionCatalog, k as editorGroups, kn as TabsList, kr as selectOperation, kt as schemaMismatchMessage, ln as ValueControl, mn as ComboboxPopup, mt as nodeTitle, n as agentTool, nn as IdTooltip, nr as executionReachableNodes, or as sourceOutputLabel, ot as getAppCatalogCache, pn as ComboboxItem, pt as nodeIcon, q as mapSource, qn as FeishuEventPicker, rn as FlowSettingsButton, rr as inputSourceCandidates, sn as selectionMenuContentClass, sr as sourcePort, tn as useWorkflowExportAction, tt as provider, un as ValueEditorFeedback, ur as triggerOutputDefinitions, vn as GroupCollectionProvider, vt as providerIcon, wn as useComboboxInputValueContext, wr as listOperations, xn as ComboboxInput, xr as triggerConfigValue, xt as hasRunFilter, yn as ComboboxTrigger, z as datePickerChange, zn as EmptyHeader } from "./flowChanges-URBEd4DI.js";
|
|
10
9
|
import { a as renameObjectField, i as objectValue, n as isJsonValue, o as setObjectField, r as jsonDataTypes, s as valueType$1, t as initialValue } from "./value-BbFQZZ_V.js";
|
|
11
10
|
import { n as compile, r as validate } from "./flowRunInputEditorStore-ys1-w9GW.js";
|
|
12
11
|
import { t as WorkbenchSelect } from "./workbenchSelect-Ci0KCYv9.js";
|
|
@@ -57,7 +56,7 @@ var ComboboxGroup = /*#__PURE__*/ React.forwardRef(function ComboboxGroup(compon
|
|
|
57
56
|
if (process.env.NODE_ENV !== "production") ComboboxGroup.displayName = "ComboboxGroup";
|
|
58
57
|
//#endregion
|
|
59
58
|
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/clear/ComboboxClear.js
|
|
60
|
-
var stateAttributesMapping$
|
|
59
|
+
var stateAttributesMapping$1 = {
|
|
61
60
|
...transitionStatusMapping,
|
|
62
61
|
...triggerOpenStateMapping
|
|
63
62
|
};
|
|
@@ -135,333 +134,13 @@ var ComboboxClear = /*#__PURE__*/ React.forwardRef(function ComboboxClear(compon
|
|
|
135
134
|
elementProps,
|
|
136
135
|
getButtonProps
|
|
137
136
|
],
|
|
138
|
-
stateAttributesMapping: stateAttributesMapping$
|
|
137
|
+
stateAttributesMapping: stateAttributesMapping$1
|
|
139
138
|
});
|
|
140
139
|
if (!(keepMounted || mounted)) return null;
|
|
141
140
|
return element;
|
|
142
141
|
});
|
|
143
142
|
if (process.env.NODE_ENV !== "production") ComboboxClear.displayName = "ComboboxClear";
|
|
144
143
|
//#endregion
|
|
145
|
-
//#region ../../node_modules/.bun/@iconify+utils@3.1.4/node_modules/@iconify/utils/lib/icon/defaults.js
|
|
146
|
-
/** Default values for dimensions */
|
|
147
|
-
var defaultIconDimensions = Object.freeze({
|
|
148
|
-
left: 0,
|
|
149
|
-
top: 0,
|
|
150
|
-
width: 16,
|
|
151
|
-
height: 16
|
|
152
|
-
});
|
|
153
|
-
/** Default values for transformations */
|
|
154
|
-
var defaultIconTransformations = Object.freeze({
|
|
155
|
-
rotate: 0,
|
|
156
|
-
vFlip: false,
|
|
157
|
-
hFlip: false
|
|
158
|
-
});
|
|
159
|
-
/** Default values for all optional IconifyIcon properties */
|
|
160
|
-
var defaultIconProps = Object.freeze({
|
|
161
|
-
...defaultIconDimensions,
|
|
162
|
-
...defaultIconTransformations
|
|
163
|
-
});
|
|
164
|
-
/** Default values for all properties used in ExtendedIconifyIcon */
|
|
165
|
-
var defaultExtendedIconProps = Object.freeze({
|
|
166
|
-
...defaultIconProps,
|
|
167
|
-
body: "",
|
|
168
|
-
hidden: false
|
|
169
|
-
});
|
|
170
|
-
//#endregion
|
|
171
|
-
//#region ../../node_modules/.bun/@iconify+utils@3.1.4/node_modules/@iconify/utils/lib/customisations/defaults.js
|
|
172
|
-
/**
|
|
173
|
-
* Default icon customisations values
|
|
174
|
-
*/
|
|
175
|
-
var defaultIconSizeCustomisations = Object.freeze({
|
|
176
|
-
width: null,
|
|
177
|
-
height: null
|
|
178
|
-
});
|
|
179
|
-
var defaultIconCustomisations = Object.freeze({
|
|
180
|
-
...defaultIconSizeCustomisations,
|
|
181
|
-
...defaultIconTransformations
|
|
182
|
-
});
|
|
183
|
-
//#endregion
|
|
184
|
-
//#region ../../node_modules/.bun/@iconify+utils@3.1.4/node_modules/@iconify/utils/lib/icon/transformations.js
|
|
185
|
-
/**
|
|
186
|
-
* Merge transformations
|
|
187
|
-
*/
|
|
188
|
-
function mergeIconTransformations(obj1, obj2) {
|
|
189
|
-
const result = {};
|
|
190
|
-
if (!obj1.hFlip !== !obj2.hFlip) result.hFlip = true;
|
|
191
|
-
if (!obj1.vFlip !== !obj2.vFlip) result.vFlip = true;
|
|
192
|
-
const rotate = ((obj1.rotate || 0) + (obj2.rotate || 0)) % 4;
|
|
193
|
-
if (rotate) result.rotate = rotate;
|
|
194
|
-
return result;
|
|
195
|
-
}
|
|
196
|
-
//#endregion
|
|
197
|
-
//#region ../../node_modules/.bun/@iconify+utils@3.1.4/node_modules/@iconify/utils/lib/icon/merge.js
|
|
198
|
-
/**
|
|
199
|
-
* Merge icon and alias
|
|
200
|
-
*
|
|
201
|
-
* Can also be used to merge default values and icon
|
|
202
|
-
*/
|
|
203
|
-
function mergeIconData(parent, child) {
|
|
204
|
-
const result = mergeIconTransformations(parent, child);
|
|
205
|
-
for (const key in defaultExtendedIconProps) if (key in defaultIconTransformations) {
|
|
206
|
-
if (key in parent && !(key in result)) result[key] = defaultIconTransformations[key];
|
|
207
|
-
} else if (key in child) result[key] = child[key];
|
|
208
|
-
else if (key in parent) result[key] = parent[key];
|
|
209
|
-
return result;
|
|
210
|
-
}
|
|
211
|
-
//#endregion
|
|
212
|
-
//#region ../../node_modules/.bun/@iconify+utils@3.1.4/node_modules/@iconify/utils/lib/icon-set/tree.js
|
|
213
|
-
/**
|
|
214
|
-
* Resolve icon set icons
|
|
215
|
-
*
|
|
216
|
-
* Returns parent icon for each icon
|
|
217
|
-
*/
|
|
218
|
-
function getIconsTree(data, names) {
|
|
219
|
-
const icons = data.icons;
|
|
220
|
-
const aliases = data.aliases || Object.create(null);
|
|
221
|
-
const resolved = Object.create(null);
|
|
222
|
-
function resolve(name) {
|
|
223
|
-
if (icons[name]) return resolved[name] = [];
|
|
224
|
-
if (!(name in resolved)) {
|
|
225
|
-
resolved[name] = null;
|
|
226
|
-
const parent = aliases[name] && aliases[name].parent;
|
|
227
|
-
const value = parent && resolve(parent);
|
|
228
|
-
if (value) resolved[name] = [parent].concat(value);
|
|
229
|
-
}
|
|
230
|
-
return resolved[name];
|
|
231
|
-
}
|
|
232
|
-
(names || Object.keys(icons).concat(Object.keys(aliases))).forEach(resolve);
|
|
233
|
-
return resolved;
|
|
234
|
-
}
|
|
235
|
-
//#endregion
|
|
236
|
-
//#region ../../node_modules/.bun/@iconify+utils@3.1.4/node_modules/@iconify/utils/lib/icon-set/get-icon.js
|
|
237
|
-
/**
|
|
238
|
-
* Get icon data, using prepared aliases tree
|
|
239
|
-
*/
|
|
240
|
-
function internalGetIconData(data, name, tree) {
|
|
241
|
-
const icons = data.icons;
|
|
242
|
-
const aliases = data.aliases || Object.create(null);
|
|
243
|
-
let currentProps = {};
|
|
244
|
-
function parse(name) {
|
|
245
|
-
currentProps = mergeIconData(icons[name] || aliases[name], currentProps);
|
|
246
|
-
}
|
|
247
|
-
parse(name);
|
|
248
|
-
tree.forEach(parse);
|
|
249
|
-
return mergeIconData(data, currentProps);
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Get data for icon
|
|
253
|
-
*/
|
|
254
|
-
function getIconData(data, name) {
|
|
255
|
-
if (data.icons[name]) return internalGetIconData(data, name, []);
|
|
256
|
-
const tree = getIconsTree(data, [name])[name];
|
|
257
|
-
return tree ? internalGetIconData(data, name, tree) : null;
|
|
258
|
-
}
|
|
259
|
-
//#endregion
|
|
260
|
-
//#region ../../node_modules/.bun/@iconify+utils@3.1.4/node_modules/@iconify/utils/lib/svg/size.js
|
|
261
|
-
/**
|
|
262
|
-
* Regular expressions for calculating dimensions
|
|
263
|
-
*/
|
|
264
|
-
var unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;
|
|
265
|
-
var unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
|
|
266
|
-
function calculateSize(size, ratio, precision) {
|
|
267
|
-
if (ratio === 1) return size;
|
|
268
|
-
precision = precision || 100;
|
|
269
|
-
if (typeof size === "number") return Math.ceil(size * ratio * precision) / precision;
|
|
270
|
-
if (typeof size !== "string") return size;
|
|
271
|
-
const oldParts = size.split(unitsSplit);
|
|
272
|
-
if (oldParts === null || !oldParts.length) return size;
|
|
273
|
-
const newParts = [];
|
|
274
|
-
let code = oldParts.shift();
|
|
275
|
-
let isNumber = unitsTest.test(code);
|
|
276
|
-
while (true) {
|
|
277
|
-
if (isNumber) {
|
|
278
|
-
const num = parseFloat(code);
|
|
279
|
-
if (isNaN(num)) newParts.push(code);
|
|
280
|
-
else newParts.push(Math.ceil(num * ratio * precision) / precision);
|
|
281
|
-
} else newParts.push(code);
|
|
282
|
-
code = oldParts.shift();
|
|
283
|
-
if (code === void 0) return newParts.join("");
|
|
284
|
-
isNumber = !isNumber;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
//#endregion
|
|
288
|
-
//#region ../../node_modules/.bun/@iconify+utils@3.1.4/node_modules/@iconify/utils/lib/svg/defs.js
|
|
289
|
-
function splitSVGDefs(content, tag = "defs") {
|
|
290
|
-
let defs = "";
|
|
291
|
-
const index = content.indexOf("<" + tag);
|
|
292
|
-
while (index >= 0) {
|
|
293
|
-
const start = content.indexOf(">", index);
|
|
294
|
-
const end = content.indexOf("</" + tag);
|
|
295
|
-
if (start === -1 || end === -1) break;
|
|
296
|
-
const endEnd = content.indexOf(">", end);
|
|
297
|
-
if (endEnd === -1) break;
|
|
298
|
-
defs += content.slice(start + 1, end).trim();
|
|
299
|
-
content = content.slice(0, index).trim() + content.slice(endEnd + 1);
|
|
300
|
-
}
|
|
301
|
-
return {
|
|
302
|
-
defs,
|
|
303
|
-
content
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Merge defs and content
|
|
308
|
-
*/
|
|
309
|
-
function mergeDefsAndContent(defs, content) {
|
|
310
|
-
return defs ? "<defs>" + defs + "</defs>" + content : content;
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Wrap SVG content, without wrapping definitions
|
|
314
|
-
*/
|
|
315
|
-
function wrapSVGContent(body, start, end) {
|
|
316
|
-
const split = splitSVGDefs(body);
|
|
317
|
-
return mergeDefsAndContent(split.defs, start + split.content + end);
|
|
318
|
-
}
|
|
319
|
-
//#endregion
|
|
320
|
-
//#region ../../node_modules/.bun/@iconify+utils@3.1.4/node_modules/@iconify/utils/lib/svg/build.js
|
|
321
|
-
/**
|
|
322
|
-
* Check if value should be unset. Allows multiple keywords
|
|
323
|
-
*/
|
|
324
|
-
var isUnsetKeyword = (value) => value === "unset" || value === "undefined" || value === "none";
|
|
325
|
-
/**
|
|
326
|
-
* Get SVG attributes and content from icon + customisations
|
|
327
|
-
*
|
|
328
|
-
* Does not generate style to make it compatible with frameworks that use objects for style, such as React.
|
|
329
|
-
* Instead, it generates 'inline' value. If true, rendering engine should add verticalAlign: -0.125em to icon.
|
|
330
|
-
*
|
|
331
|
-
* Customisations should be normalised by platform specific parser.
|
|
332
|
-
* Result should be converted to <svg> by platform specific parser.
|
|
333
|
-
* Use replaceIDs to generate unique IDs for body.
|
|
334
|
-
*/
|
|
335
|
-
function iconToSVG(icon, customisations) {
|
|
336
|
-
const fullIcon = {
|
|
337
|
-
...defaultIconProps,
|
|
338
|
-
...icon
|
|
339
|
-
};
|
|
340
|
-
const fullCustomisations = {
|
|
341
|
-
...defaultIconCustomisations,
|
|
342
|
-
...customisations
|
|
343
|
-
};
|
|
344
|
-
const box = {
|
|
345
|
-
left: fullIcon.left,
|
|
346
|
-
top: fullIcon.top,
|
|
347
|
-
width: fullIcon.width,
|
|
348
|
-
height: fullIcon.height
|
|
349
|
-
};
|
|
350
|
-
let body = fullIcon.body;
|
|
351
|
-
[fullIcon, fullCustomisations].forEach((props) => {
|
|
352
|
-
const transformations = [];
|
|
353
|
-
const hFlip = props.hFlip;
|
|
354
|
-
const vFlip = props.vFlip;
|
|
355
|
-
let rotation = props.rotate;
|
|
356
|
-
if (hFlip) if (vFlip) rotation += 2;
|
|
357
|
-
else {
|
|
358
|
-
transformations.push("translate(" + (box.width + box.left).toString() + " " + (0 - box.top).toString() + ")");
|
|
359
|
-
transformations.push("scale(-1 1)");
|
|
360
|
-
box.top = box.left = 0;
|
|
361
|
-
}
|
|
362
|
-
else if (vFlip) {
|
|
363
|
-
transformations.push("translate(" + (0 - box.left).toString() + " " + (box.height + box.top).toString() + ")");
|
|
364
|
-
transformations.push("scale(1 -1)");
|
|
365
|
-
box.top = box.left = 0;
|
|
366
|
-
}
|
|
367
|
-
let tempValue;
|
|
368
|
-
if (rotation < 0) rotation -= Math.floor(rotation / 4) * 4;
|
|
369
|
-
rotation = rotation % 4;
|
|
370
|
-
switch (rotation) {
|
|
371
|
-
case 1:
|
|
372
|
-
tempValue = box.height / 2 + box.top;
|
|
373
|
-
transformations.unshift("rotate(90 " + tempValue.toString() + " " + tempValue.toString() + ")");
|
|
374
|
-
break;
|
|
375
|
-
case 2:
|
|
376
|
-
transformations.unshift("rotate(180 " + (box.width / 2 + box.left).toString() + " " + (box.height / 2 + box.top).toString() + ")");
|
|
377
|
-
break;
|
|
378
|
-
case 3:
|
|
379
|
-
tempValue = box.width / 2 + box.left;
|
|
380
|
-
transformations.unshift("rotate(-90 " + tempValue.toString() + " " + tempValue.toString() + ")");
|
|
381
|
-
}
|
|
382
|
-
if (rotation % 2 === 1) {
|
|
383
|
-
if (box.left !== box.top) {
|
|
384
|
-
tempValue = box.left;
|
|
385
|
-
box.left = box.top;
|
|
386
|
-
box.top = tempValue;
|
|
387
|
-
}
|
|
388
|
-
if (box.width !== box.height) {
|
|
389
|
-
tempValue = box.width;
|
|
390
|
-
box.width = box.height;
|
|
391
|
-
box.height = tempValue;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
if (transformations.length) body = wrapSVGContent(body, "<g transform=\"" + transformations.join(" ") + "\">", "</g>");
|
|
395
|
-
});
|
|
396
|
-
const customisationsWidth = fullCustomisations.width;
|
|
397
|
-
const customisationsHeight = fullCustomisations.height;
|
|
398
|
-
const boxWidth = box.width;
|
|
399
|
-
const boxHeight = box.height;
|
|
400
|
-
let width;
|
|
401
|
-
let height;
|
|
402
|
-
if (customisationsWidth === null) {
|
|
403
|
-
height = customisationsHeight === null ? "1em" : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
|
|
404
|
-
width = calculateSize(height, boxWidth / boxHeight);
|
|
405
|
-
} else {
|
|
406
|
-
width = customisationsWidth === "auto" ? boxWidth : customisationsWidth;
|
|
407
|
-
height = customisationsHeight === null ? calculateSize(width, boxHeight / boxWidth) : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
|
|
408
|
-
}
|
|
409
|
-
const attributes = {};
|
|
410
|
-
const setAttr = (prop, value) => {
|
|
411
|
-
if (!isUnsetKeyword(value)) attributes[prop] = value.toString();
|
|
412
|
-
};
|
|
413
|
-
setAttr("width", width);
|
|
414
|
-
setAttr("height", height);
|
|
415
|
-
const viewBox = [
|
|
416
|
-
box.left,
|
|
417
|
-
box.top,
|
|
418
|
-
boxWidth,
|
|
419
|
-
boxHeight
|
|
420
|
-
];
|
|
421
|
-
attributes.viewBox = viewBox.join(" ");
|
|
422
|
-
return {
|
|
423
|
-
attributes,
|
|
424
|
-
viewBox,
|
|
425
|
-
body
|
|
426
|
-
};
|
|
427
|
-
}
|
|
428
|
-
//#endregion
|
|
429
|
-
//#region ../../node_modules/.bun/@iconify+utils@3.1.4/node_modules/@iconify/utils/lib/svg/id.js
|
|
430
|
-
/**
|
|
431
|
-
* Regular expression for finding ids
|
|
432
|
-
*/
|
|
433
|
-
var regex = /\sid="(\S+)"/g;
|
|
434
|
-
/**
|
|
435
|
-
* Counters
|
|
436
|
-
*/
|
|
437
|
-
var counters = /* @__PURE__ */ new Map();
|
|
438
|
-
/**
|
|
439
|
-
* Get unique new ID
|
|
440
|
-
*/
|
|
441
|
-
function nextID(id) {
|
|
442
|
-
id = id.replace(/[0-9]+$/, "") || "a";
|
|
443
|
-
const count = counters.get(id) || 0;
|
|
444
|
-
counters.set(id, count + 1);
|
|
445
|
-
return count ? `${id}${count}` : id;
|
|
446
|
-
}
|
|
447
|
-
/**
|
|
448
|
-
* Replace IDs in SVG output with unique IDs
|
|
449
|
-
*/
|
|
450
|
-
function replaceIDs(body) {
|
|
451
|
-
const ids = [];
|
|
452
|
-
let match;
|
|
453
|
-
while (match = regex.exec(body)) ids.push(match[1]);
|
|
454
|
-
if (!ids.length) return body;
|
|
455
|
-
const suffix = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16);
|
|
456
|
-
ids.forEach((id) => {
|
|
457
|
-
const newID = nextID(id);
|
|
458
|
-
const escapedID = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
459
|
-
body = body.replace(new RegExp("([#;\"])(" + escapedID + ")([\")]|\\.[a-z])", "g"), "$1" + newID + suffix + "$3");
|
|
460
|
-
});
|
|
461
|
-
body = body.replace(new RegExp(suffix, "g"), "");
|
|
462
|
-
return body;
|
|
463
|
-
}
|
|
464
|
-
//#endregion
|
|
465
144
|
//#region src/canvas/browser/useIgnoredNodes.ts
|
|
466
145
|
/** Temporary display state. It does not change the saved graph or execution. */
|
|
467
146
|
function useIgnoredNodes(identity) {
|
|
@@ -551,603 +230,8 @@ function CanvasHistoryScope({ history, disabled, ...props }) {
|
|
|
551
230
|
});
|
|
552
231
|
}
|
|
553
232
|
//#endregion
|
|
554
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/tabs/root/TabsRootContext.js
|
|
555
|
-
/**
|
|
556
|
-
* @internal
|
|
557
|
-
*/
|
|
558
|
-
var TabsRootContext = /*#__PURE__*/ React.createContext(void 0);
|
|
559
|
-
if (process.env.NODE_ENV !== "production") TabsRootContext.displayName = "TabsRootContext";
|
|
560
|
-
function useTabsRootContext() {
|
|
561
|
-
const context = React.useContext(TabsRootContext);
|
|
562
|
-
if (context === void 0) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: TabsRootContext is missing. Tabs parts must be placed within <Tabs.Root>." : formatErrorMessage(64));
|
|
563
|
-
return context;
|
|
564
|
-
}
|
|
565
|
-
//#endregion
|
|
566
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/tabs/root/TabsRootDataAttributes.js
|
|
567
|
-
var TabsRootDataAttributes = /*#__PURE__*/ function(TabsRootDataAttributes) {
|
|
568
|
-
/**
|
|
569
|
-
* Indicates the direction of the activation (based on the previous active tab).
|
|
570
|
-
* @type {'left' | 'right' | 'up' | 'down' | 'none'}
|
|
571
|
-
*/
|
|
572
|
-
TabsRootDataAttributes["activationDirection"] = "data-activation-direction";
|
|
573
|
-
/**
|
|
574
|
-
* Indicates the orientation of the tabs.
|
|
575
|
-
* @type {'horizontal' | 'vertical'}
|
|
576
|
-
*/
|
|
577
|
-
TabsRootDataAttributes["orientation"] = "data-orientation";
|
|
578
|
-
return TabsRootDataAttributes;
|
|
579
|
-
}({});
|
|
580
|
-
//#endregion
|
|
581
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/tabs/root/stateAttributesMapping.js
|
|
582
|
-
var tabsStateAttributesMapping = { tabActivationDirection: (dir) => ({ [TabsRootDataAttributes.activationDirection]: dir }) };
|
|
583
|
-
//#endregion
|
|
584
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/tabs/root/TabsRoot.js
|
|
585
|
-
/**
|
|
586
|
-
* Groups the tabs and the corresponding panels.
|
|
587
|
-
* Renders a `<div>` element.
|
|
588
|
-
*
|
|
589
|
-
* Documentation: [Base UI Tabs](https://base-ui.com/react/components/tabs)
|
|
590
|
-
*/
|
|
591
|
-
var TabsRoot = /*#__PURE__*/ React.forwardRef(function TabsRoot(componentProps, forwardedRef) {
|
|
592
|
-
const { className, defaultValue: defaultValueProp = 0, onValueChange: onValueChangeProp, orientation = "horizontal", render, value: valueProp, style, ...elementProps } = componentProps;
|
|
593
|
-
const hasExplicitDefaultValueProp = Object.hasOwn(componentProps, "defaultValue");
|
|
594
|
-
const tabPanelRefs = React.useRef([]);
|
|
595
|
-
const [mountedTabPanels, setMountedTabPanels] = React.useState(() => /* @__PURE__ */ new Map());
|
|
596
|
-
const [value, setValue] = useControlled({
|
|
597
|
-
controlled: valueProp,
|
|
598
|
-
default: defaultValueProp,
|
|
599
|
-
name: "Tabs",
|
|
600
|
-
state: "value"
|
|
601
|
-
});
|
|
602
|
-
const isControlled = valueProp !== void 0;
|
|
603
|
-
const [tabMap, setTabMap] = React.useState(() => /* @__PURE__ */ new Map());
|
|
604
|
-
const getTabElementBySelectedValue = React.useCallback((selectedValue) => {
|
|
605
|
-
if (selectedValue === void 0) return null;
|
|
606
|
-
for (const [tabElement, tabMetadata] of tabMap.entries()) if (tabMetadata != null && selectedValue === (tabMetadata.value ?? tabMetadata.index)) return tabElement;
|
|
607
|
-
return null;
|
|
608
|
-
}, [tabMap]);
|
|
609
|
-
const [activationDirectionState, setActivationDirectionState] = React.useState(() => ({
|
|
610
|
-
previousValue: value,
|
|
611
|
-
tabActivationDirection: "none"
|
|
612
|
-
}));
|
|
613
|
-
const { previousValue, tabActivationDirection: committedTabActivationDirection } = activationDirectionState;
|
|
614
|
-
let tabActivationDirection = committedTabActivationDirection;
|
|
615
|
-
let directionComputationIncomplete = false;
|
|
616
|
-
if (previousValue !== value) {
|
|
617
|
-
tabActivationDirection = computeActivationDirection(previousValue, value, orientation, tabMap);
|
|
618
|
-
directionComputationIncomplete = previousValue != null && value != null && getTabElementBySelectedValue(value) == null;
|
|
619
|
-
}
|
|
620
|
-
const nextPreviousValue = directionComputationIncomplete ? previousValue : value;
|
|
621
|
-
const shouldSyncActivationDirectionState = previousValue !== nextPreviousValue || committedTabActivationDirection !== tabActivationDirection;
|
|
622
|
-
useIsoLayoutEffect(() => {
|
|
623
|
-
if (!shouldSyncActivationDirectionState) return;
|
|
624
|
-
setActivationDirectionState({
|
|
625
|
-
previousValue: nextPreviousValue,
|
|
626
|
-
tabActivationDirection
|
|
627
|
-
});
|
|
628
|
-
}, [
|
|
629
|
-
nextPreviousValue,
|
|
630
|
-
shouldSyncActivationDirectionState,
|
|
631
|
-
tabActivationDirection
|
|
632
|
-
]);
|
|
633
|
-
const onValueChange = useStableCallback((newValue, eventDetails) => {
|
|
634
|
-
eventDetails.activationDirection = computeActivationDirection(value, newValue, orientation, tabMap);
|
|
635
|
-
onValueChangeProp?.(newValue, eventDetails);
|
|
636
|
-
if (eventDetails.isCanceled) return;
|
|
637
|
-
setValue(newValue);
|
|
638
|
-
});
|
|
639
|
-
const registerMountedTabPanel = useStableCallback((panelValue, panelId) => {
|
|
640
|
-
setMountedTabPanels((prev) => {
|
|
641
|
-
if (prev.get(panelValue) === panelId) return prev;
|
|
642
|
-
const next = new Map(prev);
|
|
643
|
-
next.set(panelValue, panelId);
|
|
644
|
-
return next;
|
|
645
|
-
});
|
|
646
|
-
});
|
|
647
|
-
const unregisterMountedTabPanel = useStableCallback((panelValue, panelId) => {
|
|
648
|
-
setMountedTabPanels((prev) => {
|
|
649
|
-
if (!prev.has(panelValue) || prev.get(panelValue) !== panelId) return prev;
|
|
650
|
-
const next = new Map(prev);
|
|
651
|
-
next.delete(panelValue);
|
|
652
|
-
return next;
|
|
653
|
-
});
|
|
654
|
-
});
|
|
655
|
-
const getTabPanelIdByValue = React.useCallback((tabValue) => {
|
|
656
|
-
return mountedTabPanels.get(tabValue);
|
|
657
|
-
}, [mountedTabPanels]);
|
|
658
|
-
const getTabIdByPanelValue = React.useCallback((tabPanelValue) => {
|
|
659
|
-
for (const tabMetadata of tabMap.values()) if (tabPanelValue === tabMetadata?.value) return tabMetadata?.id;
|
|
660
|
-
}, [tabMap]);
|
|
661
|
-
const tabsContextValue = React.useMemo(() => ({
|
|
662
|
-
getTabElementBySelectedValue,
|
|
663
|
-
getTabIdByPanelValue,
|
|
664
|
-
getTabPanelIdByValue,
|
|
665
|
-
onValueChange,
|
|
666
|
-
orientation,
|
|
667
|
-
registerMountedTabPanel,
|
|
668
|
-
setTabMap,
|
|
669
|
-
unregisterMountedTabPanel,
|
|
670
|
-
tabActivationDirection,
|
|
671
|
-
value
|
|
672
|
-
}), [
|
|
673
|
-
getTabElementBySelectedValue,
|
|
674
|
-
getTabIdByPanelValue,
|
|
675
|
-
getTabPanelIdByValue,
|
|
676
|
-
onValueChange,
|
|
677
|
-
orientation,
|
|
678
|
-
registerMountedTabPanel,
|
|
679
|
-
setTabMap,
|
|
680
|
-
unregisterMountedTabPanel,
|
|
681
|
-
tabActivationDirection,
|
|
682
|
-
value
|
|
683
|
-
]);
|
|
684
|
-
const selectedTabMetadata = React.useMemo(() => {
|
|
685
|
-
for (const tabMetadata of tabMap.values()) if (tabMetadata != null && tabMetadata.value === value) return tabMetadata;
|
|
686
|
-
}, [tabMap, value]);
|
|
687
|
-
const firstEnabledTabValue = React.useMemo(() => {
|
|
688
|
-
for (const tabMetadata of tabMap.values()) if (tabMetadata != null && !tabMetadata.disabled) return tabMetadata.value;
|
|
689
|
-
}, [tabMap]);
|
|
690
|
-
useIsoLayoutEffect(() => {
|
|
691
|
-
if (isControlled || tabMap.size === 0) return;
|
|
692
|
-
const selectionIsDisabled = selectedTabMetadata?.disabled;
|
|
693
|
-
const selectionIsMissing = selectedTabMetadata == null && value !== null;
|
|
694
|
-
if (hasExplicitDefaultValueProp && selectionIsDisabled && value === defaultValueProp) return;
|
|
695
|
-
if (!selectionIsDisabled && !selectionIsMissing) return;
|
|
696
|
-
const fallbackValue = firstEnabledTabValue ?? null;
|
|
697
|
-
if (value === fallbackValue) return;
|
|
698
|
-
setValue(fallbackValue);
|
|
699
|
-
setActivationDirectionState((prev) => {
|
|
700
|
-
if (prev.tabActivationDirection === "none") return prev;
|
|
701
|
-
return {
|
|
702
|
-
...prev,
|
|
703
|
-
tabActivationDirection: "none"
|
|
704
|
-
};
|
|
705
|
-
});
|
|
706
|
-
}, [
|
|
707
|
-
defaultValueProp,
|
|
708
|
-
firstEnabledTabValue,
|
|
709
|
-
hasExplicitDefaultValueProp,
|
|
710
|
-
isControlled,
|
|
711
|
-
selectedTabMetadata,
|
|
712
|
-
setValue,
|
|
713
|
-
tabMap,
|
|
714
|
-
value
|
|
715
|
-
]);
|
|
716
|
-
const element = useRenderElement("div", componentProps, {
|
|
717
|
-
state: {
|
|
718
|
-
orientation,
|
|
719
|
-
tabActivationDirection
|
|
720
|
-
},
|
|
721
|
-
ref: forwardedRef,
|
|
722
|
-
props: elementProps,
|
|
723
|
-
stateAttributesMapping: tabsStateAttributesMapping
|
|
724
|
-
});
|
|
725
|
-
return /*#__PURE__*/ jsx(TabsRootContext.Provider, {
|
|
726
|
-
value: tabsContextValue,
|
|
727
|
-
children: /*#__PURE__*/ jsx(CompositeList, {
|
|
728
|
-
elementsRef: tabPanelRefs,
|
|
729
|
-
children: element
|
|
730
|
-
})
|
|
731
|
-
});
|
|
732
|
-
});
|
|
733
|
-
if (process.env.NODE_ENV !== "production") TabsRoot.displayName = "TabsRoot";
|
|
734
|
-
function computeActivationDirection(oldValue, newValue, orientation, tabMap) {
|
|
735
|
-
if (oldValue == null || newValue == null) return "none";
|
|
736
|
-
let oldTab = null;
|
|
737
|
-
let newTab = null;
|
|
738
|
-
for (const [tabElement, tabMetadata] of tabMap.entries()) {
|
|
739
|
-
if (tabMetadata == null) continue;
|
|
740
|
-
const tabValue = tabMetadata.value ?? tabMetadata.index;
|
|
741
|
-
if (oldValue === tabValue) oldTab = tabElement;
|
|
742
|
-
if (newValue === tabValue) newTab = tabElement;
|
|
743
|
-
if (oldTab != null && newTab != null) break;
|
|
744
|
-
}
|
|
745
|
-
if (oldTab == null || newTab == null) {
|
|
746
|
-
if (oldTab !== newTab && (typeof oldValue === "number" || typeof oldValue === "string") && typeof oldValue === typeof newValue) {
|
|
747
|
-
if (orientation === "horizontal") return newValue > oldValue ? "right" : "left";
|
|
748
|
-
return newValue > oldValue ? "down" : "up";
|
|
749
|
-
}
|
|
750
|
-
return "none";
|
|
751
|
-
}
|
|
752
|
-
const oldRect = oldTab.getBoundingClientRect();
|
|
753
|
-
const newRect = newTab.getBoundingClientRect();
|
|
754
|
-
if (orientation === "horizontal") {
|
|
755
|
-
if (newRect.left < oldRect.left) return "left";
|
|
756
|
-
if (newRect.left > oldRect.left) return "right";
|
|
757
|
-
} else {
|
|
758
|
-
if (newRect.top < oldRect.top) return "up";
|
|
759
|
-
if (newRect.top > oldRect.top) return "down";
|
|
760
|
-
}
|
|
761
|
-
return "none";
|
|
762
|
-
}
|
|
763
|
-
//#endregion
|
|
764
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/tabs/list/TabsListContext.js
|
|
765
|
-
var TabsListContext = /*#__PURE__*/ React.createContext(void 0);
|
|
766
|
-
if (process.env.NODE_ENV !== "production") TabsListContext.displayName = "TabsListContext";
|
|
767
|
-
function useTabsListContext() {
|
|
768
|
-
const context = React.useContext(TabsListContext);
|
|
769
|
-
if (context === void 0) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: TabsListContext is missing. TabsList parts must be placed within <Tabs.List>." : formatErrorMessage(65));
|
|
770
|
-
return context;
|
|
771
|
-
}
|
|
772
|
-
//#endregion
|
|
773
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/tabs/tab/TabsTab.js
|
|
774
|
-
/**
|
|
775
|
-
* An individual interactive tab button that toggles the corresponding panel.
|
|
776
|
-
* Renders a `<button>` element.
|
|
777
|
-
*
|
|
778
|
-
* Documentation: [Base UI Tabs](https://base-ui.com/react/components/tabs)
|
|
779
|
-
*/
|
|
780
|
-
var TabsTab = /*#__PURE__*/ React.forwardRef(function TabsTab(componentProps, forwardedRef) {
|
|
781
|
-
const { className, disabled = false, render, value, id: idProp, nativeButton = true, style, ...elementProps } = componentProps;
|
|
782
|
-
const { value: activeTabValue, getTabPanelIdByValue, orientation } = useTabsRootContext();
|
|
783
|
-
const { activateOnFocus, highlightedTabIndex, onTabActivation, registerTabResizeObserverElement, setHighlightedTabIndex, tabsListElement } = useTabsListContext();
|
|
784
|
-
const id = useBaseUiId(idProp);
|
|
785
|
-
const tabMetadata = React.useMemo(() => ({
|
|
786
|
-
disabled,
|
|
787
|
-
id,
|
|
788
|
-
value
|
|
789
|
-
}), [
|
|
790
|
-
disabled,
|
|
791
|
-
id,
|
|
792
|
-
value
|
|
793
|
-
]);
|
|
794
|
-
const { compositeProps, compositeRef, index } = useCompositeItem({ metadata: tabMetadata });
|
|
795
|
-
const active = value === activeTabValue;
|
|
796
|
-
const isNavigatingRef = React.useRef(false);
|
|
797
|
-
const tabElementRef = React.useRef(null);
|
|
798
|
-
React.useEffect(() => {
|
|
799
|
-
const tabElement = tabElementRef.current;
|
|
800
|
-
if (!tabElement) return;
|
|
801
|
-
return registerTabResizeObserverElement(tabElement);
|
|
802
|
-
}, [registerTabResizeObserverElement]);
|
|
803
|
-
useIsoLayoutEffect(() => {
|
|
804
|
-
if (isNavigatingRef.current) {
|
|
805
|
-
isNavigatingRef.current = false;
|
|
806
|
-
return;
|
|
807
|
-
}
|
|
808
|
-
if (!(active && index > -1 && highlightedTabIndex !== index)) return;
|
|
809
|
-
const listElement = tabsListElement;
|
|
810
|
-
if (listElement != null) {
|
|
811
|
-
const activeEl = activeElement(ownerDocument(listElement));
|
|
812
|
-
if (activeEl && contains(listElement, activeEl)) return;
|
|
813
|
-
}
|
|
814
|
-
if (!disabled) setHighlightedTabIndex(index);
|
|
815
|
-
}, [
|
|
816
|
-
active,
|
|
817
|
-
index,
|
|
818
|
-
highlightedTabIndex,
|
|
819
|
-
setHighlightedTabIndex,
|
|
820
|
-
disabled,
|
|
821
|
-
tabsListElement
|
|
822
|
-
]);
|
|
823
|
-
const { getButtonProps, buttonRef } = useButton({
|
|
824
|
-
disabled,
|
|
825
|
-
native: nativeButton,
|
|
826
|
-
focusableWhenDisabled: true
|
|
827
|
-
});
|
|
828
|
-
const tabPanelId = getTabPanelIdByValue(value);
|
|
829
|
-
const isPressingRef = React.useRef(false);
|
|
830
|
-
const isMainButtonRef = React.useRef(false);
|
|
831
|
-
function onClick(event) {
|
|
832
|
-
if (active || disabled) return;
|
|
833
|
-
onTabActivation(value, createChangeEventDetails(none, event.nativeEvent, void 0, { activationDirection: "none" }));
|
|
834
|
-
}
|
|
835
|
-
function onFocus(event) {
|
|
836
|
-
if (active) return;
|
|
837
|
-
if (index > -1 && !disabled) setHighlightedTabIndex(index);
|
|
838
|
-
if (disabled) return;
|
|
839
|
-
if (activateOnFocus && (!isPressingRef.current || isPressingRef.current && isMainButtonRef.current)) onTabActivation(value, createChangeEventDetails(none, event.nativeEvent, void 0, { activationDirection: "none" }));
|
|
840
|
-
}
|
|
841
|
-
function onPointerDown(event) {
|
|
842
|
-
if (active || disabled) return;
|
|
843
|
-
isPressingRef.current = true;
|
|
844
|
-
function handlePointerUp() {
|
|
845
|
-
isPressingRef.current = false;
|
|
846
|
-
isMainButtonRef.current = false;
|
|
847
|
-
}
|
|
848
|
-
if (!event.button || event.button === 0) {
|
|
849
|
-
isMainButtonRef.current = true;
|
|
850
|
-
ownerDocument(event.currentTarget).addEventListener("pointerup", handlePointerUp, { once: true });
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
return useRenderElement("button", componentProps, {
|
|
854
|
-
state: {
|
|
855
|
-
disabled,
|
|
856
|
-
active,
|
|
857
|
-
orientation
|
|
858
|
-
},
|
|
859
|
-
ref: [
|
|
860
|
-
forwardedRef,
|
|
861
|
-
buttonRef,
|
|
862
|
-
compositeRef,
|
|
863
|
-
tabElementRef
|
|
864
|
-
],
|
|
865
|
-
props: [
|
|
866
|
-
compositeProps,
|
|
867
|
-
{
|
|
868
|
-
role: "tab",
|
|
869
|
-
"aria-controls": tabPanelId,
|
|
870
|
-
"aria-selected": active,
|
|
871
|
-
id,
|
|
872
|
-
onClick,
|
|
873
|
-
onFocus,
|
|
874
|
-
onPointerDown,
|
|
875
|
-
[ACTIVE_COMPOSITE_ITEM]: active ? "" : void 0,
|
|
876
|
-
onKeyDownCapture() {
|
|
877
|
-
isNavigatingRef.current = true;
|
|
878
|
-
}
|
|
879
|
-
},
|
|
880
|
-
elementProps,
|
|
881
|
-
getButtonProps
|
|
882
|
-
]
|
|
883
|
-
});
|
|
884
|
-
});
|
|
885
|
-
if (process.env.NODE_ENV !== "production") TabsTab.displayName = "TabsTab";
|
|
886
|
-
//#endregion
|
|
887
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/tabs/panel/TabsPanelDataAttributes.js
|
|
888
|
-
var TabsPanelDataAttributes = function(TabsPanelDataAttributes) {
|
|
889
|
-
/**
|
|
890
|
-
* Indicates the index of the tab panel.
|
|
891
|
-
*/
|
|
892
|
-
TabsPanelDataAttributes["index"] = "data-index";
|
|
893
|
-
/**
|
|
894
|
-
* Indicates the direction of the activation (based on the previous active tab).
|
|
895
|
-
* @type {'left' | 'right' | 'up' | 'down' | 'none'}
|
|
896
|
-
*/
|
|
897
|
-
TabsPanelDataAttributes["activationDirection"] = "data-activation-direction";
|
|
898
|
-
/**
|
|
899
|
-
* Indicates the orientation of the tabs.
|
|
900
|
-
* @type {'horizontal' | 'vertical'}
|
|
901
|
-
*/
|
|
902
|
-
TabsPanelDataAttributes["orientation"] = "data-orientation";
|
|
903
|
-
/**
|
|
904
|
-
* Present when the panel is hidden.
|
|
905
|
-
*/
|
|
906
|
-
TabsPanelDataAttributes["hidden"] = "data-hidden";
|
|
907
|
-
/**
|
|
908
|
-
* Present when the panel is animating in.
|
|
909
|
-
*/
|
|
910
|
-
TabsPanelDataAttributes[TabsPanelDataAttributes["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle";
|
|
911
|
-
/**
|
|
912
|
-
* Present when the panel is animating out.
|
|
913
|
-
*/
|
|
914
|
-
TabsPanelDataAttributes[TabsPanelDataAttributes["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle";
|
|
915
|
-
return TabsPanelDataAttributes;
|
|
916
|
-
}({});
|
|
917
|
-
//#endregion
|
|
918
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/tabs/panel/TabsPanel.js
|
|
919
|
-
var stateAttributesMapping$1 = {
|
|
920
|
-
...tabsStateAttributesMapping,
|
|
921
|
-
...transitionStatusMapping
|
|
922
|
-
};
|
|
923
|
-
/**
|
|
924
|
-
* A panel displayed when the corresponding tab is active.
|
|
925
|
-
* Renders a `<div>` element.
|
|
926
|
-
*
|
|
927
|
-
* Documentation: [Base UI Tabs](https://base-ui.com/react/components/tabs)
|
|
928
|
-
*/
|
|
929
|
-
var TabsPanel = /*#__PURE__*/ React.forwardRef(function TabPanel(componentProps, forwardedRef) {
|
|
930
|
-
const { className, value, render, keepMounted = false, style, ...elementProps } = componentProps;
|
|
931
|
-
const { value: selectedValue, getTabIdByPanelValue, orientation, tabActivationDirection, registerMountedTabPanel, unregisterMountedTabPanel } = useTabsRootContext();
|
|
932
|
-
const id = useBaseUiId();
|
|
933
|
-
const metadata = React.useMemo(() => ({
|
|
934
|
-
id,
|
|
935
|
-
value
|
|
936
|
-
}), [id, value]);
|
|
937
|
-
const { ref: listItemRef, index } = useCompositeListItem({ metadata });
|
|
938
|
-
const open = value === selectedValue;
|
|
939
|
-
const { mounted, transitionStatus, setMounted } = useTransitionStatus(open);
|
|
940
|
-
const hidden = !mounted;
|
|
941
|
-
const correspondingTabId = getTabIdByPanelValue(value);
|
|
942
|
-
const state = {
|
|
943
|
-
hidden,
|
|
944
|
-
orientation,
|
|
945
|
-
tabActivationDirection,
|
|
946
|
-
transitionStatus
|
|
947
|
-
};
|
|
948
|
-
const panelRef = React.useRef(null);
|
|
949
|
-
const element = useRenderElement("div", componentProps, {
|
|
950
|
-
state,
|
|
951
|
-
ref: [
|
|
952
|
-
forwardedRef,
|
|
953
|
-
listItemRef,
|
|
954
|
-
panelRef
|
|
955
|
-
],
|
|
956
|
-
props: [{
|
|
957
|
-
"aria-labelledby": correspondingTabId,
|
|
958
|
-
hidden,
|
|
959
|
-
id,
|
|
960
|
-
role: "tabpanel",
|
|
961
|
-
tabIndex: open ? 0 : -1,
|
|
962
|
-
inert: inertValue(!open),
|
|
963
|
-
[TabsPanelDataAttributes.index]: index
|
|
964
|
-
}, elementProps],
|
|
965
|
-
stateAttributesMapping: stateAttributesMapping$1
|
|
966
|
-
});
|
|
967
|
-
useOpenChangeComplete({
|
|
968
|
-
open,
|
|
969
|
-
ref: panelRef,
|
|
970
|
-
onComplete() {
|
|
971
|
-
if (!open) setMounted(false);
|
|
972
|
-
}
|
|
973
|
-
});
|
|
974
|
-
useIsoLayoutEffect(() => {
|
|
975
|
-
if (hidden && !keepMounted) return;
|
|
976
|
-
if (id == null) return;
|
|
977
|
-
registerMountedTabPanel(value, id);
|
|
978
|
-
return () => {
|
|
979
|
-
unregisterMountedTabPanel(value, id);
|
|
980
|
-
};
|
|
981
|
-
}, [
|
|
982
|
-
hidden,
|
|
983
|
-
keepMounted,
|
|
984
|
-
value,
|
|
985
|
-
id,
|
|
986
|
-
registerMountedTabPanel,
|
|
987
|
-
unregisterMountedTabPanel
|
|
988
|
-
]);
|
|
989
|
-
if (!(keepMounted || mounted)) return null;
|
|
990
|
-
return element;
|
|
991
|
-
});
|
|
992
|
-
if (process.env.NODE_ENV !== "production") TabsPanel.displayName = "TabsPanel";
|
|
993
|
-
//#endregion
|
|
994
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/tabs/list/TabsList.js
|
|
995
|
-
/**
|
|
996
|
-
* Groups the individual tab buttons.
|
|
997
|
-
* Renders a `<div>` element.
|
|
998
|
-
*
|
|
999
|
-
* Documentation: [Base UI Tabs](https://base-ui.com/react/components/tabs)
|
|
1000
|
-
*/
|
|
1001
|
-
var TabsList$1 = /*#__PURE__*/ React.forwardRef(function TabsList(componentProps, forwardedRef) {
|
|
1002
|
-
const { activateOnFocus = false, className, loopFocus = true, render, style, ...elementProps } = componentProps;
|
|
1003
|
-
const { onValueChange, orientation, value, setTabMap, tabActivationDirection } = useTabsRootContext();
|
|
1004
|
-
const [highlightedTabIndex, setHighlightedTabIndex] = React.useState(0);
|
|
1005
|
-
const [tabsListElement, setTabsListElement] = React.useState(null);
|
|
1006
|
-
const indicatorUpdateListenersRef = React.useRef(/* @__PURE__ */ new Set());
|
|
1007
|
-
const tabResizeObserverElementsRef = React.useRef(/* @__PURE__ */ new Set());
|
|
1008
|
-
const resizeObserverRef = React.useRef(null);
|
|
1009
|
-
const notifyIndicatorUpdateListeners = useStableCallback(() => {
|
|
1010
|
-
indicatorUpdateListenersRef.current.forEach((listener) => {
|
|
1011
|
-
listener();
|
|
1012
|
-
});
|
|
1013
|
-
});
|
|
1014
|
-
React.useEffect(() => {
|
|
1015
|
-
if (typeof ResizeObserver === "undefined") return;
|
|
1016
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
1017
|
-
if (!indicatorUpdateListenersRef.current.size) return;
|
|
1018
|
-
notifyIndicatorUpdateListeners();
|
|
1019
|
-
});
|
|
1020
|
-
resizeObserverRef.current = resizeObserver;
|
|
1021
|
-
if (tabsListElement) resizeObserver.observe(tabsListElement);
|
|
1022
|
-
tabResizeObserverElementsRef.current.forEach((element) => {
|
|
1023
|
-
resizeObserver.observe(element);
|
|
1024
|
-
});
|
|
1025
|
-
return () => {
|
|
1026
|
-
resizeObserver.disconnect();
|
|
1027
|
-
resizeObserverRef.current = null;
|
|
1028
|
-
};
|
|
1029
|
-
}, [tabsListElement, notifyIndicatorUpdateListeners]);
|
|
1030
|
-
const registerIndicatorUpdateListener = useStableCallback((listener) => {
|
|
1031
|
-
indicatorUpdateListenersRef.current.add(listener);
|
|
1032
|
-
return () => {
|
|
1033
|
-
indicatorUpdateListenersRef.current.delete(listener);
|
|
1034
|
-
};
|
|
1035
|
-
});
|
|
1036
|
-
const registerTabResizeObserverElement = useStableCallback((element) => {
|
|
1037
|
-
tabResizeObserverElementsRef.current.add(element);
|
|
1038
|
-
resizeObserverRef.current?.observe(element);
|
|
1039
|
-
return () => {
|
|
1040
|
-
tabResizeObserverElementsRef.current.delete(element);
|
|
1041
|
-
resizeObserverRef.current?.unobserve(element);
|
|
1042
|
-
};
|
|
1043
|
-
});
|
|
1044
|
-
const onTabActivation = useStableCallback((newValue, eventDetails) => {
|
|
1045
|
-
if (newValue !== value) onValueChange(newValue, eventDetails);
|
|
1046
|
-
});
|
|
1047
|
-
const state = {
|
|
1048
|
-
orientation,
|
|
1049
|
-
tabActivationDirection
|
|
1050
|
-
};
|
|
1051
|
-
const defaultProps = {
|
|
1052
|
-
"aria-orientation": orientation === "vertical" ? "vertical" : void 0,
|
|
1053
|
-
role: "tablist"
|
|
1054
|
-
};
|
|
1055
|
-
const tabsListContextValue = React.useMemo(() => ({
|
|
1056
|
-
activateOnFocus,
|
|
1057
|
-
highlightedTabIndex,
|
|
1058
|
-
registerIndicatorUpdateListener,
|
|
1059
|
-
registerTabResizeObserverElement,
|
|
1060
|
-
onTabActivation,
|
|
1061
|
-
setHighlightedTabIndex,
|
|
1062
|
-
tabsListElement
|
|
1063
|
-
}), [
|
|
1064
|
-
activateOnFocus,
|
|
1065
|
-
highlightedTabIndex,
|
|
1066
|
-
registerIndicatorUpdateListener,
|
|
1067
|
-
registerTabResizeObserverElement,
|
|
1068
|
-
onTabActivation,
|
|
1069
|
-
setHighlightedTabIndex,
|
|
1070
|
-
tabsListElement
|
|
1071
|
-
]);
|
|
1072
|
-
return /*#__PURE__*/ jsx(TabsListContext.Provider, {
|
|
1073
|
-
value: tabsListContextValue,
|
|
1074
|
-
children: /*#__PURE__*/ jsx(CompositeRoot, {
|
|
1075
|
-
render,
|
|
1076
|
-
className,
|
|
1077
|
-
style,
|
|
1078
|
-
state,
|
|
1079
|
-
refs: [forwardedRef, setTabsListElement],
|
|
1080
|
-
props: [defaultProps, elementProps],
|
|
1081
|
-
stateAttributesMapping: tabsStateAttributesMapping,
|
|
1082
|
-
highlightedIndex: highlightedTabIndex,
|
|
1083
|
-
enableHomeAndEndKeys: true,
|
|
1084
|
-
loopFocus,
|
|
1085
|
-
orientation,
|
|
1086
|
-
onHighlightedIndexChange: setHighlightedTabIndex,
|
|
1087
|
-
onMapChange: setTabMap,
|
|
1088
|
-
disabledIndices: EMPTY_ARRAY
|
|
1089
|
-
})
|
|
1090
|
-
});
|
|
1091
|
-
});
|
|
1092
|
-
if (process.env.NODE_ENV !== "production") TabsList$1.displayName = "TabsList";
|
|
1093
|
-
//#endregion
|
|
1094
|
-
//#region src/ui/browser/tabs.tsx
|
|
1095
|
-
function Tabs({ className, orientation = "horizontal", ...props }) {
|
|
1096
|
-
return /* @__PURE__ */ jsx(TabsRoot, {
|
|
1097
|
-
"data-slot": "tabs",
|
|
1098
|
-
"data-orientation": orientation,
|
|
1099
|
-
className: cn("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col", className),
|
|
1100
|
-
orientation,
|
|
1101
|
-
...props
|
|
1102
|
-
});
|
|
1103
|
-
}
|
|
1104
|
-
var tabsListVariants = cva("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg text-muted-foreground group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none", {
|
|
1105
|
-
variants: {
|
|
1106
|
-
size: {
|
|
1107
|
-
default: "p-[3px] group-data-[orientation=horizontal]/tabs:h-8",
|
|
1108
|
-
sm: "rounded-[6px] p-0.5 group-data-[orientation=horizontal]/tabs:h-6"
|
|
1109
|
-
},
|
|
1110
|
-
variant: {
|
|
1111
|
-
default: "bg-muted",
|
|
1112
|
-
line: "gap-1 bg-transparent",
|
|
1113
|
-
navigation: "gap-1 bg-transparent data-[variant=navigation]:p-0 group-data-[orientation=horizontal]/tabs:data-[variant=navigation]:h-auto",
|
|
1114
|
-
flat: "gap-1 bg-[color-mix(in_srgb,var(--ui-foreground)_8%,var(--ui-popover))] dark:bg-[color-mix(in_srgb,black_16%,var(--ui-popover))]"
|
|
1115
|
-
}
|
|
1116
|
-
},
|
|
1117
|
-
defaultVariants: {
|
|
1118
|
-
size: "default",
|
|
1119
|
-
variant: "default"
|
|
1120
|
-
}
|
|
1121
|
-
});
|
|
1122
|
-
function TabsList({ className, variant = "default", size = "default", ...props }) {
|
|
1123
|
-
return /* @__PURE__ */ jsx(TabsList$1, {
|
|
1124
|
-
"data-slot": "tabs-list",
|
|
1125
|
-
"data-variant": variant,
|
|
1126
|
-
"data-size": size,
|
|
1127
|
-
className: cn(tabsListVariants({
|
|
1128
|
-
variant,
|
|
1129
|
-
size
|
|
1130
|
-
}), className),
|
|
1131
|
-
...props
|
|
1132
|
-
});
|
|
1133
|
-
}
|
|
1134
|
-
function TabsTrigger({ className, ...props }) {
|
|
1135
|
-
return /* @__PURE__ */ jsx(TabsTab, {
|
|
1136
|
-
"data-slot": "tabs-trigger",
|
|
1137
|
-
className: cn("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-[color,background-color,border-color,box-shadow,opacity] group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-border focus-visible:outline-2 focus-visible:outline-solid focus-visible:ring-0 focus-visible:aria-invalid:ring-0 focus-visible:outline-offset-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 motion-reduce:transition-none dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent", "group-data-[variant=navigation]/tabs-list:h-auto group-data-[variant=navigation]/tabs-list:flex-none group-data-[variant=navigation]/tabs-list:rounded-[6px] group-data-[variant=navigation]/tabs-list:border-0 group-data-[variant=navigation]/tabs-list:px-3 group-data-[variant=navigation]/tabs-list:py-2 group-data-[variant=navigation]/tabs-list:text-[13px] group-data-[variant=navigation]/tabs-list:font-normal group-data-[variant=navigation]/tabs-list:text-muted-foreground group-data-[variant=navigation]/tabs-list:hover:bg-muted group-data-[variant=navigation]/tabs-list:hover:text-foreground group-data-[variant=navigation]/tabs-list:data-active:bg-muted group-data-[variant=navigation]/tabs-list:data-active:font-semibold group-data-[variant=navigation]/tabs-list:data-active:text-foreground dark:group-data-[variant=navigation]/tabs-list:data-active:bg-muted dark:group-data-[variant=navigation]/tabs-list:data-active:text-foreground", "group-data-[variant=flat]/tabs-list:h-full group-data-[variant=flat]/tabs-list:border-0 group-data-[variant=flat]/tabs-list:data-active:bg-popover group-data-[variant=flat]/tabs-list:data-active:shadow-[0_1px_2px_rgb(0_0_0/0.08)] dark:group-data-[variant=flat]/tabs-list:data-active:bg-[color-mix(in_srgb,var(--ui-foreground)_8%,var(--ui-popover))]", "data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground", "after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100 motion-reduce:after:transition-none", "group-data-[size=sm]/tabs-list:rounded-[4px] group-data-[size=sm]/tabs-list:gap-1 group-data-[size=sm]/tabs-list:py-0 group-data-[size=sm]/tabs-list:text-[11px] group-data-[size=sm]/tabs-list:leading-4 group-data-[orientation=horizontal]/tabs:group-data-[size=sm]/tabs-list:after:bottom-[-4px]", "group-data-[variant=navigation]/tabs-list:group-data-[size=sm]/tabs-list:rounded-[4px] group-data-[variant=navigation]/tabs-list:group-data-[size=sm]/tabs-list:px-2 group-data-[variant=navigation]/tabs-list:group-data-[size=sm]/tabs-list:py-1 group-data-[variant=navigation]/tabs-list:group-data-[size=sm]/tabs-list:text-[12px]", className),
|
|
1138
|
-
...props
|
|
1139
|
-
});
|
|
1140
|
-
}
|
|
1141
|
-
function TabsContent({ className, ...props }) {
|
|
1142
|
-
return /* @__PURE__ */ jsx(TabsPanel, {
|
|
1143
|
-
"data-slot": "tabs-content",
|
|
1144
|
-
className: cn("flex-1 text-sm outline-none", className),
|
|
1145
|
-
...props
|
|
1146
|
-
});
|
|
1147
|
-
}
|
|
1148
|
-
//#endregion
|
|
1149
233
|
//#region src/workbench/browser/runtime/editor/commentInspector.tsx
|
|
1150
|
-
var MarkdownContent = lazy(() => import("./markdownContent-
|
|
234
|
+
var MarkdownContent = lazy(() => import("./markdownContent-IS8xXDoc.js"));
|
|
1151
235
|
/** A comment is presentation data; editing it does not require the canvas store. */
|
|
1152
236
|
function CommentInspector({ title, content, disabled = false, readOnly, dark, onSave }) {
|
|
1153
237
|
const t = useTranslate();
|
|
@@ -1189,14 +273,16 @@ function CommentInspector({ title, content, disabled = false, readOnly, dark, on
|
|
|
1189
273
|
readOnly,
|
|
1190
274
|
value: draftContent,
|
|
1191
275
|
onChange: (event) => setDraftContent(event.target.value),
|
|
276
|
+
onPaste: (event) => pasteVideoLink(event, t),
|
|
1192
277
|
onBlur: save
|
|
1193
278
|
})
|
|
1194
279
|
}),
|
|
1195
280
|
/* @__PURE__ */ jsx(TabsContent, {
|
|
1196
281
|
value: "preview",
|
|
1197
282
|
className: "flex min-h-0 flex-1 flex-col rounded-[var(--ui-control-radius,calc(var(--ui-radius)_+_2px))] border border-[var(--_open-flow-comment-border)] bg-[var(--_open-flow-comment-surface)] p-2",
|
|
1198
|
-
children: /* @__PURE__ */ jsx(
|
|
1199
|
-
|
|
283
|
+
children: /* @__PURE__ */ jsx(ScrollArea, {
|
|
284
|
+
autoHide: "leave",
|
|
285
|
+
className: "min-h-0 flex-1 rounded-[var(--ui-control-radius,calc(var(--ui-radius)_+_2px))] border border-[color-mix(in_srgb,var(--_open-flow-comment-border)_45%,transparent)] bg-[var(--_open-flow-comment-content)] p-3",
|
|
1200
286
|
children: /* @__PURE__ */ jsx("div", {
|
|
1201
287
|
className: "markdown-body min-w-0",
|
|
1202
288
|
onDoubleClick: () => setSource(true),
|
|
@@ -4041,1249 +3127,6 @@ function ContextPanel({ className, layoutRoot, children, focusOnOpen, actions, h
|
|
|
4041
3127
|
]
|
|
4042
3128
|
})] });
|
|
4043
3129
|
}
|
|
4044
|
-
var IconPicker_module_default = {
|
|
4045
|
-
container: "IconPicker_container_1b462",
|
|
4046
|
-
filter: "IconPicker_filter_1b462",
|
|
4047
|
-
tabs: "IconPicker_tabs_1b462",
|
|
4048
|
-
colors: "IconPicker_colors_1b462",
|
|
4049
|
-
color: "IconPicker_color_1b462",
|
|
4050
|
-
panel: "IconPicker_panel_1b462",
|
|
4051
|
-
row: "IconPicker_row_1b462",
|
|
4052
|
-
icon: "IconPicker_icon_1b462",
|
|
4053
|
-
subtitle: "IconPicker_subtitle_1b462",
|
|
4054
|
-
loading: "IconPicker_loading_1b462",
|
|
4055
|
-
spin: "IconPicker_spin_1b462"
|
|
4056
|
-
};
|
|
4057
|
-
//#endregion
|
|
4058
|
-
//#region ../../node_modules/.bun/fzf@0.5.2/node_modules/fzf/dist/fzf.es.js
|
|
4059
|
-
/** @license
|
|
4060
|
-
* fzf v0.5.2
|
|
4061
|
-
* Copyright (c) 2021 Ajit
|
|
4062
|
-
* Licensed under BSD 3-Clause
|
|
4063
|
-
*/
|
|
4064
|
-
var normalized = {
|
|
4065
|
-
216: "O",
|
|
4066
|
-
223: "s",
|
|
4067
|
-
248: "o",
|
|
4068
|
-
273: "d",
|
|
4069
|
-
295: "h",
|
|
4070
|
-
305: "i",
|
|
4071
|
-
320: "l",
|
|
4072
|
-
322: "l",
|
|
4073
|
-
359: "t",
|
|
4074
|
-
383: "s",
|
|
4075
|
-
384: "b",
|
|
4076
|
-
385: "B",
|
|
4077
|
-
387: "b",
|
|
4078
|
-
390: "O",
|
|
4079
|
-
392: "c",
|
|
4080
|
-
393: "D",
|
|
4081
|
-
394: "D",
|
|
4082
|
-
396: "d",
|
|
4083
|
-
398: "E",
|
|
4084
|
-
400: "E",
|
|
4085
|
-
402: "f",
|
|
4086
|
-
403: "G",
|
|
4087
|
-
407: "I",
|
|
4088
|
-
409: "k",
|
|
4089
|
-
410: "l",
|
|
4090
|
-
412: "M",
|
|
4091
|
-
413: "N",
|
|
4092
|
-
414: "n",
|
|
4093
|
-
415: "O",
|
|
4094
|
-
421: "p",
|
|
4095
|
-
427: "t",
|
|
4096
|
-
429: "t",
|
|
4097
|
-
430: "T",
|
|
4098
|
-
434: "V",
|
|
4099
|
-
436: "y",
|
|
4100
|
-
438: "z",
|
|
4101
|
-
477: "e",
|
|
4102
|
-
485: "g",
|
|
4103
|
-
544: "N",
|
|
4104
|
-
545: "d",
|
|
4105
|
-
549: "z",
|
|
4106
|
-
564: "l",
|
|
4107
|
-
565: "n",
|
|
4108
|
-
566: "t",
|
|
4109
|
-
567: "j",
|
|
4110
|
-
570: "A",
|
|
4111
|
-
571: "C",
|
|
4112
|
-
572: "c",
|
|
4113
|
-
573: "L",
|
|
4114
|
-
574: "T",
|
|
4115
|
-
575: "s",
|
|
4116
|
-
576: "z",
|
|
4117
|
-
579: "B",
|
|
4118
|
-
580: "U",
|
|
4119
|
-
581: "V",
|
|
4120
|
-
582: "E",
|
|
4121
|
-
583: "e",
|
|
4122
|
-
584: "J",
|
|
4123
|
-
585: "j",
|
|
4124
|
-
586: "Q",
|
|
4125
|
-
587: "q",
|
|
4126
|
-
588: "R",
|
|
4127
|
-
589: "r",
|
|
4128
|
-
590: "Y",
|
|
4129
|
-
591: "y",
|
|
4130
|
-
592: "a",
|
|
4131
|
-
593: "a",
|
|
4132
|
-
595: "b",
|
|
4133
|
-
596: "o",
|
|
4134
|
-
597: "c",
|
|
4135
|
-
598: "d",
|
|
4136
|
-
599: "d",
|
|
4137
|
-
600: "e",
|
|
4138
|
-
603: "e",
|
|
4139
|
-
604: "e",
|
|
4140
|
-
605: "e",
|
|
4141
|
-
606: "e",
|
|
4142
|
-
607: "j",
|
|
4143
|
-
608: "g",
|
|
4144
|
-
609: "g",
|
|
4145
|
-
610: "G",
|
|
4146
|
-
613: "h",
|
|
4147
|
-
614: "h",
|
|
4148
|
-
616: "i",
|
|
4149
|
-
618: "I",
|
|
4150
|
-
619: "l",
|
|
4151
|
-
620: "l",
|
|
4152
|
-
621: "l",
|
|
4153
|
-
623: "m",
|
|
4154
|
-
624: "m",
|
|
4155
|
-
625: "m",
|
|
4156
|
-
626: "n",
|
|
4157
|
-
627: "n",
|
|
4158
|
-
628: "N",
|
|
4159
|
-
629: "o",
|
|
4160
|
-
633: "r",
|
|
4161
|
-
634: "r",
|
|
4162
|
-
635: "r",
|
|
4163
|
-
636: "r",
|
|
4164
|
-
637: "r",
|
|
4165
|
-
638: "r",
|
|
4166
|
-
639: "r",
|
|
4167
|
-
640: "R",
|
|
4168
|
-
641: "R",
|
|
4169
|
-
642: "s",
|
|
4170
|
-
647: "t",
|
|
4171
|
-
648: "t",
|
|
4172
|
-
649: "u",
|
|
4173
|
-
651: "v",
|
|
4174
|
-
652: "v",
|
|
4175
|
-
653: "w",
|
|
4176
|
-
654: "y",
|
|
4177
|
-
655: "Y",
|
|
4178
|
-
656: "z",
|
|
4179
|
-
657: "z",
|
|
4180
|
-
663: "c",
|
|
4181
|
-
665: "B",
|
|
4182
|
-
666: "e",
|
|
4183
|
-
667: "G",
|
|
4184
|
-
668: "H",
|
|
4185
|
-
669: "j",
|
|
4186
|
-
670: "k",
|
|
4187
|
-
671: "L",
|
|
4188
|
-
672: "q",
|
|
4189
|
-
686: "h",
|
|
4190
|
-
867: "a",
|
|
4191
|
-
868: "e",
|
|
4192
|
-
869: "i",
|
|
4193
|
-
870: "o",
|
|
4194
|
-
871: "u",
|
|
4195
|
-
872: "c",
|
|
4196
|
-
873: "d",
|
|
4197
|
-
874: "h",
|
|
4198
|
-
875: "m",
|
|
4199
|
-
876: "r",
|
|
4200
|
-
877: "t",
|
|
4201
|
-
878: "v",
|
|
4202
|
-
879: "x",
|
|
4203
|
-
7424: "A",
|
|
4204
|
-
7427: "B",
|
|
4205
|
-
7428: "C",
|
|
4206
|
-
7429: "D",
|
|
4207
|
-
7431: "E",
|
|
4208
|
-
7432: "e",
|
|
4209
|
-
7433: "i",
|
|
4210
|
-
7434: "J",
|
|
4211
|
-
7435: "K",
|
|
4212
|
-
7436: "L",
|
|
4213
|
-
7437: "M",
|
|
4214
|
-
7438: "N",
|
|
4215
|
-
7439: "O",
|
|
4216
|
-
7440: "O",
|
|
4217
|
-
7441: "o",
|
|
4218
|
-
7442: "o",
|
|
4219
|
-
7443: "o",
|
|
4220
|
-
7446: "o",
|
|
4221
|
-
7447: "o",
|
|
4222
|
-
7448: "P",
|
|
4223
|
-
7449: "R",
|
|
4224
|
-
7450: "R",
|
|
4225
|
-
7451: "T",
|
|
4226
|
-
7452: "U",
|
|
4227
|
-
7453: "u",
|
|
4228
|
-
7454: "u",
|
|
4229
|
-
7455: "m",
|
|
4230
|
-
7456: "V",
|
|
4231
|
-
7457: "W",
|
|
4232
|
-
7458: "Z",
|
|
4233
|
-
7522: "i",
|
|
4234
|
-
7523: "r",
|
|
4235
|
-
7524: "u",
|
|
4236
|
-
7525: "v",
|
|
4237
|
-
7834: "a",
|
|
4238
|
-
7835: "s",
|
|
4239
|
-
8305: "i",
|
|
4240
|
-
8341: "h",
|
|
4241
|
-
8342: "k",
|
|
4242
|
-
8343: "l",
|
|
4243
|
-
8344: "m",
|
|
4244
|
-
8345: "n",
|
|
4245
|
-
8346: "p",
|
|
4246
|
-
8347: "s",
|
|
4247
|
-
8348: "t",
|
|
4248
|
-
8580: "c"
|
|
4249
|
-
};
|
|
4250
|
-
for (let i = "̀".codePointAt(0); i <= "ͯ".codePointAt(0); ++i) {
|
|
4251
|
-
const diacritic = String.fromCodePoint(i);
|
|
4252
|
-
for (const asciiChar of "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") {
|
|
4253
|
-
const withDiacriticCodePoint = (asciiChar + diacritic).normalize().codePointAt(0);
|
|
4254
|
-
if (withDiacriticCodePoint > 126) normalized[withDiacriticCodePoint] = asciiChar;
|
|
4255
|
-
}
|
|
4256
|
-
}
|
|
4257
|
-
var ranges = {
|
|
4258
|
-
a: [7844, 7863],
|
|
4259
|
-
e: [7870, 7879],
|
|
4260
|
-
o: [7888, 7907],
|
|
4261
|
-
u: [7912, 7921]
|
|
4262
|
-
};
|
|
4263
|
-
for (const lowerChar of Object.keys(ranges)) {
|
|
4264
|
-
const upperChar = lowerChar.toUpperCase();
|
|
4265
|
-
for (let i = ranges[lowerChar][0]; i <= ranges[lowerChar][1]; ++i) normalized[i] = i % 2 === 0 ? upperChar : lowerChar;
|
|
4266
|
-
}
|
|
4267
|
-
function normalizeRune(rune) {
|
|
4268
|
-
if (rune < 192 || rune > 8580) return rune;
|
|
4269
|
-
const normalizedChar = normalized[rune];
|
|
4270
|
-
if (normalizedChar !== void 0) return normalizedChar.codePointAt(0);
|
|
4271
|
-
return rune;
|
|
4272
|
-
}
|
|
4273
|
-
function toShort(number) {
|
|
4274
|
-
return number;
|
|
4275
|
-
}
|
|
4276
|
-
function toInt(number) {
|
|
4277
|
-
return number;
|
|
4278
|
-
}
|
|
4279
|
-
function maxInt16(num1, num2) {
|
|
4280
|
-
return num1 > num2 ? num1 : num2;
|
|
4281
|
-
}
|
|
4282
|
-
var strToRunes = (str) => str.split("").map((s) => s.codePointAt(0));
|
|
4283
|
-
var whitespaceRunes = new Set(" \f\n\r \v\xA0 \u2028\u2029 ".split("").map((v) => v.codePointAt(0)));
|
|
4284
|
-
for (let codePoint = " ".codePointAt(0); codePoint <= " ".codePointAt(0); codePoint++) whitespaceRunes.add(codePoint);
|
|
4285
|
-
var MAX_ASCII = "".codePointAt(0);
|
|
4286
|
-
var CAPITAL_A_RUNE = "A".codePointAt(0);
|
|
4287
|
-
var CAPITAL_Z_RUNE = "Z".codePointAt(0);
|
|
4288
|
-
var SMALL_A_RUNE = "a".codePointAt(0);
|
|
4289
|
-
var SMALL_Z_RUNE = "z".codePointAt(0);
|
|
4290
|
-
var NUMERAL_ZERO_RUNE = "0".codePointAt(0);
|
|
4291
|
-
var NUMERAL_NINE_RUNE = "9".codePointAt(0);
|
|
4292
|
-
function indexAt(index, max, forward) {
|
|
4293
|
-
if (forward) return index;
|
|
4294
|
-
return max - index - 1;
|
|
4295
|
-
}
|
|
4296
|
-
var SCORE_MATCH = 16;
|
|
4297
|
-
var SCORE_GAP_START = -3;
|
|
4298
|
-
var SCORE_GAP_EXTENTION = -1;
|
|
4299
|
-
var BONUS_BOUNDARY = SCORE_MATCH / 2;
|
|
4300
|
-
var BONUS_NON_WORD = SCORE_MATCH / 2;
|
|
4301
|
-
var BONUS_CAMEL_123 = 7;
|
|
4302
|
-
var BONUS_CONSECUTIVE = 4;
|
|
4303
|
-
var BONUS_FIRST_CHAR_MULTIPLIER = 2;
|
|
4304
|
-
function createPosSet(withPos) {
|
|
4305
|
-
if (withPos) return /* @__PURE__ */ new Set();
|
|
4306
|
-
return null;
|
|
4307
|
-
}
|
|
4308
|
-
function alloc16(offset, slab2, size) {
|
|
4309
|
-
if (slab2 !== null && slab2.i16.length > offset + size) {
|
|
4310
|
-
const subarray = slab2.i16.subarray(offset, offset + size);
|
|
4311
|
-
return [offset + size, subarray];
|
|
4312
|
-
}
|
|
4313
|
-
return [offset, new Int16Array(size)];
|
|
4314
|
-
}
|
|
4315
|
-
function alloc32(offset, slab2, size) {
|
|
4316
|
-
if (slab2 !== null && slab2.i32.length > offset + size) {
|
|
4317
|
-
const subarray = slab2.i32.subarray(offset, offset + size);
|
|
4318
|
-
return [offset + size, subarray];
|
|
4319
|
-
}
|
|
4320
|
-
return [offset, new Int32Array(size)];
|
|
4321
|
-
}
|
|
4322
|
-
function charClassOfAscii(rune) {
|
|
4323
|
-
if (rune >= SMALL_A_RUNE && rune <= SMALL_Z_RUNE) return 1;
|
|
4324
|
-
else if (rune >= CAPITAL_A_RUNE && rune <= CAPITAL_Z_RUNE) return 2;
|
|
4325
|
-
else if (rune >= NUMERAL_ZERO_RUNE && rune <= NUMERAL_NINE_RUNE) return 4;
|
|
4326
|
-
else return 0;
|
|
4327
|
-
}
|
|
4328
|
-
function charClassOfNonAscii(rune) {
|
|
4329
|
-
const char = String.fromCodePoint(rune);
|
|
4330
|
-
if (char !== char.toUpperCase()) return 1;
|
|
4331
|
-
else if (char !== char.toLowerCase()) return 2;
|
|
4332
|
-
else if (char.match(/\p{Number}/gu) !== null) return 4;
|
|
4333
|
-
else if (char.match(/\p{Letter}/gu) !== null) return 3;
|
|
4334
|
-
return 0;
|
|
4335
|
-
}
|
|
4336
|
-
function charClassOf(rune) {
|
|
4337
|
-
if (rune <= MAX_ASCII) return charClassOfAscii(rune);
|
|
4338
|
-
return charClassOfNonAscii(rune);
|
|
4339
|
-
}
|
|
4340
|
-
function bonusFor(prevClass, currClass) {
|
|
4341
|
-
if (prevClass === 0 && currClass !== 0) return BONUS_BOUNDARY;
|
|
4342
|
-
else if (prevClass === 1 && currClass === 2 || prevClass !== 4 && currClass === 4) return BONUS_CAMEL_123;
|
|
4343
|
-
else if (currClass === 0) return BONUS_NON_WORD;
|
|
4344
|
-
return 0;
|
|
4345
|
-
}
|
|
4346
|
-
function bonusAt(input, idx) {
|
|
4347
|
-
if (idx === 0) return BONUS_BOUNDARY;
|
|
4348
|
-
return bonusFor(charClassOf(input[idx - 1]), charClassOf(input[idx]));
|
|
4349
|
-
}
|
|
4350
|
-
function trySkip(input, caseSensitive, char, from) {
|
|
4351
|
-
let rest = input.slice(from);
|
|
4352
|
-
let idx = rest.indexOf(char);
|
|
4353
|
-
if (idx === 0) return from;
|
|
4354
|
-
if (!caseSensitive && char >= SMALL_A_RUNE && char <= SMALL_Z_RUNE) {
|
|
4355
|
-
if (idx > 0) rest = rest.slice(0, idx);
|
|
4356
|
-
const uidx = rest.indexOf(char - 32);
|
|
4357
|
-
if (uidx >= 0) idx = uidx;
|
|
4358
|
-
}
|
|
4359
|
-
if (idx < 0) return -1;
|
|
4360
|
-
return from + idx;
|
|
4361
|
-
}
|
|
4362
|
-
function isAscii(runes) {
|
|
4363
|
-
for (const rune of runes) if (rune >= 128) return false;
|
|
4364
|
-
return true;
|
|
4365
|
-
}
|
|
4366
|
-
function asciiFuzzyIndex(input, pattern, caseSensitive) {
|
|
4367
|
-
if (!isAscii(input)) return 0;
|
|
4368
|
-
if (!isAscii(pattern)) return -1;
|
|
4369
|
-
let firstIdx = 0, idx = 0;
|
|
4370
|
-
for (let pidx = 0; pidx < pattern.length; pidx++) {
|
|
4371
|
-
idx = trySkip(input, caseSensitive, pattern[pidx], idx);
|
|
4372
|
-
if (idx < 0) return -1;
|
|
4373
|
-
if (pidx === 0 && idx > 0) firstIdx = idx - 1;
|
|
4374
|
-
idx++;
|
|
4375
|
-
}
|
|
4376
|
-
return firstIdx;
|
|
4377
|
-
}
|
|
4378
|
-
var fuzzyMatchV2 = (caseSensitive, normalize, forward, input, pattern, withPos, slab2) => {
|
|
4379
|
-
const M = pattern.length;
|
|
4380
|
-
if (M === 0) return [{
|
|
4381
|
-
start: 0,
|
|
4382
|
-
end: 0,
|
|
4383
|
-
score: 0
|
|
4384
|
-
}, createPosSet(withPos)];
|
|
4385
|
-
const N = input.length;
|
|
4386
|
-
if (slab2 !== null && N * M > slab2.i16.length) return fuzzyMatchV1(caseSensitive, normalize, forward, input, pattern, withPos);
|
|
4387
|
-
const idx = asciiFuzzyIndex(input, pattern, caseSensitive);
|
|
4388
|
-
if (idx < 0) return [{
|
|
4389
|
-
start: -1,
|
|
4390
|
-
end: -1,
|
|
4391
|
-
score: 0
|
|
4392
|
-
}, null];
|
|
4393
|
-
let offset16 = 0, offset32 = 0, H0 = null, C0 = null, B = null, F = null;
|
|
4394
|
-
[offset16, H0] = alloc16(offset16, slab2, N);
|
|
4395
|
-
[offset16, C0] = alloc16(offset16, slab2, N);
|
|
4396
|
-
[offset16, B] = alloc16(offset16, slab2, N);
|
|
4397
|
-
[offset32, F] = alloc32(offset32, slab2, M);
|
|
4398
|
-
const [, T] = alloc32(offset32, slab2, N);
|
|
4399
|
-
for (let i = 0; i < T.length; i++) T[i] = input[i];
|
|
4400
|
-
let maxScore = toShort(0), maxScorePos = 0;
|
|
4401
|
-
let pidx = 0, lastIdx = 0;
|
|
4402
|
-
const pchar0 = pattern[0];
|
|
4403
|
-
let pchar = pattern[0], prevH0 = toShort(0), prevCharClass = 0, inGap = false;
|
|
4404
|
-
let Tsub = T.subarray(idx);
|
|
4405
|
-
let H0sub = H0.subarray(idx).subarray(0, Tsub.length), C0sub = C0.subarray(idx).subarray(0, Tsub.length), Bsub = B.subarray(idx).subarray(0, Tsub.length);
|
|
4406
|
-
for (let [off, char] of Tsub.entries()) {
|
|
4407
|
-
let charClass = null;
|
|
4408
|
-
if (char <= MAX_ASCII) {
|
|
4409
|
-
charClass = charClassOfAscii(char);
|
|
4410
|
-
if (!caseSensitive && charClass === 2) char += 32;
|
|
4411
|
-
} else {
|
|
4412
|
-
charClass = charClassOfNonAscii(char);
|
|
4413
|
-
if (!caseSensitive && charClass === 2) char = String.fromCodePoint(char).toLowerCase().codePointAt(0);
|
|
4414
|
-
if (normalize) char = normalizeRune(char);
|
|
4415
|
-
}
|
|
4416
|
-
Tsub[off] = char;
|
|
4417
|
-
const bonus = bonusFor(prevCharClass, charClass);
|
|
4418
|
-
Bsub[off] = bonus;
|
|
4419
|
-
prevCharClass = charClass;
|
|
4420
|
-
if (char === pchar) {
|
|
4421
|
-
if (pidx < M) {
|
|
4422
|
-
F[pidx] = toInt(idx + off);
|
|
4423
|
-
pidx++;
|
|
4424
|
-
pchar = pattern[Math.min(pidx, M - 1)];
|
|
4425
|
-
}
|
|
4426
|
-
lastIdx = idx + off;
|
|
4427
|
-
}
|
|
4428
|
-
if (char === pchar0) {
|
|
4429
|
-
const score = SCORE_MATCH + bonus * BONUS_FIRST_CHAR_MULTIPLIER;
|
|
4430
|
-
H0sub[off] = score;
|
|
4431
|
-
C0sub[off] = 1;
|
|
4432
|
-
if (M === 1 && (forward && score > maxScore || !forward && score >= maxScore)) {
|
|
4433
|
-
maxScore = score;
|
|
4434
|
-
maxScorePos = idx + off;
|
|
4435
|
-
if (forward && bonus === BONUS_BOUNDARY) break;
|
|
4436
|
-
}
|
|
4437
|
-
inGap = false;
|
|
4438
|
-
} else {
|
|
4439
|
-
if (inGap) H0sub[off] = maxInt16(prevH0 + SCORE_GAP_EXTENTION, 0);
|
|
4440
|
-
else H0sub[off] = maxInt16(prevH0 + SCORE_GAP_START, 0);
|
|
4441
|
-
C0sub[off] = 0;
|
|
4442
|
-
inGap = true;
|
|
4443
|
-
}
|
|
4444
|
-
prevH0 = H0sub[off];
|
|
4445
|
-
}
|
|
4446
|
-
if (pidx !== M) return [{
|
|
4447
|
-
start: -1,
|
|
4448
|
-
end: -1,
|
|
4449
|
-
score: 0
|
|
4450
|
-
}, null];
|
|
4451
|
-
if (M === 1) {
|
|
4452
|
-
const result = {
|
|
4453
|
-
start: maxScorePos,
|
|
4454
|
-
end: maxScorePos + 1,
|
|
4455
|
-
score: maxScore
|
|
4456
|
-
};
|
|
4457
|
-
if (!withPos) return [result, null];
|
|
4458
|
-
const pos2 = /* @__PURE__ */ new Set();
|
|
4459
|
-
pos2.add(maxScorePos);
|
|
4460
|
-
return [result, pos2];
|
|
4461
|
-
}
|
|
4462
|
-
const f0 = F[0];
|
|
4463
|
-
const width = lastIdx - f0 + 1;
|
|
4464
|
-
let H = null;
|
|
4465
|
-
[offset16, H] = alloc16(offset16, slab2, width * M);
|
|
4466
|
-
{
|
|
4467
|
-
const toCopy = H0.subarray(f0, lastIdx + 1);
|
|
4468
|
-
for (const [i, v] of toCopy.entries()) H[i] = v;
|
|
4469
|
-
}
|
|
4470
|
-
let [, C] = alloc16(offset16, slab2, width * M);
|
|
4471
|
-
{
|
|
4472
|
-
const toCopy = C0.subarray(f0, lastIdx + 1);
|
|
4473
|
-
for (const [i, v] of toCopy.entries()) C[i] = v;
|
|
4474
|
-
}
|
|
4475
|
-
const Fsub = F.subarray(1);
|
|
4476
|
-
const Psub = pattern.slice(1).slice(0, Fsub.length);
|
|
4477
|
-
for (const [off, f] of Fsub.entries()) {
|
|
4478
|
-
let inGap2 = false;
|
|
4479
|
-
const pchar2 = Psub[off], pidx2 = off + 1, row = pidx2 * width, Tsub2 = T.subarray(f, lastIdx + 1), Bsub2 = B.subarray(f).subarray(0, Tsub2.length), Csub = C.subarray(row + f - f0).subarray(0, Tsub2.length), Cdiag = C.subarray(row + f - f0 - 1 - width).subarray(0, Tsub2.length), Hsub = H.subarray(row + f - f0).subarray(0, Tsub2.length), Hdiag = H.subarray(row + f - f0 - 1 - width).subarray(0, Tsub2.length), Hleft = H.subarray(row + f - f0 - 1).subarray(0, Tsub2.length);
|
|
4480
|
-
Hleft[0] = 0;
|
|
4481
|
-
for (const [off2, char] of Tsub2.entries()) {
|
|
4482
|
-
const col = off2 + f;
|
|
4483
|
-
let s1 = 0, s2 = 0, consecutive = 0;
|
|
4484
|
-
if (inGap2) s2 = Hleft[off2] + SCORE_GAP_EXTENTION;
|
|
4485
|
-
else s2 = Hleft[off2] + SCORE_GAP_START;
|
|
4486
|
-
if (pchar2 === char) {
|
|
4487
|
-
s1 = Hdiag[off2] + SCORE_MATCH;
|
|
4488
|
-
let b = Bsub2[off2];
|
|
4489
|
-
consecutive = Cdiag[off2] + 1;
|
|
4490
|
-
if (b === BONUS_BOUNDARY) consecutive = 1;
|
|
4491
|
-
else if (consecutive > 1) b = maxInt16(b, maxInt16(BONUS_CONSECUTIVE, B[col - consecutive + 1]));
|
|
4492
|
-
if (s1 + b < s2) {
|
|
4493
|
-
s1 += Bsub2[off2];
|
|
4494
|
-
consecutive = 0;
|
|
4495
|
-
} else s1 += b;
|
|
4496
|
-
}
|
|
4497
|
-
Csub[off2] = consecutive;
|
|
4498
|
-
inGap2 = s1 < s2;
|
|
4499
|
-
const score = maxInt16(maxInt16(s1, s2), 0);
|
|
4500
|
-
if (pidx2 === M - 1 && (forward && score > maxScore || !forward && score >= maxScore)) {
|
|
4501
|
-
maxScore = score;
|
|
4502
|
-
maxScorePos = col;
|
|
4503
|
-
}
|
|
4504
|
-
Hsub[off2] = score;
|
|
4505
|
-
}
|
|
4506
|
-
}
|
|
4507
|
-
const pos = createPosSet(withPos);
|
|
4508
|
-
let j = f0;
|
|
4509
|
-
if (withPos && pos !== null) {
|
|
4510
|
-
let i = M - 1;
|
|
4511
|
-
j = maxScorePos;
|
|
4512
|
-
let preferMatch = true;
|
|
4513
|
-
while (true) {
|
|
4514
|
-
const I = i * width, j0 = j - f0, s = H[I + j0];
|
|
4515
|
-
let s1 = 0, s2 = 0;
|
|
4516
|
-
if (i > 0 && j >= F[i]) s1 = H[I - width + j0 - 1];
|
|
4517
|
-
if (j > F[i]) s2 = H[I + j0 - 1];
|
|
4518
|
-
if (s > s1 && (s > s2 || s === s2 && preferMatch)) {
|
|
4519
|
-
pos.add(j);
|
|
4520
|
-
if (i === 0) break;
|
|
4521
|
-
i--;
|
|
4522
|
-
}
|
|
4523
|
-
preferMatch = C[I + j0] > 1 || I + width + j0 + 1 < C.length && C[I + width + j0 + 1] > 0;
|
|
4524
|
-
j--;
|
|
4525
|
-
}
|
|
4526
|
-
}
|
|
4527
|
-
return [{
|
|
4528
|
-
start: j,
|
|
4529
|
-
end: maxScorePos + 1,
|
|
4530
|
-
score: maxScore
|
|
4531
|
-
}, pos];
|
|
4532
|
-
};
|
|
4533
|
-
function calculateScore(caseSensitive, normalize, text, pattern, sidx, eidx, withPos) {
|
|
4534
|
-
let pidx = 0, score = 0, inGap = false, consecutive = 0, firstBonus = toShort(0);
|
|
4535
|
-
const pos = createPosSet(withPos);
|
|
4536
|
-
let prevCharClass = 0;
|
|
4537
|
-
if (sidx > 0) prevCharClass = charClassOf(text[sidx - 1]);
|
|
4538
|
-
for (let idx = sidx; idx < eidx; idx++) {
|
|
4539
|
-
let rune = text[idx];
|
|
4540
|
-
const charClass = charClassOf(rune);
|
|
4541
|
-
if (!caseSensitive) {
|
|
4542
|
-
if (rune >= CAPITAL_A_RUNE && rune <= CAPITAL_Z_RUNE) rune += 32;
|
|
4543
|
-
else if (rune > MAX_ASCII) rune = String.fromCodePoint(rune).toLowerCase().codePointAt(0);
|
|
4544
|
-
}
|
|
4545
|
-
if (normalize) rune = normalizeRune(rune);
|
|
4546
|
-
if (rune === pattern[pidx]) {
|
|
4547
|
-
if (withPos && pos !== null) pos.add(idx);
|
|
4548
|
-
score += SCORE_MATCH;
|
|
4549
|
-
let bonus = bonusFor(prevCharClass, charClass);
|
|
4550
|
-
if (consecutive === 0) firstBonus = bonus;
|
|
4551
|
-
else {
|
|
4552
|
-
if (bonus === BONUS_BOUNDARY) firstBonus = bonus;
|
|
4553
|
-
bonus = maxInt16(maxInt16(bonus, firstBonus), BONUS_CONSECUTIVE);
|
|
4554
|
-
}
|
|
4555
|
-
if (pidx === 0) score += bonus * BONUS_FIRST_CHAR_MULTIPLIER;
|
|
4556
|
-
else score += bonus;
|
|
4557
|
-
inGap = false;
|
|
4558
|
-
consecutive++;
|
|
4559
|
-
pidx++;
|
|
4560
|
-
} else {
|
|
4561
|
-
if (inGap) score += SCORE_GAP_EXTENTION;
|
|
4562
|
-
else score += SCORE_GAP_START;
|
|
4563
|
-
inGap = true;
|
|
4564
|
-
consecutive = 0;
|
|
4565
|
-
firstBonus = 0;
|
|
4566
|
-
}
|
|
4567
|
-
prevCharClass = charClass;
|
|
4568
|
-
}
|
|
4569
|
-
return [score, pos];
|
|
4570
|
-
}
|
|
4571
|
-
var fuzzyMatchV1 = (caseSensitive, normalize, forward, text, pattern, withPos, slab2) => {
|
|
4572
|
-
if (pattern.length === 0) return [{
|
|
4573
|
-
start: 0,
|
|
4574
|
-
end: 0,
|
|
4575
|
-
score: 0
|
|
4576
|
-
}, null];
|
|
4577
|
-
if (asciiFuzzyIndex(text, pattern, caseSensitive) < 0) return [{
|
|
4578
|
-
start: -1,
|
|
4579
|
-
end: -1,
|
|
4580
|
-
score: 0
|
|
4581
|
-
}, null];
|
|
4582
|
-
let pidx = 0, sidx = -1, eidx = -1;
|
|
4583
|
-
const lenRunes = text.length;
|
|
4584
|
-
const lenPattern = pattern.length;
|
|
4585
|
-
for (let index = 0; index < lenRunes; index++) {
|
|
4586
|
-
let rune = text[indexAt(index, lenRunes, forward)];
|
|
4587
|
-
if (!caseSensitive) {
|
|
4588
|
-
if (rune >= CAPITAL_A_RUNE && rune <= CAPITAL_Z_RUNE) rune += 32;
|
|
4589
|
-
else if (rune > MAX_ASCII) rune = String.fromCodePoint(rune).toLowerCase().codePointAt(0);
|
|
4590
|
-
}
|
|
4591
|
-
if (normalize) rune = normalizeRune(rune);
|
|
4592
|
-
const pchar = pattern[indexAt(pidx, lenPattern, forward)];
|
|
4593
|
-
if (rune === pchar) {
|
|
4594
|
-
if (sidx < 0) sidx = index;
|
|
4595
|
-
pidx++;
|
|
4596
|
-
if (pidx === lenPattern) {
|
|
4597
|
-
eidx = index + 1;
|
|
4598
|
-
break;
|
|
4599
|
-
}
|
|
4600
|
-
}
|
|
4601
|
-
}
|
|
4602
|
-
if (sidx >= 0 && eidx >= 0) {
|
|
4603
|
-
pidx--;
|
|
4604
|
-
for (let index = eidx - 1; index >= sidx; index--) {
|
|
4605
|
-
let rune = text[indexAt(index, lenRunes, forward)];
|
|
4606
|
-
if (!caseSensitive) {
|
|
4607
|
-
if (rune >= CAPITAL_A_RUNE && rune <= CAPITAL_Z_RUNE) rune += 32;
|
|
4608
|
-
else if (rune > MAX_ASCII) rune = String.fromCodePoint(rune).toLowerCase().codePointAt(0);
|
|
4609
|
-
}
|
|
4610
|
-
const pchar = pattern[indexAt(pidx, lenPattern, forward)];
|
|
4611
|
-
if (rune === pchar) {
|
|
4612
|
-
pidx--;
|
|
4613
|
-
if (pidx < 0) {
|
|
4614
|
-
sidx = index;
|
|
4615
|
-
break;
|
|
4616
|
-
}
|
|
4617
|
-
}
|
|
4618
|
-
}
|
|
4619
|
-
if (!forward) {
|
|
4620
|
-
const sidxTemp = sidx;
|
|
4621
|
-
sidx = lenRunes - eidx;
|
|
4622
|
-
eidx = lenRunes - sidxTemp;
|
|
4623
|
-
}
|
|
4624
|
-
const [score, pos] = calculateScore(caseSensitive, normalize, text, pattern, sidx, eidx, withPos);
|
|
4625
|
-
return [{
|
|
4626
|
-
start: sidx,
|
|
4627
|
-
end: eidx,
|
|
4628
|
-
score
|
|
4629
|
-
}, pos];
|
|
4630
|
-
}
|
|
4631
|
-
return [{
|
|
4632
|
-
start: -1,
|
|
4633
|
-
end: -1,
|
|
4634
|
-
score: 0
|
|
4635
|
-
}, null];
|
|
4636
|
-
};
|
|
4637
|
-
var exactMatchNaive = (caseSensitive, normalize, forward, text, pattern, withPos, slab2) => {
|
|
4638
|
-
if (pattern.length === 0) return [{
|
|
4639
|
-
start: 0,
|
|
4640
|
-
end: 0,
|
|
4641
|
-
score: 0
|
|
4642
|
-
}, null];
|
|
4643
|
-
const lenRunes = text.length;
|
|
4644
|
-
const lenPattern = pattern.length;
|
|
4645
|
-
if (lenRunes < lenPattern) return [{
|
|
4646
|
-
start: -1,
|
|
4647
|
-
end: -1,
|
|
4648
|
-
score: 0
|
|
4649
|
-
}, null];
|
|
4650
|
-
if (asciiFuzzyIndex(text, pattern, caseSensitive) < 0) return [{
|
|
4651
|
-
start: -1,
|
|
4652
|
-
end: -1,
|
|
4653
|
-
score: 0
|
|
4654
|
-
}, null];
|
|
4655
|
-
let pidx = 0;
|
|
4656
|
-
let bestPos = -1, bonus = toShort(0), bestBonus = toShort(-1);
|
|
4657
|
-
for (let index = 0; index < lenRunes; index++) {
|
|
4658
|
-
const index_ = indexAt(index, lenRunes, forward);
|
|
4659
|
-
let rune = text[index_];
|
|
4660
|
-
if (!caseSensitive) {
|
|
4661
|
-
if (rune >= CAPITAL_A_RUNE && rune <= CAPITAL_Z_RUNE) rune += 32;
|
|
4662
|
-
else if (rune > MAX_ASCII) rune = String.fromCodePoint(rune).toLowerCase().codePointAt(0);
|
|
4663
|
-
}
|
|
4664
|
-
if (normalize) rune = normalizeRune(rune);
|
|
4665
|
-
const pidx_ = indexAt(pidx, lenPattern, forward);
|
|
4666
|
-
if (pattern[pidx_] === rune) {
|
|
4667
|
-
if (pidx_ === 0) bonus = bonusAt(text, index_);
|
|
4668
|
-
pidx++;
|
|
4669
|
-
if (pidx === lenPattern) {
|
|
4670
|
-
if (bonus > bestBonus) {
|
|
4671
|
-
bestPos = index;
|
|
4672
|
-
bestBonus = bonus;
|
|
4673
|
-
}
|
|
4674
|
-
if (bonus === BONUS_BOUNDARY) break;
|
|
4675
|
-
index -= pidx - 1;
|
|
4676
|
-
pidx = 0;
|
|
4677
|
-
bonus = 0;
|
|
4678
|
-
}
|
|
4679
|
-
} else {
|
|
4680
|
-
index -= pidx;
|
|
4681
|
-
pidx = 0;
|
|
4682
|
-
bonus = 0;
|
|
4683
|
-
}
|
|
4684
|
-
}
|
|
4685
|
-
if (bestPos >= 0) {
|
|
4686
|
-
let sidx = 0, eidx = 0;
|
|
4687
|
-
if (forward) {
|
|
4688
|
-
sidx = bestPos - lenPattern + 1;
|
|
4689
|
-
eidx = bestPos + 1;
|
|
4690
|
-
} else {
|
|
4691
|
-
sidx = lenRunes - (bestPos + 1);
|
|
4692
|
-
eidx = lenRunes - (bestPos - lenPattern + 1);
|
|
4693
|
-
}
|
|
4694
|
-
const [score] = calculateScore(caseSensitive, normalize, text, pattern, sidx, eidx, false);
|
|
4695
|
-
return [{
|
|
4696
|
-
start: sidx,
|
|
4697
|
-
end: eidx,
|
|
4698
|
-
score
|
|
4699
|
-
}, null];
|
|
4700
|
-
}
|
|
4701
|
-
return [{
|
|
4702
|
-
start: -1,
|
|
4703
|
-
end: -1,
|
|
4704
|
-
score: 0
|
|
4705
|
-
}, null];
|
|
4706
|
-
};
|
|
4707
|
-
var SLAB_16_SIZE = 102400;
|
|
4708
|
-
var SLAB_32_SIZE = 2048;
|
|
4709
|
-
function makeSlab(size16, size32) {
|
|
4710
|
-
return {
|
|
4711
|
-
i16: new Int16Array(size16),
|
|
4712
|
-
i32: new Int32Array(size32)
|
|
4713
|
-
};
|
|
4714
|
-
}
|
|
4715
|
-
var slab = makeSlab(SLAB_16_SIZE, SLAB_32_SIZE);
|
|
4716
|
-
var buildPatternForBasicMatch = (query, casing, normalize) => {
|
|
4717
|
-
let caseSensitive = false;
|
|
4718
|
-
switch (casing) {
|
|
4719
|
-
case "smart-case":
|
|
4720
|
-
if (query.toLowerCase() !== query) caseSensitive = true;
|
|
4721
|
-
break;
|
|
4722
|
-
case "case-sensitive":
|
|
4723
|
-
caseSensitive = true;
|
|
4724
|
-
break;
|
|
4725
|
-
case "case-insensitive":
|
|
4726
|
-
query = query.toLowerCase();
|
|
4727
|
-
caseSensitive = false;
|
|
4728
|
-
}
|
|
4729
|
-
let queryRunes = strToRunes(query);
|
|
4730
|
-
if (normalize) queryRunes = queryRunes.map(normalizeRune);
|
|
4731
|
-
return {
|
|
4732
|
-
queryRunes,
|
|
4733
|
-
caseSensitive
|
|
4734
|
-
};
|
|
4735
|
-
};
|
|
4736
|
-
function getResultFromScoreMap(scoreMap, limit) {
|
|
4737
|
-
const scoresInDesc = Object.keys(scoreMap).map((v) => parseInt(v, 10)).sort((a, b) => b - a);
|
|
4738
|
-
let result = [];
|
|
4739
|
-
for (const score of scoresInDesc) {
|
|
4740
|
-
result = result.concat(scoreMap[score]);
|
|
4741
|
-
if (result.length >= limit) break;
|
|
4742
|
-
}
|
|
4743
|
-
return result;
|
|
4744
|
-
}
|
|
4745
|
-
function getBasicMatchIter(scoreMap, queryRunes, caseSensitive) {
|
|
4746
|
-
return (idx) => {
|
|
4747
|
-
const itemRunes = this.runesList[idx];
|
|
4748
|
-
if (queryRunes.length > itemRunes.length) return;
|
|
4749
|
-
let [match, positions] = this.algoFn(caseSensitive, this.opts.normalize, this.opts.forward, itemRunes, queryRunes, true, slab);
|
|
4750
|
-
if (match.start === -1) return;
|
|
4751
|
-
if (this.opts.fuzzy === false) {
|
|
4752
|
-
positions = /* @__PURE__ */ new Set();
|
|
4753
|
-
for (let position = match.start; position < match.end; ++position) positions.add(position);
|
|
4754
|
-
}
|
|
4755
|
-
const scoreKey = this.opts.sort ? match.score : 0;
|
|
4756
|
-
if (scoreMap[scoreKey] === void 0) scoreMap[scoreKey] = [];
|
|
4757
|
-
scoreMap[scoreKey].push({
|
|
4758
|
-
item: this.items[idx],
|
|
4759
|
-
...match,
|
|
4760
|
-
positions: positions != null ? positions : /* @__PURE__ */ new Set()
|
|
4761
|
-
});
|
|
4762
|
-
};
|
|
4763
|
-
}
|
|
4764
|
-
var isNode = typeof __require !== "undefined" && typeof window === "undefined";
|
|
4765
|
-
function asyncMatcher(token, len, iter2, onFinish) {
|
|
4766
|
-
return new Promise((resolve, reject) => {
|
|
4767
|
-
const INCREMENT = 1e3;
|
|
4768
|
-
let i = 0, end = Math.min(INCREMENT, len);
|
|
4769
|
-
const step = () => {
|
|
4770
|
-
if (token.cancelled) return reject("search cancelled");
|
|
4771
|
-
for (; i < end; ++i) iter2(i);
|
|
4772
|
-
if (end < len) {
|
|
4773
|
-
end = Math.min(end + INCREMENT, len);
|
|
4774
|
-
isNode ? setImmediate(step) : setTimeout(step);
|
|
4775
|
-
} else resolve(onFinish());
|
|
4776
|
-
};
|
|
4777
|
-
step();
|
|
4778
|
-
});
|
|
4779
|
-
}
|
|
4780
|
-
function asyncBasicMatch(query, token) {
|
|
4781
|
-
const { queryRunes, caseSensitive } = buildPatternForBasicMatch(query, this.opts.casing, this.opts.normalize);
|
|
4782
|
-
const scoreMap = {};
|
|
4783
|
-
return asyncMatcher(token, this.runesList.length, getBasicMatchIter.bind(this)(scoreMap, queryRunes, caseSensitive), () => getResultFromScoreMap(scoreMap, this.opts.limit));
|
|
4784
|
-
}
|
|
4785
|
-
var defaultOpts = {
|
|
4786
|
-
limit: Infinity,
|
|
4787
|
-
selector: (v) => v,
|
|
4788
|
-
casing: "smart-case",
|
|
4789
|
-
normalize: true,
|
|
4790
|
-
fuzzy: "v2",
|
|
4791
|
-
tiebreakers: [],
|
|
4792
|
-
sort: true,
|
|
4793
|
-
forward: true
|
|
4794
|
-
};
|
|
4795
|
-
var BaseFinder = class {
|
|
4796
|
-
constructor(list, ...optionsTuple) {
|
|
4797
|
-
this.opts = {
|
|
4798
|
-
...defaultOpts,
|
|
4799
|
-
...optionsTuple[0]
|
|
4800
|
-
};
|
|
4801
|
-
this.items = list;
|
|
4802
|
-
this.runesList = list.map((item) => strToRunes(this.opts.selector(item).normalize()));
|
|
4803
|
-
this.algoFn = exactMatchNaive;
|
|
4804
|
-
switch (this.opts.fuzzy) {
|
|
4805
|
-
case "v2":
|
|
4806
|
-
this.algoFn = fuzzyMatchV2;
|
|
4807
|
-
break;
|
|
4808
|
-
case "v1": this.algoFn = fuzzyMatchV1;
|
|
4809
|
-
}
|
|
4810
|
-
}
|
|
4811
|
-
};
|
|
4812
|
-
({ ...defaultOpts });
|
|
4813
|
-
var asyncDefaultOpts = {
|
|
4814
|
-
...defaultOpts,
|
|
4815
|
-
match: asyncBasicMatch
|
|
4816
|
-
};
|
|
4817
|
-
var AsyncFinder = class extends BaseFinder {
|
|
4818
|
-
constructor(list, ...optionsTuple) {
|
|
4819
|
-
super(list, ...optionsTuple);
|
|
4820
|
-
this.opts = {
|
|
4821
|
-
...asyncDefaultOpts,
|
|
4822
|
-
...optionsTuple[0]
|
|
4823
|
-
};
|
|
4824
|
-
this.token = { cancelled: false };
|
|
4825
|
-
}
|
|
4826
|
-
async find(query) {
|
|
4827
|
-
this.token.cancelled = true;
|
|
4828
|
-
this.token = { cancelled: false };
|
|
4829
|
-
if (query.length === 0 || this.items.length === 0) return this.items.slice(0, this.opts.limit).map(createResultItemWithEmptyPos);
|
|
4830
|
-
query = query.normalize();
|
|
4831
|
-
return postProcessResultItems(await this.opts.match.bind(this)(query, this.token), this.opts);
|
|
4832
|
-
}
|
|
4833
|
-
};
|
|
4834
|
-
var createResultItemWithEmptyPos = (item) => ({
|
|
4835
|
-
item,
|
|
4836
|
-
start: -1,
|
|
4837
|
-
end: -1,
|
|
4838
|
-
score: 0,
|
|
4839
|
-
positions: /* @__PURE__ */ new Set()
|
|
4840
|
-
});
|
|
4841
|
-
function postProcessResultItems(result, opts) {
|
|
4842
|
-
if (opts.sort) {
|
|
4843
|
-
const { selector } = opts;
|
|
4844
|
-
result.sort((a, b) => {
|
|
4845
|
-
if (a.score === b.score) for (const tiebreaker of opts.tiebreakers) {
|
|
4846
|
-
const diff = tiebreaker(a, b, selector);
|
|
4847
|
-
if (diff !== 0) return diff;
|
|
4848
|
-
}
|
|
4849
|
-
return 0;
|
|
4850
|
-
});
|
|
4851
|
-
}
|
|
4852
|
-
if (Number.isFinite(opts.limit)) result.splice(opts.limit);
|
|
4853
|
-
return result;
|
|
4854
|
-
}
|
|
4855
|
-
var AsyncFzf = class {
|
|
4856
|
-
constructor(list, ...optionsTuple) {
|
|
4857
|
-
this.finder = new AsyncFinder(list, ...optionsTuple);
|
|
4858
|
-
this.find = this.finder.find.bind(this.finder);
|
|
4859
|
-
}
|
|
4860
|
-
};
|
|
4861
|
-
//#endregion
|
|
4862
|
-
//#region src/ui/browser/icons/picker/IconPicker.tsx
|
|
4863
|
-
var translations = {
|
|
4864
|
-
"en": {
|
|
4865
|
-
emoji: "Emoji",
|
|
4866
|
-
icon: "Icon",
|
|
4867
|
-
random: "Random",
|
|
4868
|
-
filter: "Filter...",
|
|
4869
|
-
more: "More...",
|
|
4870
|
-
loading: "Loading...",
|
|
4871
|
-
carbon: "Carbon",
|
|
4872
|
-
close: "Close",
|
|
4873
|
-
color: "Color"
|
|
4874
|
-
},
|
|
4875
|
-
"zh-CN": {
|
|
4876
|
-
emoji: "Emoji",
|
|
4877
|
-
icon: "图标",
|
|
4878
|
-
random: "随机",
|
|
4879
|
-
filter: "搜索...",
|
|
4880
|
-
more: "更多...",
|
|
4881
|
-
loading: "加载中...",
|
|
4882
|
-
carbon: "Carbon",
|
|
4883
|
-
close: "关闭",
|
|
4884
|
-
color: "颜色"
|
|
4885
|
-
},
|
|
4886
|
-
"zh-TW": {
|
|
4887
|
-
emoji: "Emoji",
|
|
4888
|
-
icon: "圖示",
|
|
4889
|
-
random: "隨機",
|
|
4890
|
-
filter: "搜尋...",
|
|
4891
|
-
more: "更多...",
|
|
4892
|
-
loading: "載入中...",
|
|
4893
|
-
carbon: "Carbon",
|
|
4894
|
-
close: "關閉",
|
|
4895
|
-
color: "顏色"
|
|
4896
|
-
},
|
|
4897
|
-
"ja": {
|
|
4898
|
-
emoji: "絵文字",
|
|
4899
|
-
icon: "アイコン",
|
|
4900
|
-
random: "ランダム",
|
|
4901
|
-
filter: "検索…",
|
|
4902
|
-
more: "もっと見る…",
|
|
4903
|
-
loading: "読み込み中…",
|
|
4904
|
-
carbon: "Carbon",
|
|
4905
|
-
close: "閉じる",
|
|
4906
|
-
color: "色"
|
|
4907
|
-
},
|
|
4908
|
-
"ko": {
|
|
4909
|
-
emoji: "이모지",
|
|
4910
|
-
icon: "아이콘",
|
|
4911
|
-
random: "무작위",
|
|
4912
|
-
filter: "필터...",
|
|
4913
|
-
more: "더 보기...",
|
|
4914
|
-
loading: "불러오는 중...",
|
|
4915
|
-
carbon: "Carbon",
|
|
4916
|
-
close: "닫기",
|
|
4917
|
-
color: "색상"
|
|
4918
|
-
},
|
|
4919
|
-
"ru": {
|
|
4920
|
-
emoji: "Эмодзи",
|
|
4921
|
-
icon: "Значок",
|
|
4922
|
-
random: "Случайно",
|
|
4923
|
-
filter: "Фильтр…",
|
|
4924
|
-
more: "Ещё…",
|
|
4925
|
-
loading: "Загрузка…",
|
|
4926
|
-
carbon: "Carbon",
|
|
4927
|
-
close: "Закрыть",
|
|
4928
|
-
color: "Цвет"
|
|
4929
|
-
},
|
|
4930
|
-
"fr": {
|
|
4931
|
-
emoji: "Emoji",
|
|
4932
|
-
icon: "Icône",
|
|
4933
|
-
random: "Aléatoire",
|
|
4934
|
-
filter: "Filtrer...",
|
|
4935
|
-
more: "Plus...",
|
|
4936
|
-
loading: "Chargement...",
|
|
4937
|
-
carbon: "Carbon",
|
|
4938
|
-
close: "Fermer",
|
|
4939
|
-
color: "Couleur"
|
|
4940
|
-
}
|
|
4941
|
-
};
|
|
4942
|
-
var rememberLastTab;
|
|
4943
|
-
var rememberLastColor;
|
|
4944
|
-
function getTranslate(lang) {
|
|
4945
|
-
const data = translations[resolveUiLanguage([lang])];
|
|
4946
|
-
return (key) => data[key] || translations.en[key] || key;
|
|
4947
|
-
}
|
|
4948
|
-
var COLUMNS = 9;
|
|
4949
|
-
var CONTAINER_STYLE = {
|
|
4950
|
-
width: 308,
|
|
4951
|
-
height: 360
|
|
4952
|
-
};
|
|
4953
|
-
var MAX_ITEMS_INIT = 180;
|
|
4954
|
-
var MAX_ITEMS_STEP = 90;
|
|
4955
|
-
var COLORS = [
|
|
4956
|
-
"currentColor",
|
|
4957
|
-
"#CC3E44",
|
|
4958
|
-
"#E37933",
|
|
4959
|
-
"#CBCB41",
|
|
4960
|
-
"#8DC149",
|
|
4961
|
-
"#7494A3",
|
|
4962
|
-
"#519ABA",
|
|
4963
|
-
"#A074C4",
|
|
4964
|
-
"#F55385",
|
|
4965
|
-
"#6D8086"
|
|
4966
|
-
];
|
|
4967
|
-
function computeRows(iconifyData, filteredIcons, categories, collection) {
|
|
4968
|
-
const rows = [];
|
|
4969
|
-
if (!iconifyData) return rows;
|
|
4970
|
-
if (filteredIcons) for (let i = 0; i < filteredIcons.length; i += COLUMNS) rows.push(filteredIcons.slice(i, i + COLUMNS));
|
|
4971
|
-
else if (categories) for (const category in categories) {
|
|
4972
|
-
rows.push(category);
|
|
4973
|
-
const icons = categories[category];
|
|
4974
|
-
for (let i = 0; i < icons.length; i += COLUMNS) rows.push(icons.slice(i, i + COLUMNS));
|
|
4975
|
-
}
|
|
4976
|
-
else if (collection) {
|
|
4977
|
-
const icons = iconifyData[collection]?.icons.icons;
|
|
4978
|
-
if (icons) {
|
|
4979
|
-
filteredIcons = Object.keys(icons);
|
|
4980
|
-
for (let i = 0; i < filteredIcons.length; i += COLUMNS) rows.push(filteredIcons.slice(i, i + COLUMNS));
|
|
4981
|
-
}
|
|
4982
|
-
}
|
|
4983
|
-
return rows;
|
|
4984
|
-
}
|
|
4985
|
-
var ICON_SIZE = 32;
|
|
4986
|
-
var BUFFER_SIZE = 320;
|
|
4987
|
-
var ROW_STYLE = { height: ICON_SIZE };
|
|
4988
|
-
var PickerIcon = ({ iconSet, name, color }) => {
|
|
4989
|
-
const svg = useMemo(() => {
|
|
4990
|
-
const icon = getIconData(iconSet, name);
|
|
4991
|
-
if (!icon) return null;
|
|
4992
|
-
const result = iconToSVG(icon, {
|
|
4993
|
-
width: "1em",
|
|
4994
|
-
height: "1em"
|
|
4995
|
-
});
|
|
4996
|
-
return {
|
|
4997
|
-
body: replaceIDs(result.body),
|
|
4998
|
-
viewBox: result.attributes.viewBox
|
|
4999
|
-
};
|
|
5000
|
-
}, [iconSet, name]);
|
|
5001
|
-
if (!svg) return null;
|
|
5002
|
-
return /* @__PURE__ */ jsx("svg", {
|
|
5003
|
-
"aria-hidden": "true",
|
|
5004
|
-
className: clsx(IconPicker_module_default.icon, "text-lg"),
|
|
5005
|
-
focusable: "false",
|
|
5006
|
-
style: { color },
|
|
5007
|
-
viewBox: svg.viewBox,
|
|
5008
|
-
dangerouslySetInnerHTML: { __html: svg.body }
|
|
5009
|
-
});
|
|
5010
|
-
};
|
|
5011
|
-
function renderRow(index, row, iconSet, color) {
|
|
5012
|
-
return /* @__PURE__ */ jsx("div", {
|
|
5013
|
-
className: IconPicker_module_default.row,
|
|
5014
|
-
style: ROW_STYLE,
|
|
5015
|
-
children: Array.isArray(row) ? row.map((icon) => /* @__PURE__ */ jsx(Button$1, {
|
|
5016
|
-
variant: "ghost",
|
|
5017
|
-
size: "icon-sm",
|
|
5018
|
-
"aria-label": icon,
|
|
5019
|
-
"data-icon": icon,
|
|
5020
|
-
title: icon,
|
|
5021
|
-
type: "button",
|
|
5022
|
-
children: /* @__PURE__ */ jsx(PickerIcon, {
|
|
5023
|
-
iconSet,
|
|
5024
|
-
name: icon,
|
|
5025
|
-
color
|
|
5026
|
-
})
|
|
5027
|
-
}, icon)) : /* @__PURE__ */ jsx("div", {
|
|
5028
|
-
className: IconPicker_module_default.subtitle,
|
|
5029
|
-
children: row
|
|
5030
|
-
})
|
|
5031
|
-
}, index);
|
|
5032
|
-
}
|
|
5033
|
-
var IconPickerIconsPanel = ({ filteredIcons, collection, color, categories, onClick }) => {
|
|
5034
|
-
const iconifyData = useIconifyData(true);
|
|
5035
|
-
const iconSet = iconifyData?.[collection]?.icons;
|
|
5036
|
-
const [viewport, setViewport] = useState(null);
|
|
5037
|
-
const rows = useMemo(() => computeRows(iconifyData, filteredIcons, categories, collection), [
|
|
5038
|
-
iconifyData,
|
|
5039
|
-
filteredIcons,
|
|
5040
|
-
categories,
|
|
5041
|
-
collection
|
|
5042
|
-
]);
|
|
5043
|
-
return /* @__PURE__ */ jsx(ScrollArea, {
|
|
5044
|
-
className: IconPicker_module_default.panel,
|
|
5045
|
-
defer: false,
|
|
5046
|
-
events: { initialized: (instance) => setViewport(instance.elements().viewport) },
|
|
5047
|
-
onClick,
|
|
5048
|
-
children: viewport && iconSet && /* @__PURE__ */ jsx(Z$1, {
|
|
5049
|
-
data: rows,
|
|
5050
|
-
itemSize: ICON_SIZE,
|
|
5051
|
-
bufferSize: BUFFER_SIZE,
|
|
5052
|
-
scrollRef: { current: viewport },
|
|
5053
|
-
children: (row, index) => renderRow(index, row, iconSet, color)
|
|
5054
|
-
})
|
|
5055
|
-
});
|
|
5056
|
-
};
|
|
5057
|
-
var IconPicker = ({ className, emoji, carbon = true, defaultTab = rememberLastTab || (emoji ? "twemoji" : "carbon"), defaultColor = rememberLastColor || COLORS[0], locale, onChange, onCancel }) => {
|
|
5058
|
-
if (!emoji && !carbon) carbon = true;
|
|
5059
|
-
const i18n = useI18n(true);
|
|
5060
|
-
const language$ = locale || i18n?.lang$ || "en";
|
|
5061
|
-
const t = getTranslate(useVal(language$));
|
|
5062
|
-
const root = useRef(null);
|
|
5063
|
-
const [tab, setTab] = useState(defaultTab);
|
|
5064
|
-
const [searchText, setSearchText] = useState("");
|
|
5065
|
-
const [maxItems, setMaxItems] = useState(MAX_ITEMS_INIT);
|
|
5066
|
-
const [filteredIcons, setIcons] = useState(null);
|
|
5067
|
-
const [selectedColor, setColor] = useState(defaultColor);
|
|
5068
|
-
const [colorsPanel, setColorsPanel] = useState(false);
|
|
5069
|
-
const hasColors = tab === "carbon";
|
|
5070
|
-
const iconifyData = useIconifyData(true);
|
|
5071
|
-
const loadCollection = useIconifyCollectionLoader();
|
|
5072
|
-
useEffect(() => {
|
|
5073
|
-
loadCollection?.(tab).catch((error) => console.error(`Failed to load the ${tab} icon collection.`, error));
|
|
5074
|
-
}, [loadCollection, tab]);
|
|
5075
|
-
const fzf = useMemo(() => {
|
|
5076
|
-
const collection = iconifyData?.[tab];
|
|
5077
|
-
if (collection) return new AsyncFzf(Object.keys(collection.icons.icons), {
|
|
5078
|
-
casing: "case-insensitive",
|
|
5079
|
-
fuzzy: "v1"
|
|
5080
|
-
});
|
|
5081
|
-
return null;
|
|
5082
|
-
}, [iconifyData, tab]);
|
|
5083
|
-
const loadMore = useCallback(() => {
|
|
5084
|
-
setMaxItems((currentMaxItems) => currentMaxItems + MAX_ITEMS_STEP);
|
|
5085
|
-
}, []);
|
|
5086
|
-
const searchTimeout = useRef(0);
|
|
5087
|
-
useEffect(() => {
|
|
5088
|
-
clearTimeout(searchTimeout.current);
|
|
5089
|
-
if (searchText) {
|
|
5090
|
-
setIcons([]);
|
|
5091
|
-
if (!fzf || !searchText) return;
|
|
5092
|
-
let isMounted = true;
|
|
5093
|
-
searchTimeout.current = window.setTimeout(async () => {
|
|
5094
|
-
const result = await fzf.find(searchText);
|
|
5095
|
-
if (isMounted) {
|
|
5096
|
-
setMaxItems(MAX_ITEMS_INIT);
|
|
5097
|
-
setIcons(result.map((i) => i.item));
|
|
5098
|
-
}
|
|
5099
|
-
}, 200);
|
|
5100
|
-
return () => {
|
|
5101
|
-
isMounted = false;
|
|
5102
|
-
};
|
|
5103
|
-
} else setIcons(null);
|
|
5104
|
-
}, [fzf, searchText]);
|
|
5105
|
-
const onClickShuffle = useCallback(() => {
|
|
5106
|
-
const collection = iconifyData?.[tab];
|
|
5107
|
-
if (onChange && collection) {
|
|
5108
|
-
const keys = Object.keys(collection.icons.icons);
|
|
5109
|
-
const icon = keys[Math.floor(Math.random() * keys.length)];
|
|
5110
|
-
const color = COLORS[Math.floor(Math.random() * COLORS.length)];
|
|
5111
|
-
onChange(tab, icon, color, true);
|
|
5112
|
-
}
|
|
5113
|
-
}, [tab, onChange]);
|
|
5114
|
-
const toggleColorsPanel = useCallback(() => {
|
|
5115
|
-
setColorsPanel((e) => !e);
|
|
5116
|
-
}, []);
|
|
5117
|
-
const onClickColors = useCallback((event) => {
|
|
5118
|
-
const color = event.target.dataset.color;
|
|
5119
|
-
if (color) setColor(rememberLastColor = color);
|
|
5120
|
-
}, []);
|
|
5121
|
-
const onClickIcon = useCallback((event) => {
|
|
5122
|
-
const icon = event.target.dataset.icon;
|
|
5123
|
-
if (icon && onChange) onChange(tab, icon, selectedColor, false);
|
|
5124
|
-
}, [
|
|
5125
|
-
tab,
|
|
5126
|
-
selectedColor,
|
|
5127
|
-
onChange
|
|
5128
|
-
]);
|
|
5129
|
-
const onKeyDown = useCallback((event) => {
|
|
5130
|
-
if (event.key === "Escape" && onCancel) {
|
|
5131
|
-
event.stopPropagation();
|
|
5132
|
-
onCancel();
|
|
5133
|
-
}
|
|
5134
|
-
}, [onCancel]);
|
|
5135
|
-
useEffect(() => {
|
|
5136
|
-
root.current?.focus();
|
|
5137
|
-
}, []);
|
|
5138
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
5139
|
-
className: clsx(IconPicker_module_default.container, className),
|
|
5140
|
-
style: CONTAINER_STYLE,
|
|
5141
|
-
tabIndex: -1,
|
|
5142
|
-
onKeyDown,
|
|
5143
|
-
children: [
|
|
5144
|
-
/* @__PURE__ */ jsxs("div", {
|
|
5145
|
-
className: IconPicker_module_default.filter,
|
|
5146
|
-
children: [/* @__PURE__ */ jsxs(InputGroup, {
|
|
5147
|
-
className: "h-6",
|
|
5148
|
-
children: [/* @__PURE__ */ jsx(InputGroupAddon, { children: /* @__PURE__ */ jsx("i", {
|
|
5149
|
-
"aria-hidden": "true",
|
|
5150
|
-
className: "i-lucide-light:search text-sm"
|
|
5151
|
-
}) }), /* @__PURE__ */ jsx(InputGroupInput, {
|
|
5152
|
-
className: "h-full py-0 text-[11px] md:text-[11px]",
|
|
5153
|
-
"aria-label": t("filter"),
|
|
5154
|
-
autoComplete: "off",
|
|
5155
|
-
type: "search",
|
|
5156
|
-
placeholder: t("filter"),
|
|
5157
|
-
value: searchText,
|
|
5158
|
-
onChange: (e) => setSearchText(e.target.value),
|
|
5159
|
-
autoFocus: true
|
|
5160
|
-
})]
|
|
5161
|
-
}), /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
5162
|
-
render: /* @__PURE__ */ jsx(Button$1, {
|
|
5163
|
-
variant: "ghost",
|
|
5164
|
-
size: "icon-xs",
|
|
5165
|
-
"aria-label": t("random"),
|
|
5166
|
-
onClick: onClickShuffle,
|
|
5167
|
-
type: "button"
|
|
5168
|
-
}),
|
|
5169
|
-
children: /* @__PURE__ */ jsx("i", {
|
|
5170
|
-
"aria-hidden": "true",
|
|
5171
|
-
className: "i-lucide-light:shuffle text-sm"
|
|
5172
|
-
})
|
|
5173
|
-
}), /* @__PURE__ */ jsx(TooltipContent, { children: t("random") })] })]
|
|
5174
|
-
}),
|
|
5175
|
-
/* @__PURE__ */ jsxs("div", {
|
|
5176
|
-
className: IconPicker_module_default.tabs,
|
|
5177
|
-
children: [
|
|
5178
|
-
/* @__PURE__ */ jsx(Tabs, {
|
|
5179
|
-
value: tab,
|
|
5180
|
-
onValueChange: (value) => {
|
|
5181
|
-
setTab(rememberLastTab = value);
|
|
5182
|
-
setColorsPanel(false);
|
|
5183
|
-
},
|
|
5184
|
-
className: "min-w-0 flex-1",
|
|
5185
|
-
children: /* @__PURE__ */ jsxs(TabsList, {
|
|
5186
|
-
variant: "flat",
|
|
5187
|
-
className: "w-full rounded-[6px] p-0.5 group-data-[orientation=horizontal]/tabs:h-6",
|
|
5188
|
-
children: [emoji && /* @__PURE__ */ jsx(TabsTrigger, {
|
|
5189
|
-
className: "text-[11px] group-data-[variant=flat]/tabs-list:rounded-[4px]",
|
|
5190
|
-
value: "twemoji",
|
|
5191
|
-
children: t("emoji")
|
|
5192
|
-
}), carbon && /* @__PURE__ */ jsx(TabsTrigger, {
|
|
5193
|
-
className: "text-[11px] group-data-[variant=flat]/tabs-list:rounded-[4px]",
|
|
5194
|
-
value: "carbon",
|
|
5195
|
-
children: t("carbon")
|
|
5196
|
-
})]
|
|
5197
|
-
})
|
|
5198
|
-
}),
|
|
5199
|
-
hasColors && /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
5200
|
-
render: /* @__PURE__ */ jsx(Button$1, {
|
|
5201
|
-
variant: "ghost",
|
|
5202
|
-
size: "icon-xs",
|
|
5203
|
-
"aria-expanded": colorsPanel,
|
|
5204
|
-
"aria-label": t("color"),
|
|
5205
|
-
onClick: toggleColorsPanel,
|
|
5206
|
-
type: "button"
|
|
5207
|
-
}),
|
|
5208
|
-
children: /* @__PURE__ */ jsx("i", {
|
|
5209
|
-
"aria-hidden": "true",
|
|
5210
|
-
className: "i-lucide-light:palette text-sm",
|
|
5211
|
-
style: { color: selectedColor }
|
|
5212
|
-
})
|
|
5213
|
-
}), /* @__PURE__ */ jsx(TooltipContent, { children: t("color") })] }),
|
|
5214
|
-
/* @__PURE__ */ jsx("div", {
|
|
5215
|
-
onClick: onClickColors,
|
|
5216
|
-
className: IconPicker_module_default.colors,
|
|
5217
|
-
style: hasColors && colorsPanel ? {} : { display: "none" },
|
|
5218
|
-
children: COLORS.map((color) => /* @__PURE__ */ jsx("button", {
|
|
5219
|
-
"aria-label": `${t("color")}: ${color}`,
|
|
5220
|
-
"aria-pressed": selectedColor === color,
|
|
5221
|
-
className: IconPicker_module_default.color,
|
|
5222
|
-
"data-color": color,
|
|
5223
|
-
style: { backgroundColor: color },
|
|
5224
|
-
type: "button"
|
|
5225
|
-
}, color))
|
|
5226
|
-
})
|
|
5227
|
-
]
|
|
5228
|
-
}),
|
|
5229
|
-
iconifyData?.[tab] ? /* @__PURE__ */ jsx(IconPickerIconsPanel, {
|
|
5230
|
-
filteredIcons: filteredIcons?.slice(0, maxItems),
|
|
5231
|
-
collection: tab,
|
|
5232
|
-
categories: iconifyData?.[tab]?.metadata?.categories,
|
|
5233
|
-
color: selectedColor,
|
|
5234
|
-
onClick: onClickIcon
|
|
5235
|
-
}, tab) : /* @__PURE__ */ jsxs("div", {
|
|
5236
|
-
className: IconPicker_module_default.loading,
|
|
5237
|
-
children: [/* @__PURE__ */ jsx("i", { className: "i-codicon:loading" }), /* @__PURE__ */ jsx("span", { children: t("loading") })]
|
|
5238
|
-
}),
|
|
5239
|
-
filteredIcons && filteredIcons.length > maxItems && /* @__PURE__ */ jsx(Button$1, {
|
|
5240
|
-
variant: "ghost",
|
|
5241
|
-
size: "xs",
|
|
5242
|
-
className: "mx-3 mb-2 shrink-0 text-[11px]",
|
|
5243
|
-
onClick: loadMore,
|
|
5244
|
-
type: "button",
|
|
5245
|
-
children: t("more")
|
|
5246
|
-
})
|
|
5247
|
-
]
|
|
5248
|
-
});
|
|
5249
|
-
};
|
|
5250
|
-
//#endregion
|
|
5251
|
-
//#region src/ui/browser/icons/icon-picker-button.tsx
|
|
5252
|
-
function IconPickerButton({ children, className, disabled, label, onChange, side = "bottom", size = "icon-xs", variant = "ghost" }) {
|
|
5253
|
-
const [open, setOpen] = useState(false);
|
|
5254
|
-
const [container, setContainer] = useState(null);
|
|
5255
|
-
return /* @__PURE__ */ jsx("div", {
|
|
5256
|
-
className: "inline-flex",
|
|
5257
|
-
ref: setContainer,
|
|
5258
|
-
children: /* @__PURE__ */ jsxs(Popover, {
|
|
5259
|
-
open: open && !disabled,
|
|
5260
|
-
onOpenChange: setOpen,
|
|
5261
|
-
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
5262
|
-
render: /* @__PURE__ */ jsx(Button$1, {
|
|
5263
|
-
"aria-label": label,
|
|
5264
|
-
className,
|
|
5265
|
-
disabled,
|
|
5266
|
-
size,
|
|
5267
|
-
variant
|
|
5268
|
-
}),
|
|
5269
|
-
children
|
|
5270
|
-
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
5271
|
-
"aria-label": label,
|
|
5272
|
-
container,
|
|
5273
|
-
side,
|
|
5274
|
-
className: "w-auto overflow-hidden border border-foreground/10 p-0 ring-0",
|
|
5275
|
-
children: /* @__PURE__ */ jsx(IconPicker, {
|
|
5276
|
-
emoji: true,
|
|
5277
|
-
onCancel: () => setOpen(false),
|
|
5278
|
-
onChange: (collection, icon, color) => {
|
|
5279
|
-
onChange(color.toLowerCase() === "currentcolor" ? `:${collection}:${icon}:` : `:${collection}:${icon}:${color}:`);
|
|
5280
|
-
setOpen(false);
|
|
5281
|
-
}
|
|
5282
|
-
})
|
|
5283
|
-
})]
|
|
5284
|
-
})
|
|
5285
|
-
});
|
|
5286
|
-
}
|
|
5287
3130
|
//#endregion
|
|
5288
3131
|
//#region src/workbench/browser/runtime/editor/nodeHeading.tsx
|
|
5289
3132
|
function NodeHeading({ title, icon, fallback, disabled, titleReadOnly = false, validate, onRename, onIconChange }) {
|
|
@@ -5919,7 +3762,7 @@ function FlowStateButton({ client, flowId, nodes, history, notify, onClose }) {
|
|
|
5919
3762
|
children: [/* @__PURE__ */ jsx("i", {
|
|
5920
3763
|
"aria-hidden": "true",
|
|
5921
3764
|
className: "i-lucide-light:database"
|
|
5922
|
-
}), t(space == null ? "flowState.title" : "flowState.
|
|
3765
|
+
}), t(space == null ? "flowState.title" : "flowState.usage")]
|
|
5923
3766
|
}), /* @__PURE__ */ jsxs(DialogContent, {
|
|
5924
3767
|
ref: dialogRoot,
|
|
5925
3768
|
container,
|
|
@@ -5928,7 +3771,7 @@ function FlowStateButton({ client, flowId, nodes, history, notify, onClose }) {
|
|
|
5928
3771
|
children: [
|
|
5929
3772
|
/* @__PURE__ */ jsx(DialogTitle, {
|
|
5930
3773
|
className: "break-words pr-8",
|
|
5931
|
-
children: space == null ? t("flowState.title") : t("flowState.
|
|
3774
|
+
children: space == null ? t("flowState.title") : t("flowState.sourceUsage", { name: sourceName(space, nodes, t) })
|
|
5932
3775
|
}),
|
|
5933
3776
|
/* @__PURE__ */ jsxs(Tabs, {
|
|
5934
3777
|
value: scope,
|
|
@@ -36127,7 +33970,7 @@ function WorkspaceDiagnosticsIsland({ checking, items, nodes, onOpenChange, onRe
|
|
|
36127
33970
|
}
|
|
36128
33971
|
//#endregion
|
|
36129
33972
|
//#region src/workbench/browser/runtime/shell/workspaceNavigationIsland.tsx
|
|
36130
|
-
function WorkspaceNavigationIsland({ flowName, settings, flowsHref, ghost = false, onOpenFlows, saveStatus }) {
|
|
33973
|
+
function WorkspaceNavigationIsland({ flowName, flowIcon, flowDescription, settings, flowsHref, ghost = false, onOpenFlows, saveStatus }) {
|
|
36131
33974
|
const t = useTranslate();
|
|
36132
33975
|
const [tooltipContainer, setTooltipContainer] = useState(null);
|
|
36133
33976
|
const draftStatus = saveStatus == "saved" || saveStatus == "saving" || saveStatus == "failed" ? saveStatus : void 0;
|
|
@@ -36156,10 +33999,25 @@ function WorkspaceNavigationIsland({ flowName, settings, flowsHref, ghost = fals
|
|
|
36156
33999
|
children: /* @__PURE__ */ jsx(Icon, { name: "chevron-left" })
|
|
36157
34000
|
})
|
|
36158
34001
|
}),
|
|
34002
|
+
flowIcon && /* @__PURE__ */ jsx(ContentIcon, {
|
|
34003
|
+
src: flowIcon,
|
|
34004
|
+
className: "size-4 shrink-0",
|
|
34005
|
+
fallback: /* @__PURE__ */ jsx("i", {
|
|
34006
|
+
"aria-hidden": "true",
|
|
34007
|
+
className: "i-lucide-light:workflow size-4 shrink-0"
|
|
34008
|
+
})
|
|
34009
|
+
}),
|
|
36159
34010
|
/* @__PURE__ */ jsx(CanvasTooltip, {
|
|
36160
34011
|
getPopupContainer: () => tooltipContainer ?? document.body,
|
|
36161
34012
|
placement: "bottom",
|
|
36162
|
-
title:
|
|
34013
|
+
title: flowDescription ? /* @__PURE__ */ jsxs("span", {
|
|
34014
|
+
className: "whitespace-pre-wrap",
|
|
34015
|
+
children: [
|
|
34016
|
+
flowName,
|
|
34017
|
+
"\n",
|
|
34018
|
+
flowDescription
|
|
34019
|
+
]
|
|
34020
|
+
}) : flowName,
|
|
36163
34021
|
children: /* @__PURE__ */ jsx("span", {
|
|
36164
34022
|
className: "workspace-flow-name",
|
|
36165
34023
|
tabIndex: 0,
|
|
@@ -36209,6 +34067,7 @@ var blockedReasonKey = {
|
|
|
36209
34067
|
};
|
|
36210
34068
|
function WorkspacePublishIsland({ hasPublications, onOpenPublications, onExport, onExportPng, onOpenRuns, onOpenState, onPublish, preferences, state }) {
|
|
36211
34069
|
const t = useTranslate();
|
|
34070
|
+
const exportAction = useWorkflowExportAction(onExport);
|
|
36212
34071
|
const [popupContainer, setPopupContainer] = useState(null);
|
|
36213
34072
|
const [confirming, setConfirming] = useState(false);
|
|
36214
34073
|
const [exporting, setExporting] = useState(false);
|
|
@@ -36290,101 +34149,104 @@ function WorkspacePublishIsland({ hasPublications, onOpenPublications, onExport,
|
|
|
36290
34149
|
})]
|
|
36291
34150
|
})]
|
|
36292
34151
|
}),
|
|
36293
|
-
/* @__PURE__ */ jsxs(DropdownMenu, {
|
|
36294
|
-
|
|
36295
|
-
|
|
36296
|
-
|
|
36297
|
-
|
|
36298
|
-
|
|
36299
|
-
|
|
36300
|
-
|
|
36301
|
-
|
|
36302
|
-
|
|
36303
|
-
|
|
36304
|
-
|
|
36305
|
-
})
|
|
36306
|
-
}) })
|
|
36307
|
-
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
36308
|
-
align: "end",
|
|
36309
|
-
className: "w-max min-w-44 max-w-(--available-width)",
|
|
36310
|
-
container: popupContainer,
|
|
36311
|
-
side: "bottom",
|
|
36312
|
-
sideOffset: 8,
|
|
36313
|
-
children: [
|
|
36314
|
-
onExport != null && /* @__PURE__ */ jsx(WorkflowExportMenuItem, {
|
|
36315
|
-
className: "gap-2 px-2 py-[5px]",
|
|
36316
|
-
disabled: state == "busy" || state == "publishing",
|
|
36317
|
-
onClick: onExport
|
|
36318
|
-
}),
|
|
36319
|
-
onExportPng != null && /* @__PURE__ */ jsxs(DropdownMenuSub, { children: [/* @__PURE__ */ jsxs(DropdownMenuSubTrigger, {
|
|
36320
|
-
className: "gap-2 px-2 py-[5px]",
|
|
36321
|
-
disabled: exporting,
|
|
36322
|
-
children: [/* @__PURE__ */ jsx("i", {
|
|
36323
|
-
"aria-hidden": "true",
|
|
36324
|
-
className: "i-lucide-light:download size-4 shrink-0"
|
|
36325
|
-
}), t("resource.exportPng")]
|
|
36326
|
-
}), /* @__PURE__ */ jsxs(DropdownMenuSubContent, {
|
|
36327
|
-
className: "min-w-32",
|
|
36328
|
-
container: popupContainer,
|
|
36329
|
-
children: [
|
|
36330
|
-
/* @__PURE__ */ jsx(DropdownMenuCheckboxItem, {
|
|
36331
|
-
checked: showFrame,
|
|
36332
|
-
className: "py-[5px] pl-2",
|
|
36333
|
-
closeOnClick: false,
|
|
36334
|
-
onCheckedChange: (checked) => {
|
|
36335
|
-
setShowFrame(checked);
|
|
36336
|
-
writePngExportFrame(preferences, checked);
|
|
36337
|
-
},
|
|
36338
|
-
children: t("resource.exportPngFrame")
|
|
36339
|
-
}),
|
|
36340
|
-
/* @__PURE__ */ jsx(DropdownMenuSeparator, { className: "mx-2 bg-border/50" }),
|
|
36341
|
-
[false, true].map((dark) => /* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
36342
|
-
className: "px-2 py-[5px]",
|
|
36343
|
-
onClick: async () => {
|
|
36344
|
-
setExporting(true);
|
|
36345
|
-
try {
|
|
36346
|
-
await onExportPng({
|
|
36347
|
-
dark,
|
|
36348
|
-
frame: showFrame
|
|
36349
|
-
});
|
|
36350
|
-
} finally {
|
|
36351
|
-
setExporting(false);
|
|
36352
|
-
}
|
|
36353
|
-
},
|
|
36354
|
-
children: t(dark ? "resource.exportPngDark" : "resource.exportPngLight")
|
|
36355
|
-
}, String(dark)))
|
|
36356
|
-
]
|
|
36357
|
-
})] }),
|
|
36358
|
-
/* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
36359
|
-
className: "gap-2 px-2 py-[5px]",
|
|
36360
|
-
disabled: hasPublications !== true,
|
|
36361
|
-
onClick: onOpenPublications,
|
|
36362
|
-
children: [/* @__PURE__ */ jsx("i", {
|
|
36363
|
-
"aria-hidden": "true",
|
|
36364
|
-
className: "i-lucide-light:cloud-upload size-4 shrink-0 text-foreground/70"
|
|
36365
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
36366
|
-
className: "whitespace-nowrap",
|
|
36367
|
-
children: historyLabel
|
|
36368
|
-
})]
|
|
36369
|
-
}),
|
|
36370
|
-
onOpenState != null && /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
36371
|
-
className: "gap-2 px-2 py-[5px]",
|
|
36372
|
-
onClick: onOpenState,
|
|
36373
|
-
children: [/* @__PURE__ */ jsx("i", {
|
|
36374
|
-
"aria-hidden": "true",
|
|
36375
|
-
className: "i-lucide-light:database size-4 shrink-0 text-foreground/70"
|
|
36376
|
-
}), t("flowState.title")]
|
|
36377
|
-
}),
|
|
36378
|
-
/* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
36379
|
-
className: "gap-2 px-2 py-[5px]",
|
|
36380
|
-
onClick: onOpenRuns,
|
|
36381
|
-
children: [/* @__PURE__ */ jsx("i", {
|
|
34152
|
+
/* @__PURE__ */ jsxs(DropdownMenu, {
|
|
34153
|
+
onOpenChangeComplete: exportAction.onOpenChangeComplete,
|
|
34154
|
+
children: [/* @__PURE__ */ jsx(CanvasTooltip, {
|
|
34155
|
+
getPopupContainer: () => popupContainer ?? document.body,
|
|
34156
|
+
placement: "bottom",
|
|
34157
|
+
title: menuLabel,
|
|
34158
|
+
children: /* @__PURE__ */ jsx(DropdownMenuTrigger, { render: /* @__PURE__ */ jsx(Button$1, {
|
|
34159
|
+
"aria-label": menuLabel,
|
|
34160
|
+
size: "icon",
|
|
34161
|
+
type: "button",
|
|
34162
|
+
variant: "ghost",
|
|
34163
|
+
children: /* @__PURE__ */ jsx("i", {
|
|
36382
34164
|
"aria-hidden": "true",
|
|
36383
|
-
className: "i-lucide-light:
|
|
36384
|
-
})
|
|
36385
|
-
})
|
|
36386
|
-
|
|
36387
|
-
|
|
34165
|
+
className: "i-lucide-light:chevron-down"
|
|
34166
|
+
})
|
|
34167
|
+
}) })
|
|
34168
|
+
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
34169
|
+
align: "end",
|
|
34170
|
+
className: "w-max min-w-44 max-w-(--available-width)",
|
|
34171
|
+
container: popupContainer,
|
|
34172
|
+
side: "bottom",
|
|
34173
|
+
sideOffset: 8,
|
|
34174
|
+
children: [
|
|
34175
|
+
onExport != null && /* @__PURE__ */ jsx(WorkflowExportMenuItem, {
|
|
34176
|
+
className: "gap-2 px-2 py-[5px]",
|
|
34177
|
+
disabled: state == "busy" || state == "publishing",
|
|
34178
|
+
onClick: exportAction.onClick
|
|
34179
|
+
}),
|
|
34180
|
+
onExportPng != null && /* @__PURE__ */ jsxs(DropdownMenuSub, { children: [/* @__PURE__ */ jsxs(DropdownMenuSubTrigger, {
|
|
34181
|
+
className: "gap-2 px-2 py-[5px]",
|
|
34182
|
+
disabled: exporting,
|
|
34183
|
+
children: [/* @__PURE__ */ jsx("i", {
|
|
34184
|
+
"aria-hidden": "true",
|
|
34185
|
+
className: "i-lucide-light:download size-4 shrink-0"
|
|
34186
|
+
}), t("resource.exportPng")]
|
|
34187
|
+
}), /* @__PURE__ */ jsxs(DropdownMenuSubContent, {
|
|
34188
|
+
className: "min-w-32",
|
|
34189
|
+
container: popupContainer,
|
|
34190
|
+
children: [
|
|
34191
|
+
/* @__PURE__ */ jsx(DropdownMenuCheckboxItem, {
|
|
34192
|
+
checked: showFrame,
|
|
34193
|
+
className: "py-[5px] pl-2",
|
|
34194
|
+
closeOnClick: false,
|
|
34195
|
+
onCheckedChange: (checked) => {
|
|
34196
|
+
setShowFrame(checked);
|
|
34197
|
+
writePngExportFrame(preferences, checked);
|
|
34198
|
+
},
|
|
34199
|
+
children: t("resource.exportPngFrame")
|
|
34200
|
+
}),
|
|
34201
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, { className: "mx-2 bg-border/50" }),
|
|
34202
|
+
[false, true].map((dark) => /* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
34203
|
+
className: "px-2 py-[5px]",
|
|
34204
|
+
onClick: async () => {
|
|
34205
|
+
setExporting(true);
|
|
34206
|
+
try {
|
|
34207
|
+
await onExportPng({
|
|
34208
|
+
dark,
|
|
34209
|
+
frame: showFrame
|
|
34210
|
+
});
|
|
34211
|
+
} finally {
|
|
34212
|
+
setExporting(false);
|
|
34213
|
+
}
|
|
34214
|
+
},
|
|
34215
|
+
children: t(dark ? "resource.exportPngDark" : "resource.exportPngLight")
|
|
34216
|
+
}, String(dark)))
|
|
34217
|
+
]
|
|
34218
|
+
})] }),
|
|
34219
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
34220
|
+
className: "gap-2 px-2 py-[5px]",
|
|
34221
|
+
disabled: hasPublications !== true,
|
|
34222
|
+
onClick: onOpenPublications,
|
|
34223
|
+
children: [/* @__PURE__ */ jsx("i", {
|
|
34224
|
+
"aria-hidden": "true",
|
|
34225
|
+
className: "i-lucide-light:cloud-upload size-4 shrink-0 text-foreground/70"
|
|
34226
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
34227
|
+
className: "whitespace-nowrap",
|
|
34228
|
+
children: historyLabel
|
|
34229
|
+
})]
|
|
34230
|
+
}),
|
|
34231
|
+
onOpenState != null && /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
34232
|
+
className: "gap-2 px-2 py-[5px]",
|
|
34233
|
+
onClick: onOpenState,
|
|
34234
|
+
children: [/* @__PURE__ */ jsx("i", {
|
|
34235
|
+
"aria-hidden": "true",
|
|
34236
|
+
className: "i-lucide-light:database size-4 shrink-0 text-foreground/70"
|
|
34237
|
+
}), t("flowState.title")]
|
|
34238
|
+
}),
|
|
34239
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
34240
|
+
className: "gap-2 px-2 py-[5px]",
|
|
34241
|
+
onClick: onOpenRuns,
|
|
34242
|
+
children: [/* @__PURE__ */ jsx("i", {
|
|
34243
|
+
"aria-hidden": "true",
|
|
34244
|
+
className: "i-lucide-light:history size-4 shrink-0 text-foreground/70"
|
|
34245
|
+
}), runsLabel]
|
|
34246
|
+
})
|
|
34247
|
+
]
|
|
34248
|
+
})]
|
|
34249
|
+
}),
|
|
36388
34250
|
/* @__PURE__ */ jsx(Dialog, {
|
|
36389
34251
|
open: exporting,
|
|
36390
34252
|
onOpenChange: (_open, details) => details.cancel(),
|
|
@@ -36614,7 +34476,7 @@ function FlowEditor({ navigationIsland, onRun, onRunStarted, onCloseRuns, onConf
|
|
|
36614
34476
|
const connections = useVal(store.connectors.$.pickerConnections);
|
|
36615
34477
|
const triggerCatalogState = useVal(store.triggers.catalog.state);
|
|
36616
34478
|
const [startId, setStartId] = useState();
|
|
36617
|
-
const [
|
|
34479
|
+
const [stateOpen, setStateOpen] = useState(false);
|
|
36618
34480
|
const runInputRequest = useVal(store.runRequests.$.inputRequest);
|
|
36619
34481
|
useVal(store.runRequests.$.inputsLoaded);
|
|
36620
34482
|
const busy = useVal(store.$.busy);
|
|
@@ -36757,269 +34619,259 @@ function FlowEditor({ navigationIsland, onRun, onRunStarted, onCloseRuns, onConf
|
|
|
36757
34619
|
onRedo: () => void store.workspace.redo(),
|
|
36758
34620
|
onRetry: () => void store.workspace.retryHistorySync()
|
|
36759
34621
|
};
|
|
36760
|
-
return /* @__PURE__ */
|
|
36761
|
-
|
|
36762
|
-
|
|
36763
|
-
|
|
36764
|
-
|
|
36765
|
-
|
|
36766
|
-
|
|
36767
|
-
|
|
36768
|
-
|
|
36769
|
-
|
|
36770
|
-
|
|
36771
|
-
|
|
36772
|
-
|
|
36773
|
-
|
|
36774
|
-
|
|
36775
|
-
|
|
36776
|
-
|
|
36777
|
-
|
|
36778
|
-
|
|
36779
|
-
|
|
36780
|
-
|
|
36781
|
-
|
|
36782
|
-
|
|
36783
|
-
|
|
36784
|
-
|
|
36785
|
-
|
|
36786
|
-
|
|
36787
|
-
|
|
36788
|
-
|
|
36789
|
-
|
|
36790
|
-
onManage: onManageConnectorAccess,
|
|
36791
|
-
onSelectReference: setAccountReference,
|
|
36792
|
-
store
|
|
36793
|
-
}, flowId),
|
|
36794
|
-
topLeftTools: navigationIsland,
|
|
36795
|
-
bottomRightTools: /* @__PURE__ */ jsx(RunStatusIslandContainer, {
|
|
36796
|
-
onToggle: onToggleRuns,
|
|
36797
|
-
open: runDrawerOpen,
|
|
36798
|
-
panelId: RUN_LOG_PANEL_ID,
|
|
36799
|
-
store
|
|
36800
|
-
}),
|
|
36801
|
-
cornerLeading: /* @__PURE__ */ jsxs("div", {
|
|
36802
|
-
className: "workspace-corner-leading",
|
|
36803
|
-
children: [diagnostics?.valid == false && diagnosticItems.length > 0 && /* @__PURE__ */ jsx(WorkspaceDiagnosticsIsland, {
|
|
36804
|
-
checking: checkLoading,
|
|
36805
|
-
items: diagnosticItems,
|
|
36806
|
-
nodes: designerNodes,
|
|
36807
|
-
onOpenChange: (open) => {
|
|
36808
|
-
if (open) store.runRequests.dismissInputs();
|
|
36809
|
-
setDiagnosticsOpen(open);
|
|
36810
|
-
},
|
|
36811
|
-
onRefresh: () => void store.workspace.check(),
|
|
36812
|
-
onSelect: (item) => {
|
|
36813
|
-
if (store.workspace.locateDiagnostic(item)) setDiagnosticsOpen(false);
|
|
36814
|
-
},
|
|
36815
|
-
onSelectNode: (nodeId) => {
|
|
36816
|
-
if (store.workspace.locateNode(nodeId)) {
|
|
36817
|
-
openInspector();
|
|
36818
|
-
setDiagnosticsOpen(false);
|
|
36819
|
-
}
|
|
36820
|
-
},
|
|
36821
|
-
open: diagnosticsOpen
|
|
36822
|
-
}), /* @__PURE__ */ jsx(WorkspacePublishIsland, {
|
|
36823
|
-
onExportPng: connectorAccess.access?.mode != "selectable" || designer.nodes.length == 0 ? void 0 : (options) => store.exportPng(language, {
|
|
36824
|
-
...options,
|
|
36825
|
-
ignoredNodeIds
|
|
36826
|
-
}),
|
|
36827
|
-
preferences: store.preferences,
|
|
36828
|
-
onExport: () => {
|
|
36829
|
-
const id = store.workspace.$.flowId.value;
|
|
36830
|
-
if (id != null) store.workspace.exportFlow(id);
|
|
36831
|
-
},
|
|
36832
|
-
hasPublications: live == null ? void 0 : live.publication != null,
|
|
36833
|
-
onOpenPublications,
|
|
36834
|
-
onOpenRuns,
|
|
36835
|
-
onOpenState: flowId == null ? void 0 : () => setStateTarget({}),
|
|
36836
|
-
onPublish: () => void store.publications.publish(),
|
|
36837
|
-
state: publishState
|
|
36838
|
-
})]
|
|
36839
|
-
}),
|
|
36840
|
-
history: historyControls,
|
|
36841
|
-
ignoredNodeIds,
|
|
36842
|
-
onIgnoreNodes,
|
|
36843
|
-
runControl: draft != null && selectedTrigger != null ? /* @__PURE__ */ jsx(RunControl, {
|
|
36844
|
-
disabled: busy != null && busy != "run" && busy != "designer",
|
|
36845
|
-
inputContent: /* @__PURE__ */ jsx(RunInputPanel, {
|
|
36846
|
-
onStarted: onRunStarted,
|
|
36847
|
-
store: store.runRequests,
|
|
36848
|
-
theme
|
|
36849
|
-
}),
|
|
36850
|
-
inputOpen: runInputRequest?.triggerId == selectedTrigger.id,
|
|
36851
|
-
inputStatus: store.runRequests.inputStatus(draft.flowId, draft, selectedTrigger.id),
|
|
36852
|
-
onInputOpenChange: (open) => {
|
|
36853
|
-
if (open) store.editDraftRunInputs(selectedTrigger.id);
|
|
36854
|
-
else store.runRequests.dismissInputs();
|
|
36855
|
-
},
|
|
36856
|
-
onRun: () => onRun(selectedTrigger.id),
|
|
36857
|
-
onSelectTrigger: (triggerId) => {
|
|
36858
|
-
store.runRequests.dismissInputs();
|
|
36859
|
-
setStartId(triggerId);
|
|
36860
|
-
},
|
|
36861
|
-
selectedTriggerId: selectedTrigger.id,
|
|
36862
|
-
starting: busy == "run",
|
|
36863
|
-
triggers
|
|
36864
|
-
}) : void 0,
|
|
36865
|
-
addNodeControl: /* @__PURE__ */ jsx(NodePickerPopover, {
|
|
36866
|
-
options: addNodeOptions,
|
|
36867
|
-
connections,
|
|
36868
|
-
loadConnections: store.connectors.loadConnections,
|
|
36869
|
-
browseOptions: store.browseAddNodeOptions,
|
|
36870
|
-
searchOptions: store.provideAddNodeOptions,
|
|
36871
|
-
provideChoices: store.provideAddNodeOptionChoices,
|
|
36872
|
-
catalogFailed: triggerCatalogState.error != null,
|
|
36873
|
-
refreshCatalog: store.retryCatalog,
|
|
36874
|
-
initialTab: initialAddNodeTab,
|
|
36875
|
-
disabled: authoringDisabled,
|
|
36876
|
-
focusRequest: 0,
|
|
36877
|
-
onAdd: addFromPicker,
|
|
36878
|
-
onRegisterDragOption: (option) => designerRef.current?.registerDraggedNode(option),
|
|
36879
|
-
onDragEnd: () => designerRef.current?.clearDraggedNode()
|
|
36880
|
-
}, flowId ?? ""),
|
|
36881
|
-
nodePicker: {
|
|
36882
|
-
connections,
|
|
36883
|
-
loadConnections: store.connectors.loadConnections,
|
|
36884
|
-
browseOptions: store.browseAddNodeOptions,
|
|
36885
|
-
provideChoices: store.provideAddNodeOptionChoices,
|
|
36886
|
-
catalogFailed: triggerCatalogState.error != null,
|
|
36887
|
-
refreshCatalog: store.retryCatalog,
|
|
36888
|
-
initialTab: initialAddNodeTab
|
|
36889
|
-
},
|
|
36890
|
-
addNodeOptions,
|
|
36891
|
-
disabled: authoringDisabled,
|
|
36892
|
-
subscribeCanvasCommands: store.workspace.subscribeCanvasCommands,
|
|
36893
|
-
focusNodeRequest: diagnosticFocus ?? nodeFocus,
|
|
36894
|
-
inspectorOpen: contextPanelVisible,
|
|
36895
|
-
model: designer,
|
|
36896
|
-
annotationContext: canvasAnnotations(flowId, draft, workspaceStatus, moduleEditor?.status, history.failed),
|
|
36897
|
-
onAddNode: async (option, position, connection) => {
|
|
36898
|
-
const nodeId = await store.addNode(option, position, connection);
|
|
36899
|
-
if (nodeId != null && flowId != null && store.workspace.$.flowId.value == flowId) {
|
|
36900
|
-
setAddedNode({
|
|
36901
|
-
flowId,
|
|
36902
|
-
nodeId
|
|
36903
|
-
});
|
|
36904
|
-
if (panel.open) panel.activate([nodeId]);
|
|
36905
|
-
}
|
|
36906
|
-
return nodeId;
|
|
36907
|
-
},
|
|
36908
|
-
onConnect: (edge) => void store.workspace.connect(edge),
|
|
36909
|
-
onChangeNodeContentHidden: (nodeId, hidden) => void store.workspace.saveNodeContentHidden(nodeId, hidden),
|
|
36910
|
-
onChangeNodeWidth: (nodeId, width, position) => store.workspace.saveNodeWidth(nodeId, width, position),
|
|
36911
|
-
onChangeComment: (nodeId, value) => void store.workspace.saveComment(nodeId, value),
|
|
36912
|
-
onCopy: () => store.workspace.copySelectedNodes(),
|
|
36913
|
-
onDeleteEdge: (edge) => void store.workspace.disconnect(edge),
|
|
36914
|
-
onDeleteNodes: () => void store.workspace.deleteSelectedNodes(),
|
|
36915
|
-
onDuplicate: (positions, offset) => void store.workspace.duplicateSelectedNodes(positions, offset),
|
|
36916
|
-
onMoveNodes: (positions) => void store.workspace.moveNodes(positions),
|
|
36917
|
-
onChangeDirection: (direction, positions) => store.changeDirection(direction, positions),
|
|
36918
|
-
onMoveViewport: (viewport) => void store.workspace.moveViewport(viewport),
|
|
36919
|
-
onPaste: () => void store.workspace.pasteNodes(),
|
|
36920
|
-
provideAddNodeOptions: store.provideAddNodeOptions,
|
|
36921
|
-
onSelectNodes: panel.select,
|
|
36922
|
-
onActivateSelection: panel.activate,
|
|
36923
|
-
onSelectionStart: panel.startSelection,
|
|
36924
|
-
onSelectionEnd: panel.endSelection,
|
|
36925
|
-
onToggleInspector: toggleInspector,
|
|
36926
|
-
ref: designerRef,
|
|
36927
|
-
selectedNodeIds: panel.canvasSelection,
|
|
36928
|
-
theme
|
|
34622
|
+
return /* @__PURE__ */ jsxs(CanvasHistoryScope, {
|
|
34623
|
+
history: historyControls,
|
|
34624
|
+
disabled: authoringDisabled,
|
|
34625
|
+
"aria-label": t("workspace.design"),
|
|
34626
|
+
className: `editor-grid ${contextPanelVisible ? "" : "context-panel-closed"}`,
|
|
34627
|
+
id: "workspace-panel-design",
|
|
34628
|
+
role: "region",
|
|
34629
|
+
tabIndex: 0,
|
|
34630
|
+
children: [
|
|
34631
|
+
flowId != null && stateOpen && /* @__PURE__ */ jsx(FlowStateButton, {
|
|
34632
|
+
client: store.state,
|
|
34633
|
+
flowId,
|
|
34634
|
+
nodes: designer.nodes,
|
|
34635
|
+
notify: store.workspace.notify,
|
|
34636
|
+
onClose: () => setStateOpen(false)
|
|
34637
|
+
}, flowId),
|
|
34638
|
+
/* @__PURE__ */ jsx(WorkbenchCanvas, {
|
|
34639
|
+
interactiveMode$: store.interactiveMode$,
|
|
34640
|
+
connectionControl: /* @__PURE__ */ jsx(ConnectionUsageButton, {
|
|
34641
|
+
connectionHref,
|
|
34642
|
+
onManage: onManageConnectorAccess,
|
|
34643
|
+
onSelectReference: setAccountReference,
|
|
34644
|
+
store
|
|
34645
|
+
}, flowId),
|
|
34646
|
+
topLeftTools: navigationIsland,
|
|
34647
|
+
bottomRightTools: /* @__PURE__ */ jsx(RunStatusIslandContainer, {
|
|
34648
|
+
onToggle: onToggleRuns,
|
|
34649
|
+
open: runDrawerOpen,
|
|
34650
|
+
panelId: RUN_LOG_PANEL_ID,
|
|
34651
|
+
store
|
|
36929
34652
|
}),
|
|
36930
|
-
|
|
36931
|
-
|
|
36932
|
-
|
|
36933
|
-
|
|
36934
|
-
|
|
36935
|
-
|
|
36936
|
-
|
|
36937
|
-
|
|
36938
|
-
|
|
36939
|
-
title: selection.node.name ?? selectedDesignerNode?.title ?? "",
|
|
36940
|
-
icon: selectedDesignerNode != null && "icon" in selectedDesignerNode ? selectedDesignerNode.icon : void 0,
|
|
36941
|
-
disabled: authoringDisabled,
|
|
36942
|
-
fallback: /* @__PURE__ */ jsx(Icon, { name: inspectorIcon(selection) }),
|
|
36943
|
-
onRename: (name) => {
|
|
36944
|
-
store.workspace.nodes.saveNodeTitle(selection.id, name);
|
|
34653
|
+
cornerLeading: /* @__PURE__ */ jsxs("div", {
|
|
34654
|
+
className: "workspace-corner-leading",
|
|
34655
|
+
children: [diagnostics?.valid == false && diagnosticItems.length > 0 && /* @__PURE__ */ jsx(WorkspaceDiagnosticsIsland, {
|
|
34656
|
+
checking: checkLoading,
|
|
34657
|
+
items: diagnosticItems,
|
|
34658
|
+
nodes: designerNodes,
|
|
34659
|
+
onOpenChange: (open) => {
|
|
34660
|
+
if (open) store.runRequests.dismissInputs();
|
|
34661
|
+
setDiagnosticsOpen(open);
|
|
36945
34662
|
},
|
|
36946
|
-
|
|
36947
|
-
|
|
34663
|
+
onRefresh: () => void store.workspace.check(),
|
|
34664
|
+
onSelect: (item) => {
|
|
34665
|
+
if (store.workspace.locateDiagnostic(item)) setDiagnosticsOpen(false);
|
|
36948
34666
|
},
|
|
36949
|
-
|
|
36950
|
-
if (
|
|
36951
|
-
|
|
36952
|
-
|
|
36953
|
-
|
|
36954
|
-
|
|
36955
|
-
|
|
36956
|
-
}
|
|
36957
|
-
|
|
36958
|
-
|
|
36959
|
-
|
|
36960
|
-
"aria-hidden": "true",
|
|
36961
|
-
className: "i-codicon:note"
|
|
34667
|
+
onSelectNode: (nodeId) => {
|
|
34668
|
+
if (store.workspace.locateNode(nodeId)) {
|
|
34669
|
+
openInspector();
|
|
34670
|
+
setDiagnosticsOpen(false);
|
|
34671
|
+
}
|
|
34672
|
+
},
|
|
34673
|
+
open: diagnosticsOpen
|
|
34674
|
+
}), /* @__PURE__ */ jsx(WorkspacePublishIsland, {
|
|
34675
|
+
onExportPng: connectorAccess.access?.mode != "selectable" || designer.nodes.length == 0 ? void 0 : (options) => store.exportPng(language, {
|
|
34676
|
+
...options,
|
|
34677
|
+
ignoredNodeIds
|
|
36962
34678
|
}),
|
|
36963
|
-
|
|
36964
|
-
|
|
36965
|
-
store.workspace.
|
|
36966
|
-
|
|
36967
|
-
content: selectedDesignerNode.content ?? ""
|
|
36968
|
-
});
|
|
36969
|
-
}
|
|
36970
|
-
} : void 0,
|
|
36971
|
-
focusOnOpen: focusInspectorOnOpen.current,
|
|
36972
|
-
icon: contextPanelIcon,
|
|
36973
|
-
onClose: () => closeContextPanel(opener.current),
|
|
36974
|
-
theme,
|
|
36975
|
-
title: contextPanelTitle,
|
|
36976
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
36977
|
-
hidden: !flowSelected,
|
|
36978
|
-
className: flowSelected ? "flex h-full min-h-0 flex-col" : "hidden",
|
|
36979
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
36980
|
-
className: "min-h-0 flex-1",
|
|
36981
|
-
children: /* @__PURE__ */ jsx(FlowNodeList, {
|
|
36982
|
-
groupTriggers: true,
|
|
36983
|
-
nodes: designer.nodes,
|
|
36984
|
-
onFocusNode: focusNode,
|
|
36985
|
-
onSelect: selectOutlineNode
|
|
36986
|
-
}, flowId ?? "")
|
|
36987
|
-
})
|
|
36988
|
-
}), multipleSelected ? /* @__PURE__ */ jsx(FlowNodeList, {
|
|
36989
|
-
nodes: designer.nodes.filter((node) => selectedNodeIds.includes(node.id)),
|
|
36990
|
-
onSelect: selectOutlineNode,
|
|
36991
|
-
onFocusNode: focusNode
|
|
36992
|
-
}) : flowSelected ? null : selectedDesignerNode?.kind == "comment" ? /* @__PURE__ */ jsx(CommentInspector, {
|
|
36993
|
-
title: selectedDesignerNode.title,
|
|
36994
|
-
content: selectedDesignerNode.content ?? "",
|
|
36995
|
-
disabled: authoringDisabled,
|
|
36996
|
-
dark: theme == "dark",
|
|
36997
|
-
onSave: (comment) => void store.workspace.saveComment(selectedDesignerNode.id, comment)
|
|
36998
|
-
}, selectedDesignerNode.id) : revision != null && /* @__PURE__ */ jsx(NodeInspectorContainer, {
|
|
36999
|
-
onAddWorkflowOutputs: () => {
|
|
37000
|
-
const option = store.workspace.$.addNodeOptions.value.find((item) => item.kind === "outputs");
|
|
37001
|
-
if (option != null) addFromPicker(option);
|
|
34679
|
+
preferences: store.preferences,
|
|
34680
|
+
onExport: () => {
|
|
34681
|
+
const id = store.workspace.$.flowId.value;
|
|
34682
|
+
if (id != null) store.workspace.exportFlow(id);
|
|
37002
34683
|
},
|
|
37003
|
-
|
|
37004
|
-
|
|
37005
|
-
|
|
37006
|
-
|
|
37007
|
-
|
|
37008
|
-
|
|
34684
|
+
hasPublications: live == null ? void 0 : live.publication != null,
|
|
34685
|
+
onOpenPublications,
|
|
34686
|
+
onOpenRuns,
|
|
34687
|
+
onOpenState: flowId == null ? void 0 : () => setStateOpen(true),
|
|
34688
|
+
onPublish: () => void store.publications.publish(),
|
|
34689
|
+
state: publishState
|
|
37009
34690
|
})]
|
|
37010
34691
|
}),
|
|
37011
|
-
|
|
37012
|
-
|
|
37013
|
-
|
|
37014
|
-
|
|
37015
|
-
|
|
37016
|
-
|
|
37017
|
-
|
|
37018
|
-
|
|
37019
|
-
|
|
34692
|
+
history: historyControls,
|
|
34693
|
+
ignoredNodeIds,
|
|
34694
|
+
onIgnoreNodes,
|
|
34695
|
+
runControl: draft != null && selectedTrigger != null ? /* @__PURE__ */ jsx(RunControl, {
|
|
34696
|
+
disabled: busy != null && busy != "run" && busy != "designer",
|
|
34697
|
+
inputContent: /* @__PURE__ */ jsx(RunInputPanel, {
|
|
34698
|
+
onStarted: onRunStarted,
|
|
34699
|
+
store: store.runRequests,
|
|
34700
|
+
theme
|
|
34701
|
+
}),
|
|
34702
|
+
inputOpen: runInputRequest?.triggerId == selectedTrigger.id,
|
|
34703
|
+
inputStatus: store.runRequests.inputStatus(draft.flowId, draft, selectedTrigger.id),
|
|
34704
|
+
onInputOpenChange: (open) => {
|
|
34705
|
+
if (open) store.editDraftRunInputs(selectedTrigger.id);
|
|
34706
|
+
else store.runRequests.dismissInputs();
|
|
34707
|
+
},
|
|
34708
|
+
onRun: () => onRun(selectedTrigger.id),
|
|
34709
|
+
onSelectTrigger: (triggerId) => {
|
|
34710
|
+
store.runRequests.dismissInputs();
|
|
34711
|
+
setStartId(triggerId);
|
|
34712
|
+
},
|
|
34713
|
+
selectedTriggerId: selectedTrigger.id,
|
|
34714
|
+
starting: busy == "run",
|
|
34715
|
+
triggers
|
|
34716
|
+
}) : void 0,
|
|
34717
|
+
addNodeControl: /* @__PURE__ */ jsx(NodePickerPopover, {
|
|
34718
|
+
options: addNodeOptions,
|
|
34719
|
+
connections,
|
|
34720
|
+
loadConnections: store.connectors.loadConnections,
|
|
34721
|
+
browseOptions: store.browseAddNodeOptions,
|
|
34722
|
+
searchOptions: store.provideAddNodeOptions,
|
|
34723
|
+
provideChoices: store.provideAddNodeOptionChoices,
|
|
34724
|
+
catalogFailed: triggerCatalogState.error != null,
|
|
34725
|
+
refreshCatalog: store.retryCatalog,
|
|
34726
|
+
initialTab: initialAddNodeTab,
|
|
34727
|
+
disabled: authoringDisabled,
|
|
34728
|
+
focusRequest: 0,
|
|
34729
|
+
onAdd: addFromPicker,
|
|
34730
|
+
onRegisterDragOption: (option) => designerRef.current?.registerDraggedNode(option),
|
|
34731
|
+
onDragEnd: () => designerRef.current?.clearDraggedNode()
|
|
34732
|
+
}, flowId ?? ""),
|
|
34733
|
+
nodePicker: {
|
|
34734
|
+
connections,
|
|
34735
|
+
loadConnections: store.connectors.loadConnections,
|
|
34736
|
+
browseOptions: store.browseAddNodeOptions,
|
|
34737
|
+
provideChoices: store.provideAddNodeOptionChoices,
|
|
34738
|
+
catalogFailed: triggerCatalogState.error != null,
|
|
34739
|
+
refreshCatalog: store.retryCatalog,
|
|
34740
|
+
initialTab: initialAddNodeTab
|
|
34741
|
+
},
|
|
34742
|
+
addNodeOptions,
|
|
34743
|
+
disabled: authoringDisabled,
|
|
34744
|
+
subscribeCanvasCommands: store.workspace.subscribeCanvasCommands,
|
|
34745
|
+
focusNodeRequest: diagnosticFocus ?? nodeFocus,
|
|
34746
|
+
inspectorOpen: contextPanelVisible,
|
|
34747
|
+
model: designer,
|
|
34748
|
+
annotationContext: canvasAnnotations(flowId, draft, workspaceStatus, moduleEditor?.status, history.failed),
|
|
34749
|
+
onAddNode: async (option, position, connection) => {
|
|
34750
|
+
const nodeId = await store.addNode(option, position, connection);
|
|
34751
|
+
if (nodeId != null && flowId != null && store.workspace.$.flowId.value == flowId) {
|
|
34752
|
+
setAddedNode({
|
|
34753
|
+
flowId,
|
|
34754
|
+
nodeId
|
|
34755
|
+
});
|
|
34756
|
+
if (panel.open) panel.activate([nodeId]);
|
|
34757
|
+
}
|
|
34758
|
+
return nodeId;
|
|
34759
|
+
},
|
|
34760
|
+
onConnect: (edge) => void store.workspace.connect(edge),
|
|
34761
|
+
onChangeNodeContentHidden: (nodeId, hidden) => void store.workspace.saveNodeContentHidden(nodeId, hidden),
|
|
34762
|
+
onChangeNodeWidth: (nodeId, width, position) => store.workspace.saveNodeWidth(nodeId, width, position),
|
|
34763
|
+
onChangeComment: (nodeId, value) => void store.workspace.saveComment(nodeId, value),
|
|
34764
|
+
onCopy: () => store.workspace.copySelectedNodes(),
|
|
34765
|
+
onDeleteEdge: (edge) => void store.workspace.disconnect(edge),
|
|
34766
|
+
onDeleteNodes: () => void store.workspace.deleteSelectedNodes(),
|
|
34767
|
+
onDuplicate: (positions, offset) => void store.workspace.duplicateSelectedNodes(positions, offset),
|
|
34768
|
+
onMoveNodes: (positions) => void store.workspace.moveNodes(positions),
|
|
34769
|
+
onChangeDirection: (direction, positions) => store.changeDirection(direction, positions),
|
|
34770
|
+
onMoveViewport: (viewport) => void store.workspace.moveViewport(viewport),
|
|
34771
|
+
onPaste: () => void store.workspace.pasteNodes(),
|
|
34772
|
+
provideAddNodeOptions: store.provideAddNodeOptions,
|
|
34773
|
+
onSelectNodes: panel.select,
|
|
34774
|
+
onActivateSelection: panel.activate,
|
|
34775
|
+
onSelectionStart: panel.startSelection,
|
|
34776
|
+
onSelectionEnd: panel.endSelection,
|
|
34777
|
+
onToggleInspector: toggleInspector,
|
|
34778
|
+
ref: designerRef,
|
|
34779
|
+
selectedNodeIds: panel.canvasSelection,
|
|
34780
|
+
theme
|
|
34781
|
+
}),
|
|
34782
|
+
contextPanelVisible && /* @__PURE__ */ jsxs(EditorContextPanel, {
|
|
34783
|
+
resizable: true,
|
|
34784
|
+
onBack: !flowSelected ? () => {
|
|
34785
|
+
panel.back();
|
|
34786
|
+
designerRef.current?.focusCanvas();
|
|
34787
|
+
} : void 0,
|
|
34788
|
+
nodeId: singleSelected ? selectedDesignerNode?.id : void 0,
|
|
34789
|
+
nodeHeading: singleSelected && selection != null ? {
|
|
34790
|
+
titleReadOnly: selection.kind === "trigger" && (selection.trigger.kind === "manual" || selection.trigger.kind === "start"),
|
|
34791
|
+
title: selection.node.name ?? selectedDesignerNode?.title ?? "",
|
|
34792
|
+
icon: selectedDesignerNode != null && "icon" in selectedDesignerNode ? selectedDesignerNode.icon : void 0,
|
|
34793
|
+
disabled: authoringDisabled,
|
|
34794
|
+
fallback: /* @__PURE__ */ jsx(Icon, { name: inspectorIcon(selection) }),
|
|
34795
|
+
onRename: (name) => {
|
|
34796
|
+
store.workspace.nodes.saveNodeTitle(selection.id, name);
|
|
34797
|
+
},
|
|
34798
|
+
onIconChange: (icon) => {
|
|
34799
|
+
store.workspace.nodes.saveNodeIcon(selection.id, icon);
|
|
34800
|
+
},
|
|
34801
|
+
validate: (name) => {
|
|
34802
|
+
if (revision == null) return;
|
|
34803
|
+
const graph = revision.graph();
|
|
34804
|
+
if (graph == null) return;
|
|
34805
|
+
const issue = nodeNameIssue(graph, selection.id, name);
|
|
34806
|
+
return issue == null ? void 0 : t(`inspector.node.${issue === "empty" ? "nameEmpty" : "nameDuplicate"}`);
|
|
34807
|
+
}
|
|
34808
|
+
} : singleSelected && selectedDesignerNode?.kind === "comment" ? {
|
|
34809
|
+
title: selectedDesignerNode.title,
|
|
34810
|
+
disabled: authoringDisabled,
|
|
34811
|
+
fallback: /* @__PURE__ */ jsx("i", {
|
|
34812
|
+
"aria-hidden": "true",
|
|
34813
|
+
className: "i-codicon:note"
|
|
34814
|
+
}),
|
|
34815
|
+
validate: () => void 0,
|
|
34816
|
+
onRename: (title) => {
|
|
34817
|
+
store.workspace.saveComment(selectedDesignerNode.id, {
|
|
34818
|
+
title,
|
|
34819
|
+
content: selectedDesignerNode.content ?? ""
|
|
34820
|
+
});
|
|
34821
|
+
}
|
|
34822
|
+
} : void 0,
|
|
34823
|
+
focusOnOpen: focusInspectorOnOpen.current,
|
|
34824
|
+
icon: contextPanelIcon,
|
|
34825
|
+
onClose: () => closeContextPanel(opener.current),
|
|
34826
|
+
theme,
|
|
34827
|
+
title: contextPanelTitle,
|
|
34828
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
34829
|
+
hidden: !flowSelected,
|
|
34830
|
+
className: flowSelected ? "flex h-full min-h-0 flex-col" : "hidden",
|
|
34831
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
34832
|
+
className: "min-h-0 flex-1",
|
|
34833
|
+
children: /* @__PURE__ */ jsx(FlowNodeList, {
|
|
34834
|
+
groupTriggers: true,
|
|
34835
|
+
nodes: designer.nodes,
|
|
34836
|
+
onFocusNode: focusNode,
|
|
34837
|
+
onSelect: selectOutlineNode
|
|
34838
|
+
}, flowId ?? "")
|
|
34839
|
+
})
|
|
34840
|
+
}), multipleSelected ? /* @__PURE__ */ jsx(FlowNodeList, {
|
|
34841
|
+
nodes: designer.nodes.filter((node) => selectedNodeIds.includes(node.id)),
|
|
34842
|
+
onSelect: selectOutlineNode,
|
|
34843
|
+
onFocusNode: focusNode
|
|
34844
|
+
}) : flowSelected ? null : selectedDesignerNode?.kind == "comment" ? /* @__PURE__ */ jsx(CommentInspector, {
|
|
34845
|
+
title: selectedDesignerNode.title,
|
|
34846
|
+
content: selectedDesignerNode.content ?? "",
|
|
34847
|
+
disabled: authoringDisabled,
|
|
34848
|
+
dark: theme == "dark",
|
|
34849
|
+
onSave: (comment) => void store.workspace.saveComment(selectedDesignerNode.id, comment)
|
|
34850
|
+
}, selectedDesignerNode.id) : revision != null && /* @__PURE__ */ jsx(NodeInspectorContainer, {
|
|
34851
|
+
onAddWorkflowOutputs: () => {
|
|
34852
|
+
const option = store.workspace.$.addNodeOptions.value.find((item) => item.kind === "outputs");
|
|
34853
|
+
if (option != null) addFromPicker(option);
|
|
34854
|
+
},
|
|
34855
|
+
store,
|
|
34856
|
+
focus: diagnosticFocus,
|
|
34857
|
+
disabled: authoringDisabled,
|
|
34858
|
+
revision,
|
|
34859
|
+
selection,
|
|
34860
|
+
theme
|
|
34861
|
+
})]
|
|
34862
|
+
}),
|
|
34863
|
+
/* @__PURE__ */ jsx(RunDrawerContainer, {
|
|
34864
|
+
onOpenRuns,
|
|
34865
|
+
onClose: onCloseRuns,
|
|
34866
|
+
onConfigureConnector,
|
|
34867
|
+
open: runDrawerOpen,
|
|
34868
|
+
store
|
|
34869
|
+
})
|
|
34870
|
+
]
|
|
37020
34871
|
});
|
|
37021
34872
|
}
|
|
37022
34873
|
function FlowWorkspace({ hrefFor, navigation, onConfigureConnector, onManageConnectorAccess, connectionHref, store, theme }) {
|
|
34874
|
+
const [transferContainer, setTransferContainer] = useState(null);
|
|
37023
34875
|
const t = useTranslate();
|
|
37024
34876
|
const [runDrawerOpen, setRunDrawerOpen] = useState(() => readRunDrawerOpen(store.preferences) ?? false);
|
|
37025
34877
|
const runDrawerPreference = useRef(readRunDrawerOpen(store.preferences));
|
|
@@ -37102,6 +34954,8 @@ function FlowWorkspace({ hrefFor, navigation, onConfigureConnector, onManageConn
|
|
|
37102
34954
|
onSelectFlow: (target) => void navigation.selectFlow(target)
|
|
37103
34955
|
}, flow.flowId),
|
|
37104
34956
|
flowName: flow?.name ?? flow?.flowId ?? "",
|
|
34957
|
+
flowIcon: flow?.icon,
|
|
34958
|
+
flowDescription: flow?.description,
|
|
37105
34959
|
flowsHref: hrefFor({ view: "design" }),
|
|
37106
34960
|
onOpenFlows: () => void navigation.openFlows()
|
|
37107
34961
|
});
|
|
@@ -37109,64 +34963,72 @@ function FlowWorkspace({ hrefFor, navigation, onConfigureConnector, onManageConn
|
|
|
37109
34963
|
value: hrefFor,
|
|
37110
34964
|
children: /* @__PURE__ */ jsxs("main", {
|
|
37111
34965
|
className: "workspace",
|
|
37112
|
-
|
|
37113
|
-
|
|
37114
|
-
|
|
37115
|
-
|
|
37116
|
-
|
|
37117
|
-
|
|
37118
|
-
|
|
37119
|
-
|
|
37120
|
-
|
|
37121
|
-
|
|
37122
|
-
|
|
37123
|
-
|
|
37124
|
-
|
|
37125
|
-
|
|
37126
|
-
|
|
37127
|
-
|
|
37128
|
-
|
|
37129
|
-
|
|
37130
|
-
|
|
37131
|
-
|
|
37132
|
-
|
|
34966
|
+
ref: setTransferContainer,
|
|
34967
|
+
children: [
|
|
34968
|
+
/* @__PURE__ */ jsx(WorkflowExportDialog, {
|
|
34969
|
+
workspace: store.workspace,
|
|
34970
|
+
container: transferContainer
|
|
34971
|
+
}),
|
|
34972
|
+
view == "design" && !canvasReady && /* @__PURE__ */ jsx("div", {
|
|
34973
|
+
className: "workspace-navigation-placement",
|
|
34974
|
+
children: navigationIsland
|
|
34975
|
+
}),
|
|
34976
|
+
view == "design" && !canvasReady ? /* @__PURE__ */ jsx("div", {
|
|
34977
|
+
"aria-label": t("workspace.design"),
|
|
34978
|
+
className: "editor-grid context-panel-closed",
|
|
34979
|
+
id: "workspace-panel-design",
|
|
34980
|
+
role: "region",
|
|
34981
|
+
tabIndex: 0,
|
|
34982
|
+
children: /* @__PURE__ */ jsx("section", {
|
|
34983
|
+
"aria-busy": !workspaceLoadFailed,
|
|
34984
|
+
className: "canvas-panel workbench-canvas",
|
|
34985
|
+
children: workspaceLoadFailed ? /* @__PURE__ */ jsx(WorkspaceRecovery, {
|
|
34986
|
+
kind: workspaceLoadProblem?.kind ?? "failed",
|
|
34987
|
+
message: workspaceLoadProblem?.message,
|
|
34988
|
+
repairing: workspaceRepairing,
|
|
34989
|
+
onRepair: () => void store.workspace.repairWorkspace(),
|
|
34990
|
+
onRetry: () => flowId != null && void store.selectFlow(flowId)
|
|
34991
|
+
}) : /* @__PURE__ */ jsx(Empty, {
|
|
34992
|
+
className: "h-full",
|
|
34993
|
+
children: /* @__PURE__ */ jsx(EmptyHeader, { children: /* @__PURE__ */ jsx(EmptyTitle, { children: t("workspace.status.loading") }) })
|
|
34994
|
+
})
|
|
37133
34995
|
})
|
|
37134
|
-
})
|
|
37135
|
-
|
|
37136
|
-
|
|
37137
|
-
|
|
37138
|
-
|
|
37139
|
-
|
|
37140
|
-
|
|
37141
|
-
|
|
37142
|
-
|
|
37143
|
-
|
|
37144
|
-
|
|
37145
|
-
|
|
37146
|
-
|
|
37147
|
-
|
|
37148
|
-
|
|
37149
|
-
|
|
37150
|
-
|
|
37151
|
-
|
|
37152
|
-
|
|
37153
|
-
|
|
37154
|
-
|
|
37155
|
-
|
|
37156
|
-
|
|
37157
|
-
|
|
37158
|
-
|
|
37159
|
-
|
|
37160
|
-
|
|
37161
|
-
|
|
37162
|
-
|
|
37163
|
-
|
|
37164
|
-
|
|
37165
|
-
|
|
37166
|
-
|
|
37167
|
-
|
|
37168
|
-
|
|
37169
|
-
|
|
34996
|
+
}) : view == "design" ? /* @__PURE__ */ jsx(FlowEditor, {
|
|
34997
|
+
navigationIsland,
|
|
34998
|
+
onRun: (triggerId) => void run(triggerId),
|
|
34999
|
+
onRunStarted: revealRun,
|
|
35000
|
+
onCloseRuns: () => changeRunDrawerOpen(false),
|
|
35001
|
+
onConfigureConnector,
|
|
35002
|
+
onOpenPublications: () => {
|
|
35003
|
+
store.runRequests.dismissInputs();
|
|
35004
|
+
navigation.open("publications");
|
|
35005
|
+
},
|
|
35006
|
+
onOpenRuns: () => {
|
|
35007
|
+
store.runRequests.dismissInputs();
|
|
35008
|
+
navigation.open("runs");
|
|
35009
|
+
},
|
|
35010
|
+
onManageConnectorAccess,
|
|
35011
|
+
connectionHref,
|
|
35012
|
+
onToggleRuns: () => changeRunDrawerOpen(!runDrawerOpen),
|
|
35013
|
+
runDrawerOpen,
|
|
35014
|
+
store,
|
|
35015
|
+
theme
|
|
35016
|
+
}) : view == "runs" ? /* @__PURE__ */ jsx(RunsView, {
|
|
35017
|
+
onSourceChange: (source) => navigation.open("runs", source),
|
|
35018
|
+
flowName: flow?.name ?? flow?.flowId ?? "",
|
|
35019
|
+
onClose: () => navigation.open("design"),
|
|
35020
|
+
onConfigureConnector,
|
|
35021
|
+
onLocateEvent: locateRunEvent,
|
|
35022
|
+
onLocateWait: (nodeId) => {
|
|
35023
|
+
if (store.locateRunWait(nodeId)) navigation.open("design");
|
|
35024
|
+
},
|
|
35025
|
+
store
|
|
35026
|
+
}) : /* @__PURE__ */ jsx(PublicationsView, {
|
|
35027
|
+
theme,
|
|
35028
|
+
onClose: () => navigation.open("design"),
|
|
35029
|
+
store
|
|
35030
|
+
}, flowId)
|
|
35031
|
+
]
|
|
37170
35032
|
})
|
|
37171
35033
|
}) });
|
|
37172
35034
|
}
|