react-native-enriched-markdown 0.1.0 → 0.1.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 (211) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +479 -0
  3. package/ReactNativeEnrichedMarkdown.podspec +27 -0
  4. package/android/build.gradle +101 -0
  5. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextManagerDelegate.java +39 -0
  6. package/android/generated/java/com/facebook/react/viewmanagers/EnrichedMarkdownTextManagerInterface.java +21 -0
  7. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/ComponentDescriptors.cpp +22 -0
  8. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/ComponentDescriptors.h +24 -0
  9. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/EventEmitters.cpp +24 -0
  10. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/EventEmitters.h +25 -0
  11. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/Props.cpp +57 -0
  12. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/Props.h +1164 -0
  13. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/ShadowNodes.cpp +17 -0
  14. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/ShadowNodes.h +32 -0
  15. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/States.cpp +16 -0
  16. package/android/generated/jni/react/renderer/components/EnrichedMarkdownTextSpec/States.h +20 -0
  17. package/android/gradle.properties +5 -0
  18. package/android/src/main/AndroidManifest.xml +2 -0
  19. package/android/src/main/baseline-prof.txt +65 -0
  20. package/android/src/main/cpp/jni-adapter.cpp +203 -0
  21. package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownText.kt +153 -0
  22. package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownTextLayoutManager.kt +30 -0
  23. package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownTextManager.kt +119 -0
  24. package/android/src/main/java/com/swmansion/enriched/markdown/EnrichedMarkdownTextPackage.kt +17 -0
  25. package/android/src/main/java/com/swmansion/enriched/markdown/MeasurementStore.kt +165 -0
  26. package/android/src/main/java/com/swmansion/enriched/markdown/events/LinkPressEvent.kt +23 -0
  27. package/android/src/main/java/com/swmansion/enriched/markdown/parser/MarkdownASTNode.kt +29 -0
  28. package/android/src/main/java/com/swmansion/enriched/markdown/parser/Parser.kt +48 -0
  29. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/BlockStyleContext.kt +166 -0
  30. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/BlockquoteRenderer.kt +89 -0
  31. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/CodeBlockRenderer.kt +105 -0
  32. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/CodeRenderer.kt +35 -0
  33. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/DocumentRenderer.kt +15 -0
  34. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/EmphasisRenderer.kt +26 -0
  35. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/HeadingRenderer.kt +54 -0
  36. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/ImageRenderer.kt +52 -0
  37. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/LineBreakRenderer.kt +15 -0
  38. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/LinkRenderer.kt +28 -0
  39. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/ListContextManager.kt +105 -0
  40. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/ListItemRenderer.kt +58 -0
  41. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/ListRenderer.kt +69 -0
  42. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/NodeRenderer.kt +99 -0
  43. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/ParagraphRenderer.kt +66 -0
  44. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/Renderer.kt +95 -0
  45. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/SpanStyleCache.kt +85 -0
  46. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/StrongRenderer.kt +26 -0
  47. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/TextRenderer.kt +29 -0
  48. package/android/src/main/java/com/swmansion/enriched/markdown/renderer/ThematicBreakRenderer.kt +44 -0
  49. package/android/src/main/java/com/swmansion/enriched/markdown/spans/BaseListSpan.kt +136 -0
  50. package/android/src/main/java/com/swmansion/enriched/markdown/spans/BlockquoteSpan.kt +135 -0
  51. package/android/src/main/java/com/swmansion/enriched/markdown/spans/CodeBackgroundSpan.kt +180 -0
  52. package/android/src/main/java/com/swmansion/enriched/markdown/spans/CodeBlockSpan.kt +196 -0
  53. package/android/src/main/java/com/swmansion/enriched/markdown/spans/CodeSpan.kt +27 -0
  54. package/android/src/main/java/com/swmansion/enriched/markdown/spans/EmphasisSpan.kt +34 -0
  55. package/android/src/main/java/com/swmansion/enriched/markdown/spans/HeadingSpan.kt +38 -0
  56. package/android/src/main/java/com/swmansion/enriched/markdown/spans/ImageSpan.kt +320 -0
  57. package/android/src/main/java/com/swmansion/enriched/markdown/spans/LineHeightSpan.kt +36 -0
  58. package/android/src/main/java/com/swmansion/enriched/markdown/spans/LinkSpan.kt +37 -0
  59. package/android/src/main/java/com/swmansion/enriched/markdown/spans/MarginBottomSpan.kt +76 -0
  60. package/android/src/main/java/com/swmansion/enriched/markdown/spans/OrderedListSpan.kt +87 -0
  61. package/android/src/main/java/com/swmansion/enriched/markdown/spans/StrongSpan.kt +37 -0
  62. package/android/src/main/java/com/swmansion/enriched/markdown/spans/TextSpan.kt +26 -0
  63. package/android/src/main/java/com/swmansion/enriched/markdown/spans/ThematicBreakSpan.kt +69 -0
  64. package/android/src/main/java/com/swmansion/enriched/markdown/spans/UnorderedListSpan.kt +69 -0
  65. package/android/src/main/java/com/swmansion/enriched/markdown/styles/BaseBlockStyle.kt +10 -0
  66. package/android/src/main/java/com/swmansion/enriched/markdown/styles/BlockquoteStyle.kt +48 -0
  67. package/android/src/main/java/com/swmansion/enriched/markdown/styles/CodeBlockStyle.kt +51 -0
  68. package/android/src/main/java/com/swmansion/enriched/markdown/styles/CodeStyle.kt +21 -0
  69. package/android/src/main/java/com/swmansion/enriched/markdown/styles/EmphasisStyle.kt +17 -0
  70. package/android/src/main/java/com/swmansion/enriched/markdown/styles/HeadingStyle.kt +29 -0
  71. package/android/src/main/java/com/swmansion/enriched/markdown/styles/ImageStyle.kt +21 -0
  72. package/android/src/main/java/com/swmansion/enriched/markdown/styles/InlineImageStyle.kt +17 -0
  73. package/android/src/main/java/com/swmansion/enriched/markdown/styles/LinkStyle.kt +19 -0
  74. package/android/src/main/java/com/swmansion/enriched/markdown/styles/ListStyle.kt +54 -0
  75. package/android/src/main/java/com/swmansion/enriched/markdown/styles/ParagraphStyle.kt +29 -0
  76. package/android/src/main/java/com/swmansion/enriched/markdown/styles/StrongStyle.kt +17 -0
  77. package/android/src/main/java/com/swmansion/enriched/markdown/styles/StyleConfig.kt +180 -0
  78. package/android/src/main/java/com/swmansion/enriched/markdown/styles/StyleParser.kt +75 -0
  79. package/android/src/main/java/com/swmansion/enriched/markdown/styles/ThematicBreakStyle.kt +23 -0
  80. package/android/src/main/java/com/swmansion/enriched/markdown/utils/AsyncDrawable.kt +91 -0
  81. package/android/src/main/java/com/swmansion/enriched/markdown/utils/HTMLGenerator.kt +809 -0
  82. package/android/src/main/java/com/swmansion/enriched/markdown/utils/MarkdownExtractor.kt +365 -0
  83. package/android/src/main/java/com/swmansion/enriched/markdown/utils/SelectionActionMode.kt +139 -0
  84. package/android/src/main/java/com/swmansion/enriched/markdown/utils/Utils.kt +181 -0
  85. package/android/src/main/jni/CMakeLists.txt +82 -0
  86. package/android/src/main/jni/EnrichedMarkdownTextSpec.cpp +21 -0
  87. package/android/src/main/jni/EnrichedMarkdownTextSpec.h +25 -0
  88. package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextComponentDescriptor.h +29 -0
  89. package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextMeasurementManager.cpp +45 -0
  90. package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextMeasurementManager.h +21 -0
  91. package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextShadowNode.cpp +33 -0
  92. package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextShadowNode.h +49 -0
  93. package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextState.cpp +9 -0
  94. package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/MarkdownTextState.h +25 -0
  95. package/android/src/main/jni/react/renderer/components/EnrichedMarkdownTextSpec/conversions.h +19 -0
  96. package/cpp/md4c/md4c.c +6492 -0
  97. package/cpp/md4c/md4c.h +402 -0
  98. package/cpp/parser/MD4CParser.cpp +314 -0
  99. package/cpp/parser/MD4CParser.hpp +23 -0
  100. package/cpp/parser/MarkdownASTNode.hpp +49 -0
  101. package/ios/EnrichedMarkdownText.h +18 -0
  102. package/ios/EnrichedMarkdownText.mm +1074 -0
  103. package/ios/attachments/ImageAttachment.h +23 -0
  104. package/ios/attachments/ImageAttachment.m +185 -0
  105. package/ios/attachments/ThematicBreakAttachment.h +15 -0
  106. package/ios/attachments/ThematicBreakAttachment.m +33 -0
  107. package/ios/generated/EnrichedMarkdownTextSpec/ComponentDescriptors.cpp +22 -0
  108. package/ios/generated/EnrichedMarkdownTextSpec/ComponentDescriptors.h +24 -0
  109. package/ios/generated/EnrichedMarkdownTextSpec/EventEmitters.cpp +24 -0
  110. package/ios/generated/EnrichedMarkdownTextSpec/EventEmitters.h +25 -0
  111. package/ios/generated/EnrichedMarkdownTextSpec/Props.cpp +57 -0
  112. package/ios/generated/EnrichedMarkdownTextSpec/Props.h +1164 -0
  113. package/ios/generated/EnrichedMarkdownTextSpec/RCTComponentViewHelpers.h +20 -0
  114. package/ios/generated/EnrichedMarkdownTextSpec/ShadowNodes.cpp +17 -0
  115. package/ios/generated/EnrichedMarkdownTextSpec/ShadowNodes.h +32 -0
  116. package/ios/generated/EnrichedMarkdownTextSpec/States.cpp +16 -0
  117. package/ios/generated/EnrichedMarkdownTextSpec/States.h +20 -0
  118. package/ios/internals/EnrichedMarkdownTextComponentDescriptor.h +19 -0
  119. package/ios/internals/EnrichedMarkdownTextShadowNode.h +43 -0
  120. package/ios/internals/EnrichedMarkdownTextShadowNode.mm +85 -0
  121. package/ios/internals/EnrichedMarkdownTextState.h +24 -0
  122. package/ios/parser/MarkdownASTNode.h +33 -0
  123. package/ios/parser/MarkdownASTNode.m +32 -0
  124. package/ios/parser/MarkdownParser.h +8 -0
  125. package/ios/parser/MarkdownParser.mm +13 -0
  126. package/ios/parser/MarkdownParserBridge.mm +110 -0
  127. package/ios/renderer/AttributedRenderer.h +9 -0
  128. package/ios/renderer/AttributedRenderer.m +119 -0
  129. package/ios/renderer/BlockquoteRenderer.h +7 -0
  130. package/ios/renderer/BlockquoteRenderer.m +159 -0
  131. package/ios/renderer/CodeBlockRenderer.h +10 -0
  132. package/ios/renderer/CodeBlockRenderer.m +89 -0
  133. package/ios/renderer/CodeRenderer.h +10 -0
  134. package/ios/renderer/CodeRenderer.m +60 -0
  135. package/ios/renderer/EmphasisRenderer.h +6 -0
  136. package/ios/renderer/EmphasisRenderer.m +96 -0
  137. package/ios/renderer/HeadingRenderer.h +7 -0
  138. package/ios/renderer/HeadingRenderer.m +98 -0
  139. package/ios/renderer/ImageRenderer.h +12 -0
  140. package/ios/renderer/ImageRenderer.m +62 -0
  141. package/ios/renderer/LinkRenderer.h +7 -0
  142. package/ios/renderer/LinkRenderer.m +69 -0
  143. package/ios/renderer/ListItemRenderer.h +16 -0
  144. package/ios/renderer/ListItemRenderer.m +91 -0
  145. package/ios/renderer/ListRenderer.h +13 -0
  146. package/ios/renderer/ListRenderer.m +67 -0
  147. package/ios/renderer/NodeRenderer.h +8 -0
  148. package/ios/renderer/ParagraphRenderer.h +7 -0
  149. package/ios/renderer/ParagraphRenderer.m +69 -0
  150. package/ios/renderer/RenderContext.h +88 -0
  151. package/ios/renderer/RenderContext.m +248 -0
  152. package/ios/renderer/RendererFactory.h +12 -0
  153. package/ios/renderer/RendererFactory.m +110 -0
  154. package/ios/renderer/StrongRenderer.h +6 -0
  155. package/ios/renderer/StrongRenderer.m +83 -0
  156. package/ios/renderer/TextRenderer.h +6 -0
  157. package/ios/renderer/TextRenderer.m +16 -0
  158. package/ios/renderer/ThematicBreakRenderer.h +5 -0
  159. package/ios/renderer/ThematicBreakRenderer.m +53 -0
  160. package/ios/styles/StyleConfig.h +228 -0
  161. package/ios/styles/StyleConfig.mm +1467 -0
  162. package/ios/utils/BlockquoteBorder.h +20 -0
  163. package/ios/utils/BlockquoteBorder.m +92 -0
  164. package/ios/utils/CodeBackground.h +19 -0
  165. package/ios/utils/CodeBackground.m +191 -0
  166. package/ios/utils/CodeBlockBackground.h +17 -0
  167. package/ios/utils/CodeBlockBackground.m +87 -0
  168. package/ios/utils/EditMenuUtils.h +22 -0
  169. package/ios/utils/EditMenuUtils.m +118 -0
  170. package/ios/utils/FontUtils.h +20 -0
  171. package/ios/utils/FontUtils.m +13 -0
  172. package/ios/utils/HTMLGenerator.h +20 -0
  173. package/ios/utils/HTMLGenerator.m +779 -0
  174. package/ios/utils/LastElementUtils.h +53 -0
  175. package/ios/utils/ListMarkerDrawer.h +15 -0
  176. package/ios/utils/ListMarkerDrawer.m +127 -0
  177. package/ios/utils/MarkdownExtractor.h +17 -0
  178. package/ios/utils/MarkdownExtractor.m +295 -0
  179. package/ios/utils/ParagraphStyleUtils.h +13 -0
  180. package/ios/utils/ParagraphStyleUtils.m +56 -0
  181. package/ios/utils/PasteboardUtils.h +36 -0
  182. package/ios/utils/PasteboardUtils.m +134 -0
  183. package/ios/utils/RTFExportUtils.h +24 -0
  184. package/ios/utils/RTFExportUtils.m +297 -0
  185. package/ios/utils/RuntimeKeys.h +38 -0
  186. package/ios/utils/RuntimeKeys.m +11 -0
  187. package/ios/utils/TextViewLayoutManager.h +14 -0
  188. package/ios/utils/TextViewLayoutManager.mm +113 -0
  189. package/lib/module/EnrichedMarkdownText.js +34 -0
  190. package/lib/module/EnrichedMarkdownText.js.map +1 -0
  191. package/lib/module/EnrichedMarkdownTextNativeComponent.ts +130 -0
  192. package/lib/module/index.js +5 -0
  193. package/lib/module/index.js.map +1 -0
  194. package/lib/module/normalizeMarkdownStyle.js +340 -0
  195. package/lib/module/normalizeMarkdownStyle.js.map +1 -0
  196. package/lib/module/package.json +1 -0
  197. package/lib/typescript/package.json +1 -0
  198. package/lib/typescript/src/EnrichedMarkdownText.d.ts +101 -0
  199. package/lib/typescript/src/EnrichedMarkdownText.d.ts.map +1 -0
  200. package/lib/typescript/src/EnrichedMarkdownTextNativeComponent.d.ts +111 -0
  201. package/lib/typescript/src/EnrichedMarkdownTextNativeComponent.d.ts.map +1 -0
  202. package/lib/typescript/src/index.d.ts +5 -0
  203. package/lib/typescript/src/index.d.ts.map +1 -0
  204. package/lib/typescript/src/normalizeMarkdownStyle.d.ts +6 -0
  205. package/lib/typescript/src/normalizeMarkdownStyle.d.ts.map +1 -0
  206. package/package.json +186 -1
  207. package/react-native.config.js +13 -0
  208. package/src/EnrichedMarkdownText.tsx +152 -0
  209. package/src/EnrichedMarkdownTextNativeComponent.ts +130 -0
  210. package/src/index.tsx +7 -0
  211. package/src/normalizeMarkdownStyle.ts +377 -0
