react-native-unistyles 3.5.2 → 3.6.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 (317) hide show
  1. package/README.md +3 -0
  2. package/android/src/main/java/com/unistyles/NativePlatform+android.kt +44 -7
  3. package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +1 -1
  4. package/cxx/converters/BackgroundImageConverter.cpp +198 -11
  5. package/cxx/converters/BackgroundImageConverter.h +1 -0
  6. package/cxx/core/HostUnistyle.cpp +6 -0
  7. package/cxx/core/UnistylesRegistry.cpp +5 -5
  8. package/cxx/core/UnistylesRegistry.h +3 -3
  9. package/cxx/hybridObjects/HybridShadowRegistry.cpp +53 -14
  10. package/cxx/hybridObjects/HybridShadowRegistry.h +3 -2
  11. package/cxx/hybridObjects/HybridStyleSheet.cpp +3 -3
  12. package/cxx/parser/Parser.cpp +47 -9
  13. package/cxx/shadowTree/ShadowTreeManager.cpp +5 -5
  14. package/cxx/shadowTree/ShadowTreeManager.h +1 -1
  15. package/ios/NativePlatform+ios.swift +28 -15
  16. package/ios/NativePlatformListener+ios.swift +9 -0
  17. package/lib/commonjs/components/native/deep/ActivityIndicator.js +19 -0
  18. package/lib/commonjs/components/native/deep/ActivityIndicator.js.map +1 -0
  19. package/lib/commonjs/components/native/deep/Animated.js +19 -0
  20. package/lib/commonjs/components/native/deep/Animated.js.map +1 -0
  21. package/lib/commonjs/components/native/deep/FlatList.js +19 -0
  22. package/lib/commonjs/components/native/deep/FlatList.js.map +1 -0
  23. package/lib/commonjs/components/native/deep/Image.js +19 -0
  24. package/lib/commonjs/components/native/deep/Image.js.map +1 -0
  25. package/lib/commonjs/components/native/deep/ImageBackground.js +19 -0
  26. package/lib/commonjs/components/native/deep/ImageBackground.js.map +1 -0
  27. package/lib/commonjs/components/native/deep/KeyboardAvoidingView.js +19 -0
  28. package/lib/commonjs/components/native/deep/KeyboardAvoidingView.js.map +1 -0
  29. package/lib/commonjs/components/native/deep/Pressable.js +19 -0
  30. package/lib/commonjs/components/native/deep/Pressable.js.map +1 -0
  31. package/lib/commonjs/components/native/deep/RefreshControl.js +19 -0
  32. package/lib/commonjs/components/native/deep/RefreshControl.js.map +1 -0
  33. package/lib/commonjs/components/native/deep/SafeAreaView.js +19 -0
  34. package/lib/commonjs/components/native/deep/SafeAreaView.js.map +1 -0
  35. package/lib/commonjs/components/native/deep/ScrollView.js +19 -0
  36. package/lib/commonjs/components/native/deep/ScrollView.js.map +1 -0
  37. package/lib/commonjs/components/native/deep/SectionList.js +19 -0
  38. package/lib/commonjs/components/native/deep/SectionList.js.map +1 -0
  39. package/lib/commonjs/components/native/deep/Switch.js +19 -0
  40. package/lib/commonjs/components/native/deep/Switch.js.map +1 -0
  41. package/lib/commonjs/components/native/deep/Text.js +19 -0
  42. package/lib/commonjs/components/native/deep/Text.js.map +1 -0
  43. package/lib/commonjs/components/native/deep/TextInput.js +19 -0
  44. package/lib/commonjs/components/native/deep/TextInput.js.map +1 -0
  45. package/lib/commonjs/components/native/deep/TextNativeComponent.js +28 -0
  46. package/lib/commonjs/components/native/deep/TextNativeComponent.js.map +1 -0
  47. package/lib/commonjs/components/native/deep/TouchableHighlight.js +19 -0
  48. package/lib/commonjs/components/native/deep/TouchableHighlight.js.map +1 -0
  49. package/lib/commonjs/components/native/deep/TouchableOpacity.js +19 -0
  50. package/lib/commonjs/components/native/deep/TouchableOpacity.js.map +1 -0
  51. package/lib/commonjs/components/native/deep/View.js +19 -0
  52. package/lib/commonjs/components/native/deep/View.js.map +1 -0
  53. package/lib/commonjs/components/native/deep/ViewNativeComponent.js +26 -0
  54. package/lib/commonjs/components/native/deep/ViewNativeComponent.js.map +1 -0
  55. package/lib/commonjs/components/native/deep/VirtualizedList.js +19 -0
  56. package/lib/commonjs/components/native/deep/VirtualizedList.js.map +1 -0
  57. package/lib/commonjs/components/native/index.js +43 -0
  58. package/lib/commonjs/components/native/index.js.map +1 -0
  59. package/lib/commonjs/core/createUnistylesActivityIndicator.js +13 -3
  60. package/lib/commonjs/core/createUnistylesActivityIndicator.js.map +1 -1
  61. package/lib/commonjs/core/createUnistylesElement.native.js +6 -0
  62. package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -1
  63. package/lib/commonjs/core/createUnistylesImageBackground.js +20 -17
  64. package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
  65. package/lib/commonjs/core/createUnistylesTouchableHighlight.js +6 -0
  66. package/lib/commonjs/core/createUnistylesTouchableHighlight.js.map +1 -1
  67. package/lib/commonjs/core/getClassname.js +15 -0
  68. package/lib/commonjs/core/getClassname.js.map +1 -1
  69. package/lib/commonjs/core/hasUnistyles.js +26 -0
  70. package/lib/commonjs/core/hasUnistyles.js.map +1 -0
  71. package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js +10 -0
  72. package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
  73. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +16 -15
  74. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
  75. package/lib/commonjs/specs/ShadowRegistry/index.js +86 -110
  76. package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
  77. package/lib/commonjs/specs/ShadowRegistry/styleSource.js +65 -0
  78. package/lib/commonjs/specs/ShadowRegistry/styleSource.js.map +1 -0
  79. package/lib/commonjs/unifiber/src/adapters/reanimated.js +157 -0
  80. package/lib/commonjs/unifiber/src/adapters/reanimated.js.map +1 -0
  81. package/lib/commonjs/unifiber/src/adapters/registry.js +67 -0
  82. package/lib/commonjs/unifiber/src/adapters/registry.js.map +1 -0
  83. package/lib/commonjs/unifiber/src/diagnostics.js +59 -0
  84. package/lib/commonjs/unifiber/src/diagnostics.js.map +1 -0
  85. package/lib/commonjs/unifiber/src/fiber.js +199 -0
  86. package/lib/commonjs/unifiber/src/fiber.js.map +1 -0
  87. package/lib/commonjs/unifiber/src/host.js +214 -0
  88. package/lib/commonjs/unifiber/src/host.js.map +1 -0
  89. package/lib/commonjs/unifiber/src/index.js +38 -0
  90. package/lib/commonjs/unifiber/src/index.js.map +1 -0
  91. package/lib/commonjs/web/css/core.js +30 -5
  92. package/lib/commonjs/web/css/core.js.map +1 -1
  93. package/lib/commonjs/web/css/state.js +4 -1
  94. package/lib/commonjs/web/css/state.js.map +1 -1
  95. package/lib/commonjs/web/registry.js +1 -1
  96. package/lib/commonjs/web/registry.js.map +1 -1
  97. package/lib/commonjs/web/utils/unistyle.js +11 -3
  98. package/lib/commonjs/web/utils/unistyle.js.map +1 -1
  99. package/lib/module/components/native/deep/ActivityIndicator.js +5 -0
  100. package/lib/module/components/native/deep/ActivityIndicator.js.map +1 -0
  101. package/lib/module/components/native/deep/Animated.js +5 -0
  102. package/lib/module/components/native/deep/Animated.js.map +1 -0
  103. package/lib/module/components/native/deep/FlatList.js +5 -0
  104. package/lib/module/components/native/deep/FlatList.js.map +1 -0
  105. package/lib/module/components/native/deep/Image.js +5 -0
  106. package/lib/module/components/native/deep/Image.js.map +1 -0
  107. package/lib/module/components/native/deep/ImageBackground.js +5 -0
  108. package/lib/module/components/native/deep/ImageBackground.js.map +1 -0
  109. package/lib/module/components/native/deep/KeyboardAvoidingView.js +5 -0
  110. package/lib/module/components/native/deep/KeyboardAvoidingView.js.map +1 -0
  111. package/lib/module/components/native/deep/Pressable.js +5 -0
  112. package/lib/module/components/native/deep/Pressable.js.map +1 -0
  113. package/lib/module/components/native/deep/RefreshControl.js +5 -0
  114. package/lib/module/components/native/deep/RefreshControl.js.map +1 -0
  115. package/lib/module/components/native/deep/SafeAreaView.js +5 -0
  116. package/lib/module/components/native/deep/SafeAreaView.js.map +1 -0
  117. package/lib/module/components/native/deep/ScrollView.js +5 -0
  118. package/lib/module/components/native/deep/ScrollView.js.map +1 -0
  119. package/lib/module/components/native/deep/SectionList.js +5 -0
  120. package/lib/module/components/native/deep/SectionList.js.map +1 -0
  121. package/lib/module/components/native/deep/Switch.js +5 -0
  122. package/lib/module/components/native/deep/Switch.js.map +1 -0
  123. package/lib/module/components/native/deep/Text.js +5 -0
  124. package/lib/module/components/native/deep/Text.js.map +1 -0
  125. package/lib/module/components/native/deep/TextInput.js +5 -0
  126. package/lib/module/components/native/deep/TextInput.js.map +1 -0
  127. package/lib/module/components/native/deep/TextNativeComponent.js +8 -0
  128. package/lib/module/components/native/deep/TextNativeComponent.js.map +1 -0
  129. package/lib/module/components/native/deep/TouchableHighlight.js +5 -0
  130. package/lib/module/components/native/deep/TouchableHighlight.js.map +1 -0
  131. package/lib/module/components/native/deep/TouchableOpacity.js +5 -0
  132. package/lib/module/components/native/deep/TouchableOpacity.js.map +1 -0
  133. package/lib/module/components/native/deep/View.js +5 -0
  134. package/lib/module/components/native/deep/View.js.map +1 -0
  135. package/lib/module/components/native/deep/ViewNativeComponent.js +8 -0
  136. package/lib/module/components/native/deep/ViewNativeComponent.js.map +1 -0
  137. package/lib/module/components/native/deep/VirtualizedList.js +5 -0
  138. package/lib/module/components/native/deep/VirtualizedList.js.map +1 -0
  139. package/lib/module/components/native/index.js +43 -0
  140. package/lib/module/components/native/index.js.map +1 -0
  141. package/lib/module/core/createUnistylesActivityIndicator.js +13 -3
  142. package/lib/module/core/createUnistylesActivityIndicator.js.map +1 -1
  143. package/lib/module/core/createUnistylesElement.native.js +6 -0
  144. package/lib/module/core/createUnistylesElement.native.js.map +1 -1
  145. package/lib/module/core/createUnistylesImageBackground.js +20 -17
  146. package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
  147. package/lib/module/core/createUnistylesTouchableHighlight.js +6 -0
  148. package/lib/module/core/createUnistylesTouchableHighlight.js.map +1 -1
  149. package/lib/module/core/getClassname.js +16 -1
  150. package/lib/module/core/getClassname.js.map +1 -1
  151. package/lib/module/core/hasUnistyles.js +21 -0
  152. package/lib/module/core/hasUnistyles.js.map +1 -0
  153. package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js +10 -0
  154. package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
  155. package/lib/module/core/withUnistyles/withUnistyles.native.js +14 -14
  156. package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
  157. package/lib/module/specs/ShadowRegistry/index.js +86 -110
  158. package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
  159. package/lib/module/specs/ShadowRegistry/styleSource.js +60 -0
  160. package/lib/module/specs/ShadowRegistry/styleSource.js.map +1 -0
  161. package/lib/module/unifiber/src/adapters/reanimated.js +152 -0
  162. package/lib/module/unifiber/src/adapters/reanimated.js.map +1 -0
  163. package/lib/module/unifiber/src/adapters/registry.js +62 -0
  164. package/lib/module/unifiber/src/adapters/registry.js.map +1 -0
  165. package/lib/module/unifiber/src/diagnostics.js +52 -0
  166. package/lib/module/unifiber/src/diagnostics.js.map +1 -0
  167. package/lib/module/unifiber/src/fiber.js +183 -0
  168. package/lib/module/unifiber/src/fiber.js.map +1 -0
  169. package/lib/module/unifiber/src/host.js +191 -0
  170. package/lib/module/unifiber/src/host.js.map +1 -0
  171. package/lib/module/unifiber/src/index.js +33 -0
  172. package/lib/module/unifiber/src/index.js.map +1 -0
  173. package/lib/module/web/css/core.js +28 -4
  174. package/lib/module/web/css/core.js.map +1 -1
  175. package/lib/module/web/css/state.js +5 -2
  176. package/lib/module/web/css/state.js.map +1 -1
  177. package/lib/module/web/registry.js +1 -1
  178. package/lib/module/web/registry.js.map +1 -1
  179. package/lib/module/web/utils/unistyle.js +11 -3
  180. package/lib/module/web/utils/unistyle.js.map +1 -1
  181. package/lib/typescript/src/components/native/deep/ActivityIndicator.d.ts +2 -0
  182. package/lib/typescript/src/components/native/deep/ActivityIndicator.d.ts.map +1 -0
  183. package/lib/typescript/src/components/native/deep/Animated.d.ts +2 -0
  184. package/lib/typescript/src/components/native/deep/Animated.d.ts.map +1 -0
  185. package/lib/typescript/src/components/native/deep/FlatList.d.ts +2 -0
  186. package/lib/typescript/src/components/native/deep/FlatList.d.ts.map +1 -0
  187. package/lib/typescript/src/components/native/deep/Image.d.ts +2 -0
  188. package/lib/typescript/src/components/native/deep/Image.d.ts.map +1 -0
  189. package/lib/typescript/src/components/native/deep/ImageBackground.d.ts +2 -0
  190. package/lib/typescript/src/components/native/deep/ImageBackground.d.ts.map +1 -0
  191. package/lib/typescript/src/components/native/deep/KeyboardAvoidingView.d.ts +2 -0
  192. package/lib/typescript/src/components/native/deep/KeyboardAvoidingView.d.ts.map +1 -0
  193. package/lib/typescript/src/components/native/deep/Pressable.d.ts +2 -0
  194. package/lib/typescript/src/components/native/deep/Pressable.d.ts.map +1 -0
  195. package/lib/typescript/src/components/native/deep/RefreshControl.d.ts +2 -0
  196. package/lib/typescript/src/components/native/deep/RefreshControl.d.ts.map +1 -0
  197. package/lib/typescript/src/components/native/deep/SafeAreaView.d.ts +2 -0
  198. package/lib/typescript/src/components/native/deep/SafeAreaView.d.ts.map +1 -0
  199. package/lib/typescript/src/components/native/deep/ScrollView.d.ts +2 -0
  200. package/lib/typescript/src/components/native/deep/ScrollView.d.ts.map +1 -0
  201. package/lib/typescript/src/components/native/deep/SectionList.d.ts +2 -0
  202. package/lib/typescript/src/components/native/deep/SectionList.d.ts.map +1 -0
  203. package/lib/typescript/src/components/native/deep/Switch.d.ts +2 -0
  204. package/lib/typescript/src/components/native/deep/Switch.d.ts.map +1 -0
  205. package/lib/typescript/src/components/native/deep/Text.d.ts +2 -0
  206. package/lib/typescript/src/components/native/deep/Text.d.ts.map +1 -0
  207. package/lib/typescript/src/components/native/deep/TextInput.d.ts +2 -0
  208. package/lib/typescript/src/components/native/deep/TextInput.d.ts.map +1 -0
  209. package/lib/typescript/src/components/native/deep/TextNativeComponent.d.ts +3 -0
  210. package/lib/typescript/src/components/native/deep/TextNativeComponent.d.ts.map +1 -0
  211. package/lib/typescript/src/components/native/deep/TouchableHighlight.d.ts +2 -0
  212. package/lib/typescript/src/components/native/deep/TouchableHighlight.d.ts.map +1 -0
  213. package/lib/typescript/src/components/native/deep/TouchableOpacity.d.ts +2 -0
  214. package/lib/typescript/src/components/native/deep/TouchableOpacity.d.ts.map +1 -0
  215. package/lib/typescript/src/components/native/deep/View.d.ts +2 -0
  216. package/lib/typescript/src/components/native/deep/View.d.ts.map +1 -0
  217. package/lib/typescript/src/components/native/deep/ViewNativeComponent.d.ts +3 -0
  218. package/lib/typescript/src/components/native/deep/ViewNativeComponent.d.ts.map +1 -0
  219. package/lib/typescript/src/components/native/deep/VirtualizedList.d.ts +2 -0
  220. package/lib/typescript/src/components/native/deep/VirtualizedList.d.ts.map +1 -0
  221. package/lib/typescript/src/components/native/index.d.ts +4 -0
  222. package/lib/typescript/src/components/native/index.d.ts.map +1 -0
  223. package/lib/typescript/src/components/scopeChildren.d.ts +1 -1
  224. package/lib/typescript/src/core/createUnistylesActivityIndicator.d.ts.map +1 -1
  225. package/lib/typescript/src/core/createUnistylesElement.native.d.ts.map +1 -1
  226. package/lib/typescript/src/core/createUnistylesImageBackground.d.ts.map +1 -1
  227. package/lib/typescript/src/core/createUnistylesTouchableHighlight.d.ts.map +1 -1
  228. package/lib/typescript/src/core/getClassname.d.ts.map +1 -1
  229. package/lib/typescript/src/core/hasUnistyles.d.ts +2 -0
  230. package/lib/typescript/src/core/hasUnistyles.d.ts.map +1 -0
  231. package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts.map +1 -1
  232. package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts +6 -0
  233. package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
  234. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts +2 -2
  235. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
  236. package/lib/typescript/src/specs/ShadowRegistry/styleSource.d.ts +11 -0
  237. package/lib/typescript/src/specs/ShadowRegistry/styleSource.d.ts.map +1 -0
  238. package/lib/typescript/src/specs/ShadowRegistry/types.d.ts +4 -41
  239. package/lib/typescript/src/specs/ShadowRegistry/types.d.ts.map +1 -1
  240. package/lib/typescript/src/unifiber/src/adapters/reanimated.d.ts +17 -0
  241. package/lib/typescript/src/unifiber/src/adapters/reanimated.d.ts.map +1 -0
  242. package/lib/typescript/src/unifiber/src/adapters/registry.d.ts +23 -0
  243. package/lib/typescript/src/unifiber/src/adapters/registry.d.ts.map +1 -0
  244. package/lib/typescript/src/unifiber/src/diagnostics.d.ts +10 -0
  245. package/lib/typescript/src/unifiber/src/diagnostics.d.ts.map +1 -0
  246. package/lib/typescript/src/unifiber/src/fiber.d.ts +48 -0
  247. package/lib/typescript/src/unifiber/src/fiber.d.ts.map +1 -0
  248. package/lib/typescript/src/unifiber/src/host.d.ts +32 -0
  249. package/lib/typescript/src/unifiber/src/host.d.ts.map +1 -0
  250. package/lib/typescript/src/unifiber/src/index.d.ts +49 -0
  251. package/lib/typescript/src/unifiber/src/index.d.ts.map +1 -0
  252. package/lib/typescript/src/web/css/core.d.ts +1 -0
  253. package/lib/typescript/src/web/css/core.d.ts.map +1 -1
  254. package/lib/typescript/src/web/css/state.d.ts.map +1 -1
  255. package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
  256. package/metro/babel-transformer.js +1040 -0
  257. package/metro/index.d.ts +31 -0
  258. package/metro/index.js +170 -0
  259. package/package.json +26 -8
  260. package/plugin/index.d.ts +7 -0
  261. package/plugin/index.js +36 -16
  262. package/src/components/native/deep/ActivityIndicator.ts +2 -0
  263. package/src/components/native/deep/Animated.ts +2 -0
  264. package/src/components/native/deep/FlatList.ts +2 -0
  265. package/src/components/native/deep/Image.ts +2 -0
  266. package/src/components/native/deep/ImageBackground.ts +2 -0
  267. package/src/components/native/deep/KeyboardAvoidingView.ts +2 -0
  268. package/src/components/native/deep/Pressable.ts +2 -0
  269. package/src/components/native/deep/RefreshControl.ts +2 -0
  270. package/src/components/native/deep/SafeAreaView.ts +2 -0
  271. package/src/components/native/deep/ScrollView.ts +2 -0
  272. package/src/components/native/deep/SectionList.ts +2 -0
  273. package/src/components/native/deep/Switch.ts +2 -0
  274. package/src/components/native/deep/Text.ts +2 -0
  275. package/src/components/native/deep/TextInput.ts +2 -0
  276. package/src/components/native/deep/TextNativeComponent.ts +5 -0
  277. package/src/components/native/deep/TouchableHighlight.ts +2 -0
  278. package/src/components/native/deep/TouchableOpacity.ts +2 -0
  279. package/src/components/native/deep/View.ts +2 -0
  280. package/src/components/native/deep/ViewNativeComponent.ts +5 -0
  281. package/src/components/native/deep/VirtualizedList.ts +2 -0
  282. package/src/components/native/index.ts +41 -0
  283. package/src/core/createUnistylesActivityIndicator.tsx +11 -4
  284. package/src/core/createUnistylesElement.native.tsx +5 -0
  285. package/src/core/createUnistylesImageBackground.tsx +27 -23
  286. package/src/core/createUnistylesTouchableHighlight.tsx +5 -0
  287. package/src/core/getClassname.ts +10 -1
  288. package/src/core/hasUnistyles.ts +20 -0
  289. package/src/core/useProxifiedUnistyles/useProxifiedUnistyles.ts +11 -0
  290. package/src/core/withUnistyles/withUnistyles.native.tsx +22 -25
  291. package/src/specs/ShadowRegistry/index.ts +87 -149
  292. package/src/specs/ShadowRegistry/styleSource.ts +78 -0
  293. package/src/specs/ShadowRegistry/types.ts +3 -43
  294. package/src/unifiber/LICENSE +21 -0
  295. package/src/unifiber/README.md +92 -0
  296. package/src/unifiber/src/adapters/reanimated.ts +204 -0
  297. package/src/unifiber/src/adapters/registry.ts +102 -0
  298. package/src/unifiber/src/diagnostics.ts +55 -0
  299. package/src/unifiber/src/fiber.ts +262 -0
  300. package/src/unifiber/src/host.ts +236 -0
  301. package/src/unifiber/src/index.ts +43 -0
  302. package/src/web/css/core.ts +29 -4
  303. package/src/web/css/state.ts +6 -2
  304. package/src/web/registry.ts +1 -1
  305. package/src/web/utils/unistyle.ts +12 -3
  306. package/lib/typescript/src/__tests__/mocks.spec.d.ts +0 -2
  307. package/lib/typescript/src/__tests__/mocks.spec.d.ts.map +0 -1
  308. package/lib/typescript/src/__tests__/passForwardRef.spec.d.ts +0 -2
  309. package/lib/typescript/src/__tests__/passForwardRef.spec.d.ts.map +0 -1
  310. package/lib/typescript/src/__tests__/scoped-theme.spec.d.ts +0 -2
  311. package/lib/typescript/src/__tests__/scoped-theme.spec.d.ts.map +0 -1
  312. package/lib/typescript/src/__tests__/shadow-registry.spec.d.ts +0 -2
  313. package/lib/typescript/src/__tests__/shadow-registry.spec.d.ts.map +0 -1
  314. package/lib/typescript/src/__tests__/web-listener.spec.d.ts +0 -2
  315. package/lib/typescript/src/__tests__/web-listener.spec.d.ts.map +0 -1
  316. package/lib/typescript/src/__tests__/web-runtime.spec.d.ts +0 -2
  317. package/lib/typescript/src/__tests__/web-runtime.spec.d.ts.map +0 -1
