@brignano/design 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DECISIONS.md +6 -1
- package/DESIGN.md +24 -1
- package/package.json +1 -1
- package/tailwind.css +1 -0
- package/tokens.css +5 -0
package/DECISIONS.md
CHANGED
|
@@ -299,7 +299,12 @@ other theme.
|
|
|
299
299
|
needs a colour resolves it through `getComputedStyle` on an element
|
|
300
300
|
(DESIGN.md §11). ADR-0002's advice that `chart-colors.ts` read the custom
|
|
301
301
|
properties still stands, but by that route.
|
|
302
|
-
- Consumers shouldn't wrap tokens in `color-mix()`; washes are tokens.
|
|
302
|
+
- Consumers shouldn't wrap tokens in `color-mix()`; washes are tokens. The
|
|
303
|
+
first consumer that needed one (`life`'s sticky bars) got `--surface-sticky`
|
|
304
|
+
in 0.3.1 rather than a local mix.
|
|
305
|
+
- A build that lowers `light-dark()` for older browsers (Lightning CSS, inside
|
|
306
|
+
Next.js and Vite) fixes the theme at `:root`, losing scoped theming. Found in
|
|
307
|
+
`brignano.io`; consumers set `browserslist` to the floor (DESIGN.md §11).
|
|
303
308
|
- Not a token rename and not a visual change, so a patch release.
|
|
304
309
|
|
|
305
310
|
|
package/DESIGN.md
CHANGED
|
@@ -135,6 +135,10 @@ for cards, `--radius-lg` for hero surfaces.
|
|
|
135
135
|
a shadow (`--shadow-1/2/3`). Dark mode does not use borders — surfaces get
|
|
136
136
|
*lighter* with elevation. This is why `--line` can stay nearly invisible in dark.
|
|
137
137
|
|
|
138
|
+
**Sticky chrome** — a header or toolbar that content scrolls under — is
|
|
139
|
+
`--surface-sticky` with `backdrop-filter: blur(8px)`: 92% of the card in light,
|
|
140
|
+
of the page ground in dark, so it reads as the surface it sits on, not a new layer.
|
|
141
|
+
|
|
138
142
|
## 7. Motion
|
|
139
143
|
|
|
140
144
|
**Content is visible by default. Motion is progressive enhancement layered on top
|
|
@@ -241,11 +245,30 @@ Two consequences for code that touches tokens directly:
|
|
|
241
245
|
Re-read it when the theme changes.
|
|
242
246
|
- **Don't wrap a token in `color-mix()` or `light-dark()`.** Nesting is valid CSS,
|
|
243
247
|
but not every engine has been verified to resolve it. If you need a wash, it's
|
|
244
|
-
a token (`--*-surface`, `--*-line`); if it isn't, add it here.
|
|
248
|
+
a token (`--*-surface`, `--*-line`, `--surface-sticky`); if it isn't, add it here.
|
|
245
249
|
|
|
246
250
|
Needs Chrome/Edge 123, Firefox 120, Safari 17.5 or later (all shipped by May 2024).
|
|
247
251
|
An older browser drops every colour token and renders unstyled rather than wrong.
|
|
248
252
|
|
|
253
|
+
### Build tools that lower `light-dark()`
|
|
254
|
+
|
|
255
|
+
A CSS pipeline that targets browsers older than that floor rewrites
|
|
256
|
+
`light-dark()` into a fallback. Lightning CSS (inside Next.js, Vite, Parcel)
|
|
257
|
+
turns each token into `var(--lightningcss-light, …) var(--lightningcss-dark, …)`
|
|
258
|
+
and flips those two variables wherever `color-scheme` changes. The tokens
|
|
259
|
+
resolve on `:root`, so the side is fixed there. Page-wide theming still works,
|
|
260
|
+
but **`data-theme` on an inner element stops re-theming that section.**
|
|
261
|
+
|
|
262
|
+
The fix is to target the same floor the tokens need, which leaves `light-dark()`
|
|
263
|
+
alone. In the consumer's `package.json`:
|
|
264
|
+
|
|
265
|
+
```json
|
|
266
|
+
"browserslist": ["chrome >= 123", "edge >= 123", "firefox >= 120", "safari >= 17.5"]
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
Verified with Lightning CSS: older targets lower the tokens; these targets
|
|
270
|
+
pass `light-dark(#076bd3, #6ba5f3)` through untouched.
|
|
271
|
+
|
|
249
272
|
### Tailwind
|
|
250
273
|
|
|
251
274
|
Tailwind's dark variant keys off a `.dark` class; these tokens key off
|
package/package.json
CHANGED
package/tailwind.css
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
--color-line-control: var(--line-control);
|
|
24
24
|
--color-surface-hover: var(--surface-hover);
|
|
25
25
|
--color-surface-active: var(--surface-active);
|
|
26
|
+
--color-surface-sticky: var(--surface-sticky);
|
|
26
27
|
--color-on-dark: var(--on-dark);
|
|
27
28
|
|
|
28
29
|
--color-interactive: var(--i);
|
package/tokens.css
CHANGED
|
@@ -119,6 +119,11 @@
|
|
|
119
119
|
--card: light-dark(#ffffff, #17171a); /* n-0 / n-50 */
|
|
120
120
|
--surface-hover: var(--n-100);
|
|
121
121
|
--surface-active: var(--n-200);
|
|
122
|
+
/* Sticky chrome — a header or toolbar that content scrolls under, usually
|
|
123
|
+
with `backdrop-filter: blur()`. 92% of the surface it sits on: the card
|
|
124
|
+
in light, the page ground in dark, where cards are lighter than the
|
|
125
|
+
page. A token so consumers never color-mix() one (DESIGN.md §11). */
|
|
126
|
+
--surface-sticky: light-dark(color-mix(in srgb, #ffffff 92%, transparent), color-mix(in srgb, #0d0d0f 92%, transparent)); /* card / bg */
|
|
122
127
|
--ink: var(--n-900);
|
|
123
128
|
--ink-soft: var(--n-700);
|
|
124
129
|
--slate: light-dark(#6b6b73, #8b8b93); /* n-600 / n-500 — text-safe: eyebrows, axis labels, captions */
|