srcdev-nuxt-components 9.1.0 → 9.1.1

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.
Files changed (20) hide show
  1. package/.claude/settings.json +2 -1
  2. package/.claude/skills/components/page-hero-highlights.md +60 -0
  3. package/.claude/skills/components/site-navigation.md +120 -0
  4. package/.claude/skills/index.md +1 -1
  5. package/app/components/02.molecules/navigation/site-navigation/SiteNavigation.vue +780 -0
  6. package/app/components/02.molecules/navigation/site-navigation/stories/SiteNavigation.stories.ts +335 -0
  7. package/app/components/02.molecules/navigation/site-navigation/tests/SiteNavigation.spec.ts +328 -0
  8. package/app/components/02.molecules/navigation/site-navigation/tests/__snapshots__/SiteNavigation.spec.ts.snap +30 -0
  9. package/app/components/04.templates/page-hero-highlights/PageHeroHighlights.vue +36 -21
  10. package/app/components/04.templates/page-hero-highlights/PageHeroHighlightsHeader.vue +66 -0
  11. package/app/components/04.templates/page-hero-highlights/stories/PageHeroHighlights.stories.ts +50 -3
  12. package/app/components/04.templates/page-hero-highlights/stories/PageHeroHighlightsHeader.stories.ts +77 -0
  13. package/app/components/04.templates/page-hero-highlights/tests/PageHeroHighlights.spec.ts +15 -7
  14. package/app/components/04.templates/page-hero-highlights/tests/PageHeroHighlightsHeader.spec.ts +51 -0
  15. package/app/components/04.templates/page-hero-highlights/tests/__snapshots__/PageHeroHighlights.spec.ts.snap +1 -1
  16. package/app/layouts/default.vue +1 -0
  17. package/app/pages/page-hero-highlights.vue +15 -11
  18. package/nuxt.config.ts +7 -0
  19. package/package.json +6 -6
  20. package/.claude/skills/components/treatment-consultant.md +0 -128
@@ -20,7 +20,8 @@
20
20
  ],
21
21
  "additionalDirectories": [
22
22
  "/Users/simoncornforth/websites/nuxt-components/app/components/01.atoms/content-wrappers/content-width",
23
- "/Users/simoncornforth/websites/nuxt-components/.claude/skills"
23
+ "/Users/simoncornforth/websites/nuxt-components/.claude/skills",
24
+ "/Users/simoncornforth/websites/nuxt-components/app/components/02.molecules/navigation/site-navigation/tests"
24
25
  ]
25
26
  }
26
27
  }
@@ -19,6 +19,8 @@ The layout uses a 4-row CSS Grid with `subgrid` — no `translate`, negative mar
19
19
  | `highlightsJustify` | `"start" \| "center" \| "end" \| "space-between" \| "space-around"` | `"start"` | Alignment of highlight items along the main axis |
20
20
  | `maxWidth` | `string` | `undefined` | Cap the central content column (e.g. `"1064px"`). Gutters grow to enforce the constraint; below this width they hold at `16px`. |
21
21
  | `contentAlign` | `"start" \| "center"` | `"center"` | When `maxWidth` is set: `"center"` grows gutters equally; `"start"` pins content to the left with a fixed `16px` left gutter. |
22
+ | `contentPanel` | `boolean` | `true` | When `true`, renders a decorative panel behind the content slot and offsets the highlights strip. Set to `false` for a flat layout with no backdrop. |
23
+ | `highlightTitleBaseline`| `boolean` | `false` | When `true`, fixes the highlight title row to a set height so titles align at a common baseline. Override `--highlight-title-height` to tune. |
22
24
  | `styleClassPassthrough` | `string \| string[]` | `[]` | Extra classes on the root element |
23
25
 
24
26
  ## Slots
@@ -83,6 +85,64 @@ Example with `HeroText` in the header slot:
83
85
  </PageHeroHighlights>
