react-native-unistyles 3.0.0-beta.7 → 3.0.0-experimental-2025051401

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 (390) hide show
  1. package/README.md +41 -19
  2. package/Unistyles.podspec +1 -0
  3. package/android/CMakeLists.txt +2 -1
  4. package/android/src/main/cxx/NativeUnistylesModule.cpp +3 -7
  5. package/android/src/main/cxx/NativeUnistylesModule.h +0 -4
  6. package/android/src/main/java/com/unistyles/NativePlatform+android.kt +5 -1
  7. package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +11 -4
  8. package/android/src/main/java/com/unistyles/NativePlatform+listener.kt +1 -1
  9. package/android/src/main/java/com/unistyles/UnistylesModule.kt +1 -7
  10. package/components/native/ActivityIndicator/package.json +1 -0
  11. package/components/native/Animated/package.json +1 -0
  12. package/components/native/FlatList/package.json +1 -0
  13. package/components/native/Image/package.json +2 -1
  14. package/components/native/ImageBackground/package.json +1 -0
  15. package/components/native/KeyboardAvoidingView/package.json +1 -0
  16. package/components/native/NativeText/package.json +1 -0
  17. package/components/native/NativeView/package.json +1 -0
  18. package/components/native/Pressable/package.json +1 -0
  19. package/components/native/RefreshControl/package.json +1 -0
  20. package/components/native/ScrollView/package.json +1 -0
  21. package/components/native/SectionList/package.json +1 -0
  22. package/components/native/Switch/package.json +1 -0
  23. package/components/native/Text/package.json +1 -0
  24. package/components/native/TextInput/package.json +1 -0
  25. package/components/native/TouchableHighlight/package.json +1 -0
  26. package/components/native/TouchableOpacity/package.json +1 -0
  27. package/components/native/View/package.json +1 -0
  28. package/components/native/VirtualizedList/package.json +1 -0
  29. package/cxx/common/Helpers.h +89 -0
  30. package/cxx/core/HostUnistyle.cpp +14 -5
  31. package/cxx/core/StyleSheet.h +1 -1
  32. package/cxx/core/UnistyleWrapper.h +1 -1
  33. package/cxx/core/UnistylesCommitShadowNode.h +0 -21
  34. package/cxx/core/UnistylesRegistry.cpp +74 -69
  35. package/cxx/core/UnistylesRegistry.h +1 -1
  36. package/cxx/hybridObjects/HybridShadowRegistry.cpp +2 -5
  37. package/cxx/hybridObjects/HybridStyleSheet.cpp +10 -19
  38. package/cxx/hybridObjects/HybridStyleSheet.h +3 -8
  39. package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +5 -1
  40. package/cxx/parser/Parser.cpp +200 -89
  41. package/cxx/parser/Parser.h +1 -1
  42. package/cxx/shadowTree/ShadowTrafficController.h +13 -9
  43. package/cxx/shadowTree/ShadowTreeManager.cpp +64 -59
  44. package/cxx/shadowTree/ShadowTreeManager.h +0 -1
  45. package/ios/NativePlatform+ios.swift +1 -1
  46. package/ios/NativePlatformListener+ios.swift +12 -7
  47. package/ios/UnistylesModuleOnLoad.h +1 -5
  48. package/ios/UnistylesModuleOnLoad.mm +5 -13
  49. package/lib/commonjs/components/native/Image.js +27 -1
  50. package/lib/commonjs/components/native/Image.js.map +1 -1
  51. package/lib/commonjs/components/native/Image.native.js +10 -0
  52. package/lib/commonjs/components/native/Image.native.js.map +1 -0
  53. package/lib/commonjs/components/native/ImageBackground.js +21 -36
  54. package/lib/commonjs/components/native/ImageBackground.js.map +1 -1
  55. package/lib/commonjs/components/native/Pressable.native.js +16 -2
  56. package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
  57. package/lib/commonjs/core/createUnistylesElement.js +17 -21
  58. package/lib/commonjs/core/createUnistylesElement.js.map +1 -1
  59. package/lib/commonjs/core/createUnistylesElement.native.js +7 -1
  60. package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -1
  61. package/lib/commonjs/core/createUnistylesImageBackground.js +10 -4
  62. package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
  63. package/lib/commonjs/core/getClassname.js +11 -5
  64. package/lib/commonjs/core/getClassname.js.map +1 -1
  65. package/lib/commonjs/core/passForwardRef.js +3 -5
  66. package/lib/commonjs/core/passForwardRef.js.map +1 -1
  67. package/lib/commonjs/core/useProxifiedUnistyles/listener.js +5 -3
  68. package/lib/commonjs/core/useProxifiedUnistyles/listener.js.map +1 -1
  69. package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js +15 -2
  70. package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
  71. package/lib/commonjs/core/withUnistyles/withUnistyles.js +14 -5
  72. package/lib/commonjs/core/withUnistyles/withUnistyles.js.map +1 -1
  73. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +14 -7
  74. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
  75. package/lib/commonjs/hooks/useMedia.js +4 -4
  76. package/lib/commonjs/hooks/useMedia.js.map +1 -1
  77. package/lib/commonjs/hooks/useMedia.native.js +4 -4
  78. package/lib/commonjs/hooks/useMedia.native.js.map +1 -1
  79. package/lib/commonjs/mocks.js +203 -0
  80. package/lib/commonjs/mocks.js.map +1 -0
  81. package/lib/commonjs/mq.js +1 -23
  82. package/lib/commonjs/mq.js.map +1 -1
  83. package/lib/commonjs/reanimated/index.js +13 -0
  84. package/lib/commonjs/reanimated/index.js.map +1 -0
  85. package/lib/commonjs/reanimated/useAnimatedTheme.js +22 -0
  86. package/lib/commonjs/reanimated/useAnimatedTheme.js.map +1 -0
  87. package/lib/commonjs/reanimated/useAnimatedTheme.native.js +24 -0
  88. package/lib/commonjs/reanimated/useAnimatedTheme.native.js.map +1 -0
  89. package/lib/commonjs/server/getServerUnistyles.js +9 -4
  90. package/lib/commonjs/server/getServerUnistyles.js.map +1 -1
  91. package/lib/commonjs/server/hydrateServerUnistyles.js +4 -2
  92. package/lib/commonjs/server/hydrateServerUnistyles.js.map +1 -1
  93. package/lib/commonjs/server/resetServerUnistyles.js +4 -2
  94. package/lib/commonjs/server/resetServerUnistyles.js.map +1 -1
  95. package/lib/commonjs/server/serialize.js +24 -0
  96. package/lib/commonjs/server/serialize.js.map +1 -0
  97. package/lib/commonjs/specs/NativePlatform/NativePlatform.nitro.js +1 -0
  98. package/lib/commonjs/specs/NativePlatform/NativePlatform.nitro.js.map +1 -1
  99. package/lib/commonjs/specs/ShadowRegistry/index.js +2 -2
  100. package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
  101. package/lib/commonjs/utils.js +23 -1
  102. package/lib/commonjs/utils.js.map +1 -1
  103. package/lib/commonjs/web/convert/index.js +4 -7
  104. package/lib/commonjs/web/convert/index.js.map +1 -1
  105. package/lib/commonjs/web/convert/object/filter.js +7 -8
  106. package/lib/commonjs/web/convert/object/filter.js.map +1 -1
  107. package/lib/commonjs/web/create.js +10 -2
  108. package/lib/commonjs/web/create.js.map +1 -1
  109. package/lib/commonjs/web/css/core.js +2 -2
  110. package/lib/commonjs/web/css/core.js.map +1 -1
  111. package/lib/commonjs/web/css/state.js +6 -3
  112. package/lib/commonjs/web/css/state.js.map +1 -1
  113. package/lib/commonjs/web/index.js +7 -12
  114. package/lib/commonjs/web/index.js.map +1 -1
  115. package/lib/commonjs/web/registry.js +11 -9
  116. package/lib/commonjs/web/registry.js.map +1 -1
  117. package/lib/commonjs/web/runtime.js +5 -1
  118. package/lib/commonjs/web/runtime.js.map +1 -1
  119. package/lib/commonjs/web/services.js +7 -2
  120. package/lib/commonjs/web/services.js.map +1 -1
  121. package/lib/commonjs/web/shadowRegistry.js +27 -10
  122. package/lib/commonjs/web/shadowRegistry.js.map +1 -1
  123. package/lib/commonjs/web/state.js +11 -2
  124. package/lib/commonjs/web/state.js.map +1 -1
  125. package/lib/commonjs/web/types.js +2 -0
  126. package/lib/commonjs/web/types.js.map +1 -1
  127. package/lib/commonjs/web/utils/createUnistylesRef.js +31 -0
  128. package/lib/commonjs/web/utils/createUnistylesRef.js.map +1 -0
  129. package/lib/commonjs/web/utils/unistyle.js +40 -14
  130. package/lib/commonjs/web/utils/unistyle.js.map +1 -1
  131. package/lib/commonjs/web-only/getWebProps.js +19 -0
  132. package/lib/commonjs/web-only/getWebProps.js.map +1 -0
  133. package/lib/commonjs/web-only/index.js +13 -0
  134. package/lib/commonjs/web-only/index.js.map +1 -0
  135. package/lib/module/components/native/Image.js +26 -2
  136. package/lib/module/components/native/Image.js.map +1 -1
  137. package/lib/module/components/native/Image.native.js +6 -0
  138. package/lib/module/components/native/Image.native.js.map +1 -0
  139. package/lib/module/components/native/ImageBackground.js +22 -37
  140. package/lib/module/components/native/ImageBackground.js.map +1 -1
  141. package/lib/module/components/native/Pressable.native.js +16 -2
  142. package/lib/module/components/native/Pressable.native.js.map +1 -1
  143. package/lib/module/core/createUnistylesElement.js +17 -21
  144. package/lib/module/core/createUnistylesElement.js.map +1 -1
  145. package/lib/module/core/createUnistylesElement.native.js +7 -1
  146. package/lib/module/core/createUnistylesElement.native.js.map +1 -1
  147. package/lib/module/core/createUnistylesImageBackground.js +10 -4
  148. package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
  149. package/lib/module/core/getClassname.js +9 -5
  150. package/lib/module/core/getClassname.js.map +1 -1
  151. package/lib/module/core/passForwardRef.js +3 -5
  152. package/lib/module/core/passForwardRef.js.map +1 -1
  153. package/lib/module/core/useProxifiedUnistyles/listener.js +3 -3
  154. package/lib/module/core/useProxifiedUnistyles/listener.js.map +1 -1
  155. package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js +15 -2
  156. package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
  157. package/lib/module/core/withUnistyles/withUnistyles.js +14 -5
  158. package/lib/module/core/withUnistyles/withUnistyles.js.map +1 -1
  159. package/lib/module/core/withUnistyles/withUnistyles.native.js +14 -7
  160. package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
  161. package/lib/module/hooks/useMedia.js +1 -1
  162. package/lib/module/hooks/useMedia.js.map +1 -1
  163. package/lib/module/hooks/useMedia.native.js +1 -1
  164. package/lib/module/hooks/useMedia.native.js.map +1 -1
  165. package/lib/module/mocks.js +201 -0
  166. package/lib/module/mocks.js.map +1 -0
  167. package/lib/module/mq.js +0 -19
  168. package/lib/module/mq.js.map +1 -1
  169. package/lib/module/reanimated/index.js +4 -0
  170. package/lib/module/reanimated/index.js.map +1 -0
  171. package/lib/module/reanimated/useAnimatedTheme.js +17 -0
  172. package/lib/module/reanimated/useAnimatedTheme.js.map +1 -0
  173. package/lib/module/reanimated/useAnimatedTheme.native.js +19 -0
  174. package/lib/module/reanimated/useAnimatedTheme.native.js.map +1 -0
  175. package/lib/module/server/getServerUnistyles.js +7 -4
  176. package/lib/module/server/getServerUnistyles.js.map +1 -1
  177. package/lib/module/server/hydrateServerUnistyles.js +2 -2
  178. package/lib/module/server/hydrateServerUnistyles.js.map +1 -1
  179. package/lib/module/server/resetServerUnistyles.js +2 -2
  180. package/lib/module/server/resetServerUnistyles.js.map +1 -1
  181. package/lib/module/server/serialize.js +19 -0
  182. package/lib/module/server/serialize.js.map +1 -0
  183. package/lib/module/specs/NativePlatform/NativePlatform.nitro.js +1 -0
  184. package/lib/module/specs/NativePlatform/NativePlatform.nitro.js.map +1 -1
  185. package/lib/module/specs/ShadowRegistry/index.js +2 -2
  186. package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
  187. package/lib/module/utils.js +19 -0
  188. package/lib/module/utils.js.map +1 -1
  189. package/lib/module/web/convert/index.js +4 -7
  190. package/lib/module/web/convert/index.js.map +1 -1
  191. package/lib/module/web/convert/object/filter.js +3 -4
  192. package/lib/module/web/convert/object/filter.js.map +1 -1
  193. package/lib/module/web/create.js +9 -3
  194. package/lib/module/web/create.js.map +1 -1
  195. package/lib/module/web/css/core.js +2 -2
  196. package/lib/module/web/css/core.js.map +1 -1
  197. package/lib/module/web/css/state.js +6 -3
  198. package/lib/module/web/css/state.js.map +1 -1
  199. package/lib/module/web/index.js +4 -10
  200. package/lib/module/web/index.js.map +1 -1
  201. package/lib/module/web/registry.js +11 -9
  202. package/lib/module/web/registry.js.map +1 -1
  203. package/lib/module/web/runtime.js +5 -1
  204. package/lib/module/web/runtime.js.map +1 -1
  205. package/lib/module/web/services.js +7 -1
  206. package/lib/module/web/services.js.map +1 -1
  207. package/lib/module/web/shadowRegistry.js +27 -10
  208. package/lib/module/web/shadowRegistry.js.map +1 -1
  209. package/lib/module/web/state.js +11 -2
  210. package/lib/module/web/state.js.map +1 -1
  211. package/lib/module/web/types.js +1 -1
  212. package/lib/module/web/types.js.map +1 -1
  213. package/lib/module/web/utils/createUnistylesRef.js +24 -0
  214. package/lib/module/web/utils/createUnistylesRef.js.map +1 -0
  215. package/lib/module/web/utils/unistyle.js +32 -10
  216. package/lib/module/web/utils/unistyle.js.map +1 -1
  217. package/lib/module/web-only/getWebProps.js +14 -0
  218. package/lib/module/web-only/getWebProps.js.map +1 -0
  219. package/lib/module/web-only/index.js +4 -0
  220. package/lib/module/web-only/index.js.map +1 -0
  221. package/lib/typescript/src/components/native/Animated.d.ts.map +1 -1
  222. package/lib/typescript/src/components/native/Image.d.ts.map +1 -1
  223. package/lib/typescript/src/components/native/Image.native.d.ts +2 -0
  224. package/lib/typescript/src/components/native/Image.native.d.ts.map +1 -0
  225. package/lib/typescript/src/components/native/ImageBackground.d.ts.map +1 -1
  226. package/lib/typescript/src/components/native/Pressable.native.d.ts.map +1 -1
  227. package/lib/typescript/src/core/createUnistylesElement.d.ts.map +1 -1
  228. package/lib/typescript/src/core/createUnistylesElement.native.d.ts.map +1 -1
  229. package/lib/typescript/src/core/createUnistylesImageBackground.d.ts.map +1 -1
  230. package/lib/typescript/src/core/getClassname.d.ts +5 -5
  231. package/lib/typescript/src/core/getClassname.d.ts.map +1 -1
  232. package/lib/typescript/src/core/passForwardRef.d.ts +1 -1
  233. package/lib/typescript/src/core/passForwardRef.d.ts.map +1 -1
  234. package/lib/typescript/src/core/useProxifiedUnistyles/listener.d.ts.map +1 -1
  235. package/lib/typescript/src/core/useProxifiedUnistyles/listener.native.d.ts.map +1 -1
  236. package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts.map +1 -1
  237. package/lib/typescript/src/core/warn.d.ts.map +1 -1
  238. package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts +1 -1
  239. package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts.map +1 -1
  240. package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts +1 -3
  241. package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
  242. package/lib/typescript/src/hooks/useMedia.d.ts.map +1 -1
  243. package/lib/typescript/src/hooks/useMedia.native.d.ts.map +1 -1
  244. package/lib/typescript/src/mocks.d.ts +2 -0
  245. package/lib/typescript/src/mocks.d.ts.map +1 -0
  246. package/lib/typescript/src/mq.d.ts +0 -8
  247. package/lib/typescript/src/mq.d.ts.map +1 -1
  248. package/lib/typescript/src/reanimated/index.d.ts +2 -0
  249. package/lib/typescript/src/reanimated/index.d.ts.map +1 -0
  250. package/lib/typescript/src/reanimated/useAnimatedTheme.d.ts +4 -0
  251. package/lib/typescript/src/reanimated/useAnimatedTheme.d.ts.map +1 -0
  252. package/lib/typescript/src/reanimated/useAnimatedTheme.native.d.ts +4 -0
  253. package/lib/typescript/src/reanimated/useAnimatedTheme.native.d.ts.map +1 -0
  254. package/lib/typescript/src/server/getServerUnistyles.d.ts.map +1 -1
  255. package/lib/typescript/src/server/hydrateServerUnistyles.d.ts +0 -1
  256. package/lib/typescript/src/server/hydrateServerUnistyles.d.ts.map +1 -1
  257. package/lib/typescript/src/server/resetServerUnistyles.d.ts.map +1 -1
  258. package/lib/typescript/src/server/serialize.d.ts +2 -0
  259. package/lib/typescript/src/server/serialize.d.ts.map +1 -0
  260. package/lib/typescript/src/server/useServerUnistyles.d.ts.map +1 -1
  261. package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts +2 -1
  262. package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts.map +1 -1
  263. package/lib/typescript/src/specs/StatusBar/index.d.ts.map +1 -1
  264. package/lib/typescript/src/types/common.d.ts +0 -1
  265. package/lib/typescript/src/types/common.d.ts.map +1 -1
  266. package/lib/typescript/src/types/stylesheet.d.ts +1 -1
  267. package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
  268. package/lib/typescript/src/utils.d.ts +8 -0
  269. package/lib/typescript/src/utils.d.ts.map +1 -1
  270. package/lib/typescript/src/web/convert/index.d.ts +2 -1
  271. package/lib/typescript/src/web/convert/index.d.ts.map +1 -1
  272. package/lib/typescript/src/web/convert/object/boxShadow.d.ts.map +1 -1
  273. package/lib/typescript/src/web/convert/object/filter.d.ts +2 -1
  274. package/lib/typescript/src/web/convert/object/filter.d.ts.map +1 -1
  275. package/lib/typescript/src/web/convert/object/objectStyle.d.ts.map +1 -1
  276. package/lib/typescript/src/web/convert/object/transform.d.ts.map +1 -1
  277. package/lib/typescript/src/web/convert/pseudo.d.ts.map +1 -1
  278. package/lib/typescript/src/web/convert/shadow/boxShadow.d.ts.map +1 -1
  279. package/lib/typescript/src/web/convert/shadow/getShadowBreakpoints.d.ts.map +1 -1
  280. package/lib/typescript/src/web/convert/shadow/textShadow.d.ts.map +1 -1
  281. package/lib/typescript/src/web/convert/style.d.ts.map +1 -1
  282. package/lib/typescript/src/web/convert/utils.d.ts.map +1 -1
  283. package/lib/typescript/src/web/create.d.ts.map +1 -1
  284. package/lib/typescript/src/web/css/core.d.ts.map +1 -1
  285. package/lib/typescript/src/web/css/state.d.ts +4 -1
  286. package/lib/typescript/src/web/css/state.d.ts.map +1 -1
  287. package/lib/typescript/src/web/css/utils.d.ts.map +1 -1
  288. package/lib/typescript/src/web/index.d.ts +0 -5
  289. package/lib/typescript/src/web/index.d.ts.map +1 -1
  290. package/lib/typescript/src/web/listener.d.ts.map +1 -1
  291. package/lib/typescript/src/web/registry.d.ts +2 -2
  292. package/lib/typescript/src/web/registry.d.ts.map +1 -1
  293. package/lib/typescript/src/web/runtime.d.ts.map +1 -1
  294. package/lib/typescript/src/web/services.d.ts +6 -1
  295. package/lib/typescript/src/web/services.d.ts.map +1 -1
  296. package/lib/typescript/src/web/shadowRegistry.d.ts +2 -2
  297. package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
  298. package/lib/typescript/src/web/state.d.ts +2 -0
  299. package/lib/typescript/src/web/state.d.ts.map +1 -1
  300. package/lib/typescript/src/web/types.d.ts +3 -0
  301. package/lib/typescript/src/web/types.d.ts.map +1 -1
  302. package/lib/typescript/src/web/utils/common.d.ts.map +1 -1
  303. package/lib/typescript/src/web/utils/createUnistylesRef.d.ts +11 -0
  304. package/lib/typescript/src/web/utils/createUnistylesRef.d.ts.map +1 -0
  305. package/lib/typescript/src/web/utils/unistyle.d.ts +5 -2
  306. package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
  307. package/lib/typescript/src/web/variants.d.ts.map +1 -1
  308. package/lib/typescript/src/web-only/getWebProps.d.ts +7 -0
  309. package/lib/typescript/src/web-only/getWebProps.d.ts.map +1 -0
  310. package/lib/typescript/src/web-only/index.d.ts +2 -0
  311. package/lib/typescript/src/web-only/index.d.ts.map +1 -0
  312. package/nitrogen/generated/android/c++/JFunc_void_UnistylesNativeMiniRuntime.hpp +2 -2
  313. package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.hpp +2 -2
  314. package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +19 -19
  315. package/nitrogen/generated/android/c++/JUnistyleDependency.hpp +3 -0
  316. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_UnistylesNativeMiniRuntime.kt +7 -2
  317. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.kt +7 -2
  318. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +22 -22
  319. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistyleDependency.kt +2 -1
  320. package/nitrogen/generated/android/unistyles+autolinking.cmake +16 -0
  321. package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Umbrella.hpp +0 -1
  322. package/nitrogen/generated/ios/swift/UnistyleDependency.swift +4 -0
  323. package/nitrogen/generated/shared/c++/Dimensions.hpp +1 -0
  324. package/nitrogen/generated/shared/c++/Insets.hpp +1 -0
  325. package/nitrogen/generated/shared/c++/UnistyleDependency.hpp +2 -1
  326. package/nitrogen/generated/shared/c++/UnistylesCxxMiniRuntime.hpp +1 -0
  327. package/nitrogen/generated/shared/c++/UnistylesNativeMiniRuntime.hpp +1 -0
  328. package/package.json +77 -33
  329. package/plugin/index.d.ts +51 -18
  330. package/plugin/index.js +878 -177
  331. package/reanimated/package.json +6 -0
  332. package/server/package.json +6 -0
  333. package/src/components/native/Image.native.tsx +4 -0
  334. package/src/components/native/Image.tsx +36 -3
  335. package/src/components/native/ImageBackground.tsx +20 -36
  336. package/src/components/native/Pressable.native.tsx +25 -2
  337. package/src/core/createUnistylesElement.native.tsx +13 -2
  338. package/src/core/createUnistylesElement.tsx +26 -27
  339. package/src/core/createUnistylesImageBackground.tsx +16 -5
  340. package/src/core/getClassname.ts +16 -5
  341. package/src/core/passForwardRef.ts +5 -5
  342. package/src/core/useProxifiedUnistyles/listener.ts +3 -3
  343. package/src/core/useProxifiedUnistyles/useProxifiedUnistyles.ts +18 -1
  344. package/src/core/withUnistyles/withUnistyles.native.tsx +42 -17
  345. package/src/core/withUnistyles/withUnistyles.tsx +23 -6
  346. package/src/hooks/useMedia.native.ts +1 -1
  347. package/src/hooks/useMedia.ts +1 -1
  348. package/src/mocks.ts +217 -0
  349. package/src/mq.ts +0 -24
  350. package/src/reanimated/index.ts +1 -0
  351. package/src/reanimated/useAnimatedTheme.native.ts +21 -0
  352. package/src/reanimated/useAnimatedTheme.ts +19 -0
  353. package/src/server/getServerUnistyles.tsx +15 -10
  354. package/src/server/hydrateServerUnistyles.ts +3 -2
  355. package/src/server/resetServerUnistyles.ts +4 -3
  356. package/src/server/serialize.ts +20 -0
  357. package/src/specs/NativePlatform/NativePlatform.nitro.ts +2 -1
  358. package/src/specs/ShadowRegistry/index.ts +2 -2
  359. package/src/types/common.ts +0 -1
  360. package/src/types/stylesheet.ts +1 -1
  361. package/src/utils.ts +25 -0
  362. package/src/web/convert/index.ts +5 -7
  363. package/src/web/convert/object/filter.ts +4 -4
  364. package/src/web/create.ts +10 -3
  365. package/src/web/css/core.ts +2 -2
  366. package/src/web/css/state.ts +5 -3
  367. package/src/web/index.ts +4 -16
  368. package/src/web/registry.ts +20 -11
  369. package/src/web/runtime.ts +6 -2
  370. package/src/web/services.ts +14 -1
  371. package/src/web/shadowRegistry.ts +35 -13
  372. package/src/web/state.ts +14 -2
  373. package/src/web/types.ts +9 -4
  374. package/src/web/utils/createUnistylesRef.ts +33 -0
  375. package/src/web/utils/unistyle.ts +55 -23
  376. package/src/web-only/getWebProps.ts +18 -0
  377. package/src/web-only/index.ts +2 -0
  378. package/web/package.json +6 -0
  379. package/cxx/core/UnistylesCommitHook.cpp +0 -49
  380. package/cxx/core/UnistylesCommitHook.h +0 -27
  381. package/cxx/core/UnistylesMountHook.cpp +0 -28
  382. package/cxx/core/UnistylesMountHook.h +0 -27
  383. package/lib/module/package.json +0 -1
  384. package/plugin/consts.js +0 -63
  385. package/plugin/exotic.js +0 -54
  386. package/plugin/import.js +0 -51
  387. package/plugin/ref.js +0 -11
  388. package/plugin/stylesheet.js +0 -565
  389. package/plugin/variants.js +0 -66
  390. /package/cxx/common/{Constants.h → UnistylesConstants.h} +0 -0
