@tenphi/tasty 3.9.2 → 3.9.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.
- package/dist/{babel-Zs1Q03qt.d.ts → babel-DD7kdEFT.d.ts} +2 -2
- package/dist/chunks/{build-config-CUQVwdWF.js → build-config-z06WcSWq.js} +4 -4
- package/dist/chunks/{build-config-CUQVwdWF.js.map → build-config-z06WcSWq.js.map} +1 -1
- package/dist/chunks/{collector-B0LTHw6Z.js → collector-CSMFKWEi.js} +4 -4
- package/dist/chunks/{collector-B0LTHw6Z.js.map → collector-CSMFKWEi.js.map} +1 -1
- package/dist/chunks/{config-engine-C3pF9EK9.js → config-engine-BKgJcV_F.js} +3 -3
- package/dist/chunks/{config-engine-C3pF9EK9.js.map → config-engine-BKgJcV_F.js.map} +1 -1
- package/dist/chunks/{css-definitions-D_it4XZH.js → css-definitions-BLxYIG-s.js} +2 -2
- package/dist/chunks/{css-definitions-D_it4XZH.js.map → css-definitions-BLxYIG-s.js.map} +1 -1
- package/dist/chunks/{debug-CiiHDgmR.js → debug-vitwtcMP.js} +4 -4
- package/dist/chunks/{debug-CiiHDgmR.js.map → debug-vitwtcMP.js.map} +1 -1
- package/dist/chunks/{react-runtime-sH6r6Ajr.js → react-runtime-D9XQr5wn.js} +4 -4
- package/dist/chunks/{react-runtime-sH6r6Ajr.js.map → react-runtime-D9XQr5wn.js.map} +1 -1
- package/dist/chunks/{runtime-engine-BrRcOZwD.js → runtime-engine-BBxhRy60.js} +5 -5
- package/dist/chunks/{runtime-engine-BrRcOZwD.js.map → runtime-engine-BBxhRy60.js.map} +1 -1
- package/dist/chunks/{runtime-state-BTDqSYBk.js → runtime-state-D_N0OAuJ.js} +2 -2
- package/dist/chunks/{runtime-state-BTDqSYBk.js.map → runtime-state-D_N0OAuJ.js.map} +1 -1
- package/dist/chunks/{style-engine-C1ECBZxR.js → style-engine-DeE1gFDC.js} +110 -44
- package/dist/chunks/{style-engine-C1ECBZxR.js.map → style-engine-DeE1gFDC.js.map} +1 -1
- package/dist/chunks/{zero-engine-B6EnYcXY.js → zero-engine-CtaJCmco.js} +3 -3
- package/dist/chunks/{zero-engine-B6EnYcXY.js.map → zero-engine-CtaJCmco.js.map} +1 -1
- package/dist/{collector-hl5KNH7k.d.ts → collector-YpsMjV7T.d.ts} +2 -2
- package/dist/{config-DWL1ZYue.d.ts → config-BnZqyYG4.d.ts} +3 -3
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +6 -6
- package/dist/{index-D9N9GV24.d.ts → index-BLJLo9cl.d.ts} +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7 -7
- package/dist/{merge-styles-C_oMoJVd.d.ts → merge-styles-CTDLIrO5.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-jKZNpias.d.ts → types-vfRQhzRd.d.ts} +5 -5
- package/dist/zero/babel.d.ts +1 -1
- package/dist/zero/babel.js +4 -4
- package/dist/zero/index.d.ts +1 -1
- package/dist/zero/index.js +1 -1
- package/dist/zero/next.d.ts +1 -1
- package/docs/ai-agents.md +21 -2
- package/docs/dsl.md +4 -2
- package/docs/getting-started.md +13 -11
- package/docs/methodology.md +2 -2
- package/docs/pipeline.md +29 -8
- package/docs/plugins.md +1 -1
- package/docs/styles.md +23 -5
- package/docs/tasty-static.md +1 -1
- package/package.json +1 -1
package/docs/dsl.md
CHANGED
|
@@ -54,6 +54,8 @@ fill: {
|
|
|
54
54
|
}
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
+
Modifier and class names start with a letter and may be a single letter (`x` → `[data-x]`, `.x`). Tasty emits an `INVALID_STATE_KEY` warning for a key it cannot fully read and skips the unreadable parts. That covers characters outside the notation (`1st`, or `@media (w < 600px)` with a space before the parenthesis), an operator missing a state (`hovered &`), and two states with no operator between them (`hovered focused`). A partly read key can apply in states you did not mean, so fix the key rather than rely on what it produces.
|
|
58
|
+
|
|
57
59
|
#### Default State Ordering
|
|
58
60
|
|
|
59
61
|
Key order sets priority — later keys win and turn off earlier ones via negation. The bare default (`''`) is the lowest-priority state, so it **must be the first key**. If it appears after other states, Tasty moves it to the front and emits a dev warning (`MISPLACED_DEFAULT_STATE`); otherwise it would override every state above it.
|
|
@@ -701,7 +703,7 @@ const FadeIn = tasty({
|
|
|
701
703
|
styles: {
|
|
702
704
|
opacity: { '': '1', '@starting': '0' },
|
|
703
705
|
transform: { '': 'scale(1)', '@starting': 'scale(0.95)' },
|
|
704
|
-
transition: 'opacity
|
|
706
|
+
transition: 'opacity, translate',
|
|
705
707
|
},
|
|
706
708
|
});
|
|
707
709
|
```
|
|
@@ -833,7 +835,7 @@ const AnimatedGradient = tasty({
|
|
|
833
835
|
'$gradient-angle': '0deg',
|
|
834
836
|
'#theme': 'okhst(280 80% 50%)',
|
|
835
837
|
image: 'linear-gradient($gradient-angle, #theme, #clear)',
|
|
836
|
-
transition: '$$gradient-angle
|
|
838
|
+
transition: '$$gradient-angle, ##theme',
|
|
837
839
|
},
|
|
838
840
|
});
|
|
839
841
|
```
|
package/docs/getting-started.md
CHANGED
|
@@ -169,20 +169,22 @@ export default [
|
|
|
169
169
|
|
|
170
170
|
### What `recommended` catches
|
|
171
171
|
|
|
172
|
-
The `recommended` config
|
|
173
|
-
|
|
174
|
-
| Category | Rules | Examples
|
|
175
|
-
| ------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
176
|
-
| Property validation | `known-property`, `valid-boolean-property`, `valid-sub-element` | Flags typos like `pading` or invalid boolean usage
|
|
177
|
-
| Value validation | `valid-value`, `valid-color-token`, `valid-custom-unit` | Catches `#nonexistent` tokens, bad unit syntax
|
|
178
|
-
| State validation | `valid-state-key`, `no-nested-state-map`, `require-default-state` | Validates state key syntax, ensures `''` default exists
|
|
179
|
-
| Structure | `valid-styles-structure`, `no-important`, `no-nested-selector` | Prevents `!important`, invalid nesting
|
|
180
|
-
| Static mode | `static-no-dynamic-values`, `static-valid-selector` | Enforces build-time constraints in `tastyStatic()`
|
|
181
|
-
| Style properties | `valid-preset`, `valid-recipe`, `valid-transition`, `valid-directional-modifier`, `valid-radius-shape` | Validates preset names, recipe references, transition syntax
|
|
172
|
+
The `recommended` config covers common correctness and style issues:
|
|
173
|
+
|
|
174
|
+
| Category | Rules | Examples |
|
|
175
|
+
| ------------------- | ------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------- |
|
|
176
|
+
| Property validation | `known-property`, `valid-boolean-property`, `valid-sub-element` | Flags typos like `pading` or invalid boolean usage |
|
|
177
|
+
| Value validation | `valid-value`, `valid-color-token`, `valid-custom-unit` | Catches `#nonexistent` tokens, bad unit syntax |
|
|
178
|
+
| State validation | `valid-state-key`, `no-nested-state-map`, `require-default-state` | Validates state key syntax, ensures `''` default exists |
|
|
179
|
+
| Structure | `valid-styles-structure`, `no-important`, `no-nested-selector` | Prevents `!important`, invalid nesting |
|
|
180
|
+
| Static mode | `static-no-dynamic-values`, `static-valid-selector` | Enforces build-time constraints in `tastyStatic()` |
|
|
181
|
+
| Style properties | `valid-preset`, `valid-recipe`, `valid-transition`, `valid-directional-modifier`, `valid-radius-shape` | Validates preset names, recipe references, transition syntax |
|
|
182
|
+
| Motion guidance | `no-raw-transition-duration` | Suggests timing tokens or the default timing for transition durations |
|
|
183
|
+
| Dynamic styles | `no-runtime-styles-mutation`, `no-style-spread` | Warns on JavaScript values and spreads inside runtime style objects |
|
|
182
184
|
|
|
183
185
|
### Strict config
|
|
184
186
|
|
|
185
|
-
For stricter governance, use `tasty.configs.strict`. It adds rules that
|
|
187
|
+
For stricter governance, use `tasty.configs.strict`. It adds rules that flag direct `styles` prop usage and other patterns:
|
|
186
188
|
|
|
187
189
|
```js
|
|
188
190
|
export default [tasty.configs.strict];
|
package/docs/methodology.md
CHANGED
|
@@ -236,7 +236,7 @@ const ProgressBar = tasty({
|
|
|
236
236
|
width: '$progress',
|
|
237
237
|
height: '100%',
|
|
238
238
|
fill: '#primary',
|
|
239
|
-
transition: 'width
|
|
239
|
+
transition: 'width',
|
|
240
240
|
},
|
|
241
241
|
},
|
|
242
242
|
elements: { Bar: 'div' },
|
|
@@ -534,7 +534,7 @@ See [Configuration](configuration.md) for the full `configure()` API.
|
|
|
534
534
|
|
|
535
535
|
- **Create styled wrappers** instead of passing `styles` directly — faster, composable, inspectable
|
|
536
536
|
- **Use design tokens and custom units** (`#text`, `2x`, `1r`) instead of raw CSS values
|
|
537
|
-
- **Use semantic transition names** (`transition: 'theme
|
|
537
|
+
- **Use semantic transition names** (`transition: 'theme'`) instead of listing CSS properties; omit the duration to use the motion tokens
|
|
538
538
|
- **Use `elements` prop** to declare typed sub-components for compound components
|
|
539
539
|
- **Use `styleProps`** to define what product engineers can customize
|
|
540
540
|
- **Use `modProps`** to expose known modifier states as clean component props
|
package/docs/pipeline.md
CHANGED
|
@@ -86,18 +86,22 @@ Output: CSSRule[]
|
|
|
86
86
|
|
|
87
87
|
### What It Does
|
|
88
88
|
|
|
89
|
-
Runs on each style's value map **before** any parsing
|
|
89
|
+
Runs on each style's value map **before** any parsing, when the map has at least three keys and one of them uses `&`. An atom is a **don't-care** when flipping it never changes which value the map resolves to; every key that mentions a don't-care atom is dropped.
|
|
90
90
|
|
|
91
91
|
### How It Works
|
|
92
92
|
|
|
93
|
-
1.
|
|
94
|
-
2.
|
|
95
|
-
3.
|
|
96
|
-
4. Drop
|
|
93
|
+
1. Split each key into its top-level `&` atoms. Keys containing `|`, `^`, or `,` at top level are a single opaque atom. The `_` floor (and a misused `_` key) is kept verbatim and left out of the analysis.
|
|
94
|
+
2. Treat the map as the cascade it is: the last authored key whose atoms all hold wins, and `''` is always the lowest priority.
|
|
95
|
+
3. An atom is a don't-care when, in every state, the cascade resolves to the same value with the atom present as with it absent. Only the states `(K₁ minus the atom) ∪ K₀`, for every key `K₁` that contains the atom and every key `K₀` that does not (or none), can tell the two apart, so the check is quadratic in the number of keys rather than exponential in atoms.
|
|
96
|
+
4. Drop every key that contains a don't-care atom. With the atom forced absent those keys never match, and by definition the result is unchanged.
|
|
97
|
+
|
|
98
|
+
The check is over the cascade, not over pairs of keys. In `{ '': A, checked: B, 'invalid & checked': C, disabled: A }`, `disabled` has the default's value, but it outranks `checked`: a checked, disabled element gets `A`, so `disabled` is not a don't-care. (An earlier pairwise rule — "every key with the atom has a same-value partner without it" — folded `disabled` into `''` here and lost that priority.)
|
|
99
|
+
|
|
100
|
+
Atoms are compared as strings and treated as independent. Real atoms can be related (`theme=dark` vs `theme=light`, nested media ranges); that only rules states out, so a don't-care over independent atoms is one for every real state too. Two guards keep the rewrite safe: a map with more than 32 distinct atoms is left unreduced, and a reduction that would leave the `_` floor alone with `''` (which means "use the floor", see Stage 1) is skipped.
|
|
97
101
|
|
|
98
102
|
### Why
|
|
99
103
|
|
|
100
|
-
Removing don't-care dimensions before parsing prevents combinatorial blowup in later stages. `mergeEntriesByValue`, `buildExclusiveConditions`, and materialization all see fewer entries and fewer spurious conditions.
|
|
104
|
+
Removing don't-care dimensions before parsing prevents combinatorial blowup in later stages. `mergeEntriesByValue`, `buildExclusiveConditions`, and materialization all see fewer entries and fewer spurious conditions.
|
|
101
105
|
|
|
102
106
|
### Example
|
|
103
107
|
|
|
@@ -197,6 +201,8 @@ The merge is safe iff for every entry `e_m` strictly between them in priority wi
|
|
|
197
201
|
|
|
198
202
|
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.
|
|
199
203
|
|
|
204
|
+
An intermediate whose condition always holds (a tautological key, or same-value keys that already merged into one, like `beta | !beta`) is checked like any other. Only the `''` default and the `_` floor are exempt from the check, and they are always the lowest priorities, so they are never intermediates.
|
|
205
|
+
|
|
200
206
|
### Why
|
|
201
207
|
|
|
202
208
|
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.
|
|
@@ -293,7 +299,9 @@ B: B & !A (applies only when A doesn't)
|
|
|
293
299
|
C: C & !A & !B (applies only when neither A nor B)
|
|
294
300
|
```
|
|
295
301
|
|
|
296
|
-
Each exclusive condition is passed through `simplifyCondition`. Entries that simplify to `FALSE` (impossible) are filtered out.
|
|
302
|
+
Each exclusive condition is passed through `simplifyCondition`. Entries that simplify to `FALSE` (impossible) are filtered out.
|
|
303
|
+
|
|
304
|
+
Every entry is added to the "prior" list, including one whose condition is `TRUE`. That can be a tautological key, or same-value keys that merged into one in Stage 1b (`alpha: X, '!alpha': X` → `TRUE`). Such an entry always applies at its priority, so negating it correctly makes every lower entry `FALSE`. The bare `''` default is `TRUE` too, but it is always the lowest priority, so no entry comes after it.
|
|
297
305
|
|
|
298
306
|
### `_` fallback floor
|
|
299
307
|
|
|
@@ -383,7 +391,7 @@ The pre-build Stage 2a pass doesn't need this because user-authored ORs aren't p
|
|
|
383
391
|
|
|
384
392
|
### Example (conceptual)
|
|
385
393
|
|
|
386
|
-
See the comment block in `exclusive.ts
|
|
394
|
+
See the comment block on `expandExclusiveOrs` in `exclusive.ts`: a default value whose higher-priority sibling is `@supports(...) & :has(...)` gets an exclusive of `!@supports | !:has`. Expansion yields one branch under `@supports (not ...)` and another under `@supports (...) { :not(:has()) }` instead of a bare `:not(:has())` rule.
|
|
387
395
|
|
|
388
396
|
---
|
|
389
397
|
|
|
@@ -742,3 +750,16 @@ Impossible combinations are detected at multiple levels (simplification, variant
|
|
|
742
750
|
### 4. Aggressive Caching
|
|
743
751
|
|
|
744
752
|
Parse, simplify, condition-to-CSS, and full-pipeline results are cached independently, enabling fast re-rendering when only parts of the style object change.
|
|
753
|
+
|
|
754
|
+
Cache keys must respect key order where it carries meaning. A state map resolves by key order, so `{ '': A, checked: B, disabled: C }` and `{ '': A, disabled: C, checked: B }` are different styles and must get different keys (and classes). Only the style keys of a styles object, including a sub-element's, are order-insensitive, so they may be sorted. `stringifyStyles` (pipeline cache) and `generateChunkCacheKey` (class allocation) both follow this rule.
|
|
755
|
+
|
|
756
|
+
---
|
|
757
|
+
|
|
758
|
+
## Testing Priority
|
|
759
|
+
|
|
760
|
+
Every stage above is an optimization that must leave one thing unchanged: in any state, the value that applies is the value of the last authored key whose condition holds. `src/test/state-oracle.ts` states that rule directly, with none of the pipeline's machinery, and two suites compare the pipeline against it:
|
|
761
|
+
|
|
762
|
+
- `src/pipeline/exclusive.test.ts` (Node) evaluates the conditions after each of Stages 0–3 on thousands of generated maps, and names the stage that disagrees.
|
|
763
|
+
- `src/pipeline/state-priority.test.ts` (browser) renders hand-written, permuted, and generated maps to CSS, applies every combination of states (modifiers, value modifiers, `:has()`, `@root`, `@parent`, `@own`, media, supports), and compares what the browser computes against the oracle. It also checks that rules stay mutually exclusive, which a correct computed value alone can hide. It runs through the pipeline, the runtime injector, and the SSR collector, with all maps mounted at once so a cache-key collision shows up.
|
|
764
|
+
|
|
765
|
+
A change to any stage should keep both green. When a generated map fails, the message includes the map, the failing states, and the CSS; the map is usually worth adding to the hand-written cases once it is reduced.
|
package/docs/plugins.md
CHANGED
package/docs/styles.md
CHANGED
|
@@ -566,15 +566,15 @@ When easing is provided without a duration, the default timing variable is used
|
|
|
566
566
|
| `zIndex` | `z-index` |
|
|
567
567
|
| `inset` | `inset`, `top`, `right`, `bottom`, `left` |
|
|
568
568
|
|
|
569
|
-
Default timing: `$transition` (or `${name}-transition` with `$transition` fallback per semantic name).
|
|
569
|
+
Default timing: `$transition` (or `${name}-transition` with `$transition` fallback per semantic name). Prefer omitting the duration or using a duration token instead of repeating raw time values across components. Explicit zero can disable motion.
|
|
570
570
|
|
|
571
571
|
```jsx
|
|
572
|
-
transition="theme
|
|
573
|
-
transition="fill
|
|
574
|
-
transition="fade
|
|
572
|
+
transition="theme"
|
|
573
|
+
transition="fill, radius"
|
|
574
|
+
transition="fade $transition ease-in"
|
|
575
575
|
transition="fill ease-in" // easing without duration (uses default timing)
|
|
576
576
|
transition="radius ease-in-out" // easing keyword only
|
|
577
|
-
transition="$$custom-prop
|
|
577
|
+
transition="$$custom-prop" // custom property transition
|
|
578
578
|
```
|
|
579
579
|
|
|
580
580
|
**Recognized easing keywords:** `ease`, `ease-in`, `ease-out`, `ease-in-out`, `linear`, `step-start`, `step-end`. CSS easing functions (`cubic-bezier(...)`, `steps(...)`, `linear(...)`) are also recognized.
|
|
@@ -583,6 +583,24 @@ If the name is not a semantic name, it is used as a literal CSS property name.
|
|
|
583
583
|
|
|
584
584
|
---
|
|
585
585
|
|
|
586
|
+
### `animation`
|
|
587
|
+
|
|
588
|
+
`animation` is the native CSS shorthand. Tasty parses tokens in its value and
|
|
589
|
+
tracks local `@keyframes` names referenced by it, so it needs no custom style
|
|
590
|
+
handler. Define a complete animation with the shorthand, using a configured
|
|
591
|
+
duration token where appropriate (for example,
|
|
592
|
+
`animation: 'pulse $animation-duration ease-in infinite'`).
|
|
593
|
+
|
|
594
|
+
Use `animationDuration`, `animationTimeline`, `animationRange`, and other CSS
|
|
595
|
+
longhands when changing just one part of an existing animation in a state or
|
|
596
|
+
component extension. Setting `animation` resets omitted parts, including its
|
|
597
|
+
timeline and range. The same principle applies to `transitionDuration` and
|
|
598
|
+
other transition longhands when a base `transition` is already defined.
|
|
599
|
+
`transitionBehavior` remains a separate CSS longhand; Tasty's semantic
|
|
600
|
+
`transition` syntax covers name, timing, easing, and delay.
|
|
601
|
+
|
|
602
|
+
---
|
|
603
|
+
|
|
586
604
|
## Scrollbar & Overflow
|
|
587
605
|
|
|
588
606
|
### `scrollbar`
|
package/docs/tasty-static.md
CHANGED