concentric-sheet 0.0.1

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.

Potentially problematic release.


This version of concentric-sheet might be problematic. Click here for more details.

Files changed (41) hide show
  1. package/NitroConcentricSheet.podspec +31 -0
  2. package/README.md +95 -0
  3. package/ios/Bridge.h +8 -0
  4. package/ios/SheetModalController.swift +294 -0
  5. package/lib/NativeSheetModal.d.ts +22 -0
  6. package/lib/NativeSheetModal.js +128 -0
  7. package/lib/index.d.ts +3 -0
  8. package/lib/index.js +1 -0
  9. package/lib/specs/SheetModalController.nitro.d.ts +34 -0
  10. package/lib/specs/SheetModalController.nitro.js +1 -0
  11. package/nitro.json +23 -0
  12. package/nitrogen/generated/.gitattributes +1 -0
  13. package/nitrogen/generated/ios/NitroConcentricSheet+autolinking.rb +60 -0
  14. package/nitrogen/generated/ios/NitroConcentricSheet-Swift-Cxx-Bridge.cpp +33 -0
  15. package/nitrogen/generated/ios/NitroConcentricSheet-Swift-Cxx-Bridge.hpp +184 -0
  16. package/nitrogen/generated/ios/NitroConcentricSheet-Swift-Cxx-Umbrella.hpp +63 -0
  17. package/nitrogen/generated/ios/NitroConcentricSheetAutolinking.mm +33 -0
  18. package/nitrogen/generated/ios/NitroConcentricSheetAutolinking.swift +26 -0
  19. package/nitrogen/generated/ios/c++/HybridSheetModalControllerSpecSwift.cpp +11 -0
  20. package/nitrogen/generated/ios/c++/HybridSheetModalControllerSpecSwift.hpp +108 -0
  21. package/nitrogen/generated/ios/swift/HybridSheetModalControllerSpec.swift +56 -0
  22. package/nitrogen/generated/ios/swift/HybridSheetModalControllerSpec_cxx.swift +150 -0
  23. package/nitrogen/generated/ios/swift/ModalCornerConfiguration.swift +83 -0
  24. package/nitrogen/generated/ios/swift/ModalCornerConfigurationType.swift +48 -0
  25. package/nitrogen/generated/ios/swift/ModalViewBackground.swift +40 -0
  26. package/nitrogen/generated/ios/swift/PresentedModalConfig.swift +111 -0
  27. package/nitrogen/generated/ios/swift/SheetDetentIdentifier.swift +40 -0
  28. package/nitrogen/generated/ios/swift/SheetPresentationConfig.swift +160 -0
  29. package/nitrogen/generated/shared/c++/HybridSheetModalControllerSpec.cpp +22 -0
  30. package/nitrogen/generated/shared/c++/HybridSheetModalControllerSpec.hpp +64 -0
  31. package/nitrogen/generated/shared/c++/ModalCornerConfiguration.hpp +97 -0
  32. package/nitrogen/generated/shared/c++/ModalCornerConfigurationType.hpp +84 -0
  33. package/nitrogen/generated/shared/c++/ModalViewBackground.hpp +76 -0
  34. package/nitrogen/generated/shared/c++/PresentedModalConfig.hpp +111 -0
  35. package/nitrogen/generated/shared/c++/SheetDetentIdentifier.hpp +76 -0
  36. package/nitrogen/generated/shared/c++/SheetPresentationConfig.hpp +114 -0
  37. package/package.json +103 -0
  38. package/react-native.config.js +13 -0
  39. package/src/NativeSheetModal.tsx +204 -0
  40. package/src/index.ts +15 -0
  41. package/src/specs/SheetModalController.nitro.ts +41 -0
