@tenphi/tasty 0.0.0-snapshot.fa94a5a → 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 (348) hide show
  1. package/README.md +197 -141
  2. package/dist/{ssr/async-storage.js → async-storage-DKK-wTD4.js} +17 -8
  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/{ssr/collector.js → collector-DMSR6ANK.js} +124 -47
  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 -34
  14. package/dist/core/index.js +6 -27
  15. package/dist/core-B1tyn69d.js +1573 -0
  16. package/dist/core-B1tyn69d.js.map +1 -0
  17. package/dist/{zero/extractor.js → css-writer-CvAxkR6S.js} +149 -26
  18. package/dist/css-writer-CvAxkR6S.js.map +1 -0
  19. package/dist/{ssr/format-global-rules.js → format-global-rules-DklyaXv-.js} +3 -3
  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 -51
  28. package/dist/index.js +921 -35
  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 +74 -10
  47. package/dist/ssr/astro.js +124 -32
  48. package/dist/ssr/astro.js.map +1 -1
  49. package/dist/ssr/index.d.ts +37 -5
  50. package/dist/ssr/index.js +7 -9
  51. package/dist/ssr/index.js.map +1 -1
  52. package/dist/ssr/next.d.ts +6 -6
  53. package/dist/ssr/next.js +19 -16
  54. package/dist/ssr/next.js.map +1 -1
  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 -167
  62. package/dist/zero/babel.js +161 -57
  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 +13 -1
  67. package/dist/zero/next.js +6 -5
  68. package/dist/zero/next.js.map +1 -1
  69. package/docs/README.md +20 -12
  70. package/docs/adoption.md +59 -32
  71. package/docs/ai-agents.md +224 -0
  72. package/docs/comparison.md +76 -48
  73. package/docs/configuration.md +566 -69
  74. package/docs/debug.md +22 -18
  75. package/docs/design-system.md +63 -32
  76. package/docs/dsl.md +527 -181
  77. package/docs/getting-started.md +62 -41
  78. package/docs/injector.md +137 -51
  79. package/docs/methodology.md +116 -35
  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 +197 -130
  86. package/docs/styles.md +84 -15
  87. package/docs/tasty-static.md +219 -70
  88. package/package.json +60 -21
  89. package/tasty.config.ts +6 -0
  90. package/dist/_virtual/_rolldown/runtime.js +0 -8
  91. package/dist/chunks/cacheKey.js +0 -78
  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 -259
  95. package/dist/chunks/definitions.js.map +0 -1
  96. package/dist/chunks/renderChunk.js +0 -60
  97. package/dist/chunks/renderChunk.js.map +0 -1
  98. package/dist/config.d.ts +0 -366
  99. package/dist/config.js +0 -504
  100. package/dist/config.js.map +0 -1
  101. package/dist/counter-style/index.js +0 -51
  102. package/dist/counter-style/index.js.map +0 -1
  103. package/dist/debug.d.ts +0 -89
  104. package/dist/debug.js +0 -454
  105. package/dist/debug.js.map +0 -1
  106. package/dist/font-face/index.js +0 -63
  107. package/dist/font-face/index.js.map +0 -1
  108. package/dist/hooks/resolve-ssr-collector.js +0 -15
  109. package/dist/hooks/resolve-ssr-collector.js.map +0 -1
  110. package/dist/hooks/useCounterStyle.d.ts +0 -50
  111. package/dist/hooks/useCounterStyle.js +0 -47
  112. package/dist/hooks/useCounterStyle.js.map +0 -1
  113. package/dist/hooks/useFontFace.d.ts +0 -43
  114. package/dist/hooks/useFontFace.js +0 -71
  115. package/dist/hooks/useFontFace.js.map +0 -1
  116. package/dist/hooks/useGlobalStyles.d.ts +0 -30
  117. package/dist/hooks/useGlobalStyles.js +0 -79
  118. package/dist/hooks/useGlobalStyles.js.map +0 -1
  119. package/dist/hooks/useKeyframes.d.ts +0 -56
  120. package/dist/hooks/useKeyframes.js +0 -65
  121. package/dist/hooks/useKeyframes.js.map +0 -1
  122. package/dist/hooks/useProperty.d.ts +0 -79
  123. package/dist/hooks/useProperty.js +0 -110
  124. package/dist/hooks/useProperty.js.map +0 -1
  125. package/dist/hooks/useRawCSS.d.ts +0 -53
  126. package/dist/hooks/useRawCSS.js +0 -36
  127. package/dist/hooks/useRawCSS.js.map +0 -1
  128. package/dist/hooks/useStyles.d.ts +0 -45
  129. package/dist/hooks/useStyles.js +0 -270
  130. package/dist/hooks/useStyles.js.map +0 -1
  131. package/dist/injector/index.d.ts +0 -183
  132. package/dist/injector/index.js +0 -180
  133. package/dist/injector/index.js.map +0 -1
  134. package/dist/injector/injector.d.ts +0 -166
  135. package/dist/injector/injector.js +0 -465
  136. package/dist/injector/injector.js.map +0 -1
  137. package/dist/injector/sheet-manager.d.ts +0 -136
  138. package/dist/injector/sheet-manager.js +0 -731
  139. package/dist/injector/sheet-manager.js.map +0 -1
  140. package/dist/injector/types.d.ts +0 -204
  141. package/dist/keyframes/index.js +0 -206
  142. package/dist/keyframes/index.js.map +0 -1
  143. package/dist/parser/classify.js +0 -320
  144. package/dist/parser/classify.js.map +0 -1
  145. package/dist/parser/const.js +0 -33
  146. package/dist/parser/const.js.map +0 -1
  147. package/dist/parser/lru.js +0 -109
  148. package/dist/parser/lru.js.map +0 -1
  149. package/dist/parser/parser.d.ts +0 -25
  150. package/dist/parser/parser.js +0 -116
  151. package/dist/parser/parser.js.map +0 -1
  152. package/dist/parser/tokenizer.js +0 -69
  153. package/dist/parser/tokenizer.js.map +0 -1
  154. package/dist/parser/types.d.ts +0 -51
  155. package/dist/parser/types.js +0 -46
  156. package/dist/parser/types.js.map +0 -1
  157. package/dist/pipeline/conditions.d.ts +0 -134
  158. package/dist/pipeline/conditions.js +0 -406
  159. package/dist/pipeline/conditions.js.map +0 -1
  160. package/dist/pipeline/exclusive.js +0 -231
  161. package/dist/pipeline/exclusive.js.map +0 -1
  162. package/dist/pipeline/index.d.ts +0 -53
  163. package/dist/pipeline/index.js +0 -699
  164. package/dist/pipeline/index.js.map +0 -1
  165. package/dist/pipeline/materialize.js +0 -1105
  166. package/dist/pipeline/materialize.js.map +0 -1
  167. package/dist/pipeline/parseStateKey.d.ts +0 -15
  168. package/dist/pipeline/parseStateKey.js +0 -447
  169. package/dist/pipeline/parseStateKey.js.map +0 -1
  170. package/dist/pipeline/simplify.js +0 -516
  171. package/dist/pipeline/simplify.js.map +0 -1
  172. package/dist/pipeline/warnings.js +0 -18
  173. package/dist/pipeline/warnings.js.map +0 -1
  174. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  175. package/dist/plugins/okhsl-plugin.js +0 -98
  176. package/dist/plugins/okhsl-plugin.js.map +0 -1
  177. package/dist/plugins/types.d.ts +0 -76
  178. package/dist/properties/index.js +0 -223
  179. package/dist/properties/index.js.map +0 -1
  180. package/dist/properties/property-type-resolver.d.ts +0 -24
  181. package/dist/properties/property-type-resolver.js +0 -91
  182. package/dist/properties/property-type-resolver.js.map +0 -1
  183. package/dist/ssr/async-storage.d.ts +0 -17
  184. package/dist/ssr/async-storage.js.map +0 -1
  185. package/dist/ssr/collect-auto-properties.js +0 -40
  186. package/dist/ssr/collect-auto-properties.js.map +0 -1
  187. package/dist/ssr/collector.d.ts +0 -102
  188. package/dist/ssr/collector.js.map +0 -1
  189. package/dist/ssr/context.d.ts +0 -8
  190. package/dist/ssr/context.js +0 -14
  191. package/dist/ssr/context.js.map +0 -1
  192. package/dist/ssr/format-global-rules.js.map +0 -1
  193. package/dist/ssr/format-keyframes.js +0 -70
  194. package/dist/ssr/format-keyframes.js.map +0 -1
  195. package/dist/ssr/format-property.js +0 -50
  196. package/dist/ssr/format-property.js.map +0 -1
  197. package/dist/ssr/format-rules.js +0 -70
  198. package/dist/ssr/format-rules.js.map +0 -1
  199. package/dist/ssr/hydrate.d.ts +0 -22
  200. package/dist/ssr/hydrate.js +0 -50
  201. package/dist/ssr/hydrate.js.map +0 -1
  202. package/dist/ssr/ssr-collector-ref.js +0 -12
  203. package/dist/ssr/ssr-collector-ref.js.map +0 -1
  204. package/dist/states/index.d.ts +0 -49
  205. package/dist/states/index.js +0 -171
  206. package/dist/states/index.js.map +0 -1
  207. package/dist/static/tastyStatic.d.ts +0 -46
  208. package/dist/static/tastyStatic.js +0 -31
  209. package/dist/static/tastyStatic.js.map +0 -1
  210. package/dist/static/types.d.ts +0 -49
  211. package/dist/static/types.js +0 -24
  212. package/dist/static/types.js.map +0 -1
  213. package/dist/styles/align.d.ts +0 -15
  214. package/dist/styles/align.js +0 -14
  215. package/dist/styles/align.js.map +0 -1
  216. package/dist/styles/border.d.ts +0 -25
  217. package/dist/styles/border.js +0 -114
  218. package/dist/styles/border.js.map +0 -1
  219. package/dist/styles/color.d.ts +0 -14
  220. package/dist/styles/color.js +0 -27
  221. package/dist/styles/color.js.map +0 -1
  222. package/dist/styles/createStyle.js +0 -80
  223. package/dist/styles/createStyle.js.map +0 -1
  224. package/dist/styles/dimension.js +0 -97
  225. package/dist/styles/dimension.js.map +0 -1
  226. package/dist/styles/display.d.ts +0 -37
  227. package/dist/styles/display.js +0 -67
  228. package/dist/styles/display.js.map +0 -1
  229. package/dist/styles/fade.d.ts +0 -15
  230. package/dist/styles/fade.js +0 -58
  231. package/dist/styles/fade.js.map +0 -1
  232. package/dist/styles/fill.d.ts +0 -42
  233. package/dist/styles/fill.js +0 -52
  234. package/dist/styles/fill.js.map +0 -1
  235. package/dist/styles/flow.d.ts +0 -16
  236. package/dist/styles/flow.js +0 -12
  237. package/dist/styles/flow.js.map +0 -1
  238. package/dist/styles/gap.d.ts +0 -31
  239. package/dist/styles/gap.js +0 -37
  240. package/dist/styles/gap.js.map +0 -1
  241. package/dist/styles/height.d.ts +0 -17
  242. package/dist/styles/height.js +0 -20
  243. package/dist/styles/height.js.map +0 -1
  244. package/dist/styles/index.d.ts +0 -2
  245. package/dist/styles/index.js +0 -9
  246. package/dist/styles/index.js.map +0 -1
  247. package/dist/styles/inset.d.ts +0 -52
  248. package/dist/styles/inset.js +0 -150
  249. package/dist/styles/inset.js.map +0 -1
  250. package/dist/styles/justify.d.ts +0 -15
  251. package/dist/styles/justify.js +0 -14
  252. package/dist/styles/justify.js.map +0 -1
  253. package/dist/styles/list.d.ts +0 -16
  254. package/dist/styles/list.js +0 -98
  255. package/dist/styles/list.js.map +0 -1
  256. package/dist/styles/margin.d.ts +0 -24
  257. package/dist/styles/margin.js +0 -104
  258. package/dist/styles/margin.js.map +0 -1
  259. package/dist/styles/outline.d.ts +0 -29
  260. package/dist/styles/outline.js +0 -65
  261. package/dist/styles/outline.js.map +0 -1
  262. package/dist/styles/padding.d.ts +0 -24
  263. package/dist/styles/padding.js +0 -104
  264. package/dist/styles/padding.js.map +0 -1
  265. package/dist/styles/predefined.d.ts +0 -71
  266. package/dist/styles/predefined.js +0 -238
  267. package/dist/styles/predefined.js.map +0 -1
  268. package/dist/styles/preset.d.ts +0 -47
  269. package/dist/styles/preset.js +0 -112
  270. package/dist/styles/preset.js.map +0 -1
  271. package/dist/styles/radius.d.ts +0 -14
  272. package/dist/styles/radius.js +0 -51
  273. package/dist/styles/radius.js.map +0 -1
  274. package/dist/styles/scrollbar.d.ts +0 -25
  275. package/dist/styles/scrollbar.js +0 -48
  276. package/dist/styles/scrollbar.js.map +0 -1
  277. package/dist/styles/shadow.d.ts +0 -14
  278. package/dist/styles/shadow.js +0 -24
  279. package/dist/styles/shadow.js.map +0 -1
  280. package/dist/styles/transition.d.ts +0 -14
  281. package/dist/styles/transition.js +0 -158
  282. package/dist/styles/transition.js.map +0 -1
  283. package/dist/styles/types.d.ts +0 -545
  284. package/dist/styles/width.d.ts +0 -17
  285. package/dist/styles/width.js +0 -20
  286. package/dist/styles/width.js.map +0 -1
  287. package/dist/tasty.d.ts +0 -119
  288. package/dist/tasty.js +0 -232
  289. package/dist/tasty.js.map +0 -1
  290. package/dist/types.d.ts +0 -184
  291. package/dist/utils/cache-wrapper.js +0 -22
  292. package/dist/utils/cache-wrapper.js.map +0 -1
  293. package/dist/utils/case-converter.js +0 -8
  294. package/dist/utils/case-converter.js.map +0 -1
  295. package/dist/utils/color-math.d.ts +0 -46
  296. package/dist/utils/color-math.js +0 -749
  297. package/dist/utils/color-math.js.map +0 -1
  298. package/dist/utils/color-space.d.ts +0 -5
  299. package/dist/utils/color-space.js +0 -229
  300. package/dist/utils/color-space.js.map +0 -1
  301. package/dist/utils/colors.d.ts +0 -5
  302. package/dist/utils/colors.js +0 -11
  303. package/dist/utils/colors.js.map +0 -1
  304. package/dist/utils/css-types.d.ts +0 -7
  305. package/dist/utils/dotize.d.ts +0 -26
  306. package/dist/utils/dotize.js +0 -122
  307. package/dist/utils/dotize.js.map +0 -1
  308. package/dist/utils/filter-base-props.d.ts +0 -15
  309. package/dist/utils/filter-base-props.js +0 -45
  310. package/dist/utils/filter-base-props.js.map +0 -1
  311. package/dist/utils/get-display-name.d.ts +0 -7
  312. package/dist/utils/get-display-name.js +0 -10
  313. package/dist/utils/get-display-name.js.map +0 -1
  314. package/dist/utils/has-keys.js +0 -13
  315. package/dist/utils/has-keys.js.map +0 -1
  316. package/dist/utils/is-dev-env.js +0 -19
  317. package/dist/utils/is-dev-env.js.map +0 -1
  318. package/dist/utils/is-valid-element-type.js +0 -15
  319. package/dist/utils/is-valid-element-type.js.map +0 -1
  320. package/dist/utils/merge-styles.js.map +0 -1
  321. package/dist/utils/mod-attrs.d.ts +0 -8
  322. package/dist/utils/mod-attrs.js +0 -21
  323. package/dist/utils/mod-attrs.js.map +0 -1
  324. package/dist/utils/process-tokens.d.ts +0 -21
  325. package/dist/utils/process-tokens.js +0 -91
  326. package/dist/utils/process-tokens.js.map +0 -1
  327. package/dist/utils/resolve-recipes.d.ts +0 -17
  328. package/dist/utils/resolve-recipes.js.map +0 -1
  329. package/dist/utils/selector-transform.js +0 -32
  330. package/dist/utils/selector-transform.js.map +0 -1
  331. package/dist/utils/string.js +0 -8
  332. package/dist/utils/string.js.map +0 -1
  333. package/dist/utils/styles.d.ts +0 -101
  334. package/dist/utils/styles.js +0 -223
  335. package/dist/utils/styles.js.map +0 -1
  336. package/dist/utils/typography.d.ts +0 -47
  337. package/dist/utils/typography.js +0 -43
  338. package/dist/utils/typography.js.map +0 -1
  339. package/dist/utils/warnings.d.ts +0 -16
  340. package/dist/utils/warnings.js +0 -16
  341. package/dist/utils/warnings.js.map +0 -1
  342. package/dist/zero/css-writer.d.ts +0 -45
  343. package/dist/zero/css-writer.js +0 -74
  344. package/dist/zero/css-writer.js.map +0 -1
  345. package/dist/zero/extractor.d.ts +0 -24
  346. package/dist/zero/extractor.js.map +0 -1
  347. package/docs/PIPELINE.md +0 -519
  348. package/docs/runtime.md +0 -485
