@parallelworks/ui 0.18.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.
Files changed (161) hide show
  1. package/README.md +86 -6
  2. package/dist/ai/adapter/memoryStore.d.ts +8 -0
  3. package/dist/ai/adapter/mock/index.d.ts +2 -0
  4. package/dist/ai/adapter/mock/index.js +81 -0
  5. package/dist/ai/adapter/mock/mockAdapter.d.ts +4 -0
  6. package/dist/ai/adapter/openai/createOpenAIStream.d.ts +9 -0
  7. package/dist/ai/adapter/openai/errors.d.ts +3 -0
  8. package/dist/ai/adapter/openai/index.d.ts +6 -0
  9. package/dist/ai/adapter/openai/index.js +334 -0
  10. package/dist/ai/adapter/openai/openaiAdapter.d.ts +9 -0
  11. package/dist/ai/adapter/openai/responses.d.ts +4 -0
  12. package/dist/ai/adapter/openai/sse.d.ts +24 -0
  13. package/dist/ai/adapter/openai/wire.d.ts +40 -0
  14. package/dist/ai/adapter/types.d.ts +131 -0
  15. package/dist/ai/agent/classifier.d.ts +2 -0
  16. package/dist/ai/agent/diff.d.ts +35 -0
  17. package/dist/ai/agent/diffHighlight.d.ts +6 -0
  18. package/dist/ai/agent/index.d.ts +6 -0
  19. package/dist/ai/agent/permissions.d.ts +11 -0
  20. package/dist/ai/agent/toolfmt.d.ts +18 -0
  21. package/dist/ai/agent/transcript.d.ts +38 -0
  22. package/dist/ai/ai.css +325 -0
  23. package/dist/ai/components/AllocationSelector.d.ts +4 -0
  24. package/dist/ai/components/AttachmentManager.d.ts +1 -0
  25. package/dist/ai/components/AttachmentUpload.d.ts +24 -0
  26. package/dist/ai/components/BlockedGroupBanner.d.ts +1 -0
  27. package/dist/ai/components/BranchNavigator.d.ts +8 -0
  28. package/dist/ai/components/ChatEmptyState.d.ts +3 -0
  29. package/dist/ai/components/ChatInput.d.ts +45 -0
  30. package/dist/ai/components/ChatLayout.d.ts +5 -0
  31. package/dist/ai/components/ChatMessage.d.ts +24 -0
  32. package/dist/ai/components/ChatMessageList.d.ts +35 -0
  33. package/dist/ai/components/ChatSidebar.d.ts +5 -0
  34. package/dist/ai/components/ChatThread.d.ts +3 -0
  35. package/dist/ai/components/ComposerChrome.d.ts +18 -0
  36. package/dist/ai/components/ComposerFrame.d.ts +16 -0
  37. package/dist/ai/components/DragOverlay.d.ts +5 -0
  38. package/dist/ai/components/ModelSelector.d.ts +6 -0
  39. package/dist/ai/components/ShareDialog.d.ts +11 -0
  40. package/dist/ai/components/SlashMenu.d.ts +28 -0
  41. package/dist/ai/components/agent/ActivityLine.d.ts +21 -0
  42. package/dist/ai/components/agent/AgentMessageParts.d.ts +54 -0
  43. package/dist/ai/components/agent/PermissionPicker.d.ts +11 -0
  44. package/dist/ai/components/attachmentKeys.d.ts +4 -0
  45. package/dist/ai/core/ChatProvider.d.ts +66 -0
  46. package/dist/ai/core/KeyboardShortcutsProvider.d.ts +5 -0
  47. package/dist/ai/core/chatReducer.d.ts +114 -0
  48. package/dist/ai/core/config.d.ts +47 -0
  49. package/dist/ai/core/events.d.ts +1 -0
  50. package/dist/ai/core/exportConversation.d.ts +4 -0
  51. package/dist/ai/core/greeting.d.ts +3 -0
  52. package/dist/ai/core/parts.d.ts +11 -0
  53. package/dist/ai/core/useDragDrop.d.ts +14 -0
  54. package/dist/ai/core/useKeyboardShortcuts.d.ts +12 -0
  55. package/dist/ai/core/useSSEStream.d.ts +34 -0
  56. package/dist/ai/index.d.ts +40 -0
  57. package/dist/ai/index.js +6645 -0
  58. package/dist/ai/strings.d.ts +167 -0
  59. package/dist/ai/types.d.ts +236 -0
  60. package/dist/ai/ui/Avatar.d.ts +8 -0
  61. package/dist/ai/ui/Dropdown.d.ts +31 -0
  62. package/dist/ai/ui/Markdown.d.ts +8 -0
  63. package/dist/ai/ui/Notice.d.ts +21 -0
  64. package/dist/ai/ui/buttons.d.ts +1 -0
  65. package/dist/ai/ui/codeBreaks.d.ts +16 -0
  66. package/dist/ai/ui/prose.d.ts +1 -0
  67. package/dist/ai/ui/sidebar.d.ts +81 -0
  68. package/dist/ai/utils.d.ts +4 -0
  69. package/dist/assets/{editor.worker-CuBRIwi-.js → editor.worker-BmHUIVG4.js} +194 -163
  70. package/dist/assets/{json.worker-8ytS02vz.js → json.worker-D8bJ92nw.js} +384 -338
  71. package/dist/assets/{yaml.worker-DJC-VUcv.js → yaml.worker-C4gyGAko.js} +15657 -13823
  72. package/dist/chunks/{CodePreviewEditor-4lx3kE-w.js → CodePreviewEditor-YqQBz1YL.js} +1 -1
  73. package/dist/chunks/ConfirmModal-aOR4O1QE.js +79 -0
  74. package/dist/chunks/{FieldWrapper-Bef01EWO.js → FieldWrapper-Cszwg-4B.js} +3 -7
  75. package/dist/chunks/{CreateModal-BY6DLmur.js → Markdown-CM-FenNE.js} +19 -91
  76. package/dist/chunks/Monaco-DJ8MW-Dq.js +110 -0
  77. package/dist/chunks/{PageHeader-l49p1nM9.js → PageHeader-0kG_iypP.js} +67 -65
  78. package/dist/chunks/{Provider-Ghua9PkN.js → Provider-CDYurraE.js} +54 -20
  79. package/dist/chunks/{SwitchToggle-CHPP8uZQ.js → SwitchToggle-DShNdcao.js} +135 -132
  80. package/dist/chunks/{Table-4OHjdKdO.js → Table-DU2MW8xz.js} +5 -3
  81. package/dist/chunks/{Tooltip-Crxo_eU_.js → Tooltip-K5HJr4_p.js} +31 -4
  82. package/dist/chunks/duration-BOv8Phl8.js +17 -0
  83. package/dist/chunks/{editor-9_uVtUyy.js → editor-Dk1rbV75.js} +32 -18
  84. package/dist/chunks/focus-D_iZJTW1.js +7 -0
  85. package/dist/chunks/{list-qrojZZNv.js → list-CJm875m7.js} +377 -370
  86. package/dist/chunks/logviewer-BTKuQWzw.js +828 -0
  87. package/dist/chunks/memoryStore-CC91S5LP.js +152 -0
  88. package/dist/chunks/types-Yy0NrerF.js +11 -0
  89. package/dist/components/Avatar.d.ts +1 -1
  90. package/dist/components/Breadcrumbs.d.ts +1 -1
  91. package/dist/components/Dropdown.d.ts +1 -1
  92. package/dist/components/EmptyState.d.ts +1 -1
  93. package/dist/components/Indicator.d.ts +2 -2
  94. package/dist/components/Input.d.ts +1 -1
  95. package/dist/components/LetterBadge.d.ts +1 -1
  96. package/dist/components/MarkdownImpl.d.ts +1 -1
  97. package/dist/components/Provider.d.ts +16 -65
  98. package/dist/components/SettingRow.d.ts +1 -1
  99. package/dist/components/SettingsGroup.d.ts +1 -1
  100. package/dist/components/focus.d.ts +2 -0
  101. package/dist/components/keys.d.ts +12 -0
  102. package/dist/duration.d.ts +3 -0
  103. package/dist/editor/Monaco.d.ts +1 -20
  104. package/dist/editor/index.d.ts +2 -1
  105. package/dist/editor/index.js +2 -2
  106. package/dist/editor/yaml.d.ts +5 -0
  107. package/dist/engine.d.ts +98 -0
  108. package/dist/file-explorer/FileExplorer.d.ts +11 -2
  109. package/dist/file-explorer/FileExplorerContext.d.ts +1 -1
  110. package/dist/file-explorer/FilePreview/CodePreviewEditor.d.ts +1 -1
  111. package/dist/file-explorer/FilePreview/previewType.d.ts +1 -1
  112. package/dist/file-explorer/FileRow.d.ts +1 -1
  113. package/dist/file-explorer/helpers.d.ts +4 -4
  114. package/dist/file-explorer/index.d.ts +3 -3
  115. package/dist/file-explorer/index.js +613 -647
  116. package/dist/file-explorer/lib/types.d.ts +6 -1
  117. package/dist/file-explorer/lib/utils.d.ts +1 -3
  118. package/dist/file-explorer/useNearEnd.d.ts +1 -1
  119. package/dist/form/FieldWrapper.d.ts +2 -2
  120. package/dist/form/Fields/ResourceOptionIcon.d.ts +1 -1
  121. package/dist/form/Form.d.ts +4 -21
  122. package/dist/form/index.d.ts +11 -12
  123. package/dist/form/index.js +1488 -1611
  124. package/dist/form/lib.d.ts +6 -1
  125. package/dist/form/types/fieldComponentTypes.d.ts +3 -2
  126. package/dist/form/types/fieldTypes.d.ts +6 -20
  127. package/dist/form/useParsedOpts.d.ts +1 -1
  128. package/dist/form/utils/{slurmDuration.d.ts → duration.d.ts} +2 -2
  129. package/dist/{workflow → graph}/MatrixGroup.d.ts +2 -2
  130. package/dist/{workflow → graph}/index.d.ts +1 -1
  131. package/dist/{workflow → graph}/index.js +215 -180
  132. package/dist/{workflow → graph}/types.d.ts +3 -3
  133. package/dist/icons.d.ts +20 -21
  134. package/dist/index.d.ts +38 -40
  135. package/dist/index.js +347 -346
  136. package/dist/list/ListTable.d.ts +1 -1
  137. package/dist/list/ListViewControls.d.ts +2 -2
  138. package/dist/list/index.d.ts +9 -9
  139. package/dist/list/index.js +2 -2
  140. package/dist/logviewer/LogViewer.d.ts +1 -1
  141. package/dist/logviewer/index.d.ts +1 -0
  142. package/dist/logviewer/index.js +2 -742
  143. package/dist/logviewer/segments.d.ts +9 -0
  144. package/dist/styles/fonts.css +4 -4
  145. package/dist/styles/theme.css +6 -4
  146. package/dist/styles.css +1 -1
  147. package/dist/theme/index.js +2 -2
  148. package/package.json +38 -14
  149. package/LICENSE +0 -202
  150. package/dist/chunks/Monaco-C1POOdVv.js +0 -1046
  151. package/dist/editor/usesGitlab.d.ts +0 -97
  152. package/dist/form/Fields/BucketReadOnlyField.d.ts +0 -7
  153. package/dist/form/types/workflow-schema.d.ts +0 -1145
  154. package/dist/form/utils/pwResolver.d.ts +0 -18
  155. package/dist/chunks/{MarkdownImpl-Bq4QhrtA.js → MarkdownImpl-CyeTVvSt.js} +1 -1
  156. /package/dist/{workflow → graph}/AnnotationBanner.d.ts +0 -0
  157. /package/dist/{workflow → graph}/Collapse.d.ts +0 -0
  158. /package/dist/{workflow → graph}/DependencyGraph.d.ts +0 -0
  159. /package/dist/{workflow → graph}/JobSummary.d.ts +0 -0
  160. /package/dist/{workflow → graph}/Reveal.d.ts +0 -0
  161. /package/dist/{workflow → graph}/TreeView.d.ts +0 -0
