@shopify/react-native-skia 0.1.210 → 0.1.212

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. package/cpp/api/JsiSkAnimatedImage.h +60 -0
  2. package/cpp/api/JsiSkAnimatedImageFactory.h +39 -0
  3. package/cpp/api/JsiSkApi.h +4 -0
  4. package/cpp/api/JsiSkImage.h +15 -23
  5. package/cpp/api/JsiSkPath.h +66 -22
  6. package/cpp/skia/src/core/SkPathPriv.h +540 -0
  7. package/lib/commonjs/external/reanimated/moduleWrapper.d.ts +2 -0
  8. package/lib/commonjs/external/reanimated/moduleWrapper.js +11 -11
  9. package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
  10. package/lib/commonjs/skia/core/AnimatedImage.d.ts +6 -0
  11. package/lib/commonjs/skia/core/AnimatedImage.js +65 -0
  12. package/lib/commonjs/skia/core/AnimatedImage.js.map +1 -0
  13. package/lib/commonjs/skia/core/Font.js +7 -6
  14. package/lib/commonjs/skia/core/Font.js.map +1 -1
  15. package/lib/commonjs/skia/core/index.d.ts +1 -0
  16. package/lib/commonjs/skia/core/index.js +13 -0
  17. package/lib/commonjs/skia/core/index.js.map +1 -1
  18. package/lib/commonjs/skia/types/AnimatedImage/AnimatedImage.d.ts +24 -0
  19. package/lib/commonjs/skia/types/AnimatedImage/AnimatedImage.js +6 -0
  20. package/lib/commonjs/skia/types/AnimatedImage/AnimatedImage.js.map +1 -0
  21. package/lib/commonjs/skia/types/AnimatedImage/AnimatedImageFactory.d.ts +13 -0
  22. package/lib/commonjs/skia/types/AnimatedImage/AnimatedImageFactory.js +6 -0
  23. package/lib/commonjs/skia/types/AnimatedImage/AnimatedImageFactory.js.map +1 -0
  24. package/lib/commonjs/skia/types/AnimatedImage/index.d.ts +2 -0
  25. package/lib/commonjs/skia/types/AnimatedImage/index.js +32 -0
  26. package/lib/commonjs/skia/types/AnimatedImage/index.js.map +1 -0
  27. package/lib/commonjs/skia/types/Skia.d.ts +2 -0
  28. package/lib/commonjs/skia/types/Skia.js.map +1 -1
  29. package/lib/commonjs/skia/types/index.d.ts +1 -0
  30. package/lib/commonjs/skia/types/index.js +13 -0
  31. package/lib/commonjs/skia/types/index.js.map +1 -1
  32. package/lib/commonjs/skia/web/JsiSkAnimatedImage.d.ts +11 -0
  33. package/lib/commonjs/skia/web/JsiSkAnimatedImage.js +44 -0
  34. package/lib/commonjs/skia/web/JsiSkAnimatedImage.js.map +1 -0
  35. package/lib/commonjs/skia/web/JsiSkAnimatedImageFactory.d.ts +9 -0
  36. package/lib/commonjs/skia/web/JsiSkAnimatedImageFactory.js +32 -0
  37. package/lib/commonjs/skia/web/JsiSkAnimatedImageFactory.js.map +1 -0
  38. package/lib/commonjs/skia/web/JsiSkia.js +3 -0
  39. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
  40. package/lib/module/external/reanimated/moduleWrapper.d.ts +2 -0
  41. package/lib/module/external/reanimated/moduleWrapper.js +8 -11
  42. package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
  43. package/lib/module/skia/core/AnimatedImage.d.ts +6 -0
  44. package/lib/module/skia/core/AnimatedImage.js +49 -0
  45. package/lib/module/skia/core/AnimatedImage.js.map +1 -0
  46. package/lib/module/skia/core/Font.js +6 -5
  47. package/lib/module/skia/core/Font.js.map +1 -1
  48. package/lib/module/skia/core/index.d.ts +1 -0
  49. package/lib/module/skia/core/index.js +1 -0
  50. package/lib/module/skia/core/index.js.map +1 -1
  51. package/lib/module/skia/types/AnimatedImage/AnimatedImage.d.ts +24 -0
  52. package/lib/module/skia/types/AnimatedImage/AnimatedImage.js +2 -0
  53. package/lib/module/skia/types/AnimatedImage/AnimatedImage.js.map +1 -0
  54. package/lib/module/skia/types/AnimatedImage/AnimatedImageFactory.d.ts +13 -0
  55. package/lib/module/skia/types/AnimatedImage/AnimatedImageFactory.js +2 -0
  56. package/lib/module/skia/types/AnimatedImage/AnimatedImageFactory.js.map +1 -0
  57. package/lib/module/skia/types/AnimatedImage/index.d.ts +2 -0
  58. package/lib/module/skia/types/AnimatedImage/index.js +3 -0
  59. package/lib/module/skia/types/AnimatedImage/index.js.map +1 -0
  60. package/lib/module/skia/types/Skia.d.ts +2 -0
  61. package/lib/module/skia/types/Skia.js.map +1 -1
  62. package/lib/module/skia/types/index.d.ts +1 -0
  63. package/lib/module/skia/types/index.js +1 -0
  64. package/lib/module/skia/types/index.js.map +1 -1
  65. package/lib/module/skia/web/JsiSkAnimatedImage.d.ts +11 -0
  66. package/lib/module/skia/web/JsiSkAnimatedImage.js +33 -0
  67. package/lib/module/skia/web/JsiSkAnimatedImage.js.map +1 -0
  68. package/lib/module/skia/web/JsiSkAnimatedImageFactory.d.ts +9 -0
  69. package/lib/module/skia/web/JsiSkAnimatedImageFactory.js +20 -0
  70. package/lib/module/skia/web/JsiSkAnimatedImageFactory.js.map +1 -0
  71. package/lib/module/skia/web/JsiSkia.js +2 -0
  72. package/lib/module/skia/web/JsiSkia.js.map +1 -1
  73. package/lib/typescript/src/external/reanimated/moduleWrapper.d.ts +2 -0
  74. package/lib/typescript/src/skia/core/AnimatedImage.d.ts +6 -0
  75. package/lib/typescript/src/skia/core/index.d.ts +1 -0
  76. package/lib/typescript/src/skia/types/AnimatedImage/AnimatedImage.d.ts +24 -0
  77. package/lib/typescript/src/skia/types/AnimatedImage/AnimatedImageFactory.d.ts +13 -0
  78. package/lib/typescript/src/skia/types/AnimatedImage/index.d.ts +2 -0
  79. package/lib/typescript/src/skia/types/Skia.d.ts +2 -0
  80. package/lib/typescript/src/skia/types/index.d.ts +1 -0
  81. package/lib/typescript/src/skia/web/JsiSkAnimatedImage.d.ts +11 -0
  82. package/lib/typescript/src/skia/web/JsiSkAnimatedImageFactory.d.ts +9 -0
  83. package/package.json +1 -1
  84. package/src/external/reanimated/moduleWrapper.ts +9 -8
  85. package/src/skia/core/AnimatedImage.ts +63 -0
  86. package/src/skia/core/Font.ts +5 -5
  87. package/src/skia/core/index.ts +1 -0
  88. package/src/skia/types/AnimatedImage/AnimatedImage.ts +29 -0
  89. package/src/skia/types/AnimatedImage/AnimatedImageFactory.ts +15 -0
  90. package/src/skia/types/AnimatedImage/index.ts +2 -0
  91. package/src/skia/types/Skia.ts +3 -0
  92. package/src/skia/types/index.ts +1 -0
  93. package/src/skia/web/JsiSkAnimatedImage.ts +35 -0
  94. package/src/skia/web/JsiSkAnimatedImageFactory.ts +27 -0
  95. package/src/skia/web/JsiSkia.ts +2 -0
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useAnimatedImageValue = exports.useAnimatedImage = void 0;
7
+
8
+ var _moduleWrapper = require("../../external/reanimated/moduleWrapper");
9
+
10
+ var _Skia = require("../Skia");
11
+
12
+ var _Data = require("./Data");
13
+
14
+ const animatedImgFactory = _Skia.Skia.AnimatedImage.MakeAnimatedImageFromEncoded.bind(_Skia.Skia.AnimatedImage);
15
+ /**
16
+ * Returns a Skia Animated Image object
17
+ * */
18
+
19
+
20
+ const useAnimatedImage = (source, onError) => (0, _Data.useRawData)(source, animatedImgFactory, onError);
21
+
22
+ exports.useAnimatedImage = useAnimatedImage;
23
+ const DEFAULT_FRAME_DURATION = 60;
24
+
25
+ const useAnimatedImageValue = source => {
26
+ (0, _moduleWrapper.throwOnMissingReanimated)();
27
+ const currentFrame = (0, _moduleWrapper.useSharedValue)(null);
28
+ const lastTimestamp = (0, _moduleWrapper.useSharedValue)(0);
29
+ const animatedImage = useAnimatedImage(source, err => {
30
+ console.error(err);
31
+ throw new Error(`Could not load animated image - got '${err.message}'`);
32
+ });
33
+ const frameDuration = (animatedImage === null || animatedImage === void 0 ? void 0 : animatedImage.currentFrameDuration()) || DEFAULT_FRAME_DURATION; // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
+
35
+ (0, _moduleWrapper.useFrameCallback)(frameInfo => {
36
+ if (!animatedImage) {
37
+ currentFrame.value = null;
38
+ return;
39
+ }
40
+
41
+ const {
42
+ timestamp
43
+ } = frameInfo;
44
+ const elapsed = timestamp - lastTimestamp.value; // Check if it's time to switch frames based on GIF frame duration
45
+
46
+ if (elapsed < frameDuration) {
47
+ return;
48
+ } // Update the current frame
49
+
50
+
51
+ animatedImage.decodeNextFrame();
52
+
53
+ if (currentFrame.value) {
54
+ currentFrame.value.dispose();
55
+ }
56
+
57
+ currentFrame.value = animatedImage.getCurrentFrame(); // Update the last timestamp
58
+
59
+ lastTimestamp.value = timestamp; // eslint-disable-next-line react-hooks/exhaustive-deps
60
+ }, true);
61
+ return currentFrame;
62
+ };
63
+
64
+ exports.useAnimatedImageValue = useAnimatedImageValue;
65
+ //# sourceMappingURL=AnimatedImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["animatedImgFactory","Skia","AnimatedImage","MakeAnimatedImageFromEncoded","bind","useAnimatedImage","source","onError","useRawData","DEFAULT_FRAME_DURATION","useAnimatedImageValue","throwOnMissingReanimated","currentFrame","useSharedValue","lastTimestamp","animatedImage","err","console","error","Error","message","frameDuration","currentFrameDuration","useFrameCallback","frameInfo","value","timestamp","elapsed","decodeNextFrame","dispose","getCurrentFrame"],"sources":["AnimatedImage.ts"],"sourcesContent":["import {\n throwOnMissingReanimated,\n useFrameCallback,\n useSharedValue,\n} from \"../../external/reanimated/moduleWrapper\";\nimport { Skia } from \"../Skia\";\nimport type { DataSourceParam } from \"../types\";\n\nimport { useRawData } from \"./Data\";\n\nconst animatedImgFactory = Skia.AnimatedImage.MakeAnimatedImageFromEncoded.bind(\n Skia.AnimatedImage\n);\n\n/**\n * Returns a Skia Animated Image object\n * */\nexport const useAnimatedImage = (\n source: DataSourceParam,\n onError?: (err: Error) => void\n) => useRawData(source, animatedImgFactory, onError);\n\nconst DEFAULT_FRAME_DURATION = 60;\n\nexport const useAnimatedImageValue = (source: DataSourceParam) => {\n throwOnMissingReanimated();\n const currentFrame = useSharedValue(null);\n const lastTimestamp = useSharedValue(0);\n const animatedImage = useAnimatedImage(source, (err) => {\n console.error(err);\n throw new Error(`Could not load animated image - got '${err.message}'`);\n });\n const frameDuration =\n animatedImage?.currentFrameDuration() || DEFAULT_FRAME_DURATION;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n useFrameCallback((frameInfo: any) => {\n if (!animatedImage) {\n currentFrame.value = null;\n return;\n }\n\n const { timestamp } = frameInfo;\n const elapsed = timestamp - lastTimestamp.value;\n\n // Check if it's time to switch frames based on GIF frame duration\n if (elapsed < frameDuration) {\n return;\n }\n\n // Update the current frame\n animatedImage.decodeNextFrame();\n if (currentFrame.value) {\n currentFrame.value.dispose();\n }\n currentFrame.value = animatedImage.getCurrentFrame();\n\n // Update the last timestamp\n lastTimestamp.value = timestamp;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, true);\n return currentFrame;\n};\n"],"mappings":";;;;;;;AAAA;;AAKA;;AAGA;;AAEA,MAAMA,kBAAkB,GAAGC,UAAA,CAAKC,aAAL,CAAmBC,4BAAnB,CAAgDC,IAAhD,CACzBH,UAAA,CAAKC,aADoB,CAA3B;AAIA;AACA;AACA;;;AACO,MAAMG,gBAAgB,GAAG,CAC9BC,MAD8B,EAE9BC,OAF8B,KAG3B,IAAAC,gBAAA,EAAWF,MAAX,EAAmBN,kBAAnB,EAAuCO,OAAvC,CAHE;;;AAKP,MAAME,sBAAsB,GAAG,EAA/B;;AAEO,MAAMC,qBAAqB,GAAIJ,MAAD,IAA6B;EAChE,IAAAK,uCAAA;EACA,MAAMC,YAAY,GAAG,IAAAC,6BAAA,EAAe,IAAf,CAArB;EACA,MAAMC,aAAa,GAAG,IAAAD,6BAAA,EAAe,CAAf,CAAtB;EACA,MAAME,aAAa,GAAGV,gBAAgB,CAACC,MAAD,EAAUU,GAAD,IAAS;IACtDC,OAAO,CAACC,KAAR,CAAcF,GAAd;IACA,MAAM,IAAIG,KAAJ,CAAW,wCAAuCH,GAAG,CAACI,OAAQ,GAA9D,CAAN;EACD,CAHqC,CAAtC;EAIA,MAAMC,aAAa,GACjB,CAAAN,aAAa,SAAb,IAAAA,aAAa,WAAb,YAAAA,aAAa,CAAEO,oBAAf,OAAyCb,sBAD3C,CARgE,CAWhE;;EACA,IAAAc,+BAAA,EAAkBC,SAAD,IAAoB;IACnC,IAAI,CAACT,aAAL,EAAoB;MAClBH,YAAY,CAACa,KAAb,GAAqB,IAArB;MACA;IACD;;IAED,MAAM;MAAEC;IAAF,IAAgBF,SAAtB;IACA,MAAMG,OAAO,GAAGD,SAAS,GAAGZ,aAAa,CAACW,KAA1C,CAPmC,CASnC;;IACA,IAAIE,OAAO,GAAGN,aAAd,EAA6B;MAC3B;IACD,CAZkC,CAcnC;;;IACAN,aAAa,CAACa,eAAd;;IACA,IAAIhB,YAAY,CAACa,KAAjB,EAAwB;MACtBb,YAAY,CAACa,KAAb,CAAmBI,OAAnB;IACD;;IACDjB,YAAY,CAACa,KAAb,GAAqBV,aAAa,CAACe,eAAd,EAArB,CAnBmC,CAqBnC;;IACAhB,aAAa,CAACW,KAAd,GAAsBC,SAAtB,CAtBmC,CAuBnC;EACD,CAxBD,EAwBG,IAxBH;EAyBA,OAAOd,YAAP;AACD,CAtCM"}
@@ -16,17 +16,18 @@ var _Platform = require("../../Platform");
16
16
  var _Typeface = require("./Typeface");