@@ -0,0 +1,1467 @@
1
+ #import "StyleConfig.h"
2
+ #import <React/RCTFont.h>
3
+
4
+ static inline NSString *normalizedFontWeight(NSString *fontWeight)
5
+ {
6
+ // If nil or empty string, return nil to let RCTFont use fontFamily as-is
7
+ if (fontWeight == nil || fontWeight.length == 0) {
8
+ return nil;
9
+ }
10
+
11
+ return fontWeight;
12
+ }
13
+
14
+ @implementation StyleConfig {
15
+ // Primary font properties
16
+ UIColor *_primaryColor;
17
+ NSNumber *_primaryFontSize;
18
+ NSString *_primaryFontWeight;
19
+ NSString *_primaryFontFamily;
20
+ UIFont *_primaryFont;
21
+ BOOL _primaryFontNeedsRecreation;
22
+ // Paragraph properties
23
+ CGFloat _paragraphFontSize;
24
+ NSString *_paragraphFontFamily;
25
+ NSString *_paragraphFontWeight;
26
+ UIColor *_paragraphColor;
27
+ CGFloat _paragraphMarginBottom;
28
+ CGFloat _paragraphLineHeight;
29
+ UIFont *_paragraphFont;
30
+ BOOL _paragraphFontNeedsRecreation;
31
+ // H1 properties
32
+ CGFloat _h1FontSize;
33
+ NSString *_h1FontFamily;
34
+ NSString *_h1FontWeight;
35
+ UIColor *_h1Color;
36
+ CGFloat _h1MarginBottom;
37
+ CGFloat _h1LineHeight;
38
+ UIFont *_h1Font;
39
+ BOOL _h1FontNeedsRecreation;
40
+ // H2 properties
41
+ CGFloat _h2FontSize;
42
+ NSString *_h2FontFamily;
43
+ NSString *_h2FontWeight;
44
+ UIColor *_h2Color;
45
+ CGFloat _h2MarginBottom;
46
+ CGFloat _h2LineHeight;
47
+ UIFont *_h2Font;
48
+ BOOL _h2FontNeedsRecreation;
49
+ // H3 properties
50
+ CGFloat _h3FontSize;
51
+ NSString *_h3FontFamily;
52
+ NSString *_h3FontWeight;
53
+ UIColor *_h3Color;
54
+ CGFloat _h3MarginBottom;
55
+ CGFloat _h3LineHeight;
56
+ UIFont *_h3Font;
57
+ BOOL _h3FontNeedsRecreation;
58
+ // H4 properties
59
+ CGFloat _h4FontSize;
60
+ NSString *_h4FontFamily;
61
+ NSString *_h4FontWeight;
62
+ UIColor *_h4Color;
63
+ CGFloat _h4MarginBottom;
64
+ CGFloat _h4LineHeight;
65
+ UIFont *_h4Font;
66
+ BOOL _h4FontNeedsRecreation;
67
+ // H5 properties
68
+ CGFloat _h5FontSize;
69
+ NSString *_h5FontFamily;
70
+ NSString *_h5FontWeight;
71
+ UIColor *_h5Color;
72
+ CGFloat _h5MarginBottom;
73
+ CGFloat _h5LineHeight;
74
+ UIFont *_h5Font;
75
+ BOOL _h5FontNeedsRecreation;
76
+ // H6 properties
77
+ CGFloat _h6FontSize;
78
+ NSString *_h6FontFamily;
79
+ NSString *_h6FontWeight;
80
+ UIColor *_h6Color;
81
+ CGFloat _h6MarginBottom;
82
+ CGFloat _h6LineHeight;
83
+ UIFont *_h6Font;
84
+ BOOL _h6FontNeedsRecreation;
85
+ // Link properties
86
+ UIColor *_linkColor;
87
+ BOOL _linkUnderline;
88
+ // Strong properties
89
+ UIColor *_strongColor;
90
+ // Emphasis properties
91
+ UIColor *_emphasisColor;
92
+ // Code properties
93
+ UIColor *_codeColor;
94
+ UIColor *_codeBackgroundColor;
95
+ UIColor *_codeBorderColor;
96
+ // Image properties
97
+ CGFloat _imageHeight;
98
+ CGFloat _imageBorderRadius;
99
+ CGFloat _imageMarginBottom;
100
+ // Inline image properties
101
+ CGFloat _inlineImageSize;
102
+ // Blockquote properties
103
+ CGFloat _blockquoteFontSize;
104
+ NSString *_blockquoteFontFamily;
105
+ NSString *_blockquoteFontWeight;
106
+ UIColor *_blockquoteColor;
107
+ CGFloat _blockquoteMarginBottom;
108
+ CGFloat _blockquoteLineHeight;
109
+ UIColor *_blockquoteBorderColor;
110
+ CGFloat _blockquoteBorderWidth;
111
+ CGFloat _blockquoteGapWidth;
112
+ UIColor *_blockquoteBackgroundColor;
113
+ // List style properties (combined for both ordered and unordered lists)
114
+ CGFloat _listStyleFontSize;
115
+ NSString *_listStyleFontFamily;
116
+ NSString *_listStyleFontWeight;
117
+ UIColor *_listStyleColor;
118
+ CGFloat _listStyleMarginBottom;
119
+ CGFloat _listStyleLineHeight;
120
+ UIColor *_listStyleBulletColor;
121
+ CGFloat _listStyleBulletSize;
122
+ UIColor *_listStyleMarkerColor;
123
+ NSString *_listStyleMarkerFontWeight;
124
+ CGFloat _listStyleGapWidth;
125
+ CGFloat _listStyleMarginLeft;
126
+ UIFont *_listMarkerFont;
127
+ BOOL _listMarkerFontNeedsRecreation;
128
+ UIFont *_listStyleFont;
129
+ BOOL _listStyleFontNeedsRecreation;
130
+ // Code block properties
131
+ CGFloat _codeBlockFontSize;
132
+ NSString *_codeBlockFontFamily;
133
+ NSString *_codeBlockFontWeight;
134
+ UIColor *_codeBlockColor;
135
+ CGFloat _codeBlockMarginBottom;
136
+ CGFloat _codeBlockLineHeight;
137
+ UIColor *_codeBlockBackgroundColor;
138
+ UIColor *_codeBlockBorderColor;
139
+ CGFloat _codeBlockBorderRadius;
140
+ CGFloat _codeBlockBorderWidth;
141
+ CGFloat _codeBlockPadding;
142
+ UIFont *_codeBlockFont;
143
+ BOOL _codeBlockFontNeedsRecreation;
144
+ UIFont *_blockquoteFont;
145
+ BOOL _blockquoteFontNeedsRecreation;
146
+ // Thematic break properties
147
+ UIColor *_thematicBreakColor;
148
+ CGFloat _thematicBreakHeight;
149
+ CGFloat _thematicBreakMarginTop;
150
+ CGFloat _thematicBreakMarginBottom;
151
+ }
152
+
153
+ - (instancetype)init
154
+ {
155
+ self = [super init];
156
+ _primaryFontNeedsRecreation = YES;
157
+ _paragraphFontNeedsRecreation = YES;
158
+ _h1FontNeedsRecreation = YES;
159
+ _h2FontNeedsRecreation = YES;
160
+ _h3FontNeedsRecreation = YES;
161
+ _h4FontNeedsRecreation = YES;
162
+ _h5FontNeedsRecreation = YES;
163
+ _h6FontNeedsRecreation = YES;
164
+ _listMarkerFontNeedsRecreation = YES;
165
+ _listStyleFontNeedsRecreation = YES;
166
+ _codeBlockFontNeedsRecreation = YES;
167
+ _blockquoteFontNeedsRecreation = YES;
168
+ _linkUnderline = YES;
169
+ return self;
170
+ }
171
+
172
+ - (id)copyWithZone:(NSZone *)zone
173
+ {
174
+ StyleConfig *copy = [[[self class] allocWithZone:zone] init];
175
+ copy->_primaryColor = [_primaryColor copy];
176
+ copy->_primaryFontSize = [_primaryFontSize copy];
177
+ copy->_primaryFontWeight = [_primaryFontWeight copy];
178
+ copy->_primaryFontFamily = [_primaryFontFamily copy];
179
+ copy->_primaryFontNeedsRecreation = YES;
180
+
181
+ copy->_paragraphFontSize = _paragraphFontSize;
182
+ copy->_paragraphFontFamily = [_paragraphFontFamily copy];
183
+ copy->_paragraphFontWeight = [_paragraphFontWeight copy];
184
+ copy->_paragraphColor = [_paragraphColor copy];
185
+ copy->_paragraphMarginBottom = _paragraphMarginBottom;
186
+ copy->_paragraphLineHeight = _paragraphLineHeight;
187
+ copy->_paragraphFontNeedsRecreation = YES;
188
+ copy->_h1FontSize = _h1FontSize;
189
+ copy->_h1FontFamily = [_h1FontFamily copy];
190
+ copy->_h1FontWeight = [_h1FontWeight copy];
191
+ copy->_h1Color = [_h1Color copy];
192
+ copy->_h1MarginBottom = _h1MarginBottom;
193
+ copy->_h1LineHeight = _h1LineHeight;
194
+ copy->_h1FontNeedsRecreation = YES;
195
+ copy->_h2FontSize = _h2FontSize;
196
+ copy->_h2FontFamily = [_h2FontFamily copy];
197
+ copy->_h2FontWeight = [_h2FontWeight copy];
198
+ copy->_h2Color = [_h2Color copy];
199
+ copy->_h2MarginBottom = _h2MarginBottom;
200
+ copy->_h2LineHeight = _h2LineHeight;
201
+ copy->_h2FontNeedsRecreation = YES;
202
+ copy->_h3FontSize = _h3FontSize;
203
+ copy->_h3FontFamily = [_h3FontFamily copy];
204
+ copy->_h3FontWeight = [_h3FontWeight copy];
205
+ copy->_h3Color = [_h3Color copy];
206
+ copy->_h3MarginBottom = _h3MarginBottom;
207
+ copy->_h3LineHeight = _h3LineHeight;
208
+ copy->_h3FontNeedsRecreation = YES;
209
+ copy->_h4FontSize = _h4FontSize;
210
+ copy->_h4FontFamily = [_h4FontFamily copy];
211
+ copy->_h4FontWeight = [_h4FontWeight copy];
212
+ copy->_h4Color = [_h4Color copy];
213
+ copy->_h4MarginBottom = _h4MarginBottom;
214
+ copy->_h4LineHeight = _h4LineHeight;
215
+ copy->_h4FontNeedsRecreation = YES;
216
+ copy->_h5FontSize = _h5FontSize;
217
+ copy->_h5FontFamily = [_h5FontFamily copy];
218
+ copy->_h5FontWeight = [_h5FontWeight copy];
219
+ copy->_h5Color = [_h5Color copy];
220
+ copy->_h5MarginBottom = _h5MarginBottom;
221
+ copy->_h5LineHeight = _h5LineHeight;
222
+ copy->_h5FontNeedsRecreation = YES;
223
+ copy->_h6FontSize = _h6FontSize;
224
+ copy->_h6FontFamily = [_h6FontFamily copy];
225
+ copy->_h6FontWeight = [_h6FontWeight copy];
226
+ copy->_h6Color = [_h6Color copy];
227
+ copy->_h6MarginBottom = _h6MarginBottom;
228
+ copy->_h6LineHeight = _h6LineHeight;
229
+ copy->_h6FontNeedsRecreation = YES;
230
+ copy->_linkColor = [_linkColor copy];
231
+ copy->_linkUnderline = _linkUnderline;
232
+ copy->_strongColor = [_strongColor copy];
233
+ copy->_emphasisColor = [_emphasisColor copy];
234
+ copy->_codeColor = [_codeColor copy];
235
+ copy->_codeBackgroundColor = [_codeBackgroundColor copy];
236
+ copy->_codeBorderColor = [_codeBorderColor copy];
237
+ copy->_imageHeight = _imageHeight;
238
+ copy->_imageBorderRadius = _imageBorderRadius;
239
+ copy->_imageMarginBottom = _imageMarginBottom;
240
+ copy->_inlineImageSize = _inlineImageSize;
241
+ copy->_blockquoteFontSize = _blockquoteFontSize;
242
+ copy->_blockquoteFontFamily = [_blockquoteFontFamily copy];
243
+ copy->_blockquoteFontWeight = [_blockquoteFontWeight copy];
244
+ copy->_blockquoteColor = [_blockquoteColor copy];
245
+ copy->_blockquoteMarginBottom = _blockquoteMarginBottom;
246
+ copy->_blockquoteLineHeight = _blockquoteLineHeight;
247
+ copy->_blockquoteBorderColor = [_blockquoteBorderColor copy];
248
+ copy->_blockquoteBorderWidth = _blockquoteBorderWidth;
249
+ copy->_blockquoteGapWidth = _blockquoteGapWidth;
250
+ copy->_blockquoteBackgroundColor = [_blockquoteBackgroundColor copy];
251
+ copy->_listStyleFontSize = _listStyleFontSize;
252
+ copy->_listStyleFontFamily = [_listStyleFontFamily copy];
253
+ copy->_listStyleFontWeight = [_listStyleFontWeight copy];
254
+ copy->_listStyleColor = [_listStyleColor copy];
255
+ copy->_listStyleMarginBottom = _listStyleMarginBottom;
256
+ copy->_listStyleLineHeight = _listStyleLineHeight;
257
+ copy->_listStyleBulletColor = [_listStyleBulletColor copy];
258
+ copy->_listStyleBulletSize = _listStyleBulletSize;
259
+ copy->_listStyleMarkerColor = [_listStyleMarkerColor copy];
260
+ copy->_listStyleMarkerFontWeight = [_listStyleMarkerFontWeight copy];
261
+ copy->_listStyleGapWidth = _listStyleGapWidth;
262
+ copy->_listStyleMarginLeft = _listStyleMarginLeft;
263
+ copy->_listStyleFontNeedsRecreation = YES;
264
+ copy->_codeBlockFontSize = _codeBlockFontSize;
265
+ copy->_codeBlockFontFamily = [_codeBlockFontFamily copy];
266
+ copy->_codeBlockFontWeight = [_codeBlockFontWeight copy];
267
+ copy->_codeBlockColor = [_codeBlockColor copy];
268
+ copy->_codeBlockMarginBottom = _codeBlockMarginBottom;
269
+ copy->_codeBlockLineHeight = _codeBlockLineHeight;
270
+ copy->_codeBlockBackgroundColor = [_codeBlockBackgroundColor copy];
271
+ copy->_codeBlockBorderColor = [_codeBlockBorderColor copy];
272
+ copy->_codeBlockBorderRadius = _codeBlockBorderRadius;
273
+ copy->_codeBlockBorderWidth = _codeBlockBorderWidth;
274
+ copy->_codeBlockPadding = _codeBlockPadding;
275
+ copy->_codeBlockFontNeedsRecreation = YES;
276
+ copy->_blockquoteFontNeedsRecreation = YES;
277
+ copy->_thematicBreakColor = [_thematicBreakColor copy];
278
+ copy->_thematicBreakHeight = _thematicBreakHeight;
279
+ copy->_thematicBreakMarginTop = _thematicBreakMarginTop;
280
+ copy->_thematicBreakMarginBottom = _thematicBreakMarginBottom;
281
+
282
+ return copy;
283
+ }
284
+
285
+ - (UIColor *)primaryColor
286
+ {
287
+ return _primaryColor != nullptr ? _primaryColor : [UIColor blackColor];
288
+ }
289
+
290
+ - (void)setPrimaryColor:(UIColor *)newValue
291
+ {
292
+ _primaryColor = newValue;
293
+ }
294
+
295
+ - (NSNumber *)primaryFontSize
296
+ {
297
+ return _primaryFontSize != nullptr ? _primaryFontSize : @16;
298
+ }
299
+
300
+ - (void)setPrimaryFontSize:(NSNumber *)newValue
301
+ {
302
+ _primaryFontSize = newValue;
303
+ _primaryFontNeedsRecreation = YES;
304
+ }
305
+
306
+ - (NSString *)primaryFontWeight
307
+ {
308
+ return _primaryFontWeight != nullptr ? _primaryFontWeight : @"normal";
309
+ }
310
+
311
+ - (void)setPrimaryFontWeight:(NSString *)newValue
312
+ {
313
+ _primaryFontWeight = newValue;
314
+ _primaryFontNeedsRecreation = YES;
315
+ }
316
+
317
+ - (NSString *)primaryFontFamily
318
+ {
319
+ return _primaryFontFamily;
320
+ }
321
+
322
+ - (void)setPrimaryFontFamily:(NSString *)newValue
323
+ {
324
+ _primaryFontFamily = newValue;
325
+ _primaryFontNeedsRecreation = YES;
326
+ }
327
+
328
+ - (UIFont *)primaryFont
329
+ {
330
+ if (_primaryFontNeedsRecreation || !_primaryFont) {
331
+ _primaryFont = [RCTFont updateFont:nil
332
+ withFamily:_primaryFontFamily
333
+ size:_primaryFontSize
334
+ weight:normalizedFontWeight(_primaryFontWeight)
335
+ style:nil
336
+ variant:nil
337
+ scaleMultiplier:1];
338
+ _primaryFontNeedsRecreation = NO;
339
+ }
340
+ return _primaryFont;
341
+ }
342
+
343
+ // Paragraph properties
344
+ - (CGFloat)paragraphFontSize
345
+ {
346
+ return _paragraphFontSize;
347
+ }
348
+
349
+ - (void)setParagraphFontSize:(CGFloat)newValue
350
+ {
351
+ _paragraphFontSize = newValue;
352
+ _paragraphFontNeedsRecreation = YES;
353
+ }
354
+
355
+ - (NSString *)paragraphFontFamily
356
+ {
357
+ return _paragraphFontFamily;
358
+ }
359
+
360
+ - (void)setParagraphFontFamily:(NSString *)newValue
361
+ {
362
+ _paragraphFontFamily = newValue;
363
+ _paragraphFontNeedsRecreation = YES;
364
+ }
365
+
366
+ - (NSString *)paragraphFontWeight
367
+ {
368
+ return _paragraphFontWeight;
369
+ }
370
+
371
+ - (void)setParagraphFontWeight:(NSString *)newValue
372
+ {
373
+ _paragraphFontWeight = newValue;
374
+ _paragraphFontNeedsRecreation = YES;
375
+ }
376
+
377
+ - (UIColor *)paragraphColor
378
+ {
379
+ return _paragraphColor;
380
+ }
381
+
382
+ - (void)setParagraphColor:(UIColor *)newValue
383
+ {
384
+ _paragraphColor = newValue;
385
+ }
386
+
387
+ - (CGFloat)paragraphMarginBottom
388
+ {
389
+ return _paragraphMarginBottom;
390
+ }
391
+
392
+ - (void)setParagraphMarginBottom:(CGFloat)newValue
393
+ {
394
+ _paragraphMarginBottom = newValue;
395
+ }
396
+
397
+ - (CGFloat)paragraphLineHeight
398
+ {
399
+ return _paragraphLineHeight;
400
+ }
401
+
402
+ - (void)setParagraphLineHeight:(CGFloat)newValue
403
+ {
404
+ _paragraphLineHeight = newValue;
405
+ }
406
+
407
+ - (UIFont *)paragraphFont
408
+ {
409
+ if (_paragraphFontNeedsRecreation || !_paragraphFont) {
410
+ _paragraphFont = [RCTFont updateFont:nil
411
+ withFamily:_paragraphFontFamily
412
+ size:@(_paragraphFontSize)
413
+ weight:normalizedFontWeight(_paragraphFontWeight)
414
+ style:nil
415
+ variant:nil
416
+ scaleMultiplier:1];
417
+ _paragraphFontNeedsRecreation = NO;
418
+ }
419
+ return _paragraphFont;
420
+ }
421
+
422
+ - (CGFloat)h1FontSize
423
+ {
424
+ return _h1FontSize;
425
+ }
426
+
427
+ - (void)setH1FontSize:(CGFloat)newValue
428
+ {
429
+ _h1FontSize = newValue;
430
+ _h1FontNeedsRecreation = YES;
431
+ }
432
+
433
+ - (NSString *)h1FontFamily
434
+ {
435
+ return _h1FontFamily;
436
+ }
437
+
438
+ - (void)setH1FontFamily:(NSString *)newValue
439
+ {
440
+ _h1FontFamily = newValue;
441
+ _h1FontNeedsRecreation = YES;
442
+ }
443
+
444
+ - (NSString *)h1FontWeight
445
+ {
446
+ return _h1FontWeight;
447
+ }
448
+
449
+ - (void)setH1FontWeight:(NSString *)newValue
450
+ {
451
+ _h1FontWeight = newValue;
452
+ _h1FontNeedsRecreation = YES;
453
+ }
454
+
455
+ - (UIColor *)h1Color
456
+ {
457
+ return _h1Color;
458
+ }
459
+
460
+ - (void)setH1Color:(UIColor *)newValue
461
+ {
462
+ _h1Color = newValue;
463
+ }
464
+
465
+ - (CGFloat)h1MarginBottom
466
+ {
467
+ return _h1MarginBottom;
468
+ }
469
+
470
+ - (void)setH1MarginBottom:(CGFloat)newValue
471
+ {
472
+ _h1MarginBottom = newValue;
473
+ }
474
+
475
+ - (CGFloat)h1LineHeight
476
+ {
477
+ return _h1LineHeight;
478
+ }
479
+
480
+ - (void)setH1LineHeight:(CGFloat)newValue
481
+ {
482
+ _h1LineHeight = newValue;
483
+ }
484
+
485
+ - (UIFont *)h1Font
486
+ {
487
+ if (_h1FontNeedsRecreation || !_h1Font) {
488
+ _h1Font = [RCTFont updateFont:nil
489
+ withFamily:_h1FontFamily
490
+ size:@(_h1FontSize)
491
+ weight:normalizedFontWeight(_h1FontWeight)
492
+ style:nil
493
+ variant:nil
494
+ scaleMultiplier:1];
495
+ _h1FontNeedsRecreation = NO;
496
+ }
497
+ return _h1Font;
498
+ }
499
+
500
+ - (CGFloat)h2FontSize
501
+ {
502
+ return _h2FontSize;
503
+ }
504
+
505
+ - (void)setH2FontSize:(CGFloat)newValue
506
+ {
507
+ _h2FontSize = newValue;
508
+ _h2FontNeedsRecreation = YES;
509
+ }
510
+
511
+ - (NSString *)h2FontFamily
512
+ {
513
+ return _h2FontFamily;
514
+ }
515
+
516
+ - (void)setH2FontFamily:(NSString *)newValue
517
+ {
518
+ _h2FontFamily = newValue;
519
+ _h2FontNeedsRecreation = YES;
520
+ }
521
+
522
+ - (NSString *)h2FontWeight
523
+ {
524
+ return _h2FontWeight;
525
+ }
526
+
527
+ - (void)setH2FontWeight:(NSString *)newValue
528
+ {
529
+ _h2FontWeight = newValue;
530
+ _h2FontNeedsRecreation = YES;
531
+ }
532
+
533
+ - (UIColor *)h2Color
534
+ {
535
+ return _h2Color;
536
+ }
537
+
538
+ - (void)setH2Color:(UIColor *)newValue
539
+ {
540
+ _h2Color = newValue;
541
+ }
542
+
543
+ - (CGFloat)h2MarginBottom
544
+ {
545
+ return _h2MarginBottom;
546
+ }
547
+
548
+ - (void)setH2MarginBottom:(CGFloat)newValue
549
+ {
550
+ _h2MarginBottom = newValue;
551
+ }
552
+
553
+ - (CGFloat)h2LineHeight
554
+ {
555
+ return _h2LineHeight;
556
+ }
557
+
558
+ - (void)setH2LineHeight:(CGFloat)newValue
559
+ {
560
+ _h2LineHeight = newValue;
561
+ }
562
+
563
+ - (UIFont *)h2Font
564
+ {
565
+ if (_h2FontNeedsRecreation || !_h2Font) {
566
+ _h2Font = [RCTFont updateFont:nil
567
+ withFamily:_h2FontFamily
568
+ size:@(_h2FontSize)
569
+ weight:normalizedFontWeight(_h2FontWeight)
570
+ style:nil
571
+ variant:nil
572
+ scaleMultiplier:1];
573
+ _h2FontNeedsRecreation = NO;
574
+ }
575
+ return _h2Font;
576
+ }
577
+
578
+ - (CGFloat)h3FontSize
579
+ {
580
+ return _h3FontSize;
581
+ }
582
+
583
+ - (void)setH3FontSize:(CGFloat)newValue
584
+ {
585
+ _h3FontSize = newValue;
586
+ _h3FontNeedsRecreation = YES;
587
+ }
588
+
589
+ - (NSString *)h3FontFamily
590
+ {
591
+ return _h3FontFamily;
592
+ }
593
+
594
+ - (void)setH3FontFamily:(NSString *)newValue
595
+ {
596
+ _h3FontFamily = newValue;
597
+ _h3FontNeedsRecreation = YES;
598
+ }
599
+
600
+ - (NSString *)h3FontWeight
601
+ {
602
+ return _h3FontWeight;
603
+ }
604
+
605
+ - (void)setH3FontWeight:(NSString *)newValue
606
+ {
607
+ _h3FontWeight = newValue;
608
+ _h3FontNeedsRecreation = YES;
609
+ }
610
+
611
+ - (UIColor *)h3Color
612
+ {
613
+ return _h3Color;
614
+ }
615
+
616
+ - (void)setH3Color:(UIColor *)newValue
617
+ {
618
+ _h3Color = newValue;
619
+ }
620
+
621
+ - (CGFloat)h3MarginBottom
622
+ {
623
+ return _h3MarginBottom;
624
+ }
625
+
626
+ - (void)setH3MarginBottom:(CGFloat)newValue
627
+ {
628
+ _h3MarginBottom = newValue;
629
+ }
630
+
631
+ - (CGFloat)h3LineHeight
632
+ {
633
+ return _h3LineHeight;
634
+ }
635
+
636
+ - (void)setH3LineHeight:(CGFloat)newValue
637
+ {
638
+ _h3LineHeight = newValue;
639
+ }
640
+
641
+ - (UIFont *)h3Font
642
+ {
643
+ if (_h3FontNeedsRecreation || !_h3Font) {
644
+ _h3Font = [RCTFont updateFont:nil
645
+ withFamily:_h3FontFamily
646
+ size:@(_h3FontSize)
647
+ weight:normalizedFontWeight(_h3FontWeight)
648
+ style:nil
649
+ variant:nil
650
+ scaleMultiplier:1];
651
+ _h3FontNeedsRecreation = NO;
652
+ }
653
+ return _h3Font;
654
+ }
655
+
656
+ - (CGFloat)h4FontSize
657
+ {
658
+ return _h4FontSize;
659
+ }
660
+
661
+ - (void)setH4FontSize:(CGFloat)newValue
662
+ {
663
+ _h4FontSize = newValue;
664
+ _h4FontNeedsRecreation = YES;
665
+ }
666
+
667
+ - (NSString *)h4FontFamily
668
+ {
669
+ return _h4FontFamily;
670
+ }
671
+
672
+ - (void)setH4FontFamily:(NSString *)newValue
673
+ {
674
+ _h4FontFamily = newValue;
675
+ _h4FontNeedsRecreation = YES;
676
+ }
677
+
678
+ - (NSString *)h4FontWeight
679
+ {
680
+ return _h4FontWeight;
681
+ }
682
+
683
+ - (void)setH4FontWeight:(NSString *)newValue
684
+ {
685
+ _h4FontWeight = newValue;
686
+ _h4FontNeedsRecreation = YES;
687
+ }
688
+
689
+ - (UIColor *)h4Color
690
+ {
691
+ return _h4Color;
692
+ }
693
+
694
+ - (void)setH4Color:(UIColor *)newValue
695
+ {
696
+ _h4Color = newValue;
697
+ }
698
+
699
+ - (CGFloat)h4MarginBottom
700
+ {
701
+ return _h4MarginBottom;
702
+ }
703
+
704
+ - (void)setH4MarginBottom:(CGFloat)newValue
705
+ {
706
+ _h4MarginBottom = newValue;
707
+ }
708
+
709
+ - (CGFloat)h4LineHeight
710
+ {
711
+ return _h4LineHeight;
712
+ }
713
+
714
+ - (void)setH4LineHeight:(CGFloat)newValue
715
+ {
716
+ _h4LineHeight = newValue;
717
+ }
718
+
719
+ - (UIFont *)h4Font
720
+ {
721
+ if (_h4FontNeedsRecreation || !_h4Font) {
722
+ _h4Font = [RCTFont updateFont:nil
723
+ withFamily:_h4FontFamily
724
+ size:@(_h4FontSize)
725
+ weight:normalizedFontWeight(_h4FontWeight)
726
+ style:nil
727
+ variant:nil
728
+ scaleMultiplier:1];
729
+ _h4FontNeedsRecreation = NO;
730
+ }
731
+ return _h4Font;
732
+ }
733
+
734
+ - (CGFloat)h5FontSize
735
+ {
736
+ return _h5FontSize;
737
+ }
738
+
739
+ - (void)setH5FontSize:(CGFloat)newValue
740
+ {
741
+ _h5FontSize = newValue;
742
+ _h5FontNeedsRecreation = YES;
743
+ }
744
+
745
+ - (NSString *)h5FontFamily
746
+ {
747
+ return _h5FontFamily;
748
+ }
749
+
750
+ - (void)setH5FontFamily:(NSString *)newValue
751
+ {
752
+ _h5FontFamily = newValue;
753
+ _h5FontNeedsRecreation = YES;
754
+ }
755
+
756
+ - (NSString *)h5FontWeight
757
+ {
758
+ return _h5FontWeight;
759
+ }
760
+
761
+ - (void)setH5FontWeight:(NSString *)newValue
762
+ {
763
+ _h5FontWeight = newValue;
764
+ _h5FontNeedsRecreation = YES;
765
+ }
766
+
767
+ - (UIColor *)h5Color
768
+ {
769
+ return _h5Color;
770
+ }
771
+
772
+ - (void)setH5Color:(UIColor *)newValue
773
+ {
774
+ _h5Color = newValue;
775
+ }
776
+
777
+ - (CGFloat)h5MarginBottom
778
+ {
779
+ return _h5MarginBottom;
780
+ }
781
+
782
+ - (void)setH5MarginBottom:(CGFloat)newValue
783
+ {
784
+ _h5MarginBottom = newValue;
785
+ }
786
+
787
+ - (CGFloat)h5LineHeight
788
+ {
789
+ return _h5LineHeight;
790
+ }
791
+
792
+ - (void)setH5LineHeight:(CGFloat)newValue
793
+ {
794
+ _h5LineHeight = newValue;
795
+ }
796
+
797
+ - (UIFont *)h5Font
798
+ {
799
+ if (_h5FontNeedsRecreation || !_h5Font) {
800
+ _h5Font = [RCTFont updateFont:nil
801
+ withFamily:_h5FontFamily
802
+ size:@(_h5FontSize)
803
+ weight:normalizedFontWeight(_h5FontWeight)
804
+ style:nil
805
+ variant:nil
806
+ scaleMultiplier:1];
807
+ _h5FontNeedsRecreation = NO;
808
+ }
809
+ return _h5Font;
810
+ }
811
+
812
+ - (CGFloat)h6FontSize
813
+ {
814
+ return _h6FontSize;
815
+ }
816
+
817
+ - (void)setH6FontSize:(CGFloat)newValue
818
+ {
819
+ _h6FontSize = newValue;
820
+ _h6FontNeedsRecreation = YES;
821
+ }
822
+
823
+ - (NSString *)h6FontFamily
824
+ {
825
+ return _h6FontFamily;
826
+ }
827
+
828
+ - (void)setH6FontFamily:(NSString *)newValue
829
+ {
830
+ _h6FontFamily = newValue;
831
+ _h6FontNeedsRecreation = YES;
832
+ }
833
+
834
+ - (NSString *)h6FontWeight
835
+ {
836
+ return _h6FontWeight;
837
+ }
838
+
839
+ - (void)setH6FontWeight:(NSString *)newValue
840
+ {
841
+ _h6FontWeight = newValue;
842
+ _h6FontNeedsRecreation = YES;
843
+ }
844
+
845
+ - (UIColor *)h6Color
846
+ {
847
+ return _h6Color;
848
+ }
849
+
850
+ - (void)setH6Color:(UIColor *)newValue
851
+ {
852
+ _h6Color = newValue;
853
+ }
854
+
855
+ - (CGFloat)h6MarginBottom
856
+ {
857
+ return _h6MarginBottom;
858
+ }
859
+
860
+ - (void)setH6MarginBottom:(CGFloat)newValue
861
+ {
862
+ _h6MarginBottom = newValue;
863
+ }
864
+
865
+ - (CGFloat)h6LineHeight
866
+ {
867
+ return _h6LineHeight;
868
+ }
869
+
870
+ - (void)setH6LineHeight:(CGFloat)newValue
871
+ {
872
+ _h6LineHeight = newValue;
873
+ }
874
+
875
+ - (UIFont *)h6Font
876
+ {
877
+ if (_h6FontNeedsRecreation || !_h6Font) {
878
+ _h6Font = [RCTFont updateFont:nil
879
+ withFamily:_h6FontFamily
880
+ size:@(_h6FontSize)
881
+ weight:normalizedFontWeight(_h6FontWeight)
882
+ style:nil
883
+ variant:nil
884
+ scaleMultiplier:1];
885
+ _h6FontNeedsRecreation = NO;
886
+ }
887
+ return _h6Font;
888
+ }
889
+
890
+ - (UIColor *)linkColor
891
+ {
892
+ return _linkColor;
893
+ }
894
+
895
+ - (void)setLinkColor:(UIColor *)newValue
896
+ {
897
+ _linkColor = newValue;
898
+ }
899
+
900
+ - (BOOL)linkUnderline
901
+ {
902
+ return _linkUnderline;
903
+ }
904
+
905
+ - (void)setLinkUnderline:(BOOL)newValue
906
+ {
907
+ _linkUnderline = newValue;
908
+ }
909
+
910
+ - (UIColor *)strongColor
911
+ {
912
+ return _strongColor;
913
+ }
914
+
915
+ - (void)setStrongColor:(UIColor *)newValue
916
+ {
917
+ _strongColor = newValue;
918
+ }
919
+
920
+ - (UIColor *)emphasisColor
921
+ {
922
+ return _emphasisColor;
923
+ }
924
+
925
+ - (void)setEmphasisColor:(UIColor *)newValue
926
+ {
927
+ _emphasisColor = newValue;
928
+ }
929
+
930
+ - (UIColor *)codeColor
931
+ {
932
+ return _codeColor;
933
+ }
934
+
935
+ - (void)setCodeColor:(UIColor *)newValue
936
+ {
937
+ _codeColor = newValue;
938
+ }
939
+
940
+ - (UIColor *)codeBackgroundColor
941
+ {
942
+ return _codeBackgroundColor;
943
+ }
944
+
945
+ - (void)setCodeBackgroundColor:(UIColor *)newValue
946
+ {
947
+ _codeBackgroundColor = newValue;
948
+ }
949
+
950
+ - (UIColor *)codeBorderColor
951
+ {
952
+ return _codeBorderColor;
953
+ }
954
+
955
+ - (void)setCodeBorderColor:(UIColor *)newValue
956
+ {
957
+ _codeBorderColor = newValue;
958
+ }
959
+
960
+ - (CGFloat)imageHeight
961
+ {
962
+ return _imageHeight;
963
+ }
964
+
965
+ - (void)setImageHeight:(CGFloat)newValue
966
+ {
967
+ _imageHeight = newValue;
968
+ }
969
+
970
+ - (CGFloat)imageBorderRadius
971
+ {
972
+ return _imageBorderRadius;
973
+ }
974
+
975
+ - (void)setImageBorderRadius:(CGFloat)newValue
976
+ {
977
+ _imageBorderRadius = newValue;
978
+ }
979
+
980
+ - (CGFloat)imageMarginBottom
981
+ {
982
+ return _imageMarginBottom;
983
+ }
984
+
985
+ - (void)setImageMarginBottom:(CGFloat)newValue
986
+ {
987
+ _imageMarginBottom = newValue;
988
+ }
989
+
990
+ - (CGFloat)inlineImageSize
991
+ {
992
+ return _inlineImageSize;
993
+ }
994
+
995
+ - (void)setInlineImageSize:(CGFloat)newValue
996
+ {
997
+ _inlineImageSize = newValue;
998
+ }
999
+
1000
+ // Blockquote properties
1001
+ - (CGFloat)blockquoteFontSize
1002
+ {
1003
+ return _blockquoteFontSize;
1004
+ }
1005
+
1006
+ - (void)setBlockquoteFontSize:(CGFloat)newValue
1007
+ {
1008
+ _blockquoteFontSize = newValue;
1009
+ _blockquoteFontNeedsRecreation = YES;
1010
+ }
1011
+
1012
+ - (NSString *)blockquoteFontFamily
1013
+ {
1014
+ return _blockquoteFontFamily;
1015
+ }
1016
+
1017
+ - (void)setBlockquoteFontFamily:(NSString *)newValue
1018
+ {
1019
+ _blockquoteFontFamily = newValue;
1020
+ _blockquoteFontNeedsRecreation = YES;
1021
+ }
1022
+
1023
+ - (NSString *)blockquoteFontWeight
1024
+ {
1025
+ return _blockquoteFontWeight;
1026
+ }
1027
+
1028
+ - (void)setBlockquoteFontWeight:(NSString *)newValue
1029
+ {
1030
+ _blockquoteFontWeight = newValue;
1031
+ _blockquoteFontNeedsRecreation = YES;
1032
+ }
1033
+
1034
+ - (UIColor *)blockquoteColor
1035
+ {
1036
+ return _blockquoteColor;
1037
+ }
1038
+
1039
+ - (void)setBlockquoteColor:(UIColor *)newValue
1040
+ {
1041
+ _blockquoteColor = newValue;
1042
+ }
1043
+
1044
+ - (CGFloat)blockquoteMarginBottom
1045
+ {
1046
+ return _blockquoteMarginBottom;
1047
+ }
1048
+
1049
+ - (void)setBlockquoteMarginBottom:(CGFloat)newValue
1050
+ {
1051
+ _blockquoteMarginBottom = newValue;
1052
+ }
1053
+
1054
+ - (CGFloat)blockquoteLineHeight
1055
+ {
1056
+ return _blockquoteLineHeight;
1057
+ }
1058
+
1059
+ - (void)setBlockquoteLineHeight:(CGFloat)newValue
1060
+ {
1061
+ _blockquoteLineHeight = newValue;
1062
+ }
1063
+
1064
+ - (UIFont *)blockquoteFont
1065
+ {
1066
+ if (_blockquoteFontNeedsRecreation || !_blockquoteFont) {
1067
+ _blockquoteFont = [RCTFont updateFont:nil
1068
+ withFamily:_blockquoteFontFamily
1069
+ size:@(_blockquoteFontSize)
1070
+ weight:normalizedFontWeight(_blockquoteFontWeight)
1071
+ style:nil
1072
+ variant:nil
1073
+ scaleMultiplier:1];
1074
+ _blockquoteFontNeedsRecreation = NO;
1075
+ }
1076
+ return _blockquoteFont;
1077
+ }
1078
+
1079
+ - (UIColor *)blockquoteBorderColor
1080
+ {
1081
+ return _blockquoteBorderColor;
1082
+ }
1083
+
1084
+ - (void)setBlockquoteBorderColor:(UIColor *)newValue
1085
+ {
1086
+ _blockquoteBorderColor = newValue;
1087
+ }
1088
+
1089
+ - (CGFloat)blockquoteBorderWidth
1090
+ {
1091
+ return _blockquoteBorderWidth;
1092
+ }
1093
+
1094
+ - (void)setBlockquoteBorderWidth:(CGFloat)newValue
1095
+ {
1096
+ _blockquoteBorderWidth = newValue;
1097
+ }
1098
+
1099
+ - (CGFloat)blockquoteGapWidth
1100
+ {
1101
+ return _blockquoteGapWidth;
1102
+ }
1103
+
1104
+ - (void)setBlockquoteGapWidth:(CGFloat)newValue
1105
+ {
1106
+ _blockquoteGapWidth = newValue;
1107
+ }
1108
+
1109
+ - (UIColor *)blockquoteBackgroundColor
1110
+ {
1111
+ return _blockquoteBackgroundColor;
1112
+ }
1113
+
1114
+ - (void)setBlockquoteBackgroundColor:(UIColor *)newValue
1115
+ {
1116
+ _blockquoteBackgroundColor = newValue;
1117
+ }
1118
+
1119
+ // List style properties (combined for both ordered and unordered lists)
1120
+ - (CGFloat)listStyleFontSize
1121
+ {
1122
+ return _listStyleFontSize;
1123
+ }
1124
+
1125
+ - (void)setListStyleFontSize:(CGFloat)newValue
1126
+ {
1127
+ _listStyleFontSize = newValue;
1128
+ _listMarkerFontNeedsRecreation = YES;
1129
+ _listStyleFontNeedsRecreation = YES;
1130
+ }
1131
+
1132
+ - (NSString *)listStyleFontFamily
1133
+ {
1134
+ return _listStyleFontFamily;
1135
+ }
1136
+
1137
+ - (void)setListStyleFontFamily:(NSString *)newValue
1138
+ {
1139
+ _listStyleFontFamily = newValue;
1140
+ _listMarkerFontNeedsRecreation = YES;
1141
+ _listStyleFontNeedsRecreation = YES;
1142
+ }
1143
+
1144
+ - (NSString *)listStyleFontWeight
1145
+ {
1146
+ return _listStyleFontWeight;
1147
+ }
1148
+
1149
+ - (void)setListStyleFontWeight:(NSString *)newValue
1150
+ {
1151
+ _listStyleFontWeight = newValue;
1152
+ _listStyleFontNeedsRecreation = YES;
1153
+ }
1154
+
1155
+ - (UIColor *)listStyleColor
1156
+ {
1157
+ return _listStyleColor;
1158
+ }
1159
+
1160
+ - (void)setListStyleColor:(UIColor *)newValue
1161
+ {
1162
+ _listStyleColor = newValue;
1163
+ }
1164
+
1165
+ - (CGFloat)listStyleMarginBottom
1166
+ {
1167
+ return _listStyleMarginBottom;
1168
+ }
1169
+
1170
+ - (void)setListStyleMarginBottom:(CGFloat)newValue
1171
+ {
1172
+ _listStyleMarginBottom = newValue;
1173
+ }
1174
+
1175
+ - (CGFloat)listStyleLineHeight
1176
+ {
1177
+ return _listStyleLineHeight;
1178
+ }
1179
+
1180
+ - (void)setListStyleLineHeight:(CGFloat)newValue
1181
+ {
1182
+ _listStyleLineHeight = newValue;
1183
+ }
1184
+
1185
+ - (UIColor *)listStyleBulletColor
1186
+ {
1187
+ return _listStyleBulletColor;
1188
+ }
1189
+
1190
+ - (void)setListStyleBulletColor:(UIColor *)newValue
1191
+ {
1192
+ _listStyleBulletColor = newValue;
1193
+ }
1194
+
1195
+ - (CGFloat)listStyleBulletSize
1196
+ {
1197
+ return _listStyleBulletSize;
1198
+ }
1199
+
1200
+ - (void)setListStyleBulletSize:(CGFloat)newValue
1201
+ {
1202
+ _listStyleBulletSize = newValue;
1203
+ }
1204
+
1205
+ - (UIColor *)listStyleMarkerColor
1206
+ {
1207
+ return _listStyleMarkerColor;
1208
+ }
1209
+
1210
+ - (void)setListStyleMarkerColor:(UIColor *)newValue
1211
+ {
1212
+ _listStyleMarkerColor = newValue;
1213
+ }
1214
+
1215
+ - (NSString *)listStyleMarkerFontWeight
1216
+ {
1217
+ return _listStyleMarkerFontWeight;
1218
+ }
1219
+
1220
+ - (void)setListStyleMarkerFontWeight:(NSString *)newValue
1221
+ {
1222
+ _listStyleMarkerFontWeight = newValue;
1223
+ _listMarkerFontNeedsRecreation = YES;
1224
+ }
1225
+
1226
+ - (CGFloat)listStyleGapWidth
1227
+ {
1228
+ return _listStyleGapWidth;
1229
+ }
1230
+
1231
+ - (void)setListStyleGapWidth:(CGFloat)newValue
1232
+ {
1233
+ _listStyleGapWidth = newValue;
1234
+ }
1235
+
1236
+ - (CGFloat)listStyleMarginLeft
1237
+ {
1238
+ return _listStyleMarginLeft;
1239
+ }
1240
+
1241
+ - (void)setListStyleMarginLeft:(CGFloat)newValue
1242
+ {
1243
+ _listStyleMarginLeft = newValue;
1244
+ }
1245
+
1246
+ - (UIFont *)listMarkerFont
1247
+ {
1248
+ if (_listMarkerFontNeedsRecreation || !_listMarkerFont) {
1249
+ _listMarkerFont = [RCTFont updateFont:nil
1250
+ withFamily:_listStyleFontFamily
1251
+ size:@(_listStyleFontSize)
1252
+ weight:normalizedFontWeight(_listStyleMarkerFontWeight)
1253
+ style:nil
1254
+ variant:nil
1255
+ scaleMultiplier:1];
1256
+ _listMarkerFontNeedsRecreation = NO;
1257
+ }
1258
+ return _listMarkerFont;
1259
+ }
1260
+
1261
+ - (UIFont *)listStyleFont
1262
+ {
1263
+ if (_listStyleFontNeedsRecreation || !_listStyleFont) {
1264
+ _listStyleFont = [RCTFont updateFont:nil
1265
+ withFamily:_listStyleFontFamily
1266
+ size:@(_listStyleFontSize)
1267
+ weight:normalizedFontWeight(_listStyleFontWeight)
1268
+ style:nil
1269
+ variant:nil
1270
+ scaleMultiplier:1];
1271
+ _listStyleFontNeedsRecreation = NO;
1272
+ }
1273
+ return _listStyleFont;
1274
+ }
1275
+
1276
+ static const CGFloat kDefaultMinGap = 4.0;
1277
+
1278
+ - (CGFloat)effectiveListGapWidth
1279
+ {
1280
+ return MAX(_listStyleGapWidth, kDefaultMinGap);
1281
+ }
1282
+
1283
+ - (CGFloat)effectiveListMarginLeftForBullet
1284
+ {
1285
+ // Just the minimum width needed for bullet (radius)
1286
+ return _listStyleBulletSize / 2.0;
1287
+ }
1288
+
1289
+ - (CGFloat)effectiveListMarginLeftForNumber
1290
+ {
1291
+ // Reserve width for numbers up to 99 (matching Android)
1292
+ UIFont *font = [self listMarkerFont];
1293
+ return
1294
+ [@"99." sizeWithAttributes:@{NSFontAttributeName : font ?: [UIFont systemFontOfSize:_listStyleFontSize]}].width;
1295
+ }
1296
+
1297
+ // Code block properties
1298
+ - (CGFloat)codeBlockFontSize
1299
+ {
1300
+ return _codeBlockFontSize;
1301
+ }
1302
+
1303
+ - (void)setCodeBlockFontSize:(CGFloat)newValue
1304
+ {
1305
+ _codeBlockFontSize = newValue;
1306
+ _codeBlockFontNeedsRecreation = YES;
1307
+ }
1308
+
1309
+ - (NSString *)codeBlockFontFamily
1310
+ {
1311
+ return _codeBlockFontFamily;
1312
+ }
1313
+
1314
+ - (void)setCodeBlockFontFamily:(NSString *)newValue
1315
+ {
1316
+ _codeBlockFontFamily = newValue;
1317
+ _codeBlockFontNeedsRecreation = YES;
1318
+ }
1319
+
1320
+ - (NSString *)codeBlockFontWeight
1321
+ {
1322
+ return _codeBlockFontWeight;
1323
+ }
1324
+
1325
+ - (void)setCodeBlockFontWeight:(NSString *)newValue
1326
+ {
1327
+ _codeBlockFontWeight = newValue;
1328
+ _codeBlockFontNeedsRecreation = YES;
1329
+ }
1330
+
1331
+ - (UIColor *)codeBlockColor
1332
+ {
1333
+ return _codeBlockColor;
1334
+ }
1335
+
1336
+ - (void)setCodeBlockColor:(UIColor *)newValue
1337
+ {
1338
+ _codeBlockColor = newValue;
1339
+ }
1340
+
1341
+ - (CGFloat)codeBlockMarginBottom
1342
+ {
1343
+ return _codeBlockMarginBottom;
1344
+ }
1345
+
1346
+ - (void)setCodeBlockMarginBottom:(CGFloat)newValue
1347
+ {
1348
+ _codeBlockMarginBottom = newValue;
1349
+ }
1350
+
1351
+ - (CGFloat)codeBlockLineHeight
1352
+ {
1353
+ return _codeBlockLineHeight;
1354
+ }
1355
+
1356
+ - (void)setCodeBlockLineHeight:(CGFloat)newValue
1357
+ {
1358
+ _codeBlockLineHeight = newValue;
1359
+ }
1360
+
1361
+ - (UIColor *)codeBlockBackgroundColor
1362
+ {
1363
+ return _codeBlockBackgroundColor;
1364
+ }
1365
+
1366
+ - (void)setCodeBlockBackgroundColor:(UIColor *)newValue
1367
+ {
1368
+ _codeBlockBackgroundColor = newValue;
1369
+ }
1370
+
1371
+ - (UIColor *)codeBlockBorderColor
1372
+ {
1373
+ return _codeBlockBorderColor;
1374
+ }
1375
+
1376
+ - (void)setCodeBlockBorderColor:(UIColor *)newValue
1377
+ {
1378
+ _codeBlockBorderColor = newValue;
1379
+ }
1380
+
1381
+ - (CGFloat)codeBlockBorderRadius
1382
+ {
1383
+ return _codeBlockBorderRadius;
1384
+ }
1385
+
1386
+ - (void)setCodeBlockBorderRadius:(CGFloat)newValue
1387
+ {
1388
+ _codeBlockBorderRadius = newValue;
1389
+ }
1390
+
1391
+ - (CGFloat)codeBlockBorderWidth
1392
+ {
1393
+ return _codeBlockBorderWidth;
1394
+ }
1395
+
1396
+ - (void)setCodeBlockBorderWidth:(CGFloat)newValue
1397
+ {
1398
+ _codeBlockBorderWidth = newValue;
1399
+ }
1400
+
1401
+ - (CGFloat)codeBlockPadding
1402
+ {
1403
+ return _codeBlockPadding;
1404
+ }
1405
+
1406
+ - (void)setCodeBlockPadding:(CGFloat)newValue
1407
+ {
1408
+ _codeBlockPadding = newValue;
1409
+ }
1410
+
1411
+ - (UIFont *)codeBlockFont
1412
+ {
1413
+ if (_codeBlockFontNeedsRecreation || !_codeBlockFont) {
1414
+ _codeBlockFont = [RCTFont updateFont:nil
1415
+ withFamily:_codeBlockFontFamily
1416
+ size:@(_codeBlockFontSize)
1417
+ weight:normalizedFontWeight(_codeBlockFontWeight)
1418
+ style:nil
1419
+ variant:nil
1420
+ scaleMultiplier:1];
1421
+ _codeBlockFontNeedsRecreation = NO;
1422
+ }
1423
+ return _codeBlockFont;
1424
+ }
1425
+
1426
+ // Thematic break properties
1427
+ - (UIColor *)thematicBreakColor
1428
+ {
1429
+ return _thematicBreakColor;
1430
+ }
1431
+
1432
+ - (void)setThematicBreakColor:(UIColor *)newValue
1433
+ {
1434
+ _thematicBreakColor = newValue;
1435
+ }
1436
+
1437
+ - (CGFloat)thematicBreakHeight
1438
+ {
1439
+ return _thematicBreakHeight;
1440
+ }
1441
+
1442
+ - (void)setThematicBreakHeight:(CGFloat)newValue
1443
+ {
1444
+ _thematicBreakHeight = newValue;
1445
+ }
1446
+
1447
+ - (CGFloat)thematicBreakMarginTop
1448
+ {
1449
+ return _thematicBreakMarginTop;
1450
+ }
1451
+
1452
+ - (void)setThematicBreakMarginTop:(CGFloat)newValue
1453
+ {
1454
+ _thematicBreakMarginTop = newValue;
1455
+ }
1456
+
1457
+ - (CGFloat)thematicBreakMarginBottom
1458
+ {
1459
+ return _thematicBreakMarginBottom;
1460
+ }
1461
+
1462
+ - (void)setThematicBreakMarginBottom:(CGFloat)newValue
1463
+ {
1464
+ _thematicBreakMarginBottom = newValue;
1465
+ }
1466
+
1467
+ @end