@tenphi/tasty 0.0.0-snapshot.bbd10c7 → 0.0.0-snapshot.bbd36bd

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (368) hide show
  1. package/README.md +196 -140
  2. package/dist/astro-CeYENy2x.js +301 -0
  3. package/dist/astro-CeYENy2x.js.map +1 -0
  4. package/dist/{ssr/async-storage.js → async-storage-DKK-wTD4.js} +16 -6
  5. package/dist/async-storage-DKK-wTD4.js.map +1 -0
  6. package/dist/babel-DWCsafYw.d.ts +83 -0
  7. package/dist/collector-B3OsM252.js +327 -0
  8. package/dist/collector-B3OsM252.js.map +1 -0
  9. package/dist/collector-BTVXj2hS.d.ts +163 -0
  10. package/dist/config-B3gPdCqd.js +12421 -0
  11. package/dist/config-B3gPdCqd.js.map +1 -0
  12. package/dist/config-LfIDmVHx.d.ts +1363 -0
  13. package/dist/context-CA8YKeMn.js +24 -0
  14. package/dist/context-CA8YKeMn.js.map +1 -0
  15. package/dist/core/index.d.ts +5 -34
  16. package/dist/core/index.js +6 -27
  17. package/dist/core-DGm0CFHP.js +1732 -0
  18. package/dist/core-DGm0CFHP.js.map +1 -0
  19. package/dist/css-resources-Cyl_axbI.js +149 -0
  20. package/dist/css-resources-Cyl_axbI.js.map +1 -0
  21. package/dist/{zero/extractor.js → css-writer-Bgowobbx.js} +148 -24
  22. package/dist/css-writer-Bgowobbx.js.map +1 -0
  23. package/dist/{ssr/format-global-rules.js → format-global-rules-DklyaXv-.js} +2 -2
  24. package/dist/format-global-rules-DklyaXv-.js.map +1 -0
  25. package/dist/{ssr/format-rules.js → format-rules-XRw9u7d4.js} +33 -2
  26. package/dist/format-rules-XRw9u7d4.js.map +1 -0
  27. package/dist/hydrate-CNOmZprz.js +37 -0
  28. package/dist/hydrate-CNOmZprz.js.map +1 -0
  29. package/dist/index-Bm9ltvdH.d.ts +1933 -0
  30. package/dist/index-BmogEzTo.d.ts +1575 -0
  31. package/dist/index.d.ts +5 -51
  32. package/dist/index.js +922 -36
  33. package/dist/index.js.map +1 -0
  34. package/dist/keyframes-DE-OE76F.js +535 -0
  35. package/dist/keyframes-DE-OE76F.js.map +1 -0
  36. package/dist/{utils/merge-styles.d.ts → merge-styles-BcLl1u_d.d.ts} +3 -3
  37. package/dist/{utils/merge-styles.js → merge-styles-DuoZEsm9.js} +3 -4
  38. package/dist/merge-styles-DuoZEsm9.js.map +1 -0
  39. package/dist/{utils/resolve-recipes.js → resolve-recipes-H9NqOQuP.js} +4 -6
  40. package/dist/resolve-recipes-H9NqOQuP.js.map +1 -0
  41. package/dist/ssr/astro-client.js +19 -0
  42. package/dist/ssr/astro-client.js.map +1 -0
  43. package/dist/ssr/astro-middleware-extract-static.d.ts +11 -0
  44. package/dist/ssr/astro-middleware-extract-static.js +9 -0
  45. package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
  46. package/dist/ssr/astro-middleware-extract.d.ts +11 -0
  47. package/dist/ssr/astro-middleware-extract.js +9 -0
  48. package/dist/ssr/astro-middleware-extract.js.map +1 -0
  49. package/dist/ssr/astro-middleware-static.d.ts +18 -0
  50. package/dist/ssr/astro-middleware-static.js +18 -0
  51. package/dist/ssr/astro-middleware-static.js.map +1 -0
  52. package/dist/ssr/astro-middleware.d.ts +19 -0
  53. package/dist/ssr/astro-middleware.js +19 -0
  54. package/dist/ssr/astro-middleware.js.map +1 -0
  55. package/dist/ssr/astro.d.ts +117 -11
  56. package/dist/ssr/astro.js +2 -64
  57. package/dist/ssr/index.d.ts +37 -4
  58. package/dist/ssr/index.js +6 -6
  59. package/dist/ssr/index.js.map +1 -1
  60. package/dist/ssr/next-config.d.ts +66 -0
  61. package/dist/ssr/next-config.js +115 -0
  62. package/dist/ssr/next-config.js.map +1 -0
  63. package/dist/ssr/next.d.ts +14 -5
  64. package/dist/ssr/next.js +32 -15
  65. package/dist/ssr/next.js.map +1 -1
  66. package/dist/ssr-collector-ref-COs_ioWl.js +29 -0
  67. package/dist/ssr-collector-ref-COs_ioWl.js.map +1 -0
  68. package/dist/static/index.d.ts +91 -5
  69. package/dist/static/index.js +49 -3
  70. package/dist/static/index.js.map +1 -0
  71. package/dist/static/inject.js.map +1 -1
  72. package/dist/zero/babel.d.ts +2 -182
  73. package/dist/zero/babel.js +80 -40
  74. package/dist/zero/babel.js.map +1 -1
  75. package/dist/zero/index.d.ts +81 -3
  76. package/dist/zero/index.js +2 -3
  77. package/dist/zero/next.d.ts +1 -1
  78. package/dist/zero/next.js +1 -1
  79. package/dist/zero/next.js.map +1 -1
  80. package/docs/README.md +20 -12
  81. package/docs/adoption.md +59 -32
  82. package/docs/ai-agents.md +224 -0
  83. package/docs/comparison.md +76 -48
  84. package/docs/configuration.md +566 -69
  85. package/docs/debug.md +35 -18
  86. package/docs/design-system.md +63 -32
  87. package/docs/dsl.md +527 -179
  88. package/docs/getting-started.md +62 -41
  89. package/docs/injector.md +157 -51
  90. package/docs/methodology.md +69 -37
  91. package/docs/migration-v3.md +285 -0
  92. package/docs/pipeline.md +741 -0
  93. package/docs/plugins.md +353 -0
  94. package/docs/{runtime.md → react-api.md} +176 -67
  95. package/docs/runtime-benchmarks.md +351 -0
  96. package/docs/ssr.md +350 -94
  97. package/docs/styles.md +65 -16
  98. package/docs/tasty-static.md +149 -87
  99. package/package.json +78 -23
  100. package/tasty.config.ts +6 -0
  101. package/dist/_virtual/_rolldown/runtime.js +0 -7
  102. package/dist/chunks/cacheKey.js +0 -77
  103. package/dist/chunks/cacheKey.js.map +0 -1
  104. package/dist/chunks/definitions.d.ts +0 -37
  105. package/dist/chunks/definitions.js +0 -258
  106. package/dist/chunks/definitions.js.map +0 -1
  107. package/dist/chunks/index.d.ts +0 -1
  108. package/dist/chunks/renderChunk.d.ts +0 -1
  109. package/dist/chunks/renderChunk.js +0 -59
  110. package/dist/chunks/renderChunk.js.map +0 -1
  111. package/dist/compute-styles.d.ts +0 -31
  112. package/dist/compute-styles.js +0 -356
  113. package/dist/compute-styles.js.map +0 -1
  114. package/dist/config.d.ts +0 -372
  115. package/dist/config.js +0 -507
  116. package/dist/config.js.map +0 -1
  117. package/dist/counter-style/index.js +0 -51
  118. package/dist/counter-style/index.js.map +0 -1
  119. package/dist/debug.d.ts +0 -89
  120. package/dist/debug.js +0 -453
  121. package/dist/debug.js.map +0 -1
  122. package/dist/font-face/index.js +0 -63
  123. package/dist/font-face/index.js.map +0 -1
  124. package/dist/hooks/index.d.ts +0 -7
  125. package/dist/hooks/useCounterStyle.d.ts +0 -50
  126. package/dist/hooks/useCounterStyle.js +0 -45
  127. package/dist/hooks/useCounterStyle.js.map +0 -1
  128. package/dist/hooks/useFontFace.d.ts +0 -43
  129. package/dist/hooks/useFontFace.js +0 -69
  130. package/dist/hooks/useFontFace.js.map +0 -1
  131. package/dist/hooks/useGlobalStyles.d.ts +0 -30
  132. package/dist/hooks/useGlobalStyles.js +0 -77
  133. package/dist/hooks/useGlobalStyles.js.map +0 -1
  134. package/dist/hooks/useKeyframes.d.ts +0 -56
  135. package/dist/hooks/useKeyframes.js +0 -63
  136. package/dist/hooks/useKeyframes.js.map +0 -1
  137. package/dist/hooks/useProperty.d.ts +0 -79
  138. package/dist/hooks/useProperty.js +0 -108
  139. package/dist/hooks/useProperty.js.map +0 -1
  140. package/dist/hooks/useRawCSS.d.ts +0 -53
  141. package/dist/hooks/useRawCSS.js +0 -34
  142. package/dist/hooks/useRawCSS.js.map +0 -1
  143. package/dist/hooks/useStyles.d.ts +0 -40
  144. package/dist/hooks/useStyles.js +0 -29
  145. package/dist/hooks/useStyles.js.map +0 -1
  146. package/dist/injector/index.d.ts +0 -166
  147. package/dist/injector/index.js +0 -166
  148. package/dist/injector/index.js.map +0 -1
  149. package/dist/injector/injector.d.ts +0 -166
  150. package/dist/injector/injector.js +0 -464
  151. package/dist/injector/injector.js.map +0 -1
  152. package/dist/injector/sheet-manager.d.ts +0 -136
  153. package/dist/injector/sheet-manager.js +0 -733
  154. package/dist/injector/sheet-manager.js.map +0 -1
  155. package/dist/injector/types.d.ts +0 -204
  156. package/dist/keyframes/index.js +0 -206
  157. package/dist/keyframes/index.js.map +0 -1
  158. package/dist/parser/classify.js +0 -319
  159. package/dist/parser/classify.js.map +0 -1
  160. package/dist/parser/const.js +0 -60
  161. package/dist/parser/const.js.map +0 -1
  162. package/dist/parser/lru.js +0 -109
  163. package/dist/parser/lru.js.map +0 -1
  164. package/dist/parser/parser.d.ts +0 -25
  165. package/dist/parser/parser.js +0 -115
  166. package/dist/parser/parser.js.map +0 -1
  167. package/dist/parser/tokenizer.js +0 -69
  168. package/dist/parser/tokenizer.js.map +0 -1
  169. package/dist/parser/types.d.ts +0 -51
  170. package/dist/parser/types.js +0 -46
  171. package/dist/parser/types.js.map +0 -1
  172. package/dist/pipeline/conditions.d.ts +0 -134
  173. package/dist/pipeline/conditions.js +0 -406
  174. package/dist/pipeline/conditions.js.map +0 -1
  175. package/dist/pipeline/exclusive.js +0 -230
  176. package/dist/pipeline/exclusive.js.map +0 -1
  177. package/dist/pipeline/index.d.ts +0 -55
  178. package/dist/pipeline/index.js +0 -708
  179. package/dist/pipeline/index.js.map +0 -1
  180. package/dist/pipeline/materialize.js +0 -1103
  181. package/dist/pipeline/materialize.js.map +0 -1
  182. package/dist/pipeline/parseStateKey.d.ts +0 -15
  183. package/dist/pipeline/parseStateKey.js +0 -446
  184. package/dist/pipeline/parseStateKey.js.map +0 -1
  185. package/dist/pipeline/simplify.js +0 -515
  186. package/dist/pipeline/simplify.js.map +0 -1
  187. package/dist/pipeline/warnings.js +0 -18
  188. package/dist/pipeline/warnings.js.map +0 -1
  189. package/dist/plugins/index.d.ts +0 -2
  190. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  191. package/dist/plugins/okhsl-plugin.js +0 -97
  192. package/dist/plugins/okhsl-plugin.js.map +0 -1
  193. package/dist/plugins/types.d.ts +0 -76
  194. package/dist/properties/index.js +0 -222
  195. package/dist/properties/index.js.map +0 -1
  196. package/dist/properties/property-type-resolver.d.ts +0 -24
  197. package/dist/properties/property-type-resolver.js +0 -90
  198. package/dist/properties/property-type-resolver.js.map +0 -1
  199. package/dist/ssr/astro.js.map +0 -1
  200. package/dist/ssr/async-storage.d.ts +0 -17
  201. package/dist/ssr/async-storage.js.map +0 -1
  202. package/dist/ssr/collect-auto-properties.js +0 -39
  203. package/dist/ssr/collect-auto-properties.js.map +0 -1
  204. package/dist/ssr/collector.d.ts +0 -102
  205. package/dist/ssr/collector.js +0 -219
  206. package/dist/ssr/collector.js.map +0 -1
  207. package/dist/ssr/format-global-rules.js.map +0 -1
  208. package/dist/ssr/format-keyframes.js +0 -69
  209. package/dist/ssr/format-keyframes.js.map +0 -1
  210. package/dist/ssr/format-property.js +0 -49
  211. package/dist/ssr/format-property.js.map +0 -1
  212. package/dist/ssr/format-rules.js.map +0 -1
  213. package/dist/ssr/hydrate.d.ts +0 -22
  214. package/dist/ssr/hydrate.js +0 -49
  215. package/dist/ssr/hydrate.js.map +0 -1
  216. package/dist/ssr/ssr-collector-ref.js +0 -12
  217. package/dist/ssr/ssr-collector-ref.js.map +0 -1
  218. package/dist/states/index.d.ts +0 -49
  219. package/dist/states/index.js +0 -170
  220. package/dist/states/index.js.map +0 -1
  221. package/dist/static/tastyStatic.d.ts +0 -46
  222. package/dist/static/tastyStatic.js +0 -30
  223. package/dist/static/tastyStatic.js.map +0 -1
  224. package/dist/static/types.d.ts +0 -49
  225. package/dist/static/types.js +0 -24
  226. package/dist/static/types.js.map +0 -1
  227. package/dist/styles/border.d.ts +0 -25
  228. package/dist/styles/border.js +0 -120
  229. package/dist/styles/border.js.map +0 -1
  230. package/dist/styles/color.d.ts +0 -14
  231. package/dist/styles/color.js +0 -26
  232. package/dist/styles/color.js.map +0 -1
  233. package/dist/styles/const.js +0 -17
  234. package/dist/styles/const.js.map +0 -1
  235. package/dist/styles/createStyle.js +0 -79
  236. package/dist/styles/createStyle.js.map +0 -1
  237. package/dist/styles/dimension.js +0 -109
  238. package/dist/styles/dimension.js.map +0 -1
  239. package/dist/styles/directional.js +0 -133
  240. package/dist/styles/directional.js.map +0 -1
  241. package/dist/styles/display.d.ts +0 -30
  242. package/dist/styles/display.js +0 -73
  243. package/dist/styles/display.js.map +0 -1
  244. package/dist/styles/fade.d.ts +0 -15
  245. package/dist/styles/fade.js +0 -62
  246. package/dist/styles/fade.js.map +0 -1
  247. package/dist/styles/fill.d.ts +0 -42
  248. package/dist/styles/fill.js +0 -51
  249. package/dist/styles/fill.js.map +0 -1
  250. package/dist/styles/flow.d.ts +0 -16
  251. package/dist/styles/flow.js +0 -12
  252. package/dist/styles/flow.js.map +0 -1
  253. package/dist/styles/gap.d.ts +0 -31
  254. package/dist/styles/gap.js +0 -38
  255. package/dist/styles/gap.js.map +0 -1
  256. package/dist/styles/height.d.ts +0 -17
  257. package/dist/styles/height.js +0 -19
  258. package/dist/styles/height.js.map +0 -1
  259. package/dist/styles/index.d.ts +0 -1
  260. package/dist/styles/index.js +0 -8
  261. package/dist/styles/index.js.map +0 -1
  262. package/dist/styles/inset.d.ts +0 -24
  263. package/dist/styles/inset.js +0 -34
  264. package/dist/styles/inset.js.map +0 -1
  265. package/dist/styles/list.d.ts +0 -16
  266. package/dist/styles/list.js +0 -100
  267. package/dist/styles/list.js.map +0 -1
  268. package/dist/styles/margin.d.ts +0 -24
  269. package/dist/styles/margin.js +0 -32
  270. package/dist/styles/margin.js.map +0 -1
  271. package/dist/styles/outline.d.ts +0 -29
  272. package/dist/styles/outline.js +0 -55
  273. package/dist/styles/outline.js.map +0 -1
  274. package/dist/styles/padding.d.ts +0 -24
  275. package/dist/styles/padding.js +0 -32
  276. package/dist/styles/padding.js.map +0 -1
  277. package/dist/styles/placement.d.ts +0 -37
  278. package/dist/styles/placement.js +0 -74
  279. package/dist/styles/placement.js.map +0 -1
  280. package/dist/styles/predefined.d.ts +0 -71
  281. package/dist/styles/predefined.js +0 -237
  282. package/dist/styles/predefined.js.map +0 -1
  283. package/dist/styles/preset.d.ts +0 -52
  284. package/dist/styles/preset.js +0 -127
  285. package/dist/styles/preset.js.map +0 -1
  286. package/dist/styles/radius.d.ts +0 -12
  287. package/dist/styles/radius.js +0 -83
  288. package/dist/styles/radius.js.map +0 -1
  289. package/dist/styles/scrollMargin.d.ts +0 -24
  290. package/dist/styles/scrollMargin.js +0 -32
  291. package/dist/styles/scrollMargin.js.map +0 -1
  292. package/dist/styles/scrollbar.d.ts +0 -25
  293. package/dist/styles/scrollbar.js +0 -51
  294. package/dist/styles/scrollbar.js.map +0 -1
  295. package/dist/styles/shadow.d.ts +0 -14
  296. package/dist/styles/shadow.js +0 -25
  297. package/dist/styles/shadow.js.map +0 -1
  298. package/dist/styles/shared.js +0 -17
  299. package/dist/styles/shared.js.map +0 -1
  300. package/dist/styles/transition.d.ts +0 -14
  301. package/dist/styles/transition.js +0 -159
  302. package/dist/styles/transition.js.map +0 -1
  303. package/dist/styles/types.d.ts +0 -564
  304. package/dist/styles/width.d.ts +0 -17
  305. package/dist/styles/width.js +0 -19
  306. package/dist/styles/width.js.map +0 -1
  307. package/dist/tasty.d.ts +0 -134
  308. package/dist/tasty.js +0 -240
  309. package/dist/tasty.js.map +0 -1
  310. package/dist/types.d.ts +0 -184
  311. package/dist/utils/cache-wrapper.js +0 -21
  312. package/dist/utils/cache-wrapper.js.map +0 -1
  313. package/dist/utils/case-converter.js +0 -8
  314. package/dist/utils/case-converter.js.map +0 -1
  315. package/dist/utils/color-math.d.ts +0 -46
  316. package/dist/utils/color-math.js +0 -749
  317. package/dist/utils/color-math.js.map +0 -1
  318. package/dist/utils/color-space.d.ts +0 -5
  319. package/dist/utils/color-space.js +0 -228
  320. package/dist/utils/color-space.js.map +0 -1
  321. package/dist/utils/colors.d.ts +0 -5
  322. package/dist/utils/colors.js +0 -10
  323. package/dist/utils/colors.js.map +0 -1
  324. package/dist/utils/css-types.d.ts +0 -7
  325. package/dist/utils/dotize.d.ts +0 -26
  326. package/dist/utils/dotize.js +0 -122
  327. package/dist/utils/dotize.js.map +0 -1
  328. package/dist/utils/filter-base-props.d.ts +0 -15
  329. package/dist/utils/filter-base-props.js +0 -45
  330. package/dist/utils/filter-base-props.js.map +0 -1
  331. package/dist/utils/get-display-name.d.ts +0 -7
  332. package/dist/utils/get-display-name.js +0 -10
  333. package/dist/utils/get-display-name.js.map +0 -1
  334. package/dist/utils/has-keys.js +0 -13
  335. package/dist/utils/has-keys.js.map +0 -1
  336. package/dist/utils/is-dev-env.js +0 -19
  337. package/dist/utils/is-dev-env.js.map +0 -1
  338. package/dist/utils/is-valid-element-type.js +0 -15
  339. package/dist/utils/is-valid-element-type.js.map +0 -1
  340. package/dist/utils/merge-styles.js.map +0 -1
  341. package/dist/utils/mod-attrs.d.ts +0 -6
  342. package/dist/utils/mod-attrs.js +0 -20
  343. package/dist/utils/mod-attrs.js.map +0 -1
  344. package/dist/utils/process-tokens.d.ts +0 -17
  345. package/dist/utils/process-tokens.js +0 -83
  346. package/dist/utils/process-tokens.js.map +0 -1
  347. package/dist/utils/resolve-recipes.d.ts +0 -17
  348. package/dist/utils/resolve-recipes.js.map +0 -1
  349. package/dist/utils/selector-transform.js +0 -32
  350. package/dist/utils/selector-transform.js.map +0 -1
  351. package/dist/utils/string.js +0 -8
  352. package/dist/utils/string.js.map +0 -1
  353. package/dist/utils/styles.d.ts +0 -99
  354. package/dist/utils/styles.js +0 -220
  355. package/dist/utils/styles.js.map +0 -1
  356. package/dist/utils/typography.d.ts +0 -47
  357. package/dist/utils/typography.js +0 -51
  358. package/dist/utils/typography.js.map +0 -1
  359. package/dist/utils/warnings.d.ts +0 -16
  360. package/dist/utils/warnings.js +0 -16
  361. package/dist/utils/warnings.js.map +0 -1
  362. package/dist/zero/css-writer.d.ts +0 -45
  363. package/dist/zero/css-writer.js +0 -73
  364. package/dist/zero/css-writer.js.map +0 -1
  365. package/dist/zero/extractor.d.ts +0 -24
  366. package/dist/zero/extractor.js.map +0 -1
  367. package/docs/PIPELINE.md +0 -519
  368. /package/dist/{chunks/cacheKey.d.ts → ssr/astro-client.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenphi/tasty",
3
- "version": "0.0.0-snapshot.bbd10c7",
3
+ "version": "0.0.0-snapshot.bbd36bd",
4
4
  "description": "A design-system-integrated styling system and DSL for concise, state-aware UI styling",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -32,7 +32,7 @@
32
32
  "import": "./dist/zero/index.js",
33
33
  "default": "./dist/zero/index.js"
34
34
  },
