@tristan2828/ui-foundation 4.132.0 → 4.133.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,44 +3,45 @@
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 53–162
7
- - [Glow](#glow) · lines 164–183
8
- - [Semantic tones](#semantic-tones) · lines 185–213
9
- - [The three badge styles](#the-three-badge-styles) · lines 215–232
10
- - [Status marks](#status-marks) · lines 234–279
11
- - [Mapping an enum to tones](#mapping-an-enum-to-tones) · lines 281–310
12
- - [Glyphs and icons: 3:1](#glyphs-and-icons-31) · lines 312–325
13
- - [Logos and brand marks](#logos-and-brand-marks) · lines 327–371
14
- - [Categorical colour](#categorical-colour) · lines 373–443
15
- - [Heat scale](#heat-scale) · lines 445–506
16
- - [Depth ramps](#depth-ramps) · lines 508–593
17
- - [A stored colour](#a-stored-colour) · lines 595–652
18
- - [Shapes and sizes](#shapes-and-sizes) · lines 654–675
19
- - [Typography](#typography) · lines 677–848
20
- - [Words on screen: Title Case and sentence case](#words-on-screen-title-case-and-sentence-case) · lines 711–744
21
- - [Written text (notes)](#written-text-notes) · lines 746–848
22
- - [Density](#density) · lines 850–943
23
- - [Rows on this device](#rows-on-this-device) · lines 916–943
24
- - [Widget cards (hub pages)](#widget-cards-hub-pages) · lines 945–1059
25
- - [Module cards (a hub's places)](#module-cards-a-hubs-places) · lines 1061–1138
26
- - [Notices](#notices) · lines 1140–1168
27
- - [A value over time](#a-value-over-time) · lines 1170–1300
28
- - [Several values over time](#several-values-over-time) · lines 1219–1257
29
- - [Parts of a whole over time](#parts-of-a-whole-over-time) · lines 1259–1300
30
- - [A list as a board](#a-list-as-a-board) · lines 1302–1418
31
- - [Order, groups and the header (4.131)](#order-groups-and-the-header-4131) · lines 1355–1418
32
- - [A list as cards](#a-list-as-cards) · lines 1420–1466
33
- - [Images full screen](#images-full-screen) · lines 1468–1514
34
- - [Key numbers on a record](#key-numbers-on-a-record) · lines 1516–1552
35
- - [Parts of the page standards](#parts-of-the-page-standards) · lines 1554–1624
36
- - [A few equal things](#a-few-equal-things) · lines 1626–1746
37
- - [An overview page](#an-overview-page) · lines 1748–1819
38
- - [A record's header and empty values](#a-records-header-and-empty-values) · lines 1820–1886
39
- - [A record's tabs, mark and facts](#a-records-tabs-mark-and-facts) · lines 1888–2025
40
- - [Picking at random](#picking-at-random) · lines 2027–2058
41
- - [Filling in what's missing](#filling-in-whats-missing) · lines 2060–2127
42
- - [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines 2129–2154
43
- - [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines 2156–2252
6
+ - [Palettes](#palettes) · lines 54–163
7
+ - [Glow](#glow) · lines 165–184
8
+ - [Semantic tones](#semantic-tones) · lines 186–214
9
+ - [The three badge styles](#the-three-badge-styles) · lines 216–233
10
+ - [Status marks](#status-marks) · lines 235–280
11
+ - [Mapping an enum to tones](#mapping-an-enum-to-tones) · lines 282–311
12
+ - [Glyphs and icons: 3:1](#glyphs-and-icons-31) · lines 313–326
13
+ - [Logos and brand marks](#logos-and-brand-marks) · lines 328–372
14
+ - [Categorical colour](#categorical-colour) · lines 374–444
15
+ - [Heat scale](#heat-scale) · lines 446–507
16
+ - [Depth ramps](#depth-ramps) · lines 509–594
17
+ - [A stored colour](#a-stored-colour) · lines 596–653
18
+ - [Shapes and sizes](#shapes-and-sizes) · lines 655–676
19
+ - [Typography](#typography) · lines 678–849
20
+ - [Words on screen: Title Case and sentence case](#words-on-screen-title-case-and-sentence-case) · lines 712–745
21
+ - [Written text (notes)](#written-text-notes) · lines 747–849
22
+ - [Density](#density) · lines 851–971
23
+ - [Rows on this device](#rows-on-this-device) · lines 917–944
24
+ - [Page width (a record on a wide screen)](#page-width-a-record-on-a-wide-screen) · lines 946–971
25
+ - [Widget cards (hub pages)](#widget-cards-hub-pages) · lines 973–1087
26
+ - [Module cards (a hub's places)](#module-cards-a-hubs-places) · lines 1089–1166
27
+ - [Notices](#notices) · lines 1168–1196
28
+ - [A value over time](#a-value-over-time) · lines 1198–1328
29
+ - [Several values over time](#several-values-over-time) · lines 1247–1285
30
+ - [Parts of a whole over time](#parts-of-a-whole-over-time) · lines 1287–1328
31
+ - [A list as a board](#a-list-as-a-board) · lines 1330–1446
32
+ - [Order, groups and the header (4.131)](#order-groups-and-the-header-4131) · lines 1383–1446
33
+ - [A list as cards](#a-list-as-cards) · lines 1448–1494
34
+ - [Images full screen](#images-full-screen) · lines 1496–1542
35
+ - [Key numbers on a record](#key-numbers-on-a-record) · lines 1544–1580
36
+ - [Parts of the page standards](#parts-of-the-page-standards) · lines 1582–1652
37
+ - [A few equal things](#a-few-equal-things) · lines 1654–1774
38
+ - [An overview page](#an-overview-page) · lines 1776–1847
39
+ - [A record's header and empty values](#a-records-header-and-empty-values) · lines 1848–1914
40
+ - [A record's tabs, mark and facts](#a-records-tabs-mark-and-facts) · lines 1916–2053
41
+ - [Picking at random](#picking-at-random) · lines 2055–2086
42
+ - [Filling in what's missing](#filling-in-whats-missing) · lines 2088–2155
43
+ - [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines 2157–2182
44
+ - [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines 2184–2280
44
45
 
45
46
  <!-- /index -->
46
47
 
@@ -942,6 +943,33 @@ toggle in an app without a palette).
942
943
  - Content inside cells (an inline editor, a button, a badge) must fit both
943
944
  heights; check a cell like that at both.
944
945
 
946
+ ### Page width (a record on a wide screen)
947
+
948
+ A record page (`EntityView`) keeps a reading width: its column is at most
949
+ `max-w-4xl`, and with a facts rail the page is that plus the 300px rail.
950
+ On a TV the right of the page is then empty. `data-width="wide"` on
951
+ `<html>` (4.133) lifts the cap: the column fills the page and the rail
952
+ stays 300px, moving right with it.
953
+
954
+ ```ts
955
+ // The app's own Page Width setting, kept per browser, applied before first paint.
956
+ document.documentElement.dataset.width = wide ? 'wide' : ''
957
+ ```
958
+
959
+ - **The app owns the setting**, as it owns Text Size: a field on its
960
+ settings page, kept in `localStorage`, set on `<html>` by a script in
961
+ `index.html` so the first paint has it. Regular (no attribute) is the
962
+ layout as it always was.
963
+ - **Only the record page widens.** A record in a dialog over its list
964
+ keeps the dialog's size (the rule skips anything inside
965
+ `role="dialog"`); a phone is unchanged, since the column already fills
966
+ it; lists already take the content's width.
967
+ - **Long text reflows to the column**: notes and tabs fill it; the
968
+ Details tab keeps its own 42rem.
969
+ - Anything else of the package's that should follow it uses the
970
+ `page-wide:` variant (`page-wide:max-w-none`), which has the same
971
+ dialog rule.
972
+
945
973
  ## Widget cards (hub pages)
946
974
 
947
975
  A hub page (an app's home screen) shows a few small widgets from
@@ -213,7 +213,8 @@ const RAIL_LAYOUT = {
213
213
  // first section of the open tab (beside the tab's content, never its bar),
214
214
  // or the first card when the record's first content isn't the tabs (4.108).
215
215
  const FACTS_RAIL = {
216
- page: 'max-w-[calc(var(--container-4xl)+var(--spacing)*6+300px)]',
216
+ // Page width wide (data-width="wide" on <html>): no cap, the column fills the page.
217
+ page: 'max-w-[calc(var(--container-4xl)+var(--spacing)*6+300px)] page-wide:max-w-none',
217
218
  columns: 'grid grid-cols-[minmax(0,1fr)_300px] items-start gap-6',
218
219
  main: 'flex min-w-0 flex-col gap-6',
219
220
  rail: 'col-start-2 row-start-1 flex min-w-0 flex-col gap-6',
@@ -236,7 +237,7 @@ function EntityViewSkeleton({ layout, mobileOrder }) {
236
237
  const main = (_jsx("div", { className: RAIL_LAYOUT.main, children: _jsx(SkeletonCard, { rows: 6, stacked: false }) }));
237
238
  return (_jsxs("div", { className: RAIL_LAYOUT.page, "data-state": "loading", "data-layout": "rail", children: [header, _jsxs("div", { className: RAIL_LAYOUT.columns, children: [mobileOrder === 'main-first' && main, _jsx("div", { className: cn(RAIL_LAYOUT.rail, 'flex flex-col gap-6'), children: _jsx(SkeletonCard, { rows: 4, stacked: true }) }), mobileOrder === 'rail-first' && main] })] }));
238
239
  }
239
- return (_jsxs("div", { className: "flex max-w-4xl flex-col gap-6", "data-state": "loading", children: [header, Array.from({ length: 2 }, (_, section) => (_jsx(SkeletonCard, { rows: 4, stacked: false }, section)))] }));
240
+ return (_jsxs("div", { className: "flex max-w-4xl flex-col gap-6 page-wide:max-w-none", "data-state": "loading", children: [header, Array.from({ length: 2 }, (_, section) => (_jsx(SkeletonCard, { rows: 4, stacked: false }, section)))] }));
240
241
  }
241
242
  // The rail's top offset (top-6) plus as much again below it.
242
243
  const RAIL_MARGIN_PX = 48;
@@ -469,5 +470,5 @@ export function EntityView({ title, documentTitle, titleEdit, leading, subtitle,
469
470
  }
470
471
  return (_jsx(EditInPlaceContext.Provider, { value: store, children: _jsx(EmptyContext.Provider, { value: { text: emptyText, fold: emptyFields === 'fold' }, children: _jsx(BesideFactsRailContext.Provider, { value: railFacts.length > 0, children: _jsxs("div", { ref: setRoot, className: layout === 'rail' && !card
471
472
  ? RAIL_LAYOUT.page
472
- : cn('flex flex-col', railFacts.length > 0 ? FACTS_RAIL.page : 'max-w-4xl', card ? 'gap-4' : 'gap-6'), "data-facts-rail": railFacts.length > 0 ? '' : undefined, "data-state": "success", "data-layout": layout, "data-look": card ? 'card' : undefined, children: [editing && _jsx(LeaveGuard, { store: store }), !dialog && !trail && _jsx(BackLink, { back: back }), !dialog && trail && !inShell && _jsx(PageTrail, { crumbs: trail }), _jsxs("header", { className: card ? 'flex items-start justify-between gap-3' : 'flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between', children: [_jsxs("div", { className: cn('flex min-w-0 flex-1 items-start gap-3', !card && 'sm:min-w-64 sm:gap-4'), children: [leading && (_jsx("div", { "data-slot": "entity-view-leading", className: "flex shrink-0 items-center", children: leading })), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [_jsxs("div", { "data-slot": "entity-view-title-line", className: "flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2", children: [_jsx("h1", { id: dialog?.titleId, className: cn('min-w-0 max-w-full break-words text-foreground', card ? 'type-section-title' : 'type-page-title'), children: titleEdit ? (_jsx(EditableField, { label: titleEdit.label, edit: titleEdit, layout: "inline", keepPencilRoom: true, children: title })) : (title) }), badges && (_jsx(KeepPencilRoomContext.Provider, { value: true, children: _jsx("div", { "data-slot": "entity-view-badges", className: "flex flex-wrap items-center gap-1.5", children: badges }) }))] }), subtitle && (_jsx("div", { "data-slot": "entity-view-subtitle", className: "type-body break-words text-muted-foreground", children: subtitle }))] })] }), card ? (_jsxs("div", { "data-slot": "entity-view-card-controls", className: "flex shrink-0 items-center gap-1", children: [printButton, actions, dialog?.controls] })) : ((actions || printButton) && (_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2 has-[[data-slot=action-hint]]:items-start sm:justify-end", children: [printButton, actions] })))] }), _jsx("div", { role: "status", "data-slot": "entity-view-notice", className: "empty:hidden", children: notice }), strip && (!card || cardStrip) && _jsx("div", { "data-slot": "entity-view-strip", children: strip }), body, footer && (_jsx("footer", { "data-slot": "entity-view-footer", className: "type-caption text-muted-foreground", children: footer }))] }) }) }) }));
473
+ : cn('flex flex-col', railFacts.length > 0 ? FACTS_RAIL.page : 'max-w-4xl page-wide:max-w-none', card ? 'gap-4' : 'gap-6'), "data-facts-rail": railFacts.length > 0 ? '' : undefined, "data-state": "success", "data-layout": layout, "data-look": card ? 'card' : undefined, children: [editing && _jsx(LeaveGuard, { store: store }), !dialog && !trail && _jsx(BackLink, { back: back }), !dialog && trail && !inShell && _jsx(PageTrail, { crumbs: trail }), _jsxs("header", { className: card ? 'flex items-start justify-between gap-3' : 'flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between', children: [_jsxs("div", { className: cn('flex min-w-0 flex-1 items-start gap-3', !card && 'sm:min-w-64 sm:gap-4'), children: [leading && (_jsx("div", { "data-slot": "entity-view-leading", className: "flex shrink-0 items-center", children: leading })), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [_jsxs("div", { "data-slot": "entity-view-title-line", className: "flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2", children: [_jsx("h1", { id: dialog?.titleId, className: cn('min-w-0 max-w-full break-words text-foreground', card ? 'type-section-title' : 'type-page-title'), children: titleEdit ? (_jsx(EditableField, { label: titleEdit.label, edit: titleEdit, layout: "inline", keepPencilRoom: true, children: title })) : (title) }), badges && (_jsx(KeepPencilRoomContext.Provider, { value: true, children: _jsx("div", { "data-slot": "entity-view-badges", className: "flex flex-wrap items-center gap-1.5", children: badges }) }))] }), subtitle && (_jsx("div", { "data-slot": "entity-view-subtitle", className: "type-body break-words text-muted-foreground", children: subtitle }))] })] }), card ? (_jsxs("div", { "data-slot": "entity-view-card-controls", className: "flex shrink-0 items-center gap-1", children: [printButton, actions, dialog?.controls] })) : ((actions || printButton) && (_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2 has-[[data-slot=action-hint]]:items-start sm:justify-end", children: [printButton, actions] })))] }), _jsx("div", { role: "status", "data-slot": "entity-view-notice", className: "empty:hidden", children: notice }), strip && (!card || cardStrip) && _jsx("div", { "data-slot": "entity-view-strip", children: strip }), body, footer && (_jsx("footer", { "data-slot": "entity-view-footer", className: "type-caption text-muted-foreground", children: footer }))] }) }) }) }));
473
474
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tristan2828/ui-foundation",
3
- "version": "4.132.0",
3
+ "version": "4.133.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/index.css CHANGED
@@ -28,6 +28,12 @@
28
28
 
29
29
  @custom-variant density-compact (&:where([data-density="compact"], [data-density="compact"] *));
30
30
 
31
+ /* Page width (4.133): data-width="wide" on <html> (an app's own setting,
32
+ kept per browser as Text Size's data-density is) lifts a record page's
33
+ reading cap, so its column fills a wide screen; the facts rail stays
34
+ 300px. A record in a dialog keeps the dialog's size. `page-wide:max-w-none`. */
35
+ @custom-variant page-wide (&:where([data-width="wide"] *):not(:where([role="dialog"] *, [role="alertdialog"] *)));
36
+
31
37
  @theme inline {
32
38
  --font-heading: var(--font-sans);
33
39
  --font-sans: 'Geist Variable', sans-serif;