@haatlabs-core/ui 0.17.0 → 0.18.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 (59) hide show
  1. package/README.md +33 -0
  2. package/dist/client/LoginPage.js +1 -1
  3. package/dist/client/LoginPage.js.map +1 -1
  4. package/dist/client/UsagePage.js +1 -1
  5. package/dist/client/UsagePage.js.map +1 -1
  6. package/dist/client/sign-in-styles.d.ts +1 -1
  7. package/dist/client/sign-in-styles.js +26 -26
  8. package/dist/client/usage-css.d.ts +5 -0
  9. package/dist/client/usage-css.js +50 -0
  10. package/dist/client/usage-css.js.map +1 -0
  11. package/dist/index.d.ts +19 -0
  12. package/dist/index.js +13 -0
  13. package/dist/index.js.map +1 -1
  14. package/dist/layout/Callout.d.ts +7 -0
  15. package/dist/layout/Callout.js +6 -0
  16. package/dist/layout/Callout.js.map +1 -0
  17. package/dist/layout/Card.d.ts +7 -0
  18. package/dist/layout/Card.js +8 -0
  19. package/dist/layout/Card.js.map +1 -0
  20. package/dist/layout/Checklist.d.ts +11 -0
  21. package/dist/layout/Checklist.js +8 -0
  22. package/dist/layout/Checklist.js.map +1 -0
  23. package/dist/layout/PageHeader.d.ts +7 -0
  24. package/dist/layout/PageHeader.js +6 -0
  25. package/dist/layout/PageHeader.js.map +1 -0
  26. package/dist/layout/StatusChip.d.ts +7 -0
  27. package/dist/layout/StatusChip.js +7 -0
  28. package/dist/layout/StatusChip.js.map +1 -0
  29. package/dist/layout/layout-css.d.ts +2 -0
  30. package/dist/layout/layout-css.js +23 -0
  31. package/dist/layout/layout-css.js.map +1 -0
  32. package/dist/shell/AppShell.d.ts +22 -0
  33. package/dist/shell/AppShell.js +91 -0
  34. package/dist/shell/AppShell.js.map +1 -0
  35. package/dist/shell/ShellSearch.d.ts +11 -0
  36. package/dist/shell/ShellSearch.js +55 -0
  37. package/dist/shell/ShellSearch.js.map +1 -0
  38. package/dist/shell/nav.d.ts +17 -0
  39. package/dist/shell/nav.js +17 -0
  40. package/dist/shell/nav.js.map +1 -0
  41. package/dist/shell/shell-css.d.ts +2 -0
  42. package/dist/shell/shell-css.js +50 -0
  43. package/dist/shell/shell-css.js.map +1 -0
  44. package/dist/theme/ThemeStyles.d.ts +6 -0
  45. package/dist/theme/ThemeStyles.js +10 -0
  46. package/dist/theme/ThemeStyles.js.map +1 -0
  47. package/dist/theme/ThemeSwitch.d.ts +3 -0
  48. package/dist/theme/ThemeSwitch.js +34 -0
  49. package/dist/theme/ThemeSwitch.js.map +1 -0
  50. package/dist/theme/contrast.d.ts +2 -0
  51. package/dist/theme/contrast.js +13 -0
  52. package/dist/theme/contrast.js.map +1 -0
  53. package/dist/theme/theme-choice.d.ts +22 -0
  54. package/dist/theme/theme-choice.js +98 -0
  55. package/dist/theme/theme-choice.js.map +1 -0
  56. package/dist/theme/tokens.d.ts +42 -0
  57. package/dist/theme/tokens.js +102 -0
  58. package/dist/theme/tokens.js.map +1 -0
  59. package/package.json +4 -4
