@bigpixelrocket/uiok 0.2.3 → 0.3.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 (116) hide show
  1. package/CHANGELOG.md +26 -1
  2. package/dist/charts/Sparkline.d.ts +20 -0
  3. package/dist/charts/Sparkline.js +12 -0
  4. package/dist/charts/Sparkline.logic.d.ts +9 -0
  5. package/dist/charts/Sparkline.logic.js +27 -0
  6. package/dist/charts/charts.css +17 -0
  7. package/dist/charts/index.d.ts +2 -0
  8. package/dist/charts/index.js +2 -0
  9. package/dist/dialog/ConfirmDialog.d.ts +11 -1
  10. package/dist/dialog/ConfirmDialog.js +3 -2
  11. package/dist/dialog/ModalDialog.d.ts +8 -0
  12. package/dist/dialog/ModalDialog.js +4 -2
  13. package/dist/dialog/ProgressDialog.d.ts +34 -0
  14. package/dist/dialog/ProgressDialog.js +40 -0
  15. package/dist/dialog/TypedNameDialog.d.ts +36 -0
  16. package/dist/dialog/TypedNameDialog.js +17 -0
  17. package/dist/dialog/index.d.ts +5 -2
  18. package/dist/dialog/index.js +4 -1
  19. package/dist/field/Switch.d.ts +26 -0
  20. package/dist/field/Switch.js +20 -0
  21. package/dist/field/index.d.ts +3 -2
  22. package/dist/field/index.js +3 -2
  23. package/dist/frame/AppRoot.d.ts +44 -0
  24. package/dist/frame/AppRoot.js +26 -0
  25. package/dist/frame/Dock.d.ts +88 -0
  26. package/dist/frame/Dock.js +129 -0
  27. package/dist/frame/FilterChips.d.ts +28 -0
  28. package/dist/frame/FilterChips.js +14 -0
  29. package/dist/frame/PageParts.d.ts +69 -0
  30. package/dist/frame/PageParts.js +60 -0
  31. package/dist/frame/PaneSplit.d.ts +74 -0
  32. package/dist/frame/PaneSplit.js +197 -0
  33. package/dist/frame/SidebarResizer.d.ts +35 -0
  34. package/dist/frame/SidebarResizer.js +43 -0
  35. package/dist/frame/StatusNotice.d.ts +20 -0
  36. package/dist/frame/StatusNotice.js +13 -0
  37. package/dist/frame/Tree.d.ts +140 -0
  38. package/dist/frame/Tree.js +141 -0
  39. package/dist/frame/TreeToggle.d.ts +18 -0
  40. package/dist/frame/TreeToggle.js +17 -0
  41. package/dist/frame/WindowFrame.d.ts +57 -0
  42. package/dist/frame/WindowFrame.js +19 -0
  43. package/dist/frame/frame.css +801 -0
  44. package/dist/frame/index.d.ts +22 -0
  45. package/dist/frame/index.js +22 -0
  46. package/dist/frame/sharedRef.d.ts +8 -0
  47. package/dist/frame/sharedRef.js +26 -0
  48. package/dist/index.d.ts +3 -0
  49. package/dist/index.js +3 -0
  50. package/dist/labels/UiokLabels.d.ts +3 -0
  51. package/dist/labels/UiokLabels.js +3 -1
  52. package/dist/labels/dialog.d.ts +12 -0
  53. package/dist/labels/dialog.js +7 -1
  54. package/dist/labels/index.d.ts +1 -0
  55. package/dist/labels/index.js +1 -0
  56. package/dist/labels/settings.d.ts +46 -0
  57. package/dist/labels/settings.js +29 -0
  58. package/dist/listing/EmptyState.d.ts +40 -0
  59. package/dist/listing/EmptyState.js +14 -0
  60. package/dist/listing/index.d.ts +3 -1
  61. package/dist/listing/index.js +3 -1
  62. package/dist/listing/listing.css +66 -2
  63. package/dist/log/LogWell.d.ts +34 -0
  64. package/dist/log/LogWell.js +39 -0
  65. package/dist/log/LogWell.logic.d.ts +16 -0
  66. package/dist/log/LogWell.logic.js +26 -0
  67. package/dist/log/index.d.ts +8 -0
  68. package/dist/log/index.js +8 -0
  69. package/dist/log/log.css +57 -0
  70. package/dist/pane/Pane.d.ts +49 -0
  71. package/dist/pane/Pane.js +17 -0
  72. package/dist/pane/PaneKeys.d.ts +10 -3
  73. package/dist/pane/PaneKeys.js +26 -7
  74. package/dist/pane/index.d.ts +4 -2
  75. package/dist/pane/index.js +4 -2
  76. package/dist/pane/usePaneKeys.js +9 -11
  77. package/dist/shell/AboutWindow.d.ts +21 -0
  78. package/dist/shell/AboutWindow.js +10 -0
  79. package/dist/shell/LanguageChoice.d.ts +27 -0
  80. package/dist/shell/LanguageChoice.js +17 -0
  81. package/dist/shell/LoadFailure.d.ts +22 -0
  82. package/dist/shell/LoadFailure.js +15 -0
  83. package/dist/shell/Lockup.d.ts +52 -0
  84. package/dist/shell/Lockup.js +30 -0
  85. package/dist/shell/SettingsDialog.d.ts +97 -0
  86. package/dist/shell/SettingsDialog.js +219 -0
  87. package/dist/shell/SettingsDialog.logic.d.ts +33 -0
  88. package/dist/shell/SettingsDialog.logic.js +42 -0
  89. package/dist/shell/SettingsFiles.d.ts +55 -0
  90. package/dist/shell/SettingsFiles.js +30 -0
  91. package/dist/shell/SettingsPageKeys.d.ts +42 -0
  92. package/dist/shell/SettingsPageKeys.js +70 -0
  93. package/dist/shell/SettingsSubsection.d.ts +34 -0
  94. package/dist/shell/SettingsSubsection.js +30 -0
  95. package/dist/shell/SignIn.d.ts +61 -0
  96. package/dist/shell/SignIn.js +36 -0
  97. package/dist/shell/ThemePicker.d.ts +74 -0
  98. package/dist/shell/ThemePicker.js +96 -0
  99. package/dist/shell/ThemePicker.logic.d.ts +13 -0
  100. package/dist/shell/ThemePicker.logic.js +26 -0
  101. package/dist/shell/TitleBar.d.ts +44 -0
  102. package/dist/shell/TitleBar.js +23 -0
  103. package/dist/shell/UpdatePill.d.ts +26 -0
  104. package/dist/shell/UpdatePill.js +17 -0
  105. package/dist/shell/Updates.d.ts +99 -0
  106. package/dist/shell/Updates.js +72 -0
  107. package/dist/shell/index.d.ts +27 -0
  108. package/dist/shell/index.js +27 -0
  109. package/dist/shell/shell.css +243 -4
  110. package/dist/styles.css +2 -0
  111. package/dist/themes/catalog.js +4 -0
  112. package/dist/themes/themes.generated.css +244 -0
  113. package/dist/themes/tokens.d.ts +17 -5
  114. package/dist/themes/tokens.js +64 -1
  115. package/dist/tokens.css +11 -0
  116. package/package.json +1 -1
