react-native-unistyles 3.0.24 → 3.1.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 (491) hide show
  1. package/android/src/main/cxx/NativeUnistylesModule.cpp +7 -4
  2. package/android/src/main/cxx/NativeUnistylesModule.h +9 -3
  3. package/android/src/main/cxx/cpp-adapter.cpp +1 -1
  4. package/android/src/main/java/com/unistyles/NativePlatform+android.kt +22 -4
  5. package/android/src/main/java/com/unistyles/UnistylesModule.kt +1 -0
  6. package/cxx/core/StyleSheetRegistry.cpp +11 -11
  7. package/cxx/core/StyleSheetRegistry.h +4 -4
  8. package/cxx/core/UnistylesRegistry.cpp +27 -14
  9. package/cxx/core/UnistylesRegistry.h +4 -1
  10. package/cxx/hybridObjects/HybridShadowRegistry.cpp +5 -0
  11. package/cxx/hybridObjects/HybridStyleSheet.cpp +2 -14
  12. package/cxx/hybridObjects/HybridStyleSheet.h +0 -2
  13. package/ios/UnistylesModuleOnLoad.mm +10 -2
  14. package/lib/commonjs/components/AdaptiveTheme.js +1 -1
  15. package/lib/commonjs/components/AdaptiveTheme.js.map +1 -1
  16. package/lib/commonjs/components/ApplyScopedTheme.js.map +1 -1
  17. package/lib/commonjs/components/Display.js.map +1 -1
  18. package/lib/commonjs/components/Hide.js.map +1 -1
  19. package/lib/commonjs/components/NamedTheme.js +2 -2
  20. package/lib/commonjs/components/NamedTheme.js.map +1 -1
  21. package/lib/commonjs/components/ScopedTheme.js.map +1 -1
  22. package/lib/commonjs/components/native/ActivityIndicator.js.map +1 -1
  23. package/lib/commonjs/components/native/Animated.js.map +1 -1
  24. package/lib/commonjs/components/native/FlatList.js.map +1 -1
  25. package/lib/commonjs/components/native/Image.js.map +1 -1
  26. package/lib/commonjs/components/native/Image.native.js.map +1 -1
  27. package/lib/commonjs/components/native/ImageBackground.js.map +1 -1
  28. package/lib/commonjs/components/native/ImageBackground.native.js.map +1 -1
  29. package/lib/commonjs/components/native/KeyboardAvoidingView.js.map +1 -1
  30. package/lib/commonjs/components/native/NativeText.native.js.map +1 -1
  31. package/lib/commonjs/components/native/NativeView.native.js.map +1 -1
  32. package/lib/commonjs/components/native/Pressable.js.map +1 -1
  33. package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
  34. package/lib/commonjs/components/native/RefreshControl.js.map +1 -1
  35. package/lib/commonjs/components/native/SafeAreaView.js.map +1 -1
  36. package/lib/commonjs/components/native/ScrollView.js.map +1 -1
  37. package/lib/commonjs/components/native/SectionList.js.map +1 -1
  38. package/lib/commonjs/components/native/Switch.js.map +1 -1
  39. package/lib/commonjs/components/native/Text.js.map +1 -1
  40. package/lib/commonjs/components/native/TextInput.js.map +1 -1
  41. package/lib/commonjs/components/native/TouchableHighlight.js.map +1 -1
  42. package/lib/commonjs/components/native/TouchableOpacity.js.map +1 -1
  43. package/lib/commonjs/components/native/View.js.map +1 -1
  44. package/lib/commonjs/components/native/VirtualizedList.js.map +1 -1
  45. package/lib/commonjs/core/createUnistylesElement.js.map +1 -1
  46. package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -1
  47. package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
  48. package/lib/commonjs/core/getClassname.js.map +1 -1
  49. package/lib/commonjs/core/parseBoxShadow.js.map +1 -1
  50. package/lib/commonjs/core/useProxifiedUnistyles/listener.js.map +1 -1
  51. package/lib/commonjs/core/useProxifiedUnistyles/listener.native.js +0 -1
  52. package/lib/commonjs/core/useProxifiedUnistyles/listener.native.js.map +1 -1
  53. package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
  54. package/lib/commonjs/core/useUnistyles.js.map +1 -1
  55. package/lib/commonjs/core/warn.js.map +1 -1
  56. package/lib/commonjs/core/withUnistyles/withUnistyles.js +3 -1
  57. package/lib/commonjs/core/withUnistyles/withUnistyles.js.map +1 -1
  58. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +6 -0
  59. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
  60. package/lib/commonjs/hooks/useMedia.js.map +1 -1
  61. package/lib/commonjs/hooks/useMedia.native.js +0 -1
  62. package/lib/commonjs/hooks/useMedia.native.js.map +1 -1
  63. package/lib/commonjs/index.js +6 -0
  64. package/lib/commonjs/index.js.map +1 -1
  65. package/lib/commonjs/mocks.js +28 -8
  66. package/lib/commonjs/mocks.js.map +1 -1
  67. package/lib/commonjs/mq.js.map +1 -1
  68. package/lib/commonjs/reanimated/useAnimatedTheme.js.map +1 -1
  69. package/lib/commonjs/reanimated/useAnimatedTheme.native.js +0 -1
  70. package/lib/commonjs/reanimated/useAnimatedTheme.native.js.map +1 -1
  71. package/lib/commonjs/reanimated/variant/useAnimatedVariantColor.js.map +1 -1
  72. package/lib/commonjs/reanimated/variant/useUpdateVariantColor.js.map +1 -1
  73. package/lib/commonjs/reanimated/variant/useUpdateVariantColor.native.js +0 -1
  74. package/lib/commonjs/reanimated/variant/useUpdateVariantColor.native.js.map +1 -1
  75. package/lib/commonjs/server/getServerUnistyles.js.map +1 -1
  76. package/lib/commonjs/server/useServerUnistyles.js.map +1 -1
  77. package/lib/commonjs/specs/NativePlatform/NativePlatform.nitro.js.map +1 -1
  78. package/lib/commonjs/specs/ShadowRegistry/index.js +9 -5
  79. package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
  80. package/lib/commonjs/specs/StatusBar/index.js.map +1 -1
  81. package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
  82. package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -1
  83. package/lib/commonjs/specs/UnistylesRuntime/index.js.map +1 -1
  84. package/lib/commonjs/specs/index.native.js +1 -1
  85. package/lib/commonjs/specs/index.native.js.map +1 -1
  86. package/lib/commonjs/specs/types.js.map +1 -1
  87. package/lib/commonjs/types/index.js.map +1 -1
  88. package/lib/commonjs/types/stylesheet.js.map +1 -1
  89. package/lib/commonjs/utils.js.map +1 -1
  90. package/lib/commonjs/web/convert/index.js.map +1 -1
  91. package/lib/commonjs/web/convert/object/boxShadow.js.map +1 -1
  92. package/lib/commonjs/web/convert/object/filter.js.map +1 -1
  93. package/lib/commonjs/web/convert/object/objectStyle.js.map +1 -1
  94. package/lib/commonjs/web/convert/object/transform.js.map +1 -1
  95. package/lib/commonjs/web/convert/pseudo.js.map +1 -1
  96. package/lib/commonjs/web/convert/shadow/boxShadow.js.map +1 -1
  97. package/lib/commonjs/web/convert/shadow/getShadowBreakpoints.js.map +1 -1
  98. package/lib/commonjs/web/convert/shadow/textShadow.js.map +1 -1
  99. package/lib/commonjs/web/convert/types.js.map +1 -1
  100. package/lib/commonjs/web/convert/utils.js.map +1 -1
  101. package/lib/commonjs/web/create.js +1 -5
  102. package/lib/commonjs/web/create.js.map +1 -1
  103. package/lib/commonjs/web/css/core.js.map +1 -1
  104. package/lib/commonjs/web/css/state.js.map +1 -1
  105. package/lib/commonjs/web/css/utils.js.map +1 -1
  106. package/lib/commonjs/web/index.js +1 -0
  107. package/lib/commonjs/web/index.js.map +1 -1
  108. package/lib/commonjs/web/listener.js +29 -8
  109. package/lib/commonjs/web/listener.js.map +1 -1
  110. package/lib/commonjs/web/registry.js.map +1 -1
  111. package/lib/commonjs/web/runtime.js +1 -2
  112. package/lib/commonjs/web/runtime.js.map +1 -1
  113. package/lib/commonjs/web/shadowRegistry.js.map +1 -1
  114. package/lib/commonjs/web/state.js +3 -3
  115. package/lib/commonjs/web/state.js.map +1 -1
  116. package/lib/commonjs/web/utils/common.js.map +1 -1
  117. package/lib/commonjs/web/utils/createUnistylesRef.js.map +1 -1
  118. package/lib/commonjs/web/utils/unistyle.js +2 -0
  119. package/lib/commonjs/web/utils/unistyle.js.map +1 -1
  120. package/lib/commonjs/web/variants.js.map +1 -1
  121. package/lib/commonjs/web-only/getWebProps.js.map +1 -1
  122. package/lib/commonjs/web-only/index.js.map +1 -1
  123. package/lib/module/components/AdaptiveTheme.js +1 -1
  124. package/lib/module/components/AdaptiveTheme.js.map +1 -1
  125. package/lib/module/components/ApplyScopedTheme.js.map +1 -1
  126. package/lib/module/components/Display.js.map +1 -1
  127. package/lib/module/components/Hide.js.map +1 -1
  128. package/lib/module/components/NamedTheme.js +2 -2
  129. package/lib/module/components/NamedTheme.js.map +1 -1
  130. package/lib/module/components/ScopedTheme.js.map +1 -1
  131. package/lib/module/components/native/ActivityIndicator.js.map +1 -1
  132. package/lib/module/components/native/Animated.js.map +1 -1
  133. package/lib/module/components/native/FlatList.js.map +1 -1
  134. package/lib/module/components/native/Image.js.map +1 -1
  135. package/lib/module/components/native/Image.native.js.map +1 -1
  136. package/lib/module/components/native/ImageBackground.js.map +1 -1
  137. package/lib/module/components/native/ImageBackground.native.js.map +1 -1
  138. package/lib/module/components/native/KeyboardAvoidingView.js.map +1 -1
  139. package/lib/module/components/native/NativeText.native.js.map +1 -1
  140. package/lib/module/components/native/NativeView.native.js.map +1 -1
  141. package/lib/module/components/native/Pressable.js.map +1 -1
  142. package/lib/module/components/native/Pressable.native.js.map +1 -1
  143. package/lib/module/components/native/RefreshControl.js.map +1 -1
  144. package/lib/module/components/native/SafeAreaView.js.map +1 -1
  145. package/lib/module/components/native/ScrollView.js.map +1 -1
  146. package/lib/module/components/native/SectionList.js.map +1 -1
  147. package/lib/module/components/native/Switch.js.map +1 -1
  148. package/lib/module/components/native/Text.js.map +1 -1
  149. package/lib/module/components/native/TextInput.js.map +1 -1
  150. package/lib/module/components/native/TouchableHighlight.js.map +1 -1
  151. package/lib/module/components/native/TouchableOpacity.js.map +1 -1
  152. package/lib/module/components/native/View.js.map +1 -1
  153. package/lib/module/components/native/VirtualizedList.js.map +1 -1
  154. package/lib/module/core/createUnistylesElement.js.map +1 -1
  155. package/lib/module/core/createUnistylesElement.native.js.map +1 -1
  156. package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
  157. package/lib/module/core/getClassname.js.map +1 -1
  158. package/lib/module/core/parseBoxShadow.js.map +1 -1
  159. package/lib/module/core/useProxifiedUnistyles/listener.js.map +1 -1
  160. package/lib/module/core/useProxifiedUnistyles/listener.native.js +0 -1
  161. package/lib/module/core/useProxifiedUnistyles/listener.native.js.map +1 -1
  162. package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
  163. package/lib/module/core/useUnistyles.js.map +1 -1
  164. package/lib/module/core/warn.js.map +1 -1
  165. package/lib/module/core/withUnistyles/withUnistyles.js +3 -1
  166. package/lib/module/core/withUnistyles/withUnistyles.js.map +1 -1
  167. package/lib/module/core/withUnistyles/withUnistyles.native.js +6 -0
  168. package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
  169. package/lib/module/hooks/useMedia.js.map +1 -1
  170. package/lib/module/hooks/useMedia.native.js +0 -1
  171. package/lib/module/hooks/useMedia.native.js.map +1 -1
  172. package/lib/module/index.js +1 -0
  173. package/lib/module/index.js.map +1 -1
  174. package/lib/module/mocks.js +28 -8
  175. package/lib/module/mocks.js.map +1 -1
  176. package/lib/module/mq.js.map +1 -1
  177. package/lib/module/reanimated/useAnimatedTheme.js.map +1 -1
  178. package/lib/module/reanimated/useAnimatedTheme.native.js +0 -1
  179. package/lib/module/reanimated/useAnimatedTheme.native.js.map +1 -1
  180. package/lib/module/reanimated/variant/useAnimatedVariantColor.js.map +1 -1
  181. package/lib/module/reanimated/variant/useUpdateVariantColor.js.map +1 -1
  182. package/lib/module/reanimated/variant/useUpdateVariantColor.native.js +0 -1
  183. package/lib/module/reanimated/variant/useUpdateVariantColor.native.js.map +1 -1
  184. package/lib/module/server/getServerUnistyles.js.map +1 -1
  185. package/lib/module/server/useServerUnistyles.js.map +1 -1
  186. package/lib/module/specs/NativePlatform/NativePlatform.nitro.js.map +1 -1
  187. package/lib/module/specs/ShadowRegistry/index.js +9 -5
  188. package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
  189. package/lib/module/specs/StatusBar/index.js.map +1 -1
  190. package/lib/module/specs/StyleSheet/index.js.map +1 -1
  191. package/lib/module/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -1
  192. package/lib/module/specs/UnistylesRuntime/index.js.map +1 -1
  193. package/lib/module/specs/index.native.js +1 -1
  194. package/lib/module/specs/index.native.js.map +1 -1
  195. package/lib/module/specs/types.js.map +1 -1
  196. package/lib/module/types/index.js.map +1 -1
  197. package/lib/module/types/stylesheet.js.map +1 -1
  198. package/lib/module/utils.js.map +1 -1
  199. package/lib/module/web/convert/index.js.map +1 -1
  200. package/lib/module/web/convert/object/boxShadow.js.map +1 -1
  201. package/lib/module/web/convert/object/filter.js.map +1 -1
  202. package/lib/module/web/convert/object/objectStyle.js.map +1 -1
  203. package/lib/module/web/convert/object/transform.js.map +1 -1
  204. package/lib/module/web/convert/pseudo.js.map +1 -1
  205. package/lib/module/web/convert/shadow/boxShadow.js.map +1 -1
  206. package/lib/module/web/convert/shadow/getShadowBreakpoints.js.map +1 -1
  207. package/lib/module/web/convert/shadow/textShadow.js.map +1 -1
  208. package/lib/module/web/convert/types.js.map +1 -1
  209. package/lib/module/web/convert/utils.js.map +1 -1
  210. package/lib/module/web/create.js +2 -6
  211. package/lib/module/web/create.js.map +1 -1
  212. package/lib/module/web/css/core.js.map +1 -1
  213. package/lib/module/web/css/state.js.map +1 -1
  214. package/lib/module/web/css/utils.js.map +1 -1
  215. package/lib/module/web/index.js +1 -0
  216. package/lib/module/web/index.js.map +1 -1
  217. package/lib/module/web/listener.js +29 -8
  218. package/lib/module/web/listener.js.map +1 -1
  219. package/lib/module/web/registry.js.map +1 -1
  220. package/lib/module/web/runtime.js +1 -2
  221. package/lib/module/web/runtime.js.map +1 -1
  222. package/lib/module/web/shadowRegistry.js.map +1 -1
  223. package/lib/module/web/state.js +3 -3
  224. package/lib/module/web/state.js.map +1 -1
  225. package/lib/module/web/utils/common.js.map +1 -1
  226. package/lib/module/web/utils/createUnistylesRef.js.map +1 -1
  227. package/lib/module/web/utils/unistyle.js +2 -0
  228. package/lib/module/web/utils/unistyle.js.map +1 -1
  229. package/lib/module/web/variants.js.map +1 -1
  230. package/lib/module/web-only/getWebProps.js.map +1 -1
  231. package/lib/module/web-only/index.js.map +1 -1
  232. package/lib/typescript/src/__tests__/mocks.spec.d.ts +2 -0
  233. package/lib/typescript/src/__tests__/mocks.spec.d.ts.map +1 -0
  234. package/lib/typescript/src/__tests__/web-listener.spec.d.ts +2 -0
  235. package/lib/typescript/src/__tests__/web-listener.spec.d.ts.map +1 -0
  236. package/lib/typescript/src/components/AdaptiveTheme.d.ts +1 -1
  237. package/lib/typescript/src/components/AdaptiveTheme.d.ts.map +1 -1
  238. package/lib/typescript/src/components/ApplyScopedTheme.d.ts.map +1 -1
  239. package/lib/typescript/src/components/Display.d.ts.map +1 -1
  240. package/lib/typescript/src/components/Hide.d.ts.map +1 -1
  241. package/lib/typescript/src/components/NamedTheme.d.ts +1 -1
  242. package/lib/typescript/src/components/NamedTheme.d.ts.map +1 -1
  243. package/lib/typescript/src/components/ScopedTheme.d.ts.map +1 -1
  244. package/lib/typescript/src/components/native/ActivityIndicator.d.ts.map +1 -1
  245. package/lib/typescript/src/components/native/Animated.d.ts.map +1 -1
  246. package/lib/typescript/src/components/native/FlatList.d.ts.map +1 -1
  247. package/lib/typescript/src/components/native/Image.d.ts.map +1 -1
  248. package/lib/typescript/src/components/native/Image.native.d.ts.map +1 -1
  249. package/lib/typescript/src/components/native/ImageBackground.d.ts.map +1 -1
  250. package/lib/typescript/src/components/native/ImageBackground.native.d.ts.map +1 -1
  251. package/lib/typescript/src/components/native/KeyboardAvoidingView.d.ts.map +1 -1
  252. package/lib/typescript/src/components/native/NativeText.native.d.ts.map +1 -1
  253. package/lib/typescript/src/components/native/NativeView.native.d.ts.map +1 -1
  254. package/lib/typescript/src/components/native/Pressable.d.ts +1 -1
  255. package/lib/typescript/src/components/native/Pressable.d.ts.map +1 -1
  256. package/lib/typescript/src/components/native/Pressable.native.d.ts +1 -1
  257. package/lib/typescript/src/components/native/Pressable.native.d.ts.map +1 -1
  258. package/lib/typescript/src/components/native/RefreshControl.d.ts.map +1 -1
  259. package/lib/typescript/src/components/native/SafeAreaView.d.ts.map +1 -1
  260. package/lib/typescript/src/components/native/ScrollView.d.ts.map +1 -1
  261. package/lib/typescript/src/components/native/SectionList.d.ts.map +1 -1
  262. package/lib/typescript/src/components/native/Switch.d.ts.map +1 -1
  263. package/lib/typescript/src/components/native/Text.d.ts.map +1 -1
  264. package/lib/typescript/src/components/native/TextInput.d.ts.map +1 -1
  265. package/lib/typescript/src/components/native/TouchableHighlight.d.ts.map +1 -1
  266. package/lib/typescript/src/components/native/TouchableOpacity.d.ts.map +1 -1
  267. package/lib/typescript/src/components/native/View.d.ts.map +1 -1
  268. package/lib/typescript/src/components/native/VirtualizedList.d.ts.map +1 -1
  269. package/lib/typescript/src/core/createUnistylesElement.d.ts.map +1 -1
  270. package/lib/typescript/src/core/createUnistylesElement.native.d.ts.map +1 -1
  271. package/lib/typescript/src/core/createUnistylesImageBackground.d.ts.map +1 -1
  272. package/lib/typescript/src/core/getClassname.d.ts.map +1 -1
  273. package/lib/typescript/src/core/parseBoxShadow.d.ts.map +1 -1
  274. package/lib/typescript/src/core/useProxifiedUnistyles/listener.d.ts.map +1 -1
  275. package/lib/typescript/src/core/useProxifiedUnistyles/listener.native.d.ts +1 -1
  276. package/lib/typescript/src/core/useProxifiedUnistyles/listener.native.d.ts.map +1 -1
  277. package/lib/typescript/src/core/useProxifiedUnistyles/types.d.ts.map +1 -1
  278. package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts +1 -1
  279. package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts.map +1 -1
  280. package/lib/typescript/src/core/useUnistyles.d.ts.map +1 -1
  281. package/lib/typescript/src/core/withUnistyles/types.d.ts +1 -1
  282. package/lib/typescript/src/core/withUnistyles/types.d.ts.map +1 -1
  283. package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts.map +1 -1
  284. package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
  285. package/lib/typescript/src/global.d.ts.map +1 -1
  286. package/lib/typescript/src/hooks/useMedia.d.ts.map +1 -1
  287. package/lib/typescript/src/hooks/useMedia.native.d.ts.map +1 -1
  288. package/lib/typescript/src/index.d.ts +1 -0
  289. package/lib/typescript/src/index.d.ts.map +1 -1
  290. package/lib/typescript/src/mq.d.ts.map +1 -1
  291. package/lib/typescript/src/reanimated/useAnimatedTheme.d.ts.map +1 -1
  292. package/lib/typescript/src/reanimated/useAnimatedTheme.native.d.ts.map +1 -1
  293. package/lib/typescript/src/reanimated/variant/types.d.ts.map +1 -1
  294. package/lib/typescript/src/reanimated/variant/useAnimatedVariantColor.d.ts.map +1 -1
  295. package/lib/typescript/src/reanimated/variant/useUpdateVariantColor.d.ts +1 -1
  296. package/lib/typescript/src/reanimated/variant/useUpdateVariantColor.d.ts.map +1 -1
  297. package/lib/typescript/src/reanimated/variant/useUpdateVariantColor.native.d.ts +1 -1
  298. package/lib/typescript/src/reanimated/variant/useUpdateVariantColor.native.d.ts.map +1 -1
  299. package/lib/typescript/src/server/getServerUnistyles.d.ts +1 -1
  300. package/lib/typescript/src/server/getServerUnistyles.d.ts.map +1 -1
  301. package/lib/typescript/src/server/types.d.ts.map +1 -1
  302. package/lib/typescript/src/server/useServerUnistyles.d.ts.map +1 -1
  303. package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts.map +1 -1
  304. package/lib/typescript/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.d.ts.map +1 -1
  305. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
  306. package/lib/typescript/src/specs/ShadowRegistry/types.d.ts +4 -5
  307. package/lib/typescript/src/specs/ShadowRegistry/types.d.ts.map +1 -1
  308. package/lib/typescript/src/specs/StatusBar/UnistylesStatusBar.nitro.d.ts.map +1 -1
  309. package/lib/typescript/src/specs/StatusBar/index.d.ts +1 -1
  310. package/lib/typescript/src/specs/StatusBar/index.d.ts.map +1 -1
  311. package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts +0 -1
  312. package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts.map +1 -1
  313. package/lib/typescript/src/specs/StyleSheet/index.d.ts +3 -3
  314. package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
  315. package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts.map +1 -1
  316. package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts +1 -1
  317. package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts.map +1 -1
  318. package/lib/typescript/src/specs/index.native.d.ts +4 -4
  319. package/lib/typescript/src/specs/index.native.d.ts.map +1 -1
  320. package/lib/typescript/src/specs/types.d.ts.map +1 -1
  321. package/lib/typescript/src/types/breakpoints.d.ts +2 -2
  322. package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
  323. package/lib/typescript/src/types/core.d.ts.map +1 -1
  324. package/lib/typescript/src/types/index.d.ts +1 -1
  325. package/lib/typescript/src/types/index.d.ts.map +1 -1
  326. package/lib/typescript/src/types/stylesheet.d.ts +1 -1
  327. package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
  328. package/lib/typescript/src/types/variants.d.ts.map +1 -1
  329. package/lib/typescript/src/utils.d.ts.map +1 -1
  330. package/lib/typescript/src/web/convert/index.d.ts.map +1 -1
  331. package/lib/typescript/src/web/convert/object/boxShadow.d.ts.map +1 -1
  332. package/lib/typescript/src/web/convert/object/filter.d.ts.map +1 -1
  333. package/lib/typescript/src/web/convert/object/objectStyle.d.ts.map +1 -1
  334. package/lib/typescript/src/web/convert/object/transform.d.ts.map +1 -1
  335. package/lib/typescript/src/web/convert/pseudo.d.ts.map +1 -1
  336. package/lib/typescript/src/web/convert/types.d.ts +2 -2
  337. package/lib/typescript/src/web/convert/types.d.ts.map +1 -1
  338. package/lib/typescript/src/web/convert/utils.d.ts.map +1 -1
  339. package/lib/typescript/src/web/create.d.ts +1 -1
  340. package/lib/typescript/src/web/create.d.ts.map +1 -1
  341. package/lib/typescript/src/web/css/core.d.ts.map +1 -1
  342. package/lib/typescript/src/web/css/state.d.ts.map +1 -1
  343. package/lib/typescript/src/web/css/utils.d.ts.map +1 -1
  344. package/lib/typescript/src/web/index.d.ts.map +1 -1
  345. package/lib/typescript/src/web/listener.d.ts +5 -1
  346. package/lib/typescript/src/web/listener.d.ts.map +1 -1
  347. package/lib/typescript/src/web/registry.d.ts +1 -1
  348. package/lib/typescript/src/web/registry.d.ts.map +1 -1
  349. package/lib/typescript/src/web/runtime.d.ts +1 -1
  350. package/lib/typescript/src/web/runtime.d.ts.map +1 -1
  351. package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
  352. package/lib/typescript/src/web/state.d.ts.map +1 -1
  353. package/lib/typescript/src/web/types.d.ts +1 -1
  354. package/lib/typescript/src/web/types.d.ts.map +1 -1
  355. package/lib/typescript/src/web/utils/common.d.ts.map +1 -1
  356. package/lib/typescript/src/web/utils/createUnistylesRef.d.ts.map +1 -1
  357. package/lib/typescript/src/web/utils/unistyle.d.ts +1 -1
  358. package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
  359. package/lib/typescript/src/web/variants.d.ts.map +1 -1
  360. package/lib/typescript/src/web-only/getWebProps.d.ts.map +1 -1
  361. package/lib/typescript/src/web-only/index.d.ts.map +1 -1
  362. package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +36 -42
  363. package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +19 -22
  364. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +15 -18
  365. package/nitrogen/generated/android/unistylesOnLoad.cpp +14 -9
  366. package/nitrogen/generated/android/unistylesOnLoad.hpp +13 -4
  367. package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.cpp +0 -1
  368. package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.hpp +0 -1
  369. package/package.json +43 -44
  370. package/plugin/index.d.ts +34 -28
  371. package/plugin/index.js +113 -103
  372. package/repack-plugin/index.d.ts +2 -2
  373. package/src/components/AdaptiveTheme.tsx +8 -12
  374. package/src/components/ApplyScopedTheme.tsx +2 -0
  375. package/src/components/Display.tsx +2 -3
  376. package/src/components/Hide.tsx +2 -3
  377. package/src/components/NamedTheme.tsx +9 -14
  378. package/src/components/ScopedTheme.tsx +22 -27
  379. package/src/components/native/ActivityIndicator.tsx +1 -0
  380. package/src/components/native/Animated.tsx +2 -1
  381. package/src/components/native/FlatList.tsx +1 -0
  382. package/src/components/native/Image.native.tsx +1 -0
  383. package/src/components/native/Image.tsx +11 -7
  384. package/src/components/native/ImageBackground.native.tsx +1 -0
  385. package/src/components/native/ImageBackground.tsx +11 -7
  386. package/src/components/native/KeyboardAvoidingView.tsx +1 -0
  387. package/src/components/native/NativeText.native.tsx +3 -1
  388. package/src/components/native/NativeView.native.tsx +3 -1
  389. package/src/components/native/Pressable.native.tsx +8 -8
  390. package/src/components/native/Pressable.tsx +25 -20
  391. package/src/components/native/RefreshControl.tsx +1 -0
  392. package/src/components/native/SafeAreaView.tsx +1 -0
  393. package/src/components/native/ScrollView.tsx +1 -0
  394. package/src/components/native/SectionList.tsx +1 -0
  395. package/src/components/native/Switch.tsx +1 -0
  396. package/src/components/native/Text.tsx +1 -0
  397. package/src/components/native/TextInput.tsx +1 -0
  398. package/src/components/native/TouchableHighlight.tsx +1 -0
  399. package/src/components/native/TouchableOpacity.tsx +1 -0
  400. package/src/components/native/View.tsx +1 -0
  401. package/src/components/native/VirtualizedList.tsx +1 -0
  402. package/src/core/createUnistylesElement.native.tsx +4 -2
  403. package/src/core/createUnistylesElement.tsx +14 -17
  404. package/src/core/createUnistylesImageBackground.tsx +6 -4
  405. package/src/core/getClassname.ts +4 -11
  406. package/src/core/parseBoxShadow.ts +11 -24
  407. package/src/core/passForwardRef.ts +1 -1
  408. package/src/core/useProxifiedUnistyles/listener.native.ts +3 -3
  409. package/src/core/useProxifiedUnistyles/listener.ts +10 -3
  410. package/src/core/useProxifiedUnistyles/types.ts +2 -2
  411. package/src/core/useProxifiedUnistyles/useProxifiedUnistyles.ts +13 -9
  412. package/src/core/useUnistyles.ts +2 -1
  413. package/src/core/warn.ts +4 -4
  414. package/src/core/withUnistyles/types.ts +7 -4
  415. package/src/core/withUnistyles/withUnistyles.native.tsx +53 -44
  416. package/src/core/withUnistyles/withUnistyles.tsx +30 -24
  417. package/src/global.ts +2 -2
  418. package/src/hooks/useMedia.native.ts +2 -2
  419. package/src/hooks/useMedia.ts +6 -3
  420. package/src/index.ts +1 -0
  421. package/src/mocks.ts +74 -49
  422. package/src/mq.ts +23 -15
  423. package/src/reanimated/useAnimatedTheme.native.ts +4 -3
  424. package/src/reanimated/useAnimatedTheme.ts +6 -2
  425. package/src/reanimated/variant/types.ts +11 -10
  426. package/src/reanimated/variant/useAnimatedVariantColor.ts +7 -7
  427. package/src/reanimated/variant/useUpdateVariantColor.native.ts +10 -6
  428. package/src/reanimated/variant/useUpdateVariantColor.ts +21 -21
  429. package/src/server/getServerUnistyles.tsx +11 -4
  430. package/src/server/index.ts +0 -1
  431. package/src/server/types.ts +1 -1
  432. package/src/server/useServerUnistyles.tsx +4 -1
  433. package/src/specs/NativePlatform/NativePlatform.nitro.ts +30 -27
  434. package/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.ts +3 -3
  435. package/src/specs/ShadowRegistry/ShadowRegistry.nitro.ts +1 -1
  436. package/src/specs/ShadowRegistry/index.ts +35 -29
  437. package/src/specs/ShadowRegistry/types.ts +9 -10
  438. package/src/specs/StatusBar/UnistylesStatusBar.nitro.ts +4 -4
  439. package/src/specs/StatusBar/index.ts +5 -5
  440. package/src/specs/StyleSheet/UnistylesStyleSheet.nitro.ts +2 -2
  441. package/src/specs/StyleSheet/index.ts +32 -27
  442. package/src/specs/TurboUnistyles/NativeTurboUnistyles.ts +1 -0
  443. package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +26 -25
  444. package/src/specs/UnistylesRuntime/index.ts +20 -20
  445. package/src/specs/index.native.ts +6 -18
  446. package/src/specs/types.ts +9 -8
  447. package/src/types/accessibility.ts +2 -2
  448. package/src/types/breakpoints.ts +61 -59
  449. package/src/types/core.ts +17 -17
  450. package/src/types/index.ts +2 -9
  451. package/src/types/stylesheet.ts +27 -19
  452. package/src/types/variants.ts +3 -11
  453. package/src/utils.ts +16 -16
  454. package/src/web/convert/index.ts +6 -2
  455. package/src/web/convert/object/boxShadow.ts +23 -18
  456. package/src/web/convert/object/filter.ts +30 -13
  457. package/src/web/convert/object/objectStyle.ts +33 -23
  458. package/src/web/convert/object/transform.ts +10 -8
  459. package/src/web/convert/pseudo.ts +2 -2
  460. package/src/web/convert/shadow/boxShadow.ts +6 -6
  461. package/src/web/convert/shadow/getShadowBreakpoints.ts +4 -4
  462. package/src/web/convert/shadow/textShadow.ts +6 -6
  463. package/src/web/convert/style.ts +25 -25
  464. package/src/web/convert/types.ts +4 -3
  465. package/src/web/convert/utils.ts +20 -10
  466. package/src/web/create.ts +29 -20
  467. package/src/web/css/core.ts +2 -1
  468. package/src/web/css/state.ts +11 -8
  469. package/src/web/css/utils.ts +2 -1
  470. package/src/web/index.ts +7 -4
  471. package/src/web/listener.ts +61 -18
  472. package/src/web/mock.ts +2 -2
  473. package/src/web/registry.ts +17 -10
  474. package/src/web/runtime.ts +23 -17
  475. package/src/web/shadowRegistry.ts +26 -24
  476. package/src/web/state.ts +23 -16
  477. package/src/web/types.ts +5 -5
  478. package/src/web/utils/common.ts +7 -9
  479. package/src/web/utils/createUnistylesRef.ts +18 -14
  480. package/src/web/utils/unistyle.ts +53 -34
  481. package/src/web/variants.ts +19 -11
  482. package/src/web-only/getWebProps.ts +5 -6
  483. package/src/web-only/index.ts +0 -1
  484. package/LICENSE +0 -20
  485. package/README.md +0 -178
  486. package/lib/typescript/plugin/src/consts.d.ts +0 -17
  487. package/lib/typescript/plugin/src/consts.d.ts.map +0 -1
  488. package/lib/typescript/repack-plugin/src/index.d.ts +0 -18
  489. package/lib/typescript/repack-plugin/src/index.d.ts.map +0 -1
  490. package/lib/typescript/repack-plugin/src/loader.d.ts +0 -9
  491. package/lib/typescript/repack-plugin/src/loader.d.ts.map +0 -1