35
- "./next": {
35
+ "./zero/next": {
36
36
  "types": "./dist/zero/next.d.ts",
37
37
  "import": "./dist/zero/next.js",
38
38
  "default": "./dist/zero/next.js"
@@ -52,11 +52,41 @@
52
52
  "import": "./dist/ssr/next.js",
53
53
  "default": "./dist/ssr/next.js"
54
54
  },
55
+ "./ssr/next-config": {
56
+ "types": "./dist/ssr/next-config.d.ts",
57
+ "import": "./dist/ssr/next-config.js",
58
+ "default": "./dist/ssr/next-config.js"
59
+ },
55
60
  "./ssr/astro": {
56
61
  "types": "./dist/ssr/astro.d.ts",
57
62
  "import": "./dist/ssr/astro.js",
58
63
  "default": "./dist/ssr/astro.js"
59
64
  },
65
+ "./ssr/astro-client": {
66
+ "types": "./dist/ssr/astro-client.d.ts",
67
+ "import": "./dist/ssr/astro-client.js",
68
+ "default": "./dist/ssr/astro-client.js"
69
+ },
70
+ "./ssr/astro-middleware": {
71
+ "types": "./dist/ssr/astro-middleware.d.ts",
72
+ "import": "./dist/ssr/astro-middleware.js",
73
+ "default": "./dist/ssr/astro-middleware.js"
74
+ },
75
+ "./ssr/astro-middleware-static": {
76
+ "types": "./dist/ssr/astro-middleware-static.d.ts",
77
+ "import": "./dist/ssr/astro-middleware-static.js",
78
+ "default": "./dist/ssr/astro-middleware-static.js"
79
+ },
80
+ "./ssr/astro-middleware-extract": {
81
+ "types": "./dist/ssr/astro-middleware-extract.d.ts",
82
+ "import": "./dist/ssr/astro-middleware-extract.js",
83
+ "default": "./dist/ssr/astro-middleware-extract.js"
84
+ },
85
+ "./ssr/astro-middleware-extract-static": {
86
+ "types": "./dist/ssr/astro-middleware-extract-static.d.ts",
87
+ "import": "./dist/ssr/astro-middleware-extract-static.js",
88
+ "default": "./dist/ssr/astro-middleware-extract-static.js"
89
+ },
60
90
  "./tasty.config": "./tasty.config.ts"
61
91
  },
