react-native-unistyles 3.5.3 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (401) hide show
  1. package/README.md +6 -8
  2. package/android/build.gradle +42 -0
  3. package/android/src/legacy/java/com/unistyles/NativePlatform+extraWindows.kt +16 -0
  4. package/android/src/main/cxx/NativeUnistylesModule.cpp +5 -11
  5. package/android/src/main/cxx/NativeUnistylesModule.h +0 -4
  6. package/android/src/main/java/com/unistyles/NativePlatform+android.kt +82 -39
  7. package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +73 -0
  8. package/android/src/main/java/com/unistyles/UnistylesModule.kt +2 -13
  9. package/android/src/rn86/java/com/unistyles/NativePlatform+extraWindows.kt +28 -0
  10. package/cxx/common/PerformanceTracing.h +85 -0
  11. package/cxx/converters/BackgroundImageConverter.cpp +198 -11
  12. package/cxx/converters/BackgroundImageConverter.h +1 -0
  13. package/cxx/converters/BackgroundLayerConverter.cpp +523 -0
  14. package/cxx/converters/BackgroundLayerConverter.h +14 -0
  15. package/cxx/converters/FontVariationSettingsConverter.cpp +104 -0
  16. package/cxx/converters/FontVariationSettingsConverter.h +17 -0
  17. package/cxx/core/HostUnistyle.cpp +6 -0
  18. package/cxx/core/UnistyleWrapper.h +16 -1
  19. package/cxx/hybridObjects/HybridShadowRegistry.cpp +13 -0
  20. package/cxx/hybridObjects/HybridStyleSheet.cpp +11 -0
  21. package/cxx/hybridObjects/HybridStyleSheet.h +1 -0
  22. package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +10 -30
  23. package/cxx/hybridObjects/HybridUnistylesRuntime.h +2 -2
  24. package/cxx/parser/Parser.cpp +92 -5
  25. package/cxx/shadowTree/ShadowTreeDiagnostics.cpp +74 -0
  26. package/cxx/shadowTree/ShadowTreeManager.cpp +3 -0
  27. package/ios/NativePlatform+ios.swift +22 -11
  28. package/ios/NativePlatformListener+ios.swift +9 -0
  29. package/lib/commonjs/components/NamedTheme.js +4 -4
  30. package/lib/commonjs/components/NamedTheme.js.map +1 -1
  31. package/lib/commonjs/components/ScopedThemeContext.js +3 -1
  32. package/lib/commonjs/components/ScopedThemeContext.js.map +1 -1
  33. package/lib/commonjs/components/native/deep/ActivityIndicator.js +19 -0
  34. package/lib/commonjs/components/native/deep/ActivityIndicator.js.map +1 -0
  35. package/lib/commonjs/components/native/deep/Animated.js +19 -0
  36. package/lib/commonjs/components/native/deep/Animated.js.map +1 -0
  37. package/lib/commonjs/components/native/deep/FlatList.js +19 -0
  38. package/lib/commonjs/components/native/deep/FlatList.js.map +1 -0
  39. package/lib/commonjs/components/native/deep/Image.js +19 -0
  40. package/lib/commonjs/components/native/deep/Image.js.map +1 -0
  41. package/lib/commonjs/components/native/deep/ImageBackground.js +19 -0
  42. package/lib/commonjs/components/native/deep/ImageBackground.js.map +1 -0
  43. package/lib/commonjs/components/native/deep/KeyboardAvoidingView.js +19 -0
  44. package/lib/commonjs/components/native/deep/KeyboardAvoidingView.js.map +1 -0
  45. package/lib/commonjs/components/native/deep/Pressable.js +19 -0
  46. package/lib/commonjs/components/native/deep/Pressable.js.map +1 -0
  47. package/lib/commonjs/components/native/deep/RefreshControl.js +19 -0
  48. package/lib/commonjs/components/native/deep/RefreshControl.js.map +1 -0
  49. package/lib/commonjs/components/native/deep/SafeAreaView.js +19 -0
  50. package/lib/commonjs/components/native/deep/SafeAreaView.js.map +1 -0
  51. package/lib/commonjs/components/native/deep/ScrollView.js +19 -0
  52. package/lib/commonjs/components/native/deep/ScrollView.js.map +1 -0
  53. package/lib/commonjs/components/native/deep/SectionList.js +19 -0
  54. package/lib/commonjs/components/native/deep/SectionList.js.map +1 -0
  55. package/lib/commonjs/components/native/deep/Switch.js +19 -0
  56. package/lib/commonjs/components/native/deep/Switch.js.map +1 -0
  57. package/lib/commonjs/components/native/deep/Text.js +19 -0
  58. package/lib/commonjs/components/native/deep/Text.js.map +1 -0
  59. package/lib/commonjs/components/native/deep/TextInput.js +19 -0
  60. package/lib/commonjs/components/native/deep/TextInput.js.map +1 -0
  61. package/lib/commonjs/components/native/deep/TextNativeComponent.js +28 -0
  62. package/lib/commonjs/components/native/deep/TextNativeComponent.js.map +1 -0
  63. package/lib/commonjs/components/native/deep/TouchableHighlight.js +19 -0
  64. package/lib/commonjs/components/native/deep/TouchableHighlight.js.map +1 -0
  65. package/lib/commonjs/components/native/deep/TouchableOpacity.js +19 -0
  66. package/lib/commonjs/components/native/deep/TouchableOpacity.js.map +1 -0
  67. package/lib/commonjs/components/native/deep/View.js +19 -0
  68. package/lib/commonjs/components/native/deep/View.js.map +1 -0
  69. package/lib/commonjs/components/native/deep/ViewNativeComponent.js +26 -0
  70. package/lib/commonjs/components/native/deep/ViewNativeComponent.js.map +1 -0
  71. package/lib/commonjs/components/native/deep/VirtualizedList.js +19 -0
  72. package/lib/commonjs/components/native/deep/VirtualizedList.js.map +1 -0
  73. package/lib/commonjs/components/native/index.js +43 -0
  74. package/lib/commonjs/components/native/index.js.map +1 -0
  75. package/lib/commonjs/core/createUnistylesActivityIndicator.js +13 -3
  76. package/lib/commonjs/core/createUnistylesActivityIndicator.js.map +1 -1
  77. package/lib/commonjs/core/createUnistylesElement.native.js +6 -0
  78. package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -1
  79. package/lib/commonjs/core/createUnistylesImageBackground.js +26 -19
  80. package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
  81. package/lib/commonjs/core/createUnistylesTouchableHighlight.js +6 -0
  82. package/lib/commonjs/core/createUnistylesTouchableHighlight.js.map +1 -1
  83. package/lib/commonjs/core/getClassname.js +15 -0
  84. package/lib/commonjs/core/getClassname.js.map +1 -1
  85. package/lib/commonjs/core/hasUnistyles.js +26 -0
  86. package/lib/commonjs/core/hasUnistyles.js.map +1 -0
  87. package/lib/commonjs/core/withUnistyles/withUnistyles.js +10 -7
  88. package/lib/commonjs/core/withUnistyles/withUnistyles.js.map +1 -1
  89. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +22 -3
  90. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
  91. package/lib/commonjs/mocks.js +27 -3
  92. package/lib/commonjs/mocks.js.map +1 -1
  93. package/lib/commonjs/specs/ShadowRegistry/index.js +69 -76
  94. package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
  95. package/lib/commonjs/specs/ShadowRegistry/styleSource.js +65 -0
  96. package/lib/commonjs/specs/ShadowRegistry/styleSource.js.map +1 -0
  97. package/lib/commonjs/specs/ShadowRegistry/tracing.js +26 -0
  98. package/lib/commonjs/specs/ShadowRegistry/tracing.js.map +1 -0
  99. package/lib/commonjs/unifiber/src/adapters/reanimated.js +157 -0
  100. package/lib/commonjs/unifiber/src/adapters/reanimated.js.map +1 -0
  101. package/lib/commonjs/unifiber/src/adapters/registry.js +67 -0
  102. package/lib/commonjs/unifiber/src/adapters/registry.js.map +1 -0
  103. package/lib/commonjs/unifiber/src/diagnostics.js +59 -0
  104. package/lib/commonjs/unifiber/src/diagnostics.js.map +1 -0
  105. package/lib/commonjs/unifiber/src/fiber.js +199 -0
  106. package/lib/commonjs/unifiber/src/fiber.js.map +1 -0
  107. package/lib/commonjs/unifiber/src/host.js +214 -0
  108. package/lib/commonjs/unifiber/src/host.js.map +1 -0
  109. package/lib/commonjs/unifiber/src/index.js +38 -0
  110. package/lib/commonjs/unifiber/src/index.js.map +1 -0
  111. package/lib/commonjs/utils.js +52 -1
  112. package/lib/commonjs/utils.js.map +1 -1
  113. package/lib/commonjs/web/convert/index.js +19 -1
  114. package/lib/commonjs/web/convert/index.js.map +1 -1
  115. package/lib/commonjs/web/convert/module.d.ts +3 -0
  116. package/lib/commonjs/web/convert/object/backgroundLayers.js +30 -0
  117. package/lib/commonjs/web/convert/object/backgroundLayers.js.map +1 -0
  118. package/lib/commonjs/web/convert/object/fontVariationSettings.js +12 -0
  119. package/lib/commonjs/web/convert/object/fontVariationSettings.js.map +1 -0
  120. package/lib/commonjs/web/convert/object/index.js +22 -0
  121. package/lib/commonjs/web/convert/object/index.js.map +1 -1
  122. package/lib/commonjs/web/convert/utils.js +7 -1
  123. package/lib/commonjs/web/convert/utils.js.map +1 -1
  124. package/lib/commonjs/web/registry.js +6 -4
  125. package/lib/commonjs/web/registry.js.map +1 -1
  126. package/lib/commonjs/web/runtime.js +9 -6
  127. package/lib/commonjs/web/runtime.js.map +1 -1
  128. package/lib/commonjs/web/utils/unistyle.js +9 -3
  129. package/lib/commonjs/web/utils/unistyle.js.map +1 -1
  130. package/lib/module/components/NamedTheme.js +4 -4
  131. package/lib/module/components/NamedTheme.js.map +1 -1
  132. package/lib/module/components/ScopedThemeContext.js +3 -1
  133. package/lib/module/components/ScopedThemeContext.js.map +1 -1
  134. package/lib/module/components/native/deep/ActivityIndicator.js +5 -0
  135. package/lib/module/components/native/deep/ActivityIndicator.js.map +1 -0
  136. package/lib/module/components/native/deep/Animated.js +5 -0
  137. package/lib/module/components/native/deep/Animated.js.map +1 -0
  138. package/lib/module/components/native/deep/FlatList.js +5 -0
  139. package/lib/module/components/native/deep/FlatList.js.map +1 -0
  140. package/lib/module/components/native/deep/Image.js +5 -0
  141. package/lib/module/components/native/deep/Image.js.map +1 -0
  142. package/lib/module/components/native/deep/ImageBackground.js +5 -0
  143. package/lib/module/components/native/deep/ImageBackground.js.map +1 -0
  144. package/lib/module/components/native/deep/KeyboardAvoidingView.js +5 -0
  145. package/lib/module/components/native/deep/KeyboardAvoidingView.js.map +1 -0
  146. package/lib/module/components/native/deep/Pressable.js +5 -0
  147. package/lib/module/components/native/deep/Pressable.js.map +1 -0
  148. package/lib/module/components/native/deep/RefreshControl.js +5 -0
  149. package/lib/module/components/native/deep/RefreshControl.js.map +1 -0
  150. package/lib/module/components/native/deep/SafeAreaView.js +5 -0
  151. package/lib/module/components/native/deep/SafeAreaView.js.map +1 -0
  152. package/lib/module/components/native/deep/ScrollView.js +5 -0
  153. package/lib/module/components/native/deep/ScrollView.js.map +1 -0
  154. package/lib/module/components/native/deep/SectionList.js +5 -0
  155. package/lib/module/components/native/deep/SectionList.js.map +1 -0
  156. package/lib/module/components/native/deep/Switch.js +5 -0
  157. package/lib/module/components/native/deep/Switch.js.map +1 -0
  158. package/lib/module/components/native/deep/Text.js +5 -0
  159. package/lib/module/components/native/deep/Text.js.map +1 -0
  160. package/lib/module/components/native/deep/TextInput.js +5 -0
  161. package/lib/module/components/native/deep/TextInput.js.map +1 -0
  162. package/lib/module/components/native/deep/TextNativeComponent.js +8 -0
  163. package/lib/module/components/native/deep/TextNativeComponent.js.map +1 -0
  164. package/lib/module/components/native/deep/TouchableHighlight.js +5 -0
  165. package/lib/module/components/native/deep/TouchableHighlight.js.map +1 -0
  166. package/lib/module/components/native/deep/TouchableOpacity.js +5 -0
  167. package/lib/module/components/native/deep/TouchableOpacity.js.map +1 -0
  168. package/lib/module/components/native/deep/View.js +5 -0
  169. package/lib/module/components/native/deep/View.js.map +1 -0
  170. package/lib/module/components/native/deep/ViewNativeComponent.js +8 -0
  171. package/lib/module/components/native/deep/ViewNativeComponent.js.map +1 -0
  172. package/lib/module/components/native/deep/VirtualizedList.js +5 -0
  173. package/lib/module/components/native/deep/VirtualizedList.js.map +1 -0
  174. package/lib/module/components/native/index.js +43 -0
  175. package/lib/module/components/native/index.js.map +1 -0
  176. package/lib/module/core/createUnistylesActivityIndicator.js +13 -3
  177. package/lib/module/core/createUnistylesActivityIndicator.js.map +1 -1
  178. package/lib/module/core/createUnistylesElement.native.js +6 -0
  179. package/lib/module/core/createUnistylesElement.native.js.map +1 -1
  180. package/lib/module/core/createUnistylesImageBackground.js +26 -19
  181. package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
  182. package/lib/module/core/createUnistylesTouchableHighlight.js +6 -0
  183. package/lib/module/core/createUnistylesTouchableHighlight.js.map +1 -1
  184. package/lib/module/core/getClassname.js +16 -1
  185. package/lib/module/core/getClassname.js.map +1 -1
  186. package/lib/module/core/hasUnistyles.js +21 -0
  187. package/lib/module/core/hasUnistyles.js.map +1 -0
  188. package/lib/module/core/withUnistyles/withUnistyles.js +9 -6
  189. package/lib/module/core/withUnistyles/withUnistyles.js.map +1 -1
  190. package/lib/module/core/withUnistyles/withUnistyles.native.js +24 -5
  191. package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
  192. package/lib/module/mocks.js +27 -3
  193. package/lib/module/mocks.js.map +1 -1
  194. package/lib/module/specs/ShadowRegistry/index.js +69 -76
  195. package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
  196. package/lib/module/specs/ShadowRegistry/styleSource.js +60 -0
  197. package/lib/module/specs/ShadowRegistry/styleSource.js.map +1 -0
  198. package/lib/module/specs/ShadowRegistry/tracing.js +21 -0
  199. package/lib/module/specs/ShadowRegistry/tracing.js.map +1 -0
  200. package/lib/module/unifiber/src/adapters/reanimated.js +152 -0
  201. package/lib/module/unifiber/src/adapters/reanimated.js.map +1 -0
  202. package/lib/module/unifiber/src/adapters/registry.js +62 -0
  203. package/lib/module/unifiber/src/adapters/registry.js.map +1 -0
  204. package/lib/module/unifiber/src/diagnostics.js +52 -0
  205. package/lib/module/unifiber/src/diagnostics.js.map +1 -0
  206. package/lib/module/unifiber/src/fiber.js +183 -0
  207. package/lib/module/unifiber/src/fiber.js.map +1 -0
  208. package/lib/module/unifiber/src/host.js +191 -0
  209. package/lib/module/unifiber/src/host.js.map +1 -0
  210. package/lib/module/unifiber/src/index.js +33 -0
  211. package/lib/module/unifiber/src/index.js.map +1 -0
  212. package/lib/module/utils.js +50 -0
  213. package/lib/module/utils.js.map +1 -1
  214. package/lib/module/web/convert/index.js +22 -3
  215. package/lib/module/web/convert/index.js.map +1 -1
  216. package/lib/module/web/convert/module.d.ts +3 -0
  217. package/lib/module/web/convert/object/backgroundLayers.js +25 -0
  218. package/lib/module/web/convert/object/backgroundLayers.js.map +1 -0
  219. package/lib/module/web/convert/object/fontVariationSettings.js +7 -0
  220. package/lib/module/web/convert/object/fontVariationSettings.js.map +1 -0
  221. package/lib/module/web/convert/object/index.js +2 -0
  222. package/lib/module/web/convert/object/index.js.map +1 -1
  223. package/lib/module/web/convert/utils.js +4 -0
  224. package/lib/module/web/convert/utils.js.map +1 -1
  225. package/lib/module/web/registry.js +6 -4
  226. package/lib/module/web/registry.js.map +1 -1
  227. package/lib/module/web/runtime.js +9 -6
  228. package/lib/module/web/runtime.js.map +1 -1
  229. package/lib/module/web/utils/unistyle.js +10 -4
  230. package/lib/module/web/utils/unistyle.js.map +1 -1
  231. package/lib/typescript/src/components/ScopedThemeContext.d.ts +2 -1
  232. package/lib/typescript/src/components/ScopedThemeContext.d.ts.map +1 -1
  233. package/lib/typescript/src/components/native/deep/ActivityIndicator.d.ts +2 -0
  234. package/lib/typescript/src/components/native/deep/ActivityIndicator.d.ts.map +1 -0
  235. package/lib/typescript/src/components/native/deep/Animated.d.ts +2 -0
  236. package/lib/typescript/src/components/native/deep/Animated.d.ts.map +1 -0
  237. package/lib/typescript/src/components/native/deep/FlatList.d.ts +2 -0
  238. package/lib/typescript/src/components/native/deep/FlatList.d.ts.map +1 -0
  239. package/lib/typescript/src/components/native/deep/Image.d.ts +2 -0
  240. package/lib/typescript/src/components/native/deep/Image.d.ts.map +1 -0
  241. package/lib/typescript/src/components/native/deep/ImageBackground.d.ts +2 -0
  242. package/lib/typescript/src/components/native/deep/ImageBackground.d.ts.map +1 -0
  243. package/lib/typescript/src/components/native/deep/KeyboardAvoidingView.d.ts +2 -0
  244. package/lib/typescript/src/components/native/deep/KeyboardAvoidingView.d.ts.map +1 -0
  245. package/lib/typescript/src/components/native/deep/Pressable.d.ts +2 -0
  246. package/lib/typescript/src/components/native/deep/Pressable.d.ts.map +1 -0
  247. package/lib/typescript/src/components/native/deep/RefreshControl.d.ts +2 -0
  248. package/lib/typescript/src/components/native/deep/RefreshControl.d.ts.map +1 -0
  249. package/lib/typescript/src/components/native/deep/SafeAreaView.d.ts +2 -0
  250. package/lib/typescript/src/components/native/deep/SafeAreaView.d.ts.map +1 -0
  251. package/lib/typescript/src/components/native/deep/ScrollView.d.ts +2 -0
  252. package/lib/typescript/src/components/native/deep/ScrollView.d.ts.map +1 -0
  253. package/lib/typescript/src/components/native/deep/SectionList.d.ts +2 -0
  254. package/lib/typescript/src/components/native/deep/SectionList.d.ts.map +1 -0
  255. package/lib/typescript/src/components/native/deep/Switch.d.ts +2 -0
  256. package/lib/typescript/src/components/native/deep/Switch.d.ts.map +1 -0
  257. package/lib/typescript/src/components/native/deep/Text.d.ts +2 -0
  258. package/lib/typescript/src/components/native/deep/Text.d.ts.map +1 -0
  259. package/lib/typescript/src/components/native/deep/TextInput.d.ts +2 -0
  260. package/lib/typescript/src/components/native/deep/TextInput.d.ts.map +1 -0
  261. package/lib/typescript/src/components/native/deep/TextNativeComponent.d.ts +3 -0
  262. package/lib/typescript/src/components/native/deep/TextNativeComponent.d.ts.map +1 -0
  263. package/lib/typescript/src/components/native/deep/TouchableHighlight.d.ts +2 -0
  264. package/lib/typescript/src/components/native/deep/TouchableHighlight.d.ts.map +1 -0
  265. package/lib/typescript/src/components/native/deep/TouchableOpacity.d.ts +2 -0
  266. package/lib/typescript/src/components/native/deep/TouchableOpacity.d.ts.map +1 -0
  267. package/lib/typescript/src/components/native/deep/View.d.ts +2 -0
  268. package/lib/typescript/src/components/native/deep/View.d.ts.map +1 -0
  269. package/lib/typescript/src/components/native/deep/ViewNativeComponent.d.ts +3 -0
  270. package/lib/typescript/src/components/native/deep/ViewNativeComponent.d.ts.map +1 -0
  271. package/lib/typescript/src/components/native/deep/VirtualizedList.d.ts +2 -0
  272. package/lib/typescript/src/components/native/deep/VirtualizedList.d.ts.map +1 -0
  273. package/lib/typescript/src/components/native/index.d.ts +4 -0
  274. package/lib/typescript/src/components/native/index.d.ts.map +1 -0
  275. package/lib/typescript/src/components/scopeChildren.d.ts +1 -1
  276. package/lib/typescript/src/core/createUnistylesActivityIndicator.d.ts.map +1 -1
  277. package/lib/typescript/src/core/createUnistylesElement.native.d.ts.map +1 -1
  278. package/lib/typescript/src/core/createUnistylesImageBackground.d.ts.map +1 -1
  279. package/lib/typescript/src/core/createUnistylesTouchableHighlight.d.ts.map +1 -1
  280. package/lib/typescript/src/core/getClassname.d.ts.map +1 -1
  281. package/lib/typescript/src/core/hasUnistyles.d.ts +2 -0
  282. package/lib/typescript/src/core/hasUnistyles.d.ts.map +1 -0
  283. package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts +6 -3
  284. package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts.map +1 -1
  285. package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts +7 -4
  286. package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
  287. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
  288. package/lib/typescript/src/specs/ShadowRegistry/styleSource.d.ts +11 -0
  289. package/lib/typescript/src/specs/ShadowRegistry/styleSource.d.ts.map +1 -0
  290. package/lib/typescript/src/specs/ShadowRegistry/tracing.d.ts +2 -0
  291. package/lib/typescript/src/specs/ShadowRegistry/tracing.d.ts.map +1 -0
  292. package/lib/typescript/src/specs/ShadowRegistry/types.d.ts +4 -41
  293. package/lib/typescript/src/specs/ShadowRegistry/types.d.ts.map +1 -1
  294. package/lib/typescript/src/unifiber/src/adapters/reanimated.d.ts +17 -0
  295. package/lib/typescript/src/unifiber/src/adapters/reanimated.d.ts.map +1 -0
  296. package/lib/typescript/src/unifiber/src/adapters/registry.d.ts +23 -0
  297. package/lib/typescript/src/unifiber/src/adapters/registry.d.ts.map +1 -0
  298. package/lib/typescript/src/unifiber/src/diagnostics.d.ts +10 -0
  299. package/lib/typescript/src/unifiber/src/diagnostics.d.ts.map +1 -0
  300. package/lib/typescript/src/unifiber/src/fiber.d.ts +48 -0
  301. package/lib/typescript/src/unifiber/src/fiber.d.ts.map +1 -0
  302. package/lib/typescript/src/unifiber/src/host.d.ts +32 -0
  303. package/lib/typescript/src/unifiber/src/host.d.ts.map +1 -0
  304. package/lib/typescript/src/unifiber/src/index.d.ts +49 -0
  305. package/lib/typescript/src/unifiber/src/index.d.ts.map +1 -0
  306. package/lib/typescript/src/utils.d.ts +1 -0
  307. package/lib/typescript/src/utils.d.ts.map +1 -1
  308. package/lib/typescript/src/web/convert/index.d.ts.map +1 -1
  309. package/lib/typescript/src/web/convert/object/backgroundLayers.d.ts +4 -0
  310. package/lib/typescript/src/web/convert/object/backgroundLayers.d.ts.map +1 -0
  311. package/lib/typescript/src/web/convert/object/fontVariationSettings.d.ts +4 -0
  312. package/lib/typescript/src/web/convert/object/fontVariationSettings.d.ts.map +1 -0
  313. package/lib/typescript/src/web/convert/object/index.d.ts +2 -0
  314. package/lib/typescript/src/web/convert/object/index.d.ts.map +1 -1
  315. package/lib/typescript/src/web/convert/utils.d.ts +2 -0
  316. package/lib/typescript/src/web/convert/utils.d.ts.map +1 -1
  317. package/lib/typescript/src/web/registry.d.ts.map +1 -1
  318. package/lib/typescript/src/web/runtime.d.ts +1 -0
  319. package/lib/typescript/src/web/runtime.d.ts.map +1 -1
  320. package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
  321. package/metro/babel-transformer.js +1102 -0
  322. package/metro/index.d.ts +31 -0
  323. package/metro/index.js +170 -0
  324. package/package.json +50 -32
  325. package/plugin/index.d.ts +7 -0
  326. package/plugin/index.js +115 -33
  327. package/src/components/NamedTheme.tsx +5 -5
  328. package/src/components/ScopedThemeContext.ts +6 -2
  329. package/src/components/native/deep/ActivityIndicator.ts +2 -0
  330. package/src/components/native/deep/Animated.ts +2 -0
  331. package/src/components/native/deep/FlatList.ts +2 -0
  332. package/src/components/native/deep/Image.ts +2 -0
  333. package/src/components/native/deep/ImageBackground.ts +2 -0
  334. package/src/components/native/deep/KeyboardAvoidingView.ts +2 -0
  335. package/src/components/native/deep/Pressable.ts +2 -0
  336. package/src/components/native/deep/RefreshControl.ts +2 -0
  337. package/src/components/native/deep/SafeAreaView.ts +2 -0
  338. package/src/components/native/deep/ScrollView.ts +2 -0
  339. package/src/components/native/deep/SectionList.ts +2 -0
  340. package/src/components/native/deep/Switch.ts +2 -0
  341. package/src/components/native/deep/Text.ts +2 -0
  342. package/src/components/native/deep/TextInput.ts +2 -0
  343. package/src/components/native/deep/TextNativeComponent.ts +5 -0
  344. package/src/components/native/deep/TouchableHighlight.ts +2 -0
  345. package/src/components/native/deep/TouchableOpacity.ts +2 -0
  346. package/src/components/native/deep/View.ts +2 -0
  347. package/src/components/native/deep/ViewNativeComponent.ts +5 -0
  348. package/src/components/native/deep/VirtualizedList.ts +2 -0
  349. package/src/components/native/index.ts +41 -0
  350. package/src/core/createUnistylesActivityIndicator.tsx +11 -4
  351. package/src/core/createUnistylesElement.native.tsx +5 -0
  352. package/src/core/createUnistylesImageBackground.tsx +33 -25
  353. package/src/core/createUnistylesTouchableHighlight.tsx +5 -0
  354. package/src/core/getClassname.ts +10 -1
  355. package/src/core/hasUnistyles.ts +20 -0
  356. package/src/core/withUnistyles/withUnistyles.native.tsx +28 -6
  357. package/src/core/withUnistyles/withUnistyles.tsx +6 -6
  358. package/src/mocks.ts +14 -5
  359. package/src/specs/ShadowRegistry/index.ts +62 -103
  360. package/src/specs/ShadowRegistry/styleSource.ts +78 -0
  361. package/src/specs/ShadowRegistry/tracing.ts +23 -0
  362. package/src/specs/ShadowRegistry/types.ts +3 -43
  363. package/src/unifiber/LICENSE +21 -0
  364. package/src/unifiber/README.md +92 -0
  365. package/src/unifiber/src/adapters/reanimated.ts +204 -0
  366. package/src/unifiber/src/adapters/registry.ts +102 -0
  367. package/src/unifiber/src/diagnostics.ts +55 -0
  368. package/src/unifiber/src/fiber.ts +262 -0
  369. package/src/unifiber/src/host.ts +236 -0
  370. package/src/unifiber/src/index.ts +43 -0
  371. package/src/utils.ts +51 -0
  372. package/src/web/convert/index.ts +39 -3
  373. package/src/web/convert/object/backgroundLayers.ts +33 -0
  374. package/src/web/convert/object/fontVariationSettings.ts +7 -0
  375. package/src/web/convert/object/index.ts +2 -0
  376. package/src/web/convert/utils.ts +11 -0
  377. package/src/web/registry.ts +7 -8
  378. package/src/web/runtime.ts +7 -7
  379. package/src/web/utils/unistyle.ts +11 -4
  380. package/lib/commonjs/web/convert/module.d.js +0 -2
  381. package/lib/commonjs/web/convert/module.d.js.map +0 -1
  382. package/lib/module/web/convert/module.d.js +0 -2
  383. package/lib/module/web/convert/module.d.js.map +0 -1
  384. package/lib/typescript/src/__tests__/mocks.spec.d.ts +0 -2
  385. package/lib/typescript/src/__tests__/mocks.spec.d.ts.map +0 -1
  386. package/lib/typescript/src/__tests__/passForwardRef.spec.d.ts +0 -2
  387. package/lib/typescript/src/__tests__/passForwardRef.spec.d.ts.map +0 -1
  388. package/lib/typescript/src/__tests__/scoped-theme.spec.d.ts +0 -2
  389. package/lib/typescript/src/__tests__/scoped-theme.spec.d.ts.map +0 -1
  390. package/lib/typescript/src/__tests__/shadow-registry.spec.d.ts +0 -2
  391. package/lib/typescript/src/__tests__/shadow-registry.spec.d.ts.map +0 -1
  392. package/lib/typescript/src/__tests__/web-child-selector.spec.d.ts +0 -2
  393. package/lib/typescript/src/__tests__/web-child-selector.spec.d.ts.map +0 -1
  394. package/lib/typescript/src/__tests__/web-listener.spec.d.ts +0 -2
  395. package/lib/typescript/src/__tests__/web-listener.spec.d.ts.map +0 -1
  396. package/lib/typescript/src/__tests__/web-pointer-events.spec.d.ts +0 -2
  397. package/lib/typescript/src/__tests__/web-pointer-events.spec.d.ts.map +0 -1
  398. package/lib/typescript/src/__tests__/web-runtime.spec.d.ts +0 -2
  399. package/lib/typescript/src/__tests__/web-runtime.spec.d.ts.map +0 -1
  400. package/lib/typescript/src/__tests__/withUnistyles.spec.d.ts +0 -2
  401. package/lib/typescript/src/__tests__/withUnistyles.spec.d.ts.map +0 -1
