react-native-unistyles 3.0.0-beta.6 → 3.0.0-beta.7

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 (246) hide show
  1. package/README.md +3 -0
  2. package/android/CMakeLists.txt +1 -1
  3. package/android/src/main/java/com/unistyles/NativePlatform+android.kt +4 -0
  4. package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +20 -1
  5. package/android/src/main/java/com/unistyles/NativePlatform+listener.kt +4 -0
  6. package/android/src/main/java/com/unistyles/UnistylesModule.kt +5 -0
  7. package/cxx/core/HashGenerator.cpp +1 -1
  8. package/cxx/core/HostUnistyle.cpp +28 -4
  9. package/cxx/core/HostUnistyle.h +1 -0
  10. package/cxx/core/UnistyleWrapper.h +6 -6
  11. package/cxx/parser/Parser.cpp +5 -5
  12. package/lib/commonjs/components/native/Animated.js +2 -2
  13. package/lib/commonjs/components/native/Animated.js.map +1 -1
  14. package/lib/commonjs/components/native/ImageBackground.js +5 -5
  15. package/lib/commonjs/components/native/ImageBackground.js.map +1 -1
  16. package/lib/commonjs/components/native/NativeText.native.js.map +1 -1
  17. package/lib/commonjs/components/native/NativeView.native.js.map +1 -1
  18. package/lib/commonjs/components/native/Pressable.js +1 -1
  19. package/lib/commonjs/components/native/Pressable.js.map +1 -1
  20. package/lib/commonjs/components/native/Pressable.native.js +6 -10
  21. package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
  22. package/lib/commonjs/core/createUnistylesElement.js +5 -5
  23. package/lib/commonjs/core/createUnistylesElement.js.map +1 -1
  24. package/lib/commonjs/core/createUnistylesElement.native.js +1 -1
  25. package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -1
  26. package/lib/commonjs/core/createUnistylesImageBackground.js +1 -1
  27. package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
  28. package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js +2 -2
  29. package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
  30. package/lib/commonjs/core/warn.js +1 -1
  31. package/lib/commonjs/core/withUnistyles/withUnistyles.js +2 -2
  32. package/lib/commonjs/core/withUnistyles/withUnistyles.js.map +1 -1
  33. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +5 -3
  34. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
  35. package/lib/commonjs/hooks/useMedia.native.js +1 -1
  36. package/lib/commonjs/hooks/useMedia.native.js.map +1 -1
  37. package/lib/commonjs/mq.js.map +1 -1
  38. package/lib/commonjs/server/getServerUnistyles.js +1 -1
  39. package/lib/commonjs/server/getServerUnistyles.js.map +1 -1
  40. package/lib/commonjs/server/hydrateServerUnistyles.js +1 -1
  41. package/lib/commonjs/server/hydrateServerUnistyles.js.map +1 -1
  42. package/lib/commonjs/server/resetServerUnistyles.js +1 -1
  43. package/lib/commonjs/server/resetServerUnistyles.js.map +1 -1
  44. package/lib/commonjs/server/useServerUnistyles.js +2 -2
  45. package/lib/commonjs/server/useServerUnistyles.js.map +1 -1
  46. package/lib/commonjs/specs/StatusBar/index.js.map +1 -1
  47. package/lib/commonjs/specs/StyleSheet/index.js +1 -1
  48. package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
  49. package/lib/commonjs/specs/UnistylesRuntime/index.js +1 -1
  50. package/lib/commonjs/specs/UnistylesRuntime/index.js.map +1 -1
  51. package/lib/commonjs/specs/index.native.js +3 -3
  52. package/lib/commonjs/specs/index.native.js.map +1 -1
  53. package/lib/commonjs/web/convert/index.js +4 -4
  54. package/lib/commonjs/web/convert/index.js.map +1 -1
  55. package/lib/commonjs/web/convert/object/boxShadow.js +4 -4
  56. package/lib/commonjs/web/convert/object/boxShadow.js.map +1 -1
  57. package/lib/commonjs/web/convert/object/filter.js +3 -3
  58. package/lib/commonjs/web/convert/object/filter.js.map +1 -1
  59. package/lib/commonjs/web/convert/object/transform.js +1 -1
  60. package/lib/commonjs/web/convert/object/transform.js.map +1 -1
  61. package/lib/commonjs/web/convert/utils.js.map +1 -1
  62. package/lib/commonjs/web/index.js +1 -1
  63. package/lib/commonjs/web/index.js.map +1 -1
  64. package/lib/commonjs/web/registry.js +1 -1
  65. package/lib/commonjs/web/registry.js.map +1 -1
  66. package/lib/commonjs/web/runtime.js.map +1 -1
  67. package/lib/commonjs/web/shadowRegistry.js +1 -1
  68. package/lib/commonjs/web/shadowRegistry.js.map +1 -1
  69. package/lib/commonjs/web/state.js +1 -1
  70. package/lib/commonjs/web/state.js.map +1 -1
  71. package/lib/commonjs/web/utils/common.js +1 -1
  72. package/lib/commonjs/web/utils/unistyle.js +5 -5
  73. package/lib/commonjs/web/utils/unistyle.js.map +1 -1
  74. package/lib/module/components/native/Animated.js +2 -2
  75. package/lib/module/components/native/Animated.js.map +1 -1
  76. package/lib/module/components/native/ImageBackground.js +3 -3
  77. package/lib/module/components/native/ImageBackground.js.map +1 -1
  78. package/lib/module/components/native/NativeText.native.js.map +1 -1
  79. package/lib/module/components/native/NativeView.native.js.map +1 -1
  80. package/lib/module/components/native/Pressable.js +1 -1
  81. package/lib/module/components/native/Pressable.js.map +1 -1
  82. package/lib/module/components/native/Pressable.native.js +6 -10
  83. package/lib/module/components/native/Pressable.native.js.map +1 -1
  84. package/lib/module/core/createUnistylesElement.js +3 -3
  85. package/lib/module/core/createUnistylesElement.js.map +1 -1
  86. package/lib/module/core/createUnistylesElement.native.js +1 -1
  87. package/lib/module/core/createUnistylesElement.native.js.map +1 -1
  88. package/lib/module/core/createUnistylesImageBackground.js +1 -1
  89. package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
  90. package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js +2 -2
  91. package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
  92. package/lib/module/core/warn.js +1 -1
  93. package/lib/module/core/withUnistyles/withUnistyles.js +2 -2
  94. package/lib/module/core/withUnistyles/withUnistyles.js.map +1 -1
  95. package/lib/module/core/withUnistyles/withUnistyles.native.js +6 -4
  96. package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
  97. package/lib/module/hooks/useMedia.native.js +1 -1
  98. package/lib/module/hooks/useMedia.native.js.map +1 -1
  99. package/lib/module/mq.js.map +1 -1
  100. package/lib/module/server/getServerUnistyles.js +1 -1
  101. package/lib/module/server/getServerUnistyles.js.map +1 -1
  102. package/lib/module/server/hydrateServerUnistyles.js +1 -1
  103. package/lib/module/server/hydrateServerUnistyles.js.map +1 -1
  104. package/lib/module/server/resetServerUnistyles.js +1 -1
  105. package/lib/module/server/resetServerUnistyles.js.map +1 -1
  106. package/lib/module/server/useServerUnistyles.js +2 -2
  107. package/lib/module/server/useServerUnistyles.js.map +1 -1
  108. package/lib/module/specs/StatusBar/index.js.map +1 -1
  109. package/lib/module/specs/StyleSheet/index.js +1 -1
  110. package/lib/module/specs/StyleSheet/index.js.map +1 -1
  111. package/lib/module/specs/UnistylesRuntime/index.js +1 -1
  112. package/lib/module/specs/UnistylesRuntime/index.js.map +1 -1
  113. package/lib/module/specs/index.native.js +4 -4
  114. package/lib/module/specs/index.native.js.map +1 -1
  115. package/lib/module/web/convert/index.js +5 -5
  116. package/lib/module/web/convert/index.js.map +1 -1
  117. package/lib/module/web/convert/object/boxShadow.js +2 -2
  118. package/lib/module/web/convert/object/boxShadow.js.map +1 -1
  119. package/lib/module/web/convert/object/filter.js +3 -3
  120. package/lib/module/web/convert/object/filter.js.map +1 -1
  121. package/lib/module/web/convert/object/transform.js +1 -1
  122. package/lib/module/web/convert/object/transform.js.map +1 -1
  123. package/lib/module/web/convert/utils.js.map +1 -1
  124. package/lib/module/web/index.js +1 -1
  125. package/lib/module/web/index.js.map +1 -1
  126. package/lib/module/web/registry.js +1 -1
  127. package/lib/module/web/registry.js.map +1 -1
  128. package/lib/module/web/runtime.js.map +1 -1
  129. package/lib/module/web/shadowRegistry.js +1 -1
  130. package/lib/module/web/shadowRegistry.js.map +1 -1
  131. package/lib/module/web/state.js +1 -1
  132. package/lib/module/web/state.js.map +1 -1
  133. package/lib/module/web/utils/common.js +1 -1
  134. package/lib/module/web/utils/unistyle.js +5 -5
  135. package/lib/module/web/utils/unistyle.js.map +1 -1
  136. package/lib/typescript/src/components/native/Pressable.d.ts.map +1 -1
  137. package/lib/typescript/src/components/native/Pressable.native.d.ts.map +1 -1
  138. package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts +2 -1
  139. package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts.map +1 -1
  140. package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts.map +1 -1
  141. package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
  142. package/lib/typescript/src/mq.d.ts +1 -1
  143. package/lib/typescript/src/mq.d.ts.map +1 -1
  144. package/lib/typescript/src/server/hydrateServerUnistyles.d.ts.map +1 -1
  145. package/lib/typescript/src/server/useServerUnistyles.d.ts.map +1 -1
  146. package/lib/typescript/src/specs/StatusBar/index.d.ts +1 -1
  147. package/lib/typescript/src/specs/StatusBar/index.d.ts.map +1 -1
  148. package/lib/typescript/src/specs/StyleSheet/index.d.ts +1 -1
  149. package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
  150. package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts +1 -1
  151. package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts.map +1 -1
  152. package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts +5 -5
  153. package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts.map +1 -1
  154. package/lib/typescript/src/specs/index.native.d.ts +4 -4
  155. package/lib/typescript/src/specs/index.native.d.ts.map +1 -1
  156. package/lib/typescript/src/types/breakpoints.d.ts +2 -2
  157. package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
  158. package/lib/typescript/src/types/core.d.ts +1 -1
  159. package/lib/typescript/src/types/core.d.ts.map +1 -1
  160. package/lib/typescript/src/types/stylesheet.d.ts +4 -4
  161. package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
  162. package/lib/typescript/src/web/convert/object/filter.d.ts.map +1 -1
  163. package/lib/typescript/src/web/convert/object/transform.d.ts.map +1 -1
  164. package/lib/typescript/src/web/convert/types.d.ts +1 -1
  165. package/lib/typescript/src/web/convert/types.d.ts.map +1 -1
  166. package/lib/typescript/src/web/convert/utils.d.ts +2 -2
  167. package/lib/typescript/src/web/convert/utils.d.ts.map +1 -1
  168. package/lib/typescript/src/web/create.d.ts +1 -1
  169. package/lib/typescript/src/web/create.d.ts.map +1 -1
  170. package/lib/typescript/src/web/index.d.ts +1 -1
  171. package/lib/typescript/src/web/index.d.ts.map +1 -1
  172. package/lib/typescript/src/web/registry.d.ts +1 -1
  173. package/lib/typescript/src/web/registry.d.ts.map +1 -1
  174. package/lib/typescript/src/web/runtime.d.ts +1 -1
  175. package/lib/typescript/src/web/runtime.d.ts.map +1 -1
  176. package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
  177. package/lib/typescript/src/web/state.d.ts +1 -1
  178. package/lib/typescript/src/web/state.d.ts.map +1 -1
  179. package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
  180. package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +1 -1
  181. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +23 -39
  182. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/unistylesOnLoad.kt +35 -0
  183. package/nitrogen/generated/ios/Unistyles+autolinking.rb +2 -0
  184. package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.cpp +1 -1
  185. package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.hpp +3 -1
  186. package/nitrogen/generated/ios/swift/HybridNativePlatformSpec.swift +2 -3
  187. package/nitrogen/generated/ios/swift/HybridNativePlatformSpec_cxx.swift +18 -18
  188. package/nitrogen/generated/shared/c++/ColorScheme.hpp +1 -1
  189. package/nitrogen/generated/shared/c++/Dimensions.hpp +1 -1
  190. package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.hpp +1 -1
  191. package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.hpp +1 -1
  192. package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.hpp +1 -1
  193. package/nitrogen/generated/shared/c++/HybridUnistylesShadowRegistrySpec.hpp +1 -1
  194. package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.hpp +1 -1
  195. package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.hpp +1 -1
  196. package/nitrogen/generated/shared/c++/Insets.hpp +1 -1
  197. package/nitrogen/generated/shared/c++/Orientation.hpp +1 -1
  198. package/nitrogen/generated/shared/c++/UnistyleDependency.hpp +1 -1
  199. package/nitrogen/generated/shared/c++/UnistylesCxxMiniRuntime.hpp +1 -1
  200. package/nitrogen/generated/shared/c++/UnistylesNativeMiniRuntime.hpp +1 -1
  201. package/package.json +6 -4
  202. package/plugin/import.js +1 -1
  203. package/plugin/index.js +27 -38
  204. package/plugin/stylesheet.js +454 -128
  205. package/src/components/native/Animated.tsx +2 -2
  206. package/src/components/native/ImageBackground.tsx +4 -4
  207. package/src/components/native/NativeText.native.tsx +1 -1
  208. package/src/components/native/NativeView.native.tsx +1 -1
  209. package/src/components/native/Pressable.native.tsx +7 -12
  210. package/src/components/native/Pressable.tsx +1 -1
  211. package/src/core/createUnistylesElement.native.tsx +1 -1
  212. package/src/core/createUnistylesElement.tsx +3 -3
  213. package/src/core/createUnistylesImageBackground.tsx +1 -1
  214. package/src/core/useProxifiedUnistyles/useProxifiedUnistyles.ts +3 -3
  215. package/src/core/warn.ts +1 -1
  216. package/src/core/withUnistyles/withUnistyles.native.tsx +8 -6
  217. package/src/core/withUnistyles/withUnistyles.tsx +4 -4
  218. package/src/hooks/useMedia.native.ts +1 -1
  219. package/src/mq.ts +1 -1
  220. package/src/server/getServerUnistyles.tsx +1 -1
  221. package/src/server/hydrateServerUnistyles.ts +1 -1
  222. package/src/server/resetServerUnistyles.ts +1 -1
  223. package/src/server/useServerUnistyles.tsx +2 -2
  224. package/src/specs/StatusBar/index.ts +1 -1
  225. package/src/specs/StyleSheet/index.ts +3 -3
  226. package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +1 -1
  227. package/src/specs/UnistylesRuntime/index.ts +5 -5
  228. package/src/specs/index.native.ts +4 -4
  229. package/src/types/breakpoints.ts +2 -2
  230. package/src/types/core.ts +1 -1
  231. package/src/types/stylesheet.ts +4 -4
  232. package/src/web/convert/index.ts +5 -5
  233. package/src/web/convert/object/boxShadow.ts +2 -2
  234. package/src/web/convert/object/filter.ts +3 -3
  235. package/src/web/convert/object/transform.ts +2 -2
  236. package/src/web/convert/types.ts +1 -1
  237. package/src/web/convert/utils.ts +2 -2
  238. package/src/web/create.ts +1 -1
  239. package/src/web/index.ts +3 -3
  240. package/src/web/registry.ts +2 -2
  241. package/src/web/runtime.ts +2 -2
  242. package/src/web/shadowRegistry.ts +2 -2
  243. package/src/web/state.ts +4 -4
  244. package/src/web/utils/common.ts +1 -1
  245. package/src/web/utils/unistyle.ts +6 -6
  246. package/plugin/common.js +0 -142
