@poodle64/ui 2026.10.25 → 2026.10.27

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 (43) hide show
  1. package/README.md +142 -182
  2. package/dist/components/feedback/report-widget.svelte +8 -33
  3. package/dist/components/ui/app-dialog/app-dialog.svelte +2 -1
  4. package/dist/components/ui/app-identity/app-identity.svelte +4 -2
  5. package/dist/components/ui/app-identity/app-identity.svelte.d.ts +1 -1
  6. package/dist/components/ui/app-shell/app-shell.svelte +300 -147
  7. package/dist/components/ui/app-shell/app-shell.svelte.d.ts +15 -37
  8. package/dist/components/ui/app-shell/column-scope.svelte +15 -0
  9. package/dist/components/ui/app-shell/column-scope.svelte.d.ts +12 -0
  10. package/dist/components/ui/app-shell/index.d.ts +4 -2
  11. package/dist/components/ui/app-shell/index.js +4 -2
  12. package/dist/components/ui/app-shell/page-aside.svelte +58 -0
  13. package/dist/components/ui/app-shell/page-aside.svelte.d.ts +30 -0
  14. package/dist/components/ui/app-shell/page-pane.svelte +73 -0
  15. package/dist/components/ui/app-shell/page-pane.svelte.d.ts +37 -0
  16. package/dist/components/ui/app-shell/page.d.ts +77 -0
  17. package/dist/components/ui/app-shell/page.js +45 -0
  18. package/dist/components/ui/app-shell/report.svelte.d.ts +10 -0
  19. package/dist/components/ui/app-shell/report.svelte.js +8 -0
  20. package/dist/components/ui/app-shell/types.d.ts +6 -4
  21. package/dist/components/ui/app-shell/types.js +7 -5
  22. package/dist/components/ui/collection-detail/collection-detail.svelte +1 -1
  23. package/dist/components/ui/content-skeleton/content-skeleton.svelte +1 -1
  24. package/dist/components/ui/context-column/context-column.svelte +47 -129
  25. package/dist/components/ui/context-column/context-column.svelte.d.ts +3 -5
  26. package/dist/components/ui/document-reader/document-reader.svelte +56 -24
  27. package/dist/components/ui/document-reader/document-reader.svelte.d.ts +5 -4
  28. package/dist/components/ui/page-section/page-section.svelte +1 -1
  29. package/dist/components/ui/panel/panel.svelte +1 -0
  30. package/dist/components/ui/settings-shell/settings-shell.svelte +67 -81
  31. package/dist/components/ui/settings-shell/settings-shell.svelte.d.ts +21 -60
  32. package/dist/styles.css +248 -120
  33. package/package.json +1 -1
  34. package/registry/component-map.json +22 -15
  35. package/registry/component-map.md +8 -7
  36. package/dist/components/ui/app-shell/measure.d.ts +0 -28
  37. package/dist/components/ui/app-shell/measure.js +0 -21
  38. package/dist/components/ui/app-shell/padding.d.ts +0 -26
  39. package/dist/components/ui/app-shell/padding.js +0 -26
  40. package/dist/components/ui/list-shell/index.d.ts +0 -2
  41. package/dist/components/ui/list-shell/index.js +0 -2
  42. package/dist/components/ui/list-shell/list-shell.svelte +0 -85
  43. package/dist/components/ui/list-shell/list-shell.svelte.d.ts +0 -39
