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

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 (370) hide show
  1. package/README.md +196 -140
  2. package/dist/babel-Zs1Q03qt.d.ts +83 -0
  3. package/dist/chunks/async-storage-CG5HnUT5.js +20 -0
  4. package/dist/chunks/async-storage-CG5HnUT5.js.map +1 -0
  5. package/dist/chunks/build-config-CUQVwdWF.js +42 -0
  6. package/dist/chunks/build-config-CUQVwdWF.js.map +1 -0
  7. package/dist/chunks/collector-B0LTHw6Z.js +208 -0
  8. package/dist/chunks/collector-B0LTHw6Z.js.map +1 -0
  9. package/dist/chunks/config-engine-C3pF9EK9.js +267 -0
  10. package/dist/chunks/config-engine-C3pF9EK9.js.map +1 -0
  11. package/dist/chunks/css-definitions-D_it4XZH.js +875 -0
  12. package/dist/chunks/css-definitions-D_it4XZH.js.map +1 -0
  13. package/dist/chunks/css-resources-BN8apgxt.js +142 -0
  14. package/dist/chunks/css-resources-BN8apgxt.js.map +1 -0
  15. package/dist/{debug.js → chunks/debug-C9LeNVoJ.js} +187 -139
  16. package/dist/chunks/debug-C9LeNVoJ.js.map +1 -0
  17. package/dist/chunks/dsl-C5yuAn41.js +1373 -0
  18. package/dist/chunks/dsl-C5yuAn41.js.map +1 -0
  19. package/dist/chunks/hydration-TRcz5vnk.js +41 -0
  20. package/dist/chunks/hydration-TRcz5vnk.js.map +1 -0
  21. package/dist/chunks/react-runtime-O-OUrKLH.js +557 -0
  22. package/dist/chunks/react-runtime-O-OUrKLH.js.map +1 -0
  23. package/dist/chunks/runtime-engine-DvnE2g-E.js +2437 -0
  24. package/dist/chunks/runtime-engine-DvnE2g-E.js.map +1 -0
  25. package/dist/chunks/runtime-state-BTDqSYBk.js +127 -0
  26. package/dist/chunks/runtime-state-BTDqSYBk.js.map +1 -0
  27. package/dist/{utils/merge-styles.js → chunks/shared-utils-DWA4LjIa.js} +55 -55
  28. package/dist/chunks/shared-utils-DWA4LjIa.js.map +1 -0
  29. package/dist/chunks/style-engine-C1ECBZxR.js +5131 -0
  30. package/dist/chunks/style-engine-C1ECBZxR.js.map +1 -0
  31. package/dist/{zero/extractor.js → chunks/zero-engine-B6EnYcXY.js} +89 -82
  32. package/dist/chunks/zero-engine-B6EnYcXY.js.map +1 -0
  33. package/dist/collector-hl5KNH7k.d.ts +165 -0
  34. package/dist/config-DWL1ZYue.d.ts +1358 -0
  35. package/dist/core/index.d.ts +5 -34
  36. package/dist/core/index.js +9 -27
  37. package/dist/index-D9N9GV24.d.ts +1947 -0
  38. package/dist/index.d.ts +5 -51
  39. package/dist/index.js +11 -36
  40. package/dist/{utils/merge-styles.d.ts → merge-styles-C_oMoJVd.d.ts} +3 -3
  41. package/dist/ssr/astro-client.js +6 -0
  42. package/dist/ssr/astro-client.js.map +1 -0
  43. package/dist/ssr/astro-middleware-extract-static.d.ts +11 -0
  44. package/dist/ssr/astro-middleware-extract-static.js +9 -0
  45. package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
  46. package/dist/ssr/astro-middleware-extract.d.ts +11 -0
  47. package/dist/ssr/astro-middleware-extract.js +9 -0
  48. package/dist/ssr/astro-middleware-extract.js.map +1 -0
  49. package/dist/ssr/astro-middleware-static.d.ts +18 -0
  50. package/dist/ssr/astro-middleware-static.js +7 -0
  51. package/dist/ssr/astro-middleware-static.js.map +1 -0
  52. package/dist/ssr/astro-middleware.d.ts +19 -0
  53. package/dist/ssr/astro-middleware.js +7 -0
  54. package/dist/ssr/astro-middleware.js.map +1 -0
  55. package/dist/ssr/astro.d.ts +117 -11
  56. package/dist/ssr/astro.js +204 -48
  57. package/dist/ssr/astro.js.map +1 -1
  58. package/dist/ssr/index.d.ts +37 -4
  59. package/dist/ssr/index.js +6 -6
  60. package/dist/ssr/index.js.map +1 -1
  61. package/dist/ssr/next-config.d.ts +66 -0
  62. package/dist/ssr/next-config.js +124 -0
  63. package/dist/ssr/next-config.js.map +1 -0
  64. package/dist/ssr/next.d.ts +14 -5
  65. package/dist/ssr/next.js +31 -46
  66. package/dist/ssr/next.js.map +1 -1
  67. package/dist/static/index.d.ts +91 -5
  68. package/dist/static/index.js +31 -3
  69. package/dist/static/index.js.map +1 -0
  70. package/dist/static/inject.js.map +1 -1
  71. package/dist/types-jKZNpias.d.ts +1616 -0
  72. package/dist/zero/babel.d.ts +2 -182
  73. package/dist/zero/babel.js +82 -113
  74. package/dist/zero/babel.js.map +1 -1
  75. package/dist/zero/index.d.ts +81 -3
  76. package/dist/zero/index.js +2 -3
  77. package/dist/zero/next.d.ts +1 -1
  78. package/dist/zero/next.js +0 -31
  79. package/dist/zero/next.js.map +1 -1
  80. package/docs/README.md +20 -12
  81. package/docs/adoption.md +59 -32
  82. package/docs/ai-agents.md +229 -0
  83. package/docs/comparison.md +76 -48
  84. package/docs/configuration.md +566 -69
  85. package/docs/debug.md +37 -23
  86. package/docs/design-system.md +63 -32
  87. package/docs/dsl.md +527 -179
  88. package/docs/getting-started.md +62 -41
  89. package/docs/injector.md +157 -51
  90. package/docs/methodology.md +69 -37
  91. package/docs/migration-v3.md +285 -0
  92. package/docs/pipeline.md +744 -0
  93. package/docs/plugins.md +353 -0
  94. package/docs/{runtime.md → react-api.md} +176 -67
  95. package/docs/runtime-benchmarks.md +377 -0
  96. package/docs/ssr.md +350 -94
  97. package/docs/styles.md +108 -27
  98. package/docs/tasty-static.md +149 -87
  99. package/package.json +121 -23
  100. package/tasty.config.ts +6 -0
  101. package/dist/_virtual/_rolldown/runtime.js +0 -7
  102. package/dist/chunks/cacheKey.js +0 -77
  103. package/dist/chunks/cacheKey.js.map +0 -1
  104. package/dist/chunks/definitions.d.ts +0 -37
  105. package/dist/chunks/definitions.js +0 -258
  106. package/dist/chunks/definitions.js.map +0 -1
  107. package/dist/chunks/index.d.ts +0 -1
  108. package/dist/chunks/renderChunk.d.ts +0 -1
  109. package/dist/chunks/renderChunk.js +0 -59
  110. package/dist/chunks/renderChunk.js.map +0 -1
  111. package/dist/compute-styles.d.ts +0 -31
  112. package/dist/compute-styles.js +0 -356
  113. package/dist/compute-styles.js.map +0 -1
  114. package/dist/config.d.ts +0 -372
  115. package/dist/config.js +0 -507
  116. package/dist/config.js.map +0 -1
  117. package/dist/counter-style/index.js +0 -51
  118. package/dist/counter-style/index.js.map +0 -1
  119. package/dist/debug.d.ts +0 -89
  120. package/dist/debug.js.map +0 -1
  121. package/dist/font-face/index.js +0 -63
  122. package/dist/font-face/index.js.map +0 -1
  123. package/dist/hooks/index.d.ts +0 -7
  124. package/dist/hooks/useCounterStyle.d.ts +0 -50
  125. package/dist/hooks/useCounterStyle.js +0 -45
  126. package/dist/hooks/useCounterStyle.js.map +0 -1
  127. package/dist/hooks/useFontFace.d.ts +0 -43
  128. package/dist/hooks/useFontFace.js +0 -69
  129. package/dist/hooks/useFontFace.js.map +0 -1
  130. package/dist/hooks/useGlobalStyles.d.ts +0 -30
  131. package/dist/hooks/useGlobalStyles.js +0 -77
  132. package/dist/hooks/useGlobalStyles.js.map +0 -1
  133. package/dist/hooks/useKeyframes.d.ts +0 -56
  134. package/dist/hooks/useKeyframes.js +0 -63
  135. package/dist/hooks/useKeyframes.js.map +0 -1
  136. package/dist/hooks/useProperty.d.ts +0 -79
  137. package/dist/hooks/useProperty.js +0 -108
  138. package/dist/hooks/useProperty.js.map +0 -1
  139. package/dist/hooks/useRawCSS.d.ts +0 -53
  140. package/dist/hooks/useRawCSS.js +0 -34
  141. package/dist/hooks/useRawCSS.js.map +0 -1
  142. package/dist/hooks/useStyles.d.ts +0 -40
  143. package/dist/hooks/useStyles.js +0 -29
  144. package/dist/hooks/useStyles.js.map +0 -1
  145. package/dist/injector/index.d.ts +0 -166
  146. package/dist/injector/index.js +0 -166
  147. package/dist/injector/index.js.map +0 -1
  148. package/dist/injector/injector.d.ts +0 -166
  149. package/dist/injector/injector.js +0 -464
  150. package/dist/injector/injector.js.map +0 -1
  151. package/dist/injector/sheet-manager.d.ts +0 -136
  152. package/dist/injector/sheet-manager.js +0 -733
  153. package/dist/injector/sheet-manager.js.map +0 -1
  154. package/dist/injector/types.d.ts +0 -204
  155. package/dist/keyframes/index.js +0 -206
  156. package/dist/keyframes/index.js.map +0 -1
  157. package/dist/parser/classify.js +0 -319
  158. package/dist/parser/classify.js.map +0 -1
  159. package/dist/parser/const.js +0 -60
  160. package/dist/parser/const.js.map +0 -1
  161. package/dist/parser/lru.js +0 -109
  162. package/dist/parser/lru.js.map +0 -1
  163. package/dist/parser/parser.d.ts +0 -25
  164. package/dist/parser/parser.js +0 -115
  165. package/dist/parser/parser.js.map +0 -1
  166. package/dist/parser/tokenizer.js +0 -69
  167. package/dist/parser/tokenizer.js.map +0 -1
  168. package/dist/parser/types.d.ts +0 -51
  169. package/dist/parser/types.js +0 -46
  170. package/dist/parser/types.js.map +0 -1
  171. package/dist/pipeline/conditions.d.ts +0 -134
  172. package/dist/pipeline/conditions.js +0 -406
  173. package/dist/pipeline/conditions.js.map +0 -1
  174. package/dist/pipeline/exclusive.js +0 -230
  175. package/dist/pipeline/exclusive.js.map +0 -1
  176. package/dist/pipeline/index.d.ts +0 -55
  177. package/dist/pipeline/index.js +0 -708
  178. package/dist/pipeline/index.js.map +0 -1
  179. package/dist/pipeline/materialize.js +0 -1103
  180. package/dist/pipeline/materialize.js.map +0 -1
  181. package/dist/pipeline/parseStateKey.d.ts +0 -15
  182. package/dist/pipeline/parseStateKey.js +0 -446
  183. package/dist/pipeline/parseStateKey.js.map +0 -1
  184. package/dist/pipeline/simplify.js +0 -515
  185. package/dist/pipeline/simplify.js.map +0 -1
  186. package/dist/pipeline/warnings.js +0 -18
  187. package/dist/pipeline/warnings.js.map +0 -1
  188. package/dist/plugins/index.d.ts +0 -2
  189. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  190. package/dist/plugins/okhsl-plugin.js +0 -97
  191. package/dist/plugins/okhsl-plugin.js.map +0 -1
  192. package/dist/plugins/types.d.ts +0 -76
  193. package/dist/properties/index.js +0 -222
  194. package/dist/properties/index.js.map +0 -1
  195. package/dist/properties/property-type-resolver.d.ts +0 -24
  196. package/dist/properties/property-type-resolver.js +0 -90
  197. package/dist/properties/property-type-resolver.js.map +0 -1
  198. package/dist/ssr/async-storage.d.ts +0 -17
  199. package/dist/ssr/async-storage.js +0 -34
  200. package/dist/ssr/async-storage.js.map +0 -1
  201. package/dist/ssr/collect-auto-properties.js +0 -39
  202. package/dist/ssr/collect-auto-properties.js.map +0 -1
  203. package/dist/ssr/collector.d.ts +0 -102
  204. package/dist/ssr/collector.js +0 -219
  205. package/dist/ssr/collector.js.map +0 -1
  206. package/dist/ssr/format-global-rules.js +0 -22
  207. package/dist/ssr/format-global-rules.js.map +0 -1
  208. package/dist/ssr/format-keyframes.js +0 -69
  209. package/dist/ssr/format-keyframes.js.map +0 -1
  210. package/dist/ssr/format-property.js +0 -49
  211. package/dist/ssr/format-property.js.map +0 -1
  212. package/dist/ssr/format-rules.js +0 -73
  213. package/dist/ssr/format-rules.js.map +0 -1
  214. package/dist/ssr/hydrate.d.ts +0 -22
  215. package/dist/ssr/hydrate.js +0 -49
  216. package/dist/ssr/hydrate.js.map +0 -1
  217. package/dist/ssr/ssr-collector-ref.js +0 -12
  218. package/dist/ssr/ssr-collector-ref.js.map +0 -1
  219. package/dist/states/index.d.ts +0 -49
  220. package/dist/states/index.js +0 -170
  221. package/dist/states/index.js.map +0 -1
  222. package/dist/static/tastyStatic.d.ts +0 -46
  223. package/dist/static/tastyStatic.js +0 -30
  224. package/dist/static/tastyStatic.js.map +0 -1
  225. package/dist/static/types.d.ts +0 -49
  226. package/dist/static/types.js +0 -24
  227. package/dist/static/types.js.map +0 -1
  228. package/dist/styles/border.d.ts +0 -25
  229. package/dist/styles/border.js +0 -120
  230. package/dist/styles/border.js.map +0 -1
  231. package/dist/styles/color.d.ts +0 -14
  232. package/dist/styles/color.js +0 -26
  233. package/dist/styles/color.js.map +0 -1
  234. package/dist/styles/const.js +0 -17
  235. package/dist/styles/const.js.map +0 -1
  236. package/dist/styles/createStyle.js +0 -79
  237. package/dist/styles/createStyle.js.map +0 -1
  238. package/dist/styles/dimension.js +0 -109
  239. package/dist/styles/dimension.js.map +0 -1
  240. package/dist/styles/directional.js +0 -133
  241. package/dist/styles/directional.js.map +0 -1
  242. package/dist/styles/display.d.ts +0 -30
  243. package/dist/styles/display.js +0 -73
  244. package/dist/styles/display.js.map +0 -1
  245. package/dist/styles/fade.d.ts +0 -15
  246. package/dist/styles/fade.js +0 -62
  247. package/dist/styles/fade.js.map +0 -1
  248. package/dist/styles/fill.d.ts +0 -42
  249. package/dist/styles/fill.js +0 -51
  250. package/dist/styles/fill.js.map +0 -1
  251. package/dist/styles/flow.d.ts +0 -16
  252. package/dist/styles/flow.js +0 -12
  253. package/dist/styles/flow.js.map +0 -1
  254. package/dist/styles/gap.d.ts +0 -31
  255. package/dist/styles/gap.js +0 -38
  256. package/dist/styles/gap.js.map +0 -1
  257. package/dist/styles/height.d.ts +0 -17
  258. package/dist/styles/height.js +0 -19
  259. package/dist/styles/height.js.map +0 -1
  260. package/dist/styles/index.d.ts +0 -1
  261. package/dist/styles/index.js +0 -8
  262. package/dist/styles/index.js.map +0 -1
  263. package/dist/styles/inset.d.ts +0 -24
  264. package/dist/styles/inset.js +0 -34
  265. package/dist/styles/inset.js.map +0 -1
  266. package/dist/styles/list.d.ts +0 -16
  267. package/dist/styles/list.js +0 -100
  268. package/dist/styles/list.js.map +0 -1
  269. package/dist/styles/margin.d.ts +0 -24
  270. package/dist/styles/margin.js +0 -32
  271. package/dist/styles/margin.js.map +0 -1
  272. package/dist/styles/outline.d.ts +0 -29
  273. package/dist/styles/outline.js +0 -55
  274. package/dist/styles/outline.js.map +0 -1
  275. package/dist/styles/padding.d.ts +0 -24
  276. package/dist/styles/padding.js +0 -32
  277. package/dist/styles/padding.js.map +0 -1
  278. package/dist/styles/placement.d.ts +0 -37
  279. package/dist/styles/placement.js +0 -74
  280. package/dist/styles/placement.js.map +0 -1
  281. package/dist/styles/predefined.d.ts +0 -71
  282. package/dist/styles/predefined.js +0 -237
  283. package/dist/styles/predefined.js.map +0 -1
  284. package/dist/styles/preset.d.ts +0 -52
  285. package/dist/styles/preset.js +0 -127
  286. package/dist/styles/preset.js.map +0 -1
  287. package/dist/styles/radius.d.ts +0 -12
  288. package/dist/styles/radius.js +0 -83
  289. package/dist/styles/radius.js.map +0 -1
  290. package/dist/styles/scrollMargin.d.ts +0 -24
  291. package/dist/styles/scrollMargin.js +0 -32
  292. package/dist/styles/scrollMargin.js.map +0 -1
  293. package/dist/styles/scrollbar.d.ts +0 -25
  294. package/dist/styles/scrollbar.js +0 -51
  295. package/dist/styles/scrollbar.js.map +0 -1
  296. package/dist/styles/shadow.d.ts +0 -14
  297. package/dist/styles/shadow.js +0 -25
  298. package/dist/styles/shadow.js.map +0 -1
  299. package/dist/styles/shared.js +0 -17
  300. package/dist/styles/shared.js.map +0 -1
  301. package/dist/styles/transition.d.ts +0 -14
  302. package/dist/styles/transition.js +0 -159
  303. package/dist/styles/transition.js.map +0 -1
  304. package/dist/styles/types.d.ts +0 -564
  305. package/dist/styles/width.d.ts +0 -17
  306. package/dist/styles/width.js +0 -19
  307. package/dist/styles/width.js.map +0 -1
  308. package/dist/tasty.d.ts +0 -134
  309. package/dist/tasty.js +0 -240
  310. package/dist/tasty.js.map +0 -1
  311. package/dist/types.d.ts +0 -184
  312. package/dist/utils/cache-wrapper.js +0 -21
  313. package/dist/utils/cache-wrapper.js.map +0 -1
  314. package/dist/utils/case-converter.js +0 -8
  315. package/dist/utils/case-converter.js.map +0 -1
  316. package/dist/utils/color-math.d.ts +0 -46
  317. package/dist/utils/color-math.js +0 -749
  318. package/dist/utils/color-math.js.map +0 -1
  319. package/dist/utils/color-space.d.ts +0 -5
  320. package/dist/utils/color-space.js +0 -228
  321. package/dist/utils/color-space.js.map +0 -1
  322. package/dist/utils/colors.d.ts +0 -5
  323. package/dist/utils/colors.js +0 -10
  324. package/dist/utils/colors.js.map +0 -1
  325. package/dist/utils/css-types.d.ts +0 -7
  326. package/dist/utils/dotize.d.ts +0 -26
  327. package/dist/utils/dotize.js +0 -122
  328. package/dist/utils/dotize.js.map +0 -1
  329. package/dist/utils/filter-base-props.d.ts +0 -15
  330. package/dist/utils/filter-base-props.js +0 -45
  331. package/dist/utils/filter-base-props.js.map +0 -1
  332. package/dist/utils/get-display-name.d.ts +0 -7
  333. package/dist/utils/get-display-name.js +0 -10
  334. package/dist/utils/get-display-name.js.map +0 -1
  335. package/dist/utils/has-keys.js +0 -13
  336. package/dist/utils/has-keys.js.map +0 -1
  337. package/dist/utils/is-dev-env.js +0 -19
  338. package/dist/utils/is-dev-env.js.map +0 -1
  339. package/dist/utils/is-valid-element-type.js +0 -15
  340. package/dist/utils/is-valid-element-type.js.map +0 -1
  341. package/dist/utils/merge-styles.js.map +0 -1
  342. package/dist/utils/mod-attrs.d.ts +0 -6
  343. package/dist/utils/mod-attrs.js +0 -20
  344. package/dist/utils/mod-attrs.js.map +0 -1
  345. package/dist/utils/process-tokens.d.ts +0 -17
  346. package/dist/utils/process-tokens.js +0 -83
  347. package/dist/utils/process-tokens.js.map +0 -1
  348. package/dist/utils/resolve-recipes.d.ts +0 -17
  349. package/dist/utils/resolve-recipes.js +0 -146
  350. package/dist/utils/resolve-recipes.js.map +0 -1
  351. package/dist/utils/selector-transform.js +0 -32
  352. package/dist/utils/selector-transform.js.map +0 -1
  353. package/dist/utils/string.js +0 -8
  354. package/dist/utils/string.js.map +0 -1
  355. package/dist/utils/styles.d.ts +0 -99
  356. package/dist/utils/styles.js +0 -220
  357. package/dist/utils/styles.js.map +0 -1
  358. package/dist/utils/typography.d.ts +0 -47
  359. package/dist/utils/typography.js +0 -51
  360. package/dist/utils/typography.js.map +0 -1
  361. package/dist/utils/warnings.d.ts +0 -16
  362. package/dist/utils/warnings.js +0 -16
  363. package/dist/utils/warnings.js.map +0 -1
  364. package/dist/zero/css-writer.d.ts +0 -45
  365. package/dist/zero/css-writer.js +0 -73
  366. package/dist/zero/css-writer.js.map +0 -1
  367. package/dist/zero/extractor.d.ts +0 -24
  368. package/dist/zero/extractor.js.map +0 -1
  369. package/docs/PIPELINE.md +0 -519
  370. /package/dist/{chunks/cacheKey.d.ts → ssr/astro-client.d.ts} +0 -0
