@getvitops/core 4.1.0 → 6.0.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,283 @@
1
1
  # @getvitops/core
2
2
 
3
+ ## 6.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - Carousel rework: a scroll strip that is operable and discoverable with no JS in every engine, and
8
+ real controls where the scroll-marker pseudo-elements are missing.
9
+
10
+ `::scroll-button()`, `::scroll-marker` and `::scroll-marker-group` are still Chromium-only, and
11
+ there is no usable polyfill (the one prototype targets the superseded syntax and only re-parses
12
+ inline `<style>` elements). So the carousel no longer assumes them: `<wc-carousel>` builds real
13
+ prev/next `<button>`s and a real dot nav where they are absent, styled from the same declarations
14
+ as the native ones. Which branch is live is decided **by the stylesheet** — one `@supports` sets
15
+ `--carousel-native-nav: 1` and the element reads it back — so the condition is written once and
16
+ the two cannot disagree.
17
+
18
+ **Breaking — `.carousel` is now a shell and `.carousel__track` is the scroller** (all formats). The
19
+ hint and the controls need a home outside the scrollport, and absolute positioning against the
20
+ shell replaces `position: fixed` + `anchor-name`/`position-area`, which pinned controls to a
21
+ viewport corner in any engine without anchor positioning. The 5.x single-element form is still
22
+ styled via `:not(:has(> .carousel__track))` and is promoted by the element at runtime, but it is
23
+ deprecated: wrap your slides in `<ul class="carousel__track">`.
24
+
25
+ **Breaking — looping is opt-in.** `<wc-carousel loop>` clones the slides; the default no longer
26
+ does. Cloning triples the markup, duplicates every image element and makes the scrollbar report 3×
27
+ the real content. `autoplay` implies `loop`. Migration: add `loop`.
28
+
29
+ **Breaking — `[part='autoplay']` is now `.carousel__autoplay`** (aliased for one release; `part`
30
+ only crosses a shadow boundary and this element is light DOM, so it was never a part). The button
31
+ is also a child of the shell rather than the track, where it used to occupy a slide-width column.
32
+
33
+ **Breaking — the host role is `group`, not `region`.** `region` is a landmark, so every carousel
34
+ grew an entry in the landmark list. Pass `landmark` to `<Carousel />` where it really is one.
35
+
36
+ **Changed (visual)** — the scrollbar is visible by default (`scrollbar-width: thin`, was `none`)
37
+ and a "Scroll for more" hint renders above the strip; both dim once the visitor scrolls, via a
38
+ scroll-progress timeline where available and a `data-scrolled` attribute otherwise. Opt out with
39
+ `.carousel--no-scrollbar` and `hint={false}`. `@getvitops/core`'s `global.css` also gains a narrow
40
+ media reset (`max-inline-size: 100%` on replaced elements, `block-size: auto` on `img`/`video`) —
41
+ deliberately without `display: block`, which would change inline images in prose.
42
+
43
+ **Added** — `@getvitops/astro/components/Carousel.astro`, a tier-3 wrapper emitting semantic
44
+ `<ul>`/`<li>`/`<figure>` markup with the right per-slide image priorities: the first slide eager
45
+ and high (the LCP candidate), the rest `lazy`/`low`/`async`. `loading="lazy"` is honoured for
46
+ images clipped by a horizontal scroll container, so off-screen slides defer with no JavaScript at
47
+ all. Also new: `carousel--markers-below` and `carousel--no-scrollbar`, and
48
+ `--carousel-slide-aspect`, which keeps slide heights equal whatever each image's aspect ratio is.
49
+
50
+ **Fixed** — `::scroll-button()` glyphs sat off-centre in their circles (`global.css`'s `*` reset
51
+ does not reach a pseudo-element, so the button was `content-box` with the UA's `padding: 1px 6px`
52
+ and `inline-size` + `aspect-ratio` sized an ellipse); the hover state was a no-op (it set the same
53
+ token as the base rule); slide heights varied with each image's aspect ratio; navigation used
54
+ physical `left`/`right` and so put "previous" on the wrong side in RTL; cloned slides duplicated
55
+ their `id`s; and `scrollBy(clientWidth)` overshot whenever `--carousel-slide-size` was not `100%`.
56
+
57
+ ### Patch Changes
58
+
59
+ - @getvitops/utils@6.0.0
60
+
61
+ ## 5.0.0
62
+
63
+ ### Major Changes
64
+
65
+ - **Dangling token references are now a build failure.** `validate()` resolves every `var(--…)` a
66
+ config authors — in `patterns.defaults` / `radii` / `groups` / `items.*.{base,overrides,states}`,
67
+ `typography.roles` and `shadows` — against the tokens that config actually emits. A reference to a
68
+ token that does not exist used to validate, generate, minify and ship, then resolve to nothing in
69
+ the browser: one downstream config shipped a `.cta` whose `color` fell back to `inherit` on a brand
70
+ fill (unreadable text on every filled button), and two of its four dead references had been dead for
71
+ several releases with nothing ever reporting them.
72
+
73
+ The check is deliberately anchored to the namespaces the generator owns — `--color-*`, `--shadow-*`,
74
+ `--z-tier-*`, `--surface-glass`, `--overlay` — the same discipline `vitops lint` follows. A pattern
75
+ may legitimately reference a framework token from `@getvitops/core` or a hook of your own, and
76
+ enumerating "every valid token" would make those false positives. A reference carrying a fallback
77
+ (`var(--x, 0.25rem)`) is never flagged: that is you saying what happens when the token is absent.
78
+ Errors name the config path and suggest the nearest token that does exist.
79
+
80
+ Two related diagnostics ship with it:
81
+ - **Pre-1.0 colour-grammar references are reported as one rename table**, not as a dozen separate
82
+ "no such token" errors — the shape the 3.0 flat-config detector uses, applied to the 1.0 colour
83
+ change. It is built from your own role names, and it says to apply the renames _simultaneously_,
84
+ because several of them rotate (`--surface-bg` → `--color-bg-surface-muted`,
85
+ `--surface-bg-bold` → `--color-bg-surface`) and sequential replacement compounds them.
86
+ - **A surface-shaped role declared chromatic now warns.** A bare hue string is shorthand for
87
+ `kind: "chromatic"`, which emits no bare `--color-bg-<role>` and no `.bg-<role>` — so writing
88
+ `"surface": "ink"` silently removed `--color-bg-surface` and the 36 references the framework's own
89
+ CSS makes to it. Relatedly, `--surface-glass`, `--overlay` and `.glass` are no longer emitted when
90
+ `surface` is chromatic: they read `--color-bg-surface`, so emitting them pointed at nothing.
91
+
92
+ **`vitops lint --fix` is now the migration tool.** It reads `var(--…)` out of CSS and `<style>`
93
+ blocks (not just `class` attributes) and rewrites pre-1.0 token references in a **single pass**, so
94
+ the rotating renames cannot compound. Nothing else is rewritten — every other finding it reports is
95
+ a judgement call. Run it after a major bump.
96
+
97
+ **`--help` works on every subcommand.** `vitops lint --help` used to exit non-zero with
98
+ `Unknown option '--help'`; every leaf subcommand parsed its own argv strictly and none declared the
99
+ option. It is now answered before dispatch, so no command can forget it, and a drift guard fails the
100
+ build if a command has no documented options. (`validate`'s options were genuinely undocumented and
101
+ now are.)
102
+
103
+ **The Astro integration reads `site.tracking` and `site.legal.cookieConsent`.** These drive the
104
+ generated cookie notice, while `vitops({ consent, tracking })` drove the runtime — two hand-synced
105
+ declarations of the same fact with nothing comparing them, so a site could ship a notice naming
106
+ categories its banner never offered, or disclosing an `_ac` cookie no capture script ever wrote, and
107
+ the build was clean. The config blocks are now defaults (as `css` / `fonts` / `favicon` / `ads`
108
+ already were) and a genuine contradiction — `true` against `false` on the same fact — **fails the
109
+ build**, naming both sides. An absent option is not a contradiction; it just takes the config's
110
+ value.
111
+
112
+ Also fixed, each from a downstream report:
113
+ - **`@getvitops/astro/tracking`** re-exports `@getvitops/utils/tracking` (plus `TRACKING_ENDPOINT`),
114
+ so the documented conversion flow works with one install. Under strict pnpm app code cannot
115
+ resolve a transitive dependency, and the obvious workaround — importing the same symbols from the
116
+ package index — is the one that drags the integration's Node builtins toward a Worker bundle. This
117
+ entry and `./routes` are both clean.
118
+ - **`createConversionRoute`'s example was broken on every supported Astro.** It read the binding off
119
+ `locals.runtime.env`, removed in Astro v6, while the package peers on `>= 7` — and because the
120
+ throw precedes the response, Astro re-reads the request and reports a misleading "Body has already
121
+ been used". It also called a `toNotifyContext()` helper that does not exist. The example now uses
122
+ `import { env } from 'cloudflare:workers'` and a plain `NotifyContext`.
123
+ - **`/api/track` is exported as `TRACKING_ENDPOINT`**, and the integration warns at build when
124
+ tracking is on and no route answers it. It was a bare literal inside the inlined capture script:
125
+ name the route file anything else and every `tel:` beacon 404s, conversions vanish, and nothing
126
+ errors anywhere.
127
+ - **`describeEvent` no longer reports "from Unknown"** for forms that don't have a field literally
128
+ named `name`. It now falls back through `first_name`/`last_name`, `full_name`, and finally the
129
+ email address.
130
+ - **`sendEmail` takes `timeoutMs` (default 10s).** `binding.send()` had no deadline, so one hung
131
+ attempt hung the request that produced it — indefinitely, in the one module otherwise built on
132
+ always saying why. A timeout is retried, like any other transient failure.
133
+ - **`vitops search notify` warns when the sitemap's URLs aren't on the configured origin.** A 404
134
+ fails loudly; a well-formed sitemap belonging to someone else did not — a route collision served a
135
+ valid document listing another site's pages and the run reported a healthy submission. Surfaces at
136
+ `--dry`.
137
+ - **`require()` warns when the page has no `<wc-consent>`.** The demand can never be granted, so
138
+ whatever waited on it never runs — silently. Hit by rendering `<Tracking />` on pages where
139
+ `<CookieConsent />` wasn't.
140
+ - **`vitops agents` no longer writes a path it guessed.** It used to warn and then write "tokens
141
+ live in `design-system.json`" into a project whose tokens are in `company.json`, with the four
142
+ emitted `vitops generate` commands hard-coded to match — copy-paste-broken in exactly the projects
143
+ that most need the block to be right. It now finds the config by shape, interpolates the resolved
144
+ path into every emitted command, and fails rather than guessing when there is nothing to name.
145
+ - **`vitops search setup --dry` and `vitops ads setup --dry` run without credentials.** A dry run
146
+ that mutates nothing should not demand the token to mutate; with none set it plans from scratch
147
+ and says so. (`--check` still needs them — drift is a comparison against live state.) Both now
148
+ also mention that the Cloudflare token needs `Zone:Read` alongside `Zone:DNS:Edit` — the
149
+ zone-by-name lookup uses it, and its absence read as "the zone isn't in this account".
150
+ - **`vitops legal` names the files it wrote and flags new ones.** Enabling `cookieConsent` silently
151
+ produced a `cookie-notice` document that then needs a page, a route, a link and a `policyUrl`; the
152
+ command said only "3 files". The review reminder is also printed on the stdout path, where it was
153
+ missing entirely.
154
+ - **`vitops init` writes a versioned `$schema`** — `./node_modules/@getvitops/generator/schema.json`,
155
+ following wrangler — instead of an unpinned unpkg URL that resolved to whatever was newest, so an
156
+ editor validated a pinned project against a schema it wasn't built with.
157
+ - **`favicon.backgroundColor` and `favicon.name` are described accurately.** `backgroundColor` is
158
+ not manifest-only: it fills the opaque `apple-touch-icon.png` and `icon-mask.png`, which are
159
+ written whether or not a manifest is. `name` documents that it and `themeColor` **together** are
160
+ what make a site installable. The missing-background warning now also fires for a dark opaque mark,
161
+ not only a transparent source — `apple-touch-icon` insets the logo and fills the surround either
162
+ way.
163
+
164
+ - **The framework now says out loud which patterns are foundational, and reports it when you
165
+ reach past them.** From repeated downstream reports: sites were inventing a `.wrap` class and
166
+ using it everywhere instead of `.centered`, and `.subgrid` — the class for any set of cards —
167
+ was going essentially unused. Neither failure is visible in a build: every class involved is
168
+ real, nothing errors, and the page renders.
169
+
170
+ **`.subgrid` was missing from the generated class reference entirely.** So was `.cluster`, and
171
+ so was `.region`. `vitops docs classes` is the doc an agent is told to fetch for "which class
172
+ do I apply", and the framework's answer for a set of cards was not in it — which is most of why
173
+ it never got used. All three are now documented, along with `grid-auto`, and the reference opens
174
+ with a **Foundations** section that states the six substitutions as
175
+ _temptation → what to write instead_ rather than as a vocabulary list. The same table is now in
176
+ the shipped agent skill and in the `@getvitops/create` template's `AGENTS.md`, because a pointer
177
+ to a doc only helps someone who already suspects there is something to look up. (`css`/`bricks`
178
+ and `tailwind` alike — this is documentation and the `TIERS` manifest, not emitted CSS.)
179
+
180
+ **`vitops lint` gained three reuse rules and a markup pass.** The existing `.centered` rule only
181
+ fired when the hand-written CSS already referenced `--width-measure`, which is precisely the
182
+ author who was never going to hand-roll a container. It now also catches a page-scale
183
+ `max-width` (≥ 48rem, or a `ch` reading measure) with auto margins, and a
184
+ container-shaped class name — `wrap`, `wrapper`, `container`, `inner`, `shell`, … — carrying any
185
+ width cap at all. Reading the cap out of `min()` / `clamp()` too. New rules report a
186
+ hand-written `repeat()` grid as `.subgrid` (or `.grid-auto`), and a new **markup** pass reports a
187
+ repeated card set laid out without either — a loop that renders a card, or three or more cards
188
+ written out. That last one is the only check that can see this drift at all, since a card list
189
+ built from utility classes contains no bad class and no hand-written CSS.
190
+
191
+ All of these are `suggestion` severity, so they do not fail your build unless you pass
192
+ `--strict`. They found five real instances in this repo's own docs site.
193
+
194
+ **`vitops lint [files...]`** now takes explicit paths instead of scanning `--src`, so it can be
195
+ wired into a pre-commit hook — `vp`'s `staged` key appends the staged files to whatever it runs,
196
+ and a command that refused positionals could not be put in the one place the feedback lands at
197
+ the moment the code is written. Unreadable and non-source paths are skipped rather than fatal. The
198
+ `@getvitops/create` emdash template wires it up with `--strict` and adds a `lint:design` script.
199
+
200
+ **Two answers for "the whole card is a link", because one cannot exist.** Reported downstream:
201
+ agents dislike the `<li>` wrapper when a card is a link and write `<li><a class="card">` instead.
202
+ That shape is **wrong in a way that renders fine**, which is why it survives review — the `<li>`
203
+ is the grid item, so the anchor is an ordinary block inside it and the tranches within the anchor
204
+ never reach the parent's shared row lines. The alignment `.subgrid` exists for silently does not
205
+ happen, and the anchor does not fill the cell either. Putting the anchor in the grid's place
206
+ (`<ul><a></ul>`) is invalid HTML, so there was genuinely no correct shape to reach for.
207
+
208
+ There are now two, and they trade against each other because **no CSS-only technique can make a
209
+ whole card clickable and leave its text selectable** — a transparent overlay necessarily receives
210
+ the pointer-drag:
211
+
212
+ | Want | Use |
213
+ | ---------------------------------------- | ------------------------------------------- |
214
+ | zero JS, whole card clickable | `.stretched-link` — **text not selectable** |
215
+ | selectable text **and** a clickable card | `<Cards>` / `<wc-cards>` — needs JS |
216
+
217
+ `.stretched-link` goes on a link inside the card; its `::after` covers the card.
218
+ **`<wc-cards>` is a new tier-2 element** that adds no overlay and instead tells a click apart from
219
+ the end of a drag, so text selection survives. Its fallback is the card's own link, fully usable
220
+ with no JS, and the pointer cursor is applied by the element — so the affordance never appears
221
+ without the behaviour. `<Cards>` emits it for you. They are alternatives, never layered: with an
222
+ overlay present the JS has nothing to do, and `vitops lint` reports the combination. (All formats
223
+ — pattern partials, deliberately not `utilities.css`, which the tailwind format skips on the
224
+ invariant that everything left in it is a name Tailwind ships itself.)
225
+
226
+ ### Breaking
227
+ - **`<Subgrid />` renders its slot verbatim — author the `<li>` items yourself.**
228
+
229
+ ```diff
230
+ <Subgrid>
231
+ - <article class="card">…</article>
232
+ + <li class="card subgrid-card">…</li>
233
+ </Subgrid>
234
+ ```
235
+
236
+ It used to parse the slotted HTML and rebuild each child as an `<li>`, carrying over only
237
+ `class` and `style`. That existed solely because a `<ul>` may contain nothing else, and it cost
238
+ more than it bought: the child's tag was discarded, `id`/`data-*`/`aria-*` were silently
239
+ dropped, and `href` could not survive at all. Nothing is copied now, so nothing is lost. `as`
240
+ picks the container (`ul` by default, `ol`, `div`), and all other props are forwarded — they
241
+ were previously discarded, including `role`.
242
+
243
+ - **`<Subgrid />` and `<Tree />` now emit `role="list"`,** as does the Bricks `sitenav` element.
244
+ `list-style: none` stops Safari + VoiceOver announcing a `<ul>` as a list, so every marker-less
245
+ framework list was silently losing the semantics its `<ul>` was chosen for. If you hand-write
246
+ `.subgrid`, `.list`, `.facet-list`, `.nav-items`, `.collapse-menu` or `.tree` markup, add
247
+ `role="list"` yourself — the framework cannot add it to markup it does not render, and each
248
+ partial now says so at the `list-style` reset.
249
+ - **`<Cards />` no longer adds `class="card"` to slotted children,** because it no longer parses
250
+ them. Write the class on the item. It now emits `<wc-cards>` around a `<Subgrid>`, which is what
251
+ makes the whole card clickable — and like `<Tree />`, **it emits its own element, so do not wrap
252
+ it in `<wc-cards>` yourself.** It also previously passed a `role="list"` that `<Subgrid>` silently
253
+ discarded, so that never took effect.
254
+ - **`.subgrid-card` now sets `position: relative`**, so `stretched-link` inside it needs no extra
255
+ class. If you were absolutely positioning a descendant of a `.subgrid-card` against an ancestor
256
+ _outside_ that card, it will now resolve against the card. Move the positioning context
257
+ explicitly. (`css`/`bricks`/`tailwind` — the pattern partial is inlined into all three.) Not
258
+ reachable by `vitops lint --fix`: the fix depends on which ancestor you meant, which the
259
+ linter cannot know.
260
+
261
+ ### Fixed
262
+ - **`packages/generator/src/docs.ts` contained a literal NUL byte** (`CODE_SLOT`, written as the
263
+ raw character rather than an escape). libmagic classified the file as `data` rather than text, so
264
+ grep and ripgrep treated the largest doc emitter in the repo as **binary and silently skipped
265
+ it** — every search for a string in it returned nothing, with no error. It is now written as the `\u0000` escape.
266
+ Behaviour is identical; the file is searchable.
267
+ - **`.grid-auto` is documented.** It was a real framework class for auto-fit card grids with no
268
+ entry in the class reference, so the honest alternative to `subgrid` was as invisible as
269
+ `subgrid` itself.
270
+ - **`.raised` replaces the advice to use `.relative` above a `stretched-link` overlay**, which
271
+ could not work: a positioned element at `z-index: auto` does not rise above an explicit
272
+ `z-index` regardless of DOM order, so a second link or button in the card stayed underneath and
273
+ unclickable. `.raised` sets both, against the same `--z-tier-raised` token the overlay now uses
274
+ instead of a hard-coded `1`.
275
+
276
+ ### Patch Changes
277
+
278
+ - Updated dependencies
279
+ - @getvitops/utils@5.0.0
280
+
3
281
  ## 4.1.0