@@ -0,0 +1,57 @@
1
+ /* A log in a well (LogWell): the code face at the small size, the lines
2
+ kept as written (wrapping only where a line is longer than the well),
3
+ each source in a column as wide as the longest, in its own colour
4
+ (--log-source, which the component sets to a --log-source-N token, each
5
+ legible as text on a panel). */
6
+ .log-well {
7
+ min-height: 0;
8
+ margin: 0;
9
+ padding: var(--space-3) var(--space-4);
10
+ overflow: auto;
11
+ border: var(--line) solid var(--border-strong);
12
+ border-radius: var(--radius-md);
13
+ background: var(--surface);
14
+ color: var(--text);
15
+ font: var(--font-weight-regular) var(--font-size-small) / var(--line-height-compact)
16
+ var(--font-mono);
17
+ }
18
+
19
+ .log-line {
20
+ display: grid;
21
+ grid-template-columns: var(--log-source-width) auto minmax(0, 1fr);
22
+ column-gap: var(--space-3);
23
+ white-space: pre-wrap;
24
+ overflow-wrap: anywhere;
25
+ }
26
+
27
+ /* A log with no sources: the words alone. */
28
+ .log-line:not(:has(> .log-source)) {
29
+ grid-template-columns: minmax(0, 1fr);
30
+ }
31
+
32
+ .log-source {
33
+ color: var(--log-source, var(--text-dim));
34
+ white-space: nowrap;
35
+ }
36
+
37
+ .log-bar {
38
+ color: var(--text-faint);
39
+ }
40
+
41
+ .log-line[data-tone='danger'] > .log-text {
42
+ color: var(--danger-text);
43
+ }
44
+
45
+ .log-line[data-tone='warning'] > .log-text {
46
+ color: var(--warning-text);
47
+ }
48
+
49
+ .log-line[data-tone='dim'] > .log-text {
50
+ color: var(--text-dim);
51
+ }
52
+
53
+ .log-empty {
54
+ margin: 0;
55
+ color: var(--text-dim);
56
+ font-family: var(--font-ui);
57
+ }
@@ -0,0 +1,49 @@
1
+ import type { DOMAttributes, ReactElement, ReactNode, Ref } from 'react';
2
+ /**
3
+ * The event handlers a host hangs on a pane or a region of the window for
4
+ * its keys, its focus, and its drop zone; nothing that styles it.
5
+ */
6
+ export type RegionHandlers = Pick<DOMAttributes<HTMLElement>, 'onBlur' | 'onDragEnter' | 'onDragLeave' | 'onDragOver' | 'onDrop' | 'onFocus' | 'onKeyDown' | 'onKeyDownCapture' | 'onMouseDown' | 'onPointerDown'>;
7
+ /** Props for {@link PaneBox}. */
8
+ export interface PaneBoxProps extends RegionHandlers {
9
+ /** The pane holds the keyboard: its frame wears the accent. */
10
+ readonly active?: boolean;
11
+ /** The pane's accessible name, when its path bar does not name it. */
12
+ readonly label?: string;
13
+ /**
14
+ * `danger` draws its frame, and its front tab's outline, in the danger
15
+ * colour at rest, active, and in an inactive window (a production server).
16
+ */
17
+ readonly tone?: 'danger';
18
+ /** The element it draws: a `section` by default, an `aside` for a sidebar. */
19
+ readonly as?: 'section' | 'aside';
20
+ readonly ref?: Ref<HTMLElement>;
21
+ /** Its tabs (`PaneTabs`), path bar, list, and status line, top to bottom. */
22
+ readonly children?: ReactNode;
23
+ }
24
+ /**
25
+ * A pane in the listing look (under the listing root a `WindowFrame`
26
+ * wears): a framed column of its tab strip or path bar, its list, and its
27
+ * status line. `active` marks the pane that holds the keyboard; the others
28
+ * show their cursor row quietly.
29
+ */
30
+ export declare function PaneBox({ active, label, tone, as: Element, ref, children, ...handlers }: PaneBoxProps): ReactElement;
31
+ /** Props for {@link PaneList}. */
32
+ export interface PaneListProps extends RegionHandlers {
33
+ /**
34
+ * The pane's home list, which the keys return to and Page Up and Page
35
+ * Down measure (`data-pane-home`): focusable by script, out of the Tab order.
36
+ */
37
+ readonly home?: boolean;
38
+ /** Its rows act on a click, so the row under the pointer lights. */
39
+ readonly pointer?: boolean;
40
+ readonly label?: string;
41
+ readonly ref?: Ref<HTMLDivElement>;
42
+ /** Its listings, rows, and notes. */
43
+ readonly children?: ReactNode;
44
+ }
45
+ /**
46
+ * The scrolling body of a pane, between its path bar and its status line:
47
+ * the listings and notes the pane shows.
48
+ */
49
+ export declare function PaneList({ home, pointer, label, ref, children, ...handlers }: PaneListProps): ReactElement;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * A pane in the listing look (under the listing root a `WindowFrame`
4
+ * wears): a framed column of its tab strip or path bar, its list, and its
5
+ * status line. `active` marks the pane that holds the keyboard; the others
6
+ * show their cursor row quietly.
7
+ */
8
+ export function PaneBox({ active = false, label, tone, as: Element = 'section', ref, children, ...handlers }) {
9
+ return (_jsx(Element, { "aria-label": label, className: active ? 'pane active' : 'pane', "data-tone": tone, ref: ref, ...handlers, children: children }));
10
+ }
11
+ /**
12
+ * The scrolling body of a pane, between its path bar and its status line:
13
+ * the listings and notes the pane shows.
14
+ */
15
+ export function PaneList({ home = false, pointer = false, label, ref, children, ...handlers }) {
16
+ return (_jsx("div", { "aria-label": label, className: pointer ? 'pane-list pointer' : 'pane-list', "data-pane-home": home ? '' : undefined, ref: ref, tabIndex: home ? -1 : undefined, ...handlers, children: children }));
17
+ }
@@ -1,5 +1,11 @@
1
1
  import type { ControlVerb } from './PaneActions.js';
