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
@@ -60,53 +60,53 @@ namespace margelo::nitro::unistyles {
|
|
60
60
|
// Methods
|
61
61
|
Insets JHybridNativePlatformSpec::getInsets() {
|
62
62
|
static const auto method = _javaPart->getClass()->getMethod<jni::local_ref<JInsets>()>("getInsets");
|
63
|
-
auto
|
64
|
-
return
|
63
|
+
auto __result = method(_javaPart);
|
64
|
+
return __result->toCpp();
|
65
65
|
}
|
66
66
|
ColorScheme JHybridNativePlatformSpec::getColorScheme() {
|
67
67
|
static const auto method = _javaPart->getClass()->getMethod<jni::local_ref<JColorScheme>()>("getColorScheme");
|
68
|
-
auto
|
69
|
-
return
|
68
|
+
auto __result = method(_javaPart);
|
69
|
+
return __result->toCpp();
|
70
70
|
}
|
71
71
|
double JHybridNativePlatformSpec::getFontScale() {
|
72
72
|
static const auto method = _javaPart->getClass()->getMethod<double()>("getFontScale");
|
73
|
-
auto
|
74
|
-
return
|
73
|
+
auto __result = method(_javaPart);
|
74
|
+
return __result;
|
75
75
|
}
|
76
76
|
double JHybridNativePlatformSpec::getPixelRatio() {
|
77
77
|
static const auto method = _javaPart->getClass()->getMethod<double()>("getPixelRatio");
|
78
|
-
auto
|
79
|
-
return
|
78
|
+
auto __result = method(_javaPart);
|
79
|
+
return __result;
|
80
80
|
}
|
81
81
|
Orientation JHybridNativePlatformSpec::getOrientation() {
|
82
82
|
static const auto method = _javaPart->getClass()->getMethod<jni::local_ref<JOrientation>()>("getOrientation");
|
83
|
-
auto
|
84
|
-
return
|
83
|
+
auto __result = method(_javaPart);
|
84
|
+
return __result->toCpp();
|
85
85
|
}
|
86
86
|
std::string JHybridNativePlatformSpec::getContentSizeCategory() {
|
87
87
|
static const auto method = _javaPart->getClass()->getMethod<jni::local_ref<jni::JString>()>("getContentSizeCategory");
|
88
|
-
auto
|
89
|
-
return
|
88
|
+
auto __result = method(_javaPart);
|
89
|
+
return __result->toStdString();
|
90
90
|
}
|
91
91
|
Dimensions JHybridNativePlatformSpec::getScreenDimensions() {
|
92
92
|
static const auto method = _javaPart->getClass()->getMethod<jni::local_ref<JDimensions>()>("getScreenDimensions");
|
93
|
-
auto
|
94
|
-
return
|
93
|
+
auto __result = method(_javaPart);
|
94
|
+
return __result->toCpp();
|
95
95
|
}
|
96
96
|
Dimensions JHybridNativePlatformSpec::getStatusBarDimensions() {
|
97
97
|
static const auto method = _javaPart->getClass()->getMethod<jni::local_ref<JDimensions>()>("getStatusBarDimensions");
|
98
|
-
auto
|
99
|
-
return
|
98
|
+
auto __result = method(_javaPart);
|
99
|
+
return __result->toCpp();
|
100
100
|
}
|
101
101
|
Dimensions JHybridNativePlatformSpec::getNavigationBarDimensions() {
|
102
102
|
static const auto method = _javaPart->getClass()->getMethod<jni::local_ref<JDimensions>()>("getNavigationBarDimensions");
|
103
|
-
auto
|
104
|
-
return
|
103
|
+
auto __result = method(_javaPart);
|
104
|
+
return __result->toCpp();
|
105
105
|
}
|
106
106
|
bool JHybridNativePlatformSpec::getPrefersRtlDirection() {
|
107
107
|
static const auto method = _javaPart->getClass()->getMethod<jboolean()>("getPrefersRtlDirection");
|
108
|
-
auto
|
109
|
-
return
|
108
|
+
auto __result = method(_javaPart);
|
109
|
+
return __result;
|
110
110
|
}
|
111
111
|
void JHybridNativePlatformSpec::setRootViewBackgroundColor(double color) {
|
112
112
|
static const auto method = _javaPart->getClass()->getMethod<void(double /* color */)>("setRootViewBackgroundColor");
|
@@ -134,8 +134,8 @@ namespace margelo::nitro::unistyles {
|
|
134
134
|
}
|
135
135
|
UnistylesNativeMiniRuntime JHybridNativePlatformSpec::getMiniRuntime() {
|
136
136
|
static const auto method = _javaPart->getClass()->getMethod<jni::local_ref<JUnistylesNativeMiniRuntime>()>("getMiniRuntime");
|
137
|
-
auto
|
138
|
-
return
|
137
|
+
auto __result = method(_javaPart);
|
138
|
+
return __result->toCpp();
|
139
139
|
}
|
140
140
|
void JHybridNativePlatformSpec::registerPlatformListener(const std::function<void(const std::vector<UnistyleDependency>& /* dependencies */)>& callback) {
|
141
141
|
static const auto method = _javaPart->getClass()->getMethod<void(jni::alias_ref<JFunc_void_std__vector_UnistyleDependency_::javaobject> /* callback */)>("registerPlatformListener");
|
@@ -50,7 +50,7 @@ namespace margelo::nitro::unistyles {
|
|
50
50
|
return clazz->getStaticFieldValue(fieldLANDSCAPE);
|
51
51
|
default:
|
52
52
|
std::string stringValue = std::to_string(static_cast<int>(value));
|
53
|
-
throw std::
|
53
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
54
54
|
}
|
55
55
|
}
|
56
56
|
};
|
@@ -86,7 +86,7 @@ namespace margelo::nitro::unistyles {
|
|
86
86
|
return clazz->getStaticFieldValue(fieldNAVIGATIONBAR);
|
87
87
|
default:
|
88
88
|
std::string stringValue = std::to_string(static_cast<int>(value));
|
89
|
-
throw std::
|
89
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
90
90
|
}
|
91
91
|
}
|
92
92
|
};
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt
CHANGED
@@ -116,8 +116,8 @@ abstract class HybridNativePlatformSpec: HybridObject() {
|
|
116
116
|
@DoNotStrip
|
117
117
|
@Keep
|
118
118
|
private fun registerPlatformListener(callback: Func_void_std__vector_UnistyleDependency_): Unit {
|
119
|
-
val
|
120
|
-
return
|
119
|
+
val __result = registerPlatformListener(callback.toLambda())
|
120
|
+
return __result
|
121
121
|
}
|
122
122
|
|
123
123
|
private external fun initHybrid(): HybridData
|
@@ -1,11 +1,11 @@
|
|
1
1
|
///
|
2
|
-
///
|
2
|
+
/// unistylesOnLoad.cpp
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
4
4
|
/// https://github.com/mrousavy/nitro
|
5
5
|
/// Copyright © 2024 Marc Rousavy @ Margelo
|
6
6
|
///
|
7
7
|
|
8
|
-
#include "
|
8
|
+
#include "unistylesOnLoad.hpp"
|
9
9
|
|
10
10
|
#include <jni.h>
|
11
11
|
#include <fbjni/fbjni.h>
|
@@ -24,7 +24,7 @@ def add_nitrogen_files(spec)
|
|
24
24
|
|
25
25
|
spec.dependency "NitroModules"
|
26
26
|
|
27
|
-
current_source_files = spec.attributes_hash['source_files']
|
27
|
+
current_source_files = Array(spec.attributes_hash['source_files'])
|
28
28
|
spec.source_files = current_source_files + [
|
29
29
|
# Generated cross-platform specs
|
30
30
|
"nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}",
|
@@ -32,7 +32,7 @@ def add_nitrogen_files(spec)
|
|
32
32
|
"nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}",
|
33
33
|
]
|
34
34
|
|
35
|
-
current_public_header_files = spec.attributes_hash['public_header_files']
|
35
|
+
current_public_header_files = Array(spec.attributes_hash['public_header_files'])
|
36
36
|
spec.public_header_files = current_public_header_files + [
|
37
37
|
# Generated specs
|
38
38
|
"nitrogen/generated/shared/**/*.{h,hpp}",
|
@@ -40,7 +40,7 @@ def add_nitrogen_files(spec)
|
|
40
40
|
"nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.hpp"
|
41
41
|
]
|
42
42
|
|
43
|
-
current_private_header_files = spec.attributes_hash['private_header_files']
|
43
|
+
current_private_header_files = Array(spec.attributes_hash['private_header_files'])
|
44
44
|
spec.private_header_files = current_private_header_files + [
|
45
45
|
# iOS specific specs
|
46
46
|
"nitrogen/generated/ios/c++/**/*.{h,hpp}",
|
@@ -52,5 +52,7 @@ def add_nitrogen_files(spec)
|
|
52
52
|
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
53
53
|
# Enables C++ <-> Swift interop (by default it's only C)
|
54
54
|
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
55
|
+
# Enables stricter modular headers
|
56
|
+
"DEFINES_MODULE" => "YES",
|
55
57
|
})
|
56
58
|
end
|
@@ -6,3 +6,28 @@
|
|
6
6
|
///
|
7
7
|
|
8
8
|
#include "Unistyles-Swift-Cxx-Bridge.hpp"
|
9
|
+
|
10
|
+
// Include C++ implementation defined types
|
11
|
+
#include "HybridNativePlatformSpecSwift.hpp"
|
12
|
+
#include "Unistyles-Swift-Cxx-Umbrella.hpp"
|
13
|
+
#include <NitroModules/HybridContext.hpp>
|
14
|
+
|
15
|
+
namespace margelo::nitro::unistyles::bridge::swift {
|
16
|
+
|
17
|
+
// pragma MARK: std::shared_ptr<margelo::nitro::unistyles::HybridNativePlatformSpec>
|
18
|
+
std::shared_ptr<margelo::nitro::unistyles::HybridNativePlatformSpec> create_std__shared_ptr_margelo__nitro__unistyles__HybridNativePlatformSpec_(void* _Nonnull swiftUnsafePointer) {
|
19
|
+
Unistyles::HybridNativePlatformSpecCxx swiftPart = Unistyles::HybridNativePlatformSpecCxxUnsafe::fromUnsafe(swiftUnsafePointer);
|
20
|
+
return HybridContext::getOrCreate<margelo::nitro::unistyles::HybridNativePlatformSpecSwift>(swiftPart);
|
21
|
+
}
|
22
|
+
void* _Nonnull get_std__shared_ptr_margelo__nitro__unistyles__HybridNativePlatformSpec_(std__shared_ptr_margelo__nitro__unistyles__HybridNativePlatformSpec_ cppType) {
|
23
|
+
std::shared_ptr<margelo::nitro::unistyles::HybridNativePlatformSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::unistyles::HybridNativePlatformSpecSwift>(cppType);
|
24
|
+
#ifdef NITRO_DEBUG
|
25
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
26
|
+
throw std::runtime_error("Class \"HybridNativePlatformSpec\" is not implemented in Swift!");
|
27
|
+
}
|
28
|
+
#endif
|
29
|
+
Unistyles::HybridNativePlatformSpecCxx swiftPart = swiftWrapper->getSwiftPart();
|
30
|
+
return Unistyles::HybridNativePlatformSpecCxxUnsafe::toUnsafe(swiftPart);
|
31
|
+
}
|
32
|
+
|
33
|
+
} // namespace margelo::nitro::unistyles::bridge::swift
|
@@ -7,29 +7,28 @@
|
|
7
7
|
|
8
8
|
#pragma once
|
9
9
|
|
10
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
11
|
+
#include <NitroModules/NitroDefines.hpp>
|
12
|
+
#else
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
14
|
+
#endif
|
15
|
+
|
10
16
|
// Forward declarations of C++ defined types
|
17
|
+
// Forward declaration of `HybridNativePlatformSpec` to properly resolve imports.
|
18
|
+
namespace margelo::nitro::unistyles { class HybridNativePlatformSpec; }
|
11
19
|
// Forward declaration of `UnistyleDependency` to properly resolve imports.
|
12
20
|
namespace margelo::nitro::unistyles { enum class UnistyleDependency; }
|
13
21
|
|
22
|
+
// Forward declarations of Swift defined types
|
23
|
+
// Forward declaration of `HybridNativePlatformSpecCxx` to properly resolve imports.
|
24
|
+
namespace Unistyles { class HybridNativePlatformSpecCxx; }
|
25
|
+
|
14
26
|
// Include C++ defined types
|
15
|
-
#
|
16
|
-
|
17
|
-
#
|
18
|
-
#
|
19
|
-
|
20
|
-
#endif
|
21
|
-
#if __has_include(<memory>)
|
22
|
-
#include <memory>
|
23
|
-
#endif
|
24
|
-
#if __has_include(<optional>)
|
25
|
-
#include <optional>
|
26
|
-
#endif
|
27
|
-
#if __has_include(<string>)
|
28
|
-
#include <string>
|
29
|
-
#endif
|
30
|
-
#if __has_include(<vector>)
|
31
|
-
#include <vector>
|
32
|
-
#endif
|
27
|
+
#include "HybridNativePlatformSpec.hpp"
|
28
|
+
#include "UnistyleDependency.hpp"
|
29
|
+
#include <functional>
|
30
|
+
#include <memory>
|
31
|
+
#include <vector>
|
33
32
|
|
34
33
|
/**
|
35
34
|
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
@@ -37,6 +36,7 @@ namespace margelo::nitro::unistyles { enum class UnistyleDependency; }
|
|
37
36
|
*/
|
38
37
|
namespace margelo::nitro::unistyles::bridge::swift {
|
39
38
|
|
39
|
+
// pragma MARK: std::vector<UnistyleDependency>
|
40
40
|
/**
|
41
41
|
* Specialized version of `std::vector<UnistyleDependency>`.
|
42
42
|
*/
|
@@ -47,6 +47,7 @@ namespace margelo::nitro::unistyles::bridge::swift {
|
|
47
47
|
return vector;
|
48
48
|
}
|
49
49
|
|
50
|
+
// pragma MARK: std::function<void(const std::vector<UnistyleDependency>& /* dependencies */)>
|
50
51
|
/**
|
51
52
|
* Specialized version of `std::function<void(const std::vector<UnistyleDependency>&)>`.
|
52
53
|
*/
|
@@ -54,18 +55,17 @@ namespace margelo::nitro::unistyles::bridge::swift {
|
|
54
55
|
/**
|
55
56
|
* Wrapper class for a `std::function<void(const std::vector<UnistyleDependency>& / * dependencies * /)>`, this can be used from Swift.
|
56
57
|
*/
|
57
|
-
class Func_void_std__vector_UnistyleDependency__Wrapper {
|
58
|
+
class Func_void_std__vector_UnistyleDependency__Wrapper final {
|
58
59
|
public:
|
59
|
-
explicit Func_void_std__vector_UnistyleDependency__Wrapper(const std::function<void(const std::vector<UnistyleDependency>& /* dependencies */)>& func):
|
60
|
-
explicit Func_void_std__vector_UnistyleDependency__Wrapper(std::function<void(const std::vector<UnistyleDependency>& /* dependencies */)>&& func):
|
61
|
-
|
62
|
-
|
63
|
-
function(dependencies);
|
60
|
+
explicit Func_void_std__vector_UnistyleDependency__Wrapper(const std::function<void(const std::vector<UnistyleDependency>& /* dependencies */)>& func): _function(func) {}
|
61
|
+
explicit Func_void_std__vector_UnistyleDependency__Wrapper(std::function<void(const std::vector<UnistyleDependency>& /* dependencies */)>&& func): _function(std::move(func)) {}
|
62
|
+
inline void call(std::vector<UnistyleDependency> dependencies) const {
|
63
|
+
_function(dependencies);
|
64
64
|
}
|
65
|
-
|
66
|
-
std::function<void(const std::vector<UnistyleDependency>& /* dependencies */)>
|
65
|
+
private:
|
66
|
+
std::function<void(const std::vector<UnistyleDependency>& /* dependencies */)> _function;
|
67
67
|
};
|
68
|
-
inline Func_void_std__vector_UnistyleDependency_ create_Func_void_std__vector_UnistyleDependency_(void* closureHolder, void(*call)(void* /* closureHolder */, std::vector<UnistyleDependency>), void(*destroy)(void*)) {
|
68
|
+
inline Func_void_std__vector_UnistyleDependency_ create_Func_void_std__vector_UnistyleDependency_(void* _Nonnull closureHolder, void(* _Nonnull call)(void* _Nonnull /* closureHolder */, std::vector<UnistyleDependency>), void(* _Nonnull destroy)(void* _Nonnull)) {
|
69
69
|
std::shared_ptr<void> sharedClosureHolder(closureHolder, destroy);
|
70
70
|
return Func_void_std__vector_UnistyleDependency_([sharedClosureHolder, call](const std::vector<UnistyleDependency>& dependencies) -> void {
|
71
71
|
call(sharedClosureHolder.get(), dependencies);
|
@@ -75,12 +75,12 @@ namespace margelo::nitro::unistyles::bridge::swift {
|
|
75
75
|
return std::make_shared<Func_void_std__vector_UnistyleDependency__Wrapper>(value);
|
76
76
|
}
|
77
77
|
|
78
|
+
// pragma MARK: std::shared_ptr<margelo::nitro::unistyles::HybridNativePlatformSpec>
|
78
79
|
/**
|
79
|
-
* Specialized version of `std::
|
80
|
+
* Specialized version of `std::shared_ptr<margelo::nitro::unistyles::HybridNativePlatformSpec>`.
|
80
81
|
*/
|
81
|
-
using
|
82
|
-
|
83
|
-
|
84
|
-
}
|
82
|
+
using std__shared_ptr_margelo__nitro__unistyles__HybridNativePlatformSpec_ = std::shared_ptr<margelo::nitro::unistyles::HybridNativePlatformSpec>;
|
83
|
+
std::shared_ptr<margelo::nitro::unistyles::HybridNativePlatformSpec> create_std__shared_ptr_margelo__nitro__unistyles__HybridNativePlatformSpec_(void* _Nonnull swiftUnsafePointer);
|
84
|
+
void* _Nonnull get_std__shared_ptr_margelo__nitro__unistyles__HybridNativePlatformSpec_(std__shared_ptr_margelo__nitro__unistyles__HybridNativePlatformSpec_ cppType);
|
85
85
|
|
86
86
|
} // namespace margelo::nitro::unistyles::bridge::swift
|
@@ -14,24 +14,12 @@ namespace margelo::nitro::unistyles { enum class ColorScheme; }
|
|
14
14
|
namespace margelo::nitro::unistyles { struct Dimensions; }
|
15
15
|
// Forward declaration of `HybridNativePlatformSpec` to properly resolve imports.
|
16
16
|
namespace margelo::nitro::unistyles { class HybridNativePlatformSpec; }
|
17
|
-
// Forward declaration of `HybridUnistylesNavigationBarSpec` to properly resolve imports.
|
18
|
-
namespace margelo::nitro::unistyles { class HybridUnistylesNavigationBarSpec; }
|
19
|
-
// Forward declaration of `HybridUnistylesRuntimeSpec` to properly resolve imports.
|
20
|
-
namespace margelo::nitro::unistyles { class HybridUnistylesRuntimeSpec; }
|
21
|
-
// Forward declaration of `HybridUnistylesShadowRegistrySpec` to properly resolve imports.
|
22
|
-
namespace margelo::nitro::unistyles { class HybridUnistylesShadowRegistrySpec; }
|
23
|
-
// Forward declaration of `HybridUnistylesStatusBarSpec` to properly resolve imports.
|
24
|
-
namespace margelo::nitro::unistyles { class HybridUnistylesStatusBarSpec; }
|
25
|
-
// Forward declaration of `HybridUnistylesStyleSheetSpec` to properly resolve imports.
|
26
|
-
namespace margelo::nitro::unistyles { class HybridUnistylesStyleSheetSpec; }
|
27
17
|
// Forward declaration of `Insets` to properly resolve imports.
|
28
18
|
namespace margelo::nitro::unistyles { struct Insets; }
|
29
19
|
// Forward declaration of `Orientation` to properly resolve imports.
|
30
20
|
namespace margelo::nitro::unistyles { enum class Orientation; }
|
31
21
|
// Forward declaration of `UnistyleDependency` to properly resolve imports.
|
32
22
|
namespace margelo::nitro::unistyles { enum class UnistyleDependency; }
|
33
|
-
// Forward declaration of `UnistylesCxxMiniRuntime` to properly resolve imports.
|
34
|
-
namespace margelo::nitro::unistyles { struct UnistylesCxxMiniRuntime; }
|
35
23
|
// Forward declaration of `UnistylesNativeMiniRuntime` to properly resolve imports.
|
36
24
|
namespace margelo::nitro::unistyles { struct UnistylesNativeMiniRuntime; }
|
37
25
|
|
@@ -39,19 +27,12 @@ namespace margelo::nitro::unistyles { struct UnistylesNativeMiniRuntime; }
|
|
39
27
|
#include "ColorScheme.hpp"
|
40
28
|
#include "Dimensions.hpp"
|
41
29
|
#include "HybridNativePlatformSpec.hpp"
|
42
|
-
#include "HybridUnistylesNavigationBarSpec.hpp"
|
43
|
-
#include "HybridUnistylesRuntimeSpec.hpp"
|
44
|
-
#include "HybridUnistylesShadowRegistrySpec.hpp"
|
45
|
-
#include "HybridUnistylesStatusBarSpec.hpp"
|
46
|
-
#include "HybridUnistylesStyleSheetSpec.hpp"
|
47
30
|
#include "Insets.hpp"
|
48
31
|
#include "Orientation.hpp"
|
49
32
|
#include "UnistyleDependency.hpp"
|
50
|
-
#include "UnistylesCxxMiniRuntime.hpp"
|
51
33
|
#include "UnistylesNativeMiniRuntime.hpp"
|
52
34
|
#include <functional>
|
53
35
|
#include <memory>
|
54
|
-
#include <optional>
|
55
36
|
#include <string>
|
56
37
|
#include <vector>
|
57
38
|
|
@@ -67,16 +48,6 @@ namespace margelo::nitro::unistyles { struct UnistylesNativeMiniRuntime; }
|
|
67
48
|
// Forward declarations of Swift defined types
|
68
49
|
// Forward declaration of `HybridNativePlatformSpecCxx` to properly resolve imports.
|
69
50
|
namespace Unistyles { class HybridNativePlatformSpecCxx; }
|
70
|
-
// Forward declaration of `HybridUnistylesNavigationBarSpecCxx` to properly resolve imports.
|
71
|
-
namespace Unistyles { class HybridUnistylesNavigationBarSpecCxx; }
|
72
|
-
// Forward declaration of `HybridUnistylesRuntimeSpecCxx` to properly resolve imports.
|
73
|
-
namespace Unistyles { class HybridUnistylesRuntimeSpecCxx; }
|
74
|
-
// Forward declaration of `HybridUnistylesShadowRegistrySpecCxx` to properly resolve imports.
|
75
|
-
namespace Unistyles { class HybridUnistylesShadowRegistrySpecCxx; }
|
76
|
-
// Forward declaration of `HybridUnistylesStatusBarSpecCxx` to properly resolve imports.
|
77
|
-
namespace Unistyles { class HybridUnistylesStatusBarSpecCxx; }
|
78
|
-
// Forward declaration of `HybridUnistylesStyleSheetSpecCxx` to properly resolve imports.
|
79
|
-
namespace Unistyles { class HybridUnistylesStyleSheetSpecCxx; }
|
80
51
|
|
81
52
|
// Include Swift defined types
|
82
53
|
#if __has_include("Unistyles-Swift.h")
|
@@ -51,15 +51,3 @@ public protocol HybridNativePlatformSpec: AnyObject, HybridObjectSpec {
|
|
51
51
|
func getMiniRuntime() throws -> UnistylesNativeMiniRuntime
|
52
52
|
func registerPlatformListener(callback: @escaping ((_ dependencies: [UnistyleDependency]) -> Void)) throws -> Void
|
53
53
|
}
|
54
|
-
|
55
|
-
public extension HybridNativePlatformSpec {
|
56
|
-
/**
|
57
|
-
* Create a new instance of HybridNativePlatformSpecCxx for the given HybridNativePlatformSpec.
|
58
|
-
*
|
59
|
-
* Instances of HybridNativePlatformSpecCxx can be accessed from C++, and contain
|
60
|
-
* additional required bridging code for C++ <> Swift interop.
|
61
|
-
*/
|
62
|
-
func createCxxBridge() -> HybridNativePlatformSpecCxx {
|
63
|
-
return HybridNativePlatformSpecCxx(self)
|
64
|
-
}
|
65
|
-
}
|