@tenphi/tasty 0.0.0-snapshot.bae20d4 → 0.0.0-snapshot.bbd36bd
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 +309 -293
- package/dist/astro-CeYENy2x.js +301 -0
- package/dist/astro-CeYENy2x.js.map +1 -0
- package/dist/{ssr/async-storage.js → async-storage-DKK-wTD4.js} +17 -8
- package/dist/async-storage-DKK-wTD4.js.map +1 -0
- package/dist/babel-DWCsafYw.d.ts +83 -0
- package/dist/collector-B3OsM252.js +327 -0
- package/dist/collector-B3OsM252.js.map +1 -0
- package/dist/collector-BTVXj2hS.d.ts +163 -0
- package/dist/config-B3gPdCqd.js +12421 -0
- package/dist/config-B3gPdCqd.js.map +1 -0
- package/dist/config-LfIDmVHx.d.ts +1363 -0
- package/dist/context-CA8YKeMn.js +24 -0
- package/dist/context-CA8YKeMn.js.map +1 -0
- package/dist/core/index.d.ts +5 -34
- package/dist/core/index.js +6 -27
- package/dist/core-DGm0CFHP.js +1732 -0
- package/dist/core-DGm0CFHP.js.map +1 -0
- package/dist/css-resources-Cyl_axbI.js +149 -0
- package/dist/css-resources-Cyl_axbI.js.map +1 -0
- package/dist/{zero/extractor.js → css-writer-Bgowobbx.js} +188 -13
- package/dist/css-writer-Bgowobbx.js.map +1 -0
- package/dist/{ssr/format-global-rules.js → format-global-rules-DklyaXv-.js} +3 -3
- package/dist/format-global-rules-DklyaXv-.js.map +1 -0
- package/dist/{ssr/format-rules.js → format-rules-XRw9u7d4.js} +41 -7
- package/dist/format-rules-XRw9u7d4.js.map +1 -0
- package/dist/hydrate-CNOmZprz.js +37 -0
- package/dist/hydrate-CNOmZprz.js.map +1 -0
- package/dist/index-Bm9ltvdH.d.ts +1933 -0
- package/dist/index-BmogEzTo.d.ts +1575 -0
- package/dist/index.d.ts +5 -49
- package/dist/index.js +921 -33
- package/dist/index.js.map +1 -0
- package/dist/keyframes-DE-OE76F.js +535 -0
- package/dist/keyframes-DE-OE76F.js.map +1 -0
- package/dist/{utils/merge-styles.d.ts → merge-styles-BcLl1u_d.d.ts} +3 -3
- package/dist/{utils/merge-styles.js → merge-styles-DuoZEsm9.js} +4 -6
- package/dist/merge-styles-DuoZEsm9.js.map +1 -0
- package/dist/{utils/resolve-recipes.js → resolve-recipes-H9NqOQuP.js} +5 -8
- package/dist/resolve-recipes-H9NqOQuP.js.map +1 -0
- package/dist/ssr/astro-client.d.ts +1 -0
- package/dist/ssr/astro-client.js +19 -0
- package/dist/ssr/astro-client.js.map +1 -0
- package/dist/ssr/astro-middleware-extract-static.d.ts +11 -0
- package/dist/ssr/astro-middleware-extract-static.js +9 -0
- package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
- package/dist/ssr/astro-middleware-extract.d.ts +11 -0
- package/dist/ssr/astro-middleware-extract.js +9 -0
- package/dist/ssr/astro-middleware-extract.js.map +1 -0
- package/dist/ssr/astro-middleware-static.d.ts +18 -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 +19 -0
- package/dist/ssr/astro-middleware.js +19 -0
- package/dist/ssr/astro-middleware.js.map +1 -0
- package/dist/ssr/astro.d.ts +117 -11
- package/dist/ssr/astro.js +2 -65
- package/dist/ssr/index.d.ts +37 -5
- package/dist/ssr/index.js +7 -9
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/next-config.d.ts +66 -0
- package/dist/ssr/next-config.js +115 -0
- package/dist/ssr/next-config.js.map +1 -0
- package/dist/ssr/next.d.ts +14 -7
- package/dist/ssr/next.js +40 -20
- package/dist/ssr/next.js.map +1 -1
- package/dist/ssr-collector-ref-COs_ioWl.js +29 -0
- package/dist/ssr-collector-ref-COs_ioWl.js.map +1 -0
- package/dist/static/index.d.ts +91 -5
- package/dist/static/index.js +49 -4
- package/dist/static/index.js.map +1 -0
- package/dist/static/inject.d.ts +5 -0
- package/dist/static/inject.js +17 -0
- package/dist/static/inject.js.map +1 -0
- package/dist/zero/babel.d.ts +2 -155
- package/dist/zero/babel.js +183 -51
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +81 -3
- package/dist/zero/index.js +2 -4
- package/dist/zero/next.d.ts +13 -1
- package/dist/zero/next.js +6 -5
- package/dist/zero/next.js.map +1 -1
- package/docs/README.md +39 -0
- package/docs/adoption.md +72 -35
- package/docs/ai-agents.md +224 -0
- package/docs/comparison.md +88 -53
- package/docs/configuration.md +623 -63
- package/docs/debug.md +172 -342
- package/docs/design-system.md +83 -29
- package/docs/dsl.md +614 -133
- package/docs/getting-started.md +80 -43
- package/docs/injector.md +159 -53
- package/docs/methodology.md +178 -31
- package/docs/migration-v3.md +285 -0
- package/docs/pipeline.md +741 -0
- package/docs/plugins.md +353 -0
- package/docs/react-api.md +681 -0
- package/docs/runtime-benchmarks.md +351 -0
- package/docs/ssr.md +356 -128
- package/docs/styles.md +103 -32
- package/docs/tasty-static.md +227 -65
- package/package.json +83 -22
- package/tasty.config.ts +6 -0
- package/dist/_virtual/_rolldown/runtime.js +0 -8
- package/dist/chunks/cacheKey.js +0 -78
- package/dist/chunks/cacheKey.js.map +0 -1
- package/dist/chunks/definitions.d.ts +0 -37
- package/dist/chunks/definitions.js +0 -259
- package/dist/chunks/definitions.js.map +0 -1
- package/dist/chunks/renderChunk.js +0 -60
- package/dist/chunks/renderChunk.js.map +0 -1
- package/dist/config.d.ts +0 -323
- package/dist/config.js +0 -465
- package/dist/config.js.map +0 -1
- package/dist/debug.d.ts +0 -204
- package/dist/debug.js +0 -733
- package/dist/debug.js.map +0 -1
- package/dist/hooks/useGlobalStyles.d.ts +0 -30
- package/dist/hooks/useGlobalStyles.js +0 -83
- package/dist/hooks/useGlobalStyles.js.map +0 -1
- package/dist/hooks/useKeyframes.d.ts +0 -56
- package/dist/hooks/useKeyframes.js +0 -69
- package/dist/hooks/useKeyframes.js.map +0 -1
- package/dist/hooks/useProperty.d.ts +0 -79
- package/dist/hooks/useProperty.js +0 -114
- package/dist/hooks/useProperty.js.map +0 -1
- package/dist/hooks/useRawCSS.d.ts +0 -53
- package/dist/hooks/useRawCSS.js +0 -40
- package/dist/hooks/useRawCSS.js.map +0 -1
- package/dist/hooks/useStyles.d.ts +0 -45
- package/dist/hooks/useStyles.js +0 -249
- package/dist/hooks/useStyles.js.map +0 -1
- package/dist/injector/index.d.ts +0 -165
- package/dist/injector/index.js +0 -162
- package/dist/injector/index.js.map +0 -1
- package/dist/injector/injector.d.ts +0 -148
- package/dist/injector/injector.js +0 -430
- package/dist/injector/injector.js.map +0 -1
- package/dist/injector/sheet-manager.d.ts +0 -136
- package/dist/injector/sheet-manager.js +0 -729
- package/dist/injector/sheet-manager.js.map +0 -1
- package/dist/injector/types.d.ts +0 -144
- package/dist/keyframes/index.js +0 -206
- package/dist/keyframes/index.js.map +0 -1
- package/dist/parser/classify.js +0 -320
- package/dist/parser/classify.js.map +0 -1
- package/dist/parser/const.js +0 -33
- package/dist/parser/const.js.map +0 -1
- package/dist/parser/lru.js +0 -109
- package/dist/parser/lru.js.map +0 -1
- package/dist/parser/parser.d.ts +0 -25
- package/dist/parser/parser.js +0 -116
- package/dist/parser/parser.js.map +0 -1
- package/dist/parser/tokenizer.js +0 -69
- package/dist/parser/tokenizer.js.map +0 -1
- package/dist/parser/types.d.ts +0 -51
- package/dist/parser/types.js +0 -46
- package/dist/parser/types.js.map +0 -1
- package/dist/pipeline/conditions.d.ts +0 -134
- package/dist/pipeline/conditions.js +0 -406
- package/dist/pipeline/conditions.js.map +0 -1
- package/dist/pipeline/exclusive.js +0 -231
- package/dist/pipeline/exclusive.js.map +0 -1
- package/dist/pipeline/index.d.ts +0 -53
- package/dist/pipeline/index.js +0 -670
- package/dist/pipeline/index.js.map +0 -1
- package/dist/pipeline/materialize.js +0 -1105
- package/dist/pipeline/materialize.js.map +0 -1
- package/dist/pipeline/parseStateKey.d.ts +0 -15
- package/dist/pipeline/parseStateKey.js +0 -447
- package/dist/pipeline/parseStateKey.js.map +0 -1
- package/dist/pipeline/simplify.js +0 -516
- package/dist/pipeline/simplify.js.map +0 -1
- package/dist/pipeline/warnings.js +0 -18
- package/dist/pipeline/warnings.js.map +0 -1
- package/dist/plugins/okhsl-plugin.d.ts +0 -35
- package/dist/plugins/okhsl-plugin.js +0 -98
- package/dist/plugins/okhsl-plugin.js.map +0 -1
- package/dist/plugins/types.d.ts +0 -76
- package/dist/properties/index.js +0 -223
- package/dist/properties/index.js.map +0 -1
- package/dist/properties/property-type-resolver.d.ts +0 -24
- package/dist/properties/property-type-resolver.js +0 -91
- package/dist/properties/property-type-resolver.js.map +0 -1
- package/dist/ssr/astro.js.map +0 -1
- package/dist/ssr/async-storage.d.ts +0 -17
- package/dist/ssr/async-storage.js.map +0 -1
- package/dist/ssr/collect-auto-properties.js +0 -40
- package/dist/ssr/collect-auto-properties.js.map +0 -1
- package/dist/ssr/collector.d.ts +0 -85
- package/dist/ssr/collector.js +0 -183
- package/dist/ssr/collector.js.map +0 -1
- package/dist/ssr/context.d.ts +0 -8
- package/dist/ssr/context.js +0 -14
- package/dist/ssr/context.js.map +0 -1
- package/dist/ssr/format-global-rules.js.map +0 -1
- package/dist/ssr/format-keyframes.js +0 -70
- package/dist/ssr/format-keyframes.js.map +0 -1
- package/dist/ssr/format-property.js +0 -50
- package/dist/ssr/format-property.js.map +0 -1
- package/dist/ssr/format-rules.js.map +0 -1
- package/dist/ssr/hydrate.d.ts +0 -22
- package/dist/ssr/hydrate.js +0 -50
- package/dist/ssr/hydrate.js.map +0 -1
- package/dist/ssr/ssr-collector-ref.js +0 -12
- package/dist/ssr/ssr-collector-ref.js.map +0 -1
- package/dist/states/index.d.ts +0 -49
- package/dist/states/index.js +0 -169
- package/dist/states/index.js.map +0 -1
- package/dist/static/tastyStatic.d.ts +0 -46
- package/dist/static/tastyStatic.js +0 -31
- package/dist/static/tastyStatic.js.map +0 -1
- package/dist/static/types.d.ts +0 -49
- package/dist/static/types.js +0 -24
- package/dist/static/types.js.map +0 -1
- package/dist/styles/align.d.ts +0 -15
- package/dist/styles/align.js +0 -14
- package/dist/styles/align.js.map +0 -1
- package/dist/styles/border.d.ts +0 -25
- package/dist/styles/border.js +0 -114
- package/dist/styles/border.js.map +0 -1
- package/dist/styles/color.d.ts +0 -14
- package/dist/styles/color.js +0 -27
- package/dist/styles/color.js.map +0 -1
- package/dist/styles/createStyle.js +0 -80
- package/dist/styles/createStyle.js.map +0 -1
- package/dist/styles/dimension.js +0 -97
- package/dist/styles/dimension.js.map +0 -1
- package/dist/styles/display.d.ts +0 -37
- package/dist/styles/display.js +0 -67
- package/dist/styles/display.js.map +0 -1
- package/dist/styles/fade.d.ts +0 -15
- package/dist/styles/fade.js +0 -58
- package/dist/styles/fade.js.map +0 -1
- package/dist/styles/fill.d.ts +0 -42
- package/dist/styles/fill.js +0 -52
- package/dist/styles/fill.js.map +0 -1
- package/dist/styles/flow.d.ts +0 -16
- package/dist/styles/flow.js +0 -12
- package/dist/styles/flow.js.map +0 -1
- package/dist/styles/gap.d.ts +0 -31
- package/dist/styles/gap.js +0 -37
- package/dist/styles/gap.js.map +0 -1
- package/dist/styles/height.d.ts +0 -17
- package/dist/styles/height.js +0 -20
- package/dist/styles/height.js.map +0 -1
- package/dist/styles/index.d.ts +0 -2
- package/dist/styles/index.js +0 -9
- package/dist/styles/index.js.map +0 -1
- package/dist/styles/inset.d.ts +0 -52
- package/dist/styles/inset.js +0 -150
- package/dist/styles/inset.js.map +0 -1
- package/dist/styles/justify.d.ts +0 -15
- package/dist/styles/justify.js +0 -14
- package/dist/styles/justify.js.map +0 -1
- package/dist/styles/list.d.ts +0 -16
- package/dist/styles/list.js +0 -98
- package/dist/styles/list.js.map +0 -1
- package/dist/styles/margin.d.ts +0 -24
- package/dist/styles/margin.js +0 -104
- package/dist/styles/margin.js.map +0 -1
- package/dist/styles/outline.d.ts +0 -29
- package/dist/styles/outline.js +0 -65
- package/dist/styles/outline.js.map +0 -1
- package/dist/styles/padding.d.ts +0 -24
- package/dist/styles/padding.js +0 -104
- package/dist/styles/padding.js.map +0 -1
- package/dist/styles/predefined.d.ts +0 -71
- package/dist/styles/predefined.js +0 -238
- package/dist/styles/predefined.js.map +0 -1
- package/dist/styles/preset.d.ts +0 -47
- package/dist/styles/preset.js +0 -126
- package/dist/styles/preset.js.map +0 -1
- package/dist/styles/radius.d.ts +0 -14
- package/dist/styles/radius.js +0 -51
- package/dist/styles/radius.js.map +0 -1
- package/dist/styles/scrollbar.d.ts +0 -25
- package/dist/styles/scrollbar.js +0 -48
- package/dist/styles/scrollbar.js.map +0 -1
- package/dist/styles/shadow.d.ts +0 -14
- package/dist/styles/shadow.js +0 -24
- package/dist/styles/shadow.js.map +0 -1
- package/dist/styles/transition.d.ts +0 -14
- package/dist/styles/transition.js +0 -158
- package/dist/styles/transition.js.map +0 -1
- package/dist/styles/types.d.ts +0 -508
- package/dist/styles/width.d.ts +0 -17
- package/dist/styles/width.js +0 -20
- package/dist/styles/width.js.map +0 -1
- package/dist/tasty.d.ts +0 -981
- package/dist/tasty.js +0 -219
- package/dist/tasty.js.map +0 -1
- package/dist/types.d.ts +0 -184
- package/dist/utils/cache-wrapper.js +0 -22
- package/dist/utils/cache-wrapper.js.map +0 -1
- package/dist/utils/case-converter.js +0 -8
- package/dist/utils/case-converter.js.map +0 -1
- package/dist/utils/color-math.d.ts +0 -45
- package/dist/utils/color-math.js +0 -749
- package/dist/utils/color-math.js.map +0 -1
- package/dist/utils/color-space.d.ts +0 -5
- package/dist/utils/color-space.js +0 -228
- package/dist/utils/color-space.js.map +0 -1
- package/dist/utils/colors.d.ts +0 -5
- package/dist/utils/colors.js +0 -11
- package/dist/utils/colors.js.map +0 -1
- package/dist/utils/css-types.d.ts +0 -7
- package/dist/utils/dotize.d.ts +0 -26
- package/dist/utils/dotize.js +0 -122
- package/dist/utils/dotize.js.map +0 -1
- package/dist/utils/filter-base-props.d.ts +0 -15
- package/dist/utils/filter-base-props.js +0 -45
- package/dist/utils/filter-base-props.js.map +0 -1
- package/dist/utils/get-display-name.d.ts +0 -7
- package/dist/utils/get-display-name.js +0 -10
- package/dist/utils/get-display-name.js.map +0 -1
- package/dist/utils/has-keys.js +0 -13
- package/dist/utils/has-keys.js.map +0 -1
- package/dist/utils/is-dev-env.js +0 -19
- package/dist/utils/is-dev-env.js.map +0 -1
- package/dist/utils/is-valid-element-type.js +0 -15
- package/dist/utils/is-valid-element-type.js.map +0 -1
- package/dist/utils/merge-styles.js.map +0 -1
- package/dist/utils/mod-attrs.d.ts +0 -8
- package/dist/utils/mod-attrs.js +0 -21
- package/dist/utils/mod-attrs.js.map +0 -1
- package/dist/utils/process-tokens.d.ts +0 -21
- package/dist/utils/process-tokens.js +0 -91
- package/dist/utils/process-tokens.js.map +0 -1
- package/dist/utils/resolve-recipes.d.ts +0 -17
- package/dist/utils/resolve-recipes.js.map +0 -1
- package/dist/utils/selector-transform.js +0 -32
- package/dist/utils/selector-transform.js.map +0 -1
- package/dist/utils/string.js +0 -8
- package/dist/utils/string.js.map +0 -1
- package/dist/utils/styles.d.ts +0 -101
- package/dist/utils/styles.js +0 -223
- package/dist/utils/styles.js.map +0 -1
- package/dist/utils/typography.d.ts +0 -47
- package/dist/utils/typography.js +0 -43
- package/dist/utils/typography.js.map +0 -1
- package/dist/utils/warnings.d.ts +0 -16
- package/dist/utils/warnings.js +0 -16
- package/dist/utils/warnings.js.map +0 -1
- package/dist/zero/css-writer.d.ts +0 -45
- package/dist/zero/css-writer.js +0 -74
- package/dist/zero/css-writer.js.map +0 -1
- package/dist/zero/extractor.d.ts +0 -24
- package/dist/zero/extractor.js.map +0 -1
- package/docs/PIPELINE.md +0 -519
- package/docs/runtime.md +0 -291
package/docs/comparison.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
# Comparison
|
|
2
2
|
|
|
3
|
-
Tasty is
|
|
3
|
+
Use this guide when you are deciding whether Tasty is the right tool. If you have already decided to adopt it and need rollout guidance, use the [Adoption Guide](adoption.md) instead.
|
|
4
|
+
|
|
5
|
+
Tasty is CSS-in-JS for React design systems. It is built for the point where reusable components have enough intersecting states, variants, themes, and extension rules that ordinary selector competition becomes hard to reason about.
|
|
6
|
+
|
|
7
|
+
Its distinctive guarantee is narrow and concrete: each property’s state map compiles into selectors that cannot compete, so one declared branch wins regardless of CSS source order.
|
|
8
|
+
|
|
9
|
+
That does not require a big upfront configuration step. Tasty's built-in units and normal CSS color values work out of the box, and `okhsl(...)` is available immediately as the recommended path for color authoring. The extra setup comes later if a team wants shared tokens, aliases, recipes, or stricter conventions.
|
|
4
10
|
|
|
5
11
|
Most styling tools focus on one of these layers:
|
|
6
12
|
|
|
@@ -10,7 +16,7 @@ Most styling tools focus on one of these layers:
|
|
|
10
16
|
- utility composition
|
|
11
17
|
- atomic CSS generation
|
|
12
18
|
|
|
13
|
-
|
|
19
|
+
For design-system teams, that state model can sit alongside tokens, typed style props, recipes, custom units, and sub-element rules. Tasty can therefore define the styling language exposed by shared components, not just another syntax for writing CSS.
|
|
14
20
|
|
|
15
21
|
That is why syntax-level comparisons are often shallow. The more meaningful comparison is about:
|
|
16
22
|
|
|
@@ -23,14 +29,14 @@ That is why syntax-level comparisons are often shallow. The more meaningful comp
|
|
|
23
29
|
|
|
24
30
|
## High-level positioning
|
|
25
31
|
|
|
26
|
-
| System
|
|
27
|
-
|
|
28
|
-
| **Tasty**
|
|
29
|
-
| **Tailwind CSS**
|
|
30
|
-
| **Panda CSS**
|
|
31
|
-
| **vanilla-extract**
|
|
32
|
-
| **StyleX**
|
|
33
|
-
| **Stitches** (deprecated) **/ Emotion** | Component-first CSS-in-JS
|
|
32
|
+
| System | Best described as | Main authoring model | Conflict model | RSC / zero-JS SSG | Best fit |
|
|
33
|
+
| --------------------------------------- | ---------------------------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------- | --------------------------------------------- | ------------------------------------------------------------- |
|
|
34
|
+
| **Tasty** | CSS-in-JS for React design systems | CSS-like objects with state maps, tokens, recipes, style props, and sub-elements | **Mutually exclusive selector resolution** for stateful styles | Yes — hook-free, server components by default | Teams building long-lived shared component APIs |
|
|
35
|
+
| **Tailwind CSS** | Utility-first styling framework | Utility classes in markup | Utility composition, variants, and framework-controlled ordering | Yes — no JS runtime | Product teams optimizing for speed and direct authoring |
|
|
36
|
+
| **Panda CSS** | Typed styling engine with atomic output | Typed style objects, recipes, generated primitives, style props | Atomic CSS with static analysis | Yes — build-time extraction | Teams wanting a DS-friendly engine with typed primitives |
|
|
37
|
+
| **vanilla-extract** | Zero-runtime TS-native stylesheet system | `.css.ts` files, theme contracts, style composition | Standard CSS semantics | Yes — build-time extraction | Teams wanting static CSS and low-level control |
|
|
38
|
+
| **StyleX** | Compiler-based atomic styling system | JS authoring with compiler-generated atomic CSS | Compiler-controlled atomic composition | Yes — compiler-extracted | Large app teams wanting optimized, predictable atomic styling |
|
|
39
|
+
| **Stitches** (deprecated) **/ Emotion** | Component-first CSS-in-JS | Styled components, `css()` APIs, object/string styles | Composition within CSS-in-JS rules | No — requires `'use client'` | Teams optimizing for component DX and flexible styling |
|
|
34
40
|
|
|
35
41
|
---
|
|
36
42
|
|
|
@@ -63,8 +69,12 @@ This is especially relevant for components with intersecting states such as:
|
|
|
63
69
|
Here is a minimal example. Two CSS rules for a button's background — one for `:hover`, one for `[disabled]`:
|
|
64
70
|
|
|
65
71
|
```css
|
|
66
|
-
.btn:hover
|
|
67
|
-
|
|
72
|
+
.btn:hover {
|
|
73
|
+
background: dodgerblue;
|
|
74
|
+
}
|
|
75
|
+
.btn[disabled] {
|
|
76
|
+
background: gray;
|
|
77
|
+
}
|
|
68
78
|
```
|
|
69
79
|
|
|
70
80
|
When the button is both hovered **and** disabled, both selectors match with equal specificity. The last rule in source order wins. Swap the two lines and the visual behavior silently reverses — a hovered disabled button turns blue instead of gray.
|
|
@@ -75,18 +85,18 @@ In Tasty, the same intent is declared as a state map:
|
|
|
75
85
|
fill: {
|
|
76
86
|
'': '#primary',
|
|
77
87
|
':hover': '#primary-hover',
|
|
78
|
-
'disabled': '#surface',
|
|
88
|
+
'[disabled]': '#surface',
|
|
79
89
|
}
|
|
80
90
|
```
|
|
81
91
|
|
|
82
|
-
|
|
92
|
+
Because `[disabled]` is declared later, it has higher priority. Tasty excludes disabled buttons from the hover selector, so exactly one background rule matches. The outcome is defined by the state map, not by which CSS rule comes last.
|
|
83
93
|
|
|
84
94
|
That makes Tasty less of a "better way to write CSS objects" and more of a **state-aware style compiler for design systems**.
|
|
85
95
|
|
|
86
|
-
Beyond state resolution, Tasty
|
|
96
|
+
Beyond state resolution, Tasty also provides several structural capabilities that reinforce the design-system layer:
|
|
87
97
|
|
|
88
|
-
- **CSS properties as typed React props** — `styleProps` lets a component expose selected style properties as normal props (`<Button placeSelf="end">`), including state maps for responsive values.
|
|
89
|
-
- **Sub-element styling** — Compound components declare inner parts via capitalized keys in `styles` and `data-element` attributes. States, tokens, and recipes apply across the entire element tree from a single definition. See [
|
|
98
|
+
- **CSS properties as typed React props** — `styleProps` lets a component expose selected style properties as normal props (`<Button placeSelf="end">`), including state maps for responsive values. This keeps layout and composition controls inside a governed component API instead of pushing teams back to ad hoc styling escapes.
|
|
99
|
+
- **Sub-element styling** — Compound components declare inner parts via capitalized keys in `styles` and `data-element` attributes. States, tokens, and recipes apply across the entire element tree from a single definition. See [React API — Sub-element Styling](react-api.md#sub-element-styling).
|
|
90
100
|
- **Auto-inferred `@property`** — When a custom property is assigned a concrete value, Tasty infers the CSS `@property` syntax and registers it automatically, enabling smooth transitions on custom properties without manual declarations.
|
|
91
101
|
- **AI-friendly style definitions** — Style definitions are declarative, self-contained, and structurally consistent. AI tools can read, refactor, and generate Tasty styles as confidently as a human — no hidden cascade logic or implicit ordering to second-guess.
|
|
92
102
|
- **Companion ecosystem** — An [ESLint plugin](https://github.com/tenphi/eslint-plugin-tasty) with 27 lint rules, a [VS Code extension](https://github.com/tenphi/tasty-vscode-extension) for syntax highlighting, and [Glaze](https://github.com/tenphi/glaze) for OKHSL color theme generation with automatic WCAG contrast solving.
|
|
@@ -103,7 +113,7 @@ Its strength is speed: developers compose utilities directly where they use them
|
|
|
103
113
|
|
|
104
114
|
Tasty solves a different problem.
|
|
105
115
|
|
|
106
|
-
Tasty is more appropriate when styling should be exposed through a **design-system-owned API** rather than through raw utility composition.
|
|
116
|
+
Tasty is more appropriate when styling should be exposed through a **design-system-owned API** rather than through raw utility composition. You can start using Tasty immediately with its built-in DSL, but it becomes especially compelling when a team wants to define:
|
|
107
117
|
|
|
108
118
|
- approved style props
|
|
109
119
|
- semantic tokens
|
|
@@ -118,23 +128,43 @@ So this is not mainly a comparison of syntax. It is a comparison of **governance
|
|
|
118
128
|
- Tailwind: developers author directly with framework vocabulary
|
|
119
129
|
- Tasty: design-system authors define the vocabulary product teams consume
|
|
120
130
|
|
|
121
|
-
Tailwind is
|
|
131
|
+
Tailwind is a stronger fit for fast product styling with framework-owned vocabulary. Tasty is a stronger fit when styling should be exposed through a design-system-owned API and state resolution needs to stay deterministic as the component model grows.
|
|
122
132
|
|
|
123
133
|
To make this concrete, consider a button with `hover`, `disabled`, and `theme=danger` states.
|
|
124
134
|
|
|
125
135
|
**Plain CSS** — you need a selector for every intersection, and equal-specificity rules depend on source order:
|
|
126
136
|
|
|
127
137
|
```css
|
|
128
|
-
.btn {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
138
|
+
.btn {
|
|
139
|
+
background: var(--primary);
|
|
140
|
+
color: white;
|
|
141
|
+
cursor: pointer;
|
|
142
|
+
}
|
|
143
|
+
.btn:hover {
|
|
144
|
+
background: var(--primary-hover);
|
|
145
|
+
}
|
|
146
|
+
.btn:active {
|
|
147
|
+
background: var(--primary-pressed);
|
|
148
|
+
}
|
|
149
|
+
.btn[disabled] {
|
|
150
|
+
background: var(--surface);
|
|
151
|
+
color: var(--text-40);
|
|
152
|
+
cursor: not-allowed;
|
|
153
|
+
}
|
|
132
154
|
|
|
133
155
|
/* theme=danger overrides — must repeat disabled/hover/active */
|
|
134
|
-
.btn[data-theme=
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
.btn[data-theme=
|
|
156
|
+
.btn[data-theme='danger'] {
|
|
157
|
+
background: var(--danger);
|
|
158
|
+
}
|
|
159
|
+
.btn[data-theme='danger']:hover {
|
|
160
|
+
background: var(--danger-hover);
|
|
161
|
+
}
|
|
162
|
+
.btn[data-theme='danger']:active {
|
|
163
|
+
background: var(--danger-pressed);
|
|
164
|
+
}
|
|
165
|
+
.btn[data-theme='danger'][disabled] {
|
|
166
|
+
background: var(--surface);
|
|
167
|
+
}
|
|
138
168
|
|
|
139
169
|
/* Bug: .btn:hover and .btn[disabled] have the same specificity.
|
|
140
170
|
A hovered disabled button gets :hover styles — unless source order saves you. */
|
|
@@ -166,18 +196,18 @@ const Button = tasty({
|
|
|
166
196
|
'': '#primary',
|
|
167
197
|
':hover': '#primary-hover',
|
|
168
198
|
':active': '#primary-pressed',
|
|
169
|
-
|
|
199
|
+
disabled: '#surface',
|
|
170
200
|
'theme=danger': '#danger',
|
|
171
201
|
'theme=danger & :hover': '#danger-hover',
|
|
172
202
|
'theme=danger & :active': '#danger-pressed',
|
|
173
203
|
},
|
|
174
204
|
color: {
|
|
175
205
|
'': '#on-primary',
|
|
176
|
-
|
|
206
|
+
disabled: '#text.40',
|
|
177
207
|
},
|
|
178
208
|
cursor: {
|
|
179
209
|
'': 'pointer',
|
|
180
|
-
|
|
210
|
+
disabled: 'not-allowed',
|
|
181
211
|
},
|
|
182
212
|
},
|
|
183
213
|
});
|
|
@@ -229,13 +259,12 @@ Tasty is more opinionated.
|
|
|
229
259
|
|
|
230
260
|
It behaves less like "TypeScript that outputs CSS" and more like a **state-aware style compiler**. It is designed to encode higher-level styling semantics rather than only expose CSS primitives in typed form.
|
|
231
261
|
|
|
232
|
-
This also makes Tasty's
|
|
262
|
+
This also makes Tasty's delivery model notable:
|
|
233
263
|
|
|
234
|
-
-
|
|
235
|
-
- `tastyStatic()` with the Babel plugin produces static class
|
|
236
|
-
- In static mode, the output is plain CSS + class names, so it can be used with any JavaScript framework — not only React
|
|
264
|
+
- `tasty()` components are hook-free and work as React Server Components. In server-only contexts, they produce HTML + CSS with zero Tasty styling runtime in the browser while retaining the full React feature set. Astro without islands is the concrete integration; server-only Next.js RSC uses the same architecture.
|
|
265
|
+
- `tastyStatic()` with the Babel plugin produces static class-name objects via build-time extraction, with no React dependency — the output works with any JavaScript framework.
|
|
237
266
|
|
|
238
|
-
|
|
267
|
+
React component features like `styleProps`, sub-element components, and dynamic variants are available in the `tasty()` path whether it renders on the server or in the browser. The `tastyStatic()` path is framework-agnostic but limited to the DSL, tokens, and state logic.
|
|
239
268
|
|
|
240
269
|
So the tradeoff is roughly:
|
|
241
270
|
|
|
@@ -293,32 +322,32 @@ It is less focused on "how do I style this component ergonomically right now?" a
|
|
|
293
322
|
- what should be allowed or constrained?
|
|
294
323
|
- how do we keep style behavior deterministic as the system grows?
|
|
295
324
|
|
|
296
|
-
So while Stitches and Emotion are strong tools for building components, Tasty is more naturally positioned as
|
|
325
|
+
So while Stitches and Emotion are strong tools for building components, Tasty is more naturally positioned as the **styling engine underneath a design system’s component API**.
|
|
297
326
|
|
|
298
327
|
That makes it narrower in audience, but deeper in architectural ambition.
|
|
299
328
|
|
|
300
|
-
Tasty's
|
|
329
|
+
There is also a fundamental architectural difference: Emotion and styled-components rely on React context and hooks internally, which means they require `'use client'` in modern React and cannot run as React Server Components. Tasty's style functions and `tasty()` components are hook-free, so they work as server components by default and ship no Tasty styling runtime in server-only contexts. This is not a minor compatibility detail — it means Tasty-based components stay as server components until _your_ code needs interactivity, while Emotion and styled-components force the client boundary at the styling layer.
|
|
330
|
+
|
|
331
|
+
For teams evaluating runtime styling at scale, Tasty also documents its runtime benchmarks and caching model in the main [README](../README.md#performance). That matters, but it is still secondary to the core question of whether you want Tasty's deterministic selector model.
|
|
301
332
|
|
|
302
333
|
---
|
|
303
334
|
|
|
304
|
-
##
|
|
335
|
+
## Where styles are computed
|
|
305
336
|
|
|
306
337
|
Tasty is not limited to one execution model.
|
|
307
338
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
That distinction matters.
|
|
339
|
+
Zero-runtime delivery is an outcome, not a synonym for `tastyStatic()`. `tasty()` computes styles during React rendering, but that rendering can happen only on the server. In that case it produces HTML + CSS and ships **zero Tasty styling runtime** to the browser. The full feature set — `styleProps`, sub-elements, variants, state maps — remains available. Astro's `tastyIntegration({ islands: false })` is the explicit setup for this path. Server-only Next.js RSC follows the same architecture; verify the generated output for the target deployment.
|
|
311
340
|
|
|
312
|
-
|
|
341
|
+
Client JavaScript only enters the picture when a component needs React interactivity (state, effects, event handlers) — and that is the consuming component's decision, never Tasty's. Tasty never forces the `'use client'` boundary.
|
|
313
342
|
|
|
314
|
-
|
|
343
|
+
`tastyStatic()` with the Babel plugin reaches zero-runtime delivery differently: CSS is extracted **during the build**, without React. The output is framework-agnostic — any JavaScript framework can consume the resulting class names and CSS. This makes Tasty usable as the compiler layer underneath a design-system implementation, even outside the React ecosystem.
|
|
315
344
|
|
|
316
|
-
The tradeoff is that some capabilities — `styleProps`, sub-element components (`<Card.Title>`), dynamic variants — are tied to the
|
|
345
|
+
The tradeoff is that some capabilities — `styleProps`, sub-element components (`<Card.Title>`), dynamic variants — are tied to the `tasty()` path. The `tastyStatic()` path is best understood as extraction and compilation of the DSL, tokens, and state logic without a React dependency.
|
|
317
346
|
|
|
318
|
-
This
|
|
347
|
+
This gives Tasty two zero-runtime paths:
|
|
319
348
|
|
|
320
|
-
-
|
|
321
|
-
-
|
|
349
|
+
- server-only `tasty()` for the full React component API, with CSS generated during server or static rendering
|
|
350
|
+
- `tastyStatic()` as a build-time compiler whose output works with any framework, including non-React ones
|
|
322
351
|
|
|
323
352
|
---
|
|
324
353
|
|
|
@@ -327,22 +356,27 @@ This flexibility is one of Tasty's more unusual strengths:
|
|
|
327
356
|
Another useful way to think about the ecosystem is by abstraction level.
|
|
328
357
|
|
|
329
358
|
### Direct styling tools
|
|
359
|
+
|
|
330
360
|
These are optimized for styling product code directly.
|
|
331
361
|
|
|
332
362
|
Examples:
|
|
363
|
+
|
|
333
364
|
- Tailwind CSS
|
|
334
|
-
- Emotion
|
|
335
|
-
- Stitches (deprecated)
|
|
365
|
+
- Emotion (requires `'use client'` — not RSC-compatible)
|
|
366
|
+
- Stitches (deprecated, requires `'use client'`)
|
|
336
367
|
|
|
337
368
|
### Typed styling engines
|
|
369
|
+
|
|
338
370
|
These are optimized for generating CSS with stronger structure and tooling.
|
|
339
371
|
|
|
340
372
|
Examples:
|
|
373
|
+
|
|
341
374
|
- Panda CSS
|
|
342
375
|
- vanilla-extract
|
|
343
376
|
- StyleX
|
|
344
377
|
|
|
345
378
|
### Design-system language engines
|
|
379
|
+
|
|
346
380
|
These are optimized for helping a team define its own styling grammar and semantics.
|
|
347
381
|
|
|
348
382
|
Tasty belongs most naturally here.
|
|
@@ -356,9 +390,10 @@ That is why generic "feature matrix" comparisons often miss the point. Tasty is
|
|
|
356
390
|
Tasty makes the most sense when:
|
|
357
391
|
|
|
358
392
|
- a real design system exists or is being built
|
|
393
|
+
- a shared component API is emerging even if the design system is still lightweight
|
|
359
394
|
- styling should be governed through a central platform team
|
|
360
395
|
- component state logic is complex
|
|
361
|
-
- the team wants a
|
|
396
|
+
- the team wants a design-system-owned styling language instead of raw CSS-shaped authoring
|
|
362
397
|
- tokens, recipes, and sub-elements should be first-class
|
|
363
398
|
- deterministic state resolution matters more than minimum abstraction overhead
|
|
364
399
|
- the styling engine may need to work as either a runtime tool or a build-time compiler
|
|
@@ -369,7 +404,7 @@ Tasty makes the most sense when:
|
|
|
369
404
|
|
|
370
405
|
A different tool may be more appropriate when:
|
|
371
406
|
|
|
372
|
-
- the main goal is styling app code directly with minimal setup
|
|
407
|
+
- the main goal is styling app code directly with minimal setup and without defining shared styling conventions
|
|
373
408
|
- the team prefers a shared framework vocabulary over a custom design-system language
|
|
374
409
|
- the complexity of intersecting states is low
|
|
375
410
|
- low ceremony matters more than central governance
|
|
@@ -405,9 +440,9 @@ Tasty is most compelling when the problem is not just "how do we write styles,"
|
|
|
405
440
|
|
|
406
441
|
- [README](../README.md) — overview, quick start, and feature highlights
|
|
407
442
|
- [Style DSL](dsl.md) — state maps, tokens, units, extending semantics, keyframes, @property
|
|
408
|
-
- [
|
|
443
|
+
- [React API](react-api.md) — `tasty()` factory, component props, variants, sub-elements, style functions
|
|
409
444
|
- [Style Properties](styles.md) — complete reference for all enhanced style properties
|
|
410
445
|
- [Configuration](configuration.md) — tokens, recipes, custom units, style handlers, and TypeScript extensions
|
|
411
|
-
- [
|
|
446
|
+
- [Build-Time Extraction (`tastyStatic`)](tasty-static.md) — static styling with the Babel plugin
|
|
412
447
|
- [Adoption Guide](adoption.md) — where Tasty sits in the stack, incremental adoption, and what changes for product engineers
|
|
413
448
|
- [Server-Side Rendering](ssr.md) — SSR setup for Next.js, Astro, and generic frameworks
|