@niibase/uniwind 1.6.4 → 1.7.0

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 (319) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/common/{css → bundler/artifacts/css}/index.js +1 -4
  3. package/dist/common/{css → bundler/artifacts/css}/themes.js +1 -1
  4. package/dist/common/{utils/buildDtsFile.js → bundler/artifacts/dts.js} +1 -2
  5. package/dist/common/bundler/config.js +69 -0
  6. package/dist/common/bundler/css-compiler/compileCSS.js +18 -0
  7. package/dist/common/bundler/css-compiler/compileNativeCSS.js +19 -0
  8. package/dist/common/bundler/css-compiler/compileTailwind.js +27 -0
  9. package/dist/common/bundler/css-compiler/compileWebCSS.js +15 -0
  10. package/dist/common/{vite → bundler/css-compiler}/index.js +4 -4
  11. package/dist/common/bundler/css-processor/addMetaToStylesTemplate.js +130 -0
  12. package/dist/common/bundler/css-processor/animation.js +112 -0
  13. package/dist/common/bundler/css-processor/color.js +66 -0
  14. package/dist/common/bundler/css-processor/css.js +510 -0
  15. package/dist/common/bundler/css-processor/functions.js +145 -0
  16. package/dist/common/bundler/css-processor/index.js +38 -0
  17. package/dist/common/bundler/css-processor/mq.js +87 -0
  18. package/dist/common/bundler/css-processor/processor.js +353 -0
  19. package/dist/common/bundler/css-processor/rn.js +356 -0
  20. package/dist/common/bundler/css-processor/serialize.js +86 -0
  21. package/dist/common/bundler/css-processor/types.js +1 -0
  22. package/dist/common/bundler/css-processor/units.js +55 -0
  23. package/dist/common/bundler/css-processor/utils.js +63 -0
  24. package/dist/common/bundler/css-processor/var.js +20 -0
  25. package/dist/common/{css-visitor → bundler/css-visitor}/rule-visitor.js +5 -5
  26. package/dist/common/{css-visitor → bundler/css-visitor}/visitor.js +5 -6
  27. package/dist/common/bundler/logger.js +41 -0
  28. package/dist/common/bundler/types.js +1 -0
  29. package/dist/common/common/consts.js +26 -2
  30. package/dist/common/components/web/rnw.js +2 -2
  31. package/dist/common/core/config/config.common.js +9 -9
  32. package/dist/common/core/config/config.js +2 -2
  33. package/dist/common/core/config/config.native.js +3 -3
  34. package/dist/common/core/listener.js +10 -10
  35. package/dist/common/core/native/runtime.js +7 -3
  36. package/dist/common/core/native/store.js +3 -4
  37. package/dist/common/core/web/cssListener.js +2 -2
  38. package/dist/common/hoc/withUniwind.js +5 -5
  39. package/dist/common/hoc/withUniwind.native.js +5 -5
  40. package/dist/common/hooks/useCSSVariable/useCSSVariable.js +6 -2
  41. package/dist/common/hooks/useUniwind.js +2 -2
  42. package/dist/metro/index.cjs +14 -24
  43. package/dist/metro/index.d.ts +2 -0
  44. package/dist/metro/index.mjs +7 -17
  45. package/dist/metro/{metro-transformer.cjs → transformer.cjs} +294 -174
  46. package/dist/metro/{metro-transformer.mjs → transformer.mjs} +236 -116
  47. package/dist/module/{css → bundler/artifacts/css}/index.d.ts +1 -1
  48. package/dist/module/{css → bundler/artifacts/css}/index.js +1 -4
  49. package/dist/module/{css → bundler/artifacts/css}/themes.js +1 -1
  50. package/dist/module/{utils/buildDtsFile.js → bundler/artifacts/dts.js} +3 -4
  51. package/dist/module/bundler/config.d.ts +16 -0
  52. package/dist/module/bundler/config.js +69 -0
  53. package/dist/module/bundler/css-compiler/compileCSS.d.ts +2 -0
  54. package/dist/module/bundler/css-compiler/compileCSS.js +11 -0
  55. package/dist/module/bundler/css-compiler/compileNativeCSS.d.ts +2 -0
  56. package/dist/module/bundler/css-compiler/compileNativeCSS.js +33 -0
  57. package/dist/module/bundler/css-compiler/compileTailwind.d.ts +2 -0
  58. package/dist/module/bundler/css-compiler/compileTailwind.js +22 -0
  59. package/dist/module/bundler/css-compiler/compileWebCSS.d.ts +2 -0
  60. package/dist/module/bundler/css-compiler/compileWebCSS.js +8 -0
  61. package/dist/module/bundler/css-compiler/index.d.ts +1 -0
  62. package/dist/module/bundler/css-compiler/index.js +1 -0
  63. package/dist/module/bundler/css-processor/addMetaToStylesTemplate.d.ts +3 -0
  64. package/dist/module/bundler/css-processor/addMetaToStylesTemplate.js +136 -0
  65. package/dist/module/bundler/css-processor/animation.d.ts +6 -0
  66. package/dist/module/bundler/css-processor/animation.js +112 -0
  67. package/dist/module/bundler/css-processor/color.d.ts +12 -0
  68. package/dist/module/bundler/css-processor/color.js +63 -0
  69. package/dist/module/bundler/css-processor/css.d.ts +23 -0
  70. package/dist/module/bundler/css-processor/css.js +566 -0
  71. package/dist/module/bundler/css-processor/functions.d.ts +12 -0
  72. package/dist/module/bundler/css-processor/functions.js +190 -0
  73. package/dist/module/bundler/css-processor/index.d.ts +3 -0
  74. package/dist/module/bundler/css-processor/index.js +3 -0
  75. package/dist/module/bundler/css-processor/mq.d.ts +12 -0
  76. package/dist/module/bundler/css-processor/mq.js +78 -0
  77. package/dist/module/bundler/css-processor/processor.d.ts +36 -0
  78. package/dist/module/bundler/css-processor/processor.js +336 -0
  79. package/dist/module/bundler/css-processor/rn.d.ts +10 -0
  80. package/dist/module/bundler/css-processor/rn.js +400 -0
  81. package/dist/module/bundler/css-processor/serialize.d.ts +2 -0
  82. package/dist/module/bundler/css-processor/serialize.js +101 -0
  83. package/dist/module/bundler/css-processor/types.d.ts +28 -0
  84. package/dist/module/bundler/css-processor/types.js +0 -0
  85. package/dist/module/bundler/css-processor/units.d.ts +10 -0
  86. package/dist/module/bundler/css-processor/units.js +48 -0
  87. package/dist/module/bundler/css-processor/utils.d.ts +24 -0
  88. package/dist/{shared/uniwind.PtWWxxnh.mjs → module/bundler/css-processor/utils.js} +11 -15
  89. package/dist/module/bundler/css-processor/var.d.ts +7 -0
  90. package/dist/module/bundler/css-processor/var.js +13 -0
  91. package/dist/module/{css-visitor → bundler/css-visitor}/function-visitor.d.ts +1 -1
  92. package/dist/module/{css-visitor → bundler/css-visitor}/rule-visitor.d.ts +4 -3
  93. package/dist/module/{css-visitor → bundler/css-visitor}/rule-visitor.js +5 -5
  94. package/dist/module/{css-visitor → bundler/css-visitor}/visitor.d.ts +3 -3
  95. package/dist/module/{css-visitor → bundler/css-visitor}/visitor.js +5 -6
  96. package/dist/module/bundler/logger.d.ts +11 -0
  97. package/dist/module/bundler/logger.js +34 -0
  98. package/dist/module/bundler/types.d.ts +15 -0
  99. package/dist/module/bundler/types.js +0 -0
  100. package/dist/module/common/consts.d.ts +21 -0
  101. package/dist/module/common/consts.js +24 -0
  102. package/dist/module/components/ScopedTheme/ScopedTheme.native.d.ts +1 -1
  103. package/dist/module/components/native/Pressable.d.ts +1 -1
  104. package/dist/module/components/native/TouchableHighlight.d.ts +1 -1
  105. package/dist/module/components/native/TouchableOpacity.d.ts +1 -1
  106. package/dist/module/components/native/useAccentColor.d.ts +1 -1
  107. package/dist/module/components/native/useStyle.d.ts +2 -2
  108. package/dist/module/components/react-native-gesture-handler/native/BaseButton.d.ts +1 -1
  109. package/dist/module/components/react-native-gesture-handler/native/BorderlessButton.d.ts +1 -1
  110. package/dist/module/components/react-native-gesture-handler/native/DrawerLayoutAndroid.d.ts +1 -1
  111. package/dist/module/components/react-native-gesture-handler/native/FlatList.d.ts +1 -1
  112. package/dist/module/components/react-native-gesture-handler/native/Pressable.d.ts +1 -1
  113. package/dist/module/components/react-native-gesture-handler/native/PureNativeButton.d.ts +1 -1
  114. package/dist/module/components/react-native-gesture-handler/native/RawButton.d.ts +1 -1
  115. package/dist/module/components/react-native-gesture-handler/native/RectButton.d.ts +1 -1
  116. package/dist/module/components/react-native-gesture-handler/native/RefreshControl.d.ts +1 -1
  117. package/dist/module/components/react-native-gesture-handler/native/ScrollView.d.ts +1 -1
  118. package/dist/module/components/react-native-gesture-handler/native/Switch.d.ts +1 -1
  119. package/dist/module/components/react-native-gesture-handler/native/TextInput.d.ts +1 -1
  120. package/dist/module/components/web/Pressable.d.ts +1 -1
  121. package/dist/module/components/web/TouchableHighlight.d.ts +1 -1
  122. package/dist/module/components/web/TouchableOpacity.d.ts +1 -1
  123. package/dist/module/components/web/rnw.js +1 -1
  124. package/dist/module/core/config/config.common.d.ts +6 -7
  125. package/dist/module/core/config/config.common.js +2 -2
  126. package/dist/module/core/config/config.d.ts +1 -1
  127. package/dist/module/core/config/config.js +1 -1
  128. package/dist/module/core/config/config.native.d.ts +2 -2
  129. package/dist/module/core/config/config.native.js +1 -1
  130. package/dist/module/core/listener.d.ts +1 -1
  131. package/dist/module/core/listener.js +1 -1
  132. package/dist/module/core/native/runtime.js +5 -1
  133. package/dist/module/core/native/store.d.ts +2 -2
  134. package/dist/module/core/native/store.js +1 -2
  135. package/dist/module/core/types.d.ts +6 -3
  136. package/dist/module/core/web/cssListener.js +1 -1
  137. package/dist/module/core/web/getWebStyles.d.ts +1 -1
  138. package/dist/module/hoc/types.d.ts +2 -2
  139. package/dist/module/hoc/withUniwind.d.ts +1 -1
  140. package/dist/module/hoc/withUniwind.js +5 -5
  141. package/dist/module/hoc/withUniwind.native.d.ts +1 -1
  142. package/dist/module/hoc/withUniwind.native.js +5 -5
  143. package/dist/module/hooks/useCSSVariable/getVariableValue.native.d.ts +1 -1
  144. package/dist/module/hooks/useCSSVariable/useCSSVariable.d.ts +1 -1
  145. package/dist/module/hooks/useCSSVariable/useCSSVariable.js +5 -1
  146. package/dist/module/hooks/useResolveClassNames.d.ts +1 -1
  147. package/dist/module/hooks/useUniwind.d.ts +1 -1
  148. package/dist/module/hooks/useUniwind.js +1 -1
  149. package/dist/module/index.d.ts +1 -2
  150. package/dist/shared/{uniwind.r2i22V6d.cjs → uniwind.CFiAZ3D-.cjs} +307 -217
  151. package/dist/shared/{uniwind.BGiqYvxb.mjs → uniwind.u-s1XVU8.mjs} +299 -214
  152. package/dist/vite/index.cjs +12 -22
  153. package/dist/vite/index.mjs +9 -19
  154. package/package.json +1 -1
  155. package/src/{metro → bundler/adapters/metro}/index.d.ts +2 -0
  156. package/src/bundler/adapters/metro/index.ts +1 -0
  157. package/src/{metro/withUniwindConfig.ts → bundler/adapters/metro/metro.ts} +7 -22
  158. package/src/{metro/metro-css-patches.ts → bundler/adapters/metro/patches.ts} +2 -1
  159. package/src/{metro → bundler/adapters/metro}/resolvers.ts +8 -8
  160. package/src/bundler/adapters/metro/transformer.ts +85 -0
  161. package/src/{vite → bundler/adapters/vite}/vite.ts +10 -28
  162. package/src/{css → bundler/artifacts/css}/extraUtilities.ts +1 -1
  163. package/src/{css → bundler/artifacts/css}/index.ts +1 -5
  164. package/src/{css → bundler/artifacts/css}/themes.ts +1 -1
  165. package/src/{utils/buildDtsFile.ts → bundler/artifacts/dts.ts} +3 -4
  166. package/src/bundler/config.ts +84 -0
  167. package/src/bundler/css-compiler/compileCSS.ts +15 -0
  168. package/src/bundler/css-compiler/compileNativeCSS.ts +41 -0
  169. package/src/bundler/css-compiler/compileTailwind.ts +25 -0
  170. package/src/bundler/css-compiler/compileWebCSS.ts +10 -0
  171. package/src/bundler/css-compiler/index.ts +1 -0
  172. package/src/{metro → bundler/css-processor}/addMetaToStylesTemplate.ts +33 -14
  173. package/src/{metro/processor → bundler/css-processor}/animation.ts +4 -4
  174. package/src/{metro/processor → bundler/css-processor}/color.ts +4 -3
  175. package/src/{metro/processor → bundler/css-processor}/css.ts +17 -9
  176. package/src/{metro/processor → bundler/css-processor}/functions.ts +2 -2
  177. package/src/bundler/css-processor/index.ts +3 -0
  178. package/src/{metro/processor → bundler/css-processor}/mq.ts +4 -4
  179. package/src/{metro/processor → bundler/css-processor}/processor.ts +13 -11
  180. package/src/{metro/processor → bundler/css-processor}/rn.ts +96 -3
  181. package/src/{metro/utils → bundler/css-processor}/serialize.ts +2 -2
  182. package/src/{metro → bundler/css-processor}/types.ts +3 -17
  183. package/src/{metro/processor → bundler/css-processor}/units.ts +1 -1
  184. package/src/{metro/processor → bundler/css-processor}/var.ts +1 -1
  185. package/src/{css-visitor → bundler/css-visitor}/function-visitor.ts +1 -1
  186. package/src/{css-visitor → bundler/css-visitor}/rule-visitor.ts +6 -5
  187. package/src/{css-visitor → bundler/css-visitor}/visitor.ts +4 -3
  188. package/src/bundler/types.ts +17 -0
  189. package/src/common/consts.ts +25 -0
  190. package/src/components/ScopedTheme/ScopedTheme.native.tsx +1 -1
  191. package/src/components/native/ActivityIndicator.tsx +2 -1
  192. package/src/components/native/Button.tsx +2 -1
  193. package/src/components/native/FlatList.tsx +2 -1
  194. package/src/components/native/Image.tsx +2 -1
  195. package/src/components/native/ImageBackground.tsx +2 -1
  196. package/src/components/native/InputAccessoryView.tsx +3 -2
  197. package/src/components/native/KeyboardAvoidingView.tsx +2 -1
  198. package/src/components/native/Modal.tsx +2 -1
  199. package/src/components/native/Pressable.tsx +1 -1
  200. package/src/components/native/RefreshControl.tsx +2 -1
  201. package/src/components/native/SafeAreaView.tsx +2 -1
  202. package/src/components/native/ScrollView.tsx +2 -1
  203. package/src/components/native/SectionList.tsx +2 -1
  204. package/src/components/native/Switch.tsx +3 -2
  205. package/src/components/native/Text.tsx +3 -2
  206. package/src/components/native/TextInput.tsx +3 -2
  207. package/src/components/native/TouchableHighlight.tsx +3 -2
  208. package/src/components/native/TouchableNativeFeedback.tsx +3 -2
  209. package/src/components/native/TouchableOpacity.tsx +3 -2
  210. package/src/components/native/TouchableWithoutFeedback.tsx +3 -2
  211. package/src/components/native/View.tsx +2 -1
  212. package/src/components/native/VirtualizedList.tsx +2 -1
  213. package/src/components/native/useAccentColor.ts +1 -1
  214. package/src/components/native/useStyle.ts +2 -2
  215. package/src/components/react-native-gesture-handler/native/BaseButton.tsx +1 -1
  216. package/src/components/react-native-gesture-handler/native/BorderlessButton.tsx +1 -1
  217. package/src/components/react-native-gesture-handler/native/DrawerLayoutAndroid.tsx +1 -1
  218. package/src/components/react-native-gesture-handler/native/FlatList.tsx +1 -1
  219. package/src/components/react-native-gesture-handler/native/GestureHandlerRootView.tsx +1 -1
  220. package/src/components/react-native-gesture-handler/native/Pressable.tsx +1 -1
  221. package/src/components/react-native-gesture-handler/native/PureNativeButton.tsx +1 -1
  222. package/src/components/react-native-gesture-handler/native/RawButton.tsx +1 -1
  223. package/src/components/react-native-gesture-handler/native/RectButton.tsx +1 -1
  224. package/src/components/react-native-gesture-handler/native/RefreshControl.tsx +1 -1
  225. package/src/components/react-native-gesture-handler/native/ScrollView.tsx +1 -1
  226. package/src/components/react-native-gesture-handler/native/Switch.tsx +2 -2
  227. package/src/components/react-native-gesture-handler/native/Text.tsx +2 -2
  228. package/src/components/react-native-gesture-handler/native/TextInput.tsx +2 -2
  229. package/src/components/react-native-gesture-handler/native/TouchableNativeFeedback.tsx +2 -2
  230. package/src/components/react-native-gesture-handler/native/TouchableOpacity.tsx +2 -2
  231. package/src/components/react-native-gesture-handler/native/TouchableWithoutFeedback.tsx +2 -2
  232. package/src/components/web/ActivityIndicator.tsx +2 -1
  233. package/src/components/web/Button.tsx +2 -1
  234. package/src/components/web/FlatList.tsx +2 -1
  235. package/src/components/web/Image.tsx +2 -1
  236. package/src/components/web/ImageBackground.tsx +2 -1
  237. package/src/components/web/KeyboardAvoidingView.tsx +2 -1
  238. package/src/components/web/Modal.tsx +2 -1
  239. package/src/components/web/Pressable.tsx +2 -1
  240. package/src/components/web/RefreshControl.tsx +2 -1
  241. package/src/components/web/SafeAreaView.tsx +2 -1
  242. package/src/components/web/ScrollView.tsx +2 -1
  243. package/src/components/web/SectionList.tsx +2 -1
  244. package/src/components/web/Switch.tsx +2 -1
  245. package/src/components/web/Text.tsx +2 -1
  246. package/src/components/web/TextInput.tsx +2 -1
  247. package/src/components/web/TouchableHighlight.tsx +2 -1
  248. package/src/components/web/TouchableOpacity.tsx +2 -1
  249. package/src/components/web/TouchableWithoutFeedback.tsx +2 -1
  250. package/src/components/web/View.tsx +2 -1
  251. package/src/components/web/VirtualizedList.tsx +2 -1
  252. package/src/components/web/rnw.ts +1 -1
  253. package/src/core/config/config.common.ts +11 -9
  254. package/src/core/config/config.native.ts +3 -3
  255. package/src/core/config/config.ts +2 -2
  256. package/src/core/listener.ts +1 -1
  257. package/src/core/native/runtime.ts +7 -2
  258. package/src/core/native/store.ts +3 -4
  259. package/src/core/types.ts +6 -3
  260. package/src/core/web/cssListener.ts +1 -1
  261. package/src/core/web/getWebStyles.ts +1 -1
  262. package/src/hoc/types.ts +2 -2
  263. package/src/hoc/withUniwind.native.tsx +4 -3
  264. package/src/hoc/withUniwind.tsx +3 -2
  265. package/src/hooks/useCSSVariable/getVariableValue.native.ts +1 -1
  266. package/src/hooks/useCSSVariable/useCSSVariable.ts +8 -2
  267. package/src/hooks/useResolveClassNames.ts +1 -1
  268. package/src/hooks/useUniwind.ts +2 -2
  269. package/src/index.ts +1 -2
  270. package/dist/common/types.js +0 -28
  271. package/dist/common/utils/stringifyThemes.js +0 -8
  272. package/dist/common/vite/vite.js +0 -95
  273. package/dist/module/types.d.ts +0 -21
  274. package/dist/module/types.js +0 -22
  275. package/dist/module/utils/stringifyThemes.d.ts +0 -1
  276. package/dist/module/utils/stringifyThemes.js +0 -1
  277. package/dist/module/vite/index.d.ts +0 -9
  278. package/dist/module/vite/index.js +0 -1
  279. package/dist/module/vite/vite.d.ts +0 -8
  280. package/dist/module/vite/vite.js +0 -98
  281. package/dist/shared/uniwind.B5q8hBGv.cjs +0 -18
  282. package/dist/shared/uniwind.Cv73KtI-.cjs +0 -86
  283. package/dist/shared/uniwind.JSWK3vHl.mjs +0 -14
  284. package/src/metro/compileVirtual.ts +0 -85
  285. package/src/metro/index.ts +0 -1
  286. package/src/metro/injectThemes.ts +0 -23
  287. package/src/metro/metro-transformer.ts +0 -116
  288. package/src/metro/processor/index.ts +0 -1
  289. package/src/metro/utils/index.ts +0 -2
  290. package/src/types.ts +0 -23
  291. package/src/utils/stringifyThemes.ts +0 -1
  292. package/src/vite/index.d.ts +0 -9
  293. /package/dist/common/{css → bundler/artifacts/css}/extraUtilities.js +0 -0
  294. /package/dist/common/{css → bundler/artifacts/css}/insets.js +0 -0
  295. /package/dist/common/{css → bundler/artifacts/css}/overwrite.js +0 -0
  296. /package/dist/common/{css → bundler/artifacts/css}/variants.js +0 -0
  297. /package/dist/common/{css-visitor → bundler/css-visitor}/function-visitor.js +0 -0
  298. /package/dist/common/{css-visitor → bundler/css-visitor}/index.js +0 -0
  299. /package/dist/module/{css → bundler/artifacts/css}/extraUtilities.d.ts +0 -0
  300. /package/dist/module/{css → bundler/artifacts/css}/extraUtilities.js +0 -0
  301. /package/dist/module/{css → bundler/artifacts/css}/insets.d.ts +0 -0
  302. /package/dist/module/{css → bundler/artifacts/css}/insets.js +0 -0
  303. /package/dist/module/{css → bundler/artifacts/css}/overwrite.d.ts +0 -0
  304. /package/dist/module/{css → bundler/artifacts/css}/overwrite.js +0 -0
  305. /package/dist/module/{css → bundler/artifacts/css}/themes.d.ts +0 -0
  306. /package/dist/module/{css → bundler/artifacts/css}/variants.d.ts +0 -0
  307. /package/dist/module/{css → bundler/artifacts/css}/variants.js +0 -0
  308. /package/dist/module/{utils/buildDtsFile.d.ts → bundler/artifacts/dts.d.ts} +0 -0
  309. /package/dist/module/{css-visitor → bundler/css-visitor}/function-visitor.js +0 -0
  310. /package/dist/module/{css-visitor → bundler/css-visitor}/index.d.ts +0 -0
  311. /package/dist/module/{css-visitor → bundler/css-visitor}/index.js +0 -0
  312. /package/{dist/common → src/bundler/adapters}/vite/index.d.ts +0 -0
  313. /package/src/{vite → bundler/adapters/vite}/index.ts +0 -0
  314. /package/src/{css → bundler/artifacts/css}/insets.ts +0 -0
  315. /package/src/{css → bundler/artifacts/css}/overwrite.ts +0 -0
  316. /package/src/{css → bundler/artifacts/css}/variants.ts +0 -0
  317. /package/src/{metro/utils/common.ts → bundler/css-processor/utils.ts} +0 -0
  318. /package/src/{css-visitor → bundler/css-visitor}/index.ts +0 -0
  319. /package/src/{metro → bundler}/logger.ts +0 -0
