@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
@@ -1,18 +1,17 @@
1
1
  <script lang="ts">
2
2
  import type { Snippet } from 'svelte';
3
- import type { HTMLAttributes } from 'svelte/elements';
4
- import { cn, type WithElementRef } from '../../../utils.js';
5
3
  import StatList from '../stat-list/stat-list.svelte';
6
4
  import type { StatItem } from '../stat-list/stat-list.svelte';
7
- import AppDialog from '../app-dialog/app-dialog.svelte';
8
5
  import Panel from '../panel/panel.svelte';
9
6
  import * as Tooltip from '../tooltip/index.js';
10
7
  import IconAction from '../list-toolbar/icon-action.svelte';
11
- import PanelRight from '@lucide/svelte/icons/panel-right';
8
+ import PageAside from '../app-shell/page-aside.svelte';
12
9
  import X from '@lucide/svelte/icons/x';
13
10
 
14
- // The persistent right-hand context column, identical on every route, in
15
- // one of two forms.
11
+ // The page's context, in one of two forms, as the page's aside: the shell
12
+ // places it by the route's page type (`PageAside`), at a tool page's right
13
+ // edge or opened from the bar as a sheet below 80rem of window, so this sets
14
+ // no width and no breakpoint of its own.
16
15
  //
17
16
  // A list page's: one standing "At a glance" stat card and, beneath it, a
18
17
  // Find or the selected row's detail (the `detail` snippet). The stat card
@@ -21,25 +20,10 @@
21
20
  //
22
21
  // A record page's (`title` and `children`): the one item the page has
23
22
  // opened, a card with its title and a close button whose body scrolls
24
- // inside it, as tall as what it holds up to the column. A click elsewhere
25
- // on the page swaps it, and it is never empty: the page opens it on what
26
- // needs the viewer first, and a close reopens that. An opened item's
27
- // document (`documentPane`, a DocumentPane) takes the column's place, and
28
- // stands beside it as a third pane once the page's row has room for three:
29
- // 1250px of row, which a 1600px screen gives with the rail open. The row,
30
- // not the screen, decides, so a folded rail or a narrow window is read
31
- // as the room the page actually has.
32
- //
33
- // Width is clamped (shared-design-language §6) so a wide screen earns
34
- // information, not emptiness. The column is a flex child of the page body row;
35
- // the stat card is shrink-0 and any detail takes the remaining height with its
36
- // own inner scroll.
37
- //
38
- // Below xl (1280px) a fixed nav rail plus a ~400px column would crush the
39
- // primary pane, so the standing `<aside>` stays hidden there — but its content
40
- // does not vanish with it. A floating trigger opens the identical content in a
41
- // dialogue instead: the column's shape is a desktop affordance, the
42
- // information inside it is not.
23
+ // inside it. A click elsewhere on the page swaps it, and it is never empty:
24
+ // the page opens it on what needs the viewer first, and a close reopens
25
+ // that. An opened item's document (`documentPane`, a DocumentPane) takes
26
+ // the item's place.
43
27
  type ListForm = {
44
28
  stats: StatItem[];
45
29
  statsTitle?: string;
@@ -60,7 +44,7 @@
60
44
  onClose?: () => void;
61
45
  /** The opened item. */
62
46
  children: Snippet;
63
- /** The opened item's document: a DocumentPane, in the column's place or beside it. */
47
+ /** The opened item's document: a DocumentPane, in the item's place. */
64
48
  documentPane?: Snippet;
65
49
  stats?: never;
66
50
  statsTitle?: never;
@@ -78,36 +62,13 @@
78
62
  onClose,
79
63
  children,
80
64
  documentPane,
81
- /** The column's name: its landmark's, its opener's and its dialogue's.
65
+ /** The column's name: its landmark's, its opener's and its sheet's.
82
66
  Defaults to the opened item's title, else the stat card's. */
83
- ariaLabel,
84
- ref = $bindable(null),
85
- class: className,
86
- ...restProps
87
- }: Omit<WithElementRef<HTMLAttributes<HTMLElement>>, 'title' | 'children'> &
88
- (ListForm | RecordForm) & { ariaLabel?: string } = $props();
67
+ ariaLabel
68
+ }: (ListForm | RecordForm) & { ariaLabel?: string } = $props();
89
69
 
