@tenphi/tasty 0.0.0-snapshot.b3fbcbb → 0.0.0-snapshot.b3fc70b

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 (313) hide show
  1. package/README.md +372 -233
  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-DL7Q0O2U.d.ts +83 -0
  5. package/dist/collector-DBFlaFHJ.d.ts +145 -0
  6. package/dist/collector-DOlu2dYR.js +304 -0
  7. package/dist/collector-DOlu2dYR.js.map +1 -0
  8. package/dist/config-DabydZVP.js +12380 -0
  9. package/dist/config-DabydZVP.js.map +1 -0
  10. package/dist/config-Dy7mrJRI.d.ts +1335 -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-J67jVh8p.js +1648 -0
  16. package/dist/core-J67jVh8p.js.map +1 -0
  17. package/dist/{zero/extractor.js → css-writer-Bc_r5yM9.js} +188 -13
  18. package/dist/css-writer-Bc_r5yM9.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-zO4YxFIy.js +130 -0
  22. package/dist/format-rules-zO4YxFIy.js.map +1 -0
  23. package/dist/hydrate-c3-p2Ma3.js +37 -0
  24. package/dist/hydrate-c3-p2Ma3.js.map +1 -0
  25. package/dist/index-Cgk4gQ6X.d.ts +1958 -0
  26. package/dist/index-Fqlx0GUY.d.ts +1541 -0
  27. package/dist/index.d.ts +5 -48
  28. package/dist/index.js +954 -32
  29. package/dist/index.js.map +1 -0
  30. package/dist/keyframes-Dzrxy46O.js +493 -0
  31. package/dist/keyframes-Dzrxy46O.js.map +1 -0
  32. package/dist/{utils/merge-styles.js → merge-styles-DmAa79gn.js} +4 -6
  33. package/dist/merge-styles-DmAa79gn.js.map +1 -0
  34. package/dist/{utils/merge-styles.d.ts → merge-styles-kJuFR7kV.d.ts} +3 -3
  35. package/dist/{utils/resolve-recipes.js → resolve-recipes-CdFJEWNQ.js} +5 -8
  36. package/dist/resolve-recipes-CdFJEWNQ.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 -113
  62. package/dist/zero/babel.js +232 -42
  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 +620 -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 +105 -45
  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 -288
  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 -426
  124. package/dist/injector/injector.js.map +0 -1
  125. package/dist/injector/sheet-manager.d.ts +0 -135
  126. package/dist/injector/sheet-manager.js +0 -728
  127. package/dist/injector/sheet-manager.js.map +0 -1
  128. package/dist/injector/types.d.ts +0 -144
  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 -406
  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 -660
  152. package/dist/pipeline/index.js.map +0 -1
  153. package/dist/pipeline/materialize.js +0 -844
  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 -438
  157. package/dist/pipeline/parseStateKey.js.map +0 -1
  158. package/dist/pipeline/simplify.js +0 -516
  159. package/dist/pipeline/simplify.js.map +0 -1
  160. package/dist/pipeline/warnings.js +0 -18
  161. package/dist/pipeline/warnings.js.map +0 -1
  162. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  163. package/dist/plugins/okhsl-plugin.js +0 -371
  164. package/dist/plugins/okhsl-plugin.js.map +0 -1
  165. package/dist/plugins/types.d.ts +0 -69
  166. package/dist/properties/index.js +0 -237
  167. package/dist/properties/index.js.map +0 -1
  168. package/dist/properties/property-type-resolver.d.ts +0 -24
  169. package/dist/properties/property-type-resolver.js +0 -79
  170. package/dist/properties/property-type-resolver.js.map +0 -1
  171. package/dist/states/index.d.ts +0 -49
  172. package/dist/states/index.js +0 -416
  173. package/dist/states/index.js.map +0 -1
  174. package/dist/static/tastyStatic.d.ts +0 -46
  175. package/dist/static/tastyStatic.js +0 -31
  176. package/dist/static/tastyStatic.js.map +0 -1
  177. package/dist/static/types.d.ts +0 -49
  178. package/dist/static/types.js +0 -24
  179. package/dist/static/types.js.map +0 -1
  180. package/dist/styles/align.d.ts +0 -15
  181. package/dist/styles/align.js +0 -14
  182. package/dist/styles/align.js.map +0 -1
  183. package/dist/styles/border.d.ts +0 -25
  184. package/dist/styles/border.js +0 -114
  185. package/dist/styles/border.js.map +0 -1
  186. package/dist/styles/color.d.ts +0 -14
  187. package/dist/styles/color.js +0 -23
  188. package/dist/styles/color.js.map +0 -1
  189. package/dist/styles/createStyle.js +0 -77
  190. package/dist/styles/createStyle.js.map +0 -1
  191. package/dist/styles/dimension.js +0 -97
  192. package/dist/styles/dimension.js.map +0 -1
  193. package/dist/styles/display.d.ts +0 -37
  194. package/dist/styles/display.js +0 -67
  195. package/dist/styles/display.js.map +0 -1
  196. package/dist/styles/fade.d.ts +0 -15
  197. package/dist/styles/fade.js +0 -58
  198. package/dist/styles/fade.js.map +0 -1
  199. package/dist/styles/fill.d.ts +0 -42
  200. package/dist/styles/fill.js +0 -52
  201. package/dist/styles/fill.js.map +0 -1
  202. package/dist/styles/flow.d.ts +0 -16
  203. package/dist/styles/flow.js +0 -12
  204. package/dist/styles/flow.js.map +0 -1
  205. package/dist/styles/gap.d.ts +0 -31
  206. package/dist/styles/gap.js +0 -37
  207. package/dist/styles/gap.js.map +0 -1
  208. package/dist/styles/height.d.ts +0 -17
  209. package/dist/styles/height.js +0 -20
  210. package/dist/styles/height.js.map +0 -1
  211. package/dist/styles/index.d.ts +0 -2
  212. package/dist/styles/index.js +0 -9
  213. package/dist/styles/index.js.map +0 -1
  214. package/dist/styles/inset.d.ts +0 -52
  215. package/dist/styles/inset.js +0 -150
  216. package/dist/styles/inset.js.map +0 -1
  217. package/dist/styles/justify.d.ts +0 -15
  218. package/dist/styles/justify.js +0 -14
  219. package/dist/styles/justify.js.map +0 -1
  220. package/dist/styles/list.d.ts +0 -16
  221. package/dist/styles/list.js +0 -98
  222. package/dist/styles/list.js.map +0 -1
  223. package/dist/styles/margin.d.ts +0 -24
  224. package/dist/styles/margin.js +0 -104
  225. package/dist/styles/margin.js.map +0 -1
  226. package/dist/styles/outline.d.ts +0 -29
  227. package/dist/styles/outline.js +0 -65
  228. package/dist/styles/outline.js.map +0 -1
  229. package/dist/styles/padding.d.ts +0 -24
  230. package/dist/styles/padding.js +0 -104
  231. package/dist/styles/padding.js.map +0 -1
  232. package/dist/styles/predefined.d.ts +0 -73
  233. package/dist/styles/predefined.js +0 -241
  234. package/dist/styles/predefined.js.map +0 -1
  235. package/dist/styles/preset.d.ts +0 -47
  236. package/dist/styles/preset.js +0 -126
  237. package/dist/styles/preset.js.map +0 -1
  238. package/dist/styles/radius.d.ts +0 -14
  239. package/dist/styles/radius.js +0 -51
  240. package/dist/styles/radius.js.map +0 -1
  241. package/dist/styles/scrollbar.d.ts +0 -21
  242. package/dist/styles/scrollbar.js +0 -112
  243. package/dist/styles/scrollbar.js.map +0 -1
  244. package/dist/styles/shadow.d.ts +0 -14
  245. package/dist/styles/shadow.js +0 -24
  246. package/dist/styles/shadow.js.map +0 -1
  247. package/dist/styles/styledScrollbar.d.ts +0 -47
  248. package/dist/styles/styledScrollbar.js +0 -38
  249. package/dist/styles/styledScrollbar.js.map +0 -1
  250. package/dist/styles/transition.d.ts +0 -14
  251. package/dist/styles/transition.js +0 -158
  252. package/dist/styles/transition.js.map +0 -1
  253. package/dist/styles/types.d.ts +0 -498
  254. package/dist/styles/width.d.ts +0 -17
  255. package/dist/styles/width.js +0 -20
  256. package/dist/styles/width.js.map +0 -1
  257. package/dist/tasty.d.ts +0 -982
  258. package/dist/tasty.js +0 -206
  259. package/dist/tasty.js.map +0 -1
  260. package/dist/tokens/typography.d.ts +0 -19
  261. package/dist/tokens/typography.js +0 -237
  262. package/dist/tokens/typography.js.map +0 -1
  263. package/dist/types.d.ts +0 -184
  264. package/dist/utils/cache-wrapper.js +0 -26
  265. package/dist/utils/cache-wrapper.js.map +0 -1
  266. package/dist/utils/case-converter.js +0 -8
  267. package/dist/utils/case-converter.js.map +0 -1
  268. package/dist/utils/colors.d.ts +0 -5
  269. package/dist/utils/colors.js +0 -9
  270. package/dist/utils/colors.js.map +0 -1
  271. package/dist/utils/css-types.d.ts +0 -7
  272. package/dist/utils/dotize.d.ts +0 -26
  273. package/dist/utils/dotize.js +0 -122
  274. package/dist/utils/dotize.js.map +0 -1
  275. package/dist/utils/filter-base-props.d.ts +0 -15
  276. package/dist/utils/filter-base-props.js +0 -45
  277. package/dist/utils/filter-base-props.js.map +0 -1
  278. package/dist/utils/get-display-name.d.ts +0 -7
  279. package/dist/utils/get-display-name.js +0 -10
  280. package/dist/utils/get-display-name.js.map +0 -1
  281. package/dist/utils/hsl-to-rgb.js +0 -38
  282. package/dist/utils/hsl-to-rgb.js.map +0 -1
  283. package/dist/utils/is-dev-env.js +0 -19
  284. package/dist/utils/is-dev-env.js.map +0 -1
  285. package/dist/utils/is-valid-element-type.js +0 -15
  286. package/dist/utils/is-valid-element-type.js.map +0 -1
  287. package/dist/utils/merge-styles.js.map +0 -1
  288. package/dist/utils/mod-attrs.d.ts +0 -8
  289. package/dist/utils/mod-attrs.js +0 -21
  290. package/dist/utils/mod-attrs.js.map +0 -1
  291. package/dist/utils/okhsl-to-rgb.js +0 -296
  292. package/dist/utils/okhsl-to-rgb.js.map +0 -1
  293. package/dist/utils/process-tokens.d.ts +0 -31
  294. package/dist/utils/process-tokens.js +0 -171
  295. package/dist/utils/process-tokens.js.map +0 -1
  296. package/dist/utils/resolve-recipes.d.ts +0 -17
  297. package/dist/utils/resolve-recipes.js.map +0 -1
  298. package/dist/utils/string.js +0 -8
  299. package/dist/utils/string.js.map +0 -1
  300. package/dist/utils/styles.d.ts +0 -178
  301. package/dist/utils/styles.js +0 -751
  302. package/dist/utils/styles.js.map +0 -1
  303. package/dist/utils/typography.d.ts +0 -36
  304. package/dist/utils/typography.js +0 -53
  305. package/dist/utils/typography.js.map +0 -1
  306. package/dist/utils/warnings.d.ts +0 -16
  307. package/dist/utils/warnings.js +0 -16
  308. package/dist/utils/warnings.js.map +0 -1
  309. package/dist/zero/css-writer.d.ts +0 -45
  310. package/dist/zero/css-writer.js +0 -74
  311. package/dist/zero/css-writer.js.map +0 -1
  312. package/dist/zero/extractor.d.ts +0 -24
  313. package/dist/zero/extractor.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenphi/tasty",
