@parallelworks/ui 0.51.0 → 0.53.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 (250) hide show
  1. package/README.md +197 -17
  2. package/dist/ai/agent/toolStrings.d.ts +2 -0
  3. package/dist/ai/agent/toolStrings.js +20 -18
  4. package/dist/ai/ai.css +17 -3
  5. package/dist/ai/components/AllocationSelector.js +5 -1
  6. package/dist/ai/components/AttachmentManager.js +51 -42
  7. package/dist/ai/components/AttachmentUpload.d.ts +4 -2
  8. package/dist/ai/components/AttachmentUpload.js +9 -9
  9. package/dist/ai/components/BlockedGroupBanner.js +8 -14
  10. package/dist/ai/components/BranchNavigator.js +11 -12
  11. package/dist/ai/components/ChatEmptyState.js +12 -19
  12. package/dist/ai/components/ChatInput.d.ts +4 -3
  13. package/dist/ai/components/ChatInput.js +27 -13
  14. package/dist/ai/components/ChatMessage.js +45 -121
  15. package/dist/ai/components/ChatMessageList.d.ts +5 -2
  16. package/dist/ai/components/ChatMessageList.js +89 -51
  17. package/dist/ai/components/ChatSidebar.js +11 -7
  18. package/dist/ai/components/ChatThread.js +1 -13
  19. package/dist/ai/components/DragOverlay.js +3 -3
  20. package/dist/ai/components/MessageAttachments.d.ts +10 -0
  21. package/dist/ai/components/MessageAttachments.js +78 -0
  22. package/dist/ai/components/ModelSelector.js +3 -3
  23. package/dist/ai/components/PastedText.js +2 -2
  24. package/dist/ai/components/ProviderIssueBanner.js +19 -23
  25. package/dist/ai/components/ShareDialog.js +2 -2
  26. package/dist/ai/components/agent/ActivityLine.d.ts +0 -2
  27. package/dist/ai/components/agent/ActivityLine.js +8 -51
  28. package/dist/ai/components/agent/AgentMessageParts.js +114 -53
  29. package/dist/ai/core/ChatProvider.d.ts +16 -5
  30. package/dist/ai/core/ChatProvider.js +41 -8
  31. package/dist/ai/core/config.js +4 -3
  32. package/dist/ai/index.d.ts +1 -1
  33. package/dist/ai/index.js +3 -3
  34. package/dist/ai/strings.d.ts +29 -3
  35. package/dist/ai/strings.js +80 -26
  36. package/dist/ai/types.d.ts +4 -0
  37. package/dist/ai/ui/Notice.d.ts +2 -2
  38. package/dist/ai/ui/Notice.js +29 -62
  39. package/dist/ai/ui/sidebar.d.ts +5 -3
  40. package/dist/ai/ui/sidebar.js +22 -10
  41. package/dist/components/ActionMenu.d.ts +1 -0
  42. package/dist/components/ActionMenu.js +6 -1
  43. package/dist/components/AppLink.d.ts +26 -0
  44. package/dist/components/AppLink.js +51 -0
  45. package/dist/components/Avatar.d.ts +2 -1
  46. package/dist/components/Avatar.js +4 -2
  47. package/dist/components/Button.d.ts +15 -5
  48. package/dist/components/Button.js +47 -40
  49. package/dist/components/Callout.d.ts +31 -7
  50. package/dist/components/Callout.js +50 -19
  51. package/dist/components/Card.d.ts +11 -6
  52. package/dist/components/Card.js +14 -8
  53. package/dist/components/Checkbox.js +2 -1
  54. package/dist/components/ColorInput.js +5 -3
  55. package/dist/components/Combobox.js +49 -19
  56. package/dist/components/ConfirmModal.d.ts +19 -8
  57. package/dist/components/ConfirmModal.js +31 -53
  58. package/dist/components/CopyButton.d.ts +38 -0
  59. package/dist/components/CopyButton.js +68 -0
  60. package/dist/components/CreateModal.js +118 -111
  61. package/dist/components/DatePicker.js +12 -8
  62. package/dist/components/DescriptionList.d.ts +25 -5
  63. package/dist/components/DescriptionList.js +56 -22
  64. package/dist/components/Disclosure.js +1 -1
  65. package/dist/components/Drawer.js +10 -16
  66. package/dist/components/Field.d.ts +16 -5
  67. package/dist/components/Field.js +63 -8
  68. package/dist/components/IconButton.d.ts +14 -5
  69. package/dist/components/IconButton.js +25 -14
  70. package/dist/components/InfoTip.d.ts +12 -1
  71. package/dist/components/InfoTip.js +13 -2
  72. package/dist/components/Input.d.ts +14 -8
  73. package/dist/components/Input.js +46 -31
  74. package/dist/components/Loader.js +1 -1
  75. package/dist/components/MarkdownImpl.d.ts +1 -0
  76. package/dist/components/MarkdownImpl.js +1 -0
  77. package/dist/components/MenuEntries.d.ts +4 -0
  78. package/dist/components/MenuEntries.js +11 -12
  79. package/dist/components/Meter.js +5 -4
  80. package/dist/components/Modal.d.ts +28 -4
  81. package/dist/components/Modal.js +37 -14
  82. package/dist/components/Overview.d.ts +20 -12
  83. package/dist/components/Overview.js +14 -9
  84. package/dist/components/PageHeader.d.ts +47 -65
  85. package/dist/components/PageHeader.js +275 -153
  86. package/dist/components/PageHeaderAction.d.ts +67 -0
  87. package/dist/components/PageHeaderAction.js +107 -0
  88. package/dist/components/Pagination.js +6 -16
  89. package/dist/components/Popover.d.ts +4 -1
  90. package/dist/components/Popover.js +5 -3
  91. package/dist/components/Provider.d.ts +79 -19
  92. package/dist/components/Provider.js +140 -130
  93. package/dist/components/Radio.js +2 -1
  94. package/dist/components/RefreshButton.js +7 -8
  95. package/dist/components/RequiredMark.js +1 -1
  96. package/dist/components/Section.js +1 -1
  97. package/dist/components/Select.d.ts +4 -9
  98. package/dist/components/Select.js +24 -11
  99. package/dist/components/SettingModeOption.d.ts +1 -1
  100. package/dist/components/SettingModeOption.js +7 -1
  101. package/dist/components/SettingsCard.d.ts +5 -3
  102. package/dist/components/SettingsCard.js +27 -20
  103. package/dist/components/Slider.js +1 -1
  104. package/dist/components/StatusBadge.js +2 -2
  105. package/dist/components/Switch.js +5 -4
  106. package/dist/components/Table.d.ts +30 -20
  107. package/dist/components/Table.js +50 -73
  108. package/dist/components/Tabs.d.ts +3 -7
  109. package/dist/components/Tabs.js +6 -10
  110. package/dist/components/ThemeEditor.js +18 -8
  111. package/dist/components/Toast.d.ts +11 -3
  112. package/dist/components/Toast.js +45 -20
  113. package/dist/components/buttonClasses.js +1 -1
  114. package/dist/components/comboboxItems.d.ts +4 -0
  115. package/dist/components/comboboxItems.js +6 -1
  116. package/dist/components/dismiss.d.ts +12 -0
  117. package/dist/components/dismiss.js +19 -0
  118. package/dist/components/fieldBox.d.ts +4 -0
  119. package/dist/components/fieldBox.js +7 -3
  120. package/dist/components/floating.d.ts +3 -3
  121. package/dist/components/floating.js +1 -1
  122. package/dist/components/focus.d.ts +5 -0
  123. package/dist/components/focus.js +21 -1
  124. package/dist/components/markdownCodeBreaks.js +3 -4
  125. package/dist/components/pageHeaderStore.d.ts +41 -0
  126. package/dist/components/pageHeaderStore.js +67 -0
  127. package/dist/components/pathBreaks.d.ts +8 -0
  128. package/dist/components/pathBreaks.js +28 -0
  129. package/dist/components/segmented.js +1 -1
  130. package/dist/components/shortcutKey.d.ts +2 -1
  131. package/dist/components/shortcutKey.js +19 -2
  132. package/dist/components/splitter.js +1 -1
  133. package/dist/components/useCssIsDark.js +40 -18
  134. package/dist/components/useTheme.js +9 -10
  135. package/dist/dev.d.ts +9 -0
  136. package/dist/dev.js +14 -0
  137. package/dist/editor/Editor.d.ts +3 -2
  138. package/dist/editor/Editor.js +24 -5
  139. package/dist/editor/EditorField.d.ts +2 -1
  140. package/dist/editor/EditorField.js +11 -29
  141. package/dist/editor/FormCodePanel.d.ts +7 -3
  142. package/dist/editor/FormCodePanel.js +14 -7
  143. package/dist/editor/Monaco.d.ts +22 -6
  144. package/dist/editor/Monaco.js +177 -113
  145. package/dist/editor/editorModel.d.ts +1 -1
  146. package/dist/editor/editorModel.js +1 -1
  147. package/dist/editor/index.d.ts +6 -5
  148. package/dist/editor/index.js +5 -4
  149. package/dist/editor/languages.d.ts +24 -0
  150. package/dist/editor/languages.js +31 -0
  151. package/dist/editor/monacoFeatures.d.ts +7 -0
  152. package/dist/editor/monacoFeatures.js +19 -0
  153. package/dist/editor/themes.d.ts +8 -5
  154. package/dist/editor/themes.js +65 -32
  155. package/dist/editor/workers.d.ts +3 -3
  156. package/dist/editor/workers.js +8 -4
  157. package/dist/editor/yaml.d.ts +6 -2
  158. package/dist/editor/yaml.js +11 -2
  159. package/dist/editor/yamlLanguage.js +55 -38
  160. package/dist/file-explorer/FileExplorer.d.ts +18 -4
  161. package/dist/file-explorer/FileExplorer.js +204 -142
  162. package/dist/file-explorer/FileExplorerContext.js +1 -1
  163. package/dist/file-explorer/FilePreview/StreamedBadge.js +3 -1
  164. package/dist/file-explorer/FilePreview/Viewer.js +14 -10
  165. package/dist/file-explorer/FilePreview/index.js +4 -4
  166. package/dist/file-explorer/FileRow.d.ts +6 -2
  167. package/dist/file-explorer/FileRow.js +35 -17
  168. package/dist/file-explorer/FileRowsWindow.d.ts +2 -1
  169. package/dist/file-explorer/FileRowsWindow.js +36 -4
  170. package/dist/file-explorer/FileTable.d.ts +3 -1
  171. package/dist/file-explorer/FileTable.js +6 -3
  172. package/dist/file-explorer/TreeView.d.ts +5 -1
  173. package/dist/file-explorer/TreeView.js +86 -39
  174. package/dist/file-explorer/helpers.d.ts +2 -1
  175. package/dist/file-explorer/helpers.js +24 -23
  176. package/dist/file-explorer/lib/utils.d.ts +3 -0
  177. package/dist/file-explorer/lib/utils.js +6 -1
  178. package/dist/file-explorer/toasts.js +27 -19
  179. package/dist/file-explorer/treeRows.d.ts +6 -0
  180. package/dist/file-explorer/treeRows.js +19 -1
  181. package/dist/file-explorer/useNearEnd.js +3 -6
  182. package/dist/form/Fields/CheckboxGroupField.js +12 -5
  183. package/dist/form/Fields/DurationField.js +1 -1
  184. package/dist/form/Fields/LabelField.js +1 -1
  185. package/dist/form/Fields/ObjectField.d.ts +1 -1
  186. package/dist/form/Fields/ObjectField.js +3 -2
  187. package/dist/form/Fields/StringField.js +16 -29
  188. package/dist/form/Fields/TextAreaField.js +3 -4
  189. package/dist/form/Form.js +3 -8
  190. package/dist/form/Wizard/WizardNavigation.js +0 -3
  191. package/dist/form/Wizard/utils.js +2 -1
  192. package/dist/form/fieldFrame.d.ts +1 -1
  193. package/dist/form/fieldFrame.js +2 -2
  194. package/dist/form/types/fieldComponentTypes.d.ts +2 -1
  195. package/dist/graph/AnnotationBanner.d.ts +1 -2
  196. package/dist/graph/AnnotationBanner.js +30 -32
  197. package/dist/graph/Connectors.js +4 -1
  198. package/dist/graph/DependencyGraph.js +2 -2
  199. package/dist/graph/GraphEditor.js +11 -9
  200. package/dist/graph/GraphEditorDialogs.js +1 -1
  201. package/dist/graph/GraphNode.js +7 -4
  202. package/dist/graph/InputDialog.js +1 -1
  203. package/dist/graph/InputsEditor.js +14 -11
  204. package/dist/graph/MatrixGroup.js +9 -3
  205. package/dist/graph/Reveal.js +18 -10
  206. package/dist/graph/ShortcutsButton.d.ts +11 -2
  207. package/dist/graph/ShortcutsButton.js +14 -3
  208. package/dist/graph/TreeView.js +35 -18
  209. package/dist/graph/WorkflowSettingsDialog.js +1 -1
  210. package/dist/graph/editorFields.js +1 -1
  211. package/dist/graph/editorRows.js +16 -10
  212. package/dist/graph/editorStrings.d.ts +7 -0
  213. package/dist/graph/editorStrings.js +8 -1
  214. package/dist/graph/inputRefs.js +1 -1
  215. package/dist/graph/settingsViews.js +11 -18
  216. package/dist/graph/stepWith.js +1 -1
  217. package/dist/icons.d.ts +2 -0
  218. package/dist/icons.js +4 -2
  219. package/dist/index.d.ts +12 -12
  220. package/dist/index.js +16 -16
  221. package/dist/list/ActionToolbar.d.ts +42 -6
  222. package/dist/list/ActionToolbar.js +298 -101
  223. package/dist/list/ListPage.d.ts +15 -23
  224. package/dist/list/ListPage.js +42 -43
  225. package/dist/list/ListTable.d.ts +37 -7
  226. package/dist/list/ListTable.js +52 -12
  227. package/dist/list/ListViewControls.js +1 -1
  228. package/dist/list/UserHoverCard.js +7 -15
  229. package/dist/list/index.d.ts +2 -2
  230. package/dist/list/index.js +2 -2
  231. package/dist/list/listSearch.js +12 -10
  232. package/dist/list/listView.d.ts +10 -1
  233. package/dist/list/listView.js +15 -1
  234. package/dist/logviewer/LogViewer.d.ts +4 -2
  235. package/dist/logviewer/LogViewer.js +87 -69
  236. package/dist/logviewer/logviewer.css +3 -2
  237. package/dist/reducedMotion.d.ts +5 -0
  238. package/dist/reducedMotion.js +20 -0
  239. package/dist/safeUrl.d.ts +1 -1
  240. package/dist/safeUrl.js +4 -2
  241. package/dist/styles.css +1 -1
  242. package/package.json +5 -2
  243. package/dist/components/Breadcrumbs.d.ts +0 -37
  244. package/dist/components/Breadcrumbs.js +0 -90
  245. package/dist/components/CopyToClipboard.d.ts +0 -17
  246. package/dist/components/CopyToClipboard.js +0 -66
  247. package/dist/components/Sort.d.ts +0 -9
  248. package/dist/components/Sort.js +0 -42
  249. package/dist/file-explorer/FilePreview/CodePreviewEditor.d.ts +0 -6
  250. package/dist/file-explorer/FilePreview/CodePreviewEditor.js +0 -64
