@tristan2828/ui-foundation 5.1.0 → 6.0.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.
@@ -3,51 +3,52 @@
3
3
  <!-- index: written by `npm run docs:index` in the package from the headings below; never edit it by hand -->
4
4
  ## Index
5
5
 
6
- - [Palettes](#palettes) · lines 60–150
7
- - [Glow](#glow) · lines 152–171
8
- - [Semantic tones](#semantic-tones) · lines 173–201
9
- - [The three badge styles](#the-three-badge-styles) · lines 203–220
10
- - [Status marks](#status-marks) · lines 222–265
11
- - [Mapping an enum to tones](#mapping-an-enum-to-tones) · lines 267–296
12
- - [Glyphs and icons: 3:1](#glyphs-and-icons-31) · lines 298–309
13
- - [Logos and brand marks](#logos-and-brand-marks) · lines 311–351
14
- - [Emoji](#emoji) · lines 353–393
15
- - [Categorical colour](#categorical-colour) · lines 395–460
16
- - [Heat scale](#heat-scale) · lines 462–514
17
- - [Depth ramps](#depth-ramps) · lines 516–583
18
- - [A stored colour](#a-stored-colour) · lines 585–632
19
- - [Shapes and sizes](#shapes-and-sizes) · lines 634–655
20
- - [Typography](#typography) · lines 657–827
21
- - [Words on screen: Title Case and sentence case](#words-on-screen-title-case-and-sentence-case) · lines 691–723
22
- - [Written text (notes)](#written-text-notes) · lines 725–827
23
- - [Density](#density) · lines 829–958
24
- - [Rows on this device](#rows-on-this-device) · lines 902–930
25
- - [Page width (a record on a wide screen)](#page-width-a-record-on-a-wide-screen) · lines 932–958
26
- - [Widget cards (hub pages)](#widget-cards-hub-pages) · lines 960–1077
27
- - [Module cards (a hub's places)](#module-cards-a-hubs-places) · lines 1079–1151
28
- - [Notices](#notices) · lines 1153–1180
29
- - [A value over time](#a-value-over-time) · lines 1182–1312
30
- - [Several values over time](#several-values-over-time) · lines 1231–1269
31
- - [Parts of a whole over time](#parts-of-a-whole-over-time) · lines 1271–1312
32
- - [A list as a board](#a-list-as-a-board) · lines 1314–1424
33
- - [Order, groups and the header](#order-groups-and-the-header) · lines 1367–1424
34
- - [A list as cards](#a-list-as-cards) · lines 1426–1473
35
- - [Images full screen](#images-full-screen) · lines 1475–1521
36
- - [Key numbers on a record](#key-numbers-on-a-record) · lines 1523–1559
37
- - [Parts of the page standards](#parts-of-the-page-standards) · lines 1561–1597
38
- - [A few equal things](#a-few-equal-things) · lines 1599–1714
39
- - [An overview page](#an-overview-page) · lines 1716–1781
40
- - [A record's header and empty values](#a-records-header-and-empty-values) · lines 1783–1846
41
- - [A record's tabs, mark and facts](#a-records-tabs-mark-and-facts) · lines 1848–1935
42
- - [Picking at random](#picking-at-random) · lines 1937–1968
43
- - [Filling in what's missing](#filling-in-whats-missing) · lines 1970–2037
44
- - [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines 2039–2058
45
- - [A quick add line](#a-quick-add-line) · lines 2060–2088
46
- - [A date field's quick picks](#a-date-fields-quick-picks) · lines 2090–2114
47
- - [A few choices, then the month](#a-few-choices-then-the-month) · lines 2116–2142
48
- - [A month calendar](#a-month-calendar) · lines 2144–2176
49
- - [A settings page](#a-settings-page) · lines 2178–2235
50
- - [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines 2237–2296
6
+ - [Palettes](#palettes) · lines 61–153
7
+ - [Glow](#glow) · lines 155–174
8
+ - [Semantic tones](#semantic-tones) · lines 176–204
9
+ - [The three badge styles](#the-three-badge-styles) · lines 206–223
10
+ - [Status marks](#status-marks) · lines 225–268
11
+ - [Mapping an enum to tones](#mapping-an-enum-to-tones) · lines 270–299
12
+ - [Glyphs and icons: 3:1](#glyphs-and-icons-31) · lines 301–312
13
+ - [Logos and brand marks](#logos-and-brand-marks) · lines 314–354
14
+ - [Emoji](#emoji) · lines 356–396
15
+ - [Categorical colour](#categorical-colour) · lines 398–463
16
+ - [Heat scale](#heat-scale) · lines 465–517
17
+ - [Depth ramps](#depth-ramps) · lines 519–586
18
+ - [A stored colour](#a-stored-colour) · lines 588–635
19
+ - [Shapes and sizes](#shapes-and-sizes) · lines 637–658
20
+ - [Typography](#typography) · lines 660–830
21
+ - [Words on screen: Title Case and sentence case](#words-on-screen-title-case-and-sentence-case) · lines 694–726
22
+ - [Written text (notes)](#written-text-notes) · lines 728–830
23
+ - [Density](#density) · lines 832–961
24
+ - [Rows on this device](#rows-on-this-device) · lines 905–933
25
+ - [Page width (a record on a wide screen)](#page-width-a-record-on-a-wide-screen) · lines 935–961
26
+ - [Widget cards (hub pages)](#widget-cards-hub-pages) · lines 963–1080
27
+ - [Module cards (a hub's places)](#module-cards-a-hubs-places) · lines 1082–1154
28
+ - [Notices](#notices) · lines 1156–1183
29
+ - [A value over time](#a-value-over-time) · lines 1185–1315
30
+ - [Several values over time](#several-values-over-time) · lines 1234–1272
31
+ - [Parts of a whole over time](#parts-of-a-whole-over-time) · lines 1274–1315
32
+ - [A list as a board](#a-list-as-a-board) · lines 1317–1427
33
+ - [Order, groups and the header](#order-groups-and-the-header) · lines 1370–1427
34
+ - [A list as cards](#a-list-as-cards) · lines 1429–1476
35
+ - [Images full screen](#images-full-screen) · lines 1478–1524
36
+ - [Key numbers on a record](#key-numbers-on-a-record) · lines 1526–1562
37
+ - [Parts of the page standards](#parts-of-the-page-standards) · lines 1564–1600
38
+ - [A few equal things](#a-few-equal-things) · lines 1602–1717
39
+ - [An overview page](#an-overview-page) · lines 1719–1784
40
+ - [A record's header and empty values](#a-records-header-and-empty-values) · lines 1786–1849
41
+ - [A record's tabs, mark and facts](#a-records-tabs-mark-and-facts) · lines 1851–1938
42
+ - [Picking at random](#picking-at-random) · lines 1940–1971
43
+ - [Filling in what's missing](#filling-in-whats-missing) · lines 1973–2040
44
+ - [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines 2042–2061
45
+ - [A quick add line](#a-quick-add-line) · lines 2063–2091
46
+ - [A date field's quick picks](#a-date-fields-quick-picks) · lines 2093–2117
47
+ - [A few choices, then the month](#a-few-choices-then-the-month) · lines 2119–2145
48
+ - [A month calendar](#a-month-calendar) · lines 2147–2179
49
+ - [A settings page](#a-settings-page) · lines 2181–2238
50
+ - [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines 2240–2299
51
+ - [A bare shell](#a-bare-shell) · lines 2301–2335
51
52
 
52
53
  <!-- /index -->
53
54
 
@@ -69,11 +70,13 @@ second colour):
69
70
  |---|---|---|---|
70
71
  | Graphite and Periwinkle | `graphite-periwinkle` | periwinkle | lilac |
71
72
  | Graphite and Amber | `graphite-amber` | amber | orange |
72
- | Graphite and Sky | `graphite-sky` | sky blue | periwinkle blue |
73
+ | Graphite and Silver | `graphite-silver` | silver grey | mid grey |
73
74
  | Graphite and Green | `graphite-green` | green | olive |
74
75
 
75
- Amber, Sky and Green have Periwinkle's lightness and strength, at their
76
- own hue, so each reads as loud as the others.
76
+ Amber and Green have Periwinkle's lightness and strength, at their own
77
+ hue, so each reads as loud as the others. Silver is the neutral one: it
78
+ leaves colour to the app's own content (coloured module icons, say), and
79
+ it is the template's palette, the look every new app starts with.
77
80
 
78
81
  And one light one, which an app opts into by name (`LIGHT_PALETTES`):
79
82
 
@@ -2294,3 +2297,39 @@ const bottomBar: BottomBarItem[] = [
2294
2297
  current item and never counted. It takes the place of the header's
2295
2298
  button on a phone, so there is one Search. Without `search`, or past the
2296
2299
  bar's fifth item, it isn't drawn and the header is as without it.
2300
+
2301
+ ## A bare shell
2302
+
2303
+ For an app whose own page is the way around (a strip of open tabs, say),
2304
+ with no sidebar and no header: `<AppShell frame="bare" … />`. The page
2305
+ fills the window inside `<main>`, padded as in the full shell.
2306
+
2307
+ ```tsx
2308
+ <AppShell title="Notes" nav={NAV_ITEMS} frame="bare" />
2309
+
2310
+ // The app's own Log Out and version, on a page it picks:
2311
+ const logOut = useLogOut()
2312
+ <Button variant="ghost" size="sm" onClick={logOut}><LogOutIcon />Log Out</Button>
2313
+ <AppVersion version={BUILD_VERSION} />
2314
+ ```
2315
+
2316
+ - **Still the shell's:** the sign-in redirect, the browser tab's title
2317
+ (from `nav`, which is still passed and nothing draws), the offline
2318
+ notice and the toasts.
2319
+ - **Gone with the sidebar and header:** the nav itself, Log Out, the
2320
+ version, the search palette and Ctrl K, the look menu, the light/dark
2321
+ toggle, the page trail and the phone's back arrow and bottom bar.
2322
+ `sidebarExtra`, `defaultSidebarOpen`, `logo`, `navLook`, `lookMenu`,
2323
+ `search` and `bottomBar` are ignored.
2324
+ - **The app gives back what it needs.** `useLogOut()` logs out as the
2325
+ shell's own button does: a clean /login, never sending whoever signs in
2326
+ next back to the last person's page, and the records opened lately
2327
+ forgotten. Calling `useAuth().logout` directly skips both. `AppVersion`
2328
+ is the sidebar footer's "Version abc1234 · PR #12", linking to the PR or
2329
+ commit, and nothing in development. A search goes on a list's own page
2330
+ (`FilterBar`'s search).
2331
+ - **Light and dark:** with no header there's no toggle, so an app with
2332
+ no palette follows the system. Pick a palette (`FoundationProviders`'
2333
+ `palette`) for one look, or give a settings page `PaletteSetting`.
2334
+ - **A trail has no bar:** `usePageTrail` returns false, so a view that
2335
+ would put its trail there draws it itself, as outside the shell.
@@ -0,0 +1,7 @@
1
+ export declare const LogOutContext: import("react").Context<(() => void) | null>;
2
+ /**
3
+ * Logs out as AppShell's Log Out button does: a clean /login, the recent
4
+ * records forgotten. For a Log Out of the app's own (a bare shell, a
5
+ * settings page). Works inside `<AppShell>`.
6
+ */
7
+ export declare function useLogOut(): () => void;
@@ -0,0 +1,18 @@
1
+ // Logging out the way AppShell's own Log Out does, for an app that draws
2
+ // its own (a bare shell has no sidebar to hold the shell's): the logout is
3
+ // marked deliberate, so /login opens clean rather than sending whoever
4
+ // signs in next back to the last person's page, and the records opened
5
+ // lately are forgotten on this device.
6
+ import { createContext, useContext } from 'react';
7
+ export const LogOutContext = createContext(null);
8
+ /**
9
+ * Logs out as AppShell's Log Out button does: a clean /login, the recent
10
+ * records forgotten. For a Log Out of the app's own (a bare shell, a
11
+ * settings page). Works inside `<AppShell>`.
12
+ */
13
+ export function useLogOut() {
14
+ const logOut = useContext(LogOutContext);
15
+ if (!logOut)
16
+ throw new Error('useLogOut works inside <AppShell>.');
17
+ return logOut;
18
+ }
@@ -106,5 +106,19 @@ export type AppShellProps = {
106
106
  * (`useRecentRecord`), `recent` of them. No search, no box.
107
107
  */
108
108
  search?: AppShellSearch;
109
+ /**
110
+ * `'full'` (the default): the sidebar and the header around the page.
111
+ * `'bare'`: neither, for an app that draws its own way around (a strip
112
+ * of tabs, say): the page fills the window inside `<main>`. Still the
113
+ * shell's: the sign-in redirect, the browser tab's title (from `nav`,
114
+ * which nothing draws), the offline notice and the toasts. Gone with the
115
+ * sidebar and header: Log Out (`useLogOut()` for the app's own), the
116
+ * version (`AppVersion`), the search palette and Ctrl K, the look menu,
117
+ * the light/dark toggle, the page trail (`usePageTrail` returns false, so
118
+ * a view draws its own) and the phone's back arrow; `sidebarExtra`,
119
+ * `defaultSidebarOpen`, `logo`, `navLook`, `lookMenu`, `search` and
120
+ * `bottomBar` are ignored. design-language.md "A bare shell".
121
+ */
122
+ frame?: 'full' | 'bare';
109
123
  };
110
- export declare function AppShell({ title, logo: Logo, nav, sidebarExtra, defaultSidebarOpen, version, bottomBar, navLook, lookMenu, search, }: AppShellProps): import("react").JSX.Element;
124
+ export declare function AppShell({ title, logo: Logo, nav, sidebarExtra, defaultSidebarOpen, version, bottomBar, navLook, lookMenu, search, frame, }: AppShellProps): import("react").JSX.Element;
@@ -5,6 +5,7 @@ import { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react'
5
5
  import { Link, Navigate, Outlet, useLocation } from 'react-router';
6
6
  import { useAuth } from '../../auth/use-auth.js';
7
7
  import { BottomBar, BOTTOM_BAR_PADDING } from './app-shell-bottom-bar.js';
8
+ import { LogOutContext } from './app-shell-log-out.js';
8
9
  import { activeNavTo, bottomBarHasSearch, bottomBarItems, childItems, childRuns, childrenOpen, isNavItemGroup, navCountSpoken, navCountText, navGroups, navPageLabel, navTooltip, navTrail, trailBackTarget, withChildren, } from './app-shell-nav.js';
9
10
  import { versionHref, versionLabel } from './app-shell-version.js';
10
11
  import { ErrorState } from './error-state.js';
@@ -219,10 +220,11 @@ function CollapsibleNavGroup({ group, activeTo }) {
219
220
  function PhoneBack({ back }) {
220
221
  return (_jsxs(Link, { to: back.to, "data-slot": "app-shell-back", "aria-label": `Back to ${back.label}`, className: cn(buttonVariants({ variant: 'ghost', size: 'sm' }), '-ml-2 max-w-[60vw] gap-0.5 px-1.5 text-link hover:text-link pointer-coarse:h-11 md:hidden'), children: [_jsx(ChevronLeftIcon, { "aria-hidden": "true" }), _jsx("span", { className: "truncate", children: back.label })] }));
221
222
  }
222
- function AppShellSkeleton() {
223
- return (_jsxs("div", { className: "flex h-screen w-full gap-4 p-4", "data-state": "loading", children: [_jsx(Skeleton, { className: "h-full w-56 shrink-0" }), _jsxs("div", { className: "flex-1 space-y-4 pt-2", children: [_jsx(Skeleton, { className: "h-8 w-64" }), _jsx(Skeleton, { className: "h-40 w-full" })] })] }));
223
+ // While the session is checked. A bare shell's has no sidebar's column.
224
+ function AppShellSkeleton({ bare }) {
225
+ return (_jsxs("div", { className: "flex h-screen w-full gap-4 p-4", "data-state": "loading", children: [!bare && _jsx(Skeleton, { className: "h-full w-56 shrink-0" }), _jsxs("div", { className: "flex-1 space-y-4 pt-2", children: [_jsx(Skeleton, { className: "h-8 w-64" }), _jsx(Skeleton, { className: "h-40 w-full" })] })] }));
224
226
  }
225
- export function AppShell({ title, logo: Logo, nav, sidebarExtra, defaultSidebarOpen = true, version, bottomBar, navLook = 'list', lookMenu = true, search, }) {
227
+ export function AppShell({ title, logo: Logo, nav, sidebarExtra, defaultSidebarOpen = true, version, bottomBar, navLook = 'list', lookMenu = true, search, frame = 'full', }) {
226
228
  const { user, status, error, retry, logout } = useAuth();
227
229
  const location = useLocation();
228
230
  const reporter = useErrorReporter();
@@ -239,8 +241,18 @@ export function AppShell({ title, logo: Logo, nav, sidebarExtra, defaultSidebarO
239
241
  // The header's palette, for the bottom bar's Search.
240
242
  const paletteRef = useRef(null);
241
243
  const trailSlot = useMemo(() => ({ set, clear }), [set, clear]);
244
+ const logOut = useCallback(() => {
245
+ setIsLoggingOut(true);
246
+ // The records opened lately are this person's: the next to sign in on
247
+ // this device doesn't see them.
248
+ clearRecentRecords();
249
+ // A failed request still ends the session on screen (AuthProvider), so
250
+ // this stays a deliberate logout: a clean /login, never the previous
251
+ // user's page as `from`.
252
+ logout().catch(() => { });
253
+ }, [logout]);
242
254
  if (status === 'loading') {
243
- return _jsx(AppShellSkeleton, {});
255
+ return _jsx(AppShellSkeleton, { bare: frame === 'bare' });
244
256
  }
245
257
  // The session check itself failed (backend down, network) — not the same
246
258
  // as logged out, so don't send the user to a login form that can't work.
@@ -258,6 +270,9 @@ export function AppShell({ title, logo: Logo, nav, sidebarExtra, defaultSidebarO
258
270
  const from = `${location.pathname}${location.search}${location.hash}`;
259
271
  return _jsx(Navigate, { to: "/login", replace: true, state: isLoggingOut ? undefined : { from } });
260
272
  }
273
+ if (frame === 'bare') {
274
+ return (_jsxs(TooltipProvider, { children: [reporter && _jsx(ReportRoutePattern, { reporter: reporter }), _jsx(LogOutContext.Provider, { value: logOut, children: _jsxs("div", { "data-slot": "app-shell-column", "data-frame": "bare", className: "flex min-h-svh w-full min-w-0 flex-col bg-background", children: [_jsx(OfflineNotice, {}), _jsx("main", { "data-slot": "app-shell-main", className: "min-w-0 flex-1 p-6", children: _jsx(Outlet, {}) })] }) }), _jsx(Toaster, {})] }));
275
+ }
261
276
  const activeTo = activeNavTo(nav, location.pathname);
262
277
  const barItems = bottomBarItems(bottomBar, search !== undefined);
263
278
  const hasBar = barItems.length > 0;
@@ -266,14 +281,5 @@ export function AppShell({ title, logo: Logo, nav, sidebarExtra, defaultSidebarO
266
281
  const trail = ownTrail ?? navTrail(nav, location.pathname);
267
282
  const groups = navGroups(nav);
268
283
  const renderGroup = (group, groupIndex) => (group.look ?? navLook) === 'tiles' ? (_jsx(TilesNavGroup, { group: group, activeTo: activeTo }, `${group.placement ?? 'top'}:${groupIndex}:${group.label ?? ''}`)) : group.collapsible && group.label !== undefined ? (_jsx(CollapsibleNavGroup, { group: { ...group, label: group.label }, activeTo: activeTo }, `${group.placement ?? 'top'}:${groupIndex}:${group.label}`)) : (_jsxs(SidebarGroup, { children: [group.label !== undefined && _jsx(SidebarGroupLabel, { children: group.label }), _jsx(SidebarGroupContent, { children: _jsx(NavMenu, { items: group.items, activeTo: activeTo }) })] }, `${group.placement ?? 'top'}:${groupIndex}:${group.label ?? ''}`));
269
- return (_jsxs(TooltipProvider, { children: [reporter && _jsx(ReportRoutePattern, { reporter: reporter }), _jsxs(SidebarProvider, { defaultOpen: storedSidebarOpen(defaultSidebarOpen), children: [_jsx(CloseMobileSidebarOnNavigate, {}), _jsx("nav", { "aria-label": "Primary", children: _jsxs(Sidebar, { collapsible: "icon", children: [_jsx(SidebarHeader, { children: _jsxs("div", { className: "flex items-center gap-2 px-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0", children: [Logo && (_jsx(Logo, { "aria-hidden": "true", className: "size-5 shrink-0 text-sidebar-foreground group-data-[collapsible=icon]:size-4" })), _jsx("span", { className: "truncate text-sm font-semibold text-sidebar-foreground group-data-[collapsible=icon]:hidden", children: title })] }) }), _jsxs(SidebarContent, { children: [groups.filter((group) => !group.placement).map(renderGroup), sidebarExtra, groups.some((group) => group.placement) && (_jsx("div", { "data-slot": "nav-foot", className: "mt-auto flex flex-col", children: groups.filter((group) => group.placement).map(renderGroup) }))] }), _jsxs(SidebarFooter, { children: [version && _jsx(VersionEntry, { version: version }), _jsxs("div", { className: "flex items-center justify-between gap-2 px-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0", children: [_jsx("span", { className: "truncate type-caption text-sidebar-foreground/70 group-data-[collapsible=icon]:hidden", children: user.name }), _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": "Log Out", onClick: () => {
270
- setIsLoggingOut(true);
271
- // The records opened lately are this person's: the
272
- // next to sign in on this device doesn't see them.
273
- clearRecentRecords();
274
- // A failed request still ends the session on screen
275
- // (AuthProvider), so this stays a deliberate logout: a
276
- // clean /login, never the previous user's page as `from`.
277
- logout().catch(() => { });
278
- }, children: _jsx(LogOutIcon, {}) })] })] })] }) }), _jsx(PageTrailContext.Provider, { value: trailSlot, children: _jsxs("div", { "data-slot": "app-shell-column", className: "flex w-full min-w-0 flex-1 flex-col bg-background", children: [_jsxs("header", { className: "flex h-14 shrink-0 items-center gap-2 border-b border-border px-4", children: [back && _jsx(PhoneBack, { back: back }), _jsx(SidebarTrigger, { className: cn(back && hasBar && 'max-md:hidden') }), _jsx("div", { "data-slot": "app-shell-trail", className: "min-w-0 flex-1", children: trail.length > 0 && _jsx(PageTrail, { crumbs: trail, "aria-label": "You are here", className: "max-md:hidden" }) }), search && _jsx(SearchPalette, { ref: paletteRef, search: search, nav: nav, onBar: bottomBarHasSearch(barItems) }), _jsx(LookControl, { menu: lookMenu })] }), _jsx(OfflineNotice, {}), _jsx(SidebarInset, { className: "min-w-0", children: _jsx("div", { className: cn('flex-1 p-6', hasBar && BOTTOM_BAR_PADDING), children: _jsx(Outlet, {}) }) })] }) }), hasBar && (_jsx(BottomBar, { items: barItems, nav: nav, activeTo: activeTo, navLook: navLook, onSearch: (opener) => paletteRef.current?.openFrom(opener) }))] }), _jsx(Toaster, {})] }));
284
+ return (_jsxs(TooltipProvider, { children: [reporter && _jsx(ReportRoutePattern, { reporter: reporter }), _jsx(LogOutContext.Provider, { value: logOut, children: _jsxs(SidebarProvider, { defaultOpen: storedSidebarOpen(defaultSidebarOpen), children: [_jsx(CloseMobileSidebarOnNavigate, {}), _jsx("nav", { "aria-label": "Primary", children: _jsxs(Sidebar, { collapsible: "icon", children: [_jsx(SidebarHeader, { children: _jsxs("div", { className: "flex items-center gap-2 px-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0", children: [Logo && (_jsx(Logo, { "aria-hidden": "true", className: "size-5 shrink-0 text-sidebar-foreground group-data-[collapsible=icon]:size-4" })), _jsx("span", { className: "truncate text-sm font-semibold text-sidebar-foreground group-data-[collapsible=icon]:hidden", children: title })] }) }), _jsxs(SidebarContent, { children: [groups.filter((group) => !group.placement).map(renderGroup), sidebarExtra, groups.some((group) => group.placement) && (_jsx("div", { "data-slot": "nav-foot", className: "mt-auto flex flex-col", children: groups.filter((group) => group.placement).map(renderGroup) }))] }), _jsxs(SidebarFooter, { children: [version && _jsx(VersionEntry, { version: version }), _jsxs("div", { className: "flex items-center justify-between gap-2 px-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0", children: [_jsx("span", { className: "truncate type-caption text-sidebar-foreground/70 group-data-[collapsible=icon]:hidden", children: user.name }), _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": "Log Out", onClick: logOut, children: _jsx(LogOutIcon, {}) })] })] })] }) }), _jsx(PageTrailContext.Provider, { value: trailSlot, children: _jsxs("div", { "data-slot": "app-shell-column", className: "flex w-full min-w-0 flex-1 flex-col bg-background", children: [_jsxs("header", { className: "flex h-14 shrink-0 items-center gap-2 border-b border-border px-4", children: [back && _jsx(PhoneBack, { back: back }), _jsx(SidebarTrigger, { className: cn(back && hasBar && 'max-md:hidden') }), _jsx("div", { "data-slot": "app-shell-trail", className: "min-w-0 flex-1", children: trail.length > 0 && _jsx(PageTrail, { crumbs: trail, "aria-label": "You are here", className: "max-md:hidden" }) }), search && _jsx(SearchPalette, { ref: paletteRef, search: search, nav: nav, onBar: bottomBarHasSearch(barItems) }), _jsx(LookControl, { menu: lookMenu })] }), _jsx(OfflineNotice, {}), _jsx(SidebarInset, { className: "min-w-0", children: _jsx("div", { className: cn('flex-1 p-6', hasBar && BOTTOM_BAR_PADDING), children: _jsx(Outlet, {}) }) })] }) }), hasBar && (_jsx(BottomBar, { items: barItems, nav: nav, activeTo: activeTo, navLook: navLook, onSearch: (opener) => paletteRef.current?.openFrom(opener) }))] }) }), _jsx(Toaster, {})] }));
279
285
  }
@@ -0,0 +1,5 @@
1
+ import { type AppShellVersion } from './app-shell-version.js';
2
+ export declare function AppVersion({ version, className }: {
3
+ version: AppShellVersion;
4
+ className?: string;
5
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // Which build is live, as the shell's sidebar footer says it ("Version
3
+ // abc1234 · PR #12"), linking to its PR or commit: for an app that shows it
4
+ // somewhere of its own (a bare shell has no sidebar). Nothing without a
5
+ // commit, so development shows nothing.
6
+ import { versionHref, versionLabel } from './app-shell-version.js';
7
+ import { cn } from 'cn';
8
+ export function AppVersion({ version, className }) {
9
+ const label = versionLabel(version);
10
+ if (!label)
11
+ return null;
12
+ const href = versionHref(version);
13
+ const classes = cn('type-caption text-muted-foreground', className);
14
+ return href ? (_jsx("a", { href: href, target: "_blank", rel: "noreferrer", "data-slot": "app-version", className: cn(classes, 'hover:underline'), children: label })) : (_jsx("span", { "data-slot": "app-version", className: classes, children: label }));
15
+ }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export { AppShell, type AppShellProps, type AppShellSearch, type RecentRecord, type SearchRecord, type AppShellVersion, type BottomBarItem, type NavEntry, type NavItem, type NavLook, type NavSection, } from './components/app/app-shell.js';
2
2
  export { navItems, navPathname } from './components/app/app-shell-nav.js';
3
+ export { useLogOut } from './components/app/app-shell-log-out.js';
4
+ export { AppVersion } from './components/app/app-version.js';
3
5
  export type { IconComponent } from './components/app/icon-component.js';
4
6
  export { Board, type BoardColumn, type BoardGroup, type BoardMoveTarget, type BoardPlace, type BoardProps } from './components/app/board.js';
5
7
  export { SpinWheel, type SpinWheelProps } from './components/app/spin-wheel.js';
package/dist/index.js CHANGED
@@ -5,6 +5,8 @@
5
5
  // Composites
6
6
  export { AppShell, } from './components/app/app-shell.js';
7
7
  export { navItems, navPathname } from './components/app/app-shell-nav.js';
8
+ export { useLogOut } from './components/app/app-shell-log-out.js';
9
+ export { AppVersion } from './components/app/app-version.js';
8
10
  export { Board } from './components/app/board.js';
9
11
  export { SpinWheel } from './components/app/spin-wheel.js';
10
12
  export { pickSpinWheelIndex } from './components/app/spin-wheel-pick.js';
@@ -1,5 +1,5 @@
1
1
  import { type DeviceChoiceStore, type StorageLike } from './device-choice.js';
2
- export declare const PALETTES: readonly ["graphite-periwinkle", "graphite-amber", "graphite-sky", "graphite-green"];
2
+ export declare const PALETTES: readonly ["graphite-periwinkle", "graphite-amber", "graphite-silver", "graphite-green"];
3
3
  export type PaletteName = (typeof PALETTES)[number];
4
4
  /** Each palette's name as a person reads it, in the picker's order. */
5
5
  export declare const PALETTE_LABELS: Record<PaletteName, string>;
@@ -12,12 +12,12 @@
12
12
  // it is never in the picker, and it has no glow. Its block is
13
13
  // `[data-palette="<name>"]` on top of :root.
14
14
  import { browserStorage, createDeviceChoiceStore, otherTabsSubscriber } from './device-choice.js';
15
- export const PALETTES = ['graphite-periwinkle', 'graphite-amber', 'graphite-sky', 'graphite-green'];
15
+ export const PALETTES = ['graphite-periwinkle', 'graphite-amber', 'graphite-silver', 'graphite-green'];
16
16
  /** Each palette's name as a person reads it, in the picker's order. */
17
17
  export const PALETTE_LABELS = {
18
18
  'graphite-periwinkle': 'Graphite and Periwinkle',
19
19
  'graphite-amber': 'Graphite and Amber',
20
- 'graphite-sky': 'Graphite and Sky',
20
+ 'graphite-silver': 'Graphite and Silver',
21
21
  'graphite-green': 'Graphite and Green',
22
22
  };
23
23
  /** Where a device's chosen palette is kept. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tristan2828/ui-foundation",
3
- "version": "5.1.0",
3
+ "version": "6.0.0",
4
4
  "description": "Shared UI foundation for contract-first, database-backed React apps: shadcn primitives, DataTable/EntityForm composites, auth, the gateway error seam, design tokens, lint rules and the AI playbook.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/styles/theme.css CHANGED
@@ -317,16 +317,18 @@
317
317
  * strong-border on bg 2.89: under 3:1, kept as designed (axe does
318
318
  * not check borders)
319
319
  *
320
- * Each main colour, listed Periwinkle / Amber / Sky / Green:
321
- * accent on bg 4.87 / 4.99 / 5.25 / 5.54, on card 4.32 / 4.43 /
322
- * 4.66 / 4.92: never small text; the ring and fills only
323
- * on-accent on accent 5.28 / 5.43 / 5.68 / 5.97
324
- * accent-light on bg 10.4 / 10.4 / 10.6 / 10.9, on card 9.19 / 9.23 /
325
- * 9.44 / 9.65, on raised 7.95 at the least: links
320
+ * Each main colour, listed Periwinkle / Amber / Silver / Green:
321
+ * accent on bg 4.87 / 4.99 / 10.8 / 5.54, on card 4.32 / 4.43 /
322
+ * 9.61 / 4.92: never small text; the ring and fills only
323
+ * on-accent on accent 5.28 / 5.43 / 10.8 / 5.97
324
+ * accent-light on bg 10.4 / 10.4 / 16.4 / 10.9, on card 9.19 / 9.23 /
325
+ * 14.6 / 9.65, on raised 7.95 at the least: links
326
326
  * accent-deep a chart's third series, never text
327
- * second on card 5.08 / 5.07 / 5.24 / 5.50
328
- * Amber, Sky and Green are Periwinkle's lightness and strength in
329
- * OKLCH, at their own hue.
327
+ * second on card 5.08 / 5.07 / 5.31 / 5.50
328
+ * Amber and Green are Periwinkle's lightness and strength in OKLCH, at
329
+ * their own hue. Silver is the neutral one, no hue: its links and
330
+ * picked states are near-white, so they need a cue besides colour
331
+ * (#466), and its chart series are greys (#467).
330
332
  */
331
333
  --palette-graphite-background: #171717;
332
334
  --palette-graphite-panel: #222222;
@@ -348,11 +350,11 @@
348
350
  --palette-graphite-amber-on-accent: #160a00;
349
351
  --palette-graphite-amber-second: #e86d40;
350
352
 
351
- --palette-graphite-sky-accent: #0093d7;
352
- --palette-graphite-sky-accent-light: #97cef5;
353
- --palette-graphite-sky-accent-deep: #006697;
354
- --palette-graphite-sky-on-accent: #000f1b;
355
- --palette-graphite-sky-second: #7b8bfa;
353
+ --palette-graphite-silver-accent: #c9c9c9;
354
+ --palette-graphite-silver-accent-light: #f5f5f5;
355
+ --palette-graphite-silver-accent-deep: #737373;
356
+ --palette-graphite-silver-on-accent: #171717;
357
+ --palette-graphite-silver-second: #959595;
356
358
 
357
359
  --palette-graphite-green-accent: #06a54c;
358
360
  --palette-graphite-green-accent-light: #a2d6ab;
@@ -1280,12 +1282,12 @@
1280
1282
  --palette-main-second: var(--palette-graphite-amber-second);
1281
1283
  }
1282
1284
 
1283
- .dark[data-palette="graphite-sky"] {
1284
- --palette-main-accent: var(--palette-graphite-sky-accent);
1285
- --palette-main-accent-light: var(--palette-graphite-sky-accent-light);
1286
- --palette-main-accent-deep: var(--palette-graphite-sky-accent-deep);
1287
- --palette-main-on-accent: var(--palette-graphite-sky-on-accent);
1288
- --palette-main-second: var(--palette-graphite-sky-second);
1285
+ .dark[data-palette="graphite-silver"] {
1286
+ --palette-main-accent: var(--palette-graphite-silver-accent);
1287
+ --palette-main-accent-light: var(--palette-graphite-silver-accent-light);
1288
+ --palette-main-accent-deep: var(--palette-graphite-silver-accent-deep);
1289
+ --palette-main-on-accent: var(--palette-graphite-silver-on-accent);
1290
+ --palette-main-second: var(--palette-graphite-silver-second);
1289
1291
  }
1290
1292
 
1291
1293
  .dark[data-palette="graphite-green"] {
package/vite/index.d.ts CHANGED
@@ -36,7 +36,7 @@ export type PwaOptions = {
36
36
  * below default to its accent, its text on the accent and its background
37
37
  * instead of the light theme's.
38
38
  */
39
- palette?: 'graphite-periwinkle' | 'graphite-amber' | 'graphite-sky' | 'graphite-green' | 'palm-lcd'
39
+ palette?: 'graphite-periwinkle' | 'graphite-amber' | 'graphite-silver' | 'graphite-green' | 'palm-lcd'
40
40
  /** `#rrggbb`. Defaults to the package's `--primary` token (or the palette's accent). */
41
41
  themeColor?: string
42
42
  /** The letter's colour on the SVG icon, `#rrggbb`. Defaults to `--primary-foreground`. */