@tenphi/tasty 0.0.0-snapshot.2f99c73 → 0.0.0-snapshot.3006ae0

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 (196) hide show
  1. package/README.md +531 -126
  2. package/dist/chunks/definitions.js +1 -2
  3. package/dist/chunks/definitions.js.map +1 -1
  4. package/dist/config.d.ts +42 -10
  5. package/dist/config.js +73 -15
  6. package/dist/config.js.map +1 -1
  7. package/dist/core/index.d.ts +32 -0
  8. package/dist/core/index.js +26 -0
  9. package/dist/debug.js +1 -1
  10. package/dist/debug.js.map +1 -1
  11. package/dist/hooks/useGlobalStyles.d.ts +3 -0
  12. package/dist/hooks/useGlobalStyles.js +28 -1
  13. package/dist/hooks/useGlobalStyles.js.map +1 -1
  14. package/dist/hooks/useKeyframes.js +18 -3
  15. package/dist/hooks/useKeyframes.js.map +1 -1
  16. package/dist/hooks/useProperty.js +36 -13
  17. package/dist/hooks/useProperty.js.map +1 -1
  18. package/dist/hooks/useRawCSS.js +13 -1
  19. package/dist/hooks/useRawCSS.js.map +1 -1
  20. package/dist/hooks/useStyles.d.ts +5 -0
  21. package/dist/hooks/useStyles.js +88 -9
  22. package/dist/hooks/useStyles.js.map +1 -1
  23. package/dist/index.d.ts +28 -19
  24. package/dist/index.js +16 -13
  25. package/dist/injector/index.d.ts +9 -1
  26. package/dist/injector/index.js +9 -1
  27. package/dist/injector/index.js.map +1 -1
  28. package/dist/injector/injector.d.ts +9 -0
  29. package/dist/injector/injector.js +59 -33
  30. package/dist/injector/injector.js.map +1 -1
  31. package/dist/injector/sheet-manager.d.ts +16 -7
  32. package/dist/injector/sheet-manager.js +24 -9
  33. package/dist/injector/sheet-manager.js.map +1 -1
  34. package/dist/injector/types.d.ts +9 -0
  35. package/dist/parser/classify.js.map +1 -1
  36. package/dist/parser/parser.js +1 -1
  37. package/dist/pipeline/conditions.d.ts +134 -0
  38. package/dist/pipeline/conditions.js +28 -20
  39. package/dist/pipeline/conditions.js.map +1 -1
  40. package/dist/pipeline/index.d.ts +2 -2
  41. package/dist/pipeline/index.js +64 -46
  42. package/dist/pipeline/index.js.map +1 -1
  43. package/dist/pipeline/materialize.js +266 -304
  44. package/dist/pipeline/materialize.js.map +1 -1
  45. package/dist/pipeline/parseStateKey.d.ts +15 -1
  46. package/dist/pipeline/parseStateKey.js +44 -32
  47. package/dist/pipeline/parseStateKey.js.map +1 -1
  48. package/dist/pipeline/simplify.js +111 -152
  49. package/dist/pipeline/simplify.js.map +1 -1
  50. package/dist/pipeline/warnings.js +18 -0
  51. package/dist/pipeline/warnings.js.map +1 -0
  52. package/dist/plugins/types.d.ts +9 -2
  53. package/dist/properties/index.js +94 -16
  54. package/dist/properties/index.js.map +1 -1
  55. package/dist/properties/property-type-resolver.d.ts +24 -0
  56. package/dist/properties/property-type-resolver.js +91 -0
  57. package/dist/properties/property-type-resolver.js.map +1 -0
  58. package/dist/ssr/astro.d.ts +29 -0
  59. package/dist/ssr/astro.js +65 -0
  60. package/dist/ssr/astro.js.map +1 -0
  61. package/dist/ssr/async-storage.d.ts +17 -0
  62. package/dist/ssr/async-storage.js +35 -0
  63. package/dist/ssr/async-storage.js.map +1 -0
  64. package/dist/ssr/collect-auto-properties.js +40 -0
  65. package/dist/ssr/collect-auto-properties.js.map +1 -0
  66. package/dist/ssr/collector.d.ts +85 -0
  67. package/dist/ssr/collector.js +183 -0
  68. package/dist/ssr/collector.js.map +1 -0
  69. package/dist/ssr/context.d.ts +8 -0
  70. package/dist/ssr/context.js +14 -0
  71. package/dist/ssr/context.js.map +1 -0
  72. package/dist/ssr/format-global-rules.js +22 -0
  73. package/dist/ssr/format-global-rules.js.map +1 -0
  74. package/dist/ssr/format-keyframes.js +70 -0
  75. package/dist/ssr/format-keyframes.js.map +1 -0
  76. package/dist/ssr/format-property.js +48 -0
  77. package/dist/ssr/format-property.js.map +1 -0
  78. package/dist/ssr/format-rules.js +70 -0
  79. package/dist/ssr/format-rules.js.map +1 -0
  80. package/dist/ssr/hydrate.d.ts +22 -0
  81. package/dist/ssr/hydrate.js +50 -0
  82. package/dist/ssr/hydrate.js.map +1 -0
  83. package/dist/ssr/index.d.ts +5 -0
  84. package/dist/ssr/index.js +12 -0
  85. package/dist/ssr/index.js.map +1 -0
  86. package/dist/ssr/next.d.ts +45 -0
  87. package/dist/ssr/next.js +71 -0
  88. package/dist/ssr/next.js.map +1 -0
  89. package/dist/ssr/ssr-collector-ref.js +12 -0
  90. package/dist/ssr/ssr-collector-ref.js.map +1 -0
  91. package/dist/states/index.d.ts +6 -2
  92. package/dist/styles/align.d.ts +1 -1
  93. package/dist/styles/align.js.map +1 -1
  94. package/dist/styles/border.d.ts +1 -1
  95. package/dist/styles/border.js.map +1 -1
  96. package/dist/styles/color.d.ts +2 -2
  97. package/dist/styles/color.js.map +1 -1
  98. package/dist/styles/createStyle.js +1 -1
  99. package/dist/styles/createStyle.js.map +1 -1
  100. package/dist/styles/fade.d.ts +1 -1
  101. package/dist/styles/fade.js.map +1 -1
  102. package/dist/styles/fill.d.ts +14 -16
  103. package/dist/styles/fill.js +6 -5
  104. package/dist/styles/fill.js.map +1 -1
  105. package/dist/styles/flow.d.ts +3 -3
  106. package/dist/styles/flow.js.map +1 -1
  107. package/dist/styles/index.d.ts +2 -2
  108. package/dist/styles/inset.d.ts +3 -1
  109. package/dist/styles/inset.js +48 -40
  110. package/dist/styles/inset.js.map +1 -1
  111. package/dist/styles/justify.d.ts +1 -1
  112. package/dist/styles/justify.js.map +1 -1
  113. package/dist/styles/margin.d.ts +1 -5
  114. package/dist/styles/margin.js +48 -40
  115. package/dist/styles/margin.js.map +1 -1
  116. package/dist/styles/padding.d.ts +1 -5
  117. package/dist/styles/padding.js +48 -40
  118. package/dist/styles/padding.js.map +1 -1
  119. package/dist/styles/predefined.d.ts +0 -3
  120. package/dist/styles/predefined.js +0 -3
  121. package/dist/styles/predefined.js.map +1 -1
  122. package/dist/styles/preset.js +1 -1
  123. package/dist/styles/preset.js.map +1 -1
  124. package/dist/styles/radius.d.ts +1 -1
  125. package/dist/styles/radius.js.map +1 -1
  126. package/dist/styles/scrollbar.d.ts +9 -5
  127. package/dist/styles/scrollbar.js +25 -82
  128. package/dist/styles/scrollbar.js.map +1 -1
  129. package/dist/styles/shadow.d.ts +2 -2
  130. package/dist/styles/shadow.js.map +1 -1
  131. package/dist/styles/transition.d.ts +1 -1
  132. package/dist/styles/transition.js +27 -7
  133. package/dist/styles/transition.js.map +1 -1
  134. package/dist/styles/types.d.ts +29 -17
  135. package/dist/tasty.d.ts +68 -70
  136. package/dist/tasty.js +19 -4
  137. package/dist/tasty.js.map +1 -1
  138. package/dist/types.d.ts +6 -4
  139. package/dist/utils/colors.d.ts +1 -1
  140. package/dist/utils/colors.js.map +1 -1
  141. package/dist/utils/css-types.d.ts +7 -0
  142. package/dist/utils/dotize.d.ts +1 -1
  143. package/dist/utils/is-valid-element-type.js +15 -0
  144. package/dist/utils/is-valid-element-type.js.map +1 -0
  145. package/dist/utils/mod-attrs.js.map +1 -1
  146. package/dist/utils/process-tokens.d.ts +1 -1
  147. package/dist/utils/process-tokens.js.map +1 -1
  148. package/dist/utils/resolve-recipes.js +17 -13
  149. package/dist/utils/resolve-recipes.js.map +1 -1
  150. package/dist/utils/selector-transform.js +32 -0
  151. package/dist/utils/selector-transform.js.map +1 -0
  152. package/dist/utils/string.js.map +1 -1
  153. package/dist/utils/styles.d.ts +8 -14
  154. package/dist/utils/styles.js +176 -31
  155. package/dist/utils/styles.js.map +1 -1
  156. package/dist/utils/typography.d.ts +24 -13
  157. package/dist/utils/typography.js +6 -16
  158. package/dist/utils/typography.js.map +1 -1
  159. package/dist/zero/babel.d.ts +31 -6
  160. package/dist/zero/babel.js +51 -9
  161. package/dist/zero/babel.js.map +1 -1
  162. package/dist/zero/extractor.d.ts +0 -1
  163. package/dist/zero/extractor.js +66 -1
  164. package/dist/zero/extractor.js.map +1 -1
  165. package/dist/zero/next.d.ts +29 -30
  166. package/dist/zero/next.js +49 -39
  167. package/dist/zero/next.js.map +1 -1
  168. package/docs/adoption.md +286 -0
  169. package/docs/comparison.md +413 -0
  170. package/docs/configuration.md +242 -0
  171. package/docs/debug.md +505 -0
  172. package/docs/design-system.md +401 -0
  173. package/docs/dsl.md +540 -0
  174. package/docs/getting-started.md +201 -0
  175. package/docs/injector.md +528 -0
  176. package/docs/methodology.md +501 -0
  177. package/docs/runtime.md +291 -0
  178. package/docs/ssr.md +382 -0
  179. package/docs/styles.md +574 -0
  180. package/docs/tasty-static.md +398 -0
  181. package/package.json +113 -37
  182. package/tasty.config.ts +14 -0
  183. package/dist/chunks/cacheKey.d.ts +0 -1
  184. package/dist/chunks/index.d.ts +0 -3
  185. package/dist/chunks/renderChunk.d.ts +0 -2
  186. package/dist/hooks/index.d.ts +0 -5
  187. package/dist/parser/index.d.ts +0 -3
  188. package/dist/parser/index.js +0 -4
  189. package/dist/pipeline/exclusive.d.ts +0 -1
  190. package/dist/plugins/index.d.ts +0 -2
  191. package/dist/styles/styledScrollbar.d.ts +0 -47
  192. package/dist/styles/styledScrollbar.js +0 -38
  193. package/dist/styles/styledScrollbar.js.map +0 -1
  194. package/dist/tokens/typography.d.ts +0 -19
  195. package/dist/tokens/typography.js +0 -237
  196. package/dist/tokens/typography.js.map +0 -1
