@bigpixelrocket/uiok 0.3.0 → 0.5.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/CHANGELOG.md +50 -1
- package/dist/button/TextLink.d.ts +19 -3
- package/dist/button/TextLink.js +4 -3
- package/dist/dialog/ConfirmDialog.d.ts +7 -1
- package/dist/dialog/ConfirmDialog.js +2 -2
- package/dist/dialog/ModalDialog.js +8 -2
- package/dist/dialog/ProgressDialog.d.ts +7 -1
- package/dist/dialog/ProgressDialog.js +2 -2
- package/dist/dialog/TypedNameDialog.d.ts +8 -0
- package/dist/field/Check.d.ts +9 -2
- package/dist/field/Check.js +5 -4
- package/dist/field/Controls.d.ts +198 -0
- package/dist/field/Controls.js +94 -0
- package/dist/field/FieldLayout.d.ts +126 -0
- package/dist/field/FieldLayout.js +89 -0
- package/dist/field/index.d.ts +9 -6
- package/dist/field/index.js +9 -6
- package/dist/frame/Dock.js +1 -1
- package/dist/frame/SidebarResizer.js +1 -1
- package/dist/frame/Tree.d.ts +17 -4
- package/dist/frame/Tree.js +34 -9
- package/dist/frame/WindowFrame.js +2 -1
- package/dist/frame/frame.css +26 -4
- package/dist/icon/ProductMark.d.ts +57 -0
- package/dist/icon/ProductMark.js +26 -0
- package/dist/icon/icon.css +53 -0
- package/dist/icon/index.d.ts +3 -1
- package/dist/icon/index.js +3 -1
- package/dist/labels/UiokLabels.d.ts +3 -0
- package/dist/labels/UiokLabels.js +3 -1
- package/dist/labels/index.d.ts +1 -0
- package/dist/labels/index.js +1 -0
- package/dist/labels/settings.d.ts +6 -0
- package/dist/labels/settings.js +1 -0
- package/dist/labels/viewer.d.ts +193 -0
- package/dist/labels/viewer.js +124 -0
- package/dist/listing/Listing.d.ts +60 -4
- package/dist/listing/Listing.js +39 -10
- package/dist/listing/ListingScope.d.ts +7 -0
- package/dist/listing/ListingScope.js +8 -0
- package/dist/listing/PaneMessage.d.ts +28 -0
- package/dist/listing/PaneMessage.js +12 -0
- package/dist/listing/Timeline.d.ts +51 -0
- package/dist/listing/Timeline.js +28 -0
- package/dist/listing/index.d.ts +7 -3
- package/dist/listing/index.js +6 -2
- package/dist/listing/listing.css +185 -22
- package/dist/log/Ansi.logic.d.ts +27 -0
- package/dist/log/Ansi.logic.js +203 -0
- package/dist/log/LogWell.d.ts +11 -2
- package/dist/log/LogWell.js +15 -3
- package/dist/log/index.d.ts +1 -0
- package/dist/log/index.js +1 -0
- package/dist/log/log.css +80 -0
- package/dist/menu/Menu.d.ts +89 -0
- package/dist/menu/Menu.js +143 -0
- package/dist/menu/Menu.logic.d.ts +56 -0
- package/dist/menu/Menu.logic.js +64 -0
- package/dist/menu/index.d.ts +5 -1
- package/dist/menu/index.js +5 -1
- package/dist/menu/menu.css +51 -0
- package/dist/palette/Palette.d.ts +3 -2
- package/dist/palette/Palette.js +8 -4
- package/dist/palette/PaletteRows.d.ts +129 -0
- package/dist/palette/PaletteRows.js +74 -0
- package/dist/palette/index.d.ts +5 -2
- package/dist/palette/index.js +5 -2
- package/dist/pane/PaneFrame.d.ts +22 -1
- package/dist/pane/PaneFrame.js +42 -5
- package/dist/pane/index.d.ts +1 -1
- package/dist/shell/SettingsDialog.d.ts +20 -2
- package/dist/shell/SettingsDialog.js +13 -3
- package/dist/shell/index.d.ts +1 -1
- package/dist/styles.css +4 -0
- package/dist/surface/Card.d.ts +18 -0
- package/dist/surface/Card.js +10 -0
- package/dist/surface/FactTable.d.ts +44 -0
- package/dist/surface/FactTable.js +33 -0
- package/dist/surface/Notice.d.ts +45 -0
- package/dist/surface/Notice.js +27 -0
- package/dist/surface/index.d.ts +7 -3
- package/dist/surface/index.js +7 -3
- package/dist/surface/surface.css +64 -0
- package/dist/tabs/PageTabs.d.ts +6 -0
- package/dist/tabs/PageTabs.js +1 -1
- package/dist/tabs/tabs.css +14 -0
- package/dist/terminal/TerminalBox.d.ts +30 -0
- package/dist/terminal/TerminalBox.js +17 -0
- package/dist/terminal/index.d.ts +3 -1
- package/dist/terminal/index.js +3 -1
- package/dist/terminal/terminal.css +29 -0
- package/dist/themes/themes.generated.css +21 -0
- package/dist/themes/tokens.d.ts +1 -0
- package/dist/themes/tokens.js +16 -1
- package/dist/viewer/AudioView.d.ts +13 -0
- package/dist/viewer/AudioView.js +25 -0
- package/dist/viewer/HexJump.logic.d.ts +16 -0
- package/dist/viewer/HexJump.logic.js +27 -0
- package/dist/viewer/HexRows.logic.d.ts +55 -0
- package/dist/viewer/HexRows.logic.js +84 -0
- package/dist/viewer/HexSelection.logic.d.ts +57 -0
- package/dist/viewer/HexSelection.logic.js +68 -0
- package/dist/viewer/HexView.d.ts +10 -0
- package/dist/viewer/HexView.js +291 -0
- package/dist/viewer/HexViewport.logic.d.ts +61 -0
- package/dist/viewer/HexViewport.logic.js +79 -0
- package/dist/viewer/ImageView.d.ts +19 -0
- package/dist/viewer/ImageView.js +230 -0
- package/dist/viewer/ImageZoom.logic.d.ts +65 -0
- package/dist/viewer/ImageZoom.logic.js +119 -0
- package/dist/viewer/LatestRead.logic.d.ts +27 -0
- package/dist/viewer/LatestRead.logic.js +55 -0
- package/dist/viewer/MediaControls.d.ts +25 -0
- package/dist/viewer/MediaControls.js +183 -0
- package/dist/viewer/MediaPlayer.logic.d.ts +53 -0
- package/dist/viewer/MediaPlayer.logic.js +68 -0
- package/dist/viewer/PdfView.d.ts +23 -0
- package/dist/viewer/PdfView.js +25 -0
- package/dist/viewer/QuietFocus.d.ts +19 -0
- package/dist/viewer/QuietFocus.js +27 -0
- package/dist/viewer/ScaledScroll.logic.d.ts +30 -0
- package/dist/viewer/ScaledScroll.logic.js +28 -0
- package/dist/viewer/ScaledScrollbar.d.ts +19 -0
- package/dist/viewer/ScaledScrollbar.js +71 -0
- package/dist/viewer/SyntaxHighlighter.d.ts +29 -0
- package/dist/viewer/SyntaxHighlighter.js +144 -0
- package/dist/viewer/SyntaxLanguage.logic.d.ts +110 -0
- package/dist/viewer/SyntaxLanguage.logic.js +283 -0
- package/dist/viewer/SyntaxService.d.ts +75 -0
- package/dist/viewer/SyntaxService.js +49 -0
- package/dist/viewer/SyntaxSession.logic.d.ts +78 -0
- package/dist/viewer/SyntaxSession.logic.js +221 -0
- package/dist/viewer/SyntaxWorker.d.ts +6 -0
- package/dist/viewer/SyntaxWorker.js +8 -0
- package/dist/viewer/TextEncoding.logic.d.ts +35 -0
- package/dist/viewer/TextEncoding.logic.js +58 -0
- package/dist/viewer/TextRows.logic.d.ts +86 -0
- package/dist/viewer/TextRows.logic.js +241 -0
- package/dist/viewer/TextSelection.logic.d.ts +97 -0
- package/dist/viewer/TextSelection.logic.js +139 -0
- package/dist/viewer/TextView.d.ts +13 -0
- package/dist/viewer/TextView.js +448 -0
- package/dist/viewer/TextViewport.logic.d.ts +70 -0
- package/dist/viewer/TextViewport.logic.js +116 -0
- package/dist/viewer/VideoView.d.ts +18 -0
- package/dist/viewer/VideoView.js +53 -0
- package/dist/viewer/ViewerClipboard.d.ts +30 -0
- package/dist/viewer/ViewerClipboard.js +70 -0
- package/dist/viewer/ViewerFrame.logic.d.ts +61 -0
- package/dist/viewer/ViewerFrame.logic.js +130 -0
- package/dist/viewer/ViewerKeys.d.ts +16 -0
- package/dist/viewer/ViewerKeys.js +14 -0
- package/dist/viewer/ViewerScope.d.ts +12 -0
- package/dist/viewer/ViewerScope.js +22 -0
- package/dist/viewer/ViewerViews.d.ts +28 -0
- package/dist/viewer/ViewerViews.js +22 -0
- package/dist/viewer/ViewerWindow.d.ts +53 -0
- package/dist/viewer/ViewerWindow.js +219 -0
- package/dist/viewer/index.d.ts +12 -0
- package/dist/viewer/index.js +12 -0
- package/dist/viewer/types.d.ts +151 -0
- package/dist/viewer/types.js +26 -0
- package/dist/viewer/useElementHeight.d.ts +6 -0
- package/dist/viewer/useElementHeight.js +22 -0
- package/dist/viewer/useElementSize.d.ts +7 -0
- package/dist/viewer/useElementSize.js +24 -0
- package/dist/viewer/useEscapeToClear.d.ts +8 -0
- package/dist/viewer/useEscapeToClear.js +26 -0
- package/dist/viewer/useHexDocument.d.ts +41 -0
- package/dist/viewer/useHexDocument.js +144 -0
- package/dist/viewer/useMediaElement.d.ts +10 -0
- package/dist/viewer/useMediaElement.js +24 -0
- package/dist/viewer/useSyntaxHighlight.d.ts +24 -0
- package/dist/viewer/useSyntaxHighlight.js +133 -0
- package/dist/viewer/useTextDocument.d.ts +66 -0
- package/dist/viewer/useTextDocument.js +245 -0
- package/dist/viewer/viewer.css +645 -0
- package/package.json +7 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* What a `FieldRow` tells the one control it holds: the id its label names,
|
|
4
|
+
* the ids of what describes it (the problem, the note, and the help a
|
|
5
|
+
* screen reader reads as the control takes focus), and whether its value is
|
|
6
|
+
* wrong.
|
|
7
|
+
*/
|
|
8
|
+
export interface FieldRowWiring {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly describedBy: string | undefined;
|
|
11
|
+
readonly invalid: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The attributes a control takes from the `FieldRow` it stands in, with
|
|
15
|
+
* any it sets itself: its id (the row's, which its label names, so in a row
|
|
16
|
+
* give the id to `FieldRow`), `aria-describedby` (its own ids first), and
|
|
17
|
+
* `aria-invalid`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useFieldWiring(own: {
|
|
20
|
+
readonly id?: string | undefined;
|
|
21
|
+
readonly describedBy?: string | undefined;
|
|
22
|
+
readonly invalid?: boolean | undefined;
|
|
23
|
+
}): {
|
|
24
|
+
readonly id: string | undefined;
|
|
25
|
+
readonly 'aria-describedby': string | undefined;
|
|
26
|
+
readonly 'aria-invalid': true | undefined;
|
|
27
|
+
};
|
|
28
|
+
/** Props for {@link FieldGrid}. */
|
|
29
|
+
export interface FieldGridProps {
|
|
30
|
+
/** Its rows: `FieldRow`s, and any `FieldGroup` or line that spans both columns. */
|
|
31
|
+
readonly children: ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* The label column's width (`136px`, `12em`); by default as wide as the
|
|
34
|
+
* longest label, capped at 40% of the form.
|
|
35
|
+
*/
|
|
36
|
+
readonly labelWidth?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A form laid out as rows of a label and its value on one label column,
|
|
40
|
+
* each label centred on its control's first line. Draws `.field-grid`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function FieldGrid({ children, labelWidth }: FieldGridProps): ReactElement;
|
|
43
|
+
/** Props for {@link FieldRow}. */
|
|
44
|
+
export interface FieldRowProps {
|
|
45
|
+
/** What the field is for: "Host". */
|
|
46
|
+
readonly label: ReactNode;
|
|
47
|
+
/** A quieter second line under the label (which of two bands is in use). */
|
|
48
|
+
readonly labelDetail?: ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* What the control is for, as the label's tooltip and the control's
|
|
51
|
+
* accessible description (`labelHelp`); the label shows a dashed cue.
|
|
52
|
+
*/
|
|
53
|
+
readonly help?: string;
|
|
54
|
+
/**
|
|
55
|
+
* The value: one control (`TextField`, `Select`, …), which takes the
|
|
56
|
+
* row's id, note, problem, and help on its own, or `FieldOption` lines.
|
|
57
|
+
*/
|
|
58
|
+
readonly children: ReactNode;
|
|
59
|
+
/** One short line under the control on what the current choice does. */
|
|
60
|
+
readonly note?: ReactNode;
|
|
61
|
+
/** What is wrong with the value; marks the control invalid while set. */
|
|
62
|
+
readonly problem?: ReactNode;
|
|
63
|
+
/**
|
|
64
|
+
* Names a group of controls (radios, checks) rather than one: the label
|
|
65
|
+
* becomes the group's name, not a `<label>` for one control.
|
|
66
|
+
*/
|
|
67
|
+
readonly group?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* The control's id, when the app must know it; one is made otherwise. The
|
|
70
|
+
* row's id wins over one the control sets, so its label always names it.
|
|
71
|
+
*/
|
|
72
|
+
readonly id?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* One row of a `FieldGrid`: the label, then the value with its note and
|
|
76
|
+
* problem under it. The one control inside takes the label's id, the
|
|
77
|
+
* problem, note, and help as its description, and `aria-invalid` while a
|
|
78
|
+
* problem stands, with no wiring by the app. Draws
|
|
79
|
+
* `.field-label` and `.field-value` with `.field-note` and `.field-problem`.
|
|
80
|
+
*/
|
|
81
|
+
export declare function FieldRow({ label, labelDetail, help, children, note, problem, group, id }: FieldRowProps): ReactElement;
|
|
82
|
+
/** Props for {@link FieldOption}. */
|
|
83
|
+
export interface FieldOptionProps {
|
|
84
|
+
/** Choices or a field and its words, on one wrapping line. */
|
|
85
|
+
readonly children: ReactNode;
|
|
86
|
+
}
|
|
87
|
+
/** One line of a row's value (a field and a choice beside it), at least a control high. Draws `.field-option`. */
|
|
88
|
+
export declare function FieldOption({ children }: FieldOptionProps): ReactElement;
|
|
89
|
+
/** Props for {@link FieldNote} and {@link FieldProblem}. */
|
|
90
|
+
export interface FieldMessageProps {
|
|
91
|
+
/** Its words. */
|
|
92
|
+
readonly children: ReactNode;
|
|
93
|
+
/** Its id, for a control's `aria-describedby`. */
|
|
94
|
+
readonly id?: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* One short line under a control on what the current choice does ("Worn
|
|
98
|
+
* while the system is light."). Draws `.field-note`.
|
|
99
|
+
*/
|
|
100
|
+
export declare function FieldNote({ children, id }: FieldMessageProps): ReactElement;
|
|
101
|
+
/**
|
|
102
|
+
* What is wrong with a value, as a status line led by the danger glyph.
|
|
103
|
+
* Name it in the control's `aria-describedby` (`FieldRow` does). Draws
|
|
104
|
+
* `.field-problem`.
|
|
105
|
+
*/
|
|
106
|
+
export declare function FieldProblem({ children, id }: FieldMessageProps): ReactElement;
|
|
107
|
+
/** Props for {@link FieldGroup}. */
|
|
108
|
+
export interface FieldGroupProps {
|
|
109
|
+
/** The group's name, as its legend: "Show". */
|
|
110
|
+
readonly legend: ReactNode;
|
|
111
|
+
/** Speaks the legend without drawing it, for a group a row's label already names. */
|
|
112
|
+
readonly legendHidden?: boolean;
|
|
113
|
+
/** Its choices: `Check`s or `Radio`s with their labels. */
|
|
114
|
+
readonly children: ReactNode;
|
|
115
|
+
/** Lays the choices in this many columns of equal width, filled row by row. */
|
|
116
|
+
readonly columns?: number;
|
|
117
|
+
/** One short line under the choices. */
|
|
118
|
+
readonly note?: ReactNode;
|
|
119
|
+
/** What is wrong with the choice. */
|
|
120
|
+
readonly problem?: ReactNode;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* A group of choices under its legend, 4px apart, or in `columns`. Draws
|
|
124
|
+
* `fieldset.field-group` (`.field-columns`).
|
|
125
|
+
*/
|
|
126
|
+
export declare function FieldGroup({ legend, legendHidden, children, columns, note, problem }: FieldGroupProps): ReactElement;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, use, useId } from 'react';
|
|
3
|
+
import { VisuallyHidden } from '../VisuallyHidden.js';
|
|
4
|
+
import { labelHelp } from './labelHelp.js';
|
|
5
|
+
/** The wiring of the row a control stands in; null outside a `FieldRow`. */
|
|
6
|
+
const FieldRowContext = createContext(null);
|
|
7
|
+
/**
|
|
8
|
+
* The attributes a control takes from the `FieldRow` it stands in, with
|
|
9
|
+
* any it sets itself: its id (the row's, which its label names, so in a row
|
|
10
|
+
* give the id to `FieldRow`), `aria-describedby` (its own ids first), and
|
|
11
|
+
* `aria-invalid`.
|
|
12
|
+
*/
|
|
13
|
+
export function useFieldWiring(own) {
|
|
14
|
+
const row = use(FieldRowContext);
|
|
15
|
+
const describedBy = [own.describedBy, row?.describedBy].filter(Boolean).join(' ');
|
|
16
|
+
const invalid = own.invalid ?? row?.invalid ?? false;
|
|
17
|
+
return {
|
|
18
|
+
id: row?.id ?? own.id,
|
|
19
|
+
'aria-describedby': describedBy === '' ? undefined : describedBy,
|
|
20
|
+
'aria-invalid': invalid ? true : undefined
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A form laid out as rows of a label and its value on one label column,
|
|
25
|
+
* each label centred on its control's first line. Draws `.field-grid`.
|
|
26
|
+
*/
|
|
27
|
+
export function FieldGrid({ children, labelWidth }) {
|
|
28
|
+
return (_jsx("div", { className: "field-grid", style: labelWidth === undefined
|
|
29
|
+
? undefined
|
|
30
|
+
: { '--field-label-width': labelWidth }, children: children }));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* One row of a `FieldGrid`: the label, then the value with its note and
|
|
34
|
+
* problem under it. The one control inside takes the label's id, the
|
|
35
|
+
* problem, note, and help as its description, and `aria-invalid` while a
|
|
36
|
+
* problem stands, with no wiring by the app. Draws
|
|
37
|
+
* `.field-label` and `.field-value` with `.field-note` and `.field-problem`.
|
|
38
|
+
*/
|
|
39
|
+
export function FieldRow({ label, labelDetail, help, children, note, problem, group = false, id }) {
|
|
40
|
+
const made = useId();
|
|
41
|
+
const controlId = id ?? `${made}-control`;
|
|
42
|
+
const labelId = `${made}-label`;
|
|
43
|
+
const noteId = `${made}-note`;
|
|
44
|
+
const problemId = `${made}-problem`;
|
|
45
|
+
const helpId = `${made}-help`;
|
|
46
|
+
const hasNote = note !== undefined && note !== null && note !== false;
|
|
47
|
+
const hasProblem = problem !== undefined && problem !== null && problem !== false;
|
|
48
|
+
const helpParts = labelHelp(help);
|
|
49
|
+
// The help is read through aria-describedby with the note and problem, not
|
|
50
|
+
// as aria-description, which aria-describedby would override.
|
|
51
|
+
const describedBy = [hasProblem ? problemId : '', hasNote ? noteId : '', help ? helpId : '']
|
|
52
|
+
.filter(Boolean)
|
|
53
|
+
.join(' ');
|
|
54
|
+
const wiring = {
|
|
55
|
+
id: controlId,
|
|
56
|
+
describedBy: describedBy === '' ? undefined : describedBy,
|
|
57
|
+
invalid: hasProblem
|
|
58
|
+
};
|
|
59
|
+
const labelBody = (_jsxs(_Fragment, { children: [label, labelDetail === undefined ? null : (_jsx("span", { className: "settings-label-detail", children: labelDetail }))] }));
|
|
60
|
+
return (_jsxs(_Fragment, { children: [group ? (_jsx("span", { className: "field-label", id: labelId, ...helpParts.label, children: labelBody })) : (_jsx("label", { className: "field-label", htmlFor: controlId, id: labelId, ...helpParts.label, children: labelBody })), _jsxs("div", { "aria-describedby": group ? wiring.describedBy : undefined, "aria-labelledby": group ? labelId : undefined, className: "field-value", role: group ? 'group' : undefined, children: [_jsx(FieldRowContext, { value: group ? null : wiring, children: children }), hasProblem ? _jsx(FieldProblem, { id: problemId, children: problem }) : null, hasNote ? _jsx(FieldNote, { id: noteId, children: note }) : null, help ? _jsx(VisuallyHidden, { id: helpId, children: help }) : null] })] }));
|
|
61
|
+
}
|
|
62
|
+
/** One line of a row's value (a field and a choice beside it), at least a control high. Draws `.field-option`. */
|
|
63
|
+
export function FieldOption({ children }) {
|
|
64
|
+
return _jsx("div", { className: "field-option", children: children });
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* One short line under a control on what the current choice does ("Worn
|
|
68
|
+
* while the system is light."). Draws `.field-note`.
|
|
69
|
+
*/
|
|
70
|
+
export function FieldNote({ children, id }) {
|
|
71
|
+
return (_jsx("p", { className: "field-note", id: id, children: children }));
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* What is wrong with a value, as a status line led by the danger glyph.
|
|
75
|
+
* Name it in the control's `aria-describedby` (`FieldRow` does). Draws
|
|
76
|
+
* `.field-problem`.
|
|
77
|
+
*/
|
|
78
|
+
export function FieldProblem({ children, id }) {
|
|
79
|
+
return (_jsx("p", { className: "field-problem", id: id, children: children }));
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* A group of choices under its legend, 4px apart, or in `columns`. Draws
|
|
83
|
+
* `fieldset.field-group` (`.field-columns`).
|
|
84
|
+
*/
|
|
85
|
+
export function FieldGroup({ legend, legendHidden = false, children, columns, note, problem }) {
|
|
86
|
+
const made = useId();
|
|
87
|
+
const hasProblem = problem !== undefined && problem !== null && problem !== false;
|
|
88
|
+
return (_jsxs("fieldset", { "aria-describedby": hasProblem ? `${made}-problem` : undefined, className: columns === undefined ? 'field-group' : 'field-group field-columns', style: columns === undefined ? undefined : { '--field-columns': columns }, children: [_jsx("legend", { className: legendHidden ? 'visually-hidden' : undefined, children: legend }), children, hasProblem ? _jsx(FieldProblem, { id: `${made}-problem`, children: problem }) : null, note === undefined || note === null ? null : _jsx(FieldNote, { children: note })] }));
|
|
89
|
+
}
|
package/dist/field/index.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Form controls
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `labelHelp` puts a control's help in its
|
|
2
|
+
* Form controls as components over the shared field look (`field.css`):
|
|
3
|
+
* `TextField`, `TextArea`, `Select`, `FieldBox`, and `FieldEditor` in the
|
|
4
|
+
* field's well; `Check`, `Radio`, and `Switch`; `Range` and `Meter`; and the
|
|
5
|
+
* form's layout, `FieldGrid` of `FieldRow`s (label, value, note, problem,
|
|
6
|
+
* wired to the control on their own), `FieldOption`, `FieldGroup`,
|
|
7
|
+
* `FieldNote`, and `FieldProblem`. `labelHelp` puts a control's help in its
|
|
8
|
+
* label's tooltip; `RestoreDefault` sets a changed setting back.
|
|
8
9
|
*/
|
|
9
10
|
export { Check, type CheckProps } from './Check.js';
|
|
11
|
+
export { FieldBox, FieldEditor, Meter, Radio, Range, RestoreDefault, Select, TextArea, TextField, type FieldBoxProps, type FieldEditorProps, type FieldSize, type FieldTone, type FieldWidth, type MeterProps, type RadioProps, type RangeProps, type RestoreDefaultProps, type SelectOption, type SelectOptionGroup, type SelectProps, type TextAreaProps, type TextFieldProps } from './Controls.js';
|
|
12
|
+
export { FieldGrid, FieldGroup, FieldNote, FieldOption, FieldProblem, FieldRow, useFieldWiring, type FieldGridProps, type FieldGroupProps, type FieldMessageProps, type FieldOptionProps, type FieldRowProps, type FieldRowWiring } from './FieldLayout.js';
|
|
10
13
|
export { labelHelp, type LabelHelp } from './labelHelp.js';
|
|
11
14
|
export { Switch, type SwitchProps } from './Switch.js';
|
package/dist/field/index.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Form controls
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `labelHelp` puts a control's help in its
|
|
2
|
+
* Form controls as components over the shared field look (`field.css`):
|
|
3
|
+
* `TextField`, `TextArea`, `Select`, `FieldBox`, and `FieldEditor` in the
|
|
4
|
+
* field's well; `Check`, `Radio`, and `Switch`; `Range` and `Meter`; and the
|
|
5
|
+
* form's layout, `FieldGrid` of `FieldRow`s (label, value, note, problem,
|
|
6
|
+
* wired to the control on their own), `FieldOption`, `FieldGroup`,
|
|
7
|
+
* `FieldNote`, and `FieldProblem`. `labelHelp` puts a control's help in its
|
|
8
|
+
* label's tooltip; `RestoreDefault` sets a changed setting back.
|
|
8
9
|
*/
|
|
9
10
|
export { Check } from './Check.js';
|
|
11
|
+
export { FieldBox, FieldEditor, Meter, Radio, Range, RestoreDefault, Select, TextArea, TextField } from './Controls.js';
|
|
12
|
+
export { FieldGrid, FieldGroup, FieldNote, FieldOption, FieldProblem, FieldRow, useFieldWiring } from './FieldLayout.js';
|
|
10
13
|
export { labelHelp } from './labelHelp.js';
|
|
11
14
|
export { Switch } from './Switch.js';
|
package/dist/frame/Dock.js
CHANGED
|
@@ -107,7 +107,7 @@ export function Dock({ open, label, height, pageMin = 160, active = false, tone,
|
|
|
107
107
|
const classes = ['pane', 'window-dock', active ? 'active' : '', open ? '' : 'closed']
|
|
108
108
|
.filter(Boolean)
|
|
109
109
|
.join(' ');
|
|
110
|
-
return (_jsxs("section", { "aria-label": label, className: classes, "data-tone": tone, ref: attach, style: { height: shown }, ...handlers, children: [onResize === undefined ? null : (_jsx("div", { "aria-label": resizeLabel, "aria-orientation": "horizontal",
|
|
110
|
+
return (_jsxs("section", { "aria-label": label, className: classes, "data-tone": tone, ref: attach, style: { height: shown }, ...handlers, children: [onResize === undefined ? null : (_jsx("div", { "aria-label": resizeLabel, "aria-orientation": "horizontal", className: "pane-splitter", onPointerDown: start, role: "separator" })), drawn(bar) ? _jsx("div", { className: "dock-bar", children: bar }) : null, _jsx("div", { className: "dock-body", children: children })] }));
|
|
111
111
|
}
|
|
112
112
|
/**
|
|
113
113
|
* A dock's log: its entries over a hairline each, the newest at the foot;
|
|
@@ -39,5 +39,5 @@ export function SidebarResizer({ width, min, max, pageMin, label, onResize, onRe
|
|
|
39
39
|
handle.addEventListener('pointerup', end);
|
|
40
40
|
handle.addEventListener('pointercancel', end);
|
|
41
41
|
};
|
|
42
|
-
return (_jsx("div", { "aria-label": label, "aria-orientation": "vertical",
|
|
42
|
+
return (_jsx("div", { "aria-label": label, "aria-orientation": "vertical", className: "window-frame-resizer", onPointerDown: start, role: "separator" }));
|
|
43
43
|
}
|
package/dist/frame/Tree.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type LucideIcon } from 'lucide-react';
|
|
2
2
|
import { type KeyboardEvent, type ReactElement, type ReactNode, type Ref } from 'react';
|
|
3
3
|
import type { RegionHandlers } from '../pane/Pane.js';
|
|
4
4
|
/** Props for {@link TreePane}. */
|
|
@@ -73,6 +73,12 @@ export interface TreeRowProps {
|
|
|
73
73
|
readonly onOpen?: () => void;
|
|
74
74
|
/** The row itself takes the focus: in the Tab order while it is the cursor row. */
|
|
75
75
|
readonly focusable?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* The row adds one under its parent ("Add runtime…"): an accent plus in
|
|
78
|
+
* the glyph's slot unless `glyph` gives another, and dim words that turn
|
|
79
|
+
* full under the pointer and on the cursor row, as a listing's add row.
|
|
80
|
+
*/
|
|
81
|
+
readonly add?: boolean;
|
|
76
82
|
}
|
|
77
83
|
/**
|
|
78
84
|
* One row of a sidebar's tree: the chevron's slot, the glyph, the name (cut
|
|
@@ -83,7 +89,7 @@ export interface TreeRowProps {
|
|
|
83
89
|
* the cursor there. Its controls leave the Tab order, since the tree's keys
|
|
84
90
|
* run them. The expansion and its keys stay the host's.
|
|
85
91
|
*/
|
|
86
|
-
export declare function TreeRow({ rowKey, level, kind, toggle, glyph, name, detail, trailing, tool, marked, onOpen, focusable }: TreeRowProps): ReactElement;
|
|
92
|
+
export declare function TreeRow({ rowKey, level, kind, toggle, glyph, name, detail, trailing, tool, marked, onOpen, focusable, add }: TreeRowProps): ReactElement;
|
|
87
93
|
/**
|
|
88
94
|
* What a tree's tool row is: a plain tool (a filter field, a pager, an Add
|
|
89
95
|
* action), a note under a node (past the chevron's slot), a heading over a
|
|
@@ -100,7 +106,14 @@ export interface TreeToolProps {
|
|
|
100
106
|
readonly icon?: LucideIcon;
|
|
101
107
|
/** Its words. */
|
|
102
108
|
readonly text?: ReactNode;
|
|
103
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* Its key among the tree's rows, which joins it to the pane's cursor
|
|
111
|
+
* (`RowCursorContext`) as a `TreeRow` is: the cursor's keys reach it and
|
|
112
|
+
* the pointer moves the cursor to it. Without one it stands outside the
|
|
113
|
+
* cursor, which `cursor` then draws.
|
|
114
|
+
*/
|
|
115
|
+
readonly rowKey?: string;
|
|
116
|
+
/** The pane's cursor stands on it, for a tool row without a `rowKey`. */
|
|
104
117
|
readonly cursor?: boolean;
|
|
105
118
|
/** Its control after the words: a `TreeFilterInput`, a pager, an action. */
|
|
106
119
|
readonly children?: ReactNode;
|
|
@@ -110,7 +123,7 @@ export interface TreeToolProps {
|
|
|
110
123
|
* size: a filter field, a pager, a note, a heading, or a failed read with
|
|
111
124
|
* its action.
|
|
112
125
|
*/
|
|
113
|
-
export declare function TreeTool({ kind, level, icon: Icon, text, cursor, children }: TreeToolProps): ReactElement;
|
|
126
|
+
export declare function TreeTool({ kind, level, icon: Icon, text, rowKey, cursor: cursorOn, children }: TreeToolProps): ReactElement;
|
|
114
127
|
/** Props for {@link TreeFilterInput}. */
|
|
115
128
|
export interface TreeFilterInputProps {
|
|
116
129
|
readonly value: string;
|
package/dist/frame/Tree.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Plus } from 'lucide-react';
|
|
2
3
|
import { createContext, useCallback, useContext, useId, useLayoutEffect, useMemo, useRef, useSyncExternalStore } from 'react';
|
|
3
4
|
import { ICON_MD } from '../icon/sizes.js';
|
|
4
5
|
import { RowCursorContext } from '../listing/Listing.js';
|
|
@@ -40,9 +41,14 @@ export function TreeList({ label, ref, children, ...handlers }) {
|
|
|
40
41
|
return;
|
|
41
42
|
const key = cursor.current();
|
|
42
43
|
const id = key === null ? null : rowId(tree, key);
|
|
43
|
-
// One lookup by id
|
|
44
|
-
//
|
|
45
|
-
|
|
44
|
+
// One lookup by id in the tree's own root (the document, or the shadow
|
|
45
|
+
// root it is mounted in, where the document cannot see), never a scan
|
|
46
|
+
// of the rows; the tree's prefix makes the id unique there. A tree not
|
|
47
|
+
// yet attached has no such root, and nothing to name.
|
|
48
|
+
// Asked by shape, not instanceof, so a tree React renders into another
|
|
49
|
+
// window's document (a same-origin frame) finds its row too.
|
|
50
|
+
const root = element.getRootNode();
|
|
51
|
+
const row = id === null || typeof root.getElementById !== 'function' ? null : root.getElementById(id);
|
|
46
52
|
const drawnRow = row !== null && element.contains(row);
|
|
47
53
|
if (drawnRow && id !== null)
|
|
48
54
|
element.setAttribute('aria-activedescendant', id);
|
|
@@ -82,7 +88,7 @@ export function TreeList({ label, ref, children, ...handlers }) {
|
|
|
82
88
|
* the cursor there. Its controls leave the Tab order, since the tree's keys
|
|
83
89
|
* run them. The expansion and its keys stay the host's.
|
|
84
90
|
*/
|
|
85
|
-
export function TreeRow({ rowKey, level = 0, kind = 'node', toggle, glyph, name, detail, trailing, tool, marked = false, onOpen, focusable = false }) {
|
|
91
|
+
export function TreeRow({ rowKey, level = 0, kind = 'node', toggle, glyph, name, detail, trailing, tool, marked = false, onOpen, focusable = false, add = false }) {
|
|
86
92
|
const cursor = useContext(RowCursorContext);
|
|
87
93
|
const tree = useContext(TreeIdContext);
|
|
88
94
|
const current = useSyncExternalStore(cursor.subscribe, () => cursor.current() === rowKey);
|
|
@@ -99,31 +105,50 @@ export function TreeRow({ rowKey, level = 0, kind = 'node', toggle, glyph, name,
|
|
|
99
105
|
kind === 'band' ? 'tree-band' : '',
|
|
100
106
|
kind === 'group' ? 'tree-group' : '',
|
|
101
107
|
current ? 'cursor' : '',
|
|
102
|
-
marked ? 'marked' : ''
|
|
108
|
+
marked ? 'marked' : '',
|
|
109
|
+
add ? 'pane-add' : ''
|
|
103
110
|
]
|
|
104
111
|
.filter(Boolean)
|
|
105
112
|
.join(' ');
|
|
106
113
|
return (_jsx(InListingRowContext.Provider, { value: true, children: _jsx(InRowContext.Provider, { value: true, children: _jsxs("div", { "aria-current": current ? 'true' : undefined, "aria-expanded": toggle === undefined ? undefined : toggle.open, "aria-level": level + 1, "aria-selected": marked, className: classes, "data-row-key": rowKey, id: tree === null ? undefined : rowId(tree.id, rowKey), onClick: onOpen, onFocus: () => cursor.point(rowKey), onPointerMove: () => {
|
|
107
114
|
if (!current)
|
|
108
115
|
cursor.point(rowKey);
|
|
109
|
-
}, role: "treeitem", style: levelStyle(level), tabIndex: focusable ? (current ? 0 : -1) : undefined, children: [toggle === undefined ? (_jsx("span", { "aria-hidden": true, className: "row-icon" })) : (_jsx(TreeToggle, { label: toggle.label, onToggle: toggle.onToggle, open: toggle.open })), _jsx("span", { "aria-hidden": true, className: "tree-glyph", children: glyph }), _jsxs("span", { className: "row-name tree-name", ...(typeof name === 'string' && detail === undefined ? cutTooltip(name) : {}), children: [name, detail === undefined ? null : (_jsxs(_Fragment, { children: [' ', _jsx("span", { className: "tree-detail", children: detail })] }))] }), _jsxs("span", { className: "row-meta align-right", children: [trailing, tool === undefined ? null : _jsx("span", { className: "tree-row-tool", children: tool })] })] }) }) }));
|
|
116
|
+
}, role: "treeitem", style: levelStyle(level), tabIndex: focusable ? (current ? 0 : -1) : undefined, children: [toggle === undefined ? (_jsx("span", { "aria-hidden": true, className: "row-icon" })) : (_jsx(TreeToggle, { label: toggle.label, onToggle: toggle.onToggle, open: toggle.open })), _jsx("span", { "aria-hidden": true, className: "tree-glyph", children: glyph === undefined && add ? _jsx(Plus, { size: ICON_MD }) : glyph }), _jsxs("span", { className: "row-name tree-name", ...(typeof name === 'string' && detail === undefined ? cutTooltip(name) : {}), children: [name, detail === undefined ? null : (_jsxs(_Fragment, { children: [' ', _jsx("span", { className: "tree-detail", children: detail })] }))] }), _jsxs("span", { className: "row-meta align-right", children: [trailing, tool === undefined ? null : _jsx("span", { className: "tree-row-tool", children: tool })] })] }) }) }));
|
|
110
117
|
}
|
|
111
118
|
/**
|
|
112
119
|
* A row of a tree that is not a node, at its level's indent in the small
|
|
113
120
|
* size: a filter field, a pager, a note, a heading, or a failed read with
|
|
114
121
|
* its action.
|
|
115
122
|
*/
|
|
116
|
-
export function TreeTool({ kind = 'tool', level = 0, icon: Icon, text, cursor = false, children }) {
|
|
123
|
+
export function TreeTool({ kind = 'tool', level = 0, icon: Icon, text, rowKey, cursor: cursorOn = false, children }) {
|
|
124
|
+
const cursor = useContext(RowCursorContext);
|
|
125
|
+
const tree = useContext(TreeIdContext);
|
|
126
|
+
const current = useSyncExternalStore(cursor.subscribe, () => rowKey !== undefined && cursor.current() === rowKey);
|
|
127
|
+
useLayoutEffect(() => {
|
|
128
|
+
if (rowKey === undefined)
|
|
129
|
+
return;
|
|
130
|
+
cursor.rowsChanged?.();
|
|
131
|
+
tree?.rowsChanged();
|
|
132
|
+
return () => {
|
|
133
|
+
cursor.rowsChanged?.();
|
|
134
|
+
tree?.rowsChanged();
|
|
135
|
+
};
|
|
136
|
+
}, [cursor, rowKey, tree]);
|
|
117
137
|
const classes = [
|
|
118
138
|
'tree-tool',
|
|
119
139
|
kind === 'note' ? 'tree-note' : '',
|
|
120
140
|
kind === 'heading' ? 'tree-heading' : '',
|
|
121
141
|
kind === 'danger' ? 'danger' : '',
|
|
122
|
-
|
|
142
|
+
current || (rowKey === undefined && cursorOn) ? 'cursor' : ''
|
|
123
143
|
]
|
|
124
144
|
.filter(Boolean)
|
|
125
145
|
.join(' ');
|
|
126
|
-
return (_jsxs("div", { className: classes,
|
|
146
|
+
return (_jsxs("div", { className: classes, "data-row-key": rowKey, id: rowKey === undefined || tree === null ? undefined : rowId(tree.id, rowKey), onPointerMove: rowKey === undefined
|
|
147
|
+
? undefined
|
|
148
|
+
: () => {
|
|
149
|
+
if (!current)
|
|
150
|
+
cursor.point(rowKey);
|
|
151
|
+
}, "aria-level": rowKey === undefined ? undefined : level + 1, role: rowKey !== undefined ? 'treeitem' : kind === 'danger' ? 'alert' : undefined, style: levelStyle(level), children: [Icon === undefined ? null : (_jsx("span", { "aria-hidden": true, className: "tree-note-glyph", children: _jsx(Icon, { size: ICON_MD }) })), text === undefined ? null : (_jsx("span", { className: "tree-note-text", role: rowKey !== undefined && kind === 'danger' ? 'alert' : undefined, children: text })), children] }));
|
|
127
152
|
}
|
|
128
153
|
/**
|
|
129
154
|
* A tree's filter field: a bare field that fills its `TreeTool` row, the
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ListingScopeContext } from '../listing/ListingScope.js';
|
|
2
3
|
/** Whether a slot was given something to draw: idiomatic `cond && <Part />` passes false for none. */
|
|
3
4
|
export const drawn = (node) => node !== null && node !== undefined && node !== false && node !== '';
|
|
4
5
|
/**
|
|
@@ -15,5 +16,5 @@ export const drawn = (node) => node !== null && node !== undefined && node !== f
|
|
|
15
16
|
export function WindowFrame({ brand, sidebar = null, resizer = null, sidebarWidth, main, tray = null, dock = null, legend = null, trailing = null, group }) {
|
|
16
17
|
const shown = drawn(sidebar);
|
|
17
18
|
const parts = (_jsxs(_Fragment, { children: [shown ? _jsx("div", { className: "window-frame-slot window-frame-sidebar", children: sidebar }) : null, shown ? resizer : null, _jsx("div", { className: "window-frame-slot window-frame-main", children: main }), drawn(tray) ? _jsx("div", { className: "window-frame-slot window-frame-tray", children: tray }) : null, drawn(dock) ? _jsx("div", { className: "window-frame-slot window-frame-dock", children: dock }) : null] }));
|
|
18
|
-
return (_jsxs("div", { className: "window-frame space-root listing-root", "data-sidebar": shown ? 'shown' : 'hidden', style: { '--window-band-width': `${sidebarWidth}px` }, children: [_jsxs("div", { className: "window-frame-band", children: [_jsx("div", { className: "window-frame-band-lead", children: brand }), _jsx("span", { "aria-hidden": true, className: "window-frame-band-rest" }), drawn(trailing) ? _jsx("div", { className: "shell-trailing", children: trailing }) : null] }), group === undefined ? (parts) : (_jsx("div", { className: "window-frame-group", ...group, children: parts })), drawn(legend) ? _jsx("div", { className: "window-frame-legend", children: legend }) : null] }));
|
|
19
|
+
return (_jsx(ListingScopeContext, { value: true, children: _jsxs("div", { className: "window-frame space-root listing-root", "data-sidebar": shown ? 'shown' : 'hidden', style: { '--window-band-width': `${sidebarWidth}px` }, children: [_jsxs("div", { className: "window-frame-band", children: [_jsx("div", { className: "window-frame-band-lead", children: brand }), _jsx("span", { "aria-hidden": true, className: "window-frame-band-rest" }), drawn(trailing) ? _jsx("div", { className: "shell-trailing", children: trailing }) : null] }), group === undefined ? (parts) : (_jsx("div", { className: "window-frame-group", ...group, children: parts })), drawn(legend) ? _jsx("div", { className: "window-frame-legend", children: legend }) : null] }) }));
|
|
19
20
|
}
|
package/dist/frame/frame.css
CHANGED
|
@@ -341,7 +341,9 @@
|
|
|
341
341
|
--row-fill: var(--strip);
|
|
342
342
|
}
|
|
343
343
|
|
|
344
|
-
/* The disclosure chevron in a row's first column (`TreeToggle`)
|
|
344
|
+
/* The disclosure chevron in a row's first column (`TreeToggle`), in the
|
|
345
|
+
rows' dim icon tone (a row's words may be darker). One class, so the
|
|
346
|
+
cursor, mark, selection, and hover tones over a row's icon still win. */
|
|
345
347
|
.tree-chev {
|
|
346
348
|
display: inline-flex;
|
|
347
349
|
align-items: center;
|
|
@@ -350,7 +352,7 @@
|
|
|
350
352
|
border: 0;
|
|
351
353
|
border-radius: var(--radius-xs);
|
|
352
354
|
background: none;
|
|
353
|
-
color:
|
|
355
|
+
color: var(--text-dim);
|
|
354
356
|
}
|
|
355
357
|
|
|
356
358
|
.tree-chev:hover {
|
|
@@ -385,8 +387,10 @@
|
|
|
385
387
|
color: var(--row-meta-text);
|
|
386
388
|
}
|
|
387
389
|
|
|
388
|
-
/* On a cursor or marked row the quiet words take the surface's text
|
|
389
|
-
|
|
390
|
+
/* On a cursor or marked row the quiet words take the surface's text, and
|
|
391
|
+
the glyph too but on an add row, which keeps its accent plus. */
|
|
392
|
+
.row:is(.cursor, .marked):where(:not(.selected)) .tree-detail,
|
|
393
|
+
.row:is(.cursor, .marked):where(:not(.selected, .pane-add)) .tree-glyph,
|
|
390
394
|
.tree-tool.cursor,
|
|
391
395
|
.tree-tool.cursor .tree-note-glyph {
|
|
392
396
|
color: var(--text-on-surface);
|
|
@@ -462,6 +466,14 @@
|
|
|
462
466
|
);
|
|
463
467
|
}
|
|
464
468
|
|
|
469
|
+
/* A tree note that is also a listing's empty line (`.pane-message.empty`,
|
|
470
|
+
"No tables") keeps the tree's size and padding, which that two-class
|
|
471
|
+
rule would otherwise replace with the rows' size and no padding. */
|
|
472
|
+
.tree-tool.pane-message.empty {
|
|
473
|
+
padding-block: var(--space-1);
|
|
474
|
+
font-size: var(--font-size-small);
|
|
475
|
+
}
|
|
476
|
+
|
|
465
477
|
/* A heading over a group of rows further down the tree. */
|
|
466
478
|
.tree-tool.tree-heading {
|
|
467
479
|
margin-top: var(--space-3);
|
|
@@ -505,6 +517,16 @@
|
|
|
505
517
|
text-overflow: ellipsis;
|
|
506
518
|
}
|
|
507
519
|
|
|
520
|
+
/* Its row's underline shows the focus, so no field ring: two classes'
|
|
521
|
+
weight, past the base stylesheet's ring, which comes later. Forced
|
|
522
|
+
colours draw no shadow, so there the underline is gone and the ring
|
|
523
|
+
stays. */
|
|
524
|
+
@media (forced-colors: none) {
|
|
525
|
+
.tree-filter-input:focus-visible {
|
|
526
|
+
outline: 0;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
|
|
508
530
|
/* ---- A pane's quick row ---- */
|
|
509
531
|
|
|
510
532
|
/* A row of quiet buttons under a pane's path bar (FilterChips: the tree's
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { LucideIcon } from 'lucide-react';
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* A product's brand mark as data: what the app knows about a product (a
|
|
5
|
+
* language, a database, a tool) and hands the library to draw. The library
|
|
6
|
+
* ships no marks and no brand colours of its own.
|
|
7
|
+
*/
|
|
8
|
+
export interface ProductMarkShape {
|
|
9
|
+
/** The product's name: the mark's tooltip, and its accessible name where it stands alone. */
|
|
10
|
+
readonly title: string;
|
|
11
|
+
/** The mark's path data, on a 24-unit square (`viewBox` changes the part shown). */
|
|
12
|
+
readonly path: string;
|
|
13
|
+
/**
|
|
14
|
+
* The brand's colour as a CSS colour (`#777bb4`), or `currentColor` for a
|
|
15
|
+
* mark published in plain black, which then follows the quiet icon tone.
|
|
16
|
+
* The theme decides how much of it shows (`--product-mark-mix`).
|
|
17
|
+
*/
|
|
18
|
+
readonly colour: string;
|
|
19
|
+
/**
|
|
20
|
+
* The part of the artwork to show, when a published mark pairs a symbol
|
|
21
|
+
* with a wordmark that would not read at glyph size; `0 0 24 24` when
|
|
22
|
+
* absent.
|
|
23
|
+
*/
|
|
24
|
+
readonly viewBox?: string;
|
|
25
|
+
/**
|
|
26
|
+
* An outline drawn round the shape in its own colour, in viewBox units,
|
|
27
|
+
* for a mark published in lines too fine to read at row size.
|
|
28
|
+
*/
|
|
29
|
+
readonly stroke?: number;
|
|
30
|
+
}
|
|
31
|
+
/** Props for {@link ProductMark}. */
|
|
32
|
+
export interface ProductMarkProps {
|
|
33
|
+
/** The product's mark; null or absent draws `fallback` instead. */
|
|
34
|
+
readonly mark?: ProductMarkShape | null;
|
|
35
|
+
/**
|
|
36
|
+
* The glyph drawn when there is no mark (a database's, a terminal's), in
|
|
37
|
+
* the quiet icon tone at the icon size.
|
|
38
|
+
*/
|
|
39
|
+
readonly fallback?: LucideIcon;
|
|
40
|
+
/**
|
|
41
|
+
* The mark's name for assistive technology, for a mark that stands alone;
|
|
42
|
+
* absent, the mark is decorative, since the name beside it says it.
|
|
43
|
+
*/
|
|
44
|
+
readonly label?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A product's mark beside its name (a row's icon, a crumb, a palette's
|
|
48
|
+
* option): the brand's path in the brand's colour, mixed toward the text
|
|
49
|
+
* tone as far as the theme asks (`--product-mark-mix`: none in a light
|
|
50
|
+
* theme, some in a dark one, where a dark brand colour would sink), at the
|
|
51
|
+
* icon size (`--icon-md`), with the product's name as its tooltip. With
|
|
52
|
+
* no mark it draws `fallback`, a lucide glyph in the quiet icon tone, or
|
|
53
|
+
* nothing. The app owns the marks and their colours and passes one in, so
|
|
54
|
+
* the library stays free of any product list. Draws `.product-mark`
|
|
55
|
+
* (`.glyph` for a fallback), with `--product-mark-colour`.
|
|
56
|
+
*/
|
|
57
|
+
export declare function ProductMark({ mark, fallback: Fallback, label }: ProductMarkProps): ReactElement;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { tooltip } from '../tooltip/Tooltip.logic.js';
|
|
3
|
+
import { ICON_MD } from './sizes.js';
|
|
4
|
+
/**
|
|
5
|
+
* A product's mark beside its name (a row's icon, a crumb, a palette's
|
|
6
|
+
* option): the brand's path in the brand's colour, mixed toward the text
|
|
7
|
+
* tone as far as the theme asks (`--product-mark-mix`: none in a light
|
|
8
|
+
* theme, some in a dark one, where a dark brand colour would sink), at the
|
|
9
|
+
* icon size (`--icon-md`), with the product's name as its tooltip. With
|
|
10
|
+
* no mark it draws `fallback`, a lucide glyph in the quiet icon tone, or
|
|
11
|
+
* nothing. The app owns the marks and their colours and passes one in, so
|
|
12
|
+
* the library stays free of any product list. Draws `.product-mark`
|
|
13
|
+
* (`.glyph` for a fallback), with `--product-mark-colour`.
|
|
14
|
+
*/
|
|
15
|
+
export function ProductMark({ mark = null, fallback: Fallback, label }) {
|
|
16
|
+
const naming = label === undefined
|
|
17
|
+
? { 'aria-hidden': true }
|
|
18
|
+
: { 'aria-label': label, role: 'img' };
|
|
19
|
+
if (mark === null) {
|
|
20
|
+
return (_jsx("span", { className: "product-mark glyph", ...naming, ...(label === undefined ? {} : tooltip(label)), children: Fallback === undefined ? null : _jsx(Fallback, { "aria-hidden": true, size: ICON_MD }) }));
|
|
21
|
+
}
|
|
22
|
+
return (_jsx("span", { className: "product-mark", style: {
|
|
23
|
+
'--product-mark-colour': mark.colour,
|
|
24
|
+
...(mark.stroke === undefined ? {} : { '--product-mark-stroke': mark.stroke })
|
|
25
|
+
}, ...naming, ...tooltip(label ?? mark.title), children: _jsx("svg", { "aria-hidden": true, viewBox: mark.viewBox ?? '0 0 24 24', children: _jsx("path", { className: mark.stroke === undefined ? undefined : 'product-mark-outline', d: mark.path }) }) }));
|
|
26
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/* ---- Product marks (ProductMark) ----
|
|
2
|
+
|
|
3
|
+
A product's brand mark at the icon size, beside its name in a row, a
|
|
4
|
+
crumb, or a palette's option. The brand colour is the app's data
|
|
5
|
+
(--product-mark-colour, set on the mark); how much of it shows is the
|
|
6
|
+
theme's (--product-mark-mix), the rest the text tone, so a dark brand
|
|
7
|
+
colour still reads on a dark ground. A mark with no colour of its own
|
|
8
|
+
(currentColor) and a fallback glyph take the quiet icon tone, at zero
|
|
9
|
+
weight; in a row's icon column they take that column's tone instead,
|
|
10
|
+
so they rise with it on the cursor and turn with it on a selection. */
|
|
11
|
+
.product-mark {
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
flex: none;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
width: var(--icon-md);
|
|
17
|
+
height: var(--icon-md);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:where(.product-mark) {
|
|
21
|
+
color: var(--text-dim);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:where(.row-icon, .tree-glyph) > .product-mark {
|
|
25
|
+
color: inherit;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.product-mark > svg {
|
|
29
|
+
--product-mark-fill: color-mix(
|
|
30
|
+
in srgb,
|
|
31
|
+
var(--product-mark-colour, currentColor) var(--product-mark-mix),
|
|
32
|
+
var(--text)
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
width: var(--icon-md);
|
|
36
|
+
height: var(--icon-md);
|
|
37
|
+
fill: var(--product-mark-fill);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* A mark published in hairlines gains an outline of its own colour,
|
|
41
|
+
rounded so its joins stay smooth; its width is in viewBox units, which
|
|
42
|
+
CSS pixels are inside an svg. */
|
|
43
|
+
.product-mark .product-mark-outline {
|
|
44
|
+
stroke: var(--product-mark-fill);
|
|
45
|
+
stroke-width: calc(var(--product-mark-stroke) * 1px);
|
|
46
|
+
stroke-linejoin: round;
|
|
47
|
+
stroke-linecap: round;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* A fallback glyph is an icon: its strokes are lucide's, unfilled. */
|
|
51
|
+
.product-mark.glyph > svg {
|
|
52
|
+
fill: none;
|
|
53
|
+
}
|