react-native-css 0.0.0-nightly.d6f42ab → 0.0.0-nightly.df32ce3

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 (565) hide show
  1. package/README.md +29 -5
  2. package/dist/commonjs/babel/helpers.js +7 -0
  3. package/dist/commonjs/babel/helpers.js.map +1 -1
  4. package/dist/commonjs/babel/import-plugin.js +20 -8
  5. package/dist/commonjs/babel/import-plugin.js.map +1 -1
  6. package/dist/commonjs/babel/react-native-web.js +17 -4
  7. package/dist/commonjs/babel/react-native-web.js.map +1 -1
  8. package/dist/commonjs/babel/react-native.js +9 -4
  9. package/dist/commonjs/babel/react-native.js.map +1 -1
  10. package/dist/commonjs/compiler/atRules.js +35 -0
  11. package/dist/commonjs/compiler/atRules.js.map +1 -1
  12. package/dist/commonjs/compiler/compiler.js +107 -32
  13. package/dist/commonjs/compiler/compiler.js.map +1 -1
  14. package/dist/commonjs/compiler/container-query.js +6 -1
  15. package/dist/commonjs/compiler/container-query.js.map +1 -1
  16. package/dist/commonjs/compiler/declarations.js +149 -57
  17. package/dist/commonjs/compiler/declarations.js.map +1 -1
  18. package/dist/commonjs/compiler/lightningcss-loader.js +15 -2
  19. package/dist/commonjs/compiler/lightningcss-loader.js.map +1 -1
  20. package/dist/commonjs/compiler/media-query.js +16 -6
  21. package/dist/commonjs/compiler/media-query.js.map +1 -1
  22. package/dist/commonjs/compiler/selector-builder.js +15 -4
  23. package/dist/commonjs/compiler/selector-builder.js.map +1 -1
  24. package/dist/commonjs/compiler/stylesheet.js +16 -3
  25. package/dist/commonjs/compiler/stylesheet.js.map +1 -1
  26. package/dist/commonjs/compiler/supports.js +2 -2
  27. package/dist/commonjs/compiler/supports.js.map +1 -1
  28. package/dist/commonjs/components/FlatList.js +1 -0
  29. package/dist/commonjs/components/FlatList.js.map +1 -1
  30. package/dist/commonjs/components/ImageBackground.js +2 -6
  31. package/dist/commonjs/components/ImageBackground.js.map +1 -1
  32. package/dist/commonjs/components/KeyboardAvoidingView.js +2 -3
  33. package/dist/commonjs/components/KeyboardAvoidingView.js.map +1 -1
  34. package/dist/commonjs/components/SafeAreaProvider.js +13 -0
  35. package/dist/commonjs/components/SafeAreaProvider.js.map +1 -0
  36. package/dist/commonjs/components/index.cjs +46 -1
  37. package/dist/commonjs/components/index.cjs.map +1 -1
  38. package/dist/commonjs/jest/index.js +1 -1
  39. package/dist/commonjs/jest/index.js.map +1 -1
  40. package/dist/commonjs/metro/cache-version.js +43 -0
  41. package/dist/commonjs/metro/cache-version.js.map +1 -0
  42. package/dist/commonjs/metro/index.js +2 -0
  43. package/dist/commonjs/metro/index.js.map +1 -1
  44. package/dist/commonjs/metro/metro-transformer.js +16 -3
  45. package/dist/commonjs/metro/metro-transformer.js.map +1 -1
  46. package/dist/commonjs/metro/typescript.js +26 -6
  47. package/dist/commonjs/metro/typescript.js.map +1 -1
  48. package/dist/commonjs/metro/warnings.js +135 -0
  49. package/dist/commonjs/metro/warnings.js.map +1 -0
  50. package/dist/commonjs/native/api.js +13 -9
  51. package/dist/commonjs/native/api.js.map +1 -1
  52. package/dist/commonjs/native/conditions/attributes.js +16 -9
  53. package/dist/commonjs/native/conditions/attributes.js.map +1 -1
  54. package/dist/commonjs/native/conditions/container-query.js +11 -11
  55. package/dist/commonjs/native/conditions/container-query.js.map +1 -1
  56. package/dist/commonjs/native/conditions/media-query.js +1 -1
  57. package/dist/commonjs/native/conditions/media-query.js.map +1 -1
  58. package/dist/commonjs/native/react/interaction.js +10 -5
  59. package/dist/commonjs/native/react/interaction.js.map +1 -1
  60. package/dist/commonjs/native/react/rules.js +12 -5
  61. package/dist/commonjs/native/react/rules.js.map +1 -1
  62. package/dist/commonjs/native/react/useNativeCss.js +70 -15
  63. package/dist/commonjs/native/react/useNativeCss.js.map +1 -1
  64. package/dist/commonjs/native/react/usePassthrough.js +5 -2
  65. package/dist/commonjs/native/react/usePassthrough.js.map +1 -1
  66. package/dist/commonjs/native/reactivity.js +61 -24
  67. package/dist/commonjs/native/reactivity.js.map +1 -1
  68. package/dist/commonjs/native/reanimated.js +15 -3
  69. package/dist/commonjs/native/reanimated.js.map +1 -1
  70. package/dist/commonjs/native/styles/functions/color-mix.js +64 -0
  71. package/dist/commonjs/native/styles/functions/color-mix.js.map +1 -0
  72. package/dist/commonjs/native/styles/functions/filters.js +18 -5
  73. package/dist/commonjs/native/styles/functions/filters.js.map +1 -1
  74. package/dist/commonjs/native/styles/functions/index.js +11 -0
  75. package/dist/commonjs/native/styles/functions/index.js.map +1 -1
  76. package/dist/commonjs/native/styles/functions/numeric-functions.js +4 -3
  77. package/dist/commonjs/native/styles/functions/numeric-functions.js.map +1 -1
  78. package/dist/commonjs/native/styles/functions/string-functions.js +16 -1
  79. package/dist/commonjs/native/styles/functions/string-functions.js.map +1 -1
  80. package/dist/commonjs/native/styles/functions/transform-functions.js +5 -4
  81. package/dist/commonjs/native/styles/functions/transform-functions.js.map +1 -1
  82. package/dist/commonjs/native/styles/index.js +382 -28
  83. package/dist/commonjs/native/styles/index.js.map +1 -1
  84. package/dist/commonjs/native/styles/resolve.js +10 -6
  85. package/dist/commonjs/native/styles/resolve.js.map +1 -1
  86. package/dist/commonjs/native/styles/scale-factor.js +13 -0
  87. package/dist/commonjs/native/styles/scale-factor.js.map +1 -0
  88. package/dist/commonjs/native/styles/shorthands/_handler.js +10 -0
  89. package/dist/commonjs/native/styles/shorthands/_handler.js.map +1 -1
  90. package/dist/commonjs/native/styles/shorthands/animation.js +6 -3
  91. package/dist/commonjs/native/styles/shorthands/animation.js.map +1 -1
  92. package/dist/commonjs/native/styles/shorthands/box-shadow.js +45 -12
  93. package/dist/commonjs/native/styles/shorthands/box-shadow.js.map +1 -1
  94. package/dist/commonjs/native/styles/shorthands/index.js +11 -0
  95. package/dist/commonjs/native/styles/shorthands/index.js.map +1 -1
  96. package/dist/commonjs/native/styles/shorthands/logical-border-width.js +22 -0
  97. package/dist/commonjs/native/styles/shorthands/logical-border-width.js.map +1 -0
  98. package/dist/commonjs/native/styles/variables.js +55 -43
  99. package/dist/commonjs/native/styles/variables.js.map +1 -1
  100. package/dist/commonjs/native-internal/root.js +18 -7
  101. package/dist/commonjs/native-internal/root.js.map +1 -1
  102. package/dist/commonjs/native-internal/style-collection.js +1 -1
  103. package/dist/commonjs/native-internal/style-collection.js.map +1 -1
  104. package/dist/commonjs/native-internal/variables.js +1 -1
  105. package/dist/commonjs/native-internal/variables.js.map +1 -1
  106. package/dist/commonjs/utilities/dot-notation.types.js +4 -0
  107. package/dist/commonjs/utilities/style-descriptor.js +4 -9
  108. package/dist/commonjs/utilities/style-descriptor.js.map +1 -1
  109. package/dist/commonjs/web/api.js +2 -2
  110. package/dist/commonjs/web/api.js.map +1 -1
  111. package/dist/commonjs/web/assign-style.js +4 -1
  112. package/dist/commonjs/web/assign-style.js.map +1 -1
  113. package/dist/module/babel/helpers.js +6 -0
  114. package/dist/module/babel/helpers.js.map +1 -1
  115. package/dist/module/babel/import-plugin.js +22 -10
  116. package/dist/module/babel/import-plugin.js.map +1 -1
  117. package/dist/module/babel/react-native-web.js +16 -4
  118. package/dist/module/babel/react-native-web.js.map +1 -1
  119. package/dist/module/babel/react-native.js +9 -4
  120. package/dist/module/babel/react-native.js.map +1 -1
  121. package/dist/module/compiler/atRules.js +33 -0
  122. package/dist/module/compiler/atRules.js.map +1 -1
  123. package/dist/module/compiler/compiler.js +109 -34
  124. package/dist/module/compiler/compiler.js.map +1 -1
  125. package/dist/module/compiler/compiler.types.js +2 -0
  126. package/dist/module/compiler/compiler.types.js.map +1 -1
  127. package/dist/module/compiler/container-query.js +6 -1
  128. package/dist/module/compiler/container-query.js.map +1 -1
  129. package/dist/module/compiler/declarations.js +148 -57
  130. package/dist/module/compiler/declarations.js.map +1 -1
  131. package/dist/module/compiler/lightningcss-loader.js +14 -2
  132. package/dist/module/compiler/lightningcss-loader.js.map +1 -1
  133. package/dist/module/compiler/media-query.js +16 -6
  134. package/dist/module/compiler/media-query.js.map +1 -1
  135. package/dist/module/compiler/selector-builder.js +15 -4
  136. package/dist/module/compiler/selector-builder.js.map +1 -1
  137. package/dist/module/compiler/stylesheet.js +16 -3
  138. package/dist/module/compiler/stylesheet.js.map +1 -1
  139. package/dist/module/compiler/supports.js +2 -2
  140. package/dist/module/compiler/supports.js.map +1 -1
  141. package/dist/module/components/FlatList.js +1 -0
  142. package/dist/module/components/FlatList.js.map +1 -1
  143. package/dist/module/components/ImageBackground.js +2 -6
  144. package/dist/module/components/ImageBackground.js.map +1 -1
  145. package/dist/module/components/KeyboardAvoidingView.js +2 -3
  146. package/dist/module/components/KeyboardAvoidingView.js.map +1 -1
  147. package/dist/module/components/SafeAreaProvider.js +4 -0
  148. package/dist/module/components/SafeAreaProvider.js.map +1 -0
  149. package/dist/module/components/index.cjs +46 -1
  150. package/dist/module/components/index.cjs.map +1 -1
  151. package/dist/module/jest/index.js +1 -1
  152. package/dist/module/jest/index.js.map +1 -1
  153. package/dist/module/metro/cache-version.js +39 -0
  154. package/dist/module/metro/cache-version.js.map +1 -0
  155. package/dist/module/metro/index.js +2 -0
  156. package/dist/module/metro/index.js.map +1 -1
  157. package/dist/module/metro/metro-transformer.js +16 -3
  158. package/dist/module/metro/metro-transformer.js.map +1 -1
  159. package/dist/module/metro/typescript.js +26 -6
  160. package/dist/module/metro/typescript.js.map +1 -1
  161. package/dist/module/metro/warnings.js +131 -0
  162. package/dist/module/metro/warnings.js.map +1 -0
  163. package/dist/module/native/api.js +15 -11
  164. package/dist/module/native/api.js.map +1 -1
  165. package/dist/module/native/conditions/attributes.js +16 -9
  166. package/dist/module/native/conditions/attributes.js.map +1 -1
  167. package/dist/module/native/conditions/container-query.js +11 -11
  168. package/dist/module/native/conditions/container-query.js.map +1 -1
  169. package/dist/module/native/conditions/media-query.js +1 -1
  170. package/dist/module/native/conditions/media-query.js.map +1 -1
  171. package/dist/module/native/react/interaction.js +10 -5
  172. package/dist/module/native/react/interaction.js.map +1 -1
  173. package/dist/module/native/react/rules.js +13 -6
  174. package/dist/module/native/react/rules.js.map +1 -1
  175. package/dist/module/native/react/useNativeCss.js +73 -18
  176. package/dist/module/native/react/useNativeCss.js.map +1 -1
  177. package/dist/module/native/react/usePassthrough.js +5 -2
  178. package/dist/module/native/react/usePassthrough.js.map +1 -1
  179. package/dist/module/native/reactivity.js +55 -22
  180. package/dist/module/native/reactivity.js.map +1 -1
  181. package/dist/module/native/reanimated.js +15 -3
  182. package/dist/module/native/reanimated.js.map +1 -1
  183. package/dist/module/native/styles/functions/color-mix.js +59 -0
  184. package/dist/module/native/styles/functions/color-mix.js.map +1 -0
  185. package/dist/module/native/styles/functions/filters.js +16 -4
  186. package/dist/module/native/styles/functions/filters.js.map +1 -1
  187. package/dist/module/native/styles/functions/index.js +1 -0
  188. package/dist/module/native/styles/functions/index.js.map +1 -1
  189. package/dist/module/native/styles/functions/numeric-functions.js +4 -3
  190. package/dist/module/native/styles/functions/numeric-functions.js.map +1 -1
  191. package/dist/module/native/styles/functions/string-functions.js +13 -0
  192. package/dist/module/native/styles/functions/string-functions.js.map +1 -1
  193. package/dist/module/native/styles/functions/transform-functions.js +5 -4
  194. package/dist/module/native/styles/functions/transform-functions.js.map +1 -1
  195. package/dist/module/native/styles/index.js +383 -28
  196. package/dist/module/native/styles/index.js.map +1 -1
  197. package/dist/module/native/styles/resolve.js +10 -6
  198. package/dist/module/native/styles/resolve.js.map +1 -1
  199. package/dist/module/native/styles/scale-factor.js +9 -0
  200. package/dist/module/native/styles/scale-factor.js.map +1 -0
  201. package/dist/module/native/styles/shorthands/_handler.js +11 -1
  202. package/dist/module/native/styles/shorthands/_handler.js.map +1 -1
  203. package/dist/module/native/styles/shorthands/animation.js +6 -3
  204. package/dist/module/native/styles/shorthands/animation.js.map +1 -1
  205. package/dist/module/native/styles/shorthands/box-shadow.js +46 -12
  206. package/dist/module/native/styles/shorthands/box-shadow.js.map +1 -1
  207. package/dist/module/native/styles/shorthands/index.js +1 -0
  208. package/dist/module/native/styles/shorthands/index.js.map +1 -1
  209. package/dist/module/native/styles/shorthands/logical-border-width.js +18 -0
  210. package/dist/module/native/styles/shorthands/logical-border-width.js.map +1 -0
  211. package/dist/module/native/styles/variables.js +55 -43
  212. package/dist/module/native/styles/variables.js.map +1 -1
  213. package/dist/module/native-internal/root.js +18 -7
  214. package/dist/module/native-internal/root.js.map +1 -1
  215. package/dist/module/native-internal/style-collection.js +1 -1
  216. package/dist/module/native-internal/style-collection.js.map +1 -1
  217. package/dist/module/native-internal/variables.js +2 -2
  218. package/dist/module/native-internal/variables.js.map +1 -1
  219. package/dist/module/utilities/dot-notation.types.js +2 -0
  220. package/dist/module/utilities/style-descriptor.js +4 -9
  221. package/dist/module/utilities/style-descriptor.js.map +1 -1
  222. package/dist/module/web/api.js +2 -2
  223. package/dist/module/web/api.js.map +1 -1
  224. package/dist/module/web/assign-style.js +4 -1
  225. package/dist/module/web/assign-style.js.map +1 -1
  226. package/dist/typescript/commonjs/src/babel/helpers.d.ts +2 -1
  227. package/dist/typescript/commonjs/src/babel/helpers.d.ts.map +1 -1
  228. package/dist/typescript/commonjs/src/babel/import-plugin.d.ts.map +1 -1
  229. package/dist/typescript/commonjs/src/babel/react-native-web.d.ts +2 -1
  230. package/dist/typescript/commonjs/src/babel/react-native-web.d.ts.map +1 -1
  231. package/dist/typescript/commonjs/src/babel/react-native.d.ts.map +1 -1
  232. package/dist/typescript/commonjs/src/compiler/atRules.d.ts +4 -1
  233. package/dist/typescript/commonjs/src/compiler/atRules.d.ts.map +1 -1
  234. package/dist/typescript/commonjs/src/compiler/compiler.d.ts +1 -5
  235. package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -1
  236. package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts +6 -0
  237. package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -1
  238. package/dist/typescript/commonjs/src/compiler/declarations.d.ts +3 -2
  239. package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -1
  240. package/dist/typescript/commonjs/src/compiler/lightningcss-loader.d.ts.map +1 -1
  241. package/dist/typescript/commonjs/src/compiler/media-query.d.ts +1 -1
  242. package/dist/typescript/commonjs/src/compiler/media-query.d.ts.map +1 -1
  243. package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts.map +1 -1
  244. package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts +7 -8
  245. package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts.map +1 -1
  246. package/dist/typescript/commonjs/src/components/FlatList.d.ts.map +1 -1
  247. package/dist/typescript/commonjs/src/components/ImageBackground.d.ts.map +1 -1
  248. package/dist/typescript/commonjs/src/components/KeyboardAvoidingView.d.ts.map +1 -1
  249. package/dist/typescript/commonjs/src/components/SafeAreaProvider.d.ts +2 -0
  250. package/dist/typescript/commonjs/src/components/SafeAreaProvider.d.ts.map +1 -0
  251. package/dist/typescript/commonjs/src/components/react-native-safe-area-context.native.d.ts +1 -1
  252. package/dist/typescript/commonjs/src/components/react-native-safe-area-context.native.d.ts.map +1 -1
  253. package/dist/typescript/commonjs/src/jest/index.d.ts +2 -10
  254. package/dist/typescript/commonjs/src/jest/index.d.ts.map +1 -1
  255. package/dist/typescript/commonjs/src/metro/cache-version.d.ts +8 -0
  256. package/dist/typescript/commonjs/src/metro/cache-version.d.ts.map +1 -0
  257. package/dist/typescript/commonjs/src/metro/index.d.ts +4 -0
  258. package/dist/typescript/commonjs/src/metro/index.d.ts.map +1 -1
  259. package/dist/typescript/commonjs/src/metro/metro-transformer.d.ts +9 -4
  260. package/dist/typescript/commonjs/src/metro/metro-transformer.d.ts.map +1 -1
  261. package/dist/typescript/commonjs/src/metro/typescript.d.ts.map +1 -1
  262. package/dist/typescript/commonjs/src/metro/warnings.d.ts +13 -0
  263. package/dist/typescript/commonjs/src/metro/warnings.d.ts.map +1 -0
  264. package/dist/typescript/commonjs/src/native/api.d.ts +4 -8
  265. package/dist/typescript/commonjs/src/native/api.d.ts.map +1 -1
  266. package/dist/typescript/commonjs/src/native/conditions/container-query.d.ts.map +1 -1
  267. package/dist/typescript/commonjs/src/native/react/interaction.d.ts +1 -1
  268. package/dist/typescript/commonjs/src/native/react/interaction.d.ts.map +1 -1
  269. package/dist/typescript/commonjs/src/native/react/rules.d.ts.map +1 -1
  270. package/dist/typescript/commonjs/src/native/react/useNativeCss.d.ts.map +1 -1
  271. package/dist/typescript/commonjs/src/native/react/usePassthrough.d.ts.map +1 -1
  272. package/dist/typescript/commonjs/src/native/reactivity.d.ts +14 -3
  273. package/dist/typescript/commonjs/src/native/reactivity.d.ts.map +1 -1
  274. package/dist/typescript/commonjs/src/native/reanimated.d.ts.map +1 -1
  275. package/dist/typescript/commonjs/src/native/styles/functions/color-mix.d.ts +3 -0
  276. package/dist/typescript/commonjs/src/native/styles/functions/color-mix.d.ts.map +1 -0
  277. package/dist/typescript/commonjs/src/native/styles/functions/filters.d.ts +2 -0
  278. package/dist/typescript/commonjs/src/native/styles/functions/filters.d.ts.map +1 -1
  279. package/dist/typescript/commonjs/src/native/styles/functions/index.d.ts +1 -0
  280. package/dist/typescript/commonjs/src/native/styles/functions/index.d.ts.map +1 -1
  281. package/dist/typescript/commonjs/src/native/styles/functions/numeric-functions.d.ts.map +1 -1
  282. package/dist/typescript/commonjs/src/native/styles/functions/string-functions.d.ts +2 -0
  283. package/dist/typescript/commonjs/src/native/styles/functions/string-functions.d.ts.map +1 -1
  284. package/dist/typescript/commonjs/src/native/styles/functions/transform-functions.d.ts.map +1 -1
  285. package/dist/typescript/commonjs/src/native/styles/index.d.ts +2 -2
  286. package/dist/typescript/commonjs/src/native/styles/index.d.ts.map +1 -1
  287. package/dist/typescript/commonjs/src/native/styles/resolve.d.ts +1 -0
  288. package/dist/typescript/commonjs/src/native/styles/resolve.d.ts.map +1 -1
  289. package/dist/typescript/commonjs/src/native/styles/scale-factor.d.ts +2 -0
  290. package/dist/typescript/commonjs/src/native/styles/scale-factor.d.ts.map +1 -0
  291. package/dist/typescript/commonjs/src/native/styles/shorthands/_handler.d.ts.map +1 -1
  292. package/dist/typescript/commonjs/src/native/styles/shorthands/animation.d.ts.map +1 -1
  293. package/dist/typescript/commonjs/src/native/styles/shorthands/box-shadow.d.ts.map +1 -1
  294. package/dist/typescript/commonjs/src/native/styles/shorthands/index.d.ts +1 -0
  295. package/dist/typescript/commonjs/src/native/styles/shorthands/index.d.ts.map +1 -1
  296. package/dist/typescript/commonjs/src/native/styles/shorthands/logical-border-width.d.ts +4 -0
  297. package/dist/typescript/commonjs/src/native/styles/shorthands/logical-border-width.d.ts.map +1 -0
  298. package/dist/typescript/commonjs/src/native/styles/variables.d.ts.map +1 -1
  299. package/dist/typescript/commonjs/src/native-internal/root.d.ts +12 -0
  300. package/dist/typescript/commonjs/src/native-internal/root.d.ts.map +1 -1
  301. package/dist/typescript/commonjs/src/native-internal/variables.d.ts +1 -1
  302. package/dist/typescript/commonjs/src/native-internal/variables.d.ts.map +1 -1
  303. package/dist/typescript/commonjs/src/runtime.types.d.ts +11 -6
  304. package/dist/typescript/commonjs/src/runtime.types.d.ts.map +1 -1
  305. package/dist/typescript/commonjs/src/utilities/dot-notation.types.d.ts +2 -1
  306. package/dist/typescript/commonjs/src/utilities/dot-notation.types.d.ts.map +1 -1
  307. package/dist/typescript/commonjs/src/utilities/style-descriptor.d.ts +1 -1
  308. package/dist/typescript/commonjs/src/utilities/style-descriptor.d.ts.map +1 -1
  309. package/dist/typescript/commonjs/src/web/api.d.ts +5 -5
  310. package/dist/typescript/commonjs/src/web/api.d.ts.map +1 -1
  311. package/dist/typescript/commonjs/src/web/assign-style.d.ts.map +1 -1
  312. package/dist/typescript/module/src/babel/helpers.d.ts +2 -1
  313. package/dist/typescript/module/src/babel/helpers.d.ts.map +1 -1
  314. package/dist/typescript/module/src/babel/import-plugin.d.ts +1 -1
  315. package/dist/typescript/module/src/babel/import-plugin.d.ts.map +1 -1
  316. package/dist/typescript/module/src/babel/react-native-web.d.ts +2 -1
  317. package/dist/typescript/module/src/babel/react-native-web.d.ts.map +1 -1
  318. package/dist/typescript/module/src/babel/react-native.d.ts.map +1 -1
  319. package/dist/typescript/module/src/compiler/atRules.d.ts +6 -3
  320. package/dist/typescript/module/src/compiler/atRules.d.ts.map +1 -1
  321. package/dist/typescript/module/src/compiler/compiler.d.ts +3 -7
  322. package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -1
  323. package/dist/typescript/module/src/compiler/compiler.types.d.ts +7 -1
  324. package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -1
  325. package/dist/typescript/module/src/compiler/container-query.d.ts +2 -2
  326. package/dist/typescript/module/src/compiler/container-query.d.ts.map +1 -1
  327. package/dist/typescript/module/src/compiler/declarations.d.ts +5 -4
  328. package/dist/typescript/module/src/compiler/declarations.d.ts.map +1 -1
  329. package/dist/typescript/module/src/compiler/index.d.ts +2 -2
  330. package/dist/typescript/module/src/compiler/index.d.ts.map +1 -1
  331. package/dist/typescript/module/src/compiler/inline-variables.d.ts +1 -1
  332. package/dist/typescript/module/src/compiler/inline-variables.d.ts.map +1 -1
  333. package/dist/typescript/module/src/compiler/keyframes.d.ts +2 -2
  334. package/dist/typescript/module/src/compiler/keyframes.d.ts.map +1 -1
  335. package/dist/typescript/module/src/compiler/lightningcss-loader.d.ts.map +1 -1
  336. package/dist/typescript/module/src/compiler/media-query.d.ts +3 -3
  337. package/dist/typescript/module/src/compiler/media-query.d.ts.map +1 -1
  338. package/dist/typescript/module/src/compiler/pseudo-elements.d.ts +1 -1
  339. package/dist/typescript/module/src/compiler/pseudo-elements.d.ts.map +1 -1
  340. package/dist/typescript/module/src/compiler/selector-builder.d.ts +1 -1
  341. package/dist/typescript/module/src/compiler/selector-builder.d.ts.map +1 -1
  342. package/dist/typescript/module/src/compiler/selectors.d.ts +2 -2
  343. package/dist/typescript/module/src/compiler/selectors.d.ts.map +1 -1
  344. package/dist/typescript/module/src/compiler/stylesheet.d.ts +7 -8
  345. package/dist/typescript/module/src/compiler/stylesheet.d.ts.map +1 -1
  346. package/dist/typescript/module/src/components/FlatList.d.ts.map +1 -1
  347. package/dist/typescript/module/src/components/ImageBackground.d.ts.map +1 -1
  348. package/dist/typescript/module/src/components/KeyboardAvoidingView.d.ts.map +1 -1
  349. package/dist/typescript/module/src/components/SafeAreaProvider.d.ts +2 -0
  350. package/dist/typescript/module/src/components/SafeAreaProvider.d.ts.map +1 -0
  351. package/dist/typescript/module/src/components/index.d.ts +16 -16
  352. package/dist/typescript/module/src/components/index.d.ts.map +1 -1
  353. package/dist/typescript/module/src/components/react-native-safe-area-context.native.d.ts +1 -1
  354. package/dist/typescript/module/src/components/react-native-safe-area-context.native.d.ts.map +1 -1
  355. package/dist/typescript/module/src/jest/index.d.ts +2 -10
  356. package/dist/typescript/module/src/jest/index.d.ts.map +1 -1
  357. package/dist/typescript/module/src/metro/cache-version.d.ts +8 -0
  358. package/dist/typescript/module/src/metro/cache-version.d.ts.map +1 -0
  359. package/dist/typescript/module/src/metro/index.d.ts +5 -1
  360. package/dist/typescript/module/src/metro/index.d.ts.map +1 -1
  361. package/dist/typescript/module/src/metro/metro-transformer.d.ts +10 -5
  362. package/dist/typescript/module/src/metro/metro-transformer.d.ts.map +1 -1
  363. package/dist/typescript/module/src/metro/typescript.d.ts.map +1 -1
  364. package/dist/typescript/module/src/metro/warnings.d.ts +13 -0
  365. package/dist/typescript/module/src/metro/warnings.d.ts.map +1 -0
  366. package/dist/typescript/module/src/native/api.d.ts +5 -9
  367. package/dist/typescript/module/src/native/api.d.ts.map +1 -1
  368. package/dist/typescript/module/src/native/conditions/attributes.d.ts +1 -1
  369. package/dist/typescript/module/src/native/conditions/attributes.d.ts.map +1 -1
  370. package/dist/typescript/module/src/native/conditions/container-query.d.ts +2 -2
  371. package/dist/typescript/module/src/native/conditions/container-query.d.ts.map +1 -1
  372. package/dist/typescript/module/src/native/conditions/guards.d.ts +2 -2
  373. package/dist/typescript/module/src/native/conditions/guards.d.ts.map +1 -1
  374. package/dist/typescript/module/src/native/conditions/index.d.ts +3 -3
  375. package/dist/typescript/module/src/native/conditions/index.d.ts.map +1 -1
  376. package/dist/typescript/module/src/native/conditions/media-query.d.ts +1 -1
  377. package/dist/typescript/module/src/native/conditions/media-query.d.ts.map +1 -1
  378. package/dist/typescript/module/src/native/index.d.ts +3 -3
  379. package/dist/typescript/module/src/native/index.d.ts.map +1 -1
  380. package/dist/typescript/module/src/native/react/interaction.d.ts +2 -2
  381. package/dist/typescript/module/src/native/react/interaction.d.ts.map +1 -1
  382. package/dist/typescript/module/src/native/react/rules.d.ts +2 -2
  383. package/dist/typescript/module/src/native/react/rules.d.ts.map +1 -1
  384. package/dist/typescript/module/src/native/react/useNativeCss.d.ts +4 -4
  385. package/dist/typescript/module/src/native/react/useNativeCss.d.ts.map +1 -1
  386. package/dist/typescript/module/src/native/react/usePassthrough.d.ts +1 -1
  387. package/dist/typescript/module/src/native/react/usePassthrough.d.ts.map +1 -1
  388. package/dist/typescript/module/src/native/reactivity.d.ts +14 -3
  389. package/dist/typescript/module/src/native/reactivity.d.ts.map +1 -1
  390. package/dist/typescript/module/src/native/reanimated.d.ts.map +1 -1
  391. package/dist/typescript/module/src/native/styles/calculate-props.d.ts +2 -2
  392. package/dist/typescript/module/src/native/styles/calculate-props.d.ts.map +1 -1
  393. package/dist/typescript/module/src/native/styles/functions/animation-timing.d.ts +1 -1
  394. package/dist/typescript/module/src/native/styles/functions/animation-timing.d.ts.map +1 -1
  395. package/dist/typescript/module/src/native/styles/functions/calc.d.ts +1 -1
  396. package/dist/typescript/module/src/native/styles/functions/calc.d.ts.map +1 -1
  397. package/dist/typescript/module/src/native/styles/functions/color-mix.d.ts +3 -0
  398. package/dist/typescript/module/src/native/styles/functions/color-mix.d.ts.map +1 -0
  399. package/dist/typescript/module/src/native/styles/functions/filters.d.ts +3 -1
  400. package/dist/typescript/module/src/native/styles/functions/filters.d.ts.map +1 -1
  401. package/dist/typescript/module/src/native/styles/functions/index.d.ts +8 -7
  402. package/dist/typescript/module/src/native/styles/functions/index.d.ts.map +1 -1
  403. package/dist/typescript/module/src/native/styles/functions/numeric-functions.d.ts +1 -1
  404. package/dist/typescript/module/src/native/styles/functions/numeric-functions.d.ts.map +1 -1
  405. package/dist/typescript/module/src/native/styles/functions/platform-functions.d.ts +1 -1
  406. package/dist/typescript/module/src/native/styles/functions/platform-functions.d.ts.map +1 -1
  407. package/dist/typescript/module/src/native/styles/functions/string-functions.d.ts +3 -1
  408. package/dist/typescript/module/src/native/styles/functions/string-functions.d.ts.map +1 -1
  409. package/dist/typescript/module/src/native/styles/functions/transform-functions.d.ts +1 -1
  410. package/dist/typescript/module/src/native/styles/functions/transform-functions.d.ts.map +1 -1
  411. package/dist/typescript/module/src/native/styles/index.d.ts +7 -7
  412. package/dist/typescript/module/src/native/styles/index.d.ts.map +1 -1
  413. package/dist/typescript/module/src/native/styles/line-height.d.ts +1 -1
  414. package/dist/typescript/module/src/native/styles/line-height.d.ts.map +1 -1
  415. package/dist/typescript/module/src/native/styles/resolve.d.ts +4 -3
  416. package/dist/typescript/module/src/native/styles/resolve.d.ts.map +1 -1
  417. package/dist/typescript/module/src/native/styles/scale-factor.d.ts +2 -0
  418. package/dist/typescript/module/src/native/styles/scale-factor.d.ts.map +1 -0
  419. package/dist/typescript/module/src/native/styles/shorthands/_handler.d.ts +1 -1
  420. package/dist/typescript/module/src/native/styles/shorthands/_handler.d.ts.map +1 -1
  421. package/dist/typescript/module/src/native/styles/shorthands/animation.d.ts +2 -2
  422. package/dist/typescript/module/src/native/styles/shorthands/animation.d.ts.map +1 -1
  423. package/dist/typescript/module/src/native/styles/shorthands/border.d.ts +1 -1
  424. package/dist/typescript/module/src/native/styles/shorthands/border.d.ts.map +1 -1
  425. package/dist/typescript/module/src/native/styles/shorthands/box-shadow.d.ts +1 -1
  426. package/dist/typescript/module/src/native/styles/shorthands/box-shadow.d.ts.map +1 -1
  427. package/dist/typescript/module/src/native/styles/shorthands/index.d.ts +6 -5
  428. package/dist/typescript/module/src/native/styles/shorthands/index.d.ts.map +1 -1
  429. package/dist/typescript/module/src/native/styles/shorthands/logical-border-width.d.ts +4 -0
  430. package/dist/typescript/module/src/native/styles/shorthands/logical-border-width.d.ts.map +1 -0
  431. package/dist/typescript/module/src/native/styles/shorthands/text-shadow.d.ts +1 -1
  432. package/dist/typescript/module/src/native/styles/shorthands/text-shadow.d.ts.map +1 -1
  433. package/dist/typescript/module/src/native/styles/shorthands/transform.d.ts +1 -1
  434. package/dist/typescript/module/src/native/styles/shorthands/transform.d.ts.map +1 -1
  435. package/dist/typescript/module/src/native/styles/units.d.ts +1 -1
  436. package/dist/typescript/module/src/native/styles/units.d.ts.map +1 -1
  437. package/dist/typescript/module/src/native/styles/variables.d.ts +2 -2
  438. package/dist/typescript/module/src/native/styles/variables.d.ts.map +1 -1
  439. package/dist/typescript/module/src/native-internal/index.d.ts +3 -3
  440. package/dist/typescript/module/src/native-internal/index.d.ts.map +1 -1
  441. package/dist/typescript/module/src/native-internal/root.d.ts +13 -1
  442. package/dist/typescript/module/src/native-internal/root.d.ts.map +1 -1
  443. package/dist/typescript/module/src/native-internal/style-collection.d.ts +2 -2
  444. package/dist/typescript/module/src/native-internal/style-collection.d.ts.map +1 -1
  445. package/dist/typescript/module/src/native-internal/variables.d.ts +2 -2
  446. package/dist/typescript/module/src/native-internal/variables.d.ts.map +1 -1
  447. package/dist/typescript/module/src/runtime.d.ts +1 -1
  448. package/dist/typescript/module/src/runtime.d.ts.map +1 -1
  449. package/dist/typescript/module/src/runtime.native.d.ts +1 -1
  450. package/dist/typescript/module/src/runtime.native.d.ts.map +1 -1
  451. package/dist/typescript/module/src/runtime.types.d.ts +11 -6
  452. package/dist/typescript/module/src/runtime.types.d.ts.map +1 -1
  453. package/dist/typescript/module/src/utilities/dot-notation.types.d.ts +2 -1
  454. package/dist/typescript/module/src/utilities/dot-notation.types.d.ts.map +1 -1
  455. package/dist/typescript/module/src/utilities/index.d.ts +3 -3
  456. package/dist/typescript/module/src/utilities/index.d.ts.map +1 -1
  457. package/dist/typescript/module/src/utilities/specificity.d.ts +2 -2
  458. package/dist/typescript/module/src/utilities/specificity.d.ts.map +1 -1
  459. package/dist/typescript/module/src/utilities/style-descriptor.d.ts +1 -1
  460. package/dist/typescript/module/src/utilities/style-descriptor.d.ts.map +1 -1
  461. package/dist/typescript/module/src/web/api.d.ts +5 -5
  462. package/dist/typescript/module/src/web/api.d.ts.map +1 -1
  463. package/dist/typescript/module/src/web/assign-style.d.ts.map +1 -1
  464. package/dist/typescript/module/src/web/index.d.ts +3 -3
  465. package/dist/typescript/module/src/web/index.d.ts.map +1 -1
  466. package/node/babel.mjs +4 -0
  467. package/node/compiler.mjs +2 -0
  468. package/node/metro.mjs +2 -0
  469. package/package.json +78 -29
  470. package/src/babel/helpers.ts +8 -1
  471. package/src/babel/import-plugin.ts +31 -16
  472. package/src/babel/react-native-web.ts +32 -4
  473. package/src/babel/react-native.ts +9 -4
  474. package/src/compiler/atRules.ts +44 -0
  475. package/src/compiler/compiler.ts +159 -43
  476. package/src/compiler/compiler.types.ts +9 -0
  477. package/src/compiler/container-query.ts +8 -3
  478. package/src/compiler/declarations.ts +280 -95
  479. package/src/compiler/lightningcss-loader.ts +21 -1
  480. package/src/compiler/media-query.ts +20 -9
  481. package/src/compiler/selector-builder.ts +31 -4
  482. package/src/compiler/stylesheet.ts +23 -10
  483. package/src/compiler/supports.ts +2 -2
  484. package/src/components/FlatList.tsx +1 -0
  485. package/src/components/ImageBackground.tsx +2 -6
  486. package/src/components/KeyboardAvoidingView.tsx +2 -3
  487. package/src/components/SafeAreaProvider.tsx +1 -0
  488. package/src/components/index.cts +46 -1
  489. package/src/jest/index.ts +1 -1
  490. package/src/metro/cache-version.ts +48 -0
  491. package/src/metro/index.ts +7 -0
  492. package/src/metro/metro-transformer.ts +26 -8
  493. package/src/metro/typescript.ts +53 -6
  494. package/src/metro/warnings.ts +187 -0
  495. package/src/native/api.tsx +22 -17
  496. package/src/native/conditions/attributes.ts +26 -9
  497. package/src/native/conditions/container-query.ts +11 -9
  498. package/src/native/conditions/media-query.ts +1 -1
  499. package/src/native/react/interaction.ts +11 -6
  500. package/src/native/react/rules.ts +13 -5
  501. package/src/native/react/useNativeCss.ts +79 -17
  502. package/src/native/react/usePassthrough.ts +3 -2
  503. package/src/native/reactivity.ts +76 -24
  504. package/src/native/reanimated.ts +24 -5
  505. package/src/native/styles/functions/color-mix.ts +74 -0
  506. package/src/native/styles/functions/filters.ts +20 -6
  507. package/src/native/styles/functions/index.ts +1 -0
  508. package/src/native/styles/functions/numeric-functions.ts +7 -6
  509. package/src/native/styles/functions/string-functions.ts +18 -0
  510. package/src/native/styles/functions/transform-functions.ts +5 -4
  511. package/src/native/styles/index.ts +443 -36
  512. package/src/native/styles/resolve.ts +15 -11
  513. package/src/native/styles/scale-factor.ts +6 -0
  514. package/src/native/styles/shorthands/_handler.ts +14 -1
  515. package/src/native/styles/shorthands/animation.ts +8 -2
  516. package/src/native/styles/shorthands/box-shadow.ts +50 -15
  517. package/src/native/styles/shorthands/index.ts +1 -0
  518. package/src/native/styles/shorthands/logical-border-width.ts +32 -0
  519. package/src/native/styles/variables.ts +48 -38
  520. package/src/native-internal/root.ts +40 -13
  521. package/src/native-internal/style-collection.ts +1 -1
  522. package/src/native-internal/variables.tsx +6 -4
  523. package/src/runtime.types.ts +17 -15
  524. package/src/utilities/dot-notation.types.ts +4 -3
  525. package/src/utilities/style-descriptor.ts +11 -16
  526. package/src/web/api.tsx +7 -12
  527. package/src/web/assign-style.ts +2 -1
  528. package/types.d.ts +3 -20
  529. package/dist/commonjs/compiler/inheritance.test.js +0 -78
  530. package/dist/commonjs/compiler/inheritance.test.js.map +0 -1
  531. package/dist/module/compiler/inheritance.test.js +0 -78
  532. package/dist/module/compiler/inheritance.test.js.map +0 -1
  533. package/dist/typescript/commonjs/.config/eslint.config.d.mts +0 -3
  534. package/dist/typescript/commonjs/.config/eslint.config.d.mts.map +0 -1
  535. package/dist/typescript/commonjs/eslint.config.d.mts +0 -2
  536. package/dist/typescript/commonjs/eslint.config.d.mts.map +0 -1
  537. package/dist/typescript/commonjs/example/app.config.d.ts +0 -4
  538. package/dist/typescript/commonjs/example/app.config.d.ts.map +0 -1
  539. package/dist/typescript/commonjs/example/index.d.ts +0 -2
  540. package/dist/typescript/commonjs/example/index.d.ts.map +0 -1
  541. package/dist/typescript/commonjs/example/metro.config.d.ts +0 -3
  542. package/dist/typescript/commonjs/example/metro.config.d.ts.map +0 -1
  543. package/dist/typescript/commonjs/example/postcss.config.d.mts +0 -7
  544. package/dist/typescript/commonjs/example/postcss.config.d.mts.map +0 -1
  545. package/dist/typescript/commonjs/example/src/App.d.ts +0 -3
  546. package/dist/typescript/commonjs/example/src/App.d.ts.map +0 -1
  547. package/dist/typescript/commonjs/src/compiler/inheritance.test.d.ts +0 -2
  548. package/dist/typescript/commonjs/src/compiler/inheritance.test.d.ts.map +0 -1
  549. package/dist/typescript/module/.config/eslint.config.d.mts +0 -3
  550. package/dist/typescript/module/.config/eslint.config.d.mts.map +0 -1
  551. package/dist/typescript/module/eslint.config.d.mts +0 -2
  552. package/dist/typescript/module/eslint.config.d.mts.map +0 -1
  553. package/dist/typescript/module/example/app.config.d.ts +0 -4
  554. package/dist/typescript/module/example/app.config.d.ts.map +0 -1
  555. package/dist/typescript/module/example/index.d.ts +0 -2
  556. package/dist/typescript/module/example/index.d.ts.map +0 -1
  557. package/dist/typescript/module/example/metro.config.d.ts +0 -3
  558. package/dist/typescript/module/example/metro.config.d.ts.map +0 -1
  559. package/dist/typescript/module/example/postcss.config.d.mts +0 -7
  560. package/dist/typescript/module/example/postcss.config.d.mts.map +0 -1
  561. package/dist/typescript/module/example/src/App.d.ts +0 -3
  562. package/dist/typescript/module/example/src/App.d.ts.map +0 -1
  563. package/dist/typescript/module/src/compiler/inheritance.test.d.ts +0 -2
  564. package/dist/typescript/module/src/compiler/inheritance.test.d.ts.map +0 -1
  565. package/src/compiler/inheritance.test.ts +0 -121
