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.
- package/cxx/hybridObjects/HybridStyleSheet.cpp +1 -1
- package/cxx/hybridObjects/HybridStyleSheet.h +1 -1
- package/lib/commonjs/web/convert/boxShadow.js +13 -13
- package/lib/commonjs/web/convert/boxShadow.js.map +1 -1
- package/lib/commonjs/web/convert/index.js +9 -11
- package/lib/commonjs/web/convert/index.js.map +1 -1
- package/lib/commonjs/web/convert/pseudo.js.map +1 -0
- package/lib/commonjs/web/convert/style.js +11 -7
- package/lib/commonjs/web/convert/style.js.map +1 -1
- package/lib/commonjs/web/convert/textShadow.js +12 -12
- package/lib/commonjs/web/convert/textShadow.js.map +1 -1
- package/lib/commonjs/web/convert/transform.js +5 -5
- package/lib/commonjs/web/convert/transform.js.map +1 -1
- package/lib/commonjs/web/{listener/listener.js → listener.js} +2 -2
- package/lib/commonjs/web/listener.js.map +1 -0
- package/lib/commonjs/web/mq.js.map +1 -1
- package/lib/commonjs/web/registry.js +159 -21
- package/lib/commonjs/web/registry.js.map +1 -1
- package/lib/commonjs/web/shadowRegistry.js +50 -48
- package/lib/commonjs/web/shadowRegistry.js.map +1 -1
- package/lib/commonjs/web/state.js +8 -16
- package/lib/commonjs/web/state.js.map +1 -1
- package/lib/commonjs/web/{utils.js → utils/common.js} +9 -47
- package/lib/commonjs/web/utils/common.js.map +1 -0
- package/lib/commonjs/web/utils/index.js +28 -0
- package/lib/commonjs/web/utils/index.js.map +1 -0
- package/lib/commonjs/web/utils/unistyle.js +82 -0
- package/lib/commonjs/web/utils/unistyle.js.map +1 -0
- package/lib/module/web/convert/boxShadow.js +13 -13
- package/lib/module/web/convert/boxShadow.js.map +1 -1
- package/lib/module/web/convert/index.js +7 -9
- package/lib/module/web/convert/index.js.map +1 -1
- package/lib/module/web/convert/pseudo.js.map +1 -0
- package/lib/module/web/convert/style.js +11 -7
- package/lib/module/web/convert/style.js.map +1 -1
- package/lib/module/web/convert/textShadow.js +12 -12
- package/lib/module/web/convert/textShadow.js.map +1 -1
- package/lib/module/web/convert/transform.js +5 -5
- package/lib/module/web/convert/transform.js.map +1 -1
- package/lib/module/web/{listener/listener.js → listener.js} +2 -2
- package/lib/module/web/listener.js.map +1 -0
- package/lib/module/web/mq.js.map +1 -1
- package/lib/module/web/registry.js +160 -22
- package/lib/module/web/registry.js.map +1 -1
- package/lib/module/web/shadowRegistry.js +51 -49
- package/lib/module/web/shadowRegistry.js.map +1 -1
- package/lib/module/web/state.js +8 -16
- package/lib/module/web/state.js.map +1 -1
- package/lib/module/web/{utils.js → utils/common.js} +7 -39
- package/lib/module/web/utils/common.js.map +1 -0
- package/lib/module/web/utils/index.js +5 -0
- package/lib/module/web/utils/index.js.map +1 -0
- package/lib/module/web/utils/unistyle.js +69 -0
- package/lib/module/web/utils/unistyle.js.map +1 -0
- package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts +1 -1
- package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types/stylesheet.d.ts +1 -1
- package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/boxShadow.d.ts +7 -2
- package/lib/typescript/src/web/convert/boxShadow.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/index.d.ts +1 -2
- package/lib/typescript/src/web/convert/index.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/pseudo.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/style.d.ts +1 -2
- package/lib/typescript/src/web/convert/style.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/textShadow.d.ts +7 -2
- package/lib/typescript/src/web/convert/textShadow.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/transform.d.ts +1 -2
- package/lib/typescript/src/web/convert/transform.d.ts.map +1 -1
- package/lib/typescript/src/web/{listener/listener.d.ts → listener.d.ts} +1 -1
- package/lib/typescript/src/web/listener.d.ts.map +1 -0
- package/lib/typescript/src/web/mq.d.ts +6 -2
- package/lib/typescript/src/web/mq.d.ts.map +1 -1
- package/lib/typescript/src/web/registry.d.ts +21 -8
- package/lib/typescript/src/web/registry.d.ts.map +1 -1
- package/lib/typescript/src/web/shadowRegistry.d.ts +3 -4
- package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
- package/lib/typescript/src/web/state.d.ts +2 -2
- package/lib/typescript/src/web/state.d.ts.map +1 -1
- package/lib/typescript/src/web/{utils.d.ts → utils/common.d.ts} +2 -20
- package/lib/typescript/src/web/utils/common.d.ts.map +1 -0
- package/lib/typescript/src/web/utils/index.d.ts +3 -0
- package/lib/typescript/src/web/utils/index.d.ts.map +1 -0
- package/lib/typescript/src/web/utils/unistyle.d.ts +20 -0
- package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -0
- package/nitrogen/generated/android/c++/JColorScheme.hpp +1 -1
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency_.hpp +8 -8
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +22 -22
- package/nitrogen/generated/android/c++/JOrientation.hpp +1 -1
- package/nitrogen/generated/android/c++/JUnistyleDependency.hpp +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +2 -2
- package/nitrogen/generated/android/{UnistylesOnLoad.cpp → unistylesOnLoad.cpp} +2 -2
- package/nitrogen/generated/android/{UnistylesOnLoad.hpp → unistylesOnLoad.hpp} +1 -1
- package/nitrogen/generated/ios/Unistyles+autolinking.rb +5 -3
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.cpp +25 -0
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.hpp +32 -32
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Umbrella.hpp +0 -29
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpec.swift +0 -12
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpecCxx.swift +134 -110
- package/nitrogen/generated/shared/c++/ColorScheme.hpp +2 -2
- package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/Orientation.hpp +2 -2
- package/package.json +4 -15
- package/src/specs/StyleSheet/UnistylesStyleSheet.nitro.ts +1 -1
- package/src/types/stylesheet.ts +1 -1
- package/src/web/convert/boxShadow.ts +14 -15
- package/src/web/convert/index.ts +6 -13
- package/src/web/convert/style.ts +61 -10
- package/src/web/convert/textShadow.ts +13 -14
- package/src/web/convert/transform.ts +7 -8
- package/src/web/{listener/listener.ts → listener.ts} +2 -2
- package/src/web/mq.ts +1 -3
- package/src/web/registry.ts +202 -23
- package/src/web/shadowRegistry.ts +49 -49
- package/src/web/state.ts +13 -23
- package/src/web/{utils.ts → utils/common.ts} +6 -68
- package/src/web/utils/index.ts +2 -0
- package/src/web/utils/unistyle.ts +104 -0
- package/lib/commonjs/web/convert/breakpoint.js +0 -25
- package/lib/commonjs/web/convert/breakpoint.js.map +0 -1
- package/lib/commonjs/web/createUnistylesComponent.js +0 -61
- package/lib/commonjs/web/createUnistylesComponent.js.map +0 -1
- package/lib/commonjs/web/listener/index.js +0 -20
- package/lib/commonjs/web/listener/index.js.map +0 -1
- package/lib/commonjs/web/listener/listenToDependencies.js +0 -38
- package/lib/commonjs/web/listener/listenToDependencies.js.map +0 -1
- package/lib/commonjs/web/listener/listener.js.map +0 -1
- package/lib/commonjs/web/pseudo.js.map +0 -1
- package/lib/commonjs/web/utils.js.map +0 -1
- package/lib/module/web/convert/breakpoint.js +0 -20
- package/lib/module/web/convert/breakpoint.js.map +0 -1
- package/lib/module/web/createUnistylesComponent.js +0 -54
- package/lib/module/web/createUnistylesComponent.js.map +0 -1
- package/lib/module/web/listener/index.js +0 -5
- package/lib/module/web/listener/index.js.map +0 -1
- package/lib/module/web/listener/listenToDependencies.js +0 -33
- package/lib/module/web/listener/listenToDependencies.js.map +0 -1
- package/lib/module/web/listener/listener.js.map +0 -1
- package/lib/module/web/pseudo.js.map +0 -1
- package/lib/module/web/utils.js.map +0 -1
- package/lib/typescript/src/web/convert/breakpoint.d.ts +0 -3
- package/lib/typescript/src/web/convert/breakpoint.d.ts.map +0 -1
- package/lib/typescript/src/web/createUnistylesComponent.d.ts +0 -3
- package/lib/typescript/src/web/createUnistylesComponent.d.ts.map +0 -1
- package/lib/typescript/src/web/listener/index.d.ts +0 -3
- package/lib/typescript/src/web/listener/index.d.ts.map +0 -1
- package/lib/typescript/src/web/listener/listenToDependencies.d.ts +0 -12
- package/lib/typescript/src/web/listener/listenToDependencies.d.ts.map +0 -1
- package/lib/typescript/src/web/listener/listener.d.ts.map +0 -1
- package/lib/typescript/src/web/pseudo.d.ts.map +0 -1
- package/lib/typescript/src/web/utils.d.ts.map +0 -1
- package/src/web/convert/breakpoint.ts +0 -21
- package/src/web/createUnistylesComponent.tsx +0 -54
- package/src/web/listener/index.ts +0 -2
- package/src/web/listener/listenToDependencies.ts +0 -45
- /package/lib/commonjs/web/{pseudo.js → convert/pseudo.js} +0 -0
- /package/lib/module/web/{pseudo.js → convert/pseudo.js} +0 -0
- /package/lib/typescript/src/web/{pseudo.d.ts → convert/pseudo.d.ts} +0 -0
- /package/nitrogen/generated/android/{UnistylesOnLoad.kt → unistylesOnLoad.kt} +0 -0
- /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
|
55
|
+
private var __implementation: any HybridNativePlatformSpec
|
32
56
|
|
33
57
|
/**
|
34
|
-
*
|
58
|
+
* Create a new `HybridNativePlatformSpecCxx` that wraps the given `HybridNativePlatformSpec`.
|
59
|
+
* All properties and methods bridge to C++ types.
|
35
60
|
*/
|
36
|
-
|
37
|
-
|
38
|
-
|
61
|
+
public init(_ implementation: some HybridNativePlatformSpec) {
|
62
|
+
self.__implementation = implementation
|
63
|
+
/* no base class */
|
39
64
|
}
|
40
65
|
|
41
66
|
/**
|
42
|
-
*
|
43
|
-
* All properties and methods bridge to C++ types.
|
67
|
+
* Get the actual `HybridNativePlatformSpec` instance this class wraps.
|
44
68
|
*/
|
45
|
-
|
46
|
-
|
47
|
-
|
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.
|
80
|
+
return self.__implementation.hybridContext
|
57
81
|
}
|
58
82
|
@inline(__always)
|
59
83
|
set {
|
60
|
-
self.
|
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.
|
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
|
81
|
-
return
|
104
|
+
let __result = try self.__implementation.getInsets()
|
105
|
+
return __result
|
82
106
|
} catch {
|
83
|
-
let
|
84
|
-
fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(
|
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
|
92
|
-
return
|
115
|
+
let __result = try self.__implementation.getColorScheme()
|
116
|
+
return __result.rawValue
|
93
117
|
} catch {
|
94
|
-
let
|
95
|
-
fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(
|
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
|
103
|
-
return
|
126
|
+
let __result = try self.__implementation.getFontScale()
|
127
|
+
return __result
|
104
128
|
} catch {
|
105
|
-
let
|
106
|
-
fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(
|
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
|
114
|
-
return
|
137
|
+
let __result = try self.__implementation.getPixelRatio()
|
138
|
+
return __result
|
115
139
|
} catch {
|
116
|
-
let
|
117
|
-
fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(
|
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
|
125
|
-
return
|
148
|
+
let __result = try self.__implementation.getOrientation()
|
149
|
+
return __result.rawValue
|
126
150
|
} catch {
|
127
|
-
let
|
128
|
-
fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(
|
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
|
136
|
-
return std.string(
|
159
|
+
let __result = try self.__implementation.getContentSizeCategory()
|
160
|
+
return std.string(__result)
|
137
161
|
} catch {
|
138
|
-
let
|
139
|
-
fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(
|
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
|
147
|
-
return
|
170
|
+
let __result = try self.__implementation.getScreenDimensions()
|
171
|
+
return __result
|
148
172
|
} catch {
|
149
|
-
let
|
150
|
-
fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(
|
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
|
158
|
-
return
|
181
|
+
let __result = try self.__implementation.getStatusBarDimensions()
|
182
|
+
return __result
|
159
183
|
} catch {
|
160
|
-
let
|
161
|
-
fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(
|
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
|
169
|
-
return
|
192
|
+
let __result = try self.__implementation.getNavigationBarDimensions()
|
193
|
+
return __result
|
170
194
|
} catch {
|
171
|
-
let
|
172
|
-
fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(
|
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
|
180
|
-
return
|
203
|
+
let __result = try self.__implementation.getPrefersRtlDirection()
|
204
|
+
return __result
|
181
205
|
} catch {
|
182
|
-
let
|
183
|
-
fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(
|
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.
|
191
|
-
return
|
214
|
+
try self.__implementation.setRootViewBackgroundColor(color: color)
|
215
|
+
return
|
192
216
|
} catch {
|
193
|
-
let
|
194
|
-
fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(
|
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.
|
202
|
-
return
|
225
|
+
try self.__implementation.setNavigationBarBackgroundColor(color: color)
|
226
|
+
return
|
203
227
|
} catch {
|
204
|
-
let
|
205
|
-
fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(
|
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.
|
213
|
-
return
|
236
|
+
try self.__implementation.setNavigationBarHidden(isHidden: isHidden)
|
237
|
+
return
|
214
238
|
} catch {
|
215
|
-
let
|
216
|
-
fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(
|
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.
|
224
|
-
return
|
247
|
+
try self.__implementation.setStatusBarHidden(isHidden: isHidden)
|
248
|
+
return
|
225
249
|
} catch {
|
226
|
-
let
|
227
|
-
fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(
|
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.
|
235
|
-
return
|
258
|
+
try self.__implementation.setStatusBarBackgroundColor(color: color)
|
259
|
+
return
|
236
260
|
} catch {
|
237
|
-
let
|
238
|
-
fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(
|
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.
|
246
|
-
return
|
269
|
+
try self.__implementation.setImmersiveMode(isEnabled: isEnabled)
|
270
|
+
return
|
247
271
|
} catch {
|
248
|
-
let
|
249
|
-
fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(
|
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
|
257
|
-
return
|
280
|
+
let __result = try self.__implementation.getMiniRuntime()
|
281
|
+
return __result
|
258
282
|
} catch {
|
259
|
-
let
|
260
|
-
fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(
|
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.
|
268
|
-
let
|
269
|
-
return { (
|
270
|
-
|
271
|
-
var
|
272
|
-
for
|
273
|
-
|
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
|
299
|
+
return __vector
|
276
300
|
}())
|
277
301
|
}
|
278
302
|
}())
|
279
|
-
return
|
303
|
+
return
|
280
304
|
} catch {
|
281
|
-
let
|
282
|
-
fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(
|
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::
|
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::
|
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("
|
18
|
+
prototype.registerHybridGetter("unid", &HybridUnistylesStyleSheetSpec::getUnid);
|
19
19
|
});
|
20
20
|
}
|
21
21
|
|
@@ -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::
|
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::
|
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.
|
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.
|
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.
|
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",
|
package/src/types/stylesheet.ts
CHANGED
@@ -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>)
|
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
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
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
|
package/src/web/convert/index.ts
CHANGED
@@ -1,8 +1,5 @@
|
|
1
|
-
import type { NestedCSSProperties } from 'typestyle/lib/types'
|
2
1
|
import type { UnistylesValues } from '../../types'
|
3
|
-
import {
|
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
|
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
|
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
|
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<
|
68
|
+
}) as Array<Record<string, any>>
|
76
69
|
|
77
70
|
return deepMergeObjects(...stylesArray)
|
78
71
|
}
|