84
86
  ```
85
87
 
88
+ ## PageHeroHighlightsHeader companion component
89
+
90
+ A co-located companion component for laying out the `#header` slot. Provides a responsive two-area layout: `#start` (title/description) and `#end` (action buttons), stacking vertically on mobile and sitting side-by-side on wider viewports.
91
+
92
+ Located at: `app/components/04.templates/page-hero-highlights/PageHeroHighlightsHeader.vue`
93
+
94
+ ### PageHeroHighlightsHeader props
95
+
96
+ | Prop | Type | Default | Description |
97
+ | ----------------------- | -------------------- | ------- | --------------------------------- |
98
+ | `styleClassPassthrough` | `string \| string[]` | `[]` | Extra classes on the root element |
99
+
100
+ ### PageHeroHighlightsHeader slots
101
+
102
+ | Slot | Purpose |
103
+ | ------- | --------------------------------------------------------- |
104
+ | `start` | Title and description — always rendered, fills full width when `#end` is absent |
105
+ | `end` | Action buttons — `.phh-end` is only mounted when this slot is provided |
106
+
107
+ ### CSS tokens
108
+
109
+ | Token | Default | Description |
110
+ | ------------------ | -------- | ---------------------------------------- |
111
+ | `--phh-padding-block` | `1.6rem` | Block padding on the header |
112
+ | `--phh-gap` | `1.6rem` | Gap between `#start` and `#end` areas |
113
+ | `--phh-end-gap` | `0.8rem` | Gap between items within `#end` |
114
+
115
+ ### Usage
116
+
117
+ ```vue
118
+ <PageHeroHighlights tag="section">
119
+ <template #header="{ headingId }">
120
+ <PageHeroHighlightsHeader>
121
+ <template #start>
122
+ <h1 :id="headingId" class="page-heading-1">Surplus needs</h1>
123
+ <p class="page-body-normal">Let us know what you need help with.</p>
124
+ </template>
125
+ <template #end>
126
+ <HelpButton />
127
+ <Button>Create new need</Button>
128
+ </template>
129
+ </PageHeroHighlightsHeader>
130
+ </template>
131
+ ...
132
+ </PageHeroHighlights>
133
+ ```
134
+
135
+ Omit `#end` for a single-element header — `#start` fills full width with no layout change needed:
136
+
137
+ ```vue
138
+ <PageHeroHighlightsHeader>
139
+ <template #start>
140
+ <h1 :id="headingId">Dashboard</h1>
141
+ <p>Overview of your account activity.</p>
142
+ </template>
143
+ </PageHeroHighlightsHeader>
144
+ ```
145
+
86
146
  ## With aria-labelledby (section tag)
87
147
 
88
148
  When `tag="section"`, `aria-labelledby` is set automatically. Wire the heading id via the scoped slot prop:
