@tenphi/tasty 0.0.0-snapshot.db103fd → 0.0.0-snapshot.db2ef70

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 (376) hide show
  1. package/README.md +441 -362
  2. package/dist/babel-types-Dc5zghyE.d.ts +18 -0
  3. package/dist/chunks/async-storage-f9j9JRtq.js +37 -0
  4. package/dist/chunks/async-storage-f9j9JRtq.js.map +1 -0
  5. package/dist/chunks/build-config-D9Iq8QQm.js +60 -0
  6. package/dist/chunks/build-config-D9Iq8QQm.js.map +1 -0
  7. package/dist/chunks/collector-Cb8ah2JF.js +210 -0
  8. package/dist/chunks/collector-Cb8ah2JF.js.map +1 -0
  9. package/dist/chunks/config-engine-CMYFZYQh.js +272 -0
  10. package/dist/chunks/config-engine-CMYFZYQh.js.map +1 -0
  11. package/dist/chunks/config-file-DlZXJMj8.js +25 -0
  12. package/dist/chunks/config-file-DlZXJMj8.js.map +1 -0
  13. package/dist/chunks/css-definitions-B4aWBkH3.js +910 -0
  14. package/dist/chunks/css-definitions-B4aWBkH3.js.map +1 -0
  15. package/dist/chunks/css-resources-P7IBUUZs.js +142 -0
  16. package/dist/chunks/css-resources-P7IBUUZs.js.map +1 -0
  17. package/dist/{debug.js → chunks/debug-D2Pu7Xhy.js} +196 -147
  18. package/dist/chunks/debug-D2Pu7Xhy.js.map +1 -0
  19. package/dist/chunks/dsl-CsFl9LGn.js +1458 -0
  20. package/dist/chunks/dsl-CsFl9LGn.js.map +1 -0
  21. package/dist/chunks/hydration-TRcz5vnk.js +41 -0
  22. package/dist/chunks/hydration-TRcz5vnk.js.map +1 -0
  23. package/dist/chunks/react-runtime-DHiopXCu.js +691 -0
  24. package/dist/chunks/react-runtime-DHiopXCu.js.map +1 -0
  25. package/dist/chunks/runtime-engine-NGCofNXy.js +2435 -0
  26. package/dist/chunks/runtime-engine-NGCofNXy.js.map +1 -0
  27. package/dist/chunks/runtime-state-lZjMbvwV.js +152 -0
  28. package/dist/chunks/runtime-state-lZjMbvwV.js.map +1 -0
  29. package/dist/{utils/merge-styles.js → chunks/shared-utils-y-HjvPN4.js} +60 -56
  30. package/dist/chunks/shared-utils-y-HjvPN4.js.map +1 -0
  31. package/dist/chunks/style-engine-DnkV_4Jg.js +5602 -0
  32. package/dist/chunks/style-engine-DnkV_4Jg.js.map +1 -0
  33. package/dist/chunks/zero-engine-DcwaCvFs.js +310 -0
  34. package/dist/chunks/zero-engine-DcwaCvFs.js.map +1 -0
  35. package/dist/collector-D2OT6I2G.d.ts +164 -0
  36. package/dist/config-C4ftFxgI.d.ts +1367 -0
  37. package/dist/core/index.d.ts +5 -33
  38. package/dist/core/index.js +9 -26
  39. package/dist/hydrate-CRyjjAyl.d.ts +22 -0
  40. package/dist/index-DxQNRj50.d.ts +1964 -0
  41. package/dist/index.d.ts +5 -50
  42. package/dist/index.js +11 -35
  43. package/dist/{utils/merge-styles.d.ts → merge-styles-D39qBtox.d.ts} +3 -4
  44. package/dist/ssr/astro-client.d.ts +1 -0
  45. package/dist/ssr/astro-client.js +6 -0
  46. package/dist/ssr/astro-client.js.map +1 -0
  47. package/dist/ssr/astro-middleware-extract-static.d.ts +10 -0
  48. package/dist/ssr/astro-middleware-extract-static.js +9 -0
  49. package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
  50. package/dist/ssr/astro-middleware-extract.d.ts +10 -0
  51. package/dist/ssr/astro-middleware-extract.js +9 -0
  52. package/dist/ssr/astro-middleware-extract.js.map +1 -0
  53. package/dist/ssr/astro-middleware-static.d.ts +17 -0
  54. package/dist/ssr/astro-middleware-static.js +7 -0
  55. package/dist/ssr/astro-middleware-static.js.map +1 -0
  56. package/dist/ssr/astro-middleware.d.ts +18 -0
  57. package/dist/ssr/astro-middleware.js +7 -0
  58. package/dist/ssr/astro-middleware.js.map +1 -0
  59. package/dist/ssr/astro.d.ts +110 -12
  60. package/dist/ssr/astro.js +205 -48
  61. package/dist/ssr/astro.js.map +1 -1
  62. package/dist/ssr/client.d.ts +2 -0
  63. package/dist/ssr/client.js +2 -0
  64. package/dist/ssr/index.d.ts +17 -5
  65. package/dist/ssr/index.js +6 -7
  66. package/dist/ssr/index.js.map +1 -1
  67. package/dist/ssr/next-config.d.ts +64 -0
  68. package/dist/ssr/next-config.js +123 -0
  69. package/dist/ssr/next-config.js.map +1 -0
  70. package/dist/ssr/next.d.ts +13 -12
  71. package/dist/ssr/next.js +38 -47
  72. package/dist/ssr/next.js.map +1 -1
  73. package/dist/static/index.d.ts +90 -5
  74. package/dist/static/index.js +31 -3
  75. package/dist/static/index.js.map +1 -0
  76. package/dist/static/inject.d.ts +1 -2
  77. package/dist/static/inject.js.map +1 -1
  78. package/dist/types-CYQIhUg1.d.ts +1569 -0
  79. package/dist/zero/babel.d.ts +12 -121
  80. package/dist/zero/babel.js +126 -149
  81. package/dist/zero/babel.js.map +1 -1
  82. package/dist/zero/index.d.ts +136 -3
  83. package/dist/zero/index.js +25 -3
  84. package/dist/zero/index.js.map +1 -0
  85. package/dist/zero/next.d.ts +4 -5
  86. package/dist/zero/next.js +3 -38
  87. package/dist/zero/next.js.map +1 -1
  88. package/docs/README.md +23 -12
  89. package/docs/adoption.md +72 -37
  90. package/docs/ai-agents.md +259 -0
  91. package/docs/comparison.md +83 -54
  92. package/docs/configuration.md +712 -81
  93. package/docs/debug.md +39 -24
  94. package/docs/design-system.md +174 -41
  95. package/docs/dsl.md +733 -195
  96. package/docs/getting-started.md +132 -52
  97. package/docs/injector.md +197 -90
  98. package/docs/methodology.md +154 -48
  99. package/docs/migration-v3.md +285 -0
  100. package/docs/pipeline.md +768 -0
  101. package/docs/plugins.md +333 -0
  102. package/docs/react-api.md +746 -0
  103. package/docs/runtime-benchmarks.md +388 -0
  104. package/docs/ssr.md +403 -151
  105. package/docs/styles.md +248 -49
  106. package/docs/tasty-static.md +298 -118
  107. package/package.json +152 -40
  108. package/tasty.config.ts +7 -0
  109. package/dist/_virtual/_rolldown/runtime.js +0 -7
  110. package/dist/chunks/cacheKey.d.ts +0 -1
  111. package/dist/chunks/cacheKey.js +0 -77
  112. package/dist/chunks/cacheKey.js.map +0 -1
  113. package/dist/chunks/definitions.d.ts +0 -37
  114. package/dist/chunks/definitions.js +0 -258
  115. package/dist/chunks/definitions.js.map +0 -1
  116. package/dist/chunks/index.d.ts +0 -1
  117. package/dist/chunks/renderChunk.d.ts +0 -1
  118. package/dist/chunks/renderChunk.js +0 -59
  119. package/dist/chunks/renderChunk.js.map +0 -1
  120. package/dist/config.d.ts +0 -366
  121. package/dist/config.js +0 -503
  122. package/dist/config.js.map +0 -1
  123. package/dist/counter-style/index.js +0 -51
  124. package/dist/counter-style/index.js.map +0 -1
  125. package/dist/debug.d.ts +0 -89
  126. package/dist/debug.js.map +0 -1
  127. package/dist/font-face/index.js +0 -63
  128. package/dist/font-face/index.js.map +0 -1
  129. package/dist/hooks/index.d.ts +0 -7
  130. package/dist/hooks/resolve-ssr-collector.js +0 -14
  131. package/dist/hooks/resolve-ssr-collector.js.map +0 -1
  132. package/dist/hooks/useCounterStyle.d.ts +0 -50
  133. package/dist/hooks/useCounterStyle.js +0 -46
  134. package/dist/hooks/useCounterStyle.js.map +0 -1
  135. package/dist/hooks/useFontFace.d.ts +0 -43
  136. package/dist/hooks/useFontFace.js +0 -70
  137. package/dist/hooks/useFontFace.js.map +0 -1
  138. package/dist/hooks/useGlobalStyles.d.ts +0 -30
  139. package/dist/hooks/useGlobalStyles.js +0 -78
  140. package/dist/hooks/useGlobalStyles.js.map +0 -1
  141. package/dist/hooks/useKeyframes.d.ts +0 -56
  142. package/dist/hooks/useKeyframes.js +0 -64
  143. package/dist/hooks/useKeyframes.js.map +0 -1
  144. package/dist/hooks/useProperty.d.ts +0 -79
  145. package/dist/hooks/useProperty.js +0 -109
  146. package/dist/hooks/useProperty.js.map +0 -1
  147. package/dist/hooks/useRawCSS.d.ts +0 -53
  148. package/dist/hooks/useRawCSS.js +0 -35
  149. package/dist/hooks/useRawCSS.js.map +0 -1
  150. package/dist/hooks/useStyles.d.ts +0 -45
  151. package/dist/hooks/useStyles.js +0 -237
  152. package/dist/hooks/useStyles.js.map +0 -1
  153. package/dist/injector/index.d.ts +0 -183
  154. package/dist/injector/index.js +0 -179
  155. package/dist/injector/index.js.map +0 -1
  156. package/dist/injector/injector.d.ts +0 -166
  157. package/dist/injector/injector.js +0 -464
  158. package/dist/injector/injector.js.map +0 -1
  159. package/dist/injector/sheet-manager.d.ts +0 -136
  160. package/dist/injector/sheet-manager.js +0 -733
  161. package/dist/injector/sheet-manager.js.map +0 -1
  162. package/dist/injector/types.d.ts +0 -204
  163. package/dist/keyframes/index.js +0 -206
  164. package/dist/keyframes/index.js.map +0 -1
  165. package/dist/parser/classify.js +0 -319
  166. package/dist/parser/classify.js.map +0 -1
  167. package/dist/parser/const.js +0 -49
  168. package/dist/parser/const.js.map +0 -1
  169. package/dist/parser/lru.js +0 -109
  170. package/dist/parser/lru.js.map +0 -1
  171. package/dist/parser/parser.d.ts +0 -25
  172. package/dist/parser/parser.js +0 -115
  173. package/dist/parser/parser.js.map +0 -1
  174. package/dist/parser/tokenizer.js +0 -69
  175. package/dist/parser/tokenizer.js.map +0 -1
  176. package/dist/parser/types.d.ts +0 -51
  177. package/dist/parser/types.js +0 -46
  178. package/dist/parser/types.js.map +0 -1
  179. package/dist/pipeline/conditions.d.ts +0 -134
  180. package/dist/pipeline/conditions.js +0 -406
  181. package/dist/pipeline/conditions.js.map +0 -1
  182. package/dist/pipeline/exclusive.js +0 -230
  183. package/dist/pipeline/exclusive.js.map +0 -1
  184. package/dist/pipeline/index.d.ts +0 -55
  185. package/dist/pipeline/index.js +0 -708
  186. package/dist/pipeline/index.js.map +0 -1
  187. package/dist/pipeline/materialize.js +0 -1103
  188. package/dist/pipeline/materialize.js.map +0 -1
  189. package/dist/pipeline/parseStateKey.d.ts +0 -15
  190. package/dist/pipeline/parseStateKey.js +0 -446
  191. package/dist/pipeline/parseStateKey.js.map +0 -1
  192. package/dist/pipeline/simplify.js +0 -515
  193. package/dist/pipeline/simplify.js.map +0 -1
  194. package/dist/pipeline/warnings.js +0 -18
  195. package/dist/pipeline/warnings.js.map +0 -1
  196. package/dist/plugins/index.d.ts +0 -2
  197. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  198. package/dist/plugins/okhsl-plugin.js +0 -97
  199. package/dist/plugins/okhsl-plugin.js.map +0 -1
  200. package/dist/plugins/types.d.ts +0 -76
  201. package/dist/properties/index.js +0 -222
  202. package/dist/properties/index.js.map +0 -1
  203. package/dist/properties/property-type-resolver.d.ts +0 -24
  204. package/dist/properties/property-type-resolver.js +0 -90
  205. package/dist/properties/property-type-resolver.js.map +0 -1
  206. package/dist/ssr/async-storage.d.ts +0 -17
  207. package/dist/ssr/async-storage.js +0 -34
  208. package/dist/ssr/async-storage.js.map +0 -1
  209. package/dist/ssr/collect-auto-properties.js +0 -39
  210. package/dist/ssr/collect-auto-properties.js.map +0 -1
  211. package/dist/ssr/collector.d.ts +0 -102
  212. package/dist/ssr/collector.js +0 -226
  213. package/dist/ssr/collector.js.map +0 -1
  214. package/dist/ssr/context.d.ts +0 -8
  215. package/dist/ssr/context.js +0 -13
  216. package/dist/ssr/context.js.map +0 -1
  217. package/dist/ssr/format-global-rules.js +0 -22
  218. package/dist/ssr/format-global-rules.js.map +0 -1
  219. package/dist/ssr/format-keyframes.js +0 -69
  220. package/dist/ssr/format-keyframes.js.map +0 -1
  221. package/dist/ssr/format-property.js +0 -49
  222. package/dist/ssr/format-property.js.map +0 -1
  223. package/dist/ssr/format-rules.js +0 -73
  224. package/dist/ssr/format-rules.js.map +0 -1
  225. package/dist/ssr/hydrate.d.ts +0 -22
  226. package/dist/ssr/hydrate.js +0 -49
  227. package/dist/ssr/hydrate.js.map +0 -1
  228. package/dist/ssr/ssr-collector-ref.js +0 -12
  229. package/dist/ssr/ssr-collector-ref.js.map +0 -1
  230. package/dist/states/index.d.ts +0 -49
  231. package/dist/states/index.js +0 -170
  232. package/dist/states/index.js.map +0 -1
  233. package/dist/static/tastyStatic.d.ts +0 -46
  234. package/dist/static/tastyStatic.js +0 -30
  235. package/dist/static/tastyStatic.js.map +0 -1
  236. package/dist/static/types.d.ts +0 -49
  237. package/dist/static/types.js +0 -24
  238. package/dist/static/types.js.map +0 -1
  239. package/dist/styles/align.d.ts +0 -15
  240. package/dist/styles/align.js +0 -14
  241. package/dist/styles/align.js.map +0 -1
  242. package/dist/styles/border.d.ts +0 -25
  243. package/dist/styles/border.js +0 -113
  244. package/dist/styles/border.js.map +0 -1
  245. package/dist/styles/color.d.ts +0 -14
  246. package/dist/styles/color.js +0 -26
  247. package/dist/styles/color.js.map +0 -1
  248. package/dist/styles/createStyle.js +0 -79
  249. package/dist/styles/createStyle.js.map +0 -1
  250. package/dist/styles/dimension.js +0 -96
  251. package/dist/styles/dimension.js.map +0 -1
  252. package/dist/styles/display.d.ts +0 -37
  253. package/dist/styles/display.js +0 -66
  254. package/dist/styles/display.js.map +0 -1
  255. package/dist/styles/fade.d.ts +0 -15
  256. package/dist/styles/fade.js +0 -57
  257. package/dist/styles/fade.js.map +0 -1
  258. package/dist/styles/fill.d.ts +0 -42
  259. package/dist/styles/fill.js +0 -51
  260. package/dist/styles/fill.js.map +0 -1
  261. package/dist/styles/flow.d.ts +0 -16
  262. package/dist/styles/flow.js +0 -12
  263. package/dist/styles/flow.js.map +0 -1
  264. package/dist/styles/gap.d.ts +0 -31
  265. package/dist/styles/gap.js +0 -36
  266. package/dist/styles/gap.js.map +0 -1
  267. package/dist/styles/height.d.ts +0 -17
  268. package/dist/styles/height.js +0 -19
  269. package/dist/styles/height.js.map +0 -1
  270. package/dist/styles/index.d.ts +0 -1
  271. package/dist/styles/index.js +0 -8
  272. package/dist/styles/index.js.map +0 -1
  273. package/dist/styles/inset.d.ts +0 -52
  274. package/dist/styles/inset.js +0 -149
  275. package/dist/styles/inset.js.map +0 -1
  276. package/dist/styles/justify.d.ts +0 -15
  277. package/dist/styles/justify.js +0 -14
  278. package/dist/styles/justify.js.map +0 -1
  279. package/dist/styles/list.d.ts +0 -16
  280. package/dist/styles/list.js +0 -98
  281. package/dist/styles/list.js.map +0 -1
  282. package/dist/styles/margin.d.ts +0 -24
  283. package/dist/styles/margin.js +0 -103
  284. package/dist/styles/margin.js.map +0 -1
  285. package/dist/styles/outline.d.ts +0 -29
  286. package/dist/styles/outline.js +0 -64
  287. package/dist/styles/outline.js.map +0 -1
  288. package/dist/styles/padding.d.ts +0 -24
  289. package/dist/styles/padding.js +0 -103
  290. package/dist/styles/padding.js.map +0 -1
  291. package/dist/styles/predefined.d.ts +0 -71
  292. package/dist/styles/predefined.js +0 -237
  293. package/dist/styles/predefined.js.map +0 -1
  294. package/dist/styles/preset.d.ts +0 -52
  295. package/dist/styles/preset.js +0 -126
  296. package/dist/styles/preset.js.map +0 -1
  297. package/dist/styles/radius.d.ts +0 -12
  298. package/dist/styles/radius.js +0 -71
  299. package/dist/styles/radius.js.map +0 -1
  300. package/dist/styles/scrollbar.d.ts +0 -25
  301. package/dist/styles/scrollbar.js +0 -46
  302. package/dist/styles/scrollbar.js.map +0 -1
  303. package/dist/styles/shadow.d.ts +0 -14
  304. package/dist/styles/shadow.js +0 -23
  305. package/dist/styles/shadow.js.map +0 -1
  306. package/dist/styles/transition.d.ts +0 -14
  307. package/dist/styles/transition.js +0 -157
  308. package/dist/styles/transition.js.map +0 -1
  309. package/dist/styles/types.d.ts +0 -549
  310. package/dist/styles/width.d.ts +0 -17
  311. package/dist/styles/width.js +0 -19
  312. package/dist/styles/width.js.map +0 -1
  313. package/dist/tasty.d.ts +0 -119
  314. package/dist/tasty.js +0 -231
  315. package/dist/tasty.js.map +0 -1
  316. package/dist/types.d.ts +0 -184
  317. package/dist/utils/cache-wrapper.js +0 -21
  318. package/dist/utils/cache-wrapper.js.map +0 -1
  319. package/dist/utils/case-converter.js +0 -8
  320. package/dist/utils/case-converter.js.map +0 -1
  321. package/dist/utils/color-math.d.ts +0 -46
  322. package/dist/utils/color-math.js +0 -749
  323. package/dist/utils/color-math.js.map +0 -1
  324. package/dist/utils/color-space.d.ts +0 -5
  325. package/dist/utils/color-space.js +0 -228
  326. package/dist/utils/color-space.js.map +0 -1
  327. package/dist/utils/colors.d.ts +0 -5
  328. package/dist/utils/colors.js +0 -10
  329. package/dist/utils/colors.js.map +0 -1
  330. package/dist/utils/css-types.d.ts +0 -7
  331. package/dist/utils/dotize.d.ts +0 -26
  332. package/dist/utils/dotize.js +0 -122
  333. package/dist/utils/dotize.js.map +0 -1
  334. package/dist/utils/filter-base-props.d.ts +0 -15
  335. package/dist/utils/filter-base-props.js +0 -45
  336. package/dist/utils/filter-base-props.js.map +0 -1
  337. package/dist/utils/get-display-name.d.ts +0 -7
  338. package/dist/utils/get-display-name.js +0 -10
  339. package/dist/utils/get-display-name.js.map +0 -1
  340. package/dist/utils/has-keys.js +0 -13
  341. package/dist/utils/has-keys.js.map +0 -1
  342. package/dist/utils/is-dev-env.js +0 -19
  343. package/dist/utils/is-dev-env.js.map +0 -1
  344. package/dist/utils/is-valid-element-type.js +0 -15
  345. package/dist/utils/is-valid-element-type.js.map +0 -1
  346. package/dist/utils/merge-styles.js.map +0 -1
  347. package/dist/utils/mod-attrs.d.ts +0 -6
  348. package/dist/utils/mod-attrs.js +0 -20
  349. package/dist/utils/mod-attrs.js.map +0 -1
  350. package/dist/utils/process-tokens.d.ts +0 -21
  351. package/dist/utils/process-tokens.js +0 -90
  352. package/dist/utils/process-tokens.js.map +0 -1
  353. package/dist/utils/resolve-recipes.d.ts +0 -17
  354. package/dist/utils/resolve-recipes.js +0 -146
  355. package/dist/utils/resolve-recipes.js.map +0 -1
  356. package/dist/utils/selector-transform.js +0 -32
  357. package/dist/utils/selector-transform.js.map +0 -1
  358. package/dist/utils/string.js +0 -8
  359. package/dist/utils/string.js.map +0 -1
  360. package/dist/utils/styles.d.ts +0 -99
  361. package/dist/utils/styles.js +0 -220
  362. package/dist/utils/styles.js.map +0 -1
  363. package/dist/utils/typography.d.ts +0 -47
  364. package/dist/utils/typography.js +0 -51
  365. package/dist/utils/typography.js.map +0 -1
  366. package/dist/utils/warnings.d.ts +0 -16
  367. package/dist/utils/warnings.js +0 -16
  368. package/dist/utils/warnings.js.map +0 -1
  369. package/dist/zero/css-writer.d.ts +0 -45
  370. package/dist/zero/css-writer.js +0 -73
  371. package/dist/zero/css-writer.js.map +0 -1
  372. package/dist/zero/extractor.d.ts +0 -24
  373. package/dist/zero/extractor.js +0 -266
  374. package/dist/zero/extractor.js.map +0 -1
  375. package/docs/PIPELINE.md +0 -519
  376. package/docs/runtime.md +0 -485