@@ -1,4 +1,4 @@
1
- import { resolve } from "path";
1
+ import { basename, dirname, resolve, sep } from "path";
2
2
 
3
3
  import { type PluginObj } from "@babel/core";
4
4
  import type { Statement } from "@babel/types";
@@ -16,6 +16,7 @@ import {
16
16
  import {
17
17
  handleReactNativeWebIdentifierRequire,
18
18
  handleReactNativeWebImport,
19
+ handleReactNativeWebInteropRequireDefault,
19
20
  handleReactNativeWebObjectPatternRequire,
20
21
  } from "./react-native-web";
21
22
 
@@ -24,10 +25,14 @@ export default function ({
24
25
  }: {
25
26
  types: BabelTypes;
26
27
  }): PluginObj<PluginState> {
27
- const processed = new WeakSet();
28
+ const processed = new WeakSet<Statement>();
28
29
 
29
- const thisModuleDist = resolve(__dirname, "../../../dist");
30
- const thisModuleSrc = resolve(__dirname, "../../../src");
30
+ const packageRoot = resolve(
31
+ __dirname,
32
+ basename(dirname(__dirname)) === "src" ? "../.." : "../../..",
33
+ );
34
+ const thisModuleDist = resolve(packageRoot, "dist") + sep;
35
+ const thisModuleSrc = resolve(packageRoot, "src") + sep;
31
36
 
32
37
  function isFromThisModule(filename: string): boolean {
33
38
  return (
@@ -39,17 +44,19 @@ export default function ({
39
44
  name: "Rewrite react-native to react-native-css",
40
45
  visitor: {
41
46
  ImportDeclaration(path, state): void {
47
+ const { filename } = state;
48
+
42
49
  if (
43
- processed.has(path) ||
50
+ filename === undefined ||
44
51
  processed.has(path.node) ||
45
- isFromThisModule(state.filename)
52
+ isFromThisModule(filename)
46
53
  ) {
47
54
  return;
48
55
  }
49
56
 
50
57
  const statements =
51
- handleReactNativeImport(path.node, t, state.filename) ??
52
- handleReactNativeWebImport(path.node, t, state.filename);
58
+ handleReactNativeImport(path.node, t, filename) ??
59
+ handleReactNativeWebImport(path.node, t, filename);
53
60
 
54
61
  if (!statements) {
55
62
  return;
@@ -62,10 +69,12 @@ export default function ({
62
69
  path.replaceWithMultiple(statements);
63
70
  },
64
71
  VariableDeclaration(path, state): void {
72
+ const { filename } = state;
73
+
65
74
  if (
66
- processed.has(path) ||
75
+ filename === undefined ||
67
76
  processed.has(path.node) ||
68
- isFromThisModule(state.filename)
77
+ isFromThisModule(filename)
69
78
  ) {
70
79
  return;
71
80
  }
@@ -94,6 +103,11 @@ export default function ({
94
103
  return;
95
104
  }
96
105
 
106
+ // A local function called require is not the module loader.
107
+ if (path.scope.getBinding("require")) {
108
+ return;
109
+ }
110
+
97
111
  const initArg = init.arguments.at(0);
98
112
 
99
113
  if (!initArg) {
@@ -114,14 +128,14 @@ export default function ({
114
128
  t,
115
129
  id.name,
116
130
  initArg.value,
117
- state.filename,
131
+ filename,
118
132
  ) ??
119
133
  handleReactNativeWebIdentifierRequire(
120
134
  path,
121
135
  t,
122
136
  id.name,
123
137
  initArg.value,
124
- state.filename,
138
+ filename,
125
139
  );
126
140
  } else if (
127
141
  t.isObjectPattern(id) &&
@@ -134,14 +148,14 @@ export default function ({
134
148
  t,
135
149
  id,
136
150
  initArg.value,
137
- state.filename,
151
+ filename,
138
152
  ) ??
139
153
  handleReactNativeWebObjectPatternRequire(
140
154
  path,
141
155
  t,
142
156
  id,
143
157
  initArg.value,
144
- state.filename,
158
+ filename,
145
159
  );
146
160
  } else if (
147
161
  t.isIdentifier(id) &&
@@ -152,12 +166,13 @@ export default function ({
152
166
  if (!source) {
153
167
  return;
154
168
  }
155
- statements = handleReactNativeWebIdentifierRequire(
169
+ statements = handleReactNativeWebInteropRequireDefault(
156
170
  path,
157
171
  t,
158
172
  id.name,
173
+ init,
159
174
  source,
160
- state.filename,
175
+ filename,
161
176
  );
162
177
  }
163
178
 
@@ -1,7 +1,6 @@
1
- import { resolve } from "path";
2
-
3
1
  import { type NodePath } from "@babel/traverse";
4
2
  import tBabelTypes, {
3
+ type CallExpression,
5
4
  type ImportDeclaration,
6
5
  type ObjectPattern,
7
6
  type Statement,
@@ -9,12 +8,13 @@ import tBabelTypes, {
9
8
  } from "@babel/types";
10
9
 
11
10
  import { allowedModules } from "./allowedModules";
11
+ import { resolveImportSource } from "./helpers";
12
12
 
13
13
  type BabelTypes = typeof tBabelTypes;
14
14
 
15
15
  function parseReactNativeWebSource(source: string, filename: string) {
16
16
  if (source.startsWith(".")) {
17
- source = resolve(filename, source);
17
+ source = resolveImportSource(filename, source);
18
18
 
19
19
  const internalPath = source.split("react-native-web/dist")[1];
20
20
  if (!internalPath) {
@@ -48,6 +48,7 @@ export function handleReactNativeWebImport(
48
48
  filename: string,
49
49
  ): Statement[] | undefined {
50
50
  const { specifiers, source } = declaration;
51
+ if (declaration.importKind && declaration.importKind !== "value") return;
51
52
 
52
53
  const rnwSource = parseReactNativeWebSource(source.value, filename);
53
54
  if (!rnwSource) {
@@ -76,7 +77,7 @@ export function handleReactNativeWebImport(
76
77
  } else {
77
78
  statements.push(
78
79
  t.importDeclaration(
79
- [t.importSpecifier(specifier.local, specifier.local)],
80
+ [t.importSpecifier(specifier.local, t.identifier(name))],
80
81
  t.stringLiteral(`react-native-css/components/${name}`),
81
82
  ),
82
83
  );
@@ -89,6 +90,10 @@ export function handleReactNativeWebImport(
89
90
  ),
90
91
  );
91
92
  } else {
93
+ if (specifier.importKind && specifier.importKind !== "value") {
94
+ statements.push(t.importDeclaration([specifier], source));
95
+ continue;
96
+ }
92
97
  const localName = t.isStringLiteral(specifier.imported)
93
98
  ? specifier.imported.value
94
99
  : specifier.imported.name;
@@ -158,6 +163,28 @@ export function handleReactNativeWebIdentifierRequire(
158
163
  }
159
164
  }
160
165
 
166
+ export function handleReactNativeWebInteropRequireDefault(
167
+ path: NodePath<VariableDeclaration>,
168
+ t: BabelTypes,
169
+ id: string,
170
+ init: CallExpression,
171
+ source: string,
172
+ filename: string,
173
+ ) {
174
+ const parsed = parseReactNativeWebSource(source, filename);
175
+ if (!parsed) return;
176
+
177
+ const wrapped = t.cloneNode(init);
178
+ wrapped.arguments = [
179
+ t.callExpression(t.identifier("require"), [t.stringLiteral(parsed.source)]),
180
+ ];
181
+ return [
182
+ t.variableDeclaration(path.node.kind, [
183
+ t.variableDeclarator(t.identifier(id), wrapped),
184
+ ]),
185
+ ];
186
+ }
187
+
161
188
  export function handleReactNativeWebObjectPatternRequire(
162
189
  path: NodePath<VariableDeclaration>,
163
190
  t: BabelTypes,
@@ -180,6 +207,7 @@ export function handleReactNativeWebObjectPatternRequire(
180
207
  // We need to exit as we do not handle `const { Text, ...rest } = require('react-native-web');`
181
208
  return;
182
209
  } else if (
210
+ identifier.computed ||
183
211
  !(t.isIdentifier(identifier.value) && t.isIdentifier(identifier.key))
184
212
  ) {
185
213
  // Bail out on anything that isn't `const { <key>: <identifier> } = require('react-native-web');`
@@ -1,5 +1,3 @@
1
- import { dirname, resolve } from "path";
2
-
3
1
  import { type NodePath } from "@babel/traverse";
4
2
  import tBabelTypes, {
5
3
  type ImportDeclaration,
@@ -9,12 +7,13 @@ import tBabelTypes, {
9
7
  } from "@babel/types";
10
8
 
11
9
  import { allowedModules } from "./allowedModules";
10
+ import { resolveImportSource } from "./helpers";
12
11
 
13
12
  type BabelTypes = typeof tBabelTypes;
14
13
 
15
14
  function parseReactNativeSource(source: string, filename: string) {
16
15
  if (source.startsWith(".")) {
17
- source = resolve(dirname(filename), source);
16
+ source = resolveImportSource(filename, source);
18
17
 
19
18
  const internalPath = source.split("react-native/Libraries/Components/")[1];
20
19
  if (!internalPath) {
@@ -48,6 +47,7 @@ export function handleReactNativeImport(
48
47
  filename: string,
49
48
  ): Statement[] | undefined {
50
49
  const { specifiers, source } = declaration;
50
+ if (declaration.importKind && declaration.importKind !== "value") return;
51
51
 
52
52
  const rnwSource = parseReactNativeSource(source.value, filename);
53
53
  if (!rnwSource) {
@@ -76,7 +76,7 @@ export function handleReactNativeImport(
76
76
  } else {
77
77
  statements.push(
78
78
  t.importDeclaration(
79
- [t.importSpecifier(specifier.local, specifier.local)],
79
+ [t.importSpecifier(specifier.local, t.identifier(name))],
80
80
  t.stringLiteral(`react-native-css/components/${name}`),
81
81
  ),
82
82
  );
@@ -89,6 +89,10 @@ export function handleReactNativeImport(
89
89
  ),
90
90
  );
91
91
  } else {
92
+ if (specifier.importKind && specifier.importKind !== "value") {
93
+ statements.push(t.importDeclaration([specifier], source));
94
+ continue;
95
+ }
92
96
  const localName = t.isStringLiteral(specifier.imported)
93
97
  ? specifier.imported.value
94
98
  : specifier.imported.name;
@@ -180,6 +184,7 @@ export function handleReactNativeObjectPatternRequire(
180
184
  // We need to exit as we do not handle `const { Text, ...rest } = require('react-native');`
181
185
  return;
182
186
  } else if (
187
+ identifier.computed ||
183
188
  !(t.isIdentifier(identifier.value) && t.isIdentifier(identifier.key))
184
189
  ) {
185
190
  // Bail out on anything that isn't `const { <key>: <identifier> } = require('react-native');`
@@ -1,4 +1,5 @@
1
1
  import type {
2
+ Declaration,
2
3
  DeclarationBlock,
3
4
  ParsedComponent,
4
5
  Rule,
@@ -99,6 +100,49 @@ export function parsePropAtRule(rules?: (Rule | PropAtRule)[]) {
99
100
  return mapping;
100
101
  }
101
102
 
103
+ const mappingProperty = "-rn-native-mapping";
104
+
105
+ export function isMappingProperty(name: string) {
106
+ return name === mappingProperty || name.startsWith(`${mappingProperty}-`);
107
+ }
108
+
109
+ /** Declaration metadata survives the optimizer flattening nested at rules. */
110
+ export function parsePropDeclarations(declarations: Declaration[] = []) {
111
+ const mapping: StyleRuleMapping = {};
112
+ for (const declaration of declarations) {
113
+ if (
114
+ declaration.property !== "custom" ||
115
+ !isMappingProperty(declaration.value.name)
116
+ ) {
117
+ continue;
118
+ }
119
+ const { name, value } = declaration.value;
120
+ const target = value.filter(
121
+ (item): item is Extract<TokenOrValue, { type: "token" }> =>
122
+ item.type === "token" && item.value.type !== "white-space",
123
+ );
124
+ if (target.length === 0) continue;
125
+ nativeMappingAtRuleBlock(
126
+ [
127
+ {
128
+ type: "token",
129
+ value: {
130
+ type: "ident",
131
+ value:
132
+ name === mappingProperty
133
+ ? "*"
134
+ : name.slice(mappingProperty.length + 1),
135
+ },
136
+ },
137
+ { type: "token", value: { type: "colon" } },
138
+ ...target,
139
+ ],
140
+ mapping,
141
+ );
142
+ }
143
+ return mapping;
144
+ }
145
+
102
146
  function nativeMappingAtRuleBlock(
103
147
  token: Extract<TokenOrValue, { type: "token" }>[],
104
148
  mapping: StyleRuleMapping = {},
@@ -4,22 +4,36 @@ import { inspect } from "node:util";
4
4
  import { debug } from "debug";
5
5
  import {
6
6
  type ContainerRule,
7
- type MediaQuery as CSSMediaQuery,
8
7
  type CustomAtRules,
9
8
  type MediaRule,
9
+ type ParsedComponent,
10
+ type PropertyRule,
10
11
  type Rule,
11
12
  type Visitor,
13
+ type Warning,
12
14
  } from "lightningcss";
13
15
 
14
- import { maybeMutateReactNativeOptions, parsePropAtRule } from "./atRules";
16
+ import {
17
+ maybeMutateReactNativeOptions,
18
+ parsePropAtRule,
19
+ parsePropDeclarations,
20
+ } from "./atRules";
15
21
  import type {
16
22
  CompilerOptions,
17
23
  ContainerQuery,
24
+ StyleDescriptor,
18
25
  StyleRuleMapping,
19
26
  UniqueVarInfo,
20
27
  } from "./compiler.types";
21
28
  import { parseContainerCondition } from "./container-query";
22
- import { parseDeclaration, round } from "./declarations";
29
+ import {
30
+ parseAngle,
31
+ parseColor,
32
+ parseDeclaration,
33
+ parseLength,
34
+ reduceParseUnparsed,
35
+ round,
36
+ } from "./declarations";
23
37
  import { inlineVariables } from "./inline-variables";
24
38
  import { extractKeyFrames } from "./keyframes";
25
39
  import { lightningcssLoader } from "./lightningcss-loader";
@@ -29,6 +43,21 @@ import { supportsConditionValid } from "./supports";
29
43
 
30
44
  const defaultLogger = debug("react-native-css:compiler");
31
45
 
46
+ // lightningcss reports this package's own at-rule as unknown
47
+ const OWN_AT_RULE_WARNING = "Unknown at rule: @nativeMapping";
48
+
49
+ // The warning is the only record of what lightningcss could not parse; only the first pass reads the author's CSS
50
+ function reportSyntaxWarnings(
51
+ builder: StylesheetBuilder,
52
+ warnings: Warning[],
53
+ ): void {
54
+ for (const warning of warnings) {
55
+ if (warning.message !== OWN_AT_RULE_WARNING) {
56
+ builder.addSyntaxWarning(warning.message);
57
+ }
58
+ }
59
+ }
60
+
32
61
  /**
33
62
  * Converts a CSS file to a collection of style declarations that can be used with the StyleSheet API
34
63
  *
@@ -74,17 +103,60 @@ export function compile(code: Buffer | string, options: CompilerOptions = {}) {
74
103
 
75
104
  const vars = new Map<string, UniqueVarInfo>();
76
105
 
77
- const firstPassVisitor: Visitor<CustomAtRules> = {};
106
+ // Determine the effective rem multiplier for compile-time inlining.
107
+ // If inlineRem is explicitly set, use that. Otherwise, scan for
108
+ // :root { font-size: Npx } in the CSS to allow CSS-based configuration.
109
+ let effectiveRem: number | false = options.inlineRem ?? undefined!;
110
+ if (effectiveRem === undefined) {
111
+ const css = typeof code === "string" ? code : code.toString();
112
+ const match = css.match(/:root\s*\{[^}]*font-size:\s*([\d.]+)px/);
113
+ effectiveRem = match?.[1] ? parseFloat(match[1]) : 14;
114
+ options.inlineRem = effectiveRem;
115
+ }
116
+
117
+ const firstPassVisitor: Visitor<CustomAtRules> = {
118
+ Rule(rule) {
119
+ if (
120
+ rule.type === "unknown" &&
121
+ ["cssInterop", "react-native"].includes(rule.value.name)
122
+ ) {
123
+ throw new Error(
124
+ `Unsupported @${rule.value.name} configuration. Use the compiler inlineVariables.exclude option to preserve variables, @media (prefers-color-scheme: dark) for dark mode, and React Native Appearance.setColorScheme() for manual selection.`,
125
+ );
126
+ }
127
+ // Reject before variable inlining can erase an unsupported condition and
128
+ // accidentally turn its values into unconditional declarations.
129
+ if (
130
+ rule.type === "style" &&
131
+ rule.value.selectors.some(
132
+ (selector) =>
133
+ selector.some(
134
+ (part) => part.type === "pseudo-class" && part.kind === "root",
135
+ ) &&
136
+ selector.some(
137
+ (part) =>
138
+ part.type === "class" ||
139
+ (part.type === "attribute" && part.name === "class"),
140
+ ),
141
+ )
142
+ ) {
143
+ throw new Error(
144
+ "Class-qualified :root selectors are unsupported on native. Use @media (prefers-color-scheme: dark) for dark mode, and React Native Appearance.setColorScheme() for manual selection.",
145
+ );
146
+ }
147
+ },
148
+ };
78
149
 
79
- if (options.inlineRem !== false) {
150
+ if (effectiveRem !== false) {
151
+ const remMultiplier = effectiveRem;
80
152
  firstPassVisitor.Length = (length) => {
81
- if (length.unit !== "rem" || options.inlineRem === false) {
153
+ if (length.unit !== "rem") {
82
154
  return length;
83
155
  }
84
156
 
85
157
  return {
86
158
  unit: "px",
87
- value: round(length.value * (options.inlineRem ?? 14)),
159
+ value: round(length.value * remMultiplier),
88
160
  };
89
161
  };
90
162
  }
@@ -114,7 +186,7 @@ export function compile(code: Buffer | string, options: CompilerOptions = {}) {
114
186
  };
115
187
  }
116
188
 
117
- const { code: firstPass } = lightningcss({
189
+ const { code: firstPass, warnings: firstPassWarnings } = lightningcss({
118
190
  code: typeof code === "string" ? new TextEncoder().encode(code) : code,
119
191
  include: Features.DoublePositionGradients | Features.ColorFunction,
120
192
  exclude: Features.VendorPrefixes,
@@ -175,6 +247,8 @@ export function compile(code: Buffer | string, options: CompilerOptions = {}) {
175
247
  projectRoot: options.projectRoot ?? process.cwd(),
176
248
  });
177
249
 
250
+ reportSyntaxWarnings(builder, firstPassWarnings);
251
+
178
252
  return {
179
253
  stylesheet: () => builder.getNativeStyleSheet(),
180
254
  warnings: () => builder.getWarnings(),
@@ -233,7 +307,12 @@ function extractRule(
233
307
  const value = rule.value;
234
308
 
235
309
  const declarationBlock = value.declarations;
236
- mapping = { ...mapping, ...parsePropAtRule(value.rules) };
310
+ mapping = {
311
+ ...mapping,
312
+ ...parsePropAtRule(value.rules),
313
+ ...parsePropDeclarations(declarationBlock?.declarations),
314
+ ...parsePropDeclarations(declarationBlock?.importantDeclarations),
315
+ };
237
316
 
238
317
  // If the rule is a style declaration, extract it with the `getExtractedStyle` function and store it in the `declarations` map
239
318
  builder = builder.fork("style", value.selectors);
@@ -276,13 +355,15 @@ function extractRule(
276
355
  }
277
356
  }
278
357
  break;
358
+ case "property":
359
+ extractPropertyRule(rule.value, builder);
360
+ break;
279
361
  case "custom":
280
362
  case "font-face":
281
363
  case "font-palette-values":
282
364
  case "font-feature-values":
283
365
  case "namespace":
284
366
  case "layer-statement":
285
- case "property":
286
367
  case "view-transition":
287
368
  case "ignored":
288
369
  case "unknown":
@@ -314,39 +395,16 @@ function extractMedia(
314
395
  builder: StylesheetBuilder,
315
396
  mapping: StyleRuleMapping,
316
397
  ) {
317
- builder = builder.fork("media");
318
-
319
- // Initialize an empty array to store screen media queries
320
- const media: CSSMediaQuery[] = [];
321
-
322
- // Iterate over all media queries in the mediaRule
398
+ // Comma separated queries are alternatives. Each branch inherits the outer
399
+ // conditions without adding its siblings as required conjunctions.
323
400
  for (const mediaQuery of mediaRule.query.mediaQueries) {
324
- if (
325
- // If this is only a media query
326
- (mediaQuery.mediaType === "print" && mediaQuery.qualifier !== "not") ||
327
- // If this is a @media not print {}
328
- // We can only do this if there are no conditions, as @media not print and (min-width: 100px) could be valid
329
- (mediaQuery.mediaType !== "print" &&
330
- mediaQuery.qualifier === "not" &&
331
- mediaQuery.condition === null)
332
- ) {
401
+ const queryBuilder = builder.fork("media");
402
+ if (!parseMediaQuery(mediaQuery, queryBuilder)) {
333
403
  continue;
334
404
  }
335
-
336
- media.push(mediaQuery);
337
- }
338
-
339
- if (media.length === 0) {
340
- return;
341
- }
342
-
343
- for (const m of media) {
344
- parseMediaQuery(m, builder);
345
- }
346
-
347
- // Iterate over all rules in the mediaRule and extract their styles using the updated CompilerCollection
348
- for (const rule of mediaRule.rules) {
349
- extractRule(rule, builder, mapping);
405
+ for (const rule of mediaRule.rules) {
406
+ extractRule(rule, queryBuilder, mapping);
407
+ }
350
408
  }
351
409
  }
352
410
 
@@ -363,9 +421,12 @@ function extractContainer(
363
421
  builder = builder.fork("container");
364
422
 
365
423
  // Iterate over all rules inside the containerRule and extract their styles using the updated CompilerCollection
366
- const query: ContainerQuery = {
367
- m: parseContainerCondition(containerRule.condition, builder),
368
- };
424
+ const condition = parseContainerCondition(containerRule.condition, builder);
425
+ if (!condition) {
426
+ // An unsupported condition must not turn into an unconditional container.
427
+ return;
428
+ }
429
+ const query: ContainerQuery = { m: condition };
369
430
 
370
431
  if (containerRule.name) {
371
432
  query.n = `c:${containerRule.name}`;
@@ -377,3 +438,58 @@ function extractContainer(
377
438
  extractRule(rule, builder, mapping);
378
439
  }
379
440
  }
441
+
442
+ function extractPropertyRule(
443
+ propertyRule: PropertyRule,
444
+ builder: StylesheetBuilder,
445
+ ) {
446
+ const { initialValue, name } = propertyRule;
447
+
448
+ if (initialValue == null) {
449
+ return;
450
+ }
451
+
452
+ const varName = name.startsWith("--") ? name.slice(2) : name;
453
+ const value = parsePropertyInitialValue(initialValue, builder);
454
+
455
+ if (value !== undefined) {
456
+ builder.addRootVariable(varName, value);
457
+ }
458
+ }
459
+
460
+ function parsePropertyInitialValue(
461
+ component: ParsedComponent,
462
+ builder: StylesheetBuilder,
463
+ ): StyleDescriptor {
464
+ switch (component.type) {
465
+ case "length":
466
+ return parseLength(component.value, builder);
467
+ case "number":
468
+ case "integer":
469
+ return round(component.value);
470
+ case "percentage":
471
+ return `${round(component.value * 100)}%`;
472
+ case "color":
473
+ return parseColor(component.value, builder);
474
+ case "angle":
475
+ return parseAngle(component.value, builder);
476
+ case "length-percentage":
477
+ return parseLength(component.value, builder);
478
+ case "token-list":
479
+ return reduceParseUnparsed(component.value, builder, "@property", false);
480
+ case "custom-ident":
481
+ case "literal":
482
+ return component.value;
483
+ case "repeated": {
484
+ const results = component.value.components
485
+ .map((c) => parsePropertyInitialValue(c, builder))
486
+ .filter((v): v is NonNullable<StyleDescriptor> => v !== undefined);
487
+ // Unwrap single-child repeated values so downstream consumers get a
488
+ // scalar instead of a 1-element array. For example, `<length>+` with
489
+ // initial-value `10px` should produce the same shape as `<length>`.
490
+ return results.length === 1 ? results[0] : results;
491
+ }
492
+ default:
493
+ return undefined;
494
+ }
495
+ }
@@ -24,6 +24,15 @@ export interface InlineVariableOptions {
24
24
  exclude?: `--${string}`[];
25
25
  }
26
26
 
27
+ // A channel is absent when the compile recorded nothing on it
28
+ export interface CompilerWarnings {
29
+ properties?: string[];
30
+ values?: Record<string, string[]>;
31
+ functions?: string[];
32
+ // CSS lightningcss could not parse, which the author fixes in their stylesheet
33
+ syntax?: string[];
34
+ }
35
+
27
36
  /**
28
37
  * A `react-native-css` StyleSheet
29
38
  */
@@ -36,9 +36,14 @@ function parseContainerQueryCondition(
36
36
  const query = parseContainerCondition(condition.value, builder);
37
37
  return query ? ["!", query] : undefined;
38
38
  case "operation":
39
- const conditions = condition.conditions
40
- .map((c) => parseContainerQueryCondition(c, builder))
41
- .filter((v): v is MediaCondition => !!v);
39
+ const parsed = condition.conditions.map((c) =>
40
+ parseContainerCondition(c, builder),
41
+ );
42
+ if (condition.operator === "and" && parsed.some((c) => !c)) {
43
+ // Dropping a conjunct would broaden the query to unrelated containers.
44
+ return;
45
+ }
46
+ const conditions = parsed.filter((c): c is MediaCondition => !!c);
42
47
 
43
48
  if (conditions.length === 0) {
44
49
  return;