srcdev-nuxt-components 9.1.36 → 9.1.38

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 (32) hide show
  1. package/.claude/settings.json +2 -1
  2. package/.claude/settings.local.json +2 -2
  3. package/.claude/skills/components/capture-qr-code.md +84 -0
  4. package/.claude/skills/components/data-grid.md +167 -0
  5. package/.claude/skills/components/decode-qr-code.md +84 -0
  6. package/.claude/skills/components/display-qr-code.md +64 -0
  7. package/.claude/skills/index.md +5 -2
  8. package/app/components/01.atoms/grids/data-grid/DataGrid.vue +39 -0
  9. package/app/components/01.atoms/grids/data-grid/stories/DataGrid.stories.ts +234 -0
  10. package/app/components/01.atoms/grids/data-grid/tests/DataGrid.spec.ts +140 -0
  11. package/app/components/01.atoms/grids/data-grid/tests/__snapshots__/DataGrid.spec.ts.snap +11 -0
  12. package/app/components/01.atoms/qr-code/DisplayQrCode.vue +50 -0
  13. package/app/components/01.atoms/qr-code/stories/DisplayQrCode.stories.ts +206 -0
  14. package/app/components/01.atoms/qr-code/tests/DisplayQrCode.spec.ts +139 -0
  15. package/app/components/02.molecules/qr-code/CaptureQrCode.vue +142 -0
  16. package/app/components/{qr-code → 02.molecules/qr-code}/DecodeQrCode.vue +11 -35
  17. package/app/components/02.molecules/qr-code/stories/QrCode.stories.ts +101 -0
  18. package/app/components/02.molecules/qr-code/tests/CaptureQrCode.spec.ts +212 -0
  19. package/app/components/02.molecules/qr-code/tests/DecodeQrCode.spec.ts +145 -0
  20. package/app/layouts/default.vue +0 -1
  21. package/app/pages/ui/qr-code/[componentName].vue +3 -3
  22. package/app/pages/ui/simple-grid.vue +2 -2
  23. package/package.json +1 -1
  24. package/.claude/skills/components/scroll-parallax-section.md +0 -148
  25. package/app/components/01.atoms/scroll-parallax-section/ScrollParallaxSection.vue +0 -108
  26. package/app/components/01.atoms/scroll-parallax-section/stories/ScrollParallaxSection.stories.ts +0 -151
  27. package/app/components/01.atoms/scroll-parallax-section/tests/ScrollParallaxSection.spec.ts +0 -91
  28. package/app/components/display-grid/DisplayGridCore.vue +0 -22
  29. package/app/components/qr-code/CaptureQrCode.vue +0 -183
  30. package/app/components/qr-code/DisplayQrCode.vue +0 -53
  31. package/app/components/qr-code/stories/QrCode.stories.ts +0 -933
  32. package/app/pages/ui/scroll-parallax-section.vue +0 -65
@@ -24,6 +24,7 @@
24
24
  "Bash(git add:*)",
25
25
  "Bash(gh release:*)",
26
26
  "Bash(node -e ':*)"
27
- ]
27
+ ],
28
+ "additionalDirectories": []
28
29
  }
29
30
  }
@@ -29,13 +29,13 @@
29
29
  "additionalDirectories": [
30
30
  "/Users/simoncornforth/websites/nuxt-components/app/components/01.atoms/content-wrappers/content-width",
31
31
  "/Users/simoncornforth/websites/nuxt-components/.claude/skills",
32
+ "/Users/simoncornforth/websites/nuxt-components/.claude/skills/components",
32
33
  "/Users/simoncornforth/websites/nuxt-components/app/components/02.molecules/navigation/site-navigation/tests",
33
34
  "/Users/simoncornforth/websites/luxury-locs-by-natasha-nuxt3/app/pages",
34
35
  "/Users/simoncornforth/websites/nuxt-components/app/assets/styles/extends-layer",
35
36
  "/Users/simoncornforth/websites/nuxt-components/app/components/01.atoms",
36
37
  "/private/tmp",
37
- "/Users/simoncornforth/websites/nuxt-components/app/components/01.atoms/banner-video",
38
- "/Users/simoncornforth/websites/nuxt-components/app/components/01.atoms/scroll-parallax-section"
38
+ "/Users/simoncornforth/websites/nuxt-components/app/components/01.atoms/banner-video"
39
39
  ]
