react-native-unistyles 3.0.0-alpha.21 → 3.0.0-alpha.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. package/cxx/hybridObjects/HybridStyleSheet.cpp +1 -1
  2. package/cxx/hybridObjects/HybridStyleSheet.h +1 -1
  3. package/lib/commonjs/web/convert/boxShadow.js +13 -13
  4. package/lib/commonjs/web/convert/boxShadow.js.map +1 -1
  5. package/lib/commonjs/web/convert/index.js +9 -11
  6. package/lib/commonjs/web/convert/index.js.map +1 -1
  7. package/lib/commonjs/web/convert/pseudo.js.map +1 -0
  8. package/lib/commonjs/web/convert/style.js +11 -7
  9. package/lib/commonjs/web/convert/style.js.map +1 -1
  10. package/lib/commonjs/web/convert/textShadow.js +12 -12
  11. package/lib/commonjs/web/convert/textShadow.js.map +1 -1
  12. package/lib/commonjs/web/convert/transform.js +5 -5
  13. package/lib/commonjs/web/convert/transform.js.map +1 -1
  14. package/lib/commonjs/web/{listener/listener.js → listener.js} +2 -2
  15. package/lib/commonjs/web/listener.js.map +1 -0
  16. package/lib/commonjs/web/mq.js.map +1 -1
  17. package/lib/commonjs/web/registry.js +159 -21
  18. package/lib/commonjs/web/registry.js.map +1 -1
  19. package/lib/commonjs/web/shadowRegistry.js +50 -48
  20. package/lib/commonjs/web/shadowRegistry.js.map +1 -1
  21. package/lib/commonjs/web/state.js +8 -16
  22. package/lib/commonjs/web/state.js.map +1 -1
  23. package/lib/commonjs/web/{utils.js → utils/common.js} +9 -47
  24. package/lib/commonjs/web/utils/common.js.map +1 -0
  25. package/lib/commonjs/web/utils/index.js +28 -0
  26. package/lib/commonjs/web/utils/index.js.map +1 -0
  27. package/lib/commonjs/web/utils/unistyle.js +82 -0
  28. package/lib/commonjs/web/utils/unistyle.js.map +1 -0
  29. package/lib/module/web/convert/boxShadow.js +13 -13
  30. package/lib/module/web/convert/boxShadow.js.map +1 -1
  31. package/lib/module/web/convert/index.js +7 -9
  32. package/lib/module/web/convert/index.js.map +1 -1
  33. package/lib/module/web/convert/pseudo.js.map +1 -0
  34. package/lib/module/web/convert/style.js +11 -7
  35. package/lib/module/web/convert/style.js.map +1 -1
  36. package/lib/module/web/convert/textShadow.js +12 -12
  37. package/lib/module/web/convert/textShadow.js.map +1 -1
  38. package/lib/module/web/convert/transform.js +5 -5
  39. package/lib/module/web/convert/transform.js.map +1 -1
  40. package/lib/module/web/{listener/listener.js → listener.js} +2 -2
  41. package/lib/module/web/listener.js.map +1 -0
  42. package/lib/module/web/mq.js.map +1 -1
  43. package/lib/module/web/registry.js +160 -22
  44. package/lib/module/web/registry.js.map +1 -1
  45. package/lib/module/web/shadowRegistry.js +51 -49
  46. package/lib/module/web/shadowRegistry.js.map +1 -1
  47. package/lib/module/web/state.js +8 -16
  48. package/lib/module/web/state.js.map +1 -1
  49. package/lib/module/web/{utils.js → utils/common.js} +7 -39
  50. package/lib/module/web/utils/common.js.map +1 -0
  51. package/lib/module/web/utils/index.js +5 -0
  52. package/lib/module/web/utils/index.js.map +1 -0
  53. package/lib/module/web/utils/unistyle.js +69 -0
  54. package/lib/module/web/utils/unistyle.js.map +1 -0
  55. package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts +1 -1
  56. package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts.map +1 -1
  57. package/lib/typescript/src/types/stylesheet.d.ts +1 -1
  58. package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
  59. package/lib/typescript/src/web/convert/boxShadow.d.ts +7 -2
  60. package/lib/typescript/src/web/convert/boxShadow.d.ts.map +1 -1
  61. package/lib/typescript/src/web/convert/index.d.ts +1 -2
  62. package/lib/typescript/src/web/convert/index.d.ts.map +1 -1
  63. package/lib/typescript/src/web/convert/pseudo.d.ts.map +1 -0
  64. package/lib/typescript/src/web/convert/style.d.ts +1 -2
  65. package/lib/typescript/src/web/convert/style.d.ts.map +1 -1
  66. package/lib/typescript/src/web/convert/textShadow.d.ts +7 -2
  67. package/lib/typescript/src/web/convert/textShadow.d.ts.map +1 -1
  68. package/lib/typescript/src/web/convert/transform.d.ts +1 -2
  69. package/lib/typescript/src/web/convert/transform.d.ts.map +1 -1
  70. package/lib/typescript/src/web/{listener/listener.d.ts → listener.d.ts} +1 -1
  71. package/lib/typescript/src/web/listener.d.ts.map +1 -0
  72. package/lib/typescript/src/web/mq.d.ts +6 -2
  73. package/lib/typescript/src/web/mq.d.ts.map +1 -1
  74. package/lib/typescript/src/web/registry.d.ts +21 -8
  75. package/lib/typescript/src/web/registry.d.ts.map +1 -1
  76. package/lib/typescript/src/web/shadowRegistry.d.ts +3 -4
  77. package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
  78. package/lib/typescript/src/web/state.d.ts +2 -2
  79. package/lib/typescript/src/web/state.d.ts.map +1 -1
  80. package/lib/typescript/src/web/{utils.d.ts → utils/common.d.ts} +2 -20
  81. package/lib/typescript/src/web/utils/common.d.ts.map +1 -0
  82. package/lib/typescript/src/web/utils/index.d.ts +3 -0
  83. package/lib/typescript/src/web/utils/index.d.ts.map +1 -0
  84. package/lib/typescript/src/web/utils/unistyle.d.ts +20 -0
  85. package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -0
  86. package/nitrogen/generated/android/c++/JColorScheme.hpp +1 -1
  87. package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency_.hpp +8 -8
  88. package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +22 -22
  89. package/nitrogen/generated/android/c++/JOrientation.hpp +1 -1
  90. package/nitrogen/generated/android/c++/JUnistyleDependency.hpp +1 -1
  91. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +2 -2
  92. package/nitrogen/generated/android/{UnistylesOnLoad.cpp → unistylesOnLoad.cpp} +2 -2
  93. package/nitrogen/generated/android/{UnistylesOnLoad.hpp → unistylesOnLoad.hpp} +1 -1
  94. package/nitrogen/generated/ios/Unistyles+autolinking.rb +5 -3
  95. package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.cpp +25 -0
  96. package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.hpp +32 -32
  97. package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Umbrella.hpp +0 -29
  98. package/nitrogen/generated/ios/swift/HybridNativePlatformSpec.swift +0 -12
  99. package/nitrogen/generated/ios/swift/HybridNativePlatformSpecCxx.swift +134 -110
  100. package/nitrogen/generated/shared/c++/ColorScheme.hpp +2 -2
  101. package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.cpp +1 -1
  102. package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.hpp +1 -1
  103. package/nitrogen/generated/shared/c++/Orientation.hpp +2 -2
  104. package/package.json +4 -15
  105. package/src/specs/StyleSheet/UnistylesStyleSheet.nitro.ts +1 -1
  106. package/src/types/stylesheet.ts +1 -1
  107. package/src/web/convert/boxShadow.ts +14 -15
  108. package/src/web/convert/index.ts +6 -13
  109. package/src/web/convert/style.ts +61 -10
  110. package/src/web/convert/textShadow.ts +13 -14
  111. package/src/web/convert/transform.ts +7 -8
  112. package/src/web/{listener/listener.ts → listener.ts} +2 -2
  113. package/src/web/mq.ts +1 -3
  114. package/src/web/registry.ts +202 -23
  115. package/src/web/shadowRegistry.ts +49 -49
  116. package/src/web/state.ts +13 -23
  117. package/src/web/{utils.ts → utils/common.ts} +6 -68
  118. package/src/web/utils/index.ts +2 -0
  119. package/src/web/utils/unistyle.ts +104 -0
  120. package/lib/commonjs/web/convert/breakpoint.js +0 -25
  121. package/lib/commonjs/web/convert/breakpoint.js.map +0 -1
  122. package/lib/commonjs/web/createUnistylesComponent.js +0 -61
  123. package/lib/commonjs/web/createUnistylesComponent.js.map +0 -1
  124. package/lib/commonjs/web/listener/index.js +0 -20
  125. package/lib/commonjs/web/listener/index.js.map +0 -1
  126. package/lib/commonjs/web/listener/listenToDependencies.js +0 -38
  127. package/lib/commonjs/web/listener/listenToDependencies.js.map +0 -1
  128. package/lib/commonjs/web/listener/listener.js.map +0 -1
  129. package/lib/commonjs/web/pseudo.js.map +0 -1
  130. package/lib/commonjs/web/utils.js.map +0 -1
  131. package/lib/module/web/convert/breakpoint.js +0 -20
  132. package/lib/module/web/convert/breakpoint.js.map +0 -1
  133. package/lib/module/web/createUnistylesComponent.js +0 -54
  134. package/lib/module/web/createUnistylesComponent.js.map +0 -1
  135. package/lib/module/web/listener/index.js +0 -5
  136. package/lib/module/web/listener/index.js.map +0 -1
  137. package/lib/module/web/listener/listenToDependencies.js +0 -33
  138. package/lib/module/web/listener/listenToDependencies.js.map +0 -1
  139. package/lib/module/web/listener/listener.js.map +0 -1
  140. package/lib/module/web/pseudo.js.map +0 -1
  141. package/lib/module/web/utils.js.map +0 -1
  142. package/lib/typescript/src/web/convert/breakpoint.d.ts +0 -3
  143. package/lib/typescript/src/web/convert/breakpoint.d.ts.map +0 -1
  144. package/lib/typescript/src/web/createUnistylesComponent.d.ts +0 -3
  145. package/lib/typescript/src/web/createUnistylesComponent.d.ts.map +0 -1
  146. package/lib/typescript/src/web/listener/index.d.ts +0 -3
  147. package/lib/typescript/src/web/listener/index.d.ts.map +0 -1
  148. package/lib/typescript/src/web/listener/listenToDependencies.d.ts +0 -12
  149. package/lib/typescript/src/web/listener/listenToDependencies.d.ts.map +0 -1
  150. package/lib/typescript/src/web/listener/listener.d.ts.map +0 -1
  151. package/lib/typescript/src/web/pseudo.d.ts.map +0 -1
  152. package/lib/typescript/src/web/utils.d.ts.map +0 -1
  153. package/src/web/convert/breakpoint.ts +0 -21
  154. package/src/web/createUnistylesComponent.tsx +0 -54
  155. package/src/web/listener/index.ts +0 -2
  156. package/src/web/listener/listenToDependencies.ts +0 -45
  157. /package/lib/commonjs/web/{pseudo.js → convert/pseudo.js} +0 -0
  158. /package/lib/module/web/{pseudo.js → convert/pseudo.js} +0 -0
  159. /package/lib/typescript/src/web/{pseudo.d.ts → convert/pseudo.d.ts} +0 -0
  160. /package/nitrogen/generated/android/{UnistylesOnLoad.kt → unistylesOnLoad.kt} +0 -0
  161. /package/src/web/{pseudo.ts → convert/pseudo.ts} +0 -0
