@shopify/react-native-skia 0.1.181 → 0.1.183

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. package/cpp/api/JsiSkData.h +7 -0
  2. package/cpp/api/JsiSkImage.h +7 -1
  3. package/cpp/api/JsiSkSVG.h +7 -0
  4. package/cpp/api/JsiSkTypeface.h +7 -0
  5. package/cpp/rnskia/dom/base/DerivedNodeProp.h +1 -1
  6. package/cpp/rnskia/dom/base/JsiDomRenderNode.h +12 -0
  7. package/cpp/rnskia/dom/base/NodePropsContainer.h +1 -1
  8. package/lib/commonjs/animation/functions/interpolate.js +10 -1
  9. package/lib/commonjs/animation/functions/interpolate.js.map +1 -1
  10. package/lib/commonjs/animation/functions/interpolateColors.js +6 -0
  11. package/lib/commonjs/animation/functions/interpolateColors.js.map +1 -1
  12. package/lib/commonjs/animation/functions/interpolatePaths.js +4 -0
  13. package/lib/commonjs/animation/functions/interpolatePaths.js.map +1 -1
  14. package/lib/commonjs/animation/functions/interpolateVector.js +13 -5
  15. package/lib/commonjs/animation/functions/interpolateVector.js.map +1 -1
  16. package/lib/commonjs/dom/nodes/JsiSkDOM.js +56 -54
  17. package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
  18. package/lib/commonjs/external/reanimated/useSharedValueEffect.js +5 -2
  19. package/lib/commonjs/external/reanimated/useSharedValueEffect.js.map +1 -1
  20. package/lib/commonjs/renderer/Canvas.js +30 -9
  21. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  22. package/lib/commonjs/renderer/HostComponents.d.ts +1 -0
  23. package/lib/commonjs/renderer/HostComponents.js +6 -1
  24. package/lib/commonjs/renderer/HostComponents.js.map +1 -1
  25. package/lib/commonjs/renderer/Reconciler.js +3 -1
  26. package/lib/commonjs/renderer/Reconciler.js.map +1 -1
  27. package/lib/commonjs/renderer/processors/math/Coordinates.js +42 -18
  28. package/lib/commonjs/renderer/processors/math/Coordinates.js.map +1 -1
  29. package/lib/commonjs/renderer/processors/math/Math.js +10 -2
  30. package/lib/commonjs/renderer/processors/math/Math.js.map +1 -1
  31. package/lib/commonjs/renderer/processors/math/Transforms.js +2 -0
  32. package/lib/commonjs/renderer/processors/math/Transforms.js.map +1 -1
  33. package/lib/commonjs/renderer/typeddash.js +2 -0
  34. package/lib/commonjs/renderer/typeddash.js.map +1 -1
  35. package/lib/commonjs/skia/core/Data.d.ts +2 -2
  36. package/lib/commonjs/skia/core/Data.js +5 -0
  37. package/lib/commonjs/skia/core/Data.js.map +1 -1
  38. package/lib/commonjs/skia/core/Vector.js +24 -4
  39. package/lib/commonjs/skia/core/Vector.js.map +1 -1
  40. package/lib/commonjs/skia/types/Data/Data.d.ts +2 -2
  41. package/lib/commonjs/skia/types/Data/Data.js.map +1 -1
  42. package/lib/commonjs/skia/types/Image/Image.d.ts +2 -2
  43. package/lib/commonjs/skia/types/Image/Image.js.map +1 -1
  44. package/lib/commonjs/skia/types/JsiInstance.d.ts +3 -0
  45. package/lib/commonjs/skia/types/JsiInstance.js.map +1 -1
  46. package/lib/commonjs/skia/types/SVG/SVG.d.ts +2 -2
  47. package/lib/commonjs/skia/types/SVG/SVG.js.map +1 -1
  48. package/lib/commonjs/skia/types/Typeface/Typeface.d.ts +2 -2
  49. package/lib/commonjs/skia/types/Typeface/Typeface.js.map +1 -1
  50. package/lib/commonjs/skia/web/JsiSkData.d.ts +1 -0
  51. package/lib/commonjs/skia/web/JsiSkData.js +3 -0
  52. package/lib/commonjs/skia/web/JsiSkData.js.map +1 -1
  53. package/lib/commonjs/skia/web/JsiSkImage.d.ts +1 -0
  54. package/lib/commonjs/skia/web/JsiSkImage.js +4 -0
  55. package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
  56. package/lib/commonjs/skia/web/JsiSkTypeface.d.ts +1 -0
  57. package/lib/commonjs/skia/web/JsiSkTypeface.js +4 -0
  58. package/lib/commonjs/skia/web/JsiSkTypeface.js.map +1 -1
  59. package/lib/module/animation/functions/interpolate.js +10 -1
  60. package/lib/module/animation/functions/interpolate.js.map +1 -1
  61. package/lib/module/animation/functions/interpolateColors.js +6 -0
  62. package/lib/module/animation/functions/interpolateColors.js.map +1 -1
  63. package/lib/module/animation/functions/interpolatePaths.js +4 -0
  64. package/lib/module/animation/functions/interpolatePaths.js.map +1 -1
  65. package/lib/module/animation/functions/interpolateVector.js +13 -5
  66. package/lib/module/animation/functions/interpolateVector.js.map +1 -1
  67. package/lib/module/dom/nodes/JsiSkDOM.js +55 -54
  68. package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
  69. package/lib/module/external/reanimated/useSharedValueEffect.js +6 -3
  70. package/lib/module/external/reanimated/useSharedValueEffect.js.map +1 -1
  71. package/lib/module/renderer/Canvas.js +29 -10
  72. package/lib/module/renderer/Canvas.js.map +1 -1
  73. package/lib/module/renderer/HostComponents.d.ts +1 -0
  74. package/lib/module/renderer/HostComponents.js +3 -0
  75. package/lib/module/renderer/HostComponents.js.map +1 -1
  76. package/lib/module/renderer/Reconciler.js +2 -1
  77. package/lib/module/renderer/Reconciler.js.map +1 -1
  78. package/lib/module/renderer/processors/math/Coordinates.js +42 -18
  79. package/lib/module/renderer/processors/math/Coordinates.js.map +1 -1
  80. package/lib/module/renderer/processors/math/Math.js +10 -2
  81. package/lib/module/renderer/processors/math/Math.js.map +1 -1
  82. package/lib/module/renderer/processors/math/Transforms.js +2 -0
  83. package/lib/module/renderer/processors/math/Transforms.js.map +1 -1
  84. package/lib/module/renderer/typeddash.js +2 -0
  85. package/lib/module/renderer/typeddash.js.map +1 -1
  86. package/lib/module/skia/core/Data.d.ts +2 -2
  87. package/lib/module/skia/core/Data.js +5 -0
  88. package/lib/module/skia/core/Data.js.map +1 -1
  89. package/lib/module/skia/core/Vector.js +24 -4
  90. package/lib/module/skia/core/Vector.js.map +1 -1
  91. package/lib/module/skia/types/Data/Data.d.ts +2 -2
  92. package/lib/module/skia/types/Data/Data.js.map +1 -1
  93. package/lib/module/skia/types/Image/Image.d.ts +2 -2
  94. package/lib/module/skia/types/Image/Image.js.map +1 -1
  95. package/lib/module/skia/types/JsiInstance.d.ts +3 -0
  96. package/lib/module/skia/types/JsiInstance.js.map +1 -1
  97. package/lib/module/skia/types/SVG/SVG.d.ts +2 -2
  98. package/lib/module/skia/types/SVG/SVG.js.map +1 -1
  99. package/lib/module/skia/types/Typeface/Typeface.d.ts +2 -2
  100. package/lib/module/skia/types/Typeface/Typeface.js.map +1 -1
  101. package/lib/module/skia/web/JsiSkData.d.ts +1 -0
  102. package/lib/module/skia/web/JsiSkData.js +3 -0
  103. package/lib/module/skia/web/JsiSkData.js.map +1 -1
  104. package/lib/module/skia/web/JsiSkImage.d.ts +1 -0
  105. package/lib/module/skia/web/JsiSkImage.js +4 -0
  106. package/lib/module/skia/web/JsiSkImage.js.map +1 -1
  107. package/lib/module/skia/web/JsiSkTypeface.d.ts +1 -0
  108. package/lib/module/skia/web/JsiSkTypeface.js +4 -0
  109. package/lib/module/skia/web/JsiSkTypeface.js.map +1 -1
  110. package/lib/typescript/src/renderer/HostComponents.d.ts +1 -0
  111. package/lib/typescript/src/skia/core/Data.d.ts +2 -2
  112. package/lib/typescript/src/skia/types/Data/Data.d.ts +2 -2
  113. package/lib/typescript/src/skia/types/Image/Image.d.ts +2 -2
  114. package/lib/typescript/src/skia/types/JsiInstance.d.ts +3 -0
  115. package/lib/typescript/src/skia/types/SVG/SVG.d.ts +2 -2
  116. package/lib/typescript/src/skia/types/Typeface/Typeface.d.ts +2 -2
  117. package/lib/typescript/src/skia/web/JsiSkData.d.ts +1 -0
  118. package/lib/typescript/src/skia/web/JsiSkImage.d.ts +1 -0
  119. package/lib/typescript/src/skia/web/JsiSkTypeface.d.ts +1 -0
  120. package/package.json +1 -1
  121. package/react-native-skia.podspec +2 -6
  122. package/src/animation/functions/interpolate.ts +5 -0
  123. package/src/animation/functions/interpolateColors.ts +3 -0
  124. package/src/animation/functions/interpolatePaths.ts +2 -0
  125. package/src/animation/functions/interpolateVector.ts +21 -16
  126. package/src/dom/nodes/JsiSkDOM.ts +55 -54
  127. package/src/external/reanimated/useSharedValueEffect.ts +7 -4
  128. package/src/renderer/Canvas.tsx +34 -14
  129. package/src/renderer/HostComponents.ts +4 -0
  130. package/src/renderer/Reconciler.tsx +2 -1
  131. package/src/renderer/processors/math/Coordinates.ts +36 -20
  132. package/src/renderer/processors/math/Math.ts +12 -4
  133. package/src/renderer/processors/math/Transforms.ts +1 -0
  134. package/src/renderer/typeddash.ts +1 -0
  135. package/src/skia/core/Data.ts +14 -6
  136. package/src/skia/core/Vector.ts +24 -7
  137. package/src/skia/types/Data/Data.ts +2 -2
  138. package/src/skia/types/Image/Image.ts +2 -2
  139. package/src/skia/types/JsiInstance.ts +4 -0
  140. package/src/skia/types/SVG/SVG.ts +2 -2
  141. package/src/skia/types/Typeface/Typeface.ts +2 -2
  142. package/src/skia/web/JsiSkData.ts +4 -0
  143. package/src/skia/web/JsiSkImage.ts +4 -0
  144. package/src/skia/web/JsiSkTypeface.ts +4 -0
