react-native-enriched 0.0.0 → 0.1.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 (169) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +869 -0
  3. package/ReactNativeEnriched.podspec +27 -0
  4. package/android/build.gradle +101 -0
  5. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedTextInputViewManagerDelegate.java +146 -0
  6. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedTextInputViewManagerInterface.java +55 -0
  7. package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/ComponentDescriptors.cpp +22 -0
  8. package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/ComponentDescriptors.h +24 -0
  9. package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/EventEmitters.cpp +118 -0
  10. package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/EventEmitters.h +95 -0
  11. package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/Props.cpp +128 -0
  12. package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/Props.h +577 -0
  13. package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/ShadowNodes.cpp +17 -0
  14. package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/ShadowNodes.h +23 -0
  15. package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/States.cpp +16 -0
  16. package/android/generated/jni/react/renderer/components/RNEnrichedTextInputViewSpec/States.h +20 -0
  17. package/android/gradle.properties +5 -0
  18. package/android/src/main/AndroidManifest.xml +3 -0
  19. package/android/src/main/AndroidManifestNew.xml +2 -0
  20. package/android/src/main/java/com/swmansion/enriched/EnrichedTextInputView.kt +535 -0
  21. package/android/src/main/java/com/swmansion/enriched/EnrichedTextInputViewLayoutManager.kt +64 -0
  22. package/android/src/main/java/com/swmansion/enriched/EnrichedTextInputViewManager.kt +292 -0
  23. package/android/src/main/java/com/swmansion/enriched/EnrichedTextInputViewPackage.kt +19 -0
  24. package/android/src/main/java/com/swmansion/enriched/events/MentionHandler.kt +40 -0
  25. package/android/src/main/java/com/swmansion/enriched/events/OnChangeHtmlEvent.kt +28 -0
  26. package/android/src/main/java/com/swmansion/enriched/events/OnChangeSelectionEvent.kt +29 -0
  27. package/android/src/main/java/com/swmansion/enriched/events/OnChangeStateEvent.kt +24 -0
  28. package/android/src/main/java/com/swmansion/enriched/events/OnChangeTextEvent.kt +30 -0
  29. package/android/src/main/java/com/swmansion/enriched/events/OnInputBlurEvent.kt +27 -0
  30. package/android/src/main/java/com/swmansion/enriched/events/OnInputFocusEvent.kt +27 -0
  31. package/android/src/main/java/com/swmansion/enriched/events/OnLinkDetectedEvent.kt +30 -0
  32. package/android/src/main/java/com/swmansion/enriched/events/OnMentionDetectedEvent.kt +29 -0
  33. package/android/src/main/java/com/swmansion/enriched/events/OnMentionEvent.kt +33 -0
  34. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedBlockQuoteSpan.kt +34 -0
  35. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedBoldSpan.kt +10 -0
  36. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedCodeBlockSpan.kt +38 -0
  37. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedH1Span.kt +17 -0
  38. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedH2Span.kt +17 -0
  39. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedH3Span.kt +17 -0
  40. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedImageSpan.kt +41 -0
  41. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedInlineCodeSpan.kt +16 -0
  42. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedItalicSpan.kt +10 -0
  43. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedLinkSpan.kt +24 -0
  44. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedMentionSpan.kt +36 -0
  45. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedOrderedListSpan.kt +71 -0
  46. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedSpans.kt +111 -0
  47. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedStrikeThroughSpan.kt +9 -0
  48. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedUnderlineSpan.kt +9 -0
  49. package/android/src/main/java/com/swmansion/enriched/spans/EnrichedUnorderedListSpan.kt +49 -0
  50. package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedBlockSpan.kt +4 -0
  51. package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedHeadingSpan.kt +4 -0
  52. package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedInlineSpan.kt +4 -0
  53. package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedParagraphSpan.kt +4 -0
  54. package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedSpan.kt +4 -0
  55. package/android/src/main/java/com/swmansion/enriched/spans/interfaces/EnrichedZeroWidthSpaceSpan.kt +5 -0
  56. package/android/src/main/java/com/swmansion/enriched/styles/HtmlStyle.kt +227 -0
  57. package/android/src/main/java/com/swmansion/enriched/styles/InlineStyles.kt +146 -0
  58. package/android/src/main/java/com/swmansion/enriched/styles/ListStyles.kt +173 -0
  59. package/android/src/main/java/com/swmansion/enriched/styles/ParagraphStyles.kt +186 -0
  60. package/android/src/main/java/com/swmansion/enriched/styles/ParametrizedStyles.kt +223 -0
  61. package/android/src/main/java/com/swmansion/enriched/utils/EnrichedParser.java +857 -0
  62. package/android/src/main/java/com/swmansion/enriched/utils/EnrichedSelection.kt +285 -0
  63. package/android/src/main/java/com/swmansion/enriched/utils/EnrichedSpanState.kt +204 -0
  64. package/android/src/main/java/com/swmansion/enriched/utils/Utils.kt +91 -0
  65. package/android/src/main/java/com/swmansion/enriched/watchers/EnrichedSpanWatcher.kt +73 -0
  66. package/android/src/main/java/com/swmansion/enriched/watchers/EnrichedTextWatcher.kt +51 -0
  67. package/android/src/main/new_arch/CMakeLists.txt +56 -0
  68. package/android/src/main/new_arch/RNEnrichedTextInputViewSpec.cpp +22 -0
  69. package/android/src/main/new_arch/RNEnrichedTextInputViewSpec.h +26 -0
  70. package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputComponentDescriptor.h +35 -0
  71. package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputMeasurementManager.cpp +51 -0
  72. package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputMeasurementManager.h +26 -0
  73. package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputShadowNode.cpp +34 -0
  74. package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputShadowNode.h +54 -0
  75. package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputState.cpp +9 -0
  76. package/android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputState.h +25 -0
  77. package/ios/EnrichedTextInputView.h +33 -0
  78. package/ios/EnrichedTextInputView.mm +1190 -0
  79. package/ios/EnrichedTextInputViewManager.mm +13 -0
  80. package/ios/config/InputConfig.h +67 -0
  81. package/ios/config/InputConfig.mm +382 -0
  82. package/ios/generated/RNEnrichedTextInputViewSpec/ComponentDescriptors.cpp +22 -0
  83. package/ios/generated/RNEnrichedTextInputViewSpec/ComponentDescriptors.h +24 -0
  84. package/ios/generated/RNEnrichedTextInputViewSpec/EventEmitters.cpp +118 -0
  85. package/ios/generated/RNEnrichedTextInputViewSpec/EventEmitters.h +95 -0
  86. package/ios/generated/RNEnrichedTextInputViewSpec/Props.cpp +128 -0
  87. package/ios/generated/RNEnrichedTextInputViewSpec/Props.h +577 -0
  88. package/ios/generated/RNEnrichedTextInputViewSpec/RCTComponentViewHelpers.h +384 -0
  89. package/ios/generated/RNEnrichedTextInputViewSpec/ShadowNodes.cpp +17 -0
  90. package/ios/generated/RNEnrichedTextInputViewSpec/ShadowNodes.h +23 -0
  91. package/ios/generated/RNEnrichedTextInputViewSpec/States.cpp +16 -0
  92. package/ios/generated/RNEnrichedTextInputViewSpec/States.h +20 -0
  93. package/ios/inputParser/InputParser.h +11 -0
  94. package/ios/inputParser/InputParser.mm +669 -0
  95. package/ios/inputTextView/InputTextView.h +6 -0
  96. package/ios/inputTextView/InputTextView.mm +115 -0
  97. package/ios/internals/EnrichedTextInputViewComponentDescriptor.h +17 -0
  98. package/ios/internals/EnrichedTextInputViewShadowNode.h +40 -0
  99. package/ios/internals/EnrichedTextInputViewShadowNode.mm +83 -0
  100. package/ios/internals/EnrichedTextInputViewState.cpp +10 -0
  101. package/ios/internals/EnrichedTextInputViewState.h +20 -0
  102. package/ios/styles/BlockQuoteStyle.mm +248 -0
  103. package/ios/styles/BoldStyle.mm +122 -0
  104. package/ios/styles/H1Style.mm +10 -0
  105. package/ios/styles/H2Style.mm +10 -0
  106. package/ios/styles/H3Style.mm +10 -0
  107. package/ios/styles/HeadingStyleBase.mm +144 -0
  108. package/ios/styles/InlineCodeStyle.mm +163 -0
  109. package/ios/styles/ItalicStyle.mm +110 -0
  110. package/ios/styles/LinkStyle.mm +463 -0
  111. package/ios/styles/MentionStyle.mm +476 -0
  112. package/ios/styles/OrderedListStyle.mm +225 -0
  113. package/ios/styles/StrikethroughStyle.mm +80 -0
  114. package/ios/styles/UnderlineStyle.mm +112 -0
  115. package/ios/styles/UnorderedListStyle.mm +225 -0
  116. package/ios/utils/BaseStyleProtocol.h +16 -0
  117. package/ios/utils/ColorExtension.h +6 -0
  118. package/ios/utils/ColorExtension.mm +27 -0
  119. package/ios/utils/FontExtension.h +13 -0
  120. package/ios/utils/FontExtension.mm +91 -0
  121. package/ios/utils/LayoutManagerExtension.h +6 -0
  122. package/ios/utils/LayoutManagerExtension.mm +171 -0
  123. package/ios/utils/LinkData.h +9 -0
  124. package/ios/utils/LinkData.mm +4 -0
  125. package/ios/utils/MentionParams.h +9 -0
  126. package/ios/utils/MentionParams.mm +4 -0
  127. package/ios/utils/MentionStyleProps.h +13 -0
  128. package/ios/utils/MentionStyleProps.mm +56 -0
  129. package/ios/utils/OccurenceUtils.h +37 -0
  130. package/ios/utils/OccurenceUtils.mm +124 -0
  131. package/ios/utils/ParagraphsUtils.h +7 -0
  132. package/ios/utils/ParagraphsUtils.mm +54 -0
  133. package/ios/utils/StringExtension.h +15 -0
  134. package/ios/utils/StringExtension.mm +57 -0
  135. package/ios/utils/StyleHeaders.h +74 -0
  136. package/ios/utils/StylePair.h +9 -0
  137. package/ios/utils/StylePair.mm +4 -0
  138. package/ios/utils/StyleTypeEnum.h +22 -0
  139. package/ios/utils/TextDecorationLineEnum.h +6 -0
  140. package/ios/utils/TextDecorationLineEnum.mm +4 -0
  141. package/ios/utils/TextInsertionUtils.h +6 -0
  142. package/ios/utils/TextInsertionUtils.mm +48 -0
  143. package/ios/utils/WordsUtils.h +6 -0
  144. package/ios/utils/WordsUtils.mm +88 -0
  145. package/ios/utils/ZeroWidthSpaceUtils.h +7 -0
  146. package/ios/utils/ZeroWidthSpaceUtils.mm +164 -0
  147. package/lib/module/EnrichedTextInput.js +191 -0
  148. package/lib/module/EnrichedTextInput.js.map +1 -0
  149. package/lib/module/EnrichedTextInputNativeComponent.ts +235 -0
  150. package/lib/module/index.js +4 -0
  151. package/lib/module/index.js.map +1 -0
  152. package/lib/module/normalizeHtmlStyle.js +141 -0
  153. package/lib/module/normalizeHtmlStyle.js.map +1 -0
  154. package/lib/module/package.json +1 -0
  155. package/lib/typescript/package.json +1 -0
  156. package/lib/typescript/src/EnrichedTextInput.d.ts +113 -0
  157. package/lib/typescript/src/EnrichedTextInput.d.ts.map +1 -0
  158. package/lib/typescript/src/EnrichedTextInputNativeComponent.d.ts +160 -0
  159. package/lib/typescript/src/EnrichedTextInputNativeComponent.d.ts.map +1 -0
  160. package/lib/typescript/src/index.d.ts +3 -0
  161. package/lib/typescript/src/index.d.ts.map +1 -0
  162. package/lib/typescript/src/normalizeHtmlStyle.d.ts +4 -0
  163. package/lib/typescript/src/normalizeHtmlStyle.d.ts.map +1 -0
  164. package/package.json +172 -1
  165. package/react-native.config.js +13 -0
  166. package/src/EnrichedTextInput.tsx +358 -0
  167. package/src/EnrichedTextInputNativeComponent.ts +235 -0
  168. package/src/index.tsx +9 -0
  169. package/src/normalizeHtmlStyle.ts +188 -0
