@tenphi/tasty 3.14.0 → 3.15.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.
Files changed (50) hide show
  1. package/dist/{babel-types-docs8f4c.d.ts → babel-types-Cq4OMhXa.d.ts} +2 -2
  2. package/dist/chunks/{build-config-DmSCYjYl.js → build-config-mdijGIGa.js} +5 -5
  3. package/dist/chunks/{build-config-DmSCYjYl.js.map → build-config-mdijGIGa.js.map} +1 -1
  4. package/dist/chunks/{collector-8w5r-xFl.js → collector-B4cuf4Ne.js} +4 -4
  5. package/dist/chunks/{collector-8w5r-xFl.js.map → collector-B4cuf4Ne.js.map} +1 -1
  6. package/dist/chunks/{config-engine-DjRv6Axa.js → config-engine-BlZE_Nop.js} +4 -4
  7. package/dist/chunks/{config-engine-DjRv6Axa.js.map → config-engine-BlZE_Nop.js.map} +1 -1
  8. package/dist/chunks/{css-definitions-_UidGa56.js → css-definitions-38rLam_O.js} +3 -3
  9. package/dist/chunks/{css-definitions-_UidGa56.js.map → css-definitions-38rLam_O.js.map} +1 -1
  10. package/dist/chunks/{debug-DjK_ggek.js → debug-B4d71eRy.js} +4 -4
  11. package/dist/chunks/{debug-DjK_ggek.js.map → debug-B4d71eRy.js.map} +1 -1
  12. package/dist/chunks/{dsl-rgu6XQcD.js → dsl-dFfTOacf.js} +2 -2
  13. package/dist/chunks/{dsl-rgu6XQcD.js.map → dsl-dFfTOacf.js.map} +1 -1
  14. package/dist/chunks/{react-runtime-DMLdIO3J.js → react-runtime-CZeqWqBJ.js} +5 -5
  15. package/dist/chunks/{react-runtime-DMLdIO3J.js.map → react-runtime-CZeqWqBJ.js.map} +1 -1
  16. package/dist/chunks/{runtime-engine-CGO46QGS.js → runtime-engine-DZYyyrhB.js} +6 -6
  17. package/dist/chunks/{runtime-engine-CGO46QGS.js.map → runtime-engine-DZYyyrhB.js.map} +1 -1
  18. package/dist/chunks/{runtime-state-C8MzPjBR.js → runtime-state-B8fkpfgp.js} +2 -2
  19. package/dist/chunks/{runtime-state-C8MzPjBR.js.map → runtime-state-B8fkpfgp.js.map} +1 -1
  20. package/dist/chunks/{style-engine-DoGrZPBB.js → style-engine-BB3Ruaa4.js} +25 -7
  21. package/dist/chunks/style-engine-BB3Ruaa4.js.map +1 -0
  22. package/dist/chunks/{zero-engine-CiVidroC.js → zero-engine-BLELcyfS.js} +5 -5
  23. package/dist/chunks/{zero-engine-CiVidroC.js.map → zero-engine-BLELcyfS.js.map} +1 -1
  24. package/dist/{collector-CTU-nl0g.d.ts → collector-sOn_LJks.d.ts} +2 -2
  25. package/dist/{config-DDY7NlZ1.d.ts → config-bnwIG-_F.d.ts} +2 -2
  26. package/dist/core/index.d.ts +4 -4
  27. package/dist/core/index.js +7 -7
  28. package/dist/{index-BR0HTOim.d.ts → index-B-ufiyqs.d.ts} +5 -5
  29. package/dist/index.d.ts +4 -4
  30. package/dist/index.js +8 -8
  31. package/dist/{merge-styles-DSkVc6CD.d.ts → merge-styles-CLE6OMiV.d.ts} +2 -2
  32. package/dist/ssr/astro.js +2 -2
  33. package/dist/ssr/index.d.ts +1 -1
  34. package/dist/ssr/index.js +2 -2
  35. package/dist/ssr/next-config.d.ts +1 -1
  36. package/dist/ssr/next-config.js +3 -3
  37. package/dist/ssr/next.d.ts +1 -1
  38. package/dist/ssr/next.js +3 -3
  39. package/dist/static/index.d.ts +2 -2
  40. package/dist/{types-DJEM_BOJ.d.ts → types-DsK6JM1J.d.ts} +3 -2
  41. package/dist/zero/babel.d.ts +1 -1
  42. package/dist/zero/babel.js +4 -4
  43. package/dist/zero/index.d.ts +3 -3
  44. package/dist/zero/index.js +3 -3
  45. package/dist/zero/next.d.ts +1 -1
  46. package/docs/ai-agents.md +1 -1
  47. package/docs/react-api.md +1 -1
  48. package/docs/styles.md +37 -3
  49. package/package.json +3 -3
  50. package/dist/chunks/style-engine-DoGrZPBB.js.map +0 -1