62
92
  "files": [
@@ -67,7 +97,12 @@
67
97
  "sideEffects": [
68
98
  "./dist/ssr/index.js",
69
99
  "./dist/ssr/next.js",
70
- "./dist/ssr/astro.js"
100
+ "./dist/ssr/astro.js",
101
+ "./dist/ssr/astro-client.js",
102
+ "./dist/ssr/astro-middleware.js",
103
+ "./dist/ssr/astro-middleware-static.js",
104
+ "./dist/ssr/astro-middleware-extract.js",
105
+ "./dist/ssr/astro-middleware-extract-static.js"
71
106
  ],
72
107
  "engines": {
73
108
  "node": ">=20"
@@ -75,6 +110,9 @@
75
110
  "scripts": {
76
111
  "build": "tsdown",
77
112
  "test": "vitest run",
113
+ "test:node": "vitest run --project node",
114
+ "test:browser": "vitest run --project browser",
115
+ "test:setup": "playwright install chromium",
78
116
  "test:watch": "vitest",
79
117
  "test:coverage": "vitest run --coverage",
80
118
  "typecheck": "tsc --noEmit",
@@ -83,11 +121,18 @@
83
121
  "format": "prettier --write \"src/**/*.{ts,tsx}\"",
84
122
  "format:check": "prettier --check \"src/**/*.{ts,tsx}\"",
85
123
  "size": "size-limit",
86
- "bench": "vitest bench",
124
+ "bench": "vitest bench --project node",
125
+ "bench:browser": "vitest bench --project browser",
126
+ "bench:overhead": "vitest bench --config vitest.production-browser-bench.config.ts src/tasty-overhead.bench.tsx",
127
+ "bench:injection": "vitest bench --config vitest.production-browser-bench.config.ts src/tasty-injection.bench.ts",
128
+ "bench:interaction": "vitest bench --config vitest.production-browser-bench.config.ts src/tasty-interaction.bench.tsx",
129
+ "bench:cold-start": "node scripts/cold-start/index.mjs",
87
130
  "prepublishOnly": "pnpm run build",
88
131
  "changeset": "changeset",
89
132
  "version": "changeset version",
90
133
  "release": "changeset publish",
134
+ "knip": "knip",
135
+ "check:test-only": "node scripts/check-test-only-code.mjs",
91
136
  "hygiene": "pnpm lint && pnpm format:check && pnpm typecheck",
92
137
  "hygiene:fix": "pnpm lint:fix && pnpm format && pnpm typecheck"
93
138
  },
@@ -117,6 +162,7 @@
117
162
  "@babel/helper-plugin-utils": "^7.24.0",
118
163
  "@babel/types": "^7.24.0",
119
164
  "jiti": "^2.6.1",
165
+ "next": ">=14.0.0",
120
166
  "react": "^18.0.0 || ^19.0.0"
121
167
  },
122
168
  "peerDependenciesMeta": {
@@ -134,60 +180,69 @@
134
180
  },
135
181
  "jiti": {
136
182
  "optional": true
183
+ },
184
+ "next": {
185
+ "optional": true
137
186
  }
138
187
  },
