react-native-nitro-input 0.1.0 → 0.2.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 (116) hide show
  1. package/CHANGELOG.md +305 -3
  2. package/NitroInput.podspec +4 -4
  3. package/README.md +378 -53
  4. package/android/CMakeLists.txt +5 -3
  5. package/android/src/main/cpp/JOutlineGeometry.hpp +1 -1
  6. package/android/src/main/cpp/JReflowEngine.cpp +132 -0
  7. package/android/src/main/cpp/{JMorphEngine.hpp → JReflowEngine.hpp} +7 -7
  8. package/android/src/main/cpp/JRollingEngine.cpp +222 -0
  9. package/android/src/main/cpp/JRollingEngine.hpp +68 -0
  10. package/android/src/main/cpp/cpp-adapter.cpp +4 -2
  11. package/android/src/main/java/com/margelo/nitro/nitroinput/AmountFormatter.kt +1 -1
  12. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroInputView.kt +1 -1
  13. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberView.kt +471 -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 +38 -16
  16. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroNumberView.kt +1741 -0
  17. package/android/src/main/java/com/margelo/nitro/nitroinput/{MorphEngine.kt → ReflowEngine.kt} +2 -2
  18. package/android/src/main/java/com/margelo/nitro/nitroinput/RollingEngine.kt +59 -0
  19. package/cpp/AmountFormatter.cpp +5 -0
  20. package/cpp/AmountFormatter.hpp +10 -2
  21. package/cpp/{MorphEngine.cpp → ReflowEngine.cpp} +52 -47
  22. package/cpp/{MorphEngine.hpp → ReflowEngine.hpp} +12 -4
  23. package/cpp/RollingEngine.cpp +1224 -0
  24. package/cpp/RollingEngine.hpp +468 -0
  25. package/cpp/SwiftNonCopyable.hpp +22 -0
  26. package/cpp/worklets/NitroInputWorkletsBridge.cpp +3 -3
  27. package/cpp/worklets/NitroInputWorkletsBridge.hpp +1 -1
  28. package/ios/{HybridMorphInputView.swift → HybridNitroInputView.swift} +1 -1
  29. package/ios/HybridNitroNumberView.swift +439 -0
  30. package/ios/NitroInputView.swift +69 -45
  31. package/ios/NitroNumberView.swift +1934 -0
  32. package/lib/commonjs/nitrogen/generated/shared/json/NitroNumberViewConfig.json +55 -0
  33. package/lib/commonjs/src/NitroInput.js +21 -52
  34. package/lib/commonjs/src/NitroNumber.js +139 -0
  35. package/lib/commonjs/src/index.js +4 -3
  36. package/lib/commonjs/src/specs/NitroNumber.nitro.js +2 -0
  37. package/lib/commonjs/src/styleHelpers.js +36 -0
  38. package/lib/module/nitrogen/generated/shared/json/NitroNumberViewConfig.json +55 -0
  39. package/lib/module/src/NitroInput.js +12 -43
  40. package/lib/module/src/NitroNumber.js +100 -0
  41. package/lib/module/src/index.js +1 -1
  42. package/lib/module/src/specs/NitroNumber.nitro.js +1 -0
  43. package/lib/module/src/styleHelpers.js +32 -0
  44. package/lib/typescript/src/NitroInput.d.ts +28 -21
  45. package/lib/typescript/src/NitroNumber.d.ts +211 -0
  46. package/lib/typescript/src/index.d.ts +3 -2
  47. package/lib/typescript/src/specs/NitroInput.nitro.d.ts +9 -9
  48. package/lib/typescript/src/specs/NitroNumber.nitro.d.ts +238 -0
  49. package/lib/typescript/src/styleHelpers.d.ts +3 -0
  50. package/nitro.json +10 -0
  51. package/nitrogen/generated/android/NitroInput+autolinking.cmake +4 -0
  52. package/nitrogen/generated/android/NitroInputOnLoad.cpp +20 -0
  53. package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
  54. package/nitrogen/generated/android/c++/JFunc_void_double_double.hpp +10 -10
  55. package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.cpp +536 -0
  56. package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.hpp +156 -0
  57. package/nitrogen/generated/android/c++/JNitroNumberAffixAlign.hpp +64 -0
  58. package/nitrogen/generated/android/c++/JNitroNumberDirection.hpp +61 -0
  59. package/nitrogen/generated/android/c++/JNitroNumberEasing.hpp +67 -0
  60. package/nitrogen/generated/android/c++/JNitroNumberRevealStyle.hpp +58 -0
  61. package/nitrogen/generated/android/c++/JNitroNumberTextAlign.hpp +64 -0
  62. package/nitrogen/generated/android/c++/JNitroNumberTransition.hpp +61 -0
  63. package/nitrogen/generated/android/c++/views/JHybridNitroNumberViewStateUpdater.cpp +299 -0
  64. package/nitrogen/generated/android/c++/views/JHybridNitroNumberViewStateUpdater.hpp +54 -0
  65. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/Func_void.kt +78 -0
  66. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/Func_void_double_double.kt +9 -9
  67. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroNumberViewSpec.kt +363 -0
  68. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberAffixAlign.kt +25 -0
  69. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberDirection.kt +24 -0
  70. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberEasing.kt +26 -0
  71. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberRevealStyle.kt +23 -0
  72. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberTextAlign.kt +25 -0
  73. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberTransition.kt +24 -0
  74. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/views/HybridNitroNumberViewManager.kt +96 -0
  75. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/views/HybridNitroNumberViewStateUpdater.kt +23 -0
  76. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.cpp +25 -0
  77. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.hpp +248 -0
  78. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Umbrella.hpp +23 -0
  79. package/nitrogen/generated/ios/NitroInputAutolinking.mm +8 -0
  80. package/nitrogen/generated/ios/NitroInputAutolinking.swift +12 -0
  81. package/nitrogen/generated/ios/c++/HybridNitroNumberViewSpecSwift.cpp +11 -0
  82. package/nitrogen/generated/ios/c++/HybridNitroNumberViewSpecSwift.hpp +432 -0
  83. package/nitrogen/generated/ios/c++/views/HybridNitroNumberViewComponent.mm +414 -0
  84. package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
  85. package/nitrogen/generated/ios/swift/Func_void_double_double.swift +5 -5
  86. package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec.swift +102 -0
  87. package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec_cxx.swift +1243 -0
  88. package/nitrogen/generated/ios/swift/NitroNumberAffixAlign.swift +48 -0
  89. package/nitrogen/generated/ios/swift/NitroNumberDirection.swift +44 -0
  90. package/nitrogen/generated/ios/swift/NitroNumberEasing.swift +52 -0
  91. package/nitrogen/generated/ios/swift/NitroNumberRevealStyle.swift +40 -0
  92. package/nitrogen/generated/ios/swift/NitroNumberTextAlign.swift +48 -0
  93. package/nitrogen/generated/ios/swift/NitroNumberTransition.swift +44 -0
  94. package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.cpp +115 -0
  95. package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.hpp +175 -0
  96. package/nitrogen/generated/shared/c++/NitroNumberAffixAlign.hpp +84 -0
  97. package/nitrogen/generated/shared/c++/NitroNumberDirection.hpp +80 -0
  98. package/nitrogen/generated/shared/c++/NitroNumberEasing.hpp +88 -0
  99. package/nitrogen/generated/shared/c++/NitroNumberRevealStyle.hpp +76 -0
  100. package/nitrogen/generated/shared/c++/NitroNumberTextAlign.hpp +84 -0
  101. package/nitrogen/generated/shared/c++/NitroNumberTransition.hpp +80 -0
  102. package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.cpp +124 -0
  103. package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.hpp +227 -0
  104. package/nitrogen/generated/shared/json/NitroNumberViewConfig.json +55 -0
  105. package/package.json +15 -7
  106. package/src/NitroInput.tsx +37 -60
  107. package/src/NitroNumber.tsx +481 -0
  108. package/src/index.ts +20 -6
  109. package/src/specs/NitroInput.nitro.ts +9 -9
  110. package/src/specs/NitroNumber.nitro.ts +259 -0
  111. package/src/styleHelpers.ts +32 -0
  112. package/android/src/main/cpp/JMorphEngine.cpp +0 -132
  113. package/lib/commonjs/src/MorphInput.js +0 -42
  114. package/lib/module/src/MorphInput.js +0 -6
  115. package/lib/typescript/src/MorphInput.d.ts +0 -18
  116. package/src/MorphInput.tsx +0 -30
