@react-native-ohos/react-native-svg 15.12.1-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (280) hide show
  1. package/LICENSE +21 -0
  2. package/README.OpenSource +11 -0
  3. package/README.md +13 -0
  4. package/css/package.json +6 -0
  5. package/harmony/svg/BuildProfile.ets +17 -0
  6. package/harmony/svg/build-profile.json5 +9 -0
  7. package/harmony/svg/hvigorfile.ts +2 -0
  8. package/harmony/svg/index.ets +7 -0
  9. package/harmony/svg/oh-package.json5 +13 -0
  10. package/harmony/svg/src/main/cpp/Attribute.h +52 -0
  11. package/harmony/svg/src/main/cpp/CMakeLists.txt +32 -0
  12. package/harmony/svg/src/main/cpp/FallbackProps.h +0 -0
  13. package/harmony/svg/src/main/cpp/FontHolderBase.cpp +22 -0
  14. package/harmony/svg/src/main/cpp/FontHolderBase.h +54 -0
  15. package/harmony/svg/src/main/cpp/SVGPackage.cpp +135 -0
  16. package/harmony/svg/src/main/cpp/SVGPackage.h +153 -0
  17. package/harmony/svg/src/main/cpp/SvgArkUINode.cpp +75 -0
  18. package/harmony/svg/src/main/cpp/SvgArkUINode.h +45 -0
  19. package/harmony/svg/src/main/cpp/SvgBaseAttribute.h +83 -0
  20. package/harmony/svg/src/main/cpp/SvgCircle.cpp +29 -0
  21. package/harmony/svg/src/main/cpp/SvgCircle.h +29 -0
  22. package/harmony/svg/src/main/cpp/SvgClipPath.h +22 -0
  23. package/harmony/svg/src/main/cpp/SvgContext.cpp +56 -0
  24. package/harmony/svg/src/main/cpp/SvgContext.h +71 -0
  25. package/harmony/svg/src/main/cpp/SvgDefs.h +46 -0
  26. package/harmony/svg/src/main/cpp/SvgEllipse.cpp +32 -0
  27. package/harmony/svg/src/main/cpp/SvgEllipse.h +34 -0
  28. package/harmony/svg/src/main/cpp/SvgFilter.cpp +505 -0
  29. package/harmony/svg/src/main/cpp/SvgFilter.h +112 -0
  30. package/harmony/svg/src/main/cpp/SvgGradient.cpp +116 -0
  31. package/harmony/svg/src/main/cpp/SvgGradient.h +49 -0
  32. package/harmony/svg/src/main/cpp/SvgGraphic.cpp +553 -0
  33. package/harmony/svg/src/main/cpp/SvgGraphic.h +77 -0
  34. package/harmony/svg/src/main/cpp/SvgGroup.cpp +86 -0
  35. package/harmony/svg/src/main/cpp/SvgGroup.h +41 -0
  36. package/harmony/svg/src/main/cpp/SvgHost.cpp +27 -0
  37. package/harmony/svg/src/main/cpp/SvgHost.h +38 -0
  38. package/harmony/svg/src/main/cpp/SvgImage.cpp +168 -0
  39. package/harmony/svg/src/main/cpp/SvgImage.h +52 -0
  40. package/harmony/svg/src/main/cpp/SvgLine.cpp +28 -0
  41. package/harmony/svg/src/main/cpp/SvgLine.h +32 -0
  42. package/harmony/svg/src/main/cpp/SvgMarker.cpp +61 -0
  43. package/harmony/svg/src/main/cpp/SvgMarker.h +86 -0
  44. package/harmony/svg/src/main/cpp/SvgMask.cpp +72 -0
  45. package/harmony/svg/src/main/cpp/SvgMask.h +68 -0
  46. package/harmony/svg/src/main/cpp/SvgNode.cpp +289 -0
  47. package/harmony/svg/src/main/cpp/SvgNode.h +347 -0
  48. package/harmony/svg/src/main/cpp/SvgPath.cpp +42 -0
  49. package/harmony/svg/src/main/cpp/SvgPath.h +29 -0
  50. package/harmony/svg/src/main/cpp/SvgPattern.cpp +77 -0
  51. package/harmony/svg/src/main/cpp/SvgPattern.h +64 -0
  52. package/harmony/svg/src/main/cpp/SvgQuote.h +87 -0
  53. package/harmony/svg/src/main/cpp/SvgRect.cpp +58 -0
  54. package/harmony/svg/src/main/cpp/SvgRect.h +33 -0
  55. package/harmony/svg/src/main/cpp/SvgSvg.cpp +83 -0
  56. package/harmony/svg/src/main/cpp/SvgSvg.h +52 -0
  57. package/harmony/svg/src/main/cpp/SvgSymbol.cpp +25 -0
  58. package/harmony/svg/src/main/cpp/SvgSymbol.h +37 -0
  59. package/harmony/svg/src/main/cpp/SvgTSpan.cpp +501 -0
  60. package/harmony/svg/src/main/cpp/SvgTSpan.h +101 -0
  61. package/harmony/svg/src/main/cpp/SvgText.cpp +48 -0
  62. package/harmony/svg/src/main/cpp/SvgText.h +29 -0
  63. package/harmony/svg/src/main/cpp/SvgTextPath.cpp +35 -0
  64. package/harmony/svg/src/main/cpp/SvgTextPath.h +51 -0
  65. package/harmony/svg/src/main/cpp/SvgUse.cpp +65 -0
  66. package/harmony/svg/src/main/cpp/SvgUse.h +46 -0
  67. package/harmony/svg/src/main/cpp/SvgViewManager.cpp +36 -0
  68. package/harmony/svg/src/main/cpp/SvgViewManager.h +37 -0
  69. package/harmony/svg/src/main/cpp/TextBase.cpp +20 -0
  70. package/harmony/svg/src/main/cpp/TextBase.h +114 -0
  71. package/harmony/svg/src/main/cpp/componentInstances/RNSVGBaseComponentInstance.h +212 -0
  72. package/harmony/svg/src/main/cpp/componentInstances/RNSVGCircleComponentInstance.cpp +31 -0
  73. package/harmony/svg/src/main/cpp/componentInstances/RNSVGCircleComponentInstance.h +27 -0
  74. package/harmony/svg/src/main/cpp/componentInstances/RNSVGClipPathComponentInstance.cpp +23 -0
  75. package/harmony/svg/src/main/cpp/componentInstances/RNSVGClipPathComponentInstance.h +27 -0
  76. package/harmony/svg/src/main/cpp/componentInstances/RNSVGDefsComponentInstance.cpp +23 -0
  77. package/harmony/svg/src/main/cpp/componentInstances/RNSVGDefsComponentInstance.h +28 -0
  78. package/harmony/svg/src/main/cpp/componentInstances/RNSVGEllipseComponentInstance.cpp +27 -0
  79. package/harmony/svg/src/main/cpp/componentInstances/RNSVGEllipseComponentInstance.h +27 -0
  80. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeBlendComponentInstance.cpp +40 -0
  81. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeBlendComponentInstance.h +48 -0
  82. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeColorMatrixComponentInstance.cpp +33 -0
  83. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeColorMatrixComponentInstance.h +48 -0
  84. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeCompositeComponentInstance.cpp +39 -0
  85. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeCompositeComponentInstance.h +55 -0
  86. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeFloodComponentInstance.cpp +33 -0
  87. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeFloodComponentInstance.h +49 -0
  88. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeGaussianBlurComponentInstance.cpp +34 -0
  89. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeGaussianBlurComponentInstance.h +48 -0
  90. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeOffsetComponentInstance.cpp +35 -0
  91. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeOffsetComponentInstance.h +46 -0
  92. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFilterComponentInstance.cpp +199 -0
  93. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFilterComponentInstance.h +48 -0
  94. package/harmony/svg/src/main/cpp/componentInstances/RNSVGGroupComponentInstance.cpp +32 -0
  95. package/harmony/svg/src/main/cpp/componentInstances/RNSVGGroupComponentInstance.h +27 -0
  96. package/harmony/svg/src/main/cpp/componentInstances/RNSVGImageComponentInstance.cpp +100 -0
  97. package/harmony/svg/src/main/cpp/componentInstances/RNSVGImageComponentInstance.h +43 -0
  98. package/harmony/svg/src/main/cpp/componentInstances/RNSVGLineComponentInstance.cpp +27 -0
  99. package/harmony/svg/src/main/cpp/componentInstances/RNSVGLineComponentInstance.h +27 -0
  100. package/harmony/svg/src/main/cpp/componentInstances/RNSVGLinearGradientComponentInstance.cpp +30 -0
  101. package/harmony/svg/src/main/cpp/componentInstances/RNSVGLinearGradientComponentInstance.h +28 -0
  102. package/harmony/svg/src/main/cpp/componentInstances/RNSVGMarkerComponentInstance.cpp +35 -0
  103. package/harmony/svg/src/main/cpp/componentInstances/RNSVGMarkerComponentInstance.h +27 -0
  104. package/harmony/svg/src/main/cpp/componentInstances/RNSVGMaskComponentInstance.cpp +30 -0
  105. package/harmony/svg/src/main/cpp/componentInstances/RNSVGMaskComponentInstance.h +27 -0
  106. package/harmony/svg/src/main/cpp/componentInstances/RNSVGPathComponentInstance.cpp +33 -0
  107. package/harmony/svg/src/main/cpp/componentInstances/RNSVGPathComponentInstance.h +29 -0
  108. package/harmony/svg/src/main/cpp/componentInstances/RNSVGPatternComponentInstance.cpp +40 -0
  109. package/harmony/svg/src/main/cpp/componentInstances/RNSVGPatternComponentInstance.h +27 -0
  110. package/harmony/svg/src/main/cpp/componentInstances/RNSVGRadialGradientComponentInstance.cpp +32 -0
  111. package/harmony/svg/src/main/cpp/componentInstances/RNSVGRadialGradientComponentInstance.h +28 -0
  112. package/harmony/svg/src/main/cpp/componentInstances/RNSVGRectComponentInstance.cpp +36 -0
  113. package/harmony/svg/src/main/cpp/componentInstances/RNSVGRectComponentInstance.h +27 -0
  114. package/harmony/svg/src/main/cpp/componentInstances/RNSVGSvgViewComponentInstance.cpp +86 -0
  115. package/harmony/svg/src/main/cpp/componentInstances/RNSVGSvgViewComponentInstance.h +47 -0
  116. package/harmony/svg/src/main/cpp/componentInstances/RNSVGSymbolComponentInstance.cpp +30 -0
  117. package/harmony/svg/src/main/cpp/componentInstances/RNSVGSymbolComponentInstance.h +27 -0
  118. package/harmony/svg/src/main/cpp/componentInstances/RNSVGTSpanComponentInstance.cpp +27 -0
  119. package/harmony/svg/src/main/cpp/componentInstances/RNSVGTSpanComponentInstance.h +27 -0
  120. package/harmony/svg/src/main/cpp/componentInstances/RNSVGTextComponentInstance.cpp +25 -0
  121. package/harmony/svg/src/main/cpp/componentInstances/RNSVGTextComponentInstance.h +27 -0
  122. package/harmony/svg/src/main/cpp/componentInstances/RNSVGTextPathComponentInstance.cpp +32 -0
  123. package/harmony/svg/src/main/cpp/componentInstances/RNSVGTextPathComponentInstance.h +27 -0
  124. package/harmony/svg/src/main/cpp/componentInstances/RNSVGUseComponentInstance.cpp +32 -0
  125. package/harmony/svg/src/main/cpp/componentInstances/RNSVGUseComponentInstance.h +32 -0
  126. package/harmony/svg/src/main/cpp/downloadUtils/HttpTaskProcessor.cpp +207 -0
  127. package/harmony/svg/src/main/cpp/downloadUtils/HttpTaskProcessor.h +88 -0
  128. package/harmony/svg/src/main/cpp/downloadUtils/ImageSourceResolver.cpp +106 -0
  129. package/harmony/svg/src/main/cpp/downloadUtils/ImageSourceResolver.h +97 -0
  130. package/harmony/svg/src/main/cpp/downloadUtils/LRUCache.h +98 -0
  131. package/harmony/svg/src/main/cpp/drawing/Brush.cpp +50 -0
  132. package/harmony/svg/src/main/cpp/drawing/Brush.h +52 -0
  133. package/harmony/svg/src/main/cpp/drawing/GlyPathBag.cpp +20 -0
  134. package/harmony/svg/src/main/cpp/drawing/GlyPathBag.h +31 -0
  135. package/harmony/svg/src/main/cpp/drawing/Matrix.cpp +100 -0
  136. package/harmony/svg/src/main/cpp/drawing/Matrix.h +68 -0
  137. package/harmony/svg/src/main/cpp/drawing/Path.cpp +173 -0
  138. package/harmony/svg/src/main/cpp/drawing/Path.h +127 -0
  139. package/harmony/svg/src/main/cpp/drawing/Pen.cpp +57 -0
  140. package/harmony/svg/src/main/cpp/drawing/Pen.h +59 -0
  141. package/harmony/svg/src/main/cpp/drawing/Rect.cpp +47 -0
  142. package/harmony/svg/src/main/cpp/drawing/Rect.h +56 -0
  143. package/harmony/svg/src/main/cpp/drawing/RoundRect.cpp +24 -0
  144. package/harmony/svg/src/main/cpp/drawing/RoundRect.h +39 -0
  145. package/harmony/svg/src/main/cpp/drawing/ShaderEffect.cpp +37 -0
  146. package/harmony/svg/src/main/cpp/drawing/ShaderEffect.h +51 -0
  147. package/harmony/svg/src/main/cpp/drawing/TextStyle.cpp +49 -0
  148. package/harmony/svg/src/main/cpp/drawing/TextStyle.h +41 -0
  149. package/harmony/svg/src/main/cpp/drawing/Typography.cpp +9 -0
  150. package/harmony/svg/src/main/cpp/drawing/Typography.h +25 -0
  151. package/harmony/svg/src/main/cpp/drawing/TypographyStyle.cpp +31 -0
  152. package/harmony/svg/src/main/cpp/drawing/TypographyStyle.h +41 -0
  153. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGCircleJSIBinder.h +54 -0
  154. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGClipPathJSIBinder.h +54 -0
  155. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGDefsJSIBinder.h +38 -0
  156. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGEllipseJSIBinder.h +55 -0
  157. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGFeBlendJSIBinder.h +26 -0
  158. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGFeColorMatrixJSIBinder.h +26 -0
  159. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGFeCompositeJSIBinder.h +30 -0
  160. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGFeFloodJSIBinder.h +26 -0
  161. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGFeGaussianBlurJSIBinder.h +27 -0
  162. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGFeOffsetJSIBinder.h +26 -0
  163. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGFilterJSIBinder.h +44 -0
  164. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGForeignObjectJSIBinder.h +57 -0
  165. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGGroupJSIBinder.h +54 -0
  166. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGImageJSIBinder.h +58 -0
  167. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGLineJSIBinder.h +55 -0
  168. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGLinearGradientJSIBinder.h +45 -0
  169. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGMarkerJSIBinder.h +66 -0
  170. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGMaskJSIBinder.h +60 -0
  171. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGPathJSIBinder.h +52 -0
  172. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGPatternJSIBinder.h +67 -0
  173. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGRadialGradientJSIBinder.h +47 -0
  174. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGRectJSIBinder.h +57 -0
  175. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGSvgViewAndroidJSIBinder.h +67 -0
  176. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGSvgViewJSIBinder.h +36 -0
  177. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGSymbolJSIBinder.h +60 -0
  178. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGTSpanJSIBinder.h +66 -0
  179. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGTextJSIBinder.h +65 -0
  180. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGTextPathJSIBinder.h +71 -0
  181. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGUseJSIBinder.h +56 -0
  182. package/harmony/svg/src/main/cpp/generated/react/renderer/components/react_native_svg/ComponentDescriptors.h +48 -0
  183. package/harmony/svg/src/main/cpp/generated/react/renderer/components/react_native_svg/EventEmitters.cpp +20 -0
  184. package/harmony/svg/src/main/cpp/generated/react/renderer/components/react_native_svg/EventEmitters.h +253 -0
  185. package/harmony/svg/src/main/cpp/generated/react/renderer/components/react_native_svg/Props.cpp +977 -0
  186. package/harmony/svg/src/main/cpp/generated/react/renderer/components/react_native_svg/Props.h +1280 -0
  187. package/harmony/svg/src/main/cpp/generated/react/renderer/components/react_native_svg/ShadowNodes.cpp +45 -0
  188. package/harmony/svg/src/main/cpp/generated/react/renderer/components/react_native_svg/ShadowNodes.h +331 -0
  189. package/harmony/svg/src/main/cpp/generated/react/renderer/components/react_native_svg/States.cpp +18 -0
  190. package/harmony/svg/src/main/cpp/generated/react/renderer/components/react_native_svg/States.h +441 -0
  191. package/harmony/svg/src/main/cpp/properties/Color.cpp +458 -0
  192. package/harmony/svg/src/main/cpp/properties/Color.h +144 -0
  193. package/harmony/svg/src/main/cpp/properties/Decoration.cpp +41 -0
  194. package/harmony/svg/src/main/cpp/properties/Decoration.h +483 -0
  195. package/harmony/svg/src/main/cpp/properties/Dimension.cpp +64 -0
  196. package/harmony/svg/src/main/cpp/properties/Dimension.h +243 -0
  197. package/harmony/svg/src/main/cpp/properties/Font.cpp +166 -0
  198. package/harmony/svg/src/main/cpp/properties/Font.h +163 -0
  199. package/harmony/svg/src/main/cpp/properties/Offset.h +119 -0
  200. package/harmony/svg/src/main/cpp/properties/PaintState.h +240 -0
  201. package/harmony/svg/src/main/cpp/properties/Rect.h +423 -0
  202. package/harmony/svg/src/main/cpp/properties/Size.h +246 -0
  203. package/harmony/svg/src/main/cpp/properties/SvgPaintState.h +452 -0
  204. package/harmony/svg/src/main/cpp/properties/TextProperties.cpp +91 -0
  205. package/harmony/svg/src/main/cpp/properties/TextProperties.h +56 -0
  206. package/harmony/svg/src/main/cpp/properties/ViewBox.h +108 -0
  207. package/harmony/svg/src/main/cpp/svgImage/RNSVGImageComponentDescriptor.h +41 -0
  208. package/harmony/svg/src/main/cpp/svgImage/RNSVGImageShadowNode.cpp +62 -0
  209. package/harmony/svg/src/main/cpp/svgImage/RNSVGImageShadowNode.h +63 -0
  210. package/harmony/svg/src/main/cpp/svgImage/RNSVGImageState.cpp +17 -0
  211. package/harmony/svg/src/main/cpp/svgImage/RNSVGImageState.h +58 -0
  212. package/harmony/svg/src/main/cpp/turboModules/RNSVGImageModule.cpp +54 -0
  213. package/harmony/svg/src/main/cpp/turboModules/RNSVGImageModule.h +32 -0
  214. package/harmony/svg/src/main/cpp/turboModules/RNSVGRenderableModule.cpp +101 -0
  215. package/harmony/svg/src/main/cpp/turboModules/RNSVGRenderableModule.h +32 -0
  216. package/harmony/svg/src/main/cpp/turboModules/RNSVGSvgViewModule.cpp +71 -0
  217. package/harmony/svg/src/main/cpp/turboModules/RNSVGSvgViewModule.h +32 -0
  218. package/harmony/svg/src/main/cpp/utils/DynamicUtils.h +55 -0
  219. package/harmony/svg/src/main/cpp/utils/FilterManager.h +190 -0
  220. package/harmony/svg/src/main/cpp/utils/GlyphContext.cpp +221 -0
  221. package/harmony/svg/src/main/cpp/utils/GlyphContext.h +106 -0
  222. package/harmony/svg/src/main/cpp/utils/LinearMap.h +69 -0
  223. package/harmony/svg/src/main/cpp/utils/PathParserUtils.cpp +591 -0
  224. package/harmony/svg/src/main/cpp/utils/PathParserUtils.h +93 -0
  225. package/harmony/svg/src/main/cpp/utils/StringUtils.cpp +134 -0
  226. package/harmony/svg/src/main/cpp/utils/StringUtils.h +644 -0
  227. package/harmony/svg/src/main/cpp/utils/SvgAttributesParser.cpp +239 -0
  228. package/harmony/svg/src/main/cpp/utils/SvgAttributesParser.h +277 -0
  229. package/harmony/svg/src/main/cpp/utils/SvgMarkerPositionUtils.h +200 -0
  230. package/harmony/svg/src/main/cpp/utils/SvgUtils.h +176 -0
  231. package/harmony/svg/src/main/cpp/utils/TextPathHelper.cpp +94 -0
  232. package/harmony/svg/src/main/cpp/utils/TextPathHelper.h +61 -0
  233. package/harmony/svg/src/main/ets/RNSVGImageModule.ts +21 -0
  234. package/harmony/svg/src/main/ets/RNSVGRenderableModule.ts +16 -0
  235. package/harmony/svg/src/main/ets/RNSVGSvgViewModule.ts +18 -0
  236. package/harmony/svg/src/main/ets/SvgPackage.ts +58 -0
  237. package/harmony/svg/src/main/module.json5 +7 -0
  238. package/harmony/svg/src/main/resources/base/element/string.json +8 -0
  239. package/harmony/svg/src/main/resources/en_US/element/string.json +8 -0
  240. package/harmony/svg/src/main/resources/zh_CN/element/string.json +8 -0
  241. package/harmony/svg/ts.ts +8 -0
  242. package/harmony/svg.har +0 -0
  243. package/lib/commonjs/css/index.js +55 -0
  244. package/lib/commonjs/css/index.js.map +1 -0
  245. package/lib/commonjs/index.js +26 -0
  246. package/lib/commonjs/index.js.map +1 -0
  247. package/lib/module/css/index.js +4 -0
  248. package/lib/module/css/index.js.map +1 -0
  249. package/lib/module/index.js +3 -0
  250. package/lib/module/index.js.map +1 -0
  251. package/lib/typescript/babel.config.d.ts +8 -0
  252. package/lib/typescript/babel.config.d.ts.map +1 -0
  253. package/lib/typescript/example/babel.config.d.ts +3 -0
  254. package/lib/typescript/example/babel.config.d.ts.map +1 -0
  255. package/lib/typescript/example/contexts.d.ts +3 -0
  256. package/lib/typescript/example/contexts.d.ts.map +1 -0
  257. package/lib/typescript/example/harmony/entry/hvigorfile.d.ts +2 -0
  258. package/lib/typescript/example/harmony/entry/hvigorfile.d.ts.map +1 -0
  259. package/lib/typescript/example/harmony/hvigorfile.d.ts +2 -0
  260. package/lib/typescript/example/harmony/hvigorfile.d.ts.map +1 -0
  261. package/lib/typescript/example/index.d.ts +2 -0
  262. package/lib/typescript/example/index.d.ts.map +1 -0
  263. package/lib/typescript/example/jest.config.d.ts +3 -0
  264. package/lib/typescript/example/jest.config.d.ts.map +1 -0
  265. package/lib/typescript/example/metro.config.d.ts +3 -0
  266. package/lib/typescript/example/metro.config.d.ts.map +1 -0
  267. package/lib/typescript/example/react-native.config.d.ts +3 -0
  268. package/lib/typescript/example/react-native.config.d.ts.map +1 -0
  269. package/lib/typescript/example/scripts/create-build-profile.d.ts +2 -0
  270. package/lib/typescript/example/scripts/create-build-profile.d.ts.map +1 -0
  271. package/lib/typescript/example/src/index.d.ts +3 -0
  272. package/lib/typescript/example/src/index.d.ts.map +1 -0
  273. package/lib/typescript/src/css/index.d.ts +4 -0
  274. package/lib/typescript/src/css/index.d.ts.map +1 -0
  275. package/lib/typescript/src/index.d.ts +3 -0
  276. package/lib/typescript/src/index.d.ts.map +1 -0
  277. package/package.json +54 -0
  278. package/src/css/index.tsx +20 -0
  279. package/src/index.tsx +3 -0
  280. package/tsconfig.json +12 -0
