react-native-unistyles 3.0.23 → 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 (495) 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/Equatable.kt +1 -2
  5. package/android/src/main/java/com/unistyles/NativePlatform+android.kt +22 -4
  6. package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +18 -5
  7. package/android/src/main/java/com/unistyles/UnistylesModule.kt +1 -0
  8. package/cxx/core/StyleSheetRegistry.cpp +11 -11
  9. package/cxx/core/StyleSheetRegistry.h +4 -4
  10. package/cxx/core/UnistylesRegistry.cpp +27 -14
  11. package/cxx/core/UnistylesRegistry.h +4 -1
  12. package/cxx/hybridObjects/HybridShadowRegistry.cpp +5 -0
  13. package/cxx/hybridObjects/HybridStyleSheet.cpp +2 -14
  14. package/cxx/hybridObjects/HybridStyleSheet.h +0 -2
  15. package/ios/UnistylesModuleOnLoad.mm +10 -2
  16. package/lib/commonjs/components/AdaptiveTheme.js +1 -1
  17. package/lib/commonjs/components/AdaptiveTheme.js.map +1 -1
  18. package/lib/commonjs/components/ApplyScopedTheme.js.map +1 -1
  19. package/lib/commonjs/components/Display.js.map +1 -1
  20. package/lib/commonjs/components/Hide.js.map +1 -1
  21. package/lib/commonjs/components/NamedTheme.js +2 -2
  22. package/lib/commonjs/components/NamedTheme.js.map +1 -1
  23. package/lib/commonjs/components/ScopedTheme.js.map +1 -1
  24. package/lib/commonjs/components/native/ActivityIndicator.js.map +1 -1
  25. package/lib/commonjs/components/native/Animated.js.map +1 -1
  26. package/lib/commonjs/components/native/FlatList.js.map +1 -1
  27. package/lib/commonjs/components/native/Image.js.map +1 -1
  28. package/lib/commonjs/components/native/Image.native.js.map +1 -1
  29. package/lib/commonjs/components/native/ImageBackground.js.map +1 -1
  30. package/lib/commonjs/components/native/ImageBackground.native.js.map +1 -1
  31. package/lib/commonjs/components/native/KeyboardAvoidingView.js.map +1 -1
  32. package/lib/commonjs/components/native/NativeText.native.js.map +1 -1
  33. package/lib/commonjs/components/native/NativeView.native.js.map +1 -1
  34. package/lib/commonjs/components/native/Pressable.js.map +1 -1
  35. package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
  36. package/lib/commonjs/components/native/RefreshControl.js.map +1 -1
  37. package/lib/commonjs/components/native/SafeAreaView.js.map +1 -1
  38. package/lib/commonjs/components/native/ScrollView.js.map +1 -1
  39. package/lib/commonjs/components/native/SectionList.js.map +1 -1
  40. package/lib/commonjs/components/native/Switch.js.map +1 -1
  41. package/lib/commonjs/components/native/Text.js.map +1 -1
  42. package/lib/commonjs/components/native/TextInput.js.map +1 -1
  43. package/lib/commonjs/components/native/TouchableHighlight.js.map +1 -1
  44. package/lib/commonjs/components/native/TouchableOpacity.js.map +1 -1
  45. package/lib/commonjs/components/native/View.js.map +1 -1
  46. package/lib/commonjs/components/native/VirtualizedList.js.map +1 -1
  47. package/lib/commonjs/core/createUnistylesElement.js.map +1 -1
  48. package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -1
  49. package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
  50. package/lib/commonjs/core/getClassname.js.map +1 -1
  51. package/lib/commonjs/core/parseBoxShadow.js.map +1 -1
  52. package/lib/commonjs/core/useProxifiedUnistyles/listener.js.map +1 -1
  53. package/lib/commonjs/core/useProxifiedUnistyles/listener.native.js +0 -1
  54. package/lib/commonjs/core/useProxifiedUnistyles/listener.native.js.map +1 -1
  55. package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js +15 -2
  56. package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
  57. package/lib/commonjs/core/useUnistyles.js.map +1 -1
  58. package/lib/commonjs/core/warn.js.map +1 -1
  59. package/lib/commonjs/core/withUnistyles/withUnistyles.js +3 -1
  60. package/lib/commonjs/core/withUnistyles/withUnistyles.js.map +1 -1
  61. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +6 -0
  62. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
  63. package/lib/commonjs/hooks/useMedia.js.map +1 -1
  64. package/lib/commonjs/hooks/useMedia.native.js +0 -1
  65. package/lib/commonjs/hooks/useMedia.native.js.map +1 -1
  66. package/lib/commonjs/index.js +6 -0
  67. package/lib/commonjs/index.js.map +1 -1
  68. package/lib/commonjs/mocks.js +28 -8
  69. package/lib/commonjs/mocks.js.map +1 -1
  70. package/lib/commonjs/mq.js.map +1 -1
  71. package/lib/commonjs/reanimated/useAnimatedTheme.js.map +1 -1
  72. package/lib/commonjs/reanimated/useAnimatedTheme.native.js +0 -1
  73. package/lib/commonjs/reanimated/useAnimatedTheme.native.js.map +1 -1
  74. package/lib/commonjs/reanimated/variant/useAnimatedVariantColor.js.map +1 -1
  75. package/lib/commonjs/reanimated/variant/useUpdateVariantColor.js.map +1 -1
  76. package/lib/commonjs/reanimated/variant/useUpdateVariantColor.native.js +0 -1
  77. package/lib/commonjs/reanimated/variant/useUpdateVariantColor.native.js.map +1 -1
  78. package/lib/commonjs/server/getServerUnistyles.js.map +1 -1
  79. package/lib/commonjs/server/useServerUnistyles.js.map +1 -1
  80. package/lib/commonjs/specs/NativePlatform/NativePlatform.nitro.js.map +1 -1
  81. package/lib/commonjs/specs/ShadowRegistry/index.js +9 -5
  82. package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
  83. package/lib/commonjs/specs/StatusBar/index.js.map +1 -1
  84. package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
  85. package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -1
  86. package/lib/commonjs/specs/UnistylesRuntime/index.js.map +1 -1
  87. package/lib/commonjs/specs/index.native.js +1 -1
  88. package/lib/commonjs/specs/index.native.js.map +1 -1
  89. package/lib/commonjs/specs/types.js.map +1 -1
  90. package/lib/commonjs/types/index.js.map +1 -1
  91. package/lib/commonjs/types/stylesheet.js.map +1 -1
  92. package/lib/commonjs/utils.js.map +1 -1
  93. package/lib/commonjs/web/convert/index.js.map +1 -1
  94. package/lib/commonjs/web/convert/object/boxShadow.js.map +1 -1
  95. package/lib/commonjs/web/convert/object/filter.js.map +1 -1
  96. package/lib/commonjs/web/convert/object/objectStyle.js.map +1 -1
  97. package/lib/commonjs/web/convert/object/transform.js.map +1 -1
  98. package/lib/commonjs/web/convert/pseudo.js.map +1 -1
  99. package/lib/commonjs/web/convert/shadow/boxShadow.js.map +1 -1
  100. package/lib/commonjs/web/convert/shadow/getShadowBreakpoints.js.map +1 -1
  101. package/lib/commonjs/web/convert/shadow/textShadow.js.map +1 -1
  102. package/lib/commonjs/web/convert/types.js.map +1 -1
  103. package/lib/commonjs/web/convert/utils.js.map +1 -1
  104. package/lib/commonjs/web/create.js +1 -5
  105. package/lib/commonjs/web/create.js.map +1 -1
  106. package/lib/commonjs/web/css/core.js.map +1 -1
  107. package/lib/commonjs/web/css/state.js.map +1 -1
  108. package/lib/commonjs/web/css/utils.js.map +1 -1
  109. package/lib/commonjs/web/index.js +1 -0
  110. package/lib/commonjs/web/index.js.map +1 -1
  111. package/lib/commonjs/web/listener.js +29 -8
  112. package/lib/commonjs/web/listener.js.map +1 -1
  113. package/lib/commonjs/web/registry.js.map +1 -1
  114. package/lib/commonjs/web/runtime.js +1 -2
  115. package/lib/commonjs/web/runtime.js.map +1 -1
  116. package/lib/commonjs/web/shadowRegistry.js.map +1 -1
  117. package/lib/commonjs/web/state.js +3 -3
  118. package/lib/commonjs/web/state.js.map +1 -1
  119. package/lib/commonjs/web/utils/common.js.map +1 -1
  120. package/lib/commonjs/web/utils/createUnistylesRef.js.map +1 -1
  121. package/lib/commonjs/web/utils/unistyle.js +2 -0
  122. package/lib/commonjs/web/utils/unistyle.js.map +1 -1
  123. package/lib/commonjs/web/variants.js.map +1 -1
  124. package/lib/commonjs/web-only/getWebProps.js.map +1 -1
  125. package/lib/commonjs/web-only/index.js.map +1 -1
  126. package/lib/module/components/AdaptiveTheme.js +1 -1
  127. package/lib/module/components/AdaptiveTheme.js.map +1 -1
  128. package/lib/module/components/ApplyScopedTheme.js.map +1 -1
  129. package/lib/module/components/Display.js.map +1 -1
  130. package/lib/module/components/Hide.js.map +1 -1
  131. package/lib/module/components/NamedTheme.js +2 -2
  132. package/lib/module/components/NamedTheme.js.map +1 -1
  133. package/lib/module/components/ScopedTheme.js.map +1 -1
  134. package/lib/module/components/native/ActivityIndicator.js.map +1 -1
  135. package/lib/module/components/native/Animated.js.map +1 -1
  136. package/lib/module/components/native/FlatList.js.map +1 -1
  137. package/lib/module/components/native/Image.js.map +1 -1
  138. package/lib/module/components/native/Image.native.js.map +1 -1
  139. package/lib/module/components/native/ImageBackground.js.map +1 -1
  140. package/lib/module/components/native/ImageBackground.native.js.map +1 -1
  141. package/lib/module/components/native/KeyboardAvoidingView.js.map +1 -1
  142. package/lib/module/components/native/NativeText.native.js.map +1 -1
  143. package/lib/module/components/native/NativeView.native.js.map +1 -1
  144. package/lib/module/components/native/Pressable.js.map +1 -1
  145. package/lib/module/components/native/Pressable.native.js.map +1 -1
  146. package/lib/module/components/native/RefreshControl.js.map +1 -1
  147. package/lib/module/components/native/SafeAreaView.js.map +1 -1
  148. package/lib/module/components/native/ScrollView.js.map +1 -1
  149. package/lib/module/components/native/SectionList.js.map +1 -1
  150. package/lib/module/components/native/Switch.js.map +1 -1
  151. package/lib/module/components/native/Text.js.map +1 -1
  152. package/lib/module/components/native/TextInput.js.map +1 -1
  153. package/lib/module/components/native/TouchableHighlight.js.map +1 -1
  154. package/lib/module/components/native/TouchableOpacity.js.map +1 -1
  155. package/lib/module/components/native/View.js.map +1 -1
  156. package/lib/module/components/native/VirtualizedList.js.map +1 -1
  157. package/lib/module/core/createUnistylesElement.js.map +1 -1
  158. package/lib/module/core/createUnistylesElement.native.js.map +1 -1
  159. package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
  160. package/lib/module/core/getClassname.js.map +1 -1
  161. package/lib/module/core/parseBoxShadow.js.map +1 -1
  162. package/lib/module/core/useProxifiedUnistyles/listener.js.map +1 -1
  163. package/lib/module/core/useProxifiedUnistyles/listener.native.js +0 -1
  164. package/lib/module/core/useProxifiedUnistyles/listener.native.js.map +1 -1
  165. package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js +16 -3
  166. package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
  167. package/lib/module/core/useUnistyles.js.map +1 -1
  168. package/lib/module/core/warn.js.map +1 -1
  169. package/lib/module/core/withUnistyles/withUnistyles.js +3 -1
  170. package/lib/module/core/withUnistyles/withUnistyles.js.map +1 -1
  171. package/lib/module/core/withUnistyles/withUnistyles.native.js +6 -0
  172. package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
  173. package/lib/module/hooks/useMedia.js.map +1 -1
  174. package/lib/module/hooks/useMedia.native.js +0 -1
  175. package/lib/module/hooks/useMedia.native.js.map +1 -1
  176. package/lib/module/index.js +1 -0
  177. package/lib/module/index.js.map +1 -1
  178. package/lib/module/mocks.js +28 -8
  179. package/lib/module/mocks.js.map +1 -1
  180. package/lib/module/mq.js.map +1 -1
  181. package/lib/module/reanimated/useAnimatedTheme.js.map +1 -1
  182. package/lib/module/reanimated/useAnimatedTheme.native.js +0 -1
  183. package/lib/module/reanimated/useAnimatedTheme.native.js.map +1 -1
  184. package/lib/module/reanimated/variant/useAnimatedVariantColor.js.map +1 -1
  185. package/lib/module/reanimated/variant/useUpdateVariantColor.js.map +1 -1
  186. package/lib/module/reanimated/variant/useUpdateVariantColor.native.js +0 -1
  187. package/lib/module/reanimated/variant/useUpdateVariantColor.native.js.map +1 -1
  188. package/lib/module/server/getServerUnistyles.js.map +1 -1
  189. package/lib/module/server/useServerUnistyles.js.map +1 -1
  190. package/lib/module/specs/NativePlatform/NativePlatform.nitro.js.map +1 -1
  191. package/lib/module/specs/ShadowRegistry/index.js +9 -5
  192. package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
  193. package/lib/module/specs/StatusBar/index.js.map +1 -1
  194. package/lib/module/specs/StyleSheet/index.js.map +1 -1
  195. package/lib/module/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -1
  196. package/lib/module/specs/UnistylesRuntime/index.js.map +1 -1
  197. package/lib/module/specs/index.native.js +1 -1
  198. package/lib/module/specs/index.native.js.map +1 -1
  199. package/lib/module/specs/types.js.map +1 -1
  200. package/lib/module/types/index.js.map +1 -1
  201. package/lib/module/types/stylesheet.js.map +1 -1
  202. package/lib/module/utils.js.map +1 -1
  203. package/lib/module/web/convert/index.js.map +1 -1
  204. package/lib/module/web/convert/object/boxShadow.js.map +1 -1
  205. package/lib/module/web/convert/object/filter.js.map +1 -1
  206. package/lib/module/web/convert/object/objectStyle.js.map +1 -1
  207. package/lib/module/web/convert/object/transform.js.map +1 -1
  208. package/lib/module/web/convert/pseudo.js.map +1 -1
  209. package/lib/module/web/convert/shadow/boxShadow.js.map +1 -1
  210. package/lib/module/web/convert/shadow/getShadowBreakpoints.js.map +1 -1
  211. package/lib/module/web/convert/shadow/textShadow.js.map +1 -1
  212. package/lib/module/web/convert/types.js.map +1 -1
  213. package/lib/module/web/convert/utils.js.map +1 -1
  214. package/lib/module/web/create.js +2 -6
  215. package/lib/module/web/create.js.map +1 -1
  216. package/lib/module/web/css/core.js.map +1 -1
  217. package/lib/module/web/css/state.js.map +1 -1
  218. package/lib/module/web/css/utils.js.map +1 -1
  219. package/lib/module/web/index.js +1 -0
  220. package/lib/module/web/index.js.map +1 -1
  221. package/lib/module/web/listener.js +29 -8
  222. package/lib/module/web/listener.js.map +1 -1
  223. package/lib/module/web/registry.js.map +1 -1
  224. package/lib/module/web/runtime.js +1 -2
  225. package/lib/module/web/runtime.js.map +1 -1
  226. package/lib/module/web/shadowRegistry.js.map +1 -1
  227. package/lib/module/web/state.js +3 -3
  228. package/lib/module/web/state.js.map +1 -1
  229. package/lib/module/web/utils/common.js.map +1 -1
  230. package/lib/module/web/utils/createUnistylesRef.js.map +1 -1
  231. package/lib/module/web/utils/unistyle.js +2 -0
  232. package/lib/module/web/utils/unistyle.js.map +1 -1
  233. package/lib/module/web/variants.js.map +1 -1
  234. package/lib/module/web-only/getWebProps.js.map +1 -1
  235. package/lib/module/web-only/index.js.map +1 -1
  236. package/lib/typescript/src/__tests__/mocks.spec.d.ts +2 -0
  237. package/lib/typescript/src/__tests__/mocks.spec.d.ts.map +1 -0
  238. package/lib/typescript/src/__tests__/web-listener.spec.d.ts +2 -0
  239. package/lib/typescript/src/__tests__/web-listener.spec.d.ts.map +1 -0
  240. package/lib/typescript/src/components/AdaptiveTheme.d.ts +1 -1
  241. package/lib/typescript/src/components/AdaptiveTheme.d.ts.map +1 -1
  242. package/lib/typescript/src/components/ApplyScopedTheme.d.ts.map +1 -1
  243. package/lib/typescript/src/components/Display.d.ts.map +1 -1
  244. package/lib/typescript/src/components/Hide.d.ts.map +1 -1
  245. package/lib/typescript/src/components/NamedTheme.d.ts +1 -1
  246. package/lib/typescript/src/components/NamedTheme.d.ts.map +1 -1
  247. package/lib/typescript/src/components/ScopedTheme.d.ts.map +1 -1
  248. package/lib/typescript/src/components/native/ActivityIndicator.d.ts.map +1 -1
  249. package/lib/typescript/src/components/native/Animated.d.ts.map +1 -1
  250. package/lib/typescript/src/components/native/FlatList.d.ts.map +1 -1
  251. package/lib/typescript/src/components/native/Image.d.ts.map +1 -1
  252. package/lib/typescript/src/components/native/Image.native.d.ts.map +1 -1
  253. package/lib/typescript/src/components/native/ImageBackground.d.ts.map +1 -1
  254. package/lib/typescript/src/components/native/ImageBackground.native.d.ts.map +1 -1
  255. package/lib/typescript/src/components/native/KeyboardAvoidingView.d.ts.map +1 -1
  256. package/lib/typescript/src/components/native/NativeText.native.d.ts.map +1 -1
  257. package/lib/typescript/src/components/native/NativeView.native.d.ts.map +1 -1
  258. package/lib/typescript/src/components/native/Pressable.d.ts +1 -1
  259. package/lib/typescript/src/components/native/Pressable.d.ts.map +1 -1
  260. package/lib/typescript/src/components/native/Pressable.native.d.ts +1 -1
  261. package/lib/typescript/src/components/native/Pressable.native.d.ts.map +1 -1
  262. package/lib/typescript/src/components/native/RefreshControl.d.ts.map +1 -1
  263. package/lib/typescript/src/components/native/SafeAreaView.d.ts.map +1 -1
  264. package/lib/typescript/src/components/native/ScrollView.d.ts.map +1 -1
  265. package/lib/typescript/src/components/native/SectionList.d.ts.map +1 -1
  266. package/lib/typescript/src/components/native/Switch.d.ts.map +1 -1
  267. package/lib/typescript/src/components/native/Text.d.ts.map +1 -1
  268. package/lib/typescript/src/components/native/TextInput.d.ts.map +1 -1
  269. package/lib/typescript/src/components/native/TouchableHighlight.d.ts.map +1 -1
  270. package/lib/typescript/src/components/native/TouchableOpacity.d.ts.map +1 -1
  271. package/lib/typescript/src/components/native/View.d.ts.map +1 -1
  272. package/lib/typescript/src/components/native/VirtualizedList.d.ts.map +1 -1
  273. package/lib/typescript/src/core/createUnistylesElement.d.ts.map +1 -1
  274. package/lib/typescript/src/core/createUnistylesElement.native.d.ts.map +1 -1
  275. package/lib/typescript/src/core/createUnistylesImageBackground.d.ts.map +1 -1
  276. package/lib/typescript/src/core/getClassname.d.ts.map +1 -1
  277. package/lib/typescript/src/core/parseBoxShadow.d.ts.map +1 -1
  278. package/lib/typescript/src/core/useProxifiedUnistyles/listener.d.ts.map +1 -1
  279. package/lib/typescript/src/core/useProxifiedUnistyles/listener.native.d.ts +1 -1
  280. package/lib/typescript/src/core/useProxifiedUnistyles/listener.native.d.ts.map +1 -1
  281. package/lib/typescript/src/core/useProxifiedUnistyles/types.d.ts.map +1 -1
  282. package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts +1 -1
  283. package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts.map +1 -1
  284. package/lib/typescript/src/core/useUnistyles.d.ts.map +1 -1
  285. package/lib/typescript/src/core/withUnistyles/types.d.ts +1 -1
  286. package/lib/typescript/src/core/withUnistyles/types.d.ts.map +1 -1
  287. package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts.map +1 -1
  288. package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
  289. package/lib/typescript/src/global.d.ts.map +1 -1
  290. package/lib/typescript/src/hooks/useMedia.d.ts.map +1 -1
  291. package/lib/typescript/src/hooks/useMedia.native.d.ts.map +1 -1
  292. package/lib/typescript/src/index.d.ts +1 -0
  293. package/lib/typescript/src/index.d.ts.map +1 -1
  294. package/lib/typescript/src/mq.d.ts.map +1 -1
  295. package/lib/typescript/src/reanimated/useAnimatedTheme.d.ts.map +1 -1
  296. package/lib/typescript/src/reanimated/useAnimatedTheme.native.d.ts.map +1 -1
  297. package/lib/typescript/src/reanimated/variant/types.d.ts.map +1 -1
  298. package/lib/typescript/src/reanimated/variant/useAnimatedVariantColor.d.ts.map +1 -1
  299. package/lib/typescript/src/reanimated/variant/useUpdateVariantColor.d.ts +1 -1
  300. package/lib/typescript/src/reanimated/variant/useUpdateVariantColor.d.ts.map +1 -1
  301. package/lib/typescript/src/reanimated/variant/useUpdateVariantColor.native.d.ts +1 -1
  302. package/lib/typescript/src/reanimated/variant/useUpdateVariantColor.native.d.ts.map +1 -1
  303. package/lib/typescript/src/server/getServerUnistyles.d.ts +1 -1
  304. package/lib/typescript/src/server/getServerUnistyles.d.ts.map +1 -1
  305. package/lib/typescript/src/server/types.d.ts.map +1 -1
  306. package/lib/typescript/src/server/useServerUnistyles.d.ts.map +1 -1
  307. package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts.map +1 -1
  308. package/lib/typescript/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.d.ts.map +1 -1
  309. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
  310. package/lib/typescript/src/specs/ShadowRegistry/types.d.ts +4 -5
  311. package/lib/typescript/src/specs/ShadowRegistry/types.d.ts.map +1 -1
  312. package/lib/typescript/src/specs/StatusBar/UnistylesStatusBar.nitro.d.ts.map +1 -1
  313. package/lib/typescript/src/specs/StatusBar/index.d.ts +1 -1
  314. package/lib/typescript/src/specs/StatusBar/index.d.ts.map +1 -1
  315. package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts +0 -1
  316. package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts.map +1 -1
  317. package/lib/typescript/src/specs/StyleSheet/index.d.ts +3 -3
  318. package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
  319. package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts.map +1 -1
  320. package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts +1 -1
  321. package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts.map +1 -1
  322. package/lib/typescript/src/specs/index.native.d.ts +4 -4
  323. package/lib/typescript/src/specs/index.native.d.ts.map +1 -1
  324. package/lib/typescript/src/specs/types.d.ts.map +1 -1
  325. package/lib/typescript/src/types/breakpoints.d.ts +2 -2
  326. package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
  327. package/lib/typescript/src/types/core.d.ts.map +1 -1
  328. package/lib/typescript/src/types/index.d.ts +1 -1
  329. package/lib/typescript/src/types/index.d.ts.map +1 -1
  330. package/lib/typescript/src/types/stylesheet.d.ts +1 -1
  331. package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
  332. package/lib/typescript/src/types/variants.d.ts.map +1 -1
  333. package/lib/typescript/src/utils.d.ts.map +1 -1
  334. package/lib/typescript/src/web/convert/index.d.ts.map +1 -1
  335. package/lib/typescript/src/web/convert/object/boxShadow.d.ts.map +1 -1
  336. package/lib/typescript/src/web/convert/object/filter.d.ts.map +1 -1
  337. package/lib/typescript/src/web/convert/object/objectStyle.d.ts.map +1 -1
  338. package/lib/typescript/src/web/convert/object/transform.d.ts.map +1 -1
  339. package/lib/typescript/src/web/convert/pseudo.d.ts.map +1 -1
  340. package/lib/typescript/src/web/convert/types.d.ts +2 -2
  341. package/lib/typescript/src/web/convert/types.d.ts.map +1 -1
  342. package/lib/typescript/src/web/convert/utils.d.ts.map +1 -1
  343. package/lib/typescript/src/web/create.d.ts +1 -1
  344. package/lib/typescript/src/web/create.d.ts.map +1 -1
  345. package/lib/typescript/src/web/css/core.d.ts.map +1 -1
  346. package/lib/typescript/src/web/css/state.d.ts.map +1 -1
  347. package/lib/typescript/src/web/css/utils.d.ts.map +1 -1
  348. package/lib/typescript/src/web/index.d.ts.map +1 -1
  349. package/lib/typescript/src/web/listener.d.ts +5 -1
  350. package/lib/typescript/src/web/listener.d.ts.map +1 -1
  351. package/lib/typescript/src/web/registry.d.ts +1 -1
  352. package/lib/typescript/src/web/registry.d.ts.map +1 -1
  353. package/lib/typescript/src/web/runtime.d.ts +1 -1
  354. package/lib/typescript/src/web/runtime.d.ts.map +1 -1
  355. package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
  356. package/lib/typescript/src/web/state.d.ts.map +1 -1
  357. package/lib/typescript/src/web/types.d.ts +1 -1
  358. package/lib/typescript/src/web/types.d.ts.map +1 -1
  359. package/lib/typescript/src/web/utils/common.d.ts.map +1 -1
  360. package/lib/typescript/src/web/utils/createUnistylesRef.d.ts.map +1 -1
  361. package/lib/typescript/src/web/utils/unistyle.d.ts +1 -1
  362. package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
  363. package/lib/typescript/src/web/variants.d.ts.map +1 -1
  364. package/lib/typescript/src/web-only/getWebProps.d.ts.map +1 -1
  365. package/lib/typescript/src/web-only/index.d.ts.map +1 -1
  366. package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +36 -42
  367. package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +19 -22
  368. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +15 -18
  369. package/nitrogen/generated/android/unistylesOnLoad.cpp +14 -9
  370. package/nitrogen/generated/android/unistylesOnLoad.hpp +13 -4
  371. package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.cpp +0 -1
  372. package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.hpp +0 -1
  373. package/package.json +43 -44
  374. package/plugin/index.d.ts +34 -28
  375. package/plugin/index.js +113 -103
  376. package/repack-plugin/index.d.ts +2 -2
  377. package/src/components/AdaptiveTheme.tsx +8 -12
  378. package/src/components/ApplyScopedTheme.tsx +2 -0
  379. package/src/components/Display.tsx +2 -3
  380. package/src/components/Hide.tsx +2 -3
  381. package/src/components/NamedTheme.tsx +9 -14
  382. package/src/components/ScopedTheme.tsx +22 -27
  383. package/src/components/native/ActivityIndicator.tsx +1 -0
  384. package/src/components/native/Animated.tsx +2 -1
  385. package/src/components/native/FlatList.tsx +1 -0
  386. package/src/components/native/Image.native.tsx +1 -0
  387. package/src/components/native/Image.tsx +11 -7
  388. package/src/components/native/ImageBackground.native.tsx +1 -0
  389. package/src/components/native/ImageBackground.tsx +11 -7
  390. package/src/components/native/KeyboardAvoidingView.tsx +1 -0
  391. package/src/components/native/NativeText.native.tsx +3 -1
  392. package/src/components/native/NativeView.native.tsx +3 -1
  393. package/src/components/native/Pressable.native.tsx +8 -8
  394. package/src/components/native/Pressable.tsx +25 -20
  395. package/src/components/native/RefreshControl.tsx +1 -0
  396. package/src/components/native/SafeAreaView.tsx +1 -0
  397. package/src/components/native/ScrollView.tsx +1 -0
  398. package/src/components/native/SectionList.tsx +1 -0
  399. package/src/components/native/Switch.tsx +1 -0
  400. package/src/components/native/Text.tsx +1 -0
  401. package/src/components/native/TextInput.tsx +1 -0
  402. package/src/components/native/TouchableHighlight.tsx +1 -0
  403. package/src/components/native/TouchableOpacity.tsx +1 -0
  404. package/src/components/native/View.tsx +1 -0
  405. package/src/components/native/VirtualizedList.tsx +1 -0
  406. package/src/core/createUnistylesElement.native.tsx +4 -2
  407. package/src/core/createUnistylesElement.tsx +14 -17
  408. package/src/core/createUnistylesImageBackground.tsx +6 -4
  409. package/src/core/getClassname.ts +4 -11
  410. package/src/core/parseBoxShadow.ts +11 -24
  411. package/src/core/passForwardRef.ts +1 -1
  412. package/src/core/useProxifiedUnistyles/listener.native.ts +3 -3
  413. package/src/core/useProxifiedUnistyles/listener.ts +10 -3
  414. package/src/core/useProxifiedUnistyles/types.ts +2 -2
  415. package/src/core/useProxifiedUnistyles/useProxifiedUnistyles.ts +33 -14
  416. package/src/core/useUnistyles.ts +2 -1
  417. package/src/core/warn.ts +4 -4
  418. package/src/core/withUnistyles/types.ts +7 -4
  419. package/src/core/withUnistyles/withUnistyles.native.tsx +53 -44
  420. package/src/core/withUnistyles/withUnistyles.tsx +30 -24
  421. package/src/global.ts +2 -2
  422. package/src/hooks/useMedia.native.ts +2 -2
  423. package/src/hooks/useMedia.ts +6 -3
  424. package/src/index.ts +1 -0
  425. package/src/mocks.ts +74 -49
  426. package/src/mq.ts +23 -15
  427. package/src/reanimated/useAnimatedTheme.native.ts +4 -3
  428. package/src/reanimated/useAnimatedTheme.ts +6 -2
  429. package/src/reanimated/variant/types.ts +11 -10
  430. package/src/reanimated/variant/useAnimatedVariantColor.ts +7 -7
  431. package/src/reanimated/variant/useUpdateVariantColor.native.ts +10 -6
  432. package/src/reanimated/variant/useUpdateVariantColor.ts +21 -21
  433. package/src/server/getServerUnistyles.tsx +11 -4
  434. package/src/server/index.ts +0 -1
  435. package/src/server/types.ts +1 -1
  436. package/src/server/useServerUnistyles.tsx +4 -1
  437. package/src/specs/NativePlatform/NativePlatform.nitro.ts +30 -27
  438. package/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.ts +3 -3
  439. package/src/specs/ShadowRegistry/ShadowRegistry.nitro.ts +1 -1
  440. package/src/specs/ShadowRegistry/index.ts +35 -29
  441. package/src/specs/ShadowRegistry/types.ts +9 -10
  442. package/src/specs/StatusBar/UnistylesStatusBar.nitro.ts +4 -4
  443. package/src/specs/StatusBar/index.ts +5 -5
  444. package/src/specs/StyleSheet/UnistylesStyleSheet.nitro.ts +2 -2
  445. package/src/specs/StyleSheet/index.ts +32 -27
  446. package/src/specs/TurboUnistyles/NativeTurboUnistyles.ts +1 -0
  447. package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +26 -25
  448. package/src/specs/UnistylesRuntime/index.ts +20 -20
  449. package/src/specs/index.native.ts +6 -18
  450. package/src/specs/types.ts +9 -8
  451. package/src/types/accessibility.ts +2 -2
  452. package/src/types/breakpoints.ts +61 -59
  453. package/src/types/core.ts +17 -17
  454. package/src/types/index.ts +2 -9
  455. package/src/types/stylesheet.ts +27 -19
  456. package/src/types/variants.ts +3 -11
  457. package/src/utils.ts +16 -16
  458. package/src/web/convert/index.ts +6 -2
  459. package/src/web/convert/object/boxShadow.ts +23 -18
  460. package/src/web/convert/object/filter.ts +30 -13
  461. package/src/web/convert/object/objectStyle.ts +33 -23
  462. package/src/web/convert/object/transform.ts +10 -8
  463. package/src/web/convert/pseudo.ts +2 -2
  464. package/src/web/convert/shadow/boxShadow.ts +6 -6
  465. package/src/web/convert/shadow/getShadowBreakpoints.ts +4 -4
  466. package/src/web/convert/shadow/textShadow.ts +6 -6
  467. package/src/web/convert/style.ts +25 -25
  468. package/src/web/convert/types.ts +4 -3
  469. package/src/web/convert/utils.ts +20 -10
  470. package/src/web/create.ts +29 -20
  471. package/src/web/css/core.ts +2 -1
  472. package/src/web/css/state.ts +11 -8
  473. package/src/web/css/utils.ts +2 -1
  474. package/src/web/index.ts +7 -4
  475. package/src/web/listener.ts +61 -18
  476. package/src/web/mock.ts +2 -2
  477. package/src/web/registry.ts +17 -10
  478. package/src/web/runtime.ts +23 -17
  479. package/src/web/shadowRegistry.ts +26 -24
  480. package/src/web/state.ts +23 -16
  481. package/src/web/types.ts +5 -5
  482. package/src/web/utils/common.ts +7 -9
  483. package/src/web/utils/createUnistylesRef.ts +18 -14
  484. package/src/web/utils/unistyle.ts +53 -34
  485. package/src/web/variants.ts +19 -11
  486. package/src/web-only/getWebProps.ts +5 -6
  487. package/src/web-only/index.ts +0 -1
  488. package/LICENSE +0 -20
  489. package/README.md +0 -172
  490. package/lib/typescript/plugin/src/consts.d.ts +0 -17
  491. package/lib/typescript/plugin/src/consts.d.ts.map +0 -1
  492. package/lib/typescript/repack-plugin/src/index.d.ts +0 -18
  493. package/lib/typescript/repack-plugin/src/index.d.ts.map +0 -1
  494. package/lib/typescript/repack-plugin/src/loader.d.ts +0 -9
  495. package/lib/typescript/repack-plugin/src/loader.d.ts.map +0 -1