@@ -0,0 +1,48 @@
1
+ ///
2
+ /// NitroNumberAffixAlign.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
+ /**
9
+ * Represents the JS union `NitroNumberAffixAlign`, backed by a C++ enum.
10
+ */
11
+ public typealias NitroNumberAffixAlign = margelo.nitro.nitroinput.NitroNumberAffixAlign
12
+
13
+ public extension NitroNumberAffixAlign {
14
+ /**
15
+ * Get a NitroNumberAffixAlign for the given String value, or
16
+ * return `nil` if the given value was invalid/unknown.
17
+ */
18
+ init?(fromString string: String) {
19
+ switch string {
20
+ case "center":
21
+ self = .center
22
+ case "top":
23
+ self = .top
24
+ case "bottom":
25
+ self = .bottom
26
+ case "baseline":
27
+ self = .baseline
28
+ default:
29
+ return nil
30
+ }
31
+ }
32
+
33
+ /**
34
+ * Get the String value this NitroNumberAffixAlign represents.
35
+ */
36
+ var stringValue: String {
37
+ switch self {
38
+ case .center:
39
+ return "center"
40
+ case .top:
41
+ return "top"
42
+ case .bottom:
43
+ return "bottom"
44
+ case .baseline:
45
+ return "baseline"
46
+ }
47
+ }
48
+ }
@@ -0,0 +1,44 @@
1
+ ///
2
+ /// NitroNumberDirection.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
+ /**
9
+ * Represents the JS union `NitroNumberDirection`, backed by a C++ enum.
10
+ */
11
+ public typealias NitroNumberDirection = margelo.nitro.nitroinput.NitroNumberDirection
12
+
13
+ public extension NitroNumberDirection {
14
+ /**
15
+ * Get a NitroNumberDirection for the given String value, or
16
+ * return `nil` if the given value was invalid/unknown.
17
+ */
18
+ init?(fromString string: String) {
19
+ switch string {
20
+ case "auto":
21
+ self = .auto
22
+ case "up":
23
+ self = .up
24
+ case "down":
25
+ self = .down
26
+ default:
27
+ return nil
28
+ }
29
+ }
30
+
31
+ /**
32
+ * Get the String value this NitroNumberDirection represents.
33
+ */
34
+ var stringValue: String {
35
+ switch self {
36
+ case .auto:
37
+ return "auto"
38
+ case .up:
39
+ return "up"
40
+ case .down:
41
+ return "down"
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,52 @@
1
+ ///
2
+ /// NitroNumberEasing.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
+ /**
9
+ * Represents the JS union `NitroNumberEasing`, backed by a C++ enum.
10
+ */
11
+ public typealias NitroNumberEasing = margelo.nitro.nitroinput.NitroNumberEasing
12
+
13
+ public extension NitroNumberEasing {
14
+ /**
15
+ * Get a NitroNumberEasing for the given String value, or
16
+ * return `nil` if the given value was invalid/unknown.
17
+ */
18
+ init?(fromString string: String) {
19
+ switch string {
20
+ case "easeOut":
21
+ self = .easeout
22
+ case "easeInOut":
23
+ self = .easeinout
24
+ case "linear":
25
+ self = .linear
26
+ case "spring":
27
+ self = .spring
28
+ case "easeIn":
29
+ self = .easein
30
+ default:
31
+ return nil
32
+ }
33
+ }
34
+
35
+ /**
36
+ * Get the String value this NitroNumberEasing represents.
37
+ */
38
+ var stringValue: String {
39
+ switch self {
40
+ case .easeout:
41
+ return "easeOut"
42
+ case .easeinout:
43
+ return "easeInOut"
44
+ case .linear:
45
+ return "linear"
46
+ case .spring:
47
+ return "spring"
48
+ case .easein:
49
+ return "easeIn"
50
+ }
51
+ }
52
+ }
@@ -0,0 +1,40 @@
1
+ ///
2
+ /// NitroNumberRevealStyle.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
+ /**
9
+ * Represents the JS union `NitroNumberRevealStyle`, backed by a C++ enum.
10
+ */
11
+ public typealias NitroNumberRevealStyle = margelo.nitro.nitroinput.NitroNumberRevealStyle
12
+
13
+ public extension NitroNumberRevealStyle {
14
+ /**
15
+ * Get a NitroNumberRevealStyle for the given String value, or
16
+ * return `nil` if the given value was invalid/unknown.
17
+ */
18
+ init?(fromString string: String) {
19
+ switch string {
20
+ case "count":
21
+ self = .count
22
+ case "spin":
23
+ self = .spin
24
+ default:
25
+ return nil
26
+ }
27
+ }
28
+
29
+ /**
30
+ * Get the String value this NitroNumberRevealStyle represents.
31
+ */
32
+ var stringValue: String {
33
+ switch self {
34
+ case .count:
35
+ return "count"
36
+ case .spin:
37
+ return "spin"
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,48 @@
1
+ ///
2
+ /// NitroNumberTextAlign.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
+ /**
9
+ * Represents the JS union `NitroNumberTextAlign`, backed by a C++ enum.
10
+ */
11
+ public typealias NitroNumberTextAlign = margelo.nitro.nitroinput.NitroNumberTextAlign
12
+
13
+ public extension NitroNumberTextAlign {
14
+ /**
15
+ * Get a NitroNumberTextAlign for the given String value, or
16
+ * return `nil` if the given value was invalid/unknown.
17
+ */
18
+ init?(fromString string: String) {
19
+ switch string {
20
+ case "auto":
21
+ self = .auto
22
+ case "left":
23
+ self = .left
24
+ case "center":
25
+ self = .center
26
+ case "right":
27
+ self = .right
28
+ default:
29
+ return nil
30
+ }
31
+ }
32
+
33
+ /**
34
+ * Get the String value this NitroNumberTextAlign represents.
35
+ */
36
+ var stringValue: String {
37
+ switch self {
38
+ case .auto:
39
+ return "auto"
40
+ case .left:
41
+ return "left"
42
+ case .center:
43
+ return "center"
44
+ case .right:
45
+ return "right"
46
+ }
47
+ }
48
+ }
@@ -0,0 +1,44 @@
1
+ ///
2
+ /// NitroNumberTransition.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
+ /**
9
+ * Represents the JS union `NitroNumberTransition`, backed by a C++ enum.
10
+ */
11
+ public typealias NitroNumberTransition = margelo.nitro.nitroinput.NitroNumberTransition
12
+
13
+ public extension NitroNumberTransition {
14
+ /**
15
+ * Get a NitroNumberTransition for the given String value, or
16
+ * return `nil` if the given value was invalid/unknown.
17
+ */
18
+ init?(fromString string: String) {
19
+ switch string {
20
+ case "numeric":
21
+ self = .numeric
22
+ case "roll":
23
+ self = .roll
24
+ case "scramble":
25
+ self = .scramble
26
+ default:
27
+ return nil
28
+ }
29
+ }
30
+
31
+ /**
32
+ * Get the String value this NitroNumberTransition represents.
33
+ */
34
+ var stringValue: String {
35
+ switch self {
36
+ case .numeric:
37
+ return "numeric"
38
+ case .roll:
39
+ return "roll"
40
+ case .scramble:
41
+ return "scramble"
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,115 @@
1
+ ///
2
+ /// HybridNitroNumberViewSpec.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 "HybridNitroNumberViewSpec.hpp"
9
+
10
+ namespace margelo::nitro::nitroinput {
11
+
12
+ void HybridNitroNumberViewSpec::loadHybridMethods() {
13
+ // load base methods/properties
14
+ HybridObject::loadHybridMethods();
15
+ // load custom methods/properties
16
+ registerHybrids(this, [](Prototype& prototype) {
17
+ prototype.registerHybridGetter("value", &HybridNitroNumberViewSpec::getValue);
18
+ prototype.registerHybridSetter("value", &HybridNitroNumberViewSpec::setValue);
19
+ prototype.registerHybridGetter("fractionDigits", &HybridNitroNumberViewSpec::getFractionDigits);
20
+ prototype.registerHybridSetter("fractionDigits", &HybridNitroNumberViewSpec::setFractionDigits);
21
+ prototype.registerHybridGetter("minimumIntegerDigits", &HybridNitroNumberViewSpec::getMinimumIntegerDigits);
22
+ prototype.registerHybridSetter("minimumIntegerDigits", &HybridNitroNumberViewSpec::setMinimumIntegerDigits);
23
+ prototype.registerHybridGetter("groupingSeparator", &HybridNitroNumberViewSpec::getGroupingSeparator);
24
+ prototype.registerHybridSetter("groupingSeparator", &HybridNitroNumberViewSpec::setGroupingSeparator);
25
+ prototype.registerHybridGetter("decimalSeparator", &HybridNitroNumberViewSpec::getDecimalSeparator);
26
+ prototype.registerHybridSetter("decimalSeparator", &HybridNitroNumberViewSpec::setDecimalSeparator);
27
+ prototype.registerHybridGetter("prefix", &HybridNitroNumberViewSpec::getPrefix);
28
+ prototype.registerHybridSetter("prefix", &HybridNitroNumberViewSpec::setPrefix);
29
+ prototype.registerHybridGetter("suffix", &HybridNitroNumberViewSpec::getSuffix);
30
+ prototype.registerHybridSetter("suffix", &HybridNitroNumberViewSpec::setSuffix);
31
+ prototype.registerHybridGetter("duration", &HybridNitroNumberViewSpec::getDuration);
32
+ prototype.registerHybridSetter("duration", &HybridNitroNumberViewSpec::setDuration);
33
+ prototype.registerHybridGetter("easing", &HybridNitroNumberViewSpec::getEasing);
34
+ prototype.registerHybridSetter("easing", &HybridNitroNumberViewSpec::setEasing);
35
+ prototype.registerHybridGetter("bounce", &HybridNitroNumberViewSpec::getBounce);
36
+ prototype.registerHybridSetter("bounce", &HybridNitroNumberViewSpec::setBounce);
37
+ prototype.registerHybridGetter("stagger", &HybridNitroNumberViewSpec::getStagger);
38
+ prototype.registerHybridSetter("stagger", &HybridNitroNumberViewSpec::setStagger);
39
+ prototype.registerHybridGetter("transition", &HybridNitroNumberViewSpec::getTransition);
40
+ prototype.registerHybridSetter("transition", &HybridNitroNumberViewSpec::setTransition);
41
+ prototype.registerHybridGetter("flashUpColor", &HybridNitroNumberViewSpec::getFlashUpColor);
42
+ prototype.registerHybridSetter("flashUpColor", &HybridNitroNumberViewSpec::setFlashUpColor);
43
+ prototype.registerHybridGetter("flashDownColor", &HybridNitroNumberViewSpec::getFlashDownColor);
44
+ prototype.registerHybridSetter("flashDownColor", &HybridNitroNumberViewSpec::setFlashDownColor);
45
+ prototype.registerHybridGetter("flashDuration", &HybridNitroNumberViewSpec::getFlashDuration);
46
+ prototype.registerHybridSetter("flashDuration", &HybridNitroNumberViewSpec::setFlashDuration);
47
+ prototype.registerHybridGetter("popOnChange", &HybridNitroNumberViewSpec::getPopOnChange);
48
+ prototype.registerHybridSetter("popOnChange", &HybridNitroNumberViewSpec::setPopOnChange);
49
+ prototype.registerHybridGetter("rollDirection", &HybridNitroNumberViewSpec::getRollDirection);
50
+ prototype.registerHybridSetter("rollDirection", &HybridNitroNumberViewSpec::setRollDirection);
51
+ prototype.registerHybridGetter("revealState", &HybridNitroNumberViewSpec::getRevealState);
52
+ prototype.registerHybridSetter("revealState", &HybridNitroNumberViewSpec::setRevealState);
53
+ prototype.registerHybridGetter("revealStyle", &HybridNitroNumberViewSpec::getRevealStyle);
54
+ prototype.registerHybridSetter("revealStyle", &HybridNitroNumberViewSpec::setRevealStyle);
55
+ prototype.registerHybridGetter("revealDuration", &HybridNitroNumberViewSpec::getRevealDuration);
56
+ prototype.registerHybridSetter("revealDuration", &HybridNitroNumberViewSpec::setRevealDuration);
57
+ prototype.registerHybridGetter("revealBounce", &HybridNitroNumberViewSpec::getRevealBounce);
58
+ prototype.registerHybridSetter("revealBounce", &HybridNitroNumberViewSpec::setRevealBounce);
59
+ prototype.registerHybridGetter("revealGrow", &HybridNitroNumberViewSpec::getRevealGrow);
60
+ prototype.registerHybridSetter("revealGrow", &HybridNitroNumberViewSpec::setRevealGrow);
61
+ prototype.registerHybridGetter("revealStagger", &HybridNitroNumberViewSpec::getRevealStagger);
62
+ prototype.registerHybridSetter("revealStagger", &HybridNitroNumberViewSpec::setRevealStagger);
63
+ prototype.registerHybridGetter("revealMilestones", &HybridNitroNumberViewSpec::getRevealMilestones);
64
+ prototype.registerHybridSetter("revealMilestones", &HybridNitroNumberViewSpec::setRevealMilestones);
65
+ prototype.registerHybridGetter("revealMilestoneHold", &HybridNitroNumberViewSpec::getRevealMilestoneHold);
66
+ prototype.registerHybridSetter("revealMilestoneHold", &HybridNitroNumberViewSpec::setRevealMilestoneHold);
67
+ prototype.registerHybridGetter("loading", &HybridNitroNumberViewSpec::getLoading);
68
+ prototype.registerHybridSetter("loading", &HybridNitroNumberViewSpec::setLoading);
69
+ prototype.registerHybridGetter("shimmerColor", &HybridNitroNumberViewSpec::getShimmerColor);
70
+ prototype.registerHybridSetter("shimmerColor", &HybridNitroNumberViewSpec::setShimmerColor);
71
+ prototype.registerHybridGetter("shimmerDuration", &HybridNitroNumberViewSpec::getShimmerDuration);
72
+ prototype.registerHybridSetter("shimmerDuration", &HybridNitroNumberViewSpec::setShimmerDuration);
73
+ prototype.registerHybridGetter("fontSize", &HybridNitroNumberViewSpec::getFontSize);
74
+ prototype.registerHybridSetter("fontSize", &HybridNitroNumberViewSpec::setFontSize);
75
+ prototype.registerHybridGetter("prefixFontSize", &HybridNitroNumberViewSpec::getPrefixFontSize);
76
+ prototype.registerHybridSetter("prefixFontSize", &HybridNitroNumberViewSpec::setPrefixFontSize);
77
+ prototype.registerHybridGetter("suffixFontSize", &HybridNitroNumberViewSpec::getSuffixFontSize);
78
+ prototype.registerHybridSetter("suffixFontSize", &HybridNitroNumberViewSpec::setSuffixFontSize);
79
+ prototype.registerHybridGetter("affixAlign", &HybridNitroNumberViewSpec::getAffixAlign);
80
+ prototype.registerHybridSetter("affixAlign", &HybridNitroNumberViewSpec::setAffixAlign);
81
+ prototype.registerHybridGetter("prefixAlign", &HybridNitroNumberViewSpec::getPrefixAlign);
82
+ prototype.registerHybridSetter("prefixAlign", &HybridNitroNumberViewSpec::setPrefixAlign);
83
+ prototype.registerHybridGetter("suffixAlign", &HybridNitroNumberViewSpec::getSuffixAlign);
84
+ prototype.registerHybridSetter("suffixAlign", &HybridNitroNumberViewSpec::setSuffixAlign);
85
+ prototype.registerHybridGetter("adjustsFontSizeToFit", &HybridNitroNumberViewSpec::getAdjustsFontSizeToFit);
86
+ prototype.registerHybridSetter("adjustsFontSizeToFit", &HybridNitroNumberViewSpec::setAdjustsFontSizeToFit);
87
+ prototype.registerHybridGetter("minimumFontScale", &HybridNitroNumberViewSpec::getMinimumFontScale);
88
+ prototype.registerHybridSetter("minimumFontScale", &HybridNitroNumberViewSpec::setMinimumFontScale);
89
+ prototype.registerHybridGetter("allowFontScaling", &HybridNitroNumberViewSpec::getAllowFontScaling);
90
+ prototype.registerHybridSetter("allowFontScaling", &HybridNitroNumberViewSpec::setAllowFontScaling);
91
+ prototype.registerHybridGetter("maxFontSizeMultiplier", &HybridNitroNumberViewSpec::getMaxFontSizeMultiplier);
92
+ prototype.registerHybridSetter("maxFontSizeMultiplier", &HybridNitroNumberViewSpec::setMaxFontSizeMultiplier);
93
+ prototype.registerHybridGetter("fontWeight", &HybridNitroNumberViewSpec::getFontWeight);
94
+ prototype.registerHybridSetter("fontWeight", &HybridNitroNumberViewSpec::setFontWeight);
95
+ prototype.registerHybridGetter("fontFamily", &HybridNitroNumberViewSpec::getFontFamily);
96
+ prototype.registerHybridSetter("fontFamily", &HybridNitroNumberViewSpec::setFontFamily);
97
+ prototype.registerHybridGetter("color", &HybridNitroNumberViewSpec::getColor);
98
+ prototype.registerHybridSetter("color", &HybridNitroNumberViewSpec::setColor);
99
+ prototype.registerHybridGetter("textAlign", &HybridNitroNumberViewSpec::getTextAlign);
100
+ prototype.registerHybridSetter("textAlign", &HybridNitroNumberViewSpec::setTextAlign);
101
+ prototype.registerHybridGetter("rightToLeft", &HybridNitroNumberViewSpec::getRightToLeft);
102
+ prototype.registerHybridSetter("rightToLeft", &HybridNitroNumberViewSpec::setRightToLeft);
103
+ prototype.registerHybridGetter("onSizeChange", &HybridNitroNumberViewSpec::getOnSizeChange);
104
+ prototype.registerHybridSetter("onSizeChange", &HybridNitroNumberViewSpec::setOnSizeChange);
105
+ prototype.registerHybridGetter("onRevealEnd", &HybridNitroNumberViewSpec::getOnRevealEnd);
106
+ prototype.registerHybridSetter("onRevealEnd", &HybridNitroNumberViewSpec::setOnRevealEnd);
107
+ prototype.registerHybridGetter("onRevealMilestone", &HybridNitroNumberViewSpec::getOnRevealMilestone);
108
+ prototype.registerHybridSetter("onRevealMilestone", &HybridNitroNumberViewSpec::setOnRevealMilestone);
109
+ prototype.registerHybridMethod("jumpTo", &HybridNitroNumberViewSpec::jumpTo);
110
+ prototype.registerHybridMethod("animateTo", &HybridNitroNumberViewSpec::animateTo);
111
+ prototype.registerHybridMethod("revealTo", &HybridNitroNumberViewSpec::revealTo);
112
+ });
113
+ }
114
+
115
+ } // namespace margelo::nitro::nitroinput
@@ -0,0 +1,175 @@
1
+ ///
2
+ /// HybridNitroNumberViewSpec.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/HybridObject.hpp>)
11
+ #include <NitroModules/HybridObject.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+
16
+ // Forward declaration of `NitroNumberEasing` to properly resolve imports.
17
+ namespace margelo::nitro::nitroinput { enum class NitroNumberEasing; }
18
+ // Forward declaration of `NitroNumberTransition` to properly resolve imports.
19
+ namespace margelo::nitro::nitroinput { enum class NitroNumberTransition; }
20
+ // Forward declaration of `NitroNumberDirection` to properly resolve imports.
21
+ namespace margelo::nitro::nitroinput { enum class NitroNumberDirection; }
22
+ // Forward declaration of `NitroNumberRevealStyle` to properly resolve imports.
23
+ namespace margelo::nitro::nitroinput { enum class NitroNumberRevealStyle; }
24
+ // Forward declaration of `NitroNumberAffixAlign` to properly resolve imports.
25
+ namespace margelo::nitro::nitroinput { enum class NitroNumberAffixAlign; }
26
+ // Forward declaration of `NitroNumberTextAlign` to properly resolve imports.
27
+ namespace margelo::nitro::nitroinput { enum class NitroNumberTextAlign; }
28
+
29
+ #include <optional>
30
+ #include <string>
31
+ #include "NitroNumberEasing.hpp"
32
+ #include "NitroNumberTransition.hpp"
33
+ #include "NitroNumberDirection.hpp"
34
+ #include "NitroNumberRevealStyle.hpp"
35
+ #include <vector>
36
+ #include "NitroNumberAffixAlign.hpp"
37
+ #include "NitroNumberTextAlign.hpp"
38
+ #include <functional>
39
+
40
+ namespace margelo::nitro::nitroinput {
41
+
42
+ using namespace margelo::nitro;
43
+
44
+ /**
45
+ * An abstract base class for `NitroNumberView`
46
+ * Inherit this class to create instances of `HybridNitroNumberViewSpec` in C++.
47
+ * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
48
+ * @example
49
+ * ```cpp
50
+ * class HybridNitroNumberView: public HybridNitroNumberViewSpec {
51
+ * public:
52
+ * HybridNitroNumberView(...): HybridObject(TAG) { ... }
53
+ * // ...
54
+ * };
55
+ * ```
56
+ */
57
+ class HybridNitroNumberViewSpec: public virtual HybridObject {
58
+ public:
59
+ // Constructor
60
+ explicit HybridNitroNumberViewSpec(): HybridObject(TAG) { }
61
+
62
+ // Destructor
63
+ ~HybridNitroNumberViewSpec() override = default;
64
+
65
+ public:
66
+ // Properties
67
+ virtual double getValue() = 0;
68
+ virtual void setValue(double value) = 0;
69
+ virtual std::optional<double> getFractionDigits() = 0;
70
+ virtual void setFractionDigits(std::optional<double> fractionDigits) = 0;
71
+ virtual std::optional<double> getMinimumIntegerDigits() = 0;
72
+ virtual void setMinimumIntegerDigits(std::optional<double> minimumIntegerDigits) = 0;
73
+ virtual std::optional<std::string> getGroupingSeparator() = 0;
74
+ virtual void setGroupingSeparator(const std::optional<std::string>& groupingSeparator) = 0;
75
+ virtual std::optional<std::string> getDecimalSeparator() = 0;
76
+ virtual void setDecimalSeparator(const std::optional<std::string>& decimalSeparator) = 0;
77
+ virtual std::optional<std::string> getPrefix() = 0;
78
+ virtual void setPrefix(const std::optional<std::string>& prefix) = 0;
79
+ virtual std::optional<std::string> getSuffix() = 0;
80
+ virtual void setSuffix(const std::optional<std::string>& suffix) = 0;
81
+ virtual std::optional<double> getDuration() = 0;
82
+ virtual void setDuration(std::optional<double> duration) = 0;
83
+ virtual std::optional<NitroNumberEasing> getEasing() = 0;
84
+ virtual void setEasing(std::optional<NitroNumberEasing> easing) = 0;
85
+ virtual std::optional<double> getBounce() = 0;
86
+ virtual void setBounce(std::optional<double> bounce) = 0;
87
+ virtual std::optional<double> getStagger() = 0;
88
+ virtual void setStagger(std::optional<double> stagger) = 0;
89
+ virtual std::optional<NitroNumberTransition> getTransition() = 0;
90
+ virtual void setTransition(std::optional<NitroNumberTransition> transition) = 0;
91
+ virtual std::optional<double> getFlashUpColor() = 0;
92
+ virtual void setFlashUpColor(std::optional<double> flashUpColor) = 0;
93
+ virtual std::optional<double> getFlashDownColor() = 0;
94
+ virtual void setFlashDownColor(std::optional<double> flashDownColor) = 0;
95
+ virtual std::optional<double> getFlashDuration() = 0;
96
+ virtual void setFlashDuration(std::optional<double> flashDuration) = 0;
97
+ virtual std::optional<double> getPopOnChange() = 0;
98
+ virtual void setPopOnChange(std::optional<double> popOnChange) = 0;
99
+ virtual std::optional<NitroNumberDirection> getRollDirection() = 0;
100
+ virtual void setRollDirection(std::optional<NitroNumberDirection> rollDirection) = 0;
101
+ virtual std::optional<double> getRevealState() = 0;
102
+ virtual void setRevealState(std::optional<double> revealState) = 0;
103
+ virtual std::optional<NitroNumberRevealStyle> getRevealStyle() = 0;
104
+ virtual void setRevealStyle(std::optional<NitroNumberRevealStyle> revealStyle) = 0;
105
+ virtual std::optional<double> getRevealDuration() = 0;
106
+ virtual void setRevealDuration(std::optional<double> revealDuration) = 0;
107
+ virtual std::optional<double> getRevealBounce() = 0;
108
+ virtual void setRevealBounce(std::optional<double> revealBounce) = 0;
109
+ virtual std::optional<double> getRevealGrow() = 0;
110
+ virtual void setRevealGrow(std::optional<double> revealGrow) = 0;
111
+ virtual std::optional<double> getRevealStagger() = 0;
112
+ virtual void setRevealStagger(std::optional<double> revealStagger) = 0;
113
+ virtual std::optional<std::vector<double>> getRevealMilestones() = 0;
114
+ virtual void setRevealMilestones(const std::optional<std::vector<double>>& revealMilestones) = 0;
115
+ virtual std::optional<double> getRevealMilestoneHold() = 0;
116
+ virtual void setRevealMilestoneHold(std::optional<double> revealMilestoneHold) = 0;
117
+ virtual std::optional<bool> getLoading() = 0;
118
+ virtual void setLoading(std::optional<bool> loading) = 0;
119
+ virtual std::optional<double> getShimmerColor() = 0;
120
+ virtual void setShimmerColor(std::optional<double> shimmerColor) = 0;
121
+ virtual std::optional<double> getShimmerDuration() = 0;
122
+ virtual void setShimmerDuration(std::optional<double> shimmerDuration) = 0;
123
+ virtual std::optional<double> getFontSize() = 0;
124
+ virtual void setFontSize(std::optional<double> fontSize) = 0;
125
+ virtual std::optional<double> getPrefixFontSize() = 0;
126
+ virtual void setPrefixFontSize(std::optional<double> prefixFontSize) = 0;
127
+ virtual std::optional<double> getSuffixFontSize() = 0;
128
+ virtual void setSuffixFontSize(std::optional<double> suffixFontSize) = 0;
129
+ virtual std::optional<NitroNumberAffixAlign> getAffixAlign() = 0;
130
+ virtual void setAffixAlign(std::optional<NitroNumberAffixAlign> affixAlign) = 0;
131
+ virtual std::optional<NitroNumberAffixAlign> getPrefixAlign() = 0;
132
+ virtual void setPrefixAlign(std::optional<NitroNumberAffixAlign> prefixAlign) = 0;
133
+ virtual std::optional<NitroNumberAffixAlign> getSuffixAlign() = 0;
134
+ virtual void setSuffixAlign(std::optional<NitroNumberAffixAlign> suffixAlign) = 0;
135
+ virtual std::optional<bool> getAdjustsFontSizeToFit() = 0;
136
+ virtual void setAdjustsFontSizeToFit(std::optional<bool> adjustsFontSizeToFit) = 0;
137
+ virtual std::optional<double> getMinimumFontScale() = 0;
138
+ virtual void setMinimumFontScale(std::optional<double> minimumFontScale) = 0;
139
+ virtual std::optional<bool> getAllowFontScaling() = 0;
140
+ virtual void setAllowFontScaling(std::optional<bool> allowFontScaling) = 0;
141
+ virtual std::optional<double> getMaxFontSizeMultiplier() = 0;
142
+ virtual void setMaxFontSizeMultiplier(std::optional<double> maxFontSizeMultiplier) = 0;
143
+ virtual std::optional<double> getFontWeight() = 0;
144
+ virtual void setFontWeight(std::optional<double> fontWeight) = 0;
145
+ virtual std::optional<std::string> getFontFamily() = 0;
146
+ virtual void setFontFamily(const std::optional<std::string>& fontFamily) = 0;
147
+ virtual std::optional<double> getColor() = 0;
148
+ virtual void setColor(std::optional<double> color) = 0;
149
+ virtual std::optional<NitroNumberTextAlign> getTextAlign() = 0;
150
+ virtual void setTextAlign(std::optional<NitroNumberTextAlign> textAlign) = 0;
151
+ virtual std::optional<bool> getRightToLeft() = 0;
152
+ virtual void setRightToLeft(std::optional<bool> rightToLeft) = 0;
153
+ virtual std::optional<std::function<void(double /* width */, double /* height */)>> getOnSizeChange() = 0;
154
+ virtual void setOnSizeChange(const std::optional<std::function<void(double /* width */, double /* height */)>>& onSizeChange) = 0;
155
+ virtual std::optional<std::function<void()>> getOnRevealEnd() = 0;
156
+ virtual void setOnRevealEnd(const std::optional<std::function<void()>>& onRevealEnd) = 0;
157
+ virtual std::optional<std::function<void(double /* index */, double /* value */)>> getOnRevealMilestone() = 0;
158
+ virtual void setOnRevealMilestone(const std::optional<std::function<void(double /* index */, double /* value */)>>& onRevealMilestone) = 0;
159
+
160
+ public:
161
+ // Methods
162
+ virtual void jumpTo(double value) = 0;
163
+ virtual void animateTo(double value) = 0;
164
+ virtual void revealTo(double value) = 0;
165
+
166
+ protected:
167
+ // Hybrid Setup
168
+ void loadHybridMethods() override;
169
+
170
+ protected:
171
+ // Tag for logging
172
+ static constexpr auto TAG = "NitroNumberView";
173
+ };
174
+
175
+ } // namespace margelo::nitro::nitroinput
@@ -0,0 +1,84 @@
1
+ ///
2
+ /// NitroNumberAffixAlign.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/NitroHash.hpp>)
11
+ #include <NitroModules/NitroHash.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
16
+ #include <NitroModules/JSIConverter.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
21
+ #include <NitroModules/NitroDefines.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+
26
+ namespace margelo::nitro::nitroinput {
27
+
28
+ /**
29
+ * An enum which can be represented as a JavaScript union (NitroNumberAffixAlign).
30
+ */
31
+ enum class NitroNumberAffixAlign {
32
+ CENTER SWIFT_NAME(center) = 0,
33
+ TOP SWIFT_NAME(top) = 1,
34
+ BOTTOM SWIFT_NAME(bottom) = 2,
35
+ BASELINE SWIFT_NAME(baseline) = 3,
36
+ } CLOSED_ENUM;
37
+
38
+ } // namespace margelo::nitro::nitroinput
39
+
40
+ namespace margelo::nitro {
41
+
42
+ // C++ NitroNumberAffixAlign <> JS NitroNumberAffixAlign (union)
43
+ template <>
44
+ struct JSIConverter<margelo::nitro::nitroinput::NitroNumberAffixAlign> final {
45
+ static inline margelo::nitro::nitroinput::NitroNumberAffixAlign fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
46
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
47
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
48
+ case hashString("center"): return margelo::nitro::nitroinput::NitroNumberAffixAlign::CENTER;
49
+ case hashString("top"): return margelo::nitro::nitroinput::NitroNumberAffixAlign::TOP;
50
+ case hashString("bottom"): return margelo::nitro::nitroinput::NitroNumberAffixAlign::BOTTOM;
51
+ case hashString("baseline"): return margelo::nitro::nitroinput::NitroNumberAffixAlign::BASELINE;
52
+ default: [[unlikely]]
53
+ throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum NitroNumberAffixAlign - invalid value!");
54
+ }
55
+ }
56
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitroinput::NitroNumberAffixAlign arg) {
57
+ switch (arg) {
58
+ case margelo::nitro::nitroinput::NitroNumberAffixAlign::CENTER: return JSIConverter<std::string>::toJSI(runtime, "center");
59
+ case margelo::nitro::nitroinput::NitroNumberAffixAlign::TOP: return JSIConverter<std::string>::toJSI(runtime, "top");
60
+ case margelo::nitro::nitroinput::NitroNumberAffixAlign::BOTTOM: return JSIConverter<std::string>::toJSI(runtime, "bottom");
61
+ case margelo::nitro::nitroinput::NitroNumberAffixAlign::BASELINE: return JSIConverter<std::string>::toJSI(runtime, "baseline");
62
+ default: [[unlikely]]
63
+ throw std::invalid_argument("Cannot convert NitroNumberAffixAlign to JS - invalid value: "
64
+ + std::to_string(static_cast<int>(arg)) + "!");
65
+ }
66
+ }
67
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
68
+ if (!value.isString()) {
69
+ return false;
70
+ }
71
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
72
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
73
+ case hashString("center"):
74
+ case hashString("top"):
75
+ case hashString("bottom"):
76
+ case hashString("baseline"):
77
+ return true;
78
+ default:
79
+ return false;
80
+ }
81
+ }
82
+ };
83
+
84
+ } // namespace margelo::nitro