@@ -58,7 +58,9 @@ namespace margelo::nitro::unistyles {
58
58
 
59
59
  public:
60
60
  // Get the Swift part
61
- inline Unistyles::HybridNativePlatformSpec_cxx getSwiftPart() noexcept { return _swiftPart; }
61
+ inline Unistyles::HybridNativePlatformSpec_cxx& getSwiftPart() noexcept {
62
+ return _swiftPart;
63
+ }
62
64
 
63
65
  public:
64
66
  // Get memory pressure
@@ -9,7 +9,7 @@ import Foundation
9
9
  import NitroModules
10
10
 
11
11
  /// See ``HybridNativePlatformSpec``
12
- public protocol HybridNativePlatformSpec_protocol: AnyObject {
12
+ public protocol HybridNativePlatformSpec_protocol: HybridObject {
13
13
  // Properties
14
14
 
15
15
 
@@ -35,7 +35,7 @@ public protocol HybridNativePlatformSpec_protocol: AnyObject {
35
35
  }
36
36
 
37
37
  /// See ``HybridNativePlatformSpec``
38
- public class HybridNativePlatformSpec_base: HybridObjectSpec {
38
+ public class HybridNativePlatformSpec_base {
39
39
  private weak var cxxWrapper: HybridNativePlatformSpec_cxx? = nil
40
40
  public func getCxxWrapper() -> HybridNativePlatformSpec_cxx {
41
41
  #if DEBUG
@@ -51,7 +51,6 @@ public class HybridNativePlatformSpec_base: HybridObjectSpec {
51
51
  return cxxWrapper
52
52
  }
53
53
  }
54
- public var memorySize: Int { return 0 }
55
54
  }
56
55
 
57
56
  /**
@@ -101,7 +101,7 @@ public class HybridNativePlatformSpec_cxx {
101
101
 
102
102
  // Methods
103
103
  @inline(__always)
104
- public func getInsets() -> bridge.Result_Insets_ {
104
+ public final func getInsets() -> bridge.Result_Insets_ {
105
105
  do {
106
106
  let __result = try self.__implementation.getInsets()
107
107
  let __resultCpp = __result
@@ -113,7 +113,7 @@ public class HybridNativePlatformSpec_cxx {
113
113
  }
114
114
 
115
115
  @inline(__always)
116
- public func getColorScheme() -> bridge.Result_ColorScheme_ {
116
+ public final func getColorScheme() -> bridge.Result_ColorScheme_ {
117
117
  do {
118
118
  let __result = try self.__implementation.getColorScheme()
119
119
  let __resultCpp = __result
@@ -125,7 +125,7 @@ public class HybridNativePlatformSpec_cxx {
125
125
  }
126
126
 
127
127
  @inline(__always)
128
- public func getFontScale() -> bridge.Result_double_ {
128
+ public final func getFontScale() -> bridge.Result_double_ {
129
129
  do {
130
130
  let __result = try self.__implementation.getFontScale()
131
131
  let __resultCpp = __result
@@ -137,7 +137,7 @@ public class HybridNativePlatformSpec_cxx {
137
137
  }
138
138
 
139
139
  @inline(__always)
140
- public func getPixelRatio() -> bridge.Result_double_ {
140
+ public final func getPixelRatio() -> bridge.Result_double_ {
141
141
  do {
142
142
  let __result = try self.__implementation.getPixelRatio()
143
143
  let __resultCpp = __result
@@ -149,7 +149,7 @@ public class HybridNativePlatformSpec_cxx {
149
149
  }
150
150
 
151
151
  @inline(__always)
152
- public func getOrientation() -> bridge.Result_Orientation_ {
152
+ public final func getOrientation() -> bridge.Result_Orientation_ {
153
153
  do {
154
154
  let __result = try self.__implementation.getOrientation()
155
155
  let __resultCpp = __result
@@ -161,7 +161,7 @@ public class HybridNativePlatformSpec_cxx {
161
161
  }
162
162
 
163
163
  @inline(__always)
164
- public func getContentSizeCategory() -> bridge.Result_std__string_ {
164
+ public final func getContentSizeCategory() -> bridge.Result_std__string_ {
165
165
  do {
166
166
  let __result = try self.__implementation.getContentSizeCategory()
167
167
  let __resultCpp = std.string(__result)
@@ -173,7 +173,7 @@ public class HybridNativePlatformSpec_cxx {
173
173
  }
174
174
 
175
175
  @inline(__always)
176
- public func getScreenDimensions() -> bridge.Result_Dimensions_ {
176
+ public final func getScreenDimensions() -> bridge.Result_Dimensions_ {
177
177
  do {
178
178
  let __result = try self.__implementation.getScreenDimensions()
179
179
  let __resultCpp = __result
@@ -185,7 +185,7 @@ public class HybridNativePlatformSpec_cxx {
185
185
  }
186
186
 
187
187
  @inline(__always)
188
- public func getStatusBarDimensions() -> bridge.Result_Dimensions_ {
188
+ public final func getStatusBarDimensions() -> bridge.Result_Dimensions_ {
189
189
  do {
190
190
  let __result = try self.__implementation.getStatusBarDimensions()
191
191
  let __resultCpp = __result
@@ -197,7 +197,7 @@ public class HybridNativePlatformSpec_cxx {
197
197
  }
198
198
 
199
199
  @inline(__always)
200
- public func getNavigationBarDimensions() -> bridge.Result_Dimensions_ {
200
+ public final func getNavigationBarDimensions() -> bridge.Result_Dimensions_ {
201
201
  do {
202
202
  let __result = try self.__implementation.getNavigationBarDimensions()
203
203
  let __resultCpp = __result
@@ -209,7 +209,7 @@ public class HybridNativePlatformSpec_cxx {
209
209
  }
210
210
 
211
211
  @inline(__always)
212
- public func getPrefersRtlDirection() -> bridge.Result_bool_ {
212
+ public final func getPrefersRtlDirection() -> bridge.Result_bool_ {
213
213
  do {
214
214
  let __result = try self.__implementation.getPrefersRtlDirection()
215
215
  let __resultCpp = __result
@@ -221,7 +221,7 @@ public class HybridNativePlatformSpec_cxx {
221
221
  }
222
222
 
223
223
  @inline(__always)
224
- public func setRootViewBackgroundColor(color: Double) -> bridge.Result_void_ {
224
+ public final func setRootViewBackgroundColor(color: Double) -> bridge.Result_void_ {
225
225
  do {
226
226
  try self.__implementation.setRootViewBackgroundColor(color: color)
227
227
  return bridge.create_Result_void_()
@@ -232,7 +232,7 @@ public class HybridNativePlatformSpec_cxx {
232
232
  }
233
233
 
234
234
  @inline(__always)
235
- public func setNavigationBarHidden(isHidden: Bool) -> bridge.Result_void_ {
235
+ public final func setNavigationBarHidden(isHidden: Bool) -> bridge.Result_void_ {
236
236
  do {
237
237
  try self.__implementation.setNavigationBarHidden(isHidden: isHidden)
238
238
  return bridge.create_Result_void_()
@@ -243,7 +243,7 @@ public class HybridNativePlatformSpec_cxx {
243
243
  }
244
244
 
245
245
  @inline(__always)
246
- public func setStatusBarHidden(isHidden: Bool) -> bridge.Result_void_ {
246
+ public final func setStatusBarHidden(isHidden: Bool) -> bridge.Result_void_ {
247
247
  do {
248
248
  try self.__implementation.setStatusBarHidden(isHidden: isHidden)
249
249
  return bridge.create_Result_void_()
@@ -254,7 +254,7 @@ public class HybridNativePlatformSpec_cxx {
254
254
  }
255
255
 
256
256
  @inline(__always)
257
- public func setImmersiveMode(isEnabled: Bool) -> bridge.Result_void_ {
257
+ public final func setImmersiveMode(isEnabled: Bool) -> bridge.Result_void_ {
258
258
  do {
259
259
  try self.__implementation.setImmersiveMode(isEnabled: isEnabled)
260
260
  return bridge.create_Result_void_()
@@ -265,7 +265,7 @@ public class HybridNativePlatformSpec_cxx {
265
265
  }
266
266
 
267
267
  @inline(__always)
268
- public func getMiniRuntime() -> bridge.Result_UnistylesNativeMiniRuntime_ {
268
+ public final func getMiniRuntime() -> bridge.Result_UnistylesNativeMiniRuntime_ {
269
269
  do {
270
270
  let __result = try self.__implementation.getMiniRuntime()
271
271
  let __resultCpp = __result
@@ -277,7 +277,7 @@ public class HybridNativePlatformSpec_cxx {
277
277
  }
278
278
 
279
279
  @inline(__always)
280
- public func registerPlatformListener(callback: bridge.Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime) -> bridge.Result_void_ {
280
+ public final func registerPlatformListener(callback: bridge.Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime) -> bridge.Result_void_ {
281
281
  do {
282
282
  try self.__implementation.registerPlatformListener(callback: { () -> ([UnistyleDependency], UnistylesNativeMiniRuntime) -> Void in
283
283
  let __wrappedFunction = bridge.wrap_Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime(callback)
@@ -299,7 +299,7 @@ public class HybridNativePlatformSpec_cxx {
299
299
  }
300
300
 
301
301
  @inline(__always)
302
- public func registerImeListener(callback: bridge.Func_void_UnistylesNativeMiniRuntime) -> bridge.Result_void_ {
302
+ public final func registerImeListener(callback: bridge.Func_void_UnistylesNativeMiniRuntime) -> bridge.Result_void_ {
303
303
  do {
304
304
  try self.__implementation.registerImeListener(callback: { () -> (UnistylesNativeMiniRuntime) -> Void in
305
305
  let __wrappedFunction = bridge.wrap_Func_void_UnistylesNativeMiniRuntime(callback)
@@ -315,7 +315,7 @@ public class HybridNativePlatformSpec_cxx {
315
315
  }
316
316
 
317
317
  @inline(__always)
318
- public func unregisterPlatformListeners() -> bridge.Result_void_ {
318
+ public final func unregisterPlatformListeners() -> bridge.Result_void_ {
319
319
  do {
320
320
  try self.__implementation.unregisterPlatformListeners()
321
321
  return bridge.create_Result_void_()
@@ -42,7 +42,7 @@ namespace margelo::nitro {
42
42
 
43
43
  // C++ ColorScheme <> JS ColorScheme (union)
44
44
  template <>
45
- struct JSIConverter<ColorScheme> {
45
+ struct JSIConverter<ColorScheme> final {
46
46
  static inline ColorScheme fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
47
47
  std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
48
48
  switch (hashString(unionValue.c_str(), unionValue.size())) {
@@ -44,7 +44,7 @@ namespace margelo::nitro {
44
44
 
45
45
  // C++ Dimensions <> JS Dimensions (object)
46
46
  template <>
47
- struct JSIConverter<Dimensions> {
47
+ struct JSIConverter<Dimensions> final {
48
48
  static inline Dimensions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
49
49
  jsi::Object obj = arg.asObject(runtime);
50
50
  return Dimensions(
@@ -59,7 +59,7 @@ namespace margelo::nitro::unistyles {
59
59
  explicit HybridNativePlatformSpec(): HybridObject(TAG) { }
60
60
 
61
61
  // Destructor
62
- virtual ~HybridNativePlatformSpec() { }
62
+ ~HybridNativePlatformSpec() override = default;
63
63
 
64
64
  public:
65
65
  // Properties
@@ -40,7 +40,7 @@ namespace margelo::nitro::unistyles {
40
40
  explicit HybridUnistylesNavigationBarSpec(): HybridObject(TAG) { }
41
41
 
42
42
  // Destructor
43
- virtual ~HybridUnistylesNavigationBarSpec() { }
43
+ ~HybridUnistylesNavigationBarSpec() override = default;
44
44
 
45
45
  public:
46
46
  // Properties
@@ -56,7 +56,7 @@ namespace margelo::nitro::unistyles {
56
56
  explicit HybridUnistylesRuntimeSpec(): HybridObject(TAG) { }
57
57
 
58
58
  // Destructor
59
- virtual ~HybridUnistylesRuntimeSpec() { }
59
+ ~HybridUnistylesRuntimeSpec() override = default;
60
60
 
61
61
  public:
62
62
  // Properties
@@ -40,7 +40,7 @@ namespace margelo::nitro::unistyles {
40
40
  explicit HybridUnistylesShadowRegistrySpec(): HybridObject(TAG) { }
41
41
 
42
42
  // Destructor
43
- virtual ~HybridUnistylesShadowRegistrySpec() { }
43
+ ~HybridUnistylesShadowRegistrySpec() override = default;
44
44
 
45
45
  public:
46
46
  // Properties
@@ -40,7 +40,7 @@ namespace margelo::nitro::unistyles {
40
40
  explicit HybridUnistylesStatusBarSpec(): HybridObject(TAG) { }
41
41
 
42
42
  // Destructor
43
- virtual ~HybridUnistylesStatusBarSpec() { }
43
+ ~HybridUnistylesStatusBarSpec() override = default;
44
44
 
45
45
  public:
46
46
  // Properties
@@ -43,7 +43,7 @@ namespace margelo::nitro::unistyles {
43
43
  explicit HybridUnistylesStyleSheetSpec(): HybridObject(TAG) { }
44
44
 
45
45
  // Destructor
46
- virtual ~HybridUnistylesStyleSheetSpec() { }
46
+ ~HybridUnistylesStyleSheetSpec() override = default;
47
47
 
48
48
  public:
49
49
  // Properties
@@ -47,7 +47,7 @@ namespace margelo::nitro {
47
47
 
48
48
  // C++ Insets <> JS Insets (object)
49
49
  template <>
50
- struct JSIConverter<Insets> {
50
+ struct JSIConverter<Insets> final {
51
51
  static inline Insets fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
52
52
  jsi::Object obj = arg.asObject(runtime);
53
53
  return Insets(
@@ -41,7 +41,7 @@ namespace margelo::nitro {
41
41
 
42
42
  // C++ Orientation <> JS Orientation (union)
43
43
  template <>
44
- struct JSIConverter<Orientation> {
44
+ struct JSIConverter<Orientation> final {
45
45
  static inline Orientation fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
46
46
  std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
47
47
  switch (hashString(unionValue.c_str(), unionValue.size())) {
@@ -50,7 +50,7 @@ namespace margelo::nitro {
50
50
 
51
51
  // C++ UnistyleDependency <> JS UnistyleDependency (enum)
52
52
  template <>
53
- struct JSIConverter<UnistyleDependency> {
53
+ struct JSIConverter<UnistyleDependency> final {
54
54
  static inline UnistyleDependency fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
55
55
  int enumValue = JSIConverter<int>::fromJSI(runtime, arg);
56
56
  return static_cast<UnistyleDependency>(enumValue);
@@ -65,7 +65,7 @@ namespace margelo::nitro {
65
65
 
66
66
  // C++ UnistylesCxxMiniRuntime <> JS UnistylesCxxMiniRuntime (object)
67
67
  template <>
68
- struct JSIConverter<UnistylesCxxMiniRuntime> {
68
+ struct JSIConverter<UnistylesCxxMiniRuntime> final {
69
69
  static inline UnistylesCxxMiniRuntime fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
70
70
  jsi::Object obj = arg.asObject(runtime);
71
71
  return UnistylesCxxMiniRuntime(
@@ -61,7 +61,7 @@ namespace margelo::nitro {
61
61
 
62
62
  // C++ UnistylesNativeMiniRuntime <> JS UnistylesNativeMiniRuntime (object)
63
63
  template <>
64
- struct JSIConverter<UnistylesNativeMiniRuntime> {
64
+ struct JSIConverter<UnistylesNativeMiniRuntime> final {
65
65
  static inline UnistylesNativeMiniRuntime fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
66
66
  jsi::Object obj = arg.asObject(runtime);
67
67
  return UnistylesNativeMiniRuntime(
package/package.json CHANGED
@@ -1,14 +1,16 @@
1
1
  {
2
2
  "name": "react-native-unistyles",
3
- "version": "3.0.0-beta.6",
3
+ "version": "3.0.0-beta.7",
4
4
  "description": "Level up your React Native StyleSheet",
5
5
  "scripts": {
6
6
  "test": "jest",
7
7
  "test:coverage": "jest --passWithNoTests --coverage",
8
8
  "tsc": "node_modules/typescript/bin/tsc --noEmit",
9
9
  "lint": "biome lint",
10
+ "check": "biome check --write",
11
+ "check:ci": "biome check",
10
12
  "prepare": "husky && bob build",
11
- "precommit": "concurrently 'yarn tsc' 'yarn lint' 'yarn test'",
13
+ "precommit": "concurrently 'yarn tsc' 'yarn lint' 'yarn check' 'yarn test'",
12
14
  "release": "release-it"
13
15
  },
14
16
  "main": "lib/commonjs/index.js",
@@ -96,11 +98,11 @@
96
98
  "husky": "9.1.7",
97
99
  "jest": "29.7.0",
98
100
  "metro-react-native-babel-preset": "0.77.0",
99
- "nitro-codegen": "0.21.0",
101
+ "nitro-codegen": "0.22.1",
100
102
  "react": "18.3.1",
101
103
  "react-native": "0.77.0",
102
104
  "react-native-builder-bob": "0.33.1",
103
- "react-native-nitro-modules": "0.21.0",
105
+ "react-native-nitro-modules": "0.22.1",
104
106
  "react-native-web": "0.19.13",
105
107
  "react-test-renderer": "18.3.1",
106
108
  "release-it": "17.6.0",
package/plugin/import.js CHANGED
@@ -31,7 +31,7 @@ function addUnistylesImport(t, path, state) {
31
31
  const newImport = t.importDeclaration(
32
32
  [t.importSpecifier(t.identifier(localName), t.identifier(name))],
33
33
  t.stringLiteral(state.opts.isLocal
34
- ? state.file.opts.filename.split('react-native-unistyles').at(0).concat(`react-native-unistyles/components/native/${name}`)
34
+ ? state.file.opts.filename.split('react-native-unistyles').at(0).concat(`react-native-unistyles/src/components/native/${name}`)
35
35
  : `react-native-unistyles/components/native/${name}`
36
36
  )
37
37
  )
package/plugin/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const { addUnistylesImport, isInsideNodeModules } = require('./import')
2
2
  const { hasStringRef } = require('./ref')
3
- const { isUnistylesStyleSheet, analyzeDependencies, addStyleSheetTag, getUnistyles, isKindOfStyleSheet, addThemeDependencyToMemberExpression } = require('./stylesheet')
3
+ const { isUnistylesStyleSheet, addStyleSheetTag, isKindOfStyleSheet, getStylesDependenciesFromFunction, addDependencies, getStylesDependenciesFromObject } = require('./stylesheet')
4
4
  const { extractVariants } = require('./variants')
5
5
  const { REACT_NATIVE_COMPONENT_NAMES, REPLACE_WITH_UNISTYLES_PATHS, REPLACE_WITH_UNISTYLES_EXOTIC_PATHS, NATIVE_COMPONENTS_PATHS } = require('./consts')
6
6
  const { handleExoticImport } = require('./exotic')
@@ -17,6 +17,7 @@ module.exports = function ({ types: t }) {
17
17
  .some(path => state.filename.includes(path))
18
18
 
19
19
  state.file.hasAnyUnistyle = false
20
+ state.file.hasUnistylesImport = false
20
21
  state.file.hasVariants = false
21
22
  state.file.styleSheetLocalName = ''
22
23
  state.file.tagNumber = 0
@@ -95,6 +96,8 @@ module.exports = function ({ types: t }) {
95
96
  const importSource = path.node.source.value
96
97
 
97
98
  if (importSource.includes('react-native-unistyles')) {
99
+ state.file.hasUnistylesImport = true
100
+
98
101
  path.node.specifiers.forEach(specifier => {
99
102
  if (specifier.imported && specifier.imported.name === 'StyleSheet') {
100
103
  state.file.styleSheetLocalName = specifier.local.name
@@ -149,52 +152,38 @@ module.exports = function ({ types: t }) {
149
152
 
150
153
  const arg = path.node.arguments[0]
151
154
 
152
- // Object passed to StyleSheet.create
155
+ // Object passed to StyleSheet.create (may contain variants)
153
156
  if (t.isObjectExpression(arg)) {
154
- arg.properties.forEach(property => {
155
- if (t.isObjectProperty(property)) {
156
- const propertyValues = getUnistyles(t, property)
157
+ const detectedDependencies = getStylesDependenciesFromObject(t, path)
157
158
 
158
- propertyValues.forEach(propertyValue => {
159
- analyzeDependencies(t, state, property.key.name, propertyValue)
159
+ if (detectedDependencies) {
160
+ if (t.isObjectExpression(arg)) {
161
+ arg.properties.forEach(property => {
162
+ if (detectedDependencies.hasOwnProperty(property.key.name)) {
163
+ addDependencies(t, state, property.key.name, property, detectedDependencies[property.key.name])
164
+ }
160
165
  })
161
166
  }
162
- })
167
+ }
163
168
  }
164
169
 
165
170
  // Function passed to StyleSheet.create (e.g., theme => ({ container: {} }))
166
171
  if (t.isArrowFunctionExpression(arg) || t.isFunctionExpression(arg)) {
167
- const params = arg.params
168
- const hasTheme = params.length >= 1
169
- const hasMiniRuntime = params.length === 2
170
- const themeLocalName = hasTheme
171
- ? params[0].name
172
- : undefined
173
- const miniRuntimeLocalName = hasMiniRuntime
174
- ? params[1].name
175
- : undefined
176
- const body = t.isBlockStatement(arg.body)
177
- ? arg.body.body.find(statement => t.isReturnStatement(statement)).argument
178
- : arg.body
179
-
180
- // Ensure the function body returns an object
181
- if (t.isObjectExpression(body)) {
182
- body.properties.forEach(property => {
183
- if (t.isObjectProperty(property)) {
184
- const propertyValues = getUnistyles(t, property)
185
-
186
- // maybe user used inlined theme? ({ container: theme.components.container })
187
- if (propertyValues.length === 0 && t.isMemberExpression(property.value)) {
188
- if (property.value.object.object.name === themeLocalName) {
189
- addThemeDependencyToMemberExpression(t, property)
190
- }
172
+ const detectedDependencies = getStylesDependenciesFromFunction(t, path)
173
+
174
+ if (detectedDependencies) {
175
+ const body = t.isBlockStatement(arg.body)
176
+ ? arg.body.body.find(statement => t.isReturnStatement(statement)).argument
177
+ : arg.body
178
+
179
+ // Ensure the function body returns an object
180
+ if (t.isObjectExpression(body)) {
181
+ body.properties.forEach(property => {
182
+ if (detectedDependencies.hasOwnProperty(property.key.name)) {
183
+ addDependencies(t, state, property.key.name, property, detectedDependencies[property.key.name])
191
184
  }
192
-
193
- propertyValues.forEach(propertyValue => {
194
- analyzeDependencies(t, state, property.key.name, propertyValue, themeLocalName, miniRuntimeLocalName)
195
- })
196
- }
197
- })
185
+ })
186
+ }
198
187
  }
199
188
  }
200
189
  }