@shopify/react-native-skia 2.3.13 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/android/cpp/jni/JniPlatformContext.cpp +3 -1
  2. package/cpp/api/JsiSkPictureFactory.h +24 -6
  3. package/cpp/api/recorder/Command.h +12 -0
  4. package/cpp/api/recorder/JsiRecorder.h +2 -1
  5. package/cpp/api/recorder/RNRecorder.h +434 -374
  6. package/lib/commonjs/dom/types/Common.d.ts +1 -0
  7. package/lib/commonjs/dom/types/Common.js.map +1 -1
  8. package/lib/commonjs/skia/types/Recorder.d.ts +2 -2
  9. package/lib/commonjs/skia/types/Recorder.js.map +1 -1
  10. package/lib/commonjs/sksg/Recorder/Core.d.ts +2 -1
  11. package/lib/commonjs/sksg/Recorder/Core.js +0 -42
  12. package/lib/commonjs/sksg/Recorder/Core.js.map +1 -1
  13. package/lib/commonjs/sksg/Recorder/Debug.d.ts +2 -0
  14. package/lib/commonjs/sksg/Recorder/Debug.js +86 -0
  15. package/lib/commonjs/sksg/Recorder/Debug.js.map +1 -0
  16. package/lib/commonjs/sksg/Recorder/Player.js +46 -1
  17. package/lib/commonjs/sksg/Recorder/Player.js.map +1 -1
  18. package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.d.ts +2 -2
  19. package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.js +7 -2
  20. package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.js.map +1 -1
  21. package/lib/commonjs/sksg/Recorder/Recorder.d.ts +2 -2
  22. package/lib/commonjs/sksg/Recorder/Recorder.js +7 -3
  23. package/lib/commonjs/sksg/Recorder/Recorder.js.map +1 -1
  24. package/lib/commonjs/sksg/Recorder/Visitor.js +14 -6
  25. package/lib/commonjs/sksg/Recorder/Visitor.js.map +1 -1
  26. package/lib/module/dom/types/Common.d.ts +1 -0
  27. package/lib/module/dom/types/Common.js.map +1 -1
  28. package/lib/module/skia/types/Recorder.d.ts +2 -2
  29. package/lib/module/skia/types/Recorder.js.map +1 -1
  30. package/lib/module/sksg/Recorder/Core.d.ts +2 -1
  31. package/lib/module/sksg/Recorder/Core.js +0 -42
  32. package/lib/module/sksg/Recorder/Core.js.map +1 -1
  33. package/lib/module/sksg/Recorder/Debug.d.ts +2 -0
  34. package/lib/module/sksg/Recorder/Debug.js +80 -0
  35. package/lib/module/sksg/Recorder/Debug.js.map +1 -0
  36. package/lib/module/sksg/Recorder/Player.js +46 -1
  37. package/lib/module/sksg/Recorder/Player.js.map +1 -1
  38. package/lib/module/sksg/Recorder/ReanimatedRecorder.d.ts +2 -2
  39. package/lib/module/sksg/Recorder/ReanimatedRecorder.js +7 -2
  40. package/lib/module/sksg/Recorder/ReanimatedRecorder.js.map +1 -1
  41. package/lib/module/sksg/Recorder/Recorder.d.ts +2 -2
  42. package/lib/module/sksg/Recorder/Recorder.js +7 -3
  43. package/lib/module/sksg/Recorder/Recorder.js.map +1 -1
  44. package/lib/module/sksg/Recorder/Visitor.js +14 -6
  45. package/lib/module/sksg/Recorder/Visitor.js.map +1 -1
  46. package/lib/typescript/lib/commonjs/sksg/Recorder/Debug.d.ts +2 -0
  47. package/lib/typescript/lib/commonjs/sksg/Recorder/ReanimatedRecorder.d.ts +1 -1
  48. package/lib/typescript/lib/commonjs/sksg/Recorder/Recorder.d.ts +1 -1
  49. package/lib/typescript/lib/module/sksg/Recorder/Debug.d.ts +1 -0
  50. package/lib/typescript/lib/module/sksg/Recorder/ReanimatedRecorder.d.ts +1 -1
  51. package/lib/typescript/lib/module/sksg/Recorder/Recorder.d.ts +1 -1
  52. package/lib/typescript/src/dom/types/Common.d.ts +1 -0
  53. package/lib/typescript/src/skia/types/Recorder.d.ts +2 -2
  54. package/lib/typescript/src/sksg/Recorder/Core.d.ts +2 -1
  55. package/lib/typescript/src/sksg/Recorder/Debug.d.ts +2 -0
  56. package/lib/typescript/src/sksg/Recorder/ReanimatedRecorder.d.ts +2 -2
  57. package/lib/typescript/src/sksg/Recorder/Recorder.d.ts +2 -2
  58. package/package.json +1 -1
  59. package/src/dom/types/Common.ts +3 -1
  60. package/src/skia/types/Recorder.ts +4 -1
  61. package/src/sksg/Recorder/Core.ts +2 -43
  62. package/src/sksg/Recorder/Debug.ts +90 -0
  63. package/src/sksg/Recorder/Player.ts +57 -2
  64. package/src/sksg/Recorder/ReanimatedRecorder.ts +10 -2
  65. package/src/sksg/Recorder/Recorder.ts +7 -2
  66. package/src/sksg/Recorder/Visitor.ts +18 -6
@@ -56,4 +56,5 @@ export interface PaintProps extends ChildrenProps {
56
56
  dither?: boolean;
57
57
  }
