@salve-software/react-native-nitro-input-mask 1.0.0

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 (204) hide show
  1. package/LICENSE +21 -0
  2. package/NitroInputMask.podspec +31 -0
  3. package/README.md +181 -0
  4. package/android/CMakeLists.txt +32 -0
  5. package/android/build.gradle +148 -0
  6. package/android/fix-prefab.gradle +51 -0
  7. package/android/gradle.properties +5 -0
  8. package/android/src/main/AndroidManifest.xml +2 -0
  9. package/android/src/main/cpp/cpp-adapter.cpp +9 -0
  10. package/android/src/main/java/com/nitroinputmask/NitroInputMaskContext.kt +7 -0
  11. package/android/src/main/java/com/nitroinputmask/NitroInputMaskModule.kt +108 -0
  12. package/android/src/main/java/com/nitroinputmask/NitroInputMaskPackage.kt +29 -0
  13. package/android/src/main/java/com/nitroinputmask/NitroInputMaskServiceModule.kt +17 -0
  14. package/android/src/main/java/com/nitroinputmask/NitroInputMaskTextWatcher.kt +127 -0
  15. package/android/src/main/java/com/nitroinputmask/engine/CursorEngine.kt +30 -0
  16. package/android/src/main/java/com/nitroinputmask/engine/MaskEngine.kt +261 -0
  17. package/android/src/main/java/com/nitroinputmask/engine/MaskEngineFactory.kt +18 -0
  18. package/android/src/main/java/com/nitroinputmask/engine/MaskEngineProtocol.kt +8 -0
  19. package/android/src/main/java/com/nitroinputmask/masks/CreditCardMaskEngine.kt +47 -0
  20. package/android/src/main/java/com/nitroinputmask/masks/CustomMaskEngine.kt +16 -0
  21. package/android/src/main/java/com/nitroinputmask/masks/DatetimeMaskEngine.kt +38 -0
  22. package/android/src/main/java/com/nitroinputmask/masks/MoneyMaskEngine.kt +66 -0
  23. package/ios/Bridge.h +8 -0
  24. package/ios/NitroInputMaskDelegateProxy.swift +194 -0
  25. package/ios/NitroInputMaskModule.swift +114 -0
  26. package/ios/NitroInputMaskServiceModule.swift +11 -0
  27. package/ios/engine/CursorEngine.swift +52 -0
  28. package/ios/engine/MaskEngine.swift +221 -0
  29. package/ios/engine/MaskEngineFactory.swift +16 -0
  30. package/ios/engine/MaskEngineProtocol.swift +7 -0
  31. package/ios/masks/CreditCardMaskEngine.swift +57 -0
  32. package/ios/masks/CustomMaskEngine.swift +16 -0
  33. package/ios/masks/DatetimeMaskEngine.swift +46 -0
  34. package/ios/masks/MoneyMaskEngine.swift +66 -0
  35. package/lib/commonjs/classes/NitroInputMaskService/NitroInputMaskService.class.js +74 -0
  36. package/lib/commonjs/classes/NitroInputMaskService/NitroInputMaskService.class.js.map +1 -0
  37. package/lib/commonjs/classes/NitroInputMaskService/index.js +13 -0
  38. package/lib/commonjs/classes/NitroInputMaskService/index.js.map +1 -0
  39. package/lib/commonjs/classes/NitroInputMaskService/types/IApplyMaskProps.js +6 -0
  40. package/lib/commonjs/classes/NitroInputMaskService/types/IApplyMaskProps.js.map +1 -0
  41. package/lib/commonjs/classes/NitroInputMaskService/types/index.js +2 -0
  42. package/lib/commonjs/classes/NitroInputMaskService/types/index.js.map +1 -0
  43. package/lib/commonjs/classes/index.js +17 -0
  44. package/lib/commonjs/classes/index.js.map +1 -0
  45. package/lib/commonjs/components/NitroInputMask/index.js +41 -0
  46. package/lib/commonjs/components/NitroInputMask/index.js.map +1 -0
  47. package/lib/commonjs/components/NitroInputMask/types/NitroInputMaskProps.js +6 -0
  48. package/lib/commonjs/components/NitroInputMask/types/NitroInputMaskProps.js.map +1 -0
  49. package/lib/commonjs/components/NitroInputMask/types/index.js +2 -0
  50. package/lib/commonjs/components/NitroInputMask/types/index.js.map +1 -0
  51. package/lib/commonjs/components/index.js +17 -0
  52. package/lib/commonjs/components/index.js.map +1 -0
  53. package/lib/commonjs/index.js +39 -0
  54. package/lib/commonjs/index.js.map +1 -0
  55. package/lib/commonjs/nitro-module.js +17 -0
  56. package/lib/commonjs/nitro-module.js.map +1 -0
  57. package/lib/commonjs/package.json +1 -0
  58. package/lib/commonjs/specs/nitro-input-mask-service.nitro.js +6 -0
  59. package/lib/commonjs/specs/nitro-input-mask-service.nitro.js.map +1 -0
  60. package/lib/commonjs/specs/nitro-input-mask.nitro.js +6 -0
  61. package/lib/commonjs/specs/nitro-input-mask.nitro.js.map +1 -0
  62. package/lib/commonjs/types/CreditCardMaskOptions.js +2 -0
  63. package/lib/commonjs/types/CreditCardMaskOptions.js.map +1 -0
  64. package/lib/commonjs/types/CustomMaskOptions.js +2 -0
  65. package/lib/commonjs/types/CustomMaskOptions.js.map +1 -0
  66. package/lib/commonjs/types/DatetimeMaskOptions.js +2 -0
  67. package/lib/commonjs/types/DatetimeMaskOptions.js.map +1 -0
  68. package/lib/commonjs/types/MaskConfig.js +6 -0
  69. package/lib/commonjs/types/MaskConfig.js.map +1 -0
  70. package/lib/commonjs/types/MoneyMaskOptions.js +2 -0
  71. package/lib/commonjs/types/MoneyMaskOptions.js.map +1 -0
  72. package/lib/commonjs/types/index.js +2 -0
  73. package/lib/commonjs/types/index.js.map +1 -0
  74. package/lib/module/classes/NitroInputMaskService/NitroInputMaskService.class.js +70 -0
  75. package/lib/module/classes/NitroInputMaskService/NitroInputMaskService.class.js.map +1 -0
  76. package/lib/module/classes/NitroInputMaskService/index.js +4 -0
  77. package/lib/module/classes/NitroInputMaskService/index.js.map +1 -0
  78. package/lib/module/classes/NitroInputMaskService/types/IApplyMaskProps.js +4 -0
  79. package/lib/module/classes/NitroInputMaskService/types/IApplyMaskProps.js.map +1 -0
  80. package/lib/module/classes/NitroInputMaskService/types/index.js +2 -0
  81. package/lib/module/classes/NitroInputMaskService/types/index.js.map +1 -0
  82. package/lib/module/classes/index.js +4 -0
  83. package/lib/module/classes/index.js.map +1 -0
  84. package/lib/module/components/NitroInputMask/index.js +35 -0
  85. package/lib/module/components/NitroInputMask/index.js.map +1 -0
  86. package/lib/module/components/NitroInputMask/types/NitroInputMaskProps.js +4 -0
  87. package/lib/module/components/NitroInputMask/types/NitroInputMaskProps.js.map +1 -0
  88. package/lib/module/components/NitroInputMask/types/index.js +2 -0
  89. package/lib/module/components/NitroInputMask/types/index.js.map +1 -0
  90. package/lib/module/components/index.js +4 -0
  91. package/lib/module/components/index.js.map +1 -0
  92. package/lib/module/index.js +6 -0
  93. package/lib/module/index.js.map +1 -0
  94. package/lib/module/nitro-module.js +12 -0
  95. package/lib/module/nitro-module.js.map +1 -0
  96. package/lib/module/specs/nitro-input-mask-service.nitro.js +4 -0
  97. package/lib/module/specs/nitro-input-mask-service.nitro.js.map +1 -0
  98. package/lib/module/specs/nitro-input-mask.nitro.js +4 -0
  99. package/lib/module/specs/nitro-input-mask.nitro.js.map +1 -0
  100. package/lib/module/types/CreditCardMaskOptions.js +2 -0
  101. package/lib/module/types/CreditCardMaskOptions.js.map +1 -0
  102. package/lib/module/types/CustomMaskOptions.js +2 -0
  103. package/lib/module/types/CustomMaskOptions.js.map +1 -0
  104. package/lib/module/types/DatetimeMaskOptions.js +2 -0
  105. package/lib/module/types/DatetimeMaskOptions.js.map +1 -0
  106. package/lib/module/types/MaskConfig.js +4 -0
  107. package/lib/module/types/MaskConfig.js.map +1 -0
  108. package/lib/module/types/MoneyMaskOptions.js +2 -0
  109. package/lib/module/types/MoneyMaskOptions.js.map +1 -0
  110. package/lib/module/types/index.js +2 -0
  111. package/lib/module/types/index.js.map +1 -0
  112. package/lib/typescript/src/classes/NitroInputMaskService/NitroInputMaskService.class.d.ts +50 -0
  113. package/lib/typescript/src/classes/NitroInputMaskService/NitroInputMaskService.class.d.ts.map +1 -0
  114. package/lib/typescript/src/classes/NitroInputMaskService/index.d.ts +3 -0
  115. package/lib/typescript/src/classes/NitroInputMaskService/index.d.ts.map +1 -0
  116. package/lib/typescript/src/classes/NitroInputMaskService/types/IApplyMaskProps.d.ts +5 -0
  117. package/lib/typescript/src/classes/NitroInputMaskService/types/IApplyMaskProps.d.ts.map +1 -0
  118. package/lib/typescript/src/classes/NitroInputMaskService/types/index.d.ts +2 -0
  119. package/lib/typescript/src/classes/NitroInputMaskService/types/index.d.ts.map +1 -0
  120. package/lib/typescript/src/classes/index.d.ts +2 -0
  121. package/lib/typescript/src/classes/index.d.ts.map +1 -0
  122. package/lib/typescript/src/components/NitroInputMask/index.d.ts +5 -0
  123. package/lib/typescript/src/components/NitroInputMask/index.d.ts.map +1 -0
  124. package/lib/typescript/src/components/NitroInputMask/types/NitroInputMaskProps.d.ts +4 -0
  125. package/lib/typescript/src/components/NitroInputMask/types/NitroInputMaskProps.d.ts.map +1 -0
  126. package/lib/typescript/src/components/NitroInputMask/types/index.d.ts +2 -0
  127. package/lib/typescript/src/components/NitroInputMask/types/index.d.ts.map +1 -0
  128. package/lib/typescript/src/components/index.d.ts +2 -0
  129. package/lib/typescript/src/components/index.d.ts.map +1 -0
  130. package/lib/typescript/src/index.d.ts +4 -0
  131. package/lib/typescript/src/index.d.ts.map +1 -0
  132. package/lib/typescript/src/nitro-module.d.ts +5 -0
  133. package/lib/typescript/src/nitro-module.d.ts.map +1 -0
  134. package/lib/typescript/src/specs/nitro-input-mask-service.nitro.d.ts +9 -0
  135. package/lib/typescript/src/specs/nitro-input-mask-service.nitro.d.ts.map +1 -0
  136. package/lib/typescript/src/specs/nitro-input-mask.nitro.d.ts +23 -0
  137. package/lib/typescript/src/specs/nitro-input-mask.nitro.d.ts.map +1 -0
  138. package/lib/typescript/src/types/CreditCardMaskOptions.d.ts +5 -0
  139. package/lib/typescript/src/types/CreditCardMaskOptions.d.ts.map +1 -0
  140. package/lib/typescript/src/types/CustomMaskOptions.d.ts +4 -0
  141. package/lib/typescript/src/types/CustomMaskOptions.d.ts.map +1 -0
  142. package/lib/typescript/src/types/DatetimeMaskOptions.d.ts +4 -0
  143. package/lib/typescript/src/types/DatetimeMaskOptions.d.ts.map +1 -0
  144. package/lib/typescript/src/types/MaskConfig.d.ts +18 -0
  145. package/lib/typescript/src/types/MaskConfig.d.ts.map +1 -0
  146. package/lib/typescript/src/types/MoneyMaskOptions.d.ts +9 -0
  147. package/lib/typescript/src/types/MoneyMaskOptions.d.ts.map +1 -0
  148. package/lib/typescript/src/types/index.d.ts +6 -0
  149. package/lib/typescript/src/types/index.d.ts.map +1 -0
  150. package/nitro.json +40 -0
  151. package/nitrogen/generated/.gitattributes +1 -0
  152. package/nitrogen/generated/android/NitroInputMask+autolinking.cmake +83 -0
  153. package/nitrogen/generated/android/NitroInputMask+autolinking.gradle +27 -0
  154. package/nitrogen/generated/android/NitroInputMaskOnLoad.cpp +70 -0
  155. package/nitrogen/generated/android/NitroInputMaskOnLoad.hpp +34 -0
  156. package/nitrogen/generated/android/c++/JHybridNitroInputMaskServiceSpec.cpp +57 -0
  157. package/nitrogen/generated/android/c++/JHybridNitroInputMaskServiceSpec.hpp +63 -0
  158. package/nitrogen/generated/android/c++/JHybridNitroInputMaskSpec.cpp +68 -0
  159. package/nitrogen/generated/android/c++/JHybridNitroInputMaskSpec.hpp +66 -0
  160. package/nitrogen/generated/android/c++/JNitroMaskOptions.hpp +94 -0
  161. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinputmask/HybridNitroInputMaskServiceSpec.kt +54 -0
  162. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinputmask/HybridNitroInputMaskSpec.kt +66 -0
  163. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinputmask/NitroInputMaskOnLoad.kt +35 -0
  164. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinputmask/NitroMaskOptions.kt +96 -0
  165. package/nitrogen/generated/ios/NitroInputMask+autolinking.rb +62 -0
  166. package/nitrogen/generated/ios/NitroInputMask-Swift-Cxx-Bridge.cpp +50 -0
  167. package/nitrogen/generated/ios/NitroInputMask-Swift-Cxx-Bridge.hpp +124 -0
  168. package/nitrogen/generated/ios/NitroInputMask-Swift-Cxx-Umbrella.hpp +53 -0
  169. package/nitrogen/generated/ios/NitroInputMaskAutolinking.mm +41 -0
  170. package/nitrogen/generated/ios/NitroInputMaskAutolinking.swift +38 -0
  171. package/nitrogen/generated/ios/c++/HybridNitroInputMaskServiceSpecSwift.cpp +11 -0
  172. package/nitrogen/generated/ios/c++/HybridNitroInputMaskServiceSpecSwift.hpp +85 -0
  173. package/nitrogen/generated/ios/c++/HybridNitroInputMaskSpecSwift.cpp +11 -0
  174. package/nitrogen/generated/ios/c++/HybridNitroInputMaskSpecSwift.hpp +101 -0
  175. package/nitrogen/generated/ios/swift/HybridNitroInputMaskServiceSpec.swift +55 -0
  176. package/nitrogen/generated/ios/swift/HybridNitroInputMaskServiceSpec_cxx.swift +138 -0
  177. package/nitrogen/generated/ios/swift/HybridNitroInputMaskSpec.swift +58 -0
  178. package/nitrogen/generated/ios/swift/HybridNitroInputMaskSpec_cxx.swift +170 -0
  179. package/nitrogen/generated/ios/swift/NitroMaskOptions.swift +204 -0
  180. package/nitrogen/generated/shared/c++/HybridNitroInputMaskServiceSpec.cpp +21 -0
  181. package/nitrogen/generated/shared/c++/HybridNitroInputMaskServiceSpec.hpp +64 -0
  182. package/nitrogen/generated/shared/c++/HybridNitroInputMaskSpec.cpp +24 -0
  183. package/nitrogen/generated/shared/c++/HybridNitroInputMaskSpec.hpp +67 -0
  184. package/nitrogen/generated/shared/c++/NitroMaskOptions.hpp +120 -0
  185. package/package.json +136 -0
  186. package/src/classes/NitroInputMaskService/NitroInputMaskService.class.ts +70 -0
  187. package/src/classes/NitroInputMaskService/index.ts +2 -0
  188. package/src/classes/NitroInputMaskService/types/IApplyMaskProps.ts +3 -0
  189. package/src/classes/NitroInputMaskService/types/index.ts +1 -0
  190. package/src/classes/index.ts +1 -0
  191. package/src/components/NitroInputMask/index.tsx +41 -0
  192. package/src/components/NitroInputMask/types/NitroInputMaskProps.ts +4 -0
  193. package/src/components/NitroInputMask/types/index.ts +1 -0
  194. package/src/components/index.ts +1 -0
  195. package/src/index.ts +3 -0
  196. package/src/nitro-module.ts +14 -0
  197. package/src/specs/nitro-input-mask-service.nitro.ts +6 -0
  198. package/src/specs/nitro-input-mask.nitro.ts +25 -0
  199. package/src/types/CreditCardMaskOptions.ts +4 -0
  200. package/src/types/CustomMaskOptions.ts +3 -0
  201. package/src/types/DatetimeMaskOptions.ts +3 -0
  202. package/src/types/MaskConfig.ts +10 -0
  203. package/src/types/MoneyMaskOptions.ts +8 -0
  204. package/src/types/index.ts +5 -0