3
- "version": "0.0.0-snapshot.b3fbcbb",
3
+ "version": "0.0.0-snapshot.b3fc70b",
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",
@@ -8,54 +8,94 @@
8
8
  "types": "./dist/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
- "import": {
12
- "types": "./dist/index.d.ts",
13
- "default": "./dist/index.js"
14
- }
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "default": "./dist/index.js"
15
14
  },
16
15
  "./static": {
17
- "import": {
18
- "types": "./dist/static/index.d.ts",
19
- "default": "./dist/static/index.js"
20
- }
16
+ "types": "./dist/static/index.d.ts",
17
+ "import": "./dist/static/index.js",
18
+ "default": "./dist/static/index.js"
19
+ },
20
+ "./static/inject": {
21
+ "types": "./dist/static/inject.d.ts",
22
+ "import": "./dist/static/inject.js",
23
+ "default": "./dist/static/inject.js"
21
24
  },
22
25
  "./babel-plugin": {
23
- "import": {
24
- "types": "./dist/zero/babel.d.ts",
25
- "default": "./dist/zero/babel.js"
26
- }
26
+ "types": "./dist/zero/babel.d.ts",
27
+ "import": "./dist/zero/babel.js",
28
+ "default": "./dist/zero/babel.js"
27
29
  },
