@mathers101/react-native-render-rich-text 0.0.0-stage → 0.1.10

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 (358) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +140 -3
  3. package/ReactNativeRenderRichText.podspec +23 -0
  4. package/android/build.gradle +86 -0
  5. package/android/consumer-rules.pro +3 -0
  6. package/android/src/main/AndroidManifest.xml +2 -0
  7. package/android/src/main/cpp/jni-adapter.cpp +191 -0
  8. package/android/src/main/java/com/renderrichtext/EnrichedTiptapText.kt +673 -0
  9. package/android/src/main/java/com/renderrichtext/EnrichedTiptapTextLayoutManager.kt +24 -0
  10. package/android/src/main/java/com/renderrichtext/EnrichedTiptapTextManager.kt +405 -0
  11. package/android/src/main/java/com/renderrichtext/EnrichedTiptapTextPackage.kt +13 -0
  12. package/android/src/main/java/com/renderrichtext/MeasurementStore.kt +644 -0
  13. package/android/src/main/java/com/renderrichtext/accessibility/AccessibilityLabels.kt +17 -0
  14. package/android/src/main/java/com/renderrichtext/accessibility/AccessibleTiptapTextView.kt +112 -0
  15. package/android/src/main/java/com/renderrichtext/accessibility/TiptapAccessibilityHelper.kt +576 -0
  16. package/android/src/main/java/com/renderrichtext/events/CodeBlockPressEvent.kt +24 -0
  17. package/android/src/main/java/com/renderrichtext/events/ContextMenuItemPressEvent.kt +28 -0
  18. package/android/src/main/java/com/renderrichtext/events/CopyPressEvent.kt +24 -0
  19. package/android/src/main/java/com/renderrichtext/events/FactoidPressEvent.kt +23 -0
  20. package/android/src/main/java/com/renderrichtext/events/ImagePressEvent.kt +25 -0
  21. package/android/src/main/java/com/renderrichtext/events/LatexErrorEvent.kt +29 -0
  22. package/android/src/main/java/com/renderrichtext/events/LinkLongPressEvent.kt +23 -0
  23. package/android/src/main/java/com/renderrichtext/events/LinkPressEvent.kt +23 -0
  24. package/android/src/main/java/com/renderrichtext/events/MentionLongPressEvent.kt +25 -0
  25. package/android/src/main/java/com/renderrichtext/events/MentionPressEvent.kt +25 -0
  26. package/android/src/main/java/com/renderrichtext/events/TaskListItemPressEvent.kt +26 -0
  27. package/android/src/main/java/com/renderrichtext/math/LatexErrorReporter.kt +9 -0
  28. package/android/src/main/java/com/renderrichtext/parser/Parser.kt +59 -0
  29. package/android/src/main/java/com/renderrichtext/parser/TextLinkMatching.kt +35 -0
  30. package/android/src/main/java/com/renderrichtext/parser/TiptapASTNode.kt +69 -0
  31. package/android/src/main/java/com/renderrichtext/renderer/BaselineShiftRenderer.kt +45 -0
  32. package/android/src/main/java/com/renderrichtext/renderer/BlankLineRenderer.kt +39 -0
  33. package/android/src/main/java/com/renderrichtext/renderer/BlockStyleContext.kt +181 -0
  34. package/android/src/main/java/com/renderrichtext/renderer/BlockquoteRenderer.kt +243 -0
  35. package/android/src/main/java/com/renderrichtext/renderer/BlockquoteTextRenderer.kt +56 -0
  36. package/android/src/main/java/com/renderrichtext/renderer/CodeBlockRenderer.kt +135 -0
  37. package/android/src/main/java/com/renderrichtext/renderer/CodeRenderer.kt +37 -0
  38. package/android/src/main/java/com/renderrichtext/renderer/EmphasisRenderer.kt +28 -0
  39. package/android/src/main/java/com/renderrichtext/renderer/FactoidRenderer.kt +97 -0
  40. package/android/src/main/java/com/renderrichtext/renderer/HeadingRenderer.kt +81 -0
  41. package/android/src/main/java/com/renderrichtext/renderer/HighlightRenderer.kt +26 -0
  42. package/android/src/main/java/com/renderrichtext/renderer/LineBreakRenderer.kt +17 -0
  43. package/android/src/main/java/com/renderrichtext/renderer/LinkRenderer.kt +90 -0
  44. package/android/src/main/java/com/renderrichtext/renderer/ListContextManager.kt +109 -0
  45. package/android/src/main/java/com/renderrichtext/renderer/ListItemRenderer.kt +211 -0
  46. package/android/src/main/java/com/renderrichtext/renderer/ListRenderer.kt +133 -0
  47. package/android/src/main/java/com/renderrichtext/renderer/MentionRenderer.kt +85 -0
  48. package/android/src/main/java/com/renderrichtext/renderer/NodeRenderer.kt +207 -0
  49. package/android/src/main/java/com/renderrichtext/renderer/ParagraphRenderer.kt +91 -0
  50. package/android/src/main/java/com/renderrichtext/renderer/Renderer.kt +148 -0
  51. package/android/src/main/java/com/renderrichtext/renderer/SoftBreakRenderer.kt +17 -0
  52. package/android/src/main/java/com/renderrichtext/renderer/SpanStyleCache.kt +143 -0
  53. package/android/src/main/java/com/renderrichtext/renderer/StrikethroughRenderer.kt +28 -0
  54. package/android/src/main/java/com/renderrichtext/renderer/StrongRenderer.kt +28 -0
  55. package/android/src/main/java/com/renderrichtext/renderer/TextRenderer.kt +31 -0
  56. package/android/src/main/java/com/renderrichtext/renderer/ThematicBreakRenderer.kt +46 -0
  57. package/android/src/main/java/com/renderrichtext/renderer/UnderlineRenderer.kt +28 -0
  58. package/android/src/main/java/com/renderrichtext/spans/BaseListSpan.kt +164 -0
  59. package/android/src/main/java/com/renderrichtext/spans/BaselineShiftSpan.kt +27 -0
  60. package/android/src/main/java/com/renderrichtext/spans/BlockquoteSpan.kt +302 -0
  61. package/android/src/main/java/com/renderrichtext/spans/CodeBackgroundSpan.kt +205 -0
  62. package/android/src/main/java/com/renderrichtext/spans/CodeBlockSpan.kt +216 -0
  63. package/android/src/main/java/com/renderrichtext/spans/CodeSpan.kt +32 -0
  64. package/android/src/main/java/com/renderrichtext/spans/EmphasisSpan.kt +42 -0
  65. package/android/src/main/java/com/renderrichtext/spans/FactoidBackgroundSpan.kt +265 -0
  66. package/android/src/main/java/com/renderrichtext/spans/FactoidPaddingSpan.kt +258 -0
  67. package/android/src/main/java/com/renderrichtext/spans/FactoidSpan.kt +32 -0
  68. package/android/src/main/java/com/renderrichtext/spans/FadeInSpan.kt +29 -0
  69. package/android/src/main/java/com/renderrichtext/spans/HeadingSpan.kt +38 -0
  70. package/android/src/main/java/com/renderrichtext/spans/HighlightSpan.kt +80 -0
  71. package/android/src/main/java/com/renderrichtext/spans/ImageSpan.kt +481 -0
  72. package/android/src/main/java/com/renderrichtext/spans/InlineBackgroundGeometry.kt +42 -0
  73. package/android/src/main/java/com/renderrichtext/spans/LineHeightSpan.kt +39 -0
  74. package/android/src/main/java/com/renderrichtext/spans/LinkPillIconCache.kt +154 -0
  75. package/android/src/main/java/com/renderrichtext/spans/LinkPillSpan.kt +381 -0
  76. package/android/src/main/java/com/renderrichtext/spans/LinkSpan.kt +68 -0
  77. package/android/src/main/java/com/renderrichtext/spans/ListItemSpacingSpan.kt +33 -0
  78. package/android/src/main/java/com/renderrichtext/spans/ListMarkerAnchorSpan.kt +38 -0
  79. package/android/src/main/java/com/renderrichtext/spans/MarginBottomSpan.kt +76 -0
  80. package/android/src/main/java/com/renderrichtext/spans/MentionChipSpan.kt +132 -0
  81. package/android/src/main/java/com/renderrichtext/spans/MentionSpan.kt +46 -0
  82. package/android/src/main/java/com/renderrichtext/spans/OrderedListSpan.kt +127 -0
  83. package/android/src/main/java/com/renderrichtext/spans/SpoilerSpan.kt +33 -0
  84. package/android/src/main/java/com/renderrichtext/spans/StrikethroughSpan.kt +12 -0
  85. package/android/src/main/java/com/renderrichtext/spans/StrongSpan.kt +39 -0
  86. package/android/src/main/java/com/renderrichtext/spans/TaskListSpan.kt +143 -0
  87. package/android/src/main/java/com/renderrichtext/spans/TextSpan.kt +26 -0
  88. package/android/src/main/java/com/renderrichtext/spans/ThematicBreakSpan.kt +69 -0
  89. package/android/src/main/java/com/renderrichtext/spans/UnorderedListSpan.kt +96 -0
  90. package/android/src/main/java/com/renderrichtext/spoiler/SpoilerStubs.kt +46 -0
  91. package/android/src/main/java/com/renderrichtext/styles/BaseBlockStyle.kt +11 -0
  92. package/android/src/main/java/com/renderrichtext/styles/BlockquoteStyle.kt +83 -0
  93. package/android/src/main/java/com/renderrichtext/styles/CodeBlockStyle.kt +80 -0
  94. package/android/src/main/java/com/renderrichtext/styles/CodeStyle.kt +26 -0
  95. package/android/src/main/java/com/renderrichtext/styles/EmphasisStyle.kt +21 -0
  96. package/android/src/main/java/com/renderrichtext/styles/FactoidStyle.kt +21 -0
  97. package/android/src/main/java/com/renderrichtext/styles/HeadingStyle.kt +33 -0
  98. package/android/src/main/java/com/renderrichtext/styles/HighlightStyle.kt +19 -0
  99. package/android/src/main/java/com/renderrichtext/styles/ImageStyle.kt +29 -0
  100. package/android/src/main/java/com/renderrichtext/styles/InlineImageStyle.kt +17 -0
  101. package/android/src/main/java/com/renderrichtext/styles/InlineMathStyle.kt +17 -0
  102. package/android/src/main/java/com/renderrichtext/styles/LinkPillContent.kt +36 -0
  103. package/android/src/main/java/com/renderrichtext/styles/LinkPillStyle.kt +44 -0
  104. package/android/src/main/java/com/renderrichtext/styles/LinkStyle.kt +23 -0
  105. package/android/src/main/java/com/renderrichtext/styles/LinkVariantEntry.kt +34 -0
  106. package/android/src/main/java/com/renderrichtext/styles/ListStyle.kt +65 -0
  107. package/android/src/main/java/com/renderrichtext/styles/MathStyle.kt +29 -0
  108. package/android/src/main/java/com/renderrichtext/styles/MentionStyle.kt +19 -0
  109. package/android/src/main/java/com/renderrichtext/styles/ParagraphStyle.kt +33 -0
  110. package/android/src/main/java/com/renderrichtext/styles/SpoilerStyle.kt +27 -0
  111. package/android/src/main/java/com/renderrichtext/styles/StrikethroughStyle.kt +17 -0
  112. package/android/src/main/java/com/renderrichtext/styles/StrongStyle.kt +21 -0
  113. package/android/src/main/java/com/renderrichtext/styles/StyleConfig.kt +411 -0
  114. package/android/src/main/java/com/renderrichtext/styles/StyleParser.kt +92 -0
  115. package/android/src/main/java/com/renderrichtext/styles/SubscriptStyle.kt +16 -0
  116. package/android/src/main/java/com/renderrichtext/styles/SuperscriptStyle.kt +16 -0
  117. package/android/src/main/java/com/renderrichtext/styles/TableStyle.kt +75 -0
  118. package/android/src/main/java/com/renderrichtext/styles/TaskListStyle.kt +29 -0
  119. package/android/src/main/java/com/renderrichtext/styles/TextAlignment.kt +32 -0
  120. package/android/src/main/java/com/renderrichtext/styles/ThematicBreakStyle.kt +23 -0
  121. package/android/src/main/java/com/renderrichtext/styles/UnderlineStyle.kt +17 -0
  122. package/android/src/main/java/com/renderrichtext/styles/VideoStyle.kt +31 -0
  123. package/android/src/main/java/com/renderrichtext/utils/common/BorderStyleUtils.kt +86 -0
  124. package/android/src/main/java/com/renderrichtext/utils/common/BreakStrategyUtils.kt +32 -0
  125. package/android/src/main/java/com/renderrichtext/utils/common/CodeBlockHighlighter.kt +36 -0
  126. package/android/src/main/java/com/renderrichtext/utils/common/CodeBlockNode.kt +42 -0
  127. package/android/src/main/java/com/renderrichtext/utils/common/EllipsizeUtils.kt +27 -0
  128. package/android/src/main/java/com/renderrichtext/utils/common/EnrichedTiptapAncestorUtils.kt +10 -0
  129. package/android/src/main/java/com/renderrichtext/utils/common/FeatureFlags.kt +9 -0
  130. package/android/src/main/java/com/renderrichtext/utils/common/LinkRecognitionProps.kt +31 -0
  131. package/android/src/main/java/com/renderrichtext/utils/common/LinkRegexConfig.kt +56 -0
  132. package/android/src/main/java/com/renderrichtext/utils/common/MotionPreferences.kt +18 -0
  133. package/android/src/main/java/com/renderrichtext/utils/common/ReadableMapExtensions.kt +28 -0
  134. package/android/src/main/java/com/renderrichtext/utils/common/TiptapViewManagerUtils.kt +242 -0
  135. package/android/src/main/java/com/renderrichtext/utils/common/layout/RTLUtils.kt +6 -0
  136. package/android/src/main/java/com/renderrichtext/utils/common/serialization/TiptapASTSerializer.kt +368 -0
  137. package/android/src/main/java/com/renderrichtext/utils/text/ImageCache.kt +88 -0
  138. package/android/src/main/java/com/renderrichtext/utils/text/ImageDownloader.kt +203 -0
  139. package/android/src/main/java/com/renderrichtext/utils/text/LocalImageLoader.kt +167 -0
  140. package/android/src/main/java/com/renderrichtext/utils/text/TailFadeInAnimator.kt +84 -0
  141. package/android/src/main/java/com/renderrichtext/utils/text/conversion/HTMLGenerator.kt +1105 -0
  142. package/android/src/main/java/com/renderrichtext/utils/text/conversion/TiptapExtractor.kt +423 -0
  143. package/android/src/main/java/com/renderrichtext/utils/text/extensions/ParagraphUtils.kt +9 -0
  144. package/android/src/main/java/com/renderrichtext/utils/text/extensions/SpannableExtensions.kt +9 -0
  145. package/android/src/main/java/com/renderrichtext/utils/text/extensions/TextPaintExtensions.kt +76 -0
  146. package/android/src/main/java/com/renderrichtext/utils/text/interaction/CheckboxTouchHelper.kt +61 -0
  147. package/android/src/main/java/com/renderrichtext/utils/text/interaction/TaskListTapUtils.kt +286 -0
  148. package/android/src/main/java/com/renderrichtext/utils/text/span/ApplyLineHeight.kt +39 -0
  149. package/android/src/main/java/com/renderrichtext/utils/text/span/BlockSpacing.kt +142 -0
  150. package/android/src/main/java/com/renderrichtext/utils/text/span/SpanFlags.kt +43 -0
  151. package/android/src/main/java/com/renderrichtext/utils/text/span/WidthAwareSpans.kt +30 -0
  152. package/android/src/main/java/com/renderrichtext/utils/text/view/CodeBlockPressHost.kt +15 -0
  153. package/android/src/main/java/com/renderrichtext/utils/text/view/ImagePressHost.kt +19 -0
  154. package/android/src/main/java/com/renderrichtext/utils/text/view/LinkEvents.kt +88 -0
  155. package/android/src/main/java/com/renderrichtext/utils/text/view/LinkLongPressMovementMethod.kt +449 -0
  156. package/android/src/main/java/com/renderrichtext/utils/text/view/SelectionActionMode.kt +235 -0
  157. package/android/src/main/java/com/renderrichtext/utils/text/view/TextSelectionColors.kt +48 -0
  158. package/android/src/main/java/com/renderrichtext/utils/text/view/TextViewSetup.kt +119 -0
  159. package/android/src/main/java/com/renderrichtext/views/ContextMenuPopup.kt +217 -0
  160. package/android/src/main/java/com/renderrichtext/views/CopyGlyph.kt +101 -0
  161. package/android/src/main/java/com/renderrichtext/views/WrapGlyph.kt +40 -0
  162. package/android/src/main/jni/CMakeLists.txt +52 -0
  163. package/android/src/main/jni/react/renderer/components/RichTextSpec/ComponentDescriptors.h +30 -0
  164. package/android/src/main/jni/react/renderer/components/RichTextSpec/TiptapTextComponentDescriptor.h +29 -0
  165. package/android/src/main/jni/react/renderer/components/RichTextSpec/TiptapTextMeasurementManager.cpp +45 -0
  166. package/android/src/main/jni/react/renderer/components/RichTextSpec/TiptapTextMeasurementManager.h +21 -0
  167. package/android/src/main/jni/react/renderer/components/RichTextSpec/TiptapTextShadowNode.cpp +38 -0
  168. package/android/src/main/jni/react/renderer/components/RichTextSpec/TiptapTextShadowNode.h +53 -0
  169. package/android/src/main/jni/react/renderer/components/RichTextSpec/TiptapTextState.cpp +9 -0
  170. package/android/src/main/jni/react/renderer/components/RichTextSpec/TiptapTextState.h +24 -0
  171. package/android/src/main/jni/react/renderer/components/RichTextSpec/conversions.h +40 -0
  172. package/cpp/parser/TiptapASTNode.hpp +68 -0
  173. package/cpp/parser/TiptapParser.cpp +233 -0
  174. package/cpp/parser/TiptapParser.hpp +13 -0
  175. package/cpp/vendor/nlohmann/json.hpp +24765 -0
  176. package/ios/EnrichedTiptapText.h +27 -0
  177. package/ios/EnrichedTiptapText.mm +1222 -0
  178. package/ios/attachments/ENRMImageAttachment.h +51 -0
  179. package/ios/attachments/ENRMImageAttachment.m +398 -0
  180. package/ios/attachments/ENRMLinkPillAttachment.h +47 -0
  181. package/ios/attachments/ENRMLinkPillAttachment.m +324 -0
  182. package/ios/attachments/ENRMLinkPillIconCache.h +28 -0
  183. package/ios/attachments/ENRMLinkPillIconCache.m +181 -0
  184. package/ios/attachments/ENRMLinkPillText.h +27 -0
  185. package/ios/attachments/ENRMLinkPillText.m +118 -0
  186. package/ios/attachments/ENRMMathInlineAttachment.h +7 -0
  187. package/ios/attachments/ENRMMathInlineAttachment.m +4 -0
  188. package/ios/attachments/ThematicBreakAttachment.h +15 -0
  189. package/ios/attachments/ThematicBreakAttachment.m +33 -0
  190. package/ios/internals/ENRMViewFreeMeasurement.h +208 -0
  191. package/ios/internals/EnrichedTiptapTextComponentDescriptor.h +19 -0
  192. package/ios/internals/EnrichedTiptapTextShadowNode.h +43 -0
  193. package/ios/internals/EnrichedTiptapTextShadowNode.mm +69 -0
  194. package/ios/internals/EnrichedTiptapTextState.h +24 -0
  195. package/ios/internals/MeasurementCache.h +308 -0
  196. package/ios/internals/ShadowMeasurementUtils.h +145 -0
  197. package/ios/parser/ENRMTextLinkAttributes.h +7 -0
  198. package/ios/parser/ENRMTiptapParser.h +33 -0
  199. package/ios/parser/ENRMTiptapParser.mm +73 -0
  200. package/ios/parser/TiptapASTNode.h +57 -0
  201. package/ios/parser/TiptapASTNode.m +52 -0
  202. package/ios/parser/TiptapParserBridge.mm +179 -0
  203. package/ios/renderer/AttributedRenderer.h +23 -0
  204. package/ios/renderer/AttributedRenderer.m +229 -0
  205. package/ios/renderer/BaseRenderer.h +33 -0
  206. package/ios/renderer/BaseRenderer.m +46 -0
  207. package/ios/renderer/BaselineShiftTextAttributes.h +10 -0
  208. package/ios/renderer/BaselineShiftTextAttributes.m +26 -0
  209. package/ios/renderer/BlankLineRenderer.h +4 -0
  210. package/ios/renderer/BlankLineRenderer.m +51 -0
  211. package/ios/renderer/BlockquoteRenderer.h +6 -0
  212. package/ios/renderer/BlockquoteRenderer.m +258 -0
  213. package/ios/renderer/CodeBlockRenderer.h +9 -0
  214. package/ios/renderer/CodeBlockRenderer.m +99 -0
  215. package/ios/renderer/CodeRenderer.h +9 -0
  216. package/ios/renderer/CodeRenderer.m +69 -0
  217. package/ios/renderer/ENRMBlockquoteTextRenderer.h +25 -0
  218. package/ios/renderer/ENRMBlockquoteTextRenderer.m +48 -0
  219. package/ios/renderer/EmphasisRenderer.h +5 -0
  220. package/ios/renderer/EmphasisRenderer.m +100 -0
  221. package/ios/renderer/FactoidRenderer.h +9 -0
  222. package/ios/renderer/FactoidRenderer.m +130 -0
  223. package/ios/renderer/HeadingRenderer.h +6 -0
  224. package/ios/renderer/HeadingRenderer.m +103 -0
  225. package/ios/renderer/HighlightRenderer.h +7 -0
  226. package/ios/renderer/HighlightRenderer.m +33 -0
  227. package/ios/renderer/LinkRenderer.h +6 -0
  228. package/ios/renderer/LinkRenderer.m +158 -0
  229. package/ios/renderer/ListItemRenderer.h +24 -0
  230. package/ios/renderer/ListItemRenderer.m +283 -0
  231. package/ios/renderer/ListRenderer.h +13 -0
  232. package/ios/renderer/ListRenderer.m +126 -0
  233. package/ios/renderer/MentionRenderer.h +9 -0
  234. package/ios/renderer/MentionRenderer.m +96 -0
  235. package/ios/renderer/NodeRenderer.h +8 -0
  236. package/ios/renderer/ParagraphRenderer.h +6 -0
  237. package/ios/renderer/ParagraphRenderer.m +85 -0
  238. package/ios/renderer/RenderContext.h +145 -0
  239. package/ios/renderer/RenderContext.m +403 -0
  240. package/ios/renderer/RendererFactory.h +12 -0
  241. package/ios/renderer/RendererFactory.m +158 -0
  242. package/ios/renderer/StrikethroughRenderer.h +5 -0
  243. package/ios/renderer/StrikethroughRenderer.m +30 -0
  244. package/ios/renderer/StrongRenderer.h +5 -0
  245. package/ios/renderer/StrongRenderer.m +88 -0
  246. package/ios/renderer/TextRenderer.h +6 -0
  247. package/ios/renderer/TextRenderer.m +18 -0
  248. package/ios/renderer/ThematicBreakRenderer.h +4 -0
  249. package/ios/renderer/ThematicBreakRenderer.m +42 -0
  250. package/ios/renderer/UnderlineRenderer.h +4 -0
  251. package/ios/renderer/UnderlineRenderer.m +41 -0
  252. package/ios/styles/ENRMFontSlot.h +12 -0
  253. package/ios/styles/ENRMFontSlot.m +24 -0
  254. package/ios/styles/StyleConfig.h +488 -0
  255. package/ios/styles/StyleConfig.mm +2820 -0
  256. package/ios/utils/AccessibilityInfo.h +35 -0
  257. package/ios/utils/AccessibilityInfo.m +24 -0
  258. package/ios/utils/BlockquoteBorder.h +26 -0
  259. package/ios/utils/BlockquoteBorder.m +294 -0
  260. package/ios/utils/CodeBackground.h +19 -0
  261. package/ios/utils/CodeBackground.m +197 -0
  262. package/ios/utils/CodeBlockBackground.h +17 -0
  263. package/ios/utils/CodeBlockBackground.m +103 -0
  264. package/ios/utils/ContextMenuUtils.h +76 -0
  265. package/ios/utils/ContextMenuUtils.mm +75 -0
  266. package/ios/utils/ENRMAccessibilityLabels.h +40 -0
  267. package/ios/utils/ENRMAccessibilityLabels.m +5 -0
  268. package/ios/utils/ENRMAsyncRenderCoordinator.h +24 -0
  269. package/ios/utils/ENRMAsyncRenderCoordinator.m +37 -0
  270. package/ios/utils/ENRMAtomicSize.h +65 -0
  271. package/ios/utils/ENRMCodeBlockContent.h +37 -0
  272. package/ios/utils/ENRMCodeBlockContent.mm +89 -0
  273. package/ios/utils/ENRMFeatureFlags.h +25 -0
  274. package/ios/utils/ENRMImageDownloader.h +30 -0
  275. package/ios/utils/ENRMImageDownloader.m +168 -0
  276. package/ios/utils/ENRMLatexErrorCoordinator.h +27 -0
  277. package/ios/utils/ENRMLatexErrorCoordinator.mm +75 -0
  278. package/ios/utils/ENRMLatexErrorReporting.h +13 -0
  279. package/ios/utils/ENRMLinkContextMenus.h +93 -0
  280. package/ios/utils/ENRMLinkContextMenus.m +178 -0
  281. package/ios/utils/ENRMLinkRegexConfig.h +30 -0
  282. package/ios/utils/ENRMLinkRegexConfig.mm +104 -0
  283. package/ios/utils/ENRMLinkRegexProps.h +23 -0
  284. package/ios/utils/ENRMLocalImageLoader.h +35 -0
  285. package/ios/utils/ENRMLocalImageLoader.m +111 -0
  286. package/ios/utils/ENRMMenuAction.h +27 -0
  287. package/ios/utils/ENRMMenuAction.m +33 -0
  288. package/ios/utils/ENRMSpoilerOverlayManager.h +15 -0
  289. package/ios/utils/ENRMSpoilerOverlayManager.m +19 -0
  290. package/ios/utils/ENRMSpoilerTapUtils.h +6 -0
  291. package/ios/utils/ENRMSpoilerTapUtils.m +11 -0
  292. package/ios/utils/ENRMTailFadeInAnimator.h +16 -0
  293. package/ios/utils/ENRMTailFadeInAnimator.m +161 -0
  294. package/ios/utils/ENRMTextHitTest.h +23 -0
  295. package/ios/utils/ENRMTextHitTest.m +20 -0
  296. package/ios/utils/ENRMTextInteractionUtils.h +20 -0
  297. package/ios/utils/ENRMTextInteractionUtils.m +15 -0
  298. package/ios/utils/ENRMTextRenderer.h +38 -0
  299. package/ios/utils/ENRMTextRenderer.m +54 -0
  300. package/ios/utils/ENRMTextViewSetup.h +132 -0
  301. package/ios/utils/ENRMUIKit.h +429 -0
  302. package/ios/utils/EditMenuUtils.h +105 -0
  303. package/ios/utils/EditMenuUtils.m +143 -0
  304. package/ios/utils/FactoidBackground.h +20 -0
  305. package/ios/utils/FactoidBackground.m +161 -0
  306. package/ios/utils/FontScaleObserver.h +10 -0
  307. package/ios/utils/FontScaleObserver.m +55 -0
  308. package/ios/utils/FontUtils.h +31 -0
  309. package/ios/utils/FontUtils.m +63 -0
  310. package/ios/utils/HTMLGenerator.h +25 -0
  311. package/ios/utils/HTMLGenerator.m +1041 -0
  312. package/ios/utils/HeightUpdateUtils.h +25 -0
  313. package/ios/utils/ImageRequestHeaderUtils.h +35 -0
  314. package/ios/utils/LastElementUtils.h +97 -0
  315. package/ios/utils/LinkContextMenuUtils.h +55 -0
  316. package/ios/utils/LinkPillContentUtils.h +46 -0
  317. package/ios/utils/LinkTapUtils.h +56 -0
  318. package/ios/utils/LinkTapUtils.m +139 -0
  319. package/ios/utils/ListMarkerDrawer.h +15 -0
  320. package/ios/utils/ListMarkerDrawer.m +239 -0
  321. package/ios/utils/MentionBackground.h +26 -0
  322. package/ios/utils/MentionBackground.m +86 -0
  323. package/ios/utils/ParagraphStyleUtils.h +87 -0
  324. package/ios/utils/ParagraphStyleUtils.m +484 -0
  325. package/ios/utils/PasteboardUtils.h +48 -0
  326. package/ios/utils/PasteboardUtils.m +166 -0
  327. package/ios/utils/RTFExportUtils.h +24 -0
  328. package/ios/utils/RTFExportUtils.m +299 -0
  329. package/ios/utils/RuntimeKeys.h +44 -0
  330. package/ios/utils/RuntimeKeys.m +13 -0
  331. package/ios/utils/SelectionColorUtils.h +14 -0
  332. package/ios/utils/StylePropsUtils.h +1340 -0
  333. package/ios/utils/TaskListTapUtils.h +6 -0
  334. package/ios/utils/TaskListTapUtils.m +14 -0
  335. package/ios/utils/TextViewLayoutManager.h +14 -0
  336. package/ios/utils/TextViewLayoutManager.mm +198 -0
  337. package/ios/utils/TiptapAccessibilityElementBuilder.h +43 -0
  338. package/ios/utils/TiptapAccessibilityElementBuilder.m +432 -0
  339. package/ios/utils/TiptapExtractor.h +17 -0
  340. package/ios/utils/TiptapExtractor.m +367 -0
  341. package/ios/views/ENRMTiptapTextView.h +25 -0
  342. package/ios/views/ENRMTiptapTextView.m +247 -0
  343. package/package.json +70 -6
  344. package/react-native.config.js +10 -0
  345. package/src/EnrichedTiptapTextNativeComponent.ts +739 -0
  346. package/src/RichText.tsx +164 -0
  347. package/src/admonitionDefaults.ts +58 -0
  348. package/src/darkModeTextStyle.ts +99 -0
  349. package/src/headingDefaults.ts +21 -0
  350. package/src/index.tsx +4 -0
  351. package/src/linkVariantUtils.ts +120 -0
  352. package/src/normalizeTiptapStyle.ts +397 -0
  353. package/src/rn-globals.d.ts +1 -0
  354. package/src/styleUtils.ts +107 -0
  355. package/src/types/TiptapStyle.ts +532 -0
  356. package/src/types/TiptapStyleInternal.ts +299 -0
  357. package/src/types/linkPill.ts +9 -0
  358. package/src/utils/isDev.ts +4 -0