@@ -1,7 +1,10 @@
1
- import type { UnistylesMiniRuntime } from '../../specs';
2
- import type { UnistylesTheme } from '../../types';
1
+ import type { UnistylesMiniRuntime } from '../../specs'
2
+ import type { UnistylesTheme } from '../../types'
3
3
 
4
4
  export const SUPPORTED_STYLE_PROPS = ['style', 'contentContainerStyle'] as const
5
5
 
6
- export type SupportedStyleProps = typeof SUPPORTED_STYLE_PROPS[number]
7
- export type Mappings<T = {}> = (theme: UnistylesTheme, rt: UnistylesMiniRuntime) => Omit<Partial<T>, SupportedStyleProps> & { key?: string }
6
+ export type SupportedStyleProps = (typeof SUPPORTED_STYLE_PROPS)[number]
7
+ export type Mappings<T = {}> = (
8
+ theme: UnistylesTheme,
9
+ rt: UnistylesMiniRuntime,
10
+ ) => Omit<Partial<T>, SupportedStyleProps> & { key?: string }
@@ -1,10 +1,12 @@
1
1
  import React, { forwardRef, useEffect, useRef, type ComponentProps, type ComponentRef, type ComponentType } from 'react'
2
- import { type UnistyleDependency, UnistylesShadowRegistry } from '../../specs'
2
+
3
3
  import type { UnistylesTheme, UnistylesValues } from '../../types'