package/docs/debug.md CHANGED
@@ -12,6 +12,8 @@ In development mode (`isDevEnv()` returns `true`), `tastyDebug` is automatically
12
12
 
13
13
  All methods **log to the console by default**. Pass `{ raw: true }` to suppress logging and only return data.
14
14
 
15
+ > **Note (2.0.0+):** Class names use a content-addressed base36 hash format (e.g. `t3a5f`) instead of the previous sequential `t{number}` format. Cross-environment hydration reads the rendered class list from `window.__TASTY__` (the legacy `window.__TASTY_SSR_CACHE__` global was removed in 2.0.0).
16
+
15
17
  ---
16
18
 
17
19
  ## Quick Start
@@ -66,18 +68,18 @@ Retrieves CSS text for a given target. Logs the result with rule count and size.
66
68
  |---|---|
67
69
  | `'all'` | All tasty CSS (component + global + raw) |
68
70
  | `'active'` | CSS for classes currently in the DOM |
69
- | `'unused'` | CSS with refCount = 0 (cached but not used) |
71
+ | `'unused'` | CSS for injected classes no element carries (cached but not rendered) |
70
72
  | `'global'` | Only global CSS (from `injectGlobal`) |
71
73
  | `'page'` | All CSS on the page (including non-tasty) |
