@poodle64/ui 2026.10.27 → 2026.10.28

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
@@ -281,6 +281,21 @@ belongs in the page too, as a sibling of the article it serves, and not in the
281
281
  shell: it is part of that page's own reading surface, it wants that page's
282
282
  breakpoints, and no other route should be paying rail width for it.
283
283
 
284
+ **A row's `badge`, and a label that never truncates.** The label is the content:
285
+ it wraps, never ends in an ellipsis, and the badge and the chevron keep their
286
+ size. A text badge (`badge: 3`, `badge: 'beta'`) is a chip that costs the label
287
+ room: at 15.5rem, a label, a wordy chip and a chevron do not share one line, so
288
+ the label takes a second. Pass the icon form wherever a label could collide
289
+ (a tag with words in it, any row that also has `children`):
290
+
291
+ ```ts
292
+ import Lock from '@lucide/svelte/icons/lock';
293
+ { label: 'Strategy paper', href: '/strategy', icon: FileText, badge: { icon: Lock, label: 'Only you' } }
294
+ ```
295
+
296
+ It draws as a compact pill holding only the icon (12px, muted), with `label` as
297
+ its tooltip and accessible name. `NavBadge` is the type.
298
+
284
299
  `NavItem` / `NavGroup` are exported so an app types its own config against them.
285
300
  They carry **no notion of who may see an item**: two surveyed apps gate
286
301
  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' : 'truncate'}>{item.label}</span>
204
+ <span class={iconOnly ? 'sr-only' : 'ds-nav-label'}>{item.label}</span>
205
205
  {#if item.badge !== undefined && !iconOnly}
206
- <span class="ds-nav-badge">{item.badge}</span>
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}
@@ -6,4 +6,4 @@ export { default as PagePane } from './page-pane.svelte';
6
6
  export { default as PageAside } from './page-aside.svelte';
7
7
  export { PAGE_TYPES, type PageAsideRegistration, type PageColumnState, type PagePaneRegistration, type PageType } from './page.js';
8
8
  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';
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';
@@ -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
- /** Optional trailing count or short tag (an unread count, a "beta" tag). */
33
- badge?: string | number;
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;
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 truncates
680
- (`.ds-nav-item`'s label already carries `.truncate`) rather than
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.27",
3
+ "version": "2026.10.28",
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.27",
4
+ "version": "2026.10.28",
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.27`. 75 components, 20 situations.
4
+ Generated from `@poodle64/ui@2026.10.28`. 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