@poodle64/ui 2026.10.20 → 2026.10.21

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.
@@ -310,6 +310,53 @@
310
310
  // that), so this can never suppress a legitimate desktop collapse.
311
311
  const railCollapsed = $derived(collapsible && collapsed && !mobileNavOpen);
312
312
 
313
+ // A collapsed rail PEEKS: while a mouse rests on it, or keyboard focus is
314
+ // inside it, it widens over the page to show labels, and slims again when
315
+ // either leaves. The page does not reflow (the rail keeps its slim slot and
316
+ // the extra width overlays; see `data-peek` in styles.css). `collapsed` is
317
+ // untouched, so what an app persists is still the user's pin, the toggle.
318
+ //
319
+ // Pointer peeks need a mouse or pen: a touch tap fires pointerenter too, and
320
+ // a rail that opened on a tap would sit over the link being aimed at. Below
321
+ // md the rail is a drawer, never `railCollapsed`, so this cannot arise there.
322
+ // Focus peeks only for keyboard focus (`:focus-visible`), so pressing the
323
+ // toggle with a mouse does not hold the rail open. `peekSuppressed` is the
324
+ // other half of that: collapsing from under the pointer would otherwise peek
325
+ // at once and read as a toggle that did nothing, so it waits for the pointer
326
+ // to leave first.
327
+ const PEEK_DELAY_MS = 120;
328
+ let pointerOn = $state(false);
329
+ let focusIn = $state(false);
330
+ let peekSuppressed = $state(false);
331
+ let peekTimer: ReturnType<typeof setTimeout> | undefined;
332
+ const peeking = $derived(railCollapsed && !peekSuppressed && (pointerOn || focusIn));
333
+ // What the rail DRAWS: labels while peeking, icons otherwise.
334
+ const railNarrow = $derived(railCollapsed && !peeking);
335
+
336
+ function peekPointerEnter(event: PointerEvent) {
337
+ if (event.pointerType === 'touch') return;
338
+ clearTimeout(peekTimer);
339
+ peekTimer = setTimeout(() => (pointerOn = true), PEEK_DELAY_MS);
340
+ }
341
+ function peekPointerLeave() {
342
+ clearTimeout(peekTimer);
343
+ pointerOn = false;
344
+ peekSuppressed = false;
345
+ }
346
+ function peekFocusIn(event: FocusEvent) {
347
+ const target = event.target as HTMLElement | null;
348
+ if (target?.matches?.(':focus-visible')) focusIn = true;
349
+ }
350
+ function peekFocusOut(event: FocusEvent) {
351
+ const next = event.relatedTarget as Node | null;
352
+ if (!next || !(event.currentTarget as HTMLElement).contains(next)) focusIn = false;
353
+ }
354
+ function toggleCollapsed() {
355
+ collapsed = !collapsed;
356
+ peekSuppressed = true;
357
+ }
358
+ $effect(() => () => clearTimeout(peekTimer));
359
+
313
360
  // The collapse toggle's accessible name states what pressing it will DO, so it
314
361
  // flips with the state: collapsed → "Expand", expanded → "Collapse".
315
362
  const collapseLabel = $derived(collapsed ? 'Expand sidebar' : 'Collapse sidebar');
@@ -411,7 +458,7 @@
411
458
  !e.altKey &&
412
459
  !isTypingTarget(e.target)
413
460
  ) {
414
- collapsed = !collapsed;
461
+ toggleCollapsed();
415
462
  }
416
463
  }}
417
464
  />
@@ -422,7 +469,7 @@
422
469
  class={cn(
423
470
  'flex flex-none items-center gap-2.5',
424
471
  compact ? '' : 'h-14 px-4',
425
- railCollapsed && !compact && 'justify-center px-0'
472
+ railNarrow && !compact && 'justify-center px-0'
426
473
  )}
427
474
  aria-label={brandTitle ?? 'Home'}
428
475
  >
@@ -443,7 +490,7 @@
443
490
  {@render brandMark()}
444
491
  </span>
445
492
  {/if}