72
- | `'t42'` | CSS for a specific tasty class |
73
- | `['t0', 't5']` | CSS for multiple tasty classes |
74
+ | `'t3a5f'` | CSS for a specific tasty class (class names are `t` + base36 hash) |
75
+ | `['t3a5f', 't9k2']` | CSS for multiple tasty classes |
74
76
  | `'.my-button'` | CSS affecting a DOM element (by selector) |
75
77
  | `element` | CSS affecting a DOM element (by reference) |
76
78
 
77
79
  **Extra options:**
78
80
 
79
81
  ```typescript
80
- interface CssOptions extends DebugOptions {
82
+ interface CSSOptions extends DebugOptions {
81
83
  prettify?: boolean; // Format output (default: true)
82
84
  source?: boolean; // Read original CSS instead of live CSSOM (default: false, dev-mode only)
83
85
  }
@@ -88,11 +90,11 @@ interface CssOptions extends DebugOptions {
88
90
  tastyDebug.css('active');
89
91
 
90
92
  // Specific class, silent
91
- const css = tastyDebug.css('t42', { raw: true });
93
+ const css = tastyDebug.css('t3a5f', { raw: true });
92
94
 
93
95
  // Compare original vs browser-parsed CSS (dev mode only)
94
- tastyDebug.css('t42'); // live CSSOM
95
- tastyDebug.css('t42', { source: true }); // original output
96
+ tastyDebug.css('t3a5f'); // live CSSOM
97
+ tastyDebug.css('t3a5f', { source: true }); // original output
96
98
 
97
99
  // Shadow DOM
98
100
  tastyDebug.css('all', { root: shadowRoot });
@@ -109,14 +111,14 @@ Inspects a DOM element and returns detailed information about its tasty styles,
109
111
  ```typescript
