@tenphi/tasty 0.0.0-snapshot.1c5dff6 → 0.0.0-snapshot.1f1c00a

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 (331) hide show
  1. package/README.md +377 -238
  2. package/dist/babel-rZcEwPLM.d.ts +82 -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-CL4eRu2z.js +42 -0
  6. package/dist/chunks/build-config-CL4eRu2z.js.map +1 -0
  7. package/dist/chunks/collector-D2ARGT2L.js +208 -0
  8. package/dist/chunks/collector-D2ARGT2L.js.map +1 -0
  9. package/dist/chunks/config-engine-DEmmPPdp.js +272 -0
  10. package/dist/chunks/config-engine-DEmmPPdp.js.map +1 -0
  11. package/dist/chunks/css-definitions-DotDkIXt.js +876 -0
  12. package/dist/chunks/css-definitions-DotDkIXt.js.map +1 -0
  13. package/dist/chunks/css-resources-P7IBUUZs.js +142 -0
  14. package/dist/chunks/css-resources-P7IBUUZs.js.map +1 -0
  15. package/dist/chunks/debug-D8pg9RGI.js +502 -0
  16. package/dist/chunks/debug-D8pg9RGI.js.map +1 -0
  17. package/dist/chunks/dsl-DRhFWQzo.js +1378 -0
  18. package/dist/chunks/dsl-DRhFWQzo.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-BpxlOTbO.js +562 -0
  22. package/dist/chunks/react-runtime-BpxlOTbO.js.map +1 -0
  23. package/dist/chunks/runtime-engine-CKFXUH-A.js +2416 -0
  24. package/dist/chunks/runtime-engine-CKFXUH-A.js.map +1 -0
  25. package/dist/chunks/runtime-state-BxaLhVdP.js +127 -0
  26. package/dist/chunks/runtime-state-BxaLhVdP.js.map +1 -0
  27. package/dist/{utils/merge-styles.js → chunks/shared-utils-y-HjvPN4.js} +61 -58
  28. package/dist/chunks/shared-utils-y-HjvPN4.js.map +1 -0
  29. package/dist/chunks/style-engine-BBbBuSkT.js +5260 -0
  30. package/dist/chunks/style-engine-BBbBuSkT.js.map +1 -0
  31. package/dist/{zero/extractor.js → chunks/zero-engine-gJrKBRiw.js} +126 -66
  32. package/dist/chunks/zero-engine-gJrKBRiw.js.map +1 -0
  33. package/dist/collector-w4mBj5gd.d.ts +164 -0
  34. package/dist/config-CZWCzBr6.d.ts +1349 -0
  35. package/dist/core/index.d.ts +5 -33
  36. package/dist/core/index.js +9 -26
  37. package/dist/index-G9JuwM9p.d.ts +1920 -0
  38. package/dist/index.d.ts +5 -48
  39. package/dist/index.js +11 -33
  40. package/dist/{utils/merge-styles.d.ts → merge-styles-VXwJ0Frr.d.ts} +3 -4
  41. package/dist/ssr/astro-client.d.ts +1 -0
  42. package/dist/ssr/astro-client.js +6 -0
  43. package/dist/ssr/astro-client.js.map +1 -0
  44. package/dist/ssr/astro-middleware-extract-static.d.ts +10 -0
  45. package/dist/ssr/astro-middleware-extract-static.js +9 -0
  46. package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
  47. package/dist/ssr/astro-middleware-extract.d.ts +10 -0
  48. package/dist/ssr/astro-middleware-extract.js +9 -0
  49. package/dist/ssr/astro-middleware-extract.js.map +1 -0
  50. package/dist/ssr/astro-middleware-static.d.ts +17 -0
  51. package/dist/ssr/astro-middleware-static.js +7 -0
  52. package/dist/ssr/astro-middleware-static.js.map +1 -0
  53. package/dist/ssr/astro-middleware.d.ts +18 -0
  54. package/dist/ssr/astro-middleware.js +7 -0
  55. package/dist/ssr/astro-middleware.js.map +1 -0
  56. package/dist/ssr/astro.d.ts +127 -0
  57. package/dist/ssr/astro.js +221 -0
  58. package/dist/ssr/astro.js.map +1 -0
  59. package/dist/ssr/index.d.ts +36 -0
  60. package/dist/ssr/index.js +10 -0
  61. package/dist/ssr/index.js.map +1 -0
  62. package/dist/ssr/next-config.d.ts +64 -0
  63. package/dist/ssr/next-config.js +128 -0
  64. package/dist/ssr/next-config.js.map +1 -0
  65. package/dist/ssr/next.d.ts +46 -0
  66. package/dist/ssr/next.js +60 -0
  67. package/dist/ssr/next.js.map +1 -0
  68. package/dist/static/index.d.ts +90 -5
  69. package/dist/static/index.js +31 -4
  70. package/dist/static/index.js.map +1 -0
  71. package/dist/static/inject.d.ts +4 -0
  72. package/dist/static/inject.js +17 -0
  73. package/dist/static/inject.js.map +1 -0
  74. package/dist/types-JEY8PVYP.d.ts +1567 -0
  75. package/dist/zero/babel.d.ts +2 -113
  76. package/dist/zero/babel.js +230 -106
  77. package/dist/zero/babel.js.map +1 -1
  78. package/dist/zero/index.d.ts +80 -3
  79. package/dist/zero/index.js +2 -4
  80. package/dist/zero/next.d.ts +57 -33
  81. package/dist/zero/next.js +93 -59
  82. package/dist/zero/next.js.map +1 -1
  83. package/docs/README.md +39 -0
  84. package/docs/adoption.md +323 -0
  85. package/docs/ai-agents.md +250 -0
  86. package/docs/comparison.md +448 -0
  87. package/docs/configuration.md +684 -56
  88. package/docs/debug.md +170 -343
  89. package/docs/design-system.md +455 -0
  90. package/docs/dsl.md +1065 -0
  91. package/docs/getting-started.md +240 -0
  92. package/docs/injector.md +159 -53
  93. package/docs/methodology.md +648 -0
  94. package/docs/migration-v3.md +285 -0
  95. package/docs/pipeline.md +765 -0
  96. package/docs/plugins.md +353 -0
  97. package/docs/react-api.md +683 -0
  98. package/docs/runtime-benchmarks.md +388 -0
  99. package/docs/ssr.md +610 -0
  100. package/docs/styles.md +211 -63
  101. package/docs/tasty-static.md +273 -67
  102. package/package.json +182 -58
  103. package/tasty.config.ts +6 -0
  104. package/dist/_virtual/_rolldown/runtime.js +0 -8
  105. package/dist/chunks/cacheKey.js +0 -70
  106. package/dist/chunks/cacheKey.js.map +0 -1
  107. package/dist/chunks/definitions.d.ts +0 -37
  108. package/dist/chunks/definitions.js +0 -260
  109. package/dist/chunks/definitions.js.map +0 -1
  110. package/dist/chunks/renderChunk.js +0 -61
  111. package/dist/chunks/renderChunk.js.map +0 -1
  112. package/dist/config.d.ts +0 -288
  113. package/dist/config.js +0 -403
  114. package/dist/config.js.map +0 -1
  115. package/dist/debug.d.ts +0 -204
  116. package/dist/debug.js +0 -733
  117. package/dist/debug.js.map +0 -1
  118. package/dist/hooks/useGlobalStyles.d.ts +0 -27
  119. package/dist/hooks/useGlobalStyles.js +0 -56
  120. package/dist/hooks/useGlobalStyles.js.map +0 -1
  121. package/dist/hooks/useKeyframes.d.ts +0 -56
  122. package/dist/hooks/useKeyframes.js +0 -54
  123. package/dist/hooks/useKeyframes.js.map +0 -1
  124. package/dist/hooks/useProperty.d.ts +0 -79
  125. package/dist/hooks/useProperty.js +0 -91
  126. package/dist/hooks/useProperty.js.map +0 -1
  127. package/dist/hooks/useRawCSS.d.ts +0 -53
  128. package/dist/hooks/useRawCSS.js +0 -28
  129. package/dist/hooks/useRawCSS.js.map +0 -1
  130. package/dist/hooks/useStyles.d.ts +0 -40
  131. package/dist/hooks/useStyles.js +0 -169
  132. package/dist/hooks/useStyles.js.map +0 -1
  133. package/dist/injector/index.d.ts +0 -157
  134. package/dist/injector/index.js +0 -154
  135. package/dist/injector/index.js.map +0 -1
  136. package/dist/injector/injector.d.ts +0 -139
  137. package/dist/injector/injector.js +0 -417
  138. package/dist/injector/injector.js.map +0 -1
  139. package/dist/injector/sheet-manager.d.ts +0 -135
  140. package/dist/injector/sheet-manager.js +0 -728
  141. package/dist/injector/sheet-manager.js.map +0 -1
  142. package/dist/injector/types.d.ts +0 -144
  143. package/dist/keyframes/index.js +0 -206
  144. package/dist/keyframes/index.js.map +0 -1
  145. package/dist/parser/classify.js +0 -319
  146. package/dist/parser/classify.js.map +0 -1
  147. package/dist/parser/const.js +0 -33
  148. package/dist/parser/const.js.map +0 -1
  149. package/dist/parser/lru.js +0 -109
  150. package/dist/parser/lru.js.map +0 -1
  151. package/dist/parser/parser.d.ts +0 -25
  152. package/dist/parser/parser.js +0 -116
  153. package/dist/parser/parser.js.map +0 -1
  154. package/dist/parser/tokenizer.js +0 -69
  155. package/dist/parser/tokenizer.js.map +0 -1
  156. package/dist/parser/types.d.ts +0 -51
  157. package/dist/parser/types.js +0 -46
  158. package/dist/parser/types.js.map +0 -1
  159. package/dist/pipeline/conditions.d.ts +0 -134
  160. package/dist/pipeline/conditions.js +0 -406
  161. package/dist/pipeline/conditions.js.map +0 -1
  162. package/dist/pipeline/exclusive.js +0 -231
  163. package/dist/pipeline/exclusive.js.map +0 -1
  164. package/dist/pipeline/index.d.ts +0 -53
  165. package/dist/pipeline/index.js +0 -660
  166. package/dist/pipeline/index.js.map +0 -1
  167. package/dist/pipeline/materialize.js +0 -856
  168. package/dist/pipeline/materialize.js.map +0 -1
  169. package/dist/pipeline/parseStateKey.d.ts +0 -15
  170. package/dist/pipeline/parseStateKey.js +0 -451
  171. package/dist/pipeline/parseStateKey.js.map +0 -1
  172. package/dist/pipeline/simplify.js +0 -516
  173. package/dist/pipeline/simplify.js.map +0 -1
  174. package/dist/pipeline/warnings.js +0 -18
  175. package/dist/pipeline/warnings.js.map +0 -1
  176. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  177. package/dist/plugins/okhsl-plugin.js +0 -371
  178. package/dist/plugins/okhsl-plugin.js.map +0 -1
  179. package/dist/plugins/types.d.ts +0 -69
  180. package/dist/properties/index.js +0 -221
  181. package/dist/properties/index.js.map +0 -1
  182. package/dist/properties/property-type-resolver.d.ts +0 -24
  183. package/dist/properties/property-type-resolver.js +0 -83
  184. package/dist/properties/property-type-resolver.js.map +0 -1
  185. package/dist/states/index.d.ts +0 -49
  186. package/dist/states/index.js +0 -416
  187. package/dist/states/index.js.map +0 -1
  188. package/dist/static/tastyStatic.d.ts +0 -46
  189. package/dist/static/tastyStatic.js +0 -31
  190. package/dist/static/tastyStatic.js.map +0 -1
  191. package/dist/static/types.d.ts +0 -49
  192. package/dist/static/types.js +0 -24
  193. package/dist/static/types.js.map +0 -1
  194. package/dist/styles/align.d.ts +0 -15
  195. package/dist/styles/align.js +0 -14
  196. package/dist/styles/align.js.map +0 -1
  197. package/dist/styles/border.d.ts +0 -25
  198. package/dist/styles/border.js +0 -114
  199. package/dist/styles/border.js.map +0 -1
  200. package/dist/styles/color.d.ts +0 -14
  201. package/dist/styles/color.js +0 -23
  202. package/dist/styles/color.js.map +0 -1
  203. package/dist/styles/createStyle.js +0 -77
  204. package/dist/styles/createStyle.js.map +0 -1
  205. package/dist/styles/dimension.js +0 -97
  206. package/dist/styles/dimension.js.map +0 -1
  207. package/dist/styles/display.d.ts +0 -37
  208. package/dist/styles/display.js +0 -67
  209. package/dist/styles/display.js.map +0 -1
  210. package/dist/styles/fade.d.ts +0 -15
  211. package/dist/styles/fade.js +0 -58
  212. package/dist/styles/fade.js.map +0 -1
  213. package/dist/styles/fill.d.ts +0 -42
  214. package/dist/styles/fill.js +0 -52
  215. package/dist/styles/fill.js.map +0 -1
  216. package/dist/styles/flow.d.ts +0 -16
  217. package/dist/styles/flow.js +0 -12
  218. package/dist/styles/flow.js.map +0 -1
  219. package/dist/styles/gap.d.ts +0 -31
  220. package/dist/styles/gap.js +0 -37
  221. package/dist/styles/gap.js.map +0 -1
  222. package/dist/styles/height.d.ts +0 -17
  223. package/dist/styles/height.js +0 -20
  224. package/dist/styles/height.js.map +0 -1
  225. package/dist/styles/index.d.ts +0 -2
  226. package/dist/styles/index.js +0 -9
  227. package/dist/styles/index.js.map +0 -1
  228. package/dist/styles/inset.d.ts +0 -52
  229. package/dist/styles/inset.js +0 -150
  230. package/dist/styles/inset.js.map +0 -1
  231. package/dist/styles/justify.d.ts +0 -15
  232. package/dist/styles/justify.js +0 -14
  233. package/dist/styles/justify.js.map +0 -1
  234. package/dist/styles/list.d.ts +0 -16
  235. package/dist/styles/list.js +0 -98
  236. package/dist/styles/list.js.map +0 -1
  237. package/dist/styles/margin.d.ts +0 -24
  238. package/dist/styles/margin.js +0 -104
  239. package/dist/styles/margin.js.map +0 -1
  240. package/dist/styles/outline.d.ts +0 -29
  241. package/dist/styles/outline.js +0 -65
  242. package/dist/styles/outline.js.map +0 -1
  243. package/dist/styles/padding.d.ts +0 -24
  244. package/dist/styles/padding.js +0 -104
  245. package/dist/styles/padding.js.map +0 -1
  246. package/dist/styles/predefined.d.ts +0 -73
  247. package/dist/styles/predefined.js +0 -241
  248. package/dist/styles/predefined.js.map +0 -1
  249. package/dist/styles/preset.d.ts +0 -47
  250. package/dist/styles/preset.js +0 -126
  251. package/dist/styles/preset.js.map +0 -1
  252. package/dist/styles/radius.d.ts +0 -14
  253. package/dist/styles/radius.js +0 -51
  254. package/dist/styles/radius.js.map +0 -1
  255. package/dist/styles/scrollbar.d.ts +0 -23
  256. package/dist/styles/scrollbar.js +0 -34
  257. package/dist/styles/scrollbar.js.map +0 -1
  258. package/dist/styles/shadow.d.ts +0 -14
  259. package/dist/styles/shadow.js +0 -24
  260. package/dist/styles/shadow.js.map +0 -1
  261. package/dist/styles/styledScrollbar.d.ts +0 -47
  262. package/dist/styles/styledScrollbar.js +0 -38
  263. package/dist/styles/styledScrollbar.js.map +0 -1
  264. package/dist/styles/transition.d.ts +0 -14
  265. package/dist/styles/transition.js +0 -158
  266. package/dist/styles/transition.js.map +0 -1
  267. package/dist/styles/types.d.ts +0 -498
  268. package/dist/styles/width.d.ts +0 -17
  269. package/dist/styles/width.js +0 -20
  270. package/dist/styles/width.js.map +0 -1
  271. package/dist/tasty.d.ts +0 -982
  272. package/dist/tasty.js +0 -206
  273. package/dist/tasty.js.map +0 -1
  274. package/dist/tokens/typography.d.ts +0 -19
  275. package/dist/tokens/typography.js +0 -237
  276. package/dist/tokens/typography.js.map +0 -1
  277. package/dist/types.d.ts +0 -184
  278. package/dist/utils/cache-wrapper.js +0 -26
  279. package/dist/utils/cache-wrapper.js.map +0 -1
  280. package/dist/utils/case-converter.js +0 -8
  281. package/dist/utils/case-converter.js.map +0 -1
  282. package/dist/utils/colors.d.ts +0 -5
  283. package/dist/utils/colors.js +0 -9
  284. package/dist/utils/colors.js.map +0 -1
  285. package/dist/utils/css-types.d.ts +0 -7
  286. package/dist/utils/dotize.d.ts +0 -26
  287. package/dist/utils/dotize.js +0 -122
  288. package/dist/utils/dotize.js.map +0 -1
  289. package/dist/utils/filter-base-props.d.ts +0 -15
  290. package/dist/utils/filter-base-props.js +0 -45
  291. package/dist/utils/filter-base-props.js.map +0 -1
  292. package/dist/utils/get-display-name.d.ts +0 -7
  293. package/dist/utils/get-display-name.js +0 -10
  294. package/dist/utils/get-display-name.js.map +0 -1
  295. package/dist/utils/hsl-to-rgb.js +0 -38
  296. package/dist/utils/hsl-to-rgb.js.map +0 -1
  297. package/dist/utils/is-dev-env.js +0 -19
  298. package/dist/utils/is-dev-env.js.map +0 -1
  299. package/dist/utils/is-valid-element-type.js +0 -15
  300. package/dist/utils/is-valid-element-type.js.map +0 -1
  301. package/dist/utils/merge-styles.js.map +0 -1
  302. package/dist/utils/mod-attrs.d.ts +0 -8
  303. package/dist/utils/mod-attrs.js +0 -21
  304. package/dist/utils/mod-attrs.js.map +0 -1
  305. package/dist/utils/okhsl-to-rgb.js +0 -296
  306. package/dist/utils/okhsl-to-rgb.js.map +0 -1
  307. package/dist/utils/process-tokens.d.ts +0 -31
  308. package/dist/utils/process-tokens.js +0 -171
  309. package/dist/utils/process-tokens.js.map +0 -1
  310. package/dist/utils/resolve-recipes.d.ts +0 -17
  311. package/dist/utils/resolve-recipes.js +0 -147
  312. package/dist/utils/resolve-recipes.js.map +0 -1
  313. package/dist/utils/selector-transform.js +0 -32
  314. package/dist/utils/selector-transform.js.map +0 -1
  315. package/dist/utils/string.js +0 -8
  316. package/dist/utils/string.js.map +0 -1
  317. package/dist/utils/styles.d.ts +0 -177
  318. package/dist/utils/styles.js +0 -730
  319. package/dist/utils/styles.js.map +0 -1
  320. package/dist/utils/typography.d.ts +0 -36
  321. package/dist/utils/typography.js +0 -53
  322. package/dist/utils/typography.js.map +0 -1
  323. package/dist/utils/warnings.d.ts +0 -16
  324. package/dist/utils/warnings.js +0 -16
  325. package/dist/utils/warnings.js.map +0 -1
  326. package/dist/zero/css-writer.d.ts +0 -45
  327. package/dist/zero/css-writer.js +0 -74
  328. package/dist/zero/css-writer.js.map +0 -1
  329. package/dist/zero/extractor.d.ts +0 -24
  330. package/dist/zero/extractor.js.map +0 -1
  331. package/docs/usage.md +0 -695