@@ -0,0 +1,13 @@
1
+ #import <React/RCTUIManager.h>
2
+ #import <React/RCTViewManager.h>
3
+
4
+ @interface EnrichedTextInputViewManager : RCTViewManager
5
+ @end
6
+
7
+ @implementation EnrichedTextInputViewManager
8
+
9
+ RCT_EXPORT_MODULE(EnrichedTextInputView)
10
+
11
+ RCT_EXPORT_VIEW_PROPERTY(defaultValue, NSString)
12
+
13
+ @end
@@ -0,0 +1,67 @@
1
+ #pragma once
2
+ #import <UIKit/UIKit.h>
3
+ #import "TextDecorationLineEnum.h"
4
+ #import "MentionStyleProps.h"
5
+
6
+ @interface InputConfig: NSObject<NSCopying>
7
+ - (instancetype) init;
8
+ - (UIColor *)primaryColor;
9
+ - (void)setPrimaryColor:(UIColor *)newValue;
10
+ - (NSNumber *)primaryFontSize;
11
+ - (void)setPrimaryFontSize:(NSNumber *)newValue;
12
+ - (NSString *)primaryFontWeight;
13
+ - (void)setPrimaryFontWeight:(NSString *)newValue;
14
+ - (NSString *)primaryFontFamily;
15
+ - (void)setPrimaryFontFamily:(NSString *)newValue;
16
+ - (UIFont *)primaryFont;
17
+ - (UIFont *)monospacedFont;
18
+ - (NSSet<NSNumber*>*)mentionIndicators;
19
+ - (void)setMentionIndicators:(NSSet<NSNumber*>*)newValue;
20
+ - (CGFloat)h1FontSize;
21
+ - (void)setH1FontSize:(CGFloat)newValue;
22
+ - (BOOL)h1Bold;
23
+ - (void)setH1Bold:(BOOL)newValue;
24
+ - (CGFloat)h2FontSize;
25
+ - (void)setH2FontSize:(CGFloat)newValue;
26
+ - (BOOL)h2Bold;
27
+ - (void)setH2Bold:(BOOL)newValue;
28
+ - (CGFloat)h3FontSize;
29
+ - (void)setH3FontSize:(CGFloat)newValue;
30
+ - (BOOL)h3Bold;
31
+ - (void)setH3Bold:(BOOL)newValue;
32
+ - (UIColor *)blockquoteBorderColor;
33
+ - (void)setBlockquoteBorderColor:(UIColor *)newValue;
34
+ - (CGFloat)blockquoteBorderWidth;
35
+ - (void)setBlockquoteBorderWidth:(CGFloat)newValue;
36
+ - (CGFloat)blockquoteGapWidth;
37
+ - (void)setBlockquoteGapWidth:(CGFloat)newValue;
38
+ - (UIColor *)blockquoteColor;
39
+ - (void)setBlockquoteColor:(UIColor *)newValue;
40
+ - (UIColor *)inlineCodeFgColor;
41
+ - (void)setInlineCodeFgColor:(UIColor *)newValue;
42
+ - (UIColor *)inlineCodeBgColor;
43
+ - (void)setInlineCodeBgColor:(UIColor *)newValue;
44
+ - (CGFloat)orderedListGapWidth;
45
+ - (void)setOrderedListGapWidth:(CGFloat)newValue;
46
+ - (CGFloat)orderedListMarginLeft;
47
+ - (void)setOrderedListMarginLeft:(CGFloat)newValue;
48
+ - (NSString *)orderedListMarkerFontWeight;
49
+ - (void)setOrderedListMarkerFontWeight:(NSString *)newValue;
50
+ - (UIColor *)orderedListMarkerColor;
51
+ - (void)setOrderedListMarkerColor:(UIColor *)newValue;
52
+ - (UIFont *)orderedListMarkerFont;
53
+ - (UIColor *)unorderedListBulletColor;
54
+ - (void)setUnorderedListBulletColor:(UIColor *)newValue;
55
+ - (CGFloat)unorderedListBulletSize;
56
+ - (void)setUnorderedListBulletSize:(CGFloat)newValue;
57
+ - (CGFloat)unorderedListGapWidth;
58
+ - (void)setUnorderedListGapWidth:(CGFloat)newValue;
59
+ - (CGFloat)unorderedListMarginLeft;
60
+ - (void)setUnorderedListMarginLeft:(CGFloat)newValue;
61
+ - (UIColor *)linkColor;
62
+ - (void)setLinkColor:(UIColor *)newValue;
63
+ - (TextDecorationLineEnum)linkDecorationLine;
64
+ - (void)setLinkDecorationLine:(TextDecorationLineEnum)newValue;
65
+ - (void)setMentionStyleProps:(NSDictionary *)newValue;
66
+ - (MentionStyleProps *)mentionStylePropsForIndicator:(NSString *)indicator;
67
+ @end
@@ -0,0 +1,382 @@
1
+ #import <InputConfig.h>
2
+ #import <React/RCTFont.h>
3
+
4
+ @implementation InputConfig {
5
+ UIColor *_primaryColor;
6
+ NSNumber *_primaryFontSize;
7
+ NSString *_primaryFontWeight;
8
+ NSString *_primaryFontFamily;
9
+ UIFont *_primaryFont;
10
+ UIFont *_monospacedFont;
11
+ BOOL _primaryFontNeedsRecreation;
12
+ BOOL _monospacedFontNeedsRecreation;
13
+ NSSet<NSNumber*> *_mentionIndicators;
14
+ CGFloat _h1FontSize;
15
+ BOOL _h1Bold;
16
+ CGFloat _h2FontSize;
17
+ BOOL _h2Bold;
18
+ CGFloat _h3FontSize;
19
+ BOOL _h3Bold;
20
+ UIColor *_blockquoteBorderColor;
21
+ CGFloat _blockquoteBorderWidth;
22
+ CGFloat _blockquoteGapWidth;
23
+ UIColor *_blockquoteColor;
24
+ UIColor *_inlineCodeFgColor;
25
+ UIColor *_inlineCodeBgColor;
26
+ CGFloat _orderedListGapWidth;
27
+ CGFloat _orderedListMarginLeft;
28
+ NSString *_orderedListMarkerFontWeight;
29
+ UIColor *_orderedListMarkerColor;
30
+ UIFont *_orderedListMarkerFont;
31
+ BOOL _olMarkerFontNeedsRecreation;
32
+ UIColor *_unorderedListBulletColor;
33
+ CGFloat _unorderedListBulletSize;
34
+ CGFloat _unorderedListGapWidth;
35
+ CGFloat _unorderedListMarginLeft;
36
+ UIColor *_linkColor;
37
+ TextDecorationLineEnum _linkDecorationLine;
38
+ NSDictionary *_mentionProperties;
39
+ }
40
+
41
+ - (instancetype) init {
42
+ self = [super init];
43
+ _primaryFontNeedsRecreation = YES;
44
+ _monospacedFontNeedsRecreation = YES;
45
+ _olMarkerFontNeedsRecreation = YES;
46
+ return self;
47
+ }
48
+
49
+ - (id)copyWithZone:(NSZone *)zone {
50
+ InputConfig *copy = [[[self class] allocWithZone:zone] init];
51
+ copy->_primaryColor = [_primaryColor copy];
52
+ copy->_primaryFontSize = [_primaryFontSize copy];
53
+ copy->_primaryFontWeight = [_primaryFontWeight copy];
54
+ copy->_primaryFontFamily = [_primaryFontFamily copy];
55
+ copy->_primaryFont = [_primaryFont copy];
56
+ copy->_monospacedFont = [_monospacedFont copy];
57
+ copy->_mentionIndicators = [_mentionIndicators copy];
58
+ copy->_h1FontSize = _h1FontSize;
59
+ copy->_h1Bold = _h1Bold;
60
+ copy->_h2FontSize = _h2FontSize;
61
+ copy->_h2Bold = _h2Bold;
62
+ copy->_h3FontSize = _h3FontSize;
63
+ copy->_h3Bold = _h3Bold;
64
+ copy->_blockquoteBorderColor = [_blockquoteBorderColor copy];
65
+ copy->_blockquoteBorderWidth = _blockquoteBorderWidth;
66
+ copy->_blockquoteGapWidth = _blockquoteGapWidth;
67
+ copy->_blockquoteColor = [_blockquoteColor copy];
68
+ copy->_inlineCodeFgColor = [_inlineCodeFgColor copy];
69
+ copy->_inlineCodeBgColor = [_inlineCodeBgColor copy];
70
+ copy->_orderedListGapWidth = _orderedListGapWidth;
71
+ copy->_orderedListMarginLeft = _orderedListMarginLeft;
72
+ copy->_orderedListMarkerFontWeight = [_orderedListMarkerFontWeight copy];
73
+ copy->_orderedListMarkerColor = [_orderedListMarkerColor copy];
74
+ copy->_orderedListMarkerFont = [_orderedListMarkerFont copy];
75
+ copy->_unorderedListBulletColor = [_unorderedListBulletColor copy];
76
+ copy->_unorderedListBulletSize = _unorderedListBulletSize;
77
+ copy->_unorderedListGapWidth = _unorderedListGapWidth;
78
+ copy->_unorderedListMarginLeft = _unorderedListMarginLeft;
79
+ copy->_linkColor = [_linkColor copy];
80
+ copy->_linkDecorationLine = [_linkDecorationLine copy];
81
+ copy->_mentionProperties = [_mentionProperties mutableCopy];
82
+ return copy;
83
+ }
84
+
85
+ - (UIColor *)primaryColor {
86
+ return _primaryColor != nullptr ? _primaryColor : UIColor.blackColor;
87
+ }
88
+
89
+ - (void)setPrimaryColor:(UIColor *)newValue {
90
+ _primaryColor = newValue;
91
+ }
92
+
93
+ - (NSNumber *)primaryFontSize {
94
+ return _primaryFontSize != nullptr ? _primaryFontSize : @(14);
95
+ }
96
+
97
+ - (void)setPrimaryFontSize:(NSNumber *)newValue {
98
+ _primaryFontSize = newValue;
99
+ _primaryFontNeedsRecreation = YES;
100
+ _monospacedFontNeedsRecreation = YES;
101
+ _olMarkerFontNeedsRecreation = YES;
102
+ }
103
+
104
+ - (NSString *)primaryFontWeight {
105
+ return _primaryFontWeight != nullptr ? _primaryFontWeight : [NSString stringWithFormat:@"%@", @(UIFontWeightRegular)];
106
+ }
107
+
108
+ - (void)setPrimaryFontWeight:(NSString *)newValue {
109
+ _primaryFontWeight = newValue;
110
+ _primaryFontNeedsRecreation = YES;
111
+ _monospacedFontNeedsRecreation = YES;
112
+ }
113
+
114
+ - (NSString *)primaryFontFamily {
115
+ return _primaryFontFamily;
116
+ }
117
+
118
+ - (void)setPrimaryFontFamily:(NSString *)newValue {
119
+ _primaryFontFamily = newValue;
120
+ _primaryFontNeedsRecreation = YES;
121
+ _olMarkerFontNeedsRecreation = YES;
122
+ }
123
+
124
+ - (UIFont *)primaryFont {
125
+ if(_primaryFontNeedsRecreation) {
126
+ _primaryFontNeedsRecreation = NO;
127
+
128
+ NSString *newFontWeight = [self primaryFontWeight];
129
+ // fix RCTFontWeight conversion warnings:
130
+ // sometimes changing font family comes with weight '0' if not specified
131
+ // RCTConvert doesn't recognize this value so we just nullify it and it gets a default value
132
+ if([newFontWeight isEqualToString:@"0"]) {
133
+ newFontWeight = nullptr;
134
+ }
135
+
136
+ _primaryFont = [RCTFont updateFont:nullptr
137
+ withFamily:[self primaryFontFamily]
138
+ size:[self primaryFontSize]
139
+ weight:newFontWeight
140
+ style:nullptr
141
+ variant:nullptr
142
+ scaleMultiplier: 1];
143
+ }
144
+ return _primaryFont;
145
+ }
146
+
147
+ - (UIFont *)monospacedFont {
148
+ if(_monospacedFontNeedsRecreation) {
149
+ _monospacedFontNeedsRecreation = NO;
150
+ _monospacedFont = [UIFont monospacedSystemFontOfSize: [[self primaryFontSize] floatValue] weight: [[self primaryFontWeight] floatValue]];
151
+ }
152
+ return _monospacedFont;
153
+ }
154
+
155
+ - (NSSet<NSNumber*>*)mentionIndicators {
156
+ return _mentionIndicators != nullptr ? _mentionIndicators : [[NSSet alloc] init];
157
+ }
158
+
159
+ - (void)setMentionIndicators:(NSSet<NSNumber*>*)newValue {
160
+ _mentionIndicators = newValue;
161
+ }
162
+
163
+ - (CGFloat)h1FontSize {
164
+ return _h1FontSize;
165
+ }
166
+
167
+ - (void)setH1FontSize:(CGFloat)newValue {
168
+ _h1FontSize = newValue;
169
+ }
170
+
171
+ - (BOOL)h1Bold {
172
+ return _h1Bold;
173
+ }
174
+
175
+ - (void)setH1Bold:(BOOL)newValue {
176
+ _h1Bold = newValue;
177
+ }
178
+
179
+ - (CGFloat)h2FontSize {
180
+ return _h2FontSize;
181
+ }
182
+
183
+ - (void)setH2FontSize:(CGFloat)newValue {
184
+ _h2FontSize = newValue;
185
+ }
186
+
187
+ - (BOOL)h2Bold {
188
+ return _h2Bold;
189
+ }
190
+
191
+ - (void)setH2Bold:(BOOL)newValue {
192
+ _h2Bold = newValue;
193
+ }
194
+
195
+ - (CGFloat)h3FontSize {
196
+ return _h3FontSize;
197
+ }
198
+
199
+ - (void)setH3FontSize:(CGFloat)newValue {
200
+ _h3FontSize = newValue;
201
+ }
202
+
203
+ - (BOOL)h3Bold {
204
+ return _h3Bold;
205
+ }
206
+
207
+ - (void)setH3Bold:(BOOL)newValue {
208
+ _h3Bold = newValue;
209
+ }
210
+
211
+ - (UIColor *)blockquoteBorderColor {
212
+ return _blockquoteBorderColor;
213
+ }
214
+
215
+ - (void)setBlockquoteBorderColor:(UIColor *)newValue {
216
+ _blockquoteBorderColor = newValue;
217
+ }
218
+
219
+ - (CGFloat)blockquoteBorderWidth {
220
+ return _blockquoteBorderWidth;
221
+ }
222
+
223
+ - (void)setBlockquoteBorderWidth:(CGFloat)newValue {
224
+ _blockquoteBorderWidth = newValue;
225
+ }
226
+
227
+
228
+ - (CGFloat)blockquoteGapWidth {
229
+ return _blockquoteGapWidth;
230
+ }
231
+
232
+ - (void)setBlockquoteGapWidth:(CGFloat)newValue {
233
+ _blockquoteGapWidth = newValue;
234
+ }
235
+
236
+ - (UIColor *)blockquoteColor {
237
+ return _blockquoteColor;
238
+ }
239
+
240
+ - (void)setBlockquoteColor:(UIColor *)newValue {
241
+ _blockquoteColor = newValue;
242
+ }
243
+
244
+ - (UIColor *)inlineCodeFgColor {
245
+ return _inlineCodeFgColor;
246
+ }
247
+
248
+ - (void)setInlineCodeFgColor:(UIColor *)newValue {
249
+ _inlineCodeFgColor = newValue;
250
+ }
251
+
252
+ - (UIColor *)inlineCodeBgColor {
253
+ return _inlineCodeBgColor;
254
+ }
255
+
256
+ - (void)setInlineCodeBgColor:(UIColor *)newValue {
257
+ _inlineCodeBgColor = newValue;
258
+ }
259
+
260
+ - (CGFloat)orderedListGapWidth {
261
+ return _orderedListGapWidth;
262
+ }
263
+
264
+ - (void)setOrderedListGapWidth:(CGFloat)newValue {
265
+ _orderedListGapWidth = newValue;
266
+ }
267
+
268
+ - (CGFloat)orderedListMarginLeft {
269
+ return _orderedListMarginLeft;
270
+ }
271
+
272
+ - (void)setOrderedListMarginLeft:(CGFloat)newValue {
273
+ _orderedListMarginLeft = newValue;
274
+ }
275
+
276
+ - (NSString *)orderedListMarkerFontWeight {
277
+ return _orderedListMarkerFontWeight;
278
+ }
279
+
280
+ - (void)setOrderedListMarkerFontWeight:(NSString *)newValue {
281
+ _orderedListMarkerFontWeight = newValue;
282
+ _olMarkerFontNeedsRecreation = YES;
283
+ }
284
+
285
+ - (UIColor *)orderedListMarkerColor {
286
+ return _orderedListMarkerColor;
287
+ }
288
+
289
+ - (void)setOrderedListMarkerColor:(UIColor *)newValue {
290
+ _orderedListMarkerColor = newValue;
291
+ }
292
+
293
+ - (UIFont *)orderedListMarkerFont {
294
+ if(_olMarkerFontNeedsRecreation) {
295
+ _olMarkerFontNeedsRecreation = NO;
296
+
297
+ NSString *newFontWeight = [self orderedListMarkerFontWeight];
298
+ // fix RCTFontWeight conversion warnings:
299
+ // sometimes changing font family comes with weight '0' if not specified
300
+ // RCTConvert doesn't recognize this value so we just nullify it and it gets a default value
301
+ if([newFontWeight isEqualToString:@"0"]) {
302
+ newFontWeight = nullptr;
303
+ }
304
+
305
+ _orderedListMarkerFont = [RCTFont updateFont:nullptr
306
+ withFamily:[self primaryFontFamily]
307
+ size:[self primaryFontSize]
308
+ weight:newFontWeight
309
+ style:nullptr
310
+ variant:nullptr
311
+ scaleMultiplier: 1];
312
+ }
313
+ return _orderedListMarkerFont;
314
+ }
315
+
316
+ - (UIColor *)unorderedListBulletColor {
317
+ return _unorderedListBulletColor;
318
+ }
319
+
320
+ - (void)setUnorderedListBulletColor:(UIColor *)newValue {
321
+ _unorderedListBulletColor = newValue;
322
+ }
323
+
324
+ - (CGFloat)unorderedListBulletSize {
325
+ return _unorderedListBulletSize;
326
+ }
327
+
328
+ - (void)setUnorderedListBulletSize:(CGFloat)newValue {
329
+ _unorderedListBulletSize = newValue;
330
+ }
331
+
332
+ - (CGFloat)unorderedListGapWidth {
333
+ return _unorderedListGapWidth;
334
+ }
335
+
336
+ - (void)setUnorderedListGapWidth:(CGFloat)newValue {
337
+ _unorderedListGapWidth = newValue;
338
+ }
339
+
340
+ - (CGFloat)unorderedListMarginLeft {
341
+ return _unorderedListMarginLeft;
342
+ }
343
+
344
+ - (void)setUnorderedListMarginLeft:(CGFloat)newValue {
345
+ _unorderedListMarginLeft = newValue;
346
+ }
347
+
348
+ - (UIColor *)linkColor {
349
+ return _linkColor;
350
+ }
351
+
352
+ - (void)setLinkColor:(UIColor *)newValue {
353
+ _linkColor = newValue;
354
+ }
355
+
356
+ - (TextDecorationLineEnum)linkDecorationLine {
357
+ return _linkDecorationLine;
358
+ }
359
+
360
+ - (void)setLinkDecorationLine:(TextDecorationLineEnum)newValue {
361
+ _linkDecorationLine = newValue;
362
+ }
363
+
364
+ - (void)setMentionStyleProps:(NSDictionary *)newValue {
365
+ _mentionProperties = [newValue mutableCopy];
366
+ }
367
+
368
+ - (MentionStyleProps *)mentionStylePropsForIndicator:(NSString *)indicator {
369
+ if(_mentionProperties.count == 1 && _mentionProperties[@"all"] != nullptr) {
370
+ // single props for all the indicators
371
+ return _mentionProperties[@"all"];
372
+ } else if(_mentionProperties[indicator] != nullptr) {
373
+ return _mentionProperties[indicator];
374
+ }
375
+ MentionStyleProps *fallbackProps = [[MentionStyleProps alloc] init];
376
+ fallbackProps.color = [UIColor blueColor];
377
+ fallbackProps.backgroundColor = [UIColor yellowColor];
378
+ fallbackProps.decorationLine = DecorationUnderline;
379
+ return fallbackProps;
380
+ }
381
+
382
+ @end
@@ -0,0 +1,22 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateComponentDescriptorCpp.js
9
+ */
10
+
11
+ #include "ComponentDescriptors.h"
12
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
13
+ #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
14
+
15
+ namespace facebook::react {
16
+
17
+ void RNEnrichedTextInputViewSpec_registerComponentDescriptorsFromCodegen(
18
+ std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
19
+
20
+ }
21
+
22
+ } // namespace facebook::react
@@ -0,0 +1,24 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateComponentDescriptorH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include "ShadowNodes.h"
14
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
15
+ #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
16
+
17
+ namespace facebook::react {
18
+
19
+
20
+
21
+ void RNEnrichedTextInputViewSpec_registerComponentDescriptorsFromCodegen(
22
+ std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
23
+
24
+ } // namespace facebook::react
@@ -0,0 +1,118 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateEventEmitterCpp.js
9
+ */
10
+
11
+ #include "EventEmitters.h"
12
+ #include <jsi/JSIDynamic.h>
13
+
14
+ namespace facebook::react {
15
+
16
+ void EnrichedTextInputViewEventEmitter::onInputFocus(OnInputFocus event) const {
17
+ dispatchEvent("inputFocus", [](jsi::Runtime &runtime) {
18
+ auto payload = jsi::Object(runtime);
19
+
20
+ return payload;
21
+ });
22
+ }
23
+
24
+
25
+ void EnrichedTextInputViewEventEmitter::onInputBlur(OnInputBlur event) const {
26
+ dispatchEvent("inputBlur", [](jsi::Runtime &runtime) {
27
+ auto payload = jsi::Object(runtime);
28
+
29
+ return payload;
30
+ });
31
+ }
32
+
33
+
34
+ void EnrichedTextInputViewEventEmitter::onChangeText(OnChangeText event) const {
35
+ dispatchEvent("changeText", [event=std::move(event)](jsi::Runtime &runtime) {
36
+ auto payload = jsi::Object(runtime);
37
+ payload.setProperty(runtime, "value", event.value);
38
+ return payload;
39
+ });
40
+ }
41
+
42
+
43
+ void EnrichedTextInputViewEventEmitter::onChangeHtml(OnChangeHtml event) const {
44
+ dispatchEvent("changeHtml", [event=std::move(event)](jsi::Runtime &runtime) {
45
+ auto payload = jsi::Object(runtime);
46
+ payload.setProperty(runtime, "value", event.value);
47
+ return payload;
48
+ });
49
+ }
50
+
51
+
52
+ void EnrichedTextInputViewEventEmitter::onChangeState(OnChangeState event) const {
53
+ dispatchEvent("changeState", [event=std::move(event)](jsi::Runtime &runtime) {
54
+ auto payload = jsi::Object(runtime);
55
+ payload.setProperty(runtime, "isBold", event.isBold);
56
+ payload.setProperty(runtime, "isItalic", event.isItalic);
57
+ payload.setProperty(runtime, "isUnderline", event.isUnderline);
58
+ payload.setProperty(runtime, "isStrikeThrough", event.isStrikeThrough);
59
+ payload.setProperty(runtime, "isInlineCode", event.isInlineCode);
60
+ payload.setProperty(runtime, "isH1", event.isH1);
61
+ payload.setProperty(runtime, "isH2", event.isH2);
62
+ payload.setProperty(runtime, "isH3", event.isH3);
63
+ payload.setProperty(runtime, "isCodeBlock", event.isCodeBlock);
64
+ payload.setProperty(runtime, "isBlockQuote", event.isBlockQuote);
65
+ payload.setProperty(runtime, "isOrderedList", event.isOrderedList);
66
+ payload.setProperty(runtime, "isUnorderedList", event.isUnorderedList);
67
+ payload.setProperty(runtime, "isLink", event.isLink);
68
+ payload.setProperty(runtime, "isImage", event.isImage);
69
+ payload.setProperty(runtime, "isMention", event.isMention);
70
+ return payload;
71
+ });
72
+ }
73
+
74
+
75
+ void EnrichedTextInputViewEventEmitter::onLinkDetected(OnLinkDetected event) const {
76
+ dispatchEvent("linkDetected", [event=std::move(event)](jsi::Runtime &runtime) {
77
+ auto payload = jsi::Object(runtime);
78
+ payload.setProperty(runtime, "text", event.text);
79
+ payload.setProperty(runtime, "url", event.url);
80
+ payload.setProperty(runtime, "start", event.start);
81
+ payload.setProperty(runtime, "end", event.end);
82
+ return payload;
83
+ });
84
+ }
85
+
86
+
87
+ void EnrichedTextInputViewEventEmitter::onMentionDetected(OnMentionDetected event) const {
88
+ dispatchEvent("mentionDetected", [event=std::move(event)](jsi::Runtime &runtime) {
89
+ auto payload = jsi::Object(runtime);
90
+ payload.setProperty(runtime, "text", event.text);
91
+ payload.setProperty(runtime, "indicator", event.indicator);
92
+ payload.setProperty(runtime, "payload", event.payload);
93
+ return payload;
94
+ });
95
+ }
96
+
97
+
98
+ void EnrichedTextInputViewEventEmitter::onMention(OnMention event) const {
99
+ dispatchEvent("mention", [event=std::move(event)](jsi::Runtime &runtime) {
100
+ auto payload = jsi::Object(runtime);
101
+ payload.setProperty(runtime, "indicator", event.indicator);
102
+ payload.setProperty(runtime, "text", jsi::valueFromDynamic(runtime, event.text));
103
+ return payload;
104
+ });
105
+ }
106
+
107
+
108
+ void EnrichedTextInputViewEventEmitter::onChangeSelection(OnChangeSelection event) const {
109
+ dispatchEvent("changeSelection", [event=std::move(event)](jsi::Runtime &runtime) {
110
+ auto payload = jsi::Object(runtime);
111
+ payload.setProperty(runtime, "start", event.start);
112
+ payload.setProperty(runtime, "end", event.end);
113
+ payload.setProperty(runtime, "text", event.text);
114
+ return payload;
115
+ });
116
+ }
117
+
118
+ } // namespace facebook::react