@@ -8,6 +8,30 @@
8
8
  import Foundation
9
9
  import NitroModules
10
10
 
11
+ /**
12
+ * Helper class for converting instances of `HybridNativePlatformSpecCxx` from- and to unsafe pointers.
13
+ * This is useful to pass Swift classes to C++, without having to strongly type the C++ function signature.
14
+ * The actual Swift type can be included in the .cpp file, without having to forward-declare anything in .hpp.
15
+ */
16
+ public final class HybridNativePlatformSpecCxxUnsafe {
17
+ /**
18
+ * Casts a `HybridNativePlatformSpecCxx` instance to a retained unsafe raw pointer.
19
+ * This acquires one additional strong reference on the object!
20
+ */
21
+ public static func toUnsafe(_ instance: HybridNativePlatformSpecCxx) -> UnsafeMutableRawPointer {
22
+ return Unmanaged.passRetained(instance).toOpaque()
23
+ }
24
+
25
+ /**
26
+ * Casts an unsafe pointer to a `HybridNativePlatformSpecCxx`.
27
+ * The pointer has to be a retained opaque `Unmanaged<HybridNativePlatformSpecCxx>`.
28
+ * This removes one strong reference from the object!
29
+ */
30
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridNativePlatformSpecCxx {
31
+ return Unmanaged<HybridNativePlatformSpecCxx>.fromOpaque(pointer).takeRetainedValue()
32
+ }
33
+ }
34
+
11
35
  /**
12
36
  * A class implementation that bridges HybridNativePlatformSpec over to C++.
13
37
  * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
@@ -28,23 +52,23 @@ public class HybridNativePlatformSpecCxx {
28
52
  /**
29
53
  * Holds an instance of the `HybridNativePlatformSpec` Swift protocol.
30
54
  */