@@ -0,0 +1,2820 @@
1
+ #import "StyleConfig.h"
2
+ #import "ENRMFontSlot.h"
3
+ #import "FontUtils.h"
4
+ #import <React/RCTFont.h>
5
+ #import <React/RCTUtils.h>
6
+
7
+ static const NSInteger kENRMCodeBlockSyntaxColorCount = 14;
8
+
9
+ static inline NSString *normalizedFontWeight(NSString *fontWeight)
10
+ {
11
+ // If nil or empty string, return nil to let RCTFont use fontFamily as-is
12
+ if (fontWeight == nil || fontWeight.length == 0) {
13
+ return nil;
14
+ }
15
+
16
+ return fontWeight;
17
+ }
18
+
19
+ @implementation LinkPillConfig
20
+ @end
21
+
22
+ @implementation LinkPillContent
23
+ @end
24
+
25
+ @implementation LinkVariantConfig
26
+ @end
27
+
28
+ @interface LinkVariantRegexEntry : NSObject
29
+ @property (nonatomic, strong) NSRegularExpression *regex;
30
+ @property (nonatomic, strong) LinkVariantConfig *variant;
31
+ @end
32
+
33
+ @implementation LinkVariantRegexEntry
34
+ @end
35
+
36
+ @implementation StyleConfig {
37
+ BOOL _allowFontScaling;
38
+ CGFloat _maxFontSizeMultiplier;
39
+ // Primary font properties
40
+ RCTUIColor *_primaryColor;
41
+ NSNumber *_primaryFontSize;
42
+ NSString *_primaryFontWeight;
43
+ NSString *_primaryFontFamily;
44
+ ENRMFontSlot *_primaryFont;
45
+ // Paragraph properties
46
+ CGFloat _paragraphFontSize;
47
+ NSString *_paragraphFontFamily;
48
+ NSString *_paragraphFontWeight;
49
+ RCTUIColor *_paragraphColor;
50
+ CGFloat _paragraphMarginTop;
51
+ CGFloat _paragraphMarginBottom;
52
+ CGFloat _paragraphLineHeight;
53
+ NSTextAlignment _paragraphTextAlign;
54
+ ENRMFontSlot *_paragraphFont;
55
+ // H1 properties
56
+ CGFloat _h1FontSize;
57
+ NSString *_h1FontFamily;
58
+ NSString *_h1FontWeight;
59
+ RCTUIColor *_h1Color;
60
+ CGFloat _h1MarginTop;
61
+ CGFloat _h1MarginBottom;
62
+ CGFloat _h1LineHeight;
63
+ NSTextAlignment _h1TextAlign;
64
+ ENRMFontSlot *_h1Font;
65
+ // H2 properties
66
+ CGFloat _h2FontSize;
67
+ NSString *_h2FontFamily;
68
+ NSString *_h2FontWeight;
69
+ RCTUIColor *_h2Color;
70
+ CGFloat _h2MarginTop;
71
+ CGFloat _h2MarginBottom;
72
+ CGFloat _h2LineHeight;
73
+ NSTextAlignment _h2TextAlign;
74
+ ENRMFontSlot *_h2Font;
75
+ // H3 properties
76
+ CGFloat _h3FontSize;
77
+ NSString *_h3FontFamily;
78
+ NSString *_h3FontWeight;
79
+ RCTUIColor *_h3Color;
80
+ CGFloat _h3MarginTop;
81
+ CGFloat _h3MarginBottom;
82
+ CGFloat _h3LineHeight;
83
+ NSTextAlignment _h3TextAlign;
84
+ ENRMFontSlot *_h3Font;
85
+ // H4 properties
86
+ CGFloat _h4FontSize;
87
+ NSString *_h4FontFamily;
88
+ NSString *_h4FontWeight;
89
+ RCTUIColor *_h4Color;
90
+ CGFloat _h4MarginTop;
91
+ CGFloat _h4MarginBottom;
92
+ CGFloat _h4LineHeight;
93
+ NSTextAlignment _h4TextAlign;
94
+ ENRMFontSlot *_h4Font;
95
+ // H5 properties
96
+ CGFloat _h5FontSize;
97
+ NSString *_h5FontFamily;
98
+ NSString *_h5FontWeight;
99
+ RCTUIColor *_h5Color;
100
+ CGFloat _h5MarginTop;
101
+ CGFloat _h5MarginBottom;
102
+ CGFloat _h5LineHeight;
103
+ NSTextAlignment _h5TextAlign;
104
+ ENRMFontSlot *_h5Font;
105
+ // H6 properties
106
+ CGFloat _h6FontSize;
107
+ NSString *_h6FontFamily;
108
+ NSString *_h6FontWeight;
109
+ RCTUIColor *_h6Color;
110
+ CGFloat _h6MarginTop;
111
+ CGFloat _h6MarginBottom;
112
+ CGFloat _h6LineHeight;
113
+ NSTextAlignment _h6TextAlign;
114
+ ENRMFontSlot *_h6Font;
115
+ // Link properties
116
+ NSString *_linkFontFamily;
117
+ RCTUIColor *_linkColor;
118
+ BOOL _linkUnderline;
119
+ RCTUIColor *_linkBackgroundColor;
120
+ NSArray<LinkVariantConfig *> *_linkVariants;
121
+ NSArray<LinkVariantRegexEntry *> *_compiledVariantRegexes;
122
+ // Strong properties
123
+ NSString *_strongFontFamily;
124
+ NSString *_strongFontWeight;
125
+ RCTUIColor *_strongColor;
126
+ // Emphasis properties
127
+ NSString *_emphasisFontFamily;
128
+ NSString *_emphasisFontStyle;
129
+ RCTUIColor *_emphasisColor;
130
+ // Strikethrough properties
131
+ RCTUIColor *_strikethroughColor;
132
+ // Highlight properties
133
+ RCTUIColor *_highlightColor;
134
+ RCTUIColor *_highlightBackgroundColor;
135
+ // Underline properties
136
+ RCTUIColor *_underlineColor;
137
+ // Code properties
138
+ NSString *_codeFontFamily;
139
+ CGFloat _codeFontSize;
140
+ RCTUIColor *_codeColor;
141
+ RCTUIColor *_codeBackgroundColor;
142
+ RCTUIColor *_codeBorderColor;
143
+ // Factoid properties
144
+ RCTUIColor *_factoidColor;
145
+ RCTUIColor *_factoidBackgroundColor;
146
+ RCTUIColor *_factoidBorderColor;
147
+ // Mention properties
148
+ RCTUIColor *_mentionColor;
149
+ RCTUIColor *_mentionBackgroundColor;
150
+ // Image properties
151
+ CGFloat _imageHeight;
152
+ CGFloat _imageMaxHeight;
153
+ CGFloat _imageAspectRatio;
154
+ NSString *_imageResizeMode;
155
+ CGFloat _imageBorderRadius;
156
+ CGFloat _imageMarginTop;
157
+ CGFloat _imageMarginBottom;
158
+ NSDictionary<NSString *, NSString *> *_imageRequestHeaders;
159
+ NSDictionary<NSString *, LinkPillContent *> *_linkPillContent;
160
+ // Video properties
161
+ CGFloat _videoMarginTop;
162
+ CGFloat _videoMarginBottom;
163
+ CGFloat _videoBorderRadius;
164
+ CGFloat _videoAspectRatio;
165
+ RCTUIColor *_videoBackgroundColor;
166
+ // Inline image properties
167
+ CGFloat _inlineImageSize;
168
+ // Blockquote properties
169
+ CGFloat _blockquoteFontSize;
170
+ NSString *_blockquoteFontFamily;
171
+ NSString *_blockquoteFontWeight;
172
+ RCTUIColor *_blockquoteColor;
173
+ CGFloat _blockquoteMarginTop;
174
+ CGFloat _blockquoteMarginBottom;
175
+ CGFloat _blockquoteLineHeight;
176
+ RCTUIColor *_blockquoteBorderColor;
177
+ CGFloat _blockquoteBorderWidth;
178
+ CGFloat _blockquoteGapWidth;
179
+ RCTUIColor *_blockquoteBackgroundColor;
180
+ CGFloat _blockquoteBorderRadius;
181
+ CGFloat _blockquotePadding;
182
+ // Per-admonition-type colors keyed by type ("note"/"tip"/…). Empty until set.
183
+ NSDictionary<NSString *, RCTUIColor *> *_admonitionColors;
184
+ NSDictionary<NSString *, RCTUIColor *> *_admonitionBackgroundColors;
185
+ ENRMFontSlot *_blockquoteFont;
186
+ // List style properties (combined for both ordered and unordered lists)
187
+ CGFloat _listStyleFontSize;
188
+ NSString *_listStyleFontFamily;
189
+ NSString *_listStyleFontWeight;
190
+ RCTUIColor *_listStyleColor;
191
+ CGFloat _listStyleMarginTop;
192
+ CGFloat _listStyleMarginBottom;
193
+ CGFloat _listStyleLineHeight;
194
+ RCTUIColor *_listStyleBulletColor;
195
+ CGFloat _listStyleBulletSize;
196
+ CGFloat _listStyleMarkerMinWidth;
197
+ RCTUIColor *_listStyleMarkerColor;
198
+ NSString *_listStyleMarkerFontWeight;
199
+ CGFloat _listStyleGapWidth;
200
+ CGFloat _listStyleMarginLeft;
201
+ CGFloat _listStyleItemSpacing;
202
+ ENRMFontSlot *_listMarkerFont;
203
+ ENRMFontSlot *_listStyleFont;
204
+ // Code block properties
205
+ CGFloat _codeBlockFontSize;
206
+ NSString *_codeBlockFontFamily;
207
+ NSString *_codeBlockFontWeight;
208
+ RCTUIColor *_codeBlockColor;
209
+ CGFloat _codeBlockMarginTop;
210
+ CGFloat _codeBlockMarginBottom;
211
+ CGFloat _codeBlockLineHeight;
212
+ RCTUIColor *_codeBlockBackgroundColor;
213
+ RCTUIColor *_codeBlockBorderColor;
214
+ CGFloat _codeBlockBorderRadius;
215
+ CGFloat _codeBlockBorderWidth;
216
+ CGFloat _codeBlockPadding;
217
+ RCTUIColor *_codeBlockSyntaxColors[kENRMCodeBlockSyntaxColorCount];
218
+ ENRMFontSlot *_codeBlockFont;
219
+ // Thematic break properties
220
+ RCTUIColor *_thematicBreakColor;
221
+ CGFloat _thematicBreakHeight;
222
+ CGFloat _thematicBreakMarginTop;
223
+ CGFloat _thematicBreakMarginBottom;
224
+ // Table properties
225
+ CGFloat _tableFontSize;
226
+ NSString *_tableFontFamily;
227
+ NSString *_tableFontWeight;
228
+ RCTUIColor *_tableColor;
229
+ CGFloat _tableMarginTop;
230
+ CGFloat _tableMarginBottom;
231
+ CGFloat _tableLineHeight;
232
+ ENRMFontSlot *_tableFont;
233
+ NSString *_tableHeaderFontFamily;
234
+ ENRMFontSlot *_tableHeaderFont;
235
+ RCTUIColor *_tableHeaderBackgroundColor;
236
+ RCTUIColor *_tableHeaderTextColor;
237
+ RCTUIColor *_tableRowEvenBackgroundColor;
238
+ RCTUIColor *_tableRowOddBackgroundColor;
239
+ RCTUIColor *_tableBorderColor;
240
+ CGFloat _tableBorderWidth;
241
+ CGFloat _tableBorderRadius;
242
+ CGFloat _tableCellPaddingHorizontal;
243
+ CGFloat _tableCellPaddingVertical;
244
+ CGFloat _tableHorizontalOverflow;
245
+ NSString *_tableAlign;
246
+ // Task list checkbox
247
+ RCTUIColor *_taskListCheckedColor;
248
+ RCTUIColor *_taskListBorderColor;
249
+ CGFloat _taskListCheckboxSize;
250
+ CGFloat _taskListCheckboxBorderRadius;
251
+ RCTUIColor *_taskListCheckmarkColor;
252
+ RCTUIColor *_taskListCheckedTextColor;
253
+ BOOL _taskListCheckedStrikethrough;
254
+ // Math properties
255
+ CGFloat _mathFontSize;
256
+ RCTUIColor *_mathColor;
257
+ RCTUIColor *_mathBackgroundColor;
258
+ CGFloat _mathPadding;
259
+ CGFloat _mathMarginTop;
260
+ CGFloat _mathMarginBottom;
261
+ NSString *_mathTextAlign;
262
+ // Inline Math properties
263
+ RCTUIColor *_inlineMathColor;
264
+ // Spoiler properties
265
+ RCTUIColor *_spoilerColor;
266
+ CGFloat _spoilerParticleDensity;
267
+ CGFloat _spoilerParticleSpeed;
268
+ CGFloat _spoilerSolidBorderRadius;
269
+ CGFloat _superscriptFontScale;
270
+ CGFloat _superscriptBaselineOffsetScale;
271
+ CGFloat _subscriptFontScale;
272
+ CGFloat _subscriptBaselineOffsetScale;
273
+ // All font cache entries — used for bulk invalidation
274
+ NSArray<ENRMFontSlot *> *_allFontEntries;
275
+ }
276
+
277
+ - (instancetype)init
278
+ {
279
+ self = [super init];
280
+ _allowFontScaling = YES;
281
+ _maxFontSizeMultiplier = 0;
282
+ _paragraphTextAlign = NSTextAlignmentNatural;
283
+ _h1TextAlign = NSTextAlignmentNatural;
284
+ _h2TextAlign = NSTextAlignmentNatural;
285
+ _h3TextAlign = NSTextAlignmentNatural;
286
+ _h4TextAlign = NSTextAlignmentNatural;
287
+ _h5TextAlign = NSTextAlignmentNatural;
288
+ _h6TextAlign = NSTextAlignmentNatural;
289
+ _linkUnderline = YES;
290
+ _linkVariants = @[];
291
+ _compiledVariantRegexes = @[];
292
+ _primaryFont = [[ENRMFontSlot alloc] init];
293
+ _paragraphFont = [[ENRMFontSlot alloc] init];
294
+ _h1Font = [[ENRMFontSlot alloc] init];
295
+ _h2Font = [[ENRMFontSlot alloc] init];
296
+ _h3Font = [[ENRMFontSlot alloc] init];
297
+ _h4Font = [[ENRMFontSlot alloc] init];
298
+ _h5Font = [[ENRMFontSlot alloc] init];
299
+ _h6Font = [[ENRMFontSlot alloc] init];
300
+ _listMarkerFont = [[ENRMFontSlot alloc] init];
301
+ _listStyleFont = [[ENRMFontSlot alloc] init];
302
+ _codeBlockFont = [[ENRMFontSlot alloc] init];
303
+ _blockquoteFont = [[ENRMFontSlot alloc] init];
304
+ _tableFont = [[ENRMFontSlot alloc] init];
305
+ _tableHeaderFont = [[ENRMFontSlot alloc] init];
306
+ _allFontEntries = @[
307
+ _primaryFont, _paragraphFont, _h1Font, _h2Font, _h3Font, _h4Font, _h5Font, _h6Font, _listMarkerFont, _listStyleFont,
308
+ _codeBlockFont, _blockquoteFont, _tableFont, _tableHeaderFont
309
+ ];
310
+ _admonitionColors = @{};
311
+ _admonitionBackgroundColors = @{};
312
+ return self;
313
+ }
314
+
315
+ - (void)invalidateAllFonts
316
+ {
317
+ for (ENRMFontSlot *entry in _allFontEntries) {
318
+ [entry invalidate];
319
+ }
320
+ }
321
+
322
+ - (CGFloat)fontScaleMultiplier
323
+ {
324
+ return _allowFontScaling ? RCTFontSizeMultiplier() : 1.0;
325
+ }
326
+
327
+ - (CGFloat)lineHeightForLinkPill:(LinkPillConfig *)pill
328
+ {
329
+ if (_allowFontScaling && pill.lineHeight > 0) {
330
+ return pill.lineHeight * RCTFontSizeMultiplierWithMax(_maxFontSizeMultiplier);
331
+ }
332
+ return pill.lineHeight;
333
+ }
334
+
335
+ - (void)setFontScaleMultiplier:(CGFloat)newValue
336
+ {
337
+ BOOL newAllowFontScaling = (newValue != 1.0);
338
+ if (_allowFontScaling != newAllowFontScaling) {
339
+ _allowFontScaling = newAllowFontScaling;
340
+ [self invalidateAllFonts];
341
+ }
342
+ }
343
+
344
+ - (CGFloat)effectiveScaleMultiplierForFontSize:(CGFloat)fontSize
345
+ {
346
+ if (!_allowFontScaling) {
347
+ return 1.0;
348
+ }
349
+ return RCTFontSizeMultiplierWithMax(_maxFontSizeMultiplier);
350
+ }
351
+
352
+ - (CGFloat)maxFontSizeMultiplier
353
+ {
354
+ return _maxFontSizeMultiplier;
355
+ }
356
+
357
+ - (void)setMaxFontSizeMultiplier:(CGFloat)newValue
358
+ {
359
+ if (_maxFontSizeMultiplier != newValue) {
360
+ _maxFontSizeMultiplier = newValue;
361
+ [self invalidateAllFonts];
362
+ }
363
+ }
364
+
365
+ - (id)copyWithZone:(NSZone *)zone
366
+ {
367
+ // -init creates fresh ENRMFontSlot instances with needsRecreation = YES,
368
+ // so all cached fonts will be rebuilt from the copied params below.
369
+ StyleConfig *copy = [[[self class] allocWithZone:zone] init];
370
+ copy->_allowFontScaling = _allowFontScaling;
371
+ copy->_maxFontSizeMultiplier = _maxFontSizeMultiplier;
372
+ copy->_primaryColor = [_primaryColor copy];
373
+ copy->_primaryFontSize = [_primaryFontSize copy];
374
+ copy->_primaryFontWeight = [_primaryFontWeight copy];
375
+ copy->_primaryFontFamily = [_primaryFontFamily copy];
376
+ copy->_paragraphFontSize = _paragraphFontSize;
377
+ copy->_paragraphFontFamily = [_paragraphFontFamily copy];
378
+ copy->_paragraphFontWeight = [_paragraphFontWeight copy];
379
+ copy->_paragraphColor = [_paragraphColor copy];
380
+ copy->_paragraphMarginTop = _paragraphMarginTop;
381
+ copy->_paragraphMarginBottom = _paragraphMarginBottom;
382
+ copy->_paragraphLineHeight = _paragraphLineHeight;
383
+ copy->_paragraphTextAlign = _paragraphTextAlign;
384
+ copy->_h1FontSize = _h1FontSize;
385
+ copy->_h1FontFamily = [_h1FontFamily copy];
386
+ copy->_h1FontWeight = [_h1FontWeight copy];
387
+ copy->_h1Color = [_h1Color copy];
388
+ copy->_h1MarginTop = _h1MarginTop;
389
+ copy->_h1MarginBottom = _h1MarginBottom;
390
+ copy->_h1LineHeight = _h1LineHeight;
391
+ copy->_h1TextAlign = _h1TextAlign;
392
+ copy->_h2FontSize = _h2FontSize;
393
+ copy->_h2FontFamily = [_h2FontFamily copy];
394
+ copy->_h2FontWeight = [_h2FontWeight copy];
395
+ copy->_h2Color = [_h2Color copy];
396
+ copy->_h2MarginTop = _h2MarginTop;
397
+ copy->_h2MarginBottom = _h2MarginBottom;
398
+ copy->_h2LineHeight = _h2LineHeight;
399
+ copy->_h2TextAlign = _h2TextAlign;
400
+ copy->_h3FontSize = _h3FontSize;
401
+ copy->_h3FontFamily = [_h3FontFamily copy];
402
+ copy->_h3FontWeight = [_h3FontWeight copy];
403
+ copy->_h3Color = [_h3Color copy];
404
+ copy->_h3MarginTop = _h3MarginTop;
405
+ copy->_h3MarginBottom = _h3MarginBottom;
406
+ copy->_h3LineHeight = _h3LineHeight;
407
+ copy->_h3TextAlign = _h3TextAlign;
408
+ copy->_h4FontSize = _h4FontSize;
409
+ copy->_h4FontFamily = [_h4FontFamily copy];
410
+ copy->_h4FontWeight = [_h4FontWeight copy];
411
+ copy->_h4Color = [_h4Color copy];
412
+ copy->_h4MarginTop = _h4MarginTop;
413
+ copy->_h4MarginBottom = _h4MarginBottom;
414
+ copy->_h4LineHeight = _h4LineHeight;
415
+ copy->_h4TextAlign = _h4TextAlign;
416
+ copy->_h5FontSize = _h5FontSize;
417
+ copy->_h5FontFamily = [_h5FontFamily copy];
418
+ copy->_h5FontWeight = [_h5FontWeight copy];
419
+ copy->_h5Color = [_h5Color copy];
420
+ copy->_h5MarginTop = _h5MarginTop;
421
+ copy->_h5MarginBottom = _h5MarginBottom;
422
+ copy->_h5LineHeight = _h5LineHeight;
423
+ copy->_h5TextAlign = _h5TextAlign;
424
+ copy->_h6FontSize = _h6FontSize;
425
+ copy->_h6FontFamily = [_h6FontFamily copy];
426
+ copy->_h6FontWeight = [_h6FontWeight copy];
427
+ copy->_h6Color = [_h6Color copy];
428
+ copy->_h6MarginTop = _h6MarginTop;
429
+ copy->_h6MarginBottom = _h6MarginBottom;
430
+ copy->_h6LineHeight = _h6LineHeight;
431
+ copy->_h6TextAlign = _h6TextAlign;
432
+ copy->_linkFontFamily = [_linkFontFamily copy];
433
+ copy->_linkColor = [_linkColor copy];
434
+ copy->_linkUnderline = _linkUnderline;
435
+ copy->_linkBackgroundColor = [_linkBackgroundColor copy];
436
+ copy->_linkVariants = [_linkVariants copy];
437
+ copy->_compiledVariantRegexes = [_compiledVariantRegexes copy];
438
+ copy->_strongFontFamily = [_strongFontFamily copy];
439
+ copy->_strongFontWeight = [_strongFontWeight copy];
440
+ copy->_strongColor = [_strongColor copy];
441
+ copy->_emphasisFontFamily = [_emphasisFontFamily copy];
442
+ copy->_emphasisFontStyle = [_emphasisFontStyle copy];
443
+ copy->_emphasisColor = [_emphasisColor copy];
444
+ copy->_strikethroughColor = [_strikethroughColor copy];
445
+ copy->_highlightColor = [_highlightColor copy];
446
+ copy->_highlightBackgroundColor = [_highlightBackgroundColor copy];
447
+ copy->_underlineColor = [_underlineColor copy];
448
+ copy->_codeFontFamily = [_codeFontFamily copy];
449
+ copy->_codeFontSize = _codeFontSize;
450
+ copy->_codeColor = [_codeColor copy];
451
+ copy->_codeBackgroundColor = [_codeBackgroundColor copy];
452
+ copy->_codeBorderColor = [_codeBorderColor copy];
453
+ copy->_factoidColor = [_factoidColor copy];
454
+ copy->_factoidBackgroundColor = [_factoidBackgroundColor copy];
455
+ copy->_factoidBorderColor = [_factoidBorderColor copy];
456
+ copy->_mentionColor = [_mentionColor copy];
457
+ copy->_mentionBackgroundColor = [_mentionBackgroundColor copy];
458
+ copy->_imageHeight = _imageHeight;
459
+ copy->_imageMaxHeight = _imageMaxHeight;
460
+ copy->_imageAspectRatio = _imageAspectRatio;
461
+ copy->_imageResizeMode = [_imageResizeMode copy];
462
+ copy->_imageBorderRadius = _imageBorderRadius;
463
+ copy->_imageMarginTop = _imageMarginTop;
464
+ copy->_imageMarginBottom = _imageMarginBottom;
465
+ copy->_imageRequestHeaders = [_imageRequestHeaders copy];
466
+ copy->_linkPillContent = [_linkPillContent copy];
467
+ copy->_videoMarginTop = _videoMarginTop;
468
+ copy->_videoMarginBottom = _videoMarginBottom;
469
+ copy->_videoBorderRadius = _videoBorderRadius;
470
+ copy->_videoAspectRatio = _videoAspectRatio;
471
+ copy->_videoBackgroundColor = [_videoBackgroundColor copy];
472
+ copy->_inlineImageSize = _inlineImageSize;
473
+ copy->_blockquoteFontSize = _blockquoteFontSize;
474
+ copy->_blockquoteFontFamily = [_blockquoteFontFamily copy];
475
+ copy->_blockquoteFontWeight = [_blockquoteFontWeight copy];
476
+ copy->_blockquoteColor = [_blockquoteColor copy];
477
+ copy->_blockquoteMarginTop = _blockquoteMarginTop;
478
+ copy->_blockquoteMarginBottom = _blockquoteMarginBottom;
479
+ copy->_blockquoteLineHeight = _blockquoteLineHeight;
480
+ copy->_blockquoteBorderColor = [_blockquoteBorderColor copy];
481
+ copy->_blockquoteBorderWidth = _blockquoteBorderWidth;
482
+ copy->_blockquoteGapWidth = _blockquoteGapWidth;
483
+ copy->_blockquoteBackgroundColor = [_blockquoteBackgroundColor copy];
484
+ copy->_blockquoteBorderRadius = _blockquoteBorderRadius;
485
+ copy->_blockquotePadding = _blockquotePadding;
486
+ copy->_admonitionColors = [_admonitionColors copy];
487
+ copy->_admonitionBackgroundColors = [_admonitionBackgroundColors copy];
488
+ copy->_listStyleFontSize = _listStyleFontSize;
489
+ copy->_listStyleFontFamily = [_listStyleFontFamily copy];
490
+ copy->_listStyleFontWeight = [_listStyleFontWeight copy];
491
+ copy->_listStyleColor = [_listStyleColor copy];
492
+ copy->_listStyleMarginTop = _listStyleMarginTop;
493
+ copy->_listStyleMarginBottom = _listStyleMarginBottom;
494
+ copy->_listStyleLineHeight = _listStyleLineHeight;
495
+ copy->_listStyleBulletColor = [_listStyleBulletColor copy];
496
+ copy->_listStyleBulletSize = _listStyleBulletSize;
497
+ copy->_listStyleMarkerMinWidth = _listStyleMarkerMinWidth;
498
+ copy->_listStyleMarkerColor = [_listStyleMarkerColor copy];
499
+ copy->_listStyleMarkerFontWeight = [_listStyleMarkerFontWeight copy];
500
+ copy->_listStyleGapWidth = _listStyleGapWidth;
501
+ copy->_listStyleMarginLeft = _listStyleMarginLeft;
502
+ copy->_listStyleItemSpacing = _listStyleItemSpacing;
503
+ copy->_codeBlockFontSize = _codeBlockFontSize;
504
+ copy->_codeBlockFontFamily = [_codeBlockFontFamily copy];
505
+ copy->_codeBlockFontWeight = [_codeBlockFontWeight copy];
506
+ copy->_codeBlockColor = [_codeBlockColor copy];
507
+ copy->_codeBlockMarginTop = _codeBlockMarginTop;
508
+ copy->_codeBlockMarginBottom = _codeBlockMarginBottom;
509
+ copy->_codeBlockLineHeight = _codeBlockLineHeight;
510
+ copy->_codeBlockBackgroundColor = [_codeBlockBackgroundColor copy];
511
+ copy->_codeBlockBorderColor = [_codeBlockBorderColor copy];
512
+ copy->_codeBlockBorderRadius = _codeBlockBorderRadius;
513
+ copy->_codeBlockBorderWidth = _codeBlockBorderWidth;
514
+ copy->_codeBlockPadding = _codeBlockPadding;
515
+ for (NSInteger i = 0; i < kENRMCodeBlockSyntaxColorCount; i++) {
516
+ copy->_codeBlockSyntaxColors[i] = [_codeBlockSyntaxColors[i] copy];
517
+ }
518
+ copy->_thematicBreakColor = [_thematicBreakColor copy];
519
+ copy->_thematicBreakHeight = _thematicBreakHeight;
520
+ copy->_thematicBreakMarginTop = _thematicBreakMarginTop;
521
+ copy->_thematicBreakMarginBottom = _thematicBreakMarginBottom;
522
+ copy->_tableFontSize = _tableFontSize;
523
+ copy->_tableFontFamily = [_tableFontFamily copy];
524
+ copy->_tableFontWeight = [_tableFontWeight copy];
525
+ copy->_tableColor = [_tableColor copy];
526
+ copy->_tableMarginTop = _tableMarginTop;
527
+ copy->_tableMarginBottom = _tableMarginBottom;
528
+ copy->_tableLineHeight = _tableLineHeight;
529
+ copy->_tableHeaderFontFamily = [_tableHeaderFontFamily copy];
530
+ copy->_tableHeaderBackgroundColor = [_tableHeaderBackgroundColor copy];
531
+ copy->_tableHeaderTextColor = [_tableHeaderTextColor copy];
532
+ copy->_tableRowEvenBackgroundColor = [_tableRowEvenBackgroundColor copy];
533
+ copy->_tableRowOddBackgroundColor = [_tableRowOddBackgroundColor copy];
534
+ copy->_tableBorderColor = [_tableBorderColor copy];
535
+ copy->_tableBorderWidth = _tableBorderWidth;
536
+ copy->_tableBorderRadius = _tableBorderRadius;
537
+ copy->_tableCellPaddingHorizontal = _tableCellPaddingHorizontal;
538
+ copy->_tableCellPaddingVertical = _tableCellPaddingVertical;
539
+ copy->_tableHorizontalOverflow = _tableHorizontalOverflow;
540
+ copy->_tableAlign = [_tableAlign copy];
541
+ copy->_taskListCheckedColor = [_taskListCheckedColor copy];
542
+ copy->_taskListBorderColor = [_taskListBorderColor copy];
543
+ copy->_taskListCheckboxSize = _taskListCheckboxSize;
544
+ copy->_taskListCheckboxBorderRadius = _taskListCheckboxBorderRadius;
545
+ copy->_taskListCheckmarkColor = [_taskListCheckmarkColor copy];
546
+ copy->_taskListCheckedTextColor = [_taskListCheckedTextColor copy];
547
+ copy->_taskListCheckedStrikethrough = _taskListCheckedStrikethrough;
548
+ copy->_mathFontSize = _mathFontSize;
549
+ copy->_mathColor = [_mathColor copy];
550
+ copy->_mathBackgroundColor = [_mathBackgroundColor copy];
551
+ copy->_mathPadding = _mathPadding;
552
+ copy->_mathMarginTop = _mathMarginTop;
553
+ copy->_mathMarginBottom = _mathMarginBottom;
554
+ copy->_mathTextAlign = [_mathTextAlign copy];
555
+ copy->_inlineMathColor = [_inlineMathColor copy];
556
+ copy->_spoilerColor = [_spoilerColor copy];
557
+ copy->_spoilerParticleDensity = _spoilerParticleDensity;
558
+ copy->_spoilerParticleSpeed = _spoilerParticleSpeed;
559
+ copy->_spoilerSolidBorderRadius = _spoilerSolidBorderRadius;
560
+ copy->_superscriptFontScale = _superscriptFontScale;
561
+ copy->_superscriptBaselineOffsetScale = _superscriptBaselineOffsetScale;
562
+ copy->_subscriptFontScale = _subscriptFontScale;
563
+ copy->_subscriptBaselineOffsetScale = _subscriptBaselineOffsetScale;
564
+
565
+ return copy;
566
+ }
567
+
568
+ - (RCTUIColor *)primaryColor
569
+ {
570
+ return _primaryColor != nullptr ? _primaryColor : [RCTUIColor blackColor];
571
+ }
572
+
573
+ - (void)setPrimaryColor:(RCTUIColor *)newValue
574
+ {
575
+ _primaryColor = newValue;
576
+ }
577
+
578
+ - (NSNumber *)primaryFontSize
579
+ {
580
+ return _primaryFontSize != nullptr ? _primaryFontSize : @16;
581
+ }
582
+
583
+ - (void)setPrimaryFontSize:(NSNumber *)newValue
584
+ {
585
+ _primaryFontSize = newValue;
586
+ [_primaryFont invalidate];
587
+ }
588
+
589
+ - (NSString *)primaryFontWeight
590
+ {
591
+ return _primaryFontWeight != nullptr ? _primaryFontWeight : @"normal";
592
+ }
593
+
594
+ - (void)setPrimaryFontWeight:(NSString *)newValue
595
+ {
596
+ _primaryFontWeight = newValue;
597
+ [_primaryFont invalidate];
598
+ }
599
+
600
+ - (NSString *)primaryFontFamily
601
+ {
602
+ return _primaryFontFamily;
603
+ }
604
+
605
+ - (void)setPrimaryFontFamily:(NSString *)newValue
606
+ {
607
+ _primaryFontFamily = newValue;
608
+ [_primaryFont invalidate];
609
+ }
610
+
611
+ - (UIFont *)primaryFont
612
+ {
613
+ if (_primaryFont.needsRecreation || !_primaryFont.cachedFont) {
614
+ _primaryFont.cachedFont =
615
+ [RCTFont updateFont:nil
616
+ withFamily:_primaryFontFamily
617
+ size:_primaryFontSize
618
+ weight:normalizedFontWeight(_primaryFontWeight)
619
+ style:nil
620
+ variant:nil
621
+ scaleMultiplier:[self effectiveScaleMultiplierForFontSize:[_primaryFontSize floatValue]]];
622
+ _primaryFont.needsRecreation = NO;
623
+ }
624
+ return _primaryFont.cachedFont;
625
+ }
626
+
627
+ // Paragraph properties
628
+ - (CGFloat)paragraphFontSize
629
+ {
630
+ return _paragraphFontSize;
631
+ }
632
+
633
+ - (void)setParagraphFontSize:(CGFloat)newValue
634
+ {
635
+ _paragraphFontSize = newValue;
636
+ [_paragraphFont invalidate];
637
+ }
638
+
639
+ - (NSString *)paragraphFontFamily
640
+ {
641
+ return _paragraphFontFamily;
642
+ }
643
+
644
+ - (void)setParagraphFontFamily:(NSString *)newValue
645
+ {
646
+ _paragraphFontFamily = newValue;
647
+ [_paragraphFont invalidate];
648
+ }
649
+
650
+ - (NSString *)paragraphFontWeight
651
+ {
652
+ return _paragraphFontWeight;
653
+ }
654
+
655
+ - (void)setParagraphFontWeight:(NSString *)newValue
656
+ {
657
+ _paragraphFontWeight = newValue;
658
+ [_paragraphFont invalidate];
659
+ }
660
+
661
+ - (RCTUIColor *)paragraphColor
662
+ {
663
+ return _paragraphColor;
664
+ }
665
+
666
+ - (void)setParagraphColor:(RCTUIColor *)newValue
667
+ {
668
+ _paragraphColor = newValue;
669
+ }
670
+
671
+ - (CGFloat)paragraphMarginTop
672
+ {
673
+ return _paragraphMarginTop;
674
+ }
675
+
676
+ - (void)setParagraphMarginTop:(CGFloat)newValue
677
+ {
678
+ _paragraphMarginTop = newValue;
679
+ }
680
+
681
+ - (CGFloat)paragraphMarginBottom
682
+ {
683
+ return _paragraphMarginBottom;
684
+ }
685
+
686
+ - (void)setParagraphMarginBottom:(CGFloat)newValue
687
+ {
688
+ _paragraphMarginBottom = newValue;
689
+ }
690
+
691
+ - (CGFloat)paragraphLineHeight
692
+ {
693
+ if (_allowFontScaling && _paragraphLineHeight > 0) {
694
+ return _paragraphLineHeight * RCTFontSizeMultiplierWithMax(_maxFontSizeMultiplier);
695
+ }
696
+ return _paragraphLineHeight;
697
+ }
698
+
699
+ - (void)setParagraphLineHeight:(CGFloat)newValue
700
+ {
701
+ _paragraphLineHeight = newValue;
702
+ }
703
+
704
+ - (NSTextAlignment)paragraphTextAlign
705
+ {
706
+ return _paragraphTextAlign;
707
+ }
708
+
709
+ - (void)setParagraphTextAlign:(NSTextAlignment)newValue
710
+ {
711
+ _paragraphTextAlign = newValue;
712
+ }
713
+
714
+ - (UIFont *)paragraphFont
715
+ {
716
+ if (_paragraphFont.needsRecreation || !_paragraphFont.cachedFont) {
717
+ _paragraphFont.cachedFont = [RCTFont updateFont:nil
718
+ withFamily:_paragraphFontFamily
719
+ size:@(_paragraphFontSize)
720
+ weight:normalizedFontWeight(_paragraphFontWeight)
721
+ style:nil
722
+ variant:nil
723
+ scaleMultiplier:[self effectiveScaleMultiplierForFontSize:_paragraphFontSize]];
724
+ _paragraphFont.needsRecreation = NO;
725
+ }
726
+ return _paragraphFont.cachedFont;
727
+ }
728
+
729
+ - (CGFloat)h1FontSize
730
+ {
731
+ return _h1FontSize;
732
+ }
733
+
734
+ - (void)setH1FontSize:(CGFloat)newValue
735
+ {
736
+ _h1FontSize = newValue;
737
+ [_h1Font invalidate];
738
+ }
739
+
740
+ - (NSString *)h1FontFamily
741
+ {
742
+ return _h1FontFamily;
743
+ }
744
+
745
+ - (void)setH1FontFamily:(NSString *)newValue
746
+ {
747
+ _h1FontFamily = newValue;
748
+ [_h1Font invalidate];
749
+ }
750
+
751
+ - (NSString *)h1FontWeight
752
+ {
753
+ return _h1FontWeight;
754
+ }
755
+
756
+ - (void)setH1FontWeight:(NSString *)newValue
757
+ {
758
+ _h1FontWeight = newValue;
759
+ [_h1Font invalidate];
760
+ }
761
+
762
+ - (RCTUIColor *)h1Color
763
+ {
764
+ return _h1Color;
765
+ }
766
+
767
+ - (void)setH1Color:(RCTUIColor *)newValue
768
+ {
769
+ _h1Color = newValue;
770
+ }
771
+
772
+ - (CGFloat)h1MarginTop
773
+ {
774
+ return _h1MarginTop;
775
+ }
776
+
777
+ - (void)setH1MarginTop:(CGFloat)newValue
778
+ {
779
+ _h1MarginTop = newValue;
780
+ }
781
+
782
+ - (CGFloat)h1MarginBottom
783
+ {
784
+ return _h1MarginBottom;
785
+ }
786
+
787
+ - (void)setH1MarginBottom:(CGFloat)newValue
788
+ {
789
+ _h1MarginBottom = newValue;
790
+ }
791
+
792
+ - (CGFloat)h1LineHeight
793
+ {
794
+ if (_allowFontScaling && _h1LineHeight > 0) {
795
+ return _h1LineHeight * RCTFontSizeMultiplierWithMax(_maxFontSizeMultiplier);
796
+ }
797
+ return _h1LineHeight;
798
+ }
799
+
800
+ - (void)setH1LineHeight:(CGFloat)newValue
801
+ {
802
+ _h1LineHeight = newValue;
803
+ }
804
+
805
+ - (NSTextAlignment)h1TextAlign
806
+ {
807
+ return _h1TextAlign;
808
+ }
809
+
810
+ - (void)setH1TextAlign:(NSTextAlignment)newValue
811
+ {
812
+ _h1TextAlign = newValue;
813
+ }
814
+
815
+ - (UIFont *)h1Font
816
+ {
817
+ if (_h1Font.needsRecreation || !_h1Font.cachedFont) {
818
+ _h1Font.cachedFont = [RCTFont updateFont:nil
819
+ withFamily:_h1FontFamily
820
+ size:@(_h1FontSize)
821
+ weight:normalizedFontWeight(_h1FontWeight)
822
+ style:nil
823
+ variant:nil
824
+ scaleMultiplier:[self effectiveScaleMultiplierForFontSize:_h1FontSize]];
825
+ _h1Font.needsRecreation = NO;
826
+ }
827
+ return _h1Font.cachedFont;
828
+ }
829
+
830
+ - (CGFloat)h2FontSize
831
+ {
832
+ return _h2FontSize;
833
+ }
834
+
835
+ - (void)setH2FontSize:(CGFloat)newValue
836
+ {
837
+ _h2FontSize = newValue;
838
+ [_h2Font invalidate];
839
+ }
840
+
841
+ - (NSString *)h2FontFamily
842
+ {
843
+ return _h2FontFamily;
844
+ }
845
+
846
+ - (void)setH2FontFamily:(NSString *)newValue
847
+ {
848
+ _h2FontFamily = newValue;
849
+ [_h2Font invalidate];
850
+ }
851
+
852
+ - (NSString *)h2FontWeight
853
+ {
854
+ return _h2FontWeight;
855
+ }
856
+
857
+ - (void)setH2FontWeight:(NSString *)newValue
858
+ {
859
+ _h2FontWeight = newValue;
860
+ [_h2Font invalidate];
861
+ }
862
+
863
+ - (RCTUIColor *)h2Color
864
+ {
865
+ return _h2Color;
866
+ }
867
+
868
+ - (void)setH2Color:(RCTUIColor *)newValue
869
+ {
870
+ _h2Color = newValue;
871
+ }
872
+
873
+ - (CGFloat)h2MarginTop
874
+ {
875
+ return _h2MarginTop;
876
+ }
877
+
878
+ - (void)setH2MarginTop:(CGFloat)newValue
879
+ {
880
+ _h2MarginTop = newValue;
881
+ }
882
+
883
+ - (CGFloat)h2MarginBottom
884
+ {
885
+ return _h2MarginBottom;
886
+ }
887
+
888
+ - (void)setH2MarginBottom:(CGFloat)newValue
889
+ {
890
+ _h2MarginBottom = newValue;
891
+ }
892
+
893
+ - (CGFloat)h2LineHeight
894
+ {
895
+ if (_allowFontScaling && _h2LineHeight > 0) {
896
+ return _h2LineHeight * RCTFontSizeMultiplierWithMax(_maxFontSizeMultiplier);
897
+ }
898
+ return _h2LineHeight;
899
+ }
900
+
901
+ - (void)setH2LineHeight:(CGFloat)newValue
902
+ {
903
+ _h2LineHeight = newValue;
904
+ }
905
+
906
+ - (NSTextAlignment)h2TextAlign
907
+ {
908
+ return _h2TextAlign;
909
+ }
910
+
911
+ - (void)setH2TextAlign:(NSTextAlignment)newValue
912
+ {
913
+ _h2TextAlign = newValue;
914
+ }
915
+
916
+ - (UIFont *)h2Font
917
+ {
918
+ if (_h2Font.needsRecreation || !_h2Font.cachedFont) {
919
+ _h2Font.cachedFont = [RCTFont updateFont:nil
920
+ withFamily:_h2FontFamily
921
+ size:@(_h2FontSize)
922
+ weight:normalizedFontWeight(_h2FontWeight)
923
+ style:nil
924
+ variant:nil
925
+ scaleMultiplier:[self effectiveScaleMultiplierForFontSize:_h2FontSize]];
926
+ _h2Font.needsRecreation = NO;
927
+ }
928
+ return _h2Font.cachedFont;
929
+ }
930
+
931
+ - (CGFloat)h3FontSize
932
+ {
933
+ return _h3FontSize;
934
+ }
935
+
936
+ - (void)setH3FontSize:(CGFloat)newValue
937
+ {
938
+ _h3FontSize = newValue;
939
+ [_h3Font invalidate];
940
+ }
941
+
942
+ - (NSString *)h3FontFamily
943
+ {
944
+ return _h3FontFamily;
945
+ }
946
+
947
+ - (void)setH3FontFamily:(NSString *)newValue
948
+ {
949
+ _h3FontFamily = newValue;
950
+ [_h3Font invalidate];
951
+ }
952
+
953
+ - (NSString *)h3FontWeight
954
+ {
955
+ return _h3FontWeight;
956
+ }
957
+
958
+ - (void)setH3FontWeight:(NSString *)newValue
959
+ {
960
+ _h3FontWeight = newValue;
961
+ [_h3Font invalidate];
962
+ }
963
+
964
+ - (RCTUIColor *)h3Color
965
+ {
966
+ return _h3Color;
967
+ }
968
+
969
+ - (void)setH3Color:(RCTUIColor *)newValue
970
+ {
971
+ _h3Color = newValue;
972
+ }
973
+
974
+ - (CGFloat)h3MarginTop
975
+ {
976
+ return _h3MarginTop;
977
+ }
978
+
979
+ - (void)setH3MarginTop:(CGFloat)newValue
980
+ {
981
+ _h3MarginTop = newValue;
982
+ }
983
+
984
+ - (CGFloat)h3MarginBottom
985
+ {
986
+ return _h3MarginBottom;
987
+ }
988
+
989
+ - (void)setH3MarginBottom:(CGFloat)newValue
990
+ {
991
+ _h3MarginBottom = newValue;
992
+ }
993
+
994
+ - (CGFloat)h3LineHeight
995
+ {
996
+ if (_allowFontScaling && _h3LineHeight > 0) {
997
+ return _h3LineHeight * RCTFontSizeMultiplierWithMax(_maxFontSizeMultiplier);
998
+ }
999
+ return _h3LineHeight;
1000
+ }
1001
+
1002
+ - (void)setH3LineHeight:(CGFloat)newValue
1003
+ {
1004
+ _h3LineHeight = newValue;
1005
+ }
1006
+
1007
+ - (NSTextAlignment)h3TextAlign
1008
+ {
1009
+ return _h3TextAlign;
1010
+ }
1011
+
1012
+ - (void)setH3TextAlign:(NSTextAlignment)newValue
1013
+ {
1014
+ _h3TextAlign = newValue;
1015
+ }
1016
+
1017
+ - (UIFont *)h3Font
1018
+ {
1019
+ if (_h3Font.needsRecreation || !_h3Font.cachedFont) {
1020
+ _h3Font.cachedFont = [RCTFont updateFont:nil
1021
+ withFamily:_h3FontFamily
1022
+ size:@(_h3FontSize)
1023
+ weight:normalizedFontWeight(_h3FontWeight)
1024
+ style:nil
1025
+ variant:nil
1026
+ scaleMultiplier:[self effectiveScaleMultiplierForFontSize:_h3FontSize]];
1027
+ _h3Font.needsRecreation = NO;
1028
+ }
1029
+ return _h3Font.cachedFont;
1030
+ }
1031
+
1032
+ - (CGFloat)h4FontSize
1033
+ {
1034
+ return _h4FontSize;
1035
+ }
1036
+
1037
+ - (void)setH4FontSize:(CGFloat)newValue
1038
+ {
1039
+ _h4FontSize = newValue;
1040
+ [_h4Font invalidate];
1041
+ }
1042
+
1043
+ - (NSString *)h4FontFamily
1044
+ {
1045
+ return _h4FontFamily;
1046
+ }
1047
+
1048
+ - (void)setH4FontFamily:(NSString *)newValue
1049
+ {
1050
+ _h4FontFamily = newValue;
1051
+ [_h4Font invalidate];
1052
+ }
1053
+
1054
+ - (NSString *)h4FontWeight
1055
+ {
1056
+ return _h4FontWeight;
1057
+ }
1058
+
1059
+ - (void)setH4FontWeight:(NSString *)newValue
1060
+ {
1061
+ _h4FontWeight = newValue;
1062
+ [_h4Font invalidate];
1063
+ }
1064
+
1065
+ - (RCTUIColor *)h4Color
1066
+ {
1067
+ return _h4Color;
1068
+ }
1069
+
1070
+ - (void)setH4Color:(RCTUIColor *)newValue
1071
+ {
1072
+ _h4Color = newValue;
1073
+ }
1074
+
1075
+ - (CGFloat)h4MarginTop
1076
+ {
1077
+ return _h4MarginTop;
1078
+ }
1079
+
1080
+ - (void)setH4MarginTop:(CGFloat)newValue
1081
+ {
1082
+ _h4MarginTop = newValue;
1083
+ }
1084
+
1085
+ - (CGFloat)h4MarginBottom
1086
+ {
1087
+ return _h4MarginBottom;
1088
+ }
1089
+
1090
+ - (void)setH4MarginBottom:(CGFloat)newValue
1091
+ {
1092
+ _h4MarginBottom = newValue;
1093
+ }
1094
+
1095
+ - (CGFloat)h4LineHeight
1096
+ {
1097
+ if (_allowFontScaling && _h4LineHeight > 0) {
1098
+ return _h4LineHeight * RCTFontSizeMultiplierWithMax(_maxFontSizeMultiplier);
1099
+ }
1100
+ return _h4LineHeight;
1101
+ }
1102
+
1103
+ - (void)setH4LineHeight:(CGFloat)newValue
1104
+ {
1105
+ _h4LineHeight = newValue;
1106
+ }
1107
+
1108
+ - (NSTextAlignment)h4TextAlign
1109
+ {
1110
+ return _h4TextAlign;
1111
+ }
1112
+
1113
+ - (void)setH4TextAlign:(NSTextAlignment)newValue
1114
+ {
1115
+ _h4TextAlign = newValue;
1116
+ }
1117
+
1118
+ - (UIFont *)h4Font
1119
+ {
1120
+ if (_h4Font.needsRecreation || !_h4Font.cachedFont) {
1121
+ _h4Font.cachedFont = [RCTFont updateFont:nil
1122
+ withFamily:_h4FontFamily
1123
+ size:@(_h4FontSize)
1124
+ weight:normalizedFontWeight(_h4FontWeight)
1125
+ style:nil
1126
+ variant:nil
1127
+ scaleMultiplier:[self effectiveScaleMultiplierForFontSize:_h4FontSize]];
1128
+ _h4Font.needsRecreation = NO;
1129
+ }
1130
+ return _h4Font.cachedFont;
1131
+ }
1132
+
1133
+ - (CGFloat)h5FontSize
1134
+ {
1135
+ return _h5FontSize;
1136
+ }
1137
+
1138
+ - (void)setH5FontSize:(CGFloat)newValue
1139
+ {
1140
+ _h5FontSize = newValue;
1141
+ [_h5Font invalidate];
1142
+ }
1143
+
1144
+ - (NSString *)h5FontFamily
1145
+ {
1146
+ return _h5FontFamily;
1147
+ }
1148
+
1149
+ - (void)setH5FontFamily:(NSString *)newValue
1150
+ {
1151
+ _h5FontFamily = newValue;
1152
+ [_h5Font invalidate];
1153
+ }
1154
+
1155
+ - (NSString *)h5FontWeight
1156
+ {
1157
+ return _h5FontWeight;
1158
+ }
1159
+
1160
+ - (void)setH5FontWeight:(NSString *)newValue
1161
+ {
1162
+ _h5FontWeight = newValue;
1163
+ [_h5Font invalidate];
1164
+ }
1165
+
1166
+ - (RCTUIColor *)h5Color
1167
+ {
1168
+ return _h5Color;
1169
+ }
1170
+
1171
+ - (void)setH5Color:(RCTUIColor *)newValue
1172
+ {
1173
+ _h5Color = newValue;
1174
+ }
1175
+
1176
+ - (CGFloat)h5MarginTop
1177
+ {
1178
+ return _h5MarginTop;
1179
+ }
1180
+
1181
+ - (void)setH5MarginTop:(CGFloat)newValue
1182
+ {
1183
+ _h5MarginTop = newValue;
1184
+ }
1185
+
1186
+ - (CGFloat)h5MarginBottom
1187
+ {
1188
+ return _h5MarginBottom;
1189
+ }
1190
+
1191
+ - (void)setH5MarginBottom:(CGFloat)newValue
1192
+ {
1193
+ _h5MarginBottom = newValue;
1194
+ }
1195
+
1196
+ - (CGFloat)h5LineHeight
1197
+ {
1198
+ if (_allowFontScaling && _h5LineHeight > 0) {
1199
+ return _h5LineHeight * RCTFontSizeMultiplierWithMax(_maxFontSizeMultiplier);
1200
+ }
1201
+ return _h5LineHeight;
1202
+ }
1203
+
1204
+ - (void)setH5LineHeight:(CGFloat)newValue
1205
+ {
1206
+ _h5LineHeight = newValue;
1207
+ }
1208
+
1209
+ - (NSTextAlignment)h5TextAlign
1210
+ {
1211
+ return _h5TextAlign;
1212
+ }
1213
+
1214
+ - (void)setH5TextAlign:(NSTextAlignment)newValue
1215
+ {
1216
+ _h5TextAlign = newValue;
1217
+ }
1218
+
1219
+ - (UIFont *)h5Font
1220
+ {
1221
+ if (_h5Font.needsRecreation || !_h5Font.cachedFont) {
1222
+ _h5Font.cachedFont = [RCTFont updateFont:nil
1223
+ withFamily:_h5FontFamily
1224
+ size:@(_h5FontSize)
1225
+ weight:normalizedFontWeight(_h5FontWeight)
1226
+ style:nil
1227
+ variant:nil
1228
+ scaleMultiplier:[self effectiveScaleMultiplierForFontSize:_h5FontSize]];
1229
+ _h5Font.needsRecreation = NO;
1230
+ }
1231
+ return _h5Font.cachedFont;
1232
+ }
1233
+
1234
+ - (CGFloat)h6FontSize
1235
+ {
1236
+ return _h6FontSize;
1237
+ }
1238
+
1239
+ - (void)setH6FontSize:(CGFloat)newValue
1240
+ {
1241
+ _h6FontSize = newValue;
1242
+ [_h6Font invalidate];
1243
+ }
1244
+
1245
+ - (NSString *)h6FontFamily
1246
+ {
1247
+ return _h6FontFamily;
1248
+ }
1249
+
1250
+ - (void)setH6FontFamily:(NSString *)newValue
1251
+ {
1252
+ _h6FontFamily = newValue;
1253
+ [_h6Font invalidate];
1254
+ }
1255
+
1256
+ - (NSString *)h6FontWeight
1257
+ {
1258
+ return _h6FontWeight;
1259
+ }
1260
+
1261
+ - (void)setH6FontWeight:(NSString *)newValue
1262
+ {
1263
+ _h6FontWeight = newValue;
1264
+ [_h6Font invalidate];
1265
+ }
1266
+
1267
+ - (RCTUIColor *)h6Color
1268
+ {
1269
+ return _h6Color;
1270
+ }
1271
+
1272
+ - (void)setH6Color:(RCTUIColor *)newValue
1273
+ {
1274
+ _h6Color = newValue;
1275
+ }
1276
+
1277
+ - (CGFloat)h6MarginTop
1278
+ {
1279
+ return _h6MarginTop;
1280
+ }
1281
+
1282
+ - (void)setH6MarginTop:(CGFloat)newValue
1283
+ {
1284
+ _h6MarginTop = newValue;
1285
+ }
1286
+
1287
+ - (CGFloat)h6MarginBottom
1288
+ {
1289
+ return _h6MarginBottom;
1290
+ }
1291
+
1292
+ - (void)setH6MarginBottom:(CGFloat)newValue
1293
+ {
1294
+ _h6MarginBottom = newValue;
1295
+ }
1296
+
1297
+ - (CGFloat)h6LineHeight
1298
+ {
1299
+ if (_allowFontScaling && _h6LineHeight > 0) {
1300
+ return _h6LineHeight * RCTFontSizeMultiplierWithMax(_maxFontSizeMultiplier);
1301
+ }
1302
+ return _h6LineHeight;
1303
+ }
1304
+
1305
+ - (void)setH6LineHeight:(CGFloat)newValue
1306
+ {
1307
+ _h6LineHeight = newValue;
1308
+ }
1309
+
1310
+ - (NSTextAlignment)h6TextAlign
1311
+ {
1312
+ return _h6TextAlign;
1313
+ }
1314
+
1315
+ - (void)setH6TextAlign:(NSTextAlignment)newValue
1316
+ {
1317
+ _h6TextAlign = newValue;
1318
+ }
1319
+
1320
+ - (UIFont *)h6Font
1321
+ {
1322
+ if (_h6Font.needsRecreation || !_h6Font.cachedFont) {
1323
+ _h6Font.cachedFont = [RCTFont updateFont:nil
1324
+ withFamily:_h6FontFamily
1325
+ size:@(_h6FontSize)
1326
+ weight:normalizedFontWeight(_h6FontWeight)
1327
+ style:nil
1328
+ variant:nil
1329
+ scaleMultiplier:[self effectiveScaleMultiplierForFontSize:_h6FontSize]];
1330
+ _h6Font.needsRecreation = NO;
1331
+ }
1332
+ return _h6Font.cachedFont;
1333
+ }
1334
+
1335
+ - (NSString *)linkFontFamily
1336
+ {
1337
+ return _linkFontFamily;
1338
+ }
1339
+
1340
+ - (void)setLinkFontFamily:(NSString *)newValue
1341
+ {
1342
+ _linkFontFamily = newValue;
1343
+ }
1344
+
1345
+ - (RCTUIColor *)linkColor
1346
+ {
1347
+ return _linkColor;
1348
+ }
1349
+
1350
+ - (void)setLinkColor:(RCTUIColor *)newValue
1351
+ {
1352
+ _linkColor = newValue;
1353
+ }
1354
+
1355
+ - (BOOL)linkUnderline
1356
+ {
1357
+ return _linkUnderline;
1358
+ }
1359
+
1360
+ - (void)setLinkUnderline:(BOOL)newValue
1361
+ {
1362
+ _linkUnderline = newValue;
1363
+ }
1364
+
1365
+ - (RCTUIColor *)linkBackgroundColor
1366
+ {
1367
+ return _linkBackgroundColor;
1368
+ }
1369
+
1370
+ - (void)setLinkBackgroundColor:(RCTUIColor *)newValue
1371
+ {
1372
+ _linkBackgroundColor = newValue;
1373
+ }
1374
+
1375
+ - (NSArray<LinkVariantConfig *> *)linkVariants
1376
+ {
1377
+ return _linkVariants;
1378
+ }
1379
+
1380
+ /// The JS normalizer validates patterns before they reach native, but iOS and JS
1381
+ /// regex dialects still differ. Keep each compiled regex paired with its source
1382
+ /// variant so an unsupported pattern cannot shift later matches.
1383
+ - (void)setLinkVariants:(NSArray<LinkVariantConfig *> *)newValue
1384
+ {
1385
+ _linkVariants = newValue;
1386
+ NSMutableArray<LinkVariantRegexEntry *> *compiledEntries = [NSMutableArray arrayWithCapacity:newValue.count];
1387
+ for (LinkVariantConfig *variant in newValue) {
1388
+ NSError *error = nil;
1389
+ NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:variant.pattern
1390
+ options:0
1391
+ error:&error];
1392
+ if (regex) {
1393
+ LinkVariantRegexEntry *entry = [[LinkVariantRegexEntry alloc] init];
1394
+ entry.regex = regex;
1395
+ entry.variant = variant;
1396
+ [compiledEntries addObject:entry];
1397
+ }
1398
+ }
1399
+ _compiledVariantRegexes = [compiledEntries copy];
1400
+ }
1401
+
1402
+ - (nullable LinkVariantConfig *)effectiveLinkVariantForURL:(NSString *)url
1403
+ {
1404
+ if (_linkVariants.count == 0)
1405
+ return nil;
1406
+ NSUInteger len = url.length;
1407
+ for (NSUInteger i = 0; i < _compiledVariantRegexes.count; i++) {
1408
+ LinkVariantRegexEntry *entry = _compiledVariantRegexes[i];
1409
+ if ([entry.regex rangeOfFirstMatchInString:url options:0 range:NSMakeRange(0, len)].location != NSNotFound) {
1410
+ return entry.variant;
1411
+ }
1412
+ }
1413
+ return nil;
1414
+ }
1415
+
1416
+ - (NSString *)strongFontFamily
1417
+ {
1418
+ return _strongFontFamily;
1419
+ }
1420
+
1421
+ - (void)setStrongFontFamily:(NSString *)newValue
1422
+ {
1423
+ _strongFontFamily = newValue;
1424
+ }
1425
+
1426
+ - (NSString *)strongFontWeight
1427
+ {
1428
+ return _strongFontWeight;
1429
+ }
1430
+
1431
+ - (void)setStrongFontWeight:(NSString *)newValue
1432
+ {
1433
+ _strongFontWeight = newValue;
1434
+ }
1435
+
1436
+ - (RCTUIColor *)strongColor
1437
+ {
1438
+ return _strongColor;
1439
+ }
1440
+
1441
+ - (void)setStrongColor:(RCTUIColor *)newValue
1442
+ {
1443
+ _strongColor = newValue;
1444
+ }
1445
+
1446
+ - (NSString *)emphasisFontFamily
1447
+ {
1448
+ return _emphasisFontFamily;
1449
+ }
1450
+
1451
+ - (void)setEmphasisFontFamily:(NSString *)newValue
1452
+ {
1453
+ _emphasisFontFamily = newValue;
1454
+ }
1455
+
1456
+ - (NSString *)emphasisFontStyle
1457
+ {
1458
+ return _emphasisFontStyle;
1459
+ }
1460
+
1461
+ - (void)setEmphasisFontStyle:(NSString *)newValue
1462
+ {
1463
+ _emphasisFontStyle = newValue;
1464
+ }
1465
+
1466
+ - (RCTUIColor *)emphasisColor
1467
+ {
1468
+ return _emphasisColor;
1469
+ }
1470
+
1471
+ - (void)setEmphasisColor:(RCTUIColor *)newValue
1472
+ {
1473
+ _emphasisColor = newValue;
1474
+ }
1475
+
1476
+ - (RCTUIColor *)strikethroughColor
1477
+ {
1478
+ return _strikethroughColor;
1479
+ }
1480
+
1481
+ - (void)setStrikethroughColor:(RCTUIColor *)newValue
1482
+ {
1483
+ _strikethroughColor = newValue;
1484
+ }
1485
+
1486
+ - (RCTUIColor *)highlightColor
1487
+ {
1488
+ return _highlightColor;
1489
+ }
1490
+
1491
+ - (void)setHighlightColor:(RCTUIColor *)newValue
1492
+ {
1493
+ _highlightColor = newValue;
1494
+ }
1495
+
1496
+ - (RCTUIColor *)highlightBackgroundColor
1497
+ {
1498
+ return _highlightBackgroundColor;
1499
+ }
1500
+
1501
+ - (void)setHighlightBackgroundColor:(RCTUIColor *)newValue
1502
+ {
1503
+ _highlightBackgroundColor = newValue;
1504
+ }
1505
+
1506
+ - (RCTUIColor *)underlineColor
1507
+ {
1508
+ return _underlineColor;
1509
+ }
1510
+
1511
+ - (void)setUnderlineColor:(RCTUIColor *)newValue
1512
+ {
1513
+ _underlineColor = newValue;
1514
+ }
1515
+
1516
+ - (NSString *)codeFontFamily
1517
+ {
1518
+ return _codeFontFamily;
1519
+ }
1520
+
1521
+ - (void)setCodeFontFamily:(NSString *)newValue
1522
+ {
1523
+ _codeFontFamily = newValue;
1524
+ }
1525
+
1526
+ - (CGFloat)codeFontSize
1527
+ {
1528
+ return _codeFontSize;
1529
+ }
1530
+
1531
+ - (void)setCodeFontSize:(CGFloat)newValue
1532
+ {
1533
+ _codeFontSize = newValue;
1534
+ }
1535
+
1536
+ - (RCTUIColor *)codeColor
1537
+ {
1538
+ return _codeColor;
1539
+ }
1540
+
1541
+ - (void)setCodeColor:(RCTUIColor *)newValue
1542
+ {
1543
+ _codeColor = newValue;
1544
+ }
1545
+
1546
+ - (RCTUIColor *)codeBackgroundColor
1547
+ {
1548
+ return _codeBackgroundColor;
1549
+ }
1550
+
1551
+ - (void)setCodeBackgroundColor:(RCTUIColor *)newValue
1552
+ {
1553
+ _codeBackgroundColor = newValue;
1554
+ }
1555
+
1556
+ - (RCTUIColor *)codeBorderColor
1557
+ {
1558
+ return _codeBorderColor;
1559
+ }
1560
+
1561
+ - (void)setCodeBorderColor:(RCTUIColor *)newValue
1562
+ {
1563
+ _codeBorderColor = newValue;
1564
+ }
1565
+
1566
+ - (RCTUIColor *)factoidColor
1567
+ {
1568
+ return _factoidColor;
1569
+ }
1570
+
1571
+ - (void)setFactoidColor:(RCTUIColor *)newValue
1572
+ {
1573
+ _factoidColor = newValue;
1574
+ }
1575
+
1576
+ - (RCTUIColor *)factoidBackgroundColor
1577
+ {
1578
+ return _factoidBackgroundColor;
1579
+ }
1580
+
1581
+ - (void)setFactoidBackgroundColor:(RCTUIColor *)newValue
1582
+ {
1583
+ _factoidBackgroundColor = newValue;
1584
+ }
1585
+
1586
+ - (RCTUIColor *)factoidBorderColor
1587
+ {
1588
+ return _factoidBorderColor;
1589
+ }
1590
+
1591
+ - (void)setFactoidBorderColor:(RCTUIColor *)newValue
1592
+ {
1593
+ _factoidBorderColor = newValue;
1594
+ }
1595
+
1596
+ - (RCTUIColor *)mentionColor
1597
+ {
1598
+ return _mentionColor;
1599
+ }
1600
+
1601
+ - (void)setMentionColor:(RCTUIColor *)newValue
1602
+ {
1603
+ _mentionColor = newValue;
1604
+ }
1605
+
1606
+ - (RCTUIColor *)mentionBackgroundColor
1607
+ {
1608
+ return _mentionBackgroundColor;
1609
+ }
1610
+
1611
+ - (void)setMentionBackgroundColor:(RCTUIColor *)newValue
1612
+ {
1613
+ _mentionBackgroundColor = newValue;
1614
+ }
1615
+
1616
+ - (CGFloat)imageHeight
1617
+ {
1618
+ return _imageHeight;
1619
+ }
1620
+
1621
+ - (void)setImageHeight:(CGFloat)newValue
1622
+ {
1623
+ _imageHeight = newValue;
1624
+ }
1625
+
1626
+ - (CGFloat)imageMaxHeight
1627
+ {
1628
+ return _imageMaxHeight;
1629
+ }
1630
+
1631
+ - (void)setImageMaxHeight:(CGFloat)newValue
1632
+ {
1633
+ _imageMaxHeight = newValue;
1634
+ }
1635
+
1636
+ - (CGFloat)imageAspectRatio
1637
+ {
1638
+ return _imageAspectRatio;
1639
+ }
1640
+
1641
+ - (void)setImageAspectRatio:(CGFloat)newValue
1642
+ {
1643
+ _imageAspectRatio = newValue;
1644
+ }
1645
+
1646
+ - (NSString *)imageResizeMode
1647
+ {
1648
+ return _imageResizeMode ?: @"";
1649
+ }
1650
+
1651
+ - (void)setImageResizeMode:(NSString *)newValue
1652
+ {
1653
+ _imageResizeMode = newValue;
1654
+ }
1655
+
1656
+ - (CGFloat)imageBorderRadius
1657
+ {
1658
+ return _imageBorderRadius;
1659
+ }
1660
+
1661
+ - (void)setImageBorderRadius:(CGFloat)newValue
1662
+ {
1663
+ _imageBorderRadius = newValue;
1664
+ }
1665
+
1666
+ - (CGFloat)imageMarginTop
1667
+ {
1668
+ return _imageMarginTop;
1669
+ }
1670
+
1671
+ - (void)setImageMarginTop:(CGFloat)newValue
1672
+ {
1673
+ _imageMarginTop = newValue;
1674
+ }
1675
+
1676
+ - (CGFloat)imageMarginBottom
1677
+ {
1678
+ return _imageMarginBottom;
1679
+ }
1680
+
1681
+ - (void)setImageMarginBottom:(CGFloat)newValue
1682
+ {
1683
+ _imageMarginBottom = newValue;
1684
+ }
1685
+
1686
+ - (NSDictionary<NSString *, NSString *> *)imageRequestHeaders
1687
+ {
1688
+ return _imageRequestHeaders;
1689
+ }
1690
+
1691
+ - (void)setImageRequestHeaders:(NSDictionary<NSString *, NSString *> *)newValue
1692
+ {
1693
+ _imageRequestHeaders = [newValue copy];
1694
+ }
1695
+
1696
+ - (NSDictionary<NSString *, LinkPillContent *> *)linkPillContent
1697
+ {
1698
+ return _linkPillContent;
1699
+ }
1700
+
1701
+ - (void)setLinkPillContent:(NSDictionary<NSString *, LinkPillContent *> *)newValue
1702
+ {
1703
+ _linkPillContent = [newValue copy];
1704
+ }
1705
+
1706
+ - (CGFloat)videoMarginTop
1707
+ {
1708
+ return _videoMarginTop;
1709
+ }
1710
+
1711
+ - (void)setVideoMarginTop:(CGFloat)newValue
1712
+ {
1713
+ _videoMarginTop = newValue;
1714
+ }
1715
+
1716
+ - (CGFloat)videoMarginBottom
1717
+ {
1718
+ return _videoMarginBottom;
1719
+ }
1720
+
1721
+ - (void)setVideoMarginBottom:(CGFloat)newValue
1722
+ {
1723
+ _videoMarginBottom = newValue;
1724
+ }
1725
+
1726
+ - (CGFloat)videoBorderRadius
1727
+ {
1728
+ return _videoBorderRadius;
1729
+ }
1730
+
1731
+ - (void)setVideoBorderRadius:(CGFloat)newValue
1732
+ {
1733
+ _videoBorderRadius = newValue;
1734
+ }
1735
+
1736
+ - (CGFloat)videoAspectRatio
1737
+ {
1738
+ return _videoAspectRatio;
1739
+ }
1740
+
1741
+ - (void)setVideoAspectRatio:(CGFloat)newValue
1742
+ {
1743
+ _videoAspectRatio = newValue;
1744
+ }
1745
+
1746
+ - (RCTUIColor *)videoBackgroundColor
1747
+ {
1748
+ return _videoBackgroundColor;
1749
+ }
1750
+
1751
+ - (void)setVideoBackgroundColor:(RCTUIColor *)newValue
1752
+ {
1753
+ _videoBackgroundColor = newValue;
1754
+ }
1755
+
1756
+ - (CGFloat)inlineImageSize
1757
+ {
1758
+ return _inlineImageSize;
1759
+ }
1760
+
1761
+ - (void)setInlineImageSize:(CGFloat)newValue
1762
+ {
1763
+ _inlineImageSize = newValue;
1764
+ }
1765
+
1766
+ // Blockquote properties
1767
+ - (CGFloat)blockquoteFontSize
1768
+ {
1769
+ return _blockquoteFontSize;
1770
+ }
1771
+
1772
+ - (void)setBlockquoteFontSize:(CGFloat)newValue
1773
+ {
1774
+ _blockquoteFontSize = newValue;
1775
+ [_blockquoteFont invalidate];
1776
+ }
1777
+
1778
+ - (NSString *)blockquoteFontFamily
1779
+ {
1780
+ return _blockquoteFontFamily;
1781
+ }
1782
+
1783
+ - (void)setBlockquoteFontFamily:(NSString *)newValue
1784
+ {
1785
+ _blockquoteFontFamily = newValue;
1786
+ [_blockquoteFont invalidate];
1787
+ }
1788
+
1789
+ - (NSString *)blockquoteFontWeight
1790
+ {
1791
+ return _blockquoteFontWeight;
1792
+ }
1793
+
1794
+ - (void)setBlockquoteFontWeight:(NSString *)newValue
1795
+ {
1796
+ _blockquoteFontWeight = newValue;
1797
+ [_blockquoteFont invalidate];
1798
+ }
1799
+
1800
+ - (RCTUIColor *)blockquoteColor
1801
+ {
1802
+ return _blockquoteColor;
1803
+ }
1804
+
1805
+ - (void)setBlockquoteColor:(RCTUIColor *)newValue
1806
+ {
1807
+ _blockquoteColor = newValue;
1808
+ }
1809
+
1810
+ - (CGFloat)blockquoteMarginTop
1811
+ {
1812
+ return _blockquoteMarginTop;
1813
+ }
1814
+
1815
+ - (void)setBlockquoteMarginTop:(CGFloat)newValue
1816
+ {
1817
+ _blockquoteMarginTop = newValue;
1818
+ }
1819
+
1820
+ - (CGFloat)blockquoteMarginBottom
1821
+ {
1822
+ return _blockquoteMarginBottom;
1823
+ }
1824
+
1825
+ - (void)setBlockquoteMarginBottom:(CGFloat)newValue
1826
+ {
1827
+ _blockquoteMarginBottom = newValue;
1828
+ }
1829
+
1830
+ - (CGFloat)blockquoteLineHeight
1831
+ {
1832
+ if (_allowFontScaling && _blockquoteLineHeight > 0) {
1833
+ return _blockquoteLineHeight * RCTFontSizeMultiplierWithMax(_maxFontSizeMultiplier);
1834
+ }
1835
+ return _blockquoteLineHeight;
1836
+ }
1837
+
1838
+ - (void)setBlockquoteLineHeight:(CGFloat)newValue
1839
+ {
1840
+ _blockquoteLineHeight = newValue;
1841
+ }
1842
+
1843
+ - (UIFont *)blockquoteFont
1844
+ {
1845
+ if (_blockquoteFont.needsRecreation || !_blockquoteFont.cachedFont) {
1846
+ _blockquoteFont.cachedFont = [RCTFont updateFont:nil
1847
+ withFamily:_blockquoteFontFamily
1848
+ size:@(_blockquoteFontSize)
1849
+ weight:normalizedFontWeight(_blockquoteFontWeight)
1850
+ style:nil
1851
+ variant:nil
1852
+ scaleMultiplier:[self effectiveScaleMultiplierForFontSize:_blockquoteFontSize]];
1853
+ _blockquoteFont.needsRecreation = NO;
1854
+ }
1855
+ return _blockquoteFont.cachedFont;
1856
+ }
1857
+
1858
+ - (RCTUIColor *)blockquoteBorderColor
1859
+ {
1860
+ return _blockquoteBorderColor;
1861
+ }
1862
+
1863
+ - (void)setBlockquoteBorderColor:(RCTUIColor *)newValue
1864
+ {
1865
+ _blockquoteBorderColor = newValue;
1866
+ }
1867
+
1868
+ - (CGFloat)blockquoteBorderWidth
1869
+ {
1870
+ return _blockquoteBorderWidth;
1871
+ }
1872
+
1873
+ - (void)setBlockquoteBorderWidth:(CGFloat)newValue
1874
+ {
1875
+ _blockquoteBorderWidth = newValue;
1876
+ }
1877
+
1878
+ - (CGFloat)blockquoteGapWidth
1879
+ {
1880
+ return _blockquoteGapWidth;
1881
+ }
1882
+
1883
+ - (void)setBlockquoteGapWidth:(CGFloat)newValue
1884
+ {
1885
+ _blockquoteGapWidth = newValue;
1886
+ }
1887
+
1888
+ - (RCTUIColor *)blockquoteBackgroundColor
1889
+ {
1890
+ return _blockquoteBackgroundColor;
1891
+ }
1892
+
1893
+ - (void)setBlockquoteBackgroundColor:(RCTUIColor *)newValue
1894
+ {
1895
+ _blockquoteBackgroundColor = newValue;
1896
+ }
1897
+
1898
+ - (CGFloat)blockquoteBorderRadius
1899
+ {
1900
+ return _blockquoteBorderRadius;
1901
+ }
1902
+
1903
+ - (void)setBlockquoteBorderRadius:(CGFloat)newValue
1904
+ {
1905
+ _blockquoteBorderRadius = newValue;
1906
+ }
1907
+
1908
+ - (CGFloat)blockquotePadding
1909
+ {
1910
+ return _blockquotePadding;
1911
+ }
1912
+
1913
+ - (void)setBlockquotePadding:(CGFloat)newValue
1914
+ {
1915
+ _blockquotePadding = newValue;
1916
+ }
1917
+
1918
+ - (void)setAdmonitionColors:(NSDictionary<NSString *, RCTUIColor *> *)colors
1919
+ backgroundColors:(NSDictionary<NSString *, RCTUIColor *> *)backgroundColors
1920
+ {
1921
+ _admonitionColors = [colors copy];
1922
+ _admonitionBackgroundColors = [backgroundColors copy];
1923
+ }
1924
+
1925
+ // The tint (border + title + icon) for an admonition type; falls back to the
1926
+ // base blockquote border color if the type was never configured.
1927
+ - (RCTUIColor *)admonitionColorForType:(NSString *)type
1928
+ {
1929
+ RCTUIColor *color = _admonitionColors[type];
1930
+ return color ?: _blockquoteBorderColor;
1931
+ }
1932
+
1933
+ // The callout fill for an admonition type; clear (no fill) when unset.
1934
+ - (RCTUIColor *)admonitionBackgroundColorForType:(NSString *)type
1935
+ {
1936
+ RCTUIColor *color = _admonitionBackgroundColors[type];
1937
+ return color ?: [RCTUIColor clearColor];
1938
+ }
1939
+
1940
+ // List style properties (combined for both ordered and unordered lists)
1941
+ - (CGFloat)listStyleFontSize
1942
+ {
1943
+ return _listStyleFontSize;
1944
+ }
1945
+
1946
+ - (void)setListStyleFontSize:(CGFloat)newValue
1947
+ {
1948
+ _listStyleFontSize = newValue;
1949
+ [_listMarkerFont invalidate];
1950
+ [_listStyleFont invalidate];
1951
+ }
1952
+
1953
+ - (NSString *)listStyleFontFamily
1954
+ {
1955
+ return _listStyleFontFamily;
1956
+ }
1957
+
1958
+ - (void)setListStyleFontFamily:(NSString *)newValue
1959
+ {
1960
+ _listStyleFontFamily = newValue;
1961
+ [_listMarkerFont invalidate];
1962
+ [_listStyleFont invalidate];
1963
+ }
1964
+
1965
+ - (NSString *)listStyleFontWeight
1966
+ {
1967
+ return _listStyleFontWeight;
1968
+ }
1969
+
1970
+ - (void)setListStyleFontWeight:(NSString *)newValue
1971
+ {
1972
+ _listStyleFontWeight = newValue;
1973
+ [_listStyleFont invalidate];
1974
+ }
1975
+
1976
+ - (RCTUIColor *)listStyleColor
1977
+ {
1978
+ return _listStyleColor;
1979
+ }
1980
+
1981
+ - (void)setListStyleColor:(RCTUIColor *)newValue
1982
+ {
1983
+ _listStyleColor = newValue;
1984
+ }
1985
+
1986
+ - (CGFloat)listStyleMarginTop
1987
+ {
1988
+ return _listStyleMarginTop;
1989
+ }
1990
+
1991
+ - (void)setListStyleMarginTop:(CGFloat)newValue
1992
+ {
1993
+ _listStyleMarginTop = newValue;
1994
+ }
1995
+
1996
+ - (CGFloat)listStyleMarginBottom
1997
+ {
1998
+ return _listStyleMarginBottom;
1999
+ }
2000
+
2001
+ - (void)setListStyleMarginBottom:(CGFloat)newValue
2002
+ {
2003
+ _listStyleMarginBottom = newValue;
2004
+ }
2005
+
2006
+ - (CGFloat)listStyleLineHeight
2007
+ {
2008
+ if (_allowFontScaling && _listStyleLineHeight > 0) {
2009
+ return _listStyleLineHeight * RCTFontSizeMultiplierWithMax(_maxFontSizeMultiplier);
2010
+ }
2011
+ return _listStyleLineHeight;
2012
+ }
2013
+
2014
+ - (void)setListStyleLineHeight:(CGFloat)newValue
2015
+ {
2016
+ _listStyleLineHeight = newValue;
2017
+ }
2018
+
2019
+ - (RCTUIColor *)listStyleBulletColor
2020
+ {
2021
+ return _listStyleBulletColor;
2022
+ }
2023
+
2024
+ - (void)setListStyleBulletColor:(RCTUIColor *)newValue
2025
+ {
2026
+ _listStyleBulletColor = newValue;
2027
+ }
2028
+
2029
+ - (CGFloat)listStyleBulletSize
2030
+ {
2031
+ return _listStyleBulletSize;
2032
+ }
2033
+
2034
+ - (void)setListStyleBulletSize:(CGFloat)newValue
2035
+ {
2036
+ _listStyleBulletSize = newValue;
2037
+ }
2038
+
2039
+ - (CGFloat)listStyleMarkerMinWidth
2040
+ {
2041
+ return _listStyleMarkerMinWidth;
2042
+ }
2043
+
2044
+ - (void)setListStyleMarkerMinWidth:(CGFloat)newValue
2045
+ {
2046
+ _listStyleMarkerMinWidth = newValue;
2047
+ }
2048
+
2049
+ - (RCTUIColor *)listStyleMarkerColor
2050
+ {
2051
+ return _listStyleMarkerColor;
2052
+ }
2053
+
2054
+ - (void)setListStyleMarkerColor:(RCTUIColor *)newValue
2055
+ {
2056
+ _listStyleMarkerColor = newValue;
2057
+ }
2058
+
2059
+ - (NSString *)listStyleMarkerFontWeight
2060
+ {
2061
+ return _listStyleMarkerFontWeight;
2062
+ }
2063
+
2064
+ - (void)setListStyleMarkerFontWeight:(NSString *)newValue
2065
+ {
2066
+ _listStyleMarkerFontWeight = newValue;
2067
+ [_listMarkerFont invalidate];
2068
+ }
2069
+
2070
+ - (CGFloat)listStyleGapWidth
2071
+ {
2072
+ return _listStyleGapWidth;
2073
+ }
2074
+
2075
+ - (void)setListStyleGapWidth:(CGFloat)newValue
2076
+ {
2077
+ _listStyleGapWidth = newValue;
2078
+ }
2079
+
2080
+ - (CGFloat)listStyleMarginLeft
2081
+ {
2082
+ return _listStyleMarginLeft;
2083
+ }
2084
+
2085
+ - (void)setListStyleMarginLeft:(CGFloat)newValue
2086
+ {
2087
+ _listStyleMarginLeft = newValue;
2088
+ }
2089
+
2090
+ - (CGFloat)listStyleItemSpacing
2091
+ {
2092
+ return _listStyleItemSpacing;
2093
+ }
2094
+
2095
+ - (void)setListStyleItemSpacing:(CGFloat)newValue
2096
+ {
2097
+ _listStyleItemSpacing = newValue;
2098
+ }
2099
+
2100
+ - (UIFont *)listMarkerFont
2101
+ {
2102
+ if (_listMarkerFont.needsRecreation || !_listMarkerFont.cachedFont) {
2103
+ _listMarkerFont.cachedFont = [RCTFont updateFont:nil
2104
+ withFamily:_listStyleFontFamily
2105
+ size:@(_listStyleFontSize)
2106
+ weight:normalizedFontWeight(_listStyleMarkerFontWeight)
2107
+ style:nil
2108
+ variant:nil
2109
+ scaleMultiplier:[self effectiveScaleMultiplierForFontSize:_listStyleFontSize]];
2110
+ _listMarkerFont.needsRecreation = NO;
2111
+ }
2112
+ return _listMarkerFont.cachedFont;
2113
+ }
2114
+
2115
+ - (UIFont *)listStyleFont
2116
+ {
2117
+ if (_listStyleFont.needsRecreation || !_listStyleFont.cachedFont) {
2118
+ _listStyleFont.cachedFont = [RCTFont updateFont:nil
2119
+ withFamily:_listStyleFontFamily
2120
+ size:@(_listStyleFontSize)
2121
+ weight:normalizedFontWeight(_listStyleFontWeight)
2122
+ style:nil
2123
+ variant:nil
2124
+ scaleMultiplier:[self effectiveScaleMultiplierForFontSize:_listStyleFontSize]];
2125
+ _listStyleFont.needsRecreation = NO;
2126
+ }
2127
+ return _listStyleFont.cachedFont;
2128
+ }
2129
+
2130
+ static const CGFloat kDefaultMinGap = 4.0;
2131
+
2132
+ - (CGFloat)effectiveListGapWidth
2133
+ {
2134
+ return MAX(_listStyleGapWidth, kDefaultMinGap);
2135
+ }
2136
+
2137
+ - (CGFloat)effectiveListMarginLeftForNumber:(NSInteger)number
2138
+ {
2139
+ UIFont *font = [self listMarkerFont];
2140
+ CGFloat natural =
2141
+ [[NSString stringWithFormat:@"%ld.", (long)number]
2142
+ sizeWithAttributes:@{NSFontAttributeName : font ?: [UIFont systemFontOfSize:_listStyleFontSize]}]
2143
+ .width;
2144
+ return MAX(_listStyleMarkerMinWidth, natural);
2145
+ }
2146
+
2147
+ - (CGFloat)effectiveListMarginLeftForTask
2148
+ {
2149
+ return MAX(_listStyleMarkerMinWidth, [self taskListCheckboxSize]);
2150
+ }
2151
+
2152
+ // Code block properties
2153
+ - (CGFloat)codeBlockFontSize
2154
+ {
2155
+ return _codeBlockFontSize;
2156
+ }
2157
+
2158
+ - (void)setCodeBlockFontSize:(CGFloat)newValue
2159
+ {
2160
+ _codeBlockFontSize = newValue;
2161
+ [_codeBlockFont invalidate];
2162
+ }
2163
+
2164
+ - (NSString *)codeBlockFontFamily
2165
+ {
2166
+ return _codeBlockFontFamily;
2167
+ }
2168
+
2169
+ - (void)setCodeBlockFontFamily:(NSString *)newValue
2170
+ {
2171
+ _codeBlockFontFamily = newValue;
2172
+ [_codeBlockFont invalidate];
2173
+ }
2174
+
2175
+ - (NSString *)codeBlockFontWeight
2176
+ {
2177
+ return _codeBlockFontWeight;
2178
+ }
2179
+
2180
+ - (void)setCodeBlockFontWeight:(NSString *)newValue
2181
+ {
2182
+ _codeBlockFontWeight = newValue;
2183
+ [_codeBlockFont invalidate];
2184
+ }
2185
+
2186
+ - (RCTUIColor *)codeBlockColor
2187
+ {
2188
+ return _codeBlockColor;
2189
+ }
2190
+
2191
+ - (void)setCodeBlockColor:(RCTUIColor *)newValue
2192
+ {
2193
+ _codeBlockColor = newValue;
2194
+ }
2195
+
2196
+ - (CGFloat)codeBlockMarginTop
2197
+ {
2198
+ return _codeBlockMarginTop;
2199
+ }
2200
+
2201
+ - (void)setCodeBlockMarginTop:(CGFloat)newValue
2202
+ {
2203
+ _codeBlockMarginTop = newValue;
2204
+ }
2205
+
2206
+ - (CGFloat)codeBlockMarginBottom
2207
+ {
2208
+ return _codeBlockMarginBottom;
2209
+ }
2210
+
2211
+ - (void)setCodeBlockMarginBottom:(CGFloat)newValue
2212
+ {
2213
+ _codeBlockMarginBottom = newValue;
2214
+ }
2215
+
2216
+ - (CGFloat)codeBlockLineHeight
2217
+ {
2218
+ if (_allowFontScaling && _codeBlockLineHeight > 0) {
2219
+ return _codeBlockLineHeight * RCTFontSizeMultiplierWithMax(_maxFontSizeMultiplier);
2220
+ }
2221
+ return _codeBlockLineHeight;
2222
+ }
2223
+
2224
+ - (void)setCodeBlockLineHeight:(CGFloat)newValue
2225
+ {
2226
+ _codeBlockLineHeight = newValue;
2227
+ }
2228
+
2229
+ - (RCTUIColor *)codeBlockBackgroundColor
2230
+ {
2231
+ return _codeBlockBackgroundColor;
2232
+ }
2233
+
2234
+ - (void)setCodeBlockBackgroundColor:(RCTUIColor *)newValue
2235
+ {
2236
+ _codeBlockBackgroundColor = newValue;
2237
+ }
2238
+
2239
+ - (RCTUIColor *)codeBlockBorderColor
2240
+ {
2241
+ return _codeBlockBorderColor;
2242
+ }
2243
+
2244
+ - (void)setCodeBlockBorderColor:(RCTUIColor *)newValue
2245
+ {
2246
+ _codeBlockBorderColor = newValue;
2247
+ }
2248
+
2249
+ - (CGFloat)codeBlockBorderRadius
2250
+ {
2251
+ return _codeBlockBorderRadius;
2252
+ }
2253
+
2254
+ - (void)setCodeBlockBorderRadius:(CGFloat)newValue
2255
+ {
2256
+ _codeBlockBorderRadius = newValue;
2257
+ }
2258
+
2259
+ - (CGFloat)codeBlockBorderWidth
2260
+ {
2261
+ return _codeBlockBorderWidth;
2262
+ }
2263
+
2264
+ - (void)setCodeBlockBorderWidth:(CGFloat)newValue
2265
+ {
2266
+ _codeBlockBorderWidth = newValue;
2267
+ }
2268
+
2269
+ - (CGFloat)codeBlockPadding
2270
+ {
2271
+ return _codeBlockPadding;
2272
+ }
2273
+
2274
+ - (void)setCodeBlockPadding:(CGFloat)newValue
2275
+ {
2276
+ _codeBlockPadding = newValue;
2277
+ }
2278
+
2279
+ - (UIFont *)codeBlockFont
2280
+ {
2281
+ if (_codeBlockFont.needsRecreation || !_codeBlockFont.cachedFont) {
2282
+ _codeBlockFont.cachedFont = [RCTFont updateFont:nil
2283
+ withFamily:_codeBlockFontFamily
2284
+ size:@(_codeBlockFontSize)
2285
+ weight:normalizedFontWeight(_codeBlockFontWeight)
2286
+ style:nil
2287
+ variant:nil
2288
+ scaleMultiplier:[self effectiveScaleMultiplierForFontSize:_codeBlockFontSize]];
2289
+ _codeBlockFont.needsRecreation = NO;
2290
+ }
2291
+ return _codeBlockFont.cachedFont;
2292
+ }
2293
+
2294
+ - (RCTUIColor *)codeBlockSyntaxColorForToken:(NSInteger)tokenType
2295
+ {
2296
+ if (tokenType < 0 || tokenType >= kENRMCodeBlockSyntaxColorCount) {
2297
+ return nil;
2298
+ }
2299
+ return _codeBlockSyntaxColors[tokenType];
2300
+ }
2301
+
2302
+ - (void)setCodeBlockSyntaxColor:(RCTUIColor *)newValue forToken:(NSInteger)tokenType
2303
+ {
2304
+ if (tokenType < 0 || tokenType >= kENRMCodeBlockSyntaxColorCount) {
2305
+ return;
2306
+ }
2307
+ _codeBlockSyntaxColors[tokenType] = newValue;
2308
+ }
2309
+
2310
+ // Thematic break properties
2311
+ - (RCTUIColor *)thematicBreakColor
2312
+ {
2313
+ return _thematicBreakColor;
2314
+ }
2315
+
2316
+ - (void)setThematicBreakColor:(RCTUIColor *)newValue
2317
+ {
2318
+ _thematicBreakColor = newValue;
2319
+ }
2320
+
2321
+ - (CGFloat)thematicBreakHeight
2322
+ {
2323
+ return _thematicBreakHeight;
2324
+ }
2325
+
2326
+ - (void)setThematicBreakHeight:(CGFloat)newValue
2327
+ {
2328
+ _thematicBreakHeight = newValue;
2329
+ }
2330
+
2331
+ - (CGFloat)thematicBreakMarginTop
2332
+ {
2333
+ return _thematicBreakMarginTop;
2334
+ }
2335
+
2336
+ - (void)setThematicBreakMarginTop:(CGFloat)newValue
2337
+ {
2338
+ _thematicBreakMarginTop = newValue;
2339
+ }
2340
+
2341
+ - (CGFloat)thematicBreakMarginBottom
2342
+ {
2343
+ return _thematicBreakMarginBottom;
2344
+ }
2345
+
2346
+ - (void)setThematicBreakMarginBottom:(CGFloat)newValue
2347
+ {
2348
+ _thematicBreakMarginBottom = newValue;
2349
+ }
2350
+
2351
+ // Table properties
2352
+ - (CGFloat)tableFontSize
2353
+ {
2354
+ return _tableFontSize;
2355
+ }
2356
+
2357
+ - (void)setTableFontSize:(CGFloat)newValue
2358
+ {
2359
+ _tableFontSize = newValue;
2360
+ [_tableFont invalidate];
2361
+ [_tableHeaderFont invalidate];
2362
+ }
2363
+
2364
+ - (NSString *)tableFontFamily
2365
+ {
2366
+ return _tableFontFamily;
2367
+ }
2368
+
2369
+ - (void)setTableFontFamily:(NSString *)newValue
2370
+ {
2371
+ _tableFontFamily = newValue;
2372
+ [_tableFont invalidate];
2373
+ [_tableHeaderFont invalidate];
2374
+ }
2375
+
2376
+ - (NSString *)tableFontWeight
2377
+ {
2378
+ return _tableFontWeight;
2379
+ }
2380
+
2381
+ - (void)setTableFontWeight:(NSString *)newValue
2382
+ {
2383
+ _tableFontWeight = newValue;
2384
+ [_tableFont invalidate];
2385
+ }
2386
+
2387
+ - (RCTUIColor *)tableColor
2388
+ {
2389
+ return _tableColor;
2390
+ }
2391
+
2392
+ - (void)setTableColor:(RCTUIColor *)newValue
2393
+ {
2394
+ _tableColor = newValue;
2395
+ }
2396
+
2397
+ - (CGFloat)tableMarginTop
2398
+ {
2399
+ return _tableMarginTop;
2400
+ }
2401
+
2402
+ - (void)setTableMarginTop:(CGFloat)newValue
2403
+ {
2404
+ _tableMarginTop = newValue;
2405
+ }
2406
+
2407
+ - (CGFloat)tableMarginBottom
2408
+ {
2409
+ return _tableMarginBottom;
2410
+ }
2411
+
2412
+ - (void)setTableMarginBottom:(CGFloat)newValue
2413
+ {
2414
+ _tableMarginBottom = newValue;
2415
+ }
2416
+
2417
+ - (CGFloat)tableLineHeight
2418
+ {
2419
+ if (_allowFontScaling && _tableLineHeight > 0) {
2420
+ return _tableLineHeight * RCTFontSizeMultiplierWithMax(_maxFontSizeMultiplier);
2421
+ }
2422
+ return _tableLineHeight;
2423
+ }
2424
+
2425
+ - (void)setTableLineHeight:(CGFloat)newValue
2426
+ {
2427
+ _tableLineHeight = newValue;
2428
+ }
2429
+
2430
+ - (UIFont *)tableFont
2431
+ {
2432
+ if (_tableFont.needsRecreation || !_tableFont.cachedFont) {
2433
+ _tableFont.cachedFont = [RCTFont updateFont:nil
2434
+ withFamily:_tableFontFamily
2435
+ size:@(_tableFontSize)
2436
+ weight:normalizedFontWeight(_tableFontWeight)
2437
+ style:nil
2438
+ variant:nil
2439
+ scaleMultiplier:[self effectiveScaleMultiplierForFontSize:_tableFontSize]];
2440
+ _tableFont.needsRecreation = NO;
2441
+ }
2442
+ return _tableFont.cachedFont;
2443
+ }
2444
+
2445
+ - (NSString *)tableHeaderFontFamily
2446
+ {
2447
+ return _tableHeaderFontFamily;
2448
+ }
2449
+
2450
+ - (void)setTableHeaderFontFamily:(NSString *)newValue
2451
+ {
2452
+ _tableHeaderFontFamily = newValue;
2453
+ [_tableHeaderFont invalidate];
2454
+ }
2455
+
2456
+ - (UIFont *)tableHeaderFont
2457
+ {
2458
+ if (_tableHeaderFont.needsRecreation || !_tableHeaderFont.cachedFont) {
2459
+ NSString *family = (_tableHeaderFontFamily.length > 0) ? _tableHeaderFontFamily : _tableFontFamily;
2460
+ _tableHeaderFont.cachedFont = [RCTFont updateFont:nil
2461
+ withFamily:family
2462
+ size:@(_tableFontSize)
2463
+ weight:normalizedFontWeight(@"bold")
2464
+ style:nil
2465
+ variant:nil
2466
+ scaleMultiplier:[self effectiveScaleMultiplierForFontSize:_tableFontSize]];
2467
+ _tableHeaderFont.needsRecreation = NO;
2468
+ }
2469
+ return _tableHeaderFont.cachedFont;
2470
+ }
2471
+
2472
+ - (RCTUIColor *)tableHeaderBackgroundColor
2473
+ {
2474
+ return _tableHeaderBackgroundColor;
2475
+ }
2476
+
2477
+ - (void)setTableHeaderBackgroundColor:(RCTUIColor *)newValue
2478
+ {
2479
+ _tableHeaderBackgroundColor = newValue;
2480
+ }
2481
+
2482
+ - (RCTUIColor *)tableHeaderTextColor
2483
+ {
2484
+ return _tableHeaderTextColor;
2485
+ }
2486
+
2487
+ - (void)setTableHeaderTextColor:(RCTUIColor *)newValue
2488
+ {
2489
+ _tableHeaderTextColor = newValue;
2490
+ }
2491
+
2492
+ - (RCTUIColor *)tableRowEvenBackgroundColor
2493
+ {
2494
+ return _tableRowEvenBackgroundColor;
2495
+ }
2496
+
2497
+ - (void)setTableRowEvenBackgroundColor:(RCTUIColor *)newValue
2498
+ {
2499
+ _tableRowEvenBackgroundColor = newValue;
2500
+ }
2501
+
2502
+ - (RCTUIColor *)tableRowOddBackgroundColor
2503
+ {
2504
+ return _tableRowOddBackgroundColor;
2505
+ }
2506
+
2507
+ - (void)setTableRowOddBackgroundColor:(RCTUIColor *)newValue
2508
+ {
2509
+ _tableRowOddBackgroundColor = newValue;
2510
+ }
2511
+
2512
+ - (RCTUIColor *)tableBorderColor
2513
+ {
2514
+ return _tableBorderColor;
2515
+ }
2516
+
2517
+ - (void)setTableBorderColor:(RCTUIColor *)newValue
2518
+ {
2519
+ _tableBorderColor = newValue;
2520
+ }
2521
+
2522
+ - (CGFloat)tableBorderWidth
2523
+ {
2524
+ return _tableBorderWidth;
2525
+ }
2526
+
2527
+ - (void)setTableBorderWidth:(CGFloat)newValue
2528
+ {
2529
+ _tableBorderWidth = newValue;
2530
+ }
2531
+
2532
+ - (CGFloat)tableBorderRadius
2533
+ {
2534
+ return _tableBorderRadius;
2535
+ }
2536
+
2537
+ - (void)setTableBorderRadius:(CGFloat)newValue
2538
+ {
2539
+ _tableBorderRadius = newValue;
2540
+ }
2541
+
2542
+ - (CGFloat)tableCellPaddingHorizontal
2543
+ {
2544
+ return _tableCellPaddingHorizontal;
2545
+ }
2546
+
2547
+ - (void)setTableCellPaddingHorizontal:(CGFloat)newValue
2548
+ {
2549
+ _tableCellPaddingHorizontal = newValue;
2550
+ }
2551
+
2552
+ - (CGFloat)tableCellPaddingVertical
2553
+ {
2554
+ return _tableCellPaddingVertical;
2555
+ }
2556
+
2557
+ - (void)setTableCellPaddingVertical:(CGFloat)newValue
2558
+ {
2559
+ _tableCellPaddingVertical = newValue;
2560
+ }
2561
+
2562
+ - (CGFloat)tableHorizontalOverflow
2563
+ {
2564
+ return _tableHorizontalOverflow;
2565
+ }
2566
+
2567
+ - (void)setTableHorizontalOverflow:(CGFloat)newValue
2568
+ {
2569
+ _tableHorizontalOverflow = newValue;
2570
+ }
2571
+
2572
+ - (NSString *)tableAlign
2573
+ {
2574
+ return _tableAlign ?: @"";
2575
+ }
2576
+
2577
+ - (void)setTableAlign:(NSString *)newValue
2578
+ {
2579
+ _tableAlign = newValue;
2580
+ }
2581
+
2582
+ // Task list
2583
+
2584
+ - (RCTUIColor *)taskListCheckedColor
2585
+ {
2586
+ return _taskListCheckedColor;
2587
+ }
2588
+
2589
+ - (void)setTaskListCheckedColor:(RCTUIColor *)newValue
2590
+ {
2591
+ _taskListCheckedColor = newValue;
2592
+ }
2593
+
2594
+ - (RCTUIColor *)taskListBorderColor
2595
+ {
2596
+ return _taskListBorderColor;
2597
+ }
2598
+
2599
+ - (void)setTaskListBorderColor:(RCTUIColor *)newValue
2600
+ {
2601
+ _taskListBorderColor = newValue;
2602
+ }
2603
+
2604
+ - (CGFloat)taskListCheckboxSize
2605
+ {
2606
+ return _taskListCheckboxSize;
2607
+ }
2608
+
2609
+ - (void)setTaskListCheckboxSize:(CGFloat)newValue
2610
+ {
2611
+ _taskListCheckboxSize = newValue;
2612
+ }
2613
+
2614
+ - (CGFloat)taskListCheckboxBorderRadius
2615
+ {
2616
+ return _taskListCheckboxBorderRadius;
2617
+ }
2618
+
2619
+ - (void)setTaskListCheckboxBorderRadius:(CGFloat)newValue
2620
+ {
2621
+ _taskListCheckboxBorderRadius = newValue;
2622
+ }
2623
+
2624
+ - (RCTUIColor *)taskListCheckmarkColor
2625
+ {
2626
+ return _taskListCheckmarkColor;
2627
+ }
2628
+
2629
+ - (void)setTaskListCheckmarkColor:(RCTUIColor *)newValue
2630
+ {
2631
+ _taskListCheckmarkColor = newValue;
2632
+ }
2633
+
2634
+ - (RCTUIColor *)taskListCheckedTextColor
2635
+ {
2636
+ return _taskListCheckedTextColor;
2637
+ }
2638
+
2639
+ - (void)setTaskListCheckedTextColor:(RCTUIColor *)newValue
2640
+ {
2641
+ _taskListCheckedTextColor = newValue;
2642
+ }
2643
+
2644
+ - (BOOL)taskListCheckedStrikethrough
2645
+ {
2646
+ return _taskListCheckedStrikethrough;
2647
+ }
2648
+
2649
+ - (void)setTaskListCheckedStrikethrough:(BOOL)newValue
2650
+ {
2651
+ _taskListCheckedStrikethrough = newValue;
2652
+ }
2653
+
2654
+ // Math
2655
+
2656
+ - (CGFloat)mathFontSize
2657
+ {
2658
+ return _mathFontSize;
2659
+ }
2660
+
2661
+ - (void)setMathFontSize:(CGFloat)newValue
2662
+ {
2663
+ _mathFontSize = newValue;
2664
+ }
2665
+
2666
+ - (RCTUIColor *)mathColor
2667
+ {
2668
+ return _mathColor;
2669
+ }
2670
+
2671
+ - (void)setMathColor:(RCTUIColor *)newValue
2672
+ {
2673
+ _mathColor = newValue;
2674
+ }
2675
+
2676
+ - (RCTUIColor *)mathBackgroundColor
2677
+ {
2678
+ return _mathBackgroundColor;
2679
+ }
2680
+
2681
+ - (void)setMathBackgroundColor:(RCTUIColor *)newValue
2682
+ {
2683
+ _mathBackgroundColor = newValue;
2684
+ }
2685
+
2686
+ - (CGFloat)mathPadding
2687
+ {
2688
+ return _mathPadding;
2689
+ }
2690
+
2691
+ - (void)setMathPadding:(CGFloat)newValue
2692
+ {
2693
+ _mathPadding = newValue;
2694
+ }
2695
+
2696
+ - (CGFloat)mathMarginTop
2697
+ {
2698
+ return _mathMarginTop;
2699
+ }
2700
+
2701
+ - (void)setMathMarginTop:(CGFloat)newValue
2702
+ {
2703
+ _mathMarginTop = newValue;
2704
+ }
2705
+
2706
+ - (CGFloat)mathMarginBottom
2707
+ {
2708
+ return _mathMarginBottom;
2709
+ }
2710
+
2711
+ - (void)setMathMarginBottom:(CGFloat)newValue
2712
+ {
2713
+ _mathMarginBottom = newValue;
2714
+ }
2715
+
2716
+ - (NSString *)mathTextAlign
2717
+ {
2718
+ return _mathTextAlign ?: @"center";
2719
+ }
2720
+
2721
+ - (void)setMathTextAlign:(NSString *)newValue
2722
+ {
2723
+ _mathTextAlign = newValue;
2724
+ }
2725
+
2726
+ // ── Inline Math ─────────────────────────────────────────────────────────────
2727
+
2728
+ - (RCTUIColor *)inlineMathColor
2729
+ {
2730
+ return _inlineMathColor;
2731
+ }
2732
+
2733
+ - (void)setInlineMathColor:(RCTUIColor *)newValue
2734
+ {
2735
+ _inlineMathColor = newValue;
2736
+ }
2737
+
2738
+ // ── Spoiler ─────────────────────────────────────────────────────────────
2739
+
2740
+ - (RCTUIColor *)spoilerColor
2741
+ {
2742
+ return _spoilerColor;
2743
+ }
2744
+
2745
+ - (void)setSpoilerColor:(RCTUIColor *)newValue
2746
+ {
2747
+ _spoilerColor = newValue;
2748
+ }
2749
+
2750
+ - (CGFloat)spoilerParticleDensity
2751
+ {
2752
+ return _spoilerParticleDensity;
2753
+ }
2754
+
2755
+ - (void)setSpoilerParticleDensity:(CGFloat)newValue
2756
+ {
2757
+ _spoilerParticleDensity = newValue;
2758
+ }
2759
+
2760
+ - (CGFloat)spoilerParticleSpeed
2761
+ {
2762
+ return _spoilerParticleSpeed;
2763
+ }
2764
+
2765
+ - (void)setSpoilerParticleSpeed:(CGFloat)newValue
2766
+ {
2767
+ _spoilerParticleSpeed = newValue;
2768
+ }
2769
+
2770
+ - (CGFloat)spoilerSolidBorderRadius
2771
+ {
2772
+ return _spoilerSolidBorderRadius;
2773
+ }
2774
+
2775
+ - (void)setSpoilerSolidBorderRadius:(CGFloat)newValue
2776
+ {
2777
+ _spoilerSolidBorderRadius = newValue;
2778
+ }
2779
+
2780
+ - (CGFloat)superscriptFontScale
2781
+ {
2782
+ return _superscriptFontScale;
2783
+ }
2784
+
2785
+ - (void)setSuperscriptFontScale:(CGFloat)newValue
2786
+ {
2787
+ _superscriptFontScale = newValue;
2788
+ }
2789
+
2790
+ - (CGFloat)superscriptBaselineOffsetScale
2791
+ {
2792
+ return _superscriptBaselineOffsetScale;
2793
+ }
2794
+
2795
+ - (void)setSuperscriptBaselineOffsetScale:(CGFloat)newValue
2796
+ {
2797
+ _superscriptBaselineOffsetScale = newValue;
2798
+ }
2799
+
2800
+ - (CGFloat)subscriptFontScale
2801
+ {
2802
+ return _subscriptFontScale;
2803
+ }
2804
+
2805
+ - (void)setSubscriptFontScale:(CGFloat)newValue
2806
+ {
2807
+ _subscriptFontScale = newValue;
2808
+ }
2809
+
2810
+ - (CGFloat)subscriptBaselineOffsetScale
2811
+ {
2812
+ return _subscriptBaselineOffsetScale;
2813
+ }
2814
+
2815
+ - (void)setSubscriptBaselineOffsetScale:(CGFloat)newValue
2816
+ {
2817
+ _subscriptBaselineOffsetScale = newValue;
2818
+ }
2819
+
2820
+ @end