@@ -1,5 +1,5 @@
1
1
  import { t as useCssIsDark } from "./useCssIsDark-DHr05dG2.js";
2
- import { n as defineEditorThemes, r as getThemeName, t as setupMonacoWorkers } from "./editor-9_uVtUyy.js";
2
+ import { a as getThemeName, i as defineEditorThemes, r as setupMonacoWorkers } from "./editor-Dk1rbV75.js";
3
3
  import { useEffect, useRef } from "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  import * as monaco from "monaco-editor";
@@ -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 };
@@ -122,7 +122,7 @@ function impureSetValueFromPath(obj, path, value) {
122
122
  }
123
123
  current[pathArray[pathArray.length - 1]] = value;
124
124
  }
125
- function initializeValues(options, srcData = {}, ignoreDefaultStrings = false) {
125
+ function initializeValues(options, srcData = {}, blankDefault) {
126
126
  if (!options || typeof options !== "object") return;
127
127
  const schema = options;
128
128
  const source = srcData;
@@ -168,7 +168,7 @@ function initializeValues(options, srcData = {}, ignoreDefaultStrings = false) {
168
168
  if ((fieldSchema.type === "dropdown" || fieldSchema.type === "storage") && fieldSchema.secondaryField && fieldSchema.options && Array.isArray(fieldSchema.options)) {
169
169
  const option = findSecondaryOption(fieldSchema.options, data[field]);
170
170
  applySecondaryField(fieldSchema.secondaryField, option?.secondaryValue, (secondaryField, secondaryValue) => {
171
- if (!(fieldSchema.type === "storage" && Object.prototype.hasOwnProperty.call(options, secondaryField) && source[secondaryField] !== void 0)) impureSetValueFromPath(acc, secondaryField, secondaryValue);
171
+ if (!(fieldSchema.type === "storage" && Object.hasOwn(options, secondaryField) && source[secondaryField] !== void 0)) impureSetValueFromPath(acc, secondaryField, secondaryValue);
172
172
  });
173
173
  }
174
174
  return acc;
@@ -195,11 +195,7 @@ function initializeValues(options, srcData = {}, ignoreDefaultStrings = false) {
195
195
  }
196
196
  }
197
197
  if (fieldSchema.type === "multi-dropdown" || fieldSchema.type === "checkbox-group") acc[field] = [];
198
- if (fieldSchema.default !== void 0) {
199
- const dflt = fieldSchema.default;
200
- const isPwResource = typeof dflt === "string" && dflt.startsWith("pw://");
201
- acc[field] = fieldSchema.type === "string" || ignoreDefaultStrings && !isPwResource && (fieldSchema.type === "textarea" || fieldSchema.type === "compute-clusters" || fieldSchema.type === "compute-resources") ? "" : dflt;
202
- }
198
+ if (fieldSchema.default !== void 0) acc[field] = fieldSchema.type === "string" || blankDefault?.(fieldSchema) ? "" : fieldSchema.default;
203
199
  if (fieldSchema.prefillDefault && fieldSchema.default !== void 0) acc[field] = fieldSchema.default;
204
200
  return acc;
205
201
  }, data);
