@tenphi/tasty 0.0.0-snapshot.05c1c22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (314) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +629 -0
  3. package/dist/_virtual/_rolldown/runtime.js +7 -0
  4. package/dist/chunks/cacheKey.d.ts +1 -0
  5. package/dist/chunks/cacheKey.js +77 -0
  6. package/dist/chunks/cacheKey.js.map +1 -0
  7. package/dist/chunks/definitions.d.ts +37 -0
  8. package/dist/chunks/definitions.js +258 -0
  9. package/dist/chunks/definitions.js.map +1 -0
  10. package/dist/chunks/index.d.ts +1 -0
  11. package/dist/chunks/renderChunk.d.ts +1 -0
  12. package/dist/chunks/renderChunk.js +59 -0
  13. package/dist/chunks/renderChunk.js.map +1 -0
  14. package/dist/config.d.ts +366 -0
  15. package/dist/config.js +503 -0
  16. package/dist/config.js.map +1 -0
  17. package/dist/core/index.d.ts +33 -0
  18. package/dist/core/index.js +26 -0
  19. package/dist/counter-style/index.js +51 -0
  20. package/dist/counter-style/index.js.map +1 -0
  21. package/dist/debug.d.ts +89 -0
  22. package/dist/debug.js +453 -0
  23. package/dist/debug.js.map +1 -0
  24. package/dist/font-face/index.js +63 -0
  25. package/dist/font-face/index.js.map +1 -0
  26. package/dist/hooks/index.d.ts +7 -0
  27. package/dist/hooks/resolve-ssr-collector.js +14 -0
  28. package/dist/hooks/resolve-ssr-collector.js.map +1 -0
  29. package/dist/hooks/useCounterStyle.d.ts +50 -0
  30. package/dist/hooks/useCounterStyle.js +46 -0
  31. package/dist/hooks/useCounterStyle.js.map +1 -0
  32. package/dist/hooks/useFontFace.d.ts +43 -0
  33. package/dist/hooks/useFontFace.js +70 -0
  34. package/dist/hooks/useFontFace.js.map +1 -0
  35. package/dist/hooks/useGlobalStyles.d.ts +30 -0
  36. package/dist/hooks/useGlobalStyles.js +78 -0
  37. package/dist/hooks/useGlobalStyles.js.map +1 -0
  38. package/dist/hooks/useKeyframes.d.ts +56 -0
  39. package/dist/hooks/useKeyframes.js +64 -0
  40. package/dist/hooks/useKeyframes.js.map +1 -0
  41. package/dist/hooks/useProperty.d.ts +79 -0
  42. package/dist/hooks/useProperty.js +109 -0
  43. package/dist/hooks/useProperty.js.map +1 -0
  44. package/dist/hooks/useRawCSS.d.ts +53 -0
  45. package/dist/hooks/useRawCSS.js +35 -0
  46. package/dist/hooks/useRawCSS.js.map +1 -0
  47. package/dist/hooks/useStyles.d.ts +45 -0
  48. package/dist/hooks/useStyles.js +237 -0
  49. package/dist/hooks/useStyles.js.map +1 -0
  50. package/dist/index.d.ts +50 -0
  51. package/dist/index.js +35 -0
  52. package/dist/injector/index.d.ts +183 -0
  53. package/dist/injector/index.js +179 -0
  54. package/dist/injector/index.js.map +1 -0
  55. package/dist/injector/injector.d.ts +166 -0
  56. package/dist/injector/injector.js +464 -0
  57. package/dist/injector/injector.js.map +1 -0
  58. package/dist/injector/sheet-manager.d.ts +136 -0
  59. package/dist/injector/sheet-manager.js +733 -0
  60. package/dist/injector/sheet-manager.js.map +1 -0
  61. package/dist/injector/types.d.ts +204 -0
  62. package/dist/keyframes/index.js +206 -0
  63. package/dist/keyframes/index.js.map +1 -0
  64. package/dist/parser/classify.js +319 -0
  65. package/dist/parser/classify.js.map +1 -0
  66. package/dist/parser/const.js +49 -0
  67. package/dist/parser/const.js.map +1 -0
  68. package/dist/parser/lru.js +109 -0
  69. package/dist/parser/lru.js.map +1 -0
  70. package/dist/parser/parser.d.ts +25 -0
  71. package/dist/parser/parser.js +115 -0
  72. package/dist/parser/parser.js.map +1 -0
  73. package/dist/parser/tokenizer.js +69 -0
  74. package/dist/parser/tokenizer.js.map +1 -0
  75. package/dist/parser/types.d.ts +51 -0
  76. package/dist/parser/types.js +46 -0
  77. package/dist/parser/types.js.map +1 -0
  78. package/dist/pipeline/conditions.d.ts +134 -0
  79. package/dist/pipeline/conditions.js +406 -0
  80. package/dist/pipeline/conditions.js.map +1 -0
  81. package/dist/pipeline/exclusive.js +230 -0
  82. package/dist/pipeline/exclusive.js.map +1 -0
  83. package/dist/pipeline/index.d.ts +55 -0
  84. package/dist/pipeline/index.js +708 -0
  85. package/dist/pipeline/index.js.map +1 -0
  86. package/dist/pipeline/materialize.js +1103 -0
  87. package/dist/pipeline/materialize.js.map +1 -0
  88. package/dist/pipeline/parseStateKey.d.ts +15 -0
  89. package/dist/pipeline/parseStateKey.js +446 -0
  90. package/dist/pipeline/parseStateKey.js.map +1 -0
  91. package/dist/pipeline/simplify.js +515 -0
  92. package/dist/pipeline/simplify.js.map +1 -0
  93. package/dist/pipeline/warnings.js +18 -0
  94. package/dist/pipeline/warnings.js.map +1 -0
  95. package/dist/plugins/index.d.ts +2 -0
  96. package/dist/plugins/okhsl-plugin.d.ts +35 -0
  97. package/dist/plugins/okhsl-plugin.js +97 -0
  98. package/dist/plugins/okhsl-plugin.js.map +1 -0
  99. package/dist/plugins/types.d.ts +76 -0
  100. package/dist/properties/index.js +222 -0
  101. package/dist/properties/index.js.map +1 -0
  102. package/dist/properties/property-type-resolver.d.ts +24 -0
  103. package/dist/properties/property-type-resolver.js +90 -0
  104. package/dist/properties/property-type-resolver.js.map +1 -0
  105. package/dist/ssr/astro.d.ts +29 -0
  106. package/dist/ssr/astro.js +64 -0
  107. package/dist/ssr/astro.js.map +1 -0
  108. package/dist/ssr/async-storage.d.ts +17 -0
  109. package/dist/ssr/async-storage.js +34 -0
  110. package/dist/ssr/async-storage.js.map +1 -0
  111. package/dist/ssr/collect-auto-properties.js +39 -0
  112. package/dist/ssr/collect-auto-properties.js.map +1 -0
  113. package/dist/ssr/collector.d.ts +102 -0
  114. package/dist/ssr/collector.js +226 -0
  115. package/dist/ssr/collector.js.map +1 -0
  116. package/dist/ssr/context.d.ts +8 -0
  117. package/dist/ssr/context.js +13 -0
  118. package/dist/ssr/context.js.map +1 -0
  119. package/dist/ssr/format-global-rules.js +22 -0
  120. package/dist/ssr/format-global-rules.js.map +1 -0
  121. package/dist/ssr/format-keyframes.js +69 -0
  122. package/dist/ssr/format-keyframes.js.map +1 -0
  123. package/dist/ssr/format-property.js +49 -0
  124. package/dist/ssr/format-property.js.map +1 -0
  125. package/dist/ssr/format-rules.js +73 -0
  126. package/dist/ssr/format-rules.js.map +1 -0
  127. package/dist/ssr/hydrate.d.ts +22 -0
  128. package/dist/ssr/hydrate.js +49 -0
  129. package/dist/ssr/hydrate.js.map +1 -0
  130. package/dist/ssr/index.d.ts +5 -0
  131. package/dist/ssr/index.js +11 -0
  132. package/dist/ssr/index.js.map +1 -0
  133. package/dist/ssr/next.d.ts +45 -0
  134. package/dist/ssr/next.js +69 -0
  135. package/dist/ssr/next.js.map +1 -0
  136. package/dist/ssr/ssr-collector-ref.js +12 -0
  137. package/dist/ssr/ssr-collector-ref.js.map +1 -0
  138. package/dist/states/index.d.ts +49 -0
  139. package/dist/states/index.js +170 -0
  140. package/dist/states/index.js.map +1 -0
  141. package/dist/static/index.d.ts +5 -0
  142. package/dist/static/index.js +4 -0
  143. package/dist/static/inject.d.ts +5 -0
  144. package/dist/static/inject.js +17 -0
  145. package/dist/static/inject.js.map +1 -0
  146. package/dist/static/tastyStatic.d.ts +46 -0
  147. package/dist/static/tastyStatic.js +30 -0
  148. package/dist/static/tastyStatic.js.map +1 -0
  149. package/dist/static/types.d.ts +49 -0
  150. package/dist/static/types.js +24 -0
  151. package/dist/static/types.js.map +1 -0
  152. package/dist/styles/align.d.ts +15 -0
  153. package/dist/styles/align.js +14 -0
  154. package/dist/styles/align.js.map +1 -0
  155. package/dist/styles/border.d.ts +25 -0
  156. package/dist/styles/border.js +113 -0
  157. package/dist/styles/border.js.map +1 -0
  158. package/dist/styles/color.d.ts +14 -0
  159. package/dist/styles/color.js +26 -0
  160. package/dist/styles/color.js.map +1 -0
  161. package/dist/styles/createStyle.js +79 -0
  162. package/dist/styles/createStyle.js.map +1 -0
  163. package/dist/styles/dimension.js +96 -0
  164. package/dist/styles/dimension.js.map +1 -0
  165. package/dist/styles/display.d.ts +37 -0
  166. package/dist/styles/display.js +66 -0
  167. package/dist/styles/display.js.map +1 -0
  168. package/dist/styles/fade.d.ts +15 -0
  169. package/dist/styles/fade.js +57 -0
  170. package/dist/styles/fade.js.map +1 -0
  171. package/dist/styles/fill.d.ts +42 -0
  172. package/dist/styles/fill.js +51 -0
  173. package/dist/styles/fill.js.map +1 -0
  174. package/dist/styles/flow.d.ts +16 -0
  175. package/dist/styles/flow.js +12 -0
  176. package/dist/styles/flow.js.map +1 -0
  177. package/dist/styles/gap.d.ts +31 -0
  178. package/dist/styles/gap.js +36 -0
  179. package/dist/styles/gap.js.map +1 -0
  180. package/dist/styles/height.d.ts +17 -0
  181. package/dist/styles/height.js +19 -0
  182. package/dist/styles/height.js.map +1 -0
  183. package/dist/styles/index.d.ts +1 -0
  184. package/dist/styles/index.js +8 -0
  185. package/dist/styles/index.js.map +1 -0
  186. package/dist/styles/inset.d.ts +52 -0
  187. package/dist/styles/inset.js +149 -0
  188. package/dist/styles/inset.js.map +1 -0
  189. package/dist/styles/justify.d.ts +15 -0
  190. package/dist/styles/justify.js +14 -0
  191. package/dist/styles/justify.js.map +1 -0
  192. package/dist/styles/list.d.ts +16 -0
  193. package/dist/styles/list.js +98 -0
  194. package/dist/styles/list.js.map +1 -0
  195. package/dist/styles/margin.d.ts +24 -0
  196. package/dist/styles/margin.js +103 -0
  197. package/dist/styles/margin.js.map +1 -0
  198. package/dist/styles/outline.d.ts +29 -0
  199. package/dist/styles/outline.js +64 -0
  200. package/dist/styles/outline.js.map +1 -0
  201. package/dist/styles/padding.d.ts +24 -0
  202. package/dist/styles/padding.js +103 -0
  203. package/dist/styles/padding.js.map +1 -0
  204. package/dist/styles/predefined.d.ts +71 -0
  205. package/dist/styles/predefined.js +237 -0
  206. package/dist/styles/predefined.js.map +1 -0
  207. package/dist/styles/preset.d.ts +52 -0
  208. package/dist/styles/preset.js +126 -0
  209. package/dist/styles/preset.js.map +1 -0
  210. package/dist/styles/radius.d.ts +12 -0
  211. package/dist/styles/radius.js +71 -0
  212. package/dist/styles/radius.js.map +1 -0
  213. package/dist/styles/scrollbar.d.ts +25 -0
  214. package/dist/styles/scrollbar.js +46 -0
  215. package/dist/styles/scrollbar.js.map +1 -0
  216. package/dist/styles/shadow.d.ts +14 -0
  217. package/dist/styles/shadow.js +23 -0
  218. package/dist/styles/shadow.js.map +1 -0
  219. package/dist/styles/transition.d.ts +14 -0
  220. package/dist/styles/transition.js +157 -0
  221. package/dist/styles/transition.js.map +1 -0
  222. package/dist/styles/types.d.ts +549 -0
  223. package/dist/styles/width.d.ts +17 -0
  224. package/dist/styles/width.js +19 -0
  225. package/dist/styles/width.js.map +1 -0
  226. package/dist/tasty.d.ts +119 -0
  227. package/dist/tasty.js +231 -0
  228. package/dist/tasty.js.map +1 -0
  229. package/dist/types.d.ts +184 -0
  230. package/dist/utils/cache-wrapper.js +21 -0
  231. package/dist/utils/cache-wrapper.js.map +1 -0
  232. package/dist/utils/case-converter.js +8 -0
  233. package/dist/utils/case-converter.js.map +1 -0
  234. package/dist/utils/color-math.d.ts +46 -0
  235. package/dist/utils/color-math.js +749 -0
  236. package/dist/utils/color-math.js.map +1 -0
  237. package/dist/utils/color-space.d.ts +5 -0
  238. package/dist/utils/color-space.js +228 -0
  239. package/dist/utils/color-space.js.map +1 -0
  240. package/dist/utils/colors.d.ts +5 -0
  241. package/dist/utils/colors.js +10 -0
  242. package/dist/utils/colors.js.map +1 -0
  243. package/dist/utils/css-types.d.ts +7 -0
  244. package/dist/utils/dotize.d.ts +26 -0
  245. package/dist/utils/dotize.js +122 -0
  246. package/dist/utils/dotize.js.map +1 -0
  247. package/dist/utils/filter-base-props.d.ts +15 -0
  248. package/dist/utils/filter-base-props.js +45 -0
  249. package/dist/utils/filter-base-props.js.map +1 -0
  250. package/dist/utils/get-display-name.d.ts +7 -0
  251. package/dist/utils/get-display-name.js +10 -0
  252. package/dist/utils/get-display-name.js.map +1 -0
  253. package/dist/utils/has-keys.js +13 -0
  254. package/dist/utils/has-keys.js.map +1 -0
  255. package/dist/utils/is-dev-env.js +19 -0
  256. package/dist/utils/is-dev-env.js.map +1 -0
  257. package/dist/utils/is-valid-element-type.js +15 -0
  258. package/dist/utils/is-valid-element-type.js.map +1 -0
  259. package/dist/utils/merge-styles.d.ts +7 -0
  260. package/dist/utils/merge-styles.js +145 -0
  261. package/dist/utils/merge-styles.js.map +1 -0
  262. package/dist/utils/mod-attrs.d.ts +6 -0
  263. package/dist/utils/mod-attrs.js +20 -0
  264. package/dist/utils/mod-attrs.js.map +1 -0
  265. package/dist/utils/process-tokens.d.ts +21 -0
  266. package/dist/utils/process-tokens.js +90 -0
  267. package/dist/utils/process-tokens.js.map +1 -0
  268. package/dist/utils/resolve-recipes.d.ts +17 -0
  269. package/dist/utils/resolve-recipes.js +146 -0
  270. package/dist/utils/resolve-recipes.js.map +1 -0
  271. package/dist/utils/selector-transform.js +32 -0
  272. package/dist/utils/selector-transform.js.map +1 -0
  273. package/dist/utils/string.js +8 -0
  274. package/dist/utils/string.js.map +1 -0
  275. package/dist/utils/styles.d.ts +99 -0
  276. package/dist/utils/styles.js +220 -0
  277. package/dist/utils/styles.js.map +1 -0
  278. package/dist/utils/typography.d.ts +47 -0
  279. package/dist/utils/typography.js +51 -0
  280. package/dist/utils/typography.js.map +1 -0
  281. package/dist/utils/warnings.d.ts +16 -0
  282. package/dist/utils/warnings.js +16 -0
  283. package/dist/utils/warnings.js.map +1 -0
  284. package/dist/zero/babel.d.ts +182 -0
  285. package/dist/zero/babel.js +438 -0
  286. package/dist/zero/babel.js.map +1 -0
  287. package/dist/zero/css-writer.d.ts +45 -0
  288. package/dist/zero/css-writer.js +73 -0
  289. package/dist/zero/css-writer.js.map +1 -0
  290. package/dist/zero/extractor.d.ts +24 -0
  291. package/dist/zero/extractor.js +266 -0
  292. package/dist/zero/extractor.js.map +1 -0
  293. package/dist/zero/index.d.ts +3 -0
  294. package/dist/zero/index.js +3 -0
  295. package/dist/zero/next.d.ts +86 -0
  296. package/dist/zero/next.js +143 -0
  297. package/dist/zero/next.js.map +1 -0
  298. package/docs/PIPELINE.md +519 -0
  299. package/docs/README.md +31 -0
  300. package/docs/adoption.md +296 -0
  301. package/docs/comparison.md +420 -0
  302. package/docs/configuration.md +326 -0
  303. package/docs/debug.md +318 -0
  304. package/docs/design-system.md +424 -0
  305. package/docs/dsl.md +673 -0
  306. package/docs/getting-started.md +217 -0
  307. package/docs/injector.md +528 -0
  308. package/docs/methodology.md +567 -0
  309. package/docs/runtime.md +485 -0
  310. package/docs/ssr.md +384 -0
  311. package/docs/styles.md +582 -0
  312. package/docs/tasty-static.md +520 -0
  313. package/package.json +215 -0
  314. package/tasty.config.ts +14 -0