@@ -50,7 +50,7 @@ type $$ComponentProps = {
50
50
  entitlements?: string[];
51
51
  /** Required — the whole reason this slot exists is a stamped app rendering no way to sign out. */
52
52
  onSignOut: () => void;
53
- /** Optional until the app has an account-settings destination to send it to. */
53
+ /** The "Settings" item, and Settings' one home: the rail has no row for it. Wire it to the app's settings route; absent renders no item. */
54
54
  onAccountSettings?: () => void;
55
55
  /**
56
56
  * Reach the workspace's members surface from here. Ignored while
@@ -30,19 +30,11 @@
30
30
  * carries route content the global affordance reads as global rather than as
31
31
  * part of the switcher next to it.
32
32
  *
33
- * Content WIDTH is the one dimension that came back, as `measure`, and it
34
- * came back on a measurement rather than on taste. "Always full-width" did
35
- * not remove the decision, it pushed it down into every page: a consumer was
36
- * surveyed at 2560px and had six distinct caps across nine routes, every one
37
- * of them a hand-written `mx-auto max-w-*` at the top of a `+page.svelte`,
38
- * between them using 15% to 79% of the width actually available. That is
39
- * fifteen independent guesses, not a shell shape.
40
- *
41
- * `measure` is a small named scale, chosen once in the layout, and it is not
42
- * the old `content` prop returning. It defaults to `full`, so a shell that
43
- * never mentions it renders byte-identically; its tiers are CSS custom
44
- * properties an app retunes without a release; and it exists to REPLACE
45
- * per-page width decisions rather than to offer an app a look.
33
+ * Content WIDTH is not a prop. A route declares what it is (`pageType`:
34
+ * `reading`, `panel` or `tool`, see page.ts) and the shell owns everything
35
+ * that follows from it: the column's width and centring, the gutters, the
36
+ * pane flush against the rail, the aside beside the content, and which of
37
+ * them scrolls. The less an app decides, the better (operator, 24/10/2026).
46
38
  *
47
39
  * Content TEXTURE came back the same way, on the same kind of evidence. Two
48
40
  * apps had separately built one picture — a faint dot-grid floor with a soft
@@ -78,20 +70,31 @@
78
70
  * </AppShell>
79
71
  */
80
72
  import type { Snippet } from 'svelte';
81
- import type { ShellMeasure } from './measure.js';
82
- import { CONTENT_PADDING } from './padding.js';
73
+ import {
74
+ providePageSlots,
75
+ type PageAsideRegistration,
76
+ type PageColumnState,
77
+ type PagePaneRegistration,
78
+ type PageSlots,
79
+ type PageType
80
+ } from './page.js';
81
+ import ColumnScope from './column-scope.svelte';
83
82
  import type { ShellTexture } from './texture.js';
84
83
  import { toggleMode } from 'mode-watcher';
85
84
  import Menu from '@lucide/svelte/icons/menu';
86
85
  import X from '@lucide/svelte/icons/x';
87
86
  import Search from '@lucide/svelte/icons/search';
88
- import Settings from '@lucide/svelte/icons/settings';
87
+ import MessageSquarePlus from '@lucide/svelte/icons/message-square-plus';
89
88
  import Sun from '@lucide/svelte/icons/sun';
90
89
  import Moon from '@lucide/svelte/icons/moon';
91
90
  import PanelLeftClose from '@lucide/svelte/icons/panel-left-close';
92
91
  import PanelLeftOpen from '@lucide/svelte/icons/panel-left-open';
92
+ import PanelLeft from '@lucide/svelte/icons/panel-left';
93
+ import PanelRight from '@lucide/svelte/icons/panel-right';
94
+ import * as Sheet from '../sheet/index.js';
93
95
  import AppNav from './app-nav.svelte';
94
- import { activeNavLabel, matchesPrefix, toItems, type NavSource } from './types.js';
96
+ import { activeNavTitle, toItems, type NavSource } from './types.js';
97
+ import { shellReport } from './report.svelte.js';
95
98
  import { provideShellControls, type ShellControlsSlot } from './controls.js';
96
99
  import { cn } from '../../../utils.js';
97
100
  import ResizeHandle from '../resize-handle/resize-handle.svelte';
@@ -110,18 +113,15 @@
110
113
  context,
111
114
  actions,
112
115
  identity,
113
- settingsHref,
114
- settingsLabel = 'Settings',
115
116
  onSearch,
116
117
  searchLabel = 'Search…',
117
118
  searchShortcut = '⌘K',
118
119
  searchPlacement = 'leading',
119
120
  themeToggle = true,
120
121
  onToggleTheme,
121
- padded = true,
122
- measure = 'full',
122
+ pageType = 'reading',
123
+ title,
123
124
  texture = 'grid',
124
- mainClass,
125
125
  children
126
126
  }: {
127
127
  /** Navigation: bare items, groups, or a mix. Filter for permissions first. */
@@ -174,16 +174,6 @@
174
174
  * the alternative, rendering it in both, is the duplication this file
175
175
  * exists to avoid. */
176
176
  identity?: Snippet;
177
- /** Where the Settings row at the rail's foot links. Absent renders no row.
178
- * Settings sits at the foot because configuring the app is not navigating
179
- * it, and the split reads without a label.
180
- *
181
- * The app's version does NOT live beside it. A build string earns rail
182
- * space only if it saves a trip, and it does not: Settings is on screen
183
- * at every moment and its About section is one click from here, so the
184
- * line was permanent furniture duplicating the thing directly above it. */
185
- settingsHref?: string;
186
- settingsLabel?: string;
187
177
  /** Provide to render the search affordance. Usually opens a CommandPalette. */
188
178
  onSearch?: () => void;
189
179
  searchLabel?: string;
@@ -200,19 +190,17 @@
200
190
  themeToggle?: boolean;
201
191
  /** Override the theme action. Defaults to mode-watcher's toggleMode. */
202
192
  onToggleTheme?: () => void;
203
- padded?: boolean;
204
193
  /**
205
- * How wide the page body may get, from a named scale: `prose` (40rem, for
206
- * long-form running text), `page` (80rem — forms, detail views,
207
- * settings), `wide` (120rem — indexes, grids, tables, dashboards), or
208
- * `full` (no cap).
209
- *
210
- * Defaults to `full`, so a shell that does not mention it is unchanged.
211
- * Set it in the layout, once: the point is that pages stop each deciding
212
- * their own width. The cap is the content box's border box, so `padded`
213
- * spends its padding inside the measure.
194
+ * What the route is: `reading` (the default), `panel` or `tool`
195
+ * (page.ts). The route declares it; the shell owns every width, gutter
196
+ * and column that follows. Apps pass `page.data.pageType`.
197
+ */
198
+ pageType?: PageType;
199
+ /**
200
+ * The page's own name, for the bar when neither the rail nor the page's
201
+ * pane names where the reader is. Apps pass `page.data.title`.
214
202
  */
215
- measure?: ShellMeasure;
203
+ title?: string;
216
204
  /**
217
205
  * The house atmosphere on the content region: `grid` (a dot-grid floor
218
206
  * plus a corner vignette) or `none`.
@@ -228,49 +216,143 @@
228
216
  * declaration; `none` turns it off.
229
217
  */
230
218
  texture?: ShellTexture;
231
- /** Extra classes on the scrolling content container. */
232
- mainClass?: string;
233
219
  children: Snippet;
234
220
  } = $props();
