@bigpixelrocket/uiok 0.5.0 → 0.6.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 (83) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/dist/button/TextLink.d.ts +9 -2
  3. package/dist/button/TextLink.js +4 -3
  4. package/dist/button/button.css +7 -0
  5. package/dist/dialog/SectionedDialog.d.ts +37 -0
  6. package/dist/dialog/SectionedDialog.js +157 -0
  7. package/dist/dialog/dialog.css +102 -0
  8. package/dist/dialog/index.d.ts +4 -2
  9. package/dist/dialog/index.js +4 -2
  10. package/dist/frame/AppRoot.d.ts +1 -1
  11. package/dist/frame/AppRoot.js +2 -1
  12. package/dist/frame/Dock.d.ts +1 -1
  13. package/dist/frame/Dock.js +2 -1
  14. package/dist/frame/FilterChips.d.ts +5 -2
  15. package/dist/frame/FilterChips.js +35 -2
  16. package/dist/frame/FilterChips.logic.d.ts +24 -0
  17. package/dist/frame/FilterChips.logic.js +34 -0
  18. package/dist/frame/PageParts.d.ts +4 -3
  19. package/dist/frame/PageParts.js +10 -3
  20. package/dist/frame/SideBySide.d.ts +32 -0
  21. package/dist/frame/SideBySide.js +50 -0
  22. package/dist/frame/Tree.d.ts +1 -1
  23. package/dist/frame/Tree.js +3 -2
  24. package/dist/frame/WindowFrame.d.ts +1 -1
  25. package/dist/frame/WindowFrame.js +2 -1
  26. package/dist/frame/frame.css +48 -1
  27. package/dist/frame/index.d.ts +4 -2
  28. package/dist/frame/index.js +4 -2
  29. package/dist/grid/grid.css +1 -0
  30. package/dist/keyboard/Keyboard.logic.js +20 -3
  31. package/dist/keychord/KeyChord.d.ts +17 -1
  32. package/dist/keychord/KeyChord.js +16 -1
  33. package/dist/keychord/ShortcutIndex.d.ts +49 -0
  34. package/dist/keychord/ShortcutIndex.js +28 -0
  35. package/dist/keychord/index.d.ts +8 -2
  36. package/dist/keychord/index.js +8 -2
  37. package/dist/keychord/keychord.css +101 -0
  38. package/dist/labels/dialog.d.ts +2 -0
  39. package/dist/labels/dialog.js +2 -1
  40. package/dist/labels/keys.d.ts +5 -0
  41. package/dist/labels/keys.js +2 -1
  42. package/dist/listing/Listing.d.ts +36 -4
  43. package/dist/listing/Listing.js +21 -6
  44. package/dist/listing/PaneMessage.d.ts +7 -4
  45. package/dist/listing/PaneMessage.js +11 -4
  46. package/dist/listing/index.d.ts +1 -1
  47. package/dist/listing/listing.css +84 -4
  48. package/dist/menu/Menu.d.ts +52 -8
  49. package/dist/menu/Menu.js +288 -80
  50. package/dist/menu/Menu.logic.d.ts +39 -12
  51. package/dist/menu/Menu.logic.js +36 -8
  52. package/dist/menu/index.d.ts +4 -3
  53. package/dist/menu/index.js +2 -1
  54. package/dist/menu/menu.css +6 -0
  55. package/dist/palette/PaletteRows.d.ts +11 -2
  56. package/dist/palette/PaletteRows.js +6 -4
  57. package/dist/pane/Pane.d.ts +42 -6
  58. package/dist/pane/Pane.js +92 -5
  59. package/dist/pane/PaneKeys.d.ts +5 -1
  60. package/dist/pane/PaneKeys.js +28 -3
  61. package/dist/pane/PaneKeys.logic.d.ts +25 -0
  62. package/dist/pane/PaneKeys.logic.js +30 -0
  63. package/dist/pane/index.d.ts +1 -1
  64. package/dist/pane/index.js +1 -1
  65. package/dist/pane/usePaneKeys.d.ts +8 -1
  66. package/dist/pane/usePaneKeys.js +32 -12
  67. package/dist/styles.css +17 -3
  68. package/dist/surface/FactList.d.ts +54 -0
  69. package/dist/surface/FactList.js +33 -0
  70. package/dist/surface/index.d.ts +4 -1
  71. package/dist/surface/index.js +4 -1
  72. package/dist/surface/surface.css +75 -2
  73. package/dist/terminal/ghostty/core.d.ts +12 -4
  74. package/dist/terminal/ghostty/core.js +12 -4
  75. package/dist/terminal/index.d.ts +4 -2
  76. package/dist/terminal/index.js +4 -2
  77. package/dist/text/Code.d.ts +15 -0
  78. package/dist/text/Code.js +12 -0
  79. package/dist/text/index.d.ts +6 -1
  80. package/dist/text/index.js +6 -1
  81. package/dist/text/text.css +21 -0
  82. package/dist/themes/tokens.js +3 -1
  83. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -6,6 +6,40 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.6.0] - 2026-11-23