@@ -1,182 +1,2 @@
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
-
9
- //#region src/zero/babel.d.ts
10
- /**
11
- * Build-time configuration for zero-runtime mode.
12
- * Subset of TastyConfig that applies at build time.
13
- */
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 {
121
- /** Output path for generated CSS (default: 'tasty.css') */
122
- output?: string;
123
- /**
124
- * Tasty configuration for build-time processing.
125
- * Can be a static object or a factory function that returns fresh config.
126
- * A factory is called on each plugin invocation, enabling hot reload
127
- * of config values that depend on external files (e.g. theme tokens).
128
- */
129
- config?: TastyZeroConfig | (() => TastyZeroConfig);
130
- /**
131
- * Absolute path to a TypeScript/JavaScript module that default-exports
132
- * a `TastyZeroConfig` object. The module is loaded via jiti on each
133
- * plugin invocation, enabling hot reload when the file changes.
134
- *
135
- * This option is JSON-serializable and is the primary way Turbopack
136
- * passes config to the Babel plugin (since Turbopack loader options
137
- * must be plain primitives/objects/arrays).
138
- *
139
- * When both `config` and `configFile` are set, `config` takes precedence.
140
- *
141
- * @example '/absolute/path/to/tasty-zero.config.ts'
142
- */
143
- configFile?: string;
144
- /**
145
- * Absolute file paths whose content affects the generated CSS.
146
- * When any of these files change, babel-loader invalidates its cache
147
- * and re-runs the plugin with fresh config values.
148
- *
149
- * Typically includes theme files that define Glaze palettes or token values.
150
- * Paths must be absolute (resolved by the Next.js wrapper).
151
- */
152
- configDeps?: string[];
153
- /**
154
- * Automatically replace `@tenphi/tasty/static` imports with an import
155
- * of the generated CSS file. This eliminates the need for users to
156
- * manually import the CSS in their app entry point.
157
- *
158
- * @default true
159
- */
160
- injectImport?: boolean;
161
- /**
162
- * Output mode for extracted CSS.
163
- *
164
- * - `'file'` (default): CSS is written to a single output file and
165
- * the `@tenphi/tasty/static` import is rewritten to import that file.
166
- * - `'inject'`: CSS is embedded inline in the JS output and injected
167
- * at runtime via a tiny injector from `@tenphi/tasty/static/inject`.
168
- * No CSS file is written. Each `tastyStatic` call becomes
169
- * self-contained. Best for reusable components and extensions.
170
- *
171
- * When `mode` is `'inject'`, `output` and `injectImport` are ignored.
172
- *
173
- * @default 'file'
174
- */
175
- mode?: 'file' | 'inject';
176
- }
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>;
180
- //#endregion
181
- export { TastyZeroBabelOptions, TastyZeroConfig, clearWriterCache, _default as default };
182
- //# sourceMappingURL=babel.d.ts.map
1
+ import { n as _default, r as TastyZeroConfig, t as TastyZeroBabelOptions } from "../babel-Zs1Q03qt.js";
2
+ export { TastyZeroBabelOptions, type TastyZeroConfig, _default as default };
@@ -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-DWA4LjIa.js";
2
+ import "../chunks/css-definitions-D_it4XZH.js";
3
+ import { t as resolveRecipesWith } from "../chunks/config-engine-C3pF9EK9.js";
4
+ import { a as extractFunctionsFromStyles, c as extractStylesForSelector, i as extractFontFaceFromStyles, l as extractStylesWithChunks, o as extractKeyframesFromStyles, r as extractCounterStyleFromStyles, s as extractPropertiesFromStyles, t as CSSWriter, u as setExtractorNamePrefix } from "../chunks/zero-engine-B6EnYcXY.js";
5
+ import { n as functionsForExtraction, r as resetZeroConfig, t as configureZero } from "../chunks/build-config-CUQVwdWF.js";
7
6
  import * as fs from "fs";
