@tenphi/tasty 0.0.0-snapshot.27699f6 → 0.0.0-snapshot.27b6708
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/README.md +171 -107
- package/dist/{async-storage-B7_o6FKt.js → async-storage-DKK-wTD4.js} +1 -1
- package/dist/{async-storage-B7_o6FKt.js.map → async-storage-DKK-wTD4.js.map} +1 -1
- package/dist/babel-BUQGeOXA.d.ts +83 -0
- package/dist/{collector-QwpPODsy.js → collector-DTahQUiV.js} +97 -23
- package/dist/collector-DTahQUiV.js.map +1 -0
- package/dist/{collector-LuU1vZ68.d.ts → collector-DUaHCcTS.d.ts} +54 -7
- package/dist/{config-rrijM-U2.js → config-B5kHzuNz.js} +5144 -3012
- package/dist/config-B5kHzuNz.js.map +1 -0
- package/dist/{config-vuCRkBWX.d.ts → config-YsxGv4tq.d.ts} +412 -33
- package/dist/{context-CkSg-kDT.js → context-CA8YKeMn.js} +1 -1
- package/dist/{context-CkSg-kDT.js.map → context-CA8YKeMn.js.map} +1 -1
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +6 -6
- package/dist/{core-BvTG0J_M.js → core-Dr4u1NVD.js} +162 -188
- package/dist/core-Dr4u1NVD.js.map +1 -0
- package/dist/{css-writer-C7HJGEmN.js → css-writer-B-J87ncv.js} +78 -17
- package/dist/css-writer-B-J87ncv.js.map +1 -0
- package/dist/{format-global-rules-Dbc_1tc3.js → format-global-rules-DklyaXv-.js} +1 -1
- package/dist/{format-global-rules-Dbc_1tc3.js.map → format-global-rules-DklyaXv-.js.map} +1 -1
- package/dist/{format-rules-BvokPr1L.js → format-rules-DKOA-6qu.js} +4 -17
- package/dist/format-rules-DKOA-6qu.js.map +1 -0
- package/dist/{hydrate-Dsv7Pwon.js → hydrate-OeMX99We.js} +3 -11
- package/dist/{hydrate-Dsv7Pwon.js.map → hydrate-OeMX99We.js.map} +1 -1
- package/dist/{index-dUtwpOux.d.ts → index-Cd45t5NM.d.ts} +319 -64
- package/dist/{index-ZRxZWzlj.d.ts → index-PqN-DIpn.d.ts} +498 -189
- package/dist/index.d.ts +5 -5
- package/dist/index.js +253 -63
- package/dist/index.js.map +1 -1
- package/dist/{keyframes-DDqRjwa9.js → keyframes-CV8azJf3.js} +97 -191
- package/dist/keyframes-CV8azJf3.js.map +1 -0
- package/dist/{merge-styles-CtDJMhpJ.d.ts → merge-styles-CU7JbEwg.d.ts} +2 -2
- package/dist/{merge-styles-B8jV6zu3.js → merge-styles-oklji0KB.js} +2 -2
- package/dist/{merge-styles-B8jV6zu3.js.map → merge-styles-oklji0KB.js.map} +1 -1
- package/dist/{resolve-recipes-BnTZz2I_.js → resolve-recipes-DTG81rzl.js} +3 -3
- package/dist/{resolve-recipes-BnTZz2I_.js.map → resolve-recipes-DTG81rzl.js.map} +1 -1
- package/dist/ssr/astro-client.js +1 -1
- package/dist/ssr/astro-client.js.map +1 -1
- package/dist/ssr/astro-middleware-static.d.ts +16 -0
- package/dist/ssr/astro-middleware-static.js +18 -0
- package/dist/ssr/astro-middleware-static.js.map +1 -0
- package/dist/ssr/astro-middleware.d.ts +8 -6
- package/dist/ssr/astro-middleware.js +10 -10
- package/dist/ssr/astro-middleware.js.map +1 -1
- package/dist/ssr/astro.d.ts +2 -17
- package/dist/ssr/astro.js +29 -21
- package/dist/ssr/astro.js.map +1 -1
- package/dist/ssr/index.d.ts +2 -9
- package/dist/ssr/index.js +5 -5
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/next.d.ts +2 -3
- package/dist/ssr/next.js +6 -7
- package/dist/ssr/next.js.map +1 -1
- package/dist/static/index.d.ts +2 -2
- package/dist/static/index.js +4 -4
- package/dist/static/index.js.map +1 -1
- package/dist/static/inject.js.map +1 -1
- package/dist/zero/babel.d.ts +2 -81
- package/dist/zero/babel.js +39 -27
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +16 -2
- package/dist/zero/index.js +2 -2
- package/dist/zero/next.d.ts +1 -1
- package/dist/zero/next.js +1 -1
- package/dist/zero/next.js.map +1 -1
- package/docs/README.md +12 -6
- package/docs/adoption.md +53 -28
- package/docs/ai-agents.md +224 -0
- package/docs/comparison.md +59 -30
- package/docs/configuration.md +498 -69
- package/docs/debug.md +7 -7
- package/docs/design-system.md +43 -24
- package/docs/dsl.md +510 -178
- package/docs/getting-started.md +55 -34
- package/docs/injector.md +58 -5
- package/docs/methodology.md +68 -36
- package/docs/migration-v3.md +285 -0
- package/docs/pipeline.md +93 -25
- package/docs/plugins.md +349 -0
- package/docs/react-api.md +162 -38
- package/docs/ssr.md +45 -35
- package/docs/styles.md +65 -16
- package/docs/tasty-static.md +25 -8
- package/package.json +43 -21
- package/tasty.config.ts +6 -0
- package/dist/collector-QwpPODsy.js.map +0 -1
- package/dist/config-rrijM-U2.js.map +0 -1
- package/dist/core-BvTG0J_M.js.map +0 -1
- package/dist/css-writer-C7HJGEmN.js.map +0 -1
- package/dist/format-rules-BvokPr1L.js.map +0 -1
- package/dist/keyframes-DDqRjwa9.js.map +0 -1
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
# Migration Guide: v2 → v3
|
|
2
|
+
|
|
3
|
+
Everything that changes when you upgrade from `@tenphi/tasty` 2.x to 3.0, in the order you will hit it.
|
|
4
|
+
|
|
5
|
+
Most of the work is mechanical renames — see the [search-and-replace cheat sheet](#search-and-replace-cheat-sheet) at the end. The parts that need real attention are the [directional shorthand](#2-directional-shorthand) rule and the [behavior changes](#8-behavior-changes-that-are-not-renames).
|
|
6
|
+
|
|
7
|
+
- [At a glance](#at-a-glance)
|
|
8
|
+
- [1. Styles-object keys](#1-styles-object-keys)
|
|
9
|
+
- [2. Directional shorthand](#2-directional-shorthand)
|
|
10
|
+
- [3. Config keys](#3-config-keys)
|
|
11
|
+
- [4. Renamed exports](#4-renamed-exports)
|
|
12
|
+
- [5. Removed exports](#5-removed-exports)
|
|
13
|
+
- [6. Removed props](#6-removed-props)
|
|
14
|
+
- [7. Moved subpath](#7-moved-subpath)
|
|
15
|
+
- [8. Behavior changes that are not renames](#8-behavior-changes-that-are-not-renames)
|
|
16
|
+
- [9. New in v3](#9-new-in-v3)
|
|
17
|
+
- [Search-and-replace cheat sheet](#search-and-replace-cheat-sheet)
|
|
18
|
+
- [Not changed](#not-changed)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## At a glance
|
|
23
|
+
|
|
24
|
+
| v2.11 | v3.0 | Find it with |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| `'@properties': { … }` | `'@property': { … }` | `rg "'@properties'"` |
|
|
27
|
+
| `'@fontFace': { … }` | `'@font-face': { … }` | `rg "'@fontFace'"` |
|
|
28
|
+
| `'@counterStyle': { … }` | `'@counter-style': { … }` | `rg "'@counterStyle'"` |
|
|
29
|
+
| `padding: '2x 4x top right'` | `padding: '2x top, 4x right'` | dev-mode console warning |
|
|
30
|
+
| `fade: '3x 1x top bottom'` | `fade: '3x top, 1x bottom'` | dev-mode console warning |
|
|
31
|
+
| `configure({ funcs })` | `configure({ functions })` | `rg "funcs"` |
|
|
32
|
+
| `configure({ fontFace })` | `configure({ fontFaces })` | `rg "fontFace:"` |
|
|
33
|
+
| `configure({ counterStyle })` | `configure({ counterStyles })` | `rg "counterStyle:"` |
|
|
34
|
+
| `getCssText()` | `getCSSText()` | `rg "getCssText"` |
|
|
35
|
+
| `getCssTextForNode()` | `getCSSTextForNode()` | `rg "getCssTextForNode"` |
|
|
36
|
+
| `getCssTextForClasses()` | `getCSSTextForClasses()` | `rg "getCssTextForClasses"` |
|
|
37
|
+
| `getGlobalFontFace()` | `getGlobalFontFaces()` | `rg "getGlobalFontFace\b"` |
|
|
38
|
+
| `getGlobalCounterStyle()` | `getGlobalCounterStyles()` | `rg "getGlobalCounterStyle\b"` |
|
|
39
|
+
| `getGlobalFunction()` | `getGlobalFunctions()` | `rg "getGlobalFunction\b"` |
|
|
40
|
+
| `okhslFunc` / `okhstFunc` | `okhslFunction` / `okhstFunction` | `rg "okhs[lt]Func\b"` |
|
|
41
|
+
| `CssOptions` | `CSSOptions` | `rg "CssOptions"` |
|
|
42
|
+
| `ParserOptions.funcs` | `ParserOptions.functions` | `rg "funcs:"` |
|
|
43
|
+
| `StyleParser#setFuncs()` | `StyleParser#setFunctions()` | `rg "setFuncs"` |
|
|
44
|
+
| `ChunkInfo` (from `tastyDebug`) | `DebugChunkInfo` | `rg "ChunkInfo"` |
|
|
45
|
+
| `@tenphi/tasty/next` | `@tenphi/tasty/zero/next` | `rg "tasty/next"` |
|
|
46
|
+
| `getIsTestEnvironment()` | `isTestEnvironment()` | `rg "getIsTestEnvironment"` |
|
|
47
|
+
| `hydrateTastyCache()` | `hydrateTastyClasses()` | `rg "hydrateTastyCache"` |
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 1. Styles-object keys
|
|
52
|
+
|
|
53
|
+
At-rule keys now match the real CSS at-rule names Tasty already emits, so they are kebab-case rather than camelCase. The generated CSS is unchanged.
|
|
54
|
+
|
|
55
|
+
```diff
|
|
56
|
+
const Card = tasty({
|
|
57
|
+
styles: {
|
|
58
|
+
- '@properties': { '$elevation': { syntax: '<number>' } },
|
|
59
|
+
- '@fontFace': { Inter: { src: 'url(/inter.woff2)' } },
|
|
60
|
+
- '@counterStyle': { dashes: { system: 'cyclic', symbols: '"—"' } },
|
|
61
|
+
+ '@property': { '$elevation': { syntax: '<number>' } },
|
|
62
|
+
+ '@font-face': { Inter: { src: 'url(/inter.woff2)' } },
|
|
63
|
+
+ '@counter-style': { dashes: { system: 'cyclic', symbols: '"—"' } },
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
`@keyframes` and `@starting` are unchanged — they were already spec-faithful.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 2. Directional shorthand
|
|
73
|
+
|
|
74
|
+
**This is the one change that can alter rendered CSS without a rename.** A style group that names direction modifiers now takes a **single** value, applied to every direction it names.
|
|
75
|
+
|
|
76
|
+
The old form looked positional but never was: the parser buckets values and modifiers into separate arrays per comma group, so `'2x 4x top right'`, `'2x top 4x right'`, and `'top 2x right 4x'` were all the same input, and the pairing was decided by the order the *modifiers* happened to appear in. `'1x 2x right top'` and `'1x 2x top right'` produced different CSS, and `'1x 2x top top'` silently assigned `top` twice.
|
|
77
|
+
|
|
78
|
+
Per-side values now come from comma-separated groups:
|
|
79
|
+
|
|
80
|
+
```diff
|
|
81
|
+
- padding: '2x 4x top right'
|
|
82
|
+
+ padding: '2x top, 4x right'
|
|
83
|
+
|
|
84
|
+
- margin: 'right 1x top 2x'
|
|
85
|
+
+ margin: '1x right, 2x top'
|
|
86
|
+
|
|
87
|
+
- inset: 'left 2x right 1x'
|
|
88
|
+
+ inset: '2x left, 1x right'
|
|
89
|
+
|
|
90
|
+
- fade: '3x 1x top bottom'
|
|
91
|
+
+ fade: '3x top, 1x bottom'
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Affects `padding`, `margin`, `inset`, `scrollMargin`, and `fade`. Extra values are ignored with a **development-mode warning** naming the offending value, so run your app in dev and watch the console — that is the reliable way to find every occurrence. Production is silent and never throws.
|
|
95
|
+
|
|
96
|
+
**Unchanged:** single-value directional groups (`padding: '2x top'`, `'1x left right'`), every value-only CSS shorthand form (`padding: '1x 2x'`, `'1x 2x 3x 4x'`, and `fade: '3x 1x'` — a group that names no direction is unambiguous and keeps plain shorthand order), CSS-wide keywords, and the `longhand` modifier.
|
|
97
|
+
|
|
98
|
+
`inset`'s `dock` modifier keeps its two-value form with sharper semantics: the first value applies to the named edge, the second to the perpendicular sides it spans, so `inset: '2x 4x bottom dock'` still gives `auto 32px 16px 32px`. A third value with `dock`, or a second value without it, now warns.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## 3. Config keys
|
|
103
|
+
|
|
104
|
+
```diff
|
|
105
|
+
configure({
|
|
106
|
+
- funcs: { double: (groups) => `calc(2 * ${groups[0].output})` },
|
|
107
|
+
- fontFace: { Inter: { src: 'url(/inter.woff2)' } },
|
|
108
|
+
- counterStyle: { dashes: { system: 'cyclic', symbols: '"—"' } },
|
|
109
|
+
+ functions: { double: (groups) => `calc(2 * ${groups[0].output})` },
|
|
110
|
+
+ fontFaces: { Inter: { src: 'url(/inter.woff2)' } },
|
|
111
|
+
+ counterStyles: { dashes: { system: 'cyclic', symbols: '"—"' } },
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`functions` is a single map holding both flavors, discriminated by value type:
|
|
116
|
+
|
|
117
|
+
- **bare key + function value** → a parse-time function, called as `name(...)`
|
|
118
|
+
- **`$$name` key + object value** → a declarative CSS `@function`, called as `$$name(...)`
|
|
119
|
+
|
|
120
|
+
A key whose prefix doesn't match its value type is ignored with a development warning.
|
|
121
|
+
|
|
122
|
+
> If you are coming from a pre-release build of v3, note the intermediate `function` config key never shipped. Upgraders from 2.x only ever wrote `funcs`.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## 4. Renamed exports
|
|
127
|
+
|
|
128
|
+
**Raw-CSS family** — aligned on the `CSS` initialism already used by `useRawCSS` / `injectRawCSS` / `getRawCSSText`:
|
|
129
|
+
|
|
130
|
+
- `getCssText()` → `getCSSText()`
|
|
131
|
+
- `getCssTextForNode()` → `getCSSTextForNode()`
|
|
132
|
+
- `StyleInjector#getCssTextForClasses()` → `getCSSTextForClasses()`
|
|
133
|
+
- `CssOptions` → `CSSOptions`
|
|
134
|
+
|
|
135
|
+
**Config getters** — pluralized to match their already-plural config keys:
|
|
136
|
+
|
|
137
|
+
- `getGlobalFontFace()` → `getGlobalFontFaces()`
|
|
138
|
+
- `getGlobalCounterStyle()` → `getGlobalCounterStyles()`
|
|
139
|
+
- `getGlobalFunction()` → `getGlobalFunctions()`
|
|
140
|
+
|
|
141
|
+
**Color functions** — aligned with the `useFunction` / `FunctionDefinition` family:
|
|
142
|
+
|
|
143
|
+
- `okhslFunc` → `okhslFunction`
|
|
144
|
+
- `okhstFunc` → `okhstFunction`
|
|
145
|
+
- `createColorFunc(name, channelLabel, convert)` → `createColorFunc(name, convert, label?)` — the label is now an optional trailing argument used only to format development warnings
|
|
146
|
+
|
|
147
|
+
**Parser** (`@tenphi/tasty/core`):
|
|
148
|
+
|
|
149
|
+
- `ParserOptions.funcs` → `ParserOptions.functions`
|
|
150
|
+
- `StyleParser#setFuncs()` → `StyleParser#setFunctions()`
|
|
151
|
+
|
|
152
|
+
**Debug types:** the debug-local `ChunkInfo` is now `DebugChunkInfo`, so it no longer collides with the parser's `ChunkInfo`.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## 5. Removed exports
|
|
157
|
+
|
|
158
|
+
| Removed | Use instead |
|
|
159
|
+
|---|---|
|
|
160
|
+
| `getIsTestEnvironment()` | `isTestEnvironment()` |
|
|
161
|
+
| `hydrateTastyCache()` | `hydrateTastyClasses()` |
|
|
162
|
+
| `customFunc()` | `configure({ functions })` |
|
|
163
|
+
| `getGlobalFuncs()` | `getGlobalFunctions()` for `@function` definitions; the parse-function registry is internal |
|
|
164
|
+
| `resetGlobalFuncs()` | `resetConfig()` |
|
|
165
|
+
| `setGlobalPredefinedTokens()` | `configure({ replaceTokens })` |
|
|
166
|
+
| `resetGlobalPredefinedTokens()` | `resetConfig()` |
|
|
167
|
+
| `setMiddlewareTransferCache()` / `getMiddlewareTransferCache()` | internal; no replacement needed |
|
|
168
|
+
| `clearWriterCache()` | internal test utility |
|
|
169
|
+
| `DEFAULT_PLUGINS` | nothing — it was never consumed, and passing it to `configure({ plugins })` was a no-op. The default `okhsl`/`okhst` functions are registered automatically. |
|
|
170
|
+
| `registerDefaultFunctions()` | internal bootstrap helper |
|
|
171
|
+
| `warn()` / `deprecationWarning()` | internal helpers with no callers |
|
|
172
|
+
| `Bucket` enum | parser-internal |
|
|
173
|
+
| `Props` type | inline `Record<string, any>` |
|
|
174
|
+
| `UseStylesOptions` | `useStyles()` takes `Styles \| undefined` directly |
|
|
175
|
+
| `GlobalStyledProps` | its only member was the already-dead `breakpoints` prop |
|
|
176
|
+
| duplicate `PropertyOptions` | the single `PropertyOptions` from `injector/types` |
|
|
177
|
+
|
|
178
|
+
`getGlobalFuncs()` deserves a note: it returned the **live mutable internal registry**, and writing to it bypassed the parser's cache invalidation, so the write silently never took effect. If you were mutating it, move to `configure({ functions })`.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## 6. Removed props
|
|
183
|
+
|
|
184
|
+
`css`, `block`, `inline`, and `breakpoints` are gone from `BaseProps` / `TastySpecificKeys`. All four were typed but never consumed — passing them did nothing in v2 either.
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## 7. Moved subpath
|
|
189
|
+
|
|
190
|
+
```diff
|
|
191
|
+
- import { withTasty } from '@tenphi/tasty/next';
|
|
192
|
+
+ import { withTasty } from '@tenphi/tasty/zero/next';
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
The zero-runtime Next.js wrapper already lived under the `zero` namespace internally; the top-level `/next` path collided confusingly with `@tenphi/tasty/ssr/next`, which is a different integration.
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## 8. Behavior changes that are not renames
|
|
200
|
+
|
|
201
|
+
**Repeated `configure()` calls now merge.** `recipes`, `keyframes`, `properties`, `fontFaces`, `counterStyles`, and CSS `@function` definitions used to replace wholesale, so a design-system `configure()` followed by an application `configure()` silently dropped the design system's values. All of them now merge, with the later call winning on a key conflict — matching `tokens` and `globalStyles`, which already merged. If you were relying on a second call to *clear* a collection, use `resetConfig()`.
|
|
202
|
+
|
|
203
|
+
`configure({ polyfills })` is now correctly rejected after the first render, like every sibling option, and shallow-merges so an unrelated later call cannot switch a polyfill off.
|
|
204
|
+
|
|
205
|
+
**The `theme` prop is now implemented.** It maps to a `data-theme` attribute on the rendered element; previously it fell through and was spread onto the DOM raw. Augment `TastyThemeNames` for autocomplete.
|
|
206
|
+
|
|
207
|
+
**`tasty(Component, options)` no longer leaks factory-only options.** `variants`, `elements`, `styleProps`, `modProps`, and `tokenProps` are stripped instead of being passed to the wrapped component as runtime props, matching the element factory.
|
|
208
|
+
|
|
209
|
+
**Replacing a built-in style handler now warns.** Built-in handlers are shared across style names, so `configure({ handlers: { fill } })` also takes over `image` and the whole `background-*` family, and `configure({ handlers: { display } })` takes down `flow`, `gap`, `hide`, `overflow`, `whiteSpace`, and `textOverflow`. This was always true; what's new is that a development-mode warning now names exactly what was displaced. If you see it, either declare the whole group and delegate the rest to `styleHandlers.*`, or pick a narrower name. See [Plugins](plugins.md#custom-style-handlers).
|
|
210
|
+
|
|
211
|
+
**Multi-dependency custom handlers are fixed.** A handler whose dependencies mixed known and unknown style names was invoked once per chunk with only *part* of its dependencies, and could emit stale CSS. Unknown names now join their handler's chunk, so it is invoked once with all of them. No built-in style moved, so no existing class name changes.
|
|
212
|
+
|
|
213
|
+
**`isChecked` added to the root prop types.** It already worked at runtime; it was just missing from `BaseProps` / `AllBaseProps`.
|
|
214
|
+
|
|
215
|
+
**The `okhsl`/`okhst` "expected 3 values" warning is now development-only** and follows the `[Tasty]` prefix convention: `[Tasty] okhsl(): expected 3 values (H S L), got: …`. It previously fired in production.
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## 9. New in v3
|
|
220
|
+
|
|
221
|
+
Nothing here is required to upgrade.
|
|
222
|
+
|
|
223
|
+
- **CSS `@function` support** — reusable, parameterized functions via the `'@function'` styles key, the `useFunction` style function, or `configure({ functions })`. Works across client, SSR/RSC, and zero-runtime. `configure({ polyfills: { functions: true } })` inlines every call into plain CSS for browsers that don't ship the at-rule yet. See [Style DSL](dsl.md#functions-function).
|
|
224
|
+
- **Custom color plugins with no core special-casing** — `okhsl`/`okhst` are now ordinary one-line plugins, and a third-party color space can achieve identical integration. New `createColorFunc` and `resolveFunctionColor` helpers.
|
|
225
|
+
- **`configure({ propHandlers })`** — props middleware for every component: props in, props out. The extension point for props that aren't style values.
|
|
226
|
+
- **`configure({ baseStyleProps })`** — expose style properties as props on every component without listing them in each `styleProps`.
|
|
227
|
+
- **`defineHandler(deps, fn)`** — infers a multi-dependency handler's parameter types from its dependency list.
|
|
228
|
+
- **Plugins can supply `properties`, `keyframes`, `fontFaces`, and `counterStyles`** in addition to what they already could.
|
|
229
|
+
- See [Plugins & Extension Points](plugins.md) for all of the above.
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Search-and-replace cheat sheet
|
|
234
|
+
|
|
235
|
+
Run these in order — the `Css` → `CSS` renames must happen before any broader pattern, and the quoted at-rule keys must stay quote-anchored so they can't hit `configure({ properties })`.
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
# 1. Raw-CSS family (before anything that touches "Css")
|
|
239
|
+
rg -l 'getCssTextForClasses' | xargs sed -i '' 's/getCssTextForClasses/getCSSTextForClasses/g'
|
|
240
|
+
rg -l 'getCssTextForNode' | xargs sed -i '' 's/getCssTextForNode/getCSSTextForNode/g'
|
|
241
|
+
rg -l 'getCssText' | xargs sed -i '' 's/getCssText/getCSSText/g'
|
|
242
|
+
rg -l 'CssOptions' | xargs sed -i '' 's/CssOptions/CSSOptions/g'
|
|
243
|
+
|
|
244
|
+
# 2. Styles-object at-rule keys (quote-anchored)
|
|
245
|
+
rg -l "'@properties'" | xargs sed -i '' "s/'@properties'/'@property'/g"
|
|
246
|
+
rg -l "'@fontFace'" | xargs sed -i '' "s/'@fontFace'/'@font-face'/g"
|
|
247
|
+
rg -l "'@counterStyle'" | xargs sed -i '' "s/'@counterStyle'/'@counter-style'/g"
|
|
248
|
+
|
|
249
|
+
# 3. Config getters (word-anchored so the plural forms are not double-pluralized)
|
|
250
|
+
rg -l 'getGlobalFontFace\b' | xargs sed -i '' 's/getGlobalFontFace\b/getGlobalFontFaces/g'
|
|
251
|
+
rg -l 'getGlobalCounterStyle\b' | xargs sed -i '' 's/getGlobalCounterStyle\b/getGlobalCounterStyles/g'
|
|
252
|
+
rg -l 'getGlobalFunction\b' | xargs sed -i '' 's/getGlobalFunction\b/getGlobalFunctions/g'
|
|
253
|
+
|
|
254
|
+
# 4. Color functions and parser methods
|
|
255
|
+
rg -l 'okhslFunc\b' | xargs sed -i '' 's/okhslFunc\b/okhslFunction/g'
|
|
256
|
+
rg -l 'okhstFunc\b' | xargs sed -i '' 's/okhstFunc\b/okhstFunction/g'
|
|
257
|
+
rg -l 'setFuncs' | xargs sed -i '' 's/setFuncs/setFunctions/g'
|
|
258
|
+
|
|
259
|
+
# 5. Removed exports with direct replacements
|
|
260
|
+
rg -l 'getIsTestEnvironment' | xargs sed -i '' 's/getIsTestEnvironment/isTestEnvironment/g'
|
|
261
|
+
rg -l 'hydrateTastyCache' | xargs sed -i '' 's/hydrateTastyCache/hydrateTastyClasses/g'
|
|
262
|
+
|
|
263
|
+
# 6. Moved subpath
|
|
264
|
+
rg -l "@tenphi/tasty/next" | xargs sed -i '' "s|@tenphi/tasty/next|@tenphi/tasty/zero/next|g"
|
|
265
|
+
|
|
266
|
+
# 7. Verify nothing is left (should print nothing)
|
|
267
|
+
rg "getCssText|CssOptions|'@properties'|'@fontFace'|'@counterStyle'|okhs[lt]Func\b|setFuncs|getIsTestEnvironment|hydrateTastyCache|@tenphi/tasty/next|getGlobalFontFace\b|getGlobalCounterStyle\b|getGlobalFunction\b"
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
`configure({ funcs })` → `functions`, `fontFace` → `fontFaces`, and `counterStyle` → `counterStyles` are deliberately **not** scripted: those words appear in many other contexts, so change them by hand and let TypeScript find the call sites.
|
|
271
|
+
|
|
272
|
+
The directional shorthand cannot be scripted at all — the whole point is that the old form's meaning was not recoverable from its text. Run your app in development and follow the console warnings.
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## Not changed
|
|
277
|
+
|
|
278
|
+
Worth stating explicitly, because it's easy to assume otherwise:
|
|
279
|
+
|
|
280
|
+
- **At-rule styles-object keys are CSS-spec-faithful, not JS-conventional.** `@keyframes`, `@property`, `@font-face`, `@counter-style`, `@function`, `@starting` — kebab-case, matching what Tasty emits.
|
|
281
|
+
- **The `func()` injector method stays abbreviated.** `function` is a reserved word.
|
|
282
|
+
- `injector.fontFace()` and `injector.counterStyle()` keep their singular names — only the *config keys* and *getters* were pluralized.
|
|
283
|
+
- `useFontFace` and `useCounterStyle` are unchanged.
|
|
284
|
+
- `configure({ properties })` and `autoPropertyTypes` are unchanged; only the styles-object `@property` key was renamed.
|
|
285
|
+
- **The deprecated style aliases are retained deliberately.** `backgroundColor`, `background`, `backgroundImage`, `flex`, `grid`, and `flexDirection` still carry `@deprecated` tags and still work. They are the guardrail that discourages their use in projects that have not enabled `@tenphi/eslint-plugin-tasty` yet — read the tags as guidance, not as a removal notice.
|
package/docs/pipeline.md
CHANGED
|
@@ -6,7 +6,7 @@ This document describes the style rendering pipeline that transforms style objec
|
|
|
6
6
|
|
|
7
7
|
## Overview
|
|
8
8
|
|
|
9
|
-
The pipeline takes a `Styles` object and produces an array of `CSSRule` objects ready for injection into the DOM.
|
|
9
|
+
The pipeline takes a `Styles` object and produces an array of `CSSRule` objects ready for injection into the DOM. The entry point is `renderStyles`, which has two overloads: called with a selector or class (`renderStyles(styles, '.t1')`) it returns the rules directly; called without one (`renderStyles(styles)`) it returns `{ rules }` for a caller that will allocate the class name itself. The per-handler flow is:
|
|
10
10
|
|
|
11
11
|
```
|
|
12
12
|
Input: Styles Object
|
|
@@ -76,7 +76,7 @@ Output: CSSRule[]
|
|
|
76
76
|
|
|
77
77
|
**Simplification** (`simplifyCondition` in `simplify.ts`) is not a separate numbered stage. It runs inside OR expansion, exclusive building, `expandExclusiveOrs` branch cleanup, combination ANDs, merge-by-value ORs, and materialization. Every call is cached by condition unique-id, so the repetition is cheap.
|
|
78
78
|
|
|
79
|
-
**Post-pass:** After `processStyles` collects rules from every handler, `runPipeline` (`index.ts
|
|
79
|
+
**Post-pass:** After `processStyles` collects rules from every handler, `runPipeline` (`index.ts`) filters duplicates using a key of `selector|declarations|atRules|rootPrefix|startingStyle`, then **stable-sorts rules by their cascade `order` hint (ascending source priority)** so lower-priority rules come first and higher-priority rules win, and finally emits every `@starting-style` rule **after** all normal rules. The `order` hint is the highest source priority among the entries that produced each rule (threaded `ComputedRule → CSSRule`). This ordering is cascade-critical because Stage 7 equalizes specificity with `:where()`: once every state selector carries zero specificity, source order alone decides which of two overlapping rules wins — most importantly the `_` fallback floor (low order, emitted first) versus the states layered over it, and `@starting-style` versus its normal counterpart. Mutually-exclusive rules are unaffected by ordering (they never both match), so reordering them is safe.
|
|
80
80
|
|
|
81
81
|
---
|
|
82
82
|
|
|
@@ -120,6 +120,8 @@ Removing don't-care dimensions before parsing prevents combinatorial blowup in l
|
|
|
120
120
|
|
|
121
121
|
Converts each state key in a style value map (like `'hovered & !disabled'`, `'@media(w < 768px)'`) into `ConditionNode` trees. `parseStyleEntries` walks the object keys in source order and assigns priorities; `parseStateKey` parses a single key string.
|
|
122
122
|
|
|
123
|
+
`parseStyleEntries` also handles the bare `''` default and the standalone `_` fallback floor before the priority order is finalized. The bare `''` default only behaves correctly as the lowest-priority state, so a misplaced one is moved to the front (`MISPLACED_DEFAULT_STATE` warning). The `_` key is pulled out as a separate floor entry (`floor: true`, `TrueCondition`) and always assigned the lowest priority. If a map defines only `_` and a bare `''` (no other states), the `''` default is redundant — it is dropped in favor of the `_` value (`REDUNDANT_DEFAULT_STATE` warning). A `_` combined with state logic (`_ & hovered`, `_ | x`) is ignored (`INVALID_FALLBACK_KEY` warning).
|
|
124
|
+
|
|
123
125
|
### How It Works
|
|
124
126
|
|
|
125
127
|
1. **Tokenization**: The state key is split into tokens using a regex pattern that recognizes:
|
|
@@ -179,38 +181,64 @@ The condition tree representation enables:
|
|
|
179
181
|
|
|
180
182
|
### What It Does
|
|
181
183
|
|
|
182
|
-
Collapses parsed entries that share the same value. Only **non-default** entries are merged — an entry with the default state (`''` → `TrueCondition`) is never merged with a non-default entry.
|
|
184
|
+
Collapses parsed entries that share the same value when doing so provably preserves the authored cascade. Only **non-default** entries are merged — an entry with the default state (`''` → `TrueCondition`) is never merged with a non-default entry.
|
|
183
185
|
|
|
184
186
|
### How It Works
|
|
185
187
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
188
|
+
Entries arrive sorted highest-priority-first. For each entry the pass walks already-emitted entries from most-recent backward, looking for the nearest same-value entry where merging is safe. If found, the two entries collapse into one (priority becomes the maximum of the pair, condition becomes the simplified `OR`). Default entries are emitted as singletons and never participate in a merge.
|
|
189
|
+
|
|
190
|
+
### The Safety Condition
|
|
191
|
+
|
|
192
|
+
Merging two same-value entries with conditions `C_h` (higher priority) and `C_l` (lower priority) lifts the lower one up to `p_h` and changes the higher-priority "blocker" for every intermediate-priority entry from `!C_h` to `!(C_h | C_l) = !C_h & !C_l`. The added `!C_l` constraint can incorrectly block an intermediate entry that should have won.
|
|
193
|
+
|
|
194
|
+
The merge is safe iff for every entry `e_m` strictly between them in priority with a different value,
|
|
195
|
+
|
|
196
|
+
simplify(C_m & C_l & !C_h) = FALSE
|
|
197
|
+
|
|
198
|
+
i.e. there is no scenario where the intermediate state could have matched, the lower same-value entry would also have matched, and the higher one would not. This is the only way the merge could leak through and shadow the intermediate state.
|
|
191
199
|
|
|
192
200
|
### Why
|
|
193
201
|
|
|
194
|
-
Without this
|
|
202
|
+
Without this pass a value map like `{ '@dark': 'red', '@dark & @hc': 'red' }` would create two separate entries that later produce two CSS rules with identical output. Merging before exclusive building keeps the exclusive condition algebra small and avoids duplicate CSS. The safety check ensures we never break the cascade in service of this optimization.
|
|
195
203
|
|
|
196
|
-
**Why defaults are kept separate:** merging `TRUE | X` collapses to `TRUE`, destroying X's participation in the exclusive cascade. Intermediate-priority states would then lose their `:not(X)` negation, producing overlapping CSS rules.
|
|
204
|
+
**Why defaults are kept separate:** merging `TRUE | X` collapses to `TRUE`, destroying X's participation in the exclusive cascade. Intermediate-priority states would then lose their `:not(X)` negation, producing overlapping CSS rules.
|
|
197
205
|
|
|
198
|
-
### Example
|
|
206
|
+
### Example — Safe merge (still collapses)
|
|
199
207
|
|
|
200
208
|
```typescript
|
|
201
|
-
//
|
|
209
|
+
// { '@dark & @hc': 'red', '@dark': 'red' }
|
|
210
|
+
// Input entries (highest priority first), no intermediate different-value entry
|
|
202
211
|
[
|
|
203
|
-
{ stateKey: '@dark & @hc', value: 'red', condition: dark & hc },
|
|
204
|
-
{ stateKey: '@dark', value: 'red', condition: dark
|
|
212
|
+
{ stateKey: '@dark & @hc', value: 'red', condition: dark & hc, priority: 1 },
|
|
213
|
+
{ stateKey: '@dark', value: 'red', condition: dark, priority: 0 },
|
|
205
214
|
]
|
|
206
215
|
|
|
207
|
-
// Output: one merged entry
|
|
216
|
+
// Safe: no intermediates. Output: one merged entry
|
|
208
217
|
[
|
|
209
218
|
{ stateKey: '@dark & @hc | @dark', value: 'red',
|
|
210
|
-
condition: simplify((dark & hc) | dark) = dark }
|
|
219
|
+
condition: simplify((dark & hc) | dark) = dark, priority: 1 }
|
|
211
220
|
]
|
|
212
221
|
```
|
|
213
222
|
|
|
223
|
+
The compound dark/HC dedup pattern `{ '': light, '@dark': dark, '@hc': hc, '@dark & @hc': dark }` also collapses cleanly because `@hc & @dark & !(@dark & @hc)` simplifies to FALSE — the intermediate `@hc` is structurally blocked by the contradiction.
|
|
224
|
+
|
|
225
|
+
### Example — Unsafe merge (must NOT collapse)
|
|
226
|
+
|
|
227
|
+
```typescript
|
|
228
|
+
// { hovered: 'red', pressed: 'blue', disabled: 'red' }
|
|
229
|
+
// Authored cascade: disabled > pressed > hovered.
|
|
230
|
+
// Merging hovered (priority 0) with disabled (priority 2) would lift
|
|
231
|
+
// hovered to priority 2 and rewrite `pressed`'s exclusive from
|
|
232
|
+
// `pressed & !disabled` to `pressed & !disabled & !hovered`, making
|
|
233
|
+
// `pressed + hovered` resolve to red instead of blue.
|
|
234
|
+
|
|
235
|
+
// `simplify(pressed & hovered & !disabled)` is not FALSE — three
|
|
236
|
+
// independent modifiers can all be active — so the entries are kept
|
|
237
|
+
// separate. Stage 6 `mergeByValue` will later combine the two red
|
|
238
|
+
// CSS rules into one selector group, but only after the cascade is
|
|
239
|
+
// correctly resolved.
|
|
240
|
+
```
|
|
241
|
+
|
|
214
242
|
---
|
|
215
243
|
|
|
216
244
|
## Stage 2a: Expand User OR Branches
|
|
@@ -267,6 +295,32 @@ C: C & !A & !B (applies only when neither A nor B)
|
|
|
267
295
|
|
|
268
296
|
Each exclusive condition is passed through `simplifyCondition`. Entries that simplify to `FALSE` (impossible) are filtered out. The default state (`''` → `TrueCondition`) is not added to the “prior” list for negation (see `buildExclusiveConditions`).
|
|
269
297
|
|
|
298
|
+
### `_` fallback floor
|
|
299
|
+
|
|
300
|
+
An entry flagged `floor: true` (from the standalone `_` key) is the one
|
|
301
|
+
exception to the negation cascade above. `buildExclusiveConditions` **pulls the
|
|
302
|
+
floor entries out** before the negation pass, builds the remaining entries with a
|
|
303
|
+
plain unconditional negation loop, then re-appends each floor with its own
|
|
304
|
+
(`TRUE`) condition as the exclusive condition. So the floor **always applies**,
|
|
305
|
+
never receives `!prior`, and never negates lower-priority entries. Because its
|
|
306
|
+
condition is `TRUE`, Stage 1 `mergeEntriesByValue` already leaves it untouched
|
|
307
|
+
(same guard as the bare `''` default), so no floor-specific merge handling is
|
|
308
|
+
needed.
|
|
309
|
+
|
|
310
|
+
This exists to fix the *unknown-query hole*: CSS three-valued logic makes
|
|
311
|
+
`not(unknown) = unknown`, so a negated `@supports(...)` / container-query default
|
|
312
|
+
branch silently never applies. A `_` floor sidesteps negation entirely and lets
|
|
313
|
+
the positive override layer on top via the cascade (see Stage 7's `:where()`
|
|
314
|
+
equalization and the ascending-priority post-pass).
|
|
315
|
+
|
|
316
|
+
Because the floor is **additive** (always emitted, never negated) rather than
|
|
317
|
+
mutually exclusive, it differs observably from the `''` default in two ways
|
|
318
|
+
beyond the unknown-query fix: an "empty" higher-priority state (one that emits no
|
|
319
|
+
declarations) cannot unset the property — the floor still applies — and when
|
|
320
|
+
states emit different declaration sets, the floor's declarations bleed through
|
|
321
|
+
wherever a winning state does not override the same property. The `''` default,
|
|
322
|
+
being negated, swaps out cleanly. See the DSL guide's "`_` vs the `''` default".
|
|
323
|
+
|
|
270
324
|
### Why
|
|
271
325
|
|
|
272
326
|
This eliminates CSS specificity wars. Instead of relying on cascade order, each CSS rule matches in exactly one scenario. Benefits:
|
|
@@ -307,17 +361,24 @@ This is the companion to **Stage 2a** (user-OR expansion). The split exists beca
|
|
|
307
361
|
|
|
308
362
|
1. Collect top-level OR branches of `exclusiveCondition`.
|
|
309
363
|
2. If there is no OR (single branch), the entry is unchanged. Pure selector ORs with no at-rule context are also left alone (materialization handles them via `:is()` / variant merging).
|
|
310
|
-
3. Otherwise `sortOrBranchesForExpansion` reorders branches
|
|
364
|
+
3. Otherwise `sortOrBranchesForExpansion` reorders branches by a three-tier rank — `@supports` branches first, then other at-rule branches (media / container / starting), then pure-selector branches. This is load-bearing for correctness (see below).
|
|
311
365
|
4. Each branch is made exclusive against prior branches: `branch & !prior[0] & !prior[1] & ...`, then simplified.
|
|
312
366
|
5. Impossible branches are dropped; expanded entries get a synthetic `stateKey` suffix like `[or:0]`.
|
|
313
367
|
|
|
314
368
|
### Why the sort matters
|
|
315
369
|
|
|
316
|
-
Consider `!A | !B` where A is an at-rule (e.g. `@supports(grid)`) and B is a modifier (e.g. `:has(foo)`):
|
|
370
|
+
**At-rules before selectors.** Consider `!A | !B` where A is an at-rule (e.g. `@supports(grid)`) and B is a modifier (e.g. `:has(foo)`):
|
|
317
371
|
|
|
318
372
|
- **With at-rule-first sort** (`!A`, then `!B & A`): the first branch emits "outside `@supports`", the second emits "inside `@supports` with `:not(:has(foo))`". Full coverage.
|
|
319
373
|
- **Without the sort** (`!B`, then `!A & B`): the first branch emits `:not(:has(foo))` as a bare selector with no at-rule context — leaking the rule outside `@supports`. The second is incomplete.
|
|
320
374
|
|
|
375
|
+
**`@supports` before other at-rules (Kleene logic).** A `@supports` feature query is special: anything ANDed with it can become *unknown* — not simply false — when the feature is unsupported. The canonical case is a feature guard over a dependent query, e.g. `@supports(container-type: scroll-state) & @(scroll-state(scrolled: block-end))` (`S & C`). The default's exclusive is `!(S & C) = !S | !C`, which `simplify` sorts alphabetically into `[!C, !S]`.
|
|
376
|
+
|
|
377
|
+
- **Expanding `!C` first** emits a bare `@container (not scroll-state(...))` rule. In a browser without `scroll-state` support that query is unknown (not false), so it matches nothing and the default `inset` is never applied — a coverage hole.
|
|
378
|
+
- **Expanding `!S` first** yields `!S | (S & !C)`: a bare `@supports (not (container-type: scroll-state))` fallback carrying the default, plus the dependent negation nested inside the supported scope. Full coverage, and the unsupported path never references the guarded query.
|
|
379
|
+
|
|
380
|
+
Because `!S | (S & !R) ≡ !S | !R` in two-valued logic, this reordering is a no-op for cases without an `@supports` guard. The same supports-first ordering is also applied in `makeOrBranchesExclusive` (`materialize.ts`) for ORs that survive nested inside an AND (e.g. `compact & (!S | !C)`).
|
|
381
|
+
|
|
321
382
|
The pre-build Stage 2a pass doesn't need this because user-authored ORs aren't produced by negation and their branches are expected to apply in each branch's own scope.
|
|
322
383
|
|
|
323
384
|
### Example (conceptual)
|
|
@@ -444,7 +505,15 @@ Converts condition trees into actual CSS selectors and at-rules.
|
|
|
444
505
|
|
|
445
506
|
3. **Contradiction detection**: During variant merging, impossible combinations are dropped (e.g. conflicting media, root, or modifier negations).
|
|
446
507
|
|
|
447
|
-
4. **`materializeComputedRule`**: Groups variants by sorted at-rules plus root-prefix key; within each group, `mergeVariantsIntoSelectorGroups` merges variants that differ only in flat modifier/pseudo parts; builds selector strings and emits one or more `CSSRule` objects.
|
|
508
|
+
4. **`materializeComputedRule`**: Groups variants by sorted at-rules plus root-prefix key; within each group, `mergeVariantsIntoSelectorGroups` merges variants that differ only in flat modifier/pseudo parts; builds selector strings and emits one or more `CSSRule` objects. The rule's `order` hint (cascade priority) is propagated here for the post-pass sort.
|
|
509
|
+
|
|
510
|
+
5. **`:where()` specificity equalization**: Every stateful part of the selector is wrapped in `:where(...)` so it contributes **zero specificity**:
|
|
511
|
+
- the flat root modifiers + pseudos and the root element's `:is()`/`:not()` groups are combined into one `:where(...)` (`buildSelectorFromVariant`);
|
|
512
|
+
- the sub-element (`@own`) groups are wrapped in a **separate** `:where(...)` so the sub-element's structural `[data-element="X"]` specificity is preserved while its states are zeroed;
|
|
513
|
+
- `@parent` ancestors (`parentGroupsToCSS`) become `:where(... *)` / `:where(:not(... *))`;
|
|
514
|
+
- the `@root` context prefix (`rootGroupsToCSS`) becomes `:where(:root...)` (zeroing the `:root` pseudo too).
|
|
515
|
+
|
|
516
|
+
The only specificity anchors that remain are the doubled component class (`.tXX.tXX`, added by the injector) and sub-element `[data-element]` attributes. Because Stage 2b already makes ordinary rules mutually exclusive, zeroing specificity never changes *which* rule matches — it only makes additive layering (`_` fallback floor, `@starting-style`) resolve deterministically by source order (see the post-pass). Canonical sorting/dedup/subsumption still run first; `:where()` is only the final wrapper, and both output paths (injector and direct-selector / SSR) consume the same wrapped fragments.
|
|
448
517
|
|
|
449
518
|
### Why
|
|
450
519
|
|
|
@@ -465,10 +534,12 @@ interface CSSRule {
|
|
|
465
534
|
declarations: string; // CSS declarations (e.g. 'color: red;')
|
|
466
535
|
atRules?: string[]; // Wrapping at-rules
|
|
467
536
|
rootPrefix?: string; // Root state prefix
|
|
537
|
+
startingStyle?: boolean; // Wrap declarations in @starting-style
|
|
538
|
+
order?: number; // Internal cascade order hint (ascending source priority); stripped before injection
|
|
468
539
|
}
|
|
469
540
|
```
|
|
470
541
|
|
|
471
|
-
When `
|
|
542
|
+
When `renderStyles` runs **without** a selector, returned rules include `needsClassName: true` (compatibility field for the injector); that flag is not part of `CSSRule` inside `materialize.ts`.
|
|
472
543
|
|
|
473
544
|
---
|
|
474
545
|
|
|
@@ -612,7 +683,7 @@ The default entry's exclusive is `!hovered & !@media(dark)` — no top-level OR,
|
|
|
612
683
|
|
|
613
684
|
### Stages 4–5: Compute combinations and call handler
|
|
614
685
|
|
|
615
|
-
Single style, three snapshots; the `color` handler emits `color` plus `--current-color
|
|
686
|
+
Single style, three snapshots; the `color` handler emits `color` plus a `--current-color` variable.
|
|
616
687
|
|
|
617
688
|
### Stage 6: Merge by value
|
|
618
689
|
|
|
@@ -620,26 +691,23 @@ Each snapshot yields distinct declarations; no merge.
|
|
|
620
691
|
|
|
621
692
|
### Stage 7: Materialize CSS
|
|
622
693
|
|
|
623
|
-
Using `renderStyles(styles, '.t1')` (
|
|
694
|
+
Using `renderStyles(styles, '.t1')` (the class is doubled — `.t1.t1` — so Tasty owns specificity without `!important`):
|
|
624
695
|
|
|
625
696
|
```css
|
|
626
697
|
.t1[data-hovered] {
|
|
627
698
|
color: var(--highlight-color);
|
|
628
699
|
--current-color: var(--highlight-color);
|
|
629
|
-
--current-color-oklch: var(--highlight-color-oklch);
|
|
630
700
|
}
|
|
631
701
|
@media (prefers-color-scheme: dark) {
|
|
632
702
|
.t1:not([data-hovered]) {
|
|
633
703
|
color: var(--dark-color);
|
|
634
704
|
--current-color: var(--dark-color);
|
|
635
|
-
--current-color-oklch: var(--dark-color-oklch);
|
|
636
705
|
}
|
|
637
706
|
}
|
|
638
707
|
@media (not (prefers-color-scheme: dark)) {
|
|
639
708
|
.t1:not([data-hovered]) {
|
|
640
709
|
color: var(--white-color);
|
|
641
710
|
--current-color: var(--white-color);
|
|
642
|
-
--current-color-oklch: var(--white-color-oklch);
|
|
643
711
|
}
|
|
644
712
|
}
|
|
645
713
|
```
|