nitrowind-native 0.0.0-stage → 0.1.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.
Files changed (95) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/LICENSE +21 -0
  3. package/Package.swift +104 -0
  4. package/README.md +39 -2
  5. package/android/src/main/java/com/margelo/nitro/nitrowind/HybridReducedMotion.kt +79 -0
  6. package/android/src/main/java/com/margelo/nitro/nitrowind/HybridThemeCover.kt +38 -0
  7. package/android/src/main/java/com/margelo/nitro/nitrowind/NitroWindCoverLog.kt +36 -0
  8. package/android/src/main/java/com/margelo/nitro/nitrowind/ThemeCoverActivityInitializer.kt +11 -0
  9. package/android/src/main/java/com/margelo/nitro/nitrowind/ThemeCoverController.kt +619 -0
  10. package/ios/HybridReducedMotion.swift +50 -0
  11. package/ios/HybridThemeCover.swift +46 -0
  12. package/ios/NitroWindCoverLog.swift +40 -0
  13. package/ios/ThemeCoverWindow.swift +324 -0
  14. package/nitro.json +13 -0
  15. package/nitrogen/generated/.gitattributes +1 -0
  16. package/nitrogen/generated/android/NitroWindNative+autolinking.cmake +34 -0
  17. package/nitrogen/generated/android/NitroWindNative+autolinking.gradle +10 -0
  18. package/nitrogen/generated/android/NitroWindNativeOnLoad.cpp +25 -0
  19. package/nitrogen/generated/android/c++/JCallback_void.cpp +54 -0
  20. package/nitrogen/generated/android/c++/JCallback_void_bool.cpp +56 -0
  21. package/nitrogen/generated/android/c++/JCoverRequest.cpp +42 -0
  22. package/nitrogen/generated/android/c++/JHybridReducedMotionSpec.cpp +84 -0
  23. package/nitrogen/generated/android/c++/JHybridThemeCoverSpec.cpp +114 -0
  24. package/nitrogen/generated/android/c++/JListenerSubscription.cpp +34 -0
  25. package/nitrogen/generated/android/c++/JThemeTransitionDirection.cpp +52 -0
  26. package/nitrogen/generated/android/c++/JThemeTransitionStyle.cpp +58 -0
  27. package/nitrogen/generated/android/c++/include/NitroWindNative/private/JCallback_void.hpp +53 -0
  28. package/nitrogen/generated/android/c++/include/NitroWindNative/private/JCallback_void_bool.hpp +55 -0
  29. package/nitrogen/generated/android/c++/include/NitroWindNative/private/JCoverRequest.hpp +73 -0
  30. package/nitrogen/generated/android/c++/include/NitroWindNative/private/JHybridReducedMotionSpec.hpp +90 -0
  31. package/nitrogen/generated/android/c++/include/NitroWindNative/private/JHybridReducedMotionSpecJavaPart.hpp +26 -0
  32. package/nitrogen/generated/android/c++/include/NitroWindNative/private/JHybridThemeCoverSpec.hpp +96 -0
  33. package/nitrogen/generated/android/c++/include/NitroWindNative/private/JHybridThemeCoverSpecJavaPart.hpp +26 -0
  34. package/nitrogen/generated/android/c++/include/NitroWindNative/private/JListenerSubscription.hpp +49 -0
  35. package/nitrogen/generated/android/c++/include/NitroWindNative/private/JThemeTransitionDirection.hpp +72 -0
  36. package/nitrogen/generated/android/c++/include/NitroWindNative/private/JThemeTransitionStyle.hpp +82 -0
  37. package/nitrogen/generated/android/include/NitroWindNative/private/NitroWindNativeOnLoad.hpp +13 -0
  38. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/Callback_void.kt +69 -0
  39. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/Callback_void_bool.kt +69 -0
  40. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/CoverRequest.kt +67 -0
  41. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/HybridReducedMotionSpec.kt +89 -0
  42. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/HybridThemeCoverSpec.kt +107 -0
  43. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/ListenerSubscription.kt +46 -0
  44. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/NitroWindNativeOnLoad.kt +22 -0
  45. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/ThemeTransitionDirection.kt +46 -0
  46. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/ThemeTransitionStyle.kt +52 -0
  47. package/nitrogen/generated/apple/NitroWindNative-Swift-Cxx-Bridge.cpp +68 -0
  48. package/nitrogen/generated/apple/NitroWindNativeAppleCxx/NitroWindNativeAppleCxx.cpp +9 -0
  49. package/nitrogen/generated/apple/NitroWindNativeAppleCxx/include/NitroWindNativeAppleCxx/NitroWindNativeAppleCxx.h +64 -0
  50. package/nitrogen/generated/apple/NitroWindNativeAutolinking.cpp +22 -0
  51. package/nitrogen/generated/apple/NitroWindNativeAutolinking.mm +24 -0
  52. package/nitrogen/generated/apple/c++/CoverRequest-Swift.cpp +36 -0
  53. package/nitrogen/generated/apple/c++/HybridReducedMotionSpecSwift.cpp +62 -0
  54. package/nitrogen/generated/apple/c++/HybridReducedMotionSpec_cxx-Swift.cpp +28 -0
  55. package/nitrogen/generated/apple/c++/HybridThemeCoverSpecSwift.cpp +104 -0
  56. package/nitrogen/generated/apple/c++/HybridThemeCoverSpec_cxx-Swift.cpp +28 -0
  57. package/nitrogen/generated/apple/c++/ListenerSubscription-Swift.cpp +37 -0
  58. package/nitrogen/generated/apple/c++/ThemeTransitionDirection-Swift.cpp +46 -0
  59. package/nitrogen/generated/apple/c++/ThemeTransitionStyle-Swift.cpp +52 -0
  60. package/nitrogen/generated/apple/c++/include/NitroWindNative/NitroWindNativeAutolinking.hpp +13 -0
  61. package/nitrogen/generated/apple/c++/include/NitroWindNative/private/CoverRequest-Swift.hpp +23 -0
  62. package/nitrogen/generated/apple/c++/include/NitroWindNative/private/HybridReducedMotionSpecSwift.hpp +74 -0
  63. package/nitrogen/generated/apple/c++/include/NitroWindNative/private/HybridReducedMotionSpec_cxx-Swift.hpp +23 -0
  64. package/nitrogen/generated/apple/c++/include/NitroWindNative/private/HybridThemeCoverSpecSwift.hpp +79 -0
  65. package/nitrogen/generated/apple/c++/include/NitroWindNative/private/HybridThemeCoverSpec_cxx-Swift.hpp +23 -0
  66. package/nitrogen/generated/apple/c++/include/NitroWindNative/private/ListenerSubscription-Swift.hpp +23 -0
  67. package/nitrogen/generated/apple/c++/include/NitroWindNative/private/NitroWindNative-Swift-Cxx-Umbrella.hpp +41 -0
  68. package/nitrogen/generated/apple/c++/include/NitroWindNative/private/ThemeTransitionDirection-Swift.hpp +23 -0
  69. package/nitrogen/generated/apple/c++/include/NitroWindNative/private/ThemeTransitionStyle-Swift.hpp +23 -0
  70. package/nitrogen/generated/apple/c++/include/module.modulemap +12 -0
  71. package/nitrogen/generated/apple/swift/Callback_void.swift +60 -0
  72. package/nitrogen/generated/apple/swift/Callback_void_bool.swift +60 -0
  73. package/nitrogen/generated/apple/swift/CoverRequest.swift +56 -0
  74. package/nitrogen/generated/apple/swift/HybridReducedMotionSpec.swift +66 -0
  75. package/nitrogen/generated/apple/swift/HybridReducedMotionSpec_cxx.swift +164 -0
  76. package/nitrogen/generated/apple/swift/HybridThemeCoverSpec.swift +70 -0
  77. package/nitrogen/generated/apple/swift/HybridThemeCoverSpec_cxx.swift +207 -0
  78. package/nitrogen/generated/apple/swift/ListenerSubscription.swift +29 -0
  79. package/nitrogen/generated/apple/swift/Promise_bool.swift +100 -0
  80. package/nitrogen/generated/apple/swift/Promise_void.swift +100 -0
  81. package/nitrogen/generated/apple/swift/ThemeTransitionDirection.swift +54 -0
  82. package/nitrogen/generated/apple/swift/ThemeTransitionStyle.swift +64 -0
  83. package/nitrogen/generated/hybrid-classes.json +33 -0
  84. package/nitrogen/generated/shared/c++/NitroWindNativeCxxModule.cpp +2 -0
  85. package/nitrogen/generated/shared/c++/include/NitroWindNative/NitroWindNativeCxxModule.hpp +2 -0
  86. package/nitrogen/generated/shared/javascript/ReducedMotion.cjs +19 -0
  87. package/nitrogen/generated/shared/javascript/ReducedMotion.d.cts +9 -0
  88. package/nitrogen/generated/shared/javascript/ThemeCover.cjs +19 -0
  89. package/nitrogen/generated/shared/javascript/ThemeCover.d.cts +9 -0
  90. package/package.json +69 -4
  91. package/src/index.ts +59 -0
  92. package/src/specs/ListenerSubscription.ts +3 -0
  93. package/src/specs/ReducedMotion.nitro.ts +19 -0
  94. package/src/specs/ThemeCover.nitro.ts +49 -0
  95. package/src/testing.ts +18 -0