235
221
 
236
222
  const hasNav = $derived(toItems(nav).length > 0);
237
223
 
238
- // The foot's Settings row owns its subtree, matched exactly as a nav `href`
239
- // is, so the row's own current state and the bar's label cannot disagree.
240
- const atSettings = $derived(
241
- !!settingsHref && !!currentPath && matchesPrefix(currentPath, settingsHref)
242
- );
224
+ // The page's own columns, registered by `<PagePane>` and `<PageAside>`.
225
+ // Raw, not deep: a registration is stored as given, so the page that made it
226
+ // can find it again to withdraw it (a deep proxy would never equal it).
227
+ class Slots implements PageSlots {
228
+ pane = $state.raw<PagePaneRegistration | null>(null);
229
+ aside = $state.raw<PageAsideRegistration | null>(null);
230
+ }
231
+ const slots = new Slots();
232
+ providePageSlots(slots);
233
+
234
+ // A page that registers a pane is a panel page, whatever its route forgot to
235
+ // say: the pane is never dropped for a missing declaration.
236
+ const type = $derived<PageType>(slots.pane ? 'panel' : pageType);
243
237
 
244
238
  // Where the user is, in words: the rail is icons when collapsed and a closed
245
- // drawer on a phone, so the bar names the section. Settings is a section like
246
- // any other and is named the same way — by the foot row's own label, since
247
- // the shell knows nothing of the pages inside it.
239
+ // drawer on a phone, so the bar names the page, "Section › Page" inside a
240
+ // section and the item's one name otherwise. A page the rail has no row for
241
+ // is named by its pane ("Settings › Account") or, failing that, its title.
248
242
  const location = $derived(
249
- activeNavLabel(nav, currentPath) ?? (atSettings ? settingsLabel : undefined)
243
+ activeNavTitle(nav, currentPath) ??
244
+ (type === 'panel' ? slots.pane?.location : undefined) ??
245
+ title
250
246
  );