17
17
 
18
18
  /*global SkiaApi*/
19
-
19
+ const defaultFontSize = 14;
20
20
  /**
21
21
  * Returns a Skia Font object
22
22
  * */
23
- const useFont = (font, size, onError) => {
23
+
24
+ const useFont = function (font) {
25
+ let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultFontSize;
26
+ let onError = arguments.length > 2 ? arguments[2] : undefined;
24
27
  const typeface = (0, _Typeface.useTypeface)(font, onError);
25
28
  return (0, _react.useMemo)(() => {
26
- if (typeface && size) {
29
+ if (typeface) {
27
30
  return _Skia.Skia.Font(typeface, size);
28
- } else if (typeface && !size) {
29
- return _Skia.Skia.Font(typeface);
30
31
  } else {
31
32
  return null;
32
33
  }
@@ -36,7 +37,7 @@ const useFont = (font, size, onError) => {
36
37
  exports.useFont = useFont;
37
38
  const defaultFontStyle = {
38
39
  fontFamily: "System",
39
- fontSize: 14,
40
+ fontSize: defaultFontSize,
40
41
  fontStyle: "normal",
41
42
  fontWeight: "normal"
42
43
  };
@@ -1 +1 @@
1
- {"version":3,"names":["useFont","font","size","onError","typeface","useTypeface","useMemo","Skia","Font","defaultFontStyle","fontFamily","fontSize","fontStyle","fontWeight","slant","s","FontSlant","Italic","Oblique","Upright","weight","parseInt","matchFont","inputStyle","fontMgr","FontMgr","System","style","width","matchFamilyStyle","listFontFamilies","Array","countFamilies","fill","map","_","i","getFamilyName","loadTypefaces","typefacesToLoad","promises","Object","keys","flatMap","familyName","typefaceToLoad","Data","fromURI","Platform","resolveAsset","then","data","tf","Typeface","MakeFreeTypeFaceFromData","Error","Promise","all","useFonts","sources","setFontMgr","useState","useEffect","result","fMgr","TypefaceFontProvider","Make","forEach","registerFont"],"sources":["Font.ts"],"sourcesContent":["/*global SkiaApi*/\nimport { useEffect, useMemo, useState } from \"react\";\n\nimport { Skia } from \"../Skia\";\nimport { FontSlant } from \"../types\";\nimport type { DataModule, DataSourceParam, SkFontMgr } from \"../types\";\nimport { Platform } from \"../../Platform\";\nimport type { SkTypefaceFontProvider } from \"../types/Paragraph/TypefaceFontProvider\";\n\nimport { useTypeface } from \"./Typeface\";\n\n/**\n * Returns a Skia Font object\n * */\nexport const useFont = (\n font: DataSourceParam,\n size?: number,\n onError?: (err: Error) => void\n) => {\n const typeface = useTypeface(font, onError);\n return useMemo(() => {\n if (typeface && size) {\n return Skia.Font(typeface, size);\n } else if (typeface && !size) {\n return Skia.Font(typeface);\n } else {\n return null;\n }\n }, [size, typeface]);\n};\n\ntype Slant = \"normal\" | \"italic\" | \"oblique\";\ntype Weight =\n | \"normal\"\n | \"bold\"\n | \"100\"\n | \"200\"\n | \"300\"\n | \"400\"\n | \"500\"\n | \"600\"\n | \"700\"\n | \"800\"\n | \"900\";\n\ninterface RNFontStyle {\n fontFamily: string;\n fontSize: number;\n fontStyle: Slant;\n fontWeight: Weight;\n}\n\nconst defaultFontStyle: RNFontStyle = {\n fontFamily: \"System\",\n fontSize: 14,\n fontStyle: \"normal\",\n fontWeight: \"normal\",\n};\n\nconst slant = (s: Slant) => {\n if (s === \"italic\") {\n return FontSlant.Italic;\n } else if (s === \"oblique\") {\n return FontSlant.Oblique;\n } else {\n return FontSlant.Upright;\n }\n};\n\nconst weight = (fontWeight: Weight) => {\n switch (fontWeight) {\n case \"normal\":\n return 400;\n case \"bold\":\n return 700;\n default:\n return parseInt(fontWeight, 10);\n }\n};\n\nexport const matchFont = (\n inputStyle: Partial<RNFontStyle> = {},\n fontMgr: SkFontMgr = Skia.FontMgr.System()\n) => {\n const fontStyle = {\n ...defaultFontStyle,\n ...inputStyle,\n };\n const style = {\n weight: weight(fontStyle.fontWeight),\n width: 5,\n slant: slant(fontStyle.fontStyle),\n };\n const typeface = fontMgr.matchFamilyStyle(fontStyle.fontFamily, style);\n return Skia.Font(typeface, fontStyle.fontSize);\n};\n\nexport const listFontFamilies = (fontMgr: SkFontMgr = Skia.FontMgr.System()) =>\n new Array(fontMgr.countFamilies())\n .fill(0)\n .map((_, i) => fontMgr.getFamilyName(i));\n\nconst loadTypefaces = (typefacesToLoad: Record<string, DataModule[]>) => {\n const promises = Object.keys(typefacesToLoad).flatMap((familyName) => {\n return typefacesToLoad[familyName].map((typefaceToLoad) => {\n return Skia.Data.fromURI(Platform.resolveAsset(typefaceToLoad)).then(\n (data) => {\n const tf = Skia.Typeface.MakeFreeTypeFaceFromData(data);\n if (tf === null) {\n throw new Error(`Couldn't create typeface for ${familyName}`);\n }\n return [familyName, tf] as const;\n }\n );\n });\n });\n return Promise.all(promises);\n};\n\nexport const useFonts = (sources: Record<string, DataModule[]>) => {\n const [fontMgr, setFontMgr] = useState<null | SkTypefaceFontProvider>(null);\n\n useEffect(() => {\n loadTypefaces(sources).then((result) => {\n const fMgr = Skia.TypefaceFontProvider.Make();\n result.forEach(([familyName, typeface]) => {\n fMgr.registerFont(typeface, familyName);\n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yDK,IAAzD,CACJC,IAAD,IAAU;QACR,MAAMC,EAAE,GAAG7C,UAAA,CAAK8C,QAAL,CAAcC,wBAAd,CAAuCH,IAAvC,CAAX;;QACA,IAAIC,EAAE,KAAK,IAAX,EAAiB;UACf,MAAM,IAAIG,KAAJ,CAAW,gCAA+BX,UAAW,EAArD,CAAN;QACD;;QACD,OAAO,CAACA,UAAD,EAAaQ,EAAb,CAAP;MACD,CAPI,CAAP;IASD,CAVM,CAAP;EAWD,CAZgB,CAAjB;EAaA,OAAOI,OAAO,CAACC,GAAR,CAAYjB,QAAZ,CAAP;AACD,CAfD;;AAiBO,MAAMkB,QAAQ,GAAIC,OAAD,IAA2C;EACjE,MAAM,CAACnC,OAAD,EAAUoC,UAAV,IAAwB,IAAAC,eAAA,EAAwC,IAAxC,CAA9B;EAEA,IAAAC,gBAAA,EAAU,MAAM;IACdxB,aAAa,CAACqB,OAAD,CAAb,CAAuBT,IAAvB,CAA6Ba,MAAD,IAAY;MACtC,MAAMC,IAAI,GAAGzD,UAAA,CAAK0D,oBAAL,CAA0BC,IAA1B,EAAb;;MACAH,MAAM,CAACI,OAAP,CAAe,QAA4B;QAAA,IAA3B,CAACvB,UAAD,EAAaxC,QAAb,CAA2B;QACzC4D,IAAI,CAACI,YAAL,CAAkBhE,QAAlB,EAA4BwC,UAA5B;MACD,CAFD;MAGAgB,UAAU,CAACI,IAAD,CAAV;IACD,CAND,EADc,CAQd;EACD,CATD,EASG,EATH;EAUA,OAAOxC,OAAP;AACD,CAdM"}
1
+ {"version":3,"names":["defaultFontSize","useFont","font","size","onError","typeface","useTypeface","useMemo","Skia","Font","defaultFontStyle","fontFamily","fontSize","fontStyle","fontWeight","slant","s","FontSlant","Italic","Oblique","Upright","weight","parseInt","matchFont","inputStyle","fontMgr","FontMgr","System","style","width","matchFamilyStyle","listFontFamilies","Array","countFamilies","fill","map","_","i","getFamilyName","loadTypefaces","typefacesToLoad","promises","Object","keys","flatMap","familyName","typefaceToLoad","Data","fromURI","Platform","resolveAsset","then","data","tf","Typeface","MakeFreeTypeFaceFromData","Error","Promise","all","useFonts","sources","setFontMgr","useState","useEffect","result","fMgr","TypefaceFontProvider","Make","forEach","registerFont"],"sources":["Font.ts"],"sourcesContent":["/*global SkiaApi*/\nimport { useEffect, useMemo, useState } from \"react\";\n\nimport { Skia } from \"../Skia\";\nimport { FontSlant } from \"../types\";\nimport type { DataModule, DataSourceParam, SkFontMgr } from \"../types\";\nimport { Platform } from \"../../Platform\";\nimport type { SkTypefaceFontProvider } from \"../types/Paragraph/TypefaceFontProvider\";\n\nimport { useTypeface } from \"./Typeface\";\n\nconst defaultFontSize = 14;\n\n/**\n * Returns a Skia Font object\n * */\nexport const useFont = (\n font: DataSourceParam,\n size = defaultFontSize,\n onError?: (err: Error) => void\n) => {\n const typeface = useTypeface(font, onError);\n return useMemo(() => {\n if (typeface) {\n return Skia.Font(typeface, size);\n } else {\n return null;\n }\n }, [size, typeface]);\n};\n\ntype Slant = \"normal\" | \"italic\" | \"oblique\";\ntype Weight =\n | \"normal\"\n | \"bold\"\n | \"100\"\n | \"200\"\n | \"300\"\n | \"400\"\n | \"500\"\n | \"600\"\n | \"700\"\n | \"800\"\n | \"900\";\n\ninterface RNFontStyle {\n fontFamily: string;\n fontSize: number;\n fontStyle: Slant;\n fontWeight: Weight;\n}\n\nconst defaultFontStyle: RNFontStyle = {\n fontFamily: \"System\",\n fontSize: defaultFontSize,\n fontStyle: \"normal\",\n fontWeight: \"normal\",\n};\n\nconst slant = (s: Slant) => {\n if (s === \"italic\") {\n return FontSlant.Italic;\n } else if (s === \"oblique\") {\n return FontSlant.Oblique;\n } else {\n return FontSlant.Upright;\n }\n};\n\nconst weight = (fontWeight: Weight) => {\n switch (fontWeight) {\n case \"normal\":\n return 400;\n case \"bold\":\n return 700;\n default:\n return parseInt(fontWeight, 10);\n }\n};\n\nexport const matchFont = (\n inputStyle: Partial<RNFontStyle> = {},\n fontMgr: SkFontMgr = Skia.FontMgr.System()\n) => {\n const fontStyle = {\n ...defaultFontStyle,\n ...inputStyle,\n };\n const style = {\n weight: weight(fontStyle.fontWeight),\n width: 5,\n slant: slant(fontStyle.fontStyle),\n };\n const typeface = fontMgr.matchFamilyStyle(fontStyle.fontFamily, style);\n return Skia.Font(typeface, fontStyle.fontSize);\n};\n\nexport const listFontFamilies = (fontMgr: SkFontMgr = Skia.FontMgr.System()) =>\n new Array(fontMgr.countFamilies())\n .fill(0)\n .map((_, i) => fontMgr.getFamilyName(i));\n\nconst loadTypefaces = (typefacesToLoad: Record<string, DataModule[]>) => {\n const promises = Object.keys(typefacesToLoad).flatMap((familyName) => {\n return typefacesToLoad[familyName].map((typefaceToLoad) => {\n return Skia.Data.fromURI(Platform.resolveAsset(typefaceToLoad)).then(\n (data) => {\n const tf = Skia.Typeface.MakeFreeTypeFaceFromData(data);\n if (tf === null) {\n throw new Error(`Couldn't create typeface for ${familyName}`);\n }\n return [familyName, tf] as const;\n }\n );\n });\n });\n return Promise.all(promises);\n};\n\nexport const useFonts = (sources: Record<string, DataModule[]>) => {\n const [fontMgr, setFontMgr] = useState<null | SkTypefaceFontProvider>(null);\n\n useEffect(() => {\n loadTypefaces(sources).then((result) => {\n const fMgr = Skia.TypefaceFontProvider.Make();\n result.forEach(([familyName, typeface]) => {\n fMgr.registerFont(typeface, familyName);\n });\n setFontMgr(fMgr);\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n return fontMgr;\n};\n"],"mappings":";;;;;;;AACA;;AAEA;;AACA;;AAEA;;AAGA;;AATA;AAWA,MAAMA,eAAe,GAAG,EAAxB;AAEA;AACA;AACA;;AACO,MAAMC,OAAO,GAAG,UACrBC,IADqB,EAIlB;EAAA,IAFHC,IAEG,uEAFIH,eAEJ;EAAA,IADHI,OACG;EACH,MAAMC,QAAQ,GAAG,IAAAC,qBAAA,EAAYJ,IAAZ,EAAkBE,OAAlB,CAAjB;EACA,OAAO,IAAAG,cAAA,EAAQ,MAAM;IACnB,IAAIF,QAAJ,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AwC,IAAxC,CAA9B;EAEA,IAAAC,gBAAA,EAAU,MAAM;IACdxB,aAAa,CAACqB,OAAD,CAAb,CAAuBT,IAAvB,CAA6Ba,MAAD,IAAY;MACtC,MAAMC,IAAI,GAAGzD,UAAA,CAAK0D,oBAAL,CAA0BC,IAA1B,EAAb;;MACAH,MAAM,CAACI,OAAP,CAAe,QAA4B;QAAA,IAA3B,CAACvB,UAAD,EAAaxC,QAAb,CAA2B;QACzC4D,IAAI,CAACI,YAAL,CAAkBhE,QAAlB,EAA4BwC,UAA5B;MACD,CAFD;MAGAgB,UAAU,CAACI,IAAD,CAAV;IACD,CAND,EADc,CAQd;EACD,CATD,EASG,EATH;EAUA,OAAOxC,OAAP;AACD,CAdM"}
@@ -2,6 +2,7 @@ export * from "./Data";
2
2
  export * from "./Font";
3
3
  export * from "./Typeface";
4
4
  export * from "./Image";
5
+ export * from "./AnimatedImage";
5
6
  export * from "./Picture";
6
7
  export * from "./SVG";
7
8
  export * from "./Vector";
@@ -56,6 +56,19 @@ Object.keys(_Image).forEach(function (key) {
56
56
  });
57
57
  });
58
58
 
59
+ var _AnimatedImage = require("./AnimatedImage");
60
+
61
+ Object.keys(_AnimatedImage).forEach(function (key) {
62
+ if (key === "default" || key === "__esModule") return;
63
+ if (key in exports && exports[key] === _AnimatedImage[key]) return;
64
+ Object.defineProperty(exports, key, {
65
+ enumerable: true,
66
+ get: function () {
67
+ return _AnimatedImage[key];
68
+ }
69
+ });
70
+ });
71
+
59
72
  var _Picture = require("./Picture");
60
73
 
61
74
  Object.keys(_Picture).forEach(function (key) {
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Data\";\nexport * from \"./Font\";\nexport * from \"./Typeface\";\nexport * from \"./Image\";\nexport * from \"./Picture\";\nexport * from \"./SVG\";\nexport * from \"./Vector\";\nexport * from \"./Rect\";\nexport * from \"./RRect\";\nexport * from \"./Matrix\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Data\";\nexport * from \"./Font\";\nexport * from \"./Typeface\";\nexport * from \"./Image\";\nexport * from \"./AnimatedImage\";\nexport * from \"./Picture\";\nexport * from \"./SVG\";\nexport * from \"./Vector\";\nexport * from \"./Rect\";\nexport * from \"./RRect\";\nexport * from \"./Matrix\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -0,0 +1,24 @@
1
+ import type { SkJSIInstance } from "../JsiInstance";
2
+ import type { SkImage } from "../Image";
3
+ export interface SkAnimatedImage extends SkJSIInstance<"AnimatedImage"> {
4
+ /**
5
+ * Decode the next frame.
6
+ *
7
+ * If the animation is on the last frame or has hit an error, returns
8
+ * kFinished (-1).
9
+ */
10
+ decodeNextFrame(): number;
11
+ /**
12
+ * Returns the current frame as an SkImage. The SkImage will not change
13
+ * after it has been returned.
14
+ * If there is no current frame, null will be returned.
15
+ */
16
+ getCurrentFrame(): SkImage | null;
17
+ /**
18
+ * How long to display the current frame.
19
+ *
20
+ * Useful for the first frame, for which decodeNextFrame is called
21
+ * internally.
22
+ */
23
+ currentFrameDuration(): number;
24
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=AnimatedImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["AnimatedImage.ts"],"sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\nimport type { SkImage } from \"../Image\";\n\nexport interface SkAnimatedImage extends SkJSIInstance<\"AnimatedImage\"> {\n /**\n * Decode the next frame.\n *\n * If the animation is on the last frame or has hit an error, returns\n * kFinished (-1).\n */\n decodeNextFrame(): number;\n\n /**\n * Returns the current frame as an SkImage. The SkImage will not change\n * after it has been returned.\n * If there is no current frame, null will be returned.\n */\n getCurrentFrame(): SkImage | null;\n\n /**\n * How long to display the current frame.\n *\n * Useful for the first frame, for which decodeNextFrame is called\n * internally.\n */\n currentFrameDuration(): number;\n\n // TODO - add the rest of the methods from the Skia API (see SkAnimatedImage.h)\n}\n"],"mappings":""}
@@ -0,0 +1,13 @@
1
+ import type { SkData } from "../Data";
2
+ import type { SkAnimatedImage } from "./AnimatedImage";
3
+ export interface AnimatedImageFactory {
4
+ /**
5
+ * Decodes the given bytes into an animated image. Returns null if the bytes were invalid.
6
+ * The passed in bytes will be copied into the WASM heap, so the caller can dispose of them.
7
+ *
8
+ * The returned AnimatedImage will be "pointing to" the first frame, i.e. currentFrameDuration
9
+ * and makeImageAtCurrentFrame will be referring to the first frame.
10
+ * @param encoded
11
+ */
12
+ MakeAnimatedImageFromEncoded: (encoded: SkData) => SkAnimatedImage | null;
13
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=AnimatedImageFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["AnimatedImageFactory.ts"],"sourcesContent":["import type { SkData } from \"../Data\";\n\nimport type { SkAnimatedImage } from \"./AnimatedImage\";\n\nexport interface AnimatedImageFactory {\n /**\n * Decodes the given bytes into an animated image. Returns null if the bytes were invalid.\n * The passed in bytes will be copied into the WASM heap, so the caller can dispose of them.\n *\n * The returned AnimatedImage will be \"pointing to\" the first frame, i.e. currentFrameDuration\n * and makeImageAtCurrentFrame will be referring to the first frame.\n * @param encoded\n */\n MakeAnimatedImageFromEncoded: (encoded: SkData) => SkAnimatedImage | null;\n}\n"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from "./AnimatedImage";
2
+ export * from "./AnimatedImageFactory";
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _AnimatedImage = require("./AnimatedImage");
8
+
9
+ Object.keys(_AnimatedImage).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _AnimatedImage[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _AnimatedImage[key];
16
+ }
17
+ });
18
+ });
19
+
20
+ var _AnimatedImageFactory = require("./AnimatedImageFactory");
21
+
22
+ Object.keys(_AnimatedImageFactory).forEach(function (key) {
23
+ if (key === "default" || key === "__esModule") return;
24
+ if (key in exports && exports[key] === _AnimatedImageFactory[key]) return;
25
+ Object.defineProperty(exports, key, {
26
+ enumerable: true,
27
+ get: function () {
28
+ return _AnimatedImageFactory[key];
29
+ }
30
+ });
31
+ });
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./AnimatedImage\";\nexport * from \"./AnimatedImageFactory\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -24,6 +24,7 @@ import type { SkContourMeasureIter } from "./ContourMeasure";
24
24
  import type { PictureFactory, SkPictureRecorder } from "./Picture";
25
25
  import type { Color, SkColor } from "./Color";
26
26
  import type { TypefaceFontProviderFactory } from "./Paragraph/TypefaceFontProviderFactory";
27
+ import type { AnimatedImageFactory } from "./AnimatedImage";
27
28
  /**
28
29
  * Declares the interface for the native Skia API
29
30
  */
@@ -63,6 +64,7 @@ export interface Skia {
63
64
  MakeVertices(mode: VertexMode, positions: SkPoint[], textureCoordinates?: SkPoint[] | null, colors?: SkColor[], indices?: number[] | null, isVolatile?: boolean): SkVertices;
64
65
  Data: DataFactory;
65
66
  Image: ImageFactory;
67
+ AnimatedImage: AnimatedImageFactory;
66
68
  SVG: SVGFactory;
67
69
  TextBlob: TextBlobFactory;
68
70
  Surface: SurfaceFactory;
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["Skia.ts"],"sourcesContent":["import type { ImageFilterFactory } from \"./ImageFilter\";\nimport type { PathFactory } from \"./Path\";\nimport type { ColorFilterFactory } from \"./ColorFilter\";\nimport type { SkFont, FontMgrFactory } from \"./Font\";\nimport type { SkTypeface, TypefaceFactory } from \"./Typeface\";\nimport type { ImageFactory } from \"./Image\";\nimport type { MaskFilterFactory } from \"./MaskFilter\";\nimport type { SkPaint } from \"./Paint\";\nimport type { SkRect } from \"./Rect\";\nimport type { SkRRect } from \"./RRect\";\nimport type {\n RuntimeEffectFactory,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n} from \"./RuntimeEffect\";\nimport type { ShaderFactory } from \"./Shader\";\nimport type { SkMatrix } from \"./Matrix\";\nimport type { PathEffectFactory } from \"./PathEffect\";\nimport type { SkPoint } from \"./Point\";\nimport type { SkVertices, VertexMode } from \"./Vertices/Vertices\";\nimport type { DataFactory } from \"./Data\";\nimport type { SVGFactory } from \"./SVG\";\nimport type { TextBlobFactory } from \"./TextBlob\";\nimport type { SurfaceFactory } from \"./Surface\";\nimport type { SkRSXform } from \"./RSXform\";\nimport type { SkPath } from \"./Path/Path\";\nimport type { SkContourMeasureIter } from \"./ContourMeasure\";\nimport type { PictureFactory, SkPictureRecorder } from \"./Picture\";\nimport type { Color, SkColor } from \"./Color\";\nimport type { TypefaceFontProviderFactory } from \"./Paragraph/TypefaceFontProviderFactory\";\n/**\n * Declares the interface for the native Skia API\n */\nexport interface Skia {\n Point: (x: number, y: number) => SkPoint;\n XYWHRect: (x: number, y: number, width: number, height: number) => SkRect;\n RuntimeShaderBuilder: (rt: SkRuntimeEffect) => SkRuntimeShaderBuilder;\n RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;\n RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;\n Color: (color: Color) => SkColor;\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ) => SkContourMeasureIter;\n Paint: () => SkPaint;\n PictureRecorder: () => SkPictureRecorder;\n Picture: PictureFactory;\n Path: PathFactory;\n Matrix: (matrix?: readonly number[]) => SkMatrix;\n ColorFilter: ColorFilterFactory;\n Font: (typeface?: SkTypeface, size?: number) => SkFont;\n Typeface: TypefaceFactory;\n TypefaceFontProvider: TypefaceFontProviderFactory;\n FontMgr: FontMgrFactory;\n MaskFilter: MaskFilterFactory;\n RuntimeEffect: RuntimeEffectFactory;\n ImageFilter: ImageFilterFactory;\n Shader: ShaderFactory;\n PathEffect: PathEffectFactory;\n /**\n * Returns an Vertices based on the given positions and optional parameters.\n * See SkVertices.h (especially the Builder) for more details.\n * @param mode\n * @param positions\n * @param textureCoordinates\n * @param colors - either a list of int colors or a flattened color array.\n * @param indices\n * @param isVolatile\n */\n MakeVertices(\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n ): SkVertices;\n Data: DataFactory;\n Image: ImageFactory;\n SVG: SVGFactory;\n TextBlob: TextBlobFactory;\n Surface: SurfaceFactory;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["Skia.ts"],"sourcesContent":["import type { ImageFilterFactory } from \"./ImageFilter\";\nimport type { PathFactory } from \"./Path\";\nimport type { ColorFilterFactory } from \"./ColorFilter\";\nimport type { SkFont, FontMgrFactory } from \"./Font\";\nimport type { SkTypeface, TypefaceFactory } from \"./Typeface\";\nimport type { ImageFactory } from \"./Image\";\nimport type { MaskFilterFactory } from \"./MaskFilter\";\nimport type { SkPaint } from \"./Paint\";\nimport type { SkRect } from \"./Rect\";\nimport type { SkRRect } from \"./RRect\";\nimport type {\n RuntimeEffectFactory,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n} from \"./RuntimeEffect\";\nimport type { ShaderFactory } from \"./Shader\";\nimport type { SkMatrix } from \"./Matrix\";\nimport type { PathEffectFactory } from \"./PathEffect\";\nimport type { SkPoint } from \"./Point\";\nimport type { SkVertices, VertexMode } from \"./Vertices/Vertices\";\nimport type { DataFactory } from \"./Data\";\nimport type { SVGFactory } from \"./SVG\";\nimport type { TextBlobFactory } from \"./TextBlob\";\nimport type { SurfaceFactory } from \"./Surface\";\nimport type { SkRSXform } from \"./RSXform\";\nimport type { SkPath } from \"./Path/Path\";\nimport type { SkContourMeasureIter } from \"./ContourMeasure\";\nimport type { PictureFactory, SkPictureRecorder } from \"./Picture\";\nimport type { Color, SkColor } from \"./Color\";\nimport type { TypefaceFontProviderFactory } from \"./Paragraph/TypefaceFontProviderFactory\";\nimport type { AnimatedImageFactory } from \"./AnimatedImage\";\n\n/**\n * Declares the interface for the native Skia API\n */\nexport interface Skia {\n Point: (x: number, y: number) => SkPoint;\n XYWHRect: (x: number, y: number, width: number, height: number) => SkRect;\n RuntimeShaderBuilder: (rt: SkRuntimeEffect) => SkRuntimeShaderBuilder;\n RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;\n RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;\n Color: (color: Color) => SkColor;\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ) => SkContourMeasureIter;\n Paint: () => SkPaint;\n PictureRecorder: () => SkPictureRecorder;\n Picture: PictureFactory;\n Path: PathFactory;\n Matrix: (matrix?: readonly number[]) => SkMatrix;\n ColorFilter: ColorFilterFactory;\n Font: (typeface?: SkTypeface, size?: number) => SkFont;\n Typeface: TypefaceFactory;\n TypefaceFontProvider: TypefaceFontProviderFactory;\n FontMgr: FontMgrFactory;\n MaskFilter: MaskFilterFactory;\n RuntimeEffect: RuntimeEffectFactory;\n ImageFilter: ImageFilterFactory;\n Shader: ShaderFactory;\n PathEffect: PathEffectFactory;\n /**\n * Returns an Vertices based on the given positions and optional parameters.\n * See SkVertices.h (especially the Builder) for more details.\n * @param mode\n * @param positions\n * @param textureCoordinates\n * @param colors - either a list of int colors or a flattened color array.\n * @param indices\n * @param isVolatile\n */\n MakeVertices(\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n ): SkVertices;\n Data: DataFactory;\n Image: ImageFactory;\n AnimatedImage: AnimatedImageFactory;\n SVG: SVGFactory;\n TextBlob: TextBlobFactory;\n Surface: SurfaceFactory;\n}\n"],"mappings":""}
@@ -6,6 +6,7 @@ export * from "./Vertices";
6
6
  export * from "./RuntimeEffect";
7
7
  export * from "./Shader";
8
8
  export * from "./Image";
9
+ export * from "./AnimatedImage";
9
10
  export * from "./ColorFilter";
10
11
  export * from "./ImageFilter";
11
12
  export * from "./Font";
@@ -108,6 +108,19 @@ Object.keys(_Image).forEach(function (key) {
108
108
  });
109
109
  });
110
110
 
111
+ var _AnimatedImage = require("./AnimatedImage");
112
+
113
+ Object.keys(_AnimatedImage).forEach(function (key) {
114
+ if (key === "default" || key === "__esModule") return;
115
+ if (key in exports && exports[key] === _AnimatedImage[key]) return;
116
+ Object.defineProperty(exports, key, {
117
+ enumerable: true,
118
+ get: function () {
119
+ return _AnimatedImage[key];
120
+ }
121
+ });
122
+ });
123
+
111
124
  var _ColorFilter = require("./ColorFilter");
112
125
 
113
126
  Object.keys(_ColorFilter).forEach(function (key) {
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Picture\";\nexport * from \"./Data\";\nexport * from \"./SVG\";\nexport * from \"./Surface\";\nexport * from \"./Vertices\";\nexport * from \"./RuntimeEffect\";\nexport * from \"./Shader\";\nexport * from \"./Image\";\nexport * from \"./ColorFilter\";\nexport * from \"./ImageFilter\";\nexport * from \"./Font\";\nexport * from \"./Typeface\";\nexport * from \"./Paint\";\nexport * from \"./Path\";\nexport * from \"./Color\";\nexport * from \"./Canvas\";\nexport * from \"./ContourMeasure\";\nexport * from \"./MaskFilter\";\nexport * from \"./Matrix\";\nexport * from \"./PathEffect\";\nexport * from \"./Point\";\nexport * from \"./Rect\";\nexport * from \"./RRect\";\nexport * from \"./RSXform\";\nexport * from \"./JsiInstance\";\nexport * from \"./Skia\";\nexport * from \"./TextBlob\";\nexport * from \"./Size\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Picture\";\nexport * from \"./Data\";\nexport * from \"./SVG\";\nexport * from \"./Surface\";\nexport * from \"./Vertices\";\nexport * from \"./RuntimeEffect\";\nexport * from \"./Shader\";\nexport * from \"./Image\";\nexport * from \"./AnimatedImage\";\nexport * from \"./ColorFilter\";\nexport * from \"./ImageFilter\";\nexport * from \"./Font\";\nexport * from \"./Typeface\";\nexport * from \"./Paint\";\nexport * from \"./Path\";\nexport * from \"./Color\";\nexport * from \"./Canvas\";\nexport * from \"./ContourMeasure\";\nexport * from \"./MaskFilter\";\nexport * from \"./Matrix\";\nexport * from \"./PathEffect\";\nexport * from \"./Point\";\nexport * from \"./Rect\";\nexport * from \"./RRect\";\nexport * from \"./RSXform\";\nexport * from \"./JsiInstance\";\nexport * from \"./Skia\";\nexport * from \"./TextBlob\";\nexport * from \"./Size\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -0,0 +1,11 @@
1
+ import type { AnimatedImage, CanvasKit } from "canvaskit-wasm";
2
+ import type { SkAnimatedImage } from "../types/AnimatedImage";
3
+ import { HostObject } from "./Host";
4
+ import { JsiSkImage } from "./JsiSkImage";
5
+ export declare class JsiSkAnimatedImage extends HostObject<AnimatedImage, "AnimatedImage"> implements SkAnimatedImage {
6
+ constructor(CanvasKit: CanvasKit, ref: AnimatedImage);
7
+ decodeNextFrame(): number;
8
+ currentFrameDuration(): number;
9
+ getCurrentFrame(): JsiSkImage | null;
10
+ dispose: () => void;
11
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.JsiSkAnimatedImage = void 0;
7
+
8
+ var _Host = require("./Host");
9
+
10
+ var _JsiSkImage = require("./JsiSkImage");
11
+
12
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
+
14
+ class JsiSkAnimatedImage extends _Host.HostObject {
15
+ constructor(CanvasKit, ref) {
16
+ super(CanvasKit, ref, "AnimatedImage");
17
+
18
+ _defineProperty(this, "dispose", () => {
19
+ this.ref.delete();
20
+ });
21
+ }
22
+
23
+ decodeNextFrame() {
24
+ return this.ref.decodeNextFrame();
25
+ }
26
+
27
+ currentFrameDuration() {
28
+ return this.ref.currentFrameDuration();
29
+ }
30
+
31
+ getCurrentFrame() {
32
+ const image = this.ref.makeImageAtCurrentFrame();
33
+
34
+ if (image === null) {
35
+ return null;
36
+ }
37
+
38
+ return new _JsiSkImage.JsiSkImage(this.CanvasKit, image);
39
+ }
40
+
41
+ }
42
+
43
+ exports.JsiSkAnimatedImage = JsiSkAnimatedImage;
44
+ //# sourceMappingURL=JsiSkAnimatedImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["JsiSkAnimatedImage","HostObject","constructor","CanvasKit","ref","delete","decodeNextFrame","currentFrameDuration","getCurrentFrame","image","makeImageAtCurrentFrame","JsiSkImage"],"sources":["JsiSkAnimatedImage.ts"],"sourcesContent":["import type { AnimatedImage, CanvasKit } from \"canvaskit-wasm\";\n\nimport type { SkAnimatedImage } from \"../types/AnimatedImage\";\n\nimport { HostObject } from \"./Host\";\nimport { JsiSkImage } from \"./JsiSkImage\";\n\nexport class JsiSkAnimatedImage\n extends HostObject<AnimatedImage, \"AnimatedImage\">\n implements SkAnimatedImage\n{\n constructor(CanvasKit: CanvasKit, ref: AnimatedImage) {\n super(CanvasKit, ref, \"AnimatedImage\");\n }\n\n decodeNextFrame() {\n return this.ref.decodeNextFrame();\n }\n\n currentFrameDuration() {\n return this.ref.currentFrameDuration();\n }\n\n getCurrentFrame() {\n const image = this.ref.makeImageAtCurrentFrame();\n if (image === null) {\n return null;\n }\n return new JsiSkImage(this.CanvasKit, image);\n }\n\n dispose = () => {\n this.ref.delete();\n };\n}\n"],"mappings":";;;;;;;AAIA;;AACA;;;;AAEO,MAAMA,kBAAN,SACGC,gBADH,CAGP;EACEC,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAA2C;IACpD,MAAMD,SAAN,EAAiBC,GAAjB,EAAsB,eAAtB;;IADoD,iCAoB5C,MAAM;MACd,KAAKA,GAAL,CAASC,MAAT;IACD,CAtBqD;EAErD;;EAEDC,eAAe,GAAG;IAChB,OAAO,KAAKF,GAAL,CAASE,eAAT,EAAP;EACD;;EAEDC,oBAAoB,GAAG;IACrB,OAAO,KAAKH,GAAL,CAASG,oBAAT,EAAP;EACD;;EAEDC,eAAe,GAAG;IAChB,MAAMC,KAAK,GAAG,KAAKL,GAAL,CAASM,uBAAT,EAAd;;IACA,IAAID,KAAK,KAAK,IAAd,EAAoB;MAClB,OAAO,IAAP;IACD;;IACD,OAAO,IAAIE,sBAAJ,CAAe,KAAKR,SAApB,EAA+BM,KAA/B,CAAP;EACD;;AAnBH"}
@@ -0,0 +1,9 @@
1
+ import type { CanvasKit } from "canvaskit-wasm";
2
+ import type { SkData } from "../types";
3
+ import type { AnimatedImageFactory } from "../types/AnimatedImage/AnimatedImageFactory";
4
+ import { Host } from "./Host";
5
+ import { JsiSkAnimatedImage } from "./JsiSkAnimatedImage";
6
+ export declare class JsiSkAnimatedImageFactory extends Host implements AnimatedImageFactory {
7
+ constructor(CanvasKit: CanvasKit);
8
+ MakeAnimatedImageFromEncoded(encoded: SkData): JsiSkAnimatedImage | null;
9
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.JsiSkAnimatedImageFactory = void 0;
7
+
8
+ var _Host = require("./Host");
9
+
10
+ var _JsiSkData = require("./JsiSkData");
11
+
12
+ var _JsiSkAnimatedImage = require("./JsiSkAnimatedImage");
13
+
14
+ class JsiSkAnimatedImageFactory extends _Host.Host {
15
+ constructor(CanvasKit) {
16
+ super(CanvasKit);
17
+ }
18
+
19
+ MakeAnimatedImageFromEncoded(encoded) {
20
+ const image = this.CanvasKit.MakeAnimatedImageFromEncoded(_JsiSkData.JsiSkData.fromValue(encoded));
21
+
22
+ if (image === null) {
23
+ return null;
24
+ }
25
+
26
+ return new _JsiSkAnimatedImage.JsiSkAnimatedImage(this.CanvasKit, image);
27
+ }
28
+
29
+ }
30
+
31
+ exports.JsiSkAnimatedImageFactory = JsiSkAnimatedImageFactory;
32
+ //# sourceMappingURL=JsiSkAnimatedImageFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["JsiSkAnimatedImageFactory","Host","constructor","CanvasKit","MakeAnimatedImageFromEncoded","encoded","image","JsiSkData","fromValue","JsiSkAnimatedImage"],"sources":["JsiSkAnimatedImageFactory.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type { SkData } from \"../types\";\nimport type { AnimatedImageFactory } from \"../types/AnimatedImage/AnimatedImageFactory\";\n\nimport { Host } from \"./Host\";\nimport { JsiSkData } from \"./JsiSkData\";\nimport { JsiSkAnimatedImage } from \"./JsiSkAnimatedImage\";\n\nexport class JsiSkAnimatedImageFactory\n extends Host\n implements AnimatedImageFactory\n{\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeAnimatedImageFromEncoded(encoded: SkData) {\n const image = this.CanvasKit.MakeAnimatedImageFromEncoded(\n JsiSkData.fromValue(encoded)\n );\n if (image === null) {\n return null;\n }\n return new JsiSkAnimatedImage(this.CanvasKit, image);\n }\n}\n"],"mappings":";;;;;;;AAKA;;AACA;;AACA;;AAEO,MAAMA,yBAAN,SACGC,UADH,CAGP;EACEC,WAAW,CAACC,SAAD,EAAuB;IAChC,MAAMA,SAAN;EACD;;EAEDC,4BAA4B,CAACC,OAAD,EAAkB;IAC5C,MAAMC,KAAK,GAAG,KAAKH,SAAL,CAAeC,4BAAf,CACZG,oBAAA,CAAUC,SAAV,CAAoBH,OAApB,CADY,CAAd;;IAGA,IAAIC,KAAK,KAAK,IAAd,EAAoB;MAClB,OAAO,IAAP;IACD;;IACD,OAAO,IAAIG,sCAAJ,CAAuB,KAAKN,SAA5B,EAAuCG,KAAvC,CAAP;EACD;;AAbH"}
@@ -63,6 +63,8 @@ var _JsiSkTypefaceFontProviderFactory = require("./JsiSkTypefaceFontProviderFact
63
63
 
64
64
  var _JsiSkFontMgrFactory = require("./JsiSkFontMgrFactory");
65
65
 
66
+ var _JsiSkAnimatedImageFactory = require("./JsiSkAnimatedImageFactory");
67
+
66
68
  const JsiSkApi = CanvasKit => ({
67
69
  Point: (x, y) => new _JsiSkPoint.JsiSkPoint(CanvasKit, Float32Array.of(x, y)),
68
70
  RuntimeShaderBuilder: _ => {
@@ -92,6 +94,7 @@ const JsiSkApi = CanvasKit => ({
92
94
  MakeVertices: _JsiSkVerticesFactory.MakeVertices.bind(null, CanvasKit),
93
95
  Data: new _JsiSkDataFactory.JsiSkDataFactory(CanvasKit),
94
96
  Image: new _JsiSkImageFactory.JsiSkImageFactory(CanvasKit),
97
+ AnimatedImage: new _JsiSkAnimatedImageFactory.JsiSkAnimatedImageFactory(CanvasKit),
95
98
  SVG: new _JsiSkSVGFactory.JsiSkSVGFactory(CanvasKit),
96
99
  TextBlob: new _JsiSkTextBlobFactory.JsiSkTextBlobFactory(CanvasKit),
97
100
  XYWHRect: (x, y, width, height) => {
@@ -1 +1 @@
1
- {"version":3,"names":["JsiSkApi","CanvasKit","Point","x","y","JsiSkPoint","Float32Array","of","RuntimeShaderBuilder","_","Error","RRectXY","rect","rx","ry","JsiSkRRect","RSXform","scos","ssin","tx","ty","JsiSkRSXform","Color","ContourMeasureIter","path","forceClosed","resScale","JsiSkContourMeasureIter","JsiSkPath","fromValue","Paint","paint","JsiSkPaint","setAntiAlias","PictureRecorder","JsiSkPictureRecorder","Picture","JsiSkPictureFactory","Path","JsiSkPathFactory","Matrix","matrix","JsiSkMatrix","identity","ColorFilter","JsiSkColorFilterFactory","Font","typeface","size","JsiSkFont","undefined","JsiSkTypeface","Typeface","JsiSkTypefaceFactory","MaskFilter","JsiSkMaskFilterFactory","RuntimeEffect","JsiSkRuntimeEffectFactory","ImageFilter","JsiSkImageFilterFactory","Shader","JsiSkShaderFactory","PathEffect","JsiSkPathEffectFactory","MakeVertices","bind","Data","JsiSkDataFactory","Image","JsiSkImageFactory","SVG","JsiSkSVGFactory","TextBlob","JsiSkTextBlobFactory","XYWHRect","width","height","JsiSkRect","Surface","JsiSkSurfaceFactory","TypefaceFontProvider","JsiSkTypefaceFontProviderFactory","FontMgr","JsiSkFontMgrFactory"],"sources":["JsiSkia.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n SkContourMeasureIter,\n Skia,\n SkPath,\n SkRect,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n SkTypeface,\n} from \"../types\";\n\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { Color } from \"./JsiSkColor\";\nimport { JsiSkSurfaceFactory } from \"./JsiSkSurfaceFactory\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\nimport { JsiSkContourMeasureIter } from \"./JsiSkContourMeasureIter\";\nimport { JsiSkPictureRecorder } from \"./JsiSkPictureRecorder\";\nimport { JsiSkPictureFactory } from \"./JsiSkPictureFactory\";\nimport { JsiSkPathFactory } from \"./JsiSkPathFactory\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkColorFilterFactory } from \"./JsiSkColorFilterFactory\";\nimport { JsiSkTypefaceFactory } from \"./JsiSkTypefaceFactory\";\nimport { JsiSkMaskFilterFactory } from \"./JsiSkMaskFilterFactory\";\nimport { JsiSkRuntimeEffectFactory } from \"./JsiSkRuntimeEffectFactory\";\nimport { JsiSkImageFilterFactory } from \"./JsiSkImageFilterFactory\";\nimport { JsiSkShaderFactory } from \"./JsiSkShaderFactory\";\nimport { JsiSkPathEffectFactory } from \"./JsiSkPathEffectFactory\";\nimport { JsiSkDataFactory } from \"./JsiSkDataFactory\";\nimport { JsiSkImageFactory } from \"./JsiSkImageFactory\";\nimport { JsiSkSVGFactory } from \"./JsiSkSVGFactory\";\nimport { JsiSkTextBlobFactory } from \"./JsiSkTextBlobFactory\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { MakeVertices } from \"./JsiSkVerticesFactory\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\nimport { JsiSkTypefaceFontProviderFactory } from \"./JsiSkTypefaceFontProviderFactory\";\nimport { JsiSkFontMgrFactory } from \"./JsiSkFontMgrFactory\";\n\nexport const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({\n Point: (x: number, y: number) =>\n new JsiSkPoint(CanvasKit, Float32Array.of(x, y)),\n RuntimeShaderBuilder: (_: SkRuntimeEffect): SkRuntimeShaderBuilder => {\n throw new Error(\"Not implemented on React Native Web\");\n },\n RRectXY: (rect: SkRect, rx: number, ry: number) =>\n new JsiSkRRect(CanvasKit, rect, rx, ry),\n RSXform: (scos: number, ssin: number, tx: number, ty: number) =>\n new JsiSkRSXform(CanvasKit, Float32Array.of(scos, ssin, tx, ty)),\n Color,\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ): SkContourMeasureIter =>\n new JsiSkContourMeasureIter(\n CanvasKit,\n new CanvasKit.ContourMeasureIter(\n JsiSkPath.fromValue(path),\n forceClosed,\n resScale\n )\n ),\n Paint: () => {\n const paint = new JsiSkPaint(CanvasKit, new CanvasKit.Paint());\n paint.setAntiAlias(true);\n return paint;\n },\n PictureRecorder: () =>\n new JsiSkPictureRecorder(CanvasKit, new CanvasKit.PictureRecorder()),\n Picture: new JsiSkPictureFactory(CanvasKit),\n Path: new JsiSkPathFactory(CanvasKit),\n Matrix: (matrix?: readonly number[]) =>\n new JsiSkMatrix(\n CanvasKit,\n matrix\n ? Float32Array.of(...matrix)\n : Float32Array.of(...CanvasKit.Matrix.identity())\n ),\n ColorFilter: new JsiSkColorFilterFactory(CanvasKit),\n Font: (typeface?: SkTypeface, size?: number) =>\n new JsiSkFont(\n CanvasKit,\n new CanvasKit.Font(\n typeface === undefined ? null : JsiSkTypeface.fromValue(typeface),\n size\n )\n ),\n Typeface: new JsiSkTypefaceFactory(CanvasKit),\n MaskFilter: new JsiSkMaskFilterFactory(CanvasKit),\n RuntimeEffect: new JsiSkRuntimeEffectFactory(CanvasKit),\n ImageFilter: new JsiSkImageFilterFactory(CanvasKit),\n Shader: new JsiSkShaderFactory(CanvasKit),\n PathEffect: new JsiSkPathEffectFactory(CanvasKit),\n MakeVertices: MakeVertices.bind(null, CanvasKit),\n Data: new JsiSkDataFactory(CanvasKit),\n Image: new JsiSkImageFactory(CanvasKit),\n SVG: new JsiSkSVGFactory(CanvasKit),\n TextBlob: new JsiSkTextBlobFactory(CanvasKit),\n XYWHRect: (x: number, y: number, width: number, height: number) => {\n return new JsiSkRect(CanvasKit, CanvasKit.XYWHRect(x, y, width, height));\n },\n Surface: new JsiSkSurfaceFactory(CanvasKit),\n TypefaceFontProvider: new JsiSkTypefaceFontProviderFactory(CanvasKit),\n FontMgr: new JsiSkFontMgrFactory(CanvasKit),\n});\n"],"mappings":";;;;;;;AAYA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAC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xDiD;EAyDvDmE,KAAK,EAAE,IAAIC,oCAAJ,CAAsBpE,SAAtB,CAzDgD;EA0DvDqE,GAAG,EAAE,IAAIC,gCAAJ,CAAoBtE,SAApB,CA1DkD;EA2DvDuE,QAAQ,EAAE,IAAIC,0CAAJ,CAAyBxE,SAAzB,CA3D6C;EA4DvDyE,QAAQ,EAAE,CAACvE,CAAD,EAAYC,CAAZ,EAAuBuE,KAAvB,EAAsCC,MAAtC,KAAyD;IACjE,OAAO,IAAIC,oBAAJ,CAAc5E,SAAd,EAAyBA,SAAS,CAACyE,QAAV,CAAmBvE,CAAnB,EAAsBC,CAAtB,EAAyBuE,KAAzB,EAAgCC,MAAhC,CAAzB,CAAP;EACD,CA9DsD;EA+DvDE,OAAO,EAAE,IAAIC,wCAAJ,CAAwB9E,SAAxB,CA/D8C;EAgEvD+E,oBAAoB,EAAE,IAAIC,kEAAJ,CAAqChF,SAArC,CAhEiC;EAiEvDiF,OAAO,EAAE,IAAIC,wCAAJ,CAAwBlF,SAAxB;AAjE8C,CAAjC,CAAjB"}
1
+ {"version":3,"names":["JsiSkApi","CanvasKit","Point","x","y","JsiSkPoint","Float32Array","of","RuntimeShaderBuilder","_","Error","RRectXY","rect","rx","ry","JsiSkRRect","RSXform","scos","ssin","tx","ty","JsiSkRSXform","Color","ContourMeasureIter","path","forceClosed","resScale","JsiSkContourMeasureIter","JsiSkPath","fromValue","Paint","paint","JsiSkPaint","setAntiAlias","PictureRecorder","JsiSkPictureRecorder","Picture","JsiSkPictureFactory","Path","JsiSkPathFactory","Matrix","matrix","JsiSkMatrix","identity","ColorFilter","JsiSkColorFilterFactory","Font","typeface","size","JsiSkFont","undefined","JsiSkTypeface","Typeface","JsiSkTypefaceFactory","MaskFilter","JsiSkMaskFilterFactory","RuntimeEffect","JsiSkRuntimeEffectFactory","ImageFilter","JsiSkImageFilterFactory","Shader","JsiSkShaderFactory","PathEffect","JsiSkPathEffectFactory","MakeVertices","bind","Data","JsiSkDataFactory","Image","JsiSkImageFactory","AnimatedImage","JsiSkAnimatedImageFactory","SVG","JsiSkSVGFactory","TextBlob","JsiSkTextBlobFactory","XYWHRect","width","height","JsiSkRect","Surface","JsiSkSurfaceFactory","TypefaceFontProvider","JsiSkTypefaceFontProviderFactory","FontMgr","JsiSkFontMgrFactory"],"sources":["JsiSkia.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n SkContourMeasureIter,\n Skia,\n SkPath,\n SkRect,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n SkTypeface,\n} from \"../types\";\n\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { Color } from \"./JsiSkColor\";\nimport { JsiSkSurfaceFactory } from \"./JsiSkSurfaceFactory\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\nimport { JsiSkContourMeasureIter } from \"./JsiSkContourMeasureIter\";\nimport { JsiSkPictureRecorder } from \"./JsiSkPictureRecorder\";\nimport { JsiSkPictureFactory } from \"./JsiSkPictureFactory\";\nimport { JsiSkPathFactory } from \"./JsiSkPathFactory\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkColorFilterFactory } from \"./JsiSkColorFilterFactory\";\nimport { JsiSkTypefaceFactory } from \"./JsiSkTypefaceFactory\";\nimport { JsiSkMaskFilterFactory } from \"./JsiSkMaskFilterFactory\";\nimport { JsiSkRuntimeEffectFactory } from \"./JsiSkRuntimeEffectFactory\";\nimport { JsiSkImageFilterFactory } from \"./JsiSkImageFilterFactory\";\nimport { JsiSkShaderFactory } from \"./JsiSkShaderFactory\";\nimport { JsiSkPathEffectFactory } from \"./JsiSkPathEffectFactory\";\nimport { JsiSkDataFactory } from \"./JsiSkDataFactory\";\nimport { JsiSkImageFactory } from \"./JsiSkImageFactory\";\nimport { JsiSkSVGFactory } from \"./JsiSkSVGFactory\";\nimport { JsiSkTextBlobFactory } from \"./JsiSkTextBlobFactory\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { MakeVertices } from \"./JsiSkVerticesFactory\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\nimport { JsiSkTypefaceFontProviderFactory } from \"./JsiSkTypefaceFontProviderFactory\";\nimport { JsiSkFontMgrFactory } from \"./JsiSkFontMgrFactory\";\nimport { JsiSkAnimatedImageFactory } from \"./JsiSkAnimatedImageFactory\";\n\nexport const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({\n Point: (x: number, y: number) =>\n new JsiSkPoint(CanvasKit, Float32Array.of(x, y)),\n RuntimeShaderBuilder: (_: SkRuntimeEffect): SkRuntimeShaderBuilder => {\n throw new Error(\"Not implemented on React Native Web\");\n },\n RRectXY: (rect: SkRect, rx: number, ry: number) =>\n new JsiSkRRect(CanvasKit, rect, rx, ry),\n RSXform: (scos: number, ssin: number, tx: number, ty: number) =>\n new JsiSkRSXform(CanvasKit, Float32Array.of(scos, ssin, tx, ty)),\n Color,\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ): SkContourMeasureIter =>\n new JsiSkContourMeasureIter(\n CanvasKit,\n new CanvasKit.ContourMeasureIter(\n JsiSkPath.fromValue(path),\n forceClosed,\n resScale\n )\n ),\n Paint: () => {\n const paint = new JsiSkPaint(CanvasKit, new CanvasKit.Paint());\n paint.setAntiAlias(true);\n return paint;\n },\n PictureRecorder: () =>\n new JsiSkPictureRecorder(CanvasKit, new CanvasKit.PictureRecorder()),\n Picture: new JsiSkPictureFactory(CanvasKit),\n Path: new JsiSkPathFactory(CanvasKit),\n Matrix: (matrix?: readonly number[]) =>\n new JsiSkMatrix(\n CanvasKit,\n matrix\n ? Float32Array.of(...matrix)\n : Float32Array.of(...CanvasKit.Matrix.identity())\n ),\n ColorFilter: new JsiSkColorFilterFactory(CanvasKit),\n Font: (typeface?: SkTypeface, size?: number) =>\n new JsiSkFont(\n CanvasKit,\n new CanvasKit.Font(\n typeface === undefined ? null : JsiSkTypeface.fromValue(typeface),\n size\n )\n ),\n Typeface: new JsiSkTypefaceFactory(CanvasKit),\n MaskFilter: new JsiSkMaskFilterFactory(CanvasKit),\n RuntimeEffect: new JsiSkRuntimeEffectFactory(CanvasKit),\n ImageFilter: new JsiSkImageFilterFactory(CanvasKit),\n Shader: new JsiSkShaderFactory(CanvasKit),\n PathEffect: new JsiSkPathEffectFactory(CanvasKit),\n MakeVertices: MakeVertices.bind(null, CanvasKit),\n Data: new JsiSkDataFactory(CanvasKit),\n Image: new JsiSkImageFactory(CanvasKit),\n AnimatedImage: new JsiSkAnimatedImageFactory(CanvasKit),\n SVG: new JsiSkSVGFactory(CanvasKit),\n TextBlob: new JsiSkTextBlobFactory(CanvasKit),\n XYWHRect: (x: number, y: number, width: number, height: number) => {\n return new JsiSkRect(CanvasKit, CanvasKit.XYWHRect(x, y, width, height));\n },\n Surface: new JsiSkSurfaceFactory(CanvasKit),\n TypefaceFontProvider: new JsiSkTypefaceFontProviderFactory(CanvasKit),\n FontMgr: new JsiSkFontMgrFactory(CanvasKit),\n});\n"],"mappings":";;;;;;;AAYA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEO,MAAMA,QAAQ,GAAIC,SAAD,KAAiC;EACvDC,KAAK,EAAE,CAACC,CAAD,EAAYC,CAAZ,KACL,IAAIC,sBAAJ,CAAeJ,SAAf,EAA0BK,YAAY,CAACC,EAAb,CAAgBJ,CAAhB,EAAmBC,CAAnB,CAA1B,CAFqD;EAGvDI,oBAAoB,EAAGC,CAAD,IAAgD;IACpE,MAAM,IAAIC,KAAJ,CAAU,qCAAV,CAAN;EACD,CALsD;E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BAAJ,CAAc9E,SAAd,EAAyBA,SAAS,CAAC2E,QAAV,CAAmBzE,CAAnB,EAAsBC,CAAtB,EAAyByE,KAAzB,EAAgCC,MAAhC,CAAzB,CAAP;EACD,CA/DsD;EAgEvDE,OAAO,EAAE,IAAIC,wCAAJ,CAAwBhF,SAAxB,CAhE8C;EAiEvDiF,oBAAoB,EAAE,IAAIC,kEAAJ,CAAqClF,SAArC,CAjEiC;EAkEvDmF,OAAO,EAAE,IAAIC,wCAAJ,CAAwBpF,SAAxB;AAlE8C,CAAjC,CAAjB"}
@@ -1,7 +1,9 @@
1
1
  import type { SharedValueType } from "../../renderer/processors/Animations";
2
2
  export declare const HAS_REANIMATED2: boolean;
3
3
  export declare const HAS_REANIMATED3: boolean;
4
+ export declare function throwOnMissingReanimated(): void;
4
5
  export declare const useSharedValue: any;
6
+ export declare const useFrameCallback: (...args: any[]) => any;
5
7
  export declare const startMapper: any;
6
8
  export declare const stopMapper: any;
7
9
  export declare const runOnJS: any;
@@ -1,11 +1,10 @@
1
- var _Reanimated, _Reanimated2, _Reanimated3, _Reanimated4;
1
+ var _Reanimated, _Reanimated2, _Reanimated3, _Reanimated4, _Reanimated5;
2
2
 
3
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
4
  import { useMemo } from "react";
4
5
  // This one is needed for the deprecated useSharedValue function
5
6
  // We can remove it once we remove the deprecation
6
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
- let Reanimated2; // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
-
7
+ let Reanimated2;
9
8
  let Reanimated3;
10
9
  let reanimatedVersion;
11
10
 
@@ -21,8 +20,7 @@ try {
21
20
 
22
21
  export const HAS_REANIMATED2 = !!Reanimated2;
23
22
  export const HAS_REANIMATED3 = !!Reanimated3;
24
-
25
- function throwOnMissingReanimated2() {
23
+ export function throwOnMissingReanimated() {
26
24
  if (!HAS_REANIMATED2) {
27
25
  throw new Error("Reanimated was not found, make sure react-native-reanimated package is installed if you want to use \
28
26
  react-native-skia's integration layer API.");
@@ -33,16 +31,15 @@ function throwOnMissingReanimated3() {
33
31
  if (!HAS_REANIMATED3) {
34
32
  throw new Error(`Reanimated version ${reanimatedVersion} is not supported, please upgrade to 3.0.0 or newer.`);
35
33
  }
36
-
37
- throwOnMissingReanimated2();
38
34
  }
39
35
 
40
36
  export const useSharedValue = ((_Reanimated = Reanimated2) === null || _Reanimated === void 0 ? void 0 : _Reanimated.useSharedValue) || (value => useMemo(() => ({
41
37
  value
42
38
  }), [value]));
43
- export const startMapper = ((_Reanimated2 = Reanimated2) === null || _Reanimated2 === void 0 ? void 0 : _Reanimated2.startMapper) || throwOnMissingReanimated2;
44
- export const stopMapper = ((_Reanimated3 = Reanimated2) === null || _Reanimated3 === void 0 ? void 0 : _Reanimated3.stopMapper) || throwOnMissingReanimated2;
45
- export const runOnJS = ((_Reanimated4 = Reanimated2) === null || _Reanimated4 === void 0 ? void 0 : _Reanimated4.runOnJS) || throwOnMissingReanimated2;
39
+ export const useFrameCallback = ((_Reanimated2 = Reanimated2) === null || _Reanimated2 === void 0 ? void 0 : _Reanimated2.useFrameCallback) || throwOnMissingReanimated;
40
+ export const startMapper = ((_Reanimated3 = Reanimated2) === null || _Reanimated3 === void 0 ? void 0 : _Reanimated3.startMapper) || throwOnMissingReanimated;
41
+ export const stopMapper = ((_Reanimated4 = Reanimated2) === null || _Reanimated4 === void 0 ? void 0 : _Reanimated4.stopMapper) || throwOnMissingReanimated;
42
+ export const runOnJS = ((_Reanimated5 = Reanimated2) === null || _Reanimated5 === void 0 ? void 0 : _Reanimated5.runOnJS) || throwOnMissingReanimated;
46
43
  export const isSharedValue = value => {
47
44
  throwOnMissingReanimated3();
48
45
  return !!value && Reanimated3.isSharedValue(value);