@poodle64/ui 2026.10.28 → 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 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. It
190
- shows at every width and truncates on a phone, leading the first row. Settings
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);
@@ -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 { provideShellControls, type ShellControlsSlot } from './controls.js';
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}>{location}</span
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 NavBadge, 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;
@@ -175,3 +175,10 @@ export declare const TITLE_SEPARATOR = " \u203A ";
175
175
  * nothing matches, so an unlisted route renders no title rather than a wrong one.
176
176
  */
177
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poodle64/ui",
3
- "version": "2026.10.28",
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
  {
2
2
  "meta": {
3
3
  "package": "@poodle64/ui",
4
- "version": "2026.10.28",
4
+ "version": "2026.10.29",
5
5
  "generatedBy": "scripts/generate-registry.mjs",
6
6
  "source": "scripts/situations.json + package source (DO NOT EDIT the outputs by hand)",
7
7
  "componentCount": 75,
@@ -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.28`. 75 components, 20 situations.
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