@@ -1,113 +1,2 @@
1
- import { KeyframesSteps } from "../injector/types.js";
2
- import { StyleDetails, UnitHandler } from "../parser/types.js";
3
- import { StyleHandlerDefinition } from "../utils/styles.js";
4
- import { 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, handlers, or tokens.
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
- * Custom style handlers that transform style properties into CSS declarations.
68
- * Handlers replace built-in handlers for the same style name.
69
- * @example
70
- * ```ts
71
- * handlers: {
72
- * fill: ({ fill }) => fill ? { 'background-color': fill } : undefined,
73
- * elevation: ({ elevation }) => ({
74
- * 'box-shadow': `0 ${elevation}px ${elevation * 2}px rgba(0,0,0,0.1)`,
75
- * }),
76
- * }
77
- * ```
78
- */
79
- handlers?: Record<string, StyleHandlerDefinition>;
80
- /**
81
- * Predefined tokens that are replaced during style parsing.
82
- * Use `$name` for custom properties and `#name` for color tokens.
83
- * @example { $spacing: '2x', '#accent': '#purple' }
84
- */
85
- tokens?: Record<`$${string}` | `#${string}`, string | number>;
86
- /**
87
- * Predefined style recipes -- named style bundles that can be applied via `recipe` style property.
88
- * Recipe values are flat tasty styles (no sub-element keys).
89
- * @example
90
- * ```ts
91
- * recipes: {
92
- * card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
93
- * elevated: { shadow: '2x 2x 4x #shadow' },
94
- * }
95
- * ```
96
- */
97
- recipes?: Record<string, RecipeStyles>;
98
- /**
99
- * Automatically infer and register CSS @property declarations from values.
100
- * @default true
101
- */
102
- autoPropertyTypes?: boolean;
103
- }
104
- interface TastyZeroBabelOptions {
105
- /** Output path for generated CSS (default: 'tasty.css') */
106
- output?: string;
107
- /** Tasty configuration for build-time processing */
108
- config?: TastyZeroConfig;
109
- }
110
- declare const _default: (api: object, options: TastyZeroBabelOptions | null | undefined, dirname: string) => _babel_core0.PluginObj<PluginPass>;
111
- //#endregion
112
- export { TastyZeroBabelOptions, TastyZeroConfig, _default as default };
113
- //# sourceMappingURL=babel.d.ts.map
1
+ import { n as _default, r as TastyZeroConfig, t as TastyZeroBabelOptions } from "../babel-rZcEwPLM.js";
2
+ export { TastyZeroBabelOptions, type TastyZeroConfig, _default as default };
@@ -1,58 +1,152 @@
1
- import { configure } from "../config.js";
2
- import { mergeStyles } from "../utils/merge-styles.js";
3
- import { resolveRecipes } from "../utils/resolve-recipes.js";
4
- import { extractKeyframesFromStyles, extractPropertiesFromStyles, extractStylesForSelector, extractStylesWithChunks } from "./extractor.js";
5
- import { CSSWriter } from "./css-writer.js";
1
+ import { t as mergeStyles } from "../chunks/shared-utils-y-HjvPN4.js";
2
+ import "../chunks/css-definitions-DotDkIXt.js";
3
+ import { t as resolveRecipesWith } from "../chunks/config-engine-DEmmPPdp.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-gJrKBRiw.js";
5
+ import { n as functionsForExtraction, r as resetZeroConfig, t as configureZero } from "../chunks/build-config-CL4eRu2z.js";
6
+ import * as fs from "fs";
7
+ import * as path from "path";
6
8
  import { declare } from "@babel/helper-plugin-utils";