31
- private var implementation: HybridNativePlatformSpec
55
+ private var __implementation: any HybridNativePlatformSpec
32
56
 
33
57
  /**
34
- * Get the actual `HybridNativePlatformSpec` instance this class wraps.
58
+ * Create a new `HybridNativePlatformSpecCxx` that wraps the given `HybridNativePlatformSpec`.
59
+ * All properties and methods bridge to C++ types.
35
60
  */
36
- @inline(__always)
37
- public func getHybridNativePlatformSpec() -> HybridNativePlatformSpec {
38
- return implementation
61
+ public init(_ implementation: some HybridNativePlatformSpec) {
62
+ self.__implementation = implementation
63
+ /* no base class */
39
64
  }
40
65
 
41
66
  /**
42
- * Create a new `HybridNativePlatformSpecCxx` that wraps the given `HybridNativePlatformSpec`.
43
- * All properties and methods bridge to C++ types.
67
+ * Get the actual `HybridNativePlatformSpec` instance this class wraps.
44
68
  */
45
- public init(_ implementation: HybridNativePlatformSpec) {
46
- self.implementation = implementation
47
- /* no base class */
69
+ @inline(__always)
70
+ public func getHybridNativePlatformSpec() -> any HybridNativePlatformSpec {
71
+ return __implementation
48
72
  }
49
73
 
50
74
  /**
@@ -53,11 +77,11 @@ public class HybridNativePlatformSpecCxx {
53
77
  public var hybridContext: margelo.nitro.HybridContext {
54
78
  @inline(__always)
55
79
  get {
56
- return self.implementation.hybridContext
80
+ return self.__implementation.hybridContext
57
81
  }
58
82
  @inline(__always)
59
83
  set {
60
- self.implementation.hybridContext = newValue
84
+ self.__implementation.hybridContext = newValue
61
85
  }
62
86
  }
63
87
 
@@ -67,219 +91,219 @@ public class HybridNativePlatformSpecCxx {
67
91
  */
68
92
  @inline(__always)
69
93
  public var memorySize: Int {
70
- return self.implementation.memorySize
94
+ return self.__implementation.memorySize
71
95
  }
72
96
 
73
97
  // Properties
74
-
98
+
75
99
 
76
100
  // Methods
77
101
  @inline(__always)
78
102
  public func getInsets() -> Insets {
79
103
  do {
80
- let result = try self.implementation.getInsets()
81
- return result
104
+ let __result = try self.__implementation.getInsets()
105
+ return __result
82
106
  } catch {
83
- let message = "\(error.localizedDescription)"
84
- fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(message))")
107
+ let __message = "\(error.localizedDescription)"
108
+ fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(__message))")
85
109
  }
86
110
  }