8
7
  import * as path from "path";
9
8
  import { declare } from "@babel/helper-plugin-utils";
10
9
  import * as t from "@babel/types";
11
10
  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,11 +40,6 @@ 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
43
  var babel_default = declare((api, options) => {
59
44
  api.assertVersion(7);
60
45
  const mode = options.mode ?? "file";
@@ -80,37 +65,53 @@ 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);
84
- else resolvedConfig = {};
68
+ else if (options.configFile) {
69
+ const loaded = createJiti(path.dirname(options.configFile), { moduleCache: false })(options.configFile);
70
+ resolvedConfig = loaded && typeof loaded === "object" && "default" in loaded ? loaded.default : loaded;
71
+ } else resolvedConfig = {};
85
72
  const devMode = resolvedConfig.devMode ?? false;
86
- if (cached) resetConfig();
87
- configure(resolvedConfig);
73
+ resetZeroConfig();
74
+ const finalConfig = {
75
+ namePrefix: "ts",
76
+ ...resolvedConfig
77
+ };
78
+ const config = configureZero(finalConfig);
79
+ setExtractorNamePrefix(finalConfig.namePrefix ?? "ts");
88
80
  const newWriter = new CSSWriter(outputPath, { devMode });
89
81
  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);
82
+ const tokenCSS = extractCSSFromStyles(":root", config.normalized.tokens);
83
+ if (tokenCSS) newWriter.add(":root:tokens", tokenCSS);
84
+ for (const [selector, styles] of Object.entries(config.normalized.globalStyles)) {
85
+ const css = extractCSSFromStyles(selector, styles);
86
+ if (css) newWriter.add(`global:${selector}`, css);
94
87
  }
