@poodle64/ui 2026.10.21 → 2026.10.23
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 +12 -5
- package/dist/components/alerts/alert-bell.svelte +5 -3
- package/dist/components/alerts/alert-bell.svelte.d.ts +1 -0
- package/dist/components/feedback/report-widget.svelte +13 -3
- package/dist/components/feedback/report-widget.svelte.d.ts +1 -0
- package/dist/components/settings/settings-page.svelte +6 -2
- package/dist/components/settings/settings-page.svelte.d.ts +1 -0
- package/dist/components/ui/app-dialog/app-dialog.svelte +15 -3
- package/dist/components/ui/app-dialog/app-dialog.svelte.d.ts +2 -0
- package/dist/components/ui/app-identity/app-identity.svelte +10 -1
- package/dist/components/ui/app-identity/app-identity.svelte.d.ts +6 -0
- package/dist/components/ui/app-shell/app-nav.svelte +13 -5
- package/dist/components/ui/app-shell/app-nav.svelte.d.ts +4 -0
- package/dist/components/ui/app-shell/app-shell.svelte +19 -6
- package/dist/components/ui/command-palette/command-palette.svelte +20 -5
- package/dist/components/ui/command-palette/command-palette.svelte.d.ts +14 -4
- package/dist/components/ui/context-column/context-column.svelte +29 -15
- package/dist/components/ui/info-tip/info-tip.svelte +5 -1
- package/dist/components/ui/ledger/ledger.svelte +2 -2
- package/dist/components/ui/list-toolbar/list-toolbar.svelte +37 -27
- package/dist/components/ui/panel/panel.svelte +5 -5
- package/dist/components/ui/panel/panel.svelte.d.ts +4 -4
- package/dist/components/ui/record-switcher/record-switcher.svelte +36 -2
- package/dist/components/ui/schema-form/schema-form.svelte +5 -3
- package/dist/components/ui/schema-form/types.d.ts +8 -0
- package/dist/components/ui/stat-list/stat-list.svelte +14 -9
- package/dist/components/ui/stat-list/stat-list.svelte.d.ts +2 -0
- package/dist/styles.css +21 -2
- package/package.json +1 -1
- package/registry/component-map.json +1 -1
- package/registry/component-map.md +1 -1
package/README.md
CHANGED
|
@@ -98,8 +98,8 @@ rather than rebuilding it:
|
|
|
98
98
|
| `page-section` | A section of a page: `title` at `level` 2 or 3, an optional `description`, `count` and `actions`, and its content at one distance below. |
|
|
99
99
|
| `document-reader` | A document to read: PageHeader, the body (`html` the app sanitised, or `children`) in `.ds-prose` at the reading measure, and a contents list from its own headings. See [A document to read](#a-document-to-read). |
|
|
100
100
|
| `content-skeleton` | A region loading, shaped like what replaces it: `rows`, `tiles` or `prose`. A whole page waiting is LoadingState. |
|
|
101
|
-
| `panel` | The generic titled card, and the settings section: optional icon, a
|
|
102
|
-
| `list-toolbar` | The bar above a list, on the page ground: title, count, icon actions named by their tooltips, one labelled action. The Ledger and the RecordList draw theirs with it. |
|
|
101
|
+
| `panel` | The generic titled card, and the settings section: optional icon, a short `subtitle` or a longer `description`, both wrapping, trailing `action`s, a body that can opt out of padding or scroll inside the card (`scroll`), an optional `footer` strip for Save/Cancel, and `tone="destructive"` for a danger zone. There is no `SettingsSection`; see [The settings destination](#the-settings-destination). |
|
|
102
|
+
| `list-toolbar` | The bar above a list, on the page ground: title, count (both wrap when crowded, after the controls drop to their own line), icon actions named by their tooltips, one labelled action. The Ledger and the RecordList draw theirs with it. |
|
|
103
103
|
| `record-list` | The ledger's look for a list that is not money. See [Lists that are not money](#lists-that-are-not-money). |
|
|
104
104
|
| `record-switcher` | The open record's whole name as the top bar's control, its menu finding, grouping and picturing every record, and the record's pages as tabs. |
|
|
105
105
|
| `document-pane` | One document beside what it belongs to: titled, closable, its page fitted, with paging and zoom (a `PageCanvas` in a `Panel`). |
|
|
@@ -429,8 +429,8 @@ all three serve any route:
|
|
|
429
429
|
</Panel>
|
|
430
430
|
```
|
|
431
431
|
|
|
432
|
-
`description`
|
|
433
|
-
|
|
432
|
+
`description` and `subtitle` both wrap, never end in an ellipsis; the subtitle
|
|
433
|
+
is the short qualifier under the title. Carry one or the other. A page writes a run of `Panel`s and no
|
|
434
434
|
wrapper: the pane stacks them on the package's section rhythm itself.
|
|
435
435
|
|
|
436
436
|
### A working list beside a page's own content
|
|
@@ -1015,7 +1015,7 @@ Settled here, the same in every module, and not props:
|
|
|
1015
1015
|
row with no note centres its title. The checkbox, the review chip, the date and
|
|
1016
1016
|
every single-value cell centre too.
|
|
1017
1017
|
- **One mark per kind.** A review chip (StatusBadge's dot and label on a tint)
|
|
1018
|
-
beside the title on line one, which
|
|
1018
|
+
beside the title on line one, which wraps (to two lines at most) before the chip gives any width; a synthetic row's "Not as printed" badge leads its second line and
|
|
1019
1019
|
opens the row in place to the lines it was made from.
|
|
1020
1020
|
- **PocketSmith's look.** No panel around the list; a head card exactly as wide
|
|
1021
1021
|
as the group cards, its columns on theirs; one rounded card per period with
|
|
@@ -1652,6 +1652,13 @@ routes by situation, so it stands outside the situation→component registry
|
|
|
1652
1652
|
for the same reason. `getSessionId()` reading null when telemetry is off is
|
|
1653
1653
|
ordinary, not an error: the report sends with a null `session_id`.
|
|
1654
1654
|
|
|
1655
|
+
The bottom-right corner is the widget's, and it publishes its footprint on the
|
|
1656
|
+
document: `--ds-report-reserve`, the room the shell leaves at a padded page's
|
|
1657
|
+
end so its last control scrolls clear; `--ds-report-beside`, where another
|
|
1658
|
+
fixed control in the corner sits, beside the trigger and inside that room
|
|
1659
|
+
(`ContextColumn`'s opener). A page control under the corner lifts the trigger
|
|
1660
|
+
with `--ds-report-clearance` instead (the librarian composer does).
|
|
1661
|
+
|
|
1655
1662
|
## The alerts bell
|
|
1656
1663
|
|
|
1657
1664
|
`@poodle64/ui/alerts` (`AlertBell`) is app machinery of the same kind: the app
|
|
@@ -33,8 +33,10 @@
|
|
|
33
33
|
|
|
34
34
|
let {
|
|
35
35
|
/** The app's alerts route, defaulting to the one every factory app serves. */
|
|
36
|
-
endpoint = '/api/alerts'
|
|
37
|
-
|
|
36
|
+
endpoint = '/api/alerts',
|
|
37
|
+
/** The request function; the app's own where its API client stamps every call (View as colleague, workspace). */
|
|
38
|
+
fetch: send
|
|
39
|
+
}: { endpoint?: string; fetch?: typeof fetch } = $props();
|
|
38
40
|
|
|
39
41
|
const POLL_MS = 60_000;
|
|
40
42
|
const TIMEOUT_MS = 30_000;
|
|
@@ -46,7 +48,7 @@
|
|
|
46
48
|
let open = $state(false);
|
|
47
49
|
|
|
48
50
|
function call(path: string, method = 'GET'): Promise<Response | null> {
|
|
49
|
-
return fetch(`${endpoint}/${path}`, { method, signal: AbortSignal.timeout(TIMEOUT_MS) }).catch(
|
|
51
|
+
return (send ?? fetch)(`${endpoint}/${path}`, { method, signal: AbortSignal.timeout(TIMEOUT_MS) }).catch(
|
|
50
52
|
() => null
|
|
51
53
|
);
|
|
52
54
|
}
|
|
@@ -36,9 +36,12 @@
|
|
|
36
36
|
/** Who reads a report, as "the <team> team". The app's own name, never an internal one. */
|
|
37
37
|
team = 'support',
|
|
38
38
|
/** Fired with the id the endpoint returned, once, on the success leg. */
|
|
39
|
-
onSubmitted
|
|
39
|
+
onSubmitted,
|
|
40
|
+
/** The request function; the app's own where its API client stamps every call (View as colleague, workspace). */
|
|
41
|
+
fetch: send
|
|
40
42
|
}: {
|
|
41
43
|
endpoint?: string;
|
|
44
|
+
fetch?: typeof fetch;
|
|
42
45
|
team?: string;
|
|
43
46
|
onSubmitted?: (id: string) => void;
|
|
44
47
|
} = $props();
|
|
@@ -62,7 +65,14 @@
|
|
|
62
65
|
$effect(() => {
|
|
63
66
|
const root = document.documentElement;
|
|
64
67
|
root.style.setProperty('--ds-report-reserve', 'calc(4.5rem - var(--ds-report-clearance, 0px))');
|
|
65
|
-
|
|
68
|
+
// The corner is this widget's. Another fixed control in it sits beside the
|
|
69
|
+
// trigger, this far in from the right edge with the same gap, so it stays
|
|
70
|
+
// inside the reserve too (ContextColumn's opener does).
|
|
71
|
+
root.style.setProperty('--ds-report-beside', '4.5rem');
|
|
72
|
+
return () => {
|
|
73
|
+
root.style.removeProperty('--ds-report-reserve');
|
|
74
|
+
root.style.removeProperty('--ds-report-beside');
|
|
75
|
+
};
|
|
66
76
|
});
|
|
67
77
|
|
|
68
78
|
async function submit() {
|
|
@@ -77,7 +87,7 @@
|
|
|
77
87
|
}
|
|
78
88
|
|
|
79
89
|
try {
|
|
80
|
-
const response = await fetch(endpoint, {
|
|
90
|
+
const response = await (send ?? fetch)(endpoint, {
|
|
81
91
|
method: 'POST',
|
|
82
92
|
headers: { 'Content-Type': 'application/json' },
|
|
83
93
|
body: JSON.stringify({
|
|
@@ -35,8 +35,11 @@
|
|
|
35
35
|
title = 'Application',
|
|
36
36
|
subtitle = "Runtime settings this deployment's operator can change without a code change or a deploy.",
|
|
37
37
|
/** What a 401 does: the app's own re-authentication (its API client's redirect), since only the app knows its sign-in. */
|
|
38
|
-
onunauthorized
|
|
38
|
+
onunauthorized,
|
|
39
|
+
/** The request function; the app's own where its API client stamps every call (View as colleague, workspace). */
|
|
40
|
+
fetch: send
|
|
39
41
|
}: {
|
|
42
|
+
fetch?: typeof fetch;
|
|
40
43
|
endpoint?: string;
|
|
41
44
|
title?: string;
|
|
42
45
|
subtitle?: string;
|
|
@@ -63,7 +66,7 @@
|
|
|
63
66
|
): Promise<{ data: T } | { failure: string }> {
|
|
64
67
|
let response: Response;
|
|
65
68
|
try {
|
|
66
|
-
response = await fetch(`${endpoint}/${path}`, {
|
|
69
|
+
response = await (send ?? fetch)(`${endpoint}/${path}`, {
|
|
67
70
|
...init,
|
|
68
71
|
credentials: 'include',
|
|
69
72
|
signal: AbortSignal.timeout(TIMEOUT_MS)
|
|
@@ -136,6 +139,7 @@
|
|
|
136
139
|
<LoadingState message="Loading…" class="mt-16" />
|
|
137
140
|
{:else}
|
|
138
141
|
<Panel title="Settings">
|
|
142
|
+
<!-- Not validated in the browser (SchemaForm's default): the server validates each PATCH and its refusal is the toast. -->
|
|
139
143
|
<SchemaForm schema={formSchema!} uischema={formLayout} value={formValue} onChange={handleChange} />
|
|
140
144
|
</Panel>
|
|
141
145
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet, Component } from 'svelte';
|
|
3
3
|
import * as Dialog from '../dialog/index.js';
|
|
4
|
+
import InfoTip from '../info-tip/info-tip.svelte';
|
|
4
5
|
import X from '@lucide/svelte/icons/x';
|
|
5
6
|
|
|
6
7
|
// The one dialogue frame: a titled header with optional icon and subtitle, a
|
|
@@ -11,6 +12,7 @@
|
|
|
11
12
|
onOpenChange,
|
|
12
13
|
title,
|
|
13
14
|
subtitle,
|
|
15
|
+
info,
|
|
14
16
|
icon: Icon,
|
|
15
17
|
size = 'md',
|
|
16
18
|
children,
|
|
@@ -35,6 +37,8 @@
|
|
|
35
37
|
onOpenChange?: (open: boolean) => void;
|
|
36
38
|
title: string;
|
|
37
39
|
subtitle?: string;
|
|
40
|
+
/** A tip beside the title, as PageHeader's: what the name means. */
|
|
41
|
+
info?: string;
|
|
38
42
|
icon?: Component<{ class?: string }>;
|
|
39
43
|
/**
|
|
40
44
|
* The dialogue's measure. Named rather than free-form for the same reason
|
|
@@ -81,9 +85,17 @@
|
|
|
81
85
|
</span>
|
|
82
86
|
{/if}
|
|
83
87
|
<div class="min-w-0 flex-1">
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
88
|
+
<div class="flex items-center gap-2">
|
|
89
|
+
<Dialog.Title class="font-display text-lg leading-tight font-semibold tracking-[var(--ds-font-display-tracking,-0.025em)]"
|
|
90
|
+
>{title}</Dialog.Title
|
|
91
|
+
>
|
|
92
|
+
{#if info}
|
|
93
|
+
<InfoTip
|
|
94
|
+
text={info}
|
|
95
|
+
class="text-muted-foreground/50 hover:text-muted-foreground size-4 transition-colors"
|
|
96
|
+
/>
|
|
97
|
+
{/if}
|
|
98
|
+
</div>
|
|
87
99
|
{#if subtitle}
|
|
88
100
|
<Dialog.Description class="text-muted-foreground mt-0.5 text-sm"
|
|
89
101
|
>{subtitle}</Dialog.Description
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
onAccountSettings,
|
|
52
52
|
onManageMembers,
|
|
53
53
|
onSwitchTheme,
|
|
54
|
+
themeToggle = true,
|
|
54
55
|
links = []
|
|
55
56
|
}: {
|
|
56
57
|
user: { username: string; display_name: string | null; email: string | null };
|
|
@@ -78,6 +79,12 @@
|
|
|
78
79
|
onManageMembers?: () => void;
|
|
79
80
|
/** Override the theme action. Defaults to mode-watcher's toggleMode, matching AppShell. */
|
|
80
81
|
onSwitchTheme?: () => void;
|
|
82
|
+
/**
|
|
83
|
+
* Show the "Switch theme" row. Same name and default as AppShell's
|
|
84
|
+
* `themeToggle`; set both false in a dark-only (or light-only) app, so no
|
|
85
|
+
* theme control is left that does nothing.
|
|
86
|
+
*/
|
|
87
|
+
themeToggle?: boolean;
|
|
81
88
|
/**
|
|
82
89
|
* App destinations the fixed entries have no room for, rendered in their
|
|
83
90
|
* own group.
|
|
@@ -232,7 +239,9 @@
|
|
|
232
239
|
</DropdownMenu.Group>
|
|
233
240
|
{/if}
|
|
234
241
|
<DropdownMenu.Separator />
|
|
235
|
-
|
|
242
|
+
{#if themeToggle}
|
|
243
|
+
<DropdownMenu.Item onSelect={switchTheme}>Switch theme</DropdownMenu.Item>
|
|
244
|
+
{/if}
|
|
236
245
|
<DropdownMenu.Item onSelect={onAccountSettings}>Account settings</DropdownMenu.Item>
|
|
237
246
|
<DropdownMenu.Separator />
|
|
238
247
|
<DropdownMenu.Item class="text-status-error" onSelect={onSignOut}>Sign out</DropdownMenu.Item>
|
|
@@ -67,6 +67,12 @@ type $$ComponentProps = {
|
|
|
67
67
|
onManageMembers?: () => void;
|
|
68
68
|
/** Override the theme action. Defaults to mode-watcher's toggleMode, matching AppShell. */
|
|
69
69
|
onSwitchTheme?: () => void;
|
|
70
|
+
/**
|
|
71
|
+
* Show the "Switch theme" row. Same name and default as AppShell's
|
|
72
|
+
* `themeToggle`; set both false in a dark-only (or light-only) app, so no
|
|
73
|
+
* theme control is left that does nothing.
|
|
74
|
+
*/
|
|
75
|
+
themeToggle?: boolean;
|
|
70
76
|
/**
|
|
71
77
|
* App destinations the fixed entries have no room for, rendered in their
|
|
72
78
|
* own group.
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
nav,
|
|
34
34
|
currentPath,
|
|
35
35
|
collapsed = false,
|
|
36
|
+
peek = false,
|
|
36
37
|
label = 'Primary',
|
|
37
38
|
onNavigate,
|
|
38
39
|
selected,
|
|
@@ -45,6 +46,10 @@
|
|
|
45
46
|
currentPath?: string;
|
|
46
47
|
/** Icon-only mode. Labels stay in the accessible tree via sr-only text. */
|
|
47
48
|
collapsed?: boolean;
|
|
49
|
+
/** Collapsed, with the labels drawn: the rail peeking. The collapsed
|
|
50
|
+
* structure stays (a rule for a heading, no child rows), so not one row
|
|
51
|
+
* moves under the pointer that opened it. */
|
|
52
|
+
peek?: boolean;
|
|
48
53
|
/** Accessible name for the landmark; distinguish a secondary column. */
|
|
49
54
|
label?: string;
|
|
50
55
|
/** Fired after any nav link activates — AppShell uses it to shut the drawer. */
|
|
@@ -68,6 +73,8 @@
|
|
|
68
73
|
} = $props();
|
|
69
74
|
|
|
70
75
|
const groups = $derived(toGroups(nav));
|
|
76
|
+
/** The labels are hidden: collapsed and not peeking. */
|
|
77
|
+
const iconOnly = $derived(collapsed && !peek);
|
|
71
78
|
|
|
72
79
|
// Ids are real ids in the consumer's document, and this component renders
|
|
73
80
|
// more than once per page by design (the rail, plus any route-scoped second
|
|
@@ -194,8 +201,8 @@
|
|
|
194
201
|
>{item.label.slice(0, 1).toUpperCase()}</span
|
|
195
202
|
>
|
|
196
203
|
{/if}
|
|
197
|
-
<span class={
|
|
198
|
-
{#if item.badge !== undefined && !
|
|
204
|
+
<span class={iconOnly ? 'sr-only' : 'truncate'}>{item.label}</span>
|
|
205
|
+
{#if item.badge !== undefined && !iconOnly}
|
|
199
206
|
<span class="ds-nav-badge">{item.badge}</span>
|
|
200
207
|
{/if}
|
|
201
208
|
{/snippet}
|
|
@@ -211,7 +218,7 @@
|
|
|
211
218
|
class="ds-nav-item w-full text-start"
|
|
212
219
|
data-active={active ? 'true' : undefined}
|
|
213
220
|
aria-current={active ? 'true' : undefined}
|
|
214
|
-
title={
|
|
221
|
+
title={iconOnly ? item.label : undefined}
|
|
215
222
|
onclick={() => {
|
|
216
223
|
onSelect(item.href);
|
|
217
224
|
onNavigate?.();
|
|
@@ -234,7 +241,7 @@
|
|
|
234
241
|
data-within={within ? 'true' : undefined}
|
|
235
242
|
data-child={opts.child ? 'true' : undefined}
|
|
236
243
|
aria-current={active ? 'page' : undefined}
|
|
237
|
-
title={
|
|
244
|
+
title={iconOnly ? item.label : undefined}
|
|
238
245
|
target={item.external ? '_blank' : undefined}
|
|
239
246
|
rel={item.external ? 'noreferrer noopener' : undefined}
|
|
240
247
|
onclick={onNavigate}
|
|
@@ -248,7 +255,8 @@
|
|
|
248
255
|
<nav
|
|
249
256
|
class={cn('ds-nav flex flex-1 flex-col gap-5 overflow-y-auto px-3 py-4', className)}
|
|
250
257
|
aria-label={label}
|
|
251
|
-
data-collapsed={
|
|
258
|
+
data-collapsed={iconOnly ? 'true' : undefined}
|
|
259
|
+
data-peek={collapsed && peek ? 'true' : undefined}
|
|
252
260
|
>
|
|
253
261
|
{#each groups as group, i (group.heading ?? group.items[0]?.href ?? i)}
|
|
254
262
|
<div class="flex flex-col gap-1">
|
|
@@ -5,6 +5,10 @@ type $$ComponentProps = {
|
|
|
5
5
|
currentPath?: string;
|
|
6
6
|
/** Icon-only mode. Labels stay in the accessible tree via sr-only text. */
|
|
7
7
|
collapsed?: boolean;
|
|
8
|
+
/** Collapsed, with the labels drawn: the rail peeking. The collapsed
|
|
9
|
+
* structure stays (a rule for a heading, no child rows), so not one row
|
|
10
|
+
* moves under the pointer that opened it. */
|
|
11
|
+
peek?: boolean;
|
|
8
12
|
/** Accessible name for the landmark; distinguish a secondary column. */
|
|
9
13
|
label?: string;
|
|
10
14
|
/** Fired after any nav link activates — AppShell uses it to shut the drawer. */
|
|
@@ -469,7 +469,8 @@
|
|
|
469
469
|
class={cn(
|
|
470
470
|
'flex flex-none items-center gap-2.5',
|
|
471
471
|
compact ? '' : 'h-14 px-4',
|
|
472
|
-
railNarrow && !compact && 'justify-center px-0'
|
|
472
|
+
railNarrow && !compact && 'justify-center px-0',
|
|
473
|
+
railCollapsed && !railNarrow && !compact && 'px-3'
|
|
473
474
|
)}
|
|
474
475
|
aria-label={brandTitle ?? 'Home'}
|
|
475
476
|
>
|
|
@@ -612,18 +613,29 @@
|
|
|
612
613
|
the foot that read as a navigation destination. Expanded, it sits right
|
|
613
614
|
of the wordmark (`ml-auto`); collapsed, the head has no room beside the
|
|
614
615
|
mark, so the row becomes a column and the toggle stacks under it,
|
|
615
|
-
centred.
|
|
616
|
-
|
|
616
|
+
centred. A peek keeps that column, the mark and the toggle where the
|
|
617
|
+
slim rail put them: a peeked row half the height pulled every nav row 50px up
|
|
618
|
+
under the pointer, and a click landed on the row below the one aimed
|
|
619
|
+
at (caspo#177). `md:grid` keeps it off the mobile drawer, where
|
|
620
|
+
collapse does not apply — the same reason the foot control carried
|
|
621
|
+
`md:flex`.
|
|
617
622
|
-->
|
|
618
623
|
{#if collapsible}
|
|
619
|
-
<div
|
|
624
|
+
<div
|
|
625
|
+
class={cn(
|
|
626
|
+
'flex',
|
|
627
|
+
railCollapsed ? 'flex-col gap-1 py-2' : 'items-center pr-2',
|
|
628
|
+
railNarrow && 'items-center'
|
|
629
|
+
)}
|
|
630
|
+
>
|
|
620
631
|
{@render brandLockup()}
|
|
621
632
|
<button
|
|
622
633
|
type="button"
|
|
623
634
|
onclick={toggleCollapsed}
|
|
624
635
|
class={cn(
|
|
625
636
|
'text-shell-muted-foreground hover:text-shell-foreground hidden size-8 flex-none place-items-center rounded-md transition-colors md:grid',
|
|
626
|
-
!
|
|
637
|
+
!railCollapsed && 'ml-auto',
|
|
638
|
+
railCollapsed && !railNarrow && 'ml-3'
|
|
627
639
|
)}
|
|
628
640
|
aria-label={collapseLabel}
|
|
629
641
|
aria-pressed={collapsed}
|
|
@@ -643,7 +655,8 @@
|
|
|
643
655
|
<AppNav
|
|
644
656
|
{nav}
|
|
645
657
|
{currentPath}
|
|
646
|
-
collapsed={
|
|
658
|
+
collapsed={railCollapsed}
|
|
659
|
+
peek={peeking}
|
|
647
660
|
label={navLabel}
|
|
648
661
|
onNavigate={() => (mobileNavOpen = false)}
|
|
649
662
|
/>
|
|
@@ -19,12 +19,18 @@
|
|
|
19
19
|
* `query` is the text in the input, bindable, so an app can offer a row that
|
|
20
20
|
* acts on what was typed ("Ask the agent: …", "Search everything for …"). Pass
|
|
21
21
|
* `forceMount` on that row, or the palette's own filter hides it the moment
|
|
22
|
-
* the text matches no label
|
|
22
|
+
* the text matches no label. In `lead` it renders above the nav group and
|
|
23
|
+
* ungrouped, so it leads whether or not the text also matches a destination
|
|
24
|
+
* (the filter's sort moves every group after it), and it is what answers a
|
|
25
|
+
* text nothing else matches, so no "No results." line is drawn over it.
|
|
26
|
+
* `children` is for groups of the app's own, beneath the nav group:
|
|
23
27
|
*
|
|
24
28
|
* <CommandPalette bind:open bind:query {nav}>
|
|
25
|
-
* {#
|
|
26
|
-
*
|
|
27
|
-
*
|
|
29
|
+
* {#snippet lead()}
|
|
30
|
+
* {#if query.trim()}
|
|
31
|
+
* <Command.Item forceMount value="ask" onSelect={() => ask(query)}>Ask: {query}</Command.Item>
|
|
32
|
+
* {/if}
|
|
33
|
+
* {/snippet}
|
|
28
34
|
* </CommandPalette>
|
|
29
35
|
*/
|
|
30
36
|
import type { Snippet } from 'svelte';
|
|
@@ -40,6 +46,7 @@
|
|
|
40
46
|
navHeading = 'Navigate',
|
|
41
47
|
emptyText = 'No results.',
|
|
42
48
|
shortcut = true,
|
|
49
|
+
lead,
|
|
43
50
|
children
|
|
44
51
|
}: {
|
|
45
52
|
open?: boolean;
|
|
@@ -58,6 +65,10 @@
|
|
|
58
65
|
emptyText?: string;
|
|
59
66
|
/** Bind ⌘K / Ctrl-K to toggle. Turn off to drive `open` yourself. */
|
|
60
67
|
shortcut?: boolean;
|
|
68
|
+
/** App rows above the nav group, left ungrouped so they stay first while
|
|
69
|
+
* the filter sorts: an action on what was typed. Given, the palette
|
|
70
|
+
* draws no empty line of its own. */
|
|
71
|
+
lead?: Snippet;
|
|
61
72
|
/** Extra command groups: app-specific actions beneath the nav group. */
|
|
62
73
|
children?: Snippet;
|
|
63
74
|
} = $props();
|
|
@@ -91,7 +102,11 @@
|
|
|
91
102
|
<Command.Dialog bind:open title="Command palette" description={placeholder}>
|
|
92
103
|
<Command.Input {placeholder} bind:value={query} />
|
|
93
104
|
<Command.List>
|
|
94
|
-
|
|
105
|
+
{#if lead}
|
|
106
|
+
{@render lead()}
|
|
107
|
+
{:else}
|
|
108
|
+
<Command.Empty>{emptyText}</Command.Empty>
|
|
109
|
+
{/if}
|
|
95
110
|
|
|
96
111
|
{#if items.length > 0}
|
|
97
112
|
<Command.Group heading={navHeading}>
|
|
@@ -18,12 +18,18 @@
|
|
|
18
18
|
* `query` is the text in the input, bindable, so an app can offer a row that
|
|
19
19
|
* acts on what was typed ("Ask the agent: …", "Search everything for …"). Pass
|
|
20
20
|
* `forceMount` on that row, or the palette's own filter hides it the moment
|
|
21
|
-
* the text matches no label
|
|
21
|
+
* the text matches no label. In `lead` it renders above the nav group and
|
|
22
|
+
* ungrouped, so it leads whether or not the text also matches a destination
|
|
23
|
+
* (the filter's sort moves every group after it), and it is what answers a
|
|
24
|
+
* text nothing else matches, so no "No results." line is drawn over it.
|
|
25
|
+
* `children` is for groups of the app's own, beneath the nav group:
|
|
22
26
|
*
|
|
23
27
|
* <CommandPalette bind:open bind:query {nav}>
|
|
24
|
-
* {#
|
|
25
|
-
*
|
|
26
|
-
*
|
|
28
|
+
* {#snippet lead()}
|
|
29
|
+
* {#if query.trim()}
|
|
30
|
+
* <Command.Item forceMount value="ask" onSelect={() => ask(query)}>Ask: {query}</Command.Item>
|
|
31
|
+
* {/if}
|
|
32
|
+
* {/snippet}
|
|
27
33
|
* </CommandPalette>
|
|
28
34
|
*/
|
|
29
35
|
import type { Snippet } from 'svelte';
|
|
@@ -45,6 +51,10 @@ type $$ComponentProps = {
|
|
|
45
51
|
emptyText?: string;
|
|
46
52
|
/** Bind ⌘K / Ctrl-K to toggle. Turn off to drive `open` yourself. */
|
|
47
53
|
shortcut?: boolean;
|
|
54
|
+
/** App rows above the nav group, left ungrouped so they stay first while
|
|
55
|
+
* the filter sorts: an action on what was typed. Given, the palette
|
|
56
|
+
* draws no empty line of its own. */
|
|
57
|
+
lead?: Snippet;
|
|
48
58
|
/** Extra command groups: app-specific actions beneath the nav group. */
|
|
49
59
|
children?: Snippet;
|
|
50
60
|
};
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
onClose,
|
|
79
79
|
children,
|
|
80
80
|
documentPane,
|
|
81
|
-
/** The
|
|
82
|
-
|
|
81
|
+
/** The column's name: its landmark's, its opener's and its dialogue's.
|
|
82
|
+
Defaults to the opened item's title, else the stat card's. */
|
|
83
83
|
ariaLabel,
|
|
84
84
|
ref = $bindable(null),
|
|
85
85
|
class: className,
|
|
@@ -107,6 +107,8 @@
|
|
|
107
107
|
const BESIDE = 1250;
|
|
108
108
|
const beside = $derived(row !== null && row >= BESIDE);
|
|
109
109
|
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. */
|
|
111
|
+
const headed = $derived(name === (children ? title : statsTitle));
|
|
110
112
|
</script>
|
|
111
113
|
|
|
112
114
|
{#snippet close()}
|
|
@@ -115,12 +117,12 @@
|
|
|
115
117
|
</Tooltip.Provider>
|
|
116
118
|
{/snippet}
|
|
117
119
|
|
|
118
|
-
{#snippet item()}
|
|
120
|
+
{#snippet item(framed: boolean)}
|
|
119
121
|
{#key title}
|
|
120
122
|
<Panel
|
|
121
|
-
{title}
|
|
122
|
-
{subtitle}
|
|
123
|
-
action={onClose ? close : undefined}
|
|
123
|
+
title={framed ? undefined : title}
|
|
124
|
+
subtitle={framed ? undefined : subtitle}
|
|
125
|
+
action={onClose && !framed ? close : undefined}
|
|
124
126
|
pad={false}
|
|
125
127
|
scroll
|
|
126
128
|
class="max-h-full min-h-0"
|
|
@@ -131,11 +133,13 @@
|
|
|
131
133
|
{/key}
|
|
132
134
|
{/snippet}
|
|
133
135
|
|
|
134
|
-
|
|
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)}
|
|
135
139
|
{#if children}
|
|
136
|
-
{#if documentPane && row !== null && !beside}{@render documentPane()}{:else}{@render item()}{/if}
|
|
140
|
+
{#if documentPane && row !== null && !beside}{@render documentPane()}{:else}{@render item(framed)}{/if}
|
|
137
141
|
{:else}
|
|
138
|
-
<StatList items={stats ?? []} title={statsTitle} info={statsInfo} />
|
|
142
|
+
<StatList items={stats ?? []} title={statsTitle} info={statsInfo} bare={framed} />
|
|
139
143
|
{#if detail}
|
|
140
144
|
{@render detail()}
|
|
141
145
|
{/if}
|
|
@@ -144,7 +148,7 @@
|
|
|
144
148
|
|
|
145
149
|
<aside
|
|
146
150
|
bind:this={ref}
|
|
147
|
-
aria-label={
|
|
151
|
+
aria-label={name}
|
|
148
152
|
class={cn(
|
|
149
153
|
'hidden max-h-full min-h-0 w-[clamp(360px,28vw,460px)] shrink-0 flex-col gap-5 xl:flex',
|
|
150
154
|
className
|
|
@@ -152,7 +156,7 @@
|
|
|
152
156
|
data-slot="context-column"
|
|
153
157
|
{...restProps}
|
|
154
158
|
>
|
|
155
|
-
{@render body()}
|
|
159
|
+
{@render body(false)}
|
|
156
160
|
</aside>
|
|
157
161
|
|
|
158
162
|
{#if children && documentPane && beside}
|
|
@@ -164,18 +168,28 @@
|
|
|
164
168
|
<!-- The reachable stand-in below xl. `size-11` (44px) rather than this
|
|
165
169
|
package's usual 36px control row: this is the one control whose entire
|
|
166
170
|
job is making otherwise-unreachable content reachable, so it earns the
|
|
167
|
-
full touch-target minimum rather than the shell's ordinary density.
|
|
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. -->
|
|
168
176
|
<button
|
|
169
177
|
type="button"
|
|
170
178
|
onclick={() => (sheetOpen = true)}
|
|
171
|
-
class="border-border bg-card text-muted-foreground hover:text-foreground ds-edge fixed right-
|
|
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"
|
|
172
180
|
aria-label="Open {name}"
|
|
173
181
|
>
|
|
174
182
|
<PanelRight class="size-4.5" />
|
|
175
183
|
</button>
|
|
176
184
|
|
|
177
|
-
<AppDialog
|
|
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
|
+
>
|
|
178
192
|
<div class={cn('flex flex-col gap-5', children && documentPane && 'h-[70dvh]')}>
|
|
179
|
-
{@render body()}
|
|
193
|
+
{@render body(headed)}
|
|
180
194
|
</div>
|
|
181
195
|
</AppDialog>
|
|
@@ -20,7 +20,11 @@
|
|
|
20
20
|
} = $props();
|
|
21
21
|
</script>
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
<!-- Opened by hover or a keyboard's focus, never by focus a script moves after a
|
|
24
|
+
click or tap: a dialogue whose first control is a tip (AppDialog's `info`)
|
|
25
|
+
opens with it shut. Opened from the keyboard, the focused tip shows, as
|
|
26
|
+
tabbing to it would. -->
|
|
27
|
+
<Tooltip.Provider delayDuration={150} ignoreNonKeyboardFocus>
|
|
24
28
|
<Tooltip.Root>
|
|
25
29
|
<!--
|
|
26
30
|
The icon trigger takes a 44x44 hit area (`size-11`) and hands the space
|
|
@@ -524,7 +524,7 @@
|
|
|
524
524
|
data-slot="ledger-title"
|
|
525
525
|
>
|
|
526
526
|
<span class="flex min-w-0 items-center gap-1.5">
|
|
527
|
-
<span class="min-w-0
|
|
527
|
+
<span class="min-w-0 line-clamp-2 break-words">{r.title}</span>
|
|
528
528
|
{#if r.attachment}{@render clip(r)}{/if}
|
|
529
529
|
{@render chip(r)}
|
|
530
530
|
{#if c.actions}<span class="pointer-events-auto flex flex-none items-center gap-1" data-slot="ledger-actions">{@render c.actions(r)}</span>{/if}
|
|
@@ -676,7 +676,7 @@
|
|
|
676
676
|
{/if}
|
|
677
677
|
<span class="pointer-events-none flex min-w-0 flex-col justify-center gap-0.5">
|
|
678
678
|
<span class="flex min-w-0 items-center gap-1.5">
|
|
679
|
-
<span class="min-w-0
|
|
679
|
+
<span class="min-w-0 line-clamp-2 font-medium break-words">{r.title}</span>
|
|
680
680
|
{#if r.attachment}{@render clip(r)}{/if}
|
|
681
681
|
{@render chip(r)}
|
|
682
682
|
{#if titleColumn?.actions}<span class="pointer-events-auto flex flex-none items-center gap-1" data-slot="ledger-actions">{@render titleColumn.actions(r)}</span>{/if}
|
|
@@ -50,36 +50,46 @@
|
|
|
50
50
|
<div
|
|
51
51
|
role="toolbar"
|
|
52
52
|
aria-label={label ?? title}
|
|
53
|
-
class={cn('flex min-h-11 flex-none items-center gap-2 px-2 pb-2', className)}
|
|
53
|
+
class={cn('flex min-h-11 flex-none flex-wrap items-center gap-x-2 gap-y-1 px-2 pb-2', className)}
|
|
54
54
|
data-slot="list-toolbar"
|
|
55
55
|
{...restProps}
|
|
56
56
|
>
|
|
57
57
|
{@render leading?.()}
|
|
58
|
-
<!--
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
<IconAction action={tool} />
|
|
69
|
-
{/each}
|
|
70
|
-
</Tooltip.Provider>
|
|
71
|
-
{/if}
|
|
72
|
-
{#if action}
|
|
73
|
-
<Button
|
|
74
|
-
variant="outline"
|
|
75
|
-
size="sm"
|
|
76
|
-
href={action.href}
|
|
77
|
-
download={action.href ? (action.download === true ? '' : action.download || undefined) : undefined}
|
|
78
|
-
disabled={action.disabled}
|
|
79
|
-
onclick={action.onclick}
|
|
80
|
-
data-slot="list-toolbar-action"
|
|
81
|
-
>
|
|
82
|
-
{#if ActionIcon}<ActionIcon />{/if}{action.label}
|
|
83
|
-
</Button>
|
|
58
|
+
<!--
|
|
59
|
+
Crowded, nothing ends in an ellipsis: the controls drop together to a
|
|
60
|
+
line of their own, still at the end, then the count drops under the
|
|
61
|
+
title, then the title wraps.
|
|
62
|
+
-->
|
|
63
|
+
{#if title || meta}
|
|
64
|
+
<div class="flex min-w-0 flex-wrap items-baseline gap-x-2.5">
|
|
65
|
+
{#if title}<h2 class="text-body min-w-0 font-semibold break-words">{title}</h2>{/if}
|
|
66
|
+
{#if meta}<span class="text-muted-foreground min-w-0 text-sm break-words">{meta}</span>{/if}
|
|
67
|
+
</div>
|
|
84
68
|
{/if}
|
|
69
|
+
<div
|
|
70
|
+
class="ml-auto flex min-w-0 flex-wrap items-center justify-end gap-2 [&:not(:has(>*))]:hidden"
|
|
71
|
+
data-slot="list-toolbar-controls"
|
|
72
|
+
>
|
|
73
|
+
{@render children?.()}
|
|
74
|
+
{#if tools.length}
|
|
75
|
+
<Tooltip.Provider delayDuration={150}>
|
|
76
|
+
{#each tools as tool (tool.label)}
|
|
77
|
+
<IconAction action={tool} />
|
|
78
|
+
{/each}
|
|
79
|
+
</Tooltip.Provider>
|
|
80
|
+
{/if}
|
|
81
|
+
{#if action}
|
|
82
|
+
<Button
|
|
83
|
+
variant="outline"
|
|
84
|
+
size="sm"
|
|
85
|
+
href={action.href}
|
|
86
|
+
download={action.href ? (action.download === true ? '' : action.download || undefined) : undefined}
|
|
87
|
+
disabled={action.disabled}
|
|
88
|
+
onclick={action.onclick}
|
|
89
|
+
data-slot="list-toolbar-action"
|
|
90
|
+
>
|
|
91
|
+
{#if ActionIcon}<ActionIcon />{/if}{action.label}
|
|
92
|
+
</Button>
|
|
93
|
+
{/if}
|
|
94
|
+
</div>
|
|
85
95
|
</div>
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
}: WithElementRef<HTMLAttributes<HTMLElement>> & {
|
|
33
33
|
title?: string;
|
|
34
34
|
/**
|
|
35
|
-
* A
|
|
36
|
-
*
|
|
37
|
-
* subtitle that wrapped would change it everywhere at once.
|
|
35
|
+
* A short qualifier under the title. It WRAPS: a header is as tall as its
|
|
36
|
+
* text, so a phone shows the whole qualifier rather than "Profit and l…".
|
|
38
37
|
*
|
|
39
38
|
* For the sentence or two that explains what the section is for, use
|
|
40
|
-
* `description`, which
|
|
39
|
+
* `description`, which sits in the same place with more room. Carry one
|
|
40
|
+
* or the other, not both.
|
|
41
41
|
*/
|
|
42
42
|
subtitle?: string;
|
|
43
43
|
/**
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
{title}
|
|
121
121
|
</h2>
|
|
122
122
|
{#if subtitle}
|
|
123
|
-
<p class="text-muted-foreground
|
|
123
|
+
<p class="text-muted-foreground text-xs break-words">{subtitle}</p>
|
|
124
124
|
{/if}
|
|
125
125
|
{#if description}
|
|
126
126
|
<p class="text-muted-foreground mt-1 text-sm">{description}</p>
|
|
@@ -4,12 +4,12 @@ import { type WithElementRef } from '../../../utils.js';
|
|
|
4
4
|
type $$ComponentProps = WithElementRef<HTMLAttributes<HTMLElement>> & {
|
|
5
5
|
title?: string;
|
|
6
6
|
/**
|
|
7
|
-
* A
|
|
8
|
-
*
|
|
9
|
-
* subtitle that wrapped would change it everywhere at once.
|
|
7
|
+
* A short qualifier under the title. It WRAPS: a header is as tall as its
|
|
8
|
+
* text, so a phone shows the whole qualifier rather than "Profit and l…".
|
|
10
9
|
*
|
|
11
10
|
* For the sentence or two that explains what the section is for, use
|
|
12
|
-
* `description`, which
|
|
11
|
+
* `description`, which sits in the same place with more room. Carry one
|
|
12
|
+
* or the other, not both.
|
|
13
13
|
*/
|
|
14
14
|
subtitle?: string;
|
|
15
15
|
/**
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* a thumbnail each, and ends with the way to all of them, so it still
|
|
7
7
|
* works at fifty. The record's own pages follow as tabs. On a phone the
|
|
8
8
|
* breadcrumb (the section's name and the "/") gives way, and the tabs scroll
|
|
9
|
-
* sideways inside the row, so every page stays reachable.
|
|
9
|
+
* sideways inside the row, so every page stays reachable. The open page is
|
|
10
|
+
* scrolled into view, and a strip with more beyond an edge fades that edge,
|
|
11
|
+
* so a hidden tab is never silent.
|
|
10
12
|
*
|
|
11
13
|
* It places nothing itself: put it inside `ShellControls` with whatever
|
|
12
14
|
* else the page sets in the bar.
|
|
@@ -79,6 +81,33 @@
|
|
|
79
81
|
*/
|
|
80
82
|
// svelte-ignore state_referenced_locally
|
|
81
83
|
let highlighted = $state(here());
|
|
84
|
+
/** The page strip, and whether tabs lie past its left or right edge. */
|
|
85
|
+
let strip = $state<HTMLElement | null>(null);
|
|
86
|
+
let moreBefore = $state(false);
|
|
87
|
+
let moreAfter = $state(false);
|
|
88
|
+
const measure = () => {
|
|
89
|
+
if (!strip) return;
|
|
90
|
+
moreBefore = strip.scrollLeft > 1;
|
|
91
|
+
moreAfter = strip.scrollLeft + strip.clientWidth < strip.scrollWidth - 1;
|
|
92
|
+
};
|
|
93
|
+
$effect(() => {
|
|
94
|
+
const at = pages.findIndex((p) => p.current);
|
|
95
|
+
if (!strip) return;
|
|
96
|
+
const open = strip.children[at] as HTMLElement | undefined;
|
|
97
|
+
if (open) {
|
|
98
|
+
const left = open.offsetLeft;
|
|
99
|
+
const right = left + open.offsetWidth;
|
|
100
|
+
if (left < strip.scrollLeft) strip.scrollLeft = left;
|
|
101
|
+
else if (right > strip.scrollLeft + strip.clientWidth) strip.scrollLeft = right - strip.clientWidth;
|
|
102
|
+
}
|
|
103
|
+
measure();
|
|
104
|
+
if (typeof ResizeObserver === 'undefined') return;
|
|
105
|
+
// The tabs too: a label or a font that changes their width moves the strip's end.
|
|
106
|
+
const watch = new ResizeObserver(measure);
|
|
107
|
+
for (const el of [strip, ...strip.children]) watch.observe(el);
|
|
108
|
+
return () => watch.disconnect();
|
|
109
|
+
});
|
|
110
|
+
const fade = (edge: boolean) => (edge ? '1.5rem' : '0px');
|
|
82
111
|
const eyebrow = 'text-muted-foreground text-2xs tracking-eyebrow font-semibold uppercase';
|
|
83
112
|
</script>
|
|
84
113
|
|
|
@@ -150,8 +179,13 @@
|
|
|
150
179
|
|
|
151
180
|
{#if pages.length}
|
|
152
181
|
<nav
|
|
182
|
+
bind:this={strip}
|
|
153
183
|
aria-label="Pages of {name}"
|
|
154
|
-
class="ml-1 flex min-w-0 items-stretch gap-1 self-stretch overflow-x-auto sm:ml-3"
|
|
184
|
+
class="relative ml-1 flex min-w-0 items-stretch gap-1 self-stretch overflow-x-auto sm:ml-3"
|
|
185
|
+
style="--fade-start: {fade(moreBefore)}; --fade-end: {fade(moreAfter)}; mask-image: linear-gradient(to right, transparent, #000 var(--fade-start), #000 calc(100% - var(--fade-end)), transparent); -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--fade-start), #000 calc(100% - var(--fade-end)), transparent);"
|
|
186
|
+
data-more-before={moreBefore || undefined}
|
|
187
|
+
data-more-after={moreAfter || undefined}
|
|
188
|
+
onscroll={measure}
|
|
155
189
|
>
|
|
156
190
|
{#each pages as p (p.href)}
|
|
157
191
|
<a
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
value,
|
|
37
37
|
onChange,
|
|
38
38
|
disabled = false,
|
|
39
|
+
validate = false,
|
|
39
40
|
idPrefix = 'sf',
|
|
40
41
|
class: className
|
|
41
42
|
}: SchemaFormProps = $props();
|
|
@@ -59,11 +60,12 @@
|
|
|
59
60
|
*/
|
|
60
61
|
const errors = $derived.by(() => {
|
|
61
62
|
const byPath: Record<string, string[]> = {};
|
|
63
|
+
if (!validate) return byPath;
|
|
62
64
|
try {
|
|
63
|
-
const
|
|
65
|
+
const check = ajv.compile(schema as object);
|
|
64
66
|
const probe = structuredClone($state.snapshot(value));
|
|
65
|
-
if (
|
|
66
|
-
for (const error of
|
|
67
|
+
if (check(probe)) return byPath;
|
|
68
|
+
for (const error of check.errors ?? []) {
|
|
67
69
|
const missing = (error.params as { missingProperty?: string })?.missingProperty;
|
|
68
70
|
const instance = error.instancePath.replace(/^\//, '').split('/').filter(Boolean).join('.');
|
|
69
71
|
const path = missing ? [instance, missing].filter(Boolean).join('.') : instance;
|
|
@@ -54,6 +54,14 @@ export interface SchemaFormProps {
|
|
|
54
54
|
onChange: (next: Record<string, unknown>, change: SchemaFormChange) => void;
|
|
55
55
|
/** Disable every control in the form. */
|
|
56
56
|
disabled?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Validate the value against the schema in the browser; default false. Ajv
|
|
59
|
+
* compiles a schema with `new Function`, which a Content-Security-Policy
|
|
60
|
+
* without `'unsafe-eval'` refuses (every factory app's), so the form compiles
|
|
61
|
+
* nothing and marks no violation, and the page shows its server's refusals.
|
|
62
|
+
* Pass `true` on a host without that policy.
|
|
63
|
+
*/
|
|
64
|
+
validate?: boolean;
|
|
57
65
|
/** Prefix for generated element ids, when two forms share a page. */
|
|
58
66
|
idPrefix?: string;
|
|
59
67
|
/** Extra classes on the form's root element. */
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
items,
|
|
30
30
|
title = 'At a glance',
|
|
31
31
|
info,
|
|
32
|
+
bare = false,
|
|
32
33
|
class: klass = '',
|
|
33
34
|
ref = $bindable(null),
|
|
34
35
|
...restProps
|
|
@@ -36,6 +37,8 @@
|
|
|
36
37
|
items: StatItem[];
|
|
37
38
|
title?: string;
|
|
38
39
|
info?: string;
|
|
40
|
+
/** Leave the header out: the frame around the card (a dialogue) carries its title and info. */
|
|
41
|
+
bare?: boolean;
|
|
39
42
|
} = $props();
|
|
40
43
|
</script>
|
|
41
44
|
|
|
@@ -44,15 +47,17 @@
|
|
|
44
47
|
class="bg-card border-border ds-edge flex shrink-0 flex-col overflow-hidden rounded-lg border {klass}"
|
|
45
48
|
{...restProps}
|
|
46
49
|
>
|
|
47
|
-
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
{#if !bare}
|
|
51
|
+
<header class="border-border flex items-center gap-2 border-b px-4 py-3">
|
|
52
|
+
<h2 class="text-body leading-tight font-semibold tracking-tight">{title}</h2>
|
|
53
|
+
{#if info}
|
|
54
|
+
<InfoTip
|
|
55
|
+
text={info}
|
|
56
|
+
class="text-muted-foreground/50 hover:text-muted-foreground size-3.5 transition-colors"
|
|
57
|
+
/>
|
|
58
|
+
{/if}
|
|
59
|
+
</header>
|
|
60
|
+
{/if}
|
|
56
61
|
<dl class="flex flex-col">
|
|
57
62
|
{#each items as item (item.label)}
|
|
58
63
|
<div
|
|
@@ -17,6 +17,8 @@ type $$ComponentProps = WithElementRef<HTMLAttributes<HTMLElement>> & {
|
|
|
17
17
|
items: StatItem[];
|
|
18
18
|
title?: string;
|
|
19
19
|
info?: string;
|
|
20
|
+
/** Leave the header out: the frame around the card (a dialogue) carries its title and info. */
|
|
21
|
+
bare?: boolean;
|
|
20
22
|
};
|
|
21
23
|
declare const StatList: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
22
24
|
type StatList = ReturnType<typeof StatList>;
|
package/dist/styles.css
CHANGED
|
@@ -251,6 +251,15 @@
|
|
|
251
251
|
--color-accent-foreground: var(--accent-foreground, var(--ds-color-foreground));
|
|
252
252
|
--color-input: var(--input, var(--ds-color-border));
|
|
253
253
|
|
|
254
|
+
/* The accent as TEXT. An accent chosen as a fill can fail 4.5:1 as text
|
|
255
|
+
(caspo's is 2.48:1 on its light ground), so every text use of it reads
|
|
256
|
+
--ds-color-primary-ink, which an app sets where its accent fails as text;
|
|
257
|
+
unset, it is the accent itself, resolved live at the element. Tailwind's
|
|
258
|
+
`text-*` reads `--text-color-*` before `--color-*`, so `text-primary`
|
|
259
|
+
takes the ink while `bg-`, `border-` and `ring-primary` keep the fill.
|
|
260
|
+
A key @poodle64/design-tokens does not register (it owns `--color-primary`). */
|
|
261
|
+
--text-color-primary: var(--ds-color-primary-ink, var(--ds-color-primary));
|
|
262
|
+
|
|
254
263
|
/* The shell's chrome surface — the nav rail and the top bar.
|
|
255
264
|
Deliberately NOT `sidebar`. `20-sveltekit-frontend.md` makes the
|
|
256
265
|
`sidebar-*` set the app's own to define, and this package registers
|
|
@@ -571,7 +580,7 @@
|
|
|
571
580
|
}
|
|
572
581
|
|
|
573
582
|
.ds-chip-primary {
|
|
574
|
-
color: var(--ds-color-primary);
|
|
583
|
+
color: var(--ds-color-primary-ink, var(--ds-color-primary));
|
|
575
584
|
background: color-mix(in oklch, var(--ds-color-primary) 14%, transparent);
|
|
576
585
|
}
|
|
577
586
|
.ds-dot-primary {
|
|
@@ -676,9 +685,12 @@
|
|
|
676
685
|
--ds-nav-chrome-ink-muted: var(--ds-shell-chrome-muted-foreground);
|
|
677
686
|
}
|
|
678
687
|
|
|
688
|
+
/* One height labelled or icon-only (the 1.25rem line, not the 1.125rem
|
|
689
|
+
icon, sets it), so a peek that draws the labels moves no row. */
|
|
679
690
|
.ds-nav-item {
|
|
680
691
|
position: relative;
|
|
681
692
|
display: flex;
|
|
693
|
+
min-height: 2.25rem;
|
|
682
694
|
align-items: center;
|
|
683
695
|
gap: 0.75rem;
|
|
684
696
|
border-radius: var(--ds-radius-md);
|
|
@@ -913,6 +925,13 @@
|
|
|
913
925
|
padding-inline: 0;
|
|
914
926
|
}
|
|
915
927
|
|
|
928
|
+
/* Peeking, a row's icon keeps the place the slim rail centred it in (the
|
|
929
|
+
rail less the nav's 0.75rem gutters, less the 1.125rem icon, halved), the
|
|
930
|
+
label drawn after it: nothing under the pointer moves, across or down. */
|
|
931
|
+
.ds-nav[data-peek='true'] .ds-nav-item {
|
|
932
|
+
padding-inline: calc((var(--ds-shell-rail-width-collapsed) - 1.5rem - 1.125rem) / 2) 0.625rem;
|
|
933
|
+
}
|
|
934
|
+
|
|
916
935
|
/* The settings destination's two panes (SettingsShell).
|
|
917
936
|
|
|
918
937
|
Only the SHAPE is here; the list's width, tint and rule are utilities on the
|
|
@@ -1240,7 +1259,7 @@
|
|
|
1240
1259
|
}
|
|
1241
1260
|
|
|
1242
1261
|
.ds-prose a {
|
|
1243
|
-
color: var(--ds-color-primary);
|
|
1262
|
+
color: var(--ds-color-primary-ink, var(--ds-color-primary));
|
|
1244
1263
|
text-decoration: underline;
|
|
1245
1264
|
text-underline-offset: 2px;
|
|
1246
1265
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poodle64/ui",
|
|
3
|
-
"version": "2026.10.
|
|
3
|
+
"version": "2026.10.23",
|
|
4
4
|
"description": "Household shared component layer: shadcn-svelte primitives (bits-ui) plus the composed page chrome every app builds its routes from, restyled by each app's @poodle64/design-tokens alias layer. One fix reaches every app.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @poodle64/ui — situation → component map
|
|
2
2
|
|
|
3
3
|
<!-- GENERATED by scripts/generate-registry.mjs from scripts/situations.json + package source. DO NOT EDIT. -->
|
|
4
|
-
Generated from `@poodle64/ui@2026.10.
|
|
4
|
+
Generated from `@poodle64/ui@2026.10.23`. 76 components, 20 situations.
|
|
5
5
|
|
|
6
6
|
**Read this before writing a `<div>`.** Find the SITUATION you are in below, then compose the component named for it — do not hand-build it from raw `Card` or utility classes. Import is `import { Name } from '<import path>'`. Props marked `?` are optional. This map is the retrieval step the [`frontend-design` skill] makes mandatory; the [CHI 2026 study] measured composing-from-a-registry at 95% design-system compliance against 71% for writing the CSS from a prose style guide.
|
|
7
7
|
|