package/README.md CHANGED
@@ -15,9 +15,22 @@
15
15
  ## Installation
16
16
 
17
17
  ```shell
18
- yarn add react-native-unistyles@beta
18
+ yarn add react-native-unistyles@next
19
19
  ```
20
20
 
21
+ Install dependencies:
22
+
23
+ ```shell
24
+ yarn add react-native-edge-to-edge react-native-nitro-modules@0.25.2
25
+ ```
26
+
27
+ > To avoid unexpected behavior, always use a fixed version of `react-native-nitro-modules`
28
+
29
+ | react-native-unistyles | react-native-nitro-modules |
30
+ |------------------------|----------------------------|
31
+ | 3.0.0-nightly-20250513 | 0.25.2 |
32
+ | 3.0.0-rc.4 | 0.25.2 |
33
+
21
34
  Then follow [installation guides](https://unistyl.es/v3/start/getting-started) for your platform.
22
35
 
23
36
  ## [Documentation](https://unistyl.es/)
@@ -65,44 +78,53 @@ Then follow [installation guides](https://unistyl.es/v3/start/getting-started) f
65
78
  <a href="https://github.com/oscklm">
66
79
  <img src="https://avatars.githubusercontent.com/u/22825865?v=4" height="70px" width="70px" alt="oscklm" />
67
80
  </a>
68
- <a href="https://github.com/guillaumehcht">
69
- <img src="https://avatars.githubusercontent.com/u/80776475?v=4" height="70px" width="70px" alt="guillaumehcht" />
81
+ <a href="https://github.com/ryanlanciaux">
82
+ <img src="https://avatars.githubusercontent.com/u/85041?v=4" height="70px" width="70px" alt="ryanlanciaux" />
70
83
  </a>
71
- <a href="https://github.com/FilipiRafael">
72
- <img src="https://avatars.githubusercontent.com/u/61629642?v=4" height="70px" width="70px" alt="FilipiRafael" />
73
- </a>
74
- <a href="https://github.com/4cc3ssX">
75
- <img src="https://avatars.githubusercontent.com/u/57473799?v=4" height="70px" width="70px" alt="4cc3ssX" />
76
- </a>
77
- <a href="https://github.com/dacoto97">
78
- <img src="https://avatars.githubusercontent.com/u/16915053?v=4" height="70px" width="70px" alt="dacoto97" />
84
+ <a href="https://github.com/loopsware">
85
+ <img src="https://avatars.githubusercontent.com/u/161434039?s=200&v=4" height="70px" width="70px" alt="loopsware" />
79
86
  </a>
80
87
 
81
88
  ## Past sponsors
82
89
 
83
90
  <a href="https://github.com/kmartinezmedia">
84
- <img src="https://avatars.githubusercontent.com/u/6308123?s=200&v=4" height="70px" width="70px" alt="kmartinezmedia" />
91
+ <img src="https://avatars.githubusercontent.com/u/6308123?s=200&v=4" height="60px" width="60px" alt="kmartinezmedia" />
85
92
  </a>
86
93
  <a href="https://github.com/levibuzolic">
87
- <img src="https://avatars.githubusercontent.com/u/721323?v=4" height="70px" width="70px" alt="levibuzolic" />
94
+ <img src="https://avatars.githubusercontent.com/u/721323?v=4" height="60px" width="60px" alt="levibuzolic" />
88
95
  </a>
89
96
  <a href="https://github.com/claudesortwell">
90
- <img src="https://avatars.githubusercontent.com/u/41422239?v=4" height="70px" width="70px" alt="claudesortwell" />
97
+ <img src="https://avatars.githubusercontent.com/u/41422239?v=4" height="60px" width="60px" alt="claudesortwell" />
91
98
  </a>
92
99
  <a href="https://github.com/luoxuhai">
93
- <img src="https://avatars.githubusercontent.com/u/37284154?v=4" height="70px" width="70px" alt="luoxuhai" />
100
+ <img src="https://avatars.githubusercontent.com/u/37284154?v=4" height="60px" width="60px" alt="luoxuhai" />
94
101
  </a>
95
102
  <a href="https://github.com">
96
- <img src="https://avatars.githubusercontent.com/u/113348625?v=4" height="70px" width="70px" alt="anonymous" />
103
+ <img src="https://avatars.githubusercontent.com/u/113348625?v=4" height="60px" width="60px" alt="anonymous" />
97
104
  </a>
98
105
  <a href="https://github.com/abanobboles">
99
- <img src="https://avatars.githubusercontent.com/u/9078953?v=4" height="70px" width="70px" alt="abanobboles" />
106
+ <img src="https://avatars.githubusercontent.com/u/9078953?v=4" height="60px" width="60px" alt="abanobboles" />
100
107
  </a>
101
108
  <a href="https://github.com/hyoban">
102
- <img src="https://avatars.githubusercontent.com/u/38493346?v=4" height="70px" width="70px" alt="hyoban" />
109
+ <img src="https://avatars.githubusercontent.com/u/38493346?v=4" height="60px" width="60px" alt="hyoban" />
103
110
  </a>
104
111
  <a href="https://github.com/giovannilondero">
105
- <img src="https://avatars.githubusercontent.com/u/10998991?v=4" height="70px" width="70px" alt="giovannilondero" />
112
+ <img src="https://avatars.githubusercontent.com/u/10998991?v=4" height="60px" width="60px" alt="giovannilondero" />
113
+ </a>
114
+ <a href="https://github.com/4cc3ssX">
115
+ <img src="https://avatars.githubusercontent.com/u/57473799?v=4" height="60px" width="60px" alt="4cc3ssX" />
116
+ </a>
117
+ <a href="https://github.com/FilipiRafael">
118
+ <img src="https://avatars.githubusercontent.com/u/61629642?v=4" height="60px" width="60px" alt="FilipiRafael" />
119
+ </a>
120
+ <a href="https://github.com/dacoto97">
121
+ <img src="https://avatars.githubusercontent.com/u/16915053?v=4" height="60px" width="60px" alt="dacoto97" />
122
+ </a>
123
+ <a href="https://github.com/chinamcafee">
124
+ <img src="https://avatars.githubusercontent.com/u/3439961?v=4" height="60px" width="60px" alt="chinamcafee" />
125
+ </a>
126
+ <a href="https://github.com/guillaumehcht">
127
+ <img src="https://avatars.githubusercontent.com/u/80776475?v=4" height="60px" width="60px" alt="guillaumehcht" />
106
128
  </a>
107
129
 
108
130
  ## Sponsor my work
package/Unistyles.podspec CHANGED
@@ -29,6 +29,7 @@ Pod::Spec.new do |s|
29
29
  if ENV["USE_FRAMEWORKS"]
30
30
  s.dependency "React-Core"
31
31
  add_dependency(s, "React-jsinspector", :framework_name => "jsinspector_modern")
32
+ add_dependency(s, "React-jsinspectortracing", :framework_name => 'jsinspector_moderntracing')
32
33
  add_dependency(s, "React-rendererconsistency", :framework_name => "React_rendererconsistency")
33
34
  end
34
35
 
@@ -23,7 +23,8 @@ include_directories(
23
23
  ../cxx/shadowTree
24
24
  )
25
25
 
26
- string(APPEND CMAKE_CXX_FLAGS " -DFOLLY_NO_CONFIG=1 -DFOLLY_CFG_NO_COROUTINES=1 -DFOLLY_MOBILE=1")
26
+ # Nitro appends all Folly Flags, leaving it empty
27
+ string(APPEND CMAKE_CXX_FLAGS " ")
27
28
 
28
29
  set_target_properties(unistyles PROPERTIES
29
30
  CXX_STANDARD 20
@@ -10,19 +10,16 @@ using namespace facebook::react;
10
10
  UnistylesModule::UnistylesModule(
11
11
  jni::alias_ref<UnistylesModule::jhybridobject> jThis,
12
12
  jni::alias_ref<react::JRuntimeExecutor::javaobject> runtimeExecutorHolder,
13
- jni::alias_ref<JFabricUIManager::javaobject> fabricUIManager,
14
13
  jni::alias_ref<JHybridNativePlatformSpec::javaobject> nativePlatform
15
14
  ): _runtimeExecutor(runtimeExecutorHolder->cthis()->get()),
16
- _uiManager(fabricUIManager->getBinding()->getScheduler()->getUIManager()),
17
15
  _nativePlatform(nativePlatform->cthis()) {}
18
16
 
19
17
  jni::local_ref<UnistylesModule::jhybriddata> UnistylesModule::initHybrid(
20
18
  jni::alias_ref<UnistylesModule::jhybridobject> jThis,
21
19
  jni::alias_ref<JRuntimeExecutor::javaobject> runtimeExecutorHolder,
22
- jni::alias_ref<JFabricUIManager::javaobject> fabricUIManager,
23
20
  jni::alias_ref<JHybridNativePlatformSpec::javaobject> nativePlatform
24
21
  ) {
25
- return makeCxxInstance(jThis, runtimeExecutorHolder, fabricUIManager, nativePlatform);
22
+ return makeCxxInstance(jThis, runtimeExecutorHolder, nativePlatform);
26
23
  }
27
24
 
28
25
  void UnistylesModule::registerNatives() {
@@ -34,10 +31,9 @@ void UnistylesModule::registerNatives() {
34
31
 
35
32
  jni::local_ref<BindingsInstallerHolder::javaobject> UnistylesModule::getBindingsInstaller(jni::alias_ref<UnistylesModule::javaobject> jobj) {
36
33
  auto& runtimeExecutor = jobj->cthis()->_runtimeExecutor;
37
- auto& uiManager = jobj->cthis()->_uiManager;
38
34
  auto& nativePlatform = jobj->cthis()->_nativePlatform;
39
35
 
40
- return BindingsInstallerHolder::newObjectCxxArgs([&runtimeExecutor, &uiManager, &nativePlatform](jsi::Runtime& rt) {
36
+ return BindingsInstallerHolder::newObjectCxxArgs([&runtimeExecutor, &nativePlatform](jsi::Runtime& rt) {
41
37
  // function is called on: first init and every live reload
42
38
  // check if this is live reload, if so let's replace UnistylesRuntime with new runtime
43
39
  auto hasUnistylesRuntime = HybridObjectRegistry::hasHybridObject("UnistylesRuntime");
@@ -56,7 +52,7 @@ jni::local_ref<BindingsInstallerHolder::javaobject> UnistylesModule::getBindings
56
52
 
57
53
  // init hybrids
58
54
  auto unistylesRuntime = std::make_shared<HybridUnistylesRuntime>(nativePlatform, rt, runOnJSThread);
59
- auto styleSheet = std::make_shared<HybridStyleSheet>(unistylesRuntime, uiManager);
55
+ auto styleSheet = std::make_shared<HybridStyleSheet>(unistylesRuntime);
60
56
 
61
57
  HybridObjectRegistry::registerHybridObjectConstructor("UnistylesRuntime", [unistylesRuntime]() -> std::shared_ptr<HybridObject>{
62
58
  return unistylesRuntime;
@@ -1,7 +1,6 @@
1
1
  #pragma once
2
2
 
3
3
  #include <ReactCommon/BindingsInstallerHolder.h>
4
- #include <react/fabric/JFabricUIManager.h>
5
4
  #include <react/jni/JRuntimeExecutor.h>
6
5
  #include <react/renderer/scheduler/Scheduler.h>
7
6
  #include <fbjni/fbjni.h>
@@ -19,7 +18,6 @@ struct UnistylesModule : public jni::HybridClass<UnistylesModule> {
19
18
  explicit UnistylesModule(
20
19
  jni::alias_ref<jhybridobject> jThis,
21
20
  jni::alias_ref<react::JRuntimeExecutor::javaobject> runtimeExecutorHolder,
22
- jni::alias_ref<JFabricUIManager::javaobject> fabricUIManager,
23
21
  jni::alias_ref<JHybridNativePlatformSpec::javaobject> nativePlatform
24
22
  );
25
23
 
@@ -27,14 +25,12 @@ struct UnistylesModule : public jni::HybridClass<UnistylesModule> {
27
25
  static jni::local_ref<jhybriddata> initHybrid(
28
26
  jni::alias_ref<jhybridobject> jThis,
29
27
  jni::alias_ref<JRuntimeExecutor::javaobject> runtimeExecutorHolder,
30
- jni::alias_ref<JFabricUIManager::javaobject>,
31
28
  jni::alias_ref<JHybridNativePlatformSpec::javaobject> nativePlatform
32
29
  );
33
30
 
34
31
  static jni::local_ref<BindingsInstallerHolder::javaobject> getBindingsInstaller(jni::alias_ref<UnistylesModule::javaobject> jThis);
35
32
 
36
33
  private:
37
- std::shared_ptr<UIManager> _uiManager;
38
34
  RuntimeExecutor _runtimeExecutor;
39
35
  std::shared_ptr<HybridNativePlatformSpec> _nativePlatform;
40
36
  };
@@ -27,7 +27,7 @@ import java.util.Locale
27
27
  @Keep
28
28
  @DoNotStrip
29
29
  class NativePlatformAndroid(private val reactContext: ReactApplicationContext): HybridNativePlatformSpec(), LifecycleEventListener {
30
- private val _insets = NativePlatformInsets(reactContext, this::getMiniRuntime) { this.diffMiniRuntime() }
30
+ private val _insets = NativePlatformInsets(reactContext, this::getMiniRuntime) { this.onConfigChange() }
31
31
  private var _miniRuntime: UnistylesNativeMiniRuntime = buildMiniRuntime()
32
32
  private val _listener = NativePlatformListener(reactContext, this::getMiniRuntime) { this.diffMiniRuntime() }
33
33
 
@@ -263,6 +263,10 @@ class NativePlatformAndroid(private val reactContext: ReactApplicationContext):
263
263
  return changedDependencies
264
264
  }
265
265
 
266
+ private fun onConfigChange() {
267
+ this._listener.onConfigChange()
268
+ }
269
+
266
270
  override fun registerPlatformListener(callback: (dependencies: Array<UnistyleDependency>, miniRuntime: UnistylesNativeMiniRuntime) -> Unit) {
267
271
  this._listener.addPlatformListener(callback)
268
272
  }
@@ -12,7 +12,6 @@ import androidx.core.view.WindowInsetsCompat
12
12
  import com.facebook.proguard.annotations.DoNotStrip
13
13
  import com.facebook.react.bridge.ReactApplicationContext
14
14
  import com.margelo.nitro.unistyles.Insets
15
- import com.margelo.nitro.unistyles.UnistyleDependency
16
15
  import com.margelo.nitro.unistyles.UnistylesNativeMiniRuntime
17
16
 
18
17
  typealias CxxImeListener = (miniRuntime: UnistylesNativeMiniRuntime) -> Unit
@@ -22,8 +21,9 @@ typealias CxxImeListener = (miniRuntime: UnistylesNativeMiniRuntime) -> Unit
22
21
  class NativePlatformInsets(
23
22
  private val reactContext: ReactApplicationContext,
24
23
  private val getMiniRuntime: () -> UnistylesNativeMiniRuntime,
25
- private val diffMiniRuntime: () -> Array<UnistyleDependency>
24
+ private val onConfigChange: () -> Unit
26
25
  ) {
26
+ private var _shouldListenToImeEvents = false
27
27
  private val _imeListeners: MutableList<CxxImeListener> = mutableListOf()
28
28
  private var _insets: Insets = Insets(0.0, 0.0, 0.0, 0.0, 0.0)
29
29
 
@@ -105,7 +105,7 @@ class NativePlatformInsets(
105
105
  return
106
106
  }
107
107
 
108
- diffMiniRuntime()
108
+ this@NativePlatformInsets.onConfigChange()
109
109
 
110
110
  if (shouldEmitImeEvent) {
111
111
  this@NativePlatformInsets.emitImeEvent(this.getMiniRuntime())
@@ -113,6 +113,8 @@ class NativePlatformInsets(
113
113
  }
114
114
 
115
115
  fun startInsetsListener() {
116
+ _shouldListenToImeEvents = true
117
+
116
118
  reactContext.currentActivity?.let { activity ->
117
119
  activity.findViewById<View>(android.R.id.content)?.let { mainView ->
118
120
  ViewCompat.setOnApplyWindowInsetsListener(mainView) { _, insets ->
@@ -130,6 +132,10 @@ class NativePlatformInsets(
130
132
  insets: WindowInsetsCompat,
131
133
  runningAnimations: List<WindowInsetsAnimationCompat>
132
134
  ): WindowInsetsCompat {
135
+ if (!_shouldListenToImeEvents) {
136
+ return insets
137
+ }
138
+
133
139
  runningAnimations.firstOrNull()?.let {
134
140
  val bottomInset = insets.getInsets(WindowInsetsCompat.Type.ime()).bottom.toDouble() - this@NativePlatformInsets._insets.bottom
135
141
  val nextBottomInset = if (bottomInset < 0) {
@@ -160,9 +166,10 @@ class NativePlatformInsets(
160
166
  reactContext.currentActivity?.let { activity ->
161
167
  activity.window?.decorView?.let { view ->
162
168
  ViewCompat.setOnApplyWindowInsetsListener(view, null)
163
- ViewCompat.setWindowInsetsAnimationCallback(view, null)
164
169
  }
165
170
  }
171
+
172
+ _shouldListenToImeEvents = false
166
173
  }
167
174
 
168
175
  fun addImeListener(listener: CxxImeListener) {
@@ -27,7 +27,7 @@ class NativePlatformListener(
27
27
  override fun onReceive(context: Context, intent: Intent) {
28
28
  Handler(Looper.getMainLooper()).postDelayed({
29
29
  this@NativePlatformListener.onConfigChange()
30
- }, 10)
30
+ }, 25)
31
31
  }
32
32
  }
33
33
 
@@ -5,11 +5,8 @@ import com.facebook.jni.HybridData
5
5
  import com.facebook.proguard.annotations.DoNotStrip
6
6
  import com.facebook.react.bridge.ReactApplicationContext
7
7
  import com.facebook.react.bridge.RuntimeExecutor
8
- import com.facebook.react.fabric.FabricUIManager
9
8
  import com.facebook.react.turbomodule.core.interfaces.BindingsInstallerHolder
10
9
  import com.facebook.react.turbomodule.core.interfaces.TurboModuleWithJSIBindings
11
- import com.facebook.react.uimanager.UIManagerHelper
12
- import com.facebook.react.uimanager.common.UIManagerType
13
10
  import com.margelo.nitro.unistyles.HybridNativePlatformSpec
14
11
  import com.margelo.nitro.unistyles.unistylesOnLoad.Companion.initializeNative
15
12
 
@@ -34,10 +31,8 @@ class UnistylesModule(reactContext: ReactApplicationContext): NativeTurboUnistyl
34
31
  private fun initializeHybridData(reactContext: ReactApplicationContext): HybridData {
35
32
  val runtimeExecutor = reactContext.catalystInstance?.runtimeExecutor
36
33
  ?: throw IllegalStateException("Unistyles: React Native runtime executor is not available. Please follow installation guides.")
37
- val fabricUIManager = UIManagerHelper.getUIManager(reactContext, UIManagerType.FABRIC) as? FabricUIManager
38
- ?: throw IllegalStateException("Unistyles: Fabric UI Manager is not available. Please follow installation guides.")
39
34
 
40
- return initHybrid(runtimeExecutor, fabricUIManager, _nativePlatform)
35
+ return initHybrid(runtimeExecutor, _nativePlatform)
41
36
  }
42
37
 
43
38
  @DoNotStrip
@@ -46,7 +41,6 @@ class UnistylesModule(reactContext: ReactApplicationContext): NativeTurboUnistyl
46
41
  @DoNotStrip
47
42
  private external fun initHybrid(
48
43
  runtimeExecutor: RuntimeExecutor,
49
- fabricUIManager: FabricUIManager,
50
44
  nativePlatform: HybridNativePlatformSpec
51
45
  ): HybridData
52
46
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/ActivityIndicator.js",
3
3
  "module": "../../../lib/module/components/native/ActivityIndicator.js",
4
+ "browser": "../../../lib/module/components/native/ActivityIndicator.js",
4
5
  "react-native": "../../../src/components/native/ActivityIndicator.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/Animated.js",
3
3
  "module": "../../../lib/module/components/native/Animated.js",
4
+ "browser": "../../../lib/module/components/native/Animated.js",
4
5
  "react-native": "../../../src/components/native/Animated.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/FlatList.js",
3
3
  "module": "../../../lib/module/components/native/FlatList.js",
4
+ "browser": "../../../lib/module/components/native/FlatList.js",
4
5
  "react-native": "../../../src/components/native/FlatList.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/Image.js",
3
3
  "module": "../../../lib/module/components/native/Image.js",
4
- "react-native": "../../../src/components/native/Image.tsx"
4
+ "browser": "../../../lib/module/components/native/Image.js",
5
+ "react-native": "../../../src/components/native/Image.native.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/ImageBackground.js",
3
3
  "module": "../../../lib/module/components/native/ImageBackground.js",
4
+ "browser": "../../../lib/module/components/native/ImageBackground.js",
4
5
  "react-native": "../../../src/components/native/ImageBackground.native.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/KeyboardAvoidingView.js",
3
3
  "module": "../../../lib/module/components/native/KeyboardAvoidingView.js",
4
+ "browser": "../../../lib/module/components/native/KeyboardAvoidingView.js",
4
5
  "react-native": "../../../src/components/native/KeyboardAvoidingView.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/NativeText.js",
3
3
  "module": "../../../lib/module/components/native/NativeText.js",
4
+ "browser": "../../../lib/module/components/native/NativeText.js",
4
5
  "react-native": "../../../src/components/native/NativeText.native.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/NativeView.js",
3
3
  "module": "../../../lib/module/components/native/NativeView.js",
4
+ "browser": "../../../lib/module/components/native/NativeView.js",
4
5
  "react-native": "../../../src/components/native/NativeView.native.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/Pressable.js",
3
3
  "module": "../../../lib/module/components/native/Pressable.js",
4
+ "browser": "../../../lib/module/components/native/Pressable.js",
4
5
  "react-native": "../../../src/components/native/Pressable.native.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/RefreshControl.js",
3
3
  "module": "../../../lib/module/components/native/RefreshControl.js",
4
+ "browser": "../../../lib/module/components/native/RefreshControl.js",
4
5
  "react-native": "../../../src/components/native/RefreshControl.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/ScrollView.js",
3
3
  "module": "../../../lib/module/components/native/ScrollView.js",
4
+ "browser": "../../../lib/module/components/native/ScrollView.js",
4
5
  "react-native": "../../../src/components/native/ScrollView.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/SectionList.js",
3
3
  "module": "../../../lib/module/components/native/SectionList.js",
4
+ "browser": "../../../lib/module/components/native/SectionList.js",
4
5
  "react-native": "../../../src/components/native/SectionList.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/Switch.js",
3
3
  "module": "../../../lib/module/components/native/Switch.js",
4
+ "browser": "../../../lib/module/components/native/Switch.js",
4
5
  "react-native": "../../../src/components/native/Switch.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/Text.js",
3
3
  "module": "../../../lib/module/components/native/Text.js",
4
+ "browser": "../../../lib/module/components/native/Text.js",
4
5
  "react-native": "../../../src/components/native/Text.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/TextInput.js",
3
3
  "module": "../../../lib/module/components/native/TextInput.js",
4
+ "browser": "../../../lib/module/components/native/TextInput.js",
4
5
  "react-native": "../../../src/components/native/TextInput.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/TouchableHighlight.js",
3
3
  "module": "../../../lib/module/components/native/TouchableHighlight.js",
4
+ "browser": "../../../lib/module/components/native/TouchableHighlight.js",
4
5
  "react-native": "../../../src/components/native/TouchableHighlight.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/TouchableOpacity.js",
3
3
  "module": "../../../lib/module/components/native/TouchableOpacity.js",
4
+ "browser": "../../../lib/module/components/native/TouchableOpacity.js",
4
5
  "react-native": "../../../src/components/native/TouchableOpacity.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/View.js",
3
3
  "module": "../../../lib/module/components/native/View.js",
4
+ "browser": "../../../lib/module/components/native/View.js",
4
5
  "react-native": "../../../src/components/native/View.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/VirtualizedList.js",
3
3
  "module": "../../../lib/module/components/native/VirtualizedList.js",
4
+ "browser": "../../../lib/module/components/native/VirtualizedList.js",
4
5
  "react-native": "../../../src/components/native/VirtualizedList.tsx"
5
6
  }
@@ -122,6 +122,10 @@ inline Variants variantsToPairs(jsi::Runtime& rt, jsi::Object&& variants) {
122
122
  if (variantValue.isString()) {
123
123
  pairs.emplace_back(std::make_pair(variantName, variantValue.asString(rt).utf8(rt)));
124
124
  }
125
+
126
+ if (variantValue.isNumber()) {
127
+ pairs.emplace_back(std::make_pair(variantName, std::to_string(static_cast<int>(variantValue.asNumber()))));
128
+ }
125
129
  });
126
130
 
127
131
  return pairs;
@@ -225,4 +229,89 @@ inline static jsi::Array dependenciesToJSIArray(jsi::Runtime& rt, const std::vec
225
229
  return result;
226
230
  }
227
231
 
232
+ inline void debugPrintJSIObject(jsi::Runtime& rt, std::string& name, jsi::Object& obj) {
233
+ auto console = rt.global().getPropertyAsObject(rt, "console");
234
+ auto log = console.getPropertyAsFunction(rt, "log");
235
+ auto parser = [&](const std::string& key, jsi::Value& value){
236
+ if (value.isBool()) {
237
+ std::string output = key + ": " + (value.getBool() ? "true" : "false");
238
+ log.call(rt, output);
239
+
240
+ return;
241
+ }
242
+
243
+ if (value.isNumber()) {
244
+ std::string output = key + ": " + std::to_string(value.getNumber());
245
+ log.call(rt, output);
246
+
247
+ return;
248
+ }
249
+
250
+ if (value.isString()) {
251
+ std::string output = key + ": " + value.getString(rt).utf8(rt);
252
+ log.call(rt, output);
253
+
254
+ return;
255
+ }
256
+
257
+ if (value.isUndefined()) {
258
+ std::string output = key + ": undefined";
259
+ log.call(rt, output);
260
+
261
+ return;
262
+ }
263
+
264
+ if (value.isNull()) {
265
+ std::string output = key + ": null";
266
+ log.call(rt, output);
267
+
268
+ return;
269
+ }
270
+ };
271
+
272
+ log.call(rt, "===" + name + "===");
273
+
274
+ enumerateJSIObject(rt, obj, [&](const std::string& key, jsi::Value& value){
275
+ if (value.isObject()) {
276
+ if (value.asObject(rt).isArray(rt)) {
277
+ iterateJSIArray(rt, value.asObject(rt).asArray(rt), [&](size_t i, jsi::Value& nestedValue){
278
+ std::string printableKey = key + ": Array[" + std::to_string(i) + "]";
279
+
280
+ log.call(rt, printableKey);
281
+
282
+ if (nestedValue.isObject()) {
283
+ enumerateJSIObject(rt, nestedValue.asObject(rt), [&](const std::string& nestedKey, jsi::Value& nestedValue){
284
+ parser(nestedKey, nestedValue);
285
+ });
286
+ } else {
287
+ parser(printableKey, nestedValue);
288
+ }
289
+
290
+ std::string endKey = key + ": Array[end]";
291
+
292
+ log.call(rt, endKey);
293
+ });
294
+ }
295
+
296
+ if (value.asObject(rt).isFunction(rt)) {
297
+ std::string output = key + ": [Function]";
298
+
299
+ log.call(rt, output);
300
+
301
+ return;
302
+ }
303
+
304
+ enumerateJSIObject(rt, value.asObject(rt), [&](const std::string& nestedKey, jsi::Value& nestedValue){
305
+ parser(nestedKey, nestedValue);
306
+ });
307
+
308
+ return;
309
+ }
310
+
311
+ parser(key, value);
312
+ });
313
+
314
+ log.call(rt, "===/" + name + "===");
315
+ }
316
+
228
317
  }
@@ -87,19 +87,28 @@ jsi::Function HostUnistyle::createAddVariantsProxyFunction(jsi::Runtime& rt) {
87
87
  Variants variants = helpers::variantsToPairs(rt, arguments[0].asObject(rt));
88
88
  parser::Parser parser = parser::Parser(this->_unistylesRuntime);
89
89
 
90
- helpers::enumerateJSIObject(rt, thisVal.asObject(rt), [this, &parser, &rt, &variants](const std::string& name, jsi::Value& value){
91
- if (name == helpers::ADD_VARIANTS_FN || !this->_stylesheet->unistyles.contains(name)) {
90
+ auto stylesheetCopy = std::make_shared<StyleSheet>(
91
+ this->_stylesheet->tag,
92
+ this->_stylesheet->type,
93
+ jsi::Value(rt, this->_stylesheet->rawValue).asObject(rt)
94
+ );
95
+
96
+ parser.buildUnistyles(rt, stylesheetCopy);
97
+ parser.parseUnistyles(rt, stylesheetCopy);
98
+
99
+ helpers::enumerateJSIObject(rt, thisVal.asObject(rt), [this, &parser, &rt, &variants, stylesheetCopy](const std::string& name, jsi::Value& value){
100
+ if (name == helpers::ADD_VARIANTS_FN || !stylesheetCopy->unistyles.contains(name)) {
92
101
  return;
93
102
  }
94
103
 
95
- auto unistyle = this->_stylesheet->unistyles[name];
96
-
104
+ auto unistyle = stylesheetCopy->unistyles[name];
105
+
97
106
  if (unistyle->dependsOn(UnistyleDependency::VARIANTS)) {
98
107
  parser.rebuildUnistyle(rt, unistyle, variants, std::nullopt);
99
108
  }
100
109
  });
101
110
 
102
- auto style = std::make_shared<core::HostUnistyle>(this->_stylesheet, this->_unistylesRuntime, variants);
111
+ auto style = std::make_shared<core::HostUnistyle>(stylesheetCopy, this->_unistylesRuntime, variants);
103
112
  auto styleHostObject = jsi::Object::createFromHostObject(rt, style);
104
113
 
105
114
  return styleHostObject;
@@ -3,7 +3,7 @@
3
3
  #include <jsi/jsi.h>
4
4
  #include "Unistyle.h"
5
5
  #include "Helpers.h"
6
- #include "Constants.h"
6
+ #include "UnistylesConstants.h"
7
7
 
8
8
  namespace margelo::nitro::unistyles::core {
9
9
 
@@ -5,7 +5,7 @@
5
5
  #include "UnistylesRegistry.h"
6
6
  #include "Helpers.h"
7
7
  #include "HybridUnistylesRuntime.h"
8
- #include "Constants.h"
8
+ #include "UnistylesConstants.h"
9
9
  #include "Parser.h"
10
10
 
11
11
  namespace margelo::nitro::unistyles::core {