@@ -0,0 +1,262 @@
1
+ // The only module that reads React's fiber fields. A missing field gives undefined / null for that call, never a throw.
2
+ import type { Context } from 'react'
3
+
4
+ // ReactWorkTags, React 19
5
+ export const Tag = {
6
+ ClassComponent: 1,
7
+ HostRoot: 3,
8
+ HostComponent: 5,
9
+ ContextProvider: 10,
10
+ Suspense: 13,
11
+ Offscreen: 22,
12
+ Activity: 31,
13
+ } as const
14
+
15
+ declare const brand: unique symbol
16
+ export type FiberNode = { readonly [brand]: 'FiberNode' }
17
+ export type ShadowNode = { readonly __hostObjectShadowNodeWrapper?: unknown }
18
+
19
+ export type RawFiber = {
20
+ tag: number
21
+ type: any
22
+ return: RawFiber | null
23
+ child: RawFiber | null
24
+ sibling: RawFiber | null
25
+ alternate: RawFiber | null
26
+ stateNode: any
27
+ memoizedProps: any
28
+ pendingProps: any
29
+ memoizedState: any
30
+ _debugOwner?: any
31
+ _debugStack?: { stack?: string } | null
32
+ }
33
+
34
+ export const raw = (fiber: FiberNode | null | undefined) => fiber as unknown as RawFiber | null | undefined
35
+
36
+ export const hostFiberOf = (instance: unknown): FiberNode | null =>
37
+ ((instance as any)?.__internalInstanceHandle ?? null) as FiberNode | null
38
+
39
+ // RN composites that keep their host behind a ref of their own, most common first
40
+ const compositeHostRefs: Array<(handle: any) => unknown> = [
41
+ (handle) => handle?.getScrollResponder?.()?.getNativeScrollRef?.(), // FlatList, SectionList, VirtualizedList
42
+ (handle) => handle?.getNativeScrollRef?.(), // ScrollView
43
+ (handle) => handle?._viewRef, // ImageBackground
44
+ (handle) => handle?.viewRef?.current, // KeyboardAvoidingView
45
+ (handle) => handle?._nativeRef, // RefreshControl
46
+ ]
47
+
48
+ export const resolveHostFiber = (handle: unknown): FiberNode | null => {
49
+ const direct = hostFiberOf(handle)
50
+
51
+ if (direct || !handle) {
52
+ return direct
53
+ }
54
+
55
+ for (let i = 0; i < compositeHostRefs.length; i++) {
56
+ const fiber = hostFiberOf(compositeHostRefs[i]!(handle))
57
+
58
+ if (fiber) {
59
+ return fiber
60
+ }
61
+ }
62
+
63
+ return null
64
+ }
65
+
66
+ export const fiberOfInstance = (instance: unknown): FiberNode | null =>
67
+ ((instance as any)?._reactInternals ?? null) as FiberNode | null
68
+
69
+ export const firstHostBelow = (fiber: FiberNode | null): FiberNode | null => {
70
+ let current = raw(fiber)
71
+
72
+ while (current && current.tag !== Tag.HostComponent) {
73
+ current = current.child
74
+ }
75
+
76
+ return (current ?? null) as FiberNode | null
77
+ }
78
+
79
+ export const hostAncestor = (fiber: FiberNode | null, levels = 1): FiberNode | null => {
80
+ let current = raw(fiber)?.return
81
+
82
+ while (current) {
83
+ if (current.tag === Tag.HostComponent && --levels === 0) {
84
+ return current as unknown as FiberNode
85
+ }
86
+
87
+ current = current.return
88
+ }
89
+
90
+ return null
91
+ }
92
+
93
+ export const shadowNodesOf = (fiber: FiberNode | null, out: Array<ShadowNode>) => {
94
+ const current = raw(fiber)
95
+ const node = current?.stateNode?.node
96
+ const alternateNode = current?.alternate?.stateNode?.node
97
+
98
+ if (node) {
99
+ out.push(node)
100
+ }
101
+
102
+ if (alternateNode && alternateNode !== node) {
103
+ out.push(alternateNode)
104
+ }
105
+ }
106
+
107
+ const childOfParent = (parent: RawFiber, a: RawFiber, b: RawFiber): RawFiber | null => {
108
+ for (let child = parent.child; child; child = child.sibling) {
109
+ if (child === a || child === b) {
110
+ return child
111
+ }
112
+ }
113
+
114
+ return null
115
+ }
116
+
117
+ // React 19.2 findCurrentFiberUsingSlowPath, returning null where React throws
118
+ export const committedOf = (fiber: FiberNode | null): FiberNode | null => {
119
+ const self = raw(fiber)
120
+
121
+ if (!self) {
122
+ return null
123
+ }
124
+
125
+ const alternate = self.alternate
126
+
127
+ if (!alternate) {
128
+ let root = self
129
+
130
+ while (root.return) {
131
+ root = root.return
132
+ }
133
+
134
+ return root.tag === Tag.HostRoot ? fiber : null
135
+ }
136
+
137
+ let a: RawFiber = self
138
+ let b: RawFiber = alternate
139
+
140
+ while (true) {
141
+ const parentA = a.return
142
+
143
+ if (!parentA) {
144
+ break
145
+ }
146
+
147
+ const parentB = parentA.alternate
148
+
149
+ if (!parentB) {
150
+ const next = parentA.return
151
+
152
+ if (next) {
153
+ a = next
154
+ continue
155
+ }
156
+
157
+ break
158
+ }
159
+
160
+ if (parentA.child === parentB.child) {
161
+ const found = childOfParent(parentA, a, b)
162
+
163
+ return found === a ? fiber : found === b ? (alternate as unknown as FiberNode) : null
164
+ }
165
+
166
+ if (a.return !== b.return) {
167
+ a = parentA
168
+ b = parentB
169
+ } else {
170
+ const inA = childOfParent(parentA, a, b)
171
+ const inB = inA ? null : childOfParent(parentB, a, b)
172
+
173
+ if (!inA && !inB) {
174
+ return null
175
+ }
176
+
177
+ const aUnderA = inA ? inA === a : inB !== a
178
+
179
+ a = aUnderA ? parentA : parentB
180
+ b = aUnderA ? parentB : parentA
181
+ }
182
+
183
+ if (a.alternate !== b) {
184
+ return null
185
+ }
186
+ }
187
+
188
+ if (a.tag !== Tag.HostRoot) {
189
+ return null
190
+ }
191
+
192
+ return a.stateNode?.current === a ? fiber : (alternate as unknown as FiberNode)
193
+ }
194
+
195
+ // a provider's other half can hold its previous value
196
+ const committedProviderValue = (provider: RawFiber): unknown => {
197
+ const alternate = provider.alternate
198
+
199
+ if (!alternate || alternate.memoizedProps?.value === provider.memoizedProps?.value) {
200
+ return provider.memoizedProps?.value
201
+ }
202
+
203
+ return (raw(committedOf(provider as unknown as FiberNode)) ?? provider).memoizedProps?.value
204
+ }
205
+
206
+ export const readContext = <T>(fiber: FiberNode | null, context: Context<T>, fallback?: T): T | undefined => {
207
+ for (let current = raw(fiber)?.return; current; current = current.return) {
208
+ if (current.tag === Tag.ContextProvider && (current.type === context || current.type?._context === context)) {
209
+ return committedProviderValue(current) as T
210
+ }
211
+ }
212
+
213
+ return fallback
214
+ }
215
+
216
+ // Fabric is a secondary renderer: its context stack is `_currentValue2`. Only valid during render.
217
+ export const readContextDuringRender = <T>(context: Context<T>): T | undefined =>
218
+ (context as any)?._currentValue2
219
+
220
+ export type ContextReader = <T>(context: Context<T>) => T | undefined
221
+
222
+ export const contextReaderFor = (instance: unknown, rendering: boolean): ContextReader =>
223
+ rendering ? readContextDuringRender : (context) => readCommittedContext(instance, context)
224
+
225
+ const NO_PROVIDER = Symbol('no provider')
226
+
227
+ const readCommittedContext = <T>(instance: unknown, context: Context<T>): T | undefined => {
228
+ const value = readContext(committedOf(fiberOfInstance(instance)), context, NO_PROVIDER as T)
229
+
230
+ return value === NO_PROVIDER ? readContextDuringRender(context) : value
231
+ }
232
+
233
+ // pendingProps too, so React still bails out. Replaced, not mutated: props are frozen in dev.
234
+ export const patchRenderedProps = (
235
+ fiber: FiberNode | null,
236
+ patch: (props: Record<string, any>) => Record<string, any> | undefined,
237
+ ): boolean => {
238
+ const self = raw(fiber)
239
+
240
+ if (!self) {
241
+ return false
242
+ }
243
+
244
+ const patchedSelf = replaceProps(self, patch)
245
+ const patchedAlternate = self.alternate ? replaceProps(self.alternate, patch) : false
246
+
247
+ return patchedSelf || patchedAlternate
248
+ }
249
+
250
+ const replaceProps = (target: RawFiber, patch: (props: Record<string, any>) => Record<string, any> | undefined) => {
251
+ const props = target.memoizedProps
252
+ const next = props ? patch(props) : undefined
253
+
254
+ if (!next) {
255
+ return false
256
+ }
257
+
258
+ target.memoizedProps = next
259
+ target.pendingProps = next
260
+
261
+ return true
262
+ }
@@ -0,0 +1,236 @@
1
+ // A Host is the view's creation fiber behind an opaque type: no allocation, and stable identity (=== / WeakMap keys).
2
+ import type { FiberNode, RawFiber, ShadowNode } from './fiber'
3
+ import * as fiber from './fiber'
4
+
5
+ // Bound once: Metro's inline requires would turn each imported name used in a function into a require per call
6
+ const {
7
+ committedOf,
8
+ fiberOfInstance,
9
+ firstHostBelow,
10
+ hostAncestor,
11
+ patchRenderedProps: patchFiberProps,
12
+ raw,
13
+ resolveHostFiber,
14
+ shadowNodesOf,
15
+ } = fiber
16
+ const { HostComponent: HOST_COMPONENT, Offscreen: OFFSCREEN, Suspense: SUSPENSE, Activity: ACTIVITY } = fiber.Tag
17
+
18
+ declare const brand: unique symbol
19
+ export type Host = { readonly [brand]: 'Host' }
20
+
21
+ export const fiberOf = (host: Host): RawFiber => host as unknown as RawFiber
22
+
23
+ export const toHost = (fiber: RawFiber | FiberNode | null | undefined): Host | undefined =>
24
+ ((fiber as RawFiber | null | undefined)?.stateNode?.canonical?.internalInstanceHandle ?? undefined) as Host | undefined
25
+
26
+ const resolveRefSlowly = (ref: unknown): RawFiber | undefined =>
27
+ raw(resolveHostFiber(ref)) ?? (toHost(firstHostBelow(fiberOfInstance(ref))) as unknown as RawFiber | undefined)
28
+
29
+ // The fast path is inlined: legacy Hermes doesn't inline calls
30
+ export const getHostFor = (ref: unknown): Host | undefined => {
31
+ const fiber = (ref as { __internalInstanceHandle?: RawFiber } | null | undefined)?.__internalInstanceHandle
32
+
33
+ if (fiber !== undefined) {
34
+ return fiber as unknown as Host
35
+ }
36
+
37
+ return resolveRefSlowly(ref) as unknown as Host | undefined
38
+ }
39
+
40
+ export const getShadowNodeFor = (ref: unknown): ShadowNode | undefined => {
41
+ const fiber = (ref as { __internalInstanceHandle?: RawFiber } | null | undefined)?.__internalInstanceHandle
42
+
43
+ if (fiber !== undefined) {
44
+ return fiber.stateNode?.node
45
+ }
46
+
47
+ return resolveRefSlowly(ref)?.stateNode?.node
48
+ }
49
+
50
+ export const getHostForInstanceHandle = (handle: unknown): Host | undefined => toHost(handle as RawFiber | null | undefined)
51
+
52
+ // Not the first host below the scroll view: on iOS a refreshControl comes first
53
+ export const getContentContainerFor = (ref: any): Host | undefined => {
54
+ const scroll = ref?.getInnerViewRef ? ref : (ref?.getNativeScrollRef?.() ?? ref?.getScrollResponder?.())
55
+
56
+ return getHostFor(scroll?.getInnerViewRef?.())
57
+ }
58
+
59
+ export const getShadowNode = (host: Host): ShadowNode | undefined => fiberOf(host).stateNode?.node
60
+
61
+ // Two nodes only while a render is in flight; after a commit both halves share one
62
+ export const getShadowNodes = (host: Host, out: Array<ShadowNode> = []): Array<ShadowNode> => {
63
+ shadowNodesOf(host as unknown as FiberNode, out)
64
+
65
+ return out
66
+ }
67
+
68
+ export const getNativeTag = (host: Host): number | undefined => fiberOf(host).stateNode?.canonical?.nativeTag
69
+
70
+ export const getParentHost = (host: Host): Host | undefined => toHost(hostAncestor(host as unknown as FiberNode))
71
+
72
+ export const patchRenderedProps = (host: Host, patch: (props: Record<string, any>) => Record<string, any> | undefined): boolean =>
73
+ patchFiberProps(host as unknown as FiberNode, patch)
74
+
75
+ export const HiddenBy = {
76
+ None: 0,
77
+ Suspense: 1,
78
+ Freeze: 2,
79
+ Activity: 4,
80
+ } as const
81
+
82
+ // `return` can point into either half of a pair; ask which half is committed only when they disagree
83
+ export const committedHalf = (fiber: RawFiber, differs: (a: RawFiber, b: RawFiber) => boolean): RawFiber | null => {
84
+ const alternate = fiber.alternate
85
+
86
+ if (!alternate || !differs(fiber, alternate)) {
87
+ return fiber
88
+ }
89
+
90
+ return raw(committedOf(fiber as unknown as FiberNode)) ?? null
91
+ }
92
+
93
+ const hiddenStateDiffers = (a: RawFiber, b: RawFiber) => (a.memoizedState === null) !== (b.memoizedState === null)
94
+
95
+ // React's own visibility bit on the Offscreen instance: shared by both halves and flipped in the commit before refs
96
+ // detach, so it also holds inside a ref cleanup, where the committed half is still the old tree
97
+ const OFFSCREEN_VISIBLE = 1
98
+ const isOffscreenHidden = (offscreen: RawFiber): boolean => {
99
+ const visibility = offscreen.stateNode?._visibility
100
+
101
+ if (typeof visibility === 'number') {
102
+ return (visibility & OFFSCREEN_VISIBLE) === 0
103
+ }
104
+
105
+ return committedHalf(offscreen, hiddenStateDiffers)?.memoizedState != null
106
+ }
107
+ const freezeDiffers = (a: RawFiber, b: RawFiber) => a.memoizedProps?.freeze !== b.memoizedProps?.freeze
108
+
109
+ // react-freeze: Freeze > Suspense > Suspender. The Suspender keeps stale props because it throws, so read Freeze's.
110
+ const isFrozenBoundary = (suspense: RawFiber) =>
111
+ committedHalf(suspense.return as RawFiber, freezeDiffers)?.memoizedProps?.freeze === true
112
+
113
+ // Every hidden subtree sits under an Offscreen fiber with memoizedState set
114
+ export const getHiddenReasons = (host: Host): number => {
115
+ let reasons = 0
116
+
117
+ for (let current = fiberOf(host).return; current; current = current.return) {
118
+ if (current.tag !== OFFSCREEN || !isOffscreenHidden(current)) {
119
+ continue
120
+ }
121
+
122
+ const boundary = current.return
123
+
124
+ if (boundary?.tag === ACTIVITY) {
125
+ reasons |= HiddenBy.Activity
126
+ } else if (boundary?.tag === SUSPENSE) {
127
+ reasons |= isFrozenBoundary(boundary) ? HiddenBy.Freeze : HiddenBy.Suspense
128
+ }
129
+ }
130
+
131
+ return reasons
132
+ }
133
+
134
+ // Any hidden Offscreen, as in collectVisibleAncestors. Stops at the first: the reason isn't needed
135
+ export const isHidden = (host: Host): boolean => {
136
+ for (let current = fiberOf(host).return; current; current = current.return) {
137
+ if (current.tag === OFFSCREEN && isOffscreenHidden(current)) {
138
+ return true
139
+ }
140
+ }
141
+
142
+ return false
143
+ }
144
+ export const isSuspended = (host: Host) => (getHiddenReasons(host) & HiddenBy.Suspense) !== 0
145
+ export const isFrozen = (host: Host) => (getHiddenReasons(host) & HiddenBy.Freeze) !== 0
146
+ export const isInHiddenActivity = (host: Host) => (getHiddenReasons(host) & HiddenBy.Activity) !== 0
147
+
148
+ const isHiddenOffscreen = (offscreen: RawFiber, boundaries: Map<RawFiber, boolean>): boolean => {
149
+ let hidden = boundaries.get(offscreen)
150
+
151
+ if (hidden === undefined) {
152
+ hidden = isOffscreenHidden(offscreen)
153
+ boundaries.set(offscreen, hidden)
154
+
155
+ if (offscreen.alternate) {
156
+ boundaries.set(offscreen.alternate, hidden)
157
+ }
158
+ }
159
+
160
+ return hidden
161
+ }
162
+
163
+ // Hot loops below: indexed loops and writes, explicit null checks, no helper calls (legacy Hermes)
164
+ export const collectVisibleAncestors = (hosts: ReadonlyArray<Host | null | undefined>, visit: (host: Host) => void) => {
165
+ const visibleByTag = new Map<number, boolean>()
166
+ const boundaries = new Map<RawFiber, boolean>()
167
+ const pending: Array<RawFiber> = []
168
+
169
+ for (let h = 0; h < hosts.length; h++) {
170
+ let visible = true
171
+ let count = 0
172
+
173
+ for (let current = hosts[h] as unknown as RawFiber | null | undefined; current != null; current = current.return) {
174
+ if (current.tag === HOST_COMPONENT) {
175
+ const stateNode = current.stateNode
176
+
177
+ if (stateNode == null || stateNode.canonical == null) {
178
+ break
179
+ }
180
+
181
+ const answer = visibleByTag.get(stateNode.canonical.nativeTag)
182
+
183
+ if (answer !== undefined) {
184
+ visible = answer
185
+ break
186
+ }
187
+
188
+ pending[count++] = current
189
+ } else if (current.tag === OFFSCREEN && isHiddenOffscreen(current, boundaries)) {
190
+ visible = false
191
+ break
192
+ }
193
+ }
194
+
195
+ for (let i = 0; i < count; i++) {
196
+ const canonical = pending[i]!.stateNode.canonical
197
+
198
+ visibleByTag.set(canonical.nativeTag, visible)
199
+
200
+ if (visible && canonical.internalInstanceHandle != null) {
201
+ visit(canonical.internalInstanceHandle as Host)
202
+ }
203
+ }
204
+ }
205
+ }
206
+
207
+ // Hidden hosts included
208
+ export const collectAncestors = (hosts: ReadonlyArray<Host | null | undefined>, visit: (host: Host) => void) => {
209
+ const visitedByTag = new Set<number>()
210
+
211
+ for (let h = 0; h < hosts.length; h++) {
212
+ for (let current = hosts[h] as unknown as RawFiber | null | undefined; current != null; current = current.return) {
213
+ if (current.tag !== HOST_COMPONENT) {
214
+ continue
215
+ }
216
+
217
+ const stateNode = current.stateNode
218
+
219
+ if (stateNode == null || stateNode.canonical == null) {
220
+ break
221
+ }
222
+
223
+ const canonical = stateNode.canonical
224
+
225
+ if (visitedByTag.has(canonical.nativeTag)) {
226
+ break
227
+ }
228
+
229
+ visitedByTag.add(canonical.nativeTag)
230
+
231
+ if (canonical.internalInstanceHandle != null) {
232
+ visit(canonical.internalInstanceHandle as Host)
233
+ }
234
+ }
235
+ }
236
+ }
@@ -0,0 +1,43 @@
1
+ import { createOwnerRegistry } from './adapters/registry'
2
+ import { animatedComponentOf, reanimatedCSSAdapter } from './adapters/reanimated'
3
+ import { getCreationStack, getOwners, verify } from './diagnostics'
4
+ import * as HostApi from './host'
5
+
6
+ export type { Host } from './host'
7
+ export type { Drift } from './diagnostics'
8
+ export type { ShadowNode } from './fiber'
9
+ export type { OwnerAdapter, OwnerRegistry, StyleSource } from './adapters/registry'
10
+
11
+ // Object literals, not classes: static methods on a Babel-transpiled class are slower on Hermes
12
+ export const Fiber = {
13
+ getHostFor: HostApi.getHostFor,
14
+ getShadowNodeFor: HostApi.getShadowNodeFor,
15
+ getHostForInstanceHandle: HostApi.getHostForInstanceHandle,
16
+ getContentContainerFor: HostApi.getContentContainerFor,
17
+
18
+ getShadowNode: HostApi.getShadowNode,
19
+ getShadowNodes: HostApi.getShadowNodes,
20
+ getNativeTag: HostApi.getNativeTag,
21
+ getParentHost: HostApi.getParentHost,
22
+
23
+ isHidden: HostApi.isHidden,
24
+ isSuspended: HostApi.isSuspended,
25
+ isFrozen: HostApi.isFrozen,
26
+ isInHiddenActivity: HostApi.isInHiddenActivity,
27
+
28
+ collectVisibleAncestors: HostApi.collectVisibleAncestors,
29
+ collectAncestors: HostApi.collectAncestors,
30
+
31
+ patchRenderedProps: HostApi.patchRenderedProps,
32
+
33
+ verify,
34
+ getOwners,
35
+ getCreationStack,
36
+
37
+ createOwnerRegistry,
38
+ }
39
+
40
+ export const Reanimated = {
41
+ animatedComponentOf,
42
+ cssAdapter: reanimatedCSSAdapter,
43
+ }
@@ -3,6 +3,31 @@ import type { CSSState } from './state'
3
3
  import { isPseudoClass } from '../convert/pseudo'
