@poodle64/ui 2026.10.27 → 2026.10.29
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 +31 -2
- package/dist/components/ui/app-shell/app-nav.svelte +15 -2
- package/dist/components/ui/app-shell/app-shell.svelte +30 -3
- package/dist/components/ui/app-shell/bar-actions.svelte +71 -0
- package/dist/components/ui/app-shell/bar-actions.svelte.d.ts +7 -0
- package/dist/components/ui/app-shell/controls.d.ts +30 -1
- package/dist/components/ui/app-shell/controls.js +7 -0
- package/dist/components/ui/app-shell/index.d.ts +3 -1
- package/dist/components/ui/app-shell/index.js +2 -1
- package/dist/components/ui/app-shell/shell-actions.svelte +28 -0
- package/dist/components/ui/app-shell/shell-actions.svelte.d.ts +19 -0
- package/dist/components/ui/app-shell/types.d.ts +25 -2
- package/dist/components/ui/app-shell/types.js +18 -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
|
@@ -186,8 +186,10 @@ That is the whole minimum. Everything below is optional.
|
|
|
186
186
|
|
|
187
187
|
The bar also names where you are, read off `nav` and `currentPath`: "Section ›
|
|
188
188
|
Page" inside a section that has `children` ("Securities › Trading"), the item's
|
|
189
|
-
one name for a top-level page, nothing for a route the nav does not list.
|
|
190
|
-
|
|
189
|
+
one name for a top-level page, nothing for a route the nav does not list. On a
|
|
190
|
+
phone the bar holds the page's name alone ("Trading"; a section's landing child
|
|
191
|
+
whose `href` is the section's, an "Overview", reads as the section), so it has
|
|
192
|
+
the row's remaining width and does not cut. Settings
|
|
191
193
|
is not in the rail: it is the account menu's one item (`AppIdentity`'s
|
|
192
194
|
`onAccountSettings`, labelled "Settings"), and Sign out lives there only. The
|
|
193
195
|
bar also carries the page's scope controls. A page registers them
|
|
@@ -206,6 +208,18 @@ a second row of the bar below that:
|
|
|
206
208
|
</ShellControls>
|
|
207
209
|
```
|
|
208
210
|
|
|
211
|
+
A page's own actions (a download, an export) register with `ShellActions`.
|
|
212
|
+
From `sm` each is a labelled button in the bar's trailing group; below it they
|
|
213
|
+
fold into one "More actions" (`⋯`) menu listing each with its icon and name,
|
|
214
|
+
and the status stands down. The shell's own icons stay as they are.
|
|
215
|
+
|
|
216
|
+
```svelte
|
|
217
|
+
<ShellActions
|
|
218
|
+
status="Draft 0.1"
|
|
219
|
+
actions={[{ label: 'Brand guide', icon: Download, href, download: true, primary: true }]}
|
|
220
|
+
/>
|
|
221
|
+
```
|
|
222
|
+
|
|
209
223
|
A scope control changes the view of the page you are on and never
|
|
210
224
|
navigates; sub-routes are `NavItem.children`. The rail's right edge is a drag
|
|
211
225
|
handle (200–420px, arrows nudge, Home resets, a drag below 170px collapses);
|
|
@@ -281,6 +295,21 @@ belongs in the page too, as a sibling of the article it serves, and not in the
|
|
|
281
295
|
shell: it is part of that page's own reading surface, it wants that page's
|
|
282
296
|
breakpoints, and no other route should be paying rail width for it.
|
|
283
297
|
|
|
298
|
+
**A row's `badge`, and a label that never truncates.** The label is the content:
|
|
299
|
+
it wraps, never ends in an ellipsis, and the badge and the chevron keep their
|
|
300
|
+
size. A text badge (`badge: 3`, `badge: 'beta'`) is a chip that costs the label
|
|
301
|
+
room: at 15.5rem, a label, a wordy chip and a chevron do not share one line, so
|
|
302
|
+
the label takes a second. Pass the icon form wherever a label could collide
|
|
303
|
+
(a tag with words in it, any row that also has `children`):
|
|
304
|
+
|
|
305
|
+
```ts
|
|
306
|
+
import Lock from '@lucide/svelte/icons/lock';
|
|
307
|
+
{ label: 'Strategy paper', href: '/strategy', icon: FileText, badge: { icon: Lock, label: 'Only you' } }
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
It draws as a compact pill holding only the icon (12px, muted), with `label` as
|
|
311
|
+
its tooltip and accessible name. `NavBadge` is the type.
|
|
312
|
+
|
|
284
313
|
`NavItem` / `NavGroup` are exported so an app types its own config against them.
|
|
285
314
|
They carry **no notion of who may see an item**: two surveyed apps gate
|
|
286
315
|
navigation on admin or per-module permission, and both do it with their own auth
|
|
@@ -201,9 +201,22 @@
|
|
|
201
201
|
>{item.label.slice(0, 1).toUpperCase()}</span
|
|
202
202
|
>
|
|
203
203
|
{/if}
|
|
204
|
-
<span class={iconOnly ? 'sr-only' : '
|
|
204
|
+
<span class={iconOnly ? 'sr-only' : 'ds-nav-label'}>{item.label}</span>
|
|
205
205
|
{#if item.badge !== undefined && !iconOnly}
|
|
206
|
-
|
|
206
|
+
{#if typeof item.badge === 'object'}
|
|
207
|
+
{@const Mark = item.badge.icon}
|
|
208
|
+
<span
|
|
209
|
+
class="ds-nav-badge"
|
|
210
|
+
data-icon
|
|
211
|
+
role="img"
|
|
212
|
+
title={item.badge.label}
|
|
213
|
+
aria-label={item.badge.label}
|
|
214
|
+
>
|
|
215
|
+
<Mark class="size-3 flex-none" />
|
|
216
|
+
</span>
|
|
217
|
+
{:else}
|
|
218
|
+
<span class="ds-nav-badge">{item.badge}</span>
|
|
219
|
+
{/if}
|
|
207
220
|
{/if}
|
|
208
221
|
{/snippet}
|
|
209
222
|
{#if stateful}
|
|
@@ -93,9 +93,16 @@
|
|
|
93
93
|
import PanelRight from '@lucide/svelte/icons/panel-right';
|
|
94
94
|
import * as Sheet from '../sheet/index.js';
|
|
95
95
|
import AppNav from './app-nav.svelte';
|
|
96
|
-
import { activeNavTitle, toItems, type NavSource } from './types.js';
|
|
96
|
+
import { activeNavTitle, shortLocation, toItems, type NavSource } from './types.js';
|
|
97
|
+
import BarActions from './bar-actions.svelte';
|
|
97
98
|
import { shellReport } from './report.svelte.js';
|
|
98
|
-
import {
|
|
99
|
+
import {
|
|
100
|
+
provideShellActions,
|
|
101
|
+
provideShellControls,
|
|
102
|
+
type BarActionsSlot,
|
|
103
|
+
type ShellActionsHolder,
|
|
104
|
+
type ShellControlsSlot
|
|
105
|
+
} from './controls.js';
|
|
99
106
|
import { cn } from '../../../utils.js';
|
|
100
107
|
import ResizeHandle from '../resize-handle/resize-handle.svelte';
|
|
101
108
|
|
|
@@ -245,6 +252,18 @@
|
|
|
245
252
|
title
|
|
246
253
|
);
|
|
247
254
|
|
|
255
|
+
// On a phone the bar holds one name, the page's own: a trail does not fit
|
|
256
|
+
// beside the menu, the brand and the bar's icons, and cut letters help no one.
|
|
257
|
+
const shortName = $derived(shortLocation(nav, currentPath, location));
|
|
258
|
+
|
|
259
|
+
// The page's status and actions, registered by `<ShellActions>` from the route.
|
|
260
|
+
// Raw, not deep, so the page that registered it can find it again to withdraw it.
|
|
261
|
+
class PageBar implements ShellActionsHolder {
|
|
262
|
+
current = $state.raw<BarActionsSlot | null>(null);
|
|
263
|
+
}
|
|
264
|
+
const pageBar = new PageBar();
|
|
265
|
+
provideShellActions(pageBar);
|
|
266
|
+
|
|
248
267
|
// The page's scope controls, registered by `<ShellControls>` from the route.
|
|
249
268
|
const controls: ShellControlsSlot = $state({ content: null });
|
|
250
269
|
provideShellControls(controls);
|
|
@@ -837,7 +856,10 @@
|
|
|
837
856
|
{#if location}
|
|
838
857
|
<span
|
|
839
858
|
class="text-shell-muted-foreground min-w-0 truncate text-sm max-sm:flex-1 max-sm:basis-0 sm:max-w-72"
|
|
840
|
-
title={location}
|
|
859
|
+
title={location}
|
|
860
|
+
data-testid="ds-shell-title"
|
|
861
|
+
>{#if shortName && shortName !== location}<span class="max-sm:hidden">{location}</span
|
|
862
|
+
><span class="sm:hidden">{shortName}</span>{:else}{location}{/if}</span
|
|
841
863
|
>
|
|
842
864
|
{/if}
|
|
843
865
|
{#if controls.content}
|
|
@@ -913,6 +935,11 @@
|
|
|
913
935
|
</button>
|
|
914
936
|
{/if}
|
|
915
937
|
|
|
938
|
+
{#if pageBar.current}
|
|
939
|
+
<BarActions bar={pageBar.current} />
|
|
940
|
+
<span class="bg-border hidden h-6 w-px flex-none sm:block" aria-hidden="true"></span>
|
|
941
|
+
{/if}
|
|
942
|
+
|
|
916
943
|
{#if actions}{@render actions()}{/if}
|
|
917
944
|
|
|
918
945
|
{#if themeToggle}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/** The page's actions in the bar: buttons from `sm`, one "More actions" menu below it. */
|
|
3
|
+
import Ellipsis from '@lucide/svelte/icons/ellipsis';
|
|
4
|
+
import { Button } from '../button/index.js';
|
|
5
|
+
import * as DropdownMenu from '../dropdown-menu/index.js';
|
|
6
|
+
import type { BarActionsSlot } from './controls.js';
|
|
7
|
+
|
|
8
|
+
let { bar }: { bar: BarActionsSlot } = $props();
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<div class="flex items-center gap-2" data-testid="ds-shell-page-actions">
|
|
12
|
+
{#if bar.status}
|
|
13
|
+
<span class="text-muted-foreground hidden text-sm tabular-nums sm:inline">{bar.status}</span>
|
|
14
|
+
{/if}
|
|
15
|
+
<div class="hidden items-center gap-2 sm:flex">
|
|
16
|
+
{#each bar.actions as action (action.label)}
|
|
17
|
+
<Button
|
|
18
|
+
size="sm"
|
|
19
|
+
variant={action.primary ? 'default' : 'outline'}
|
|
20
|
+
href={action.href}
|
|
21
|
+
download={action.download ? '' : undefined}
|
|
22
|
+
onclick={action.onclick}
|
|
23
|
+
title={action.detail}
|
|
24
|
+
class="pointer-coarse:h-11"
|
|
25
|
+
>
|
|
26
|
+
<action.icon class="size-4" />
|
|
27
|
+
{action.label}
|
|
28
|
+
</Button>
|
|
29
|
+
{/each}
|
|
30
|
+
</div>
|
|
31
|
+
{#if bar.actions.length > 0}
|
|
32
|
+
<div class="sm:hidden">
|
|
33
|
+
<DropdownMenu.Root>
|
|
34
|
+
<DropdownMenu.Trigger
|
|
35
|
+
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"
|
|
36
|
+
aria-label="More actions"
|
|
37
|
+
data-testid="ds-shell-more"
|
|
38
|
+
>
|
|
39
|
+
<Ellipsis class="size-4" />
|
|
40
|
+
</DropdownMenu.Trigger>
|
|
41
|
+
<DropdownMenu.Content align="end" class="min-w-48">
|
|
42
|
+
{#each bar.actions as action (action.label)}
|
|
43
|
+
{#if action.href}
|
|
44
|
+
<DropdownMenu.Item class="pointer-coarse:min-h-11 pointer-coarse:text-base">
|
|
45
|
+
{#snippet child({ props })}
|
|
46
|
+
<a
|
|
47
|
+
{...props}
|
|
48
|
+
href={action.href}
|
|
49
|
+
download={action.download ? '' : undefined}
|
|
50
|
+
title={action.detail}
|
|
51
|
+
>
|
|
52
|
+
<action.icon class="size-4" />
|
|
53
|
+
{action.label}
|
|
54
|
+
</a>
|
|
55
|
+
{/snippet}
|
|
56
|
+
</DropdownMenu.Item>
|
|
57
|
+
{:else}
|
|
58
|
+
<DropdownMenu.Item
|
|
59
|
+
onSelect={() => action.onclick?.()}
|
|
60
|
+
class="pointer-coarse:min-h-11 pointer-coarse:text-base"
|
|
61
|
+
>
|
|
62
|
+
<action.icon class="size-4" />
|
|
63
|
+
{action.label}
|
|
64
|
+
</DropdownMenu.Item>
|
|
65
|
+
{/if}
|
|
66
|
+
{/each}
|
|
67
|
+
</DropdownMenu.Content>
|
|
68
|
+
</DropdownMenu.Root>
|
|
69
|
+
</div>
|
|
70
|
+
{/if}
|
|
71
|
+
</div>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BarActionsSlot } from './controls.js';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
bar: BarActionsSlot;
|
|
4
|
+
};
|
|
5
|
+
declare const BarActions: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
+
type BarActions = ReturnType<typeof BarActions>;
|
|
7
|
+
export default BarActions;
|
|
@@ -8,10 +8,39 @@
|
|
|
8
8
|
* page registers its children on mount and withdraws them on unmount. One
|
|
9
9
|
* registration at a time; a later one replaces an earlier one.
|
|
10
10
|
*/
|
|
11
|
-
import { type Snippet } from 'svelte';
|
|
11
|
+
import { type Component, type Snippet } from 'svelte';
|
|
12
12
|
export interface ShellControlsSlot {
|
|
13
13
|
content: Snippet | null;
|
|
14
14
|
}
|
|
15
15
|
export declare function provideShellControls(slot: ShellControlsSlot): void;
|
|
16
16
|
/** Undefined outside a shell: `ShellControls` then renders nothing. */
|
|
17
17
|
export declare function getShellControls(): ShellControlsSlot | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* One of the page's own actions in the top bar: a download, an export, a
|
|
20
|
+
* "new". From `sm` up the shell draws each as a labelled button; below it they
|
|
21
|
+
* fold into one "More actions" menu, so they never take the title's room.
|
|
22
|
+
*/
|
|
23
|
+
export interface BarAction {
|
|
24
|
+
label: string;
|
|
25
|
+
icon: Component<{
|
|
26
|
+
class?: string;
|
|
27
|
+
}>;
|
|
28
|
+
/** A link, or a file to download when `download` is set. */
|
|
29
|
+
href?: string;
|
|
30
|
+
download?: boolean;
|
|
31
|
+
onclick?: () => void;
|
|
32
|
+
/** The page's one primary action takes the accent. */
|
|
33
|
+
primary?: boolean;
|
|
34
|
+
/** What the label leaves out (a file's size), as the tooltip. */
|
|
35
|
+
detail?: string;
|
|
36
|
+
}
|
|
37
|
+
/** The page's status and actions in the bar, registered by `<ShellActions>`. */
|
|
38
|
+
export interface BarActionsSlot {
|
|
39
|
+
status?: string;
|
|
40
|
+
actions: readonly BarAction[];
|
|
41
|
+
}
|
|
42
|
+
export interface ShellActionsHolder {
|
|
43
|
+
current: BarActionsSlot | null;
|
|
44
|
+
}
|
|
45
|
+
export declare function provideShellActions(holder: ShellActionsHolder): void;
|
|
46
|
+
export declare function getShellActions(): ShellActionsHolder | undefined;
|
|
@@ -17,3 +17,10 @@ export function provideShellControls(slot) {
|
|
|
17
17
|
export function getShellControls() {
|
|
18
18
|
return getContext(KEY);
|
|
19
19
|
}
|
|
20
|
+
const ACTIONS_KEY = Symbol('ds-shell-actions');
|
|
21
|
+
export function provideShellActions(holder) {
|
|
22
|
+
setContext(ACTIONS_KEY, holder);
|
|
23
|
+
}
|
|
24
|
+
export function getShellActions() {
|
|
25
|
+
return getContext(ACTIONS_KEY);
|
|
26
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
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
|
+
export { default as ShellActions } from './shell-actions.svelte';
|
|
5
|
+
export type { BarAction } from './controls.js';
|
|
4
6
|
export { default } from './app-shell.svelte';
|
|
5
7
|
export { default as PagePane } from './page-pane.svelte';
|
|
6
8
|
export { default as PageAside } from './page-aside.svelte';
|
|
7
9
|
export { PAGE_TYPES, type PageAsideRegistration, type PageColumnState, type PagePaneRegistration, type PageType } from './page.js';
|
|
8
10
|
export { SHELL_TEXTURES, type ShellTexture } from './texture.js';
|
|
9
|
-
export { activeNavTitle, hasActiveNavChild, isNavGroup, isNavItemActive, navChildren, toGroups, toItems, type IconComponent, type NavChildItem, type NavEntry, type NavGroup, type NavItem, type NavSource } from './types.js';
|
|
11
|
+
export { activeNavTitle, hasActiveNavChild, isNavGroup, isNavItemActive, shortLocation, navChildren, toGroups, toItems, type IconComponent, type NavBadge, type NavChildItem, type NavEntry, type NavGroup, type NavItem, type NavSource } from './types.js';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
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
|
+
export { default as ShellActions } from './shell-actions.svelte';
|
|
4
5
|
export { default } from './app-shell.svelte';
|
|
5
6
|
export { default as PagePane } from './page-pane.svelte';
|
|
6
7
|
export { default as PageAside } from './page-aside.svelte';
|
|
7
8
|
export { PAGE_TYPES } from './page.js';
|
|
8
9
|
export { SHELL_TEXTURES } from './texture.js';
|
|
9
|
-
export { activeNavTitle, hasActiveNavChild, isNavGroup, isNavItemActive, navChildren, toGroups, toItems } from './types.js';
|
|
10
|
+
export { activeNavTitle, hasActiveNavChild, isNavGroup, isNavItemActive, shortLocation, navChildren, toGroups, toItems } from './types.js';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Registers this page's status and actions in the shell's top bar. Renders
|
|
4
|
+
* nothing where it stands.
|
|
5
|
+
*
|
|
6
|
+
* <ShellActions status="Draft 0.1" actions={[{ label: 'Brand guide', icon: Download, href, download: true, primary: true }]} />
|
|
7
|
+
*
|
|
8
|
+
* Wide, each action is a labelled button beside the bar's own icons. On a
|
|
9
|
+
* phone the status stands down and the actions fold into one "More actions"
|
|
10
|
+
* menu, so the title keeps the row. One registration at a time; a later one
|
|
11
|
+
* replaces an earlier one.
|
|
12
|
+
*/
|
|
13
|
+
import { getShellActions, type BarAction } from './controls.js';
|
|
14
|
+
|
|
15
|
+
let { status, actions = [] }: { status?: string; actions?: readonly BarAction[] } = $props();
|
|
16
|
+
|
|
17
|
+
const holder = getShellActions();
|
|
18
|
+
|
|
19
|
+
$effect(() => {
|
|
20
|
+
if (!holder) return;
|
|
21
|
+
const registration = { status, actions };
|
|
22
|
+
if (!status && actions.length === 0) return;
|
|
23
|
+
holder.current = registration;
|
|
24
|
+
return () => {
|
|
25
|
+
if (holder.current === registration) holder.current = null;
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registers this page's status and actions in the shell's top bar. Renders
|
|
3
|
+
* nothing where it stands.
|
|
4
|
+
*
|
|
5
|
+
* <ShellActions status="Draft 0.1" actions={[{ label: 'Brand guide', icon: Download, href, download: true, primary: true }]} />
|
|
6
|
+
*
|
|
7
|
+
* Wide, each action is a labelled button beside the bar's own icons. On a
|
|
8
|
+
* phone the status stands down and the actions fold into one "More actions"
|
|
9
|
+
* menu, so the title keeps the row. One registration at a time; a later one
|
|
10
|
+
* replaces an earlier one.
|
|
11
|
+
*/
|
|
12
|
+
import { type BarAction } from './controls.js';
|
|
13
|
+
type $$ComponentProps = {
|
|
14
|
+
status?: string;
|
|
15
|
+
actions?: readonly BarAction[];
|
|
16
|
+
};
|
|
17
|
+
declare const ShellActions: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
18
|
+
type ShellActions = ReturnType<typeof ShellActions>;
|
|
19
|
+
export default ShellActions;
|
|
@@ -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;
|
|
@@ -159,3 +175,10 @@ export declare const TITLE_SEPARATOR = " \u203A ";
|
|
|
159
175
|
* nothing matches, so an unlisted route renders no title rather than a wrong one.
|
|
160
176
|
*/
|
|
161
177
|
export declare function activeNavTitle(nav: NavSource | undefined, currentPath: string | undefined): string | undefined;
|
|
178
|
+
/**
|
|
179
|
+
* The phone bar's one name for where the user is: the page's own name, never a
|
|
180
|
+
* trail. A child that is its section's landing page (its `href` is the
|
|
181
|
+
* section's, an "Overview") is named by the section, since "Overview" says
|
|
182
|
+
* nothing alone. Off the rail, the last segment of whatever trail was given.
|
|
183
|
+
*/
|
|
184
|
+
export declare function shortLocation(nav: NavSource | undefined, currentPath: string | undefined, fallback?: string): string | undefined;
|
|
@@ -129,3 +129,21 @@ export function activeNavTitle(nav, currentPath) {
|
|
|
129
129
|
}
|
|
130
130
|
return undefined;
|
|
131
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* The phone bar's one name for where the user is: the page's own name, never a
|
|
134
|
+
* trail. A child that is its section's landing page (its `href` is the
|
|
135
|
+
* section's, an "Overview") is named by the section, since "Overview" says
|
|
136
|
+
* nothing alone. Off the rail, the last segment of whatever trail was given.
|
|
137
|
+
*/
|
|
138
|
+
export function shortLocation(nav, currentPath, fallback) {
|
|
139
|
+
if (currentPath) {
|
|
140
|
+
for (const item of toItems(nav)) {
|
|
141
|
+
const child = navChildren(item).find((c) => isNavItemActive(c, currentPath));
|
|
142
|
+
if (child)
|
|
143
|
+
return child.href === item.href ? item.label : child.label;
|
|
144
|
+
if (isNavItemActive(item, currentPath))
|
|
145
|
+
return item.label;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return fallback?.split(TITLE_SEPARATOR).pop();
|
|
149
|
+
}
|
package/dist/styles.css
CHANGED
|
@@ -676,8 +676,8 @@
|
|
|
676
676
|
`auto` too (CSSOM's "if one axis is visible and the other is not, the
|
|
677
677
|
visible one becomes auto" rule), so a row wider than the nav — a long
|
|
678
678
|
label, a wide badge — got its own sideways scrollbar inside the drawer.
|
|
679
|
-
The drawer scrolls vertically only; a row that doesn't fit
|
|
680
|
-
(`.ds-nav-
|
|
679
|
+
The drawer scrolls vertically only; a row that doesn't fit wraps its label
|
|
680
|
+
(`.ds-nav-label`) rather than
|
|
681
681
|
growing a second scroll axis on top of the menu's own (design-system#111). */
|
|
682
682
|
overflow-x: hidden;
|
|
683
683
|
}
|
|
@@ -790,12 +790,31 @@
|
|
|
790
790
|
color: var(--ds-nav-ink-muted);
|
|
791
791
|
}
|
|
792
792
|
|
|
793
|
+
/* The label is the content: it wraps, never truncates, and the badge and the
|
|
794
|
+
chevron keep their own size (a chip that does not fit costs the label a
|
|
795
|
+
line, not its letters). `anywhere` also breaks a single word wider than the
|
|
796
|
+
rail. */
|
|
797
|
+
.ds-nav-label {
|
|
798
|
+
min-width: 0;
|
|
799
|
+
white-space: normal;
|
|
800
|
+
overflow-wrap: anywhere;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
/* The icon form: a pill the size of its glyph, no text to collide. */
|
|
804
|
+
.ds-nav-badge[data-icon] {
|
|
805
|
+
display: inline-grid;
|
|
806
|
+
place-items: center;
|
|
807
|
+
padding: 0.1875rem 0.375rem;
|
|
808
|
+
color: var(--ds-nav-ink-muted);
|
|
809
|
+
}
|
|
810
|
+
|
|
793
811
|
/* A count badge is small text on a tint, so it carries the 4.5:1 text floor
|
|
794
812
|
with the least margin of anything in the nav — and it was the worst of the
|
|
795
813
|
three (#11): 1.73:1 under a warm amber, and 3.72:1 even on the package
|
|
796
814
|
default, because it sits on the active row's tint AND its own. Same fix,
|
|
797
815
|
same reason: the ink is the chrome's, the brand stays in the chip. */
|
|
798
816
|
.ds-nav-badge {
|
|
817
|
+
flex: none;
|
|
799
818
|
margin-left: auto;
|
|
800
819
|
border-radius: 9999px;
|
|
801
820
|
padding: 0 0.375rem;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poodle64/ui",
|
|
3
|
-
"version": "2026.10.
|
|
3
|
+
"version": "2026.10.29",
|
|
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.29`. 75 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
|
|