28
30
  "./zero": {
29
- "import": {
30
- "types": "./dist/zero/index.d.ts",
31
- "default": "./dist/zero/index.js"
32
- }
31
+ "types": "./dist/zero/index.d.ts",
32
+ "import": "./dist/zero/index.js",
33
+ "default": "./dist/zero/index.js"
33
34
  },
34
- "./next": {
35
- "import": {
36
- "types": "./dist/zero/next.d.ts",
37
- "default": "./dist/zero/next.js"
38
- }
35
+ "./zero/next": {
36
+ "types": "./dist/zero/next.d.ts",
37
+ "import": "./dist/zero/next.js",
38
+ "default": "./dist/zero/next.js"
39
39
  },
40
40
  "./core": {
41
- "import": {
42
- "types": "./dist/core/index.d.ts",
43
- "default": "./dist/core/index.js"
44
- }
41
+ "types": "./dist/core/index.d.ts",
42
+ "import": "./dist/core/index.js",
43
+ "default": "./dist/core/index.js"
44
+ },
45
+ "./ssr": {
46
+ "types": "./dist/ssr/index.d.ts",
47
+ "import": "./dist/ssr/index.js",
48
+ "default": "./dist/ssr/index.js"
49
+ },
50
+ "./ssr/next": {
51
+ "types": "./dist/ssr/next.d.ts",
52
+ "import": "./dist/ssr/next.js",
53
+ "default": "./dist/ssr/next.js"
54
+ },
55
+ "./ssr/astro": {
56
+ "types": "./dist/ssr/astro.d.ts",
57
+ "import": "./dist/ssr/astro.js",
58
+ "default": "./dist/ssr/astro.js"
59
+ },
60
+ "./ssr/astro-client": {
61
+ "types": "./dist/ssr/astro-client.d.ts",
62
+ "import": "./dist/ssr/astro-client.js",
63
+ "default": "./dist/ssr/astro-client.js"
64
+ },
65
+ "./ssr/astro-middleware": {
66
+ "types": "./dist/ssr/astro-middleware.d.ts",
67
+ "import": "./dist/ssr/astro-middleware.js",
68
+ "default": "./dist/ssr/astro-middleware.js"
69
+ },
70
+ "./ssr/astro-middleware-static": {
71
+ "types": "./dist/ssr/astro-middleware-static.d.ts",
72
+ "import": "./dist/ssr/astro-middleware-static.js",
73
+ "default": "./dist/ssr/astro-middleware-static.js"
45
74
  },
46
75
  "./tasty.config": "./tasty.config.ts"
47
76
  },
