concentric-sheet 0.0.2
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/LICENSE +21 -0
- package/NitroConcentricSheet.podspec +31 -0
- package/README.md +118 -0
- package/ios/Bridge.h +8 -0
- package/ios/SheetModalController.swift +912 -0
- package/lib/NativeSheetModal.d.ts +10 -0
- package/lib/NativeSheetModal.js +243 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +1 -0
- package/lib/specs/SheetModalController.nitro.d.ts +46 -0
- package/lib/specs/SheetModalController.nitro.js +1 -0
- package/nitro.json +23 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/ios/NitroConcentricSheet+autolinking.rb +60 -0
- package/nitrogen/generated/ios/NitroConcentricSheet-Swift-Cxx-Bridge.cpp +33 -0
- package/nitrogen/generated/ios/NitroConcentricSheet-Swift-Cxx-Bridge.hpp +269 -0
- package/nitrogen/generated/ios/NitroConcentricSheet-Swift-Cxx-Umbrella.hpp +69 -0
- package/nitrogen/generated/ios/NitroConcentricSheetAutolinking.mm +33 -0
- package/nitrogen/generated/ios/NitroConcentricSheetAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridSheetModalControllerSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridSheetModalControllerSpecSwift.hpp +130 -0
- package/nitrogen/generated/ios/swift/HybridSheetModalControllerSpec.swift +58 -0
- package/nitrogen/generated/ios/swift/HybridSheetModalControllerSpec_cxx.swift +181 -0
- package/nitrogen/generated/ios/swift/ModalCornerConfiguration.swift +83 -0
- package/nitrogen/generated/ios/swift/ModalCornerConfigurationType.swift +48 -0
- package/nitrogen/generated/ios/swift/ModalViewBackground.swift +40 -0
- package/nitrogen/generated/ios/swift/PresentedModalConfig.swift +129 -0
- package/nitrogen/generated/ios/swift/PresentedModalDetent.swift +71 -0
- package/nitrogen/generated/ios/swift/SheetDetentIdentifier.swift +40 -0
- package/nitrogen/generated/ios/swift/SheetPresentationConfig.swift +238 -0
- package/nitrogen/generated/ios/swift/Variant_NullType_PresentedModalDetent.swift +18 -0
- package/nitrogen/generated/shared/c++/HybridSheetModalControllerSpec.cpp +24 -0
- package/nitrogen/generated/shared/c++/HybridSheetModalControllerSpec.hpp +71 -0
- package/nitrogen/generated/shared/c++/ModalCornerConfiguration.hpp +97 -0
- package/nitrogen/generated/shared/c++/ModalCornerConfigurationType.hpp +84 -0
- package/nitrogen/generated/shared/c++/ModalViewBackground.hpp +76 -0
- package/nitrogen/generated/shared/c++/PresentedModalConfig.hpp +115 -0
- package/nitrogen/generated/shared/c++/PresentedModalDetent.hpp +94 -0
- package/nitrogen/generated/shared/c++/SheetDetentIdentifier.hpp +76 -0
- package/nitrogen/generated/shared/c++/SheetPresentationConfig.hpp +130 -0
- package/package.json +103 -0
- package/react-native.config.js +13 -0
- package/src/NativeSheetModal.tsx +343 -0
- package/src/index.ts +16 -0
- package/src/specs/SheetModalController.nitro.ts +54 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// SheetPresentationConfig.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `SheetPresentationConfig`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias SheetPresentationConfig = margelo.nitro.concentricsheet.SheetPresentationConfig
|
|
14
|
+
|
|
15
|
+
public extension SheetPresentationConfig {
|
|
16
|
+
private typealias bridge = margelo.nitro.concentricsheet.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `SheetPresentationConfig`.
|
|
20
|
+
*/
|
|
21
|
+
init(detents: [SheetDetentIdentifier]?, customDetentHeights: [Double]?, selectedDetentIdentifier: SheetDetentIdentifier?, selectedCustomDetentHeight: Double?, largestUndimmedDetentIdentifier: SheetDetentIdentifier?, largestUndimmedCustomDetentHeight: Double?, prefersGrabberVisible: Bool?, preferredCornerRadius: Double?, prefersScrollingExpandsWhenScrolledToEdge: Bool?, prefersEdgeAttachedInCompactHeight: Bool?, widthFollowsPreferredContentSizeWhenEdgeAttached: Bool?, wantsFullScreen: Bool?) {
|
|
22
|
+
self.init({ () -> bridge.std__optional_std__vector_SheetDetentIdentifier__ in
|
|
23
|
+
if let __unwrappedValue = detents {
|
|
24
|
+
return bridge.create_std__optional_std__vector_SheetDetentIdentifier__({ () -> bridge.std__vector_SheetDetentIdentifier_ in
|
|
25
|
+
var __vector = bridge.create_std__vector_SheetDetentIdentifier_(__unwrappedValue.count)
|
|
26
|
+
for __item in __unwrappedValue {
|
|
27
|
+
__vector.push_back(__item)
|
|
28
|
+
}
|
|
29
|
+
return __vector
|
|
30
|
+
}())
|
|
31
|
+
} else {
|
|
32
|
+
return .init()
|
|
33
|
+
}
|
|
34
|
+
}(), { () -> bridge.std__optional_std__vector_double__ in
|
|
35
|
+
if let __unwrappedValue = customDetentHeights {
|
|
36
|
+
return bridge.create_std__optional_std__vector_double__({ () -> bridge.std__vector_double_ in
|
|
37
|
+
var __vector = bridge.create_std__vector_double_(__unwrappedValue.count)
|
|
38
|
+
for __item in __unwrappedValue {
|
|
39
|
+
__vector.push_back(__item)
|
|
40
|
+
}
|
|
41
|
+
return __vector
|
|
42
|
+
}())
|
|
43
|
+
} else {
|
|
44
|
+
return .init()
|
|
45
|
+
}
|
|
46
|
+
}(), { () -> bridge.std__optional_SheetDetentIdentifier_ in
|
|
47
|
+
if let __unwrappedValue = selectedDetentIdentifier {
|
|
48
|
+
return bridge.create_std__optional_SheetDetentIdentifier_(__unwrappedValue)
|
|
49
|
+
} else {
|
|
50
|
+
return .init()
|
|
51
|
+
}
|
|
52
|
+
}(), { () -> bridge.std__optional_double_ in
|
|
53
|
+
if let __unwrappedValue = selectedCustomDetentHeight {
|
|
54
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
55
|
+
} else {
|
|
56
|
+
return .init()
|
|
57
|
+
}
|
|
58
|
+
}(), { () -> bridge.std__optional_SheetDetentIdentifier_ in
|
|
59
|
+
if let __unwrappedValue = largestUndimmedDetentIdentifier {
|
|
60
|
+
return bridge.create_std__optional_SheetDetentIdentifier_(__unwrappedValue)
|
|
61
|
+
} else {
|
|
62
|
+
return .init()
|
|
63
|
+
}
|
|
64
|
+
}(), { () -> bridge.std__optional_double_ in
|
|
65
|
+
if let __unwrappedValue = largestUndimmedCustomDetentHeight {
|
|
66
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
67
|
+
} else {
|
|
68
|
+
return .init()
|
|
69
|
+
}
|
|
70
|
+
}(), { () -> bridge.std__optional_bool_ in
|
|
71
|
+
if let __unwrappedValue = prefersGrabberVisible {
|
|
72
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
73
|
+
} else {
|
|
74
|
+
return .init()
|
|
75
|
+
}
|
|
76
|
+
}(), { () -> bridge.std__optional_double_ in
|
|
77
|
+
if let __unwrappedValue = preferredCornerRadius {
|
|
78
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
79
|
+
} else {
|
|
80
|
+
return .init()
|
|
81
|
+
}
|
|
82
|
+
}(), { () -> bridge.std__optional_bool_ in
|
|
83
|
+
if let __unwrappedValue = prefersScrollingExpandsWhenScrolledToEdge {
|
|
84
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
85
|
+
} else {
|
|
86
|
+
return .init()
|
|
87
|
+
}
|
|
88
|
+
}(), { () -> bridge.std__optional_bool_ in
|
|
89
|
+
if let __unwrappedValue = prefersEdgeAttachedInCompactHeight {
|
|
90
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
91
|
+
} else {
|
|
92
|
+
return .init()
|
|
93
|
+
}
|
|
94
|
+
}(), { () -> bridge.std__optional_bool_ in
|
|
95
|
+
if let __unwrappedValue = widthFollowsPreferredContentSizeWhenEdgeAttached {
|
|
96
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
97
|
+
} else {
|
|
98
|
+
return .init()
|
|
99
|
+
}
|
|
100
|
+
}(), { () -> bridge.std__optional_bool_ in
|
|
101
|
+
if let __unwrappedValue = wantsFullScreen {
|
|
102
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
103
|
+
} else {
|
|
104
|
+
return .init()
|
|
105
|
+
}
|
|
106
|
+
}())
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@inline(__always)
|
|
110
|
+
var detents: [SheetDetentIdentifier]? {
|
|
111
|
+
return { () -> [SheetDetentIdentifier]? in
|
|
112
|
+
if bridge.has_value_std__optional_std__vector_SheetDetentIdentifier__(self.__detents) {
|
|
113
|
+
let __unwrapped = bridge.get_std__optional_std__vector_SheetDetentIdentifier__(self.__detents)
|
|
114
|
+
return __unwrapped.map({ __item in __item })
|
|
115
|
+
} else {
|
|
116
|
+
return nil
|
|
117
|
+
}
|
|
118
|
+
}()
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
@inline(__always)
|
|
122
|
+
var customDetentHeights: [Double]? {
|
|
123
|
+
return { () -> [Double]? in
|
|
124
|
+
if bridge.has_value_std__optional_std__vector_double__(self.__customDetentHeights) {
|
|
125
|
+
let __unwrapped = bridge.get_std__optional_std__vector_double__(self.__customDetentHeights)
|
|
126
|
+
return __unwrapped.map({ __item in __item })
|
|
127
|
+
} else {
|
|
128
|
+
return nil
|
|
129
|
+
}
|
|
130
|
+
}()
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@inline(__always)
|
|
134
|
+
var selectedDetentIdentifier: SheetDetentIdentifier? {
|
|
135
|
+
return self.__selectedDetentIdentifier.value
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@inline(__always)
|
|
139
|
+
var selectedCustomDetentHeight: Double? {
|
|
140
|
+
return { () -> Double? in
|
|
141
|
+
if bridge.has_value_std__optional_double_(self.__selectedCustomDetentHeight) {
|
|
142
|
+
let __unwrapped = bridge.get_std__optional_double_(self.__selectedCustomDetentHeight)
|
|
143
|
+
return __unwrapped
|
|
144
|
+
} else {
|
|
145
|
+
return nil
|
|
146
|
+
}
|
|
147
|
+
}()
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@inline(__always)
|
|
151
|
+
var largestUndimmedDetentIdentifier: SheetDetentIdentifier? {
|
|
152
|
+
return self.__largestUndimmedDetentIdentifier.value
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
@inline(__always)
|
|
156
|
+
var largestUndimmedCustomDetentHeight: Double? {
|
|
157
|
+
return { () -> Double? in
|
|
158
|
+
if bridge.has_value_std__optional_double_(self.__largestUndimmedCustomDetentHeight) {
|
|
159
|
+
let __unwrapped = bridge.get_std__optional_double_(self.__largestUndimmedCustomDetentHeight)
|
|
160
|
+
return __unwrapped
|
|
161
|
+
} else {
|
|
162
|
+
return nil
|
|
163
|
+
}
|
|
164
|
+
}()
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
@inline(__always)
|
|
168
|
+
var prefersGrabberVisible: Bool? {
|
|
169
|
+
return { () -> Bool? in
|
|
170
|
+
if bridge.has_value_std__optional_bool_(self.__prefersGrabberVisible) {
|
|
171
|
+
let __unwrapped = bridge.get_std__optional_bool_(self.__prefersGrabberVisible)
|
|
172
|
+
return __unwrapped
|
|
173
|
+
} else {
|
|
174
|
+
return nil
|
|
175
|
+
}
|
|
176
|
+
}()
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
@inline(__always)
|
|
180
|
+
var preferredCornerRadius: Double? {
|
|
181
|
+
return { () -> Double? in
|
|
182
|
+
if bridge.has_value_std__optional_double_(self.__preferredCornerRadius) {
|
|
183
|
+
let __unwrapped = bridge.get_std__optional_double_(self.__preferredCornerRadius)
|
|
184
|
+
return __unwrapped
|
|
185
|
+
} else {
|
|
186
|
+
return nil
|
|
187
|
+
}
|
|
188
|
+
}()
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
@inline(__always)
|
|
192
|
+
var prefersScrollingExpandsWhenScrolledToEdge: Bool? {
|
|
193
|
+
return { () -> Bool? in
|
|
194
|
+
if bridge.has_value_std__optional_bool_(self.__prefersScrollingExpandsWhenScrolledToEdge) {
|
|
195
|
+
let __unwrapped = bridge.get_std__optional_bool_(self.__prefersScrollingExpandsWhenScrolledToEdge)
|
|
196
|
+
return __unwrapped
|
|
197
|
+
} else {
|
|
198
|
+
return nil
|
|
199
|
+
}
|
|
200
|
+
}()
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@inline(__always)
|
|
204
|
+
var prefersEdgeAttachedInCompactHeight: Bool? {
|
|
205
|
+
return { () -> Bool? in
|
|
206
|
+
if bridge.has_value_std__optional_bool_(self.__prefersEdgeAttachedInCompactHeight) {
|
|
207
|
+
let __unwrapped = bridge.get_std__optional_bool_(self.__prefersEdgeAttachedInCompactHeight)
|
|
208
|
+
return __unwrapped
|
|
209
|
+
} else {
|
|
210
|
+
return nil
|
|
211
|
+
}
|
|
212
|
+
}()
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
@inline(__always)
|
|
216
|
+
var widthFollowsPreferredContentSizeWhenEdgeAttached: Bool? {
|
|
217
|
+
return { () -> Bool? in
|
|
218
|
+
if bridge.has_value_std__optional_bool_(self.__widthFollowsPreferredContentSizeWhenEdgeAttached) {
|
|
219
|
+
let __unwrapped = bridge.get_std__optional_bool_(self.__widthFollowsPreferredContentSizeWhenEdgeAttached)
|
|
220
|
+
return __unwrapped
|
|
221
|
+
} else {
|
|
222
|
+
return nil
|
|
223
|
+
}
|
|
224
|
+
}()
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
@inline(__always)
|
|
228
|
+
var wantsFullScreen: Bool? {
|
|
229
|
+
return { () -> Bool? in
|
|
230
|
+
if bridge.has_value_std__optional_bool_(self.__wantsFullScreen) {
|
|
231
|
+
let __unwrapped = bridge.get_std__optional_bool_(self.__wantsFullScreen)
|
|
232
|
+
return __unwrapped
|
|
233
|
+
} else {
|
|
234
|
+
return nil
|
|
235
|
+
}
|
|
236
|
+
}()
|
|
237
|
+
}
|
|
238
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Variant_NullType_PresentedModalDetent.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* An Swift enum with associated values representing a Variant/Union type.
|
|
12
|
+
* JS type: `null | struct`
|
|
13
|
+
*/
|
|
14
|
+
@frozen
|
|
15
|
+
public indirect enum Variant_NullType_PresentedModalDetent {
|
|
16
|
+
case first(NullType)
|
|
17
|
+
case second(PresentedModalDetent)
|
|
18
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridSheetModalControllerSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridSheetModalControllerSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::concentricsheet {
|
|
11
|
+
|
|
12
|
+
void HybridSheetModalControllerSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridMethod("cachePresentedModalConfig", &HybridSheetModalControllerSpec::cachePresentedModalConfig);
|
|
18
|
+
prototype.registerHybridMethod("applyPresentedModalConfig", &HybridSheetModalControllerSpec::applyPresentedModalConfig);
|
|
19
|
+
prototype.registerHybridMethod("getPresentedModalDetent", &HybridSheetModalControllerSpec::getPresentedModalDetent);
|
|
20
|
+
prototype.registerHybridMethod("dismissPresentedModal", &HybridSheetModalControllerSpec::dismissPresentedModal);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
} // namespace margelo::nitro::concentricsheet
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridSheetModalControllerSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `PresentedModalConfig` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::concentricsheet { struct PresentedModalConfig; }
|
|
18
|
+
// Forward declaration of `PresentedModalDetent` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::concentricsheet { struct PresentedModalDetent; }
|
|
20
|
+
|
|
21
|
+
#include "PresentedModalConfig.hpp"
|
|
22
|
+
#include <NitroModules/Null.hpp>
|
|
23
|
+
#include "PresentedModalDetent.hpp"
|
|
24
|
+
#include <variant>
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::concentricsheet {
|
|
27
|
+
|
|
28
|
+
using namespace margelo::nitro;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* An abstract base class for `SheetModalController`
|
|
32
|
+
* Inherit this class to create instances of `HybridSheetModalControllerSpec` in C++.
|
|
33
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
34
|
+
* @example
|
|
35
|
+
* ```cpp
|
|
36
|
+
* class HybridSheetModalController: public HybridSheetModalControllerSpec {
|
|
37
|
+
* public:
|
|
38
|
+
* HybridSheetModalController(...): HybridObject(TAG) { ... }
|
|
39
|
+
* // ...
|
|
40
|
+
* };
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
class HybridSheetModalControllerSpec: public virtual HybridObject {
|
|
44
|
+
public:
|
|
45
|
+
// Constructor
|
|
46
|
+
explicit HybridSheetModalControllerSpec(): HybridObject(TAG) { }
|
|
47
|
+
|
|
48
|
+
// Destructor
|
|
49
|
+
~HybridSheetModalControllerSpec() override = default;
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
// Properties
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
// Methods
|
|
57
|
+
virtual bool cachePresentedModalConfig(const PresentedModalConfig& config) = 0;
|
|
58
|
+
virtual bool applyPresentedModalConfig(const PresentedModalConfig& config) = 0;
|
|
59
|
+
virtual std::variant<nitro::NullType, PresentedModalDetent> getPresentedModalDetent(double modalInstanceId) = 0;
|
|
60
|
+
virtual bool dismissPresentedModal(bool animated) = 0;
|
|
61
|
+
|
|
62
|
+
protected:
|
|
63
|
+
// Hybrid Setup
|
|
64
|
+
void loadHybridMethods() override;
|
|
65
|
+
|
|
66
|
+
protected:
|
|
67
|
+
// Tag for logging
|
|
68
|
+
static constexpr auto TAG = "SheetModalController";
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
} // namespace margelo::nitro::concentricsheet
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ModalCornerConfiguration.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
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
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `ModalCornerConfigurationType` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::concentricsheet { enum class ModalCornerConfigurationType; }
|
|
33
|
+
|
|
34
|
+
#include "ModalCornerConfigurationType.hpp"
|
|
35
|
+
#include <optional>
|
|
36
|
+
|
|
37
|
+
namespace margelo::nitro::concentricsheet {
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A struct which can be represented as a JavaScript object (ModalCornerConfiguration).
|
|
41
|
+
*/
|
|
42
|
+
struct ModalCornerConfiguration final {
|
|
43
|
+
public:
|
|
44
|
+
ModalCornerConfigurationType type SWIFT_PRIVATE;
|
|
45
|
+
std::optional<double> radius SWIFT_PRIVATE;
|
|
46
|
+
std::optional<double> minimumRadius SWIFT_PRIVATE;
|
|
47
|
+
std::optional<double> maximumRadius SWIFT_PRIVATE;
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
ModalCornerConfiguration() = default;
|
|
51
|
+
explicit ModalCornerConfiguration(ModalCornerConfigurationType type, std::optional<double> radius, std::optional<double> minimumRadius, std::optional<double> maximumRadius): type(type), radius(radius), minimumRadius(minimumRadius), maximumRadius(maximumRadius) {}
|
|
52
|
+
|
|
53
|
+
public:
|
|
54
|
+
friend bool operator==(const ModalCornerConfiguration& lhs, const ModalCornerConfiguration& rhs) = default;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
} // namespace margelo::nitro::concentricsheet
|
|
58
|
+
|
|
59
|
+
namespace margelo::nitro {
|
|
60
|
+
|
|
61
|
+
// C++ ModalCornerConfiguration <> JS ModalCornerConfiguration (object)
|
|
62
|
+
template <>
|
|
63
|
+
struct JSIConverter<margelo::nitro::concentricsheet::ModalCornerConfiguration> final {
|
|
64
|
+
static inline margelo::nitro::concentricsheet::ModalCornerConfiguration fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
65
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
66
|
+
return margelo::nitro::concentricsheet::ModalCornerConfiguration(
|
|
67
|
+
JSIConverter<margelo::nitro::concentricsheet::ModalCornerConfigurationType>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type"))),
|
|
68
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "radius"))),
|
|
69
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumRadius"))),
|
|
70
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumRadius")))
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::concentricsheet::ModalCornerConfiguration& arg) {
|
|
74
|
+
jsi::Object obj(runtime);
|
|
75
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "type"), JSIConverter<margelo::nitro::concentricsheet::ModalCornerConfigurationType>::toJSI(runtime, arg.type));
|
|
76
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "radius"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.radius));
|
|
77
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "minimumRadius"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.minimumRadius));
|
|
78
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "maximumRadius"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.maximumRadius));
|
|
79
|
+
return obj;
|
|
80
|
+
}
|
|
81
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
82
|
+
if (!value.isObject()) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
jsi::Object obj = value.getObject(runtime);
|
|
86
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
if (!JSIConverter<margelo::nitro::concentricsheet::ModalCornerConfigurationType>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type")))) return false;
|
|
90
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "radius")))) return false;
|
|
91
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumRadius")))) return false;
|
|
92
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumRadius")))) return false;
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ModalCornerConfigurationType.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::concentricsheet {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (ModalCornerConfigurationType).
|
|
30
|
+
*/
|
|
31
|
+
enum class ModalCornerConfigurationType {
|
|
32
|
+
NONE SWIFT_NAME(none) = 0,
|
|
33
|
+
FIXED SWIFT_NAME(fixed) = 1,
|
|
34
|
+
CONTAINERCONCENTRIC SWIFT_NAME(containerconcentric) = 2,
|
|
35
|
+
CAPSULE SWIFT_NAME(capsule) = 3,
|
|
36
|
+
} CLOSED_ENUM;
|
|
37
|
+
|
|
38
|
+
} // namespace margelo::nitro::concentricsheet
|
|
39
|
+
|
|
40
|
+
namespace margelo::nitro {
|
|
41
|
+
|
|
42
|
+
// C++ ModalCornerConfigurationType <> JS ModalCornerConfigurationType (union)
|
|
43
|
+
template <>
|
|
44
|
+
struct JSIConverter<margelo::nitro::concentricsheet::ModalCornerConfigurationType> final {
|
|
45
|
+
static inline margelo::nitro::concentricsheet::ModalCornerConfigurationType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
46
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
47
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
48
|
+
case hashString("none"): return margelo::nitro::concentricsheet::ModalCornerConfigurationType::NONE;
|
|
49
|
+
case hashString("fixed"): return margelo::nitro::concentricsheet::ModalCornerConfigurationType::FIXED;
|
|
50
|
+
case hashString("containerConcentric"): return margelo::nitro::concentricsheet::ModalCornerConfigurationType::CONTAINERCONCENTRIC;
|
|
51
|
+
case hashString("capsule"): return margelo::nitro::concentricsheet::ModalCornerConfigurationType::CAPSULE;
|
|
52
|
+
default: [[unlikely]]
|
|
53
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum ModalCornerConfigurationType - invalid value!");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::concentricsheet::ModalCornerConfigurationType arg) {
|
|
57
|
+
switch (arg) {
|
|
58
|
+
case margelo::nitro::concentricsheet::ModalCornerConfigurationType::NONE: return JSIConverter<std::string>::toJSI(runtime, "none");
|
|
59
|
+
case margelo::nitro::concentricsheet::ModalCornerConfigurationType::FIXED: return JSIConverter<std::string>::toJSI(runtime, "fixed");
|
|
60
|
+
case margelo::nitro::concentricsheet::ModalCornerConfigurationType::CONTAINERCONCENTRIC: return JSIConverter<std::string>::toJSI(runtime, "containerConcentric");
|
|
61
|
+
case margelo::nitro::concentricsheet::ModalCornerConfigurationType::CAPSULE: return JSIConverter<std::string>::toJSI(runtime, "capsule");
|
|
62
|
+
default: [[unlikely]]
|
|
63
|
+
throw std::invalid_argument("Cannot convert ModalCornerConfigurationType to JS - invalid value: "
|
|
64
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
68
|
+
if (!value.isString()) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
72
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
73
|
+
case hashString("none"):
|
|
74
|
+
case hashString("fixed"):
|
|
75
|
+
case hashString("containerConcentric"):
|
|
76
|
+
case hashString("capsule"):
|
|
77
|
+
return true;
|
|
78
|
+
default:
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ModalViewBackground.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::concentricsheet {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (ModalViewBackground).
|
|
30
|
+
*/
|
|
31
|
+
enum class ModalViewBackground {
|
|
32
|
+
CLEAR SWIFT_NAME(clear) = 0,
|
|
33
|
+
SYSTEMBACKGROUND SWIFT_NAME(systembackground) = 1,
|
|
34
|
+
} CLOSED_ENUM;
|
|
35
|
+
|
|
36
|
+
} // namespace margelo::nitro::concentricsheet
|
|
37
|
+
|
|
38
|
+
namespace margelo::nitro {
|
|
39
|
+
|
|
40
|
+
// C++ ModalViewBackground <> JS ModalViewBackground (union)
|
|
41
|
+
template <>
|
|
42
|
+
struct JSIConverter<margelo::nitro::concentricsheet::ModalViewBackground> final {
|
|
43
|
+
static inline margelo::nitro::concentricsheet::ModalViewBackground fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
44
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
45
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
46
|
+
case hashString("clear"): return margelo::nitro::concentricsheet::ModalViewBackground::CLEAR;
|
|
47
|
+
case hashString("systemBackground"): return margelo::nitro::concentricsheet::ModalViewBackground::SYSTEMBACKGROUND;
|
|
48
|
+
default: [[unlikely]]
|
|
49
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum ModalViewBackground - invalid value!");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::concentricsheet::ModalViewBackground arg) {
|
|
53
|
+
switch (arg) {
|
|
54
|
+
case margelo::nitro::concentricsheet::ModalViewBackground::CLEAR: return JSIConverter<std::string>::toJSI(runtime, "clear");
|
|
55
|
+
case margelo::nitro::concentricsheet::ModalViewBackground::SYSTEMBACKGROUND: return JSIConverter<std::string>::toJSI(runtime, "systemBackground");
|
|
56
|
+
default: [[unlikely]]
|
|
57
|
+
throw std::invalid_argument("Cannot convert ModalViewBackground to JS - invalid value: "
|
|
58
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
62
|
+
if (!value.isString()) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
66
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
67
|
+
case hashString("clear"):
|
|
68
|
+
case hashString("systemBackground"):
|
|
69
|
+
return true;
|
|
70
|
+
default:
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
} // namespace margelo::nitro
|