@shopify/react-native-skia 0.1.225 → 0.1.227

Sign up to get free protection for your applications and to get access to all the features.
Files changed (243) hide show
  1. package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.h +3 -3
  2. package/cpp/api/JsiSkMatrix.h +8 -2
  3. package/cpp/api/JsiSkPictureRecorder.h +10 -3
  4. package/cpp/rnskia/dom/props/MatrixProp.h +8 -0
  5. package/cpp/rnskia/dom/props/TransformProp.h +76 -9
  6. package/lib/commonjs/animation/spring/runSpring.d.ts +3 -0
  7. package/lib/commonjs/animation/spring/runSpring.js +3 -0
  8. package/lib/commonjs/animation/spring/runSpring.js.map +1 -1
  9. package/lib/commonjs/animation/spring/useSpring.d.ts +3 -0
  10. package/lib/commonjs/animation/spring/useSpring.js +3 -0
  11. package/lib/commonjs/animation/spring/useSpring.js.map +1 -1
  12. package/lib/commonjs/animation/timing/runTiming.d.ts +3 -0
  13. package/lib/commonjs/animation/timing/runTiming.js +3 -0
  14. package/lib/commonjs/animation/timing/runTiming.js.map +1 -1
  15. package/lib/commonjs/animation/timing/useLoop.d.ts +3 -0
  16. package/lib/commonjs/animation/timing/useLoop.js +3 -0
  17. package/lib/commonjs/animation/timing/useLoop.js.map +1 -1
  18. package/lib/commonjs/animation/timing/useTiming.d.ts +3 -0
  19. package/lib/commonjs/animation/timing/useTiming.js +3 -0
  20. package/lib/commonjs/animation/timing/useTiming.js.map +1 -1
  21. package/lib/commonjs/dom/nodes/JsiSkDOM.js +2 -0
  22. package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
  23. package/lib/commonjs/dom/nodes/datatypes/Fitting.d.ts +5 -5
  24. package/lib/commonjs/dom/nodes/datatypes/Fitting.js.map +1 -1
  25. package/lib/commonjs/dom/nodes/datatypes/Gradient.d.ts +235 -75
  26. package/lib/commonjs/dom/nodes/datatypes/Gradient.js.map +1 -1
  27. package/lib/commonjs/dom/types/Common.d.ts +3 -3
  28. package/lib/commonjs/dom/types/Common.js.map +1 -1
  29. package/lib/commonjs/external/reanimated/interpolators.js +10 -4
  30. package/lib/commonjs/external/reanimated/interpolators.js.map +1 -1
  31. package/lib/commonjs/renderer/Canvas.js +34 -28
  32. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  33. package/lib/commonjs/renderer/components/Drawing.d.ts +5 -0
  34. package/lib/commonjs/renderer/components/Drawing.js +5 -0
  35. package/lib/commonjs/renderer/components/Drawing.js.map +1 -1
  36. package/lib/commonjs/renderer/components/shapes/FitBox.d.ts +5 -5
  37. package/lib/commonjs/skia/core/Matrix.d.ts +2 -2
  38. package/lib/commonjs/skia/core/Matrix.js.map +1 -1
  39. package/lib/commonjs/skia/core/Picture.d.ts +2 -2
  40. package/lib/commonjs/skia/core/Picture.js +12 -2
  41. package/lib/commonjs/skia/core/Picture.js.map +1 -1
  42. package/lib/commonjs/skia/core/Vector.d.ts +3 -3
  43. package/lib/commonjs/skia/core/Vector.js.map +1 -1
  44. package/lib/commonjs/skia/types/Canvas.d.ts +1 -1
  45. package/lib/commonjs/skia/types/Canvas.js.map +1 -1
  46. package/lib/commonjs/skia/types/Matrix.d.ts +4 -9
  47. package/lib/commonjs/skia/types/Matrix.js +5 -56
  48. package/lib/commonjs/skia/types/Matrix.js.map +1 -1
  49. package/lib/commonjs/skia/types/Matrix4.d.ts +39 -0
  50. package/lib/commonjs/skia/types/Matrix4.js +213 -0
  51. package/lib/commonjs/skia/types/Matrix4.js.map +1 -0
  52. package/lib/commonjs/skia/types/Path/Path.d.ts +1 -1
  53. package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
  54. package/lib/commonjs/skia/types/Picture/PictureRecorder.d.ts +1 -1
  55. package/lib/commonjs/skia/types/Picture/PictureRecorder.js.map +1 -1
  56. package/lib/commonjs/skia/types/Rect.d.ts +1 -0
  57. package/lib/commonjs/skia/types/Rect.js +18 -0
  58. package/lib/commonjs/skia/types/Rect.js.map +1 -1
  59. package/lib/commonjs/skia/types/index.d.ts +1 -0
  60. package/lib/commonjs/skia/types/index.js +13 -0
  61. package/lib/commonjs/skia/types/index.js.map +1 -1
  62. package/lib/commonjs/skia/web/JsiSkCanvas.d.ts +1 -1
  63. package/lib/commonjs/skia/web/JsiSkCanvas.js +1 -1
  64. package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
  65. package/lib/commonjs/skia/web/JsiSkMatrix.d.ts +1 -1
  66. package/lib/commonjs/skia/web/JsiSkMatrix.js +1 -1
  67. package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
  68. package/lib/commonjs/skia/web/JsiSkPath.js +1 -1
  69. package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
  70. package/lib/commonjs/skia/web/JsiSkPictureRecorder.d.ts +1 -1
  71. package/lib/commonjs/skia/web/JsiSkPictureRecorder.js +1 -1
  72. package/lib/commonjs/skia/web/JsiSkPictureRecorder.js.map +1 -1
  73. package/lib/commonjs/values/api.d.ts +23 -2
  74. package/lib/commonjs/values/api.js +44 -1
  75. package/lib/commonjs/values/api.js.map +1 -1
  76. package/lib/commonjs/values/hooks/useClockValue.d.ts +3 -0
  77. package/lib/commonjs/values/hooks/useClockValue.js +3 -0
  78. package/lib/commonjs/values/hooks/useClockValue.js.map +1 -1
  79. package/lib/commonjs/values/hooks/useComputedValue.d.ts +3 -0
  80. package/lib/commonjs/values/hooks/useComputedValue.js +3 -0
  81. package/lib/commonjs/values/hooks/useComputedValue.js.map +1 -1
  82. package/lib/commonjs/values/hooks/useValue.d.ts +3 -0
  83. package/lib/commonjs/values/hooks/useValue.js +3 -0
  84. package/lib/commonjs/values/hooks/useValue.js.map +1 -1
  85. package/lib/commonjs/values/hooks/useValueEffect.d.ts +3 -0
  86. package/lib/commonjs/values/hooks/useValueEffect.js +3 -0
  87. package/lib/commonjs/values/hooks/useValueEffect.js.map +1 -1
  88. package/lib/commonjs/values/types.d.ts +4 -4
  89. package/lib/commonjs/values/types.js.map +1 -1
  90. package/lib/commonjs/views/SkiaView.d.ts +5 -0
  91. package/lib/commonjs/views/SkiaView.js +9 -0
  92. package/lib/commonjs/views/SkiaView.js.map +1 -1
  93. package/lib/module/animation/spring/runSpring.d.ts +3 -0
  94. package/lib/module/animation/spring/runSpring.js +3 -0
  95. package/lib/module/animation/spring/runSpring.js.map +1 -1
  96. package/lib/module/animation/spring/useSpring.d.ts +3 -0
  97. package/lib/module/animation/spring/useSpring.js +3 -0
  98. package/lib/module/animation/spring/useSpring.js.map +1 -1
  99. package/lib/module/animation/timing/runTiming.d.ts +3 -0
  100. package/lib/module/animation/timing/runTiming.js +3 -0
  101. package/lib/module/animation/timing/runTiming.js.map +1 -1
  102. package/lib/module/animation/timing/useLoop.d.ts +3 -0
  103. package/lib/module/animation/timing/useLoop.js +3 -0
  104. package/lib/module/animation/timing/useLoop.js.map +1 -1
  105. package/lib/module/animation/timing/useTiming.d.ts +3 -0
  106. package/lib/module/animation/timing/useTiming.js +3 -0
  107. package/lib/module/animation/timing/useTiming.js.map +1 -1
  108. package/lib/module/dom/nodes/JsiSkDOM.js +2 -0
  109. package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
  110. package/lib/module/dom/nodes/datatypes/Fitting.d.ts +5 -5
  111. package/lib/module/dom/nodes/datatypes/Fitting.js.map +1 -1
  112. package/lib/module/dom/nodes/datatypes/Gradient.d.ts +235 -75
  113. package/lib/module/dom/nodes/datatypes/Gradient.js.map +1 -1
  114. package/lib/module/dom/types/Common.d.ts +3 -3
  115. package/lib/module/dom/types/Common.js.map +1 -1
  116. package/lib/module/external/reanimated/interpolators.js +11 -5
  117. package/lib/module/external/reanimated/interpolators.js.map +1 -1
  118. package/lib/module/renderer/Canvas.js +35 -29
  119. package/lib/module/renderer/Canvas.js.map +1 -1
  120. package/lib/module/renderer/components/Drawing.d.ts +5 -0
  121. package/lib/module/renderer/components/Drawing.js +6 -0
  122. package/lib/module/renderer/components/Drawing.js.map +1 -1
  123. package/lib/module/renderer/components/shapes/FitBox.d.ts +5 -5
  124. package/lib/module/skia/core/Matrix.d.ts +2 -2
  125. package/lib/module/skia/core/Matrix.js.map +1 -1
  126. package/lib/module/skia/core/Picture.d.ts +2 -2
  127. package/lib/module/skia/core/Picture.js +12 -3
  128. package/lib/module/skia/core/Picture.js.map +1 -1
  129. package/lib/module/skia/core/Vector.d.ts +3 -3
  130. package/lib/module/skia/core/Vector.js.map +1 -1
  131. package/lib/module/skia/types/Canvas.d.ts +1 -1
  132. package/lib/module/skia/types/Canvas.js.map +1 -1
  133. package/lib/module/skia/types/Matrix.d.ts +4 -9
  134. package/lib/module/skia/types/Matrix.js +3 -57
  135. package/lib/module/skia/types/Matrix.js.map +1 -1
  136. package/lib/module/skia/types/Matrix4.d.ts +39 -0
  137. package/lib/module/skia/types/Matrix4.js +200 -0
  138. package/lib/module/skia/types/Matrix4.js.map +1 -0
  139. package/lib/module/skia/types/Path/Path.d.ts +1 -1
  140. package/lib/module/skia/types/Path/Path.js.map +1 -1
  141. package/lib/module/skia/types/Picture/PictureRecorder.d.ts +1 -1
  142. package/lib/module/skia/types/Picture/PictureRecorder.js.map +1 -1
  143. package/lib/module/skia/types/Rect.d.ts +1 -0
  144. package/lib/module/skia/types/Rect.js +9 -0
  145. package/lib/module/skia/types/Rect.js.map +1 -1
  146. package/lib/module/skia/types/index.d.ts +1 -0
  147. package/lib/module/skia/types/index.js +1 -0
  148. package/lib/module/skia/types/index.js.map +1 -1
  149. package/lib/module/skia/web/JsiSkCanvas.d.ts +1 -1
  150. package/lib/module/skia/web/JsiSkCanvas.js +1 -1
  151. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
  152. package/lib/module/skia/web/JsiSkMatrix.d.ts +1 -1
  153. package/lib/module/skia/web/JsiSkMatrix.js +1 -1
  154. package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
  155. package/lib/module/skia/web/JsiSkPath.js +1 -1
  156. package/lib/module/skia/web/JsiSkPath.js.map +1 -1
  157. package/lib/module/skia/web/JsiSkPictureRecorder.d.ts +1 -1
  158. package/lib/module/skia/web/JsiSkPictureRecorder.js +1 -1
  159. package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -1
  160. package/lib/module/values/api.d.ts +23 -2
  161. package/lib/module/values/api.js +44 -1
  162. package/lib/module/values/api.js.map +1 -1
  163. package/lib/module/values/hooks/useClockValue.d.ts +3 -0
  164. package/lib/module/values/hooks/useClockValue.js +3 -0
  165. package/lib/module/values/hooks/useClockValue.js.map +1 -1
  166. package/lib/module/values/hooks/useComputedValue.d.ts +3 -0
  167. package/lib/module/values/hooks/useComputedValue.js +3 -0
  168. package/lib/module/values/hooks/useComputedValue.js.map +1 -1
  169. package/lib/module/values/hooks/useValue.d.ts +3 -0
  170. package/lib/module/values/hooks/useValue.js +3 -0
  171. package/lib/module/values/hooks/useValue.js.map +1 -1
  172. package/lib/module/values/hooks/useValueEffect.d.ts +3 -0
  173. package/lib/module/values/hooks/useValueEffect.js +3 -0
  174. package/lib/module/values/hooks/useValueEffect.js.map +1 -1
  175. package/lib/module/values/types.d.ts +4 -4
  176. package/lib/module/values/types.js.map +1 -1
  177. package/lib/module/views/SkiaView.d.ts +5 -0
  178. package/lib/module/views/SkiaView.js +10 -0
  179. package/lib/module/views/SkiaView.js.map +1 -1
  180. package/lib/typescript/src/animation/spring/runSpring.d.ts +3 -0
  181. package/lib/typescript/src/animation/spring/useSpring.d.ts +3 -0
  182. package/lib/typescript/src/animation/timing/runTiming.d.ts +3 -0
  183. package/lib/typescript/src/animation/timing/useLoop.d.ts +3 -0
  184. package/lib/typescript/src/animation/timing/useTiming.d.ts +3 -0
  185. package/lib/typescript/src/dom/nodes/datatypes/Fitting.d.ts +5 -5
  186. package/lib/typescript/src/dom/nodes/datatypes/Gradient.d.ts +235 -75
  187. package/lib/typescript/src/dom/types/Common.d.ts +3 -3
  188. package/lib/typescript/src/renderer/components/Drawing.d.ts +5 -0
  189. package/lib/typescript/src/renderer/components/shapes/FitBox.d.ts +5 -5
  190. package/lib/typescript/src/skia/core/Matrix.d.ts +2 -2
  191. package/lib/typescript/src/skia/core/Picture.d.ts +2 -2
  192. package/lib/typescript/src/skia/core/Vector.d.ts +3 -3
  193. package/lib/typescript/src/skia/types/Canvas.d.ts +1 -1
  194. package/lib/typescript/src/skia/types/Matrix.d.ts +4 -9
  195. package/lib/typescript/src/skia/types/Matrix4.d.ts +39 -0
  196. package/lib/typescript/src/skia/types/Path/Path.d.ts +1 -1
  197. package/lib/typescript/src/skia/types/Picture/PictureRecorder.d.ts +1 -1
  198. package/lib/typescript/src/skia/types/Rect.d.ts +1 -0
  199. package/lib/typescript/src/skia/types/index.d.ts +1 -0
  200. package/lib/typescript/src/skia/web/JsiSkCanvas.d.ts +1 -1
  201. package/lib/typescript/src/skia/web/JsiSkMatrix.d.ts +1 -1
  202. package/lib/typescript/src/skia/web/JsiSkPictureRecorder.d.ts +1 -1
  203. package/lib/typescript/src/values/api.d.ts +23 -2
  204. package/lib/typescript/src/values/hooks/useClockValue.d.ts +3 -0
  205. package/lib/typescript/src/values/hooks/useComputedValue.d.ts +3 -0
  206. package/lib/typescript/src/values/hooks/useValue.d.ts +3 -0
  207. package/lib/typescript/src/values/hooks/useValueEffect.d.ts +3 -0
  208. package/lib/typescript/src/values/types.d.ts +4 -4
  209. package/lib/typescript/src/views/SkiaView.d.ts +5 -0
  210. package/package.json +1 -1
  211. package/src/animation/spring/runSpring.ts +3 -0
  212. package/src/animation/spring/useSpring.ts +3 -0
  213. package/src/animation/timing/runTiming.ts +3 -0
  214. package/src/animation/timing/useLoop.ts +3 -0
  215. package/src/animation/timing/useTiming.ts +3 -0
  216. package/src/dom/nodes/JsiSkDOM.ts +4 -0
  217. package/src/dom/nodes/datatypes/Fitting.ts +10 -2
  218. package/src/dom/nodes/datatypes/Gradient.ts +2 -2
  219. package/src/dom/types/Common.ts +3 -3
  220. package/src/external/reanimated/interpolators.ts +14 -6
  221. package/src/renderer/Canvas.tsx +41 -30
  222. package/src/renderer/components/Drawing.tsx +5 -0
  223. package/src/skia/core/Matrix.ts +2 -2
  224. package/src/skia/core/Picture.ts +11 -3
  225. package/src/skia/core/Vector.ts +5 -2
  226. package/src/skia/types/Canvas.ts +1 -1
  227. package/src/skia/types/Matrix.ts +7 -74
  228. package/src/skia/types/Matrix4.ts +266 -0
  229. package/src/skia/types/Path/Path.ts +1 -1
  230. package/src/skia/types/Picture/PictureRecorder.ts +1 -1
  231. package/src/skia/types/Rect.ts +14 -0
  232. package/src/skia/types/index.ts +1 -0
  233. package/src/skia/web/JsiSkCanvas.ts +2 -2
  234. package/src/skia/web/JsiSkMatrix.ts +4 -2
  235. package/src/skia/web/JsiSkPath.ts +1 -1
  236. package/src/skia/web/JsiSkPictureRecorder.ts +6 -2
  237. package/src/values/api.ts +55 -2
  238. package/src/values/hooks/useClockValue.ts +3 -0
  239. package/src/values/hooks/useComputedValue.ts +3 -0
  240. package/src/values/hooks/useValue.ts +3 -0
  241. package/src/values/hooks/useValueEffect.ts +3 -0
  242. package/src/values/types.ts +6 -6
  243. package/src/views/SkiaView.tsx +11 -0