48
77
  "files": [
49
78
  "dist",
79
+ "docs",
50
80
  "tasty.config.ts"
51
81
  ],
52
- "sideEffects": false,
82
+ "sideEffects": [
83
+ "./dist/ssr/index.js",
84
+ "./dist/ssr/next.js",
85
+ "./dist/ssr/astro.js",
86
+ "./dist/ssr/astro-client.js",
87
+ "./dist/ssr/astro-middleware.js",
88
+ "./dist/ssr/astro-middleware-static.js"
89
+ ],
53
90
  "engines": {
54
91
  "node": ">=20"
55
92
  },
56
93
  "scripts": {
57
94
  "build": "tsdown",
58
95
  "test": "vitest run",
96
+ "test:node": "vitest run --project node",
97
+ "test:browser": "vitest run --project browser",
98
+ "test:setup": "playwright install chromium",
59
99
  "test:watch": "vitest",
60
100
  "test:coverage": "vitest run --coverage",
61
101
  "typecheck": "tsc --noEmit",
@@ -64,10 +104,19 @@
64
104
  "format": "prettier --write \"src/**/*.{ts,tsx}\"",
65
105
  "format:check": "prettier --check \"src/**/*.{ts,tsx}\"",
66
106
  "size": "size-limit",
107
+ "bench": "vitest bench --project node",
108
+ "bench:browser": "vitest bench --project browser",
109
+ "bench:overhead": "vitest bench --config vitest.production-browser-bench.config.ts src/tasty-overhead.bench.tsx",
110
+ "bench:injection": "vitest bench --config vitest.production-browser-bench.config.ts src/tasty-injection.bench.ts",
111
+ "bench:tree": "vitest bench --config vitest.production-browser-bench.config.ts src/tasty-tree.bench.tsx",
67
112
  "prepublishOnly": "pnpm run build",
68
113
  "changeset": "changeset",
69
114
  "version": "changeset version",
70
- "release": "changeset publish"
115
+ "release": "changeset publish",
116
+ "knip": "knip",
117
+ "check:test-only": "node scripts/check-test-only-code.mjs",
118
+ "hygiene": "pnpm lint && pnpm format:check && pnpm typecheck",
119
+ "hygiene:fix": "pnpm lint:fix && pnpm format && pnpm typecheck"
71
120
  },
72
121
  "repository": {
73
122
  "type": "git",
@@ -94,6 +143,8 @@
94
143
  "@babel/core": "^7.24.0",
95
144
  "@babel/helper-plugin-utils": "^7.24.0",
96
145
  "@babel/types": "^7.24.0",
146
+ "jiti": "^2.6.1",
147
+ "next": ">=14.0.0",
97
148
  "react": "^18.0.0 || ^19.0.0"
98
149
  },
99
150
  "peerDependenciesMeta": {
@@ -108,6 +159,12 @@
108
159
  },
109
160
  "react": {
110
161
  "optional": true
162
+ },
163
+ "jiti": {
164
+ "optional": true
165
+ },
166
+ "next": {
167
+ "optional": true
111
168
  }
112
169
  },
113
170
  "dependencies": {
@@ -115,53 +172,56 @@
115
172
  },
