react-native-nitro-input 0.2.0 → 0.3.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 (222) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/README.md +132 -2
  3. package/android/CMakeLists.txt +4 -0
  4. package/android/gradle.properties +1 -1
  5. package/android/src/main/cpp/JReflowEngine.cpp +32 -0
  6. package/android/src/main/cpp/JReflowEngine.hpp +13 -0
  7. package/android/src/main/cpp/JRollingEngine.cpp +43 -2
  8. package/android/src/main/cpp/JRollingEngine.hpp +9 -1
  9. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroInputView.kt +20 -0
  10. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberFormatPlatform.kt +284 -0
  11. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberView.kt +113 -0
  12. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroTextMeasure.kt +25 -0
  13. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroTextView.kt +140 -0
  14. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroInputPackage.kt +2 -1
  15. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroInputView.kt +69 -10
  16. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroNumberView.kt +522 -130
  17. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroTextView.kt +868 -0
  18. package/android/src/main/java/com/margelo/nitro/nitroinput/ReflowEngine.kt +21 -0
  19. package/android/src/main/java/com/margelo/nitro/nitroinput/RollingEngine.kt +14 -2
  20. package/cpp/RollingEngine.cpp +102 -8
  21. package/cpp/RollingEngine.hpp +44 -3
  22. package/cpp/numberformat/HybridNitroNumberFormat.cpp +498 -0
  23. package/cpp/numberformat/HybridNitroNumberFormat.hpp +74 -0
  24. package/cpp/numberformat/HybridNitroNumberFormatFactory.hpp +11 -0
  25. package/cpp/numberformat/NumberFormatCore.cpp +629 -0
  26. package/cpp/numberformat/NumberFormatCore.hpp +154 -0
  27. package/cpp/numberformat/NumberFormatProbe.cpp +354 -0
  28. package/cpp/numberformat/NumberFormatProbe.hpp +63 -0
  29. package/ios/HybridNitroInputView.swift +15 -0
  30. package/ios/HybridNitroNumberFormatPlatform.swift +426 -0
  31. package/ios/HybridNitroNumberView.swift +101 -1
  32. package/ios/HybridNitroTextView.swift +134 -0
  33. package/ios/NitroInputView.swift +79 -19
  34. package/ios/NitroNumberView.swift +520 -147
  35. package/ios/NitroTextView.swift +583 -0
  36. package/lib/commonjs/nitrogen/generated/shared/json/NitroInputViewConfig.json +5 -0
  37. package/lib/commonjs/nitrogen/generated/shared/json/NitroNumberViewConfig.json +26 -0
  38. package/lib/commonjs/nitrogen/generated/shared/json/NitroTextViewConfig.json +30 -0
  39. package/lib/commonjs/src/NitroInput.js +8 -6
  40. package/lib/commonjs/src/NitroNumber.js +54 -3
  41. package/lib/commonjs/src/NitroText.js +138 -0
  42. package/lib/commonjs/src/NitroTime.js +65 -0
  43. package/lib/commonjs/src/NumberFormat.js +525 -0
  44. package/lib/commonjs/src/formatProps.js +108 -0
  45. package/lib/commonjs/src/index.js +8 -1
  46. package/lib/commonjs/src/specs/NitroText.nitro.js +2 -0
  47. package/lib/commonjs/src/specs/NumberFormat.nitro.js +2 -0
  48. package/lib/module/nitrogen/generated/shared/json/NitroInputViewConfig.json +5 -0
  49. package/lib/module/nitrogen/generated/shared/json/NitroNumberViewConfig.json +26 -0
  50. package/lib/module/nitrogen/generated/shared/json/NitroTextViewConfig.json +30 -0
  51. package/lib/module/src/NitroInput.js +8 -6
  52. package/lib/module/src/NitroNumber.js +54 -3
  53. package/lib/module/src/NitroText.js +98 -0
  54. package/lib/module/src/NitroTime.js +29 -0
  55. package/lib/module/src/NumberFormat.js +521 -0
  56. package/lib/module/src/formatProps.js +104 -0
  57. package/lib/module/src/index.js +3 -0
  58. package/lib/module/src/specs/NitroText.nitro.js +1 -0
  59. package/lib/module/src/specs/NumberFormat.nitro.js +1 -0
  60. package/lib/typescript/src/NitroInput.d.ts +22 -0
  61. package/lib/typescript/src/NitroNumber.d.ts +115 -2
  62. package/lib/typescript/src/NitroText.d.ts +67 -0
  63. package/lib/typescript/src/NitroTime.d.ts +19 -0
  64. package/lib/typescript/src/NumberFormat.d.ts +47 -0
  65. package/lib/typescript/src/formatProps.d.ts +47 -0
  66. package/lib/typescript/src/index.d.ts +6 -1
  67. package/lib/typescript/src/specs/NitroInput.nitro.d.ts +10 -0
  68. package/lib/typescript/src/specs/NitroNumber.nitro.d.ts +80 -1
  69. package/lib/typescript/src/specs/NitroText.nitro.d.ts +60 -0
  70. package/lib/typescript/src/specs/NumberFormat.nitro.d.ts +139 -0
  71. package/nitro.json +36 -0
  72. package/nitrogen/generated/android/NitroInput+autolinking.cmake +12 -0
  73. package/nitrogen/generated/android/NitroInputOnLoad.cpp +62 -0
  74. package/nitrogen/generated/android/c++/JHybridNitroInputViewSpec.cpp +45 -0
  75. package/nitrogen/generated/android/c++/JHybridNitroInputViewSpec.hpp +10 -0
  76. package/nitrogen/generated/android/c++/JHybridNitroNumberFormatPlatformSpec.cpp +118 -0
  77. package/nitrogen/generated/android/c++/JHybridNitroNumberFormatPlatformSpec.hpp +64 -0
  78. package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.cpp +297 -0
  79. package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.hpp +52 -0
  80. package/nitrogen/generated/android/c++/JHybridNitroPlatformNumberFormatterSpec.cpp +65 -0
  81. package/nitrogen/generated/android/c++/JHybridNitroPlatformNumberFormatterSpec.hpp +64 -0
  82. package/nitrogen/generated/android/c++/JHybridNitroTextMeasureSpec.cpp +58 -0
  83. package/nitrogen/generated/android/c++/JHybridNitroTextMeasureSpec.hpp +64 -0
  84. package/nitrogen/generated/android/c++/JHybridNitroTextViewSpec.cpp +253 -0
  85. package/nitrogen/generated/android/c++/JHybridNitroTextViewSpec.hpp +104 -0
  86. package/nitrogen/generated/android/c++/JNitroNumberDirection.hpp +3 -0
  87. package/nitrogen/generated/android/c++/JNitroNumberShimmerDirection.hpp +61 -0
  88. package/nitrogen/generated/android/c++/JNitroNumberSignDisplay.hpp +67 -0
  89. package/nitrogen/generated/android/c++/JNumberFormatCompactDisplay.hpp +58 -0
  90. package/nitrogen/generated/android/c++/JNumberFormatCurrencyDisplay.hpp +64 -0
  91. package/nitrogen/generated/android/c++/JNumberFormatCurrencySign.hpp +58 -0
  92. package/nitrogen/generated/android/c++/JNumberFormatNotation.hpp +64 -0
  93. package/nitrogen/generated/android/c++/JNumberFormatPlatformOptions.hpp +161 -0
  94. package/nitrogen/generated/android/c++/JNumberFormatPlatformSymbols.hpp +89 -0
  95. package/nitrogen/generated/android/c++/JNumberFormatRoundingMode.hpp +79 -0
  96. package/nitrogen/generated/android/c++/JNumberFormatSignDisplay.hpp +67 -0
  97. package/nitrogen/generated/android/c++/JNumberFormatStyle.hpp +64 -0
  98. package/nitrogen/generated/android/c++/JNumberFormatUnitDisplay.hpp +61 -0
  99. package/nitrogen/generated/android/c++/views/JHybridNitroInputViewStateUpdater.cpp +25 -0
  100. package/nitrogen/generated/android/c++/views/JHybridNitroNumberViewStateUpdater.cpp +130 -0
  101. package/nitrogen/generated/android/c++/views/JHybridNitroTextViewStateUpdater.cpp +174 -0
  102. package/nitrogen/generated/android/c++/views/JHybridNitroTextViewStateUpdater.hpp +54 -0
  103. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroInputViewSpec.kt +30 -0
  104. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroNumberFormatPlatformSpec.kt +60 -0
  105. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroNumberViewSpec.kt +172 -0
  106. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroPlatformNumberFormatterSpec.kt +62 -0
  107. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroTextMeasureSpec.kt +60 -0
  108. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroTextViewSpec.kt +179 -0
  109. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberDirection.kt +2 -1
  110. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberShimmerDirection.kt +24 -0
  111. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberSignDisplay.kt +26 -0
  112. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatCompactDisplay.kt +23 -0
  113. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatCurrencyDisplay.kt +25 -0
  114. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatCurrencySign.kt +23 -0
  115. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatNotation.kt +25 -0
  116. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatPlatformOptions.kt +136 -0
  117. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatPlatformSymbols.kt +91 -0
  118. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatRoundingMode.kt +30 -0
  119. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatSignDisplay.kt +26 -0
  120. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatStyle.kt +25 -0
  121. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatUnitDisplay.kt +24 -0
  122. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/views/HybridNitroTextViewManager.kt +96 -0
  123. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/views/HybridNitroTextViewStateUpdater.kt +23 -0
  124. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.cpp +68 -0
  125. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.hpp +184 -0
  126. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Umbrella.hpp +56 -0
  127. package/nitrogen/generated/ios/NitroInputAutolinking.mm +34 -0
  128. package/nitrogen/generated/ios/NitroInputAutolinking.swift +36 -0
  129. package/nitrogen/generated/ios/c++/HybridNitroInputViewSpecSwift.hpp +30 -0
  130. package/nitrogen/generated/ios/c++/HybridNitroNumberFormatPlatformSpecSwift.cpp +11 -0
  131. package/nitrogen/generated/ios/c++/HybridNitroNumberFormatPlatformSpecSwift.hpp +122 -0
  132. package/nitrogen/generated/ios/c++/HybridNitroNumberViewSpecSwift.hpp +188 -0
  133. package/nitrogen/generated/ios/c++/HybridNitroPlatformNumberFormatterSpecSwift.cpp +11 -0
  134. package/nitrogen/generated/ios/c++/HybridNitroPlatformNumberFormatterSpecSwift.hpp +94 -0
  135. package/nitrogen/generated/ios/c++/HybridNitroTextMeasureSpecSwift.cpp +11 -0
  136. package/nitrogen/generated/ios/c++/HybridNitroTextMeasureSpecSwift.hpp +90 -0
  137. package/nitrogen/generated/ios/c++/HybridNitroTextViewSpecSwift.cpp +11 -0
  138. package/nitrogen/generated/ios/c++/HybridNitroTextViewSpecSwift.hpp +233 -0
  139. package/nitrogen/generated/ios/c++/views/HybridNitroInputViewComponent.mm +30 -0
  140. package/nitrogen/generated/ios/c++/views/HybridNitroNumberViewComponent.mm +156 -0
  141. package/nitrogen/generated/ios/c++/views/HybridNitroTextViewComponent.mm +264 -0
  142. package/nitrogen/generated/ios/swift/HybridNitroInputViewSpec.swift +5 -0
  143. package/nitrogen/generated/ios/swift/HybridNitroInputViewSpec_cxx.swift +55 -0
  144. package/nitrogen/generated/ios/swift/HybridNitroNumberFormatPlatformSpec.swift +56 -0
  145. package/nitrogen/generated/ios/swift/HybridNitroNumberFormatPlatformSpec_cxx.swift +159 -0
  146. package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec.swift +26 -0
  147. package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec_cxx.swift +658 -21
  148. package/nitrogen/generated/ios/swift/HybridNitroPlatformNumberFormatterSpec.swift +56 -0
  149. package/nitrogen/generated/ios/swift/HybridNitroPlatformNumberFormatterSpec_cxx.swift +155 -0
  150. package/nitrogen/generated/ios/swift/HybridNitroTextMeasureSpec.swift +56 -0
  151. package/nitrogen/generated/ios/swift/HybridNitroTextMeasureSpec_cxx.swift +150 -0
  152. package/nitrogen/generated/ios/swift/HybridNitroTextViewSpec.swift +75 -0
  153. package/nitrogen/generated/ios/swift/HybridNitroTextViewSpec_cxx.swift +608 -0
  154. package/nitrogen/generated/ios/swift/NitroNumberDirection.swift +4 -0
  155. package/nitrogen/generated/ios/swift/NitroNumberShimmerDirection.swift +44 -0
  156. package/nitrogen/generated/ios/swift/NitroNumberSignDisplay.swift +52 -0
  157. package/nitrogen/generated/ios/swift/NumberFormatCompactDisplay.swift +40 -0
  158. package/nitrogen/generated/ios/swift/NumberFormatCurrencyDisplay.swift +48 -0
  159. package/nitrogen/generated/ios/swift/NumberFormatCurrencySign.swift +40 -0
  160. package/nitrogen/generated/ios/swift/NumberFormatNotation.swift +48 -0
  161. package/nitrogen/generated/ios/swift/NumberFormatPlatformOptions.swift +159 -0
  162. package/nitrogen/generated/ios/swift/NumberFormatPlatformSymbols.swift +69 -0
  163. package/nitrogen/generated/ios/swift/NumberFormatRoundingMode.swift +68 -0
  164. package/nitrogen/generated/ios/swift/NumberFormatSignDisplay.swift +52 -0
  165. package/nitrogen/generated/ios/swift/NumberFormatStyle.swift +48 -0
  166. package/nitrogen/generated/ios/swift/NumberFormatUnitDisplay.swift +44 -0
  167. package/nitrogen/generated/shared/c++/HybridNitroInputViewSpec.cpp +10 -0
  168. package/nitrogen/generated/shared/c++/HybridNitroInputViewSpec.hpp +10 -0
  169. package/nitrogen/generated/shared/c++/HybridNitroNumberFormatFactorySpec.cpp +22 -0
  170. package/nitrogen/generated/shared/c++/HybridNitroNumberFormatFactorySpec.hpp +70 -0
  171. package/nitrogen/generated/shared/c++/HybridNitroNumberFormatPlatformSpec.cpp +22 -0
  172. package/nitrogen/generated/shared/c++/HybridNitroNumberFormatPlatformSpec.hpp +70 -0
  173. package/nitrogen/generated/shared/c++/HybridNitroNumberFormatSpec.cpp +23 -0
  174. package/nitrogen/generated/shared/c++/HybridNitroNumberFormatSpec.hpp +71 -0
  175. package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.cpp +52 -0
  176. package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.hpp +58 -0
  177. package/nitrogen/generated/shared/c++/HybridNitroPlatformNumberFormatterSpec.cpp +23 -0
  178. package/nitrogen/generated/shared/c++/HybridNitroPlatformNumberFormatterSpec.hpp +65 -0
  179. package/nitrogen/generated/shared/c++/HybridNitroTextMeasureSpec.cpp +22 -0
  180. package/nitrogen/generated/shared/c++/HybridNitroTextMeasureSpec.hpp +63 -0
  181. package/nitrogen/generated/shared/c++/HybridNitroTextViewSpec.cpp +62 -0
  182. package/nitrogen/generated/shared/c++/HybridNitroTextViewSpec.hpp +115 -0
  183. package/nitrogen/generated/shared/c++/NitroNumberDirection.hpp +4 -0
  184. package/nitrogen/generated/shared/c++/NitroNumberShimmerDirection.hpp +80 -0
  185. package/nitrogen/generated/shared/c++/NitroNumberSignDisplay.hpp +88 -0
  186. package/nitrogen/generated/shared/c++/NumberFormatCompactDisplay.hpp +76 -0
  187. package/nitrogen/generated/shared/c++/NumberFormatCurrencyDisplay.hpp +84 -0
  188. package/nitrogen/generated/shared/c++/NumberFormatCurrencySign.hpp +76 -0
  189. package/nitrogen/generated/shared/c++/NumberFormatGrouping.hpp +80 -0
  190. package/nitrogen/generated/shared/c++/NumberFormatNotation.hpp +84 -0
  191. package/nitrogen/generated/shared/c++/NumberFormatOptions.hpp +193 -0
  192. package/nitrogen/generated/shared/c++/NumberFormatPart.hpp +87 -0
  193. package/nitrogen/generated/shared/c++/NumberFormatPlatformOptions.hpp +176 -0
  194. package/nitrogen/generated/shared/c++/NumberFormatPlatformSymbols.hpp +115 -0
  195. package/nitrogen/generated/shared/c++/NumberFormatRoundingMode.hpp +104 -0
  196. package/nitrogen/generated/shared/c++/NumberFormatRoundingPriority.hpp +80 -0
  197. package/nitrogen/generated/shared/c++/NumberFormatSignDisplay.hpp +88 -0
  198. package/nitrogen/generated/shared/c++/NumberFormatStyle.hpp +84 -0
  199. package/nitrogen/generated/shared/c++/NumberFormatTrailingZeroDisplay.hpp +76 -0
  200. package/nitrogen/generated/shared/c++/NumberFormatUnitDisplay.hpp +80 -0
  201. package/nitrogen/generated/shared/c++/ResolvedNumberFormatOptions.hpp +197 -0
  202. package/nitrogen/generated/shared/c++/views/HybridNitroInputViewComponent.cpp +10 -0
  203. package/nitrogen/generated/shared/c++/views/HybridNitroInputViewComponent.hpp +15 -0
  204. package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.cpp +52 -0
  205. package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.hpp +80 -0
  206. package/nitrogen/generated/shared/c++/views/HybridNitroTextViewComponent.cpp +74 -0
  207. package/nitrogen/generated/shared/c++/views/HybridNitroTextViewComponent.hpp +149 -0
  208. package/nitrogen/generated/shared/json/NitroInputViewConfig.json +5 -0
  209. package/nitrogen/generated/shared/json/NitroNumberViewConfig.json +26 -0
  210. package/nitrogen/generated/shared/json/NitroTextViewConfig.json +30 -0
  211. package/package.json +2 -2
  212. package/src/NitroInput.tsx +42 -7
  213. package/src/NitroNumber.tsx +236 -12
  214. package/src/NitroText.tsx +166 -0
  215. package/src/NitroTime.tsx +68 -0
  216. package/src/NumberFormat.ts +563 -0
  217. package/src/formatProps.ts +149 -0
  218. package/src/index.ts +23 -0
  219. package/src/specs/NitroInput.nitro.ts +10 -0
  220. package/src/specs/NitroNumber.nitro.ts +82 -1
  221. package/src/specs/NitroText.nitro.ts +65 -0
  222. package/src/specs/NumberFormat.nitro.ts +145 -0