@@ -30,6 +30,13 @@ public:
30
30
 
31
31
  JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkData, __typename__))
32
32
 
33
+ JSI_HOST_FUNCTION(dispose) {
34
+ setObject(nullptr);
35
+ return jsi::Value::undefined();
36
+ }
37
+
38
+ JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkData, dispose))
39
+
33
40
  /**
34
41
  Returns the underlying object from a host object of this type
35
42
  */
@@ -104,12 +104,18 @@ public:
104
104
  return jsi::String::createFromAscii(runtime, buffer);
105
105
  }
106
106
 
107
+ JSI_HOST_FUNCTION(dispose) {
108
+ setObject(nullptr);
109
+ return jsi::Value::undefined();
110
+ }
111
+
107
112
  JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkImage, width),
108
113
  JSI_EXPORT_FUNC(JsiSkImage, height),
109
114
  JSI_EXPORT_FUNC(JsiSkImage, makeShaderOptions),
110
115
  JSI_EXPORT_FUNC(JsiSkImage, makeShaderCubic),
111
116
  JSI_EXPORT_FUNC(JsiSkImage, encodeToBytes),
112
- JSI_EXPORT_FUNC(JsiSkImage, encodeToBase64))
117
+ JSI_EXPORT_FUNC(JsiSkImage, encodeToBase64),
118
+ JSI_EXPORT_FUNC(JsiSkImage, dispose))
113
119
 
114
120
  JsiSkImage(std::shared_ptr<RNSkPlatformContext> context,
115
121
  const sk_sp<SkImage> image)
@@ -30,6 +30,13 @@ public:
30
30
 
31
31
  JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkSVG, __typename__))
32
32
 
33
+ JSI_HOST_FUNCTION(dispose) {
34
+ setObject(nullptr);
35
+ return jsi::Value::undefined();
36
+ }
37
+
38
+ JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkSVG, dispose))
39
+
33
40
  /**
34
41
  Returns the underlying object from a host object of this type
35
42
  */
@@ -29,6 +29,13 @@ public:
29
29
 
30
30
  JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkTypeface, __typename__))
31
31
 
32
+ JSI_HOST_FUNCTION(dispose) {
33
+ setObject(nullptr);
34
+ return jsi::Value::undefined();
35
+ }
36
+
37
+ JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkTypeface, dispose))
38
+
32
39
  JsiSkTypeface(std::shared_ptr<RNSkPlatformContext> context,
33
40
  sk_sp<SkTypeface> typeface)
34
41
  : JsiSkWrappingSkPtrHostObject(std::move(context), std::move(typeface)) {}
@@ -72,7 +72,7 @@ public:
72
72
  Adds a property to the derived property child props.
73
73
  */
74
74
  template <class _Tp, class... _Args,
75
- class = std::_EnableIf<!std::is_array<_Tp>::value>>
75
+ class = std::enable_if_t<!std::is_array<_Tp>::value>>
76
76
  _Tp *defineProperty(_Args &&...__args) {
77
77
  auto prop =
78
78
  std::make_shared<_Tp>(std::forward<_Args>(__args)..., _onChange);
@@ -132,6 +132,14 @@ public:
132
132
  */
133
133
  void resetPendingChanges() override { JsiDomNode::resetPendingChanges(); }
134
134
 
135
+ /**
136
+ Overridden dispose to release resources
137
+ */
138
+ void dispose(bool immediate) override {
139
+ JsiDomNode::dispose(immediate);
140
+ _paintCache.clear();
141
+ }
142
+
135
143
  protected:
136
144
  /**
137
145
  Invalidates and marks then context as changed.
@@ -232,6 +240,10 @@ private:
232
240
  }
233
241
 
234
242
  struct PaintCache {
243
+ void clear() {
244
+ parent = nullptr;
245
+ child = nullptr;
246
+ }
235
247
  std::shared_ptr<SkPaint> parent;
236
248
  std::shared_ptr<SkPaint> child;
237
249
  };
@@ -112,7 +112,7 @@ public:
112
112
  Defines a property that will be added to the container
113
113
  */
114
114
  template <class _Tp, class... _Args,
115
- class = std::_EnableIf<!std::is_array<_Tp>::value>>
115
+ class = std::enable_if_t<!std::is_array<_Tp>::value>>
116
116
  _Tp *defineProperty(_Args &&...__args) {
117
117
  // Create property and set onChange callback
118
118
  auto prop =
@@ -18,6 +18,8 @@ exports.Extrapolate = Extrapolate;
18
18
  })(Extrapolate || (exports.Extrapolate = Extrapolate = {}));
