@bigpixelrocket/uiok 0.6.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.
Files changed (49) hide show
  1. package/CHANGELOG.md +37 -1
  2. package/dist/button/TextLink.d.ts +14 -2
  3. package/dist/button/TextLink.js +13 -3
  4. package/dist/dialog/SectionedDialog.js +2 -1
  5. package/dist/field/FieldLayout.d.ts +3 -2
  6. package/dist/field/FieldLayout.js +8 -3
  7. package/dist/frame/PageParts.js +1 -1
  8. package/dist/frame/SideBySide.d.ts +2 -1
  9. package/dist/frame/SideBySide.js +16 -4
  10. package/dist/frame/Tree.d.ts +19 -6
  11. package/dist/frame/Tree.js +20 -8
  12. package/dist/frame/frame.css +8 -0
  13. package/dist/keychord/KeyChord.d.ts +4 -3
  14. package/dist/keychord/KeyChord.js +10 -6
  15. package/dist/legend/legend.css +6 -10
  16. package/dist/listing/Listing.d.ts +19 -1
  17. package/dist/listing/Listing.js +43 -4
  18. package/dist/listing/listing.css +41 -2
  19. package/dist/menu/Menu.js +2 -2
  20. package/dist/menu/menu.css +4 -6
  21. package/dist/palette/Palette.d.ts +3 -1
  22. package/dist/palette/Palette.js +14 -2
  23. package/dist/palette/PaletteRows.d.ts +17 -12
  24. package/dist/palette/PaletteRows.js +17 -15
  25. package/dist/pane/Pane.d.ts +8 -0
  26. package/dist/pane/Pane.js +26 -6
  27. package/dist/pane/PaneTabs.js +7 -3
  28. package/dist/pane/panetabs.css +14 -2
  29. package/dist/styles.css +34 -11
  30. package/dist/surface/surface.css +10 -0
  31. package/dist/terminal/TerminalMenu.js +1 -1
  32. package/dist/terminal/terminal.css +3 -2
  33. package/dist/themes/tokens.js +5 -2
  34. package/dist/tokens.css +4 -0
  35. package/dist/viewer/HexView.js +17 -8
  36. package/dist/viewer/ImageView.js +5 -3
  37. package/dist/viewer/PdfView.d.ts +8 -1
  38. package/dist/viewer/PdfView.js +27 -2
  39. package/dist/viewer/SyntaxHighlighter.d.ts +3 -2
  40. package/dist/viewer/SyntaxHighlighter.js +7 -2
  41. package/dist/viewer/SyntaxLanguage.logic.d.ts +5 -0
  42. package/dist/viewer/SyntaxLanguage.logic.js +17 -3
  43. package/dist/viewer/SyntaxService.d.ts +3 -1
  44. package/dist/viewer/SyntaxService.js +8 -1
  45. package/dist/viewer/TextView.js +14 -7
  46. package/dist/viewer/ViewerClipboard.js +17 -6
  47. package/dist/viewer/ViewerFrame.logic.js +4 -1
  48. package/dist/viewer/types.d.ts +3 -2
  49. package/package.json +1 -1
