react-native-nitro-input 0.3.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 (108) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +90 -2
  3. package/android/src/main/cpp/JReflowEngine.cpp +32 -0
  4. package/android/src/main/cpp/JReflowEngine.hpp +13 -0
  5. package/android/src/main/cpp/JRollingEngine.cpp +42 -2
  6. package/android/src/main/cpp/JRollingEngine.hpp +9 -1
  7. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberFormatPlatform.kt +76 -1
  8. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberView.kt +88 -0
  9. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroTextMeasure.kt +25 -0
  10. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroTextView.kt +140 -0
  11. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroInputPackage.kt +2 -1
  12. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroNumberView.kt +388 -136
  13. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroTextView.kt +868 -0
  14. package/android/src/main/java/com/margelo/nitro/nitroinput/ReflowEngine.kt +21 -0
  15. package/android/src/main/java/com/margelo/nitro/nitroinput/RollingEngine.kt +13 -2
  16. package/cpp/RollingEngine.cpp +92 -8
  17. package/cpp/RollingEngine.hpp +36 -2
  18. package/ios/HybridNitroNumberFormatPlatform.swift +87 -9
  19. package/ios/HybridNitroNumberView.swift +82 -1
  20. package/ios/HybridNitroTextView.swift +134 -0
  21. package/ios/NitroNumberView.swift +368 -135
  22. package/ios/NitroTextView.swift +583 -0
  23. package/lib/commonjs/nitrogen/generated/shared/json/NitroNumberViewConfig.json +20 -0
  24. package/lib/commonjs/nitrogen/generated/shared/json/NitroTextViewConfig.json +30 -0
  25. package/lib/commonjs/src/NitroNumber.js +52 -3
  26. package/lib/commonjs/src/NitroText.js +138 -0
  27. package/lib/commonjs/src/NitroTime.js +65 -0
  28. package/lib/commonjs/src/formatProps.js +76 -16
  29. package/lib/commonjs/src/index.js +6 -1
  30. package/lib/commonjs/src/specs/NitroText.nitro.js +2 -0
  31. package/lib/module/nitrogen/generated/shared/json/NitroNumberViewConfig.json +20 -0
  32. package/lib/module/nitrogen/generated/shared/json/NitroTextViewConfig.json +30 -0
  33. package/lib/module/src/NitroNumber.js +53 -4
  34. package/lib/module/src/NitroText.js +98 -0
  35. package/lib/module/src/NitroTime.js +29 -0
  36. package/lib/module/src/formatProps.js +76 -17
  37. package/lib/module/src/index.js +2 -0
  38. package/lib/module/src/specs/NitroText.nitro.js +1 -0
  39. package/lib/typescript/src/NitroNumber.d.ts +79 -1
  40. package/lib/typescript/src/NitroText.d.ts +67 -0
  41. package/lib/typescript/src/NitroTime.d.ts +19 -0
  42. package/lib/typescript/src/formatProps.d.ts +30 -4
  43. package/lib/typescript/src/index.d.ts +4 -1
  44. package/lib/typescript/src/specs/NitroNumber.nitro.d.ts +67 -0
  45. package/lib/typescript/src/specs/NitroText.nitro.d.ts +60 -0
  46. package/nitro.json +20 -0
  47. package/nitrogen/generated/android/NitroInput+autolinking.cmake +6 -0
  48. package/nitrogen/generated/android/NitroInputOnLoad.cpp +34 -0
  49. package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.cpp +243 -0
  50. package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.hpp +40 -0
  51. package/nitrogen/generated/android/c++/JHybridNitroTextMeasureSpec.cpp +58 -0
  52. package/nitrogen/generated/android/c++/JHybridNitroTextMeasureSpec.hpp +64 -0
  53. package/nitrogen/generated/android/c++/JHybridNitroTextViewSpec.cpp +253 -0
  54. package/nitrogen/generated/android/c++/JHybridNitroTextViewSpec.hpp +104 -0
  55. package/nitrogen/generated/android/c++/JNitroNumberShimmerDirection.hpp +61 -0
  56. package/nitrogen/generated/android/c++/JNitroNumberSignDisplay.hpp +67 -0
  57. package/nitrogen/generated/android/c++/views/JHybridNitroNumberViewStateUpdater.cpp +100 -0
  58. package/nitrogen/generated/android/c++/views/JHybridNitroTextViewStateUpdater.cpp +174 -0
  59. package/nitrogen/generated/android/c++/views/JHybridNitroTextViewStateUpdater.hpp +54 -0
  60. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroNumberViewSpec.kt +136 -0
  61. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroTextMeasureSpec.kt +60 -0
  62. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroTextViewSpec.kt +179 -0
  63. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberShimmerDirection.kt +24 -0
  64. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberSignDisplay.kt +26 -0
  65. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/views/HybridNitroTextViewManager.kt +96 -0
  66. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/views/HybridNitroTextViewStateUpdater.kt +23 -0
  67. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.cpp +34 -0
  68. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.hpp +132 -11
  69. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Umbrella.hpp +16 -0
  70. package/nitrogen/generated/ios/NitroInputAutolinking.mm +16 -0
  71. package/nitrogen/generated/ios/NitroInputAutolinking.swift +24 -0
  72. package/nitrogen/generated/ios/c++/HybridNitroNumberViewSpecSwift.hpp +146 -0
  73. package/nitrogen/generated/ios/c++/HybridNitroTextMeasureSpecSwift.cpp +11 -0
  74. package/nitrogen/generated/ios/c++/HybridNitroTextMeasureSpecSwift.hpp +90 -0
  75. package/nitrogen/generated/ios/c++/HybridNitroTextViewSpecSwift.cpp +11 -0
  76. package/nitrogen/generated/ios/c++/HybridNitroTextViewSpecSwift.hpp +233 -0
  77. package/nitrogen/generated/ios/c++/views/HybridNitroNumberViewComponent.mm +120 -0
  78. package/nitrogen/generated/ios/c++/views/HybridNitroTextViewComponent.mm +264 -0
  79. package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec.swift +20 -0
  80. package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec_cxx.swift +493 -0
  81. package/nitrogen/generated/ios/swift/HybridNitroTextMeasureSpec.swift +56 -0
  82. package/nitrogen/generated/ios/swift/HybridNitroTextMeasureSpec_cxx.swift +150 -0
  83. package/nitrogen/generated/ios/swift/HybridNitroTextViewSpec.swift +75 -0
  84. package/nitrogen/generated/ios/swift/HybridNitroTextViewSpec_cxx.swift +608 -0
  85. package/nitrogen/generated/ios/swift/NitroNumberShimmerDirection.swift +44 -0
  86. package/nitrogen/generated/ios/swift/NitroNumberSignDisplay.swift +52 -0
  87. package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.cpp +40 -0
  88. package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.hpp +46 -0
  89. package/nitrogen/generated/shared/c++/HybridNitroTextMeasureSpec.cpp +22 -0
  90. package/nitrogen/generated/shared/c++/HybridNitroTextMeasureSpec.hpp +63 -0
  91. package/nitrogen/generated/shared/c++/HybridNitroTextViewSpec.cpp +62 -0
  92. package/nitrogen/generated/shared/c++/HybridNitroTextViewSpec.hpp +115 -0
  93. package/nitrogen/generated/shared/c++/NitroNumberShimmerDirection.hpp +80 -0
  94. package/nitrogen/generated/shared/c++/NitroNumberSignDisplay.hpp +88 -0
  95. package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.cpp +40 -0
  96. package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.hpp +62 -0
  97. package/nitrogen/generated/shared/c++/views/HybridNitroTextViewComponent.cpp +74 -0
  98. package/nitrogen/generated/shared/c++/views/HybridNitroTextViewComponent.hpp +149 -0
  99. package/nitrogen/generated/shared/json/NitroNumberViewConfig.json +20 -0
  100. package/nitrogen/generated/shared/json/NitroTextViewConfig.json +30 -0
  101. package/package.json +1 -1
  102. package/src/NitroNumber.tsx +183 -9
  103. package/src/NitroText.tsx +166 -0
  104. package/src/NitroTime.tsx +68 -0
  105. package/src/formatProps.ts +108 -18
  106. package/src/index.ts +5 -0
  107. package/src/specs/NitroNumber.nitro.ts +69 -0
  108. package/src/specs/NitroText.nitro.ts +65 -0