@@ -0,0 +1,107 @@
1
+ ///
2
+ /// HybridThemeCoverSpec.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.nitrowind
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import dalvik.annotation.optimization.FastNative
14
+ import com.margelo.nitro.core.Promise
15
+ import com.margelo.nitro.nitrowind.HybridThemeCover
16
+ import com.margelo.nitro.core.HybridObject
17
+
18
+ /**
19
+ * A Kotlin class representing the ThemeCover HybridObject.
20
+ * Implement this abstract class to create Kotlin-based instances of ThemeCover.
21
+ */
22
+ @DoNotStrip
23
+ @Keep
24
+ @Suppress(
25
+ "KotlinJniMissingFunction", "unused",
26
+ "RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
27
+ "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
28
+ )
29
+ abstract class HybridThemeCoverSpec: HybridObject() {
30
+ // Properties
31
+ @get:DoNotStrip
32
+ @get:Keep
33
+ abstract val isSyncCaptureSupported: Boolean
34
+
35
+ // Methods
36
+ @DoNotStrip
37
+ @Keep
38
+ abstract fun captureCoverSync(request: CoverRequest): Boolean
39
+
40
+ @DoNotStrip
41
+ @Keep
42
+ abstract fun captureCoverAsync(request: CoverRequest): Promise<Boolean>
43
+
44
+ @DoNotStrip
45
+ @Keep
46
+ abstract fun finishCover(): Promise<Unit>
47
+
48
+ @DoNotStrip
49
+ @Keep
50
+ abstract fun cancelCover(): Unit
51
+
52
+ @DoNotStrip
53
+ @Keep
54
+ abstract fun isCoverActive(): Boolean
55
+
56
+ @DoNotStrip
57
+ @Keep
58
+ abstract fun lastCaptureOutcome(): String
59
+
60
+ // Default implementation of `HybridObject.toString()`
61
+ override fun toString(): String {
62
+ return "[HybridObject ThemeCover]"
63
+ }
64
+
65
+ // C++ backing class
66
+ @DoNotStrip
67
+ @Keep
68
+ protected open class CxxPart(javaPart: HybridThemeCoverSpec): HybridObject.CxxPart(javaPart) {
69
+ // C++ JHybridThemeCoverSpec::CxxPart::initHybrid(...)
70
+ @FastNative
71
+ external override fun initHybrid(): HybridData
72
+
73
+ companion object {
74
+ @DoNotStrip
75
+ @Keep
76
+ @JvmField
77
+ val implementationClass_cxx: Class<out HybridThemeCoverSpec> = HybridThemeCover::class.java
78
+ }
79
+ }
80
+ override fun createCxxPart(): CxxPart {
81
+ return CxxPart(this)
82
+ }
83
+
84
+ interface Companion {
85
+ // Static Properties
86
+
87
+
88
+ // Static Methods
89
+ /** Creates an instance for JavaScript's `new ThemeCover(...)`. */
90
+ fun constructor(): HybridThemeCover
91
+ }
92
+
93
+ protected companion object Bridge {
94
+ protected const val TAG = "HybridThemeCoverSpec"
95
+
96
+ private val implementationCompanion: Companion
97
+ get() = HybridThemeCover
98
+
99
+ // Constructor
100
+ @JvmStatic
101
+ @DoNotStrip
102
+ @Keep
103
+ private fun constructor_cxx(): HybridThemeCoverSpec {
104
+ return HybridThemeCover.constructor()
105
+ }
106
+ }
107
+ }
@@ -0,0 +1,46 @@
1
+ ///
2
+ /// ListenerSubscription.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.nitrowind
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import com.margelo.nitro.core.Callback
13
+
14
+ /**
15
+ * Represents the JavaScript object/struct "ListenerSubscription".
16
+ */
17
+ @DoNotStrip
18
+ @Keep
19
+ data class ListenerSubscription(
20
+ @DoNotStrip
21
+ @Keep
22
+ val remove: Callback<() -> Unit>
23
+ ) {
24
+ override fun equals(other: Any?): Boolean {
25
+ if (this === other) return true
26
+ if (other !is ListenerSubscription) return false
27
+ return this.remove == other.remove
28
+ }
29
+
30
+ override fun hashCode(): Int {
31
+ return this.remove.hashCode()
32
+ }
33
+
34
+ companion object {
35
+ /**
36
+ * Constructor called from C++
37
+ */
38
+ @DoNotStrip
39
+ @Keep
40
+ @Suppress("unused")
41
+ @JvmStatic
42
+ private fun fromCpp(remove: Callback<() -> Unit>): ListenerSubscription {
43
+ return ListenerSubscription(remove)
44
+ }
45
+ }
46
+ }
@@ -0,0 +1,22 @@
1
+ ///
2
+ /// NitroWindNativeOnLoad.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.nitrowind
9
+
10
+ internal class NitroWindNativeOnLoad {
11
+ companion object {
12
+ private var didLoad = false
13
+
14
+ @JvmStatic
15
+ @Synchronized
16
+ fun initializeNative() {
17
+ if (didLoad) return
18
+ System.loadLibrary("NitroWindNative")
19
+ didLoad = true
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,46 @@
1
+ ///
2
+ /// ThemeTransitionDirection.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.nitrowind
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+ /**
14
+ * Represents the JavaScript enum/union "ThemeTransitionDirection".
15
+ */
16
+ @DoNotStrip
17
+ @Keep
18
+ enum class ThemeTransitionDirection(@DoNotStrip @Keep val value: Int) {
19
+ LEFT(0),
20
+ RIGHT(1);
21
+
22
+ /**
23
+ * Get the String value this ThemeTransitionDirection represents.
24
+ */
25
+ val stringValue: String
26
+ get() =
27
+ when (this) {
28
+ LEFT -> "left"
29
+ RIGHT -> "right"
30
+ }
31
+
32
+ override fun toString(): String = stringValue
33
+
34
+ companion object {
35
+ /**
36
+ * Get a ThemeTransitionDirection for the given String value, or
37
+ * return `null` if the given value was invalid/unknown.
38
+ */
39
+ fun fromString(value: String): ThemeTransitionDirection? =
40
+ when (value) {
41
+ "left" -> LEFT
42
+ "right" -> RIGHT
43
+ else -> null
44
+ }
45
+ }
46
+ }
@@ -0,0 +1,52 @@
1
+ ///
2
+ /// ThemeTransitionStyle.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.nitrowind
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+ /**
14
+ * Represents the JavaScript enum/union "ThemeTransitionStyle".
15
+ */
16
+ @DoNotStrip
17
+ @Keep
18
+ enum class ThemeTransitionStyle(@DoNotStrip @Keep val value: Int) {
19
+ FADE(0),
20
+ CIRCLE(1),
21
+ SLIDE(2),
22
+ BLUR(3);
23
+
24
+ /**
25
+ * Get the String value this ThemeTransitionStyle represents.
26
+ */
27
+ val stringValue: String
28
+ get() =
29
+ when (this) {
30
+ FADE -> "fade"
31
+ CIRCLE -> "circle"
32
+ SLIDE -> "slide"
33
+ BLUR -> "blur"
34
+ }
35
+
36
+ override fun toString(): String = stringValue
37
+
38
+ companion object {
39
+ /**
40
+ * Get a ThemeTransitionStyle for the given String value, or
41
+ * return `null` if the given value was invalid/unknown.
42
+ */
43
+ fun fromString(value: String): ThemeTransitionStyle? =
44
+ when (value) {
45
+ "fade" -> FADE
46
+ "circle" -> CIRCLE
47
+ "slide" -> SLIDE
48
+ "blur" -> BLUR
49
+ else -> null
50
+ }
51
+ }
52
+ }
@@ -0,0 +1,68 @@
1
+ ///
2
+ /// NitroWindNative-Swift-Cxx-Bridge.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+ #include <NitroWindNative/private/NitroWindNative-Swift-Cxx-Umbrella.hpp>
8
+ #include <NitroWindNative/private/HybridReducedMotionSpecSwift.hpp>
9
+ #include <NitroModules/Callback.hpp>
10
+ #include <NitroWindNative/private/HybridThemeCoverSpecSwift.hpp>
11
+
12
+ namespace margelo::nitro::nitrowind::swift_bridge {
13
+ std__shared_ptr_margelo__nitro__nitrowind__HybridReducedMotionSpec_ create_std__shared_ptr_margelo__nitro__nitrowind__HybridReducedMotionSpec_(void* NON_NULL pointer) {
14
+ return std::make_shared<margelo::nitro::nitrowind::HybridReducedMotionSpecSwift>(::NitroWindNative::HybridReducedMotionSpec_cxx::fromUnsafe(pointer));
15
+ }
16
+
17
+ void* NON_NULL get_std__shared_ptr_margelo__nitro__nitrowind__HybridReducedMotionSpec_(const std::shared_ptr<HybridObject>& value) {
18
+ auto wrapper = std::dynamic_pointer_cast<margelo::nitro::nitrowind::HybridReducedMotionSpecSwift>(value);
19
+ if (!wrapper) throw std::runtime_error("HybridReducedMotionSpec is not implemented in Swift");
20
+ return wrapper->getSwiftPart().toUnsafe();
21
+ }
22
+
23
+ Result<void, margelo::nitro::nitrowind::swift_bridge::ResultTag> callSync_Callback_void(const Callback_void& callback) noexcept {
24
+ try {
25
+ callback.callSync();
26
+ return Result<void, margelo::nitro::nitrowind::swift_bridge::ResultTag>::withValue();
27
+ } catch (...) {
28
+ return Result<void, margelo::nitro::nitrowind::swift_bridge::ResultTag>::withError(std::current_exception());
29
+ }
30
+ }
31
+
32
+ Callback_void create_Callback_void(std::function<Result<void, margelo::nitro::nitrowind::swift_bridge::ResultTag>()> closure) {
33
+ return Callback_void::make([closure = std::move(closure)]() -> void {
34
+ auto __result = closure();
35
+ if (__result.hasError()) [[unlikely]] {
36
+ std::rethrow_exception(__result.error());
37
+ }
38
+ });
39
+ }
40
+
41
+ Result<void, margelo::nitro::nitrowind::swift_bridge::ResultTag> callSync_Callback_void_bool(const Callback_void_bool& callback, bool param0) noexcept {
42
+ try {
43
+ callback.callSync(param0);
44
+ return Result<void, margelo::nitro::nitrowind::swift_bridge::ResultTag>::withValue();
45
+ } catch (...) {
46
+ return Result<void, margelo::nitro::nitrowind::swift_bridge::ResultTag>::withError(std::current_exception());
47
+ }
48
+ }
49
+
50
+ Callback_void_bool create_Callback_void_bool(std::function<Result<void, margelo::nitro::nitrowind::swift_bridge::ResultTag>(bool param0)> closure) {
51
+ return Callback_void_bool::make([closure = std::move(closure)](bool param0) -> void {
52
+ auto __result = closure(param0);
53
+ if (__result.hasError()) [[unlikely]] {
54
+ std::rethrow_exception(__result.error());
55
+ }
56
+ });
57
+ }
58
+
59
+ std__shared_ptr_margelo__nitro__nitrowind__HybridThemeCoverSpec_ create_std__shared_ptr_margelo__nitro__nitrowind__HybridThemeCoverSpec_(void* NON_NULL pointer) {
60
+ return std::make_shared<margelo::nitro::nitrowind::HybridThemeCoverSpecSwift>(::NitroWindNative::HybridThemeCoverSpec_cxx::fromUnsafe(pointer));
61
+ }
62
+
63
+ void* NON_NULL get_std__shared_ptr_margelo__nitro__nitrowind__HybridThemeCoverSpec_(const std::shared_ptr<HybridObject>& value) {
64
+ auto wrapper = std::dynamic_pointer_cast<margelo::nitro::nitrowind::HybridThemeCoverSpecSwift>(value);
65
+ if (!wrapper) throw std::runtime_error("HybridThemeCoverSpec is not implemented in Swift");
66
+ return wrapper->getSwiftPart().toUnsafe();
67
+ }
68
+ } // namespace margelo::nitro::nitrowind::swift_bridge
@@ -0,0 +1,9 @@
1
+ ///
2
+ /// NitroWindNativeAppleCxx.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ // Swift packages require at least one source file per C++ target.
9
+ #include <NitroWindNativeAppleCxx/NitroWindNativeAppleCxx.h>
@@ -0,0 +1,64 @@
1
+ ///
2
+ /// NitroWindNativeAppleCxx.h
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ // Forward declaration of `HybridReducedMotionSpec_cxx` to properly resolve imports.
11
+ namespace NitroWindNative { class HybridReducedMotionSpec_cxx; }
12
+ #include <NitroModules/Callback.hpp>
13
+ // Forward declaration of `ListenerSubscription` to properly resolve imports.
14
+ namespace NitroWindNative { class ListenerSubscription; }
15
+ #include <NitroModules/Result.hpp>
16
+ // Forward declaration of `HybridThemeCoverSpec_cxx` to properly resolve imports.
17
+ namespace NitroWindNative { class HybridThemeCoverSpec_cxx; }
18
+ #include <NitroModules/Promise.hpp>
19
+ namespace swift { class String; }
20
+ // Forward declaration of `ThemeTransitionStyle` to properly resolve imports.
21
+ namespace NitroWindNative { class ThemeTransitionStyle; }
22
+ #ifndef SWIFT_SWIFT_H
23
+ namespace swift { template <class T> class Optional; }
24
+ #endif
25
+ // Forward declaration of `ThemeTransitionDirection` to properly resolve imports.
26
+ namespace NitroWindNative { class ThemeTransitionDirection; }
27
+ // Forward declaration of `CoverRequest` to properly resolve imports.
28
+ namespace NitroWindNative { class CoverRequest; }
29
+ #include <NitroModules/HybridObject.hpp>
30
+ // Forward declaration of `HybridReducedMotionSpecSwift` to properly resolve imports.
31
+ namespace margelo::nitro::nitrowind { class HybridReducedMotionSpecSwift; }
32
+ #include <NitroModules/NitroDefines.hpp>
33
+ // Forward declaration of `HybridThemeCoverSpecSwift` to properly resolve imports.
34
+ namespace margelo::nitro::nitrowind { class HybridThemeCoverSpecSwift; }
35
+
36
+ namespace margelo::nitro::nitrowind::swift_bridge {
37
+ using std__shared_ptr_margelo__nitro__nitrowind__HybridReducedMotionSpec_ = std::shared_ptr<margelo::nitro::nitrowind::HybridReducedMotionSpecSwift>;
38
+ using std__weak_ptr_margelo__nitro__nitrowind__HybridReducedMotionSpec_ = std::weak_ptr<margelo::nitro::nitrowind::HybridReducedMotionSpecSwift>;
39
+ inline std__weak_ptr_margelo__nitro__nitrowind__HybridReducedMotionSpec_ weakify_std__shared_ptr_margelo__nitro__nitrowind__HybridReducedMotionSpec_(const std__shared_ptr_margelo__nitro__nitrowind__HybridReducedMotionSpec_& value) {
40
+ return value;
41
+ }
42
+ std__shared_ptr_margelo__nitro__nitrowind__HybridReducedMotionSpec_ create_std__shared_ptr_margelo__nitro__nitrowind__HybridReducedMotionSpec_(void* NON_NULL pointer);
43
+ void* NON_NULL get_std__shared_ptr_margelo__nitro__nitrowind__HybridReducedMotionSpec_(const std::shared_ptr<HybridObject>& value);
44
+ using Promise_void = Promise<void>;
45
+ // Distinct specializations prevent duplicate Swift metadata across module headers.
46
+ struct ResultTag {};
47
+ using Result_void = Result<void, margelo::nitro::nitrowind::swift_bridge::ResultTag>;
48
+ using Callback_void = Callback<void()>;
49
+ Result<void, margelo::nitro::nitrowind::swift_bridge::ResultTag> callSync_Callback_void(const Callback_void& callback) noexcept;
50
+ Callback_void create_Callback_void(std::function<Result<void, margelo::nitro::nitrowind::swift_bridge::ResultTag>()> closure);
51
+ using Callback_void_bool = Callback<void(bool)>;
52
+ Result<void, margelo::nitro::nitrowind::swift_bridge::ResultTag> callSync_Callback_void_bool(const Callback_void_bool& callback, bool param0) noexcept;
53
+ Callback_void_bool create_Callback_void_bool(std::function<Result<void, margelo::nitro::nitrowind::swift_bridge::ResultTag>(bool param0)> closure);
54
+ using Result_bool = Result<bool, margelo::nitro::nitrowind::swift_bridge::ResultTag>;
55
+ using Result_void_ = Result<void*, margelo::nitro::nitrowind::swift_bridge::ResultTag>;
56
+ using std__shared_ptr_margelo__nitro__nitrowind__HybridThemeCoverSpec_ = std::shared_ptr<margelo::nitro::nitrowind::HybridThemeCoverSpecSwift>;
57
+ using std__weak_ptr_margelo__nitro__nitrowind__HybridThemeCoverSpec_ = std::weak_ptr<margelo::nitro::nitrowind::HybridThemeCoverSpecSwift>;
58
+ inline std__weak_ptr_margelo__nitro__nitrowind__HybridThemeCoverSpec_ weakify_std__shared_ptr_margelo__nitro__nitrowind__HybridThemeCoverSpec_(const std__shared_ptr_margelo__nitro__nitrowind__HybridThemeCoverSpec_& value) {
59
+ return value;
60
+ }
61
+ std__shared_ptr_margelo__nitro__nitrowind__HybridThemeCoverSpec_ create_std__shared_ptr_margelo__nitro__nitrowind__HybridThemeCoverSpec_(void* NON_NULL pointer);
62
+ void* NON_NULL get_std__shared_ptr_margelo__nitro__nitrowind__HybridThemeCoverSpec_(const std::shared_ptr<HybridObject>& value);
63
+ using Promise_bool = Promise<bool>;
64
+ } // namespace margelo::nitro::nitrowind::swift_bridge
@@ -0,0 +1,22 @@
1
+ ///
2
+ /// NitroWindNativeAutolinking.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include <NitroWindNative/NitroWindNativeAutolinking.hpp>
9
+ #include <NitroModules/HybridClassRegistry.hpp>
10
+
11
+ #include <NitroWindNative/private/HybridReducedMotionSpecSwift.hpp>
12
+ #include <NitroWindNative/private/HybridThemeCoverSpecSwift.hpp>
13
+
14
+ namespace margelo::nitro::nitrowind {
15
+ void registerHybridClasses() {
16
+ using namespace margelo::nitro;
17
+ using namespace margelo::nitro::nitrowind;
18
+
19
+ HybridClassRegistry::registerHybridClass("nitrowind.ReducedMotion", HybridReducedMotionSpecSwift::Class::get());
20
+ HybridClassRegistry::registerHybridClass("nitrowind.ThemeCover", HybridThemeCoverSpecSwift::Class::get());
21
+ }
22
+ } // namespace margelo::nitro::nitrowind
@@ -0,0 +1,24 @@
1
+ ///
2
+ /// NitroWindNativeAutolinking.mm
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #import <Foundation/Foundation.h>
9
+ #include <NitroWindNative/NitroWindNativeAutolinking.hpp>
10
+
11
+ /**
12
+ * Registers all HybridObject classes of NitroWindNative
13
+ * when the app loads, so JS can look them up by name.
14
+ */
15
+ @interface NitroWindNativeAutolinking : NSObject
16
+ @end
17
+
18
+ @implementation NitroWindNativeAutolinking
19
+
20
+ + (void)load {
21
+ margelo::nitro::nitrowind::registerHybridClasses();
22
+ }
23
+
24
+ @end
@@ -0,0 +1,36 @@
1
+ ///
2
+ /// CoverRequest-Swift.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include <NitroWindNative/private/CoverRequest-Swift.hpp>
9
+ #include <NitroWindNative/private/NitroWindNative-Swift-Cxx-Umbrella.hpp>
10
+ #include <NitroModules/PropNameIDCache.hpp>
11
+
12
+ namespace margelo::nitro {
13
+
14
+ ::NitroWindNative::CoverRequest JSIConverter<::NitroWindNative::CoverRequest>::fromJSI(jsi::Runtime& runtime, const jsi::Value& value) {
15
+ auto object = value.asObject(runtime);
16
+ return ::NitroWindNative::CoverRequest::init_cxx(JSIConverter<::NitroWindNative::ThemeTransitionStyle>::fromJSI(runtime, object.getProperty(runtime, PropNameIDCache::get(runtime, "style"))), JSIConverter<double>::fromJSI(runtime, object.getProperty(runtime, PropNameIDCache::get(runtime, "durationMs"))), JSIConverter<swift::Optional<double>>::fromJSI(runtime, object.getProperty(runtime, PropNameIDCache::get(runtime, "originX"))), JSIConverter<swift::Optional<double>>::fromJSI(runtime, object.getProperty(runtime, PropNameIDCache::get(runtime, "originY"))), JSIConverter<swift::Optional<::NitroWindNative::ThemeTransitionDirection>>::fromJSI(runtime, object.getProperty(runtime, PropNameIDCache::get(runtime, "direction"))));
17
+ }
18
+
19
+ jsi::Value JSIConverter<::NitroWindNative::CoverRequest>::toJSI(jsi::Runtime& runtime, const ::NitroWindNative::CoverRequest& value) {
20
+ jsi::Object object(runtime);
21
+ object.setProperty(runtime, PropNameIDCache::get(runtime, "style"), JSIConverter<::NitroWindNative::ThemeTransitionStyle>::toJSI(runtime, value.getStyle_cxx()));
22
+ object.setProperty(runtime, PropNameIDCache::get(runtime, "durationMs"), JSIConverter<double>::toJSI(runtime, value.getDurationMs_cxx()));
23
+ object.setProperty(runtime, PropNameIDCache::get(runtime, "originX"), JSIConverter<swift::Optional<double>>::toJSI(runtime, value.getOriginX_cxx()));
24
+ object.setProperty(runtime, PropNameIDCache::get(runtime, "originY"), JSIConverter<swift::Optional<double>>::toJSI(runtime, value.getOriginY_cxx()));
25
+ object.setProperty(runtime, PropNameIDCache::get(runtime, "direction"), JSIConverter<swift::Optional<::NitroWindNative::ThemeTransitionDirection>>::toJSI(runtime, value.getDirection_cxx()));
26
+ return object;
27
+ }
28
+
29
+ bool JSIConverter<::NitroWindNative::CoverRequest>::canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
30
+ if (!value.isObject()) return false;
31
+ auto object = value.getObject(runtime);
32
+ if (!isPlainObject(runtime, object)) return false;
33
+ return JSIConverter<::NitroWindNative::ThemeTransitionStyle>::canConvert(runtime, object.getProperty(runtime, PropNameIDCache::get(runtime, "style"))) && JSIConverter<double>::canConvert(runtime, object.getProperty(runtime, PropNameIDCache::get(runtime, "durationMs"))) && JSIConverter<swift::Optional<double>>::canConvert(runtime, object.getProperty(runtime, PropNameIDCache::get(runtime, "originX"))) && JSIConverter<swift::Optional<double>>::canConvert(runtime, object.getProperty(runtime, PropNameIDCache::get(runtime, "originY"))) && JSIConverter<swift::Optional<::NitroWindNative::ThemeTransitionDirection>>::canConvert(runtime, object.getProperty(runtime, PropNameIDCache::get(runtime, "direction")));
34
+ }
35
+
36
+ } // namespace margelo::nitro
@@ -0,0 +1,62 @@
1
+ ///
2
+ /// HybridReducedMotionSpecSwift.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include <NitroWindNative/private/HybridReducedMotionSpecSwift.hpp>
9
+ #include <NitroModules/SwiftConverter.hpp>
10
+ #include <NitroModules/SwiftResult.hpp>
11
+ #include <optional>
12
+
13
+ namespace margelo::nitro::nitrowind {
14
+
15
+ std::string HybridReducedMotionSpecSwift::toString() {
16
+ return SwiftConverter<std::string, swift::String>::fromSwift(_swiftPart.toString());
17
+ }
18
+
19
+ // Properties
20
+
21
+ // Methods
22
+
23
+ bool HybridReducedMotionSpecSwift::isReducedMotionEnabled() {
24
+ auto __result = _swiftPart.isReducedMotionEnabled();
25
+ if (__result.hasError()) [[unlikely]] {
26
+ std::rethrow_exception(__result.error());
27
+ }
28
+ return std::move(__result.value());
29
+ }
30
+
31
+ ::NitroWindNative::ListenerSubscription HybridReducedMotionSpecSwift::addOnReducedMotionChangedListener(const Callback<void(bool)>& listener) {
32
+ auto __result = ([&](const void* listener) {
33
+ return receiveSwiftResult<::NitroWindNative::ListenerSubscription>([&](const void* __onResult) {
34
+ return _swiftPart.addOnReducedMotionChangedListener(listener, __onResult);
35
+ });
36
+ })(std::addressof(listener));
37
+ if (__result.hasError()) [[unlikely]] {
38
+ std::rethrow_exception(__result.error());
39
+ }
40
+ return std::move(__result.value());
41
+ }
42
+
43
+ // Constructor
44
+
45
+ ::NitroWindNative::HybridReducedMotionSpec_cxx HybridReducedMotionSpecSwift::constructor() {
46
+ auto __result = ::NitroWindNative::HybridReducedMotionSpec_cxx::constructor();
47
+ if (__result.hasError()) [[unlikely]] {
48
+ std::rethrow_exception(__result.error());
49
+ }
50
+ return ::NitroWindNative::HybridReducedMotionSpec_cxx::fromUnsafe(__result.value());
51
+ }
52
+
53
+ const std::shared_ptr<const HybridClass>& HybridReducedMotionSpecSwift::Class::get() {
54
+ static const auto hybridClass = HybridClass::create<Class>([](HybridClass& clazz) {
55
+ clazz.registerHybridMethod("isReducedMotionEnabled", &HybridReducedMotionSpecSwift::isReducedMotionEnabled);
56
+ clazz.registerHybridMethod("addOnReducedMotionChangedListener", &HybridReducedMotionSpecSwift::addOnReducedMotionChangedListener);
57
+ clazz.registerHybridConstructor(&HybridReducedMotionSpecSwift::constructor);
58
+ });
59
+ return hybridClass;
60
+ }
61
+
62
+ } // namespace margelo::nitro::nitrowind
@@ -0,0 +1,28 @@
1
+ ///
2
+ /// HybridReducedMotionSpec_cxx-Swift.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/margelo/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include <NitroWindNative/private/HybridReducedMotionSpec_cxx-Swift.hpp>
9
+ #include <NitroWindNative/private/NitroWindNative-Swift-Cxx-Umbrella.hpp>
10
+ #include <NitroWindNative/private/HybridReducedMotionSpecSwift.hpp>
11
+
12
+ namespace margelo::nitro {
13
+
14
+ ::NitroWindNative::HybridReducedMotionSpec_cxx JSIConverter<::NitroWindNative::HybridReducedMotionSpec_cxx>::fromJSI(jsi::Runtime& runtime, const jsi::Value& value) {
15
+ auto hybridSpec = JSIConverter<std::shared_ptr<margelo::nitro::nitrowind::HybridReducedMotionSpecSwift>>::fromJSI(runtime, value);
16
+ return ::NitroWindNative::HybridReducedMotionSpec_cxx::fromUnsafe(margelo::nitro::nitrowind::swift_bridge::get_std__shared_ptr_margelo__nitro__nitrowind__HybridReducedMotionSpec_(hybridSpec));
17
+ }
18
+
19
+ jsi::Value JSIConverter<::NitroWindNative::HybridReducedMotionSpec_cxx>::toJSI(jsi::Runtime& runtime, const ::NitroWindNative::HybridReducedMotionSpec_cxx& value) {
20
+ auto hybridSpec = ::NitroWindNative::HybridReducedMotionSpec_cxx::getCxxPart(value);
21
+ return JSIConverter<std::shared_ptr<margelo::nitro::nitrowind::HybridReducedMotionSpecSwift>>::toJSI(runtime, hybridSpec);
22
+ }
23
+
24
+ bool JSIConverter<::NitroWindNative::HybridReducedMotionSpec_cxx>::canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
25
+ return JSIConverter<std::shared_ptr<margelo::nitro::nitrowind::HybridReducedMotionSpecSwift>>::canConvert(runtime, value);
26
+ }
27
+
28
+ } // namespace margelo::nitro