@@ -0,0 +1,27 @@
1
+ /*
2
+ * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ #pragma once
8
+
9
+ #include "RNSVGBaseComponentInstance.h"
10
+ #include "SvgMask.h"
11
+
12
+ namespace rnoh {
13
+ namespace svg {
14
+
15
+ class RNSVGMaskComponentInstance : public RNSVGBaseComponentInstance<facebook::react::RNSVGMaskShadowNode> {
16
+ public:
17
+ explicit RNSVGMaskComponentInstance(Context context);
18
+
19
+ protected:
20
+ void UpdateElementProps() override;
21
+
22
+ private:
23
+ std::shared_ptr<SvgMask> m_svgMask = std::make_shared<SvgMask>();
24
+ };
25
+
26
+ } // namespace svg
27
+ } // namespace rnoh
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ #include "RNSVGPathComponentInstance.h"
8
+ #include <react/renderer/components/react_native_svg/Props.h>
9
+
10
+ namespace rnoh {
11
+ namespace svg {
12
+
13
+ RNSVGPathComponentInstance::RNSVGPathComponentInstance(Context context)
14
+ : RNSVGBaseComponentInstance(std::move(context)) {
15
+ SetSvgNode(m_svgPath);
16
+ }
17
+
18
+ void RNSVGPathComponentInstance::UpdateElementProps() {
19
+ DLOG(INFO) << "[RNSVGPathCI] d: " << m_props->d;
20
+ DLOG(INFO) << "[RNSVGPathCI] pointScaleFactor: " << m_layoutMetrics.pointScaleFactor;
21
+ m_svgPath->UpdateCommonProps(m_props);
22
+ // Check if path data or scale factor has changed
23
+ if (m_cacheD != m_props->d || m_cacheScale != m_layoutMetrics.pointScaleFactor) {
24
+ m_svgPath->setD(m_props->d); // Update path data
25
+ m_cacheD = m_props->d; // Cache the new path data
26
+ m_cacheScale = m_layoutMetrics.pointScaleFactor; // Cache the new scale factor
27
+ } else {
28
+ LOG(INFO) << "[RNSVGPathCI] No changes detected. Skipping update.";
29
+ }
30
+ }
31
+
32
+ } // namespace svg
33
+ } // namespace rnoh
@@ -0,0 +1,29 @@
1
+ /*
2
+ * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ #pragma once
8
+
9
+ #include "RNSVGBaseComponentInstance.h"
10
+ #include "SvgPath.h"
11
+
12
+ namespace rnoh {
13
+ namespace svg {
14
+
15
+ class RNSVGPathComponentInstance : public RNSVGBaseComponentInstance<facebook::react::RNSVGPathShadowNode> {
16
+ public:
17
+ explicit RNSVGPathComponentInstance(Context context);
18
+
19
+ protected:
20
+ void UpdateElementProps() override;
21
+
22
+ private:
23
+ std::shared_ptr<SvgPath> m_svgPath = std::make_shared<SvgPath>();
24
+ std::string m_cacheD;
25
+ float m_cacheScale;
26
+ };
27
+
28
+ } // namespace svg
29
+ } // namespace rnoh
@@ -0,0 +1,40 @@
1
+ /*
2
+ * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ #include "RNSVGPatternComponentInstance.h"
8
+ #include "utils/DynamicUtils.h"
9
+ #include "utils/SvgAttributesParser.h"
10
+ #include <react/renderer/components/react_native_svg/Props.h>
11
+
12
+ namespace rnoh {
13
+ namespace svg {
14
+
15
+ RNSVGPatternComponentInstance::RNSVGPatternComponentInstance(Context context)
16
+ : RNSVGBaseComponentInstance(std::move(context)) {
17
+ SetSvgNode(m_svgPattern);
18
+ }
19
+
20
+ void RNSVGPatternComponentInstance::UpdateElementProps() {
21
+ // set attribute to svgPattern
22
+ m_svgPattern->UpdateCommonProps(m_props);
23
+ m_svgPattern->setPatternX(SvgAttributesParser::ParseDimension(DynamicUtils::DynamicToString(m_props->x), true));
24
+ m_svgPattern->setPatternY(SvgAttributesParser::ParseDimension(DynamicUtils::DynamicToString(m_props->y), true));
25
+ m_svgPattern->setWidth(SvgAttributesParser::ParseDimension(DynamicUtils::DynamicToString(m_props->width), true));
26
+ m_svgPattern->setHeight(SvgAttributesParser::ParseDimension(DynamicUtils::DynamicToString(m_props->height), true));
27
+ m_svgPattern->setPatternUnits(m_props->patternUnits);
28
+ m_svgPattern->setPatternContentUnits(m_props->patternContentUnits);
29
+ m_svgPattern->setViewBox(Rect(m_props->minX, m_props->minY, m_props->vbWidth, m_props->vbHeight));
30
+ m_svgPattern->setmMinX(m_props->minX);
31
+ m_svgPattern->setmMinY(m_props->minY);
32
+ m_svgPattern->setmVbWidth(m_props->vbWidth);
33
+ m_svgPattern->setmVbHeight(m_props->vbHeight);
34
+ m_svgPattern->setmAlign(m_props->align);
35
+ m_svgPattern->setmMeetOrSlice(m_props->meetOrSlice);
36
+ m_svgPattern->setPatternTransforms(m_props->patternTransform);
37
+ }
38
+
39
+ } // namespace svg
40
+ } // namespace rnoh
@@ -0,0 +1,27 @@
1
+ /*
2
+ * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ #pragma once
8
+
9
+ #include "RNSVGBaseComponentInstance.h"
10
+ #include "SvgPattern.h"
11
+
12
+ namespace rnoh {
13
+ namespace svg {
14
+
15
+ class RNSVGPatternComponentInstance : public RNSVGBaseComponentInstance<facebook::react::RNSVGPatternShadowNode> {
16
+ public:
17
+ explicit RNSVGPatternComponentInstance(Context context);
18
+
19
+ protected:
20
+ void UpdateElementProps() override;
21
+
22
+ private:
23
+ std::shared_ptr<SvgPattern> m_svgPattern = std::make_shared<SvgPattern>();
24
+ };
25
+
26
+ } // namespace svg
27
+ } // namespace rnoh
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ #include "RNSVGRadialGradientComponentInstance.h"
8
+ #include "utils/DynamicUtils.h"
9
+
10
+ namespace rnoh {
11
+ namespace svg {
12
+
13
+ RNSVGRadialGradientComponentInstance::RNSVGRadialGradientComponentInstance(Context context)
14
+ : RNSVGBaseComponentInstance(std::move(context)) {
15
+ SetSvgNode(m_svgRadialGradient);
16
+ }
17
+
18
+ void RNSVGRadialGradientComponentInstance::UpdateElementProps() {
19
+ m_svgRadialGradient->UpdateHrefRenderProps(m_props);
20
+ m_svgRadialGradient->SetAttrGradientUnits(m_props->gradientUnits); // first set attr gradientUnits
21
+ m_svgRadialGradient->SetAttrFx(DynamicUtils::DynamicToString(m_props->fx));
22
+ m_svgRadialGradient->SetAttrFy(DynamicUtils::DynamicToString(m_props->fy));
23
+ m_svgRadialGradient->SetAttrCx(DynamicUtils::DynamicToString(m_props->cx));
24
+ m_svgRadialGradient->SetAttrCy(DynamicUtils::DynamicToString(m_props->cy));
25
+ m_svgRadialGradient->SetAttrRx(DynamicUtils::DynamicToString(m_props->rx));
26
+ m_svgRadialGradient->SetAttrRy(DynamicUtils::DynamicToString(m_props->ry));
27
+ m_svgRadialGradient->SetAttrGradient(m_props->gradient);
28
+ m_svgRadialGradient->SetAttrGradientTransforms(m_props->gradientTransform);
29
+ }
30
+
31
+ } // namespace svg
32
+ } // namespace rnoh
@@ -0,0 +1,28 @@
1
+ /*
2
+ * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ #pragma once
8
+
9
+ #include "RNSVGBaseComponentInstance.h"
10
+ #include "SvgGradient.h"
11
+
12
+ namespace rnoh {
13
+ namespace svg {
14
+
15
+ class RNSVGRadialGradientComponentInstance
16
+ : public RNSVGBaseComponentInstance<facebook::react::RNSVGRadialGradientShadowNode> {
17
+ public:
18
+ explicit RNSVGRadialGradientComponentInstance(Context context);
19
+
20
+ protected:
21
+ void UpdateElementProps() override;
22
+
23
+ private:
24
+ std::shared_ptr<SvgGradient> m_svgRadialGradient = std::make_shared<SvgGradient>(GradientType::RADIAL);
25
+ };
26
+
27
+ } // namespace svg
28
+ } // namespace rnoh
@@ -0,0 +1,36 @@
1
+ /*
2
+ * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ #include "RNSVGRectComponentInstance.h"
8
+ #include "utils/DynamicUtils.h"
9
+ #include <react/renderer/components/react_native_svg/Props.h>
10
+
11
+ namespace rnoh {
12
+ namespace svg {
13
+
14
+ RNSVGRectComponentInstance::RNSVGRectComponentInstance(Context context)
15
+ : RNSVGBaseComponentInstance(std::move(context)) {
16
+ SetSvgNode(m_svgRect);
17
+ }
18
+
19
+ void RNSVGRectComponentInstance::UpdateElementProps() {
20
+ m_svgRect->UpdateCommonProps(m_props);
21
+ m_svgRect->SetX(DynamicUtils::DynamicToString(m_props->x));
22
+ m_svgRect->SetY(DynamicUtils::DynamicToString(m_props->y));
23
+ m_svgRect->SetWidth(DynamicUtils::DynamicToString(m_props->width));
24
+ m_svgRect->SetHeight(DynamicUtils::DynamicToString(m_props->height));
25
+ std::string rx = DynamicUtils::DynamicToString(m_props->rx);
26
+ if (rx.size() != 0) {
27
+ m_svgRect->SetRX(rx);
28
+ }
29
+ std::string ry = DynamicUtils::DynamicToString(m_props->ry);
30
+ if (ry.size() != 0) {
31
+ m_svgRect->SetRY(ry);
32
+ }
33
+ }
34
+
35
+ } // namespace svg
36
+ } // namespace rnoh
@@ -0,0 +1,27 @@
1
+ /*
2
+ * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ #pragma once
8
+
9
+ #include "RNSVGBaseComponentInstance.h"
10
+ #include "SvgRect.h"
11
+
12
+ namespace rnoh {
13
+ namespace svg {
14
+
15
+ class RNSVGRectComponentInstance : public RNSVGBaseComponentInstance<facebook::react::RNSVGRectShadowNode> {
16
+ public:
17
+ explicit RNSVGRectComponentInstance(Context context);
18
+
19
+ protected:
20
+ void UpdateElementProps() override;
21
+
22
+ private:
23
+ std::shared_ptr<SvgRect> m_svgRect = std::make_shared<SvgRect>();
24
+ };
25
+
26
+ } // namespace svg
27
+ } // namespace rnoh
@@ -0,0 +1,86 @@
1
+ /*
2
+ * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ #include "RNSVGSvgViewComponentInstance.h"
8
+ #include "utils/DynamicUtils.h"
9
+ #include <glog/logging.h>
10
+
11
+ namespace rnoh {
12
+ namespace svg {
13
+
14
+ RNSVGSvgViewComponentInstance::RNSVGSvgViewComponentInstance(Context context)
15
+ : CppComponentInstance(std::move(context)) {
16
+ SetSvgNode(m_svgSvg);
17
+ getLocalRootArkUINode().SetSvgNode(GetSvgNode());
18
+ GetSvgNode()->SetContext(std::make_shared<SvgContext>());
19
+ SvgViewManager::getInstance().setSvgView(CppComponentInstance::getTag(), m_svgSvg);
20
+ }
21
+
22
+ RNSVGSvgViewComponentInstance::~RNSVGSvgViewComponentInstance() {
23
+ SvgViewManager::getInstance().onDropView(CppComponentInstance::getTag());
24
+ }
25
+
26
+ void RNSVGSvgViewComponentInstance::onFinalizeUpdates() {
27
+ ComponentInstance::onFinalizeUpdates();
28
+ std::string bbWidthStr = DynamicUtils::DynamicToString(m_props->bbWidth);
29
+ std::string bbHeightStr = DynamicUtils::DynamicToString(m_props->bbHeight);
30
+ m_svgSvg->SetScale(m_layoutMetrics.pointScaleFactor);
31
+ auto tintColor = getColorFromDynamic(m_props->rawProps);
32
+ if (tintColor.has_value()) {
33
+ m_svgSvg->GetContext()->SetSvgColor(Color::FromString(tintColor.value()));
34
+ }
35
+ m_svgSvg->SetVbX(m_props->minX);
36
+ m_svgSvg->SetVbY(m_props->minY);
37
+ m_svgSvg->SetVbWidth(m_props->vbWidth);
38
+ m_svgSvg->SetVbHeight(m_props->vbHeight);
39
+ m_svgSvg->SetX(0);
40
+ m_svgSvg->SetY(0);
41
+ m_svgSvg->SetWidth(bbWidthStr);
42
+ m_svgSvg->SetHeight(bbHeightStr);
43
+ m_svgSvg->SetAlign(m_props->align);
44
+ m_svgSvg->SetMeetOrSlice(m_props->meetOrSlice);
45
+ getLocalRootArkUINode().markDirty();
46
+ }
47
+
48
+ void RNSVGSvgViewComponentInstance::onChildInserted(ComponentInstance::Shared const &childComponentInstance,
49
+ std::size_t index) {
50
+ CppComponentInstance::onChildInserted(childComponentInstance, index);
51
+ OnChildInsertCommon(std::dynamic_pointer_cast<SvgHost>(childComponentInstance));
52
+ }
53
+
54
+ void RNSVGSvgViewComponentInstance::onChildRemoved(ComponentInstance::Shared const &childComponentInstance) {
55
+ CppComponentInstance::onChildRemoved(childComponentInstance);
56
+ OnChildRemoveCommon(std::dynamic_pointer_cast<SvgHost>(childComponentInstance));
57
+ }
58
+
59
+ SvgArkUINode &RNSVGSvgViewComponentInstance::getLocalRootArkUINode() { return m_svgArkUINode; }
60
+
61
+ std::optional<std::string> RNSVGSvgViewComponentInstance::getColorFromDynamic(folly::dynamic value) {
62
+ if (value.isNull() || !value.isObject()) {
63
+ return std::nullopt;
64
+ }
65
+ auto rawPropsColor = (value.count("color") > 0) ? std::optional(value["color"].asString()) : std::nullopt;
66
+ return rawPropsColor;
67
+ }
68
+
69
+ bool RNSVGSvgViewComponentInstance::canHandleTouch() const {
70
+ if (m_props != nullptr) {
71
+ auto props = std::dynamic_pointer_cast<const facebook::react::RNSVGSvgViewProps>(m_props);
72
+ return props->pointerEvents == "auto" || props->pointerEvents == "box-only" || props->pointerEvents.size() == 0;
73
+ }
74
+ return true;
75
+ };
76
+
77
+ bool RNSVGSvgViewComponentInstance::canChildrenHandleTouch() const {
78
+ if (m_props != nullptr) {
79
+ auto props = std::dynamic_pointer_cast<const facebook::react::RNSVGSvgViewProps>(m_props);
80
+ return props->pointerEvents == "auto" || props->pointerEvents == "box-none" || props->pointerEvents.size() == 0;
81
+ }
82
+ return true;
83
+ };
84
+
85
+ } // namespace svg
86
+ } // namespace rnoh
@@ -0,0 +1,47 @@
1
+ /*
2
+ * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ #pragma once
8
+
9
+ #include "RNOH/CppComponentInstance.h"
10
+ #include <folly/dynamic.h>
11
+ #include "SvgArkUINode.h"
12
+ #include <react/renderer/components/react_native_svg/ShadowNodes.h>
13
+ #include "SvgViewManager.h"
14
+ #include "SvgSvg.h"
15
+
16
+ namespace rnoh {
17
+ namespace svg {
18
+
19
+ class RNSVGSvgViewComponentInstance : public CppComponentInstance<facebook::react::RNSVGSvgViewShadowNode>,
20
+ public SvgHost {
21
+ public:
22
+ explicit RNSVGSvgViewComponentInstance(Context context);
23
+ ~RNSVGSvgViewComponentInstance();
24
+
25
+ void onFinalizeUpdates() override;
26
+
27
+ // get SvgNode from childComponentInstance and set it to root_
28
+ void onChildInserted(ComponentInstance::Shared const &childComponentInstance, std::size_t index) override;
29
+
30
+ void onChildRemoved(ComponentInstance::Shared const &childComponentInstance) override;
31
+
32
+ SvgArkUINode &getLocalRootArkUINode() override;
33
+
34
+ // since we can't get color correctly from props
35
+ std::optional<std::string> getColorFromDynamic(folly::dynamic value);
36
+
37
+ bool canHandleTouch() const override;
38
+
39
+ bool canChildrenHandleTouch() const override;
40
+
41
+ private:
42
+ SvgArkUINode m_svgArkUINode;
43
+ std::shared_ptr<SvgSvg> m_svgSvg = std::make_shared<SvgSvg>();
44
+ };
45
+
46
+ } // namespace svg
47
+ } // namespace rnoh
@@ -0,0 +1,30 @@
1
+ /*
2
+ * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ #include "RNSVGSymbolComponentInstance.h"
8
+ #include <react/renderer/components/react_native_svg/Props.h>
9
+
10
+ namespace rnoh {
11
+ namespace svg {
12
+
13
+ RNSVGSymbolComponentInstance::RNSVGSymbolComponentInstance(Context context)
14
+ : RNSVGBaseComponentInstance(std::move(context)) {
15
+ SetSvgNode(m_svgSymbol);
16
+ }
17
+
18
+ void RNSVGSymbolComponentInstance::UpdateElementProps() {
19
+ // set attribute to svgSymbol.
20
+ m_svgSymbol->UpdateCommonProps(m_props);
21
+ m_svgSymbol->mMinX = m_props->minX;
22
+ m_svgSymbol->mMinY = m_props->minY;
23
+ m_svgSymbol->mVbWidth = m_props->vbWidth;
24
+ m_svgSymbol->mVbHeight = m_props->vbHeight;
25
+ m_svgSymbol->mMeetOrSlice = m_props->meetOrSlice;
26
+ m_svgSymbol->mAlign = m_props->align;
27
+ }
28
+
29
+ } // namespace svg
30
+ } // namespace rnoh
@@ -0,0 +1,27 @@
1
+ /*
2
+ * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ #pragma once
8
+
9
+ #include "RNSVGBaseComponentInstance.h"
10
+ #include "SvgSymbol.h"
11
+
12
+ namespace rnoh {
13
+ namespace svg {
14
+
15
+ class RNSVGSymbolComponentInstance : public RNSVGBaseComponentInstance<facebook::react::RNSVGSymbolShadowNode> {
16
+ public:
17
+ explicit RNSVGSymbolComponentInstance(Context context);
18
+
19
+ protected:
20
+ void UpdateElementProps() override;
21
+
22
+ private:
23
+ std::shared_ptr<SvgSymbol> m_svgSymbol = std::make_shared<SvgSymbol>();
24
+ };
25
+
26
+ } // namespace svg
27
+ } // namespace rnoh
@@ -0,0 +1,27 @@
1
+ /*
2
+ * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ #include "RNSVGTSpanComponentInstance.h"
8
+ #include "SvgTSpan.h"
9
+ #include <react/renderer/components/react_native_svg/Props.h>
10
+
11
+ namespace rnoh {
12
+ namespace svg {
13
+
14
+ RNSVGTSpanComponentInstance::RNSVGTSpanComponentInstance(Context context)
15
+ : RNSVGBaseComponentInstance(std::move(context)) {
16
+ SetSvgNode(m_svgTSpan);
17
+ }
18
+
19
+ void RNSVGTSpanComponentInstance::UpdateElementProps() {
20
+ m_svgTSpan->UpdateCommonProps(m_props);
21
+ m_svgTSpan->content_ = m_props->content;
22
+ m_svgTSpan->UpdateFontProps(m_props);
23
+ m_svgTSpan->UpdateTextProps(m_props);
24
+ }
25
+
26
+ } // namespace svg
27
+ } // namespace rnoh
@@ -0,0 +1,27 @@
1
+ /*
2
+ * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ #pragma once
8
+
9
+ #include "RNSVGBaseComponentInstance.h"
10
+ #include "SvgTSpan.h"
11
+
12
+ namespace rnoh {
13
+ namespace svg {
14
+
15
+ class RNSVGTSpanComponentInstance : public RNSVGBaseComponentInstance<facebook::react::RNSVGTSpanShadowNode> {
16
+ public:
17
+ explicit RNSVGTSpanComponentInstance(Context context);
18
+
19
+ protected:
20
+ void UpdateElementProps() override;
21
+
22
+ private:
23
+ std::shared_ptr<SvgTSpan> m_svgTSpan = std::make_shared<SvgTSpan>();
24
+ };
25
+
26
+ } // namespace svg
27
+ } // namespace rnoh
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ #include "RNSVGTextComponentInstance.h"
8
+ #include <react/renderer/components/react_native_svg/Props.h>
9
+
10
+ namespace rnoh {
11
+ namespace svg {
12
+
13
+ RNSVGTextComponentInstance::RNSVGTextComponentInstance(Context context)
14
+ : RNSVGBaseComponentInstance(std::move(context)) {
15
+ SetSvgNode(m_svgText);
16
+ }
17
+
18
+ void RNSVGTextComponentInstance::UpdateElementProps() {
19
+ m_svgText->UpdateCommonProps(m_props);
20
+ m_svgText->UpdateFontProps(m_props);
21
+ m_svgText->UpdateTextProps(m_props);
22
+ }
23
+
24
+ } // namespace svg
25
+ } // namespace rnoh
@@ -0,0 +1,27 @@
1
+ /*
2
+ * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ #pragma once
8
+
9
+ #include "RNSVGBaseComponentInstance.h"
10
+ #include "SvgText.h"
11
+
12
+ namespace rnoh {
13
+ namespace svg {
14
+
15
+ class RNSVGTextComponentInstance : public RNSVGBaseComponentInstance<facebook::react::RNSVGTextShadowNode> {
16
+ public:
17
+ explicit RNSVGTextComponentInstance(Context context);
18
+
19
+ protected:
20
+ void UpdateElementProps() override;
21
+
22
+ private:
23
+ std::shared_ptr<SvgText> m_svgText = std::make_shared<SvgText>();
24
+ };
25
+
26
+ } // namespace svg
27
+ } // namespace rnoh
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ #include "RNSVGTextPathComponentInstance.h"
8
+ #include "utils/DynamicUtils.h"
9
+ #include "SvgTSpan.h"
10
+ #include <react/renderer/components/react_native_svg/Props.h>
11
+
12
+ namespace rnoh {
13
+ namespace svg {
14
+
15
+ RNSVGTextPathComponentInstance::RNSVGTextPathComponentInstance(Context context)
16
+ : RNSVGBaseComponentInstance(std::move(context)) {
17
+ SetSvgNode(m_svgTP);
18
+ }
19
+
20
+ void RNSVGTextPathComponentInstance::UpdateElementProps() {
21
+ m_svgTP->UpdateCommonProps(m_props);
22
+ m_svgTP->UpdateFontProps(m_props);
23
+ m_svgTP->UpdateTextProps(m_props);
24
+ m_svgTP->href_ = m_props->href;
25
+ m_svgTP->startOffset_ = StringUtils::FromString(DynamicUtils::DynamicToString(m_props->startOffset)).ConvertToPx(m_layoutMetrics.pointScaleFactor);
26
+ m_svgTP->spacing_ = textPathSpacingFromStr(m_props->spacing);
27
+ m_svgTP->midLine_ = textPathMidLineFromStr(m_props->midLine);
28
+ m_svgTP->side_ = textPathSideFromStr(m_props->side);
29
+ m_svgTP->method_ = textPathMethodFromStr(m_props->method);
30
+ }
31
+ } // namespace svg
32
+ } // namespace rnoh
@@ -0,0 +1,27 @@
1
+ /*
2
+ * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ #pragma once
8
+
9
+ #include "RNSVGBaseComponentInstance.h"
10
+ #include "SvgTextPath.h"
11
+
12
+ namespace rnoh {
13
+ namespace svg {
14
+
15
+ class RNSVGTextPathComponentInstance : public RNSVGBaseComponentInstance<facebook::react::RNSVGTextPathShadowNode> {
16
+ public:
17
+ explicit RNSVGTextPathComponentInstance(Context context);
18
+
19
+ protected:
20
+ void UpdateElementProps() override;
21
+
22
+ private:
23
+ std::shared_ptr<SvgTextPath> m_svgTP = std::make_shared<SvgTextPath>();
24
+ };
25
+
26
+ } // namespace svg
27
+ } // namespace rnoh