react-native-enriched-markdown 0.1.0 → 0.2.0

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