7
9
  import * as t from "@babel/types";
8
-
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
9
20
  //#region src/zero/babel.ts
10
- /**
11
- * Babel plugin for zero-runtime tasty static site generation.
12
- *
13
- * Transforms:
14
- * - `tastyStatic(styles)` → StaticStyle object { className, styles, toString() }
15
- * - `tastyStatic(base, styles)` → StaticStyle object with merged styles
16
- * - `tastyStatic(selector, styles)` → removed entirely
17
- *
18
- * Usage:
19
- * ```javascript
20
- * // babel.config.js
21
- * module.exports = {
22
- * plugins: [
23
- * ['@tenphi/tasty/babel-plugin', { output: 'public/tasty.css' }]
24
- * ]
25
- * };
26
- * ```
27
- */
21
+ function mtime(filePath) {
22
+ try {
23
+ return fs.statSync(filePath).mtimeMs;
24
+ } catch {
25
+ return null;
26
+ }
27
+ }
28
+ function clearRequireCacheTree(filePath) {
29
+ let resolved;
30
+ try {
31
+ resolved = __require.resolve(filePath);
32
+ } catch {
33
+ return;
34
+ }
35
+ const mod = __require.cache[resolved];
36
+ if (!mod) return;
37
+ const dir = resolved.substring(0, resolved.lastIndexOf("/"));
38
+ if (mod.children) {
39
+ for (const child of mod.children) if (child.id.startsWith(dir) && !child.id.includes("node_modules")) clearRequireCacheTree(child.id);
40
+ }
41
+ delete __require.cache[resolved];
42
+ }
28
43
  var babel_default = declare((api, options) => {
29
44
  api.assertVersion(7);
45
+ const mode = options.mode ?? "file";
30
46
  const outputPath = options.output || "tasty.css";
31
- const config = options.config || {};
32
- const devMode = config.devMode ?? false;
33
- configure(config);
34
- const cssWriter = new CSSWriter(outputPath, { devMode });
35
- const globalRegistry = {};
47
+ const resolvedOutputPath = path.resolve(outputPath);
48
+ const injectImport = options.injectImport ?? true;
49
+ if (mode === "file" && injectImport) {
50
+ const dir = path.dirname(resolvedOutputPath);
51
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
52
+ if (!fs.existsSync(resolvedOutputPath)) fs.writeFileSync(resolvedOutputPath, "/* Generated by @tenphi/tasty/zero - DO NOT EDIT */\n");
53
+ }
54
+ const configDeps = [...options.configFile ? [options.configFile] : [], ...options.configDeps || []];
55
+ const configKey = configDeps.length > 0 ? configDeps.map(mtime).join(",") : "";
56
+ if (configDeps.length > 0) {
57
+ api.cache.using(() => configKey);
58
+ for (const dep of configDeps) try {
59
+ api.addExternalDependency(dep);
60
+ } catch {}
61
+ } else api.cache.forever();
62
+ if (configDeps.length > 0) for (const dep of configDeps) clearRequireCacheTree(dep);
63
+ const cached = writerCache.get(resolvedOutputPath);
64
+ if (!cached || cached.configKey !== configKey) {
65
+ const configOption = options.config;
66
+ let resolvedConfig;
67
+ if (configOption) resolvedConfig = typeof configOption === "function" ? configOption() : configOption;
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 = {};
72
+ const devMode = resolvedConfig.devMode ?? false;
73
+ resetZeroConfig();
74
+ const finalConfig = {
75
+ namePrefix: "ts",
76
+ ...resolvedConfig
77
+ };
78
+ const config = configureZero(finalConfig);
79
+ setExtractorNamePrefix(finalConfig.namePrefix ?? "ts");
80
+ const newWriter = new CSSWriter(outputPath, { devMode });
81
+ if (mode !== "inject") {
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);
87
+ }
88
+ }
89
+ writerCache.set(resolvedOutputPath, {
90
+ writer: newWriter,
91
+ configKey,
92
+ registry: {},
93
+ config
94
+ });
95
+ }
96
+ const entry = writerCache.get(resolvedOutputPath);
97
+ const cssWriter = entry.writer;
98
+ const globalRegistry = entry.registry;
99
+ const config = entry.config;
100
+ const sourceConfig = config.source;
101
+ const devMode = sourceConfig.devMode ?? false;
102
+ setExtractorNamePrefix(sourceConfig.namePrefix ?? "ts");
103
+ let tokenCSS;
104
+ let globalStylesCSS;
105
+ if (mode === "inject") {
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;
115
+ }
116
+ }
36
117
  return {
37
118
  name: "tasty-zero",
38
119
  pre() {
39
120
  this.staticStyleRegistry = {};
121
+ this._fileAddedCSS = false;
40
122
  if (devMode && this.filename) this.sourceFile = this.filename.split("/").pop() || this.filename;
41
123
  },
42
124
  visitor: {
43
- ImportDeclaration(path) {
44
- const source = path.node.source.value;
45
- if (source === "@tenphi/tasty/static" || source.endsWith("/tasty/static")) path.remove();
125
+ ImportDeclaration(nodePath, state) {
126
+ const source = nodePath.node.source.value;
127
+ if (source === "@tenphi/tasty/static" || source.endsWith("/tasty/static")) {
128
+ if (mode === "inject") nodePath.replaceWith(t.importDeclaration([t.importSpecifier(t.identifier("_$i"), t.identifier("injectCSS"))], t.stringLiteral("@tenphi/tasty/static/inject")));
129
+ else if (injectImport) {
130
+ let importPath = resolvedOutputPath;
131
+ if (state.filename) {
132
+ const sourceDir = path.dirname(state.filename);
133
+ importPath = path.relative(sourceDir, resolvedOutputPath);
134
+ if (!importPath.startsWith(".")) importPath = "./" + importPath;
135
+ }
136
+ nodePath.replaceWith(t.importDeclaration([], t.stringLiteral(importPath)));
137
+ } else nodePath.remove();
138
+ }
46
139
  },
47
140
  CallExpression(path, state) {
48
141
  const callee = path.node.callee;
49
142
  if (!t.isIdentifier(callee, { name: "tastyStatic" })) return;
143
+ state._fileAddedCSS = true;
50
144
  const args = path.node.arguments;
51
145
  if (args.length === 0) throw path.buildCodeFrameError("tastyStatic() requires at least one argument");
52
146
  const firstArg = args[0];
53
- if (t.isStringLiteral(firstArg)) handleSelectorMode(path, args, cssWriter, state.sourceFile, config.keyframes, config.autoPropertyTypes);
54
- else if (t.isObjectExpression(firstArg)) handleStylesMode(path, args, cssWriter, state, globalRegistry, config.keyframes, config.autoPropertyTypes);
55
- else if (t.isIdentifier(firstArg)) handleExtensionMode(path, args, cssWriter, state, globalRegistry, config.keyframes, config.autoPropertyTypes);
147
+ 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);
148
+ 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);
149
+ 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);
56
150
  else throw path.buildCodeFrameError("tastyStatic() first argument must be an object (styles), identifier (base StaticStyle), or string (selector)");
57
151
  },