@@ -1,11 +1,12 @@
1
- export { default as Editor } from './Editor.js';
2
- export { default as EditorField, type IEditorField } from './EditorField.js';
3
- export { default as FormCodePanel } from './FormCodePanel.js';
1
+ export { Editor } from './Editor.js';
2
+ export { EditorField, type IEditorField } from './EditorField.js';
3
+ export { FormCodePanel, type FormCodePanelProps } from './FormCodePanel.js';
4
+ export { addEditorLanguages, type EditorLanguages } from './languages.js';
4
5
  export { HOST_MARKER_OWNER, LINT_OWNER } from './lintOwner.js';
5
- export type { IEditorProps, ISchemaError } from './Monaco.js';
6
+ export type { EditorMarker, EditorProps, ValidationMarker } from './Monaco.js';
6
7
  export { type NestedWorkflowText, nestedWorkflowText } from './nestedText.js';
7
8
  export { revealLines } from './reveal.js';
8
9
  export { INPUT_YAML_PATH, JOB_YAML_PATH, type JsonSchema, SETTINGS_YAML_PATH, STEP_YAML_PATH, settingsSchemas, } from './settingsYaml.js';
9
10
  export { defineEditorThemes, followThemeTokens, getThemeName } from './themes.js';
10
11
  export { setupMonacoWorkers } from './workers.js';
