rnwind 0.0.1 → 0.0.3

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 +193 -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 +120 -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 +110 -0
  36. package/lib/cjs/core/parser/length.cjs.map +1 -0
  37. package/lib/cjs/core/parser/length.d.ts +51 -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 +188 -0
  51. package/lib/cjs/core/parser/shorthand.cjs.map +1 -0
  52. package/lib/cjs/core/parser/shorthand.d.ts +67 -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 +467 -0
  57. package/lib/cjs/core/parser/theme-vars.cjs.map +1 -0
  58. package/lib/cjs/core/parser/theme-vars.d.ts +82 -0
  59. package/lib/cjs/core/parser/tokens.cjs +486 -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 +1680 -0
  66. package/lib/cjs/core/parser/tw-parser.cjs.map +1 -0
  67. package/lib/cjs/core/parser/tw-parser.d.ts +210 -0
  68. package/lib/cjs/core/parser/types.d.ts +37 -0
  69. package/lib/cjs/core/parser/typography-dispatcher.cjs +108 -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 +444 -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 +301 -0
  93. package/lib/cjs/metro/state.cjs.map +1 -0
  94. package/lib/cjs/metro/state.d.ts +88 -0
  95. package/lib/cjs/metro/transform-ast.cjs +1472 -0
  96. package/lib/cjs/metro/transform-ast.cjs.map +1 -0
  97. package/lib/cjs/metro/transform-ast.d.ts +88 -0
  98. package/lib/cjs/metro/transformer.cjs +372 -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 +79 -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 +191 -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 +118 -0
  172. package/lib/esm/core/parser/layout-dispatcher.mjs.map +1 -0
  173. package/lib/esm/core/parser/length.d.ts +51 -0
  174. package/lib/esm/core/parser/length.mjs +104 -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 +67 -0
  189. package/lib/esm/core/parser/shorthand.mjs +180 -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 +82 -0
  195. package/lib/esm/core/parser/theme-vars.mjs +461 -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 +480 -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 +210 -0
  204. package/lib/esm/core/parser/tw-parser.mjs +1678 -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 +106 -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 +442 -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 +88 -0
  231. package/lib/esm/metro/state.mjs +291 -0
  232. package/lib/esm/metro/state.mjs.map +1 -0
  233. package/lib/esm/metro/transform-ast.d.ts +88 -0
  234. package/lib/esm/metro/transform-ast.mjs +1451 -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 +349 -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 +79 -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 +80 -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 +191 -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 +111 -0
  291. package/src/core/parser/length.ts +114 -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 +182 -0
  297. package/src/core/parser/text-truncate.ts +79 -0
  298. package/src/core/parser/theme-vars.ts +465 -0
  299. package/src/core/parser/tokens.ts +456 -0
  300. package/src/core/parser/transform.ts +195 -0
  301. package/src/core/parser/tw-parser.ts +1828 -0
  302. package/src/core/parser/types.ts +45 -0
  303. package/src/core/parser/typography-dispatcher.ts +97 -0
  304. package/src/core/parser/typography.ts +83 -0
  305. package/src/core/style-builder/build-style.ts +500 -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 +305 -0
  313. package/src/metro/transform-ast.ts +1729 -0
  314. package/src/metro/transformer.ts +372 -0
  315. package/src/metro/warn-unknown-classes.ts +79 -0
  316. package/src/metro/with-config.ts +251 -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,130 @@