@@ -89,8 +89,8 @@ public:
89
89
 
90
90
  // Check for exceptions
91
91
  if (env->ExceptionCheck()) {
92
- RNSkLogger::logToConsole(
93
- "updateTexImage() failed. The exception above can safely be ignored");
92
+ RNSkLogger::logToConsole("updateAndRelease() failed. The exception above "
93
+ "can safely be ignored");
94
94
  env->ExceptionClear();
95
95
  }
96
96
  }
@@ -162,4 +162,4 @@ public:
162
162
  }
163
163
  };
164
164
 
165
- } // namespace RNSkia
165
+ } // namespace RNSkia
@@ -41,8 +41,14 @@ public:
41
41
  }
42
42
 
43
43
  JSI_HOST_FUNCTION(concat) {
44
- auto m3 = JsiSkMatrix::fromValue(runtime, arguments[0]);
45
- getObject()->preConcat(*m3);
44
+ if (arguments[0].isObject() &&
45
+ arguments[0].asObject(runtime).isHostObject(runtime)) {
46
+ auto m3 = JsiSkMatrix::fromValue(runtime, arguments[0]);
47
+ getObject()->preConcat(*m3);
48
+ } else {
49
+ auto m3 = JsiSkMatrix::getMatrix(runtime, arguments[0]);
50
+ getObject()->preConcat(m3);
51
+ }
46
52
  return thisValue.asObject(runtime);
47
53
  }
48
54
 
@@ -27,9 +27,16 @@ public:
27
27
  context, std::make_shared<SkPictureRecorder>()) {}
28
28
 
29
29
  JSI_HOST_FUNCTION(beginRecording) {
30
- auto rect = JsiSkRect::fromValue(runtime, arguments[0]);
31
- SkRTreeFactory factory;
32
- auto canvas = getObject()->beginRecording(*rect, &factory);
30
+ SkCanvas *canvas;
31
+ if (count > 0 && !arguments[0].isUndefined()) {
32
+ auto rect = JsiSkRect::fromValue(runtime, arguments[0]);
33
+ SkRTreeFactory factory;
34
+ canvas = getObject()->beginRecording(*rect, &factory);
35
+ } else {
36
+ SkISize size = SkISize::Make(2'000'000, 2'000'000);
37
+ SkRect rect = SkRect::Make(size);
38
+ canvas = getObject()->beginRecording(rect, nullptr);
39
+ }
33
40
  return jsi::Object::createFromHostObject(
34
41
  runtime, std::make_shared<JsiSkCanvas>(getContext(), canvas));
35
42
  }
@@ -25,6 +25,14 @@ public:
25
25
  if (matrix != nullptr) {
26
26
  setDerivedValue(matrix->getObject());
27
27
  }
28
+ } else if (_matrixProp->isSet()) {
29
+ auto values = _matrixProp->value().getAsArray();
30
+ auto m3 = std::make_shared<SkMatrix>();
31
+ for (size_t i = 0; i < values.size(); ++i) {
32
+ auto a = values[i];
33
+ m3->set(i, a.getAsNumber());
34
+ }
35
+ setDerivedValue(m3);
28
36
  }
29
37
  }
30
38
 
@@ -10,6 +10,8 @@ namespace RNSkia {
10
10
 
11
11
  static PropId PropNameTranslateX = JsiPropId::get("translateX");
12
12
  static PropId PropNameTranslateY = JsiPropId::get("translateY");
13
+ static PropId PropNameTranslateZ = JsiPropId::get("translateZ");
14
+ static PropId PropNameTranslate = JsiPropId::get("translate");
13
15
  static PropId PropNameScale = JsiPropId::get("scale");
14
16
  static PropId PropNameScaleX = JsiPropId::get("scaleX");
15
17
  static PropId PropNameScaleY = JsiPropId::get("scaleY");
@@ -17,6 +19,10 @@ static PropId PropNameSkewX = JsiPropId::get("skewX");
17
19
  static PropId PropNameSkewY = JsiPropId::get("skewY");
18
20
  static PropId PropNameRotate = JsiPropId::get("rotate");
19
21
  static PropId PropNameRotateZ = JsiPropId::get("rotateZ");
22
+ static PropId PropNameRotateX = JsiPropId::get("rotateX");
23
+ static PropId PropNameRotateY = JsiPropId::get("rotateY");
24
+ static PropId PropNamePerspective = JsiPropId::get("perspective");
25
+ static PropId PropNameMatrix4 = JsiPropId::get("matrix");
20
26
 
21
27
  class TransformProp : public DerivedProp<SkMatrix> {
22
28
  public:
@@ -34,6 +40,7 @@ public:
34
40
  "Expected array for transform property, got " +
35
41
  JsiValue::getTypeAsString(_transformProp->value().getType()));
36
42
  } else {
43
+ SkM44 m4;
37
44
  auto m = std::make_shared<SkMatrix>(SkMatrix());
38
45
  for (auto &el : _transformProp->value().getAsArray()) {
39
46
  auto keys = el.getKeys();
@@ -44,23 +51,82 @@ public:
44
51
  "scaleX, scaleY, skewX, skewY, rotate or rotateZ.");
45
52
  }
46
53
  auto key = el.getKeys().at(0);