95
88
  }
96
89
  writerCache.set(resolvedOutputPath, {
97
90
  writer: newWriter,
98
91
  configKey,
99
92
  registry: {},
100
- config: resolvedConfig
93
+ config
101
94
  });
102
95
  }
103
96
  const entry = writerCache.get(resolvedOutputPath);
104
97
  const cssWriter = entry.writer;
105
98
  const globalRegistry = entry.registry;
106
99
  const config = entry.config;
107
- const devMode = config.devMode ?? false;
100
+ const sourceConfig = config.source;
101
+ const devMode = sourceConfig.devMode ?? false;
102
+ setExtractorNamePrefix(sourceConfig.namePrefix ?? "ts");
108
103
  let tokenCSS;
104
+ let globalStylesCSS;
109
105
  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;
106
+ tokenCSS = extractCSSFromStyles(":root", config.normalized.tokens);
107
+ const gs = config.normalized.globalStyles;
108
+ if (Object.keys(gs).length > 0) {
109
+ globalStylesCSS = /* @__PURE__ */ new Map();
110
+ for (const [selector, styles] of Object.entries(gs)) {
111
+ const css = extractCSSFromStyles(selector, styles);
112
+ if (css) globalStylesCSS.set(selector, css);
113
+ }
114
+ if (globalStylesCSS.size === 0) globalStylesCSS = void 0;
114
115
  }
