@poodle64/ui 2026.10.26 → 2026.10.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +138 -169
- package/dist/components/ui/app-dialog/app-dialog.svelte +2 -1
- package/dist/components/ui/app-shell/app-nav.svelte +15 -2
- package/dist/components/ui/app-shell/app-shell.svelte +251 -97
- package/dist/components/ui/app-shell/app-shell.svelte.d.ts +15 -27
- package/dist/components/ui/app-shell/column-scope.svelte +15 -0
- package/dist/components/ui/app-shell/column-scope.svelte.d.ts +12 -0
- package/dist/components/ui/app-shell/index.d.ts +4 -2
- package/dist/components/ui/app-shell/index.js +3 -1
- package/dist/components/ui/app-shell/page-aside.svelte +58 -0
- package/dist/components/ui/app-shell/page-aside.svelte.d.ts +30 -0
- package/dist/components/ui/app-shell/page-pane.svelte +73 -0
- package/dist/components/ui/app-shell/page-pane.svelte.d.ts +37 -0
- package/dist/components/ui/app-shell/page.d.ts +77 -0
- package/dist/components/ui/app-shell/page.js +45 -0
- package/dist/components/ui/app-shell/types.d.ts +18 -2
- package/dist/components/ui/collection-detail/collection-detail.svelte +1 -1
- package/dist/components/ui/content-skeleton/content-skeleton.svelte +1 -1
- package/dist/components/ui/context-column/context-column.svelte +47 -146
- package/dist/components/ui/context-column/context-column.svelte.d.ts +3 -5
- package/dist/components/ui/document-reader/document-reader.svelte +56 -24
- package/dist/components/ui/document-reader/document-reader.svelte.d.ts +5 -4
- package/dist/components/ui/page-section/page-section.svelte +1 -1
- package/dist/components/ui/panel/panel.svelte +1 -0
- package/dist/components/ui/settings-shell/settings-shell.svelte +67 -81
- package/dist/components/ui/settings-shell/settings-shell.svelte.d.ts +21 -60
- package/dist/styles.css +267 -119
- package/package.json +1 -1
- package/registry/component-map.json +22 -15
- package/registry/component-map.md +8 -7
- package/dist/components/ui/app-shell/measure.d.ts +0 -28
- package/dist/components/ui/app-shell/measure.js +0 -21
- package/dist/components/ui/app-shell/padding.d.ts +0 -27
- package/dist/components/ui/app-shell/padding.js +0 -27
- package/dist/components/ui/list-shell/index.d.ts +0 -2
- package/dist/components/ui/list-shell/index.js +0 -2
- package/dist/components/ui/list-shell/list-shell.svelte +0 -85
- package/dist/components/ui/list-shell/list-shell.svelte.d.ts +0 -39
|
@@ -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
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
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,8 +70,15 @@
|
|
|
78
70
|
* </AppShell>
|
|
79
71
|
*/
|
|
80
72
|
import type { Snippet } from 'svelte';
|
|
81
|
-
import
|
|
82
|
-
|
|
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';
|
|
@@ -90,6 +89,9 @@
|
|
|
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
96
|
import { activeNavTitle, toItems, type NavSource } from './types.js';
|
|
95
97
|
import { shellReport } from './report.svelte.js';
|
|
@@ -117,10 +119,9 @@
|
|
|
117
119
|
searchPlacement = 'leading',
|
|
118
120
|
themeToggle = true,
|
|
119
121
|
onToggleTheme,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
+
pageType = 'reading',
|
|
123
|
+
title,
|
|
122
124
|
texture = 'grid',
|
|
123
|
-
mainClass,
|
|
124
125
|
children
|
|
125
126
|
}: {
|
|
126
127
|
/** Navigation: bare items, groups, or a mix. Filter for permissions first. */
|
|
@@ -189,19 +190,17 @@
|
|
|
189
190
|
themeToggle?: boolean;
|
|
190
191
|
/** Override the theme action. Defaults to mode-watcher's toggleMode. */
|
|
191
192
|
onToggleTheme?: () => void;
|
|
192
|
-
padded?: boolean;
|
|
193
193
|
/**
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
* 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`.
|
|
203
202
|
*/
|
|
204
|
-
|
|
203
|
+
title?: string;
|
|
205
204
|
/**
|
|
206
205
|
* The house atmosphere on the content region: `grid` (a dot-grid floor
|
|
207
206
|
* plus a corner vignette) or `none`.
|
|
@@ -217,41 +216,143 @@
|
|
|
217
216
|
* declaration; `none` turns it off.
|
|
218
217
|
*/
|
|
219
218
|
texture?: ShellTexture;
|
|
220
|
-
/** Extra classes on the scrolling content container. */
|
|
221
|
-
mainClass?: string;
|
|
222
219
|
children: Snippet;
|
|
223
220
|
} = $props();
|
|
224
221
|
|
|
225
222
|
const hasNav = $derived(toItems(nav).length > 0);
|
|
226
223
|
|
|
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);
|
|
237
|
+
|
|
227
238
|
// Where the user is, in words: the rail is icons when collapsed and a closed
|
|
228
239
|
// drawer on a phone, so the bar names the page, "Section › Page" inside a
|
|
229
|
-
// section and the item's one name otherwise.
|
|
230
|
-
//
|
|
231
|
-
const location = $derived(
|
|
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.
|
|
242
|
+
const location = $derived(
|
|
243
|
+
activeNavTitle(nav, currentPath) ??
|
|
244
|
+
(type === 'panel' ? slots.pane?.location : undefined) ??
|
|
245
|
+
title
|
|
246
|
+
);
|
|
232
247
|
|
|
233
248
|
// The page's scope controls, registered by `<ShellControls>` from the route.
|
|
234
249
|
const controls: ShellControlsSlot = $state({ content: null });
|
|
235
250
|
provideShellControls(controls);
|
|
236
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
|
+
|
|
237
348
|
// Rail width is a personal preference: localStorage, one key across apps.
|
|
238
349
|
// A drag below RAIL_SNAP collapses; the width survives and returns on expand.
|
|
239
350
|
let railWidth = $state<number | null>(null);
|
|
240
351
|
let resizing = $state(false);
|
|
241
352
|
|
|
242
|
-
// The
|
|
243
|
-
//
|
|
244
|
-
//
|
|
245
|
-
// class token under the same test survives, so `measure={null}` — which the
|
|
246
|
-
// type forbids but a loosely-typed prop bag or a nullable route field can
|
|
247
|
-
// still deliver — produced the class with no attribute and therefore no
|
|
248
|
-
// matching rule. Harmless to look at, but it breaks the DOM contract the
|
|
249
|
-
// additivity gate states, and a guarantee with a hole in it is not one.
|
|
250
|
-
const capped = $derived(measure != null && measure !== 'full' ? measure : null);
|
|
251
|
-
|
|
252
|
-
// The texture resolves the same way, and for the same reason: one answer
|
|
253
|
-
// feeding both the class and the attribute, so `texture={null}` from a
|
|
254
|
-
// 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.
|
|
255
356
|
const textured = $derived(texture != null && texture !== 'none' ? texture : null);
|
|
256
357
|
|
|
257
358
|
// The disclosure toggle and the region it opens have to be programmatically
|
|
@@ -757,6 +858,40 @@
|
|
|
757
858
|
{/if}
|
|
758
859
|
|
|
759
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
|
+
|
|
760
895
|
{#if onSearch && searchPlacement === 'trailing'}
|
|
761
896
|
{@render searchButton(
|
|
762
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'
|
|
@@ -818,9 +953,9 @@
|
|
|
818
953
|
<!--
|
|
819
954
|
`texture` paints the house atmosphere HERE, on the scroller itself,
|
|
820
955
|
through `.ds-shell-texture` in styles.css. It is this element rather
|
|
821
|
-
than the
|
|
822
|
-
sits on:
|
|
823
|
-
|
|
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.
|
|
824
959
|
|
|
825
960
|
It is a background rather than a layer, and that is the whole design
|
|
826
961
|
rather than an implementation detail. An absolutely positioned child
|
|
@@ -848,62 +983,81 @@
|
|
|
848
983
|
data-slot="app-shell-content"
|
|
849
984
|
tabindex="-1"
|
|
850
985
|
class={cn(
|
|
851
|
-
'relative flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto',
|
|
852
|
-
textured && 'ds-shell-texture'
|
|
853
|
-
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'
|
|
854
988
|
)}
|
|
855
989
|
data-texture={textured ?? undefined}
|
|
856
990
|
>
|
|
857
991
|
<!--
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
the declaration is currently INERT. The automatic minimum size
|
|
865
|
-
applies to a flex item's MAIN axis, and `<main>` is a column, so this
|
|
866
|
-
box's width is already cross-axis stretch and cannot grow past its
|
|
867
|
-
container. Driving the harness at 375px and 320px, with and without
|
|
868
|
-
the declaration, against a plain page wrapper and an `mx-auto` one,
|
|
869
|
-
moved nothing — `harness/drive.mjs` pins that.
|
|
870
|
-
|
|
871
|
-
It stays because it is the correct declaration for the box, and
|
|
872
|
-
because the day this container becomes a row item the omission would
|
|
873
|
-
be invisible all over again. What it is NOT is the cause of the
|
|
874
|
-
sideways scroll in #5: that comes from a child with no scroller of
|
|
875
|
-
its own, which no sizing rule here can prevent — only the child
|
|
876
|
-
carrying its own scroller can, as this package's Table does. The half
|
|
877
|
-
of that defect the shell genuinely owns is on `<main>` above.
|
|
878
|
-
-->
|
|
879
|
-
<!--
|
|
880
|
-
`measure` caps and centres this box, through `.ds-shell-measure`
|
|
881
|
-
in styles.css rather than a utility here — an arbitrary max-width
|
|
882
|
-
utility only exists if the consumer's Tailwind build scanned the
|
|
883
|
-
file spelling it, and a cap that silently does not compile is the
|
|
884
|
-
failure mode this package gates against everywhere else. (Never
|
|
885
|
-
write the utility's class name in a comment: Tailwind scans
|
|
886
|
-
comments too, and compiles the placeholder it finds there.)
|
|
887
|
-
|
|
888
|
-
At `full` the class and the attribute are both ABSENT, not set to
|
|
889
|
-
a no-op value. That is what makes the prop additive: a consumer
|
|
890
|
-
who never names it gets the same element, the same class string
|
|
891
|
-
and the same declarations as before it existed, so there is
|
|
892
|
-
nothing for the cascade to resolve differently. Both read the
|
|
893
|
-
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.
|
|
894
998
|
-->
|
|
895
999
|
<div
|
|
896
|
-
class=
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
padded && CONTENT_PADDING
|
|
901
|
-
)}
|
|
902
|
-
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}
|
|
903
1004
|
>
|
|
904
|
-
{
|
|
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}
|
|
905
1032
|
</div>
|
|
906
1033
|
</main>
|
|
907
1034
|
</div>
|
|
908
1035
|
</div>
|
|
909
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}
|
|
@@ -29,19 +29,11 @@
|
|
|
29
29
|
* carries route content the global affordance reads as global rather than as
|
|
30
30
|
* part of the switcher next to it.
|
|
31
31
|
*
|
|
32
|
-
* Content WIDTH is
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* between them using 15% to 79% of the width actually available. That is
|
|
38
|
-
* fifteen independent guesses, not a shell shape.
|
|
39
|
-
*
|
|
40
|
-
* `measure` is a small named scale, chosen once in the layout, and it is not
|
|
41
|
-
* the old `content` prop returning. It defaults to `full`, so a shell that
|
|
42
|
-
* never mentions it renders byte-identically; its tiers are CSS custom
|
|
43
|
-
* properties an app retunes without a release; and it exists to REPLACE
|
|
44
|
-
* per-page width decisions rather than to offer an app a look.
|
|
32
|
+
* Content WIDTH is not a prop. A route declares what it is (`pageType`:
|
|
33
|
+
* `reading`, `panel` or `tool`, see page.ts) and the shell owns everything
|
|
34
|
+
* that follows from it: the column's width and centring, the gutters, the
|
|
35
|
+
* pane flush against the rail, the aside beside the content, and which of
|
|
36
|
+
* them scrolls. The less an app decides, the better (operator, 24/10/2026).
|
|
45
37
|
*
|
|
46
38
|
* Content TEXTURE came back the same way, on the same kind of evidence. Two
|
|
47
39
|
* apps had separately built one picture — a faint dot-grid floor with a soft
|
|
@@ -77,7 +69,7 @@
|
|
|
77
69
|
* </AppShell>
|
|
78
70
|
*/
|
|
79
71
|
import type { Snippet } from 'svelte';
|
|
80
|
-
import type
|
|
72
|
+
import { type PageType } from './page.js';
|
|
81
73
|
import type { ShellTexture } from './texture.js';
|
|
82
74
|
import { type NavSource } from './types.js';
|
|
83
75
|
type $$ComponentProps = {
|
|
@@ -147,19 +139,17 @@ type $$ComponentProps = {
|
|
|
147
139
|
themeToggle?: boolean;
|
|
148
140
|
/** Override the theme action. Defaults to mode-watcher's toggleMode. */
|
|
149
141
|
onToggleTheme?: () => void;
|
|
150
|
-
padded?: boolean;
|
|
151
142
|
/**
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* spends its padding inside the measure.
|
|
143
|
+
* What the route is: `reading` (the default), `panel` or `tool`
|
|
144
|
+
* (page.ts). The route declares it; the shell owns every width, gutter
|
|
145
|
+
* and column that follows. Apps pass `page.data.pageType`.
|
|
146
|
+
*/
|
|
147
|
+
pageType?: PageType;
|
|
148
|
+
/**
|
|
149
|
+
* The page's own name, for the bar when neither the rail nor the page's
|
|
150
|
+
* pane names where the reader is. Apps pass `page.data.title`.
|
|
161
151
|
*/
|
|
162
|
-
|
|
152
|
+
title?: string;
|
|
163
153
|
/**
|
|
164
154
|
* The house atmosphere on the content region: `grid` (a dot-grid floor
|
|
165
155
|
* plus a corner vignette) or `none`.
|
|
@@ -175,8 +165,6 @@ type $$ComponentProps = {
|
|
|
175
165
|
* declaration; `none` turns it off.
|
|
176
166
|
*/
|
|
177
167
|
texture?: ShellTexture;
|
|
178
|
-
/** Extra classes on the scrolling content container. */
|
|
179
|
-
mainClass?: string;
|
|
180
168
|
children: Snippet;
|
|
181
169
|
};
|
|
182
170
|
declare const AppShell: import("svelte").Component<$$ComponentProps, {}, "collapsed">;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Marks what it wraps as inside one of the page's columns or a dialogue,
|
|
4
|
+
* not the page itself, so a component there (a DocumentReader in an aside)
|
|
5
|
+
* keeps its own layout rather than claiming the page's aside.
|
|
6
|
+
*/
|
|
7
|
+
import type { Snippet } from 'svelte';
|
|
8
|
+
import { markInColumn } from './page.js';
|
|
9
|
+
|
|
10
|
+
let { children }: { children: Snippet } = $props();
|
|
11
|
+
|
|
12
|
+
markInColumn();
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
{@render children()}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marks what it wraps as inside one of the page's columns or a dialogue,
|
|
3
|
+
* not the page itself, so a component there (a DocumentReader in an aside)
|
|
4
|
+
* keeps its own layout rather than claiming the page's aside.
|
|
5
|
+
*/
|
|
6
|
+
import type { Snippet } from 'svelte';
|
|
7
|
+
type $$ComponentProps = {
|
|
8
|
+
children: Snippet;
|
|
9
|
+
};
|
|
10
|
+
declare const ColumnScope: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
11
|
+
type ColumnScope = ReturnType<typeof ColumnScope>;
|
|
12
|
+
export default ColumnScope;
|
|
@@ -2,6 +2,8 @@ export { default as AppShell } from './app-shell.svelte';
|
|
|
2
2
|
export { default as AppNav } from './app-nav.svelte';
|
|
3
3
|
export { default as ShellControls } from './shell-controls.svelte';
|
|
4
4
|
export { default } from './app-shell.svelte';
|
|
5
|
-
export {
|
|
5
|
+
export { default as PagePane } from './page-pane.svelte';
|
|
6
|
+
export { default as PageAside } from './page-aside.svelte';
|
|
7
|
+
export { PAGE_TYPES, type PageAsideRegistration, type PageColumnState, type PagePaneRegistration, type PageType } from './page.js';
|
|
6
8
|
export { SHELL_TEXTURES, type ShellTexture } from './texture.js';
|
|
7
|
-
export { activeNavTitle, hasActiveNavChild, isNavGroup, isNavItemActive, navChildren, toGroups, toItems, type IconComponent, type NavChildItem, type NavEntry, type NavGroup, type NavItem, type NavSource } from './types.js';
|
|
9
|
+
export { activeNavTitle, hasActiveNavChild, isNavGroup, isNavItemActive, navChildren, toGroups, toItems, type IconComponent, type NavBadge, type NavChildItem, type NavEntry, type NavGroup, type NavItem, type NavSource } from './types.js';
|
|
@@ -2,6 +2,8 @@ export { default as AppShell } from './app-shell.svelte';
|
|
|
2
2
|
export { default as AppNav } from './app-nav.svelte';
|
|
3
3
|
export { default as ShellControls } from './shell-controls.svelte';
|
|
4
4
|
export { default } from './app-shell.svelte';
|
|
5
|
-
export {
|
|
5
|
+
export { default as PagePane } from './page-pane.svelte';
|
|
6
|
+
export { default as PageAside } from './page-aside.svelte';
|
|
7
|
+
export { PAGE_TYPES } from './page.js';
|
|
6
8
|
export { SHELL_TEXTURES } from './texture.js';
|
|
7
9
|
export { activeNavTitle, hasActiveNavChild, isNavGroup, isNavItemActive, navChildren, toGroups, toItems } from './types.js';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Registers this page's aside: what stands beside the page's content. The
|
|
4
|
+
* shell places it by the route's page type: in a `reading` page beside the
|
|
5
|
+
* centred column, the pair centred, and after the column below 66rem of
|
|
6
|
+
* content region; in a `tool` or `panel` page at the frame's right edge,
|
|
7
|
+
* opened from the bar as a sheet below 80rem of window. Renders nothing
|
|
8
|
+
* where it stands (in place outside a shell).
|
|
9
|
+
*
|
|
10
|
+
* <PageAside label="Work under way">
|
|
11
|
+
* <Panel title="Work under way">…</Panel>
|
|
12
|
+
* </PageAside>
|
|
13
|
+
*
|
|
14
|
+
* The body takes the column's state when it needs it (`{#snippet body(state)}`
|
|
15
|
+
* instead of children), to close the sheet after a choice. One registration
|
|
16
|
+
* at a time; a later one replaces an earlier one.
|
|
17
|
+
*/
|
|
18
|
+
import type { Snippet } from 'svelte';
|
|
19
|
+
import type { IconComponent } from './types.js';
|
|
20
|
+
import { getPageSlots, IN_PLACE, type PageAsideRegistration, type PageColumnState } from './page.js';
|
|
21
|
+
|
|
22
|
+
let {
|
|
23
|
+
label,
|
|
24
|
+
description,
|
|
25
|
+
icon,
|
|
26
|
+
body,
|
|
27
|
+
children
|
|
28
|
+
}: {
|
|
29
|
+
label: string;
|
|
30
|
+
/** A line under the name at the head of the sheet. */
|
|
31
|
+
description?: string;
|
|
32
|
+
icon?: IconComponent;
|
|
33
|
+
body?: Snippet<[PageColumnState]>;
|
|
34
|
+
children?: Snippet;
|
|
35
|
+
} = $props();
|
|
36
|
+
|
|
37
|
+
const slots = getPageSlots();
|
|
38
|
+
|
|
39
|
+
$effect(() => {
|
|
40
|
+
if (!slots) return;
|
|
41
|
+
const content = body ?? children;
|
|
42
|
+
if (!content) return;
|
|
43
|
+
const registration: PageAsideRegistration = {
|
|
44
|
+
label,
|
|
45
|
+
description,
|
|
46
|
+
icon,
|
|
47
|
+
body: content as Snippet<[PageColumnState]>
|
|
48
|
+
};
|
|
49
|
+
slots.aside = registration;
|
|
50
|
+
return () => {
|
|
51
|
+
if (slots.aside === registration) slots.aside = null;
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
{#if !slots}
|
|
57
|
+
{#if body}{@render body(IN_PLACE)}{:else}{@render children?.()}{/if}
|
|
58
|
+
{/if}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registers this page's aside: what stands beside the page's content. The
|
|
3
|
+
* shell places it by the route's page type: in a `reading` page beside the
|
|
4
|
+
* centred column, the pair centred, and after the column below 66rem of
|
|
5
|
+
* content region; in a `tool` or `panel` page at the frame's right edge,
|
|
6
|
+
* opened from the bar as a sheet below 80rem of window. Renders nothing
|
|
7
|
+
* where it stands (in place outside a shell).
|
|
8
|
+
*
|
|
9
|
+
* <PageAside label="Work under way">
|
|
10
|
+
* <Panel title="Work under way">…</Panel>
|
|
11
|
+
* </PageAside>
|
|
12
|
+
*
|
|
13
|
+
* The body takes the column's state when it needs it (`{#snippet body(state)}`
|
|
14
|
+
* instead of children), to close the sheet after a choice. One registration
|
|
15
|
+
* at a time; a later one replaces an earlier one.
|
|
16
|
+
*/
|
|
17
|
+
import type { Snippet } from 'svelte';
|
|
18
|
+
import type { IconComponent } from './types.js';
|
|
19
|
+
import { type PageColumnState } from './page.js';
|
|
20
|
+
type $$ComponentProps = {
|
|
21
|
+
label: string;
|
|
22
|
+
/** A line under the name at the head of the sheet. */
|
|
23
|
+
description?: string;
|
|
24
|
+
icon?: IconComponent;
|
|
25
|
+
body?: Snippet<[PageColumnState]>;
|
|
26
|
+
children?: Snippet;
|
|
27
|
+
};
|
|
28
|
+
declare const PageAside: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
29
|
+
type PageAside = ReturnType<typeof PageAside>;
|
|
30
|
+
export default PageAside;
|