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,395 @@
1
+ /** Match atom names like `border-hairline`, `h-hairline`, `border-t-hairline`, etc. */
2
+ const HAIRLINE_ATOM = /-hairline$/;
3
+ /** Parser's synthetic "no variant" scheme — provides the canonical fallback. */
4
+ const BASE_SCHEME = 'base';
5
+ /** Runtime registry key for the always-loaded fallback scheme. */
6
+ const COMMON_SCHEME = 'common';
7
+ /** Sentinel key the parser sets on interactive (`active:`/`focus:`) atoms. */
8
+ const STATE_KEY = '__state';
9
+ /**
10
+ * Whether an atom is a `*-hairline` utility — its numeric value must be
11
+ * rewritten as `StyleSheet.hairlineWidth` at runtime.
12
+ * @param atomName Class name.
13
+ * @returns True when the atom is a hairline utility.
14
+ */
15
+ function isHairlineAtom(atomName) {
16
+ return HAIRLINE_ATOM.test(atomName);
17
+ }
18
+ /**
19
+ * Whether an RN style object carries any own key. The parser emits
20
+ * empty `{}` for schemes an atom doesn't apply to; we treat those as
21
+ * "inherit canonical" and don't emit an entry for that scheme.
22
+ * @param style RN style object.
23
+ * @returns Whether the style has content.
24
+ */
25
+ function isNonEmptyStyle(style) {
26
+ if (!style)
27
+ return false;
28
+ return Object.keys(style).length > 0;
29
+ }
30
+ /**
31
+ * Iterate per-scheme entries from a parser-produced schemed bucket,
32
+ * skipping the reserved `__state` metadata key.
33
+ * @param schemed Parser output for one atom.
34
+ * @yields `[scheme, style]` pairs in object-key order.
35
+ */
36
+ function* iterScheme(schemed) {
37
+ const raw = schemed;
38
+ for (const key in raw) {
39
+ if (key === STATE_KEY)
40
+ continue;
41
+ yield [key, raw[key]];
42
+ }
43
+ }
44
+ /**
45
+ * Pick the canonical style for an atom — the value that goes into
46
+ * `common.style.js`. Prefers the parser's `base` entry (the "default
47
+ * when no variant matches"); falls back to the first non-empty per-
48
+ * scheme entry when the atom has no explicit base.
49
+ * @param schemed Parser-produced per-scheme bucket.
50
+ * @returns Canonical style, or undefined when every scheme is empty.
51
+ */
52
+ function canonicalValue(schemed) {
53
+ const baseEntry = schemed[BASE_SCHEME];
54
+ if (isNonEmptyStyle(baseEntry))
55
+ return baseEntry;
56
+ for (const [, style] of iterScheme(schemed)) {
57
+ if (isNonEmptyStyle(style))
58
+ return style;
59
+ }
60
+ return undefined;
61
+ }
62
+ /**
63
+ * Collect every variant scheme name across the project's atoms. The
64
+ * synthetic `base` scheme is excluded — it's folded into the `common`
65
+ * output. Returns variants in sorted order for deterministic output.
66
+ * @param resolved Parser-produced atom map.
67
+ * @returns Variant scheme names (no `base`, no `common`).
68
+ */
69
+ function collectVariantSchemes(resolved) {
70
+ const set = new Set();
71
+ for (const schemed of resolved.values()) {
72
+ for (const [scheme] of iterScheme(schemed)) {
73
+ if (scheme !== BASE_SCHEME)
74
+ set.add(scheme);
75
+ }
76
+ }
77
+ return [...set].toSorted((a, b) => a.localeCompare(b));
78
+ }
79
+ /**
80
+ * Normalize a CSS keyframe selector to the percentage form Reanimated
81
+ * v4 keyframes objects use.
82
+ * @param offset Selector text (`'from'`, `'to'`, `'50%'`).
83
+ * @returns Percentage string.
84
+ */
85
+ function offsetToPercent(offset) {
86
+ if (offset === 'from')
87
+ return '0%';
88
+ if (offset === 'to')
89
+ return '100%';
90
+ return offset;
91
+ }
92
+ /**
93
+ * Replace a string `animationName` with the inline keyframes object
94
+ * Reanimated v4's CSS engine expects. Atoms whose `animationName`
95
+ * doesn't match any registered keyframe keep the original string.
96
+ * @param style RN style object (possibly carrying `animationName`).
97
+ * @param keyframes Keyframes available to this build.
98
+ * @returns Style with `animationName` inlined when matched.
99
+ */
100
+ function inlineAnimationName(style, keyframes) {
101
+ const name = style.animationName;
102
+ if (typeof name !== 'string')
103
+ return style;
104
+ const block = keyframes.get(name);
105
+ if (!block)
106
+ return style;
107
+ const out = { ...style };
108
+ const inline = {};
109
+ for (const step of block.steps)
110
+ inline[offsetToPercent(step.offset)] = step.style;
111
+ out.animationName = inline;
112
+ return out;
113
+ }
114
+ /**
115
+ * Convert any safe-area markers in the style into a precomputed spec
116
+ * envelope. Atoms with `__safe` markers become
117
+ * `{__safeStyle: [[cssKey, sideTag, or, offset], ...]}` — the runtime
118
+ * resolver reads `value.__safeStyle` as a single property access and
119
+ * resolves against live insets without walking the value's keys.
120
+ * @param style RN style as resolved by the parser.
121
+ * @returns Original style OR the safe-style envelope.
122
+ */
123
+ function envelopeSafeMarkers(style) {
124
+ let specs = null;
125
+ for (const key of Object.keys(style)) {
126
+ const value = style[key];
127
+ if (typeof value !== 'object' || !value)
128
+ continue;
129
+ const marker = value;
130
+ if (typeof marker.__safe !== 'string')
131
+ continue;
132
+ if (!specs)
133
+ specs = [];
134
+ specs.push([key, marker.__safe, marker.or, marker.offset]);
135
+ }
136
+ if (!specs)
137
+ return style;
138
+ return { __safeStyle: specs };
139
+ }
140
+ /**
141
+ * Serialise a single atom's RN style to a JS object literal. Honors
142
+ * the `*-hairline` sentinel: numeric values get rewritten to
143
+ * `StyleSheet.hairlineWidth` so device-density differences land in the
144
+ * rendered border.
145
+ * @param atomName The atom's class name (used to detect hairline).
146
+ * @param style The atom's RN style object.
147
+ * @returns JS object-literal source.
148
+ */
149
+ function serializeStyle(atomName, style) {
150
+ const json = JSON.stringify(style);
151
+ if (!isHairlineAtom(atomName))
152
+ return json;
153
+ return json.replaceAll(/:(-?\d+(?:\.\d+)?)/g, ': StyleSheet.hairlineWidth');
154
+ }
155
+ /**
156
+ * Serialise an atom's resolved value — bare RN style object or an
157
+ * already-enveloped safe-style value.
158
+ * @param atomName Atom name (controls hairline rewrite).
159
+ * @param value Atom value (bare style or `{__safeStyle: spec[]}`).
160
+ * @returns JS source for the value.
161
+ */
162
+ function serializeAtomValue(atomName, value) {
163
+ if (typeof value === 'object' && value !== null && '__safeStyle' in value)
164
+ return JSON.stringify(value);
165
+ return serializeStyle(atomName, value);
166
+ }
167
+ /**
168
+ * Resolve + envelope + serialize an atom's value under one scheme.
169
+ * @param atomName Atom name.
170
+ * @param style Raw RN style for this scheme.
171
+ * @param keyframes Keyframes available to this build.
172
+ * @returns Serialized text ready to emit.
173
+ */
174
+ function prepareAtomValue(atomName, style, keyframes) {
175
+ const enveloped = envelopeSafeMarkers(inlineAnimationName(style, keyframes));
176
+ return serializeAtomValue(atomName, enveloped);
177
+ }
178
+ /**
179
+ * Per-file value deduplicator — interns each unique serialized atom
180
+ * value once and emits `const _s<N> = <value>` at module scope. Scheme
181
+ * entries reference the const instead of inlining the literal.
182
+ *
183
+ * Wins: (1) smaller bundle bytes for themes with many atoms sharing a
184
+ * style shape; (2) stable `===` inside one scheme so two atoms
185
+ * resolving to the same value yield the same object reference.
186
+ */
187
+ class ValueDeduper {
188
+ byText = new Map();
189
+ decls = [];
190
+ intern(serialized) {
191
+ const existing = this.byText.get(serialized);
192
+ if (existing)
193
+ return existing;
194
+ const name = `_s${this.decls.length}`;
195
+ this.decls.push(`const ${name} = ${serialized}`);
196
+ this.byText.set(serialized, name);
197
+ return name;
198
+ }
199
+ get declarations() {
200
+ return this.decls;
201
+ }
202
+ }
203
+ /**
204
+ * Render one scheme file's source. `entries` is the list of atoms this
205
+ * scheme contributes — for `common` every atom's canonical value; for
206
+ * a variant only atoms whose value differs from canonical. Hairline
207
+ * atoms in this file trigger the `StyleSheet` import.
208
+ * @param schemeName Registry key (`'common'` or the variant name).
209
+ * @param entries `[atomName, serializedValue]` pairs to emit.
210
+ * @returns JS source text.
211
+ */
212
+ function renderSchemeFile(schemeName, entries) {
213
+ const needsStyleSheet = entries.some(([atom]) => isHairlineAtom(atom));
214
+ const deduper = new ValueDeduper();
215
+ const recordLines = [];
216
+ for (const [atom, value] of entries) {
217
+ const ref = deduper.intern(value);
218
+ recordLines.push(` ${JSON.stringify(atom)}: ${ref},`);
219
+ }
220
+ const lines = [];
221
+ if (needsStyleSheet)
222
+ lines.push(`import { StyleSheet } from 'react-native'`);
223
+ lines.push(`import { registerAtoms } from 'rnwind'`, ``);
224
+ if (deduper.declarations.length > 0) {
225
+ for (const decl of deduper.declarations)
226
+ lines.push(decl);
227
+ lines.push(``);
228
+ }
229
+ lines.push(`registerAtoms(${JSON.stringify(schemeName)}, {`, ...recordLines, `})`, ``);
230
+ return lines.join('\n');
231
+ }
232
+ /**
233
+ * Render the JS-object literal for the responsive-breakpoint table the
234
+ * runtime registers at manifest-load time. Sorted by ascending px
235
+ * threshold so the runtime can build a deterministic "tier index" for
236
+ * its style cache.
237
+ * @param breakpoints Breakpoint name → px-threshold map.
238
+ * @returns Object-literal source (`{}` when empty).
239
+ */
240
+ function serializeBreakpoints(breakpoints) {
241
+ if (breakpoints.size === 0)
242
+ return '{}';
243
+ const entries = [...breakpoints].toSorted((a, b) => a[1] - b[1] || a[0].localeCompare(b[0]));
244
+ const inner = entries.map(([name, px]) => `${JSON.stringify(name)}: ${px}`).join(', ');
245
+ return `{ ${inner} }`;
246
+ }
247
+ /**
248
+ * Render the manifest module. Eager-imports `common.style.js` (every
249
+ * rewritten source file pulls this via a transitive side-effect
250
+ * import), registers the responsive-breakpoint table once, and lazy-
251
+ * requires every variant scheme's file through an inline require —
252
+ * first call in `ensureSchemeLoaded(name)` triggers the scheme
253
+ * module's evaluation; Metro's module cache makes subsequent calls
254
+ * no-ops.
255
+ * @param variants Variant scheme names (no `base`, no `common`).
256
+ * @param breakpoints Responsive breakpoint name → px-threshold map.
257
+ * @returns JS source text.
258
+ */
259
+ function renderManifest(variants, breakpoints) {
260
+ const lines = [
261
+ `import { registerSchemeLoader, registerBreakpoints } from 'rnwind'`,
262
+ `import './common.style'`,
263
+ ``,
264
+ `registerBreakpoints(${serializeBreakpoints(breakpoints)})`,
265
+ ``,
266
+ ];
267
+ if (variants.length === 0) {
268
+ lines.push(`function ensureSchemeLoaded(_name) {}`, ``, `registerSchemeLoader(ensureSchemeLoaded)`, ``, `export { ensureSchemeLoaded }`, ``);
269
+ return lines.join('\n');
270
+ }
271
+ lines.push(`const LOADERS = {`);
272
+ for (const variant of variants) {
273
+ lines.push(` ${JSON.stringify(variant)}: () => require(${JSON.stringify(`./${variant}.style`)}),`);
274
+ }
275
+ lines.push(`}`, ``, `function ensureSchemeLoaded(name) {`, ` const loader = LOADERS[name]`, ` if (loader) loader()`, `}`, ``, `registerSchemeLoader(ensureSchemeLoaded)`, ``, `export { ensureSchemeLoaded }`, ``);
276
+ return lines.join('\n');
277
+ }
278
+ /**
279
+ * Serialize one atom's canonical + variant-diff entries, honouring
280
+ * the per-atom cache. Returns the number of cache MISSES this atom
281
+ * incurred (0 when canonical was cached AND every needed variant was
282
+ * cached; 1 when anything had to be re-stringified). Split out of
283
+ * `buildSchemeSources` to keep that function under the repo's cognitive
284
+ * complexity budget.
285
+ *
286
+ * Two paths gated on whether the parser produced a non-empty `base`
287
+ * bucket:
288
+ * - **Themed atom (base present)**: canonical goes to `common`, each
289
+ * variant whose own value diverges from canonical writes the diff
290
+ * into its own scheme file. `lookupAtom` then finds the variant's
291
+ * override or falls through to common.
292
+ * - **Scheme-gated atom (base empty)**: the atom only matches when a
293
+ * specific scheme is active (Tailwind `light:` / `dark:` / `brand:`
294
+ * selectors). Skipping `common` here is essential — registering it
295
+ * would let the lookup fall through under non-matching schemes and
296
+ * leak the variant style into every scheme. Each populated variant
297
+ * bucket writes the value into its own scheme file directly.
298
+ * @param atom Atom name.
299
+ * @param schemed Parser-produced schemed bucket for the atom.
300
+ * @param canonical Canonical RN style for `common`.
301
+ * @param variants Variant scheme names in deterministic order.
302
+ * @param keyframes Keyframes available to inline.
303
+ * @param commonEntries Mutable collector for `common`'s `[atom, text]` pairs.
304
+ * @param variantEntries Mutable collector keyed by variant name.
305
+ * @param cache Optional shared serialized-value cache.
306
+ * @returns Number of JSON.stringify passes triggered for this atom.
307
+ */
308
+ function collectAtomEntries(atom, schemed, canonical, variants, keyframes, commonEntries, variantEntries, cache) {
309
+ const cached = cache?.get(atom);
310
+ const hit = cached?.styleRef === schemed;
311
+ const baseEntry = schemed[BASE_SCHEME];
312
+ const isSchemeGated = !isNonEmptyStyle(baseEntry);
313
+ const canonicalText = hit ? cached.canonical : prepareAtomValue(atom, canonical, keyframes);
314
+ if (!isSchemeGated)
315
+ commonEntries.push([atom, canonicalText]);
316
+ const entry = hit
317
+ ? cached
318
+ : { styleRef: schemed, canonical: canonicalText, variants: new Map() };
319
+ if (!hit)
320
+ cache?.set(atom, entry);
321
+ for (const variant of variants) {
322
+ const own = schemed[variant];
323
+ if (!isNonEmptyStyle(own))
324
+ continue;
325
+ let ownText = entry.variants.get(variant);
326
+ if (ownText === undefined) {
327
+ ownText = prepareAtomValue(atom, own, keyframes);
328
+ entry.variants.set(variant, ownText);
329
+ }
330
+ if (!isSchemeGated && ownText === canonicalText)
331
+ continue;
332
+ variantEntries[variant].push([atom, ownText]);
333
+ }
334
+ return hit ? 0 : 1;
335
+ }
336
+ /** Empty fallback when the caller didn't supply breakpoints (legacy callers, tests). */
337
+ const EMPTY_BREAKPOINTS = new Map();
338
+ /**
339
+ * Build the per-scheme style files + manifest source.
340
+ *
341
+ * Dedup rule (the thing that shrinks scheme files to their diff):
342
+ * - Every atom's canonical value goes into `common.style.js`.
343
+ * - Each variant's file emits an entry for an atom ONLY when the
344
+ * variant's own resolved value differs from canonical. When the
345
+ * variant inherits (parser emits an empty `{}` for that scheme) or
346
+ * the variant's resolved value serializes identically to canonical,
347
+ * the atom is omitted — at runtime the lookup falls through via
348
+ * `cache.atoms[scheme]?.[atom] ?? cache.atoms.common[atom]`.
349
+ *
350
+ * Keyframes are inlined directly into atom values via `animationName`
351
+ * ({@link inlineAnimationName}). Safe-area markers get pre-enveloped
352
+ * via {@link envelopeSafeMarkers}. Hairline utilities stay bound to
353
+ * `StyleSheet.hairlineWidth` at runtime.
354
+ * @param atomNames All atom names (sorted).
355
+ * @param resolved Per-atom schemed styles from the parser.
356
+ * @param keyframes Keyframe blocks referenced by any atom.
357
+ * @param cache Optional shared serialized-value cache.
358
+ * @param breakpoints Responsive breakpoint name → px-threshold map. The
359
+ * manifest emits `registerBreakpoints({...})` so the runtime can gate
360
+ * `md:*` / `lg:*` atoms on `windowWidth`. Optional — empty when the
361
+ * theme declares no breakpoints (legacy/test callers).
362
+ * @returns Per-scheme sources, manifest source, variant list.
363
+ */
364
+ function buildSchemeSources(atomNames, resolved, keyframes, cache, breakpoints = EMPTY_BREAKPOINTS) {
365
+ const variants = collectVariantSchemes(resolved);
366
+ const commonEntries = [];
367
+ const variantEntries = {};
368
+ for (const variant of variants)
369
+ variantEntries[variant] = [];
370
+ let misses = 0;
371
+ for (const atom of atomNames) {
372
+ const schemed = resolved.get(atom);
373
+ if (!schemed)
374
+ continue;
375
+ const canonical = canonicalValue(schemed);
376
+ if (!canonical)
377
+ continue;
378
+ misses += collectAtomEntries(atom, schemed, canonical, variants, keyframes, commonEntries, variantEntries, cache);
379
+ }
380
+ const schemeSources = {
381
+ [COMMON_SCHEME]: renderSchemeFile(COMMON_SCHEME, commonEntries),
382
+ };
383
+ for (const variant of variants) {
384
+ schemeSources[variant] = renderSchemeFile(variant, variantEntries[variant]);
385
+ }
386
+ return {
387
+ schemeSources,
388
+ manifestSource: renderManifest(variants, breakpoints),
389
+ variants,
390
+ serializedMisses: misses,
391
+ };
392
+ }
393
+
394
+ export { buildSchemeSources };
395
+ //# sourceMappingURL=build-style.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-style.mjs","sources":["../../../../../src/core/style-builder/build-style.ts"],"sourcesContent":["import type { KeyframeBlock, RNStyle, SchemedStyle } from '../parser'\n\n/** Match atom names like `border-hairline`, `h-hairline`, `border-t-hairline`, etc. */\nconst HAIRLINE_ATOM = /-hairline$/\n\n/** Parser's synthetic \"no variant\" scheme — provides the canonical fallback. */\nconst BASE_SCHEME = 'base'\n\n/** Runtime registry key for the always-loaded fallback scheme. */\nconst COMMON_SCHEME = 'common'\n\n/** Sentinel key the parser sets on interactive (`active:`/`focus:`) atoms. */\nconst STATE_KEY = '__state'\n\n/**\n * Whether an atom is a `*-hairline` utility — its numeric value must be\n * rewritten as `StyleSheet.hairlineWidth` at runtime.\n * @param atomName Class name.\n * @returns True when the atom is a hairline utility.\n */\nfunction isHairlineAtom(atomName: string): boolean {\n return HAIRLINE_ATOM.test(atomName)\n}\n\n/**\n * Whether an RN style object carries any own key. The parser emits\n * empty `{}` for schemes an atom doesn't apply to; we treat those as\n * \"inherit canonical\" and don't emit an entry for that scheme.\n * @param style RN style object.\n * @returns Whether the style has content.\n */\nfunction isNonEmptyStyle(style: RNStyle | undefined): style is RNStyle {\n if (!style) return false\n return Object.keys(style).length > 0\n}\n\n/**\n * Iterate per-scheme entries from a parser-produced schemed bucket,\n * skipping the reserved `__state` metadata key.\n * @param schemed Parser output for one atom.\n * @yields `[scheme, style]` pairs in object-key order.\n */\nfunction* iterScheme(schemed: SchemedStyle): IterableIterator<[string, RNStyle]> {\n const raw = schemed as Readonly<Record<string, RNStyle | string>>\n for (const key in raw) {\n if (key === STATE_KEY) continue\n yield [key, raw[key] as RNStyle]\n }\n}\n\n/**\n * Pick the canonical style for an atom — the value that goes into\n * `common.style.js`. Prefers the parser's `base` entry (the \"default\n * when no variant matches\"); falls back to the first non-empty per-\n * scheme entry when the atom has no explicit base.\n * @param schemed Parser-produced per-scheme bucket.\n * @returns Canonical style, or undefined when every scheme is empty.\n */\nfunction canonicalValue(schemed: SchemedStyle): RNStyle | undefined {\n const baseEntry = (schemed as Readonly<Record<string, RNStyle>>)[BASE_SCHEME]\n if (isNonEmptyStyle(baseEntry)) return baseEntry\n for (const [, style] of iterScheme(schemed)) {\n if (isNonEmptyStyle(style)) return style\n }\n return undefined\n}\n\n/**\n * Collect every variant scheme name across the project's atoms. The\n * synthetic `base` scheme is excluded — it's folded into the `common`\n * output. Returns variants in sorted order for deterministic output.\n * @param resolved Parser-produced atom map.\n * @returns Variant scheme names (no `base`, no `common`).\n */\nfunction collectVariantSchemes(resolved: ReadonlyMap<string, SchemedStyle>): readonly string[] {\n const set = new Set<string>()\n for (const schemed of resolved.values()) {\n for (const [scheme] of iterScheme(schemed)) {\n if (scheme !== BASE_SCHEME) set.add(scheme)\n }\n }\n return [...set].toSorted((a, b) => a.localeCompare(b))\n}\n\n/**\n * Normalize a CSS keyframe selector to the percentage form Reanimated\n * v4 keyframes objects use.\n * @param offset Selector text (`'from'`, `'to'`, `'50%'`).\n * @returns Percentage string.\n */\nfunction offsetToPercent(offset: string): string {\n if (offset === 'from') return '0%'\n if (offset === 'to') return '100%'\n return offset\n}\n\n/**\n * Replace a string `animationName` with the inline keyframes object\n * Reanimated v4's CSS engine expects. Atoms whose `animationName`\n * doesn't match any registered keyframe keep the original string.\n * @param style RN style object (possibly carrying `animationName`).\n * @param keyframes Keyframes available to this build.\n * @returns Style with `animationName` inlined when matched.\n */\nfunction inlineAnimationName(style: RNStyle, keyframes: ReadonlyMap<string, KeyframeBlock>): RNStyle {\n const name = style.animationName\n if (typeof name !== 'string') return style\n const block = keyframes.get(name)\n if (!block) return style\n const out: RNStyle = { ...style }\n const inline: Record<string, Record<string, string | number>> = {}\n for (const step of block.steps) inline[offsetToPercent(step.offset)] = step.style as Record<string, string | number>\n out.animationName = inline as unknown as RNStyle[string]\n return out\n}\n\n/**\n * Convert any safe-area markers in the style into a precomputed spec\n * envelope. Atoms with `__safe` markers become\n * `{__safeStyle: [[cssKey, sideTag, or, offset], ...]}` — the runtime\n * resolver reads `value.__safeStyle` as a single property access and\n * resolves against live insets without walking the value's keys.\n * @param style RN style as resolved by the parser.\n * @returns Original style OR the safe-style envelope.\n */\nfunction envelopeSafeMarkers(\n style: RNStyle,\n): RNStyle | { __safeStyle: readonly (readonly [string, string, number | undefined, number | undefined])[] } {\n let specs: [string, string, number | undefined, number | undefined][] | null = null\n for (const key of Object.keys(style)) {\n const value = style[key]\n if (typeof value !== 'object' || !value) continue\n const marker = value as { __safe?: string; or?: number; offset?: number }\n if (typeof marker.__safe !== 'string') continue\n if (!specs) specs = []\n specs.push([key, marker.__safe, marker.or, marker.offset])\n }\n if (!specs) return style\n return { __safeStyle: specs }\n}\n\n/**\n * Serialise a single atom's RN style to a JS object literal. Honors\n * the `*-hairline` sentinel: numeric values get rewritten to\n * `StyleSheet.hairlineWidth` so device-density differences land in the\n * rendered border.\n * @param atomName The atom's class name (used to detect hairline).\n * @param style The atom's RN style object.\n * @returns JS object-literal source.\n */\nfunction serializeStyle(atomName: string, style: RNStyle): string {\n const json = JSON.stringify(style)\n if (!isHairlineAtom(atomName)) return json\n return json.replaceAll(/:(-?\\d+(?:\\.\\d+)?)/g, ': StyleSheet.hairlineWidth')\n}\n\n/**\n * Serialise an atom's resolved value — bare RN style object or an\n * already-enveloped safe-style value.\n * @param atomName Atom name (controls hairline rewrite).\n * @param value Atom value (bare style or `{__safeStyle: spec[]}`).\n * @returns JS source for the value.\n */\nfunction serializeAtomValue(atomName: string, value: unknown): string {\n if (typeof value === 'object' && value !== null && '__safeStyle' in value) return JSON.stringify(value)\n return serializeStyle(atomName, value as RNStyle)\n}\n\n/**\n * Resolve + envelope + serialize an atom's value under one scheme.\n * @param atomName Atom name.\n * @param style Raw RN style for this scheme.\n * @param keyframes Keyframes available to this build.\n * @returns Serialized text ready to emit.\n */\nfunction prepareAtomValue(atomName: string, style: RNStyle, keyframes: ReadonlyMap<string, KeyframeBlock>): string {\n const enveloped = envelopeSafeMarkers(inlineAnimationName(style, keyframes))\n return serializeAtomValue(atomName, enveloped)\n}\n\n/**\n * Per-file value deduplicator — interns each unique serialized atom\n * value once and emits `const _s<N> = <value>` at module scope. Scheme\n * entries reference the const instead of inlining the literal.\n *\n * Wins: (1) smaller bundle bytes for themes with many atoms sharing a\n * style shape; (2) stable `===` inside one scheme so two atoms\n * resolving to the same value yield the same object reference.\n */\nclass ValueDeduper {\n private readonly byText = new Map<string, string>()\n private readonly decls: string[] = []\n\n intern(serialized: string): string {\n const existing = this.byText.get(serialized)\n if (existing) return existing\n const name = `_s${this.decls.length}`\n this.decls.push(`const ${name} = ${serialized}`)\n this.byText.set(serialized, name)\n return name\n }\n\n get declarations(): readonly string[] {\n return this.decls\n }\n}\n\n/**\n * Render one scheme file's source. `entries` is the list of atoms this\n * scheme contributes — for `common` every atom's canonical value; for\n * a variant only atoms whose value differs from canonical. Hairline\n * atoms in this file trigger the `StyleSheet` import.\n * @param schemeName Registry key (`'common'` or the variant name).\n * @param entries `[atomName, serializedValue]` pairs to emit.\n * @returns JS source text.\n */\nfunction renderSchemeFile(schemeName: string, entries: readonly (readonly [string, string])[]): string {\n const needsStyleSheet = entries.some(([atom]) => isHairlineAtom(atom))\n const deduper = new ValueDeduper()\n const recordLines: string[] = []\n for (const [atom, value] of entries) {\n const ref = deduper.intern(value)\n recordLines.push(` ${JSON.stringify(atom)}: ${ref},`)\n }\n\n const lines: string[] = []\n if (needsStyleSheet) lines.push(`import { StyleSheet } from 'react-native'`)\n lines.push(`import { registerAtoms } from 'rnwind'`, ``)\n if (deduper.declarations.length > 0) {\n for (const decl of deduper.declarations) lines.push(decl)\n lines.push(``)\n }\n lines.push(`registerAtoms(${JSON.stringify(schemeName)}, {`, ...recordLines, `})`, ``)\n return lines.join('\\n')\n}\n\n/**\n * Render the JS-object literal for the responsive-breakpoint table the\n * runtime registers at manifest-load time. Sorted by ascending px\n * threshold so the runtime can build a deterministic \"tier index\" for\n * its style cache.\n * @param breakpoints Breakpoint name → px-threshold map.\n * @returns Object-literal source (`{}` when empty).\n */\nfunction serializeBreakpoints(breakpoints: ReadonlyMap<string, number>): string {\n if (breakpoints.size === 0) return '{}'\n const entries = [...breakpoints].toSorted((a, b) => a[1] - b[1] || a[0].localeCompare(b[0]))\n const inner = entries.map(([name, px]) => `${JSON.stringify(name)}: ${px}`).join(', ')\n return `{ ${inner} }`\n}\n\n/**\n * Render the manifest module. Eager-imports `common.style.js` (every\n * rewritten source file pulls this via a transitive side-effect\n * import), registers the responsive-breakpoint table once, and lazy-\n * requires every variant scheme's file through an inline require —\n * first call in `ensureSchemeLoaded(name)` triggers the scheme\n * module's evaluation; Metro's module cache makes subsequent calls\n * no-ops.\n * @param variants Variant scheme names (no `base`, no `common`).\n * @param breakpoints Responsive breakpoint name → px-threshold map.\n * @returns JS source text.\n */\nfunction renderManifest(variants: readonly string[], breakpoints: ReadonlyMap<string, number>): string {\n const lines: string[] = [\n `import { registerSchemeLoader, registerBreakpoints } from 'rnwind'`,\n `import './common.style'`,\n ``,\n `registerBreakpoints(${serializeBreakpoints(breakpoints)})`,\n ``,\n ]\n if (variants.length === 0) {\n lines.push(`function ensureSchemeLoaded(_name) {}`, ``, `registerSchemeLoader(ensureSchemeLoaded)`, ``, `export { ensureSchemeLoaded }`, ``)\n return lines.join('\\n')\n }\n lines.push(`const LOADERS = {`)\n for (const variant of variants) {\n lines.push(` ${JSON.stringify(variant)}: () => require(${JSON.stringify(`./${variant}.style`)}),`)\n }\n lines.push(`}`, ``, `function ensureSchemeLoaded(name) {`, ` const loader = LOADERS[name]`, ` if (loader) loader()`, `}`, ``, `registerSchemeLoader(ensureSchemeLoaded)`, ``, `export { ensureSchemeLoaded }`, ``)\n return lines.join('\\n')\n}\n\n/** Output of one build pass — one source per scheme plus the manifest. */\nexport interface BuildSchemeSourcesOutput {\n /** `<schemeName>.style.js` source per scheme. Always contains `common`. */\n readonly schemeSources: Readonly<Record<string, string>>\n /** Manifest module source (`schemes.js`). */\n readonly manifestSource: string\n /** Variant scheme names this build covers (sorted; excludes `common`). */\n readonly variants: readonly string[]\n /** Number of `prepareAtomValue` / JSON.stringify passes (cache MISSES) this call did — test telemetry. */\n readonly serializedMisses: number\n}\n\n/**\n * Per-atom cached serialized value. Canonical (common) string plus a\n * map of variant → own-serialized-string. `styleRef` is an identity\n * guard against the resolved SchemedStyle — when callers replace an\n * atom's value the ref diverges and the cache rebuilds that entry.\n */\nexport interface AtomSerializedEntry {\n styleRef: SchemedStyle\n canonical: string\n variants: Map<string, string>\n}\n\n/** Cache UnionBuilder owns across repeated writeSchemes calls. */\nexport type AtomSerializedCache = Map<string, AtomSerializedEntry>\n\n/**\n * Serialize one atom's canonical + variant-diff entries, honouring\n * the per-atom cache. Returns the number of cache MISSES this atom\n * incurred (0 when canonical was cached AND every needed variant was\n * cached; 1 when anything had to be re-stringified). Split out of\n * `buildSchemeSources` to keep that function under the repo's cognitive\n * complexity budget.\n *\n * Two paths gated on whether the parser produced a non-empty `base`\n * bucket:\n * - **Themed atom (base present)**: canonical goes to `common`, each\n * variant whose own value diverges from canonical writes the diff\n * into its own scheme file. `lookupAtom` then finds the variant's\n * override or falls through to common.\n * - **Scheme-gated atom (base empty)**: the atom only matches when a\n * specific scheme is active (Tailwind `light:` / `dark:` / `brand:`\n * selectors). Skipping `common` here is essential — registering it\n * would let the lookup fall through under non-matching schemes and\n * leak the variant style into every scheme. Each populated variant\n * bucket writes the value into its own scheme file directly.\n * @param atom Atom name.\n * @param schemed Parser-produced schemed bucket for the atom.\n * @param canonical Canonical RN style for `common`.\n * @param variants Variant scheme names in deterministic order.\n * @param keyframes Keyframes available to inline.\n * @param commonEntries Mutable collector for `common`'s `[atom, text]` pairs.\n * @param variantEntries Mutable collector keyed by variant name.\n * @param cache Optional shared serialized-value cache.\n * @returns Number of JSON.stringify passes triggered for this atom.\n */\nfunction collectAtomEntries(\n atom: string,\n schemed: SchemedStyle,\n canonical: RNStyle,\n variants: readonly string[],\n keyframes: ReadonlyMap<string, KeyframeBlock>,\n commonEntries: (readonly [string, string])[],\n variantEntries: Record<string, (readonly [string, string])[]>,\n cache?: AtomSerializedCache,\n): number {\n const cached = cache?.get(atom)\n const hit = cached?.styleRef === schemed\n const baseEntry = (schemed as Readonly<Record<string, RNStyle>>)[BASE_SCHEME]\n const isSchemeGated = !isNonEmptyStyle(baseEntry)\n const canonicalText = hit ? cached.canonical : prepareAtomValue(atom, canonical, keyframes)\n if (!isSchemeGated) commonEntries.push([atom, canonicalText])\n const entry: AtomSerializedEntry = hit\n ? cached\n : { styleRef: schemed, canonical: canonicalText, variants: new Map<string, string>() }\n if (!hit) cache?.set(atom, entry)\n\n for (const variant of variants) {\n const own = (schemed as Readonly<Record<string, RNStyle>>)[variant]\n if (!isNonEmptyStyle(own)) continue\n let ownText = entry.variants.get(variant)\n if (ownText === undefined) {\n ownText = prepareAtomValue(atom, own, keyframes)\n entry.variants.set(variant, ownText)\n }\n if (!isSchemeGated && ownText === canonicalText) continue\n variantEntries[variant].push([atom, ownText])\n }\n return hit ? 0 : 1\n}\n\n/** Empty fallback when the caller didn't supply breakpoints (legacy callers, tests). */\nconst EMPTY_BREAKPOINTS: ReadonlyMap<string, number> = new Map()\n\n/**\n * Build the per-scheme style files + manifest source.\n *\n * Dedup rule (the thing that shrinks scheme files to their diff):\n * - Every atom's canonical value goes into `common.style.js`.\n * - Each variant's file emits an entry for an atom ONLY when the\n * variant's own resolved value differs from canonical. When the\n * variant inherits (parser emits an empty `{}` for that scheme) or\n * the variant's resolved value serializes identically to canonical,\n * the atom is omitted — at runtime the lookup falls through via\n * `cache.atoms[scheme]?.[atom] ?? cache.atoms.common[atom]`.\n *\n * Keyframes are inlined directly into atom values via `animationName`\n * ({@link inlineAnimationName}). Safe-area markers get pre-enveloped\n * via {@link envelopeSafeMarkers}. Hairline utilities stay bound to\n * `StyleSheet.hairlineWidth` at runtime.\n * @param atomNames All atom names (sorted).\n * @param resolved Per-atom schemed styles from the parser.\n * @param keyframes Keyframe blocks referenced by any atom.\n * @param cache Optional shared serialized-value cache.\n * @param breakpoints Responsive breakpoint name → px-threshold map. The\n * manifest emits `registerBreakpoints({...})` so the runtime can gate\n * `md:*` / `lg:*` atoms on `windowWidth`. Optional — empty when the\n * theme declares no breakpoints (legacy/test callers).\n * @returns Per-scheme sources, manifest source, variant list.\n */\nexport function buildSchemeSources(\n atomNames: readonly string[],\n resolved: ReadonlyMap<string, SchemedStyle>,\n keyframes: ReadonlyMap<string, KeyframeBlock>,\n cache?: AtomSerializedCache,\n breakpoints: ReadonlyMap<string, number> = EMPTY_BREAKPOINTS,\n): BuildSchemeSourcesOutput {\n const variants = collectVariantSchemes(resolved)\n const commonEntries: (readonly [string, string])[] = []\n const variantEntries: Record<string, (readonly [string, string])[]> = {}\n for (const variant of variants) variantEntries[variant] = []\n let misses = 0\n\n for (const atom of atomNames) {\n const schemed = resolved.get(atom)\n if (!schemed) continue\n const canonical = canonicalValue(schemed)\n if (!canonical) continue\n misses += collectAtomEntries(atom, schemed, canonical, variants, keyframes, commonEntries, variantEntries, cache)\n }\n\n const schemeSources: Record<string, string> = {\n [COMMON_SCHEME]: renderSchemeFile(COMMON_SCHEME, commonEntries),\n }\n for (const variant of variants) {\n schemeSources[variant] = renderSchemeFile(variant, variantEntries[variant])\n }\n\n return {\n schemeSources,\n manifestSource: renderManifest(variants, breakpoints),\n variants,\n serializedMisses: misses,\n }\n}\n\n/** Registry key the runtime uses for the always-loaded fallback. */\nexport const COMMON_SCHEME_NAME: string = COMMON_SCHEME\n"],"names":[],"mappings":"AAEA;AACA,MAAM,aAAa,GAAG,YAAY;AAElC;AACA,MAAM,WAAW,GAAG,MAAM;AAE1B;AACA,MAAM,aAAa,GAAG,QAAQ;AAE9B;AACA,MAAM,SAAS,GAAG,SAAS;AAE3B;;;;;AAKG;AACH,SAAS,cAAc,CAAC,QAAgB,EAAA;AACtC,IAAA,OAAO,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC;AACrC;AAEA;;;;;;AAMG;AACH,SAAS,eAAe,CAAC,KAA0B,EAAA;AACjD,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,OAAO,KAAK;IACxB,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC;AACtC;AAEA;;;;;AAKG;AACH,UAAU,UAAU,CAAC,OAAqB,EAAA;IACxC,MAAM,GAAG,GAAG,OAAqD;AACjE,IAAA,KAAK,MAAM,GAAG,IAAI,GAAG,EAAE;QACrB,IAAI,GAAG,KAAK,SAAS;YAAE;QACvB,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAY,CAAC;IAClC;AACF;AAEA;;;;;;;AAOG;AACH,SAAS,cAAc,CAAC,OAAqB,EAAA;AAC3C,IAAA,MAAM,SAAS,GAAI,OAA6C,CAAC,WAAW,CAAC;IAC7E,IAAI,eAAe,CAAC,SAAS,CAAC;AAAE,QAAA,OAAO,SAAS;IAChD,KAAK,MAAM,GAAG,KAAK,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE;QAC3C,IAAI,eAAe,CAAC,KAAK,CAAC;AAAE,YAAA,OAAO,KAAK;IAC1C;AACA,IAAA,OAAO,SAAS;AAClB;AAEA;;;;;;AAMG;AACH,SAAS,qBAAqB,CAAC,QAA2C,EAAA;AACxE,IAAA,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU;IAC7B,KA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aAAa,CAAC;KAChE;AACD,IAAA,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;AAC9B,QAAA,aAAa,CAAC,OAAO,CAAC,GAAG,gBAAgB,CAAC,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IAC7E;IAEA,OAAO;QACL,aAAa;AACb,QAAA,cAAc,EAAE,cAAc,CAAC,QAAQ,EAAE,WAAW,CAAC;QACrD,QAAQ;AACR,QAAA,gBAAgB,EAAE,MAAM;KACzB;AACH;;;;"}
@@ -0,0 +1,3 @@
1
+ export { UnionBuilder } from './union-builder';
2
+ export { buildSchemeSources, COMMON_SCHEME_NAME } from './build-style';
3
+ export type { BuildSchemeSourcesOutput } from './build-style';
@@ -0,0 +1,128 @@
1
+ import type { KeyframeBlock, SchemedStyle, TailwindParser } from '../parser';
2
+ /**
3
+ * In-memory atom union + per-scheme style-file emitter.
4
+ *
5
+ * Correctness under multi-worker Metro relies on `ensureProjectScanned`:
6
+ * the FIRST `recordFile` / `writeSchemes` call in every worker drives
7
+ * the oxide Scanner across ALL project sources and hydrates the union
8
+ * with the complete set of candidates. Subsequent per-file
9
+ * `recordFile` calls only layer in atoms the scan already knew about,
10
+ * so writes are idempotent — different workers can't clobber each
11
+ * other's scheme files with partial views.
12
+ *
13
+ * Per-file deltas (atom set unchanged → early return) skip
14
+ * serialization entirely. On a theme-CSS change, `getRnwindState`
15
+ * builds a fresh parser + builder; the next call re-runs
16
+ * `ensureProjectScanned` against the new parser, producing scheme
17
+ * files with the new theme values.
18
+ */
19
+ declare class UnionBuilder {
20
+ private readonly cacheDir;
21
+ private readonly parser;
22
+ private readonly unionAtoms;
23
+ private readonly unionKeyframes;
24
+ /**
25
+ * Responsive breakpoints captured from the parser. Refreshed on every
26
+ * `recordFile` / `ensureProjectScanned` so user-defined
27
+ * `--breakpoint-*` overrides land in the manifest the next time it's
28
+ * written. Identical for every parser call within one parser instance
29
+ * (theme is fixed for the parser's lifetime), so storing the latest
30
+ * snapshot is sufficient.
31
+ */
32
+ private breakpoints;
33
+ /** file → set of atom names this file currently contributes. */
34
+ private readonly fileAtomSets;
35
+ /** atom name → how many files currently contribute it (refcount). */
36
+ private readonly atomRefCount;
37
+ /** scheme → last-written source SHA. Skips re-writing unchanged schemes. */
38
+ private readonly schemeSignatures;
39
+ /**
40
+ * Per-atom serialized-value cache — identity-keyed on each atom's
41
+ * SchemedStyle reference. Carried across `writeSchemes` calls so the
42
+ * typical "user added one className" FR case re-stringifies ONE atom
43
+ * instead of all 175+. Cleared on `ensureProjectScanned` (full
44
+ * rescan replaces every reference) and individually invalidated for
45
+ * any atom `applyDiff` mutates.
46
+ */
47
+ private readonly serializedCache;
48
+ /** Running count of stringify passes (cache misses). Test telemetry. */
49
+ private serializedMissesCount;
50
+ /** Set after `ensureProjectScanned` completes. */
51
+ private projectScanned;
52
+ /** Promise guard so concurrent first-calls await ONE scan. */
53
+ private pendingScan;
54
+ constructor(cacheDir: string, parser: TailwindParser);
55
+ /** Absolute path of the manifest module (`rnwind/__generated/schemes`). */
56
+ get manifestPath(): string;
57
+ /**
58
+ * Snapshot of every source file the builder has recorded atoms for
59
+ * this worker session. Used by `withRnwindConfig`'s CSS watcher to
60
+ * touch `mtime` on each and nudge Metro into re-transforming them
61
+ * with the new theme values.
62
+ * @returns Absolute source paths.
63
+ */
64
+ recordedFiles(): readonly string[];
65
+ /** Cumulative cache-miss count — exposed for tests to assert cache behaviour. */
66
+ get serializedMisses(): number;
67
+ /**
68
+ * Absolute path of one scheme's style file.
69
+ * @param scheme Registry key.
70
+ * @returns Absolute path.
71
+ */
72
+ schemePath(scheme: string): string;
73
+ /**
74
+ * One-shot oxide scan + compile across every source the parser was
75
+ * configured with. Idempotent — safe to call from any entry point.
76
+ * Concurrent callers share the same in-flight promise.
77
+ */
78
+ ensureProjectScanned(): Promise<void>;
79
+ /**
80
+ * Record one source file's resolved atoms + keyframes. Short-circuits
81
+ * when the file's atom name set hasn't changed — the common case on
82
+ * every Fast Refresh save of a file whose className literals are
83
+ * unchanged.
84
+ * @param file Absolute source file path.
85
+ * @param atoms Per-atom resolved schemed styles from this transform.
86
+ * @param keyframes Keyframe blocks referenced by this file's atoms.
87
+ * @returns `{ changed: true }` when the union shifted (new atom name,
88
+ * removed atom name, or new keyframe) — the transformer uses this
89
+ * to skip the serializer + `writeSchemes` when nothing changed.
90
+ */
91
+ recordFile(file: string, atoms: ReadonlyMap<string, SchemedStyle>, keyframes: ReadonlyMap<string, KeyframeBlock>): Promise<{
92
+ changed: boolean;
93
+ }>;
94
+ /**
95
+ * Forget one source file's contribution. Idempotent — repeated calls
96
+ * for a file that's already dropped are no-ops. Does NOT remove the
97
+ * atom from the union when another file (or the project scan) still
98
+ * references it.
99
+ * @param file Absolute source file path.
100
+ */
101
+ dropFile(file: string): void;
102
+ /**
103
+ * Serialize the union into per-scheme files + manifest, writing only
104
+ * files whose source bytes changed. Called after every `recordFile`
105
+ * from the transformer — and once at Metro startup via
106
+ * `ensureFilesExist` to seed disk from the project scan alone.
107
+ * @returns List of scheme keys whose files were rewritten (empty
108
+ * when the union is byte-identical to the last flush).
109
+ */
110
+ writeSchemes(): Promise<{
111
+ changedSchemes: readonly string[];
112
+ }>;
113
+ /**
114
+ * Ensure the manifest + common scheme files exist on disk so Metro's
115
+ * resolver can SHA1 them at boot before the first transform runs.
116
+ */
117
+ ensureFilesExist(): Promise<void>;
118
+ /**
119
+ * Apply one file's atom-name diff to the in-memory refcount + union.
120
+ * @param file Source file path.
121
+ * @param newAtoms New atom-name set for the file.
122
+ * @param resolvedAtoms Fresh parser output — carries the resolved
123
+ * styles for every entry in `newAtoms`.
124
+ * @param newKeyframes Keyframes this file's atoms reference.
125
+ */
126
+ private applyDiff;
127
+ }
128
+ export { UnionBuilder };