115
116
  }
116
117
  return {
@@ -141,9 +142,9 @@ var babel_default = declare((api, options) => {
141
142
  const args = path.node.arguments;
142
143
  if (args.length === 0) throw path.buildCodeFrameError("tastyStatic() requires at least one argument");
143
144
  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);
145
+ if (t.isStringLiteral(firstArg)) handleSelectorMode(path, args, cssWriter, mode, state.sourceFile, config.normalized.keyframes, sourceConfig.autoPropertyTypes, config.normalized.fontFaces, config.normalized.counterStyles, functionsForExtraction(config), config.normalized.recipes);
146
+ else if (t.isObjectExpression(firstArg)) handleStylesMode(path, args, cssWriter, state, globalRegistry, mode, config.normalized.keyframes, sourceConfig.autoPropertyTypes, config.normalized.fontFaces, config.normalized.counterStyles, functionsForExtraction(config), config.normalized.recipes);
147
+ else if (t.isIdentifier(firstArg)) handleExtensionMode(path, args, cssWriter, state, globalRegistry, mode, config.normalized.keyframes, sourceConfig.autoPropertyTypes, config.normalized.fontFaces, config.normalized.counterStyles, functionsForExtraction(config), config.normalized.recipes);
147
148
  else throw path.buildCodeFrameError("tastyStatic() first argument must be an object (styles), identifier (base StaticStyle), or string (selector)");
148
149
  },
149
150
  VariableDeclarator(path, state) {
@@ -168,12 +169,20 @@ var babel_default = declare((api, options) => {
168
169
  },
169
170
  post() {
170
171
  if (mode === "inject") {
171
- if (this._fileAddedCSS && tokenCSS) {
172
+ if (this._fileAddedCSS && (tokenCSS || globalStylesCSS)) {
172
173
  const program = this.file.ast.program;
173
- const injectCall = createInjectCallAST(":root", tokenCSS);
174
174
  let insertIndex = 0;
175
175
  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));
176
+ if (tokenCSS) {
177
+ const injectCall = createInjectCallAST(":root", tokenCSS);
178
+ program.body.splice(insertIndex, 0, t.expressionStatement(injectCall));
179
+ insertIndex++;
180
+ }
181
+ if (globalStylesCSS) for (const [selector, css] of globalStylesCSS) {
182
+ const injectCall = createInjectCallAST(selector, css);
183
+ program.body.splice(insertIndex, 0, t.expressionStatement(injectCall));
184
+ insertIndex++;
185
+ }
177
186
  }
178
187
  return;
179
188
  }
@@ -181,55 +190,41 @@ var babel_default = declare((api, options) => {
181
190
  }
182
191
  };
183
192
  });
184
- /**
185
- * Check if an object expression looks like a StaticStyle object
186
- */
187
193
  function isStaticStyleObject(node) {
188
194
  const hasClassName = node.properties.some((p) => t.isObjectProperty(p) && t.isIdentifier(p.key, { name: "className" }));
189
195
  const hasStyles = node.properties.some((p) => t.isObjectProperty(p) && t.isIdentifier(p.key, { name: "styles" }));
190
196
  return hasClassName && hasStyles;
191
197
  }
192
- /**
193
- * Extract styles object from a StaticStyle object expression
194
- */
195
198
  function extractStylesFromStaticStyleObject(node, path) {
196
199
  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
200
  return null;
198
201
  }
199
- /**
200
- * Extract className from a StaticStyle object expression
201
- */
202
202
  function extractClassNameFromStaticStyleObject(node) {
203
203
  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
204
  return null;
205
205
  }
206
- /**
207
- * Handle tastyStatic(styles) - returns StaticStyle object
208
- */
209
- function handleStylesMode(path, args, cssWriter, state, globalRegistry, mode, globalKeyframes, autoPropertyTypes, globalFontFace, globalCounterStyle) {
206
+ function handleStylesMode(path, args, cssWriter, state, globalRegistry, mode, globalKeyframes, autoPropertyTypes, globalFontFace, globalCounterStyle, globalFunction, globalRecipes) {
210
207
  const stylesArg = args[0];
211
208
  if (!t.isObjectExpression(stylesArg)) throw path.buildCodeFrameError("tastyStatic(styles) argument must be a static object literal");
212
- const styles = resolveRecipes(evaluateObjectExpression(stylesArg, path));
209
+ const styles = resolveRecipesWith(evaluateObjectExpression(stylesArg, path), globalRecipes ?? null);
213
210
  const { keyframes, nameMap } = extractKeyframesFromStyles(styles, globalKeyframes);
214
211
  const properties = extractPropertiesFromStyles(styles, { autoPropertyTypes });
215
212
  const fontFaces = extractFontFaceFromStyles(styles, globalFontFace);
216
213
  const counterStyles = extractCounterStyleFromStyles(styles, globalCounterStyle);
214
+ const functions = extractFunctionsFromStyles(styles, globalFunction);
217
215
  const chunks = extractStylesWithChunks(styles);
218
216
  const className = chunks.length > 0 ? chunks.map((c) => c.className).join(" ") : "";
219
217
  const staticStyleObject = createStaticStyleAST(className, styles);
220
218
  if (mode === "inject") {
221
- const injectCall = createInjectCallAST(className, collectAllCSS(keyframes, properties, fontFaces, counterStyles, chunks, nameMap));
219
+ const injectCall = createInjectCallAST(className, collectAllCSS(keyframes, properties, fontFaces, counterStyles, functions, chunks, nameMap));
222
220
  path.replaceWith(t.sequenceExpression([injectCall, staticStyleObject]));
223
221
  } else {
224
- writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, chunks, nameMap, state.sourceFile);
222
+ writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, functions, chunks, nameMap, state.sourceFile);
225
223
  path.replaceWith(staticStyleObject);
226
224
  }
227
225
  registerIfVariableDeclaration(path, className, styles, state, globalRegistry);
228
226
  }
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) {
227
+ function handleExtensionMode(path, args, cssWriter, state, globalRegistry, mode, globalKeyframes, autoPropertyTypes, globalFontFace, globalCounterStyle, globalFunction, globalRecipes) {
233
228
  if (args.length < 2) throw path.buildCodeFrameError("tastyStatic(base, styles) requires two arguments");
234
229
  const baseArg = args[0];
235
230
  const stylesArg = args[1];
@@ -239,38 +234,37 @@ function handleExtensionMode(path, args, cssWriter, state, globalRegistry, mode,
239
234
  const baseEntry = state.staticStyleRegistry[baseName] || globalRegistry[baseName];
240
235
  if (!baseEntry) throw path.buildCodeFrameError(`Cannot find base StaticStyle '${baseName}'. Make sure it is defined before being extended.`);
241
236
  const overrideStyles = evaluateObjectExpression(stylesArg, path);
242
- const mergedStyles = resolveRecipes(mergeStyles(baseEntry.styles, overrideStyles));
237
+ const mergedStyles = resolveRecipesWith(mergeStyles(baseEntry.styles, overrideStyles), globalRecipes ?? null);
243
238
  const { keyframes, nameMap } = extractKeyframesFromStyles(mergedStyles, globalKeyframes);
244
239
  const properties = extractPropertiesFromStyles(mergedStyles, { autoPropertyTypes });
245
240
  const fontFaces = extractFontFaceFromStyles(mergedStyles, globalFontFace);
246
241
  const counterStyles = extractCounterStyleFromStyles(mergedStyles, globalCounterStyle);
242
+ const functions = extractFunctionsFromStyles(mergedStyles, globalFunction);
247
243
  const chunks = extractStylesWithChunks(mergedStyles);
248
244
  const className = chunks.length > 0 ? chunks.map((c) => c.className).join(" ") : "";
249
245
  const staticStyleObject = createStaticStyleAST(className, mergedStyles);
250
246
  if (mode === "inject") {
251
- const injectCall = createInjectCallAST(className, collectAllCSS(keyframes, properties, fontFaces, counterStyles, chunks, nameMap));
247
+ const injectCall = createInjectCallAST(className, collectAllCSS(keyframes, properties, fontFaces, counterStyles, functions, chunks, nameMap));
252
248
  path.replaceWith(t.sequenceExpression([injectCall, staticStyleObject]));
253
249
  } else {
254
- writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, chunks, nameMap, state.sourceFile);
250
+ writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, functions, chunks, nameMap, state.sourceFile);
255
251
  path.replaceWith(staticStyleObject);
256
252
  }
257
253
  registerIfVariableDeclaration(path, className, mergedStyles, state, globalRegistry);
258
254
  }