90
- let sheetOpen = $state(false);
91
- /**
92
- * The page row the column stands in, by its width; null until read, so a
93
- * document is placed once rather than mounted in the column and moved.
94
- * Crossing the threshold later moves it, opening it afresh.
95
- */
96
- let row = $state<number | null>(null);
97
- $effect(() => {
98
- const parent = ref?.parentElement;
99
- if (!parent) return;
100
- row = parent.clientWidth;
101
- if (typeof ResizeObserver === 'undefined') return;
102
- const observer = new ResizeObserver(([entry]) => (row = entry?.contentRect.width ?? 0));
103
- observer.observe(parent);
104
- return () => observer.disconnect();
105
- });
106
- /** Room for the document beside the column, not in its place. */
107
- const BESIDE = 1250;
108
- const beside = $derived(row !== null && row >= BESIDE);
109
70
  const name = $derived(ariaLabel ?? title ?? statsTitle);
110
- /** The dialogue's title is the body's own heading, so the body leaves it to the dialogue. */
71
+ /** The sheet's title is the body's own heading, so the body leaves it to the sheet. */
111
72
  const headed = $derived(name === (children ? title : statsTitle));
112
73
  </script>
113
74
 
@@ -117,79 +78,36 @@
117
78
  </Tooltip.Provider>
118
79
  {/snippet}
119
80
 
