@shopify/react-native-skia 2.4.0 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/skia/types/Recorder.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Debug.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Player.d.ts +1 -1
- package/lib/commonjs/sksg/Recorder/Player.js +33 -34
- package/lib/commonjs/sksg/Recorder/Player.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.js.map +1 -1
- package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
- package/lib/module/skia/types/Recorder.js.map +1 -1
- package/lib/module/sksg/Recorder/Debug.js +1 -2
- package/lib/module/sksg/Recorder/Debug.js.map +1 -1
- package/lib/module/sksg/Recorder/Player.d.ts +1 -1
- package/lib/module/sksg/Recorder/Player.js +32 -32
- package/lib/module/sksg/Recorder/Player.js.map +1 -1
- package/lib/module/sksg/Recorder/ReanimatedRecorder.js.map +1 -1
- package/lib/module/views/SkiaPictureView.js.map +1 -1
- package/lib/typescript/src/sksg/Recorder/Player.d.ts +1 -1
- package/package.json +1 -1
- package/src/skia/types/Recorder.ts +1 -3
- package/src/sksg/Recorder/Debug.ts +72 -75
- package/src/sksg/Recorder/Player.ts +38 -38
- package/src/sksg/Recorder/ReanimatedRecorder.ts +1 -3
- package/src/views/SkiaPictureView.tsx +7 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["Recorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type {\n TextProps,\n AtlasProps,\n BlurMaskFilterProps,\n BoxProps,\n BoxShadowProps,\n CircleProps,\n CTMProps,\n DiffRectProps,\n GlyphsProps,\n ImageProps,\n ImageSVGProps,\n LineProps,\n NodeType,\n OvalProps,\n PaintProps,\n ParagraphProps,\n PatchProps,\n PathProps,\n PictureProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n TextBlobProps,\n TextPathProps,\n VerticesProps,\n SkottieProps,\n DrawingNodeProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer/processors/Animations/Animations\";\n\nimport type { SkPicture } from \"./Picture\";\n\nexport interface BaseRecorder {\n saveGroup(
|
|
1
|
+
{"version":3,"names":[],"sources":["Recorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type {\n TextProps,\n AtlasProps,\n BlurMaskFilterProps,\n BoxProps,\n BoxShadowProps,\n CircleProps,\n CTMProps,\n DiffRectProps,\n GlyphsProps,\n ImageProps,\n ImageSVGProps,\n LineProps,\n NodeType,\n OvalProps,\n PaintProps,\n ParagraphProps,\n PatchProps,\n PathProps,\n PictureProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n TextBlobProps,\n TextPathProps,\n VerticesProps,\n SkottieProps,\n DrawingNodeProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer/processors/Animations/Animations\";\n\nimport type { SkPicture } from \"./Picture\";\n\nexport interface BaseRecorder {\n saveGroup(props?: AnimatedProps<Pick<DrawingNodeProps, \"zIndex\">>): void;\n restoreGroup(): void;\n savePaint(props: AnimatedProps<PaintProps>, standalone: boolean): void;\n restorePaint(): void;\n restorePaintDeclaration(): void;\n materializePaint(): void;\n pushPathEffect(pathEffectType: NodeType, props: AnimatedProps<unknown>): void;\n pushImageFilter(\n imageFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void;\n pushColorFilter(\n colorFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void;\n pushShader(\n shaderType: NodeType,\n props: AnimatedProps<unknown>,\n children: number\n ): void;\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void;\n composePathEffect(): void;\n composeColorFilter(): void;\n composeImageFilter(): void;\n saveCTM(props: AnimatedProps<CTMProps>): void;\n restoreCTM(): void;\n drawPaint(): void;\n saveLayer(): void;\n saveBackdropFilter(): void;\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n animatedProps?: Record<string, SharedValue<unknown>>;\n }[]\n ): void;\n drawImage(props: AnimatedProps<ImageProps>): void;\n drawCircle(props: AnimatedProps<CircleProps>): void;\n drawPoints(props: AnimatedProps<PointsProps>): void;\n drawPath(props: AnimatedProps<PathProps>): void;\n drawRect(props: AnimatedProps<RectProps>): void;\n drawRRect(props: AnimatedProps<RoundedRectProps>): void;\n drawOval(props: AnimatedProps<OvalProps>): void;\n drawLine(props: AnimatedProps<LineProps>): void;\n drawPatch(props: AnimatedProps<PatchProps>): void;\n drawVertices(props: AnimatedProps<VerticesProps>): void;\n drawDiffRect(props: AnimatedProps<DiffRectProps>): void;\n drawText(props: AnimatedProps<TextProps>): void;\n drawTextPath(props: AnimatedProps<TextPathProps>): void;\n drawTextBlob(props: AnimatedProps<TextBlobProps>): void;\n drawGlyphs(props: AnimatedProps<GlyphsProps>): void;\n drawPicture(props: AnimatedProps<PictureProps>): void;\n drawImageSVG(props: AnimatedProps<ImageSVGProps>): void;\n drawParagraph(props: AnimatedProps<ParagraphProps>): void;\n drawSkottie(props: AnimatedProps<SkottieProps>): void;\n drawAtlas(props: AnimatedProps<AtlasProps>): void;\n}\n\nexport interface JsiRecorder extends BaseRecorder {\n play(picture: SkPicture): void;\n applyUpdates(variables: SharedValue<unknown>[]): void;\n reset(): void;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_Core","require","CommandTypeNames","CommandType","Group","SavePaint","RestorePaint","SaveCTM","RestoreCTM","PushColorFilter","PushBlurMaskFilter","PushImageFilter","PushPathEffect","PushShader","ComposeColorFilter","ComposeImageFilter","ComposePathEffect","MaterializePaint","SaveBackdropFilter","SaveLayer","RestorePaintDeclaration","DrawBox","DrawImage","DrawCircle","DrawPaint","DrawPoints","DrawPath","DrawRect","DrawRRect","DrawOval","DrawLine","DrawPatch","DrawVertices","DrawDiffRect","DrawText","DrawTextPath","DrawTextBlob","DrawGlyphs","DrawPicture","DrawImageSVG","DrawParagraph","DrawAtlas","DrawSkottie","serializeProps","props","JSON","stringify","key","value","undefined","toString","e","debugTree","commands","indent","result","prefix","repeat","forEach","cmd","index","type","isGroup","children","length","exports"],"sources":["Debug.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"names":["_Core","require","CommandTypeNames","CommandType","Group","SavePaint","RestorePaint","SaveCTM","RestoreCTM","PushColorFilter","PushBlurMaskFilter","PushImageFilter","PushPathEffect","PushShader","ComposeColorFilter","ComposeImageFilter","ComposePathEffect","MaterializePaint","SaveBackdropFilter","SaveLayer","RestorePaintDeclaration","DrawBox","DrawImage","DrawCircle","DrawPaint","DrawPoints","DrawPath","DrawRect","DrawRRect","DrawOval","DrawLine","DrawPatch","DrawVertices","DrawDiffRect","DrawText","DrawTextPath","DrawTextBlob","DrawGlyphs","DrawPicture","DrawImageSVG","DrawParagraph","DrawAtlas","DrawSkottie","serializeProps","props","JSON","stringify","key","value","undefined","toString","e","debugTree","commands","indent","result","prefix","repeat","forEach","cmd","index","type","isGroup","children","length","exports"],"sources":["Debug.ts"],"sourcesContent":["import { CommandType, isGroup } from \"./Core\";\nimport type { Command } from \"./Core\";\n\nconst CommandTypeNames: Record<CommandType, string> = {\n [CommandType.Group]: \"Group\",\n [CommandType.SavePaint]: \"SavePaint\",\n [CommandType.RestorePaint]: \"RestorePaint\",\n [CommandType.SaveCTM]: \"SaveCTM\",\n [CommandType.RestoreCTM]: \"RestoreCTM\",\n [CommandType.PushColorFilter]: \"PushColorFilter\",\n [CommandType.PushBlurMaskFilter]: \"PushBlurMaskFilter\",\n [CommandType.PushImageFilter]: \"PushImageFilter\",\n [CommandType.PushPathEffect]: \"PushPathEffect\",\n [CommandType.PushShader]: \"PushShader\",\n [CommandType.ComposeColorFilter]: \"ComposeColorFilter\",\n [CommandType.ComposeImageFilter]: \"ComposeImageFilter\",\n [CommandType.ComposePathEffect]: \"ComposePathEffect\",\n [CommandType.MaterializePaint]: \"MaterializePaint\",\n [CommandType.SaveBackdropFilter]: \"SaveBackdropFilter\",\n [CommandType.SaveLayer]: \"SaveLayer\",\n [CommandType.RestorePaintDeclaration]: \"RestorePaintDeclaration\",\n [CommandType.DrawBox]: \"DrawBox\",\n [CommandType.DrawImage]: \"DrawImage\",\n [CommandType.DrawCircle]: \"DrawCircle\",\n [CommandType.DrawPaint]: \"DrawPaint\",\n [CommandType.DrawPoints]: \"DrawPoints\",\n [CommandType.DrawPath]: \"DrawPath\",\n [CommandType.DrawRect]: \"DrawRect\",\n [CommandType.DrawRRect]: \"DrawRRect\",\n [CommandType.DrawOval]: \"DrawOval\",\n [CommandType.DrawLine]: \"DrawLine\",\n [CommandType.DrawPatch]: \"DrawPatch\",\n [CommandType.DrawVertices]: \"DrawVertices\",\n [CommandType.DrawDiffRect]: \"DrawDiffRect\",\n [CommandType.DrawText]: \"DrawText\",\n [CommandType.DrawTextPath]: \"DrawTextPath\",\n [CommandType.DrawTextBlob]: \"DrawTextBlob\",\n [CommandType.DrawGlyphs]: \"DrawGlyphs\",\n [CommandType.DrawPicture]: \"DrawPicture\",\n [CommandType.DrawImageSVG]: \"DrawImageSVG\",\n [CommandType.DrawParagraph]: \"DrawParagraph\",\n [CommandType.DrawAtlas]: \"DrawAtlas\",\n [CommandType.DrawSkottie]: \"DrawSkottie\",\n};\n\nconst serializeProps = (props: unknown): string => {\n try {\n return JSON.stringify(props, (key, value) => {\n if (key === \"children\") {\n return undefined;\n }\n if (typeof value === \"bigint\") {\n return value.toString();\n }\n return value;\n });\n } catch (e) {\n return `\"Error serializing props: ${e}\"`;\n }\n};\n\nexport const debugTree = (commands: Command[], indent = 0): string => {\n let result = \"[\\n\";\n const prefix = \" \".repeat(indent + 2);\n\n commands.forEach((cmd, index) => {\n const type = CommandTypeNames[cmd.type] || \"Unknown\";\n result += `${prefix}{ \"type\": \"${type}\"`;\n\n if (\"props\" in cmd) {\n result += `, \"props\": ${serializeProps(cmd.props)}`;\n }\n\n if (isGroup(cmd)) {\n result += `, \"children\": ${debugTree(cmd.children, indent + 2)}`;\n }\n\n result += \" }\";\n if (index < commands.length - 1) {\n result += \",\";\n }\n result += \"\\n\";\n });\n\n result += \" \".repeat(indent) + \"]\";\n return result;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAGA,MAAMC,gBAA6C,GAAG;EACpD,CAACC,iBAAW,CAACC,KAAK,GAAG,OAAO;EAC5B,CAACD,iBAAW,CAACE,SAAS,GAAG,WAAW;EACpC,CAACF,iBAAW,CAACG,YAAY,GAAG,cAAc;EAC1C,CAACH,iBAAW,CAACI,OAAO,GAAG,SAAS;EAChC,CAACJ,iBAAW,CAACK,UAAU,GAAG,YAAY;EACtC,CAACL,iBAAW,CAACM,eAAe,GAAG,iBAAiB;EAChD,CAACN,iBAAW,CAACO,kBAAkB,GAAG,oBAAoB;EACtD,CAACP,iBAAW,CAACQ,eAAe,GAAG,iBAAiB;EAChD,CAACR,iBAAW,CAACS,cAAc,GAAG,gBAAgB;EAC9C,CAACT,iBAAW,CAACU,UAAU,GAAG,YAAY;EACtC,CAACV,iBAAW,CAACW,kBAAkB,GAAG,oBAAoB;EACtD,CAACX,iBAAW,CAACY,kBAAkB,GAAG,oBAAoB;EACtD,CAACZ,iBAAW,CAACa,iBAAiB,GAAG,mBAAmB;EACpD,CAACb,iBAAW,CAACc,gBAAgB,GAAG,kBAAkB;EAClD,CAACd,iBAAW,CAACe,kBAAkB,GAAG,oBAAoB;EACtD,CAACf,iBAAW,CAACgB,SAAS,GAAG,WAAW;EACpC,CAAChB,iBAAW,CAACiB,uBAAuB,GAAG,yBAAyB;EAChE,CAACjB,iBAAW,CAACkB,OAAO,GAAG,SAAS;EAChC,CAAClB,iBAAW,CAACmB,SAAS,GAAG,WAAW;EACpC,CAACnB,iBAAW,CAACoB,UAAU,GAAG,YAAY;EACtC,CAACpB,iBAAW,CAACqB,SAAS,GAAG,WAAW;EACpC,CAACrB,iBAAW,C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C;AACF,CAAC;AAEM,MAAMC,SAAS,GAAGA,CAACC,QAAmB,EAAEC,MAAM,GAAG,CAAC,KAAa;EACpE,IAAIC,MAAM,GAAG,KAAK;EAClB,MAAMC,MAAM,GAAG,GAAG,CAACC,MAAM,CAACH,MAAM,GAAG,CAAC,CAAC;EAErCD,QAAQ,CAACK,OAAO,CAAC,CAACC,GAAG,EAAEC,KAAK,KAAK;IAC/B,MAAMC,IAAI,GAAG3D,gBAAgB,CAACyD,GAAG,CAACE,IAAI,CAAC,IAAI,SAAS;IACpDN,MAAM,IAAI,GAAGC,MAAM,cAAcK,IAAI,GAAG;IAExC,IAAI,OAAO,IAAIF,GAAG,EAAE;MAClBJ,MAAM,IAAI,cAAcZ,cAAc,CAACgB,GAAG,CAACf,KAAK,CAAC,EAAE;IACrD;IAEA,IAAI,IAAAkB,aAAO,EAACH,GAAG,CAAC,EAAE;MAChBJ,MAAM,IAAI,iBAAiBH,SAAS,CAACO,GAAG,CAACI,QAAQ,EAAET,MAAM,GAAG,CAAC,CAAC,EAAE;IAClE;IAEAC,MAAM,IAAI,IAAI;IACd,IAAIK,KAAK,GAAGP,QAAQ,CAACW,MAAM,GAAG,CAAC,EAAE;MAC/BT,MAAM,IAAI,GAAG;IACf;IACAA,MAAM,IAAI,IAAI;EAChB,CAAC,CAAC;EAEFA,MAAM,IAAI,GAAG,CAACE,MAAM,CAACH,MAAM,CAAC,GAAG,GAAG;EAClC,OAAOC,MAAM;AACf,CAAC;AAACU,OAAA,CAAAb,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.replay =
|
|
6
|
+
exports.replay = replay;
|
|
7
7
|
var _Drawing = require("./commands/Drawing");
|
|
8
8
|
var _Box = require("./commands/Box");
|
|
9
9
|
var _ColorFilters = require("./commands/ColorFilters");
|
|
@@ -26,40 +26,40 @@ const getZIndex = command => {
|
|
|
26
26
|
}
|
|
27
27
|
return zIndex;
|
|
28
28
|
};
|
|
29
|
-
const
|
|
30
|
-
|
|
29
|
+
const play = (ctx, _command) => {
|
|
30
|
+
const flushPendingGroups = (ctx, pendingGroups) => {
|
|
31
|
+
"worklet";
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
pendingGroups.sort((a, b) => a.zIndex === b.zIndex ? a.order - b.order : a.zIndex - b.zIndex).forEach(({
|
|
36
|
-
command
|
|
37
|
-
}) => {
|
|
38
|
-
play(ctx, command);
|
|
39
|
-
});
|
|
40
|
-
pendingGroups.length = 0;
|
|
41
|
-
};
|
|
42
|
-
const playGroup = (ctx, group) => {
|
|
43
|
-
"worklet";
|
|
44
|
-
|
|
45
|
-
const pending = [];
|
|
46
|
-
group.children.forEach(child => {
|
|
47
|
-
if ((0, _Core.isGroup)(child)) {
|
|
48
|
-
pending.push({
|
|
49
|
-
command: child,
|
|
50
|
-
zIndex: getZIndex(child),
|
|
51
|
-
order: pending.length
|
|
52
|
-
});
|
|
33
|
+
if (pendingGroups.length === 0) {
|
|
53
34
|
return;
|
|
54
35
|
}
|
|
36
|
+
pendingGroups.sort((a, b) => a.zIndex === b.zIndex ? a.order - b.order : a.zIndex - b.zIndex).forEach(({
|
|
37
|
+
command
|
|
38
|
+
}) => {
|
|
39
|
+
play(ctx, command);
|
|
40
|
+
});
|
|
41
|
+
pendingGroups.length = 0;
|
|
42
|
+
};
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
44
|
+
const playGroup = (ctx, group) => {
|
|
45
|
+
"worklet";
|
|
46
|
+
|
|
47
|
+
const pending = [];
|
|
48
|
+
group.children.forEach(child => {
|
|
49
|
+
if ((0, _Core.isGroup)(child)) {
|
|
50
|
+
pending.push({
|
|
51
|
+
command: child,
|
|
52
|
+
zIndex: getZIndex(child),
|
|
53
|
+
order: pending.length
|
|
54
|
+
});
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
flushPendingGroups(ctx, pending);
|
|
58
|
+
play(ctx, child);
|
|
59
|
+
});
|
|
55
60
|
flushPendingGroups(ctx, pending);
|
|
56
|
-
|
|
57
|
-
});
|
|
58
|
-
flushPendingGroups(ctx, pending);
|
|
59
|
-
};
|
|
60
|
-
function play(ctx, _command) {
|
|
61
|
+
};
|
|
61
62
|
"worklet";
|
|
62
|
-
|
|
63
63
|
if ((0, _Core.isGroup)(_command)) {
|
|
64
64
|
playGroup(ctx, _command);
|
|
65
65
|
return;
|
|
@@ -176,14 +176,13 @@ function play(ctx, _command) {
|
|
|
176
176
|
ctx.paints.pop();
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
|
-
}
|
|
180
|
-
|
|
179
|
+
};
|
|
180
|
+
function replay(ctx, commands) {
|
|
181
181
|
"worklet";
|
|
182
182
|
|
|
183
183
|
//console.log(debugTree(commands));
|
|
184
184
|
commands.forEach(command => {
|
|
185
185
|
play(ctx, command);
|
|
186
186
|
});
|
|
187
|
-
}
|
|
188
|
-
exports.replay = replay;
|
|
187
|
+
}
|
|
189
188
|
//# sourceMappingURL=Player.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_Drawing","require","_Box","_ColorFilters","_CTM","_ImageFilters","_Paint","_PathEffects","_Shaders","_Core","getZIndex","command","_materialized$props","materialized","materializeCommand","zIndex","props","Number","isNaN","flushPendingGroups","ctx","pendingGroups","length","sort","a","b","order","forEach","play","playGroup","group","pending","children","child","isGroup","push","_command","isCommand","CommandType","SaveBackdropFilter","saveBackdropFilter","SaveLayer","materializePaint","paint","paintDeclarations","pop","canvas","saveLayer","isDrawCommand","SavePaint","paints","standalone","savePaint","freshPaint","Skia","Paint","assign","setPaintProperties","RestorePaint","restorePaint","ComposeColorFilter","composeColorFilters","RestorePaintDeclaration","Error","MaterializePaint","isPushColorFilter","pushColorFilter","isPushShader","pushShader","isPushImageFilter","pushImageFilter","isPushPathEffect","pushPathEffect","ComposePathEffect","composePathEffects","ComposeImageFilter","composeImageFilters","PushBlurMaskFilter","setBlurMaskFilter","SaveCTM","saveCTM","RestoreCTM","restore","copy","setAlphaf","getAlphaf","getOpacity","p","isBoxCommand","drawBox","DrawPaint","drawPaint","DrawImage","drawImage","DrawCircle","drawCircle","DrawPoints","drawPoints","DrawPath","drawPath","DrawRect","drawRect","DrawRRect","drawRRect","DrawOval","drawOval","DrawLine","drawLine","DrawPatch","drawPatch","DrawVertices","drawVertices","DrawDiffRect","drawDiffRect","DrawText","drawText","DrawTextPath","drawTextPath","DrawTextBlob","drawTextBlob","DrawGlyphs","drawGlyphs","DrawPicture","drawPicture","DrawImageSVG","drawImageSVG","DrawParagraph","drawParagraph","DrawAtlas","drawAtlas","DrawSkottie","drawSkottie","console","warn","type","replay","commands","exports"],"sources":["Player.ts"],"sourcesContent":["import type { DrawingNodeProps } from \"../../dom/types\";\n\nimport {\n drawCircle,\n drawImage,\n drawOval,\n drawPath,\n drawPoints,\n drawRect,\n drawRRect,\n drawLine,\n drawAtlas,\n drawParagraph,\n drawImageSVG,\n drawPicture,\n drawGlyphs,\n drawTextBlob,\n drawTextPath,\n drawText,\n drawDiffRect,\n drawVertices,\n drawPatch,\n drawSkottie,\n} from \"./commands/Drawing\";\nimport { drawBox, isBoxCommand } from \"./commands/Box\";\nimport {\n composeColorFilters,\n isPushColorFilter,\n pushColorFilter,\n} from \"./commands/ColorFilters\";\nimport { saveCTM } from \"./commands/CTM\";\nimport {\n setBlurMaskFilter,\n isPushImageFilter,\n pushImageFilter,\n composeImageFilters,\n} from \"./commands/ImageFilters\";\nimport { setPaintProperties } from \"./commands/Paint\";\nimport {\n composePathEffects,\n isPushPathEffect,\n pushPathEffect,\n} from \"./commands/PathEffects\";\nimport { isPushShader, pushShader } from \"./commands/Shaders\";\nimport {\n CommandType,\n isCommand,\n isDrawCommand,\n isGroup,\n materializeCommand,\n} from \"./Core\";\nimport type { Command, GroupCommand } from \"./Core\";\nimport type { DrawingContext } from \"./DrawingContext\";\n\ntype PendingGroup = {\n command: GroupCommand;\n zIndex: number;\n order: number;\n};\n\nconst getZIndex = (command: GroupCommand) => {\n \"worklet\";\n const materialized = materializeCommand(command);\n const { zIndex } = (materialized.props ?? {}) as DrawingNodeProps;\n if (typeof zIndex !== \"number\" || Number.isNaN(zIndex)) {\n return 0;\n }\n return zIndex;\n};\n\nconst flushPendingGroups = (\n ctx: DrawingContext,\n pendingGroups: PendingGroup[]\n) => {\n \"worklet\";\n if (pendingGroups.length === 0) {\n return;\n }\n pendingGroups\n .sort((a, b) =>\n a.zIndex === b.zIndex ? a.order - b.order : a.zIndex - b.zIndex\n )\n .forEach(({ command }) => {\n play(ctx, command);\n });\n pendingGroups.length = 0;\n};\n\nconst playGroup = (ctx: DrawingContext, group: GroupCommand) => {\n \"worklet\";\n const pending: PendingGroup[] = [];\n group.children.forEach((child) => {\n if (isGroup(child)) {\n pending.push({\n command: child,\n zIndex: getZIndex(child),\n order: pending.length,\n });\n return;\n }\n flushPendingGroups(ctx, pending);\n play(ctx, child);\n });\n flushPendingGroups(ctx, pending);\n};\n\nfunction play(ctx: DrawingContext, _command: Command) {\n \"worklet\";\n if (isGroup(_command)) {\n playGroup(ctx, _command);\n return;\n }\n const command = materializeCommand(_command);\n if (isCommand(command, CommandType.SaveBackdropFilter)) {\n ctx.saveBackdropFilter();\n } else if (isCommand(command, CommandType.SaveLayer)) {\n ctx.materializePaint();\n const paint = ctx.paintDeclarations.pop();\n ctx.canvas.saveLayer(paint);\n } else if (isDrawCommand(command, CommandType.SavePaint)) {\n if (command.props.paint) {\n ctx.paints.push(command.props.paint);\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { standalone } = command as any;\n ctx.savePaint();\n if (standalone) {\n const freshPaint = ctx.Skia.Paint();\n ctx.paint.assign(freshPaint);\n }\n setPaintProperties(ctx.Skia, ctx, command.props, standalone);\n }\n } else if (isCommand(command, CommandType.RestorePaint)) {\n ctx.restorePaint();\n } else if (isCommand(command, CommandType.ComposeColorFilter)) {\n composeColorFilters(ctx);\n } else if (isCommand(command, CommandType.RestorePaintDeclaration)) {\n ctx.materializePaint();\n const paint = ctx.restorePaint();\n if (!paint) {\n throw new Error(\"No paint declaration to push\");\n }\n ctx.paintDeclarations.push(paint);\n } else if (isCommand(command, CommandType.MaterializePaint)) {\n ctx.materializePaint();\n } else if (isPushColorFilter(command)) {\n pushColorFilter(ctx, command);\n } else if (isPushShader(command)) {\n pushShader(ctx, command);\n } else if (isPushImageFilter(command)) {\n pushImageFilter(ctx, command);\n } else if (isPushPathEffect(command)) {\n pushPathEffect(ctx, command);\n } else if (isCommand(command, CommandType.ComposePathEffect)) {\n composePathEffects(ctx);\n } else if (isCommand(command, CommandType.ComposeImageFilter)) {\n composeImageFilters(ctx);\n } else if (isDrawCommand(command, CommandType.PushBlurMaskFilter)) {\n setBlurMaskFilter(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.SaveCTM)) {\n saveCTM(ctx, command.props);\n } else if (isCommand(command, CommandType.RestoreCTM)) {\n ctx.canvas.restore();\n } else {\n // TODO: is a copy needed here?\n // apply opacity to the current paint.\n const paint = ctx.paint.copy();\n paint.setAlphaf(paint.getAlphaf() * ctx.getOpacity());\n const paints = [paint, ...ctx.paintDeclarations];\n ctx.paintDeclarations = [];\n paints.forEach((p) => {\n ctx.paints.push(p);\n if (isBoxCommand(command)) {\n drawBox(ctx, command);\n } else if (isCommand(command, CommandType.DrawPaint)) {\n ctx.canvas.drawPaint(ctx.paint);\n } else if (isDrawCommand(command, CommandType.DrawImage)) {\n drawImage(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawCircle)) {\n drawCircle(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPoints)) {\n drawPoints(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPath)) {\n drawPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRect)) {\n drawRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRRect)) {\n drawRRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawOval)) {\n drawOval(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawLine)) {\n drawLine(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPatch)) {\n drawPatch(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawVertices)) {\n drawVertices(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawDiffRect)) {\n drawDiffRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawText)) {\n drawText(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextPath)) {\n drawTextPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextBlob)) {\n drawTextBlob(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawGlyphs)) {\n drawGlyphs(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPicture)) {\n drawPicture(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawImageSVG)) {\n drawImageSVG(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawParagraph)) {\n drawParagraph(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawAtlas)) {\n drawAtlas(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawSkottie)) {\n drawSkottie(ctx, command.props);\n } else {\n console.warn(`Unknown command: ${command.type}`);\n }\n ctx.paints.pop();\n });\n }\n}\n\nexport const replay = (ctx: DrawingContext, commands: Command[]) => {\n \"worklet\";\n //console.log(debugTree(commands));\n commands.forEach((command) => {\n play(ctx, command);\n });\n};\n"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AAsBA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAKA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAMA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OA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AG,EAAET,OAAO,CAACK,KAAK,CAAC;MACjC,CAAC,MAAM;QACLoH,OAAO,CAACC,IAAI,CAAC,oBAAoB1H,OAAO,CAAC2H,IAAI,EAAE,CAAC;MAClD;MACAlH,GAAG,CAAC8B,MAAM,CAACL,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC;EACJ;AACF;AAEO,MAAM0F,MAAM,GAAGA,CAACnH,GAAmB,EAAEoH,QAAmB,KAAK;EAClE,SAAS;;EACT;EACAA,QAAQ,CAAC7G,OAAO,CAAEhB,OAAO,IAAK;IAC5BiB,IAAI,CAACR,GAAG,EAAET,OAAO,CAAC;EACpB,CAAC,CAAC;AACJ,CAAC;AAAC8H,OAAA,CAAAF,MAAA,GAAAA,MAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_Drawing","require","_Box","_ColorFilters","_CTM","_ImageFilters","_Paint","_PathEffects","_Shaders","_Core","getZIndex","command","_materialized$props","materialized","materializeCommand","zIndex","props","Number","isNaN","play","ctx","_command","flushPendingGroups","pendingGroups","length","sort","a","b","order","forEach","playGroup","group","pending","children","child","isGroup","push","isCommand","CommandType","SaveBackdropFilter","saveBackdropFilter","SaveLayer","materializePaint","paint","paintDeclarations","pop","canvas","saveLayer","isDrawCommand","SavePaint","paints","standalone","savePaint","freshPaint","Skia","Paint","assign","setPaintProperties","RestorePaint","restorePaint","ComposeColorFilter","composeColorFilters","RestorePaintDeclaration","Error","MaterializePaint","isPushColorFilter","pushColorFilter","isPushShader","pushShader","isPushImageFilter","pushImageFilter","isPushPathEffect","pushPathEffect","ComposePathEffect","composePathEffects","ComposeImageFilter","composeImageFilters","PushBlurMaskFilter","setBlurMaskFilter","SaveCTM","saveCTM","RestoreCTM","restore","copy","setAlphaf","getAlphaf","getOpacity","p","isBoxCommand","drawBox","DrawPaint","drawPaint","DrawImage","drawImage","DrawCircle","drawCircle","DrawPoints","drawPoints","DrawPath","drawPath","DrawRect","drawRect","DrawRRect","drawRRect","DrawOval","drawOval","DrawLine","drawLine","DrawPatch","drawPatch","DrawVertices","drawVertices","DrawDiffRect","drawDiffRect","DrawText","drawText","DrawTextPath","drawTextPath","DrawTextBlob","drawTextBlob","DrawGlyphs","drawGlyphs","DrawPicture","drawPicture","DrawImageSVG","drawImageSVG","DrawParagraph","drawParagraph","DrawAtlas","drawAtlas","DrawSkottie","drawSkottie","console","warn","type","replay","commands"],"sources":["Player.ts"],"sourcesContent":["import type { DrawingNodeProps } from \"../../dom/types\";\n\nimport {\n drawCircle,\n drawImage,\n drawOval,\n drawPath,\n drawPoints,\n drawRect,\n drawRRect,\n drawLine,\n drawAtlas,\n drawParagraph,\n drawImageSVG,\n drawPicture,\n drawGlyphs,\n drawTextBlob,\n drawTextPath,\n drawText,\n drawDiffRect,\n drawVertices,\n drawPatch,\n drawSkottie,\n} from \"./commands/Drawing\";\nimport { drawBox, isBoxCommand } from \"./commands/Box\";\nimport {\n composeColorFilters,\n isPushColorFilter,\n pushColorFilter,\n} from \"./commands/ColorFilters\";\nimport { saveCTM } from \"./commands/CTM\";\nimport {\n setBlurMaskFilter,\n isPushImageFilter,\n pushImageFilter,\n composeImageFilters,\n} from \"./commands/ImageFilters\";\nimport { setPaintProperties } from \"./commands/Paint\";\nimport {\n composePathEffects,\n isPushPathEffect,\n pushPathEffect,\n} from \"./commands/PathEffects\";\nimport { isPushShader, pushShader } from \"./commands/Shaders\";\nimport {\n CommandType,\n isCommand,\n isDrawCommand,\n isGroup,\n materializeCommand,\n} from \"./Core\";\nimport type { Command, GroupCommand } from \"./Core\";\nimport type { DrawingContext } from \"./DrawingContext\";\n\ntype PendingGroup = {\n command: GroupCommand;\n zIndex: number;\n order: number;\n};\n\nconst getZIndex = (command: GroupCommand) => {\n \"worklet\";\n const materialized = materializeCommand(command);\n const { zIndex } = (materialized.props ?? {}) as DrawingNodeProps;\n if (typeof zIndex !== \"number\" || Number.isNaN(zIndex)) {\n return 0;\n }\n return zIndex;\n};\n\nconst play = (ctx: DrawingContext, _command: Command) => {\n const flushPendingGroups = (\n // eslint-disable-next-line @typescript-eslint/no-shadow\n ctx: DrawingContext,\n pendingGroups: PendingGroup[]\n ) => {\n \"worklet\";\n if (pendingGroups.length === 0) {\n return;\n }\n pendingGroups\n .sort((a, b) =>\n a.zIndex === b.zIndex ? a.order - b.order : a.zIndex - b.zIndex\n )\n .forEach(({ command }) => {\n play(ctx, command);\n });\n pendingGroups.length = 0;\n };\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const playGroup = (ctx: DrawingContext, group: GroupCommand) => {\n \"worklet\";\n const pending: PendingGroup[] = [];\n group.children.forEach((child) => {\n if (isGroup(child)) {\n pending.push({\n command: child,\n zIndex: getZIndex(child),\n order: pending.length,\n });\n return;\n }\n flushPendingGroups(ctx, pending);\n play(ctx, child);\n });\n flushPendingGroups(ctx, pending);\n };\n\n (\"worklet\");\n if (isGroup(_command)) {\n playGroup(ctx, _command);\n return;\n }\n const command = materializeCommand(_command);\n if (isCommand(command, CommandType.SaveBackdropFilter)) {\n ctx.saveBackdropFilter();\n } else if (isCommand(command, CommandType.SaveLayer)) {\n ctx.materializePaint();\n const paint = ctx.paintDeclarations.pop();\n ctx.canvas.saveLayer(paint);\n } else if (isDrawCommand(command, CommandType.SavePaint)) {\n if (command.props.paint) {\n ctx.paints.push(command.props.paint);\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { standalone } = command as any;\n ctx.savePaint();\n if (standalone) {\n const freshPaint = ctx.Skia.Paint();\n ctx.paint.assign(freshPaint);\n }\n setPaintProperties(ctx.Skia, ctx, command.props, standalone);\n }\n } else if (isCommand(command, CommandType.RestorePaint)) {\n ctx.restorePaint();\n } else if (isCommand(command, CommandType.ComposeColorFilter)) {\n composeColorFilters(ctx);\n } else if (isCommand(command, CommandType.RestorePaintDeclaration)) {\n ctx.materializePaint();\n const paint = ctx.restorePaint();\n if (!paint) {\n throw new Error(\"No paint declaration to push\");\n }\n ctx.paintDeclarations.push(paint);\n } else if (isCommand(command, CommandType.MaterializePaint)) {\n ctx.materializePaint();\n } else if (isPushColorFilter(command)) {\n pushColorFilter(ctx, command);\n } else if (isPushShader(command)) {\n pushShader(ctx, command);\n } else if (isPushImageFilter(command)) {\n pushImageFilter(ctx, command);\n } else if (isPushPathEffect(command)) {\n pushPathEffect(ctx, command);\n } else if (isCommand(command, CommandType.ComposePathEffect)) {\n composePathEffects(ctx);\n } else if (isCommand(command, CommandType.ComposeImageFilter)) {\n composeImageFilters(ctx);\n } else if (isDrawCommand(command, CommandType.PushBlurMaskFilter)) {\n setBlurMaskFilter(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.SaveCTM)) {\n saveCTM(ctx, command.props);\n } else if (isCommand(command, CommandType.RestoreCTM)) {\n ctx.canvas.restore();\n } else {\n // TODO: is a copy needed here?\n // apply opacity to the current paint.\n const paint = ctx.paint.copy();\n paint.setAlphaf(paint.getAlphaf() * ctx.getOpacity());\n const paints = [paint, ...ctx.paintDeclarations];\n ctx.paintDeclarations = [];\n paints.forEach((p) => {\n ctx.paints.push(p);\n if (isBoxCommand(command)) {\n drawBox(ctx, command);\n } else if (isCommand(command, CommandType.DrawPaint)) {\n ctx.canvas.drawPaint(ctx.paint);\n } else if (isDrawCommand(command, CommandType.DrawImage)) {\n drawImage(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawCircle)) {\n drawCircle(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPoints)) {\n drawPoints(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPath)) {\n drawPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRect)) {\n drawRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRRect)) {\n drawRRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawOval)) {\n drawOval(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawLine)) {\n drawLine(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPatch)) {\n drawPatch(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawVertices)) {\n drawVertices(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawDiffRect)) {\n drawDiffRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawText)) {\n drawText(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextPath)) {\n drawTextPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextBlob)) {\n drawTextBlob(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawGlyphs)) {\n drawGlyphs(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPicture)) {\n drawPicture(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawImageSVG)) {\n drawImageSVG(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawParagraph)) {\n drawParagraph(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawAtlas)) {\n drawAtlas(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawSkottie)) {\n drawSkottie(ctx, command.props);\n } else {\n console.warn(`Unknown command: ${command.type}`);\n }\n ctx.paints.pop();\n });\n }\n};\nexport function replay(ctx: DrawingContext, commands: Command[]) {\n \"worklet\";\n //console.log(debugTree(commands));\n commands.forEach((command) => {\n play(ctx, command);\n });\n}\n"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AAsBA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAKA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAMA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAKA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AAgBA,MAAMS,SAAS,GAAIC,OAAqB,IAAK;EAC3C,SAAS;;EAAC,IAAAC,mBAAA;EACV,MAAMC,YAAY,GAAG,IAAAC,wBAAkB,EAACH,OAAO,CAAC;EAChD,MAAM;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EACJ;AACF,CAAC;AACM,SAAS0F,MAAMA,CAACnH,GAAmB,EAAEoH,QAAmB,EAAE;EAC/D,SAAS;;EACT;EACAA,QAAQ,CAAC3G,OAAO,CAAElB,OAAO,IAAK;IAC5BQ,IAAI,CAACC,GAAG,EAAET,OAAO,CAAC;EACpB,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_utils","require","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ReanimatedRecorder","constructor","Skia","Set","recorder","Recorder","reset","values","clear","processAnimationValues","props","forEach","isSharedValue","has","name","size","add","getRecorder","getSharedValues","Array","from","saveGroup","restoreGroup","savePaint","standalone","restorePaint","restorePaintDeclaration","materializePaint","pushPathEffect","pathEffectType","pushImageFilter","imageFilterType","pushColorFilter","colorFilterType","pushShader","shaderType","children","pushBlurMaskFilter","composePathEffect","composeColorFilter","composeImageFilter","saveCTM","restoreCTM","drawPaint","saveLayer","saveBackdropFilter","drawBox","boxProps","shadows","shadow","map","s","drawImage","drawCircle","drawPoints","drawPath","drawRect","drawRRect","drawOval","drawLine","drawPatch","drawVertices","drawDiffRect","drawText","drawTextPath","drawTextBlob","drawGlyphs","drawPicture","drawImageSVG","drawParagraph","drawAtlas","drawSkottie","exports"],"sources":["ReanimatedRecorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type { BaseRecorder, JsiRecorder, Skia } from \"../../skia/types\";\nimport type {\n PaintProps,\n NodeType,\n BlurMaskFilterProps,\n CTMProps,\n BoxProps,\n BoxShadowProps,\n ImageProps,\n CircleProps,\n PointsProps,\n PathProps,\n RectProps,\n RoundedRectProps,\n OvalProps,\n LineProps,\n PatchProps,\n VerticesProps,\n DiffRectProps,\n TextProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n ParagraphProps,\n AtlasProps,\n SkottieProps,\n DrawingNodeProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer\";\nimport { isSharedValue } from \"../utils\";\n\n/**\n * Currently the recorder only work if the GPU resources (e.g Images) are owned by the main thread.\n * It will crash otherwise on Ganesh (iOS/Android).\n */\nexport class ReanimatedRecorder implements BaseRecorder {\n private values = new Set<SharedValue<unknown>>();\n private recorder: JsiRecorder;\n\n constructor(Skia: Skia) {\n this.recorder = Skia.Recorder();\n }\n\n reset() {\n this.values.clear();\n this.recorder.reset();\n }\n\n private processAnimationValues(props?: Record<string, unknown>) {\n if (!props) {\n return;\n }\n Object.values(props).forEach((value) => {\n if (isSharedValue(value) && !this.values.has(value)) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n value.name = `variable${this.values.size}`;\n this.values.add(value as SharedValue<unknown>);\n }\n });\n }\n\n getRecorder() {\n return this.recorder;\n }\n\n getSharedValues() {\n return Array.from(this.values);\n }\n\n saveGroup(\n props?: AnimatedProps<Pick<DrawingNodeProps, \"zIndex\">>\n ): void {\n if (props) {\n this.processAnimationValues(props);\n this.recorder.saveGroup(props);\n } else {\n this.recorder.saveGroup();\n }\n }\n\n restoreGroup(): void {\n this.recorder.restoreGroup();\n }\n\n savePaint(props: AnimatedProps<PaintProps>, standalone: boolean): void {\n this.processAnimationValues(props);\n this.recorder.savePaint(props, standalone);\n }\n\n restorePaint(): void {\n this.recorder.restorePaint();\n }\n\n restorePaintDeclaration(): void {\n this.recorder.restorePaintDeclaration();\n }\n\n materializePaint(): void {\n this.recorder.materializePaint();\n }\n\n pushPathEffect(\n pathEffectType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushPathEffect(pathEffectType, props);\n }\n\n pushImageFilter(\n imageFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushImageFilter(imageFilterType, props);\n }\n\n pushColorFilter(\n colorFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushColorFilter(colorFilterType, props);\n }\n\n pushShader(\n shaderType: NodeType,\n props: AnimatedProps<unknown>,\n children: number\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushShader(shaderType, props, children);\n }\n\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void {\n this.processAnimationValues(props);\n this.recorder.pushBlurMaskFilter(props);\n }\n\n composePathEffect(): void {\n this.recorder.composePathEffect();\n }\n\n composeColorFilter(): void {\n this.recorder.composeColorFilter();\n }\n\n composeImageFilter(): void {\n this.recorder.composeImageFilter();\n }\n\n saveCTM(props: AnimatedProps<CTMProps>): void {\n this.processAnimationValues(props);\n this.recorder.saveCTM(props);\n }\n\n restoreCTM(): void {\n this.recorder.restoreCTM();\n }\n\n drawPaint(): void {\n this.recorder.drawPaint();\n }\n\n saveLayer(): void {\n this.recorder.saveLayer();\n }\n\n saveBackdropFilter(): void {\n this.recorder.saveBackdropFilter();\n }\n\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n }[]\n ): void {\n this.processAnimationValues(boxProps);\n shadows.forEach((shadow) => {\n this.processAnimationValues(\n shadow.props as AnimatedProps<BoxShadowProps>\n );\n });\n this.recorder.drawBox(\n boxProps,\n // TODO: Fix this type BaseRecorder.drawBox()\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n shadows.map((s) => s.props)\n );\n }\n\n drawImage(props: AnimatedProps<ImageProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawImage(props);\n }\n\n drawCircle(props: AnimatedProps<CircleProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawCircle(props);\n }\n\n drawPoints(props: AnimatedProps<PointsProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPoints(props);\n }\n\n drawPath(props: AnimatedProps<PathProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPath(props);\n }\n\n drawRect(props: AnimatedProps<RectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawRect(props);\n }\n\n drawRRect(props: AnimatedProps<RoundedRectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawRRect(props);\n }\n\n drawOval(props: AnimatedProps<OvalProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawOval(props);\n }\n\n drawLine(props: AnimatedProps<LineProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawLine(props);\n }\n\n drawPatch(props: AnimatedProps<PatchProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPatch(props);\n }\n\n drawVertices(props: AnimatedProps<VerticesProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawVertices(props);\n }\n\n drawDiffRect(props: AnimatedProps<DiffRectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawDiffRect(props);\n }\n\n drawText(props: AnimatedProps<TextProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawText(props);\n }\n\n drawTextPath(props: AnimatedProps<TextPathProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawTextPath(props);\n }\n\n drawTextBlob(props: AnimatedProps<TextBlobProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawTextBlob(props);\n }\n\n drawGlyphs(props: AnimatedProps<GlyphsProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawGlyphs(props);\n }\n\n drawPicture(props: AnimatedProps<PictureProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPicture(props);\n }\n\n drawImageSVG(props: AnimatedProps<ImageSVGProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawImageSVG(props);\n }\n\n drawParagraph(props: AnimatedProps<ParagraphProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawParagraph(props);\n }\n\n drawAtlas(props: AnimatedProps<AtlasProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawAtlas(props);\n }\n\n drawSkottie(props: AnimatedProps<SkottieProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawSkottie(props);\n }\n}\n"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KAAK,CAAC;EAClC;AACF;AAAC8D,OAAA,CAAAxE,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_utils","require","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ReanimatedRecorder","constructor","Skia","Set","recorder","Recorder","reset","values","clear","processAnimationValues","props","forEach","isSharedValue","has","name","size","add","getRecorder","getSharedValues","Array","from","saveGroup","restoreGroup","savePaint","standalone","restorePaint","restorePaintDeclaration","materializePaint","pushPathEffect","pathEffectType","pushImageFilter","imageFilterType","pushColorFilter","colorFilterType","pushShader","shaderType","children","pushBlurMaskFilter","composePathEffect","composeColorFilter","composeImageFilter","saveCTM","restoreCTM","drawPaint","saveLayer","saveBackdropFilter","drawBox","boxProps","shadows","shadow","map","s","drawImage","drawCircle","drawPoints","drawPath","drawRect","drawRRect","drawOval","drawLine","drawPatch","drawVertices","drawDiffRect","drawText","drawTextPath","drawTextBlob","drawGlyphs","drawPicture","drawImageSVG","drawParagraph","drawAtlas","drawSkottie","exports"],"sources":["ReanimatedRecorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type { BaseRecorder, JsiRecorder, Skia } from \"../../skia/types\";\nimport type {\n PaintProps,\n NodeType,\n BlurMaskFilterProps,\n CTMProps,\n BoxProps,\n BoxShadowProps,\n ImageProps,\n CircleProps,\n PointsProps,\n PathProps,\n RectProps,\n RoundedRectProps,\n OvalProps,\n LineProps,\n PatchProps,\n VerticesProps,\n DiffRectProps,\n TextProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n ParagraphProps,\n AtlasProps,\n SkottieProps,\n DrawingNodeProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer\";\nimport { isSharedValue } from \"../utils\";\n\n/**\n * Currently the recorder only work if the GPU resources (e.g Images) are owned by the main thread.\n * It will crash otherwise on Ganesh (iOS/Android).\n */\nexport class ReanimatedRecorder implements BaseRecorder {\n private values = new Set<SharedValue<unknown>>();\n private recorder: JsiRecorder;\n\n constructor(Skia: Skia) {\n this.recorder = Skia.Recorder();\n }\n\n reset() {\n this.values.clear();\n this.recorder.reset();\n }\n\n private processAnimationValues(props?: Record<string, unknown>) {\n if (!props) {\n return;\n }\n Object.values(props).forEach((value) => {\n if (isSharedValue(value) && !this.values.has(value)) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n value.name = `variable${this.values.size}`;\n this.values.add(value as SharedValue<unknown>);\n }\n });\n }\n\n getRecorder() {\n return this.recorder;\n }\n\n getSharedValues() {\n return Array.from(this.values);\n }\n\n saveGroup(props?: AnimatedProps<Pick<DrawingNodeProps, \"zIndex\">>): void {\n if (props) {\n this.processAnimationValues(props);\n this.recorder.saveGroup(props);\n } else {\n this.recorder.saveGroup();\n }\n }\n\n restoreGroup(): void {\n this.recorder.restoreGroup();\n }\n\n savePaint(props: AnimatedProps<PaintProps>, standalone: boolean): void {\n this.processAnimationValues(props);\n this.recorder.savePaint(props, standalone);\n }\n\n restorePaint(): void {\n this.recorder.restorePaint();\n }\n\n restorePaintDeclaration(): void {\n this.recorder.restorePaintDeclaration();\n }\n\n materializePaint(): void {\n this.recorder.materializePaint();\n }\n\n pushPathEffect(\n pathEffectType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushPathEffect(pathEffectType, props);\n }\n\n pushImageFilter(\n imageFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushImageFilter(imageFilterType, props);\n }\n\n pushColorFilter(\n colorFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushColorFilter(colorFilterType, props);\n }\n\n pushShader(\n shaderType: NodeType,\n props: AnimatedProps<unknown>,\n children: number\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushShader(shaderType, props, children);\n }\n\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void {\n this.processAnimationValues(props);\n this.recorder.pushBlurMaskFilter(props);\n }\n\n composePathEffect(): void {\n this.recorder.composePathEffect();\n }\n\n composeColorFilter(): void {\n this.recorder.composeColorFilter();\n }\n\n composeImageFilter(): void {\n this.recorder.composeImageFilter();\n }\n\n saveCTM(props: AnimatedProps<CTMProps>): void {\n this.processAnimationValues(props);\n this.recorder.saveCTM(props);\n }\n\n restoreCTM(): void {\n this.recorder.restoreCTM();\n }\n\n drawPaint(): void {\n this.recorder.drawPaint();\n }\n\n saveLayer(): void {\n this.recorder.saveLayer();\n }\n\n saveBackdropFilter(): void {\n this.recorder.saveBackdropFilter();\n }\n\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n }[]\n ): void {\n this.processAnimationValues(boxProps);\n shadows.forEach((shadow) => {\n this.processAnimationValues(\n shadow.props as AnimatedProps<BoxShadowProps>\n );\n });\n this.recorder.drawBox(\n boxProps,\n // TODO: Fix this type BaseRecorder.drawBox()\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n shadows.map((s) => s.props)\n );\n }\n\n drawImage(props: AnimatedProps<ImageProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawImage(props);\n }\n\n drawCircle(props: AnimatedProps<CircleProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawCircle(props);\n }\n\n drawPoints(props: AnimatedProps<PointsProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPoints(props);\n }\n\n drawPath(props: AnimatedProps<PathProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPath(props);\n }\n\n drawRect(props: AnimatedProps<RectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawRect(props);\n }\n\n drawRRect(props: AnimatedProps<RoundedRectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawRRect(props);\n }\n\n drawOval(props: AnimatedProps<OvalProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawOval(props);\n }\n\n drawLine(props: AnimatedProps<LineProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawLine(props);\n }\n\n drawPatch(props: AnimatedProps<PatchProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPatch(props);\n }\n\n drawVertices(props: AnimatedProps<VerticesProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawVertices(props);\n }\n\n drawDiffRect(props: AnimatedProps<DiffRectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawDiffRect(props);\n }\n\n drawText(props: AnimatedProps<TextProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawText(props);\n }\n\n drawTextPath(props: AnimatedProps<TextPathProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawTextPath(props);\n }\n\n drawTextBlob(props: AnimatedProps<TextBlobProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawTextBlob(props);\n }\n\n drawGlyphs(props: AnimatedProps<GlyphsProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawGlyphs(props);\n }\n\n drawPicture(props: AnimatedProps<PictureProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPicture(props);\n }\n\n drawImageSVG(props: AnimatedProps<ImageSVGProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawImageSVG(props);\n }\n\n drawParagraph(props: AnimatedProps<ParagraphProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawParagraph(props);\n }\n\n drawAtlas(props: AnimatedProps<AtlasProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawAtlas(props);\n }\n\n drawSkottie(props: AnimatedProps<SkottieProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawSkottie(props);\n }\n}\n"],"mappings":";;;;;;AAiCA,IAAAA,MAAA,GAAAC,OAAA;AAAyC,SAAAC,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,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AACN,QAAQ,CAAC4D,YAAY,CAACtD,KAAK,CAAC;EACnC;EAEAuD,YAAYA,CAACvD,KAAmC,EAAQ;IACtD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAAC6D,YAAY,CAACvD,KAAK,CAAC;EACnC;EAEAwD,UAAUA,CAACxD,KAAiC,EAAQ;IAClD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAAC8D,UAAU,CAACxD,KAAK,CAAC;EACjC;EAEAyD,WAAWA,CAACzD,KAAkC,EAAQ;IACpD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAAC+D,WAAW,CAACzD,KAAK,CAAC;EAClC;EAEA0D,YAAYA,CAAC1D,KAAmC,EAAQ;IACtD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAACgE,YAAY,CAAC1D,KAAK,CAAC;EACnC;EAEA2D,aAAaA,CAAC3D,KAAoC,EAAQ;IACxD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAACiE,aAAa,CAAC3D,KAAK,CAAC;EACpC;EAEA4D,SAASA,CAAC5D,KAAgC,EAAQ;IAChD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAACkE,SAAS,CAAC5D,KAAK,CAAC;EAChC;EAEA6D,WAAWA,CAAC7D,KAAkC,EAAQ;IACpD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAACmE,WAAW,CAAC7D,KAAK,CAAC;EAClC;AACF;AAAC8D,OAAA,CAAAxE,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_SkiaPictureViewNativeComponent","_api","_SkiaViewNativeId","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","_defineProperty","_toPropertyKey","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","NativeSkiaPictureView","SkiaPictureViewNativeComponent","SkiaPictureView","React","Component","constructor","props","_nativeId","SkiaViewNativeId","current","picture","onSize","assertSkiaViewApi","SkiaViewApi","setJsiProperty","tick","nativeId","componentDidUpdate","prevProps","componentWillUnmount","requestId","cancelAnimationFrame","redraw","mode","requestAnimationFrame","makeImageSnapshot","rect","requestRedraw","render","debug","opaque","coldStart","viewProps","createElement","collapsable","nativeID","exports","Error"],"sources":["SkiaPictureView.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { SkRect } from \"../skia/types\";\nimport SkiaPictureViewNativeComponent from \"../specs/SkiaPictureViewNativeComponent\";\n\nimport { SkiaViewApi } from \"./api\";\nimport type { SkiaPictureViewNativeProps } from \"./types\";\nimport { SkiaViewNativeId } from \"./SkiaViewNativeId\";\n\nconst NativeSkiaPictureView = SkiaPictureViewNativeComponent;\n\ninterface SkiaPictureViewProps extends SkiaPictureViewNativeProps {\n mode?: \"default\" | \"continuous\";\n coldStart?: boolean;\n}\n\nexport class SkiaPictureView extends React.Component<SkiaPictureViewProps> {\n private requestId = 0;\n\n constructor(props: SkiaPictureViewProps) {\n super(props);\n this._nativeId = SkiaViewNativeId.current++;\n const { picture, onSize } = props;\n if (picture) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", picture);\n }\n if (onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n this.tick();\n }\n\n private _nativeId: number;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaPictureViewProps) {\n const { picture, onSize } = this.props;\n if (picture !== prevProps.picture) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", picture);\n }\n if (onSize !== prevProps.onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n this.tick();\n }\n\n componentWillUnmount() {\n if (this.requestId) {\n cancelAnimationFrame(this.requestId);\n }\n }\n\n private tick() {\n this.redraw();\n if (this.props.mode === \"continuous\") {\n this.requestId = requestAnimationFrame(this.tick.bind(this));\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertSkiaViewApi();\n SkiaViewApi.requestRedraw(this._nativeId);\n }\n\n render() {\n const {
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_SkiaPictureViewNativeComponent","_api","_SkiaViewNativeId","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","_defineProperty","_toPropertyKey","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","NativeSkiaPictureView","SkiaPictureViewNativeComponent","SkiaPictureView","React","Component","constructor","props","_nativeId","SkiaViewNativeId","current","picture","onSize","assertSkiaViewApi","SkiaViewApi","setJsiProperty","tick","nativeId","componentDidUpdate","prevProps","componentWillUnmount","requestId","cancelAnimationFrame","redraw","mode","requestAnimationFrame","makeImageSnapshot","rect","requestRedraw","render","debug","opaque","coldStart","viewProps","createElement","collapsable","nativeID","exports","Error"],"sources":["SkiaPictureView.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { SkRect } from \"../skia/types\";\nimport SkiaPictureViewNativeComponent from \"../specs/SkiaPictureViewNativeComponent\";\n\nimport { SkiaViewApi } from \"./api\";\nimport type { SkiaPictureViewNativeProps } from \"./types\";\nimport { SkiaViewNativeId } from \"./SkiaViewNativeId\";\n\nconst NativeSkiaPictureView = SkiaPictureViewNativeComponent;\n\ninterface SkiaPictureViewProps extends SkiaPictureViewNativeProps {\n mode?: \"default\" | \"continuous\";\n coldStart?: boolean;\n}\n\nexport class SkiaPictureView extends React.Component<SkiaPictureViewProps> {\n private requestId = 0;\n\n constructor(props: SkiaPictureViewProps) {\n super(props);\n this._nativeId = SkiaViewNativeId.current++;\n const { picture, onSize } = props;\n if (picture) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", picture);\n }\n if (onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n this.tick();\n }\n\n private _nativeId: number;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaPictureViewProps) {\n const { picture, onSize } = this.props;\n if (picture !== prevProps.picture) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", picture);\n }\n if (onSize !== prevProps.onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n this.tick();\n }\n\n componentWillUnmount() {\n if (this.requestId) {\n cancelAnimationFrame(this.requestId);\n }\n }\n\n private tick() {\n this.redraw();\n if (this.props.mode === \"continuous\") {\n this.requestId = requestAnimationFrame(this.tick.bind(this));\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertSkiaViewApi();\n SkiaViewApi.requestRedraw(this._nativeId);\n }\n\n render() {\n const {\n mode,\n debug = false,\n opaque = false,\n coldStart = false,\n ...viewProps\n } = this.props;\n return (\n <NativeSkiaPictureView\n collapsable={false}\n nativeID={`${this._nativeId}`}\n debug={debug}\n opaque={opaque}\n coldStart={coldStart}\n {...viewProps}\n />\n );\n }\n}\n\nconst assertSkiaViewApi = () => {\n if (\n SkiaViewApi === null ||\n SkiaViewApi.setJsiProperty === null ||\n SkiaViewApi.requestRedraw === null ||\n SkiaViewApi.makeImageSnapshot === null\n ) {\n throw Error(\"Skia View Api was not found.\");\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,+BAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,IAAA,GAAAF,OAAA;AAEA,IAAAG,iBAAA,GAAAH,OAAA;AAAsD,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,SAAA,WAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,CAAA,aAAAP,CAAA,MAAAA,CAAA,GAAAQ,SAAA,CAAAC,MAAA,EAAAT,CAAA,UAAAU,CAAA,GAAAF,SAAA,CAAAR,CAAA,YAAAW,CAAA,IAAAD,CAAA,OAAAE,cAAA,CAAAC,IAAA,CAAAH,CAAA,EAAAC,CAAA,MAAAJ,CAAA,CAAAI,CAAA,IAAAD,CAAA,CAAAC,CAAA,aAAAJ,CAAA,KAAAJ,QAAA,CAAAW,KAAA,OAAAN,SAAA;AAAA,SAAAO,gBAAAf,CAAA,EAAAW,CAAA,EAAAD,CAAA,YAAAC,CAAA,GAAAK,cAAA,CAAAL,CAAA,MAAAX,CAAA,GAAAI,MAAA,CAAAa,cAAA,CAAAjB,CAAA,EAAAW,CAAA,IAAAO,KAAA,EAAAR,CAAA,EAAAS,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAArB,CAAA,CAAAW,CAAA,IAAAD,CAAA,EAAAV,CAAA;AAAA,SAAAgB,eAAAN,CAAA,QAAAY,CAAA,G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B,EAAA1B,QAAA;MACpB4D,WAAW,EAAE,KAAM;MACnBC,QAAQ,EAAE,GAAG,IAAI,CAAC5B,SAAS,EAAG;MAC9BsB,KAAK,EAAEA,KAAM;MACbC,MAAM,EAAEA,MAAO;MACfC,SAAS,EAAEA;IAAU,GACjBC,SAAS,CACd,CAAC;EAEN;AACF;AAACI,OAAA,CAAAlC,eAAA,GAAAA,eAAA;AAED,MAAMU,iBAAiB,GAAGA,CAAA,KAAM;EAC9B,IACEC,gBAAW,KAAK,IAAI,IACpBA,gBAAW,CAACC,cAAc,KAAK,IAAI,IACnCD,gBAAW,CAACc,aAAa,KAAK,IAAI,IAClCd,gBAAW,CAACY,iBAAiB,KAAK,IAAI,EACtC;IACA,MAAMY,KAAK,CAAC,8BAA8B,CAAC;EAC7C;AACF,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["Recorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type {\n TextProps,\n AtlasProps,\n BlurMaskFilterProps,\n BoxProps,\n BoxShadowProps,\n CircleProps,\n CTMProps,\n DiffRectProps,\n GlyphsProps,\n ImageProps,\n ImageSVGProps,\n LineProps,\n NodeType,\n OvalProps,\n PaintProps,\n ParagraphProps,\n PatchProps,\n PathProps,\n PictureProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n TextBlobProps,\n TextPathProps,\n VerticesProps,\n SkottieProps,\n DrawingNodeProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer/processors/Animations/Animations\";\n\nimport type { SkPicture } from \"./Picture\";\n\nexport interface BaseRecorder {\n saveGroup(
|
|
1
|
+
{"version":3,"names":[],"sources":["Recorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type {\n TextProps,\n AtlasProps,\n BlurMaskFilterProps,\n BoxProps,\n BoxShadowProps,\n CircleProps,\n CTMProps,\n DiffRectProps,\n GlyphsProps,\n ImageProps,\n ImageSVGProps,\n LineProps,\n NodeType,\n OvalProps,\n PaintProps,\n ParagraphProps,\n PatchProps,\n PathProps,\n PictureProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n TextBlobProps,\n TextPathProps,\n VerticesProps,\n SkottieProps,\n DrawingNodeProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer/processors/Animations/Animations\";\n\nimport type { SkPicture } from \"./Picture\";\n\nexport interface BaseRecorder {\n saveGroup(props?: AnimatedProps<Pick<DrawingNodeProps, \"zIndex\">>): void;\n restoreGroup(): void;\n savePaint(props: AnimatedProps<PaintProps>, standalone: boolean): void;\n restorePaint(): void;\n restorePaintDeclaration(): void;\n materializePaint(): void;\n pushPathEffect(pathEffectType: NodeType, props: AnimatedProps<unknown>): void;\n pushImageFilter(\n imageFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void;\n pushColorFilter(\n colorFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void;\n pushShader(\n shaderType: NodeType,\n props: AnimatedProps<unknown>,\n children: number\n ): void;\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void;\n composePathEffect(): void;\n composeColorFilter(): void;\n composeImageFilter(): void;\n saveCTM(props: AnimatedProps<CTMProps>): void;\n restoreCTM(): void;\n drawPaint(): void;\n saveLayer(): void;\n saveBackdropFilter(): void;\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n animatedProps?: Record<string, SharedValue<unknown>>;\n }[]\n ): void;\n drawImage(props: AnimatedProps<ImageProps>): void;\n drawCircle(props: AnimatedProps<CircleProps>): void;\n drawPoints(props: AnimatedProps<PointsProps>): void;\n drawPath(props: AnimatedProps<PathProps>): void;\n drawRect(props: AnimatedProps<RectProps>): void;\n drawRRect(props: AnimatedProps<RoundedRectProps>): void;\n drawOval(props: AnimatedProps<OvalProps>): void;\n drawLine(props: AnimatedProps<LineProps>): void;\n drawPatch(props: AnimatedProps<PatchProps>): void;\n drawVertices(props: AnimatedProps<VerticesProps>): void;\n drawDiffRect(props: AnimatedProps<DiffRectProps>): void;\n drawText(props: AnimatedProps<TextProps>): void;\n drawTextPath(props: AnimatedProps<TextPathProps>): void;\n drawTextBlob(props: AnimatedProps<TextBlobProps>): void;\n drawGlyphs(props: AnimatedProps<GlyphsProps>): void;\n drawPicture(props: AnimatedProps<PictureProps>): void;\n drawImageSVG(props: AnimatedProps<ImageSVGProps>): void;\n drawParagraph(props: AnimatedProps<ParagraphProps>): void;\n drawSkottie(props: AnimatedProps<SkottieProps>): void;\n drawAtlas(props: AnimatedProps<AtlasProps>): void;\n}\n\nexport interface JsiRecorder extends BaseRecorder {\n play(picture: SkPicture): void;\n applyUpdates(variables: SharedValue<unknown>[]): void;\n reset(): void;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CommandType } from "./Core";
|
|
1
|
+
import { CommandType, isGroup } from "./Core";
|
|
2
2
|
const CommandTypeNames = {
|
|
3
3
|
[CommandType.Group]: "Group",
|
|
4
4
|
[CommandType.SavePaint]: "SavePaint",
|
|
@@ -40,7 +40,6 @@ const CommandTypeNames = {
|
|
|
40
40
|
[CommandType.DrawAtlas]: "DrawAtlas",
|
|
41
41
|
[CommandType.DrawSkottie]: "DrawSkottie"
|
|
42
42
|
};
|
|
43
|
-
import { isGroup } from "./Core";
|
|
44
43
|
const serializeProps = props => {
|
|
45
44
|
try {
|
|
46
45
|
return JSON.stringify(props, (key, value) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CommandType","CommandTypeNames","Group","SavePaint","RestorePaint","SaveCTM","RestoreCTM","PushColorFilter","PushBlurMaskFilter","PushImageFilter","PushPathEffect","PushShader","ComposeColorFilter","ComposeImageFilter","ComposePathEffect","MaterializePaint","SaveBackdropFilter","SaveLayer","RestorePaintDeclaration","DrawBox","DrawImage","DrawCircle","DrawPaint","DrawPoints","DrawPath","DrawRect","DrawRRect","DrawOval","DrawLine","DrawPatch","DrawVertices","DrawDiffRect","DrawText","DrawTextPath","DrawTextBlob","DrawGlyphs","DrawPicture","DrawImageSVG","DrawParagraph","DrawAtlas","DrawSkottie","
|
|
1
|
+
{"version":3,"names":["CommandType","isGroup","CommandTypeNames","Group","SavePaint","RestorePaint","SaveCTM","RestoreCTM","PushColorFilter","PushBlurMaskFilter","PushImageFilter","PushPathEffect","PushShader","ComposeColorFilter","ComposeImageFilter","ComposePathEffect","MaterializePaint","SaveBackdropFilter","SaveLayer","RestorePaintDeclaration","DrawBox","DrawImage","DrawCircle","DrawPaint","DrawPoints","DrawPath","DrawRect","DrawRRect","DrawOval","DrawLine","DrawPatch","DrawVertices","DrawDiffRect","DrawText","DrawTextPath","DrawTextBlob","DrawGlyphs","DrawPicture","DrawImageSVG","DrawParagraph","DrawAtlas","DrawSkottie","serializeProps","props","JSON","stringify","key","value","undefined","toString","e","debugTree","commands","indent","result","prefix","repeat","forEach","cmd","index","type","children","length"],"sources":["Debug.ts"],"sourcesContent":["import { CommandType, isGroup } from \"./Core\";\nimport type { Command } from \"./Core\";\n\nconst CommandTypeNames: Record<CommandType, string> = {\n [CommandType.Group]: \"Group\",\n [CommandType.SavePaint]: \"SavePaint\",\n [CommandType.RestorePaint]: \"RestorePaint\",\n [CommandType.SaveCTM]: \"SaveCTM\",\n [CommandType.RestoreCTM]: \"RestoreCTM\",\n [CommandType.PushColorFilter]: \"PushColorFilter\",\n [CommandType.PushBlurMaskFilter]: \"PushBlurMaskFilter\",\n [CommandType.PushImageFilter]: \"PushImageFilter\",\n [CommandType.PushPathEffect]: \"PushPathEffect\",\n [CommandType.PushShader]: \"PushShader\",\n [CommandType.ComposeColorFilter]: \"ComposeColorFilter\",\n [CommandType.ComposeImageFilter]: \"ComposeImageFilter\",\n [CommandType.ComposePathEffect]: \"ComposePathEffect\",\n [CommandType.MaterializePaint]: \"MaterializePaint\",\n [CommandType.SaveBackdropFilter]: \"SaveBackdropFilter\",\n [CommandType.SaveLayer]: \"SaveLayer\",\n [CommandType.RestorePaintDeclaration]: \"RestorePaintDeclaration\",\n [CommandType.DrawBox]: \"DrawBox\",\n [CommandType.DrawImage]: \"DrawImage\",\n [CommandType.DrawCircle]: \"DrawCircle\",\n [CommandType.DrawPaint]: \"DrawPaint\",\n [CommandType.DrawPoints]: \"DrawPoints\",\n [CommandType.DrawPath]: \"DrawPath\",\n [CommandType.DrawRect]: \"DrawRect\",\n [CommandType.DrawRRect]: \"DrawRRect\",\n [CommandType.DrawOval]: \"DrawOval\",\n [CommandType.DrawLine]: \"DrawLine\",\n [CommandType.DrawPatch]: \"DrawPatch\",\n [CommandType.DrawVertices]: \"DrawVertices\",\n [CommandType.DrawDiffRect]: \"DrawDiffRect\",\n [CommandType.DrawText]: \"DrawText\",\n [CommandType.DrawTextPath]: \"DrawTextPath\",\n [CommandType.DrawTextBlob]: \"DrawTextBlob\",\n [CommandType.DrawGlyphs]: \"DrawGlyphs\",\n [CommandType.DrawPicture]: \"DrawPicture\",\n [CommandType.DrawImageSVG]: \"DrawImageSVG\",\n [CommandType.DrawParagraph]: \"DrawParagraph\",\n [CommandType.DrawAtlas]: \"DrawAtlas\",\n [CommandType.DrawSkottie]: \"DrawSkottie\",\n};\n\nconst serializeProps = (props: unknown): string => {\n try {\n return JSON.stringify(props, (key, value) => {\n if (key === \"children\") {\n return undefined;\n }\n if (typeof value === \"bigint\") {\n return value.toString();\n }\n return value;\n });\n } catch (e) {\n return `\"Error serializing props: ${e}\"`;\n }\n};\n\nexport const debugTree = (commands: Command[], indent = 0): string => {\n let result = \"[\\n\";\n const prefix = \" \".repeat(indent + 2);\n\n commands.forEach((cmd, index) => {\n const type = CommandTypeNames[cmd.type] || \"Unknown\";\n result += `${prefix}{ \"type\": \"${type}\"`;\n\n if (\"props\" in cmd) {\n result += `, \"props\": ${serializeProps(cmd.props)}`;\n }\n\n if (isGroup(cmd)) {\n result += `, \"children\": ${debugTree(cmd.children, indent + 2)}`;\n }\n\n result += \" }\";\n if (index < commands.length - 1) {\n result += \",\";\n }\n result += \"\\n\";\n });\n\n result += \" \".repeat(indent) + \"]\";\n return result;\n};\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,OAAO,QAAQ,QAAQ;AAG7C,MAAMC,gBAA6C,GAAG;EACpD,CAACF,WAAW,CAACG,KAAK,GAAG,OAAO;EAC5B,CAACH,WAAW,CAACI,SAAS,GAAG,WAAW;EACpC,CAACJ,WAAW,CAACK,YAAY,GAAG,cAAc;EAC1C,CAACL,WAAW,CAACM,OAAO,GAAG,SAAS;EAChC,CAACN,WAAW,CAACO,UAAU,GAAG,YAAY;EACtC,CAACP,WAAW,CAACQ,eAAe,GAAG,iBAAiB;EAChD,CAACR,WAAW,CAACS,kBAAkB,GAAG,oBAAoB;EACtD,CAACT,WAAW,CAACU,eAAe,GAAG,iBAAiB;EAChD,CAACV,WAAW,CAACW,cAAc,GAAG,gBAAgB;EAC9C,CAACX,WAAW,CAACY,UAAU,GAAG,YAAY;EACtC,CAACZ,WAAW,CAACa,kBAAkB,GAAG,oBAAoB;EACtD,CAACb,WAAW,CAACc,kBAAkB,GAAG,oBAAoB;EACtD,CAACd,WAAW,CAACe,iBAAiB,GAAG,mBAAmB;EACpD,CAACf,WAAW,CAACgB,gBAAgB,GAAG,kBAAkB;EAClD,CAAChB,WAAW,CAACiB,kBAAkB,GAAG,oBAAoB;EACtD,CAACjB,WAAW,CAACkB,SAAS,GAAG,WAAW;EACpC,CAAClB,WAAW,CAACmB,uBAAuB,GAAG,yBAAyB;EAChE,CAACnB,WAAW,CAACoB,OAAO,GAAG,SAAS;EAChC,CAACpB,WAAW,CAACqB,SAAS,GAAG,WAAW;EACpC,CAACrB,WAAW,CAACsB,UAAU,GAAG,YAAY;EACtC,CAACtB,WAAW,CAACuB,SAAS,GAAG,WAAW;EACpC,CAACvB,WAAW,CAACwB,UAAU,GAAG,YAAY;EACtC,CAACxB,WAAW,CAACyB,QAAQ,GAAG,UAAU;EAClC,CAACzB,WAAW,C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AG,KAAK;EAClB,MAAMC,MAAM,GAAG,GAAG,CAACC,MAAM,CAACH,MAAM,GAAG,CAAC,CAAC;EAErCD,QAAQ,CAACK,OAAO,CAAC,CAACC,GAAG,EAAEC,KAAK,KAAK;IAC/B,MAAMC,IAAI,GAAG1D,gBAAgB,CAACwD,GAAG,CAACE,IAAI,CAAC,IAAI,SAAS;IACpDN,MAAM,IAAI,GAAGC,MAAM,cAAcK,IAAI,GAAG;IAExC,IAAI,OAAO,IAAIF,GAAG,EAAE;MAClBJ,MAAM,IAAI,cAAcZ,cAAc,CAACgB,GAAG,CAACf,KAAK,CAAC,EAAE;IACrD;IAEA,IAAI1C,OAAO,CAACyD,GAAG,CAAC,EAAE;MAChBJ,MAAM,IAAI,iBAAiBH,SAAS,CAACO,GAAG,CAACG,QAAQ,EAAER,MAAM,GAAG,CAAC,CAAC,EAAE;IAClE;IAEAC,MAAM,IAAI,IAAI;IACd,IAAIK,KAAK,GAAGP,QAAQ,CAACU,MAAM,GAAG,CAAC,EAAE;MAC/BR,MAAM,IAAI,GAAG;IACf;IACAA,MAAM,IAAI,IAAI;EAChB,CAAC,CAAC;EAEFA,MAAM,IAAI,GAAG,CAACE,MAAM,CAACH,MAAM,CAAC,GAAG,GAAG;EAClC,OAAOC,MAAM;AACf,CAAC","ignoreList":[]}
|
|
@@ -20,40 +20,40 @@ const getZIndex = command => {
|
|
|
20
20
|
}
|
|
21
21
|
return zIndex;
|
|
22
22
|
};
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (pendingGroups.length === 0) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
pendingGroups.sort((a, b) => a.zIndex === b.zIndex ? a.order - b.order : a.zIndex - b.zIndex).forEach(({
|
|
30
|
-
command
|
|
31
|
-
}) => {
|
|
32
|
-
play(ctx, command);
|
|
33
|
-
});
|
|
34
|
-
pendingGroups.length = 0;
|
|
35
|
-
};
|
|
36
|
-
const playGroup = (ctx, group) => {
|
|
37
|
-
"worklet";
|
|
23
|
+
const play = (ctx, _command) => {
|
|
24
|
+
const flushPendingGroups = (ctx, pendingGroups) => {
|
|
25
|
+
"worklet";
|
|
38
26
|
|
|
39
|
-
|
|
40
|
-
group.children.forEach(child => {
|
|
41
|
-
if (isGroup(child)) {
|
|
42
|
-
pending.push({
|
|
43
|
-
command: child,
|
|
44
|
-
zIndex: getZIndex(child),
|
|
45
|
-
order: pending.length
|
|
46
|
-
});
|
|
27
|
+
if (pendingGroups.length === 0) {
|
|
47
28
|
return;
|
|
48
29
|
}
|
|
30
|
+
pendingGroups.sort((a, b) => a.zIndex === b.zIndex ? a.order - b.order : a.zIndex - b.zIndex).forEach(({
|
|
31
|
+
command
|
|
32
|
+
}) => {
|
|
33
|
+
play(ctx, command);
|
|
34
|
+
});
|
|
35
|
+
pendingGroups.length = 0;
|
|
36
|
+
};
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
38
|
+
const playGroup = (ctx, group) => {
|
|
39
|
+
"worklet";
|
|
40
|
+
|
|
41
|
+
const pending = [];
|
|
42
|
+
group.children.forEach(child => {
|
|
43
|
+
if (isGroup(child)) {
|
|
44
|
+
pending.push({
|
|
45
|
+
command: child,
|
|
46
|
+
zIndex: getZIndex(child),
|
|
47
|
+
order: pending.length
|
|
48
|
+
});
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
flushPendingGroups(ctx, pending);
|
|
52
|
+
play(ctx, child);
|
|
53
|
+
});
|
|
49
54
|
flushPendingGroups(ctx, pending);
|
|
50
|
-
|
|
51
|
-
});
|
|
52
|
-
flushPendingGroups(ctx, pending);
|
|
53
|
-
};
|
|
54
|
-
function play(ctx, _command) {
|
|
55
|
+
};
|
|
55
56
|
"worklet";
|
|
56
|
-
|
|
57
57
|
if (isGroup(_command)) {
|
|
58
58
|
playGroup(ctx, _command);
|
|
59
59
|
return;
|
|
@@ -170,13 +170,13 @@ function play(ctx, _command) {
|
|
|
170
170
|
ctx.paints.pop();
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
|
-
}
|
|
174
|
-
export
|
|
173
|
+
};
|
|
174
|
+
export function replay(ctx, commands) {
|
|
175
175
|
"worklet";
|
|
176
176
|
|
|
177
177
|
//console.log(debugTree(commands));
|
|
178
178
|
commands.forEach(command => {
|
|
179
179
|
play(ctx, command);
|
|
180
180
|
});
|
|
181
|
-
}
|
|
181
|
+
}
|
|
182
182
|
//# sourceMappingURL=Player.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["drawCircle","drawImage","drawOval","drawPath","drawPoints","drawRect","drawRRect","drawLine","drawAtlas","drawParagraph","drawImageSVG","drawPicture","drawGlyphs","drawTextBlob","drawTextPath","drawText","drawDiffRect","drawVertices","drawPatch","drawSkottie","drawBox","isBoxCommand","composeColorFilters","isPushColorFilter","pushColorFilter","saveCTM","setBlurMaskFilter","isPushImageFilter","pushImageFilter","composeImageFilters","setPaintProperties","composePathEffects","isPushPathEffect","pushPathEffect","isPushShader","pushShader","CommandType","isCommand","isDrawCommand","isGroup","materializeCommand","getZIndex","command","_materialized$props","materialized","zIndex","props","Number","isNaN","flushPendingGroups","ctx","pendingGroups","length","sort","a","b","order","forEach","play","playGroup","group","pending","children","child","push","_command","SaveBackdropFilter","saveBackdropFilter","SaveLayer","materializePaint","paint","paintDeclarations","pop","canvas","saveLayer","SavePaint","paints","standalone","savePaint","freshPaint","Skia","Paint","assign","RestorePaint","restorePaint","ComposeColorFilter","RestorePaintDeclaration","Error","MaterializePaint","ComposePathEffect","ComposeImageFilter","PushBlurMaskFilter","SaveCTM","RestoreCTM","restore","copy","setAlphaf","getAlphaf","getOpacity","p","DrawPaint","drawPaint","DrawImage","DrawCircle","DrawPoints","DrawPath","DrawRect","DrawRRect","DrawOval","DrawLine","DrawPatch","DrawVertices","DrawDiffRect","DrawText","DrawTextPath","DrawTextBlob","DrawGlyphs","DrawPicture","DrawImageSVG","DrawParagraph","DrawAtlas","DrawSkottie","console","warn","type","replay","commands"],"sources":["Player.ts"],"sourcesContent":["import type { DrawingNodeProps } from \"../../dom/types\";\n\nimport {\n drawCircle,\n drawImage,\n drawOval,\n drawPath,\n drawPoints,\n drawRect,\n drawRRect,\n drawLine,\n drawAtlas,\n drawParagraph,\n drawImageSVG,\n drawPicture,\n drawGlyphs,\n drawTextBlob,\n drawTextPath,\n drawText,\n drawDiffRect,\n drawVertices,\n drawPatch,\n drawSkottie,\n} from \"./commands/Drawing\";\nimport { drawBox, isBoxCommand } from \"./commands/Box\";\nimport {\n composeColorFilters,\n isPushColorFilter,\n pushColorFilter,\n} from \"./commands/ColorFilters\";\nimport { saveCTM } from \"./commands/CTM\";\nimport {\n setBlurMaskFilter,\n isPushImageFilter,\n pushImageFilter,\n composeImageFilters,\n} from \"./commands/ImageFilters\";\nimport { setPaintProperties } from \"./commands/Paint\";\nimport {\n composePathEffects,\n isPushPathEffect,\n pushPathEffect,\n} from \"./commands/PathEffects\";\nimport { isPushShader, pushShader } from \"./commands/Shaders\";\nimport {\n CommandType,\n isCommand,\n isDrawCommand,\n isGroup,\n materializeCommand,\n} from \"./Core\";\nimport type { Command, GroupCommand } from \"./Core\";\nimport type { DrawingContext } from \"./DrawingContext\";\n\ntype PendingGroup = {\n command: GroupCommand;\n zIndex: number;\n order: number;\n};\n\nconst getZIndex = (command: GroupCommand) => {\n \"worklet\";\n const materialized = materializeCommand(command);\n const { zIndex } = (materialized.props ?? {}) as DrawingNodeProps;\n if (typeof zIndex !== \"number\" || Number.isNaN(zIndex)) {\n return 0;\n }\n return zIndex;\n};\n\nconst flushPendingGroups = (\n ctx: DrawingContext,\n pendingGroups: PendingGroup[]\n) => {\n \"worklet\";\n if (pendingGroups.length === 0) {\n return;\n }\n pendingGroups\n .sort((a, b) =>\n a.zIndex === b.zIndex ? a.order - b.order : a.zIndex - b.zIndex\n )\n .forEach(({ command }) => {\n play(ctx, command);\n });\n pendingGroups.length = 0;\n};\n\nconst playGroup = (ctx: DrawingContext, group: GroupCommand) => {\n \"worklet\";\n const pending: PendingGroup[] = [];\n group.children.forEach((child) => {\n if (isGroup(child)) {\n pending.push({\n command: child,\n zIndex: getZIndex(child),\n order: pending.length,\n });\n return;\n }\n flushPendingGroups(ctx, pending);\n play(ctx, child);\n });\n flushPendingGroups(ctx, pending);\n};\n\nfunction play(ctx: DrawingContext, _command: Command) {\n \"worklet\";\n if (isGroup(_command)) {\n playGroup(ctx, _command);\n return;\n }\n const command = materializeCommand(_command);\n if (isCommand(command, CommandType.SaveBackdropFilter)) {\n ctx.saveBackdropFilter();\n } else if (isCommand(command, CommandType.SaveLayer)) {\n ctx.materializePaint();\n const paint = ctx.paintDeclarations.pop();\n ctx.canvas.saveLayer(paint);\n } else if (isDrawCommand(command, CommandType.SavePaint)) {\n if (command.props.paint) {\n ctx.paints.push(command.props.paint);\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { standalone } = command as any;\n ctx.savePaint();\n if (standalone) {\n const freshPaint = ctx.Skia.Paint();\n ctx.paint.assign(freshPaint);\n }\n setPaintProperties(ctx.Skia, ctx, command.props, standalone);\n }\n } else if (isCommand(command, CommandType.RestorePaint)) {\n ctx.restorePaint();\n } else if (isCommand(command, CommandType.ComposeColorFilter)) {\n composeColorFilters(ctx);\n } else if (isCommand(command, CommandType.RestorePaintDeclaration)) {\n ctx.materializePaint();\n const paint = ctx.restorePaint();\n if (!paint) {\n throw new Error(\"No paint declaration to push\");\n }\n ctx.paintDeclarations.push(paint);\n } else if (isCommand(command, CommandType.MaterializePaint)) {\n ctx.materializePaint();\n } else if (isPushColorFilter(command)) {\n pushColorFilter(ctx, command);\n } else if (isPushShader(command)) {\n pushShader(ctx, command);\n } else if (isPushImageFilter(command)) {\n pushImageFilter(ctx, command);\n } else if (isPushPathEffect(command)) {\n pushPathEffect(ctx, command);\n } else if (isCommand(command, CommandType.ComposePathEffect)) {\n composePathEffects(ctx);\n } else if (isCommand(command, CommandType.ComposeImageFilter)) {\n composeImageFilters(ctx);\n } else if (isDrawCommand(command, CommandType.PushBlurMaskFilter)) {\n setBlurMaskFilter(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.SaveCTM)) {\n saveCTM(ctx, command.props);\n } else if (isCommand(command, CommandType.RestoreCTM)) {\n ctx.canvas.restore();\n } else {\n // TODO: is a copy needed here?\n // apply opacity to the current paint.\n const paint = ctx.paint.copy();\n paint.setAlphaf(paint.getAlphaf() * ctx.getOpacity());\n const paints = [paint, ...ctx.paintDeclarations];\n ctx.paintDeclarations = [];\n paints.forEach((p) => {\n ctx.paints.push(p);\n if (isBoxCommand(command)) {\n drawBox(ctx, command);\n } else if (isCommand(command, CommandType.DrawPaint)) {\n ctx.canvas.drawPaint(ctx.paint);\n } else if (isDrawCommand(command, CommandType.DrawImage)) {\n drawImage(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawCircle)) {\n drawCircle(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPoints)) {\n drawPoints(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPath)) {\n drawPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRect)) {\n drawRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRRect)) {\n drawRRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawOval)) {\n drawOval(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawLine)) {\n drawLine(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPatch)) {\n drawPatch(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawVertices)) {\n drawVertices(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawDiffRect)) {\n drawDiffRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawText)) {\n drawText(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextPath)) {\n drawTextPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextBlob)) {\n drawTextBlob(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawGlyphs)) {\n drawGlyphs(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPicture)) {\n drawPicture(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawImageSVG)) {\n drawImageSVG(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawParagraph)) {\n drawParagraph(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawAtlas)) {\n drawAtlas(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawSkottie)) {\n drawSkottie(ctx, command.props);\n } else {\n console.warn(`Unknown command: ${command.type}`);\n }\n ctx.paints.pop();\n });\n }\n}\n\nexport const replay = (ctx: DrawingContext, commands: Command[]) => {\n \"worklet\";\n //console.log(debugTree(commands));\n commands.forEach((command) => {\n play(ctx, command);\n });\n};\n"],"mappings":"AAEA,SACEA,UAAU,EACVC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACVC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,SAAS,EACTC,aAAa,EACbC,YAAY,EACZC,WAAW,EACXC,UAAU,EACVC,YAAY,EACZC,YAAY,EACZC,QAAQ,EACRC,YAAY,EACZC,YAAY,EACZC,SAAS,EACTC,WAAW,QACN,oBAAoB;AAC3B,SAASC,OAAO,EAAEC,YAAY,QAAQ,gBAAgB;AACtD,SACEC,mBAAmB,EACnBC,iBAAiB,EACjBC,eAAe,QACV,yBAAyB;AAChC,SAASC,OAAO,QAAQ,gBAAgB;AACxC,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,eAAe,EACfC,mBAAmB,QACd,yBAAyB;AAChC,SAASC,kBAAkB,QAAQ,kBAAkB;AACrD,SACEC,kBAAkB,EAClBC,gBAAgB,EAChBC,cAAc,QACT,wBAAwB;AAC/B,SAASC,YAAY,EAAEC,UAAU,QAAQ,oBAAoB;AAC7D,SACEC,WAAW,EACXC,SAAS,EACTC,aAAa,EACbC,OAAO,EACPC,kBAAkB,QACb,QAAQ;AAUf,MAAMC,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AM,IAAIR,aAAa,CAACI,OAAO,EAAEN,WAAW,CAACkF,YAAY,CAAC,EAAE;QAC3D5G,YAAY,CAACwC,GAAG,EAAER,OAAO,CAACI,KAAK,CAAC;MAClC,CAAC,MAAM,IAAIR,aAAa,CAACI,OAAO,EAAEN,WAAW,CAACmF,aAAa,CAAC,EAAE;QAC5D9G,aAAa,CAACyC,GAAG,EAAER,OAAO,CAACI,KAAK,CAAC;MACnC,CAAC,MAAM,IAAIR,aAAa,CAACI,OAAO,EAAEN,WAAW,CAACoF,SAAS,CAAC,EAAE;QACxDhH,SAAS,CAAC0C,GAAG,EAAER,OAAO,CAACI,KAAK,CAAC;MAC/B,CAAC,MAAM,IAAIR,aAAa,CAACI,OAAO,EAAEN,WAAW,CAACqF,WAAW,CAAC,EAAE;QAC1DtG,WAAW,CAAC+B,GAAG,EAAER,OAAO,CAACI,KAAK,CAAC;MACjC,CAAC,MAAM;QACL4E,OAAO,CAACC,IAAI,CAAC,oBAAoBjF,OAAO,CAACkF,IAAI,EAAE,CAAC;MAClD;MACA1E,GAAG,CAAC0B,MAAM,CAACJ,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC;EACJ;AACF;AAEA,OAAO,MAAMqD,MAAM,GAAGA,CAAC3E,GAAmB,EAAE4E,QAAmB,KAAK;EAClE,SAAS;;EACT;EACAA,QAAQ,CAACrE,OAAO,CAAEf,OAAO,IAAK;IAC5BgB,IAAI,CAACR,GAAG,EAAER,OAAO,CAAC;EACpB,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["drawCircle","drawImage","drawOval","drawPath","drawPoints","drawRect","drawRRect","drawLine","drawAtlas","drawParagraph","drawImageSVG","drawPicture","drawGlyphs","drawTextBlob","drawTextPath","drawText","drawDiffRect","drawVertices","drawPatch","drawSkottie","drawBox","isBoxCommand","composeColorFilters","isPushColorFilter","pushColorFilter","saveCTM","setBlurMaskFilter","isPushImageFilter","pushImageFilter","composeImageFilters","setPaintProperties","composePathEffects","isPushPathEffect","pushPathEffect","isPushShader","pushShader","CommandType","isCommand","isDrawCommand","isGroup","materializeCommand","getZIndex","command","_materialized$props","materialized","zIndex","props","Number","isNaN","play","ctx","_command","flushPendingGroups","pendingGroups","length","sort","a","b","order","forEach","playGroup","group","pending","children","child","push","SaveBackdropFilter","saveBackdropFilter","SaveLayer","materializePaint","paint","paintDeclarations","pop","canvas","saveLayer","SavePaint","paints","standalone","savePaint","freshPaint","Skia","Paint","assign","RestorePaint","restorePaint","ComposeColorFilter","RestorePaintDeclaration","Error","MaterializePaint","ComposePathEffect","ComposeImageFilter","PushBlurMaskFilter","SaveCTM","RestoreCTM","restore","copy","setAlphaf","getAlphaf","getOpacity","p","DrawPaint","drawPaint","DrawImage","DrawCircle","DrawPoints","DrawPath","DrawRect","DrawRRect","DrawOval","DrawLine","DrawPatch","DrawVertices","DrawDiffRect","DrawText","DrawTextPath","DrawTextBlob","DrawGlyphs","DrawPicture","DrawImageSVG","DrawParagraph","DrawAtlas","DrawSkottie","console","warn","type","replay","commands"],"sources":["Player.ts"],"sourcesContent":["import type { DrawingNodeProps } from \"../../dom/types\";\n\nimport {\n drawCircle,\n drawImage,\n drawOval,\n drawPath,\n drawPoints,\n drawRect,\n drawRRect,\n drawLine,\n drawAtlas,\n drawParagraph,\n drawImageSVG,\n drawPicture,\n drawGlyphs,\n drawTextBlob,\n drawTextPath,\n drawText,\n drawDiffRect,\n drawVertices,\n drawPatch,\n drawSkottie,\n} from \"./commands/Drawing\";\nimport { drawBox, isBoxCommand } from \"./commands/Box\";\nimport {\n composeColorFilters,\n isPushColorFilter,\n pushColorFilter,\n} from \"./commands/ColorFilters\";\nimport { saveCTM } from \"./commands/CTM\";\nimport {\n setBlurMaskFilter,\n isPushImageFilter,\n pushImageFilter,\n composeImageFilters,\n} from \"./commands/ImageFilters\";\nimport { setPaintProperties } from \"./commands/Paint\";\nimport {\n composePathEffects,\n isPushPathEffect,\n pushPathEffect,\n} from \"./commands/PathEffects\";\nimport { isPushShader, pushShader } from \"./commands/Shaders\";\nimport {\n CommandType,\n isCommand,\n isDrawCommand,\n isGroup,\n materializeCommand,\n} from \"./Core\";\nimport type { Command, GroupCommand } from \"./Core\";\nimport type { DrawingContext } from \"./DrawingContext\";\n\ntype PendingGroup = {\n command: GroupCommand;\n zIndex: number;\n order: number;\n};\n\nconst getZIndex = (command: GroupCommand) => {\n \"worklet\";\n const materialized = materializeCommand(command);\n const { zIndex } = (materialized.props ?? {}) as DrawingNodeProps;\n if (typeof zIndex !== \"number\" || Number.isNaN(zIndex)) {\n return 0;\n }\n return zIndex;\n};\n\nconst play = (ctx: DrawingContext, _command: Command) => {\n const flushPendingGroups = (\n // eslint-disable-next-line @typescript-eslint/no-shadow\n ctx: DrawingContext,\n pendingGroups: PendingGroup[]\n ) => {\n \"worklet\";\n if (pendingGroups.length === 0) {\n return;\n }\n pendingGroups\n .sort((a, b) =>\n a.zIndex === b.zIndex ? a.order - b.order : a.zIndex - b.zIndex\n )\n .forEach(({ command }) => {\n play(ctx, command);\n });\n pendingGroups.length = 0;\n };\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const playGroup = (ctx: DrawingContext, group: GroupCommand) => {\n \"worklet\";\n const pending: PendingGroup[] = [];\n group.children.forEach((child) => {\n if (isGroup(child)) {\n pending.push({\n command: child,\n zIndex: getZIndex(child),\n order: pending.length,\n });\n return;\n }\n flushPendingGroups(ctx, pending);\n play(ctx, child);\n });\n flushPendingGroups(ctx, pending);\n };\n\n (\"worklet\");\n if (isGroup(_command)) {\n playGroup(ctx, _command);\n return;\n }\n const command = materializeCommand(_command);\n if (isCommand(command, CommandType.SaveBackdropFilter)) {\n ctx.saveBackdropFilter();\n } else if (isCommand(command, CommandType.SaveLayer)) {\n ctx.materializePaint();\n const paint = ctx.paintDeclarations.pop();\n ctx.canvas.saveLayer(paint);\n } else if (isDrawCommand(command, CommandType.SavePaint)) {\n if (command.props.paint) {\n ctx.paints.push(command.props.paint);\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { standalone } = command as any;\n ctx.savePaint();\n if (standalone) {\n const freshPaint = ctx.Skia.Paint();\n ctx.paint.assign(freshPaint);\n }\n setPaintProperties(ctx.Skia, ctx, command.props, standalone);\n }\n } else if (isCommand(command, CommandType.RestorePaint)) {\n ctx.restorePaint();\n } else if (isCommand(command, CommandType.ComposeColorFilter)) {\n composeColorFilters(ctx);\n } else if (isCommand(command, CommandType.RestorePaintDeclaration)) {\n ctx.materializePaint();\n const paint = ctx.restorePaint();\n if (!paint) {\n throw new Error(\"No paint declaration to push\");\n }\n ctx.paintDeclarations.push(paint);\n } else if (isCommand(command, CommandType.MaterializePaint)) {\n ctx.materializePaint();\n } else if (isPushColorFilter(command)) {\n pushColorFilter(ctx, command);\n } else if (isPushShader(command)) {\n pushShader(ctx, command);\n } else if (isPushImageFilter(command)) {\n pushImageFilter(ctx, command);\n } else if (isPushPathEffect(command)) {\n pushPathEffect(ctx, command);\n } else if (isCommand(command, CommandType.ComposePathEffect)) {\n composePathEffects(ctx);\n } else if (isCommand(command, CommandType.ComposeImageFilter)) {\n composeImageFilters(ctx);\n } else if (isDrawCommand(command, CommandType.PushBlurMaskFilter)) {\n setBlurMaskFilter(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.SaveCTM)) {\n saveCTM(ctx, command.props);\n } else if (isCommand(command, CommandType.RestoreCTM)) {\n ctx.canvas.restore();\n } else {\n // TODO: is a copy needed here?\n // apply opacity to the current paint.\n const paint = ctx.paint.copy();\n paint.setAlphaf(paint.getAlphaf() * ctx.getOpacity());\n const paints = [paint, ...ctx.paintDeclarations];\n ctx.paintDeclarations = [];\n paints.forEach((p) => {\n ctx.paints.push(p);\n if (isBoxCommand(command)) {\n drawBox(ctx, command);\n } else if (isCommand(command, CommandType.DrawPaint)) {\n ctx.canvas.drawPaint(ctx.paint);\n } else if (isDrawCommand(command, CommandType.DrawImage)) {\n drawImage(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawCircle)) {\n drawCircle(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPoints)) {\n drawPoints(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPath)) {\n drawPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRect)) {\n drawRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRRect)) {\n drawRRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawOval)) {\n drawOval(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawLine)) {\n drawLine(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPatch)) {\n drawPatch(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawVertices)) {\n drawVertices(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawDiffRect)) {\n drawDiffRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawText)) {\n drawText(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextPath)) {\n drawTextPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextBlob)) {\n drawTextBlob(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawGlyphs)) {\n drawGlyphs(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPicture)) {\n drawPicture(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawImageSVG)) {\n drawImageSVG(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawParagraph)) {\n drawParagraph(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawAtlas)) {\n drawAtlas(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawSkottie)) {\n drawSkottie(ctx, command.props);\n } else {\n console.warn(`Unknown command: ${command.type}`);\n }\n ctx.paints.pop();\n });\n }\n};\nexport function replay(ctx: DrawingContext, commands: Command[]) {\n \"worklet\";\n //console.log(debugTree(commands));\n commands.forEach((command) => {\n play(ctx, command);\n });\n}\n"],"mappings":"AAEA,SACEA,UAAU,EACVC,SAA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AAER,OAAO,CAACI,KAAK,CAAC;MACjC,CAAC,MAAM;QACL4E,OAAO,CAACC,IAAI,CAAC,oBAAoBjF,OAAO,CAACkF,IAAI,EAAE,CAAC;MAClD;MACA1E,GAAG,CAAC0B,MAAM,CAACJ,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC;EACJ;AACF,CAAC;AACD,OAAO,SAASqD,MAAMA,CAAC3E,GAAmB,EAAE4E,QAAmB,EAAE;EAC/D,SAAS;;EACT;EACAA,QAAQ,CAACnE,OAAO,CAAEjB,OAAO,IAAK;IAC5BO,IAAI,CAACC,GAAG,EAAER,OAAO,CAAC;EACpB,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isSharedValue","ReanimatedRecorder","constructor","Skia","_defineProperty","Set","recorder","Recorder","reset","values","clear","processAnimationValues","props","Object","forEach","value","has","name","size","add","getRecorder","getSharedValues","Array","from","saveGroup","restoreGroup","savePaint","standalone","restorePaint","restorePaintDeclaration","materializePaint","pushPathEffect","pathEffectType","pushImageFilter","imageFilterType","pushColorFilter","colorFilterType","pushShader","shaderType","children","pushBlurMaskFilter","composePathEffect","composeColorFilter","composeImageFilter","saveCTM","restoreCTM","drawPaint","saveLayer","saveBackdropFilter","drawBox","boxProps","shadows","shadow","map","s","drawImage","drawCircle","drawPoints","drawPath","drawRect","drawRRect","drawOval","drawLine","drawPatch","drawVertices","drawDiffRect","drawText","drawTextPath","drawTextBlob","drawGlyphs","drawPicture","drawImageSVG","drawParagraph","drawAtlas","drawSkottie"],"sources":["ReanimatedRecorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type { BaseRecorder, JsiRecorder, Skia } from \"../../skia/types\";\nimport type {\n PaintProps,\n NodeType,\n BlurMaskFilterProps,\n CTMProps,\n BoxProps,\n BoxShadowProps,\n ImageProps,\n CircleProps,\n PointsProps,\n PathProps,\n RectProps,\n RoundedRectProps,\n OvalProps,\n LineProps,\n PatchProps,\n VerticesProps,\n DiffRectProps,\n TextProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n ParagraphProps,\n AtlasProps,\n SkottieProps,\n DrawingNodeProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer\";\nimport { isSharedValue } from \"../utils\";\n\n/**\n * Currently the recorder only work if the GPU resources (e.g Images) are owned by the main thread.\n * It will crash otherwise on Ganesh (iOS/Android).\n */\nexport class ReanimatedRecorder implements BaseRecorder {\n private values = new Set<SharedValue<unknown>>();\n private recorder: JsiRecorder;\n\n constructor(Skia: Skia) {\n this.recorder = Skia.Recorder();\n }\n\n reset() {\n this.values.clear();\n this.recorder.reset();\n }\n\n private processAnimationValues(props?: Record<string, unknown>) {\n if (!props) {\n return;\n }\n Object.values(props).forEach((value) => {\n if (isSharedValue(value) && !this.values.has(value)) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n value.name = `variable${this.values.size}`;\n this.values.add(value as SharedValue<unknown>);\n }\n });\n }\n\n getRecorder() {\n return this.recorder;\n }\n\n getSharedValues() {\n return Array.from(this.values);\n }\n\n saveGroup(\n props?: AnimatedProps<Pick<DrawingNodeProps, \"zIndex\">>\n ): void {\n if (props) {\n this.processAnimationValues(props);\n this.recorder.saveGroup(props);\n } else {\n this.recorder.saveGroup();\n }\n }\n\n restoreGroup(): void {\n this.recorder.restoreGroup();\n }\n\n savePaint(props: AnimatedProps<PaintProps>, standalone: boolean): void {\n this.processAnimationValues(props);\n this.recorder.savePaint(props, standalone);\n }\n\n restorePaint(): void {\n this.recorder.restorePaint();\n }\n\n restorePaintDeclaration(): void {\n this.recorder.restorePaintDeclaration();\n }\n\n materializePaint(): void {\n this.recorder.materializePaint();\n }\n\n pushPathEffect(\n pathEffectType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushPathEffect(pathEffectType, props);\n }\n\n pushImageFilter(\n imageFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushImageFilter(imageFilterType, props);\n }\n\n pushColorFilter(\n colorFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushColorFilter(colorFilterType, props);\n }\n\n pushShader(\n shaderType: NodeType,\n props: AnimatedProps<unknown>,\n children: number\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushShader(shaderType, props, children);\n }\n\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void {\n this.processAnimationValues(props);\n this.recorder.pushBlurMaskFilter(props);\n }\n\n composePathEffect(): void {\n this.recorder.composePathEffect();\n }\n\n composeColorFilter(): void {\n this.recorder.composeColorFilter();\n }\n\n composeImageFilter(): void {\n this.recorder.composeImageFilter();\n }\n\n saveCTM(props: AnimatedProps<CTMProps>): void {\n this.processAnimationValues(props);\n this.recorder.saveCTM(props);\n }\n\n restoreCTM(): void {\n this.recorder.restoreCTM();\n }\n\n drawPaint(): void {\n this.recorder.drawPaint();\n }\n\n saveLayer(): void {\n this.recorder.saveLayer();\n }\n\n saveBackdropFilter(): void {\n this.recorder.saveBackdropFilter();\n }\n\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n }[]\n ): void {\n this.processAnimationValues(boxProps);\n shadows.forEach((shadow) => {\n this.processAnimationValues(\n shadow.props as AnimatedProps<BoxShadowProps>\n );\n });\n this.recorder.drawBox(\n boxProps,\n // TODO: Fix this type BaseRecorder.drawBox()\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n shadows.map((s) => s.props)\n );\n }\n\n drawImage(props: AnimatedProps<ImageProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawImage(props);\n }\n\n drawCircle(props: AnimatedProps<CircleProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawCircle(props);\n }\n\n drawPoints(props: AnimatedProps<PointsProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPoints(props);\n }\n\n drawPath(props: AnimatedProps<PathProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPath(props);\n }\n\n drawRect(props: AnimatedProps<RectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawRect(props);\n }\n\n drawRRect(props: AnimatedProps<RoundedRectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawRRect(props);\n }\n\n drawOval(props: AnimatedProps<OvalProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawOval(props);\n }\n\n drawLine(props: AnimatedProps<LineProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawLine(props);\n }\n\n drawPatch(props: AnimatedProps<PatchProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPatch(props);\n }\n\n drawVertices(props: AnimatedProps<VerticesProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawVertices(props);\n }\n\n drawDiffRect(props: AnimatedProps<DiffRectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawDiffRect(props);\n }\n\n drawText(props: AnimatedProps<TextProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawText(props);\n }\n\n drawTextPath(props: AnimatedProps<TextPathProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawTextPath(props);\n }\n\n drawTextBlob(props: AnimatedProps<TextBlobProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawTextBlob(props);\n }\n\n drawGlyphs(props: AnimatedProps<GlyphsProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawGlyphs(props);\n }\n\n drawPicture(props: AnimatedProps<PictureProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPicture(props);\n }\n\n drawImageSVG(props: AnimatedProps<ImageSVGProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawImageSVG(props);\n }\n\n drawParagraph(props: AnimatedProps<ParagraphProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawParagraph(props);\n }\n\n drawAtlas(props: AnimatedProps<AtlasProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawAtlas(props);\n }\n\n drawSkottie(props: AnimatedProps<SkottieProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawSkottie(props);\n }\n}\n"],"mappings":";;;AAiCA,SAASA,aAAa,QAAQ,UAAU;;AAExC;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,CAAyB;EAItDC,WAAWA,CAACC,IAAU,EAAE;IAAAC,eAAA,iBAHP,IAAIC,GAAG,CAAuB,CAAC;IAAAD,eAAA;IAI9C,IAAI,CAACE,QAAQ,GAAGH,IAAI,CAACI,QAAQ,CAAC,CAAC;EACjC;EAEAC,KAAKA,CAAA,EAAG;IACN,IAAI,CAACC,MAAM,CAACC,KAAK,CAAC,CAAC;IACnB,IAAI,CAACJ,QAAQ,CAACE,KAAK,CAAC,CAAC;EACvB;EAEQG,sBAAsBA,CAACC,KAA+B,EAAE;IAC9D,IAAI,CAACA,KAAK,EAAE;MACV;IACF;IACAC,MAAM,CAACJ,MAAM,CAACG,KAAK,CAAC,CAACE,OAAO,CAAEC,KAAK,IAAK;MACtC,IAAIf,aAAa,CAACe,KAAK,CAAC,IAAI,CAAC,IAAI,CAACN,MAAM,CAACO,GAAG,CAACD,KAAK,CAAC,EAAE;QACnD;QACA;QACAA,KAAK,CAACE,IAAI,GAAG,WAAW,IAAI,CAACR,MAAM,CAACS,IAAI,EAAE;QAC1C,IAAI,CAACT,MAAM,CAACU,GAAG,CAACJ,KAA6B,CAAC;MAChD;IACF,CAAC,CAAC;EACJ;EAEAK,WAAWA,CAAA,EAAG;IACZ,OAAO,IAAI,CAACd,QAAQ;EACtB;EAEAe,eAAeA,CAAA,EAAG;IAChB,OAAOC,KAAK,CAACC,IAAI,CAAC,IAAI,CAACd,MAAM,CAAC;EAChC;EAEAe,SAASA,CACPZ,KAAuD,EACjD;IACN,IAAIA,KAAK,EAAE;MACT,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;MAClC,IAAI,CAACN,QAAQ,CAACkB,SAAS,CAACZ,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,QAAQ,CAACgE,WAAW,CAAC1D,KAAK,CAAC;EAClC;EAEA2D,YAAYA,CAAC3D,KAAmC,EAAQ;IACtD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAACiE,YAAY,CAAC3D,KAAK,CAAC;EACnC;EAEA4D,aAAaA,CAAC5D,KAAoC,EAAQ;IACxD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAACkE,aAAa,CAAC5D,KAAK,CAAC;EACpC;EAEA6D,SAASA,CAAC7D,KAAgC,EAAQ;IAChD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAACmE,SAAS,CAAC7D,KAAK,CAAC;EAChC;EAEA8D,WAAWA,CAAC9D,KAAkC,EAAQ;IACpD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAACoE,WAAW,CAAC9D,KAAK,CAAC;EAClC;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["isSharedValue","ReanimatedRecorder","constructor","Skia","_defineProperty","Set","recorder","Recorder","reset","values","clear","processAnimationValues","props","Object","forEach","value","has","name","size","add","getRecorder","getSharedValues","Array","from","saveGroup","restoreGroup","savePaint","standalone","restorePaint","restorePaintDeclaration","materializePaint","pushPathEffect","pathEffectType","pushImageFilter","imageFilterType","pushColorFilter","colorFilterType","pushShader","shaderType","children","pushBlurMaskFilter","composePathEffect","composeColorFilter","composeImageFilter","saveCTM","restoreCTM","drawPaint","saveLayer","saveBackdropFilter","drawBox","boxProps","shadows","shadow","map","s","drawImage","drawCircle","drawPoints","drawPath","drawRect","drawRRect","drawOval","drawLine","drawPatch","drawVertices","drawDiffRect","drawText","drawTextPath","drawTextBlob","drawGlyphs","drawPicture","drawImageSVG","drawParagraph","drawAtlas","drawSkottie"],"sources":["ReanimatedRecorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type { BaseRecorder, JsiRecorder, Skia } from \"../../skia/types\";\nimport type {\n PaintProps,\n NodeType,\n BlurMaskFilterProps,\n CTMProps,\n BoxProps,\n BoxShadowProps,\n ImageProps,\n CircleProps,\n PointsProps,\n PathProps,\n RectProps,\n RoundedRectProps,\n OvalProps,\n LineProps,\n PatchProps,\n VerticesProps,\n DiffRectProps,\n TextProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n ParagraphProps,\n AtlasProps,\n SkottieProps,\n DrawingNodeProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer\";\nimport { isSharedValue } from \"../utils\";\n\n/**\n * Currently the recorder only work if the GPU resources (e.g Images) are owned by the main thread.\n * It will crash otherwise on Ganesh (iOS/Android).\n */\nexport class ReanimatedRecorder implements BaseRecorder {\n private values = new Set<SharedValue<unknown>>();\n private recorder: JsiRecorder;\n\n constructor(Skia: Skia) {\n this.recorder = Skia.Recorder();\n }\n\n reset() {\n this.values.clear();\n this.recorder.reset();\n }\n\n private processAnimationValues(props?: Record<string, unknown>) {\n if (!props) {\n return;\n }\n Object.values(props).forEach((value) => {\n if (isSharedValue(value) && !this.values.has(value)) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n value.name = `variable${this.values.size}`;\n this.values.add(value as SharedValue<unknown>);\n }\n });\n }\n\n getRecorder() {\n return this.recorder;\n }\n\n getSharedValues() {\n return Array.from(this.values);\n }\n\n saveGroup(props?: AnimatedProps<Pick<DrawingNodeProps, \"zIndex\">>): void {\n if (props) {\n this.processAnimationValues(props);\n this.recorder.saveGroup(props);\n } else {\n this.recorder.saveGroup();\n }\n }\n\n restoreGroup(): void {\n this.recorder.restoreGroup();\n }\n\n savePaint(props: AnimatedProps<PaintProps>, standalone: boolean): void {\n this.processAnimationValues(props);\n this.recorder.savePaint(props, standalone);\n }\n\n restorePaint(): void {\n this.recorder.restorePaint();\n }\n\n restorePaintDeclaration(): void {\n this.recorder.restorePaintDeclaration();\n }\n\n materializePaint(): void {\n this.recorder.materializePaint();\n }\n\n pushPathEffect(\n pathEffectType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushPathEffect(pathEffectType, props);\n }\n\n pushImageFilter(\n imageFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushImageFilter(imageFilterType, props);\n }\n\n pushColorFilter(\n colorFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushColorFilter(colorFilterType, props);\n }\n\n pushShader(\n shaderType: NodeType,\n props: AnimatedProps<unknown>,\n children: number\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushShader(shaderType, props, children);\n }\n\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void {\n this.processAnimationValues(props);\n this.recorder.pushBlurMaskFilter(props);\n }\n\n composePathEffect(): void {\n this.recorder.composePathEffect();\n }\n\n composeColorFilter(): void {\n this.recorder.composeColorFilter();\n }\n\n composeImageFilter(): void {\n this.recorder.composeImageFilter();\n }\n\n saveCTM(props: AnimatedProps<CTMProps>): void {\n this.processAnimationValues(props);\n this.recorder.saveCTM(props);\n }\n\n restoreCTM(): void {\n this.recorder.restoreCTM();\n }\n\n drawPaint(): void {\n this.recorder.drawPaint();\n }\n\n saveLayer(): void {\n this.recorder.saveLayer();\n }\n\n saveBackdropFilter(): void {\n this.recorder.saveBackdropFilter();\n }\n\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n }[]\n ): void {\n this.processAnimationValues(boxProps);\n shadows.forEach((shadow) => {\n this.processAnimationValues(\n shadow.props as AnimatedProps<BoxShadowProps>\n );\n });\n this.recorder.drawBox(\n boxProps,\n // TODO: Fix this type BaseRecorder.drawBox()\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n shadows.map((s) => s.props)\n );\n }\n\n drawImage(props: AnimatedProps<ImageProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawImage(props);\n }\n\n drawCircle(props: AnimatedProps<CircleProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawCircle(props);\n }\n\n drawPoints(props: AnimatedProps<PointsProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPoints(props);\n }\n\n drawPath(props: AnimatedProps<PathProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPath(props);\n }\n\n drawRect(props: AnimatedProps<RectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawRect(props);\n }\n\n drawRRect(props: AnimatedProps<RoundedRectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawRRect(props);\n }\n\n drawOval(props: AnimatedProps<OvalProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawOval(props);\n }\n\n drawLine(props: AnimatedProps<LineProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawLine(props);\n }\n\n drawPatch(props: AnimatedProps<PatchProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPatch(props);\n }\n\n drawVertices(props: AnimatedProps<VerticesProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawVertices(props);\n }\n\n drawDiffRect(props: AnimatedProps<DiffRectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawDiffRect(props);\n }\n\n drawText(props: AnimatedProps<TextProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawText(props);\n }\n\n drawTextPath(props: AnimatedProps<TextPathProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawTextPath(props);\n }\n\n drawTextBlob(props: AnimatedProps<TextBlobProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawTextBlob(props);\n }\n\n drawGlyphs(props: AnimatedProps<GlyphsProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawGlyphs(props);\n }\n\n drawPicture(props: AnimatedProps<PictureProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPicture(props);\n }\n\n drawImageSVG(props: AnimatedProps<ImageSVGProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawImageSVG(props);\n }\n\n drawParagraph(props: AnimatedProps<ParagraphProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawParagraph(props);\n }\n\n drawAtlas(props: AnimatedProps<AtlasProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawAtlas(props);\n }\n\n drawSkottie(props: AnimatedProps<SkottieProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawSkottie(props);\n }\n}\n"],"mappings":";;;AAiCA,SAASA,aAAa,QAAQ,UAAU;;AAExC;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,CAAyB;EAItDC,WAAWA,CAACC,IAAU,EAAE;IAAAC,eAAA,iBAHP,IAAIC,GAAG,CAAuB,CAAC;IAAAD,eAAA;IAI9C,IAAI,CAACE,QAAQ,GAAGH,IAAI,CAACI,QAAQ,CAAC,CAAC;EACjC;EAEAC,KAAKA,CAAA,EAAG;IACN,IAAI,CAACC,MAAM,CAACC,KAAK,CAAC,CAAC;IACnB,IAAI,CAACJ,QAAQ,CAACE,KAAK,CAAC,CAAC;EACvB;EAEQG,sBAAsBA,CAACC,KAA+B,EAAE;IAC9D,IAAI,CAACA,KAAK,EAAE;MACV;IACF;IACAC,MAAM,CAACJ,MAAM,CAACG,KAAK,CAAC,CAACE,OAAO,CAAEC,KAAK,IAAK;MACtC,IAAIf,aAAa,CAACe,KAAK,CAAC,IAAI,CAAC,IAAI,CAACN,MAAM,CAACO,GAAG,CAACD,KAAK,CAAC,EAAE;QACnD;QACA;QACAA,KAAK,CAACE,IAAI,GAAG,WAAW,IAAI,CAACR,MAAM,CAACS,IAAI,EAAE;QAC1C,IAAI,CAACT,MAAM,CAACU,GAAG,CAACJ,KAA6B,CAAC;MAChD;IACF,CAAC,CAAC;EACJ;EAEAK,WAAWA,CAAA,EAAG;IACZ,OAAO,IAAI,CAACd,QAAQ;EACtB;EAEAe,eAAeA,CAAA,EAAG;IAChB,OAA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ClD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAAC+D,UAAU,CAACzD,KAAK,CAAC;EACjC;EAEA0D,WAAWA,CAAC1D,KAAkC,EAAQ;IACpD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAACgE,WAAW,CAAC1D,KAAK,CAAC;EAClC;EAEA2D,YAAYA,CAAC3D,KAAmC,EAAQ;IACtD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAACiE,YAAY,CAAC3D,KAAK,CAAC;EACnC;EAEA4D,aAAaA,CAAC5D,KAAoC,EAAQ;IACxD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAACkE,aAAa,CAAC5D,KAAK,CAAC;EACpC;EAEA6D,SAASA,CAAC7D,KAAgC,EAAQ;IAChD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAACmE,SAAS,CAAC7D,KAAK,CAAC;EAChC;EAEA8D,WAAWA,CAAC9D,KAAkC,EAAQ;IACpD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACN,QAAQ,CAACoE,WAAW,CAAC9D,KAAK,CAAC;EAClC;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","SkiaPictureViewNativeComponent","SkiaViewApi","SkiaViewNativeId","NativeSkiaPictureView","SkiaPictureView","Component","constructor","props","_defineProperty","_nativeId","current","picture","onSize","assertSkiaViewApi","setJsiProperty","tick","nativeId","componentDidUpdate","prevProps","componentWillUnmount","requestId","cancelAnimationFrame","redraw","mode","requestAnimationFrame","bind","makeImageSnapshot","rect","requestRedraw","render","debug","opaque","coldStart","viewProps","createElement","_extends","collapsable","nativeID","Error"],"sources":["SkiaPictureView.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { SkRect } from \"../skia/types\";\nimport SkiaPictureViewNativeComponent from \"../specs/SkiaPictureViewNativeComponent\";\n\nimport { SkiaViewApi } from \"./api\";\nimport type { SkiaPictureViewNativeProps } from \"./types\";\nimport { SkiaViewNativeId } from \"./SkiaViewNativeId\";\n\nconst NativeSkiaPictureView = SkiaPictureViewNativeComponent;\n\ninterface SkiaPictureViewProps extends SkiaPictureViewNativeProps {\n mode?: \"default\" | \"continuous\";\n coldStart?: boolean;\n}\n\nexport class SkiaPictureView extends React.Component<SkiaPictureViewProps> {\n private requestId = 0;\n\n constructor(props: SkiaPictureViewProps) {\n super(props);\n this._nativeId = SkiaViewNativeId.current++;\n const { picture, onSize } = props;\n if (picture) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", picture);\n }\n if (onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n this.tick();\n }\n\n private _nativeId: number;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaPictureViewProps) {\n const { picture, onSize } = this.props;\n if (picture !== prevProps.picture) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", picture);\n }\n if (onSize !== prevProps.onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n this.tick();\n }\n\n componentWillUnmount() {\n if (this.requestId) {\n cancelAnimationFrame(this.requestId);\n }\n }\n\n private tick() {\n this.redraw();\n if (this.props.mode === \"continuous\") {\n this.requestId = requestAnimationFrame(this.tick.bind(this));\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertSkiaViewApi();\n SkiaViewApi.requestRedraw(this._nativeId);\n }\n\n render() {\n const {
|
|
1
|
+
{"version":3,"names":["React","SkiaPictureViewNativeComponent","SkiaViewApi","SkiaViewNativeId","NativeSkiaPictureView","SkiaPictureView","Component","constructor","props","_defineProperty","_nativeId","current","picture","onSize","assertSkiaViewApi","setJsiProperty","tick","nativeId","componentDidUpdate","prevProps","componentWillUnmount","requestId","cancelAnimationFrame","redraw","mode","requestAnimationFrame","bind","makeImageSnapshot","rect","requestRedraw","render","debug","opaque","coldStart","viewProps","createElement","_extends","collapsable","nativeID","Error"],"sources":["SkiaPictureView.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { SkRect } from \"../skia/types\";\nimport SkiaPictureViewNativeComponent from \"../specs/SkiaPictureViewNativeComponent\";\n\nimport { SkiaViewApi } from \"./api\";\nimport type { SkiaPictureViewNativeProps } from \"./types\";\nimport { SkiaViewNativeId } from \"./SkiaViewNativeId\";\n\nconst NativeSkiaPictureView = SkiaPictureViewNativeComponent;\n\ninterface SkiaPictureViewProps extends SkiaPictureViewNativeProps {\n mode?: \"default\" | \"continuous\";\n coldStart?: boolean;\n}\n\nexport class SkiaPictureView extends React.Component<SkiaPictureViewProps> {\n private requestId = 0;\n\n constructor(props: SkiaPictureViewProps) {\n super(props);\n this._nativeId = SkiaViewNativeId.current++;\n const { picture, onSize } = props;\n if (picture) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", picture);\n }\n if (onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n this.tick();\n }\n\n private _nativeId: number;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaPictureViewProps) {\n const { picture, onSize } = this.props;\n if (picture !== prevProps.picture) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", picture);\n }\n if (onSize !== prevProps.onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n this.tick();\n }\n\n componentWillUnmount() {\n if (this.requestId) {\n cancelAnimationFrame(this.requestId);\n }\n }\n\n private tick() {\n this.redraw();\n if (this.props.mode === \"continuous\") {\n this.requestId = requestAnimationFrame(this.tick.bind(this));\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertSkiaViewApi();\n SkiaViewApi.requestRedraw(this._nativeId);\n }\n\n render() {\n const {\n mode,\n debug = false,\n opaque = false,\n coldStart = false,\n ...viewProps\n } = this.props;\n return (\n <NativeSkiaPictureView\n collapsable={false}\n nativeID={`${this._nativeId}`}\n debug={debug}\n opaque={opaque}\n coldStart={coldStart}\n {...viewProps}\n />\n );\n }\n}\n\nconst assertSkiaViewApi = () => {\n if (\n SkiaViewApi === null ||\n SkiaViewApi.setJsiProperty === null ||\n SkiaViewApi.requestRedraw === null ||\n SkiaViewApi.makeImageSnapshot === null\n ) {\n throw Error(\"Skia View Api was not found.\");\n }\n};\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAGzB,OAAOC,8BAA8B,MAAM,yCAAyC;AAEpF,SAASC,WAAW,QAAQ,OAAO;AAEnC,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,MAAMC,qBAAqB,GAAGH,8BAA8B;AAO5D,OAAO,MAAMI,eAAe,SAASL,KAAK,CAACM,SAAS,CAAuB;EAGzEC,WAAWA,CAACC,KAA2B,EAAE;IACvC,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA,oBAHK,CAAC;IAAAA,eAAA;IAInB,IAAI,CAACC,SAAS,GAAGP,gBAAgB,CAACQ,OAAO,EAAE;IAC3C,MAAM;MAAEC,O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I,CAAC,CAAC;IAC9D;EACF;;EAEA;AACF;AACA;AACA;AACA;EACSC,iBAAiBA,CAACC,IAAa,EAAE;IACtCd,iBAAiB,CAAC,CAAC;IACnB,OAAOZ,WAAW,CAACyB,iBAAiB,CAAC,IAAI,CAACjB,SAAS,EAAEkB,IAAI,CAAC;EAC5D;;EAEA;AACF;AACA;EACSL,MAAMA,CAAA,EAAG;IACdT,iBAAiB,CAAC,CAAC;IACnBZ,WAAW,CAAC2B,aAAa,CAAC,IAAI,CAACnB,SAAS,CAAC;EAC3C;EAEAoB,MAAMA,CAAA,EAAG;IACP,MAAM;MACJN,IAAI;MACJO,KAAK,GAAG,KAAK;MACbC,MAAM,GAAG,KAAK;MACdC,SAAS,GAAG,KAAK;MACjB,GAAGC;IACL,CAAC,GAAG,IAAI,CAAC1B,KAAK;IACd,oBACER,KAAA,CAAAmC,aAAA,CAAC/B,qBAAqB,EAAAgC,QAAA;MACpBC,WAAW,EAAE,KAAM;MACnBC,QAAQ,EAAE,GAAG,IAAI,CAAC5B,SAAS,EAAG;MAC9BqB,KAAK,EAAEA,KAAM;MACbC,MAAM,EAAEA,MAAO;MACfC,SAAS,EAAEA;IAAU,GACjBC,SAAS,CACd,CAAC;EAEN;AACF;AAEA,MAAMpB,iBAAiB,GAAGA,CAAA,KAAM;EAC9B,IACEZ,WAAW,KAAK,IAAI,IACpBA,WAAW,CAACa,cAAc,KAAK,IAAI,IACnCb,WAAW,CAAC2B,aAAa,KAAK,IAAI,IAClC3B,WAAW,CAACyB,iBAAiB,KAAK,IAAI,EACtC;IACA,MAAMY,KAAK,CAAC,8BAA8B,CAAC;EAC7C;AACF,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -34,9 +34,7 @@ import type { AnimatedProps } from "../../renderer/processors/Animations/Animati
|
|
|
34
34
|
import type { SkPicture } from "./Picture";
|
|
35
35
|
|
|
36
36
|
export interface BaseRecorder {
|
|
37
|
-
saveGroup(
|
|
38
|
-
props?: AnimatedProps<Pick<DrawingNodeProps, "zIndex">>
|
|
39
|
-
): void;
|
|
37
|
+
saveGroup(props?: AnimatedProps<Pick<DrawingNodeProps, "zIndex">>): void;
|
|
40
38
|
restoreGroup(): void;
|
|
41
39
|
savePaint(props: AnimatedProps<PaintProps>, standalone: boolean): void;
|
|
42
40
|
restorePaint(): void;
|
|
@@ -1,90 +1,87 @@
|
|
|
1
|
-
|
|
2
|
-
import { CommandType } from "./Core";
|
|
1
|
+
import { CommandType, isGroup } from "./Core";
|
|
3
2
|
import type { Command } from "./Core";
|
|
4
3
|
|
|
5
4
|
const CommandTypeNames: Record<CommandType, string> = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
5
|
+
[CommandType.Group]: "Group",
|
|
6
|
+
[CommandType.SavePaint]: "SavePaint",
|
|
7
|
+
[CommandType.RestorePaint]: "RestorePaint",
|
|
8
|
+
[CommandType.SaveCTM]: "SaveCTM",
|
|
9
|
+
[CommandType.RestoreCTM]: "RestoreCTM",
|
|
10
|
+
[CommandType.PushColorFilter]: "PushColorFilter",
|
|
11
|
+
[CommandType.PushBlurMaskFilter]: "PushBlurMaskFilter",
|
|
12
|
+
[CommandType.PushImageFilter]: "PushImageFilter",
|
|
13
|
+
[CommandType.PushPathEffect]: "PushPathEffect",
|
|
14
|
+
[CommandType.PushShader]: "PushShader",
|
|
15
|
+
[CommandType.ComposeColorFilter]: "ComposeColorFilter",
|
|
16
|
+
[CommandType.ComposeImageFilter]: "ComposeImageFilter",
|
|
17
|
+
[CommandType.ComposePathEffect]: "ComposePathEffect",
|
|
18
|
+
[CommandType.MaterializePaint]: "MaterializePaint",
|
|
19
|
+
[CommandType.SaveBackdropFilter]: "SaveBackdropFilter",
|
|
20
|
+
[CommandType.SaveLayer]: "SaveLayer",
|
|
21
|
+
[CommandType.RestorePaintDeclaration]: "RestorePaintDeclaration",
|
|
22
|
+
[CommandType.DrawBox]: "DrawBox",
|
|
23
|
+
[CommandType.DrawImage]: "DrawImage",
|
|
24
|
+
[CommandType.DrawCircle]: "DrawCircle",
|
|
25
|
+
[CommandType.DrawPaint]: "DrawPaint",
|
|
26
|
+
[CommandType.DrawPoints]: "DrawPoints",
|
|
27
|
+
[CommandType.DrawPath]: "DrawPath",
|
|
28
|
+
[CommandType.DrawRect]: "DrawRect",
|
|
29
|
+
[CommandType.DrawRRect]: "DrawRRect",
|
|
30
|
+
[CommandType.DrawOval]: "DrawOval",
|
|
31
|
+
[CommandType.DrawLine]: "DrawLine",
|
|
32
|
+
[CommandType.DrawPatch]: "DrawPatch",
|
|
33
|
+
[CommandType.DrawVertices]: "DrawVertices",
|
|
34
|
+
[CommandType.DrawDiffRect]: "DrawDiffRect",
|
|
35
|
+
[CommandType.DrawText]: "DrawText",
|
|
36
|
+
[CommandType.DrawTextPath]: "DrawTextPath",
|
|
37
|
+
[CommandType.DrawTextBlob]: "DrawTextBlob",
|
|
38
|
+
[CommandType.DrawGlyphs]: "DrawGlyphs",
|
|
39
|
+
[CommandType.DrawPicture]: "DrawPicture",
|
|
40
|
+
[CommandType.DrawImageSVG]: "DrawImageSVG",
|
|
41
|
+
[CommandType.DrawParagraph]: "DrawParagraph",
|
|
42
|
+
[CommandType.DrawAtlas]: "DrawAtlas",
|
|
43
|
+
[CommandType.DrawSkottie]: "DrawSkottie",
|
|
45
44
|
};
|
|
46
45
|
|
|
47
|
-
import { isGroup } from "./Core";
|
|
48
|
-
|
|
49
46
|
const serializeProps = (props: unknown): string => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
47
|
+
try {
|
|
48
|
+
return JSON.stringify(props, (key, value) => {
|
|
49
|
+
if (key === "children") {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
if (typeof value === "bigint") {
|
|
53
|
+
return value.toString();
|
|
54
|
+
}
|
|
55
|
+
return value;
|
|
56
|
+
});
|
|
57
|
+
} catch (e) {
|
|
58
|
+
return `"Error serializing props: ${e}"`;
|
|
59
|
+
}
|
|
63
60
|
};
|
|
64
61
|
|
|
65
62
|
export const debugTree = (commands: Command[], indent = 0): string => {
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
let result = "[\n";
|
|
64
|
+
const prefix = " ".repeat(indent + 2);
|
|
68
65
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
commands.forEach((cmd, index) => {
|
|
67
|
+
const type = CommandTypeNames[cmd.type] || "Unknown";
|
|
68
|
+
result += `${prefix}{ "type": "${type}"`;
|
|
72
69
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
if ("props" in cmd) {
|
|
71
|
+
result += `, "props": ${serializeProps(cmd.props)}`;
|
|
72
|
+
}
|
|
76
73
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
if (isGroup(cmd)) {
|
|
75
|
+
result += `, "children": ${debugTree(cmd.children, indent + 2)}`;
|
|
76
|
+
}
|
|
80
77
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
78
|
+
result += " }";
|
|
79
|
+
if (index < commands.length - 1) {
|
|
80
|
+
result += ",";
|
|
81
|
+
}
|
|
82
|
+
result += "\n";
|
|
83
|
+
});
|
|
87
84
|
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
result += " ".repeat(indent) + "]";
|
|
86
|
+
return result;
|
|
90
87
|
};
|
|
@@ -68,44 +68,45 @@ const getZIndex = (command: GroupCommand) => {
|
|
|
68
68
|
return zIndex;
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
pendingGroups
|
|
80
|
-
.sort((a, b) =>
|
|
81
|
-
a.zIndex === b.zIndex ? a.order - b.order : a.zIndex - b.zIndex
|
|
82
|
-
)
|
|
83
|
-
.forEach(({ command }) => {
|
|
84
|
-
play(ctx, command);
|
|
85
|
-
});
|
|
86
|
-
pendingGroups.length = 0;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const playGroup = (ctx: DrawingContext, group: GroupCommand) => {
|
|
90
|
-
"worklet";
|
|
91
|
-
const pending: PendingGroup[] = [];
|
|
92
|
-
group.children.forEach((child) => {
|
|
93
|
-
if (isGroup(child)) {
|
|
94
|
-
pending.push({
|
|
95
|
-
command: child,
|
|
96
|
-
zIndex: getZIndex(child),
|
|
97
|
-
order: pending.length,
|
|
98
|
-
});
|
|
71
|
+
const play = (ctx: DrawingContext, _command: Command) => {
|
|
72
|
+
const flushPendingGroups = (
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
74
|
+
ctx: DrawingContext,
|
|
75
|
+
pendingGroups: PendingGroup[]
|
|
76
|
+
) => {
|
|
77
|
+
"worklet";
|
|
78
|
+
if (pendingGroups.length === 0) {
|
|
99
79
|
return;
|
|
100
80
|
}
|
|
81
|
+
pendingGroups
|
|
82
|
+
.sort((a, b) =>
|
|
83
|
+
a.zIndex === b.zIndex ? a.order - b.order : a.zIndex - b.zIndex
|
|
84
|
+
)
|
|
85
|
+
.forEach(({ command }) => {
|
|
86
|
+
play(ctx, command);
|
|
87
|
+
});
|
|
88
|
+
pendingGroups.length = 0;
|
|
89
|
+
};
|
|
90
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
91
|
+
const playGroup = (ctx: DrawingContext, group: GroupCommand) => {
|
|
92
|
+
"worklet";
|
|
93
|
+
const pending: PendingGroup[] = [];
|
|
94
|
+
group.children.forEach((child) => {
|
|
95
|
+
if (isGroup(child)) {
|
|
96
|
+
pending.push({
|
|
97
|
+
command: child,
|
|
98
|
+
zIndex: getZIndex(child),
|
|
99
|
+
order: pending.length,
|
|
100
|
+
});
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
flushPendingGroups(ctx, pending);
|
|
104
|
+
play(ctx, child);
|
|
105
|
+
});
|
|
101
106
|
flushPendingGroups(ctx, pending);
|
|
102
|
-
|
|
103
|
-
});
|
|
104
|
-
flushPendingGroups(ctx, pending);
|
|
105
|
-
};
|
|
107
|
+
};
|
|
106
108
|
|
|
107
|
-
|
|
108
|
-
"worklet";
|
|
109
|
+
("worklet");
|
|
109
110
|
if (isGroup(_command)) {
|
|
110
111
|
playGroup(ctx, _command);
|
|
111
112
|
return;
|
|
@@ -220,12 +221,11 @@ function play(ctx: DrawingContext, _command: Command) {
|
|
|
220
221
|
ctx.paints.pop();
|
|
221
222
|
});
|
|
222
223
|
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
export const replay = (ctx: DrawingContext, commands: Command[]) => {
|
|
224
|
+
};
|
|
225
|
+
export function replay(ctx: DrawingContext, commands: Command[]) {
|
|
226
226
|
"worklet";
|
|
227
227
|
//console.log(debugTree(commands));
|
|
228
228
|
commands.forEach((command) => {
|
|
229
229
|
play(ctx, command);
|
|
230
230
|
});
|
|
231
|
-
}
|
|
231
|
+
}
|
|
@@ -72,9 +72,7 @@ export class ReanimatedRecorder implements BaseRecorder {
|
|
|
72
72
|
return Array.from(this.values);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
saveGroup(
|
|
76
|
-
props?: AnimatedProps<Pick<DrawingNodeProps, "zIndex">>
|
|
77
|
-
): void {
|
|
75
|
+
saveGroup(props?: AnimatedProps<Pick<DrawingNodeProps, "zIndex">>): void {
|
|
78
76
|
if (props) {
|
|
79
77
|
this.processAnimationValues(props);
|
|
80
78
|
this.recorder.saveGroup(props);
|
|
@@ -83,7 +83,13 @@ export class SkiaPictureView extends React.Component<SkiaPictureViewProps> {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
render() {
|
|
86
|
-
const {
|
|
86
|
+
const {
|
|
87
|
+
mode,
|
|
88
|
+
debug = false,
|
|
89
|
+
opaque = false,
|
|
90
|
+
coldStart = false,
|
|
91
|
+
...viewProps
|
|
92
|
+
} = this.props;
|
|
87
93
|
return (
|
|
88
94
|
<NativeSkiaPictureView
|
|
89
95
|
collapsable={false}
|