@shopify/react-native-skia 0.1.134 → 0.1.136

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/cpp/api/JsiSkFont.h +25 -1
  2. package/jestSetup.js +5 -0
  3. package/lib/commonjs/animation/functions/interpolate.js +3 -2
  4. package/lib/commonjs/animation/functions/interpolate.js.map +1 -1
  5. package/lib/commonjs/animation/functions/interpolateColors.js +2 -2
  6. package/lib/commonjs/animation/functions/interpolateColors.js.map +1 -1
  7. package/lib/commonjs/animation/functions/interpolatePaths.js +45 -11
  8. package/lib/commonjs/animation/functions/interpolatePaths.js.map +1 -1
  9. package/lib/commonjs/mock/index.js +121 -177
  10. package/lib/commonjs/mock/index.js.map +1 -1
  11. package/lib/commonjs/skia/types/Font/Font.js.map +1 -1
  12. package/lib/commonjs/skia/web/JsiSkFont.js +6 -0
  13. package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
  14. package/lib/commonjs/values/api.js +1 -7
  15. package/lib/commonjs/values/api.js.map +1 -1
  16. package/lib/commonjs/values/hooks/useComputedValue.js +2 -2
  17. package/lib/commonjs/values/hooks/useComputedValue.js.map +1 -1
  18. package/lib/commonjs/views/SkiaView.web.js +11 -11
  19. package/lib/commonjs/views/SkiaView.web.js.map +1 -1
  20. package/lib/module/animation/functions/interpolate.js +2 -2
  21. package/lib/module/animation/functions/interpolate.js.map +1 -1
  22. package/lib/module/animation/functions/interpolateColors.js +1 -1
  23. package/lib/module/animation/functions/interpolateColors.js.map +1 -1
  24. package/lib/module/animation/functions/interpolatePaths.js +44 -11
  25. package/lib/module/animation/functions/interpolatePaths.js.map +1 -1
  26. package/lib/module/mock/index.js +103 -147
  27. package/lib/module/mock/index.js.map +1 -1
  28. package/lib/module/skia/types/Font/Font.js.map +1 -1
  29. package/lib/module/skia/web/JsiSkFont.js +6 -0
  30. package/lib/module/skia/web/JsiSkFont.js.map +1 -1
  31. package/lib/module/values/api.js +0 -4
  32. package/lib/module/values/api.js.map +1 -1
  33. package/lib/module/values/hooks/useComputedValue.js +1 -1
  34. package/lib/module/values/hooks/useComputedValue.js.map +1 -1
  35. package/lib/module/views/SkiaView.web.js +11 -11
  36. package/lib/module/views/SkiaView.web.js.map +1 -1
  37. package/lib/typescript/jestSetup.d.ts +1 -0
  38. package/lib/typescript/src/animation/functions/interpolate.d.ts +6 -0
  39. package/lib/typescript/src/animation/functions/interpolatePaths.d.ts +3 -1
  40. package/lib/typescript/src/mock/index.d.ts +11 -42
  41. package/lib/typescript/src/renderer/Canvas.d.ts +1 -1
  42. package/lib/typescript/src/skia/types/Font/Font.d.ts +6 -0
  43. package/lib/typescript/src/skia/web/JsiSkFont.d.ts +1 -0
  44. package/lib/typescript/src/values/api.d.ts +0 -1
  45. package/package.json +3 -3
  46. package/src/animation/functions/interpolate.ts +4 -2
  47. package/src/animation/functions/interpolateColors.ts +1 -1
  48. package/src/animation/functions/interpolatePaths.ts +59 -10
  49. package/src/mock/index.ts +103 -149
  50. package/src/skia/types/Font/Font.ts +7 -0
  51. package/src/skia/web/JsiSkFont.ts +6 -0
  52. package/src/values/api.ts +0 -2
  53. package/src/values/hooks/useComputedValue.ts +1 -1
  54. package/src/views/SkiaView.web.tsx +20 -17
@@ -3,6 +3,7 @@
3
3
  #include <memory>
4
4
  #include <utility>
5
5
  #include <vector>
6
+ #include <numeric>
6
7
 
7
8
  #include <jsi/jsi.h>
8
9
  #include "JsiSkHostObjects.h"
@@ -86,6 +87,28 @@ namespace RNSkia
86
87
  return jsiWidths;
87
88
  }
88
89
 
