react-native-nitro-input 0.2.0 → 0.3.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 (164) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +43 -1
  3. package/android/CMakeLists.txt +4 -0
  4. package/android/gradle.properties +1 -1
  5. package/android/src/main/cpp/JRollingEngine.cpp +3 -2
  6. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroInputView.kt +20 -0
  7. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberFormatPlatform.kt +209 -0
  8. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberView.kt +25 -0
  9. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroInputView.kt +69 -10
  10. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroNumberView.kt +164 -24
  11. package/android/src/main/java/com/margelo/nitro/nitroinput/RollingEngine.kt +2 -1
  12. package/cpp/RollingEngine.cpp +12 -2
  13. package/cpp/RollingEngine.hpp +8 -1
  14. package/cpp/numberformat/HybridNitroNumberFormat.cpp +498 -0
  15. package/cpp/numberformat/HybridNitroNumberFormat.hpp +74 -0
  16. package/cpp/numberformat/HybridNitroNumberFormatFactory.hpp +11 -0
  17. package/cpp/numberformat/NumberFormatCore.cpp +629 -0
  18. package/cpp/numberformat/NumberFormatCore.hpp +154 -0
  19. package/cpp/numberformat/NumberFormatProbe.cpp +354 -0
  20. package/cpp/numberformat/NumberFormatProbe.hpp +63 -0
  21. package/ios/HybridNitroInputView.swift +15 -0
  22. package/ios/HybridNitroNumberFormatPlatform.swift +348 -0
  23. package/ios/HybridNitroNumberView.swift +19 -0
  24. package/ios/NitroInputView.swift +79 -19
  25. package/ios/NitroNumberView.swift +171 -31
  26. package/lib/commonjs/nitrogen/generated/shared/json/NitroInputViewConfig.json +5 -0
  27. package/lib/commonjs/nitrogen/generated/shared/json/NitroNumberViewConfig.json +6 -0
  28. package/lib/commonjs/src/NitroInput.js +8 -6
  29. package/lib/commonjs/src/NitroNumber.js +4 -2
  30. package/lib/commonjs/src/NumberFormat.js +525 -0
  31. package/lib/commonjs/src/formatProps.js +48 -0
  32. package/lib/commonjs/src/index.js +3 -1
  33. package/lib/commonjs/src/specs/NumberFormat.nitro.js +2 -0
  34. package/lib/module/nitrogen/generated/shared/json/NitroInputViewConfig.json +5 -0
  35. package/lib/module/nitrogen/generated/shared/json/NitroNumberViewConfig.json +6 -0
  36. package/lib/module/src/NitroInput.js +8 -6
  37. package/lib/module/src/NitroNumber.js +4 -2
  38. package/lib/module/src/NumberFormat.js +521 -0
  39. package/lib/module/src/formatProps.js +45 -0
  40. package/lib/module/src/index.js +1 -0
  41. package/lib/module/src/specs/NumberFormat.nitro.js +1 -0
  42. package/lib/typescript/src/NitroInput.d.ts +22 -0
  43. package/lib/typescript/src/NitroNumber.d.ts +36 -1
  44. package/lib/typescript/src/NumberFormat.d.ts +47 -0
  45. package/lib/typescript/src/formatProps.d.ts +21 -0
  46. package/lib/typescript/src/index.d.ts +2 -0
  47. package/lib/typescript/src/specs/NitroInput.nitro.d.ts +10 -0
  48. package/lib/typescript/src/specs/NitroNumber.nitro.d.ts +13 -1
  49. package/lib/typescript/src/specs/NumberFormat.nitro.d.ts +139 -0
  50. package/nitro.json +16 -0
  51. package/nitrogen/generated/android/NitroInput+autolinking.cmake +6 -0
  52. package/nitrogen/generated/android/NitroInputOnLoad.cpp +28 -0
  53. package/nitrogen/generated/android/c++/JHybridNitroInputViewSpec.cpp +45 -0
  54. package/nitrogen/generated/android/c++/JHybridNitroInputViewSpec.hpp +10 -0
  55. package/nitrogen/generated/android/c++/JHybridNitroNumberFormatPlatformSpec.cpp +118 -0
  56. package/nitrogen/generated/android/c++/JHybridNitroNumberFormatPlatformSpec.hpp +64 -0
  57. package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.cpp +54 -0
  58. package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.hpp +12 -0
  59. package/nitrogen/generated/android/c++/JHybridNitroPlatformNumberFormatterSpec.cpp +65 -0
  60. package/nitrogen/generated/android/c++/JHybridNitroPlatformNumberFormatterSpec.hpp +64 -0
  61. package/nitrogen/generated/android/c++/JNitroNumberDirection.hpp +3 -0
  62. package/nitrogen/generated/android/c++/JNumberFormatCompactDisplay.hpp +58 -0
  63. package/nitrogen/generated/android/c++/JNumberFormatCurrencyDisplay.hpp +64 -0
  64. package/nitrogen/generated/android/c++/JNumberFormatCurrencySign.hpp +58 -0
  65. package/nitrogen/generated/android/c++/JNumberFormatNotation.hpp +64 -0
  66. package/nitrogen/generated/android/c++/JNumberFormatPlatformOptions.hpp +161 -0
  67. package/nitrogen/generated/android/c++/JNumberFormatPlatformSymbols.hpp +89 -0
  68. package/nitrogen/generated/android/c++/JNumberFormatRoundingMode.hpp +79 -0
  69. package/nitrogen/generated/android/c++/JNumberFormatSignDisplay.hpp +67 -0
  70. package/nitrogen/generated/android/c++/JNumberFormatStyle.hpp +64 -0
  71. package/nitrogen/generated/android/c++/JNumberFormatUnitDisplay.hpp +61 -0
  72. package/nitrogen/generated/android/c++/views/JHybridNitroInputViewStateUpdater.cpp +25 -0
  73. package/nitrogen/generated/android/c++/views/JHybridNitroNumberViewStateUpdater.cpp +30 -0
  74. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroInputViewSpec.kt +30 -0
  75. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroNumberFormatPlatformSpec.kt +60 -0
  76. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroNumberViewSpec.kt +36 -0
  77. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroPlatformNumberFormatterSpec.kt +62 -0
  78. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberDirection.kt +2 -1
  79. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatCompactDisplay.kt +23 -0
  80. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatCurrencyDisplay.kt +25 -0
  81. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatCurrencySign.kt +23 -0
  82. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatNotation.kt +25 -0
  83. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatPlatformOptions.kt +136 -0
  84. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatPlatformSymbols.kt +91 -0
  85. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatRoundingMode.kt +30 -0
  86. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatSignDisplay.kt +26 -0
  87. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatStyle.kt +25 -0
  88. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatUnitDisplay.kt +24 -0
  89. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.cpp +34 -0
  90. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.hpp +63 -0
  91. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Umbrella.hpp +40 -0
  92. package/nitrogen/generated/ios/NitroInputAutolinking.mm +18 -0
  93. package/nitrogen/generated/ios/NitroInputAutolinking.swift +12 -0
  94. package/nitrogen/generated/ios/c++/HybridNitroInputViewSpecSwift.hpp +30 -0
  95. package/nitrogen/generated/ios/c++/HybridNitroNumberFormatPlatformSpecSwift.cpp +11 -0
  96. package/nitrogen/generated/ios/c++/HybridNitroNumberFormatPlatformSpecSwift.hpp +122 -0
  97. package/nitrogen/generated/ios/c++/HybridNitroNumberViewSpecSwift.hpp +42 -0
  98. package/nitrogen/generated/ios/c++/HybridNitroPlatformNumberFormatterSpecSwift.cpp +11 -0
  99. package/nitrogen/generated/ios/c++/HybridNitroPlatformNumberFormatterSpecSwift.hpp +94 -0
  100. package/nitrogen/generated/ios/c++/views/HybridNitroInputViewComponent.mm +30 -0
  101. package/nitrogen/generated/ios/c++/views/HybridNitroNumberViewComponent.mm +36 -0
  102. package/nitrogen/generated/ios/swift/HybridNitroInputViewSpec.swift +5 -0
  103. package/nitrogen/generated/ios/swift/HybridNitroInputViewSpec_cxx.swift +55 -0
  104. package/nitrogen/generated/ios/swift/HybridNitroNumberFormatPlatformSpec.swift +56 -0
  105. package/nitrogen/generated/ios/swift/HybridNitroNumberFormatPlatformSpec_cxx.swift +159 -0
  106. package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec.swift +6 -0
  107. package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec_cxx.swift +144 -0
  108. package/nitrogen/generated/ios/swift/HybridNitroPlatformNumberFormatterSpec.swift +56 -0
  109. package/nitrogen/generated/ios/swift/HybridNitroPlatformNumberFormatterSpec_cxx.swift +155 -0
  110. package/nitrogen/generated/ios/swift/NitroNumberDirection.swift +4 -0
  111. package/nitrogen/generated/ios/swift/NumberFormatCompactDisplay.swift +40 -0
  112. package/nitrogen/generated/ios/swift/NumberFormatCurrencyDisplay.swift +48 -0
  113. package/nitrogen/generated/ios/swift/NumberFormatCurrencySign.swift +40 -0
  114. package/nitrogen/generated/ios/swift/NumberFormatNotation.swift +48 -0
  115. package/nitrogen/generated/ios/swift/NumberFormatPlatformOptions.swift +159 -0
  116. package/nitrogen/generated/ios/swift/NumberFormatPlatformSymbols.swift +69 -0
  117. package/nitrogen/generated/ios/swift/NumberFormatRoundingMode.swift +68 -0
  118. package/nitrogen/generated/ios/swift/NumberFormatSignDisplay.swift +52 -0
  119. package/nitrogen/generated/ios/swift/NumberFormatStyle.swift +48 -0
  120. package/nitrogen/generated/ios/swift/NumberFormatUnitDisplay.swift +44 -0
  121. package/nitrogen/generated/shared/c++/HybridNitroInputViewSpec.cpp +10 -0
  122. package/nitrogen/generated/shared/c++/HybridNitroInputViewSpec.hpp +10 -0
  123. package/nitrogen/generated/shared/c++/HybridNitroNumberFormatFactorySpec.cpp +22 -0
  124. package/nitrogen/generated/shared/c++/HybridNitroNumberFormatFactorySpec.hpp +70 -0
  125. package/nitrogen/generated/shared/c++/HybridNitroNumberFormatPlatformSpec.cpp +22 -0
  126. package/nitrogen/generated/shared/c++/HybridNitroNumberFormatPlatformSpec.hpp +70 -0
  127. package/nitrogen/generated/shared/c++/HybridNitroNumberFormatSpec.cpp +23 -0
  128. package/nitrogen/generated/shared/c++/HybridNitroNumberFormatSpec.hpp +71 -0
  129. package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.cpp +12 -0
  130. package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.hpp +12 -0
  131. package/nitrogen/generated/shared/c++/HybridNitroPlatformNumberFormatterSpec.cpp +23 -0
  132. package/nitrogen/generated/shared/c++/HybridNitroPlatformNumberFormatterSpec.hpp +65 -0
  133. package/nitrogen/generated/shared/c++/NitroNumberDirection.hpp +4 -0
  134. package/nitrogen/generated/shared/c++/NumberFormatCompactDisplay.hpp +76 -0
  135. package/nitrogen/generated/shared/c++/NumberFormatCurrencyDisplay.hpp +84 -0
  136. package/nitrogen/generated/shared/c++/NumberFormatCurrencySign.hpp +76 -0
  137. package/nitrogen/generated/shared/c++/NumberFormatGrouping.hpp +80 -0
  138. package/nitrogen/generated/shared/c++/NumberFormatNotation.hpp +84 -0
  139. package/nitrogen/generated/shared/c++/NumberFormatOptions.hpp +193 -0
  140. package/nitrogen/generated/shared/c++/NumberFormatPart.hpp +87 -0
  141. package/nitrogen/generated/shared/c++/NumberFormatPlatformOptions.hpp +176 -0
  142. package/nitrogen/generated/shared/c++/NumberFormatPlatformSymbols.hpp +115 -0
  143. package/nitrogen/generated/shared/c++/NumberFormatRoundingMode.hpp +104 -0
  144. package/nitrogen/generated/shared/c++/NumberFormatRoundingPriority.hpp +80 -0
  145. package/nitrogen/generated/shared/c++/NumberFormatSignDisplay.hpp +88 -0
  146. package/nitrogen/generated/shared/c++/NumberFormatStyle.hpp +84 -0
  147. package/nitrogen/generated/shared/c++/NumberFormatTrailingZeroDisplay.hpp +76 -0
  148. package/nitrogen/generated/shared/c++/NumberFormatUnitDisplay.hpp +80 -0
  149. package/nitrogen/generated/shared/c++/ResolvedNumberFormatOptions.hpp +197 -0
  150. package/nitrogen/generated/shared/c++/views/HybridNitroInputViewComponent.cpp +10 -0
  151. package/nitrogen/generated/shared/c++/views/HybridNitroInputViewComponent.hpp +15 -0
  152. package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.cpp +12 -0
  153. package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.hpp +18 -0
  154. package/nitrogen/generated/shared/json/NitroInputViewConfig.json +5 -0
  155. package/nitrogen/generated/shared/json/NitroNumberViewConfig.json +6 -0
  156. package/package.json +2 -2
  157. package/src/NitroInput.tsx +42 -7
  158. package/src/NitroNumber.tsx +57 -7
  159. package/src/NumberFormat.ts +563 -0
  160. package/src/formatProps.ts +59 -0
  161. package/src/index.ts +18 -0
  162. package/src/specs/NitroInput.nitro.ts +10 -0
  163. package/src/specs/NitroNumber.nitro.ts +13 -1
  164. package/src/specs/NumberFormat.nitro.ts +145 -0