@@ -1,13 +1,14 @@
1
- import { i as useNotify, u as useStrings } from "./Provider-Ghua9PkN.js";
2
- import { w as AddMenu } from "./PageHeader-l49p1nM9.js";
1
+ import { i as useNotify, u as useStrings } from "./Provider-CDYurraE.js";
3
2
  import { AlertIcon, CheckIcon, ChevronDownIcon, ChevronRightIcon, ClipboardIcon, CopyIcon, FavoriteIcon, FavoriteOutlineIcon, HiddenFalseIcon, HiddenTrueIcon, InfoIcon, TooltipIcon } from "../icons.js";
4
- import { n as TOOLTIP_ID } from "./Tooltip-Crxo_eU_.js";
5
- import { a as filterOption, u as toggleSetMember } from "./StatusBadge-C1Blx_cW.js";
3
+ import { n as TOOLTIP_ID } from "./Tooltip-K5HJr4_p.js";
4
+ import { E as AddMenu } from "./PageHeader-0kG_iypP.js";
6
5
  import { n as modalPanelClasses, t as BareModal } from "./BareModal-BtRiQezg.js";
6
+ import { r as ghostButtonClasses } from "./ConfirmModal-aOR4O1QE.js";
7
+ import { a as filterOption, u as toggleSetMember } from "./StatusBadge-C1Blx_cW.js";
8
+ import { Combobox, ComboboxInput, ComboboxOption, ComboboxOptions, Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/react";
7
9
  import cx from "classnames";
8
10
  import { Suspense, lazy, useCallback, useEffect, useRef, useState } from "react";
9
11
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
10
- import { Combobox, ComboboxInput, ComboboxOption, ComboboxOptions, Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/react";
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 }) {
@@ -655,4 +571,16 @@ function CreateModalSelect({ label, icon, value, options, onChange, disabled = f
655
571
  })] }) });
