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

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 (70) hide show
  1. package/LICENSE +21 -21
  2. package/README.OpenSource +10 -10
  3. package/README.md +13 -13
  4. package/css/package.json +5 -5
  5. package/harmony/svg/BuildProfile.ets +16 -16
  6. package/harmony/svg/build-profile.json5 +9 -9
  7. package/harmony/svg/hvigorfile.ts +1 -1
  8. package/harmony/svg/index.ets +6 -6
  9. package/harmony/svg/oh-package.json5 +13 -13
  10. package/harmony/svg/src/main/cpp/SVGPackage.h +4 -0
  11. package/harmony/svg/src/main/cpp/SvgArkUINode.cpp +3 -0
  12. package/harmony/svg/src/main/cpp/SvgArkUINode.h +15 -9
  13. package/harmony/svg/src/main/cpp/SvgFilter.cpp +505 -505
  14. package/harmony/svg/src/main/cpp/SvgFilter.h +112 -112
  15. package/harmony/svg/src/main/cpp/SvgForeignObjectNode.cpp +74 -0
  16. package/harmony/svg/src/main/cpp/SvgForeignObjectNode.h +54 -0
  17. package/harmony/svg/src/main/cpp/SvgForeignObjectNodeDelegate.h +30 -0
  18. package/harmony/svg/src/main/cpp/SvgNode.cpp +64 -0
  19. package/harmony/svg/src/main/cpp/SvgNode.h +17 -1
  20. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeBlendComponentInstance.cpp +40 -40
  21. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeBlendComponentInstance.h +48 -48
  22. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeColorMatrixComponentInstance.cpp +33 -33
  23. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeColorMatrixComponentInstance.h +48 -48
  24. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeCompositeComponentInstance.cpp +39 -39
  25. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeCompositeComponentInstance.h +55 -55
  26. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeFloodComponentInstance.cpp +33 -33
  27. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeFloodComponentInstance.h +49 -49
  28. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeGaussianBlurComponentInstance.cpp +34 -34
  29. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeGaussianBlurComponentInstance.h +48 -48
  30. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeOffsetComponentInstance.cpp +35 -35
  31. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeOffsetComponentInstance.h +45 -45
  32. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFilterComponentInstance.cpp +198 -198
  33. package/harmony/svg/src/main/cpp/componentInstances/RNSVGFilterComponentInstance.h +48 -48
  34. package/harmony/svg/src/main/cpp/componentInstances/RNSVGForeignObjectComponentInstance.cpp +65 -0
  35. package/harmony/svg/src/main/cpp/componentInstances/RNSVGForeignObjectComponentInstance.h +50 -0
  36. package/harmony/svg/src/main/cpp/componentInstances/RNSVGGroupComponentInstance.h +8 -4
  37. package/harmony/svg/src/main/cpp/componentInstances/RNSVGImageComponentInstance.cpp +4 -1
  38. package/harmony/svg/src/main/cpp/componentInstances/RNSVGSvgViewComponentInstance.cpp +37 -0
  39. package/harmony/svg/src/main/cpp/componentInstances/RNSVGSvgViewComponentInstance.h +10 -2
  40. package/harmony/svg/src/main/cpp/downloadUtils/ImageSourceResolver.cpp +36 -15
  41. package/harmony/svg/src/main/cpp/downloadUtils/ImageSourceResolver.h +6 -10
  42. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGFeBlendJSIBinder.h +26 -26
  43. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGFeColorMatrixJSIBinder.h +26 -26
  44. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGFeCompositeJSIBinder.h +30 -30
  45. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGFeFloodJSIBinder.h +26 -26
  46. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGFeGaussianBlurJSIBinder.h +26 -26
  47. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGFeOffsetJSIBinder.h +26 -26
  48. package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGFilterJSIBinder.h +44 -44
  49. package/harmony/svg/src/main/cpp/generated/react/renderer/components/react_native_svg/Props.cpp +977 -977
  50. package/harmony/svg/src/main/cpp/generated/react/renderer/components/react_native_svg/Props.h +1280 -1280
  51. package/harmony/svg/src/main/cpp/utils/DynamicUtils.h +55 -55
  52. package/harmony/svg/src/main/cpp/utils/FilterManager.h +190 -190
  53. package/harmony/svg/src/main/ets/RNSVGImageModule.ts +21 -21
  54. package/harmony/svg/src/main/ets/RNSVGRenderableModule.ts +16 -16
  55. package/harmony/svg/src/main/ets/RNSVGSvgViewModule.ts +18 -18
  56. package/harmony/svg/src/main/ets/SvgPackage.ts +57 -57
  57. package/harmony/svg/src/main/module.json5 +7 -7
  58. package/harmony/svg/src/main/resources/base/element/string.json +8 -8
  59. package/harmony/svg/src/main/resources/en_US/element/string.json +8 -8
  60. package/harmony/svg/src/main/resources/zh_CN/element/string.json +8 -8
  61. package/harmony/svg/ts.ts +7 -7
  62. package/harmony/svg.har +0 -0
  63. package/lib/commonjs/css/index.js.map +1 -1
  64. package/lib/commonjs/index.js.map +1 -1
  65. package/lib/module/css/index.js.map +1 -1
  66. package/lib/module/index.js.map +1 -1
  67. package/package.json +53 -54
  68. package/src/css/index.tsx +19 -19
  69. package/src/index.tsx +2 -2
  70. package/tsconfig.json +11 -11