19
19
 
20
20
  function getVal(type, coef, val, leftEdgeOutput, rightEdgeOutput, x) {
21
+ "worklet";
22
+
21
23
  switch (type) {
22
24
  case Extrapolate.IDENTITY:
23
25
  return x;
@@ -36,13 +38,16 @@ function getVal(type, coef, val, leftEdgeOutput, rightEdgeOutput, x) {
36
38
  }
37
39
 
38
40
  function isExtrapolate(value) {
41
+ "worklet";
42
+
39
43
  return value === Extrapolate.EXTEND || value === Extrapolate.CLAMP || value === Extrapolate.IDENTITY;
40
44
  } // validates extrapolations type
41
45
  // if type is correct, converts it to ExtrapolationConfig
42
46
 
43
47
 
44
48
  function validateInterpolationOptions(type) {
45
- // initialize extrapolationConfig with default extrapolation
49
+ "worklet"; // initialize extrapolationConfig with default extrapolation
50
+
46
51
  const extrapolationConfig = {
47
52
  extrapolateLeft: Extrapolate.EXTEND,
48
53
  extrapolateRight: Extrapolate.EXTEND
@@ -77,6 +82,8 @@ function validateInterpolationOptions(type) {
77
82
  }
78
83
 
79
84
  function internalInterpolate(x, narrowedInput, extrapolationConfig) {
85
+ "worklet";
86
+
80
87
  const {
81
88
  leftEdgeInput,
82
89
  rightEdgeInput,
@@ -103,6 +110,8 @@ function internalInterpolate(x, narrowedInput, extrapolationConfig) {
103
110
 
104
111
 
105
112
  function interpolate(x, input, output, type) {
113
+ "worklet";
114
+
106
115
  if (input.length < 2 || output.length < 2) {
107
116
  throw Error("Interpolation input and output should contain at least two values.");
108
117
  }
@@ -1 +1 @@
1
- {"version":3,"names":["Extrapolate","getVal","type","coef","val","leftEdgeOutput","rightEdgeOutput","x","IDENTITY","CLAMP","EXTEND","isExtrapolate","value","validateInterpolationOptions","extrapolationConfig","extrapolateLeft","extrapolateRight","Error","Object","assign","internalInterpolate","narrowedInput","leftEdgeInput","rightEdgeInput","progress","interpolate","input","output","length","i"],"sources":["interpolate.ts"],"sourcesContent":["/* eslint-disable max-len */\nexport enum Extrapolate {\n IDENTITY = \"identity\",\n CLAMP = \"clamp\",\n EXTEND = \"extend\",\n}\n\ninterface InterpolationNarrowedInput {\n leftEdgeInput: number;\n rightEdgeInput: number;\n leftEdgeOutput: number;\n rightEdgeOutput: number;\n}\n\nexport interface ExtrapolationConfig {\n extrapolateLeft?: Extrapolate | string;\n extrapolateRight?: Extrapolate | string;\n}\n\ninterface RequiredExtrapolationConfig {\n extrapolateLeft: Extrapolate;\n extrapolateRight: Extrapolate;\n}\n\nexport type ExtrapolationType =\n | ExtrapolationConfig\n | Extrapolate\n | string\n | undefined;\n\nfunction getVal(\n type: Extrapolate,\n coef: number,\n val: number,\n leftEdgeOutput: number,\n rightEdgeOutput: number,\n x: number\n): number {\n switch (type) {\n case Extrapolate.IDENTITY:\n return x;\n case Extrapolate.CLAMP:\n if (coef * val < coef * leftEdgeOutput) {\n return leftEdgeOutput;\n }\n return rightEdgeOutput;\n case Extrapolate.EXTEND:\n default:\n return val;\n }\n}\n\nfunction isExtrapolate(value: string): value is Extrapolate {\n return (\n value === Extrapolate.EXTEND ||\n value === Extrapolate.CLAMP ||\n value === Extrapolate.IDENTITY\n );\n}\n\n// validates extrapolations type\n// if type is correct, converts it to ExtrapolationConfig\nexport function validateInterpolationOptions(\n type: ExtrapolationType\n): RequiredExtrapolationConfig {\n // initialize extrapolationConfig with default extrapolation\n const extrapolationConfig: RequiredExtrapolationConfig = {\n extrapolateLeft: Extrapolate.EXTEND,\n extrapolateRight: Extrapolate.EXTEND,\n };\n\n if (!type) {\n return extrapolationConfig;\n }\n\n if (typeof type === \"string\") {\n if (!isExtrapolate(type)) {\n throw new Error(\n `No supported value for \"interpolate\" \\nSupported values: [\"extend\", \"clamp\", \"identity\", Extrapolatation.CLAMP, Extrapolatation.EXTEND, Extrapolatation.IDENTITY]\\n Valid example:\n interpolate(value, [inputRange], [outputRange], \"clamp\")`\n );\n }\n extrapolationConfig.extrapolateLeft = type;\n extrapolationConfig.extrapolateRight = type;\n return extrapolationConfig;\n }\n\n // otherwise type is extrapolation config object\n if (\n (type.extrapolateLeft && !isExtrapolate(type.extrapolateLeft)) ||\n (type.extrapolateRight && !isExtrapolate(type.extrapolateRight))\n ) {\n throw new Error(\n `No supported value for \"interpolate\" \\nSupported values: [\"extend\", \"clamp\", \"identity\", Extrapolatation.CLAMP, Extrapolatation.EXTEND, Extrapolatation.IDENTITY]\\n Valid example:\n interpolate(value, [inputRange], [outputRange], {\n extrapolateLeft: Extrapolation.CLAMP,\n extrapolateRight: Extrapolation.IDENTITY\n }})`\n );\n }\n\n Object.assign(extrapolationConfig, type);\n return extrapolationConfig;\n}\n\nfunction internalInterpolate(\n x: number,\n narrowedInput: InterpolationNarrowedInput,\n extrapolationConfig: RequiredExtrapolationConfig\n) {\n const { leftEdgeInput, rightEdgeInput, leftEdgeOutput, rightEdgeOutput } =\n narrowedInput;\n if (rightEdgeInput - leftEdgeInput === 0) {\n return leftEdgeOutput;\n }\n const progress = (x - leftEdgeInput) / (rightEdgeInput - leftEdgeInput);\n const val = leftEdgeOutput + progress * (rightEdgeOutput - leftEdgeOutput);\n const coef = rightEdgeOutput >= leftEdgeOutput ? 1 : -1;\n\n if (coef * val < coef * leftEdgeOutput) {\n return getVal(\n extrapolationConfig.extrapolateLeft,\n coef,\n val,\n leftEdgeOutput,\n rightEdgeOutput,\n x\n );\n } else if (coef * val > coef * rightEdgeOutput) {\n return getVal(\n extrapolationConfig.extrapolateRight,\n coef,\n val,\n leftEdgeOutput,\n rightEdgeOutput,\n x\n );\n }\n\n return val;\n}\n\n// e.g. function interpolate(x, input, output, type = Extrapolatation.CLAMP)\nexport function interpolate(\n x: number,\n input: readonly number[],\n output: readonly number[],\n type?: ExtrapolationType\n): number {\n if (input.length < 2 || output.length < 2) {\n throw Error(\n \"Interpolation input and output should contain at least two values.\"\n );\n }\n\n const extrapolationConfig = validateInterpolationOptions(type);\n const { length } = input;\n const narrowedInput: InterpolationNarrowedInput = {\n leftEdgeInput: input[0],\n rightEdgeInput: input[1],\n leftEdgeOutput: output[0],\n rightEdgeOutput: output[1],\n };\n if (length > 2) {\n if (x > input[length - 1]) {\n narrowedInput.leftEdgeInput = input[length - 2];\n narrowedInput.rightEdgeInput = input[length - 1];\n narrowedInput.leftEdgeOutput = output[length - 2];\n narrowedInput.rightEdgeOutput = output[length - 1];\n } else {\n for (let i = 1; i < length; ++i) {\n if (x <= input[i]) {\n narrowedInput.leftEdgeInput = input[i - 1];\n narrowedInput.rightEdgeInput = input[i];\n narrowedInput.leftEdgeOutput = output[i - 1];\n narrowedInput.rightEdgeOutput = output[i];\n break;\n }\n }\n }\n }\n\n return internalInterpolate(x, narrowedInput, extrapolationConfig);\n}\n"],"mappings":";;;;;;;;;AAAA;IACYA,W;;;WAAAA,W;EAAAA,W;EAAAA,W;EAAAA,W;GAAAA,W,2BAAAA,W;;AA6BZ,SAASC,MAAT,CACEC,IADF,EAEEC,IAFF,EAGEC,GAHF,EAIEC,cAJF,EAKEC,eALF,EAMEC,CANF,EAOU;EACR,QAAQL,IAAR;IACE,KAAKF,WAAW,CAAC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AG;IAChDC,aAAa,EAAEI,KAAK,CAAC,CAAD,CAD4B;IAEhDH,cAAc,EAAEG,KAAK,CAAC,CAAD,CAF2B;IAGhDrB,cAAc,EAAEsB,MAAM,CAAC,CAAD,CAH0B;IAIhDrB,eAAe,EAAEqB,MAAM,CAAC,CAAD;EAJyB,CAAlD;;EAMA,IAAIC,MAAM,GAAG,CAAb,EAAgB;IACd,IAAIrB,CAAC,GAAGmB,KAAK,CAACE,MAAM,GAAG,CAAV,CAAb,EAA2B;MACzBP,aAAa,CAACC,aAAd,GAA8BI,KAAK,CAACE,MAAM,GAAG,CAAV,CAAnC;MACAP,aAAa,CAACE,cAAd,GAA+BG,KAAK,CAACE,MAAM,GAAG,CAAV,CAApC;MACAP,aAAa,CAAChB,cAAd,GAA+BsB,MAAM,CAACC,MAAM,GAAG,CAAV,CAArC;MACAP,aAAa,CAACf,eAAd,GAAgCqB,MAAM,CAACC,MAAM,GAAG,CAAV,CAAtC;IACD,CALD,MAKO;MACL,KAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,MAApB,EAA4B,EAAEC,CAA9B,EAAiC;QAC/B,IAAItB,CAAC,IAAImB,KAAK,CAACG,CAAD,CAAd,EAAmB;UACjBR,aAAa,CAACC,aAAd,GAA8BI,KAAK,CAACG,CAAC,GAAG,CAAL,CAAnC;UACAR,aAAa,CAACE,cAAd,GAA+BG,KAAK,CAACG,CAAD,CAApC;UACAR,aAAa,CAAChB,cAAd,GAA+BsB,MAAM,CAACE,CAAC,GAAG,CAAL,CAArC;UACAR,aAAa,CAACf,eAAd,GAAgCqB,MAAM,CAACE,CAAD,CAAtC;UACA;QACD;MACF;IACF;EACF;;EAED,OAAOT,mBAAmB,CAACb,CAAD,EAAIc,aAAJ,EAAmBP,mBAAnB,CAA1B;AACD"}
1
+ {"version":3,"names":["Extrapolate","getVal","type","coef","val","leftEdgeOutput","rightEdgeOutput","x","IDENTITY","CLAMP","EXTEND","isExtrapolate","value","validateInterpolationOptions","extrapolationConfig","extrapolateLeft","extrapolateRight","Error","Object","assign","internalInterpolate","narrowedInput","leftEdgeInput","rightEdgeInput","progress","interpolate","input","output","length","i"],"sources":["interpolate.ts"],"sourcesContent":["/* eslint-disable max-len */\nexport enum Extrapolate {\n IDENTITY = \"identity\",\n CLAMP = \"clamp\",\n EXTEND = \"extend\",\n}\n\ninterface InterpolationNarrowedInput {\n leftEdgeInput: number;\n rightEdgeInput: number;\n leftEdgeOutput: number;\n rightEdgeOutput: number;\n}\n\nexport interface ExtrapolationConfig {\n extrapolateLeft?: Extrapolate | string;\n extrapolateRight?: Extrapolate | string;\n}\n\ninterface RequiredExtrapolationConfig {\n extrapolateLeft: Extrapolate;\n extrapolateRight: Extrapolate;\n}\n\nexport type ExtrapolationType =\n | ExtrapolationConfig\n | Extrapolate\n | string\n | undefined;\n\nfunction getVal(\n type: Extrapolate,\n coef: number,\n val: number,\n leftEdgeOutput: number,\n rightEdgeOutput: number,\n x: number\n): number {\n \"worklet\";\n switch (type) {\n case Extrapolate.IDENTITY:\n return x;\n case Extrapolate.CLAMP:\n if (coef * val < coef * leftEdgeOutput) {\n return leftEdgeOutput;\n }\n return rightEdgeOutput;\n case Extrapolate.EXTEND:\n default:\n return val;\n }\n}\n\nfunction isExtrapolate(value: string): value is Extrapolate {\n \"worklet\";\n return (\n value === Extrapolate.EXTEND ||\n value === Extrapolate.CLAMP ||\n value === Extrapolate.IDENTITY\n );\n}\n\n// validates extrapolations type\n// if type is correct, converts it to ExtrapolationConfig\nexport function validateInterpolationOptions(\n type: ExtrapolationType\n): RequiredExtrapolationConfig {\n \"worklet\";\n // initialize extrapolationConfig with default extrapolation\n const extrapolationConfig: RequiredExtrapolationConfig = {\n extrapolateLeft: Extrapolate.EXTEND,\n extrapolateRight: Extrapolate.EXTEND,\n };\n\n if (!type) {\n return extrapolationConfig;\n }\n\n if (typeof type === \"string\") {\n if (!isExtrapolate(type)) {\n throw new Error(\n `No supported value for \"interpolate\" \\nSupported values: [\"extend\", \"clamp\", \"identity\", Extrapolatation.CLAMP, Extrapolatation.EXTEND, Extrapolatation.IDENTITY]\\n Valid example:\n interpolate(value, [inputRange], [outputRange], \"clamp\")`\n );\n }\n extrapolationConfig.extrapolateLeft = type;\n extrapolationConfig.extrapolateRight = type;\n return extrapolationConfig;\n }\n\n // otherwise type is extrapolation config object\n if (\n (type.extrapolateLeft && !isExtrapolate(type.extrapolateLeft)) ||\n (type.extrapolateRight && !isExtrapolate(type.extrapolateRight))\n ) {\n throw new Error(\n `No supported value for \"interpolate\" \\nSupported values: [\"extend\", \"clamp\", \"identity\", Extrapolatation.CLAMP, Extrapolatation.EXTEND, Extrapolatation.IDENTITY]\\n Valid example:\n interpolate(value, [inputRange], [outputRange], {\n extrapolateLeft: Extrapolation.CLAMP,\n extrapolateRight: Extrapolation.IDENTITY\n }})`\n );\n }\n\n Object.assign(extrapolationConfig, type);\n return extrapolationConfig;\n}\n\nfunction internalInterpolate(\n x: number,\n narrowedInput: InterpolationNarrowedInput,\n extrapolationConfig: RequiredExtrapolationConfig\n) {\n \"worklet\";\n const { leftEdgeInput, rightEdgeInput, leftEdgeOutput, rightEdgeOutput } =\n narrowedInput;\n if (rightEdgeInput - leftEdgeInput === 0) {\n return leftEdgeOutput;\n }\n const progress = (x - leftEdgeInput) / (rightEdgeInput - leftEdgeInput);\n const val = leftEdgeOutput + progress * (rightEdgeOutput - leftEdgeOutput);\n const coef = rightEdgeOutput >= leftEdgeOutput ? 1 : -1;\n\n if (coef * val < coef * leftEdgeOutput) {\n return getVal(\n extrapolationConfig.extrapolateLeft,\n coef,\n val,\n leftEdgeOutput,\n rightEdgeOutput,\n x\n );\n } else if (coef * val > coef * rightEdgeOutput) {\n return getVal(\n extrapolationConfig.extrapolateRight,\n coef,\n val,\n leftEdgeOutput,\n rightEdgeOutput,\n x\n );\n }\n\n return val;\n}\n\n// e.g. function interpolate(x, input, output, type = Extrapolatation.CLAMP)\nexport function interpolate(\n x: number,\n input: readonly number[],\n output: readonly number[],\n type?: ExtrapolationType\n): number {\n \"worklet\";\n if (input.length < 2 || output.length < 2) {\n throw Error(\n \"Interpolation input and output should contain at least two values.\"\n );\n }\n\n const extrapolationConfig = validateInterpolationOptions(type);\n const { length } = input;\n const narrowedInput: InterpolationNarrowedInput = {\n leftEdgeInput: input[0],\n rightEdgeInput: input[1],\n leftEdgeOutput: output[0],\n rightEdgeOutput: output[1],\n };\n if (length > 2) {\n if (x > input[length - 1]) {\n narrowedInput.leftEdgeInput = input[length - 2];\n narrowedInput.rightEdgeInput = input[length - 1];\n narrowedInput.leftEdgeOutput = output[length - 2];\n narrowedInput.rightEdgeOutput = output[length - 1];\n } else {\n for (let i = 1; i < length; ++i) {\n if (x <= input[i]) {\n narrowedInput.leftEdgeInput = input[i - 1];\n narrowedInput.rightEdgeInput = input[i];\n narrowedInput.leftEdgeOutput = output[i - 1];\n narrowedInput.rightEdgeOutput = output[i];\n break;\n }\n }\n }\n }\n\n return internalInterpolate(x, narrowedInput, extrapolationConfig);\n}\n"],"mappings":";;;;;;;;;AAAA;IACYA,W;;;WAAAA,W;EAAAA,W;EAAAA,W;EAAAA,W;GAAAA,W,2BAAAA,W;;AA6BZ,SAASC,MAAT,CACEC,IADF,EAEEC,IAFF,EAGEC,GAHF,EAIEC,cAJF,EAKEC,eALF,EAMEC,CANF,EAOU;EACR;;EACA,QAAQL,IAAR;IACE,KAAKF,WAAW,CAACQ,QAAjB;MACE,OAAOD,CAAP;;IACF,KAAKP,WAAW,CAACS,KAAjB;MACE,IAAIN,IAAI,GAAGC,GAAP,GAAaD,IAAI,GAAGE,cAAxB,EAAwC;QACtC,OAAOA,cAAP;MACD;;MACD,OAAOC,eAAP;;IACF,KAAKN,WAAW,CAACU,MAAjB;IACA;MACE,OAAON,GAAP;EAVJ;AAYD;;AAED,SAASO,aAAT,CAAuBC,KAAvB,EAA4D;EAC1D;;EACA,OACEA,KAAK,KAAKZ,WAAW,CAACU,MAAtB,IACAE,KAAK,KAAKZ,WAAW,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a,CAACC,aAAd,GAA8BI,KAAK,CAACE,MAAM,GAAG,CAAV,CAAnC;MACAP,aAAa,CAACE,cAAd,GAA+BG,KAAK,CAACE,MAAM,GAAG,CAAV,CAApC;MACAP,aAAa,CAAChB,cAAd,GAA+BsB,MAAM,CAACC,MAAM,GAAG,CAAV,CAArC;MACAP,aAAa,CAACf,eAAd,GAAgCqB,MAAM,CAACC,MAAM,GAAG,CAAV,CAAtC;IACD,CALD,MAKO;MACL,KAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,MAApB,EAA4B,EAAEC,CAA9B,EAAiC;QAC/B,IAAItB,CAAC,IAAImB,KAAK,CAACG,CAAD,CAAd,EAAmB;UACjBR,aAAa,CAACC,aAAd,GAA8BI,KAAK,CAACG,CAAC,GAAG,CAAL,CAAnC;UACAR,aAAa,CAACE,cAAd,GAA+BG,KAAK,CAACG,CAAD,CAApC;UACAR,aAAa,CAAChB,cAAd,GAA+BsB,MAAM,CAACE,CAAC,GAAG,CAAL,CAArC;UACAR,aAAa,CAACf,eAAd,GAAgCqB,MAAM,CAACE,CAAD,CAAtC;UACA;QACD;MACF;IACF;EACF;;EAED,OAAOT,mBAAmB,CAACb,CAAD,EAAIc,aAAJ,EAAmBP,mBAAnB,CAA1B;AACD"}
@@ -12,6 +12,8 @@ var _skia = require("../../skia");
12
12
  var _interpolate = require("./interpolate");
13
13
 
14
14
  const interpolateColorsRGB = (value, inputRange, outputRange) => {
15
+ "worklet";
16
+
15
17
  const r = (0, _interpolate.interpolate)(value, inputRange, outputRange.map(c => c[0]), "clamp");
16
18
  const g = (0, _interpolate.interpolate)(value, inputRange, outputRange.map(c => c[1]), "clamp");
17
19
  const b = (0, _interpolate.interpolate)(value, inputRange, outputRange.map(c => c[2]), "clamp");
@@ -20,6 +22,8 @@ const interpolateColorsRGB = (value, inputRange, outputRange) => {
20
22
  };
21
23
 
22
24
  const interpolateColors = (value, inputRange, _outputRange) => {
25
+ "worklet";
26
+
23
27
  const outputRange = _outputRange.map(cl => _skia.Skia.Color(cl));
24
28
 
25
29
  return interpolateColorsRGB(value, inputRange, outputRange);
@@ -28,6 +32,8 @@ const interpolateColors = (value, inputRange, _outputRange) => {
28
32
  exports.interpolateColors = interpolateColors;
29
33
 
30
34
  const mixColors = (value, x, y) => {
35
+ "worklet";
36
+
31
37
  const c1 = _skia.Skia.Color(x);
32
38
 
33
39
  const c2 = _skia.Skia.Color(y);
@@ -1 +1 @@
1
- {"version":3,"names":["interpolateColorsRGB","value","inputRange","outputRange","r","interpolate","map","c","g","b","a","Float32Array","interpolateColors","_outputRange","cl","Skia","Color","mixColors","x","y","c1","c2","mix"],"sources":["interpolateColors.ts"],"sourcesContent":["import { mix } from \"../../renderer/processors/math\";\nimport type { Color, SkColor } from \"../../skia\";\nimport { Skia } from \"../../skia\";\n\nimport { interpolate } from \"./interpolate\";\n\nconst interpolateColorsRGB = (\n value: number,\n inputRange: number[],\n outputRange: SkColor[]\n) => {\n const r = interpolate(\n value,\n inputRange,\n outputRange.map((c) => c[0]),\n \"clamp\"\n );\n const g = interpolate(\n value,\n inputRange,\n outputRange.map((c) => c[1]),\n \"clamp\"\n );\n const b = interpolate(\n value,\n inputRange,\n outputRange.map((c) => c[2]),\n \"clamp\"\n );\n const a = interpolate(\n value,\n inputRange,\n outputRange.map((c) => c[3]),\n \"clamp\"\n );\n return new Float32Array([r, g, b, a]);\n};\n\nexport const interpolateColors = (\n value: number,\n inputRange: number[],\n _outputRange: Color[]\n) => {\n const outputRange = _outputRange.map((cl) => Skia.Color(cl));\n return interpolateColorsRGB(value, inputRange, outputRange);\n};\n\nexport const mixColors = (value: number, x: Color, y: Color) => {\n const c1 = Skia.Color(x);\n const c2 = Skia.Color(y);\n return new Float32Array([\n mix(value, c1[0], c2[0]),\n mix(value, c1[1], c2[1]),\n mix(value, c1[2], c2[2]),\n mix(value, c1[3], c2[3]),\n ]);\n};\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;AAEA,MAAMA,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AKC,KAAL,CAAWE,CAAX,CAAX;;EACA,MAAMG,EAAE,GAAGN,UAAA,CAAKC,KAAL,CAAWG,CAAX,CAAX;;EACA,OAAO,IAAIR,YAAJ,CAAiB,CACtB,IAAAW,SAAA,EAAIrB,KAAJ,EAAWmB,EAAE,CAAC,CAAD,CAAb,EAAkBC,EAAE,CAAC,CAAD,CAApB,CADsB,EAEtB,IAAAC,SAAA,EAAIrB,KAAJ,EAAWmB,EAAE,CAAC,CAAD,CAAb,EAAkBC,EAAE,CAAC,CAAD,CAApB,CAFsB,EAGtB,IAAAC,SAAA,EAAIrB,KAAJ,EAAWmB,EAAE,CAAC,CAAD,CAAb,EAAkBC,EAAE,CAAC,CAAD,CAApB,CAHsB,EAItB,IAAAC,SAAA,EAAIrB,KAAJ,EAAWmB,EAAE,CAAC,CAAD,CAAb,EAAkBC,EAAE,CAAC,CAAD,CAApB,CAJsB,CAAjB,CAAP;AAMD,CATM"}
1
+ {"version":3,"names":["interpolateColorsRGB","value","inputRange","outputRange","r","interpolate","map","c","g","b","a","Float32Array","interpolateColors","_outputRange","cl","Skia","Color","mixColors","x","y","c1","c2","mix"],"sources":["interpolateColors.ts"],"sourcesContent":["import { mix } from \"../../renderer/processors/math\";\nimport type { Color, SkColor } from \"../../skia\";\nimport { Skia } from \"../../skia\";\n\nimport { interpolate } from \"./interpolate\";\n\nconst interpolateColorsRGB = (\n value: number,\n inputRange: number[],\n outputRange: SkColor[]\n) => {\n \"worklet\";\n const r = interpolate(\n value,\n inputRange,\n outputRange.map((c) => c[0]),\n \"clamp\"\n );\n const g = interpolate(\n value,\n inputRange,\n outputRange.map((c) => c[1]),\n \"clamp\"\n );\n const b = interpolate(\n value,\n inputRange,\n outputRange.map((c) => c[2]),\n \"clamp\"\n );\n const a = interpolate(\n value,\n inputRange,\n outputRange.map((c) => c[3]),\n \"clamp\"\n );\n return new Float32Array([r, g, b, a]);\n};\n\nexport const interpolateColors = (\n value: number,\n inputRange: number[],\n _outputRange: Color[]\n) => {\n \"worklet\";\n const outputRange = _outputRange.map((cl) => Skia.Color(cl));\n return interpolateColorsRGB(value, inputRange, outputRange);\n};\n\nexport const mixColors = (value: number, x: Color, y: Color) => {\n \"worklet\";\n const c1 = Skia.Color(x);\n const c2 = Skia.Color(y);\n return new Float32Array([\n mix(value, c1[0], c2[0]),\n mix(value, c1[1], c2[1]),\n mix(value, c1[2], c2[2]),\n mix(value, c1[3], c2[3]),\n ]);\n};\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;AAEA,MAAMA,oBAAoB,GAAG,CAC3BC,KAD2B,EAE3BC,UAF2B,EAG3BC,WAH2B,KAIxB;EACH;;EACA,MAAMC,CAAC,GAAG,IAAAC,wBAAA,EACRJ,KADQ,EAERC,UAFQ,EAGRC,WAAW,CAACG,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAAC,CAAD,CAAxB,CAHQ,EAIR,OAJQ,CAAV;EAMA,MAAMC,CAAC,GAAG,IAAAH,wBAAA,EACRJ,KADQ,EAERC,UAFQ,EAGRC,WAAW,CAACG,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAAC,CAAD,CAAxB,CAHQ,EAIR,OAJQ,CAAV;EAMA,MAAME,CAAC,GAAG,IAAAJ,wBAAA,EACRJ,KADQ,EAERC,UAFQ,EAGRC,WAAW,CAACG,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAAC,CAAD,CAAxB,CAHQ,EAIR,OAJQ,CAAV;EAMA,MAAMG,CAAC,GAAG,IAAAL,wBAAA,EACRJ,KADQ,EAERC,UAFQ,EAGRC,WAAW,CAACG,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAAC,CAAD,CAAxB,CAHQ,EAIR,OAJQ,CAAV;EAMA,OAAO,IAAII,YAAJ,CAAiB,CAACP,CAAD,EAAII,CAAJ,EAAOC,CAAP,EAAUC,CAAV,CAAjB,CAAP;AACD,CA/BD;;AAiCO,MAAME,iBAAiB,GAAG,CAC/BX,KAD+B,EAE/BC,UAF+B,EAG/BW,YAH+B,KAI5B;EACH;;EACA,MAAMV,WAAW,GAAGU,YAAY,CAACP,GAAb,CAAkBQ,EAAD,IAAQC,UAAA,CAAKC,KAAL,CAAWF,EAAX,CAAzB,CAApB;;EACA,OAAOd,oBAAoB,CAACC,KAAD,EAAQC,UAAR,EAAoBC,WAApB,CAA3B;AACD,CARM;;;;AAUA,MAAMc,SAAS,GAAG,CAAChB,KAAD,EAAgBiB,CAAhB,EAA0BC,CAA1B,KAAuC;EAC9D;;EACA,MAAMC,EAAE,GAAGL,UAAA,CAAKC,KAAL,CAAWE,CAAX,CAAX;;EACA,MAAMG,EAAE,GAAGN,UAAA,CAAKC,KAAL,CAAWG,CAAX,CAAX;;EACA,OAAO,IAAIR,YAAJ,CAAiB,CACtB,IAAAW,SAAA,EAAIrB,KAAJ,EAAWmB,EAAE,CAAC,CAAD,CAAb,EAAkBC,EAAE,CAAC,CAAD,CAApB,CADsB,EAEtB,IAAAC,SAAA,EAAIrB,KAAJ,EAAWmB,EAAE,CAAC,CAAD,CAAb,EAAkBC,EAAE,CAAC,CAAD,CAApB,CAFsB,EAGtB,IAAAC,SAAA,EAAIrB,KAAJ,EAAWmB,EAAE,CAAC,CAAD,CAAb,EAAkBC,EAAE,CAAC,CAAD,CAApB,CAHsB,EAItB,IAAAC,SAAA,EAAIrB,KAAJ,EAAWmB,EAAE,CAAC,CAAD,CAAb,EAAkBC,EAAE,CAAC,CAAD,CAApB,CAJsB,CAAjB,CAAP;AAMD,CAVM"}
@@ -10,6 +10,8 @@ var _typeddash = require("../../renderer/typeddash");
10
10
  var _interpolate = require("./interpolate");
11
11
 
12
12
  const lerp = (value, from, to, p1, p2) => {
13
+ "worklet";
14
+
13
15
  const t = (value - from) / (to - from);
14
16
  return p2.interpolate(p1, t);
15
17
  };
@@ -32,6 +34,8 @@ const lerp = (value, from, to, p1, p2) => {
32
34
 
33
35
 
34
36
  const interpolatePaths = (value, input, outputRange, options) => {
37
+ "worklet";
38
+
35
39
  const extrapolation = (0, _interpolate.validateInterpolationOptions)(options);
36
40
 
37
41
  if (value < input[0]) {
@@ -1 +1 @@
1
- {"version":3,"names":["lerp","value","from","to","p1","p2","t","interpolate","interpolatePaths","input","outputRange","options","extrapolation","validateInterpolationOptions","extrapolateLeft","Extrapolate","CLAMP","EXTEND","IDENTITY","Error","exhaustiveCheck","length","extrapolateRight","i"],"sources":["interpolatePaths.ts"],"sourcesContent":["import type { SkPath } from \"../../skia/types\";\nimport { exhaustiveCheck } from \"../../renderer/typeddash\";\n\nimport type { ExtrapolationType } from \"./interpolate\";\nimport { validateInterpolationOptions, Extrapolate } from \"./interpolate\";\n\nconst lerp = (\n value: number,\n from: number,\n to: number,\n p1: SkPath,\n p2: SkPath\n) => {\n const t = (value - from) / (to - from);\n return p2.interpolate(p1, t)!;\n};\n\n/**\n * Maps an input value within a range to an output path within a path range.\n * @param value - The input value.\n * @param inputRange - The range of the input value.\n * @param outputRange - The range of the output path.\n * @param options - Extrapolation options\n * @returns The output path.\n * @example <caption>Map a value between 0 and 1 to a path between two paths.</caption>\n * const path1 = new Path();\n * path1.moveTo(0, 0);\n * path1.lineTo(100, 0);\n * const path2 = new Path();\n * path2.moveTo(0, 0);\n * path2.lineTo(0, 100);\n * const path = interpolatePath(0.5, [0, 1], [path1, path2]);\n */\nexport const interpolatePaths = (\n value: number,\n input: number[],\n outputRange: SkPath[],\n options?: ExtrapolationType\n) => {\n const extrapolation = validateInterpolationOptions(options);\n if (value < input[0]) {\n switch (extrapolation.extrapolateLeft) {\n case Extrapolate.CLAMP:\n return outputRange[0];\n case Extrapolate.EXTEND:\n return lerp(value, input[0], input[1], outputRange[0], outputRange[1]);\n case Extrapolate.IDENTITY:\n throw new Error(\n \"Identity is not a supported extrapolation type for interpolatePaths()\"\n );\n default:\n exhaustiveCheck(extrapolation.extrapolateLeft);\n }\n } else if (value > input[input.length - 1]) {\n switch (extrapolation.extrapolateRight) {\n case Extrapolate.CLAMP:\n return outputRange[outputRange.length - 1];\n case Extrapolate.EXTEND:\n return lerp(\n value,\n input[input.length - 2],\n input[input.length - 1],\n outputRange[input.length - 2],\n outputRange[input.length - 1]\n );\n case Extrapolate.IDENTITY:\n throw new Error(\n \"Identity is not a supported extrapolation type for interpolatePaths()\"\n );\n default:\n exhaustiveCheck(extrapolation.extrapolateRight);\n }\n }\n let i = 0;\n for (; i <= input.length - 1; i++) {\n if (value >= input[i] && value <= input[i + 1]) {\n break;\n }\n }\n return lerp(\n value,\n input[i],\n input[i + 1],\n outputRange[i],\n outputRange[i + 1]\n );\n};\n"],"mappings":";;;;;;;AACA;;AAGA;;AAEA,MAAMA,IAAI,GAAG,CACXC,KADW,EAEXC,IAFW,EAGXC,EAHW,EAIXC,EAJW,EAKXC,EALW,KAMR;EACH,MAAMC,CAAC,GAAG,CAACL,KAAK,GAAGC,IAAT,KAAkBC,EAAE,GAAGD,IAAvB,CAAV;EACA,OAAOG,EAAE,CAACE,WAAH,CAAeH,EAAf,EAAmBE,CAAnB,CAAP;AACD,CATD;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAME,gBAAgB,GAAG,CAC9BP,KAD8B,EAE9BQ,KAF8B,EAG9BC,WAH8B,EAI9BC,OAJ8B,KAK3B;EACH,MAAMC,aAAa,GAAG,IAAAC,yCAAA,EAA6BF,OAA7B,CAAtB;;EACA,IAAIV,KAAK,GAAGQ,KAAK,CAAC,CAAD,CAAjB,EAAsB;IACpB,QAAQG,aAAa,CAACE,eAAtB;MACE,KAAKC,wBAAA,CAAYC,KAAjB;QACE,OAAON,WAAW,CAAC,CAAD,CAAlB;;MACF,KAAKK,wBAAA,CAAYE,MAAjB;QACE,OAAOjB,IAAI,CAACC,KAAD,EAAQQ,KAAK,CAAC,CAAD,CAAb,EAAkBA,KAAK,CAAC,CAAD,CAAvB,EAA4BC,WAAW,CAAC,CAAD,CAAvC,EAA4CA,WAAW,CAAC,CAAD,CAAvD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CAAC,GAAG,CAAL,CALF,CAAX;AAOD,CArDM"}
1
+ {"version":3,"names":["lerp","value","from","to","p1","p2","t","interpolate","interpolatePaths","input","outputRange","options","extrapolation","validateInterpolationOptions","extrapolateLeft","Extrapolate","CLAMP","EXTEND","IDENTITY","Error","exhaustiveCheck","length","extrapolateRight","i"],"sources":["interpolatePaths.ts"],"sourcesContent":["import type { SkPath } from \"../../skia/types\";\nimport { exhaustiveCheck } from \"../../renderer/typeddash\";\n\nimport type { ExtrapolationType } from \"./interpolate\";\nimport { validateInterpolationOptions, Extrapolate } from \"./interpolate\";\n\nconst lerp = (\n value: number,\n from: number,\n to: number,\n p1: SkPath,\n p2: SkPath\n) => {\n \"worklet\";\n const t = (value - from) / (to - from);\n return p2.interpolate(p1, t)!;\n};\n\n/**\n * Maps an input value within a range to an output path within a path range.\n * @param value - The input value.\n * @param inputRange - The range of the input value.\n * @param outputRange - The range of the output path.\n * @param options - Extrapolation options\n * @returns The output path.\n * @example <caption>Map a value between 0 and 1 to a path between two paths.</caption>\n * const path1 = new Path();\n * path1.moveTo(0, 0);\n * path1.lineTo(100, 0);\n * const path2 = new Path();\n * path2.moveTo(0, 0);\n * path2.lineTo(0, 100);\n * const path = interpolatePath(0.5, [0, 1], [path1, path2]);\n */\nexport const interpolatePaths = (\n value: number,\n input: number[],\n outputRange: SkPath[],\n options?: ExtrapolationType\n) => {\n \"worklet\";\n const extrapolation = validateInterpolationOptions(options);\n if (value < input[0]) {\n switch (extrapolation.extrapolateLeft) {\n case Extrapolate.CLAMP:\n return outputRange[0];\n case Extrapolate.EXTEND:\n return lerp(value, input[0], input[1], outputRange[0], outputRange[1]);\n case Extrapolate.IDENTITY:\n throw new Error(\n \"Identity is not a supported extrapolation type for interpolatePaths()\"\n );\n default:\n exhaustiveCheck(extrapolation.extrapolateLeft);\n }\n } else if (value > input[input.length - 1]) {\n switch (extrapolation.extrapolateRight) {\n case Extrapolate.CLAMP:\n return outputRange[outputRange.length - 1];\n case Extrapolate.EXTEND:\n return lerp(\n value,\n input[input.length - 2],\n input[input.length - 1],\n outputRange[input.length - 2],\n outputRange[input.length - 1]\n );\n case Extrapolate.IDENTITY:\n throw new Error(\n \"Identity is not a supported extrapolation type for interpolatePaths()\"\n );\n default:\n exhaustiveCheck(extrapolation.extrapolateRight);\n }\n }\n let i = 0;\n for (; i <= input.length - 1; i++) {\n if (value >= input[i] && value <= input[i + 1]) {\n break;\n }\n }\n return lerp(\n value,\n input[i],\n input[i + 1],\n outputRange[i],\n outputRange[i + 1]\n );\n};\n"],"mappings":";;;;;;;AACA;;AAGA;;AAEA,MAAMA,IAAI,GAAG,CACXC,KADW,EAEXC,IAFW,EAGXC,EAHW,EAIXC,EAJW,EAKXC,EALW,KAMR;EACH;;EACA,MAAMC,CAAC,GAAG,CAACL,KAAK,GAAGC,IAAT,KAAkBC,EAAE,GAAGD,IAAvB,CAAV;EACA,OAAOG,EAAE,CAACE,WAAH,CAAeH,EAAf,EAAmBE,CAAnB,CAAP;AACD,CAVD;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAME,gBAAgB,GAAG,CAC9BP,KAD8B,EAE9BQ,KAF8B,EAG9BC,WAH8B,EAI9BC,OAJ8B,KAK3B;EACH;;EACA,MAAMC,aAAa,GAAG,IAAAC,yCAAA,EAA6BF,OAA7B,CAAtB;;EACA,IAAIV,KAAK,GAAGQ,KAAK,CAAC,CAAD,CAAjB,EAAsB;IACpB,QAAQG,aAAa,CAACE,eAAtB;MACE,KAAKC,wBAAA,CAAYC,KAAjB;QACE,OAAON,WAAW,CAAC,CAAD,CAAlB;;MACF,KAAKK,wBAAA,CAAYE,MAAjB;QACE,OAAOjB,IAAI,CAACC,KAAD,EAAQQ,KAAK,CAAC,CAAD,CAAb,EAAkBA,KAAK,CAAC,CAAD,CAAvB,EAA4BC,WAAW,CAAC,CAAD,CAAvC,EAA4CA,WAAW,CAAC,CAAD,CAAvD,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AAC,GAAG,CAAL,CALF,CAAX;AAOD,CAtDM"}
@@ -7,14 +7,22 @@ exports.mixVector = exports.interpolateVector = void 0;
7
7
 
8
8
  var _interpolate = require("./interpolate");
9
9
 
10
- const interpolateVector = (value, inputRange, outputRange, options) => ({
11
- x: (0, _interpolate.interpolate)(value, inputRange, outputRange.map(v => v.x), options),
12
- y: (0, _interpolate.interpolate)(value, inputRange, outputRange.map(v => v.y), options)
13
- });
10
+ const interpolateVector = (value, inputRange, outputRange, options) => {
11
+ "worklet";
12
+
13
+ return {
14
+ x: (0, _interpolate.interpolate)(value, inputRange, outputRange.map(v => v.x), options),
15
+ y: (0, _interpolate.interpolate)(value, inputRange, outputRange.map(v => v.y), options)
16
+ };
17
+ };
14
18
 
15
19
  exports.interpolateVector = interpolateVector;
16
20
 
17
- const mixVector = (value, from, to) => interpolateVector(value, [0, 1], [from, to]);
21
+ const mixVector = (value, from, to) => {
22
+ "worklet";
23
+
24
+ return interpolateVector(value, [0, 1], [from, to]);
25
+ };
18
26
 
19
27
  exports.mixVector = mixVector;
20
28
  //# sourceMappingURL=interpolateVector.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["interpolateVector","value","inputRange","outputRange","options","x","interpolate","map","v","y","mixVector","from","to"],"sources":["interpolateVector.ts"],"sourcesContent":["import type { Vector } from \"../../skia/types\";\n\nimport { interpolate } from \"./interpolate\";\n\nexport const interpolateVector = (\n value: number,\n inputRange: readonly number[],\n outputRange: readonly Vector[],\n options?: Parameters<typeof interpolate>[3]\n) => ({\n x: interpolate(\n value,\n inputRange,\n outputRange.map((v) => v.x),\n options\n ),\n y: interpolate(\n value,\n inputRange,\n outputRange.map((v) => v.y),\n options\n ),\n});\n\nexport const mixVector = (value: number, from: Vector, to: Vector) =>\n interpolateVector(value, [0, 1], [from, to]);\n"],"mappings":";;;;;;;AAEA;;AAEO,MAAMA,iBAAiB,GAAG,CAC/BC,KAD+B,EAE/BC,UAF+B,EAG/BC,WAH+B,EAI/BC,OAJ+B,MAK3B;EACJC,CAAC,EAAE,IAAAC,wBAAA,EACDL,KADC,EAEDC,UAFC,EAGDC,WAAW,CAACI,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAACH,CAAzB,CAHC,EAIDD,OAJC,CADC;EAOJK,CAAC,EAAE,IAAAH,wBAAA,EACDL,KADC,EAEDC,UAFC,EAGDC,WAAW,CAACI,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAACC,CAAzB,CAHC,EAIDL,OAJC;AAPC,CAL2B,CAA1B;;;;AAoBA,MAAMM,SAAS,GAAG,CAACT,KAAD,EAAgBU,IAAhB,EAA8BC,EAA9B,KACvBZ,iBAAiB,CAACC,KAAD,EAAQ,CAAC,CAAD,EAAI,CAAJ,CAAR,EAAgB,CAACU,IAAD,EAAOC,EAAP,CAAhB,CADZ"}
1
+ {"version":3,"names":["interpolateVector","value","inputRange","outputRange","options","x","interpolate","map","v","y","mixVector","from","to"],"sources":["interpolateVector.ts"],"sourcesContent":["import type { Vector } from \"../../skia/types\";\n\nimport { interpolate } from \"./interpolate\";\n\nexport const interpolateVector = (\n value: number,\n inputRange: readonly number[],\n outputRange: readonly Vector[],\n options?: Parameters<typeof interpolate>[3]\n) => {\n \"worklet\";\n return {\n x: interpolate(\n value,\n inputRange,\n outputRange.map((v) => v.x),\n options\n ),\n y: interpolate(\n value,\n inputRange,\n outputRange.map((v) => v.y),\n options\n ),\n };\n};\n\nexport const mixVector = (value: number, from: Vector, to: Vector) => {\n \"worklet\";\n return interpolateVector(value, [0, 1], [from, to]);\n};\n"],"mappings":";;;;;;;AAEA;;AAEO,MAAMA,iBAAiB,GAAG,CAC/BC,KAD+B,EAE/BC,UAF+B,EAG/BC,WAH+B,EAI/BC,OAJ+B,KAK5B;EACH;;EACA,OAAO;IACLC,CAAC,EAAE,IAAAC,wBAAA,EACDL,KADC,EAEDC,UAFC,EAGDC,WAAW,CAACI,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAACH,CAAzB,CAHC,EAIDD,OAJC,CADE;IAOLK,CAAC,EAAE,IAAAH,wBAAA,EACDL,KADC,EAEDC,UAFC,EAGDC,WAAW,CAACI,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAACC,CAAzB,CAHC,EAIDL,OAJC;EAPE,CAAP;AAcD,CArBM;;;;AAuBA,MAAMM,SAAS,GAAG,CAACT,KAAD,EAAgBU,IAAhB,EAA8BC,EAA9B,KAA6C;EACpE;;EACA,OAAOZ,iBAAiB,CAACC,KAAD,EAAQ,CAAC,CAAD,EAAI,CAAJ,CAAR,EAAgB,CAACU,IAAD,EAAOC,EAAP,CAAhB,CAAxB;AACD,CAHM"}
@@ -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
  }