@@ -11,7 +11,7 @@ export enum IOSContentSizeCategory {
11
11
  Medium = 'Medium',
12
12
  Small = 'Small',
13
13
  ExtraSmall = 'xSmall',
14
- Unspecified = 'unspecified'
14
+ Unspecified = 'unspecified',
15
15
  }
16
16
 
17
17
  export enum AndroidContentSizeCategory {
@@ -21,7 +21,7 @@ export enum AndroidContentSizeCategory {
21
21
  ExtraLarge = 'ExtraLarge',
22
22
  Huge = 'Huge',
23
23
  ExtraHuge = 'ExtraHuge',
24
- ExtraExtraHuge = 'ExtraExtraHuge'
24
+ ExtraExtraHuge = 'ExtraExtraHuge',
25
25
  }
26
26
 
27
27
  export enum WebContentSizeCategory {
@@ -1,22 +1,21 @@
1
1
  import type { ColorValue, OpaqueColorValue } from 'react-native'
2
+
2
3
  import type { SafeReturnType, UnionToIntersection } from './common'
3
4
  import type { TransformStyles } from './core'
4
5
  import type { BreakpointsOrMediaQueries, ToDeepUnistyles } from './stylesheet'
5
6
 
6
- type ExtractTransformArray<T> = T extends object
7
- ? { [K in keyof T]: ExtractBreakpoints<T[K]> }
8
- : never
7
+ type ExtractTransformArray<T> = T extends object ? { [K in keyof T]: ExtractBreakpoints<T[K]> } : never
9
8
 
10
9
  type ExtractBreakpoints<T> = T extends object
11
10
  ? keyof T extends BreakpointsOrMediaQueries
12
11
  ? T[keyof T]
13
12
  : T extends Array<ToDeepUnistyles<TransformStyles>>
14
- ? Array<ExtractTransformArray<T[number]>>
15
- : T extends Array<infer _U>
16
- ? T
17
- : {
18
- [K in keyof T]: ExtractBreakpoints<T[K]>
19
- }
13
+ ? Array<ExtractTransformArray<T[number]>>
14
+ : T extends Array<infer _U>
15
+ ? T
16
+ : {
17
+ [K in keyof T]: ExtractBreakpoints<T[K]>
18
+ }
20
19
  : T
21
20
 
22
21
  // Helper type to check if the base styles (without variants) are truly empty or just {}
@@ -25,48 +24,53 @@ type IsEmptyObject<T> = T extends Record<string, never> ? true : keyof T extends
25
24
  type ParseNestedObject<T, ShouldFlatten> = T extends (...args: infer A) => infer R
26
25
  ? (...args: A) => ParseNestedObject<R, false>
27
26
  : T extends object
28
- ? T extends { variants: infer R, compoundVariants: infer C }
29
- ? (ParseVariants<FlattenVariants<R, false>> & FlattenCompoundVariants<C, false> & ParseNestedObject<Omit<T, 'variants' | 'compoundVariants'>, false>) extends never
30
- ? ParseVariants<FlattenVariants<R, true>> & FlattenCompoundVariants<C, true> & ParseNestedObject<Omit<T, 'variants' | 'compoundVariants'>, false>
31
- : ParseVariants<FlattenVariants<R, false>> & FlattenCompoundVariants<C, false> & ParseNestedObject<Omit<T, 'variants' | 'compoundVariants'>, false>
32
- : T extends { variants: infer R }
33
- ? IsEmptyObject<ParseNestedObject<Omit<T, 'variants'>, false>> extends true
34
- ? ParseVariants<FlattenVariants<R, false>>
35
- : (ParseVariants<FlattenVariants<R, false>> & ParseNestedObject<Omit<T, 'variants'>, false>) extends never
36
- ? ParseVariants<FlattenVariants<R, true>> & ParseNestedObject<Omit<T, 'variants'>, false>
37
- : ParseVariants<FlattenVariants<R, false>> & ParseNestedObject<Omit<T, 'variants'>, false>
38
- : T extends { compoundVariants: object }
39
- ? ParseNestedObject<Omit<T, 'compoundVariants'>, false>
40
- : {
41
- [K in keyof T as K extends '_web' ? never : K]: T[K] extends object
42
- ? T[K] extends OpaqueColorValue
43
- ? ColorValue
44
- : ExtractBreakpoints<T[K]>
45
- : T[K] extends string
46
- ? ShouldFlatten extends true
47
- ? string
48
- : T[K]
49
- : T[K]
50
- }
51
- : T
27
+ ? T extends { variants: infer R; compoundVariants: infer C }
28
+ ? ParseVariants<FlattenVariants<R, false>> &
29
+ FlattenCompoundVariants<C, false> &
30
+ ParseNestedObject<Omit<T, 'variants' | 'compoundVariants'>, false> extends never
31
+ ? ParseVariants<FlattenVariants<R, true>> &
32
+ FlattenCompoundVariants<C, true> &
33
+ ParseNestedObject<Omit<T, 'variants' | 'compoundVariants'>, false>
34
+ : ParseVariants<FlattenVariants<R, false>> &
35
+ FlattenCompoundVariants<C, false> &
36
+ ParseNestedObject<Omit<T, 'variants' | 'compoundVariants'>, false>
37
+ : T extends { variants: infer R }
38
+ ? IsEmptyObject<ParseNestedObject<Omit<T, 'variants'>, false>> extends true
39
+ ? ParseVariants<FlattenVariants<R, false>>
40
+ : ParseVariants<FlattenVariants<R, false>> & ParseNestedObject<Omit<T, 'variants'>, false> extends never
41
+ ? ParseVariants<FlattenVariants<R, true>> & ParseNestedObject<Omit<T, 'variants'>, false>
42
+ : ParseVariants<FlattenVariants<R, false>> & ParseNestedObject<Omit<T, 'variants'>, false>
43
+ : T extends { compoundVariants: object }
44
+ ? ParseNestedObject<Omit<T, 'compoundVariants'>, false>
45
+ : {
46
+ [K in keyof T as K extends '_web' ? never : K]: T[K] extends object
47
+ ? T[K] extends OpaqueColorValue
48
+ ? ColorValue
49
+ : ExtractBreakpoints<T[K]>
50
+ : T[K] extends string
51
+ ? ShouldFlatten extends true
52
+ ? string
53
+ : T[K]
54
+ : T[K]
55
+ }
56
+ : T
52
57
 
53
58
  type FlattenVariants<T, ShouldFlatten> = T extends object
54
59
  ? {
55
- [K in keyof T]: T[K] extends object
56
- ? {
57
- [key in keyof T[K]]: T[K][key] extends object
58
- ? ParseNestedObject<T[K][key], ShouldFlatten>
59
- : never
60
- }
61
- : never
62
- }
60
+ [K in keyof T]: T[K] extends object
61
+ ? {
62
+ [key in keyof T[K]]: T[K][key] extends object ? ParseNestedObject<T[K][key], ShouldFlatten> : never
63
+ }
64
+ : never
65
+ }
63
66
  : never
64
67
 
65
- type FlattenCompoundVariants<T, ShouldFlatten> = T extends Array<infer _>
66
- ? FlattenCompoundVariants<T[number], ShouldFlatten>
67
- : T extends { styles: infer S }
68
- ? ParseNestedObject<S, ShouldFlatten>
69
- : never
68
+ type FlattenCompoundVariants<T, ShouldFlatten> =
69
+ T extends Array<infer _>
70
+ ? FlattenCompoundVariants<T[number], ShouldFlatten>
71
+ : T extends { styles: infer S }
72
+ ? ParseNestedObject<S, ShouldFlatten>
73
+ : never
70
74
 
71
75
  type IsNonEmpty<T> = T extends object ? (keyof T extends never ? false : true) : false
72
76
 
@@ -74,18 +78,18 @@ type IntersectCategoryValues<T> = T extends object
74
78
  ? T extends Array<any>
75
79
  ? T
76
80
  : UnionToIntersection<T[keyof T]> extends infer R
77
- ? R extends never
78
- ? T[keyof T]
79
- : R
80
- : never
81
+ ? R extends never
82
+ ? T[keyof T]
83
+ : R
84
+ : never
81
85
  : never
82
86
 
83
87
  type MergeVariantCategories<T> = T extends object
84
88
  ? UnionToIntersection<
85
- {
86
- [K in keyof T]: IsNonEmpty<T[K]> extends true ? T[K] : never
87
- }[keyof T]
88
- > extends infer R
89
+ {
90
+ [K in keyof T]: IsNonEmpty<T[K]> extends true ? T[K] : never
91
+ }[keyof T]
92
+ > extends infer R
89
93
  ? R extends never
90
94
  ? NonNullable<T[keyof T]>
91
95
  : R
@@ -97,13 +101,11 @@ type ParseVariants<T> = T extends object
97
101
  ? T[keyof T] extends Array<any>
98
102
  ? T
99
103
  : MergeVariantCategories<{
100
- [K in keyof T]: T[K] extends object ? IntersectCategoryValues<T[K]> : never
101
- }>
104
+ [K in keyof T]: T[K] extends object ? IntersectCategoryValues<T[K]> : never
105
+ }>
102
106
  : T
