@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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) [2015-2016] [Horcrux]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,11 @@
1
+ [
2
+ {
3
+ "Name": "@react-native-ohos/react-native-svg",
4
+ "License": "MIT License",
5
+ "License File": " LICENSE ",
6
+ "Version Number": "15.12.1",
7
+ "Owner" : "xiafeng@huawei.com",
8
+ "Upstream URL": "https://github.com/react-native-oh-library/react-native-harmony-svg",
9
+ "Description": "SVG library for React Native OpenHarmony."
10
+ }
11
+ ]
package/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # @react-native-ohos/react-native-svg
2
+
3
+ This project is based on [react-native-svg v15.12.1](https://github.com/software-mansion/react-native-svg/releases/tag/v15.12.1)
4
+
5
+ ## Documentation
6
+
7
+ - [中文](https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/react-native-svg-capi.md)
8
+
9
+ - [English](https://gitee.com/react-native-oh-library/usage-docs/blob/master/en/react-native-svg-capi.md)
10
+
11
+ ## License
12
+
13
+ This library is licensed under [The MIT License (MIT)](https://github.com/software-mansion/react-native-svg/blob/main/LICENSE)
@@ -0,0 +1,6 @@
1
+ {
2
+ "main": "../lib/commonjs/css/index",
3
+ "module": "../lib/module/css/index",
4
+ "react-native": "../src/css/index",
5
+ "types": "../lib/typescript/css/index"
6
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Use these variables when you tailor your ArkTS code. They must be of the const type.
3
+ */
4
+ export const HAR_VERSION = '15.12.1-rc.1';
5
+ export const BUILD_MODE_NAME = 'debug';
6
+ export const DEBUG = true;
7
+ export const TARGET_NAME = 'default';
8
+
9
+ /**
10
+ * BuildProfile Class is used only for compatibility purposes.
11
+ */
12
+ export default class BuildProfile {
13
+ static readonly HAR_VERSION = HAR_VERSION;
14
+ static readonly BUILD_MODE_NAME = BUILD_MODE_NAME;
15
+ static readonly DEBUG = DEBUG;
16
+ static readonly TARGET_NAME = TARGET_NAME;
17
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "apiType": "stageMode",
3
+ "targets": [
4
+ {
5
+ "name": "default",
6
+ "runtimeOS": "HarmonyOS"
7
+ }
8
+ ]
9
+ }
@@ -0,0 +1,2 @@
1
+ // Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
2
+ export { harTasks } from '@ohos/hvigor-ohos-plugin';
@@ -0,0 +1,7 @@
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
+ export * from './ts'
@@ -0,0 +1,13 @@
1
+ {
2
+ license: 'MIT',
3
+ devDependencies: {},
4
+ author: '',
5
+ description: "",
6
+ name: '@react-native-ohos/react-native-svg',
7
+ type: 'module',
8
+ main: 'index.ets',
9
+ version: '15.12.1-rc.1',
10
+ dependencies: {
11
+ "@rnoh/react-native-openharmony": "file:../../node_modules/@react-native-oh/react-native-harmony/harmony/react_native_openharmony.har"
12
+ },
13
+ }
@@ -0,0 +1,52 @@
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
+ * This file incorporates from the OpenHarmony project, licensed under
7
+ * the Apache License, Version 2.0. Specifically:
8
+ * - [OpenHarmony/arkui_ace_engine] (https://gitee.com/openharmony/arkui_ace_engine)
9
+ *
10
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
11
+ * use this file except in compliance with the License. You may obtain a copy
12
+ * of the License at:
13
+ * http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software
16
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
18
+ * License for the specific language governing permissions and limitations
19
+ * under the License.
20
+ */
21
+
22
+ // from ArkUI "frameworks/core/components/declaration/common/attribute.h"
23
+ #pragma once
24
+
25
+ namespace rnoh {
26
+ namespace svg {
27
+
28
+ enum class AttributeTag {
29
+ COMMON_ATTR = 0,
30
+ COMMON_DISABLED_ATTR,
31
+ COMMON_FOCUSABLE_ATTR,
32
+ COMMON_TOUCHABLE_ATTR,
33
+ COMMON_DATA_ATTR,
34
+ COMMON_CLICK_EFFECT_ATTR,
35
+ COMMON_RENDER_ATTR,
36
+ COMMON_MULTIMODAL_ATTR,
37
+ SPECIALIZED_ATTR,
38
+ UNKNOWN,
39
+ DEFAULT,
40
+ };
41
+
42
+ struct Attribute {
43
+ bool IsValid() const { return tag != AttributeTag::UNKNOWN; }
44
+
45
+ bool IsShared() const { return isShared; }
46
+
47
+ bool isShared = true;
48
+ AttributeTag tag = AttributeTag::DEFAULT;
49
+ };
50
+
51
+ } // namespace svg
52
+ } // namespace rnoh
@@ -0,0 +1,32 @@
1
+ cmake_minimum_required(VERSION 3.13)
2
+ set(CMAKE_VERBOSE_MAKEFILE on)
3
+
4
+ set(rnoh_svg_generated_dir "${CMAKE_CURRENT_SOURCE_DIR}/generated")
5
+ file(GLOB_RECURSE rnoh_svg_generated_SRC "${rnoh_svg_generated_dir}/**/*.cpp")
6
+ file(GLOB rnoh_svg_SRC CONFIGURE_DEPENDS
7
+ *.cpp
8
+ componentInstances/*.cpp
9
+ drawing/*.cpp
10
+ properties/*.cpp
11
+ turboModules/*.cpp
12
+ utils/*.cpp
13
+ svgImage/*.cpp
14
+ downloadUtils/*.cpp
15
+ )
16
+ add_library(rnoh_svg SHARED ${rnoh_svg_SRC} ${rnoh_svg_generated_SRC})
17
+ target_include_directories(rnoh_svg PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${rnoh_svg_generated_dir})
18
+
19
+ target_link_libraries(rnoh_svg PUBLIC rnoh)
20
+ target_link_libraries(rnoh_svg PUBLIC libimage_source.so)
21
+ target_link_libraries(rnoh_svg PUBLIC libpixelmap.so)
22
+ target_link_libraries(rnoh_svg PUBLIC libimage_packer.so)
23
+ target_link_libraries(rnoh_svg PUBLIC librawfile.z.so)
24
+ target_link_libraries(rnoh_svg PUBLIC librcp_c.so)
25
+ target_link_libraries(rnoh_svg PUBLIC libohfileuri.so)
26
+
27
+
28
+ if("${OHOS_ARCH}" STREQUAL "arm64-v8a")
29
+ target_link_directories(rnoh_svg PUBLIC ${HMOS_SDK_NATIVE}/sysroot/usr/lib/aarch64-linux-ohos)
30
+ elseif("${OHOS_ARCH}" STREQUAL "x86_64")
31
+ target_link_directories(rnoh_svg PUBLIC ${HMOS_SDK_NATIVE}/sysroot/usr/lib/x86_64-linux-ohos)
32
+ endif()
File without changes
@@ -0,0 +1,22 @@
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 "FontHolderBase.h"
8
+
9
+ namespace rnoh {
10
+ namespace svg {
11
+
12
+ void FontHolderBase::InheritFont(const std::shared_ptr<FontData> &parent, double scale) {
13
+ if (fp_.Empty()) {
14
+ // share parent font to save memory
15
+ font_ = parent;
16
+ } else {
17
+ font_ = std::make_shared<FontData>(fp_, *parent, scale);
18
+ }
19
+ }
20
+
21
+ } // namespace svg
22
+ } // namespace rnoh
@@ -0,0 +1,54 @@
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 <memory>
10
+ #include "properties/Font.h"
11
+
12
+ namespace rnoh {
13
+ namespace svg {
14
+
15
+ class FontHolderBase {
16
+ public:
17
+ template <typename T> void UpdateFontProps(const std::shared_ptr<T> &props) {
18
+ if constexpr (requires { props->font; }) {
19
+ auto& font = props->font;
20
+ if (!font.isNull()) {
21
+ fp_.fontStyle = font.count("fontStyle") > 0 ? font["fontStyle"].asString() : "";
22
+ fp_.fontVariant = font.count("fontVariant") > 0 ? font["fontVariant"].asString() : "";
23
+ fp_.fontWeight = font.count("fontWeight") > 0 ? font["fontWeight"].asString() : "";
24
+ fp_.fontStretch = font.count("fontStretch") > 0 ? font["fontStretch"].asString() : "";
25
+ fp_.fontSize = font.count("fontSize") > 0 ? font["fontSize"].asString() : "";
26
+ fp_.fontFamily = font.count("fontFamily") > 0 ? font["fontFamily"].asString() : "";
27
+ fp_.textAnchor = font.count("textAnchor") > 0 ? font["textAnchor"].asString() : "";
28
+ fp_.textDecoration = font.count("textDecoration") > 0 ? font["textDecoration"].asString() : "";
29
+ fp_.letterSpacing = font.count("letterSpacing") > 0 ? font["letterSpacing"].asString() : "";
30
+ fp_.wordSpacing = font.count("wordSpacing") > 0 ? font["wordSpacing"].asString() : "";
31
+ fp_.kerning = font.count("kerning") > 0 ? font["kerning"].asString() : "";
32
+ fp_.fontFeatureSettings = font.count("fontFeatureSettings") > 0 ? font["fontFeatureSettings"].asString() : "";
33
+ fp_.fontVariantLigatures = font.count("fontVariantLigatures") > 0 ? font["fontVariantLigatures"].asString() : "";
34
+ fp_.fontVariationSettings = font.count("fontVariationSettings") > 0 ? font["fontVariationSettings"].asString() : "";
35
+ } else {
36
+ fp_ = FontProps{};
37
+ }
38
+ }
39
+ }
40
+
41
+ void InheritFont(const std::shared_ptr<FontData> &parent, double scale);
42
+
43
+ // init when font parent is not present
44
+ void InitFont(double scale) { font_ = std::make_shared<FontData>(fp_, FontData{}, scale); }
45
+
46
+ protected:
47
+ std::shared_ptr<FontData> font_;
48
+
49
+ private:
50
+ FontProps fp_; // save intermediate font properties here because tree is not ready during onPropsChanged
51
+ };
52
+
53
+ } // namespace svg
54
+ } // namespace rnoh
@@ -0,0 +1,135 @@
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 "SVGPackage.h"
10
+
11
+ #include "RNOH/generated/components/RNSVGGroupJSIBinder.h"
12
+ #include "RNOH/generated/components/RNSVGSvgViewJSIBinder.h"
13
+ #include "RNOH/generated/components/RNSVGPathJSIBinder.h"
14
+ #include "RNOH/generated/components/RNSVGRectJSIBinder.h"
15
+ #include "RNOH/generated/components/RNSVGImageJSIBinder.h"
16
+ #include "RNOH/generated/components/RNSVGCircleJSIBinder.h"
17
+ #include "RNOH/generated/components/RNSVGEllipseJSIBinder.h"
18
+ #include "RNOH/generated/components/RNSVGLinearGradientJSIBinder.h"
19
+ #include "RNOH/generated/components/RNSVGDefsJSIBinder.h"
20
+ #include "RNOH/generated/components/RNSVGTextJSIBinder.h"
21
+ #include "RNOH/generated/components/RNSVGTSpanJSIBinder.h"
22
+ #include "RNOH/generated/components/RNSVGClipPathJSIBinder.h"
23
+ #include "RNOH/generated/components/RNSVGMaskJSIBinder.h"
24
+ #include "RNOH/generated/components/RNSVGMarkerJSIBinder.h"
25
+ #include "RNOH/generated/components/RNSVGUseJSIBinder.h"
26
+ #include "RNOH/generated/components/RNSVGForeignObjectJSIBinder.h"
27
+ #include "RNOH/generated/components/RNSVGLineJSIBinder.h"
28
+ #include "RNOH/generated/components/RNSVGPatternJSIBinder.h"
29
+ #include "RNOH/generated/components/RNSVGRadialGradientJSIBinder.h"
30
+ #include "RNOH/generated/components/RNSVGSymbolJSIBinder.h"
31
+ #include "RNOH/generated/components/RNSVGTextPathJSIBinder.h"
32
+ #include "RNOH/generated/components/RNSVGFilterJSIBinder.h"
33
+ #include "RNOH/generated/components/RNSVGFeBlendJSIBinder.h"
34
+ #include "RNOH/generated/components/RNSVGFeColorMatrixJSIBinder.h"
35
+ #include "RNOH/generated/components/RNSVGFeCompositeJSIBinder.h"
36
+ #include "RNOH/generated/components/RNSVGFeGaussianBlurJSIBinder.h"
37
+ #include "RNOH/generated/components/RNSVGFeFloodJSIBinder.h"
38
+ #include "RNOH/generated/components/RNSVGFeOffsetJSIBinder.h"
39
+ #include "turboModules/RNSVGSvgViewModule.h"
40
+ #include "turboModules/RNSVGRenderableModule.h"
41
+ #include "turboModules/RNSVGImageModule.h"
42
+ #include <react/renderer/components/react_native_svg/ComponentDescriptors.h>
43
+ #include "svgImage/RNSVGImageComponentDescriptor.h"
44
+
45
+ using namespace rnoh;
46
+ using namespace facebook;
47
+ using namespace svg;
48
+
49
+ std::vector<react::ComponentDescriptorProvider> SVGPackage::createComponentDescriptorProviders() {
50
+ return {
51
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGCircleComponentDescriptor>(),
52
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGClipPathComponentDescriptor>(),
53
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGDefsComponentDescriptor>(),
54
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGEllipseComponentDescriptor>(),
55
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGFeBlendComponentDescriptor>(),
56
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGFeColorMatrixComponentDescriptor>(),
57
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGFeCompositeComponentDescriptor>(),
58
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGFeGaussianBlurComponentDescriptor>(),
59
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGFeFloodComponentDescriptor>(),
60
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGFeOffsetComponentDescriptor>(),
61
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGFilterComponentDescriptor>(),
62
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGForeignObjectComponentDescriptor>(),
63
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGGroupComponentDescriptor>(),
64
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGSvgViewComponentDescriptor>(),
65
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGImageComponentDescriptor>(),
66
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGLineComponentDescriptor>(),
67
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGLinearGradientComponentDescriptor>(),
68
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGMarkerComponentDescriptor>(),
69
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGMaskComponentDescriptor>(),
70
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGPathComponentDescriptor>(),
71
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGPatternComponentDescriptor>(),
72
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGRadialGradientComponentDescriptor>(),
73
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGRectComponentDescriptor>(),
74
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGSymbolComponentDescriptor>(),
75
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGTSpanComponentDescriptor>(),
76
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGTextComponentDescriptor>(),
77
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGTextPathComponentDescriptor>(),
78
+ facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSVGUseComponentDescriptor>(),
79
+ };
80
+ }
81
+
82
+ ComponentNapiBinderByString SVGPackage::createComponentNapiBinderByName() { return {}; }
83
+
84
+ ComponentJSIBinderByString SVGPackage::createComponentJSIBinderByName() {
85
+ return {
86
+ {"RNSVGCircle", std::make_shared<RNSVGCircleJSIBinder>()},
87
+ {"RNSVGClipPath", std::make_shared<RNSVGClipPathJSIBinder>()},
88
+ {"RNSVGDefs", std::make_shared<RNSVGDefsJSIBinder>()},
89
+ {"RNSVGEllipse", std::make_shared<RNSVGEllipseJSIBinder>()},
90
+ {"RNSVGForeignObject", std::make_shared<RNSVGForeignObjectJSIBinder>()},
91
+ {"RNSVGGroup", std::make_shared<RNSVGGroupJSIBinder>()},
92
+ {"RNSVGSvgView", std::make_shared<RNSVGSvgViewJSIBinder>()},
93
+ {"RNSVGImage", std::make_shared<RNSVGImageJSIBinder>()},
94
+ {"RNSVGLine", std::make_shared<RNSVGLineJSIBinder>()},
95
+ {"RNSVGLinearGradient", std::make_shared<RNSVGLinearGradientJSIBinder>()},
96
+ {"RNSVGRadialGradient", std::make_shared<RNSVGRadialGradientJSIBinder>()},
97
+ {"RNSVGMarker", std::make_shared<RNSVGMarkerJSIBinder>()},
98
+ {"RNSVGMask", std::make_shared<RNSVGMaskJSIBinder>()},
99
+ {"RNSVGPath", std::make_shared<RNSVGPathJSIBinder>()},
100
+ {"RNSVGPattern", std::make_shared<RNSVGPatternJSIBinder>()},
101
+ {"RNSVGRect", std::make_shared<RNSVGRectJSIBinder>()},
102
+ {"RNSVGSymbol", std::make_shared<RNSVGSymbolJSIBinder>()},
103
+ {"RNSVGTSpan", std::make_shared<RNSVGTSpanJSIBinder>()},
104
+ {"RNSVGText", std::make_shared<RNSVGTextJSIBinder>()},
105
+ {"RNSVGTextPath", std::make_shared<RNSVGTextPathJSIBinder>()},
106
+ {"RNSVGUse", std::make_shared<RNSVGUseJSIBinder>()},
107
+ {"RNSVGFilter", std::make_shared<RNSVGFilterJSIBinder>()},
108
+ {"RNSVGFeBlend", std::make_shared<RNSVGFeBlendJSIBinder>()},
109
+ {"RNSVGFeColorMatrix", std::make_shared<RNSVGFeColorMatrixJSIBinder>()},
110
+ {"RNSVGFeComposite", std::make_shared<RNSVGFeCompositeJSIBinder>()},
111
+ {"RNSVGFeGaussianBlur", std::make_shared<RNSVGFeGaussianBlurJSIBinder>()},
112
+ {"RNSVGFeFlood", std::make_shared<RNSVGFeFloodJSIBinder>()},
113
+ {"RNSVGFeOffset", std::make_shared<RNSVGFeOffsetJSIBinder>()},
114
+ };
115
+ };
116
+
117
+ class SvgTurboModuleFactoryDelegate : public TurboModuleFactoryDelegate {
118
+ public:
119
+ SharedTurboModule createTurboModule(Context ctx, const std::string &name) const override {
120
+ if (name == "RNSVGSvgViewModule") {
121
+ return std::make_shared<RNSVGSvgViewModule>(ctx, name);
122
+ }
123
+ if (name == "RNSVGRenderableModule") {
124
+ return std::make_shared<RNSVGRenderableModule>(ctx, name);
125
+ }
126
+ if (name == "RNSVGImageModule") {
127
+ return std::make_shared<RNSVGImageModule>(ctx, name);
128
+ }
129
+ return nullptr;
130
+ };
131
+ };
132
+
133
+ std::unique_ptr<TurboModuleFactoryDelegate> SVGPackage::createTurboModuleFactoryDelegate() {
134
+ return std::make_unique<SvgTurboModuleFactoryDelegate>();
135
+ }
@@ -0,0 +1,153 @@
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/Package.h"
10
+ #include <glog/logging.h>
11
+ #include "componentInstances/RNSVGSvgViewComponentInstance.h"
12
+ #include "componentInstances/RNSVGCircleComponentInstance.h"
13
+ #include "componentInstances/RNSVGGroupComponentInstance.h"
14
+ #include "componentInstances/RNSVGPathComponentInstance.h"
15
+ #include "componentInstances/RNSVGRectComponentInstance.h"
16
+ #include "componentInstances/RNSVGImageComponentInstance.h"
17
+ #include "componentInstances/RNSVGEllipseComponentInstance.h"
18
+ #include "componentInstances/RNSVGLinearGradientComponentInstance.h"
19
+ #include "componentInstances/RNSVGRadialGradientComponentInstance.h"
20
+ #include "componentInstances/RNSVGLineComponentInstance.h"
21
+ #include "componentInstances/RNSVGDefsComponentInstance.h"
22
+ #include "componentInstances/RNSVGTextComponentInstance.h"
23
+ #include "componentInstances/RNSVGTextPathComponentInstance.h"
24
+ #include "componentInstances/RNSVGTSpanComponentInstance.h"
25
+ #include "componentInstances/RNSVGClipPathComponentInstance.h"
26
+ #include "componentInstances/RNSVGMaskComponentInstance.h"
27
+ #include "componentInstances/RNSVGUseComponentInstance.h"
28
+ #include "componentInstances/RNSVGMarkerComponentInstance.h"
29
+ #include "componentInstances/RNSVGPatternComponentInstance.h"
30
+ #include "componentInstances/RNSVGSymbolComponentInstance.h"
31
+ #include "componentInstances/RNSVGFilterComponentInstance.h"
32
+ #include "componentInstances/RNSVGFeBlendComponentInstance.h"
33
+ #include "componentInstances/RNSVGFeColorMatrixComponentInstance.h"
34
+ #include "componentInstances/RNSVGFeFloodComponentInstance.h"
35
+ #include "componentInstances/RNSVGFeCompositeComponentInstance.h"
36
+ #include "componentInstances/RNSVGFeGaussianBlurComponentInstance.h"
37
+ #include "componentInstances/RNSVGFeOffsetComponentInstance.h"
38
+
39
+ using namespace rnoh;
40
+ using namespace facebook;
41
+ using namespace svg;
42
+
43
+ namespace rnoh {
44
+
45
+ class SVGPackageComponentInstanceFactoryDelegate : public ComponentInstanceFactoryDelegate {
46
+ public:
47
+ using ComponentInstanceFactoryDelegate::ComponentInstanceFactoryDelegate;
48
+
49
+ ComponentInstance::Shared create(ComponentInstance::Context ctx) override {
50
+ DLOG(INFO) << "[SVGPackageComponentInstanceFactoryDelegate] create componentName= " << ctx.componentName;
51
+ if (ctx.componentName == "RNSVGSvgView") {
52
+ return std::make_shared<RNSVGSvgViewComponentInstance>(std::move(ctx));
53
+ }
54
+ if (ctx.componentName == "RNSVGCircle") {
55
+ return std::make_shared<RNSVGCircleComponentInstance>(std::move(ctx));
56
+ }
57
+ if (ctx.componentName == "RNSVGGroup") {
58
+ return std::make_shared<RNSVGGroupComponentInstance>(std::move(ctx));
59
+ }
60
+ if (ctx.componentName == "RNSVGPath") {
61
+ return std::make_shared<RNSVGPathComponentInstance>(std::move(ctx));
62
+ }
63
+ if (ctx.componentName == "RNSVGRect") {
64
+ return std::make_shared<RNSVGRectComponentInstance>(std::move(ctx));
65
+ }
66
+ if (ctx.componentName == "RNSVGImage") {
67
+ return std::make_shared<RNSVGImageComponentInstance>(std::move(ctx));
68
+ }
69
+ if (ctx.componentName == "RNSVGEllipse") {
70
+ return std::make_shared<RNSVGEllipseComponentInstance>(std::move(ctx));
71
+ }
72
+ if (ctx.componentName == "RNSVGLinearGradient") {
73
+ return std::make_shared<RNSVGLinearGradientComponentInstance>(std::move(ctx));
74
+ }
75
+ if (ctx.componentName == "RNSVGRadialGradient") {
76
+ return std::make_shared<RNSVGRadialGradientComponentInstance>(std::move(ctx));
77
+ }
78
+ if (ctx.componentName == "RNSVGLine") {
79
+ return std::make_shared<RNSVGLineComponentInstance>(std::move(ctx));
80
+ }
81
+ if (ctx.componentName == "RNSVGDefs") {
82
+ return std::make_shared<RNSVGDefsComponentInstance>(std::move(ctx));
83
+ }
84
+ if (ctx.componentName == "RNSVGText") {
85
+ return std::make_shared<RNSVGTextComponentInstance>(std::move(ctx));
86
+ }
87
+ if (ctx.componentName == "RNSVGTSpan") {
88
+ return std::make_shared<RNSVGTSpanComponentInstance>(std::move(ctx));
89
+ }
90
+ if (ctx.componentName == "RNSVGTextPath") {
91
+ return std::make_shared<RNSVGTextPathComponentInstance>(std::move(ctx));
92
+ }
93
+ if (ctx.componentName == "RNSVGClipPath") {
94
+ return std::make_shared<RNSVGClipPathComponentInstance>(std::move(ctx));
95
+ }
96
+ if (ctx.componentName == "RNSVGMask") {
97
+ return std::make_shared<RNSVGMaskComponentInstance>(std::move(ctx));
98
+ }
99
+ if (ctx.componentName == "RNSVGUse") {
100
+ return std::make_shared<RNSVGUseComponentInstance>(std::move(ctx));
101
+ }
102
+ if (ctx.componentName == "RNSVGMarker") {
103
+ return std::make_shared<RNSVGMarkerComponentInstance>(std::move(ctx));
104
+ }
105
+ if (ctx.componentName == "RNSVGPattern") {
106
+ return std::make_shared<RNSVGPatternComponentInstance>(std::move(ctx));
107
+ }
108
+ if (ctx.componentName == "RNSVGSymbol") {
109
+ return std::make_shared<RNSVGSymbolComponentInstance>(std::move(ctx));
110
+ }
111
+ if (ctx.componentName == "RNSVGFilter") {
112
+ return std::make_shared<RNSVGFilterComponentInstance>(std::move(ctx));
113
+ }
114
+ if (ctx.componentName == "RNSVGFeBlend") {
115
+ return std::make_shared<RNSVGFeBlendComponentInstance>(std::move(ctx));
116
+ }
117
+ if (ctx.componentName == "RNSVGFeColorMatrix") {
118
+ return std::make_shared<RNSVGFeColorMatrixComponentInstance>(std::move(ctx));
119
+ }
120
+ if (ctx.componentName == "RNSVGFeFlood") {
121
+ return std::make_shared<RNSVGFeFloodComponentInstance>(std::move(ctx));
122
+ }
123
+ if (ctx.componentName == "RNSVGFeComposite") {
124
+ return std::make_shared<RNSVGFeCompositeComponentInstance>(std::move(ctx));
125
+ }
126
+ if (ctx.componentName == "RNSVGFeGaussianBlur") {
127
+ return std::make_shared<RNSVGFeGaussianBlurComponentInstance>(std::move(ctx));
128
+ }
129
+ if (ctx.componentName == "RNSVGFeOffset") {
130
+ return std::make_shared<RNSVGFeOffsetComponentInstance>(std::move(ctx));
131
+ }
132
+ return nullptr;
133
+ }
134
+ };
135
+
136
+ class SVGPackage : public Package {
137
+ public:
138
+ explicit SVGPackage(Package::Context ctx) : Package(ctx) {}
139
+
140
+ std::unique_ptr<TurboModuleFactoryDelegate> createTurboModuleFactoryDelegate() override;
141
+
142
+ ComponentInstanceFactoryDelegate::Shared createComponentInstanceFactoryDelegate() override {
143
+ return std::make_shared<SVGPackageComponentInstanceFactoryDelegate>();
144
+ }
145
+
146
+ std::vector<facebook::react::ComponentDescriptorProvider> createComponentDescriptorProviders() override;
147
+
148
+ ComponentNapiBinderByString createComponentNapiBinderByName() override;
149
+
150
+ ComponentJSIBinderByString createComponentJSIBinderByName() override;
151
+ };
152
+
153
+ } // namespace rnoh
@@ -0,0 +1,75 @@
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 "arkui/native_node.h"
8
+ #include "arkui/native_type.h"
9
+ #include "RNOH/arkui/NativeNodeApi.h"
10
+ #include "SvgArkUINode.h"
11
+ #include <native_drawing/drawing_canvas.h>
12
+ #include <native_drawing/drawing_path.h>
13
+ #include <native_drawing/drawing_pen.h>
14
+ #include <native_drawing/drawing_types.h>
15
+ #include <sstream>
16
+ #include <functional>
17
+ #include "SvgViewManager.h"
18
+
19
+ namespace rnoh {
20
+ namespace svg {
21
+
22
+ constexpr int NODE_EVENT_ID = 77;
23
+
24
+ // 对应SVGArkUINode
25
+ SvgArkUINode::SvgArkUINode() : ArkUINode(NativeNodeApi::getInstance()->createNode(ArkUI_NodeType::ARKUI_NODE_CUSTOM)) {
26
+ userCallback_ = new UserCallback();
27
+ // 设置自定义回调。注册onDraw
28
+ userCallback_->callback = [this](ArkUI_NodeCustomEvent *event) {
29
+ auto type = OH_ArkUI_NodeCustomEvent_GetEventType(event);
30
+ switch (type) {
31
+ case ARKUI_NODE_CUSTOM_EVENT_ON_DRAW:
32
+ OnDraw(event);
33
+ break;
34
+ default:
35
+ break;
36
+ }
37
+ };
38
+ eventReceiver = [](ArkUI_NodeCustomEvent *event) {
39
+ if (OH_ArkUI_NodeCustomEvent_GetEventTargetId(event) == NODE_EVENT_ID) {
40
+ auto *userData = reinterpret_cast<UserCallback *>(OH_ArkUI_NodeCustomEvent_GetUserData(event));
41
+ if (userData != nullptr && userData->callback != nullptr) {
42
+ userData->callback(event);
43
+ }
44
+ }
45
+ };
46
+ maybeThrow(NativeNodeApi::getInstance()->addNodeCustomEventReceiver(m_nodeHandle, eventReceiver));
47
+ maybeThrow(NativeNodeApi::getInstance()->registerNodeCustomEvent(m_nodeHandle, ARKUI_NODE_CUSTOM_EVENT_ON_DRAW, NODE_EVENT_ID,
48
+ userCallback_));
49
+ }
50
+
51
+ SvgArkUINode::~SvgArkUINode() {
52
+ NativeNodeApi::getInstance()->removeNodeCustomEventReceiver(m_nodeHandle, eventReceiver);
53
+ NativeNodeApi::getInstance()->unregisterNodeCustomEvent(m_nodeHandle, ARKUI_NODE_CUSTOM_EVENT_ON_DRAW);
54
+ delete userCallback_;
55
+ userCallback_ = nullptr;
56
+ }
57
+
58
+ void SvgArkUINode::OnDraw(ArkUI_NodeCustomEvent *event) {
59
+ auto *drawContext = OH_ArkUI_NodeCustomEvent_GetDrawContextInDraw(event);
60
+ auto *drawingHandle = reinterpret_cast<OH_Drawing_Canvas *>(OH_ArkUI_DrawContext_GetCanvas(drawContext));
61
+ DLOG(INFO) << "[svg] <SVGArkUINode> CanvasGetHeight: " << OH_Drawing_CanvasGetHeight(drawingHandle);
62
+ DLOG(INFO) << "[svg] <SVGArkUINode> CanvasGetWidth: " << OH_Drawing_CanvasGetWidth(drawingHandle);
63
+ auto root = root_.lock();
64
+ CHECK_NULL_VOID(root);
65
+ if (root->GetContext()) {
66
+ // reset the idMap
67
+ root->GetContext()->ClearIdMap();
68
+ }
69
+ root->ContextTraversal();
70
+ root->InitStyle({});
71
+ root->Draw(drawingHandle);
72
+ }
73
+
74
+ } // namespace svg
75
+ } // namespace rnoh