446
- {#if brandTitle && !railCollapsed}
493
+ {#if brandTitle && !railNarrow}
447
494
  <!--
448
495
  The wordmark stands down below sm, leaving the mark alone. On a phone
449
496
  the rail is gone, so this same lockup is what the top bar carries — and
@@ -534,6 +581,7 @@
534
581
  class="ds-shell-rail bg-shell text-shell-foreground border-border flex-none flex-col border-r"
535
582
  style={railWidth ? `--ds-shell-rail-width: ${railWidth}px` : undefined}
536
583
  data-collapsed={railCollapsed ? 'true' : undefined}
584
+ data-peek={peeking ? 'true' : undefined}
537
585
  data-resizing={resizing ? 'true' : undefined}
538
586
  data-drawer={mobileNavOpen ? 'true' : undefined}
539
587
  data-testid={mobileNavOpen ? 'ds-shell-drawer' : undefined}
@@ -541,6 +589,10 @@
541
589
  aria-modal={mobileNavOpen ? 'true' : undefined}
542
590
  aria-label={mobileNavOpen ? 'Navigation' : undefined}
543
591
  onkeydown={trapTab}
592
+ onpointerenter={peekPointerEnter}
593
+ onpointerleave={peekPointerLeave}
594
+ onfocusin={peekFocusIn}
595
+ onfocusout={peekFocusOut}
544
596
  >
545
597
  {#if mobileNavOpen}
546
598
  <button
@@ -564,14 +616,14 @@
564
616
  not apply — the same reason the foot control carried `md:flex`.
565
617
  -->
566
618
  {#if collapsible}
567
- <div class={cn('flex items-center', railCollapsed ? 'flex-col gap-1 py-2' : 'pr-2')}>
619
+ <div class={cn('flex items-center', railNarrow ? 'flex-col gap-1 py-2' : 'pr-2')}>
568
620
  {@render brandLockup()}
569
621
  <button
570
622
  type="button"
571
- onclick={() => (collapsed = !collapsed)}
623
+ onclick={toggleCollapsed}
572
624
  class={cn(
573
625
  'text-shell-muted-foreground hover:text-shell-foreground hidden size-8 flex-none place-items-center rounded-md transition-colors md:grid',
574
- !railCollapsed && 'ml-auto'
626
+ !railNarrow && 'ml-auto'
575
627
  )}
576
628
  aria-label={collapseLabel}
577
629
  aria-pressed={collapsed}
@@ -591,7 +643,7 @@
591
643
  <AppNav
592
644
  {nav}
593
645
  {currentPath}
594
- collapsed={railCollapsed}
646
+ collapsed={railNarrow}
595
647
  label={navLabel}
596
648
  onNavigate={() => (mobileNavOpen = false)}
597
649
  />
@@ -617,7 +669,7 @@
617
669
  onclick={() => (mobileNavOpen = false)}
618
670
  >
619
671
  <Settings class="ds-nav-icon size-[1.125rem] flex-none" aria-hidden="true" />
620
- <span class={railCollapsed && !mobileNavOpen ? 'sr-only' : 'truncate'}>
672
+ <span class={railNarrow && !mobileNavOpen ? 'sr-only' : 'truncate'}>
621
673
  {settingsLabel}
622
674
  </span>
623
675
  </a>
@@ -629,7 +681,10 @@
629
681
  bind:dragging={resizing}
630
682
  storageKey="ds-shell-rail-width"
631
683
  snap={170}
632
- onsnap={() => (collapsed = true)}
684
+ onsnap={() => {
685
+ collapsed = true;
686
+ peekSuppressed = true;
687
+ }}
633
688
  data-testid="ds-rail-resize"
634
689
  />
635
690
  {/if}
@@ -15,6 +15,17 @@
15
15
  * let paletteOpen = $state(false);
16
16
  * <AppShell {nav} onSearch={() => (paletteOpen = true)}>…</AppShell>
17
17
  * <CommandPalette bind:open={paletteOpen} {nav} onNavigate={goto} />
18
+ *
19
+ * `query` is the text in the input, bindable, so an app can offer a row that
20
+ * acts on what was typed ("Ask the agent: …", "Search everything for …"). Pass
21
+ * `forceMount` on that row, or the palette's own filter hides it the moment
22
+ * the text matches no label:
23
+ *
24
+ * <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}
28
+ * </CommandPalette>
18
29
  */
19
30
  import type { Snippet } from 'svelte';
20
31
  import * as Command from '../command/index.js';
@@ -22,6 +33,7 @@
22
33
 
23
34
  let {
24
35
  open = $bindable(false),
36
+ query = $bindable(''),
25
37
  nav,
26
38
  onNavigate,
27
39
  placeholder = 'Search…',
@@ -31,6 +43,8 @@
31
43
  children
32
44
  }: {
33
45
  open?: boolean;
46
+ /** What the user has typed. Cleared whenever the palette closes. */
47
+ query?: string;
34
48
  /** The same value passed to AppShell. Filter for permissions first. */
35
49
  nav?: NavSource;
36
50
  /**
@@ -50,6 +64,10 @@
50
64
 
51
65
  const items = $derived(toItems(nav));
52
66
 
67
+ $effect(() => {
68
+ if (!open) query = '';
69
+ });
70
+
53
71
  function go(href: string) {
54
72
  open = false;
55
73
  if (onNavigate) onNavigate(href);
@@ -71,7 +89,7 @@
71
89
  />
72
90
 
73
91
  <Command.Dialog bind:open title="Command palette" description={placeholder}>
74
- <Command.Input {placeholder} />
92
+ <Command.Input {placeholder} bind:value={query} />
75
93
  <Command.List>
76
94
  <Command.Empty>{emptyText}</Command.Empty>
77
95
 
@@ -14,11 +14,24 @@
14
14
  * let paletteOpen = $state(false);
15
15
  * <AppShell {nav} onSearch={() => (paletteOpen = true)}>…</AppShell>
16
16
  * <CommandPalette bind:open={paletteOpen} {nav} onNavigate={goto} />
17
+ *
18
+ * `query` is the text in the input, bindable, so an app can offer a row that
19
+ * acts on what was typed ("Ask the agent: …", "Search everything for …"). Pass
20
+ * `forceMount` on that row, or the palette's own filter hides it the moment
21
+ * the text matches no label:
22
+ *
23
+ * <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}
27
+ * </CommandPalette>
17
28
  */
18
29
  import type { Snippet } from 'svelte';
19
30
  import { type NavSource } from '../app-shell/types.js';
20
31
  type $$ComponentProps = {
21
32
  open?: boolean;
33
+ /** What the user has typed. Cleared whenever the palette closes. */
34
+ query?: string;
22
35
  /** The same value passed to AppShell. Filter for permissions first. */
23
36
  nav?: NavSource;
24
37
  /**
@@ -35,6 +48,6 @@ type $$ComponentProps = {
35
48
  /** Extra command groups: app-specific actions beneath the nav group. */
36
49
  children?: Snippet;
37
50
  };
38
- declare const CommandPalette: import("svelte").Component<$$ComponentProps, {}, "open">;
51
+ declare const CommandPalette: import("svelte").Component<$$ComponentProps, {}, "open" | "query">;
39
52
  type CommandPalette = ReturnType<typeof CommandPalette>;
40
53
  export default CommandPalette;
package/dist/styles.css CHANGED
@@ -1004,7 +1004,9 @@
1004
1004
  height: 100dvh;
1005
1005
  width: var(--ds-shell-rail-width);
1006
1006
  max-width: 50%;
1007
- transition: width 200ms ease;
1007
+ transition:
1008
+ width 200ms ease,
1009
+ margin-right 200ms ease;
1008
1010
  }
1009
1011
 
1010
1012
  /* Full viewport height (`inset-block: 0`), so the brand row at its top and
@@ -1068,6 +1070,19 @@
1068
1070
  width: var(--ds-shell-rail-width-collapsed);
1069
1071
  }
1070
1072
 
1073
+ /* A collapsed rail peeking: it takes its full width but a negative right
1074
+ margin of the difference, so it still claims only the slim slot in the
1075
+ flex row and the page does not move. It sits above the top bar (z-20) and
1076
+ throws the same soft shadow the drawer does. */
1077
+ .ds-shell-rail[data-collapsed='true'][data-peek='true'] {
1078
+ width: var(--ds-shell-rail-width);
1079
+ margin-right: calc(var(--ds-shell-rail-width-collapsed) - var(--ds-shell-rail-width));
1080
+ z-index: 30;
1081
+ box-shadow:
1082
+ 0 10px 15px -3px oklch(0 0 0 / 0.1),
1083
+ 0 4px 6px -4px oklch(0 0 0 / 0.1);
1084
+ }
1085
+
1071
1086
  /* Width follows the pointer during a drag; the transition is for the
1072
1087
  collapse, not for every pixel of a resize. */
1073
1088
  .ds-shell-rail[data-resizing='true'] {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poodle64/ui",
3
- "version": "2026.10.20",
3
+ "version": "2026.10.21",
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.20",
4
+ "version": "2026.10.21",
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.20`. 76 components, 20 situations.
4
+ Generated from `@poodle64/ui@2026.10.21`. 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