11
- export { configureEditorYaml } from './yaml.js';
12
+ export { configureEditorYaml, type SchemasSettings } from './yaml.js';
@@ -1,11 +1,12 @@
1
1
  import { HOST_MARKER_OWNER, LINT_OWNER } from "./lintOwner.js";
2
2
  import { INPUT_YAML_PATH, JOB_YAML_PATH, SETTINGS_YAML_PATH, STEP_YAML_PATH, settingsSchemas } from "./settingsYaml.js";
3
- import Editor from "./Editor.js";
4
- import EditorField from "./EditorField.js";
5
- import FormCodePanel from "./FormCodePanel.js";
3
+ import { addEditorLanguages } from "./languages.js";
4
+ import { Editor } from "./Editor.js";
5
+ import { EditorField } from "./EditorField.js";
6
+ import { FormCodePanel } from "./FormCodePanel.js";
6
7
  import { nestedWorkflowText } from "./nestedText.js";
7
8
  import { revealLines } from "./reveal.js";
8
9
  import { defineEditorThemes, followThemeTokens, getThemeName } from "./themes.js";
9
10
  import { setupMonacoWorkers } from "./workers.js";
10
11
  import { configureEditorYaml } from "./yaml.js";
11
- export { Editor, EditorField, FormCodePanel, HOST_MARKER_OWNER, INPUT_YAML_PATH, JOB_YAML_PATH, LINT_OWNER, SETTINGS_YAML_PATH, STEP_YAML_PATH, configureEditorYaml, defineEditorThemes, followThemeTokens, getThemeName, nestedWorkflowText, revealLines, settingsSchemas, setupMonacoWorkers };
12
+ export { Editor, EditorField, FormCodePanel, HOST_MARKER_OWNER, INPUT_YAML_PATH, JOB_YAML_PATH, LINT_OWNER, SETTINGS_YAML_PATH, STEP_YAML_PATH, addEditorLanguages, configureEditorYaml, defineEditorThemes, followThemeTokens, getThemeName, nestedWorkflowText, revealLines, settingsSchemas, setupMonacoWorkers };
@@ -0,0 +1,24 @@
1
+ /** Languages a host adds to the ones the editor carries. */
2
+ export interface EditorLanguages {
3
+ /**
4
+ * Imports Monaco's registration for the languages, such as
5
+ * `() => import('monaco-editor/languages/definitions/ruby/register')`. It runs when the next
6
+ * editor mounts, so Monaco still loads only once an editor needs it.
7
+ */
8
+ load: () => Promise<unknown>;
9
+ /**
10
+ * A worker for each language service the registration brings, by the label Monaco asks for,
11
+ * such as `typescript` and `javascript`. Basic languages color text on the page and need none.
12
+ */
13
+ workers?: Record<string, () => Worker>;
14
+ }
15
+ /**
16
+ * Adds language services with their workers, such as TypeScript's, or languages of the host's
17
+ * own, to the coloring the editor has for every Monaco language. Call it once at startup, before
18
+ * the first editor mounts; an editor that mounts while they load waits for them.
19
+ */
20
+ export declare function addEditorLanguages({ load, workers: added }: EditorLanguages): void;
21
+ /** The languages still loading, starting any added since, or undefined once all have. */
22
+ export declare function editorLanguagesLoading(): Promise<unknown> | undefined;
23
+ /** The host's worker for a Monaco worker label, if it added one. */
24
+ export declare function hostEditorWorker(label: string): (() => Worker) | undefined;
@@ -0,0 +1,31 @@
1
+ //#region src/editor/languages.ts
2
+ var workers = /* @__PURE__ */ new Map();
3
+ var waiting = [];
4
+ var loading;
5
+ /**
6
+ * Adds language services with their workers, such as TypeScript's, or languages of the host's
7
+ * own, to the coloring the editor has for every Monaco language. Call it once at startup, before
8
+ * the first editor mounts; an editor that mounts while they load waits for them.
9
+ */
10
+ function addEditorLanguages({ load, workers: added = {} }) {
11
+ for (const [label, create] of Object.entries(added)) workers.set(label, create);
12
+ waiting.push(load);
13
+ }
14
+ /** The languages still loading, starting any added since, or undefined once all have. */
15
+ function editorLanguagesLoading() {
16
+ if (waiting.length > 0) {
17
+ const loads = waiting;
18
+ waiting = [];
19
+ const started = Promise.all([loading, ...loads.map((load) => load().catch((error) => console.error("An editor language failed to load", error)))]).finally(() => {
20
+ if (loading === started) loading = void 0;
21
+ });
22
+ loading = started;
23
+ }
24
+ return loading;
25
+ }
26
+ /** The host's worker for a Monaco worker label, if it added one. */
27
+ function hostEditorWorker(label) {
28
+ return workers.get(label);
29
+ }
30
+ //#endregion
31
+ export { addEditorLanguages, editorLanguagesLoading, hostEditorWorker };
@@ -0,0 +1,7 @@
1
+ import 'monaco-editor/features/register.all';
2
+ import 'monaco-editor/editor/contrib/caretOperations/browser/caretOperations';
3
+ import 'monaco-editor/editor/contrib/dropOrPasteInto/browser/copyPasteContribution';
4
+ import 'monaco-editor/editor/contrib/gotoError/browser/markerSelectionStatus';
5
+ import 'monaco-editor/editor/contrib/semanticTokens/browser/documentSemanticTokens';
6
+ import 'monaco-editor/languages/definitions/register.all';
7
+ import 'monaco-editor/languages/features/json/register';
@@ -0,0 +1,19 @@
1
+ import { languages } from "monaco-editor/editor/editor.api";
2
+ import "monaco-editor/features/register.all";
3
+ import "monaco-editor/editor/contrib/caretOperations/browser/caretOperations";
4
+ import "monaco-editor/editor/contrib/dropOrPasteInto/browser/copyPasteContribution";
5
+ import "monaco-editor/editor/contrib/gotoError/browser/markerSelectionStatus";
6
+ import "monaco-editor/editor/contrib/semanticTokens/browser/documentSemanticTokens";
7
+ import "monaco-editor/languages/definitions/register.all";
8
+ import "monaco-editor/languages/features/json/register";
9
+ //#region src/editor/monacoFeatures.ts
10
+ var shell = () => import("monaco-editor/languages/definitions/shell/shell");
11
+ languages.register({
12
+ id: "bash",
13
+ aliases: ["Bash", "bash"]
14
+ });
15
+ languages.registerTokensProviderFactory("bash", { create: async () => (await shell()).language });
16
+ languages.onLanguageEncountered("bash", async () => {
17
+ languages.setLanguageConfiguration("bash", (await shell()).conf);
18
+ });
19
+ //#endregion
@@ -1,8 +1,11 @@
1
1
  import type * as monaco from 'monaco-editor';