2
- /** The rows a pane's cursor walks, top to bottom: its `data-row-key` elements. */
2
+ /**
3
+ * A pane's home that shows: the first `data-pane-home` element in it (the
4
+ * sidebar's with `"sidebar"`) outside a hidden page, or null for none.
5
+ * Internal to the pane area.
6
+ */
7
+ export declare const shownHome: (pane: Element | null, sidebar?: boolean) => HTMLElement | null;
8
+ /** The rows a pane's cursor walks, top to bottom: its `data-row-key` elements that show. */
3
9
  export declare const paneRows: (pane: Element | null) => HTMLElement[];
4
10
  /** A pane's row by its key, or null for none. */
5
11
  export declare const paneRow: (pane: Element | null, key: string | null) => HTMLElement | null;
@@ -29,9 +35,10 @@ export interface SidebarTabStops {
29
35
  * document puts it, make one cycle in document order that wraps at either
30
36
  * end. A row's controls are no stops (the cursor row's keys run them) unless
31
37
  * its listing keeps them in the Tab order (`Row`'s `tabbable`); a sidebar
32
- * row's never are.
38
+ * row's never are. With `alone` (no sidebar shown) the page's stops make
39
+ * the one cycle, wrapping at either end, and the sidebar is never named.
33
40
  */
34
- export declare function nextTabStop(main: Element, home: HTMLElement, from: TabStop, back: boolean, sidebar?: SidebarTabStops | null): TabStop;
41
+ export declare function nextTabStop(main: Element, home: HTMLElement, from: TabStop, back: boolean, sidebar?: SidebarTabStops | null, alone?: boolean): TabStop;
35
42
  /**
36
43
  * The rows one Page Up or Page Down moves in a pane: what its home
37
44
  * (`data-pane-home`) shows of 24px rows, less one kept in view.
@@ -5,8 +5,26 @@
5
5
  * panes say what they offer by these marks, so the keys run exactly what a
6
6
  * click would, disabled where the control is.
7
7
  */
8
- /** The rows a pane's cursor walks, top to bottom: its `data-row-key` elements. */
9
- export const paneRows = (pane) => pane === null ? [] : [...pane.querySelectorAll('[data-row-key]')];
8
+ /**
9
+ * The elements in `root` matching `selector` that show: none inside a
10
+ * `hidden` element under `root`, such as a page held mounted out of sight
11
+ * behind the front tab (`PageSlot`), whose rows, home, and verbs the keys
12
+ * never reach.
13
+ */
14
+ const shownMatches = (root, selector) => [...root.querySelectorAll(selector)].filter((match) => {
15
+ const hidden = match.closest('[hidden]');
16
+ return hidden === null || !root.contains(hidden) || hidden === root;
17
+ });
18
+ /**
19
+ * A pane's home that shows: the first `data-pane-home` element in it (the
20
+ * sidebar's with `"sidebar"`) outside a hidden page, or null for none.
21
+ * Internal to the pane area.
22
+ */
23
+ export const shownHome = (pane, sidebar = false) => pane === null
24
+ ? null
25
+ : (shownMatches(pane, sidebar ? '[data-pane-home="sidebar"]' : '[data-pane-home]')[0] ?? null);
26
+ /** The rows a pane's cursor walks, top to bottom: its `data-row-key` elements that show. */
27
+ export const paneRows = (pane) => pane === null ? [] : shownMatches(pane, '[data-row-key]');
10
28
  /** A pane's row by its key, or null for none. */
11
29
  export const paneRow = (pane, key) => key === null ? null : (paneRows(pane).find((row) => row.dataset.rowKey === key) ?? null);
12
30
  /** Whether a control takes a click: not disabled, not inert behind `aria-disabled`. */
@@ -18,7 +36,7 @@ const enabled = (control) => !control.disabled && control.getAttribute('aria-dis
18
36
  export function verbControl(root, verb, attribute = 'verb') {
19
37
  // The verb is quoted, so only a quote or a backslash in it needs escaping.
20
38
  const quoted = verb.replace(/["\\]/g, '\\$&');
21
- const control = root?.querySelector(`[data-${attribute}~="${quoted}"]`) ?? null;
39
+ const control = root === null ? null : (shownMatches(root, `[data-${attribute}~="${quoted}"]`)[0] ?? null);
22
40
  return control !== null && enabled(control) ? control : null;
23
41
  }
24
42
  const FOCUSABLE = 'a[href], button, input, select, textarea, summary, [tabindex]';
@@ -61,9 +79,10 @@ const inDocumentOrder = (a, b) => a.compareDocumentPosition(b) & Node.DOCUMENT_P
61
79
  * document puts it, make one cycle in document order that wraps at either
62
80
  * end. A row's controls are no stops (the cursor row's keys run them) unless
63
81
  * its listing keeps them in the Tab order (`Row`'s `tabbable`); a sidebar
64
- * row's never are.
82
+ * row's never are. With `alone` (no sidebar shown) the page's stops make
83
+ * the one cycle, wrapping at either end, and the sidebar is never named.
65
84
  */
66
- export function nextTabStop(main, home, from, back, sidebar = null) {
85
+ export function nextTabStop(main, home, from, back, sidebar = null, alone = false) {
67
86
  if (from === 'sidebar' && sidebar === null)
68
87
  return 'page';
69
88
  const at = from === 'sidebar' ? (sidebar?.home ?? home) : from === 'page' ? home : from;
@@ -84,7 +103,7 @@ export function nextTabStop(main, home, from, back, sidebar = null) {
84
103
  .filter((stop) => stop.compareDocumentPosition(at) & Node.DOCUMENT_POSITION_FOLLOWING)
85
104
  .pop()
86
105
  : stops.find((stop) => stop.compareDocumentPosition(at) & Node.DOCUMENT_POSITION_PRECEDING);
87
- const landed = next ?? (sidebar === null ? undefined : back ? stops.at(-1) : stops[0]);
106
+ const landed = next ?? (sidebar === null && !alone ? undefined : back ? stops.at(-1) : stops[0]);
88
107
  if (landed === undefined || landed === sidebar?.home)
89
108
  return 'sidebar';
90
109
  return landed === home ? 'page' : landed;
@@ -94,7 +113,7 @@ export function nextTabStop(main, home, from, back, sidebar = null) {
94
113
  * (`data-pane-home`) shows of 24px rows, less one kept in view.
95
114
  */
96
115
  export const pageRows = (pane) => {
97
- const list = pane?.querySelector('[data-pane-home]');
116
+ const list = shownHome(pane);
98
117
  return Math.max(1, Math.floor((list?.clientHeight ?? 0) / 24) - 1);
99
118
  };
100
119
  /** Brings a row the keys moved to into view, clear of its strip (the row's own scroll margin). */
@@ -4,9 +4,11 @@
4
4
  * fits its tools to one line (`useToolbarFit`), and the keyboard of a
5
5
  * sidebar beside a page (`usePaneKeys`) with the pure key mapping and DOM
6
6
  * readers it is built on, and the tab strip a pane hangs from (`PaneTabs`)
7
- * with the pure rules it and its host keep tab state by. Styled by the
8
- * listing look under `.listing-root`.
7
+ * with the pure rules it and its host keep tab state by; `PaneBox` and
8
+ * `PaneList` are the pane and its scrolling body. Styled by the listing
9
+ * look under `.listing-root`.
9
10
  */
11
+ export { PaneBox, PaneList, type PaneBoxProps, type PaneListProps, type RegionHandlers } from './Pane.js';
10
12
  export { InRowContext, QuietAction, RowIconAction, RowLinkLookContext, useInRow, type ControlVerb, type LinkLook, type QuietActionProps, type RowIconActionProps } from './PaneActions.js';
11
13
  export { PanePathBar, PaneStatus, PathFact, type PaneCrumb, type PanePathBarProps, type PaneStatusProps, type PathFactProps } from './PaneFrame.js';
12
14
  export { isTabStop, nextTabStop, pageRows, paneRow, paneRows, showRow, tabStops, verbControl, type SidebarTabStops, type TabStop } from './PaneKeys.js';
@@ -4,9 +4,11 @@
4
4
  * fits its tools to one line (`useToolbarFit`), and the keyboard of a
5
5
  * sidebar beside a page (`usePaneKeys`) with the pure key mapping and DOM
6
6
  * readers it is built on, and the tab strip a pane hangs from (`PaneTabs`)
7
- * with the pure rules it and its host keep tab state by. Styled by the
8
- * listing look under `.listing-root`.
7
+ * with the pure rules it and its host keep tab state by; `PaneBox` and
8
+ * `PaneList` are the pane and its scrolling body. Styled by the listing
9
+ * look under `.listing-root`.
9
10
  */
11
+ export { PaneBox, PaneList } from './Pane.js';
10
12
  export { InRowContext, QuietAction, RowIconAction, RowLinkLookContext, useInRow } from './PaneActions.js';
11
13
  export { PanePathBar, PaneStatus, PathFact } from './PaneFrame.js';
12
14
  export { isTabStop, nextTabStop, pageRows, paneRow, paneRows, showRow, tabStops, verbControl } from './PaneKeys.js';
@@ -2,12 +2,12 @@ import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, use
2
2
  import { isTextEditingTarget } from '../keyboard/Keyboard.logic.js';
3
3
  import { watchOverlays } from '../keyboard/OverlayWatch.js';
4
4
  import { createValueStore, unheard } from '../store/ValueStore.js';
5
- import { isTabStop, nextTabStop, pageRows, paneRow, paneRows, showRow } from './PaneKeys.js';
5
+ import { isTabStop, nextTabStop, pageRows, paneRow, paneRows, showRow, shownHome } from './PaneKeys.js';
6
6
  import { movedIndex, sameVerbs } from './PaneKeys.logic.js';
7
7
  /** The sidebar's cursor row: the one moved to while it is listed, else the open row, else the first. */
8
8
  const sidebarRow = (moved, keys, openKey) => (moved !== null && keys.includes(moved) ? moved : (openKey ?? keys[0] ?? null));
9
9
  /** The sidebar pane: the frame around its home, which holds its other controls (Refresh) too. */
10
- const sidebarPane = (root) => root.querySelector('[data-pane-home="sidebar"]')?.closest('.pane') ?? null;
10
+ const sidebarPane = (root) => shownHome(root, true)?.closest('.pane') ?? null;
11
11
  /**
12
12
  * The keyboard of a view with a sidebar beside a page: each pane has a
13
13
  * cursor row the arrows move and the pointer shares (`data-row-key` rows;
@@ -146,8 +146,8 @@ export function usePaneKeys(options) {
146
146
  if (pane === 'main')
147
147
  sidebarStore.set(null);
148
148
  const home = pane === 'sidebar'
149
- ? rootRef.current?.querySelector('[data-pane-home="sidebar"]')
150
- : (mainRef.current?.querySelector('[data-pane-home]') ?? mainRef.current);
149
+ ? shownHome(rootRef.current, true)
150
+ : (shownHome(mainRef.current) ?? mainRef.current);
151
151
  home?.focus({ preventScroll: true });
152
152
  };
153
153
  // Coming into view, the app focuses the view; the active pane's home
@@ -178,7 +178,7 @@ export function usePaneKeys(options) {
178
178
  if (key === undefined)
179
179
  return;
180
180
  sidebarStore.set(key);
181
- showRow(paneRow(root?.querySelector('[data-pane-home="sidebar"]') ?? null, key));
181
+ showRow(paneRow(shownHome(root ?? null, true), key));
182
182
  return;
183
183
  }
184
184
  const rows = paneRows(mainRef.current);
@@ -214,7 +214,7 @@ export function usePaneKeys(options) {
214
214
  if (action === null)
215
215
  return;
216
216
  const sidebar = sidebarPane(root);
217
- const home = main.querySelector('[data-pane-home]') ?? main;
217
+ const home = shownHome(main) ?? main;
218
218
  const inSidebar = node !== null && sidebar?.contains(node) === true;
219
219
  const inMain = node !== null && main.contains(node);
220
220
  const pane = inSidebar ? 'sidebar' : inMain ? 'main' : activePane;
@@ -232,7 +232,7 @@ export function usePaneKeys(options) {
232
232
  !inRow &&
233
233
  node.closest('button, input, select, textarea, summary, a, [tabindex]') === home);
234
234
  if (action.kind === 'switch-pane') {
235
- const sidebarHome = root.querySelector('[data-pane-home="sidebar"]');
235
+ const sidebarHome = shownHome(root, true);
236
236
  const walked = current.sidebarStops === true && sidebar !== null && sidebarHome !== null
237
237
  ? { pane: sidebar, home: sidebarHome }
238
238
  : null;
@@ -248,7 +248,7 @@ export function usePaneKeys(options) {
248
248
  ? 'page'
249
249
  : node;
250
250
  const back = 'back' in action && action.back === true;
251
- const to = nextTabStop(main, home, from, back, walked);
251
+ const to = nextTabStop(main, home, from, back, walked, sidebar === null);
252
252
  event.preventDefault();
253
253
  event.stopPropagation();
254
254
  if (to === 'sidebar' || to === 'page')
@@ -271,9 +271,7 @@ export function usePaneKeys(options) {
271
271
  if (pane !== activePane)
272
272
  setActivePane(pane);
273
273
  if (inRow && isMove) {
274
- (pane === 'sidebar'
275
- ? root.querySelector('[data-pane-home="sidebar"]')
276
- : home)?.focus({
274
+ (pane === 'sidebar' ? shownHome(root, true) : home)?.focus({
277
275
  preventScroll: true
278
276
  });
279
277
  }
@@ -0,0 +1,21 @@
1
+ import type { ReactElement, ReactNode } from 'react';
2
+ /** Props for {@link AboutWindow}. */
3
+ export interface AboutWindowProps {
4
+ /** The app icon's URL: the round patch on a transparent canvas, drawn at 128px. */
5
+ readonly icon: string;
6
+ /** The product's `Lockup`, without its mark (the icon stands above it). */
7
+ readonly lockup: ReactNode;
8
+ /** The channel's name on a build that is not the release, as a `channel-tag`; none on the release. */
9
+ readonly channelTag?: string | null;
10
+ /** The channel the window wears (`data-channel`), which colours the tag; none on the release. */
11
+ readonly channel?: string | null;
12
+ /** The version line, the one line a reader may select. */
13
+ readonly version?: string | null;
14
+ }
15
+ /**
16
+ * The About window's one panel: the app's icon, the lockup with the
17
+ * channel tag of a build that is not the release, and the version. A fixed
18
+ * frame the window's height that never scrolls; the panel drags the window
19
+ * under a hidden title bar, all but the version line.
20
+ */
21
+ export declare function AboutWindow({ icon, lockup, channelTag, channel, version }: AboutWindowProps): ReactElement;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * The About window's one panel: the app's icon, the lockup with the
4
+ * channel tag of a build that is not the release, and the version. A fixed
5
+ * frame the window's height that never scrolls; the panel drags the window
6
+ * under a hidden title bar, all but the version line.
7
+ */
8
+ export function AboutWindow({ icon, lockup, channelTag = null, channel = null, version = null }) {
9
+ return (_jsxs("main", { className: "about-window", "data-channel": channel ?? undefined, children: [_jsx("img", { alt: "", className: "about-icon", src: icon }), _jsxs("div", { className: "about-lockup", children: [lockup, channelTag ? _jsx("span", { className: "channel-tag", children: channelTag }) : null] }), version ? _jsx("p", { className: "about-version", children: version }) : null] }));
10
+ }
@@ -0,0 +1,27 @@
1
+ import type { ReactElement } from 'react';
2
+ /** One language a Language page offers. */
3
+ export interface LanguageOption {
4
+ /** What the host saves ("system", "de-DE"). */
5
+ readonly value: string;
6
+ /** The language by its own name ("Deutsch"), or the system choice ("Match System (English)"). */
7
+ readonly label: string;
8
+ /** The option's own language tag, so it is read in its language; none for the system choice. */
9
+ readonly lang?: string | null;
10
+ }
11
+ /** Props for {@link LanguageChoice}. */
12
+ export interface LanguageChoiceProps {
13
+ /** The row's label ("Language"). */
14
+ readonly label: string;
15
+ /** What changes and when, the label's tooltip. */
16
+ readonly help?: string;
17
+ readonly value: string;
18
+ readonly options: readonly LanguageOption[];
19
+ /** Hears a new choice, never the one already shown. */
20
+ readonly onChange: (value: string) => void;
21
+ }
22
+ /**
23
+ * A Language page of Settings: one pop-up menu on the label column, the
24
+ * system's choice first and then every language by its own name. The host
25
+ * saves each choice, which applies at once.
26
+ */
27
+ export declare function LanguageChoice({ label, help, value, options, onChange }: LanguageChoiceProps): ReactElement;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId } from 'react';
3
+ import { labelHelp } from '../field/labelHelp.js';
4
+ /**
5
+ * A Language page of Settings: one pop-up menu on the label column, the
6
+ * system's choice first and then every language by its own name. The host
7
+ * saves each choice, which applies at once.
8
+ */
9
+ export function LanguageChoice({ label, help, value, options, onChange }) {
10
+ const id = useId();
11
+ const hint = labelHelp(help);
12
+ const choose = (event) => {
13
+ if (event.target.value !== value)
14
+ onChange(event.target.value);
15
+ };
16
+ return (_jsxs("div", { className: "field-grid", children: [_jsx("label", { className: "field-label", htmlFor: id, ...hint.label, children: label }), _jsx("div", { className: "field-value", children: _jsx("div", { className: "field-option", children: _jsx("select", { ...hint.control, className: "field field-sm", id: id, onChange: choose, value: value, children: options.map((option) => (_jsx("option", { lang: option.lang ?? undefined, value: option.value, children: option.label }, option.value))) }) }) })] }));
17
+ }
@@ -0,0 +1,22 @@
1
+ import { type LucideIcon } from 'lucide-react';
2
+ import type { ReactElement, ReactNode } from 'react';
3
+ /** Props for {@link LoadFailure}. */
4
+ export interface LoadFailureProps {
5
+ /** What could not load ("Could not load projects"). */
6
+ readonly title: string;
7
+ /** Why, as the system said it or in a sentence. */
8
+ readonly reason?: ReactNode;
9
+ /** Its way on (a `Button`: Try Again). */
10
+ readonly action?: ReactNode;
11
+ /** The failure's glyph, in the danger tone; `CircleAlert` unless given. */
12
+ readonly icon?: LucideIcon;
13
+ }
14
+ /**
15
+ * The block a window shows in place of content that failed to load, outside
16
+ * any pane: the failure's glyph in the danger tone, the headline, the
17
+ * reason (dim, at most 420px wide), and its way on, centred in the space it
18
+ * takes and announced as an alert. Its words can be selected and copied. A
19
+ * pane inside the window that could not load says so with `EmptyState`'s
20
+ * `failure` instead.
21
+ */
22
+ export declare function LoadFailure({ title, reason, action, icon: Icon }: LoadFailureProps): ReactElement;
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { CircleAlert } from 'lucide-react';
3
+ import { drawn } from '../frame/WindowFrame.js';
4
+ import { ICON_XL } from '../icon/sizes.js';
5
+ /**
6
+ * The block a window shows in place of content that failed to load, outside
7
+ * any pane: the failure's glyph in the danger tone, the headline, the
8
+ * reason (dim, at most 420px wide), and its way on, centred in the space it
9
+ * takes and announced as an alert. Its words can be selected and copied. A
10
+ * pane inside the window that could not load says so with `EmptyState`'s
11
+ * `failure` instead.
12
+ */
13
+ export function LoadFailure({ title, reason, action, icon: Icon = CircleAlert }) {
14
+ return (_jsxs("div", { className: "space-load-failure", role: "alert", children: [_jsx(Icon, { "aria-hidden": true, size: ICON_XL }), _jsx("strong", { children: title }), drawn(reason) ? _jsx("p", { children: reason }) : null, action] }));
15
+ }
@@ -0,0 +1,52 @@
1
+ import type { ReactElement, ReactNode } from 'react';
2
+ /**
3
+ * How a brand mark's shape is drawn: `fill` fills it in the brand's white,
4
+ * `line` strokes it in that white (a line drawing), and `cut` strokes it in
5
+ * the plate's colour over a white fill, so it reads as cut out of the white
6
+ * (the tiers of a cylinder).
7
+ */
8
+ export type BrandMarkLook = 'fill' | 'line' | 'cut';
9
+ /** One shape of a brand mark's glyph: an SVG path on the mark's 24-unit grid, and how it is drawn. */
10
+ export interface BrandMarkShape {
11
+ /** The path's data (`d`), inside the plate: from 1 to 19 on each axis. */
12
+ readonly d: string;
13
+ readonly look: BrandMarkLook;
14
+ }
15
+ /** Props for {@link BrandMark}. */
16
+ export interface BrandMarkProps {
17
+ /** The app's glyph, its shapes drawn in order over the plate. */
18
+ readonly glyph: readonly BrandMarkShape[];
19
+ }
20
+ /**
21
+ * The family's brand mark: a rounded plate in the theme's accent with the
22
+ * app's glyph on it in white, and a green check badge at its lower right,
23
+ * ringed in the title bar's own ground so it reads as cut out of the
24
+ * plate. Drawn for the eye only; the wordmark beside it names the product.
25
+ * Every colour is a token (`--brand-white`, `--brand-plate`, the accent and
26
+ * success hues), so it follows the theme in light and dark.
27
+ */
28
+ export declare function BrandMark({ glyph }: BrandMarkProps): ReactElement;
29
+ /** A lockup's size by where it stands: the title bar, the About window, or a page of its own. */
30
+ export type LockupSize = 'title' | 'about' | 'hero';
31
+ /** Props for {@link Lockup}. */
32
+ export interface LockupProps {
33
+ /** The wordmark's lighter first part ("Database"). */
34
+ readonly lead: string;
35
+ /** The wordmark's heavier last part ("OK"). */
36
+ readonly strong: string;
37
+ /** The brand mark before the wordmark (`BrandMark`); none where an icon stands beside it instead. */
38
+ readonly mark?: ReactNode;
39
+ /**
40
+ * Its size: `title` in the title bar (15px), `about` in the About window
41
+ * (21px), `hero` on a page of its own (40px, the default).
42
+ */
43
+ readonly size?: LockupSize;
44
+ /** The element it draws: the window's heading by default, a `span` inside one. */
45
+ readonly as?: 'h1' | 'span';
46
+ }
47
+ /**
48
+ * A product's lockup, the title bar's heading and the About window's: the
49
+ * mark (when given) beside the wordmark, its `strong` part in the heavier
50
+ * weight, at its `size`; the mark scales with it.
51
+ */
52
+ export declare function Lockup({ lead, strong, mark, size, as: Element }: LockupProps): ReactElement;
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ const SHAPE_CLASS = {
3
+ fill: 'brand-mark-glyph',
4
+ line: 'brand-mark-line',
5
+ cut: 'brand-mark-cut'
6
+ };
7
+ /**
8
+ * The family's brand mark: a rounded plate in the theme's accent with the
9
+ * app's glyph on it in white, and a green check badge at its lower right,
10
+ * ringed in the title bar's own ground so it reads as cut out of the
11
+ * plate. Drawn for the eye only; the wordmark beside it names the product.
12
+ * Every colour is a token (`--brand-white`, `--brand-plate`, the accent and
13
+ * success hues), so it follows the theme in light and dark.
14
+ */
15
+ export function BrandMark({ glyph }) {
16
+ return (_jsxs("svg", { "aria-hidden": true, className: "brand-mark", focusable: "false", viewBox: "0 0 24 24", children: [_jsx("rect", { className: "brand-mark-plate", height: "18", rx: "4.5", width: "18", x: "1", y: "1" }), glyph.map((shape, index) => (_jsx("path", { className: SHAPE_CLASS[shape.look], d: shape.d }, index))), _jsx("circle", { className: "brand-mark-badge", cx: "18.5", cy: "18.5", r: "4.25" }), _jsx("path", { className: "brand-mark-check", d: "M16.6 18.6l1.3 1.3 2.5-2.7" })] }));
17
+ }
18
+ const LOCKUP_CLASS = {
19
+ title: 'lockup shell-lockup',
20
+ about: 'lockup about-lockup-text',
21
+ hero: 'lockup'
22
+ };
23
+ /**
24
+ * A product's lockup, the title bar's heading and the About window's: the
25
+ * mark (when given) beside the wordmark, its `strong` part in the heavier
26
+ * weight, at its `size`; the mark scales with it.
27
+ */
28
+ export function Lockup({ lead, strong, mark, size = 'hero', as: Element = 'h1' }) {
29
+ return (_jsxs(Element, { className: LOCKUP_CLASS[size], children: [mark, _jsxs("span", { className: "lockup-wordmark", children: [lead, _jsx("b", { children: strong })] })] }));
30
+ }
@@ -0,0 +1,97 @@
1
+ import { type LucideIcon } from 'lucide-react';
2
+ import type { ComponentType, ReactElement, ReactNode } from 'react';
3
+ /** A subsection of a Settings page: the sidebar lists it and scrolls the page to it. */
4
+ export interface SettingsSubsectionEntry {
5
+ /** Matches the `id` the page passes to its `SettingsSubsection`. */
6
+ readonly id: string;
7
+ readonly title: string;
8
+ }
9
+ /** One page of the Settings dialog, with its body ready to draw. */
10
+ export interface SettingsPage {
11
+ /** Unique across every page in the dialog. */
12
+ readonly id: string;
13
+ /** The sidebar row's label and the page's title. */
14
+ readonly title: string;
15
+ /** The sidebar row's glyph. */
16
+ readonly Icon: ComponentType<{
17
+ readonly size?: number;
18
+ readonly 'aria-hidden'?: boolean;
19
+ }>;
20
+ /** The page's subsections, in the order its body draws them; the sidebar unfolds them under the chosen page. */
21
+ readonly subsections: readonly SettingsSubsectionEntry[];
22
+ /**
23
+ * The body takes the column's whole height, so a part of it can scroll in
24
+ * its own box (an updates page's notes) while the rest stays put.
25
+ */
26
+ readonly fills?: boolean;
27
+ /** A short label the page's sidebar row shows after its title as a warning chip (an offered build's version); none for none. */
28
+ readonly chip?: string | null;
29
+ readonly body: ReactNode;
30
+ }
31
+ /** A sidebar header and the pages under it, in the order they are listed. */
32
+ export interface SettingsGroup {
33
+ readonly id: string;
34
+ readonly title: string;
35
+ readonly pages: readonly SettingsPage[];
36
+ }
37
+ /**
38
+ * A request to show Settings on one page: the page's id and a number that
39
+ * grows with every request, so a repeat for the page already chosen still
40
+ * counts as a new one.
41
+ */
42
+ export interface SettingsPageRequest {
43
+ readonly pageId: string;
44
+ readonly seq: number;
45
+ }
46
+ /** Props for {@link SettingsDialog}. */
47
+ export interface SettingsDialogProps {
48
+ /** The pages under their headers; the dialog opens on the first page unless `pageRequest` names another. */
49
+ readonly groups: readonly SettingsGroup[];
50
+ /** The page to open on, and to turn to whenever a new request arrives; null for the first page. */
51
+ readonly pageRequest?: SettingsPageRequest | null;
52
+ /** Hears the id of each page as it comes into view, the first included. */
53
+ readonly onPageShown?: (pageId: string) => void;
54
+ /**
55
+ * What stands over the page column, outside its scroll, on the page in
56
+ * view (a change a settings file could not take: `SettingsSaveFailure`);
57
+ * `choosePage` turns the dialog to another page.
58
+ */
59
+ readonly notice?: (pageId: string, choosePage: (pageId: string) => void) => ReactNode;
60
+ /** The title strip's glyph; a gear unless given. */
61
+ readonly icon?: LucideIcon;
62
+ /** Done, Escape, or a press outside the dialog with no page keys of its own. */
63
+ readonly onClose: () => void;
64
+ }
65
+ /**
66
+ * The Settings dialog: a fixed frame on the frosted wash, the sidebar of
67
+ * pages at its left, and the chosen page in a column that scrolls beside
68
+ * it. It opens on the page a request names, or on the first page, and keeps
69
+ * the chosen one until it closes or a new request names another
70
+ * (`pageRequest`). The title strip says Settings alone; the page's name
71
+ * heads its content, and the sidebar marks the page and the subsection in
72
+ * view, following the column's scroll. Every control applies its change at
73
+ * once, so there is nothing to commit: the legend's one verb is Done on
74
+ * Return, which Escape runs too, and a focused field, pop-up menu, or
75
+ * button keeps Return. A page that has keys of its own takes the legend and
76
+ * Escape over while it shows (`useSettingsPageKeys`) and gives them back
77
+ * when it goes. A new page starts at its top, its first subsection marked,
78
+ * and shows whole the control it marks to reveal.
79
+ */
80
+ export declare function SettingsDialog({ groups, pageRequest, onPageShown, notice, icon, onClose }: SettingsDialogProps): ReactElement;
81
+ /** Props for {@link SettingsSaveFailure}. */
82
+ export interface SettingsSaveFailureProps {
83
+ /** What the file could not take, in the system's or the app's words. */
84
+ readonly message: string;
85
+ /** The verb that shows where the problem is (Show Files); none on that page itself. */
86
+ readonly action?: {
87
+ readonly label: string;
88
+ readonly onRun: () => void;
89
+ } | null;
90
+ }
91
+ /**
92
+ * A change a settings file could not take, over the Settings page column
93
+ * (`SettingsDialog`'s `notice`), outside the page's scroll so it stays in
94
+ * view however far the page is scrolled: a danger notice, its words
95
+ * announced, and a verb that turns to the page that lists it.
96
+ */
97
+ export declare function SettingsSaveFailure({ message, action }: SettingsSaveFailureProps): ReactElement;