139
188
  "dependencies": {
140
189
  "csstype": "^3.1.0"
141
190
  },
142
191
  "devDependencies": {
192
+ "@astrojs/react": "^4.4.2",
143
193
  "@babel/core": "^7.24.0",
144
- "@changesets/changelog-github": "^0.6.0",
194
+ "@babel/helper-plugin-utils": "^7.24.0",
195
+ "@babel/types": "^7.24.0",
196
+ "@changesets/changelog-github": "^0.7.0",
145
197
  "@changesets/cli": "^2.29.8",
146
198
  "@eslint/js": "^10.0.1",
147
199
  "@size-limit/esbuild": "^12.0.0",
148
200
  "@size-limit/file": "^12.0.0",
201
+ "@tenphi/eslint-plugin-tasty": "^1.0.5",
149
202
  "@testing-library/jest-dom": "^6.9.1",
150
203
  "@testing-library/react": "^16.3.2",
151
204
  "@types/babel__core": "^7.20.5",
152
205
  "@types/babel__helper-plugin-utils": "^7.10.3",
153
- "@types/node": "^25.3.2",
206
+ "@types/node": "^26.4.0",
154
207
  "@types/react": "^19.0.0",
155
- "@vitest/runner": "^4.0.18",
208
+ "@types/react-dom": "^19.0.0",
209
+ "@vitest/browser-playwright": "^4.1.10",
210
+ "astro": "^5.18.2",
211
+ "esbuild": "^0.27.7",
156
212
  "eslint": "^10.0.0",
157
213
  "eslint-config-prettier": "^10.1.8",
158
- "jsdom": "^29.0.1",
159
- "prettier": "^3.8.1",
214
+ "jiti": "^2.6.1",
215
+ "knip": "^5.61.3",
216
+ "next": "^16.0.0",
217
+ "playwright": "^1.62.1",
218
+ "prettier": "^3.9.6",
160
219
  "react": "^19.0.0",
220
+ "react-dom": "^19.0.0",
161
221
  "size-limit": "^12.0.0",
162
- "tsdown": "^0.21.7",
163
- "typescript": "^5.9.3",
222
+ "tsdown": "^0.22.0",
223
+ "typescript": "^6.0.2",
164
224
  "typescript-eslint": "^8.56.0",
165
- "vitest": "^4.0.18"
166
- },
167
- "pnpm": {
168
- "onlyBuiltDependencies": [
169
- "esbuild"
170
- ]
225
+ "vitest": "^4.1.10"
171
226
  },
172
- "packageManager": "pnpm@10.32.1",
227
+ "packageManager": "pnpm@11.24.0",
173
228
  "size-limit": [
174
229
  {
175
230
  "name": "main (import *)",
176
231
  "path": "dist/index.js",
177
232
  "import": "*",
178
- "limit": "48 kB"
233
+ "limit": "57.5 kB"
179
234
  },
180
235
  {
181
236
  "name": "core (import *)",
182
237
  "path": "dist/core/index.js",
183
238
  "import": "*",
184
- "limit": "45 kB"
239
+ "limit": "54.5 kB"
185
240
  },
186
241
  {
187
242
  "name": "static",
188
243
  "path": "dist/static/index.js",
189
244
  "import": "*",
190
- "limit": "2 kB"
245
+ "limit": "16.8 kB"
191
246
  },
192
247
  {
193
248
  "name": "zero",
@@ -198,7 +253,7 @@
198
253
  "path",
199
254
  "crypto"
200
255
  ],
201
- "limit": "28.5 kB"
256
+ "limit": "31.25 kB"
202
257
  },
203
258
  {
204
259
  "name": "babel-plugin",
@@ -209,7 +264,7 @@
209
264
  "path",
210
265
  "crypto"
211
266
  ],
212
- "limit": "41 kB"
267
+ "limit": "49.6 kB"
213
268
  }
214
269
  ]
215
270
  }
package/tasty.config.ts CHANGED
@@ -3,6 +3,7 @@ export default {
3
3
  '#white',
4
4
  '#black',
5
5
  '#current',
6
+ '#clear',
6
7
  '$gap',
7
8
  '$radius',
8
9
  '$border-width',
@@ -11,4 +12,9 @@ export default {
11
12
  '$sharp-radius',
12
13
  '$bold-font-weight',
13
14
  ],
15
+ styles: ['viewTransitionName'],
16
+ // This repo imports its own API relatively, so the plugin's default
17
+ // `@tenphi/tasty` import tracking never matches. List the local entry points so
18
+ // `tasty({ styles })` call sites are actually linted.
19
+ importSources: ['@tenphi/tasty', './tasty', '../tasty', './src/tasty'],
14
20
  };