103
107
  : T
104
108
 
105
- type ParseStyleKeys<T> = T extends object
106
- ? { [K in keyof T]: ParseNestedObject<T[K], false> }
107
- : never
109
+ type ParseStyleKeys<T> = T extends object ? { [K in keyof T]: ParseNestedObject<T[K], false> } : never
108
110
 
109
111
  export type ReactNativeStyleSheet<T> = ParseStyleKeys<SafeReturnType<T>>
package/src/types/core.ts CHANGED
@@ -12,32 +12,32 @@ import type {
12
12
  SkewXTransform,
13
13
  SkewYTransform,
14
14
  TranslateXTransform,
15
- TranslateYTransform
15
+ TranslateYTransform,
16
16
  } from 'react-native/Libraries/StyleSheet/StyleSheetTypes'
17
+
17
18
  import type { UnistylesBreakpoints, UnistylesThemes } from '../global'
18
19
 
19
20
  export type ShadowOffset = {
20
- width: number,
21
+ width: number
21
22
  height: number
22
23
  }
23
24
 
24
- export type TransformStyles =
25
- & PerspectiveTransform
26
- & RotateTransform
27
- & RotateXTransform
28
- & RotateYTransform
29
- & RotateZTransform
30
- & ScaleTransform
31
- & ScaleXTransform
32
- & ScaleYTransform
33
- & TranslateXTransform
34
- & TranslateYTransform
35
- & SkewXTransform
36
- & SkewYTransform
37
- & MatrixTransform
25
+ export type TransformStyles = PerspectiveTransform &
26
+ RotateTransform &
27
+ RotateXTransform &
28
+ RotateYTransform &
29
+ RotateZTransform &
30
+ ScaleTransform &
31
+ ScaleXTransform &
32
+ ScaleYTransform &
33
+ TranslateXTransform &
34
+ TranslateYTransform &
35
+ SkewXTransform &
36
+ SkewYTransform &
37
+ MatrixTransform
38
38
 