47
- auto value = el.getValue(key).getAsNumber();
48
54
  if (key == PropNameTranslateX) {
49
- m->preTranslate(value, 0);
55
+ auto x = el.getValue(key).getAsNumber();
56
+ SkM44 trX(1, 0, 0, x, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
57
+ m4.preConcat(trX);
50
58
  } else if (key == PropNameTranslateY) {
51
- m->preTranslate(0, value);
59
+ auto y = el.getValue(key).getAsNumber();
60
+ SkM44 trY(1, 0, 0, 0, 0, 1, 0, y, 0, 0, 1, 0, 0, 0, 0, 1);
61
+ m4.preConcat(trY);
62
+ } else if (key == PropNameTranslateZ) {
63
+ auto z = el.getValue(key).getAsNumber();
64
+ SkM44 trZ(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, z, 0, 0, 0, 1);
65
+ m4.preConcat(trZ);
66
+ } else if (key == PropNameTranslate) {
67
+ auto arr = el.getValue(key).getAsArray();
68
+ double x = 0, y = 0, z = 0;
69
+ for (size_t i = 0; i < arr.size(); ++i) {
70
+ if (i == 0) {
71
+ x = arr[i].getAsNumber();
72
+ } else if (i == 1) {
73
+ y = arr[i].getAsNumber();
74
+ } else if (i == 2) {
75
+ z = arr[i].getAsNumber();
76
+ }
77
+ }
78
+ SkM44 tr(1, 0, 0, x, 0, 1, 0, y, 0, 0, 1, z, 0, 0, 0, 1);
79
+ m4.preConcat(tr);
52
80
  } else if (key == PropNameScale) {
53
- m->preScale(value, value);
81
+ auto s = el.getValue(key).getAsNumber();
82
+ SkM44 scale(s, 0, 0, 0, 0, s, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
83
+ m4.preConcat(scale);
54
84
  } else if (key == PropNameScaleX) {
55
- m->preScale(value, 1);
85
+ auto s = el.getValue(key).getAsNumber();
86
+ SkM44 scale(s, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
87
+ m4.preConcat(scale);
56
88
  } else if (key == PropNameScaleY) {
57
- m->preScale(1, value);
89
+ auto s = el.getValue(key).getAsNumber();
90
+ SkM44 scale(1, 0, 0, 0, 0, s, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
91
+ m4.preConcat(scale);
58
92
  } else if (key == PropNameSkewX) {
59
- m->preSkew(value, 0);
93
+ auto angle = el.getValue(key).getAsNumber();
94
+ SkM44 skewX(1, 0, 0, 0, std::tan(angle), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0,
95
+ 1);
96
+ m4.preConcat(skewX);
60
97
  } else if (key == PropNameSkewY) {
61
- m->preSkew(0, value);
98
+ auto angle = el.getValue(key).getAsNumber();
99
+ SkM44 skewY(1, std::tan(angle), 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0,
100
+ 1);
101
+ m4.preConcat(skewY);
62
102
  } else if (key == PropNameRotate || key == PropNameRotateZ) {
63
- m->preRotate(SkRadiansToDegrees(value));
103
+ auto angle = el.getValue(key).getAsNumber();
104
+ SkM44 rotate;
105
+ rotate.setRotateUnit({0, 0, 1}, angle);
106
+ m4.preConcat(rotate);
107
+ } else if (key == PropNameRotateY) {
108
+ auto angle = el.getValue(key).getAsNumber();
109
+ SkM44 rotate;
110
+ rotate.setRotateUnit({0, 1, 0}, angle);
111
+ m4.preConcat(rotate);
112
+ } else if (key == PropNameRotateX) {
113
+ auto angle = el.getValue(key).getAsNumber();
114
+ SkM44 rotate;
115
+ rotate.setRotateUnit({1, 0, 0}, angle);
116
+ m4.preConcat(rotate);
117
+ } else if (key == PropNamePerspective) {
118
+ auto p = el.getValue(key).getAsNumber();
119
+ SkM44 perspective(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, -1 / p,
120
+ 1);
121
+ m4.preConcat(perspective);
122
+ } else if (key == PropNameMatrix4) {
123
+ auto arr = el.getValue(key).getAsArray();
124
+ SkM44 m44;
125
+ for (size_t i = 0; i < arr.size(); ++i) {
126
+ auto obj = arr[i];
127
+ m44.setRC(i / 4, i % 4, obj.getAsNumber());
128
+ }
129
+ m4.preConcat(m44);
64
130
  } else {
65
131
  throw std::runtime_error(
66
132
  "Unknown key in transform. Expected translateX, translateY, "
@@ -69,6 +135,7 @@ public:
69
135
  std::string(key) + ".");
70
136
  }
71
137
  }
138
+ m->preConcat(m4.asM33());
72
139
  setDerivedValue(m);
73
140
  }
74
141
  }
@@ -1,6 +1,9 @@
1
1
  import type { SkiaMutableValue, SkiaAnimation } from "../../values/types";
2
2
  import type { AnimationParams, SpringConfig, AnimationCallback } from "../types";
3
3
  /**
4
+ * @deprecated Use Reanimated 3 for animations:
5
+ * https://shopify.github.io/react-native-skia/docs/animations/animations
6
+ *
4
7
  * Creates a new animation on an existing value that will be driven by
5
8
  * an animation value. The value will be run from / to the value in
6
9
  * params and modified by the provided easing curve for the length of
@@ -12,6 +12,9 @@ var _Spring = require("./Spring");
12
12
  var _spring = require("./functions/spring");
13
13
 
14
14
  /**
15
+ * @deprecated Use Reanimated 3 for animations:
16
+ * https://shopify.github.io/react-native-skia/docs/animations/animations
17
+ *
15
18
  * Creates a new animation on an existing value that will be driven by
16
19
  * an animation value. The value will be run from / to the value in
17
20
  * params and modified by the provided easing curve for the length of
@@ -1 +1 @@
1
- {"version":3,"names":["runSpring","value","toOrParams","config","callback","runTiming","createSpringEasing","Spring","Config","Default"],"sources":["runSpring.ts"],"sourcesContent":["import type { SkiaMutableValue, SkiaAnimation } from \"../../values/types\";\nimport type {\n AnimationParams,\n SpringConfig,\n AnimationCallback,\n} from \"../types\";\nimport { runTiming } from \"../timing/runTiming\";\n\nimport { Spring } from \"./Spring\";\nimport { createSpringEasing } from \"./functions/spring\";\n\n/**\n * Creates a new animation on an existing value that will be driven by\n * an animation value. The value will be run from / to the value in\n * params and modified by the provided easing curve for the length of\n * the duration. When the value has reached its desired \"to\" value the\n * animation will be stopped.\n *\n * @param value The value to animate\n * @param toOrParams To value or Animation parameters\n * @param config Spring configuration\n * @returns an animation value that can be used to start/stop\n * the animation.\n */\nexport const runSpring = (\n value: SkiaMutableValue<number>,\n toOrParams: number | AnimationParams,\n config?: SpringConfig,\n callback?: AnimationCallback\n): SkiaAnimation => {\n return runTiming(\n value,\n toOrParams,\n createSpringEasing(config ?? Spring.Config.Default),\n callback\n );\n};\n"],"mappings":";;;;;;;AAMA;;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,SAAS,GAAG,CACvBC,KADuB,EAEvBC,UAFuB,EAGvBC,MAHuB,EAIvBC,QAJuB,KAKL;EAClB,OAAO,IAAAC,oBAAA,EACLJ,KADK,EAELC,UAFK,EAGL,IAAAI,0BAAA,EAAmBH,MAAM,IAAII,cAAA,CAAOC,MAAP,CAAcC,OAA3C,CAHK,EAILL,QAJK,CAAP;AAMD,CAZM"}
1
+ {"version":3,"names":["runSpring","value","toOrParams","config","callback","runTiming","createSpringEasing","Spring","Config","Default"],"sources":["runSpring.ts"],"sourcesContent":["import type { SkiaMutableValue, SkiaAnimation } from \"../../values/types\";\nimport type {\n AnimationParams,\n SpringConfig,\n AnimationCallback,\n} from \"../types\";\nimport { runTiming } from \"../timing/runTiming\";\n\nimport { Spring } from \"./Spring\";\nimport { createSpringEasing } from \"./functions/spring\";\n\n/**\n * @deprecated Use Reanimated 3 for animations:\n * https://shopify.github.io/react-native-skia/docs/animations/animations\n *\n * Creates a new animation on an existing value that will be driven by\n * an animation value. The value will be run from / to the value in\n * params and modified by the provided easing curve for the length of\n * the duration. When the value has reached its desired \"to\" value the\n * animation will be stopped.\n *\n * @param value The value to animate\n * @param toOrParams To value or Animation parameters\n * @param config Spring configuration\n * @returns an animation value that can be used to start/stop\n * the animation.\n */\nexport const runSpring = (\n value: SkiaMutableValue<number>,\n toOrParams: number | AnimationParams,\n config?: SpringConfig,\n callback?: AnimationCallback\n): SkiaAnimation => {\n return runTiming(\n value,\n toOrParams,\n createSpringEasing(config ?? Spring.Config.Default),\n callback\n );\n};\n"],"mappings":";;;;;;;AAMA;;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,SAAS,GAAG,CACvBC,KADuB,EAEvBC,UAFuB,EAGvBC,MAHuB,EAIvBC,QAJuB,KAKL;EAClB,OAAO,IAAAC,oBAAA,EACLJ,KADK,EAELC,UAFK,EAGL,IAAAI,0BAAA,EAAmBH,MAAM,IAAII,cAAA,CAAOC,MAAP,CAAcC,OAA3C,CAHK,EAILL,QAJK,CAAP;AAMD,CAZM"}
@@ -1,6 +1,9 @@
1
1
  import type { SkiaValue } from "../../values/types";
2
2
  import type { SpringConfig, AnimationParams, AnimationCallback } from "../types";
3
3
  /**
4
+ * @deprecated Use Reanimated 3 for animations:
5
+ * https://shopify.github.io/react-native-skia/docs/animations/animations
6
+ *
4
7
  * Creats a spring based animation value that will run whenever
5
8
  * the animation parameters change.
6
9
  * @param toOrParams
@@ -12,6 +12,9 @@ var _Spring = require("./Spring");
12
12
  var _spring = require("./functions/spring");
13
13
 
14
14
  /**
15
+ * @deprecated Use Reanimated 3 for animations:
16
+ * https://shopify.github.io/react-native-skia/docs/animations/animations
17
+ *
15
18
  * Creats a spring based animation value that will run whenever
16
19
  * the animation parameters change.
17
20
  * @param toOrParams
@@ -1 +1 @@
1
- {"version":3,"names":["useSpring","toOrParams","config","callback","useTiming","createSpringEasing","Spring","Config","Default"],"sources":["useSpring.ts"],"sourcesContent":["import type { SkiaValue } from \"../../values/types\";\nimport type {\n SpringConfig,\n AnimationParams,\n AnimationCallback,\n} from \"../types\";\nimport { useTiming } from \"../timing\";\n\nimport { Spring } from \"./Spring\";\nimport { createSpringEasing } from \"./functions/spring\";\n\n/**\n * Creats a spring based animation value that will run whenever\n * the animation parameters change.\n * @param toOrParams\n * @param config\n * @returns\n */\nexport const useSpring = (\n toOrParams: number | AnimationParams,\n config?: SpringConfig,\n callback?: AnimationCallback\n): SkiaValue<number> =>\n useTiming(\n toOrParams,\n createSpringEasing(config ?? Spring.Config.Default),\n callback\n );\n"],"mappings":";;;;;;;AAMA;;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,SAAS,GAAG,CACvBC,UADuB,EAEvBC,MAFuB,EAGvBC,QAHuB,KAKvB,IAAAC,iBAAA,EACEH,UADF,EAEE,IAAAI,0BAAA,EAAmBH,MAAM,IAAII,cAAA,CAAOC,MAAP,CAAcC,OAA3C,CAFF,EAGEL,QAHF,CALK"}
1
+ {"version":3,"names":["useSpring","toOrParams","config","callback","useTiming","createSpringEasing","Spring","Config","Default"],"sources":["useSpring.ts"],"sourcesContent":["import type { SkiaValue } from \"../../values/types\";\nimport type {\n SpringConfig,\n AnimationParams,\n AnimationCallback,\n} from \"../types\";\nimport { useTiming } from \"../timing\";\n\nimport { Spring } from \"./Spring\";\nimport { createSpringEasing } from \"./functions/spring\";\n\n/**\n * @deprecated Use Reanimated 3 for animations:\n * https://shopify.github.io/react-native-skia/docs/animations/animations\n *\n * Creats a spring based animation value that will run whenever\n * the animation parameters change.\n * @param toOrParams\n * @param config\n * @returns\n */\nexport const useSpring = (\n toOrParams: number | AnimationParams,\n config?: SpringConfig,\n callback?: AnimationCallback\n): SkiaValue<number> =>\n useTiming(\n toOrParams,\n createSpringEasing(config ?? Spring.Config.Default),\n callback\n );\n"],"mappings":";;;;;;;AAMA;;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,SAAS,GAAG,CACvBC,UADuB,EAEvBC,MAFuB,EAGvBC,QAHuB,KAKvB,IAAAC,iBAAA,EACEH,UADF,EAEE,IAAAI,0BAAA,EAAmBH,MAAM,IAAII,cAAA,CAAOC,MAAP,CAAcC,OAA3C,CAFF,EAGEL,QAHF,CALK"}
@@ -1,6 +1,9 @@
1
1
  import type { SkiaMutableValue, SkiaAnimation } from "../../values/types";
2
2
  import type { AnimationParams, TimingConfig, AnimationCallback } from "../types";
3
3
  /**
4
+ * @deprecated Use Reanimated 3 for animations:
5
+ * https://shopify.github.io/react-native-skia/docs/animations/animations
6
+ *
4
7
  * Creates a new animation on an existing value that will be driven by
5
8
  * an animation value. The value will be run from / to the value in
6
9
  * params and modified by the provided easing curve for the length of
@@ -10,6 +10,9 @@ var _functions = require("./functions");
10
10
  var _createTiming = require("./createTiming");
11
11
 
12
12
  /**
13
+ * @deprecated Use Reanimated 3 for animations:
14
+ * https://shopify.github.io/react-native-skia/docs/animations/animations
15
+ *
13
16
  * Creates a new animation on an existing value that will be driven by
14
17
  * an animation value. The value will be run from / to the value in
15
18
  * params and modified by the provided easing curve for the length of
@@ -1 +1 @@
1
- {"version":3,"names":["runTiming","value","toOrParams","config","callback","resolvedParameters","getResolvedParams","animation","createTiming"],"sources":["runTiming.ts"],"sourcesContent":["import type { SkiaMutableValue, SkiaAnimation } from \"../../values/types\";\nimport type {\n AnimationParams,\n TimingConfig,\n AnimationCallback,\n} from \"../types\";\n\nimport { getResolvedParams } from \"./functions\";\nimport { createTiming } from \"./createTiming\";\n/**\n * Creates a new animation on an existing value that will be driven by\n * an animation value. The value will be run from / to the value in\n * params and modified by the provided easing curve for the length of\n * the duration. When the value has reached its desired \"to\" value the\n * animation will be stopped.\n *\n * @param value The value to animate\n * @param toOrParams To value or Animation parameters\n * @param config Spring or timing configuration\n * @returns an animation value that can be used to start/stop\n * the animation.\n */\nexport const runTiming = (\n value: SkiaMutableValue<number>,\n toOrParams: number | AnimationParams,\n config?: TimingConfig,\n callback?: AnimationCallback\n): SkiaAnimation => {\n const resolvedParameters = getResolvedParams(toOrParams, config);\n const animation = createTiming(resolvedParameters, value, callback);\n value.animation = animation;\n return animation;\n};\n"],"mappings":";;;;;;;AAOA;;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,SAAS,GAAG,CACvBC,KADuB,EAEvBC,UAFuB,EAGvBC,MAHuB,EAIvBC,QAJuB,KAKL;EAClB,MAAMC,kBAAkB,GAAG,IAAAC,4BAAA,EAAkBJ,UAAlB,EAA8BC,MAA9B,CAA3B;EACA,MAAMI,SAAS,GAAG,IAAAC,0BAAA,EAAaH,kBAAb,EAAiCJ,KAAjC,EAAwCG,QAAxC,CAAlB;EACAH,KAAK,CAACM,SAAN,GAAkBA,SAAlB;EACA,OAAOA,SAAP;AACD,CAVM"}
1
+ {"version":3,"names":["runTiming","value","toOrParams","config","callback","resolvedParameters","getResolvedParams","animation","createTiming"],"sources":["runTiming.ts"],"sourcesContent":["import type { SkiaMutableValue, SkiaAnimation } from \"../../values/types\";\nimport type {\n AnimationParams,\n TimingConfig,\n AnimationCallback,\n} from \"../types\";\n\nimport { getResolvedParams } from \"./functions\";\nimport { createTiming } from \"./createTiming\";\n/**\n * @deprecated Use Reanimated 3 for animations:\n * https://shopify.github.io/react-native-skia/docs/animations/animations\n *\n * Creates a new animation on an existing value that will be driven by\n * an animation value. The value will be run from / to the value in\n * params and modified by the provided easing curve for the length of\n * the duration. When the value has reached its desired \"to\" value the\n * animation will be stopped.\n *\n * @param value The value to animate\n * @param toOrParams To value or Animation parameters\n * @param config Spring or timing configuration\n * @returns an animation value that can be used to start/stop\n * the animation.\n */\nexport const runTiming = (\n value: SkiaMutableValue<number>,\n toOrParams: number | AnimationParams,\n config?: TimingConfig,\n callback?: AnimationCallback\n): SkiaAnimation => {\n const resolvedParameters = getResolvedParams(toOrParams, config);\n const animation = createTiming(resolvedParameters, value, callback);\n value.animation = animation;\n return animation;\n};\n"],"mappings":";;;;;;;AAOA;;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,SAAS,GAAG,CACvBC,KADuB,EAEvBC,UAFuB,EAGvBC,MAHuB,EAIvBC,QAJuB,KAKL;EAClB,MAAMC,kBAAkB,GAAG,IAAAC,4BAAA,EAAkBJ,UAAlB,EAA8BC,MAA9B,CAA3B;EACA,MAAMI,SAAS,GAAG,IAAAC,0BAAA,EAAaH,kBAAb,EAAiCJ,KAAjC,EAAwCG,QAAxC,CAAlB;EACAH,KAAK,CAACM,SAAN,GAAkBA,SAAlB;EACA,OAAOA,SAAP;AACD,CAVM"}
@@ -1,5 +1,8 @@
1
1
  import type { TimingConfig } from "../types";
2
2
  /**
3
+ * @deprecated Use Reanimated 3 for animations:
4
+ * https://shopify.github.io/react-native-skia/docs/animations/animations
5
+ *
3
6
  * Configures a looped timing value. The value will go back and forth
4
7
  * between 0 and 1 and back.
5
8
  * @param config Timing configuration for easing and duration
@@ -8,6 +8,9 @@ exports.useLoop = void 0;
8
8
  var _useTiming = require("./useTiming");
9
9
 
10
10
  /**
11
+ * @deprecated Use Reanimated 3 for animations:
12
+ * https://shopify.github.io/react-native-skia/docs/animations/animations
13
+ *
11
14
  * Configures a looped timing value. The value will go back and forth
12
15
  * between 0 and 1 and back.
13
16
  * @param config Timing configuration for easing and duration
@@ -1 +1 @@
1
- {"version":3,"names":["useLoop","config","useTiming","yoyo","loop"],"sources":["useLoop.ts"],"sourcesContent":["import type { TimingConfig } from \"../types\";\n\nimport { useTiming } from \"./useTiming\";\n\n/**\n * Configures a looped timing value. The value will go back and forth\n * between 0 and 1 and back.\n * @param config Timing configuration for easing and duration\n * @returns A value that can be used for further animations\n */\nexport const useLoop = (config?: TimingConfig) =>\n useTiming(\n {\n yoyo: true,\n loop: true,\n },\n config\n );\n"],"mappings":";;;;;;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,OAAO,GAAIC,MAAD,IACrB,IAAAC,oBAAA,EACE;EACEC,IAAI,EAAE,IADR;EAEEC,IAAI,EAAE;AAFR,CADF,EAKEH,MALF,CADK"}
1
+ {"version":3,"names":["useLoop","config","useTiming","yoyo","loop"],"sources":["useLoop.ts"],"sourcesContent":["import type { TimingConfig } from \"../types\";\n\nimport { useTiming } from \"./useTiming\";\n\n/**\n * @deprecated Use Reanimated 3 for animations:\n * https://shopify.github.io/react-native-skia/docs/animations/animations\n *\n * Configures a looped timing value. The value will go back and forth\n * between 0 and 1 and back.\n * @param config Timing configuration for easing and duration\n * @returns A value that can be used for further animations\n */\nexport const useLoop = (config?: TimingConfig) =>\n useTiming(\n {\n yoyo: true,\n loop: true,\n },\n config\n );\n"],"mappings":";;;;;;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,OAAO,GAAIC,MAAD,IACrB,IAAAC,oBAAA,EACE;EACEC,IAAI,EAAE,IADR;EAEEC,IAAI,EAAE;AAFR,CADF,EAKEH,MALF,CADK"}
@@ -1,6 +1,9 @@
1
1
  import type { SkiaValue } from "../../values/types";
2
2
  import type { AnimationParams, TimingConfig, AnimationCallback } from "../types";
3
3
  /**
4
+ * @deprecated Use Reanimated 3 for animations:
5
+ * https://shopify.github.io/react-native-skia/docs/animations/animations
6
+ *
4
7
  * Creats an animation value that will run whenever
5
8
  * the animation parameters change. The animation start immediately.
6
9
  * @param toOrParams
@@ -14,6 +14,9 @@ var _functions = require("./functions");
14
14
  var _createTiming = require("./createTiming");
15
15
 
16
16
  /**
17
+ * @deprecated Use Reanimated 3 for animations:
18
+ * https://shopify.github.io/react-native-skia/docs/animations/animations
19
+ *
17
20
  * Creats an animation value that will run whenever
18
21
  * the animation parameters change. The animation start immediately.
19
22
  * @param toOrParams
@@ -1 +1 @@
1
- {"version":3,"names":["useTiming","toOrParams","config","callback","prevCfgRef","useRef","resolvedParameters","useMemo","nextParams","getResolvedParams","equals","current","value","useValue","from","prevAnimationRef","prevParamsRef","animation","createTiming","useEffect","undefined","a","b","JSON","stringify"],"sources":["useTiming.ts"],"sourcesContent":["import { useEffect, useMemo, useRef } from \"react\";\n\nimport type { SkiaValue, SkiaAnimation } from \"../../values/types\";\nimport type {\n AnimationParams,\n TimingConfig,\n AnimationCallback,\n} from \"../types\";\nimport { useValue } from \"../../values/hooks/useValue\";\n\nimport { getResolvedParams } from \"./functions\";\nimport { createTiming } from \"./createTiming\";\n\n/**\n * Creats an animation value that will run whenever\n * the animation parameters change. The animation start immediately.\n * @param toOrParams\n * @param config\n * @returns A value that is animated\n */\nexport const useTiming = (\n toOrParams: number | AnimationParams,\n config?: TimingConfig,\n callback?: AnimationCallback\n): SkiaValue<number> => {\n // Resolve parameters - keep a cached version to avoid\n // unnecesary re-renders.\n const prevCfgRef = useRef<ReturnType<typeof getResolvedParams>>();\n const resolvedParameters = useMemo(() => {\n const nextParams = getResolvedParams(toOrParams, config);\n if (!equals(prevCfgRef.current, nextParams)) {\n prevCfgRef.current = nextParams;\n }\n return prevCfgRef.current!;\n }, [config, toOrParams]);\n\n // Create value\n const value = useValue(resolvedParameters.from ?? 0);\n\n // Create timing animation - keep a cached version to avoid\n // uneccessary recreation of animations\n const prevAnimationRef = useRef<SkiaAnimation>();\n const prevParamsRef = useRef<typeof resolvedParameters>();\n const animation = useMemo(() => {\n if (!equals(prevParamsRef.current, resolvedParameters)) {\n prevParamsRef.current = resolvedParameters;\n prevAnimationRef.current = createTiming(\n resolvedParameters,\n value,\n callback\n );\n }\n return prevAnimationRef.current!;\n }, [callback, resolvedParameters, value]);\n\n // Run animation on the value - and stop it on unmount\n useEffect(() => {\n value.animation = animation;\n return () => (value.animation = undefined);\n }, [animation, value]);\n\n // Return the value that is animated\n return value;\n};\n\nconst equals = <T1, T2>(a: T1, b: T2) => {\n return JSON.stringify(a) === JSON.stringify(b);\n};\n"],"mappings":";;;;;;;AAAA;;AAQA;;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,SAAS,GAAG,CACvBC,UADuB,EAEvBC,MAFuB,EAGvBC,QAHuB,KAID;EACtB;EACA;EACA,MAAMC,UAAU,GAAG,IAAAC,aAAA,GAAnB;EACA,MAAMC,kBAAkB,GAAG,IAAAC,cAAA,EAAQ,MAAM;IACvC,MAAMC,UAAU,GAAG,IAAAC,4BAAA,EAAkBR,UAAlB,EAA8BC,MAA9B,CAAnB;;IACA,IAAI,CAACQ,MAAM,CAACN,UAAU,CAACO,OAAZ,EAAqBH,UAArB,CAAX,EAA6C;MAC3CJ,UAAU,CAACO,OAAX,GAAqBH,UAArB;IACD;;IACD,OAAOJ,UAAU,CAACO,OAAlB;EACD,CAN0B,EAMxB,CAACT,MAAD,EAASD,UAAT,CANwB,CAA3B,CAJsB,CAYtB;;EACA,MAAMW,KAAK,GAAG,IAAAC,kBAAA,EAASP,kBAAkB,CAACQ,IAAnB,IAA2B,CAApC,CAAd,CAbsB,CAetB;EACA;;EACA,MAAMC,gBAAgB,GAAG,IAAAV,aAAA,GAAzB;EACA,MAAMW,aAAa,GAAG,IAAAX,aAAA,GAAtB;EACA,MAAMY,SAAS,GAAG,IAAAV,cAAA,EAAQ,MAAM;IAC9B,IAAI,CAACG,MAAM,CAACM,aAAa,CAACL,OAAf,EAAwBL,kBAAxB,CAAX,EAAwD;MACtDU,aAAa,CAACL,OAAd,GAAwBL,kBAAxB;MACAS,gBAAgB,CAACJ,OAAjB,GAA2B,IAAAO,0BAAA,EACzBZ,kBADyB,EAEzBM,KAFyB,EAGzBT,QAHyB,CAA3B;IAKD;;IACD,OAAOY,gBAAgB,CAACJ,OAAxB;EACD,CAViB,EAUf,CAACR,QAAD,EAAWG,kBAAX,EAA+BM,KAA/B,CAVe,CAAlB,CAnBsB,CA+BtB;;EACA,IAAAO,gBAAA,EAAU,MAAM;IACdP,KAAK,CAACK,SAAN,GAAkBA,SAAlB;IACA,OAAO,MAAOL,KAAK,CAACK,SAAN,GAAkBG,SAAhC;EACD,CAHD,EAGG,CAACH,SAAD,EAAYL,KAAZ,CAHH,EAhCsB,CAqCtB;;EACA,OAAOA,KAAP;AACD,CA3CM;;;;AA6CP,MAAMF,MAAM,GAAG,CAASW,CAAT,EAAgBC,CAAhB,KAA0B;EACvC,OAAOC,IAAI,CAACC,SAAL,CAAeH,CAAf,MAAsBE,IAAI,CAACC,SAAL,CAAeF,CAAf,CAA7B;AACD,CAFD"}
1
+ {"version":3,"names":["useTiming","toOrParams","config","callback","prevCfgRef","useRef","resolvedParameters","useMemo","nextParams","getResolvedParams","equals","current","value","useValue","from","prevAnimationRef","prevParamsRef","animation","createTiming","useEffect","undefined","a","b","JSON","stringify"],"sources":["useTiming.ts"],"sourcesContent":["import { useEffect, useMemo, useRef } from \"react\";\n\nimport type { SkiaValue, SkiaAnimation } from \"../../values/types\";\nimport type {\n AnimationParams,\n TimingConfig,\n AnimationCallback,\n} from \"../types\";\nimport { useValue } from \"../../values/hooks/useValue\";\n\nimport { getResolvedParams } from \"./functions\";\nimport { createTiming } from \"./createTiming\";\n\n/**\n * @deprecated Use Reanimated 3 for animations:\n * https://shopify.github.io/react-native-skia/docs/animations/animations\n *\n * Creats an animation value that will run whenever\n * the animation parameters change. The animation start immediately.\n * @param toOrParams\n * @param config\n * @returns A value that is animated\n */\nexport const useTiming = (\n toOrParams: number | AnimationParams,\n config?: TimingConfig,\n callback?: AnimationCallback\n): SkiaValue<number> => {\n // Resolve parameters - keep a cached version to avoid\n // unnecesary re-renders.\n const prevCfgRef = useRef<ReturnType<typeof getResolvedParams>>();\n const resolvedParameters = useMemo(() => {\n const nextParams = getResolvedParams(toOrParams, config);\n if (!equals(prevCfgRef.current, nextParams)) {\n prevCfgRef.current = nextParams;\n }\n return prevCfgRef.current!;\n }, [config, toOrParams]);\n\n // Create value\n const value = useValue(resolvedParameters.from ?? 0);\n\n // Create timing animation - keep a cached version to avoid\n // uneccessary recreation of animations\n const prevAnimationRef = useRef<SkiaAnimation>();\n const prevParamsRef = useRef<typeof resolvedParameters>();\n const animation = useMemo(() => {\n if (!equals(prevParamsRef.current, resolvedParameters)) {\n prevParamsRef.current = resolvedParameters;\n prevAnimationRef.current = createTiming(\n resolvedParameters,\n value,\n callback\n );\n }\n return prevAnimationRef.current!;\n }, [callback, resolvedParameters, value]);\n\n // Run animation on the value - and stop it on unmount\n useEffect(() => {\n value.animation = animation;\n return () => (value.animation = undefined);\n }, [animation, value]);\n\n // Return the value that is animated\n return value;\n};\n\nconst equals = <T1, T2>(a: T1, b: T2) => {\n return JSON.stringify(a) === JSON.stringify(b);\n};\n"],"mappings":";;;;;;;AAAA;;AAQA;;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,SAAS,GAAG,CACvBC,UADuB,EAEvBC,MAFuB,EAGvBC,QAHuB,KAID;EACtB;EACA;EACA,MAAMC,UAAU,GAAG,IAAAC,aAAA,GAAnB;EACA,MAAMC,kBAAkB,GAAG,IAAAC,cAAA,EAAQ,MAAM;IACvC,MAAMC,UAAU,GAAG,IAAAC,4BAAA,EAAkBR,UAAlB,EAA8BC,MAA9B,CAAnB;;IACA,IAAI,CAACQ,MAAM,CAACN,UAAU,CAACO,OAAZ,EAAqBH,UAArB,CAAX,EAA6C;MAC3CJ,UAAU,CAACO,OAAX,GAAqBH,UAArB;IACD;;IACD,OAAOJ,UAAU,CAACO,OAAlB;EACD,CAN0B,EAMxB,CAACT,MAAD,EAASD,UAAT,CANwB,CAA3B,CAJsB,CAYtB;;EACA,MAAMW,KAAK,GAAG,IAAAC,kBAAA,EAASP,kBAAkB,CAACQ,IAAnB,IAA2B,CAApC,CAAd,CAbsB,CAetB;EACA;;EACA,MAAMC,gBAAgB,GAAG,IAAAV,aAAA,GAAzB;EACA,MAAMW,aAAa,GAAG,IAAAX,aAAA,GAAtB;EACA,MAAMY,SAAS,GAAG,IAAAV,cAAA,EAAQ,MAAM;IAC9B,IAAI,CAACG,MAAM,CAACM,aAAa,CAACL,OAAf,EAAwBL,kBAAxB,CAAX,EAAwD;MACtDU,aAAa,CAACL,OAAd,GAAwBL,kBAAxB;MACAS,gBAAgB,CAACJ,OAAjB,GAA2B,IAAAO,0BAAA,EACzBZ,kBADyB,EAEzBM,KAFyB,EAGzBT,QAHyB,CAA3B;IAKD;;IACD,OAAOY,gBAAgB,CAACJ,OAAxB;EACD,CAViB,EAUf,CAACR,QAAD,EAAWG,kBAAX,EAA+BM,KAA/B,CAVe,CAAlB,CAnBsB,CA+BtB;;EACA,IAAAO,gBAAA,EAAU,MAAM;IACdP,KAAK,CAACK,SAAN,GAAkBA,SAAlB;IACA,OAAO,MAAOL,KAAK,CAACK,SAAN,GAAkBG,SAAhC;EACD,CAHD,EAGG,CAACH,SAAD,EAAYL,KAAZ,CAHH,EAhCsB,CAqCtB;;EACA,OAAOA,KAAP;AACD,CA3CM;;;;AA6CP,MAAMF,MAAM,GAAG,CAASW,CAAT,EAAgBC,CAAhB,KAA0B;EACvC,OAAOC,IAAI,CAACC,SAAL,CAAeH,CAAf,MAAsBE,IAAI,CAACC,SAAL,CAAeF,CAAf,CAA7B;AACD,CAFD"}
@@ -60,6 +60,8 @@ class JsiSkDOM {
60
60
  }
61
61
 
62
62
  CustomDrawing(props) {
63
+ console.warn( // eslint-disable-next-line max-len
64
+ "The <Drawing /> component is deprecated and will be removed in the next release. For custom drawings, please sure the <Picture /> component: https://shopify.github.io/react-native-skia/docs/shapes/pictures/");
63
65
  return _HostComponents.NATIVE_DOM ? global.SkiaDomApi.CustomDrawingNode(props ?? {}) : new _drawings.CustomDrawingNode(this.ctx, props);
64
66
  }
65
67
 
@@ -1 +1 @@
1
- {"version":3,"names":["JsiSkDOM","constructor","ctx","Layer","props","NATIVE_DOM","global","SkiaDomApi","LayerNode","Group","GroupNode","Paint","PaintNode","Fill","FillNode","Image","ImageNode","Circle","CircleNode","Path","PathNode","CustomDrawing","CustomDrawingNode","Line","LineNode","Oval","OvalNode","Patch","PatchNode","Points","PointsNode","Rect","RectNode","RRect","RRectNode","Vertices","VerticesNode","Text","TextNode","TextPath","TextPathNode","TextBlob","TextBlobNode","Glyphs","GlyphsNode","DiffRect","DiffRectNode","Picture","PictureNode","ImageSVG","ImageSVGNode","BlurMaskFilter","BlurMaskFilterNode","BlendImageFilter","BlendImageFilterNode","DropShadowImageFilter","DropShadowImageFilterNode","DisplacementMapImageFilter","DisplacementMapImageFilterNode","BlurImageFilter","BlurImageFilterNode","OffsetImageFilter","OffsetImageFilterNode","MorphologyImageFilter","MorphologyImageFilterNode","RuntimeShaderImageFilter","RuntimeShaderImageFilterNode","MatrixColorFilter","MatrixColorFilterNode","BlendColorFilter","BlendColorFilterNode","LumaColorFilter","LumaColorFilterNode","LinearToSRGBGammaColorFilter","LinearToSRGBGammaColorFilterNode","SRGBToLinearGammaColorFilter","SRGBToLinearGammaColorFilterNode","LerpColorFilter","LerpColorFilterNode","Shader","ShaderNode","ImageShader","ImageShaderNode","ColorShader","ColorShaderNode","ColorNode","SweepGradient","SweepGradientNode","Turbulence","TurbulenceNode","FractalNoise","FractalNoiseNode","LinearGradient","LinearGradientNode","RadialGradient","RadialGradientNode","TwoPointConicalGradient","TwoPointConicalGradientNode","CornerPathEffect","CornerPathEffectNode","DiscretePathEffect","DiscretePathEffectNode","DashPathEffect","DashPathEffectNode","Path1DPathEffect","Path1DPathEffectNode","Path2DPathEffect","Path2DPathEffectNode","SumPathEffect","SumPathEffectNode","Line2DPathEffect","Line2DPathEffectNode","Blend","BlendNode","BackdropFilter","BackdropFilterNode","Box","BoxNode","BoxShadow","BoxShadowNode","Paragraph","ParagraphNode"],"sources":["JsiSkDOM.ts"],"sourcesContent":["import type {\n PathProps,\n SkDOM,\n GroupProps,\n ImageProps,\n BlurImageFilterProps,\n MatrixColorFilterProps,\n CircleProps,\n BlurMaskFilterProps,\n LinearGradientProps,\n PaintProps,\n ShaderProps,\n ImageShaderProps,\n CustomDrawingNodeProps,\n LineProps,\n OvalProps,\n PatchProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n VerticesProps,\n TextProps,\n DiffRectProps,\n OffsetImageFilterProps,\n BlendColorFilterProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n TwoPointConicalGradientProps,\n TurbulenceProps,\n SweepGradientProps,\n RadialGradientProps,\n FractalNoiseProps,\n ColorProps,\n PictureProps,\n ImageSVGProps,\n LerpColorFilterProps,\n DrawingNodeProps,\n BoxProps,\n BoxShadowProps,\n ChildrenProps,\n} from \"../types\";\nimport type {\n BlendImageFilterProps,\n BlendProps,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n MorphologyImageFilterProps,\n RuntimeShaderImageFilterProps,\n} from \"../types/ImageFilters\";\nimport type {\n CornerPathEffectProps,\n DashPathEffectProps,\n DiscretePathEffectProps,\n Line2DPathEffectProps,\n Path1DPathEffectProps,\n Path2DPathEffectProps,\n} from \"../types/PathEffects\";\nimport { NATIVE_DOM } from \"../../renderer/HostComponents\";\nimport type { ParagraphProps } from \"../types/Paragraph\";\n\nimport {\n FillNode,\n ImageNode,\n CircleNode,\n PathNode,\n LineNode,\n PatchNode,\n PointsNode,\n RectNode,\n RRectNode,\n VerticesNode,\n TextNode,\n OvalNode,\n CustomDrawingNode,\n TextPathNode,\n TextBlobNode,\n GlyphsNode,\n DiffRectNode,\n PictureNode,\n ImageSVGNode,\n BackdropFilterNode,\n BoxNode,\n BoxShadowNode,\n} from \"./drawings\";\nimport {\n BlendImageFilterNode,\n BlurImageFilterNode,\n BlurMaskFilterNode,\n DisplacementMapImageFilterNode,\n DropShadowImageFilterNode,\n OffsetImageFilterNode,\n RuntimeShaderImageFilterNode,\n CornerPathEffectNode,\n DiscretePathEffectNode,\n DashPathEffectNode,\n Path1DPathEffectNode,\n Path2DPathEffectNode,\n SumPathEffectNode,\n Line2DPathEffectNode,\n BlendNode,\n} from \"./paint\";\nimport {\n MatrixColorFilterNode,\n LumaColorFilterNode,\n LinearToSRGBGammaColorFilterNode,\n SRGBToLinearGammaColorFilterNode,\n BlendColorFilterNode,\n LerpColorFilterNode,\n} from \"./paint/ColorFilters\";\nimport {\n LinearGradientNode,\n ShaderNode,\n ImageShaderNode,\n TwoPointConicalGradientNode,\n TurbulenceNode,\n SweepGradientNode,\n RadialGradientNode,\n FractalNoiseNode,\n ColorNode,\n} from \"./paint/Shaders\";\nimport { MorphologyImageFilterNode } from \"./paint/ImageFilters\";\nimport { GroupNode } from \"./GroupNode\";\nimport { PaintNode } from \"./PaintNode\";\nimport type { NodeContext } from \"./Node\";\nimport { LayerNode } from \"./LayerNode\";\nimport { ParagraphNode } from \"./drawings/ParagraphNode\";\n\nexport class JsiSkDOM implements SkDOM {\n constructor(private ctx: NodeContext) {}\n\n Layer(props?: ChildrenProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.LayerNode(props ?? {})\n : new LayerNode(this.ctx, props ?? {});\n }\n\n Group(props?: GroupProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.GroupNode(props ?? {})\n : new GroupNode(this.ctx, props ?? {});\n }\n\n Paint(props: PaintProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.PaintNode(props ?? {})\n : new PaintNode(this.ctx, props);\n }\n\n // Drawings\n Fill(props?: DrawingNodeProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.FillNode(props ?? {})\n : new FillNode(this.ctx, props);\n }\n\n Image(props: ImageProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.ImageNode(props ?? {})\n : new ImageNode(this.ctx, props);\n }\n\n Circle(props: CircleProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.CircleNode(props ?? {})\n : new CircleNode(this.ctx, props);\n }\n\n Path(props: PathProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.PathNode(props ?? {})\n : new PathNode(this.ctx, props);\n }\n\n CustomDrawing(props: CustomDrawingNodeProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.CustomDrawingNode(props ?? {})\n : new CustomDrawingNode(this.ctx, props);\n }\n\n Line(props: LineProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.LineNode(props ?? {})\n : new LineNode(this.ctx, props);\n }\n\n Oval(props: OvalProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.OvalNode(props ?? {})\n : new OvalNode(this.ctx, props);\n }\n\n Patch(props: PatchProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.PatchNode(props ?? {})\n : new PatchNode(this.ctx, props);\n }\n\n Points(props: PointsProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.PointsNode(props ?? {})\n : new PointsNode(this.ctx, props);\n }\n\n Rect(props: RectProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.RectNode(props)\n : new RectNode(this.ctx, props);\n }\n\n RRect(props: RoundedRectProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.RRectNode(props)\n : new RRectNode(this.ctx, props);\n }\n\n Vertices(props: VerticesProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.VerticesNode(props)\n : new VerticesNode(this.ctx, props);\n }\n\n Text(props: TextProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.TextNode(props)\n : new TextNode(this.ctx, props);\n }\n\n TextPath(props: TextPathProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.TextPathNode(props)\n : new TextPathNode(this.ctx, props);\n }\n\n TextBlob(props: TextBlobProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.TextBlobNode(props)\n : new TextBlobNode(this.ctx, props);\n }\n\n Glyphs(props: GlyphsProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.GlyphsNode(props)\n : new GlyphsNode(this.ctx, props);\n }\n\n DiffRect(props: DiffRectProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.DiffRectNode(props)\n : new DiffRectNode(this.ctx, props);\n }\n\n Picture(props: PictureProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.PictureNode(props)\n : new PictureNode(this.ctx, props);\n }\n\n ImageSVG(props: ImageSVGProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.ImageSVGNode(props)\n : new ImageSVGNode(this.ctx, props);\n }\n\n // BlurMaskFilters\n BlurMaskFilter(props: BlurMaskFilterProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.BlurMaskFilterNode(props)\n : new BlurMaskFilterNode(this.ctx, props);\n }\n\n // ImageFilters\n BlendImageFilter(props: BlendImageFilterProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.BlendImageFilterNode(props)\n : new BlendImageFilterNode(this.ctx, props);\n }\n\n DropShadowImageFilter(props: DropShadowImageFilterProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.DropShadowImageFilterNode(props)\n : new DropShadowImageFilterNode(this.ctx, props);\n }\n\n DisplacementMapImageFilter(props: DisplacementMapImageFilterProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.DisplacementMapImageFilterNode(props)\n : new DisplacementMapImageFilterNode(this.ctx, props);\n }\n\n BlurImageFilter(props: BlurImageFilterProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.BlurImageFilterNode(props)\n : new BlurImageFilterNode(this.ctx, props);\n }\n\n OffsetImageFilter(props: OffsetImageFilterProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.OffsetImageFilterNode(props)\n : new OffsetImageFilterNode(this.ctx, props);\n }\n\n MorphologyImageFilter(props: MorphologyImageFilterProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.MorphologyImageFilterNode(props)\n : new MorphologyImageFilterNode(this.ctx, props);\n }\n\n RuntimeShaderImageFilter(props: RuntimeShaderImageFilterProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.RuntimeShaderImageFilterNode(props)\n : new RuntimeShaderImageFilterNode(this.ctx, props);\n }\n\n // Color Filters\n MatrixColorFilter(props: MatrixColorFilterProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.MatrixColorFilterNode(props)\n : new MatrixColorFilterNode(this.ctx, props);\n }\n\n BlendColorFilter(props: BlendColorFilterProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.BlendColorFilterNode(props)\n : new BlendColorFilterNode(this.ctx, props);\n }\n\n LumaColorFilter() {\n return NATIVE_DOM\n ? global.SkiaDomApi.LumaColorFilterNode()\n : new LumaColorFilterNode(this.ctx);\n }\n\n LinearToSRGBGammaColorFilter() {\n return global.SkiaDomApi &&\n global.SkiaDomApi.LinearToSRGBGammaColorFilterNode\n ? global.SkiaDomApi.LinearToSRGBGammaColorFilterNode()\n : new LinearToSRGBGammaColorFilterNode(this.ctx);\n }\n\n SRGBToLinearGammaColorFilter() {\n return global.SkiaDomApi &&\n global.SkiaDomApi.SRGBToLinearGammaColorFilterNode\n ? global.SkiaDomApi.SRGBToLinearGammaColorFilterNode()\n : new SRGBToLinearGammaColorFilterNode(this.ctx);\n }\n\n LerpColorFilter(props: LerpColorFilterProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.LerpColorFilterNode(props)\n : new LerpColorFilterNode(this.ctx, props);\n }\n\n // Shaders\n Shader(props: ShaderProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.ShaderNode(props)\n : new ShaderNode(this.ctx, props);\n }\n\n ImageShader(props: ImageShaderProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.ImageShaderNode(props)\n : new ImageShaderNode(this.ctx, props);\n }\n\n ColorShader(props: ColorProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.ColorShaderNode(props)\n : new ColorNode(this.ctx, props);\n }\n\n SweepGradient(props: SweepGradientProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.SweepGradientNode(props)\n : new SweepGradientNode(this.ctx, props);\n }\n\n Turbulence(props: TurbulenceProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.TurbulenceNode(props)\n : new TurbulenceNode(this.ctx, props);\n }\n\n FractalNoise(props: FractalNoiseProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.FractalNoiseNode(props)\n : new FractalNoiseNode(this.ctx, props);\n }\n\n LinearGradient(props: LinearGradientProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.LinearGradientNode(props)\n : new LinearGradientNode(this.ctx, props);\n }\n\n RadialGradient(props: RadialGradientProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.RadialGradientNode(props)\n : new RadialGradientNode(this.ctx, props);\n }\n\n TwoPointConicalGradient(props: TwoPointConicalGradientProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.TwoPointConicalGradientNode(props)\n : new TwoPointConicalGradientNode(this.ctx, props);\n }\n\n // Path Effects\n CornerPathEffect(props: CornerPathEffectProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.CornerPathEffectNode(props)\n : new CornerPathEffectNode(this.ctx, props);\n }\n\n DiscretePathEffect(props: DiscretePathEffectProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.DiscretePathEffectNode(props)\n : new DiscretePathEffectNode(this.ctx, props);\n }\n\n DashPathEffect(props: DashPathEffectProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.DashPathEffectNode(props)\n : new DashPathEffectNode(this.ctx, props);\n }\n\n Path1DPathEffect(props: Path1DPathEffectProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.Path1DPathEffectNode(props)\n : new Path1DPathEffectNode(this.ctx, props);\n }\n\n Path2DPathEffect(props: Path2DPathEffectProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.Path2DPathEffectNode(props)\n : new Path2DPathEffectNode(this.ctx, props);\n }\n\n SumPathEffect() {\n return NATIVE_DOM\n ? global.SkiaDomApi.SumPathEffectNode()\n : new SumPathEffectNode(this.ctx);\n }\n\n Line2DPathEffect(props: Line2DPathEffectProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.Line2DPathEffectNode(props)\n : new Line2DPathEffectNode(this.ctx, props);\n }\n\n Blend(props: BlendProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.BlendNode(props)\n : new BlendNode(this.ctx, props);\n }\n\n BackdropFilter(props: ChildrenProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.BackdropFilterNode(props)\n : new BackdropFilterNode(this.ctx, props);\n }\n\n Box(props: BoxProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.BoxNode(props)\n : new BoxNode(this.ctx, props);\n }\n\n BoxShadow(props: BoxShadowProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.BoxShadowNode(props)\n : new BoxShadowNode(this.ctx, props);\n }\n\n // Paragraph\n Paragraph(props: ParagraphProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.ParagraphNode(props)\n : new ParagraphNode(this.ctx, props);\n }\n}\n"],"mappings":";;;;;;;AA0DA;;AAGA;;AAwBA;;AAiBA;;AAQA;;AAWA;;AACA;;AACA;;AAEA;;AACA;;AAEO,MAAMA,QAAN,CAAgC;EACrCC,WAAW,CAASC,GAAT,EAA2B;IAAA,KAAlBA,GAAkB,GAAlBA,GAAkB;EAAE;;EAExCC,KAAK,CAACC,KAAD,EAAwB;IAC3B,OAAOC,0BAAA,GACHC,MAAM,CAACC,UAAP,CAAkBC,SAAlB,CAA4BJ,KAAK,IAAI,EAArC,CADG,GAEH,IAAII,oBAAJ,CAAc,KAAKN,GAAnB,EAAwBE,KAAK,IAAI,EAAjC,CAFJ;EAGD;;EAEDK,KAAK,CAACL,KAAD,EAAqB;IACxB,OAAOC,0BAAA,GACHC,MAAM,CAACC,UAAP,CAAkBG,SAAlB,CAA4BN,KAAK,IAAI,EAArC,CADG,GAEH,IAAIM,oBAAJ,CAAc,KAAKR,GAAnB,EAAwBE,KAAK,IAAI,EA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J;EAGD;;EAED4G,KAAK,CAAC5G,KAAD,EAAoB;IACvB,OAAOC,0BAAA,GACHC,MAAM,CAACC,UAAP,CAAkB0G,SAAlB,CAA4B7G,KAA5B,CADG,GAEH,IAAI6G,gBAAJ,CAAc,KAAK/G,GAAnB,EAAwBE,KAAxB,CAFJ;EAGD;;EAED8G,cAAc,CAAC9G,KAAD,EAAuB;IACnC,OAAOC,0BAAA,GACHC,MAAM,CAACC,UAAP,CAAkB4G,kBAAlB,CAAqC/G,KAArC,CADG,GAEH,IAAI+G,4BAAJ,CAAuB,KAAKjH,GAA5B,EAAiCE,KAAjC,CAFJ;EAGD;;EAEDgH,GAAG,CAAChH,KAAD,EAAkB;IACnB,OAAOC,0BAAA,GACHC,MAAM,CAACC,UAAP,CAAkB8G,OAAlB,CAA0BjH,KAA1B,CADG,GAEH,IAAIiH,iBAAJ,CAAY,KAAKnH,GAAjB,EAAsBE,KAAtB,CAFJ;EAGD;;EAEDkH,SAAS,CAAClH,KAAD,EAAwB;IAC/B,OAAOC,0BAAA,GACHC,MAAM,CAACC,UAAP,CAAkBgH,aAAlB,CAAgCnH,KAAhC,CADG,GAEH,IAAImH,uBAAJ,CAAkB,KAAKrH,GAAvB,EAA4BE,KAA5B,CAFJ;EAGD,CAzVoC,CA2VrC;;;EACAoH,SAAS,CAACpH,KAAD,EAAwB;IAC/B,OAAOC,0BAAA,GACHC,MAAM,CAACC,UAAP,CAAkBkH,aAAlB,CAAgCrH,KAAhC,CADG,GAEH,IAAIqH,4BAAJ,CAAkB,KAAKvH,GAAvB,EAA4BE,KAA5B,CAFJ;EAGD;;AAhWoC"}
1
+ {"version":3,"names":["JsiSkDOM","constructor","ctx","Layer","props","NATIVE_DOM","global","SkiaDomApi","LayerNode","Group","GroupNode","Paint","PaintNode","Fill","FillNode","Image","ImageNode","Circle","CircleNode","Path","PathNode","CustomDrawing","console","warn","CustomDrawingNode","Line","LineNode","Oval","OvalNode","Patch","PatchNode","Points","PointsNode","Rect","RectNode","RRect","RRectNode","Vertices","VerticesNode","Text","TextNode","TextPath","TextPathNode","TextBlob","TextBlobNode","Glyphs","GlyphsNode","DiffRect","DiffRectNode","Picture","PictureNode","ImageSVG","ImageSVGNode","BlurMaskFilter","BlurMaskFilterNode","BlendImageFilter","BlendImageFilterNode","DropShadowImageFilter","DropShadowImageFilterNode","DisplacementMapImageFilter","DisplacementMapImageFilterNode","BlurImageFilter","BlurImageFilterNode","OffsetImageFilter","OffsetImageFilterNode","MorphologyImageFilter","MorphologyImageFilterNode","RuntimeShaderImageFilter","RuntimeShaderImageFilterNode","MatrixColorFilter","MatrixColorFilterNode","BlendColorFilter","BlendColorFilterNode","LumaColorFilter","LumaColorFilterNode","LinearToSRGBGammaColorFilter","LinearToSRGBGammaColorFilterNode","SRGBToLinearGammaColorFilter","SRGBToLinearGammaColorFilterNode","LerpColorFilter","LerpColorFilterNode","Shader","ShaderNode","ImageShader","ImageShaderNode","ColorShader","ColorShaderNode","ColorNode","SweepGradient","SweepGradientNode","Turbulence","TurbulenceNode","FractalNoise","FractalNoiseNode","LinearGradient","LinearGradientNode","RadialGradient","RadialGradientNode","TwoPointConicalGradient","TwoPointConicalGradientNode","CornerPathEffect","CornerPathEffectNode","DiscretePathEffect","DiscretePathEffectNode","DashPathEffect","DashPathEffectNode","Path1DPathEffect","Path1DPathEffectNode","Path2DPathEffect","Path2DPathEffectNode","SumPathEffect","SumPathEffectNode","Line2DPathEffect","Line2DPathEffectNode","Blend","BlendNode","BackdropFilter","BackdropFilterNode","Box","BoxNode","BoxShadow","BoxShadowNode","Paragraph","ParagraphNode"],"sources":["JsiSkDOM.ts"],"sourcesContent":["import type {\n PathProps,\n SkDOM,\n GroupProps,\n ImageProps,\n BlurImageFilterProps,\n MatrixColorFilterProps,\n CircleProps,\n BlurMaskFilterProps,\n LinearGradientProps,\n PaintProps,\n ShaderProps,\n ImageShaderProps,\n CustomDrawingNodeProps,\n LineProps,\n OvalProps,\n PatchProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n VerticesProps,\n TextProps,\n DiffRectProps,\n OffsetImageFilterProps,\n BlendColorFilterProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n TwoPointConicalGradientProps,\n TurbulenceProps,\n SweepGradientProps,\n RadialGradientProps,\n FractalNoiseProps,\n ColorProps,\n PictureProps,\n ImageSVGProps,\n LerpColorFilterProps,\n DrawingNodeProps,\n BoxProps,\n BoxShadowProps,\n ChildrenProps,\n} from \"../types\";\nimport type {\n BlendImageFilterProps,\n BlendProps,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n MorphologyImageFilterProps,\n RuntimeShaderImageFilterProps,\n} from \"../types/ImageFilters\";\nimport type {\n CornerPathEffectProps,\n DashPathEffectProps,\n DiscretePathEffectProps,\n Line2DPathEffectProps,\n Path1DPathEffectProps,\n Path2DPathEffectProps,\n} from \"../types/PathEffects\";\nimport { NATIVE_DOM } from \"../../renderer/HostComponents\";\nimport type { ParagraphProps } from \"../types/Paragraph\";\n\nimport {\n FillNode,\n ImageNode,\n CircleNode,\n PathNode,\n LineNode,\n PatchNode,\n PointsNode,\n RectNode,\n RRectNode,\n VerticesNode,\n TextNode,\n OvalNode,\n CustomDrawingNode,\n TextPathNode,\n TextBlobNode,\n GlyphsNode,\n DiffRectNode,\n PictureNode,\n ImageSVGNode,\n BackdropFilterNode,\n BoxNode,\n BoxShadowNode,\n} from \"./drawings\";\nimport {\n BlendImageFilterNode,\n BlurImageFilterNode,\n BlurMaskFilterNode,\n DisplacementMapImageFilterNode,\n DropShadowImageFilterNode,\n OffsetImageFilterNode,\n RuntimeShaderImageFilterNode,\n CornerPathEffectNode,\n DiscretePathEffectNode,\n DashPathEffectNode,\n Path1DPathEffectNode,\n Path2DPathEffectNode,\n SumPathEffectNode,\n Line2DPathEffectNode,\n BlendNode,\n} from \"./paint\";\nimport {\n MatrixColorFilterNode,\n LumaColorFilterNode,\n LinearToSRGBGammaColorFilterNode,\n SRGBToLinearGammaColorFilterNode,\n BlendColorFilterNode,\n LerpColorFilterNode,\n} from \"./paint/ColorFilters\";\nimport {\n LinearGradientNode,\n ShaderNode,\n ImageShaderNode,\n TwoPointConicalGradientNode,\n TurbulenceNode,\n SweepGradientNode,\n RadialGradientNode,\n FractalNoiseNode,\n ColorNode,\n} from \"./paint/Shaders\";\nimport { MorphologyImageFilterNode } from \"./paint/ImageFilters\";\nimport { GroupNode } from \"./GroupNode\";\nimport { PaintNode } from \"./PaintNode\";\nimport type { NodeContext } from \"./Node\";\nimport { LayerNode } from \"./LayerNode\";\nimport { ParagraphNode } from \"./drawings/ParagraphNode\";\n\nexport class JsiSkDOM implements SkDOM {\n constructor(private ctx: NodeContext) {}\n\n Layer(props?: ChildrenProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.LayerNode(props ?? {})\n : new LayerNode(this.ctx, props ?? {});\n }\n\n Group(props?: GroupProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.GroupNode(props ?? {})\n : new GroupNode(this.ctx, props ?? {});\n }\n\n Paint(props: PaintProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.PaintNode(props ?? {})\n : new PaintNode(this.ctx, props);\n }\n\n // Drawings\n Fill(props?: DrawingNodeProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.FillNode(props ?? {})\n : new FillNode(this.ctx, props);\n }\n\n Image(props: ImageProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.ImageNode(props ?? {})\n : new ImageNode(this.ctx, props);\n }\n\n Circle(props: CircleProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.CircleNode(props ?? {})\n : new CircleNode(this.ctx, props);\n }\n\n Path(props: PathProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.PathNode(props ?? {})\n : new PathNode(this.ctx, props);\n }\n\n CustomDrawing(props: CustomDrawingNodeProps) {\n console.warn(\n // eslint-disable-next-line max-len\n \"The <Drawing /> component is deprecated and will be removed in the next release. For custom drawings, please sure the <Picture /> component: https://shopify.github.io/react-native-skia/docs/shapes/pictures/\"\n );\n return NATIVE_DOM\n ? global.SkiaDomApi.CustomDrawingNode(props ?? {})\n : new CustomDrawingNode(this.ctx, props);\n }\n\n Line(props: LineProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.LineNode(props ?? {})\n : new LineNode(this.ctx, props);\n }\n\n Oval(props: OvalProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.OvalNode(props ?? {})\n : new OvalNode(this.ctx, props);\n }\n\n Patch(props: PatchProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.PatchNode(props ?? {})\n : new PatchNode(this.ctx, props);\n }\n\n Points(props: PointsProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.PointsNode(props ?? {})\n : new PointsNode(this.ctx, props);\n }\n\n Rect(props: RectProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.RectNode(props)\n : new RectNode(this.ctx, props);\n }\n\n RRect(props: RoundedRectProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.RRectNode(props)\n : new RRectNode(this.ctx, props);\n }\n\n Vertices(props: VerticesProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.VerticesNode(props)\n : new VerticesNode(this.ctx, props);\n }\n\n Text(props: TextProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.TextNode(props)\n : new TextNode(this.ctx, props);\n }\n\n TextPath(props: TextPathProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.TextPathNode(props)\n : new TextPathNode(this.ctx, props);\n }\n\n TextBlob(props: TextBlobProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.TextBlobNode(props)\n : new TextBlobNode(this.ctx, props);\n }\n\n Glyphs(props: GlyphsProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.GlyphsNode(props)\n : new GlyphsNode(this.ctx, props);\n }\n\n DiffRect(props: DiffRectProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.DiffRectNode(props)\n : new DiffRectNode(this.ctx, props);\n }\n\n Picture(props: PictureProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.PictureNode(props)\n : new PictureNode(this.ctx, props);\n }\n\n ImageSVG(props: ImageSVGProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.ImageSVGNode(props)\n : new ImageSVGNode(this.ctx, props);\n }\n\n // BlurMaskFilters\n BlurMaskFilter(props: BlurMaskFilterProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.BlurMaskFilterNode(props)\n : new BlurMaskFilterNode(this.ctx, props);\n }\n\n // ImageFilters\n BlendImageFilter(props: BlendImageFilterProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.BlendImageFilterNode(props)\n : new BlendImageFilterNode(this.ctx, props);\n }\n\n DropShadowImageFilter(props: DropShadowImageFilterProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.DropShadowImageFilterNode(props)\n : new DropShadowImageFilterNode(this.ctx, props);\n }\n\n DisplacementMapImageFilter(props: DisplacementMapImageFilterProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.DisplacementMapImageFilterNode(props)\n : new DisplacementMapImageFilterNode(this.ctx, props);\n }\n\n BlurImageFilter(props: BlurImageFilterProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.BlurImageFilterNode(props)\n : new BlurImageFilterNode(this.ctx, props);\n }\n\n OffsetImageFilter(props: OffsetImageFilterProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.OffsetImageFilterNode(props)\n : new OffsetImageFilterNode(this.ctx, props);\n }\n\n MorphologyImageFilter(props: MorphologyImageFilterProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.MorphologyImageFilterNode(props)\n : new MorphologyImageFilterNode(this.ctx, props);\n }\n\n RuntimeShaderImageFilter(props: RuntimeShaderImageFilterProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.RuntimeShaderImageFilterNode(props)\n : new RuntimeShaderImageFilterNode(this.ctx, props);\n }\n\n // Color Filters\n MatrixColorFilter(props: MatrixColorFilterProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.MatrixColorFilterNode(props)\n : new MatrixColorFilterNode(this.ctx, props);\n }\n\n BlendColorFilter(props: BlendColorFilterProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.BlendColorFilterNode(props)\n : new BlendColorFilterNode(this.ctx, props);\n }\n\n LumaColorFilter() {\n return NATIVE_DOM\n ? global.SkiaDomApi.LumaColorFilterNode()\n : new LumaColorFilterNode(this.ctx);\n }\n\n LinearToSRGBGammaColorFilter() {\n return global.SkiaDomApi &&\n global.SkiaDomApi.LinearToSRGBGammaColorFilterNode\n ? global.SkiaDomApi.LinearToSRGBGammaColorFilterNode()\n : new LinearToSRGBGammaColorFilterNode(this.ctx);\n }\n\n SRGBToLinearGammaColorFilter() {\n return global.SkiaDomApi &&\n global.SkiaDomApi.SRGBToLinearGammaColorFilterNode\n ? global.SkiaDomApi.SRGBToLinearGammaColorFilterNode()\n : new SRGBToLinearGammaColorFilterNode(this.ctx);\n }\n\n LerpColorFilter(props: LerpColorFilterProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.LerpColorFilterNode(props)\n : new LerpColorFilterNode(this.ctx, props);\n }\n\n // Shaders\n Shader(props: ShaderProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.ShaderNode(props)\n : new ShaderNode(this.ctx, props);\n }\n\n ImageShader(props: ImageShaderProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.ImageShaderNode(props)\n : new ImageShaderNode(this.ctx, props);\n }\n\n ColorShader(props: ColorProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.ColorShaderNode(props)\n : new ColorNode(this.ctx, props);\n }\n\n SweepGradient(props: SweepGradientProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.SweepGradientNode(props)\n : new SweepGradientNode(this.ctx, props);\n }\n\n Turbulence(props: TurbulenceProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.TurbulenceNode(props)\n : new TurbulenceNode(this.ctx, props);\n }\n\n FractalNoise(props: FractalNoiseProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.FractalNoiseNode(props)\n : new FractalNoiseNode(this.ctx, props);\n }\n\n LinearGradient(props: LinearGradientProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.LinearGradientNode(props)\n : new LinearGradientNode(this.ctx, props);\n }\n\n RadialGradient(props: RadialGradientProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.RadialGradientNode(props)\n : new RadialGradientNode(this.ctx, props);\n }\n\n TwoPointConicalGradient(props: TwoPointConicalGradientProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.TwoPointConicalGradientNode(props)\n : new TwoPointConicalGradientNode(this.ctx, props);\n }\n\n // Path Effects\n CornerPathEffect(props: CornerPathEffectProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.CornerPathEffectNode(props)\n : new CornerPathEffectNode(this.ctx, props);\n }\n\n DiscretePathEffect(props: DiscretePathEffectProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.DiscretePathEffectNode(props)\n : new DiscretePathEffectNode(this.ctx, props);\n }\n\n DashPathEffect(props: DashPathEffectProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.DashPathEffectNode(props)\n : new DashPathEffectNode(this.ctx, props);\n }\n\n Path1DPathEffect(props: Path1DPathEffectProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.Path1DPathEffectNode(props)\n : new Path1DPathEffectNode(this.ctx, props);\n }\n\n Path2DPathEffect(props: Path2DPathEffectProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.Path2DPathEffectNode(props)\n : new Path2DPathEffectNode(this.ctx, props);\n }\n\n SumPathEffect() {\n return NATIVE_DOM\n ? global.SkiaDomApi.SumPathEffectNode()\n : new SumPathEffectNode(this.ctx);\n }\n\n Line2DPathEffect(props: Line2DPathEffectProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.Line2DPathEffectNode(props)\n : new Line2DPathEffectNode(this.ctx, props);\n }\n\n Blend(props: BlendProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.BlendNode(props)\n : new BlendNode(this.ctx, props);\n }\n\n BackdropFilter(props: ChildrenProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.BackdropFilterNode(props)\n : new BackdropFilterNode(this.ctx, props);\n }\n\n Box(props: BoxProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.BoxNode(props)\n : new BoxNode(this.ctx, props);\n }\n\n BoxShadow(props: BoxShadowProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.BoxShadowNode(props)\n : new BoxShadowNode(this.ctx, props);\n }\n\n // Paragraph\n Paragraph(props: ParagraphProps) {\n return NATIVE_DOM\n ? global.SkiaDomApi.ParagraphNode(props)\n : new ParagraphNode(this.ctx, props);\n }\n}\n"],"mappings":";;;;;;;AA0DA;;AAGA;;AAwBA;;AAiBA;;AAQA;;AAWA;;AACA;;AACA;;AAEA;;AACA;;AAEO,MAAMA,QAAN,CAAgC;EACrCC,WAAW,CAASC,GAAT,EAA2B;IAAA,KAAlBA,GAAkB,GAAlBA,GAAkB;EAAE;;EAExCC,KAAK,CAACC,KAAD,EAAwB;IAC3B,OAAOC,0BAAA,GACHC,MAAM,CAACC,UAAP,CAAkBC,SAAlB,CAA4BJ,KAAK,IAAI,EAArC,CADG,GAEH,IAAII,oBAAJ,CAAc,KAAKN,GAAnB,EAAwBE,KAAK,IAAI,EAAjC,CAFJ;EAGD;;EAEDK,KAAK,CAACL,KAAD,EAAqB;IACxB,OAAOC,0BAAA,GACHC,MAAM,CAACC,UAAP,CAAkBG,SAAlB,CAA4BN,KAAK,IAAI,EAArC,CADG,GAEH,IAAIM,oBAAJ,CAAc,KAAKR,GAAnB,EAAwBE,KAAK,IAAI,EAAjC,CAFJ;EAGD;;EAEDO,KAAK,CAACP,KAAD,EAAoB;IACvB,OAAOC,0BAAA,GACHC,MAAM,CAACC,UAAP,CAAkBK,SAAlB,CAA4BR,KAAK,IAAI,EAArC,CADG,GAEH,IAAIQ,oBAAJ,CAAc,KAAKV,GAAnB,EAAwBE,KAAxB,CAFJ;EA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AnB,EAAwBE,KAAxB,CAFJ;EAGD;;EAEDgH,cAAc,CAAChH,KAAD,EAAuB;IACnC,OAAOC,0BAAA,GACHC,MAAM,CAACC,UAAP,CAAkB8G,kBAAlB,CAAqCjH,KAArC,CADG,GAEH,IAAIiH,4BAAJ,CAAuB,KAAKnH,GAA5B,EAAiCE,KAAjC,CAFJ;EAGD;;EAEDkH,GAAG,CAAClH,KAAD,EAAkB;IACnB,OAAOC,0BAAA,GACHC,MAAM,CAACC,UAAP,CAAkBgH,OAAlB,CAA0BnH,KAA1B,CADG,GAEH,IAAImH,iBAAJ,CAAY,KAAKrH,GAAjB,EAAsBE,KAAtB,CAFJ;EAGD;;EAEDoH,SAAS,CAACpH,KAAD,EAAwB;IAC/B,OAAOC,0BAAA,GACHC,MAAM,CAACC,UAAP,CAAkBkH,aAAlB,CAAgCrH,KAAhC,CADG,GAEH,IAAIqH,uBAAJ,CAAkB,KAAKvH,GAAvB,EAA4BE,KAA5B,CAFJ;EAGD,CA7VoC,CA+VrC;;;EACAsH,SAAS,CAACtH,KAAD,EAAwB;IAC/B,OAAOC,0BAAA,GACHC,MAAM,CAACC,UAAP,CAAkBoH,aAAlB,CAAgCvH,KAAhC,CADG,GAEH,IAAIuH,4BAAJ,CAAkB,KAAKzH,GAAvB,EAA4BE,KAA5B,CAFJ;EAGD;;AApWoC"}
@@ -8,14 +8,14 @@ export declare const size: (width?: number, height?: number) => {
8
8
  width: number;
9
9
  height: number;
10
10
  };
11
- export declare const rect2rect: (src: SkRect, dst: SkRect) => readonly [{
12
- readonly translateX: number;
11
+ export declare const rect2rect: (src: SkRect, dst: SkRect) => [{
12
+ translateX: number;
13
13
  }, {
14
- readonly translateY: number;
14
+ translateY: number;
15
15
  }, {
16
- readonly scaleX: number;
16
+ scaleX: number;
17
17
  }, {
18
- readonly scaleY: number;
18
+ scaleY: number;
19
19
  }];
20
20
  export declare const fitRects: (fit: Fit, rect: SkRect, { x, y, width, height }: SkRect) => {
21
21
  src: {
@@ -1 +1 @@
1
- {"version":3,"names":["size","width","height","rect2rect","src","dst","scaleX","scaleY","translateX","x","translateY","y","fitRects","fit","rect","sizes","applyBoxFit","inscribe","halfWidthDelta","halfHeightDelta","input","output","Math","min","aspectRatio","exhaustiveCheck"],"sources":["Fitting.ts"],"sourcesContent":["import { exhaustiveCheck } from \"../../../renderer/typeddash\";\nimport type { SkRect } from \"../../../skia/types\";\nimport type { Fit } from \"../../types\";\n\nexport interface Size {\n width: number;\n height: number;\n}\n\nexport const size = (width = 0, height = 0) => ({ width, height });\n\nexport const rect2rect = (src: SkRect, dst: SkRect) => {\n const scaleX = dst.width / src.width;\n const scaleY = dst.height / src.height;\n const translateX = dst.x - src.x * scaleX;\n const translateY = dst.y - src.y * scaleY;\n return [{ translateX }, { translateY }, { scaleX }, { scaleY }] as const;\n};\n\nexport const fitRects = (\n fit: Fit,\n rect: SkRect,\n { x, y, width, height }: SkRect\n) => {\n const sizes = applyBoxFit(\n fit,\n { width: rect.width, height: rect.height },\n { width, height }\n );\n const src = inscribe(sizes.src, rect);\n const dst = inscribe(sizes.dst, {\n x,\n y,\n width,\n height,\n });\n return { src, dst };\n};\n\nconst inscribe = (\n { width, height }: Size,\n rect: { x: number; y: number; width: number; height: number }\n) => {\n const halfWidthDelta = (rect.width - width) / 2.0;\n const halfHeightDelta = (rect.height - height) / 2.0;\n return {\n x: rect.x + halfWidthDelta,\n y: rect.y + halfHeightDelta,\n width,\n height,\n };\n};\n\nconst applyBoxFit = (fit: Fit, input: Size, output: Size) => {\n let src = size(),\n dst = size();\n if (\n input.height <= 0.0 ||\n input.width <= 0.0 ||\n output.height <= 0.0 ||\n output.width <= 0.0\n ) {\n return { src, dst };\n }\n switch (fit) {\n case \"fill\":\n src = input;\n dst = output;\n break;\n case \"contain\":\n src = input;\n if (output.width / output.height > src.width / src.height) {\n dst = size((src.width * output.height) / src.height, output.height);\n } else {\n dst = size(output.width, (src.height * output.width) / src.width);\n }\n break;\n case \"cover\":\n if (output.width / output.height > input.width / input.height) {\n src = size(input.width, (input.width * output.height) / output.width);\n } else {\n src = size((input.height * output.width) / output.height, input.height);\n }\n dst = output;\n break;\n case \"fitWidth\":\n src = size(input.width, (input.width * output.height) / output.width);\n dst = size(output.width, (src.height * output.width) / src.width);\n break;\n case \"fitHeight\":\n src = size((input.height * output.width) / output.height, input.height);\n dst = size((src.width * output.height) / src.height, output.height);\n break;\n case \"none\":\n src = size(\n Math.min(input.width, output.width),\n Math.min(input.height, output.height)\n );\n dst = src;\n break;\n case \"scaleDown\":\n src = input;\n dst = input;\n const aspectRatio = input.width / input.height;\n if (dst.height > output.height) {\n dst = size(output.height * aspectRatio, output.height);\n }\n if (dst.width > output.width) {\n dst = size(output.width, output.width / aspectRatio);\n }\n break;\n default:\n exhaustiveCheck(fit);\n }\n return { src, dst };\n};\n"],"mappings":";;;;;;;AAAA;;AASO,MAAMA,IAAI,GAAG;EAAA,IAACC,KAAD,uEAAS,CAAT;EAAA,IAAYC,MAAZ,uEAAqB,CAArB;EAAA,OAA4B;IAAED,KAAF;IAASC;EAAT,CAA5B;AAAA,CAAb;;;;AAEA,MAAMC,SAAS,GAAG,CAACC,GAAD,EAAcC,GAAd,KAA8B;EACrD,MAAMC,MAAM,GAAGD,GAAG,CAACJ,KAAJ,GAAYG,GAAG,CAACH,KAA/B;EACA,MAAMM,MAAM,GAAGF,GAAG,CAACH,MAAJ,GAAaE,GAAG,CAACF,MAAhC;EACA,MAAMM,UAAU,GAAGH,GAAG,CAACI,CAAJ,GAAQL,GAAG,CAACK,CAAJ,GAAQH,MAAnC;EACA,MAAMI,UAAU,GAAGL,GAAG,CAACM,CAAJ,GAAQP,GAAG,CAACO,CAAJ,GAAQJ,MAAnC;EACA,OAAO,CAAC;IAAEC;EAAF,CAAD,EAAiB;IAAEE;EAAF,CAAjB,EAAiC;IAAEJ;EAAF,CAAjC,EAA6C;IAAEC;EAAF,CAA7C,CAAP;AACD,CANM;;;;AAQA,MAAMK,QAAQ,GAAG,CACtBC,GAD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I,CAACqB,MAAM,CAACpB,KAAR,EAAeoB,MAAM,CAACpB,KAAP,GAAeuB,WAA9B,CAAV;MACD;;MACD;;IACF;MACE,IAAAC,0BAAA,EAAgBZ,GAAhB;EAhDJ;;EAkDA,OAAO;IAAET,GAAF;IAAOC;EAAP,CAAP;AACD,CA9DD"}
1
+ {"version":3,"names":["size","width","height","rect2rect","src","dst","scaleX","scaleY","translateX","x","translateY","y","fitRects","fit","rect","sizes","applyBoxFit","inscribe","halfWidthDelta","halfHeightDelta","input","output","Math","min","aspectRatio","exhaustiveCheck"],"sources":["Fitting.ts"],"sourcesContent":["import { exhaustiveCheck } from \"../../../renderer/typeddash\";\nimport type { SkRect } from \"../../../skia/types\";\nimport type { Fit } from \"../../types\";\n\nexport interface Size {\n width: number;\n height: number;\n}\n\nexport const size = (width = 0, height = 0) => ({ width, height });\n\nexport const rect2rect = (\n src: SkRect,\n dst: SkRect\n): [\n { translateX: number },\n { translateY: number },\n { scaleX: number },\n { scaleY: number }\n] => {\n const scaleX = dst.width / src.width;\n const scaleY = dst.height / src.height;\n const translateX = dst.x - src.x * scaleX;\n const translateY = dst.y - src.y * scaleY;\n return [{ translateX }, { translateY }, { scaleX }, { scaleY }];\n};\n\nexport const fitRects = (\n fit: Fit,\n rect: SkRect,\n { x, y, width, height }: SkRect\n) => {\n const sizes = applyBoxFit(\n fit,\n { width: rect.width, height: rect.height },\n { width, height }\n );\n const src = inscribe(sizes.src, rect);\n const dst = inscribe(sizes.dst, {\n x,\n y,\n width,\n height,\n });\n return { src, dst };\n};\n\nconst inscribe = (\n { width, height }: Size,\n rect: { x: number; y: number; width: number; height: number }\n) => {\n const halfWidthDelta = (rect.width - width) / 2.0;\n const halfHeightDelta = (rect.height - height) / 2.0;\n return {\n x: rect.x + halfWidthDelta,\n y: rect.y + halfHeightDelta,\n width,\n height,\n };\n};\n\nconst applyBoxFit = (fit: Fit, input: Size, output: Size) => {\n let src = size(),\n dst = size();\n if (\n input.height <= 0.0 ||\n input.width <= 0.0 ||\n output.height <= 0.0 ||\n output.width <= 0.0\n ) {\n return { src, dst };\n }\n switch (fit) {\n case \"fill\":\n src = input;\n dst = output;\n break;\n case \"contain\":\n src = input;\n if (output.width / output.height > src.width / src.height) {\n dst = size((src.width * output.height) / src.height, output.height);\n } else {\n dst = size(output.width, (src.height * output.width) / src.width);\n }\n break;\n case \"cover\":\n if (output.width / output.height > input.width / input.height) {\n src = size(input.width, (input.width * output.height) / output.width);\n } else {\n src = size((input.height * output.width) / output.height, input.height);\n }\n dst = output;\n break;\n case \"fitWidth\":\n src = size(input.width, (input.width * output.height) / output.width);\n dst = size(output.width, (src.height * output.width) / src.width);\n break;\n case \"fitHeight\":\n src = size((input.height * output.width) / output.height, input.height);\n dst = size((src.width * output.height) / src.height, output.height);\n break;\n case \"none\":\n src = size(\n Math.min(input.width, output.width),\n Math.min(input.height, output.height)\n );\n dst = src;\n break;\n case \"scaleDown\":\n src = input;\n dst = input;\n const aspectRatio = input.width / input.height;\n if (dst.height > output.height) {\n dst = size(output.height * aspectRatio, output.height);\n }\n if (dst.width > output.width) {\n dst = size(output.width, output.width / aspectRatio);\n }\n break;\n default:\n exhaustiveCheck(fit);\n }\n return { src, dst };\n};\n"],"mappings":";;;;;;;AAAA;;AASO,MAAMA,IAAI,GAAG;EAAA,IAACC,KAAD,uEAAS,CAAT;EAAA,IAAYC,MAAZ,uEAAqB,CAArB;EAAA,OAA4B;IAAED,KAAF;IAASC;EAAT,CAA5B;AAAA,CAAb;;;;AAEA,MAAMC,SAAS,GAAG,CACvBC,GADuB,EAEvBC,GAFuB,KAQpB;EACH,MAAMC,MAAM,GAAGD,GAAG,CAACJ,KAAJ,GAAYG,GAAG,CAACH,KAA/B;EACA,MAAMM,MAAM,GAAGF,GAAG,CAACH,MAAJ,GAAaE,GAAG,CAACF,MAAhC;EACA,MAAMM,UAAU,GAAGH,GAAG,CAACI,CAAJ,GAAQL,GAAG,CAACK,CAAJ,GAAQH,MAAnC;EACA,MAAMI,UA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