@haatlabs-core/ui 0.19.0 → 0.22.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.
- package/README.md +14 -3
- package/dist/client/LoginPage.d.ts +8 -2
- package/dist/client/LoginPage.js +24 -4
- package/dist/client/LoginPage.js.map +1 -1
- package/dist/client/UsagePage.d.ts +10 -1
- package/dist/client/UsagePage.js +44 -14
- package/dist/client/UsagePage.js.map +1 -1
- package/dist/client/index.d.ts +13 -1
- package/dist/client/index.js +11 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/sign-in-styles.d.ts +1 -1
- package/dist/client/sign-in-styles.js +6 -0
- package/dist/client/sign-in-styles.js.map +1 -1
- package/dist/client/usage-css.d.ts +1 -1
- package/dist/client/usage-css.js +5 -0
- package/dist/client/usage-css.js.map +1 -1
- package/dist/index.d.ts +9 -3
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/notifications/NotificationBell.d.ts +12 -0
- package/dist/notifications/NotificationBell.js +94 -0
- package/dist/notifications/NotificationBell.js.map +1 -0
- package/dist/notifications/NotificationInbox.d.ts +23 -0
- package/dist/notifications/NotificationInbox.js +92 -0
- package/dist/notifications/NotificationInbox.js.map +1 -0
- package/dist/notifications/NotificationPreferences.d.ts +10 -0
- package/dist/notifications/NotificationPreferences.js +135 -0
- package/dist/notifications/NotificationPreferences.js.map +1 -0
- package/dist/notifications/notifications-css.d.ts +6 -0
- package/dist/notifications/notifications-css.js +62 -0
- package/dist/notifications/notifications-css.js.map +1 -0
- package/dist/notifications/types.d.ts +80 -0
- package/dist/notifications/types.js +12 -0
- package/dist/notifications/types.js.map +1 -0
- package/dist/notifications/use-notification-stream.d.ts +15 -0
- package/dist/notifications/use-notification-stream.js +123 -0
- package/dist/notifications/use-notification-stream.js.map +1 -0
- package/dist/shell/Account.d.ts +24 -0
- package/dist/shell/Account.js +48 -0
- package/dist/shell/Account.js.map +1 -0
- package/dist/shell/AppShell.d.ts +13 -7
- package/dist/shell/AppShell.js +139 -65
- package/dist/shell/AppShell.js.map +1 -1
- package/dist/shell/BottomNav.d.ts +34 -0
- package/dist/shell/BottomNav.js +40 -0
- package/dist/shell/BottomNav.js.map +1 -0
- package/dist/shell/MoreSheet.d.ts +21 -0
- package/dist/shell/MoreSheet.js +46 -0
- package/dist/shell/MoreSheet.js.map +1 -0
- package/dist/shell/ShellSearch.d.ts +6 -2
- package/dist/shell/ShellSearch.js +3 -3
- package/dist/shell/ShellSearch.js.map +1 -1
- package/dist/shell/ShortcutsDialog.d.ts +11 -0
- package/dist/shell/ShortcutsDialog.js +26 -0
- package/dist/shell/ShortcutsDialog.js.map +1 -0
- package/dist/shell/bottom-nav-css.d.ts +6 -0
- package/dist/shell/bottom-nav-css.js +40 -0
- package/dist/shell/bottom-nav-css.js.map +1 -0
- package/dist/shell/breakpoint.d.ts +12 -0
- package/dist/shell/breakpoint.js +29 -0
- package/dist/shell/breakpoint.js.map +1 -0
- package/dist/shell/focus-trap.d.ts +9 -0
- package/dist/shell/focus-trap.js +35 -0
- package/dist/shell/focus-trap.js.map +1 -0
- package/dist/shell/icons.d.ts +23 -0
- package/dist/shell/icons.js +21 -0
- package/dist/shell/icons.js.map +1 -0
- package/dist/shell/nav.d.ts +22 -0
- package/dist/shell/nav.js +22 -0
- package/dist/shell/nav.js.map +1 -1
- package/dist/shell/shell-css.d.ts +1 -1
- package/dist/shell/shell-css.js +67 -16
- package/dist/shell/shell-css.js.map +1 -1
- package/dist/shell/shortcuts.d.ts +22 -0
- package/dist/shell/shortcuts.js +48 -0
- package/dist/shell/shortcuts.js.map +1 -0
- package/dist/shell/sidebar-state.d.ts +5 -0
- package/dist/shell/sidebar-state.js +38 -0
- package/dist/shell/sidebar-state.js.map +1 -0
- package/dist/theme/ThemeStyles.js +2 -1
- package/dist/theme/ThemeStyles.js.map +1 -1
- package/dist/theme/ThemeSwitch.d.ts +12 -2
- package/dist/theme/ThemeSwitch.js +19 -3
- package/dist/theme/ThemeSwitch.js.map +1 -1
- package/dist/theme/tokens.d.ts +7 -2
- package/dist/theme/tokens.js +24 -1
- package/dist/theme/tokens.js.map +1 -1
- package/package.json +4 -4
package/dist/shell/shell-css.js
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
|
+
import { BOTTOM_NAV_CSS } from './bottom-nav-css.js';
|
|
2
|
+
import { NARROW_BREAKPOINT } from './breakpoint.js';
|
|
1
3
|
/** The app shell's look, on the theme tokens only (see tokens.ts). */
|
|
2
4
|
export const SHELL_CSS = `
|
|
3
5
|
.hl-shell { min-height: 100vh; display: flex; background: var(--hl-ground); color: var(--hl-text); }
|
|
4
6
|
.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
7
|
.hl-skip:focus { left: 8px; }
|
|
6
|
-
.hl-sidebar { width:
|
|
7
|
-
.hl-
|
|
8
|
+
.hl-sidebar { width: 260px; flex: none; box-sizing: border-box; display: flex; flex-direction: column; gap: 4px; padding: 14px 12px; background: var(--hl-sidebar); border-right: 1px solid var(--hl-border); position: sticky; top: 0; z-index: 20; height: 100vh; overflow-y: auto; transition: width .2s ease, padding .2s ease; }
|
|
9
|
+
.hl-sidebar[data-collapsed] { width: 72px; padding: 14px 10px; align-items: center; overflow: visible; }
|
|
10
|
+
@media (prefers-reduced-motion: reduce) { .hl-sidebar { transition: none; } }
|
|
11
|
+
.hl-brand-row { display: flex; align-items: center; gap: 6px; padding: 0 0 12px; }
|
|
12
|
+
.hl-sidebar[data-collapsed] .hl-brand-row { flex-direction: column; gap: 8px; }
|
|
13
|
+
.hl-brand { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 4px 6px; font-size: 15px; font-weight: 800; letter-spacing: -0.02em; color: var(--hl-text); text-decoration: none; }
|
|
14
|
+
.hl-sidebar[data-collapsed] .hl-brand { flex: none; padding: 0; justify-content: center; }
|
|
15
|
+
.hl-shell button.hl-sidebar-toggle { width: 32px; height: 32px; min-height: 32px; flex: none; padding: 0; box-sizing: border-box; border: 0; border-radius: var(--hl-radius-control); display: grid; place-items: center; background: transparent; color: var(--hl-muted); cursor: pointer; }
|
|
16
|
+
.hl-shell button.hl-sidebar-toggle:hover:not(:disabled) { background: var(--hl-faint); border-color: transparent; color: var(--hl-text); }
|
|
17
|
+
.hl-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
|
|
8
18
|
.hl-nav { display: flex; flex-direction: column; gap: 2px; }
|
|
9
19
|
.hl-nav__group { margin: 12px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--hl-muted); }
|
|
10
20
|
.hl-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
|
|
@@ -13,38 +23,79 @@ export const SHELL_CSS = `
|
|
|
13
23
|
.hl-nav a[aria-current="page"] { background: var(--hl-accent-soft); color: var(--hl-accent-text); font-weight: 700; }
|
|
14
24
|
.hl-nav ul ul a { min-height: 28px; padding-left: 36px; font-weight: 500; color: var(--hl-muted); }
|
|
15
25
|
.hl-nav ul ul a[aria-current="page"] { color: var(--hl-accent-text); }
|
|
26
|
+
.hl-sidebar[data-collapsed] .hl-nav { align-items: center; }
|
|
27
|
+
.hl-sidebar[data-collapsed] .hl-nav a { position: relative; width: 44px; height: 44px; min-height: 44px; padding: 0; justify-content: center; }
|
|
28
|
+
.hl-nav__initial { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--hl-faint); }
|
|
29
|
+
.hl-nav a[aria-current="page"] .hl-nav__initial { background: transparent; }
|
|
30
|
+
.hl-nav__divider { width: 28px; margin: 8px auto; border: 0; border-top: 1px solid var(--hl-border); }
|
|
16
31
|
.hl-sidebar__foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding-top: 20px; border-top: 1px solid var(--hl-border); }
|
|
32
|
+
.hl-sidebar[data-collapsed] .hl-sidebar__foot { align-self: stretch; align-items: center; }
|
|
17
33
|
.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
34
|
.hl-theme-switch { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--hl-faint); }
|
|
19
35
|
.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
36
|
.hl-shell .hl-theme-switch button:hover:not(:disabled) { background: var(--hl-surface); border-color: transparent; color: var(--hl-text); }
|
|
21
37
|
.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-
|
|
23
|
-
.hl-
|
|
24
|
-
.hl-
|
|
25
|
-
.hl-
|
|
38
|
+
.hl-shell button.hl-theme-cycle { width: 40px; height: 40px; min-height: 40px; padding: 0; box-sizing: border-box; border: 0; border-radius: 999px; display: grid; place-items: center; background: var(--hl-faint); color: var(--hl-text); cursor: pointer; }
|
|
39
|
+
.hl-shell button.hl-theme-cycle:hover:not(:disabled) { background: var(--hl-surface); border-color: transparent; color: var(--hl-text); }
|
|
40
|
+
.hl-account { position: relative; }
|
|
41
|
+
.hl-shell button.hl-account__trigger { width: 100%; min-height: 48px; display: flex; align-items: center; gap: 10px; padding: 6px; box-sizing: border-box; border: 0; border-radius: var(--hl-radius-control); background: transparent; color: var(--hl-text); font: inherit; text-align: left; cursor: pointer; }
|
|
42
|
+
.hl-shell button.hl-account__trigger:hover:not(:disabled), .hl-shell button.hl-account__trigger[aria-expanded="true"] { background: var(--hl-faint); border-color: transparent; color: var(--hl-text); }
|
|
43
|
+
.hl-sidebar[data-collapsed] button.hl-account__trigger { width: 44px; height: 44px; min-height: 44px; padding: 0; justify-content: center; border-radius: 999px; }
|
|
44
|
+
.hl-avatar { width: 32px; height: 32px; flex: none; border-radius: 999px; display: grid; place-items: center; background: var(--hl-accent); color: var(--hl-on-accent); font-weight: 700; }
|
|
45
|
+
.hl-account__text { flex: 1; display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
|
|
46
|
+
.hl-account__text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
26
47
|
.hl-account__text span { font-size: 13px; color: var(--hl-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
27
|
-
.hl-
|
|
28
|
-
.hl-
|
|
29
|
-
.hl-
|
|
48
|
+
.hl-account__chevron { flex: none; color: var(--hl-muted); }
|
|
49
|
+
.hl-account__menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 25; display: flex; flex-direction: column; gap: 2px; padding: 6px; border-radius: var(--hl-radius-control); border: 1px solid var(--hl-border); background: var(--hl-surface); box-shadow: 0 14px 34px rgba(0,0,0,.25); }
|
|
50
|
+
.hl-sidebar[data-collapsed] .hl-account__menu { left: calc(100% + 10px); right: auto; bottom: 0; width: 260px; }
|
|
51
|
+
.hl-account__head { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--hl-border); }
|
|
52
|
+
.hl-account__caption { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--hl-muted); }
|
|
53
|
+
.hl-account__full { overflow-wrap: anywhere; }
|
|
54
|
+
.hl-account__head span.hl-account__full { font-size: 13px; color: var(--hl-muted); }
|
|
55
|
+
.hl-shell button.hl-signout { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--hl-text); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
|
|
56
|
+
.hl-shell button.hl-signout:hover:not(:disabled) { background: var(--hl-faint); border-color: transparent; color: var(--hl-text); }
|
|
57
|
+
.hl-shell button.hl-signout:disabled { background: transparent; border-color: transparent; color: var(--hl-muted); opacity: .7; cursor: default; }
|
|
30
58
|
.hl-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
|
|
31
59
|
.hl-topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 24px; border-bottom: 1px solid var(--hl-border); background: var(--hl-ground); position: sticky; top: 0; z-index: 10; }
|
|
32
60
|
.hl-search { position: relative; flex: 1 1 280px; max-width: 520px; display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 12px; border-radius: var(--hl-radius-control); border: 1px solid var(--hl-border); background: var(--hl-surface); color: var(--hl-muted); box-sizing: border-box; }
|
|
33
61
|
.hl-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--hl-text); font: inherit; }
|
|
34
62
|
.hl-search:focus-within { border-color: var(--hl-accent); }
|
|
63
|
+
.hl-search__kbd, .hl-shortcuts kbd { flex: none; min-width: 22px; box-sizing: border-box; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--hl-border); background: var(--hl-ground); font-family: inherit; font-size: 11px; font-weight: 700; text-align: center; color: var(--hl-muted); }
|
|
35
64
|
.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
65
|
.hl-search__list li { padding: 10px 12px; border-radius: 8px; color: var(--hl-text); cursor: pointer; }
|
|
37
66
|
.hl-search__list li[aria-selected="true"] { background: var(--hl-accent-soft); color: var(--hl-accent-text); }
|
|
38
67
|
.hl-search__list .hl-search__empty { color: var(--hl-muted); cursor: default; }
|
|
39
68
|
.hl-topbar__end { margin-left: auto; display: flex; align-items: center; gap: 10px; }
|
|
40
|
-
.hl-shell button.hl-menu-button { min-height: 32px; padding: 0 12px; 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
69
|
.hl-main { padding: 20px 24px; width: 100%; max-width: 1180px; box-sizing: border-box; }
|
|
43
|
-
.hl-
|
|
44
|
-
.hl-
|
|
45
|
-
|
|
46
|
-
|
|
70
|
+
.hl-shortcuts-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45); }
|
|
71
|
+
.hl-shortcuts { position: fixed; z-index: 51; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 64px); overflow-y: auto; box-sizing: border-box; padding: 18px 22px 22px; border-radius: 14px; border: 1px solid var(--hl-border); background: var(--hl-surface); color: var(--hl-text); box-shadow: 0 20px 50px rgba(0,0,0,.35); }
|
|
72
|
+
.hl-shortcuts__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
|
|
73
|
+
.hl-shortcuts h2 { margin: 0; font-size: 17px; }
|
|
74
|
+
.hl-shortcuts h3 { margin: 16px 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--hl-muted); }
|
|
75
|
+
.hl-shortcuts dl { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; }
|
|
76
|
+
.hl-shortcuts dt { min-width: 0; }
|
|
77
|
+
.hl-shortcuts dd { margin: 0; display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
|
|
78
|
+
.hl-shortcuts__row { display: contents; }
|
|
79
|
+
.hl-shortcuts__or { padding: 0 4px; font-size: 12px; color: var(--hl-muted); }
|
|
80
|
+
.hl-shell button.hl-shortcuts__close { width: 32px; height: 32px; min-height: 32px; padding: 0; border: 0; border-radius: var(--hl-radius-control); display: grid; place-items: center; background: transparent; color: var(--hl-muted); cursor: pointer; }
|
|
81
|
+
.hl-shell button.hl-shortcuts__close:hover:not(:disabled) { background: var(--hl-faint); border-color: transparent; color: var(--hl-text); }
|
|
82
|
+
.hl-shell .hl-sidebar a, .hl-shell .hl-sidebar a:hover, .hl-shell .hl-topbar a, .hl-shell .hl-topbar a:hover { text-decoration: none; }
|
|
83
|
+
.hl-shell a.hl-brand:hover { color: var(--hl-text); }
|
|
84
|
+
.hl-shell a.hl-skip, .hl-shell a.hl-skip:hover { color: var(--hl-on-accent); text-decoration: none; }
|
|
85
|
+
.hl-topbar[data-narrow] { flex-wrap: nowrap; min-height: 56px; box-sizing: border-box; padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 6px max(16px, env(safe-area-inset-left)); }
|
|
86
|
+
.hl-topbar[data-narrow] .hl-brand { flex: 0 1 auto; padding: 0; font-size: 15px; }
|
|
87
|
+
.hl-topbar[data-narrow] .hl-topbar__end { flex: none; gap: 4px; }
|
|
88
|
+
.hl-topbar[data-narrow] .hl-topbar__end > * { flex: none; white-space: nowrap; }
|
|
89
|
+
.hl-shell button.hl-search-button, .hl-shell button.hl-search-close { width: 44px; height: 44px; min-height: 44px; flex: none; padding: 0; box-sizing: border-box; border: 0; border-radius: var(--hl-radius-control); display: grid; place-items: center; background: transparent; color: var(--hl-text); cursor: pointer; }
|
|
90
|
+
.hl-shell button.hl-search-button:hover:not(:disabled), .hl-shell button.hl-search-close:hover:not(:disabled) { background: var(--hl-faint); border-color: transparent; color: var(--hl-text); }
|
|
91
|
+
.hl-search-backdrop { position: fixed; inset: 0; z-index: 44; background: rgba(0,0,0,.45); }
|
|
92
|
+
.hl-search-overlay { position: fixed; top: 0; left: 0; right: 0; z-index: 45; display: flex; align-items: center; gap: 6px; padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left)); box-sizing: border-box; background: var(--hl-ground); border-bottom: 1px solid var(--hl-border); }
|
|
93
|
+
.hl-search-overlay .hl-search { flex: 1; max-width: none; min-height: 44px; }
|
|
94
|
+
.hl-search-overlay .hl-search input { font-size: 16px; }
|
|
95
|
+
.hl-shell[data-narrow] .hl-main { padding-bottom: calc(56px + 24px + env(safe-area-inset-bottom)); }
|
|
96
|
+
@media (max-width: ${String(NARROW_BREAKPOINT - 1)}px) {
|
|
97
|
+
.hl-topbar { padding: 6px 8px 6px 16px; }
|
|
47
98
|
.hl-main { padding: 20px 16px; }
|
|
48
99
|
}
|
|
49
|
-
`;
|
|
100
|
+
${BOTTOM_NAV_CSS}`;
|
|
50
101
|
//# sourceMappingURL=shell-css.js.map
|
|
@@ -1 +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
|
|
1
|
+
{"version":3,"file":"shell-css.js","sourceRoot":"","sources":["../../src/shell/shell-css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,sEAAsE;AACtE,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA4FJ,MAAM,CAAC,iBAAiB,GAAG,CAAC,CAAC;;;;EAIhD,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { NavItem } from './nav.js';
|
|
2
|
+
/** Whether a key press lands where the person is typing: single-key shortcuts leave it alone. */
|
|
3
|
+
export declare function isTyping(target: EventTarget | null): boolean;
|
|
4
|
+
/** Whether this is a Mac (⌘) rather than Windows or Linux (Ctrl). */
|
|
5
|
+
export declare function isMac(): boolean;
|
|
6
|
+
/** The modifier keys' names as shown on this computer's keyboard. */
|
|
7
|
+
export declare function keyNames(mac: boolean): {
|
|
8
|
+
mod: string;
|
|
9
|
+
shift: string;
|
|
10
|
+
};
|
|
11
|
+
/** A page "G then a letter" goes to. */
|
|
12
|
+
export interface GoKey {
|
|
13
|
+
key: string;
|
|
14
|
+
item: NavItem;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The letter for each page, for "G then a letter": the item's own `shortcut`, else the first
|
|
18
|
+
* letter of its name not taken by a page before it. A page with no free letter has none.
|
|
19
|
+
*/
|
|
20
|
+
export declare function goKeys(items: NavItem[]): GoKey[];
|
|
21
|
+
/** How long after G the letter still counts. */
|
|
22
|
+
export declare const GO_WINDOW_MS = 1500;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** Whether a key press lands where the person is typing: single-key shortcuts leave it alone. */
|
|
2
|
+
export function isTyping(target) {
|
|
3
|
+
if (!target || typeof target.tagName !== 'string')
|
|
4
|
+
return false;
|
|
5
|
+
const el = target;
|
|
6
|
+
const tag = el.tagName;
|
|
7
|
+
if (tag === 'TEXTAREA' || tag === 'SELECT')
|
|
8
|
+
return true;
|
|
9
|
+
if (tag === 'INPUT') {
|
|
10
|
+
const type = el.type;
|
|
11
|
+
return !['button', 'checkbox', 'radio', 'reset', 'submit', 'range', 'color', 'file'].includes(type);
|
|
12
|
+
}
|
|
13
|
+
return el.isContentEditable === true || el.getAttribute('contenteditable') === 'true';
|
|
14
|
+
}
|
|
15
|
+
/** Whether this is a Mac (⌘) rather than Windows or Linux (Ctrl). */
|
|
16
|
+
export function isMac() {
|
|
17
|
+
if (typeof navigator === 'undefined')
|
|
18
|
+
return false;
|
|
19
|
+
const platform = navigator.userAgentData?.platform ??
|
|
20
|
+
navigator.platform ??
|
|
21
|
+
'';
|
|
22
|
+
return /mac|iphone|ipad/i.test(platform);
|
|
23
|
+
}
|
|
24
|
+
/** The modifier keys' names as shown on this computer's keyboard. */
|
|
25
|
+
export function keyNames(mac) {
|
|
26
|
+
return mac ? { mod: '⌘', shift: '⇧' } : { mod: 'Ctrl', shift: 'Shift' };
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The letter for each page, for "G then a letter": the item's own `shortcut`, else the first
|
|
30
|
+
* letter of its name not taken by a page before it. A page with no free letter has none.
|
|
31
|
+
*/
|
|
32
|
+
export function goKeys(items) {
|
|
33
|
+
const taken = new Set();
|
|
34
|
+
const out = [];
|
|
35
|
+
for (const item of items) {
|
|
36
|
+
const own = item.shortcut?.toLowerCase();
|
|
37
|
+
const candidates = own ? [own] : [...item.label.toLowerCase()].filter((c) => /[a-z]/.test(c));
|
|
38
|
+
const key = candidates.find((c) => !taken.has(c));
|
|
39
|
+
if (!key)
|
|
40
|
+
continue;
|
|
41
|
+
taken.add(key);
|
|
42
|
+
out.push({ key, item });
|
|
43
|
+
}
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
46
|
+
/** How long after G the letter still counts. */
|
|
47
|
+
export const GO_WINDOW_MS = 1500;
|
|
48
|
+
//# sourceMappingURL=shortcuts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shortcuts.js","sourceRoot":"","sources":["../../src/shell/shortcuts.ts"],"names":[],"mappings":"AAEA,iGAAiG;AACjG,MAAM,UAAU,QAAQ,CAAC,MAA0B;IACjD,IAAI,CAAC,MAAM,IAAI,OAAQ,MAAkB,CAAC,OAAO,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7E,MAAM,EAAE,GAAG,MAAqB,CAAC;IACjC,MAAM,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC;IACvB,IAAI,GAAG,KAAK,UAAU,IAAI,GAAG,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACxD,IAAI,GAAG,KAAK,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,GAAI,EAAuB,CAAC,IAAI,CAAC;QAC3C,OAAO,CAAC,CAAC,QAAQ,EAA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C,CAAC;QAC9F,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAClD,IAAI,CAAC,GAAG;YAAE,SAAS;QACnB,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACf,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,gDAAgD;AAChD,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const SIDEBAR_STORAGE_KEY = "haatlabs:sidebar";
|
|
2
|
+
/** Whether the sidebar was left collapsed in this browser; anything else opens it expanded. */
|
|
3
|
+
export declare function readSidebarCollapsed(store?: Pick<Storage, 'getItem'> | null): boolean;
|
|
4
|
+
/** Collapsed or expanded, remembered in this browser (like the theme). */
|
|
5
|
+
export declare function useSidebarCollapsed(): [boolean, () => void];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
2
|
+
export const SIDEBAR_STORAGE_KEY = 'haatlabs:sidebar';
|
|
3
|
+
/** The browser's storage, or null where reading it throws (blocked site data, some private windows). */
|
|
4
|
+
function storage() {
|
|
5
|
+
try {
|
|
6
|
+
return typeof window === 'undefined' ? null : window.localStorage;
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/** Whether the sidebar was left collapsed in this browser; anything else opens it expanded. */
|
|
13
|
+
export function readSidebarCollapsed(store = storage()) {
|
|
14
|
+
try {
|
|
15
|
+
return store?.getItem(SIDEBAR_STORAGE_KEY) === 'collapsed';
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** Collapsed or expanded, remembered in this browser (like the theme). */
|
|
22
|
+
export function useSidebarCollapsed() {
|
|
23
|
+
const [collapsed, setCollapsed] = useState(() => readSidebarCollapsed());
|
|
24
|
+
const toggle = useCallback(() => {
|
|
25
|
+
setCollapsed((was) => {
|
|
26
|
+
const next = !was;
|
|
27
|
+
try {
|
|
28
|
+
storage()?.setItem(SIDEBAR_STORAGE_KEY, next ? 'collapsed' : 'expanded');
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
// Not stored: the choice holds for this page only.
|
|
32
|
+
}
|
|
33
|
+
return next;
|
|
34
|
+
});
|
|
35
|
+
}, []);
|
|
36
|
+
return [collapsed, toggle];
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=sidebar-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidebar-state.js","sourceRoot":"","sources":["../../src/shell/sidebar-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9C,MAAM,CAAC,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AAEtD,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,+FAA+F;AAC/F,MAAM,UAAU,oBAAoB,CAAC,QAAyC,OAAO,EAAE;IACrF,IAAI,CAAC;QACH,OAAO,KAAK,EAAE,OAAO,CAAC,mBAAmB,CAAC,KAAK,WAAW,CAAC;IAC7D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,mBAAmB;IACjC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,oBAAoB,EAAE,CAAC,CAAC;IACzE,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE;QAC9B,YAAY,CAAC,CAAC,GAAG,EAAE,EAAE;YACnB,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC;YAClB,IAAI,CAAC;gBACH,OAAO,EAAE,EAAE,OAAO,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;YAC3E,CAAC;YAAC,MAAM,CAAC;gBACP,mDAAmD;YACrD,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { USAGE_CSS } from '../client/usage-css.js';
|
|
3
3
|
import { LAYOUT_CSS } from '../layout/layout-css.js';
|
|
4
|
+
import { NOTIFICATIONS_CSS } from '../notifications/notifications-css.js';
|
|
4
5
|
import { SHELL_CSS } from '../shell/shell-css.js';
|
|
5
6
|
import { themeCss } from './tokens.js';
|
|
6
7
|
/** The dashboard look as one `<style>`: render it once, at the top of the app. */
|
|
7
8
|
export function ThemeStyles({ accent }) {
|
|
8
|
-
return _jsx("style", { children: themeCss(accent) + SHELL_CSS + LAYOUT_CSS + USAGE_CSS });
|
|
9
|
+
return _jsx("style", { children: themeCss(accent) + SHELL_CSS + LAYOUT_CSS + USAGE_CSS + NOTIFICATIONS_CSS });
|
|
9
10
|
}
|
|
10
11
|
//# sourceMappingURL=ThemeStyles.js.map
|
|
@@ -1 +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;
|
|
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,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,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,GAAG,iBAAiB,GAAS,CAAC;AACpG,CAAC"}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import type { ThemeChoice } from './theme-choice.js';
|
|
3
|
+
/**
|
|
4
|
+
* System, dark or light: the choice is remembered in this browser. With `labels` (the phone
|
|
5
|
+
* and tablet More sheet) each button shows its name beside its icon, Light, Dark, System.
|
|
6
|
+
*/
|
|
7
|
+
export declare function ThemeSwitch({ labels }?: {
|
|
8
|
+
labels?: boolean;
|
|
9
|
+
}): ReactElement;
|
|
10
|
+
/** The theme after this one: system → dark → light → system. */
|
|
11
|
+
export declare function nextTheme(choice: ThemeChoice): ThemeChoice;
|
|
12
|
+
/** One button that steps through system, dark and light: for the collapsed sidebar. */
|
|
13
|
+
export declare function ThemeCycle(): ReactElement;
|
|
@@ -26,9 +26,25 @@ const OPTIONS = [
|
|
|
26
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
27
|
},
|
|
28
28
|
];
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const NAMES = { system: 'System', dark: 'Dark', light: 'Light' };
|
|
30
|
+
/**
|
|
31
|
+
* System, dark or light: the choice is remembered in this browser. With `labels` (the phone
|
|
32
|
+
* and tablet More sheet) each button shows its name beside its icon, Light, Dark, System.
|
|
33
|
+
*/
|
|
34
|
+
export function ThemeSwitch({ labels = false } = {}) {
|
|
31
35
|
const { choice, setChoice } = useTheme();
|
|
32
|
-
|
|
36
|
+
const options = labels ? [...OPTIONS].reverse() : OPTIONS;
|
|
37
|
+
return (_jsx("div", { role: "group", "aria-label": "Theme", className: labels ? 'hl-theme-switch hl-theme-switch--labels' : 'hl-theme-switch', children: options.map((option) => (_jsxs("button", { type: "button", "aria-label": option.label, "aria-pressed": choice === option.choice, onClick: () => setChoice(option.choice), children: [option.icon, labels && _jsx("span", { className: "hl-theme-switch__text", children: NAMES[option.choice] })] }, option.choice))) }));
|
|
38
|
+
}
|
|
39
|
+
/** The theme after this one: system → dark → light → system. */
|
|
40
|
+
export function nextTheme(choice) {
|
|
41
|
+
return choice === 'system' ? 'dark' : choice === 'dark' ? 'light' : 'system';
|
|
42
|
+
}
|
|
43
|
+
/** One button that steps through system, dark and light: for the collapsed sidebar. */
|
|
44
|
+
export function ThemeCycle() {
|
|
45
|
+
const { choice, setChoice } = useTheme();
|
|
46
|
+
const option = OPTIONS.find((o) => o.choice === choice) ?? OPTIONS[0];
|
|
47
|
+
const next = nextTheme(choice);
|
|
48
|
+
return (_jsx("button", { type: "button", className: "hl-theme-cycle", "aria-label": `Theme: ${NAMES[choice]}. Change to ${NAMES[next]}`, title: `Theme: ${NAMES[choice]}`, onClick: () => setChoice(next), children: option?.icon }));
|
|
33
49
|
}
|
|
34
50
|
//# sourceMappingURL=ThemeSwitch.js.map
|
|
@@ -1 +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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,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;IACtE,MAAM,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,CACL,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,gBAAgB,gBACd,UAAU,KAAK,CAAC,MAAM,CAAC,eAAe,KAAK,CAAC,IAAI,CAAC,EAAE,EAC/D,KAAK,EAAE,UAAU,KAAK,CAAC,MAAM,CAAC,EAAE,EAChC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,YAE7B,MAAM,EAAE,IAAI,GACN,CACV,CAAC;AACJ,CAAC"}
|
package/dist/theme/tokens.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* The dashboards' look: neutral colours for light and dark, and one accent per product.
|
|
3
3
|
* Every value is checked for contrast in `tokens.test.ts`.
|
|
4
4
|
*/
|
|
5
|
-
/** The
|
|
6
|
-
export type AccentPreset = 'indigo' | 'coral' | 'teal' | 'green';
|
|
5
|
+
/** The products' accents: the console, Catalogpix, Catalogscout, MarginLedger and VendorHaat. */
|
|
6
|
+
export type AccentPreset = 'indigo' | 'coral' | 'teal' | 'green' | 'pine';
|
|
7
7
|
export interface AccentColors {
|
|
8
8
|
/** Buttons and fills; white text sits on it. */
|
|
9
9
|
solid: string;
|
|
@@ -35,6 +35,11 @@ export declare const NEUTRALS: Readonly<{
|
|
|
35
35
|
light: Neutrals;
|
|
36
36
|
dark: Neutrals;
|
|
37
37
|
}>;
|
|
38
|
+
/**
|
|
39
|
+
* A link's colour under the pointer: the link colour moved away from the ground (darker in
|
|
40
|
+
* the light theme, lighter in the dark), so it stays as readable as the link and still shows.
|
|
41
|
+
*/
|
|
42
|
+
export declare function accentHover(accent: AccentColors, dark: boolean): string;
|
|
38
43
|
/**
|
|
39
44
|
* The tokens as CSS: light by default, dark when `<html data-theme="dark">` or, with no
|
|
40
45
|
* choice made, when the system is dark; then the base rules every dashboard shares.
|
package/dist/theme/tokens.js
CHANGED
|
@@ -31,6 +31,13 @@ export const ACCENTS = {
|
|
|
31
31
|
softLight: '#E6F4EA',
|
|
32
32
|
softDark: '#18301F',
|
|
33
33
|
},
|
|
34
|
+
pine: {
|
|
35
|
+
solid: '#0F766E',
|
|
36
|
+
textLight: '#0F766E',
|
|
37
|
+
textDark: '#5EEAD4',
|
|
38
|
+
softLight: '#E6F4F1',
|
|
39
|
+
softDark: '#12302C',
|
|
40
|
+
},
|
|
34
41
|
};
|
|
35
42
|
export const NEUTRALS = {
|
|
36
43
|
light: {
|
|
@@ -62,6 +69,20 @@ export const NEUTRALS = {
|
|
|
62
69
|
};
|
|
63
70
|
const FONT = "'Plus Jakarta Sans Variable', system-ui, sans-serif";
|
|
64
71
|
const MONO = "'JetBrains Mono', ui-monospace, monospace";
|
|
72
|
+
/** `#RRGGBB` moved `share` (0–1) of the way towards `#RRGGBB` `to`. */
|
|
73
|
+
function mix(hex, to, share) {
|
|
74
|
+
const channels = (value) => [1, 3, 5].map((i) => Number.parseInt(value.slice(i, i + 2), 16));
|
|
75
|
+
const target = channels(to);
|
|
76
|
+
const mixed = channels(hex).map((c, i) => Math.round(c + ((target[i] ?? c) - c) * share));
|
|
77
|
+
return `#${mixed.map((c) => c.toString(16).padStart(2, '0')).join('')}`.toUpperCase();
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* A link's colour under the pointer: the link colour moved away from the ground (darker in
|
|
81
|
+
* the light theme, lighter in the dark), so it stays as readable as the link and still shows.
|
|
82
|
+
*/
|
|
83
|
+
export function accentHover(accent, dark) {
|
|
84
|
+
return dark ? mix(accent.textDark, '#FFFFFF', 0.4) : mix(accent.textLight, '#000000', 0.25);
|
|
85
|
+
}
|
|
65
86
|
function variables(n, accent, dark) {
|
|
66
87
|
return [
|
|
67
88
|
`--hl-ground: ${n.ground};`,
|
|
@@ -78,6 +99,7 @@ function variables(n, accent, dark) {
|
|
|
78
99
|
`--hl-accent: ${accent.solid};`,
|
|
79
100
|
`--hl-accent-text: ${dark ? accent.textDark : accent.textLight};`,
|
|
80
101
|
`--hl-accent-soft: ${dark ? accent.softDark : accent.softLight};`,
|
|
102
|
+
`--hl-accent-hover: ${accentHover(accent, dark)};`,
|
|
81
103
|
`color-scheme: ${dark ? 'dark' : 'light'};`,
|
|
82
104
|
].join(' ');
|
|
83
105
|
}
|
|
@@ -95,7 +117,8 @@ export function themeCss(accent) {
|
|
|
95
117
|
@media (prefers-color-scheme: dark) { :root:not([data-theme]) { ${dark} } }
|
|
96
118
|
body { margin: 0; background: var(--hl-ground); color: var(--hl-text); font-family: var(--hl-font); font-size: 13px; line-height: 1.5; }
|
|
97
119
|
code, kbd, pre, samp { font-family: var(--hl-mono); }
|
|
98
|
-
a { color: var(--hl-accent-text); }
|
|
120
|
+
a { color: var(--hl-accent-text); text-decoration: none; cursor: pointer; }
|
|
121
|
+
a:hover { color: var(--hl-accent-hover); }
|
|
99
122
|
:focus-visible { outline: 3px solid var(--hl-accent); outline-offset: 2px; }
|
|
100
123
|
`;
|
|
101
124
|
}
|
package/dist/theme/tokens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../src/theme/tokens.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkBH,MAAM,CAAC,MAAM,OAAO,GAAiD;IACnE,MAAM,EAAE;QACN,KAAK,EAAE,SAAS;QAChB,SAAS,EAAE,SAAS;QACpB,QAAQ,EAAE,SAAS;QACnB,SAAS,EAAE,SAAS;QACpB,QAAQ,EAAE,SAAS;KACpB;IACD,KAAK,EAAE;QACL,KAAK,EAAE,SAAS;QAChB,SAAS,EAAE,SAAS;QACpB,QAAQ,EAAE,SAAS;QACnB,SAAS,EAAE,SAAS;QACpB,QAAQ,EAAE,SAAS;KACpB;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,SAAS;QAChB,SAAS,EAAE,SAAS;QACpB,QAAQ,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E,IAAI,CAAC,CAAC;IAC/C,OAAO;UACC,KAAK,8LAA8L,IAAI,gBAAgB,IAAI;6BACxM,IAAI;kEACiC,IAAI;;;;;;CAMrE,CAAC;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haatlabs-core/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "React components for an app's dashboard, styled by the app.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"haatlabs",
|
|
@@ -67,11 +67,11 @@
|
|
|
67
67
|
"react-router-dom": "^7.18.4",
|
|
68
68
|
"@tanstack/react-query": "^5.104.1",
|
|
69
69
|
"zod": "^4.6.5",
|
|
70
|
-
"@haatlabs-core/tsconfig": "0.
|
|
71
|
-
"@haatlabs-core/vitest-config": "0.
|
|
70
|
+
"@haatlabs-core/tsconfig": "0.22.0",
|
|
71
|
+
"@haatlabs-core/vitest-config": "0.22.0"
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@haatlabs-core/auth-contracts": "0.
|
|
74
|
+
"@haatlabs-core/auth-contracts": "0.22.0"
|
|
75
75
|
},
|
|
76
76
|
"scripts": {
|
|
77
77
|
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|