10
+
11
+ ### Added
12
+
13
+ - `SectionedDialog`, `SectionedDialogProps`, and `DialogSection` (`@bigpixelrocket/uiok/dialog`): a form too long for one view, in a fixed frame with a sidebar of its sections beside a column that scrolls, each section headed by its name; the sidebar marks the section in view as the column scrolls, a row scrolls the column to its section, and a row run from the keyboard moves the focus to the section's first control. The `dialog` label `sections` names the sidebar.
14
+ - `FactList`, `Fact`, `FactColumns`, and `FactValueTone` (`@bigpixelrocket/uiok/surface`): a headed list of facts set straight on a page, the names in a column of their own and each value beside its name, a long value wrapping whole as a block, a printed one keeping its lines; lists side by side in as many columns as fit.
15
+ - `Code` (`@bigpixelrocket/uiok/text`): a command, a path, or a name inside a sentence, in the code face on a faint track, wrapping anywhere.
16
+ - `ShortcutIndex`, `ShortcutGroup`, and `ShortcutRow` (`@bigpixelrocket/uiok/keychord`): every key a window answers, in groups of verbs whose chords stand in one column across the groups, with a changed chord's accent caps, a verb with no chord, and a dimmed verb.
17
+ - `Row`'s `radio` (`RowRadio`): a row that is one choice of several, led by a radio named by the row's name, its cursor key reached through a `verb`.
18
+ - `PaneBox`'s `bell`: the visual bell, which shoves the cursor row sideways for one beat each time its count rises, or flashes the selection fill under reduced motion.
19
+ - `TextLink`'s `tone` (`danger`): a link to something failing (a log file whose writes fail) in the danger tone, its `tip` (the reason) its accessible description too.
20
+ - `KeyChords` (`@bigpixelrocket/uiok/keychord`): several chords for one verb, parted by the new `keys` label `or`, drawn and read between them, so two chords never run together; `ShortcutRow` draws its chords with it.
21
+ - `usePaneKeys`'s `tabOrder` and `nextTabStop`'s `order` (`TabOrder`): `listing` walks each pane's listing first, then its other controls, then the other pane's listing, over the pure rule `listingFirstStop` (`WalkPane`).
22
+ - `Row`'s `onContextMenu(event, rowKey)`: a secondary click for the row's menu. The row moves the pane's cursor to itself before calling it, and cancels the browser's own menu. From the keyboard, the Menu key or Shift-F10 on a pane's home (`PaneList` with `home`) runs the cursor row's, its event placed under the row.
23
+ - `RegionHandlers`' `onContextMenu`, so every part that takes the region handlers (`PaneBox`, `PaneList`, `SpacePanel`, `WindowFrame`'s `group`, `Dock`, `TreePane`, `TreeList`) takes a secondary click for its own menu. The innermost menu wins: a row's, then its pane's, then the region's around it, each running only for a click nothing inside cancelled, so one click never opens two menus. A secondary click in a text field is never claimed, so the field keeps the browser's own Cut, Copy, and Paste menu.
24
+ - `Menu`'s submenus (`MenuSubmenuEntry`, `{ kind: 'submenu', id, label, entries }`), one level deep (`MenuLeafEntry`): an item that opens a second menu beside it, on its inline-end side or the other with no room there (`placeMenu`'s `{ beside, rtl }`, `MenuFrom`). → (← right to left), Return, or Space opens it with the keys on its first item, ← goes back to its item, Escape closes it alone and Tab the whole menu; resting on or pressing its item opens it for the pointer, which may cross other items on its way in. Both menus read in the direction of what opened them (`Menu`'s new `dir`, else its anchor's or its place's). The item is a `menuitem` with `aria-haspopup="menu"` and `aria-expanded`, the submenu a `menu` labelled by it.
25
+ - `PaletteOption`'s `checked`: a row picked with others (the scripts a project includes), an `option` with `aria-checked` and the menu's check mark in its icon column while ticked. A press, or Return on the cursor row, toggles it through `onPick`; Space stays in the query.
26
+ - `SideBySide` (`@bigpixelrocket/uiok/frame`): two of a page's listings or sections side by side while the room the pair itself is given is `from` pixels wide or more, stacked in less, each a group named by its label. It measures its own width (`data-layout`), so a narrowed pane stacks them in a wide window, and holds no cursor: the page's one cursor walks the first part's rows, then the second's.
27
+ - `FilterChips` keeps to one line: chips that do not fit scroll sideways under the inline edge fade (`.scroll-fade-x`) with no scrollbar drawn, a mouse's vertical wheel scrolls the row sideways while it can move that way (left to the page otherwise; a trackpad's sideways swipe stays the browser's), and a chip the keys reach scrolls into view. Nothing scrolls smoothly.
28
+ - `BUDGETED_TERMINALS_PER_PAGE` (`@bigpixelrocket/uiok/terminal`): how many terminals one page's shared engine memory is budgeted for (17), so an app can test how many it opens against it; past it, terminals that fill their histories to the ceiling can exhaust the shared memory.
29
+
30
+ ### Changed
31
+
32
+ - `menuKeyAction(event, rtl)` maps → and ← (`open`, `back`), and its `close` says whether it closes one level (Escape, `all: false`) or the whole menu (Tab, `all: true`). A `Menu` now holds → and ← too, which no longer reach its owner while it is open.
33
+ - `KeyLabels` takes `or` ("or" in English). An app that builds a whole `keys` group of its own, not an override through `UiokProvider`, adds it.
34
+ - `DialogLabels` takes `sections` ("Sections" in English), the name of a `SectionedDialog`'s sidebar. An app that builds a whole `dialog` group of its own adds it.
35
+ - `PaneMessage` draws its words in one `.pane-message-text`, so inline code flows with them.
36
+ - `PaneMessage` and `PageNote` drawn outside every listing scope carry the scope themselves (a `.listing-root` around them), as `Listing` does, so a note after a listing keeps its look anywhere.
37
+
38
+ ### Fixed
39
+
40
+ - Tab from a pane's listing (`usePaneKeys`) no longer stops on a control the stylesheet hides, which refused the focus and held Tab in place, nor on a hidden input: the walk goes on past such a stop in the same direction, and ends on the pane's home if none takes the focus.
41
+ - `isTextEditingTarget` resolves inherited editability as the browser does (`isContentEditable`, else the nearest `contenteditable` that is not `inherit`), so editable content inside an editable parent counts as a text field and keeps its native menu and keys.
42
+
9
43
  ## [0.5.0] - 2026-11-23
10
44
 
11
45
  ### Added
@@ -271,7 +305,8 @@ The first published version. The package is published to npm as `@bigpixelrocket
271
305
  - `lucide-react` 1.31 or later within 1.x is a peer dependency.
272
306
  - Terminal (`@bigpixelrocket/uiok/terminal`, `docs/components/terminal.md`): `Terminal`, Ghostty's VT engine as WebAssembly drawn on a canvas, read-only without `onInput`, with a Copy and Paste menu whose chords come from `menuChords`, a visual bell, line-editing actions bound by `actionForKey`, and `TerminalScrollbackContext`. The package root does not export it, so an app without a terminal never loads its assets. Its words are the new `terminal` label group; the package now ships a `NOTICE` with the engine's, adapter's, and font's licences.
273
307
 
274
- [Unreleased]: https://github.com/Bigpixelrocket/uiok/compare/v0.5.0...HEAD
308
+ [Unreleased]: https://github.com/Bigpixelrocket/uiok/compare/v0.6.0...HEAD
309
+ [0.6.0]: https://github.com/Bigpixelrocket/uiok/compare/v0.5.0...v0.6.0
275
310
  [0.5.0]: https://github.com/Bigpixelrocket/uiok/compare/v0.4.0...v0.5.0
276
311
  [0.4.0]: https://github.com/Bigpixelrocket/uiok/compare/v0.3.0...v0.4.0
277
312
  [0.3.0]: https://github.com/Bigpixelrocket/uiok/compare/v0.2.3...v0.3.0
@@ -29,6 +29,12 @@ export interface TextLinkProps {
29
29
  readonly tip?: string;
30
30
  /** The chord that opens it, as text, written after the tooltip's words. */
31
31
  readonly shortcut?: string;
32
+ /**
33
+ * `danger`: what it opens is failing (a log file whose writes fail), so
34
+ * its words and glyph take the danger tone, and its `tip` (the reason)
35
+ * is its accessible description too, so a screen reader says why.
36
+ */
37
+ readonly tone?: 'danger';
32
38
  }
33
39
  /**
34
40
  * A link in words: a button that reads as a link inside a sentence, a
@@ -37,7 +43,8 @@ export interface TextLinkProps {
37
43
  * takes the keyboard's focus with the shared ring. It is a button because
38
44
  * the host decides how to open what it names (an external browser, a tab),
39
45
  * so it never navigates the page itself. A `disabled` link dims and
40
- * refuses the press; `label` names it when its words are short. Styled by `.text-link` in
46
+ * refuses the press; `label` names it when its words are short; `tone`
47
+ * `danger` sets it in the danger tone with its reason described. Styled by `.text-link` in
41
48
  * `@bigpixelrocket/uiok/styles.css`.
42
49
  */
43
- export declare function TextLink({ children, onClick, icon: Icon, code, tip, shortcut, label, disabled }: TextLinkProps): ReactElement;
50
+ export declare function TextLink({ children, onClick, icon: Icon, code, tip, shortcut, label, disabled, tone }: TextLinkProps): ReactElement;
@@ -8,9 +8,10 @@ import { tooltip } from '../tooltip/Tooltip.logic.js';
8
8
  * takes the keyboard's focus with the shared ring. It is a button because
9
9
  * the host decides how to open what it names (an external browser, a tab),
10
10
  * so it never navigates the page itself. A `disabled` link dims and
11
- * refuses the press; `label` names it when its words are short. Styled by `.text-link` in
11
+ * refuses the press; `label` names it when its words are short; `tone`
12
+ * `danger` sets it in the danger tone with its reason described. Styled by `.text-link` in
12
13
  * `@bigpixelrocket/uiok/styles.css`.
13
14
  */
14
- export function TextLink({ children, onClick, icon: Icon, code = false, tip, shortcut, label, disabled = false }) {
15
- return (_jsxs("button", { "aria-label": label, className: code ? 'text-link code' : 'text-link', disabled: disabled, onClick: onClick, type: "button", ...(tip === undefined && shortcut === undefined ? {} : tooltip(tip ?? children, shortcut)), children: [Icon === undefined ? null : _jsx(Icon, { "aria-hidden": true, size: ICON_SM }), _jsx("span", { className: "text-link-words", children: children })] }));
15
+ export function TextLink({ children, onClick, icon: Icon, code = false, tip, shortcut, label, disabled = false, tone }) {
16
+ return (_jsxs("button", { "aria-description": tone === 'danger' ? tip : undefined, "aria-label": label, className: ['text-link', code ? 'code' : '', tone ?? ''].filter(Boolean).join(' '), disabled: disabled, onClick: onClick, type: "button", ...(tip === undefined && shortcut === undefined ? {} : tooltip(tip ?? children, shortcut)), children: [Icon === undefined ? null : _jsx(Icon, { "aria-hidden": true, size: ICON_SM }), _jsx("span", { className: "text-link-words", children: children })] }));
16
17
  }
@@ -309,3 +309,10 @@
309
309
  .text-link:disabled {
310
310
  color: var(--text-dim);
311
311
  }
312
+
313
+ /* What it opens is failing (`tone="danger"`): the words and glyph in the
314
+ danger text tone, which keeps 4.5:1 as the accent's does; the reason is
315
+ its tooltip and description. A disabled one still dims. */
316
+ .text-link.danger:not(:disabled) {
317
+ color: var(--danger-text);
318
+ }
@@ -0,0 +1,37 @@
1
+ import { type ReactElement, type ReactNode } from 'react';
2
+ import { type ModalDialogProps } from './ModalDialog.js';
3
+ /** One headed group of a `SectionedDialog`. */
4
+ export interface DialogSection {
5
+ /** Names the section to the sidebar; unique in the dialog, the same in every language. */
6
+ readonly id: string;
7
+ /** Its name, in the sidebar and as the overline over its rows: "Depends on". */
8
+ readonly title: string;
9
+ /** Its rows: a `FieldGrid` of `FieldRow`s, notes, a listing. */
10
+ readonly children: ReactNode;
11
+ }
12
+ /** Props for {@link SectionedDialog}. */
13
+ export interface SectionedDialogProps extends Omit<ModalDialogProps, 'children' | 'size'> {
14
+ /** The body's groups, in order; the sidebar lists them in the same order. */
15
+ readonly sections: readonly DialogSection[];
16
+ /** The section brought to the top as the dialog opens; the first unless given. */
17
+ readonly openAt?: string;
18
+ /**
19
+ * A line over the scrolling column that stays in view however far it is
20
+ * scrolled: a save that failed (a danger `Notice`).
21
+ */
22
+ readonly notice?: ReactNode;
23
+ }
24
+ /**
25
+ * A form too long for one view (a command's settings, a connection's
26
+ * options), in a dialog with a sidebar of its sections beside a column that
27
+ * scrolls: each section's name heads its group as an overline, a hairline
28
+ * between groups. The sidebar marks the section in view and follows the
29
+ * column as it scrolls, the way the Settings dialog marks a page's
30
+ * subsection; a row scrolls the column to its section. A press leaves the
31
+ * focus where it was; a row chosen from the keyboard (Return or Space on
32
+ * it) moves the focus to its section's first control, so a keyboard user
33
+ * lands where they asked to go. A fixed frame (`.sectioned-dialog`), so the
34
+ * dialog does not resize as its fields change; everything else, the title,
35
+ * the legend and its keys, and Escape, is `ModalDialog`'s.
36
+ */
37
+ export declare function SectionedDialog({ sections, openAt, notice, className, ...dialog }: SectionedDialogProps): ReactElement;
@@ -0,0 +1,157 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId, useLayoutEffect, useRef, useState } from 'react';
3
+ import { useLabels } from '../labels/UiokProvider.js';
4
+ import { spiedSubsection, subsectionScrollTop } from '../shell/SettingsDialog.logic.js';
5
+ import { cutTooltip } from '../tooltip/Tooltip.logic.js';
6
+ import { ModalDialog } from './ModalDialog.js';
7
+ /** The attribute that marks a section of a `SectionedDialog`'s body, carrying its id. */
8
+ const SECTION_ATTRIBUTE = 'data-dialog-section';
9
+ /** What can take the focus inside a section: its first control, for a section chosen from the keyboard. */
10
+ const FOCUSABLE = 'input:not([type="hidden"]), select, textarea, button, [href], [tabindex]';
11
+ /**
12
+ * Moves the focus to the first control of `section` that Tab would stop on
13
+ * and that takes it: one in the Tab order (a row's control out of it, at
14
+ * `tabIndex` -1, is the cursor row's keys' to run), not disabled (by itself
15
+ * or a disabled fieldset), not hidden, and, should the browser still refuse
16
+ * one, the next. So Tab goes on from it as the dialog's Tab cycle expects.
17
+ * Returns the control it focused, null for none.
18
+ */
19
+ const focusFirstControl = (section) => {
20
+ for (const control of section.querySelectorAll(FOCUSABLE)) {
21
+ if (control.tabIndex < 0 ||
22
+ control.matches(':disabled') ||
23
+ control.closest('[hidden], [inert]') !== null) {
24
+ continue;
25
+ }
26
+ control.focus({ preventScroll: true });
27
+ if (control.ownerDocument.activeElement === control)
28
+ return control;
29
+ }
30
+ return null;
31
+ };
32
+ /**
33
+ * Where each section starts in the column, in pixels from the top of its
34
+ * scrolled content.
35
+ */
36
+ const sectionAnchors = (column) => {
37
+ const columnTop = column.getBoundingClientRect().top - column.scrollTop;
38
+ return [...column.querySelectorAll(`[${SECTION_ATTRIBUTE}]`)].map((section) => ({
39
+ id: section.getAttribute(SECTION_ATTRIBUTE) ?? '',
40
+ top: section.getBoundingClientRect().top - columnTop
41
+ }));
42
+ };
43
+ /** A press on a sidebar row leaves the focus where it was, as a list row's does. */
44
+ const keepFocus = (event) => event.preventDefault();
45
+ /**
46
+ * A form too long for one view (a command's settings, a connection's
47
+ * options), in a dialog with a sidebar of its sections beside a column that
48
+ * scrolls: each section's name heads its group as an overline, a hairline
49
+ * between groups. The sidebar marks the section in view and follows the
50
+ * column as it scrolls, the way the Settings dialog marks a page's
51
+ * subsection; a row scrolls the column to its section. A press leaves the
52
+ * focus where it was; a row chosen from the keyboard (Return or Space on
53
+ * it) moves the focus to its section's first control, so a keyboard user
54
+ * lands where they asked to go. A fixed frame (`.sectioned-dialog`), so the
55
+ * dialog does not resize as its fields change; everything else, the title,
56
+ * the legend and its keys, and Escape, is `ModalDialog`'s.
57
+ */
58
+ export function SectionedDialog({ sections, openAt, notice, className, ...dialog }) {
59
+ const labels = useLabels().dialog;
60
+ const prefix = useId();
61
+ // The scrolling column, as state: a dialog under a `DialogLayer` mounts
62
+ // its frame only once the layer's element exists, after this component's
63
+ // first commit, so the effects below wait for the column, not the mount.
64
+ const [column, setColumn] = useState(null);
65
+ // Set while the column scrolls to the section a sidebar row chose, so that
66
+ // scroll keeps the choice marked even where the column cannot bring it to
67
+ // the top (a short last section).
68
+ const chosenScrollRef = useRef(false);
69
+ const [current, setCurrent] = useState(openAt ?? sections[0]?.id ?? null);
70
+ const openAtRef = useRef(openAt);
71
+ const spy = (column) => {
72
+ setCurrent(spiedSubsection(sectionAnchors(column), column));
73
+ };
74
+ // Scrolls the column to a chosen section, keeping the scroll it causes from
75
+ // moving the mark off it.
76
+ const scrollTo = (column, id) => {
77
+ const top = subsectionScrollTop(sectionAnchors(column), id);
78
+ if (top === null)
79
+ return;
80
+ const before = column.scrollTop;
81
+ column.scrollTop = top;
82
+ chosenScrollRef.current = column.scrollTop !== before;
83
+ };
84
+ const show = (id, focus) => {
85
+ setCurrent(id);
86
+ if (column === null)
87
+ return;
88
+ scrollTo(column, id);
89
+ if (focus) {
90
+ const section = [...column.querySelectorAll(`[${SECTION_ATTRIBUTE}]`)].find((candidate) => candidate.getAttribute(SECTION_ATTRIBUTE) === id);
91
+ const control = section === undefined ? null : focusFirstControl(section);
92
+ // A control past the column's end (a long list above it in its
93
+ // section) comes into view, the scroll keeping the section marked.
94
+ if (control !== null) {
95
+ const view = column.getBoundingClientRect();
96
+ const box = control.getBoundingClientRect();
97
+ if (box.top < view.top || box.bottom > view.bottom) {
98
+ const before = column.scrollTop;
99
+ control.scrollIntoView({ block: 'nearest' });
100
+ chosenScrollRef.current = chosenScrollRef.current || column.scrollTop !== before;
101
+ }
102
+ }
103
+ }
104
+ };
105
+ // Opens on the section asked for, or marks the one in view, once the
106
+ // column is in the document.
107
+ useLayoutEffect(() => {
108
+ const first = openAtRef.current;
109
+ if (column === null)
110
+ return;
111
+ if (first === undefined) {
112
+ spy(column);
113
+ }
114
+ else {
115
+ scrollTo(column, first);
116
+ }
117
+ // Runs once per column: a later openAt does not scroll an open dialog.
118
+ }, [column]);
119
+ // A section that grows or shrinks as it is filled in (a dependency added)
120
+ // moves the one in view without a scroll, so the mark follows the content.
121
+ useLayoutEffect(() => {
122
+ if (column === null || typeof MutationObserver === 'undefined')
123
+ return undefined;
124
+ const observer = new MutationObserver(() => {
125
+ if (!chosenScrollRef.current)
126
+ spy(column);
127
+ });
128
+ observer.observe(column, { childList: true, subtree: true });
129
+ return () => observer.disconnect();
130
+ }, [column]);
131
+ const classes = className === undefined ? 'sectioned-dialog' : `sectioned-dialog ${className}`;
132
+ return (_jsx(ModalDialog, { ...dialog, className: classes, children: _jsxs("div", { className: "sectioned-dialog-body", children: [_jsx("nav", { "aria-label": labels.sections, className: "sectioned-dialog-nav scroll-fade", children: sections.map((section) => (_jsx("button", { "aria-controls": `${prefix}-${section.id}`, "aria-current": section.id === current ? 'location' : undefined, className: "sectioned-dialog-nav-row", onClick: (event) => show(section.id, event.detail === 0),
133
+ // Return on a row goes to its section, as Space does, instead
134
+ // of running the dialog's primary verb, which plain Return
135
+ // runs from anywhere else in the dialog.
136
+ onKeyDown: (event) => {
137
+ if (event.key !== 'Enter' ||
138
+ event.nativeEvent.isComposing ||
139
+ event.repeat ||
140
+ event.altKey ||
141
+ event.ctrlKey ||
142
+ event.metaKey ||
143
+ event.shiftKey) {
144
+ return;
145
+ }
146
+ event.preventDefault();
147
+ event.stopPropagation();
148
+ show(section.id, true);
149
+ }, onMouseDown: keepFocus, type: "button", ...cutTooltip(section.title), children: section.title }, section.id))) }), _jsxs("div", { className: "sectioned-dialog-column", children: [notice, _jsx("div", { className: "sectioned-dialog-sections scroll-fade", onScroll: (event) => {
150
+ if (chosenScrollRef.current) {
151
+ chosenScrollRef.current = false;
152
+ }
153
+ else {
154
+ spy(event.currentTarget);
155
+ }
156
+ }, ref: setColumn, children: sections.map((section) => (_jsxs("section", { "aria-labelledby": `${prefix}-${section.id}-title`, className: "dialog-section", id: `${prefix}-${section.id}`, [SECTION_ATTRIBUTE]: section.id, children: [_jsx("h3", { className: "dialog-section-title overline", id: `${prefix}-${section.id}-title`, children: section.title }), section.children] }, section.id))) })] })] }) }));
157
+ }
@@ -423,6 +423,108 @@
423
423
  font-weight: var(--font-weight-strong);
424
424
  }
425
425
 
426
+ /* ---- Sectioned dialog (SectionedDialog) ----
427
+
428
+ A form too long for one view: a sidebar of its sections beside a column
429
+ that scrolls, both reaching the frame's edges from the title strip's rule
430
+ down to the legend's hairline. A fixed frame, so the dialog keeps its
431
+ size as fields come and go, that fits the smallest window. */
432
+ .dialog.sectioned-dialog {
433
+ width: min(860px, 100%);
434
+ height: min(640px, 100%);
435
+ }
436
+
437
+ .sectioned-dialog-body {
438
+ display: grid;
439
+ grid-template-columns: minmax(140px, 170px) minmax(0, 1fr);
440
+ flex: 1 1 auto;
441
+ min-height: 0;
442
+ margin: calc(-1 * var(--space-6));
443
+ }
444
+
445
+ /* The sidebar, a shade over the dialog's surface; the hairline beside it
446
+ is the column's, since its own edge fade would mask one of its own. */
447
+ .sectioned-dialog-nav {
448
+ display: flex;
449
+ flex-direction: column;
450
+ gap: var(--space-1);
451
+ overflow-y: auto;
452
+ padding: var(--space-4);
453
+ background: var(--scrim-strong);
454
+ }
455
+
456
+ /* A section's row: the Settings sidebar's row, its hover and press the
457
+ base sheet's quiet recipes. */
458
+ .sectioned-dialog-nav-row {
459
+ display: block;
460
+ width: 100%;
461
+ min-height: var(--bar-height);
462
+ margin: 0;
463
+ padding: calc((var(--bar-height) - var(--line-height-compact)) / 2) var(--space-4);
464
+ overflow: hidden;
465
+ border: 0;
466
+ border-radius: var(--radius-md);
467
+ background: none;
468
+ color: var(--text-dim);
469
+ cursor: default;
470
+ font: var(--font-weight-regular) var(--font-size-small) / var(--line-height-compact)
471
+ var(--font-ui);
472
+ text-align: start;
473
+ text-overflow: ellipsis;
474
+ white-space: nowrap;
475
+ }
476
+
477
+ .sectioned-dialog-nav-row:focus-visible {
478
+ outline-offset: var(--focus-offset-inset);
479
+ }
480
+
481
+ /* The section in view: the current item's tint and ring, its words full. */
482
+ .sectioned-dialog-nav-row[aria-current='location'] {
483
+ background: var(--current-bg);
484
+ box-shadow: inset 0 0 0 var(--line) var(--current-ring);
485
+ color: var(--text);
486
+ }
487
+
488
+ /* The column: a failed save's notice, which never scrolls, over the
489
+ sections, which do, fading at an edge while more lies past it. */
490
+ .sectioned-dialog-column {
491
+ display: flex;
492
+ flex-direction: column;
493
+ min-width: 0;
494
+ min-height: 0;
495
+ border-inline-start: var(--line) solid var(--border);
496
+ }
497
+
498
+ .sectioned-dialog-column > .notice {
499
+ flex: none;
500
+ padding: var(--space-4) var(--space-8) 0;
501
+ }
502
+
503
+ .sectioned-dialog-sections {
504
+ flex: 1 1 auto;
505
+ min-width: 0;
506
+ min-height: 0;
507
+ overflow-y: auto;
508
+ padding: var(--space-6) var(--space-8) var(--space-8);
509
+ }
510
+
511
+ /* Each section a group under its overline, a hairline between them. */
512
+ .dialog-section {
513
+ padding: var(--space-8) 0;
514
+ }
515
+
516
+ .dialog-section:first-child {
517
+ padding-top: 0;
518
+ }
519
+
520
+ .dialog-section + .dialog-section {
521
+ border-top: var(--line) solid var(--border);
522
+ }
523
+
524
+ .dialog-section > .dialog-section-title {
525
+ margin: 0 0 var(--space-6);
526
+ }
527
+
426
528
  /* ---- Fact list (DialogFacts) ----
427
529
 
428
530
  A desktop property list: one line per row, the labels in a leading
@@ -4,12 +4,14 @@
4
4
  * lists a confirmation's body holds (`DialogItems` for what it acts on,
5
5
  * `DialogStatements` for the statements it runs, `DialogFacts` for facts
6
6
  * about the action), the `ProgressDialog` of long work, the
7
- * `TypedNameDialog` for work a slip would cost most, and the
8
- * `DialogLayer` a host mounts them into.
7
+ * `TypedNameDialog` for work a slip would cost most, the
8
+ * `SectionedDialog` of a form too long for one view, and the `DialogLayer` a
9
+ * host mounts them into.
9
10
  */
10
11
  export { ConfirmDialog, type ConfirmDialogProps, type ConfirmTone } from './ConfirmDialog.js';
11
12
  export { DialogLayer, type DialogLayerProps } from './DialogLayer.js';
12
13
  export { ProgressDialog, type ProgressDialogProps } from './ProgressDialog.js';
14
+ export { SectionedDialog, type DialogSection, type SectionedDialogProps } from './SectionedDialog.js';
13
15
  export { TypedNameDialog, type TypedNameDialogProps } from './TypedNameDialog.js';
14
16
  export { DIALOG_ITEMS_SHOWN, DialogFacts, DialogItems, DialogStatements, shownItems, type DialogFact, type DialogFactsProps, type DialogItem, type DialogItemGroup, type DialogItemsProps, type DialogStatementsProps } from './DialogLists.js';
15
17
  export { DialogLegend, type DialogLegendProps } from './DialogLegend.js';
@@ -4,12 +4,14 @@
4
4
  * lists a confirmation's body holds (`DialogItems` for what it acts on,
5
5
  * `DialogStatements` for the statements it runs, `DialogFacts` for facts
6
6
  * about the action), the `ProgressDialog` of long work, the
7
- * `TypedNameDialog` for work a slip would cost most, and the
8
- * `DialogLayer` a host mounts them into.
7
+ * `TypedNameDialog` for work a slip would cost most, the
8
+ * `SectionedDialog` of a form too long for one view, and the `DialogLayer` a
9
+ * host mounts them into.
9
10
  */
10
11
  export { ConfirmDialog } from './ConfirmDialog.js';
11
12
  export { DialogLayer } from './DialogLayer.js';
12
13
  export { ProgressDialog } from './ProgressDialog.js';
14
+ export { SectionedDialog } from './SectionedDialog.js';
13
15
  export { TypedNameDialog } from './TypedNameDialog.js';
14
16
  export { DIALOG_ITEMS_SHOWN, DialogFacts, DialogItems, DialogStatements, shownItems } from './DialogLists.js';
15
17
  export { DialogLegend } from './DialogLegend.js';
@@ -1,5 +1,5 @@
1
1
  import type { ReactElement, ReactNode, Ref } from 'react';
2
- import type { RegionHandlers } from '../pane/Pane.js';
2
+ import { type RegionHandlers } from '../pane/Pane.js';
3
3
  /** Props for {@link AppRoot}. */
4
4
  export interface AppRootProps {
5
5
  /**
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { regionHandlers } from '../pane/Pane.js';
2
3
  /**
3
4
  * The app window's root: one column the window's height holding its
4
5
  * content, which owns the whole window, its top band included. A window
@@ -14,7 +15,7 @@ export function AppRoot({ channel = null, children }) {
14
15
  * out of the Tab order, never a control, so it draws no ring.
15
16
  */
16
17
  export function SpacePanel({ ref, children, ...handlers }) {
17
- return (_jsx("div", { className: "space-panel", ref: ref, tabIndex: -1, ...handlers, children: children }));
18
+ return (_jsx("div", { className: "space-panel", ref: ref, tabIndex: -1, ...regionHandlers(handlers), children: children }));
18
19
  }
19
20
  /**
20
21
  * One page of the main pane: the front tab's page lays out as the pane's
@@ -1,5 +1,5 @@
1
1
  import { type ReactElement, type ReactNode, type Ref } from 'react';
2
- import type { RegionHandlers } from '../pane/Pane.js';
2
+ import { type RegionHandlers } from '../pane/Pane.js';
3
3
  /**
4
4
  * The height a dock takes: the height its host keeps, between `min` and
5
5
  * the room under the band less what the main pane keeps (`pageMin`), in
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Children, useLayoutEffect, useState } from 'react';
3
+ import { regionHandlers } from '../pane/Pane.js';
3
4
  import { useSharedRef } from './sharedRef.js';
4
5
  import { drawn } from './WindowFrame.js';
5
6
  /**
@@ -107,7 +108,7 @@ export function Dock({ open, label, height, pageMin = 160, active = false, tone,
107
108
  const classes = ['pane', 'window-dock', active ? 'active' : '', open ? '' : 'closed']
108
109
  .filter(Boolean)
109
110
  .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", 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
+ return (_jsxs("section", { "aria-label": label, className: classes, "data-tone": tone, ref: attach, style: { height: shown }, ...regionHandlers(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
112
  }
112
113
  /**
113
114
  * A dock's log: its entries over a hairline each, the newest at the foot;
@@ -1,5 +1,5 @@
1
1
  import type { LucideIcon } from 'lucide-react';
2
- import type { ReactElement } from 'react';
2
+ import { type ReactElement } from 'react';
3
3
  /** One filter of a quick row. */
4
4
  export interface FilterChip<Id extends string> {
5
5
  readonly id: Id;
@@ -23,6 +23,9 @@ export interface FilterChipsProps<Id extends string> {
23
23
  * A pane's quick row of filters under its path bar (`pane-quick-row`), as a
24
24
  * sidebar's Running and Updates: each a quiet button with its glyph, its
25
25
  * word, and its count, pressed while on. A press toggles its filter and
26
- * leaves the focus where it was.
26
+ * leaves the focus where it was. The row is one line: chips that do not
27
+ * fit scroll sideways under an edge fade (`.scroll-fade-x`), a mouse's
28
+ * vertical wheel scrolls it sideways while it can move that way
29
+ * (`sidewaysWheel`), and a chip the keys reach comes whole into view.
27
30
  */
28
31
  export declare function FilterChips<Id extends string>({ chips, on, onToggle, label }: FilterChipsProps<Id>): ReactElement;
@@ -1,13 +1,46 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef } from 'react';
2
3
  import { ICON_SM } from '../icon/sizes.js';
4
+ import { sidewaysWheel } from './FilterChips.logic.js';
3
5
  /**
4
6
  * A pane's quick row of filters under its path bar (`pane-quick-row`), as a
5
7
  * sidebar's Running and Updates: each a quiet button with its glyph, its
6
8
  * word, and its count, pressed while on. A press toggles its filter and
7
- * leaves the focus where it was.
9
+ * leaves the focus where it was. The row is one line: chips that do not
10
+ * fit scroll sideways under an edge fade (`.scroll-fade-x`), a mouse's
11
+ * vertical wheel scrolls it sideways while it can move that way
12
+ * (`sidewaysWheel`), and a chip the keys reach comes whole into view.
8
13
  */
9
14
  export function FilterChips({ chips, on, onToggle, label }) {
10
- return (_jsx("div", { "aria-label": label, className: "pane-quick-row", role: "toolbar", children: chips.map((chip) => {
15
+ const rowRef = useRef(null);
16
+ // A wheel listener React would make passive, so it can keep the page
17
+ // still while it turns the row; one it leaves alone scrolls the page.
18
+ useEffect(() => {
19
+ const row = rowRef.current;
20
+ if (row === null)
21
+ return undefined;
22
+ const onWheel = (event) => {
23
+ // Shift turns a wheel sideways and Control (or Command) zooms on their
24
+ // own; the row leaves both to the browser.
25
+ if (event.shiftKey || event.ctrlKey || event.metaKey)
26
+ return;
27
+ const delta = sidewaysWheel(event, row, getComputedStyle(row).direction === 'rtl');
28
+ if (delta === null)
29
+ return;
30
+ event.preventDefault();
31
+ row.scrollLeft += delta;
32
+ };
33
+ row.addEventListener('wheel', onWheel, { passive: false });
34
+ return () => row.removeEventListener('wheel', onWheel);
35
+ }, []);
36
+ return (_jsx("div", { "aria-label": label, className: "pane-quick-row scroll-fade-x",
37
+ // A chip the keys reach comes whole into view, past the edge fade, at
38
+ // once: nothing here scrolls smoothly, so reduced motion has nothing to stop.
39
+ onFocus: (event) => {
40
+ if (event.target !== event.currentTarget) {
41
+ event.target.scrollIntoView?.({ block: 'nearest', inline: 'nearest' });
42
+ }
43
+ }, ref: rowRef, role: "toolbar", children: chips.map((chip) => {
11
44
  const Icon = chip.icon;
12
45
  return (_jsxs("button", { "aria-pressed": on.includes(chip.id), className: "pane-quick-button quiet-track-item", onClick: () => onToggle(chip.id), onMouseDown: (event) => event.preventDefault(), type: "button", children: [Icon === undefined ? null : _jsx(Icon, { "aria-hidden": true, size: ICON_SM }), chip.label, chip.count === undefined || chip.count === null ? null : (_jsxs(_Fragment, { children: [' ', _jsx("span", { className: "pane-quick-count", children: chip.count })] }))] }, chip.id));
13
46
  }) }));
@@ -0,0 +1,24 @@
1
+ /** A wheel event's deltas, as the DOM reports them. */
2
+ export interface WheelDeltas {
3
+ readonly deltaX: number;
4
+ readonly deltaY: number;
5
+ /** `WheelEvent.deltaMode`: 0 pixels, 1 lines, 2 pages. */
6
+ readonly deltaMode: number;
7
+ }
8
+ /** Where a sideways scroller stands: its `scrollLeft`, `scrollWidth`, and `clientWidth`. */
9
+ export interface SidewaysBox {
10
+ readonly scrollLeft: number;
11
+ readonly scrollWidth: number;
12
+ readonly clientWidth: number;
13
+ }
14
+ /**
15
+ * How far a wheel moves a sideways line, as a change to its `scrollLeft`,
16
+ * or null to leave the event alone: when it is mostly sideways already (a
17
+ * trackpad, or Shift with a wheel, which the browser turns sideways
18
+ * itself), when the line has nothing hidden, and when the line already
19
+ * stands at the end the wheel points to, so the page under it scrolls as
20
+ * it would without the line. Down moves toward the line's end, which is
21
+ * its left in a right-to-left line (`rtl`), where `scrollLeft` runs from 0
22
+ * down to less than 0.
23
+ */
24
+ export declare function sidewaysWheel(wheel: WheelDeltas, box: SidewaysBox, rtl?: boolean): number | null;
@@ -0,0 +1,34 @@
1
+ /*
2
+ * The quick row of filters is one line that scrolls sideways under the
3
+ * base sheet's inline edge fade, with no scrollbar drawn. A trackpad
4
+ * scrolls it sideways on its own; a plain mouse wheel sends only a
5
+ * vertical delta, which these rules turn onto the line.
6
+ */
7
+ /** How far one wheel line moves the line, in pixels: a listing row's height (`--row-height`). */
8
+ const LINE_PIXELS = 24;
9
+ /**
10
+ * How far a wheel moves a sideways line, as a change to its `scrollLeft`,
11
+ * or null to leave the event alone: when it is mostly sideways already (a
12
+ * trackpad, or Shift with a wheel, which the browser turns sideways
13
+ * itself), when the line has nothing hidden, and when the line already
14
+ * stands at the end the wheel points to, so the page under it scrolls as
15
+ * it would without the line. Down moves toward the line's end, which is
16
+ * its left in a right-to-left line (`rtl`), where `scrollLeft` runs from 0
17
+ * down to less than 0.
18
+ */
19
+ export function sidewaysWheel(wheel, box, rtl = false) {
20
+ if (wheel.deltaY === 0 || Math.abs(wheel.deltaX) >= Math.abs(wheel.deltaY))
21
+ return null;
22
+ const room = box.scrollWidth - box.clientWidth;
23
+ if (room <= 0)
24
+ return null;
25
+ const unit = wheel.deltaMode === 1 ? LINE_PIXELS : wheel.deltaMode === 2 ? box.clientWidth : 1;
26
+ const delta = wheel.deltaY * unit;
27
+ const along = rtl ? -box.scrollLeft : box.scrollLeft;
28
+ // Within half a pixel of an end counts as there: scroll positions are fractional at 2x.
29
+ const atStart = along <= 0.5;
30
+ const atEnd = along >= room - 0.5;
31
+ if ((delta < 0 && atStart) || (delta > 0 && atEnd))
32
+ return null;
33
+ return rtl ? -delta : delta;
34
+ }