@@ -63,7 +63,7 @@
63
63
  :where(.listing-root) .pane {
64
64
  position: relative;
65
65
  isolation: isolate;
66
- flex: 1 1 0;
66
+ flex: 1;
67
67
  min-width: 0;
68
68
  display: flex;
69
69
  flex-direction: column;
@@ -1759,16 +1759,29 @@ button.crumb-label.crumb-siblings > svg {
1759
1759
  flow as a sentence beside the glyph instead of as separate flex items.
1760
1760
  A glyph the host leads the words with lands in that box too: it keeps
1761
1761
  the glyph's place, the message's gap before the words, on the text's
1762
- middle. */
1762
+ middle. The box takes the room after the glyph from a zero basis, so a
1763
+ long sentence wraps in its own column beside the glyph (a hanging
1764
+ indent), never under it. */
1763
1765
  :where(.listing-root) .pane-message-text {
1766
+ flex: 1;
1764
1767
  min-width: 0;
1765
1768
  }
1766
1769
 
1767
1770
  :where(.listing-root) .pane-message-text > svg:first-child {
1771
+ width: var(--icon-md);
1772
+ height: var(--icon-md);
1768
1773
  margin-inline-end: var(--space-4);
1769
1774
  vertical-align: middle;
1770
1775
  }
1771
1776
 
1777
+ /* The words after a glyph of the host's own hang in their own column, as
1778
+ they do beside the drawn one: the box steps in by the glyph and its gap,
1779
+ and its first line steps back out to start with the glyph. */
1780
+ :where(.listing-root) .pane-message-text:has(> svg:first-child) {
1781
+ padding-inline-start: calc(var(--icon-md) + var(--space-4));
1782
+ text-indent: calc(-1 * (var(--icon-md) + var(--space-4)));
1783
+ }
1784
+
1772
1785
  :where(.listing-root) .pane-message code {
1773
1786
  font-family: var(--font-mono);
1774
1787
  }
@@ -2398,6 +2411,32 @@ button.crumb-label.crumb-siblings > svg {
2398
2411
  color: var(--on-selected);
2399
2412
  }
2400
2413
 
2414
+ /* A link in words (TextLink) on an active selection takes the selection's
2415
+ words, a dimmed one the selection's quiet words: in its own accent or
2416
+ danger tone it would vanish on the accent fill. The list weighs as much as
2417
+ its danger and disabled rules (two classes), so it wins over each. */
2418
+ :where(.listing-root)
2419
+ .row.selected:where(
2420
+ :not(
2421
+ :root[data-window-inactive] .listing-root *,
2422
+ .listing-root:has(.pane.active) .pane:not(.active, .active .pane) *
2423
+ )
2424
+ )
2425
+ :is(.text-link, .text-link.danger) {
2426
+ color: var(--on-selected);
2427
+ }
2428
+
2429
+ :where(.listing-root)
2430
+ .row.selected:where(
2431
+ :not(
2432
+ :root[data-window-inactive] .listing-root *,
2433
+ .listing-root:has(.pane.active) .pane:not(.active, .active .pane) *
2434
+ )
2435
+ )
2436
+ .text-link:disabled {
2437
+ color: var(--on-selected-dim);
2438
+ }
2439
+
2401
2440
  /* A lit or red action under the pointer or the focus keeps the selection's
2402
2441
  words too: their own rules weigh more than the one above, and their tones
2403
2442
  are not floored on the accent. */
package/dist/menu/Menu.js CHANGED
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useId, useLayoutEffect, useRef, useState } from 'react';
3
3
  import { createPortal } from 'react-dom';
4
4
  import { ICON_MD } from '../icon/sizes.js';
@@ -94,7 +94,7 @@ function MenuSurface({ surfaceRef, id, label, labelledBy, entries, cursor, itemI
94
94
  ]
95
95
  .filter(Boolean)
96
96
  .join(' ');
97
- return (_jsxs("div", { "aria-checked": submenu ? undefined : entry.checked, "aria-controls": open ? expanded.menu : undefined, "aria-disabled": entry.disabled === true || undefined, "aria-expanded": submenu ? open : undefined, "aria-haspopup": submenu ? 'menu' : undefined, className: classes, id: `${itemId}-${position}`, onClick: () => onRowClick(entry), onMouseMove: () => onRowMove(entry), role: submenu || entry.checked === undefined ? 'menuitem' : 'menuitemcheckbox', ...describedTooltip(entry.tip), children: [_jsx("span", { "aria-hidden": true, className: "row-icon", children: Icon === undefined ? entry.mark : _jsx(Icon, { size: ICON_MD }) }), _jsxs("span", { className: "menu-label", children: [_jsx("span", { className: "menu-label-text", children: entry.label }), submenu || entry.current === undefined || entry.current === null ? null : (_jsx(CurrentDot, { label: entry.current }))] }), submenu || entry.chord === undefined ? null : _jsx(KeyChord, { chord: entry.chord })] }, entry.id));
97
+ return (_jsxs("div", { "aria-checked": submenu ? undefined : entry.checked, "aria-controls": open ? expanded.menu : undefined, "aria-disabled": entry.disabled === true || undefined, "aria-expanded": submenu ? open : undefined, "aria-haspopup": submenu ? 'menu' : undefined, className: classes, id: `${itemId}-${position}`, onClick: () => onRowClick(entry), onMouseMove: () => onRowMove(entry), role: submenu || entry.checked === undefined ? 'menuitem' : 'menuitemcheckbox', ...describedTooltip(entry.tip), children: [_jsx("span", { "aria-hidden": true, className: "row-icon", children: Icon === undefined ? entry.mark : _jsx(Icon, { size: ICON_MD }) }), _jsxs("span", { className: "menu-label", children: [_jsx("span", { className: "menu-label-text", children: entry.label }), submenu || entry.current === undefined || entry.current === null ? null : (_jsxs(_Fragment, { children: [' ', _jsx(CurrentDot, { label: entry.current })] }))] }), submenu || entry.chord === undefined ? null : (_jsxs(_Fragment, { children: [' ', _jsx(KeyChord, { chord: entry.chord })] }))] }, entry.id));
98
98
  }) }), document.fullscreenElement ?? document.body);
99
99
  }
100
100
  /**
@@ -244,18 +244,16 @@
244
244
  background: var(--text-dim);
245
245
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E")
246
246
  center / contain no-repeat;
247
+ /* Right to left, a submenu opens on the left, so the chevron points
248
+ there: --inline-flip follows the nearest dir attribute (styles.css), as
249
+ the menu's own placement follows the nearest direction. */
250
+ transform: scaleX(var(--inline-flip, 1));
247
251
  }
248
252
 
249
253
  .folder-menu-option.cursor[aria-haspopup='menu']:not([aria-disabled='true'])::after {
250
254
  background: var(--text-on-surface);
251
255
  }
252
256
 
253
- /* Right to left, a submenu opens on the left, so the chevron points there.
254
- :dir() follows the nearest direction, as the menu's own placement does. */
255
- .folder-menu-option[aria-haspopup='menu']:dir(rtl)::after {
256
- transform: scaleX(-1);
257
- }
258
-
259
257
  /* A plain separator between groups of rows that need no name: a hairline
260
258
  in the border colour with a small space above and below, as a desktop
261
259
  menu draws one. */