4
282
 
5
283
  ### Patch Changes
package/css/global.css CHANGED
@@ -26,6 +26,30 @@
26
26
  box-sizing: border-box;
27
27
  }
28
28
 
29
+ /* Media never overflows its container. `:where()` so it carries zero specificity
30
+ and this file's layer (`vitops.base`) so it loses to everything, including a
31
+ consumer's unlayered rule.
32
+
33
+ Deliberately NOT the classic `img { display: block }` half of this reset. That
34
+ is the part that breaks things here: inline images in prose lose baseline
35
+ alignment, `patterns/icon.css`'s `.icon > img` and marquee logo runs break onto
36
+ their own lines, and `layout.css`'s
37
+ `.rhythm > :where(p, h1…h6, ul, ol) + :where(figure, img, picture, video)`
38
+ rules start spacing images that were previously inline. Every framework pattern
39
+ that wants a block image already declares it (media.css, subgrid.css,
40
+ carousel.css), which is the right place for it.
41
+
42
+ `svg` is excluded from `block-size: auto` because `patterns/svg.css` ships a
43
+ bare `svg` rule and SVGs commonly size from presentation attributes;
44
+ `max-inline-size` alone is safe there. */
45
+ :where(img, svg, video, canvas, iframe, embed, object) {
46
+ max-inline-size: 100%;
47
+ }
48
+
49
+ :where(img, video) {
50
+ block-size: auto;
51
+ }
52
+
29
53
  /* Drop the UA's 8px body margin. The framework owns page gutters via `.centered`
30
54
  (--gutter), so the UA default just offsets every full-bleed surface — sticky
31
55
  headers and `bg-*` bands end up inset by 8px with a sliver of canvas showing
package/css/index.css CHANGED
@@ -16,6 +16,9 @@
16
16
  @import './patterns/cluster.css';
17
17
  @import './patterns/grouped.css';
18
18
  @import './patterns/subgrid.css';
19
+ /* After subgrid: `.subgrid-card` is the usual card and this sets the `<wc-cards>`
20
+ host plus the upgraded-card affordance. */
21
+ @import './patterns/card.css';
19
22
  @import './patterns/masonry.css';