4
+ import type { Mappings } from './types'
5
+
6
+ import { type UnistyleDependency, UnistylesShadowRegistry } from '../../specs'
4
7
  import { deepMergeObjects } from '../../utils'
5
8
  import { useProxifiedUnistyles } from '../useProxifiedUnistyles'
6
9
  import { maybeWarnAboutMultipleUnistyles } from '../warn'
7
- import type { Mappings } from './types'
8
10
 
9
11
  // @ts-expect-error
10
12
  type GenericComponentProps<P> = ComponentProps<P>
@@ -12,51 +14,50 @@ type GenericComponentProps<P> = ComponentProps<P>
12
14
  type GenericComponentRef<T> = ComponentRef<T>
13
15
 
14
16
  type UnistylesSecrets = {
15
- uni__getStyles: () => Record<string, any>,
17
+ uni__getStyles: () => Record<string, any>
16
18
  uni__dependencies: Array<UnistyleDependency>
17
19
  }
18
20
 
19
21
  type MappedSecrets = {
20
- styles: Record<string, any>,
22
+ styles: Record<string, any>
21
23
  dependencies: Array<UnistyleDependency>
22
24
  }
23
25
 
24
- export const withUnistyles = <TComponent, TMappings extends GenericComponentProps<TComponent>>(Component: TComponent, mappings?: Mappings<TMappings>) => {
26
+ export const withUnistyles = <TComponent, TMappings extends GenericComponentProps<TComponent>>(
27
+ Component: TComponent,
28
+ mappings?: Mappings<TMappings>,
29
+ ) => {
25
30
  type TProps = GenericComponentProps<TComponent>
26
31
  type PropsWithUnistyles = Partial<TProps> & {
27
32
  uniProps?: Mappings<TProps>
28
33
  }
29
34
  type UnistyleStyles = {
30
- style?: UnistylesValues,
35
+ style?: UnistylesValues
31
36
  contentContainerStyle?: UnistylesValues
32
37
  }
33
38
 
34
39
  const getSecrets = (styleProps: Record<string, any> = {}): MappedSecrets => {
35
- const styles = Array.isArray(styleProps)
36
- ? styleProps.flat()
37
- : [styleProps]
38
-
39
- const secrets: Array<UnistylesSecrets> = styles
40
- .filter(Boolean)
41
- .reduce((acc, style) => {
42
- const unistyleKey = Object
43
- .keys(style)
44
- .find(key => key.startsWith('unistyles_'))
45
-
46
- return acc.concat([
47
- unistyleKey
48
- ? style[unistyleKey]
49
- : {
50
- uni__getStyles: () => style,
51
- uni__dependencies: [],
52
- }
53
- ])
54
- }, [])
40
+ const styles = Array.isArray(styleProps) ? styleProps.flat() : [styleProps]
41
+
42
+ const secrets: Array<UnistylesSecrets> = styles.filter(Boolean).reduce((acc, style) => {
43
+ const unistyleKey = Object.keys(style).find((key) => key.startsWith('unistyles_'))
44
+
45
+ return acc.concat([
46
+ unistyleKey
47
+ ? style[unistyleKey]
48
+ : {
49
+ uni__getStyles: () => style,
50
+ uni__dependencies: [],
51
+ },
52
+ ])
53
+ }, [])
55
54
 
56
55
  return {
57
- styles: secrets.reduce((acc, secret) => Object
58
- .assign(acc, secret.uni__getStyles()), {} as Record<string, any>),
59
- dependencies: secrets.flatMap(secret => secret.uni__dependencies),
56
+ styles: secrets.reduce(
57
+ (acc, secret) => Object.assign(acc, secret.uni__getStyles()),
58
+ {} as Record<string, any>,
59
+ ),
60
+ dependencies: secrets.flatMap((secret) => secret.uni__dependencies),
60
61
  }
61
62
  }
62
63
 
@@ -65,42 +66,50 @@ export const withUnistyles = <TComponent, TMappings extends GenericComponentProp
65
66
  const NativeComponent = Component as ComponentType
66
67
 
67
68
  // @ts-ignore we don't know the type of the component
69
+ // prettier-ignore
68
70
  maybeWarnAboutMultipleUnistyles(narrowedProps.style, `withUnistyles(${Component.displayName ?? Component.name ?? 'Unknown'})`)
69
71
  // @ts-ignore we don't know the type of the component
72
+ // prettier-ignore
70
73
  maybeWarnAboutMultipleUnistyles(narrowedProps.contentContainerStyle, `withUnistyles(${Component.displayName ?? Component.name ?? 'Unknown'})`)
71
74
 
72
75
  const scopedTheme = useRef(UnistylesShadowRegistry.getScopedTheme() as UnistylesTheme)
73
76
  const { proxifiedRuntime, proxifiedTheme, addDependencies } = useProxifiedUnistyles(scopedTheme.current)
74
77
 
78
+ // Always track Theme dependency — accessing any property on proxifiedTheme
79
+ // triggers the Proxy get trap which adds Theme to the dependency Set
80
+ void (proxifiedTheme as Record<string, unknown>).__uni
81
+
75
82
  useEffect(() => {
76
83
  const styleSecrets = getSecrets(narrowedProps.style)
77
84
  const contentContainerStyleSecrets = getSecrets(narrowedProps.contentContainerStyle)
78
85
 
79
- addDependencies(Array.from(new Set([...styleSecrets.dependencies, ...contentContainerStyleSecrets.dependencies])))
86
+ addDependencies(
87
+ Array.from(new Set([...styleSecrets.dependencies, ...contentContainerStyleSecrets.dependencies])),
88
+ )
80
89
  }, [narrowedProps.style, narrowedProps.contentContainerStyle])
81
90
 
82
91
  const { key: mappingsKey, ...mappingsProps } = mappings ? mappings(proxifiedTheme, proxifiedRuntime) : {}
83
- const { key: uniPropsKey, ...unistyleProps } = narrowedProps.uniProps ? narrowedProps.uniProps(proxifiedTheme, proxifiedRuntime) : {}
92
+ const { key: uniPropsKey, ...unistyleProps } = narrowedProps.uniProps
93
+ ? narrowedProps.uniProps(proxifiedTheme, proxifiedRuntime)
94
+ : {}
84
95
 
85
96
  const styleSecrets = getSecrets(narrowedProps.style)
86
97
  const contentContainerStyleSecrets = getSecrets(narrowedProps.contentContainerStyle)
87
98
 
88
99
  const finalProps = {
89
100
  ...deepMergeObjects(mappingsProps, unistyleProps, props),
90
- ...narrowedProps.style ? {
91
- style: styleSecrets.styles,
92
- } : {},
93
- ...narrowedProps.contentContainerStyle ? {
94
- contentContainerStyle: contentContainerStyleSecrets.styles,
95
- } : {},
101
+ ...(narrowedProps.style
102
+ ? {
103
+ style: styleSecrets.styles,
104
+ }
105
+ : {}),
106
+ ...(narrowedProps.contentContainerStyle
107
+ ? {
108
+ contentContainerStyle: contentContainerStyleSecrets.styles,
109
+ }
110
+ : {}),
96
111
  } as any
97
112
 
98
- return (
99
- <NativeComponent
100
- key={uniPropsKey || mappingsKey}
101
- {...finalProps}
102
- ref={ref}
103
- />
104
- )
113
+ return <NativeComponent key={uniPropsKey || mappingsKey} {...finalProps} ref={ref} />
105
114
  })