@@ -72,7 +72,9 @@ export interface PaletteQueryProps {
72
72
  * stands below its first level, the field (a combobox over the list it
73
73
  * names, holding the focus), then the count ("3 of 12") while a query
74
74
  * narrows the list, or, after a refused keystroke, why it was refused in the
75
- * count's place, and any tag the caller puts at the field's end. A refused
75
+ * count's place, and any tag the caller puts at the field's end. The field
76
+ * cancels Return's default before the caller's `onKeyDown` runs, so a focus
77
+ * the caller hands back on close cannot take the same key. A refused
76
78
  * keystroke also rings the visual bell on the row, once per refusal
77
79
  * (`useBellBeat`). The chip's words and the refusal come from the `palette`
78
80
  * label group.
@@ -53,7 +53,9 @@ export function Palette({ label, className, busy = false, onClose, children }) {
53
53
  * stands below its first level, the field (a combobox over the list it
54
54
  * names, holding the focus), then the count ("3 of 12") while a query
55
55
  * narrows the list, or, after a refused keystroke, why it was refused in the
56
- * count's place, and any tag the caller puts at the field's end. A refused
56
+ * count's place, and any tag the caller puts at the field's end. The field
57
+ * cancels Return's default before the caller's `onKeyDown` runs, so a focus
58
+ * the caller hands back on close cannot take the same key. A refused
57
59
  * keystroke also rings the visual bell on the row, once per refusal
58
60
  * (`useBellBeat`). The chip's words and the refusal come from the `palette`
59
61
  * label group.
@@ -61,5 +63,15 @@ export function Palette({ label, className, busy = false, onClose, children }) {
61
63
  export function PaletteQuery({ inputRef, value, label, placeholder, listId, activeId, bell, level = null, count, refused, aside, onChange, onKeyDown }) {
62
64
  const labels = useLabels().palette;
63
65
  const beat = useBellBeat(bell);
64
- return (_jsxs("div", { className: beat === null ? 'folder-menu-query' : `folder-menu-query bell-${beat}`, children: [_jsx(FilterIcon, {}), level !== null && (_jsxs("button", { "aria-label": labels.backFrom(level.title), className: "palette-level", disabled: level.disabled, onClick: level.onBack, tabIndex: -1, type: "button", ...tooltip(labels.back, '←'), children: [_jsx(ArrowLeft, { "aria-hidden": true, size: ICON_SM }), level.title] })), _jsx("input", { "aria-activedescendant": activeId, "aria-autocomplete": "list", "aria-controls": listId, "aria-expanded": true, "aria-label": label, onChange: onChange, onKeyDown: onKeyDown, placeholder: placeholder, ref: inputRef, role: "combobox", spellCheck: false, value: value }), refused !== null ? (_jsx("span", { className: "palette-refused", children: labels.nothingMatches(refused) })) : (count !== null && _jsx("span", { className: "folder-menu-count", children: count })), aside] }));
66
+ return (_jsxs("div", { className: beat === null ? 'folder-menu-query' : `folder-menu-query bell-${beat}`, children: [_jsx(FilterIcon, {}), level !== null && (_jsxs("button", { "aria-label": labels.backFrom(level.title), className: "palette-level", disabled: level.disabled, onClick: level.onBack, tabIndex: -1, type: "button", ...tooltip(labels.back, '←'), children: [_jsx(ArrowLeft, { "aria-hidden": true, size: ICON_SM }), level.title] })), _jsx("input", { "aria-activedescendant": activeId, "aria-autocomplete": "list", "aria-controls": listId, "aria-expanded": true, "aria-label": label, onChange: onChange, onKeyDown: (event) => {
67
+ // Return in the field runs the cursor row, so its default goes
68
+ // first, before the caller's handler can stop the key: a caller
69
+ // that closes on it and hands the focus back to the button that
70
+ // opened the palette would otherwise see the browser click that
71
+ // button with the same key and open the palette again. An input
72
+ // method's Return stays the input method's.
73
+ if (event.key === 'Enter' && !event.nativeEvent.isComposing)
74
+ event.preventDefault();
75
+ onKeyDown(event);
76
+ }, placeholder: placeholder, ref: inputRef, role: "combobox", spellCheck: false, value: value }), refused !== null ? (_jsx("span", { className: "palette-refused", children: labels.nothingMatches(refused) })) : (count !== null && _jsx("span", { className: "folder-menu-count", children: count })), aside] }));
65
77
  }
@@ -1,4 +1,4 @@
1
- import { type ReactElement, type ReactNode, type Ref } from 'react';
1
+ import type { ReactElement, ReactNode, Ref } from 'react';
2
2
  /** Props for {@link PaletteList}. */
3
3
  export interface PaletteListProps {
4
4
  /** The listbox's id, which `PaletteQuery`'s `listId` names. */
@@ -27,9 +27,10 @@ export interface PaletteOptionProps {
27
27
  /** The row's name: words, or `MarkedText` with the query's matches lit. */
28
28
  readonly name: ReactNode;
29
29
  /**
30
- * The row's accessible name. Pass it whenever `name` is markup
31
- * (`MarkedText`): without it the row is named by the drawn words, which a
32
- * screen reader may read split at the highlights ("Po stgreSQL").
30
+ * The drawn name's words for the row's accessible name, in their place
31
+ * before the context and trail. Pass it whenever `name` is markup
32
+ * (`MarkedText`): without it the name part is read from the drawn words,
33
+ * which a screen reader may split at the highlights ("Po stgreSQL").
33
34
  */
34
35
  readonly label?: string;
35
36
  /** The glyph in the icon column (a `ProductMark`, a lucide icon), decorative. */
@@ -61,11 +62,11 @@ export interface PaletteOptionProps {
61
62
  */
62
63
  readonly disabled?: boolean;
63
64
  /**
64
- * Read after the name by assistive technology, in place of what the row
65
- * derives: its context, a trail in words, and what `current` means, in
66
- * that order. Give it to say why the row is disabled, or to word a trail
67
- * that is not text (a `KeyChord`); an empty string reads nothing after
68
- * the name.
65
+ * Read after the name by assistive technology, for what the row does not
66
+ * draw: why it is disabled ("Already added"). The name already reads the
67
+ * row's words in the order they are drawn, its context and trail (a
68
+ * `KeyChord` by its words) and what `current` means included, so the
69
+ * description never repeats them.
69
70
  */
70
71
  readonly description?: string;
71
72
  /** A press picks it; never called while it is disabled. */
@@ -84,9 +85,13 @@ export interface PaletteOptionProps {
84
85
  * is dimmed and never takes the cursor or a pick. A `checked` row, one of
85
86
  * several picked together, wears the check mark while it is ticked, as a
86
87
  * menu's setting does. The palette keeps the
87
- * focus in its field, so a press here never takes it. Its name is `label`
88
- * or its words; the context, a trail in words, and what `current` means
89
- * are read after it as its description, unless `description` says it.
88
+ * focus in its field, so a press here never takes it. Its accessible name
89
+ * is the words it draws, in the order drawn: its name, its context, and its
90
+ * trail with what `current` means, so the name holds every visible word
91
+ * (WCAG 2.5.3), read from its content; `label` stands in for the drawn
92
+ * name's words alone (a name marked up by a query), the context and trail
93
+ * still read after it.
94
+ * `description` adds what the row does not draw.
90
95
  */
91
96
  export declare function PaletteOption({ id, name, label, mark, context, contextKind, trail, current, checked, cursor, disabled, description, onPick, onPoint, ref }: PaletteOptionProps): ReactElement;
92
97
  /** Props for {@link PaletteHeading}. */
@@ -1,7 +1,7 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useId } from 'react';
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
2
  import { CurrentDot } from '../listing/CurrentDot.js';
4
3
  import { cutTooltip } from '../tooltip/Tooltip.logic.js';
4
+ import { VisuallyHidden } from '../VisuallyHidden.js';
5
5
  /**
6
6
  * A palette's list: the listbox its query field drives, seventeen rows tall
7
7
  * at most and fading the edge that has more (`.folder-menu-options`). The
@@ -19,27 +19,29 @@ export function PaletteList({ id, label, children }) {
19
19
  * is dimmed and never takes the cursor or a pick. A `checked` row, one of
20
20
  * several picked together, wears the check mark while it is ticked, as a
21
21
  * menu's setting does. The palette keeps the
22
- * focus in its field, so a press here never takes it. Its name is `label`
23
- * or its words; the context, a trail in words, and what `current` means
24
- * are read after it as its description, unless `description` says it.
22
+ * focus in its field, so a press here never takes it. Its accessible name
23
+ * is the words it draws, in the order drawn: its name, its context, and its
24
+ * trail with what `current` means, so the name holds every visible word
25
+ * (WCAG 2.5.3), read from its content; `label` stands in for the drawn
26
+ * name's words alone (a name marked up by a query), the context and trail
27
+ * still read after it.
28
+ * `description` adds what the row does not draw.
25
29
  */
26
30
  export function PaletteOption({ id, name, label, mark, context, contextKind = 'sentence', trail, current = null, checked, cursor = false, disabled = false, description, onPick, onPoint, ref }) {
27
- // The name's own id, private to the row, so it never meets a caller's id.
28
- const nameId = useId();
29
31
  const contextClass = contextKind === 'path' ? 'palette-context' : `palette-context palette-${contextKind}`;
30
- // The row is named by its name alone, which hides the words drawn after
31
- // it, so those are read as its description unless the caller words one.
32
- const described = description ??
33
- [context, typeof trail === 'string' || typeof trail === 'number' ? String(trail) : '', current]
34
- .filter((part) => typeof part === 'string' && part !== '')
35
- .join(', ');
36
- return (_jsxs("div", { "aria-checked": checked, "aria-description": described === '' ? undefined : described, "aria-disabled": disabled || undefined, "aria-label": label ?? (typeof name === 'string' ? name : undefined), "aria-labelledby": label === undefined && typeof name !== 'string' ? nameId : undefined, "aria-selected": cursor, className: cursor ? 'folder-menu-option cursor' : 'folder-menu-option', id: id, onClick: () => {
32
+ const hasContext = context !== undefined && context !== '';
33
+ // An empty label is none, as an empty context or description is.
34
+ const hasLabel = label !== undefined && label !== '';
35
+ // Named from its content, every word it draws in the order drawn, so the
36
+ // name a voice user speaks is the text they see. The spaces between the
37
+ // parts are for that name: the row's grid and flex rows draw none.
38
+ return (_jsxs("div", { "aria-checked": checked, "aria-description": description === undefined || description === '' ? undefined : description, "aria-disabled": disabled || undefined, "aria-selected": cursor, className: cursor ? 'folder-menu-option cursor' : 'folder-menu-option', id: id, onClick: () => {
37
39
  if (!disabled)
38
40
  onPick();
39
41
  }, onMouseMove: () => {
40
42
  if (!disabled && !cursor)
41
43
  onPoint?.();
42
- }, ref: ref, role: "option", children: [_jsx("span", { "aria-hidden": true, className: "row-icon", children: checked === undefined ? mark : null }), _jsxs("span", { className: "palette-text", children: [_jsx("span", { className: "row-name", id: nameId, children: name }), context === undefined || context === '' ? null : (_jsx("span", { className: contextClass, ...cutTooltip(context), children: contextKind === 'path' ? _jsx("bdi", { children: context }) : context }))] }), _jsxs("span", { className: "palette-trail", children: [trail === undefined || trail === null ? null : (_jsx("span", { className: "palette-meta", children: trail })), current === null ? null : _jsx(CurrentDot, { label: current })] })] }));
44
+ }, ref: ref, role: "option", children: [_jsx("span", { "aria-hidden": true, className: "row-icon", children: checked === undefined ? mark : null }), ' ', _jsxs("span", { className: "palette-text", children: [hasLabel ? _jsx(VisuallyHidden, { children: label }) : null, _jsx("span", { "aria-hidden": hasLabel ? true : undefined, className: "row-name", children: name }), !hasContext ? null : (_jsxs(_Fragment, { children: [' ', _jsx("span", { className: contextClass, ...cutTooltip(context), children: contextKind === 'path' ? _jsx("bdi", { children: context }) : context })] }))] }), ' ', _jsxs("span", { className: "palette-trail", children: [trail === undefined || trail === null ? null : (_jsx("span", { className: "palette-meta", children: trail })), current === null ? null : (_jsxs(_Fragment, { children: [' ', _jsx(CurrentDot, { label: current })] }))] })] }));
43
45
  }
44
46
  /**
45
47
  * A group's name over its rows in a palette's or a menu's list, with a
@@ -83,3 +83,11 @@ export interface PaneListProps extends RegionHandlers {
83
83
  * row's menu is reached from the keys too.
84
84
  */
85
85
  export declare function PaneList({ home, pointer, label, ref, children, ...handlers }: PaneListProps): ReactElement;
86
+ /**
87
+ * The handlers that make a pane's home (`PaneList` with `home`, a tree's
88
+ * `TreeList`) hand the keyboard's menu key (the Menu key, Shift-F10) to its
89
+ * cursor row's menu, around the region's own handlers (`regionHandlers`),
90
+ * which they call in turn. Spread after the region's. Not a home, the
91
+ * element keeps the region's menu alone.
92
+ */
93
+ export declare function useMenuKeyHome(home: boolean, region: RegionHandlers): Pick<DOMAttributes<HTMLElement>, 'onContextMenu' | 'onKeyDownCapture' | 'onMouseDownCapture' | 'onPointerDownCapture'>;
package/dist/pane/Pane.js CHANGED
@@ -55,18 +55,33 @@ export function PaneBox({ active = false, label, tone, as: Element = 'section',
55
55
  */
56
56
  export function PaneList({ home = false, pointer = false, label, ref, children, ...handlers }) {
57
57
  const region = regionHandlers(handlers);
58
+ const menuKey = useMenuKeyHome(home, region);
59
+ return (_jsx("div", { "aria-label": label, className: pointer ? 'pane-list pointer' : 'pane-list', "data-pane-home": home ? '' : undefined, ref: ref, tabIndex: home ? -1 : undefined, ...region, ...menuKey, children: children }));
60
+ }
61
+ /**
62
+ * The handlers that make a pane's home (`PaneList` with `home`, a tree's
63
+ * `TreeList`) hand the keyboard's menu key (the Menu key, Shift-F10) to its
64
+ * cursor row's menu, around the region's own handlers (`regionHandlers`),
65
+ * which they call in turn. Spread after the region's. Not a home, the
66
+ * element keeps the region's menu alone.
67
+ */
68
+ export function useMenuKeyHome(home, region) {
58
69
  // Whether the keyboard's menu key (the Menu key, Shift-F10) was the last
59
70
  // thing pressed: only it makes a menu the keyboard's, until the menu it
60
- // asks for, another key, or a press of the pointer. The event alone cannot
61
- // tell: Chromium sends the Menu key's as a mouse's pointer event.
71
+ // asks for, another key, or a press of the pointer or a mouse button. The
72
+ // event alone cannot tell: Chromium sends the Menu key's as a mouse's
73
+ // pointer event. A mouse's second button pressed while another is held
74
+ // brings a mousedown but no pointerdown, so both clear it.
62
75
  const menuKey = useRef(false);
63
- return (_jsx("div", { "aria-label": label, className: pointer ? 'pane-list pointer' : 'pane-list', "data-pane-home": home ? '' : undefined, ref: ref, tabIndex: home ? -1 : undefined, ...region, onContextMenu: (event) => {
76
+ return {
77
+ onContextMenu: (event) => {
64
78
  const fromKeys = menuKey.current;
65
79
  menuKey.current = false;
66
80
  if (home && fromKeys && event.target === event.currentTarget)
67
81
  menuOnCursorRow(event);
68
82
  region.onContextMenu?.(event);
69
- }, onKeyDownCapture: (event) => {
83
+ },
84
+ onKeyDownCapture: (event) => {
70
85
  menuKey.current =
71
86
  event.key === 'ContextMenu' ||
72
87
  (event.key === 'F10' &&
@@ -75,9 +90,14 @@ export function PaneList({ home = false, pointer = false, label, ref, children,
75
90
  !event.altKey &&
76
91
  !event.metaKey);
77
92
  region.onKeyDownCapture?.(event);
78
- }, onPointerDownCapture: () => {
93
+ },
94
+ onMouseDownCapture: () => {
79
95
  menuKey.current = false;
80
- }, children: children }));
96
+ },
97
+ onPointerDownCapture: () => {
98
+ menuKey.current = false;
99
+ }
100
+ };
81
101
  }
82
102
  /**
83
103
  * The keyboard's menu key aimed at a pane's home, which holds the focus
@@ -274,7 +274,11 @@ export function PaneTabs({ label, tabs, front, picked = NO_PICKS, onSelect, onCl
274
274
  ]
275
275
  .filter((part) => part !== undefined && part !== '')
276
276
  .join(', ');
277
- return (_jsxs("div", { ...tooltip(tab.tip, null, { value: true }), "aria-description": description === '' ? undefined : description, "aria-label": isPicked ? labels.picked(spoken) : spoken, "aria-selected": isFront, className: [
277
+ // The box draws the tab and takes its presses; the tab a screen reader
278
+ // meets is its face, which holds no control. The close control stands
279
+ // beside the face in the box, so it is never inside the tab, and is the
280
+ // pointer's alone.
281
+ return (_jsxs("div", { ...tooltip(tab.tip, null, { value: true }), className: [
278
282
  'pane-tab',
279
283
  isFront ? 'active' : '',
280
284
  tab.following === true ? 'following' : '',
@@ -310,9 +314,9 @@ export function PaneTabs({ label, tabs, front, picked = NO_PICKS, onSelect, onCl
310
314
  if (onReorder !== undefined) {
311
315
  drag.begin(tab.id, event.currentTarget, event.clientX);
312
316
  }
313
- }, ref: drag.tabRef(tab.id), role: "tab", style: {
317
+ }, ref: drag.tabRef(tab.id), role: "presentation", style: {
314
318
  '--pane-tab-floor': `${floor.context + (tab.context === undefined ? 0 : 1) + floor.name}ch`
315
- }, children: [tab.mark === undefined ? null : (_jsx("span", { "aria-hidden": true, className: "pane-tab-mark", children: tab.mark })), _jsx(TabLabel, { tab: tab }), tab.dirty === true ? (_jsx("span", { "aria-hidden": true, className: "pane-tab-dirty", ...tooltip(labels.notSaved), children: _jsx(StateMark, { tone: "warning", word: "" }) })) : null, tab.pinned === true ? (_jsx("span", { "aria-hidden": true, className: "pane-tab-pin", ...tooltip(labels.pinned), children: _jsx(Pin, { size: ICON_SM }) })) : closes(tab) ? (_jsx("button", { "aria-label": labels.close(spoken), className: "pane-tab-close hit-target quiet-control", onClick: (event) => {
319
+ }, children: [_jsxs("span", { "aria-description": description === '' ? undefined : description, "aria-label": isPicked ? labels.picked(spoken) : spoken, "aria-selected": isFront, className: "pane-tab-face", role: "tab", children: [tab.mark === undefined ? null : (_jsx("span", { "aria-hidden": true, className: "pane-tab-mark", children: tab.mark })), _jsx(TabLabel, { tab: tab }), tab.dirty === true ? (_jsx("span", { "aria-hidden": true, className: "pane-tab-dirty", ...tooltip(labels.notSaved), children: _jsx(StateMark, { tone: "warning", word: "" }) })) : null, tab.pinned === true ? (_jsx("span", { "aria-hidden": true, className: "pane-tab-pin", ...tooltip(labels.pinned), children: _jsx(Pin, { size: ICON_SM }) })) : null] }), tab.pinned !== true && closes(tab) ? (_jsx("button", { "aria-hidden": true, "aria-label": labels.close(spoken), className: "pane-tab-close hit-target quiet-control", onClick: (event) => {
316
320
  event.stopPropagation();
317
321
  onClose(tab.id);
318
322
  }, onDoubleClick: (event) => event.stopPropagation(), onMouseDown: keepFocus,
@@ -86,8 +86,19 @@
86
86
  cursor: default;
87
87
  }
88
88
 
89
+ /* The tab's face, the element a screen reader meets as the tab: its mark,
90
+ name, and dirty or pin mark in the box's row, the close control beside it
91
+ (a control is never inside a tab). */
92
+ :where(.listing-root) .pane-tab-face {
93
+ display: inline-flex;
94
+ flex: 0 1 auto;
95
+ align-items: center;
96
+ gap: var(--space-2);
97
+ min-width: 0;
98
+ }
99
+
89
100
  /* A mark ahead of the name takes its own room on top of the floor. */
90
- :where(.listing-root) .pane-tab:has(> .pane-tab-mark) {
101
+ :where(.listing-root) .pane-tab:has(> .pane-tab-face > .pane-tab-mark) {
91
102
  min-width: calc(
92
103
  var(--pane-tab-floor, 0ch) + var(--space-4) + var(--space-2) + var(--space-2) + var(--icon-lg) +
93
104
  2 * var(--line) + var(--icon-md) + var(--space-2)
@@ -95,7 +106,8 @@
95
106
  }
96
107
 
97
108
  /* A tab with no close control, pin, or mark of its own has nothing to keep room for. */
98
- :where(.listing-root) .pane-tab:not(:has(> :is(.pane-tab-close, .pane-tab-pin, .pane-tab-dirty))) {
109
+ :where(.listing-root)
110
+ .pane-tab:not(:has(> .pane-tab-close, > .pane-tab-face > :is(.pane-tab-pin, .pane-tab-dirty))) {
99
111
  padding-right: var(--space-4);
100
112
  }
101
113
 
package/dist/styles.css CHANGED
@@ -221,6 +221,37 @@ meter::-webkit-meter-even-less-good-value {
221
221
  backdrop-filter: var(--frost);
222
222
  }
223
223
 
224
+ /* The inline direction as inherited properties, for what a logical property
225
+ cannot say: --scroll-fade-inline-to, where the inline fade's gradient runs
226
+ (below), and --inline-flip, 1 or -1, a scaleX() that turns a glyph to
227
+ point toward the inline end. Each explicit dir attribute sets them, so the
228
+ nearest one wins, an LTR box inside an RTL one included; a reader gives
229
+ the left-to-right value as its fallback for a page with no dir attribute.
230
+ An explicit dir is read by attribute, not :dir(rtl): a bundler's CSS
231
+ transform (Lightning CSS, under Vite) rewrites :dir() into a list of
232
+ :lang() selectors, which a right-to-left box in an English page does not
233
+ match. Only dir="auto", whose direction comes from its text, needs
234
+ :dir(); scoped to it, a rewrite can reach no explicit dir. */
235
+ [dir='rtl'] {
236
+ --scroll-fade-inline-to: to left;
237
+ --inline-flip: -1;
238
+ }
239
+
240
+ [dir='ltr'] {
241
+ --scroll-fade-inline-to: to right;
242
+ --inline-flip: 1;
243
+ }
244
+
245
+ [dir='auto']:dir(rtl) {
246
+ --scroll-fade-inline-to: to left;
247
+ --inline-flip: -1;
248
+ }
249
+
250
+ [dir='auto']:dir(ltr) {
251
+ --scroll-fade-inline-to: to right;
252
+ --inline-flip: 1;
253
+ }
254
+
224
255
  /* A scrolling box whose content runs past an edge fades over the last
225
256
  --scroll-fade-size at that edge, so a clipped row reads as "more", not
226
257
  as a cut. On the scrolling element itself: .scroll-fade for the block
@@ -287,19 +318,11 @@ meter::-webkit-meter-even-less-good-value {
287
318
  /* The inline fade runs from the inline start, where the scroll timeline
288
319
  starts: the left edge, or the right in a right-to-left box, whose
289
320
  scroll position counts down from its right edge. */
290
- .scroll-fade-x {
291
- --scroll-fade-inline-to: to right;
292
- }
293
-
294
- .scroll-fade-x:dir(rtl) {
295
- --scroll-fade-inline-to: to left;
296
- }
297
-
298
321
  .scroll-fade-x {
299
322
  mask-image:
300
323
  linear-gradient(var(--ground), var(--ground)), linear-gradient(var(--ground), var(--ground)),
301
324
  linear-gradient(
302
- var(--scroll-fade-inline-to),
325
+ var(--scroll-fade-inline-to, to right),
303
326
  transparent,
304
327
  var(--ground) var(--scroll-fade-inline-start),
305
328
  var(--ground) calc(100% - var(--scroll-fade-inline-end)),
@@ -331,7 +354,7 @@ meter::-webkit-meter-even-less-good-value {
331
354
  transparent
332
355
  ),
333
356
  linear-gradient(
334
- var(--scroll-fade-inline-to),
357
+ var(--scroll-fade-inline-to, to right),
335
358
  transparent,
336
359
  var(--ground) var(--scroll-fade-inline-start),
337
360
  var(--ground) calc(100% - var(--scroll-fade-inline-end)),
@@ -344,7 +367,7 @@ meter::-webkit-meter-even-less-good-value {
344
367
  linear-gradient(var(--ground), var(--ground)), linear-gradient(var(--ground), var(--ground)),
345
368
  linear-gradient(to bottom, var(--ground) calc(100% - var(--scroll-fade-end)), transparent),
346
369
  linear-gradient(
347
- var(--scroll-fade-inline-to),
370
+ var(--scroll-fade-inline-to, to right),
348
371
  transparent,
349
372
  var(--ground) var(--scroll-fade-inline-start),
350
373
  var(--ground) calc(100% - var(--scroll-fade-inline-end)),
@@ -404,3 +404,13 @@
404
404
  gap: var(--space-8) var(--space-12);
405
405
  align-items: start;
406
406
  }
407
+
408
+ /* Set straight in a pane's body (a PaneList, a PanePage, a PageSlot, which
409
+ draws no box of its own, or one part of a SideBySide), a list of facts
410
+ or a row of them keeps the rows' inset from the pane's edge, where a
411
+ section head, a pane message, and a row's icon start, and a step of room
412
+ above and below. Nested in a row of lists, or inside a card, it is the
413
+ container's to inset. */
414
+ :is(.pane-list, .pane-page, .page-slot, .side-by-side-part) > :is(.fact-list, .fact-columns) {
415
+ padding: var(--space-4) var(--pane-row-inset);
416
+ }
@@ -89,6 +89,6 @@ export function TerminalMenu({ at, within, items, label, onRun, onClose }) {
89
89
  : 'folder-menu-option terminal-menu-item', id: `${itemId}-${index}`, onClick: () => run(item), onMouseMove: () => {
90
90
  if (item.enabled)
91
91
  setPointed(item.verb);
92
- }, role: "menuitem", children: [_jsx("span", { className: "terminal-menu-icon", children: _jsx(Icon, { "aria-hidden": true, size: ICON_MD }) }), _jsx("span", { className: "terminal-menu-label", children: item.label }), _jsx(KeyChord, { chord: item.chord })] }, item.verb));
92
+ }, role: "menuitem", children: [_jsx("span", { className: "terminal-menu-icon", children: _jsx(Icon, { "aria-hidden": true, size: ICON_MD }) }), _jsx("span", { className: "terminal-menu-label", children: item.label }), ' ', _jsx(KeyChord, { chord: item.chord })] }, item.verb));
93
93
  }) }), document.fullscreenElement ?? document.body);
94
94
  }
@@ -195,7 +195,8 @@
195
195
  }
196
196
 
197
197
  /* A terminal in a box of its own (TerminalBox). Framed, it is a console of
198
- a fixed height (--terminal-box-height, which the component sets) in the
198
+ a fixed height (--terminal-box-height, which the component sets, else
199
+ --terminal-box-default-height, 200px, for a box drawn by class alone) in the
199
200
  strong hairline a well wears, on the terminal's ground; filling, it
200
201
  takes its parent's room with no frame. Either way it pads the mount by
201
202
  the 8px every host adds, so the text starts 12px in. */
@@ -203,7 +204,7 @@
203
204
  display: flex;
204
205
  flex: none;
205
206
  min-width: 0;
206
- height: var(--terminal-box-height);
207
+ height: var(--terminal-box-height, var(--terminal-box-default-height));
207
208
  padding: var(--space-4);
208
209
  overflow: hidden;
209
210
  border: var(--line) solid var(--border-strong);
@@ -1097,8 +1097,8 @@ function rule(selector, tokens, depth = 0) {
1097
1097
  * declares or reads (the activity stripes' colour, a dialog's tone, top
1098
1098
  * inset, and pinned top, a date picker fraction field's digit count, a tab
1099
1099
  * strip's edge fades, a field's label column and chevron, a range's fill, a
1100
- * notice's tone, the scroll fade's edges), which an app token on `:root`
1101
- * would otherwise reach.
1100
+ * notice's tone, the scroll fade's edges, the inline direction's flip),
1101
+ * which an app token on `:root` would otherwise reach.
1102
1102
  */
1103
1103
  const BASE_TOKEN_NAMES = [
1104
1104
  // The scales of src/tokens.css: size, space, corner, line, timing,
@@ -1156,6 +1156,7 @@ const BASE_TOKEN_NAMES = [
1156
1156
  '--shell-header-height',
1157
1157
  '--traffic-light-inset',
1158
1158
  '--sidebar-width',
1159
+ '--terminal-box-default-height',
1159
1160
  '--focus-ring-width',
1160
1161
  '--focus-offset',
1161
1162
  '--focus-offset-flush',
@@ -1186,6 +1187,8 @@ const BASE_TOKEN_NAMES = [
1186
1187
  '--scroll-fade-inline-start',
1187
1188
  '--scroll-fade-inline-end',
1188
1189
  '--scroll-fade-inline-to',
1190
+ // The inline direction each dir attribute sets for what a logical property cannot say.
1191
+ '--inline-flip',
1189
1192
  // The hooks a component stylesheet declares or reads.
1190
1193
  '--stripe-ink',
1191
1194
  '--stripe-ground',
package/dist/tokens.css CHANGED
@@ -144,6 +144,10 @@
144
144
  --traffic-light-inset: 72px;
145
145
  --sidebar-width: 240px;
146
146
 
147
+ /* A framed terminal's height when its host gives none (TerminalBox, whose
148
+ TERMINAL_BOX_HEIGHT it matches): a dialog's console, ten lines and some. */
149
+ --terminal-box-default-height: 200px;
150
+
147
151
  /* Focus. One ring for everything focusable: a 2px accent line outside the
148
152
  control at focus-offset, so it follows the control's corner one pixel
149
153
  out. focus-offset-flush puts it on the control's edge, for a compact
@@ -57,6 +57,7 @@ function HexView({ reader, info }) {
57
57
  const rowsElement = useRef(null);
58
58
  const jumpField = useRef(null);
59
59
  const wheelRemainder = useRef(0);
60
+ // The drag in progress, which owns its window listeners and scroll timer.
60
61
  const drag = useRef(null);
61
62
  const digits = offsetDigits(info.sizeBytes);
62
63
  const top = screen?.top ?? 0;
@@ -130,7 +131,9 @@ function HexView({ reader, info }) {
130
131
  const command = event.metaKey && !event.ctrlKey && !event.altKey && !event.shiftKey;
131
132
  const shift = event.shiftKey && !event.metaKey && !event.ctrlKey && !event.altKey;
132
133
  const plain = !event.metaKey && !event.ctrlKey && !event.altKey && !event.shiftKey;
133
- const step = SELECTION_STEPS[event.key];
134
+ const step = Object.hasOwn(SELECTION_STEPS, event.key)
135
+ ? SELECTION_STEPS[event.key]
136
+ : undefined;
134
137
  let handled = true;
135
138
  if (command && event.key === 'a') {
136
139
  if (end > 0)
@@ -207,15 +210,17 @@ function HexView({ reader, info }) {
207
210
  useEffect(() => {
208
211
  focusQuietly(rowsElement.current);
209
212
  }, []);
213
+ /** Ends the drag in progress, if any: its scroll timer and window listeners go with it. */
210
214
  const endDrag = useCallback(() => {
211
- if (drag.current?.timer)
212
- clearInterval(drag.current.timer);
215
+ drag.current?.stop();
213
216
  drag.current = null;
214
217
  }, []);
215
218
  useEffect(() => endDrag, [endDrag]);
216
219
  const onMouseDown = (event) => {
217
220
  if (event.button !== 0)
218
221
  return;
222
+ // A drag whose mouseup never came (released outside the window) ends here.
223
+ endDrag();
219
224
  // The page's own selection would cover only the rows in the DOM, so the
220
225
  // view keeps its own and the native one never starts.
221
226
  event.preventDefault();
@@ -233,7 +238,6 @@ function HexView({ reader, info }) {
233
238
  y: event.clientY,
234
239
  timer: null
235
240
  };
236
- drag.current = state;
237
241
  const extend = () => {
238
242
  const focus = byteAt(state.x, state.y);
239
243
  if (focus)
@@ -256,10 +260,15 @@ function HexView({ reader, info }) {
256
260
  state.timer = null;
257
261
  }
258
262
  };
259
- const onUp = () => {
260
- window.removeEventListener('mousemove', onMove);
261
- window.removeEventListener('mouseup', onUp);
262
- endDrag();
263
+ const onUp = () => endDrag();
264
+ drag.current = {
265
+ stop: () => {
266
+ if (state.timer !== null)
267
+ clearInterval(state.timer);
268
+ state.timer = null;
269
+ window.removeEventListener('mousemove', onMove);
270
+ window.removeEventListener('mouseup', onUp);
271
+ }
263
272
  };
264
273
  window.addEventListener('mousemove', onMove);
265
274
  window.addEventListener('mouseup', onUp);