58
152
  VariableDeclarator(path, state) {
@@ -76,57 +170,64 @@ var babel_default = declare((api, options) => {
76
170
  }
77
171
  },
78
172
  post() {
79
- if (cssWriter.size > 0) cssWriter.write();
173
+ if (mode === "inject") {
174
+ if (this._fileAddedCSS && (tokenCSS || globalStylesCSS)) {
175
+ const program = this.file.ast.program;
176
+ let insertIndex = 0;
177
+ for (let i = 0; i < program.body.length; i++) if (t.isImportDeclaration(program.body[i])) insertIndex = i + 1;
178
+ if (tokenCSS) {
179
+ const injectCall = createInjectCallAST(":root", tokenCSS);
180
+ program.body.splice(insertIndex, 0, t.expressionStatement(injectCall));
181
+ insertIndex++;
182
+ }
183
+ if (globalStylesCSS) for (const [selector, css] of globalStylesCSS) {
184
+ const injectCall = createInjectCallAST(selector, css);
185
+ program.body.splice(insertIndex, 0, t.expressionStatement(injectCall));
186
+ insertIndex++;
187
+ }
188
+ }
189
+ return;
190
+ }
191
+ if (this._fileAddedCSS && cssWriter.size > 0) cssWriter.write();
80
192
  }
81
193
  };