@@ -0,0 +1,91 @@
1
+ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
+ import { Link, NavLink, useLocation } from 'react-router-dom';
4
+ import { ThemeSwitch } from '../theme/ThemeSwitch.js';
5
+ import { ShellSearch } from './ShellSearch.js';
6
+ import { flattenNav, isUnder } from './nav.js';
7
+ const NARROW = '(max-width: 899px)';
8
+ /** Whether the screen is phone-sized: the sidebar becomes a menu. */
9
+ function useNarrow() {
10
+ const query = () => typeof window !== 'undefined' && typeof window.matchMedia === 'function'
11
+ ? window.matchMedia(NARROW)
12
+ : null;
13
+ const [narrow, setNarrow] = useState(() => query()?.matches ?? false);
14
+ useEffect(() => {
15
+ const list = query();
16
+ if (!list)
17
+ return;
18
+ const onChange = () => setNarrow(list.matches);
19
+ list.addEventListener('change', onChange);
20
+ return () => list.removeEventListener('change', onChange);
21
+ }, []);
22
+ return narrow;
23
+ }
24
+ function Items({ items, pathname }) {
25
+ return (_jsx("ul", { children: items.map((item) => (_jsxs("li", { children: [_jsxs(NavLink, { to: item.to, end: true, children: [item.icon, item.label] }), item.children && isUnder(pathname, item.to) && (_jsx(Items, { items: item.children, pathname: pathname }))] }, item.to))) }));
26
+ }
27
+ function Nav({ groups }) {
28
+ const { pathname } = useLocation();
29
+ return (_jsx("nav", { "aria-label": "Main", className: "hl-nav", children: groups.map((group, i) => (_jsxs("div", { children: [group.label && _jsx("p", { className: "hl-nav__group", children: group.label }), _jsx(Items, { items: group.items, pathname: pathname })] }, group.label ?? `group-${String(i)}`))) }));
30
+ }
31
+ /** Who is signed in, and Sign out: a plain button, always in view. */
32
+ function Account({ account }) {
33
+ return (_jsxs("div", { className: "hl-account", children: [_jsxs("div", { className: "hl-account__who", children: [_jsx("span", { "aria-hidden": "true", className: "hl-avatar", children: account.name.charAt(0).toUpperCase() }), _jsxs("span", { className: "hl-account__text", children: [_jsx("strong", { children: account.name }), account.detail && _jsx("span", { children: account.detail })] })] }), _jsx("button", { type: "button", className: "hl-signout", disabled: account.signingOut, onClick: account.onSignOut, children: "Sign out" })] }));
34
+ }
35
+ function SidebarBody(props) {
36
+ return (_jsxs(_Fragment, { children: [_jsx(Link, { to: "/", className: "hl-brand", children: props.brand }), _jsx(Nav, { groups: props.nav }), _jsxs("div", { className: "hl-sidebar__foot", children: [_jsxs("div", { className: "hl-theme-row", children: [_jsx("span", { children: "Theme" }), _jsx(ThemeSwitch, {})] }), _jsx(Account, { account: props.account })] })] }));
37
+ }
38
+ const FOCUSABLE = 'a[href], button:not([disabled]), input, select, textarea, [tabindex]:not([tabindex="-1"])';
39
+ /** The phone menu: a dialog that keeps focus inside, closes with Escape or on navigation. */
40
+ function MenuDrawer(props) {
41
+ const ref = useRef(null);
42
+ useEffect(() => {
43
+ ref.current?.querySelector(FOCUSABLE)?.focus();
44
+ }, []);
45
+ const onKeyDown = (event) => {
46
+ if (event.key === 'Escape') {
47
+ props.onClose();
48
+ return;
49
+ }
50
+ if (event.key !== 'Tab' || !ref.current)
51
+ return;
52
+ const items = [...ref.current.querySelectorAll(FOCUSABLE)];
53
+ const first = items[0];
54
+ const last = items[items.length - 1];
55
+ if (!first || !last)
56
+ return;
57
+ if (!event.shiftKey && document.activeElement === last) {
58
+ event.preventDefault();
59
+ first.focus();
60
+ }
61
+ else if (event.shiftKey && document.activeElement === first) {
62
+ event.preventDefault();
63
+ last.focus();
64
+ }
65
+ };
66
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: "hl-drawer-backdrop", onClick: props.onClose, "aria-hidden": "true" }), _jsx("div", { ref: ref, role: "dialog", "aria-modal": "true", "aria-label": "Menu", className: "hl-drawer", onKeyDown: onKeyDown, children: props.children })] }));
67
+ }
68
+ /**
69
+ * The dashboards' frame: the sidebar (brand, grouped pages, the theme switch, the account),
70
+ * a top bar (search and a status chip) and the page. On a phone the sidebar is a menu.
71
+ */
72
+ export function AppShell(props) {
73
+ const narrow = useNarrow();
74
+ const [menuOpen, setMenuOpen] = useState(false);
75
+ const menuButton = useRef(null);
76
+ const { pathname } = useLocation();
77
+ const closeMenu = useCallback(() => {
78
+ setMenuOpen(false);
79
+ menuButton.current?.focus();
80
+ }, []);
81
+ useEffect(() => {
82
+ setMenuOpen(false);
83
+ }, [pathname]);
84
+ const entries = useMemo(() => [
85
+ ...flattenNav(props.nav).map((item) => ({ label: item.label, to: item.to })),
86
+ ...(props.searchEntries ?? []),
87
+ ], [props.nav, props.searchEntries]);
88
+ const body = _jsx(SidebarBody, { brand: props.brand, nav: props.nav, account: props.account });
89
+ return (_jsxs("div", { className: "hl-shell", children: [_jsx("a", { className: "hl-skip", href: "#main", children: "Skip to the page" }), !narrow && _jsx("aside", { className: "hl-sidebar", children: body }), narrow && menuOpen && _jsx(MenuDrawer, { onClose: closeMenu, children: body }), _jsxs("div", { className: "hl-content", children: [_jsxs("header", { className: "hl-topbar", children: [narrow && (_jsx("button", { ref: menuButton, type: "button", className: "hl-menu-button", "aria-expanded": menuOpen, onClick: () => setMenuOpen(true), children: "Menu" })), _jsx(ShellSearch, { entries: entries }), props.statusChip && _jsx("div", { className: "hl-topbar__end", children: props.statusChip })] }), _jsx("div", { id: "main", className: "hl-main", tabIndex: -1, children: props.children })] })] }));
90
+ }
91
+ //# sourceMappingURL=AppShell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppShell.js","sourceRoot":"","sources":["../../src/shell/AppShell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAG/C,MAAM,MAAM,GAAG,oBAAoB,CAAC;AAEpC,qEAAqE;AACrE,SAAS,SAAS;IAChB,MAAM,KAAK,GAAG,GAA0B,EAAE,CACxC,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU;QACtE,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC;QAC3B,CAAC,CAAC,IAAI,CAAC;IACX,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE,OAAO,IAAI,KAAK,CAAC,CAAC;IACtE,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,IAAI,GAAG,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,IAAI;YAAE,OAAO;QAClB,MAAM,QAAQ,GAAG,GAAS,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrD,IAAI,CAA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AI,GAAS,EACvD,MAAM,IAAI,QAAQ,IAAI,KAAC,UAAU,IAAC,OAAO,EAAE,SAAS,YAAG,IAAI,GAAc,EAC1E,eAAK,SAAS,EAAC,YAAY,aACzB,kBAAQ,SAAS,EAAC,WAAW,aAC1B,MAAM,IAAI,CACT,iBACE,GAAG,EAAE,UAAU,EACf,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,gBAAgB,mBACX,QAAQ,EACvB,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,qBAGzB,CACV,EACD,KAAC,WAAW,IAAC,OAAO,EAAE,OAAO,GAAI,EAChC,KAAK,CAAC,UAAU,IAAI,cAAK,SAAS,EAAC,gBAAgB,YAAE,KAAK,CAAC,UAAU,GAAO,IACtE,EAET,cAAK,EAAE,EAAC,MAAM,EAAC,SAAS,EAAC,SAAS,EAAC,QAAQ,EAAE,CAAC,CAAC,YAC5C,KAAK,CAAC,QAAQ,GACX,IACF,IACF,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { ReactElement } from 'react';
2
+ /** A page the search can find: by its name or any of its keywords. */
3
+ export interface SearchEntry {
4
+ label: string;
5
+ to: string;
6
+ keywords?: string[];
7
+ }
8
+ /** The top bar's "Search pages": a combobox that goes to the page picked. */
9
+ export declare function ShellSearch({ entries }: {
10
+ entries: SearchEntry[];
11
+ }): ReactElement;
@@ -0,0 +1,55 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId, useMemo, useState } from 'react';
3
+ import { useNavigate } from 'react-router-dom';
4
+ const MAX_RESULTS = 8;
5
+ /** The top bar's "Search pages": a combobox that goes to the page picked. */
6
+ export function ShellSearch({ entries }) {
7
+ const navigate = useNavigate();
8
+ const listId = useId();
9
+ const [query, setQuery] = useState('');
10
+ const [active, setActive] = useState(0);
11
+ const [focused, setFocused] = useState(false);
12
+ const results = useMemo(() => {
13
+ const q = query.trim().toLowerCase();
14
+ if (!q)
15
+ return [];
16
+ return entries
17
+ .filter((e) => [e.label, ...(e.keywords ?? [])].some((text) => text.toLowerCase().includes(q)))
18
+ .slice(0, MAX_RESULTS);
19
+ }, [entries, query]);
20
+ const open = focused && query.trim() !== '';
21
+ const go = (entry) => {
22
+ if (!entry)
23
+ return;
24
+ setQuery('');
25
+ setActive(0);
26
+ navigate(entry.to);
27
+ };
28
+ const onKeyDown = (event) => {
29
+ if (event.key === 'ArrowDown' && results.length > 0) {
30
+ event.preventDefault();
31
+ setActive((i) => (i + 1) % results.length);
32
+ }
33
+ else if (event.key === 'ArrowUp' && results.length > 0) {
34
+ event.preventDefault();
35
+ setActive((i) => (i - 1 + results.length) % results.length);
36
+ }
37
+ else if (event.key === 'Enter') {
38
+ event.preventDefault();
39
+ go(results[active]);
40
+ }
41
+ else if (event.key === 'Escape') {
42
+ setQuery('');
43
+ setActive(0);
44
+ }
45
+ };
46
+ return (_jsxs("div", { className: "hl-search", children: [_jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", "aria-hidden": "true", children: [_jsx("circle", { cx: "11", cy: "11", r: "7" }), _jsx("path", { d: "M20 20l-3.5-3.5" })] }), _jsx("input", { type: "search", role: "combobox", "aria-label": "Search pages", "aria-expanded": open, "aria-controls": listId, "aria-autocomplete": "list", "aria-activedescendant": open && results[active] ? `${listId}-${String(active)}` : undefined, placeholder: "Search pages\u2026", value: query, onChange: (e) => {
47
+ setQuery(e.target.value);
48
+ setActive(0);
49
+ setFocused(true);
50
+ }, onKeyDown: onKeyDown, onFocus: () => setFocused(true), onBlur: () => setFocused(false) }), open && (_jsx("ul", { id: listId, role: "listbox", "aria-label": "Pages", className: "hl-search__list", children: results.length === 0 ? (_jsx("li", { role: "option", "aria-disabled": "true", "aria-selected": false, className: "hl-search__empty", children: "No pages match" })) : (results.map((entry, i) => (_jsx("li", { id: `${listId}-${String(i)}`, role: "option", "aria-selected": i === active, onMouseDown: (e) => {
51
+ e.preventDefault();
52
+ go(entry);
53
+ }, children: entry.label }, entry.to)))) }))] }));
54
+ }
55
+ //# sourceMappingURL=ShellSearch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShellSearch.js","sourceRoot":"","sources":["../../src/shell/ShellSearch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAS/C,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,6EAA6E;AAC7E,MAAM,UAAU,WAAW,CAAC,EAAE,OAAO,EAA8B;IACjE,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,MAAM,GAAG,KAAK,EAAE,CAAC;IACvB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACvC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACxC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE;QAC3B,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACrC,IAAI,CAAC,CAAC;YAAE,OAAO,EAAE,CAAC;QAClB,OAAO,OAAO;aACX,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CACZ,CAAC,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAChF;aACA,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;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+BAGzB,CACN,CAAC,CAAC,CAAC,CACF,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CACxB,aAEE,EAAE,EAAE,GAAG,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,EAC5B,IAAI,EAAC,QAAQ,mBACE,CAAC,KAAK,MAAM,EAC3B,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE;wBACjB,CAAC,CAAC,cAAc,EAAE,CAAC;wBACnB,EAAE,CAAC,KAAK,CAAC,CAAC;oBACZ,CAAC,YAEA,KAAK,CAAC,KAAK,IATP,KAAK,CAAC,EAAE,CAUV,CACN,CAAC,CACH,GACE,CACN,IACG,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { ReactNode } from 'react';
2
+ /** A page in the sidebar; one with `children` shows them while it or a child is open. */
3
+ export interface NavItem {
4
+ label: string;
5
+ to: string;
6
+ icon?: ReactNode;
7
+ children?: NavItem[];
8
+ }
9
+ /** A group of pages under an optional small heading. */
10
+ export interface NavGroup {
11
+ label?: string;
12
+ items: NavItem[];
13
+ }
14
+ /** Every page in the nav, nested ones included, in order. */
15
+ export declare function flattenNav(groups: NavGroup[]): NavItem[];
16
+ /** Whether `pathname` is `to` or a page under it. */
17
+ export declare const isUnder: (pathname: string, to: string) => boolean;
@@ -0,0 +1,17 @@
1
+ /** Every page in the nav, nested ones included, in order. */
2
+ export function flattenNav(groups) {
3
+ const out = [];
4
+ const walk = (items) => {
5
+ for (const item of items) {
6
+ out.push(item);
7
+ if (item.children)
8
+ walk(item.children);
9
+ }
10
+ };
11
+ for (const group of groups)
12
+ walk(group.items);
13
+ return out;
14
+ }
15
+ /** Whether `pathname` is `to` or a page under it. */
16
+ export const isUnder = (pathname, to) => pathname === to || pathname.startsWith(`${to}/`);
17
+ //# sourceMappingURL=nav.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nav.js","sourceRoot":"","sources":["../../src/shell/nav.ts"],"names":[],"mappings":"AAgBA,6DAA6D;AAC7D,MAAM,UAAU,UAAU,CAAC,MAAkB;IAC3C,MAAM,GAAG,GAAc,EAAE,CAAC;IAC1B,MAAM,IAAI,GAAG,CAAC,KAAgB,EAAQ,EAAE;QACtC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACf,IAAI,IAAI,CAAC,QAAQ;gBAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACzC,CAAC;IACH,CAAC,CAAC;IACF,KAAK,MAAM,KAAK,IAAI,MAAM;QAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC9C,OAAO,GAAG,CAAC;AACb,CAAC;AAED,qDAAqD;AACrD,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,QAAgB,EAAE,EAAU,EAAW,EAAE,CAC/D,QAAQ,KAAK,EAAE,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ /** The app shell's look, on the theme tokens only (see tokens.ts). */
2
+ export declare const SHELL_CSS = "\n.hl-shell { min-height: 100vh; display: flex; background: var(--hl-ground); color: var(--hl-text); }\n.hl-skip { position: absolute; left: -9999px; top: 8px; z-index: 30; padding: 10px 16px; border-radius: var(--hl-radius-control); background: var(--hl-accent); color: #FFFFFF; font-weight: 700; }\n.hl-skip:focus { left: 8px; }\n.hl-sidebar { width: 264px; flex: none; box-sizing: border-box; display: flex; flex-direction: column; gap: 6px; padding: 20px 14px; background: var(--hl-sidebar); border-right: 1px solid var(--hl-border); position: sticky; top: 0; height: 100vh; overflow-y: auto; }\n.hl-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; color: var(--hl-text); text-decoration: none; }\n.hl-nav { display: flex; flex-direction: column; gap: 2px; }\n.hl-nav__group { margin: 18px 12px 6px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--hl-muted); }\n.hl-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }\n.hl-nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: var(--hl-radius-control); color: var(--hl-text); text-decoration: none; font-weight: 600; }\n.hl-nav a:hover { background: var(--hl-faint); }\n.hl-nav a[aria-current=\"page\"] { background: var(--hl-accent-soft); color: var(--hl-accent-text); font-weight: 700; }\n.hl-nav ul ul a { min-height: 40px; padding-left: 42px; font-weight: 500; color: var(--hl-muted); }\n.hl-nav ul ul a[aria-current=\"page\"] { color: var(--hl-accent-text); }\n.hl-sidebar__foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding-top: 20px; border-top: 1px solid var(--hl-border); }\n.hl-theme-row { display: flex; align-items: center; justify-content: space-between; padding: 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--hl-muted); }\n.hl-theme-switch { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--hl-faint); }\n.hl-shell .hl-theme-switch button { width: 34px; height: 30px; min-height: 30px; padding: 0; box-sizing: border-box; border: 0; border-radius: 999px; display: grid; place-items: center; background: transparent; color: var(--hl-muted); cursor: pointer; }\n.hl-shell .hl-theme-switch button:hover:not(:disabled) { background: var(--hl-surface); border-color: transparent; color: var(--hl-text); }\n.hl-shell .hl-theme-switch button[aria-pressed=\"true\"], .hl-shell .hl-theme-switch button[aria-pressed=\"true\"]:hover:not(:disabled) { background: var(--hl-accent); border-color: var(--hl-accent); color: var(--hl-on-accent); }\n.hl-account { display: flex; flex-direction: column; gap: 8px; padding: 0 4px; }\n.hl-account__who { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }\n.hl-avatar { width: 36px; height: 36px; flex: none; border-radius: 999px; display: grid; place-items: center; background: var(--hl-accent); color: var(--hl-on-accent); font-weight: 700; }\n.hl-account__text { display: flex; flex-direction: column; min-width: 0; }\n.hl-account__text span { font-size: 13px; color: var(--hl-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.hl-shell button.hl-signout { min-height: 40px; padding: 0 12px; border-radius: var(--hl-radius-control); border: 1px solid var(--hl-border); background: transparent; color: var(--hl-text); font: inherit; font-weight: 600; cursor: pointer; }\n.hl-shell button.hl-signout:hover:not(:disabled) { background: var(--hl-faint); border-color: var(--hl-border); color: var(--hl-text); }\n.hl-shell button.hl-signout:disabled { background: transparent; border-color: var(--hl-border); color: var(--hl-muted); opacity: .7; cursor: default; }\n.hl-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }\n.hl-topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 32px; border-bottom: 1px solid var(--hl-border); background: var(--hl-ground); position: sticky; top: 0; z-index: 10; }\n.hl-search { position: relative; flex: 1 1 280px; max-width: 520px; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--hl-border); background: var(--hl-surface); color: var(--hl-muted); box-sizing: border-box; }\n.hl-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--hl-text); font: inherit; }\n.hl-search:focus-within { border-color: var(--hl-accent); }\n.hl-search__list { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20; list-style: none; margin: 0; padding: 6px; border-radius: var(--hl-radius-control); border: 1px solid var(--hl-border); background: var(--hl-surface); box-shadow: 0 12px 30px rgba(0,0,0,.18); }\n.hl-search__list li { padding: 10px 12px; border-radius: 8px; color: var(--hl-text); cursor: pointer; }\n.hl-search__list li[aria-selected=\"true\"] { background: var(--hl-accent-soft); color: var(--hl-accent-text); }\n.hl-search__list .hl-search__empty { color: var(--hl-muted); cursor: default; }\n.hl-topbar__end { margin-left: auto; display: flex; align-items: center; gap: 10px; }\n.hl-shell button.hl-menu-button { min-height: 44px; padding: 0 14px; border-radius: var(--hl-radius-control); border: 1px solid var(--hl-border); background: var(--hl-surface); color: var(--hl-text); font: inherit; font-weight: 700; cursor: pointer; }\n.hl-shell button.hl-menu-button:hover:not(:disabled) { background: var(--hl-faint); border-color: var(--hl-border); color: var(--hl-text); }\n.hl-main { padding: 32px; width: 100%; max-width: 1180px; box-sizing: border-box; }\n.hl-drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.45); }\n.hl-drawer { position: fixed; inset: 0 auto 0 0; z-index: 41; width: min(300px, 86vw); display: flex; flex-direction: column; gap: 6px; padding: 16px 14px; background: var(--hl-sidebar); overflow-y: auto; }\n@media (max-width: 899px) {\n .hl-topbar { padding: 12px 16px; }\n .hl-main { padding: 20px 16px; }\n}\n";
@@ -0,0 +1,50 @@
1
+ /** The app shell's look, on the theme tokens only (see tokens.ts). */
2
+ export const SHELL_CSS = `
3
+ .hl-shell { min-height: 100vh; display: flex; background: var(--hl-ground); color: var(--hl-text); }
4
+ .hl-skip { position: absolute; left: -9999px; top: 8px; z-index: 30; padding: 10px 16px; border-radius: var(--hl-radius-control); background: var(--hl-accent); color: #FFFFFF; font-weight: 700; }
5
+ .hl-skip:focus { left: 8px; }
6
+ .hl-sidebar { width: 264px; flex: none; box-sizing: border-box; display: flex; flex-direction: column; gap: 6px; padding: 20px 14px; background: var(--hl-sidebar); border-right: 1px solid var(--hl-border); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
7
+ .hl-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; color: var(--hl-text); text-decoration: none; }
8
+ .hl-nav { display: flex; flex-direction: column; gap: 2px; }
9
+ .hl-nav__group { margin: 18px 12px 6px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--hl-muted); }
10
+ .hl-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
11
+ .hl-nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: var(--hl-radius-control); color: var(--hl-text); text-decoration: none; font-weight: 600; }
12
+ .hl-nav a:hover { background: var(--hl-faint); }
13
+ .hl-nav a[aria-current="page"] { background: var(--hl-accent-soft); color: var(--hl-accent-text); font-weight: 700; }
14
+ .hl-nav ul ul a { min-height: 40px; padding-left: 42px; font-weight: 500; color: var(--hl-muted); }
15
+ .hl-nav ul ul a[aria-current="page"] { color: var(--hl-accent-text); }
16
+ .hl-sidebar__foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding-top: 20px; border-top: 1px solid var(--hl-border); }
17
+ .hl-theme-row { display: flex; align-items: center; justify-content: space-between; padding: 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--hl-muted); }
18
+ .hl-theme-switch { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--hl-faint); }
19
+ .hl-shell .hl-theme-switch button { width: 34px; height: 30px; min-height: 30px; padding: 0; box-sizing: border-box; border: 0; border-radius: 999px; display: grid; place-items: center; background: transparent; color: var(--hl-muted); cursor: pointer; }
20
+ .hl-shell .hl-theme-switch button:hover:not(:disabled) { background: var(--hl-surface); border-color: transparent; color: var(--hl-text); }
21
+ .hl-shell .hl-theme-switch button[aria-pressed="true"], .hl-shell .hl-theme-switch button[aria-pressed="true"]:hover:not(:disabled) { background: var(--hl-accent); border-color: var(--hl-accent); color: var(--hl-on-accent); }
22
+ .hl-account { display: flex; flex-direction: column; gap: 8px; padding: 0 4px; }
23
+ .hl-account__who { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
24
+ .hl-avatar { width: 36px; height: 36px; flex: none; border-radius: 999px; display: grid; place-items: center; background: var(--hl-accent); color: var(--hl-on-accent); font-weight: 700; }
25
+ .hl-account__text { display: flex; flex-direction: column; min-width: 0; }
26
+ .hl-account__text span { font-size: 13px; color: var(--hl-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
27
+ .hl-shell button.hl-signout { min-height: 40px; padding: 0 12px; border-radius: var(--hl-radius-control); border: 1px solid var(--hl-border); background: transparent; color: var(--hl-text); font: inherit; font-weight: 600; cursor: pointer; }
28
+ .hl-shell button.hl-signout:hover:not(:disabled) { background: var(--hl-faint); border-color: var(--hl-border); color: var(--hl-text); }
29
+ .hl-shell button.hl-signout:disabled { background: transparent; border-color: var(--hl-border); color: var(--hl-muted); opacity: .7; cursor: default; }
30
+ .hl-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
31
+ .hl-topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 32px; border-bottom: 1px solid var(--hl-border); background: var(--hl-ground); position: sticky; top: 0; z-index: 10; }
32
+ .hl-search { position: relative; flex: 1 1 280px; max-width: 520px; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--hl-border); background: var(--hl-surface); color: var(--hl-muted); box-sizing: border-box; }
33
+ .hl-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--hl-text); font: inherit; }
34
+ .hl-search:focus-within { border-color: var(--hl-accent); }
35
+ .hl-search__list { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20; list-style: none; margin: 0; padding: 6px; border-radius: var(--hl-radius-control); border: 1px solid var(--hl-border); background: var(--hl-surface); box-shadow: 0 12px 30px rgba(0,0,0,.18); }
36
+ .hl-search__list li { padding: 10px 12px; border-radius: 8px; color: var(--hl-text); cursor: pointer; }
37
+ .hl-search__list li[aria-selected="true"] { background: var(--hl-accent-soft); color: var(--hl-accent-text); }
38
+ .hl-search__list .hl-search__empty { color: var(--hl-muted); cursor: default; }
39
+ .hl-topbar__end { margin-left: auto; display: flex; align-items: center; gap: 10px; }
40
+ .hl-shell button.hl-menu-button { min-height: 44px; padding: 0 14px; border-radius: var(--hl-radius-control); border: 1px solid var(--hl-border); background: var(--hl-surface); color: var(--hl-text); font: inherit; font-weight: 700; cursor: pointer; }
41
+ .hl-shell button.hl-menu-button:hover:not(:disabled) { background: var(--hl-faint); border-color: var(--hl-border); color: var(--hl-text); }
42
+ .hl-main { padding: 32px; width: 100%; max-width: 1180px; box-sizing: border-box; }
43
+ .hl-drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.45); }
44
+ .hl-drawer { position: fixed; inset: 0 auto 0 0; z-index: 41; width: min(300px, 86vw); display: flex; flex-direction: column; gap: 6px; padding: 16px 14px; background: var(--hl-sidebar); overflow-y: auto; }
45
+ @media (max-width: 899px) {
46
+ .hl-topbar { padding: 12px 16px; }
47
+ .hl-main { padding: 20px 16px; }
48
+ }
49
+ `;
50
+ //# sourceMappingURL=shell-css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell-css.js","sourceRoot":"","sources":["../../src/shell/shell-css.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+CxB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { ReactElement } from 'react';
2
+ import type { AccentColors, AccentPreset } from './tokens.js';
3
+ /** The dashboard look as one `<style>`: render it once, at the top of the app. */
4
+ export declare function ThemeStyles({ accent }: {
5
+ accent: AccentPreset | AccentColors;
6
+ }): ReactElement;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { USAGE_CSS } from '../client/usage-css.js';
3
+ import { LAYOUT_CSS } from '../layout/layout-css.js';
4
+ import { SHELL_CSS } from '../shell/shell-css.js';
5
+ import { themeCss } from './tokens.js';
6
+ /** The dashboard look as one `<style>`: render it once, at the top of the app. */
7
+ export function ThemeStyles({ accent }) {
8
+ return _jsx("style", { children: themeCss(accent) + SHELL_CSS + LAYOUT_CSS + USAGE_CSS });
9
+ }
10
+ //# sourceMappingURL=ThemeStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeStyles.js","sourceRoot":"","sources":["../../src/theme/ThemeStyles.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,kFAAkF;AAClF,MAAM,UAAU,WAAW,CAAC,EAAE,MAAM,EAA2C;IAC7E,OAAO,0BAAQ,QAAQ,CAAC,MAAM,CAAC,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAS,CAAC;AAChF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ReactElement } from 'react';
2
+ /** System, dark or light: the choice is remembered in this browser. */
3
+ export declare function ThemeSwitch(): ReactElement;
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useTheme } from './theme-choice.js';
3
+ const ICON = {
4
+ width: 16,
5
+ height: 16,
6
+ viewBox: '0 0 24 24',
7
+ fill: 'none',
8
+ stroke: 'currentColor',
9
+ strokeWidth: 2,
10
+ 'aria-hidden': true,
11
+ };
12
+ const OPTIONS = [
13
+ {
14
+ choice: 'system',
15
+ label: 'System theme',
16
+ icon: (_jsxs("svg", { ...ICON, children: [_jsx("rect", { x: "3", y: "4", width: "18", height: "12", rx: "2" }), _jsx("path", { d: "M8 20h8M12 16v4" })] })),
17
+ },
18
+ {
19
+ choice: 'dark',
20
+ label: 'Dark theme',
21
+ icon: (_jsx("svg", { ...ICON, children: _jsx("path", { d: "M20 14.5A8 8 0 0 1 9.5 4 8 8 0 1 0 20 14.5z" }) })),
22
+ },
23
+ {
24
+ choice: 'light',
25
+ label: 'Light theme',
26
+ icon: (_jsxs("svg", { ...ICON, children: [_jsx("circle", { cx: "12", cy: "12", r: "4" }), _jsx("path", { d: "M12 2v2M12 20v2M2 12h2M20 12h2M5 5l1.5 1.5M17.5 17.5L19 19M5 19l1.5-1.5M17.5 6.5L19 5" })] })),
27
+ },
28
+ ];
29
+ /** System, dark or light: the choice is remembered in this browser. */
30
+ export function ThemeSwitch() {
31
+ const { choice, setChoice } = useTheme();
32
+ return (_jsx("div", { role: "group", "aria-label": "Theme", className: "hl-theme-switch", children: OPTIONS.map((option) => (_jsx("button", { type: "button", "aria-label": option.label, "aria-pressed": choice === option.choice, onClick: () => setChoice(option.choice), children: option.icon }, option.choice))) }));
33
+ }
34
+ //# sourceMappingURL=ThemeSwitch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeSwitch.js","sourceRoot":"","sources":["../../src/theme/ThemeSwitch.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,MAAM,IAAI,GAAG;IACX,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,WAAW;IACpB,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,cAAc;IACtB,WAAW,EAAE,CAAC;IACd,aAAa,EAAE,IAAI;CACX,CAAC;AAEX,MAAM,OAAO,GAAiE;IAC5E;QACE,MAAM,EAAE,QAAQ;QAChB,KAAK,EAAE,cAAc;QACrB,IAAI,EAAE,CACJ,kBAAS,IAAI,aACX,eAAM,CAAC,EAAC,GAAG,EAAC,CAAC,EAAC,GAAG,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,EAAE,EAAC,GAAG,GAAG,EAClD,eAAM,CAAC,EAAC,iBAAiB,GAAG,IACxB,CACP;KACF;IACD;QACE,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,CACJ,iBAAS,IAAI,YACX,eAAM,CAAC,EAAC,6CAA6C,GAAG,GACpD,CACP;KACF;IACD;QACE,MAAM,EAAE,OAAO;QACf,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,CACJ,kBAAS,IAAI,aACX,iBAAQ,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,CAAC,EAAC,GAAG,GAAG,EAChC,eAAM,CAAC,EAAC,uFAAuF,GAAG,IAC9F,CACP;KACF;CACF,CAAC;AAEF,uEAAuE;AACvE,MAAM,UAAU,WAAW;IACzB,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,QAAQ,EAAE,CAAC;IACzC,OAAO,CACL,cAAK,IAAI,EAAC,OAAO,gBAAY,OAAO,EAAC,SAAS,EAAC,iBAAiB,YAC7D,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACvB,iBAEE,IAAI,EAAC,QAAQ,gBACD,MAAM,CAAC,KAAK,kBACV,MAAM,KAAK,MAAM,CAAC,MAAM,EACtC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,YAEtC,MAAM,CAAC,IAAI,IANP,MAAM,CAAC,MAAM,CAOX,CACV,CAAC,GACE,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ /** The WCAG contrast ratio of two `#RRGGBB` colours: 1 (none) to 21 (black on white). */
2
+ export declare function contrastRatio(a: string, b: string): number;
@@ -0,0 +1,13 @@
1
+ /** A `#RRGGBB` colour's relative luminance (WCAG 2). */
2
+ function luminance(hex) {
3
+ const value = hex.replace('#', '');
4
+ const channels = [0, 2, 4].map((i) => Number.parseInt(value.slice(i, i + 2), 16) / 255);
5
+ const [r, g, b] = channels.map((c) => c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4);
6
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b;
7
+ }
8
+ /** The WCAG contrast ratio of two `#RRGGBB` colours: 1 (none) to 21 (black on white). */
9
+ export function contrastRatio(a, b) {
10
+ const [light, dark] = [luminance(a), luminance(b)].sort((x, y) => y - x);
11
+ return (light + 0.05) / (dark + 0.05);
12
+ }
13
+ //# sourceMappingURL=contrast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contrast.js","sourceRoot":"","sources":["../../src/theme/contrast.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,SAAS,SAAS,CAAC,GAAW;IAC5B,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACnC,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC;IACxF,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACnC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,GAAG,CAC5B,CAAC;IAC9B,OAAO,MAAM,GAAG,CAAC,GAAG,MAAM,GAAG,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC;AAC9C,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,aAAa,CAAC,CAAS,EAAE,CAAS;IAChD,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAqB,CAAC;IAC7F,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,22 @@
1
+ /** What the person chose: a theme, or to follow the computer's setting. */
2
+ export type ThemeChoice = 'light' | 'dark' | 'system';
3
+ export declare const THEME_STORAGE_KEY = "haatlabs:theme";
4
+ /** The stored choice; anything missing, unknown or unreadable follows the system. */
5
+ export declare function readThemeChoice(store?: Pick<Storage, 'getItem'> | null): ThemeChoice;
6
+ /** `<html data-theme>`: set for light or dark; absent, the CSS follows the system. */
7
+ export declare function applyThemeChoice(choice: ThemeChoice, root?: HTMLElement): void;
8
+ /**
9
+ * The choice, the theme it comes to, and a way to change it (stored when the browser lets us).
10
+ * Every switch on the page reads the same choice, the one applied to `<html>`.
11
+ */
12
+ export declare function useTheme(): {
13
+ choice: ThemeChoice;
14
+ resolved: 'light' | 'dark';
15
+ setChoice: (choice: ThemeChoice) => void;
16
+ };
17
+ /**
18
+ * The same read-and-apply as a plain script, for `public/theme-boot.js`: loaded in `<head>`
19
+ * before the page's own script, so a dark page never flashes light. (The pages' CSP forbids
20
+ * inline scripts, so it is a file.)
21
+ */
22
+ export declare const THEME_BOOT_SCRIPT = "(function () {\n try {\n var choice = window.localStorage.getItem('haatlabs:theme');\n if (choice === 'light' || choice === 'dark') document.documentElement.setAttribute('data-theme', choice);\n } catch {}\n})();";
@@ -0,0 +1,98 @@
1
+ import { useCallback, useEffect, useState, useSyncExternalStore } from 'react';
2
+ export const THEME_STORAGE_KEY = 'haatlabs:theme';
3
+ const CHOICES = ['light', 'dark', 'system'];
4
+ /** The browser's storage, or null where reading it throws (blocked site data, some private windows). */
5
+ function storage() {
6
+ try {
7
+ return typeof window === 'undefined' ? null : window.localStorage;
8
+ }
9
+ catch {
10
+ return null;
11
+ }
12
+ }
13
+ /** The stored choice; anything missing, unknown or unreadable follows the system. */
14
+ export function readThemeChoice(store = storage()) {
15
+ try {
16
+ const value = store?.getItem(THEME_STORAGE_KEY) ?? null;
17
+ return value && CHOICES.includes(value) ? value : 'system';
18
+ }
19
+ catch {
20
+ return 'system';
21
+ }
22
+ }
23
+ /** `<html data-theme>`: set for light or dark; absent, the CSS follows the system. */
24
+ export function applyThemeChoice(choice, root = document.documentElement) {
25
+ if (choice === 'system')
26
+ root.removeAttribute('data-theme');
27
+ else
28
+ root.setAttribute('data-theme', choice);
29
+ }
30
+ const DARK_QUERY = '(prefers-color-scheme: dark)';
31
+ const systemIsDark = () => typeof window !== 'undefined' && typeof window.matchMedia === 'function'
32
+ ? window.matchMedia(DARK_QUERY).matches
33
+ : false;
34
+ const listeners = new Set();
35
+ const notify = () => {
36
+ for (const listener of listeners)
37
+ listener();
38
+ };
39
+ /** The choice in force: what is on `<html>`, else what is stored (else the system's). */
40
+ function currentChoice() {
41
+ const applied = document.documentElement.getAttribute('data-theme');
42
+ return applied === 'light' || applied === 'dark' ? applied : readThemeChoice();
43
+ }
44
+ function subscribe(listener) {
45
+ listeners.add(listener);
46
+ // Another tab changed it: apply it here too.
47
+ const onStorage = (event) => {
48
+ if (event.key !== THEME_STORAGE_KEY)
49
+ return;
50
+ applyThemeChoice(readThemeChoice());
51
+ notify();
52
+ };
53
+ window.addEventListener('storage', onStorage);
54
+ return () => {
55
+ listeners.delete(listener);
56
+ window.removeEventListener('storage', onStorage);
57
+ };
58
+ }
59
+ /**
60
+ * The choice, the theme it comes to, and a way to change it (stored when the browser lets us).
61
+ * Every switch on the page reads the same choice, the one applied to `<html>`.
62
+ */
63
+ export function useTheme() {
64
+ const choice = useSyncExternalStore(subscribe, currentChoice, () => 'system');
65
+ const [systemDark, setSystemDark] = useState(systemIsDark);
66
+ useEffect(() => {
67
+ if (typeof window.matchMedia !== 'function')
68
+ return;
69
+ const query = window.matchMedia(DARK_QUERY);
70
+ const onChange = () => setSystemDark(query.matches);
71
+ query.addEventListener('change', onChange);
72
+ return () => query.removeEventListener('change', onChange);
73
+ }, []);
74
+ const setChoice = useCallback((next) => {
75
+ applyThemeChoice(next);
76
+ try {
77
+ storage()?.setItem(THEME_STORAGE_KEY, next);
78
+ }
79
+ catch {
80
+ // Not stored: the choice holds for this page only.
81
+ }
82
+ notify();
83
+ }, []);
84
+ const resolved = choice === 'system' ? (systemDark ? 'dark' : 'light') : choice;
85
+ return { choice, resolved, setChoice };
86
+ }
87
+ /**
88
+ * The same read-and-apply as a plain script, for `public/theme-boot.js`: loaded in `<head>`
89
+ * before the page's own script, so a dark page never flashes light. (The pages' CSP forbids
90
+ * inline scripts, so it is a file.)
91
+ */
92
+ export const THEME_BOOT_SCRIPT = `(function () {
93
+ try {
94
+ var choice = window.localStorage.getItem('${THEME_STORAGE_KEY}');
95
+ if (choice === 'light' || choice === 'dark') document.documentElement.setAttribute('data-theme', choice);
96
+ } catch {}
97
+ })();`;
98
+ //# sourceMappingURL=theme-choice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-choice.js","sourceRoot":"","sources":["../../src/theme/theme-choice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAK/E,MAAM,CAAC,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;AAClD,MAAM,OAAO,GAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AAE/D,wGAAwG;AACxG,SAAS,OAAO;IACd,IAAI,CAAC;QACH,OAAO,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;IACpE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,eAAe,CAAC,QAAyC,OAAO,EAAE;IAChF,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,KAAK,EAAE,OAAO,CAAC,iBAAiB,CAAC,IAAI,IAAI,CAAC;QACxD,OAAO,KAAK,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAE,KAAqB,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC9E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAC;IACl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C,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAChF,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;;gDAEe,iBAAiB;;;MAG3D,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The dashboards' look: neutral colours for light and dark, and one accent per product.
3
+ * Every value is checked for contrast in `tokens.test.ts`.
4
+ */
5
+ /** The four products' accents: the console, Catalogpix, Catalogscout and MarginLedger. */
6
+ export type AccentPreset = 'indigo' | 'coral' | 'teal' | 'green';
7
+ export interface AccentColors {
8
+ /** Buttons and fills; white text sits on it. */
9
+ solid: string;
10
+ /** Links and active text on the light theme's grounds. */
11
+ textLight: string;
12
+ /** Links and active text on the dark theme's grounds. */
13
+ textDark: string;
14
+ /** A tinted fill (the active nav item, a key chip) in the light theme. */
15
+ softLight: string;
16
+ /** The same in the dark theme. */
17
+ softDark: string;
18
+ }
19
+ export declare const ACCENTS: Readonly<Record<AccentPreset, AccentColors>>;
20
+ export interface Neutrals {
21
+ ground: string;
22
+ sidebar: string;
23
+ surface: string;
24
+ border: string;
25
+ text: string;
26
+ muted: string;
27
+ faint: string;
28
+ amberBg: string;
29
+ amberBorder: string;
30
+ amberText: string;
31
+ /** Error text. */
32
+ danger: string;
33
+ }
34
+ export declare const NEUTRALS: Readonly<{
35
+ light: Neutrals;
36
+ dark: Neutrals;
37
+ }>;
38
+ /**
39
+ * The tokens as CSS: light by default, dark when `<html data-theme="dark">` or, with no
40
+ * choice made, when the system is dark; then the base rules every dashboard shares.
41
+ */
42
+ export declare function themeCss(accent: AccentPreset | AccentColors): string;