@tenphi/tasty 0.0.0-snapshot.fafcbfe → 0.0.0-snapshot.fdb16ea

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 (309) hide show
  1. package/README.md +397 -185
  2. package/dist/async-storage-DKK-wTD4.js +44 -0
  3. package/dist/async-storage-DKK-wTD4.js.map +1 -0
  4. package/dist/babel-CMYf4JZ2.d.ts +83 -0
  5. package/dist/collector-Ctn5s74s.d.ts +145 -0
  6. package/dist/collector-DMSR6ANK.js +304 -0
  7. package/dist/collector-DMSR6ANK.js.map +1 -0
  8. package/dist/config-B23gZrfP.js +12317 -0
  9. package/dist/config-B23gZrfP.js.map +1 -0
  10. package/dist/config-CZx8_DCu.d.ts +1296 -0
  11. package/dist/context-CA8YKeMn.js +24 -0
  12. package/dist/context-CA8YKeMn.js.map +1 -0
  13. package/dist/core/index.d.ts +5 -33
  14. package/dist/core/index.js +6 -26
  15. package/dist/core-B1tyn69d.js +1573 -0
  16. package/dist/core-B1tyn69d.js.map +1 -0
  17. package/dist/css-writer-CvAxkR6S.js +390 -0
  18. package/dist/css-writer-CvAxkR6S.js.map +1 -0
  19. package/dist/format-global-rules-DklyaXv-.js +22 -0
  20. package/dist/format-global-rules-DklyaXv-.js.map +1 -0
  21. package/dist/format-rules-BCTWVvcS.js +130 -0
  22. package/dist/format-rules-BCTWVvcS.js.map +1 -0
  23. package/dist/hydrate-BCPvkJj3.js +37 -0
  24. package/dist/hydrate-BCPvkJj3.js.map +1 -0
  25. package/dist/index-B3o0aCYV.d.ts +1538 -0
  26. package/dist/index-CsvB0EXZ.d.ts +1909 -0
  27. package/dist/index.d.ts +5 -40
  28. package/dist/index.js +921 -32
  29. package/dist/index.js.map +1 -0
  30. package/dist/keyframes-Dxdx3KOo.js +493 -0
  31. package/dist/keyframes-Dxdx3KOo.js.map +1 -0
  32. package/dist/{utils/merge-styles.js → merge-styles-C-uwpoNW.js} +4 -6
  33. package/dist/merge-styles-C-uwpoNW.js.map +1 -0
  34. package/dist/{utils/merge-styles.d.ts → merge-styles-DJTSfz_M.d.ts} +3 -3
  35. package/dist/{utils/resolve-recipes.js → resolve-recipes-BuOvSEa2.js} +5 -8
  36. package/dist/resolve-recipes-BuOvSEa2.js.map +1 -0
  37. package/dist/ssr/astro-client.d.ts +1 -0
  38. package/dist/ssr/astro-client.js +19 -0
  39. package/dist/ssr/astro-client.js.map +1 -0
  40. package/dist/ssr/astro-middleware-static.d.ts +16 -0
  41. package/dist/ssr/astro-middleware-static.js +18 -0
  42. package/dist/ssr/astro-middleware-static.js.map +1 -0
  43. package/dist/ssr/astro-middleware.d.ts +17 -0
  44. package/dist/ssr/astro-middleware.js +19 -0
  45. package/dist/ssr/astro-middleware.js.map +1 -0
  46. package/dist/ssr/astro.d.ts +93 -0
  47. package/dist/ssr/astro.js +157 -0
  48. package/dist/ssr/astro.js.map +1 -0
  49. package/dist/ssr/index.d.ts +37 -0
  50. package/dist/ssr/index.js +10 -0
  51. package/dist/ssr/index.js.map +1 -0
  52. package/dist/ssr/next.d.ts +45 -0
  53. package/dist/ssr/next.js +74 -0
  54. package/dist/ssr/next.js.map +1 -0
  55. package/dist/static/index.d.ts +91 -5
  56. package/dist/static/index.js +49 -4
  57. package/dist/static/index.js.map +1 -0
  58. package/dist/static/inject.d.ts +5 -0
  59. package/dist/static/inject.js +17 -0
  60. package/dist/static/inject.js.map +1 -0
  61. package/dist/zero/babel.d.ts +2 -108
  62. package/dist/zero/babel.js +235 -39
  63. package/dist/zero/babel.js.map +1 -1
  64. package/dist/zero/index.d.ts +81 -3
  65. package/dist/zero/index.js +2 -4
  66. package/dist/zero/next.d.ts +56 -30
  67. package/dist/zero/next.js +106 -41
  68. package/dist/zero/next.js.map +1 -1
  69. package/docs/README.md +39 -0
  70. package/docs/adoption.md +323 -0
  71. package/docs/ai-agents.md +224 -0
  72. package/docs/comparison.md +448 -0
  73. package/docs/configuration.md +823 -0
  74. package/docs/debug.md +322 -0
  75. package/docs/design-system.md +455 -0
  76. package/docs/dsl.md +1021 -0
  77. package/docs/getting-started.md +238 -0
  78. package/docs/injector.md +614 -0
  79. package/docs/methodology.md +648 -0
  80. package/docs/migration-v3.md +285 -0
  81. package/docs/pipeline.md +741 -0
  82. package/docs/plugins.md +353 -0
  83. package/docs/react-api.md +681 -0
  84. package/docs/runtime-benchmarks.md +216 -0
  85. package/docs/ssr.md +451 -0
  86. package/docs/styles.md +645 -0
  87. package/docs/tasty-static.md +582 -0
  88. package/package.json +149 -40
  89. package/tasty.config.ts +6 -0
  90. package/dist/_virtual/_rolldown/runtime.js +0 -8
  91. package/dist/chunks/cacheKey.js +0 -70
  92. package/dist/chunks/cacheKey.js.map +0 -1
  93. package/dist/chunks/definitions.d.ts +0 -37
  94. package/dist/chunks/definitions.js +0 -260
  95. package/dist/chunks/definitions.js.map +0 -1
  96. package/dist/chunks/renderChunk.js +0 -61
  97. package/dist/chunks/renderChunk.js.map +0 -1
  98. package/dist/config.d.ts +0 -280
  99. package/dist/config.js +0 -403
  100. package/dist/config.js.map +0 -1
  101. package/dist/debug.d.ts +0 -204
  102. package/dist/debug.js +0 -733
  103. package/dist/debug.js.map +0 -1
  104. package/dist/hooks/useGlobalStyles.d.ts +0 -27
  105. package/dist/hooks/useGlobalStyles.js +0 -56
  106. package/dist/hooks/useGlobalStyles.js.map +0 -1
  107. package/dist/hooks/useKeyframes.d.ts +0 -56
  108. package/dist/hooks/useKeyframes.js +0 -54
  109. package/dist/hooks/useKeyframes.js.map +0 -1
  110. package/dist/hooks/useProperty.d.ts +0 -79
  111. package/dist/hooks/useProperty.js +0 -91
  112. package/dist/hooks/useProperty.js.map +0 -1
  113. package/dist/hooks/useRawCSS.d.ts +0 -53
  114. package/dist/hooks/useRawCSS.js +0 -28
  115. package/dist/hooks/useRawCSS.js.map +0 -1
  116. package/dist/hooks/useStyles.d.ts +0 -40
  117. package/dist/hooks/useStyles.js +0 -169
  118. package/dist/hooks/useStyles.js.map +0 -1
  119. package/dist/injector/index.d.ts +0 -157
  120. package/dist/injector/index.js +0 -154
  121. package/dist/injector/index.js.map +0 -1
  122. package/dist/injector/injector.d.ts +0 -139
  123. package/dist/injector/injector.js +0 -404
  124. package/dist/injector/injector.js.map +0 -1
  125. package/dist/injector/sheet-manager.d.ts +0 -127
  126. package/dist/injector/sheet-manager.js +0 -714
  127. package/dist/injector/sheet-manager.js.map +0 -1
  128. package/dist/injector/types.d.ts +0 -135
  129. package/dist/keyframes/index.js +0 -206
  130. package/dist/keyframes/index.js.map +0 -1
  131. package/dist/parser/classify.js +0 -319
  132. package/dist/parser/classify.js.map +0 -1
  133. package/dist/parser/const.js +0 -33
  134. package/dist/parser/const.js.map +0 -1
  135. package/dist/parser/lru.js +0 -109
  136. package/dist/parser/lru.js.map +0 -1
  137. package/dist/parser/parser.d.ts +0 -25
  138. package/dist/parser/parser.js +0 -116
  139. package/dist/parser/parser.js.map +0 -1
  140. package/dist/parser/tokenizer.js +0 -69
  141. package/dist/parser/tokenizer.js.map +0 -1
  142. package/dist/parser/types.d.ts +0 -51
  143. package/dist/parser/types.js +0 -46
  144. package/dist/parser/types.js.map +0 -1
  145. package/dist/pipeline/conditions.d.ts +0 -134
  146. package/dist/pipeline/conditions.js +0 -400
  147. package/dist/pipeline/conditions.js.map +0 -1
  148. package/dist/pipeline/exclusive.js +0 -231
  149. package/dist/pipeline/exclusive.js.map +0 -1
  150. package/dist/pipeline/index.d.ts +0 -53
  151. package/dist/pipeline/index.js +0 -641
  152. package/dist/pipeline/index.js.map +0 -1
  153. package/dist/pipeline/materialize.js +0 -908
  154. package/dist/pipeline/materialize.js.map +0 -1
  155. package/dist/pipeline/parseStateKey.d.ts +0 -15
  156. package/dist/pipeline/parseStateKey.js +0 -430
  157. package/dist/pipeline/parseStateKey.js.map +0 -1
  158. package/dist/pipeline/simplify.js +0 -557
  159. package/dist/pipeline/simplify.js.map +0 -1
  160. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  161. package/dist/plugins/okhsl-plugin.js +0 -371
  162. package/dist/plugins/okhsl-plugin.js.map +0 -1
  163. package/dist/plugins/types.d.ts +0 -69
  164. package/dist/properties/index.js +0 -158
  165. package/dist/properties/index.js.map +0 -1
  166. package/dist/states/index.d.ts +0 -49
  167. package/dist/states/index.js +0 -416
  168. package/dist/states/index.js.map +0 -1
  169. package/dist/static/tastyStatic.d.ts +0 -46
  170. package/dist/static/tastyStatic.js +0 -31
  171. package/dist/static/tastyStatic.js.map +0 -1
  172. package/dist/static/types.d.ts +0 -49
  173. package/dist/static/types.js +0 -24
  174. package/dist/static/types.js.map +0 -1
  175. package/dist/styles/align.d.ts +0 -15
  176. package/dist/styles/align.js +0 -14
  177. package/dist/styles/align.js.map +0 -1
  178. package/dist/styles/border.d.ts +0 -25
  179. package/dist/styles/border.js +0 -114
  180. package/dist/styles/border.js.map +0 -1
  181. package/dist/styles/color.d.ts +0 -14
  182. package/dist/styles/color.js +0 -23
  183. package/dist/styles/color.js.map +0 -1
  184. package/dist/styles/createStyle.js +0 -77
  185. package/dist/styles/createStyle.js.map +0 -1
  186. package/dist/styles/dimension.js +0 -97
  187. package/dist/styles/dimension.js.map +0 -1
  188. package/dist/styles/display.d.ts +0 -37
  189. package/dist/styles/display.js +0 -67
  190. package/dist/styles/display.js.map +0 -1
  191. package/dist/styles/fade.d.ts +0 -15
  192. package/dist/styles/fade.js +0 -58
  193. package/dist/styles/fade.js.map +0 -1
  194. package/dist/styles/fill.d.ts +0 -44
  195. package/dist/styles/fill.js +0 -51
  196. package/dist/styles/fill.js.map +0 -1
  197. package/dist/styles/flow.d.ts +0 -16
  198. package/dist/styles/flow.js +0 -12
  199. package/dist/styles/flow.js.map +0 -1
  200. package/dist/styles/gap.d.ts +0 -31
  201. package/dist/styles/gap.js +0 -37
  202. package/dist/styles/gap.js.map +0 -1
  203. package/dist/styles/height.d.ts +0 -17
  204. package/dist/styles/height.js +0 -20
  205. package/dist/styles/height.js.map +0 -1
  206. package/dist/styles/index.d.ts +0 -2
  207. package/dist/styles/index.js +0 -9
  208. package/dist/styles/index.js.map +0 -1
  209. package/dist/styles/inset.d.ts +0 -52
  210. package/dist/styles/inset.js +0 -150
  211. package/dist/styles/inset.js.map +0 -1
  212. package/dist/styles/justify.d.ts +0 -15
  213. package/dist/styles/justify.js +0 -14
  214. package/dist/styles/justify.js.map +0 -1
  215. package/dist/styles/list.d.ts +0 -16
  216. package/dist/styles/list.js +0 -98
  217. package/dist/styles/list.js.map +0 -1
  218. package/dist/styles/margin.d.ts +0 -24
  219. package/dist/styles/margin.js +0 -104
  220. package/dist/styles/margin.js.map +0 -1
  221. package/dist/styles/outline.d.ts +0 -29
  222. package/dist/styles/outline.js +0 -65
  223. package/dist/styles/outline.js.map +0 -1
  224. package/dist/styles/padding.d.ts +0 -24
  225. package/dist/styles/padding.js +0 -104
  226. package/dist/styles/padding.js.map +0 -1
  227. package/dist/styles/predefined.d.ts +0 -73
  228. package/dist/styles/predefined.js +0 -241
  229. package/dist/styles/predefined.js.map +0 -1
  230. package/dist/styles/preset.d.ts +0 -47
  231. package/dist/styles/preset.js +0 -126
  232. package/dist/styles/preset.js.map +0 -1
  233. package/dist/styles/radius.d.ts +0 -14
  234. package/dist/styles/radius.js +0 -51
  235. package/dist/styles/radius.js.map +0 -1
  236. package/dist/styles/scrollbar.d.ts +0 -21
  237. package/dist/styles/scrollbar.js +0 -105
  238. package/dist/styles/scrollbar.js.map +0 -1
  239. package/dist/styles/shadow.d.ts +0 -14
  240. package/dist/styles/shadow.js +0 -24
  241. package/dist/styles/shadow.js.map +0 -1
  242. package/dist/styles/styledScrollbar.d.ts +0 -47
  243. package/dist/styles/styledScrollbar.js +0 -38
  244. package/dist/styles/styledScrollbar.js.map +0 -1
  245. package/dist/styles/transition.d.ts +0 -14
  246. package/dist/styles/transition.js +0 -158
  247. package/dist/styles/transition.js.map +0 -1
  248. package/dist/styles/types.d.ts +0 -498
  249. package/dist/styles/width.d.ts +0 -17
  250. package/dist/styles/width.js +0 -20
  251. package/dist/styles/width.js.map +0 -1
  252. package/dist/tasty.d.ts +0 -982
  253. package/dist/tasty.js +0 -191
  254. package/dist/tasty.js.map +0 -1
  255. package/dist/tokens/typography.d.ts +0 -19
  256. package/dist/tokens/typography.js +0 -237
  257. package/dist/tokens/typography.js.map +0 -1
  258. package/dist/types.d.ts +0 -184
  259. package/dist/utils/cache-wrapper.js +0 -26
  260. package/dist/utils/cache-wrapper.js.map +0 -1
  261. package/dist/utils/case-converter.js +0 -8
  262. package/dist/utils/case-converter.js.map +0 -1
  263. package/dist/utils/colors.d.ts +0 -5
  264. package/dist/utils/colors.js +0 -9
  265. package/dist/utils/colors.js.map +0 -1
  266. package/dist/utils/css-types.d.ts +0 -7
  267. package/dist/utils/dotize.d.ts +0 -26
  268. package/dist/utils/dotize.js +0 -122
  269. package/dist/utils/dotize.js.map +0 -1
  270. package/dist/utils/filter-base-props.d.ts +0 -15
  271. package/dist/utils/filter-base-props.js +0 -45
  272. package/dist/utils/filter-base-props.js.map +0 -1
  273. package/dist/utils/get-display-name.d.ts +0 -7
  274. package/dist/utils/get-display-name.js +0 -10
  275. package/dist/utils/get-display-name.js.map +0 -1
  276. package/dist/utils/hsl-to-rgb.js +0 -38
  277. package/dist/utils/hsl-to-rgb.js.map +0 -1
  278. package/dist/utils/is-dev-env.js +0 -19
  279. package/dist/utils/is-dev-env.js.map +0 -1
  280. package/dist/utils/is-valid-element-type.js +0 -15
  281. package/dist/utils/is-valid-element-type.js.map +0 -1
  282. package/dist/utils/merge-styles.js.map +0 -1
  283. package/dist/utils/mod-attrs.d.ts +0 -8
  284. package/dist/utils/mod-attrs.js +0 -21
  285. package/dist/utils/mod-attrs.js.map +0 -1
  286. package/dist/utils/okhsl-to-rgb.js +0 -296
  287. package/dist/utils/okhsl-to-rgb.js.map +0 -1
  288. package/dist/utils/process-tokens.d.ts +0 -31
  289. package/dist/utils/process-tokens.js +0 -171
  290. package/dist/utils/process-tokens.js.map +0 -1
  291. package/dist/utils/resolve-recipes.d.ts +0 -17
  292. package/dist/utils/resolve-recipes.js.map +0 -1
  293. package/dist/utils/string.js +0 -8
  294. package/dist/utils/string.js.map +0 -1
  295. package/dist/utils/styles.d.ts +0 -183
  296. package/dist/utils/styles.js +0 -585
  297. package/dist/utils/styles.js.map +0 -1
  298. package/dist/utils/typography.d.ts +0 -36
  299. package/dist/utils/typography.js +0 -53
  300. package/dist/utils/typography.js.map +0 -1
  301. package/dist/utils/warnings.d.ts +0 -16
  302. package/dist/utils/warnings.js +0 -16
  303. package/dist/utils/warnings.js.map +0 -1
  304. package/dist/zero/css-writer.d.ts +0 -45
  305. package/dist/zero/css-writer.js +0 -74
  306. package/dist/zero/css-writer.js.map +0 -1
  307. package/dist/zero/extractor.d.ts +0 -24
  308. package/dist/zero/extractor.js +0 -150
  309. package/dist/zero/extractor.js.map +0 -1
