@parallelworks/ui 0.17.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -6
- package/dist/ai/adapter/memoryStore.d.ts +8 -0
- package/dist/ai/adapter/mock/index.d.ts +2 -0
- package/dist/ai/adapter/mock/index.js +81 -0
- package/dist/ai/adapter/mock/mockAdapter.d.ts +4 -0
- package/dist/ai/adapter/openai/createOpenAIStream.d.ts +9 -0
- package/dist/ai/adapter/openai/errors.d.ts +3 -0
- package/dist/ai/adapter/openai/index.d.ts +6 -0
- package/dist/ai/adapter/openai/index.js +334 -0
- package/dist/ai/adapter/openai/openaiAdapter.d.ts +9 -0
- package/dist/ai/adapter/openai/responses.d.ts +4 -0
- package/dist/ai/adapter/openai/sse.d.ts +24 -0
- package/dist/ai/adapter/openai/wire.d.ts +40 -0
- package/dist/ai/adapter/types.d.ts +131 -0
- package/dist/ai/agent/classifier.d.ts +2 -0
- package/dist/ai/agent/diff.d.ts +35 -0
- package/dist/ai/agent/diffHighlight.d.ts +6 -0
- package/dist/ai/agent/index.d.ts +6 -0
- package/dist/ai/agent/permissions.d.ts +11 -0
- package/dist/ai/agent/toolfmt.d.ts +18 -0
- package/dist/ai/agent/transcript.d.ts +38 -0
- package/dist/ai/ai.css +325 -0
- package/dist/ai/components/AllocationSelector.d.ts +4 -0
- package/dist/ai/components/AttachmentManager.d.ts +1 -0
- package/dist/ai/components/AttachmentUpload.d.ts +24 -0
- package/dist/ai/components/BlockedGroupBanner.d.ts +1 -0
- package/dist/ai/components/BranchNavigator.d.ts +8 -0
- package/dist/ai/components/ChatEmptyState.d.ts +3 -0
- package/dist/ai/components/ChatInput.d.ts +45 -0
- package/dist/ai/components/ChatLayout.d.ts +5 -0
- package/dist/ai/components/ChatMessage.d.ts +24 -0
- package/dist/ai/components/ChatMessageList.d.ts +35 -0
- package/dist/ai/components/ChatSidebar.d.ts +5 -0
- package/dist/ai/components/ChatThread.d.ts +3 -0
- package/dist/ai/components/ComposerChrome.d.ts +18 -0
- package/dist/ai/components/ComposerFrame.d.ts +16 -0
- package/dist/ai/components/DragOverlay.d.ts +5 -0
- package/dist/ai/components/ModelSelector.d.ts +6 -0
- package/dist/ai/components/ShareDialog.d.ts +11 -0
- package/dist/ai/components/SlashMenu.d.ts +28 -0
- package/dist/ai/components/agent/ActivityLine.d.ts +21 -0
- package/dist/ai/components/agent/AgentMessageParts.d.ts +54 -0
- package/dist/ai/components/agent/PermissionPicker.d.ts +11 -0
- package/dist/ai/components/attachmentKeys.d.ts +4 -0
- package/dist/ai/core/ChatProvider.d.ts +66 -0
- package/dist/ai/core/KeyboardShortcutsProvider.d.ts +5 -0
- package/dist/ai/core/chatReducer.d.ts +114 -0
- package/dist/ai/core/config.d.ts +47 -0
- package/dist/ai/core/events.d.ts +1 -0
- package/dist/ai/core/exportConversation.d.ts +4 -0
- package/dist/ai/core/greeting.d.ts +3 -0
- package/dist/ai/core/parts.d.ts +11 -0
- package/dist/ai/core/useDragDrop.d.ts +14 -0
- package/dist/ai/core/useKeyboardShortcuts.d.ts +12 -0
- package/dist/ai/core/useSSEStream.d.ts +34 -0
- package/dist/ai/index.d.ts +40 -0
- package/dist/ai/index.js +6645 -0
- package/dist/ai/strings.d.ts +167 -0
- package/dist/ai/types.d.ts +236 -0
- package/dist/ai/ui/Avatar.d.ts +8 -0
- package/dist/ai/ui/Dropdown.d.ts +31 -0
- package/dist/ai/ui/Markdown.d.ts +8 -0
- package/dist/ai/ui/Notice.d.ts +21 -0
- package/dist/ai/ui/buttons.d.ts +1 -0
- package/dist/ai/ui/codeBreaks.d.ts +16 -0
- package/dist/ai/ui/prose.d.ts +1 -0
- package/dist/ai/ui/sidebar.d.ts +81 -0
- package/dist/ai/utils.d.ts +4 -0
- package/dist/assets/{editor.worker-CuBRIwi-.js → editor.worker-BmHUIVG4.js} +194 -163
- package/dist/assets/{json.worker-8ytS02vz.js → json.worker-D8bJ92nw.js} +384 -338
- package/dist/assets/{yaml.worker-DJC-VUcv.js → yaml.worker-C4gyGAko.js} +15657 -13823
- package/dist/chunks/{CodePreviewEditor-UAtnpmOV.js → CodePreviewEditor-YqQBz1YL.js} +2 -2
- package/dist/chunks/ConfirmModal-aOR4O1QE.js +79 -0
- package/dist/chunks/{lib-CUTRDpa6.js → FieldWrapper-Cszwg-4B.js} +52 -55
- package/dist/chunks/{CreateModal-BbV5cTj7.js → Markdown-CM-FenNE.js} +25 -97
- package/dist/chunks/Monaco-DJ8MW-Dq.js +110 -0
- package/dist/chunks/{PageHeader-MxuOs9cH.js → PageHeader-0kG_iypP.js} +170 -105
- package/dist/chunks/{Provider-DHmZ3v9i.js → Provider-CDYurraE.js} +60 -24
- package/dist/chunks/{SwitchToggle-BRQoEwLZ.js → SwitchToggle-DShNdcao.js} +143 -140
- package/dist/chunks/{Table-C6JdFFiJ.js → Table-DU2MW8xz.js} +6 -4
- package/dist/chunks/{Tooltip-n9w7Tkt1.js → Tooltip-K5HJr4_p.js} +32 -5
- package/dist/chunks/duration-BOv8Phl8.js +17 -0
- package/dist/chunks/{editor-mNznodJN.js → editor-Dk1rbV75.js} +33 -19
- package/dist/chunks/focus-D_iZJTW1.js +7 -0
- package/dist/chunks/{list-7k0eaI5N.js → list-CJm875m7.js} +497 -379
- package/dist/chunks/logviewer-BTKuQWzw.js +828 -0
- package/dist/chunks/memoryStore-CC91S5LP.js +152 -0
- package/dist/chunks/types-Yy0NrerF.js +11 -0
- package/dist/components/AddMenu.d.ts +1 -0
- package/dist/components/Avatar.d.ts +13 -0
- package/dist/components/Breadcrumbs.d.ts +1 -1
- package/dist/components/Dropdown.d.ts +3 -1
- package/dist/components/EmptyState.d.ts +1 -1
- package/dist/components/Indicator.d.ts +2 -2
- package/dist/components/Input.d.ts +1 -1
- package/dist/components/LetterBadge.d.ts +1 -1
- package/dist/components/MarkdownImpl.d.ts +1 -1
- package/dist/components/Provider.d.ts +18 -65
- package/dist/components/SettingRow.d.ts +1 -1
- package/dist/components/SettingsGroup.d.ts +1 -1
- package/dist/components/focus.d.ts +2 -0
- package/dist/components/keys.d.ts +12 -0
- package/dist/duration.d.ts +3 -0
- package/dist/editor/Monaco.d.ts +1 -20
- package/dist/editor/index.d.ts +2 -1
- package/dist/editor/index.js +2 -2
- package/dist/editor/yaml.d.ts +5 -0
- package/dist/engine.d.ts +98 -0
- package/dist/file-explorer/FileExplorer.d.ts +11 -2
- package/dist/file-explorer/FileExplorerContext.d.ts +1 -1
- package/dist/file-explorer/FilePreview/CodePreviewEditor.d.ts +1 -1
- package/dist/file-explorer/FilePreview/previewType.d.ts +1 -1
- package/dist/file-explorer/FileRow.d.ts +1 -1
- package/dist/file-explorer/helpers.d.ts +4 -4
- package/dist/file-explorer/index.d.ts +3 -3
- package/dist/file-explorer/index.js +632 -665
- package/dist/file-explorer/lib/types.d.ts +6 -1
- package/dist/file-explorer/lib/utils.d.ts +1 -3
- package/dist/file-explorer/useNearEnd.d.ts +1 -1
- package/dist/form/FieldWrapper.d.ts +2 -1
- package/dist/form/Fields/ResourceOptionIcon.d.ts +1 -1
- package/dist/form/Form.d.ts +7 -22
- package/dist/form/index.d.ts +11 -12
- package/dist/form/index.js +1333 -1454
- package/dist/form/lib.d.ts +6 -1
- package/dist/form/types/fieldComponentTypes.d.ts +4 -2
- package/dist/form/types/fieldTypes.d.ts +6 -20
- package/dist/form/useParsedOpts.d.ts +2 -2
- package/dist/form/utils/{slurmDuration.d.ts → duration.d.ts} +2 -2
- package/dist/{workflow → graph}/MatrixGroup.d.ts +2 -2
- package/dist/{workflow → graph}/index.d.ts +1 -1
- package/dist/{workflow → graph}/index.js +220 -185
- package/dist/{workflow → graph}/types.d.ts +3 -3
- package/dist/icons.d.ts +20 -21
- package/dist/icons.js +3 -3
- package/dist/index.d.ts +38 -39
- package/dist/index.js +355 -354
- package/dist/list/ListTable.d.ts +1 -1
- package/dist/list/ListViewControls.d.ts +2 -2
- package/dist/list/RowContextMenu.d.ts +9 -9
- package/dist/list/UserHoverCard.d.ts +45 -0
- package/dist/list/index.d.ts +9 -8
- package/dist/list/index.js +3 -3
- package/dist/logviewer/LogViewer.d.ts +1 -1
- package/dist/logviewer/index.d.ts +1 -0
- package/dist/logviewer/index.js +2 -742
- package/dist/logviewer/segments.d.ts +9 -0
- package/dist/styles/Geist-Variable.woff2 +0 -0
- package/dist/styles/GeistMono-Variable.woff2 +0 -0
- package/dist/styles/base.css +57 -0
- package/dist/styles/fonts.css +15 -0
- package/dist/styles/theme.css +9 -41
- package/dist/styles.css +1 -1
- package/dist/theme/index.js +2 -2
- package/package.json +45 -20
- package/LICENSE +0 -21
- package/dist/chunks/Monaco-DVyIpyv4.js +0 -1046
- package/dist/editor/usesGitlab.d.ts +0 -97
- package/dist/form/Fields/BucketReadOnlyField.d.ts +0 -7
- package/dist/form/types/workflow-schema.d.ts +0 -1145
- package/dist/form/utils/pwResolver.d.ts +0 -18
- package/dist/chunks/{BareModal-BqroLbZ5.js → BareModal-BtRiQezg.js} +1 -1
- package/dist/chunks/{MarkdownImpl-Bq4QhrtA.js → MarkdownImpl-CyeTVvSt.js} +1 -1
- /package/dist/{workflow → graph}/AnnotationBanner.d.ts +0 -0
- /package/dist/{workflow → graph}/Collapse.d.ts +0 -0
- /package/dist/{workflow → graph}/DependencyGraph.d.ts +0 -0
- /package/dist/{workflow → graph}/JobSummary.d.ts +0 -0
- /package/dist/{workflow → graph}/Reveal.d.ts +0 -0
- /package/dist/{workflow → graph}/TreeView.d.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as useCssIsDark } from "./useCssIsDark-DHr05dG2.js";
|
|
2
|
-
import {
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { a as getThemeName, i as defineEditorThemes, r as setupMonacoWorkers } from "./editor-Dk1rbV75.js";
|
|
4
3
|
import { useEffect, useRef } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import * as monaco from "monaco-editor";
|
|
6
6
|
//#region src/file-explorer/FilePreview/CodePreviewEditor.tsx
|
|
7
7
|
var OPTIONS = {
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { u as useStrings } from "./Provider-CDYurraE.js";
|
|
2
|
+
import { n as modalPanelClasses, t as BareModal } from "./BareModal-BtRiQezg.js";
|
|
3
|
+
import cx from "classnames";
|
|
4
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/ghostButton.ts
|
|
7
|
+
var ghostButtonClasses = "inline-flex cursor-pointer items-center gap-1.5 h-8 px-3 rounded-md text-sm text-(--theme-muted-text-color) hover:text-(--theme-app) hover:bg-(--theme-muted-panel-bg) transition-colors";
|
|
8
|
+
var primaryButtonClasses = "inline-flex cursor-pointer items-center gap-1.5 h-7 px-2.5 rounded-md text-[12.5px] font-medium bg-(--theme-element) text-(--theme-element-text) hover:opacity-90 transition-opacity";
|
|
9
|
+
/** Filled destructive button for confirming irreversible actions in ds modals. */
|
|
10
|
+
var dangerButtonClasses = "inline-flex cursor-pointer items-center gap-1.5 h-7 px-2.5 rounded-md text-[12.5px] font-medium bg-red-600 text-white hover:bg-red-700 transition-colors";
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/components/ConfirmModal.tsx
|
|
13
|
+
function ConfirmModal({ open, onClose, title, description, children, confirmLabel, onConfirm, confirmDisabled = false, destructive = false, align = "top", cancelLabel, closeOnConfirm = true }) {
|
|
14
|
+
const strings = useStrings();
|
|
15
|
+
const [pending, setPending] = useState(false);
|
|
16
|
+
const firedRef = useRef(false);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (open) firedRef.current = false;
|
|
19
|
+
}, [open]);
|
|
20
|
+
const onCloseRef = useRef(onClose);
|
|
21
|
+
onCloseRef.current = onClose;
|
|
22
|
+
const runConfirm = useCallback(async () => {
|
|
23
|
+
if (firedRef.current) return;
|
|
24
|
+
firedRef.current = true;
|
|
25
|
+
setPending(true);
|
|
26
|
+
try {
|
|
27
|
+
await onConfirm();
|
|
28
|
+
if (closeOnConfirm) onCloseRef.current();
|
|
29
|
+
else firedRef.current = false;
|
|
30
|
+
} catch (error) {
|
|
31
|
+
firedRef.current = false;
|
|
32
|
+
throw error;
|
|
33
|
+
} finally {
|
|
34
|
+
setPending(false);
|
|
35
|
+
}
|
|
36
|
+
}, [onConfirm, closeOnConfirm]);
|
|
37
|
+
return /* @__PURE__ */ jsxs(BareModal, {
|
|
38
|
+
open,
|
|
39
|
+
onClose,
|
|
40
|
+
ariaLabel: title,
|
|
41
|
+
align,
|
|
42
|
+
preventClose: pending,
|
|
43
|
+
className: cx(modalPanelClasses, "w-[480px] max-w-full"),
|
|
44
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
45
|
+
className: "px-5 pt-5",
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ jsx("h2", {
|
|
48
|
+
className: "text-lg font-semibold text-(--theme-app)",
|
|
49
|
+
children: title
|
|
50
|
+
}),
|
|
51
|
+
description !== null && description !== void 0 && /* @__PURE__ */ jsx("p", {
|
|
52
|
+
className: "mt-1.5 text-sm text-(--theme-muted-text-color)",
|
|
53
|
+
children: description
|
|
54
|
+
}),
|
|
55
|
+
children !== null && children !== void 0 && /* @__PURE__ */ jsx("div", {
|
|
56
|
+
className: "mt-4",
|
|
57
|
+
children
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
61
|
+
className: "mt-5 flex items-center justify-end gap-2 border-t border-(--theme-border) px-5 py-3",
|
|
62
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
63
|
+
type: "button",
|
|
64
|
+
onClick: onClose,
|
|
65
|
+
disabled: pending,
|
|
66
|
+
className: cx(ghostButtonClasses, pending && "cursor-wait"),
|
|
67
|
+
children: cancelLabel ?? strings.modal.cancel
|
|
68
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
69
|
+
type: "button",
|
|
70
|
+
onClick: runConfirm,
|
|
71
|
+
disabled: confirmDisabled || pending,
|
|
72
|
+
className: cx(destructive ? dangerButtonClasses : primaryButtonClasses, "disabled:cursor-not-allowed disabled:opacity-50", pending && "cursor-wait"),
|
|
73
|
+
children: confirmLabel
|
|
74
|
+
})]
|
|
75
|
+
})]
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
//#endregion
|
|
79
|
+
export { primaryButtonClasses as i, dangerButtonClasses as n, ghostButtonClasses as r, ConfirmModal as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as RequiredMark } from "./RequiredMark-DfLdYbYZ.js";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
3
|
import { createContext, useContext, useId, useMemo } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
//#region src/form/fieldContext.tsx
|
|
6
6
|
var FieldContext = createContext({ required: false });
|
|
7
7
|
var FieldProvider = FieldContext.Provider;
|
|
@@ -26,52 +26,6 @@ function useFieldLabelledByProps() {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
//#endregion
|
|
29
|
-
//#region src/form/FieldWrapper.tsx
|
|
30
|
-
function FieldWrapper({ label, tooltipComponent, description, labelPosition = "left", spaceCompact = false, optional = false, children }) {
|
|
31
|
-
const uid = useId();
|
|
32
|
-
const id = `${uid}control`;
|
|
33
|
-
const labelId = `${uid}label`;
|
|
34
|
-
const descriptionId = description ? `${uid}description` : void 0;
|
|
35
|
-
const field = useMemo(() => ({
|
|
36
|
-
required: !optional,
|
|
37
|
-
id,
|
|
38
|
-
labelId,
|
|
39
|
-
descriptionId
|
|
40
|
-
}), [
|
|
41
|
-
optional,
|
|
42
|
-
id,
|
|
43
|
-
labelId,
|
|
44
|
-
descriptionId
|
|
45
|
-
]);
|
|
46
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
47
|
-
className: cx("flex w-full", labelPosition === "left" ? "items-start" : "items-left flex-col"),
|
|
48
|
-
children: [/* @__PURE__ */ jsxs("label", {
|
|
49
|
-
htmlFor: id,
|
|
50
|
-
id: labelId,
|
|
51
|
-
className: cx("relative", labelPosition === "left" ? "form-label" : "form-label-top", spaceCompact && "form-label-compact"),
|
|
52
|
-
children: [
|
|
53
|
-
label,
|
|
54
|
-
!optional && /* @__PURE__ */ jsx(RequiredMark, {}),
|
|
55
|
-
tooltipComponent
|
|
56
|
-
]
|
|
57
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
58
|
-
className: "w-full",
|
|
59
|
-
children: [/* @__PURE__ */ jsx(FieldProvider, {
|
|
60
|
-
value: field,
|
|
61
|
-
children: typeof children === "function" ? children({
|
|
62
|
-
id,
|
|
63
|
-
labelId,
|
|
64
|
-
describedBy: descriptionId
|
|
65
|
-
}) : children
|
|
66
|
-
}), description && /* @__PURE__ */ jsx("div", {
|
|
67
|
-
id: descriptionId,
|
|
68
|
-
className: "text-xs theme-muted-text mt-1 leading-relaxed",
|
|
69
|
-
children: description
|
|
70
|
-
})]
|
|
71
|
-
})]
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
//#endregion
|
|
75
29
|
//#region src/form/utils/secondaryField.ts
|
|
76
30
|
function findSecondaryOption(options, value) {
|
|
77
31
|
for (const candidate of options) {
|
|
@@ -168,7 +122,7 @@ function impureSetValueFromPath(obj, path, value) {
|
|
|
168
122
|
}
|
|
169
123
|
current[pathArray[pathArray.length - 1]] = value;
|
|
170
124
|
}
|
|
171
|
-
function initializeValues(options, srcData = {},
|
|
125
|
+
function initializeValues(options, srcData = {}, blankDefault) {
|
|
172
126
|
if (!options || typeof options !== "object") return;
|
|
173
127
|
const schema = options;
|
|
174
128
|
const source = srcData;
|
|
@@ -214,7 +168,7 @@ function initializeValues(options, srcData = {}, ignoreDefaultStrings = false) {
|
|
|
214
168
|
if ((fieldSchema.type === "dropdown" || fieldSchema.type === "storage") && fieldSchema.secondaryField && fieldSchema.options && Array.isArray(fieldSchema.options)) {
|
|
215
169
|
const option = findSecondaryOption(fieldSchema.options, data[field]);
|
|
216
170
|
applySecondaryField(fieldSchema.secondaryField, option?.secondaryValue, (secondaryField, secondaryValue) => {
|
|
217
|
-
if (!(fieldSchema.type === "storage" && Object.
|
|
171
|
+
if (!(fieldSchema.type === "storage" && Object.hasOwn(options, secondaryField) && source[secondaryField] !== void 0)) impureSetValueFromPath(acc, secondaryField, secondaryValue);
|
|
218
172
|
});
|
|
219
173
|
}
|
|
220
174
|
return acc;
|
|
@@ -241,14 +195,57 @@ function initializeValues(options, srcData = {}, ignoreDefaultStrings = false) {
|
|
|
241
195
|
}
|
|
242
196
|
}
|
|
243
197
|
if (fieldSchema.type === "multi-dropdown" || fieldSchema.type === "checkbox-group") acc[field] = [];
|
|
244
|
-
if (fieldSchema.default !== void 0)
|
|
245
|
-
const dflt = fieldSchema.default;
|
|
246
|
-
const isPwResource = typeof dflt === "string" && dflt.startsWith("pw://");
|
|
247
|
-
acc[field] = fieldSchema.type === "string" || ignoreDefaultStrings && !isPwResource && (fieldSchema.type === "textarea" || fieldSchema.type === "compute-clusters" || fieldSchema.type === "compute-resources") ? "" : dflt;
|
|
248
|
-
}
|
|
198
|
+
if (fieldSchema.default !== void 0) acc[field] = fieldSchema.type === "string" || blankDefault?.(fieldSchema) ? "" : fieldSchema.default;
|
|
249
199
|
if (fieldSchema.prefillDefault && fieldSchema.default !== void 0) acc[field] = fieldSchema.default;
|
|
250
200
|
return acc;
|
|
251
201
|
}, data);
|
|
252
202
|
}
|
|
253
203
|
//#endregion
|
|
254
|
-
|
|
204
|
+
//#region src/form/FieldWrapper.tsx
|
|
205
|
+
function FieldWrapper({ label, tooltipComponent, description, labelPosition = "left", spaceCompact = false, optional = false, children }) {
|
|
206
|
+
const isOptional = Boolean(resolvedFlag(optional));
|
|
207
|
+
const uid = useId();
|
|
208
|
+
const id = `${uid}control`;
|
|
209
|
+
const labelId = `${uid}label`;
|
|
210
|
+
const descriptionId = description ? `${uid}description` : void 0;
|
|
211
|
+
const field = useMemo(() => ({
|
|
212
|
+
required: !isOptional,
|
|
213
|
+
id,
|
|
214
|
+
labelId,
|
|
215
|
+
descriptionId
|
|
216
|
+
}), [
|
|
217
|
+
isOptional,
|
|
218
|
+
id,
|
|
219
|
+
labelId,
|
|
220
|
+
descriptionId
|
|
221
|
+
]);
|
|
222
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
223
|
+
className: cx("flex w-full", labelPosition === "left" ? "items-start" : "items-left flex-col"),
|
|
224
|
+
children: [/* @__PURE__ */ jsxs("label", {
|
|
225
|
+
htmlFor: id,
|
|
226
|
+
id: labelId,
|
|
227
|
+
className: cx("relative", labelPosition === "left" ? "form-label" : "form-label-top", spaceCompact && "form-label-compact"),
|
|
228
|
+
children: [
|
|
229
|
+
label,
|
|
230
|
+
!isOptional && /* @__PURE__ */ jsx(RequiredMark, {}),
|
|
231
|
+
tooltipComponent
|
|
232
|
+
]
|
|
233
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
234
|
+
className: "w-full",
|
|
235
|
+
children: [/* @__PURE__ */ jsx(FieldProvider, {
|
|
236
|
+
value: field,
|
|
237
|
+
children: typeof children === "function" ? children({
|
|
238
|
+
id,
|
|
239
|
+
labelId,
|
|
240
|
+
describedBy: descriptionId
|
|
241
|
+
}) : children
|
|
242
|
+
}), description && /* @__PURE__ */ jsx("div", {
|
|
243
|
+
id: descriptionId,
|
|
244
|
+
className: "text-xs theme-muted-text mt-1 leading-relaxed",
|
|
245
|
+
children: description
|
|
246
|
+
})]
|
|
247
|
+
})]
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
//#endregion
|
|
251
|
+
export { initializeValues as a, findSecondaryOption as c, useFieldLabelledByProps as d, useFieldRequired as f, impureSetValueFromPath as i, FieldProvider as l, enforceOneMustBeTrue as n, resolvedFlag as o, flattenGroups as r, applySecondaryField as s, FieldWrapper as t, useFieldControlProps as u };
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import { i as useNotify, u as useStrings } from "./Provider-CDYurraE.js";
|
|
1
2
|
import { AlertIcon, CheckIcon, ChevronDownIcon, ChevronRightIcon, ClipboardIcon, CopyIcon, FavoriteIcon, FavoriteOutlineIcon, HiddenFalseIcon, HiddenTrueIcon, InfoIcon, TooltipIcon } from "../icons.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
3
|
+
import { n as TOOLTIP_ID } from "./Tooltip-K5HJr4_p.js";
|
|
4
|
+
import { E as AddMenu } from "./PageHeader-0kG_iypP.js";
|
|
5
|
+
import { n as modalPanelClasses, t as BareModal } from "./BareModal-BtRiQezg.js";
|
|
6
|
+
import { r as ghostButtonClasses } from "./ConfirmModal-aOR4O1QE.js";
|
|
4
7
|
import { a as filterOption, u as toggleSetMember } from "./StatusBadge-C1Blx_cW.js";
|
|
5
|
-
import {
|
|
6
|
-
import { w as AddMenu } from "./PageHeader-MxuOs9cH.js";
|
|
8
|
+
import { Combobox, ComboboxInput, ComboboxOption, ComboboxOptions, Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/react";
|
|
7
9
|
import cx from "classnames";
|
|
8
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
import { Suspense, lazy, useCallback, useEffect, useRef, useState } from "react";
|
|
10
|
-
import {
|
|
11
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
12
|
//#region src/components/Callout.tsx
|
|
12
13
|
function CalloutIcon({ type }) {
|
|
13
14
|
if (type === "warning" || type === "error") return /* @__PURE__ */ jsx(AlertIcon, { className: "h-6 w-6 mr-4 text-lg" });
|
|
@@ -103,91 +104,6 @@ function CopyCodeBlock({ textToCopy, children, secret = false, isRevealed = fals
|
|
|
103
104
|
});
|
|
104
105
|
}
|
|
105
106
|
//#endregion
|
|
106
|
-
//#region src/components/Markdown.tsx
|
|
107
|
-
var MarkdownImpl = lazy(() => import("./MarkdownImpl-Bq4QhrtA.js"));
|
|
108
|
-
function Markdown(props) {
|
|
109
|
-
return /* @__PURE__ */ jsx(Suspense, {
|
|
110
|
-
fallback: /* @__PURE__ */ jsx("div", {
|
|
111
|
-
className: "markdown whitespace-pre-wrap text-start w-full",
|
|
112
|
-
children: props.children
|
|
113
|
-
}),
|
|
114
|
-
children: /* @__PURE__ */ jsx(MarkdownImpl, { ...props })
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
//#endregion
|
|
118
|
-
//#region src/components/ghostButton.ts
|
|
119
|
-
var ghostButtonClasses = "inline-flex cursor-pointer items-center gap-1.5 h-8 px-3 rounded-md text-sm text-(--theme-muted-text-color) hover:text-(--theme-app) hover:bg-(--theme-muted-panel-bg) transition-colors";
|
|
120
|
-
var primaryButtonClasses = "inline-flex cursor-pointer items-center gap-1.5 h-7 px-2.5 rounded-md text-[12.5px] font-medium bg-(--theme-element) text-(--theme-element-text) hover:opacity-90 transition-opacity";
|
|
121
|
-
/** Filled destructive button for confirming irreversible actions in ds modals. */
|
|
122
|
-
var dangerButtonClasses = "inline-flex cursor-pointer items-center gap-1.5 h-7 px-2.5 rounded-md text-[12.5px] font-medium bg-red-600 text-white hover:bg-red-700 transition-colors";
|
|
123
|
-
//#endregion
|
|
124
|
-
//#region src/components/ConfirmModal.tsx
|
|
125
|
-
function ConfirmModal({ open, onClose, title, description, children, confirmLabel, onConfirm, confirmDisabled = false, destructive = false, align = "top", cancelLabel, closeOnConfirm = true }) {
|
|
126
|
-
const strings = useStrings();
|
|
127
|
-
const [pending, setPending] = useState(false);
|
|
128
|
-
const firedRef = useRef(false);
|
|
129
|
-
useEffect(() => {
|
|
130
|
-
if (open) firedRef.current = false;
|
|
131
|
-
}, [open]);
|
|
132
|
-
const onCloseRef = useRef(onClose);
|
|
133
|
-
onCloseRef.current = onClose;
|
|
134
|
-
const runConfirm = useCallback(async () => {
|
|
135
|
-
if (firedRef.current) return;
|
|
136
|
-
firedRef.current = true;
|
|
137
|
-
setPending(true);
|
|
138
|
-
try {
|
|
139
|
-
await onConfirm();
|
|
140
|
-
if (closeOnConfirm) onCloseRef.current();
|
|
141
|
-
else firedRef.current = false;
|
|
142
|
-
} catch (error) {
|
|
143
|
-
firedRef.current = false;
|
|
144
|
-
throw error;
|
|
145
|
-
} finally {
|
|
146
|
-
setPending(false);
|
|
147
|
-
}
|
|
148
|
-
}, [onConfirm, closeOnConfirm]);
|
|
149
|
-
return /* @__PURE__ */ jsxs(BareModal, {
|
|
150
|
-
open,
|
|
151
|
-
onClose,
|
|
152
|
-
ariaLabel: title,
|
|
153
|
-
align,
|
|
154
|
-
preventClose: pending,
|
|
155
|
-
className: cx(modalPanelClasses, "w-[480px] max-w-full"),
|
|
156
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
157
|
-
className: "px-5 pt-5",
|
|
158
|
-
children: [
|
|
159
|
-
/* @__PURE__ */ jsx("h2", {
|
|
160
|
-
className: "text-lg font-semibold text-(--theme-app)",
|
|
161
|
-
children: title
|
|
162
|
-
}),
|
|
163
|
-
description !== null && description !== void 0 && /* @__PURE__ */ jsx("p", {
|
|
164
|
-
className: "mt-1.5 text-sm text-(--theme-muted-text-color)",
|
|
165
|
-
children: description
|
|
166
|
-
}),
|
|
167
|
-
children !== null && children !== void 0 && /* @__PURE__ */ jsx("div", {
|
|
168
|
-
className: "mt-4",
|
|
169
|
-
children
|
|
170
|
-
})
|
|
171
|
-
]
|
|
172
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
173
|
-
className: "mt-5 flex items-center justify-end gap-2 border-t border-(--theme-border) px-5 py-3",
|
|
174
|
-
children: [/* @__PURE__ */ jsx("button", {
|
|
175
|
-
type: "button",
|
|
176
|
-
onClick: onClose,
|
|
177
|
-
disabled: pending,
|
|
178
|
-
className: cx(ghostButtonClasses, pending && "cursor-wait"),
|
|
179
|
-
children: cancelLabel ?? strings.modal.cancel
|
|
180
|
-
}), /* @__PURE__ */ jsx("button", {
|
|
181
|
-
type: "button",
|
|
182
|
-
onClick: runConfirm,
|
|
183
|
-
disabled: confirmDisabled || pending,
|
|
184
|
-
className: cx(destructive ? dangerButtonClasses : primaryButtonClasses, "disabled:cursor-not-allowed disabled:opacity-50", pending && "cursor-wait"),
|
|
185
|
-
children: confirmLabel
|
|
186
|
-
})]
|
|
187
|
-
})]
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
//#endregion
|
|
191
107
|
//#region src/components/CreateModal.tsx
|
|
192
108
|
/** Small info icon that surfaces field help via the global tooltip. */
|
|
193
109
|
function FieldHelp({ tooltip }) {
|
|
@@ -303,7 +219,7 @@ function CreateModal({ open, onClose, typeIcon, typeLabel, typeMenu, namePlaceho
|
|
|
303
219
|
className: "inline-flex items-center gap-1.5 px-1.5 py-1 rounded-md bg-(--theme-muted-panel-bg) text-xs font-medium text-(--theme-muted-text-color)",
|
|
304
220
|
children: [typeIcon, typeLabel]
|
|
305
221
|
}),
|
|
306
|
-
hideName ? /* @__PURE__ */ jsx("div", { className: "mt-3" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
222
|
+
hideName ? /* @__PURE__ */ jsx("div", { className: "mt-3" }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
307
223
|
/* @__PURE__ */ jsx("input", {
|
|
308
224
|
ref: nameRef,
|
|
309
225
|
type: "text",
|
|
@@ -587,7 +503,7 @@ function CreateModalSelectPanel({ open, options, label, value, collapsedLabel, o
|
|
|
587
503
|
} : void 0);
|
|
588
504
|
return /* @__PURE__ */ jsxs(MenuItems, {
|
|
589
505
|
anchor: "bottom start",
|
|
590
|
-
className: "z-[9999] mt-1 flex min-w-44 max-h-64 flex-col [--anchor-max-height:16rem] overflow-hidden rounded-lg border border-(--theme-border) bg-(--theme-app-bg) shadow-lg focus:outline-none",
|
|
506
|
+
className: "z-[9999] mt-1 flex min-w-44 max-w-[min(28rem,calc(100vw-2rem))] max-h-64 flex-col [--anchor-max-height:16rem] overflow-hidden rounded-lg border border-(--theme-border) bg-(--theme-app-bg) shadow-lg focus:outline-none",
|
|
591
507
|
children: [showFilter && /* @__PURE__ */ jsx("div", {
|
|
592
508
|
className: "shrink-0 bg-(--theme-app-bg) px-1.5 pt-1 pb-1.5 border-b border-(--theme-border)",
|
|
593
509
|
children: /* @__PURE__ */ jsx("input", {
|
|
@@ -618,9 +534,9 @@ function CreateModalSelectPanel({ open, options, label, value, collapsedLabel, o
|
|
|
618
534
|
function CreateModalSelect({ label, icon, value, options, onChange, disabled = false, disabledHint, tooltip, collapsedLabel }) {
|
|
619
535
|
const selected = options.find((o) => o.value === value);
|
|
620
536
|
const selectedLabel = selected?.label ?? (value || void 0);
|
|
621
|
-
const pillContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
537
|
+
const pillContent = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
622
538
|
selected?.icon ?? icon,
|
|
623
|
-
selectedLabel ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
539
|
+
selectedLabel ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
624
540
|
className: "font-normal text-(--theme-muted-text-color)",
|
|
625
541
|
children: label
|
|
626
542
|
}), selectedLabel] }) : label,
|
|
@@ -637,7 +553,7 @@ function CreateModalSelect({ label, icon, value, options, onChange, disabled = f
|
|
|
637
553
|
children: pillContent
|
|
638
554
|
})
|
|
639
555
|
});
|
|
640
|
-
return /* @__PURE__ */ jsx(Menu, { children: ({ open }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MenuButton, {
|
|
556
|
+
return /* @__PURE__ */ jsx(Menu, { children: ({ open }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(MenuButton, {
|
|
641
557
|
"aria-label": label,
|
|
642
558
|
className: cx("inline-flex h-7 rounded-md border border-(--theme-border) text-xs font-medium transition-colors hover:bg-(--theme-muted-panel-bg)", selectedLabel ? "text-(--theme-app)" : "text-(--theme-muted-text-color)"),
|
|
643
559
|
children: /* @__PURE__ */ jsx(PillTooltip, {
|
|
@@ -655,4 +571,16 @@ function CreateModalSelect({ label, icon, value, options, onChange, disabled = f
|
|
|
655
571
|
})] }) });
|
|
656
572
|
}
|
|
657
573
|
//#endregion
|
|
658
|
-
|
|
574
|
+
//#region src/components/Markdown.tsx
|
|
575
|
+
var MarkdownImpl = lazy(() => import("./MarkdownImpl-CyeTVvSt.js"));
|
|
576
|
+
function Markdown(props) {
|
|
577
|
+
return /* @__PURE__ */ jsx(Suspense, {
|
|
578
|
+
fallback: /* @__PURE__ */ jsx("div", {
|
|
579
|
+
className: "markdown whitespace-pre-wrap text-start w-full",
|
|
580
|
+
children: props.children
|
|
581
|
+
}),
|
|
582
|
+
children: /* @__PURE__ */ jsx(MarkdownImpl, { ...props })
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
//#endregion
|
|
586
|
+
export { CreateModalField as a, CreateModalTextarea as c, Callout as d, CreateModalAutocompleteField as i, CopyCodeBlock as l, CREATE_MODAL_SELECT_FILTER_THRESHOLD as n, CreateModalSelect as o, CreateModal as r, CreateModalSwitch as s, Markdown as t, CopyToClipboard as u };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { t as useCssIsDark } from "./useCssIsDark-DHr05dG2.js";
|
|
2
|
+
import { a as getThemeName, i as defineEditorThemes, n as onYamlSchemas, r as setupMonacoWorkers } from "./editor-Dk1rbV75.js";
|
|
3
|
+
import cx from "classnames";
|
|
4
|
+
import { useEffect, useLayoutEffect, useRef } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import * as monaco from "monaco-editor";
|
|
7
|
+
import { configureMonacoYaml } from "monaco-yaml";
|
|
8
|
+
//#region src/editor/Monaco.tsx
|
|
9
|
+
setupMonacoWorkers();
|
|
10
|
+
var monacoWithWorkerBridge = {
|
|
11
|
+
...monaco,
|
|
12
|
+
editor: {
|
|
13
|
+
...monaco.editor,
|
|
14
|
+
createWebWorker: (opts) => "worker" in opts ? monaco.editor.createWebWorker(opts) : monaco.createWebWorker(opts)
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var monacoYamlConfigured = false;
|
|
18
|
+
function ensureMonacoYamlConfigured() {
|
|
19
|
+
if (monacoYamlConfigured) return;
|
|
20
|
+
monacoYamlConfigured = true;
|
|
21
|
+
const options = (schemas) => ({
|
|
22
|
+
enableSchemaRequest: true,
|
|
23
|
+
completion: true,
|
|
24
|
+
validate: true,
|
|
25
|
+
hover: true,
|
|
26
|
+
format: { enable: true },
|
|
27
|
+
schemas
|
|
28
|
+
});
|
|
29
|
+
const monacoYaml = configureMonacoYaml(monacoWithWorkerBridge, options([]));
|
|
30
|
+
onYamlSchemas((schemas) => monacoYaml.update(options(schemas)));
|
|
31
|
+
}
|
|
32
|
+
function editorText(value) {
|
|
33
|
+
return value.replace(/\r/g, "");
|
|
34
|
+
}
|
|
35
|
+
var noop = () => {};
|
|
36
|
+
function MonacoEditor({ className, disabled, onChange = noop, onValidate = noop, width = "100%", height = "100%", path = "file:///default", ...options }) {
|
|
37
|
+
const isDark = useCssIsDark();
|
|
38
|
+
const readOnly = disabled || options.readOnly;
|
|
39
|
+
const monacoRef = useRef(null);
|
|
40
|
+
const isSyncingValueRef = useRef(false);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (!monacoRef.current) return;
|
|
43
|
+
defineEditorThemes(monaco.editor);
|
|
44
|
+
monaco.editor.setTheme(getThemeName(isDark, disabled));
|
|
45
|
+
monacoRef.current.updateOptions(readOnly === void 0 ? {} : { readOnly });
|
|
46
|
+
}, [
|
|
47
|
+
disabled,
|
|
48
|
+
isDark,
|
|
49
|
+
readOnly
|
|
50
|
+
]);
|
|
51
|
+
useLayoutEffect(() => {
|
|
52
|
+
const model = monacoRef.current?.getModel();
|
|
53
|
+
if (!model || options.value === void 0 || editorText(model.getValue()) === editorText(options.value)) return;
|
|
54
|
+
isSyncingValueRef.current = true;
|
|
55
|
+
try {
|
|
56
|
+
model.setValue(options.value);
|
|
57
|
+
} finally {
|
|
58
|
+
isSyncingValueRef.current = false;
|
|
59
|
+
}
|
|
60
|
+
}, [options.value]);
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
return () => {
|
|
63
|
+
monacoRef.current?.dispose();
|
|
64
|
+
monacoRef.current = null;
|
|
65
|
+
};
|
|
66
|
+
}, []);
|
|
67
|
+
/** Strips CR (\r) — Windows line endings break bash scripts. */
|
|
68
|
+
const onChangeWrapper = (value) => {
|
|
69
|
+
value = editorText(value);
|
|
70
|
+
onChange(value);
|
|
71
|
+
};
|
|
72
|
+
return /* @__PURE__ */ jsx("div", {
|
|
73
|
+
style: {
|
|
74
|
+
width,
|
|
75
|
+
height
|
|
76
|
+
},
|
|
77
|
+
className: cx("relative border rounded", className),
|
|
78
|
+
ref: (ref) => {
|
|
79
|
+
if (ref && !monacoRef.current) {
|
|
80
|
+
monaco.editor.getModel(monaco.Uri.parse(path))?.dispose();
|
|
81
|
+
defineEditorThemes(monaco.editor);
|
|
82
|
+
monaco.editor.setTheme(getThemeName(isDark, disabled));
|
|
83
|
+
const model = monaco.editor.createModel(options.value ?? "", options.language, monaco.Uri.parse(path));
|
|
84
|
+
const editor = monaco.editor.create(ref, {
|
|
85
|
+
automaticLayout: true,
|
|
86
|
+
model,
|
|
87
|
+
...options,
|
|
88
|
+
...readOnly === void 0 ? {} : { readOnly },
|
|
89
|
+
fixedOverflowWidgets: true,
|
|
90
|
+
suggest: {
|
|
91
|
+
preview: true,
|
|
92
|
+
showWords: false,
|
|
93
|
+
showInlineDetails: true
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
model.onDidChangeContent(() => {
|
|
97
|
+
if (isSyncingValueRef.current) return;
|
|
98
|
+
onChangeWrapper(editor.getValue());
|
|
99
|
+
});
|
|
100
|
+
model.onDidChangeDecorations(() => {
|
|
101
|
+
onValidate(monaco.editor.getModelMarkers({ resource: model.uri }));
|
|
102
|
+
});
|
|
103
|
+
ensureMonacoYamlConfigured();
|
|
104
|
+
monacoRef.current = editor;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
//#endregion
|
|
110
|
+
export { MonacoEditor as default };
|