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,73 @@
1
+ 'use strict';
2
+
3
+ var tokens = require('./tokens.cjs');
4
+
5
+ /**
6
+ * Haptic-atom extractor.
7
+ *
8
+ * rnwind's haptic utilities are declared in preset.css as `@utility`
9
+ * rules that write a single `--rnwind-haptic: <kind>[-<value>]` custom
10
+ * property. Lightningcss surfaces those custom-property writes on the
11
+ * style rule's declaration list; this module converts the raw marker
12
+ * text into a structured {@link HapticRequest} the transformer can
13
+ * hoist into JSX.
14
+ *
15
+ * Marker vocabulary:
16
+ *
17
+ * --rnwind-haptic: impact-Light | impact-Medium | impact-Heavy | impact-Soft | impact-Rigid;
18
+ * --rnwind-haptic: notification-Success | notification-Warning | notification-Error;
19
+ * --rnwind-haptic: selection;
20
+ *
21
+ * Everything else is returned as `null` so unknown markers don't leak
22
+ * into the transformer's map.
23
+ */
24
+ const IMPACT_STYLES = new Set(['Light', 'Medium', 'Heavy', 'Soft', 'Rigid']);
25
+ const NOTIFICATION_TYPES = new Set(['Success', 'Warning', 'Error']);
26
+ /**
27
+ * Parse the raw marker text (post-serialization) into a
28
+ * {@link HapticRequest}, or `null` when the token is unrecognised.
29
+ * Shape: `impact-<Style>`, `notification-<Type>`, or bare `selection`.
30
+ * @param text Trimmed marker text.
31
+ * @returns Haptic request, or null.
32
+ */
33
+ function parseMarker(text) {
34
+ if (text === 'selection')
35
+ return { kind: 'selection' };
36
+ if (text.startsWith('impact-')) {
37
+ const style = text.slice('impact-'.length);
38
+ if (IMPACT_STYLES.has(style))
39
+ return { kind: 'impact', style: style };
40
+ return null;
41
+ }
42
+ if (text.startsWith('notification-')) {
43
+ const typeText = text.slice('notification-'.length);
44
+ if (NOTIFICATION_TYPES.has(typeText)) {
45
+ return { kind: 'notification', type: typeText };
46
+ }
47
+ return null;
48
+ }
49
+ return null;
50
+ }
51
+ /**
52
+ * Inspect a rule's declaration list for a `--rnwind-haptic: <marker>`
53
+ * custom property and return the structured request. Returns `null`
54
+ * for rules that don't carry the marker.
55
+ * @param declarations Declarations from one lightningcss style rule.
56
+ * @returns Parsed haptic request, or null.
57
+ */
58
+ function detectHapticAtom(declarations) {
59
+ for (const decl of declarations) {
60
+ if (decl.property !== 'custom')
61
+ continue;
62
+ const custom = decl.value;
63
+ const name = typeof custom.name === 'string' ? custom.name : custom.name.name;
64
+ if (name !== '--rnwind-haptic')
65
+ continue;
66
+ const text = tokens.serializeTokens(custom.value ?? []).trim();
67
+ return parseMarker(text);
68
+ }
69
+ return null;
70
+ }
71
+
72
+ exports.detectHapticAtom = detectHapticAtom;
73
+ //# sourceMappingURL=haptics.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"haptics.cjs","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":["serializeTokens"],"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,W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 *
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,8 @@
1
+ export { TailwindParser } from './tw-parser';
2
+ export type { TailwindParserConfig, ParseOptions, ParsedOutput, SchemedStyle, KeyframeBlock, KeyframeStep } 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,95 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Pull the first keyframe name out of a typed `animation` shorthand.
5
+ * @param animations Parsed animation shorthand entries.
6
+ * @returns First ident name, or `null`.
7
+ */
8
+ function firstAnimationName(animations) {
9
+ for (const animation of animations) {
10
+ if (animation.name.type === 'ident' || animation.name.type === 'string')
11
+ return animation.name.value;
12
+ }
13
+ return null;
14
+ }
15
+ /**
16
+ * Pull the first ident name from a typed `animation-name` longhand.
17
+ * @param names Animation-name list.
18
+ * @returns First name, or `null`.
19
+ */
20
+ function firstNameFromAnimationNames(names) {
21
+ for (const name of names) {
22
+ if ((name.type === 'ident' || name.type === 'string') && typeof name.value === 'string')
23
+ return name.value;
24
+ }
25
+ return null;
26
+ }
27
+ /**
28
+ * Extract the animation name of an `@keyframes` rule. lightningcss models
29
+ * the name as a discriminated union (`ident` / `custom`); both variants
30
+ * carry the same downstream string.
31
+ * @param raw lightningcss `KeyframesName`.
32
+ * @returns Animation name, or `null` when empty.
33
+ */
34
+ function keyframesName(raw) {
35
+ if (typeof raw.value !== 'string' || raw.value.length === 0)
36
+ return null;
37
+ return raw.value;
38
+ }
39
+ /**
40
+ * Render a keyframe step's selector list back to CSS-text (`'from'`,
41
+ * `'to'`, or `'50%'`). Timeline-range keyframe selectors (CSS Scroll /
42
+ * View Timelines) can't run in React Native — those steps are skipped.
43
+ * @param selectors Step selectors.
44
+ * @returns Step offset, or `null` when unrepresentable in RN.
45
+ */
46
+ function keyframeSelectorOffset(selectors) {
47
+ const [head] = selectors;
48
+ if (!head)
49
+ return null;
50
+ switch (head.type) {
51
+ case 'from': {
52
+ return 'from';
53
+ }
54
+ case 'to': {
55
+ return 'to';
56
+ }
57
+ case 'percentage': {
58
+ return `${head.value * 100}%`;
59
+ }
60
+ default: {
61
+ return null;
62
+ }
63
+ }
64
+ }
65
+ /**
66
+ * Extract the referenced `@keyframes` name from a declaration whose
67
+ * property is `animation-name` or a shorthand `animation` that names one.
68
+ * Returns the first ident found inside the value — Tailwind's animate-*
69
+ * utilities emit exactly one animation-name per rule.
70
+ * @param decl One declaration from a style rule.
71
+ * @returns Keyframe name, or `null` when the declaration doesn't reference one.
72
+ */
73
+ function pickAnimationName(decl) {
74
+ if (decl.property === 'animation')
75
+ return firstAnimationName(decl.value);
76
+ if (decl.property === 'animation-name')
77
+ return firstNameFromAnimationNames(decl.value);
78
+ if (decl.property !== 'unparsed')
79
+ return null;
80
+ const targetProperty = decl.value.propertyId.property;
81
+ if (targetProperty !== 'animation-name' && targetProperty !== 'animation')
82
+ return null;
83
+ for (const token of decl.value.value) {
84
+ if (token.type === 'token' && token.value.type === 'ident')
85
+ return token.value.value;
86
+ if (token.type === 'dashed-ident')
87
+ return token.value;
88
+ }
89
+ return null;
90
+ }
91
+
92
+ exports.keyframeSelectorOffset = keyframeSelectorOffset;
93
+ exports.keyframesName = keyframesName;
94
+ exports.pickAnimationName = pickAnimationName;
95
+ //# sourceMappingURL=keyframes.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyframes.cjs","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.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C/B;QACA,SAAS;AACP,YAAA,OAAO,IAAI;QACb;;AAEJ;AAEA;;;;;;;AAOG;AACG,SAAU,iBAAiB,CAAC,IAAmB,EAAA;AACnD,IAAA,IAAI,IAAI,CAAC,QAAQ,KAAK,WAAW;AAAE,QAAA,OAAO,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC;AACxE,IAAA,IAAI,IAAI,CAAC,QAAQ,KAAK,gBAAgB;AAAE,QAAA,OAAO,2BAA2B,CAAC,IAAI,CAAC,KAAK,CAAC;AACtF,IAAA,IAAI,IAAI,CAAC,QAAQ,KAAK,UAAU;AAAE,QAAA,OAAO,IAAI;IAC7C,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ;AACrD,IAAA,IAAI,cAAc,KAAK,gBAAgB,IAAI,cAAc,KAAK,WAAW;AAAE,QAAA,OAAO,IAAI;IACtF,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,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,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,120 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Lower CSS alignment keywords to the strings RN accepts. CSS uses
5
+ * `start`/`end` while RN sticks with the legacy `flex-start`/`flex-end`.
6
+ * Shared between `align-items`, `align-self`, `align-content`, and
7
+ * `justify-content` — the lowering rule is identical for all four.
8
+ * @param css CSS keyword (`center` / `start` / `end` / `baseline` / `stretch`).
9
+ * @returns RN-compatible keyword.
10
+ */
11
+ function cssToRnAlignment(css) {
12
+ if (css === 'start')
13
+ return 'flex-start';
14
+ if (css === 'end')
15
+ return 'flex-end';
16
+ return css;
17
+ }
18
+ /** Alias kept for clarity at the call site. Identical lowering rule. */
19
+ const cssToRnJustify = cssToRnAlignment;
20
+ /**
21
+ * Map lightningcss's `align-items` / `align-self` / `align-content`
22
+ * value (typed as `{type: 'self-position' | 'baseline-position', value: …}`)
23
+ * to the RN keyword RN expects.
24
+ * @param value Typed alignment value.
25
+ * @returns RN alignment string, or `null` when unmappable.
26
+ */
27
+ function mapAlignKeyword(value) {
28
+ if (typeof value === 'string')
29
+ return cssToRnAlignment(value);
30
+ if (typeof value !== 'object' || value === null)
31
+ return null;
32
+ const tagged = value;
33
+ if (tagged.type === 'baseline-position')
34
+ return 'baseline';
35
+ if (typeof tagged.value === 'string')
36
+ return cssToRnAlignment(tagged.value);
37
+ // Bare-keyword variants like `{type: 'stretch'}` carry the keyword
38
+ // in the `type` field with no separate `value`.
39
+ if (tagged.type === 'stretch' || tagged.type === 'normal')
40
+ return cssToRnAlignment(tagged.type);
41
+ return null;
42
+ }
43
+ /**
44
+ * Map lightningcss's `justify-content` value to the RN keyword.
45
+ * @param value Typed justify value.
46
+ * @returns RN justify string, or `null` when unmappable.
47
+ */
48
+ function mapJustifyKeyword(value) {
49
+ if (typeof value === 'string')
50
+ return cssToRnJustify(value);
51
+ if (typeof value !== 'object' || value === null)
52
+ return null;
53
+ const tagged = value;
54
+ if (typeof tagged.value === 'string')
55
+ return cssToRnJustify(tagged.value);
56
+ return null;
57
+ }
58
+ /**
59
+ * Dispatch flexbox-layout declarations (flex-direction, flex-wrap,
60
+ * align-items, align-self, align-content, justify-content). Returns
61
+ * `null` for any property the dispatcher doesn't handle so the caller
62
+ * can fall through to its main switch.
63
+ *
64
+ * RN expects keyword-mapped strings: `flex-start` / `flex-end` instead
65
+ * of CSS's `start` / `end`. We do the lowering here.
66
+ * @param decl One lightningcss declaration.
67
+ * @returns RN entries when the property matched, else `null`.
68
+ */
69
+ function dispatchLayoutDeclaration(decl) {
70
+ switch (decl.property) {
71
+ case 'flex-direction': {
72
+ return [['flexDirection', String(decl.value)]];
73
+ }
74
+ case 'flex-wrap': {
75
+ return [['flexWrap', String(decl.value)]];
76
+ }
77
+ case 'align-items': {
78
+ const v = mapAlignKeyword(decl.value);
79
+ return v === null ? [] : [['alignItems', v]];
80
+ }
81
+ case 'align-self': {
82
+ const v = mapAlignKeyword(decl.value);
83
+ return v === null ? [] : [['alignSelf', v]];
84
+ }
85
+ case 'align-content': {
86
+ const v = mapAlignKeyword(decl.value);
87
+ return v === null ? [] : [['alignContent', v]];
88
+ }
89
+ case 'justify-content': {
90
+ const v = mapJustifyKeyword(decl.value);
91
+ return v === null ? [] : [['justifyContent', v]];
92
+ }
93
+ case 'overflow': {
94
+ // Lightningcss splits CSS `overflow` into `{x, y}` axes; RN only
95
+ // supports a single `overflow` keyword (and only `'hidden' |
96
+ // 'visible' | 'scroll'` on iOS, `'hidden' | 'visible'` on
97
+ // Android — RN ignores unsupported keywords at runtime). Take
98
+ // the `x` axis when the user wrote shorthand; per-axis Tailwind
99
+ // utilities both emit shorthand here so axis splitting is rare.
100
+ const value = decl.value;
101
+ if (typeof value.x !== 'string')
102
+ return [];
103
+ return [['overflow', value.x]];
104
+ }
105
+ case 'overflow-x':
106
+ case 'overflow-y': {
107
+ // Tailwind's `overflow-x-*` / `overflow-y-*` emit these longhands,
108
+ // not the `overflow` shorthand. RN has only a single `overflow`,
109
+ // so collapse both axes onto it (last one declared wins via the
110
+ // normal entry-merge order).
111
+ return typeof decl.value === 'string' ? [['overflow', decl.value]] : [];
112
+ }
113
+ default: {
114
+ return null;
115
+ }
116
+ }
117
+ }
118
+
119
+ exports.dispatchLayoutDeclaration = dispatchLayoutDeclaration;
120
+ //# sourceMappingURL=layout-dispatcher.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout-dispatcher.cjs","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,IAAI,MAAM,CAAC,IAAI,KAAK,mBAAmB;AAAE,QAAA,OAAO,UAAU;AAC1D,IAAA,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ;AAAE,QAAA,OAAO,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC;;;IAG3E,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI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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,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,110 @@
1
+ 'use strict';
2
+
3
+ var constants = require('./constants.cjs');
4
+
5
+ /**
6
+ * Round a percentage / length float to 4 decimal places so lightningcss's
7
+ * IEEE-754 noise (`0.237 → 0.23700000345…`) doesn't leak into RN style
8
+ * strings. 4 decimals is well below CSS subpixel precision.
9
+ * @param n Raw float.
10
+ * @returns Rounded float with trailing zeros trimmed.
11
+ */
12
+ function roundFloat(n) {
13
+ return Math.round(n * 10_000) / 10_000;
14
+ }
15
+ /**
16
+ * "Fully rounded" sentinel — emitted for Tailwind's `rounded-full` (and
17
+ * any other utility expanding to `calc(infinity * 1px)`). RN can't
18
+ * render `Infinity` as a style value (the StyleSheet validator silently
19
+ * drops it), but it accepts a finite large pixel count and renders the
20
+ * same pill / circle shape. 9999 covers every realistic phone screen.
21
+ */
22
+ const FULLY_ROUNDED_PX = 9999;
23
+ /**
24
+ * Convert a lightningcss `LengthValue` to a pixel number. Handles the
25
+ * units Tailwind emits: px, rem, em. Tailwind v4's "fully rounded"
26
+ * expansion (`calc(infinity * 1px)`) lands here as `value === Infinity`
27
+ * — we clamp to a finite sentinel so RN can render it. Other non-finite
28
+ * values (NaN from a malformed expression) are clamped to 0 rather
29
+ * than leaking through as `null` in the serialized RN style.
30
+ * @param length Typed length value.
31
+ * @returns Finite pixel number.
32
+ */
33
+ function lengthToPx(length) {
34
+ const raw = length.value;
35
+ if (!Number.isFinite(raw))
36
+ return raw === Number.POSITIVE_INFINITY ? FULLY_ROUNDED_PX : 0;
37
+ switch (length.unit) {
38
+ case 'px': {
39
+ return raw;
40
+ }
41
+ case 'rem':
42
+ case 'em': {
43
+ return raw * constants.REM_TO_PX;
44
+ }
45
+ default: {
46
+ return raw;
47
+ }
48
+ }
49
+ }
50
+ /**
51
+ * Collapse a `DimensionPercentageFor_LengthValue` to a number (pixel) or
52
+ * `'N%'` string. `calc()` variants are not evaluated here — they fall
53
+ * through to `null` so the caller can skip or serialize via tokens.
54
+ * @param value Typed dimension-or-percentage.
55
+ * @returns Number, percent string, or `null` when unrepresentable.
56
+ */
57
+ function dimensionPercentageToNumber(value) {
58
+ if (value.type === 'dimension')
59
+ return lengthToPx(value.value);
60
+ if (value.type === 'percentage')
61
+ return `${roundFloat(value.value * 100)}%`;
62
+ return null;
63
+ }
64
+ /**
65
+ * Convert `LengthPercentageOrAuto` (per-side value type for padding /
66
+ * margin / inset) to an RN scalar. `auto` maps to the string `'auto'`,
67
+ * which RN's margin accepts for centering; non-margin callers can filter
68
+ * it out if they need a number.
69
+ * @param value Typed length-percentage-or-auto.
70
+ * @returns RN scalar or `null` for unrepresentable shapes.
71
+ */
72
+ function lengthPercentageOrAutoToValue(value) {
73
+ if (value.type === 'auto')
74
+ return 'auto';
75
+ return dimensionPercentageToNumber(value.value);
76
+ }
77
+ /**
78
+ * Convert a lightningcss `Size` (used by width/height) or `MaxSize` (used
79
+ * by max-width/max-height) to an RN scalar. Sizing keywords with no RN
80
+ * analog (`min-content`, `fit-content`, `stretch`, …) fall through to
81
+ * `null` so the caller drops them.
82
+ * @param value Typed size value.
83
+ * @returns RN scalar or `null` when unrepresentable.
84
+ */
85
+ function sizeLikeToValue(value) {
86
+ if (value.type === 'auto' || value.type === 'none')
87
+ return value.type === 'auto' ? 'auto' : null;
88
+ if (value.type === 'length-percentage')
89
+ return dimensionPercentageToNumber(value.value);
90
+ return null;
91
+ }
92
+ /**
93
+ * Convert a lightningcss `GapValue` (per-axis gap, used by `row-gap` /
94
+ * `column-gap`) to an RN scalar. The `normal` keyword has no RN analog
95
+ * and falls through to `null`.
96
+ * @param value Typed gap value.
97
+ * @returns Number, percent string, or `null`.
98
+ */
99
+ function gapValueToValue(value) {
100
+ if (value.type === 'normal')
101
+ return null;
102
+ return dimensionPercentageToNumber(value.value);
103
+ }
104
+
105
+ exports.dimensionPercentageToNumber = dimensionPercentageToNumber;
106
+ exports.gapValueToValue = gapValueToValue;
107
+ exports.lengthPercentageOrAutoToValue = lengthPercentageOrAutoToValue;
108
+ exports.lengthToPx = lengthToPx;
109
+ exports.sizeLikeToValue = sizeLikeToValue;
110
+ //# sourceMappingURL=length.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"length.cjs","sources":["../../../../../src/core/parser/length.ts"],"sourcesContent":["import type {\n DimensionPercentageFor_LengthValue as LcDimensionPercentage,\n GapValue,\n LengthPercentageOrAuto,\n LengthValue,\n MaxSize,\n Size,\n} from 'lightningcss'\nimport { REM_TO_PX } from './constants'\n\n/** Alias for lightningcss's snake_case dimension-or-percentage type. */\ntype DimensionPercentage = LcDimensionPercentage\n\n/** RN-compatible length/percent result, or `null` when unrepresentable. */\ntype LengthResult = number | string | null\n\n/**\n * Round a percentage / length float to 4 decimal places so lightningcss's\n * IEEE-754 noise (`0.237 → 0.23700000345…`) doesn't leak into RN style\n * strings. 4 decimals is well below CSS subpixel precision.\n * @param n Raw float.\n * @returns Rounded float with trailing zeros trimmed.\n */\nfunction roundFloat(n: number): number {\n return Math.round(n * 10_000) / 10_000\n}\n\n/**\n * \"Fully rounded\" sentinel — emitted for Tailwind's `rounded-full` (and\n * any other utility expanding to `calc(infinity * 1px)`). RN can't\n * render `Infinity` as a style value (the StyleSheet validator silently\n * drops it), but it accepts a finite large pixel count and renders the\n * same pill / circle shape. 9999 covers every realistic phone screen.\n */\nconst FULLY_ROUNDED_PX = 9999\n\n/**\n * Convert a lightningcss `LengthValue` to a pixel number. Handles the\n * units Tailwind emits: px, rem, em. Tailwind v4's \"fully rounded\"\n * expansion (`calc(infinity * 1px)`) lands here as `value === Infinity`\n * — we clamp to a finite sentinel so RN can render it. Other non-finite\n * values (NaN from a malformed expression) are clamped to 0 rather\n * than leaking through as `null` in the serialized RN style.\n * @param length Typed length value.\n * @returns Finite pixel number.\n */\nexport function lengthToPx(length: LengthValue): number {\n const raw = length.value\n if (!Number.isFinite(raw)) return raw === Number.POSITIVE_INFINITY ? FULLY_ROUNDED_PX : 0\n switch (length.unit) {\n case 'px': {\n return raw\n }\n case 'rem':\n case 'em': {\n return raw * REM_TO_PX\n }\n default: {\n return raw\n }\n }\n}\n\n/**\n * Collapse a `DimensionPercentageFor_LengthValue` to a number (pixel) or\n * `'N%'` string. `calc()` variants are not evaluated here — they fall\n * through to `null` so the caller can skip or serialize via tokens.\n * @param value Typed dimension-or-percentage.\n * @returns Number, percent string, or `null` when unrepresentable.\n */\nexport function dimensionPercentageToNumber(value: DimensionPercentage): LengthResult {\n if (value.type === 'dimension') return lengthToPx(value.value)\n if (value.type === 'percentage') return `${roundFloat(value.value * 100)}%`\n return null\n}\n\n/**\n * Convert `LengthPercentageOrAuto` (per-side value type for padding /\n * margin / inset) to an RN scalar. `auto` maps to the string `'auto'`,\n * which RN's margin accepts for centering; non-margin callers can filter\n * it out if they need a number.\n * @param value Typed length-percentage-or-auto.\n * @returns RN scalar or `null` for unrepresentable shapes.\n */\nexport function lengthPercentageOrAutoToValue(value: LengthPercentageOrAuto): LengthResult {\n if (value.type === 'auto') return 'auto'\n return dimensionPercentageToNumber(value.value)\n}\n\n/**\n * Convert a lightningcss `Size` (used by width/height) or `MaxSize` (used\n * by max-width/max-height) to an RN scalar. Sizing keywords with no RN\n * analog (`min-content`, `fit-content`, `stretch`, …) fall through to\n * `null` so the caller drops them.\n * @param value Typed size value.\n * @returns RN scalar or `null` when unrepresentable.\n */\nexport function sizeLikeToValue(value: Size | MaxSize): LengthResult {\n if (value.type === 'auto' || value.type === 'none') return value.type === 'auto' ? 'auto' : null\n if (value.type === 'length-percentage') return dimensionPercentageToNumber(value.value)\n return null\n}\n\n/**\n * Convert a lightningcss `GapValue` (per-axis gap, used by `row-gap` /\n * `column-gap`) to an RN scalar. The `normal` keyword has no RN analog\n * and falls through to `null`.\n * @param value Typed gap value.\n * @returns Number, percent string, or `null`.\n */\nexport function gapValueToValue(value: GapValue): LengthResult {\n if (value.type === 'normal') return null\n return dimensionPercentageToNumber(value.value)\n}\n"],"names":["REM_TO_PX"],"mappings":";;;;AAgBA;;;;;;AA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C,IAAI,KAAK,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM;AAAE,QAAA,OAAO,KAAK,CAAC,IAAI,KAAK,MAAM,GAAG,MAAM,GAAG,IAAI;AAChG,IAAA,IAAI,KAAK,CAAC,IAAI,KAAK,mBAAmB;AAAE,QAAA,OAAO,2BAA2B,CAAC,KAAK,CAAC,KAAK,CAAC;AACvF,IAAA,OAAO,IAAI;AACb;AAEA;;;;;;AAMG;AACG,SAAU,eAAe,CAAC,KAAe,EAAA;AAC7C,IAAA,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ;AAAE,QAAA,OAAO,IAAI;AACxC,IAAA,OAAO,2BAA2B,CAAC,KAAK,CAAC,KAAK,CAAC;AACjD;;;;;;;;"}
@@ -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 {};