@@ -0,0 +1,55 @@
1
+ ///
2
+ /// HybridNitroInputMaskServiceSpec.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
+ /// See ``HybridNitroInputMaskServiceSpec``
11
+ public protocol HybridNitroInputMaskServiceSpec_protocol: HybridObject {
12
+ // Properties
13
+
14
+
15
+ // Methods
16
+ func applyMask(value: String, maskType: String, options: NitroMaskOptions) throws -> String
17
+ }
18
+
19
+ public extension HybridNitroInputMaskServiceSpec_protocol {
20
+ /// Default implementation of ``HybridObject.toString``
21
+ func toString() -> String {
22
+ return "[HybridObject NitroInputMaskService]"
23
+ }
24
+ }
25
+
26
+ /// See ``HybridNitroInputMaskServiceSpec``
27
+ open class HybridNitroInputMaskServiceSpec_base {
28
+ private weak var cxxWrapper: HybridNitroInputMaskServiceSpec_cxx? = nil
29
+ public init() { }
30
+ public func getCxxWrapper() -> HybridNitroInputMaskServiceSpec_cxx {
31
+ #if DEBUG
32
+ guard self is any HybridNitroInputMaskServiceSpec else {
33
+ fatalError("`self` is not a `HybridNitroInputMaskServiceSpec`! Did you accidentally inherit from `HybridNitroInputMaskServiceSpec_base` instead of `HybridNitroInputMaskServiceSpec`?")
34
+ }
35
+ #endif
36
+ if let cxxWrapper = self.cxxWrapper {
37
+ return cxxWrapper
38
+ } else {
39
+ let cxxWrapper = HybridNitroInputMaskServiceSpec_cxx(self as! any HybridNitroInputMaskServiceSpec)
40
+ self.cxxWrapper = cxxWrapper
41
+ return cxxWrapper
42
+ }
43
+ }
44
+ }
45
+
46
+ /**
47
+ * A Swift base-protocol representing the NitroInputMaskService HybridObject.
48
+ * Implement this protocol to create Swift-based instances of NitroInputMaskService.
49
+ * ```swift
50
+ * class HybridNitroInputMaskService : HybridNitroInputMaskServiceSpec {
51
+ * // ...
52
+ * }
53
+ * ```
54
+ */
55
+ public typealias HybridNitroInputMaskServiceSpec = HybridNitroInputMaskServiceSpec_protocol & HybridNitroInputMaskServiceSpec_base
@@ -0,0 +1,138 @@
1
+ ///
2
+ /// HybridNitroInputMaskServiceSpec_cxx.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
+ * A class implementation that bridges HybridNitroInputMaskServiceSpec over to C++.
12
+ * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
13
+ *
14
+ * Also, some Swift types need to be bridged with special handling:
15
+ * - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
16
+ * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
17
+ * - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
18
+ */
19
+ open class HybridNitroInputMaskServiceSpec_cxx {
20
+ /**
21
+ * The Swift <> C++ bridge's namespace (`margelo::nitro::nitroinputmask::bridge::swift`)
22
+ * from `NitroInputMask-Swift-Cxx-Bridge.hpp`.
23
+ * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
24
+ */
25
+ public typealias bridge = margelo.nitro.nitroinputmask.bridge.swift
26
+
27
+ /**
28
+ * Holds an instance of the `HybridNitroInputMaskServiceSpec` Swift protocol.
29
+ */
30
+ private var __implementation: any HybridNitroInputMaskServiceSpec
31
+
32
+ /**
33
+ * Holds a weak pointer to the C++ class that wraps the Swift class.
34
+ */
35
+ private var __cxxPart: bridge.std__weak_ptr_HybridNitroInputMaskServiceSpec_
36
+
37
+ /**
38
+ * Create a new `HybridNitroInputMaskServiceSpec_cxx` that wraps the given `HybridNitroInputMaskServiceSpec`.
39
+ * All properties and methods bridge to C++ types.
40
+ */
41
+ public init(_ implementation: any HybridNitroInputMaskServiceSpec) {
42
+ self.__implementation = implementation
43
+ self.__cxxPart = .init()
44
+ /* no base class */
45
+ }
46
+
47
+ /**
48
+ * Get the actual `HybridNitroInputMaskServiceSpec` instance this class wraps.
49
+ */
50
+ @inline(__always)
51
+ public func getHybridNitroInputMaskServiceSpec() -> any HybridNitroInputMaskServiceSpec {
52
+ return __implementation
53
+ }
54
+
55
+ /**
56
+ * Casts this instance to a retained unsafe raw pointer.
57
+ * This acquires one additional strong reference on the object!
58
+ */
59
+ public func toUnsafe() -> UnsafeMutableRawPointer {
60
+ return Unmanaged.passRetained(self).toOpaque()
61
+ }
62
+
63
+ /**
64
+ * Casts an unsafe pointer to a `HybridNitroInputMaskServiceSpec_cxx`.
65
+ * The pointer has to be a retained opaque `Unmanaged<HybridNitroInputMaskServiceSpec_cxx>`.
66
+ * This removes one strong reference from the object!
67
+ */
68
+ public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridNitroInputMaskServiceSpec_cxx {
69
+ return Unmanaged<HybridNitroInputMaskServiceSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
70
+ }
71
+
72
+ /**
73
+ * Gets (or creates) the C++ part of this Hybrid Object.
74
+ * The C++ part is a `std::shared_ptr<HybridNitroInputMaskServiceSpec>`.
75
+ */
76
+ public func getCxxPart() -> bridge.std__shared_ptr_HybridNitroInputMaskServiceSpec_ {
77
+ let cachedCxxPart = self.__cxxPart.lock()
78
+ if Bool(fromCxx: cachedCxxPart) {
79
+ return cachedCxxPart
80
+ } else {
81
+ let newCxxPart = bridge.create_std__shared_ptr_HybridNitroInputMaskServiceSpec_(self.toUnsafe())
82
+ __cxxPart = bridge.weakify_std__shared_ptr_HybridNitroInputMaskServiceSpec_(newCxxPart)
83
+ return newCxxPart
84
+ }
85
+ }
86
+
87
+
88
+
89
+ /**
90
+ * Get the memory size of the Swift class (plus size of any other allocations)
91
+ * so the JS VM can properly track it and garbage-collect the JS object if needed.
92
+ */
93
+ @inline(__always)
94
+ public var memorySize: Int {
95
+ return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
96
+ }
97
+
98
+ /**
99
+ * Compares this object with the given [other] object for reference equality.
100
+ */
101
+ @inline(__always)
102
+ public func equals(other: HybridNitroInputMaskServiceSpec_cxx) -> Bool {
103
+ return self.__implementation === other.__implementation
104
+ }
105
+
106
+ /**
107
+ * Call dispose() on the Swift class.
108
+ * This _may_ be called manually from JS.
109
+ */
110
+ @inline(__always)
111
+ public func dispose() {
112
+ self.__implementation.dispose()
113
+ }
114
+
115
+ /**
116
+ * Call toString() on the Swift class.
117
+ */
118
+ @inline(__always)
119
+ public func toString() -> String {
120
+ return self.__implementation.toString()
121
+ }
122
+
123
+ // Properties
124
+
125
+
126
+ // Methods
127
+ @inline(__always)
128
+ public final func applyMask(value: std.string, maskType: std.string, options: NitroMaskOptions) -> bridge.Result_std__string_ {
129
+ do {
130
+ let __result = try self.__implementation.applyMask(value: String(value), maskType: String(maskType), options: options)
131
+ let __resultCpp = std.string(__result)
132
+ return bridge.create_Result_std__string_(__resultCpp)
133
+ } catch (let __error) {
134
+ let __exceptionPtr = __error.toCpp()
135
+ return bridge.create_Result_std__string_(__exceptionPtr)
136
+ }
137
+ }
138
+ }
@@ -0,0 +1,58 @@
1
+ ///
2
+ /// HybridNitroInputMaskSpec.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
+ /// See ``HybridNitroInputMaskSpec``
11
+ public protocol HybridNitroInputMaskSpec_protocol: HybridObject {
12
+ // Properties
13
+
14
+
15
+ // Methods
16
+ func attach(nativeID: String, maskType: String, options: NitroMaskOptions) throws -> Void
17
+ func detach(nativeID: String) throws -> Void
18
+ func updateMask(nativeID: String, maskType: String, options: NitroMaskOptions) throws -> Void
19
+ func setValue(nativeID: String, rawValue: String) throws -> Void
20
+ }
21
+
22
+ public extension HybridNitroInputMaskSpec_protocol {
23
+ /// Default implementation of ``HybridObject.toString``
24
+ func toString() -> String {
25
+ return "[HybridObject NitroInputMask]"
26
+ }
27
+ }
28
+
29
+ /// See ``HybridNitroInputMaskSpec``
30
+ open class HybridNitroInputMaskSpec_base {
31
+ private weak var cxxWrapper: HybridNitroInputMaskSpec_cxx? = nil
32
+ public init() { }
33
+ public func getCxxWrapper() -> HybridNitroInputMaskSpec_cxx {
34
+ #if DEBUG
35
+ guard self is any HybridNitroInputMaskSpec else {
36
+ fatalError("`self` is not a `HybridNitroInputMaskSpec`! Did you accidentally inherit from `HybridNitroInputMaskSpec_base` instead of `HybridNitroInputMaskSpec`?")
37
+ }
38
+ #endif
39
+ if let cxxWrapper = self.cxxWrapper {
40
+ return cxxWrapper
41
+ } else {
42
+ let cxxWrapper = HybridNitroInputMaskSpec_cxx(self as! any HybridNitroInputMaskSpec)
43
+ self.cxxWrapper = cxxWrapper
44
+ return cxxWrapper
45
+ }
46
+ }
47
+ }
48
+
49
+ /**
50
+ * A Swift base-protocol representing the NitroInputMask HybridObject.
51
+ * Implement this protocol to create Swift-based instances of NitroInputMask.
52
+ * ```swift
53
+ * class HybridNitroInputMask : HybridNitroInputMaskSpec {
54
+ * // ...
55
+ * }
56
+ * ```
57
+ */
58
+ public typealias HybridNitroInputMaskSpec = HybridNitroInputMaskSpec_protocol & HybridNitroInputMaskSpec_base
@@ -0,0 +1,170 @@
1
+ ///
2
+ /// HybridNitroInputMaskSpec_cxx.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
+ * A class implementation that bridges HybridNitroInputMaskSpec over to C++.
12
+ * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
13
+ *
14
+ * Also, some Swift types need to be bridged with special handling:
15
+ * - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
16
+ * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
17
+ * - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
18
+ */
19
+ open class HybridNitroInputMaskSpec_cxx {
20
+ /**
21
+ * The Swift <> C++ bridge's namespace (`margelo::nitro::nitroinputmask::bridge::swift`)
22
+ * from `NitroInputMask-Swift-Cxx-Bridge.hpp`.
23
+ * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
24
+ */
25
+ public typealias bridge = margelo.nitro.nitroinputmask.bridge.swift
26
+
27
+ /**
28
+ * Holds an instance of the `HybridNitroInputMaskSpec` Swift protocol.
29
+ */
30
+ private var __implementation: any HybridNitroInputMaskSpec
31
+
32
+ /**
33
+ * Holds a weak pointer to the C++ class that wraps the Swift class.
34
+ */
35
+ private var __cxxPart: bridge.std__weak_ptr_HybridNitroInputMaskSpec_
36
+
37
+ /**
38
+ * Create a new `HybridNitroInputMaskSpec_cxx` that wraps the given `HybridNitroInputMaskSpec`.
39
+ * All properties and methods bridge to C++ types.
40
+ */
41
+ public init(_ implementation: any HybridNitroInputMaskSpec) {
42
+ self.__implementation = implementation
43
+ self.__cxxPart = .init()
44
+ /* no base class */
45
+ }
46
+
47
+ /**
48
+ * Get the actual `HybridNitroInputMaskSpec` instance this class wraps.
49
+ */
50
+ @inline(__always)
51
+ public func getHybridNitroInputMaskSpec() -> any HybridNitroInputMaskSpec {
52
+ return __implementation
53
+ }
54
+
55
+ /**
56
+ * Casts this instance to a retained unsafe raw pointer.
57
+ * This acquires one additional strong reference on the object!
58
+ */
59
+ public func toUnsafe() -> UnsafeMutableRawPointer {
60
+ return Unmanaged.passRetained(self).toOpaque()
61
+ }
62
+
63
+ /**
64
+ * Casts an unsafe pointer to a `HybridNitroInputMaskSpec_cxx`.
65
+ * The pointer has to be a retained opaque `Unmanaged<HybridNitroInputMaskSpec_cxx>`.
66
+ * This removes one strong reference from the object!
67
+ */
68
+ public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridNitroInputMaskSpec_cxx {
69
+ return Unmanaged<HybridNitroInputMaskSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
70
+ }
71
+
72
+ /**
73
+ * Gets (or creates) the C++ part of this Hybrid Object.
74
+ * The C++ part is a `std::shared_ptr<HybridNitroInputMaskSpec>`.
75
+ */
76
+ public func getCxxPart() -> bridge.std__shared_ptr_HybridNitroInputMaskSpec_ {
77
+ let cachedCxxPart = self.__cxxPart.lock()
78
+ if Bool(fromCxx: cachedCxxPart) {
79
+ return cachedCxxPart
80
+ } else {
81
+ let newCxxPart = bridge.create_std__shared_ptr_HybridNitroInputMaskSpec_(self.toUnsafe())
82
+ __cxxPart = bridge.weakify_std__shared_ptr_HybridNitroInputMaskSpec_(newCxxPart)
83
+ return newCxxPart
84
+ }
85
+ }
86
+
87
+
88
+
89
+ /**
90
+ * Get the memory size of the Swift class (plus size of any other allocations)
91
+ * so the JS VM can properly track it and garbage-collect the JS object if needed.
92
+ */
93
+ @inline(__always)
94
+ public var memorySize: Int {
95
+ return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
96
+ }
97
+
98
+ /**
99
+ * Compares this object with the given [other] object for reference equality.
100
+ */
101
+ @inline(__always)
102
+ public func equals(other: HybridNitroInputMaskSpec_cxx) -> Bool {
103
+ return self.__implementation === other.__implementation
104
+ }
105
+
106
+ /**
107
+ * Call dispose() on the Swift class.
108
+ * This _may_ be called manually from JS.
109
+ */
110
+ @inline(__always)
111
+ public func dispose() {
112
+ self.__implementation.dispose()
113
+ }
114
+
115
+ /**
116
+ * Call toString() on the Swift class.
117
+ */
118
+ @inline(__always)
119
+ public func toString() -> String {
120
+ return self.__implementation.toString()
121
+ }
122
+
123
+ // Properties
124
+
125
+
126
+ // Methods
127
+ @inline(__always)
128
+ public final func attach(nativeID: std.string, maskType: std.string, options: NitroMaskOptions) -> bridge.Result_void_ {
129
+ do {
130
+ try self.__implementation.attach(nativeID: String(nativeID), maskType: String(maskType), options: options)
131
+ return bridge.create_Result_void_()
132
+ } catch (let __error) {
133
+ let __exceptionPtr = __error.toCpp()
134
+ return bridge.create_Result_void_(__exceptionPtr)
135
+ }
136
+ }
137
+
138
+ @inline(__always)
139
+ public final func detach(nativeID: std.string) -> bridge.Result_void_ {
140
+ do {
141
+ try self.__implementation.detach(nativeID: String(nativeID))
142
+ return bridge.create_Result_void_()
143
+ } catch (let __error) {
144
+ let __exceptionPtr = __error.toCpp()
145
+ return bridge.create_Result_void_(__exceptionPtr)
146
+ }
147
+ }
148
+
149
+ @inline(__always)
150
+ public final func updateMask(nativeID: std.string, maskType: std.string, options: NitroMaskOptions) -> bridge.Result_void_ {
151
+ do {
152
+ try self.__implementation.updateMask(nativeID: String(nativeID), maskType: String(maskType), options: options)
153
+ return bridge.create_Result_void_()
154
+ } catch (let __error) {
155
+ let __exceptionPtr = __error.toCpp()
156
+ return bridge.create_Result_void_(__exceptionPtr)
157
+ }
158
+ }
159
+
160
+ @inline(__always)
161
+ public final func setValue(nativeID: std.string, rawValue: std.string) -> bridge.Result_void_ {
162
+ do {
163
+ try self.__implementation.setValue(nativeID: String(nativeID), rawValue: String(rawValue))
164
+ return bridge.create_Result_void_()
165
+ } catch (let __error) {
166
+ let __exceptionPtr = __error.toCpp()
167
+ return bridge.create_Result_void_(__exceptionPtr)
168
+ }
169
+ }
170
+ }
@@ -0,0 +1,204 @@
1
+ ///
2
+ /// NitroMaskOptions.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 `NitroMaskOptions`, backed by a C++ struct.
12
+ */
13
+ public typealias NitroMaskOptions = margelo.nitro.nitroinputmask.NitroMaskOptions
14
+
15
+ public extension NitroMaskOptions {
16
+ private typealias bridge = margelo.nitro.nitroinputmask.bridge.swift
17
+
18
+ /**
19
+ * Create a new instance of `NitroMaskOptions`.
20
+ */
21
+ init(mask: String?, precision: Double?, separator: String?, delimiter: String?, unit: String?, suffixUnit: String?, zeroCents: Bool?, format: String?, issuer: String?, obfuscated: Bool?) {
22
+ self.init({ () -> bridge.std__optional_std__string_ in
23
+ if let __unwrappedValue = mask {
24
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
25
+ } else {
26
+ return .init()
27
+ }
28
+ }(), { () -> bridge.std__optional_double_ in
29
+ if let __unwrappedValue = precision {
30
+ return bridge.create_std__optional_double_(__unwrappedValue)
31
+ } else {
32
+ return .init()
33
+ }
34
+ }(), { () -> bridge.std__optional_std__string_ in
35
+ if let __unwrappedValue = separator {
36
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
37
+ } else {
38
+ return .init()
39
+ }
40
+ }(), { () -> bridge.std__optional_std__string_ in
41
+ if let __unwrappedValue = delimiter {
42
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
43
+ } else {
44
+ return .init()
45
+ }
46
+ }(), { () -> bridge.std__optional_std__string_ in
47
+ if let __unwrappedValue = unit {
48
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
49
+ } else {
50
+ return .init()
51
+ }
52
+ }(), { () -> bridge.std__optional_std__string_ in
53
+ if let __unwrappedValue = suffixUnit {
54
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
55
+ } else {
56
+ return .init()
57
+ }
58
+ }(), { () -> bridge.std__optional_bool_ in
59
+ if let __unwrappedValue = zeroCents {
60
+ return bridge.create_std__optional_bool_(__unwrappedValue)
61
+ } else {
62
+ return .init()
63
+ }
64
+ }(), { () -> bridge.std__optional_std__string_ in
65
+ if let __unwrappedValue = format {
66
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
67
+ } else {
68
+ return .init()
69
+ }
70
+ }(), { () -> bridge.std__optional_std__string_ in
71
+ if let __unwrappedValue = issuer {
72
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
73
+ } else {
74
+ return .init()
75
+ }
76
+ }(), { () -> bridge.std__optional_bool_ in
77
+ if let __unwrappedValue = obfuscated {
78
+ return bridge.create_std__optional_bool_(__unwrappedValue)
79
+ } else {
80
+ return .init()
81
+ }
82
+ }())
83
+ }
84
+
85
+ @inline(__always)
86
+ var mask: String? {
87
+ return { () -> String? in
88
+ if bridge.has_value_std__optional_std__string_(self.__mask) {
89
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__mask)
90
+ return String(__unwrapped)
91
+ } else {
92
+ return nil
93
+ }
94
+ }()
95
+ }
96
+
97
+ @inline(__always)
98
+ var precision: Double? {
99
+ return { () -> Double? in
100
+ if bridge.has_value_std__optional_double_(self.__precision) {
101
+ let __unwrapped = bridge.get_std__optional_double_(self.__precision)
102
+ return __unwrapped
103
+ } else {
104
+ return nil
105
+ }
106
+ }()
107
+ }
108
+
109
+ @inline(__always)
110
+ var separator: String? {
111
+ return { () -> String? in
112
+ if bridge.has_value_std__optional_std__string_(self.__separator) {
113
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__separator)
114
+ return String(__unwrapped)
115
+ } else {
116
+ return nil
117
+ }
118
+ }()
119
+ }
120
+
121
+ @inline(__always)
122
+ var delimiter: String? {
123
+ return { () -> String? in
124
+ if bridge.has_value_std__optional_std__string_(self.__delimiter) {
125
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__delimiter)
126
+ return String(__unwrapped)
127
+ } else {
128
+ return nil
129
+ }
130
+ }()
131
+ }
132
+
133
+ @inline(__always)
134
+ var unit: String? {
135
+ return { () -> String? in
136
+ if bridge.has_value_std__optional_std__string_(self.__unit) {
137
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__unit)
138
+ return String(__unwrapped)
139
+ } else {
140
+ return nil
141
+ }
142
+ }()
143
+ }
144
+
145
+ @inline(__always)
146
+ var suffixUnit: String? {
147
+ return { () -> String? in
148
+ if bridge.has_value_std__optional_std__string_(self.__suffixUnit) {
149
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__suffixUnit)
150
+ return String(__unwrapped)
151
+ } else {
152
+ return nil
153
+ }
154
+ }()
155
+ }
156
+
157
+ @inline(__always)
158
+ var zeroCents: Bool? {
159
+ return { () -> Bool? in
160
+ if bridge.has_value_std__optional_bool_(self.__zeroCents) {
161
+ let __unwrapped = bridge.get_std__optional_bool_(self.__zeroCents)
162
+ return __unwrapped
163
+ } else {
164
+ return nil
165
+ }
166
+ }()
167
+ }
168
+
169
+ @inline(__always)
170
+ var format: String? {
171
+ return { () -> String? in
172
+ if bridge.has_value_std__optional_std__string_(self.__format) {
173
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__format)
174
+ return String(__unwrapped)
175
+ } else {
176
+ return nil
177
+ }
178
+ }()
179
+ }
180
+
181
+ @inline(__always)
182
+ var issuer: String? {
183
+ return { () -> String? in
184
+ if bridge.has_value_std__optional_std__string_(self.__issuer) {
185
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__issuer)
186
+ return String(__unwrapped)
187
+ } else {
188
+ return nil
189
+ }
190
+ }()
191
+ }
192
+
193
+ @inline(__always)
194
+ var obfuscated: Bool? {
195
+ return { () -> Bool? in
196
+ if bridge.has_value_std__optional_bool_(self.__obfuscated) {
197
+ let __unwrapped = bridge.get_std__optional_bool_(self.__obfuscated)
198
+ return __unwrapped
199
+ } else {
200
+ return nil
201
+ }
202
+ }()
203
+ }
204
+ }
@@ -0,0 +1,21 @@
1
+ ///
2
+ /// HybridNitroInputMaskServiceSpec.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 "HybridNitroInputMaskServiceSpec.hpp"
9
+
10
+ namespace margelo::nitro::nitroinputmask {
11
+
12
+ void HybridNitroInputMaskServiceSpec::loadHybridMethods() {
13
+ // load base methods/properties
14
+ HybridObject::loadHybridMethods();
15
+ // load custom methods/properties
16
+ registerHybrids(this, [](Prototype& prototype) {
17
+ prototype.registerHybridMethod("applyMask", &HybridNitroInputMaskServiceSpec::applyMask);
18
+ });
19
+ }
20
+
21
+ } // namespace margelo::nitro::nitroinputmask