87
-
111
+
88
112
  @inline(__always)
89
113
  public func getColorScheme() -> Int32 {
90
114
  do {
91
- let result = try self.implementation.getColorScheme()
92
- return result.rawValue
115
+ let __result = try self.__implementation.getColorScheme()
116
+ return __result.rawValue
93
117
  } catch {
94
- let message = "\(error.localizedDescription)"
95
- fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(message))")
118
+ let __message = "\(error.localizedDescription)"
119
+ fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(__message))")
96
120
  }
97
121
  }
98
-
122
+
99
123
  @inline(__always)
100
124
  public func getFontScale() -> Double {
101
125
  do {
102
- let result = try self.implementation.getFontScale()
103
- return result
126
+ let __result = try self.__implementation.getFontScale()
127
+ return __result
104
128
  } catch {
105
- let message = "\(error.localizedDescription)"
106
- fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(message))")
129
+ let __message = "\(error.localizedDescription)"
130
+ fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(__message))")
107
131
  }
108
132
  }
109
-
133
+
110
134
  @inline(__always)
111
135
  public func getPixelRatio() -> Double {
112
136
  do {
113
- let result = try self.implementation.getPixelRatio()
114
- return result
137
+ let __result = try self.__implementation.getPixelRatio()
138
+ return __result
115
139
  } catch {
116
- let message = "\(error.localizedDescription)"
117
- fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(message))")
140
+ let __message = "\(error.localizedDescription)"
141
+ fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(__message))")
118
142
  }
119
143
  }
120
-
144
+
121
145
  @inline(__always)
122
146
  public func getOrientation() -> Int32 {
123
147
  do {
124
- let result = try self.implementation.getOrientation()
125
- return result.rawValue
148
+ let __result = try self.__implementation.getOrientation()
149
+ return __result.rawValue
126
150
  } catch {
127
- let message = "\(error.localizedDescription)"
128
- fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(message))")
151
+ let __message = "\(error.localizedDescription)"
152
+ fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(__message))")
129
153
  }
130
154
  }
131
-
155
+
132
156
  @inline(__always)
