srcdev-nuxt-components 9.6.5 → 9.6.6
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/.claude/rules/consumer/a11y-no-focus-steal.md +14 -0
- package/.claude/skills/component-compliance-checklist.md +5 -1
- package/.claude/skills/components/display-toast.md +6 -3
- package/.claude/skills/components/social-icons-list.md +32 -5
- package/.claude/skills/css-dynamic-border-radius.md +114 -0
- package/.claude/skills/index.md +2 -1
- package/.claude/skills/storybook-add-story.md +6 -0
- package/.vscode/srcdev-component-display-toast.code-snippets +6 -8
- package/.vscode/srcdev-component-social-icons-list.code-snippets +14 -0
- package/.vscode/srcdev-utility-dynamic-border-radius.code-snippets +31 -0
- package/app/assets/styles/setup/06.utility-classes/_dynamic-border-radius.css +27 -0
- package/app/assets/styles/setup/06.utility-classes/index.css +1 -0
- package/app/components/02.molecules/social-icons-list/CONSUMER-STYLING.md +97 -8
- package/app/components/02.molecules/social-icons-list/SocialIconsList.vue +80 -14
- package/app/components/02.molecules/social-icons-list/stories/SocialIconsList.stories.ts +230 -2
- package/app/components/02.molecules/social-icons-list/stories/social-icons-list-recipes.css +108 -0
- package/app/components/02.molecules/social-icons-list/tests/SocialIconsList.spec.ts +123 -52
- package/app/components/02.molecules/social-icons-list/tests/__snapshots__/SocialIconsList.spec.ts.snap +10 -4
- package/app/components/02.molecules/toast/CONSUMER-STYLING.md +9 -3
- package/app/components/02.molecules/toast/DisplayToast.vue +10 -10
- package/app/components/02.molecules/toast/DisplayToastProvider.vue +12 -4
- package/app/components/02.molecules/toast/stories/DisplayToast.stories.ts +200 -2
- package/app/components/02.molecules/toast/tests/DisplayToast.spec.ts +33 -12
- package/app/components/02.molecules/toast/tests/DisplayToastProvider.spec.ts +20 -0
- package/app/types/components/social-icons-list.d.ts +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "app/**/*.vue"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Status messages never take focus
|
|
7
|
+
|
|
8
|
+
Never `.focus()` a toast, banner or other status message when it appears. Announce it with `role`
|
|
9
|
+
+ `aria-live`, keep it reachable with `tabindex="0"`, and listen for Escape on the document while
|
|
10
|
+
it's shown (skipping `event.defaultPrevented`).
|
|
11
|
+
|
|
12
|
+
Why: WCAG 4.1.3 says status messages are announced without receiving focus, and moving focus
|
|
13
|
+
interrupts typing. Chrome also counts script focus before any pointer input as `:focus-visible`,
|
|
14
|
+
so `:focus:not(:focus-visible)` can't hide the ring (`DisplayToast`, 2026-10-16).
|
|
@@ -178,7 +178,9 @@ The ledger can't see items 6c, 9, 10, 11 and 14, so check those by hand.
|
|
|
178
178
|
stories/tests up one level, fix relative imports); `pathPrefix: false` keeps the auto-import
|
|
179
179
|
names unchanged. All existing `variants/` folders were flattened 2026-09-25.
|
|
180
180
|
8. **VS Code snippet** — create or update `.vscode/srcdev-component-{family}.code-snippets`,
|
|
181
|
-
covering the control and its Field wrapper in one file.
|
|
181
|
+
covering the control and its Field wrapper in one file. For a teleported component, a CSS
|
|
182
|
+
override scaffold must not nest its selector under a page class: it never matches (the
|
|
183
|
+
`DisplayToast` snippet did, fixed 2026-10-16).
|
|
182
184
|
9. **Accessibility** — check for gaps beyond what already-passing tests would catch:
|
|
183
185
|
- Interactive controls (buttons, toggles, custom form-like widgets) have an accessible name —
|
|
184
186
|
visible text, `aria-label`, or `aria-labelledby`.
|
|
@@ -188,6 +190,8 @@ The ledger can't see items 6c, 9, 10, 11 and 14, so check those by hand.
|
|
|
188
190
|
`event.preventDefault()` with a comment like "could add this later", and no screen-reader
|
|
189
191
|
copy (visible or `sr-only`) that describes an interaction the component doesn't actually
|
|
190
192
|
perform. Cross-check every claim in the copy against the handler that's supposed to back it.
|
|
193
|
+
- A toast, banner or status message doesn't `.focus()` itself when it appears (rule
|
|
194
|
+
`consumer/a11y-no-focus-steal.md`).
|
|
191
195
|
- Focus is visible (`:focus-visible`, not a suppressed outline) on anything focusable.
|
|
192
196
|
- Live-updating or auto-advancing content (carousels, marquees, auto-dismissing toasts) has a
|
|
193
197
|
way to pause it, per WCAG 2.2.2 — a visible control, or pause-on-hover/focus at minimum.
|
|
@@ -111,6 +111,7 @@ const toastVisible = ref(false)
|
|
|
111
111
|
|
|
112
112
|
- `onBeforeRouteLeave` dismisses the toast on navigation. This emits a Vue Router warning in Vitest (no active route record) — harmless.
|
|
113
113
|
- `returnFocusTo` accepts an `HTMLElement` or a component instance with `$el`.
|
|
114
|
+
- Neither `DisplayToast` nor `DisplayToastProvider` moves focus when a toast appears (changed 2026-10-16; both used to `.focus()` the toast). Toasts are status messages announced through `role` + `aria-live` (WCAG 4.1.3), and stealing focus interrupted typing and drew a focus ring in Chrome when the toast opened before any pointer input. Keyboard users can still Tab to it (`tabindex="0"`), and Escape is heard on the document while a toast is shown (ignored if another handler called `preventDefault()`).
|
|
114
115
|
- The toast uses `<Teleport to="body">`. In tests, query `document.querySelector(".display-toast")` not `wrapper.find()`.
|
|
115
116
|
- Position, alignment and state are `data-position`, `data-alignment` (`full-width` when `fullWidth`) and `data-state="show|hide"`, not classes (changed 2026-10-08: the old bare `.top`/`.hide`/... classes could collide with a consumer's utility classes, since the toast is teleported into `<body>`).
|
|
116
117
|
- In tests, unmount every toast in `afterEach` before clearing `document.body`: a leftover instance's pending dismiss timer otherwise re-renders into the removed container (`insertBefore` of null) during a later test's timer advance.
|
|
@@ -119,8 +120,8 @@ const toastVisible = ref(false)
|
|
|
119
120
|
|
|
120
121
|
Auto-dismiss pauses while hovered, or while keyboard focus is on or inside the toast, and resumes with
|
|
121
122
|
the remaining time (`createPausableTimeout` in `app/utils/pausableTimeout.ts`, plus
|
|
122
|
-
`focusPausesAutoDismiss`).
|
|
123
|
-
`:focus-visible` (keyboard modality), so mouse
|
|
123
|
+
`focusPausesAutoDismiss`). Focus on the toast root only pauses it when the root matches
|
|
124
|
+
`:focus-visible` (keyboard modality), so a mouse click on it doesn't stop auto-dismiss. `data-paused` freezes the
|
|
124
125
|
progress bar via `animation-play-state`. In jsdom `:focus-visible` matches any focus, so tests that
|
|
125
126
|
depend on modality spy on `Element.prototype.matches` (see `DisplayToast.spec.ts`).
|
|
126
127
|
|
|
@@ -244,6 +245,8 @@ The SVG border shape matches the standard toast exactly (8px left radius, 4px ri
|
|
|
244
245
|
|
|
245
246
|
The inner content layout is handled by the shared `AlertContentInner` molecule — both variants reuse it. `AlertMaskedContent` sets `--alert-content-inner-background: transparent` so the glass effect shows through.
|
|
246
247
|
|
|
248
|
+
**Contrast caveat:** a toast is fixed to the viewport, so whatever scrolls behind it (body copy, busy photos) shows through the fill. 80% holds up over most backdrops; lowering `--alert-masked-content-background` can make the message hard to read, and the 1px accent border can disappear over a backdrop of similar hue. Set that token on `.display-toast` (or a `styleClassPassthrough` class) or `.display-toast-provider-item`: both teleport to `<body>`, so a page-level ancestor never reaches them. Prefer the opaque variant for error/warning toasts. Storybook's "Masked: Low Contrast Risk" story demos the failure.
|
|
249
|
+
|
|
247
250
|
### Provider notes
|
|
248
251
|
|
|
249
252
|
- `useToastQueue` state persists across route changes — no `onBeforeRouteLeave` cleanup needed.
|
|
@@ -252,4 +255,4 @@ The inner content layout is handled by the shared `AlertContentInner` molecule
|
|
|
252
255
|
- Every mounted provider reacts to the shared `useToastQueue` state, so tests must unmount providers in `afterEach`; otherwise an earlier test's provider runs its own timer for a new toast and dismisses it.
|
|
253
256
|
- Each item pauses independently (hover / keyboard focus, same rule as the standalone toast), tracked per toast id.
|
|
254
257
|
- The progress bar (`.display-toast-provider-progress`) is only rendered when `autoDismiss: true`.
|
|
255
|
-
- Dismissal can be triggered by: close button click, Escape key (when the
|
|
258
|
+
- Dismissal can be triggered by: close button click, Escape key (dismisses that item when focus is inside it, otherwise the newest visible item), `dismiss(id)`, auto-dismiss timer, or `clear()`.
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
| `items` | `ISocialIcon[]` | — | **Required.** Array of social network items. |
|
|
14
14
|
| `label` | `string` | `"Social media profiles"` | `aria-label` applied to the `<ul>` element. |
|
|
15
15
|
| `linkLabelTemplate` | `string` | `"{network} profile (opens in a new tab)"` | `aria-label` for each link; `{network}` is replaced with the item's `networkName`. |
|
|
16
|
+
| `showLabel` | `boolean` | `false` | Show each item's `networkName` as visible text after the icon. Filling the `label` slot shows it too. |
|
|
16
17
|
| `styleClassPassthrough` | `string \| string[]` | `[]` | Extra CSS classes applied to the root `<ul>`. |
|
|
17
18
|
|
|
18
19
|
---
|
|
@@ -26,11 +27,25 @@ interface ISocialIcon {
|
|
|
26
27
|
iconName: string; // Iconify icon name, e.g. "logos:instagram-icon"
|
|
27
28
|
baseHref: string; // Base URL including trailing slash, e.g. "https://www.instagram.com/"
|
|
28
29
|
profileId: string; // Profile identifier appended to baseHref
|
|
30
|
+
brandColour?: string; // Exposed as --social-icons-list-brand-colour on the item, for recipes
|
|
29
31
|
}
|
|
30
32
|
```
|
|
31
33
|
|
|
32
34
|
The rendered `href` is `${baseHref}${profileId}`.
|
|
33
35
|
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Slots
|
|
39
|
+
|
|
40
|
+
Both are scoped and receive `{ item }` (the `ISocialIcon`). Types: `SocialIconsListSlots`.
|
|
41
|
+
|
|
42
|
+
| Slot | Replaces | Notes |
|
|
43
|
+
|------|----------|-------|
|
|
44
|
+
| `icon` | The `<Icon>` inside `.social-icons-list-icon-wrapper` | The wrapper is `aria-hidden` and keeps the size and circle tokens, so slot content (an initial, `DisplayAvatar`, an image) is decorative and sized by `--social-icons-list-icon-size`. |
|
|
45
|
+
| `label` | The visible `networkName` text | Filling it shows the label without `showLabel` (e.g. name plus `@handle`). |
|
|
46
|
+
|
|
47
|
+
Slot content sits inside the link: keep it non-interactive (no buttons or nested links).
|
|
48
|
+
|
|
34
49
|
### Importing the type
|
|
35
50
|
|
|
36
51
|
**Within the layer** (e.g. in another layer component or composable):
|
|
@@ -57,6 +72,8 @@ import type { ISocialIcon } from "srcdev-nuxt-components";
|
|
|
57
72
|
| YouTube | `logos:youtube-icon` | `https://www.youtube.com/@` |
|
|
58
73
|
| TikTok | `logos:tiktok-icon` | `https://www.tiktok.com/@` |
|
|
59
74
|
|
|
75
|
+
Mono equivalents for recipes, with brand colours: `bi:facebook` (`#1877f2`), `bi:twitter-x` (`#000000`), `bi:instagram` (`#e1306c`), `bi:youtube` (`#ff0000`), `bi:tiktok` (`#000000`).
|
|
76
|
+
|
|
60
77
|
`logos:instagram-icon`, `logos:x` and other dark brand icons vanish on a dark background, and their colours can't be changed. On a dark background use a mono icon such as `mdi:instagram` (any set that draws in `currentColor`) and colour it with `--social-icons-list-icon-colour` (default `currentColor`). Installed mono Instagram icons: `mdi:instagram`, `bi:instagram`, `lucide:instagram`, `akar-icons:instagram-fill`, `radix-icons:instagram-logo`.
|
|
61
78
|
|
|
62
79
|
---
|
|
@@ -88,14 +105,21 @@ import type { ISocialIcon } from "srcdev-nuxt-components";
|
|
|
88
105
|
|
|
89
106
|
| Property | Default | Notes |
|
|
90
107
|
|----------|---------|-------|
|
|
91
|
-
| `--social-icons-list-icon-size` | `2.4rem` | Icon size (
|
|
92
|
-
| `--social-icons-list-gap` | `1.2rem` | Gap between
|
|
108
|
+
| `--social-icons-list-icon-size` | `2.4rem` | Icon size (a `font-size` on the icon wrapper) |
|
|
109
|
+
| `--social-icons-list-gap` | `1.2rem` | Gap between items |
|
|
110
|
+
| `--social-icons-list-icon-colour` / `-hover` | `currentColor` | Mono icons only; `logos:` colours are fixed |
|
|
111
|
+
| `--social-icons-list-link-padding` / `-border` / `-radius` / `-background` / `-background-hover` / `-shadow` / `-shadow-hover` / `-gap` | none / `0.8rem` gap | Turn links into tiles or pills |
|
|
112
|
+
| `--social-icons-list-icon-wrapper-padding` / `-border` / `-radius` / `-background` | none | Circle or tile behind the icon |
|
|
113
|
+
| `--social-icons-list-label-colour` / `-font-size` / `-font-weight` | `currentColor` / `--step-4` / `600` | Visible label |
|
|
93
114
|
| `--social-icons-list-hover-scale` | `1.15` | Hover/focus scale (none under reduced motion) |
|
|
94
115
|
| `--social-icons-list-hover-opacity` | `0.85` | Hover/focus opacity |
|
|
116
|
+
| `--social-icons-list-focus-ring-colour` | `var(--theme-ring, currentColor)` | Keyboard focus outline |
|
|
117
|
+
|
|
118
|
+
Full table with defaults in `CONSUMER-STYLING.md`. **Tokens that read `--social-icons-list-brand-colour` must be set on `.social-icons-list-item`**, where the brand colour is defined: a `var()` in a custom property resolves on the declaring element, so set on the list root it finds nothing. Four recipes (mono tiles with brand hover, dark dock with glow, labelled pills, overlapping stack) are in `stories/social-icons-list-recipes.css` and the `Recipe: …` stories; reuse them rather than inventing new structure.
|
|
95
119
|
|
|
96
|
-
> Renamed 2026-09-28 from `--theme-social-icon-size` / `--theme-social-icon-gap`. Full reference: `CONSUMER-STYLING.md` in the component folder.
|
|
120
|
+
> Renamed 2026-09-28 from `--theme-social-icon-size` / `--theme-social-icon-gap`. Inner classes renamed 2026-10-16 (`.social-icon-item`/`-link`/`.social-icon` are now `.social-icons-list-item`/`-link`/`-icon`). Full reference: `CONSUMER-STYLING.md` in the component folder.
|
|
97
121
|
|
|
98
|
-
|
|
122
|
+
The size token is a `font-size` on `.social-icons-list-icon-wrapper`, whose content box is a fixed `1em` square (`box-sizing: content-box`, padding added around it). The default icon fills it, any `icon` slot content is centred in it, and an icon name that doesn't resolve still leaves a visible, focusable target. With uniform `--social-icons-list-icon-wrapper-padding` and a `50%` radius it's always a circle; slot content bigger than `1em` overflows the square, so size it to fit (e.g. `font-size: 0.8em` for a letter).
|
|
99
123
|
|
|
100
124
|
---
|
|
101
125
|
|
|
@@ -120,7 +144,7 @@ Offer this scaffold when placing the component in a consuming page or section. T
|
|
|
120
144
|
/* --social-icons-list-gap: 1.6rem; */
|
|
121
145
|
/* margin-block-start: 1.6rem; */
|
|
122
146
|
|
|
123
|
-
.social-
|
|
147
|
+
.social-icons-list-link {
|
|
124
148
|
/* border-radius: 0.4rem; */
|
|
125
149
|
/* padding: 0.4rem; */
|
|
126
150
|
/* outline: 1px solid transparent; */
|
|
@@ -138,6 +162,9 @@ need to target a specific instance. See `component-local-style-override.md` for
|
|
|
138
162
|
## Notes
|
|
139
163
|
|
|
140
164
|
- All links open in a new tab with `rel="noopener noreferrer"`.
|
|
165
|
+
- An item is skipped (with a dev-mode `console.warn`) when its `baseHref + profileId` isn't `http:`/`https:`, `mailto:`, `tel:` or a site-relative `/path`: `items` often comes from a CMS, and a `javascript:` href would otherwise render as a working link. `mailto:` and `tel:` items are fine, so email and phone can sit in the same row.
|
|
166
|
+
- Keys are `index + networkName`, so two accounts on the same network (two Instagram profiles) both render.
|
|
167
|
+
- The `<ul>` has `role="list"`: with `list-style: none`, Safari/VoiceOver stops announcing it as a list otherwise.
|
|
141
168
|
- Each link's `aria-label` comes from `linkLabelTemplate` (default `"{network} profile (opens in a new tab)"`, `{network}` = `networkName`), or the item's own `label`. Pass a translated template for other languages. The icon is `aria-hidden`.
|
|
142
169
|
- The `logos:*` Iconify collection requires `@iconify-json/logos` to be installed in the consumer app. Without it, icons will fall back to a CDN fetch (causing FOUC). See [icon-sets.md](../icon-sets.md).
|
|
143
170
|
- Auto-imported in Nuxt — no manual import needed.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# CSS Dynamic Border Radius
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`.dynamic-border-radius` (global utility, `app/assets/styles/setup/06.utility-classes/_dynamic-border-radius.css`,
|
|
6
|
+
`utilities` layer) rounds an element's corners while it's narrower than its container, and squares them once it
|
|
7
|
+
spans the full container width. A capped-width image reads as a rounded card on wide screens and as an edge-to-edge
|
|
8
|
+
band on narrow ones, with no media query and no JS.
|
|
9
|
+
|
|
10
|
+
```css
|
|
11
|
+
.dynamic-border-radius {
|
|
12
|
+
border-radius: clamp(0px, (100cqi - 100%) * 1e5, var(--dynamic-border-radius, 5rem));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.dynamic-border-radius-transition {
|
|
16
|
+
max-inline-size: var(--dynamic-border-radius-max-width, 100%);
|
|
17
|
+
border-radius: clamp(0px, (100cqi - var(--dynamic-border-radius-max-width, 100%)) * 1e5, var(--dynamic-border-radius, 5rem));
|
|
18
|
+
|
|
19
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
20
|
+
transition: border-radius var(--dynamic-border-radius-duration, 300ms) var(--dynamic-border-radius-easing, ease-out);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
It's a utility class, not a component: it works on any element (`<img>`, `NuxtImg`, `<video>`, a card), and the
|
|
26
|
+
container it measures is an ancestor the element doesn't own.
|
|
27
|
+
|
|
28
|
+
Storybook: **Foundations/Utilities/Dynamic Border Radius**.
|
|
29
|
+
|
|
30
|
+
## Token
|
|
31
|
+
|
|
32
|
+
| Token | Default | Controls |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| `--dynamic-border-radius` | `5rem` | Radius while the element is narrower than its container. Set it on the element or any ancestor. |
|
|
35
|
+
| `--dynamic-border-radius-max-width` | `100%` | `.dynamic-border-radius-transition` only: the element's max width, as a length. Sets its `max-inline-size` and is what the container is compared against. |
|
|
36
|
+
| `--dynamic-border-radius-duration` | `300ms` | Transition duration, with `.dynamic-border-radius-transition`. |
|
|
37
|
+
| `--dynamic-border-radius-easing` | `ease-out` | Transition easing, with `.dynamic-border-radius-transition`. |
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<div class="hero-media">
|
|
43
|
+
<img class="dynamic-border-radius" src="/images/hero.jpg" alt="" width="1600" height="900">
|
|
44
|
+
</div>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```css
|
|
48
|
+
.hero-media {
|
|
49
|
+
container-type: inline-size;
|
|
50
|
+
|
|
51
|
+
img {
|
|
52
|
+
display: block;
|
|
53
|
+
inline-size: 100%;
|
|
54
|
+
max-inline-size: 50rem;
|
|
55
|
+
margin-inline: auto;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## How it works
|
|
61
|
+
|
|
62
|
+
`100cqi` is the container's inline size; inside `border-radius`, `100%` is the element's own width. While the element
|
|
63
|
+
is narrower, the difference is positive, the `* 1e5` blows it up past the max, and `clamp()` caps it at the token.
|
|
64
|
+
When the element fills the container, the difference is 0 and so is the radius.
|
|
65
|
+
|
|
66
|
+
## Optional transition
|
|
67
|
+
|
|
68
|
+
Use `.dynamic-border-radius-transition` instead of the base class to ease the switch, and give it the element's max
|
|
69
|
+
width as a token (it sets `max-inline-size` from it, so don't also set `max-inline-size` yourself):
|
|
70
|
+
|
|
71
|
+
```html
|
|
72
|
+
<img class="dynamic-border-radius-transition" style="--dynamic-border-radius-max-width: 50rem" src="/images/hero.jpg" alt="" width="1600" height="900">
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
- **Why a different formula.** Don't just add a `transition` to the base class: it flickers while the container
|
|
76
|
+
shrinks. A transition starts from the old *computed* value, where `100cqi` is already pixels (the previous
|
|
77
|
+
frame's container width) but `100%` stays unresolved until layout, so it's re-evaluated against this frame's,
|
|
78
|
+
smaller, element width. Previous container minus current element is positive, `* 1e5` clamps it to the full
|
|
79
|
+
radius, and every resize frame restarts a transition from there. Comparing against a length token instead makes
|
|
80
|
+
the computed value a plain length (full radius or 0): nothing changes while you resize either side of the
|
|
81
|
+
threshold, and crossing it starts exactly one transition.
|
|
82
|
+
- **Without the token** it falls back to `100%`: the base formula, so it works but flickers on resize.
|
|
83
|
+
- **The token must match the element's real max width**, as a single length (`50rem`, not `min(50rem, 90%)`). If
|
|
84
|
+
something else caps the element narrower (a consumer `max-inline-size`, a small intrinsic image size), the radius
|
|
85
|
+
stays at 0 even though the element doesn't fill the container.
|
|
86
|
+
- It sets `transition`, which replaces any transition already on the element (the utilities layer beats
|
|
87
|
+
`@layer components`). If the element needs its own transition too, add `border-radius` to your own combined
|
|
88
|
+
`transition` instead (`transform 200ms, border-radius 300ms ease-out`).
|
|
89
|
+
- It only animates when the **container** resizes. If only the token changes (at a breakpoint), the value changes
|
|
90
|
+
too, so that animates as well; an image loading doesn't affect it.
|
|
91
|
+
- The transition is skipped under `prefers-reduced-motion: reduce`; the radius still switches.
|
|
92
|
+
|
|
93
|
+
## Caveats
|
|
94
|
+
|
|
95
|
+
1. **It needs a `container-type: inline-size` ancestor.** Without one, `cqi` falls back to the viewport, so the
|
|
96
|
+
radius only drops when the element is as wide as the screen. It doesn't error; it just looks wrong. Put the
|
|
97
|
+
container on the element's direct layout wrapper: if the nearest container is wider than the element's real
|
|
98
|
+
column, the element never "fills" it.
|
|
99
|
+
2. **It works partly by luck. Don't split it into horizontal and vertical radii.** The single value sets both radii, and
|
|
100
|
+
the vertical one resolves `100%` against the element's *height*, so at full width it's usually still at the max.
|
|
101
|
+
The corner is square anyway, because CSS draws a square corner when either radius is 0. A `border-radius: X / Y`
|
|
102
|
+
rewrite, or a percentage max, can break this.
|
|
103
|
+
3. **The element must actually reach full width.** Give an image `display: block; inline-size: 100%` plus a
|
|
104
|
+
`max-inline-size`. With only a max, an image whose intrinsic width is smaller than the container (a `w=400` CDN
|
|
105
|
+
URL, for example) never fills it, so the radius never drops.
|
|
106
|
+
4. **Subpixel widths.** A 500.4px container around a 500px element keeps the radius on. That's correct (it isn't
|
|
107
|
+
full width), but it can look like the switch is late at fractional zoom levels.
|
|
108
|
+
5. **Support:** container query units and `clamp()` with mixed units work in Safari 16, the layer's support
|
|
109
|
+
baseline.
|
|
110
|
+
|
|
111
|
+
## Snippet
|
|
112
|
+
|
|
113
|
+
`.vscode/srcdev-utility-dynamic-border-radius.code-snippets`: `srcdev-dynamic-border-radius` (markup with the
|
|
114
|
+
container wrapper, transition class as an optional placeholder) and `srcdev-dynamic-border-radius-css` (the wrapper and image rules).
|
package/.claude/skills/index.md
CHANGED
|
@@ -51,6 +51,7 @@ Each skill is a single markdown file named `<area>-<task>.md`.
|
|
|
51
51
|
├── css-nesting-conventions.md — native CSS nesting rules: why &__child Sass BEM concatenation silently breaks, correct patterns
|
|
52
52
|
├── css-grid-max-width-gutters.md — cap a centre grid column width by growing gutters, with start/center alignment variants
|
|
53
53
|
├── css-animation-utilities.md — scroll-driven animation utility classes: scroller-x (carousel), entry-zoom-reveal, entry-slide-in, entry-exit-blur, auto-rotate
|
|
54
|
+
├── css-dynamic-border-radius.md — .dynamic-border-radius utility: rounded until the element fills its container-type ancestor, then square; --dynamic-border-radius token, opt-in -transition class, container/full-width caveats
|
|
54
55
|
├── component-aria-landmark.md — useAriaLabelledById composable: aria-labelledby for section/article/aside tags (not main), consumer-bound vs self-bound pattern, built-in broken-reference console warning
|
|
55
56
|
├── component-export-types.md — move inline component types to app/types/components/ barrel for consumer imports
|
|
56
57
|
├── component-inline-action-button.md — InputButton variant="inline" pattern for buttons embedded in custom input wrappers
|
|
@@ -115,7 +116,7 @@ Each skill is a single markdown file named `<area>-<task>.md`.
|
|
|
115
116
|
├── wipe-away-vertical.md — WipeAwayVertical: scroll-driven vertical wipe-away effect, pure-CSS grid overlay (no JS), indexed dynamic slots, sticky-centering-via-calc gotcha, CSS tokens
|
|
116
117
|
├── marquee-scroller.md — MarqueeScroller: infinite logo/badge scroller, per-item dynamic slots (marqueeData id), hover/focus/keyboard pause, reduced-motion, CSS tokens
|
|
117
118
|
├── rotating-carousel-image.md — RotatingCarouselImage: 3D rotating image carousel, scroll-parallax tilt, focus/keyboard/hover pause, reduced-motion, CSS tokens
|
|
118
|
-
├── social-icons-list.md — SocialIconsList: data-driven social icon links, ISocialIcon type, logos: icon names (dark ones vanish on dark backgrounds; mono alternatives),
|
|
119
|
+
├── social-icons-list.md — SocialIconsList: data-driven social icon links, ISocialIcon type, logos: icon names (dark ones vanish on dark backgrounds; mono alternatives), showLabel + scoped icon/label slots, per-item brandColour (set brand-colour tokens on .social-icons-list-item), tile/circle/label tokens, four recipes (mono tiles, dark dock, pills, overlapping stack), unsafe hrefs skipped
|
|
119
120
|
├── display-qr-code.md — DisplayQrCode: QR code SVG from a string value, colour/size/variant/radius props, currentColor default
|
|
120
121
|
├── capture-qr-code.md — CaptureQrCode: live camera scanner, error state, visibility/route/KeepAlive lifecycle, media stream cleanup
|
|
121
122
|
├── decode-qr-code.md — DecodeQrCode: file picker + drag-and-drop image decoder, shared results list, CSS override points
|
|
@@ -321,6 +321,12 @@ the earlier nightly `@nuxtjs/storybook` didn't render Docs pages at all, so a lo
|
|
|
321
321
|
screens, and sets `docs.story: { inline: false }`. `CookieConsentBanner` and `DisplayToast`
|
|
322
322
|
follow this. A teleported component doesn't inherit a wrapper's `dir`, so wrap RTL slot copy
|
|
323
323
|
in `<span dir="rtl">`.
|
|
324
|
+
- The same goes for tokens: a teleported component doesn't inherit custom properties from a story
|
|
325
|
+
wrapper. To demo a token override, inject a `<style>` rule targeting the component's own root
|
|
326
|
+
class in setup (remove it in `onUnmounted`); that also keeps `var(--theme-*)` inside the value
|
|
327
|
+
resolving against the component's own `data-theme`. A backdrop meant to sit behind it (to demo
|
|
328
|
+
translucency) must be `position: fixed; inset: 0`. `DisplayToast`'s `canvas` / `maskedFill`
|
|
329
|
+
story controls follow this.
|
|
324
330
|
- Opt a file out with `tags: ["!autodocs"]` only when it isn't a component reference (tooling, or
|
|
325
331
|
a file with its own attached `.mdx` page, like `ColourRamps.stories.ts` with `SetupGuide.mdx`).
|
|
326
332
|
|
|
@@ -62,16 +62,14 @@
|
|
|
62
62
|
]
|
|
63
63
|
},
|
|
64
64
|
"SRCDEV DisplayToast CSS Override": {
|
|
65
|
-
"description": "CSS override scaffold for DisplayToastProvider items",
|
|
65
|
+
"description": "CSS override scaffold for DisplayToastProvider items (teleported to body, so not nested in a page class)",
|
|
66
66
|
"scope": "css",
|
|
67
67
|
"body": [
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
" --theme-border: ;",
|
|
74
|
-
" }",
|
|
68
|
+
".display-toast-provider-item {",
|
|
69
|
+
" --theme-surface: $1;",
|
|
70
|
+
" --theme-text: $2;",
|
|
71
|
+
" --theme-accent: $3;",
|
|
72
|
+
" --theme-border: $4;",
|
|
75
73
|
"}"
|
|
76
74
|
]
|
|
77
75
|
}
|
|
@@ -11,6 +11,19 @@
|
|
|
11
11
|
"/>"
|
|
12
12
|
]
|
|
13
13
|
},
|
|
14
|
+
"SRCDEV SocialIconsList Labelled": {
|
|
15
|
+
"description": "SocialIconsList with visible labels and brand colours (mono icons, for the pill or tile recipes)",
|
|
16
|
+
"scope": "vue,html",
|
|
17
|
+
"body": [
|
|
18
|
+
"<SocialIconsList",
|
|
19
|
+
" :items=\"[",
|
|
20
|
+
" { networkName: '${1:Instagram}', iconName: '${2:bi:instagram}', baseHref: '${3:https://www.instagram.com/}', profileId: '$4', brandColour: '${5:#e1306c}' },",
|
|
21
|
+
" ]\"",
|
|
22
|
+
" show-label",
|
|
23
|
+
" :style-class-passthrough=\"['${6:my-social-pills}']\"",
|
|
24
|
+
"/>"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
14
27
|
"SRCDEV SocialIconsList CSS Override": {
|
|
15
28
|
"description": "CSS override scaffold for SocialIconsList tokens",
|
|
16
29
|
"scope": "css",
|
|
@@ -18,6 +31,7 @@
|
|
|
18
31
|
".$1my-page {",
|
|
19
32
|
" --social-icons-list-icon-size: $2;",
|
|
20
33
|
" --social-icons-list-gap: $3;",
|
|
34
|
+
" --social-icons-list-icon-colour: $4;",
|
|
21
35
|
"}"
|
|
22
36
|
]
|
|
23
37
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"SRCDEV Dynamic Border Radius Markup": {
|
|
3
|
+
"prefix": "srcdev-dynamic-border-radius",
|
|
4
|
+
"description": ".dynamic-border-radius: rounded until the image fills its container, then square (wrapper needs container-type: inline-size)",
|
|
5
|
+
"scope": "vue,html",
|
|
6
|
+
"body": [
|
|
7
|
+
"<div class=\"$1media-wrapper\">",
|
|
8
|
+
" <img class=\"dynamic-border-radius${6:-transition}\" src=\"$2\" alt=\"$3\" width=\"$4\" height=\"$5\">",
|
|
9
|
+
"</div>"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"SRCDEV Dynamic Border Radius CSS": {
|
|
13
|
+
"prefix": "srcdev-dynamic-border-radius-css",
|
|
14
|
+
"description": "Container wrapper and image rules for .dynamic-border-radius (max width via the token, so the -transition class can read it)",
|
|
15
|
+
"scope": "css",
|
|
16
|
+
"body": [
|
|
17
|
+
".$1media-wrapper {",
|
|
18
|
+
" container-type: inline-size;",
|
|
19
|
+
"",
|
|
20
|
+
" img {",
|
|
21
|
+
" display: block;",
|
|
22
|
+
" inline-size: 100%;",
|
|
23
|
+
" --dynamic-border-radius-max-width: ${2:50rem};",
|
|
24
|
+
" max-inline-size: var(--dynamic-border-radius-max-width);",
|
|
25
|
+
" margin-inline: auto;",
|
|
26
|
+
" --dynamic-border-radius: ${3:5rem};",
|
|
27
|
+
" }",
|
|
28
|
+
"}"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* ===========================================
|
|
2
|
+
DYNAMIC BORDER RADIUS
|
|
3
|
+
Rounded corners while the element is narrower than its
|
|
4
|
+
container; square once it spans the full container width.
|
|
5
|
+
Needs an ancestor with container-type: inline-size.
|
|
6
|
+
=========================================== */
|
|
7
|
+
|
|
8
|
+
.dynamic-border-radius {
|
|
9
|
+
border-radius: clamp(0px, (100cqi - 100%) * 1e5, var(--dynamic-border-radius, 5rem));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
* Transition variant: compares against a max-width token instead of 100%, so the computed value is a plain length.
|
|
14
|
+
* A % stays unresolved until layout, which makes a transition start from a stale value and flicker on every resize frame.
|
|
15
|
+
*/
|
|
16
|
+
.dynamic-border-radius-transition {
|
|
17
|
+
max-inline-size: var(--dynamic-border-radius-max-width, 100%);
|
|
18
|
+
border-radius: clamp(
|
|
19
|
+
0px,
|
|
20
|
+
(100cqi - var(--dynamic-border-radius-max-width, 100%)) * 1e5,
|
|
21
|
+
var(--dynamic-border-radius, 5rem)
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
25
|
+
transition: border-radius var(--dynamic-border-radius-duration, 300ms) var(--dynamic-border-radius-easing, ease-out);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -2,18 +2,68 @@
|
|
|
2
2
|
|
|
3
3
|
## Public token API
|
|
4
4
|
|
|
5
|
+
### List
|
|
6
|
+
|
|
7
|
+
| Token | Default | Controls |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| `--social-icons-list-gap` | `1.2rem` | Gap between items |
|
|
10
|
+
|
|
11
|
+
### Link (the tile)
|
|
12
|
+
|
|
5
13
|
| Token | Default | Controls |
|
|
6
14
|
|---|---|---|
|
|
7
|
-
| `--social-icons-list-
|
|
8
|
-
| `--social-icons-list-gap` | `
|
|
9
|
-
| `--social-icons-list-
|
|
15
|
+
| `--social-icons-list-link-padding` | `0` | Padding inside each link: set it to turn links into tiles or pills |
|
|
16
|
+
| `--social-icons-list-link-gap` | `0.8rem` | Gap between the icon and the visible label |
|
|
17
|
+
| `--social-icons-list-link-border` | `none` | Border shorthand |
|
|
18
|
+
| `--social-icons-list-link-radius` | `0` | Corner radius (the focus outline follows it) |
|
|
19
|
+
| `--social-icons-list-link-background` | `transparent` | Background |
|
|
20
|
+
| `--social-icons-list-link-background-hover` | the resting background | Background on hover/focus |
|
|
21
|
+
| `--social-icons-list-link-shadow` | `none` | Box shadow |
|
|
22
|
+
| `--social-icons-list-link-shadow-hover` | the resting shadow | Box shadow on hover/focus (a glow) |
|
|
10
23
|
| `--social-icons-list-hover-scale` | `1.15` | Scale on hover/focus (no scaling under `prefers-reduced-motion: reduce`) |
|
|
11
24
|
| `--social-icons-list-hover-opacity` | `0.85` | Opacity on hover/focus |
|
|
25
|
+
| `--social-icons-list-focus-ring-colour` | `var(--theme-ring, currentColor)` | Keyboard focus outline colour |
|
|
26
|
+
|
|
27
|
+
### Icon
|
|
12
28
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
29
|
+
| Token | Default | Controls |
|
|
30
|
+
|---|---|---|
|
|
31
|
+
| `--social-icons-list-icon-size` | `2.4rem` | Icon size (a `font-size` on the icon wrapper) |
|
|
32
|
+
| `--social-icons-list-icon-colour` | `currentColor` | Colour of mono icons (sets that draw in `currentColor`, e.g. `bi:instagram`). No effect on `logos:` icons, whose colours are fixed in the SVG |
|
|
33
|
+
| `--social-icons-list-icon-colour-hover` | the resting icon colour | Mono icon colour on hover/focus |
|
|
34
|
+
| `--social-icons-list-icon-wrapper-padding` | `0` | Padding around the icon's fixed `1em` square: uniform padding with a background and `50%` radius gives a circle, whatever the `icon` slot holds |
|
|
35
|
+
| `--social-icons-list-icon-wrapper-border` | `none` | Border shorthand around the icon |
|
|
36
|
+
| `--social-icons-list-icon-wrapper-radius` | `0` | Corner radius of the icon wrapper |
|
|
37
|
+
| `--social-icons-list-icon-wrapper-background` | `transparent` | Background behind the icon |
|
|
38
|
+
|
|
39
|
+
### Label (`show-label` or the `label` slot)
|
|
40
|
+
|
|
41
|
+
| Token | Default | Controls |
|
|
42
|
+
|---|---|---|
|
|
43
|
+
| `--social-icons-list-label-colour` | `currentColor` | Label text colour (set on the link) |
|
|
44
|
+
| `--social-icons-list-label-font-size` | `var(--step-4, 1.6rem)` | Label font size |
|
|
45
|
+
| `--social-icons-list-label-font-weight` | `600` | Label font weight |
|
|
16
46
|
|
|
47
|
+
### Brand colour (data, not a default)
|
|
48
|
+
|
|
49
|
+
`--social-icons-list-brand-colour` is set inline on each `.social-icons-list-item` from that item's
|
|
50
|
+
`brandColour`. The component doesn't use it; it's there so your tokens can (hover colour, glow,
|
|
51
|
+
circle fill). See the caveat under Local overrides.
|
|
52
|
+
|
|
53
|
+
`logos:` icons carry their own brand colours. Some are dark (`logos:instagram-icon`, `logos:x`,
|
|
54
|
+
`logos:github-icon`) and vanish on a dark background: use a mono icon there (`bi:instagram`,
|
|
55
|
+
`mdi:instagram`, ...) and colour it with `--social-icons-list-icon-colour`.
|
|
56
|
+
|
|
57
|
+
> Changed 2026-10-16: the inner classes were renamed so they can't collide with a site's own
|
|
58
|
+
> `.social-icon` styles: `.social-icon-item` is now `.social-icons-list-item`, `.social-icon-link` is
|
|
59
|
+
> `.social-icons-list-link` and `.social-icon` is `.social-icons-list-icon`. Update any selector that
|
|
60
|
+
> used the old names. The icon now sits in a `.social-icons-list-icon-wrapper` span, which carries
|
|
61
|
+
> the icon size (so a missing icon still leaves a focus target). New: the link, icon wrapper and
|
|
62
|
+
> label tokens above, `--social-icons-list-focus-ring-colour` (the outline read `--theme-ring`
|
|
63
|
+
> directly), and per-item `--social-icons-list-brand-colour`. Items whose href isn't http(s),
|
|
64
|
+
> mailto, tel or site-relative are skipped. The focus outline's fixed `2px` radius is now
|
|
65
|
+
> `--social-icons-list-link-radius` (default `0`).
|
|
66
|
+
>
|
|
17
67
|
> Changed 2026-10-14: new `--social-icons-list-icon-colour` token for mono icons.
|
|
18
68
|
>
|
|
19
69
|
> Changed 2026-09-28: `--theme-social-icon-size` and `--theme-social-icon-gap` were renamed to
|
|
@@ -27,8 +77,10 @@ No private `--_` tokens.
|
|
|
27
77
|
|
|
28
78
|
## State hooks
|
|
29
79
|
|
|
30
|
-
Inner classes: `.social-
|
|
31
|
-
tab), `.social-icon` (the
|
|
80
|
+
Inner classes: `.social-icons-list-item` (each `<li>`, carries `--social-icons-list-brand-colour`),
|
|
81
|
+
`.social-icons-list-link` (the `<a>`, opens in a new tab), `.social-icons-list-icon-wrapper` (the
|
|
82
|
+
`aria-hidden` span around the icon or the `icon` slot), `.social-icons-list-icon` (the default
|
|
83
|
+
icon), `.social-icons-list-label` (visible text, only with `show-label` or the `label` slot).
|
|
32
84
|
|
|
33
85
|
---
|
|
34
86
|
|
|
@@ -40,6 +92,43 @@ Set the tokens above on an element you own (a page or section class, or a class
|
|
|
40
92
|
`<style scoped>`, tokens set on your element still work, but selectors that reach inside the component need
|
|
41
93
|
`:deep()`. Patterns and examples: `.claude/skills/component-local-style-override.md`.
|
|
42
94
|
|
|
95
|
+
**Caveat:** a token whose value reads `--social-icons-list-brand-colour` must be set on
|
|
96
|
+
`.social-icons-list-item` (or deeper), not on the list or an ancestor. A `var()` inside a custom
|
|
97
|
+
property resolves on the element that declares it, and the brand colour only exists on each item,
|
|
98
|
+
so set on the root it finds nothing and falls back to the default.
|
|
99
|
+
|
|
100
|
+
```css
|
|
101
|
+
.my-section .social-icons-list-item {
|
|
102
|
+
--social-icons-list-icon-colour-hover: var(--social-icons-list-brand-colour);
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Recipes
|
|
109
|
+
|
|
110
|
+
Four looks built only from the tokens above and consumer CSS, each on a class passed through
|
|
111
|
+
`style-class-passthrough`. The full CSS is in `stories/social-icons-list-recipes.css` next to the
|
|
112
|
+
component, and each has a Storybook story (`Recipe: …`). All use mono `bi:` icons plus a
|
|
113
|
+
`brandColour` per item.
|
|
114
|
+
|
|
115
|
+
- **Mono tiles, brand colour on hover**: tile tokens (`link-padding`, `-radius`, `-background`,
|
|
116
|
+
`-background-hover`), then `--social-icons-list-icon-colour-hover: var(--social-icons-list-brand-colour)`
|
|
117
|
+
on `.social-icons-list-item`.
|
|
118
|
+
- **Dark dock with glow**: the dock is the list root (padding, border, radius and
|
|
119
|
+
`inline-size: fit-content` on your class), dark tiles inside, and
|
|
120
|
+
`--social-icons-list-link-shadow-hover` mixed from the brand colour on `.social-icons-list-item`.
|
|
121
|
+
Black brand colours (X, TikTok) don't show on a dark dock: give those items a light or accent
|
|
122
|
+
`brandColour` there.
|
|
123
|
+
- **Labelled pills**: `show-label`, a pill link (`link-padding`, `-border`, `99rem` radius), and the
|
|
124
|
+
icon wrapper as a brand-coloured circle (`icon-wrapper-padding`, `50%` radius,
|
|
125
|
+
`icon-wrapper-background` from the brand colour on the item).
|
|
126
|
+
- **Overlapping stack**: circles from the icon wrapper tokens, a negative `margin-inline-start` on
|
|
127
|
+
every `.social-icons-list-item + .social-icons-list-item`, reset on the list's `:hover` and
|
|
128
|
+
`:focus-within` so keyboard users get the fan-out too. Put the transition inside
|
|
129
|
+
`@media (prefers-reduced-motion: no-preference)`. A "Follow us" caption is your own text beside
|
|
130
|
+
the component.
|
|
131
|
+
|
|
43
132
|
---
|
|
44
133
|
|
|
45
134
|
## Class passthrough
|