react-native-unistyles 3.0.19 → 3.0.21
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 +11 -11
- package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +1 -1
- package/cxx/hybridObjects/HybridStyleSheet.cpp +3 -0
- package/ios/Equatable.swift +11 -18
- package/ios/NativePlatform+keyboard.swift +23 -1
- package/lib/typescript/src/types/breakpoints.d.ts +12 -6
- package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JColorScheme.hpp +4 -5
- package/nitrogen/generated/android/c++/JDimensions.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 +1 -1
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +1 -1
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +1 -1
- package/nitrogen/generated/android/c++/JInsets.hpp +1 -1
- package/nitrogen/generated/android/c++/JOrientation.hpp +3 -4
- package/nitrogen/generated/android/c++/JUnistyleDependency.hpp +17 -18
- package/nitrogen/generated/android/c++/JUnistylesNativeMiniRuntime.hpp +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/ColorScheme.kt +3 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Dimensions.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_UnistylesNativeMiniRuntime.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Insets.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Orientation.kt +3 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistyleDependency.kt +3 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistylesNativeMiniRuntime.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/unistylesOnLoad.kt +1 -1
- package/nitrogen/generated/android/unistyles+autolinking.cmake +1 -1
- package/nitrogen/generated/android/unistyles+autolinking.gradle +1 -1
- package/nitrogen/generated/android/unistylesOnLoad.cpp +1 -1
- package/nitrogen/generated/android/unistylesOnLoad.hpp +1 -1
- package/nitrogen/generated/ios/Unistyles+autolinking.rb +2 -2
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.cpp +1 -1
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.hpp +1 -1
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Umbrella.hpp +1 -1
- package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.cpp +1 -1
- package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.hpp +1 -1
- package/nitrogen/generated/ios/swift/ColorScheme.swift +1 -1
- package/nitrogen/generated/ios/swift/Dimensions.swift +5 -17
- package/nitrogen/generated/ios/swift/Func_void_UnistylesNativeMiniRuntime.swift +1 -1
- package/nitrogen/generated/ios/swift/Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpec.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpec_cxx.swift +1 -1
- package/nitrogen/generated/ios/swift/Insets.swift +11 -41
- package/nitrogen/generated/ios/swift/Orientation.swift +1 -1
- package/nitrogen/generated/ios/swift/UnistyleDependency.swift +1 -1
- package/nitrogen/generated/ios/swift/UnistylesNativeMiniRuntime.swift +23 -89
- package/nitrogen/generated/shared/c++/ColorScheme.hpp +1 -1
- package/nitrogen/generated/shared/c++/Dimensions.hpp +16 -8
- package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesShadowRegistrySpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesShadowRegistrySpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/Insets.hpp +25 -17
- package/nitrogen/generated/shared/c++/Orientation.hpp +1 -1
- package/nitrogen/generated/shared/c++/UnistyleDependency.hpp +1 -1
- package/nitrogen/generated/shared/c++/UnistylesCxxMiniRuntime.hpp +52 -44
- package/nitrogen/generated/shared/c++/UnistylesNativeMiniRuntime.hpp +43 -35
- package/package.json +3 -3
- package/src/types/breakpoints.ts +40 -20
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// Insets.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -22,6 +22,11 @@
|
|
|
22
22
|
#else
|
|
23
23
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
24
|
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
25
30
|
|
|
26
31
|
|
|
27
32
|
|
|
@@ -32,7 +37,7 @@ namespace margelo::nitro::unistyles {
|
|
|
32
37
|
/**
|
|
33
38
|
* A struct which can be represented as a JavaScript object (Insets).
|
|
34
39
|
*/
|
|
35
|
-
struct Insets {
|
|
40
|
+
struct Insets final {
|
|
36
41
|
public:
|
|
37
42
|
double top SWIFT_PRIVATE;
|
|
38
43
|
double bottom SWIFT_PRIVATE;
|
|
@@ -43,6 +48,9 @@ namespace margelo::nitro::unistyles {
|
|
|
43
48
|
public:
|
|
44
49
|
Insets() = default;
|
|
45
50
|
explicit Insets(double top, double bottom, double left, double right, double ime): top(top), bottom(bottom), left(left), right(right), ime(ime) {}
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
friend bool operator==(const Insets& lhs, const Insets& rhs) = default;
|
|
46
54
|
};
|
|
47
55
|
|
|
48
56
|
} // namespace margelo::nitro::unistyles
|
|
@@ -55,20 +63,20 @@ namespace margelo::nitro {
|
|
|
55
63
|
static inline margelo::nitro::unistyles::Insets fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
56
64
|
jsi::Object obj = arg.asObject(runtime);
|
|
57
65
|
return margelo::nitro::unistyles::Insets(
|
|
58
|
-
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "top")),
|
|
59
|
-
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "bottom")),
|
|
60
|
-
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "left")),
|
|
61
|
-
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "right")),
|
|
62
|
-
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "ime"))
|
|
66
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "top"))),
|
|
67
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bottom"))),
|
|
68
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "left"))),
|
|
69
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "right"))),
|
|
70
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "ime")))
|
|
63
71
|
);
|
|
64
72
|
}
|
|
65
73
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::unistyles::Insets& arg) {
|
|
66
74
|
jsi::Object obj(runtime);
|
|
67
|
-
obj.setProperty(runtime, "top", JSIConverter<double>::toJSI(runtime, arg.top));
|
|
68
|
-
obj.setProperty(runtime, "bottom", JSIConverter<double>::toJSI(runtime, arg.bottom));
|
|
69
|
-
obj.setProperty(runtime, "left", JSIConverter<double>::toJSI(runtime, arg.left));
|
|
70
|
-
obj.setProperty(runtime, "right", JSIConverter<double>::toJSI(runtime, arg.right));
|
|
71
|
-
obj.setProperty(runtime, "ime", JSIConverter<double>::toJSI(runtime, arg.ime));
|
|
75
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "top"), JSIConverter<double>::toJSI(runtime, arg.top));
|
|
76
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "bottom"), JSIConverter<double>::toJSI(runtime, arg.bottom));
|
|
77
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "left"), JSIConverter<double>::toJSI(runtime, arg.left));
|
|
78
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "right"), JSIConverter<double>::toJSI(runtime, arg.right));
|
|
79
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "ime"), JSIConverter<double>::toJSI(runtime, arg.ime));
|
|
72
80
|
return obj;
|
|
73
81
|
}
|
|
74
82
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -79,11 +87,11 @@ namespace margelo::nitro {
|
|
|
79
87
|
if (!nitro::isPlainObject(runtime, obj)) {
|
|
80
88
|
return false;
|
|
81
89
|
}
|
|
82
|
-
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "top"))) return false;
|
|
83
|
-
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "bottom"))) return false;
|
|
84
|
-
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "left"))) return false;
|
|
85
|
-
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "right"))) return false;
|
|
86
|
-
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "ime"))) return false;
|
|
90
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "top")))) return false;
|
|
91
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bottom")))) return false;
|
|
92
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "left")))) return false;
|
|
93
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "right")))) return false;
|
|
94
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "ime")))) return false;
|
|
87
95
|
return true;
|
|
88
96
|
}
|
|
89
97
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// UnistylesCxxMiniRuntime.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -22,6 +22,11 @@
|
|
|
22
22
|
#else
|
|
23
23
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
24
|
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
25
30
|
|
|
26
31
|
// Forward declaration of `ColorScheme` to properly resolve imports.
|
|
27
32
|
namespace margelo::nitro::unistyles { enum class ColorScheme; }
|
|
@@ -41,7 +46,7 @@ namespace margelo::nitro::unistyles {
|
|
|
41
46
|
/**
|
|
42
47
|
* A struct which can be represented as a JavaScript object (UnistylesCxxMiniRuntime).
|
|
43
48
|
*/
|
|
44
|
-
struct UnistylesCxxMiniRuntime {
|
|
49
|
+
struct UnistylesCxxMiniRuntime final {
|
|
45
50
|
public:
|
|
46
51
|
std::optional<std::string> themeName SWIFT_PRIVATE;
|
|
47
52
|
std::optional<std::string> breakpoint SWIFT_PRIVATE;
|
|
@@ -61,6 +66,9 @@ namespace margelo::nitro::unistyles {
|
|
|
61
66
|
public:
|
|
62
67
|
UnistylesCxxMiniRuntime() = default;
|
|
63
68
|
explicit UnistylesCxxMiniRuntime(std::optional<std::string> themeName, std::optional<std::string> breakpoint, bool hasAdaptiveThemes, ColorScheme colorScheme, Dimensions screen, std::string contentSizeCategory, Insets insets, double pixelRatio, double fontScale, bool rtl, Dimensions statusBar, Dimensions navigationBar, bool isPortrait, bool isLandscape): themeName(themeName), breakpoint(breakpoint), hasAdaptiveThemes(hasAdaptiveThemes), colorScheme(colorScheme), screen(screen), contentSizeCategory(contentSizeCategory), insets(insets), pixelRatio(pixelRatio), fontScale(fontScale), rtl(rtl), statusBar(statusBar), navigationBar(navigationBar), isPortrait(isPortrait), isLandscape(isLandscape) {}
|
|
69
|
+
|
|
70
|
+
public:
|
|
71
|
+
friend bool operator==(const UnistylesCxxMiniRuntime& lhs, const UnistylesCxxMiniRuntime& rhs) = default;
|
|
64
72
|
};
|
|
65
73
|
|
|
66
74
|
} // namespace margelo::nitro::unistyles
|
|
@@ -73,38 +81,38 @@ namespace margelo::nitro {
|
|
|
73
81
|
static inline margelo::nitro::unistyles::UnistylesCxxMiniRuntime fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
74
82
|
jsi::Object obj = arg.asObject(runtime);
|
|
75
83
|
return margelo::nitro::unistyles::UnistylesCxxMiniRuntime(
|
|
76
|
-
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "themeName")),
|
|
77
|
-
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "breakpoint")),
|
|
78
|
-
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "hasAdaptiveThemes")),
|
|
79
|
-
JSIConverter<margelo::nitro::unistyles::ColorScheme>::fromJSI(runtime, obj.getProperty(runtime, "colorScheme")),
|
|
80
|
-
JSIConverter<margelo::nitro::unistyles::Dimensions>::fromJSI(runtime, obj.getProperty(runtime, "screen")),
|
|
81
|
-
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "contentSizeCategory")),
|
|
82
|
-
JSIConverter<margelo::nitro::unistyles::Insets>::fromJSI(runtime, obj.getProperty(runtime, "insets")),
|
|
83
|
-
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "pixelRatio")),
|
|
84
|
-
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "fontScale")),
|
|
85
|
-
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "rtl")),
|
|
86
|
-
JSIConverter<margelo::nitro::unistyles::Dimensions>::fromJSI(runtime, obj.getProperty(runtime, "statusBar")),
|
|
87
|
-
JSIConverter<margelo::nitro::unistyles::Dimensions>::fromJSI(runtime, obj.getProperty(runtime, "navigationBar")),
|
|
88
|
-
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "isPortrait")),
|
|
89
|
-
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "isLandscape"))
|
|
84
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "themeName"))),
|
|
85
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "breakpoint"))),
|
|
86
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hasAdaptiveThemes"))),
|
|
87
|
+
JSIConverter<margelo::nitro::unistyles::ColorScheme>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "colorScheme"))),
|
|
88
|
+
JSIConverter<margelo::nitro::unistyles::Dimensions>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "screen"))),
|
|
89
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contentSizeCategory"))),
|
|
90
|
+
JSIConverter<margelo::nitro::unistyles::Insets>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "insets"))),
|
|
91
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pixelRatio"))),
|
|
92
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fontScale"))),
|
|
93
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rtl"))),
|
|
94
|
+
JSIConverter<margelo::nitro::unistyles::Dimensions>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "statusBar"))),
|
|
95
|
+
JSIConverter<margelo::nitro::unistyles::Dimensions>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "navigationBar"))),
|
|
96
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isPortrait"))),
|
|
97
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isLandscape")))
|
|
90
98
|
);
|
|
91
99
|
}
|
|
92
100
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::unistyles::UnistylesCxxMiniRuntime& arg) {
|
|
93
101
|
jsi::Object obj(runtime);
|
|
94
|
-
obj.setProperty(runtime, "themeName", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.themeName));
|
|
95
|
-
obj.setProperty(runtime, "breakpoint", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.breakpoint));
|
|
96
|
-
obj.setProperty(runtime, "hasAdaptiveThemes", JSIConverter<bool>::toJSI(runtime, arg.hasAdaptiveThemes));
|
|
97
|
-
obj.setProperty(runtime, "colorScheme", JSIConverter<margelo::nitro::unistyles::ColorScheme>::toJSI(runtime, arg.colorScheme));
|
|
98
|
-
obj.setProperty(runtime, "screen", JSIConverter<margelo::nitro::unistyles::Dimensions>::toJSI(runtime, arg.screen));
|
|
99
|
-
obj.setProperty(runtime, "contentSizeCategory", JSIConverter<std::string>::toJSI(runtime, arg.contentSizeCategory));
|
|
100
|
-
obj.setProperty(runtime, "insets", JSIConverter<margelo::nitro::unistyles::Insets>::toJSI(runtime, arg.insets));
|
|
101
|
-
obj.setProperty(runtime, "pixelRatio", JSIConverter<double>::toJSI(runtime, arg.pixelRatio));
|
|
102
|
-
obj.setProperty(runtime, "fontScale", JSIConverter<double>::toJSI(runtime, arg.fontScale));
|
|
103
|
-
obj.setProperty(runtime, "rtl", JSIConverter<bool>::toJSI(runtime, arg.rtl));
|
|
104
|
-
obj.setProperty(runtime, "statusBar", JSIConverter<margelo::nitro::unistyles::Dimensions>::toJSI(runtime, arg.statusBar));
|
|
105
|
-
obj.setProperty(runtime, "navigationBar", JSIConverter<margelo::nitro::unistyles::Dimensions>::toJSI(runtime, arg.navigationBar));
|
|
106
|
-
obj.setProperty(runtime, "isPortrait", JSIConverter<bool>::toJSI(runtime, arg.isPortrait));
|
|
107
|
-
obj.setProperty(runtime, "isLandscape", JSIConverter<bool>::toJSI(runtime, arg.isLandscape));
|
|
102
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "themeName"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.themeName));
|
|
103
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "breakpoint"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.breakpoint));
|
|
104
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "hasAdaptiveThemes"), JSIConverter<bool>::toJSI(runtime, arg.hasAdaptiveThemes));
|
|
105
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "colorScheme"), JSIConverter<margelo::nitro::unistyles::ColorScheme>::toJSI(runtime, arg.colorScheme));
|
|
106
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "screen"), JSIConverter<margelo::nitro::unistyles::Dimensions>::toJSI(runtime, arg.screen));
|
|
107
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "contentSizeCategory"), JSIConverter<std::string>::toJSI(runtime, arg.contentSizeCategory));
|
|
108
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "insets"), JSIConverter<margelo::nitro::unistyles::Insets>::toJSI(runtime, arg.insets));
|
|
109
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "pixelRatio"), JSIConverter<double>::toJSI(runtime, arg.pixelRatio));
|
|
110
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "fontScale"), JSIConverter<double>::toJSI(runtime, arg.fontScale));
|
|
111
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "rtl"), JSIConverter<bool>::toJSI(runtime, arg.rtl));
|
|
112
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "statusBar"), JSIConverter<margelo::nitro::unistyles::Dimensions>::toJSI(runtime, arg.statusBar));
|
|
113
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "navigationBar"), JSIConverter<margelo::nitro::unistyles::Dimensions>::toJSI(runtime, arg.navigationBar));
|
|
114
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "isPortrait"), JSIConverter<bool>::toJSI(runtime, arg.isPortrait));
|
|
115
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "isLandscape"), JSIConverter<bool>::toJSI(runtime, arg.isLandscape));
|
|
108
116
|
return obj;
|
|
109
117
|
}
|
|
110
118
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -115,20 +123,20 @@ namespace margelo::nitro {
|
|
|
115
123
|
if (!nitro::isPlainObject(runtime, obj)) {
|
|
116
124
|
return false;
|
|
117
125
|
}
|
|
118
|
-
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "themeName"))) return false;
|
|
119
|
-
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "breakpoint"))) return false;
|
|
120
|
-
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "hasAdaptiveThemes"))) return false;
|
|
121
|
-
if (!JSIConverter<margelo::nitro::unistyles::ColorScheme>::canConvert(runtime, obj.getProperty(runtime, "colorScheme"))) return false;
|
|
122
|
-
if (!JSIConverter<margelo::nitro::unistyles::Dimensions>::canConvert(runtime, obj.getProperty(runtime, "screen"))) return false;
|
|
123
|
-
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "contentSizeCategory"))) return false;
|
|
124
|
-
if (!JSIConverter<margelo::nitro::unistyles::Insets>::canConvert(runtime, obj.getProperty(runtime, "insets"))) return false;
|
|
125
|
-
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "pixelRatio"))) return false;
|
|
126
|
-
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "fontScale"))) return false;
|
|
127
|
-
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "rtl"))) return false;
|
|
128
|
-
if (!JSIConverter<margelo::nitro::unistyles::Dimensions>::canConvert(runtime, obj.getProperty(runtime, "statusBar"))) return false;
|
|
129
|
-
if (!JSIConverter<margelo::nitro::unistyles::Dimensions>::canConvert(runtime, obj.getProperty(runtime, "navigationBar"))) return false;
|
|
130
|
-
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "isPortrait"))) return false;
|
|
131
|
-
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "isLandscape"))) return false;
|
|
126
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "themeName")))) return false;
|
|
127
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "breakpoint")))) return false;
|
|
128
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hasAdaptiveThemes")))) return false;
|
|
129
|
+
if (!JSIConverter<margelo::nitro::unistyles::ColorScheme>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "colorScheme")))) return false;
|
|
130
|
+
if (!JSIConverter<margelo::nitro::unistyles::Dimensions>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "screen")))) return false;
|
|
131
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contentSizeCategory")))) return false;
|
|
132
|
+
if (!JSIConverter<margelo::nitro::unistyles::Insets>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "insets")))) return false;
|
|
133
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pixelRatio")))) return false;
|
|
134
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fontScale")))) return false;
|
|
135
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rtl")))) return false;
|
|
136
|
+
if (!JSIConverter<margelo::nitro::unistyles::Dimensions>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "statusBar")))) return false;
|
|
137
|
+
if (!JSIConverter<margelo::nitro::unistyles::Dimensions>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "navigationBar")))) return false;
|
|
138
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isPortrait")))) return false;
|
|
139
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isLandscape")))) return false;
|
|
132
140
|
return true;
|
|
133
141
|
}
|
|
134
142
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// UnistylesNativeMiniRuntime.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -22,6 +22,11 @@
|
|
|
22
22
|
#else
|
|
23
23
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
24
|
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
25
30
|
|
|
26
31
|
// Forward declaration of `ColorScheme` to properly resolve imports.
|
|
27
32
|
namespace margelo::nitro::unistyles { enum class ColorScheme; }
|
|
@@ -40,7 +45,7 @@ namespace margelo::nitro::unistyles {
|
|
|
40
45
|
/**
|
|
41
46
|
* A struct which can be represented as a JavaScript object (UnistylesNativeMiniRuntime).
|
|
42
47
|
*/
|
|
43
|
-
struct UnistylesNativeMiniRuntime {
|
|
48
|
+
struct UnistylesNativeMiniRuntime final {
|
|
44
49
|
public:
|
|
45
50
|
ColorScheme colorScheme SWIFT_PRIVATE;
|
|
46
51
|
Dimensions screen SWIFT_PRIVATE;
|
|
@@ -57,6 +62,9 @@ namespace margelo::nitro::unistyles {
|
|
|
57
62
|
public:
|
|
58
63
|
UnistylesNativeMiniRuntime() = default;
|
|
59
64
|
explicit UnistylesNativeMiniRuntime(ColorScheme colorScheme, Dimensions screen, std::string contentSizeCategory, Insets insets, double pixelRatio, double fontScale, bool rtl, Dimensions statusBar, Dimensions navigationBar, bool isPortrait, bool isLandscape): colorScheme(colorScheme), screen(screen), contentSizeCategory(contentSizeCategory), insets(insets), pixelRatio(pixelRatio), fontScale(fontScale), rtl(rtl), statusBar(statusBar), navigationBar(navigationBar), isPortrait(isPortrait), isLandscape(isLandscape) {}
|
|
65
|
+
|
|
66
|
+
public:
|
|
67
|
+
friend bool operator==(const UnistylesNativeMiniRuntime& lhs, const UnistylesNativeMiniRuntime& rhs) = default;
|
|
60
68
|
};
|
|
61
69
|
|
|
62
70
|
} // namespace margelo::nitro::unistyles
|
|
@@ -69,32 +77,32 @@ namespace margelo::nitro {
|
|
|
69
77
|
static inline margelo::nitro::unistyles::UnistylesNativeMiniRuntime fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
70
78
|
jsi::Object obj = arg.asObject(runtime);
|
|
71
79
|
return margelo::nitro::unistyles::UnistylesNativeMiniRuntime(
|
|
72
|
-
JSIConverter<margelo::nitro::unistyles::ColorScheme>::fromJSI(runtime, obj.getProperty(runtime, "colorScheme")),
|
|
73
|
-
JSIConverter<margelo::nitro::unistyles::Dimensions>::fromJSI(runtime, obj.getProperty(runtime, "screen")),
|
|
74
|
-
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "contentSizeCategory")),
|
|
75
|
-
JSIConverter<margelo::nitro::unistyles::Insets>::fromJSI(runtime, obj.getProperty(runtime, "insets")),
|
|
76
|
-
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "pixelRatio")),
|
|
77
|
-
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "fontScale")),
|
|
78
|
-
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "rtl")),
|
|
79
|
-
JSIConverter<margelo::nitro::unistyles::Dimensions>::fromJSI(runtime, obj.getProperty(runtime, "statusBar")),
|
|
80
|
-
JSIConverter<margelo::nitro::unistyles::Dimensions>::fromJSI(runtime, obj.getProperty(runtime, "navigationBar")),
|
|
81
|
-
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "isPortrait")),
|
|
82
|
-
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "isLandscape"))
|
|
80
|
+
JSIConverter<margelo::nitro::unistyles::ColorScheme>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "colorScheme"))),
|
|
81
|
+
JSIConverter<margelo::nitro::unistyles::Dimensions>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "screen"))),
|
|
82
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contentSizeCategory"))),
|
|
83
|
+
JSIConverter<margelo::nitro::unistyles::Insets>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "insets"))),
|
|
84
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pixelRatio"))),
|
|
85
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fontScale"))),
|
|
86
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rtl"))),
|
|
87
|
+
JSIConverter<margelo::nitro::unistyles::Dimensions>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "statusBar"))),
|
|
88
|
+
JSIConverter<margelo::nitro::unistyles::Dimensions>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "navigationBar"))),
|
|
89
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isPortrait"))),
|
|
90
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isLandscape")))
|
|
83
91
|
);
|
|
84
92
|
}
|
|
85
93
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::unistyles::UnistylesNativeMiniRuntime& arg) {
|
|
86
94
|
jsi::Object obj(runtime);
|
|
87
|
-
obj.setProperty(runtime, "colorScheme", JSIConverter<margelo::nitro::unistyles::ColorScheme>::toJSI(runtime, arg.colorScheme));
|
|
88
|
-
obj.setProperty(runtime, "screen", JSIConverter<margelo::nitro::unistyles::Dimensions>::toJSI(runtime, arg.screen));
|
|
89
|
-
obj.setProperty(runtime, "contentSizeCategory", JSIConverter<std::string>::toJSI(runtime, arg.contentSizeCategory));
|
|
90
|
-
obj.setProperty(runtime, "insets", JSIConverter<margelo::nitro::unistyles::Insets>::toJSI(runtime, arg.insets));
|
|
91
|
-
obj.setProperty(runtime, "pixelRatio", JSIConverter<double>::toJSI(runtime, arg.pixelRatio));
|
|
92
|
-
obj.setProperty(runtime, "fontScale", JSIConverter<double>::toJSI(runtime, arg.fontScale));
|
|
93
|
-
obj.setProperty(runtime, "rtl", JSIConverter<bool>::toJSI(runtime, arg.rtl));
|
|
94
|
-
obj.setProperty(runtime, "statusBar", JSIConverter<margelo::nitro::unistyles::Dimensions>::toJSI(runtime, arg.statusBar));
|
|
95
|
-
obj.setProperty(runtime, "navigationBar", JSIConverter<margelo::nitro::unistyles::Dimensions>::toJSI(runtime, arg.navigationBar));
|
|
96
|
-
obj.setProperty(runtime, "isPortrait", JSIConverter<bool>::toJSI(runtime, arg.isPortrait));
|
|
97
|
-
obj.setProperty(runtime, "isLandscape", JSIConverter<bool>::toJSI(runtime, arg.isLandscape));
|
|
95
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "colorScheme"), JSIConverter<margelo::nitro::unistyles::ColorScheme>::toJSI(runtime, arg.colorScheme));
|
|
96
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "screen"), JSIConverter<margelo::nitro::unistyles::Dimensions>::toJSI(runtime, arg.screen));
|
|
97
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "contentSizeCategory"), JSIConverter<std::string>::toJSI(runtime, arg.contentSizeCategory));
|
|
98
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "insets"), JSIConverter<margelo::nitro::unistyles::Insets>::toJSI(runtime, arg.insets));
|
|
99
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "pixelRatio"), JSIConverter<double>::toJSI(runtime, arg.pixelRatio));
|
|
100
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "fontScale"), JSIConverter<double>::toJSI(runtime, arg.fontScale));
|
|
101
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "rtl"), JSIConverter<bool>::toJSI(runtime, arg.rtl));
|
|
102
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "statusBar"), JSIConverter<margelo::nitro::unistyles::Dimensions>::toJSI(runtime, arg.statusBar));
|
|
103
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "navigationBar"), JSIConverter<margelo::nitro::unistyles::Dimensions>::toJSI(runtime, arg.navigationBar));
|
|
104
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "isPortrait"), JSIConverter<bool>::toJSI(runtime, arg.isPortrait));
|
|
105
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "isLandscape"), JSIConverter<bool>::toJSI(runtime, arg.isLandscape));
|
|
98
106
|
return obj;
|
|
99
107
|
}
|
|
100
108
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -105,17 +113,17 @@ namespace margelo::nitro {
|
|
|
105
113
|
if (!nitro::isPlainObject(runtime, obj)) {
|
|
106
114
|
return false;
|
|
107
115
|
}
|
|
108
|
-
if (!JSIConverter<margelo::nitro::unistyles::ColorScheme>::canConvert(runtime, obj.getProperty(runtime, "colorScheme"))) return false;
|
|
109
|
-
if (!JSIConverter<margelo::nitro::unistyles::Dimensions>::canConvert(runtime, obj.getProperty(runtime, "screen"))) return false;
|
|
110
|
-
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "contentSizeCategory"))) return false;
|
|
111
|
-
if (!JSIConverter<margelo::nitro::unistyles::Insets>::canConvert(runtime, obj.getProperty(runtime, "insets"))) return false;
|
|
112
|
-
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "pixelRatio"))) return false;
|
|
113
|
-
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "fontScale"))) return false;
|
|
114
|
-
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "rtl"))) return false;
|
|
115
|
-
if (!JSIConverter<margelo::nitro::unistyles::Dimensions>::canConvert(runtime, obj.getProperty(runtime, "statusBar"))) return false;
|
|
116
|
-
if (!JSIConverter<margelo::nitro::unistyles::Dimensions>::canConvert(runtime, obj.getProperty(runtime, "navigationBar"))) return false;
|
|
117
|
-
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "isPortrait"))) return false;
|
|
118
|
-
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "isLandscape"))) return false;
|
|
116
|
+
if (!JSIConverter<margelo::nitro::unistyles::ColorScheme>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "colorScheme")))) return false;
|
|
117
|
+
if (!JSIConverter<margelo::nitro::unistyles::Dimensions>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "screen")))) return false;
|
|
118
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contentSizeCategory")))) return false;
|
|
119
|
+
if (!JSIConverter<margelo::nitro::unistyles::Insets>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "insets")))) return false;
|
|
120
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pixelRatio")))) return false;
|
|
121
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fontScale")))) return false;
|
|
122
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rtl")))) return false;
|
|
123
|
+
if (!JSIConverter<margelo::nitro::unistyles::Dimensions>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "statusBar")))) return false;
|
|
124
|
+
if (!JSIConverter<margelo::nitro::unistyles::Dimensions>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "navigationBar")))) return false;
|
|
125
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isPortrait")))) return false;
|
|
126
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isLandscape")))) return false;
|
|
119
127
|
return true;
|
|
120
128
|
}
|
|
121
129
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-unistyles",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.21",
|
|
4
4
|
"description": "Level up your React Native StyleSheet",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "NODE_ENV=babel-test jest ./plugin",
|
|
@@ -146,11 +146,11 @@
|
|
|
146
146
|
"husky": "9.1.7",
|
|
147
147
|
"jest": "29.7.0",
|
|
148
148
|
"metro-react-native-babel-preset": "0.77.0",
|
|
149
|
-
"nitrogen": "0.
|
|
149
|
+
"nitrogen": "0.32.0",
|
|
150
150
|
"react": "19.1.0",
|
|
151
151
|
"react-native": "0.79.2",
|
|
152
152
|
"react-native-builder-bob": "0.40.10",
|
|
153
|
-
"react-native-nitro-modules": "0.
|
|
153
|
+
"react-native-nitro-modules": "0.32.0",
|
|
154
154
|
"react-native-reanimated": "3.17.5",
|
|
155
155
|
"react-native-web": "0.20.0",
|
|
156
156
|
"react-test-renderer": "19.1.0",
|
package/src/types/breakpoints.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ColorValue, OpaqueColorValue } from 'react-native'
|
|
2
|
-
import type { SafeReturnType } from './common'
|
|
2
|
+
import type { SafeReturnType, UnionToIntersection } from './common'
|
|
3
3
|
import type { TransformStyles } from './core'
|
|
4
4
|
import type { BreakpointsOrMediaQueries, ToDeepUnistyles } from './stylesheet'
|
|
5
5
|
|
|
@@ -12,24 +12,29 @@ type ExtractBreakpoints<T> = T extends object
|
|
|
12
12
|
? T[keyof T]
|
|
13
13
|
: T extends Array<ToDeepUnistyles<TransformStyles>>
|
|
14
14
|
? Array<ExtractTransformArray<T[number]>>
|
|
15
|
-
:
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
: T extends Array<infer _U>
|
|
16
|
+
? T
|
|
17
|
+
: {
|
|
18
|
+
[K in keyof T]: ExtractBreakpoints<T[K]>
|
|
19
|
+
}
|
|
18
20
|
: T
|
|
19
21
|
|
|
22
|
+
// Helper type to check if the base styles (without variants) are truly empty or just {}
|
|
23
|
+
type IsEmptyObject<T> = T extends Record<string, never> ? true : keyof T extends never ? true : false
|
|
24
|
+
|
|
20
25
|
type ParseNestedObject<T, ShouldFlatten> = T extends (...args: infer A) => infer R
|
|
21
26
|
? (...args: A) => ParseNestedObject<R, false>
|
|
22
27
|
: T extends object
|
|
23
28
|
? T extends { variants: infer R, compoundVariants: infer C }
|
|
24
|
-
// // if intersection of Base, Variants and Compound Variants is never, then flatten variants and compound variants to generic "string"
|
|
25
29
|
? (ParseVariants<FlattenVariants<R, false>> & FlattenCompoundVariants<C, false> & ParseNestedObject<Omit<T, 'variants' | 'compoundVariants'>, false>) extends never
|
|
26
30
|
? ParseVariants<FlattenVariants<R, true>> & FlattenCompoundVariants<C, true> & ParseNestedObject<Omit<T, 'variants' | 'compoundVariants'>, false>
|
|
27
31
|
: ParseVariants<FlattenVariants<R, false>> & FlattenCompoundVariants<C, false> & ParseNestedObject<Omit<T, 'variants' | 'compoundVariants'>, false>
|
|
28
32
|
: T extends { variants: infer R }
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
? IsEmptyObject<ParseNestedObject<Omit<T, 'variants'>, false>> extends true
|
|
34
|
+
? ParseVariants<FlattenVariants<R, false>>
|
|
35
|
+
: (ParseVariants<FlattenVariants<R, false>> & ParseNestedObject<Omit<T, 'variants'>, false>) extends never
|
|
36
|
+
? ParseVariants<FlattenVariants<R, true>> & ParseNestedObject<Omit<T, 'variants'>, false>
|
|
37
|
+
: ParseVariants<FlattenVariants<R, false>> & ParseNestedObject<Omit<T, 'variants'>, false>
|
|
33
38
|
: T extends { compoundVariants: object }
|
|
34
39
|
? ParseNestedObject<Omit<T, 'compoundVariants'>, false>
|
|
35
40
|
: {
|
|
@@ -63,25 +68,40 @@ type FlattenCompoundVariants<T, ShouldFlatten> = T extends Array<infer _>
|
|
|
63
68
|
? ParseNestedObject<S, ShouldFlatten>
|
|
64
69
|
: never
|
|
65
70
|
|
|
66
|
-
type
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
type IsNonEmpty<T> = T extends object ? (keyof T extends never ? false : true) : false
|
|
72
|
+
|
|
73
|
+
type IntersectCategoryValues<T> = T extends object
|
|
74
|
+
? T extends Array<any>
|
|
75
|
+
? T
|
|
76
|
+
: UnionToIntersection<T[keyof T]> extends infer R
|
|
77
|
+
? R extends never
|
|
78
|
+
? T[keyof T]
|
|
79
|
+
: R
|
|
80
|
+
: never
|
|
81
|
+
: never
|
|
82
|
+
|
|
83
|
+
type MergeVariantCategories<T> = T extends object
|
|
84
|
+
? UnionToIntersection<
|
|
85
|
+
{
|
|
86
|
+
[K in keyof T]: IsNonEmpty<T[K]> extends true ? T[K] : never
|
|
87
|
+
}[keyof T]
|
|
88
|
+
> extends infer R
|
|
89
|
+
? R extends never
|
|
90
|
+
? NonNullable<T[keyof T]>
|
|
91
|
+
: R
|
|
69
92
|
: never
|
|
70
93
|
: never
|
|
71
94
|
|
|
72
95
|
type ParseVariants<T> = T extends object
|
|
73
96
|
? T[keyof T] extends object
|
|
74
|
-
?
|
|
75
|
-
?
|
|
76
|
-
:
|
|
77
|
-
?
|
|
78
|
-
|
|
97
|
+
? T[keyof T] extends Array<any>
|
|
98
|
+
? T
|
|
99
|
+
: MergeVariantCategories<{
|
|
100
|
+
[K in keyof T]: T[K] extends object ? IntersectCategoryValues<T[K]> : never
|
|
101
|
+
}>
|
|
79
102
|
: T
|
|
80
103
|
: T
|
|
81
104
|
|
|
82
|
-
type UnionToIntersection<U> =
|
|
83
|
-
(U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never
|
|
84
|
-
|
|
85
105
|
type ParseStyleKeys<T> = T extends object
|
|
86
106
|
? { [K in keyof T]: ParseNestedObject<T[K], false> }
|
|
87
107
|
: never
|