@@ -0,0 +1,120 @@
1
+ # SiteNavigation
2
+
3
+ ## Overview
4
+
5
+ `SiteNavigation` is a responsive site-wide navigation component. It renders a horizontal link list on wide viewports and automatically collapses to a burger-menu + slide-down panel on narrow viewports. Collapse is driven by a `ResizeObserver` that compares the list's natural `scrollWidth` against the nav container's `clientWidth` — no breakpoint prop needed.
6
+
7
+ Both the horizontal list and the panel include animated active/hover indicator decorators (underline indicator + background highlight) that snap into position using CSS custom properties set via JavaScript.
8
+
9
+ ## Component location
10
+
11
+ `app/components/02.molecules/navigation/site-navigation/SiteNavigation.vue`
12
+
13
+ ## Props
14
+
15
+ | Prop | Type | Default | Description |
16
+ |---|---|---|---|
17
+ | `navItemData` | `NavItemData` | — (required) | Navigation items — see type below |
18
+ | `navAlign` | `"left" \| "center" \| "right"` | `"left"` | Alignment of the horizontal nav list |
19
+ | `styleClassPassthrough` | `string \| string[]` | `[]` | Extra classes applied to the root `<nav>` |
20
+
21
+ ## NavItemData type
22
+
23
+ ```ts
24
+ import type { NavItemData } from "~/types/components/navigation-horizontal.d";
25
+
26
+ const navItemData: NavItemData = {
27
+ main: [
28
+ { text: "Home", href: "/" },
29
+ { text: "About", href: "/about" },
30
+ { text: "Services", href: "/services", cssName: "is-featured" },
31
+ { text: "Contact", href: "/contact", iconName: "heroicons:envelope", isExternal: false },
32
+ ],
33
+ };
34
+ ```
35
+
36
+ `NavItem` fields:
37
+
38
+ | Field | Type | Description |
39
+ |---|---|---|
40
+ | `text` | `string` | Link label |
41
+ | `href` | `string` | Link destination |
42
+ | `isExternal` | `boolean?` | Passed to NuxtLink `:external` — opens in new tab |
43
+ | `iconName` | `string?` | Iconify icon name rendered before the label |
44
+ | `cssName` | `string?` | CSS class applied to the `<li>` element |
45
+
46
+ ## Basic usage
47
+
48
+ ```vue
49
+ <SiteNavigation :nav-item-data="navItemData" nav-align="left" />
50
+ ```
51
+
52
+ Always use hyphenated prop names in templates (ESLint enforces this).
53
+
54
+ ## CSS token API
55
+
56
+ Set these tokens on a parent element (e.g. your `<header>`) to theme the navigation.
57
+
58
+ ```css
59
+ .your-header {
60
+ /* ── Decorators ────────────────────────────────────── */
61
+ --site-nav-decorator-indicator-color: var(--rose-05); /* underline bar */
62
+
63
+ /* ── Horizontal nav links ──────────────────────────── */
64
+ --site-nav-link-color: var(--warm-01);
65
+ --site-nav-link-hover-color: var(--rose-04);
66
+ --site-nav-link-active-color: var(--rose-05);
67
+ --site-nav-link-size: 1.6rem;
68
+ --site-nav-link-weight: 400;
69
+ --site-nav-link-tracking: 0.06em;
70
+ --site-nav-gap: 2.2rem;
71
+ --site-nav-transition: 250ms ease;
72
+
73
+ /* ── Mobile panel ──────────────────────────────────── */
74
+ --site-nav-panel-bg: var(--page-bg, #1a1614);
75
+ --site-nav-panel-border-color: color-mix(in oklch, var(--rose-05) 35%, transparent);
76
+ --site-nav-panel-link-color: var(--warm-01);
77
+ --site-nav-panel-link-hover-color: var(--rose-04);
78
+ --site-nav-panel-link-active-color: var(--rose-05);
79
+ --site-nav-panel-padding-block: 1.4rem;
80
+ --site-nav-panel-padding-inline: 1.5rem;
81
+ --site-nav-panel-slide-duration: 350ms;
82
+ --site-nav-panel-slide-easing: cubic-bezier(0.4, 0, 0.2, 1);
83
+ --site-nav-panel-decorator-indicator-color: var(--rose-05);
84
+ --site-nav-panel-indicator-left: 0; /* position the panel indicator bar */
85
+ --site-nav-panel-indicator-right: auto;
86
+
87
+ /* ── Burger button ─────────────────────────────────── */
88
+ --site-nav-burger-color: var(--warm-01);
89
+ --site-nav-burger-width: 22px;
90
+ --site-nav-burger-height: 1.5px;
91
+ --site-nav-burger-gap: 5px;
92
+ --site-nav-burger-transition: 300ms ease;
93
+
94
+ /* ── Backdrop (teleported to <body>) ───────────────── */
95
+ --site-nav-backdrop-bg: oklch(0% 0 0 / 55%);
96
+ --site-nav-backdrop-blur: 3px;
97
+ --site-nav-backdrop-duration: 350ms;
98
+ }
99
+ ```
100
+
101
+ ## Behaviour notes
102
+
103
+ - **Collapse detection**: `ResizeObserver` fires on every container resize. The list's `scrollWidth` is cached whenever the list is in the DOM; that cached value is compared against the container's `clientWidth` to set `isCollapsed`.
104
+ - **isLoaded state**: The component uses `useState("site-nav-loaded")` — a Nuxt shared state — to gate visibility until the first measurement is complete, preventing a flash of the wrong nav state on load. The nav renders `opacity: 0` until `is-loaded` is applied.
105
+ - **Teleport**: The backdrop overlay is teleported to `<body>` via `<Teleport>` and is only mounted when `isCollapsed && isLoaded`.
106
+ - **Panel inert**: The `#site-nav-panel` div receives `:inert="!isMenuOpen ? true : undefined"` — it is inert (keyboard/pointer-inaccessible) when closed.
107
+ - **Decorator init**: `initNavDecorators()` and `initPanelDecorators()` inject `<li>` elements with CSS-driven indicator `<div>`s. They query `[data-nav-item]` / `[data-panel-nav-item]` to find links, and look for `router-link-active` to set the initial active position.
108
+
109
+ ## Accessibility
110
+
111
+ - Root `<nav>` has `aria-label="Site navigation"`.
112
+ - Burger button uses `aria-expanded` (string `"true"/"false"`) and `aria-controls="site-nav-panel"`.
113
+ - Backdrop and indicator `<li>` elements are `aria-hidden="true"`.
114
+ - Panel div is `inert` when closed.
115
+
116
+ ## Related files
117
+
118
+ - Type: `app/types/components/navigation-horizontal.d.ts`
119
+ - Tests: `app/components/02.molecules/navigation/site-navigation/tests/SiteNavigation.spec.ts`
120
+ - Story: `app/components/02.molecules/navigation/site-navigation/stories/SiteNavigation.stories.ts`
@@ -50,7 +50,7 @@ Each skill is a single markdown file named `<area>-<task>.md`.
50
50
  ├── expanding-panel.md — ExpandingPanel v-model, forceOpened, slots (summary/icon/content), ARIA wiring
51
51
  ├── navigation-horizontal.md — NavigationHorizontal props, NavItemData type, CSS token API, import path gotcha
52
52
  ├── input-copy-core.md — InputCopyCore: readonly copy-to-clipboard input; props, emits, slots, CSS classes, usage
53
- └── treatment-consultant.md TreatmentConsultant 5-step wizard: props, step flow, treatment exclusion logic, recommendation matrix, image paths
53
+ └── site-navigation.md SiteNavigation: responsive nav with auto-collapse, burger menu, decorator indicators, CSS token API
54
54
  ```
55
55
 
56
56
  ## Skill file template