656
572
  }
657
573
  //#endregion
658
- export { CreateModalSelect as a, ConfirmModal as c, primaryButtonClasses as d, Markdown as f, Callout as h, CreateModalField as i, dangerButtonClasses as l, CopyToClipboard as m, CreateModal as n, CreateModalSwitch as o, CopyCodeBlock as p, CreateModalAutocompleteField as r, CreateModalTextarea as s, CREATE_MODAL_SELECT_FILTER_THRESHOLD as t, ghostButtonClasses as u };
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 };
@@ -1,11 +1,50 @@
1
- import { i as useNotify, l as useSlots, n as useLink, u as useStrings } from "./Provider-Ghua9PkN.js";
1
+ import { i as useNotify, l as useSlots, n as useLink, u as useStrings } from "./Provider-CDYurraE.js";
2
2
  import { AddIcon, CheckIcon, ChevronRightIcon, ClipboardIcon, CopyIcon, EditIcon, IdCardIcon, KeyIcon, LinkIcon, MailIcon, MoreIcon, UserIcon } from "../icons.js";
3
- import { n as TOOLTIP_ID } from "./Tooltip-Crxo_eU_.js";
3
+ import { n as TOOLTIP_ID, o as keyedByContent } from "./Tooltip-K5HJr4_p.js";
4
+ import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/react";
4
5
  import cx from "classnames";