259
- /**
260
- * Handle tastyStatic(selector, styles) - removes the call entirely
261
- */
262
- function handleSelectorMode(path, args, cssWriter, mode, sourceFile, globalKeyframes, autoPropertyTypes, globalFontFace, globalCounterStyle) {
255
+ function handleSelectorMode(path, args, cssWriter, mode, sourceFile, globalKeyframes, autoPropertyTypes, globalFontFace, globalCounterStyle, globalFunction, globalRecipes) {
263
256
  if (args.length < 2) throw path.buildCodeFrameError("tastyStatic(selector, styles) requires two arguments");
264
257
  const selectorArg = args[0];
265
258
  const stylesArg = args[1];
266
259
  if (!t.isStringLiteral(selectorArg)) throw path.buildCodeFrameError("tastyStatic(selector, styles) first argument must be a string literal");
267
260
  if (!t.isObjectExpression(stylesArg)) throw path.buildCodeFrameError("tastyStatic(selector, styles) second argument must be a static object literal");
268
261
  const selector = selectorArg.value;
269
- const styles = resolveRecipes(evaluateObjectExpression(stylesArg, path));
262
+ const styles = resolveRecipesWith(evaluateObjectExpression(stylesArg, path), globalRecipes ?? null);
270
263
  const { keyframes, nameMap } = extractKeyframesFromStyles(styles, globalKeyframes);
271
264
  const properties = extractPropertiesFromStyles(styles, { autoPropertyTypes });
272
265
  const fontFaces = extractFontFaceFromStyles(styles, globalFontFace);
273
266
  const counterStyles = extractCounterStyleFromStyles(styles, globalCounterStyle);
267
+ const functions = extractFunctionsFromStyles(styles, globalFunction);
274
268
  const result = extractStylesForSelector(selector, styles);
275
269
  const selectorCSS = nameMap.size > 0 ? replaceAnimationNamesInCSS(result.css, nameMap) : result.css;
276
270
  if (mode === "inject") {
@@ -279,53 +273,48 @@ function handleSelectorMode(path, args, cssWriter, mode, sourceFile, globalKeyfr
279
273
  for (const prop of properties) cssParts.push(prop.css);
280
274
  for (const ff of fontFaces) cssParts.push(ff.css);
281
275
  for (const cs of counterStyles) cssParts.push(cs.css);
276
+ for (const fn of functions) cssParts.push(fn.css);
282
277
  cssParts.push(selectorCSS);
283
278
  const injectCall = createInjectCallAST(selector, cssParts.join("\n"));
284
279
  const parent = path.parentPath;
285
280
  if (parent && t.isExpressionStatement(parent.node)) parent.replaceWith(t.expressionStatement(injectCall));
286
281
  else path.replaceWith(injectCall);
287
282
  } else {
288
- writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, [], nameMap, sourceFile);
283
+ writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, functions, [], nameMap, sourceFile);
289
284
  cssWriter.add(selector, selectorCSS, sourceFile);
290
285
  const parent = path.parentPath;
291
286
  if (parent && t.isExpressionStatement(parent.node)) parent.remove();
292
287
  else path.replaceWith(t.identifier("undefined"));
293
288
  }
294
289
  }
