@tenphi/tasty 3.16.0 → 3.17.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/dist/{babel-types-CCAgO9ZM.d.ts → babel-types-Dc5zghyE.d.ts} +2 -2
- package/dist/chunks/{build-config-BTMXiCMW.js → build-config-D9Iq8QQm.js} +4 -4
- package/dist/chunks/{build-config-BTMXiCMW.js.map → build-config-D9Iq8QQm.js.map} +1 -1
- package/dist/chunks/{collector-Dit2r0Jc.js → collector-Cb8ah2JF.js} +4 -4
- package/dist/chunks/{collector-Dit2r0Jc.js.map → collector-Cb8ah2JF.js.map} +1 -1
- package/dist/chunks/{config-engine-IYvCVLNM.js → config-engine-CMYFZYQh.js} +3 -3
- package/dist/chunks/{config-engine-IYvCVLNM.js.map → config-engine-CMYFZYQh.js.map} +1 -1
- package/dist/chunks/{css-definitions-D6ToG43M.js → css-definitions-B4aWBkH3.js} +2 -2
- package/dist/chunks/{css-definitions-D6ToG43M.js.map → css-definitions-B4aWBkH3.js.map} +1 -1
- package/dist/chunks/{debug-BmIXavn5.js → debug-D2Pu7Xhy.js} +4 -4
- package/dist/chunks/{debug-BmIXavn5.js.map → debug-D2Pu7Xhy.js.map} +1 -1
- package/dist/chunks/{react-runtime-B52DjXFu.js → react-runtime-DHiopXCu.js} +5 -5
- package/dist/chunks/{react-runtime-B52DjXFu.js.map → react-runtime-DHiopXCu.js.map} +1 -1
- package/dist/chunks/{runtime-engine-rlmL8Koo.js → runtime-engine-NGCofNXy.js} +5 -5
- package/dist/chunks/{runtime-engine-rlmL8Koo.js.map → runtime-engine-NGCofNXy.js.map} +1 -1
- package/dist/chunks/{runtime-state-CB3ZPAKl.js → runtime-state-lZjMbvwV.js} +2 -2
- package/dist/chunks/{runtime-state-CB3ZPAKl.js.map → runtime-state-lZjMbvwV.js.map} +1 -1
- package/dist/chunks/{style-engine-Cq7kL3Xh.js → style-engine-DnkV_4Jg.js} +2 -8
- package/dist/chunks/style-engine-DnkV_4Jg.js.map +1 -0
- package/dist/chunks/{zero-engine-B1PkpmG-.js → zero-engine-DcwaCvFs.js} +5 -5
- package/dist/chunks/{zero-engine-B1PkpmG-.js.map → zero-engine-DcwaCvFs.js.map} +1 -1
- package/dist/{collector-C6RV9oQV.d.ts → collector-D2OT6I2G.d.ts} +2 -2
- package/dist/{config-RsgpMdyc.d.ts → config-C4ftFxgI.d.ts} +2 -2
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +6 -6
- package/dist/{index-CDRJqQIM.d.ts → index-DxQNRj50.d.ts} +5 -5
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7 -7
- package/dist/{merge-styles-CkJeO9AJ.d.ts → merge-styles-D39qBtox.d.ts} +2 -2
- package/dist/ssr/astro.js +2 -2
- package/dist/ssr/index.d.ts +1 -1
- package/dist/ssr/index.js +2 -2
- package/dist/ssr/next-config.d.ts +1 -1
- package/dist/ssr/next-config.js +3 -3
- package/dist/ssr/next.d.ts +1 -1
- package/dist/ssr/next.js +3 -3
- package/dist/static/index.d.ts +2 -2
- package/dist/{types-DeVUQ6o-.d.ts → types-CYQIhUg1.d.ts} +2 -2
- package/dist/zero/babel.d.ts +1 -1
- package/dist/zero/babel.js +4 -4
- package/dist/zero/index.d.ts +3 -3
- package/dist/zero/index.js +3 -3
- package/dist/zero/next.d.ts +1 -1
- package/docs/ai-agents.md +1 -1
- package/docs/styles.md +16 -20
- package/package.json +1 -1
- package/dist/chunks/style-engine-Cq7kL3Xh.js.map +0 -1
package/docs/styles.md
CHANGED
|
@@ -303,14 +303,13 @@ Avoid setting physical and logical declarations that resolve to the same edge in
|
|
|
303
303
|
|
|
304
304
|
Background color with design token support. Preferred over `backgroundColor` and `background`.
|
|
305
305
|
|
|
306
|
-
**Syntax:** `[color]
|
|
306
|
+
**Syntax:** `[color]`
|
|
307
307
|
|
|
308
308
|
| Value | Effect |
|
|
309
309
|
|-------|--------|
|
|
310
310
|
| `"#purple"` | Token-based background color |
|
|
311
311
|
| `"#purple.10"` | Token color at 10% opacity |
|
|
312
312
|
| `"#surface+#dark.04"` | `#dark` at 4% opacity over `#surface`, as one color — see [Compound colors](dsl.md#compound-colors) |
|
|
313
|
-
| `"#dark 4%, #surface"` | `#dark` mixed into `#surface` at 4% — the same color, written as `color-mix()` arguments |
|
|
314
313
|
| `"rgb(255 128 0)"` | CSS color value |
|
|
315
314
|
| `"color-mix(in oklab, #primary 50%, #surface)"` | CSS color function — see [CSS Color Functions](dsl.md#css-color-functions) |
|
|
316
315
|
|
|
@@ -325,29 +324,12 @@ fill: { '': '#surface', hovered: '#surface+#dark.04', pressed: '#surface+#dark.0
|
|
|
325
324
|
|
|
326
325
|
The overlay token has to be opaque, with its opacity in the suffix: a translucent
|
|
327
326
|
token, or one that turns `#clear` in some state, leaves the background
|
|
328
|
-
see-through.
|
|
329
|
-
|
|
330
|
-
#### Mixing two colors
|
|
331
|
-
|
|
332
|
-
A comma between two colors mixes them into one:
|
|
333
|
-
|
|
334
|
-
```jsx
|
|
335
|
-
fill: '#dark 4%, #surface'
|
|
336
|
-
// → background-color: color-mix(in srgb, var(--dark-color) 4%, var(--surface-color));
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
The comma-separated parts are the arguments of `color-mix()`, as written, mixed in sRGB: the space browsers composite layers in. When the weighted color is opaque, the mix is exactly what drawing it at that opacity over the other color shows. And because it is one `background-color`:
|
|
327
|
+
see-through. Because the result is one `background-color`:
|
|
340
328
|
|
|
341
329
|
- contrast checkers such as axe-core and Lighthouse can read it;
|
|
342
330
|
- it transitions and animates between states like any other color;
|
|
343
331
|
- an `image` on the same element stays the only `background-image` layer.
|
|
344
332
|
|
|
345
|
-
The weight can come from a token or an expression: `'#dark $hover-weight, #surface'`, `'#dark ($hover * 100%), #surface'`.
|
|
346
|
-
|
|
347
|
-
Give the weight as a percentage, not as an opacity. A color without a percentage takes half the weight, and its own alpha weighs it down again, so the mix comes out see-through: `'#dark.04, #surface'` is 52% opaque, not `#dark` at 4% over `#surface`. In development Tasty warns about a `#name.N` or `#clear` part without a percentage. It can't see into a token, though, so a token holding a translucent color mixes the same way with no warning: keep the token opaque and put its weight in the percentage.
|
|
348
|
-
|
|
349
|
-
A mix takes two colors. Any more are ignored, with a development warning.
|
|
350
|
-
|
|
351
333
|
#### Two colors separated by a space (deprecated)
|
|
352
334
|
|
|
353
335
|
`fill: '#surface #dark.04'` paints the first color as `background-color` and the second as a `linear-gradient()` layer over it, through the `--tasty-second-fill-color` custom property. It still works, with a development warning, and is going away in the next major version: contrast checkers can't see through a `background-image`, so axe-core reports every text node over the layer as *incomplete*.
|
|
@@ -365,6 +347,20 @@ The rewrites are exact when the overlay token is opaque. A state map no longer n
|
|
|
365
347
|
|
|
366
348
|
If an overlay has to stay a translucent token, draw the layer yourself with `fill: '#base', image: 'linear-gradient(#overlay, #overlay)'`. Contrast checkers can't read that either.
|
|
367
349
|
|
|
350
|
+
#### Two colors mixed with a comma (deprecated)
|
|
351
|
+
|
|
352
|
+
`fill: '#dark 4%, #surface'` mixes the two colors in sRGB, as the arguments of `color-mix()`: `color-mix(in srgb, var(--dark-color) 4%, var(--surface-color))`. It still works, with a development warning, and is going away in the next major version. A compound color is the same mix, in every color slot, and `color-mix()` itself covers what a compound can't write. `tasty/prefer-fill-mix` in [`@tenphi/eslint-plugin-tasty`](https://github.com/tenphi/eslint-plugin-tasty) rewrites each mix to the same color.
|
|
353
|
+
|
|
354
|
+
| Before | After |
|
|
355
|
+
|--------|-------|
|
|
356
|
+
| `'#dark 4%, #surface'`, `'#surface, #dark 4%'` | `'#surface+#dark.04'` |
|
|
357
|
+
| `'#accent 10%, #surface+#dark.04'` | `'#surface+#dark.04+#accent.1'` |
|
|
358
|
+
| `'#dark $hover-weight, #surface'` (a percentage) | `'#surface+#dark.$hover-alpha'`, with `$hover-alpha` the opacity as a number — or `'color-mix(in srgb, #dark $hover-weight, #surface)'` |
|
|
359
|
+
| `'#dark, #surface'`, `'rgb(0 0 0) 4%, #surface'`, and any other mix | `'color-mix(in srgb, #dark, #surface)'` — the same parts, in `color-mix()` |
|
|
360
|
+
| `'#dark.04, #surface'` (a translucent part without a percentage) | `'#surface+#dark.04'` |
|
|
361
|
+
|
|
362
|
+
Every rewrite but the last row's is the same color. `'#dark.04, #surface'` mixed a translucent color in by half and came out 52% opaque, so its rewrite paints what it was most likely meant to: `#dark` at 4% over `#surface`.
|
|
363
|
+
|
|
368
364
|
There is no default fill color, so `fill: true` is ignored with a development warning. Use `false` for no fill.
|
|
369
365
|
|
|
370
366
|
**Related deprecated props:** `backgroundColor` (use `fill`), `background` (overrides all background props when set — avoid).
|