82
194
  });
83
- /**
84
- * Check if an object expression looks like a StaticStyle object
85
- */
86
195
  function isStaticStyleObject(node) {
87
196
  const hasClassName = node.properties.some((p) => t.isObjectProperty(p) && t.isIdentifier(p.key, { name: "className" }));
88
197
  const hasStyles = node.properties.some((p) => t.isObjectProperty(p) && t.isIdentifier(p.key, { name: "styles" }));
89
198
  return hasClassName && hasStyles;
90
199
  }
91
- /**
92
- * Extract styles object from a StaticStyle object expression
93
- */
94
200
  function extractStylesFromStaticStyleObject(node, path) {
95
201
  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);
96
202
  return null;
97
203
  }
98
- /**
99
- * Extract className from a StaticStyle object expression
100
- */
101
204
  function extractClassNameFromStaticStyleObject(node) {
102
205
  for (const prop of node.properties) if (t.isObjectProperty(prop) && t.isIdentifier(prop.key, { name: "className" }) && t.isStringLiteral(prop.value)) return prop.value.value;
103
206
  return null;
104
207
  }
105
- /**
106
- * Handle tastyStatic(styles) - returns StaticStyle object
107
- */
108
- function handleStylesMode(path, args, cssWriter, state, globalRegistry, globalKeyframes, autoPropertyTypes) {
208
+ function handleStylesMode(path, args, cssWriter, state, globalRegistry, mode, globalKeyframes, autoPropertyTypes, globalFontFace, globalCounterStyle, globalFunction, globalRecipes) {
109
209
  const stylesArg = args[0];
110
210
  if (!t.isObjectExpression(stylesArg)) throw path.buildCodeFrameError("tastyStatic(styles) argument must be a static object literal");
111
- const styles = resolveRecipes(evaluateObjectExpression(stylesArg, path));
211
+ const rawStyles = evaluateObjectExpression(stylesArg, path);
212
+ const styles = resolveRecipesWith(rawStyles, globalRecipes ?? null);
112
213
  const { keyframes, nameMap } = extractKeyframesFromStyles(styles, globalKeyframes);
113
- for (const kf of keyframes) cssWriter.add(kf.css, kf.css, state.sourceFile);
114
214
  const properties = extractPropertiesFromStyles(styles, { autoPropertyTypes });
115
- for (const prop of properties) cssWriter.add(prop.css, prop.css, state.sourceFile);
215
+ const fontFaces = extractFontFaceFromStyles(styles, globalFontFace);
216
+ const counterStyles = extractCounterStyleFromStyles(styles, globalCounterStyle);
217
+ const functions = extractFunctionsFromStyles(styles, globalFunction);
116
218
  const chunks = extractStylesWithChunks(styles);
117
- for (const chunk of chunks) {
118
- const css = nameMap.size > 0 ? replaceAnimationNamesInCSS(chunk.css, nameMap) : chunk.css;
119
- cssWriter.add(chunk.className, css, state.sourceFile);
120
- }
121
219
  const className = chunks.length > 0 ? chunks.map((c) => c.className).join(" ") : "";
122
220
  const staticStyleObject = createStaticStyleAST(className, styles);
123
- path.replaceWith(staticStyleObject);
221
+ if (mode === "inject") {
222
+ const injectCall = createInjectCallAST(className, collectAllCSS(keyframes, properties, fontFaces, counterStyles, functions, chunks, nameMap));
223
+ path.replaceWith(t.sequenceExpression([injectCall, staticStyleObject]));
224
+ } else {
225
+ writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, functions, chunks, nameMap, state.sourceFile);
226
+ path.replaceWith(staticStyleObject);
227
+ }
124
228
  registerIfVariableDeclaration(path, className, styles, state, globalRegistry);
125
229
  }