@@ -2,11 +2,13 @@ import type { MetroConfig } from 'metro-config'
2
2
 
3
3
  type Polyfills = {
4
4
  rem?: number
5
+ responsive?: 'text' | 'components' | boolean
5
6
  }
6
7
 
7
8
  type UniwindConfig = {
8
9
  cssEntryFile: string
9
10
  extraThemes?: Array<string>
11
+ extraComponents?: Record<string, string>
10
12
  dtsFile?: string
11
13
  polyfills?: Polyfills
12
14
  debug?: boolean
@@ -0,0 +1 @@
1
+ export * from './metro'
@@ -1,39 +1,24 @@
1
+ import { UniwindBundlerConfig } from '@/bundler/config'
2
+ import type { UniwindConfig } from '@/bundler/types'
3
+ import { Platform } from '@/common/consts'
1
4
  import type { MetroConfig } from 'metro-config'
2
- import { Platform } from '../common/consts'
3
- import { cacheStore, patchMetroGraphToSupportUncachedModules } from './metro-css-patches'
5
+ import { cacheStore, patchMetroGraphToSupportUncachedModules } from './patches'
4
6
  import { nativeResolver, webResolver } from './resolvers'
5
- import { UniwindConfig } from './types'
6
- import { uniq } from './utils'
7
7
 
8
8
  export const withUniwindConfig = <T extends MetroConfig>(
9
9
  config: T,
10
10
  uniwindConfig: UniwindConfig,
11
11
  ): T => {
12
- uniwindConfig.themes = uniq([
13
- 'light',
14
- 'dark',
15
- ...(uniwindConfig.extraThemes ?? []),
16
- ])
17
-
12
+ const bundlerConfig = UniwindBundlerConfig.fromMetroConfig(uniwindConfig)
18
13
  patchMetroGraphToSupportUncachedModules()
19
14
 
20
- if (typeof uniwindConfig === 'undefined') {
21
- throw new Error('Uniwind: You need to pass second parameter to withUniwindConfig')
22
- }
23
-
24
- if (typeof uniwindConfig.cssEntryFile === 'undefined') {
25
- throw new Error(
26
- 'Uniwind: You need to pass css css entry file to withUniwindConfig, e.g. withUniwindConfig(config, { cssEntryFile: "./global.css" })',
27
- )
28
- }
29
-
30
15
  return {
31
16
  ...config,
32
17
  cacheStores: [cacheStore],
33
- transformerPath: require.resolve('./metro-transformer.cjs'),
18
+ transformerPath: require.resolve('./transformer.cjs'),
34
19
  transformer: {
35
20
  ...config.transformer,
36
- uniwind: uniwindConfig,
21
+ uniwind: bundlerConfig.toMetroConfig(),
37
22
  },
38
23
  resolver: {
39
24
  ...config.resolver,
@@ -1,5 +1,6 @@
1
1
  import type { Graph, Result as GraphResult } from '@expo/metro/metro/DeltaBundler/Graph'
2
2
  import FileStoreBase from 'metro-cache/private/stores/FileStore'
3
+ import type * as MetroGraphModule from 'metro/private/DeltaBundler/Graph'
3
4
  import type { Options as GraphOptions } from 'metro/private/DeltaBundler/types'
4
5
  import os from 'os'
5
6
  import path from 'path'
@@ -24,7 +25,7 @@ interface TraverseDependencies {
24
25
  }
25
26
 
26
27
  export const patchMetroGraphToSupportUncachedModules = () => {
27
- const { Graph } = require('metro/private/DeltaBundler/Graph') as typeof import('metro/private/DeltaBundler/Graph')
28
+ const { Graph } = require('metro/private/DeltaBundler/Graph') as typeof MetroGraphModule
28
29
 
29
30
  // oxlint-disable-next-line @typescript-eslint/unbound-method
30
31
  const original_traverseDependencies = Graph.prototype.traverseDependencies as unknown as TraverseDependencies
@@ -1,6 +1,6 @@
1
- import { CustomResolutionContext, CustomResolver } from 'metro-resolver'
1
+ import type { CustomResolutionContext, CustomResolver } from 'metro-resolver'
2
2
  import { basename, dirname, sep } from 'node:path'
3
- import { name } from '../../package.json'
3
+ import { name as UNIWIND_PACKAGE_NAME } from '../../../../package.json'
4
4
 
5
5
  type ResolverConfig = {
6
6
  platform: string | null
@@ -48,7 +48,7 @@ export const nativeResolver = (extraComponents: Record<string, string>) =>
48
48
 
49
49
  if (cachedInternalBasePath === null) {
50
50
  try {
51
- cachedInternalBasePath = dirname(require.resolve(`${name}/package.json`))
51
+ cachedInternalBasePath = dirname(require.resolve(`${UNIWIND_PACKAGE_NAME}/package.json`))
52
52
  } catch {
53
53
  cachedInternalBasePath = ''
54
54
  }
@@ -69,11 +69,11 @@ export const nativeResolver = (extraComponents: Record<string, string>) =>
69
69
  }
70
70
 
71
71
  if (moduleName === 'react-native') {
72
- return resolver(context, `${name}/components`, platform)
72
+ return resolver(context, `${UNIWIND_PACKAGE_NAME}/components`, platform)
73
73
  }
74
74
 
75
75
  if (moduleName === 'react-native-gesture-handler') {
76
- return resolver(context, `${name}/components/react-native-gesture-handler`, platform)
76
+ return resolver(context, `${UNIWIND_PACKAGE_NAME}/components/react-native-gesture-handler`, platform)
77
77
  }
78
78
 
79
79
  if (
@@ -83,7 +83,7 @@ export const nativeResolver = (extraComponents: Record<string, string>) =>
83
83
  const module = filename.split('.').at(0)
84
84
 
85
85
  if (module !== undefined && SUPPORTED_COMPONENTS.includes(module)) {
86
- return resolver(context, `${name}/components/${module}`, platform)
86
+ return resolver(context, `${UNIWIND_PACKAGE_NAME}/components/${module}`, platform)
87
87
  }
88
88
  }
89
89
 
@@ -106,7 +106,7 @@ export const webResolver = (extraComponents: Record<string, string>) =>
106
106
 
107
107
  if (cachedInternalBasePath === null) {
108
108
  try {
109
- cachedInternalBasePath = dirname(require.resolve(`${name}/package.json`))
109
+ cachedInternalBasePath = dirname(require.resolve(`${UNIWIND_PACKAGE_NAME}/package.json`))
110
110
  } catch {
111
111
  cachedInternalBasePath = ''
112
112
  }
@@ -139,5 +139,5 @@ export const webResolver = (extraComponents: Record<string, string>) =>
139
139
  return resolution
140
140
  }
141
141
 
142
- return resolver(context, `${name}/components/${module}`, platform)
142
+ return resolver(context, `${UNIWIND_PACKAGE_NAME}/components/${module}`, platform)
143
143
  }
@@ -0,0 +1,85 @@
1
+ import { UniwindBundlerConfig } from '@/bundler/config'
2
+ import { compileCSS } from '@/bundler/css-compiler'
3
+ import type { UniwindMetroConfig } from '@/bundler/types'
4
+ import { Platform } from '@/common/consts'
5
+ import type * as ExpoMetroConfig from '@expo/metro-config'
6
+ import type * as MetroTransformWorker from 'metro-transform-worker'
7
+ import type { JsTransformerConfig, JsTransformOptions } from 'metro-transform-worker'
8
+ import path from 'path'
9
+ import { name as UNIWIND_PACKAGE_NAME } from '../../../../package.json'
10
+
11
+ const cssArtifactPath = path.resolve(__dirname, '../../uniwind.css')
12
+
13
+ let worker: typeof MetroTransformWorker
14
+
15
+ try {
16
+ try {
17
+ const { unstable_transformerPath } = require('@expo/metro-config') as typeof ExpoMetroConfig
18
+
19
+ worker = require(unstable_transformerPath)
20
+ } catch {
21
+ worker = require('@expo/metro-config/build/transform-worker/transform-worker.js')
22
+ }
23
+ } catch {
24
+ worker = require('metro-transform-worker')
25
+ }
26
+
27
+ export const transform = async (
28
+ config: JsTransformerConfig & {
29
+ uniwind: UniwindMetroConfig
30
+ },
31
+ projectRoot: string,
32
+ filePath: string,
33
+ data: Buffer,
34
+ options: JsTransformOptions,
35
+ ) => {
36
+ const isCss = options.type !== 'asset' && path.join(process.cwd(), config.uniwind.cssEntryFile) === path.join(projectRoot, filePath)
37
+
38
+ if (filePath.endsWith('/components/web/metro-injected.js')) {
39
+ const bundlerConfig = UniwindBundlerConfig.fromMetroConfig(config.uniwind, Platform.Web)
40
+
41
+ data = Buffer.from(
42
+ [
43
+ `import { Uniwind } from '${UNIWIND_PACKAGE_NAME}';`,
44
+ `Uniwind.__reinit(() => ({}), ${bundlerConfig.stringifiedThemes});`,
45
+ ].join(''),
46
+ 'utf-8',
47
+ )
48
+ }
49
+
50
+ if (!isCss) {
51
+ return worker.transform(config, projectRoot, filePath, data, options)
52
+ }
53
+
54
+ const bundlerConfig = UniwindBundlerConfig.fromMetroConfig(config.uniwind, options.platform)
55
+ await bundlerConfig.generateArtifacts(cssArtifactPath)
56
+ const virtualCode = await compileCSS(bundlerConfig)
57
+ const isWeb = bundlerConfig.platform === Platform.Web
58
+
59
+ data = Buffer.from(
60
+ isWeb
61
+ ? virtualCode
62
+ : [
63
+ `const { Uniwind } = require('${UNIWIND_PACKAGE_NAME}');`,
64
+ `Uniwind.__reinit(rt => ${virtualCode}, ${bundlerConfig.stringifiedThemes});`,
65
+ ].join(''),
66
+ 'utf-8',
67
+ )
68
+
69
+ const transform: any = await worker.transform(
70
+ config,
71
+ projectRoot,
72
+ `${filePath}${isWeb ? '' : '.js'}`,
73
+ data,
74
+ options,
75
+ )
76
+
77
+ transform.output[0].data.css ??= {}
78
+ transform.output[0].data.css.skipCache = true
79
+
80
+ if (!isWeb) {
81
+ transform.output[0].data.css.code = ''
82
+ }
83
+
84
+ return transform
85
+ }
@@ -1,18 +1,10 @@
1
1
  import { normalizePath } from '@tailwindcss/node'
2
2
  import path from 'path'
3
3
  import type { Plugin } from 'vite'
4
- import { name as UNIWIND_PACKAGE_NAME } from '../../package.json'
5
- import { buildCSS } from '../css'
6
- import { UniwindCSSVisitor } from '../css-visitor'
7
- import { uniq } from '../metro/utils'
8
- import { buildDtsFile } from '../utils/buildDtsFile'
9
- import { stringifyThemes } from '../utils/stringifyThemes'
4
+ import { name as UNIWIND_PACKAGE_NAME } from '../../../../package.json'
10
5
 
11
- type UniwindConfig = {
12
- cssEntryFile: string
13
- extraThemes?: Array<string>
14
- dtsFile?: string
15
- }
6
+ import { UniwindBundlerConfig } from '@/bundler/config'
7
+ import type { UniwindConfig } from '@/bundler/types'
16
8
 
17
9
  const dirname = typeof __dirname !== 'undefined' ? __dirname : import.meta.dirname
18
10
  const componentPath = path.resolve(
@@ -23,18 +15,10 @@ const styleSheetPath = path.resolve(
23
15
  dirname,
24
16
  '../module/components/web/createOrderedCSSStyleSheet.js',
25
17
  )
18
+ const cssArtifactPath = path.resolve(dirname, '../../uniwind.css')
26
19
 
27
- export const uniwind = ({
28
- cssEntryFile,
29
- extraThemes,
30
- dtsFile = 'uniwind-types.d.ts',
31
- }: UniwindConfig): Plugin => {
32
- const themes = uniq([
33
- 'light',
34
- 'dark',
35
- ...(extraThemes ?? []),
36
- ])
37
- const stringifiedThemes = stringifyThemes(themes)
20
+ export const uniwind = (config: UniwindConfig): Plugin => {
21
+ const bundlerConfig = UniwindBundlerConfig.fromViteConfig(config)
38
22
 
39
23
  return {
40
24
  name: 'uniwind',
@@ -52,7 +36,7 @@ export const uniwind = ({
52
36
  css: {
53
37
  transformer: 'lightningcss',
54
38
  lightningcss: {
55
- visitor: new UniwindCSSVisitor(themes),
39
+ visitor: bundlerConfig.cssVisitor,
56
40
  },
57
41
  },
58
42
  optimizeDeps: {
@@ -97,17 +81,15 @@ export const uniwind = ({
97
81
 
98
82
  if (normalizedId.includes(`${UNIWIND_PACKAGE_NAME}/dist`) && normalizedId.includes('config/config.js')) {
99
83
  return {
100
- code: `${code}Uniwind.__reinit(() => ({}), ${stringifiedThemes})`,
84
+ code: `${code}\n;Uniwind.__reinit(() => ({}), ${bundlerConfig.stringifiedThemes})`,
101
85
  }
102
86
  }
103
87
  },
104
88
  buildStart: async () => {
105
- await buildCSS(themes, cssEntryFile)
106
- buildDtsFile(dtsFile, stringifiedThemes)
89
+ await bundlerConfig.generateArtifacts(cssArtifactPath)
107
90
  },
108
91
  generateBundle: async () => {
109
- await buildCSS(themes, cssEntryFile)
110
- buildDtsFile(dtsFile, stringifiedThemes)
92
+ await bundlerConfig.generateArtifacts(cssArtifactPath)
111
93
  },
112
94
  }
113
95
  }
@@ -1,4 +1,4 @@
1
- import { RNStyle } from '../core/types'
1
+ import type { RNStyle } from '../../../core/types'
2
2
 
3
3
  const toKebabCase = (str: string) => str.replace(/[A-Z]/g, letter => `-${letter.toLowerCase()}`)
4
4
 
@@ -1,16 +1,12 @@
1
1
  import fs from 'fs'
2
- import path from 'path'
3
2
  import { EXTRA_UTILITIES_CSS } from './extraUtilities'
4
3
  import { INSETS_CSS } from './insets'
5
4
  import { OVERWRITE_CSS } from './overwrite'
6
5
  import { generateCSSForThemes } from './themes'
7
6
  import { VARIANTS_CSS } from './variants'
8
7
 
9
- const dirname = typeof __dirname !== 'undefined' ? __dirname : import.meta.dirname
10
-
11
- export const buildCSS = async (themes: Array<string>, input: string) => {
8
+ export const buildCSS = async (themes: Array<string>, input: string, cssFilePath: string) => {
12
9
  const themesCSS = await generateCSSForThemes(themes, input)
13
- const cssFilePath = path.join(dirname, '../../uniwind.css')
14
10
  const oldCSSFile = fs.existsSync(cssFilePath)
15
11
  ? fs.readFileSync(cssFilePath, 'utf-8')
16
12
  : ''
@@ -1,8 +1,8 @@
1
+ import { Logger } from '@/bundler/logger'
1
2
  import { compile } from '@tailwindcss/node'
2
3
  import fs from 'fs'
3
4
  import { transform } from 'lightningcss'
4
5
  import path from 'path'
5
- import { Logger } from '../metro/logger'
6
6
 
7
7
  const readFileSafe = (filePath: string) => {
8
8
  try {
@@ -1,15 +1,14 @@
1
1
  import fs from 'fs'
2
- import { name } from '../../package.json'
3
2
 
4
3
  export const buildDtsFile = (dtsPath: string, stringifiedThemes: string) => {
5
4
  const oldDtsContent = fs.existsSync(dtsPath)
6
5
  ? fs.readFileSync(dtsPath, 'utf-8')
7
6
  : ''
8
7
  const dtsContent = [
9
- `// NOTE: This file is generated by ${name} and it should not be edited manually.`,
10
- `/// <reference types="${name}/types" />`,
8
+ `// NOTE: This file is generated by uniwind and it should not be edited manually.`,
9
+ `/// <reference types="uniwind/types" />`,
11
10
  '',
12
- `declare module '${name}' {`,
11
+ `declare module 'uniwind' {`,
13
12
  ` export interface UniwindConfig {`,
14
13
  ` themes: readonly ${stringifiedThemes}`,
15
14
  ` }`,
@@ -0,0 +1,84 @@
1
+ import { buildCSS } from '@/bundler/artifacts/css'
2
+ import { buildDtsFile } from '@/bundler/artifacts/dts'
3
+ import { UniwindCSSVisitor } from '@/bundler/css-visitor'
4
+ import type { UniwindConfig, UniwindMetroConfig } from '@/bundler/types'
5
+ import { Platform } from '@/common/consts'
6
+ import { isDefined } from '@/common/utils'
7
+ import path from 'path'
8
+
9
+ export class UniwindBundlerConfig {
10
+ static fromMetroConfig(config: UniwindMetroConfig, platform?: string | null) {
11
+ const getPlatform = () => {
12
+ if (!isDefined(platform)) {
13
+ return Platform.Native
14
+ }
15
+
16
+ if (!config.isTV) {
17
+ return platform as Platform
18
+ }
19
+
20
+ if (platform === Platform.Android) {
21
+ return Platform.AndroidTV
22
+ }
23
+
24
+ if (platform === Platform.iOS) {
25
+ return Platform.AppleTV
26
+ }
27
+
28
+ throw new Error(`Platform ${platform} not supported`)
29
+ }
30
+
31
+ if (typeof config === 'undefined') {
32
+ throw new Error('Uniwind: You need to pass second parameter to withUniwindConfig')
33
+ }
34
+
35
+ if (typeof config.cssEntryFile === 'undefined') {
36
+ throw new Error(
37
+ 'Uniwind: You need to pass css css entry file to withUniwindConfig, e.g. withUniwindConfig(config, { cssEntryFile: "./global.css" })',
38
+ )
39
+ }
40
+
41
+ return new UniwindBundlerConfig(config, getPlatform())
42
+ }
43
+
44
+ static fromViteConfig(config: UniwindConfig) {
45
+ return new UniwindBundlerConfig(config, Platform.Web)
46
+ }
47
+
48
+ constructor(private readonly config: UniwindMetroConfig, readonly platform: Platform) {}
49
+
50
+ get cssPath() {
51
+ return path.join(process.cwd(), this.config.cssEntryFile)
52
+ }
53
+
54
+ get themes() {
55
+ return Array.from(
56
+ new Set([
57
+ 'light',
58
+ 'dark',
59
+ ...this.config.extraThemes ?? [],
60
+ ]),
61
+ )
62
+ }
63
+
64
+ get cssVisitor() {
65
+ return new UniwindCSSVisitor(this)
66
+ }
67
+
68
+ get polyfills() {
69
+ return this.config.polyfills
70
+ }
71
+
72
+ get stringifiedThemes() {
73
+ return `[${this.themes.map((theme) => `'${theme}'`).join(', ')}]`
74
+ }
75
+
76
+ toMetroConfig() {
77
+ return this.config
78
+ }
79
+
80
+ async generateArtifacts(cssArtifactPath: string) {
81
+ await buildCSS(this.themes, this.config.cssEntryFile, cssArtifactPath)
82
+ buildDtsFile(this.config.dtsFile ?? 'uniwind-types.d.ts', this.stringifiedThemes)
83
+ }
84
+ }
@@ -0,0 +1,15 @@
1
+ import { Platform } from '@/common/consts'
2
+ import type { UniwindBundlerConfig } from '../config'
3
+ import { compileNativeCSS } from './compileNativeCSS'
4
+ import { compileTailwind } from './compileTailwind'
5
+ import { compileWebCSS } from './compileWebCSS'
6
+
7
+ export const compileCSS = async (bundlerConfig: UniwindBundlerConfig) => {
8
+ const tailwindCSS = await compileTailwind(bundlerConfig)
9
+
10
+ if (bundlerConfig.platform === Platform.Web) {
11
+ return compileWebCSS(bundlerConfig, tailwindCSS)
12
+ }
13
+
14
+ return compileNativeCSS(bundlerConfig, tailwindCSS)
15
+ }
@@ -0,0 +1,41 @@
1
+ import type { UniwindBundlerConfig } from '../config'
2
+ import { addMetaToStylesTemplate, ProcessorBuilder, serializeJSObject } from '../css-processor'
3
+
4
+ export const compileNativeCSS = (bundlerConfig: UniwindBundlerConfig, tailwindCSS: string) => {
5
+ const Processor = new ProcessorBuilder(bundlerConfig)
6
+
7
+ Processor.transform(tailwindCSS)
8
+
9
+ const stylesheet = serializeJSObject(
10
+ addMetaToStylesTemplate(Processor, bundlerConfig.platform),
11
+ (key, value) => `"${key}": ${value}`,
12
+ )
13
+ const vars = serializeJSObject(
14
+ Processor.vars,
15
+ (key, value) => `get "${key}"() { return ${value} }`,
16
+ )
17
+ const keyframes = serializeJSObject(
18
+ Processor.keyframes,
19
+ (key, value) => `get "${key}"() { return ${value} }`,
20
+ )
21
+ const scopedVars = Object.fromEntries(
22
+ Object.entries(Processor.scopedVars)
23
+ .map(([scopedVarsName, scopedVars]) => [
24
+ scopedVarsName,
25
+ serializeJSObject(scopedVars, (key, value) => `get "${key}"() { return ${value} }`),
26
+ ]),
27
+ )
28
+ const serializedScopedVars = Object.entries(scopedVars)
29
+ .map(([scopedVarsName, scopedVars]) => `"${scopedVarsName}": ({ ${scopedVars} }),`)
30
+ .join('')
31
+ const currentColorVar = `get currentColor() { return rt.colorScheme === 'dark' ? '#ffffff' : '#000000' },`
32
+
33
+ return [
34
+ '({',
35
+ `scopedVars: ({ ${serializedScopedVars} }),`,
36
+ `vars: ({ ${currentColorVar} ${vars} }),`,
37
+ `stylesheet: ({ ${stylesheet} }),`,
38
+ `keyframes: ({ ${keyframes} }),`,
39
+ '})',
40
+ ].join('')
41
+ }
@@ -0,0 +1,25 @@
1
+ import { compile } from '@tailwindcss/node'
2
+ import { Scanner } from '@tailwindcss/oxide'
3
+ import fs from 'fs'
4
+ import path from 'path'
5
+ import type { UniwindBundlerConfig } from '../config'
6
+
7
+ export const compileTailwind = async (bundlerConfig: UniwindBundlerConfig) => {
8
+ const css = await fs.promises.readFile(bundlerConfig.cssPath, 'utf-8')
9
+ const compiler = await compile(css, {
10
+ base: path.dirname(bundlerConfig.cssPath),
11
+ onDependency: () => void 0,
12
+ })
13
+ const scanner = new Scanner({
14
+ sources: [
15
+ ...compiler.sources,
16
+ {
17
+ negated: false,
18
+ pattern: '**/*',
19
+ base: path.dirname(bundlerConfig.cssPath),
20
+ },
21
+ ],
22
+ })
23
+
24
+ return compiler.build(scanner.scan())
25
+ }
@@ -0,0 +1,10 @@
1
+ import { transform } from 'lightningcss'
2
+ import type { UniwindBundlerConfig } from '../config'
3
+
4
+ export const compileWebCSS = (bundlerConfig: UniwindBundlerConfig, tailwindCSS: string) => {
5
+ return transform({
6
+ code: Buffer.from(tailwindCSS),
7
+ filename: 'uniwind.css',
8
+ visitor: bundlerConfig.cssVisitor,
9
+ }).code.toString()
10
+ }
@@ -0,0 +1 @@
1
+ export * from './compileCSS'
@@ -1,9 +1,9 @@
1
- import { Platform } from '../common/consts'
2
- import { isDefined } from '../common/utils'
3
- import { StyleDependency } from '../types'
4
- import { ProcessorBuilder } from './processor'
5
- import { StyleSheetTemplate } from './types'
6
- import { serialize, toCamelCase } from './utils'
1
+ import { Platform, StyleDependency } from '@/common/consts'
2
+ import { isDefined } from '@/common/utils'
3
+ import type { ProcessorBuilder } from './processor'
4
+ import { serialize } from './serialize'
5
+ import type { StyleSheetTemplate } from './types'
6
+ import { toCamelCase } from './utils'
7
7
 
8
8
  const extractVarsFromString = (value: string) => {
9
9
  const thisIndexes = [...value.matchAll(/this\[/g)].map(m => m.index)
@@ -29,6 +29,30 @@ const makeSafeForSerialization = (value: any) => {
29
29
  return value
30
30
  }
31
31
 
32
+ const hasThemedVarDependency = (varName: string, Processor: ProcessorBuilder, visited = new Set<string>()): boolean => {
33
+ if (visited.has(varName)) {
34
+ return false
35
+ }
36
+
37
+ visited.add(varName)
38
+
39
+ const isScopedVar = Object.values(Processor.scopedVars).some(scopedVars => varName in scopedVars)
40
+
41
+ if (isScopedVar) {
42
+ return true
43
+ }
44
+
45
+ const globalVarValue = Processor.vars[varName]
46
+
47
+ if (typeof globalVarValue !== 'string') {
48
+ return false
49
+ }
50
+
51
+ return extractVarsFromString(globalVarValue).some(usedVarName => {
52
+ return hasThemedVarDependency(usedVarName, Processor, visited)
53
+ })
54
+ }
55
+
32
56
  export const addMetaToStylesTemplate = (Processor: ProcessorBuilder, currentPlatform: Platform) => {
33
57
  const stylesheetsEntries = Object.entries(Processor.stylesheets as StyleSheetTemplate)
34
58
  .map(([className, stylesPerMediaQuery]) => {
@@ -70,13 +94,7 @@ export const addMetaToStylesTemplate = (Processor: ProcessorBuilder, currentPlat
70
94
  const dependencies: Array<StyleDependency> = []
71
95
  const stringifiedEntries = JSON.stringify(entries)
72
96
  const usedVars = extractVarsFromString(stringifiedEntries)
73
- const isUsingThemedVar = usedVars.some(usedVarName => {
74
- return Object.values(Processor.scopedVars).some(scopedVars => {
75
- const scopedVarsNames = Object.keys(scopedVars)
76
-
77
- return scopedVarsNames.includes(usedVarName)
78
- })
79
- })
97
+ const isUsingThemedVar = usedVars.some(usedVarName => hasThemedVarDependency(usedVarName, Processor))
80
98
 
81
99
  if (usedVars.length > 0) {
82
100
  dependencies.push(StyleDependency.Variables)
@@ -97,6 +115,7 @@ export const addMetaToStylesTemplate = (Processor: ProcessorBuilder, currentPlat
97
115
  if (
98
116
  Number(minWidth) !== 0
99
117
  || Number(maxWidth) !== Number.MAX_VALUE
118
+ || stringifiedEntries.includes('rt.makeResponsive')
100
119
  || stringifiedEntries.includes('rt.screen')
101
120
  ) {
102
121
  dependencies.push(StyleDependency.Dimensions)
@@ -126,7 +145,7 @@ export const addMetaToStylesTemplate = (Processor: ProcessorBuilder, currentPlat
126
145
  focus,
127
146
  disabled,
128
147
  importantProperties: importantProperties
129
- ?.map(property => property.startsWith('--') ? property : toCamelCase)
148
+ ?.map(property => property.startsWith('--') ? property : toCamelCase(property))
130
149
  .map(makeSafeForSerialization) ?? [],
131
150
  dataAttributes,
132
151
  complexity: [
@@ -1,11 +1,11 @@
1
1
  import type { TokenOrValue } from 'lightningcss'
2
- import type { DeclarationValues } from '../types'
3
- import { toCamelCase } from '../utils'
4
2
 
5
- import {
3
+ import type {
6
4
  CSSAnimationDelay,
7
5
  } from 'react-native-reanimated'
8
- import { ParametrizedTimingFunction } from 'react-native-reanimated/lib/typescript/css/easing'
6
+ import type { ParametrizedTimingFunction } from 'react-native-reanimated/lib/typescript/css/easing'
7
+ import type { DeclarationValues } from './types'
8
+ import { toCamelCase } from './utils'
9
9
 
10
10
  type GetProcessedValue = (value: DeclarationValues) => any
11
11
 
@@ -1,8 +1,9 @@
1
- import { Color as ColorType, converter, formatHex, formatHex8, parse } from 'culori'
2
- import { CssColor, UnresolvedColor } from 'lightningcss'
1
+ import type { Color as ColorType } from 'culori'
2
+ import { converter, formatHex, formatHex8, parse } from 'culori'
3
+ import type { CssColor, UnresolvedColor } from 'lightningcss'
3
4
  import { Logger } from '../logger'
4
- import { pipe } from '../utils'
5
5
  import type { ProcessorBuilder } from './processor'
6
+ import { pipe } from './utils'
6
7
 
7
8
  export class Color {
8
9
  private toRgb = converter('rgb')