58
58
  export interface GroupProps extends PaintProps, CTMProps {
59
+ zIndex?: number;
59
60
  }
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["Common.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\n\nimport type {\n BlendMode,\n Color,\n InputMatrix,\n InputRRect,\n PaintStyle,\n SkPaint,\n SkPath,\n SkRect,\n SkRRect,\n StrokeCap,\n StrokeJoin,\n Transforms3d,\n Vector,\n} from \"../../skia/types\";\n\nexport type SkEnum<T> = Uncapitalize<keyof T extends string ? keyof T : never>;\n\nexport type PathDef = string | SkPath;\n\nexport type ClipDef = SkRRect | SkRect | PathDef;\n\nexport type Fit =\n | \"cover\"\n | \"contain\"\n | \"fill\"\n | \"fitHeight\"\n | \"fitWidth\"\n | \"none\"\n | \"scaleDown\";\n\nexport type Radius = number | Vector;\n\nexport interface ChildrenProps {\n children?: ReactNode | ReactNode[];\n}\n\nexport interface RectCtor {\n x?: number;\n y?: number;\n width: number;\n height: number;\n}\n\nexport interface RRectCtor extends RectCtor {\n r?: Radius;\n}\n\nexport type RectDef = RectCtor | { rect: SkRect };\nexport type RRectDef = RRectCtor | { rect: InputRRect };\n\nexport interface PointCircleDef {\n c?: Vector;\n r: number;\n}\n\nexport interface ScalarCircleDef {\n cx: number;\n cy: number;\n r: number;\n}\n\nexport type CircleDef = PointCircleDef | ScalarCircleDef;\n\nexport interface TransformProps {\n transform?: Transforms3d;\n origin?: Vector;\n matrix?: InputMatrix;\n}\n\nexport interface CTMProps extends TransformProps {\n clip?: ClipDef;\n invertClip?: boolean;\n layer?: SkPaint | boolean;\n}\n\nexport interface PaintProps extends ChildrenProps {\n color?: Color;\n strokeWidth?: number;\n blendMode?: SkEnum<typeof BlendMode>;\n style?: SkEnum<typeof PaintStyle>;\n strokeJoin?: SkEnum<typeof StrokeJoin>;\n strokeCap?: SkEnum<typeof StrokeCap>;\n strokeMiter?: number;\n opacity?: number;\n antiAlias?: boolean;\n dither?: boolean;\n}\n\nexport interface GroupProps extends PaintProps, CTMProps {}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["Common.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\n\nimport type {\n BlendMode,\n Color,\n InputMatrix,\n InputRRect,\n PaintStyle,\n SkPaint,\n SkPath,\n SkRect,\n SkRRect,\n StrokeCap,\n StrokeJoin,\n Transforms3d,\n Vector,\n} from \"../../skia/types\";\n\nexport type SkEnum<T> = Uncapitalize<keyof T extends string ? keyof T : never>;\n\nexport type PathDef = string | SkPath;\n\nexport type ClipDef = SkRRect | SkRect | PathDef;\n\nexport type Fit =\n | \"cover\"\n | \"contain\"\n | \"fill\"\n | \"fitHeight\"\n | \"fitWidth\"\n | \"none\"\n | \"scaleDown\";\n\nexport type Radius = number | Vector;\n\nexport interface ChildrenProps {\n children?: ReactNode | ReactNode[];\n}\n\nexport interface RectCtor {\n x?: number;\n y?: number;\n width: number;\n height: number;\n}\n\nexport interface RRectCtor extends RectCtor {\n r?: Radius;\n}\n\nexport type RectDef = RectCtor | { rect: SkRect };\nexport type RRectDef = RRectCtor | { rect: InputRRect };\n\nexport interface PointCircleDef {\n c?: Vector;\n r: number;\n}\n\nexport interface ScalarCircleDef {\n cx: number;\n cy: number;\n r: number;\n}\n\nexport type CircleDef = PointCircleDef | ScalarCircleDef;\n\nexport interface TransformProps {\n transform?: Transforms3d;\n origin?: Vector;\n matrix?: InputMatrix;\n}\n\nexport interface CTMProps extends TransformProps {\n clip?: ClipDef;\n invertClip?: boolean;\n layer?: SkPaint | boolean;\n}\n\nexport interface PaintProps extends ChildrenProps {\n color?: Color;\n strokeWidth?: number;\n blendMode?: SkEnum<typeof BlendMode>;\n style?: SkEnum<typeof PaintStyle>;\n strokeJoin?: SkEnum<typeof StrokeJoin>;\n strokeCap?: SkEnum<typeof StrokeCap>;\n strokeMiter?: number;\n opacity?: number;\n antiAlias?: boolean;\n dither?: boolean;\n}\n\nexport interface GroupProps extends PaintProps, CTMProps {\n zIndex?: number;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,9 +1,9 @@
1
1
  import type { SharedValue } from "react-native-reanimated";
2
- import type { TextProps, AtlasProps, BlurMaskFilterProps, BoxProps, BoxShadowProps, CircleProps, CTMProps, DiffRectProps, GlyphsProps, ImageProps, ImageSVGProps, LineProps, NodeType, OvalProps, PaintProps, ParagraphProps, PatchProps, PathProps, PictureProps, PointsProps, RectProps, RoundedRectProps, TextBlobProps, TextPathProps, VerticesProps, SkottieProps } from "../../dom/types";
2
+ import type { TextProps, AtlasProps, BlurMaskFilterProps, BoxProps, BoxShadowProps, CircleProps, CTMProps, DiffRectProps, GlyphsProps, ImageProps, ImageSVGProps, LineProps, NodeType, OvalProps, PaintProps, ParagraphProps, PatchProps, PathProps, PictureProps, PointsProps, RectProps, RoundedRectProps, TextBlobProps, TextPathProps, VerticesProps, SkottieProps, DrawingNodeProps } from "../../dom/types";
3
3
  import type { AnimatedProps } from "../../renderer/processors/Animations/Animations";
4
4
  import type { SkPicture } from "./Picture";
5
5
  export interface BaseRecorder {
6
- saveGroup(): void;
6
+ saveGroup(props?: AnimatedProps<Pick<DrawingNodeProps, "zIndex">>): void;
7
7
  restoreGroup(): void;
8
8
  savePaint(props: AnimatedProps<PaintProps>, standalone: boolean): void;
9
9
  restorePaint(): void;
@@ -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} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer/processors/Animations/Animations\";\n\nimport type { SkPicture } from \"./Picture\";\n\nexport interface BaseRecorder {\n saveGroup(): 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
+ {"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(\n props?: AnimatedProps<Pick<DrawingNodeProps, \"zIndex\">>\n ): 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":[]}
@@ -46,7 +46,8 @@ export type Command<T extends CommandType = CommandType> = {
46
46
  };
47
47
  export declare const materializeCommand: (command: any) => any;
48
48
  export declare const isCommand: <T extends CommandType>(command: Command, type: T) => command is Command<T>;
49
- interface GroupCommand extends Command<CommandType.Group> {
49
+ export interface GroupCommand extends Command<CommandType.Group> {
50
+ props?: Pick<DrawingNodeProps, "zIndex">;
50
51
  children: Command[];
51
52
  }
52
53
  export declare const isGroup: (command: Command) => command is GroupCommand;
@@ -4,48 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.materializeCommand = exports.isGroup = exports.isDrawCommand = exports.isCommand = exports.CommandType = void 0;
7
- // export enum CommandType {
8
- // // Context
9
- // Group = "Group",
10
- // SavePaint = "SavePaint",
11
- // RestorePaint = "RestorePaint",
12
- // SaveCTM = "SaveCTM",
13
- // RestoreCTM = "RestoreCTM",
14
- // PushColorFilter = "PushColorFilter",
15
- // PushBlurMaskFilter = "PushBlurMaskFilter",
16
- // PushImageFilter = "PushImageFilter",
17
- // PushPathEffect = "PushPathEffect",
18
- // PushShader = "PushShader",
19
- // ComposeColorFilter = "ComposeColorFilter",
20
- // ComposeImageFilter = "ComposeImageFilter",
21
- // ComposePathEffect = "ComposePathEffect",
22
- // MaterializePaint = "MaterializePaint",
23
- // SaveBackdropFilter = "SaveBackdropFilter",
24
- // SaveLayer = "SaveLayer",
25
- // RestorePaintDeclaration = "RestorePaintDeclaration",
26
- // // Drawing
27
- // DrawBox = "DrawBox",
28
- // DrawImage = "DrawImage",
29
- // DrawCircle = "DrawCircle",
30
- // DrawPaint = "DrawPaint",
31
- // DrawPoints = "DrawPoints",
32
- // DrawPath = "DrawPath",
33
- // DrawRect = "DrawRect",
34
- // DrawRRect = "DrawRRect",
35
- // DrawOval = "DrawOval",
36
- // DrawLine = "DrawLine",
37
- // DrawPatch = "DrawPatch",
38
- // DrawVertices = "DrawVertices",
39
- // DrawDiffRect = "DrawDiffRect",
40
- // DrawText = "DrawText",
41
- // DrawTextPath = "DrawTextPath",
42
- // DrawTextBlob = "DrawTextBlob",
43
- // DrawGlyphs = "DrawGlyphs",
44
- // DrawPicture = "DrawPicture",
45
- // DrawImageSVG = "DrawImageSVG",
46
- // DrawParagraph = "DrawParagraph",
47
- // DrawAtlas = "DrawAtlas",
48
- // }
49
7
  let CommandType = exports.CommandType = /*#__PURE__*/function (CommandType) {
50
8
  // Context
51
9
  CommandType[CommandType["Group"] = 0] = "Group";
@@ -1 +1 @@
1
- {"version":3,"names":["CommandType","exports","materializeCommand","command","newProps","props","animatedProps","key","value","isCommand","type","isGroup","Group","isDrawCommand"],"sources":["Core.ts"],"sourcesContent":["import type {\n BlurMaskFilterProps,\n CircleProps,\n CTMProps,\n ImageProps,\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 DrawingNodeProps,\n SkottieProps,\n} from \"../../dom/types\";\n\n// export enum CommandType {\n// // Context\n// Group = \"Group\",\n// SavePaint = \"SavePaint\",\n// RestorePaint = \"RestorePaint\",\n// SaveCTM = \"SaveCTM\",\n// RestoreCTM = \"RestoreCTM\",\n// PushColorFilter = \"PushColorFilter\",\n// PushBlurMaskFilter = \"PushBlurMaskFilter\",\n// PushImageFilter = \"PushImageFilter\",\n// PushPathEffect = \"PushPathEffect\",\n// PushShader = \"PushShader\",\n// ComposeColorFilter = \"ComposeColorFilter\",\n// ComposeImageFilter = \"ComposeImageFilter\",\n// ComposePathEffect = \"ComposePathEffect\",\n// MaterializePaint = \"MaterializePaint\",\n// SaveBackdropFilter = \"SaveBackdropFilter\",\n// SaveLayer = \"SaveLayer\",\n// RestorePaintDeclaration = \"RestorePaintDeclaration\",\n// // Drawing\n// DrawBox = \"DrawBox\",\n// DrawImage = \"DrawImage\",\n// DrawCircle = \"DrawCircle\",\n// DrawPaint = \"DrawPaint\",\n// DrawPoints = \"DrawPoints\",\n// DrawPath = \"DrawPath\",\n// DrawRect = \"DrawRect\",\n// DrawRRect = \"DrawRRect\",\n// DrawOval = \"DrawOval\",\n// DrawLine = \"DrawLine\",\n// DrawPatch = \"DrawPatch\",\n// DrawVertices = \"DrawVertices\",\n// DrawDiffRect = \"DrawDiffRect\",\n// DrawText = \"DrawText\",\n// DrawTextPath = \"DrawTextPath\",\n// DrawTextBlob = \"DrawTextBlob\",\n// DrawGlyphs = \"DrawGlyphs\",\n// DrawPicture = \"DrawPicture\",\n// DrawImageSVG = \"DrawImageSVG\",\n// DrawParagraph = \"DrawParagraph\",\n// DrawAtlas = \"DrawAtlas\",\n// }\nexport enum CommandType {\n // Context\n Group,\n SavePaint,\n RestorePaint,\n SaveCTM,\n RestoreCTM,\n PushColorFilter,\n PushBlurMaskFilter,\n PushImageFilter,\n PushPathEffect,\n PushShader,\n ComposeColorFilter,\n ComposeImageFilter,\n ComposePathEffect,\n MaterializePaint,\n SaveBackdropFilter,\n SaveLayer,\n RestorePaintDeclaration,\n // Drawing\n DrawBox,\n DrawImage,\n DrawCircle,\n DrawPaint,\n DrawPoints,\n DrawPath,\n DrawRect,\n DrawRRect,\n DrawOval,\n DrawLine,\n DrawPatch,\n DrawVertices,\n DrawDiffRect,\n DrawText,\n DrawTextPath,\n DrawTextBlob,\n DrawGlyphs,\n DrawPicture,\n DrawImageSVG,\n DrawParagraph,\n DrawAtlas,\n DrawSkottie,\n}\n\nexport type Command<T extends CommandType = CommandType> = {\n type: T;\n [key: string]: unknown;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const materializeCommand = (command: any) => {\n \"worklet\";\n const newProps = { ...command.props };\n if (command.animatedProps) {\n for (const key in command.animatedProps) {\n newProps[key] = command.animatedProps[key].value;\n }\n }\n return { ...command, props: newProps };\n};\n\nexport const isCommand = <T extends CommandType>(\n command: Command,\n type: T\n): command is Command<T> => {\n \"worklet\";\n return command.type === type;\n};\n\ninterface GroupCommand extends Command<CommandType.Group> {\n children: Command[];\n}\n\nexport const isGroup = (command: Command): command is GroupCommand => {\n \"worklet\";\n return command.type === CommandType.Group;\n};\n\ninterface Props {\n [CommandType.DrawImage]: ImageProps;\n [CommandType.DrawCircle]: CircleProps;\n [CommandType.SaveCTM]: CTMProps;\n [CommandType.SavePaint]: DrawingNodeProps;\n [CommandType.PushBlurMaskFilter]: BlurMaskFilterProps;\n [CommandType.DrawPoints]: PointsProps;\n [CommandType.DrawPath]: PathProps;\n [CommandType.DrawRect]: RectProps;\n [CommandType.DrawRRect]: RoundedRectProps;\n [CommandType.DrawOval]: OvalProps;\n [CommandType.DrawLine]: LineProps;\n [CommandType.DrawPatch]: PatchProps;\n [CommandType.DrawVertices]: VerticesProps;\n [CommandType.DrawDiffRect]: DiffRectProps;\n [CommandType.DrawText]: TextProps;\n [CommandType.DrawTextPath]: TextPathProps;\n [CommandType.DrawTextBlob]: TextBlobProps;\n [CommandType.DrawGlyphs]: GlyphsProps;\n [CommandType.DrawPicture]: PictureProps;\n [CommandType.DrawImageSVG]: ImageSVGProps;\n [CommandType.DrawParagraph]: ParagraphProps;\n [CommandType.DrawAtlas]: AtlasProps;\n [CommandType.DrawSkottie]: SkottieProps;\n}\n\ninterface DrawCommand<T extends CommandType> extends Command<T> {\n props: T extends keyof Props ? Props[T] : never;\n}\n\nexport const isDrawCommand = <T extends keyof Props>(\n command: Command,\n type: T\n): command is DrawCommand<T> => {\n \"worklet\";\n return command.type === type;\n};\n"],"mappings":";;;;;;AA0BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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QAAQ,GAAG;IAAE,GAAGD,OAAO,CAACE;EAAM,CAAC;EACrC,IAAIF,OAAO,CAACG,aAAa,EAAE;IACzB,KAAK,MAAMC,GAAG,IAAIJ,OAAO,CAACG,aAAa,EAAE;MACvCF,QAAQ,CAACG,GAAG,CAAC,GAAGJ,OAAO,CAACG,aAAa,CAACC,GAAG,CAAC,CAACC,KAAK;IAClD;EACF;EACA,OAAO;IAAE,GAAGL,OAAO;IAAEE,KAAK,EAAED;EAAS,CAAC;AACxC,CAAC;AAACH,OAAA,CAAAC,kBAAA,GAAAA,kBAAA;AAEK,MAAMO,SAAS,GAAGA,CACvBN,OAAgB,EAChBO,IAAO,KACmB;EAC1B,SAAS;;EACT,OAAOP,OAAO,CAACO,IAAI,KAAKA,IAAI;AAC9B,CAAC;AAACT,OAAA,CAAAQ,SAAA,GAAAA,SAAA;AAMK,MAAME,OAAO,GAAIR,OAAgB,IAA8B;EACpE,SAAS;;EACT,OAAOA,OAAO,CAACO,IAAI,KAAKV,WAAW,CAACY,KAAK;AAC3C,CAAC;AAACX,OAAA,CAAAU,OAAA,GAAAA,OAAA;AAgCK,MAAME,aAAa,GAAGA,CAC3BV,OAAgB,EAChBO,IAAO,KACuB;EAC9B,SAAS;;EACT,OAAOP,OAAO,CAACO,IAAI,KAAKA,IAAI;AAC9B,CAAC;AAACT,OAAA,CAAAY,aAAA,GAAAA,aAAA","ignoreList":[]}
1
+ {"version":3,"names":["CommandType","exports","materializeCommand","command","newProps","props","animatedProps","key","value","isCommand","type","isGroup","Group","isDrawCommand"],"sources":["Core.ts"],"sourcesContent":["import type {\n BlurMaskFilterProps,\n CircleProps,\n CTMProps,\n ImageProps,\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 DrawingNodeProps,\n SkottieProps,\n} from \"../../dom/types\";\n\nexport enum CommandType {\n // Context\n Group,\n SavePaint,\n RestorePaint,\n SaveCTM,\n RestoreCTM,\n PushColorFilter,\n PushBlurMaskFilter,\n PushImageFilter,\n PushPathEffect,\n PushShader,\n ComposeColorFilter,\n ComposeImageFilter,\n ComposePathEffect,\n MaterializePaint,\n SaveBackdropFilter,\n SaveLayer,\n RestorePaintDeclaration,\n // Drawing\n DrawBox,\n DrawImage,\n DrawCircle,\n DrawPaint,\n DrawPoints,\n DrawPath,\n DrawRect,\n DrawRRect,\n DrawOval,\n DrawLine,\n DrawPatch,\n DrawVertices,\n DrawDiffRect,\n DrawText,\n DrawTextPath,\n DrawTextBlob,\n DrawGlyphs,\n DrawPicture,\n DrawImageSVG,\n DrawParagraph,\n DrawAtlas,\n DrawSkottie,\n}\n\nexport type Command<T extends CommandType = CommandType> = {\n type: T;\n [key: string]: unknown;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const materializeCommand = (command: any) => {\n \"worklet\";\n const newProps = { ...command.props };\n if (command.animatedProps) {\n for (const key in command.animatedProps) {\n newProps[key] = command.animatedProps[key].value;\n }\n }\n return { ...command, props: newProps };\n};\n\nexport const isCommand = <T extends CommandType>(\n command: Command,\n type: T\n): command is Command<T> => {\n \"worklet\";\n return command.type === type;\n};\n\nexport interface GroupCommand extends Command<CommandType.Group> {\n props?: Pick<DrawingNodeProps, \"zIndex\">;\n children: Command[];\n}\n\nexport const isGroup = (command: Command): command is GroupCommand => {\n \"worklet\";\n return command.type === CommandType.Group;\n};\n\ninterface Props {\n [CommandType.DrawImage]: ImageProps;\n [CommandType.DrawCircle]: CircleProps;\n [CommandType.SaveCTM]: CTMProps;\n [CommandType.SavePaint]: DrawingNodeProps;\n [CommandType.PushBlurMaskFilter]: BlurMaskFilterProps;\n [CommandType.DrawPoints]: PointsProps;\n [CommandType.DrawPath]: PathProps;\n [CommandType.DrawRect]: RectProps;\n [CommandType.DrawRRect]: RoundedRectProps;\n [CommandType.DrawOval]: OvalProps;\n [CommandType.DrawLine]: LineProps;\n [CommandType.DrawPatch]: PatchProps;\n [CommandType.DrawVertices]: VerticesProps;\n [CommandType.DrawDiffRect]: DiffRectProps;\n [CommandType.DrawText]: TextProps;\n [CommandType.DrawTextPath]: TextPathProps;\n [CommandType.DrawTextBlob]: TextBlobProps;\n [CommandType.DrawGlyphs]: GlyphsProps;\n [CommandType.DrawPicture]: PictureProps;\n [CommandType.DrawImageSVG]: ImageSVGProps;\n [CommandType.DrawParagraph]: ParagraphProps;\n [CommandType.DrawAtlas]: AtlasProps;\n [CommandType.DrawSkottie]: SkottieProps;\n}\n\ninterface DrawCommand<T extends CommandType> extends Command<T> {\n props: T extends keyof Props ? Props[T] : never;\n}\n\nexport const isDrawCommand = <T extends keyof Props>(\n command: Command,\n type: T\n): command is DrawCommand<T> => {\n \"worklet\";\n return command.type === type;\n};\n"],"mappings":";;;;;;IA0BYA,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAXA,WAAW;EACrB;EADUA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAmBrB;EAnBUA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,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AgCK,MAAME,aAAa,GAAGA,CAC3BV,OAAgB,EAChBO,IAAO,KACuB;EAC9B,SAAS;;EACT,OAAOP,OAAO,CAACO,IAAI,KAAKA,IAAI;AAC9B,CAAC;AAACT,OAAA,CAAAY,aAAA,GAAAA,aAAA","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ import type { Command } from "./Core";
2
+ export declare const debugTree: (commands: Command[], indent?: number) => string;
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.debugTree = void 0;
7
+ var _Core = require("./Core");
8
+ const CommandTypeNames = {
9
+ [_Core.CommandType.Group]: "Group",
10
+ [_Core.CommandType.SavePaint]: "SavePaint",
11
+ [_Core.CommandType.RestorePaint]: "RestorePaint",
12
+ [_Core.CommandType.SaveCTM]: "SaveCTM",
13
+ [_Core.CommandType.RestoreCTM]: "RestoreCTM",
14
+ [_Core.CommandType.PushColorFilter]: "PushColorFilter",
15
+ [_Core.CommandType.PushBlurMaskFilter]: "PushBlurMaskFilter",
16
+ [_Core.CommandType.PushImageFilter]: "PushImageFilter",
17
+ [_Core.CommandType.PushPathEffect]: "PushPathEffect",
18
+ [_Core.CommandType.PushShader]: "PushShader",
19
+ [_Core.CommandType.ComposeColorFilter]: "ComposeColorFilter",
20
+ [_Core.CommandType.ComposeImageFilter]: "ComposeImageFilter",
21
+ [_Core.CommandType.ComposePathEffect]: "ComposePathEffect",
22
+ [_Core.CommandType.MaterializePaint]: "MaterializePaint",
23
+ [_Core.CommandType.SaveBackdropFilter]: "SaveBackdropFilter",
24
+ [_Core.CommandType.SaveLayer]: "SaveLayer",
25
+ [_Core.CommandType.RestorePaintDeclaration]: "RestorePaintDeclaration",
26
+ [_Core.CommandType.DrawBox]: "DrawBox",
27
+ [_Core.CommandType.DrawImage]: "DrawImage",
28
+ [_Core.CommandType.DrawCircle]: "DrawCircle",
29
+ [_Core.CommandType.DrawPaint]: "DrawPaint",
30
+ [_Core.CommandType.DrawPoints]: "DrawPoints",
31
+ [_Core.CommandType.DrawPath]: "DrawPath",
32
+ [_Core.CommandType.DrawRect]: "DrawRect",
33
+ [_Core.CommandType.DrawRRect]: "DrawRRect",
34
+ [_Core.CommandType.DrawOval]: "DrawOval",
35
+ [_Core.CommandType.DrawLine]: "DrawLine",
36
+ [_Core.CommandType.DrawPatch]: "DrawPatch",
37
+ [_Core.CommandType.DrawVertices]: "DrawVertices",
38
+ [_Core.CommandType.DrawDiffRect]: "DrawDiffRect",
39
+ [_Core.CommandType.DrawText]: "DrawText",
40
+ [_Core.CommandType.DrawTextPath]: "DrawTextPath",
41
+ [_Core.CommandType.DrawTextBlob]: "DrawTextBlob",
42
+ [_Core.CommandType.DrawGlyphs]: "DrawGlyphs",
43
+ [_Core.CommandType.DrawPicture]: "DrawPicture",
44
+ [_Core.CommandType.DrawImageSVG]: "DrawImageSVG",
45
+ [_Core.CommandType.DrawParagraph]: "DrawParagraph",
46
+ [_Core.CommandType.DrawAtlas]: "DrawAtlas",
47
+ [_Core.CommandType.DrawSkottie]: "DrawSkottie"
48
+ };
49
+ const serializeProps = props => {
50
+ try {
51
+ return JSON.stringify(props, (key, value) => {
52
+ if (key === "children") {
53
+ return undefined;
54
+ }
55
+ if (typeof value === "bigint") {
56
+ return value.toString();
57
+ }
58
+ return value;
59
+ });
60
+ } catch (e) {
61
+ return `"Error serializing props: ${e}"`;
62
+ }
63
+ };
64
+ const debugTree = (commands, indent = 0) => {
65
+ let result = "[\n";
66
+ const prefix = " ".repeat(indent + 2);
67
+ commands.forEach((cmd, index) => {
68
+ const type = CommandTypeNames[cmd.type] || "Unknown";
69
+ result += `${prefix}{ "type": "${type}"`;
70
+ if ("props" in cmd) {
71
+ result += `, "props": ${serializeProps(cmd.props)}`;
72
+ }
73
+ if ((0, _Core.isGroup)(cmd)) {
74
+ result += `, "children": ${debugTree(cmd.children, indent + 2)}`;
75
+ }
76
+ result += " }";
77
+ if (index < commands.length - 1) {
78
+ result += ",";
79
+ }
80
+ result += "\n";
81
+ });
82
+ result += " ".repeat(indent) + "]";
83
+ return result;
84
+ };
85
+ exports.debugTree = debugTree;
86
+ //# sourceMappingURL=Debug.js.map
@@ -0,0 +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":["\nimport { CommandType } 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\nimport { isGroup } from \"./Core\";\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":";;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AAGA,MAAMC,gBAA6C,GAAG;EAClD,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,CAACsB,UAAU,GAAG,YAAY;EACtC,CAACtB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AAGA,CAACC,QAAmB,EAAEC,MAAM,GAAG,CAAC,KAAa;EAClE,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;IAC7B,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;MAChBJ,MAAM,IAAI,cAAcZ,cAAc,CAACgB,GAAG,CAACf,KAAK,CAAC,EAAE;IACvD;IAEA,IAAI,IAAAkB,aAAO,EAACH,GAAG,CAAC,EAAE;MACdJ,MAAM,IAAI,iBAAiBH,SAAS,CAACO,GAAG,CAACI,QAAQ,EAAET,MAAM,GAAG,CAAC,CAAC,EAAE;IACpE;IAEAC,MAAM,IAAI,IAAI;IACd,IAAIK,KAAK,GAAGP,QAAQ,CAACW,MAAM,GAAG,CAAC,EAAE;MAC7BT,MAAM,IAAI,GAAG;IACjB;IACAA,MAAM,IAAI,IAAI;EAClB,CAAC,CAAC;EAEFA,MAAM,IAAI,GAAG,CAACE,MAAM,CAACH,MAAM,CAAC,GAAG,GAAG;EAClC,OAAOC,MAAM;AACjB,CAAC;AAACU,OAAA,CAAAb,SAAA,GAAAA,SAAA","ignoreList":[]}
@@ -13,11 +13,55 @@ var _Paint = require("./commands/Paint");
13
13
  var _PathEffects = require("./commands/PathEffects");
14
14
  var _Shaders = require("./commands/Shaders");
15
15
  var _Core = require("./Core");
16
+ const getZIndex = command => {
17
+ "worklet";
18
+
19
+ var _materialized$props;
20
+ const materialized = (0, _Core.materializeCommand)(command);
21
+ const {
22
+ zIndex
23
+ } = (_materialized$props = materialized.props) !== null && _materialized$props !== void 0 ? _materialized$props : {};
24
+ if (typeof zIndex !== "number" || Number.isNaN(zIndex)) {
25
+ return 0;
26
+ }
27
+ return zIndex;
28
+ };
29
+ const flushPendingGroups = (ctx, pendingGroups) => {
30
+ "worklet";
31
+
32
+ if (pendingGroups.length === 0) {
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
+ });
53
+ return;
54
+ }
55
+ flushPendingGroups(ctx, pending);
56
+ play(ctx, child);
57
+ });
58
+ flushPendingGroups(ctx, pending);
59
+ };
16
60
  function play(ctx, _command) {
17
61
  "worklet";
18
62
 
19
63
  if ((0, _Core.isGroup)(_command)) {
20
- _command.children.forEach(child => play(ctx, child));
64
+ playGroup(ctx, _command);
21
65
  return;
22
66
  }
23
67
  const command = (0, _Core.materializeCommand)(_command);
@@ -136,6 +180,7 @@ function play(ctx, _command) {
136
180
  const replay = (ctx, commands) => {
137
181
  "worklet";
138
182
 
183
+ //console.log(debugTree(commands));
139
184
  commands.forEach(command => {
140
185
  play(ctx, command);
141
186
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_Drawing","require","_Box","_ColorFilters","_CTM","_ImageFilters","_Paint","_PathEffects","_Shaders","_Core","play","ctx","_command","isGroup","children","forEach","child","command","materializeCommand","isCommand","CommandType","SaveBackdropFilter","saveBackdropFilter","SaveLayer","materializePaint","paint","paintDeclarations","pop","canvas","saveLayer","isDrawCommand","SavePaint","props","paints","push","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 {\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 } from \"./Core\";\nimport type { DrawingContext } from \"./DrawingContext\";\n\nfunction play(ctx: DrawingContext, _command: Command) {\n \"worklet\";\n if (isGroup(_command)) {\n _command.children.forEach((child) => play(ctx, child));\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 commands.forEach((command) => {\n play(ctx, command);\n });\n};\n"],"mappings":";;;;;;AAAA,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;AAUA,SAASS,IAAIA,CAACC,GAAmB,EAAEC,QAAiB,EAAE;EACpD,SAAS;;EACT,IAAI,IAAAC,aAAO,EAACD,QAAQ,CAAC,EAAE;IACrBA,QAAQ,CAACE,QAAQ,CAACC,OAAO,CAAEC,KAAK,IAAKN,IAAI,CAACC,GAAG,EAAEK,KAAK,CAAC,CAAC;IACtD;EACF;EACA,MAAMC,OAAO,GAAG,IAAAC,wBAAkB,EAACN,QAAQ,CAAC;EAC5C,IAAI,IAAAO,eAAS,EAACF,OAAO,EAAEG,iBAAW,CAACC,kBAAkB,CAAC,EAAE;IACtDV,GAAG,CAACW,kBAAkB,CAAC,CAAC;EAC1B,CAAC,MAAM,IAAI,IAAAH,eAAS,EAACF,OAAO,EAAEG,iBAAW,CAACG,SAAS,CAAC,EAAE;IACpDZ,GAAG,CAACa,gBAAgB,CAAC,CAAC;IACtB,MAAMC,KAAK,GAAGd,GAAG,CAACe,iBAAiB,CAACC,G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KAAK,CAAC;MACnC,CAAC,MAAM,IAAI,IAAAF,mBAAa,EAACb,OAAO,EAAEG,iBAAW,CAAC4F,SAAS,CAAC,EAAE;QACxD,IAAAC,kBAAS,EAACtG,GAAG,EAAEM,OAAO,CAACe,KAAK,CAAC;MAC/B,CAAC,MAAM,IAAI,IAAAF,mBAAa,EAACb,OAAO,EAAEG,iBAAW,CAAC8F,WAAW,CAAC,EAAE;QAC1D,IAAAC,oBAAW,EAACxG,GAAG,EAAEM,OAAO,CAACe,KAAK,CAAC;MACjC,CAAC,MAAM;QACLoF,OAAO,CAACC,IAAI,CAAC,oBAAoBpG,OAAO,CAACqG,IAAI,EAAE,CAAC;MAClD;MACA3G,GAAG,CAACsB,MAAM,CAACN,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC;EACJ;AACF;AAEO,MAAM4F,MAAM,GAAGA,CAAC5G,GAAmB,EAAE6G,QAAmB,KAAK;EAClE,SAAS;;EACTA,QAAQ,CAACzG,OAAO,CAAEE,OAAO,IAAK;IAC5BP,IAAI,CAACC,GAAG,EAAEM,OAAO,CAAC;EACpB,CAAC,CAAC;AACJ,CAAC;AAACwG,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","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,GA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C/G,GAAG,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,6 +1,6 @@
1
1
  import type { SharedValue } from "react-native-reanimated";
2
2
  import type { BaseRecorder, JsiRecorder, Skia } from "../../skia/types";
3
- import type { PaintProps, NodeType, BlurMaskFilterProps, CTMProps, BoxProps, BoxShadowProps, ImageProps, CircleProps, PointsProps, PathProps, RectProps, RoundedRectProps, OvalProps, LineProps, PatchProps, VerticesProps, DiffRectProps, TextProps, TextPathProps, TextBlobProps, GlyphsProps, PictureProps, ImageSVGProps, ParagraphProps, AtlasProps, SkottieProps } from "../../dom/types";
3
+ import type { PaintProps, NodeType, BlurMaskFilterProps, CTMProps, BoxProps, BoxShadowProps, ImageProps, CircleProps, PointsProps, PathProps, RectProps, RoundedRectProps, OvalProps, LineProps, PatchProps, VerticesProps, DiffRectProps, TextProps, TextPathProps, TextBlobProps, GlyphsProps, PictureProps, ImageSVGProps, ParagraphProps, AtlasProps, SkottieProps, DrawingNodeProps } from "../../dom/types";
4
4
  import type { AnimatedProps } from "../../renderer";
5
5
  /**
6
6
  * Currently the recorder only work if the GPU resources (e.g Images) are owned by the main thread.
@@ -14,7 +14,7 @@ export declare class ReanimatedRecorder implements BaseRecorder {
14
14
  private processAnimationValues;
15
15
  getRecorder(): JsiRecorder;
16
16
  getSharedValues(): SharedValue<unknown>[];
17
- saveGroup(): void;
17
+ saveGroup(props?: AnimatedProps<Pick<DrawingNodeProps, "zIndex">>): void;
18
18
  restoreGroup(): void;
19
19
  savePaint(props: AnimatedProps<PaintProps>, standalone: boolean): void;
20
20
  restorePaint(): void;
@@ -41,8 +41,13 @@ class ReanimatedRecorder {
41
41
  getSharedValues() {
42
42
  return Array.from(this.values);
43
43
  }
44
- saveGroup() {
45
- this.recorder.saveGroup();
44
+ saveGroup(props) {
45
+ if (props) {
46
+ this.processAnimationValues(props);
47
+ this.recorder.saveGroup(props);
48
+ } else {
49
+ this.recorder.saveGroup();
50
+ }
46
51
  }
47
52
  restoreGroup() {
48
53
  this.recorder.restoreGroup();
@@ -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} 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(): void {\n this.recorder.saveGroup();\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":";;;;;;AAgCA,IAAAA,MAAA,GAAAC,OAAA;AAAyC,SAAAC,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,CAAAc,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAEzC;AACA;AACA;AACA;AACO,MAAMgB,kBAAkB,CAAyB;EAItDC,WAAWA,CAACC,IAAU,EAAE;IAAArB,eAAA,iBAHP,IAAIsB,GAAG,CAAuB,CAAC;IAAAtB,eAAA;IAI9C,IAAI,CAACuB,QAAQ,GAAGF,IAAI,CAACG,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,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BAAA,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(\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,IAAAA,MAAA,GAAAC,OAAA;AAAyC,SAAAC,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,K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;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,6 +1,6 @@
1
1
  import type { SharedValue } from "react-native-reanimated";
2
2
  import { NodeType } from "../../dom/types";
3
- import type { BlurMaskFilterProps, CircleProps, CTMProps, ImageProps, PaintProps, PointsProps, PathProps, RectProps, RoundedRectProps, OvalProps, LineProps, PatchProps, VerticesProps, DiffRectProps, TextProps, TextPathProps, TextBlobProps, GlyphsProps, PictureProps, ImageSVGProps, ParagraphProps, AtlasProps, BoxProps, BoxShadowProps, SkottieProps } from "../../dom/types";
3
+ import type { BlurMaskFilterProps, CircleProps, CTMProps, ImageProps, PaintProps, PointsProps, PathProps, RectProps, RoundedRectProps, OvalProps, LineProps, PatchProps, VerticesProps, DiffRectProps, TextProps, TextPathProps, TextBlobProps, GlyphsProps, PictureProps, ImageSVGProps, ParagraphProps, AtlasProps, BoxProps, BoxShadowProps, SkottieProps, DrawingNodeProps } from "../../dom/types";
4
4
  import type { AnimatedProps } from "../../renderer";
5
5
  import type { SkPaint, BaseRecorder } from "../../skia/types";
6
6
  import type { Command } from "./Core";
@@ -19,7 +19,7 @@ export declare class Recorder implements BaseRecorder {
19
19
  getRecording(): Recording & AnimationValues;
20
20
  private processProps;
21
21
  private add;
22
- saveGroup(): void;
22
+ saveGroup(props?: AnimatedProps<Pick<DrawingNodeProps, "zIndex">>): void;
23
23
  restoreGroup(): void;
24
24
  savePaint(props: AnimatedProps<PaintProps>, standalone: boolean): void;
25
25
  restorePaint(): void;
@@ -52,12 +52,16 @@ class Recorder {
52
52
  }
53
53
  this.cursors[this.cursors.length - 1].push(command);
54
54
  }
55
- saveGroup() {
55
+ saveGroup(props) {
56
56
  const children = [];
57
- this.add({
57
+ const group = {
58
58
  type: _Core.CommandType.Group,
59
59
  children
60
- });
60
+ };
61
+ if (props) {
62
+ group.props = props;
63
+ }
64
+ this.add(group);
61
65
  this.cursors.push(children);
62
66
  }
63
67
  restoreGroup() {