2
2
  export declare function expandShorthandHex(color: string): string;
3
- /** Monaco themes read from the document's tokens: call again after the host applies another theme. */
4
- export declare function defineEditorThemes(monacoEditor: typeof monaco.editor): void;
5
- /** Redefines the editor themes when the host applies other tokens to the document,
6
- * and sets `current()` again, so an open editor follows a theme being edited. */
3
+ /**
4
+ * Defines the light and dark Monaco themes from the document's tokens. Call it again after the
5
+ * host applies other tokens; it returns whether anything changed.
6
+ */
7
+ export declare function defineEditorThemes(monacoEditor: typeof monaco.editor): boolean;
8
+ /** Redefines the editor themes when the host applies other tokens or another scheme to the
9
+ * document, and sets `current()` again, so an open editor follows a theme being edited. */
7
10
  export declare function followThemeTokens(monacoEditor: typeof monaco.editor, current: () => string): () => void;
8
- export declare function getThemeName(isDark: boolean, disabled?: boolean): string;
11
+ export declare function getThemeName(isDark: boolean): string;
@@ -9,9 +9,8 @@ var fallbacks = {};
9
9
  /** A token as Monaco takes it: a 6-digit hex. Monaco can't read display-p3, so
10
10
  * a wide-gamut value is mapped back into sRGB; the default theme fills in for
11
11
  * a host that sets no tokens. */