20
23
  @import './patterns/media.css';
21
24
  @import './patterns/separator.css';
@@ -100,3 +100,70 @@ a[target='_blank'].link--external::after {
100
100
  color: var(--color-text-surface);
101
101
  border-radius: var(--br-control, 0.375rem);
102
102
  }
103
+
104
+ /* ── stretched-link — the whole card is a link ──
105
+ One link inside a container covers it, so the entire card is clickable while the
106
+ accessible name stays on real text. `.subgrid-card` already carries the
107
+ `position: relative` this resolves against; on a bare `.card`, add `relative`.
108
+
109
+ <li class="card subgrid-card">
110
+ <p class="font-eyebrow">Service</p>
111
+ <p class="font-heading"><a class="link stretched-link" href="/x">Title</a></p>
112
+ <p>Blurb…</p>
113
+ </li>
114
+
115
+ WHY THIS RATHER THAN MAKING THE ANCHOR THE CARD. `<li><a class="card">` is the
116
+ shape that gets reached for, and it is wrong in a way that renders fine: the LI is
117
+ the grid item, so the anchor is an ordinary block inside it — its tranches never
118
+ land on the parent's shared row lines, and the alignment `.subgrid` exists for
119
+ silently does not happen. (Nor does an inline anchor fill the cell.) Putting the
120
+ anchor in the grid's place instead means `<ul><a></ul>`, which is invalid.
121
+
122
+ THE COST, AND THE ALTERNATIVE. The overlay receives the pointer-drag over
123
+ everything it covers, so **the card's text can no longer be selected**. That is
124
+ inherent to the technique, not a bug to fix here — any transparent layer over text
125
+ takes the drag. Where selectable text matters, use `<wc-cards>`
126
+ (src/web-components/WCCards.ts) instead: no overlay, and JS tells a click apart
127
+ from the end of a drag. The two are alternatives, never layered — with this
128
+ overlay present, that element has nothing left to do.
129
+
130
+ It lives HERE, in a pattern partial, and not in `utilities.css`: that file is in
131
+ the generator's TAILWIND_SKIP on the stated invariant that everything left in it
132
+ is a TW_CLASH name Tailwind ships itself. `stretched-link` is ours, so putting it
133
+ there would emit it in css/bricks and silently not in tailwind — the exact
134
+ cross-format hole `format-parity.test.ts` exists to catch.
135
+
136
+ Another interactive element inside the same card must sit above the overlay: give
137
+ it `.raised`, NOT `.relative`. A positioned element at `z-index: auto` does not
138
+ rise above an explicit z-index no matter its DOM order, so `.relative` alone left
139
+ the control underneath and unclickable. ── */
140
+ .stretched-link::after {
141
+ content: '';
142
+ position: absolute;
143
+ /* Covers the nearest positioned ancestor, which is the card. */
144
+ inset: 0;
145
+ /* The shared z-scale rather than a bare 1, so `.raised` can be defined in terms of
146
+ the same token instead of guessing a number that beats it. */
147
+ z-index: var(--z-tier-raised);
148
+ border-radius: inherit;
149
+ }
150
+
151
+ /* ── raised — lift content above a `.stretched-link` overlay ──
152
+ For the second link, the button, or the text you want selectable inside a card
153
+ whose whole area is otherwise clickable.
154
+
155
+ It carries `position: relative` AND a z-index, and both are required: z-index has
156
+ no effect on a static element, and a positioned element at `z-index: auto` does not
157
+ rise above an explicit z-index regardless of DOM order. That second half is why
158
+ telling people to use `.relative` here did not work.
159
+
160
+ Defined against the same token as the overlay, so the two cannot drift apart the
161
+ way two hand-picked numbers would.
162
+
163
+ Here rather than in `utilities.css` for the reason given above `.stretched-link`:
164
+ that file is in TAILWIND_SKIP on the invariant that everything left in it is a name
165
+ Tailwind ships itself, and Tailwind has no `raised`. ── */
166
+ .raised {
167
+ position: relative;
168
+ z-index: calc(var(--z-tier-raised) + 1);
169
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Card — the `<wc-cards>` host and the marker its enhancement applies.
3
+ *
4
+ * The `.card` pattern itself is CONFIG-GENERATED (`patterns.items.card` in
5
+ * design-system.json), so its border, padding, background and shadow are not here.
6
+ * This partial holds only what the framework owns: the custom element's box, and the
7
+ * affordance for a card the element has taken over.
8
+ */
9
+
10
+ /* ── wc-cards — the whole-card click enhancement (src/web-components/WCCards.ts) ──
11
+ A custom element defaults to `display: inline`, and this one wraps a block
12
+ container — a `<ul class="subgrid">` in the documented shape — so an inline box
13
+ around a block child is exactly the KNOWN GAP recorded in `js/elements.ts`.
14
+
15
+ `block`, matched to the content it wraps, following the one precedent:
16
+ `patterns/tree.css` declares `wc-tree { display: block }` around a
17
+ `<ul class="tree">`. Deliberately NOT `display: contents`, whose support has been
18
+ uneven — the accessibility tree in particular — and this is not a place to depend
19
+ on it.
20
+
21
+ The cost of a real box: where the grid is nested in a parent flex/grid, `wc-cards`
22
+ rather than the `<ul>` becomes the item. Restyle the element in that case; it
23
+ carries no other styling to lose. ── */
24
+ wc-cards {
25
+ display: block;
26
+ }
27
+
28
+ /* ── The card the element has taken over ──
29
+ Written by `WCCards` at upgrade, and only onto cards it found a link in — so the
30
+ pointer cursor cannot appear on a card with nothing to click, and cannot appear at
31
+ all when `elements.js` never loads. That is the point of stamping it from JS
32
+ rather than authoring it: the affordance and the behaviour arrive together. ── */
33
+ [data-card-link] {
34
+ cursor: pointer;
35
+ }