40
40
  }
41
41
  }
@@ -0,0 +1,84 @@
1
+ # CaptureQrCode
2
+
3
+ Live camera QR code scanner. Streams the device camera, detects QR codes in real time, and displays the decoded results inline. Handles camera errors, page visibility changes, and route navigation — stopping media streams cleanly in all cases.
4
+
5
+ **File**: `app/components/02.molecules/qr-code/CaptureQrCode.vue`
6
+
7
+ ## Prerequisites
8
+
9
+ The `nuxt-qrcode` Nuxt module must be registered in the consuming app's `nuxt.config.ts`:
10
+
11
+ ```typescript
12
+ // nuxt.config.ts
13
+ export default defineNuxtConfig({
14
+ modules: ["nuxt-qrcode"],
15
+ });
16
+ ```
17
+
18
+ Camera access requires a secure context (HTTPS or localhost) and the user granting camera permission.
19
+
20
+ ## Props
21
+
22
+ | Prop | Type | Default | Description |
23
+ |------|------|---------|-------------|
24
+ | `style-class-passthrough` | `string \| string[]` | `[]` | Extra classes on the root element |
25
+
26
+ ## CSS classes
27
+
28
+ | Class | Where | Description |
29
+ |-------|-------|-------------|
30
+ | `.capture-qr-stream` | root | always present |
31
+ | `.camera-stopped` | inner | shown when camera is off but no error |
32
+ | `.camera-error` | inner | shown when an error has occurred |
33
+ | `.scanned-results` | inner | shown when at least one code has been decoded |
34
+
35
+ ## Behaviour
36
+
37
+ - Camera starts automatically on mount (`state.cameraOn = true`)
38
+ - When the page becomes hidden (tab switch, minimize), the camera stops and media streams are released
39
+ - On route leave (`onBeforeRouteLeave`), the camera stops and streams are released
40
+ - On `<KeepAlive>` deactivate/activate, camera is stopped/restarted accordingly
41
+ - If the user denies camera permission or another error occurs, the `.camera-error` state is shown with the error message and a **Reset camera** button
42
+ - Detected QR codes replace the previous results — each scan is a fresh result set
43
+ - Results are displayed as a `<ul>` inside `.scanned-results`
44
+
45
+ ## Usage
46
+
47
+ Drop in where camera scanning is needed. No configuration required beyond the module being present:
48
+
49
+ ```vue
50
+ <CaptureQrCode />
51
+ ```
52
+
53
+ With styling:
54
+
55
+ ```vue
56
+ <CaptureQrCode style-class-passthrough="my-scanner" />
57
+ ```
58
+
59
+ ## CSS override
60
+
61
+ The root element is a square (`aspect-ratio: 1 / 1`) by default. Override in a consuming page or component:
62
+
63
+ ```css
64
+ .my-scanner.capture-qr-stream {
65
+ aspect-ratio: auto;
66
+ max-width: 40rem;
67
+ }
68
+
69
+ .my-scanner .camera-error {
70
+ padding: 1.6rem;
71
+ border-radius: 0.8rem;
72
+ background-color: var(--theme-surface-error);
73
+ }
74
+
75
+ .my-scanner .scanned-results {
76
+ margin-block-start: 1.6rem;
77
+ font-size: 1.4rem;
78
+ }
79
+ ```
80
+
81
+ ## Notes
82
+
83
+ - The component does not emit the detected values — results are rendered inline. To act on scan results in a parent, extend the component or use `nuxt-qrcode`'s `QrcodeStream` directly with `@detect`.
84
+ - Media streams are stopped via two strategies: via the `QrcodeStream` component ref and via a document-level `querySelectorAll("video")` sweep — the sweep acts as a safety net if the ref is unavailable.
@@ -0,0 +1,167 @@
1
+ # DataGrid Component
2
+
3
+ ## Overview
4
+
5
+ `DataGrid` is a responsive auto-fit CSS grid wrapper. It renders whatever named slots the consumer provides, auto-fitting columns to a minimum of `250px` each. Column count and gap are controlled via CSS custom properties, making layout adjustments a single-line style override rather than a prop change.
6
+
7
+ ---
8
+
9
+ ## Slot pattern
10
+
11
+ Pass any number of named slots — the component renders each one in document order inside the grid.
12
+
13
+ ```vue
14
+ <DataGrid>
15
+ <template #item-1><StatCard label="Revenue" value="£24,500" /></template>
16
+ <template #item-2><StatCard label="Clients" value="142" /></template>
17
+ <template #item-3><StatCard label="Bookings" value="38" /></template>
18
+ </DataGrid>
19
+ ```
20
+
21
+ When filling from a data array, use a dynamic slot name in a `v-for`:
22
+
23
+ ```vue
24
+ <DataGrid>
25
+ <template v-for="(item, i) in stats" #[`item-${i}`] :key="i">
26
+ <StatCard :label="item.label" :value="item.value" />
27
+ </template>
28
+ </DataGrid>
29
+ ```
30
+
31
+ ---
32
+
33
+ ## Props reference
34
+
35
+ > **Hyphenation rule**: Vue's ESLint config enforces `vue/attribute-hyphenation`. Always write camelCase prop names hyphenated in templates: `:style-class-passthrough`.
36
+
37
+ | Prop (template form) | Type | Default | Notes |
38
+ |---|---|---|---|
39
+ | `tag` | `"div" \| "section" \| "article" \| "main"` | `"div"` | Use a semantic tag for page landmark regions. |
40
+ | `:style-class-passthrough` | `string \| string[]` | `[]` | Extra CSS classes on the root element. |
41
+
42
+ ---
43
+
44
+ ## CSS custom properties
45
+
46
+ Override these via `style` attribute or a `styleClassPassthrough` class in a consuming `<style>` block.
47
+
48
+ | Property | Default | Notes |
49
+ |---|---|---|
50
+ | `--data-grid-columns` | `repeat(auto-fit, minmax(250px, 1fr))` | Full `grid-template-columns` value. Override to fix column count or change min width. |
51
+ | `--data-grid-gap` | `1rem` | Grid gap between items. |
52
+
53
+ ### Fixed column count
54
+
55
+ ```vue
56
+ <DataGrid style="--data-grid-columns: repeat(3, 1fr); --data-grid-gap: 2.4rem;">
57
+ ...
58
+ </DataGrid>
59
+ ```
60
+
61
+ ### Narrower minimum item width
62
+
63
+ ```vue
64
+ <DataGrid style="--data-grid-columns: repeat(auto-fit, minmax(180px, 1fr));">
65
+ ...
66
+ </DataGrid>
67
+ ```
68
+
69
+ ---
70
+
71
+ ## Usage examples
72
+
73
+ ### Stat cards (default auto-fit)
74
+
75
+ ```vue
76
+ <DataGrid>
77
+ <template #revenue>
78
+ <div class="stat-card">
79
+ <span class="stat-card-label">Revenue</span>
80
+ <span class="stat-card-value">£24,500</span>
81
+ </div>
82
+ </template>
83
+ <template #clients>
84
+ <div class="stat-card">
85
+ <span class="stat-card-label">Clients</span>
86
+ <span class="stat-card-value">142</span>
87
+ </div>
88
+ </template>
89
+ </DataGrid>
90
+ ```
91
+
92
+ ### Semantic section with auto aria-labelledby
93
+
94
+ ```vue
95
+ <DataGrid tag="section">
96
+ <!-- aria-labelledby is wired automatically via useAriaLabelledById -->
97
+ <template #item-1><div>Item 1</div></template>
98
+ <template #item-2><div>Item 2</div></template>
99
+ </DataGrid>
100
+ ```
101
+
102
+ ### Data-driven grid
103
+
104
+ ```vue
105
+ <script setup lang="ts">
106
+ const stats = [
107
+ { id: "revenue", label: "Revenue", value: "£24,500" },
108
+ { id: "clients", label: "Clients", value: "142" },
109
+ { id: "bookings", label: "Bookings", value: "38" },
110
+ ];
111
+ </script>
112
+
113
+ <template>
114
+ <DataGrid>
115
+ <template v-for="stat in stats" #[stat.id] :key="stat.id">
116
+ <div class="stat-card">
117
+ <span class="stat-card-label">{{ stat.label }}</span>
118
+ <span class="stat-card-value">{{ stat.value }}</span>
119
+ </div>
120
+ </template>
121
+ </DataGrid>
122
+ </template>
123
+ ```
124
+
125
+ ---
126
+
127
+ ## Accessibility
128
+
129
+ - When `tag` is `section`, `article`, or `main`, `aria-labelledby` is automatically set via `useAriaLabelledById`, pointing to a generated heading ID.
130
+ - When `tag="div"`, no ARIA attributes are added.
131
+ - Ensure a heading element with the matching ID is present inside the grid when using semantic tags.
132
+
133
+ See [component-aria-landmark.md](../component-aria-landmark.md) for the full landmark pattern.
134
+
135
+ ---
136
+
137
+ ## Local style override scaffold
138
+
139
+ ```vue
140
+ <DataGrid :style-class-passthrough="['my-data-grid']">
141
+ ...
142
+ </DataGrid>
143
+
144
+ <style>
145
+ /* ─── DataGrid local overrides ──────────────────────────────────────
146
+ Use CSS custom properties for layout, not utility classes.
147
+ Delete this block if no overrides are needed.
148
+ ─────────────────────────────────────────────────────────────────── */
149
+ .data-grid {
150
+ &.my-data-grid {
151
+ --data-grid-columns: repeat(auto-fit, minmax(200px, 1fr));
152
+ --data-grid-gap: 2rem;
153
+ }
154
+ }
155
+ </style>
156
+ ```
157
+
158
+ See [component-local-style-override.md](../component-local-style-override.md) for the full pattern.
159
+
160
+ ---
161
+
162
+ ## Notes
163
+
164
+ - Auto-imported in Nuxt — no manual import needed.
165
+ - Slot names can be anything — semantic (`#revenue`) or indexed (`#item-0`). Document order determines render order.
166
+ - `--data-grid-columns` accepts any valid `grid-template-columns` value, including named tracks and `subgrid`.
167
+ - The component does not impose a column count — `auto-fit` with `minmax` means the browser decides. Use `repeat(N, 1fr)` in `--data-grid-columns` to fix the count.
@@ -0,0 +1,84 @@
1
+ # DecodeQrCode
2
+
3
+ QR code decoder for static images. Accepts images via file picker or drag-and-drop, decodes any QR codes found, and displays the results inline.
4
+
5
+ **File**: `app/components/02.molecules/qr-code/DecodeQrCode.vue`
6
+
7
+ ## Prerequisites
8
+
9
+ The `nuxt-qrcode` Nuxt module must be registered in the consuming app's `nuxt.config.ts`:
10
+
11
+ ```typescript
12
+ // nuxt.config.ts
13
+ export default defineNuxtConfig({
14
+ modules: ["nuxt-qrcode"],
15
+ });
16
+ ```
17
+
18
+ No camera permission is required — this component works entirely with uploaded or dropped image files.
19
+
20
+ ## Props
21
+
22
+ | Prop | Type | Default | Description |
23
+ |------|------|---------|-------------|
24
+ | `style-class-passthrough` | `string \| string[]` | `[]` | Extra classes on the root element |
25
+
26
+ ## CSS classes
27
+
28
+ | Class | Where | Description |
29
+ |-------|-------|-------------|
30
+ | `.decode-qr-code` | root | always present |
31
+ | `.qr-code-capture` | file input | the `QrcodeCapture` file-picker element |
32
+ | `.qr-code-dropzone` | drop zone | the `QrcodeDropZone` drag-and-drop area |
33
+ | `.scanned-results` | inner | shown when at least one code has been decoded |
34
+
35
+ ## Behaviour
36
+
37
+ - Two input methods are rendered side by side: a file picker (`.qr-code-capture`) and a drag-and-drop zone (`.qr-code-dropzone`)
38
+ - Both share the same `onDetect` handler — results are displayed in the same `.scanned-results` list regardless of input method
39
+ - Detected QR codes replace the previous results — each decode is a fresh result set
40
+ - If the decoded array is empty, `.scanned-results` is hidden
41
+ - The drop zone has a dashed border and minimum height by default — style with `.qr-code-dropzone` to customise
42
+
43
+ ## Usage
44
+
45
+ Drop in where image-based QR decoding is needed:
46
+
47
+ ```vue
48
+ <DecodeQrCode />
49
+ ```
50
+
51
+ With styling:
52
+
53
+ ```vue
54
+ <DecodeQrCode style-class-passthrough="my-decoder" />
55
+ ```
56
+
57
+ ## CSS override
58
+
59
+ ```css
60
+ .my-decoder.decode-qr-code {
61
+ display: flex;
62
+ flex-direction: column;
63
+ gap: 1.6rem;
64
+ }
65
+
66
+ .my-decoder .qr-code-dropzone {
67
+ min-height: 12rem;
68
+ border-radius: 1rem;
69
+ border-color: var(--theme-input-border);
70
+ display: flex;
71
+ align-items: center;
72
+ justify-content: center;
73
+ }
74
+
75
+ .my-decoder .scanned-results {
76
+ margin-block-start: 1.6rem;
77
+ font-size: 1.4rem;
78
+ }
79
+ ```
80
+
81
+ ## Notes
82
+
83
+ - Like `CaptureQrCode`, results are rendered inline and not emitted. To act on results in a parent, extend the component or use `nuxt-qrcode`'s `QrcodeCapture` / `QrcodeDropZone` primitives directly.
84
+ - The component renders both input methods unconditionally. If only one is needed, use the underlying `QrcodeCapture` or `QrcodeDropZone` primitives directly.
@@ -0,0 +1,64 @@
1
+ # DisplayQrCode
2
+
3
+ Renders a styled QR code SVG from a string value. Supports colour, size, corner radius, and pixel/marker shape variants.
4
+
5
+ **File**: `app/components/01.atoms/qr-code/DisplayQrCode.vue`
6
+
7
+ ## Props
8
+
9
+ | Prop | Type | Default | Description |
10
+ |------|------|---------|-------------|
11
+ | `qr-value` | `string` | required | The string to encode into the QR code |
12
+ | `variant` | `QrCodeVariant` | `{ inner: "default", marker: "default", pixel: "default" }` | Shape variants for inner markers, outer markers, and pixels |
13
+ | `radius` | `number` | `0` | Corner rounding applied to pixels/markers (0–1 scale) |
14
+ | `black-color` | `string` | `"currentColor"` | Colour for the dark modules |
15
+ | `white-color` | `string` | `"transparent"` | Colour for the light modules |
16
+ | `size` | `string` | `"256px"` | Width of the QR code (height matches via `aspect-ratio: 1 / 1`) |
17
+ | `style-class-passthrough` | `string \| string[]` | `[]` | Extra classes on the root element |
18
+
19
+ ### QrCodeVariant type
20
+
21
+ ```typescript
22
+ import type { QrCodeVariant } from "srcdev-nuxt-components/types/components";
23
+
24
+ // Each field accepts: "default" | "circle" | "rounded" | "dots" | "classy" | "classy-rounded"
25
+ const variant: QrCodeVariant = {
26
+ inner: "circle",
27
+ marker: "rounded",
28
+ pixel: "dots",
29
+ };
30
+ ```
31
+
32
+ ## CSS classes
33
+
34
+ | Class | Where | Description |
35
+ |-------|-------|-------------|
36
+ | `.display-qr-code` | root | always present |
37
+
38
+ ## Usage
39
+
40
+ Minimal — encodes a URL with default styling:
41
+
42
+ ```vue
43
+ <DisplayQrCode qr-value="https://example.com" />
44
+ ```
45
+
46
+ Custom size, colour, and rounded pixels:
47
+
48
+ ```vue
49
+ <DisplayQrCode
50
+ qr-value="https://example.com"
51
+ size="320px"
52
+ black-color="#1a1a2e"
53
+ white-color="#f5f5f5"
54
+ :radius="0.5"
55
+ :variant="{ inner: 'circle', marker: 'rounded', pixel: 'default' }"
56
+ />
57
+ ```
58
+
59
+ ## Notes
60
+
61
+ - The component renders directly as the `Qrcode` element from `nuxt-qrcode` — there is no wrapper `<div>`. The `.display-qr-code` class is applied to the `Qrcode` root, which renders as an `<svg>`.
62
+ - `size` is applied via CSS `v-bind()` — pass any valid CSS length value (`px`, `rem`, `%`, etc.).
63
+ - `black-color` defaults to `currentColor`, so the QR code inherits the surrounding text colour automatically unless overridden.
64
+ - `white-color` defaults to `transparent`, making the background of the QR code see-through by default.
@@ -68,11 +68,14 @@ Each skill is a single markdown file named `<area>-<task>.md`.
68
68
  ├── input-copy-core.md — InputCopyCore: readonly copy-to-clipboard input; props, emits, slots, CSS classes, usage