120
- {#snippet item(framed: boolean)}
121
- {#key title}
122
- <Panel
123
- title={framed ? undefined : title}
124
- subtitle={framed ? undefined : subtitle}
125
- action={onClose && !framed ? close : undefined}
126
- pad={false}
127
- scroll
128
- class="max-h-full min-h-0"
129
- data-slot="context-column-item"
130
- >
131
- {@render children?.()}
132
- </Panel>
133
- {/key}
134
- {/snippet}
135
-
136
- <!-- `framed`: the dialogue's own header carries the name, with its subtitle or
137
- info, so the body leaves its heading out rather than repeat it. -->
138
- {#snippet body(framed: boolean)}
139
- {#if children}
140
- {#if documentPane && row !== null && !beside}{@render documentPane()}{:else}{@render item(framed)}{/if}
141
- {:else}
142
- <StatList items={stats ?? []} title={statsTitle} info={statsInfo} bare={framed} />
143
- {#if detail}
144
- {@render detail()}
145
- {/if}
146
- {/if}
147
- {/snippet}
148
-
149
- <aside
150
- bind:this={ref}
151
- aria-label={name}
152
- class={cn(
153
- 'hidden max-h-full min-h-0 w-[clamp(360px,28vw,460px)] shrink-0 flex-col gap-5 xl:flex',
154
- className
155
- )}
156
- data-slot="context-column"
157
- {...restProps}
158
- >
159
- {@render body(false)}
160
- </aside>
161
-
162
- {#if children && documentPane && beside}
163
- <div class="hidden min-h-0 min-w-0 flex-1 flex-col xl:flex" data-slot="context-column-document">
164
- {@render documentPane()}
165
- </div>
166
- {/if}
167
-
168
- <!-- The reachable stand-in below xl. `size-11` (44px) rather than this
169
- package's usual 36px control row: this is the one control whose entire
170
- job is making otherwise-unreachable content reachable, so it earns the
171
- full touch-target minimum rather than the shell's ordinary density.
172
- The bottom-right corner is the feedback widget's; this sits beside it
173
- (`--ds-report-beside`, which the widget publishes) and follows its lift, so
174
- neither covers the other and both stay in the band the shell reserves at
175
- the content's end. -->
176
- <button
177
- type="button"
178
- onclick={() => (sheetOpen = true)}
179
- class="border-border bg-card text-muted-foreground hover:text-foreground ds-edge fixed right-[var(--ds-report-beside,1rem)] bottom-[calc(1rem+var(--ds-report-clearance,0px)+env(safe-area-inset-bottom))] z-30 grid size-11 flex-none place-items-center rounded-full border xl:hidden"
180
- aria-label="Open {name}"
181
- >
182
- <PanelRight class="size-4.5" />
183
- </button>
184
-
185
- <AppDialog
186
- bind:open={sheetOpen}
187
- title={name}
188
- subtitle={headed && children ? subtitle : undefined}
189
- info={headed && !children ? statsInfo : undefined}
190
- size="sm"
191
- >
192
- <div class={cn('flex flex-col gap-5', children && documentPane && 'h-[70dvh]')}>
193
- {@render body(headed)}
194
- </div>
195
- </AppDialog>
81
+ <!-- In the sheet the header names the column, so a body headed by the same
82
+ name leaves its heading to it, and the line under the heading goes with it. -->
83
+ <PageAside label={name} description={headed ? (children ? subtitle : statsInfo) : undefined}>
84
+ {#snippet body(state)}
85
+ {@const framed = state.mode === 'sheet' && headed}
86
+ <div class="flex min-h-0 flex-1 flex-col gap-5" data-slot="context-column">
87
+ {#if children}
88
+ {#if documentPane}
89
+ {@render documentPane()}
90
+ {:else}
91
+ {#key title}
92
+ <Panel
93
+ title={framed ? undefined : title}
94
+ subtitle={framed ? undefined : subtitle}
95
+ action={onClose && !framed ? close : undefined}
96
+ pad={false}
97
+ scroll
98
+ class="max-h-full min-h-0"
99
+ data-slot="context-column-item"
100
+ >
101
+ {@render children?.()}
102
+ </Panel>
103
+ {/key}
104
+ {/if}
105
+ {:else}
106
+ <StatList items={stats ?? []} title={statsTitle} info={statsInfo} bare={framed} />
107
+ {#if detail}
108
+ {@render detail()}
109
+ {/if}
110
+ {/if}
111
+ </div>
112
+ {/snippet}
113
+ </PageAside>
@@ -1,6 +1,4 @@
1
1
  import type { Snippet } from 'svelte';
2
- import type { HTMLAttributes } from 'svelte/elements';
3
- import { type WithElementRef } from '../../../utils.js';
4
2
  import type { StatItem } from '../stat-list/stat-list.svelte';
5
3
  type ListForm = {
6
4
  stats: StatItem[];
@@ -22,16 +20,16 @@ type RecordForm = {
22
20
  onClose?: () => void;
23
21
  /** The opened item. */
24
22
  children: Snippet;
25
- /** The opened item's document: a DocumentPane, in the column's place or beside it. */
23
+ /** The opened item's document: a DocumentPane, in the item's place. */
26
24
  documentPane?: Snippet;
27
25
  stats?: never;
28
26
  statsTitle?: never;
29
27
  statsInfo?: never;
30
28
  detail?: never;
31
29
  };
32
- type $$ComponentProps = Omit<WithElementRef<HTMLAttributes<HTMLElement>>, 'title' | 'children'> & (ListForm | RecordForm) & {
30
+ type $$ComponentProps = (ListForm | RecordForm) & {
33
31
  ariaLabel?: string;
34
32
  };
35
- declare const ContextColumn: import("svelte").Component<$$ComponentProps, {}, "ref">;
33
+ declare const ContextColumn: import("svelte").Component<$$ComponentProps, {}, "">;
36
34
  type ContextColumn = ReturnType<typeof ContextColumn>;
37
35
  export default ContextColumn;
@@ -37,10 +37,11 @@
37
37
  * URL fragment, because a fragment cannot find an element inside a shadow
38
38
  * root, and this reader appears inside elements too.
39
39
  *
40
- * It centres itself and carries its own measure, so its route's `measure`
41
- * only needs to leave room: `page` or wider shows the contents beside the
42
- * body, and the shift from beside to above is a container query on the
43
- * reader's own width, not the window's.
40
+ * In a shell it is a `reading` page's column, and its contents list and
41
+ * `aside` are the page's aside (`PageAside`), so the shell places them:
42
+ * beside the column with room, the contents folded into a disclosure above
43
+ * the body without it. Outside a shell (inside an element) it lays the same
44
+ * two columns out itself, by a container query on its own width.
44
45
  */
45
46
  import { untrack, type Snippet } from 'svelte';
46
47
  import type { HTMLAttributes } from 'svelte/elements';
@@ -52,6 +53,8 @@
52
53
  import ContentSkeleton from '../content-skeleton/content-skeleton.svelte';
53
54
  import ErrorState from '../error-state/error-state.svelte';
54
55
  import LoadingState from '../loading-state/loading-state.svelte';
56
+ import PageAside from '../app-shell/page-aside.svelte';
57
+ import { onThePage } from '../app-shell/page.js';
55
58
 
56
59
  let {
57
60
  title,
@@ -96,6 +99,10 @@
96
99
  onRetry?: () => void;
97
100
  } = $props();
98
101
 
102
+ // On a shell's page, the page's aside holds the side column; outside a shell,
103
+ // or inside a column or a dialogue, this does.
104
+ const hosted = onThePage();
105
+
99
106
  let article = $state<HTMLElement | null>(null);
100
107
  let disclosure = $state<HTMLDetailsElement | null>(null);
101
108
  let headings = $state<DocumentReaderHeading[]>([]);
@@ -245,6 +252,22 @@
245
252
  </nav>
246
253
  {/snippet}
247
254
 
255
+ {#snippet sideColumn()}
256
+ {#if showContents}
257
+ <!-- Hosted, its display is styles.css's, so the page frame can hide it. -->
258
+ <div
259
+ data-slot="document-reader-contents"
260
+ class={cn(!hosted && 'hidden flex-col gap-2 @5xl:flex')}
261
+ >
262
+ <p class="text-sm font-medium" aria-hidden="true">{contentsLabel}</p>
263
+ {@render contentsList()}
264
+ </div>
265
+ {/if}
266
+ {#if aside}
267
+ <div class={cn(!hosted && 'mt-10 @5xl:mt-0')}>{@render aside()}</div>
268
+ {/if}
269
+ {/snippet}
270
+
248
271
  <div
249
272
  bind:this={ref}
250
273
  data-slot="document-reader"
@@ -264,8 +287,9 @@
264
287
  {:else}
265
288
  <div
266
289
  class={cn(
267
- 'mx-auto w-full max-w-(--ds-shell-measure-prose)',
268
- side && '@5xl:max-w-[calc(var(--ds-shell-measure-prose)+16.5rem)]'
290
+ 'w-full',
291
+ !hosted && 'mx-auto max-w-(--ds-page-reading)',
292
+ !hosted && side && '@5xl:max-w-[calc(var(--ds-page-reading)+16.5rem)]'
269
293
  )}
270
294
  >
271
295
  {#if title || breadcrumbs?.length || meta || actions}
@@ -274,15 +298,21 @@
274
298
  {#if loading}
275
299
  <ContentSkeleton shape="prose" label="Loading the document…" />
276
300
  {:else}
277
- <!-- One column, then two from 64rem of reader. The side column is
278
- rendered once: below 64rem it follows the body and shows only
279
- `aside`, since the contents fold into the disclosure above. -->
280
- <div class="flex flex-col @5xl:flex-row @5xl:items-start @5xl:gap-10">
301
+ <!-- Outside a shell: one column, then two from 64rem of reader, the
302
+ side column rendered once and below 64rem showing only `aside`,
303
+ since the contents fold into the disclosure above. In a shell the
304
+ side column is the page's aside, and the disclosure shows only
305
+ where that aside is not beside the column (styles.css). -->
306
+ <div class={cn('flex flex-col', !hosted && '@5xl:flex-row @5xl:items-start @5xl:gap-10')}>
281
307
  <div class="min-w-0 flex-1">
282
308
  {#if showContents}
283
309
  <details
284
310
  bind:this={disclosure}
285
- class="group bg-card border-border ds-edge mb-6 rounded-lg border @5xl:hidden"
311
+ data-slot="document-reader-disclosure"
312
+ class={cn(
313
+ 'group bg-card border-border ds-edge mb-6 rounded-lg border',
314
+ !hosted && '@5xl:hidden'
315
+ )}
286
316
  >
287
317
  <summary
288
318
  class="focus-visible:ring-ring/50 flex cursor-pointer list-none items-center gap-2 rounded-lg px-3 py-2 text-sm font-medium outline-none focus-visible:ring-3 [&::-webkit-details-marker]:hidden"
@@ -298,8 +328,7 @@
298
328
  {/if}
299
329
  <article
300
330
  bind:this={article}
301
- class="ds-prose ds-measure [&_:is(h2,h3)]:scroll-mt-4 [&_:is(h2,h3)]:outline-none"
302
- data-measure="prose"
331
+ class="ds-prose [&_:is(h2,h3)]:scroll-mt-4 [&_:is(h2,h3)]:outline-none"
303
332
  >
304
333
  {#if html !== undefined}
305
334
  {@html html}
@@ -308,29 +337,32 @@
308
337
  {/if}
309
338
  </article>
310
339
  </div>
311
- {#if side}
340
+ {#if side && !hosted}
312
341
  <div
313
342
  data-slot="document-reader-side"
314
343
  class="flex flex-col gap-8 @5xl:sticky @5xl:top-4 @5xl:max-h-[calc(100dvh-6rem)] @5xl:w-56 @5xl:shrink-0 @5xl:overflow-y-auto"
315
344
  >
316
- {#if showContents}
317
- <div class="hidden flex-col gap-2 @5xl:flex">
318
- <p class="text-sm font-medium" aria-hidden="true">{contentsLabel}</p>
319
- {@render contentsList()}
320
- </div>
321
- {/if}
322
- {#if aside}
323
- <div class="mt-10 @5xl:mt-0">{@render aside()}</div>
324
- {/if}
345
+ {@render sideColumn()}
325
346
  </div>
326
347
  {/if}
327
348
  </div>
328
349
  {#if footer}
329
- <div class="ds-measure border-border mt-12 border-t pt-6" data-measure="prose">
350
+ <div class="border-border mt-12 border-t pt-6">
330
351
  {@render footer()}
331
352
  </div>
332
353
  {/if}
333
354
  {/if}
334
355
  </div>
356
+ {#if side && hosted}
357
+ <PageAside label={contentsLabel}>
358
+ <div
359
+ data-slot="document-reader-side"
360
+ data-only-contents={aside ? undefined : ''}
361
+ class="flex flex-col gap-8"
362
+ >
363
+ {@render sideColumn()}
364
+ </div>
365
+ </PageAside>
366
+ {/if}
335
367
  {/if}
336
368
  </div>
@@ -27,10 +27,11 @@ export declare function slugify(text: string): string;
27
27
  * URL fragment, because a fragment cannot find an element inside a shadow
28
28
  * root, and this reader appears inside elements too.
29
29
  *
30
- * It centres itself and carries its own measure, so its route's `measure`
31
- * only needs to leave room: `page` or wider shows the contents beside the
32
- * body, and the shift from beside to above is a container query on the
33
- * reader's own width, not the window's.
30
+ * In a shell it is a `reading` page's column, and its contents list and
31
+ * `aside` are the page's aside (`PageAside`), so the shell places them:
32
+ * beside the column with room, the contents folded into a disclosure above
33
+ * the body without it. Outside a shell (inside an element) it lays the same
34
+ * two columns out itself, by a container query on its own width.
34
35
  */
35
36
  import { type Snippet } from 'svelte';
36
37
  import type { HTMLAttributes } from 'svelte/elements';
@@ -85,7 +85,7 @@
85
85
  {/if}
86
86
  </div>
87
87
  {#if description}
88
- <p class="text-muted-foreground ds-measure text-sm" data-measure="prose">{description}</p>
88
+ <p class="text-muted-foreground text-sm" data-prose>{description}</p>
89
89
  {/if}
90
90
  </header>
91
91
  {@render children?.()}
@@ -85,6 +85,7 @@
85
85
  <section
86
86
  bind:this={ref}
87
87
  data-tone={tone === 'default' ? undefined : tone}
88
+ data-fill={scroll ? '' : undefined}
88
89
  class={cn(
89
90
  'bg-card ds-edge flex flex-col overflow-hidden rounded-lg border',
90
91
  destructive ? 'border-destructive/40' : 'border-border',
@@ -16,68 +16,39 @@
16
16
 
17
17
  <script lang="ts">
18
18
  /**
19
- * The settings destination: a grouped section list beside the section you are
20
- * reading, inside AppShell's content area.
19
+ * The settings destination: its sections are a `panel` page's pane
20
+ * (`PagePane`), flush against the rail, and the section you are reading is
21
+ * the page beside it. The route declares `pageType: 'panel'`; this sets no
22
+ * width, padding or scroller of its own. Below 64rem of window the sections
23
+ * open as a sheet from the bar.
21
24
  *
22
- * Two PANES, not a panel and not a drawer. The distinction is load-bearing:
23
- * a panel overlays and closes, and this package carries a standing directive
24
- * against side panels for work you are actually doing. These panes divide and
25
- * persist, each scrolling on its own, so a long settings page never pushes the
26
- * section list out of reach.
27
- *
28
- * The list renders through AppNav rather than a row renderer of its own, and
29
- * that is the whole reason this component is small. AppNav already owns the
30
- * group eyebrow, the active row's leading edge and tint and weight, the
31
- * `aria-current="page"`, the segment-safe prefix match, truncation, and the
32
- * density ramp — and it is exported in its own right precisely so a navigation
33
- * list that belongs in a PAGE is built from the same affordance rather than
34
- * hand-copied. The estate has already paid for the alternative once: one app's
35
- * inner nav had reimplemented the active indicator independently of its own
36
- * top bar. A second row renderer here would re-commit that drift one
37
- * destination down, on the one surface every app is about to adopt at once.
25
+ * The list renders through AppNav rather than a row renderer of its own:
26
+ * AppNav already owns the group eyebrow, the active row's leading edge and
27
+ * tint, `aria-current="page"`, the segment-safe prefix match and truncation,
28
+ * so a row is the same row everywhere in the household.
38
29
  *
39
30
  * Grouping is by WHOSE setting it is — the person's, then the workspace's —
40
- * because that is the only split a reader can predict: "yours" changes what
41
- * you see, "this company" changes what everyone sees. A group whose `items`
42
- * is empty renders nothing (`toGroups` drops it), so an app with no personal
43
- * sections yet can leave the group in its list rather than stubbing a row that
44
- * leads nowhere.
45
- *
46
- * One label per row, nothing beneath it. A description long enough to be worth
47
- * reading does not fit a 240px column: every one of them truncated to an
48
- * ellipsis and told the reader less than the label already did (measured
49
- * 16/09/2026 in a consumer, removed there the same day). The page introduces
50
- * its own sections — that is what Panel's `description` is for.
51
- *
52
- * No "Settings" heading. The shell's bar names the section it is on as of
53
- * 2026.9.16, so a heading here is the same word twice, one above the other.
31
+ * because that is the only split a reader can predict. A group whose `items`
32
+ * is empty renders nothing (`toGroups` drops it). One label per row, nothing
33
+ * beneath it: the page introduces its own sections (Panel's `description`).
54
34
  *
55
- * BELOW md the list STACKS above the content and the page scrolls as one.
56
- * A horizontally scrollable strip of the same rows was the obvious
57
- * alternative and loses on the requirement it was meant to serve — every
58
- * section reachable in one tap. A strip fits about two and a half rows at
59
- * 375px, so the rest are behind a sideways swipe with no scrollbar to
60
- * advertise them: a swipe THEN a tap, where a stack is a scroll the reader is
61
- * already doing. It also has to drop the group labels for width, which throws
62
- * away the one split the reader could predict, and it needs a second row
63
- * renderer in a horizontal mode — the drift this component exists to avoid.
64
- *
65
- * USE IT WITH `padded={false}` on AppShell. The list's border and tint have to
66
- * reach the content area's edges or the two panes read as a floating card, and
67
- * this component pads its own content pane to the shell's own rhythm
68
- * (`CONTENT_PADDING`) so the settings destination is not the one route whose
69
- * text sits somewhere else.
35
+ * The bar names where the reader is, "Settings › Account": the rail has no
36
+ * row for Settings (it opens from the account menu), so the pane says it.
70
37
  */
71
38
  import type { Snippet } from 'svelte';
72
- import type { HTMLAttributes } from 'svelte/elements';
39
+ import X from '@lucide/svelte/icons/x';
40
+ import SettingsIcon from '@lucide/svelte/icons/settings';
73
41
  import AppNav from '../app-shell/app-nav.svelte';
74
- import { CONTENT_PADDING } from '../app-shell/padding.js';
75
- import type { NavSource } from '../app-shell/types.js';
76
- import { cn, type WithElementRef } from '../../../utils.js';
42
+ import PagePane from '../app-shell/page-pane.svelte';
43
+ import { getPageSlots } from '../app-shell/page.js';
44
+ import { activeNavTitle, toItems, TITLE_SEPARATOR, type NavSource } from '../app-shell/types.js';
45
+ import Button from '../button/button.svelte';
77
46
 
78
- type Shared = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
47
+ type Shared = {
79
48
  /** The list's accessible name. */
80
49
  listLabel?: string;
50
+ /** What the destination is called, in the bar and over the sheet. */
51
+ title?: string;
81
52
  children: Snippet;
82
53
  };
83
54
 
@@ -87,19 +58,14 @@
87
58
  selected,
88
59
  onSelect,
89
60
  listLabel = 'Settings sections',
90
- children,
91
- ref = $bindable(null),
92
- class: className,
93
- ...restProps
61
+ title = 'Settings',
62
+ children
94
63
  }: Shared &
95
64
  (
96
65
  | {
97
66
  /**
98
67
  * ROUTED: the sections, as the package's own navigation vocabulary:
99
68
  * groups of `NavItem` (`{ heading, items }`), bare items, or a mix.
100
- * The same type the rail takes, so a row is the same row everywhere
101
- * in the household.
102
- *
103
69
  * A row at the settings ROOT (`/settings`) needs `exact: true`, or
104
70
  * its prefix match keeps it lit on every section beneath it.
105
71
  */
@@ -113,11 +79,8 @@
113
79
  /**
114
80
  * STATE-DRIVEN, for a single-route app whose sections swap in place
115
81
  * (canonical-app-shape §Applicability): groups of `SettingsSection`
116
- * (`{ id, label, icon? }`) rather than `NavItem`, since nothing is
117
- * navigated to. Rows are buttons; `selected` is the current `id` and
118
- * `onSelect` fires with the `id` that was chosen. The app owns the
119
- * state, so a deep link or a failure that opens a section just sets
120
- * `selected`.
82
+ * (`{ id, label, icon? }`). Rows are buttons; `selected` is the
83
+ * current `id` and `onSelect` fires with the `id` chosen.
121
84
  */
122
85
  sections: readonly (SettingsSection | SettingsSectionGroup)[];
123
86
  selected: string;
@@ -136,29 +99,52 @@
136
99
  )
137
100
  : (sections as NavSource)
138
101
  );
139
- </script>
140
102
 
141
- <div bind:this={ref} class={cn('ds-settings', className)} {...restProps}>
142
- <!--
143
- Width, tint and rule as utilities rather than in styles.css, because AppNav
144
- declares `flex-1` on this same element: a base-layer `flex: none` loses to
145
- a utility by layer, whatever order it is written in, while a utility passed
146
- through `cn()` is resolved by tailwind-merge — `flex-none` and `flex-1` are
147
- one group, so the last one wins and it is this one.
103
+ const here = $derived(
104
+ onSelect
105
+ ? toItems(nav).find((item) => item.href === selected)?.label
106
+ : activeNavTitle(nav, currentPath)
107
+ );
108
+ const location = $derived(here ? `${title}${TITLE_SEPARATOR}${here}` : title);
148
109
 
149
- 15rem (240px) is measured, not picked: it is the width at which a
150
- two-word section label ("Overhead suppliers", "Delegation limits") sits on
151
- one line beside its icon at comfortable density.
152
- -->
110
+ // Without a shell (a desktop window, an element) nothing hosts the pane, so
111
+ // the same panel frame is drawn here.
112
+ const hosted = getPageSlots() !== undefined;
113
+ </script>
114
+
115
+ {#snippet list(close: () => void)}
153
116
  <AppNav
154
117
  {nav}
155
118
  {currentPath}
156
119
  {selected}
157
- {onSelect}
120
+ onSelect={onSelect
121
+ ? (id: string) => {
122
+ onSelect(id);
123
+ close();
124
+ }
125
+ : undefined}
158
126
  label={listLabel}
159
- class="border-border bg-muted/30 flex-none border-b md:w-60 md:border-b-0 md:border-e"
160
127
  />
161
- <div class={cn('ds-settings-pane', CONTENT_PADDING)}>
162
- {@render children()}
128
+ {/snippet}
129
+
130
+ {#if !hosted}
131
+ <div class="ds-page" data-page="panel">
132
+ <div class="ds-page-pane"><div class="ds-page-pane-body">{@render list(() => {})}</div></div>
133
+ <div class="ds-page-main">{@render children()}</div>
163
134
  </div>
164
- </div>
135
+ {:else}
136
+ <PagePane label={listLabel} icon={SettingsIcon} {location}>
137
+ {#snippet body(state)}
138
+ {#if state.mode === 'sheet'}
139
+ <div class="border-border flex items-center justify-between gap-2 border-b py-2 ps-4 pe-2">
140
+ <h2 class="text-sm font-medium">{title}</h2>
141
+ <Button variant="ghost" size="icon" aria-label="Close {title}" onclick={state.close}>
142
+ <X />
143
+ </Button>
144
+ </div>
145
+ {/if}
146
+ {@render list(state.close)}
147
+ {/snippet}
148
+ </PagePane>
149
+ {@render children()}
150
+ {/if}