1
+ import { cssColorToString } from './color.mjs';
2
+
3
+ /**
4
+ * Gradient-atom extractor.
5
+ *
6
+ * Tailwind v4's gradient system is encoded as a set of CSS custom
7
+ * properties Tailwind writes onto specific utility class rules:
8
+ *
9
+ * .from-red-500 → `--tw-gradient-from: #ef4444`
10
+ * .via-green-500 → `--tw-gradient-via: #22c55e`
11
+ * .to-blue-500 → `--tw-gradient-to: #3b82f6`
12
+ * .bg-gradient-to-r → `--tw-gradient-position: to right`
13
+ * .bg-linear-to-br → `--tw-gradient-position: to bottom right`
14
+ *
15
+ * None of these set properties React Native can render (`backgroundImage:
16
+ * linear-gradient(...)` is web-only). Instead, rnwind treats them as
17
+ * **metadata**: the transformer strips gradient atoms from the JSX
18
+ * site's className and emits `colors={[...]} start={...} end={...}`
19
+ * props on the original component (user supplies `<LinearGradient>`
20
+ * from `expo-linear-gradient` or similar).
21
+ *
22
+ * This module walks a lightningcss declaration list, notices the
23
+ * `--tw-gradient-*` writes, and surfaces them as a compact
24
+ * {@link GradientAtomInfo} record the transformer can read per atom.
25
+ */
26
+ /**
27
+ * Inspect a rule's declaration list for `--tw-gradient-*` writes and
28
+ * return the atom's role + data. Returns `null` for rules that don't
29
+ * belong to a gradient utility.
30
+ * @param declarations Declarations from one lightningcss style rule.
31
+ * @returns Gradient info, or null.
32
+ */
33
+ function detectGradientAtom(declarations) {
34
+ for (const decl of declarations) {
35
+ if (decl.property !== 'custom')
36
+ continue;
37
+ const custom = decl.value;
38
+ const name = typeof custom.name === 'string' ? custom.name : custom.name.name;
39
+ if (!name.startsWith('--tw-gradient-'))
40
+ continue;
41
+ if (name === '--tw-gradient-from')
42
+ return fromColor('from', custom.value);
43
+ if (name === '--tw-gradient-via')
44
+ return fromColor('via', custom.value);
45
+ if (name === '--tw-gradient-to')
46
+ return fromColor('to', custom.value);
47
+ if (name === '--tw-gradient-position')
48
+ return fromDirection(custom.value);
49
+ }
50
+ return null;
51
+ }
52
+ /**
53
+ * Extract a single color token from a custom-property value list and
54
+ * return the `{role, color}` record. Returns `null` when no color token
55
+ * is present (defensive — Tailwind always emits one, but future output
56
+ * shapes may not).
57
+ * @param role Target role (`from` / `via` / `to`).
58
+ * @param tokens Value tokens from the `--tw-gradient-*` declaration.
59
+ * @returns Gradient info, or null.
60
+ */
61
+ function fromColor(role, tokens) {
62
+ if (!tokens)
63
+ return null;
64
+ for (const token of tokens) {
65
+ if (token.type !== 'color')
66
+ continue;
67
+ const color = cssColorToString(token.value);
68
+ if (!color)
69
+ return null;
70
+ return { role, color };
71
+ }
72
+ return null;
73
+ }
74
+ /**
75
+ * Interpret a `--tw-gradient-position` value list as a direction tag.
76
+ * Tailwind emits plain idents (`to`, `right`, `bottom`, …) for the
77
+ * 8 stock corners.
78
+ * @param tokens Value tokens from `--tw-gradient-position`.
79
+ * @returns Direction record, or null when unrecognised.
80
+ */
81
+ function fromDirection(tokens) {
82
+ if (!tokens)
83
+ return null;
84
+ const idents = [];
85
+ for (const token of tokens) {
86
+ if (token.type !== 'token')
87
+ continue;
88
+ if (token.value.type === 'ident')
89
+ idents.push(token.value.value);
90
+ }
91
+ const dir = directionFromIdents(idents);
92
+ if (!dir)
93
+ return null;
94
+ return { role: 'direction', dir };
95
+ }
96
+ /** Table of Tailwind-space direction idents → compact rnwind tag. */
97
+ const DIRECTION_TABLE = {
98
+ right: 'to-r',
99
+ left: 'to-l',
100
+ top: 'to-t',
101
+ bottom: 'to-b',
102
+ 'top-right': 'to-tr',
103
+ 'top-left': 'to-tl',
104
+ 'bottom-right': 'to-br',
105
+ 'bottom-left': 'to-bl',
106
+ };
107
+ /**
108
+ * Collapse the ident list Tailwind emits (`['to', 'right']`,
109
+ * `['to', 'bottom', 'right']`, etc.) into the compact tag the
110
+ * transformer hoists.
111
+ * @param idents Ident tokens from the declaration value.
112
+ * @returns One of the eight stock directions, `'unknown'`, or null.
113
+ */
114
+ function directionFromIdents(idents) {
115
+ if (idents.length === 0)
116
+ return null;
117
+ if (idents[0] !== 'to')
118
+ return 'unknown';
119
+ // Tailwind v4 appends `in <colourspace>` for colour interpolation
120
+ // (`to right in oklab`). Strip everything from the `in` keyword on
121
+ // — it's irrelevant for the point mapping.
122
+ const inIndex = idents.indexOf('in');
123
+ const rest = idents.slice(1, inIndex === -1 ? idents.length : inIndex);
124
+ if (rest.length === 0 || rest.length > 2)
125
+ return 'unknown';
126
+ return DIRECTION_TABLE[rest.join('-')] ?? 'unknown';
127
+ }
128
+
129
+ export { detectGradientAtom };
130
+ //# sourceMappingURL=gradient.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gradient.mjs","sources":["../../../../../src/core/parser/gradient.ts"],"sourcesContent":["/**\n * Gradient-atom extractor.\n *\n * Tailwind v4's gradient system is encoded as a set of CSS custom\n * properties Tailwind writes onto specific utility class rules:\n *\n * .from-red-500 → `--tw-gradient-from: #ef4444`\n * .via-green-500 → `--tw-gradient-via: #22c55e`\n * .to-blue-500 → `--tw-gradient-to: #3b82f6`\n * .bg-gradient-to-r → `--tw-gradient-position: to right`\n * .bg-linear-to-br → `--tw-gradient-position: to bottom right`\n *\n * None of these set properties React Native can render (`backgroundImage:\n * linear-gradient(...)` is web-only). Instead, rnwind treats them as\n * **metadata**: the transformer strips gradient atoms from the JSX\n * site's className and emits `colors={[...]} start={...} end={...}`\n * props on the original component (user supplies `<LinearGradient>`\n * from `expo-linear-gradient` or similar).\n *\n * This module walks a lightningcss declaration list, notices the\n * `--tw-gradient-*` writes, and surfaces them as a compact\n * {@link GradientAtomInfo} record the transformer can read per atom.\n */\n\nimport type { Declaration as LcDeclaration, TokenOrValue } from 'lightningcss'\nimport { cssColorToString } from './color'\n\n/**\n * The four roles an atom can play in a Tailwind v4 gradient. `from`,\n * `via`, `to` carry a color. `direction` carries one of the 8 stock\n * points (or a bare angle when Tailwind v4's `bg-linear-[angle]`\n * syntax is used).\n */\nexport type GradientAtomInfo =\n | { readonly role: 'from'; readonly color: string }\n | { readonly role: 'via'; readonly color: string }\n | { readonly role: 'to'; readonly color: string }\n | { readonly role: 'direction'; readonly dir: GradientDirection }\n\n/**\n * Eight stock corner directions Tailwind v4 ships. The transformer\n * maps each to a `(start, end)` pair of unit-square points the\n * expo-linear-gradient API expects. Unknown directions are surfaced as\n * `'unknown'` so the transformer can skip them gracefully.\n */\nexport type GradientDirection =\n | 'to-r'\n | 'to-l'\n | 'to-t'\n | 'to-b'\n | 'to-tr'\n | 'to-tl'\n | 'to-br'\n | 'to-bl'\n | 'unknown'\n\n/**\n * Inspect a rule's declaration list for `--tw-gradient-*` writes and\n * return the atom's role + data. Returns `null` for rules that don't\n * belong to a gradient utility.\n * @param declarations Declarations from one lightningcss style rule.\n * @returns Gradient info, or null.\n */\nfunction detectGradientAtom(declarations: readonly LcDeclaration[]): GradientAtomInfo | null {\n for (const decl of declarations) {\n if (decl.property !== 'custom') continue\n const custom = decl.value as { name: { name: string } | string; value?: readonly TokenOrValue[] }\n const name = typeof custom.name === 'string' ? custom.name : custom.name.name\n if (!name.startsWith('--tw-gradient-')) continue\n if (name === '--tw-gradient-from') return fromColor('from', custom.value)\n if (name === '--tw-gradient-via') return fromColor('via', custom.value)\n if (name === '--tw-gradient-to') return fromColor('to', custom.value)\n if (name === '--tw-gradient-position') return fromDirection(custom.value)\n }\n return null\n}\n\n/**\n * Extract a single color token from a custom-property value list and\n * return the `{role, color}` record. Returns `null` when no color token\n * is present (defensive — Tailwind always emits one, but future output\n * shapes may not).\n * @param role Target role (`from` / `via` / `to`).\n * @param tokens Value tokens from the `--tw-gradient-*` declaration.\n * @returns Gradient info, or null.\n */\nfunction fromColor(role: 'from' | 'via' | 'to', tokens: readonly TokenOrValue[] | undefined): GradientAtomInfo | null {\n if (!tokens) return null\n for (const token of tokens) {\n if (token.type !== 'color') continue\n const color = cssColorToString(token.value as never)\n if (!color) return null\n return { role, color } as GradientAtomInfo\n }\n return null\n}\n\n/**\n * Interpret a `--tw-gradient-position` value list as a direction tag.\n * Tailwind emits plain idents (`to`, `right`, `bottom`, …) for the\n * 8 stock corners.\n * @param tokens Value tokens from `--tw-gradient-position`.\n * @returns Direction record, or null when unrecognised.\n */\nfunction fromDirection(tokens: readonly TokenOrValue[] | undefined): GradientAtomInfo | null {\n if (!tokens) return null\n const idents: string[] = []\n for (const token of tokens) {\n if (token.type !== 'token') continue\n if (token.value.type === 'ident') idents.push(token.value.value as string)\n }\n const dir = directionFromIdents(idents)\n if (!dir) return null\n return { role: 'direction', dir }\n}\n\n/** Table of Tailwind-space direction idents → compact rnwind tag. */\nconst DIRECTION_TABLE: Record<string, GradientDirection> = {\n right: 'to-r',\n left: 'to-l',\n top: 'to-t',\n bottom: 'to-b',\n 'top-right': 'to-tr',\n 'top-left': 'to-tl',\n 'bottom-right': 'to-br',\n 'bottom-left': 'to-bl',\n}\n\n/**\n * Collapse the ident list Tailwind emits (`['to', 'right']`,\n * `['to', 'bottom', 'right']`, etc.) into the compact tag the\n * transformer hoists.\n * @param idents Ident tokens from the declaration value.\n * @returns One of the eight stock directions, `'unknown'`, or null.\n */\nfunction directionFromIdents(idents: readonly string[]): GradientDirection | null {\n if (idents.length === 0) return null\n if (idents[0] !== 'to') return 'unknown'\n // Tailwind v4 appends `in <colourspace>` for colour interpolation\n // (`to right in oklab`). Strip everything from the `in` keyword on\n // — it's irrelevant for the point mapping.\n const inIndex = idents.indexOf('in')\n const rest = idents.slice(1, inIndex === -1 ? idents.length : inIndex)\n if (rest.length === 0 || rest.length > 2) return 'unknown'\n return DIRECTION_TABLE[rest.join('-')] ?? 'unknown'\n}\n\nexport { detectGradientAtom }\n"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;;AAsBG;AAkCH;;;;;;AAMG;AACH,SAAS,kBAAkB,CAAC,YAAsC,EAAA;AAChE,IAAA,KAAK,MAAM,IAAI,IAAI,YAAY,EAAE;AAC/B,QAAA,IAAI,IAAI,CAAC,QAAQ,KAAK,QAAQ;YAAE;AAChC,QAAA,MAAM,MAAM,GAAG,IAAI,CAAC,KAA6E;QACjG,MAAM,IAAI,GAAG,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,GAAG,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI;AAC7E,QAAA,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC;YAAE;QACxC,IAAI,IAAI,KAAK,oBAAoB;YAAE,OAAO,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC;QACzE,IAAI,IAAI,KAAK,mBAAm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AW,EAAE,GAAG,EAAE;AACnC;AAEA;AACA,MAAM,eAAe,GAAsC;AACzD,IAAA,KAAK,EAAE,MAAM;AACb,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,GAAG,EAAE,MAAM;AACX,IAAA,MAAM,EAAE,MAAM;AACd,IAAA,WAAW,EAAE,OAAO;AACpB,IAAA,UAAU,EAAE,OAAO;AACnB,IAAA,cAAc,EAAE,OAAO;AACvB,IAAA,aAAa,EAAE,OAAO;CACvB;AAED;;;;;;AAMG;AACH,SAAS,mBAAmB,CAAC,MAAyB,EAAA;AACpD,IAAA,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;AAAE,QAAA,OAAO,IAAI;AACpC,IAAA,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI;AAAE,QAAA,OAAO,SAAS;;;;IAIxC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;IACpC,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,KAAK,EAAE,GAAG,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC;IACtE,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;AAAE,QAAA,OAAO,SAAS;IAC1D,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,SAAS;AACrD;;;;"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Haptic-atom extractor.
3
+ *
4
+ * rnwind's haptic utilities are declared in preset.css as `@utility`
5
+ * rules that write a single `--rnwind-haptic: <kind>[-<value>]` custom
6
+ * property. Lightningcss surfaces those custom-property writes on the
7
+ * style rule's declaration list; this module converts the raw marker
8
+ * text into a structured {@link HapticRequest} the transformer can
9
+ * hoist into JSX.
10
+ *
11
+ * Marker vocabulary:
12
+ *
13
+ * --rnwind-haptic: impact-Light | impact-Medium | impact-Heavy | impact-Soft | impact-Rigid;
14
+ * --rnwind-haptic: notification-Success | notification-Warning | notification-Error;
15
+ * --rnwind-haptic: selection;
16
+ *
17
+ * Everything else is returned as `null` so unknown markers don't leak
18
+ * into the transformer's map.
19
+ */
20
+ import type { Declaration as LcDeclaration } from 'lightningcss';
21
+ /**
22
+ * Structured haptic request the `onHaptics` callback receives. Union
23
+ * members mirror `expo-haptics`'s three entry points 1:1 so consumers
24
+ * can index directly into the enum (`Haptics.ImpactFeedbackStyle[req.style]`).
25
+ */
26
+ export type HapticRequest = {
27
+ readonly kind: 'impact';
28
+ readonly style: 'Light' | 'Medium' | 'Heavy' | 'Soft' | 'Rigid';
29
+ } | {
30
+ readonly kind: 'notification';
31
+ readonly type: 'Success' | 'Warning' | 'Error';
32
+ } | {
33
+ readonly kind: 'selection';
34
+ };
35
+ /** When during a component's lifecycle the haptic was triggered. */
36
+ export type HapticTrigger = 'mount' | 'pressIn' | 'pressOut' | 'focus' | 'hover';
37
+ /** User-provided callback fired by rnwind when a haptic atom resolves. */
38
+ export type OnHaptics = (request: HapticRequest, trigger: HapticTrigger) => void;
39
+ /**
40
+ * Inspect a rule's declaration list for a `--rnwind-haptic: <marker>`
41
+ * custom property and return the structured request. Returns `null`
42
+ * for rules that don't carry the marker.
43
+ * @param declarations Declarations from one lightningcss style rule.
44
+ * @returns Parsed haptic request, or null.
45
+ */
46
+ declare function detectHapticAtom(declarations: readonly LcDeclaration[]): HapticRequest | null;
47
+ export { detectHapticAtom };
@@ -0,0 +1,71 @@
1
+ import { serializeTokens } from './tokens.mjs';
2
+
3
+ /**
4
+ * Haptic-atom extractor.
5
+ *
6
+ * rnwind's haptic utilities are declared in preset.css as `@utility`
7
+ * rules that write a single `--rnwind-haptic: <kind>[-<value>]` custom
8
+ * property. Lightningcss surfaces those custom-property writes on the
9
+ * style rule's declaration list; this module converts the raw marker
10
+ * text into a structured {@link HapticRequest} the transformer can
11
+ * hoist into JSX.
12
+ *
13
+ * Marker vocabulary:
14
+ *
15
+ * --rnwind-haptic: impact-Light | impact-Medium | impact-Heavy | impact-Soft | impact-Rigid;
16
+ * --rnwind-haptic: notification-Success | notification-Warning | notification-Error;
17
+ * --rnwind-haptic: selection;
18
+ *
19
+ * Everything else is returned as `null` so unknown markers don't leak
20
+ * into the transformer's map.
21
+ */
22
+ const IMPACT_STYLES = new Set(['Light', 'Medium', 'Heavy', 'Soft', 'Rigid']);
23
+ const NOTIFICATION_TYPES = new Set(['Success', 'Warning', 'Error']);
24
+ /**
25
+ * Parse the raw marker text (post-serialization) into a
26
+ * {@link HapticRequest}, or `null` when the token is unrecognised.
27
+ * Shape: `impact-<Style>`, `notification-<Type>`, or bare `selection`.
28
+ * @param text Trimmed marker text.
29
+ * @returns Haptic request, or null.
30
+ */
31
+ function parseMarker(text) {
32
+ if (text === 'selection')
33
+ return { kind: 'selection' };
34
+ if (text.startsWith('impact-')) {
35
+ const style = text.slice('impact-'.length);
36
+ if (IMPACT_STYLES.has(style))
37
+ return { kind: 'impact', style: style };
38
+ return null;
39
+ }
40
+ if (text.startsWith('notification-')) {
41
+ const typeText = text.slice('notification-'.length);
42
+ if (NOTIFICATION_TYPES.has(typeText)) {
43
+ return { kind: 'notification', type: typeText };
44
+ }
45
+ return null;
46
+ }
47
+ return null;
48
+ }
49
+ /**
50
+ * Inspect a rule's declaration list for a `--rnwind-haptic: <marker>`
51
+ * custom property and return the structured request. Returns `null`
52
+ * for rules that don't carry the marker.
53
+ * @param declarations Declarations from one lightningcss style rule.
54
+ * @returns Parsed haptic request, or null.
55
+ */
56
+ function detectHapticAtom(declarations) {
57
+ for (const decl of declarations) {
58
+ if (decl.property !== 'custom')
59
+ continue;
60
+ const custom = decl.value;
61
+ const name = typeof custom.name === 'string' ? custom.name : custom.name.name;
62
+ if (name !== '--rnwind-haptic')
63
+ continue;
64
+ const text = serializeTokens(custom.value ?? []).trim();
65
+ return parseMarker(text);
66
+ }
67
+ return null;
68
+ }
69
+
70
+ export { detectHapticAtom };
71
+ //# sourceMappingURL=haptics.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"haptics.mjs","sources":["../../../../../src/core/parser/haptics.ts"],"sourcesContent":["/**\n * Haptic-atom extractor.\n *\n * rnwind's haptic utilities are declared in preset.css as `@utility`\n * rules that write a single `--rnwind-haptic: <kind>[-<value>]` custom\n * property. Lightningcss surfaces those custom-property writes on the\n * style rule's declaration list; this module converts the raw marker\n * text into a structured {@link HapticRequest} the transformer can\n * hoist into JSX.\n *\n * Marker vocabulary:\n *\n * --rnwind-haptic: impact-Light | impact-Medium | impact-Heavy | impact-Soft | impact-Rigid;\n * --rnwind-haptic: notification-Success | notification-Warning | notification-Error;\n * --rnwind-haptic: selection;\n *\n * Everything else is returned as `null` so unknown markers don't leak\n * into the transformer's map.\n */\n\nimport type { Declaration as LcDeclaration, TokenOrValue } from 'lightningcss'\nimport { serializeTokens } from './tokens'\n\n/**\n * Structured haptic request the `onHaptics` callback receives. Union\n * members mirror `expo-haptics`'s three entry points 1:1 so consumers\n * can index directly into the enum (`Haptics.ImpactFeedbackStyle[req.style]`).\n */\nexport type HapticRequest =\n | { readonly kind: 'impact'; readonly style: 'Light' | 'Medium' | 'Heavy' | 'Soft' | 'Rigid' }\n | { readonly kind: 'notification'; readonly type: 'Success' | 'Warning' | 'Error' }\n | { readonly kind: 'selection' }\n\n/** When during a component's lifecycle the haptic was triggered. */\nexport type HapticTrigger = 'mount' | 'pressIn' | 'pressOut' | 'focus' | 'hover'\n\n/** User-provided callback fired by rnwind when a haptic atom resolves. */\nexport type OnHaptics = (request: HapticRequest, trigger: HapticTrigger) => void\n\nconst IMPACT_STYLES = new Set(['Light', 'Medium', 'Heavy', 'Soft', 'Rigid'] as const)\ntype ImpactStyle = 'Light' | 'Medium' | 'Heavy' | 'Soft' | 'Rigid'\nconst NOTIFICATION_TYPES = new Set(['Success', 'Warning', 'Error'] as const)\ntype NotificationType = 'Success' | 'Warning' | 'Error'\n\n/**\n * Parse the raw marker text (post-serialization) into a\n * {@link HapticRequest}, or `null` when the token is unrecognised.\n * Shape: `impact-<Style>`, `notification-<Type>`, or bare `selection`.\n * @param text Trimmed marker text.\n * @returns Haptic request, or null.\n */\nfunction parseMarker(text: string): HapticRequest | null {\n if (text === 'selection') return { kind: 'selection' }\n if (text.startsWith('impact-')) {\n const style = text.slice('impact-'.length)\n if (IMPACT_STYLES.has(style as ImpactStyle)) return { kind: 'impact', style: style as ImpactStyle }\n return null\n }\n if (text.startsWith('notification-')) {\n const typeText = text.slice('notification-'.length)\n if (NOTIFICATION_TYPES.has(typeText as NotificationType)) {\n return { kind: 'notification', type: typeText as NotificationType }\n }\n return null\n }\n return null\n}\n\n/**\n * Inspect a rule's declaration list for a `--rnwind-haptic: <marker>`\n * custom property and return the structured request. Returns `null`\n * for rules that don't carry the marker.\n * @param declarations Declarations from one lightningcss style rule.\n * @returns Parsed haptic request, or null.\n */\nfunction detectHapticAtom(declarations: readonly LcDeclaration[]): HapticRequest | null {\n for (const decl of declarations) {\n if (decl.property !== 'custom') continue\n const custom = decl.value as { name: { name: string } | string; value?: readonly TokenOrValue[] }\n const name = typeof custom.name === 'string' ? custom.name : custom.name.name\n if (name !== '--rnwind-haptic') continue\n const text = serializeTokens(custom.value ?? []).trim()\n return parseMarker(text)\n }\n return null\n}\n\nexport { detectHapticAtom }\n"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;AAkBG;AAqBH,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAU,CAAC;AAErF,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAU,CAAC;AAG5E;;;;;;AAMG;AACH,SAAS,WAAW,CAAC,IAAY,EAAA;IAC/B,IAAI,IAAI,KAAK,WAAW;AAAE,QAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE;AACtD,IAAA,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,C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from './tw-parser';
3
+ export type { SourceEntry } from '@tailwindcss/oxide';
4
+ export type { RNStyle, RNStyleValue, RNEntry, SafeAreaMarker } from './types';
5
+ export type { GradientAtomInfo, GradientDirection } from './gradient';
6
+ export type { TextTruncateInfo } from './text-truncate';
7
+ export type { HapticRequest, HapticTrigger, OnHaptics } from './haptics';
8
+ export { BASE_SCHEME } from './theme-vars';
@@ -0,0 +1,26 @@
1
+ import type { Declaration as LcDeclaration, KeyframeSelector, KeyframesName } from 'lightningcss';
2
+ /**
3
+ * Extract the animation name of an `@keyframes` rule. lightningcss models
4
+ * the name as a discriminated union (`ident` / `custom`); both variants
5
+ * carry the same downstream string.
6
+ * @param raw lightningcss `KeyframesName`.
7
+ * @returns Animation name, or `null` when empty.
8
+ */
9
+ export declare function keyframesName(raw: KeyframesName): string | null;
10
+ /**
11
+ * Render a keyframe step's selector list back to CSS-text (`'from'`,
12
+ * `'to'`, or `'50%'`). Timeline-range keyframe selectors (CSS Scroll /
13
+ * View Timelines) can't run in React Native — those steps are skipped.
14
+ * @param selectors Step selectors.
15
+ * @returns Step offset, or `null` when unrepresentable in RN.
16
+ */
17
+ export declare function keyframeSelectorOffset(selectors: readonly KeyframeSelector[]): string | null;
18
+ /**
19
+ * Extract the referenced `@keyframes` name from a declaration whose
20
+ * property is `animation-name` or a shorthand `animation` that names one.
21
+ * Returns the first ident found inside the value — Tailwind's animate-*
22
+ * utilities emit exactly one animation-name per rule.
23
+ * @param decl One declaration from a style rule.
24
+ * @returns Keyframe name, or `null` when the declaration doesn't reference one.
25
+ */
26
+ export declare function pickAnimationName(decl: LcDeclaration): string | null;
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Pull the first keyframe name out of a typed `animation` shorthand.
3
+ * @param animations Parsed animation shorthand entries.
4
+ * @returns First ident name, or `null`.
5
+ */
6
+ function firstAnimationName(animations) {
7
+ for (const animation of animations) {
8
+ if (animation.name.type === 'ident' || animation.name.type === 'string')
9
+ return animation.name.value;
10
+ }
11
+ return null;
12
+ }
13
+ /**
14
+ * Pull the first ident name from a typed `animation-name` longhand.
15
+ * @param names Animation-name list.
16
+ * @returns First name, or `null`.
17
+ */
18
+ function firstNameFromAnimationNames(names) {
19
+ for (const name of names) {
20
+ if ((name.type === 'ident' || name.type === 'string') && typeof name.value === 'string')
21
+ return name.value;
22
+ }
23
+ return null;
24
+ }
25
+ /**
26
+ * Extract the animation name of an `@keyframes` rule. lightningcss models
27
+ * the name as a discriminated union (`ident` / `custom`); both variants
28
+ * carry the same downstream string.
29
+ * @param raw lightningcss `KeyframesName`.
30
+ * @returns Animation name, or `null` when empty.
31
+ */
32
+ function keyframesName(raw) {
33
+ if (typeof raw.value !== 'string' || raw.value.length === 0)
34
+ return null;
35
+ return raw.value;
36
+ }
37
+ /**
38
+ * Render a keyframe step's selector list back to CSS-text (`'from'`,
39
+ * `'to'`, or `'50%'`). Timeline-range keyframe selectors (CSS Scroll /
40
+ * View Timelines) can't run in React Native — those steps are skipped.
41
+ * @param selectors Step selectors.
42
+ * @returns Step offset, or `null` when unrepresentable in RN.
43
+ */
44
+ function keyframeSelectorOffset(selectors) {
45
+ const [head] = selectors;
46
+ if (!head)
47
+ return null;
48
+ switch (head.type) {
49
+ case 'from': {
50
+ return 'from';
51
+ }
52
+ case 'to': {
53
+ return 'to';
54
+ }
55
+ case 'percentage': {
56
+ return `${head.value * 100}%`;
57
+ }
58
+ default: {
59
+ return null;
60
+ }
61
+ }
62
+ }
63
+ /**
64
+ * Extract the referenced `@keyframes` name from a declaration whose
65
+ * property is `animation-name` or a shorthand `animation` that names one.
66
+ * Returns the first ident found inside the value — Tailwind's animate-*
67
+ * utilities emit exactly one animation-name per rule.
68
+ * @param decl One declaration from a style rule.
69
+ * @returns Keyframe name, or `null` when the declaration doesn't reference one.
70
+ */
71
+ function pickAnimationName(decl) {
72
+ if (decl.property === 'animation')
73
+ return firstAnimationName(decl.value);
74
+ if (decl.property === 'animation-name')
75
+ return firstNameFromAnimationNames(decl.value);
76
+ if (decl.property !== 'unparsed')
77
+ return null;
78
+ const targetProperty = decl.value.propertyId.property;
79
+ if (targetProperty !== 'animation-name' && targetProperty !== 'animation')
80
+ return null;
81
+ for (const token of decl.value.value) {
82
+ if (token.type === 'token' && token.value.type === 'ident')
83
+ return token.value.value;
84
+ if (token.type === 'dashed-ident')
85
+ return token.value;
86
+ }
87
+ return null;
88
+ }
89
+
90
+ export { keyframeSelectorOffset, keyframesName, pickAnimationName };
91
+ //# sourceMappingURL=keyframes.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyframes.mjs","sources":["../../../../../src/core/parser/keyframes.ts"],"sourcesContent":["import type { Animation, Declaration as LcDeclaration, KeyframeSelector, KeyframesName } from 'lightningcss'\n\n/**\n * Pull the first keyframe name out of a typed `animation` shorthand.\n * @param animations Parsed animation shorthand entries.\n * @returns First ident name, or `null`.\n */\nfunction firstAnimationName(animations: readonly Animation[]): string | null {\n for (const animation of animations) {\n if (animation.name.type === 'ident' || animation.name.type === 'string') return animation.name.value\n }\n return null\n}\n\n/**\n * Pull the first ident name from a typed `animation-name` longhand.\n * @param names Animation-name list.\n * @returns First name, or `null`.\n */\nfunction firstNameFromAnimationNames(names: readonly { type: string; value?: string }[]): string | null {\n for (const name of names) {\n if ((name.type === 'ident' || name.type === 'string') && typeof name.value === 'string') return name.value\n }\n return null\n}\n\n/**\n * Extract the animation name of an `@keyframes` rule. lightningcss models\n * the name as a discriminated union (`ident` / `custom`); both variants\n * carry the same downstream string.\n * @param raw lightningcss `KeyframesName`.\n * @returns Animation name, or `null` when empty.\n */\nexport function keyframesName(raw: KeyframesName): string | null {\n if (typeof raw.value !== 'string' || raw.value.length === 0) return null\n return raw.value\n}\n\n/**\n * Render a keyframe step's selector list back to CSS-text (`'from'`,\n * `'to'`, or `'50%'`). Timeline-range keyframe selectors (CSS Scroll /\n * View Timelines) can't run in React Native — those steps are skipped.\n * @param selectors Step selectors.\n * @returns Step offset, or `null` when unrepresentable in RN.\n */\nexport function keyframeSelectorOffset(selectors: readonly KeyframeSelector[]): string | null {\n const [head] = selectors\n if (!head) return null\n switch (head.type) {\n case 'from': {\n return 'from'\n }\n case 'to': {\n return 'to'\n }\n case 'percentage': {\n return `${head.value * 100}%`\n }\n default: {\n return null\n }\n }\n}\n\n/**\n * Extract the referenced `@keyframes` name from a declaration whose\n * property is `animation-name` or a shorthand `animation` that names one.\n * Returns the first ident found inside the value — Tailwind's animate-*\n * utilities emit exactly one animation-name per rule.\n * @param decl One declaration from a style rule.\n * @returns Keyframe name, or `null` when the declaration doesn't reference one.\n */\nexport function pickAnimationName(decl: LcDeclaration): string | null {\n if (decl.property === 'animation') return firstAnimationName(decl.value)\n if (decl.property === 'animation-name') return firstNameFromAnimationNames(decl.value)\n if (decl.property !== 'unparsed') return null\n const targetProperty = decl.value.propertyId.property\n if (targetProperty !== 'animation-name' && targetProperty !== 'animation') return null\n for (const token of decl.value.value) {\n if (token.type === 'token' && token.value.type === 'ident') return token.value.value\n if (token.type === 'dashed-ident') return token.value\n }\n return null\n}\n"],"names":[],"mappings":"AAEA;;;;AAIG;AACH,SAAS,kBAAkB,CAAC,UAAgC,EAAA;AAC1D,IAAA,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;AAClC,QAAA,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ;AAAE,YAAA,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK;IACtG;AACA,IAAA,OAAO,IAAI;AACb;AAEA;;;;AAIG;AACH,SAAS,2BAA2B,CAAC,KAAkD,EAAA;AACrF,IAAA,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;AACxB,QAAA,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,KAAK,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC,KAAK;IAC5G;AACA,IAAA,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EAAE;AACpC,QAAA,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO;AAAE,YAAA,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK;AACpF,QAAA,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc;YAAE,OAAO,KAAK,CAAC,KAAK;IACvD;AACA,IAAA,OAAO,IAAI;AACb;;;;"}
@@ -0,0 +1,14 @@
1
+ import type { Declaration as LcDeclaration } from 'lightningcss';
2
+ import type { RNEntry } from './types';
3
+ /**
4
+ * Dispatch flexbox-layout declarations (flex-direction, flex-wrap,
5
+ * align-items, align-self, align-content, justify-content). Returns
6
+ * `null` for any property the dispatcher doesn't handle so the caller
7
+ * can fall through to its main switch.
8
+ *
9
+ * RN expects keyword-mapped strings: `flex-start` / `flex-end` instead
10
+ * of CSS's `start` / `end`. We do the lowering here.
11
+ * @param decl One lightningcss declaration.
12
+ * @returns RN entries when the property matched, else `null`.
13
+ */
14
+ export declare function dispatchLayoutDeclaration(decl: LcDeclaration): readonly RNEntry[] | null;
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Lower CSS alignment keywords to the strings RN accepts. CSS uses
3
+ * `start`/`end` while RN sticks with the legacy `flex-start`/`flex-end`.
4
+ * Shared between `align-items`, `align-self`, `align-content`, and
5
+ * `justify-content` — the lowering rule is identical for all four.
6
+ * @param css CSS keyword (`center` / `start` / `end` / `baseline` / `stretch`).
7
+ * @returns RN-compatible keyword.
8
+ */
9
+ function cssToRnAlignment(css) {
10
+ if (css === 'start')
11
+ return 'flex-start';
12
+ if (css === 'end')
13
+ return 'flex-end';
14
+ return css;
15
+ }
16
+ /** Alias kept for clarity at the call site. Identical lowering rule. */
17
+ const cssToRnJustify = cssToRnAlignment;
18
+ /**
19
+ * Map lightningcss's `align-items` / `align-self` / `align-content`
20
+ * value (typed as `{type: 'self-position' | 'baseline-position', value: …}`)
21
+ * to the RN keyword RN expects.
22
+ * @param value Typed alignment value.
23
+ * @returns RN alignment string, or `null` when unmappable.
24
+ */
25
+ function mapAlignKeyword(value) {
26
+ if (typeof value === 'string')
27
+ return cssToRnAlignment(value);
28
+ if (typeof value !== 'object' || value === null)
29
+ return null;
30
+ const tagged = value;
31
+ if (tagged.type === 'baseline-position')
32
+ return 'baseline';
33
+ if (typeof tagged.value === 'string')
34
+ return cssToRnAlignment(tagged.value);
35
+ // Bare-keyword variants like `{type: 'stretch'}` carry the keyword
36
+ // in the `type` field with no separate `value`.
37
+ if (tagged.type === 'stretch' || tagged.type === 'normal')
38
+ return cssToRnAlignment(tagged.type);
39
+ return null;
40
+ }
41
+ /**
42
+ * Map lightningcss's `justify-content` value to the RN keyword.
43
+ * @param value Typed justify value.
44
+ * @returns RN justify string, or `null` when unmappable.
45
+ */
46
+ function mapJustifyKeyword(value) {
47
+ if (typeof value === 'string')
48
+ return cssToRnJustify(value);
49
+ if (typeof value !== 'object' || value === null)
50
+ return null;
51
+ const tagged = value;
52
+ if (typeof tagged.value === 'string')
53
+ return cssToRnJustify(tagged.value);
54
+ return null;
55
+ }
56
+ /**
57
+ * Dispatch flexbox-layout declarations (flex-direction, flex-wrap,
58
+ * align-items, align-self, align-content, justify-content). Returns
59
+ * `null` for any property the dispatcher doesn't handle so the caller
60
+ * can fall through to its main switch.
61
+ *
62
+ * RN expects keyword-mapped strings: `flex-start` / `flex-end` instead
63
+ * of CSS's `start` / `end`. We do the lowering here.
64
+ * @param decl One lightningcss declaration.
65
+ * @returns RN entries when the property matched, else `null`.
66
+ */
67
+ function dispatchLayoutDeclaration(decl) {
68
+ switch (decl.property) {
69
+ case 'flex-direction': {
70
+ return [['flexDirection', String(decl.value)]];
71
+ }
72
+ case 'flex-wrap': {
73
+ return [['flexWrap', String(decl.value)]];
74
+ }
75
+ case 'align-items': {
76
+ const v = mapAlignKeyword(decl.value);
77
+ return v === null ? [] : [['alignItems', v]];
78
+ }
79
+ case 'align-self': {
80
+ const v = mapAlignKeyword(decl.value);
81
+ return v === null ? [] : [['alignSelf', v]];
82
+ }
83
+ case 'align-content': {
84
+ const v = mapAlignKeyword(decl.value);
85
+ return v === null ? [] : [['alignContent', v]];
86
+ }
87
+ case 'justify-content': {
88
+ const v = mapJustifyKeyword(decl.value);
89
+ return v === null ? [] : [['justifyContent', v]];
90
+ }
91
+ case 'overflow': {
92
+ // Lightningcss splits CSS `overflow` into `{x, y}` axes; RN only
93
+ // supports a single `overflow` keyword (and only `'hidden' |
94
+ // 'visible' | 'scroll'` on iOS, `'hidden' | 'visible'` on
95
+ // Android — RN ignores unsupported keywords at runtime). Take
96
+ // the `x` axis when the user wrote shorthand; per-axis Tailwind
97
+ // utilities both emit shorthand here so axis splitting is rare.
98
+ const value = decl.value;
99
+ if (typeof value.x !== 'string')
100
+ return [];
101
+ return [['overflow', value.x]];
102
+ }
103
+ case 'overflow-x':
104
+ case 'overflow-y': {
105
+ // Tailwind's `overflow-x-*` / `overflow-y-*` emit these longhands,
106
+ // not the `overflow` shorthand. RN has only a single `overflow`,
107
+ // so collapse both axes onto it (last one declared wins via the
108
+ // normal entry-merge order).
109
+ return typeof decl.value === 'string' ? [['overflow', decl.value]] : [];
110
+ }
111
+ default: {
112
+ return null;
113
+ }
114
+ }
115
+ }
116
+
117
+ export { dispatchLayoutDeclaration };
118
+ //# sourceMappingURL=layout-dispatcher.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout-dispatcher.mjs","sources":["../../../../../src/core/parser/layout-dispatcher.ts"],"sourcesContent":["import type { Declaration as LcDeclaration } from 'lightningcss'\nimport type { RNEntry } from './types'\n\n/**\n * Lower CSS alignment keywords to the strings RN accepts. CSS uses\n * `start`/`end` while RN sticks with the legacy `flex-start`/`flex-end`.\n * Shared between `align-items`, `align-self`, `align-content`, and\n * `justify-content` — the lowering rule is identical for all four.\n * @param css CSS keyword (`center` / `start` / `end` / `baseline` / `stretch`).\n * @returns RN-compatible keyword.\n */\nfunction cssToRnAlignment(css: string): string {\n if (css === 'start') return 'flex-start'\n if (css === 'end') return 'flex-end'\n return css\n}\n\n/** Alias kept for clarity at the call site. Identical lowering rule. */\nconst cssToRnJustify = cssToRnAlignment\n\n/**\n * Map lightningcss's `align-items` / `align-self` / `align-content`\n * value (typed as `{type: 'self-position' | 'baseline-position', value: …}`)\n * to the RN keyword RN expects.\n * @param value Typed alignment value.\n * @returns RN alignment string, or `null` when unmappable.\n */\nfunction mapAlignKeyword(value: unknown): string | null {\n if (typeof value === 'string') return cssToRnAlignment(value)\n if (typeof value !== 'object' || value === null) return null\n const tagged = value as { type?: string; value?: string }\n if (tagged.type === 'baseline-position') return 'baseline'\n if (typeof tagged.value === 'string') return cssToRnAlignment(tagged.value)\n // Bare-keyword variants like `{type: 'stretch'}` carry the keyword\n // in the `type` field with no separate `value`.\n if (tagged.type === 'stretch' || tagged.type === 'normal') return cssToRnAlignment(tagged.type)\n return null\n}\n\n/**\n * Map lightningcss's `justify-content` value to the RN keyword.\n * @param value Typed justify value.\n * @returns RN justify string, or `null` when unmappable.\n */\nfunction mapJustifyKeyword(value: unknown): string | null {\n if (typeof value === 'string') return cssToRnJustify(value)\n if (typeof value !== 'object' || value === null) return null\n const tagged = value as { type?: string; value?: string }\n if (typeof tagged.value === 'string') return cssToRnJustify(tagged.value)\n return null\n}\n\n/**\n * Dispatch flexbox-layout declarations (flex-direction, flex-wrap,\n * align-items, align-self, align-content, justify-content). Returns\n * `null` for any property the dispatcher doesn't handle so the caller\n * can fall through to its main switch.\n *\n * RN expects keyword-mapped strings: `flex-start` / `flex-end` instead\n * of CSS's `start` / `end`. We do the lowering here.\n * @param decl One lightningcss declaration.\n * @returns RN entries when the property matched, else `null`.\n */\nexport function dispatchLayoutDeclaration(decl: LcDeclaration): readonly RNEntry[] | null {\n switch (decl.property) {\n case 'flex-direction': {\n return [['flexDirection', String(decl.value)]]\n }\n case 'flex-wrap': {\n return [['flexWrap', String(decl.value)]]\n }\n case 'align-items': {\n const v = mapAlignKeyword(decl.value)\n return v === null ? [] : [['alignItems', v]]\n }\n case 'align-self': {\n const v = mapAlignKeyword(decl.value)\n return v === null ? [] : [['alignSelf', v]]\n }\n case 'align-content': {\n const v = mapAlignKeyword(decl.value)\n return v === null ? [] : [['alignContent', v]]\n }\n case 'justify-content': {\n const v = mapJustifyKeyword(decl.value)\n return v === null ? [] : [['justifyContent', v]]\n }\n case 'overflow': {\n // Lightningcss splits CSS `overflow` into `{x, y}` axes; RN only\n // supports a single `overflow` keyword (and only `'hidden' |\n // 'visible' | 'scroll'` on iOS, `'hidden' | 'visible'` on\n // Android — RN ignores unsupported keywords at runtime). Take\n // the `x` axis when the user wrote shorthand; per-axis Tailwind\n // utilities both emit shorthand here so axis splitting is rare.\n const value = decl.value as { x?: unknown; y?: unknown }\n if (typeof value.x !== 'string') return []\n return [['overflow', value.x]]\n }\n case 'overflow-x':\n case 'overflow-y': {\n // Tailwind's `overflow-x-*` / `overflow-y-*` emit these longhands,\n // not the `overflow` shorthand. RN has only a single `overflow`,\n // so collapse both axes onto it (last one declared wins via the\n // normal entry-merge order).\n return typeof decl.value === 'string' ? [['overflow', decl.value]] : []\n }\n default: {\n return null\n }\n }\n}\n"],"names":[],"mappings":"AAGA;;;;;;;AAOG;AACH,SAAS,gBAAgB,CAAC,GAAW,EAAA;IACnC,IAAI,GAAG,KAAK,OAAO;AAAE,QAAA,OAAO,YAAY;IACxC,IAAI,GAAG,KAAK,KAAK;AAAE,QAAA,OAAO,UAAU;AACpC,IAAA,OAAO,GAAG;AACZ;AAEA;AACA,MAAM,cAAc,GAAG,gBAAgB;AAEvC;;;;;;AAMG;AACH,SAAS,eAAe,CAAC,KAAc,EAAA;IACrC,IAAI,OAAO,KAAK,KAAK,QAAQ;AAAE,QAAA,OAAO,gBAAgB,CAAC,KAAK,CAAC;AAC7D,IAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;AAAE,QAAA,OAAO,IAAI;IAC5D,MAAM,MAAM,GAAG,KAA0C;AACzD,IAAA,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C,YAAY,EAAE,CAAC,CAAC,CAAC;QAC9C;QACA,KAAK,YAAY,EAAE;YACjB,MAAM,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC;AACrC,YAAA,OAAO,CAAC,KAAK,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;QAC7C;QACA,KAAK,eAAe,EAAE;YACpB,MAAM,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC;AACrC,YAAA,OAAO,CAAC,KAAK,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;QAChD;QACA,KAAK,iBAAiB,EAAE;YACtB,MAAM,CAAC,GAAG,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC;AACvC,YAAA,OAAO,CAAC,KAAK,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC;QAClD;QACA,KAAK,UAAU,EAAE;;;;;;;AAOf,YAAA,MAAM,KAAK,GAAG,IAAI,CAAC,KAAqC;AACxD,YAAA,IAAI,OAAO,KAAK,CAAC,CAAC,KAAK,QAAQ;AAAE,gBAAA,OAAO,EAAE;YAC1C,OAAO,CAAC,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;QAChC;AACA,QAAA,KAAK,YAAY;QACjB,KAAK,YAAY,EAAE;;;;;YAKjB,OAAO,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,GAAG,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE;QACzE;QACA,SAAS;AACP,YAAA,OAAO,IAAI;QACb;;AAEJ;;;;"}
@@ -0,0 +1,51 @@
1
+ import type { DimensionPercentageFor_LengthValue as LcDimensionPercentage, GapValue, LengthPercentageOrAuto, LengthValue, MaxSize, Size } from 'lightningcss';
2
+ /** Alias for lightningcss's snake_case dimension-or-percentage type. */
3
+ type DimensionPercentage = LcDimensionPercentage;
4
+ /** RN-compatible length/percent result, or `null` when unrepresentable. */
5
+ type LengthResult = number | string | null;
6
+ /**
7
+ * Convert a lightningcss `LengthValue` to a pixel number. Handles the
8
+ * units Tailwind emits: px, rem, em. Tailwind v4's "fully rounded"
9
+ * expansion (`calc(infinity * 1px)`) lands here as `value === Infinity`
10
+ * — we clamp to a finite sentinel so RN can render it. Other non-finite
11
+ * values (NaN from a malformed expression) are clamped to 0 rather
12
+ * than leaking through as `null` in the serialized RN style.
13
+ * @param length Typed length value.
14
+ * @returns Finite pixel number.
15
+ */
16
+ export declare function lengthToPx(length: LengthValue): number;
17
+ /**
18
+ * Collapse a `DimensionPercentageFor_LengthValue` to a number (pixel) or
19
+ * `'N%'` string. `calc()` variants are not evaluated here — they fall
20
+ * through to `null` so the caller can skip or serialize via tokens.
21
+ * @param value Typed dimension-or-percentage.
22
+ * @returns Number, percent string, or `null` when unrepresentable.
23
+ */
24
+ export declare function dimensionPercentageToNumber(value: DimensionPercentage): LengthResult;
25
+ /**
26
+ * Convert `LengthPercentageOrAuto` (per-side value type for padding /
27
+ * margin / inset) to an RN scalar. `auto` maps to the string `'auto'`,
28
+ * which RN's margin accepts for centering; non-margin callers can filter
29
+ * it out if they need a number.
30
+ * @param value Typed length-percentage-or-auto.
31
+ * @returns RN scalar or `null` for unrepresentable shapes.
32
+ */
33
+ export declare function lengthPercentageOrAutoToValue(value: LengthPercentageOrAuto): LengthResult;
34
+ /**
35
+ * Convert a lightningcss `Size` (used by width/height) or `MaxSize` (used
36
+ * by max-width/max-height) to an RN scalar. Sizing keywords with no RN
37
+ * analog (`min-content`, `fit-content`, `stretch`, …) fall through to
38
+ * `null` so the caller drops them.
39
+ * @param value Typed size value.
40
+ * @returns RN scalar or `null` when unrepresentable.
41
+ */
42
+ export declare function sizeLikeToValue(value: Size | MaxSize): LengthResult;
43
+ /**
44
+ * Convert a lightningcss `GapValue` (per-axis gap, used by `row-gap` /
45
+ * `column-gap`) to an RN scalar. The `normal` keyword has no RN analog
46
+ * and falls through to `null`.
47
+ * @param value Typed gap value.
48
+ * @returns Number, percent string, or `null`.
49
+ */
50
+ export declare function gapValueToValue(value: GapValue): LengthResult;
51
+ export {};