110
112
  interface InspectResult {
111
113
  element?: Element | null;
112
- classes: string[]; // Tasty classes on the element
113
- chunks: ChunkInfo[]; // Chunk assignment per class
114
- css: string; // Prettified CSS
115
- size: number; // CSS size in characters
116
- rules: number; // Number of CSS rule blocks
114
+ classes: string[]; // Tasty classes on the element
115
+ chunks: DebugChunkInfo[]; // Chunk assignment per class
116
+ css: string; // Prettified CSS
117
+ size: number; // CSS size in characters
118
+ rules: number; // Number of CSS rule blocks
117
119
  }
118
120
 
119
- interface ChunkInfo {
121
+ interface DebugChunkInfo {
120
122
  className: string;
121
123
  chunkName: string | null; // e.g., 'appearance', 'font', 'dimension'
122
124
  }
@@ -125,11 +127,11 @@ interface ChunkInfo {
125
127
  ```typescript
126
128
  tastyDebug.inspect('.my-card');
127
129
  // Logs: inspect div — 3 classes, 5 rules, 1.2KB
128
- // Chunks: t3→appearance, t7→font, t12→dimension
130
+ // Chunks: t3a5f→appearance, t9k2→font, tb71→dimension
129
131
 
130
132
  // Silent
131
133
  const result = tastyDebug.inspect('.my-card', { raw: true });
132
- console.log(result.classes); // ['t3', 't7', 't12']
134
+ console.log(result.classes); // ['t3a5f', 't9k2', 'tb71']
133
135
  console.log(result.rules); // 5
134
136
  ```
135
137
 
@@ -239,7 +241,9 @@ tastyDebug.cache();
239
241
 
240
242
  ### `cleanup(opts?): void`
241
243
 
242
- Forces immediate cleanup of all unused styles (those with `refCount = 0`).
244
+ Removes every injected style that is neither carried by an element nor pinned by
245
+ an outstanding `inject()` handle — the same set `summary()` reports as unused.
246
+ Equivalent to `gc({ force: true })`.
243
247
 
244
248
  ```typescript
245
249
  tastyDebug.cleanup();
@@ -291,10 +295,10 @@ tastyDebug.summary({ root: shadowRoot });
291
295
  tastyDebug.inspect('.my-button');
292
296
 
293
297
  // 2. See CSS for a specific class
294
- tastyDebug.css('t3');
298
+ tastyDebug.css('t3a5f');
295
299
 
296
300
  // 3. Compare original vs browser-parsed (dev mode)
297
- tastyDebug.css('t3', { source: true });
301
+ tastyDebug.css('t3a5f', { source: true });
298
302
  ```
299
303
 
300
304
  ### Checking cache efficiency
@@ -1,8 +1,8 @@
1
1
  # Building a Design System
2
2
 
3
- This guide walks through building a design-system styling layer on top of Tasty — defining tokens, state aliases, recipes, primitive components, and compound components with sub-elements.
3
+ This guide shows how to build shared React components whose styles stay predictable as states, variants, themes, and responsive rules accumulate. You will define tokens, state aliases, recipes, primitive APIs, and compound components with sub-elements.
4
4
 
5
- It assumes you have already decided to adopt Tasty. The goal is not just to centralize tokens, but to define a styling language whose component states resolve deterministically across variants, responsive rules, and sub-elements. For evaluation criteria, audience fit, and incremental adoption phases, see the [Adoption Guide](adoption.md). For the recommended component patterns and mental model, see [Methodology](methodology.md).
5
+ It assumes you have already decided to adopt Tasty. The goal is not only to centralize values, but to give your design system one state model and a governed component-facing styling API. For evaluation criteria and incremental rollout, see the [Adoption Guide](adoption.md). For the recommended component architecture, see [Methodology](methodology.md).
6
6
 
7
7
  ---
8
8
 
@@ -43,8 +43,8 @@ configure({
43
43
  '#border': '#e0e0e0',
44
44
 
45
45
  // Unit values
46
- '$gap': '8px',
47
- '$radius': '4px',
46
+ $gap: '8px',
47
+ $radius: '4px',
48
48
  '$border-width': '1px',
49
49
  '$outline-width': '2px',
50
50
  },
@@ -84,35 +84,65 @@ configure({
84
84
 
85
85
  ### Typography presets
86
86
 
87
- Use `generateTypographyTokens()` to create typography tokens from your own presets, then pass them to `configure({ tokens })`:
87
+ Pass typography presets directly to `configure()` — they are converted to tokens automatically:
88
88
 
89
89
  ```tsx
90
- import { configure, generateTypographyTokens } from '@tenphi/tasty';
90
+ import { configure } from '@tenphi/tasty';
91
91
 
92
- const typographyTokens = generateTypographyTokens({
93
- h1: { fontSize: '2rem', lineHeight: '1.2', letterSpacing: '-0.02em', fontWeight: 700 },
94
- t2: { fontSize: '0.875rem', lineHeight: '1.5', letterSpacing: 'normal', fontWeight: 400 },
92
+ configure({
93
+ presets: {
94
+ h1: {
95
+ fontSize: '2rem',
96
+ lineHeight: '1.2',
97
+ letterSpacing: '-0.02em',
98
+ fontWeight: 700,
99
+ },
100
+ t2: {
101
+ fontSize: '0.875rem',
102
+ lineHeight: '1.5',
103
+ letterSpacing: 'normal',
104
+ fontWeight: 400,
105
+ },
106
+ },
95
107
  });
108
+ ```
96
109
 
110
+ Preset values support state maps for responsive or theme-aware typography:
111
+
112
+ ```tsx
97
113
  configure({
98
- tokens: {
99
- ...typographyTokens,
114
+ presets: {
115
+ t2: {
116
+ fontSize: '0.875rem',
117
+ lineHeight: '1.5',
118
+ fontWeight: { '': 400, '@dark': 300 },
119
+ },
100
120
  },
101
121
  });
102
122
  ```
103
123
 
104
124
  Then use `preset: 'h1'` or `preset: 't2'` in any component's styles.
105
125
 
126
+ > You can also call `generateTypographyTokens()` manually and spread the result into `tokens` for more control — `presets` is just a shorthand.
127
+
106
128
  ### Registering brand fonts
107
129
 
108
- Register your design system's custom fonts via `configure({ fontFace })` so every component can reference them:
130
+ Register your design system's custom fonts via `configure({ fontFaces })` so every component can reference them:
109
131
 
110
132
  ```ts
111
133
  configure({
112
- fontFace: {
134
+ fontFaces: {
113
135
  'Brand Sans': [
114
- { src: 'url("/fonts/brand-regular.woff2") format("woff2")', fontWeight: 400, fontDisplay: 'swap' },
115
- { src: 'url("/fonts/brand-bold.woff2") format("woff2")', fontWeight: 700, fontDisplay: 'swap' },
136
+ {
137
+ src: 'url("/fonts/brand-regular.woff2") format("woff2")',
138
+ fontWeight: 400,
139
+ fontDisplay: 'swap',
140
+ },
141
+ {
142
+ src: 'url("/fonts/brand-bold.woff2") format("woff2")',
143
+ fontWeight: 700,
144
+ fontDisplay: 'swap',
145
+ },
116
146
  ],
117
147
  },
118
148
  });
@@ -132,7 +162,8 @@ configure({
132
162
  '@mobile': '@media(w < 768px)',
133
163
  '@tablet': '@media(768px <= w < 1024px)',
134
164
  '@desktop': '@media(w >= 1024px)',
135
- '@dark': '@root(schema=dark) | (!@root(schema) & @media(prefers-color-scheme: dark))',
165
+ '@dark':
166
+ '@root(schema=dark) | (!@root(schema) & @media(prefers-color-scheme: dark))',
136
167
  '@reduced-motion': '@media(prefers-reduced-motion: reduce)',
137
168
  },
138
169
  });
@@ -173,7 +204,7 @@ configure({
173
204
  'input-reset': {
174
205
  border: 'none',
175
206
  outline: 'none',
176
- fill: 'transparent',
207
+ fill: '#clear',
177
208
  font: true,
178
209
  preset: 't3',
179
210
  },
@@ -199,7 +230,7 @@ const ProfileCard = tasty({
199
230
  });
200
231
  ```
201
232
 
202
- Use the `/` separator when a recipe should be applied *after* local styles (post-merge), so recipe states take priority:
233
+ Use the `/` separator when a recipe should be applied _after_ local styles (post-merge), so recipe states take priority:
203
234
 
204
235
  ```tsx
205
236
  const Input = tasty({
@@ -271,12 +302,12 @@ Product engineers use these to compose layouts without writing CSS:
271
302
 
272
303
  Match the prop set to the component's role:
273
304
 
274
- | Component category | Recommended styleProps |
275
- |--------------------|----------------------|
276
- | Layout containers (`Space`, `Box`, `Grid`) | `FLOW_STYLES` — flow, gap, align, justify, padding, fill |
277
- | Positioned elements (`Button`, `Badge`) | `POSITION_STYLES` — placeSelf, gridArea, order |
278
- | Text elements | `['preset', 'color']` or a custom subset |
279
- | Compound components | Typically none — styling happens via sub-elements and wrapping |
305
+ | Component category | Recommended styleProps |
306
+ | ------------------------------------------ | -------------------------------------------------------------- |
307
+ | Layout containers (`Space`, `Box`, `Grid`) | `FLOW_STYLES` — flow, gap, align, justify, padding, fill |
308
+ | Positioned elements (`Button`, `Badge`) | `POSITION_STYLES` — placeSelf, gridArea, order |
309
+ | Text elements | `['preset', 'color']` or a custom subset |
310
+ | Compound components | Typically none — styling happens via sub-elements and wrapping |
280
311
 
281
312
  Exposing too many props weakens the design system's constraints. See [Methodology — styleProps as the public API](methodology.md#styleprops-as-the-public-api) for the rationale.
282
313
 
@@ -323,9 +354,7 @@ Usage:
323
354
  ```tsx
324
355
  <Card>
325
356
  <Card.Title>Monthly Revenue</Card.Title>
326
- <Card.Content>
327
- $1.2M — up 12% from last month.
328
- </Card.Content>
357
+ <Card.Content>$1.2M — up 12% from last month.</Card.Content>
329
358
  <Card.Footer>
330
359
  <Button>Details</Button>
331
360
  </Card.Footer>
@@ -334,7 +363,7 @@ Usage:
334
363
 
335
364
  Sub-elements share the root component's state context by default. A `disabled` modifier on `<Card>` affects `Title`, `Content`, and `Footer` styles automatically — no prop drilling. For the full mental model, see [Methodology — Component architecture](methodology.md#component-architecture-root--sub-elements).
336
365
 
337
- For sub-element syntax details (selector affix `$`, `@own()`, `elements` config), see [Runtime API — Sub-element Styling](runtime.md#sub-element-styling).
366
+ For sub-element syntax details (selector affix `$`, `@own()`, `elements` config), see [React API — Sub-element Styling](react-api.md#sub-element-styling).
338
367
 
339
368
  ---
340
369
 
@@ -353,13 +382,15 @@ A design system works best when the rules for customization are explicit. Tasty
353
382
  2. **Use modProps** — control component states through typed props instead of `mods`:
354
383
 
355
384
  ```tsx
356
- <Button isLoading size="large">Submit</Button>
385
+ <Button isLoading size="large">
386
+ Submit
387
+ </Button>
357
388
  ```
358
389
 
359
390
  3. **Pass tokens** — inject runtime values through the `tokens` prop for per-instance customization:
360
391
 
361
392
  ```tsx
362
- <ProgressBar tokens={{ '$progress': `${percent}%` }} />
393
+ <ProgressBar tokens={{ $progress: `${percent}%` }} />
363
394
  ```
364
395
 
365
396
  4. **Create styled wrappers** — extend a component's styles with `tasty(Base, { styles })`:
@@ -404,7 +435,7 @@ ds/
404
435
  index.ts # Recipe definitions (imported by config.ts)
405
436
  tokens/
406
437
  colors.ts # Color token definitions
407
- typography.ts # Typography presets via generateTypographyTokens()
438
+ typography.ts # Typography presets for configure({ presets })
408
439
  spacing.ts # Spacing token definitions
409
440
  index.ts # Public API: re-exports components + configure
410
441
  ```
@@ -418,7 +449,7 @@ The key principle: `config.ts` imports tokens and recipes, calls `configure()`,
418
449
  - **[Methodology](methodology.md)** — The recommended patterns for structuring Tasty components
419
450
  - **[Getting Started](getting-started.md)** — Installation, first component, tooling setup
420
451
  - **[Style DSL](dsl.md)** — State maps, tokens, units, extending semantics, keyframes, @property
421
- - **[Runtime API](runtime.md)** — `tasty()` factory, component props, variants, sub-elements, hooks
452
+ - **[React API](react-api.md)** — `tasty()` factory, component props, variants, sub-elements, style functions
422
453
  - **[Configuration](configuration.md)** — Full `configure()` API: tokens, recipes, custom units, style handlers
423
454
  - **[Adoption Guide](adoption.md)** — Who should adopt Tasty, incremental phases, what changes for product engineers
424
455
  - **[Style Properties](styles.md)** — Complete reference for all enhanced style properties