@shopify/react-native-skia 0.1.134 → 0.1.138
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +4 -47
- package/android/build.gradle +1 -2
- package/cpp/api/JsiSkFont.h +25 -1
- package/cpp/api/JsiSkMatrix.h +12 -0
- package/cpp/api/JsiSkTypeface.h +1 -29
- package/jestSetup.js +5 -0
- package/lib/commonjs/animation/functions/interpolate.js +3 -2
- package/lib/commonjs/animation/functions/interpolate.js.map +1 -1
- package/lib/commonjs/animation/functions/interpolateColors.js +2 -2
- package/lib/commonjs/animation/functions/interpolateColors.js.map +1 -1
- package/lib/commonjs/animation/functions/interpolatePaths.js +45 -11
- package/lib/commonjs/animation/functions/interpolatePaths.js.map +1 -1
- package/lib/commonjs/mock/index.js +121 -177
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/renderer/components/Group.js +1 -1
- package/lib/commonjs/renderer/components/Group.js.map +1 -1
- package/lib/commonjs/renderer/processors/Transform.js +8 -15
- package/lib/commonjs/renderer/processors/Transform.js.map +1 -1
- package/lib/commonjs/skia/core/Data.js +7 -4
- package/lib/commonjs/skia/core/Data.js.map +1 -1
- package/lib/commonjs/skia/types/Font/Font.js.map +1 -1
- package/lib/commonjs/skia/types/Matrix.js +18 -3
- package/lib/commonjs/skia/types/Matrix.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkFont.js +6 -0
- package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkMatrix.js +4 -0
- package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/commonjs/values/api.js +1 -7
- package/lib/commonjs/values/api.js.map +1 -1
- package/lib/commonjs/values/hooks/useComputedValue.js +2 -2
- package/lib/commonjs/values/hooks/useComputedValue.js.map +1 -1
- package/lib/commonjs/views/SkiaView.web.js +27 -37
- package/lib/commonjs/views/SkiaView.web.js.map +1 -1
- package/lib/commonjs/web/LoadSkiaWeb.js +29 -0
- package/lib/commonjs/web/LoadSkiaWeb.js.map +1 -0
- package/lib/commonjs/web/WithSkiaWeb.js +39 -0
- package/lib/commonjs/web/WithSkiaWeb.js.map +1 -0
- package/lib/commonjs/web/index.js +22 -12
- package/lib/commonjs/web/index.js.map +1 -1
- package/lib/module/animation/functions/interpolate.js +2 -2
- package/lib/module/animation/functions/interpolate.js.map +1 -1
- package/lib/module/animation/functions/interpolateColors.js +1 -1
- package/lib/module/animation/functions/interpolateColors.js.map +1 -1
- package/lib/module/animation/functions/interpolatePaths.js +44 -11
- package/lib/module/animation/functions/interpolatePaths.js.map +1 -1
- package/lib/module/mock/index.js +103 -147
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/renderer/components/Group.js +1 -1
- package/lib/module/renderer/components/Group.js.map +1 -1
- package/lib/module/renderer/processors/Transform.js +8 -15
- package/lib/module/renderer/processors/Transform.js.map +1 -1
- package/lib/module/skia/core/Data.js +7 -4
- package/lib/module/skia/core/Data.js.map +1 -1
- package/lib/module/skia/types/Font/Font.js.map +1 -1
- package/lib/module/skia/types/Matrix.js +12 -2
- package/lib/module/skia/types/Matrix.js.map +1 -1
- package/lib/module/skia/web/JsiSkFont.js +6 -0
- package/lib/module/skia/web/JsiSkFont.js.map +1 -1
- package/lib/module/skia/web/JsiSkMatrix.js +4 -0
- package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/module/values/api.js +0 -4
- package/lib/module/values/api.js.map +1 -1
- package/lib/module/values/hooks/useComputedValue.js +1 -1
- package/lib/module/values/hooks/useComputedValue.js.map +1 -1
- package/lib/module/views/SkiaView.web.js +27 -37
- package/lib/module/views/SkiaView.web.js.map +1 -1
- package/lib/module/web/LoadSkiaWeb.js +16 -0
- package/lib/module/web/LoadSkiaWeb.js.map +1 -0
- package/lib/module/web/WithSkiaWeb.js +23 -0
- package/lib/module/web/WithSkiaWeb.js.map +1 -0
- package/lib/module/web/index.js +2 -9
- package/lib/module/web/index.js.map +1 -1
- package/lib/typescript/jestSetup.d.ts +1 -0
- package/lib/typescript/src/animation/functions/interpolate.d.ts +6 -0
- package/lib/typescript/src/animation/functions/interpolatePaths.d.ts +3 -1
- package/lib/typescript/src/mock/index.d.ts +11 -42
- package/lib/typescript/src/renderer/Canvas.d.ts +1 -1
- package/lib/typescript/src/renderer/processors/Transform.d.ts +2 -2
- package/lib/typescript/src/skia/types/Font/Font.d.ts +6 -0
- package/lib/typescript/src/skia/types/Matrix.d.ts +6 -2
- package/lib/typescript/src/skia/types/Typeface/Typeface.d.ts +1 -4
- package/lib/typescript/src/skia/web/JsiSkFont.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkMatrix.d.ts +1 -0
- package/lib/typescript/src/values/api.d.ts +0 -1
- package/lib/typescript/src/views/SkiaView.web.d.ts +4 -6
- package/lib/typescript/src/web/LoadSkiaWeb.d.ts +6 -0
- package/lib/typescript/src/web/WithSkiaWeb.d.ts +12 -0
- package/lib/typescript/src/web/index.d.ts +2 -5
- package/package.json +7 -3
- package/scripts/setup-canvaskit.js +74 -0
- package/src/animation/functions/interpolate.ts +4 -2
- package/src/animation/functions/interpolateColors.ts +1 -1
- package/src/animation/functions/interpolatePaths.ts +59 -10
- package/src/mock/index.ts +103 -149
- package/src/renderer/components/Group.tsx +1 -1
- package/src/renderer/processors/Transform.ts +7 -10
- package/src/skia/core/Data.ts +7 -8
- package/src/skia/types/Font/Font.ts +7 -0
- package/src/skia/types/Matrix.ts +19 -3
- package/src/skia/types/Typeface/Typeface.ts +1 -4
- package/src/skia/web/JsiSkFont.ts +6 -0
- package/src/skia/web/JsiSkMatrix.ts +4 -0
- package/src/values/api.ts +0 -2
- package/src/values/hooks/useComputedValue.ts +1 -1
- package/src/views/SkiaView.web.tsx +36 -43
- package/src/web/LoadSkiaWeb.tsx +24 -0
- package/src/web/WithSkiaWeb.tsx +37 -0
- package/src/web/index.ts +2 -15
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["interpolateColors.ts"],"names":["mix","Skia","interpolate","interpolateColorsRGB","value","inputRange","outputRange","r","map","c","g","b","a","Float32Array","interpolateColors","_outputRange","cl","Color","mixColors","x","y","c1","c2"],"mappings":"AAAA,SAASA,GAAT,QAAoB,
|
1
|
+
{"version":3,"sources":["interpolateColors.ts"],"names":["mix","Skia","interpolate","interpolateColorsRGB","value","inputRange","outputRange","r","map","c","g","b","a","Float32Array","interpolateColors","_outputRange","cl","Color","mixColors","x","y","c1","c2"],"mappings":"AAAA,SAASA,GAAT,QAAoB,gCAApB;AAEA,SAASC,IAAT,QAAqB,YAArB;AAEA,SAASC,WAAT,QAA4B,eAA5B;;AAEA,MAAMC,oBAAoB,GAAG,CAC3BC,KAD2B,EAE3BC,UAF2B,EAG3BC,WAH2B,KAIxB;AACH,QAAMC,CAAC,GAAGL,WAAW,CACnBE,KADmB,EAEnBC,UAFmB,EAGnBC,WAAW,CAACE,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAAC,CAAD,CAAxB,CAHmB,EAInB,OAJmB,CAArB;AAMA,QAAMC,CAAC,GAAGR,WAAW,CACnBE,KADmB,EAEnBC,UAFmB,EAGnBC,WAAW,CAACE,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAAC,CAAD,CAAxB,CAHmB,EAInB,OAJmB,CAArB;AAMA,QAAME,CAAC,GAAGT,WAAW,CACnBE,KADmB,EAEnBC,UAFmB,EAGnBC,WAAW,CAACE,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAAC,CAAD,CAAxB,CAHmB,EAInB,OAJmB,CAArB;AAMA,QAAMG,CAAC,GAAGV,WAAW,CACnBE,KADmB,EAEnBC,UAFmB,EAGnBC,WAAW,CAACE,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAAC,CAAD,CAAxB,CAHmB,EAInB,OAJmB,CAArB;AAMA,SAAO,IAAII,YAAJ,CAAiB,CAACN,CAAD,EAAIG,CAAJ,EAAOC,CAAP,EAAUC,CAAV,CAAjB,CAAP;AACD,CA9BD;;AAgCA,OAAO,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,IAAQf,IAAI,CAACgB,KAAL,CAAWD,EAAX,CAAzB,CAApB;;AACA,SAAOb,oBAAoB,CAACC,KAAD,EAAQC,UAAR,EAAoBC,WAApB,CAA3B;AACD,CAPM;AASP,OAAO,MAAMY,SAAS,GAAG,CAACd,KAAD,EAAgBe,CAAhB,EAA0BC,CAA1B,KAAuC;AAC9D,QAAMC,EAAE,GAAGpB,IAAI,CAACgB,KAAL,CAAWE,CAAX,CAAX;AACA,QAAMG,EAAE,GAAGrB,IAAI,CAACgB,KAAL,CAAWG,CAAX,CAAX;AACA,SAAO,IAAIP,YAAJ,CAAiB,CACtBb,GAAG,CAACI,KAAD,EAAQiB,EAAE,CAAC,CAAD,CAAV,EAAeC,EAAE,CAAC,CAAD,CAAjB,CADmB,EAEtBtB,GAAG,CAACI,KAAD,EAAQiB,EAAE,CAAC,CAAD,CAAV,EAAeC,EAAE,CAAC,CAAD,CAAjB,CAFmB,EAGtBtB,GAAG,CAACI,KAAD,EAAQiB,EAAE,CAAC,CAAD,CAAV,EAAeC,EAAE,CAAC,CAAD,CAAjB,CAHmB,EAItBtB,GAAG,CAACI,KAAD,EAAQiB,EAAE,CAAC,CAAD,CAAV,EAAeC,EAAE,CAAC,CAAD,CAAjB,CAJmB,CAAjB,CAAP;AAMD,CATM","sourcesContent":["import { mix } from \"../../renderer/processors/math\";\nimport type { Color, SkColor } from \"../../skia\";\nimport { Skia } from \"../../skia\";\n\nimport { interpolate } from \"./interpolate\";\n\nconst interpolateColorsRGB = (\n value: number,\n inputRange: number[],\n outputRange: SkColor[]\n) => {\n const r = interpolate(\n value,\n inputRange,\n outputRange.map((c) => c[0]),\n \"clamp\"\n );\n const g = interpolate(\n value,\n inputRange,\n outputRange.map((c) => c[1]),\n \"clamp\"\n );\n const b = interpolate(\n value,\n inputRange,\n outputRange.map((c) => c[2]),\n \"clamp\"\n );\n const a = interpolate(\n value,\n inputRange,\n outputRange.map((c) => c[3]),\n \"clamp\"\n );\n return new Float32Array([r, g, b, a]);\n};\n\nexport const interpolateColors = (\n value: number,\n inputRange: number[],\n _outputRange: Color[]\n) => {\n const outputRange = _outputRange.map((cl) => Skia.Color(cl));\n return interpolateColorsRGB(value, inputRange, outputRange);\n};\n\nexport const mixColors = (value: number, x: Color, y: Color) => {\n const c1 = Skia.Color(x);\n const c2 = Skia.Color(y);\n return new Float32Array([\n mix(value, c1[0], c2[0]),\n mix(value, c1[1], c2[1]),\n mix(value, c1[2], c2[2]),\n mix(value, c1[3], c2[3]),\n ]);\n};\n"]}
|
@@ -1,8 +1,16 @@
|
|
1
|
+
import { exhaustiveCheck } from "../../renderer/typeddash";
|
2
|
+
import { validateInterpolationOptions, Extrapolate } from "./interpolate";
|
3
|
+
|
4
|
+
const lerp = (value, from, to, p1, p2) => {
|
5
|
+
const t = (value - from) / (to - from);
|
6
|
+
return p2.interpolate(p1, t);
|
7
|
+
};
|
1
8
|
/**
|
2
9
|
* Maps an input value within a range to an output path within a path range.
|
3
10
|
* @param value - The input value.
|
4
11
|
* @param inputRange - The range of the input value.
|
5
12
|
* @param outputRange - The range of the output path.
|
13
|
+
* @param options - Extrapolation options
|
6
14
|
* @returns The output path.
|
7
15
|
* @example <caption>Map a value between 0 and 1 to a path between two paths.</caption>
|
8
16
|
* const path1 = new Path();
|
@@ -13,24 +21,49 @@
|
|
13
21
|
* path2.lineTo(0, 100);
|
14
22
|
* const path = interpolatePath(0.5, [0, 1], [path1, path2]);
|
15
23
|
*/
|
16
|
-
|
24
|
+
|
25
|
+
|
26
|
+
export const interpolatePaths = (value, input, outputRange, options) => {
|
27
|
+
const extrapolation = validateInterpolationOptions(options);
|
28
|
+
|
29
|
+
if (value < input[0]) {
|
30
|
+
switch (extrapolation.extrapolateLeft) {
|
31
|
+
case Extrapolate.CLAMP:
|
32
|
+
return outputRange[0];
|
33
|
+
|
34
|
+
case Extrapolate.EXTEND:
|
35
|
+
return lerp(value, input[0], input[1], outputRange[0], outputRange[1]);
|
36
|
+
|
37
|
+
case Extrapolate.IDENTITY:
|
38
|
+
throw new Error("Identity is not a supported extrapolation type for interpolatePaths()");
|
39
|
+
|
40
|
+
default:
|
41
|
+
exhaustiveCheck(extrapolation.extrapolateLeft);
|
42
|
+
}
|
43
|
+
} else if (value > input[input.length - 1]) {
|
44
|
+
switch (extrapolation.extrapolateRight) {
|
45
|
+
case Extrapolate.CLAMP:
|
46
|
+
return outputRange[outputRange.length - 1];
|
47
|
+
|
48
|
+
case Extrapolate.EXTEND:
|
49
|
+
return lerp(value, input[input.length - 2], input[input.length - 1], outputRange[input.length - 2], outputRange[input.length - 1]);
|
50
|
+
|
51
|
+
case Extrapolate.IDENTITY:
|
52
|
+
throw new Error("Identity is not a supported extrapolation type for interpolatePaths()");
|
53
|
+
|
54
|
+
default:
|
55
|
+
exhaustiveCheck(extrapolation.extrapolateRight);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
17
59
|
let i = 0;
|
18
60
|
|
19
61
|
for (; i <= input.length - 1; i++) {
|
20
62
|
if (value >= input[i] && value <= input[i + 1]) {
|
21
63
|
break;
|
22
64
|
}
|
23
|
-
|
24
|
-
if (i === input.length - 1) {
|
25
|
-
if (value < input[0]) {
|
26
|
-
return outputRange[0];
|
27
|
-
} else {
|
28
|
-
return outputRange[i];
|
29
|
-
}
|
30
|
-
}
|
31
65
|
}
|
32
66
|
|
33
|
-
|
34
|
-
return outputRange[i + 1].interpolate(outputRange[i], t);
|
67
|
+
return lerp(value, input[i], input[i + 1], outputRange[i], outputRange[i + 1]);
|
35
68
|
};
|
36
69
|
//# sourceMappingURL=interpolatePaths.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["interpolatePaths.ts"],"names":["
|
1
|
+
{"version":3,"sources":["interpolatePaths.ts"],"names":["exhaustiveCheck","validateInterpolationOptions","Extrapolate","lerp","value","from","to","p1","p2","t","interpolate","interpolatePaths","input","outputRange","options","extrapolation","extrapolateLeft","CLAMP","EXTEND","IDENTITY","Error","length","extrapolateRight","i"],"mappings":"AACA,SAASA,eAAT,QAAgC,0BAAhC;AAGA,SAASC,4BAAT,EAAuCC,WAAvC,QAA0D,eAA1D;;AAEA,MAAMC,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;;;AACA,OAAO,MAAME,gBAAgB,GAAG,CAC9BP,KAD8B,EAE9BQ,KAF8B,EAG9BC,WAH8B,EAI9BC,OAJ8B,KAK3B;AACH,QAAMC,aAAa,GAAGd,4BAA4B,CAACa,OAAD,CAAlD;;AACA,MAAIV,KAAK,GAAGQ,KAAK,CAAC,CAAD,CAAjB,EAAsB;AACpB,YAAQG,aAAa,CAACC,eAAtB;AACE,WAAKd,WAAW,CAACe,KAAjB;AACE,eAAOJ,WAAW,CAAC,CAAD,CAAlB;;AACF,WAAKX,WAAW,CAACgB,MAAjB;AACE,eAAOf,IAAI,CAACC,KAAD,EAAQQ,KAAK,CAAC,CAAD,CAAb,EAAkBA,KAAK,CAAC,CAAD,CAAvB,EAA4BC,WAAW,CAAC,CAAD,CAAvC,EAA4CA,WAAW,CAAC,CAAD,CAAvD,CAAX;;AACF,WAAKX,WAAW,CAACiB,QAAjB;AACE,cAAM,IAAIC,KAAJ,CACJ,uEADI,CAAN;;AAGF;AACEpB,QAAAA,eAAe,CAACe,aAAa,CAACC,eAAf,CAAf;AAVJ;AAYD,GAbD,MAaO,IAAIZ,KAAK,GAAGQ,KAAK,CAACA,KAAK,CAACS,MAAN,GAAe,CAAhB,CAAjB,EAAqC;AAC1C,YAAQN,aAAa,CAACO,gBAAtB;AACE,WAAKpB,WAAW,CAACe,KAAjB;AACE,eAAOJ,WAAW,CAACA,WAAW,CAACQ,MAAZ,GAAqB,CAAtB,CAAlB;;AACF,WAAKnB,WAAW,CAACgB,MAAjB;AACE,eAAOf,IAAI,CACTC,KADS,EAETQ,KAAK,CAACA,KAAK,CAACS,MAAN,GAAe,CAAhB,CAFI,EAGTT,KAAK,CAACA,KAAK,CAACS,MAAN,GAAe,CAAhB,CAHI,EAITR,WAAW,CAACD,KAAK,CAACS,MAAN,GAAe,CAAhB,CAJF,EAKTR,WAAW,CAACD,KAAK,CAACS,MAAN,GAAe,CAAhB,CALF,CAAX;;AAOF,WAAKnB,WAAW,CAACiB,QAAjB;AACE,cAAM,IAAIC,KAAJ,CACJ,uEADI,CAAN;;AAGF;AACEpB,QAAAA,eAAe,CAACe,aAAa,CAACO,gBAAf,CAAf;AAhBJ;AAkBD;;AACD,MAAIC,CAAC,GAAG,CAAR;;AACA,SAAOA,CAAC,IAAIX,KAAK,CAACS,MAAN,GAAe,CAA3B,EAA8BE,CAAC,EAA/B,EAAmC;AACjC,QAAInB,KAAK,IAAIQ,KAAK,CAACW,CAAD,CAAd,IAAqBnB,KAAK,IAAIQ,KAAK,CAACW,CAAC,GAAG,CAAL,CAAvC,EAAgD;AAC9C;AACD;AACF;;AACD,SAAOpB,IAAI,CACTC,KADS,EAETQ,KAAK,CAACW,CAAD,CAFI,EAGTX,KAAK,CAACW,CAAC,GAAG,CAAL,CAHI,EAITV,WAAW,CAACU,CAAD,CAJF,EAKTV,WAAW,CAACU,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"]}
|
package/lib/module/mock/index.js
CHANGED
@@ -1,152 +1,108 @@
|
|
1
|
-
|
2
|
-
*
|
3
|
-
*
|
4
|
-
*
|
5
|
-
|
6
|
-
*
|
7
|
-
*
|
8
|
-
*
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
2
|
+
import * as Values from "../values/web";
|
3
|
+
import * as ValuesHooks from "../values/hooks";
|
4
|
+
import * as BaseSkia from "../skia/types";
|
5
|
+
import { useSharedValueEffect } from "../external/reanimated/useSharedValueEffect";
|
6
|
+
import * as timingFunctions from "../animation/timing";
|
7
|
+
import * as springFunctions from "../animation/spring";
|
8
|
+
import * as decayFunctions from "../animation/decay";
|
9
|
+
import * as interpolateFn from "../animation/functions/interpolate";
|
10
|
+
import * as interpolatePathFn from "../animation/functions/interpolatePaths";
|
11
|
+
import * as interpolateVectorFn from "../animation/functions/interpolateVector";
|
12
|
+
import { ShaderLib } from "../renderer/components/shaders/ShaderLib";
|
12
13
|
|
13
|
-
|
14
|
+
class Stub {
|
15
|
+
constructor() {
|
16
|
+
return new Proxy(() => {}, {
|
17
|
+
get: () => new Stub(),
|
18
|
+
apply: () => new Stub(),
|
19
|
+
set: () => true
|
20
|
+
});
|
21
|
+
}
|
14
22
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
MakeTurbulence: Noop,
|
75
|
-
MakeFractalNoise: Noop,
|
76
|
-
MakeBlend: Noop,
|
77
|
-
MakeColor: Noop
|
78
|
-
},
|
79
|
-
PathEffect: {
|
80
|
-
MakeCorner: Noop,
|
81
|
-
MakeDash: Noop,
|
82
|
-
MakeDiscrete: Noop,
|
83
|
-
MakeCompose: Noop,
|
84
|
-
MakeSum: Noop,
|
85
|
-
MakeLine2D: Noop,
|
86
|
-
MakePath1D: Noop,
|
87
|
-
MakePath2D: Noop
|
88
|
-
},
|
89
|
-
MakeVertices: Noop,
|
90
|
-
Data: {
|
91
|
-
fromURI: Noop,
|
92
|
-
fromBytes: Noop,
|
93
|
-
fromBase64: Noop
|
94
|
-
},
|
95
|
-
Image: {
|
96
|
-
MakeImageFromEncoded: Noop,
|
97
|
-
MakeImage: Noop
|
98
|
-
},
|
99
|
-
SVG: {
|
100
|
-
MakeFromData: Noop,
|
101
|
-
MakeFromString: Noop
|
102
|
-
},
|
103
|
-
FontMgr: {
|
104
|
-
RefDefault: Noop
|
105
|
-
},
|
106
|
-
TextBlob: {
|
107
|
-
MakeFromText: Noop,
|
108
|
-
MakeFromGlyphs: Noop,
|
109
|
-
MakeFromRSXform: Noop,
|
110
|
-
MakeFromRSXformGlyphs: Noop
|
23
|
+
}
|
24
|
+
|
25
|
+
const Noop = () => {};
|
26
|
+
|
27
|
+
export const Skia = new Stub();
|
28
|
+
export const vec = (x, y) => {
|
29
|
+
var _ref;
|
30
|
+
|
31
|
+
return {
|
32
|
+
x: x !== null && x !== void 0 ? x : 0,
|
33
|
+
y: (_ref = y !== null && y !== void 0 ? y : x) !== null && _ref !== void 0 ? _ref : 0
|
34
|
+
};
|
35
|
+
};
|
36
|
+
export const Mock = {
|
37
|
+
// SkiaExports
|
38
|
+
// 1. Skia API. BaseSkia contains the enums, and functions like isPaint etc
|
39
|
+
Skia,
|
40
|
+
...BaseSkia,
|
41
|
+
// 2. Hooks
|
42
|
+
useDataCollection: Noop,
|
43
|
+
useRawData: Noop,
|
44
|
+
useData: Noop,
|
45
|
+
useFont: Noop,
|
46
|
+
useTypeface: Noop,
|
47
|
+
useImage: Noop,
|
48
|
+
usePath: Noop,
|
49
|
+
useSVG: Noop,
|
50
|
+
useTextPath: Noop,
|
51
|
+
usePaint: Noop,
|
52
|
+
usePicture: Noop,
|
53
|
+
useSvgPath: Noop,
|
54
|
+
// 3. Point/Rect/Transform utilities
|
55
|
+
vec,
|
56
|
+
rect: (x, y, width, height) => ({
|
57
|
+
x,
|
58
|
+
y,
|
59
|
+
width,
|
60
|
+
height
|
61
|
+
}),
|
62
|
+
rrect: (r, rx, ry) => ({
|
63
|
+
rect: r,
|
64
|
+
rx,
|
65
|
+
ry
|
66
|
+
}),
|
67
|
+
point: vec,
|
68
|
+
add: (a, b) => vec(a.x + b.x, a.y + b.y),
|
69
|
+
sub: (a, b) => vec(a.x - b.x, a.y - b.y),
|
70
|
+
neg: a => vec(-a.x, -a.y),
|
71
|
+
dist: (a, b) => Math.hypot(a.x - b.x, a.y - b.y),
|
72
|
+
translate: _ref2 => {
|
73
|
+
let {
|
74
|
+
x,
|
75
|
+
y
|
76
|
+
} = _ref2;
|
77
|
+
return [{
|
78
|
+
translateX: x
|
79
|
+
}, {
|
80
|
+
translateY: y
|
81
|
+
}];
|
111
82
|
},
|
112
|
-
|
113
|
-
|
114
|
-
|
83
|
+
bounds: Noop,
|
84
|
+
topLeft: Noop,
|
85
|
+
topRight: Noop,
|
86
|
+
bottomLeft: Noop,
|
87
|
+
bottomRight: Noop,
|
88
|
+
center: Noop,
|
89
|
+
processTransform2d: Noop,
|
90
|
+
// ExternalExports
|
91
|
+
useSharedValueEffect,
|
92
|
+
// ValueExports
|
93
|
+
...Values,
|
94
|
+
...ValuesHooks,
|
95
|
+
// Animations
|
96
|
+
...timingFunctions,
|
97
|
+
...springFunctions,
|
98
|
+
...decayFunctions,
|
99
|
+
...interpolateFn,
|
100
|
+
...interpolatePathFn,
|
101
|
+
...interpolateVectorFn,
|
102
|
+
interpolateColors: (_value, _inputRange, _outputRange) => Float32Array.of(0, 0, 0, 0),
|
103
|
+
mixColors: (_v, _x, _y) => Float32Array.of(0, 0, 0, 0),
|
104
|
+
ShaderLib,
|
105
|
+
createDrawing: Noop,
|
106
|
+
createDeclaration: Noop
|
115
107
|
};
|
116
|
-
export const vec = (x, y) => ({
|
117
|
-
x,
|
118
|
-
y
|
119
|
-
});
|
120
|
-
export const rect = (x, y, width, height) => ({
|
121
|
-
x,
|
122
|
-
y,
|
123
|
-
width,
|
124
|
-
height
|
125
|
-
});
|
126
|
-
export const rrect = (r, rx, ry) => ({
|
127
|
-
rect: r,
|
128
|
-
rx,
|
129
|
-
ry
|
130
|
-
});
|
131
|
-
export const useTouchHandler = Noop;
|
132
|
-
export const useComputedValue = Noop;
|
133
|
-
export const useValue = Noop;
|
134
|
-
export const useClockValue = Noop;
|
135
|
-
export const useValueEffect = Noop;
|
136
|
-
export const useTiming = Noop;
|
137
|
-
export const runTiming = Noop;
|
138
|
-
export const timing = Noop;
|
139
|
-
export const useSpring = Noop;
|
140
|
-
export const runSpring = Noop;
|
141
|
-
export const spring = Noop;
|
142
|
-
export const runDecay = Noop;
|
143
|
-
export const decay = Noop;
|
144
|
-
export const useSharedValueEffect = Noop;
|
145
|
-
export const useData = Noop;
|
146
|
-
export const useDataCollection = Noop;
|
147
|
-
export const useFont = Noop;
|
148
|
-
export const useImage = Noop;
|
149
|
-
export const usePicture = Noop;
|
150
|
-
export const useSVG = Noop;
|
151
|
-
export const useTypeface = Noop;
|
152
108
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["
|
1
|
+
{"version":3,"sources":["index.ts"],"names":["Values","ValuesHooks","BaseSkia","useSharedValueEffect","timingFunctions","springFunctions","decayFunctions","interpolateFn","interpolatePathFn","interpolateVectorFn","ShaderLib","Stub","constructor","Proxy","get","apply","set","Noop","Skia","vec","x","y","Mock","useDataCollection","useRawData","useData","useFont","useTypeface","useImage","usePath","useSVG","useTextPath","usePaint","usePicture","useSvgPath","rect","width","height","rrect","r","rx","ry","point","add","a","b","sub","neg","dist","Math","hypot","translate","translateX","translateY","bounds","topLeft","topRight","bottomLeft","bottomRight","center","processTransform2d","interpolateColors","_value","_inputRange","_outputRange","Float32Array","of","mixColors","_v","_x","_y","createDrawing","createDeclaration"],"mappings":"AAAA;AAGA,OAAO,KAAKA,MAAZ,MAAwB,eAAxB;AACA,OAAO,KAAKC,WAAZ,MAA6B,iBAA7B;AACA,OAAO,KAAKC,QAAZ,MAA0B,eAA1B;AAKA,SAASC,oBAAT,QAAqC,6CAArC;AACA,OAAO,KAAKC,eAAZ,MAAiC,qBAAjC;AACA,OAAO,KAAKC,eAAZ,MAAiC,qBAAjC;AACA,OAAO,KAAKC,cAAZ,MAAgC,oBAAhC;AACA,OAAO,KAAKC,aAAZ,MAA+B,oCAA/B;AACA,OAAO,KAAKC,iBAAZ,MAAmC,yCAAnC;AACA,OAAO,KAAKC,mBAAZ,MAAqC,0CAArC;AACA,SAASC,SAAT,QAA0B,0CAA1B;;AAEA,MAAMC,IAAN,CAAW;AACTC,EAAAA,WAAW,GAAG;AACZ,WAAO,IAAIC,KAAJ,CAAU,MAAM,CAAE,CAAlB,EAAoB;AACzBC,MAAAA,GAAG,EAAE,MAAM,IAAIH,IAAJ,EADc;AAEzBI,MAAAA,KAAK,EAAE,MAAM,IAAIJ,IAAJ,EAFY;AAGzBK,MAAAA,GAAG,EAAE,MAAM;AAHc,KAApB,CAAP;AAKD;;AAPQ;;AAUX,MAAMC,IAAe,GAAG,MAAM,CAAE,CAAhC;;AAEA,OAAO,MAAMC,IAAa,GAAG,IAAIP,IAAJ,EAAtB;AAEP,OAAO,MAAMQ,GAAG,GAAG,CAACC,CAAD,EAAaC,CAAb;AAAA;;AAAA,SAA6B;AAAED,IAAAA,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uDJ,KAAGC,aAvDC;AAwDJ,KAAGC,iBAxDC;AAyDJ,KAAGC,mBAzDC;AA0DJoD,EAAAA,iBAAiB,EAAE,CACjBC,MADiB,EAEjBC,WAFiB,EAGjBC,YAHiB,KAIdC,YAAY,CAACC,EAAb,CAAgB,CAAhB,EAAmB,CAAnB,EAAsB,CAAtB,EAAyB,CAAzB,CA9DD;AA+DJC,EAAAA,SAAS,EAAE,CAACC,EAAD,EAAaC,EAAb,EAAwBC,EAAxB,KAAsCL,YAAY,CAACC,EAAb,CAAgB,CAAhB,EAAmB,CAAnB,EAAsB,CAAtB,EAAyB,CAAzB,CA/D7C;AAgEJxD,EAAAA,SAhEI;AAiEJ6D,EAAAA,aAAa,EAAEtD,IAjEX;AAkEJuD,EAAAA,iBAAiB,EAAEvD;AAlEf,CAPC","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { Color, Skia as SkiaApi, SkRect, Vector } from \"../skia/types\";\nimport * as Values from \"../values/web\";\nimport * as ValuesHooks from \"../values/hooks\";\nimport * as BaseSkia from \"../skia/types\";\nimport type * as SkiaExports from \"../skia\";\nimport type * as ExternalExports from \"../external\";\nimport type * as ValueExports from \"../values\";\nimport type * as AnimationExports from \"../animation\";\nimport { useSharedValueEffect } from \"../external/reanimated/useSharedValueEffect\";\nimport * as timingFunctions from \"../animation/timing\";\nimport * as springFunctions from \"../animation/spring\";\nimport * as decayFunctions from \"../animation/decay\";\nimport * as interpolateFn from \"../animation/functions/interpolate\";\nimport * as interpolatePathFn from \"../animation/functions/interpolatePaths\";\nimport * as interpolateVectorFn from \"../animation/functions/interpolateVector\";\nimport { ShaderLib } from \"../renderer/components/shaders/ShaderLib\";\n\nclass Stub {\n constructor() {\n return new Proxy(() => {}, {\n get: () => new Stub(),\n apply: () => new Stub(),\n set: () => true,\n });\n }\n}\n\nconst Noop: () => any = () => {};\n\nexport const Skia: SkiaApi = new Stub() as any;\n\nexport const vec = (x?: number, y?: number) => ({ x: x ?? 0, y: y ?? x ?? 0 });\n\nexport const Mock: typeof SkiaExports &\n typeof ExternalExports &\n typeof ValueExports &\n typeof AnimationExports & {\n createDrawing: () => any;\n createDeclaration: () => any;\n ShaderLib: typeof ShaderLib;\n } = {\n // SkiaExports\n // 1. Skia API. BaseSkia contains the enums, and functions like isPaint etc\n Skia,\n ...BaseSkia,\n // 2. Hooks\n useDataCollection: Noop,\n useRawData: Noop,\n useData: Noop,\n useFont: Noop,\n useTypeface: Noop,\n useImage: Noop,\n usePath: Noop,\n useSVG: Noop,\n useTextPath: Noop,\n usePaint: Noop,\n usePicture: Noop,\n useSvgPath: Noop,\n // 3. Point/Rect/Transform utilities\n vec,\n rect: (x: number, y: number, width: number, height: number) => ({\n x,\n y,\n width,\n height,\n }),\n rrect: (r: SkRect, rx: number, ry: number) => ({\n rect: r,\n rx,\n ry,\n }),\n point: vec,\n add: (a: Vector, b: Vector) => vec(a.x + b.x, a.y + b.y),\n sub: (a: Vector, b: Vector) => vec(a.x - b.x, a.y - b.y),\n neg: (a: Vector) => vec(-a.x, -a.y),\n dist: (a: Vector, b: Vector) => Math.hypot(a.x - b.x, a.y - b.y),\n translate: ({ x, y }: Vector) =>\n [{ translateX: x }, { translateY: y }] as const,\n\n bounds: Noop,\n topLeft: Noop,\n topRight: Noop,\n bottomLeft: Noop,\n bottomRight: Noop,\n center: Noop,\n processTransform2d: Noop,\n // ExternalExports\n useSharedValueEffect,\n // ValueExports\n ...Values,\n ...ValuesHooks,\n // Animations\n ...timingFunctions,\n ...springFunctions,\n ...decayFunctions,\n ...interpolateFn,\n ...interpolatePathFn,\n ...interpolateVectorFn,\n interpolateColors: (\n _value: number,\n _inputRange: number[],\n _outputRange: Color[]\n ) => Float32Array.of(0, 0, 0, 0),\n mixColors: (_v: number, _x: Color, _y: Color) => Float32Array.of(0, 0, 0, 0),\n ShaderLib,\n createDrawing: Noop,\n createDeclaration: Noop,\n};\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Group.tsx"],"names":["React","ClipOp","processCanvasTransform","processPaint","processClip","createDrawing","DrawingNode","isDeclarationNode","isSkPaint","obj","__typename__","onDraw","ctx","node","layer","clip","invertClip","groupProps","canvas","opacity","Skia","declarations","children","filter","map","child","draw","drawings","paint","copy","hasTransform","transform","matrix","hasClip","shouldSave","saveLayer","current","undefined","save","op","Difference","Intersect","visit","restore","Group","props"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAIA,SAASC,MAAT,QAAuB,kBAAvB;AACA,SACEC,sBADF,EAEEC,YAFF,EAGEC,WAHF,QAIO,eAJP;AAWA,SAASC,aAAT,EAAwBC,WAAxB,QAA2C,UAA3C;AACA,SAASC,iBAAT,QAAkC,sBAAlC;;AAEA,MAAMC,SAAS,GAAIC,GAAD,IAChB,kBAAkBA,GAAlB,IAAyBA,GAAG,CAACC,YAAJ,KAAqB,OADhD;;AASA,MAAMC,MAAM,GAAGN,aAAa,CAC1B,CAACO,GAAD,QAAkDC,IAAlD,KAA2D;AAAA,MAArD;AAAEC,IAAAA,KAAF;AAASC,IAAAA,IAAT;AAAeC,IAAAA,UAAf;AAA2B,OAAGC;AAA9B,GAAqD;AACzD,QAAM;AAAEC,IAAAA,MAAF;AAAUC,IAAAA,OAAV;AAAmBC,IAAAA;AAAnB,MAA4BR,GAAlC;AACA,QAAMS,YAAY,GAAGR,IAAI,CAACS,QAAL,CAClBC,MADkB,CACXhB,iBADW,EAElBiB,GAFkB,CAEbC,KAAD,IAAWA,KAAK,CAACC,IAAN,CAAWd,GAAX,CAFG,CAArB;AAIA,QAAMe,QAAQ,GAAGd,IAAI,CAACS,QAAL,CAAcC,MAAd,CACdE,KAAD,IAAWA,KAAK,YAAYnB,WADb,CAAjB;AAGA,QAAMsB,KAAK,GAAGzB,YAAY,CACxBS,GAAG,CAACQ,IADoB,EAExBR,GAAG,CAACgB,KAAJ,CAAUC,IAAV,EAFwB,EAGxBV,OAHwB,EAIxBF,UAJwB,EAKxBI,YALwB,CAA1B;AAOA,QAAMS,YAAY,GAAG,CAAC,CAACb,UAAU,CAACc,SAAb,IAA0B,CAAC,CAACd,UAAU,CAACe,MAA5D;AACA,QAAMC,OAAO,GAAG,CAAC,CAAClB,IAAlB;AACA,QAAMmB,UAAU,GAAGJ,YAAY,IAAIG,OAAhB,IAA2B,CAAC,CAACnB,KAAhD;;AACA,MAAIoB,UAAJ,EAAgB;AACd,QAAIpB,KAAJ,EAAW;AACT,UAAI,OAAOA,KAAP,KAAiB,SAArB,EAAgC;AAC9BI,QAAAA,MAAM,CAACiB,SAAP;AACD,OAFD,MAEO,IAAI3B,SAAS,CAACM,KAAD,CAAb,EAAsB;AAC3BI,QAAAA,MAAM,CAACiB,SAAP,CAAiBrB,KAAjB;AACD,OAFM,MAEA;AAAA;;AACLI,QAAAA,MAAM,CAACiB,SAAP,mBAAiBrB,KAAK,CAACsB,OAAvB,2DAAkCC,SAAlC;AACD;AACF,KARD,MAQO;AACLnB,MAAAA,MAAM,CAACoB,IAAP;AACD;;AACDpC,IAAAA,sBAAsB,
|
1
|
+
{"version":3,"sources":["Group.tsx"],"names":["React","ClipOp","processCanvasTransform","processPaint","processClip","createDrawing","DrawingNode","isDeclarationNode","isSkPaint","obj","__typename__","onDraw","ctx","node","layer","clip","invertClip","groupProps","canvas","opacity","Skia","declarations","children","filter","map","child","draw","drawings","paint","copy","hasTransform","transform","matrix","hasClip","shouldSave","saveLayer","current","undefined","save","op","Difference","Intersect","visit","restore","Group","props"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAIA,SAASC,MAAT,QAAuB,kBAAvB;AACA,SACEC,sBADF,EAEEC,YAFF,EAGEC,WAHF,QAIO,eAJP;AAWA,SAASC,aAAT,EAAwBC,WAAxB,QAA2C,UAA3C;AACA,SAASC,iBAAT,QAAkC,sBAAlC;;AAEA,MAAMC,SAAS,GAAIC,GAAD,IAChB,kBAAkBA,GAAlB,IAAyBA,GAAG,CAACC,YAAJ,KAAqB,OADhD;;AASA,MAAM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C;AACD;AACF,KARD,MAQO;AACLnB,MAAAA,MAAM,CAACoB,IAAP;AACD;;AACDpC,IAAAA,sBAAsB,CAACgB,MAAD,EAASD,UAAT,CAAtB;;AACA,QAAIF,IAAJ,EAAU;AACR,YAAMwB,EAAE,GAAGvB,UAAU,GAAGf,MAAM,CAACuC,UAAV,GAAuBvC,MAAM,CAACwC,SAAnD;AACArC,MAAAA,WAAW,CAACgB,IAAD,EAAOF,MAAP,EAAeH,IAAf,EAAqBwB,EAArB,CAAX;AACD;AACF;;AACD1B,EAAAA,IAAI,CAAC6B,KAAL,CACE,EACE,GAAG9B,GADL;AAEEgB,IAAAA,KAFF;AAGET,IAAAA,OAAO,EAAEF,UAAU,CAACE,OAAX,GAAqBF,UAAU,CAACE,OAAX,GAAqBA,OAA1C,GAAoDA;AAH/D,GADF,EAMEQ,QANF;;AAQA,MAAIO,UAAJ,EAAgB;AACdhB,IAAAA,MAAM,CAACyB,OAAP;AACD;AACF,CAjDyB,CAA5B;AAoDA,OAAO,MAAMC,KAAK,GAAIC,KAAD,IAAsC;AACzD,sBAAO;AAAW,IAAA,MAAM,EAAElC;AAAnB,KAA+BkC,KAA/B;AAAsC,IAAA,cAAc;AAApD,KAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\nimport type { RefObject } from \"react\";\n\nimport type { SkPaint } from \"../../skia/types\";\nimport { ClipOp } from \"../../skia/types\";\nimport {\n processCanvasTransform,\n processPaint,\n processClip,\n} from \"../processors\";\nimport type {\n CustomPaintProps,\n TransformProps,\n AnimatedProps,\n ClipDef,\n} from \"../processors\";\nimport { createDrawing, DrawingNode } from \"../nodes\";\nimport { isDeclarationNode } from \"../nodes/Declaration\";\n\nconst isSkPaint = (obj: RefObject<SkPaint> | SkPaint): obj is SkPaint =>\n \"__typename__\" in obj && obj.__typename__ === \"Paint\";\n\nexport interface GroupProps extends CustomPaintProps, TransformProps {\n clip?: ClipDef;\n invertClip?: boolean;\n layer?: RefObject<SkPaint> | SkPaint | boolean;\n}\n\nconst onDraw = createDrawing<GroupProps>(\n (ctx, { layer, clip, invertClip, ...groupProps }, node) => {\n const { canvas, opacity, Skia } = ctx;\n const declarations = node.children\n .filter(isDeclarationNode)\n .map((child) => child.draw(ctx));\n\n const drawings = node.children.filter(\n (child) => child instanceof DrawingNode\n );\n const paint = processPaint(\n ctx.Skia,\n ctx.paint.copy(),\n opacity,\n groupProps,\n declarations\n );\n const hasTransform = !!groupProps.transform || !!groupProps.matrix;\n const hasClip = !!clip;\n const shouldSave = hasTransform || hasClip || !!layer;\n if (shouldSave) {\n if (layer) {\n if (typeof layer === \"boolean\") {\n canvas.saveLayer();\n } else if (isSkPaint(layer)) {\n canvas.saveLayer(layer);\n } else {\n canvas.saveLayer(layer.current ?? undefined);\n }\n } else {\n canvas.save();\n }\n processCanvasTransform(canvas, groupProps);\n if (clip) {\n const op = invertClip ? ClipOp.Difference : ClipOp.Intersect;\n processClip(Skia, canvas, clip, op);\n }\n }\n node.visit(\n {\n ...ctx,\n paint,\n opacity: groupProps.opacity ? groupProps.opacity * opacity : opacity,\n },\n drawings\n );\n if (shouldSave) {\n canvas.restore();\n }\n }\n);\n\nexport const Group = (props: AnimatedProps<GroupProps>) => {\n return <skDrawing onDraw={onDraw} {...props} skipProcessing />;\n};\n"]}
|
@@ -1,35 +1,28 @@
|
|
1
1
|
import { processTransform } from "../../skia/types";
|
2
|
-
export const processCanvasTransform = (
|
3
|
-
let {
|
4
|
-
canvas,
|
5
|
-
Skia
|
6
|
-
} = _ref;
|
2
|
+
export const processCanvasTransform = (canvas, _ref) => {
|
7
3
|
let {
|
8
4
|
transform,
|
9
5
|
origin,
|
10
6
|
matrix
|
11
|
-
} =
|
7
|
+
} = _ref;
|
12
8
|
|
13
9
|
if (matrix) {
|
14
10
|
if (origin) {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
m3.translate(-origin.x, -origin.y);
|
19
|
-
canvas.concat(m3);
|
11
|
+
canvas.translate(origin.x, origin.y);
|
12
|
+
canvas.concat(matrix);
|
13
|
+
canvas.translate(-origin.x, -origin.y);
|
20
14
|
} else {
|
21
15
|
canvas.concat(matrix);
|
22
16
|
}
|
23
17
|
} else if (transform) {
|
24
|
-
|
25
|
-
canvas.concat(m3);
|
18
|
+
processTransform(canvas, origin ? transformOrigin(origin, transform) : transform);
|
26
19
|
}
|
27
20
|
};
|
28
|
-
export const localMatrix = (m,
|
21
|
+
export const localMatrix = (m, _ref2) => {
|
29
22
|
let {
|
30
23
|
transform,
|
31
24
|
origin
|
32
|
-
} =
|
25
|
+
} = _ref2;
|
33
26
|
|
34
27
|
if (transform) {
|
35
28
|
return processTransform(m, origin ? transformOrigin(origin, transform) : transform);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Transform.ts"],"names":["processTransform","processCanvasTransform","canvas","
|
1
|
+
{"version":3,"sources":["Transform.ts"],"names":["processTransform","processCanvasTransform","canvas","transform","origin","matrix","translate","x","y","concat","transformOrigin","localMatrix","m","undefined","translateX","translateY"],"mappings":"AACA,SAASA,gBAAT,QAAiC,kBAAjC;AASA,OAAO,MAAMC,sBAAsB,GAAG,CACpCC,MADoC,WAGjC;AAAA,MADH;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,MAAb;AAAqBC,IAAAA;AAArB,GACG;;AACH,MAAIA,MAAJ,EAAY;AACV,QAAID,MAAJ,EAAY;AACVF,MAAAA,MAAM,CAACI,SAAP,CAAiBF,MAAM,CAACG,CAAxB,EAA2BH,MAAM,CAACI,CAAlC;AACAN,MAAAA,MAAM,CAACO,MAAP,CAAcJ,MAAd;AACAH,MAAAA,MAAM,CAACI,SAAP,CAAiB,CAACF,MAAM,CAACG,CAAzB,EAA4B,CAACH,MAAM,CAACI,CAApC;AACD,KAJD,MAIO;AACLN,MAAAA,MAAM,CAACO,MAAP,CAAcJ,MAAd;AACD;AACF,GARD,MAQO,IAAIF,SAAJ,EAAe;AACpBH,IAAAA,gBAAgB,CACdE,MADc,EAEdE,MAAM,GAAGM,eAAe,CAACN,MAAD,EAASD,SAAT,CAAlB,GAAwCA,SAFhC,CAAhB;AAID;AACF,CAlBM;AAoBP,OAAO,MAAMQ,WAAW,GAAG,CACzBC,CADyB,YAGtB;AAAA,MADH;AAAET,IAAAA,SAAF;AAAaC,IAAAA;AAAb,GACG;;AACH,MAAID,SAAJ,EAAe;AACb,WAAOH,gBAAgB,CACrBY,CADqB,EAErBR,MAAM,GAAGM,eAAe,CAACN,MAAD,EAASD,SAAT,CAAlB,GAAwCA,SAFzB,CAAvB;AAID;;AACD,SAAOU,SAAP;AACD,CAXM;AAaP,OAAO,MAAMH,eAAe,GAAG,CAACN,MAAD,EAAiBD,SAAjB,KAA6C,CAC1E;AAAEW,EAAAA,UAAU,EAAEV,MAAM,CAACG;AAArB,CAD0E,EAE1E;AAAEQ,EAAAA,UAAU,EAAEX,MAAM,CAACI;AAArB,CAF0E,EAG1E,GAAGL,SAHuE,EAI1E;AAAEW,EAAAA,UAAU,EAAE,CAACV,MAAM,CAACG;AAAtB,CAJ0E,EAK1E;AAAEQ,EAAAA,UAAU,EAAE,CAACX,MAAM,CAACI;AAAtB,CAL0E,CAArE","sourcesContent":["import type { SkMatrix, Vector, Transforms2d } from \"../../skia/types\";\nimport { processTransform } from \"../../skia/types\";\nimport type { SkCanvas } from \"../../skia/types/Canvas\";\n\nexport interface TransformProps {\n transform?: Transforms2d;\n origin?: Vector;\n matrix?: SkMatrix;\n}\n\nexport const processCanvasTransform = (\n canvas: SkCanvas,\n { transform, origin, matrix }: TransformProps\n) => {\n if (matrix) {\n if (origin) {\n canvas.translate(origin.x, origin.y);\n canvas.concat(matrix);\n canvas.translate(-origin.x, -origin.y);\n } else {\n canvas.concat(matrix);\n }\n } else if (transform) {\n processTransform(\n canvas,\n origin ? transformOrigin(origin, transform) : transform\n );\n }\n};\n\nexport const localMatrix = (\n m: SkMatrix,\n { transform, origin }: TransformProps\n) => {\n if (transform) {\n return processTransform(\n m,\n origin ? transformOrigin(origin, transform) : transform\n );\n }\n return undefined;\n};\n\nexport const transformOrigin = (origin: Vector, transform: Transforms2d) => [\n { translateX: origin.x },\n { translateY: origin.y },\n ...transform,\n { translateX: -origin.x },\n { translateY: -origin.y },\n];\n"]}
|
@@ -19,12 +19,15 @@ const factoryWrapper = (data2, factory, onError) => {
|
|
19
19
|
|
20
20
|
const loadDataCollection = (sources, factory, onError) => Promise.all(sources.map(source => loadData(source, factory, onError)));
|
21
21
|
|
22
|
-
const loadData = (source, factory, onError) => {
|
23
|
-
if (source
|
24
|
-
return
|
22
|
+
const loadData = async (source, factory, onError) => {
|
23
|
+
if (source === null) {
|
24
|
+
return null;
|
25
|
+
} else if (source instanceof Uint8Array) {
|
26
|
+
return factoryWrapper(Skia.Data.fromBytes(source), factory, onError);
|
25
27
|
} else {
|
26
28
|
const uri = typeof source === "string" ? source : resolveAsset(source);
|
27
|
-
|
29
|
+
const d = await Skia.Data.fromURI(uri);
|
30
|
+
return factoryWrapper(d, factory, onError);
|
28
31
|
}
|
29
32
|
};
|
30
33
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Data.ts"],"names":["useRef","useEffect","useState","Image","Platform","Skia","resolveAsset","source","OS","default","resolveAssetSource","uri","factoryWrapper","data2","factory","onError","factoryResult","Error","loadDataCollection","sources","Promise","all","map","loadData","Uint8Array","
|
1
|
+
{"version":3,"sources":["Data.ts"],"names":["useRef","useEffect","useState","Image","Platform","Skia","resolveAsset","source","OS","default","resolveAssetSource","uri","factoryWrapper","data2","factory","onError","factoryResult","Error","loadDataCollection","sources","Promise","all","map","loadData","Uint8Array","Data","fromBytes","d","fromURI","useLoading","loader","deps","data","setData","prevSourceRef","current","then","useDataCollection","useRawData","identity","useData"],"mappings":"AACA,SAASA,MAAT,EAAiBC,SAAjB,EAA4BC,QAA5B,QAA4C,OAA5C;AACA,SAASC,KAAT,EAAgBC,QAAhB,QAAgC,cAAhC;AAEA,SAASC,IAAT,QAAqB,SAArB;;AAGA,MAAMC,YAAY,GAAIC,MAAD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nimport { useRef, useEffect, useState } from \"react\";\nimport { Image, Platform } from \"react-native\";\n\nimport { Skia } from \"../Skia\";\nimport type { SkData, DataSource } from \"../types\";\n\nconst resolveAsset = (source: ReturnType<typeof require>) => {\n return Platform.OS === \"web\"\n ? source.default\n : Image.resolveAssetSource(source).uri;\n};\n\nconst factoryWrapper = <T>(\n data2: SkData,\n factory: (data: SkData) => T,\n onError?: (err: Error) => void\n) => {\n const factoryResult = factory(data2);\n if (factoryResult === null) {\n onError && onError(new Error(\"Could not load data\"));\n return null;\n } else {\n return factoryResult;\n }\n};\n\nconst loadDataCollection = <T>(\n sources: DataSource[],\n factory: (data: SkData) => T,\n onError?: (err: Error) => void\n): Promise<(T | null)[]> =>\n Promise.all(sources.map((source) => loadData(source, factory, onError)));\n\nconst loadData = async <T>(\n source: DataSource,\n factory: (data: SkData) => T,\n onError?: (err: Error) => void\n): Promise<T | null> => {\n if (source === null) {\n return null;\n } else if (source instanceof Uint8Array) {\n return factoryWrapper(Skia.Data.fromBytes(source), factory, onError);\n } else {\n const uri = typeof source === \"string\" ? source : resolveAsset(source);\n const d = await Skia.Data.fromURI(uri);\n return factoryWrapper(d, factory, onError);\n }\n};\n\ntype Source = DataSource | null | undefined;\n\nconst useLoading = <T>(\n source: Source,\n loader: () => Promise<T | null>,\n deps: DependencyList = []\n) => {\n const [data, setData] = useState<T | null>(null);\n const prevSourceRef = useRef<Source>();\n useEffect(() => {\n if (prevSourceRef.current !== source) {\n prevSourceRef.current = source;\n loader().then(setData);\n } else {\n setData(null);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n return data;\n};\n\nexport const useDataCollection = <T>(\n sources: DataSource[],\n factory: (data: SkData) => T,\n onError?: (err: Error) => void,\n deps?: DependencyList\n) =>\n useLoading(\n sources,\n () => loadDataCollection(sources, factory, onError),\n deps\n );\n\nexport const useRawData = <T>(\n source: DataSource | null | undefined,\n factory: (data: SkData) => T,\n onError?: (err: Error) => void,\n deps?: DependencyList\n) => useLoading(source, () => loadData(source, factory, onError), deps);\n\nconst identity = (data: SkData) => data;\n\nexport const useData = (\n source: DataSource | null | undefined,\n onError?: (err: Error) => void,\n deps?: DependencyList\n) => useRawData(source, identity, onError, deps);\n"]}
|