@parallelworks/ui 0.52.0 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -8
- package/dist/access/AccessDrawer.d.ts +55 -0
- package/dist/access/AccessDrawer.js +445 -0
- package/dist/access/AccessList.d.ts +58 -0
- package/dist/access/AccessList.js +382 -0
- package/dist/access/GrantView.d.ts +35 -0
- package/dist/access/GrantView.js +188 -0
- package/dist/access/GroupPicker.d.ts +35 -0
- package/dist/access/GroupPicker.js +336 -0
- package/dist/access/focus.d.ts +10 -0
- package/dist/access/focus.js +27 -0
- package/dist/access/index.d.ts +3 -0
- package/dist/access/index.js +3 -0
- package/dist/access/model.d.ts +49 -0
- package/dist/access/model.js +129 -0
- package/dist/access/strings.d.ts +122 -0
- package/dist/access/strings.js +151 -0
- package/dist/access/types.d.ts +56 -0
- package/dist/ai/ai.css +5 -3
- package/dist/ai/components/SlashMenu.js +1 -1
- package/dist/ai/components/agent/AgentMessageParts.js +1 -1
- package/dist/ai/strings.js +0 -1
- package/dist/ai/ui/sidebar.js +1 -1
- package/dist/components/Combobox.d.ts +19 -0
- package/dist/components/Combobox.js +101 -50
- package/dist/components/Drawer.d.ts +6 -1
- package/dist/components/Drawer.js +25 -16
- package/dist/components/Field.d.ts +5 -4
- package/dist/components/Field.js +27 -4
- package/dist/components/InfoTip.d.ts +12 -4
- package/dist/components/InfoTip.js +13 -3
- package/dist/components/MarkdownImpl.d.ts +1 -0
- package/dist/components/MarkdownImpl.js +1 -0
- package/dist/components/Menu.js +4 -4
- package/dist/components/MenuEntries.js +1 -1
- package/dist/components/OptionDescription.d.ts +7 -0
- package/dist/components/OptionDescription.js +19 -0
- package/dist/components/Popover.d.ts +4 -1
- package/dist/components/Popover.js +2 -1
- package/dist/components/Provider.d.ts +9 -0
- package/dist/components/Provider.js +4 -0
- package/dist/components/Select.js +13 -11
- package/dist/components/comboboxItems.d.ts +10 -0
- package/dist/components/comboboxItems.js +8 -1
- package/dist/components/floating.d.ts +5 -2
- package/dist/components/floating.js +2 -2
- package/dist/components/focus.d.ts +5 -0
- package/dist/components/focus.js +21 -1
- package/dist/editor/Editor.js +13 -3
- package/dist/editor/Monaco.d.ts +8 -1
- package/dist/editor/Monaco.js +16 -3
- package/dist/editor/editorModel.d.ts +1 -1
- package/dist/editor/editorModel.js +1 -1
- package/dist/editor/index.d.ts +1 -0
- package/dist/editor/index.js +2 -1
- package/dist/editor/languages.d.ts +24 -0
- package/dist/editor/languages.js +31 -0
- package/dist/editor/monacoFeatures.d.ts +7 -0
- package/dist/editor/monacoFeatures.js +19 -0
- package/dist/editor/themes.d.ts +5 -0
- package/dist/editor/themes.js +24 -4
- package/dist/editor/workers.d.ts +3 -3
- package/dist/editor/workers.js +8 -4
- package/dist/editor/yamlLanguage.js +55 -38
- package/dist/file-explorer/FileExplorer.d.ts +18 -4
- package/dist/file-explorer/FileExplorer.js +64 -20
- package/dist/file-explorer/FilePreview/Viewer.js +12 -8
- package/dist/file-explorer/FileRow.d.ts +6 -2
- package/dist/file-explorer/FileRow.js +35 -17
- package/dist/file-explorer/FileRowsWindow.d.ts +2 -1
- package/dist/file-explorer/FileRowsWindow.js +2 -1
- package/dist/file-explorer/FileTable.d.ts +3 -1
- package/dist/file-explorer/FileTable.js +3 -2
- package/dist/file-explorer/TreeView.d.ts +5 -1
- package/dist/file-explorer/TreeView.js +49 -25
- package/dist/file-explorer/helpers.js +3 -3
- package/dist/file-explorer/lib/paging.d.ts +1 -0
- package/dist/file-explorer/lib/paging.js +5 -1
- package/dist/file-explorer/lib/utils.d.ts +3 -0
- package/dist/file-explorer/lib/utils.js +6 -1
- package/dist/form/Wizard/utils.js +2 -1
- package/dist/list/ActionToolbar.js +3 -2
- package/dist/list/ListPage.js +1 -1
- package/dist/list/ListTable.d.ts +5 -0
- package/dist/list/ListTable.js +6 -2
- package/dist/styles/theme.css +82 -62
- package/dist/styles.css +1 -1
- package/dist/theme/derive.d.ts +5 -3
- package/dist/theme/derive.js +61 -3
- package/package.json +9 -2
- package/dist/file-explorer/FilePreview/CodePreviewEditor.d.ts +0 -6
- package/dist/file-explorer/FilePreview/CodePreviewEditor.js +0 -64
package/dist/theme/derive.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CodeStyle, type Scheme } from './model.js';
|
|
1
|
+
import { type CodeStyle, type Mode, type Scheme } from './model.js';
|
|
2
2
|
export declare const THEME_TOKENS: readonly ['--theme-app-bg', '--theme-panel-bg', '--theme-panel-hover', '--theme-muted-panel-bg', '--theme-hover', '--theme-input-bg', '--theme-input-disabled-bg', '--theme-app', '--theme-muted-text-color', '--theme-placeholder', '--theme-link', '--theme-border', '--theme-border-strong', '--theme-accent', '--theme-accent-text', '--theme-accent-hover', '--theme-accent-subtle', '--theme-focus', '--theme-focus-ring', '--theme-success', '--theme-success-text', '--theme-success-solid', '--theme-success-muted', '--theme-error', '--theme-error-text', '--theme-error-solid', '--theme-error-muted', '--theme-warning', '--theme-warning-text', '--theme-warning-solid', '--theme-warning-muted', '--theme-info', '--theme-info-text', '--theme-info-solid', '--theme-info-muted', '--theme-favorite', '--theme-favorite-text', '--theme-favorite-solid', '--theme-favorite-muted', '--theme-shadow-sm', '--theme-shadow', '--theme-shadow-lg', '--theme-shadow-xl', '--theme-sidebar-bg', '--theme-sidebar-text', '--theme-sidebar-hover', '--theme-sidebar-active-bg', '--theme-sidebar-active-text', '--theme-code-bg', '--theme-code-text', '--theme-code-comment', '--theme-code-keyword', '--theme-code-string', '--theme-code-number', '--theme-code-function', '--theme-code-type', '--theme-code-property', '--theme-ansi-black', '--theme-ansi-red', '--theme-ansi-green', '--theme-ansi-yellow', '--theme-ansi-blue', '--theme-ansi-magenta', '--theme-ansi-cyan', '--theme-ansi-white'];
|
|
3
3
|
export type ThemeToken = (typeof THEME_TOKENS)[number];
|
|
4
4
|
export type ThemeVariables = Record<ThemeToken, string>;
|
|
@@ -22,7 +22,9 @@ export declare function generateTheme(scheme: Scheme, options?: DeriveOptions):
|
|
|
22
22
|
/** Every `--theme-*` token for a scheme, in sRGB. */
|
|
23
23
|
export declare function deriveTheme(scheme: Scheme, options?: DeriveOptions): ThemeVariables;
|
|
24
24
|
/** A stylesheet for a scheme: sRGB under `selector`, and the display-p3 overrides under
|
|
25
|
-
* `@media (color-gamut: p3)`.
|
|
26
|
-
|
|
25
|
+
* `@media (color-gamut: p3)`. Given a scheme for each mode, every token that differs between
|
|
26
|
+
* them is written as `light-dark()`, so the tokens follow the CSS color-scheme wherever they are
|
|
27
|
+
* used. `omit` leaves tokens out, such as ones a host supplies. */
|
|
28
|
+
export declare function themeStylesheet(selector: string, scheme: Scheme | Record<Mode, Scheme>, options?: DeriveOptions & {
|
|
27
29
|
omit?: readonly ThemeToken[];
|
|
28
30
|
}): string;
|
package/dist/theme/derive.js
CHANGED
|
@@ -492,11 +492,69 @@ function compositeHex(fill, backdrop) {
|
|
|
492
492
|
function deriveTheme(scheme, options = {}) {
|
|
493
493
|
return build(scheme, options).srgb;
|
|
494
494
|
}
|
|
495
|
+
var COLOR = /#[0-9a-f]{3,8}\b|rgba?\([^)]*\)|color\([^)]*\)/gi;
|
|
496
|
+
/** One value for both modes: each color that differs becomes `light-dark()`, which follows the
|
|
497
|
+
* CSS color-scheme. A shadow keeps its geometry and pairs its colors. */
|
|
498
|
+
function lightDark(light, dark) {
|
|
499
|
+
if (light === dark) return light;
|
|
500
|
+
const darks = dark.match(COLOR) ?? [];
|
|
501
|
+
if (light.replace(COLOR, "") !== dark.replace(COLOR, "")) throw new Error(`cannot pair ${light} with ${dark}`);
|
|
502
|
+
let i = 0;
|
|
503
|
+
return light.replace(COLOR, (color) => {
|
|
504
|
+
const other = darks[i++];
|
|
505
|
+
return color === other ? color : `light-dark(${color}, ${other})`;
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
/** Splits at the commas outside any parentheses. */
|
|
509
|
+
function topLevel(value) {
|
|
510
|
+
const parts = [];
|
|
511
|
+
let depth = 0;
|
|
512
|
+
let start = 0;
|
|
513
|
+
for (let i = 0; i < value.length; i++) {
|
|
514
|
+
const ch = value[i];
|
|
515
|
+
if (ch === "(") depth++;
|
|
516
|
+
else if (ch === ")") depth--;
|
|
517
|
+
else if (ch === "," && depth === 0) {
|
|
518
|
+
parts.push(value.slice(start, i).trim());
|
|
519
|
+
start = i + 1;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
parts.push(value.slice(start).trim());
|
|
523
|
+
return parts;
|
|
524
|
+
}
|
|
525
|
+
/** A declaration laid out as the repository's formatter lays out CSS past 100 columns: a list
|
|
526
|
+
* takes a line per item, and a single function a line per argument. */
|
|
527
|
+
function declaration(token, value, indent) {
|
|
528
|
+
const line = `${indent}${token}: ${value};`;
|
|
529
|
+
if (line.length <= 100) return line;
|
|
530
|
+
const inner = `${indent} `;
|
|
531
|
+
const items = topLevel(value);
|
|
532
|
+
if (items.length > 1) return `${indent}${token}:\n${items.map((item) => `${inner}${item}`).join(",\n")};`;
|
|
533
|
+
const call = /^([\w-]+)\((.*)\)$/s.exec(value);
|
|
534
|
+
if (!call) return line;
|
|
535
|
+
const args = topLevel(call[2]);
|
|
536
|
+
return `${indent}${token}: ${call[1]}(\n${args.map((arg) => `${inner}${arg}`).join(",\n")}\n${indent});`;
|
|
537
|
+
}
|
|
495
538
|
/** A stylesheet for a scheme: sRGB under `selector`, and the display-p3 overrides under
|
|
496
|
-
* `@media (color-gamut: p3)`.
|
|
539
|
+
* `@media (color-gamut: p3)`. Given a scheme for each mode, every token that differs between
|
|
540
|
+
* them is written as `light-dark()`, so the tokens follow the CSS color-scheme wherever they are
|
|
541
|
+
* used. `omit` leaves tokens out, such as ones a host supplies. */
|
|
497
542
|
function themeStylesheet(selector, scheme, options = {}) {
|
|
498
|
-
const
|
|
499
|
-
|
|
543
|
+
const tokens = THEME_TOKENS.filter((token) => !options.omit?.includes(token));
|
|
544
|
+
let srgb;
|
|
545
|
+
let p3;
|
|
546
|
+
if ("interface" in scheme) ({srgb, p3} = generateTheme(scheme, options));
|
|
547
|
+
else {
|
|
548
|
+
const light = generateTheme(scheme.light, options);
|
|
549
|
+
const dark = generateTheme(scheme.dark, options);
|
|
550
|
+
srgb = {};
|
|
551
|
+
p3 = {};
|
|
552
|
+
for (const token of tokens) {
|
|
553
|
+
srgb[token] = lightDark(light.srgb[token], dark.srgb[token]);
|
|
554
|
+
if (light.p3[token] !== void 0 || dark.p3[token] !== void 0) p3[token] = lightDark(light.p3[token] ?? light.srgb[token], dark.p3[token] ?? dark.srgb[token]);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
const block = (vars, indent) => tokens.filter((token) => vars[token] !== void 0).map((token) => declaration(token, vars[token], indent)).join("\n");
|
|
500
558
|
const wide = block(p3, " ");
|
|
501
559
|
return `${selector} {\n${block(srgb, " ")}\n}\n${wide ? `\n@media (color-gamut: p3) {\n ${selector} {\n${wide}\n }\n}\n` : ""}`;
|
|
502
560
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parallelworks/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.54.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
|
".": {
|
|
@@ -58,6 +60,10 @@
|
|
|
58
60
|
"types": "./dist/file-explorer/index.d.ts",
|
|
59
61
|
"import": "./dist/file-explorer/index.js"
|
|
60
62
|
},
|
|
63
|
+
"./access": {
|
|
64
|
+
"types": "./dist/access/index.d.ts",
|
|
65
|
+
"import": "./dist/access/index.js"
|
|
66
|
+
},
|
|
61
67
|
"./ai": {
|
|
62
68
|
"types": "./dist/ai/index.d.ts",
|
|
63
69
|
"import": "./dist/ai/index.js"
|
|
@@ -96,6 +102,7 @@
|
|
|
96
102
|
"clsx": "^2.1.1",
|
|
97
103
|
"css-tree": "^3.2.1",
|
|
98
104
|
"dequal": "^2.0.3",
|
|
105
|
+
"katex": "^0.16.27",
|
|
99
106
|
"lucide-react": "1.52.0",
|
|
100
107
|
"luxon": "^3.7.2",
|
|
101
108
|
"react-zoom-pan-pinch": "^4.2.0",
|
|
@@ -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 };
|