133
157
  public func getContentSizeCategory() -> std.string {
134
158
  do {
135
- let result = try self.implementation.getContentSizeCategory()
136
- return std.string(result)
159
+ let __result = try self.__implementation.getContentSizeCategory()
160
+ return std.string(__result)
137
161
  } catch {
138
- let message = "\(error.localizedDescription)"
139
- fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(message))")
162
+ let __message = "\(error.localizedDescription)"
163
+ fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(__message))")
140
164
  }
141
165
  }
142
-
166
+
143
167
  @inline(__always)
144
168
  public func getScreenDimensions() -> Dimensions {
145
169
  do {
146
- let result = try self.implementation.getScreenDimensions()
147
- return result
170
+ let __result = try self.__implementation.getScreenDimensions()
171
+ return __result
148
172
  } catch {
149
- let message = "\(error.localizedDescription)"
150
- fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(message))")
173
+ let __message = "\(error.localizedDescription)"
174
+ fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(__message))")
151
175
  }
152
176
  }
153
-
177
+
154
178
  @inline(__always)
155
179
  public func getStatusBarDimensions() -> Dimensions {
156
180
  do {
157
- let result = try self.implementation.getStatusBarDimensions()
158
- return result
181
+ let __result = try self.__implementation.getStatusBarDimensions()
182
+ return __result
159
183
  } catch {
160
- let message = "\(error.localizedDescription)"
161
- fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(message))")
184
+ let __message = "\(error.localizedDescription)"
185
+ fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(__message))")
162
186
  }
163
187
  }
164
-
188
+
165
189
  @inline(__always)
166
190
  public func getNavigationBarDimensions() -> Dimensions {
167
191
  do {
168
- let result = try self.implementation.getNavigationBarDimensions()
169
- return result
192
+ let __result = try self.__implementation.getNavigationBarDimensions()
193
+ return __result
170
194
  } catch {
171
- let message = "\(error.localizedDescription)"
172
- fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(message))")
195
+ let __message = "\(error.localizedDescription)"
196
+ fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(__message))")
173
197
  }
174
198
  }
175
-
199
+
176
200
  @inline(__always)
177
201
  public func getPrefersRtlDirection() -> Bool {
178
202
  do {
179
- let result = try self.implementation.getPrefersRtlDirection()
180
- return result
203
+ let __result = try self.__implementation.getPrefersRtlDirection()
204
+ return __result
181
205
  } catch {
182
- let message = "\(error.localizedDescription)"
183
- fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(message))")
206
+ let __message = "\(error.localizedDescription)"
207
+ fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(__message))")
184
208
  }
185
209
  }
186
-
210
+
187
211
  @inline(__always)
188
212
  public func setRootViewBackgroundColor(color: Double) -> Void {
189
213
  do {
190
- try self.implementation.setRootViewBackgroundColor(color: color)
191
- return
214
+ try self.__implementation.setRootViewBackgroundColor(color: color)
215
+ return
192
216
  } catch {
193
- let message = "\(error.localizedDescription)"
194
- fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(message))")
217
+ let __message = "\(error.localizedDescription)"
218
+ fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(__message))")
195
219
  }
196
220
  }
197
-
221
+
198
222
  @inline(__always)
199
223
  public func setNavigationBarBackgroundColor(color: Double) -> Void {
200
224
  do {
201
- try self.implementation.setNavigationBarBackgroundColor(color: color)
202
- return
225
+ try self.__implementation.setNavigationBarBackgroundColor(color: color)
226
+ return
203
227
  } catch {
204
- let message = "\(error.localizedDescription)"
205
- fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(message))")
228
+ let __message = "\(error.localizedDescription)"
229
+ fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(__message))")
206
230
  }
207
231
  }
208
-
232
+
209
233
  @inline(__always)
210
234
  public func setNavigationBarHidden(isHidden: Bool) -> Void {
211
235
  do {
212
- try self.implementation.setNavigationBarHidden(isHidden: isHidden)
213
- return
236
+ try self.__implementation.setNavigationBarHidden(isHidden: isHidden)
237
+ return
214
238
  } catch {
215
- let message = "\(error.localizedDescription)"
216
- fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(message))")
239
+ let __message = "\(error.localizedDescription)"
240
+ fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(__message))")
217
241
  }
218
242
  }
219
-
243
+
220
244
  @inline(__always)
221
245
  public func setStatusBarHidden(isHidden: Bool) -> Void {
222
246
  do {
223
- try self.implementation.setStatusBarHidden(isHidden: isHidden)
224
- return
247
+ try self.__implementation.setStatusBarHidden(isHidden: isHidden)
248
+ return
225
249
  } catch {
226
- let message = "\(error.localizedDescription)"
227
- fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(message))")
250
+ let __message = "\(error.localizedDescription)"
251
+ fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(__message))")
228
252
  }