@@ -1,123 +1,9 @@
1
- import { CounterStyleDescriptors, FontFaceInput, KeyframesSteps } from "../injector/types.js";
2
- import { StyleDetails, UnitHandler } from "../parser/types.js";
3
- import { StyleHandlerDefinition } from "../utils/styles.js";
4
- import { ConfigTokens, RecipeStyles } from "../styles/types.js";
5
- import { TastyPlugin } from "../plugins/types.js";
6
- import * as _$_babel_core0 from "@babel/core";
7
- import { PluginPass } from "@babel/core";
8
-
1
+ import { t as TastyZeroConfig } from "../babel-types-Dc5zghyE.js";
9
2
  //#region src/zero/babel.d.ts
10
3
  /**
11
- * Build-time configuration for zero-runtime mode.
12
- * Subset of TastyConfig that applies at build time.
4
+ * Options for the `@tenphi/tasty/babel-plugin` Babel plugin.
13
5
  */
14
- interface TastyZeroConfig {
15
- /**
16
- * Global predefined states for advanced state mapping.
17
- * Example: { '@mobile': '@media(w < 768px)', '@dark': '@root(theme=dark)' }
18
- */
19
- states?: Record<string, string>;
20
- /**
21
- * Enable development mode features: source comments in generated CSS.
22
- * Default: false
23
- */
24
- devMode?: boolean;
25
- /**
26
- * Parser LRU cache size (default: 1000).
27
- * Larger values improve performance for builds with many unique style values.
28
- */
29
- parserCacheSize?: number;
30
- /**
31
- * Custom units for the style parser (merged with built-in units).
32
- * Units transform numeric values like `2x` → `calc(2 * var(--gap))`.
33
- * @example { em: 'em', vw: 'vw', custom: (n) => `${n * 10}px` }
34
- */
35
- units?: Record<string, string | UnitHandler>;
36
- /**
37
- * Custom functions for the style parser (merged with existing).
38
- * Functions process parsed style groups and return CSS values.
39
- * @example { myFunc: (groups) => groups.map(g => g.output).join(' ') }
40
- */
41
- funcs?: Record<string, (groups: StyleDetails[]) => string>;
42
- /**
43
- * Plugins that extend tasty with custom functions, units, states, and handlers.
44
- * Plugins are processed in order, with later plugins overriding earlier ones.
45
- * @example
46
- * ```ts
47
- * import { okhslPlugin } from '@tenphi/tasty';
48
- *
49
- * // babel.config.js
50
- * module.exports = {
51
- * plugins: [
52
- * ['@tenphi/tasty/babel-plugin', {
53
- * config: { plugins: [okhslPlugin()] }
54
- * }]
55
- * ]
56
- * };
57
- * ```
58
- */
59
- plugins?: TastyPlugin[];
60
- /**
61
- * Global keyframes definitions for static extraction.
62
- * Keys are animation names, values are keyframes step definitions.
63
- * @example { fadeIn: { from: { opacity: 0 }, to: { opacity: 1 } } }
64
- */
65
- keyframes?: Record<string, KeyframesSteps>;
66
- /**
67
- * Global @font-face definitions for static extraction.
68
- * Keys are font-family names, values are descriptors or arrays of descriptors.
69
- */
70
- fontFace?: Record<string, FontFaceInput>;
71
- /**
72
- * Global @counter-style definitions for static extraction.
73
- * Keys are counter-style names, values are descriptor objects.
74
- */
75
- counterStyle?: Record<string, CounterStyleDescriptors>;
76
- /**
77
- * Custom style handlers that transform style properties into CSS declarations.
78
- * Handlers replace built-in handlers for the same style name.
79
- * @example
80
- * ```ts
81
- * handlers: {
82
- * fill: ({ fill }) => fill ? { 'background-color': fill } : undefined,
83
- * elevation: ({ elevation }) => ({
84
- * 'box-shadow': `0 ${elevation}px ${elevation * 2}px rgba(0,0,0,0.1)`,
85
- * }),
86
- * }
87
- * ```
88
- */
89
- handlers?: Record<string, StyleHandlerDefinition>;
90
- /**
91
- * Design tokens injected as CSS custom properties on `:root`.
92
- * Values are parsed through the Tasty DSL. Supports state maps.
93
- * @example { '$gap': '4px', '#primary': { '': '#purple', '@dark': '#light-purple' } }
94
- */
95
- tokens?: ConfigTokens;
96
- /**
97
- * Predefined tokens replaced during style parsing (parse-time substitution).
98
- * Use `$name` for custom properties and `#name` for color tokens.
99
- * @example { $spacing: '2x', '#accent': '#purple' }
100
- */
101
- replaceTokens?: Record<`$${string}` | `#${string}`, string | number>;
102
- /**
103
- * Predefined style recipes -- named style bundles that can be applied via `recipe` style property.
104
- * Recipe values are flat tasty styles (no sub-element keys).
105
- * @example
106
- * ```ts
107
- * recipes: {
108
- * card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
109
- * elevated: { shadow: '2x 2x 4x #shadow' },
110
- * }
111
- * ```
112
- */
113
- recipes?: Record<string, RecipeStyles>;
114
- /**
115
- * Automatically infer and register CSS @property declarations from values.
116
- * @default true
117
- */
118
- autoPropertyTypes?: boolean;
119
- }
120
- interface TastyZeroBabelOptions {
6
+ export interface TastyZeroBabelOptions {
121
7
  /** Output path for generated CSS (default: 'tasty.css') */
122
8
  output?: string;
123
9
  /**
@@ -174,9 +60,14 @@ interface TastyZeroBabelOptions {
174
60
  */
175
61
  mode?: 'file' | 'inject';
176
62
  }
177
- /** Clear the shared CSSWriter cache. Exposed for testing. */
178
- declare function clearWriterCache(): void;
179
- declare const _default: (api: object, options: TastyZeroBabelOptions | null | undefined, dirname: string) => _$_babel_core0.PluginObj<PluginPass>;
63
+ /**
64
+ * The plugin's call signature, written out rather than inferred from
65
+ * `declare()` so the published declaration names no Babel types: Babel 7's
66
+ * come from `@types/babel__core`, Babel 8 ships its own, and the two name the
67
+ * plugin object differently.
68
+ */
69
+ type TastyZeroBabelPlugin = (api: object, options: TastyZeroBabelOptions | null | undefined, dirname: string) => object;
70
+ declare const _default: TastyZeroBabelPlugin;
180
71
  //#endregion
181
- export { TastyZeroBabelOptions, TastyZeroConfig, clearWriterCache, _default as default };
72
+ export { type TastyZeroConfig, _default as default };
182
73
  //# sourceMappingURL=babel.d.ts.map
@@ -1,33 +1,23 @@
1
- import { __require } from "../_virtual/_rolldown/runtime.js";
2
- import { configure, getGlobalConfigTokens, resetConfig } from "../config.js";
3
- import { mergeStyles } from "../utils/merge-styles.js";
4
- import { resolveRecipes } from "../utils/resolve-recipes.js";
5
- import { extractCounterStyleFromStyles, extractFontFaceFromStyles, extractKeyframesFromStyles, extractPropertiesFromStyles, extractStylesForSelector, extractStylesWithChunks } from "./extractor.js";
6
- import { CSSWriter } from "./css-writer.js";
1
+ import { t as mergeStyles } from "../chunks/shared-utils-y-HjvPN4.js";
2
+ import "../chunks/css-definitions-B4aWBkH3.js";
3
+ import { t as resolveRecipesWith } from "../chunks/config-engine-CMYFZYQh.js";
4
+ import { a as resetZeroConfig, i as reapplyZeroConfig, n as functionsForExtraction, t as configureZero } from "../chunks/build-config-D9Iq8QQm.js";
5
+ import { a as extractCounterStyleFromStyles, c as extractKeyframesFromStyles, h as setExtractorNamePrefix, i as extractConfigProperties, l as extractPropertiesFromStyles, m as replaceAnimationNamesInCSS, o as extractFontFaceFromStyles, p as renderSelectorCSS, r as extractChunks, s as extractFunctionsFromStyles, t as CSSWriter, u as extractSelectorCSS } from "../chunks/zero-engine-DcwaCvFs.js";
6
+ import { t as loadConfigFile } from "../chunks/config-file-DlZXJMj8.js";
7
7
  import * as fs from "fs";
8
8
  import * as path from "path";
9
9
  import { declare } from "@babel/helper-plugin-utils";
10
10
  import * as t from "@babel/types";
11
- import { createJiti } from "jiti";
11
+ //#region \0rolldown/runtime.js
12
+ 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) {
13
+ if (typeof require !== "undefined") return require.apply(this, arguments);
14
+ 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.");
15
+ });
16
+ //#endregion
17
+ //#region src/zero/writer-cache.ts
18
+ const writerCache = /* @__PURE__ */ new Map();
19
+ //#endregion
12
20
  //#region src/zero/babel.ts