90
+ JSI_HOST_FUNCTION(getTextWidth) {
91
+ auto str = arguments[0].asString(runtime).utf8(runtime);
92
+ auto numGlyphIDs = str.length();
93
+ std::vector<SkGlyphID> glyphs;
94
+ glyphs.resize(numGlyphIDs);
95
+ int glyphsSize = static_cast<int>(numGlyphIDs);
96
+ getObject()->textToGlyphs(str.c_str(), str.length(), SkTextEncoding::kUTF8,
97
+ static_cast<SkGlyphID *>(glyphs.data()), glyphsSize);
98
+ std::vector<SkScalar> widthPtrs;
99
+ widthPtrs.resize(numGlyphIDs);
100
+ if (count > 1)
101
+ {
102
+ auto paint = JsiSkPaint::fromValue(runtime, arguments[1]);
103
+ getObject()->getWidthsBounds(glyphs.data(), glyphsSize, static_cast<SkScalar *>(widthPtrs.data()), nullptr, paint.get());
104
+ }
105
+ else
106
+ {
107
+ getObject()->getWidthsBounds(glyphs.data(), glyphsSize, static_cast<SkScalar *>(widthPtrs.data()), nullptr, nullptr);
108
+ }
109
+ return jsi::Value(std::accumulate(widthPtrs.begin(), widthPtrs.end(), 0));
110
+ }
111
+
89
112
  JSI_HOST_FUNCTION(getMetrics)
90
113
  {
91
114
  SkFontMetrics fm;
@@ -273,7 +296,8 @@ namespace RNSkia
273
296
  JSI_EXPORT_FUNC(JsiSkFont, setEmbolden),
274
297
  JSI_EXPORT_FUNC(JsiSkFont, setSubpixel),
275
298
  JSI_EXPORT_FUNC(JsiSkFont, setTypeface),
276
- JSI_EXPORT_FUNC(JsiSkFont, getGlyphWidths))
299
+ JSI_EXPORT_FUNC(JsiSkFont, getGlyphWidths),
300
+ JSI_EXPORT_FUNC(JsiSkFont, getTextWidth))
277
301
 
278
302
  JsiSkFont(std::shared_ptr<RNSkPlatformContext> context, const SkFont &font)