5
6
  import React, { Fragment, createContext, useCallback, useContext, useEffect, useLayoutEffect, useRef, useState } from "react";
6
7
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
8
  import { createPortal } from "react-dom";
8
- import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/react";
9
+ //#region src/components/AddMenu.tsx
10
+ var addMenuItemClasses = "flex w-full items-center gap-2 px-3 py-1.5 text-[13px] text-(--theme-app) data-[focus]:bg-(--theme-muted-panel-bg) cursor-pointer";
11
+ function itemButtonProps(item) {
12
+ if (!item.disabled) return { onClick: item.onSelect };
13
+ return {
14
+ "aria-disabled": true,
15
+ ...item.hint ? {
16
+ "aria-label": `${item.label}. ${item.hint}`,
17
+ "data-tooltip-id": TOOLTIP_ID,
18
+ "data-tooltip-content": item.hint
19
+ } : {}
20
+ };
21
+ }
22
+ function AddMenu({ items, label, buttonClassName, zClassName = "z-50", children }) {
23
+ const Link = useLink();
24
+ return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuButton, {
25
+ "aria-label": label,
26
+ title: label,
27
+ className: buttonClassName,
28
+ children
29
+ }), /* @__PURE__ */ jsx(MenuItems, {
30
+ anchor: "bottom start",
31
+ className: cx("mt-1 min-w-52 rounded-lg border border-(--theme-border) bg-(--theme-app-bg) py-1 shadow-lg focus:outline-none", zClassName),
32
+ children: items.map((item) => /* @__PURE__ */ jsxs(Fragment, { children: [item.separatorAbove && /* @__PURE__ */ jsx("div", { className: "my-1 border-t border-(--theme-border)" }), /* @__PURE__ */ jsx(MenuItem, {
33
+ disabled: item.disabled ?? false,
34
+ children: item.to && !item.disabled ? /* @__PURE__ */ jsxs(Link, {
35
+ to: item.to,
36
+ className: addMenuItemClasses,
37
+ children: [item.icon, item.label]
38
+ }) : /* @__PURE__ */ jsxs("button", {
39
+ type: "button",
40
+ ...itemButtonProps(item),
41
+ className: cx(addMenuItemClasses, item.disabled && "opacity-50 cursor-not-allowed"),
42
+ children: [item.icon, item.label]
43
+ })
44
+ })] }, item.label))
45
+ })] });
46
+ }
47
+ //#endregion
9
48
  //#region src/components/Avatar.tsx
10
49
  var SIZE_CLASSES = {
11
50
  sm: "w-6 h-6 text-xs",
@@ -47,45 +86,6 @@ function Avatar({ src, name, size = "md", status, className }) {
47
86
  });
48
87
  }
49
88
  //#endregion