@@ -0,0 +1,56 @@
1
+ ///
2
+ /// HybridNitroPlatformNumberFormatterSpec.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 ``HybridNitroPlatformNumberFormatterSpec``
11
+ public protocol HybridNitroPlatformNumberFormatterSpec_protocol: HybridObject {
12
+ // Properties
13
+ var symbols: NumberFormatPlatformSymbols { get }
14
+
15
+ // Methods
16
+ func format(value: Double) throws -> String
17
+ func formatDecimal(value: String) throws -> String
18
+ }
19
+
20
+ public extension HybridNitroPlatformNumberFormatterSpec_protocol {
21
+ /// Default implementation of ``HybridObject.toString``
22
+ func toString() -> String {
23
+ return "[HybridObject NitroPlatformNumberFormatter]"
24
+ }
25
+ }
26
+
27
+ /// See ``HybridNitroPlatformNumberFormatterSpec``
28
+ open class HybridNitroPlatformNumberFormatterSpec_base {
29
+ private weak var cxxWrapper: HybridNitroPlatformNumberFormatterSpec_cxx? = nil
30
+ public init() { }
31
+ public func getCxxWrapper() -> HybridNitroPlatformNumberFormatterSpec_cxx {
32
+ #if DEBUG
33
+ guard self is any HybridNitroPlatformNumberFormatterSpec else {
34
+ fatalError("`self` is not a `HybridNitroPlatformNumberFormatterSpec`! Did you accidentally inherit from `HybridNitroPlatformNumberFormatterSpec_base` instead of `HybridNitroPlatformNumberFormatterSpec`?")
35
+ }
36
+ #endif
37
+ if let cxxWrapper = self.cxxWrapper {
38
+ return cxxWrapper
39
+ } else {
40
+ let cxxWrapper = HybridNitroPlatformNumberFormatterSpec_cxx(self as! any HybridNitroPlatformNumberFormatterSpec)
41
+ self.cxxWrapper = cxxWrapper
42
+ return cxxWrapper
43
+ }
44
+ }
45
+ }
46
+
47
+ /**
48
+ * A Swift base-protocol representing the NitroPlatformNumberFormatter HybridObject.
49
+ * Implement this protocol to create Swift-based instances of NitroPlatformNumberFormatter.
50
+ * ```swift
51
+ * class HybridNitroPlatformNumberFormatter : HybridNitroPlatformNumberFormatterSpec {
52
+ * // ...
53
+ * }
54
+ * ```
55
+ */
56
+ public typealias HybridNitroPlatformNumberFormatterSpec = HybridNitroPlatformNumberFormatterSpec_protocol & HybridNitroPlatformNumberFormatterSpec_base
@@ -0,0 +1,155 @@
1
+ ///
2
+ /// HybridNitroPlatformNumberFormatterSpec_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 HybridNitroPlatformNumberFormatterSpec 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 HybridNitroPlatformNumberFormatterSpec_cxx {
20
+ /**
21
+ * The Swift <> C++ bridge's namespace (`margelo::nitro::nitroinput::bridge::swift`)
22
+ * from `NitroInput-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.nitroinput.bridge.swift
26
+
27
+ /**
28
+ * Holds an instance of the `HybridNitroPlatformNumberFormatterSpec` Swift protocol.
29
+ */
30
+ private var __implementation: any HybridNitroPlatformNumberFormatterSpec
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_HybridNitroPlatformNumberFormatterSpec_
36
+
37
+ /**
38
+ * Create a new `HybridNitroPlatformNumberFormatterSpec_cxx` that wraps the given `HybridNitroPlatformNumberFormatterSpec`.
39
+ * All properties and methods bridge to C++ types.
40
+ */
41
+ public init(_ implementation: any HybridNitroPlatformNumberFormatterSpec) {
42
+ self.__implementation = implementation
43
+ self.__cxxPart = .init()
44
+ /* no base class */
45
+ }
46
+
47
+ /**
48
+ * Get the actual `HybridNitroPlatformNumberFormatterSpec` instance this class wraps.
49
+ */
50
+ @inline(__always)
51
+ public func getHybridNitroPlatformNumberFormatterSpec() -> any HybridNitroPlatformNumberFormatterSpec {
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 `HybridNitroPlatformNumberFormatterSpec_cxx`.
65
+ * The pointer has to be a retained opaque `Unmanaged<HybridNitroPlatformNumberFormatterSpec_cxx>`.
66
+ * This removes one strong reference from the object!
67
+ */
68
+ public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridNitroPlatformNumberFormatterSpec_cxx {
69
+ return Unmanaged<HybridNitroPlatformNumberFormatterSpec_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<HybridNitroPlatformNumberFormatterSpec>`.
75
+ */
76
+ public func getCxxPart() -> bridge.std__shared_ptr_HybridNitroPlatformNumberFormatterSpec_ {
77
+ let cachedCxxPart = self.__cxxPart.lock()
78
+ if Bool(fromCxx: cachedCxxPart) {
79
+ return cachedCxxPart
80
+ } else {
81
+ let newCxxPart = bridge.create_std__shared_ptr_HybridNitroPlatformNumberFormatterSpec_(self.toUnsafe())
82
+ __cxxPart = bridge.weakify_std__shared_ptr_HybridNitroPlatformNumberFormatterSpec_(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: HybridNitroPlatformNumberFormatterSpec_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
+ public final var symbols: NumberFormatPlatformSymbols {
125
+ @inline(__always)
126
+ get {
127
+ return self.__implementation.symbols
128
+ }
129
+ }
130
+
131
+ // Methods
132
+ @inline(__always)
133
+ public final func format(value: Double) -> bridge.Result_std__string_ {
134
+ do {
135
+ let __result = try self.__implementation.format(value: value)
136
+ let __resultCpp = std.string(__result)
137
+ return bridge.create_Result_std__string_(__resultCpp)
138
+ } catch (let __error) {
139
+ let __exceptionPtr = __error.toCpp()
140
+ return bridge.create_Result_std__string_(__exceptionPtr)
141
+ }
142
+ }
143
+
144
+ @inline(__always)
145
+ public final func formatDecimal(value: std.string) -> bridge.Result_std__string_ {
146
+ do {
147
+ let __result = try self.__implementation.formatDecimal(value: String(value))
148
+ let __resultCpp = std.string(__result)
149
+ return bridge.create_Result_std__string_(__resultCpp)
150
+ } catch (let __error) {
151
+ let __exceptionPtr = __error.toCpp()
152
+ return bridge.create_Result_std__string_(__exceptionPtr)
153
+ }
154
+ }
155
+ }
@@ -0,0 +1,56 @@
1
+ ///
2
+ /// HybridNitroTextMeasureSpec.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 ``HybridNitroTextMeasureSpec``
11
+ public protocol HybridNitroTextMeasureSpec_protocol: HybridObject {
12
+ // Properties
13
+
14
+
15
+ // Methods
16
+ func measure(text: String, fontSize: Double, fontWeight: Double, fontFamily: String, letterSpacing: Double) throws -> Double
17
+ func lineHeight(fontSize: Double, fontWeight: Double, fontFamily: String) throws -> Double
18
+ }
19
+
20
+ public extension HybridNitroTextMeasureSpec_protocol {
21
+ /// Default implementation of ``HybridObject.toString``
22
+ func toString() -> String {
23
+ return "[HybridObject NitroTextMeasure]"
24
+ }
25
+ }
26
+
27
+ /// See ``HybridNitroTextMeasureSpec``
28
+ open class HybridNitroTextMeasureSpec_base {
29
+ private weak var cxxWrapper: HybridNitroTextMeasureSpec_cxx? = nil
30
+ public init() { }
31
+ public func getCxxWrapper() -> HybridNitroTextMeasureSpec_cxx {
32
+ #if DEBUG
33
+ guard self is any HybridNitroTextMeasureSpec else {
34
+ fatalError("`self` is not a `HybridNitroTextMeasureSpec`! Did you accidentally inherit from `HybridNitroTextMeasureSpec_base` instead of `HybridNitroTextMeasureSpec`?")
35
+ }
36
+ #endif
37
+ if let cxxWrapper = self.cxxWrapper {
38
+ return cxxWrapper
39
+ } else {
40
+ let cxxWrapper = HybridNitroTextMeasureSpec_cxx(self as! any HybridNitroTextMeasureSpec)
41
+ self.cxxWrapper = cxxWrapper
42
+ return cxxWrapper
43
+ }
44
+ }
45
+ }
46
+
47
+ /**
48
+ * A Swift base-protocol representing the NitroTextMeasure HybridObject.
49
+ * Implement this protocol to create Swift-based instances of NitroTextMeasure.
50
+ * ```swift
51
+ * class HybridNitroTextMeasure : HybridNitroTextMeasureSpec {
52
+ * // ...
53
+ * }
54
+ * ```
55
+ */
56
+ public typealias HybridNitroTextMeasureSpec = HybridNitroTextMeasureSpec_protocol & HybridNitroTextMeasureSpec_base
@@ -0,0 +1,150 @@
1
+ ///
2
+ /// HybridNitroTextMeasureSpec_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 HybridNitroTextMeasureSpec 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 HybridNitroTextMeasureSpec_cxx {
20
+ /**
21
+ * The Swift <> C++ bridge's namespace (`margelo::nitro::nitroinput::bridge::swift`)
22
+ * from `NitroInput-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.nitroinput.bridge.swift
26
+
27
+ /**
28
+ * Holds an instance of the `HybridNitroTextMeasureSpec` Swift protocol.
29
+ */
30
+ private var __implementation: any HybridNitroTextMeasureSpec
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_HybridNitroTextMeasureSpec_
36
+
37
+ /**
38
+ * Create a new `HybridNitroTextMeasureSpec_cxx` that wraps the given `HybridNitroTextMeasureSpec`.
39
+ * All properties and methods bridge to C++ types.
40
+ */
41
+ public init(_ implementation: any HybridNitroTextMeasureSpec) {
42
+ self.__implementation = implementation
43
+ self.__cxxPart = .init()
44
+ /* no base class */
45
+ }
46
+
47
+ /**
48
+ * Get the actual `HybridNitroTextMeasureSpec` instance this class wraps.
49
+ */
50
+ @inline(__always)
51
+ public func getHybridNitroTextMeasureSpec() -> any HybridNitroTextMeasureSpec {
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 `HybridNitroTextMeasureSpec_cxx`.
65
+ * The pointer has to be a retained opaque `Unmanaged<HybridNitroTextMeasureSpec_cxx>`.
66
+ * This removes one strong reference from the object!
67
+ */
68
+ public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridNitroTextMeasureSpec_cxx {
69
+ return Unmanaged<HybridNitroTextMeasureSpec_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<HybridNitroTextMeasureSpec>`.
75
+ */
76
+ public func getCxxPart() -> bridge.std__shared_ptr_HybridNitroTextMeasureSpec_ {
77
+ let cachedCxxPart = self.__cxxPart.lock()
78
+ if Bool(fromCxx: cachedCxxPart) {
79
+ return cachedCxxPart
80
+ } else {
81
+ let newCxxPart = bridge.create_std__shared_ptr_HybridNitroTextMeasureSpec_(self.toUnsafe())
82
+ __cxxPart = bridge.weakify_std__shared_ptr_HybridNitroTextMeasureSpec_(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: HybridNitroTextMeasureSpec_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 measure(text: std.string, fontSize: Double, fontWeight: Double, fontFamily: std.string, letterSpacing: Double) -> bridge.Result_double_ {
129
+ do {
130
+ let __result = try self.__implementation.measure(text: String(text), fontSize: fontSize, fontWeight: fontWeight, fontFamily: String(fontFamily), letterSpacing: letterSpacing)
131
+ let __resultCpp = __result
132
+ return bridge.create_Result_double_(__resultCpp)
133
+ } catch (let __error) {
134
+ let __exceptionPtr = __error.toCpp()
135
+ return bridge.create_Result_double_(__exceptionPtr)
136
+ }
137
+ }
138
+
139
+ @inline(__always)
140
+ public final func lineHeight(fontSize: Double, fontWeight: Double, fontFamily: std.string) -> bridge.Result_double_ {
141
+ do {
142
+ let __result = try self.__implementation.lineHeight(fontSize: fontSize, fontWeight: fontWeight, fontFamily: String(fontFamily))
143
+ let __resultCpp = __result
144
+ return bridge.create_Result_double_(__resultCpp)
145
+ } catch (let __error) {
146
+ let __exceptionPtr = __error.toCpp()
147
+ return bridge.create_Result_double_(__exceptionPtr)
148
+ }
149
+ }
150
+ }
@@ -0,0 +1,75 @@
1
+ ///
2
+ /// HybridNitroTextViewSpec.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 ``HybridNitroTextViewSpec``
11
+ public protocol HybridNitroTextViewSpec_protocol: HybridObject, HybridView {
12
+ // Properties
13
+ var text: String { get set }
14
+ var fontSize: Double? { get set }
15
+ var fontWeight: Double? { get set }
16
+ var fontFamily: String? { get set }
17
+ var color: Double? { get set }
18
+ var letterSpacing: Double? { get set }
19
+ var textAlign: NitroNumberTextAlign? { get set }
20
+ var rightToLeft: Bool? { get set }
21
+ var duration: Double? { get set }
22
+ var easing: NitroInputEasing? { get set }
23
+ var bounce: Double? { get set }
24
+ var effect: NitroInputEffect? { get set }
25
+ var respectReduceMotion: Bool? { get set }
26
+ var loading: Bool? { get set }
27
+ var shimmerColor: Double? { get set }
28
+ var shimmerDuration: Double? { get set }
29
+ var shimmerAngle: Double? { get set }
30
+ var shimmerWidth: Double? { get set }
31
+ var shimmerBaseColor: Double? { get set }
32
+ var shimmerDirection: NitroNumberShimmerDirection? { get set }
33
+ var shimmerDelay: Double? { get set }
34
+
35
+ // Methods
36
+
37
+ }
38
+
39
+ public extension HybridNitroTextViewSpec_protocol {
40
+ /// Default implementation of ``HybridObject.toString``
41
+ func toString() -> String {
42
+ return "[HybridObject NitroTextView]"
43
+ }
44
+ }
45
+
46
+ /// See ``HybridNitroTextViewSpec``
47
+ open class HybridNitroTextViewSpec_base {
48
+ private weak var cxxWrapper: HybridNitroTextViewSpec_cxx? = nil
49
+ public init() { }
50
+ public func getCxxWrapper() -> HybridNitroTextViewSpec_cxx {
51
+ #if DEBUG
52
+ guard self is any HybridNitroTextViewSpec else {
53
+ fatalError("`self` is not a `HybridNitroTextViewSpec`! Did you accidentally inherit from `HybridNitroTextViewSpec_base` instead of `HybridNitroTextViewSpec`?")
54
+ }
55
+ #endif
56
+ if let cxxWrapper = self.cxxWrapper {
57
+ return cxxWrapper
58
+ } else {
59
+ let cxxWrapper = HybridNitroTextViewSpec_cxx(self as! any HybridNitroTextViewSpec)
60
+ self.cxxWrapper = cxxWrapper
61
+ return cxxWrapper
62
+ }
63
+ }
64
+ }
65
+
66
+ /**
67
+ * A Swift base-protocol representing the NitroTextView HybridObject.
68
+ * Implement this protocol to create Swift-based instances of NitroTextView.
69
+ * ```swift
70
+ * class HybridNitroTextView : HybridNitroTextViewSpec {
71
+ * // ...
72
+ * }
73
+ * ```
74
+ */
75
+ public typealias HybridNitroTextViewSpec = HybridNitroTextViewSpec_protocol & HybridNitroTextViewSpec_base