229
253
  }
230
-
254
+
231
255
  @inline(__always)
232
256
  public func setStatusBarBackgroundColor(color: Double) -> Void {
233
257
  do {
234
- try self.implementation.setStatusBarBackgroundColor(color: color)
235
- return
258
+ try self.__implementation.setStatusBarBackgroundColor(color: color)
259
+ return
236
260
  } catch {
237
- let message = "\(error.localizedDescription)"
238
- fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(message))")
261
+ let __message = "\(error.localizedDescription)"
262
+ fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(__message))")
239
263
  }
240
264
  }
241
-
265
+
242
266
  @inline(__always)
243
267
  public func setImmersiveMode(isEnabled: Bool) -> Void {
244
268
  do {
245
- try self.implementation.setImmersiveMode(isEnabled: isEnabled)
246
- return
269
+ try self.__implementation.setImmersiveMode(isEnabled: isEnabled)
270
+ return
247
271
  } catch {
248
- let message = "\(error.localizedDescription)"
249
- fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(message))")
272
+ let __message = "\(error.localizedDescription)"
273
+ fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(__message))")
250
274
  }
251
275
  }
252
-
276
+
253
277
  @inline(__always)
254
278
  public func getMiniRuntime() -> UnistylesNativeMiniRuntime {
255
279
  do {
256
- let result = try self.implementation.getMiniRuntime()
257
- return result
280
+ let __result = try self.__implementation.getMiniRuntime()
281
+ return __result
258
282
  } catch {
259
- let message = "\(error.localizedDescription)"
260
- fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(message))")
283
+ let __message = "\(error.localizedDescription)"
284
+ fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(__message))")
261
285
  }
262
286
  }
263
-
287
+
264
288
  @inline(__always)