@@ -0,0 +1,323 @@
1
+ # Adoption Guide
2
+
3
+ Tasty is most useful where reusable component styling has become a state-resolution problem: hover intersects with disabled, variants intersect with themes, and every extension makes selector behavior harder to predict.
4
+
5
+ It normally sits underneath a design system’s existing components. You can preserve their public React APIs while moving their style logic into state maps that produce one declared winner. Adoption should start with a small, state-heavy component—not an all-at-once rewrite.
6
+
7
+ This guide is for design-system maintainers and platform engineers evaluating Tasty or introducing it into an existing codebase. Use it for rollout strategy and adoption sequencing; use the [Comparison guide](comparison.md) when the open question is whether Tasty is the right tool.
8
+
9
+ ---
10
+
11
+ ## Where Tasty sits in the stack
12
+
13
+ Tasty is not the surface your product engineers interact with directly. It sits one layer below:
14
+
15
+ ```
16
+ Product code
17
+ └─ DS components (Button, Card, Layout, ...)
18
+ └─ Tasty engine (tasty(), configure(), style functions)
19
+ └─ CSS (mutually exclusive selectors, tokens, custom properties)
20
+ ```
21
+
22
+ **What Tasty owns:**
23
+
24
+ - The DSL and value parser (tokens, custom units, auto-calc, color opacity)
25
+ - State compilation (mutually exclusive selectors from state maps)
26
+ - Style injection and deduplication (runtime or build-time)
27
+ - The `tasty()` component factory and hooks API
28
+
29
+ **What the DS team owns:**
30
+
31
+ - Token names and values (colors, spacing, typography)
32
+ - Custom units and their semantics
33
+ - State aliases (`@mobile`, `@dark`, `@compact`)
34
+ - Recipes (reusable style bundles)
35
+ - Which style props each component exposes
36
+ - Sub-element structure for compound components
37
+ - The override and extension rules product teams follow
38
+
39
+ Two teams using Tasty can end up with very different authoring models. That is by design.
40
+
41
+ ---
42
+
43
+ ## Who should adopt Tasty
44
+
45
+ **Strong fit:**
46
+
47
+ - A design-system or platform team that owns shared component APIs
48
+ - Components with complex, intersecting states (hover + disabled + theme + breakpoint)
49
+ - Teams that need deterministic style resolution without cascade/specificity bugs
50
+ - Organizations that want tokens, states, and extension rules to stay consistent across products
51
+
52
+ **Not the right fit:**
53
+
54
+ - Solo developers building a one-off app with minimal UI structure
55
+ - Teams that want a shared utility vocabulary and direct markup authoring (Tailwind is better here)
56
+ - Projects where low ceremony matters more than central governance
57
+ - Codebases where intersecting state complexity is low
58
+
59
+ For a detailed comparison with Tailwind, Panda CSS, vanilla-extract, StyleX, Stitches, and Emotion, see the [Comparison guide](comparison.md).
60
+
61
+ ---
62
+
63
+ ## What you are expected to define
64
+
65
+ Tasty provides the engine. The DS team defines the language that runs on it. Here is what that typically involves:
66
+
67
+ | Layer | What you define | Where |
68
+ | ------------------ | ---------------------------------------------------------- | ------------------------------------------ |
69
+ | **Tokens** | Color names, spacing scale, border widths, radii | `configure({ tokens })` |
70
+ | **Units** | Custom multiplier units (`x`, `r`, `bw`, or your own) | `configure({ units })` |
71
+ | **State aliases** | Responsive breakpoints, theme modes, feature flags | `configure({ states })` |
72
+ | **Recipes** | Reusable style bundles (card, elevated, input-reset) | `configure({ recipes })` |
73
+ | **Typography** | Preset definitions (h1-h6, t1-t4, etc.) | `configure({ presets: { ... } })` |
74
+ | **Style props** | Which CSS properties each component exposes as React props | `styleProps` in each component |
75
+ | **Sub-elements** | Inner parts of compound components (Title, Icon, Content) | `elements` + capitalized keys in `styles` |
76
+ | **Override rules** | How product engineers extend or constrain components | Styled wrappers via `tasty(Base, { ... })` |
77
+
78
+ The same engine can power a minimal design system with a handful of tokens:
79
+
80
+ ```tsx
81
+ configure({
82
+ tokens: { '#bg': '#white', '#text': '#111' },
83
+ states: { '@dark': '@root(schema=dark)' },
84
+ });
85
+ ```
86
+
87
+ ...or an enterprise-scale system with dozens of tokens, multiple state aliases, typography presets, recipes, and custom units. The scope is yours to decide.
88
+
89
+ Here is how the layers connect end-to-end. The DS team configures the engine, defines components, and product engineers consume them:
90
+
91
+ ```tsx
92
+ // ds/config.ts — DS team defines the language
93
+ configure({
94
+ tokens: {
95
+ '#primary': 'oklch(55% 0.25 265)',
96
+ '#surface': '#fff',
97
+ '#text': '#111',
98
+ },
99
+ states: { '@mobile': '@media(w < 768px)', '@dark': '@root(schema=dark)' },
100
+ recipes: {
101
+ card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
102
+ },
103
+ });
104
+
105
+ // ds/components/Card.tsx — DS team builds components on top
106
+ const Card = tasty({
107
+ styles: {
108
+ recipe: 'card',
109
+ Title: { preset: 'h3', color: '#primary' },
110
+ Body: { preset: 't2', color: '#text' },
111
+ },
112
+ elements: { Title: 'h2', Body: 'div' },
113
+ styleProps: ['padding', 'fill'],
114
+ });
115
+
116
+ // app/Dashboard.tsx — product engineer uses the component
117
+ <Card padding={{ '': '4x', '@mobile': '2x' }}>
118
+ <Card.Title>Monthly Revenue</Card.Title>
119
+ <Card.Body>$1.2M — up 12% from last month</Card.Body>
120
+ </Card>;
121
+ ```
122
+
123
+ See [Configuration](configuration.md) for the full `configure()` API.
124
+
125
+ ---
126
+
127
+ ## Incremental adoption
128
+
129
+ You do not need to adopt everything at once. Tasty is designed to be introduced layer by layer.
130
+
131
+ A practical first slice is one component that already suffers from intersecting state and variant logic: a button, input, menu item, disclosure, or interactive card. Keep its public API unchanged, move one or two properties into Tasty state maps, and verify that the declared priority matches the behavior your team expects.
132
+
133
+ This proves the differentiator before you invest in a complete token vocabulary or migrate an entire component library.
134
+
135
+ ### Phase 1 -- Pilot one state-heavy component
136
+
137
+ Choose a component with a known hover/disabled, focus/error, or variant/theme interaction. Preserve its external props and visual behavior. The pilot should answer three questions:
138
+
139
+ 1. Is the state map easier to review than the existing selectors or conditional class logic?
140
+ 2. Does extending the component keep the intended state priority?
141
+ 3. Can your current tokens and component API move over without product-code churn?
142
+
143
+ If the answer is yes, establish the shared design-system vocabulary around the successful slice.
144
+
145
+ ### Phase 2 -- Tokens and units
146
+
147
+ Start by defining your design tokens and custom units. This is the lowest-risk step: it only configures the parser and does not require rewriting any components.
148
+
149
+ ```tsx
150
+ import { configure } from '@tenphi/tasty';
151
+
152
+ configure({
153
+ tokens: {
154
+ '#primary': 'oklch(55% 0.25 265)',
155
+ '#surface': '#white',
156
+ '#text': '#111',
157
+ '$card-padding': '4x',
158
+ },
159
+ // Common units (x, r, bw, ow, cr) are built-in.
160
+ // A DS typically redefines them to use CSS custom properties
161
+ // so that the actual scale is controlled via CSS, not JS:
162
+ units: {
163
+ x: 'var(--gap)', // 2x → calc(var(--gap) * 2)
164
+ r: 'var(--radius)',
165
+ bw: 'var(--border-width)',
166
+ },
167
+ });
168
+ ```
169
+
170
+ ### Phase 3 -- State aliases and recipes
171
+
172
+ Define the state vocabulary your components will share. This is where you start encoding your team's conventions.
173
+
174
+ ```tsx
175
+ configure({
176
+ states: {
177
+ '@mobile': '@media(w < 768px)',
178
+ '@tablet': '@media(w < 1024px)',
179
+ '@dark':
180
+ '@root(schema=dark) | (!@root(schema) & @media(prefers-color-scheme: dark))',
181
+ },
182
+ recipes: {
183
+ card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
184
+ elevated: { shadow: '0 2x 4x #shadow' },
185
+ },
186
+ });
187
+ ```
188
+
189
+ ### Phase 4 -- Migrate a few primitives
190
+
191
+ Pick 2-3 widely used primitives (Box, Text, Button) and rewrite them with `tasty()`. Keep the public API identical so product code does not need to change.
192
+
193
+ ```tsx
194
+ const Box = tasty({
195
+ as: 'div',
196
+ styles: {
197
+ display: 'flex',
198
+ flow: 'column',
199
+ gap: '1x',
200
+ },
201
+ styleProps: ['gap', 'flow', 'padding', 'fill'],
202
+ });
203
+ ```
204
+
205
+ At this point you can validate the DSL, token workflow, and component authoring experience before expanding the rollout.
206
+
207
+ ### Phase 5 -- Expand state resolution
208
+
209
+ Move the components with the most painful intersecting states (buttons with hover + disabled + theme variants, inputs with focus + error + readonly) to Tasty's state map syntax. This is where mutually exclusive selectors start paying off.
210
+
211
+ ```tsx
212
+ const Button = tasty({
213
+ as: 'button',
214
+ styles: {
215
+ fill: {
216
+ '': '#primary',
217
+ ':hover': '#primary-hover',
218
+ ':active': '#primary-pressed',
219
+ // `disabled` is a data-attribute modifier → [data-disabled].
220
+ // Tasty auto-applies it from the native `disabled` attribute.
221
+ // `[disabled]` (attribute selector) also works here.
222
+ disabled: '#surface',
223
+ },
224
+ color: {
225
+ '': '#on-primary',
226
+ disabled: '#text.40',
227
+ },
228
+ cursor: {
229
+ '': 'pointer',
230
+ disabled: 'not-allowed',
231
+ },
232
+ transition: 'theme',
233
+ },
234
+ });
235
+ ```
236
+
237
+ ### Phase 6 -- Standardize style props and sub-elements
238
+
239
+ Define which style props each component category exposes. Layout components get flow/gap/padding. Interactive components get positioning. Compound components declare sub-elements.
240
+
241
+ ```tsx
242
+ const Card = tasty({
243
+ styles: {
244
+ recipe: 'card elevated',
245
+ Title: { preset: 'h3', color: '#primary' },
246
+ Content: { color: '#text', preset: 't2' },
247
+ },
248
+ elements: { Title: 'h2', Content: 'div' },
249
+ styleProps: ['padding', 'fill', 'radius'],
250
+ });
251
+ ```
252
+
253
+ ### Phase 7 -- Expand to full DS coverage
254
+
255
+ Migrate the remaining components, add the [ESLint plugin](https://github.com/tenphi/eslint-plugin-tasty) to enforce style conventions at lint time, and choose between [server-only `tasty()`](ssr.md) and [`tastyStatic()` build-time extraction](tasty-static.md) when a page should ship no Tasty styling runtime.
256
+
257
+ ---
258
+
259
+ ## What changes for product engineers
260
+
261
+ When a DS is powered by Tasty, product engineers typically interact with **components, not Tasty itself**. Here is what changes from their perspective:
262
+
263
+ **They do not write CSS directly.** Styling decisions are embedded in the components the DS provides. Product code consumes components, tokens, and style props.
264
+
265
+ **Overrides use styled wrappers.** Instead of passing one-off `className` or `style` props, product engineers extend components:
266
+
267
+ ```tsx
268
+ import { tasty } from '@tenphi/tasty';
269
+ import { Button } from 'my-ds';
270
+
271
+ // Replace mode: providing '' (default) key replaces the parent's fill entirely
272
+ const DangerButton = tasty(Button, {
273
+ styles: {
274
+ fill: { '': '#danger', ':hover': '#danger-hover' },
275
+ },
276
+ });
277
+
278
+ // Extend mode: omitting '' key preserves parent states and adds/overrides
279
+ const LoadingButton = tasty(Button, {
280
+ styles: {
281
+ fill: {
282
+ loading: '#yellow', // new state appended
283
+ disabled: '#gray.20', // existing state overridden in place
284
+ },
285
+ },
286
+ });
287
+ ```
288
+
289
+ **Style props replace raw CSS.** Layout, spacing, and positioning are controlled through typed props on the components that expose them:
290
+
291
+ ```tsx
292
+ <Space flow="row" gap="2x" placeItems="center">
293
+ <Title>Dashboard</Title>
294
+ <Button placeSelf="end">Add Item</Button>
295
+ </Space>
296
+ ```
297
+
298
+ **Components are server components by default.** All `tasty()` components and style functions are hook-free, so they work as React Server Components without `'use client'`. In server-only contexts they ship no Tasty styling runtime. Astro without `client:*` directives ships no client JavaScript; server-only Next.js RSC follows the same Tasty architecture, while final output depends on the application deployment. Product engineers only add `'use client'` when their component needs actual React interactivity (state, effects, event handlers), never because of styling.
299
+
300
+ **No cascade/specificity concerns.** Tasty's mutually exclusive selectors mean extending a component cannot accidentally break another. Import order, class name collisions, and specificity arithmetic are non-issues.
301
+
302
+ ---
303
+
304
+ ## Migration and Interop Notes
305
+
306
+ - **From Tailwind**: keep utility-authored product surfaces as-is at first, and use Tasty to build or replace the design-system primitives underneath them instead of forcing an all-at-once markup rewrite.
307
+ - **From CSS-in-JS libraries**: start with shared primitives such as `Box`, `Text`, and `Button`, preserve the external component API, and move state logic into Tasty state maps so behavior changes without product-code churn.
308
+ - **From CSS Modules or plain CSS**: migrate token definitions and repeated patterns first, then wrap existing DOM structure with `tasty()` components gradually rather than converting every stylesheet at once.
309
+
310
+ ---
311
+
312
+ ## Learn more
313
+
314
+ - [README](../README.md) -- overview, quick start, and feature highlights
315
+ - [Getting Started](getting-started.md) -- installation, first component, tooling setup
316
+ - [Methodology](methodology.md) -- the recommended patterns for structuring Tasty components
317
+ - [Building a Design System](design-system.md) -- practical guide to building a DS layer with Tasty
318
+ - [Style DSL](dsl.md) -- state maps, tokens, units, extending semantics, keyframes, @property
319
+ - [React API](react-api.md) -- `tasty()` factory, component props, variants, sub-elements, style functions
320
+ - [Configuration](configuration.md) -- tokens, recipes, custom units, style handlers, and TypeScript extensions
321
+ - [Style Properties](styles.md) -- complete reference for all enhanced style properties
322
+ - [Comparison](comparison.md) -- positioning and trade-offs vs. other styling systems
323
+ - [Build-Time Extraction (`tastyStatic`)](tasty-static.md) -- static styling with the Babel plugin
@@ -0,0 +1,224 @@
1
+ # Tasty Style Rules for AI Agents
2
+
3
+ A compact ruleset for **writing correct `@tenphi/tasty` styles**. It is not an API tour — most rules here are machine-checked by [`@tenphi/eslint-plugin-tasty`](https://www.npmjs.com/package/@tenphi/eslint-plugin-tasty), so following it generally means clean lint output. The plugin ships separately and can lag a new DSL rule, so treat this page as the source of truth and the plugin as the enforcement that catches most of it. For explanations and the complete API, see [Style DSL](dsl.md), [Style Properties](styles.md), [React API](react-api.md).
4
+
5
+ Notation: ❌ wrong → ✅ correct.
6
+
7
+ ---
8
+
9
+ ## 0. Read the project config first
10
+
11
+ Color tokens (`#name`), custom properties (`$name`), `preset` names, `recipe` names, state aliases (`@mobile`) and extra units are **project-defined** in `tasty.config.ts` or a `configure({ … })` call. Look them up before writing styles. Never invent a name — reuse an existing one, or add it to the config.
12
+
13
+ ## 1. Where styles go
14
+
15
+ ```jsx
16
+ const Card = tasty({ as: 'div', styles: { … }, styleProps: ['padding'] }); // new component
17
+ const Hero = tasty(Card, { styles: { … } }); // extend a component
18
+ const cls = useStyles({ … }); // ad-hoc class name
19
+ tastyStatic('.card', { … }); // build-time extraction
20
+ ```
21
+
22
+ - Wrap, don't pass styles per instance: ❌ `<Box styles={{ padding: '2x' }} />` → ✅ `const Box = tasty({ styles: { padding: '2x' } })`.
23
+ - Style values are **static**. Route anything conditional through a state map plus `mods` (or `tokens` / `styleProps`):
24
+ ❌ `fill: isOpen ? '#primary' : '#surface'` → ✅ `fill: { '': '#surface', open: '#primary' }` with `mods={{ open: isOpen }}`.
25
+
26
+ ## 2. Property names
27
+
28
+ Keys are camelCase — a Tasty property or a real CSS property. No kebab-case, no invented names.
29
+
30
+ Prefer the Tasty shorthand over its CSS equivalents:
31
+
32
+ | Use | Instead of |
33
+ | ---------------------------------------- | ------------------------------------------------------------------------------------- |
34
+ | `fill` | `backgroundColor`, `background` |
35
+ | `image` | `backgroundImage` |
36
+ | `border` | `borderColor`, `borderWidth`, `borderStyle`, `borderTop`/`Right`/`Bottom`/`Left` |
37
+ | `radius` | `borderRadius` |
38
+ | `outline` | `outlineColor`, `outlineWidth`, `outlineStyle`, `outlineOffset` |
39
+ | `shadow` | `boxShadow` |
40
+ | `padding` | `paddingTop`/`Right`/`Bottom`/`Left` |
41
+ | `margin` | `marginTop`/`Right`/`Bottom`/`Left` |
42
+ | `inset` | `top`, `right`, `bottom`, `left` |
43
+ | `width` / `height` | `minWidth`/`maxWidth`, `minHeight`/`maxHeight` |
44
+ | `flow` | `flexDirection`, `flexWrap`, `flexFlow`, `gridAutoFlow` |
45
+ | `preset` | `fontSize`, `lineHeight`, `letterSpacing`, `fontWeight`, `fontStyle`, `textTransform` |
46
+ | `font` | `fontFamily` |
47
+ | `scrollbar` | `scrollbarWidth`, `scrollbarColor`, `scrollbarGutter` |
48
+ | `gridColumns` / `gridRows` / `gridAreas` | `gridTemplateColumns` / `Rows` / `Areas` |
49
+ | `textOverflow: 'ellipsis / 3'` | `lineClamp` |
50
+ | `hide: true` | `display: 'none'` |
51
+ | `flexGrow` / `flexShrink` / `flexBasis` | `flex` |
52
+
53
+ The last row goes the other way — longhands over the shorthand — because `flex` is lossy: it resets the components you omit to non-initial values (`flex: '0'` silently sets `flex-basis: 0%`) and cannot express `flexShrink: 0` at all. The longhands also carry separate state maps.
54
+
55
+ ## 3. Values
56
+
57
+ ### Tokens
58
+
59
+ | Syntax | Meaning |
60
+ | --------------------- | ------------------------------------------------------------------------- |
61
+ | `#name` | color token → `var(--name-color)` |
62
+ | `#name.50` | token at 50% opacity (`0`–`100`) |
63
+ | `#name.$opacity` | opacity from a custom property |
64
+ | `#clear` / `#current` | `transparent` / `currentcolor` |
65
+ | `$name` | custom property → `var(--name)` |
66
+ | `(#a, #b)` | fallback chain |
67
+ | `$$name` / `##name` | the custom property _name_ (not its value) — inside `transition` |
68
+ | `$$name(…)` | call a CSS `@function` declared via `@function`, `useFunction`, or config |
69
+
70
+ - ❌ `#f5f5f5`, `rgb(0 0 0)`, `oklch(…)`, `okhsl(…)`, `red` → ✅ `#surface` (add the token to the config if it doesn't exist).
71
+ - ❌ `var(--gap)` → ✅ `$gap` · ❌ `$accent-color` → ✅ `#accent` · ❌ `transparent` → ✅ `#clear` · ❌ `currentColor` → ✅ `#current`.
72
+ - A `$name` must be declared as a `'$name': value` key in the same styles object, or in the config.
73
+ - Names are case-sensitive and start lowercase — `$myVar` → `--myVar`; a leading capital folds (`$Foo` → `--foo`). Prefer kebab-case.
74
+ - A `$name` reference is untyped: it fills the first free slot in a shorthand (`border: '1bw $my-style'` → the line style). Write colors as `#name`; `$name-color` is a fallback for pointing at a raw CSS custom property that holds a color.
75
+ - `preset` and `transition` take token _names_, not values, so a `$name` cannot stand in for one (it warns in dev and is ignored).
76
+
77
+ ### Units
78
+
79
+ Tasty units: `x` (gap multiple), `r` (radius), `cr` (card radius), `bw` (border width), `ow` (outline width), `sf` (`minmax(0, Nfr)`). All CSS units work too, plus anything in `units` in the config. Any other unit is an error.
80
+
81
+ Prefer units over raw pixels: `8px` → `1x` … `64px` → `8x`; `radius: '6px'` → `'1r'`; `border: '1px …'` → `'1bw …'`.
82
+
83
+ ### Math
84
+
85
+ ❌ `calc(100% - 2x)` → ✅ `(100% - 2x)`. Parentheses are wrapped in `calc()` automatically — and must be balanced.
86
+
87
+ ### `true`
88
+
89
+ `true` means "the design-system default" and is accepted **only** by: `border`, `radius`, `outline`, `shadow`, `padding`, `margin`, `gap`, `inset`, `width`, `height`, `fill`, `color`, `fade`, `preset`, `font`, `scrollbar`, `hide`. Anywhere else it is an error.
90
+
91
+ ### `!important`
92
+
93
+ Never use it. Tasty owns specificity through doubled selectors and state ordering; `!important` breaks that. Express the exception as a state instead.
94
+
95
+ ### Modifiers
96
+
97
+ A value is `[values…] [modifiers…]`, and several groups can be comma-separated (later groups override earlier ones). A group that names **direction** modifiers takes a **single** value, applied to every direction it names — per-side values come from comma groups. A group naming no direction keeps plain CSS shorthand order (1–4 values). (`inset` + `dock` is the one exception: a second value insets the spanned sides.) Only the modifiers a property knows are valid:
98
+
99
+ | Property | Modifiers |
100
+ | ------------------------------------ | ---------------------------------------------------------------------------------------------------------- |
101
+ | `padding`, `margin`, `inset`, `fade` | `top` `right` `bottom` `left` |
102
+ | `border` | the four directions + `solid` `dashed` `dotted` `double` `groove` `ridge` `inset` `outset` `none` `hidden` |
103
+ | `outline` | the style keywords above |
104
+ | `radius` | `top` `right` `bottom` `left` + shapes `round` `ellipse` `leaf` `backleaf` |
105
+ | `width`, `height` | `min` `max` `fixed` |
106
+ | `flow` | `row` `column` `row-reverse` `column-reverse` `wrap` `nowrap` `dense` |
107
+ | `overflow` | `visible` `hidden` `scroll` `clip` `auto` `overlay` |
108
+ | `position` | `static` `relative` `absolute` `fixed` `sticky` |
109
+ | `shadow` | `inset` |
110
+ | `preset` | `name / strong` (or `bold`) `italic` `icon` `tight` |
111
+ | box properties | `longhand` — emit CSS longhands instead of the shorthand |
112
+
113
+ Directional modifiers beat placeholder zeros:
114
+
115
+ - ❌ `padding: '0 0 2x 0'` → ✅ `padding: '2x bottom'`
116
+ - ❌ `padding: '1x 1x 2x 1x'` → ✅ `padding: '1x, 2x bottom'`
117
+ - ❌ `border: '0 0 1bw 0'` — four tokens parse as _one_ border value, so this renders no border at all → ✅ `border: '1bw bottom'`
118
+ - ❌ `padding: '2x 4x top right'` — a directional group takes one value, so `4x` is dropped → ✅ `padding: '2x top, 4x right'`
119
+ - ❌ `fade: '3x 1x top bottom'` → ✅ `fade: '3x top, 1x bottom'`
120
+
121
+ Value-only properties reject both colors and modifiers: `gap`, `columnGap`, `rowGap`, `opacity`, `zIndex`, `order`, `flexGrow`, `flexShrink`, `flexBasis`, `aspectRatio`, `lineClamp`, `tabSize`, `paddingInline`, `paddingBlock`. `fill` and `color` take a color (plus `none` / `transparent`); `caretColor` and `accentColor` take a color only.
122
+
123
+ ### `transition`
124
+
125
+ Use semantic names, not CSS property names: `fade` `fill` `color` `theme` `border` `radius` `shadow` `outline` `preset` `text` `gap` `opacity` `translate` `rotate` `scale` `filter` `image` `background` `width` `height` `zIndex` `inset` `flow` `dimension`.
126
+
127
+ ❌ `transition: 'background-color 0.2s'` → ✅ `transition: 'fill 0.2s'`
128
+
129
+ ## 4. State maps
130
+
131
+ A property value can be an object of `state: value`. Key order is priority — later keys win.
132
+
133
+ | Key | Generated selector |
134
+ | ------------------------ | ----------------------------------------------- |
135
+ | `hovered` | `[data-hovered]` (boolean modifier from `mods`) |
136
+ | `theme=danger` | `[data-theme="danger"]` (value modifier) |
137
+ | `:hover` | pseudo-class |
138
+ | `.active` | class selector |
139
+ | `[aria-expanded="true"]` | attribute selector |
140
+ | `hovered & .active` | AND |
141
+ | `hovered \| focused` | OR (`,` also means OR) |
142
+ | `!disabled` | NOT |
143
+ | `hovered ^ focused` | XOR — exactly one (keep chains ≤ 4 operands) |
144
+
145
+ Precedence `!` > `^` > `|` > `&`; use parentheses to override.
146
+
147
+ Rules:
148
+
149
+ 1. **`''` comes first.** The bare default is the lowest-priority state; placing it later would override everything above it.
150
+ 2. **Every state map needs `''` or `_`** — except when extending (`tasty(Parent, …)`), where omitting `''` merges into the parent's states and including `''` replaces them wholesale.
151
+ 3. **`_` is standalone-only** and always first (with `''` right after it, if present). `_` is a never-negated fallback floor for cases where a higher-priority branch may be _unknown_ (`@supports`, container queries). If a map contains only `_` and `''`, drop the `''`.
152
+ 4. **No nested maps:** ❌ `{ hovered: { pressed: 'x' } }` → ✅ `{ 'hovered & pressed': 'x' }`
153
+ 5. **State keys never sit at the top level** of a styles object — `:hover`, `.active`, `[open]` belong inside a property value.
154
+ 6. **Prefer automatic native states:** use `disabled` and `checked` in Tasty component styles instead of `[disabled]` and `[checked]`. The concise states track the corresponding native prop or attribute automatically.
155
+
156
+ ```jsx
157
+ color: { '': '#text', hovered: '#accent', disabled: '#text.40' }
158
+ ```
159
+
160
+ Advanced states:
161
+
162
+ | Prefix | Use | Example |
163
+ | -------------- | -------------------------------------------------------------------------------- | --------------------------------------------------- |
164
+ | `@media(…)` | media query; dimensions `w` `h`; types `@media:print` `:screen` `:all` `:speech` | `@media(w < 768px)`, `@media(600px <= w < 1200px)` |
165
+ | `@(…)` | container query; dimensions `w` `h` `is` `bs` | `@(layout, w >= 600px)`, `@($variant=primary)` |
166
+ | `@supports(…)` | feature query; `$` first argument tests a selector | `@supports(display: grid)`, `@supports($, :has(*))` |
167
+ | `@root(…)` | condition on `:root` | `@root(schema=dark)` |
168
+ | `@parent(…)` | condition on an ancestor; `, >` for the direct parent | `@parent(hovered, >)` |
169
+ | `@own(…)` | a sub-element's own state — **only inside sub-element styles** | `@own(:hover)` |
170
+ | `@starting` | `@starting-style` entry animation | `@starting` |
171
+ | `@name` | project state alias | `@mobile` |
172
+
173
+ - At root level write the selector directly: ❌ `'@own(:hover)'` → ✅ `':hover'`.
174
+ - `@name` aliases must exist in `states` in the config or be declared locally as an `'@name': '<state expression>'` key; alias keys start with `@` and their value must be a valid state expression.
175
+ - `:is()` / `:has()` / `:not()` / `:where()` work in state keys but support at most 2 levels of nested parentheses, and `:has()` is expensive — prefer `@parent()`, `@own()` and modifiers.
176
+
177
+ When extending a parent's state map: `'@inherit'` reuses the parent's value for that state, `null` removes a state (or resets a property, letting recipes fill in), `false` is a tombstone that blocks it entirely.
178
+
179
+ ## 5. Sub-elements
180
+
181
+ A **capitalized** key targets `[data-element="Name"]`, and its value must be a style object.
182
+
183
+ ```jsx
184
+ styles: { Title: { preset: 'h3' }, Icon: { $: '>@:last-child', color: '#accent' } }
185
+ ```
186
+
187
+ ❌ nested-selector keys (`'& .title'`, `'&:hover'`) → ✅ sub-elements and state maps. Use the `$` affix property inside a sub-element to control how its selector attaches (`>` direct child, `@` placeholder for the element itself, `&::before` for a root pseudo-element).
188
+
189
+ ## 6. Special top-level keys
190
+
191
+ | Key | Shape |
192
+ | ---------------- | ----------------------------------------------------------------------------------------------------------- |
193
+ | `@keyframes` | `{ name: { '0%': styles, … } }` |
194
+ | `@property` | `{ '$name': { syntax, inherits, initialValue } }` |
195
+ | `@font-face` | `{ 'Family Name': descriptors \| descriptors[] }` |
196
+ | `@counter-style` | `{ name: descriptors }` |
197
+ | `@function` | `{ '$$name': { args, returns?, result, '$local'? } }` |
198
+ | `recipe` | a **string** of configured recipe names: `'card elevated'`, `'reset input / autofill'`, `'none / disabled'` |
199
+
200
+ At-rule keys match the real CSS at-rule names, so they are kebab-case, not camelCase. Inside `@function`, the callable is `$$name` but its parameters and local variables are `$name`:
201
+
202
+ ```jsx
203
+ styles: {
204
+ '@function': { $$negative: { args: ['$value'], result: '(-1 * $value)' } },
205
+ margin: '$$negative(2x) top',
206
+ }
207
+ ```
208
+
209
+ ## 7. `tastyStatic()`
210
+
211
+ The selector must be a string literal and valid CSS. Values must be static — strings, numbers, booleans, `null`, or objects/arrays of those. No variables, template literals, function calls, or spreads.
212
+
213
+ ## 8. Checklist
214
+
215
+ - Token, preset, recipe, unit and `@alias` names exist in the project config.
216
+ - Tasty shorthand chosen over CSS longhands; `flexGrow`/`flexShrink`/`flexBasis` over `flex`; `hide: true` over `display: 'none'`.
217
+ - Colors are `#tokens`, not hex/rgb/oklch/named; `$prop` not `var(--prop)`.
218
+ - Spacing uses `x`/`r`/`bw`/`ow` units; math uses `(…)`, not `calc(…)`.
219
+ - `true` only on the properties that accept it; no `!important`.
220
+ - Modifiers valid for the property; directional shorthand instead of placeholder zeros.
221
+ - Every state map starts with `''` (or `_`), is flat, and lives inside a property value.
222
+ - `@own()` only inside sub-elements; sub-element keys are capitalized and hold objects.
223
+ - At-rule keys are kebab-case (`@property`, `@font-face`, `@counter-style`, `@function`); `@function` names use `$$`, their args and locals use `$`.
224
+ - Values are static; dynamic behavior comes from `mods` / `tokens` / `styleProps`.