package/README.md CHANGED
@@ -5,7 +5,8 @@
5
5
  <h1 align="center">Tasty</h1>
6
6
 
7
7
  <p align="center">
8
- A design-system-integrated styling system and DSL for concise, state-aware UI styling
8
+ <strong>The styling engine built for design systems.</strong><br>
9
+ Deterministic CSS generation. State-aware DSL. Zero specificity conflicts. Ever.
9
10
  </p>
10
11
 
11
12
  <p align="center">
@@ -16,21 +17,23 @@
16
17
 
17
18
  ---
18
19
 
19
- Tasty is a powerful CSS-in-JS styling system for React that combines declarative state-aware styling with design system integration. It provides a concise DSL for creating maintainable, themeable components with built-in support for responsive design, dark mode, container queries, and more.
20
+ Most CSS-in-JS libraries emit rules that compete through cascade and specificity. Tasty emits **mutually exclusive CSS selectors** for any component state combination, exactly one selector matches each property at a time. No cascade conflicts, no specificity wars, no `!important` escapes. Components compose and extend without breaking each other.
20
21
 
21
- ## Features
22
+ That guarantee unlocks a concise, CSS-like DSL where design tokens, custom units, responsive states, container queries, sub-element styling, and theming all compose without surprises — one coherent system that scales from a single component to an enterprise design system.
22
23
 