4
4
  import { getMediaQuery } from '../utils'
5
5
 
6
+ type SetProps = Parameters<CSSState['set']>[0]
7
+
8
+ // box-none and box-only aren't CSS values, polyfill them like react-native-web: [element, children]
9
+ const POINTER_EVENTS: Record<string, [string, string]> = {
10
+ 'box-none': ['none', 'auto'],
11
+ 'box-only': ['auto', 'none'],
12
+ }
13
+
14
+ export const getChildrenClassName = (className: string) => `:where(.${className})>*`
15
+
16
+ const setStyle = (state: CSSState, props: SetProps) => {
17
+ if (props.propertyKey !== 'pointerEvents') {
18
+ state.set(props)
19
+
20
+ return
21
+ }
22
+
23
+ const [value, childrenValue] = POINTER_EVENTS[props.value] ?? [props.value]
24
+
25
+ state.set({ ...props, value })
26
+ // :where() has no specificity, so a child's own pointerEvents always wins
27
+ // set it for every value, so re-applying the style can't leave a stale children rule
28
+ state.set({ ...props, className: getChildrenClassName(props.className), value: childrenValue })
29
+ }
30
+
6
31
  export const convertToCSS = (hash: string, value: Record<string, any>, state: CSSState) => {
7
32
  Object.entries(value).forEach(([styleKey, styleValue]) => {
8
33
  if (styleKey[0] === '_') {
@@ -15,7 +40,7 @@ export const convertToCSS = (hash: string, value: Record<string, any>, state: CS
15
40
  Object.entries(pseudoStyleValue).forEach(([breakpointStyleKey, breakpointStyleValue]) => {
16
41
  const mediaQuery = getMediaQuery(pseudoStyleKey, allBreakpoints)
17
42
 
18
- state.set({
43
+ setStyle(state, {
19
44
  mediaQuery,
20
45
  className: pseudoClassName,
21
46
  propertyKey: breakpointStyleKey,
@@ -26,7 +51,7 @@ export const convertToCSS = (hash: string, value: Record<string, any>, state: CS
26
51
  return
27
52
  }
28
53
 
29
- state.set({
54
+ setStyle(state, {
30
55
  className: pseudoClassName,
31
56
  propertyKey: pseudoStyleKey,
32
57
  value: pseudoStyleValue,
@@ -49,7 +74,7 @@ export const convertToCSS = (hash: string, value: Record<string, any>, state: CS
49
74
  .map(([key]) => key)
50
75
  const mediaQuery = getMediaQuery(styleKey, allBreakpoints)
51
76
 
52
- state.set({
77
+ setStyle(state, {
53
78
  mediaQuery,
54
79
  className: hash,
55
80
  propertyKey: breakpointStyleKey,
@@ -60,7 +85,7 @@ export const convertToCSS = (hash: string, value: Record<string, any>, state: CS
60
85
  return
61
86
  }
62
87
 
63
- state.set({
88
+ setStyle(state, {
64
89
  className: hash,
65
90
  propertyKey: styleKey,
66
91
  value: styleValue,
@@ -3,7 +3,7 @@ import type { UnistylesServices } from '../types'
3
3
 
4
4
  import { convertUnistyles } from '../convert'
5
5
  import { hyphenate, isServer } from '../utils'
6
- import { convertToCSS } from './core'
6
+ import { convertToCSS, getChildrenClassName } from './core'
7
7
 
8
8
  type MapType = Map<string, Map<string, Map<string, any>>>
9
9
  type SetProps = {
@@ -105,11 +105,15 @@ export class CSSState {
105
105
  }
106
106
 
107
107
  remove = (hash: string) => {
108
+ const childrenClassName = getChildrenClassName(hash)
109
+
108
110
  this.mainMap.forEach((styles) => {
109
111
  styles.delete(hash)
112
+ styles.delete(childrenClassName)
110
113
  })
111
114
  this.mqMap.forEach((styles) => {
112
115
  styles.delete(hash)
116
+ styles.delete(childrenClassName)
113
117
  })
114
118
  this.recreate()
115
119
  }
@@ -125,7 +129,7 @@ export class CSSState {
125
129
  }
126
130
 
127
131
  for (const [className, thirdLevelMap] of secondLevelMap) {
128
- styles += `.${className}{`
132
+ styles += className[0] === ':' ? `${className}{` : `.${className}{`
129
133
 
130
134
  for (const [propertyKey, value] of thirdLevelMap) {
131
135
  if (value === undefined) {
@@ -112,7 +112,7 @@ export class UnistylesRegistry {
112
112
 
113
113
  add = (value: UnistylesValues, forChild?: boolean) => {
114
114
  const generatedHash = generateHash(value)
115
- const hash = forChild ? `${generatedHash} > *` : generatedHash
115
+ const hash = forChild ? `${generatedHash}_child > *` : generatedHash
116
116
 
117
117
  if (!this.stylesCache.has(hash)) {
118
118
  this.applyStyles(hash, value)
@@ -98,9 +98,13 @@ export const getMediaQuery = (query: string, allBreakpoints: Array<string>) => {
98
98
  .map((b) => unistyles.services.runtime.breakpoints[b] as number)
99
99
  .sort((a, b) => a - b)
100
100
  .find((b) => b > breakpointValue)
101
+ // Viewport widths are fractional CSS px under browser zoom / OS scaling, so an integer
102
+ // `max-width: next - 1` leaves a dead band (e.g. 767 < width < 768) that matches neither
103
+ // this breakpoint nor the next one. 0.02px below the next breakpoint (the Bootstrap
104
+ // convention) closes it without overlapping `(min-width: next)`.
101
105
  const queries = [
102
106
  `(min-width: ${breakpointValue}px)`,
103
- nextBreakpoint ? `(max-width: ${nextBreakpoint - 1}px)` : undefined,
107
+ nextBreakpoint ? `(max-width: ${nextBreakpoint - 0.02}px)` : undefined,
104
108
  ]
105
109
  .filter(Boolean)
106
110
  .join(' and ')
@@ -138,12 +142,17 @@ export const checkForAnimated = (value: any): boolean => {
138
142
  }
139
143
 
140
144
  if (typeof value === 'object' && value !== null) {
145
+ // Reanimated useAnimatedStyle handle, it's a plain object, not an Animated.Node
146
+ // styleUpdaterContainer was added in Reanimated 4.1, so check only the keys every version has
147
+ if ('viewDescriptors' in value && 'initial' in value) {
148
+ return true
149
+ }
150
+
141
151
  const objectValues = Object.values(value)
142
152
  const secrets = extractSecrets(value)
143
153
 
144
- // @ts-expect-error React Native Web exports Animated.AnimatedNode as Animated.Node
145
154
  // prettier-ignore
146
- return value instanceof Animated.Node || objectValues.length > 0 && objectValues.some(checkForAnimated) || secrets && Object.keys(secrets).length === 0
155
+ return value instanceof Animated.Node || objectValues.length > 0 && objectValues.some(checkForAnimated) || !!secrets && Object.keys(secrets).length === 0
147
156
  }
148
157
 
149
158
  return false
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=mocks.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mocks.spec.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/mocks.spec.ts"],"names":[],"mappings":""}