rnwind 0.0.1 → 0.0.2

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 (330) hide show
  1. package/lib/cjs/core/parser/animation.cjs +427 -0
  2. package/lib/cjs/core/parser/animation.cjs.map +1 -0
  3. package/lib/cjs/core/parser/animation.d.ts +126 -0
  4. package/lib/cjs/core/parser/border-dispatcher.cjs +180 -0
  5. package/lib/cjs/core/parser/border-dispatcher.cjs.map +1 -0
  6. package/lib/cjs/core/parser/border-dispatcher.d.ts +15 -0
  7. package/lib/cjs/core/parser/case-convert.cjs +15 -0
  8. package/lib/cjs/core/parser/case-convert.cjs.map +1 -0
  9. package/lib/cjs/core/parser/case-convert.d.ts +6 -0
  10. package/lib/cjs/core/parser/color-properties-dispatcher.cjs +84 -0
  11. package/lib/cjs/core/parser/color-properties-dispatcher.cjs.map +1 -0
  12. package/lib/cjs/core/parser/color-properties-dispatcher.d.ts +19 -0
  13. package/lib/cjs/core/parser/color.cjs +164 -0
  14. package/lib/cjs/core/parser/color.cjs.map +1 -0
  15. package/lib/cjs/core/parser/color.d.ts +12 -0
  16. package/lib/cjs/core/parser/constants.cjs +21 -0
  17. package/lib/cjs/core/parser/constants.cjs.map +1 -0
  18. package/lib/cjs/core/parser/constants.d.ts +8 -0
  19. package/lib/cjs/core/parser/declaration.cjs +347 -0
  20. package/lib/cjs/core/parser/declaration.cjs.map +1 -0
  21. package/lib/cjs/core/parser/declaration.d.ts +15 -0
  22. package/lib/cjs/core/parser/gradient.cjs +132 -0
  23. package/lib/cjs/core/parser/gradient.cjs.map +1 -0
  24. package/lib/cjs/core/parser/gradient.d.ts +59 -0
  25. package/lib/cjs/core/parser/haptics.cjs +73 -0
  26. package/lib/cjs/core/parser/haptics.cjs.map +1 -0
  27. package/lib/cjs/core/parser/haptics.d.ts +47 -0
  28. package/lib/cjs/core/parser/index.d.ts +8 -0
  29. package/lib/cjs/core/parser/keyframes.cjs +95 -0
  30. package/lib/cjs/core/parser/keyframes.cjs.map +1 -0
  31. package/lib/cjs/core/parser/keyframes.d.ts +26 -0
  32. package/lib/cjs/core/parser/layout-dispatcher.cjs +100 -0
  33. package/lib/cjs/core/parser/layout-dispatcher.cjs.map +1 -0
  34. package/lib/cjs/core/parser/layout-dispatcher.d.ts +14 -0
  35. package/lib/cjs/core/parser/length.cjs +96 -0
  36. package/lib/cjs/core/parser/length.cjs.map +1 -0
  37. package/lib/cjs/core/parser/length.d.ts +48 -0
  38. package/lib/cjs/core/parser/motion-dispatcher.cjs +77 -0
  39. package/lib/cjs/core/parser/motion-dispatcher.cjs.map +1 -0
  40. package/lib/cjs/core/parser/motion-dispatcher.d.ts +11 -0
  41. package/lib/cjs/core/parser/property.cjs +22 -0
  42. package/lib/cjs/core/parser/property.cjs.map +1 -0
  43. package/lib/cjs/core/parser/property.d.ts +8 -0
  44. package/lib/cjs/core/parser/safe-area.cjs +404 -0
  45. package/lib/cjs/core/parser/safe-area.cjs.map +1 -0
  46. package/lib/cjs/core/parser/safe-area.d.ts +39 -0
  47. package/lib/cjs/core/parser/selector.cjs +22 -0
  48. package/lib/cjs/core/parser/selector.cjs.map +1 -0
  49. package/lib/cjs/core/parser/selector.d.ts +11 -0
  50. package/lib/cjs/core/parser/shorthand.cjs +156 -0
  51. package/lib/cjs/core/parser/shorthand.cjs.map +1 -0
  52. package/lib/cjs/core/parser/shorthand.d.ts +61 -0
  53. package/lib/cjs/core/parser/text-truncate.cjs +78 -0
  54. package/lib/cjs/core/parser/text-truncate.cjs.map +1 -0
  55. package/lib/cjs/core/parser/text-truncate.d.ts +44 -0
  56. package/lib/cjs/core/parser/theme-vars.cjs +414 -0
  57. package/lib/cjs/core/parser/theme-vars.cjs.map +1 -0
  58. package/lib/cjs/core/parser/theme-vars.d.ts +61 -0
  59. package/lib/cjs/core/parser/tokens.cjs +304 -0
  60. package/lib/cjs/core/parser/tokens.cjs.map +1 -0
  61. package/lib/cjs/core/parser/tokens.d.ts +45 -0
  62. package/lib/cjs/core/parser/transform.cjs +198 -0
  63. package/lib/cjs/core/parser/transform.cjs.map +1 -0
  64. package/lib/cjs/core/parser/transform.d.ts +36 -0
  65. package/lib/cjs/core/parser/tw-parser.cjs +1567 -0
  66. package/lib/cjs/core/parser/tw-parser.cjs.map +1 -0
  67. package/lib/cjs/core/parser/tw-parser.d.ts +194 -0
  68. package/lib/cjs/core/parser/types.d.ts +37 -0
  69. package/lib/cjs/core/parser/typography-dispatcher.cjs +93 -0
  70. package/lib/cjs/core/parser/typography-dispatcher.cjs.map +1 -0
  71. package/lib/cjs/core/parser/typography-dispatcher.d.ts +11 -0
  72. package/lib/cjs/core/parser/typography.cjs +97 -0
  73. package/lib/cjs/core/parser/typography.cjs.map +1 -0
  74. package/lib/cjs/core/parser/typography.d.ts +43 -0
  75. package/lib/cjs/core/style-builder/build-style.cjs +397 -0
  76. package/lib/cjs/core/style-builder/build-style.cjs.map +1 -0
  77. package/lib/cjs/core/style-builder/build-style.d.ts +54 -0
  78. package/lib/cjs/core/style-builder/index.d.ts +3 -0
  79. package/lib/cjs/core/style-builder/union-builder.cjs +326 -0
  80. package/lib/cjs/core/style-builder/union-builder.cjs.map +1 -0
  81. package/lib/cjs/core/style-builder/union-builder.d.ts +128 -0
  82. package/lib/cjs/core/types.d.ts +14 -0
  83. package/lib/cjs/metro/dts.cjs +127 -0
  84. package/lib/cjs/metro/dts.cjs.map +1 -0
  85. package/lib/cjs/metro/dts.d.ts +16 -0
  86. package/lib/cjs/metro/index.cjs +19 -0
  87. package/lib/cjs/metro/index.cjs.map +1 -0
  88. package/lib/cjs/metro/index.d.ts +9 -0
  89. package/lib/cjs/metro/resolver.cjs +47 -0
  90. package/lib/cjs/metro/resolver.cjs.map +1 -0
  91. package/lib/cjs/metro/resolver.d.ts +22 -0
  92. package/lib/cjs/metro/state.cjs +251 -0
  93. package/lib/cjs/metro/state.cjs.map +1 -0
  94. package/lib/cjs/metro/state.d.ts +72 -0
  95. package/lib/cjs/metro/transform-ast.cjs +1255 -0
  96. package/lib/cjs/metro/transform-ast.cjs.map +1 -0
  97. package/lib/cjs/metro/transform-ast.d.ts +73 -0
  98. package/lib/cjs/metro/transformer.cjs +345 -0
  99. package/lib/cjs/metro/transformer.cjs.map +1 -0
  100. package/lib/cjs/metro/transformer.d.ts +47 -0
  101. package/lib/cjs/metro/warn-unknown-classes.cjs +86 -0
  102. package/lib/cjs/metro/warn-unknown-classes.cjs.map +1 -0
  103. package/lib/cjs/metro/warn-unknown-classes.d.ts +21 -0
  104. package/lib/cjs/metro/with-config.cjs +196 -0
  105. package/lib/cjs/metro/with-config.cjs.map +1 -0
  106. package/lib/cjs/metro/with-config.d.ts +57 -0
  107. package/lib/cjs/runtime/chain-handlers.cjs +37 -0
  108. package/lib/cjs/runtime/chain-handlers.cjs.map +1 -0
  109. package/lib/cjs/runtime/chain-handlers.d.ts +33 -0
  110. package/lib/cjs/runtime/components/rnwind-provider.cjs +98 -0
  111. package/lib/cjs/runtime/components/rnwind-provider.cjs.map +1 -0
  112. package/lib/cjs/runtime/components/rnwind-provider.d.ts +84 -0
  113. package/lib/cjs/runtime/gradient-types.d.ts +58 -0
  114. package/lib/cjs/runtime/haptics.cjs +113 -0
  115. package/lib/cjs/runtime/haptics.cjs.map +1 -0
  116. package/lib/cjs/runtime/haptics.d.ts +48 -0
  117. package/lib/cjs/runtime/hooks/use-css.cjs +21 -0
  118. package/lib/cjs/runtime/hooks/use-css.cjs.map +1 -0
  119. package/lib/cjs/runtime/hooks/use-css.d.ts +11 -0
  120. package/lib/cjs/runtime/hooks/use-interact.cjs +46 -0
  121. package/lib/cjs/runtime/hooks/use-interact.cjs.map +1 -0
  122. package/lib/cjs/runtime/hooks/use-interact.d.ts +42 -0
  123. package/lib/cjs/runtime/hooks/use-scheme.cjs +68 -0
  124. package/lib/cjs/runtime/hooks/use-scheme.cjs.map +1 -0
  125. package/lib/cjs/runtime/hooks/use-scheme.d.ts +34 -0
  126. package/lib/cjs/runtime/index.cjs +45 -0
  127. package/lib/cjs/runtime/index.cjs.map +1 -0
  128. package/lib/cjs/runtime/index.d.ts +27 -0
  129. package/lib/cjs/runtime/interactive-box.cjs +35 -0
  130. package/lib/cjs/runtime/interactive-box.cjs.map +1 -0
  131. package/lib/cjs/runtime/interactive-box.d.ts +40 -0
  132. package/lib/cjs/runtime/lookup-css.cjs +542 -0
  133. package/lib/cjs/runtime/lookup-css.cjs.map +1 -0
  134. package/lib/cjs/runtime/lookup-css.d.ts +164 -0
  135. package/lib/cjs/runtime/types.d.ts +29 -0
  136. package/lib/cjs/testing/index.cjs +367 -0
  137. package/lib/cjs/testing/index.cjs.map +1 -0
  138. package/lib/cjs/testing/index.d.ts +145 -0
  139. package/lib/esm/core/parser/animation.d.ts +126 -0
  140. package/lib/esm/core/parser/animation.mjs +408 -0
  141. package/lib/esm/core/parser/animation.mjs.map +1 -0
  142. package/lib/esm/core/parser/border-dispatcher.d.ts +15 -0
  143. package/lib/esm/core/parser/border-dispatcher.mjs +178 -0
  144. package/lib/esm/core/parser/border-dispatcher.mjs.map +1 -0
  145. package/lib/esm/core/parser/case-convert.d.ts +6 -0
  146. package/lib/esm/core/parser/case-convert.mjs +13 -0
  147. package/lib/esm/core/parser/case-convert.mjs.map +1 -0
  148. package/lib/esm/core/parser/color-properties-dispatcher.d.ts +19 -0
  149. package/lib/esm/core/parser/color-properties-dispatcher.mjs +82 -0
  150. package/lib/esm/core/parser/color-properties-dispatcher.mjs.map +1 -0
  151. package/lib/esm/core/parser/color.d.ts +12 -0
  152. package/lib/esm/core/parser/color.mjs +162 -0
  153. package/lib/esm/core/parser/color.mjs.map +1 -0
  154. package/lib/esm/core/parser/constants.d.ts +8 -0
  155. package/lib/esm/core/parser/constants.mjs +13 -0
  156. package/lib/esm/core/parser/constants.mjs.map +1 -0
  157. package/lib/esm/core/parser/declaration.d.ts +15 -0
  158. package/lib/esm/core/parser/declaration.mjs +345 -0
  159. package/lib/esm/core/parser/declaration.mjs.map +1 -0
  160. package/lib/esm/core/parser/gradient.d.ts +59 -0
  161. package/lib/esm/core/parser/gradient.mjs +130 -0
  162. package/lib/esm/core/parser/gradient.mjs.map +1 -0
  163. package/lib/esm/core/parser/haptics.d.ts +47 -0
  164. package/lib/esm/core/parser/haptics.mjs +71 -0
  165. package/lib/esm/core/parser/haptics.mjs.map +1 -0
  166. package/lib/esm/core/parser/index.d.ts +8 -0
  167. package/lib/esm/core/parser/keyframes.d.ts +26 -0
  168. package/lib/esm/core/parser/keyframes.mjs +91 -0
  169. package/lib/esm/core/parser/keyframes.mjs.map +1 -0
  170. package/lib/esm/core/parser/layout-dispatcher.d.ts +14 -0
  171. package/lib/esm/core/parser/layout-dispatcher.mjs +98 -0
  172. package/lib/esm/core/parser/layout-dispatcher.mjs.map +1 -0
  173. package/lib/esm/core/parser/length.d.ts +48 -0
  174. package/lib/esm/core/parser/length.mjs +90 -0
  175. package/lib/esm/core/parser/length.mjs.map +1 -0
  176. package/lib/esm/core/parser/motion-dispatcher.d.ts +11 -0
  177. package/lib/esm/core/parser/motion-dispatcher.mjs +75 -0
  178. package/lib/esm/core/parser/motion-dispatcher.mjs.map +1 -0
  179. package/lib/esm/core/parser/property.d.ts +8 -0
  180. package/lib/esm/core/parser/property.mjs +20 -0
  181. package/lib/esm/core/parser/property.mjs.map +1 -0
  182. package/lib/esm/core/parser/safe-area.d.ts +39 -0
  183. package/lib/esm/core/parser/safe-area.mjs +402 -0
  184. package/lib/esm/core/parser/safe-area.mjs.map +1 -0
  185. package/lib/esm/core/parser/selector.d.ts +11 -0
  186. package/lib/esm/core/parser/selector.mjs +20 -0
  187. package/lib/esm/core/parser/selector.mjs.map +1 -0
  188. package/lib/esm/core/parser/shorthand.d.ts +61 -0
  189. package/lib/esm/core/parser/shorthand.mjs +148 -0
  190. package/lib/esm/core/parser/shorthand.mjs.map +1 -0
  191. package/lib/esm/core/parser/text-truncate.d.ts +44 -0
  192. package/lib/esm/core/parser/text-truncate.mjs +75 -0
  193. package/lib/esm/core/parser/text-truncate.mjs.map +1 -0
  194. package/lib/esm/core/parser/theme-vars.d.ts +61 -0
  195. package/lib/esm/core/parser/theme-vars.mjs +409 -0
  196. package/lib/esm/core/parser/theme-vars.mjs.map +1 -0
  197. package/lib/esm/core/parser/tokens.d.ts +45 -0
  198. package/lib/esm/core/parser/tokens.mjs +298 -0
  199. package/lib/esm/core/parser/tokens.mjs.map +1 -0
  200. package/lib/esm/core/parser/transform.d.ts +36 -0
  201. package/lib/esm/core/parser/transform.mjs +193 -0
  202. package/lib/esm/core/parser/transform.mjs.map +1 -0
  203. package/lib/esm/core/parser/tw-parser.d.ts +194 -0
  204. package/lib/esm/core/parser/tw-parser.mjs +1565 -0
  205. package/lib/esm/core/parser/tw-parser.mjs.map +1 -0
  206. package/lib/esm/core/parser/types.d.ts +37 -0
  207. package/lib/esm/core/parser/typography-dispatcher.d.ts +11 -0
  208. package/lib/esm/core/parser/typography-dispatcher.mjs +91 -0
  209. package/lib/esm/core/parser/typography-dispatcher.mjs.map +1 -0
  210. package/lib/esm/core/parser/typography.d.ts +43 -0
  211. package/lib/esm/core/parser/typography.mjs +91 -0
  212. package/lib/esm/core/parser/typography.mjs.map +1 -0
  213. package/lib/esm/core/style-builder/build-style.d.ts +54 -0
  214. package/lib/esm/core/style-builder/build-style.mjs +395 -0
  215. package/lib/esm/core/style-builder/build-style.mjs.map +1 -0
  216. package/lib/esm/core/style-builder/index.d.ts +3 -0
  217. package/lib/esm/core/style-builder/union-builder.d.ts +128 -0
  218. package/lib/esm/core/style-builder/union-builder.mjs +324 -0
  219. package/lib/esm/core/style-builder/union-builder.mjs.map +1 -0
  220. package/lib/esm/core/types.d.ts +14 -0
  221. package/lib/esm/metro/dts.d.ts +16 -0
  222. package/lib/esm/metro/dts.mjs +125 -0
  223. package/lib/esm/metro/dts.mjs.map +1 -0
  224. package/lib/esm/metro/index.d.ts +9 -0
  225. package/lib/esm/metro/index.mjs +6 -0
  226. package/lib/esm/metro/index.mjs.map +1 -0
  227. package/lib/esm/metro/resolver.d.ts +22 -0
  228. package/lib/esm/metro/resolver.mjs +43 -0
  229. package/lib/esm/metro/resolver.mjs.map +1 -0
  230. package/lib/esm/metro/state.d.ts +72 -0
  231. package/lib/esm/metro/state.mjs +243 -0
  232. package/lib/esm/metro/state.mjs.map +1 -0
  233. package/lib/esm/metro/transform-ast.d.ts +73 -0
  234. package/lib/esm/metro/transform-ast.mjs +1234 -0
  235. package/lib/esm/metro/transform-ast.mjs.map +1 -0
  236. package/lib/esm/metro/transformer.d.ts +47 -0
  237. package/lib/esm/metro/transformer.mjs +322 -0
  238. package/lib/esm/metro/transformer.mjs.map +1 -0
  239. package/lib/esm/metro/warn-unknown-classes.d.ts +21 -0
  240. package/lib/esm/metro/warn-unknown-classes.mjs +84 -0
  241. package/lib/esm/metro/warn-unknown-classes.mjs.map +1 -0
  242. package/lib/esm/metro/with-config.d.ts +57 -0
  243. package/lib/esm/metro/with-config.mjs +194 -0
  244. package/lib/esm/metro/with-config.mjs.map +1 -0
  245. package/lib/esm/runtime/chain-handlers.d.ts +33 -0
  246. package/lib/esm/runtime/chain-handlers.mjs +34 -0
  247. package/lib/esm/runtime/chain-handlers.mjs.map +1 -0
  248. package/lib/esm/runtime/components/rnwind-provider.d.ts +84 -0
  249. package/lib/esm/runtime/components/rnwind-provider.mjs +94 -0
  250. package/lib/esm/runtime/components/rnwind-provider.mjs.map +1 -0
  251. package/lib/esm/runtime/gradient-types.d.ts +58 -0
  252. package/lib/esm/runtime/haptics.d.ts +48 -0
  253. package/lib/esm/runtime/haptics.mjs +110 -0
  254. package/lib/esm/runtime/haptics.mjs.map +1 -0
  255. package/lib/esm/runtime/hooks/use-css.d.ts +11 -0
  256. package/lib/esm/runtime/hooks/use-css.mjs +19 -0
  257. package/lib/esm/runtime/hooks/use-css.mjs.map +1 -0
  258. package/lib/esm/runtime/hooks/use-interact.d.ts +42 -0
  259. package/lib/esm/runtime/hooks/use-interact.mjs +44 -0
  260. package/lib/esm/runtime/hooks/use-interact.mjs.map +1 -0
  261. package/lib/esm/runtime/hooks/use-scheme.d.ts +34 -0
  262. package/lib/esm/runtime/hooks/use-scheme.mjs +63 -0
  263. package/lib/esm/runtime/hooks/use-scheme.mjs.map +1 -0
  264. package/lib/esm/runtime/index.d.ts +27 -0
  265. package/lib/esm/runtime/index.mjs +18 -0
  266. package/lib/esm/runtime/index.mjs.map +1 -0
  267. package/lib/esm/runtime/interactive-box.d.ts +40 -0
  268. package/lib/esm/runtime/interactive-box.mjs +33 -0
  269. package/lib/esm/runtime/interactive-box.mjs.map +1 -0
  270. package/lib/esm/runtime/lookup-css.d.ts +164 -0
  271. package/lib/esm/runtime/lookup-css.mjs +531 -0
  272. package/lib/esm/runtime/lookup-css.mjs.map +1 -0
  273. package/lib/esm/runtime/types.d.ts +29 -0
  274. package/lib/esm/testing/index.d.ts +145 -0
  275. package/lib/esm/testing/index.mjs +344 -0
  276. package/lib/esm/testing/index.mjs.map +1 -0
  277. package/package.json +79 -13
  278. package/preset.css +1171 -0
  279. package/src/core/parser/animation.ts +404 -0
  280. package/src/core/parser/border-dispatcher.ts +176 -0
  281. package/src/core/parser/case-convert.ts +10 -0
  282. package/src/core/parser/color-properties-dispatcher.ts +78 -0
  283. package/src/core/parser/color.ts +157 -0
  284. package/src/core/parser/constants.ts +11 -0
  285. package/src/core/parser/declaration.ts +340 -0
  286. package/src/core/parser/gradient.ts +148 -0
  287. package/src/core/parser/haptics.ts +88 -0
  288. package/src/core/parser/index.ts +8 -0
  289. package/src/core/parser/keyframes.ts +84 -0
  290. package/src/core/parser/layout-dispatcher.ts +92 -0
  291. package/src/core/parser/length.ts +100 -0
  292. package/src/core/parser/motion-dispatcher.ts +89 -0
  293. package/src/core/parser/property.ts +15 -0
  294. package/src/core/parser/safe-area.ts +404 -0
  295. package/src/core/parser/selector.ts +17 -0
  296. package/src/core/parser/shorthand.ts +152 -0
  297. package/src/core/parser/text-truncate.ts +79 -0
  298. package/src/core/parser/theme-vars.ts +412 -0
  299. package/src/core/parser/tokens.ts +286 -0
  300. package/src/core/parser/transform.ts +195 -0
  301. package/src/core/parser/tw-parser.ts +1709 -0
  302. package/src/core/parser/types.ts +45 -0
  303. package/src/core/parser/typography-dispatcher.ts +83 -0
  304. package/src/core/parser/typography.ts +83 -0
  305. package/src/core/style-builder/build-style.ts +442 -0
  306. package/src/core/style-builder/index.ts +3 -0
  307. package/src/core/style-builder/union-builder.ts +328 -0
  308. package/src/core/types.ts +15 -0
  309. package/src/metro/dts.ts +128 -0
  310. package/src/metro/index.ts +9 -0
  311. package/src/metro/resolver.ts +42 -0
  312. package/src/metro/state.ts +257 -0
  313. package/src/metro/transform-ast.ts +1498 -0
  314. package/src/metro/transformer.ts +347 -0
  315. package/src/metro/warn-unknown-classes.ts +79 -0
  316. package/src/metro/with-config.ts +229 -0
  317. package/src/runtime/chain-handlers.ts +47 -0
  318. package/src/runtime/components/rnwind-provider.tsx +144 -0
  319. package/src/runtime/gradient-types.ts +60 -0
  320. package/src/runtime/haptics.ts +120 -0
  321. package/src/runtime/hooks/use-css.ts +16 -0
  322. package/src/runtime/hooks/use-interact.ts +65 -0
  323. package/src/runtime/hooks/use-scheme.ts +63 -0
  324. package/src/runtime/index.ts +54 -0
  325. package/src/runtime/interactive-box.tsx +57 -0
  326. package/src/runtime/lookup-css.ts +628 -0
  327. package/src/runtime/types.ts +32 -0
  328. package/src/testing/index.ts +507 -0
  329. package/src/types/tailwindcss-node.d.ts +33 -0
  330. package/src/index.ts +0 -1
