rnwind 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (330) hide show
  1. package/lib/cjs/core/parser/animation.cjs +427 -0
  2. package/lib/cjs/core/parser/animation.cjs.map +1 -0
  3. package/lib/cjs/core/parser/animation.d.ts +126 -0
  4. package/lib/cjs/core/parser/border-dispatcher.cjs +180 -0
  5. package/lib/cjs/core/parser/border-dispatcher.cjs.map +1 -0
  6. package/lib/cjs/core/parser/border-dispatcher.d.ts +15 -0
  7. package/lib/cjs/core/parser/case-convert.cjs +15 -0
  8. package/lib/cjs/core/parser/case-convert.cjs.map +1 -0
  9. package/lib/cjs/core/parser/case-convert.d.ts +6 -0
  10. package/lib/cjs/core/parser/color-properties-dispatcher.cjs +84 -0
  11. package/lib/cjs/core/parser/color-properties-dispatcher.cjs.map +1 -0
  12. package/lib/cjs/core/parser/color-properties-dispatcher.d.ts +19 -0
  13. package/lib/cjs/core/parser/color.cjs +164 -0
  14. package/lib/cjs/core/parser/color.cjs.map +1 -0
  15. package/lib/cjs/core/parser/color.d.ts +12 -0
  16. package/lib/cjs/core/parser/constants.cjs +21 -0
  17. package/lib/cjs/core/parser/constants.cjs.map +1 -0
  18. package/lib/cjs/core/parser/constants.d.ts +8 -0
  19. package/lib/cjs/core/parser/declaration.cjs +347 -0
  20. package/lib/cjs/core/parser/declaration.cjs.map +1 -0
  21. package/lib/cjs/core/parser/declaration.d.ts +15 -0
  22. package/lib/cjs/core/parser/gradient.cjs +132 -0
  23. package/lib/cjs/core/parser/gradient.cjs.map +1 -0
  24. package/lib/cjs/core/parser/gradient.d.ts +59 -0
  25. package/lib/cjs/core/parser/haptics.cjs +73 -0
  26. package/lib/cjs/core/parser/haptics.cjs.map +1 -0
  27. package/lib/cjs/core/parser/haptics.d.ts +47 -0
  28. package/lib/cjs/core/parser/index.d.ts +8 -0
  29. package/lib/cjs/core/parser/keyframes.cjs +95 -0
  30. package/lib/cjs/core/parser/keyframes.cjs.map +1 -0
  31. package/lib/cjs/core/parser/keyframes.d.ts +26 -0
  32. package/lib/cjs/core/parser/layout-dispatcher.cjs +100 -0
  33. package/lib/cjs/core/parser/layout-dispatcher.cjs.map +1 -0
  34. package/lib/cjs/core/parser/layout-dispatcher.d.ts +14 -0
  35. package/lib/cjs/core/parser/length.cjs +96 -0
  36. package/lib/cjs/core/parser/length.cjs.map +1 -0
  37. package/lib/cjs/core/parser/length.d.ts +48 -0
  38. package/lib/cjs/core/parser/motion-dispatcher.cjs +77 -0
  39. package/lib/cjs/core/parser/motion-dispatcher.cjs.map +1 -0
  40. package/lib/cjs/core/parser/motion-dispatcher.d.ts +11 -0
  41. package/lib/cjs/core/parser/property.cjs +22 -0
  42. package/lib/cjs/core/parser/property.cjs.map +1 -0
  43. package/lib/cjs/core/parser/property.d.ts +8 -0
  44. package/lib/cjs/core/parser/safe-area.cjs +404 -0
  45. package/lib/cjs/core/parser/safe-area.cjs.map +1 -0
  46. package/lib/cjs/core/parser/safe-area.d.ts +39 -0
  47. package/lib/cjs/core/parser/selector.cjs +22 -0
  48. package/lib/cjs/core/parser/selector.cjs.map +1 -0
  49. package/lib/cjs/core/parser/selector.d.ts +11 -0
  50. package/lib/cjs/core/parser/shorthand.cjs +156 -0
  51. package/lib/cjs/core/parser/shorthand.cjs.map +1 -0
  52. package/lib/cjs/core/parser/shorthand.d.ts +61 -0
  53. package/lib/cjs/core/parser/text-truncate.cjs +78 -0
  54. package/lib/cjs/core/parser/text-truncate.cjs.map +1 -0
  55. package/lib/cjs/core/parser/text-truncate.d.ts +44 -0
  56. package/lib/cjs/core/parser/theme-vars.cjs +414 -0
  57. package/lib/cjs/core/parser/theme-vars.cjs.map +1 -0
  58. package/lib/cjs/core/parser/theme-vars.d.ts +61 -0
  59. package/lib/cjs/core/parser/tokens.cjs +304 -0
  60. package/lib/cjs/core/parser/tokens.cjs.map +1 -0
  61. package/lib/cjs/core/parser/tokens.d.ts +45 -0
  62. package/lib/cjs/core/parser/transform.cjs +198 -0
  63. package/lib/cjs/core/parser/transform.cjs.map +1 -0
  64. package/lib/cjs/core/parser/transform.d.ts +36 -0
  65. package/lib/cjs/core/parser/tw-parser.cjs +1567 -0
  66. package/lib/cjs/core/parser/tw-parser.cjs.map +1 -0
  67. package/lib/cjs/core/parser/tw-parser.d.ts +194 -0
  68. package/lib/cjs/core/parser/types.d.ts +37 -0
  69. package/lib/cjs/core/parser/typography-dispatcher.cjs +93 -0
  70. package/lib/cjs/core/parser/typography-dispatcher.cjs.map +1 -0
  71. package/lib/cjs/core/parser/typography-dispatcher.d.ts +11 -0
  72. package/lib/cjs/core/parser/typography.cjs +97 -0
  73. package/lib/cjs/core/parser/typography.cjs.map +1 -0
  74. package/lib/cjs/core/parser/typography.d.ts +43 -0
  75. package/lib/cjs/core/style-builder/build-style.cjs +397 -0
  76. package/lib/cjs/core/style-builder/build-style.cjs.map +1 -0
  77. package/lib/cjs/core/style-builder/build-style.d.ts +54 -0
  78. package/lib/cjs/core/style-builder/index.d.ts +3 -0
  79. package/lib/cjs/core/style-builder/union-builder.cjs +326 -0
  80. package/lib/cjs/core/style-builder/union-builder.cjs.map +1 -0
  81. package/lib/cjs/core/style-builder/union-builder.d.ts +128 -0
  82. package/lib/cjs/core/types.d.ts +14 -0
  83. package/lib/cjs/metro/dts.cjs +127 -0
  84. package/lib/cjs/metro/dts.cjs.map +1 -0
  85. package/lib/cjs/metro/dts.d.ts +16 -0
  86. package/lib/cjs/metro/index.cjs +19 -0
  87. package/lib/cjs/metro/index.cjs.map +1 -0
  88. package/lib/cjs/metro/index.d.ts +9 -0
  89. package/lib/cjs/metro/resolver.cjs +47 -0
  90. package/lib/cjs/metro/resolver.cjs.map +1 -0
  91. package/lib/cjs/metro/resolver.d.ts +22 -0
  92. package/lib/cjs/metro/state.cjs +251 -0
  93. package/lib/cjs/metro/state.cjs.map +1 -0
  94. package/lib/cjs/metro/state.d.ts +72 -0
  95. package/lib/cjs/metro/transform-ast.cjs +1255 -0
  96. package/lib/cjs/metro/transform-ast.cjs.map +1 -0
  97. package/lib/cjs/metro/transform-ast.d.ts +73 -0
  98. package/lib/cjs/metro/transformer.cjs +345 -0
  99. package/lib/cjs/metro/transformer.cjs.map +1 -0
  100. package/lib/cjs/metro/transformer.d.ts +47 -0
  101. package/lib/cjs/metro/warn-unknown-classes.cjs +86 -0
  102. package/lib/cjs/metro/warn-unknown-classes.cjs.map +1 -0
  103. package/lib/cjs/metro/warn-unknown-classes.d.ts +21 -0
  104. package/lib/cjs/metro/with-config.cjs +196 -0
  105. package/lib/cjs/metro/with-config.cjs.map +1 -0
  106. package/lib/cjs/metro/with-config.d.ts +57 -0
  107. package/lib/cjs/runtime/chain-handlers.cjs +37 -0
  108. package/lib/cjs/runtime/chain-handlers.cjs.map +1 -0
  109. package/lib/cjs/runtime/chain-handlers.d.ts +33 -0
  110. package/lib/cjs/runtime/components/rnwind-provider.cjs +98 -0
  111. package/lib/cjs/runtime/components/rnwind-provider.cjs.map +1 -0
  112. package/lib/cjs/runtime/components/rnwind-provider.d.ts +84 -0
  113. package/lib/cjs/runtime/gradient-types.d.ts +58 -0
  114. package/lib/cjs/runtime/haptics.cjs +113 -0
  115. package/lib/cjs/runtime/haptics.cjs.map +1 -0
  116. package/lib/cjs/runtime/haptics.d.ts +48 -0
  117. package/lib/cjs/runtime/hooks/use-css.cjs +21 -0
  118. package/lib/cjs/runtime/hooks/use-css.cjs.map +1 -0
  119. package/lib/cjs/runtime/hooks/use-css.d.ts +11 -0
  120. package/lib/cjs/runtime/hooks/use-interact.cjs +46 -0
  121. package/lib/cjs/runtime/hooks/use-interact.cjs.map +1 -0
  122. package/lib/cjs/runtime/hooks/use-interact.d.ts +42 -0
  123. package/lib/cjs/runtime/hooks/use-scheme.cjs +68 -0
  124. package/lib/cjs/runtime/hooks/use-scheme.cjs.map +1 -0
  125. package/lib/cjs/runtime/hooks/use-scheme.d.ts +34 -0
  126. package/lib/cjs/runtime/index.cjs +45 -0
  127. package/lib/cjs/runtime/index.cjs.map +1 -0
  128. package/lib/cjs/runtime/index.d.ts +27 -0
  129. package/lib/cjs/runtime/interactive-box.cjs +35 -0
  130. package/lib/cjs/runtime/interactive-box.cjs.map +1 -0
  131. package/lib/cjs/runtime/interactive-box.d.ts +40 -0
  132. package/lib/cjs/runtime/lookup-css.cjs +542 -0
  133. package/lib/cjs/runtime/lookup-css.cjs.map +1 -0
  134. package/lib/cjs/runtime/lookup-css.d.ts +164 -0
  135. package/lib/cjs/runtime/types.d.ts +29 -0
  136. package/lib/cjs/testing/index.cjs +367 -0
  137. package/lib/cjs/testing/index.cjs.map +1 -0
  138. package/lib/cjs/testing/index.d.ts +145 -0
  139. package/lib/esm/core/parser/animation.d.ts +126 -0
  140. package/lib/esm/core/parser/animation.mjs +408 -0
  141. package/lib/esm/core/parser/animation.mjs.map +1 -0
  142. package/lib/esm/core/parser/border-dispatcher.d.ts +15 -0
  143. package/lib/esm/core/parser/border-dispatcher.mjs +178 -0
  144. package/lib/esm/core/parser/border-dispatcher.mjs.map +1 -0
  145. package/lib/esm/core/parser/case-convert.d.ts +6 -0
  146. package/lib/esm/core/parser/case-convert.mjs +13 -0
  147. package/lib/esm/core/parser/case-convert.mjs.map +1 -0
  148. package/lib/esm/core/parser/color-properties-dispatcher.d.ts +19 -0
  149. package/lib/esm/core/parser/color-properties-dispatcher.mjs +82 -0
  150. package/lib/esm/core/parser/color-properties-dispatcher.mjs.map +1 -0
  151. package/lib/esm/core/parser/color.d.ts +12 -0
  152. package/lib/esm/core/parser/color.mjs +162 -0
  153. package/lib/esm/core/parser/color.mjs.map +1 -0
  154. package/lib/esm/core/parser/constants.d.ts +8 -0
  155. package/lib/esm/core/parser/constants.mjs +13 -0
  156. package/lib/esm/core/parser/constants.mjs.map +1 -0
  157. package/lib/esm/core/parser/declaration.d.ts +15 -0
  158. package/lib/esm/core/parser/declaration.mjs +345 -0
  159. package/lib/esm/core/parser/declaration.mjs.map +1 -0
  160. package/lib/esm/core/parser/gradient.d.ts +59 -0
  161. package/lib/esm/core/parser/gradient.mjs +130 -0
  162. package/lib/esm/core/parser/gradient.mjs.map +1 -0
  163. package/lib/esm/core/parser/haptics.d.ts +47 -0
  164. package/lib/esm/core/parser/haptics.mjs +71 -0
  165. package/lib/esm/core/parser/haptics.mjs.map +1 -0
  166. package/lib/esm/core/parser/index.d.ts +8 -0
  167. package/lib/esm/core/parser/keyframes.d.ts +26 -0
  168. package/lib/esm/core/parser/keyframes.mjs +91 -0
  169. package/lib/esm/core/parser/keyframes.mjs.map +1 -0
  170. package/lib/esm/core/parser/layout-dispatcher.d.ts +14 -0
  171. package/lib/esm/core/parser/layout-dispatcher.mjs +98 -0
  172. package/lib/esm/core/parser/layout-dispatcher.mjs.map +1 -0
  173. package/lib/esm/core/parser/length.d.ts +48 -0
  174. package/lib/esm/core/parser/length.mjs +90 -0
  175. package/lib/esm/core/parser/length.mjs.map +1 -0
  176. package/lib/esm/core/parser/motion-dispatcher.d.ts +11 -0
  177. package/lib/esm/core/parser/motion-dispatcher.mjs +75 -0
  178. package/lib/esm/core/parser/motion-dispatcher.mjs.map +1 -0
  179. package/lib/esm/core/parser/property.d.ts +8 -0
  180. package/lib/esm/core/parser/property.mjs +20 -0
  181. package/lib/esm/core/parser/property.mjs.map +1 -0
  182. package/lib/esm/core/parser/safe-area.d.ts +39 -0
  183. package/lib/esm/core/parser/safe-area.mjs +402 -0
  184. package/lib/esm/core/parser/safe-area.mjs.map +1 -0
  185. package/lib/esm/core/parser/selector.d.ts +11 -0
  186. package/lib/esm/core/parser/selector.mjs +20 -0
  187. package/lib/esm/core/parser/selector.mjs.map +1 -0
  188. package/lib/esm/core/parser/shorthand.d.ts +61 -0
  189. package/lib/esm/core/parser/shorthand.mjs +148 -0
  190. package/lib/esm/core/parser/shorthand.mjs.map +1 -0
  191. package/lib/esm/core/parser/text-truncate.d.ts +44 -0
  192. package/lib/esm/core/parser/text-truncate.mjs +75 -0
  193. package/lib/esm/core/parser/text-truncate.mjs.map +1 -0
  194. package/lib/esm/core/parser/theme-vars.d.ts +61 -0
  195. package/lib/esm/core/parser/theme-vars.mjs +409 -0
  196. package/lib/esm/core/parser/theme-vars.mjs.map +1 -0
  197. package/lib/esm/core/parser/tokens.d.ts +45 -0
  198. package/lib/esm/core/parser/tokens.mjs +298 -0
  199. package/lib/esm/core/parser/tokens.mjs.map +1 -0
  200. package/lib/esm/core/parser/transform.d.ts +36 -0
  201. package/lib/esm/core/parser/transform.mjs +193 -0
  202. package/lib/esm/core/parser/transform.mjs.map +1 -0
  203. package/lib/esm/core/parser/tw-parser.d.ts +194 -0
  204. package/lib/esm/core/parser/tw-parser.mjs +1565 -0
  205. package/lib/esm/core/parser/tw-parser.mjs.map +1 -0
  206. package/lib/esm/core/parser/types.d.ts +37 -0
  207. package/lib/esm/core/parser/typography-dispatcher.d.ts +11 -0
  208. package/lib/esm/core/parser/typography-dispatcher.mjs +91 -0
  209. package/lib/esm/core/parser/typography-dispatcher.mjs.map +1 -0
  210. package/lib/esm/core/parser/typography.d.ts +43 -0
  211. package/lib/esm/core/parser/typography.mjs +91 -0
  212. package/lib/esm/core/parser/typography.mjs.map +1 -0
  213. package/lib/esm/core/style-builder/build-style.d.ts +54 -0
  214. package/lib/esm/core/style-builder/build-style.mjs +395 -0
  215. package/lib/esm/core/style-builder/build-style.mjs.map +1 -0
  216. package/lib/esm/core/style-builder/index.d.ts +3 -0
  217. package/lib/esm/core/style-builder/union-builder.d.ts +128 -0
  218. package/lib/esm/core/style-builder/union-builder.mjs +324 -0
  219. package/lib/esm/core/style-builder/union-builder.mjs.map +1 -0
  220. package/lib/esm/core/types.d.ts +14 -0
  221. package/lib/esm/metro/dts.d.ts +16 -0
  222. package/lib/esm/metro/dts.mjs +125 -0
  223. package/lib/esm/metro/dts.mjs.map +1 -0
  224. package/lib/esm/metro/index.d.ts +9 -0
  225. package/lib/esm/metro/index.mjs +6 -0
  226. package/lib/esm/metro/index.mjs.map +1 -0
  227. package/lib/esm/metro/resolver.d.ts +22 -0
  228. package/lib/esm/metro/resolver.mjs +43 -0
  229. package/lib/esm/metro/resolver.mjs.map +1 -0
  230. package/lib/esm/metro/state.d.ts +72 -0
  231. package/lib/esm/metro/state.mjs +243 -0
  232. package/lib/esm/metro/state.mjs.map +1 -0
  233. package/lib/esm/metro/transform-ast.d.ts +73 -0
  234. package/lib/esm/metro/transform-ast.mjs +1234 -0
  235. package/lib/esm/metro/transform-ast.mjs.map +1 -0
  236. package/lib/esm/metro/transformer.d.ts +47 -0
  237. package/lib/esm/metro/transformer.mjs +322 -0
  238. package/lib/esm/metro/transformer.mjs.map +1 -0
  239. package/lib/esm/metro/warn-unknown-classes.d.ts +21 -0
  240. package/lib/esm/metro/warn-unknown-classes.mjs +84 -0
  241. package/lib/esm/metro/warn-unknown-classes.mjs.map +1 -0
  242. package/lib/esm/metro/with-config.d.ts +57 -0
  243. package/lib/esm/metro/with-config.mjs +194 -0
  244. package/lib/esm/metro/with-config.mjs.map +1 -0
  245. package/lib/esm/runtime/chain-handlers.d.ts +33 -0
  246. package/lib/esm/runtime/chain-handlers.mjs +34 -0
  247. package/lib/esm/runtime/chain-handlers.mjs.map +1 -0
  248. package/lib/esm/runtime/components/rnwind-provider.d.ts +84 -0
  249. package/lib/esm/runtime/components/rnwind-provider.mjs +94 -0
  250. package/lib/esm/runtime/components/rnwind-provider.mjs.map +1 -0
  251. package/lib/esm/runtime/gradient-types.d.ts +58 -0
  252. package/lib/esm/runtime/haptics.d.ts +48 -0
  253. package/lib/esm/runtime/haptics.mjs +110 -0
  254. package/lib/esm/runtime/haptics.mjs.map +1 -0
  255. package/lib/esm/runtime/hooks/use-css.d.ts +11 -0
  256. package/lib/esm/runtime/hooks/use-css.mjs +19 -0
  257. package/lib/esm/runtime/hooks/use-css.mjs.map +1 -0
  258. package/lib/esm/runtime/hooks/use-interact.d.ts +42 -0
  259. package/lib/esm/runtime/hooks/use-interact.mjs +44 -0
  260. package/lib/esm/runtime/hooks/use-interact.mjs.map +1 -0
  261. package/lib/esm/runtime/hooks/use-scheme.d.ts +34 -0
  262. package/lib/esm/runtime/hooks/use-scheme.mjs +63 -0
  263. package/lib/esm/runtime/hooks/use-scheme.mjs.map +1 -0
  264. package/lib/esm/runtime/index.d.ts +27 -0
  265. package/lib/esm/runtime/index.mjs +18 -0
  266. package/lib/esm/runtime/index.mjs.map +1 -0
  267. package/lib/esm/runtime/interactive-box.d.ts +40 -0
  268. package/lib/esm/runtime/interactive-box.mjs +33 -0
  269. package/lib/esm/runtime/interactive-box.mjs.map +1 -0
  270. package/lib/esm/runtime/lookup-css.d.ts +164 -0
  271. package/lib/esm/runtime/lookup-css.mjs +531 -0
  272. package/lib/esm/runtime/lookup-css.mjs.map +1 -0
  273. package/lib/esm/runtime/types.d.ts +29 -0
  274. package/lib/esm/testing/index.d.ts +145 -0
  275. package/lib/esm/testing/index.mjs +344 -0
  276. package/lib/esm/testing/index.mjs.map +1 -0
  277. package/package.json +79 -13
  278. package/preset.css +1171 -0
  279. package/src/core/parser/animation.ts +404 -0
  280. package/src/core/parser/border-dispatcher.ts +176 -0
  281. package/src/core/parser/case-convert.ts +10 -0
  282. package/src/core/parser/color-properties-dispatcher.ts +78 -0
  283. package/src/core/parser/color.ts +157 -0
  284. package/src/core/parser/constants.ts +11 -0
  285. package/src/core/parser/declaration.ts +340 -0
  286. package/src/core/parser/gradient.ts +148 -0
  287. package/src/core/parser/haptics.ts +88 -0
  288. package/src/core/parser/index.ts +8 -0
  289. package/src/core/parser/keyframes.ts +84 -0
  290. package/src/core/parser/layout-dispatcher.ts +92 -0
  291. package/src/core/parser/length.ts +100 -0
  292. package/src/core/parser/motion-dispatcher.ts +89 -0
  293. package/src/core/parser/property.ts +15 -0
  294. package/src/core/parser/safe-area.ts +404 -0
  295. package/src/core/parser/selector.ts +17 -0
  296. package/src/core/parser/shorthand.ts +152 -0
  297. package/src/core/parser/text-truncate.ts +79 -0
  298. package/src/core/parser/theme-vars.ts +412 -0
  299. package/src/core/parser/tokens.ts +286 -0
  300. package/src/core/parser/transform.ts +195 -0
  301. package/src/core/parser/tw-parser.ts +1709 -0
  302. package/src/core/parser/types.ts +45 -0
  303. package/src/core/parser/typography-dispatcher.ts +83 -0
  304. package/src/core/parser/typography.ts +83 -0
  305. package/src/core/style-builder/build-style.ts +442 -0
  306. package/src/core/style-builder/index.ts +3 -0
  307. package/src/core/style-builder/union-builder.ts +328 -0
  308. package/src/core/types.ts +15 -0
  309. package/src/metro/dts.ts +128 -0
  310. package/src/metro/index.ts +9 -0
  311. package/src/metro/resolver.ts +42 -0
  312. package/src/metro/state.ts +257 -0
  313. package/src/metro/transform-ast.ts +1498 -0
  314. package/src/metro/transformer.ts +347 -0
  315. package/src/metro/warn-unknown-classes.ts +79 -0
  316. package/src/metro/with-config.ts +229 -0
  317. package/src/runtime/chain-handlers.ts +47 -0
  318. package/src/runtime/components/rnwind-provider.tsx +144 -0
  319. package/src/runtime/gradient-types.ts +60 -0
  320. package/src/runtime/haptics.ts +120 -0
  321. package/src/runtime/hooks/use-css.ts +16 -0
  322. package/src/runtime/hooks/use-interact.ts +65 -0
  323. package/src/runtime/hooks/use-scheme.ts +63 -0
  324. package/src/runtime/index.ts +54 -0
  325. package/src/runtime/interactive-box.tsx +57 -0
  326. package/src/runtime/lookup-css.ts +628 -0
  327. package/src/runtime/types.ts +32 -0
  328. package/src/testing/index.ts +507 -0
  329. package/src/types/tailwindcss-node.d.ts +33 -0
  330. package/src/index.ts +0 -1