116
173
  "devDependencies": {
117
174
  "@babel/core": "^7.24.0",
118
- "@changesets/changelog-github": "^0.5.2",
175
+ "@babel/helper-plugin-utils": "^7.24.0",
176
+ "@babel/types": "^7.24.0",
177
+ "@changesets/changelog-github": "^0.7.0",
119
178
  "@changesets/cli": "^2.29.8",
120
179
  "@eslint/js": "^10.0.1",
121
180
  "@size-limit/esbuild": "^12.0.0",
122
181
  "@size-limit/file": "^12.0.0",
182
+ "@tenphi/eslint-plugin-tasty": "^0.11.3",
123
183
  "@testing-library/jest-dom": "^6.9.1",
124
184
  "@testing-library/react": "^16.3.2",
125
185
  "@types/babel__core": "^7.20.5",
126
186
  "@types/babel__helper-plugin-utils": "^7.10.3",
127
187
  "@types/node": "^25.3.2",
128
188
  "@types/react": "^19.0.0",
129
- "@vitest/runner": "^4.0.18",
189
+ "@types/react-dom": "^19.0.0",
190
+ "@vitest/browser-playwright": "^4.1.10",
130
191
  "eslint": "^10.0.0",
131
192
  "eslint-config-prettier": "^10.1.8",
132
- "jsdom": "^28.1.0",
193
+ "jiti": "^2.6.1",
194
+ "knip": "^5.61.3",
195
+ "next": "^16.0.0",
196
+ "playwright": "^1.62.1",
133
197
  "prettier": "^3.8.1",
134
198
  "react": "^19.0.0",
199
+ "react-dom": "^19.0.0",
135
200
  "size-limit": "^12.0.0",
136
- "tsdown": "^0.20.3",
137
- "typescript": "^5.9.3",
201
+ "tsdown": "^0.22.0",
202
+ "typescript": "^6.0.2",
138
203
  "typescript-eslint": "^8.56.0",
139
- "vitest": "^4.0.18"
140
- },
141
- "pnpm": {
142
- "onlyBuiltDependencies": [
143
- "esbuild"
144
- ]
204
+ "vitest": "^4.1.10"
145
205
  },
146
- "packageManager": "pnpm@10.29.3",
206
+ "packageManager": "pnpm@11.24.0",
147
207
  "size-limit": [
148
208
  {
149
209
  "name": "main (import *)",
150
210
  "path": "dist/index.js",
151
211
  "import": "*",
152
- "limit": "47 kB"
212
+ "limit": "56.9 kB"
153
213
  },
154
214
  {
155
215
  "name": "core (import *)",
156
216
  "path": "dist/core/index.js",
157
217
  "import": "*",
158
- "limit": "45 kB"
218
+ "limit": "53.65 kB"
159
219
  },
160
220
  {
161
221
  "name": "static",
162
222
  "path": "dist/static/index.js",
163
223
  "import": "*",
164
- "limit": "2 kB"
224
+ "limit": "16.8 kB"
165
225
  },
166
226
  {
167
227
  "name": "zero",
@@ -172,7 +232,7 @@
172
232
  "path",
173
233
  "crypto"
174
234
  ],
175
- "limit": "27 kB"
235
+ "limit": "31.25 kB"
176
236
  },
177
237
  {
178
238
  "name": "babel-plugin",
@@ -183,7 +243,7 @@
183
243
  "path",
184
244
  "crypto"
185
245
  ],
186
- "limit": "37 kB"
246
+ "limit": "49.35 kB"
187
247
  }
188
248
  ]