106
115
  }
@@ -1,23 +1,28 @@
1
1
  import React, { type ComponentType, forwardRef, type ComponentProps, type ComponentRef } from 'react'
2
+
2
3
  import type { UnistylesValues } from '../../types'
4
+ import type { Mappings } from './types'
5
+
3
6
  import { deepMergeObjects } from '../../utils'
4
7
  import { getClassName } from '../getClassname'
5
8
  import { useProxifiedUnistyles } from '../useProxifiedUnistyles'
6
9
  import { maybeWarnAboutMultipleUnistyles } from '../warn'
7
- import type { Mappings } from './types'
8
10
 
9
11
  // @ts-expect-error
10
12
  type GenericComponentProps<T> = ComponentProps<T>
11
13
  // @ts-expect-error
12
14
  type GenericComponentRef<T> = ComponentRef<T>
13
15
 
14
- export const withUnistyles = <TComponent, TMappings extends GenericComponentProps<TComponent>>(Component: TComponent, mappings?: Mappings<TMappings>) => {
16
+ export const withUnistyles = <TComponent, TMappings extends GenericComponentProps<TComponent>>(
17
+ Component: TComponent,
18
+ mappings?: Mappings<TMappings>,
19
+ ) => {
15
20
  type TProps = GenericComponentProps<TComponent>
16
21
  type PropsWithUnistyles = Partial<TProps> & {
17
22
  uniProps?: Mappings<TProps>
18
23
  }
19
24
  type UnistyleStyles = {
20
- style?: UnistylesValues,
25
+ style?: UnistylesValues
21
26
  contentContainerStyle?: UnistylesValues
22
27
  }
23
28
 
@@ -28,45 +33,46 @@ export const withUnistyles = <TComponent, TMappings extends GenericComponentProp
28
33
  const { proxifiedRuntime, proxifiedTheme } = useProxifiedUnistyles()
29
34
 
30
35
  const { key: mappingsKey, ...mappingsProps } = mappings ? mappings(proxifiedTheme, proxifiedRuntime) : {}
31
- const { key: uniPropsKey, ...unistyleProps } = narrowedProps.uniProps ? narrowedProps.uniProps(proxifiedTheme, proxifiedRuntime) : {}
36
+ const { key: uniPropsKey, ...unistyleProps } = narrowedProps.uniProps
37
+ ? narrowedProps.uniProps(proxifiedTheme, proxifiedRuntime)
38
+ : {}
32
39
 
33
40
  const emptyStyles = narrowedProps.style
34
41
  ? Object.fromEntries(
35
- Object.entries(Object.getOwnPropertyDescriptors(narrowedProps.style))
36
- .filter(([key]) => !key.startsWith("unistyles") && !key.startsWith("_"))
37
- .map(([key]) => [key, undefined])
38
- )
42
+ Object.entries(Object.getOwnPropertyDescriptors(narrowedProps.style))
43
+ .filter(([key]) => !key.startsWith('unistyles') && !key.startsWith('_'))
44
+ .map(([key]) => [key, undefined]),
45
+ )
39
46
  : undefined
40
47
 
41
48
  const combinedProps = {
42
49
  ...deepMergeObjects(mappingsProps, unistyleProps, props),
43
- ...narrowedProps.style ? {
44
- // Override default component styles with undefined values to reset them
45
- style: emptyStyles
46
- } : {},
47
- ...narrowedProps.contentContainerStyle ? {
48
- contentContainerStyle: contentContainerStyleClassNames,
49
- } : {},
50
+ ...(narrowedProps.style
51
+ ? {
52
+ // Override default component styles with undefined values to reset them
53
+ style: emptyStyles,
54
+ }
55
+ : {}),
56
+ ...(narrowedProps.contentContainerStyle
57
+ ? {
58
+ contentContainerStyle: contentContainerStyleClassNames,
59
+ }
60
+ : {}),
50
61
  } as any
51
62
 
52
63
  // @ts-ignore
64
+ // prettier-ignore
53
65
  maybeWarnAboutMultipleUnistyles(narrowedProps.style, `withUnistyles(${Component.displayName ?? Component.name ?? 'Unknown'})`)
54
66
  // @ts-ignore
67
+ // prettier-ignore
55
68
  maybeWarnAboutMultipleUnistyles(narrowedProps.contentContainerStyle, `withUnistyles(${Component.displayName ?? Component.name ?? 'Unknown'})`)
56
69
 
57
70
  const NativeComponent = Component as ComponentType
58
71
  const [classNames] = styleClassNames ?? []
59
72
 
60
73
  return (
61
- <div
62
- className={classNames?.hash}
63
- style={{ display: 'contents' }}
64
- >
65
- <NativeComponent
66
- key={uniPropsKey || mappingsKey}
67
- {...combinedProps}
68
- ref={ref}
69
- />
74
+ <div className={classNames?.hash} style={{ display: 'contents' }}>
75
+ <NativeComponent key={uniPropsKey || mappingsKey} {...combinedProps} ref={ref} />
70
76
  </div>
71
77
  )
72
78
  })
