@shopify/react-native-skia 0.1.180 → 0.1.182

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. package/android/build.gradle +6 -1
  2. package/cpp/api/JsiSkData.h +7 -0
  3. package/cpp/api/JsiSkImage.h +7 -1
  4. package/cpp/api/JsiSkSVG.h +7 -0
  5. package/cpp/api/JsiSkTypeface.h +7 -0
  6. package/cpp/jsi/RuntimeAwareCache.cpp +0 -2
  7. package/cpp/rnskia/RNSkDomView.cpp +2 -2
  8. package/cpp/rnskia/RNSkPlatformContext.h +2 -2
  9. package/cpp/rnskia/dom/base/DerivedNodeProp.h +1 -1
  10. package/cpp/rnskia/dom/base/JsiDependencyManager.h +10 -6
  11. package/cpp/rnskia/dom/base/JsiDomNode.h +133 -78
  12. package/cpp/rnskia/dom/base/JsiDomRenderNode.h +17 -5
  13. package/cpp/rnskia/dom/base/NodeProp.h +5 -5
  14. package/cpp/rnskia/dom/base/NodePropsContainer.h +8 -2
  15. package/cpp/rnskia/dom/props/ClipProp.h +13 -20
  16. package/cpp/rnskia/dom/props/PathProp.h +16 -14
  17. package/cpp/rnskia/dom/props/PointProp.h +1 -1
  18. package/cpp/rnskia/dom/props/RRectProp.h +39 -61
  19. package/cpp/rnskia/dom/props/RectProp.h +27 -25
  20. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +0 -2
  21. package/lib/commonjs/dom/nodes/JsiSkDOM.js +56 -54
  22. package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
  23. package/lib/commonjs/renderer/Canvas.js +30 -9
  24. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  25. package/lib/commonjs/renderer/HostComponents.d.ts +1 -0
  26. package/lib/commonjs/renderer/HostComponents.js +6 -1
  27. package/lib/commonjs/renderer/HostComponents.js.map +1 -1
  28. package/lib/commonjs/renderer/Reconciler.js +3 -1
  29. package/lib/commonjs/renderer/Reconciler.js.map +1 -1
  30. package/lib/commonjs/skia/core/Data.d.ts +2 -2
  31. package/lib/commonjs/skia/core/Data.js +5 -0
  32. package/lib/commonjs/skia/core/Data.js.map +1 -1
  33. package/lib/commonjs/skia/types/Data/Data.d.ts +2 -2
  34. package/lib/commonjs/skia/types/Data/Data.js.map +1 -1
  35. package/lib/commonjs/skia/types/Image/Image.d.ts +2 -2
  36. package/lib/commonjs/skia/types/Image/Image.js.map +1 -1
  37. package/lib/commonjs/skia/types/JsiInstance.d.ts +3 -0
  38. package/lib/commonjs/skia/types/JsiInstance.js.map +1 -1
  39. package/lib/commonjs/skia/types/SVG/SVG.d.ts +2 -2
  40. package/lib/commonjs/skia/types/SVG/SVG.js.map +1 -1
  41. package/lib/commonjs/skia/types/Typeface/Typeface.d.ts +2 -2
  42. package/lib/commonjs/skia/types/Typeface/Typeface.js.map +1 -1
  43. package/lib/commonjs/skia/web/JsiSkData.d.ts +1 -0
  44. package/lib/commonjs/skia/web/JsiSkData.js +3 -0
  45. package/lib/commonjs/skia/web/JsiSkData.js.map +1 -1
  46. package/lib/commonjs/skia/web/JsiSkImage.d.ts +1 -0
  47. package/lib/commonjs/skia/web/JsiSkImage.js +4 -0
  48. package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
  49. package/lib/commonjs/skia/web/JsiSkTypeface.d.ts +1 -0
  50. package/lib/commonjs/skia/web/JsiSkTypeface.js +4 -0
  51. package/lib/commonjs/skia/web/JsiSkTypeface.js.map +1 -1
  52. package/lib/commonjs/views/SkiaBaseWebView.js +5 -1
  53. package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
  54. package/lib/module/dom/nodes/JsiSkDOM.js +55 -54
  55. package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
  56. package/lib/module/renderer/Canvas.js +29 -10
  57. package/lib/module/renderer/Canvas.js.map +1 -1
  58. package/lib/module/renderer/HostComponents.d.ts +1 -0
  59. package/lib/module/renderer/HostComponents.js +3 -0
  60. package/lib/module/renderer/HostComponents.js.map +1 -1
  61. package/lib/module/renderer/Reconciler.js +2 -1
  62. package/lib/module/renderer/Reconciler.js.map +1 -1
  63. package/lib/module/skia/core/Data.d.ts +2 -2
  64. package/lib/module/skia/core/Data.js +5 -0
  65. package/lib/module/skia/core/Data.js.map +1 -1
  66. package/lib/module/skia/types/Data/Data.d.ts +2 -2
  67. package/lib/module/skia/types/Data/Data.js.map +1 -1
  68. package/lib/module/skia/types/Image/Image.d.ts +2 -2
  69. package/lib/module/skia/types/Image/Image.js.map +1 -1
  70. package/lib/module/skia/types/JsiInstance.d.ts +3 -0
  71. package/lib/module/skia/types/JsiInstance.js.map +1 -1
  72. package/lib/module/skia/types/SVG/SVG.d.ts +2 -2
  73. package/lib/module/skia/types/SVG/SVG.js.map +1 -1
  74. package/lib/module/skia/types/Typeface/Typeface.d.ts +2 -2
  75. package/lib/module/skia/types/Typeface/Typeface.js.map +1 -1
  76. package/lib/module/skia/web/JsiSkData.d.ts +1 -0
  77. package/lib/module/skia/web/JsiSkData.js +3 -0
  78. package/lib/module/skia/web/JsiSkData.js.map +1 -1
  79. package/lib/module/skia/web/JsiSkImage.d.ts +1 -0
  80. package/lib/module/skia/web/JsiSkImage.js +4 -0
  81. package/lib/module/skia/web/JsiSkImage.js.map +1 -1
  82. package/lib/module/skia/web/JsiSkTypeface.d.ts +1 -0
  83. package/lib/module/skia/web/JsiSkTypeface.js +4 -0
  84. package/lib/module/skia/web/JsiSkTypeface.js.map +1 -1
  85. package/lib/module/views/SkiaBaseWebView.js +5 -1
  86. package/lib/module/views/SkiaBaseWebView.js.map +1 -1
  87. package/lib/typescript/src/renderer/HostComponents.d.ts +1 -0
  88. package/lib/typescript/src/skia/core/Data.d.ts +2 -2
  89. package/lib/typescript/src/skia/types/Data/Data.d.ts +2 -2
  90. package/lib/typescript/src/skia/types/Image/Image.d.ts +2 -2
  91. package/lib/typescript/src/skia/types/JsiInstance.d.ts +3 -0
  92. package/lib/typescript/src/skia/types/SVG/SVG.d.ts +2 -2
  93. package/lib/typescript/src/skia/types/Typeface/Typeface.d.ts +2 -2
  94. package/lib/typescript/src/skia/web/JsiSkData.d.ts +1 -0
  95. package/lib/typescript/src/skia/web/JsiSkImage.d.ts +1 -0
  96. package/lib/typescript/src/skia/web/JsiSkTypeface.d.ts +1 -0
  97. package/package.json +1 -1
  98. package/src/dom/nodes/JsiSkDOM.ts +55 -54
  99. package/src/renderer/Canvas.tsx +34 -14
  100. package/src/renderer/HostComponents.ts +4 -0
  101. package/src/renderer/Reconciler.tsx +2 -1
  102. package/src/skia/core/Data.ts +14 -6
  103. package/src/skia/types/Data/Data.ts +2 -2
  104. package/src/skia/types/Image/Image.ts +2 -2
  105. package/src/skia/types/JsiInstance.ts +4 -0
  106. package/src/skia/types/SVG/SVG.ts +2 -2
  107. package/src/skia/types/Typeface/Typeface.ts +2 -2
  108. package/src/skia/web/JsiSkData.ts +4 -0
  109. package/src/skia/web/JsiSkImage.ts +4 -0
  110. package/src/skia/web/JsiSkTypeface.ts +4 -0
  111. package/src/views/SkiaBaseWebView.tsx +5 -0