251
247
 
252
248
  // The page's scope controls, registered by `<ShellControls>` from the route.
253
249
  const controls: ShellControlsSlot = $state({ content: null });
254
250
  provideShellControls(controls);
255
251
 
252
+ // A pane is a column from 64rem of window and a sheet below it; a tool or
253
+ // panel page's aside is a column from 80rem. A reading page's aside never
254
+ // becomes a sheet: below 66rem of content region it follows the column (CSS).
255
+ const PANE_WIDE = '(min-width: 64rem)';
256
+ const ASIDE_WIDE = '(min-width: 80rem)';
257
+ let paneWide = $state(true);
258
+ let asideWide = $state(true);
259
+ $effect(() => {
260
+ if (typeof window === 'undefined' || !window.matchMedia) return;
261
+ const pane = window.matchMedia(PANE_WIDE);
262
+ const aside = window.matchMedia(ASIDE_WIDE);
263
+ const sync = () => {
264
+ paneWide = pane.matches;
265
+ asideWide = aside.matches;
266
+ };
267
+ sync();
268
+ pane.addEventListener('change', sync);
269
+ aside.addEventListener('change', sync);
270
+ return () => {
271
+ pane.removeEventListener('change', sync);
272
+ aside.removeEventListener('change', sync);
273
+ };
274
+ });
275
+
276
+ const pane = $derived(type === 'panel' ? slots.pane : null);
277
+ const aside = $derived(slots.aside);
278
+ const paneColumn = $derived(pane !== null && paneWide);
279
+ const asideMode = $derived<PageColumnState['mode'] | null>(
280
+ aside === null
281
+ ? null
282
+ : type === 'reading'
283
+ ? 'stacked'
284
+ : asideWide
285
+ ? 'column'
286
+ : 'sheet'
287
+ );
288
+
289
+ // The page may arrange itself around where its pane is drawn.
290
+ $effect(() => {
291
+ pane?.onmode?.(paneColumn ? 'column' : 'sheet');
292
+ });
293
+
294
+ // The fold is the reader's, remembered under the pane's own key.
295
+ let paneFolded = $state(false);
296
+ const foldKey = $derived(pane?.folded ? pane.remember : undefined);
297
+ $effect(() => {
298
+ const key = foldKey;
299
+ if (!key) {
300
+ paneFolded = false;
301
+ return;
302
+ }
303
+ try {
304
+ paneFolded = localStorage.getItem(key) === '1';
305
+ } catch {
306
+ paneFolded = false;
307
+ }
308
+ });
309
+ function setFolded(next: boolean) {
310
+ paneFolded = next;
311
+ const key = pane?.remember;
312
+ if (!key) return;
313
+ try {
314
+ localStorage.setItem(key, next ? '1' : '0');
315
+ } catch {
316
+ // Remembered for this visit only.
317
+ }
318
+ }
319
+
320
+ let paneSheetOpen = $state(false);
321
+ let asideSheetOpen = $state(false);
322
+ // A navigation puts a sheet away, and so does the window widening into a column.
323
+ $effect(() => {
324
+ void currentPath;
325
+ paneSheetOpen = false;
326
+ asideSheetOpen = false;
327
+ });
328
+ $effect(() => {
329
+ if (paneColumn || !pane) paneSheetOpen = false;
330
+ if (asideMode !== 'sheet') asideSheetOpen = false;
331
+ });
332
+
333
+ const paneState = $derived<PageColumnState>({
334
+ mode: paneColumn ? 'column' : 'sheet',
335
+ folded: paneColumn && Boolean(pane?.folded) && paneFolded,
336
+ fold: () => setFolded(true),
337
+ unfold: () => setFolded(false),
338
+ close: () => (paneSheetOpen = false)
339
+ });
340
+ const asideState = $derived<PageColumnState>({
341
+ mode: asideMode ?? 'stacked',
342
+ folded: false,
343
+ fold: () => {},
344
+ unfold: () => {},
345
+ close: () => (asideSheetOpen = false)
346
+ });
347
+
256
348
  // Rail width is a personal preference: localStorage, one key across apps.