295
- /**
296
- * Collect all extracted CSS parts into a single string (for inject mode).
297
- */
298
- function collectAllCSS(keyframes, properties, fontFaces, counterStyles, chunks, nameMap) {
290
+ function collectAllCSS(keyframes, properties, fontFaces, counterStyles, functions, chunks, nameMap) {
299
291
  const parts = [];
300
292
  for (const kf of keyframes) parts.push(kf.css);
301
293
  for (const prop of properties) parts.push(prop.css);
302
294
  for (const ff of fontFaces) parts.push(ff.css);
303
295
  for (const cs of counterStyles) parts.push(cs.css);
296
+ for (const fn of functions) parts.push(fn.css);
304
297
  for (const chunk of chunks) parts.push(nameMap.size > 0 ? replaceAnimationNamesInCSS(chunk.css, nameMap) : chunk.css);
305
298
  return parts.join("\n");
306
299
  }
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) {
300
+ function writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, functions, chunks, nameMap, sourceFile) {
311
301
  for (const kf of keyframes) cssWriter.add(kf.css, kf.css, sourceFile);
312
302
  for (const prop of properties) cssWriter.add(prop.css, prop.css, sourceFile);
313
303
  for (const ff of fontFaces) cssWriter.add(ff.css, ff.css, sourceFile);
314
304
  for (const cs of counterStyles) cssWriter.add(cs.css, cs.css, sourceFile);
305
+ for (const fn of functions) cssWriter.add(fn.css, fn.css, sourceFile);
315
306
  for (const chunk of chunks) {
316
307
  const css = nameMap.size > 0 ? replaceAnimationNamesInCSS(chunk.css, nameMap) : chunk.css;
317
308
  cssWriter.add(chunk.className, css, sourceFile);
318
309
  }
319
310
  }