23
- - **Declarative state-aware styling** — style objects with state keys (`hovered`, `disabled`, `@media`, `@root`, etc.)
24
- - **Design token integration** — color tokens (`#purple`), custom units (`2x`, `1r`), typography presets
25
- - **Sub-element styling** — style inner elements via capitalized keys with `data-element` attributes
26
- - **Advanced state mapping** — media queries, container queries, root states, supports queries with boolean logic
27
- - **Zero-runtime mode** — Babel plugin extracts CSS at build time for static sites
28
- - **Plugin system** — extensible with custom color functions (OKHSL, etc.)
29
- - **React hooks** — `useStyles`, `useGlobalStyles`, `useRawCSS` for programmatic style injection
30
- - **Style extension** — compose and extend styled components with proper merge semantics
31
- - **Recipes** — named style bundles for reusable patterns
32
- - **TypeScript-first** — full type definitions with module augmentation support
33
- - **Tree-shakeable ESM** — unbundled output with `sideEffects: false`
24
+ ## Why Tasty
25
+
26
+ - **Deterministic at any scale** — Exclusive selector generation eliminates the entire class of cascade/specificity bugs. Every state combination resolves to exactly one CSS rule per property. Refactor freely. See [How It Actually Works](#how-it-actually-works).
27
+ - **AI-friendly by design** — Style definitions are declarative, self-contained, and structurally consistent. AI tools can read, understand, and refactor even advanced state bindings as confidently as a human — because there's no hidden cascade logic or implicit ordering to second-guess.
28
+ - **DSL that feels like CSS** — Property names you already know (`padding`, `color`, `display`) with syntax sugar that removes boilerplate. Learn the DSL in minutes, not days. See [Style Properties](docs/styles.md).
29
+ - **CSS properties as normal component props** — `styleProps` lets you expose selected styles as typed React props. Use `<Button placeSelf="end">` or `<Space flow="row" gap="2x">` without extra wrappers, utility classes, or `styles` overrides. The same props also accept state maps, so responsive values work with the same API. See [CSS properties as props](#css-properties-as-props).
30
+ - **Design-system native** — Color tokens (`#primary`), spacing units (`2x`), typography presets (`h1`, `t2`), border radius (`1r`), and recipes are first-class primitives, not afterthoughts. See [Configuration](docs/configuration.md).
31
+ - **Near-complete modern CSS coverage** — Media queries, container queries, `@supports`, `:has()`, `@starting-style`, `@property`, `@keyframes`, etc. Some features that don't fit Tasty's component model (such as `@layer` and `!important`) are intentionally omitted, but real-world use cases are covered almost completely.
32
+ - **Runtime, zero-runtime, or SSR — your call** — Use `tasty()` for dynamic React components with runtime injection, `tastyStatic()` with the Babel plugin for zero-runtime CSS extraction, or enable SSR with zero-cost client hydration for Next.js, Astro, or any React framework (experimental). Same DSL, same tokens, same output.
33
+ - **Only generate what is used** — In runtime mode, Tasty injects CSS on demand for mounted components/variants, so your app avoids shipping style rules for UI states that are never rendered.
34
+ - **Runtime performance that holds at scale** — The runtime path is tested against enterprise-scale applications and tuned with multi-level caching, chunk-level style reuse, style garbage collection, and a dedicated injector.
35
+ - **Composable and extensible by design** — Extend any component's styles with proper merge semantics, and evolve built-in behavior through configuration and plugins.
36
+ - **TypeScript-first** — Full type definitions, module augmentation for custom properties, and autocomplete for tokens, presets, and themes. See [Configuration](docs/configuration.md).
34
37
 
35
38
  ## Installation
36
39
 
@@ -38,17 +41,9 @@ Tasty is a powerful CSS-in-JS styling system for React that combines declarative
38
41
  pnpm add @tenphi/tasty
39
42
  ```
40
43
 
41
- ```bash
42
- npm install @tenphi/tasty
43
- ```
44
-
45
- ```bash
46
- yarn add @tenphi/tasty
47
- ```
48
-
49
44
  ## Quick Start
50
45
 
51
- ### Creating Styled Components
46
+ ### Create a styled component
52
47
 
53
48
  ```tsx
54
49
  import { tasty } from '@tenphi/tasty';
@@ -56,50 +51,68 @@ import { tasty } from '@tenphi/tasty';
56
51
  const Card = tasty({
57
52
  as: 'div',
58
53
  styles: {
54
+ display: 'flex',
55
+ flow: 'column',
59
56
  padding: '4x',
60
- fill: '#white',
61
- border: true,
62
- radius: true,
57
+ gap: '2x',
58
+ fill: '#surface',
59
+ border: '#border bottom',
60
+ radius: '1r',
63
61
  },
64
62
  });
65
63
 
64
+ // Just a React component
66
65
  <Card>Hello World</Card>
67
66
  ```
68
67
 
69
- ### State-Based Styling
68
+ Every value maps to CSS you'd recognize — but with tokens and units that keep your design system consistent by default.
69
+
70
+ ### Add state-driven styles
70
71
 
71
72
  ```tsx
72
- const InteractiveCard = tasty({
73
+ const Button = tasty({
74
+ as: 'button',
73
75
  styles: {
76
+ padding: '1.5x 3x',
74
77
  fill: {
75
- '': '#white',
76
- 'hovered': '#gray.05',
77
- 'pressed': '#gray.10',
78
- '@media(w < 768px)': '#surface',
78
+ '': '#primary',
79
+ ':hover': '#primary-hover',
80
+ ':active': '#primary-pressed',
81
+ '[disabled]': '#surface',
79
82
  },
80
- padding: {
81
- '': '4x',
82
- '@media(w < 768px)': '2x',
83
+ color: {
84
+ '': '#on-primary',
85
+ '[disabled]': '#text.40',
86
+ },
87
+ cursor: {
88
+ '': 'pointer',
89
+ '[disabled]': 'not-allowed',
83
90
  },
91
+ transition: 'theme',
84
92
  },
85
93
  });
86
94
  ```
87
95
 
88
- ### Extending Components
96
+ State keys support pseudo-classes first (`:hover`, `:active`), then modifiers (`theme=danger`), attributes (`[disabled]`), media/container queries, root states, and more. Tasty compiles them into exclusive selectors automatically.
97
+
98
+ ### Extend any component
89
99
 
90
100
  ```tsx
91
101
  import { Button } from 'my-ui-lib';
92
102
 
93
- const PrimaryButton = tasty(Button, {
103
+ const DangerButton = tasty(Button, {
94
104
  styles: {
95
- fill: '#purple',
96
- color: '#white',
97
- padding: '2x 4x',
105
+ fill: {
106
+ '': '#danger',
107
+ ':hover': '#danger-hover',
108
+ },
98
109
  },
99
110
  });
100
111
  ```
101
112
 
102
- ### Configuration
113
+ Child styles merge with parent styles intelligently — state maps can extend or replace parent states per-property.
114
+
115
+ ### Configure once, use everywhere
103
116
 
104
117
  ```tsx
105
118
  import { configure } from '@tenphi/tasty';
@@ -107,154 +120,546 @@ import { configure } from '@tenphi/tasty';
107
120
  configure({
108
121
  states: {
109
122
  '@mobile': '@media(w < 768px)',
110
- '@dark': '@root(theme=dark)',
123
+ '@tablet': '@media(w < 1024px)',
124
+ '@dark': '@root(schema=dark) | (!@root(schema) & @media(prefers-color-scheme: dark))',
111
125
  },
112
126
  recipes: {
113
- card: {
114
- padding: '4x',
115
- fill: '#surface',
116
- radius: '1r',
117
- border: true,
118
- },
127
+ card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
119
128
  },
120
129
  });
121
130
  ```
122
131
 
123
- ## Entry Points
132
+ Predefined states turn complex selector logic into single tokens. Use `@mobile` instead of writing media query expressions in every component.
124
133
 
125
- | Import | Description | Platform |
126
- |--------|-------------|----------|
127
- | `@tenphi/tasty` | Runtime style engine | Browser |
128
- | `@tenphi/tasty/static` | Build-time static style generation | Browser |
129
- | `@tenphi/tasty/babel-plugin` | Babel plugin for zero-runtime | Node |
130
- | `@tenphi/tasty/zero` | Programmatic extraction API | Node |
131
- | `@tenphi/tasty/next` | Next.js integration wrapper | Node |
134
+ ### CSS properties as props
135
+
136
+ With `styleProps`, a component can expose the styles you choose as normal typed props. That means you can adjust layout, spacing, alignment, or positioning right where the component is used, instead of introducing wrapper elements or reaching for a separate styling API.
137
+
138
+ This is especially good for prototyping and fast UI iteration: you can shape interfaces quickly, while still staying inside a typed, design-system-aware component API that scales to production.
139
+
140
+ ```tsx
141
+ import { tasty, FLOW_STYLES, POSITION_STYLES } from '@tenphi/tasty';
142
+
143
+ const Space = tasty({
144
+ styles: {
145
+ display: 'flex',
146
+ flow: 'column',
147
+ gap: '1x',
148
+ },
149
+ styleProps: FLOW_STYLES,
150
+ });
151
+
152
+ const Button = tasty({
153
+ as: 'button',
154
+ styles: {
155
+ padding: '1.5x 3x',
156
+ fill: '#primary',
157
+ color: '#primary-text',
158
+ radius: true,
159
+ },
160
+ styleProps: POSITION_STYLES,
161
+ });
162
+ ```
163
+
164
+ Now you can compose layout and tweak component positioning directly in JSX:
165
+
166
+ ```tsx
167
+ <Space flow="row" gap="2x" placeItems="center">
168
+ <Title>Dashboard</Title>
169
+ <Button placeSelf="end">Add Item</Button>
170
+ </Space>
171
+ ```
172
+
173
+ The same props also support state maps, so responsive values use the exact same API:
174
+
175
+ ```tsx
176
+ <Space
177
+ flow={{ '': 'column', '@tablet': 'row' }}
178
+ gap={{ '': '2x', '@tablet': '4x' }}
179
+ >
180
+ <Sidebar />
181
+ <Content />
182
+ </Space>
183
+ ```
184
+
185
+ Layout components can expose flow props. Buttons can expose positioning props. Each component can offer only the style props that make sense for its role, while still keeping tokens, custom units, and state maps fully typed. This works in runtime `tasty()` components, not in `tastyStatic()`.
186
+
187
+ ## How It Actually Works
188
+
189
+ This is the core idea that makes everything else possible.
190
+
191
+ Traditional CSS has two structural problems.
192
+
193
+ First, the **cascade** resolves conflicts by specificity and source order: when multiple selectors match, the one with the highest specificity wins, or — if specificity is equal — the last one in source order wins. That makes styles inherently fragile. Reordering imports, adding a media query, or composing components from different libraries can silently break styling.
194
+
195
+ A small example makes this tangible. Two rules for a button's background:
196
+
197
+ ```css
198
+ .btn:hover { background: dodgerblue; }
199
+ .btn[disabled] { background: gray; }
200
+ ```
132
201
 
133
- ## Core Concepts
202
+ Both selectors have specificity `(0, 1, 1)`. When the button is hovered **and** disabled, both match — and the last rule in source order wins. Swap the two lines and a hovered disabled button silently turns blue instead of gray. This class of bug is invisible in code review because the logic is correct; only the ordering is wrong.
134
203
 
135
- ### Design Tokens
204
+ Second, **authoring selectors that capture real-world state logic is fundamentally hard.** A single state like "dark mode" may depend on a root attribute, an OS preference, or both — each branch needing its own selector, proper negation of competing branches, and correct `@media` nesting. The example below shows the CSS you'd write by hand for just *one* property with *one* state. Scale that across dozens of properties, then add breakpoints and container queries, and the selector logic quickly becomes unmanageable.
205
+
206
+ Tasty solves both problems at once: **every state mapping compiles into mutually exclusive selectors.**
136
207
 
137
208
  ```tsx
138
- const TokenCard = tasty({
209
+ const Text = tasty({
139
210
  styles: {
140
- fill: '#surface', // Color token → var(--surface-color)
141
- color: '#text', // Color token
142
- padding: '2x', // Gap multiplier → calc(var(--gap) * 2)
143
- radius: '1r', // Border radius → var(--radius)
144
- border: '1bw solid #border',
211
+ color: {
212
+ '': '#text',
213
+ '@dark': '#text-on-dark',
214
+ },
215
+ padding: {
216
+ '': '4x',
217
+ '@mobile': '2x',
218
+ },
145
219
  },
146
220
  });
147
221
  ```
148
222
 
223
+ If `@dark` expands to `@root(schema=dark) | (!@root(schema) & @media(prefers-color-scheme: dark))`, try writing the CSS by hand. A first attempt might look like this:
224
+
225
+ ```css
226
+ /* First attempt — the @media branch is too broad */
227
+ .t0 { color: var(--text-color); }
228
+ :root[data-schema="dark"] .t0 { color: var(--text-on-dark-color); }
229
+ @media (prefers-color-scheme: dark) {
230
+ .t0 { color: var(--text-on-dark-color); }
231
+ }
232
+ ```
233
+
234
+ The `@media` branch fires even when `data-schema="light"` is explicitly set. Fix that:
235
+
236
+ ```css
237
+ /* Second attempt — @media is scoped, but the default is still too broad */
238
+ .t0 { color: var(--text-color); }
239
+ :root[data-schema="dark"] .t0 { color: var(--text-on-dark-color); }
240
+ @media (prefers-color-scheme: dark) {
241
+ :root:not([data-schema]) .t0 { color: var(--text-on-dark-color); }
242
+ }
243
+ ```
244
+
245
+ Better — but the bare `.t0` default still matches unconditionally. It matches in dark mode, it matches when `data-schema="dark"` is set, and it can beat the attribute selector by source order if another rule re-declares it later. There is no selector that says "apply this default only when none of the dark branches win."
246
+
247
+ This is just *one* property with *one* state, and getting it right already takes multiple iterations. The correct selectors require negating every other branch — which is exactly what Tasty generates automatically:
248
+
249
+ Tasty generates the correct version automatically:
250
+
251
+ ```css
252
+ /* Branch 1: Explicit dark schema */
253
+ :root[data-schema="dark"] .t0.t0 {
254
+ color: var(--text-on-dark-color);
255
+ }
256
+
257
+ /* Branch 2: No schema attribute + OS prefers dark */
258
+ @media (prefers-color-scheme: dark) {
259
+ :root:not([data-schema]) .t0.t0 {
260
+ color: var(--text-on-dark-color);
261
+ }
262
+ }
263
+
264
+ /* Default: no schema + OS does not prefer dark */
265
+ @media (not (prefers-color-scheme: dark)) {
266
+ :root:not([data-schema="dark"]) .t0.t0 {
267
+ color: var(--text-color);
268
+ }
269
+ }
270
+
271
+ /* Default: schema is set but not dark (any OS preference) */
272
+ :root:not([data-schema="dark"])[data-schema] .t0.t0 {
273
+ color: var(--text-color);
274
+ }
275
+ ```
276
+
277
+ Every rule is guarded by the negation of higher-priority rules. No two rules can match at the same time. No specificity arithmetic. No source-order dependence. Components compose and extend without collisions.
278
+
279
+ By absorbing selector complexity, Tasty makes advanced CSS patterns practical again — nested container queries, multi-condition `@supports` gates, and combined root-state/media branches. You stay in pure CSS instead of relying on JavaScript workarounds, so the browser can optimize layout, painting, and transitions natively. Tasty doesn't limit CSS; it unlocks its full potential by removing the complexity that held teams back.
280
+
281
+ [Try it in the Tasty Playground →](https://cube-ui-kit.vercel.app/?path=/story/getting-started-tasty-playground--playground)
282
+
283
+ ## Capabilities
284
+
285
+ ### Design Tokens and Custom Units
286
+
287
+ Tokens are first-class. Colors use `#name` syntax. Spacing, radius, and border width use multiplier units tied to CSS custom properties:
288
+
289
+ ```tsx
290
+ fill: '#surface', // → var(--surface-color)
291
+ color: '#text.80', // → 80% opacity text token
292
+ padding: '2x', // → calc(var(--gap) * 2)
293
+ radius: '1r', // → var(--radius)
294
+ border: '1bw solid #border',
295
+ ```
296
+
297
+ | Unit | Maps to | Example |
298
+ |------|---------|---------|
299
+ | `x` | `--gap` multiplier | `2x` → `calc(var(--gap) * 2)` |
300
+ | `r` | `--radius` multiplier | `1r` → `var(--radius)` |
301
+ | `bw` | `--border-width` multiplier | `1bw` → `var(--border-width)` |
302
+ | `ow` | `--outline-width` multiplier | `1ow` → `var(--outline-width)` |
303
+ | `cr` | `--card-radius` multiplier | `1cr` → `var(--card-radius)` |
304
+
305
+ Define your own units via `configure({ units: { ... } })`.
306
+
307
+ ### State System
308
+
309
+ Every style property accepts a state mapping object. Keys can be combined with boolean logic:
310
+
311
+ | State type | Syntax | CSS output |
312
+ |------------|--------|------------|
313
+ | Data attribute (boolean modifier) | `disabled` | `[data-disabled]` |
314
+ | Data attribute (value modifier) | `theme=danger` | `[data-theme="danger"]` |
315
+ | Pseudo-class | `:hover` | `:hover` |
316
+ | Attribute selector | `[role="tab"]` | `[role="tab"]` |
317
+ | Class selector (supported) | `.is-active` | `.is-active` |
318
+ | Media query | `@media(w < 768px)` | `@media (width < 768px)` |
319
+ | Container query | `@(panel, w >= 300px)` | `@container panel (width >= 300px)` |
320
+ | Root state | `@root(theme=dark)` | `:root[data-theme="dark"]` |
321
+ | Parent state | `@parent(theme=danger)` | `:is([data-theme="danger"] *)` |
322
+ | Feature query | `@supports(display: grid)` | `@supports (display: grid)` |
323
+ | Entry animation | `@starting` | `@starting-style` |
324
+
325
+ Combine with `&` (AND), `|` (OR), `!` (NOT):
326
+
327
+ ```tsx
328
+ fill: {
329
+ '': '#surface',
330
+ 'theme=danger & :hover': '#danger-hover',
331
+ '[aria-selected="true"]': '#accent-subtle',
332
+ }
333
+ ```
334
+
149
335
  ### Sub-Element Styling
150
336
 
337
+ Style inner elements from the parent component definition. No extra components, no CSS leakage:
338
+
151
339
  ```tsx
152
340
  const Card = tasty({
153
341
  styles: {
154
342
  padding: '4x',
155
343
  Title: { preset: 'h3', color: '#primary' },
156
- Content: { color: '#text' },
157
- },
158
- elements: {
159
- Title: 'h2',
160
- Content: 'div',
344
+ Content: { color: '#text', preset: 't2' },
161
345
  },
346
+ elements: { Title: 'h2', Content: 'div' },
162
347
  });
163
348
 
164
349
  <Card>
165
- <Card.Title>Title</Card.Title>
166
- <Card.Content>Content</Card.Content>
350
+ <Card.Title>Heading</Card.Title>
351
+ <Card.Content>Body text</Card.Content>
167
352
  </Card>
168
353
  ```
169
354
 
170
- ### Hooks
355
+ Sub-elements use `data-element` attributes — no extra class names, no naming conventions.
356
+
357
+ By default, sub-elements participate in the same state context as the root component. That means mappings like `:hover`, `theme=danger`, `[role="button"]`, and other keys are evaluated as one unified block, which keeps styling logic predictable across the whole markup tree.
358
+
359
+ Use `@own(...)` when a sub-element should react to its own state instead of the root state context.
360
+
361
+ Class selectors are also supported, but modifiers/pseudo-classes are usually the better default in design-system code.
362
+
363
+ Use the sub-element selector `$` when you need precise descendant targeting to avoid leakage in deeply nested component trees.
364
+
365
+ ### Variants
366
+
367
+ Variants are designed to keep single-component CSS lean. Instead of generating dozens of static button classes up front, define all versions once and let runtime usage decide what CSS is actually emitted.
368
+
369
+ ```tsx
370
+ const Button = tasty({
371
+ styles: { padding: '2x 4x', radius: '1r' },
372
+ variants: {
373
+ default: { fill: '#primary', color: '#on-primary' },
374
+ danger: { fill: '#danger', color: '#on-danger' },
375
+ outline: { fill: 'transparent', border: '1bw solid #primary' },
376
+ },
377
+ });
378
+
379
+ <Button variant="danger">Delete</Button>
380
+ ```
381
+
382
+ ### Recipes
383
+
384
+ Recipes are predefined style sets that work like composable styling classes for Tasty. They can be pre-applied or post-applied to current styles, which lets you add reusable state logic while still allowing local style overrides.
171
385
 
172
386
  ```tsx
173
- import { useStyles, useGlobalStyles } from '@tenphi/tasty';
387
+ configure({
388
+ recipes: {
389
+ card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
390
+ elevated: { shadow: '0 2x 4x #shadow' },
391
+ },
392
+ });
174
393
 
175
- function MyComponent() {
176
- const { className } = useStyles({
177
- padding: '2x',
178
- fill: '#surface',
179
- });
394
+ const ProfileCard = tasty({
395
+ styles: {
396
+ recipe: 'card elevated',
397
+ color: '#text',
398
+ },
399
+ });
400
+ ```
180
401
 
181
- useGlobalStyles('.card', {
182
- border: '1bw solid #border',
183
- radius: '1r',
184
- });
402
+ Use `/` to post-apply recipes after local styles when you need recipe states/styles to win the final merge order. Use `none` to skip base recipes: `recipe: 'none / disabled'`.
403
+
404
+ ### Auto-Inferred `@property`
405
+
406
+ CSS custom properties do not animate smoothly by default because the browser does not know how to interpolate their values. The [`@property`](https://developer.mozilla.org/en-US/docs/Web/CSS/@property) at-rule fixes that by declaring a property's syntax, such as `<number>` or `<color>`.
407
+
408
+ In Tasty, you usually do not need to declare `@property` manually. When a custom property is assigned a concrete value, Tasty infers the syntax and registers the matching `@property` for you:
409
+
410
+ ```tsx
411
+ const Pulse = tasty({
412
+ styles: {
413
+ animation: 'pulse 2s infinite',
414
+ transform: 'scale($pulse-scale)',
415
+ '@keyframes': {
416
+ pulse: {
417
+ '0%, 100%': { '$pulse-scale': 1 },
418
+ '50%': { '$pulse-scale': 1.05 },
419
+ },
420
+ },
421
+ },
422
+ });
423
+ ```
424
+
425
+ Here, `$pulse-scale: 1` is inferred as `<number>`, so Tasty injects `@property --pulse-scale` automatically before using it in the animation. Numeric types (`<number>`, `<length>`, `<percentage>`, `<angle>`, `<time>`) are inferred from values; `<color>` is inferred from the `#name` token convention.
185
426
 
186
- return <div className={className}>Styled</div>;
427
+ If you prefer full manual control, disable auto-inference globally with `configure({ autoPropertyTypes: false })`.
428
+
429
+ ### Explicit `@properties`
430
+
431
+ Declare `@properties` yourself only when you need to override the defaults, for example to set `inherits: false` or provide a custom `initialValue`:
432
+
433
+ ```tsx
434
+ '@properties': {
435
+ '$pulse-scale': { syntax: '<number>', inherits: false, initialValue: 1 },
436
+ },
437
+ ```
438
+
439
+ ### React Hooks
440
+
441
+ For cases where you don't need a full component:
442
+
443
+ ```tsx
444
+ import { useStyles, useGlobalStyles, useRawCSS } from '@tenphi/tasty';
445
+
446
+ function App() {
447
+ const { className } = useStyles({ padding: '2x', fill: '#surface' });
448
+ useGlobalStyles('body', { margin: '0' });
449
+ useRawCSS('@font-face { font-family: "Custom"; src: url(...); }');
450
+
451
+ return <main className={className}>...</main>;
187
452
  }
188
453
  ```
189
454
 
190
455
  ### Zero-Runtime Mode
191
456
 
457
+ Extract all CSS at build time. Zero JavaScript overhead in production:
458
+
192
459
  ```tsx
193
460
  import { tastyStatic } from '@tenphi/tasty/static';
194
461
 
195
- const button = tastyStatic({
196
- display: 'inline-flex',
197
- padding: '2x 4x',
198
- fill: '#purple',
199
- color: '#white',
462
+ const card = tastyStatic({
463
+ padding: '4x',
464
+ fill: '#surface',
465
+ radius: '1r',
466
+ color: { '': '#text', '@dark': '#text-on-dark' },
200
467
  });
201
468
 
202
- <button className={button}>Click me</button>
469
+ // card is a CSS class name string
470
+ <div className={card}>Static styles, zero runtime</div>
203
471
  ```
204
472
 
205
473
  Configure the Babel plugin:
206
474
 
207
475
  ```js
208
- // babel.config.js
209
476
  module.exports = {
210
477
  plugins: [
211
- ['@tenphi/tasty/babel-plugin', { output: 'public/tasty.css' }],
478
+ ['@tenphi/tasty/babel-plugin', {
479
+ output: 'public/tasty.css',
480
+ config: {
481
+ states: { '@dark': '@root(theme=dark)' },
482
+ },
483
+ }],
212
484
  ],
213
485
  };
214
486
  ```
215
487
 
216
- ## Built-in Units
488
+ ### `tasty` vs `tastyStatic`
217
489
 
218
- | Unit | Description | Example | CSS Output |
219
- |------|-------------|---------|------------|
220
- | `x` | Gap multiplier | `2x` | `calc(var(--gap) * 2)` |
221
- | `r` | Border radius | `1r` | `var(--radius)` |
222
- | `cr` | Card border radius | `1cr` | `var(--card-radius)` |
223
- | `bw` | Border width | `2bw` | `calc(var(--border-width) * 2)` |
224
- | `ow` | Outline width | `1ow` | `var(--outline-width)` |
225
- | `fs` | Font size | `1fs` | `var(--font-size)` |
226
- | `lh` | Line height | `1lh` | `var(--line-height)` |
227
- | `sf` | Stable fraction | `1sf` | `minmax(0, 1fr)` |
490
+ | | `tasty` (runtime) | `tastyStatic` (zero-runtime) |
491
+ |---|---|---|
492
+ | **Output** | React component | CSS class name |
493
+ | **CSS injection** | Runtime `<style>` tags | Build-time extraction |
494
+ | **Runtime cost** | Style generation on mount | None |
495
+ | **Generated CSS scope** | Only styles/variants used at runtime | All extracted static styles at build time |
496
+ | **Dynamic values** | Fully supported | Via CSS custom properties |
497
+ | **Sub-elements** | Built-in (`<C.Title>`) | Manual (`data-element`) |
498
+ | **Variants** | Built-in (`variants` option) | Separate static styles |
499
+ | **Framework** | React | Any (requires Babel) |
500
+ | **Best for** | Interactive apps, design systems | Static sites, SSG, landing pages |
228
501
 
229
- ## `tasty` vs `tastyStatic`
502
+ Both share the same DSL, tokens, units, state mappings, and recipes.
230
503
 
231
- Tasty ships two styling APIs with different trade-offs. Pick the one that fits your project:
504
+ ### Runtime Performance
232
505
 
233
- | | `tasty` (runtime) | `tastyStatic` (zero-runtime) |
234
- |---|---|---|
235
- | **Framework** | React only | Framework-agnostic (requires Babel) |
236
- | **Import** | `@tenphi/tasty` | `@tenphi/tasty/static` |
237
- | **Output** | React component | CSS class name (string) |
238
- | **CSS injection** | At runtime via `<style>` tags | At build time via Babel plugin |
239
- | **Runtime overhead** | Style generation + injection on mount | None — CSS is pre-extracted |
240
- | **Requires Babel plugin** | No | Yes (`@tenphi/tasty/babel-plugin`) |
241
- | **Component creation** | `tasty({ as, styles, ... })` | `tastyStatic({ ... })` returns a class |
242
- | **Extending components** | `tasty(BaseComponent, { styles })` | `tastyStatic(baseStyle, { ... })` |
243
- | **Global / selector styles** | `useGlobalStyles(selector, styles)` | `tastyStatic(selector, styles)` |
244
- | **Style props at runtime** | Yes — `styleProps`, `styles`, `mods` | No — all values must be static |
245
- | **Dynamic values** | Fully supported | Only via CSS custom properties |
246
- | **Sub-elements** | Built-in (`elements` + `<C.Title>`) | Manual (use `data-element` + CSS) |
247
- | **Variants** | Built-in (`variants` option) | Manual (create separate static styles) |
248
- | **Tokens** | `tokens` prop → inline CSS vars | `processTokens()` helper |
249
- | **Design tokens & units** | Full support (`#color`, `2x`, `1r`) | Full support (`#color`, `2x`, `1r`) |
250
- | **State mappings** | Full support (modifiers, media, etc.) | Full support (modifiers, media, etc.) |
251
- | **Recipes** | Supported via `configure()` | Supported via Babel plugin config |
252
- | **Best for** | Interactive React apps, design systems | Static sites, landing pages, SSG |
506
+ If you choose the runtime approach, performance is usually a non-issue in practice:
507
+
508
+ - CSS is generated and injected only when styles are actually used.
509
+ - Multi-level caching avoids repeated parsing and style recomputation.
510
+ - Styles are split into reusable chunks and applied as multiple class names, so matching chunks can be reused across components instead of re-injected.
511
+ - Style normalization guarantees equivalent style input resolves to the same chunks, improving deduplication hit rates.
512
+ - A style garbage collector removes unused styles/chunks over time.
513
+ - A dedicated style injector minimizes DOM/style-tag overhead.
514
+ - This approach is validated in enterprise-scale apps where runtime styling overhead is not noticeable in normal UI flows.
515
+
516
+ ### Server-Side Rendering (Experimental)
517
+
518
+ SSR with zero-cost client hydration. Existing `tasty()` components work unchanged — SSR is opt-in and requires no per-component modifications. Supports Next.js (App Router with streaming), Astro (middleware + islands), and any React-based framework via the core API. Requires React 19+.
519
+
520
+ **Next.js setup:**
521
+
522
+ ```tsx
523
+ // app/tasty-registry.tsx
524
+ 'use client';
525
+
526
+ import { TastyRegistry } from '@tenphi/tasty/ssr/next';
527
+
528
+ export default function TastyStyleRegistry({
529
+ children,
530
+ }: {
531
+ children: React.ReactNode;
532
+ }) {
533
+ return <TastyRegistry>{children}</TastyRegistry>;
534
+ }
535
+ ```
536
+
537
+ ```tsx
538
+ // app/layout.tsx
539
+ import TastyStyleRegistry from './tasty-registry';
540
+
541
+ export default function RootLayout({
542
+ children,
543
+ }: {
544
+ children: React.ReactNode;
545
+ }) {
546
+ return (
547
+ <html>
548
+ <body>
549
+ <TastyStyleRegistry>{children}</TastyStyleRegistry>
550
+ </body>
551
+ </html>
552
+ );
553
+ }
554
+ ```
555
+
556
+ See the [full SSR guide](docs/ssr.md) for Astro integration, streaming SSR, generic framework usage, and the complete API reference.
557
+
558
+ ## Entry Points
559
+
560
+ | Import | Description | Platform |
561
+ |--------|-------------|----------|
562
+ | `@tenphi/tasty` | Runtime style engine (`tasty`, hooks, `configure`) | Browser |
563
+ | `@tenphi/tasty/static` | Zero-runtime static styles (`tastyStatic`) | Browser |
564
+ | `@tenphi/tasty/core` | Lower-level internals (config, parser, pipeline, injector, style handlers) for tooling and advanced use | Browser / Node |
565
+ | `@tenphi/tasty/babel-plugin` | Babel plugin for zero-runtime CSS extraction | Node |
566
+ | `@tenphi/tasty/zero` | Programmatic extraction API | Node |
567
+ | `@tenphi/tasty/next` | Next.js integration wrapper | Node |
568
+ | `@tenphi/tasty/ssr` | Core SSR API (collector, context, hydration) | Node |
569
+ | `@tenphi/tasty/ssr/next` | Next.js App Router SSR integration | Node |
570
+ | `@tenphi/tasty/ssr/astro` | Astro middleware + auto-hydration | Node / Browser |
571
+
572
+ ## Ecosystem
573
+
574
+ Tasty is the core of a production-ready styling platform. These companion tools complete the picture:
575
+
576
+ ### [ESLint Plugin](https://github.com/tenphi/eslint-plugin-tasty)
577
+
578
+ `@tenphi/eslint-plugin-tasty` — 27 lint rules that validate style property names, value syntax, token existence, state keys, and enforce best practices. Catch typos and invalid styles at lint time, not at runtime.
579
+
580
+ ```bash
581
+ pnpm add -D @tenphi/eslint-plugin-tasty
582
+ ```
583
+
584
+ ```js
585
+ import tasty from '@tenphi/eslint-plugin-tasty';
586
+ export default [tasty.configs.recommended];
587
+ ```
588
+
589
+ ### [Glaze](https://github.com/tenphi/glaze)
590
+
591
+ `@tenphi/glaze` — OKHSL-based color theme generator with automatic WCAG contrast solving. Generate light, dark, and high-contrast palettes from a single hue, and export them directly as Tasty color tokens.
592
+
593
+ ```tsx
594
+ import { glaze } from '@tenphi/glaze';
595
+
596
+ const theme = glaze(280, 80);
597
+ theme.colors({
598
+ surface: { lightness: 97 },
599
+ text: { base: 'surface', lightness: '-52', contrast: 'AAA' },
600
+ });
601
+
602
+ const tokens = theme.tasty(); // Ready-to-use Tasty tokens
603
+ ```
604
+
605
+ ### [VS Code Extension](https://github.com/tenphi/tasty-vscode-extension)
606
+
607
+ Syntax highlighting for Tasty styles in TypeScript, TSX, JavaScript, and JSX. Highlights color tokens, custom units, state keys, presets, and style properties inside `tasty()`, `tastyStatic()`, and related APIs.
608
+
609
+ <p align="center">
610
+ <img src="assets/tasty-vscode-highlight.png" width="512" alt="Tasty VS Code syntax highlighting example">
611
+ </p>
612
+
613
+ ## Built with Tasty
614
+
615
+ ### [tasty.style](https://tasty.style) ([source](https://github.com/tenphi/tasty.style))
616
+
617
+ The official Tasty documentation and landing page — itself built entirely with Tasty. A showcase for zero-runtime styling via `tastyStatic`, SSR with Next.js, and OKHSL color theming with Glaze.
618
+
619
+ ### [Cube Cloud](https://cube.dev/)
620
+
621
+ Enterprise universal semantic layer platform by Cube Dev, Inc. Cube Cloud unifies data modeling, caching, access control, and APIs (REST, GraphQL, SQL, AI) for analytics at scale. Tasty has powered its frontend for over 5 years in production.
622
+
623
+ ### [Cube Cloud for Excel and Google Sheets](https://cube.dev/)
624
+
625
+ A single spreadsheet add-in deployed to both [Microsoft Excel](https://marketplace.microsoft.com/en-us/product/office/WA200008486) and [Google Sheets](https://workspace.google.com/u/0/marketplace/app/cube_cloud_for_sheets/641460343379). Connects spreadsheets to any cloud data platform (BigQuery, Databricks, Snowflake, Redshift, and more) via Cube Cloud's universal semantic layer.
626
+
627
+ ### [Cube UI Kit](https://github.com/cube-js/cube-ui-kit) ([storybook](https://cube-ui-kit.vercel.app/))
628
+
629
+ Open-source React UI kit built on Tasty + React Aria. 100+ production components proving Tasty works at design-system scale. A reference implementation and a ready-to-use component library.
253
630
 
254
631
  ## Documentation
255
632
 
256
- - [Runtime API (tasty)](docs/tasty.md) — Full runtime styling documentation
257
- - [Zero Runtime (tastyStatic)](docs/tasty-static.md) — Build-time static styling documentation
633
+ ### Start here
634
+
635
+ - **[Getting Started](docs/getting-started.md)** — Installation, first component, configuration, ESLint plugin setup, editor tooling, and rendering mode decision tree
636
+ - **[Methodology](docs/methodology.md)** — The recommended patterns for structuring Tasty components: root + sub-elements, styleProps, tokens, styles vs style, wrapping and extension
637
+
638
+ ### Guides
639
+
640
+ - **[Building a Design System](docs/design-system.md)** — Practical guide to building a DS layer: token vocabulary, state aliases, recipes, primitives, compound components, override contracts
641
+ - **[Adoption Guide](docs/adoption.md)** — Where Tasty sits in the stack, who should adopt it, what you define yourself, and how to introduce it incrementally into an existing design system
642
+
643
+ ### Reference
644
+
645
+ - **[Style DSL](docs/dsl.md)** — The Tasty style language: state maps, tokens, units, color syntax, extending semantics, recipes, keyframes, and @property
646
+ - **[Runtime API](docs/runtime.md)** — React-specific API: `tasty()` factory, component props, variants, sub-elements, and hooks
647
+ - **[Configuration](docs/configuration.md)** — Global configuration: tokens, recipes, custom units, style handlers, and TypeScript extensions
648
+ - **[Style Properties](docs/styles.md)** — Complete reference for all enhanced style properties: syntax, values, modifiers, and recommendations
649
+
650
+ ### Rendering modes
651
+
652
+ - **[Zero Runtime (tastyStatic)](docs/tasty-static.md)** — Build-time static styling: Babel plugin setup, Next.js integration, and static style patterns
653
+ - **[Server-Side Rendering](docs/ssr.md)** — SSR setup for Next.js, Astro, and generic frameworks: streaming support, cache hydration, and troubleshooting
654
+
655
+ ### Internals
656
+
657
+ - **[Style Injector](docs/injector.md)** — Internal CSS injection engine: `inject()`, `injectGlobal()`, `injectRawCSS()`, `keyframes()`, deduplication, reference counting, cleanup, SSR support, and Shadow DOM
658
+ - **[Debug Utilities](docs/debug.md)** — Runtime CSS inspection via `tastyDebug`: CSS extraction, element inspection, cache metrics, chunk breakdown, and performance monitoring
659
+
660
+ ### Context
661
+
662
+ - **[Comparison](docs/comparison.md)** — How Tasty compares to Tailwind, Panda CSS, vanilla-extract, StyleX, Stitches, and Emotion: positioning, trade-offs, and when each tool fits best
258
663
 
259
664
  ## License
260
665