@bigpixelrocket/uiok 0.2.3 → 0.4.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 (215) hide show
  1. package/CHANGELOG.md +48 -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 +17 -1
  10. package/dist/dialog/ConfirmDialog.js +4 -3
  11. package/dist/dialog/ModalDialog.d.ts +8 -0
  12. package/dist/dialog/ModalDialog.js +4 -2
  13. package/dist/dialog/ProgressDialog.d.ts +40 -0
  14. package/dist/dialog/ProgressDialog.js +40 -0
  15. package/dist/dialog/TypedNameDialog.d.ts +44 -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/Check.d.ts +9 -2
  20. package/dist/field/Check.js +5 -4
  21. package/dist/field/Controls.d.ts +198 -0
  22. package/dist/field/Controls.js +94 -0
  23. package/dist/field/FieldLayout.d.ts +126 -0
  24. package/dist/field/FieldLayout.js +89 -0
  25. package/dist/field/Switch.d.ts +26 -0
  26. package/dist/field/Switch.js +20 -0
  27. package/dist/field/index.d.ts +10 -6
  28. package/dist/field/index.js +10 -6
  29. package/dist/frame/AppRoot.d.ts +44 -0
  30. package/dist/frame/AppRoot.js +26 -0
  31. package/dist/frame/Dock.d.ts +88 -0
  32. package/dist/frame/Dock.js +129 -0
  33. package/dist/frame/FilterChips.d.ts +28 -0
  34. package/dist/frame/FilterChips.js +14 -0
  35. package/dist/frame/PageParts.d.ts +69 -0
  36. package/dist/frame/PageParts.js +60 -0
  37. package/dist/frame/PaneSplit.d.ts +74 -0
  38. package/dist/frame/PaneSplit.js +197 -0
  39. package/dist/frame/SidebarResizer.d.ts +35 -0
  40. package/dist/frame/SidebarResizer.js +43 -0
  41. package/dist/frame/StatusNotice.d.ts +20 -0
  42. package/dist/frame/StatusNotice.js +13 -0
  43. package/dist/frame/Tree.d.ts +147 -0
  44. package/dist/frame/Tree.js +164 -0
  45. package/dist/frame/TreeToggle.d.ts +18 -0
  46. package/dist/frame/TreeToggle.js +17 -0
  47. package/dist/frame/WindowFrame.d.ts +57 -0
  48. package/dist/frame/WindowFrame.js +19 -0
  49. package/dist/frame/frame.css +801 -0
  50. package/dist/frame/index.d.ts +22 -0
  51. package/dist/frame/index.js +22 -0
  52. package/dist/frame/sharedRef.d.ts +8 -0
  53. package/dist/frame/sharedRef.js +26 -0
  54. package/dist/index.d.ts +3 -0
  55. package/dist/index.js +3 -0
  56. package/dist/labels/UiokLabels.d.ts +6 -0
  57. package/dist/labels/UiokLabels.js +5 -1
  58. package/dist/labels/dialog.d.ts +12 -0
  59. package/dist/labels/dialog.js +7 -1
  60. package/dist/labels/index.d.ts +2 -0
  61. package/dist/labels/index.js +2 -0
  62. package/dist/labels/settings.d.ts +46 -0
  63. package/dist/labels/settings.js +29 -0
  64. package/dist/labels/viewer.d.ts +193 -0
  65. package/dist/labels/viewer.js +124 -0
  66. package/dist/listing/EmptyState.d.ts +40 -0
  67. package/dist/listing/EmptyState.js +14 -0
  68. package/dist/listing/PaneMessage.d.ts +28 -0
  69. package/dist/listing/PaneMessage.js +12 -0
  70. package/dist/listing/index.d.ts +5 -1
  71. package/dist/listing/index.js +5 -1
  72. package/dist/listing/listing.css +66 -2
  73. package/dist/log/LogWell.d.ts +34 -0
  74. package/dist/log/LogWell.js +39 -0
  75. package/dist/log/LogWell.logic.d.ts +16 -0
  76. package/dist/log/LogWell.logic.js +26 -0
  77. package/dist/log/index.d.ts +8 -0
  78. package/dist/log/index.js +8 -0
  79. package/dist/log/log.css +57 -0
  80. package/dist/pane/Pane.d.ts +49 -0
  81. package/dist/pane/Pane.js +17 -0
  82. package/dist/pane/PaneKeys.d.ts +10 -3
  83. package/dist/pane/PaneKeys.js +26 -7
  84. package/dist/pane/index.d.ts +4 -2
  85. package/dist/pane/index.js +4 -2
  86. package/dist/pane/usePaneKeys.js +9 -11
  87. package/dist/shell/AboutWindow.d.ts +21 -0
  88. package/dist/shell/AboutWindow.js +10 -0
  89. package/dist/shell/LanguageChoice.d.ts +27 -0
  90. package/dist/shell/LanguageChoice.js +17 -0
  91. package/dist/shell/LoadFailure.d.ts +22 -0
  92. package/dist/shell/LoadFailure.js +15 -0
  93. package/dist/shell/Lockup.d.ts +52 -0
  94. package/dist/shell/Lockup.js +30 -0
  95. package/dist/shell/SettingsDialog.d.ts +97 -0
  96. package/dist/shell/SettingsDialog.js +219 -0
  97. package/dist/shell/SettingsDialog.logic.d.ts +33 -0
  98. package/dist/shell/SettingsDialog.logic.js +42 -0
  99. package/dist/shell/SettingsFiles.d.ts +55 -0
  100. package/dist/shell/SettingsFiles.js +30 -0
  101. package/dist/shell/SettingsPageKeys.d.ts +42 -0
  102. package/dist/shell/SettingsPageKeys.js +70 -0
  103. package/dist/shell/SettingsSubsection.d.ts +34 -0
  104. package/dist/shell/SettingsSubsection.js +30 -0
  105. package/dist/shell/SignIn.d.ts +61 -0
  106. package/dist/shell/SignIn.js +36 -0
  107. package/dist/shell/ThemePicker.d.ts +74 -0
  108. package/dist/shell/ThemePicker.js +96 -0
  109. package/dist/shell/ThemePicker.logic.d.ts +13 -0
  110. package/dist/shell/ThemePicker.logic.js +26 -0
  111. package/dist/shell/TitleBar.d.ts +44 -0
  112. package/dist/shell/TitleBar.js +23 -0
  113. package/dist/shell/UpdatePill.d.ts +26 -0
  114. package/dist/shell/UpdatePill.js +17 -0
  115. package/dist/shell/Updates.d.ts +99 -0
  116. package/dist/shell/Updates.js +72 -0
  117. package/dist/shell/index.d.ts +27 -0
  118. package/dist/shell/index.js +27 -0
  119. package/dist/shell/shell.css +243 -4
  120. package/dist/styles.css +5 -0
  121. package/dist/surface/Card.d.ts +18 -0
  122. package/dist/surface/Card.js +10 -0
  123. package/dist/surface/Notice.d.ts +45 -0
  124. package/dist/surface/Notice.js +27 -0
  125. package/dist/surface/index.d.ts +5 -3
  126. package/dist/surface/index.js +5 -3
  127. package/dist/themes/catalog.js +4 -0
  128. package/dist/themes/themes.generated.css +245 -0
  129. package/dist/themes/tokens.d.ts +17 -5
  130. package/dist/themes/tokens.js +67 -1
  131. package/dist/tokens.css +11 -0
  132. package/dist/viewer/AudioView.d.ts +13 -0
  133. package/dist/viewer/AudioView.js +25 -0
  134. package/dist/viewer/HexJump.logic.d.ts +16 -0
  135. package/dist/viewer/HexJump.logic.js +27 -0
  136. package/dist/viewer/HexRows.logic.d.ts +55 -0
  137. package/dist/viewer/HexRows.logic.js +84 -0
  138. package/dist/viewer/HexSelection.logic.d.ts +57 -0
  139. package/dist/viewer/HexSelection.logic.js +68 -0
  140. package/dist/viewer/HexView.d.ts +10 -0
  141. package/dist/viewer/HexView.js +291 -0
  142. package/dist/viewer/HexViewport.logic.d.ts +61 -0
  143. package/dist/viewer/HexViewport.logic.js +79 -0
  144. package/dist/viewer/ImageView.d.ts +19 -0
  145. package/dist/viewer/ImageView.js +230 -0
  146. package/dist/viewer/ImageZoom.logic.d.ts +65 -0
  147. package/dist/viewer/ImageZoom.logic.js +119 -0
  148. package/dist/viewer/LatestRead.logic.d.ts +27 -0
  149. package/dist/viewer/LatestRead.logic.js +55 -0
  150. package/dist/viewer/MediaControls.d.ts +25 -0
  151. package/dist/viewer/MediaControls.js +183 -0
  152. package/dist/viewer/MediaPlayer.logic.d.ts +53 -0
  153. package/dist/viewer/MediaPlayer.logic.js +68 -0
  154. package/dist/viewer/PdfView.d.ts +23 -0
  155. package/dist/viewer/PdfView.js +25 -0
  156. package/dist/viewer/QuietFocus.d.ts +19 -0
  157. package/dist/viewer/QuietFocus.js +27 -0
  158. package/dist/viewer/ScaledScroll.logic.d.ts +30 -0
  159. package/dist/viewer/ScaledScroll.logic.js +28 -0
  160. package/dist/viewer/ScaledScrollbar.d.ts +19 -0
  161. package/dist/viewer/ScaledScrollbar.js +71 -0
  162. package/dist/viewer/SyntaxHighlighter.d.ts +29 -0
  163. package/dist/viewer/SyntaxHighlighter.js +144 -0
  164. package/dist/viewer/SyntaxLanguage.logic.d.ts +110 -0
  165. package/dist/viewer/SyntaxLanguage.logic.js +283 -0
  166. package/dist/viewer/SyntaxService.d.ts +75 -0
  167. package/dist/viewer/SyntaxService.js +49 -0
  168. package/dist/viewer/SyntaxSession.logic.d.ts +78 -0
  169. package/dist/viewer/SyntaxSession.logic.js +221 -0
  170. package/dist/viewer/SyntaxWorker.d.ts +6 -0
  171. package/dist/viewer/SyntaxWorker.js +8 -0
  172. package/dist/viewer/TextEncoding.logic.d.ts +35 -0
  173. package/dist/viewer/TextEncoding.logic.js +58 -0
  174. package/dist/viewer/TextRows.logic.d.ts +86 -0
  175. package/dist/viewer/TextRows.logic.js +241 -0
  176. package/dist/viewer/TextSelection.logic.d.ts +97 -0
  177. package/dist/viewer/TextSelection.logic.js +139 -0
  178. package/dist/viewer/TextView.d.ts +13 -0
  179. package/dist/viewer/TextView.js +448 -0
  180. package/dist/viewer/TextViewport.logic.d.ts +70 -0
  181. package/dist/viewer/TextViewport.logic.js +116 -0
  182. package/dist/viewer/VideoView.d.ts +18 -0
  183. package/dist/viewer/VideoView.js +53 -0
  184. package/dist/viewer/ViewerClipboard.d.ts +30 -0
  185. package/dist/viewer/ViewerClipboard.js +70 -0
  186. package/dist/viewer/ViewerFrame.logic.d.ts +61 -0
  187. package/dist/viewer/ViewerFrame.logic.js +130 -0
  188. package/dist/viewer/ViewerKeys.d.ts +16 -0
  189. package/dist/viewer/ViewerKeys.js +14 -0
  190. package/dist/viewer/ViewerScope.d.ts +12 -0
  191. package/dist/viewer/ViewerScope.js +22 -0
  192. package/dist/viewer/ViewerViews.d.ts +28 -0
  193. package/dist/viewer/ViewerViews.js +22 -0
  194. package/dist/viewer/ViewerWindow.d.ts +53 -0
  195. package/dist/viewer/ViewerWindow.js +219 -0
  196. package/dist/viewer/index.d.ts +12 -0
  197. package/dist/viewer/index.js +12 -0
  198. package/dist/viewer/types.d.ts +151 -0
  199. package/dist/viewer/types.js +26 -0
  200. package/dist/viewer/useElementHeight.d.ts +6 -0
  201. package/dist/viewer/useElementHeight.js +22 -0
  202. package/dist/viewer/useElementSize.d.ts +7 -0
  203. package/dist/viewer/useElementSize.js +24 -0
  204. package/dist/viewer/useEscapeToClear.d.ts +8 -0
  205. package/dist/viewer/useEscapeToClear.js +26 -0
  206. package/dist/viewer/useHexDocument.d.ts +41 -0
  207. package/dist/viewer/useHexDocument.js +144 -0
  208. package/dist/viewer/useMediaElement.d.ts +10 -0
  209. package/dist/viewer/useMediaElement.js +24 -0
  210. package/dist/viewer/useSyntaxHighlight.d.ts +24 -0
  211. package/dist/viewer/useSyntaxHighlight.js +133 -0
  212. package/dist/viewer/useTextDocument.d.ts +66 -0
  213. package/dist/viewer/useTextDocument.js +245 -0
  214. package/dist/viewer/viewer.css +645 -0
  215. package/package.json +7 -1