50
- //#region src/components/AddMenu.tsx
51
- var addMenuItemClasses = "flex w-full items-center gap-2 px-3 py-1.5 text-[13px] text-(--theme-app) data-[focus]:bg-(--theme-muted-panel-bg) cursor-pointer";
52
- function itemButtonProps(item) {
53
- if (!item.disabled) return { onClick: item.onSelect };
54
- return {
55
- "aria-disabled": true,
56
- ...item.hint ? {
57
- "aria-label": `${item.label}. ${item.hint}`,
58
- "data-tooltip-id": TOOLTIP_ID,
59
- "data-tooltip-content": item.hint
60
- } : {}
61
- };
62
- }
63
- function AddMenu({ items, label, buttonClassName, zClassName = "z-50", children }) {
64
- const Link = useLink();
65
- return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuButton, {
66
- "aria-label": label,
67
- title: label,
68
- className: buttonClassName,
69
- children
70
- }), /* @__PURE__ */ jsx(MenuItems, {
71
- anchor: "bottom start",
72
- className: cx("mt-1 min-w-52 rounded-lg border border-(--theme-border) bg-(--theme-app-bg) py-1 shadow-lg focus:outline-none", zClassName),
73
- children: items.map((item) => /* @__PURE__ */ jsxs(Fragment, { children: [item.separatorAbove && /* @__PURE__ */ jsx("div", { className: "my-1 border-t border-(--theme-border)" }), /* @__PURE__ */ jsx(MenuItem, {
74
- disabled: item.disabled ?? false,
75
- children: item.to && !item.disabled ? /* @__PURE__ */ jsxs(Link, {
76
- to: item.to,
77
- className: addMenuItemClasses,
78
- children: [item.icon, item.label]
79
- }) : /* @__PURE__ */ jsxs("button", {
80
- type: "button",
81
- ...itemButtonProps(item),
82
- className: cx(addMenuItemClasses, item.disabled && "opacity-50 cursor-not-allowed"),
83
- children: [item.icon, item.label]
84
- })
85
- })] }, item.label))
86
- })] });
87
- }
88
- //#endregion
89
89
  //#region src/components/Breadcrumbs.tsx
