@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,36 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { KeyRound, Server, ShieldQuestionMark } from 'lucide-react';
3
+ import { Fragment, useEffect, useId, useRef, useState } from 'react';
4
+ import { ConfirmDialog } from '../dialog/ConfirmDialog.js';
5
+ import { ModalDialog } from '../dialog/ModalDialog.js';
6
+ import { useLabels } from '../labels/UiokProvider.js';
7
+ import { cutTooltip } from '../tooltip/Tooltip.logic.js';
8
+ /**
9
+ * One password or passphrase, asked in the dialog frame: fact rows for
10
+ * where and who, then the field's one-word label beside one secure field,
11
+ * and why it asks again when it does, on one label column. Return signs in
12
+ * and Escape cancels. The value lives in this field alone and leaves only
13
+ * as the answer; the field takes the focus once the dialog is up.
14
+ */
15
+ export function SignInDialog({ title, confirmLabel, facts, secretLabel, rejection = null, accepts = (value) => value.length > 0, children, icon = KeyRound, onSubmit, onCancel }) {
16
+ const labels = useLabels().dialog;
17
+ const ids = useId();
18
+ const [value, setValue] = useState('');
19
+ const field = useRef(null);
20
+ useEffect(() => {
21
+ field.current?.focus();
22
+ }, []);
23
+ return (_jsx(ModalDialog, { className: "sign-in-dialog", icon: icon, labelId: `${ids}-title`, legend: {
24
+ leave: { label: labels.cancel },
25
+ primary: { label: confirmLabel, disabled: !accepts(value), onRun: () => onSubmit(value) }
26
+ }, onCancel: onCancel, title: title, children: _jsxs("div", { className: "field-grid", children: [facts.map((fact) => (_jsxs(Fragment, { children: [_jsx("span", { className: "field-label sign-in-fact", children: fact.label }), _jsx("p", { className: "sign-in-fact-value dialog-value", ...cutTooltip(fact.value), children: fact.value })] }, fact.label))), _jsx("label", { className: "field-label", htmlFor: `${ids}-secret`, children: secretLabel }), _jsxs("div", { className: "field-value", children: [_jsx("input", { "aria-describedby": rejection === null ? undefined : `${ids}-note`, "aria-invalid": rejection === null ? undefined : true, autoComplete: "off", className: "field sign-in-field", id: `${ids}-secret`, onChange: (event) => setValue(event.target.value), ref: field, spellCheck: false, type: "password", value: value }), children, rejection !== null && (_jsx("p", { className: "field-problem", id: `${ids}-note`, role: "alert", children: rejection }))] })] }) }));
27
+ }
28
+ /**
29
+ * A host key the computer has not seen before, as a confirmation read at a
30
+ * glance: the lead says why it asks and when to trust it, the host is the
31
+ * one item, and then the key's type and its whole fingerprint in a framed
32
+ * well. The verb answers yes, Cancel no.
33
+ */
34
+ export function HostKeyDialog({ title, message, confirmLabel, host, keyType, fingerprint, onTrust, onCancel }) {
35
+ return (_jsx(ConfirmDialog, { confirmLabel: confirmLabel, icon: ShieldQuestionMark, itemIcon: Server, items: [host], message: message, onCancel: onCancel, onConfirm: onTrust, title: title, tone: "primary", children: _jsxs("dl", { className: "sign-in-fingerprint", children: [_jsx("dt", { className: "dialog-value", children: keyType }), _jsx("dd", { className: "dialog-value", children: fingerprint })] }) }));
36
+ }
@@ -0,0 +1,74 @@
1
+ import type { ReactElement } from 'react';
2
+ import type { AppearanceMode } from '../labels/settings.js';
3
+ import { type AppearanceThemes, type ThemeAppearance } from '../themes/ids.js';
4
+ /**
5
+ * Whether the system's appearance, as the page sees it, is dark now,
6
+ * following each change. A page with no `matchMedia` reads as light.
7
+ */
8
+ export declare function useSystemDark(): boolean;
9
+ /**
10
+ * A theme's miniature window, painted in that theme's own colours whatever
11
+ * the page wears (the preview tokens under `data-theme-preview`): the
12
+ * header strip with its window buttons, a sidebar with the cursor row lit,
13
+ * and a panel with a line of text, a quieter line, a primary chip beside an
14
+ * accent mark, and a row of the theme's ANSI colours. Drawn for the eye
15
+ * only; the option's name says which theme it is.
16
+ */
17
+ export declare function ThemePreview({ id }: {
18
+ readonly id: string;
19
+ }): ReactElement;
20
+ /** A theme a picker offers: its id and display name. */
21
+ export interface ThemeChoice {
22
+ readonly id: string;
23
+ readonly name: string;
24
+ }
25
+ /** Props for {@link ThemeChoices}. */
26
+ export interface ThemeChoicesProps {
27
+ /** The themes, in the order the picker lists them. */
28
+ readonly themes: readonly ThemeChoice[];
29
+ /** The chosen theme's id. */
30
+ readonly value: string;
31
+ /** Hears a new choice, never the one already chosen. */
32
+ readonly onChange: (id: string) => void;
33
+ /** The id of the group's label; or `label` names it. */
34
+ readonly labelId?: string;
35
+ /** The group's name where no element labels it. */
36
+ readonly label?: string;
37
+ /** The ids of what describes the group (whether it is in use now, when it shows). */
38
+ readonly describedBy?: string;
39
+ /** Marks the chosen theme for `SettingsDialog` to bring into view as the page opens. */
40
+ readonly reveal?: boolean;
41
+ }
42
+ /**
43
+ * One appearance's themes as a radio group of miniatures (`ThemePreview`),
44
+ * each with its name under it: one Tab stop (the chosen theme), the arrow
45
+ * keys moving the choice through every theme, wrapping at the ends, with
46
+ * the focus following it. A choice applies at once.
47
+ */
48
+ export declare function ThemeChoices({ themes, value, onChange, labelId, label, describedBy, reveal }: ThemeChoicesProps): ReactElement;
49
+ /** The themes of one appearance from the catalog, in its order. */
50
+ export declare const themesOf: (appearance: ThemeAppearance) => readonly ThemeChoice[];
51
+ /** Props for {@link AppearanceSettings}. */
52
+ export interface AppearanceSettingsProps {
53
+ /** Which appearance the windows wear, as last saved. */
54
+ readonly mode: AppearanceMode;
55
+ /** Saves and applies a new appearance. */
56
+ readonly onModeChange: (mode: AppearanceMode) => void;
57
+ /** The theme each appearance wears, as last saved. */
58
+ readonly themes: AppearanceThemes;
59
+ /** Saves the theme one appearance wears; `id` is always one of that appearance's themes. */
60
+ readonly onThemeChange: (appearance: ThemeAppearance, id: string) => void;
61
+ /** The subsection's id in the page's `subsections`; `theme` unless given. */
62
+ readonly subsectionId?: string;
63
+ }
64
+ /**
65
+ * The Appearance page's Theme subsection: which appearance the windows wear
66
+ * (System follows the operating system's), its note following the choice
67
+ * and the system, then each appearance's theme as a grid of miniatures
68
+ * (`ThemeChoices`), the band in use now marked so a dark theme picked while
69
+ * the window is light reads as waiting rather than ignored. When a band
70
+ * shows is the label's tooltip, read with the themes. The host holds every
71
+ * value and saves each change, which applies at once. Words from
72
+ * `UiokLabels.settings.appearance`.
73
+ */
74
+ export declare function AppearanceSettings({ mode, onModeChange, themes, onThemeChange, subsectionId }: AppearanceSettingsProps): ReactElement;
@@ -0,0 +1,96 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useEffect, useId, useRef, useState } from 'react';
3
+ import { useLabels } from '../labels/UiokProvider.js';
4
+ import { SegmentedChoice } from '../segmented/SegmentedChoice.js';
5
+ import { THEME_ENTRIES, THEME_PREVIEW_ATTRIBUTE } from '../themes/ids.js';
6
+ import { tooltip } from '../tooltip/Tooltip.logic.js';
7
+ import { SettingsSubsection, SETTINGS_REVEAL_ATTRIBUTE } from './SettingsSubsection.js';
8
+ import { appearanceInUse, steppedIndex } from './ThemePicker.logic.js';
9
+ const DARK_QUERY = '(prefers-color-scheme: dark)';
10
+ /**
11
+ * Whether the system's appearance, as the page sees it, is dark now,
12
+ * following each change. A page with no `matchMedia` reads as light.
13
+ */
14
+ export function useSystemDark() {
15
+ const [dark, setDark] = useState(() => window.matchMedia?.(DARK_QUERY).matches ?? false);
16
+ useEffect(() => {
17
+ const query = window.matchMedia?.(DARK_QUERY);
18
+ if (!query) {
19
+ return undefined;
20
+ }
21
+ const follow = () => setDark(query.matches);
22
+ follow();
23
+ query.addEventListener('change', follow);
24
+ return () => query.removeEventListener('change', follow);
25
+ }, []);
26
+ return dark;
27
+ }
28
+ /**
29
+ * A theme's miniature window, painted in that theme's own colours whatever
30
+ * the page wears (the preview tokens under `data-theme-preview`): the
31
+ * header strip with its window buttons, a sidebar with the cursor row lit,
32
+ * and a panel with a line of text, a quieter line, a primary chip beside an
33
+ * accent mark, and a row of the theme's ANSI colours. Drawn for the eye
34
+ * only; the option's name says which theme it is.
35
+ */
36
+ export function ThemePreview({ id }) {
37
+ return (_jsxs("span", { "aria-hidden": true, className: "theme-preview", [THEME_PREVIEW_ATTRIBUTE]: id, children: [_jsx("span", { className: "theme-preview-header", children: _jsxs("span", { className: "theme-preview-lights", children: [_jsx("span", {}), _jsx("span", {}), _jsx("span", {})] }) }), _jsxs("span", { className: "theme-preview-body", children: [_jsxs("span", { className: "theme-preview-sidebar", children: [_jsx("span", { className: "theme-preview-row lit" }), _jsx("span", { className: "theme-preview-row" }), _jsx("span", { className: "theme-preview-row" })] }), _jsxs("span", { className: "theme-preview-panel", children: [_jsx("span", { className: "theme-preview-line text" }), _jsx("span", { className: "theme-preview-line dim" }), _jsxs("span", { className: "theme-preview-chips", children: [_jsx("span", { className: "theme-preview-chip primary" }), _jsx("span", { className: "theme-preview-chip accent" })] }), _jsx("span", { className: "theme-preview-swatches", children: [1, 2, 3, 4, 5, 6].map((index) => (_jsx("span", { className: `theme-preview-swatch ansi-${index}` }, index))) })] })] })] }));
38
+ }
39
+ /**
40
+ * One appearance's themes as a radio group of miniatures (`ThemePreview`),
41
+ * each with its name under it: one Tab stop (the chosen theme), the arrow
42
+ * keys moving the choice through every theme, wrapping at the ends, with
43
+ * the focus following it. A choice applies at once.
44
+ */
45
+ export function ThemeChoices({ themes, value, onChange, labelId, label, describedBy, reveal = false }) {
46
+ const group = useRef(null);
47
+ const choose = (id) => {
48
+ if (id !== value)
49
+ onChange(id);
50
+ };
51
+ const step = (event) => {
52
+ const index = steppedIndex(event.key, themes.findIndex((theme) => theme.id === value), themes.length);
53
+ const next = index === null ? undefined : themes[index];
54
+ if (index === null || next === undefined) {
55
+ return;
56
+ }
57
+ event.preventDefault();
58
+ choose(next.id);
59
+ group.current?.querySelectorAll('[role="radio"]')[index]?.focus();
60
+ };
61
+ return (_jsx("div", { "aria-describedby": describedBy, "aria-label": labelId === undefined ? label : undefined, "aria-labelledby": labelId, className: "theme-choices", onKeyDown: step, ref: group, role: "radiogroup", children: themes.map((theme) => (_jsxs("button", { "aria-checked": theme.id === value, className: "theme-choice", onClick: () => choose(theme.id), role: "radio", tabIndex: theme.id === value ? 0 : -1, type: "button", ...(reveal && theme.id === value ? { [SETTINGS_REVEAL_ATTRIBUTE]: '' } : {}), children: [_jsx("span", { className: "theme-choice-frame", children: _jsx(ThemePreview, { id: theme.id }) }), _jsx("span", { className: "theme-choice-name", "data-name": theme.name, children: theme.name })] }, theme.id))) }));
62
+ }
63
+ /** The themes of one appearance from the catalog, in its order. */
64
+ export const themesOf = (appearance) => THEME_ENTRIES.filter((entry) => entry.appearance === appearance);
65
+ /** The appearances whose themes the page lists, in its order. */
66
+ const APPEARANCES = ['light', 'dark'];
67
+ /** The appearance choices, in the segmented control's order. */
68
+ const MODES = ['system', 'light', 'dark'];
69
+ /**
70
+ * The Appearance page's Theme subsection: which appearance the windows wear
71
+ * (System follows the operating system's), its note following the choice
72
+ * and the system, then each appearance's theme as a grid of miniatures
73
+ * (`ThemeChoices`), the band in use now marked so a dark theme picked while
74
+ * the window is light reads as waiting rather than ignored. When a band
75
+ * shows is the label's tooltip, read with the themes. The host holds every
76
+ * value and saves each change, which applies at once. Words from
77
+ * `UiokLabels.settings.appearance`.
78
+ */
79
+ export function AppearanceSettings({ mode, onModeChange, themes, onThemeChange, subsectionId = 'theme' }) {
80
+ const labels = useLabels().settings.appearance;
81
+ const systemDark = useSystemDark();
82
+ const inUse = appearanceInUse(mode, systemDark);
83
+ const ids = useId();
84
+ const modeLabelId = `${ids}-mode`;
85
+ return (_jsx(SettingsSubsection, { id: subsectionId, title: labels.title, children: _jsxs("div", { className: "field-grid", children: [_jsx("span", { className: "field-label", id: modeLabelId, children: labels.mode }), _jsxs("div", { className: "field-value", children: [_jsx("div", { className: "field-option", children: _jsx(SegmentedChoice, { choices: MODES, labelId: modeLabelId, onChange: onModeChange, render: (choice) => labels.modes[choice], value: mode }) }), _jsx("p", { className: "field-note", children: labels.modeNote(mode, systemDark) })] }), APPEARANCES.map((appearance) => {
86
+ const labelId = `${ids}-${appearance}`;
87
+ const noteId = `${labelId}-note`;
88
+ const note = appearance === 'light' ? labels.lightNote : labels.darkNote;
89
+ const used = inUse === appearance;
90
+ return (_jsx(ThemeBand, { describedBy: used ? `${labelId}-in-use ${noteId}` : noteId, inUse: used ? labels.inUse : null, label: appearance === 'light' ? labels.lightTheme : labels.darkTheme, labelId: labelId, note: note, noteId: noteId, onChange: (id) => onThemeChange(appearance, id), themes: themesOf(appearance), value: themes[appearance] }, appearance));
91
+ })] }) }));
92
+ }
93
+ /** One appearance's band: its label, marked while in use, and its themes. */
94
+ function ThemeBand({ label, labelId, inUse, note, noteId, describedBy, themes, value, onChange }) {
95
+ return (_jsxs(_Fragment, { children: [_jsxs("span", { className: "field-label", ...tooltip(note), children: [_jsx("span", { id: labelId, children: label }), inUse === null ? null : (_jsx("span", { className: "settings-label-detail", id: `${labelId}-in-use`, children: inUse }))] }), _jsxs("div", { className: "field-value", children: [_jsx(ThemeChoices, { describedBy: describedBy, labelId: labelId, onChange: onChange, reveal: inUse !== null, themes: themes, value: value }), _jsx("p", { className: "visually-hidden", id: noteId, children: note })] })] }));
96
+ }
@@ -0,0 +1,13 @@
1
+ import type { AppearanceMode } from '../labels/settings.js';
2
+ import type { ThemeAppearance } from '../themes/ids.js';
3
+ /**
4
+ * Where an arrow key moves the choice in a radio group of `count` options
5
+ * from `index`: Right and Down to the next, Left and Up to the previous,
6
+ * wrapping at either end. Null for any other key.
7
+ */
8
+ export declare function steppedIndex(key: string, index: number, count: number): number | null;
9
+ /**
10
+ * The appearance the window wears now: the one chosen, or, while it follows
11
+ * the system, the one the system uses (`systemDark`).
12
+ */
13
+ export declare function appearanceInUse(mode: AppearanceMode, systemDark: boolean): ThemeAppearance;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Where an arrow key moves the choice in a radio group of `count` options
3
+ * from `index`: Right and Down to the next, Left and Up to the previous,
4
+ * wrapping at either end. Null for any other key.
5
+ */
6
+ export function steppedIndex(key, index, count) {
7
+ const delta = key === 'ArrowRight' || key === 'ArrowDown'
8
+ ? 1
9
+ : key === 'ArrowLeft' || key === 'ArrowUp'
10
+ ? -1
11
+ : 0;
12
+ if (delta === 0 || count === 0) {
13
+ return null;
14
+ }
15
+ return (index + delta + count) % count;
16
+ }
17
+ /**
18
+ * The appearance the window wears now: the one chosen, or, while it follows
19
+ * the system, the one the system uses (`systemDark`).
20
+ */
21
+ export function appearanceInUse(mode, systemDark) {
22
+ if (mode === 'system') {
23
+ return systemDark ? 'dark' : 'light';
24
+ }
25
+ return mode;
26
+ }
@@ -0,0 +1,44 @@
1
+ import type { ReactElement, ReactNode } from 'react';
2
+ /** Props for {@link ChannelMarker}. */
3
+ export interface ChannelMarkerProps {
4
+ /** The channel's name ("Latest", "Local"). */
5
+ readonly label: string;
6
+ /** The build number or the branch, the part that gives way to an ellipsis. */
7
+ readonly detail?: string | null;
8
+ /** The whole build line, the marker's tooltip and accessible description. */
9
+ readonly title?: string;
10
+ /**
11
+ * The spoken words for a build with changes not yet committed, which the
12
+ * marker shows as a dot after the detail; none for a clean build.
13
+ */
14
+ readonly modified?: string | null;
15
+ }
16
+ /**
17
+ * The release channel after a lockup in the title bar, on a build that is
18
+ * not the release: a dot in the channel's colour (`--channel`, which an
19
+ * ancestor's `data-channel` sets), the channel's name, and its build number
20
+ * or branch, small and quiet, so a screenshot always says which build it
21
+ * shows without the bar shouting it. It takes pointer events inside the
22
+ * bar's drag region, so its tooltip shows.
23
+ */
24
+ export declare function ChannelMarker({ label, detail, title, modified }: ChannelMarkerProps): ReactElement;
25
+ /** Props for {@link TitleBar}. */
26
+ export interface TitleBarProps {
27
+ /** The lockup and, on a build that is not the release, its `ChannelMarker`. */
28
+ readonly children: ReactNode;
29
+ /**
30
+ * Whether the window's own buttons sit at the bar's leading end, as
31
+ * macOS draws its traffic lights over a hidden title bar: the brand then
32
+ * starts clear of them (`--traffic-light-inset`). Elsewhere the bar's
33
+ * own padding stands there.
34
+ */
35
+ readonly trafficLights?: boolean;
36
+ }
37
+ /**
38
+ * The window's title bar where the native one is hidden: the brand at its
39
+ * leading end on the window's ground, painting nothing, so tabs beside it
40
+ * stand on the same ground. The whole bar is a drag region (it moves the
41
+ * window and a double click zooms it) except the channel marker; a narrow
42
+ * bar cuts the marker's detail first, never the lockup.
43
+ */
44
+ export declare function TitleBar({ children, trafficLights }: TitleBarProps): ReactElement;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { describedTooltip } from '../tooltip/Tooltip.logic.js';
3
+ /**
4
+ * The release channel after a lockup in the title bar, on a build that is
5
+ * not the release: a dot in the channel's colour (`--channel`, which an
6
+ * ancestor's `data-channel` sets), the channel's name, and its build number
7
+ * or branch, small and quiet, so a screenshot always says which build it
8
+ * shows without the bar shouting it. It takes pointer events inside the
9
+ * bar's drag region, so its tooltip shows.
10
+ */
11
+ export function ChannelMarker({ label, detail = null, title, modified = null }) {
12
+ return (_jsxs("span", { className: "shell-channel", ...describedTooltip(title), children: [_jsx("span", { "aria-hidden": true, className: "shell-channel-dot" }), _jsx("span", { className: "shell-channel-name", children: label }), detail ? _jsx("span", { className: "shell-channel-detail", children: detail }) : null, modified ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": true, className: "shell-channel-modified", children: "\u25CF" }), _jsx("span", { className: "visually-hidden", children: modified })] })) : null] }));
13
+ }
14
+ /**
15
+ * The window's title bar where the native one is hidden: the brand at its
16
+ * leading end on the window's ground, painting nothing, so tabs beside it
17
+ * stand on the same ground. The whole bar is a drag region (it moves the
18
+ * window and a double click zooms it) except the channel marker; a narrow
19
+ * bar cuts the marker's detail first, never the lockup.
20
+ */
21
+ export function TitleBar({ children, trafficLights = false }) {
22
+ return (_jsx("header", { className: "shell-topbar", "data-traffic-lights": trafficLights ? '' : undefined, children: _jsx("div", { className: "shell-brand", children: children }) }));
23
+ }
@@ -0,0 +1,26 @@
1
+ import type { ReactElement } from 'react';
2
+ /**
3
+ * Where an offered build stands, as the pill shows it: `offered` (found,
4
+ * not yet downloaded, or downloading), `ready` (downloaded and verified,
5
+ * installs on restart), or `download-failed`.
6
+ */
7
+ export type UpdatePillState = 'offered' | 'ready' | 'download-failed';
8
+ /** Props for {@link UpdatePill}. */
9
+ export interface UpdatePillProps {
10
+ readonly state: UpdatePillState;
11
+ /** The pill's words ("Update", "Restart"). */
12
+ readonly label: string;
13
+ /** What the pill offers in full ("Update ready · 2.5.0"), its tooltip and accessible description. */
14
+ readonly description?: string;
15
+ /** Opens the place that carries the notes, the download, and the restart (Settings › Updates). */
16
+ readonly onOpen: () => void;
17
+ }
18
+ /**
19
+ * The title bar's update control, shown only while a build is offered: a
20
+ * tonal Update with a download arrow, a solid Restart once the build is
21
+ * ready, and a neutral pill with a warning outline and glyph after a failed
22
+ * download. It never shows progress; its click opens the place that does.
23
+ * The host shows it only while there is an offer and hands the focus back
24
+ * to it when what it opened closes.
25
+ */
26
+ export declare function UpdatePill({ state, label, description, onOpen }: UpdatePillProps): ReactElement;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ArrowDownToLine, RotateCw, TriangleAlert } from 'lucide-react';
3
+ import { Button } from '../button/Button.js';
4
+ import { ICON_MD } from '../icon/sizes.js';
5
+ import { describedTooltip } from '../tooltip/Tooltip.logic.js';
6
+ /**
7
+ * The title bar's update control, shown only while a build is offered: a
8
+ * tonal Update with a download arrow, a solid Restart once the build is
9
+ * ready, and a neutral pill with a warning outline and glyph after a failed
10
+ * download. It never shows progress; its click opens the place that does.
11
+ * The host shows it only while there is an offer and hands the focus back
12
+ * to it when what it opened closes.
13
+ */
14
+ export function UpdatePill({ state, label, description, onOpen }) {
15
+ const Icon = state === 'ready' ? RotateCw : state === 'download-failed' ? TriangleAlert : ArrowDownToLine;
16
+ return (_jsxs(Button, { "aria-haspopup": "dialog", className: "shell-update-pill", "data-state": state, onClick: onOpen, variant: state === 'ready' ? 'primary' : state === 'download-failed' ? 'neutral' : 'tonal', ...describedTooltip(description), children: [_jsx(Icon, { "aria-hidden": true, size: ICON_MD }), label] }));
17
+ }
@@ -0,0 +1,99 @@
1
+ import { type LucideIcon } from 'lucide-react';
2
+ import type { ReactElement, ReactNode } from 'react';
3
+ import { type RunHeaderProps } from '../run/RunHeader.js';
4
+ /** A heading's lines in a build's notes. */
5
+ export interface UpdateNotesGroup {
6
+ /** The heading: the area of the app the lines are about. */
7
+ readonly title: string;
8
+ readonly lines: readonly string[];
9
+ }
10
+ /** Props for {@link UpdateNotes}. */
11
+ export interface UpdateNotesProps {
12
+ /** The section's heading ("What's new"), also the list's accessible name. */
13
+ readonly heading: string;
14
+ /** The words shown when the build lists no change. */
15
+ readonly empty: string;
16
+ /** The notes, one line per change, listed as one list where `groups` is null. */
17
+ readonly lines: readonly string[];
18
+ /** The lines under a heading per area; null lists `lines` as one list. */
19
+ readonly groups?: readonly UpdateNotesGroup[] | null;
20
+ }
21
+ /**
22
+ * What's new in an offered build, at the foot of the update card: the
23
+ * notes under a heading per area, or as one list, in a box that scrolls on
24
+ * its own once the card reaches the bottom of the column, and that the
25
+ * arrow keys scroll when focused. A squeezed box keeps its first three
26
+ * rows, a heading counting as one.
27
+ */
28
+ export declare function UpdateNotes({ heading, empty, lines, groups }: UpdateNotesProps): ReactElement;
29
+ /** The update card's tone, which colours its glyph (and an `error`'s title). */
30
+ export type UpdateCardTone = 'idle' | 'busy' | 'ready' | 'ok' | 'warning' | 'error';
31
+ /** The update card's one next step. */
32
+ export interface UpdateCardVerb {
33
+ readonly label: string;
34
+ /** The primary fill (Download, Restart), else neutral (Check Now, Stop). */
35
+ readonly primary?: boolean;
36
+ readonly disabled?: boolean;
37
+ readonly onRun: () => void;
38
+ }
39
+ /** Props for {@link UpdateCard}. */
40
+ export interface UpdateCardProps {
41
+ readonly tone: UpdateCardTone;
42
+ /** The state's glyph; `checking` draws the turning ring. */
43
+ readonly glyph: LucideIcon | 'checking';
44
+ /** What the card is about: the installed build, or the offered one (a `strong` in it is set strong). */
45
+ readonly title: ReactNode;
46
+ /** A quieter line under the title (the installed version under an offer). */
47
+ readonly sub?: ReactNode;
48
+ /** When, after `sub`; a clock moves it, so it is never announced. */
49
+ readonly when?: ReactNode;
50
+ readonly verb?: UpdateCardVerb | null;
51
+ /** A download, or a check that failed, under the head: a `RunHeader`. */
52
+ readonly run?: RunHeaderProps | null;
53
+ /** A quiet line under the head ("Installs the next time the app opens"). */
54
+ readonly note?: string | null;
55
+ /** A failure of the card's own verb, as a danger notice. */
56
+ readonly failure?: string | null;
57
+ /** What's new in the offered build, at the card's foot. */
58
+ readonly notes?: UpdateNotesProps | null;
59
+ }
60
+ /**
61
+ * The Updates page's status card: the state's glyph, where the updater
62
+ * stands with a quieter line under it, and its one next step; then a
63
+ * download or a failed check in the shared progress header under a quieter
64
+ * head, a note, a failure, and the offered build's notes, the card growing
65
+ * with them only to the bottom of the column. A verb that disables itself
66
+ * or goes while it holds the focus hands the focus to the dialog around the
67
+ * card, so Escape and Tab still reach it.
68
+ */
69
+ export declare function UpdateCard({ tone, glyph, title, sub, when, verb, run, note, failure, notes }: UpdateCardProps): ReactElement;
70
+ /** One choice of how often the updater checks. */
71
+ export interface UpdateChecksChoice<Value extends string> {
72
+ readonly value: Value;
73
+ readonly label: string;
74
+ }
75
+ /** Props for {@link UpdateChecks}. */
76
+ export interface UpdateChecksProps<Value extends string> {
77
+ /** The select's label ("Check for updates"). */
78
+ readonly label: string;
79
+ readonly value: Value;
80
+ readonly choices: readonly UpdateChecksChoice<Value>[];
81
+ /** The note under both, which follows the choice. */
82
+ readonly note: string;
83
+ readonly onChange: (value: Value) => void;
84
+ }
85
+ /** How often the updater checks on its own: a label, a select at the end, and a note under both, on a card. */
86
+ export declare function UpdateChecks<Value extends string>({ label, value, choices, note, onChange }: UpdateChecksProps<Value>): ReactElement;
87
+ /** Props for {@link UpdatesPage}. */
88
+ export interface UpdatesPageProps {
89
+ /** The cadence (`UpdateChecks`); none where the build cannot update. */
90
+ readonly checks?: ReactNode;
91
+ /** The status card (`UpdateCard`); none before the first status is known, which leaves the page busy. */
92
+ readonly card?: ReactNode;
93
+ }
94
+ /**
95
+ * The Updates page's body (a `SettingsPage` with `fills`): the check
96
+ * cadence over the status card. Until the host knows the updater's status
97
+ * the page is empty and busy, so it never shows a status it would take back.
98
+ */
99
+ export declare function UpdatesPage({ checks, card }: UpdatesPageProps): ReactElement;
@@ -0,0 +1,72 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { CircleAlert } from 'lucide-react';
3
+ import { useId, useLayoutEffect, useRef } from 'react';
4
+ import { Button } from '../button/Button.js';
5
+ import { Spinner } from '../icon/Spinner.js';
6
+ import { ICON_LG, ICON_MD } from '../icon/sizes.js';
7
+ import { RunHeader } from '../run/RunHeader.js';
8
+ /** The notes a squeezed card still shows before the column scrolls instead. */
9
+ const NOTES_FLOOR_ROWS = 3;
10
+ /**
11
+ * What's new in an offered build, at the foot of the update card: the
12
+ * notes under a heading per area, or as one list, in a box that scrolls on
13
+ * its own once the card reaches the bottom of the column, and that the
14
+ * arrow keys scroll when focused. A squeezed box keeps its first three
15
+ * rows, a heading counting as one.
16
+ */
17
+ export function UpdateNotes({ heading, empty, lines, groups = null }) {
18
+ const ids = useId();
19
+ const rows = groups === null ? lines.length : groups.reduce((sum, group) => sum + group.lines.length + 1, 0);
20
+ const box = {
21
+ 'aria-label': heading,
22
+ style: { '--update-note-rows': Math.min(rows, NOTES_FLOOR_ROWS) },
23
+ tabIndex: 0
24
+ };
25
+ return (_jsxs("section", { "aria-labelledby": `${ids}-heading`, className: "update-notes", children: [_jsx("h4", { className: "overline", id: `${ids}-heading`, children: heading }), rows === 0 ? (_jsx("p", { className: "field-note", children: empty })) : groups === null ? (_jsx("div", { className: "update-notes-frame", children: _jsx("ul", { ...box, className: "update-notes-list scroll-fade", children: lines.map((line, index) => (_jsx("li", { children: line }, index))) }) })) : (_jsx("div", { className: "update-notes-frame", children: _jsx("div", { ...box, className: "update-notes-list scroll-fade update-notes-groups", role: "group", children: groups.map((group, groupIndex) => (_jsxs("div", { className: "update-notes-group", children: [_jsx("h5", { className: "update-notes-area", id: `${ids}-area-${groupIndex}`, children: group.title }), _jsx("ul", { "aria-labelledby": `${ids}-area-${groupIndex}`, children: group.lines.map((line, index) => (_jsx("li", { children: line }, index))) })] }, group.title))) }) }))] }));
26
+ }
27
+ /**
28
+ * The Updates page's status card: the state's glyph, where the updater
29
+ * stands with a quieter line under it, and its one next step; then a
30
+ * download or a failed check in the shared progress header under a quieter
31
+ * head, a note, a failure, and the offered build's notes, the card growing
32
+ * with them only to the bottom of the column. A verb that disables itself
33
+ * or goes while it holds the focus hands the focus to the dialog around the
34
+ * card, so Escape and Tab still reach it.
35
+ */
36
+ export function UpdateCard({ tone, glyph, title, sub = null, when = null, verb = null, run = null, note = null, failure = null, notes = null }) {
37
+ const card = useRef(null);
38
+ const Glyph = glyph === 'checking' ? null : glyph;
39
+ const verbLabel = verb?.label;
40
+ const verbDisabled = verb?.disabled === true;
41
+ const showsNotes = notes !== null;
42
+ useLayoutEffect(() => {
43
+ const element = card.current;
44
+ const focused = element?.ownerDocument.activeElement;
45
+ if (element &&
46
+ (focused === element.ownerDocument.body ||
47
+ (focused instanceof HTMLButtonElement && focused.disabled && element.contains(focused)))) {
48
+ element.closest('[role="dialog"]')?.focus({ preventScroll: true });
49
+ }
50
+ }, [verbLabel, verbDisabled, showsNotes]);
51
+ return (_jsxs("div", { className: ['update-card card', run ? 'with-run' : null, notes ? 'with-notes' : null]
52
+ .filter(Boolean)
53
+ .join(' '), "data-tone": tone, ref: card, children: [_jsxs("div", { className: "update-card-head", children: [Glyph === null ? (_jsx(Spinner, { className: "update-card-glyph", size: ICON_LG })) : (_jsx(Glyph, { "aria-hidden": true, className: "update-card-glyph", size: ICON_LG })), _jsxs("div", { className: "update-card-said", role: "status", children: [_jsx("span", { className: "update-card-title", children: title }), sub !== null || when !== null ? (_jsxs("span", { className: "update-card-sub", children: [sub, sub !== null && when !== null ? ' · ' : null, when !== null ? _jsx("span", { "aria-live": "off", children: when }) : null] })) : null] }), verb ? (_jsx(Button, { disabled: verb.disabled, onClick: verb.onRun, size: "small", variant: verb.primary ? 'primary' : 'neutral', children: verb.label })) : null] }), run ? _jsx(RunHeader, { ...run }) : null, note ? _jsx("p", { className: "update-card-note", children: note }) : null, failure ? (_jsxs("div", { className: "notice notice-danger", role: "alert", children: [_jsx(CircleAlert, { "aria-hidden": true, size: ICON_MD }), _jsx("p", { className: "notice-text", children: failure })] })) : null, notes ? _jsx(UpdateNotes, { ...notes }) : null] }));
54
+ }
55
+ /** How often the updater checks on its own: a label, a select at the end, and a note under both, on a card. */
56
+ export function UpdateChecks({ label, value, choices, note, onChange }) {
57
+ const id = useId();
58
+ const choose = (event) => {
59
+ const choice = choices.find((candidate) => candidate.value === event.target.value);
60
+ if (choice !== undefined)
61
+ onChange(choice.value);
62
+ };
63
+ return (_jsxs("div", { className: "update-checks card", children: [_jsx("label", { className: "update-checks-label", htmlFor: id, children: label }), _jsx("select", { className: "field field-sm", id: id, onChange: choose, value: value, children: choices.map((choice) => (_jsx("option", { value: choice.value, children: choice.label }, choice.value))) }), _jsx("p", { className: "field-note", children: note })] }));
64
+ }
65
+ /**
66
+ * The Updates page's body (a `SettingsPage` with `fills`): the check
67
+ * cadence over the status card. Until the host knows the updater's status
68
+ * the page is empty and busy, so it never shows a status it would take back.
69
+ */
70
+ export function UpdatesPage({ checks = null, card = null }) {
71
+ return (_jsx("div", { "aria-busy": card === null ? true : undefined, className: "updates-page", children: card === null ? null : (_jsxs(_Fragment, { children: [checks, card] })) }));
72
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The shell: what an app's window draws around its own pages, which every
3
+ * app of the family draws the same way. The title bar (`TitleBar` with the
4
+ * `Lockup`, the `BrandMark`, and the `ChannelMarker`), the `UpdatePill`, the
5
+ * `AboutWindow`, the `SettingsDialog` with its subsections and page keys,
6
+ * its shared pages (`AppearanceSettings` over `ThemeChoices`,
7
+ * `LanguageChoice`, `UpdatesPage` with `UpdateChecks` and `UpdateCard`,
8
+ * `SettingsFiles`), and the sign-in prompts (`SignInDialog`,
9
+ * `HostKeyDialog`), and the `LoadFailure` a window shows in place of
10
+ * content that failed to load. Their look is `shell.css` in
11
+ * `@bigpixelrocket/uiok/styles.css`.
12
+ */
13
+ export { AboutWindow, type AboutWindowProps } from './AboutWindow.js';
14
+ export { LanguageChoice, type LanguageChoiceProps, type LanguageOption } from './LanguageChoice.js';
15
+ export { LoadFailure, type LoadFailureProps } from './LoadFailure.js';
16
+ export { BrandMark, Lockup, type BrandMarkLook, type BrandMarkProps, type BrandMarkShape, type LockupProps, type LockupSize } from './Lockup.js';
17
+ export { SettingsDialog, SettingsSaveFailure, type SettingsDialogProps, type SettingsGroup, type SettingsPage, type SettingsPageRequest, type SettingsSaveFailureProps, type SettingsSubsectionEntry } from './SettingsDialog.js';
18
+ export { spiedSubsection, SUBSECTION_SCROLL_INSET_PX, SUBSECTION_SPY_SLACK_PX, subsectionScrollTop, type SettingsScrollView, type SubsectionAnchor } from './SettingsDialog.logic.js';
19
+ export { SettingsFiles, type SettingsFileEntry, type SettingsFileProblem, type SettingsFileRequest, type SettingsFilesProps } from './SettingsFiles.js';
20
+ export { SettingsPageKeysContext, settingsLegend, useSettingsPageKeys, type SettingsPageKeys } from './SettingsPageKeys.js';
21
+ export { SETTINGS_PAGE_HEAD_ATTRIBUTE, SETTINGS_REVEAL_ATTRIBUTE, SETTINGS_SUBSECTION_ATTRIBUTE, SettingsSubsection, type SettingsSubsectionProps } from './SettingsSubsection.js';
22
+ export { HostKeyDialog, SignInDialog, type HostKeyDialogProps, type SignInDialogProps, type SignInFact } from './SignIn.js';
23
+ export { AppearanceSettings, ThemeChoices, ThemePreview, themesOf, useSystemDark, type AppearanceSettingsProps, type ThemeChoice, type ThemeChoicesProps } from './ThemePicker.js';
24
+ export { appearanceInUse, steppedIndex } from './ThemePicker.logic.js';
25
+ export { ChannelMarker, TitleBar, type ChannelMarkerProps, type TitleBarProps } from './TitleBar.js';
26
+ export { UpdatePill, type UpdatePillProps, type UpdatePillState } from './UpdatePill.js';
27
+ export { UpdateCard, UpdateChecks, UpdateNotes, UpdatesPage, type UpdateCardProps, type UpdateCardTone, type UpdateCardVerb, type UpdateChecksChoice, type UpdateChecksProps, type UpdateNotesGroup, type UpdateNotesProps, type UpdatesPageProps } from './Updates.js';
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The shell: what an app's window draws around its own pages, which every
3
+ * app of the family draws the same way. The title bar (`TitleBar` with the
4
+ * `Lockup`, the `BrandMark`, and the `ChannelMarker`), the `UpdatePill`, the
5
+ * `AboutWindow`, the `SettingsDialog` with its subsections and page keys,
6
+ * its shared pages (`AppearanceSettings` over `ThemeChoices`,
7
+ * `LanguageChoice`, `UpdatesPage` with `UpdateChecks` and `UpdateCard`,
8
+ * `SettingsFiles`), and the sign-in prompts (`SignInDialog`,
9
+ * `HostKeyDialog`), and the `LoadFailure` a window shows in place of
10
+ * content that failed to load. Their look is `shell.css` in
11
+ * `@bigpixelrocket/uiok/styles.css`.
12
+ */
13
+ export { AboutWindow } from './AboutWindow.js';
14
+ export { LanguageChoice } from './LanguageChoice.js';
15
+ export { LoadFailure } from './LoadFailure.js';
16
+ export { BrandMark, Lockup } from './Lockup.js';
17
+ export { SettingsDialog, SettingsSaveFailure } from './SettingsDialog.js';
18
+ export { spiedSubsection, SUBSECTION_SCROLL_INSET_PX, SUBSECTION_SPY_SLACK_PX, subsectionScrollTop } from './SettingsDialog.logic.js';
19
+ export { SettingsFiles } from './SettingsFiles.js';
20
+ export { SettingsPageKeysContext, settingsLegend, useSettingsPageKeys } from './SettingsPageKeys.js';
21
+ export { SETTINGS_PAGE_HEAD_ATTRIBUTE, SETTINGS_REVEAL_ATTRIBUTE, SETTINGS_SUBSECTION_ATTRIBUTE, SettingsSubsection } from './SettingsSubsection.js';
22
+ export { HostKeyDialog, SignInDialog } from './SignIn.js';
23
+ export { AppearanceSettings, ThemeChoices, ThemePreview, themesOf, useSystemDark } from './ThemePicker.js';
24
+ export { appearanceInUse, steppedIndex } from './ThemePicker.logic.js';
25
+ export { ChannelMarker, TitleBar } from './TitleBar.js';
26
+ export { UpdatePill } from './UpdatePill.js';
27
+ export { UpdateCard, UpdateChecks, UpdateNotes, UpdatesPage } from './Updates.js';