@bigpixelrocket/uiok 0.5.0 → 0.7.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 +72 -1
- package/dist/button/TextLink.d.ts +21 -2
- package/dist/button/TextLink.js +14 -3
- package/dist/button/button.css +7 -0
- package/dist/dialog/SectionedDialog.d.ts +37 -0
- package/dist/dialog/SectionedDialog.js +158 -0
- package/dist/dialog/dialog.css +102 -0
- package/dist/dialog/index.d.ts +4 -2
- package/dist/dialog/index.js +4 -2
- package/dist/field/FieldLayout.d.ts +3 -2
- package/dist/field/FieldLayout.js +8 -3
- package/dist/frame/AppRoot.d.ts +1 -1
- package/dist/frame/AppRoot.js +2 -1
- package/dist/frame/Dock.d.ts +1 -1
- package/dist/frame/Dock.js +2 -1
- package/dist/frame/FilterChips.d.ts +5 -2
- package/dist/frame/FilterChips.js +35 -2
- package/dist/frame/FilterChips.logic.d.ts +24 -0
- package/dist/frame/FilterChips.logic.js +34 -0
- package/dist/frame/PageParts.d.ts +4 -3
- package/dist/frame/PageParts.js +10 -3
- package/dist/frame/SideBySide.d.ts +33 -0
- package/dist/frame/SideBySide.js +62 -0
- package/dist/frame/Tree.d.ts +20 -7
- package/dist/frame/Tree.js +21 -8
- package/dist/frame/WindowFrame.d.ts +1 -1
- package/dist/frame/WindowFrame.js +2 -1
- package/dist/frame/frame.css +56 -1
- package/dist/frame/index.d.ts +4 -2
- package/dist/frame/index.js +4 -2
- package/dist/grid/grid.css +1 -0
- package/dist/keyboard/Keyboard.logic.js +20 -3
- package/dist/keychord/KeyChord.d.ts +21 -4
- package/dist/keychord/KeyChord.js +24 -5
- package/dist/keychord/ShortcutIndex.d.ts +49 -0
- package/dist/keychord/ShortcutIndex.js +28 -0
- package/dist/keychord/index.d.ts +8 -2
- package/dist/keychord/index.js +8 -2
- package/dist/keychord/keychord.css +101 -0
- package/dist/labels/dialog.d.ts +2 -0
- package/dist/labels/dialog.js +2 -1
- package/dist/labels/keys.d.ts +5 -0
- package/dist/labels/keys.js +2 -1
- package/dist/legend/legend.css +6 -10
- package/dist/listing/Listing.d.ts +54 -4
- package/dist/listing/Listing.js +61 -7
- package/dist/listing/PaneMessage.d.ts +7 -4
- package/dist/listing/PaneMessage.js +11 -4
- package/dist/listing/index.d.ts +1 -1
- package/dist/listing/listing.css +124 -5
- package/dist/menu/Menu.d.ts +52 -8
- package/dist/menu/Menu.js +288 -80
- package/dist/menu/Menu.logic.d.ts +39 -12
- package/dist/menu/Menu.logic.js +36 -8
- package/dist/menu/index.d.ts +4 -3
- package/dist/menu/index.js +2 -1
- package/dist/menu/menu.css +4 -0
- package/dist/palette/Palette.d.ts +3 -1
- package/dist/palette/Palette.js +14 -2
- package/dist/palette/PaletteRows.d.ts +28 -14
- package/dist/palette/PaletteRows.js +21 -17
- package/dist/pane/Pane.d.ts +50 -6
- package/dist/pane/Pane.js +112 -5
- package/dist/pane/PaneKeys.d.ts +5 -1
- package/dist/pane/PaneKeys.js +28 -3
- package/dist/pane/PaneKeys.logic.d.ts +25 -0
- package/dist/pane/PaneKeys.logic.js +30 -0
- package/dist/pane/PaneTabs.js +7 -3
- package/dist/pane/index.d.ts +1 -1
- package/dist/pane/index.js +1 -1
- package/dist/pane/panetabs.css +14 -2
- package/dist/pane/usePaneKeys.d.ts +8 -1
- package/dist/pane/usePaneKeys.js +32 -12
- package/dist/styles.css +40 -3
- package/dist/surface/FactList.d.ts +54 -0
- package/dist/surface/FactList.js +33 -0
- package/dist/surface/index.d.ts +4 -1
- package/dist/surface/index.js +4 -1
- package/dist/surface/surface.css +85 -2
- package/dist/terminal/TerminalMenu.js +1 -1
- package/dist/terminal/ghostty/core.d.ts +12 -4
- package/dist/terminal/ghostty/core.js +12 -4
- package/dist/terminal/index.d.ts +4 -2
- package/dist/terminal/index.js +4 -2
- package/dist/terminal/terminal.css +3 -2
- package/dist/text/Code.d.ts +15 -0
- package/dist/text/Code.js +12 -0
- package/dist/text/index.d.ts +6 -1
- package/dist/text/index.js +6 -1
- package/dist/text/text.css +21 -0
- package/dist/themes/tokens.js +8 -3
- package/dist/tokens.css +4 -0
- package/dist/viewer/HexView.js +17 -8
- package/dist/viewer/ImageView.js +5 -3
- package/dist/viewer/PdfView.d.ts +8 -1
- package/dist/viewer/PdfView.js +27 -2
- package/dist/viewer/SyntaxHighlighter.d.ts +3 -2
- package/dist/viewer/SyntaxHighlighter.js +7 -2
- package/dist/viewer/SyntaxLanguage.logic.d.ts +5 -0
- package/dist/viewer/SyntaxLanguage.logic.js +17 -3
- package/dist/viewer/SyntaxService.d.ts +3 -1
- package/dist/viewer/SyntaxService.js +8 -1
- package/dist/viewer/TextView.js +14 -7
- package/dist/viewer/ViewerClipboard.js +17 -6
- package/dist/viewer/ViewerFrame.logic.js +4 -1
- package/dist/viewer/types.d.ts +3 -2
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ArrowBigUp, ArrowDown, ArrowDownToLine, ArrowLeft, ArrowRight, ArrowRightToLine, ArrowUp, ArrowUpToLine, ChevronUp, ChevronsDown, ChevronsUp, Command, CornerDownLeft, Delete, Option, Slash } from 'lucide-react';
|
|
3
|
+
import { Fragment } from 'react';
|
|
3
4
|
import { chordParts, chordSpoken } from '../keyboard/KeyChord.logic.js';
|
|
4
5
|
import { useLabels } from '../labels/UiokProvider.js';
|
|
5
6
|
/**
|
|
@@ -43,13 +44,31 @@ function Key({ part, labels }) {
|
|
|
43
44
|
return (_jsx("span", { "aria-hidden": true, className: text.length > 1 ? 'key key-word' : 'key key-letter', children: text }));
|
|
44
45
|
}
|
|
45
46
|
/**
|
|
46
|
-
* A chord as a row of key caps in a `<kbd>`. The accessible name
|
|
47
|
-
* the full chord in words ("Shift Command N", from
|
|
48
|
-
* when the drawing omits a modifier a strip shows
|
|
47
|
+
* A chord as a row of key caps in a `<kbd role="img">`. The accessible name
|
|
48
|
+
* is always the full chord in words ("Shift Command N", from
|
|
49
|
+
* `UiokLabels.keys`), even when the drawing omits a modifier a strip shows
|
|
50
|
+
* once, and a control round it reads it in its own name. A chord with an
|
|
49
51
|
* empty key draws its modifiers alone.
|
|
50
52
|
*/
|
|
51
53
|
export function KeyChord({ chord, omit = [], tone, recording = false }) {
|
|
52
54
|
const { keys } = useLabels();
|
|
53
55
|
const parts = chordParts(chord).filter((part) => typeof part === 'object' ? part.key !== '' : !omit.includes(part));
|
|
54
|
-
return (_jsx("kbd", { "aria-label": chordSpoken(chord, keys), className: "keychord",
|
|
56
|
+
return (_jsx("kbd", { "aria-label": chordSpoken(chord, keys), className: "keychord",
|
|
57
|
+
// A kbd has no role of its own to carry a name; as an image its name
|
|
58
|
+
// is the chord in words, and it is how a control round it reads it.
|
|
59
|
+
role: "img", "data-state": recording ? 'recording' : undefined, "data-tone": tone, children: parts.map((part, index) => (_jsx(Key, { labels: keys, part: part }, index))) }));
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Several chords that run one verb, each its own `KeyChord`, parted by the
|
|
63
|
+
* `keys.or` word ("⇧⌘N or ⌘N"), drawn quiet between them and read between
|
|
64
|
+
* their names ("Shift Command N or Command N"), so two chords never run
|
|
65
|
+
* together as one. One chord draws alone; none draws nothing. Put `keycap`
|
|
66
|
+
* on an element round it to draw each chord as a key cap. Draws
|
|
67
|
+
* `.keychords` with `.keychords-or` between the chords.
|
|
68
|
+
*/
|
|
69
|
+
export function KeyChords({ chords, tone }) {
|
|
70
|
+
const { keys } = useLabels();
|
|
71
|
+
if (chords.length === 0)
|
|
72
|
+
return null;
|
|
73
|
+
return (_jsx("span", { className: "keychords", children: chords.map((chord, index) => (_jsxs(Fragment, { children: [index === 0 ? null : (_jsxs(_Fragment, { children: [' ', _jsx("span", { className: "keychords-or", children: keys.or }), ' '] })), _jsx(KeyChord, { chord: chord, tone: tone })] }, index))) }));
|
|
55
74
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import type { Chord } from '../keyboard/Keyboard.logic.js';
|
|
3
|
+
/** Props for {@link ShortcutIndex}. */
|
|
4
|
+
export interface ShortcutIndexProps {
|
|
5
|
+
/** The index's accessible name: "Keyboard shortcuts". */
|
|
6
|
+
readonly label: string;
|
|
7
|
+
/** Its groups (`ShortcutGroup`), in order. */
|
|
8
|
+
readonly children: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Every key a window answers, in groups of verbs, each verb with the chords
|
|
12
|
+
* that run it: one grid for every group, so the chords stand in one column
|
|
13
|
+
* at the index's end from the first group to the last, whatever each group's
|
|
14
|
+
* longest verb. Put it in a dialog (a frosted `ModalDialog`) or a page; a
|
|
15
|
+
* find field above it is the host's. Draws `.shortcut-index`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function ShortcutIndex({ label, children }: ShortcutIndexProps): ReactElement;
|
|
18
|
+
/** Props for {@link ShortcutGroup}. */
|
|
19
|
+
export interface ShortcutGroupProps {
|
|
20
|
+
/** The group's name, as an overline over its verbs: "Services". */
|
|
21
|
+
readonly title: string;
|
|
22
|
+
/** Its verbs (`ShortcutRow`). */
|
|
23
|
+
readonly children: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
/** One group of a `ShortcutIndex`: its name over its verbs, a hairline above every group but the first. */
|
|
26
|
+
export declare function ShortcutGroup({ title, children }: ShortcutGroupProps): ReactElement;
|
|
27
|
+
/** Props for {@link ShortcutRow}. */
|
|
28
|
+
export interface ShortcutRowProps {
|
|
29
|
+
/** The verb, as menus name it: "Restart". */
|
|
30
|
+
readonly verb: string;
|
|
31
|
+
/** What it does, beyond its name, in a quieter line under it. */
|
|
32
|
+
readonly detail?: string;
|
|
33
|
+
/** The chords that run it now, each drawn as a key cap; none draws `none`. */
|
|
34
|
+
readonly chords: readonly Chord[];
|
|
35
|
+
/** The words in the chord column when it has no chord: "No shortcut". */
|
|
36
|
+
readonly none?: string;
|
|
37
|
+
/** Its chords were changed from the defaults: the caps wear the accent tone. */
|
|
38
|
+
readonly changed?: boolean;
|
|
39
|
+
/** Not available where the index was opened: the verb and its chords a tone down. */
|
|
40
|
+
readonly dim?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* One verb of a `ShortcutGroup`: its name (and a detail under it) at the
|
|
44
|
+
* start, its chords as key caps at the end, in the index's one chord
|
|
45
|
+
* column; several chords are parted by "or" (`KeyChords`) and wrap within
|
|
46
|
+
* the column, aligned to its end. Each chord is named in words for
|
|
47
|
+
* assistive technology (`KeyChord`).
|
|
48
|
+
*/
|
|
49
|
+
export declare function ShortcutRow({ verb, detail, chords, none, changed, dim }: ShortcutRowProps): ReactElement;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from 'react';
|
|
3
|
+
import { KeyChords } from './KeyChord.js';
|
|
4
|
+
/**
|
|
5
|
+
* Every key a window answers, in groups of verbs, each verb with the chords
|
|
6
|
+
* that run it: one grid for every group, so the chords stand in one column
|
|
7
|
+
* at the index's end from the first group to the last, whatever each group's
|
|
8
|
+
* longest verb. Put it in a dialog (a frosted `ModalDialog`) or a page; a
|
|
9
|
+
* find field above it is the host's. Draws `.shortcut-index`.
|
|
10
|
+
*/
|
|
11
|
+
export function ShortcutIndex({ label, children }) {
|
|
12
|
+
return (_jsx("div", { "aria-label": label, className: "shortcut-index", role: "region", children: children }));
|
|
13
|
+
}
|
|
14
|
+
/** One group of a `ShortcutIndex`: its name over its verbs, a hairline above every group but the first. */
|
|
15
|
+
export function ShortcutGroup({ title, children }) {
|
|
16
|
+
const headingId = useId();
|
|
17
|
+
return (_jsxs("section", { "aria-labelledby": headingId, className: "shortcut-group", children: [_jsx("h3", { className: "shortcut-group-title overline", id: headingId, children: title }), _jsx("dl", { className: "shortcut-group-rows", children: children })] }));
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* One verb of a `ShortcutGroup`: its name (and a detail under it) at the
|
|
21
|
+
* start, its chords as key caps at the end, in the index's one chord
|
|
22
|
+
* column; several chords are parted by "or" (`KeyChords`) and wrap within
|
|
23
|
+
* the column, aligned to its end. Each chord is named in words for
|
|
24
|
+
* assistive technology (`KeyChord`).
|
|
25
|
+
*/
|
|
26
|
+
export function ShortcutRow({ verb, detail, chords, none, changed = false, dim = false }) {
|
|
27
|
+
return (_jsxs("div", { className: dim ? 'shortcut-row dim' : 'shortcut-row', children: [_jsxs("dt", { className: "shortcut-verb", children: [verb, detail === undefined ? null : _jsx("span", { className: "shortcut-detail", children: detail })] }), _jsx("dd", { className: "shortcut-chords keycap", children: chords.length === 0 ? (_jsx("span", { className: "shortcut-none", children: none })) : (_jsx(KeyChords, { chords: chords, tone: changed ? 'accent' : undefined })) })] }));
|
|
28
|
+
}
|
package/dist/keychord/index.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* `KeyChord`: a chord drawn as key caps, named in words for assistive
|
|
3
|
+
* technology; `KeyChords`, several chords for one verb parted by "or";
|
|
4
|
+
* `ShortcutIndex` with `ShortcutGroup` and `ShortcutRow`, every
|
|
5
|
+
* key a window answers in groups whose chords share one column.
|
|
6
|
+
*/
|
|
7
|
+
export { KeyChord, KeyChords, type KeyChordProps, type KeyChordsProps, type KeyChordTone } from './KeyChord.js';
|
|
8
|
+
export { ShortcutGroup, ShortcutIndex, ShortcutRow, type ShortcutGroupProps, type ShortcutIndexProps, type ShortcutRowProps } from './ShortcutIndex.js';
|
package/dist/keychord/index.js
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* `KeyChord`: a chord drawn as key caps, named in words for assistive
|
|
3
|
+
* technology; `KeyChords`, several chords for one verb parted by "or";
|
|
4
|
+
* `ShortcutIndex` with `ShortcutGroup` and `ShortcutRow`, every
|
|
5
|
+
* key a window answers in groups whose chords share one column.
|
|
6
|
+
*/
|
|
7
|
+
export { KeyChord, KeyChords } from './KeyChord.js';
|
|
8
|
+
export { ShortcutGroup, ShortcutIndex, ShortcutRow } from './ShortcutIndex.js';
|
|
@@ -117,3 +117,104 @@
|
|
|
117
117
|
outline: var(--line) solid var(--accent);
|
|
118
118
|
outline-offset: var(--line);
|
|
119
119
|
}
|
|
120
|
+
|
|
121
|
+
/* ---- Several chords (KeyChords) ----
|
|
122
|
+
|
|
123
|
+
Chords that run one verb, parted by a quiet word ("or") so two never
|
|
124
|
+
read as one run of keys; they wrap whole, never inside a chord. */
|
|
125
|
+
.keychords {
|
|
126
|
+
display: inline-flex;
|
|
127
|
+
flex-wrap: wrap;
|
|
128
|
+
align-items: center;
|
|
129
|
+
gap: var(--space-2) var(--space-3);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.keychords-or {
|
|
133
|
+
color: var(--text-dim);
|
|
134
|
+
font-size: var(--font-size-caption);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* ---- Shortcut index (ShortcutIndex, ShortcutGroup, ShortcutRow) ----
|
|
138
|
+
|
|
139
|
+
Every key a window answers, in groups: one grid down the whole index
|
|
140
|
+
(each group and each row a subgrid of it), so the chord column stands at
|
|
141
|
+
the index's end at one width from the first group to the last. A verb
|
|
142
|
+
takes the room left; its chords sit at the column's end, several
|
|
143
|
+
wrapping within it. The column is as wide as its longest chords but
|
|
144
|
+
never more than half the index, so a verb with many chords wraps them
|
|
145
|
+
instead of squeezing every verb to nothing. A hairline parts the
|
|
146
|
+
groups. */
|
|
147
|
+
.shortcut-index {
|
|
148
|
+
display: grid;
|
|
149
|
+
grid-template-columns: minmax(0, 1fr) fit-content(50%);
|
|
150
|
+
column-gap: var(--space-8);
|
|
151
|
+
font: var(--font-size-small) / var(--line-height-compact) var(--font-ui);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.shortcut-group,
|
|
155
|
+
.shortcut-group-rows,
|
|
156
|
+
.shortcut-row {
|
|
157
|
+
display: grid;
|
|
158
|
+
grid-column: 1 / -1;
|
|
159
|
+
grid-template-columns: subgrid;
|
|
160
|
+
margin: 0;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.shortcut-group {
|
|
164
|
+
padding-block: var(--space-6);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.shortcut-group:first-child {
|
|
168
|
+
padding-block-start: 0;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.shortcut-group + .shortcut-group {
|
|
172
|
+
border-top: var(--line) solid var(--border);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.shortcut-group-title {
|
|
176
|
+
grid-column: 1 / -1;
|
|
177
|
+
margin: 0 0 var(--space-3);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.shortcut-row {
|
|
181
|
+
align-items: center;
|
|
182
|
+
min-height: var(--row-height-dense);
|
|
183
|
+
padding-block: var(--space-1);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.shortcut-verb {
|
|
187
|
+
min-width: 0;
|
|
188
|
+
color: var(--text);
|
|
189
|
+
overflow-wrap: break-word;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.shortcut-detail {
|
|
193
|
+
display: block;
|
|
194
|
+
color: var(--text-dim);
|
|
195
|
+
font-size: var(--font-size-caption);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.shortcut-chords {
|
|
199
|
+
display: flex;
|
|
200
|
+
justify-content: flex-end;
|
|
201
|
+
margin: 0;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.shortcut-chords > .keychords {
|
|
205
|
+
justify-content: flex-end;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.shortcut-none {
|
|
209
|
+
color: var(--text-dim);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/* A verb not available where the index was opened: a tone down, its caps
|
|
213
|
+
too. */
|
|
214
|
+
.shortcut-row.dim > .shortcut-verb {
|
|
215
|
+
color: var(--text-dim);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.shortcut-row.dim > .shortcut-chords {
|
|
219
|
+
opacity: var(--disabled-opacity);
|
|
220
|
+
}
|
package/dist/labels/dialog.d.ts
CHANGED
|
@@ -36,6 +36,8 @@ export interface DialogLabels {
|
|
|
36
36
|
readonly runInBackground: string;
|
|
37
37
|
/** The note under a typed-name confirmation's field (`TypedNameDialog`): "Type the name to confirm." */
|
|
38
38
|
readonly typeName: string;
|
|
39
|
+
/** The accessible name of a sectioned dialog's sidebar (`SectionedDialog`): "Sections". */
|
|
40
|
+
readonly sections: string;
|
|
39
41
|
}
|
|
40
42
|
/** English dialog words: the `dialog` group `UiokProvider` starts from. */
|
|
41
43
|
export declare const DEFAULT_DIALOG_LABELS: DialogLabels;
|
package/dist/labels/dialog.js
CHANGED
package/dist/labels/keys.d.ts
CHANGED
|
@@ -23,6 +23,11 @@ export interface KeyLabels {
|
|
|
23
23
|
readonly spaceCap: string;
|
|
24
24
|
/** What the Escape key cap says when a chord is drawn: "esc". */
|
|
25
25
|
readonly escapeCap: string;
|
|
26
|
+
/**
|
|
27
|
+
* The word between two chords that run the same verb (`KeyChords`), drawn
|
|
28
|
+
* and read between them: "or".
|
|
29
|
+
*/
|
|
30
|
+
readonly or: string;
|
|
26
31
|
}
|
|
27
32
|
/** English key names and macOS glyphs: the `keys` group `UiokProvider` starts from. */
|
|
28
33
|
export declare const DEFAULT_KEY_LABELS: KeyLabels;
|
package/dist/labels/keys.js
CHANGED
package/dist/legend/legend.css
CHANGED
|
@@ -210,16 +210,12 @@
|
|
|
210
210
|
.keylegend-more-place > .keylegend-more-list {
|
|
211
211
|
top: auto;
|
|
212
212
|
bottom: calc(100% + var(--space-2));
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
/* The list ends where the chip ends the strip: its inline end, the right
|
|
214
|
+
edge, or the left right to left. Logical insets follow the box's own
|
|
215
|
+
direction, so an LTR footer inside an RTL page keeps the left-to-right
|
|
216
|
+
place; not :dir(rtl), which a bundler's CSS transform rewrites into
|
|
217
|
+
:lang() selectors that an RTL box in an English page does not match. */
|
|
218
|
+
inset-inline: auto 0;
|
|
215
219
|
width: max-content;
|
|
216
220
|
min-width: 200px;
|
|
217
221
|
}
|
|
218
|
-
|
|
219
|
-
/* Right to left, the chip ends the strip on the left: the list ends there
|
|
220
|
-
too. :dir() follows the nearest direction, so an LTR footer inside an RTL
|
|
221
|
-
page keeps the left-to-right place. */
|
|
222
|
-
.keylegend-more-place > .keylegend-more-list:dir(rtl) {
|
|
223
|
-
left: 0;
|
|
224
|
-
right: auto;
|
|
225
|
-
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type ReactElement, type ReactNode } from 'react';
|
|
1
|
+
import { type MouseEvent, type ReactElement, type ReactNode } from 'react';
|
|
2
2
|
import type { SortDirection } from '../labels/listing.js';
|
|
3
|
-
import { type LinkLook } from '../pane/PaneActions.js';
|
|
3
|
+
import { type ControlVerb, type LinkLook } from '../pane/PaneActions.js';
|
|
4
4
|
/**
|
|
5
5
|
* A listing column as wide as `ch` characters and the gutter before it, for
|
|
6
6
|
* a listing's `grid`: `column(9)` is "calc(9ch + var(--pane-column-gap))".
|
|
@@ -139,15 +139,51 @@ export interface RowCursor {
|
|
|
139
139
|
}
|
|
140
140
|
/** The cursor of the pane a row is in, which the app provides; without one no row is the cursor. */
|
|
141
141
|
export declare const RowCursorContext: import("react").Context<RowCursor>;
|
|
142
|
+
/**
|
|
143
|
+
* The radio a row leads with in place of its mark (`Row`'s `radio`): the
|
|
144
|
+
* row is one choice of several, the one picked checked.
|
|
145
|
+
*/
|
|
146
|
+
export interface RowRadio {
|
|
147
|
+
/** Whether this row is the one picked. */
|
|
148
|
+
readonly checked: boolean;
|
|
149
|
+
/** Picks this row; a press on the radio, or the key the app maps to its `verb`. */
|
|
150
|
+
readonly onPick: () => void;
|
|
151
|
+
/** The radio group's name, the same on every row of the choice and unique in the window. */
|
|
152
|
+
readonly group: string;
|
|
153
|
+
/** Holds the choice where it is (a change under way). */
|
|
154
|
+
readonly disabled?: boolean;
|
|
155
|
+
/** What the cursor row's keys run it for (`data-verb`), so a key the app maps picks the cursor row. */
|
|
156
|
+
readonly verb?: ControlVerb;
|
|
157
|
+
}
|
|
142
158
|
/** Props for {@link Row}. */
|
|
143
159
|
export interface RowProps {
|
|
144
160
|
/** Names the row to the cursor (`data-row-key`); unique in its pane. */
|
|
145
161
|
readonly rowKey: string;
|
|
146
162
|
/** The icon before the name, decorative. */
|
|
147
163
|
readonly mark?: ReactNode;
|
|
164
|
+
/**
|
|
165
|
+
* Leads the row with a radio in the mark's place: the row is one choice
|
|
166
|
+
* of several (the database a server uses), named by the row's name.
|
|
167
|
+
*/
|
|
168
|
+
readonly radio?: RowRadio;
|
|
148
169
|
readonly name: ReactNode;
|
|
149
170
|
/** The name cell's own class, beside `row-name`. */
|
|
150
171
|
readonly nameClass?: string;
|
|
172
|
+
/**
|
|
173
|
+
* More than the name says, in the host's words: what a narrow pane's
|
|
174
|
+
* dropped columns held ("running · 5432"). The name's tooltip at every
|
|
175
|
+
* width, under the whole name (a name in markup by its drawn words), in
|
|
176
|
+
* place of the tooltip a cut name shows alone; its words are also read
|
|
177
|
+
* as the description (below).
|
|
178
|
+
*/
|
|
179
|
+
readonly nameTip?: string;
|
|
180
|
+
/**
|
|
181
|
+
* Read by assistive technology before `nameTip`'s words, and never shown:
|
|
182
|
+
* what kind of item the row is ("Database"), never the name itself. The
|
|
183
|
+
* two are the description of the name's cell, of the row when it takes
|
|
184
|
+
* the focus (`focusable`, `tabbable`), and of a radio row's radio.
|
|
185
|
+
*/
|
|
186
|
+
readonly nameDescription?: string;
|
|
151
187
|
readonly className?: string;
|
|
152
188
|
/**
|
|
153
189
|
* The row's item is not there yet (a version not installed, a product
|
|
@@ -181,6 +217,15 @@ export interface RowProps {
|
|
|
181
217
|
readonly emphasis?: boolean;
|
|
182
218
|
/** Opens the row's item on a click anywhere but its controls. */
|
|
183
219
|
readonly onOpen?: () => void;
|
|
220
|
+
/**
|
|
221
|
+
* A secondary click (the right button, a Control-click, the menu key) on
|
|
222
|
+
* the row, with the row's key, for the row's menu: open it at
|
|
223
|
+
* `event.clientX` and `event.clientY`. The row moves the pane's cursor to
|
|
224
|
+
* itself first, as a file manager does, so the menu acts on the cursor row,
|
|
225
|
+
* and cancels the browser's own menu; a cancelled event is one the
|
|
226
|
+
* `PaneBox` around it leaves alone, so one click never opens both menus.
|
|
227
|
+
*/
|
|
228
|
+
readonly onContextMenu?: (event: MouseEvent<HTMLElement>, rowKey: string) => void;
|
|
184
229
|
/**
|
|
185
230
|
* How deep the row stands in a tree or a plan: its name is indented by one
|
|
186
231
|
* icon column a level (`--row-level`); 0, or none, is no indent. The
|
|
@@ -201,15 +246,20 @@ export interface RowProps {
|
|
|
201
246
|
* it to the pane's cursor (`RowCursorContext`), which it wears as the
|
|
202
247
|
* listing's cursor row (`.cursor`, `aria-current`); the pointer moving over
|
|
203
248
|
* it or the focus entering it moves the cursor there. A row with `onOpen`
|
|
204
|
-
* opens its item on a click anywhere but its controls
|
|
249
|
+
* opens its item on a click anywhere but its controls; one with
|
|
250
|
+
* `onContextMenu` takes the cursor on a secondary click, then hands the
|
|
251
|
+
* click and its key to the app for the row's menu. Controls that say
|
|
205
252
|
* what the keys run mark it with `data-verb` (`QuietAction`,
|
|
206
253
|
* `RowIconAction`), and the app reads them off the cursor row
|
|
207
254
|
* (`verbControl`); such controls leave the Tab order, unless `tabbable`
|
|
208
255
|
* keeps them in it, for a listing whose rows no key runs. A `focusable` row
|
|
209
256
|
* is a stop of its own: the cursor row in the Tab order (or, while no row
|
|
210
257
|
* is, the one marked `entry`), the others reached by the keys that move it.
|
|
258
|
+
* `nameTip` puts the host's words under the whole name in its tooltip (a
|
|
259
|
+
* narrow pane's dropped columns), and with `nameDescription` they are read
|
|
260
|
+
* after the name.
|
|
211
261
|
*/
|
|
212
|
-
export declare function Row({ rowKey, mark, name, nameClass, className, dim, add, selected, marked, change, emphasis, onOpen, level, tabbable, focusable, entry, children }: RowProps): ReactElement;
|
|
262
|
+
export declare function Row({ rowKey, mark, radio, name, nameClass, nameTip, nameDescription, className, dim, add, selected, marked, change, emphasis, onOpen, onContextMenu, level, tabbable, focusable, entry, children }: RowProps): ReactElement;
|
|
213
263
|
/**
|
|
214
264
|
* A cell's tone: `warning` a value with something waiting on it (an
|
|
215
265
|
* update), `accent` a value offered (the version an update brings),
|
package/dist/listing/Listing.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { ChevronDown, ChevronUp, Plus } from 'lucide-react';
|
|
3
|
-
import { createContext, useContext, useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react';
|
|
3
|
+
import { createContext, useContext, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react';
|
|
4
4
|
import { ICON_MD, ICON_SM, Spinner } from '../icon/index.js';
|
|
5
5
|
import { useLabels } from '../labels/UiokProvider.js';
|
|
6
|
+
import { unclaimedContextMenu } from '../pane/Pane.js';
|
|
6
7
|
import { InListingRowContext, InRowContext, RowLinkLookContext } from '../pane/PaneActions.js';
|
|
7
|
-
import { cutTooltip, describedTooltip } from '../tooltip/Tooltip.logic.js';
|
|
8
|
+
import { cutTooltip, describedTooltip, tooltip } from '../tooltip/Tooltip.logic.js';
|
|
8
9
|
import { ListingScopeContext } from './ListingScope.js';
|
|
9
10
|
import { pathParts } from './PathParts.logic.js';
|
|
10
11
|
/**
|
|
@@ -208,26 +209,70 @@ export const RowCursorContext = createContext({
|
|
|
208
209
|
subscribe: () => () => undefined,
|
|
209
210
|
point: () => undefined
|
|
210
211
|
});
|
|
212
|
+
/** A press on a row's radio picks it and never opens the row. */
|
|
213
|
+
const keepRadioToSelf = (event) => event.stopPropagation();
|
|
214
|
+
/**
|
|
215
|
+
* The tooltip of a row's name, on the box that cuts it. With no host tip,
|
|
216
|
+
* a name in words shows itself whole only while a narrow column cuts it. A
|
|
217
|
+
* host tip shows at every width under the whole name: `nameText`, the
|
|
218
|
+
* name's words (a marked-up name's as rendered), or the tip alone while
|
|
219
|
+
* they are not known.
|
|
220
|
+
*/
|
|
221
|
+
function nameTooltip(name, nameText, tip) {
|
|
222
|
+
if (tip === undefined || tip === '')
|
|
223
|
+
return typeof name === 'string' ? cutTooltip(name) : {};
|
|
224
|
+
return tooltip(nameText === null || nameText === '' ? tip : `${nameText}\n${tip}`, null, {
|
|
225
|
+
value: true
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
/** What a row's name is described by: the host's description, then its tip; none when neither. */
|
|
229
|
+
function nameDescribed(description, tip) {
|
|
230
|
+
const parts = [description, tip].filter((part) => part !== undefined && part !== '');
|
|
231
|
+
return parts.length === 0 ? {} : { 'aria-description': parts.join(', ') };
|
|
232
|
+
}
|
|
211
233
|
/**
|
|
212
234
|
* One row of a listing: its mark, its name, then its cells. `rowKey` names
|
|
213
235
|
* it to the pane's cursor (`RowCursorContext`), which it wears as the
|
|
214
236
|
* listing's cursor row (`.cursor`, `aria-current`); the pointer moving over
|
|
215
237
|
* it or the focus entering it moves the cursor there. A row with `onOpen`
|
|
216
|
-
* opens its item on a click anywhere but its controls
|
|
238
|
+
* opens its item on a click anywhere but its controls; one with
|
|
239
|
+
* `onContextMenu` takes the cursor on a secondary click, then hands the
|
|
240
|
+
* click and its key to the app for the row's menu. Controls that say
|
|
217
241
|
* what the keys run mark it with `data-verb` (`QuietAction`,
|
|
218
242
|
* `RowIconAction`), and the app reads them off the cursor row
|
|
219
243
|
* (`verbControl`); such controls leave the Tab order, unless `tabbable`
|
|
220
244
|
* keeps them in it, for a listing whose rows no key runs. A `focusable` row
|
|
221
245
|
* is a stop of its own: the cursor row in the Tab order (or, while no row
|
|
222
246
|
* is, the one marked `entry`), the others reached by the keys that move it.
|
|
247
|
+
* `nameTip` puts the host's words under the whole name in its tooltip (a
|
|
248
|
+
* narrow pane's dropped columns), and with `nameDescription` they are read
|
|
249
|
+
* after the name.
|
|
223
250
|
*/
|
|
224
|
-
export function Row({ rowKey, mark, name, nameClass, className, dim = false, add = false, selected = false, marked = false, change = null, emphasis = false, onOpen, level = 0, tabbable = false, focusable = false, entry = false, children }) {
|
|
251
|
+
export function Row({ rowKey, mark, radio, name, nameClass, nameTip, nameDescription, className, dim = false, add = false, selected = false, marked = false, change = null, emphasis = false, onOpen, onContextMenu, level = 0, tabbable = false, focusable = false, entry = false, children }) {
|
|
225
252
|
const cursor = useContext(RowCursorContext);
|
|
226
253
|
const current = useSyncExternalStore(cursor.subscribe, () => cursor.current() === rowKey);
|
|
254
|
+
const nameId = useId();
|
|
255
|
+
const nameBox = useRef(null);
|
|
256
|
+
// A marked-up name's words, read from the drawn name for the host tip's
|
|
257
|
+
// tooltip; a name in words is its own.
|
|
258
|
+
const [drawnName, setDrawnName] = useState(null);
|
|
259
|
+
const nameText = typeof name === 'string' ? name : drawnName;
|
|
260
|
+
const tipped = nameTip !== undefined && nameTip !== '';
|
|
261
|
+
// Read where the focus lands (a focusable or tabbable row, a radio) and in
|
|
262
|
+
// the name's cell for a table's navigation.
|
|
263
|
+
const described = nameDescribed(nameDescription, nameTip);
|
|
227
264
|
useLayoutEffect(() => {
|
|
228
265
|
cursor.rowsChanged?.();
|
|
229
266
|
return () => cursor.rowsChanged?.();
|
|
230
267
|
}, [cursor, rowKey]);
|
|
268
|
+
// Whenever the name is drawn again: a name in markup is a new element
|
|
269
|
+
// each time its host draws it.
|
|
270
|
+
useLayoutEffect(() => {
|
|
271
|
+
if (!tipped || typeof name === 'string')
|
|
272
|
+
return;
|
|
273
|
+
const text = nameBox.current?.textContent ?? '';
|
|
274
|
+
setDrawnName((now) => (now === text ? now : text));
|
|
275
|
+
}, [tipped, name]);
|
|
231
276
|
return (_jsx(InListingRowContext.Provider, { value: true, children: _jsx(InRowContext.Provider, { value: !tabbable, children: _jsxs("div", { "aria-current": current ? 'true' : undefined, "aria-selected": selected || undefined, className: [
|
|
232
277
|
'row',
|
|
233
278
|
current ? 'cursor' : '',
|
|
@@ -240,13 +285,22 @@ export function Row({ rowKey, mark, name, nameClass, className, dim = false, add
|
|
|
240
285
|
className ?? ''
|
|
241
286
|
]
|
|
242
287
|
.filter(Boolean)
|
|
243
|
-
.join(' '), "data-row-key": rowKey, onClick: onOpen,
|
|
288
|
+
.join(' '), "data-row-key": rowKey, "data-row-menu": onContextMenu === undefined ? undefined : '', onClick: onOpen, onContextMenu: unclaimedContextMenu(onContextMenu &&
|
|
289
|
+
((event) => {
|
|
290
|
+
// The menu acts on the row it opened over, so that row is the cursor first.
|
|
291
|
+
if (!current)
|
|
292
|
+
cursor.point(rowKey);
|
|
293
|
+
onContextMenu(event, rowKey);
|
|
294
|
+
})), onFocus: () => cursor.point(rowKey),
|
|
244
295
|
// Movement, not entry: a row scrolled under a still pointer as the
|
|
245
296
|
// keys move the cursor must not take the cursor back.
|
|
246
297
|
onPointerMove: () => {
|
|
247
298
|
if (!current)
|
|
248
299
|
cursor.point(rowKey);
|
|
249
|
-
}, role: "row", style: level > 0 ? { '--row-level': level } : undefined, tabIndex: focusable ? (current || entry ? 0 : -1) : undefined, children: [_jsx("span", { "aria-hidden": true, className: "row-icon", children: mark === undefined && add ? _jsx(Plus, { size: ICON_MD }) : mark }), _jsx("span", { className: nameClass === undefined ? 'row-name' : `row-name ${nameClass}`, role: "cell", ...(
|
|
300
|
+
}, role: "row", style: level > 0 ? { '--row-level': level } : undefined, tabIndex: focusable ? (current || entry ? 0 : -1) : undefined, ...(focusable || tabbable ? described : {}), children: [radio === undefined ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": true, className: "row-icon", children: mark === undefined && add ? _jsx(Plus, { size: ICON_MD }) : mark }), _jsx("span", { className: nameClass === undefined ? 'row-name' : `row-name ${nameClass}`, ref: nameBox, role: "cell", ...nameTooltip(name, nameText, nameTip), ...described, children: name })] })) : (_jsxs("span", { className: nameClass === undefined ? 'row-name row-pick' : `row-name row-pick ${nameClass}`, role: "cell", ...described, children: [_jsx("input", { "aria-labelledby": nameId, ...described, checked: radio.checked, className: "check row-radio", "data-verb": radio.verb, disabled: radio.disabled, name: radio.group, onChange: () => {
|
|
301
|
+
if (!radio.disabled)
|
|
302
|
+
radio.onPick();
|
|
303
|
+
}, onClick: keepRadioToSelf, tabIndex: tabbable ? undefined : -1, type: "radio" }), _jsx("span", { className: "row-pick-name", id: nameId, ref: nameBox, ...nameTooltip(name, nameText, nameTip), children: name })] })), children] }) }) }));
|
|
250
304
|
}
|
|
251
305
|
/**
|
|
252
306
|
* A cell of a row after its name, in the listing's metadata look
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* A pane message's tone: `danger` a refusal or a failure, `warning` a state
|
|
4
4
|
* that needs a second look, `empty` a list with no rows; a plain hint
|
|
@@ -21,8 +21,11 @@ export interface PaneMessageProps {
|
|
|
21
21
|
* One line that says something about a listing, where its rows stand: a
|
|
22
22
|
* hint, a refusal led by the danger glyph, a warning led by the warning
|
|
23
23
|
* glyph, or the line of a list with no rows, in the interface face from the
|
|
24
|
-
* rows' inset
|
|
25
|
-
*
|
|
26
|
-
* `.
|
|
24
|
+
* rows' inset. Inside a listing, after one, or anywhere else: drawn
|
|
25
|
+
* outside every listing scope (a page of the app's own, a popover), it
|
|
26
|
+
* carries the scope itself (a `.listing-root` around it), as `Listing`
|
|
27
|
+
* does, so it keeps its look. For what `Listing`'s `empty` and `PageNote`
|
|
28
|
+
* do not cover. Draws `.pane-message` (`.danger`, `.warning`, `.empty`), its
|
|
29
|
+
* words in one `.pane-message-text`, so a `Code` inside flows with them.
|
|
27
30
|
*/
|
|
28
31
|
export declare function PaneMessage({ children, tone, live }: PaneMessageProps): ReactElement;
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
import { ListingScopeContext } from './ListingScope.js';
|
|
2
4
|
/**
|
|
3
5
|
* One line that says something about a listing, where its rows stand: a
|
|
4
6
|
* hint, a refusal led by the danger glyph, a warning led by the warning
|
|
5
7
|
* glyph, or the line of a list with no rows, in the interface face from the
|
|
6
|
-
* rows' inset
|
|
7
|
-
*
|
|
8
|
-
* `.
|
|
8
|
+
* rows' inset. Inside a listing, after one, or anywhere else: drawn
|
|
9
|
+
* outside every listing scope (a page of the app's own, a popover), it
|
|
10
|
+
* carries the scope itself (a `.listing-root` around it), as `Listing`
|
|
11
|
+
* does, so it keeps its look. For what `Listing`'s `empty` and `PageNote`
|
|
12
|
+
* do not cover. Draws `.pane-message` (`.danger`, `.warning`, `.empty`), its
|
|
13
|
+
* words in one `.pane-message-text`, so a `Code` inside flows with them.
|
|
9
14
|
*/
|
|
10
15
|
export function PaneMessage({ children, tone, live = false }) {
|
|
11
|
-
|
|
16
|
+
const scoped = useContext(ListingScopeContext);
|
|
17
|
+
const message = (_jsx("p", { className: tone === undefined ? 'pane-message' : `pane-message ${tone}`, role: live ? 'status' : undefined, children: _jsx("span", { className: "pane-message-text", children: children }) }));
|
|
18
|
+
return scoped ? message : _jsx("div", { className: "listing-root", children: message });
|
|
12
19
|
}
|
package/dist/listing/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
export { type SortDirection } from '../labels/listing.js';
|
|
11
11
|
export { CurrentDot, type CurrentDotProps } from './CurrentDot.js';
|
|
12
12
|
export { EmptyState, type EmptyStateProps, type EmptyStateStep } from './EmptyState.js';
|
|
13
|
-
export { ACTION_COLUMN, Cell, column, ICON_LINK_PX, iconLinksColumn, linksColumn, Listing, PathCell, Row, RowCursorContext, StateMark, Strip, WellColumn, type CellProps, type CellTone, type ColumnSort, type ListingColumn, type ListingProps, type PathCellProps, type RowCursor, type RowProps, type StateMarkProps, type StateTone, type StripProps, type WellColumnProps } from './Listing.js';
|
|
13
|
+
export { ACTION_COLUMN, Cell, column, ICON_LINK_PX, iconLinksColumn, linksColumn, Listing, PathCell, Row, RowCursorContext, StateMark, Strip, WellColumn, type CellProps, type CellTone, type ColumnSort, type ListingColumn, type ListingProps, type PathCellProps, type RowCursor, type RowProps, type RowRadio, type StateMarkProps, type StateTone, type StripProps, type WellColumnProps } from './Listing.js';
|
|
14
14
|
export { PaneMessage, type PaneMessageProps, type PaneMessageTone } from './PaneMessage.js';
|
|
15
15
|
export { pathParts, type PathParts } from './PathParts.logic.js';
|
|
16
16
|
export { TimelineCell, TimelineScale, type TimelineCellProps, type TimelineScaleProps, type TimelineTick } from './Timeline.js';
|