90
90
  var BreadcrumbContext = createContext({
91
91
  breadcrumbs: [],
@@ -224,25 +224,27 @@ function assembleRowMenu({ lead = [], actions, exclude, order, trailing = ["dele
224
224
  function useRowMenu(zClassName = "z-50") {
225
225
  const [menu, setMenu] = useState(null);
226
226
  const onCloseRef = useRef(void 0);
227
+ const openMenu = useCallback((x, y, items, onClose) => {
228
+ if (items.length > 0) {
229
+ onCloseRef.current?.();
230
+ onCloseRef.current = onClose;
231
+ setMenu({
232
+ x,
233
+ y,
234
+ items
235
+ });
236
+ }
237
+ }, []);
238
+ const close = useCallback(() => {
239
+ onCloseRef.current?.();
240
+ onCloseRef.current = void 0;
241
+ setMenu(null);
242
+ }, []);
227
243
  return {
228
- openMenu: useCallback((x, y, items, onClose) => {
229
- if (items.length > 0) {
230
- onCloseRef.current?.();
231
- onCloseRef.current = onClose;
232
- setMenu({
233
- x,
234
- y,
235
- items
236
- });
237
- }
238
- }, []),
244
+ openMenu,
239
245
  contextMenu: /* @__PURE__ */ jsx(RowContextMenu, {
240
246
  state: menu,
241
- onClose: useCallback(() => {
242
- onCloseRef.current?.();
243
- onCloseRef.current = void 0;
244
- setMenu(null);
245
- }, []),
247
+ onClose: close,
246
248
  zClassName
247
249
  })
248
250
  };
@@ -342,14 +344,14 @@ function RowContextMenu({ state, onClose, zClassName }) {
342
344
  }
343
345
  var MENU_ITEM_CLASSES = "flex w-full items-center gap-2.5 px-3 py-1.5 text-left text-[13px] hover:bg-(--theme-muted-panel-bg) transition-colors cursor-pointer [&>svg]:h-4 [&>svg]:w-4 [&>svg]:shrink-0";
344
346
  function MenuItemList({ items, onClose, side }) {
345
- return items.map((item, i) => item.kind === "divider" ? /* @__PURE__ */ jsx("div", {
347
+ return keyedByContent(items, (it) => it.kind === "divider" ? "divider" : it.label).map(({ key, item }) => item.kind === "divider" ? /* @__PURE__ */ jsx("div", {
346
348
  "aria-hidden": "true",
347
349
  className: "my-1 h-px bg-(--theme-border)"
348
- }, `divider-${i}`) : /* @__PURE__ */ jsx(MenuRow, {
350
+ }, key) : /* @__PURE__ */ jsx(MenuRow, {
349
351
  item,
350
352
  onClose,
351
353
  side
352
- }, `${item.label}-${i}`));
354
+ }, key));
353
355
  }
354
356
  function MenuRow({ item, onClose, side }) {
355
357
  const Link = useLink();
@@ -646,11 +648,11 @@ function PageHeader({ breadcrumbs, title, titleAction, actions, toolbar, classNa
646
648
  /* @__PURE__ */ jsx("nav", {
647
649
  "aria-label": "Breadcrumb",
648
650
  className: "flex items-center gap-2 min-w-0 text-[13px]",
649
- children: crumbs.map((crumb, idx) => {
651
+ children: keyedByContent(crumbs, (c) => c.href ?? (typeof c.label === "string" ? c.label : "crumb")).map(({ key, item: crumb }, idx) => {
650
652
  if (idx === crumbs.length - 1) return /* @__PURE__ */ jsx("h1", {
651
653
  className: "m-0 text-[13px] font-medium leading-none text-(--theme-app) truncate",
652
654
  children: crumb.label
653
- }, `${crumb.label}-${idx}`);
655
+ }, key);
654
656
  return /* @__PURE__ */ jsxs(Fragment, { children: [crumb.href ? /* @__PURE__ */ jsx(Link, {
655
657
  to: crumb.href,
656
658
  className: "text-(--theme-muted-text-color) hover:text-(--theme-app) transition-colors cursor-pointer whitespace-nowrap",
@@ -658,7 +660,7 @@ function PageHeader({ breadcrumbs, title, titleAction, actions, toolbar, classNa
658
660
  }) : /* @__PURE__ */ jsx("span", {
659
661
  className: "text-(--theme-muted-text-color) whitespace-nowrap",
660
662
  children: crumb.label
661
- }), /* @__PURE__ */ jsx(ChevronRightIcon, { className: "w-3 h-3 opacity-60 shrink-0 text-(--theme-muted-text-color)" })] }, `${crumb.label}-${idx}`);
663
+ }), /* @__PURE__ */ jsx(ChevronRightIcon, { className: "w-3 h-3 opacity-60 shrink-0 text-(--theme-muted-text-color)" })] }, key);
662
664
  })
663
665
  }),
664
666
  titleAction,
@@ -687,4 +689,4 @@ function PageHeader({ breadcrumbs, title, titleAction, actions, toolbar, classNa
687
689
  });
688
690
  }
689
691
  //#endregion
690
- export { useSetDefaultBreadcrumbs as C, avatarInitials as E, useSetBreadcrumbs as S, Avatar as T, useRowMenuActive as _, HeaderAddButton as a, useClearBreadcrumbs as b, PageHeader as c, assembleRowMenu as d, rowContextMenuProps as f, useRowMenu as g, useCopySubmenu as h, HeaderActionMenu as i, headerActionButtonClasses as l, toolbarActionToRowAction as m, BreadcrumbsRightAction as n, HeaderEditButton as o, toRowMenuItem as p, BreadcrumbsTitleAction as r, HeaderRowMenu as s, BreadcrumbsActionButton as t, MoreButton as u, BreadcrumbProvider as v, AddMenu as w, useHideBreadcrumbs as x, useBreadcrumb as y };
692
+ export { useSetDefaultBreadcrumbs as C, AddMenu as E, useSetBreadcrumbs as S, avatarInitials as T, useRowMenuActive as _, HeaderAddButton as a, useClearBreadcrumbs as b, PageHeader as c, assembleRowMenu as d, rowContextMenuProps as f, useRowMenu as g, useCopySubmenu as h, HeaderActionMenu as i, headerActionButtonClasses as l, toolbarActionToRowAction as m, BreadcrumbsRightAction as n, HeaderEditButton as o, toRowMenuItem as p, BreadcrumbsTitleAction as r, HeaderRowMenu as s, BreadcrumbsActionButton as t, MoreButton as u, BreadcrumbProvider as v, Avatar as w, useHideBreadcrumbs as x, useBreadcrumb as y };