package/LICENSE CHANGED
@@ -1,21 +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.
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.
package/README.OpenSource CHANGED
@@ -1,11 +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
- }
1
+ [
2
+ {
3
+ "Name": "@react-native-ohos/react-native-svg",
4
+ "License": "MIT License",
5
+ "License File": " LICENSE ",
6
+ "Version Number": "15.12.0",
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
11
  ]
package/README.md CHANGED
@@ -1,13 +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)
1
+ # @react-native-ohos/react-native-svg
2
+
3
+ This project is based on [react-native-svg@15.12.0](https://github.com/software-mansion/react-native-svg/tree/v15.12.0)
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)
package/css/package.json CHANGED
@@ -1,6 +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"
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
6
  }
@@ -1,17 +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;
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.2';
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
17
  }
@@ -1,9 +1,9 @@
1
- {
2
- "apiType": "stageMode",
3
- "targets": [
4
- {
5
- "name": "default",
6
- "runtimeOS": "HarmonyOS"
7
- }
8
- ]
9
- }
1
+ {
2
+ "apiType": "stageMode",
3
+ "targets": [
4
+ {
5
+ "name": "default",
6
+ "runtimeOS": "HarmonyOS"
7
+ }
8
+ ]
9
+ }
@@ -1,2 +1,2 @@
1
- // Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
1
+ // Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
2
2
  export { harTasks } from '@ohos/hvigor-ohos-plugin';
@@ -1,7 +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
-
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
7
  export * from './ts'
@@ -1,13 +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
- }
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.3',
10
+ dependencies: {
11
+ "@rnoh/react-native-openharmony": "file:../../node_modules/@react-native-oh/react-native-harmony/harmony/react_native_openharmony.har"
12
+ },
13
+ }
@@ -8,6 +8,7 @@
8
8
 
9
9
  #include "RNOH/Package.h"
10
10
  #include <glog/logging.h>
11
+ #include "componentInstances/RNSVGForeignObjectComponentInstance.h"
11
12
  #include "componentInstances/RNSVGSvgViewComponentInstance.h"
12
13
  #include "componentInstances/RNSVGCircleComponentInstance.h"
13
14
  #include "componentInstances/RNSVGGroupComponentInstance.h"
@@ -51,6 +52,9 @@ public:
51
52
  if (ctx.componentName == "RNSVGSvgView") {
52
53
  return std::make_shared<RNSVGSvgViewComponentInstance>(std::move(ctx));
53
54
  }
55
+ if (ctx.componentName == "RNSVGForeignObject") {
56
+ return std::make_shared<RNSVGForeignObjectComponentInstance>(std::move(ctx));
57
+ }
54
58
  if (ctx.componentName == "RNSVGCircle") {
55
59
  return std::make_shared<RNSVGCircleComponentInstance>(std::move(ctx));
56
60
  }
@@ -55,6 +55,9 @@ SvgArkUINode::~SvgArkUINode() {
55
55
  userCallback_ = nullptr;
56
56
  }
57
57
 
58
+ void SvgArkUINode::AddChild(ArkUINode &node) {
59
+ maybeThrow(NativeNodeApi::getInstance()->addChild(m_nodeHandle, node.getArkUINodeHandle()));
60
+ }
58
61
  void SvgArkUINode::OnDraw(ArkUI_NodeCustomEvent *event) {
59
62
  auto *drawContext = OH_ArkUI_NodeCustomEvent_GetDrawContextInDraw(event);
60
63
  auto *drawingHandle = reinterpret_cast<OH_Drawing_Canvas *>(OH_ArkUI_DrawContext_GetCanvas(drawContext));
@@ -6,9 +6,10 @@
6
6
 
7
7
  #pragma once
8
8
 
9
- #include "SvgNode.h"
10
- #include "SvgHost.h"
11
9
  #include "RNOH/arkui/ArkUINode.h"
10
+ #include "SvgForeignObjectNodeDelegate.h"
11
+ #include "SvgHost.h"
12
+ #include "SvgNode.h"
12
13
  #include "arkui/native_node.h"
13
14
 
14
15
  namespace rnoh {
@@ -26,18 +27,23 @@ private:
26
27
  std::weak_ptr<SvgNode> root_;
27
28
  ArkUI_NativeNodeAPI_1 *nativeModule_ = nullptr;
28
29
  UserCallback *userCallback_ = nullptr;
30
+ std::weak_ptr<SvgNode> _groupNode;
31
+ std::vector<ForeignProps> foreignPropsArray;
29
32
  void (*eventReceiver)(ArkUI_NodeCustomEvent *event);
30
-
33
+
31
34
  public:
32
35
  SvgArkUINode();
33
36
  ~SvgArkUINode() override;
34
37
 
35
- void SetSvgNode(const std::weak_ptr<SvgNode>& node)
36
- {
37
- root_ = node;
38
- }
39
- void ResetNodeHandle() {
40
-
38
+ void SetSvgNode(const std::weak_ptr<SvgNode> &node) { root_ = node; }
39
+ void SetGroupNode(const std::weak_ptr<SvgNode> &node) { _groupNode = node; }
40
+ void ResetNodeHandle() {}
41
+ void AddChild(ArkUINode &node);
42
+ void SetForeignObject(OH_PixelmapNative *pixelMap, float w, float h, float x, float y) {
43
+ ForeignProps foreignProps = {std::move(pixelMap), w, h, x, y};
44
+ if (auto groupNode = _groupNode.lock()) {
45
+ groupNode->SetForeignObject(std::move(foreignProps));
46
+ }
41
47
  }
42
48
  };
43
49