69
69
  ├── banner-video.md — BannerVideo: full-width hero video banner, depth tier system, objectFit/objectPosition, reduced-motion fallback, CSS tokens
70
70
  ├── grid-stack.md — GridStack: CSS Grid z-axis stacking, slot API, z-order rules, sizing, video+overlay and image+text patterns
71
- ├── scroll-parallax-section.md — ScrollParallaxSection: JS-driven parallax background section, parallaxStrength guide, height token, reduced-motion pattern
72
71
  ├── scroll-reveal-frame.md — ScrollRevealFrame: generic parallax clipping frame, slot API, image grid pattern, CSS tokens, browser support
73
72
  ├── scroll-reveal-image.md — ScrollRevealImage: single-image parallax reveal, focalX, imgWidth/imgHeight, responsive frame height
74
73
  ├── site-navigation.md — SiteNavigation: responsive nav with auto-collapse, burger menu, decorator indicators, CSS token API
75
- └── social-icons-list.md — SocialIconsList: data-driven social icon links, ISocialIcon type, logos: icon names, CSS tokens
74
+ ├── social-icons-list.md — SocialIconsList: data-driven social icon links, ISocialIcon type, logos: icon names, CSS tokens
75
+ ├── display-qr-code.md — DisplayQrCode: QR code SVG from a string value, colour/size/variant/radius props, currentColor default
76
+ ├── capture-qr-code.md — CaptureQrCode: live camera scanner, error state, visibility/route/KeepAlive lifecycle, media stream cleanup
77
+ ├── decode-qr-code.md — DecodeQrCode: file picker + drag-and-drop image decoder, shared results list, CSS override points
78
+ └── data-grid.md — DataGrid: auto-fit responsive grid, $slots iteration, --data-grid-columns/gap tokens, semantic tag + aria
76
79
  ```
77
80
 
78
81
  ## Skill file template
@@ -0,0 +1,39 @@
1
+ <template>
2
+ <component :is="tag" class="data-grid" :class="[elementClasses]" :aria-labelledby="ariaLabelledby">
3
+ <slot v-for="(_, name) in $slots" :key="name" :name="name"></slot>
4
+ </component>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ interface Props {
9
+ tag?: "div" | "section" | "article" | "main";
10
+ styleClassPassthrough?: string | string[];
11
+ }
12
+
13
+ const props = withDefaults(defineProps<Props>(), {
14
+ tag: "div",
15
+ styleClassPassthrough: () => [],
16
+ });
17
+
18
+ const { elementClasses, resetElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
19
+ const { ariaLabelledby } = useAriaLabelledById(props.tag);
20
+
21
+ watch(
22
+ () => props.styleClassPassthrough,
23
+ () => resetElementClasses(props.styleClassPassthrough),
24
+ );
25
+ </script>
26
+
27
+ <style lang="css">
28
+ @layer components {
29
+ .data-grid {
30
+ /* CSS Tockens for @container grid-template-columns */
31
+ --data-grid-columns: repeat(auto-fit, minmax(250px, 1fr));
32
+ --data-grid-gap: 1rem;
33
+
34
+ display: grid;
35
+ grid-template-columns: var(--data-grid-columns);
36
+ gap: var(--data-grid-gap);
37
+ }
38
+ }
39
+ </style>