@@ -1,7 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
3
- if (typeof require !== "undefined") return require.apply(this, arguments);
4
- throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
5
- });
6
- //#endregion
7
- export { __require };
@@ -1,77 +0,0 @@
1
- import { extractLocalPredefinedStates, extractPredefinedStateRefs } from "../states/index.js";
2
- //#region src/chunks/cacheKey.ts
3
- /**
4
- * Chunk-specific cache key generation.
5
- *
6
- * Generates cache keys that only include styles relevant to a specific chunk,
7
- * enabling more granular caching and reuse.
8
- *
9
- * Enhanced to support predefined states:
10
- * - Global predefined states don't affect cache keys (constant across app)
11
- * - Local predefined states only affect cache keys if referenced in the chunk
12
- */
13
- const _stableStringifyCache = /* @__PURE__ */ new WeakMap();
14
- /**
15
- * Recursively serialize a value with sorted keys for stable output.
16
- * This ensures that {a: 1, b: 2} and {b: 2, a: 1} produce the same string.
17
- * Uses a WeakMap cache for object values to avoid re-serializing the same references.
18
- */
19
- function stableStringify(value) {
20
- if (value === null) return "null";
21
- if (value === void 0) return "undefined";
22
- if (typeof value !== "object") return JSON.stringify(value);
23
- const cached = _stableStringifyCache.get(value);
24
- if (cached !== void 0) return cached;
25
- let result;
26
- if (Array.isArray(value)) result = "[" + value.map(stableStringify).join(",") + "]";
27
- else {
28
- const obj = value;
29
- const sortedKeys = Object.keys(obj).sort();
30
- const parts = [];
31
- for (const key of sortedKeys) if (obj[key] !== void 0) parts.push(`${JSON.stringify(key)}:${stableStringify(obj[key])}`);
32
- result = "{" + parts.join(",") + "}";
33
- }
34
- _stableStringifyCache.set(value, result);
35
- return result;
36
- }
37
- /**
38
- * Generate a cache key for a specific chunk.
39
- *
40
- * Only includes the styles that belong to this chunk, allowing
41
- * chunks to be cached independently.
42
- *
43
- * Also includes relevant local predefined states that are referenced
44
- * by this chunk's styles.
45
- *
46
- * @param styles - The full styles object
47
- * @param chunkName - Name of the chunk
48
- * @param styleKeys - Keys of styles belonging to this chunk
49
- * @returns A stable cache key string
50
- */
51
- function generateChunkCacheKey(styles, chunkName, styleKeys) {
52
- const parts = [chunkName];
53
- let chunkStylesStr = "";
54
- for (const key of styleKeys) {
55
- const value = styles[key];
56
- if (value !== void 0) {
57
- const serialized = stableStringify(value);
58
- parts.push(`${key}:${serialized}`);
59
- chunkStylesStr += serialized;
60
- }
61
- }
62
- const localStates = extractLocalPredefinedStates(styles);
63
- if (Object.keys(localStates).length > 0) {
64
- const referencedStates = extractPredefinedStateRefs(chunkStylesStr);
65
- const relevantLocalStates = [];
66
- for (const stateName of referencedStates) if (localStates[stateName]) relevantLocalStates.push(`${stateName}=${localStates[stateName]}`);
67
- if (relevantLocalStates.length > 0) {
68
- relevantLocalStates.sort();
69
- parts.unshift(`[states:${relevantLocalStates.join("|")}]`);
70
- }
71
- }
72
- return parts.join("\0");
73
- }
74
- //#endregion
75
- export { generateChunkCacheKey };
76
-
77
- //# sourceMappingURL=cacheKey.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cacheKey.js","names":[],"sources":["../../src/chunks/cacheKey.ts"],"sourcesContent":["/**\n * Chunk-specific cache key generation.\n *\n * Generates cache keys that only include styles relevant to a specific chunk,\n * enabling more granular caching and reuse.\n *\n * Enhanced to support predefined states:\n * - Global predefined states don't affect cache keys (constant across app)\n * - Local predefined states only affect cache keys if referenced in the chunk\n */\n\nimport {\n extractLocalPredefinedStates,\n extractPredefinedStateRefs,\n} from '../states';\nimport type { Styles } from '../styles/types';\n\nconst _stableStringifyCache = new WeakMap<object, string>();\n\n/**\n * Recursively serialize a value with sorted keys for stable output.\n * This ensures that {a: 1, b: 2} and {b: 2, a: 1} produce the same string.\n * Uses a WeakMap cache for object values to avoid re-serializing the same references.\n */\nfunction stableStringify(value: unknown): string {\n if (value === null) {\n return 'null';\n }\n if (value === undefined) {\n return 'undefined';\n }\n if (typeof value !== 'object') {\n return JSON.stringify(value);\n }\n\n const cached = _stableStringifyCache.get(value as object);\n if (cached !== undefined) return cached;\n\n let result: string;\n if (Array.isArray(value)) {\n result = '[' + value.map(stableStringify).join(',') + ']';\n } else {\n const obj = value as Record<string, unknown>;\n const sortedKeys = Object.keys(obj).sort();\n const parts: string[] = [];\n for (const key of sortedKeys) {\n if (obj[key] !== undefined) {\n parts.push(`${JSON.stringify(key)}:${stableStringify(obj[key])}`);\n }\n }\n result = '{' + parts.join(',') + '}';\n }\n\n _stableStringifyCache.set(value as object, result);\n return result;\n}\n\n/**\n * Generate a cache key for a specific chunk.\n *\n * Only includes the styles that belong to this chunk, allowing\n * chunks to be cached independently.\n *\n * Also includes relevant local predefined states that are referenced\n * by this chunk's styles.\n *\n * @param styles - The full styles object\n * @param chunkName - Name of the chunk\n * @param styleKeys - Keys of styles belonging to this chunk\n * @returns A stable cache key string\n */\nexport function generateChunkCacheKey(\n styles: Styles,\n chunkName: string,\n styleKeys: string[],\n): string {\n // Start with chunk name for namespace separation\n const parts: string[] = [chunkName];\n\n // styleKeys are already sorted by categorizeStyleKeys\n let chunkStylesStr = '';\n\n for (const key of styleKeys) {\n const value = styles[key];\n if (value !== undefined) {\n // Use stable stringify for consistent serialization regardless of key order\n const serialized = stableStringify(value);\n parts.push(`${key}:${serialized}`);\n chunkStylesStr += serialized;\n }\n }\n\n // Extract local predefined states from the full styles object\n const localStates = extractLocalPredefinedStates(styles);\n\n // Only include local predefined states that are actually referenced in this chunk\n if (Object.keys(localStates).length > 0) {\n const referencedStates = extractPredefinedStateRefs(chunkStylesStr);\n const relevantLocalStates: string[] = [];\n\n for (const stateName of referencedStates) {\n if (localStates[stateName]) {\n relevantLocalStates.push(`${stateName}=${localStates[stateName]}`);\n }\n }\n\n // Add relevant local states to the cache key (sorted for stability)\n if (relevantLocalStates.length > 0) {\n relevantLocalStates.sort();\n parts.unshift(`[states:${relevantLocalStates.join('|')}]`);\n }\n }\n\n // Use null character as separator (safe, not in JSON output)\n return parts.join('\\0');\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAM,wCAAwB,IAAI,SAAyB;;;;;;AAO3D,SAAS,gBAAgB,OAAwB;AAC/C,KAAI,UAAU,KACZ,QAAO;AAET,KAAI,UAAU,KAAA,EACZ,QAAO;AAET,KAAI,OAAO,UAAU,SACnB,QAAO,KAAK,UAAU,MAAM;CAG9B,MAAM,SAAS,sBAAsB,IAAI,MAAgB;AACzD,KAAI,WAAW,KAAA,EAAW,QAAO;CAEjC,IAAI;AACJ,KAAI,MAAM,QAAQ,MAAM,CACtB,UAAS,MAAM,MAAM,IAAI,gBAAgB,CAAC,KAAK,IAAI,GAAG;MACjD;EACL,MAAM,MAAM;EACZ,MAAM,aAAa,OAAO,KAAK,IAAI,CAAC,MAAM;EAC1C,MAAM,QAAkB,EAAE;AAC1B,OAAK,MAAM,OAAO,WAChB,KAAI,IAAI,SAAS,KAAA,EACf,OAAM,KAAK,GAAG,KAAK,UAAU,IAAI,CAAC,GAAG,gBAAgB,IAAI,KAAK,GAAG;AAGrE,WAAS,MAAM,MAAM,KAAK,IAAI,GAAG;;AAGnC,uBAAsB,IAAI,OAAiB,OAAO;AAClD,QAAO;;;;;;;;;;;;;;;;AAiBT,SAAgB,sBACd,QACA,WACA,WACQ;CAER,MAAM,QAAkB,CAAC,UAAU;CAGnC,IAAI,iBAAiB;AAErB,MAAK,MAAM,OAAO,WAAW;EAC3B,MAAM,QAAQ,OAAO;AACrB,MAAI,UAAU,KAAA,GAAW;GAEvB,MAAM,aAAa,gBAAgB,MAAM;AACzC,SAAM,KAAK,GAAG,IAAI,GAAG,aAAa;AAClC,qBAAkB;;;CAKtB,MAAM,cAAc,6BAA6B,OAAO;AAGxD,KAAI,OAAO,KAAK,YAAY,CAAC,SAAS,GAAG;EACvC,MAAM,mBAAmB,2BAA2B,eAAe;EACnE,MAAM,sBAAgC,EAAE;AAExC,OAAK,MAAM,aAAa,iBACtB,KAAI,YAAY,WACd,qBAAoB,KAAK,GAAG,UAAU,GAAG,YAAY,aAAa;AAKtE,MAAI,oBAAoB,SAAS,GAAG;AAClC,uBAAoB,MAAM;AAC1B,SAAM,QAAQ,WAAW,oBAAoB,KAAK,IAAI,CAAC,GAAG;;;AAK9D,QAAO,MAAM,KAAK,KAAK"}
@@ -1,37 +0,0 @@
1
- //#region src/chunks/definitions.d.ts
2
- declare const CHUNK_NAMES: {
3
- /** Special chunk for styles that cannot be split */readonly COMBINED: "combined";
4
- readonly SUBCOMPONENTS: "subcomponents";
5
- readonly APPEARANCE: "appearance";
6
- readonly FONT: "font";
7
- readonly DIMENSION: "dimension";
8
- readonly DISPLAY: "display";
9
- readonly LAYOUT: "layout";
10
- readonly POSITION: "position";
11
- readonly MISC: "misc";
12
- };
13
- type ChunkName = (typeof CHUNK_NAMES)[keyof typeof CHUNK_NAMES];
14
- /**
15
- * Pre-computed map for O(1) style-to-chunk lookup.
16
- * Built once at module load time.
17
- */
18
- declare const STYLE_TO_CHUNK: Map<string, ChunkName>;
19
- interface ChunkInfo {
20
- /** Name of the chunk */
21
- name: ChunkName | string;
22
- /** Style keys belonging to this chunk */
23
- styleKeys: string[];
24
- }
25
- /**
26
- * Categorize style keys into chunks.
27
- *
28
- * Returns chunks in a deterministic order (by CHUNK_ORDER) regardless
29
- * of the order of keys in the input styles object.
30
- *
31
- * @param styles - The styles object to categorize
32
- * @returns Map of chunk name to array of style keys in that chunk (in priority order)
33
- */
34
- declare function categorizeStyleKeys(styles: Record<string, unknown>): Map<string, string[]>;
35
- //#endregion
36
- export { CHUNK_NAMES, ChunkInfo, ChunkName, STYLE_TO_CHUNK, categorizeStyleKeys };
37
- //# sourceMappingURL=definitions.d.ts.map
@@ -1,258 +0,0 @@
1
- import { isSelector } from "../pipeline/index.js";
2
- //#region src/chunks/definitions.ts
3
- /**
4
- * Style chunk definitions for CSS chunking optimization.
5
- *
6
- * Styles are grouped into chunks based on:
7
- * 1. Handler dependencies - styles that share a handler MUST be in the same chunk
8
- * 2. Logical grouping - related styles grouped for better cache reuse
9
- *
10
- * See STYLE_CHUNKING_SPEC.md for detailed rationale.
11
- *
12
- * ============================================================================
13
- * ⚠️ CRITICAL ARCHITECTURAL CONSTRAINT: NO CROSS-CHUNK HANDLER DEPENDENCIES
14
- * ============================================================================
15
- *
16
- * Style handlers declare their dependencies via `__lookupStyles` array.
17
- * This creates a dependency graph where handlers read multiple style props.
18
- *
19
- * **ALL styles in a handler's `__lookupStyles` MUST be in the SAME chunk.**
20
- *
21
- * Why this matters:
22
- * 1. Each chunk computes a cache key from ONLY its own style values
23
- * 2. If a handler reads a style from another chunk, that value isn't in the cache key
24
- * 3. Changing the cross-chunk style won't invalidate this chunk's cache
25
- * 4. Result: stale CSS output or incorrect cache hits
26
- *
27
- * Example of a violation:
28
- * ```
29
- * // flowStyle.__lookupStyles = ['display', 'flow']
30
- * // If 'display' is in DISPLAY chunk and 'flow' is in LAYOUT chunk:
31
- * // - User sets { display: 'grid', flow: 'column' }
32
- * // - LAYOUT chunk caches CSS with flow=column, display=grid
33
- * // - User changes to { display: 'flex', flow: 'column' }
34
- * // - LAYOUT chunk cache key unchanged (only has 'flow')
35
- * // - Returns stale CSS computed with display=grid!
36
- * ```
37
- *
38
- * Before adding/moving styles, verify:
39
- * 1. Find all handlers that use this style (grep for the style name in __lookupStyles)
40
- * 2. Ensure ALL styles from each handler's __lookupStyles are in the same chunk
41
- * ============================================================================
42
- */
43
- /**
44
- * Appearance chunk - visual styling with independent handlers
45
- */
46
- const APPEARANCE_CHUNK_STYLES = [
47
- "fill",
48
- "color",
49
- "opacity",
50
- "border",
51
- "radius",
52
- "outline",
53
- "outlineOffset",
54
- "shadow",
55
- "fade"
56
- ];
57
- /**
58
- * Font chunk - typography styles
59
- *
60
- * Handler dependencies (all styles in each handler MUST stay in this chunk):
61
- * ⚠️ presetStyle: preset, fontSize, lineHeight, letterSpacing, textTransform,
62
- * fontWeight, fontStyle, font
63
- */
64
- const FONT_CHUNK_STYLES = [
65
- "preset",
66
- "font",
67
- "fontWeight",
68
- "fontStyle",
69
- "fontSize",
70
- "lineHeight",
71
- "letterSpacing",
72
- "textTransform",
73
- "fontFamily",
74
- "textAlign",
75
- "textDecoration",
76
- "wordBreak",
77
- "wordWrap",
78
- "boldFontWeight"
79
- ];
80
- /**
81
- * Dimension chunk - sizing and spacing
82
- *
83
- * Handler dependencies (all styles in each handler MUST stay in this chunk):
84
- * ⚠️ paddingStyle: padding, paddingTop/Right/Bottom/Left, paddingBlock/Inline
85
- * ⚠️ marginStyle: margin, marginTop/Right/Bottom/Left, marginBlock/Inline
86
- * ⚠️ widthStyle: width, minWidth, maxWidth
87
- * ⚠️ heightStyle: height, minHeight, maxHeight
88
- */
89
- const DIMENSION_CHUNK_STYLES = [
90
- "padding",
91
- "paddingTop",
92
- "paddingRight",
93
- "paddingBottom",
94
- "paddingLeft",
95
- "paddingBlock",
96
- "paddingInline",
97
- "margin",
98
- "marginTop",
99
- "marginRight",
100
- "marginBottom",
101
- "marginLeft",
102
- "marginBlock",
103
- "marginInline",
104
- "width",
105
- "minWidth",
106
- "maxWidth",
107
- "height",
108
- "minHeight",
109
- "maxHeight",
110
- "flexBasis",
111
- "flexGrow",
112
- "flexShrink",
113
- "flex"
114
- ];
115
- /**
116
- * Display chunk - display mode, layout flow, text overflow, and scrollbar
117
- *
118
- * Handler dependencies (all styles in each handler MUST stay in this chunk):
119
- * ⚠️ displayStyle: display, hide, textOverflow, overflow, whiteSpace
120
- * ⚠️ flowStyle: display, flow
121
- * ⚠️ gapStyle: display, flow, gap
122
- * ⚠️ scrollbarStyle: scrollbar, overflow
123
- */
124
- const DISPLAY_CHUNK_STYLES = [
125
- "display",
126
- "hide",
127
- "textOverflow",
128
- "overflow",
129
- "whiteSpace",
130
- "flow",
131
- "gap",
132
- "scrollbar"
133
- ];
134
- /**
135
- * Layout chunk - flex/grid alignment and grid templates
136
- *
137
- * Note: flow and gap are in DISPLAY chunk due to handler dependencies
138
- * (flowStyle and gapStyle both require 'display' prop).
139
- */
140
- const LAYOUT_CHUNK_STYLES = [
141
- "placeItems",
142
- "placeContent",
143
- "alignItems",
144
- "alignContent",
145
- "justifyItems",
146
- "justifyContent",
147
- "align",
148
- "justify",
149
- "place",
150
- "columnGap",
151
- "rowGap",
152
- "gridColumns",
153
- "gridRows",
154
- "gridTemplate",
155
- "gridAreas",
156
- "gridAutoFlow",
157
- "gridAutoColumns",
158
- "gridAutoRows"
159
- ];
160
- /**
161
- * Position chunk - element positioning
162
- *
163
- * Handler dependencies (all styles in each handler MUST stay in this chunk):
164
- * ⚠️ insetStyle: inset, insetBlock, insetInline, top, right, bottom, left
165
- */
166
- const POSITION_CHUNK_STYLES = [
167
- "position",
168
- "inset",
169
- "insetBlock",
170
- "insetInline",
171
- "top",
172
- "right",
173
- "bottom",
174
- "left",
175
- "zIndex",
176
- "gridArea",
177
- "gridColumn",
178
- "gridRow",
179
- "order",
180
- "placeSelf",
181
- "alignSelf",
182
- "justifySelf",
183
- "transform",
184
- "transition",
185
- "animation"
186
- ];
187
- const CHUNK_NAMES = {
188
- COMBINED: "combined",
189
- SUBCOMPONENTS: "subcomponents",
190
- APPEARANCE: "appearance",
191
- FONT: "font",
192
- DIMENSION: "dimension",
193
- DISPLAY: "display",
194
- LAYOUT: "layout",
195
- POSITION: "position",
196
- MISC: "misc"
197
- };
198
- /**
199
- * Pre-computed map for O(1) style-to-chunk lookup.
200
- * Built once at module load time.
201
- */
202
- const STYLE_TO_CHUNK = /* @__PURE__ */ new Map();
203
- function populateStyleToChunkMap() {
204
- for (const style of APPEARANCE_CHUNK_STYLES) STYLE_TO_CHUNK.set(style, CHUNK_NAMES.APPEARANCE);
205
- for (const style of FONT_CHUNK_STYLES) STYLE_TO_CHUNK.set(style, CHUNK_NAMES.FONT);
206
- for (const style of DIMENSION_CHUNK_STYLES) STYLE_TO_CHUNK.set(style, CHUNK_NAMES.DIMENSION);
207
- for (const style of DISPLAY_CHUNK_STYLES) STYLE_TO_CHUNK.set(style, CHUNK_NAMES.DISPLAY);
208
- for (const style of LAYOUT_CHUNK_STYLES) STYLE_TO_CHUNK.set(style, CHUNK_NAMES.LAYOUT);
209
- for (const style of POSITION_CHUNK_STYLES) STYLE_TO_CHUNK.set(style, CHUNK_NAMES.POSITION);
210
- }
211
- populateStyleToChunkMap();
212
- /**
213
- * Chunk processing order. This ensures deterministic className allocation
214
- * regardless of style key order in the input.
215
- */
216
- const CHUNK_ORDER = [
217
- CHUNK_NAMES.APPEARANCE,
218
- CHUNK_NAMES.FONT,
219
- CHUNK_NAMES.DIMENSION,
220
- CHUNK_NAMES.DISPLAY,
221
- CHUNK_NAMES.LAYOUT,
222
- CHUNK_NAMES.POSITION,
223
- CHUNK_NAMES.MISC,
224
- CHUNK_NAMES.SUBCOMPONENTS
225
- ];
226
- new Map(CHUNK_ORDER.map((name, index) => [name, index]));
227
- /**
228
- * Categorize style keys into chunks.
229
- *
230
- * Returns chunks in a deterministic order (by CHUNK_ORDER) regardless
231
- * of the order of keys in the input styles object.
232
- *
233
- * @param styles - The styles object to categorize
234
- * @returns Map of chunk name to array of style keys in that chunk (in priority order)
235
- */
236
- function categorizeStyleKeys(styles) {
237
- const chunkData = {};
238
- const keys = Object.keys(styles);
239
- for (const key of keys) {
240
- if (key === "$" || key === "@keyframes" || key === "@properties" || key === "@fontFace" || key === "@counterStyle" || key === "recipe") continue;
241
- if (isSelector(key)) {
242
- if (!chunkData[CHUNK_NAMES.SUBCOMPONENTS]) chunkData[CHUNK_NAMES.SUBCOMPONENTS] = [];
243
- chunkData[CHUNK_NAMES.SUBCOMPONENTS].push(key);
244
- } else {
245
- const chunkName = STYLE_TO_CHUNK.get(key) ?? CHUNK_NAMES.MISC;
246
- if (!chunkData[chunkName]) chunkData[chunkName] = [];
247
- chunkData[chunkName].push(key);
248
- }
249
- }
250
- const orderedChunks = /* @__PURE__ */ new Map();
251
- for (const chunkName of CHUNK_ORDER) if (chunkData[chunkName] && chunkData[chunkName].length > 0) orderedChunks.set(chunkName, chunkData[chunkName].sort());
252
- for (const chunkName of Object.keys(chunkData)) if (!orderedChunks.has(chunkName)) orderedChunks.set(chunkName, chunkData[chunkName].sort());
253
- return orderedChunks;
254
- }
255
- //#endregion
256
- export { CHUNK_NAMES, STYLE_TO_CHUNK, categorizeStyleKeys };
257
-
258
- //# sourceMappingURL=definitions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"definitions.js","names":[],"sources":["../../src/chunks/definitions.ts"],"sourcesContent":["/**\n * Style chunk definitions for CSS chunking optimization.\n *\n * Styles are grouped into chunks based on:\n * 1. Handler dependencies - styles that share a handler MUST be in the same chunk\n * 2. Logical grouping - related styles grouped for better cache reuse\n *\n * See STYLE_CHUNKING_SPEC.md for detailed rationale.\n *\n * ============================================================================\n * ⚠️ CRITICAL ARCHITECTURAL CONSTRAINT: NO CROSS-CHUNK HANDLER DEPENDENCIES\n * ============================================================================\n *\n * Style handlers declare their dependencies via `__lookupStyles` array.\n * This creates a dependency graph where handlers read multiple style props.\n *\n * **ALL styles in a handler's `__lookupStyles` MUST be in the SAME chunk.**\n *\n * Why this matters:\n * 1. Each chunk computes a cache key from ONLY its own style values\n * 2. If a handler reads a style from another chunk, that value isn't in the cache key\n * 3. Changing the cross-chunk style won't invalidate this chunk's cache\n * 4. Result: stale CSS output or incorrect cache hits\n *\n * Example of a violation:\n * ```\n * // flowStyle.__lookupStyles = ['display', 'flow']\n * // If 'display' is in DISPLAY chunk and 'flow' is in LAYOUT chunk:\n * // - User sets { display: 'grid', flow: 'column' }\n * // - LAYOUT chunk caches CSS with flow=column, display=grid\n * // - User changes to { display: 'flex', flow: 'column' }\n * // - LAYOUT chunk cache key unchanged (only has 'flow')\n * // - Returns stale CSS computed with display=grid!\n * ```\n *\n * Before adding/moving styles, verify:\n * 1. Find all handlers that use this style (grep for the style name in __lookupStyles)\n * 2. Ensure ALL styles from each handler's __lookupStyles are in the same chunk\n * ============================================================================\n */\n\nimport { isSelector } from '../pipeline';\n\n// ============================================================================\n// Chunk Style Lists\n// ============================================================================\n\n/**\n * Appearance chunk - visual styling with independent handlers\n */\nexport const APPEARANCE_CHUNK_STYLES = [\n 'fill', // fillStyle (independent)\n 'color', // colorStyle (independent)\n 'opacity', // independent\n 'border', // borderStyle (independent)\n 'radius', // radiusStyle (independent)\n 'outline', // outlineStyle: outline ↔ outlineOffset\n 'outlineOffset', // outlineStyle: outline ↔ outlineOffset\n 'shadow', // shadowStyle (independent)\n 'fade', // fadeStyle (independent)\n] as const;\n\n/**\n * Font chunk - typography styles\n *\n * Handler dependencies (all styles in each handler MUST stay in this chunk):\n * ⚠️ presetStyle: preset, fontSize, lineHeight, letterSpacing, textTransform,\n * fontWeight, fontStyle, font\n */\nexport const FONT_CHUNK_STYLES = [\n // All from presetStyle handler - MUST stay together\n 'preset',\n 'font',\n 'fontWeight',\n 'fontStyle',\n 'fontSize',\n 'lineHeight',\n 'letterSpacing',\n 'textTransform',\n // Independent text styles grouped for cohesion\n 'fontFamily', // independent alias (logical grouping with font styles)\n 'textAlign',\n 'textDecoration',\n 'wordBreak',\n 'wordWrap',\n 'boldFontWeight',\n] as const;\n\n/**\n * Dimension chunk - sizing and spacing\n *\n * Handler dependencies (all styles in each handler MUST stay in this chunk):\n * ⚠️ paddingStyle: padding, paddingTop/Right/Bottom/Left, paddingBlock/Inline\n * ⚠️ marginStyle: margin, marginTop/Right/Bottom/Left, marginBlock/Inline\n * ⚠️ widthStyle: width, minWidth, maxWidth\n * ⚠️ heightStyle: height, minHeight, maxHeight\n */\nexport const DIMENSION_CHUNK_STYLES = [\n // All from paddingStyle handler - MUST stay together\n 'padding',\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n 'paddingBlock',\n 'paddingInline',\n // All from marginStyle handler - MUST stay together\n 'margin',\n 'marginTop',\n 'marginRight',\n 'marginBottom',\n 'marginLeft',\n 'marginBlock',\n 'marginInline',\n // widthStyle handler - MUST stay together\n 'width',\n 'minWidth',\n 'maxWidth',\n // heightStyle handler - MUST stay together\n 'height',\n 'minHeight',\n 'maxHeight',\n 'flexBasis',\n 'flexGrow',\n 'flexShrink',\n 'flex',\n] as const;\n\n/**\n * Display chunk - display mode, layout flow, text overflow, and scrollbar\n *\n * Handler dependencies (all styles in each handler MUST stay in this chunk):\n * ⚠️ displayStyle: display, hide, textOverflow, overflow, whiteSpace\n * ⚠️ flowStyle: display, flow\n * ⚠️ gapStyle: display, flow, gap\n * ⚠️ scrollbarStyle: scrollbar, overflow\n */\nexport const DISPLAY_CHUNK_STYLES = [\n // displayStyle handler\n 'display',\n 'hide',\n 'textOverflow',\n 'overflow', // also used by scrollbarStyle\n 'whiteSpace',\n // flowStyle handler (requires display)\n 'flow',\n // gapStyle handler (requires display, flow)\n 'gap',\n // scrollbarStyle handler (requires overflow)\n 'scrollbar',\n] as const;\n\n/**\n * Layout chunk - flex/grid alignment and grid templates\n *\n * Note: flow and gap are in DISPLAY chunk due to handler dependencies\n * (flowStyle and gapStyle both require 'display' prop).\n */\nexport const LAYOUT_CHUNK_STYLES = [\n // Alignment styles (all independent handlers)\n 'placeItems',\n 'placeContent',\n 'alignItems',\n 'alignContent',\n 'justifyItems',\n 'justifyContent',\n 'align', // placementStyle\n 'justify', // placementStyle\n 'place', // placementStyle\n 'columnGap',\n 'rowGap',\n // Grid template styles\n 'gridColumns',\n 'gridRows',\n 'gridTemplate',\n 'gridAreas',\n 'gridAutoFlow',\n 'gridAutoColumns',\n 'gridAutoRows',\n] as const;\n\n/**\n * Position chunk - element positioning\n *\n * Handler dependencies (all styles in each handler MUST stay in this chunk):\n * ⚠️ insetStyle: inset, insetBlock, insetInline, top, right, bottom, left\n */\nexport const POSITION_CHUNK_STYLES = [\n 'position',\n // All from insetStyle handler - MUST stay together\n 'inset',\n 'insetBlock',\n 'insetInline',\n 'top',\n 'right',\n 'bottom',\n 'left',\n 'zIndex',\n 'gridArea',\n 'gridColumn',\n 'gridRow',\n 'order',\n 'placeSelf',\n 'alignSelf',\n 'justifySelf',\n 'transform',\n 'transition',\n 'animation',\n] as const;\n\n// ============================================================================\n// Chunk Names\n// ============================================================================\n\nexport const CHUNK_NAMES = {\n /** Special chunk for styles that cannot be split */\n COMBINED: 'combined',\n SUBCOMPONENTS: 'subcomponents',\n APPEARANCE: 'appearance',\n FONT: 'font',\n DIMENSION: 'dimension',\n DISPLAY: 'display',\n LAYOUT: 'layout',\n POSITION: 'position',\n MISC: 'misc',\n} as const;\n\nexport type ChunkName = (typeof CHUNK_NAMES)[keyof typeof CHUNK_NAMES];\n\n// ============================================================================\n// Style-to-Chunk Lookup Map (O(1) categorization)\n// ============================================================================\n\n/**\n * Pre-computed map for O(1) style-to-chunk lookup.\n * Built once at module load time.\n */\nexport const STYLE_TO_CHUNK = new Map<string, ChunkName>();\n\n// Populate the lookup map\nfunction populateStyleToChunkMap() {\n for (const style of APPEARANCE_CHUNK_STYLES) {\n STYLE_TO_CHUNK.set(style, CHUNK_NAMES.APPEARANCE);\n }\n for (const style of FONT_CHUNK_STYLES) {\n STYLE_TO_CHUNK.set(style, CHUNK_NAMES.FONT);\n }\n for (const style of DIMENSION_CHUNK_STYLES) {\n STYLE_TO_CHUNK.set(style, CHUNK_NAMES.DIMENSION);\n }\n for (const style of DISPLAY_CHUNK_STYLES) {\n STYLE_TO_CHUNK.set(style, CHUNK_NAMES.DISPLAY);\n }\n for (const style of LAYOUT_CHUNK_STYLES) {\n STYLE_TO_CHUNK.set(style, CHUNK_NAMES.LAYOUT);\n }\n for (const style of POSITION_CHUNK_STYLES) {\n STYLE_TO_CHUNK.set(style, CHUNK_NAMES.POSITION);\n }\n}\n\n// Initialize at module load\npopulateStyleToChunkMap();\n\n// ============================================================================\n// Chunk Priority Order\n// ============================================================================\n\n/**\n * Chunk processing order. This ensures deterministic className allocation\n * regardless of style key order in the input.\n */\nconst CHUNK_ORDER: readonly string[] = [\n CHUNK_NAMES.APPEARANCE,\n CHUNK_NAMES.FONT,\n CHUNK_NAMES.DIMENSION,\n CHUNK_NAMES.DISPLAY,\n CHUNK_NAMES.LAYOUT,\n CHUNK_NAMES.POSITION,\n CHUNK_NAMES.MISC,\n CHUNK_NAMES.SUBCOMPONENTS,\n] as const;\n\n/**\n * Map from chunk name to its priority index for sorting.\n */\nconst _CHUNK_PRIORITY = new Map<string, number>(\n CHUNK_ORDER.map((name, index) => [name, index]),\n);\n\n// ============================================================================\n// Chunk Info Interface\n// ============================================================================\n\nexport interface ChunkInfo {\n /** Name of the chunk */\n name: ChunkName | string;\n /** Style keys belonging to this chunk */\n styleKeys: string[];\n}\n\n// ============================================================================\n// Style Categorization\n// ============================================================================\n\n/**\n * Categorize style keys into chunks.\n *\n * Returns chunks in a deterministic order (by CHUNK_ORDER) regardless\n * of the order of keys in the input styles object.\n *\n * @param styles - The styles object to categorize\n * @returns Map of chunk name to array of style keys in that chunk (in priority order)\n */\nexport function categorizeStyleKeys(\n styles: Record<string, unknown>,\n): Map<string, string[]> {\n // First pass: collect keys into chunks (unordered)\n const chunkData: Record<string, string[]> = {};\n const keys = Object.keys(styles);\n\n for (const key of keys) {\n // Skip the $ helper key (used for selector combinators)\n // Skip @keyframes and @properties (processed separately in useStyles)\n // Skip recipe (resolved before pipeline by resolveRecipes)\n if (\n key === '$' ||\n key === '@keyframes' ||\n key === '@properties' ||\n key === '@fontFace' ||\n key === '@counterStyle' ||\n key === 'recipe'\n ) {\n continue;\n }\n\n if (isSelector(key)) {\n // All selectors go into the subcomponents chunk\n if (!chunkData[CHUNK_NAMES.SUBCOMPONENTS]) {\n chunkData[CHUNK_NAMES.SUBCOMPONENTS] = [];\n }\n chunkData[CHUNK_NAMES.SUBCOMPONENTS].push(key);\n } else {\n // Look up the chunk for this style, default to misc\n const chunkName = STYLE_TO_CHUNK.get(key) ?? CHUNK_NAMES.MISC;\n if (!chunkData[chunkName]) {\n chunkData[chunkName] = [];\n }\n chunkData[chunkName].push(key);\n }\n }\n\n // Second pass: build ordered Map based on CHUNK_ORDER\n const orderedChunks = new Map<string, string[]>();\n\n // Add chunks in priority order\n for (const chunkName of CHUNK_ORDER) {\n if (chunkData[chunkName] && chunkData[chunkName].length > 0) {\n // Sort keys within chunk for consistent cache key generation\n orderedChunks.set(chunkName, chunkData[chunkName].sort());\n }\n }\n\n // Handle any unknown chunks (shouldn't happen, but be defensive)\n for (const chunkName of Object.keys(chunkData)) {\n if (!orderedChunks.has(chunkName)) {\n orderedChunks.set(chunkName, chunkData[chunkName].sort());\n }\n }\n\n return orderedChunks;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,MAAa,0BAA0B;CACrC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;;;;;AASD,MAAa,oBAAoB;CAE/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACD;;;;;;;;;;AAWD,MAAa,yBAAyB;CAEpC;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;;;;;;;AAWD,MAAa,uBAAuB;CAElC;CACA;CACA;CACA;CACA;CAEA;CAEA;CAEA;CACD;;;;;;;AAQD,MAAa,sBAAsB;CAEjC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;;;;AAQD,MAAa,wBAAwB;CACnC;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAMD,MAAa,cAAc;CAEzB,UAAU;CACV,eAAe;CACf,YAAY;CACZ,MAAM;CACN,WAAW;CACX,SAAS;CACT,QAAQ;CACR,UAAU;CACV,MAAM;CACP;;;;;AAYD,MAAa,iCAAiB,IAAI,KAAwB;AAG1D,SAAS,0BAA0B;AACjC,MAAK,MAAM,SAAS,wBAClB,gBAAe,IAAI,OAAO,YAAY,WAAW;AAEnD,MAAK,MAAM,SAAS,kBAClB,gBAAe,IAAI,OAAO,YAAY,KAAK;AAE7C,MAAK,MAAM,SAAS,uBAClB,gBAAe,IAAI,OAAO,YAAY,UAAU;AAElD,MAAK,MAAM,SAAS,qBAClB,gBAAe,IAAI,OAAO,YAAY,QAAQ;AAEhD,MAAK,MAAM,SAAS,oBAClB,gBAAe,IAAI,OAAO,YAAY,OAAO;AAE/C,MAAK,MAAM,SAAS,sBAClB,gBAAe,IAAI,OAAO,YAAY,SAAS;;AAKnD,yBAAyB;;;;;AAUzB,MAAM,cAAiC;CACrC,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACb;AAKuB,IAAI,IAC1B,YAAY,KAAK,MAAM,UAAU,CAAC,MAAM,MAAM,CAAC,CAChD;;;;;;;;;;AA0BD,SAAgB,oBACd,QACuB;CAEvB,MAAM,YAAsC,EAAE;CAC9C,MAAM,OAAO,OAAO,KAAK,OAAO;AAEhC,MAAK,MAAM,OAAO,MAAM;AAItB,MACE,QAAQ,OACR,QAAQ,gBACR,QAAQ,iBACR,QAAQ,eACR,QAAQ,mBACR,QAAQ,SAER;AAGF,MAAI,WAAW,IAAI,EAAE;AAEnB,OAAI,CAAC,UAAU,YAAY,eACzB,WAAU,YAAY,iBAAiB,EAAE;AAE3C,aAAU,YAAY,eAAe,KAAK,IAAI;SACzC;GAEL,MAAM,YAAY,eAAe,IAAI,IAAI,IAAI,YAAY;AACzD,OAAI,CAAC,UAAU,WACb,WAAU,aAAa,EAAE;AAE3B,aAAU,WAAW,KAAK,IAAI;;;CAKlC,MAAM,gCAAgB,IAAI,KAAuB;AAGjD,MAAK,MAAM,aAAa,YACtB,KAAI,UAAU,cAAc,UAAU,WAAW,SAAS,EAExD,eAAc,IAAI,WAAW,UAAU,WAAW,MAAM,CAAC;AAK7D,MAAK,MAAM,aAAa,OAAO,KAAK,UAAU,CAC5C,KAAI,CAAC,cAAc,IAAI,UAAU,CAC/B,eAAc,IAAI,WAAW,UAAU,WAAW,MAAM,CAAC;AAI7D,QAAO"}
@@ -1 +0,0 @@
1
- import { CHUNK_NAMES, ChunkInfo, ChunkName, STYLE_TO_CHUNK, categorizeStyleKeys } from "./definitions.js";
@@ -1 +0,0 @@
1
- export { };