@poodle64/ui 2026.10.21 → 2026.10.22

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.
@@ -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={collapsed ? 'sr-only' : 'truncate'}>{item.label}</span>
198
- {#if item.badge !== undefined && !collapsed}
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={collapsed ? item.label : undefined}
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={collapsed ? item.label : undefined}
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={collapsed ? 'true' : undefined}
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. `md:grid` keeps it off the mobile drawer, where collapse does
616
- not apply — the same reason the foot control carried `md:flex`.
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 class={cn('flex items-center', railNarrow ? 'flex-col gap-1 py-2' : 'pr-2')}>
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
- !railNarrow && 'ml-auto'
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={railNarrow}
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
- * {#if query.trim()}
26
- * <Command.Item forceMount value="ask" onSelect={() => ask(query)}>Ask: {query}</Command.Item>
27
- * {/if}
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
- <Command.Empty>{emptyText}</Command.Empty>
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
- * {#if query.trim()}
25
- * <Command.Item forceMount value="ask" onSelect={() => ask(query)}>Ask: {query}</Command.Item>
26
- * {/if}
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
  };
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.21",
3
+ "version": "2026.10.22",
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.21",
4
+ "version": "2026.10.22",
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": 76,
@@ -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.21`. 76 components, 20 situations.
4
+ Generated from `@poodle64/ui@2026.10.22`. 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