@@ -0,0 +1,420 @@
1
+ # Comparison
2
+
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 best understood not as a general-purpose CSS framework, but as a **styling engine for design systems and shared component APIs**.
6
+
7
+ It targets a different layer: helping design-system teams define a **house styling language** on top of CSS.
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.
10
+
11
+ Most styling tools focus on one of these layers:
12
+
13
+ - direct app styling
14
+ - component-level styling
15
+ - typed CSS authoring
16
+ - utility composition
17
+ - atomic CSS generation
18
+
19
+ Tasty's house styling language can include tokens, state semantics, style props, recipes, custom units, and sub-element rules. In other words, it is a governed styling model, not just another syntax for writing CSS.
20
+
21
+ That is why syntax-level comparisons are often shallow. The more meaningful comparison is about:
22
+
23
+ - **which layer** a tool is designed for
24
+ - **who owns the authoring language**
25
+ - **how state conflicts are resolved**
26
+ - **what kind of predictability** the tool actually guarantees
27
+
28
+ ---
29
+
30
+ ## High-level positioning
31
+
32
+ | System | Best described as | Main authoring model | Conflict model | Best fit |
33
+ |---|---|---|---|---|
34
+ | **Tasty** | Design-system styling engine | Custom DSL with tokens, state maps, recipes, style props, sub-elements, custom units | **Mutually exclusive selector resolution** for stateful styles | Teams building shared component APIs or a house styling language |
35
+ | **Tailwind CSS** | Utility-first styling framework | Utility classes in markup | Utility composition, variants, and framework-controlled ordering | 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 | 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 | 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 | 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 | Teams optimizing for component DX and flexible styling |
40
+
41
+ ---
42
+
43
+ ## What makes Tasty different
44
+
45
+ Tasty is built around a stronger goal than generic "predictable styling."
46
+
47
+ In many systems, predictability means:
48
+
49
+ - the compiler controls ordering
50
+ - class names do not accidentally collide
51
+ - specificity is reduced or normalized
52
+ - atomic rules compose in a stable way
53
+
54
+ Those are useful guarantees, but they are not the same as Tasty's main idea.
55
+
56
+ Tasty focuses on **stateful style resolution**. Instead of relying on ordinary cascade competition between matching rules, it compiles style logic into **mutually exclusive selectors**. For a given property and state combination, the system ensures that exactly one branch is eligible to win.
57
+
58
+ This is especially relevant for components with intersecting states such as:
59
+
60
+ - hover
61
+ - focus
62
+ - pressed
63
+ - disabled
64
+ - selected
65
+ - theme variants
66
+ - responsive conditions
67
+ - parent or root-driven conditions
68
+
69
+ Here is a minimal example. Two CSS rules for a button's background — one for `:hover`, one for `[disabled]`:
70
+
71
+ ```css
72
+ .btn:hover { background: dodgerblue; }
73
+ .btn[disabled] { background: gray; }
74
+ ```
75
+
76
+ 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.
77
+
78
+ In Tasty, the same intent is declared as a state map:
79
+
80
+ ```tsx
81
+ fill: {
82
+ '': '#primary',
83
+ ':hover': '#primary-hover',
84
+ 'disabled': '#surface',
85
+ }
86
+ ```
87
+
88
+ Tasty compiles this into selectors where `disabled` is guarded by `:not(:hover)` negations (and vice versa), so exactly one rule matches regardless of source order. The outcome is defined by the state map, not by which line comes last.
89
+
90
+ That makes Tasty less of a "better way to write CSS objects" and more of a **state-aware style compiler for design systems**.
91
+
92
+ Beyond state resolution, Tasty also provides several structural capabilities that reinforce the design-system layer:
93
+
94
+ - **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.
95
+ - **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 [Runtime API — Sub-element Styling](runtime.md#sub-element-styling).
96
+ - **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.
97
+ - **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.
98
+ - **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.
99
+
100
+ ---
101
+
102
+ ## Comparison by system
103
+
104
+ ### Tasty vs Tailwind CSS
105
+
106
+ Tailwind is centered on **direct authoring in markup**.
107
+
108
+ Its strength is speed: developers compose utilities directly where they use them, with responsive and state modifiers layered on top. This works extremely well for app teams that want a shared utility vocabulary with minimal ceremony.
109
+
110
+ Tasty solves a different problem.
111
+
112
+ 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:
113
+
114
+ - approved style props
115
+ - semantic tokens
116
+ - custom units
117
+ - recipes
118
+ - state semantics
119
+ - sub-element rules
120
+ - constrained component-facing styling APIs
121
+
122
+ So this is not mainly a comparison of syntax. It is a comparison of **governance models**:
123
+
124
+ - Tailwind: developers author directly with framework vocabulary
125
+ - Tasty: design-system authors define the vocabulary product teams consume
126
+
127
+ 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.
128
+
129
+ To make this concrete, consider a button with `hover`, `disabled`, and `theme=danger` states.
130
+
131
+ **Plain CSS** — you need a selector for every intersection, and equal-specificity rules depend on source order:
132
+
133
+ ```css
134
+ .btn { background: var(--primary); color: white; cursor: pointer; }
135
+ .btn:hover { background: var(--primary-hover); }
136
+ .btn:active { background: var(--primary-pressed); }
137
+ .btn[disabled] { background: var(--surface); color: var(--text-40); cursor: not-allowed; }
138
+
139
+ /* theme=danger overrides — must repeat disabled/hover/active */
140
+ .btn[data-theme="danger"] { background: var(--danger); }
141
+ .btn[data-theme="danger"]:hover { background: var(--danger-hover); }
142
+ .btn[data-theme="danger"]:active { background: var(--danger-pressed); }
143
+ .btn[data-theme="danger"][disabled] { background: var(--surface); }
144
+
145
+ /* Bug: .btn:hover and .btn[disabled] have the same specificity.
146
+ A hovered disabled button gets :hover styles — unless source order saves you. */
147
+ ```
148
+
149
+ Every new state doubles the selector count. Miss one intersection and you ship a visual bug.
150
+
151
+ **Tailwind** — state intersections move into conditional className logic:
152
+
153
+ ```tsx
154
+ <button className={cn(
155
+ 'bg-primary text-white cursor-pointer',
156
+ 'hover:bg-primary-hover active:bg-primary-pressed',
157
+ 'disabled:bg-surface disabled:text-text-40 disabled:cursor-not-allowed',
158
+ theme === 'danger' && 'bg-danger hover:bg-danger-hover active:bg-danger-pressed',
159
+ theme === 'danger' && disabled && '!bg-surface',
160
+ )}>
161
+ ```
162
+
163
+ The `theme` branch is runtime JS, not CSS. Intersections like `disabled + hover` need manual `!important` or extra utilities to override correctly.
164
+
165
+ **Tasty** — each property declares all its states in one map. The engine generates mutually exclusive selectors:
166
+
167
+ ```tsx
168
+ const Button = tasty({
169
+ as: 'button',
170
+ styles: {
171
+ fill: {
172
+ '': '#primary',
173
+ ':hover': '#primary-hover',
174
+ ':active': '#primary-pressed',
175
+ 'disabled': '#surface',
176
+ 'theme=danger': '#danger',
177
+ 'theme=danger & :hover': '#danger-hover',
178
+ 'theme=danger & :active': '#danger-pressed',
179
+ },
180
+ color: {
181
+ '': '#on-primary',
182
+ 'disabled': '#text.40',
183
+ },
184
+ cursor: {
185
+ '': 'pointer',
186
+ 'disabled': 'not-allowed',
187
+ },
188
+ },
189
+ });
190
+ ```
191
+
192
+ `disabled` always wins over `:hover` because Tasty emits negation selectors — no source-order dependence, no manual intersection management, no `!important`.
193
+
194
+ ---
195
+
196
+ ### Tasty vs Panda CSS
197
+
198
+ Panda is one of the closest comparisons.
199
+
200
+ Like Tasty, Panda sits closer to the design-system layer than many other tools. It supports typed style authoring, recipes, generated primitives, and a DS-friendly workflow. It is much more than a basic styling helper.
201
+
202
+ The difference is where each system puts its core idea.
203
+
204
+ Panda is centered on **typed atomic generation** and static analysis. It gives teams a structured, modern, design-system-friendly engine with a strong build-time story.
205
+
206
+ Tasty is more centered on:
207
+
208
+ - a custom DSL
209
+ - state mapping
210
+ - mutually exclusive resolution
211
+ - defining a team-specific styling language
212
+
213
+ So while both can support serious design-system work, they do not optimize for exactly the same thing:
214
+
215
+ - **Panda** is closer to a typed styling engine with strong DS ergonomics
216
+ - **Tasty** is closer to a design-system style compiler with explicit state semantics
217
+
218
+ If a team mostly wants typed primitives, recipes, and extracted CSS, Panda may feel more straightforward.
219
+
220
+ If a team wants to define a more opinionated styling language with stronger control over state logic and rule exclusivity, Tasty has a more specialized angle.
221
+
222
+ ---
223
+
224
+ ### Tasty vs vanilla-extract
225
+
226
+ vanilla-extract is a lower-level foundation.
227
+
228
+ It gives teams a zero-runtime TypeScript-native way to generate CSS, plus strong theming primitives and the ability to build architecture on top. It is excellent when a team wants maximum control over structure while staying close to normal CSS semantics.
229
+
230
+ That last point matters.
231
+
232
+ With vanilla-extract, styles are still fundamentally governed by **standard CSS behavior**. Ordering, layering, and media-query structure still matter in the usual CSS sense. That is not a flaw; it is simply a different abstraction level.
233
+
234
+ Tasty is more opinionated.
235
+
236
+ 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.
237
+
238
+ This also makes Tasty's static mode notable:
239
+
240
+ - Runtime `tasty()` creates React components with dynamic injection
241
+ - `tastyStatic()` with the Babel plugin produces static class name strings with zero runtime overhead
242
+ - In static mode, the output is plain CSS + class names, so it can be used with any JavaScript framework — not only React
243
+
244
+ Runtime features like `styleProps`, sub-element components, and dynamic variants are React-specific. The static path is framework-agnostic.
245
+
246
+ So the tradeoff is roughly:
247
+
248
+ - **vanilla-extract**: lower-level, static, explicit, architecture left to the team
249
+ - **Tasty**: more opinionated, more state-aware, more language-defining
250
+
251
+ ---
252
+
253
+ ### Tasty vs StyleX
254
+
255
+ This comparison needs extra precision, because both systems care about predictability, but not in the same way.
256
+
257
+ StyleX is a compiler-based atomic system with strong guarantees around consistency and composition. Its model is designed to avoid many classic CSS pitfalls such as accidental rule collisions and specificity-driven unpredictability.
258
+
259
+ That is real value.
260
+
261
+ But it is still a different kind of guarantee from Tasty's.
262
+
263
+ StyleX predictability comes from:
264
+
265
+ - atomic decomposition
266
+ - compiler control
267
+ - constrained composition
268
+ - normalized style behavior
269
+
270
+ Tasty's differentiator is stronger in a specific area:
271
+
272
+ - **stateful per-property resolution**
273
+ - **mutually exclusive selectors**
274
+ - **conflict avoidance by construction**, not only by atomic normalization
275
+
276
+ So "collision-free atomic CSS" should not be treated as equivalent to Tasty's approach.
277
+
278
+ A better framing is:
279
+
280
+ - **StyleX** provides compiler-controlled atomic predictability
281
+ - **Tasty** provides mutually exclusive selector resolution for stateful component styling
282
+
283
+ That makes Tasty especially interesting when the hardest problem is not just style composition, but **complex intersecting component states**.
284
+
285
+ ---
286
+
287
+ ### Tasty vs Stitches (deprecated) / Emotion
288
+
289
+ Stitches and Emotion are component-first styling systems. (Note: Stitches has been archived and is no longer maintained. It is included here because it remains widely referenced in comparisons.)
290
+
291
+ They optimize for developer experience, flexible composition, reusable styled primitives, and ergonomic component authoring. For many teams, that is exactly the right abstraction level.
292
+
293
+ Tasty targets a different question.
294
+
295
+ It is less focused on "how do I style this component ergonomically right now?" and more focused on:
296
+
297
+ - what styling language should this design system expose?
298
+ - how should states be modeled?
299
+ - what should be allowed or constrained?
300
+ - how do we keep style behavior deterministic as the system grows?
301
+
302
+ So while Stitches and Emotion are strong tools for building components, Tasty is more naturally positioned as a **styling substrate for the design system itself**.
303
+
304
+ That makes it narrower in audience, but deeper in architectural ambition.
305
+
306
+ 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.
307
+
308
+ ---
309
+
310
+ ## Build-time vs runtime
311
+
312
+ Tasty is not limited to one execution model.
313
+
314
+ It can be used as a styling system with runtime behavior, but it can also be used as a **fully build-time style compiler** when that is the right fit.
315
+
316
+ That distinction matters.
317
+
318
+ In runtime mode, `tasty()` creates React components with dynamic style injection, `styleProps`, sub-element components, and variants. This path is React-specific.
319
+
320
+ In build-time mode, `tastyStatic()` with the Babel plugin generates plain static class names and CSS files. 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.
321
+
322
+ The tradeoff is that some capabilities — `styleProps`, sub-element components (`<Card.Title>`), dynamic variants — are tied to the runtime path. The static path is best understood as extraction and compilation of the DSL, tokens, and state logic.
323
+
324
+ This flexibility is one of Tasty's more unusual strengths:
325
+
326
+ - it can be used as a full authoring/runtime system for React
327
+ - or as a static compiler whose output works with any framework
328
+
329
+ ---
330
+
331
+ ## Comparison by abstraction level
332
+
333
+ Another useful way to think about the ecosystem is by abstraction level.
334
+
335
+ ### Direct styling tools
336
+ These are optimized for styling product code directly.
337
+
338
+ Examples:
339
+ - Tailwind CSS
340
+ - Emotion
341
+ - Stitches (deprecated)
342
+
343
+ ### Typed styling engines
344
+ These are optimized for generating CSS with stronger structure and tooling.
345
+
346
+ Examples:
347
+ - Panda CSS
348
+ - vanilla-extract
349
+ - StyleX
350
+
351
+ ### Design-system language engines
352
+ These are optimized for helping a team define its own styling grammar and semantics.
353
+
354
+ Tasty belongs most naturally here.
355
+
356
+ That is why generic "feature matrix" comparisons often miss the point. Tasty is not only trying to style elements. It is trying to help define **how a design system talks about styling**.
357
+
358
+ ---
359
+
360
+ ## When Tasty is a strong fit
361
+
362
+ Tasty makes the most sense when:
363
+
364
+ - a real design system exists or is being built
365
+ - a shared component API is emerging even if the design system is still lightweight
366
+ - styling should be governed through a central platform team
367
+ - component state logic is complex
368
+ - the team wants a house styling language instead of raw CSS-shaped authoring
369
+ - tokens, recipes, and sub-elements should be first-class
370
+ - deterministic state resolution matters more than minimum abstraction overhead
371
+ - the styling engine may need to work as either a runtime tool or a build-time compiler
372
+
373
+ ---
374
+
375
+ ## When another tool may be a better fit
376
+
377
+ A different tool may be more appropriate when:
378
+
379
+ - the main goal is styling app code directly with minimal setup and without defining shared styling conventions
380
+ - the team prefers a shared framework vocabulary over a custom design-system language
381
+ - the complexity of intersecting states is low
382
+ - low ceremony matters more than central governance
383
+ - the team wants static CSS primitives without a more opinionated state model
384
+ - component-level DX is the primary optimization target
385
+
386
+ ---
387
+
388
+ ## Summary
389
+
390
+ Tasty is not best compared as "another CSS framework."
391
+
392
+ Its more meaningful comparison point is this:
393
+
394
+ > Tasty is a styling engine for building a design-system-defined authoring language, with a particular focus on explicit state semantics and mutually exclusive selector resolution.
395
+
396
+ That puts it in a different category from:
397
+
398
+ - utility-first tools that optimize for direct authoring
399
+ - component-first CSS-in-JS libraries that optimize for DX
400
+ - typed static CSS systems that expose lower-level primitives
401
+ - atomic compilers that focus on normalized composition
402
+
403
+ Those systems are all useful, but they optimize for different layers.
404
+
405
+ Tasty is most compelling when the problem is not just "how do we write styles," but:
406
+
407
+ > "How do we define a scalable, deterministic styling model for the design system itself?"
408
+
409
+ ---
410
+
411
+ ## Learn more
412
+
413
+ - [README](../README.md) — overview, quick start, and feature highlights
414
+ - [Style DSL](dsl.md) — state maps, tokens, units, extending semantics, keyframes, @property
415
+ - [Runtime API](runtime.md) — `tasty()` factory, component props, variants, sub-elements, hooks
416
+ - [Style Properties](styles.md) — complete reference for all enhanced style properties
417
+ - [Configuration](configuration.md) — tokens, recipes, custom units, style handlers, and TypeScript extensions
418
+ - [Zero Runtime (tastyStatic)](tasty-static.md) — build-time static styling with Babel plugin
419
+ - [Adoption Guide](adoption.md) — where Tasty sits in the stack, incremental adoption, and what changes for product engineers
420
+ - [Server-Side Rendering](ssr.md) — SSR setup for Next.js, Astro, and generic frameworks