320
- /**
321
- * Create an `_$i(id, css)` call expression AST node for inject mode.
322
- */
311
+ function extractCSSFromStyles(selector, styles) {
312
+ if (!styles || Object.keys(styles).length === 0) return void 0;
313
+ return extractStylesForSelector(selector, styles).css || void 0;
314
+ }
323
315
  function createInjectCallAST(id, css) {
324
316
  return t.callExpression(t.identifier("_$i"), [t.stringLiteral(id), t.stringLiteral(css)]);
325
317
  }
326
- /**
327
- * Create a StaticStyle object AST node
328
- */
329
318
  function createStaticStyleAST(className, styles) {
330
319
  return t.objectExpression([
331
320
  t.objectProperty(t.identifier("className"), t.stringLiteral(className)),
@@ -333,9 +322,6 @@ function createStaticStyleAST(className, styles) {
333
322
  t.objectMethod("method", t.identifier("toString"), [], t.blockStatement([t.returnStatement(t.memberExpression(t.thisExpression(), t.identifier("className")))]))
334
323
  ]);
335
324
  }
336
- /**
337
- * Register a StaticStyle in the registry if it's being assigned to a variable
338
- */
339
325
  function registerIfVariableDeclaration(path, className, styles, state, globalRegistry) {
340
326
  const parent = path.parentPath;
341
327
  if (parent && t.isVariableDeclarator(parent.node)) {
@@ -353,9 +339,6 @@ function registerIfVariableDeclaration(path, className, styles, state, globalReg
353
339
  }
354
340
  }
355
341
  }
356
- /**
357
- * Convert a JavaScript value to an AST node
358
- */
359
342
  function valueToAST(value) {
360
343
  if (value === null) return t.nullLiteral();
361
344
  if (value === void 0) return t.identifier("undefined");
@@ -369,10 +352,6 @@ function valueToAST(value) {
369
352
  }
370
353
  return t.identifier("undefined");
371
354
  }
372
- /**
373
- * Evaluate an ObjectExpression to a plain JavaScript object.
374
- * Only supports static values that can be determined at build time.
375
- */
376
355
  function evaluateObjectExpression(node, path) {
377
356
  const result = {};
378
357
  for (const prop of node.properties) {
@@ -386,9 +365,6 @@ function evaluateObjectExpression(node, path) {
386
365
  }
387
366
  return result;
388
367
  }
389
- /**
390
- * Evaluate an expression to a JavaScript value.
391
- */
392
368
  function evaluateExpression(node, path) {
393
369
  if (t.isStringLiteral(node)) return node.value;
394
370
  if (t.isNumericLiteral(node)) return node.value;
@@ -411,10 +387,6 @@ function evaluateExpression(node, path) {
411
387
  }
412
388
  throw path.buildCodeFrameError(`Dynamic expressions are not supported in tastyStatic() - got ${node.type}. All values must be static literals.`);
413
389
  }
414
- /**
415
- * Replace animation names in CSS string.
416
- * Wraps the keyframes replaceAnimationNames to work on full CSS blocks.
417
- */
418
390
  function replaceAnimationNamesInCSS(css, nameMap) {
419
391
  if (nameMap.size === 0) return css;
420
392
  return css.replace(/(animation(?:-name)?)\s*:\s*([^;}]+)/gi, (match, prop, value) => {
@@ -426,13 +398,10 @@ function replaceAnimationNamesInCSS(css, nameMap) {
426
398
  return `${prop}: ${newValue}`;
427
399
  });
428
400
  }
429
- /**
430
- * Escape special regex characters.
431
- */
432
401
  function escapeRegex(str) {
433
402
  return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
434
403
  }
435
404
  //#endregion
436
- export { clearWriterCache, babel_default as default };
405
+ export { babel_default as default };
437
406
 
438
407
  //# sourceMappingURL=babel.js.map