package/docs/styles.md CHANGED
@@ -303,17 +303,51 @@ 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]` or `[base-color] [overlay-color]`
306
+ **Syntax:** `[color]`, or two colors mixed with a comma: `[color] [weight%], [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
- | `"#surface #primary.10"` | Background `#surface` with `#primary.10` overlay (two colors enable smooth transitions between both) |
312
+ | `"#dark 4%, #surface"` | `#dark` mixed into `#surface` at 4% — the color `#dark` at 4% opacity over `#surface` would show |
313
313
  | `"rgb(255 128 0)"` | CSS color value |
314
314
  | `"color-mix(in oklab, #primary 50%, #surface)"` | CSS color function — see [CSS Color Functions](dsl.md#css-color-functions) |
315
315
 
316
- When two colors are provided, the first sets the background color and the second is applied as an overlay gradient layer. This enables independent CSS transitions on each color. With `image` or `backgroundImage` on the same element, the image is layered over the overlay color in one `background-image`.
316
+ #### Mixing two colors
317
+
318
+ A comma between two colors mixes them into one:
319
+
320
+ ```jsx
321
+ fill: '#dark 4%, #surface'
322
+ // → background-color: color-mix(in srgb, var(--dark-color) 4%, var(--surface-color));
323
+ ```
324
+
325
+ 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`:
326
+
327
+ - contrast checkers such as axe-core and Lighthouse can read it;
328
+ - it transitions and animates between states like any other color;
329
+ - an `image` on the same element stays the only `background-image` layer.
330
+
331
+ The weight can come from a token or an expression: `'#dark $hover-weight, #surface'`, `'#dark ($hover * 100%), #surface'`.
332
+
333
+ 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.
334
+
335
+ A mix takes two colors. Any more are ignored, with a development warning.
336
+
337
+ #### Two colors separated by a space (deprecated)
338
+
339
+ `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*.
340
+
341
+ | Before | After |
342
+ |--------|-------|
343
+ | `'#surface #dark.04'` | `'#dark 4%, #surface'` |
344
+ | `'#surface #clear'` | `'#surface'` |
345
+ | `'#surface #accent'` (an opaque overlay) | `'#accent'` |
346
+ | `'#base #overlay'` (a token holding a translucent color) | `'#overlay $overlay-weight, #base'`, with `#overlay` opaque and `$overlay-weight` a percentage |
347
+
348
+ The rewrites are exact when the overlay token is opaque. A state map no longer needs the same two-color shape in every state to transition smoothly: every state is now a plain background color.
349
+
350
+ 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.
317
351
 
318
352
  There is no default fill color, so `fill: true` is ignored with a development warning. Use `false` for no fill.
319
353
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenphi/tasty",
3
- "version": "3.14.0",
3
+ "version": "3.15.0",
4
4
  "description": "A design-system-integrated styling system and DSL for concise, state-aware UI styling",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -233,7 +233,7 @@
233
233
  "name": "core (import *)",
234
234
  "path": "dist/core/index.js",
235
235
  "import": "*",
236
- "limit": "56.29 kB"
236
+ "limit": "57.38 kB"
237
237
  },
238
238
  {
239
239
  "name": "static",
@@ -287,7 +287,7 @@
287
287
  "node:module",
288
288
  "node:path"
289
289
  ],
290
- "limit": "40.18 kB"
290
+ "limit": "41.48 kB"
291
291
  }
292
292
  ],
293
293
  "scripts": {