package/src/global.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export interface UnistylesThemes {}
2
2
  export interface UnistylesBreakpoints {
3
3
  // these breakpoints are only available on mobile, when you didn't specify any breakpoints
4
- landscape?: number,
5
- portrait?: number,
4
+ landscape?: number
5
+ portrait?: number
6
6
  }
@@ -1,4 +1,5 @@
1
1
  import { useEffect, useLayoutEffect, useState } from 'react'
2
+
2
3
  import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs'
3
4
  import { isUnistylesMq, isValidMq, parseMq } from '../utils'
4
5
 
@@ -47,7 +48,6 @@ export const useMedia = (config: { mq: symbol }) => {
47
48
  }, [config.mq])
48
49
 
49
50
  useLayoutEffect(() => {
50
- // @ts-expect-error - this is hidden from TS
51
51
  const removeChangeListener = StyleSheet.addChangeListener((dependencies: Array<UnistyleDependency>) => {
52
52
  if (dependencies.includes(UnistyleDependency.Breakpoints)) {
53
53
  setIsVisible(computeIsVisible())
@@ -60,6 +60,6 @@ export const useMedia = (config: { mq: symbol }) => {
60
60
  }, [config.mq])
61
61
 
62
62
  return {
63
- isVisible
63
+ isVisible,
64
64
  }
65
65
  }
@@ -1,4 +1,5 @@
1
1
  import { useEffect, useRef, useState } from 'react'
2
+
2
3
  import { isUnistylesMq, isValidMq, parseMq } from '../utils'
3
4
 
4
5
  export const useMedia = (config: { mq: symbol }) => {
@@ -26,8 +27,10 @@ export const useMedia = (config: { mq: symbol }) => {
26
27
  minWidth !== undefined ? `(min-width: ${minWidth}px)` : undefined,
27
28
  maxWidth !== undefined ? `(max-width: ${maxWidth}px)` : undefined,
28
29
  minHeight !== undefined ? `(min-height: ${minHeight}px)` : undefined,
29
- maxHeight !== undefined ? `(max-height: ${maxHeight}px)` : undefined
30
- ].filter(Boolean).join(' and ')
30
+ maxHeight !== undefined ? `(max-height: ${maxHeight}px)` : undefined,
31
+ ]
32
+ .filter(Boolean)
33
+ .join(' and ')
31
34
 
32
35
  const media = window.matchMedia(mediaQuery)
33
36
  const handler = (event: MediaQueryListEvent) => setIsVisible(event.matches)
@@ -42,6 +45,6 @@ export const useMedia = (config: { mq: symbol }) => {
42
45
  useEffect(() => () => disposeRef.current(), [])
43
46
 
44
47
  return {
45
- isVisible
48
+ isVisible,
46
49
  }
47
50
  }
package/src/index.ts CHANGED
@@ -7,6 +7,7 @@ if (majorReactVersions === undefined || majorReactVersions < 19) {
7
7
  }
8
8
 
9
9
  export { StyleSheet, UnistylesRuntime, StatusBar, NavigationBar } from './specs'
10
+ export { UnistyleDependency } from './specs'
10
11
  export { mq } from './mq'
11
12
  export type { UnistylesThemes, UnistylesBreakpoints } from './global'
12
13
  export { withUnistyles, useUnistyles, createUnistylesElement } from './core'
package/src/mocks.ts CHANGED
@@ -2,8 +2,8 @@ import type { UnistylesBreakpoints, UnistylesThemes } from './global'
2
2
  import type { UnistylesNavigationBar } from './specs/NavigtionBar'
3
3
  import type { UnistylesStatusBar } from './specs/StatusBar'
4
4
  import type { UnistylesConfig, UnistylesStyleSheet } from './specs/StyleSheet'
5
- import type { UnistylesRuntimePrivate } from './specs/UnistylesRuntime'
6
5
  import type { ColorScheme, Orientation } from './specs/types'
6
+ import type { UnistylesRuntimePrivate } from './specs/UnistylesRuntime'
7
7
  import type { IOSContentSizeCategory, UnistylesTheme } from './types'
8
8
 
9
9
  type Registry = {
@@ -20,15 +20,15 @@ jest.mock('react-native-nitro-modules', () => ({
20
20
  setStyle: () => {},
21
21
  }),
22
22
  createHybridNavigationBar: () => {},
23
- })
24
- }
23
+ }),
24
+ },
25
25
  }))