257
349
  // A drag below RAIL_SNAP collapses; the width survives and returns on expand.
258
350
  let railWidth = $state<number | null>(null);
259
351
  let resizing = $state(false);
260
352
 
261
- // The measure is resolved ONCE, and the class and the attribute both read
262
- // that one answer. Two independently-worded conditionals looked symmetric
263
- // and were not: Svelte omits an attribute whose value is `null`, while a
264
- // class token under the same test survives, so `measure={null}` — which the
265
- // type forbids but a loosely-typed prop bag or a nullable route field can
266
- // still deliver — produced the class with no attribute and therefore no
267
- // matching rule. Harmless to look at, but it breaks the DOM contract the
268
- // additivity gate states, and a guarantee with a hole in it is not one.
269
- const capped = $derived(measure != null && measure !== 'full' ? measure : null);
270
-
271
- // The texture resolves the same way, and for the same reason: one answer
272
- // feeding both the class and the attribute, so `texture={null}` from a
273
- // loosely-typed prop bag cannot produce a class with no matching rule.
353
+ // The texture is resolved ONCE, one answer feeding both the class and the
354
+ // attribute, so `texture={null}` from a loosely-typed prop bag cannot
355
+ // produce a class with no matching rule.
274
356
  const textured = $derived(texture != null && texture !== 'none' ? texture : null);
275
357
 
276
358
  // The disclosure toggle and the region it opens have to be programmatically
@@ -619,30 +701,25 @@
619
701
  />
620
702
 
621
703
  <!--
622
- The rail's foot. `mt-auto` pins it under the nav however short the
623
- section list is, so it sits on the rail's bottom edge rather than
624
- trailing the last section. Two things live here and nothing else:
625
- where you configure the app, and which build you are looking at.
626
-
627
- Settings is a nav row like any other and takes the same active and
628
- hover treatment, because it IS a destination — it is last rather
629
- than separate because configuring the app is not navigating it.
630
- The version is not a row: no icon, no tile, no hover, one muted
631
- line, so it reads as metadata and never competes for a click.
704
+ The drawer's foot: the one place feedback sits on a phone, where nothing
705
+ floats over the page. From md it is the bar's icon. Settings is the
706
+ account menu's, never a row here.
632
707
  -->