13
- /**
14
- * Babel plugin for zero-runtime tasty static site generation.
15
- *
16
- * Transforms:
17
- * - `tastyStatic(styles)` → StaticStyle object { className, styles, toString() }
18
- * - `tastyStatic(base, styles)` → StaticStyle object with merged styles
19
- * - `tastyStatic(selector, styles)` → removed entirely
20
- *
21
- * Usage:
22
- * ```javascript
23
- * // babel.config.js
24
- * module.exports = {
25
- * plugins: [
26
- * ['@tenphi/tasty/babel-plugin', { output: 'public/tasty.css' }]
27
- * ]
28
- * };
29
- * ```
30
- */
31
21
  function mtime(filePath) {
32
22
  try {
33
23
  return fs.statSync(filePath).mtimeMs;
@@ -50,13 +40,8 @@ function clearRequireCacheTree(filePath) {
50
40
  }
51
41
  delete __require.cache[resolved];
52
42
  }
53
- const writerCache = /* @__PURE__ */ new Map();
54
- /** Clear the shared CSSWriter cache. Exposed for testing. */
55
- function clearWriterCache() {
56
- writerCache.clear();
57
- }
58
- var babel_default = declare((api, options) => {
59
- api.assertVersion(7);
43
+ const plugin = declare((api, options) => {
44
+ api.assertVersion("^7.0.0-0 || ^8.0.0-0");
60
45
  const mode = options.mode ?? "file";
61
46
  const outputPath = options.output || "tasty.css";
62
47
  const resolvedOutputPath = path.resolve(outputPath);
@@ -80,42 +65,64 @@ var babel_default = declare((api, options) => {
80
65
  const configOption = options.config;
81
66
  let resolvedConfig;
82
67
  if (configOption) resolvedConfig = typeof configOption === "function" ? configOption() : configOption;
83
- else if (options.configFile) resolvedConfig = createJiti(path.dirname(options.configFile), { moduleCache: false })(options.configFile);
68
+ else if (options.configFile) resolvedConfig = loadConfigFile(options.configFile);
84
69
  else resolvedConfig = {};
85
70
  const devMode = resolvedConfig.devMode ?? false;
86
- if (cached) resetConfig();
87
- configure(resolvedConfig);
71
+ resetZeroConfig();
72
+ const finalConfig = {
73
+ namePrefix: "ts",
74
+ ...resolvedConfig
75
+ };
76
+ const config = configureZero(finalConfig);
77
+ setExtractorNamePrefix(finalConfig.namePrefix ?? "ts");
88
78
  const newWriter = new CSSWriter(outputPath, { devMode });
89
79
  if (mode !== "inject") {
90
- const tokenStyles = getGlobalConfigTokens();
91
- if (tokenStyles && Object.keys(tokenStyles).length > 0) {
92
- const result = extractStylesForSelector(":root", tokenStyles);
93
- if (result.css) newWriter.add(":root:tokens", result.css);
94
- }
80
+ for (const prop of extractConfigProperties(config.normalized.properties)) newWriter.add(`@property:${prop.name}`, prop.css);
81
+ const tokenCSS = extractCSSFromStyles(":root", config.normalized.tokens);
82
+ if (tokenCSS) newWriter.add(":root:tokens", tokenCSS);
83
+ for (const [selector, styles] of Object.entries(config.normalized.globalStyles)) writeGlobalStyles(newWriter, selector, styles, config.normalized.keyframes);
95
84
  }
96
85
  writerCache.set(resolvedOutputPath, {
97
86
  writer: newWriter,
98
87
  configKey,
99
88
  registry: {},
100
- config: resolvedConfig
89
+ config
101
90
  });
102
91
  }
103
92
  const entry = writerCache.get(resolvedOutputPath);
93
+ entry.config = reapplyZeroConfig(entry.config);
104
94
  const cssWriter = entry.writer;
105
95
  const globalRegistry = entry.registry;
106
96
  const config = entry.config;
107
- const devMode = config.devMode ?? false;
97
+ const sourceConfig = config.source;
98
+ const devMode = sourceConfig.devMode ?? false;
99
+ setExtractorNamePrefix(sourceConfig.namePrefix ?? "ts");
100
+ const configProperties = extractConfigProperties(config.normalized.properties);
101
+ const propertyOptions = {
102
+ autoPropertyTypes: sourceConfig.autoPropertyTypes,
103
+ defined: new Set(configProperties.map((prop) => prop.name))
104
+ };
105
+ let propertyCSS;
108
106
  let tokenCSS;
107
+ let globalStylesCSS;
109
108
  if (mode === "inject") {
110
- const tokenStyles = getGlobalConfigTokens();
111
- if (tokenStyles && Object.keys(tokenStyles).length > 0) {
112
- const result = extractStylesForSelector(":root", tokenStyles);
113
- if (result.css) tokenCSS = result.css;
109
+ propertyCSS = configProperties.map((prop) => prop.css).join("\n") || void 0;
110
+ tokenCSS = extractCSSFromStyles(":root", config.normalized.tokens);
111
+ const gs = config.normalized.globalStyles;
112
+ if (Object.keys(gs).length > 0) {
113
+ globalStylesCSS = /* @__PURE__ */ new Map();
114
+ for (const [selector, styles] of Object.entries(gs)) {
115
+ const css = extractCSSFromStyles(selector, styles, config.normalized.keyframes);
116
+ if (css) globalStylesCSS.set(selector, css);
117
+ }
118
+ if (globalStylesCSS.size === 0) globalStylesCSS = void 0;
114
119
  }
115
120
  }
116
121
  return {
117
122
  name: "tasty-zero",
118
123
  pre() {
124
+ entry.config = reapplyZeroConfig(entry.config);
125
+ setExtractorNamePrefix(sourceConfig.namePrefix ?? "ts");
119
126
  this.staticStyleRegistry = {};
120
127
  this._fileAddedCSS = false;
121
128
  if (devMode && this.filename) this.sourceFile = this.filename.split("/").pop() || this.filename;
@@ -123,16 +130,18 @@ var babel_default = declare((api, options) => {
123
130
  visitor: {
124
131
  ImportDeclaration(nodePath, state) {
125
132
  const source = nodePath.node.source.value;
126
- if (source === "@tenphi/tasty/static" || source.endsWith("/tasty/static")) if (mode === "inject") nodePath.replaceWith(t.importDeclaration([t.importSpecifier(t.identifier("_$i"), t.identifier("injectCSS"))], t.stringLiteral("@tenphi/tasty/static/inject")));
127
- else if (injectImport) {
128
- let importPath = resolvedOutputPath;
129
- if (state.filename) {
130
- const sourceDir = path.dirname(state.filename);
131
- importPath = path.relative(sourceDir, resolvedOutputPath);
132
- if (!importPath.startsWith(".")) importPath = "./" + importPath;
133
- }
134
- nodePath.replaceWith(t.importDeclaration([], t.stringLiteral(importPath)));
135
- } else nodePath.remove();
133
+ if (source === "@tenphi/tasty/static" || source.endsWith("/tasty/static")) {
134
+ if (mode === "inject") nodePath.replaceWith(t.importDeclaration([t.importSpecifier(t.identifier("_$i"), t.identifier("injectCSS"))], t.stringLiteral("@tenphi/tasty/static/inject")));
135
+ else if (injectImport) {
136
+ let importPath = resolvedOutputPath;
137
+ if (state.filename) {
138
+ const sourceDir = path.dirname(state.filename);
139
+ importPath = path.relative(sourceDir, resolvedOutputPath);
140
+ if (!importPath.startsWith(".")) importPath = "./" + importPath;
141
+ }
142
+ nodePath.replaceWith(t.importDeclaration([], t.stringLiteral(importPath)));
143
+ } else nodePath.remove();
144
+ }
136
145
  },
137
146
  CallExpression(path, state) {
138
147
  const callee = path.node.callee;
@@ -141,9 +150,9 @@ var babel_default = declare((api, options) => {
141
150
  const args = path.node.arguments;
142
151
  if (args.length === 0) throw path.buildCodeFrameError("tastyStatic() requires at least one argument");
143
152
  const firstArg = args[0];
144
- if (t.isStringLiteral(firstArg)) handleSelectorMode(path, args, cssWriter, mode, state.sourceFile, config.keyframes, config.autoPropertyTypes, config.fontFace, config.counterStyle);
145
- else if (t.isObjectExpression(firstArg)) handleStylesMode(path, args, cssWriter, state, globalRegistry, mode, config.keyframes, config.autoPropertyTypes, config.fontFace, config.counterStyle);
146
- else if (t.isIdentifier(firstArg)) handleExtensionMode(path, args, cssWriter, state, globalRegistry, mode, config.keyframes, config.autoPropertyTypes, config.fontFace, config.counterStyle);
153
+ if (t.isStringLiteral(firstArg)) handleSelectorMode(path, args, cssWriter, mode, state.sourceFile, config.normalized.keyframes, propertyOptions, config.normalized.fontFaces, config.normalized.counterStyles, functionsForExtraction(config), config.normalized.recipes);
154
+ else if (t.isObjectExpression(firstArg)) handleStylesMode(path, args, cssWriter, state, globalRegistry, mode, config.normalized.keyframes, propertyOptions, config.normalized.fontFaces, config.normalized.counterStyles, functionsForExtraction(config), config.normalized.recipes);
155
+ else if (t.isIdentifier(firstArg)) handleExtensionMode(path, args, cssWriter, state, globalRegistry, mode, config.normalized.keyframes, propertyOptions, config.normalized.fontFaces, config.normalized.counterStyles, functionsForExtraction(config), config.normalized.recipes);
147
156
  else throw path.buildCodeFrameError("tastyStatic() first argument must be an object (styles), identifier (base StaticStyle), or string (selector)");
148
157
  },
149
158
  VariableDeclarator(path, state) {
@@ -168,12 +177,25 @@ var babel_default = declare((api, options) => {
168
177
  },
169
178
  post() {
170
179
  if (mode === "inject") {
171
- if (this._fileAddedCSS && tokenCSS) {
180
+ if (this._fileAddedCSS && (propertyCSS || tokenCSS || globalStylesCSS)) {
172
181
  const program = this.file.ast.program;
173
- const injectCall = createInjectCallAST(":root", tokenCSS);
174
182
  let insertIndex = 0;
175
183
  for (let i = 0; i < program.body.length; i++) if (t.isImportDeclaration(program.body[i])) insertIndex = i + 1;
176
- program.body.splice(insertIndex, 0, t.expressionStatement(injectCall));
184
+ if (propertyCSS) {
185
+ const injectCall = createInjectCallAST("@property", propertyCSS);
186
+ program.body.splice(insertIndex, 0, t.expressionStatement(injectCall));
187
+ insertIndex++;
188
+ }
189
+ if (tokenCSS) {
190
+ const injectCall = createInjectCallAST(":root", tokenCSS);
191
+ program.body.splice(insertIndex, 0, t.expressionStatement(injectCall));
192
+ insertIndex++;
193
+ }
194
+ if (globalStylesCSS) for (const [selector, css] of globalStylesCSS) {
195
+ const injectCall = createInjectCallAST(selector, css);
196
+ program.body.splice(insertIndex, 0, t.expressionStatement(injectCall));
197
+ insertIndex++;
198
+ }
177
199
  }
178
200
  return;
179
201
  }
@@ -181,55 +203,42 @@ var babel_default = declare((api, options) => {
181
203
  }
182
204
  };
183
205
  });
184
- /**
185
- * Check if an object expression looks like a StaticStyle object
186
- */
187
206
  function isStaticStyleObject(node) {
188
207
  const hasClassName = node.properties.some((p) => t.isObjectProperty(p) && t.isIdentifier(p.key, { name: "className" }));
189
208
  const hasStyles = node.properties.some((p) => t.isObjectProperty(p) && t.isIdentifier(p.key, { name: "styles" }));
190
209
  return hasClassName && hasStyles;
191
210
  }
192
- /**
193
- * Extract styles object from a StaticStyle object expression
194
- */
195
211
  function extractStylesFromStaticStyleObject(node, path) {
196
212
  for (const prop of node.properties) if (t.isObjectProperty(prop) && t.isIdentifier(prop.key, { name: "styles" }) && t.isObjectExpression(prop.value)) return evaluateObjectExpression(prop.value, path);
197
213
  return null;
198
214
  }
199
- /**
200
- * Extract className from a StaticStyle object expression
201
- */
202
215
  function extractClassNameFromStaticStyleObject(node) {
203
216
  for (const prop of node.properties) if (t.isObjectProperty(prop) && t.isIdentifier(prop.key, { name: "className" }) && t.isStringLiteral(prop.value)) return prop.value.value;
204
217
  return null;
205
218
  }
206
- /**
207
- * Handle tastyStatic(styles) - returns StaticStyle object
208
- */
209
- function handleStylesMode(path, args, cssWriter, state, globalRegistry, mode, globalKeyframes, autoPropertyTypes, globalFontFace, globalCounterStyle) {
219
+ function handleStylesMode(path, args, cssWriter, state, globalRegistry, mode, globalKeyframes, propertyOptions, globalFontFace, globalCounterStyle, globalFunction, globalRecipes) {
210
220
  const stylesArg = args[0];
211
221
  if (!t.isObjectExpression(stylesArg)) throw path.buildCodeFrameError("tastyStatic(styles) argument must be a static object literal");
212
- const styles = resolveRecipes(evaluateObjectExpression(stylesArg, path));
222
+ const rawStyles = evaluateObjectExpression(stylesArg, path);
223
+ const styles = resolveRecipesWith(rawStyles, globalRecipes ?? null);
213
224
  const { keyframes, nameMap } = extractKeyframesFromStyles(styles, globalKeyframes);
214
- const properties = extractPropertiesFromStyles(styles, { autoPropertyTypes });
225
+ const properties = extractPropertiesFromStyles(styles, propertyOptions);
215
226
  const fontFaces = extractFontFaceFromStyles(styles, globalFontFace);
216
227
  const counterStyles = extractCounterStyleFromStyles(styles, globalCounterStyle);
217
- const chunks = extractStylesWithChunks(styles);
228
+ const functions = extractFunctionsFromStyles(styles, globalFunction);
229
+ const chunks = extractChunks(styles);
218
230
  const className = chunks.length > 0 ? chunks.map((c) => c.className).join(" ") : "";
219
231
  const staticStyleObject = createStaticStyleAST(className, styles);
220
232
  if (mode === "inject") {
221
- const injectCall = createInjectCallAST(className, collectAllCSS(keyframes, properties, fontFaces, counterStyles, chunks, nameMap));
233
+ const injectCall = createInjectCallAST(className, collectAllCSS(keyframes, properties, fontFaces, counterStyles, functions, chunks, nameMap));
222
234
  path.replaceWith(t.sequenceExpression([injectCall, staticStyleObject]));
223
235
  } else {
224
- writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, chunks, nameMap, state.sourceFile);
236
+ writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, functions, chunks, nameMap, state.sourceFile);
225
237
  path.replaceWith(staticStyleObject);
226
238
  }
227
239
  registerIfVariableDeclaration(path, className, styles, state, globalRegistry);
228
240
  }
229
- /**
230
- * Handle tastyStatic(base, styles) - extends base with additional styles
231
- */
232
- function handleExtensionMode(path, args, cssWriter, state, globalRegistry, mode, globalKeyframes, autoPropertyTypes, globalFontFace, globalCounterStyle) {
241
+ function handleExtensionMode(path, args, cssWriter, state, globalRegistry, mode, globalKeyframes, propertyOptions, globalFontFace, globalCounterStyle, globalFunction, globalRecipes) {
233
242
  if (args.length < 2) throw path.buildCodeFrameError("tastyStatic(base, styles) requires two arguments");
234
243
  const baseArg = args[0];
235
244
  const stylesArg = args[1];
@@ -239,93 +248,94 @@ function handleExtensionMode(path, args, cssWriter, state, globalRegistry, mode,
239
248
  const baseEntry = state.staticStyleRegistry[baseName] || globalRegistry[baseName];
240
249
  if (!baseEntry) throw path.buildCodeFrameError(`Cannot find base StaticStyle '${baseName}'. Make sure it is defined before being extended.`);
241
250
  const overrideStyles = evaluateObjectExpression(stylesArg, path);
242
- const mergedStyles = resolveRecipes(mergeStyles(baseEntry.styles, overrideStyles));
251
+ const mergedStyles = resolveRecipesWith(mergeStyles(baseEntry.styles, overrideStyles), globalRecipes ?? null);
243
252
  const { keyframes, nameMap } = extractKeyframesFromStyles(mergedStyles, globalKeyframes);
244
- const properties = extractPropertiesFromStyles(mergedStyles, { autoPropertyTypes });
253
+ const properties = extractPropertiesFromStyles(mergedStyles, propertyOptions);
245
254
  const fontFaces = extractFontFaceFromStyles(mergedStyles, globalFontFace);
246
255
  const counterStyles = extractCounterStyleFromStyles(mergedStyles, globalCounterStyle);
247
- const chunks = extractStylesWithChunks(mergedStyles);
256
+ const functions = extractFunctionsFromStyles(mergedStyles, globalFunction);
257
+ const chunks = extractChunks(mergedStyles);
248
258
  const className = chunks.length > 0 ? chunks.map((c) => c.className).join(" ") : "";
249
259
  const staticStyleObject = createStaticStyleAST(className, mergedStyles);
250
260
  if (mode === "inject") {
251
- const injectCall = createInjectCallAST(className, collectAllCSS(keyframes, properties, fontFaces, counterStyles, chunks, nameMap));
261
+ const injectCall = createInjectCallAST(className, collectAllCSS(keyframes, properties, fontFaces, counterStyles, functions, chunks, nameMap));
252
262
  path.replaceWith(t.sequenceExpression([injectCall, staticStyleObject]));
253
263
  } else {
254
- writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, chunks, nameMap, state.sourceFile);
264
+ writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, functions, chunks, nameMap, state.sourceFile);
255
265
  path.replaceWith(staticStyleObject);
256
266
  }
257
267
  registerIfVariableDeclaration(path, className, mergedStyles, state, globalRegistry);
258
268
  }
259
- /**
260
- * Handle tastyStatic(selector, styles) - removes the call entirely
261
- */
262
- function handleSelectorMode(path, args, cssWriter, mode, sourceFile, globalKeyframes, autoPropertyTypes, globalFontFace, globalCounterStyle) {
269
+ function handleSelectorMode(path, args, cssWriter, mode, sourceFile, globalKeyframes, propertyOptions, globalFontFace, globalCounterStyle, globalFunction, globalRecipes) {
263
270
  if (args.length < 2) throw path.buildCodeFrameError("tastyStatic(selector, styles) requires two arguments");
264
271
  const selectorArg = args[0];
265
272
  const stylesArg = args[1];
266
273
  if (!t.isStringLiteral(selectorArg)) throw path.buildCodeFrameError("tastyStatic(selector, styles) first argument must be a string literal");
267
274
  if (!t.isObjectExpression(stylesArg)) throw path.buildCodeFrameError("tastyStatic(selector, styles) second argument must be a static object literal");
268
275
  const selector = selectorArg.value;
269
- const styles = resolveRecipes(evaluateObjectExpression(stylesArg, path));
276
+ const rawStyles = evaluateObjectExpression(stylesArg, path);
277
+ const styles = resolveRecipesWith(rawStyles, globalRecipes ?? null);
270
278
  const { keyframes, nameMap } = extractKeyframesFromStyles(styles, globalKeyframes);
271
- const properties = extractPropertiesFromStyles(styles, { autoPropertyTypes });
279
+ const properties = extractPropertiesFromStyles(styles, propertyOptions);
272
280
  const fontFaces = extractFontFaceFromStyles(styles, globalFontFace);
273
281
  const counterStyles = extractCounterStyleFromStyles(styles, globalCounterStyle);
274
- const result = extractStylesForSelector(selector, styles);
275
- const selectorCSS = nameMap.size > 0 ? replaceAnimationNamesInCSS(result.css, nameMap) : result.css;
282
+ const functions = extractFunctionsFromStyles(styles, globalFunction);
283
+ const css = renderSelectorCSS(selector, styles);
284
+ const selectorCSS = nameMap.size > 0 ? replaceAnimationNamesInCSS(css, nameMap) : css;
276
285
  if (mode === "inject") {
277
286
  const cssParts = [];
278
287
  for (const kf of keyframes) cssParts.push(kf.css);
279
288
  for (const prop of properties) cssParts.push(prop.css);
280
289
  for (const ff of fontFaces) cssParts.push(ff.css);
281
290
  for (const cs of counterStyles) cssParts.push(cs.css);
291
+ for (const fn of functions) cssParts.push(fn.css);
282
292
  cssParts.push(selectorCSS);
283
293
  const injectCall = createInjectCallAST(selector, cssParts.join("\n"));
284
294
  const parent = path.parentPath;
285
295
  if (parent && t.isExpressionStatement(parent.node)) parent.replaceWith(t.expressionStatement(injectCall));
286
296
  else path.replaceWith(injectCall);
287
297
  } else {
288
- writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, [], nameMap, sourceFile);
298
+ writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, functions, [], nameMap, sourceFile);
289
299
  cssWriter.add(selector, selectorCSS, sourceFile);
290
300
  const parent = path.parentPath;
291
301
  if (parent && t.isExpressionStatement(parent.node)) parent.remove();
292
302
  else path.replaceWith(t.identifier("undefined"));
293
303
  }
294
304
  }
295
- /**
296
- * Collect all extracted CSS parts into a single string (for inject mode).
297
- */
298
- function collectAllCSS(keyframes, properties, fontFaces, counterStyles, chunks, nameMap) {
305
+ function collectAllCSS(keyframes, properties, fontFaces, counterStyles, functions, chunks, nameMap) {
299
306
  const parts = [];
300
307
  for (const kf of keyframes) parts.push(kf.css);
301
308
  for (const prop of properties) parts.push(prop.css);
302
309
  for (const ff of fontFaces) parts.push(ff.css);
303
310
  for (const cs of counterStyles) parts.push(cs.css);
311
+ for (const fn of functions) parts.push(fn.css);
304
312
  for (const chunk of chunks) parts.push(nameMap.size > 0 ? replaceAnimationNamesInCSS(chunk.css, nameMap) : chunk.css);
305
313
  return parts.join("\n");
306
314
  }
307
- /**
308
- * Write all extracted CSS parts to a CSSWriter (for file mode).
309
- */
310
- function writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, chunks, nameMap, sourceFile) {
315
+ function writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, functions, chunks, nameMap, sourceFile) {
311
316
  for (const kf of keyframes) cssWriter.add(kf.css, kf.css, sourceFile);
312
317
  for (const prop of properties) cssWriter.add(prop.css, prop.css, sourceFile);
313
318
  for (const ff of fontFaces) cssWriter.add(ff.css, ff.css, sourceFile);
314
319
  for (const cs of counterStyles) cssWriter.add(cs.css, cs.css, sourceFile);
320
+ for (const fn of functions) cssWriter.add(fn.css, fn.css, sourceFile);
315
321
  for (const chunk of chunks) {
316
322
  const css = nameMap.size > 0 ? replaceAnimationNamesInCSS(chunk.css, nameMap) : chunk.css;
317
323
  cssWriter.add(chunk.className, css, sourceFile);
318
324
  }
319
325
  }
320
- /**
321
- * Create an `_$i(id, css)` call expression AST node for inject mode.
322
- */
326
+ function extractCSSFromStyles(selector, styles, globalKeyframes) {
327
+ if (!styles || Object.keys(styles).length === 0) return void 0;
328
+ return extractSelectorCSS(selector, styles, globalKeyframes) || void 0;
329
+ }
330
+ function writeGlobalStyles(cssWriter, selector, styles, globalKeyframes) {
331
+ const { keyframes, nameMap } = extractKeyframesFromStyles(styles, globalKeyframes);
332
+ for (const kf of keyframes) cssWriter.add(kf.css, kf.css);
333
+ const css = replaceAnimationNamesInCSS(renderSelectorCSS(selector, styles), nameMap);
334
+ if (css) cssWriter.add(`global:${selector}`, css);
335
+ }
323
336
  function createInjectCallAST(id, css) {
324
337
  return t.callExpression(t.identifier("_$i"), [t.stringLiteral(id), t.stringLiteral(css)]);
325
338
  }
326
- /**
327
- * Create a StaticStyle object AST node
328
- */
329
339
  function createStaticStyleAST(className, styles) {
330
340
  return t.objectExpression([
331
341
  t.objectProperty(t.identifier("className"), t.stringLiteral(className)),
@@ -333,9 +343,6 @@ function createStaticStyleAST(className, styles) {
333
343
  t.objectMethod("method", t.identifier("toString"), [], t.blockStatement([t.returnStatement(t.memberExpression(t.thisExpression(), t.identifier("className")))]))
334
344
  ]);
335
345
  }
336
- /**
337
- * Register a StaticStyle in the registry if it's being assigned to a variable
338
- */
339
346
  function registerIfVariableDeclaration(path, className, styles, state, globalRegistry) {
340
347
  const parent = path.parentPath;
341
348
  if (parent && t.isVariableDeclarator(parent.node)) {
@@ -353,14 +360,11 @@ function registerIfVariableDeclaration(path, className, styles, state, globalReg
353
360
  }
354
361
  }
355
362
  }
356
- /**
357
- * Convert a JavaScript value to an AST node
358
- */
359
363
  function valueToAST(value) {
360
364
  if (value === null) return t.nullLiteral();
361
365
  if (value === void 0) return t.identifier("undefined");
362
366
  if (typeof value === "string") return t.stringLiteral(value);
363
- if (typeof value === "number") return t.numericLiteral(value);
367
+ if (typeof value === "number") return t.valueToNode(value);
364
368
  if (typeof value === "boolean") return t.booleanLiteral(value);
365
369
  if (Array.isArray(value)) return t.arrayExpression(value.map(valueToAST));
366
370
  if (typeof value === "object") {
@@ -369,10 +373,6 @@ function valueToAST(value) {
369
373
  }
370
374
  return t.identifier("undefined");
371
375
  }
372
- /**
373
- * Evaluate an ObjectExpression to a plain JavaScript object.
374
- * Only supports static values that can be determined at build time.
375
- */
376
376
  function evaluateObjectExpression(node, path) {
377
377
  const result = {};
378
378
  for (const prop of node.properties) {
@@ -382,13 +382,11 @@ function evaluateObjectExpression(node, path) {
382
382
  if (t.isIdentifier(prop.key)) key = prop.key.name;
383
383
  else if (t.isStringLiteral(prop.key)) key = prop.key.value;
384
384
  else throw path.buildCodeFrameError("Dynamic property keys are not supported in tastyStatic()");
385
- result[key] = evaluateExpression(prop.value, path);
385
+ const value = evaluateExpression(prop.value, path);
386
+ result[key] = value;
386
387
  }
387
388
  return result;
388
389
  }
389
- /**
390
- * Evaluate an expression to a JavaScript value.
391
- */
392
390
  function evaluateExpression(node, path) {
393
391
  if (t.isStringLiteral(node)) return node.value;
394
392
  if (t.isNumericLiteral(node)) return node.value;
@@ -411,28 +409,7 @@ function evaluateExpression(node, path) {
411
409
  }
412
410
  throw path.buildCodeFrameError(`Dynamic expressions are not supported in tastyStatic() - got ${node.type}. All values must be static literals.`);
413
411
  }
414
- /**
415
- * Replace animation names in CSS string.
416
- * Wraps the keyframes replaceAnimationNames to work on full CSS blocks.
417
- */
418
- function replaceAnimationNamesInCSS(css, nameMap) {
419
- if (nameMap.size === 0) return css;
420
- return css.replace(/(animation(?:-name)?)\s*:\s*([^;}]+)/gi, (match, prop, value) => {
421
- let newValue = value;
422
- for (const [original, replacement] of nameMap) {
423
- const pattern = new RegExp(`\\b${escapeRegex(original)}\\b`, "g");
424
- newValue = newValue.replace(pattern, replacement);
425
- }
426
- return `${prop}: ${newValue}`;
427
- });
428
- }
429
- /**
430
- * Escape special regex characters.
431
- */
432
- function escapeRegex(str) {
433
- return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
434
- }
435
412
  //#endregion
436
- export { clearWriterCache, babel_default as default };
413
+ export { plugin as default };
437
414
 
438
415
  //# sourceMappingURL=babel.js.map