26
26
 
27
27
  jest.mock('react-native-unistyles', () => {
28
28
  const React = require('react')
29
29
  const _REGISTRY: Registry = {
30
30
  themes: {},
31
- breakpoints: {}
31
+ breakpoints: {},
32
32
  }
33
33
  const miniRuntime = {
34
34
  themeName: undefined,
@@ -41,7 +41,7 @@ jest.mock('react-native-unistyles', () => {
41
41
  left: 0,
42
42
  right: 0,
43
43
  bottom: 0,
44
- ime: 0
44
+ ime: 0,
45
45
  },
46
46
  pixelRatio: 1,
47
47
  fontScale: 1,
@@ -50,16 +50,16 @@ jest.mock('react-native-unistyles', () => {
50
50
  isPortrait: true,
51
51
  navigationBar: {
52
52
  width: 0,
53
- height: 0
53
+ height: 0,
54
54
  },
55
55
  screen: {
56
56
  width: 0,
57
- height: 0
57
+ height: 0,
58
58
  },
59
59
  statusBar: {
60
60
  width: 0,
61
- height: 0
62
- }
61
+ height: 0,
62
+ },
63
63
  }
64
64
  const unistylesRuntime = {
65
65
  colorScheme: 'unspecified' as ColorScheme,
@@ -68,7 +68,7 @@ jest.mock('react-native-unistyles', () => {
68
68
  isPortrait: true,
69
69
  isLandscape: false,
70
70
  breakpoints: {},
71
- dispose: () => { },
71
+ dispose: () => {},
72
72
  equals: () => false,
73
73
  name: 'UnistylesRuntimeMock',
74
74
  miniRuntime: miniRuntime,
@@ -77,16 +77,16 @@ jest.mock('react-native-unistyles', () => {
77
77
  width: 0,
78
78
  name: 'StatusBarMock',
79
79
  equals: () => false,
80
- setHidden: () => { },
81
- setStyle: () => { }
80
+ setHidden: () => {},
81
+ setStyle: () => {},
82
82
  },
83
83
  navigationBar: {
84
84
  height: 0,
85
85
  width: 0,
86
86
  name: 'NavigationBarMock',
87
87
  equals: () => false,
88
- setHidden: () => { },
89
- dispose: () => { }
88
+ setHidden: () => {},
89
+ dispose: () => {},
90
90
  },
91
91
  fontScale: 1,
92
92
  hasAdaptiveThemes: false,
@@ -113,51 +113,79 @@ jest.mock('react-native-unistyles', () => {
113
113
  left: 0,
114
114
  right: 0,
115
115
  bottom: 0,
116
- ime: 0
116
+ ime: 0,
117
117
  },
118
118
  screen: {
119
119
  width: 0,
120
- height: 0
120
+ height: 0,
121
121
  },
122
- breakpoint: undefined
122
+ breakpoint: undefined,
123
123
  } satisfies UnistylesRuntimePrivate
124
124
 
125
+ const stripVariants = (styleEntries: Record<string, any>): any => {
126
+ const result: Record<string, any> = {}
127
+
128
+ for (const [name, style] of Object.entries(styleEntries)) {
129
+ if (typeof style === 'function') {
130
+ result[name] = (...args: Array<any>) => {
131
+ const resolved = style(...args)
132
+ const { variants, compoundVariants, ...rest } = resolved
133
+
134
+ return rest
135
+ }
136
+ } else if (style !== null && typeof style === 'object' && !Array.isArray(style)) {
137
+ const { variants, compoundVariants, ...rest } = style
138
+
139
+ result[name] = rest
140
+ } else {
141
+ result[name] = style
142
+ }
143
+ }
144
+
145
+ return result
146
+ }
147
+
125
148
  return {
126
149
  Hide: () => null,
127
150
  Display: () => null,
128
151
  ScopedTheme: () => null,
129
- withUnistyles: <TComponent,>(Component: TComponent, mapper?: (theme: UnistylesTheme, runtime: typeof miniRuntime) => TComponent) => (props: any) =>
130
- React.createElement(Component, {
131
- ...mapper?.((Object.values(_REGISTRY.themes).at(0) ?? {}) as UnistylesTheme, miniRuntime),
132
- ...props
133
- }),
152
+ withUnistyles:
153
+ <TComponent>(
154
+ Component: TComponent,
155
+ mapper?: (theme: UnistylesTheme, runtime: typeof miniRuntime) => TComponent,
156
+ ) =>
157
+ (props: any) =>
158
+ React.createElement(Component, {
159
+ ...mapper?.((Object.values(_REGISTRY.themes).at(0) ?? {}) as UnistylesTheme, miniRuntime),
160
+ ...props,
161
+ }),
134
162
  mq: {
135
163
  only: {
136
164
  width: () => ({
137
165
  and: {
138
- height: () => ({})
139
- }
166
+ height: () => ({}),
167
+ },
140
168
  }),
141
169
  height: () => ({
142
170
  and: {
143
- width: () => ({})
144
- }
145
- })
171
+ width: () => ({}),
172
+ },
173
+ }),
146
174
  },
147
175
  width: () => ({
148
176
  and: {
149
- height: () => ({})
150
- }
177
+ height: () => ({}),
178
+ },
151
179
  }),
152
180
  height: () => ({
153
181
  and: {
154
- width: () => ({})
155
- }
156
- })
182
+ width: () => ({}),
183
+ },
184
+ }),
157
185
  },
158
186
  useUnistyles: () => ({
159
187
  theme: Object.values(_REGISTRY.themes).at(0) ?? {},
160
- rt: unistylesRuntime
188
+ rt: unistylesRuntime,
161
189
  }),
162
190
  StyleSheet: {
163
191
  absoluteFillObject: {
@@ -165,14 +193,14 @@ jest.mock('react-native-unistyles', () => {
165
193
  left: 0,
166
194
  right: 0,
167
195
  top: 0,
168
- bottom: 0
196
+ bottom: 0,
169
197
  },
170
198
  absoluteFill: {
171
199
  position: 'absolute',
172
200
  left: 0,
173
201
  right: 0,
174
202
  top: 0,
175
- bottom: 0
203
+ bottom: 0,
176
204
  } as unknown as UnistylesStyleSheet['absoluteFill'],
177
205
  compose: (styles: any) => {
178
206
  return styles
@@ -181,16 +209,14 @@ jest.mock('react-native-unistyles', () => {
181
209
  return styles
182
210
  },
183
211
  create: (styles: any) => {
184
- if (typeof styles === 'function') {
185
- return {
186
- ...styles(Object.values(_REGISTRY.themes).at(0) ?? {}, miniRuntime),
187
- useVariants: () => {}
188
- }
189
- }
212
+ const resolved =
213
+ typeof styles === 'function'
214
+ ? styles(Object.values(_REGISTRY.themes).at(0) ?? {}, miniRuntime)
215
+ : styles
190
216
 
191
217
  return {
192
- ...styles,
193
- useVariants: () => {}
218
+ ...stripVariants(resolved),
219
+ useVariants: () => {},
194
220
  }
195
221
  },
196
222
  configure: (config: UnistylesConfig) => {
@@ -204,17 +230,16 @@ jest.mock('react-native-unistyles', () => {
204
230
  },
205
231
  jsMethods: {
206
232
  processColor: () => null,
207
- parseBoxShadowString: () => []
233
+ parseBoxShadowString: () => [],
208
234
  },
209
235
  hairlineWidth: 1,
210
- unid: -1,
211
236
  addChangeListener: () => () => {},
212
237
  init: () => {},
213
238
  name: 'StyleSheetMock',
214
239
  dispose: () => {},
215
- equals: () => false
240
+ equals: () => false,
216
241
  } satisfies UnistylesStyleSheet,
217
- UnistylesRuntime: unistylesRuntime
242
+ UnistylesRuntime: unistylesRuntime,
218
243
  }
219
244
  })
220
245
 
@@ -223,7 +248,7 @@ jest.mock('react-native-unistyles/reanimated', () => {
223
248
  const mockedSharedValue = (value: any) => ({
224
249
  get: () => value,
225
250
  set: (_value: any) => {},
226
- value
251
+ value,
227
252
  })
228
253
 
229
254
  return {
@@ -239,7 +264,7 @@ jest.mock('react-native-unistyles/reanimated', () => {
239
264
 
240
265
  return {
241
266
  fromValue,
242
- toValue
267
+ toValue,
243
268
  }
244
269
  },
245
270
  }
package/src/mq.ts CHANGED
@@ -1,20 +1,27 @@
1
1
  import type { UnistylesBreakpoints } from './global'
2
- import { UnistylesRuntime } from './specs'
3
2
  import type { Nullable } from './types'
4
3
 
4
+ import { UnistylesRuntime } from './specs'
5
+
5
6
  type MQValue = keyof UnistylesBreakpoints | number
6
7
 
7
8
  type MQHandler = {
8
9
  only: {
9
- width(wMin?: Nullable<MQValue>, wMax?: MQValue): symbol,
10
- height(hMin?: Nullable<MQValue>, hMax?: MQValue): symbol,
11
- },
12
- width(wMin?: Nullable<MQValue>, wMax?: MQValue): {
10
+ width(wMin?: Nullable<MQValue>, wMax?: MQValue): symbol
11
+ height(hMin?: Nullable<MQValue>, hMax?: MQValue): symbol
12
+ }
13
+ width(
14
+ wMin?: Nullable<MQValue>,
15
+ wMax?: MQValue,
16
+ ): {
13
17
  and: {
14
18
  height(hMin?: Nullable<MQValue>, hMax?: MQValue): symbol
15
19
  }
16
- },
17
- height(hMin?: Nullable<MQValue>, hMax?: MQValue): {
20
+ }
21
+ height(
22
+ hMin?: Nullable<MQValue>,
23
+ hMax?: MQValue,
24
+ ): {
18
25
  and: {
19
26
  width(wMin?: Nullable<MQValue>, wMax?: MQValue): symbol
20
27
  }
@@ -41,20 +48,21 @@ const getMQValue = (value: Nullable<MQValue>) => {
41
48
  */
42
49
  export const mq: MQHandler = {
43
50
  only: {
44
- width: (wMin: Nullable<MQValue> = 0, wMax: MQValue = Number.POSITIVE_INFINITY) => (`:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]` as unknown as symbol),
45
- height: (hMin: Nullable<MQValue> = 0, hMax: MQValue = Number.POSITIVE_INFINITY) => (`:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]` as unknown as symbol)
51
+ width: (wMin: Nullable<MQValue> = 0, wMax: MQValue = Number.POSITIVE_INFINITY) =>
52
+ `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]` as unknown as symbol,
53
+ height: (hMin: Nullable<MQValue> = 0, hMax: MQValue = Number.POSITIVE_INFINITY) =>
54
+ `:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]` as unknown as symbol,
46
55
  },
47
56
  width: (wMin: Nullable<MQValue> = 0, wMax: MQValue = Number.POSITIVE_INFINITY) => ({
48
57
  and: {
49
58
  height: (hMin: Nullable<MQValue> = 0, hMax: MQValue = Number.POSITIVE_INFINITY) =>
50
- (`:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]` as unknown as symbol)
51
- }
59
+ `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]` as unknown as symbol,
60
+ },
52
61
  }),
53
62
  height: (hMin: Nullable<MQValue> = 0, hMax: MQValue = Number.POSITIVE_INFINITY) => ({
54
63
  and: {
55
64
  width: (wMin: Nullable<MQValue> = 0, wMax: MQValue = Number.POSITIVE_INFINITY) =>
56
- (`:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]` as unknown as symbol)
57
- }
58
- })
65
+ `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]` as unknown as symbol,
66
+ },
67
+ }),
59
68
  }
60
-