@@ -0,0 +1,64 @@
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
+
19
+ #include "PresentedModalConfig.hpp"
20
+
21
+ namespace margelo::nitro::concentricsheet {
22
+
23
+ using namespace margelo::nitro;
24
+
25
+ /**
26
+ * An abstract base class for `SheetModalController`
27
+ * Inherit this class to create instances of `HybridSheetModalControllerSpec` in C++.
28
+ * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
29
+ * @example
30
+ * ```cpp
31
+ * class HybridSheetModalController: public HybridSheetModalControllerSpec {
32
+ * public:
33
+ * HybridSheetModalController(...): HybridObject(TAG) { ... }
34
+ * // ...
35
+ * };
36
+ * ```
37
+ */
38
+ class HybridSheetModalControllerSpec: public virtual HybridObject {
39
+ public:
40
+ // Constructor
41
+ explicit HybridSheetModalControllerSpec(): HybridObject(TAG) { }
42
+
43
+ // Destructor
44
+ ~HybridSheetModalControllerSpec() override = default;
45
+
46
+ public:
47
+ // Properties
48
+
49
+
50
+ public:
51
+ // Methods
52
+ virtual bool applyPresentedModalConfig(const PresentedModalConfig& config) = 0;
53
+ virtual bool dismissPresentedModal(bool animated) = 0;
54
+
55
+ protected:
56
+ // Hybrid Setup
57
+ void loadHybridMethods() override;
58
+
59
+ protected:
60
+ // Tag for logging
61
+ static constexpr auto TAG = "SheetModalController";
62
+ };
63
+
64
+ } // 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
@@ -0,0 +1,111 @@
1
+ ///
2
+ /// PresentedModalConfig.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 `ModalViewBackground` to properly resolve imports.
32
+ namespace margelo::nitro::concentricsheet { enum class ModalViewBackground; }
33
+ // Forward declaration of `ModalCornerConfiguration` to properly resolve imports.
34
+ namespace margelo::nitro::concentricsheet { struct ModalCornerConfiguration; }
35
+ // Forward declaration of `SheetPresentationConfig` to properly resolve imports.
36
+ namespace margelo::nitro::concentricsheet { struct SheetPresentationConfig; }
37
+
38
+ #include <optional>
39
+ #include "ModalViewBackground.hpp"
40
+ #include "ModalCornerConfiguration.hpp"
41
+ #include "SheetPresentationConfig.hpp"
42
+
43
+ namespace margelo::nitro::concentricsheet {
44
+
45
+ /**
46
+ * A struct which can be represented as a JavaScript object (PresentedModalConfig).
47
+ */
48
+ struct PresentedModalConfig final {
49
+ public:
50
+ std::optional<bool> isModalInPresentation SWIFT_PRIVATE;
51
+ std::optional<double> preferredContentWidth SWIFT_PRIVATE;
52
+ std::optional<double> preferredContentHeight SWIFT_PRIVATE;
53
+ std::optional<ModalViewBackground> modalViewBackground SWIFT_PRIVATE;
54
+ std::optional<ModalCornerConfiguration> cornerConfiguration SWIFT_PRIVATE;
55
+ std::optional<SheetPresentationConfig> sheet SWIFT_PRIVATE;
56
+
57
+ public:
58
+ PresentedModalConfig() = default;
59
+ explicit PresentedModalConfig(std::optional<bool> isModalInPresentation, std::optional<double> preferredContentWidth, std::optional<double> preferredContentHeight, std::optional<ModalViewBackground> modalViewBackground, std::optional<ModalCornerConfiguration> cornerConfiguration, std::optional<SheetPresentationConfig> sheet): isModalInPresentation(isModalInPresentation), preferredContentWidth(preferredContentWidth), preferredContentHeight(preferredContentHeight), modalViewBackground(modalViewBackground), cornerConfiguration(cornerConfiguration), sheet(sheet) {}
60
+
61
+ public:
62
+ friend bool operator==(const PresentedModalConfig& lhs, const PresentedModalConfig& rhs) = default;
63
+ };
64
+
65
+ } // namespace margelo::nitro::concentricsheet
66
+
67
+ namespace margelo::nitro {
68
+
69
+ // C++ PresentedModalConfig <> JS PresentedModalConfig (object)
70
+ template <>
71
+ struct JSIConverter<margelo::nitro::concentricsheet::PresentedModalConfig> final {
72
+ static inline margelo::nitro::concentricsheet::PresentedModalConfig fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
73
+ jsi::Object obj = arg.asObject(runtime);
74
+ return margelo::nitro::concentricsheet::PresentedModalConfig(
75
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isModalInPresentation"))),
76
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "preferredContentWidth"))),
77
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "preferredContentHeight"))),
78
+ JSIConverter<std::optional<margelo::nitro::concentricsheet::ModalViewBackground>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "modalViewBackground"))),
79
+ JSIConverter<std::optional<margelo::nitro::concentricsheet::ModalCornerConfiguration>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cornerConfiguration"))),
80
+ JSIConverter<std::optional<margelo::nitro::concentricsheet::SheetPresentationConfig>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sheet")))
81
+ );
82
+ }
83
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::concentricsheet::PresentedModalConfig& arg) {
84
+ jsi::Object obj(runtime);
85
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "isModalInPresentation"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.isModalInPresentation));
86
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "preferredContentWidth"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.preferredContentWidth));
87
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "preferredContentHeight"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.preferredContentHeight));
88
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "modalViewBackground"), JSIConverter<std::optional<margelo::nitro::concentricsheet::ModalViewBackground>>::toJSI(runtime, arg.modalViewBackground));
89
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "cornerConfiguration"), JSIConverter<std::optional<margelo::nitro::concentricsheet::ModalCornerConfiguration>>::toJSI(runtime, arg.cornerConfiguration));
90
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "sheet"), JSIConverter<std::optional<margelo::nitro::concentricsheet::SheetPresentationConfig>>::toJSI(runtime, arg.sheet));
91
+ return obj;
92
+ }
93
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
94
+ if (!value.isObject()) {
95
+ return false;
96
+ }
97
+ jsi::Object obj = value.getObject(runtime);
98
+ if (!nitro::isPlainObject(runtime, obj)) {
99
+ return false;
100
+ }
101
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isModalInPresentation")))) return false;
102
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "preferredContentWidth")))) return false;
103
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "preferredContentHeight")))) return false;
104
+ if (!JSIConverter<std::optional<margelo::nitro::concentricsheet::ModalViewBackground>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "modalViewBackground")))) return false;
105
+ if (!JSIConverter<std::optional<margelo::nitro::concentricsheet::ModalCornerConfiguration>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cornerConfiguration")))) return false;
106
+ if (!JSIConverter<std::optional<margelo::nitro::concentricsheet::SheetPresentationConfig>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sheet")))) return false;
107
+ return true;
108
+ }
109
+ };
110
+
111
+ } // namespace margelo::nitro
@@ -0,0 +1,76 @@
1
+ ///
2
+ /// SheetDetentIdentifier.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 (SheetDetentIdentifier).
30
+ */
31
+ enum class SheetDetentIdentifier {
32
+ MEDIUM SWIFT_NAME(medium) = 0,
33
+ LARGE SWIFT_NAME(large) = 1,
34
+ } CLOSED_ENUM;
35
+
36
+ } // namespace margelo::nitro::concentricsheet
37
+
38
+ namespace margelo::nitro {
39
+
40
+ // C++ SheetDetentIdentifier <> JS SheetDetentIdentifier (union)
41
+ template <>
42
+ struct JSIConverter<margelo::nitro::concentricsheet::SheetDetentIdentifier> final {
43
+ static inline margelo::nitro::concentricsheet::SheetDetentIdentifier 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("medium"): return margelo::nitro::concentricsheet::SheetDetentIdentifier::MEDIUM;
47
+ case hashString("large"): return margelo::nitro::concentricsheet::SheetDetentIdentifier::LARGE;
48
+ default: [[unlikely]]
49
+ throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum SheetDetentIdentifier - invalid value!");
50
+ }
51
+ }
52
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::concentricsheet::SheetDetentIdentifier arg) {
53
+ switch (arg) {
54
+ case margelo::nitro::concentricsheet::SheetDetentIdentifier::MEDIUM: return JSIConverter<std::string>::toJSI(runtime, "medium");
55
+ case margelo::nitro::concentricsheet::SheetDetentIdentifier::LARGE: return JSIConverter<std::string>::toJSI(runtime, "large");
56
+ default: [[unlikely]]
57
+ throw std::invalid_argument("Cannot convert SheetDetentIdentifier 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("medium"):
68
+ case hashString("large"):
69
+ return true;
70
+ default:
71
+ return false;
72
+ }
73
+ }
74
+ };
75
+
76
+ } // namespace margelo::nitro
@@ -0,0 +1,114 @@
1
+ ///
2
+ /// SheetPresentationConfig.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 `SheetDetentIdentifier` to properly resolve imports.
32
+ namespace margelo::nitro::concentricsheet { enum class SheetDetentIdentifier; }
33
+
34
+ #include "SheetDetentIdentifier.hpp"
35
+ #include <vector>
36
+ #include <optional>
37
+
38
+ namespace margelo::nitro::concentricsheet {
39
+
40
+ /**
41
+ * A struct which can be represented as a JavaScript object (SheetPresentationConfig).
42
+ */
43
+ struct SheetPresentationConfig final {
44
+ public:
45
+ std::optional<std::vector<SheetDetentIdentifier>> detents SWIFT_PRIVATE;
46
+ std::optional<SheetDetentIdentifier> selectedDetentIdentifier SWIFT_PRIVATE;
47
+ std::optional<SheetDetentIdentifier> largestUndimmedDetentIdentifier SWIFT_PRIVATE;
48
+ std::optional<bool> prefersGrabberVisible SWIFT_PRIVATE;
49
+ std::optional<double> preferredCornerRadius SWIFT_PRIVATE;
50
+ std::optional<bool> prefersScrollingExpandsWhenScrolledToEdge SWIFT_PRIVATE;
51
+ std::optional<bool> prefersEdgeAttachedInCompactHeight SWIFT_PRIVATE;
52
+ std::optional<bool> widthFollowsPreferredContentSizeWhenEdgeAttached SWIFT_PRIVATE;
53
+
54
+ public:
55
+ SheetPresentationConfig() = default;
56
+ explicit SheetPresentationConfig(std::optional<std::vector<SheetDetentIdentifier>> detents, std::optional<SheetDetentIdentifier> selectedDetentIdentifier, std::optional<SheetDetentIdentifier> largestUndimmedDetentIdentifier, std::optional<bool> prefersGrabberVisible, std::optional<double> preferredCornerRadius, std::optional<bool> prefersScrollingExpandsWhenScrolledToEdge, std::optional<bool> prefersEdgeAttachedInCompactHeight, std::optional<bool> widthFollowsPreferredContentSizeWhenEdgeAttached): detents(detents), selectedDetentIdentifier(selectedDetentIdentifier), largestUndimmedDetentIdentifier(largestUndimmedDetentIdentifier), prefersGrabberVisible(prefersGrabberVisible), preferredCornerRadius(preferredCornerRadius), prefersScrollingExpandsWhenScrolledToEdge(prefersScrollingExpandsWhenScrolledToEdge), prefersEdgeAttachedInCompactHeight(prefersEdgeAttachedInCompactHeight), widthFollowsPreferredContentSizeWhenEdgeAttached(widthFollowsPreferredContentSizeWhenEdgeAttached) {}
57
+
58
+ public:
59
+ friend bool operator==(const SheetPresentationConfig& lhs, const SheetPresentationConfig& rhs) = default;
60
+ };
61
+
62
+ } // namespace margelo::nitro::concentricsheet
63
+
64
+ namespace margelo::nitro {
65
+
66
+ // C++ SheetPresentationConfig <> JS SheetPresentationConfig (object)
67
+ template <>
68
+ struct JSIConverter<margelo::nitro::concentricsheet::SheetPresentationConfig> final {
69
+ static inline margelo::nitro::concentricsheet::SheetPresentationConfig fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
70
+ jsi::Object obj = arg.asObject(runtime);
71
+ return margelo::nitro::concentricsheet::SheetPresentationConfig(
72
+ JSIConverter<std::optional<std::vector<margelo::nitro::concentricsheet::SheetDetentIdentifier>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "detents"))),
73
+ JSIConverter<std::optional<margelo::nitro::concentricsheet::SheetDetentIdentifier>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "selectedDetentIdentifier"))),
74
+ JSIConverter<std::optional<margelo::nitro::concentricsheet::SheetDetentIdentifier>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "largestUndimmedDetentIdentifier"))),
75
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "prefersGrabberVisible"))),
76
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "preferredCornerRadius"))),
77
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "prefersScrollingExpandsWhenScrolledToEdge"))),
78
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "prefersEdgeAttachedInCompactHeight"))),
79
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "widthFollowsPreferredContentSizeWhenEdgeAttached")))
80
+ );
81
+ }
82
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::concentricsheet::SheetPresentationConfig& arg) {
83
+ jsi::Object obj(runtime);
84
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "detents"), JSIConverter<std::optional<std::vector<margelo::nitro::concentricsheet::SheetDetentIdentifier>>>::toJSI(runtime, arg.detents));
85
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "selectedDetentIdentifier"), JSIConverter<std::optional<margelo::nitro::concentricsheet::SheetDetentIdentifier>>::toJSI(runtime, arg.selectedDetentIdentifier));
86
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "largestUndimmedDetentIdentifier"), JSIConverter<std::optional<margelo::nitro::concentricsheet::SheetDetentIdentifier>>::toJSI(runtime, arg.largestUndimmedDetentIdentifier));
87
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "prefersGrabberVisible"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.prefersGrabberVisible));
88
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "preferredCornerRadius"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.preferredCornerRadius));
89
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "prefersScrollingExpandsWhenScrolledToEdge"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.prefersScrollingExpandsWhenScrolledToEdge));
90
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "prefersEdgeAttachedInCompactHeight"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.prefersEdgeAttachedInCompactHeight));
91
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "widthFollowsPreferredContentSizeWhenEdgeAttached"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.widthFollowsPreferredContentSizeWhenEdgeAttached));
92
+ return obj;
93
+ }
94
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
95
+ if (!value.isObject()) {
96
+ return false;
97
+ }
98
+ jsi::Object obj = value.getObject(runtime);
99
+ if (!nitro::isPlainObject(runtime, obj)) {
100
+ return false;
101
+ }
102
+ if (!JSIConverter<std::optional<std::vector<margelo::nitro::concentricsheet::SheetDetentIdentifier>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "detents")))) return false;
103
+ if (!JSIConverter<std::optional<margelo::nitro::concentricsheet::SheetDetentIdentifier>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "selectedDetentIdentifier")))) return false;
104
+ if (!JSIConverter<std::optional<margelo::nitro::concentricsheet::SheetDetentIdentifier>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "largestUndimmedDetentIdentifier")))) return false;
105
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "prefersGrabberVisible")))) return false;
106
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "preferredCornerRadius")))) return false;
107
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "prefersScrollingExpandsWhenScrolledToEdge")))) return false;
108
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "prefersEdgeAttachedInCompactHeight")))) return false;
109
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "widthFollowsPreferredContentSizeWhenEdgeAttached")))) return false;
110
+ return true;
111
+ }
112
+ };
113
+
114
+ } // namespace margelo::nitro