279
303
  : JsiSkWrappingSharedPtrHostObject(std::move(context),
package/jestSetup.js ADDED
@@ -0,0 +1,5 @@
1
+ /* globals jest */
2
+ jest.mock(
3
+ "@shopify/react-native-skia",
4
+ () => require("@shopify/react-native-skia/lib/commonjs/mock").Mock
5
+ );
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Extrapolate = void 0;
7
7
  exports.interpolate = interpolate;
8
+ exports.validateInterpolationOptions = validateInterpolationOptions;
8
9
 
9
10
  /* eslint-disable max-len */
10
11
  let Extrapolate;
@@ -40,7 +41,7 @@ function isExtrapolate(value) {
40
41
  // if type is correct, converts it to ExtrapolationConfig
41
42
 
42
43
 
43
- function validateType(type) {
44
+ function validateInterpolationOptions(type) {
44
45
  // initialize extrapolationConfig with default extrapolation
45
46
  const extrapolationConfig = {
46
47
  extrapolateLeft: Extrapolate.EXTEND,
@@ -106,7 +107,7 @@ function interpolate(x, input, output, type) {
106
107
  throw Error("Interpolation input and output should contain at least two values.");
107
108
  }
108
109
 
109
- const extrapolationConfig = validateType(type);
110
+ const extrapolationConfig = validateInterpolationOptions(type);
110
111
  const {
111
112
  length
112
113
  } = input;
@@ -1 +1 @@
1
- {"version":3,"sources":["interpolate.ts"],"names":["Extrapolate","getVal","type","coef","val","leftEdgeOutput","rightEdgeOutput","x","IDENTITY","CLAMP","EXTEND","isExtrapolate","value","validateType","extrapolationConfig","extrapolateLeft","extrapolateRight","Error","Object","assign","internalInterpolate","narrowedInput","leftEdgeInput","rightEdgeInput","progress","interpolate","input","output","length","i"],"mappings":";;;;;;;;AAAA;IACYA,W;;;WAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,2BAAAA,W;;AA6BZ,SAASC,MAAT,CACEC,IADF,EAEEC,IAFF,EAGEC,GAHF,EAIEC,cAJF,EAKEC,eALF,EAMEC,CANF,EAOU;AACR,UAAQL,IAAR;AACE,SAAKF,WAAW,CAACQ,QAAjB;AACE,aAAOD,CAAP;;AACF,SAAKP,WAAW,CAACS,KAAjB;AACE,UAAIN,IAAI,GAAGC,GAAP,GAAaD,IAAI,GAAGE,cAAxB,EAAwC;AACtC,eAAOA,cAAP;AACD;;AACD,aAAOC,eAAP;;AACF,SAAKN,WAAW,CAACU,MAAjB;AACA;AACE,aAAON,GAAP;AAVJ;AAYD;;AAED,SAASO,aAAT,CAAuBC,KAAvB,EAA4D;AAC1D,SACEA,KAAK,KAAKZ,WAAW,CAACU,MAAtB,IACAE,KAAK,KAAKZ,WAAW,CAACS,KADtB,IAEAG,KAAK,KAAKZ,WAAW,CAACQ,QAHxB;AAKD,C,CAED;AAC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AAAA,aAAa,CAACC,aAAd,GAA8BI,KAAK,CAACE,MAAM,GAAG,CAAV,CAAnC;AACAP,MAAAA,aAAa,CAACE,cAAd,GAA+BG,KAAK,CAACE,MAAM,GAAG,CAAV,CAApC;AACAP,MAAAA,aAAa,CAAChB,cAAd,GAA+BsB,MAAM,CAACC,MAAM,GAAG,CAAV,CAArC;AACAP,MAAAA,aAAa,CAACf,eAAd,GAAgCqB,MAAM,CAACC,MAAM,GAAG,CAAV,CAAtC;AACD,KALD,MAKO;AACL,WAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,MAApB,EAA4B,EAAEC,CAA9B,EAAiC;AAC/B,YAAItB,CAAC,IAAImB,KAAK,CAACG,CAAD,CAAd,EAAmB;AACjBR,UAAAA,aAAa,CAACC,aAAd,GAA8BI,KAAK,CAACG,CAAC,GAAG,CAAL,CAAnC;AACAR,UAAAA,aAAa,CAACE,cAAd,GAA+BG,KAAK,CAACG,CAAD,CAApC;AACAR,UAAAA,aAAa,CAAChB,cAAd,GAA+BsB,MAAM,CAACE,CAAC,GAAG,CAAL,CAArC;AACAR,UAAAA,aAAa,CAACf,eAAd,GAAgCqB,MAAM,CAACE,CAAD,CAAtC;AACA;AACD;AACF;AACF;AACF;;AAED,SAAOT,mBAAmB,CAACb,CAAD,EAAIc,aAAJ,EAAmBP,mBAAnB,CAA1B;AACD","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\nfunction validateType(type: ExtrapolationType): 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 = validateType(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"]}
1
+ {"version":3,"sources":["interpolate.ts"],"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"],"mappings":";;;;;;;;;AAAA;IACYA,W;;;WAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,2BAAAA,W;;AA6BZ,SAASC,MAAT,CACEC,IADF,EAEEC,IAFF,EAGEC,GAHF,EAIEC,cAJF,EAKEC,eALF,EAMEC,CANF,EAOU;AACR,UAAQL,IAAR;AACE,SAAKF,WAAW,CAACQ,QAAjB;AACE,aAAOD,CAAP;;AACF,SAAKP,WAAW,CAACS,KAAjB;AACE,UAAIN,IAAI,GAAGC,GAAP,GAAaD,IAAI,GAAGE,cAAxB,EAAwC;AACtC,eAAOA,cAAP;AACD;;AACD,aAAOC,eAAP;;AACF,SAAKN,WAAW,CAACU,MAAjB;AACA;AACE,aAAON,GAAP;AAVJ;AAYD;;AAED,SAASO,aAAT,CAAuBC,KAAvB,EAA4D;AAC1D,SACEA,KAAK,KAAKZ,WAAW,CAACU,MAAtB,IACAE,KAAK,KAAKZ,WAAW,CAACS,KADtB,IAEAG,KAAK,KAAKZ,WAAW,CAACQ,QAHxB;AAKD,C,CAED;AACA;;;AACO,SAASK,4BAAT,CACLX,IADK,EAEwB;AAC7B;AACA,QAAMY,mBAAgD,GAAG;AACvDC,IAAAA,eAAe,EAAEf,WAAW,CAACU,MAD0B;AAEvDM,IAAAA,gBAAgB,EAAEhB,WAAW,CAACU;AAFyB,GAAzD;;AAKA,MAAI,CAACR,IAAL,EAAW;AACT,WAAOY,mBAAP;AACD;;AAED,MAAI,OAAOZ,IAAP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qB,MAAM,CAACC,MAAM,GAAG,CAAV,CAAtC;AACD,KALD,MAKO;AACL,WAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,MAApB,EAA4B,EAAEC,CAA9B,EAAiC;AAC/B,YAAItB,CAAC,IAAImB,KAAK,CAACG,CAAD,CAAd,EAAmB;AACjBR,UAAAA,aAAa,CAACC,aAAd,GAA8BI,KAAK,CAACG,CAAC,GAAG,CAAL,CAAnC;AACAR,UAAAA,aAAa,CAACE,cAAd,GAA+BG,KAAK,CAACG,CAAD,CAApC;AACAR,UAAAA,aAAa,CAAChB,cAAd,GAA+BsB,MAAM,CAACE,CAAC,GAAG,CAAL,CAArC;AACAR,UAAAA,aAAa,CAACf,eAAd,GAAgCqB,MAAM,CAACE,CAAD,CAAtC;AACA;AACD;AACF;AACF;AACF;;AAED,SAAOT,mBAAmB,CAACb,CAAD,EAAIc,aAAJ,EAAmBP,mBAAnB,CAA1B;AACD","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"]}
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.mixColors = exports.interpolateColors = void 0;
7
7
 
8
- var _renderer = require("../../renderer");
8
+ var _math = require("../../renderer/processors/math");
9
9
 
10
10
  var _skia = require("../../skia");
11
11
 
@@ -32,7 +32,7 @@ const mixColors = (value, x, y) => {
32
32
 
33
33
  const c2 = _skia.Skia.Color(y);
34
34
 
35
- return new Float32Array([(0, _renderer.mix)(value, c1[0], c2[0]), (0, _renderer.mix)(value, c1[1], c2[1]), (0, _renderer.mix)(value, c1[2], c2[2]), (0, _renderer.mix)(value, c1[3], c2[3])]);
35
+ return new Float32Array([(0, _math.mix)(value, c1[0], c2[0]), (0, _math.mix)(value, c1[1], c2[1]), (0, _math.mix)(value, c1[2], c2[2]), (0, _math.mix)(value, c1[3], c2[3])]);
36
36
  };
37
37
 
38
38
  exports.mixColors = mixColors;
@@ -1 +1 @@
1
- {"version":3,"sources":["interpolateColors.ts"],"names":["interpolateColorsRGB","value","inputRange","outputRange","r","map","c","g","b","a","Float32Array","interpolateColors","_outputRange","cl","Skia","Color","mixColors","x","y","c1","c2"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;AAEA,MAAMA,oBAAoB,GAAG,CAC3BC,KAD2B,EAE3BC,UAF2B,EAG3BC,WAH2B,KAIxB;AACH,QAAMC,CAAC,GAAG,8BACRH,KADQ,EAERC,UAFQ,EAGRC,WAAW,CAACE,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAAC,CAAD,CAAxB,CAHQ,EAIR,OAJQ,CAAV;AAMA,QAAMC,CAAC,GAAG,8BACRN,KADQ,EAERC,UAFQ,EAGRC,WAAW,CAACE,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAAC,CAAD,CAAxB,CAHQ,EAIR,OAJQ,CAAV;AAMA,QAAME,CAAC,GAAG,8BACRP,KADQ,EAERC,UAFQ,EAGRC,WAAW,CAACE,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAAC,CAAD,CAAxB,CAHQ,EAIR,OAJQ,CAAV;AAMA,QAAMG,CAAC,GAAG,8BACRR,KADQ,EAERC,UAFQ,EAGRC,WAAW,CAACE,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAAC,CAAD,CAAxB,CAHQ,EAIR,OAJQ,CAAV;AAMA,SAAO,IAAII,YAAJ,CAAiB,CAACN,CAAD,EAAIG,CAAJ,EAAOC,CAAP,EAAUC,CAAV,CAAjB,CAAP;AACD,CA9BD;;AAgCO,MAAME,iBAAiB,GAAG,CAC/BV,KAD+B,EAE/BC,UAF+B,EAG/BU,YAH+B,KAI5B;AACH,QAAMT,WAAW,GAAGS,YAAY,CAACP,GAAb,CAAkBQ,EAAD,IAAQC,WAAKC,KAAL,CAAWF,EAAX,CAAzB,CAApB;;AACA,SAAOb,oBAAoB,CAACC,KAAD,EAAQC,UAAR,EAAoBC,WAApB,CAA3B;AACD,CAPM;;;;AASA,MAAMa,SAAS,GAAG,CAACf,KAAD,EAAgBgB,CAAhB,EAA0BC,CAA1B,KAAuC;AAC9D,QAAMC,EAAE,GAAGL,WAAKC,KAAL,CAAWE,CAAX,CAAX;;AACA,QAAMG,EAAE,GAAGN,WAAKC,KAAL,CAAWG,CAAX,CAAX;;AACA,SAAO,IAAIR,YAAJ,CAAiB,CACtB,mBAAIT,KAAJ,EAAWkB,EAAE,CAAC,CAAD,CAAb,EAAkBC,EAAE,CAAC,CAAD,CAApB,CADsB,EAEtB,mBAAInB,KAAJ,EAAWkB,EAAE,CAAC,CAAD,CAAb,EAAkBC,EAAE,CAAC,CAAD,CAApB,CAFsB,EAGtB,mBAAInB,KAAJ,EAAWkB,EAAE,CAAC,CAAD,CAAb,EAAkBC,EAAE,CAAC,CAAD,CAApB,CAHsB,EAItB,mBAAInB,KAAJ,EAAWkB,EAAE,CAAC,CAAD,CAAb,EAAkBC,EAAE,CAAC,CAAD,CAApB,CAJsB,CAAjB,CAAP;AAMD,CATM","sourcesContent":["import { mix } from \"../../renderer\";\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"]}
1
+ {"version":3,"sources":["interpolateColors.ts"],"names":["interpolateColorsRGB","value","inputRange","outputRange","r","map","c","g","b","a","Float32Array","interpolateColors","_outputRange","cl","Skia","Color","mixColors","x","y","c1","c2"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;AAEA,MAAMA,oBAAoB,GAAG,CAC3BC,KAD2B,EAE3BC,UAF2B,EAG3BC,WAH2B,KAIxB;AACH,QAAMC,CAAC,GAAG,8BACRH,KADQ,EAERC,UAFQ,EAGRC,WAAW,CAACE,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAAC,CAAD,CAAxB,CAHQ,EAIR,OAJQ,CAAV;AAMA,QAAMC,CAAC,GAAG,8BACRN,KADQ,EAERC,UAFQ,EAGRC,WAAW,CAACE,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAAC,CAAD,CAAxB,CAHQ,EAIR,OAJQ,CAAV;AAMA,QAAME,CAAC,GAAG,8BACRP,KADQ,EAERC,UAFQ,EAGRC,WAAW,CAACE,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAAC,CAAD,CAAxB,CAHQ,E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../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"]}
@@ -5,11 +5,20 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.interpolatePaths = void 0;
7
7
 
8
+ var _typeddash = require("../../renderer/typeddash");
9
+
10
+ var _interpolate = require("./interpolate");
11
+
12
+ const lerp = (value, from, to, p1, p2) => {
13
+ const t = (value - from) / (to - from);
14
+ return p2.interpolate(p1, t);
15
+ };
8
16
  /**
9
17
  * Maps an input value within a range to an output path within a path range.
10
18
  * @param value - The input value.
11
19
  * @param inputRange - The range of the input value.
12
20
  * @param outputRange - The range of the output path.
21
+ * @param options - Extrapolation options
13
22
  * @returns The output path.
14
23
  * @example <caption>Map a value between 0 and 1 to a path between two paths.</caption>
15
24
  * const path1 = new Path();
@@ -20,25 +29,50 @@ exports.interpolatePaths = void 0;
20
29
  * path2.lineTo(0, 100);
21
30
  * const path = interpolatePath(0.5, [0, 1], [path1, path2]);
22
31
  */
23
- const interpolatePaths = (value, input, outputRange) => {
32
+
33
+
34
+ const interpolatePaths = (value, input, outputRange, options) => {
35
+ const extrapolation = (0, _interpolate.validateInterpolationOptions)(options);
36
+
37
+ if (value < input[0]) {
38
+ switch (extrapolation.extrapolateLeft) {
39
+ case _interpolate.Extrapolate.CLAMP:
40
+ return outputRange[0];
41
+
42
+ case _interpolate.Extrapolate.EXTEND:
43
+ return lerp(value, input[0], input[1], outputRange[0], outputRange[1]);
44
+
45
+ case _interpolate.Extrapolate.IDENTITY:
46
+ throw new Error("Identity is not a supported extrapolation type for interpolatePaths()");
47
+
48
+ default:
49
+ (0, _typeddash.exhaustiveCheck)(extrapolation.extrapolateLeft);
50
+ }
51
+ } else if (value > input[input.length - 1]) {
52
+ switch (extrapolation.extrapolateRight) {
53
+ case _interpolate.Extrapolate.CLAMP:
54
+ return outputRange[outputRange.length - 1];
55
+
56
+ case _interpolate.Extrapolate.EXTEND:
57
+ return lerp(value, input[input.length - 2], input[input.length - 1], outputRange[input.length - 2], outputRange[input.length - 1]);
58
+
59
+ case _interpolate.Extrapolate.IDENTITY:
60
+ throw new Error("Identity is not a supported extrapolation type for interpolatePaths()");
61
+
62
+ default:
63
+ (0, _typeddash.exhaustiveCheck)(extrapolation.extrapolateRight);
64
+ }
65
+ }
66
+
24
67
  let i = 0;
25
68
 
26
69
  for (; i <= input.length - 1; i++) {
27
70
  if (value >= input[i] && value <= input[i + 1]) {
28
71
  break;
29
72
  }
30
-
31
- if (i === input.length - 1) {
32
- if (value < input[0]) {
33
- return outputRange[0];
34
- } else {
35
- return outputRange[i];
36
- }
37
- }
38
73
  }
39
74
 
40
- const t = (value - input[i]) / (input[i + 1] - input[i]);
41
- return outputRange[i + 1].interpolate(outputRange[i], t);
75
+ return lerp(value, input[i], input[i + 1], outputRange[i], outputRange[i + 1]);
42
76
  };
43
77
 
44
78
  exports.interpolatePaths = interpolatePaths;
@@ -1 +1 @@
1
- {"version":3,"sources":["interpolatePaths.ts"],"names":["interpolatePaths","value","input","outputRange","i","length","t","interpolate"],"mappings":";;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,gBAAgB,GAAG,CAC9BC,KAD8B,EAE9BC,KAF8B,EAG9BC,WAH8B,KAI3B;AACH,MAAIC,CAAC,GAAG,CAAR;;AACA,SAAOA,CAAC,IAAIF,KAAK,CAACG,MAAN,GAAe,CAA3B,EAA8BD,CAAC,EAA/B,EAAmC;AACjC,QAAIH,KAAK,IAAIC,KAAK,CAACE,CAAD,CAAd,IAAqBH,KAAK,IAAIC,KAAK,CAACE,CAAC,GAAG,CAAL,CAAvC,EAAgD;AAC9C;AACD;;AACD,QAAIA,CAAC,KAAKF,KAAK,CAACG,MAAN,GAAe,CAAzB,EAA4B;AAC1B,UAAIJ,KAAK,GAAGC,KAAK,CAAC,CAAD,CAAjB,EAAsB;AACpB,eAAOC,WAAW,CAAC,CAAD,CAAlB;AACD,OAFD,MAEO;AACL,eAAOA,WAAW,CAACC,CAAD,CAAlB;AACD;AACF;AACF;;AACD,QAAME,CAAC,GAAG,CAACL,KAAK,GAAGC,KAAK,CAACE,CAAD,CAAd,KAAsBF,KAAK,CAACE,CAAC,GAAG,CAAL,CAAL,GAAeF,KAAK,CAACE,CAAD,CAA1C,CAAV;AACA,SAAOD,WAAW,CAACC,CAAC,GAAG,CAAL,CAAX,CAAmBG,WAAnB,CAA+BJ,WAAW,CAACC,CAAD,CAA1C,EAA+CE,CAA/C,CAAP;AACD,CApBM","sourcesContent":["import type { SkPath } from \"../../skia/types\";\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 * @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) => {\n let i = 0;\n for (; i <= input.length - 1; i++) {\n if (value >= input[i] && value <= input[i + 1]) {\n break;\n }\n if (i === input.length - 1) {\n if (value < input[0]) {\n return outputRange[0];\n } else {\n return outputRange[i];\n }\n }\n }\n const t = (value - input[i]) / (input[i + 1] - input[i]);\n return outputRange[i + 1].interpolate(outputRange[i], t)!;\n};\n"]}
1
+ {"version":3,"sources":["interpolatePaths.ts"],"names":["lerp","value","from","to","p1","p2","t","interpolate","interpolatePaths","input","outputRange","options","extrapolation","extrapolateLeft","Extrapolate","CLAMP","EXTEND","IDENTITY","Error","length","extrapolateRight","i"],"mappings":";;;;;;;AACA;;AAGA;;AAEA,MAAMA,IAAI,GAAG,CACXC,KADW,EAEXC,IAFW,EAGXC,EAHW,EAIXC,EAJW,EAKXC,EALW,KAMR;AACH,QAAMC,CAAC,GAAG,CAACL,KAAK,GAAGC,IAAT,KAAkBC,EAAE,GAAGD,IAAvB,CAAV;AACA,SAAOG,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;AACH,QAAMC,aAAa,GAAG,+CAA6BD,OAA7B,CAAtB;;AACA,MAAIV,KAAK,GAAGQ,KAAK,CAAC,CAAD,CAAjB,EAAsB;AACpB,YAAQG,aAAa,CAACC,eAAtB;AACE,WAAKC,yBAAYC,KAAjB;AACE,eAAOL,WAAW,CAAC,CAAD,CAAlB;;AACF,WAAKI,yBAAYE,MAAjB;AACE,eAAOhB,IAAI,CAACC,KAAD,EAAQQ,K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,CAACY,CAAC,GAAG,CAAL,CAHI,EAITX,WAAW,CAACW,CAAD,CAJF,EAKTX,WAAW,CAACW,CAAC,GAAG,CAAL,CALF,CAAX;AAOD,CArDM","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"]}
@@ -3,188 +3,132 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.vec = exports.useValueEffect = exports.useValue = exports.useTypeface = exports.useTouchHandler = exports.useTiming = exports.useSpring = exports.useSharedValueEffect = exports.useSVG = exports.usePicture = exports.useImage = exports.useFont = exports.useDataCollection = exports.useData = exports.useComputedValue = exports.useClockValue = exports.timing = exports.spring = exports.runTiming = exports.runSpring = exports.runDecay = exports.rrect = exports.rect = exports.decay = exports.Skia = void 0;
7
-
8
- /**
9
- * Mock implementation for test runners.
10
- *
11
- * Example:
12
- *
13
- * ```js
14
- * jest.mock('@shopify/react-native-skia', () => require('@shopify/react-native-skia/lib/commonjs/mock'));
15
- * ```
16
- */
17
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
- const MockJSIInstance = {};
19
-
20
- const Noop = () => MockJSIInstance;
21
-
22
- const Skia = {
23
- Point: Noop,
24
- XYWHRect: Noop,
25
- RuntimeShaderBuilder: Noop,
26
- RRectXY: Noop,
27
- RSXform: Noop,
28
- Color: Noop,
29
- ContourMeasureIter: Noop,
30
- Paint: Noop,
31
- PictureRecorder: Noop,
32
- Picture: {
33
- MakePicture: Noop
34
- },
35
- Path: {
36
- Make: Noop,
37
- MakeFromSVGString: Noop,
38
- MakeFromOp: Noop,
39
- MakeFromCmds: Noop,
40
- MakeFromText: Noop
41
- },
42
- Matrix: Noop,
43
- ColorFilter: {
44
- MakeMatrix: Noop,
45
- MakeBlend: Noop,
46
- MakeCompose: Noop,
47
- MakeLerp: Noop,
48
- MakeLinearToSRGBGamma: Noop,
49
- MakeSRGBToLinearGamma: Noop,
50
- MakeLumaColorFilter: Noop
51
- },
52
- Font: Noop,
53
- Typeface: {
54
- MakeFreeTypeFaceFromData: Noop
55
- },
56
- MaskFilter: {
57
- MakeBlur: Noop
58
- },
59
- RuntimeEffect: {
60
- Make: Noop
61
- },
62
- ImageFilter: {
63
- MakeOffset: Noop,
64
- MakeDisplacementMap: Noop,
65
- MakeShader: Noop,
66
- MakeBlur: Noop,
67
- MakeColorFilter: Noop,
68
- MakeCompose: Noop,
69
- MakeDropShadow: Noop,
70
- MakeDropShadowOnly: Noop,
71
- MakeErode: Noop,
72
- MakeDilate: Noop,
73
- MakeBlend: Noop,
74
- MakeRuntimeShader: Noop
75
- },
76
- Shader: {
77
- MakeLinearGradient: Noop,
78
- MakeRadialGradient: Noop,
79
- MakeTwoPointConicalGradient: Noop,
80
- MakeSweepGradient: Noop,
81
- MakeTurbulence: Noop,
82
- MakeFractalNoise: Noop,
83
- MakeBlend: Noop,
84
- MakeColor: Noop
85
- },
86
- PathEffect: {
87
- MakeCorner: Noop,
88
- MakeDash: Noop,
89
- MakeDiscrete: Noop,
90
- MakeCompose: Noop,
91
- MakeSum: Noop,
92
- MakeLine2D: Noop,
93
- MakePath1D: Noop,
94
- MakePath2D: Noop
95
- },
96
- MakeVertices: Noop,
97
- Data: {
98
- fromURI: Noop,
99
- fromBytes: Noop,
100
- fromBase64: Noop
101
- },
102
- Image: {
103
- MakeImageFromEncoded: Noop,
104
- MakeImage: Noop
105
- },
106
- SVG: {
107
- MakeFromData: Noop,
108
- MakeFromString: Noop
109
- },
110
- FontMgr: {
111
- RefDefault: Noop
112
- },
113
- TextBlob: {
114
- MakeFromText: Noop,
115
- MakeFromGlyphs: Noop,
116
- MakeFromRSXform: Noop,
117
- MakeFromRSXformGlyphs: Noop
118
- },
119
- Surface: {
120
- Make: Noop
6
+ exports.vec = exports.Skia = exports.Mock = void 0;
7
+
8
+ var Values = _interopRequireWildcard(require("../values/web"));
9
+
10
+ var ValuesHooks = _interopRequireWildcard(require("../values/hooks"));
11
+
12
+ var BaseSkia = _interopRequireWildcard(require("../skia/types"));
13
+
14
+ var _useSharedValueEffect = require("../external/reanimated/useSharedValueEffect");
15
+
16
+ var timingFunctions = _interopRequireWildcard(require("../animation/timing"));
17
+
18
+ var springFunctions = _interopRequireWildcard(require("../animation/spring"));
19
+
20
+ var decayFunctions = _interopRequireWildcard(require("../animation/decay"));
21
+
22
+ var interpolateFn = _interopRequireWildcard(require("../animation/functions/interpolate"));
23
+
24
+ var interpolatePathFn = _interopRequireWildcard(require("../animation/functions/interpolatePaths"));
25
+
26
+ var interpolateVectorFn = _interopRequireWildcard(require("../animation/functions/interpolateVector"));
27
+
28
+ var _ShaderLib = require("../renderer/components/shaders/ShaderLib");
29
+
30
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
31
+
32
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
33
+
34
+ /* eslint-disable @typescript-eslint/no-explicit-any */
35
+ class Stub {
36
+ constructor() {
37
+ return new Proxy(() => {}, {
38
+ get: () => new Stub(),
39
+ apply: () => new Stub(),
40
+ set: () => true
41
+ });
121
42
  }
122
- };
123
- exports.Skia = Skia;
124
43
 
125
- const vec = (x, y) => ({
126
- x,
127
- y
128
- });
44
+ }
129
45
 
130
- exports.vec = vec;
46
+ const Noop = () => {};
131
47
 
132
- const rect = (x, y, width, height) => ({
133
- x,
134
- y,
135
- width,
136
- height
137
- });
48
+ const Skia = new Stub();
49
+ exports.Skia = Skia;
138
50
 
139
- exports.rect = rect;
51
+ const vec = (x, y) => {
52
+ var _ref;
140
53
 
141
- const rrect = (r, rx, ry) => ({
142
- rect: r,
143
- rx,
144
- ry
145
- });
54
+ return {
55
+ x: x !== null && x !== void 0 ? x : 0,
56
+ y: (_ref = y !== null && y !== void 0 ? y : x) !== null && _ref !== void 0 ? _ref : 0
57
+ };
58
+ };
146
59
 
147
- exports.rrect = rrect;
148
- const useTouchHandler = Noop;
149
- exports.useTouchHandler = useTouchHandler;
150
- const useComputedValue = Noop;
151
- exports.useComputedValue = useComputedValue;
152
- const useValue = Noop;
153
- exports.useValue = useValue;
154
- const useClockValue = Noop;
155
- exports.useClockValue = useClockValue;
156
- const useValueEffect = Noop;
157
- exports.useValueEffect = useValueEffect;
158
- const useTiming = Noop;
159
- exports.useTiming = useTiming;
160
- const runTiming = Noop;
161
- exports.runTiming = runTiming;
162
- const timing = Noop;
163
- exports.timing = timing;
164
- const useSpring = Noop;
165
- exports.useSpring = useSpring;
166
- const runSpring = Noop;
167
- exports.runSpring = runSpring;
168
- const spring = Noop;
169
- exports.spring = spring;
170
- const runDecay = Noop;
171
- exports.runDecay = runDecay;
172
- const decay = Noop;
173
- exports.decay = decay;
174
- const useSharedValueEffect = Noop;
175
- exports.useSharedValueEffect = useSharedValueEffect;
176
- const useData = Noop;
177
- exports.useData = useData;
178
- const useDataCollection = Noop;
179
- exports.useDataCollection = useDataCollection;
180
- const useFont = Noop;
181
- exports.useFont = useFont;
182
- const useImage = Noop;
183
- exports.useImage = useImage;
184
- const usePicture = Noop;
185
- exports.usePicture = usePicture;
186
- const useSVG = Noop;
187
- exports.useSVG = useSVG;
188
- const useTypeface = Noop;
189
- exports.useTypeface = useTypeface;
60
+ exports.vec = vec;
61
+ const Mock = {
62
+ // SkiaExports
63
+ // 1. Skia API. BaseSkia contains the enums, and functions like isPaint etc
64
+ Skia,
65
+ ...BaseSkia,
66
+ // 2. Hooks
67
+ useDataCollection: Noop,
68
+ useRawData: Noop,
69
+ useData: Noop,
70
+ useFont: Noop,
71
+ useTypeface: Noop,
72
+ useImage: Noop,
73
+ usePath: Noop,
74
+ useSVG: Noop,
75
+ useTextPath: Noop,
76
+ usePaint: Noop,
77
+ usePicture: Noop,
78
+ useSvgPath: Noop,
79
+ // 3. Point/Rect/Transform utilities
80
+ vec,
81
+ rect: (x, y, width, height) => ({
82
+ x,
83
+ y,
84
+ width,
85
+ height
86
+ }),
87
+ rrect: (r, rx, ry) => ({
88
+ rect: r,
89
+ rx,
90
+ ry
91
+ }),
92
+ point: vec,
93
+ add: (a, b) => vec(a.x + b.x, a.y + b.y),
94
+ sub: (a, b) => vec(a.x - b.x, a.y - b.y),
95
+ neg: a => vec(-a.x, -a.y),
96
+ dist: (a, b) => Math.hypot(a.x - b.x, a.y - b.y),
97
+ translate: _ref2 => {
98
+ let {
99
+ x,
100
+ y
101
+ } = _ref2;
102
+ return [{
103
+ translateX: x
104
+ }, {
105
+ translateY: y
106
+ }];
107
+ },
108
+ bounds: Noop,
109
+ topLeft: Noop,
110
+ topRight: Noop,
111
+ bottomLeft: Noop,
112
+ bottomRight: Noop,
113
+ center: Noop,
114
+ processTransform2d: Noop,
115
+ // ExternalExports
116
+ useSharedValueEffect: _useSharedValueEffect.useSharedValueEffect,
117
+ // ValueExports
118
+ ...Values,
119
+ ...ValuesHooks,
120
+ // Animations
121
+ ...timingFunctions,
122
+ ...springFunctions,
123
+ ...decayFunctions,
124
+ ...interpolateFn,
125
+ ...interpolatePathFn,
126
+ ...interpolateVectorFn,
127
+ interpolateColors: (_value, _inputRange, _outputRange) => Float32Array.of(0, 0, 0, 0),
128
+ mixColors: (_v, _x, _y) => Float32Array.of(0, 0, 0, 0),
129
+ ShaderLib: _ShaderLib.ShaderLib,
130
+ createDrawing: Noop,
131
+ createDeclaration: Noop
132
+ };
133
+ exports.Mock = Mock;
190
134
  //# sourceMappingURL=index.js.map