12
- function token(name, mode) {
13
- const set = typeof window === "undefined" ? "" : getComputedStyle(document.documentElement).getPropertyValue(name).trim();
14
- const color = parseColor(expandShorthandHex(set));
12
+ function token(style, name, mode) {
13
+ const color = parseColor(expandShorthandHex(style?.getPropertyValue(name).trim() ?? ""));
15
14
  if (color) return toHex(color);
16
15
  fallbacks[mode] ??= deriveTheme(schemeFor(DEFAULT_THEME, mode));
17
16
  return fallbacks[mode][name];
@@ -37,54 +36,88 @@ var RULES = [
37
36
  ["delimiter", "--theme-code-text"],
38
37
  ["operators", "--theme-code-text"]
39
38
  ];
40
- function editorTheme(mode, disabled) {
41
- const c = (name) => token(name, mode);
42
- const foreground = disabled ? c("--theme-muted-text-color") : c("--theme-code-text");
43
- const background = disabled ? c("--theme-input-disabled-bg") : c("--theme-panel-bg");
39
+ function editorTheme(style, mode) {
40
+ const c = (name) => token(style, name, mode);
44
41
  return {
45
42
  base: mode === "dark" ? "vs-dark" : "vs",
46
43
  inherit: true,
47
- rules: disabled ? [{
48
- token: "",
49
- foreground: foreground.slice(1)
50
- }] : RULES.map(([name, t, fontStyle]) => ({
44
+ rules: RULES.map(([name, t, fontStyle]) => ({
51
45
  token: name,
52
46
  foreground: c(t).slice(1),
53
47
  ...fontStyle ? { fontStyle } : {}
54
48
  })),
55
49
  colors: {
56
- "editor.foreground": foreground,
57
- "editor.background": background,
50
+ "editor.foreground": c("--theme-code-text"),
51
+ "editor.background": c("--theme-panel-bg"),
58
52
  "editor.border": c("--theme-border"),
59
- "editorCursor.foreground": disabled ? background : c("--theme-app"),
60
- "editor.lineHighlightBackground": disabled ? background : c("--theme-hover"),
53
+ "editorCursor.foreground": c("--theme-app"),
54
+ "editor.lineHighlightBackground": c("--theme-hover"),
61
55
  "editorLineNumber.foreground": c("--theme-placeholder"),
62
56
  "editorLineNumber.activeForeground": c("--theme-muted-text-color"),
63
- "editor.selectionBackground": c("--theme-accent-subtle"),
64
- "editor.inactiveSelectionBackground": c("--theme-hover")
57
+ ...mode === "dark" ? {
58
+ "editor.selectionBackground": `${c("--theme-accent")}66`,
59
+ "editor.inactiveSelectionBackground": `${c("--theme-accent")}40`
60
+ } : {
61
+ "editor.selectionBackground": c("--theme-accent-subtle"),
62
+ "editor.inactiveSelectionBackground": c("--theme-hover")
63
+ }
65
64
  }
66
65
  };
67
66
  }
68
- /** Monaco themes read from the document's tokens: call again after the host applies another theme. */
67
+ var definedFor = /* @__PURE__ */ new WeakMap();
68
+ /**
69
+ * Defines the light and dark Monaco themes from the document's tokens. Call it again after the
70
+ * host applies other tokens; it returns whether anything changed.
71
+ */
69
72
  function defineEditorThemes(monacoEditor) {
70
- for (const mode of ["light", "dark"]) for (const disabled of [false, true]) monacoEditor.defineTheme(getThemeName(mode === "dark", disabled), editorTheme(mode, disabled));
73
+ const style = typeof window === "undefined" ? void 0 : getComputedStyle(document.documentElement);
74
+ const themes = ["light", "dark"].map((mode) => [mode, editorTheme(style, mode)]);
75
+ const snapshot = JSON.stringify(themes);
76
+ if (definedFor.get(monacoEditor) === snapshot) return false;
77
+ definedFor.set(monacoEditor, snapshot);
78
+ for (const [mode, data] of themes) monacoEditor.defineTheme(getThemeName(mode === "dark"), data);
79
+ return true;
71
80
  }
72
- /** Redefines the editor themes when the host applies other tokens to the document,
73
- * and sets `current()` again, so an open editor follows a theme being edited. */
81
+ var followers = /* @__PURE__ */ new Set();
82
+ var observer;
83
+ var frame = 0;
84
+ function flush() {
85
+ frame = 0;
86
+ for (const follow of followers) follow();
87
+ }
88
+ /** Redefines the editor themes when the host applies other tokens or another scheme to the
89
+ * document, and sets `current()` again, so an open editor follows a theme being edited. */
74
90
  function followThemeTokens(monacoEditor, current) {
75
91
  if (typeof MutationObserver === "undefined") return () => {};
76
- const observer = new MutationObserver(() => {
77
- defineEditorThemes(monacoEditor);
78
- monacoEditor.setTheme(current());
79
- });
80
- observer.observe(document.documentElement, {
81
- attributes: true,
82
- attributeFilter: ["style"]
83
- });
84
- return () => observer.disconnect();
92
+ const follow = () => {
93
+ if (defineEditorThemes(monacoEditor)) monacoEditor.setTheme(current());
94
+ };
95
+ followers.add(follow);
96
+ if (!observer) {
97
+ observer = new MutationObserver(() => {
98
+ frame ||= requestAnimationFrame(flush);
99
+ });
100
+ observer.observe(document.documentElement, {
101
+ attributes: true,
102
+ attributeFilter: [
103
+ "style",
104
+ "class",
105
+ "data-theme"
106
+ ]
107
+ });
108
+ }
109
+ return () => {
110
+ followers.delete(follow);
111
+ if (followers.size === 0) {
112
+ observer?.disconnect();
113
+ observer = void 0;
114
+ cancelAnimationFrame(frame);
115
+ frame = 0;
116
+ }
117
+ };
85
118
  }
86
- function getThemeName(isDark, disabled) {
87
- return `app-${isDark ? "dark" : "light"}${disabled ? "-disabled" : ""}`;
119
+ function getThemeName(isDark) {
120
+ return `app-${isDark ? "dark" : "light"}`;
88
121
  }
89
122
  //#endregion
90
123
  export { defineEditorThemes, expandShorthandHex, followThemeTokens, getThemeName };
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Points window.MonacoEnvironment at the bundled workers. Idempotent, and a
3
- * host that already configured its own MonacoEnvironment wins — the editor
4
- * calls this on first load only when nothing is configured.
2
+ * Points window.MonacoEnvironment at the bundled workers and those a host added with
3
+ * `addEditorLanguages`. Idempotent, and a host that already configured its own
4
+ * MonacoEnvironment wins — the editor calls this on first load only when nothing is configured.
5
5
  */
6
6
  export declare function setupMonacoWorkers(): void;
7
7
  /**
@@ -1,20 +1,24 @@
1
+ import { hostEditorWorker } from "./languages.js";
1
2
  //#region src/editor/workers.ts
2
3
  var monacoEnvironment = { getWorker(_moduleId, label) {
4
+ const host = hostEditorWorker(label);
5
+ if (host) return host();
3
6
  if (label === "json") return new Worker(new URL(
4
7
  /* @vite-ignore */
5
8
  new URL("../assets/json.worker-BKkHJbNB.js", import.meta.url).href,
6
9
  "" + import.meta.url
7
10
  ), { type: "module" });
8
- return new Worker(new URL(
11
+ if (label === "editorWorkerService") return new Worker(new URL(
9
12
  /* @vite-ignore */
10
13
  new URL("../assets/editor.worker-Cc3TfJ_-.js", import.meta.url).href,
11
14
  "" + import.meta.url
12
15
  ), { type: "module" });
16
+ throw new Error(`The editor has no worker for Monaco's "${label}" service: pass one to addEditorLanguages.`);
13
17
  } };
14
18
  /**
15
- * Points window.MonacoEnvironment at the bundled workers. Idempotent, and a
16
- * host that already configured its own MonacoEnvironment wins — the editor
17
- * calls this on first load only when nothing is configured.
19
+ * Points window.MonacoEnvironment at the bundled workers and those a host added with
20
+ * `addEditorLanguages`. Idempotent, and a host that already configured its own
21
+ * MonacoEnvironment wins — the editor calls this on first load only when nothing is configured.
18
22
  */
19
23
  function setupMonacoWorkers() {
20
24
  if (window.MonacoEnvironment) return;
@@ -7,7 +7,11 @@ export interface SchemasSettings {
7
7
  /** The schema itself, used instead of fetching `uri`. */
8
8
  schema?: object;
9
9
  }
10
- /** Adds JSON schemas that validate and complete YAML models whose URI matches. */
11
- export declare function configureEditorYaml(added: SchemasSettings[]): void;
10
+ /**
11
+ * Adds JSON schemas that validate and complete YAML models whose URI matches. A schema with the
12
+ * `uri` of one already added replaces it, so calling this again, as a reload or a second mount
13
+ * does, adds nothing twice. Returns a function that removes these schemas.
14
+ */
15
+ export declare function configureEditorYaml(added: SchemasSettings[]): () => void;
12
16
  /** Lets the loaded editor pick up schemas added before or after it loads. */
13
17
  export declare function onYamlSchemas(listener: (schemas: SchemasSettings[]) => void): void;
@@ -1,10 +1,19 @@
1
1
  //#region src/editor/yaml.ts
2
2
  var schemas = [];
3
3
  var apply;
4
- /** Adds JSON schemas that validate and complete YAML models whose URI matches. */
4
+ /**
5
+ * Adds JSON schemas that validate and complete YAML models whose URI matches. A schema with the
6
+ * `uri` of one already added replaces it, so calling this again, as a reload or a second mount
7
+ * does, adds nothing twice. Returns a function that removes these schemas.
8
+ */
5
9
  function configureEditorYaml(added) {
6
- schemas = [...schemas, ...added];
10
+ const uris = new Set(added.map((schema) => schema.uri));
11
+ schemas = [...schemas.filter((schema) => !uris.has(schema.uri)), ...added];
7
12
  apply?.(schemas);
13
+ return () => {
14
+ schemas = schemas.filter((schema) => !added.includes(schema));
15
+ apply?.(schemas);
16
+ };
8
17
  }
9
18
  /** Lets the loaded editor pick up schemas added before or after it loads. */
10
19
  function onYamlSchemas(listener) {
@@ -1,6 +1,6 @@
1
1
  import { createYamlWorker } from "./workers.js";
2
2
  import { onYamlSchemas } from "./yaml.js";
3
- import * as monaco from "monaco-editor";
3
+ import * as monaco from "monaco-editor/editor/editor.api";
4
4
  //#region src/editor/yamlLanguage.ts
5
5
  var LANGUAGE_ID = "yaml";
6
6
  var MARKER_OWNER = "yaml";
@@ -186,41 +186,59 @@ function answerServer(method, params) {
186
186
  return null;
187
187
  }
188
188
  function startYamlLanguage() {
189
- const worker = createYamlWorker();
190
- worker.postMessage({});
191
- const connection = new WorkerConnection(worker, answerServer);
189
+ let server;
190
+ let schemas = [];
192
191
  const open = /* @__PURE__ */ new Map();
193
- const ready = connection.request("initialize", {
194
- processId: null,
195
- rootUri: null,
196
- capabilities: {
197
- workspace: { configuration: true },
198
- textDocument: {
199
- synchronization: {},
200
- completion: { completionItem: {
201
- snippetSupport: true,
202
- insertReplaceSupport: true,
203
- documentationFormat: ["markdown", "plaintext"]
204
- } },
205
- hover: { contentFormat: ["markdown", "plaintext"] },
206
- publishDiagnostics: {}
207
- }
208
- }
209
- }).then(() => {
210
- connection.notify("initialized", {});
211
- connection.notify("workspace/didChangeConfiguration", { settings: null });
212
- });
213
- onYamlSchemas((schemas) => {
214
- ready.then(() => connection.notify("json/schemaAssociations", [schemas]));
215
- });
216
- connection.onNotification("textDocument/publishDiagnostics", (params) => {
217
- const { uri, diagnostics } = params;
218
- const model = open.get(uri);
219
- if (model && !model.isDisposed()) monaco.editor.setModelMarkers(model, MARKER_OWNER, diagnostics.map(toMarker));
192
+ function connect() {
193
+ if (server) return server;
194
+ const worker = createYamlWorker();
195
+ worker.postMessage({});
196
+ const connection = new WorkerConnection(worker, answerServer);
197
+ connection.onNotification("textDocument/publishDiagnostics", (params) => {
198
+ const { uri, diagnostics } = params;
199
+ const model = open.get(uri);
200
+ if (model && !model.isDisposed()) monaco.editor.setModelMarkers(model, MARKER_OWNER, diagnostics.map(toMarker));
201
+ });
202
+ server = {
203
+ connection,
204
+ ready: connection.request("initialize", {
205
+ processId: null,
206
+ rootUri: null,
207
+ capabilities: {
208
+ workspace: { configuration: true },
209
+ textDocument: {
210
+ synchronization: {},
211
+ completion: { completionItem: {
212
+ snippetSupport: true,
213
+ insertReplaceSupport: true,
214
+ documentationFormat: ["markdown", "plaintext"]
215
+ } },
216
+ hover: { contentFormat: ["markdown", "plaintext"] },
217
+ publishDiagnostics: {}
218
+ }
219
+ }
220
+ }).then(() => {
221
+ connection.notify("initialized", {});
222
+ connection.notify("workspace/didChangeConfiguration", { settings: null });
223
+ sendSchemas();
224
+ })
225
+ };
226
+ return server;
227
+ }
228
+ function notify(method, params) {
229
+ const { connection, ready } = connect();
230
+ ready.then(() => connection.notify(method, params));
231
+ }
232
+ function sendSchemas() {
233
+ server?.connection.notify("json/schemaAssociations", [schemas]);
234
+ }
235
+ onYamlSchemas((added) => {
236
+ schemas = added;
237
+ server?.ready.then(sendSchemas);
220
238
  });
221
239
  function close(uri, model) {
222
240
  open.delete(uri);
223
- ready.then(() => connection.notify("textDocument/didClose", { textDocument: { uri } }));
241
+ notify("textDocument/didClose", { textDocument: { uri } });
224
242
  if (!model.isDisposed()) monaco.editor.setModelMarkers(model, MARKER_OWNER, []);
225
243
  }
226
244
  function track(model) {
@@ -229,26 +247,24 @@ function startYamlLanguage() {
229
247
  const isYaml = model.getLanguageId() === LANGUAGE_ID;
230
248
  if (isYaml && !open.has(uri)) {
231
249
  open.set(uri, model);
232
- const textDocument = {
250
+ notify("textDocument/didOpen", { textDocument: {
233
251
  uri,
234
252
  languageId: LANGUAGE_ID,
235
253
  version: model.getVersionId(),
236
254
  text: model.getValue()
237
- };
238
- ready.then(() => connection.notify("textDocument/didOpen", { textDocument }));
255
+ } });
239
256
  } else if (!isYaml && open.has(uri)) close(uri, model);
240
257
  };
241
258
  model.onDidChangeLanguage(sync);
242
259
  model.onDidChangeContent(() => {
243
260
  if (!open.has(uri)) return;
244
- const params = {
261
+ notify("textDocument/didChange", {
245
262
  textDocument: {
246
263
  uri,
247
264
  version: model.getVersionId()
248
265
  },
249
266
  contentChanges: [{ text: model.getValue() }]
250
- };
251
- ready.then(() => connection.notify("textDocument/didChange", params));
267
+ });
252
268
  });
253
269
  model.onWillDispose(() => {
254
270
  if (open.get(uri) === model) close(uri, model);
@@ -258,6 +274,7 @@ function startYamlLanguage() {
258
274
  for (const model of monaco.editor.getModels()) track(model);
259
275
  monaco.editor.onDidCreateModel(track);
260
276
  async function request(method, model, params, token) {
277
+ const { connection, ready } = connect();
261
278
  await ready;
262
279
  return connection.request(method, {
263
280
  textDocument: { uri: model.uri.toString() },
@@ -2,7 +2,22 @@ import { type ReactNode } from 'react';
2
2
  import { type RowAction } from '../list/index.js';
3
3
  import type { IFileExplorerClient, IFileExplorerProvider } from './lib/fileExplorer.js';
4
4
  import type { ExplorerObject, TreeNode, TStorage } from './lib/types.js';
5
- interface IFileExplorerProps {
5
+ /** How the explorer moves between folders and files. */
6
+ type ExplorerNavigation = {
7
+ /** The URL of a path, for a host that keeps the path in its URL. Rows, the
8
+ * tree, the trail and each row menu's "Open folder" are then links through
9
+ * the host's router (`useLink`), so a path opens in a new tab, shows its
10
+ * URL and can be copied, and back and forward move between paths. */
11
+ pathHref: (path: string) => string;
12
+ /** Moves to a path without a link: from the keyboard, a delete, an upload.
13
+ * Absent, the explorer goes to `pathHref(path)` through the provider's
14
+ * `navigation.goTo`. */
15
+ onPathChange?: ((path: string) => void) | undefined;
16
+ } | {
17
+ pathHref?: undefined;
18
+ onPathChange: (path: string) => void;
19
+ };
20
+ type IFileExplorerProps = ExplorerNavigation & {
6
21
  storages: TStorage[];
7
22
  /** Resolves the storage's injected provider pair; the host owns caching. */
8
23
  getProviderAndClient: (storage: TStorage) => Promise<{
@@ -21,7 +36,6 @@ interface IFileExplorerProps {
21
36
  }[] | undefined;
22
37
  groupsLoading?: boolean;
23
38
  selectedPath: string;
24
- onPathChange: (path: string) => void;
25
39
  /** Renders only the tree, for a host that embeds it as a navigator and owns
26
40
  * the pane beside it (the notebooks page puts its editor there). The host
27
41
  * also owns the width, so the tree fills its container instead of carrying
@@ -48,6 +62,6 @@ interface IFileExplorerProps {
48
62
  extraRowActions?: ((node: TreeNode, storage: TStorage | undefined) => RowAction[]) | undefined;
49
63
  /** Host content for the selected folder's header, before its badges. */
50
64
  headerAccessory?: ((node: TreeNode, storage: TStorage | undefined) => ReactNode) | undefined;
51
- }
52
- export default function FileExplorer({ storages, onRefresh, refreshKey, onOpenFile, showUserHierarchy, groups, groupsLoading, selectedPath, onPathChange, getProviderAndClient, treeOnly, initialExpandedPaths, onExpandedPathsChange, objectUris, downloadCommand, extraRowActions, headerAccessory, }: IFileExplorerProps): import("react").JSX.Element;
65
+ };
66
+ export default function FileExplorer({ storages, onRefresh, refreshKey, onOpenFile, showUserHierarchy, groups, groupsLoading, selectedPath, onPathChange, pathHref, getProviderAndClient, treeOnly, initialExpandedPaths, onExpandedPathsChange, objectUris, downloadCommand, extraRowActions, headerAccessory, }: IFileExplorerProps): import("react").JSX.Element;
53
67
  export {};