@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
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Registers this page's pane: the second column a `panel` page carries
|
|
4
|
+
* flush against the rail, as wide as the rail and folded as narrow as it,
|
|
5
|
+
* and opened from the bar as a sheet below 64rem of window. The shell draws
|
|
6
|
+
* it; this renders nothing where it stands (in place outside a shell).
|
|
7
|
+
*
|
|
8
|
+
* <PagePane label="Past questions" icon={History} remember="chat-past-folded" fill>
|
|
9
|
+
* {#snippet body({ mode, fold, close })}<ConversationList … />{/snippet}
|
|
10
|
+
* {#snippet foot()}<Button …>Clear all</Button>{/snippet}
|
|
11
|
+
* {#snippet folded({ unfold })}<Button … onclick={unfold}>…</Button>{/snippet}
|
|
12
|
+
* </PagePane>
|
|
13
|
+
*
|
|
14
|
+
* The route declares `pageType: 'panel'`; the content beside the pane is the
|
|
15
|
+
* page itself. One registration at a time; a later one replaces an earlier.
|
|
16
|
+
*/
|
|
17
|
+
import type { Snippet } from 'svelte';
|
|
18
|
+
import type { IconComponent } from './types.js';
|
|
19
|
+
import { getPageSlots, IN_PLACE, type PageColumnState, type PagePaneRegistration } from './page.js';
|
|
20
|
+
|
|
21
|
+
let {
|
|
22
|
+
label,
|
|
23
|
+
icon,
|
|
24
|
+
location,
|
|
25
|
+
remember,
|
|
26
|
+
fill = false,
|
|
27
|
+
column = $bindable(false),
|
|
28
|
+
body,
|
|
29
|
+
foot,
|
|
30
|
+
folded
|
|
31
|
+
}: {
|
|
32
|
+
label: string;
|
|
33
|
+
icon?: IconComponent;
|
|
34
|
+
/** What the bar names on this page when the rail names nothing ("Settings › Account"). */
|
|
35
|
+
location?: string;
|
|
36
|
+
/** localStorage key the fold is remembered under. */
|
|
37
|
+
remember?: string;
|
|
38
|
+
/** The content beside the pane fills the frame (a transcript) instead of sitting at the panel measure. */
|
|
39
|
+
fill?: boolean;
|
|
40
|
+
/** True while the shell draws the pane as a column; false while it is a sheet. Bindable. */
|
|
41
|
+
column?: boolean;
|
|
42
|
+
body: Snippet<[PageColumnState]>;
|
|
43
|
+
foot?: Snippet<[PageColumnState]>;
|
|
44
|
+
/** The pane folded to its edge; given, the pane folds. */
|
|
45
|
+
folded?: Snippet<[PageColumnState]>;
|
|
46
|
+
} = $props();
|
|
47
|
+
|
|
48
|
+
const slots = getPageSlots();
|
|
49
|
+
|
|
50
|
+
$effect(() => {
|
|
51
|
+
if (!slots) return;
|
|
52
|
+
const registration: PagePaneRegistration = {
|
|
53
|
+
label,
|
|
54
|
+
icon,
|
|
55
|
+
location,
|
|
56
|
+
remember,
|
|
57
|
+
fill,
|
|
58
|
+
body,
|
|
59
|
+
foot,
|
|
60
|
+
folded,
|
|
61
|
+
onmode: (mode) => (column = mode === 'column')
|
|
62
|
+
};
|
|
63
|
+
slots.pane = registration;
|
|
64
|
+
return () => {
|
|
65
|
+
if (slots.pane === registration) slots.pane = null;
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
{#if !slots}
|
|
71
|
+
{@render body(IN_PLACE)}
|
|
72
|
+
{@render foot?.(IN_PLACE)}
|
|
73
|
+
{/if}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registers this page's pane: the second column a `panel` page carries
|
|
3
|
+
* flush against the rail, as wide as the rail and folded as narrow as it,
|
|
4
|
+
* and opened from the bar as a sheet below 64rem of window. The shell draws
|
|
5
|
+
* it; this renders nothing where it stands (in place outside a shell).
|
|
6
|
+
*
|
|
7
|
+
* <PagePane label="Past questions" icon={History} remember="chat-past-folded" fill>
|
|
8
|
+
* {#snippet body({ mode, fold, close })}<ConversationList … />{/snippet}
|
|
9
|
+
* {#snippet foot()}<Button …>Clear all</Button>{/snippet}
|
|
10
|
+
* {#snippet folded({ unfold })}<Button … onclick={unfold}>…</Button>{/snippet}
|
|
11
|
+
* </PagePane>
|
|
12
|
+
*
|
|
13
|
+
* The route declares `pageType: 'panel'`; the content beside the pane is the
|
|
14
|
+
* page itself. One registration at a time; a later one replaces an earlier.
|
|
15
|
+
*/
|
|
16
|
+
import type { Snippet } from 'svelte';
|
|
17
|
+
import type { IconComponent } from './types.js';
|
|
18
|
+
import { type PageColumnState } from './page.js';
|
|
19
|
+
type $$ComponentProps = {
|
|
20
|
+
label: string;
|
|
21
|
+
icon?: IconComponent;
|
|
22
|
+
/** What the bar names on this page when the rail names nothing ("Settings › Account"). */
|
|
23
|
+
location?: string;
|
|
24
|
+
/** localStorage key the fold is remembered under. */
|
|
25
|
+
remember?: string;
|
|
26
|
+
/** The content beside the pane fills the frame (a transcript) instead of sitting at the panel measure. */
|
|
27
|
+
fill?: boolean;
|
|
28
|
+
/** True while the shell draws the pane as a column; false while it is a sheet. Bindable. */
|
|
29
|
+
column?: boolean;
|
|
30
|
+
body: Snippet<[PageColumnState]>;
|
|
31
|
+
foot?: Snippet<[PageColumnState]>;
|
|
32
|
+
/** The pane folded to its edge; given, the pane folds. */
|
|
33
|
+
folded?: Snippet<[PageColumnState]>;
|
|
34
|
+
};
|
|
35
|
+
declare const PagePane: import("svelte").Component<$$ComponentProps, {}, "column">;
|
|
36
|
+
type PagePane = ReturnType<typeof PagePane>;
|
|
37
|
+
export default PagePane;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Page types: what a route is, declared once, and everything about its width,
|
|
3
|
+
* gutters and second columns decided here rather than on the page.
|
|
4
|
+
*
|
|
5
|
+
* - `reading` (the default): one centred column sized for prose, and the
|
|
6
|
+
* page's aside (`<PageAside>`) beside it, the pair centred; below 66rem of
|
|
7
|
+
* content region the aside follows the column. The page scrolls.
|
|
8
|
+
* - `panel`: a second column (`<PagePane>`: settings' sections, a chat's past
|
|
9
|
+
* questions) flush against the rail, and the content beside it, left-aligned
|
|
10
|
+
* to the pane. Below 64rem of window the pane opens as a sheet from the bar.
|
|
11
|
+
* - `tool`: the whole frame, the content filling its height and scrolling
|
|
12
|
+
* inside itself; the page never scrolls. An aside stands at the frame's
|
|
13
|
+
* right edge, and below 80rem of window opens as a sheet from the bar.
|
|
14
|
+
*
|
|
15
|
+
* The widths are `--ds-page-*` custom properties (`styles.css`), so an app
|
|
16
|
+
* retunes one in one declaration; it never writes a width of its own.
|
|
17
|
+
*/
|
|
18
|
+
import { type Snippet } from 'svelte';
|
|
19
|
+
import type { IconComponent } from './types.js';
|
|
20
|
+
export type PageType = 'reading' | 'panel' | 'tool';
|
|
21
|
+
/** Every page type, the default first. */
|
|
22
|
+
export declare const PAGE_TYPES: readonly ["reading", "panel", "tool"];
|
|
23
|
+
/** Where a pane or an aside is drawn just now, and how to put it away. */
|
|
24
|
+
export interface PageColumnState {
|
|
25
|
+
/** `column` beside the content, `sheet` over it from the bar, `stacked` after it (a reading aside). */
|
|
26
|
+
mode: 'column' | 'sheet' | 'stacked';
|
|
27
|
+
/** Whether a foldable pane is folded to its edge. */
|
|
28
|
+
folded: boolean;
|
|
29
|
+
/** Fold the pane to its edge; a no-op where it does not fold. */
|
|
30
|
+
fold: () => void;
|
|
31
|
+
/** Open a folded pane. */
|
|
32
|
+
unfold: () => void;
|
|
33
|
+
/** Close the sheet; a no-op in a column. */
|
|
34
|
+
close: () => void;
|
|
35
|
+
}
|
|
36
|
+
export interface PagePaneRegistration {
|
|
37
|
+
/** The pane's name: its landmark's, and the bar action's that opens it as a sheet. */
|
|
38
|
+
label: string;
|
|
39
|
+
/** The bar action's icon. */
|
|
40
|
+
icon?: IconComponent;
|
|
41
|
+
/** What the bar names while this pane's page is open, when the rail names nothing. */
|
|
42
|
+
location?: string;
|
|
43
|
+
/** The column's body. */
|
|
44
|
+
body: Snippet<[PageColumnState]>;
|
|
45
|
+
/** Pinned at the pane's foot, open or in the sheet. */
|
|
46
|
+
foot?: Snippet<[PageColumnState]>;
|
|
47
|
+
/** What the pane shows folded to its edge; given, the pane folds. */
|
|
48
|
+
folded?: Snippet<[PageColumnState]>;
|
|
49
|
+
/** The localStorage key the fold is remembered under. */
|
|
50
|
+
remember?: string;
|
|
51
|
+
/** The content beside the pane fills the frame (a transcript), rather than sitting at the panel measure. */
|
|
52
|
+
fill?: boolean;
|
|
53
|
+
/** Told whether the shell draws the pane as a column or keeps it in a sheet. */
|
|
54
|
+
onmode?: (mode: 'column' | 'sheet') => void;
|
|
55
|
+
}
|
|
56
|
+
export interface PageAsideRegistration {
|
|
57
|
+
/** The aside's name: its landmark's, and the bar action's that opens it as a sheet. */
|
|
58
|
+
label: string;
|
|
59
|
+
/** A line under the name at the head of the sheet. */
|
|
60
|
+
description?: string;
|
|
61
|
+
icon?: IconComponent;
|
|
62
|
+
body: Snippet<[PageColumnState]>;
|
|
63
|
+
}
|
|
64
|
+
/** The shell's two page-owned columns, each registered by the route. */
|
|
65
|
+
export interface PageSlots {
|
|
66
|
+
pane: PagePaneRegistration | null;
|
|
67
|
+
aside: PageAsideRegistration | null;
|
|
68
|
+
}
|
|
69
|
+
export declare function providePageSlots(slots: PageSlots): void;
|
|
70
|
+
/** Undefined outside a shell: `PagePane` and `PageAside` then render in place. */
|
|
71
|
+
export declare function getPageSlots(): PageSlots | undefined;
|
|
72
|
+
/** Marks the subtree as inside a page column or a dialogue (`ColumnScope`). */
|
|
73
|
+
export declare function markInColumn(): void;
|
|
74
|
+
/** Whether this component stands in the page itself, not in one of its columns or a dialogue. */
|
|
75
|
+
export declare function onThePage(): boolean;
|
|
76
|
+
/** A column's state where nothing hosts it: in place, open. */
|
|
77
|
+
export declare const IN_PLACE: PageColumnState;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Page types: what a route is, declared once, and everything about its width,
|
|
3
|
+
* gutters and second columns decided here rather than on the page.
|
|
4
|
+
*
|
|
5
|
+
* - `reading` (the default): one centred column sized for prose, and the
|
|
6
|
+
* page's aside (`<PageAside>`) beside it, the pair centred; below 66rem of
|
|
7
|
+
* content region the aside follows the column. The page scrolls.
|
|
8
|
+
* - `panel`: a second column (`<PagePane>`: settings' sections, a chat's past
|
|
9
|
+
* questions) flush against the rail, and the content beside it, left-aligned
|
|
10
|
+
* to the pane. Below 64rem of window the pane opens as a sheet from the bar.
|
|
11
|
+
* - `tool`: the whole frame, the content filling its height and scrolling
|
|
12
|
+
* inside itself; the page never scrolls. An aside stands at the frame's
|
|
13
|
+
* right edge, and below 80rem of window opens as a sheet from the bar.
|
|
14
|
+
*
|
|
15
|
+
* The widths are `--ds-page-*` custom properties (`styles.css`), so an app
|
|
16
|
+
* retunes one in one declaration; it never writes a width of its own.
|
|
17
|
+
*/
|
|
18
|
+
import { getContext, setContext } from 'svelte';
|
|
19
|
+
/** Every page type, the default first. */
|
|
20
|
+
export const PAGE_TYPES = ['reading', 'panel', 'tool'];
|
|
21
|
+
const KEY = Symbol('ds-page-slots');
|
|
22
|
+
const IN_COLUMN = Symbol('ds-page-in-column');
|
|
23
|
+
export function providePageSlots(slots) {
|
|
24
|
+
setContext(KEY, slots);
|
|
25
|
+
}
|
|
26
|
+
/** Undefined outside a shell: `PagePane` and `PageAside` then render in place. */
|
|
27
|
+
export function getPageSlots() {
|
|
28
|
+
return getContext(KEY);
|
|
29
|
+
}
|
|
30
|
+
/** Marks the subtree as inside a page column or a dialogue (`ColumnScope`). */
|
|
31
|
+
export function markInColumn() {
|
|
32
|
+
setContext(IN_COLUMN, true);
|
|
33
|
+
}
|
|
34
|
+
/** Whether this component stands in the page itself, not in one of its columns or a dialogue. */
|
|
35
|
+
export function onThePage() {
|
|
36
|
+
return getPageSlots() !== undefined && getContext(IN_COLUMN) !== true;
|
|
37
|
+
}
|
|
38
|
+
/** A column's state where nothing hosts it: in place, open. */
|
|
39
|
+
export const IN_PLACE = {
|
|
40
|
+
mode: 'stacked',
|
|
41
|
+
folded: false,
|
|
42
|
+
fold: () => { },
|
|
43
|
+
unfold: () => { },
|
|
44
|
+
close: () => { }
|
|
45
|
+
};
|
|
@@ -21,6 +21,16 @@ import type { Component } from 'svelte';
|
|
|
21
21
|
export type IconComponent = Component<{
|
|
22
22
|
class?: string;
|
|
23
23
|
}>;
|
|
24
|
+
/**
|
|
25
|
+
* A row's trailing mark. A string or number is a text chip (an unread count, a
|
|
26
|
+
* "beta" tag). `{ icon, label }` is a compact icon-only pill whose `label` is its
|
|
27
|
+
* tooltip and accessible name: the choice whenever a text chip could collide with
|
|
28
|
+
* the row's own label or its submenu chevron at the rail's width.
|
|
29
|
+
*/
|
|
30
|
+
export type NavBadge = string | number | {
|
|
31
|
+
icon: IconComponent;
|
|
32
|
+
label: string;
|
|
33
|
+
};
|
|
24
34
|
/** One navigable destination. */
|
|
25
35
|
export interface NavItem {
|
|
26
36
|
/** The visible text. Also the accessible name when the rail is collapsed. */
|
|
@@ -29,8 +39,14 @@ export interface NavItem {
|
|
|
29
39
|
href: string;
|
|
30
40
|
/** Optional leading icon. Omit it for a label-only row; alignment is kept. */
|
|
31
41
|
icon?: IconComponent;
|
|
32
|
-
/**
|
|
33
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Optional trailing mark: a count or short tag (`3`, `'beta'`), or an icon
|
|
44
|
+
* pill (`{ icon: Lock, label: 'Only you' }`). The label is the content and
|
|
45
|
+
* never truncates: a text chip that does not fit takes the label's room and
|
|
46
|
+
* the label wraps. So use the icon form whenever a label could collide, a
|
|
47
|
+
* wordy tag, or a row that also carries `children`.
|
|
48
|
+
*/
|
|
49
|
+
badge?: NavBadge;
|
|
34
50
|
/**
|
|
35
51
|
* Match the current path exactly rather than by prefix. Prefix is the
|
|
36
52
|
* default because a section root should stay lit while you are inside it;
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
<p class="text-muted-foreground text-sm">{collection.subtitle}</p>
|
|
111
111
|
{/if}
|
|
112
112
|
{#if collection.description}
|
|
113
|
-
<p class="
|
|
113
|
+
<p class="mt-2 text-sm" data-prose>{collection.description}</p>
|
|
114
114
|
{/if}
|
|
115
115
|
{#if !collection.subtitle && !collection.description}
|
|
116
116
|
<p class="text-muted-foreground text-sm">No description recorded.</p>
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
{/each}
|
|
80
80
|
</div>
|
|
81
81
|
{:else}
|
|
82
|
-
<div class="
|
|
82
|
+
<div class="flex flex-col gap-5" data-prose aria-hidden="true">
|
|
83
83
|
{#each { length: n }, i (i)}
|
|
84
84
|
<div class="flex flex-col">
|
|
85
85
|
{#each { length: 4 }, line (line)}
|
|
@@ -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
|
|
8
|
+
import PageAside from '../app-shell/page-aside.svelte';
|
|
12
9
|
import X from '@lucide/svelte/icons/x';
|
|
13
10
|
|
|
14
|
-
// The
|
|
15
|
-
//
|
|
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
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
//
|
|
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
|
|
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,55 +62,13 @@
|
|
|
78
62
|
onClose,
|
|
79
63
|
children,
|
|
80
64
|
documentPane,
|
|
81
|
-
/** The column's name: its landmark's, its opener's and its
|
|
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
|
-
|
|
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
|
-
// Below xl the opener floats over the page's corner, so the shell ends its
|
|
107
|
-
// padded content with room for it (`--ds-float-reserve`, read by
|
|
108
|
-
// CONTENT_PADDING) and a list scrolled to its end clears it. The opener's top
|
|
109
|
-
// edge sits 3.75rem up; 4.5rem leaves a gap, less any lift a page control sets.
|
|
110
|
-
$effect(() => {
|
|
111
|
-
if (typeof window === 'undefined' || !window.matchMedia) return;
|
|
112
|
-
const narrow = window.matchMedia('(max-width: 79.99rem)');
|
|
113
|
-
const root = document.documentElement;
|
|
114
|
-
const sync = () =>
|
|
115
|
-
narrow.matches
|
|
116
|
-
? root.style.setProperty('--ds-float-reserve', 'calc(4.5rem - var(--ds-report-clearance, 0px))')
|
|
117
|
-
: root.style.removeProperty('--ds-float-reserve');
|
|
118
|
-
sync();
|
|
119
|
-
narrow.addEventListener('change', sync);
|
|
120
|
-
return () => {
|
|
121
|
-
narrow.removeEventListener('change', sync);
|
|
122
|
-
root.style.removeProperty('--ds-float-reserve');
|
|
123
|
-
};
|
|
124
|
-
});
|
|
125
|
-
/** Room for the document beside the column, not in its place. */
|
|
126
|
-
const BESIDE = 1250;
|
|
127
|
-
const beside = $derived(row !== null && row >= BESIDE);
|
|
128
70
|
const name = $derived(ariaLabel ?? title ?? statsTitle);
|
|
129
|
-
/** The
|
|
71
|
+
/** The sheet's title is the body's own heading, so the body leaves it to the sheet. */
|
|
130
72
|
const headed = $derived(name === (children ? title : statsTitle));
|
|
131
73
|
</script>
|
|
132
74
|
|
|
@@ -136,77 +78,36 @@
|
|
|
136
78
|
</Tooltip.Provider>
|
|
137
79
|
{/snippet}
|
|
138
80
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
{
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
{
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
{
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
'hidden max-h-full min-h-0 w-[clamp(360px,28vw,460px)] shrink-0 flex-col gap-5 xl:flex',
|
|
173
|
-
className
|
|
174
|
-
)}
|
|
175
|
-
data-slot="context-column"
|
|
176
|
-
{...restProps}
|
|
177
|
-
>
|
|
178
|
-
{@render body(false)}
|
|
179
|
-
</aside>
|
|
180
|
-
|
|
181
|
-
{#if children && documentPane && beside}
|
|
182
|
-
<div class="hidden min-h-0 min-w-0 flex-1 flex-col xl:flex" data-slot="context-column-document">
|
|
183
|
-
{@render documentPane()}
|
|
184
|
-
</div>
|
|
185
|
-
{/if}
|
|
186
|
-
|
|
187
|
-
<!-- The reachable stand-in below xl. `size-11` (44px) rather than this
|
|
188
|
-
package's usual 36px control row: this is the one control whose entire
|
|
189
|
-
job is making otherwise-unreachable content reachable, so it earns the
|
|
190
|
-
full touch-target minimum rather than the shell's ordinary density.
|
|
191
|
-
It lifts by `--ds-report-clearance` when a page control (the librarian
|
|
192
|
-
composer) shares the corner. -->
|
|
193
|
-
<button
|
|
194
|
-
type="button"
|
|
195
|
-
onclick={() => (sheetOpen = true)}
|
|
196
|
-
class="border-border bg-card text-muted-foreground hover:text-foreground ds-edge fixed right-4 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"
|
|
197
|
-
aria-label="Open {name}"
|
|
198
|
-
>
|
|
199
|
-
<PanelRight class="size-4.5" />
|
|
200
|
-
</button>
|
|
201
|
-
|
|
202
|
-
<AppDialog
|
|
203
|
-
bind:open={sheetOpen}
|
|
204
|
-
title={name}
|
|
205
|
-
subtitle={headed && children ? subtitle : undefined}
|
|
206
|
-
info={headed && !children ? statsInfo : undefined}
|
|
207
|
-
size="sm"
|
|
208
|
-
>
|
|
209
|
-
<div class={cn('flex flex-col gap-5', children && documentPane && 'h-[70dvh]')}>
|
|
210
|
-
{@render body(headed)}
|
|
211
|
-
</div>
|
|
212
|
-
</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
|
|
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 =
|
|
30
|
+
type $$ComponentProps = (ListForm | RecordForm) & {
|
|
33
31
|
ariaLabel?: string;
|
|
34
32
|
};
|
|
35
|
-
declare const ContextColumn: import("svelte").Component<$$ComponentProps, {}, "
|
|
33
|
+
declare const ContextColumn: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
36
34
|
type ContextColumn = ReturnType<typeof ContextColumn>;
|
|
37
35
|
export default ContextColumn;
|