@@ -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;
@@ -0,0 +1,219 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { CircleAlert, Settings } from 'lucide-react';
3
+ import { Fragment, useEffect, useLayoutEffect, useRef, useState } from 'react';
4
+ import { Button } from '../button/Button.js';
5
+ import { ModalDialog } from '../dialog/ModalDialog.js';
6
+ import { ICON_MD } from '../icon/sizes.js';
7
+ import { useLabels } from '../labels/UiokProvider.js';
8
+ import { cutTooltip } from '../tooltip/Tooltip.logic.js';
9
+ import { spiedSubsection, subsectionScrollTop } from './SettingsDialog.logic.js';
10
+ import { SettingsPageKeysContext, settingsLegend } from './SettingsPageKeys.js';
11
+ import { SETTINGS_PAGE_HEAD_ATTRIBUTE, SETTINGS_REVEAL_ATTRIBUTE, SETTINGS_SUBSECTION_ATTRIBUTE } from './SettingsSubsection.js';
12
+ const DIALOG_LABEL_ID = 'settings-dialog-title';
13
+ const PAGE_TITLE_ID = 'settings-page-title';
14
+ /**
15
+ * Where each subsection drawn in the content column starts, in page order,
16
+ * less the height of a sticky page head, so a subsection reads as reaching
17
+ * the top once it reaches the head's lower edge.
18
+ */
19
+ const subsectionAnchors = (column) => {
20
+ const columnTop = column.getBoundingClientRect().top - column.scrollTop;
21
+ const head = column.querySelector(`[${SETTINGS_PAGE_HEAD_ATTRIBUTE}]`)?.offsetHeight ?? 0;
22
+ return [...column.querySelectorAll(`[${SETTINGS_SUBSECTION_ATTRIBUTE}]`)].map((section) => ({
23
+ id: section.getAttribute(SETTINGS_SUBSECTION_ATTRIBUTE) ?? '',
24
+ top: section.getBoundingClientRect().top - columnTop - head
25
+ }));
26
+ };
27
+ /**
28
+ * Opens a page's view: the column at its top, and, when the page marks a
29
+ * control to reveal (`SETTINGS_REVEAL_ATTRIBUTE`) that is not wholly in
30
+ * view there, the column scrolled to show it whole, resting where an edge
31
+ * starts at the page's top padding: the edge of the group that holds it
32
+ * where the column can scroll that far, else the nearest edge of a row in
33
+ * the group past the least scroll that shows the control. Where no edge
34
+ * fits because the page ends too soon, the page gains just the room at its
35
+ * foot that lets it rest on the nearest edge, so it never opens on a row
36
+ * half under the top fade. A control already in view moves nothing. Where
37
+ * the row above the group ends below that edge, it rests on that row's foot
38
+ * instead, so the first thing in view is whole. It measures in layout
39
+ * pixels (the column's rendered height over its layout height), since the
40
+ * dialog opens scaling up and a reselect runs at whatever frame that
41
+ * animation has reached.
42
+ */
43
+ function openPageView(column) {
44
+ column.style.paddingBlockEnd = '';
45
+ column.scrollTop = 0;
46
+ const chosen = column.querySelector(`[${SETTINGS_REVEAL_ATTRIBUTE}]`);
47
+ if (chosen === null)
48
+ return;
49
+ const view = column.getBoundingClientRect();
50
+ const scale = column.offsetHeight > 0 ? view.height / column.offsetHeight || 1 : 1;
51
+ const top = (element) => (element.getBoundingClientRect().top - view.top) / scale;
52
+ const bottom = (element) => (element.getBoundingClientRect().bottom - view.top) / scale;
53
+ const height = column.offsetHeight;
54
+ const cardTop = top(chosen);
55
+ const cardBottom = bottom(chosen);
56
+ if (cardTop >= 0 && cardBottom <= height)
57
+ return;
58
+ const inset = Number.parseFloat(getComputedStyle(column).paddingTop) || 0;
59
+ const group = chosen.closest('[role="radiogroup"]') ?? chosen;
60
+ const edge = (element) => top(element) - inset;
61
+ const margin = Number.parseFloat(getComputedStyle(chosen).scrollMarginBlockEnd) || 0;
62
+ const least = cardBottom + margin > height ? cardBottom + margin - height : cardTop - inset;
63
+ const range = column.scrollHeight - column.clientHeight;
64
+ const marginTop = Number.parseFloat(getComputedStyle(chosen).scrollMarginBlockStart) || 0;
65
+ const furthest = cardTop - Math.max(inset, marginTop);
66
+ const most = Math.min(range, furthest);
67
+ const reachable = [group, ...column.querySelectorAll('[role="radiogroup"] > *')]
68
+ .map(edge)
69
+ .filter((offset) => offset >= least && offset <= furthest)
70
+ .sort((left, right) => left - right);
71
+ const edges = reachable.filter((offset) => offset <= most);
72
+ const groupEdge = edge(group);
73
+ const chosenRest = groupEdge >= least && groupEdge <= most ? groupEdge : (edges[0] ?? reachable[0] ?? least);
74
+ // The foot of the row before the group: the lowest of the cells before
75
+ // the group's own cell in its grid that end above the group.
76
+ const cell = group.parentElement ?? group;
77
+ const groupTop = top(group);
78
+ let previousFoot = Number.NEGATIVE_INFINITY;
79
+ let previousCell = null;
80
+ for (let sibling = cell.previousElementSibling; sibling; sibling = sibling.previousElementSibling) {
81
+ const foot = bottom(sibling);
82
+ if (foot <= groupTop && foot > previousFoot) {
83
+ previousFoot = foot;
84
+ previousCell = sibling;
85
+ }
86
+ }
87
+ const lastLine = previousCell?.lastElementChild ?? previousCell;
88
+ const back = lastLine === null ? Number.NaN : top(lastLine) - inset;
89
+ let rest = chosenRest;
90
+ if (previousFoot > chosenRest && previousFoot < groupTop) {
91
+ if (previousFoot <= furthest) {
92
+ rest = previousFoot;
93
+ }
94
+ else if (back >= least && back < chosenRest) {
95
+ rest = back;
96
+ }
97
+ }
98
+ if (rest > range) {
99
+ const padding = Number.parseFloat(getComputedStyle(column).paddingBlockEnd) || 0;
100
+ column.style.paddingBlockEnd = `${padding + rest - range}px`;
101
+ }
102
+ column.scrollTop = rest;
103
+ chosen.scrollIntoView?.({ block: 'nearest' });
104
+ }
105
+ /** A press on a sidebar row leaves the focus where it was, as a list row's does. */
106
+ const keepFocus = (event) => event.preventDefault();
107
+ /**
108
+ * The sidebar: the pages under their headers, the chosen page unfolding its
109
+ * subsections on a rail, the one in view marked. Every row is a button in
110
+ * the Tab order that leaves the focus where it was when pressed.
111
+ */
112
+ function SettingsSidebar({ groups, page, subsectionId, onPage, onSubsection }) {
113
+ const labels = useLabels().settings;
114
+ return (_jsx("nav", { "aria-label": labels.sidebar, className: "settings-sidebar scroll-fade", children: groups.map((group) => (_jsxs("div", { "aria-labelledby": `settings-group-${group.id}`, className: "settings-sidebar-group", role: "group", children: [_jsx("span", { className: "settings-sidebar-header overline", id: `settings-group-${group.id}`, children: group.title }), group.pages.map((item) => (_jsxs(Fragment, { children: [_jsxs("button", { "aria-current": item.id === page.id ? 'page' : undefined, className: "settings-sidebar-page", "data-settings-page": item.id, onClick: () => onPage(item.id), onMouseDown: keepFocus, type: "button", children: [_jsx(item.Icon, { "aria-hidden": true, size: ICON_MD }), _jsx("span", { ...cutTooltip(item.title), children: item.title }), item.chip ? _jsx("span", { className: "settings-sidebar-chip", children: item.chip }) : null] }), item.id === page.id && item.subsections.length > 0 ? (_jsx("div", { className: "settings-sidebar-subsections", children: item.subsections.map((subsection) => (_jsx("button", { "aria-current": subsection.id === subsectionId ? 'location' : undefined, className: "settings-sidebar-subsection", onClick: () => onSubsection(subsection.id), onMouseDown: keepFocus, type: "button", ...cutTooltip(subsection.title), children: subsection.title }, subsection.id))) })) : null] }, item.id)))] }, group.id))) }));
115
+ }
116
+ /**
117
+ * The Settings dialog: a fixed frame on the frosted wash, the sidebar of
118
+ * pages at its left, and the chosen page in a column that scrolls beside
119
+ * it. It opens on the page a request names, or on the first page, and keeps
120
+ * the chosen one until it closes or a new request names another
121
+ * (`pageRequest`). The title strip says Settings alone; the page's name
122
+ * heads its content, and the sidebar marks the page and the subsection in
123
+ * view, following the column's scroll. Every control applies its change at
124
+ * once, so there is nothing to commit: the legend's one verb is Done on
125
+ * Return, which Escape runs too, and a focused field, pop-up menu, or
126
+ * button keeps Return. A page that has keys of its own takes the legend and
127
+ * Escape over while it shows (`useSettingsPageKeys`) and gives them back
128
+ * when it goes. A new page starts at its top, its first subsection marked,
129
+ * and shows whole the control it marks to reveal.
130
+ */
131
+ export function SettingsDialog({ groups, pageRequest = null, onPageShown, notice, icon = Settings, onClose }) {
132
+ const labels = useLabels().settings;
133
+ const pages = groups.flatMap((group) => group.pages);
134
+ const [pageId, setPageId] = useState(pageRequest?.pageId ?? pages[0]?.id);
135
+ const [requestSeq, setRequestSeq] = useState(pageRequest?.seq);
136
+ if (pageRequest && pageRequest.seq !== requestSeq) {
137
+ setRequestSeq(pageRequest.seq);
138
+ setPageId(pageRequest.pageId);
139
+ }
140
+ const page = pages.find((candidate) => candidate.id === pageId) ?? pages[0];
141
+ if (page === undefined) {
142
+ throw new Error('SettingsDialog needs at least one page.');
143
+ }
144
+ useEffect(() => {
145
+ onPageShown?.(page.id);
146
+ }, [onPageShown, page.id]);
147
+ const [subsectionId, setSubsectionId] = useState(null);
148
+ const columnRef = useRef(null);
149
+ // Set while the column scrolls to the subsection a sidebar row chose, so
150
+ // that scroll keeps the choice marked even where the column cannot bring
151
+ // it to the top.
152
+ const chosenScrollRef = useRef(false);
153
+ // A row press leaves the focus where it was, so a control the old page
154
+ // held is gone with it: the dialog takes the focus back, or Escape and
155
+ // Tab would stop reaching it.
156
+ useLayoutEffect(() => {
157
+ const column = columnRef.current;
158
+ if (column) {
159
+ const dialog = column.closest('[role="dialog"]');
160
+ if (dialog && !dialog.contains(dialog.ownerDocument.activeElement)) {
161
+ dialog.focus({ preventScroll: true });
162
+ }
163
+ openPageView(column);
164
+ chosenScrollRef.current = false;
165
+ setSubsectionId(spiedSubsection(subsectionAnchors(column), column));
166
+ }
167
+ }, [page.id]);
168
+ // A page that adds or drops subsections as it is used moves the one in
169
+ // view without a scroll, so the mark follows the page's content too.
170
+ useLayoutEffect(() => {
171
+ const column = columnRef.current;
172
+ if (!column || typeof MutationObserver === 'undefined') {
173
+ return undefined;
174
+ }
175
+ const observer = new MutationObserver(() => {
176
+ if (!chosenScrollRef.current) {
177
+ setSubsectionId(spiedSubsection(subsectionAnchors(column), column));
178
+ }
179
+ });
180
+ observer.observe(column, { childList: true, subtree: true });
181
+ return () => observer.disconnect();
182
+ }, [page.id]);
183
+ const handleScroll = () => {
184
+ const column = columnRef.current;
185
+ if (chosenScrollRef.current) {
186
+ chosenScrollRef.current = false;
187
+ }
188
+ else if (column) {
189
+ setSubsectionId(spiedSubsection(subsectionAnchors(column), column));
190
+ }
191
+ };
192
+ const choosePage = (id) => {
193
+ if (id === page.id && columnRef.current) {
194
+ openPageView(columnRef.current);
195
+ }
196
+ setPageId(id);
197
+ };
198
+ const showSubsection = (id) => {
199
+ const column = columnRef.current;
200
+ const top = column ? subsectionScrollTop(subsectionAnchors(column), id) : null;
201
+ setSubsectionId(id);
202
+ if (column && top !== null) {
203
+ const before = column.scrollTop;
204
+ column.scrollTop = top;
205
+ chosenScrollRef.current = column.scrollTop !== before;
206
+ }
207
+ };
208
+ const [pageKeys, setPageKeys] = useState(null);
209
+ return (_jsx(ModalDialog, { className: "settings-dialog", frosted: true, icon: icon, labelId: DIALOG_LABEL_ID, legend: settingsLegend(pageKeys, onClose, labels.done), onCancel: pageKeys?.onLeave ?? onClose, title: labels.title, children: _jsxs("div", { className: "settings-dialog-body", children: [_jsx(SettingsSidebar, { groups: groups, onPage: choosePage, onSubsection: showSubsection, page: page, subsectionId: subsectionId }), _jsxs("div", { className: "settings-column", children: [notice?.(page.id, choosePage), _jsxs("section", { "aria-labelledby": PAGE_TITLE_ID, className: page.fills ? 'settings-page scroll-fade fills' : 'settings-page scroll-fade', onScroll: handleScroll, ref: columnRef, children: [_jsx("h3", { className: "settings-page-title", id: PAGE_TITLE_ID, children: page.title }), _jsx(SettingsPageKeysContext.Provider, { value: setPageKeys, children: _jsx(Fragment, { children: page.body }, page.id) })] })] })] }) }));
210
+ }
211
+ /**
212
+ * A change a settings file could not take, over the Settings page column
213
+ * (`SettingsDialog`'s `notice`), outside the page's scroll so it stays in
214
+ * view however far the page is scrolled: a danger notice, its words
215
+ * announced, and a verb that turns to the page that lists it.
216
+ */
217
+ export function SettingsSaveFailure({ message, action = null }) {
218
+ return (_jsxs("div", { className: "settings-save-failure notice notice-danger", children: [_jsx(CircleAlert, { "aria-hidden": true, size: ICON_MD }), _jsx("p", { className: "notice-text", role: "alert", children: message }), action === null ? null : (_jsx("div", { className: "notice-actions", children: _jsx(Button, { onClick: action.onRun, size: "small", children: action.label }) }))] }));
219
+ }
@@ -0,0 +1,33 @@
1
+ /** Where a subsection starts, in pixels from the top of the scrolled content. */
2
+ export interface SubsectionAnchor {
3
+ readonly id: string;
4
+ readonly top: number;
5
+ }
6
+ /** A Settings page column's scroll state. */
7
+ export interface SettingsScrollView {
8
+ readonly scrollTop: number;
9
+ readonly clientHeight: number;
10
+ readonly scrollHeight: number;
11
+ }
12
+ /**
13
+ * How far below the column's top edge a subsection's start may sit and
14
+ * still count as the one in view: the column's top padding and some slack,
15
+ * so the subsection a sidebar click scrolled to is the one marked.
16
+ */
17
+ export declare const SUBSECTION_SPY_SLACK_PX = 24;
18
+ /** The column's top padding, which a subsection keeps above it once scrolled to. */
19
+ export declare const SUBSECTION_SCROLL_INSET_PX = 14;
20
+ /**
21
+ * The subsection the sidebar marks as in view: the last one whose start has
22
+ * reached the column's top edge, or the last of all once the column is
23
+ * scrolled to its end (a short last subsection never reaches the top). A
24
+ * page that cannot scroll, or one not yet scrolled past its title, marks
25
+ * its first. Null when the page has no subsections.
26
+ */
27
+ export declare function spiedSubsection(anchors: readonly SubsectionAnchor[], view: SettingsScrollView): string | null;
28
+ /**
29
+ * Where to scroll the column to show a subsection: the top for the first,
30
+ * so the page title stays in view, and otherwise the subsection's start
31
+ * under the column's top padding. Null for an id the page does not draw.
32
+ */
33
+ export declare function subsectionScrollTop(anchors: readonly SubsectionAnchor[], id: string): number | null;