@@ -457,6 +457,61 @@ open class HybridNitroInputViewSpec_cxx {
457
457
  }
458
458
  }
459
459
 
460
+ public final var letterSpacing: Double {
461
+ @inline(__always)
462
+ get {
463
+ return self.__implementation.letterSpacing
464
+ }
465
+ @inline(__always)
466
+ set {
467
+ self.__implementation.letterSpacing = newValue
468
+ }
469
+ }
470
+
471
+ public final var prefixSpacing: Double {
472
+ @inline(__always)
473
+ get {
474
+ return self.__implementation.prefixSpacing
475
+ }
476
+ @inline(__always)
477
+ set {
478
+ self.__implementation.prefixSpacing = newValue
479
+ }
480
+ }
481
+
482
+ public final var suffixSpacing: Double {
483
+ @inline(__always)
484
+ get {
485
+ return self.__implementation.suffixSpacing
486
+ }
487
+ @inline(__always)
488
+ set {
489
+ self.__implementation.suffixSpacing = newValue
490
+ }
491
+ }
492
+
493
+ public final var prefixOffset: Double {
494
+ @inline(__always)
495
+ get {
496
+ return self.__implementation.prefixOffset
497
+ }
498
+ @inline(__always)
499
+ set {
500
+ self.__implementation.prefixOffset = newValue
501
+ }
502
+ }
503
+
504
+ public final var suffixOffset: Double {
505
+ @inline(__always)
506
+ get {
507
+ return self.__implementation.suffixOffset
508
+ }
509
+ @inline(__always)
510
+ set {
511
+ self.__implementation.suffixOffset = newValue
512
+ }
513
+ }
514
+
460
515
  public final var placeholder: std.string {
461
516
  @inline(__always)
462
517
  get {
@@ -0,0 +1,56 @@
1
+ ///
2
+ /// HybridNitroNumberFormatPlatformSpec.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 ``HybridNitroNumberFormatPlatformSpec``
11
+ public protocol HybridNitroNumberFormatPlatformSpec_protocol: HybridObject {
12
+ // Properties
13
+
14
+
15
+ // Methods
16
+ func create(options: NumberFormatPlatformOptions) throws -> (any HybridNitroPlatformNumberFormatterSpec)
17
+ func supportedLocalesOf(locales: [String]) throws -> [String]
18
+ }
19
+
20
+ public extension HybridNitroNumberFormatPlatformSpec_protocol {
21
+ /// Default implementation of ``HybridObject.toString``
22
+ func toString() -> String {
23
+ return "[HybridObject NitroNumberFormatPlatform]"
24
+ }
25
+ }
26
+
27
+ /// See ``HybridNitroNumberFormatPlatformSpec``
28
+ open class HybridNitroNumberFormatPlatformSpec_base {
29
+ private weak var cxxWrapper: HybridNitroNumberFormatPlatformSpec_cxx? = nil
30
+ public init() { }
31
+ public func getCxxWrapper() -> HybridNitroNumberFormatPlatformSpec_cxx {
32
+ #if DEBUG
33
+ guard self is any HybridNitroNumberFormatPlatformSpec else {
34
+ fatalError("`self` is not a `HybridNitroNumberFormatPlatformSpec`! Did you accidentally inherit from `HybridNitroNumberFormatPlatformSpec_base` instead of `HybridNitroNumberFormatPlatformSpec`?")
35
+ }
36
+ #endif
37
+ if let cxxWrapper = self.cxxWrapper {
38
+ return cxxWrapper
39
+ } else {
40
+ let cxxWrapper = HybridNitroNumberFormatPlatformSpec_cxx(self as! any HybridNitroNumberFormatPlatformSpec)
41
+ self.cxxWrapper = cxxWrapper
42
+ return cxxWrapper
43
+ }
44
+ }
45
+ }
46
+
47
+ /**
48
+ * A Swift base-protocol representing the NitroNumberFormatPlatform HybridObject.
49
+ * Implement this protocol to create Swift-based instances of NitroNumberFormatPlatform.
50
+ * ```swift
51
+ * class HybridNitroNumberFormatPlatform : HybridNitroNumberFormatPlatformSpec {
52
+ * // ...
53
+ * }
54
+ * ```
55
+ */
56
+ public typealias HybridNitroNumberFormatPlatformSpec = HybridNitroNumberFormatPlatformSpec_protocol & HybridNitroNumberFormatPlatformSpec_base
@@ -0,0 +1,159 @@
1
+ ///
2
+ /// HybridNitroNumberFormatPlatformSpec_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 HybridNitroNumberFormatPlatformSpec 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 HybridNitroNumberFormatPlatformSpec_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 `HybridNitroNumberFormatPlatformSpec` Swift protocol.
29
+ */
30
+ private var __implementation: any HybridNitroNumberFormatPlatformSpec
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_HybridNitroNumberFormatPlatformSpec_
36
+
37
+ /**
38
+ * Create a new `HybridNitroNumberFormatPlatformSpec_cxx` that wraps the given `HybridNitroNumberFormatPlatformSpec`.
39
+ * All properties and methods bridge to C++ types.
40
+ */
41
+ public init(_ implementation: any HybridNitroNumberFormatPlatformSpec) {
42
+ self.__implementation = implementation
43
+ self.__cxxPart = .init()
44
+ /* no base class */
45
+ }
46
+
47
+ /**
48
+ * Get the actual `HybridNitroNumberFormatPlatformSpec` instance this class wraps.
49
+ */
50
+ @inline(__always)
51
+ public func getHybridNitroNumberFormatPlatformSpec() -> any HybridNitroNumberFormatPlatformSpec {
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 `HybridNitroNumberFormatPlatformSpec_cxx`.
65
+ * The pointer has to be a retained opaque `Unmanaged<HybridNitroNumberFormatPlatformSpec_cxx>`.
66
+ * This removes one strong reference from the object!
67
+ */
68
+ public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridNitroNumberFormatPlatformSpec_cxx {
69
+ return Unmanaged<HybridNitroNumberFormatPlatformSpec_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<HybridNitroNumberFormatPlatformSpec>`.
75
+ */
76
+ public func getCxxPart() -> bridge.std__shared_ptr_HybridNitroNumberFormatPlatformSpec_ {
77
+ let cachedCxxPart = self.__cxxPart.lock()
78
+ if Bool(fromCxx: cachedCxxPart) {
79
+ return cachedCxxPart
80
+ } else {
81
+ let newCxxPart = bridge.create_std__shared_ptr_HybridNitroNumberFormatPlatformSpec_(self.toUnsafe())
82
+ __cxxPart = bridge.weakify_std__shared_ptr_HybridNitroNumberFormatPlatformSpec_(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: HybridNitroNumberFormatPlatformSpec_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 create(options: NumberFormatPlatformOptions) -> bridge.Result_std__shared_ptr_HybridNitroPlatformNumberFormatterSpec__ {
129
+ do {
130
+ let __result = try self.__implementation.create(options: options)
131
+ let __resultCpp = { () -> bridge.std__shared_ptr_HybridNitroPlatformNumberFormatterSpec_ in
132
+ let __cxxWrapped = __result.getCxxWrapper()
133
+ return __cxxWrapped.getCxxPart()
134
+ }()
135
+ return bridge.create_Result_std__shared_ptr_HybridNitroPlatformNumberFormatterSpec__(__resultCpp)
136
+ } catch (let __error) {
137
+ let __exceptionPtr = __error.toCpp()
138
+ return bridge.create_Result_std__shared_ptr_HybridNitroPlatformNumberFormatterSpec__(__exceptionPtr)
139
+ }
140
+ }
141
+
142
+ @inline(__always)
143
+ public final func supportedLocalesOf(locales: bridge.std__vector_std__string_) -> bridge.Result_std__vector_std__string__ {
144
+ do {
145
+ let __result = try self.__implementation.supportedLocalesOf(locales: locales.map({ __item in String(__item) }))
146
+ let __resultCpp = { () -> bridge.std__vector_std__string_ in
147
+ var __vector = bridge.create_std__vector_std__string_(__result.count)
148
+ for __item in __result {
149
+ __vector.push_back(std.string(__item))
150
+ }
151
+ return __vector
152
+ }()
153
+ return bridge.create_Result_std__vector_std__string__(__resultCpp)
154
+ } catch (let __error) {
155
+ let __exceptionPtr = __error.toCpp()
156
+ return bridge.create_Result_std__vector_std__string__(__exceptionPtr)
157
+ }
158
+ }
159
+ }
@@ -44,6 +44,12 @@ public protocol HybridNitroNumberViewSpec_protocol: HybridObject, HybridView {
44
44
  var affixAlign: NitroNumberAffixAlign? { get set }
45
45
  var prefixAlign: NitroNumberAffixAlign? { get set }
46
46
  var suffixAlign: NitroNumberAffixAlign? { get set }
47
+ var letterSpacing: Double? { get set }
48
+ var prefixSpacing: Double? { get set }
49
+ var suffixSpacing: Double? { get set }
50
+ var prefixOffset: Double? { get set }
51
+ var suffixOffset: Double? { get set }
52
+ var tabularNums: Bool? { get set }
47
53
  var adjustsFontSizeToFit: Bool? { get set }
48
54
  var minimumFontScale: Double? { get set }
49
55
  var allowFontScaling: Bool? { get set }
@@ -881,6 +881,150 @@ open class HybridNitroNumberViewSpec_cxx {
881
881
  }
882
882
  }
883
883
 
884
+ public final var letterSpacing: bridge.std__optional_double_ {
885
+ @inline(__always)
886
+ get {
887
+ return { () -> bridge.std__optional_double_ in
888
+ if let __unwrappedValue = self.__implementation.letterSpacing {
889
+ return bridge.create_std__optional_double_(__unwrappedValue)
890
+ } else {
891
+ return .init()
892
+ }
893
+ }()
894
+ }
895
+ @inline(__always)
896
+ set {
897
+ self.__implementation.letterSpacing = { () -> Double? in
898
+ if bridge.has_value_std__optional_double_(newValue) {
899
+ let __unwrapped = bridge.get_std__optional_double_(newValue)
900
+ return __unwrapped
901
+ } else {
902
+ return nil
903
+ }
904
+ }()
905
+ }
906
+ }
907
+
908
+ public final var prefixSpacing: bridge.std__optional_double_ {
909
+ @inline(__always)
910
+ get {
911
+ return { () -> bridge.std__optional_double_ in
912
+ if let __unwrappedValue = self.__implementation.prefixSpacing {
913
+ return bridge.create_std__optional_double_(__unwrappedValue)
914
+ } else {
915
+ return .init()
916
+ }
917
+ }()
918
+ }
919
+ @inline(__always)
920
+ set {
921
+ self.__implementation.prefixSpacing = { () -> Double? in
922
+ if bridge.has_value_std__optional_double_(newValue) {
923
+ let __unwrapped = bridge.get_std__optional_double_(newValue)
924
+ return __unwrapped
925
+ } else {
926
+ return nil
927
+ }
928
+ }()
929
+ }
930
+ }
931
+
932
+ public final var suffixSpacing: bridge.std__optional_double_ {
933
+ @inline(__always)
934
+ get {
935
+ return { () -> bridge.std__optional_double_ in
936
+ if let __unwrappedValue = self.__implementation.suffixSpacing {
937
+ return bridge.create_std__optional_double_(__unwrappedValue)
938
+ } else {
939
+ return .init()
940
+ }
941
+ }()
942
+ }
943
+ @inline(__always)
944
+ set {
945
+ self.__implementation.suffixSpacing = { () -> Double? in
946
+ if bridge.has_value_std__optional_double_(newValue) {
947
+ let __unwrapped = bridge.get_std__optional_double_(newValue)
948
+ return __unwrapped
949
+ } else {
950
+ return nil
951
+ }
952
+ }()
953
+ }
954
+ }
955
+
956
+ public final var prefixOffset: bridge.std__optional_double_ {
957
+ @inline(__always)
958
+ get {
959
+ return { () -> bridge.std__optional_double_ in
960
+ if let __unwrappedValue = self.__implementation.prefixOffset {
961
+ return bridge.create_std__optional_double_(__unwrappedValue)
962
+ } else {
963
+ return .init()
964
+ }
965
+ }()
966
+ }
967
+ @inline(__always)
968
+ set {
969
+ self.__implementation.prefixOffset = { () -> Double? in
970
+ if bridge.has_value_std__optional_double_(newValue) {
971
+ let __unwrapped = bridge.get_std__optional_double_(newValue)
972
+ return __unwrapped
973
+ } else {
974
+ return nil
975
+ }
976
+ }()
977
+ }
978
+ }
979
+
980
+ public final var suffixOffset: bridge.std__optional_double_ {
981
+ @inline(__always)
982
+ get {
983
+ return { () -> bridge.std__optional_double_ in
984
+ if let __unwrappedValue = self.__implementation.suffixOffset {
985
+ return bridge.create_std__optional_double_(__unwrappedValue)
986
+ } else {
987
+ return .init()
988
+ }
989
+ }()
990
+ }
991
+ @inline(__always)
992
+ set {
993
+ self.__implementation.suffixOffset = { () -> Double? in
994
+ if bridge.has_value_std__optional_double_(newValue) {
995
+ let __unwrapped = bridge.get_std__optional_double_(newValue)
996
+ return __unwrapped
997
+ } else {
998
+ return nil
999
+ }
1000
+ }()
1001
+ }
1002
+ }
1003
+
1004
+ public final var tabularNums: bridge.std__optional_bool_ {
1005
+ @inline(__always)
1006
+ get {
1007
+ return { () -> bridge.std__optional_bool_ in
1008
+ if let __unwrappedValue = self.__implementation.tabularNums {
1009
+ return bridge.create_std__optional_bool_(__unwrappedValue)
1010
+ } else {
1011
+ return .init()
1012
+ }
1013
+ }()
1014
+ }
1015
+ @inline(__always)
1016
+ set {
1017
+ self.__implementation.tabularNums = { () -> Bool? in
1018
+ if bridge.has_value_std__optional_bool_(newValue) {
1019
+ let __unwrapped = bridge.get_std__optional_bool_(newValue)
1020
+ return __unwrapped
1021
+ } else {
1022
+ return nil
1023
+ }
1024
+ }()
1025
+ }
1026
+ }
1027
+
884
1028
  public final var adjustsFontSizeToFit: bridge.std__optional_bool_ {
885
1029
  @inline(__always)
886
1030
  get {
@@ -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
+ }
@@ -23,6 +23,8 @@ public extension NitroNumberDirection {
23
23
  self = .up
24
24
  case "down":
25
25
  self = .down
26
+ case "shortest":
27
+ self = .shortest
26
28
  default:
27
29
  return nil
28
30
  }
@@ -39,6 +41,8 @@ public extension NitroNumberDirection {
39
41
  return "up"
40
42
  case .down:
41
43
  return "down"
44
+ case .shortest:
45
+ return "shortest"
42
46
  }
43
47
  }
44
48
  }