@@ -0,0 +1,88 @@
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
+
21
+ import type { Declaration as LcDeclaration, TokenOrValue } from 'lightningcss'
22
+ import { serializeTokens } from './tokens'
23
+
24
+ /**
25
+ * Structured haptic request the `onHaptics` callback receives. Union
26
+ * members mirror `expo-haptics`'s three entry points 1:1 so consumers
27
+ * can index directly into the enum (`Haptics.ImpactFeedbackStyle[req.style]`).
28
+ */
29
+ export type HapticRequest =
30
+ | { readonly kind: 'impact'; readonly style: 'Light' | 'Medium' | 'Heavy' | 'Soft' | 'Rigid' }
31
+ | { readonly kind: 'notification'; readonly type: 'Success' | 'Warning' | 'Error' }
32
+ | { readonly kind: 'selection' }
33
+
34
+ /** When during a component's lifecycle the haptic was triggered. */
35
+ export type HapticTrigger = 'mount' | 'pressIn' | 'pressOut' | 'focus' | 'hover'
36
+
37
+ /** User-provided callback fired by rnwind when a haptic atom resolves. */
38
+ export type OnHaptics = (request: HapticRequest, trigger: HapticTrigger) => void
39
+
40
+ const IMPACT_STYLES = new Set(['Light', 'Medium', 'Heavy', 'Soft', 'Rigid'] as const)
41
+ type ImpactStyle = 'Light' | 'Medium' | 'Heavy' | 'Soft' | 'Rigid'
42
+ const NOTIFICATION_TYPES = new Set(['Success', 'Warning', 'Error'] as const)
43
+ type NotificationType = 'Success' | 'Warning' | 'Error'
44
+
45
+ /**
46
+ * Parse the raw marker text (post-serialization) into a
47
+ * {@link HapticRequest}, or `null` when the token is unrecognised.
48
+ * Shape: `impact-<Style>`, `notification-<Type>`, or bare `selection`.
49
+ * @param text Trimmed marker text.
50
+ * @returns Haptic request, or null.
51
+ */
52
+ function parseMarker(text: string): HapticRequest | null {
53
+ if (text === 'selection') return { kind: 'selection' }
54
+ if (text.startsWith('impact-')) {
55
+ const style = text.slice('impact-'.length)
56
+ if (IMPACT_STYLES.has(style as ImpactStyle)) return { kind: 'impact', style: style as ImpactStyle }
57
+ return null
58
+ }
59
+ if (text.startsWith('notification-')) {
60
+ const typeText = text.slice('notification-'.length)
61
+ if (NOTIFICATION_TYPES.has(typeText as NotificationType)) {
62
+ return { kind: 'notification', type: typeText as NotificationType }
63
+ }
64
+ return null
65
+ }
66
+ return null
67
+ }
68
+
69
+ /**
70
+ * Inspect a rule's declaration list for a `--rnwind-haptic: <marker>`
71
+ * custom property and return the structured request. Returns `null`
72
+ * for rules that don't carry the marker.
73
+ * @param declarations Declarations from one lightningcss style rule.
74
+ * @returns Parsed haptic request, or null.
75
+ */
76
+ function detectHapticAtom(declarations: readonly LcDeclaration[]): HapticRequest | null {
77
+ for (const decl of declarations) {
78
+ if (decl.property !== 'custom') continue
79
+ const custom = decl.value as { name: { name: string } | string; value?: readonly TokenOrValue[] }
80
+ const name = typeof custom.name === 'string' ? custom.name : custom.name.name
81
+ if (name !== '--rnwind-haptic') continue
82
+ const text = serializeTokens(custom.value ?? []).trim()
83
+ return parseMarker(text)
84
+ }
85
+ return null
86
+ }
87
+
88
+ 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,84 @@
1
+ import type { Animation, Declaration as LcDeclaration, KeyframeSelector, KeyframesName } from 'lightningcss'
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: readonly Animation[]): string | null {
9
+ for (const animation of animations) {
10
+ if (animation.name.type === 'ident' || animation.name.type === 'string') return animation.name.value
11
+ }
12
+ return null
13
+ }
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: readonly { type: string; value?: string }[]): string | null {
21
+ for (const name of names) {
22
+ if ((name.type === 'ident' || name.type === 'string') && typeof name.value === 'string') return name.value
23
+ }
24
+ return null
25
+ }
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
+ export function keyframesName(raw: KeyframesName): string | null {
35
+ if (typeof raw.value !== 'string' || raw.value.length === 0) return null
36
+ return raw.value
37
+ }
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
+ export function keyframeSelectorOffset(selectors: readonly KeyframeSelector[]): string | null {
47
+ const [head] = selectors
48
+ if (!head) return null
49
+ switch (head.type) {
50
+ case 'from': {
51
+ return 'from'
52
+ }
53
+ case 'to': {
54
+ return 'to'
55
+ }
56
+ case 'percentage': {
57
+ return `${head.value * 100}%`
58
+ }
59
+ default: {
60
+ return null
61
+ }
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
+ export function pickAnimationName(decl: LcDeclaration): string | null {
74
+ if (decl.property === 'animation') return firstAnimationName(decl.value)
75
+ if (decl.property === 'animation-name') return firstNameFromAnimationNames(decl.value)
76
+ if (decl.property !== 'unparsed') return null
77
+ const targetProperty = decl.value.propertyId.property
78
+ if (targetProperty !== 'animation-name' && targetProperty !== 'animation') return null
79
+ for (const token of decl.value.value) {
80
+ if (token.type === 'token' && token.value.type === 'ident') return token.value.value
81
+ if (token.type === 'dashed-ident') return token.value
82
+ }
83
+ return null
84
+ }
@@ -0,0 +1,92 @@
1
+ import type { Declaration as LcDeclaration } from 'lightningcss'
2
+ import type { RNEntry } from './types'
3
+
4
+ /**
5
+ * Lower CSS alignment keywords to the strings RN accepts. CSS uses
6
+ * `start`/`end` while RN sticks with the legacy `flex-start`/`flex-end`.
7
+ * Shared between `align-items`, `align-self`, `align-content`, and
8
+ * `justify-content` — the lowering rule is identical for all four.
9
+ * @param css CSS keyword (`center` / `start` / `end` / `baseline` / `stretch`).
10
+ * @returns RN-compatible keyword.
11
+ */
12
+ function cssToRnAlignment(css: string): string {
13
+ if (css === 'start') return 'flex-start'
14
+ if (css === 'end') return 'flex-end'
15
+ return css
16
+ }
17
+
18
+ /** Alias kept for clarity at the call site. Identical lowering rule. */
19
+ const cssToRnJustify = cssToRnAlignment
20
+
21
+ /**
22
+ * Map lightningcss's `align-items` / `align-self` / `align-content`
23
+ * value (typed as `{type: 'self-position' | 'baseline-position', value: …}`)
24
+ * to the RN keyword RN expects.
25
+ * @param value Typed alignment value.
26
+ * @returns RN alignment string, or `null` when unmappable.
27
+ */
28
+ function mapAlignKeyword(value: unknown): string | null {
29
+ if (typeof value === 'string') return cssToRnAlignment(value)
30
+ if (typeof value !== 'object' || value === null) return null
31
+ const tagged = value as { type?: string; value?: string }
32
+ if (tagged.type === 'baseline-position') return 'baseline'
33
+ if (typeof tagged.value === 'string') return cssToRnAlignment(tagged.value)
34
+ // Bare-keyword variants like `{type: 'stretch'}` carry the keyword
35
+ // in the `type` field with no separate `value`.
36
+ if (tagged.type === 'stretch' || tagged.type === 'normal') return cssToRnAlignment(tagged.type)
37
+ return null
38
+ }
39
+
40
+ /**
41
+ * Map lightningcss's `justify-content` value to the RN keyword.
42
+ * @param value Typed justify value.
43
+ * @returns RN justify string, or `null` when unmappable.
44
+ */
45
+ function mapJustifyKeyword(value: unknown): string | null {
46
+ if (typeof value === 'string') return cssToRnJustify(value)
47
+ if (typeof value !== 'object' || value === null) return null
48
+ const tagged = value as { type?: string; value?: string }
49
+ if (typeof tagged.value === 'string') return cssToRnJustify(tagged.value)
50
+ return null
51
+ }
52
+
53
+ /**
54
+ * Dispatch flexbox-layout declarations (flex-direction, flex-wrap,
55
+ * align-items, align-self, align-content, justify-content). Returns
56
+ * `null` for any property the dispatcher doesn't handle so the caller
57
+ * can fall through to its main switch.
58
+ *
59
+ * RN expects keyword-mapped strings: `flex-start` / `flex-end` instead
60
+ * of CSS's `start` / `end`. We do the lowering here.
61
+ * @param decl One lightningcss declaration.
62
+ * @returns RN entries when the property matched, else `null`.
63
+ */
64
+ export function dispatchLayoutDeclaration(decl: LcDeclaration): readonly RNEntry[] | null {
65
+ switch (decl.property) {
66
+ case 'flex-direction': {
67
+ return [['flexDirection', String(decl.value)]]
68
+ }
69
+ case 'flex-wrap': {
70
+ return [['flexWrap', String(decl.value)]]
71
+ }
72
+ case 'align-items': {
73
+ const v = mapAlignKeyword(decl.value)
74
+ return v === null ? [] : [['alignItems', v]]
75
+ }
76
+ case 'align-self': {
77
+ const v = mapAlignKeyword(decl.value)
78
+ return v === null ? [] : [['alignSelf', v]]
79
+ }
80
+ case 'align-content': {
81
+ const v = mapAlignKeyword(decl.value)
82
+ return v === null ? [] : [['alignContent', v]]
83
+ }
84
+ case 'justify-content': {
85
+ const v = mapJustifyKeyword(decl.value)
86
+ return v === null ? [] : [['justifyContent', v]]
87
+ }
88
+ default: {
89
+ return null
90
+ }
91
+ }
92
+ }
@@ -0,0 +1,100 @@
1
+ import type {
2
+ DimensionPercentageFor_LengthValue as LcDimensionPercentage,
3
+ GapValue,
4
+ LengthPercentageOrAuto,
5
+ LengthValue,
6
+ MaxSize,
7
+ Size,
8
+ } from 'lightningcss'
9
+ import { REM_TO_PX } from './constants'
10
+
11
+ /** Alias for lightningcss's snake_case dimension-or-percentage type. */
12
+ type DimensionPercentage = LcDimensionPercentage
13
+
14
+ /** RN-compatible length/percent result, or `null` when unrepresentable. */
15
+ type LengthResult = number | string | null
16
+
17
+ /**
18
+ * Round a percentage / length float to 4 decimal places so lightningcss's
19
+ * IEEE-754 noise (`0.237 → 0.23700000345…`) doesn't leak into RN style
20
+ * strings. 4 decimals is well below CSS subpixel precision.
21
+ * @param n Raw float.
22
+ * @returns Rounded float with trailing zeros trimmed.
23
+ */
24
+ function roundFloat(n: number): number {
25
+ return Math.round(n * 10_000) / 10_000
26
+ }
27
+
28
+ /**
29
+ * Convert a lightningcss `LengthValue` to a pixel number. Handles the
30
+ * units Tailwind emits: px, rem, em. Unknown units pass through as the
31
+ * raw numeric value so a later pass can warn.
32
+ * @param length Typed length value.
33
+ * @returns Pixel number.
34
+ */
35
+ export function lengthToPx(length: LengthValue): number {
36
+ switch (length.unit) {
37
+ case 'px': {
38
+ return length.value
39
+ }
40
+ case 'rem':
41
+ case 'em': {
42
+ return length.value * REM_TO_PX
43
+ }
44
+ default: {
45
+ return length.value
46
+ }
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
+ export function dimensionPercentageToNumber(value: DimensionPercentage): LengthResult {
58
+ if (value.type === 'dimension') return lengthToPx(value.value)
59
+ if (value.type === 'percentage') return `${roundFloat(value.value * 100)}%`
60
+ return null
61
+ }
62
+
63
+ /**
64
+ * Convert `LengthPercentageOrAuto` (per-side value type for padding /
65
+ * margin / inset) to an RN scalar. `auto` maps to the string `'auto'`,
66
+ * which RN's margin accepts for centering; non-margin callers can filter
67
+ * it out if they need a number.
68
+ * @param value Typed length-percentage-or-auto.
69
+ * @returns RN scalar or `null` for unrepresentable shapes.
70
+ */
71
+ export function lengthPercentageOrAutoToValue(value: LengthPercentageOrAuto): LengthResult {
72
+ if (value.type === 'auto') return 'auto'
73
+ return dimensionPercentageToNumber(value.value)
74
+ }
75
+
76
+ /**
77
+ * Convert a lightningcss `Size` (used by width/height) or `MaxSize` (used
78
+ * by max-width/max-height) to an RN scalar. Sizing keywords with no RN
79
+ * analog (`min-content`, `fit-content`, `stretch`, …) fall through to
80
+ * `null` so the caller drops them.
81
+ * @param value Typed size value.
82
+ * @returns RN scalar or `null` when unrepresentable.
83
+ */
84
+ export function sizeLikeToValue(value: Size | MaxSize): LengthResult {
85
+ if (value.type === 'auto' || value.type === 'none') return value.type === 'auto' ? 'auto' : null
86
+ if (value.type === 'length-percentage') return dimensionPercentageToNumber(value.value)
87
+ return null
88
+ }
89
+
90
+ /**
91
+ * Convert a lightningcss `GapValue` (per-axis gap, used by `row-gap` /
92
+ * `column-gap`) to an RN scalar. The `normal` keyword has no RN analog
93
+ * and falls through to `null`.
94
+ * @param value Typed gap value.
95
+ * @returns Number, percent string, or `null`.
96
+ */
97
+ export function gapValueToValue(value: GapValue): LengthResult {
98
+ if (value.type === 'normal') return null
99
+ return dimensionPercentageToNumber(value.value)
100
+ }
@@ -0,0 +1,89 @@
1
+ import type { Declaration as LcDeclaration } from 'lightningcss'
2
+ import {
3
+ animationDelayEntries,
4
+ animationDirectionEntries,
5
+ animationDurationEntries,
6
+ animationFillModeEntries,
7
+ animationIterationCountEntries,
8
+ animationNameEntries,
9
+ animationPlayStateEntries,
10
+ animationShorthandToEntries,
11
+ animationTimingFunctionEntries,
12
+ transitionDelayEntries,
13
+ transitionDurationEntries,
14
+ transitionPropertyEntries,
15
+ transitionShorthandToEntries,
16
+ transitionTimingFunctionEntries,
17
+ } from './animation'
18
+ import { rotateToEntries, scaleToEntries, transformFunctionsToEntries, translateToEntries } from './transform'
19
+ import type { RNEntry } from './types'
20
+
21
+ /**
22
+ * Dispatch motion-adjacent declarations (animation/transition/transform)
23
+ * to their typed handlers. Returns `null` when the declaration isn't
24
+ * one this dispatcher handles, so the caller can fall through to its
25
+ * main switch.
26
+ * @param decl One lightningcss declaration.
27
+ * @returns RN entries when the property matched, else `null`.
28
+ */
29
+ export function dispatchMotionDeclaration(decl: LcDeclaration): readonly RNEntry[] | null {
30
+ switch (decl.property) {
31
+ case 'animation': {
32
+ return animationShorthandToEntries(decl.value)
33
+ }
34
+ case 'animation-name': {
35
+ return animationNameEntries(decl.value)
36
+ }
37
+ case 'animation-duration': {
38
+ return animationDurationEntries(decl.value)
39
+ }
40
+ case 'animation-timing-function': {
41
+ return animationTimingFunctionEntries(decl.value)
42
+ }
43
+ case 'animation-iteration-count': {
44
+ return animationIterationCountEntries(decl.value)
45
+ }
46
+ case 'animation-delay': {
47
+ return animationDelayEntries(decl.value)
48
+ }
49
+ case 'animation-direction': {
50
+ return animationDirectionEntries(decl.value)
51
+ }
52
+ case 'animation-fill-mode': {
53
+ return animationFillModeEntries(decl.value)
54
+ }
55
+ case 'animation-play-state': {
56
+ return animationPlayStateEntries(decl.value)
57
+ }
58
+ case 'transition': {
59
+ return transitionShorthandToEntries(decl.value)
60
+ }
61
+ case 'transition-property': {
62
+ return transitionPropertyEntries(decl.value)
63
+ }
64
+ case 'transition-duration': {
65
+ return transitionDurationEntries(decl.value)
66
+ }
67
+ case 'transition-timing-function': {
68
+ return transitionTimingFunctionEntries(decl.value)
69
+ }
70
+ case 'transition-delay': {
71
+ return transitionDelayEntries(decl.value)
72
+ }
73
+ case 'transform': {
74
+ return transformFunctionsToEntries(decl.value)
75
+ }
76
+ case 'rotate': {
77
+ return rotateToEntries(decl.value)
78
+ }
79
+ case 'translate': {
80
+ return translateToEntries(decl.value)
81
+ }
82
+ case 'scale': {
83
+ return scaleToEntries(decl.value)
84
+ }
85
+ default: {
86
+ return null
87
+ }
88
+ }
89
+ }
@@ -0,0 +1,15 @@
1
+ import type { ParsedComponent } from 'lightningcss'
2
+
3
+ /**
4
+ * Serialize an `@property --x { initial-value: … }` body to plain text —
5
+ * enough for the downstream var() resolver to use as a fallback.
6
+ * @param initial Parsed-component AST node (or null when absent).
7
+ * @returns CSS-value string, or `null` when missing / unsupported shape.
8
+ */
9
+ export function serializeInitialValue(initial: ParsedComponent | null | undefined): string | null {
10
+ if (!initial) return null
11
+ if (initial.type === 'literal') return initial.value
12
+ if (initial.type === 'custom-ident') return initial.value
13
+ if (initial.type === 'string') return initial.value
14
+ return null
15
+ }