189
249
  }
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,8 +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
-
7
- //#endregion
8
- export { __require };
@@ -1,70 +0,0 @@
1
- import { extractLocalPredefinedStates, extractPredefinedStateRefs } from "../states/index.js";
2
-
3
- //#region src/chunks/cacheKey.ts
4
- /**
5
- * Chunk-specific cache key generation.
6
- *
7
- * Generates cache keys that only include styles relevant to a specific chunk,
8
- * enabling more granular caching and reuse.
9
- *
10
- * Enhanced to support predefined states:
11
- * - Global predefined states don't affect cache keys (constant across app)
12
- * - Local predefined states only affect cache keys if referenced in the chunk
13
- */
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
- */
18
- function stableStringify(value) {
19
- if (value === null) return "null";
20
- if (value === void 0) return "undefined";
21
- if (typeof value !== "object") return JSON.stringify(value);
22
- if (Array.isArray(value)) return "[" + value.map(stableStringify).join(",") + "]";
23
- const obj = value;
24
- const sortedKeys = Object.keys(obj).sort();
25
- const parts = [];
26
- for (const key of sortedKeys) if (obj[key] !== void 0) parts.push(`${JSON.stringify(key)}:${stableStringify(obj[key])}`);
27
- return "{" + parts.join(",") + "}";
28
- }
29
- /**
30
- * Generate a cache key for a specific chunk.
31
- *
32
- * Only includes the styles that belong to this chunk, allowing
33
- * chunks to be cached independently.
34
- *
35
- * Also includes relevant local predefined states that are referenced
36
- * by this chunk's styles.
37
- *
38
- * @param styles - The full styles object
39
- * @param chunkName - Name of the chunk
40
- * @param styleKeys - Keys of styles belonging to this chunk
41
- * @returns A stable cache key string
42
- */
43
- function generateChunkCacheKey(styles, chunkName, styleKeys) {
44
- const parts = [chunkName];
45
- const sortedKeys = styleKeys.slice().sort();
46
- let chunkStylesStr = "";
47
- for (const key of sortedKeys) {
48
- const value = styles[key];
49
- if (value !== void 0) {
50
- const serialized = stableStringify(value);
51
- parts.push(`${key}:${serialized}`);
52
- chunkStylesStr += serialized;
53
- }
54
- }
55
- const localStates = extractLocalPredefinedStates(styles);
56
- if (Object.keys(localStates).length > 0) {
57
- const referencedStates = extractPredefinedStateRefs(chunkStylesStr);
58
- const relevantLocalStates = [];
59
- for (const stateName of referencedStates) if (localStates[stateName]) relevantLocalStates.push(`${stateName}=${localStates[stateName]}`);
60
- if (relevantLocalStates.length > 0) {
61
- relevantLocalStates.sort();
62
- parts.unshift(`[states:${relevantLocalStates.join("|")}]`);
63
- }
64
- }
65
- return parts.join("\0");
66
- }
67
-
68
- //#endregion
69
- export { generateChunkCacheKey };
70
- //# 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\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 */\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 if (Array.isArray(value)) {\n return '[' + value.map(stableStringify).join(',') + ']';\n }\n // Object: sort keys for stable order\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 return '{' + parts.join(',') + '}';\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 // Sort keys for stable ordering\n const sortedKeys = styleKeys.slice().sort();\n\n // Build the chunk-specific styles string for predefined state detection\n let chunkStylesStr = '';\n\n for (const key of sortedKeys) {\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":";;;;;;;;;;;;;;;;;AAqBA,SAAS,gBAAgB,OAAwB;AAC/C,KAAI,UAAU,KACZ,QAAO;AAET,KAAI,UAAU,OACZ,QAAO;AAET,KAAI,OAAO,UAAU,SACnB,QAAO,KAAK,UAAU,MAAM;AAE9B,KAAI,MAAM,QAAQ,MAAM,CACtB,QAAO,MAAM,MAAM,IAAI,gBAAgB,CAAC,KAAK,IAAI,GAAG;CAGtD,MAAM,MAAM;CACZ,MAAM,aAAa,OAAO,KAAK,IAAI,CAAC,MAAM;CAC1C,MAAM,QAAkB,EAAE;AAC1B,MAAK,MAAM,OAAO,WAChB,KAAI,IAAI,SAAS,OACf,OAAM,KAAK,GAAG,KAAK,UAAU,IAAI,CAAC,GAAG,gBAAgB,IAAI,KAAK,GAAG;AAGrE,QAAO,MAAM,MAAM,KAAK,IAAI,GAAG;;;;;;;;;;;;;;;;AAiBjC,SAAgB,sBACd,QACA,WACA,WACQ;CAER,MAAM,QAAkB,CAAC,UAAU;CAGnC,MAAM,aAAa,UAAU,OAAO,CAAC,MAAM;CAG3C,IAAI,iBAAiB;AAErB,MAAK,MAAM,OAAO,YAAY;EAC5B,MAAM,QAAQ,OAAO;AACrB,MAAI,UAAU,QAAW;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 (e.g., @starting-style) */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,260 +0,0 @@
1
- import { isSelector } from "../pipeline/index.js";
2
-
3
- //#region src/chunks/definitions.ts
4
- /**
5
- * Style chunk definitions for CSS chunking optimization.
6
- *
7
- * Styles are grouped into chunks based on:
8
- * 1. Handler dependencies - styles that share a handler MUST be in the same chunk
9
- * 2. Logical grouping - related styles grouped for better cache reuse
10
- *
11
- * See STYLE_CHUNKING_SPEC.md for detailed rationale.
12
- *
13
- * ============================================================================
14
- * ⚠️ CRITICAL ARCHITECTURAL CONSTRAINT: NO CROSS-CHUNK HANDLER DEPENDENCIES
15
- * ============================================================================
16
- *
17
- * Style handlers declare their dependencies via `__lookupStyles` array.
18
- * This creates a dependency graph where handlers read multiple style props.
19
- *
20
- * **ALL styles in a handler's `__lookupStyles` MUST be in the SAME chunk.**
21
- *
22
- * Why this matters:
23
- * 1. Each chunk computes a cache key from ONLY its own style values
24
- * 2. If a handler reads a style from another chunk, that value isn't in the cache key
25
- * 3. Changing the cross-chunk style won't invalidate this chunk's cache
26
- * 4. Result: stale CSS output or incorrect cache hits
27
- *
28
- * Example of a violation:
29
- * ```
30
- * // flowStyle.__lookupStyles = ['display', 'flow']
31
- * // If 'display' is in DISPLAY chunk and 'flow' is in LAYOUT chunk:
32
- * // - User sets { display: 'grid', flow: 'column' }
33
- * // - LAYOUT chunk caches CSS with flow=column, display=grid
34
- * // - User changes to { display: 'flex', flow: 'column' }
35
- * // - LAYOUT chunk cache key unchanged (only has 'flow')
36
- * // - Returns stale CSS computed with display=grid!
37
- * ```
38
- *
39
- * Before adding/moving styles, verify:
40
- * 1. Find all handlers that use this style (grep for the style name in __lookupStyles)
41
- * 2. Ensure ALL styles from each handler's __lookupStyles are in the same chunk
42
- * ============================================================================
43
- */
44
- /**
45
- * Appearance chunk - visual styling with independent handlers
46
- */
47
- const APPEARANCE_CHUNK_STYLES = [
48
- "fill",
49
- "color",
50
- "opacity",
51
- "border",
52
- "radius",
53
- "outline",
54
- "outlineOffset",
55
- "shadow",
56
- "fade"
57
- ];
58
- /**
59
- * Font chunk - typography styles
60
- *
61
- * Handler dependencies (all styles in each handler MUST stay in this chunk):
62
- * ⚠️ presetStyle: preset, fontSize, lineHeight, letterSpacing, textTransform,
63
- * fontWeight, fontStyle, font
64
- */
65
- const FONT_CHUNK_STYLES = [
66
- "preset",
67
- "font",
68
- "fontWeight",
69
- "fontStyle",
70
- "fontSize",
71
- "lineHeight",
72
- "letterSpacing",
73
- "textTransform",
74
- "fontFamily",
75
- "textAlign",
76
- "textDecoration",
77
- "wordBreak",
78
- "wordWrap",
79
- "boldFontWeight"
80
- ];
81
- /**
82
- * Dimension chunk - sizing and spacing
83
- *
84
- * Handler dependencies (all styles in each handler MUST stay in this chunk):
85
- * ⚠️ paddingStyle: padding, paddingTop/Right/Bottom/Left, paddingBlock/Inline
86
- * ⚠️ marginStyle: margin, marginTop/Right/Bottom/Left, marginBlock/Inline
87
- * ⚠️ widthStyle: width, minWidth, maxWidth
88
- * ⚠️ heightStyle: height, minHeight, maxHeight
89
- */
90
- const DIMENSION_CHUNK_STYLES = [
91
- "padding",
92
- "paddingTop",
93
- "paddingRight",
94
- "paddingBottom",
95
- "paddingLeft",
96
- "paddingBlock",
97
- "paddingInline",
98
- "margin",
99
- "marginTop",
100
- "marginRight",
101
- "marginBottom",
102
- "marginLeft",
103
- "marginBlock",
104
- "marginInline",
105
- "width",
106
- "minWidth",
107
- "maxWidth",
108
- "height",
109
- "minHeight",
110
- "maxHeight",
111
- "flexBasis",
112
- "flexGrow",
113
- "flexShrink",
114
- "flex"
115
- ];
116
- /**
117
- * Display chunk - display mode, layout flow, text overflow, and scrollbar
118
- *
119
- * Handler dependencies (all styles in each handler MUST stay in this chunk):
120
- * ⚠️ displayStyle: display, hide, textOverflow, overflow, whiteSpace
121
- * ⚠️ flowStyle: display, flow
122
- * ⚠️ gapStyle: display, flow, gap
123
- * ⚠️ scrollbarStyle: scrollbar, overflow
124
- */
125
- const DISPLAY_CHUNK_STYLES = [
126
- "display",
127
- "hide",
128
- "textOverflow",
129
- "overflow",
130
- "whiteSpace",
131
- "flow",
132
- "gap",
133
- "scrollbar",
134
- "styledScrollbar"
135
- ];
136
- /**
137
- * Layout chunk - flex/grid alignment and grid templates
138
- *
139
- * Note: flow and gap are in DISPLAY chunk due to handler dependencies
140
- * (flowStyle and gapStyle both require 'display' prop).
141
- */
142
- const LAYOUT_CHUNK_STYLES = [
143
- "placeItems",
144
- "placeContent",
145
- "alignItems",
146
- "alignContent",
147
- "justifyItems",
148
- "justifyContent",
149
- "align",
150
- "justify",
151
- "place",
152
- "columnGap",
153
- "rowGap",
154
- "gridColumns",
155
- "gridRows",
156
- "gridTemplate",
157
- "gridAreas",
158
- "gridAutoFlow",
159
- "gridAutoColumns",
160
- "gridAutoRows"
161
- ];
162
- /**
163
- * Position chunk - element positioning
164
- *
165
- * Handler dependencies (all styles in each handler MUST stay in this chunk):
166
- * ⚠️ insetStyle: inset, insetBlock, insetInline, top, right, bottom, left
167
- */
168
- const POSITION_CHUNK_STYLES = [
169
- "position",
170
- "inset",
171
- "insetBlock",
172
- "insetInline",
173
- "top",
174
- "right",
175
- "bottom",
176
- "left",
177
- "zIndex",
178
- "gridArea",
179
- "gridColumn",
180
- "gridRow",
181
- "order",
182
- "placeSelf",
183
- "alignSelf",
184
- "justifySelf",
185
- "transform",
186
- "transition",
187
- "animation"
188
- ];
189
- const CHUNK_NAMES = {
190
- COMBINED: "combined",
191
- SUBCOMPONENTS: "subcomponents",
192
- APPEARANCE: "appearance",
193
- FONT: "font",
194
- DIMENSION: "dimension",
195
- DISPLAY: "display",
196
- LAYOUT: "layout",
197
- POSITION: "position",
198
- MISC: "misc"
199
- };
200
- /**
201
- * Pre-computed map for O(1) style-to-chunk lookup.
202
- * Built once at module load time.
203
- */
204
- const STYLE_TO_CHUNK = /* @__PURE__ */ new Map();
205
- function populateStyleToChunkMap() {
206
- for (const style of APPEARANCE_CHUNK_STYLES) STYLE_TO_CHUNK.set(style, CHUNK_NAMES.APPEARANCE);
207
- for (const style of FONT_CHUNK_STYLES) STYLE_TO_CHUNK.set(style, CHUNK_NAMES.FONT);
208
- for (const style of DIMENSION_CHUNK_STYLES) STYLE_TO_CHUNK.set(style, CHUNK_NAMES.DIMENSION);
209
- for (const style of DISPLAY_CHUNK_STYLES) STYLE_TO_CHUNK.set(style, CHUNK_NAMES.DISPLAY);
210
- for (const style of LAYOUT_CHUNK_STYLES) STYLE_TO_CHUNK.set(style, CHUNK_NAMES.LAYOUT);
211
- for (const style of POSITION_CHUNK_STYLES) STYLE_TO_CHUNK.set(style, CHUNK_NAMES.POSITION);
212
- }
213
- populateStyleToChunkMap();
214
- /**
215
- * Chunk processing order. This ensures deterministic className allocation
216
- * regardless of style key order in the input.
217
- */
218
- const CHUNK_ORDER = [
219
- CHUNK_NAMES.APPEARANCE,
220
- CHUNK_NAMES.FONT,
221
- CHUNK_NAMES.DIMENSION,
222
- CHUNK_NAMES.DISPLAY,
223
- CHUNK_NAMES.LAYOUT,
224
- CHUNK_NAMES.POSITION,
225
- CHUNK_NAMES.MISC,
226
- CHUNK_NAMES.SUBCOMPONENTS
227
- ];
228
- new Map(CHUNK_ORDER.map((name, index) => [name, index]));
229
- /**
230
- * Categorize style keys into chunks.
231
- *
232
- * Returns chunks in a deterministic order (by CHUNK_ORDER) regardless
233
- * of the order of keys in the input styles object.
234
- *
235
- * @param styles - The styles object to categorize
236
- * @returns Map of chunk name to array of style keys in that chunk (in priority order)
237
- */
238
- function categorizeStyleKeys(styles) {
239
- const chunkData = {};
240
- const keys = Object.keys(styles);
241
- for (const key of keys) {
242
- if (key === "$" || key === "@keyframes" || key === "@properties" || key === "recipe") continue;
243
- if (isSelector(key)) {
244
- if (!chunkData[CHUNK_NAMES.SUBCOMPONENTS]) chunkData[CHUNK_NAMES.SUBCOMPONENTS] = [];
245
- chunkData[CHUNK_NAMES.SUBCOMPONENTS].push(key);
246
- } else {
247
- const chunkName = STYLE_TO_CHUNK.get(key) ?? CHUNK_NAMES.MISC;
248
- if (!chunkData[chunkName]) chunkData[chunkName] = [];
249
- chunkData[chunkName].push(key);
250
- }
251
- }
252
- const orderedChunks = /* @__PURE__ */ new Map();
253
- for (const chunkName of CHUNK_ORDER) if (chunkData[chunkName] && chunkData[chunkName].length > 0) orderedChunks.set(chunkName, chunkData[chunkName].sort());
254
- for (const chunkName of Object.keys(chunkData)) if (!orderedChunks.has(chunkName)) orderedChunks.set(chunkName, chunkData[chunkName].sort());
255
- return orderedChunks;
256
- }
257
-
258
- //#endregion
259
- export { CHUNK_NAMES, STYLE_TO_CHUNK, categorizeStyleKeys };
260
- //# sourceMappingURL=definitions.js.map