@@ -0,0 +1,414 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Lightweight extractor for user-declared `@theme` and `@variant` blocks
5
+ * inside `:root` / `@layer theme`. Used by the parser to resolve
6
+ * `var(--x)` references that Tailwind's `theme(inline)` leaves
7
+ * unresolved (it only inlines its own known tokens, not user-added ones).
8
+ *
9
+ * Kept regex-free — a linear paren-balanced scan handles nesting without
10
+ * the backtracking risks of `{[^}]*}` patterns. CSS comment blocks are
11
+ * stripped before scanning so slash-star-sequences inside declaration
12
+ * values don't confuse the parser.
13
+ */
14
+ /**
15
+ * `@custom-variant <name> ...content-up-to-semicolon...;`
16
+ * The `[^;]+` class is constant-width relative to its input (one char
17
+ * per step, no alternation backtracking), so sonarjs/slow-regex doesn't
18
+ * apply — the flagged pattern is a false positive.
19
+ */
20
+ // eslint-disable-next-line sonarjs/slow-regex
21
+ const CUSTOM_VARIANT_WITH_SELECTOR = /@custom-variant\s+([A-Za-z][A-Za-z0-9_-]*)\s+([^;]+);/g;
22
+ /** Bare `.classname` occurrences (one capture group per class). */
23
+ const CLASS_IN_SELECTOR = /\.([A-Za-z_][\w-]*)/g;
24
+ /**
25
+ * Recursively descend into `{ ... }` blocks, collecting `--x: y;`
26
+ * declarations under the active scheme. When we hit `@variant <name> {`,
27
+ * the child scope's scheme becomes `<name>` until that block closes.
28
+ * @param source Pre-stripped CSS source.
29
+ * @param start Start index of the block body (0 for top-level).
30
+ * @param scheme Active scheme name for declarations inside this scope.
31
+ * @param table Destination table, mutated in place.
32
+ */
33
+ function walkBlocks(source, start, scheme, table) {
34
+ let index = start;
35
+ while (index < source.length) {
36
+ const step = nextWalkStep(source, index, scheme, table);
37
+ if (step.next === -1)
38
+ return;
39
+ index = step.next;
40
+ }
41
+ }
42
+ /**
43
+ * Decide the next action at `index`: declaration, nested block, or EOF.
44
+ * @param source Pre-stripped CSS.
45
+ * @param index Current scan index.
46
+ * @param scheme Active scheme name.
47
+ * @param table Destination table.
48
+ * @returns Step descriptor with the next scan index (or -1 for EOF).
49
+ */
50
+ function nextWalkStep(source, index, scheme, table) {
51
+ // Find the next TOP-LEVEL `--` (outside any `( ... )`). That's the only
52
+ // place a custom-property declaration can start. `--foo` that appears
53
+ // inside `var(--foo)` or `calc(... --value(integer) ...)` is part of a
54
+ // value, not a new declaration — accidentally treating it as one would
55
+ // splice into the `@theme` block's declaration list and produce broken
56
+ // CSS that Tailwind rejects downstream.
57
+ const atIndex = findTopLevelDoubleDash(source, index);
58
+ const openIndex = source.indexOf('{', index);
59
+ const closeIndex = source.indexOf('}', index);
60
+ const blockClose = closeIndex === -1 ? Number.POSITIVE_INFINITY : closeIndex;
61
+ if (isDeclarationNext(atIndex, openIndex, blockClose)) {
62
+ return { next: consumeDeclaration(source, atIndex, scheme, table) };
63
+ }
64
+ if (openIndex !== -1 && openIndex < blockClose) {
65
+ return { next: enterBlock(source, index, openIndex, scheme, table) };
66
+ }
67
+ return { next: -1 };
68
+ }
69
+ /**
70
+ * Find the next `--` in `source` that's not inside a `( ... )` group.
71
+ * Stops early if we hit an unmatched `}` (end of the containing block)
72
+ * — a `--` inside a nested block isn't our concern either.
73
+ * @param source Pre-stripped CSS source.
74
+ * @param from Start index to scan from.
75
+ * @returns Index of the next top-level `--`, or `-1` when none.
76
+ */
77
+ function findTopLevelDoubleDash(source, from) {
78
+ let parenDepth = 0;
79
+ for (let index = from; index < source.length - 1; index += 1) {
80
+ const ch = source.codePointAt(index);
81
+ if (ch === 40 /* ( */) {
82
+ parenDepth += 1;
83
+ continue;
84
+ }
85
+ if (ch === 41 /* ) */) {
86
+ if (parenDepth > 0)
87
+ parenDepth -= 1;
88
+ continue;
89
+ }
90
+ if (ch === 125 /* } */ && parenDepth === 0)
91
+ return -1;
92
+ if (ch === 45 /* - */ && parenDepth === 0 && source.codePointAt(index + 1) === 45) {
93
+ return index;
94
+ }
95
+ }
96
+ return -1;
97
+ }
98
+ /**
99
+ * Whether the next action at the current scan position is a declaration.
100
+ * @param atIndex Index of the next `--`.
101
+ * @param openIndex Index of the next `{`.
102
+ * @param blockClose Index of the next `}` (or `+Infinity` when absent).
103
+ * @returns True when a declaration should be consumed next.
104
+ */
105
+ function isDeclarationNext(atIndex, openIndex, blockClose) {
106
+ if (atIndex === -1 || atIndex >= blockClose)
107
+ return false;
108
+ return openIndex === -1 || atIndex < openIndex;
109
+ }
110
+ /**
111
+ * Handle a nested `{ ... }` block: recurse with the right scheme, then
112
+ * skip past the matching closing brace.
113
+ * @param source Pre-stripped CSS.
114
+ * @param index Scan position at the start of the header.
115
+ * @param openIndex Index of the opening brace.
116
+ * @param scheme Scheme active in the parent scope.
117
+ * @param table Destination table.
118
+ * @returns Index past the matching closing brace.
119
+ */
120
+ function enterBlock(source, index, openIndex, scheme, table) {
121
+ const header = source.slice(index, openIndex).trim();
122
+ // Skip blocks that define utilities / at-rules that carry declarations
123
+ // meant for a downstream compiler, not custom-property values for the
124
+ // active theme scheme. `@utility name-*` bodies contain Tailwind v4's
125
+ // `--value(...)` meta-syntax which would otherwise confuse the
126
+ // top-level declaration walker and spill into the extracted theme.
127
+ if (isNonThemeAtRule(header))
128
+ return skipMatchingBrace(source, openIndex + 1);
129
+ const childScheme = variantNameOf(header) ?? scheme;
130
+ walkBlocks(source, openIndex + 1, childScheme, table);
131
+ return skipMatchingBrace(source, openIndex + 1);
132
+ }
133
+ /**
134
+ * Whether a block header belongs to an at-rule whose body should be
135
+ * ignored by the theme-var extractor. `@utility` / `@media` / `@keyframes`
136
+ * / `@supports` / `@container` bodies contain property declarations that
137
+ * are NOT custom-property definitions for the active theme.
138
+ * @param header Text between the outer statement and the opening brace.
139
+ * @returns `true` when the block body should be skipped.
140
+ */
141
+ function isNonThemeAtRule(header) {
142
+ const trimmed = header.trimStart();
143
+ if (!trimmed.startsWith('@'))
144
+ return false;
145
+ const match = /^@([A-Za-z-]+)/.exec(trimmed);
146
+ if (!match)
147
+ return false;
148
+ const name = match[1];
149
+ return name === 'utility' || name === 'keyframes' || name === 'media' || name === 'supports' || name === 'container';
150
+ }
151
+ /**
152
+ * Consume one `--name: value;` declaration starting at `start`. Commits
153
+ * the name/value pair into the active scheme's map and returns the index
154
+ * just past the terminating `;`.
155
+ * @param source CSS source.
156
+ * @param start Index of the `--`.
157
+ * @param scheme Active scheme.
158
+ * @param table Destination table.
159
+ * @returns Next scan index.
160
+ */
161
+ function consumeDeclaration(source, start, scheme, table) {
162
+ const colon = source.indexOf(':', start);
163
+ if (colon === -1)
164
+ return source.length;
165
+ const name = source.slice(start, colon).trim();
166
+ const end = source.indexOf(';', colon);
167
+ const stop = end === -1 ? source.indexOf('}', colon) : end;
168
+ if (stop === -1)
169
+ return source.length;
170
+ const value = source.slice(colon + 1, stop).trim();
171
+ if (name.startsWith('--')) {
172
+ const bucket = table.get(scheme) ?? new Map();
173
+ bucket.set(name, value);
174
+ table.set(scheme, bucket);
175
+ }
176
+ return stop + 1;
177
+ }
178
+ /**
179
+ * Walk forward through the source tracking brace depth; return the index
180
+ * just past the matching `}` for the opener at `start - 1`.
181
+ * @param source CSS source.
182
+ * @param start Index just past the opening brace.
183
+ * @returns Index past the matching closer (or source.length on imbalance).
184
+ */
185
+ function skipMatchingBrace(source, start) {
186
+ let depth = 1;
187
+ for (let index = start; index < source.length; index += 1) {
188
+ const ch = source[index];
189
+ if (ch === '{')
190
+ depth += 1;
191
+ else if (ch === '}') {
192
+ depth -= 1;
193
+ if (depth === 0)
194
+ return index + 1;
195
+ }
196
+ }
197
+ return source.length;
198
+ }
199
+ /**
200
+ * If `header` text (right before an opening brace) names a variant
201
+ * (`@variant <name>`), return that name. Otherwise null.
202
+ * @param header Text between the previous statement and the next `{`.
203
+ * @returns Variant name, or null when this block isn't a `@variant`.
204
+ */
205
+ function variantNameOf(header) {
206
+ const match = /^@variant\s+([A-Za-z][A-Za-z0-9_-]*)/.exec(header);
207
+ if (!match)
208
+ return null;
209
+ return match[1] ?? null;
210
+ }
211
+ /**
212
+ * Emit `@custom-variant` declarations for every scheme the user declared
213
+ * but hasn't manually registered. Makes Tailwind accept `light:*` /
214
+ * `dark:*` / etc. as valid class-name prefixes.
215
+ * @param css Stripped CSS source used to detect already-declared variants.
216
+ * @param schemes Non-base scheme names from the extracted table.
217
+ * @returns Zero or more `@custom-variant ... ;` lines.
218
+ */
219
+ function buildCustomVariantDeclarations(css, schemes) {
220
+ if (schemes.length === 0)
221
+ return [];
222
+ const existing = new Set();
223
+ for (const match of css.matchAll(CUSTOM_VARIANT_REGEX))
224
+ existing.add(match[1]);
225
+ const out = [];
226
+ for (const name of schemes) {
227
+ if (!existing.has(name))
228
+ out.push(`@custom-variant ${name} (&:where(.${name}, .${name} *));`);
229
+ }
230
+ return out;
231
+ }
232
+ /**
233
+ * Re-publish variant-scoped tokens into a flat theme block so Tailwind
234
+ * sees every custom-property name it needs. Values come from the base
235
+ * scheme first, with the FIRST declared non-base scheme layering on top
236
+ * — Tailwind only cares about token shape (color vs length), not the
237
+ * exact value, since rnwind does per-scheme substitution at walk time.
238
+ * @param table Extracted scheme → var-name → value table.
239
+ * @param schemes Non-base scheme names (sorted by declaration order).
240
+ * @returns A single `@theme { ... }` block or `null` when there are no tokens.
241
+ */
242
+ function buildUnifiedThemeBlock(table, schemes) {
243
+ const unifiedVars = new Map();
244
+ const baseTokens = table.get(BASE_SCHEME);
245
+ if (baseTokens)
246
+ for (const [k, v] of baseTokens)
247
+ unifiedVars.set(k, v);
248
+ if (schemes.length > 0) {
249
+ const firstTokens = table.get(schemes[0]);
250
+ if (firstTokens)
251
+ for (const [k, v] of firstTokens)
252
+ unifiedVars.set(k, v);
253
+ }
254
+ if (unifiedVars.size === 0)
255
+ return null;
256
+ const decls = [...unifiedVars].map(([name, value]) => ` ${name}: ${value};`).join('\n');
257
+ return `@theme {\n${decls}\n}`;
258
+ }
259
+ const CUSTOM_VARIANT_REGEX = /@custom-variant\s+([A-Za-z][A-Za-z0-9_-]*)\b/g;
260
+ const VARIANT_OPEN_REGEX = /@variant\s+[A-Za-z0-9_-]+\s*\{/g;
261
+ /**
262
+ * Strip every `@variant <name> { ... }` block (including nested braces)
263
+ * from a CSS source.
264
+ * @param css Raw CSS.
265
+ * @returns CSS without variant blocks.
266
+ */
267
+ function stripVariantBlocks(css) {
268
+ let out = '';
269
+ let cursor = 0;
270
+ VARIANT_OPEN_REGEX.lastIndex = 0;
271
+ let match;
272
+ while ((match = VARIANT_OPEN_REGEX.exec(css)) !== null) {
273
+ const openEnd = match.index + match[0].length;
274
+ const closeIndex = findMatchingBrace(css, openEnd);
275
+ if (closeIndex === -1)
276
+ break;
277
+ out += css.slice(cursor, match.index);
278
+ cursor = closeIndex + 1;
279
+ VARIANT_OPEN_REGEX.lastIndex = cursor;
280
+ }
281
+ out += css.slice(cursor);
282
+ return out;
283
+ }
284
+ /**
285
+ * Walk forward from `start` tracking brace depth; return the index of the
286
+ * matching `}` for the opener just before `start`.
287
+ * @param source Source string.
288
+ * @param start Index just past the opening `{`.
289
+ * @returns Index of matching `}`, or `-1` on imbalance.
290
+ */
291
+ function findMatchingBrace(source, start) {
292
+ let depth = 1;
293
+ for (let index = start; index < source.length; index += 1) {
294
+ const ch = source[index];
295
+ if (ch === '{')
296
+ depth += 1;
297
+ else if (ch === '}') {
298
+ depth -= 1;
299
+ if (depth === 0)
300
+ return index;
301
+ }
302
+ }
303
+ return -1;
304
+ }
305
+ /**
306
+ * Drop CSS comment blocks from a source. Keeps the token-declaration
307
+ * scanner simple — comments can contain braces / `--` sequences that
308
+ * would otherwise fool it.
309
+ * @param css Raw CSS source.
310
+ * @returns Source with every comment block removed.
311
+ */
312
+ function stripComments(css) {
313
+ let out = '';
314
+ let index = 0;
315
+ while (index < css.length) {
316
+ const open = css.indexOf('/*', index);
317
+ if (open === -1) {
318
+ out += css.slice(index);
319
+ break;
320
+ }
321
+ out += css.slice(index, open);
322
+ const close = css.indexOf('*/', open + 2);
323
+ if (close === -1)
324
+ break;
325
+ index = close + 2;
326
+ }
327
+ return out;
328
+ }
329
+ /** Synthetic scheme name used for tokens declared outside any `@variant`. */
330
+ const BASE_SCHEME = 'base';
331
+ /**
332
+ * Extract user-declared theme tokens from a CSS source. Scans for:
333
+ * - classic v4 `@theme` blocks (`@theme { --x: y; ... }`)
334
+ * - `@variant <name> { --x: y; ... }` inside any surrounding block
335
+ *
336
+ * Both flavors contribute to the returned table: vars outside any
337
+ * `@variant` go under `'base'`; vars inside `@variant <name>` go under
338
+ * `<name>`.
339
+ *
340
+ * Not a full CSS parser — just enough to recognise the token-declaration
341
+ * shape Tailwind v4 users actually write.
342
+ * @param css Theme CSS source.
343
+ * @returns Scheme → var-name → value map.
344
+ */
345
+ function extractThemeVars(css) {
346
+ const table = new Map();
347
+ const stripped = stripComments(css);
348
+ walkBlocks(stripped, 0, BASE_SCHEME, table);
349
+ return table;
350
+ }
351
+ /**
352
+ * Build a `<class-in-selector> → <scheme-name>` alias map from any
353
+ * `@custom-variant <name> (<selector>);` declarations in the theme CSS.
354
+ *
355
+ * Tailwind compiles `dark:opacity-100` to a nested rule whose selector is
356
+ * the user's declared variant selector. When the user writes
357
+ * `@custom-variant dark (&:where(.scheme-dark, .scheme-dark *));`, the
358
+ * generated rule references `.scheme-dark` instead of the literal `.dark`
359
+ * class rnwind's selector matcher defaults to. This alias map lets the
360
+ * parser map those custom selector classes back to their scheme name.
361
+ * @param css Theme CSS source.
362
+ * @returns Class-name → scheme-name map. Empty when no `@custom-variant`
363
+ * declarations are present (rnwind's auto-generated defaults already
364
+ * use the literal scheme name and don't need an alias).
365
+ */
366
+ function extractSchemeAliases(css) {
367
+ const aliases = new Map();
368
+ const stripped = stripComments(css);
369
+ for (const match of stripped.matchAll(CUSTOM_VARIANT_WITH_SELECTOR)) {
370
+ const schemeName = match[1];
371
+ const selectorBody = match[2];
372
+ for (const cls of selectorBody.matchAll(CLASS_IN_SELECTOR)) {
373
+ const className = cls[1];
374
+ if (className === schemeName)
375
+ continue;
376
+ aliases.set(className, schemeName);
377
+ }
378
+ }
379
+ return aliases;
380
+ }
381
+ /**
382
+ * Rewrite the theme CSS so Tailwind's compiler accepts it:
383
+ * 1. Strip every `@variant <name> { ... }` block — Tailwind rejects
384
+ * them inline because `@variant` is a rnwind concept, not a Tailwind
385
+ * at-rule. The scheme-scoped vars are preserved in the extracted
386
+ * {@link ThemeSchemeTable} and substituted at walk time.
387
+ * 2. Prepend `@custom-variant <name> (&:where(.<name>, .<name> *));`
388
+ * for every scheme name we saw, so Tailwind accepts `light:bg-*`,
389
+ * `dark:bg-*`, etc. as valid class-name prefixes without the user
390
+ * having to duplicate the variant declaration.
391
+ * @param css Theme CSS source.
392
+ * @param table Scheme → var-name → value table from {@link extractThemeVars}.
393
+ * @returns CSS ready to feed `@tailwindcss/node`'s compiler.
394
+ */
395
+ function compileReadyTheme(css, table) {
396
+ const schemes = [...table.keys()].filter((name) => name !== BASE_SCHEME);
397
+ const stripped = stripVariantBlocks(css);
398
+ const prelude = [];
399
+ const customVariants = buildCustomVariantDeclarations(stripped, schemes);
400
+ if (customVariants.length > 0)
401
+ prelude.push(...customVariants);
402
+ const themeBlock = buildUnifiedThemeBlock(table, schemes);
403
+ if (themeBlock)
404
+ prelude.push(themeBlock);
405
+ if (prelude.length === 0)
406
+ return stripped;
407
+ return `${prelude.join('\n')}\n${stripped}`;
408
+ }
409
+
410
+ exports.BASE_SCHEME = BASE_SCHEME;
411
+ exports.compileReadyTheme = compileReadyTheme;
412
+ exports.extractSchemeAliases = extractSchemeAliases;
413
+ exports.extractThemeVars = extractThemeVars;
414
+ //# sourceMappingURL=theme-vars.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-vars.cjs","sources":["../../../../../src/core/parser/theme-vars.ts"],"sourcesContent":["/**\n * Lightweight extractor for user-declared `@theme` and `@variant` blocks\n * inside `:root` / `@layer theme`. Used by the parser to resolve\n * `var(--x)` references that Tailwind's `theme(inline)` leaves\n * unresolved (it only inlines its own known tokens, not user-added ones).\n *\n * Kept regex-free — a linear paren-balanced scan handles nesting without\n * the backtracking risks of `{[^}]*}` patterns. CSS comment blocks are\n * stripped before scanning so slash-star-sequences inside declaration\n * values don't confuse the parser.\n */\n\n/**\n * `@custom-variant <name> ...content-up-to-semicolon...;`\n * The `[^;]+` class is constant-width relative to its input (one char\n * per step, no alternation backtracking), so sonarjs/slow-regex doesn't\n * apply — the flagged pattern is a false positive.\n */\n// eslint-disable-next-line sonarjs/slow-regex\nconst CUSTOM_VARIANT_WITH_SELECTOR = /@custom-variant\\s+([A-Za-z][A-Za-z0-9_-]*)\\s+([^;]+);/g\n/** Bare `.classname` occurrences (one capture group per class). */\nconst CLASS_IN_SELECTOR = /\\.([A-Za-z_][\\w-]*)/g\n\n/**\n * One iteration step of the block walker — decides whether the next\n * interesting token is a declaration, a nested block, or the end of\n * scope. Kept small to keep {@link walkBlocks} below the cognitive\n * complexity threshold.\n */\ninterface WalkStep {\n /** Next scan index, or `-1` to terminate the outer loop. */\n next: number\n}\n\n/**\n * Recursively descend into `{ ... }` blocks, collecting `--x: y;`\n * declarations under the active scheme. When we hit `@variant <name> {`,\n * the child scope's scheme becomes `<name>` until that block closes.\n * @param source Pre-stripped CSS source.\n * @param start Start index of the block body (0 for top-level).\n * @param scheme Active scheme name for declarations inside this scope.\n * @param table Destination table, mutated in place.\n */\nfunction walkBlocks(source: string, start: number, scheme: string, table: ThemeSchemeTable): void {\n let index = start\n while (index < source.length) {\n const step = nextWalkStep(source, index, scheme, table)\n if (step.next === -1) return\n index = step.next\n }\n}\n\n/**\n * Decide the next action at `index`: declaration, nested block, or EOF.\n * @param source Pre-stripped CSS.\n * @param index Current scan index.\n * @param scheme Active scheme name.\n * @param table Destination table.\n * @returns Step descriptor with the next scan index (or -1 for EOF).\n */\nfunction nextWalkStep(source: string, index: number, scheme: string, table: ThemeSchemeTable): WalkStep {\n // Find the next TOP-LEVEL `--` (outside any `( ... )`). That's the only\n // place a custom-property declaration can start. `--foo` that appears\n // inside `var(--foo)` or `calc(... --value(integer) ...)` is part of a\n // value, not a new declaration — accidentally treating it as one would\n // splice into the `@theme` block's declaration list and produce broken\n // CSS that Tailwind rejects downstream.\n const atIndex = findTopLevelDoubleDash(source, index)\n const openIndex = source.indexOf('{', index)\n const closeIndex = source.indexOf('}', index)\n const blockClose = closeIndex === -1 ? Number.POSITIVE_INFINITY : closeIndex\n if (isDeclarationNext(atIndex, openIndex, blockClose)) {\n return { next: consumeDeclaration(source, atIndex, scheme, table) }\n }\n if (openIndex !== -1 && openIndex < blockClose) {\n return { next: enterBlock(source, index, openIndex, scheme, table) }\n }\n return { next: -1 }\n}\n\n/**\n * Find the next `--` in `source` that's not inside a `( ... )` group.\n * Stops early if we hit an unmatched `}` (end of the containing block)\n * — a `--` inside a nested block isn't our concern either.\n * @param source Pre-stripped CSS source.\n * @param from Start index to scan from.\n * @returns Index of the next top-level `--`, or `-1` when none.\n */\nfunction findTopLevelDoubleDash(source: string, from: number): number {\n let parenDepth = 0\n for (let index = from; index < source.length - 1; index += 1) {\n const ch = source.codePointAt(index)\n if (ch === 40 /* ( */) {\n parenDepth += 1\n continue\n }\n if (ch === 41 /* ) */) {\n if (parenDepth > 0) parenDepth -= 1\n continue\n }\n if (ch === 125 /* } */ && parenDepth === 0) return -1\n if (ch === 45 /* - */ && parenDepth === 0 && source.codePointAt(index + 1) === 45) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Whether the next action at the current scan position is a declaration.\n * @param atIndex Index of the next `--`.\n * @param openIndex Index of the next `{`.\n * @param blockClose Index of the next `}` (or `+Infinity` when absent).\n * @returns True when a declaration should be consumed next.\n */\nfunction isDeclarationNext(atIndex: number, openIndex: number, blockClose: number): boolean {\n if (atIndex === -1 || atIndex >= blockClose) return false\n return openIndex === -1 || atIndex < openIndex\n}\n\n/**\n * Handle a nested `{ ... }` block: recurse with the right scheme, then\n * skip past the matching closing brace.\n * @param source Pre-stripped CSS.\n * @param index Scan position at the start of the header.\n * @param openIndex Index of the opening brace.\n * @param scheme Scheme active in the parent scope.\n * @param table Destination table.\n * @returns Index past the matching closing brace.\n */\nfunction enterBlock(source: string, index: number, openIndex: number, scheme: string, table: ThemeSchemeTable): number {\n const header = source.slice(index, openIndex).trim()\n // Skip blocks that define utilities / at-rules that carry declarations\n // meant for a downstream compiler, not custom-property values for the\n // active theme scheme. `@utility name-*` bodies contain Tailwind v4's\n // `--value(...)` meta-syntax which would otherwise confuse the\n // top-level declaration walker and spill into the extracted theme.\n if (isNonThemeAtRule(header)) return skipMatchingBrace(source, openIndex + 1)\n const childScheme = variantNameOf(header) ?? scheme\n walkBlocks(source, openIndex + 1, childScheme, table)\n return skipMatchingBrace(source, openIndex + 1)\n}\n\n/**\n * Whether a block header belongs to an at-rule whose body should be\n * ignored by the theme-var extractor. `@utility` / `@media` / `@keyframes`\n * / `@supports` / `@container` bodies contain property declarations that\n * are NOT custom-property definitions for the active theme.\n * @param header Text between the outer statement and the opening brace.\n * @returns `true` when the block body should be skipped.\n */\nfunction isNonThemeAtRule(header: string): boolean {\n const trimmed = header.trimStart()\n if (!trimmed.startsWith('@')) return false\n const match = /^@([A-Za-z-]+)/.exec(trimmed)\n if (!match) return false\n const name = match[1]!\n return name === 'utility' || name === 'keyframes' || name === 'media' || name === 'supports' || name === 'container'\n}\n\n/**\n * Consume one `--name: value;` declaration starting at `start`. Commits\n * the name/value pair into the active scheme's map and returns the index\n * just past the terminating `;`.\n * @param source CSS source.\n * @param start Index of the `--`.\n * @param scheme Active scheme.\n * @param table Destination table.\n * @returns Next scan index.\n */\nfunction consumeDeclaration(source: string, start: number, scheme: string, table: ThemeSchemeTable): number {\n const colon = source.indexOf(':', start)\n if (colon === -1) return source.length\n const name = source.slice(start, colon).trim()\n const end = source.indexOf(';', colon)\n const stop = end === -1 ? source.indexOf('}', colon) : end\n if (stop === -1) return source.length\n const value = source.slice(colon + 1, stop).trim()\n if (name.startsWith('--')) {\n const bucket = table.get(scheme) ?? new Map()\n bucket.set(name, value)\n table.set(scheme, bucket)\n }\n return stop + 1\n}\n\n/**\n * Walk forward through the source tracking brace depth; return the index\n * just past the matching `}` for the opener at `start - 1`.\n * @param source CSS source.\n * @param start Index just past the opening brace.\n * @returns Index past the matching closer (or source.length on imbalance).\n */\nfunction skipMatchingBrace(source: string, start: number): number {\n let depth = 1\n for (let index = start; index < source.length; index += 1) {\n const ch = source[index]\n if (ch === '{') depth += 1\n else if (ch === '}') {\n depth -= 1\n if (depth === 0) return index + 1\n }\n }\n return source.length\n}\n\n/**\n * If `header` text (right before an opening brace) names a variant\n * (`@variant <name>`), return that name. Otherwise null.\n * @param header Text between the previous statement and the next `{`.\n * @returns Variant name, or null when this block isn't a `@variant`.\n */\nfunction variantNameOf(header: string): string | null {\n const match = /^@variant\\s+([A-Za-z][A-Za-z0-9_-]*)/.exec(header)\n if (!match) return null\n return match[1] ?? null\n}\n\n/**\n * Emit `@custom-variant` declarations for every scheme the user declared\n * but hasn't manually registered. Makes Tailwind accept `light:*` /\n * `dark:*` / etc. as valid class-name prefixes.\n * @param css Stripped CSS source used to detect already-declared variants.\n * @param schemes Non-base scheme names from the extracted table.\n * @returns Zero or more `@custom-variant ... ;` lines.\n */\nfunction buildCustomVariantDeclarations(css: string, schemes: readonly string[]): string[] {\n if (schemes.length === 0) return []\n const existing = new Set<string>()\n for (const match of css.matchAll(CUSTOM_VARIANT_REGEX)) existing.add(match[1]!)\n const out: string[] = []\n for (const name of schemes) {\n if (!existing.has(name)) out.push(`@custom-variant ${name} (&:where(.${name}, .${name} *));`)\n }\n return out\n}\n\n/**\n * Re-publish variant-scoped tokens into a flat theme block so Tailwind\n * sees every custom-property name it needs. Values come from the base\n * scheme first, with the FIRST declared non-base scheme layering on top\n * — Tailwind only cares about token shape (color vs length), not the\n * exact value, since rnwind does per-scheme substitution at walk time.\n * @param table Extracted scheme → var-name → value table.\n * @param schemes Non-base scheme names (sorted by declaration order).\n * @returns A single `@theme { ... }` block or `null` when there are no tokens.\n */\nfunction buildUnifiedThemeBlock(table: ThemeSchemeTable, schemes: readonly string[]): string | null {\n const unifiedVars = new Map<string, string>()\n const baseTokens = table.get(BASE_SCHEME)\n if (baseTokens) for (const [k, v] of baseTokens) unifiedVars.set(k, v)\n if (schemes.length > 0) {\n const firstTokens = table.get(schemes[0]!)\n if (firstTokens) for (const [k, v] of firstTokens) unifiedVars.set(k, v)\n }\n if (unifiedVars.size === 0) return null\n const decls = [...unifiedVars].map(([name, value]) => ` ${name}: ${value};`).join('\\n')\n return `@theme {\\n${decls}\\n}`\n}\n\nconst CUSTOM_VARIANT_REGEX = /@custom-variant\\s+([A-Za-z][A-Za-z0-9_-]*)\\b/g\nconst VARIANT_OPEN_REGEX = /@variant\\s+[A-Za-z0-9_-]+\\s*\\{/g\n\n/**\n * Strip every `@variant <name> { ... }` block (including nested braces)\n * from a CSS source.\n * @param css Raw CSS.\n * @returns CSS without variant blocks.\n */\nfunction stripVariantBlocks(css: string): string {\n let out = ''\n let cursor = 0\n VARIANT_OPEN_REGEX.lastIndex = 0\n let match: RegExpExecArray | null\n while ((match = VARIANT_OPEN_REGEX.exec(css)) !== null) {\n const openEnd = match.index + match[0].length\n const closeIndex = findMatchingBrace(css, openEnd)\n if (closeIndex === -1) break\n out += css.slice(cursor, match.index)\n cursor = closeIndex + 1\n VARIANT_OPEN_REGEX.lastIndex = cursor\n }\n out += css.slice(cursor)\n return out\n}\n\n/**\n * Walk forward from `start` tracking brace depth; return the index of the\n * matching `}` for the opener just before `start`.\n * @param source Source string.\n * @param start Index just past the opening `{`.\n * @returns Index of matching `}`, or `-1` on imbalance.\n */\nfunction findMatchingBrace(source: string, start: number): number {\n let depth = 1\n for (let index = start; index < source.length; index += 1) {\n const ch = source[index]\n if (ch === '{') depth += 1\n else if (ch === '}') {\n depth -= 1\n if (depth === 0) return index\n }\n }\n return -1\n}\n\n/**\n * Drop CSS comment blocks from a source. Keeps the token-declaration\n * scanner simple — comments can contain braces / `--` sequences that\n * would otherwise fool it.\n * @param css Raw CSS source.\n * @returns Source with every comment block removed.\n */\nfunction stripComments(css: string): string {\n let out = ''\n let index = 0\n while (index < css.length) {\n const open = css.indexOf('/*', index)\n if (open === -1) {\n out += css.slice(index)\n break\n }\n out += css.slice(index, open)\n const close = css.indexOf('*/', open + 2)\n if (close === -1) break\n index = close + 2\n }\n return out\n}\n\n/** Scheme name → (var name → value). The base scheme key is `'base'`. */\nexport type ThemeSchemeTable = Map<string, Map<string, string>>\n\n/** Synthetic scheme name used for tokens declared outside any `@variant`. */\nexport const BASE_SCHEME = 'base'\n\n/**\n * Extract user-declared theme tokens from a CSS source. Scans for:\n * - classic v4 `@theme` blocks (`@theme { --x: y; ... }`)\n * - `@variant <name> { --x: y; ... }` inside any surrounding block\n *\n * Both flavors contribute to the returned table: vars outside any\n * `@variant` go under `'base'`; vars inside `@variant <name>` go under\n * `<name>`.\n *\n * Not a full CSS parser — just enough to recognise the token-declaration\n * shape Tailwind v4 users actually write.\n * @param css Theme CSS source.\n * @returns Scheme → var-name → value map.\n */\nexport function extractThemeVars(css: string): ThemeSchemeTable {\n const table: ThemeSchemeTable = new Map()\n const stripped = stripComments(css)\n walkBlocks(stripped, 0, BASE_SCHEME, table)\n return table\n}\n\n/**\n * Build a `<class-in-selector> → <scheme-name>` alias map from any\n * `@custom-variant <name> (<selector>);` declarations in the theme CSS.\n *\n * Tailwind compiles `dark:opacity-100` to a nested rule whose selector is\n * the user's declared variant selector. When the user writes\n * `@custom-variant dark (&:where(.scheme-dark, .scheme-dark *));`, the\n * generated rule references `.scheme-dark` instead of the literal `.dark`\n * class rnwind's selector matcher defaults to. This alias map lets the\n * parser map those custom selector classes back to their scheme name.\n * @param css Theme CSS source.\n * @returns Class-name → scheme-name map. Empty when no `@custom-variant`\n * declarations are present (rnwind's auto-generated defaults already\n * use the literal scheme name and don't need an alias).\n */\nexport function extractSchemeAliases(css: string): Map<string, string> {\n const aliases = new Map<string, string>()\n const stripped = stripComments(css)\n for (const match of stripped.matchAll(CUSTOM_VARIANT_WITH_SELECTOR)) {\n const schemeName = match[1]!\n const selectorBody = match[2]!\n for (const cls of selectorBody.matchAll(CLASS_IN_SELECTOR)) {\n const className = cls[1]!\n if (className === schemeName) continue\n aliases.set(className, schemeName)\n }\n }\n return aliases\n}\n\n/**\n * Rewrite the theme CSS so Tailwind's compiler accepts it:\n * 1. Strip every `@variant <name> { ... }` block — Tailwind rejects\n * them inline because `@variant` is a rnwind concept, not a Tailwind\n * at-rule. The scheme-scoped vars are preserved in the extracted\n * {@link ThemeSchemeTable} and substituted at walk time.\n * 2. Prepend `@custom-variant <name> (&:where(.<name>, .<name> *));`\n * for every scheme name we saw, so Tailwind accepts `light:bg-*`,\n * `dark:bg-*`, etc. as valid class-name prefixes without the user\n * having to duplicate the variant declaration.\n * @param css Theme CSS source.\n * @param table Scheme → var-name → value table from {@link extractThemeVars}.\n * @returns CSS ready to feed `@tailwindcss/node`'s compiler.\n */\nexport function compileReadyTheme(css: string, table: ThemeSchemeTable): string {\n const schemes = [...table.keys()].filter((name) => name !== BASE_SCHEME)\n const stripped = stripVariantBlocks(css)\n const prelude: string[] = []\n const customVariants = buildCustomVariantDeclarations(stripped, schemes)\n if (customVariants.length > 0) prelude.push(...customVariants)\n const themeBlock = buildUnifiedThemeBlock(table, schemes)\n if (themeBlock) prelude.push(themeBlock)\n if (prelude.length === 0) return stripped\n return `${prelude.join('\\n')}\\n${stripped}`\n}\n"],"names":[],"mappings":";;AAAA;;;;;;;;;;AAUG;AAEH;;;;;AAKG;AACH;AACA,MAAM,4BAA4B,GAAG,wDAAwD;AAC7F;AACA,MAAM,iBAAiB,GAAG,sBAAsB;AAahD;;;;;;;;AAQG;AACH,SAAS,UAAU,CAAC,MAAc,EAAE,KAAa,EAAE,MAAc,EAAE,KAAuB,EAAA;IACxF,IAAI,KAAK,GAAG,KAAK;AACjB,IAAA,OAAO,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE;AAC5B,QAAA,MAAM,IAAI,GAAG,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC;AACvD,QAAA,IAAI,IAAI,CAAC,IAAI,KAAK,EAAE;YAAE;AACtB,QAAA,KAAK,GAAG,IAAI,CAAC,IAAI;IACnB;AACF;AAEA;;;;;;;AAOG;AACH,SAAS,YAAY,CAAC,MAAc,EAAE,KAAa,EAAE,MAAc,EAAE,KAAuB,EAAA;;;;;;;IAO1F,MAAM,OAAO,GAAG,sBAAsB,CAAC,MAAM,EAAE,KAAK,CAAC;IACrD,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC;IAC5C,MAAM,UAAU,GAAG,M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AAO;AAChB;AAEA;;;;;;;;;;;;;AAaG;AACG,SAAU,iBAAiB,CAAC,GAAW,EAAE,KAAuB,EAAA;IACpE,MAAM,OAAO,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,IAAI,KAAK,WAAW,CAAC;AACxE,IAAA,MAAM,QAAQ,GAAG,kBAAkB,CAAC,GAAG,CAAC;IACxC,MAAM,OAAO,GAAa,EAAE;IAC5B,MAAM,cAAc,GAAG,8BAA8B,CAAC,QAAQ,EAAE,OAAO,CAAC;AACxE,IAAA,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC;AAAE,QAAA,OAAO,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC;IAC9D,MAAM,UAAU,GAAG,sBAAsB,CAAC,KAAK,EAAE,OAAO,CAAC;AACzD,IAAA,IAAI,UAAU;AAAE,QAAA,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC;AACxC,IAAA,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;AAAE,QAAA,OAAO,QAAQ;IACzC,OAAO,CAAA,EAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,EAAA,EAAK,QAAQ,CAAA,CAAE;AAC7C;;;;;;;"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Lightweight extractor for user-declared `@theme` and `@variant` blocks
3
+ * inside `:root` / `@layer theme`. Used by the parser to resolve
4
+ * `var(--x)` references that Tailwind's `theme(inline)` leaves
5
+ * unresolved (it only inlines its own known tokens, not user-added ones).
6
+ *
7
+ * Kept regex-free — a linear paren-balanced scan handles nesting without
8
+ * the backtracking risks of `{[^}]*}` patterns. CSS comment blocks are
9
+ * stripped before scanning so slash-star-sequences inside declaration
10
+ * values don't confuse the parser.
11
+ */
12
+ /** Scheme name → (var name → value). The base scheme key is `'base'`. */
13
+ export type ThemeSchemeTable = Map<string, Map<string, string>>;
14
+ /** Synthetic scheme name used for tokens declared outside any `@variant`. */
15
+ export declare const BASE_SCHEME = "base";
16
+ /**
17
+ * Extract user-declared theme tokens from a CSS source. Scans for:
18
+ * - classic v4 `@theme` blocks (`@theme { --x: y; ... }`)
19
+ * - `@variant <name> { --x: y; ... }` inside any surrounding block
20
+ *
21
+ * Both flavors contribute to the returned table: vars outside any
22
+ * `@variant` go under `'base'`; vars inside `@variant <name>` go under
23
+ * `<name>`.
24
+ *
25
+ * Not a full CSS parser — just enough to recognise the token-declaration
26
+ * shape Tailwind v4 users actually write.
27
+ * @param css Theme CSS source.
28
+ * @returns Scheme → var-name → value map.
29
+ */
30
+ export declare function extractThemeVars(css: string): ThemeSchemeTable;
31
+ /**
32
+ * Build a `<class-in-selector> → <scheme-name>` alias map from any
33
+ * `@custom-variant <name> (<selector>);` declarations in the theme CSS.
34
+ *
35
+ * Tailwind compiles `dark:opacity-100` to a nested rule whose selector is
36
+ * the user's declared variant selector. When the user writes
37
+ * `@custom-variant dark (&:where(.scheme-dark, .scheme-dark *));`, the
38
+ * generated rule references `.scheme-dark` instead of the literal `.dark`
39
+ * class rnwind's selector matcher defaults to. This alias map lets the
40
+ * parser map those custom selector classes back to their scheme name.
41
+ * @param css Theme CSS source.
42
+ * @returns Class-name → scheme-name map. Empty when no `@custom-variant`
43
+ * declarations are present (rnwind's auto-generated defaults already
44
+ * use the literal scheme name and don't need an alias).
45
+ */
46
+ export declare function extractSchemeAliases(css: string): Map<string, string>;
47
+ /**
48
+ * Rewrite the theme CSS so Tailwind's compiler accepts it:
49
+ * 1. Strip every `@variant <name> { ... }` block — Tailwind rejects
50
+ * them inline because `@variant` is a rnwind concept, not a Tailwind
51
+ * at-rule. The scheme-scoped vars are preserved in the extracted
52
+ * {@link ThemeSchemeTable} and substituted at walk time.
53
+ * 2. Prepend `@custom-variant <name> (&:where(.<name>, .<name> *));`
54
+ * for every scheme name we saw, so Tailwind accepts `light:bg-*`,
55
+ * `dark:bg-*`, etc. as valid class-name prefixes without the user
56
+ * having to duplicate the variant declaration.
57
+ * @param css Theme CSS source.
58
+ * @param table Scheme → var-name → value table from {@link extractThemeVars}.
59
+ * @returns CSS ready to feed `@tailwindcss/node`'s compiler.
60
+ */
61
+ export declare function compileReadyTheme(css: string, table: ThemeSchemeTable): string;