126
- /**
127
- * Handle tastyStatic(base, styles) - extends base with additional styles
128
- */
129
- function handleExtensionMode(path, args, cssWriter, state, globalRegistry, globalKeyframes, autoPropertyTypes) {
230
+ function handleExtensionMode(path, args, cssWriter, state, globalRegistry, mode, globalKeyframes, autoPropertyTypes, globalFontFace, globalCounterStyle, globalFunction, globalRecipes) {
130
231
  if (args.length < 2) throw path.buildCodeFrameError("tastyStatic(base, styles) requires two arguments");
131
232
  const baseArg = args[0];
132
233
  const stylesArg = args[1];
@@ -136,46 +237,88 @@ function handleExtensionMode(path, args, cssWriter, state, globalRegistry, globa
136
237
  const baseEntry = state.staticStyleRegistry[baseName] || globalRegistry[baseName];
137
238
  if (!baseEntry) throw path.buildCodeFrameError(`Cannot find base StaticStyle '${baseName}'. Make sure it is defined before being extended.`);
138
239
  const overrideStyles = evaluateObjectExpression(stylesArg, path);
139
- const mergedStyles = resolveRecipes(mergeStyles(baseEntry.styles, overrideStyles));
240
+ const mergedStyles = resolveRecipesWith(mergeStyles(baseEntry.styles, overrideStyles), globalRecipes ?? null);
140
241
  const { keyframes, nameMap } = extractKeyframesFromStyles(mergedStyles, globalKeyframes);
141
- for (const kf of keyframes) cssWriter.add(kf.css, kf.css, state.sourceFile);
142
242
  const properties = extractPropertiesFromStyles(mergedStyles, { autoPropertyTypes });
143
- for (const prop of properties) cssWriter.add(prop.css, prop.css, state.sourceFile);
243
+ const fontFaces = extractFontFaceFromStyles(mergedStyles, globalFontFace);
244
+ const counterStyles = extractCounterStyleFromStyles(mergedStyles, globalCounterStyle);
245
+ const functions = extractFunctionsFromStyles(mergedStyles, globalFunction);
144
246
  const chunks = extractStylesWithChunks(mergedStyles);
145
- for (const chunk of chunks) {
146
- const css = nameMap.size > 0 ? replaceAnimationNamesInCSS(chunk.css, nameMap) : chunk.css;
147
- cssWriter.add(chunk.className, css, state.sourceFile);
148
- }
149
247
  const className = chunks.length > 0 ? chunks.map((c) => c.className).join(" ") : "";
150
248
  const staticStyleObject = createStaticStyleAST(className, mergedStyles);
151
- path.replaceWith(staticStyleObject);
249
+ if (mode === "inject") {
250
+ const injectCall = createInjectCallAST(className, collectAllCSS(keyframes, properties, fontFaces, counterStyles, functions, chunks, nameMap));
251
+ path.replaceWith(t.sequenceExpression([injectCall, staticStyleObject]));
252
+ } else {
253
+ writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, functions, chunks, nameMap, state.sourceFile);
254
+ path.replaceWith(staticStyleObject);
255
+ }
152
256
  registerIfVariableDeclaration(path, className, mergedStyles, state, globalRegistry);
153
257
  }
154
- /**
155
- * Handle tastyStatic(selector, styles) - removes the call entirely
156
- */
157
- function handleSelectorMode(path, args, cssWriter, sourceFile, globalKeyframes, autoPropertyTypes) {
258
+ function handleSelectorMode(path, args, cssWriter, mode, sourceFile, globalKeyframes, autoPropertyTypes, globalFontFace, globalCounterStyle, globalFunction, globalRecipes) {
158
259
  if (args.length < 2) throw path.buildCodeFrameError("tastyStatic(selector, styles) requires two arguments");
159
260
  const selectorArg = args[0];
160
261
  const stylesArg = args[1];
161
262
  if (!t.isStringLiteral(selectorArg)) throw path.buildCodeFrameError("tastyStatic(selector, styles) first argument must be a string literal");
162
263
  if (!t.isObjectExpression(stylesArg)) throw path.buildCodeFrameError("tastyStatic(selector, styles) second argument must be a static object literal");
163
264
  const selector = selectorArg.value;
164
- const styles = resolveRecipes(evaluateObjectExpression(stylesArg, path));
265
+ const rawStyles = evaluateObjectExpression(stylesArg, path);
266
+ const styles = resolveRecipesWith(rawStyles, globalRecipes ?? null);
165
267
  const { keyframes, nameMap } = extractKeyframesFromStyles(styles, globalKeyframes);
166
- for (const kf of keyframes) cssWriter.add(kf.css, kf.css, sourceFile);
167
268
  const properties = extractPropertiesFromStyles(styles, { autoPropertyTypes });
168
- for (const prop of properties) cssWriter.add(prop.css, prop.css, sourceFile);
269
+ const fontFaces = extractFontFaceFromStyles(styles, globalFontFace);
270
+ const counterStyles = extractCounterStyleFromStyles(styles, globalCounterStyle);
271
+ const functions = extractFunctionsFromStyles(styles, globalFunction);
169
272
  const result = extractStylesForSelector(selector, styles);
170
- const css = nameMap.size > 0 ? replaceAnimationNamesInCSS(result.css, nameMap) : result.css;
171
- cssWriter.add(selector, css, sourceFile);
172
- const parent = path.parentPath;
173
- if (parent && t.isExpressionStatement(parent.node)) parent.remove();
174
- else path.replaceWith(t.identifier("undefined"));
273
+ const selectorCSS = nameMap.size > 0 ? replaceAnimationNamesInCSS(result.css, nameMap) : result.css;
274
+ if (mode === "inject") {
275
+ const cssParts = [];
276
+ for (const kf of keyframes) cssParts.push(kf.css);
277
+ for (const prop of properties) cssParts.push(prop.css);
278
+ for (const ff of fontFaces) cssParts.push(ff.css);
279
+ for (const cs of counterStyles) cssParts.push(cs.css);
280
+ for (const fn of functions) cssParts.push(fn.css);
281
+ cssParts.push(selectorCSS);
282
+ const injectCall = createInjectCallAST(selector, cssParts.join("\n"));
283
+ const parent = path.parentPath;
284
+ if (parent && t.isExpressionStatement(parent.node)) parent.replaceWith(t.expressionStatement(injectCall));
285
+ else path.replaceWith(injectCall);
286
+ } else {
287
+ writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, functions, [], nameMap, sourceFile);
288
+ cssWriter.add(selector, selectorCSS, sourceFile);
289
+ const parent = path.parentPath;
290
+ if (parent && t.isExpressionStatement(parent.node)) parent.remove();
291
+ else path.replaceWith(t.identifier("undefined"));
292
+ }
293
+ }
294
+ function collectAllCSS(keyframes, properties, fontFaces, counterStyles, functions, chunks, nameMap) {
295
+ const parts = [];
296
+ for (const kf of keyframes) parts.push(kf.css);
297
+ for (const prop of properties) parts.push(prop.css);
298
+ for (const ff of fontFaces) parts.push(ff.css);
299
+ for (const cs of counterStyles) parts.push(cs.css);
300
+ for (const fn of functions) parts.push(fn.css);
301
+ for (const chunk of chunks) parts.push(nameMap.size > 0 ? replaceAnimationNamesInCSS(chunk.css, nameMap) : chunk.css);
302
+ return parts.join("\n");
303
+ }
304
+ function writeCSSToWriter(cssWriter, keyframes, properties, fontFaces, counterStyles, functions, chunks, nameMap, sourceFile) {
305
+ for (const kf of keyframes) cssWriter.add(kf.css, kf.css, sourceFile);
306
+ for (const prop of properties) cssWriter.add(prop.css, prop.css, sourceFile);
307
+ for (const ff of fontFaces) cssWriter.add(ff.css, ff.css, sourceFile);
308
+ for (const cs of counterStyles) cssWriter.add(cs.css, cs.css, sourceFile);
309
+ for (const fn of functions) cssWriter.add(fn.css, fn.css, sourceFile);
310
+ for (const chunk of chunks) {
311
+ const css = nameMap.size > 0 ? replaceAnimationNamesInCSS(chunk.css, nameMap) : chunk.css;
312
+ cssWriter.add(chunk.className, css, sourceFile);
313
+ }
314
+ }
315
+ function extractCSSFromStyles(selector, styles) {
316
+ if (!styles || Object.keys(styles).length === 0) return void 0;
317
+ return extractStylesForSelector(selector, styles).css || void 0;
318
+ }
319
+ function createInjectCallAST(id, css) {
320
+ return t.callExpression(t.identifier("_$i"), [t.stringLiteral(id), t.stringLiteral(css)]);
175
321
  }
176
- /**
177
- * Create a StaticStyle object AST node
178
- */
179
322
  function createStaticStyleAST(className, styles) {
180
323
  return t.objectExpression([
181
324
  t.objectProperty(t.identifier("className"), t.stringLiteral(className)),
@@ -183,9 +326,6 @@ function createStaticStyleAST(className, styles) {
183
326
  t.objectMethod("method", t.identifier("toString"), [], t.blockStatement([t.returnStatement(t.memberExpression(t.thisExpression(), t.identifier("className")))]))
184
327
  ]);
185
328
  }
186
- /**
187
- * Register a StaticStyle in the registry if it's being assigned to a variable
188
- */
189
329
  function registerIfVariableDeclaration(path, className, styles, state, globalRegistry) {
190
330
  const parent = path.parentPath;
191
331
  if (parent && t.isVariableDeclarator(parent.node)) {
@@ -203,9 +343,6 @@ function registerIfVariableDeclaration(path, className, styles, state, globalReg
203
343
  }
204
344
  }
205
345
  }
206
- /**
207
- * Convert a JavaScript value to an AST node
208
- */
209
346
  function valueToAST(value) {
210
347
  if (value === null) return t.nullLiteral();
211
348
  if (value === void 0) return t.identifier("undefined");
@@ -219,10 +356,6 @@ function valueToAST(value) {
219
356
  }
220
357
  return t.identifier("undefined");
221
358
  }
222
- /**
223
- * Evaluate an ObjectExpression to a plain JavaScript object.
224
- * Only supports static values that can be determined at build time.
225
- */
226
359
  function evaluateObjectExpression(node, path) {
227
360
  const result = {};
228
361
  for (const prop of node.properties) {
@@ -232,13 +365,11 @@ function evaluateObjectExpression(node, path) {
232
365
  if (t.isIdentifier(prop.key)) key = prop.key.name;
233
366
  else if (t.isStringLiteral(prop.key)) key = prop.key.value;
234
367
  else throw path.buildCodeFrameError("Dynamic property keys are not supported in tastyStatic()");
235
- result[key] = evaluateExpression(prop.value, path);
368
+ const value = evaluateExpression(prop.value, path);
369
+ result[key] = value;
236
370
  }
237
371
  return result;
238
372
  }
239
- /**
240
- * Evaluate an expression to a JavaScript value.
241
- */
242
373
  function evaluateExpression(node, path) {
243
374
  if (t.isStringLiteral(node)) return node.value;
244
375
  if (t.isNumericLiteral(node)) return node.value;
@@ -261,10 +392,6 @@ function evaluateExpression(node, path) {
261
392
  }
262
393
  throw path.buildCodeFrameError(`Dynamic expressions are not supported in tastyStatic() - got ${node.type}. All values must be static literals.`);
263
394
  }
264
- /**
265
- * Replace animation names in CSS string.
266
- * Wraps the keyframes replaceAnimationNames to work on full CSS blocks.
267
- */
268
395
  function replaceAnimationNamesInCSS(css, nameMap) {
269
396
  if (nameMap.size === 0) return css;
270
397
  return css.replace(/(animation(?:-name)?)\s*:\s*([^;}]+)/gi, (match, prop, value) => {
@@ -276,13 +403,10 @@ function replaceAnimationNamesInCSS(css, nameMap) {
276
403
  return `${prop}: ${newValue}`;
277
404
  });
278
405
  }
279
- /**
280
- * Escape special regex characters.
281
- */
282
406
  function escapeRegex(str) {
283
407
  return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
284
408
  }
285
-
286
409
  //#endregion
287
410
  export { babel_default as default };
411
+
288
412
  //# sourceMappingURL=babel.js.map