@@ -1,17 +1,177 @@
1
1
  #include "BackgroundImageConverter.h"
2
2
 
3
3
  #include <algorithm>
4
+ #include <cxxreact/ReactNativeVersion.h>
5
+ #include <react/featureflags/ReactNativeFeatureFlags.h>
4
6
 
5
- #if defined(RN_SERIALIZABLE_STATE) && \
6
- __has_include( \
7
- <react/renderer/components/view/BackgroundImagePropsConversions.h>)
8
- #include <react/renderer/components/view/BackgroundImagePropsConversions.h>
9
- #include <react/renderer/core/propsConversions.h>
7
+ // React Native 0.83 added a C++ CSS parser for background images. Without
8
+ // enableNativeCSSParsing, the native props parser only accepts the processed
9
+ // form (array of gradient objects), so strings are converted here on both
10
+ // platforms.
11
+ #if __has_include(<react/renderer/css/CSSBackgroundImage.h>)
12
+ #include <folly/Conv.h>
13
+ #include <react/renderer/css/CSSBackgroundImage.h>
14
+ #include <react/renderer/css/CSSValueParser.h>
10
15
  #define UNISTYLES_HAS_RN_BACKGROUND_IMAGE_PARSER 1
11
16
  #endif
12
17
 
13
18
  namespace margelo::nitro::unistyles::converters {
14
19
 
20
+ #ifdef UNISTYLES_HAS_RN_BACKGROUND_IMAGE_PARSER
21
+ namespace {
22
+
23
+ using namespace facebook::react;
24
+
25
+ using CSSLengthPercentage = std::variant<CSSLength, CSSPercentage>;
26
+ using CSSGradientItems = std::vector<std::variant<CSSColorStop, CSSColorHint>>;
27
+
28
+ // same output as React Native's processBackgroundImage.js
29
+ folly::dynamic toPosition(const CSSLengthPercentage &value) {
30
+ if (std::holds_alternative<CSSLength>(value)) {
31
+ return std::get<CSSLength>(value).value;
32
+ }
33
+
34
+ return folly::to<std::string>(std::get<CSSPercentage>(value).value) + "%";
35
+ }
36
+
37
+ // ARGB, same as processColor
38
+ int32_t toColor(const CSSColor &color) {
39
+ return static_cast<int32_t>((static_cast<uint32_t>(color.a) << 24) |
40
+ (static_cast<uint32_t>(color.r) << 16) |
41
+ (static_cast<uint32_t>(color.g) << 8) |
42
+ static_cast<uint32_t>(color.b));
43
+ }
44
+
45
+ folly::dynamic toColorStops(const CSSGradientItems &items) {
46
+ folly::dynamic colorStops = folly::dynamic::array();
47
+
48
+ for (const auto &item : items) {
49
+ if (std::holds_alternative<CSSColorHint>(item)) {
50
+ colorStops.push_back(folly::dynamic::object("color", nullptr)(
51
+ "position", toPosition(std::get<CSSColorHint>(item).position)));
52
+
53
+ continue;
54
+ }
55
+
56
+ const auto &colorStop = std::get<CSSColorStop>(item);
57
+ auto color = toColor(colorStop.color);
58
+
59
+ colorStops.push_back(folly::dynamic::object("color", color)(
60
+ "position", colorStop.startPosition.has_value()
61
+ ? toPosition(*colorStop.startPosition)
62
+ : nullptr));
63
+
64
+ if (colorStop.endPosition.has_value()) {
65
+ colorStops.push_back(folly::dynamic::object("color", color)(
66
+ "position", toPosition(*colorStop.endPosition)));
67
+ }
68
+ }
69
+
70
+ return colorStops;
71
+ }
72
+
73
+ std::string toKeyword(CSSLinearGradientDirectionKeyword keyword) {
74
+ switch (keyword) {
75
+ case CSSLinearGradientDirectionKeyword::ToTopLeft:
76
+ return "to top left";
77
+ case CSSLinearGradientDirectionKeyword::ToTopRight:
78
+ return "to top right";
79
+ case CSSLinearGradientDirectionKeyword::ToBottomLeft:
80
+ return "to bottom left";
81
+ case CSSLinearGradientDirectionKeyword::ToBottomRight:
82
+ return "to bottom right";
83
+ }
84
+
85
+ return "to bottom right";
86
+ }
87
+
88
+ folly::dynamic toLinearGradient(const CSSLinearGradientFunction &gradient) {
89
+ folly::dynamic direction =
90
+ folly::dynamic::object("type", "angle")("value", 180.0);
91
+
92
+ if (gradient.direction.has_value()) {
93
+ const auto &value = gradient.direction->value;
94
+
95
+ direction =
96
+ std::holds_alternative<CSSAngle>(value)
97
+ ? folly::dynamic::object("type", "angle")(
98
+ "value", std::get<CSSAngle>(value).degrees)
99
+ : folly::dynamic::object("type", "keyword")(
100
+ "value",
101
+ toKeyword(std::get<CSSLinearGradientDirectionKeyword>(value)));
102
+ }
103
+
104
+ return folly::dynamic::object("type", "linear-gradient")(
105
+ "direction", std::move(direction))("colorStops",
106
+ toColorStops(gradient.items));
107
+ }
108
+
109
+ std::string toSizeKeyword(CSSRadialGradientSizeKeyword keyword) {
110
+ switch (keyword) {
111
+ case CSSRadialGradientSizeKeyword::ClosestSide:
112
+ return "closest-side";
113
+ case CSSRadialGradientSizeKeyword::ClosestCorner:
114
+ return "closest-corner";
115
+ case CSSRadialGradientSizeKeyword::FarthestSide:
116
+ return "farthest-side";
117
+ case CSSRadialGradientSizeKeyword::FarthestCorner:
118
+ return "farthest-corner";
119
+ }
120
+
121
+ return "farthest-corner";
122
+ }
123
+
124
+ folly::dynamic toRadialGradient(const CSSRadialGradientFunction &gradient) {
125
+ folly::dynamic size = "farthest-corner";
126
+ folly::dynamic position = folly::dynamic::object("top", "50%")("left", "50%");
127
+
128
+ if (gradient.size.has_value()) {
129
+ const auto &value = *gradient.size;
130
+
131
+ if (std::holds_alternative<CSSRadialGradientSizeKeyword>(value)) {
132
+ size = toSizeKeyword(std::get<CSSRadialGradientSizeKeyword>(value));
133
+ } else {
134
+ const auto &explicitSize = std::get<CSSRadialGradientExplicitSize>(value);
135
+
136
+ size = folly::dynamic::object("x", toPosition(explicitSize.sizeX))(
137
+ "y", toPosition(explicitSize.sizeY));
138
+ }
139
+ }
140
+
141
+ if (gradient.position.has_value()) {
142
+ const auto &value = *gradient.position;
143
+
144
+ position = folly::dynamic::object();
145
+
146
+ if (value.top.has_value()) {
147
+ position["top"] = toPosition(*value.top);
148
+ }
149
+
150
+ if (value.bottom.has_value()) {
151
+ position["bottom"] = toPosition(*value.bottom);
152
+ }
153
+
154
+ if (value.left.has_value()) {
155
+ position["left"] = toPosition(*value.left);
156
+ }
157
+
158
+ if (value.right.has_value()) {
159
+ position["right"] = toPosition(*value.right);
160
+ }
161
+ }
162
+
163
+ auto isCircle = gradient.shape.has_value() &&
164
+ *gradient.shape == CSSRadialGradientShape::Circle;
165
+
166
+ return folly::dynamic::object("type", "radial-gradient")(
167
+ "shape", isCircle ? "circle" : "ellipse")("size", std::move(size))(
168
+ "position", std::move(position))("colorStops",
169
+ toColorStops(gradient.items));
170
+ }
171
+
172
+ } // namespace
173
+ #endif
174
+
15
175
  bool isBackgroundImagePropName(const std::string &propertyName) {
16
176
  return propertyName == "backgroundImage" ||
17
177
  propertyName == "experimental_backgroundImage";
@@ -37,19 +197,46 @@ bool hasSafeBackgroundImageColorStops(const folly::dynamic &backgroundImages) {
37
197
  std::optional<folly::dynamic>
38
198
  parseBackgroundImageString(const std::string &backgroundImageString) {
39
199
  #ifdef UNISTYLES_HAS_RN_BACKGROUND_IMAGE_PARSER
40
- std::vector<facebook::react::BackgroundImage> backgroundImages;
200
+ using namespace facebook::react;
201
+
202
+ auto maybeBackgroundImages =
203
+ parseCSSProperty<CSSBackgroundImageList>(backgroundImageString);
41
204
 
42
- facebook::react::parseUnprocessedBackgroundImageString(backgroundImageString,
43
- backgroundImages);
205
+ if (!std::holds_alternative<CSSBackgroundImageList>(maybeBackgroundImages)) {
206
+ return folly::dynamic::array();
207
+ }
208
+
209
+ folly::dynamic backgroundImages = folly::dynamic::array();
44
210
 
45
- auto parsedBackgroundImages = facebook::react::toDynamic(backgroundImages);
211
+ for (const auto &backgroundImage :
212
+ std::get<CSSBackgroundImageList>(maybeBackgroundImages)) {
213
+ if (std::holds_alternative<CSSLinearGradientFunction>(backgroundImage)) {
214
+ backgroundImages.push_back(
215
+ toLinearGradient(std::get<CSSLinearGradientFunction>(backgroundImage)));
216
+ } else if (std::holds_alternative<CSSRadialGradientFunction>(
217
+ backgroundImage)) {
218
+ backgroundImages.push_back(
219
+ toRadialGradient(std::get<CSSRadialGradientFunction>(backgroundImage)));
220
+ }
221
+ }
46
222
 
47
- return hasSafeBackgroundImageColorStops(parsedBackgroundImages)
48
- ? std::move(parsedBackgroundImages)
223
+ return hasSafeBackgroundImageColorStops(backgroundImages)
224
+ ? std::move(backgroundImages)
49
225
  : folly::dynamic::array();
50
226
  #else
51
227
  return std::nullopt;
52
228
  #endif
53
229
  }
54
230
 
231
+ // React Native parses background image strings natively since 0.83, but only
232
+ // with enableNativeCSSParsing. Otherwise its view props expect the processed
233
+ // array and read a string as no background image.
234
+ bool canReactNativeParseBackgroundImageString() {
235
+ #if REACT_NATIVE_VERSION_MAJOR > 0 || REACT_NATIVE_VERSION_MINOR >= 83
236
+ return facebook::react::ReactNativeFeatureFlags::enableNativeCSSParsing();
237
+ #else
238
+ return false;
239
+ #endif
240
+ }
241
+
55
242
  } // namespace margelo::nitro::unistyles::converters
@@ -10,5 +10,6 @@ bool isBackgroundImagePropName(const std::string &propertyName);
10
10
  bool hasSafeBackgroundImageColorStops(const folly::dynamic &backgroundImages);
11
11
  std::optional<folly::dynamic>
12
12
  parseBackgroundImageString(const std::string &backgroundImageString);
13
+ bool canReactNativeParseBackgroundImageString();
13
14
 
14
15
  } // namespace margelo::nitro::unistyles::converters