633
- {#if settingsHref}
708
+ {#if mobileNavOpen && shellReport.open}
634
709
  <div class="ds-shell-rail-foot mt-auto">
635
- <a
636
- href={settingsHref}
637
- class="ds-nav-item"
638
- aria-current={atSettings ? 'page' : undefined}
639
- onclick={() => (mobileNavOpen = false)}
710
+ <button
711
+ type="button"
712
+ class="ds-nav-item w-full"
713
+ data-testid="ds-shell-drawer-report"
714
+ onclick={() => {
715
+ const open = shellReport.open;
716
+ closeMobileNav();
717
+ open?.();
718
+ }}
640
719
  >
641
- <Settings class="ds-nav-icon size-[1.125rem] flex-none" aria-hidden="true" />
642
- <span class={railNarrow && !mobileNavOpen ? 'sr-only' : 'truncate'}>
643
- {settingsLabel}
644
- </span>
645
- </a>
720
+ <MessageSquarePlus class="ds-nav-icon size-[1.125rem] flex-none" aria-hidden="true" />
721
+ <span class="truncate">Report a problem</span>
722
+ </button>
646
723
  </div>
647
724
  {/if}
648
725
  {#if collapsible && !railCollapsed && !mobileNavOpen}
@@ -744,25 +821,33 @@
744
821
  <!-- Where you are, then the page's scope controls. Inline with the
745
822
  rest of the bar from xl; below that, controls take a second row
746
823
  of the bar, and a bare label shows from md and not on a phone. -->
824
+ <!-- Where you are, then the page's scope controls. From sm they share one
825
+ row, inline from xl and on the bar's second row below it. On a phone
826
+ the wrapper steps aside (`contents`): the title takes the free room
827
+ of the first row, truncated, and the controls take the second row
828
+ whole. -->
747
829
  {#if location || controls.content}
748
830
  <div
749
831
  class={cn(
750
- 'flex min-w-0 items-center gap-2 sm:gap-3',
751
- controls.content
752
- ? 'order-last basis-full xl:order-none xl:basis-auto'
753
- : 'hidden md:flex'
832
+ 'flex min-w-0 items-center gap-2 max-sm:contents sm:gap-3',
833
+ controls.content && 'sm:order-last sm:basis-full xl:order-none xl:basis-auto'
754
834
  )}
755
835
  data-testid="ds-shell-location"
756
836
  >
757
837
  {#if location}
758
838
  <span
759
- class={cn(
760
- 'text-shell-muted-foreground max-w-48 flex-none truncate text-sm',
761
- controls.content && 'max-sm:hidden'
762
- )}>{location}</span
839
+ class="text-shell-muted-foreground min-w-0 truncate text-sm max-sm:flex-1 max-sm:basis-0 sm:max-w-72"
840
+ title={location}>{location}</span
841
+ >
842
+ {/if}
843
+ {#if controls.content}
844
+ <div
845
+ class="flex min-w-0 items-center gap-2 max-sm:order-last max-sm:basis-full sm:gap-3"
846
+ data-testid="ds-shell-controls"
763
847
  >
848
+ {@render controls.content()}
849
+ </div>
764
850
  {/if}
765
- {#if controls.content}{@render controls.content()}{/if}
766
851
  </div>
767
852
  {/if}
768
853
 
@@ -773,12 +858,61 @@
773
858
  {/if}
774
859
 
775
860
  <div class="ml-auto flex flex-none items-center gap-2 sm:gap-3">
861
+ <!-- The page's own columns where they do not fit beside it: the pane
862
+ and the aside open as sheets from here, before everything the bar
863
+ carries on every page. -->
864
+ {#if pane && !paneColumn}
865
+ {@const Icon = pane.icon ?? PanelLeft}
866
+ <button
867
+ type="button"
868
+ onclick={() => (paneSheetOpen = true)}
869
+ class="border-border text-shell-muted-foreground hover:text-shell-foreground grid size-9 flex-none place-items-center rounded-md border transition-colors pointer-coarse:size-11"
870
+ aria-label={pane.label}
871
+ title={pane.label}
872
+ aria-haspopup="dialog"
873
+ aria-expanded={paneSheetOpen}
874
+ data-testid="ds-page-pane-open"
875
+ >
876
+ <Icon class="size-4" />
877
+ </button>
878
+ {/if}
879
+ {#if aside && asideMode === 'sheet'}
880
+ {@const Icon = aside.icon ?? PanelRight}
881
+ <button
882
+ type="button"
883
+ onclick={() => (asideSheetOpen = true)}
884
+ class="border-border text-shell-muted-foreground hover:text-shell-foreground grid size-9 flex-none place-items-center rounded-md border transition-colors pointer-coarse:size-11"
885
+ aria-label={aside.label}
886
+ title={aside.label}
887
+ aria-haspopup="dialog"
888
+ aria-expanded={asideSheetOpen}
889
+ data-testid="ds-page-aside-open"
890
+ >
891
+ <Icon class="size-4" />
892
+ </button>
893
+ {/if}
894
+
776
895
  {#if onSearch && searchPlacement === 'trailing'}
777
896
  {@render searchButton(
778
897
  'h-9 w-9 flex-none justify-center px-0 sm:h-auto sm:w-[clamp(180px,18vw,300px)] sm:justify-start sm:gap-2 sm:px-3 sm:py-1.5'
779
898
  )}
780
899
  {/if}
781
900
 
901
+ <!-- Feedback has one home: here from md, the drawer's foot on a phone.
902
+ Shown only while a ReportWidget is mounted to open. -->
903
+ {#if shellReport.open}
904
+ <button
905
+ type="button"
906
+ onclick={() => shellReport.open?.()}
907
+ class="border-border text-shell-muted-foreground hover:text-shell-foreground hidden size-9 flex-none place-items-center rounded-md border transition-colors md:grid"
908
+ aria-label="Report a problem"
909
+ title="Report a problem"
910
+ data-testid="ds-shell-report"
911
+ >
912
+ <MessageSquarePlus class="size-4" />
913
+ </button>
914
+ {/if}
915
+
782
916
  {#if actions}{@render actions()}{/if}
783
917
 
784
918
  {#if themeToggle}
@@ -819,9 +953,9 @@
819
953
  <!--
820
954
  `texture` paints the house atmosphere HERE, on the scroller itself,
821
955
  through `.ds-shell-texture` in styles.css. It is this element rather
822
- than the content box below because the texture is the FLOOR the page
823
- sits on: capped by `measure`, that box is narrower than the region, and
824
- a floor that stopped at the measure would be a stripe.
956
+ than the page frame below because the texture is the FLOOR the page
957
+ sits on: a reading column is narrower than the region, and a floor that
958
+ stopped at the column would be a stripe.
825
959
 
826
960
  It is a background rather than a layer, and that is the whole design
827
961
  rather than an implementation detail. An absolutely positioned child
@@ -849,62 +983,81 @@
849
983
  data-slot="app-shell-content"
850
984
  tabindex="-1"
851
985
  class={cn(
852
- 'relative flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto',
853
- textured && 'ds-shell-texture',
854
- mainClass
986
+ 'ds-shell-main relative flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto',
987
+ textured && 'ds-shell-texture'
855
988
  )}
856
989
  data-texture={textured ?? undefined}
857
990
  >
858
991
  <!--
859
- `min-w-0` on a flex child, for the same reason `<main>` and both
860
- boxes above it carry it: a flex item's default `min-width: auto` can
861
- size it by its own min-content rather than by its container.
862
-
863
- Measured rather than assumed, and the measurement is worth writing
864
- down because it contradicts the obvious reading: in THIS structure
865
- the declaration is currently INERT. The automatic minimum size
866
- applies to a flex item's MAIN axis, and `<main>` is a column, so this
867
- box's width is already cross-axis stretch and cannot grow past its
868
- container. Driving the harness at 375px and 320px, with and without
869
- the declaration, against a plain page wrapper and an `mx-auto` one,
870
- moved nothing — `harness/drive.mjs` pins that.
871
-
872
- It stays because it is the correct declaration for the box, and
873
- because the day this container becomes a row item the omission would
874
- be invisible all over again. What it is NOT is the cause of the
875
- sideways scroll in #5: that comes from a child with no scroller of
876
- its own, which no sizing rule here can prevent — only the child
877
- carrying its own scroller can, as this package's Table does. The half
878
- of that defect the shell genuinely owns is on `<main>` above.
879
- -->
880
- <!--
881
- `measure` caps and centres this box, through `.ds-shell-measure`
882
- in styles.css rather than a utility here — an arbitrary max-width
883
- utility only exists if the consumer's Tailwind build scanned the
884
- file spelling it, and a cap that silently does not compile is the
885
- failure mode this package gates against everywhere else. (Never
886
- write the utility's class name in a comment: Tailwind scans
887
- comments too, and compiles the placeholder it finds there.)
888
-
889
- At `full` the class and the attribute are both ABSENT, not set to
890
- a no-op value. That is what makes the prop additive: a consumer
891
- who never names it gets the same element, the same class string
892
- and the same declarations as before it existed, so there is
893
- nothing for the cascade to resolve differently. Both read the
894
- single `capped` answer above, so they cannot disagree.
992
+ The page's frame: one element whose type the route declared. Every
993
+ width, gutter and column is `.ds-page` in styles.css, read from
994
+ `data-page`, and no utility here: an arbitrary utility only exists if
995
+ the consumer's Tailwind build scanned this file. `data-aside` says
996
+ where the aside stands, `data-fill` that the content beside a pane
997
+ fills the frame.
895
998
  -->
896
999
  <div
897
- class={cn(
898
- 'flex min-h-0 min-w-0 flex-1 flex-col',
899
- 'w-full',
900
- capped && 'ds-shell-measure',
901
- padded && CONTENT_PADDING
902
- )}
903
- data-measure={capped ?? undefined}
1000
+ class="ds-page"
1001
+ data-page={type}
1002
+ data-aside={asideMode === 'sheet' ? undefined : (asideMode ?? undefined)}
1003
+ data-fill={pane?.fill ? '' : undefined}
904
1004
  >
905
- {@render children()}
1005
+ {#if pane && paneColumn}
1006
+ <!-- The body names itself (a list's own section, AppNav's nav). -->
1007
+ <div
1008
+ class="ds-page-pane"
1009
+ data-folded={paneState.folded ? 'true' : undefined}
1010
+ data-testid="ds-page-pane"
1011
+ >
1012
+ <ColumnScope>
1013
+ {#if paneState.folded && pane.folded}
1014
+ {@render pane.folded(paneState)}
1015
+ {:else}
1016
+ <div class="ds-page-pane-body">{@render pane.body(paneState)}</div>
1017
+ {#if pane.foot}
1018
+ <div class="ds-page-pane-foot">{@render pane.foot(paneState)}</div>
1019
+ {/if}
1020
+ {/if}
1021
+ </ColumnScope>
1022
+ </div>
1023
+ {/if}
1024
+ <div class="ds-page-main" data-slot="page-main">
1025
+ {@render children()}
1026
+ </div>
1027
+ {#if aside && asideMode !== 'sheet'}
1028
+ <aside class="ds-page-aside" aria-label={aside.label} data-testid="ds-page-aside">
1029
+ <ColumnScope>{@render aside.body(asideState)}</ColumnScope>
1030
+ </aside>
1031
+ {/if}
906
1032
  </div>
907
1033
  </main>
908
1034
  </div>
909
1035
  </div>
910
1036
  </div>
1037
+
1038
+ <!-- The page's columns as sheets, where they do not fit beside the content. -->
1039
+ {#if pane && !paneColumn}
1040
+ <Sheet.Root open={paneSheetOpen} onOpenChange={(open) => (paneSheetOpen = open)}>
1041
+ <Sheet.Content side="left" showCloseButton={false} aria-label={pane.label} class="gap-0">
1042
+ <ColumnScope>
1043
+ <div class="ds-page-pane-body">{@render pane.body(paneState)}</div>
1044
+ {#if pane.foot}
1045
+ <div class="ds-page-pane-foot">{@render pane.foot(paneState)}</div>
1046
+ {/if}
1047
+ </ColumnScope>
1048
+ </Sheet.Content>
1049
+ </Sheet.Root>
1050
+ {/if}
1051
+ {#if aside && asideMode === 'sheet'}
1052
+ <Sheet.Root open={asideSheetOpen} onOpenChange={(open) => (asideSheetOpen = open)}>
1053
+ <Sheet.Content side="right" aria-label={aside.label} class="gap-0">
1054
+ <Sheet.Header>
1055
+ <Sheet.Title>{aside.label}</Sheet.Title>
1056
+ {#if aside.description}<Sheet.Description>{aside.description}</Sheet.Description>{/if}
1057
+ </Sheet.Header>
1058
+ <div class="ds-page-aside-sheet">
1059
+ <ColumnScope>{@render aside.body(asideState)}</ColumnScope>
1060
+ </div>
1061
+ </Sheet.Content>
1062
+ </Sheet.Root>
1063
+ {/if}