@@ -70,6 +70,16 @@ namespace margelo::nitro::nitroinput {
70
70
  prototype.registerHybridSetter("shimmerColor", &HybridNitroNumberViewSpec::setShimmerColor);
71
71
  prototype.registerHybridGetter("shimmerDuration", &HybridNitroNumberViewSpec::getShimmerDuration);
72
72
  prototype.registerHybridSetter("shimmerDuration", &HybridNitroNumberViewSpec::setShimmerDuration);
73
+ prototype.registerHybridGetter("shimmerAngle", &HybridNitroNumberViewSpec::getShimmerAngle);
74
+ prototype.registerHybridSetter("shimmerAngle", &HybridNitroNumberViewSpec::setShimmerAngle);
75
+ prototype.registerHybridGetter("shimmerWidth", &HybridNitroNumberViewSpec::getShimmerWidth);
76
+ prototype.registerHybridSetter("shimmerWidth", &HybridNitroNumberViewSpec::setShimmerWidth);
77
+ prototype.registerHybridGetter("shimmerBaseColor", &HybridNitroNumberViewSpec::getShimmerBaseColor);
78
+ prototype.registerHybridSetter("shimmerBaseColor", &HybridNitroNumberViewSpec::setShimmerBaseColor);
79
+ prototype.registerHybridGetter("shimmerDirection", &HybridNitroNumberViewSpec::getShimmerDirection);
80
+ prototype.registerHybridSetter("shimmerDirection", &HybridNitroNumberViewSpec::setShimmerDirection);
81
+ prototype.registerHybridGetter("shimmerDelay", &HybridNitroNumberViewSpec::getShimmerDelay);
82
+ prototype.registerHybridSetter("shimmerDelay", &HybridNitroNumberViewSpec::setShimmerDelay);
73
83
  prototype.registerHybridGetter("fontSize", &HybridNitroNumberViewSpec::getFontSize);
74
84
  prototype.registerHybridSetter("fontSize", &HybridNitroNumberViewSpec::setFontSize);
75
85
  prototype.registerHybridGetter("prefixFontSize", &HybridNitroNumberViewSpec::getPrefixFontSize);
@@ -94,6 +104,32 @@ namespace margelo::nitro::nitroinput {
94
104
  prototype.registerHybridSetter("suffixOffset", &HybridNitroNumberViewSpec::setSuffixOffset);
95
105
  prototype.registerHybridGetter("tabularNums", &HybridNitroNumberViewSpec::getTabularNums);
96
106
  prototype.registerHybridSetter("tabularNums", &HybridNitroNumberViewSpec::setTabularNums);
107
+ prototype.registerHybridGetter("signDisplay", &HybridNitroNumberViewSpec::getSignDisplay);
108
+ prototype.registerHybridSetter("signDisplay", &HybridNitroNumberViewSpec::setSignDisplay);
109
+ prototype.registerHybridGetter("plusSign", &HybridNitroNumberViewSpec::getPlusSign);
110
+ prototype.registerHybridSetter("plusSign", &HybridNitroNumberViewSpec::setPlusSign);
111
+ prototype.registerHybridGetter("minusSign", &HybridNitroNumberViewSpec::getMinusSign);
112
+ prototype.registerHybridSetter("minusSign", &HybridNitroNumberViewSpec::setMinusSign);
113
+ prototype.registerHybridGetter("digitGlyphs", &HybridNitroNumberViewSpec::getDigitGlyphs);
114
+ prototype.registerHybridSetter("digitGlyphs", &HybridNitroNumberViewSpec::setDigitGlyphs);
115
+ prototype.registerHybridGetter("groupingSizes", &HybridNitroNumberViewSpec::getGroupingSizes);
116
+ prototype.registerHybridSetter("groupingSizes", &HybridNitroNumberViewSpec::setGroupingSizes);
117
+ prototype.registerHybridGetter("digitMax", &HybridNitroNumberViewSpec::getDigitMax);
118
+ prototype.registerHybridSetter("digitMax", &HybridNitroNumberViewSpec::setDigitMax);
119
+ prototype.registerHybridGetter("continuous", &HybridNitroNumberViewSpec::getContinuous);
120
+ prototype.registerHybridSetter("continuous", &HybridNitroNumberViewSpec::setContinuous);
121
+ prototype.registerHybridGetter("prefixColor", &HybridNitroNumberViewSpec::getPrefixColor);
122
+ prototype.registerHybridSetter("prefixColor", &HybridNitroNumberViewSpec::setPrefixColor);
123
+ prototype.registerHybridGetter("suffixColor", &HybridNitroNumberViewSpec::getSuffixColor);
124
+ prototype.registerHybridSetter("suffixColor", &HybridNitroNumberViewSpec::setSuffixColor);
125
+ prototype.registerHybridGetter("fractionColor", &HybridNitroNumberViewSpec::getFractionColor);
126
+ prototype.registerHybridSetter("fractionColor", &HybridNitroNumberViewSpec::setFractionColor);
127
+ prototype.registerHybridGetter("fractionFontSize", &HybridNitroNumberViewSpec::getFractionFontSize);
128
+ prototype.registerHybridSetter("fractionFontSize", &HybridNitroNumberViewSpec::setFractionFontSize);
129
+ prototype.registerHybridGetter("fractionAlign", &HybridNitroNumberViewSpec::getFractionAlign);
130
+ prototype.registerHybridSetter("fractionAlign", &HybridNitroNumberViewSpec::setFractionAlign);
131
+ prototype.registerHybridGetter("respectReduceMotion", &HybridNitroNumberViewSpec::getRespectReduceMotion);
132
+ prototype.registerHybridSetter("respectReduceMotion", &HybridNitroNumberViewSpec::setRespectReduceMotion);
97
133
  prototype.registerHybridGetter("adjustsFontSizeToFit", &HybridNitroNumberViewSpec::getAdjustsFontSizeToFit);
98
134
  prototype.registerHybridSetter("adjustsFontSizeToFit", &HybridNitroNumberViewSpec::setAdjustsFontSizeToFit);
99
135
  prototype.registerHybridGetter("minimumFontScale", &HybridNitroNumberViewSpec::getMinimumFontScale);
@@ -118,6 +154,10 @@ namespace margelo::nitro::nitroinput {
118
154
  prototype.registerHybridSetter("onRevealEnd", &HybridNitroNumberViewSpec::setOnRevealEnd);
119
155
  prototype.registerHybridGetter("onRevealMilestone", &HybridNitroNumberViewSpec::getOnRevealMilestone);
120
156
  prototype.registerHybridSetter("onRevealMilestone", &HybridNitroNumberViewSpec::setOnRevealMilestone);
157
+ prototype.registerHybridGetter("onAnimationStart", &HybridNitroNumberViewSpec::getOnAnimationStart);
158
+ prototype.registerHybridSetter("onAnimationStart", &HybridNitroNumberViewSpec::setOnAnimationStart);
159
+ prototype.registerHybridGetter("onAnimationEnd", &HybridNitroNumberViewSpec::getOnAnimationEnd);
160
+ prototype.registerHybridSetter("onAnimationEnd", &HybridNitroNumberViewSpec::setOnAnimationEnd);
121
161
  prototype.registerHybridMethod("jumpTo", &HybridNitroNumberViewSpec::jumpTo);
122
162
  prototype.registerHybridMethod("animateTo", &HybridNitroNumberViewSpec::animateTo);
123
163
  prototype.registerHybridMethod("revealTo", &HybridNitroNumberViewSpec::revealTo);
@@ -21,8 +21,12 @@ namespace margelo::nitro::nitroinput { enum class NitroNumberTransition; }
21
21
  namespace margelo::nitro::nitroinput { enum class NitroNumberDirection; }
22
22
  // Forward declaration of `NitroNumberRevealStyle` to properly resolve imports.
23
23
  namespace margelo::nitro::nitroinput { enum class NitroNumberRevealStyle; }
24
+ // Forward declaration of `NitroNumberShimmerDirection` to properly resolve imports.
25
+ namespace margelo::nitro::nitroinput { enum class NitroNumberShimmerDirection; }
24
26
  // Forward declaration of `NitroNumberAffixAlign` to properly resolve imports.
25
27
  namespace margelo::nitro::nitroinput { enum class NitroNumberAffixAlign; }
28
+ // Forward declaration of `NitroNumberSignDisplay` to properly resolve imports.
29
+ namespace margelo::nitro::nitroinput { enum class NitroNumberSignDisplay; }
26
30
  // Forward declaration of `NitroNumberTextAlign` to properly resolve imports.
27
31
  namespace margelo::nitro::nitroinput { enum class NitroNumberTextAlign; }
28
32
 
@@ -33,7 +37,9 @@ namespace margelo::nitro::nitroinput { enum class NitroNumberTextAlign; }
33
37
  #include "NitroNumberDirection.hpp"
34
38
  #include "NitroNumberRevealStyle.hpp"
35
39
  #include <vector>
40
+ #include "NitroNumberShimmerDirection.hpp"
36
41
  #include "NitroNumberAffixAlign.hpp"
42
+ #include "NitroNumberSignDisplay.hpp"
37
43
  #include "NitroNumberTextAlign.hpp"
38
44
  #include <functional>
39
45
 
@@ -120,6 +126,16 @@ namespace margelo::nitro::nitroinput {
120
126
  virtual void setShimmerColor(std::optional<double> shimmerColor) = 0;
121
127
  virtual std::optional<double> getShimmerDuration() = 0;
122
128
  virtual void setShimmerDuration(std::optional<double> shimmerDuration) = 0;
129
+ virtual std::optional<double> getShimmerAngle() = 0;
130
+ virtual void setShimmerAngle(std::optional<double> shimmerAngle) = 0;
131
+ virtual std::optional<double> getShimmerWidth() = 0;
132
+ virtual void setShimmerWidth(std::optional<double> shimmerWidth) = 0;
133
+ virtual std::optional<double> getShimmerBaseColor() = 0;
134
+ virtual void setShimmerBaseColor(std::optional<double> shimmerBaseColor) = 0;
135
+ virtual std::optional<NitroNumberShimmerDirection> getShimmerDirection() = 0;
136
+ virtual void setShimmerDirection(std::optional<NitroNumberShimmerDirection> shimmerDirection) = 0;
137
+ virtual std::optional<double> getShimmerDelay() = 0;
138
+ virtual void setShimmerDelay(std::optional<double> shimmerDelay) = 0;
123
139
  virtual std::optional<double> getFontSize() = 0;
124
140
  virtual void setFontSize(std::optional<double> fontSize) = 0;
125
141
  virtual std::optional<double> getPrefixFontSize() = 0;
@@ -144,6 +160,32 @@ namespace margelo::nitro::nitroinput {
144
160
  virtual void setSuffixOffset(std::optional<double> suffixOffset) = 0;
145
161
  virtual std::optional<bool> getTabularNums() = 0;
146
162
  virtual void setTabularNums(std::optional<bool> tabularNums) = 0;
163
+ virtual std::optional<NitroNumberSignDisplay> getSignDisplay() = 0;
164
+ virtual void setSignDisplay(std::optional<NitroNumberSignDisplay> signDisplay) = 0;
165
+ virtual std::optional<std::string> getPlusSign() = 0;
166
+ virtual void setPlusSign(const std::optional<std::string>& plusSign) = 0;
167
+ virtual std::optional<std::string> getMinusSign() = 0;
168
+ virtual void setMinusSign(const std::optional<std::string>& minusSign) = 0;
169
+ virtual std::optional<std::vector<std::string>> getDigitGlyphs() = 0;
170
+ virtual void setDigitGlyphs(const std::optional<std::vector<std::string>>& digitGlyphs) = 0;
171
+ virtual std::optional<std::vector<double>> getGroupingSizes() = 0;
172
+ virtual void setGroupingSizes(const std::optional<std::vector<double>>& groupingSizes) = 0;
173
+ virtual std::optional<std::vector<double>> getDigitMax() = 0;
174
+ virtual void setDigitMax(const std::optional<std::vector<double>>& digitMax) = 0;
175
+ virtual std::optional<bool> getContinuous() = 0;
176
+ virtual void setContinuous(std::optional<bool> continuous) = 0;
177
+ virtual std::optional<double> getPrefixColor() = 0;
178
+ virtual void setPrefixColor(std::optional<double> prefixColor) = 0;
179
+ virtual std::optional<double> getSuffixColor() = 0;
180
+ virtual void setSuffixColor(std::optional<double> suffixColor) = 0;
181
+ virtual std::optional<double> getFractionColor() = 0;
182
+ virtual void setFractionColor(std::optional<double> fractionColor) = 0;
183
+ virtual std::optional<double> getFractionFontSize() = 0;
184
+ virtual void setFractionFontSize(std::optional<double> fractionFontSize) = 0;
185
+ virtual std::optional<NitroNumberAffixAlign> getFractionAlign() = 0;
186
+ virtual void setFractionAlign(std::optional<NitroNumberAffixAlign> fractionAlign) = 0;
187
+ virtual std::optional<bool> getRespectReduceMotion() = 0;
188
+ virtual void setRespectReduceMotion(std::optional<bool> respectReduceMotion) = 0;
147
189
  virtual std::optional<bool> getAdjustsFontSizeToFit() = 0;
148
190
  virtual void setAdjustsFontSizeToFit(std::optional<bool> adjustsFontSizeToFit) = 0;
149
191
  virtual std::optional<double> getMinimumFontScale() = 0;
@@ -168,6 +210,10 @@ namespace margelo::nitro::nitroinput {
168
210
  virtual void setOnRevealEnd(const std::optional<std::function<void()>>& onRevealEnd) = 0;
169
211
  virtual std::optional<std::function<void(double /* index */, double /* value */)>> getOnRevealMilestone() = 0;
170
212
  virtual void setOnRevealMilestone(const std::optional<std::function<void(double /* index */, double /* value */)>>& onRevealMilestone) = 0;
213
+ virtual std::optional<std::function<void()>> getOnAnimationStart() = 0;
214
+ virtual void setOnAnimationStart(const std::optional<std::function<void()>>& onAnimationStart) = 0;
215
+ virtual std::optional<std::function<void(double /* value */)>> getOnAnimationEnd() = 0;
216
+ virtual void setOnAnimationEnd(const std::optional<std::function<void(double /* value */)>>& onAnimationEnd) = 0;
171
217
 
172
218
  public:
173
219
  // Methods
@@ -0,0 +1,22 @@
1
+ ///
2
+ /// HybridNitroTextMeasureSpec.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 "HybridNitroTextMeasureSpec.hpp"
9
+
10
+ namespace margelo::nitro::nitroinput {
11
+
12
+ void HybridNitroTextMeasureSpec::loadHybridMethods() {
13
+ // load base methods/properties
14
+ HybridObject::loadHybridMethods();
15
+ // load custom methods/properties
16
+ registerHybrids(this, [](Prototype& prototype) {
17
+ prototype.registerHybridMethod("measure", &HybridNitroTextMeasureSpec::measure);
18
+ prototype.registerHybridMethod("lineHeight", &HybridNitroTextMeasureSpec::lineHeight);
19
+ });
20
+ }
21
+
22
+ } // namespace margelo::nitro::nitroinput
@@ -0,0 +1,63 @@
1
+ ///
2
+ /// HybridNitroTextMeasureSpec.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
+
17
+
18
+ #include <string>
19
+
20
+ namespace margelo::nitro::nitroinput {
21
+
22
+ using namespace margelo::nitro;
23
+
24
+ /**
25
+ * An abstract base class for `NitroTextMeasure`
26
+ * Inherit this class to create instances of `HybridNitroTextMeasureSpec` in C++.
27
+ * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
28
+ * @example
29
+ * ```cpp
30
+ * class HybridNitroTextMeasure: public HybridNitroTextMeasureSpec {
31
+ * public:
32
+ * HybridNitroTextMeasure(...): HybridObject(TAG) { ... }
33
+ * // ...
34
+ * };
35
+ * ```
36
+ */
37
+ class HybridNitroTextMeasureSpec: public virtual HybridObject {
38
+ public:
39
+ // Constructor
40
+ explicit HybridNitroTextMeasureSpec(): HybridObject(TAG) { }
41
+
42
+ // Destructor
43
+ ~HybridNitroTextMeasureSpec() override = default;
44
+
45
+ public:
46
+ // Properties
47
+
48
+
49
+ public:
50
+ // Methods
51
+ virtual double measure(const std::string& text, double fontSize, double fontWeight, const std::string& fontFamily, double letterSpacing) = 0;
52
+ virtual double lineHeight(double fontSize, double fontWeight, const std::string& fontFamily) = 0;
53
+
54
+ protected:
55
+ // Hybrid Setup
56
+ void loadHybridMethods() override;
57
+
58
+ protected:
59
+ // Tag for logging
60
+ static constexpr auto TAG = "NitroTextMeasure";
61
+ };
62
+
63
+ } // namespace margelo::nitro::nitroinput
@@ -0,0 +1,62 @@
1
+ ///
2
+ /// HybridNitroTextViewSpec.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 "HybridNitroTextViewSpec.hpp"
9
+
10
+ namespace margelo::nitro::nitroinput {
11
+
12
+ void HybridNitroTextViewSpec::loadHybridMethods() {
13
+ // load base methods/properties
14
+ HybridObject::loadHybridMethods();
15
+ // load custom methods/properties
16
+ registerHybrids(this, [](Prototype& prototype) {
17
+ prototype.registerHybridGetter("text", &HybridNitroTextViewSpec::getText);
18
+ prototype.registerHybridSetter("text", &HybridNitroTextViewSpec::setText);
19
+ prototype.registerHybridGetter("fontSize", &HybridNitroTextViewSpec::getFontSize);
20
+ prototype.registerHybridSetter("fontSize", &HybridNitroTextViewSpec::setFontSize);
21
+ prototype.registerHybridGetter("fontWeight", &HybridNitroTextViewSpec::getFontWeight);
22
+ prototype.registerHybridSetter("fontWeight", &HybridNitroTextViewSpec::setFontWeight);
23
+ prototype.registerHybridGetter("fontFamily", &HybridNitroTextViewSpec::getFontFamily);
24
+ prototype.registerHybridSetter("fontFamily", &HybridNitroTextViewSpec::setFontFamily);
25
+ prototype.registerHybridGetter("color", &HybridNitroTextViewSpec::getColor);
26
+ prototype.registerHybridSetter("color", &HybridNitroTextViewSpec::setColor);
27
+ prototype.registerHybridGetter("letterSpacing", &HybridNitroTextViewSpec::getLetterSpacing);
28
+ prototype.registerHybridSetter("letterSpacing", &HybridNitroTextViewSpec::setLetterSpacing);
29
+ prototype.registerHybridGetter("textAlign", &HybridNitroTextViewSpec::getTextAlign);
30
+ prototype.registerHybridSetter("textAlign", &HybridNitroTextViewSpec::setTextAlign);
31
+ prototype.registerHybridGetter("rightToLeft", &HybridNitroTextViewSpec::getRightToLeft);
32
+ prototype.registerHybridSetter("rightToLeft", &HybridNitroTextViewSpec::setRightToLeft);
33
+ prototype.registerHybridGetter("duration", &HybridNitroTextViewSpec::getDuration);
34
+ prototype.registerHybridSetter("duration", &HybridNitroTextViewSpec::setDuration);
35
+ prototype.registerHybridGetter("easing", &HybridNitroTextViewSpec::getEasing);
36
+ prototype.registerHybridSetter("easing", &HybridNitroTextViewSpec::setEasing);
37
+ prototype.registerHybridGetter("bounce", &HybridNitroTextViewSpec::getBounce);
38
+ prototype.registerHybridSetter("bounce", &HybridNitroTextViewSpec::setBounce);
39
+ prototype.registerHybridGetter("effect", &HybridNitroTextViewSpec::getEffect);
40
+ prototype.registerHybridSetter("effect", &HybridNitroTextViewSpec::setEffect);
41
+ prototype.registerHybridGetter("respectReduceMotion", &HybridNitroTextViewSpec::getRespectReduceMotion);
42
+ prototype.registerHybridSetter("respectReduceMotion", &HybridNitroTextViewSpec::setRespectReduceMotion);
43
+ prototype.registerHybridGetter("loading", &HybridNitroTextViewSpec::getLoading);
44
+ prototype.registerHybridSetter("loading", &HybridNitroTextViewSpec::setLoading);
45
+ prototype.registerHybridGetter("shimmerColor", &HybridNitroTextViewSpec::getShimmerColor);
46
+ prototype.registerHybridSetter("shimmerColor", &HybridNitroTextViewSpec::setShimmerColor);
47
+ prototype.registerHybridGetter("shimmerDuration", &HybridNitroTextViewSpec::getShimmerDuration);
48
+ prototype.registerHybridSetter("shimmerDuration", &HybridNitroTextViewSpec::setShimmerDuration);
49
+ prototype.registerHybridGetter("shimmerAngle", &HybridNitroTextViewSpec::getShimmerAngle);
50
+ prototype.registerHybridSetter("shimmerAngle", &HybridNitroTextViewSpec::setShimmerAngle);
51
+ prototype.registerHybridGetter("shimmerWidth", &HybridNitroTextViewSpec::getShimmerWidth);
52
+ prototype.registerHybridSetter("shimmerWidth", &HybridNitroTextViewSpec::setShimmerWidth);
53
+ prototype.registerHybridGetter("shimmerBaseColor", &HybridNitroTextViewSpec::getShimmerBaseColor);
54
+ prototype.registerHybridSetter("shimmerBaseColor", &HybridNitroTextViewSpec::setShimmerBaseColor);
55
+ prototype.registerHybridGetter("shimmerDirection", &HybridNitroTextViewSpec::getShimmerDirection);
56
+ prototype.registerHybridSetter("shimmerDirection", &HybridNitroTextViewSpec::setShimmerDirection);
57
+ prototype.registerHybridGetter("shimmerDelay", &HybridNitroTextViewSpec::getShimmerDelay);
58
+ prototype.registerHybridSetter("shimmerDelay", &HybridNitroTextViewSpec::setShimmerDelay);
59
+ });
60
+ }
61
+
62
+ } // namespace margelo::nitro::nitroinput
@@ -0,0 +1,115 @@
1
+ ///
2
+ /// HybridNitroTextViewSpec.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 `NitroNumberTextAlign` to properly resolve imports.
17
+ namespace margelo::nitro::nitroinput { enum class NitroNumberTextAlign; }
18
+ // Forward declaration of `NitroInputEasing` to properly resolve imports.
19
+ namespace margelo::nitro::nitroinput { enum class NitroInputEasing; }
20
+ // Forward declaration of `NitroInputEffect` to properly resolve imports.
21
+ namespace margelo::nitro::nitroinput { enum class NitroInputEffect; }
22
+ // Forward declaration of `NitroNumberShimmerDirection` to properly resolve imports.
23
+ namespace margelo::nitro::nitroinput { enum class NitroNumberShimmerDirection; }
24
+
25
+ #include <string>
26
+ #include <optional>
27
+ #include "NitroNumberTextAlign.hpp"
28
+ #include "NitroInputEasing.hpp"
29
+ #include "NitroInputEffect.hpp"
30
+ #include "NitroNumberShimmerDirection.hpp"
31
+
32
+ namespace margelo::nitro::nitroinput {
33
+
34
+ using namespace margelo::nitro;
35
+
36
+ /**
37
+ * An abstract base class for `NitroTextView`
38
+ * Inherit this class to create instances of `HybridNitroTextViewSpec` in C++.
39
+ * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
40
+ * @example
41
+ * ```cpp
42
+ * class HybridNitroTextView: public HybridNitroTextViewSpec {
43
+ * public:
44
+ * HybridNitroTextView(...): HybridObject(TAG) { ... }
45
+ * // ...
46
+ * };
47
+ * ```
48
+ */
49
+ class HybridNitroTextViewSpec: public virtual HybridObject {
50
+ public:
51
+ // Constructor
52
+ explicit HybridNitroTextViewSpec(): HybridObject(TAG) { }
53
+
54
+ // Destructor
55
+ ~HybridNitroTextViewSpec() override = default;
56
+
57
+ public:
58
+ // Properties
59
+ virtual std::string getText() = 0;
60
+ virtual void setText(const std::string& text) = 0;
61
+ virtual std::optional<double> getFontSize() = 0;
62
+ virtual void setFontSize(std::optional<double> fontSize) = 0;
63
+ virtual std::optional<double> getFontWeight() = 0;
64
+ virtual void setFontWeight(std::optional<double> fontWeight) = 0;
65
+ virtual std::optional<std::string> getFontFamily() = 0;
66
+ virtual void setFontFamily(const std::optional<std::string>& fontFamily) = 0;
67
+ virtual std::optional<double> getColor() = 0;
68
+ virtual void setColor(std::optional<double> color) = 0;
69
+ virtual std::optional<double> getLetterSpacing() = 0;
70
+ virtual void setLetterSpacing(std::optional<double> letterSpacing) = 0;
71
+ virtual std::optional<NitroNumberTextAlign> getTextAlign() = 0;
72
+ virtual void setTextAlign(std::optional<NitroNumberTextAlign> textAlign) = 0;
73
+ virtual std::optional<bool> getRightToLeft() = 0;
74
+ virtual void setRightToLeft(std::optional<bool> rightToLeft) = 0;
75
+ virtual std::optional<double> getDuration() = 0;
76
+ virtual void setDuration(std::optional<double> duration) = 0;
77
+ virtual std::optional<NitroInputEasing> getEasing() = 0;
78
+ virtual void setEasing(std::optional<NitroInputEasing> easing) = 0;
79
+ virtual std::optional<double> getBounce() = 0;
80
+ virtual void setBounce(std::optional<double> bounce) = 0;
81
+ virtual std::optional<NitroInputEffect> getEffect() = 0;
82
+ virtual void setEffect(std::optional<NitroInputEffect> effect) = 0;
83
+ virtual std::optional<bool> getRespectReduceMotion() = 0;
84
+ virtual void setRespectReduceMotion(std::optional<bool> respectReduceMotion) = 0;
85
+ virtual std::optional<bool> getLoading() = 0;
86
+ virtual void setLoading(std::optional<bool> loading) = 0;
87
+ virtual std::optional<double> getShimmerColor() = 0;
88
+ virtual void setShimmerColor(std::optional<double> shimmerColor) = 0;
89
+ virtual std::optional<double> getShimmerDuration() = 0;
90
+ virtual void setShimmerDuration(std::optional<double> shimmerDuration) = 0;
91
+ virtual std::optional<double> getShimmerAngle() = 0;
92
+ virtual void setShimmerAngle(std::optional<double> shimmerAngle) = 0;
93
+ virtual std::optional<double> getShimmerWidth() = 0;
94
+ virtual void setShimmerWidth(std::optional<double> shimmerWidth) = 0;
95
+ virtual std::optional<double> getShimmerBaseColor() = 0;
96
+ virtual void setShimmerBaseColor(std::optional<double> shimmerBaseColor) = 0;
97
+ virtual std::optional<NitroNumberShimmerDirection> getShimmerDirection() = 0;
98
+ virtual void setShimmerDirection(std::optional<NitroNumberShimmerDirection> shimmerDirection) = 0;
99
+ virtual std::optional<double> getShimmerDelay() = 0;
100
+ virtual void setShimmerDelay(std::optional<double> shimmerDelay) = 0;
101
+
102
+ public:
103
+ // Methods
104
+
105
+
106
+ protected:
107
+ // Hybrid Setup
108
+ void loadHybridMethods() override;
109
+
110
+ protected:
111
+ // Tag for logging
112
+ static constexpr auto TAG = "NitroTextView";
113
+ };
114
+
115
+ } // namespace margelo::nitro::nitroinput
@@ -0,0 +1,80 @@
1
+ ///
2
+ /// NitroNumberShimmerDirection.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 (NitroNumberShimmerDirection).
30
+ */
31
+ enum class NitroNumberShimmerDirection {
32
+ AUTO SWIFT_NAME(auto) = 0,
33
+ LTR SWIFT_NAME(ltr) = 1,
34
+ RTL SWIFT_NAME(rtl) = 2,
35
+ } CLOSED_ENUM;
36
+
37
+ } // namespace margelo::nitro::nitroinput
38
+
39
+ namespace margelo::nitro {
40
+
41
+ // C++ NitroNumberShimmerDirection <> JS NitroNumberShimmerDirection (union)
42
+ template <>
43
+ struct JSIConverter<margelo::nitro::nitroinput::NitroNumberShimmerDirection> final {
44
+ static inline margelo::nitro::nitroinput::NitroNumberShimmerDirection fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
45
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
46
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
47
+ case hashString("auto"): return margelo::nitro::nitroinput::NitroNumberShimmerDirection::AUTO;
48
+ case hashString("ltr"): return margelo::nitro::nitroinput::NitroNumberShimmerDirection::LTR;
49
+ case hashString("rtl"): return margelo::nitro::nitroinput::NitroNumberShimmerDirection::RTL;
50
+ default: [[unlikely]]
51
+ throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum NitroNumberShimmerDirection - invalid value!");
52
+ }
53
+ }
54
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitroinput::NitroNumberShimmerDirection arg) {
55
+ switch (arg) {
56
+ case margelo::nitro::nitroinput::NitroNumberShimmerDirection::AUTO: return JSIConverter<std::string>::toJSI(runtime, "auto");
57
+ case margelo::nitro::nitroinput::NitroNumberShimmerDirection::LTR: return JSIConverter<std::string>::toJSI(runtime, "ltr");
58
+ case margelo::nitro::nitroinput::NitroNumberShimmerDirection::RTL: return JSIConverter<std::string>::toJSI(runtime, "rtl");
59
+ default: [[unlikely]]
60
+ throw std::invalid_argument("Cannot convert NitroNumberShimmerDirection to JS - invalid value: "
61
+ + std::to_string(static_cast<int>(arg)) + "!");
62
+ }
63
+ }
64
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
65
+ if (!value.isString()) {
66
+ return false;
67
+ }
68
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
69
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
70
+ case hashString("auto"):
71
+ case hashString("ltr"):
72
+ case hashString("rtl"):
73
+ return true;
74
+ default:
75
+ return false;
76
+ }
77
+ }
78
+ };
79
+
80
+ } // namespace margelo::nitro
@@ -0,0 +1,88 @@
1
+ ///
2
+ /// NitroNumberSignDisplay.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 (NitroNumberSignDisplay).
30
+ */
31
+ enum class NitroNumberSignDisplay {
32
+ AUTO SWIFT_NAME(auto) = 0,
33
+ ALWAYS SWIFT_NAME(always) = 1,
34
+ NEVER SWIFT_NAME(never) = 2,
35
+ EXCEPTZERO SWIFT_NAME(exceptzero) = 3,
36
+ NEGATIVE SWIFT_NAME(negative) = 4,
37
+ } CLOSED_ENUM;
38
+
39
+ } // namespace margelo::nitro::nitroinput
40
+
41
+ namespace margelo::nitro {
42
+
43
+ // C++ NitroNumberSignDisplay <> JS NitroNumberSignDisplay (union)
44
+ template <>
45
+ struct JSIConverter<margelo::nitro::nitroinput::NitroNumberSignDisplay> final {
46
+ static inline margelo::nitro::nitroinput::NitroNumberSignDisplay fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
47
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
48
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
49
+ case hashString("auto"): return margelo::nitro::nitroinput::NitroNumberSignDisplay::AUTO;
50
+ case hashString("always"): return margelo::nitro::nitroinput::NitroNumberSignDisplay::ALWAYS;
51
+ case hashString("never"): return margelo::nitro::nitroinput::NitroNumberSignDisplay::NEVER;
52
+ case hashString("exceptZero"): return margelo::nitro::nitroinput::NitroNumberSignDisplay::EXCEPTZERO;
53
+ case hashString("negative"): return margelo::nitro::nitroinput::NitroNumberSignDisplay::NEGATIVE;
54
+ default: [[unlikely]]
55
+ throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum NitroNumberSignDisplay - invalid value!");
56
+ }
57
+ }
58
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitroinput::NitroNumberSignDisplay arg) {
59
+ switch (arg) {
60
+ case margelo::nitro::nitroinput::NitroNumberSignDisplay::AUTO: return JSIConverter<std::string>::toJSI(runtime, "auto");
61
+ case margelo::nitro::nitroinput::NitroNumberSignDisplay::ALWAYS: return JSIConverter<std::string>::toJSI(runtime, "always");
62
+ case margelo::nitro::nitroinput::NitroNumberSignDisplay::NEVER: return JSIConverter<std::string>::toJSI(runtime, "never");
63
+ case margelo::nitro::nitroinput::NitroNumberSignDisplay::EXCEPTZERO: return JSIConverter<std::string>::toJSI(runtime, "exceptZero");
64
+ case margelo::nitro::nitroinput::NitroNumberSignDisplay::NEGATIVE: return JSIConverter<std::string>::toJSI(runtime, "negative");
65
+ default: [[unlikely]]
66
+ throw std::invalid_argument("Cannot convert NitroNumberSignDisplay to JS - invalid value: "
67
+ + std::to_string(static_cast<int>(arg)) + "!");
68
+ }
69
+ }
70
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
71
+ if (!value.isString()) {
72
+ return false;
73
+ }
74
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
75
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
76
+ case hashString("auto"):
77
+ case hashString("always"):
78
+ case hashString("never"):
79
+ case hashString("exceptZero"):
80
+ case hashString("negative"):
81
+ return true;
82
+ default:
83
+ return false;
84
+ }
85
+ }
86
+ };
87
+
88
+ } // namespace margelo::nitro