39
39
  export type ScreenSize = {
40
- width: number,
40
+ width: number
41
41
  height: number
42
42
  }
43
43
 
@@ -1,12 +1,5 @@
1
1
  export type { Optional, Nullable, UnionToIntersection } from './common'
2
- export type {
3
- NestedStylePairs,
4
- UnistylesTheme,
5
- ScreenSize,
6
- NestedStyle,
7
- RNValue,
8
- RNStyle
9
- } from './core'
2
+ export type { NestedStylePairs, UnistylesTheme, ScreenSize, NestedStyle, RNValue, RNStyle } from './core'
10
3
  export type {
11
4
  CreateUnistylesStyleSheet,
12
5
  StyleSheet,
@@ -14,7 +7,7 @@ export type {
14
7
  UnistylesValues,
15
8
  UnistyleText,
16
9
  UnistyleView,
17
- UnistyleImage
10
+ UnistyleImage,
18
11
  } from './stylesheet'
19
12
  export type { ReactNativeStyleSheet } from './breakpoints'
20
13
  export type { ExtractVariantNames, UnistylesVariants } from './variants'
@@ -1,5 +1,6 @@
1
1
  import type { CSSProperties } from 'react'
2
2
  import type { BoxShadowValue, FilterFunction, ImageStyle, TextStyle, ViewStyle } from 'react-native'
3
+
3
4
  import type { UnistylesBreakpoints } from '../global'
4
5
  import type { UnistylesMiniRuntime } from '../specs'
5
6
  import type { Pseudo } from '../web/convert/pseudo'
@@ -15,10 +16,10 @@ export type UnistyleText = Omit<TextStyle, NestedKeys>
15
16
  export type UnistyleImage = Omit<ImageStyle, NestedKeys>
16
17
 
17
18
  type UnistyleNestedStyles = {
18
- shadowOffset?: ToDeepUnistyles<ShadowOffset>,
19
- textShadowOffset?: ToDeepUnistyles<ShadowOffset>,
20
- transform?: Array<ToDeepUnistyles<TransformStyles>>,
21
- boxShadow?: Array<ToDeepUnistyles<BoxShadowValue>> | string,
19
+ shadowOffset?: ToDeepUnistyles<ShadowOffset>
20
+ textShadowOffset?: ToDeepUnistyles<ShadowOffset>
21
+ transform?: Array<ToDeepUnistyles<TransformStyles>>
22
+ boxShadow?: Array<ToDeepUnistyles<BoxShadowValue>> | string
22
23
  filter?: Array<ToDeepUnistyles<FilterFunction>> | string
23
24
  }
24
25
 
@@ -37,14 +38,16 @@ type CompoundVariant = {
37
38
  }
38
39
 
39
40
  type VariantsAndCompoundVariants = {
40
- variants?: VariantsObject,
41
+ variants?: VariantsObject
41
42
  compoundVariants?: Array<CompoundVariant>
42
43
  }
43
44
 
44
45
  export type ToDeepUnistyles<T> = {
45
- [K in keyof T]?: T[K] | {
46
- [key in BreakpointsOrMediaQueries]?: T[K]
47
- }
46
+ [K in keyof T]?:
47
+ | T[K]
48
+ | {
49
+ [key in BreakpointsOrMediaQueries]?: T[K]
50
+ }
48
51
  }
49
52
 
50
53
  type AllAvailableStyles = UnistyleView & UnistyleText & UnistyleImage & UnistyleNestedStyles
@@ -53,19 +56,21 @@ export type AllAvailableKeys = keyof (UnistyleView & UnistyleText & UnistyleImag
53
56
  export type BreakpointsOrMediaQueries = keyof UnistylesBreakpoints | symbol
54
57
 
55
58
  type FlatUnistylesValues = {
56
- [propName in AllAvailableKeys]?: AllAvailableStyles[propName] | {
57
- [key in BreakpointsOrMediaQueries]?: AllAvailableStyles[propName]
58
- }
59
+ [propName in AllAvailableKeys]?:
60
+ | AllAvailableStyles[propName]
61
+ | {
62
+ [key in BreakpointsOrMediaQueries]?: AllAvailableStyles[propName]
63
+ }
59
64
  }
60
65
 
61
- export type UnistylesValues = FlatUnistylesValues & {
62
- } & VariantsAndCompoundVariants & {
63
- [propName in NestedKeys]?: UnistyleNestedStyles[propName]
64
- } & {
65
- _web?: ToDeepUnistyles<CSSProperties> & CustomClassName & {
66
- [propName in Pseudo]?: ToDeepUnistyles<CSSProperties>
66
+ export type UnistylesValues = FlatUnistylesValues & {} & VariantsAndCompoundVariants & {
67
+ [propName in NestedKeys]?: UnistyleNestedStyles[propName]
68
+ } & {
69
+ _web?: ToDeepUnistyles<CSSProperties> &
70
+ CustomClassName & {
71
+ [propName in Pseudo]?: ToDeepUnistyles<CSSProperties>
72
+ }
67
73
  }
68
- }
69
74
 
70
75
  export type StyleSheet = {
71
76
  [styleName: string]: UnistylesValues | ((...args: any) => UnistylesValues)
@@ -79,6 +84,9 @@ type UseVariantsFn<T> = {
79
84
  useVariants: (variants: ExtractVariantNames<T>) => void
80
85
  }
81
86
 
82
- const create = <S extends StyleSheet>(stylesheet: StyleSheetWithSuperPowers<S>): (ReactNativeStyleSheet<S> & UseVariantsFn<typeof stylesheet>) => stylesheet as (ReactNativeStyleSheet<S> & UseVariantsFn<typeof stylesheet>)
87
+ const create = <S extends StyleSheet>(
88
+ stylesheet: StyleSheetWithSuperPowers<S>,
89
+ ): ReactNativeStyleSheet<S> & UseVariantsFn<typeof stylesheet> =>
90
+ stylesheet as ReactNativeStyleSheet<S> & UseVariantsFn<typeof stylesheet>
83
91
 
84
92
  export type CreateUnistylesStyleSheet = typeof create
@@ -2,15 +2,9 @@ import type { SafeReturnType } from './common'
2
2
 
3
3
  export type ExtractVariantNames<T> = ExtractVariantKeys<SafeReturnType<T>>
4
4
 
5
- type ExtractVariantKeys<T> = T extends object
6
- ? ExtractVariant<SafeReturnType<T[keyof T]>>
7
- : never
5
+ type ExtractVariantKeys<T> = T extends object ? ExtractVariant<SafeReturnType<T[keyof T]>> : never
8
6
 
9
- type HasBooleanVariants<T> = T extends Record<'true', any>
10
- ? true
11
- : T extends Record<'false', any>
12
- ? true
13
- : false
7
+ type HasBooleanVariants<T> = T extends Record<'true', any> ? true : T extends Record<'false', any> ? true : false
14
8
 
15
9
  type ExtractSubVariantKeys<T> = T extends object
16
10
  ? HasBooleanVariants<T> extends true
@@ -18,9 +12,7 @@ type ExtractSubVariantKeys<T> = T extends object
18
12
  : keyof Omit<T, 'default'> | undefined
19
13
  : never
20
14
 
21
- type ExtractVariant<T> = T extends { variants: infer V }
22
- ? { [key in keyof V]?: ExtractSubVariantKeys<V[key]> }
23
- : never
15
+ type ExtractVariant<T> = T extends { variants: infer V } ? { [key in keyof V]?: ExtractSubVariantKeys<V[key]> } : never
24
16
 
25
17
  export type UnistylesVariants<ST> = ST extends { useVariants: infer V }
26
18
  ? V extends (variants: infer T) => void
package/src/utils.ts CHANGED
@@ -3,22 +3,20 @@ export const isDefined = <T>(value: T): value is NonNullable<T> => value !== und
3
3
  export const deepMergeObjects = <T extends Record<PropertyKey, any>>(...sources: Array<T>) => {
4
4
  const target = {} as T
5
5
 
6
- sources
7
- .filter(isDefined)
8
- .forEach(source => {
9
- Object.keys(source).forEach(key => {
10
- const sourceValue = source[key]
11
- const targetValue = target[key]
6
+ sources.filter(isDefined).forEach((source) => {
7
+ Object.keys(source).forEach((key) => {
8
+ const sourceValue = source[key]
9
+ const targetValue = target[key]
12
10
 
13
- if (Object(sourceValue) === sourceValue && Object(targetValue) === targetValue) {
14
- // @ts-expect-error - can't assign to generic
15
- target[key] = deepMergeObjects(targetValue, sourceValue)
11
+ if (Object(sourceValue) === sourceValue && Object(targetValue) === targetValue) {
12
+ // @ts-expect-error - can't assign to generic
13
+ target[key] = deepMergeObjects(targetValue, sourceValue)
16
14
 
17
- return
18
- }
15
+ return
16
+ }
19
17
 
20
- // @ts-expect-error - can't assign to generic
21
- target[key] = sourceValue
18
+ // @ts-expect-error - can't assign to generic
19
+ target[key] = sourceValue
22
20
  })
23
21
  })
24
22
 
@@ -36,7 +34,7 @@ export const copyComponentProperties = (Component: any, UnistylesComponent: any)
36
34
  })
37
35
 
38
36
  UnistylesComponent.displayName = Component.displayName
39
-
37
+
40
38
  return UnistylesComponent
41
39
  }
42
40
 
@@ -59,8 +57,10 @@ export const parseMq = (mq: string) => {
59
57
  }
60
58
 
61
59
  export const isValidMq = (parsedMQ: ReturnType<typeof parseMq>) => {
62
- const isWidthValid = parsedMQ.minWidth === undefined || parsedMQ.maxWidth === undefined || parsedMQ.minWidth <= parsedMQ.maxWidth
63
- const isHeightValid = parsedMQ.minHeight === undefined || parsedMQ.maxHeight === undefined || parsedMQ.minHeight <= parsedMQ.maxHeight
60
+ const isWidthValid =
61
+ parsedMQ.minWidth === undefined || parsedMQ.maxWidth === undefined || parsedMQ.minWidth <= parsedMQ.maxWidth
62
+ const isHeightValid =
63
+ parsedMQ.minHeight === undefined || parsedMQ.maxHeight === undefined || parsedMQ.minHeight <= parsedMQ.maxHeight
64
64
 
65
65
  return isWidthValid && isHeightValid
66
66
  }
@@ -1,6 +1,7 @@
1
1
  import type { UnistylesValues } from '../../types'
2
- import { deepMergeObjects } from '../../utils'
3
2
  import type { UnistylesRuntime } from '../runtime'
3
+
4
+ import { deepMergeObjects } from '../../utils'
4
5
  import { getBoxShadow, getFilterStyle, getTransformStyle } from './object'
5
6
  import { isPseudo } from './pseudo'
6
7
  import { getBoxShadowStyle, getTextShadowStyle } from './shadow'
@@ -15,7 +16,10 @@ export const convertUnistyles = (value: UnistylesValues, runtime: UnistylesRunti
15
16
 
16
17
  const stylesArray = Object.entries(value).flatMap(([unistylesKey, unistylesValue]) => {
17
18
  // Keys to omit
18
- if (['_classNames', '_web', 'variants', 'compoundVariants', 'uni__dependencies'].includes(unistylesKey) || unistylesKey.startsWith('unistyles_')) {
19
+ if (
20
+ ['_classNames', '_web', 'variants', 'compoundVariants', 'uni__dependencies'].includes(unistylesKey) ||
21
+ unistylesKey.startsWith('unistyles_')
22
+ ) {
19
23
  return []
20
24
  }
21
25
 
@@ -1,4 +1,5 @@
1
1
  import type { BoxShadowValue } from 'react-native'
2
+
2
3
  import { deepMergeObjects } from '../../../utils'
3
4
  import { keyInObject } from '../../utils'
4
5
  import { normalizeNumericValue } from '../utils'
@@ -11,43 +12,47 @@ const createBoxShadowValue = (style: BoxShadowValue) => {
11
12
 
12
13
  export const getBoxShadow = (boxShadow: Array<BoxShadowValue>) => {
13
14
  const breakpoints = new Set<string>()
14
- boxShadow.forEach(shadow => {
15
+ boxShadow.forEach((shadow) => {
15
16
  const [key] = Object.keys(shadow)
16
17
  const value = shadow[key as keyof BoxShadowValue]
17
18
 
18
19
  // Breakpoints
19
20
  if (typeof value === 'object') {
20
- Object.keys(value).forEach(breakpoint => breakpoints.add(breakpoint))
21
+ Object.keys(value).forEach((breakpoint) => breakpoints.add(breakpoint))
21
22
  }
22
23
  })
23
24
 
24
25
  if (breakpoints.size === 0) {
25
- const boxShadowStyle = Object.fromEntries(boxShadow.map(shadow => {
26
- const [key] = Object.keys(shadow)
27
- return [key, shadow[key as keyof BoxShadowValue]]
28
- })) as BoxShadowValue
26
+ const boxShadowStyle = Object.fromEntries(
27
+ boxShadow.map((shadow) => {
28
+ const [key] = Object.keys(shadow)
29
+ return [key, shadow[key as keyof BoxShadowValue]]
30
+ }),
31
+ ) as BoxShadowValue
29
32
 
30
33
  return {
31
- boxShadow: createBoxShadowValue(boxShadowStyle)
34
+ boxShadow: createBoxShadowValue(boxShadowStyle),
32
35
  }
33
36
  }
34
37
 
35
- const breakpointStyles = Array.from(breakpoints).map(breakpoint => {
36
- const styles = Object.fromEntries(boxShadow.map(shadow => {
37
- const [key] = Object.keys(shadow)
38
- const value = shadow[key as keyof BoxShadowValue]
38
+ const breakpointStyles = Array.from(breakpoints).map((breakpoint) => {
39
+ const styles = Object.fromEntries(
40
+ boxShadow.map((shadow) => {
41
+ const [key] = Object.keys(shadow)
42
+ const value = shadow[key as keyof BoxShadowValue]
39
43
 
40
- if (typeof value === 'object' && keyInObject(value, breakpoint)) {
41
- return [key, value[breakpoint]]
42
- }
44
+ if (typeof value === 'object' && keyInObject(value, breakpoint)) {
45
+ return [key, value[breakpoint]]
46
+ }
43
47
 
44
- return [key, value]
45
- })) as BoxShadowValue
48
+ return [key, value]
49
+ }),
50
+ ) as BoxShadowValue
46
51
 
47
52
  return {
48
53
  [breakpoint]: {
49
- boxShadow: createBoxShadowValue(styles)
50
- }
54
+ boxShadow: createBoxShadowValue(styles),
55
+ },
51
56
  }
52
57
  })
53
58
 
@@ -1,8 +1,10 @@
1
1
  import type { DropShadowValue } from 'react-native'
2
- import { isUnistylesMq } from '../../../utils'
2
+
3
3
  import type { UnistylesRuntime } from '../../runtime'
4
- import { hyphenate } from '../../utils'
5
4
  import type { Filters } from '../types'
5
+
6
+ import { isUnistylesMq } from '../../../utils'
7
+ import { hyphenate } from '../../utils'
6
8
  import { normalizeColor, normalizeNumericValue } from '../utils'
7
9
  import { getObjectStyle } from './objectStyle'
8
10
 
@@ -13,27 +15,42 @@ const getDropShadowStyle = (dropShadow: DropShadowValue) => {
13
15
  }
14
16
 
15
17
  export const getFilterStyle = (filters: Array<Filters>, runtime: UnistylesRuntime) => {
16
- const restFilters = filters.filter(filter => Object.keys(filter)[0] !== 'dropShadow')
18
+ const restFilters = filters.filter((filter) => Object.keys(filter)[0] !== 'dropShadow')
17
19
  const dropShadow = (() => {
18
- const dropShadowValue = filters.find(filter => Object.keys(filter)[0] === 'dropShadow')?.dropShadow as Record<string, any>
20
+ const dropShadowValue = filters.find((filter) => Object.keys(filter)[0] === 'dropShadow')?.dropShadow as Record<
21
+ string,
22
+ any
23
+ >
19
24
 
20
25
  if (typeof dropShadowValue !== 'object') {
21
26
  return []
22
27
  }
23
28
 
24
- const breakpoints = Object.keys(dropShadowValue).filter(key => Object.keys(runtime.breakpoints).includes(key) || isUnistylesMq(key))
25
- const breakpointsDropShadow = Object.fromEntries(breakpoints.map(breakpoint => [breakpoint, getDropShadowStyle(dropShadowValue[breakpoint])]))
29
+ const breakpoints = Object.keys(dropShadowValue).filter(
30
+ (key) => Object.keys(runtime.breakpoints).includes(key) || isUnistylesMq(key),
31
+ )
32
+ const breakpointsDropShadow = Object.fromEntries(
33
+ breakpoints.map((breakpoint) => [breakpoint, getDropShadowStyle(dropShadowValue[breakpoint])]),
34
+ )
26
35
 
27
36
  if (breakpoints.length === 0) {
28
- return [{
29
- dropShadow: getDropShadowStyle(dropShadowValue as DropShadowValue)
30
- }]
37
+ return [
38
+ {
39
+ dropShadow: getDropShadowStyle(dropShadowValue as DropShadowValue),
40
+ },
41
+ ]
31
42
  }
32
43
 
33
- return [{
34
- dropShadow: breakpointsDropShadow
35
- }]
44
+ return [
45
+ {
46
+ dropShadow: breakpointsDropShadow,
47
+ },
48
+ ]
36
49
  })()
37
50
 
38
- return getObjectStyle([...restFilters, ...dropShadow], 'filter', (key, value) => `${hyphenate(key)}(${normalizeNumericValue(value as number | string)})`)
51
+ return getObjectStyle(
52
+ [...restFilters, ...dropShadow],
53
+ 'filter',
54
+ (key, value) => `${hyphenate(key)}(${normalizeNumericValue(value as number | string)})`,
55
+ )
39
56
  }