@tenphi/cookbook 0.31.2 → 0.31.3
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="https://raw.githubusercontent.com/tenphi/tasty/v3.
|
|
2
|
+
<img src="https://raw.githubusercontent.com/tenphi/tasty/v3.17.0/assets/tasty.svg" width="128" height="128" alt="Tasty logo" />
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<h1 align="center">Tasty</h1>
|
|
@@ -548,7 +548,7 @@ Covered in [Types and Linting](#eslint-and-oxlint): 40+ rules for ESLint 9+ and
|
|
|
548
548
|
[Tasty for VS Code](https://github.com/tenphi/tasty-vscode-extension) highlights color tokens, units, state keys, presets, and style properties inside `tasty()`, `tastyStatic()`, `styles` objects, and style functions, and adds snippets for components, state maps, and `configure()`. Install the `.vsix` from the [latest release](https://github.com/tenphi/tasty-vscode-extension/releases/latest).
|
|
549
549
|
|
|
550
550
|
<p align="center">
|
|
551
|
-
<img src="https://raw.githubusercontent.com/tenphi/tasty/v3.
|
|
551
|
+
<img src="https://raw.githubusercontent.com/tenphi/tasty/v3.17.0/assets/tasty-vscode-highlight.png" width="512" alt="Tasty VS Code syntax highlighting example" />
|
|
552
552
|
</p>
|
|
553
553
|
|
|
554
554
|
### Glaze
|
|
@@ -135,7 +135,7 @@ Directional modifiers beat placeholder zeros:
|
|
|
135
135
|
- ❌ `padding: '2x 4x top right'` — a directional group takes one value, so `4x` is dropped → ✅ `padding: '2x top, 4x right'`
|
|
136
136
|
- ❌ `fade: '3x 1x top bottom'` → ✅ `fade: '3x top, 1x bottom'`
|
|
137
137
|
|
|
138
|
-
Value-only properties reject both colors and modifiers: `gap`, `columnGap`, `rowGap`, `opacity`, `zIndex`, `order`, `flexGrow`, `flexShrink`, `flexBasis`, `aspectRatio`, `lineClamp`, and `tabSize`. Logical axis category styles accept one or two values in start/end order and the `start`, `end`, and `longhand` modifiers. `fill`, `color`, `caretColor`, and `accentColor` take a color only (use `#clear` for transparent). An overlay is a compound color, in any color slot: ❌ `fill: '#surface #dark.04'` (deprecated overlay layer) · ❌ `fill: '#dark.04, #surface'` (half-transparent mix) → ✅ `fill: '#surface+#dark.04'`. Write it as one word, with no spaces around `+`. Every layer after the first needs an opacity suffix, and its token must be opaque: a translucent layer token, or one that is `#clear` in some state, leaves the result see-through, so vary the suffix (`#surface+#dark.$hover`) or the whole compound per state instead. `fill`
|
|
138
|
+
Value-only properties reject both colors and modifiers: `gap`, `columnGap`, `rowGap`, `opacity`, `zIndex`, `order`, `flexGrow`, `flexShrink`, `flexBasis`, `aspectRatio`, `lineClamp`, and `tabSize`. Logical axis category styles accept one or two values in start/end order and the `start`, `end`, and `longhand` modifiers. `fill`, `color`, `caretColor`, and `accentColor` take a color only (use `#clear` for transparent). An overlay is a compound color, in any color slot: ❌ `fill: '#surface #dark.04'` (deprecated overlay layer) · ❌ `fill: '#dark.04, #surface'` (half-transparent mix) → ✅ `fill: '#surface+#dark.04'`. Write it as one word, with no spaces around `+`. Every layer after the first needs an opacity suffix, and its token must be opaque: a translucent layer token, or one that is `#clear` in some state, leaves the result see-through, so vary the suffix (`#surface+#dark.$hover`) or the whole compound per state instead. A comma mix in `fill` is deprecated too: ❌ `fill: '#dark 4%, #surface'` → ✅ `fill: '#surface+#dark.04'`. For any other mix, write `color-mix()` itself: ✅ `fill: 'color-mix(in srgb, #dark $weight, #surface)'`.
|
|
139
139
|
|
|
140
140
|
### `transition`
|
|
141
141
|
|
|
@@ -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).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tenphi/cookbook",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.3",
|
|
4
4
|
"description": "Repository-native static documentation for Astro",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"author": "Andrey Yamanov",
|
|
69
69
|
"license": "MIT",
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@tenphi/docs": "0.31.
|
|
72
|
-
"@tenphi/renderer": "0.31.
|
|
71
|
+
"@tenphi/docs": "0.31.3",
|
|
72
|
+
"@tenphi/renderer": "0.31.3"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"astro": "^7.3.2"
|