@@ -22,32 +22,34 @@ public:
22
22
  _pathProp = defineProperty<NodeProp>(name);
23
23
  }
24
24
 
25
- void updateDerivedValue() override {
26
- if (!_pathProp->isSet()) {
27
- setDerivedValue(nullptr);
28
- return;
29
- }
30
-
31
- if (_pathProp->value().getType() == PropType::HostObject) {
25
+ static std::shared_ptr<SkPath> processPath(const JsiValue &value) {
26
+ if (value.getType() == PropType::HostObject) {
32
27
  // Try reading as Path
33
- auto ptr = std::dynamic_pointer_cast<JsiSkPath>(
34
- _pathProp->value().getAsHostObject());
28
+ auto ptr = std::dynamic_pointer_cast<JsiSkPath>(value.getAsHostObject());
35
29
  if (ptr != nullptr) {
36
- setDerivedValue(ptr->getObject());
30
+ return ptr->getObject();
37
31
  }
38
- } else if (_pathProp->value().getType() == PropType::String) {
32
+ } else if (value.getType() == PropType::String) {
39
33
  // Read as string
40
- auto pathString = _pathProp->value().getAsString();
34
+ auto pathString = value.getAsString();
41
35
  SkPath result;
42
36
 
43
37
  if (SkParsePath::FromSVGString(pathString.c_str(), &result)) {
44
- setDerivedValue(std::make_shared<SkPath>(result));
38
+ return std::make_shared<SkPath>(result);
45
39
  } else {
46
40
  throw std::runtime_error("Could not parse path from string.");
47
41
  }
48
- } else {
42
+ }
43
+ return nullptr;
44
+ }
45
+
46
+ void updateDerivedValue() override {
47
+ if (!_pathProp->isSet()) {
49
48
  setDerivedValue(nullptr);
49
+ return;
50
50
  }
51
+ auto value = _pathProp->value();
52
+ setDerivedValue(PathProp::processPath(value));
51
53
  }
52
54
 
53
55
  private:
@@ -29,7 +29,7 @@ public:
29
29
  void updateDerivedValue() override {
30
30
  if (_pointProp->isSet()) {
31
31
  // Check for JsiSkRect and JsiSkPoint
32
- setDerivedValue(std::move(processValue(_pointProp->value())));
32
+ setDerivedValue(processValue(_pointProp->value()));
33
33
  } else {
34
34
  setDerivedValue(nullptr);
35
35
  }
@@ -33,35 +33,33 @@ public:
33
33
  _prop = defineProperty<NodeProp>(name);
34
34
  }
35
35
 
36
- void updateDerivedValue() override {
37
- if (_prop->isSet()) {
38
- // Check for JsiSkRRect
39
- if (_prop->value().getType() == PropType::HostObject) {
40
- // Try reading as rect
41
- auto rectPtr = std::dynamic_pointer_cast<JsiSkRRect>(
42
- _prop->value().getAsHostObject());
43
- if (rectPtr != nullptr) {
44
- auto rrect = rectPtr->getObject();
45
- setDerivedValue(SkRRect::MakeRectXY(
46
- SkRect::MakeXYWH(rrect->rect().x(), rrect->rect().y(),
47
- rrect->rect().width(), rrect->rect().height()),
48
- rrect->getSimpleRadii().x(), rrect->getSimpleRadii().y()));
49
- }
50
- } else {
51
- if (_prop->isSet() && _prop->value().getType() == PropType::Object) {
52
- auto p = _prop->value();
53
- if (p.hasValue(PropNameX) && p.hasValue(PropNameY) &&
54
- p.hasValue(PropNameWidth) && p.hasValue(PropNameHeight) &&
55
- p.hasValue(PropNameRx) && p.hasValue(PropNameRy)) {
56
- auto x = _prop->value().getValue(PropNameX);
57
- auto y = _prop->value().getValue(PropNameY);
58
- auto width = _prop->value().getValue(PropNameWidth);
59
- auto height = _prop->value().getValue(PropNameHeight);
60
- auto rx = _prop->value().getValue(PropNameRx);
61
- auto ry = _prop->value().getValue(PropNameRy);
36
+ static std::shared_ptr<SkRRect> processRRect(const JsiValue &value) {
37
+ if (value.getType() == PropType::HostObject) {
38
+ // Try reading as rect
39
+ auto rectPtr =
40
+ std::dynamic_pointer_cast<JsiSkRRect>(value.getAsHostObject());
41
+ if (rectPtr != nullptr) {
42
+ auto rrect = rectPtr->getObject();
43
+ return std::make_shared<SkRRect>(
44
+ SkRRect::MakeRectXY(rrect->rect(), rrect->getSimpleRadii().x(),
45
+ rrect->getSimpleRadii().y()));
46
+ }
47
+ } else {
48
+ if (value.getType() == PropType::Object) {
49
+ if (value.hasValue(PropNameRect) && value.hasValue(PropNameRx) &&
50
+ value.hasValue(PropNameRy)) {
51
+ auto rect = value.getValue(PropNameRect);
52
+ if (rect.hasValue(PropNameX) && rect.hasValue(PropNameY) &&
53
+ rect.hasValue(PropNameWidth) && rect.hasValue(PropNameHeight)) {
54
+ auto x = rect.getValue(PropNameX);
55
+ auto y = rect.getValue(PropNameY);
56
+ auto width = rect.getValue(PropNameWidth);
57
+ auto height = rect.getValue(PropNameHeight);
58
+ auto rx = value.getValue(PropNameRx);
59
+ auto ry = value.getValue(PropNameRy);
62
60
 
63
61
  // Update cache from js object value
64
- setDerivedValue(SkRRect::MakeRectXY(
62
+ return std::make_shared<SkRRect>(SkRRect::MakeRectXY(
65
63
  SkRect::MakeXYWH(x.getAsNumber(), y.getAsNumber(),
66
64
  width.getAsNumber(), height.getAsNumber()),
67
65
  rx.getAsNumber(), ry.getAsNumber()));
@@ -69,6 +67,14 @@ public:
69
67
  }
70
68
  }
71
69
  }
70
+ return nullptr;
71
+ }
72
+
73
+ void updateDerivedValue() override {
74
+ if (_prop->isSet()) {
75
+ auto value = _prop->value();
76
+ setDerivedValue(RRectProp::processRRect(value));
77
+ }
72
78
  }
73
79
 
74
80
  private:
@@ -150,40 +156,12 @@ public:
150
156
  }
151
157
 
152
158
  void updateDerivedValue() override {
153
- if (_boxProp->value().getType() == PropType::HostObject) {
154
- auto rectPtr = std::dynamic_pointer_cast<JsiSkRect>(
155
- _boxProp->value().getAsHostObject());
156
- auto rrectPtr = std::dynamic_pointer_cast<JsiSkRRect>(
157
- _boxProp->value().getAsHostObject());
158
- // 1. box is SkRect
159
- if (rectPtr != nullptr) {
160
- auto rect = rectPtr->getObject();
161
- setDerivedValue(SkRRect::MakeRect(*rect));
162
- // 2. box is SkRRect
163
- } else if (rrectPtr != nullptr) {
164
- setDerivedValue(rrectPtr->getObject());
165
- }
166
- } else if (_boxProp->value().getType() == PropType::Object) {
167
- if (_boxProp->value().hasValue(PropNameRect)) {
168
- // 3. box is { rect: { x, y, width, height }, rx, ry }
169
- auto rectProp = _boxProp->value().getValue(PropNameRect);
170
- auto x = rectProp.getValue(PropNameX).getAsNumber();
171
- auto y = rectProp.getValue(PropNameY).getAsNumber();
172
- auto width = rectProp.getValue(PropNameWidth).getAsNumber();
173
- auto height = rectProp.getValue(PropNameHeight).getAsNumber();
174
- auto rx = _boxProp->value().getValue(PropNameRx).getAsNumber();
175
- auto ry = _boxProp->value().getValue(PropNameRy).getAsNumber();
176
- setDerivedValue(
177
- SkRRect::MakeRectXY(SkRect::MakeXYWH(x, y, width, height), rx, ry));
178
- } else {
179
- // 4. box is { x, y, width, height }
180
- auto x = _boxProp->value().getValue(PropNameX).getAsNumber();
181
- auto y = _boxProp->value().getValue(PropNameY).getAsNumber();
182
- auto width = _boxProp->value().getValue(PropNameWidth).getAsNumber();
183
- auto height = _boxProp->value().getValue(PropNameHeight).getAsNumber();
184
- setDerivedValue(
185
- SkRRect::MakeRect(SkRect::MakeXYWH(x, y, width, height)));
186
- }
159
+ auto value = _boxProp->value();
160
+ auto rect = RectProp::processRect(value);
161
+ if (rect) {
162
+ setDerivedValue(SkRRect::MakeRect(*rect));
163
+ } else {
164
+ setDerivedValue(RRectProp::processRRect(value));
187
165
  }
188
166
  }
189
167
 
@@ -31,33 +31,35 @@ public:
31
31
  _prop = defineProperty<NodeProp>(name);
32
32
  }
33
33
 
34
+ static std::shared_ptr<SkRect> processRect(const JsiValue &value) {
35
+ if (value.getType() == PropType::HostObject) {
36
+ auto rectPtr =
37
+ std::dynamic_pointer_cast<JsiSkRect>(value.getAsHostObject());
38
+ if (rectPtr != nullptr) {
39
+ return std::make_shared<SkRect>(SkRect::MakeXYWH(
40
+ rectPtr->getObject()->x(), rectPtr->getObject()->y(),
41
+ rectPtr->getObject()->width(), rectPtr->getObject()->height()));
42
+ }
43
+ } else if (value.getType() == PropType::Object &&
44
+ value.hasValue(PropNameX) && value.hasValue(PropNameY) &&
45
+ value.hasValue(PropNameWidth) &&
46
+ value.hasValue(PropNameHeight)) {
47
+ // Save props for fast access
48
+ auto x = value.getValue(PropNameX);
49
+ auto y = value.getValue(PropNameY);
50
+ auto width = value.getValue(PropNameWidth);
51
+ auto height = value.getValue(PropNameHeight);
52
+ // Update cache from js object value
53
+ return std::make_shared<SkRect>(
54
+ SkRect::MakeXYWH(x.getAsNumber(), y.getAsNumber(),
55
+ width.getAsNumber(), height.getAsNumber()));
56
+ }
57
+ return nullptr;
58
+ }
59
+
34
60
  void updateDerivedValue() override {
35
61
  if (_prop->isSet()) {
36
- // Check for JsiSkRect
37
- if (_prop->value().getType() == PropType::HostObject) {
38
- auto rectPtr = std::dynamic_pointer_cast<JsiSkRect>(
39
- _prop->value().getAsHostObject());
40
- if (rectPtr != nullptr) {
41
- setDerivedValue(SkRect::MakeXYWH(
42
- rectPtr->getObject()->x(), rectPtr->getObject()->y(),
43
- rectPtr->getObject()->width(), rectPtr->getObject()->height()));
44
- }
45
- } else {
46
- auto p = _prop->value();
47
- if (p.hasValue(PropNameX) && p.hasValue(PropNameY) &&
48
- p.hasValue(PropNameWidth) && p.hasValue(PropNameHeight)) {
49
- // Save props for fast access
50
- auto x = p.getValue(PropNameX);
51
- auto y = p.getValue(PropNameY);
52
- auto width = p.getValue(PropNameWidth);
53
- auto height = p.getValue(PropNameHeight);
54
-
55
- // Update cache from js object value
56
- setDerivedValue(SkRect::MakeXYWH(x.getAsNumber(), y.getAsNumber(),
57
- width.getAsNumber(),
58
- height.getAsNumber()));
59
- }
60
- }
62
+ setDerivedValue(RectProp::processRect(_prop->value()));
61
63
  }
62
64
  }
63
65
 
@@ -4,7 +4,6 @@
4
4
  #include <thread>
5
5
  #include <utility>
6
6
 
7
- #include <RNSkMeasureTime.h>
8
7
  #include <SkiaMetalRenderer.h>
9
8
 
10
9
  #pragma clang diagnostic push
@@ -20,7 +19,6 @@ void RNSkiOSPlatformContext::performStreamOperation(
20
19
  const std::string &sourceUri,
21
20
  const std::function<void(std::unique_ptr<SkStreamAsset>)> &op) {
22
21
 
23
- RNSkMeasureTime("PlatformContext::performStreamOperation");
24
22
  auto loader = [=]() {
25
23
  NSURL *url = [[NSURL alloc]
26
24
  initWithString:[NSString stringWithUTF8String:sourceUri.c_str()]];
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.JsiSkDOM = void 0;
7
7
 
8
+ var _HostComponents = require("../../renderer/HostComponents");
9
+
8
10
  var _drawings = require("./drawings");
9
11
 
10
12
  var _paint = require("./paint");
@@ -27,139 +29,139 @@ class JsiSkDOM {
27
29
  }
28
30
 
29
31
  Layer(props) {
30
- return global.SkiaDomApi && global.SkiaDomApi.LayerNode ? global.SkiaDomApi.LayerNode(props ?? {}) : new _LayerNode.LayerNode(this.ctx, props ?? {});
32
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.LayerNode(props ?? {}) : new _LayerNode.LayerNode(this.ctx, props ?? {});
31
33
  }
32
34
 
33
35
  Group(props) {
34
- return global.SkiaDomApi && global.SkiaDomApi.GroupNode ? global.SkiaDomApi.GroupNode(props ?? {}) : new _GroupNode.GroupNode(this.ctx, props ?? {});
36
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.GroupNode(props ?? {}) : new _GroupNode.GroupNode(this.ctx, props ?? {});
35
37
  }
36
38
 
37
39
  Paint(props) {
38
- return global.SkiaDomApi && global.SkiaDomApi.PaintNode ? global.SkiaDomApi.PaintNode(props ?? {}) : new _PaintNode.PaintNode(this.ctx, props);
40
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.PaintNode(props ?? {}) : new _PaintNode.PaintNode(this.ctx, props);
39
41
  } // Drawings
40
42
 
41
43
 
42
44
  Fill(props) {
43
- return global.SkiaDomApi && global.SkiaDomApi.FillNode ? global.SkiaDomApi.FillNode(props ?? {}) : new _drawings.FillNode(this.ctx, props);
45
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.FillNode(props ?? {}) : new _drawings.FillNode(this.ctx, props);
44
46
  }
45
47
 
46
48
  Image(props) {
47
- return global.SkiaDomApi && global.SkiaDomApi.ImageNode ? global.SkiaDomApi.ImageNode(props ?? {}) : new _drawings.ImageNode(this.ctx, props);
49
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.ImageNode(props ?? {}) : new _drawings.ImageNode(this.ctx, props);
48
50
  }
49
51
 
50
52
  Circle(props) {
51
- return global.SkiaDomApi && global.SkiaDomApi.CircleNode ? global.SkiaDomApi.CircleNode(props ?? {}) : new _drawings.CircleNode(this.ctx, props);
53
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.CircleNode(props ?? {}) : new _drawings.CircleNode(this.ctx, props);
52
54
  }
53
55
 
54
56
  Path(props) {
55
- return global.SkiaDomApi && global.SkiaDomApi.PathNode ? global.SkiaDomApi.PathNode(props ?? {}) : new _drawings.PathNode(this.ctx, props);
57
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.PathNode(props ?? {}) : new _drawings.PathNode(this.ctx, props);
56
58
  }
57
59
 
58
60
  CustomDrawing(props) {
59
- return global.SkiaDomApi && global.SkiaDomApi.CustomDrawingNode ? global.SkiaDomApi.CustomDrawingNode(props ?? {}) : new _drawings.CustomDrawingNode(this.ctx, props);
61
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.CustomDrawingNode(props ?? {}) : new _drawings.CustomDrawingNode(this.ctx, props);
60
62
  }
61
63
 
62
64
  Line(props) {
63
- return global.SkiaDomApi && global.SkiaDomApi.LineNode ? global.SkiaDomApi.LineNode(props ?? {}) : new _drawings.LineNode(this.ctx, props);
65
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.LineNode(props ?? {}) : new _drawings.LineNode(this.ctx, props);
64
66
  }
65
67
 
66
68
  Oval(props) {
67
- return global.SkiaDomApi && global.SkiaDomApi.OvalNode ? global.SkiaDomApi.OvalNode(props ?? {}) : new _drawings.OvalNode(this.ctx, props);
69
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.OvalNode(props ?? {}) : new _drawings.OvalNode(this.ctx, props);
68
70
  }
69
71
 
70
72
  Patch(props) {
71
- return global.SkiaDomApi && global.SkiaDomApi.PatchNode ? global.SkiaDomApi.PatchNode(props ?? {}) : new _drawings.PatchNode(this.ctx, props);
73
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.PatchNode(props ?? {}) : new _drawings.PatchNode(this.ctx, props);
72
74
  }
73
75
 
74
76
  Points(props) {
75
- return global.SkiaDomApi && global.SkiaDomApi.PointsNode ? global.SkiaDomApi.PointsNode(props ?? {}) : new _drawings.PointsNode(this.ctx, props);
77
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.PointsNode(props ?? {}) : new _drawings.PointsNode(this.ctx, props);
76
78
  }
77
79
 
78
80
  Rect(props) {
79
- return global.SkiaDomApi && global.SkiaDomApi.RectNode ? global.SkiaDomApi.RectNode(props) : new _drawings.RectNode(this.ctx, props);
81
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.RectNode(props) : new _drawings.RectNode(this.ctx, props);
80
82
  }
81
83
 
82
84
  RRect(props) {
83
- return global.SkiaDomApi && global.SkiaDomApi.RRectNode ? global.SkiaDomApi.RRectNode(props) : new _drawings.RRectNode(this.ctx, props);
85
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.RRectNode(props) : new _drawings.RRectNode(this.ctx, props);
84
86
  }
85
87
 
86
88
  Vertices(props) {
87
- return global.SkiaDomApi && global.SkiaDomApi.VerticesNode ? global.SkiaDomApi.VerticesNode(props) : new _drawings.VerticesNode(this.ctx, props);
89
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.VerticesNode(props) : new _drawings.VerticesNode(this.ctx, props);
88
90
  }
89
91
 
90
92
  Text(props) {
91
- return global.SkiaDomApi && global.SkiaDomApi.TextNode ? global.SkiaDomApi.TextNode(props) : new _drawings.TextNode(this.ctx, props);
93
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.TextNode(props) : new _drawings.TextNode(this.ctx, props);
92
94
  }
93
95
 
94
96
  TextPath(props) {
95
- return global.SkiaDomApi && global.SkiaDomApi.TextPathNode ? global.SkiaDomApi.TextPathNode(props) : new _drawings.TextPathNode(this.ctx, props);
97
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.TextPathNode(props) : new _drawings.TextPathNode(this.ctx, props);
96
98
  }
97
99
 
98
100
  TextBlob(props) {
99
- return global.SkiaDomApi && global.SkiaDomApi.TextBlobNode ? global.SkiaDomApi.TextBlobNode(props) : new _drawings.TextBlobNode(this.ctx, props);
101
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.TextBlobNode(props) : new _drawings.TextBlobNode(this.ctx, props);
100
102
  }
101
103
 
102
104
  Glyphs(props) {
103
- return global.SkiaDomApi && global.SkiaDomApi.GlyphsNode ? global.SkiaDomApi.GlyphsNode(props) : new _drawings.GlyphsNode(this.ctx, props);
105
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.GlyphsNode(props) : new _drawings.GlyphsNode(this.ctx, props);
104
106
  }
105
107
 
106
108
  DiffRect(props) {
107
- return global.SkiaDomApi && global.SkiaDomApi.DiffRectNode ? global.SkiaDomApi.DiffRectNode(props) : new _drawings.DiffRectNode(this.ctx, props);
109
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.DiffRectNode(props) : new _drawings.DiffRectNode(this.ctx, props);
108
110
  }
109
111
 
110
112
  Picture(props) {
111
- return global.SkiaDomApi && global.SkiaDomApi.PictureNode ? global.SkiaDomApi.PictureNode(props) : new _drawings.PictureNode(this.ctx, props);
113
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.PictureNode(props) : new _drawings.PictureNode(this.ctx, props);
112
114
  }
113
115
 
114
116
  ImageSVG(props) {
115
- return global.SkiaDomApi && global.SkiaDomApi.ImageSVGNode ? global.SkiaDomApi.ImageSVGNode(props) : new _drawings.ImageSVGNode(this.ctx, props);
117
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.ImageSVGNode(props) : new _drawings.ImageSVGNode(this.ctx, props);
116
118
  } // BlurMaskFilters
117
119
 
118
120
 
119
121
  BlurMaskFilter(props) {
120
- return global.SkiaDomApi && global.SkiaDomApi.BlurMaskFilterNode ? global.SkiaDomApi.BlurMaskFilterNode(props) : new _paint.BlurMaskFilterNode(this.ctx, props);
122
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.BlurMaskFilterNode(props) : new _paint.BlurMaskFilterNode(this.ctx, props);
121
123
  } // ImageFilters
122
124
 
123
125
 
124
126
  BlendImageFilter(props) {
125
- return global.SkiaDomApi && global.SkiaDomApi.BlendImageFilterNode ? global.SkiaDomApi.BlendImageFilterNode(props) : new _paint.BlendImageFilterNode(this.ctx, props);
127
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.BlendImageFilterNode(props) : new _paint.BlendImageFilterNode(this.ctx, props);
126
128
  }
127
129
 
128
130
  DropShadowImageFilter(props) {
129
- return global.SkiaDomApi && global.SkiaDomApi.DropShadowImageFilterNode ? global.SkiaDomApi.DropShadowImageFilterNode(props) : new _paint.DropShadowImageFilterNode(this.ctx, props);
131
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.DropShadowImageFilterNode(props) : new _paint.DropShadowImageFilterNode(this.ctx, props);
130
132
  }
131
133
 
132
134
  DisplacementMapImageFilter(props) {
133
- return global.SkiaDomApi && global.SkiaDomApi.DisplacementMapImageFilterNode ? global.SkiaDomApi.DisplacementMapImageFilterNode(props) : new _paint.DisplacementMapImageFilterNode(this.ctx, props);
135
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.DisplacementMapImageFilterNode(props) : new _paint.DisplacementMapImageFilterNode(this.ctx, props);
134
136
  }
135
137
 
136
138
  BlurImageFilter(props) {
137
- return global.SkiaDomApi && global.SkiaDomApi.BlurImageFilterNode ? global.SkiaDomApi.BlurImageFilterNode(props) : new _paint.BlurImageFilterNode(this.ctx, props);
139
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.BlurImageFilterNode(props) : new _paint.BlurImageFilterNode(this.ctx, props);
138
140
  }
139
141
 
140
142
  OffsetImageFilter(props) {
141
- return global.SkiaDomApi && global.SkiaDomApi.OffsetImageFilterNode ? global.SkiaDomApi.OffsetImageFilterNode(props) : new _paint.OffsetImageFilterNode(this.ctx, props);
143
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.OffsetImageFilterNode(props) : new _paint.OffsetImageFilterNode(this.ctx, props);
142
144
  }
143
145
 
144
146
  MorphologyImageFilter(props) {
145
- return global.SkiaDomApi && global.SkiaDomApi.MorphologyImageFilterNode ? global.SkiaDomApi.MorphologyImageFilterNode(props) : new _ImageFilters.MorphologyImageFilterNode(this.ctx, props);
147
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.MorphologyImageFilterNode(props) : new _ImageFilters.MorphologyImageFilterNode(this.ctx, props);
146
148
  }
147
149
 
148
150
  RuntimeShaderImageFilter(props) {
149
- return global.SkiaDomApi && global.SkiaDomApi.RuntimeShaderImageFilterNode ? global.SkiaDomApi.RuntimeShaderImageFilterNode(props) : new _paint.RuntimeShaderImageFilterNode(this.ctx, props);
151
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.RuntimeShaderImageFilterNode(props) : new _paint.RuntimeShaderImageFilterNode(this.ctx, props);
150
152
  } // Color Filters
151
153
 
152
154
 
153
155
  MatrixColorFilter(props) {
154
- return global.SkiaDomApi && global.SkiaDomApi.MatrixColorFilterNode ? global.SkiaDomApi.MatrixColorFilterNode(props) : new _ColorFilters.MatrixColorFilterNode(this.ctx, props);
156
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.MatrixColorFilterNode(props) : new _ColorFilters.MatrixColorFilterNode(this.ctx, props);
155
157
  }
156
158
 
157
159
  BlendColorFilter(props) {
158
- return global.SkiaDomApi && global.SkiaDomApi.BlendColorFilterNode ? global.SkiaDomApi.BlendColorFilterNode(props) : new _ColorFilters.BlendColorFilterNode(this.ctx, props);
160
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.BlendColorFilterNode(props) : new _ColorFilters.BlendColorFilterNode(this.ctx, props);
159
161
  }
160
162
 
161
163
  LumaColorFilter() {
162
- return global.SkiaDomApi && global.SkiaDomApi.LumaColorFilterNode ? global.SkiaDomApi.LumaColorFilterNode() : new _ColorFilters.LumaColorFilterNode(this.ctx);
164
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.LumaColorFilterNode() : new _ColorFilters.LumaColorFilterNode(this.ctx);
163
165
  }
164
166
 
165
167
  LinearToSRGBGammaColorFilter() {
@@ -171,89 +173,89 @@ class JsiSkDOM {
171
173
  }
172
174
 
173
175
  LerpColorFilter(props) {
174
- return global.SkiaDomApi && global.SkiaDomApi.LerpColorFilterNode ? global.SkiaDomApi.LerpColorFilterNode(props) : new _ColorFilters.LerpColorFilterNode(this.ctx, props);
176
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.LerpColorFilterNode(props) : new _ColorFilters.LerpColorFilterNode(this.ctx, props);
175
177
  } // Shaders
176
178
 
177
179
 
178
180
  Shader(props) {
179
- return global.SkiaDomApi && global.SkiaDomApi.ShaderNode ? global.SkiaDomApi.ShaderNode(props) : new _Shaders.ShaderNode(this.ctx, props);
181
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.ShaderNode(props) : new _Shaders.ShaderNode(this.ctx, props);
180
182
  }
181
183
 
182
184
  ImageShader(props) {
183
- return global.SkiaDomApi && global.SkiaDomApi.ImageShaderNode ? global.SkiaDomApi.ImageShaderNode(props) : new _Shaders.ImageShaderNode(this.ctx, props);
185
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.ImageShaderNode(props) : new _Shaders.ImageShaderNode(this.ctx, props);
184
186
  }
185
187
 
186
188
  ColorShader(props) {
187
- return global.SkiaDomApi && global.SkiaDomApi.ColorShaderNode ? global.SkiaDomApi.ColorShaderNode(props) : new _Shaders.ColorNode(this.ctx, props);
189
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.ColorShaderNode(props) : new _Shaders.ColorNode(this.ctx, props);
188
190
  }
189
191
 
190
192
  SweepGradient(props) {
191
- return global.SkiaDomApi && global.SkiaDomApi.SweepGradientNode ? global.SkiaDomApi.SweepGradientNode(props) : new _Shaders.SweepGradientNode(this.ctx, props);
193
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.SweepGradientNode(props) : new _Shaders.SweepGradientNode(this.ctx, props);
192
194
  }
193
195
 
194
196
  Turbulence(props) {
195
- return global.SkiaDomApi && global.SkiaDomApi.TurbulenceNode ? global.SkiaDomApi.TurbulenceNode(props) : new _Shaders.TurbulenceNode(this.ctx, props);
197
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.TurbulenceNode(props) : new _Shaders.TurbulenceNode(this.ctx, props);
196
198
  }
197
199
 
198
200
  FractalNoise(props) {
199
- return global.SkiaDomApi && global.SkiaDomApi.FractalNoiseNode ? global.SkiaDomApi.FractalNoiseNode(props) : new _Shaders.FractalNoiseNode(this.ctx, props);
201
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.FractalNoiseNode(props) : new _Shaders.FractalNoiseNode(this.ctx, props);
200
202
  }
201
203
 
202
204
  LinearGradient(props) {
203
- return global.SkiaDomApi && global.SkiaDomApi.LinearGradientNode ? global.SkiaDomApi.LinearGradientNode(props) : new _Shaders.LinearGradientNode(this.ctx, props);
205
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.LinearGradientNode(props) : new _Shaders.LinearGradientNode(this.ctx, props);
204
206
  }
205
207
 
206
208
  RadialGradient(props) {
207
- return global.SkiaDomApi && global.SkiaDomApi.RadialGradientNode ? global.SkiaDomApi.RadialGradientNode(props) : new _Shaders.RadialGradientNode(this.ctx, props);
209
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.RadialGradientNode(props) : new _Shaders.RadialGradientNode(this.ctx, props);
208
210
  }
209
211
 
210
212
  TwoPointConicalGradient(props) {
211
- return global.SkiaDomApi && global.SkiaDomApi.TwoPointConicalGradientNode ? global.SkiaDomApi.TwoPointConicalGradientNode(props) : new _Shaders.TwoPointConicalGradientNode(this.ctx, props);
213
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.TwoPointConicalGradientNode(props) : new _Shaders.TwoPointConicalGradientNode(this.ctx, props);
212
214
  } // Path Effects
213
215
 
214
216
 
215
217
  CornerPathEffect(props) {
216
- return global.SkiaDomApi && global.SkiaDomApi.CornerPathEffectNode ? global.SkiaDomApi.CornerPathEffectNode(props) : new _paint.CornerPathEffectNode(this.ctx, props);
218
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.CornerPathEffectNode(props) : new _paint.CornerPathEffectNode(this.ctx, props);
217
219
  }
218
220
 
219
221
  DiscretePathEffect(props) {
220
- return global.SkiaDomApi && global.SkiaDomApi.DiscretePathEffectNode ? global.SkiaDomApi.DiscretePathEffectNode(props) : new _paint.DiscretePathEffectNode(this.ctx, props);
222
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.DiscretePathEffectNode(props) : new _paint.DiscretePathEffectNode(this.ctx, props);
221
223
  }
222
224
 
223
225
  DashPathEffect(props) {
224
- return global.SkiaDomApi && global.SkiaDomApi.DashPathEffectNode ? global.SkiaDomApi.DashPathEffectNode(props) : new _paint.DashPathEffectNode(this.ctx, props);
226
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.DashPathEffectNode(props) : new _paint.DashPathEffectNode(this.ctx, props);
225
227
  }
226
228
 
227
229
  Path1DPathEffect(props) {
228
- return global.SkiaDomApi && global.SkiaDomApi.Path1DPathEffectNode ? global.SkiaDomApi.Path1DPathEffectNode(props) : new _paint.Path1DPathEffectNode(this.ctx, props);
230
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.Path1DPathEffectNode(props) : new _paint.Path1DPathEffectNode(this.ctx, props);
229
231
  }
230
232
 
231
233
  Path2DPathEffect(props) {
232
- return global.SkiaDomApi && global.SkiaDomApi.Path2DPathEffectNode ? global.SkiaDomApi.Path2DPathEffectNode(props) : new _paint.Path2DPathEffectNode(this.ctx, props);
234
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.Path2DPathEffectNode(props) : new _paint.Path2DPathEffectNode(this.ctx, props);
233
235
  }
234
236
 
235
237
  SumPathEffect() {
236
- return global.SkiaDomApi && global.SkiaDomApi.SumPathEffectNode ? global.SkiaDomApi.SumPathEffectNode() : new _paint.SumPathEffectNode(this.ctx);
238
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.SumPathEffectNode() : new _paint.SumPathEffectNode(this.ctx);
237
239
  }
238
240
 
239
241
  Line2DPathEffect(props) {
240
- return global.SkiaDomApi && global.SkiaDomApi.Line2DPathEffectNode ? global.SkiaDomApi.Line2DPathEffectNode(props) : new _paint.Line2DPathEffectNode(this.ctx, props);
242
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.Line2DPathEffectNode(props) : new _paint.Line2DPathEffectNode(this.ctx, props);
241
243
  }
242
244
 
243
245
  Blend(props) {
244
- return global.SkiaDomApi && global.SkiaDomApi.BlendNode ? global.SkiaDomApi.BlendNode(props) : new _paint.BlendNode(this.ctx, props);
246
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.BlendNode(props) : new _paint.BlendNode(this.ctx, props);
245
247
  }
246
248
 
247
249
  BackdropFilter(props) {
248
- return global.SkiaDomApi && global.SkiaDomApi.BackdropFilterNode ? global.SkiaDomApi.BackdropFilterNode(props) : new _drawings.BackdropFilterNode(this.ctx, props);
250
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.BackdropFilterNode(props) : new _drawings.BackdropFilterNode(this.ctx, props);
249
251
  }
250
252
 
251
253
  Box(props) {
252
- return global.SkiaDomApi && global.SkiaDomApi.BoxNode ? global.SkiaDomApi.BoxNode(props) : new _drawings.BoxNode(this.ctx, props);
254
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.BoxNode(props) : new _drawings.BoxNode(this.ctx, props);
253
255
  }
254
256
 
255
257
  BoxShadow(props) {
256
- return global.SkiaDomApi && global.SkiaDomApi.BoxShadowNode ? global.SkiaDomApi.BoxShadowNode(props) : new _drawings.BoxShadowNode(this.ctx, props);
258
+ return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.BoxShadowNode(props) : new _drawings.BoxShadowNode(this.ctx, props);
257
259
  }
258
260
 
259
261
  }