265
289
  public func registerPlatformListener(callback: bridge.Func_void_std__vector_UnistyleDependency_) -> Void {
266
290
  do {
267
- try self.implementation.registerPlatformListener(callback: { () -> (([UnistyleDependency]) -> Void) in
268
- let shared = bridge.share_Func_void_std__vector_UnistyleDependency_(callback)
269
- return { (dependencies: [UnistyleDependency]) -> Void in
270
- shared.pointee.call({ () -> bridge.std__vector_UnistyleDependency_ in
271
- var vector = bridge.create_std__vector_UnistyleDependency_(dependencies.count)
272
- for item in dependencies {
273
- vector.push_back(item)
291
+ try self.__implementation.registerPlatformListener(callback: { () -> (([UnistyleDependency]) -> Void) in
292
+ let __sharedClosure = bridge.share_Func_void_std__vector_UnistyleDependency_(callback)
293
+ return { (__dependencies: [UnistyleDependency]) -> Void in
294
+ __sharedClosure.pointee.call({ () -> bridge.std__vector_UnistyleDependency_ in
295
+ var __vector = bridge.create_std__vector_UnistyleDependency_(__dependencies.count)
296
+ for __item in __dependencies {
297
+ __vector.push_back(__item)
274
298
  }
275
- return vector
299
+ return __vector
276
300
  }())
277
301
  }
278
302
  }())
279
- return
303
+ return
280
304
  } catch {
281
- let message = "\(error.localizedDescription)"
282
- fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(message))")
305
+ let __message = "\(error.localizedDescription)"
306
+ fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(__message))")
283
307
  }
284
308
  }
285
309
  }
@@ -50,7 +50,7 @@ namespace margelo::nitro {
50
50
  case hashString("light"): return ColorScheme::LIGHT;
51
51
  case hashString("unspecified"): return ColorScheme::UNSPECIFIED;
52
52
  default: [[unlikely]]
53
- throw std::runtime_error("Cannot convert \"" + unionValue + "\" to enum ColorScheme - invalid value!");
53
+ throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum ColorScheme - invalid value!");
54
54
  }
55
55
  }
56
56
  static inline jsi::Value toJSI(jsi::Runtime& runtime, ColorScheme arg) {
@@ -59,7 +59,7 @@ namespace margelo::nitro {
59
59
  case ColorScheme::LIGHT: return JSIConverter<std::string>::toJSI(runtime, "light");
60
60
  case ColorScheme::UNSPECIFIED: return JSIConverter<std::string>::toJSI(runtime, "unspecified");
61
61
  default: [[unlikely]]
62
- throw std::runtime_error("Cannot convert ColorScheme to JS - invalid value: "
62
+ throw std::invalid_argument("Cannot convert ColorScheme to JS - invalid value: "
63
63
  + std::to_string(static_cast<int>(arg)) + "!");
64
64
  }
65
65
  }
@@ -15,7 +15,7 @@ namespace margelo::nitro::unistyles {
15
15
  // load custom methods/properties
16
16
  registerHybrids(this, [](Prototype& prototype) {
17
17
  prototype.registerHybridGetter("hairlineWidth", &HybridUnistylesStyleSheetSpec::getHairlineWidth);
18
- prototype.registerHybridGetter("__unid", &HybridUnistylesStyleSheetSpec::get__unid);
18
+ prototype.registerHybridGetter("unid", &HybridUnistylesStyleSheetSpec::getUnid);
19
19
  });
20
20
  }
21
21
 
@@ -45,7 +45,7 @@ namespace margelo::nitro::unistyles {
45
45
  public:
46
46
  // Properties
47
47
  virtual double getHairlineWidth() = 0;
48
- virtual double get__unid() = 0;
48
+ virtual double getUnid() = 0;
49
49
 
50
50
  public:
51
51
  // Methods
@@ -48,7 +48,7 @@ namespace margelo::nitro {
48
48
  case hashString("portrait"): return Orientation::PORTRAIT;
49
49
  case hashString("landscape"): return Orientation::LANDSCAPE;
50
50
  default: [[unlikely]]
51
- throw std::runtime_error("Cannot convert \"" + unionValue + "\" to enum Orientation - invalid value!");
51
+ throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum Orientation - invalid value!");
52
52
  }
53
53
  }
54
54
  static inline jsi::Value toJSI(jsi::Runtime& runtime, Orientation arg) {
@@ -56,7 +56,7 @@ namespace margelo::nitro {
56
56
  case Orientation::PORTRAIT: return JSIConverter<std::string>::toJSI(runtime, "portrait");
57
57
  case Orientation::LANDSCAPE: return JSIConverter<std::string>::toJSI(runtime, "landscape");
58
58
  default: [[unlikely]]
59
- throw std::runtime_error("Cannot convert Orientation to JS - invalid value: "
59
+ throw std::invalid_argument("Cannot convert Orientation to JS - invalid value: "
60
60
  + std::to_string(static_cast<int>(arg)) + "!");
61
61
  }
62
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-unistyles",
3
- "version": "3.0.0-alpha.21",
3
+ "version": "3.0.0-alpha.22",
4
4
  "description": "Level up your React Native StyleSheet",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -74,12 +74,11 @@
74
74
  "husky": "9.1.5",
75
75
  "jest": "29.7.0",
76
76
  "metro-react-native-babel-preset": "0.77.0",
77
- "nitro-codegen": "0.11.0",
77
+ "nitro-codegen": "0.13.0",
78
78
  "react": "18.3.1",
79
79
  "react-native": "0.75.2",
80
80
  "react-native-builder-bob": "0.30.0",
81
- "react-native-nitro-modules": "0.11.0",
82
- "react-native-web": "0.19.12",
81
+ "react-native-nitro-modules": "0.13.0",
83
82
  "react-test-renderer": "18.3.1",
84
83
  "release-it": "17.6.0",
85
84
  "typescript": "5.5.4",
@@ -88,17 +87,7 @@
88
87
  "peerDependencies": {
89
88
  "@react-native/normalize-colors": "*",
90
89
  "react": "*",
91
- "react-native": "*",
92
- "react-native-web": "*",
93
- "typestyle": ">=2.4.0"
94
- },
95
- "peerDependenciesMeta": {
96
- "react-native-web": {
97
- "optional": true
98
- },
99
- "typestyle": {
100
- "optional": true
101
- }
90
+ "react-native": "*"
102
91
  },
103
92
  "workspaces": [
104
93
  "example",
@@ -2,5 +2,5 @@ import type { HybridObject } from 'react-native-nitro-modules'
2
2
 
3
3
  export interface UnistylesStyleSheet extends HybridObject<{ ios: 'c++', android: 'c++' }> {
4
4
  readonly hairlineWidth: number
5
- readonly __unid: number
5
+ readonly unid: number
6
6
  }
@@ -5,7 +5,7 @@ import type { UnistylesMiniRuntime } from '../specs'
5
5
  import type { ReactNativeStyleSheet } from './breakpoints'
6
6
  import type { ExtractVariantNames } from './variants'
7
7
  import type { CSSProperties } from 'react'
8
- import type { Pseudo } from '../web/pseudo'
8
+ import type { Pseudo } from '../web/convert/pseudo'
9
9
 
10
10
  // these props are treated differently to nest breakpoints and media queries
11
11
  type NestedKeys = 'shadowOffset' | 'transform' | 'textShadowOffset'
@@ -1,8 +1,5 @@
1
- import { media } from 'typestyle'
2
- import type { NestedCSSProperties } from 'typestyle/lib/types'
3
1
  import { deepMergeObjects, warn } from '../utils'
4
2
  import { validateShadow } from './shadow'
5
- import { convertBreakpoint } from './breakpoint'
6
3
  import { BOX_SHADOW_STYLES, type BoxShadow } from './types'
7
4
  import { extractShadowValue, normalizeColor, normalizeNumericValue } from './utils'
8
5
 
@@ -17,7 +14,7 @@ const createBoxShadowValue = (style: BoxShadow) => {
17
14
  return `${offsetX} ${offsetY} ${radius} ${color}`
18
15
  }
19
16
 
20
- export const getBoxShadowStyle = (styles: Record<string, any>): NestedCSSProperties => {
17
+ export const getBoxShadowStyle = (styles: Record<string, any>) => {
21
18
  const missingStyles = BOX_SHADOW_STYLES.filter(key => !(key in styles))
22
19
 
23
20
  if (missingStyles.length) {
@@ -54,17 +51,19 @@ export const getBoxShadowStyle = (styles: Record<string, any>): NestedCSSPropert
54
51
  const radius = extractShadowValue('shadowRadius', breakpoint, styles)
55
52
  const opacity = extractShadowValue('shadowOpacity', breakpoint, styles)
56
53
 
57
- return media(convertBreakpoint(breakpoint), {
58
- boxShadow: createBoxShadowValue({
59
- shadowColor: color,
60
- shadowOffset: {
61
- width,
62
- height
63
- },
64
- shadowRadius: radius,
65
- shadowOpacity: opacity
66
- })
67
- })
54
+ return {
55
+ [breakpoint]: {
56
+ boxShadow: createBoxShadowValue({
57
+ shadowColor: color,
58
+ shadowOffset: {
59
+ width,
60
+ height
61
+ },
62
+ shadowRadius: radius,
63
+ shadowOpacity: opacity
64
+ })
65
+ }
66
+ }
68
67
  })
69
68
 
70
69
  // Merge all breakpoints styles into one
@@ -1,8 +1,5 @@
1
- import type { NestedCSSProperties } from 'typestyle/lib/types'
2
1
  import type { UnistylesValues } from '../../types'
3
- import { media } from 'typestyle'
4
- import { isPseudo } from '../pseudo'
5
- import { convertBreakpoint } from './breakpoint'
2
+ import { isPseudo } from './pseudo'
6
3
  import { getStyle } from './style'
7
4
  import { deepMergeObjects } from '../utils'
8
5
  import { getTransformStyle } from './transform'
@@ -10,7 +7,7 @@ import { isBoxShadow, isTextShadow, isTransform } from './utils'
10
7
  import { getTextShadowStyle } from './textShadow'
11
8
  import { getBoxShadowStyle } from './boxShadow'
12
9
 
13
- export const convertToTypeStyle = (value: UnistylesValues) => {
10
+ export const convertUnistyles = (value: UnistylesValues) => {
14
11
  // Flag to mark if textShadow is already created
15
12
  let hasTextShadow = false
16
13
  // Flag to mark if boxShadow is already created
@@ -27,13 +24,9 @@ export const convertToTypeStyle = (value: UnistylesValues) => {
27
24
 
28
25
  // Pseudo classes :hover, :before etc.
29
26
  if (isPseudo(unistylesKey)) {
30
- const typestyleValues = convertToTypeStyle(unistylesValue as UnistylesValues)
27
+ const flattenValues = convertUnistyles(unistylesValue as UnistylesValues)
31
28
 
32
- return {
33
- $nest: {
34
- [unistylesKey.replace('_', '&:')]: typestyleValues
35
- }
36
- }
29
+ return { [unistylesKey]: flattenValues }
37
30
  }
38
31
 
39
32
  // Text shadow
@@ -66,13 +59,13 @@ export const convertToTypeStyle = (value: UnistylesValues) => {
66
59
  // Breakpoints
67
60
  if (typeof unistylesValue === 'object' && unistylesValue !== null) {
68
61
  return Object.entries(unistylesValue).map(([breakpointKey, breakpointValue]) => {
69
- return media(convertBreakpoint(breakpointKey), getStyle(unistylesKey, breakpointValue))
62
+ return { [breakpointKey]: getStyle(unistylesKey, breakpointValue) }
70
63
  })
71
64
  }
72
65
 
73
66
  // Regular styles
74
67
  return getStyle(unistylesKey, unistylesValue)
75
- }) as Array<NestedCSSProperties>
68
+ }) as Array<Record<string, any>>
76
69
 
77
70
  return deepMergeObjects(...stylesArray)
78
71
  }