@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parallelworks/ui",
3
- "version": "0.51.0",
3
+ "version": "0.53.0",
4
4
  "description": "React UI components: a theme contract, icons, brand logos, primitives, lists, forms, a job graph, a code editor, a log viewer, a file explorer and an AI chat, each on its own subpath",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -10,7 +10,9 @@
10
10
  },
11
11
  "type": "module",
12
12
  "sideEffects": [
13
- "**/*.css"
13
+ "**/*.css",
14
+ "./src/editor/monacoFeatures.ts",
15
+ "./dist/editor/monacoFeatures.js"
14
16
  ],
15
17
  "exports": {
16
18
  ".": {
@@ -96,6 +98,7 @@
96
98
  "clsx": "^2.1.1",
97
99
  "css-tree": "^3.2.1",
98
100
  "dequal": "^2.0.3",
101
+ "katex": "^0.16.27",
99
102
  "lucide-react": "1.52.0",
100
103
  "luxon": "^3.7.2",
101
104
  "react-zoom-pan-pinch": "^4.2.0",
@@ -1,37 +0,0 @@
1
- import React from 'react';
2
- export interface IBreadcrumbItem {
3
- label: string;
4
- href?: string;
5
- newWindow?: boolean;
6
- }
7
- interface BreadcrumbContextType {
8
- breadcrumbs: IBreadcrumbItem[];
9
- setBreadcrumbs: (breadcrumbs: IBreadcrumbItem[]) => void;
10
- rightsideBreadcrumb?: IBreadcrumbItem | null;
11
- setRightsideBreadcrumb: (breadcrumb: IBreadcrumbItem | null) => void;
12
- hidden: boolean;
13
- setHidden: (hidden: boolean) => void;
14
- /** Null whenever the breadcrumb strip isn't rendered (classic chrome). */
15
- titleActionSlot: HTMLElement | null;
16
- setTitleActionSlot: (el: HTMLElement | null) => void;
17
- rightActionSlot: HTMLElement | null;
18
- setRightActionSlot: (el: HTMLElement | null) => void;
19
- /** Pathname whose breadcrumbs a page set itself, so layouts leave it alone. */
20
- claimedPath: React.MutableRefObject<string | null>;
21
- }
22
- export declare const useBreadcrumb: () => BreadcrumbContextType;
23
- export declare function BreadcrumbProvider({ children }: {
24
- children: React.ReactNode;
25
- }): React.JSX.Element;
26
- export declare function useSetBreadcrumbs(getBreadcrumbs: (() => IBreadcrumbItem[]) | IBreadcrumbItem[]): void;
27
- /**
28
- * For layout routes that derive breadcrumbs from the URL: applies them only
29
- * while no page under the layout has set its own for the current path.
30
- * Without this, a layout re-running its effect (for example when the
31
- * organization's display name loads) overwrote the page's breadcrumbs.
32
- */
33
- export declare function useSetDefaultBreadcrumbs(getBreadcrumbs: (() => IBreadcrumbItem[]) | IBreadcrumbItem[]): void;
34
- /** For pages that render their own header instead of the breadcrumb strip. */
35
- export declare function useClearBreadcrumbs(): void;
36
- export declare function useHideBreadcrumbs(hidden: boolean): void;
37
- export {};
@@ -1,90 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import React, { createContext, useContext, useEffect, useLayoutEffect, useMemo } from "react";
3
- //#region src/components/Breadcrumbs.tsx
4
- var BreadcrumbContext = createContext({
5
- breadcrumbs: [],
6
- setBreadcrumbs: () => {},
7
- rightsideBreadcrumb: null,
8
- setRightsideBreadcrumb: () => {},
9
- hidden: false,
10
- setHidden: () => {},
11
- titleActionSlot: null,
12
- setTitleActionSlot: () => {},
13
- rightActionSlot: null,
14
- setRightActionSlot: () => {},
15
- claimedPath: { current: null }
16
- });
17
- var useBreadcrumb = () => useContext(BreadcrumbContext);
18
- function BreadcrumbProvider({ children }) {
19
- const [breadcrumbs, setBreadcrumbs] = React.useState([]);
20
- const [rightsideBreadcrumb, setRightsideBreadcrumb] = React.useState(null);
21
- const [hidden, setHidden] = React.useState(false);
22
- const [titleActionSlot, setTitleActionSlot] = React.useState(null);
23
- const [rightActionSlot, setRightActionSlot] = React.useState(null);
24
- const claimedPath = React.useRef(null);
25
- const value = useMemo(() => ({
26
- breadcrumbs,
27
- setBreadcrumbs,
28
- rightsideBreadcrumb,
29
- setRightsideBreadcrumb,
30
- hidden,
31
- setHidden,
32
- titleActionSlot,
33
- setTitleActionSlot,
34
- rightActionSlot,
35
- setRightActionSlot,
36
- claimedPath
37
- }), [
38
- breadcrumbs,
39
- rightsideBreadcrumb,
40
- hidden,
41
- titleActionSlot,
42
- rightActionSlot
43
- ]);
44
- return /* @__PURE__ */ jsx(BreadcrumbContext.Provider, {
45
- value,
46
- children
47
- });
48
- }
49
- function useSetBreadcrumbs(getBreadcrumbs) {
50
- const { setBreadcrumbs, claimedPath } = useBreadcrumb();
51
- useLayoutEffect(() => {
52
- claimedPath.current = window.location.pathname;
53
- setBreadcrumbs(typeof getBreadcrumbs === "function" ? getBreadcrumbs() : getBreadcrumbs);
54
- }, [
55
- getBreadcrumbs,
56
- setBreadcrumbs,
57
- claimedPath
58
- ]);
59
- }
60
- /**
61
- * For layout routes that derive breadcrumbs from the URL: applies them only
62
- * while no page under the layout has set its own for the current path.
63
- * Without this, a layout re-running its effect (for example when the
64
- * organization's display name loads) overwrote the page's breadcrumbs.
65
- */
66
- function useSetDefaultBreadcrumbs(getBreadcrumbs) {
67
- const { setBreadcrumbs, claimedPath } = useBreadcrumb();
68
- useLayoutEffect(() => {
69
- if (claimedPath.current === window.location.pathname) return;
70
- setBreadcrumbs(typeof getBreadcrumbs === "function" ? getBreadcrumbs() : getBreadcrumbs);
71
- }, [
72
- getBreadcrumbs,
73
- setBreadcrumbs,
74
- claimedPath
75
- ]);
76
- }
77
- var EMPTY_BREADCRUMBS = [];
78
- /** For pages that render their own header instead of the breadcrumb strip. */
79
- function useClearBreadcrumbs() {
80
- useSetBreadcrumbs(EMPTY_BREADCRUMBS);
81
- }
82
- function useHideBreadcrumbs(hidden) {
83
- const { setHidden } = useBreadcrumb();
84
- useEffect(() => {
85
- setHidden(hidden);
86
- return () => setHidden(false);
87
- }, [hidden, setHidden]);
88
- }
89
- //#endregion
90
- export { BreadcrumbProvider, useBreadcrumb, useClearBreadcrumbs, useHideBreadcrumbs, useSetBreadcrumbs, useSetDefaultBreadcrumbs };
@@ -1,17 +0,0 @@
1
- interface ICopyToClipboardProps {
2
- as?: 'div' | 'button';
3
- text: string;
4
- className?: string;
5
- children?: React.ReactNode;
6
- showIcon?: boolean;
7
- }
8
- export default function CopyToClipboard({ as, text, className, children, showIcon, }: ICopyToClipboardProps): import("react").JSX.Element;
9
- interface CopyCodeBlockProps {
10
- textToCopy: string;
11
- children: React.ReactNode;
12
- secret?: boolean;
13
- isRevealed?: boolean;
14
- onRevealToggle?: () => void;
15
- }
16
- export declare function CopyCodeBlock({ textToCopy, children, secret, isRevealed, onRevealToggle, }: CopyCodeBlockProps): import("react").JSX.Element;
17
- export {};
@@ -1,66 +0,0 @@
1
- import { CheckIcon, CopyIcon, EyeIcon, EyeOffIcon } from "../icons.js";
2
- import { useStrings } from "./Provider.js";
3
- import { useCopy } from "./useCopy.js";
4
- import { jsx, jsxs } from "react/jsx-runtime";
5
- //#region src/components/CopyToClipboard.tsx
6
- function CopyToClipboard({ as = "div", text, className, children, showIcon = true }) {
7
- const { common } = useStrings();
8
- const { copy } = useCopy();
9
- const handleCopy = () => void copy(text);
10
- return /* @__PURE__ */ jsxs(as, {
11
- className,
12
- onClick: handleCopy,
13
- ...as === "button" ? { type: "button" } : {
14
- role: "button",
15
- "aria-label": common.copy,
16
- tabIndex: 0,
17
- onKeyDown: (e) => {
18
- if (e.key === "Enter" || e.key === " ") {
19
- e.preventDefault();
20
- handleCopy();
21
- }
22
- }
23
- },
24
- children: [showIcon && /* @__PURE__ */ jsx(CopyIcon, {}), children]
25
- });
26
- }
27
- function CopyCodeBlock({ textToCopy, children, secret = false, isRevealed = false, onRevealToggle }) {
28
- const { common } = useStrings();
29
- const { copy, copied } = useCopy();
30
- const handleCopy = () => {
31
- if (!copied) copy(textToCopy);
32
- };
33
- return /* @__PURE__ */ jsxs("div", {
34
- className: "group relative",
35
- role: "none",
36
- onClick: handleCopy,
37
- children: [/* @__PURE__ */ jsx("pre", {
38
- className: `p-4 theme-hover border rounded-lg text-left font-mono text-sm overflow-x-auto ${secret ? "pr-24" : "pr-12"}`,
39
- children
40
- }), /* @__PURE__ */ jsxs("div", {
41
- className: "absolute top-0 right-0 bottom-0 flex items-center gap-1 pl-8 pr-2 bg-gradient-to-l from-[var(--color-panel)] from-70% to-transparent rounded-r-lg",
42
- children: [secret && /* @__PURE__ */ jsx("button", {
43
- type: "button",
44
- onClick: (e) => {
45
- e.stopPropagation();
46
- onRevealToggle?.();
47
- },
48
- className: "p-2 rounded-md opacity-0 group-hover:opacity-100 transition-all duration-150",
49
- "aria-label": isRevealed ? common.hideValue : common.showValue,
50
- title: isRevealed ? common.hideValue : common.showValue,
51
- children: isRevealed ? /* @__PURE__ */ jsx(EyeIcon, {}) : /* @__PURE__ */ jsx(EyeOffIcon, {})
52
- }), /* @__PURE__ */ jsx("button", {
53
- type: "button",
54
- onClick: (e) => {
55
- e.stopPropagation();
56
- handleCopy();
57
- },
58
- className: "p-2 rounded-md opacity-0 group-hover:opacity-100 transition-all duration-150",
59
- "aria-label": copied ? common.copied : common.copyToClipboard,
60
- children: copied ? /* @__PURE__ */ jsx(CheckIcon, { className: "text-green-400" }) : /* @__PURE__ */ jsx(CopyIcon, {})
61
- })]
62
- })]
63
- });
64
- }
65
- //#endregion
66
- export { CopyCodeBlock, CopyToClipboard as default };
@@ -1,9 +0,0 @@
1
- export type TDirection = 'ascending' | 'descending' | 'unsorted';
2
- declare function Sort<T extends string>({ currentlySorted, name, setCurrentDirection, setCurrentlySorted, currentDirection, }: {
3
- currentlySorted: T | null;
4
- name: NoInfer<T>;
5
- setCurrentDirection: (direction: TDirection) => void;
6
- setCurrentlySorted: (value: NoInfer<T> | '') => void;
7
- currentDirection: TDirection;
8
- }): import("react").JSX.Element;
9
- export default Sort;
@@ -1,42 +0,0 @@
1
- import { SortDownIcon, SortUnsortedIcon, SortUpIcon } from "../icons.js";
2
- import { useStrings } from "./Provider.js";
3
- import { jsx } from "react/jsx-runtime";
4
- //#region src/components/Sort.tsx
5
- var SortIcon = ({ currentlySorted, currentDirection, name }) => {
6
- const style = { transform: "translateY(2px)" };
7
- if (currentlySorted === name) {
8
- if (currentDirection === "ascending") return /* @__PURE__ */ jsx(SortDownIcon, { style });
9
- else if (currentDirection === "descending") return /* @__PURE__ */ jsx(SortUpIcon, { style });
10
- } else return /* @__PURE__ */ jsx(SortUnsortedIcon, { style });
11
- return null;
12
- };
13
- function Sort({ currentlySorted, name, setCurrentDirection, setCurrentlySorted, currentDirection }) {
14
- const t = useStrings().common;
15
- const sort = (sorted, direction) => {
16
- if (sorted === name) {
17
- if (direction === "ascending") setCurrentDirection("descending");
18
- else if (direction === "descending") {
19
- setCurrentDirection("unsorted");
20
- setCurrentlySorted("");
21
- }
22
- } else {
23
- setCurrentDirection("ascending");
24
- setCurrentlySorted(name);
25
- }
26
- };
27
- return /* @__PURE__ */ jsx("div", {
28
- className: "inline",
29
- children: /* @__PURE__ */ jsx("button", {
30
- type: "button",
31
- "aria-label": t.sort,
32
- onClick: () => sort(currentlySorted, currentDirection),
33
- children: /* @__PURE__ */ jsx(SortIcon, {
34
- currentDirection,
35
- currentlySorted,
36
- name
37
- })
38
- })
39
- });
40
- }
41
- //#endregion
42
- export { Sort as default };
@@ -1,6 +0,0 @@
1
- interface CodePreviewEditorProps {
2
- value: string;
3
- language: string;
4
- }
5
- export default function CodePreviewEditor({ value, language }: CodePreviewEditorProps): import("react").JSX.Element;
6
- export {};
@@ -1,64 +0,0 @@
1
- import { useCssIsDark } from "../../components/useCssIsDark.js";
2
- import { defineEditorThemes, followThemeTokens, getThemeName } from "../../editor/themes.js";
3
- import { setupMonacoWorkers } from "../../editor/workers.js";
4
- import { jsx } from "react/jsx-runtime";
5
- import { useEffect, useRef } from "react";
6
- import * as monaco from "monaco-editor";
7
- //#region src/file-explorer/FilePreview/CodePreviewEditor.tsx
8
- var OPTIONS = {
9
- readOnly: true,
10
- domReadOnly: true,
11
- automaticLayout: true,
12
- minimap: { enabled: false },
13
- scrollBeyondLastLine: false,
14
- renderLineHighlight: "none",
15
- overviewRulerLanes: 0,
16
- hideCursorInOverviewRuler: true,
17
- lineNumbers: "on",
18
- wordWrap: "off",
19
- fontSize: 12,
20
- scrollbar: { alwaysConsumeMouseWheel: false }
21
- };
22
- setupMonacoWorkers();
23
- function CodePreviewEditor({ value, language }) {
24
- const isDark = useCssIsDark();
25
- const editorRef = useRef(null);
26
- useEffect(() => {
27
- return () => {
28
- editorRef.current?.getModel()?.dispose();
29
- editorRef.current?.dispose();
30
- editorRef.current = null;
31
- };
32
- }, []);
33
- useEffect(() => {
34
- const model = editorRef.current?.getModel();
35
- if (model && model.getValue() !== value) model.setValue(value);
36
- }, [value]);
37
- useEffect(() => {
38
- const model = editorRef.current?.getModel();
39
- if (model) monaco.editor.setModelLanguage(model, language);
40
- }, [language]);
41
- useEffect(() => {
42
- if (editorRef.current) {
43
- defineEditorThemes(monaco.editor);
44
- monaco.editor.setTheme(getThemeName(isDark));
45
- }
46
- return followThemeTokens(monaco.editor, () => getThemeName(isDark));
47
- }, [isDark]);
48
- return /* @__PURE__ */ jsx("div", {
49
- className: "h-full w-full",
50
- ref: (container) => {
51
- if (container && !editorRef.current) {
52
- defineEditorThemes(monaco.editor);
53
- const model = monaco.editor.createModel(value, language);
54
- editorRef.current = monaco.editor.create(container, {
55
- ...OPTIONS,
56
- model
57
- });
58
- monaco.editor.setTheme(getThemeName(isDark));
59
- }
60
- }
61
- });
62
- }
63
- //#endregion
64
- export { CodePreviewEditor as default };