react-native-unistyles 3.0.7 → 3.0.9
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.
- package/README.md +2 -2
- package/cxx/parser/Parser.cpp +6 -0
- package/lib/commonjs/index.js +6 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JColorScheme.hpp +1 -1
- package/nitrogen/generated/android/c++/JFunc_void_UnistylesNativeMiniRuntime.hpp +1 -1
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.hpp +2 -2
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +7 -2
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +2 -0
- 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/ColorScheme.kt +4 -8
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Dimensions.kt +5 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_UnistylesNativeMiniRuntime.kt +1 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.kt +1 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Insets.kt +11 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Orientation.kt +3 -7
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistyleDependency.kt +17 -21
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistylesNativeMiniRuntime.kt +23 -0
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.cpp +2 -2
- package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.hpp +5 -3
- package/nitrogen/generated/ios/swift/Func_void_UnistylesNativeMiniRuntime.swift +1 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.swift +1 -0
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpec.swift +2 -1
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpec_cxx.swift +10 -1
- package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.hpp +2 -2
- package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/UnistyleDependency.hpp +5 -5
- package/nitrogen/generated/shared/c++/UnistylesCxxMiniRuntime.hpp +1 -1
- package/package.json +3 -3
- package/src/index.ts +1 -1
package/README.md
CHANGED
@@ -21,14 +21,14 @@ yarn add react-native-unistyles
|
|
21
21
|
Install dependencies:
|
22
22
|
|
23
23
|
```shell
|
24
|
-
yarn add react-native-edge-to-edge react-native-nitro-modules@0.
|
24
|
+
yarn add react-native-edge-to-edge react-native-nitro-modules@0.27.5
|
25
25
|
```
|
26
26
|
|
27
27
|
> To avoid unexpected behavior, always use a fixed version of `react-native-nitro-modules`
|
28
28
|
|
29
29
|
| react-native-unistyles | react-native-nitro-modules |
|
30
30
|
|------------------------|----------------------------|
|
31
|
-
| 3.0.0 | 0.
|
31
|
+
| 3.0.0 | 0.27.5 |
|
32
32
|
|
33
33
|
Then follow [installation guides](https://unistyl.es/v3/start/getting-started) for your platform.
|
34
34
|
|
package/cxx/parser/Parser.cpp
CHANGED
@@ -437,6 +437,12 @@ jsi::Object parser::Parser::parseFirstLevel(jsi::Runtime& rt, Unistyle::Shared u
|
|
437
437
|
|
438
438
|
return;
|
439
439
|
}
|
440
|
+
|
441
|
+
if (propertyValue.isBool() && propertyName == "includeFontPadding") {
|
442
|
+
parsedStyle.setProperty(rt, jsi::PropNameID::forUtf8(rt, propertyName), propertyValue);
|
443
|
+
|
444
|
+
return;
|
445
|
+
}
|
440
446
|
|
441
447
|
// at this point ignore non objects
|
442
448
|
if (!propertyValue.isObject()) {
|
package/lib/commonjs/index.js
CHANGED
@@ -45,6 +45,12 @@ Object.defineProperty(exports, "UnistylesRuntime", {
|
|
45
45
|
return _specs.UnistylesRuntime;
|
46
46
|
}
|
47
47
|
});
|
48
|
+
Object.defineProperty(exports, "createUnistylesElement", {
|
49
|
+
enumerable: true,
|
50
|
+
get: function () {
|
51
|
+
return _core.createUnistylesElement;
|
52
|
+
}
|
53
|
+
});
|
48
54
|
Object.defineProperty(exports, "getServerUnistyles", {
|
49
55
|
enumerable: true,
|
50
56
|
get: function () {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_specs","_mq","_core","_components","_server","e","__esModule","default","majorReactVersions","React","version","split","map","Number","parseInt","undefined","Error"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_specs","_mq","_core","_components","_server","e","__esModule","default","majorReactVersions","React","version","split","map","Number","parseInt","undefined","Error"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAQA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,GAAA,GAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAH,OAAA;AAEA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAA+G,SAAAD,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAZ/G,MAAM,CAACG,kBAAkB,CAAC,GAAGC,cAAK,CAACC,OAAO,CAACC,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAACC,MAAM,CAACC,QAAQ,CAAC;AAE1E,IAAIN,kBAAkB,KAAKO,SAAS,IAAIP,kBAAkB,GAAG,EAAE,EAAE;EAC7D,MAAM,IAAIQ,KAAK,CAAC,kFAAkF,CAAC;AACvG","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
@@ -7,7 +7,7 @@ if (majorReactVersions === undefined || majorReactVersions < 19) {
|
|
7
7
|
}
|
8
8
|
export { StyleSheet, UnistylesRuntime, StatusBar, NavigationBar } from './specs';
|
9
9
|
export { mq } from './mq';
|
10
|
-
export { withUnistyles, useUnistyles } from './core';
|
10
|
+
export { withUnistyles, useUnistyles, createUnistylesElement } from './core';
|
11
11
|
export { Display, Hide, ScopedTheme } from './components';
|
12
12
|
export { useServerUnistyles, hydrateServerUnistyles, getServerUnistyles, resetServerUnistyles } from './server';
|
13
13
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","majorReactVersions","version","split","map","Number","parseInt","undefined","Error","StyleSheet","UnistylesRuntime","StatusBar","NavigationBar","mq","withUnistyles","useUnistyles","Display","Hide","ScopedTheme","useServerUnistyles","hydrateServerUnistyles","getServerUnistyles","resetServerUnistyles"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAM,CAACC,kBAAkB,CAAC,GAAGD,KAAK,CAACE,OAAO,CAACC,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAACC,MAAM,CAACC,QAAQ,CAAC;AAE1E,IAAIL,kBAAkB,KAAKM,SAAS,IAAIN,kBAAkB,GAAG,EAAE,EAAE;EAC7D,MAAM,IAAIO,KAAK,CAAC,kFAAkF,CAAC;AACvG;AAEA,SAASC,UAAU,EAAEC,gBAAgB,EAAEC,SAAS,EAAEC,aAAa,QAAQ,SAAS;AAChF,SAASC,EAAE,QAAQ,MAAM;AAEzB,SAASC,aAAa,EAAEC,YAAY,QAAQ,QAAQ;
|
1
|
+
{"version":3,"names":["React","majorReactVersions","version","split","map","Number","parseInt","undefined","Error","StyleSheet","UnistylesRuntime","StatusBar","NavigationBar","mq","withUnistyles","useUnistyles","createUnistylesElement","Display","Hide","ScopedTheme","useServerUnistyles","hydrateServerUnistyles","getServerUnistyles","resetServerUnistyles"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAM,CAACC,kBAAkB,CAAC,GAAGD,KAAK,CAACE,OAAO,CAACC,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAACC,MAAM,CAACC,QAAQ,CAAC;AAE1E,IAAIL,kBAAkB,KAAKM,SAAS,IAAIN,kBAAkB,GAAG,EAAE,EAAE;EAC7D,MAAM,IAAIO,KAAK,CAAC,kFAAkF,CAAC;AACvG;AAEA,SAASC,UAAU,EAAEC,gBAAgB,EAAEC,SAAS,EAAEC,aAAa,QAAQ,SAAS;AAChF,SAASC,EAAE,QAAQ,MAAM;AAEzB,SAASC,aAAa,EAAEC,YAAY,EAAEC,sBAAsB,QAAQ,QAAQ;AAE5E,SAASC,OAAO,EAAEC,IAAI,EAAEC,WAAW,QAAQ,cAAc;AACzD,SAASC,kBAAkB,EAAEC,sBAAsB,EAAEC,kBAAkB,EAAEC,oBAAoB,QAAQ,UAAU","ignoreList":[]}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
export { StyleSheet, UnistylesRuntime, StatusBar, NavigationBar } from './specs';
|
2
2
|
export { mq } from './mq';
|
3
3
|
export type { UnistylesThemes, UnistylesBreakpoints } from './global';
|
4
|
-
export { withUnistyles, useUnistyles } from './core';
|
4
|
+
export { withUnistyles, useUnistyles, createUnistylesElement } from './core';
|
5
5
|
export type { UnistylesVariants } from './types';
|
6
6
|
export { Display, Hide, ScopedTheme } from './components';
|
7
7
|
export { useServerUnistyles, hydrateServerUnistyles, getServerUnistyles, resetServerUnistyles } from './server';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAChF,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAA;AACzB,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAChF,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAA;AACzB,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAA;AAC5E,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA"}
|
@@ -29,7 +29,7 @@ namespace margelo::nitro::unistyles {
|
|
29
29
|
[[nodiscard]]
|
30
30
|
ColorScheme toCpp() const {
|
31
31
|
static const auto clazz = javaClassStatic();
|
32
|
-
static const auto fieldOrdinal = clazz->getField<int>("
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("value");
|
33
33
|
int ordinal = this->getFieldValue(fieldOrdinal);
|
34
34
|
return static_cast<ColorScheme>(ordinal);
|
35
35
|
}
|
@@ -10,8 +10,8 @@
|
|
10
10
|
#include <fbjni/fbjni.h>
|
11
11
|
#include <functional>
|
12
12
|
|
13
|
-
#include <functional>
|
14
13
|
#include "UnistylesNativeMiniRuntime.hpp"
|
14
|
+
#include <functional>
|
15
15
|
#include "JUnistylesNativeMiniRuntime.hpp"
|
16
16
|
#include "ColorScheme.hpp"
|
17
17
|
#include "JColorScheme.hpp"
|
@@ -10,10 +10,10 @@
|
|
10
10
|
#include <fbjni/fbjni.h>
|
11
11
|
#include <functional>
|
12
12
|
|
13
|
-
#include <functional>
|
14
|
-
#include <vector>
|
15
13
|
#include "UnistyleDependency.hpp"
|
14
|
+
#include <vector>
|
16
15
|
#include "UnistylesNativeMiniRuntime.hpp"
|
16
|
+
#include <functional>
|
17
17
|
#include "JUnistyleDependency.hpp"
|
18
18
|
#include "JUnistylesNativeMiniRuntime.hpp"
|
19
19
|
#include "ColorScheme.hpp"
|
@@ -31,9 +31,9 @@ namespace margelo::nitro::unistyles { enum class UnistyleDependency; }
|
|
31
31
|
#include "JDimensions.hpp"
|
32
32
|
#include "UnistylesNativeMiniRuntime.hpp"
|
33
33
|
#include "JUnistylesNativeMiniRuntime.hpp"
|
34
|
-
#include <functional>
|
35
|
-
#include <vector>
|
36
34
|
#include "UnistyleDependency.hpp"
|
35
|
+
#include <vector>
|
36
|
+
#include <functional>
|
37
37
|
#include "JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.hpp"
|
38
38
|
#include "JUnistyleDependency.hpp"
|
39
39
|
#include "JFunc_void_UnistylesNativeMiniRuntime.hpp"
|
@@ -55,6 +55,11 @@ namespace margelo::nitro::unistyles {
|
|
55
55
|
return method(_javaPart);
|
56
56
|
}
|
57
57
|
|
58
|
+
void JHybridNativePlatformSpec::dispose() noexcept {
|
59
|
+
static const auto method = javaClassStatic()->getMethod<void()>("dispose");
|
60
|
+
method(_javaPart);
|
61
|
+
}
|
62
|
+
|
58
63
|
// Properties
|
59
64
|
|
60
65
|
|
@@ -29,6 +29,7 @@ namespace margelo::nitro::unistyles {
|
|
29
29
|
// C++ constructor (called from Java via `initHybrid()`)
|
30
30
|
explicit JHybridNativePlatformSpec(jni::alias_ref<jhybridobject> jThis) :
|
31
31
|
HybridObject(HybridNativePlatformSpec::TAG),
|
32
|
+
HybridBase(jThis),
|
32
33
|
_javaPart(jni::make_global(jThis)) {}
|
33
34
|
|
34
35
|
public:
|
@@ -39,6 +40,7 @@ namespace margelo::nitro::unistyles {
|
|
39
40
|
|
40
41
|
public:
|
41
42
|
size_t getExternalMemorySize() noexcept override;
|
43
|
+
void dispose() noexcept override;
|
42
44
|
|
43
45
|
public:
|
44
46
|
inline const jni::global_ref<JHybridNativePlatformSpec::javaobject>& getJavaPart() const noexcept {
|
@@ -29,7 +29,7 @@ namespace margelo::nitro::unistyles {
|
|
29
29
|
[[nodiscard]]
|
30
30
|
Orientation toCpp() const {
|
31
31
|
static const auto clazz = javaClassStatic();
|
32
|
-
static const auto fieldOrdinal = clazz->getField<int>("
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("value");
|
33
33
|
int ordinal = this->getFieldValue(fieldOrdinal);
|
34
34
|
return static_cast<Orientation>(ordinal);
|
35
35
|
}
|
@@ -29,7 +29,7 @@ namespace margelo::nitro::unistyles {
|
|
29
29
|
[[nodiscard]]
|
30
30
|
UnistyleDependency toCpp() const {
|
31
31
|
static const auto clazz = javaClassStatic();
|
32
|
-
static const auto fieldOrdinal = clazz->getField<int>("
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("value");
|
33
33
|
int ordinal = this->getFieldValue(fieldOrdinal);
|
34
34
|
return static_cast<UnistyleDependency>(ordinal);
|
35
35
|
}
|
@@ -15,12 +15,8 @@ import com.facebook.proguard.annotations.DoNotStrip
|
|
15
15
|
*/
|
16
16
|
@DoNotStrip
|
17
17
|
@Keep
|
18
|
-
enum class ColorScheme {
|
19
|
-
DARK,
|
20
|
-
LIGHT,
|
21
|
-
UNSPECIFIED;
|
22
|
-
|
23
|
-
@DoNotStrip
|
24
|
-
@Keep
|
25
|
-
private val _ordinal = ordinal
|
18
|
+
enum class ColorScheme(@DoNotStrip @Keep val value: Int) {
|
19
|
+
DARK(0),
|
20
|
+
LIGHT(1),
|
21
|
+
UNSPECIFIED(2);
|
26
22
|
}
|
@@ -11,6 +11,7 @@ import androidx.annotation.Keep
|
|
11
11
|
import com.facebook.proguard.annotations.DoNotStrip
|
12
12
|
import com.margelo.nitro.core.*
|
13
13
|
|
14
|
+
|
14
15
|
/**
|
15
16
|
* Represents the JavaScript object/struct "Dimensions".
|
16
17
|
*/
|
@@ -20,7 +21,11 @@ data class Dimensions
|
|
20
21
|
@DoNotStrip
|
21
22
|
@Keep
|
22
23
|
constructor(
|
24
|
+
@DoNotStrip
|
25
|
+
@Keep
|
23
26
|
val width: Double,
|
27
|
+
@DoNotStrip
|
28
|
+
@Keep
|
24
29
|
val height: Double
|
25
30
|
) {
|
26
31
|
/* main constructor */
|
@@ -13,6 +13,7 @@ import com.facebook.proguard.annotations.DoNotStrip
|
|
13
13
|
import com.margelo.nitro.core.*
|
14
14
|
import dalvik.annotation.optimization.FastNative
|
15
15
|
|
16
|
+
|
16
17
|
/**
|
17
18
|
* Represents the JavaScript callback `(miniRuntime: struct) => void`.
|
18
19
|
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
@@ -13,6 +13,7 @@ import com.facebook.proguard.annotations.DoNotStrip
|
|
13
13
|
import com.margelo.nitro.core.*
|
14
14
|
import dalvik.annotation.optimization.FastNative
|
15
15
|
|
16
|
+
|
16
17
|
/**
|
17
18
|
* Represents the JavaScript callback `(dependencies: array, miniRuntime: struct) => void`.
|
18
19
|
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
@@ -11,6 +11,7 @@ import androidx.annotation.Keep
|
|
11
11
|
import com.facebook.proguard.annotations.DoNotStrip
|
12
12
|
import com.margelo.nitro.core.*
|
13
13
|
|
14
|
+
|
14
15
|
/**
|
15
16
|
* Represents the JavaScript object/struct "Insets".
|
16
17
|
*/
|
@@ -20,10 +21,20 @@ data class Insets
|
|
20
21
|
@DoNotStrip
|
21
22
|
@Keep
|
22
23
|
constructor(
|
24
|
+
@DoNotStrip
|
25
|
+
@Keep
|
23
26
|
val top: Double,
|
27
|
+
@DoNotStrip
|
28
|
+
@Keep
|
24
29
|
val bottom: Double,
|
30
|
+
@DoNotStrip
|
31
|
+
@Keep
|
25
32
|
val left: Double,
|
33
|
+
@DoNotStrip
|
34
|
+
@Keep
|
26
35
|
val right: Double,
|
36
|
+
@DoNotStrip
|
37
|
+
@Keep
|
27
38
|
val ime: Double
|
28
39
|
) {
|
29
40
|
/* main constructor */
|
@@ -15,11 +15,7 @@ import com.facebook.proguard.annotations.DoNotStrip
|
|
15
15
|
*/
|
16
16
|
@DoNotStrip
|
17
17
|
@Keep
|
18
|
-
enum class Orientation {
|
19
|
-
PORTRAIT,
|
20
|
-
LANDSCAPE;
|
21
|
-
|
22
|
-
@DoNotStrip
|
23
|
-
@Keep
|
24
|
-
private val _ordinal = ordinal
|
18
|
+
enum class Orientation(@DoNotStrip @Keep val value: Int) {
|
19
|
+
PORTRAIT(0),
|
20
|
+
LANDSCAPE(1);
|
25
21
|
}
|
@@ -15,25 +15,21 @@ import com.facebook.proguard.annotations.DoNotStrip
|
|
15
15
|
*/
|
16
16
|
@DoNotStrip
|
17
17
|
@Keep
|
18
|
-
enum class UnistyleDependency {
|
19
|
-
THEME,
|
20
|
-
THEMENAME,
|
21
|
-
ADAPTIVETHEMES,
|
22
|
-
BREAKPOINTS,
|
23
|
-
VARIANTS,
|
24
|
-
COLORSCHEME,
|
25
|
-
DIMENSIONS,
|
26
|
-
ORIENTATION,
|
27
|
-
CONTENTSIZECATEGORY,
|
28
|
-
INSETS,
|
29
|
-
PIXELRATIO,
|
30
|
-
FONTSCALE,
|
31
|
-
STATUSBAR,
|
32
|
-
NAVIGATIONBAR,
|
33
|
-
IME,
|
34
|
-
RTL;
|
35
|
-
|
36
|
-
@DoNotStrip
|
37
|
-
@Keep
|
38
|
-
private val _ordinal = ordinal
|
18
|
+
enum class UnistyleDependency(@DoNotStrip @Keep val value: Int) {
|
19
|
+
THEME(0),
|
20
|
+
THEMENAME(1),
|
21
|
+
ADAPTIVETHEMES(2),
|
22
|
+
BREAKPOINTS(3),
|
23
|
+
VARIANTS(4),
|
24
|
+
COLORSCHEME(5),
|
25
|
+
DIMENSIONS(6),
|
26
|
+
ORIENTATION(7),
|
27
|
+
CONTENTSIZECATEGORY(8),
|
28
|
+
INSETS(9),
|
29
|
+
PIXELRATIO(10),
|
30
|
+
FONTSCALE(11),
|
31
|
+
STATUSBAR(12),
|
32
|
+
NAVIGATIONBAR(13),
|
33
|
+
IME(14),
|
34
|
+
RTL(15);
|
39
35
|
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistylesNativeMiniRuntime.kt
CHANGED
@@ -11,6 +11,7 @@ import androidx.annotation.Keep
|
|
11
11
|
import com.facebook.proguard.annotations.DoNotStrip
|
12
12
|
import com.margelo.nitro.core.*
|
13
13
|
|
14
|
+
|
14
15
|
/**
|
15
16
|
* Represents the JavaScript object/struct "UnistylesNativeMiniRuntime".
|
16
17
|
*/
|
@@ -20,16 +21,38 @@ data class UnistylesNativeMiniRuntime
|
|
20
21
|
@DoNotStrip
|
21
22
|
@Keep
|
22
23
|
constructor(
|
24
|
+
@DoNotStrip
|
25
|
+
@Keep
|
23
26
|
val colorScheme: ColorScheme,
|
27
|
+
@DoNotStrip
|
28
|
+
@Keep
|
24
29
|
val screen: Dimensions,
|
30
|
+
@DoNotStrip
|
31
|
+
@Keep
|
25
32
|
val contentSizeCategory: String,
|
33
|
+
@DoNotStrip
|
34
|
+
@Keep
|
26
35
|
val insets: Insets,
|
36
|
+
@DoNotStrip
|
37
|
+
@Keep
|
27
38
|
val pixelRatio: Double,
|
39
|
+
@DoNotStrip
|
40
|
+
@Keep
|
28
41
|
val fontScale: Double,
|
42
|
+
@DoNotStrip
|
43
|
+
@Keep
|
29
44
|
val rtl: Boolean,
|
45
|
+
@DoNotStrip
|
46
|
+
@Keep
|
30
47
|
val statusBar: Dimensions,
|
48
|
+
@DoNotStrip
|
49
|
+
@Keep
|
31
50
|
val navigationBar: Dimensions,
|
51
|
+
@DoNotStrip
|
52
|
+
@Keep
|
32
53
|
val isPortrait: Boolean,
|
54
|
+
@DoNotStrip
|
55
|
+
@Keep
|
33
56
|
val isLandscape: Boolean
|
34
57
|
) {
|
35
58
|
/* main constructor */
|
@@ -36,11 +36,11 @@ namespace margelo::nitro::unistyles::bridge::swift {
|
|
36
36
|
}
|
37
37
|
void* _Nonnull get_std__shared_ptr_margelo__nitro__unistyles__HybridNativePlatformSpec_(std__shared_ptr_margelo__nitro__unistyles__HybridNativePlatformSpec_ cppType) {
|
38
38
|
std::shared_ptr<margelo::nitro::unistyles::HybridNativePlatformSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::unistyles::HybridNativePlatformSpecSwift>(cppType);
|
39
|
-
|
39
|
+
#ifdef NITRO_DEBUG
|
40
40
|
if (swiftWrapper == nullptr) [[unlikely]] {
|
41
41
|
throw std::runtime_error("Class \"HybridNativePlatformSpec\" is not implemented in Swift!");
|
42
42
|
}
|
43
|
-
|
43
|
+
#endif
|
44
44
|
Unistyles::HybridNativePlatformSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
45
45
|
return swiftPart.toUnsafe();
|
46
46
|
}
|
@@ -31,9 +31,9 @@ namespace margelo::nitro::unistyles { enum class UnistyleDependency; }
|
|
31
31
|
#include <string>
|
32
32
|
#include "Dimensions.hpp"
|
33
33
|
#include "UnistylesNativeMiniRuntime.hpp"
|
34
|
-
#include <functional>
|
35
|
-
#include <vector>
|
36
34
|
#include "UnistyleDependency.hpp"
|
35
|
+
#include <vector>
|
36
|
+
#include <functional>
|
37
37
|
|
38
38
|
#include "Unistyles-Swift-Cxx-Umbrella.hpp"
|
39
39
|
|
@@ -63,10 +63,12 @@ namespace margelo::nitro::unistyles {
|
|
63
63
|
}
|
64
64
|
|
65
65
|
public:
|
66
|
-
// Get memory pressure
|
67
66
|
inline size_t getExternalMemorySize() noexcept override {
|
68
67
|
return _swiftPart.getMemorySize();
|
69
68
|
}
|
69
|
+
void dispose() noexcept override {
|
70
|
+
_swiftPart.dispose();
|
71
|
+
}
|
70
72
|
|
71
73
|
public:
|
72
74
|
// Properties
|
@@ -35,8 +35,9 @@ public protocol HybridNativePlatformSpec_protocol: HybridObject {
|
|
35
35
|
}
|
36
36
|
|
37
37
|
/// See ``HybridNativePlatformSpec``
|
38
|
-
|
38
|
+
open class HybridNativePlatformSpec_base {
|
39
39
|
private weak var cxxWrapper: HybridNativePlatformSpec_cxx? = nil
|
40
|
+
public init() { }
|
40
41
|
public func getCxxWrapper() -> HybridNativePlatformSpec_cxx {
|
41
42
|
#if DEBUG
|
42
43
|
guard self is HybridNativePlatformSpec else {
|
@@ -17,7 +17,7 @@ import NitroModules
|
|
17
17
|
* - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
|
18
18
|
* - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
|
19
19
|
*/
|
20
|
-
|
20
|
+
open class HybridNativePlatformSpec_cxx {
|
21
21
|
/**
|
22
22
|
* The Swift <> C++ bridge's namespace (`margelo::nitro::unistyles::bridge::swift`)
|
23
23
|
* from `Unistyles-Swift-Cxx-Bridge.hpp`.
|
@@ -96,6 +96,15 @@ public class HybridNativePlatformSpec_cxx {
|
|
96
96
|
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
97
97
|
}
|
98
98
|
|
99
|
+
/**
|
100
|
+
* Call dispose() on the Swift class.
|
101
|
+
* This _may_ be called manually from JS.
|
102
|
+
*/
|
103
|
+
@inline(__always)
|
104
|
+
public func dispose() {
|
105
|
+
self.__implementation.dispose()
|
106
|
+
}
|
107
|
+
|
99
108
|
// Properties
|
100
109
|
|
101
110
|
|
@@ -32,9 +32,9 @@ namespace margelo::nitro::unistyles { enum class UnistyleDependency; }
|
|
32
32
|
#include <string>
|
33
33
|
#include "Dimensions.hpp"
|
34
34
|
#include "UnistylesNativeMiniRuntime.hpp"
|
35
|
-
#include <functional>
|
36
|
-
#include <vector>
|
37
35
|
#include "UnistyleDependency.hpp"
|
36
|
+
#include <vector>
|
37
|
+
#include <functional>
|
38
38
|
|
39
39
|
namespace margelo::nitro::unistyles {
|
40
40
|
|
@@ -26,8 +26,8 @@ namespace margelo::nitro::unistyles { struct UnistylesCxxMiniRuntime; }
|
|
26
26
|
|
27
27
|
#include "ColorScheme.hpp"
|
28
28
|
#include "Dimensions.hpp"
|
29
|
-
#include <optional>
|
30
29
|
#include <string>
|
30
|
+
#include <optional>
|
31
31
|
#include <unordered_map>
|
32
32
|
#include "Insets.hpp"
|
33
33
|
#include "Orientation.hpp"
|
@@ -7,7 +7,6 @@
|
|
7
7
|
|
8
8
|
#pragma once
|
9
9
|
|
10
|
-
#include <cmath>
|
11
10
|
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
12
11
|
#include <NitroModules/JSIConverter.hpp>
|
13
12
|
#else
|
@@ -64,10 +63,11 @@ namespace margelo::nitro {
|
|
64
63
|
if (!value.isNumber()) {
|
65
64
|
return false;
|
66
65
|
}
|
67
|
-
double
|
68
|
-
|
69
|
-
if (
|
70
|
-
//
|
66
|
+
double number = value.getNumber();
|
67
|
+
int integer = static_cast<int>(number);
|
68
|
+
if (number != integer) {
|
69
|
+
// The integer is not the same value as the double - we truncated floating points.
|
70
|
+
// Enums are all integers, so the input floating point number is obviously invalid.
|
71
71
|
return false;
|
72
72
|
}
|
73
73
|
// Check if we are within the bounds of the enum.
|
@@ -25,8 +25,8 @@ namespace margelo::nitro::unistyles { struct Dimensions; }
|
|
25
25
|
// Forward declaration of `Insets` to properly resolve imports.
|
26
26
|
namespace margelo::nitro::unistyles { struct Insets; }
|
27
27
|
|
28
|
-
#include <optional>
|
29
28
|
#include <string>
|
29
|
+
#include <optional>
|
30
30
|
#include "ColorScheme.hpp"
|
31
31
|
#include "Dimensions.hpp"
|
32
32
|
#include "Insets.hpp"
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "react-native-unistyles",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.9",
|
4
4
|
"description": "Level up your React Native StyleSheet",
|
5
5
|
"scripts": {
|
6
6
|
"test": "NODE_ENV=babel-test jest ./plugin",
|
@@ -148,11 +148,11 @@
|
|
148
148
|
"husky": "9.1.7",
|
149
149
|
"jest": "29.7.0",
|
150
150
|
"metro-react-native-babel-preset": "0.77.0",
|
151
|
-
"nitro-codegen": "0.
|
151
|
+
"nitro-codegen": "0.27.5",
|
152
152
|
"react": "19.1.0",
|
153
153
|
"react-native": "0.79.2",
|
154
154
|
"react-native-builder-bob": "0.40.10",
|
155
|
-
"react-native-nitro-modules": "0.
|
155
|
+
"react-native-nitro-modules": "0.27.5",
|
156
156
|
"react-native-reanimated": "3.17.5",
|
157
157
|
"react-native-web": "0.20.0",
|
158
158
|
"react-test-renderer": "19.1.0",
|
package/src/index.ts
CHANGED
@@ -9,7 +9,7 @@ if (majorReactVersions === undefined || majorReactVersions < 19) {
|
|
9
9
|
export { StyleSheet, UnistylesRuntime, StatusBar, NavigationBar } from './specs'
|
10
10
|
export { mq } from './mq'
|
11
11
|
export type { UnistylesThemes, UnistylesBreakpoints } from './global'
|
12
|
-
export { withUnistyles, useUnistyles } from './core'
|
12
|
+
export { withUnistyles, useUnistyles, createUnistylesElement } from './core'
|
13
13
|
export type { UnistylesVariants } from './types'
|
14
14
|
export { Display, Hide, ScopedTheme } from './components'
|
15
15
|
export { useServerUnistyles, hydrateServerUnistyles, getServerUnistyles, resetServerUnistyles } from './server'
|