@shopify/react-native-skia 2.3.14 → 2.4.1

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 (71) hide show
  1. package/cpp/api/JsiSkPictureFactory.h +24 -6
  2. package/cpp/api/recorder/Command.h +12 -0
  3. package/cpp/api/recorder/JsiRecorder.h +2 -1
  4. package/cpp/api/recorder/RNRecorder.h +434 -374
  5. package/lib/commonjs/dom/types/Common.d.ts +1 -0
  6. package/lib/commonjs/dom/types/Common.js.map +1 -1
  7. package/lib/commonjs/skia/types/Recorder.d.ts +2 -2
  8. package/lib/commonjs/skia/types/Recorder.js.map +1 -1
  9. package/lib/commonjs/sksg/Recorder/Core.d.ts +2 -1
  10. package/lib/commonjs/sksg/Recorder/Core.js +0 -42
  11. package/lib/commonjs/sksg/Recorder/Core.js.map +1 -1
  12. package/lib/commonjs/sksg/Recorder/Debug.d.ts +2 -0
  13. package/lib/commonjs/sksg/Recorder/Debug.js +86 -0
  14. package/lib/commonjs/sksg/Recorder/Debug.js.map +1 -0
  15. package/lib/commonjs/sksg/Recorder/Player.d.ts +1 -1
  16. package/lib/commonjs/sksg/Recorder/Player.js +51 -7
  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/commonjs/views/SkiaPictureView.js.map +1 -1
  27. package/lib/module/dom/types/Common.d.ts +1 -0
  28. package/lib/module/dom/types/Common.js.map +1 -1
  29. package/lib/module/skia/types/Recorder.d.ts +2 -2
  30. package/lib/module/skia/types/Recorder.js.map +1 -1
  31. package/lib/module/sksg/Recorder/Core.d.ts +2 -1
  32. package/lib/module/sksg/Recorder/Core.js +0 -42
  33. package/lib/module/sksg/Recorder/Core.js.map +1 -1
  34. package/lib/module/sksg/Recorder/Debug.d.ts +2 -0
  35. package/lib/module/sksg/Recorder/Debug.js +79 -0
  36. package/lib/module/sksg/Recorder/Debug.js.map +1 -0
  37. package/lib/module/sksg/Recorder/Player.d.ts +1 -1
  38. package/lib/module/sksg/Recorder/Player.js +50 -5
  39. package/lib/module/sksg/Recorder/Player.js.map +1 -1
  40. package/lib/module/sksg/Recorder/ReanimatedRecorder.d.ts +2 -2
  41. package/lib/module/sksg/Recorder/ReanimatedRecorder.js +7 -2
  42. package/lib/module/sksg/Recorder/ReanimatedRecorder.js.map +1 -1
  43. package/lib/module/sksg/Recorder/Recorder.d.ts +2 -2
  44. package/lib/module/sksg/Recorder/Recorder.js +7 -3
  45. package/lib/module/sksg/Recorder/Recorder.js.map +1 -1
  46. package/lib/module/sksg/Recorder/Visitor.js +14 -6
  47. package/lib/module/sksg/Recorder/Visitor.js.map +1 -1
  48. package/lib/module/views/SkiaPictureView.js.map +1 -1
  49. package/lib/typescript/lib/commonjs/sksg/Recorder/Debug.d.ts +2 -0
  50. package/lib/typescript/lib/commonjs/sksg/Recorder/ReanimatedRecorder.d.ts +1 -1
  51. package/lib/typescript/lib/commonjs/sksg/Recorder/Recorder.d.ts +1 -1
  52. package/lib/typescript/lib/module/sksg/Recorder/Debug.d.ts +1 -0
  53. package/lib/typescript/lib/module/sksg/Recorder/ReanimatedRecorder.d.ts +1 -1
  54. package/lib/typescript/lib/module/sksg/Recorder/Recorder.d.ts +1 -1
  55. package/lib/typescript/src/dom/types/Common.d.ts +1 -0
  56. package/lib/typescript/src/skia/types/Recorder.d.ts +2 -2
  57. package/lib/typescript/src/sksg/Recorder/Core.d.ts +2 -1
  58. package/lib/typescript/src/sksg/Recorder/Debug.d.ts +2 -0
  59. package/lib/typescript/src/sksg/Recorder/Player.d.ts +1 -1
  60. package/lib/typescript/src/sksg/Recorder/ReanimatedRecorder.d.ts +2 -2
  61. package/lib/typescript/src/sksg/Recorder/Recorder.d.ts +2 -2
  62. package/package.json +1 -1
  63. package/src/dom/types/Common.ts +3 -1
  64. package/src/skia/types/Recorder.ts +2 -1
  65. package/src/sksg/Recorder/Core.ts +2 -43
  66. package/src/sksg/Recorder/Debug.ts +87 -0
  67. package/src/sksg/Recorder/Player.ts +62 -7
  68. package/src/sksg/Recorder/ReanimatedRecorder.ts +8 -2
  69. package/src/sksg/Recorder/Recorder.ts +7 -2
  70. package/src/sksg/Recorder/Visitor.ts +18 -6
  71. package/src/views/SkiaPictureView.tsx +7 -1
@@ -1 +1 @@
1
- {"version":3,"names":["_types","require","_utils","_Node","_Core","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","Recorder","constructor","Set","cursors","push","commands","getRecording","paintPool","animationValues","processProps","props","animatedProps","hasAnimatedProps","key","prop","isSharedValue","add","undefined","command","length","saveGroup","children","type","CommandType","Group","restoreGroup","pop","savePaint","standalone","SavePaint","restorePaint","RestorePaint","restorePaintDeclaration","RestorePaintDeclaration","materializePaint","MaterializePaint","pushPathEffect","pathEffectType","isPathEffect","Error","PushPathEffect","pushImageFilter","imageFilterType","isImageFilter","PushImageFilter","pushColorFilter","colorFilterType","isColorFilter","PushColorFilter","pushShader","shaderType","isShader","NodeType","Blend","PushShader","pushBlurMaskFilter","PushBlurMaskFilter","composePathEffect","ComposePathEffect","composeColorFilter","ComposeColorFilter","composeImageFilter","ComposeImageFilter","saveCTM","SaveCTM","restoreCTM","RestoreCTM","drawPaint","DrawPaint","saveLayer","SaveLayer","saveBackdropFilter","SaveBackdropFilter","drawBox","boxProps","shadows","forEach","shadow","DrawBox","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","exports"],"sources":["Recorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport { NodeType } from \"../../dom/types\";\nimport type {\n BlurMaskFilterProps,\n CircleProps,\n CTMProps,\n ImageProps,\n PaintProps,\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 BoxProps,\n BoxShadowProps,\n SkottieProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer\";\nimport { isSharedValue } from \"../utils\";\nimport { isColorFilter, isImageFilter, isPathEffect, isShader } from \"../Node\";\nimport type { SkPaint, BaseRecorder } from \"../../skia/types\";\n\nimport { CommandType } from \"./Core\";\nimport type { Command } from \"./Core\";\n\nexport interface Recording {\n commands: Command[];\n paintPool: SkPaint[];\n}\n\ninterface AnimationValues {\n animationValues: Set<SharedValue<unknown>>;\n}\n\nexport class Recorder implements BaseRecorder {\n commands: Command[] = [];\n cursors: Command[][] = [];\n animationValues: Set<SharedValue<unknown>> = new Set();\n\n constructor() {\n this.cursors.push(this.commands);\n }\n\n getRecording(): Recording & AnimationValues {\n return {\n commands: this.commands,\n paintPool: [],\n animationValues: this.animationValues,\n };\n }\n\n private processProps(props: Record<string, unknown>) {\n const animatedProps: Record<string, SharedValue<unknown>> = {};\n let hasAnimatedProps = false;\n\n for (const key in props) {\n const prop = props[key];\n if (isSharedValue(prop)) {\n this.animationValues.add(prop);\n animatedProps[key] = prop;\n hasAnimatedProps = true;\n }\n }\n\n return {\n props,\n animatedProps: hasAnimatedProps ? animatedProps : undefined,\n };\n }\n\n private add(command: Command) {\n if (command.props) {\n const { animatedProps } = this.processProps(\n command.props as Record<string, unknown>\n );\n if (animatedProps) {\n command.animatedProps = animatedProps;\n }\n }\n this.cursors[this.cursors.length - 1].push(command);\n }\n\n saveGroup() {\n const children: Command[] = [];\n this.add({ type: CommandType.Group, children });\n this.cursors.push(children);\n }\n\n restoreGroup() {\n this.cursors.pop();\n }\n\n savePaint(props: AnimatedProps<PaintProps>, standalone: boolean) {\n this.add({ type: CommandType.SavePaint, props, standalone });\n }\n\n restorePaint() {\n this.add({ type: CommandType.RestorePaint });\n }\n\n restorePaintDeclaration() {\n this.add({ type: CommandType.RestorePaintDeclaration });\n }\n\n materializePaint() {\n this.add({ type: CommandType.MaterializePaint });\n }\n\n pushPathEffect(pathEffectType: NodeType, props: AnimatedProps<unknown>) {\n if (!isPathEffect(pathEffectType)) {\n throw new Error(\"Invalid color filter type: \" + pathEffectType);\n }\n this.add({\n type: CommandType.PushPathEffect,\n pathEffectType,\n props,\n });\n }\n\n pushImageFilter(imageFilterType: NodeType, props: AnimatedProps<unknown>) {\n if (!isImageFilter(imageFilterType)) {\n throw new Error(\"Invalid color filter type: \" + imageFilterType);\n }\n this.add({\n type: CommandType.PushImageFilter,\n imageFilterType,\n props,\n });\n }\n\n pushColorFilter(colorFilterType: NodeType, props: AnimatedProps<unknown>) {\n if (!isColorFilter(colorFilterType)) {\n throw new Error(\"Invalid color filter type: \" + colorFilterType);\n }\n this.add({\n type: CommandType.PushColorFilter,\n colorFilterType,\n props,\n });\n }\n\n pushShader(\n shaderType: NodeType,\n props: AnimatedProps<unknown>,\n children: number\n ) {\n if (!isShader(shaderType) && !(shaderType === NodeType.Blend)) {\n throw new Error(\"Invalid color filter type: \" + shaderType);\n }\n this.add({ type: CommandType.PushShader, shaderType, props, children });\n }\n\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>) {\n this.add({ type: CommandType.PushBlurMaskFilter, props });\n }\n\n composePathEffect() {\n this.add({ type: CommandType.ComposePathEffect });\n }\n\n composeColorFilter() {\n this.add({ type: CommandType.ComposeColorFilter });\n }\n\n composeImageFilter() {\n this.add({ type: CommandType.ComposeImageFilter });\n }\n\n saveCTM(props: AnimatedProps<CTMProps>) {\n this.add({ type: CommandType.SaveCTM, props });\n }\n\n restoreCTM() {\n this.add({ type: CommandType.RestoreCTM });\n }\n\n drawPaint() {\n this.add({ type: CommandType.DrawPaint });\n }\n\n saveLayer() {\n this.add({ type: CommandType.SaveLayer });\n }\n\n saveBackdropFilter() {\n this.add({ type: CommandType.SaveBackdropFilter });\n }\n\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n animatedProps?: Record<string, SharedValue<unknown>>;\n }[]\n ) {\n shadows.forEach((shadow) => {\n if (shadow.props) {\n if (shadow.props) {\n const { animatedProps } = this.processProps(\n shadow.props as unknown as Record<string, unknown>\n );\n if (animatedProps) {\n shadow.animatedProps = animatedProps;\n }\n }\n }\n });\n this.add({ type: CommandType.DrawBox, props: boxProps, shadows });\n }\n\n drawImage(props: AnimatedProps<ImageProps>) {\n this.add({ type: CommandType.DrawImage, props });\n }\n\n drawCircle(props: AnimatedProps<CircleProps>) {\n this.add({ type: CommandType.DrawCircle, props });\n }\n drawPoints(props: AnimatedProps<PointsProps>) {\n this.add({ type: CommandType.DrawPoints, props });\n }\n\n drawPath(props: AnimatedProps<PathProps>) {\n this.add({ type: CommandType.DrawPath, props });\n }\n\n drawRect(props: AnimatedProps<RectProps>) {\n this.add({ type: CommandType.DrawRect, props });\n }\n\n drawRRect(props: AnimatedProps<RoundedRectProps>) {\n this.add({ type: CommandType.DrawRRect, props });\n }\n\n drawOval(props: AnimatedProps<OvalProps>) {\n this.add({ type: CommandType.DrawOval, props });\n }\n\n drawLine(props: AnimatedProps<LineProps>) {\n this.add({ type: CommandType.DrawLine, props });\n }\n\n drawPatch(props: AnimatedProps<PatchProps>) {\n this.add({ type: CommandType.DrawPatch, props });\n }\n\n drawVertices(props: AnimatedProps<VerticesProps>) {\n this.add({ type: CommandType.DrawVertices, props });\n }\n\n drawDiffRect(props: AnimatedProps<DiffRectProps>) {\n this.add({ type: CommandType.DrawDiffRect, props });\n }\n\n drawText(props: AnimatedProps<TextProps>) {\n this.add({ type: CommandType.DrawText, props });\n }\n\n drawTextPath(props: AnimatedProps<TextPathProps>) {\n this.add({ type: CommandType.DrawTextPath, props });\n }\n\n drawTextBlob(props: AnimatedProps<TextBlobProps>) {\n this.add({ type: CommandType.DrawTextBlob, props });\n }\n\n drawGlyphs(props: AnimatedProps<GlyphsProps>) {\n this.add({ type: CommandType.DrawGlyphs, props });\n }\n\n drawPicture(props: AnimatedProps<PictureProps>) {\n this.add({ type: CommandType.DrawPicture, props });\n }\n\n drawImageSVG(props: AnimatedProps<ImageSVGProps>) {\n this.add({ type: CommandType.DrawImageSVG, props });\n }\n\n drawParagraph(props: AnimatedProps<ParagraphProps>) {\n this.add({ type: CommandType.DrawParagraph, props });\n }\n\n drawAtlas(props: AnimatedProps<AtlasProps>) {\n this.add({ type: CommandType.DrawAtlas, props });\n }\n\n drawSkottie(props: AnimatedProps<SkottieProps>) {\n this.add({ type: CommandType.DrawSkottie, props });\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AA6BA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAGA,IAAAG,KAAA,GAAAH,OAAA;AAAqC,SAAAI,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,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UA,CAACjG,KAAiC,EAAE;IAC5C,IAAI,CAACM,GAAG,CAAC;MAAEM,IAAI,EAAEC,iBAAW,CAACqF,UAAU;MAAElG;IAAM,CAAC,CAAC;EACnD;EAEAmG,WAAWA,CAACnG,KAAkC,EAAE;IAC9C,IAAI,CAACM,GAAG,CAAC;MAAEM,IAAI,EAAEC,iBAAW,CAACuF,WAAW;MAAEpG;IAAM,CAAC,CAAC;EACpD;EAEAqG,YAAYA,CAACrG,KAAmC,EAAE;IAChD,IAAI,CAACM,GAAG,CAAC;MAAEM,IAAI,EAAEC,iBAAW,CAACyF,YAAY;MAAEtG;IAAM,CAAC,CAAC;EACrD;EAEAuG,aAAaA,CAACvG,KAAoC,EAAE;IAClD,IAAI,CAACM,GAAG,CAAC;MAAEM,IAAI,EAAEC,iBAAW,CAAC2F,aAAa;MAAExG;IAAM,CAAC,CAAC;EACtD;EAEAyG,SAASA,CAACzG,KAAgC,EAAE;IAC1C,IAAI,CAACM,GAAG,CAAC;MAAEM,IAAI,EAAEC,iBAAW,CAAC6F,SAAS;MAAE1G;IAAM,CAAC,CAAC;EAClD;EAEA2G,WAAWA,CAAC3G,KAAkC,EAAE;IAC9C,IAAI,CAACM,GAAG,CAAC;MAAEM,IAAI,EAAEC,iBAAW,CAAC+F,WAAW;MAAE5G;IAAM,CAAC,CAAC;EACpD;AACF;AAAC6G,OAAA,CAAAvH,QAAA,GAAAA,QAAA","ignoreList":[]}
1
+ {"version":3,"names":["_types","require","_utils","_Node","_Core","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","Recorder","constructor","Set","cursors","push","commands","getRecording","paintPool","animationValues","processProps","props","animatedProps","hasAnimatedProps","key","prop","isSharedValue","add","undefined","command","length","saveGroup","children","group","type","CommandType","Group","restoreGroup","pop","savePaint","standalone","SavePaint","restorePaint","RestorePaint","restorePaintDeclaration","RestorePaintDeclaration","materializePaint","MaterializePaint","pushPathEffect","pathEffectType","isPathEffect","Error","PushPathEffect","pushImageFilter","imageFilterType","isImageFilter","PushImageFilter","pushColorFilter","colorFilterType","isColorFilter","PushColorFilter","pushShader","shaderType","isShader","NodeType","Blend","PushShader","pushBlurMaskFilter","PushBlurMaskFilter","composePathEffect","ComposePathEffect","composeColorFilter","ComposeColorFilter","composeImageFilter","ComposeImageFilter","saveCTM","SaveCTM","restoreCTM","RestoreCTM","drawPaint","DrawPaint","saveLayer","SaveLayer","saveBackdropFilter","SaveBackdropFilter","drawBox","boxProps","shadows","forEach","shadow","DrawBox","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","exports"],"sources":["Recorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport { NodeType } from \"../../dom/types\";\nimport type {\n BlurMaskFilterProps,\n CircleProps,\n CTMProps,\n ImageProps,\n PaintProps,\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 BoxProps,\n BoxShadowProps,\n SkottieProps,\n DrawingNodeProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer\";\nimport { isSharedValue } from \"../utils\";\nimport { isColorFilter, isImageFilter, isPathEffect, isShader } from \"../Node\";\nimport type { SkPaint, BaseRecorder } from \"../../skia/types\";\n\nimport { CommandType } from \"./Core\";\nimport type { Command } from \"./Core\";\n\nexport interface Recording {\n commands: Command[];\n paintPool: SkPaint[];\n}\n\ninterface AnimationValues {\n animationValues: Set<SharedValue<unknown>>;\n}\n\nexport class Recorder implements BaseRecorder {\n commands: Command[] = [];\n cursors: Command[][] = [];\n animationValues: Set<SharedValue<unknown>> = new Set();\n\n constructor() {\n this.cursors.push(this.commands);\n }\n\n getRecording(): Recording & AnimationValues {\n return {\n commands: this.commands,\n paintPool: [],\n animationValues: this.animationValues,\n };\n }\n\n private processProps(props: Record<string, unknown>) {\n const animatedProps: Record<string, SharedValue<unknown>> = {};\n let hasAnimatedProps = false;\n\n for (const key in props) {\n const prop = props[key];\n if (isSharedValue(prop)) {\n this.animationValues.add(prop);\n animatedProps[key] = prop;\n hasAnimatedProps = true;\n }\n }\n\n return {\n props,\n animatedProps: hasAnimatedProps ? animatedProps : undefined,\n };\n }\n\n private add(command: Command) {\n if (command.props) {\n const { animatedProps } = this.processProps(\n command.props as Record<string, unknown>\n );\n if (animatedProps) {\n command.animatedProps = animatedProps;\n }\n }\n this.cursors[this.cursors.length - 1].push(command);\n }\n\n saveGroup(props?: AnimatedProps<Pick<DrawingNodeProps, \"zIndex\">>) {\n const children: Command[] = [];\n const group: Command = { type: CommandType.Group, children };\n if (props) {\n group.props = props;\n }\n this.add(group);\n this.cursors.push(children);\n }\n\n restoreGroup() {\n this.cursors.pop();\n }\n\n savePaint(props: AnimatedProps<PaintProps>, standalone: boolean) {\n this.add({ type: CommandType.SavePaint, props, standalone });\n }\n\n restorePaint() {\n this.add({ type: CommandType.RestorePaint });\n }\n\n restorePaintDeclaration() {\n this.add({ type: CommandType.RestorePaintDeclaration });\n }\n\n materializePaint() {\n this.add({ type: CommandType.MaterializePaint });\n }\n\n pushPathEffect(pathEffectType: NodeType, props: AnimatedProps<unknown>) {\n if (!isPathEffect(pathEffectType)) {\n throw new Error(\"Invalid color filter type: \" + pathEffectType);\n }\n this.add({\n type: CommandType.PushPathEffect,\n pathEffectType,\n props,\n });\n }\n\n pushImageFilter(imageFilterType: NodeType, props: AnimatedProps<unknown>) {\n if (!isImageFilter(imageFilterType)) {\n throw new Error(\"Invalid color filter type: \" + imageFilterType);\n }\n this.add({\n type: CommandType.PushImageFilter,\n imageFilterType,\n props,\n });\n }\n\n pushColorFilter(colorFilterType: NodeType, props: AnimatedProps<unknown>) {\n if (!isColorFilter(colorFilterType)) {\n throw new Error(\"Invalid color filter type: \" + colorFilterType);\n }\n this.add({\n type: CommandType.PushColorFilter,\n colorFilterType,\n props,\n });\n }\n\n pushShader(\n shaderType: NodeType,\n props: AnimatedProps<unknown>,\n children: number\n ) {\n if (!isShader(shaderType) && !(shaderType === NodeType.Blend)) {\n throw new Error(\"Invalid color filter type: \" + shaderType);\n }\n this.add({ type: CommandType.PushShader, shaderType, props, children });\n }\n\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>) {\n this.add({ type: CommandType.PushBlurMaskFilter, props });\n }\n\n composePathEffect() {\n this.add({ type: CommandType.ComposePathEffect });\n }\n\n composeColorFilter() {\n this.add({ type: CommandType.ComposeColorFilter });\n }\n\n composeImageFilter() {\n this.add({ type: CommandType.ComposeImageFilter });\n }\n\n saveCTM(props: AnimatedProps<CTMProps>) {\n this.add({ type: CommandType.SaveCTM, props });\n }\n\n restoreCTM() {\n this.add({ type: CommandType.RestoreCTM });\n }\n\n drawPaint() {\n this.add({ type: CommandType.DrawPaint });\n }\n\n saveLayer() {\n this.add({ type: CommandType.SaveLayer });\n }\n\n saveBackdropFilter() {\n this.add({ type: CommandType.SaveBackdropFilter });\n }\n\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n animatedProps?: Record<string, SharedValue<unknown>>;\n }[]\n ) {\n shadows.forEach((shadow) => {\n if (shadow.props) {\n if (shadow.props) {\n const { animatedProps } = this.processProps(\n shadow.props as unknown as Record<string, unknown>\n );\n if (animatedProps) {\n shadow.animatedProps = animatedProps;\n }\n }\n }\n });\n this.add({ type: CommandType.DrawBox, props: boxProps, shadows });\n }\n\n drawImage(props: AnimatedProps<ImageProps>) {\n this.add({ type: CommandType.DrawImage, props });\n }\n\n drawCircle(props: AnimatedProps<CircleProps>) {\n this.add({ type: CommandType.DrawCircle, props });\n }\n drawPoints(props: AnimatedProps<PointsProps>) {\n this.add({ type: CommandType.DrawPoints, props });\n }\n\n drawPath(props: AnimatedProps<PathProps>) {\n this.add({ type: CommandType.DrawPath, props });\n }\n\n drawRect(props: AnimatedProps<RectProps>) {\n this.add({ type: CommandType.DrawRect, props });\n }\n\n drawRRect(props: AnimatedProps<RoundedRectProps>) {\n this.add({ type: CommandType.DrawRRect, props });\n }\n\n drawOval(props: AnimatedProps<OvalProps>) {\n this.add({ type: CommandType.DrawOval, props });\n }\n\n drawLine(props: AnimatedProps<LineProps>) {\n this.add({ type: CommandType.DrawLine, props });\n }\n\n drawPatch(props: AnimatedProps<PatchProps>) {\n this.add({ type: CommandType.DrawPatch, props });\n }\n\n drawVertices(props: AnimatedProps<VerticesProps>) {\n this.add({ type: CommandType.DrawVertices, props });\n }\n\n drawDiffRect(props: AnimatedProps<DiffRectProps>) {\n this.add({ type: CommandType.DrawDiffRect, props });\n }\n\n drawText(props: AnimatedProps<TextProps>) {\n this.add({ type: CommandType.DrawText, props });\n }\n\n drawTextPath(props: AnimatedProps<TextPathProps>) {\n this.add({ type: CommandType.DrawTextPath, props });\n }\n\n drawTextBlob(props: AnimatedProps<TextBlobProps>) {\n this.add({ type: CommandType.DrawTextBlob, props });\n }\n\n drawGlyphs(props: AnimatedProps<GlyphsProps>) {\n this.add({ type: CommandType.DrawGlyphs, props });\n }\n\n drawPicture(props: AnimatedProps<PictureProps>) {\n this.add({ type: CommandType.DrawPicture, props });\n }\n\n drawImageSVG(props: AnimatedProps<ImageSVGProps>) {\n this.add({ type: CommandType.DrawImageSVG, props });\n }\n\n drawParagraph(props: AnimatedProps<ParagraphProps>) {\n this.add({ type: CommandType.DrawParagraph, props });\n }\n\n drawAtlas(props: AnimatedProps<AtlasProps>) {\n this.add({ type: CommandType.DrawAtlas, props });\n }\n\n drawSkottie(props: AnimatedProps<SkottieProps>) {\n this.add({ type: CommandType.DrawSkottie, props });\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AA8BA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAGA,IAAAG,KAAA,GAAAH,OAAA;AAAqC,SAAAI,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;AAY9B,MAAMgB,QAAQ,CAAyB;EAK5CC,WAAWA,CAAA,EAAG;IAAApB,eAAA,mBAJQ,EAAE;IAAAA,eAAA,kBACD,EAAE;IAAAA,eAAA,0BACoB,IAAIqB,GAAG,CAAC,CAAC;IAGpD,IAAI,CAACC,OAAO,CAACC,IAAI,CAAC,IAAI,CAACC,QAAQ,CAAC;EAClC;EAEAC,YA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G;IAAM,CAAC,CAAC;EAClD;EAEA4G,WAAWA,CAAC5G,KAAkC,EAAE;IAC9C,IAAI,CAACM,GAAG,CAAC;MAAEO,IAAI,EAAEC,iBAAW,CAAC+F,WAAW;MAAE7G;IAAM,CAAC,CAAC;EACpD;AACF;AAAC8G,OAAA,CAAAxH,QAAA,GAAAA,QAAA","ignoreList":[]}
@@ -164,13 +164,23 @@ const pushPaints = (recorder, paints) => {
164
164
  recorder.restorePaintDeclaration();
165
165
  });
166
166
  };
167
- const visitNode = (recorder, node) => {
168
- if (node.type === _types.NodeType.Group) {
169
- recorder.saveGroup();
167
+ const getStackingContextProps = props => {
168
+ const {
169
+ zIndex
170
+ } = props;
171
+ if (zIndex === undefined) {
172
+ return undefined;
170
173
  }
174
+ return {
175
+ zIndex
176
+ };
177
+ };
178
+ const visitNode = (recorder, node) => {
171
179
  const {
172
180
  props
173
181
  } = node;
182
+ const stackingContextProps = getStackingContextProps(props);
183
+ recorder.saveGroup(stackingContextProps);
174
184
  const {
175
185
  colorFilters,
176
186
  maskFilters,
@@ -289,9 +299,7 @@ const visitNode = (recorder, node) => {
289
299
  if (shouldRestore) {
290
300
  recorder.restoreCTM();
291
301
  }
292
- if (node.type === _types.NodeType.Group) {
293
- recorder.restoreGroup();
294
- }
302
+ recorder.restoreGroup();
295
303
  };
296
304
  const visit = (recorder, root) => {
297
305
  root.forEach(node => {
@@ -1 +1 @@
1
- {"version":3,"names":["_types","require","_Node","processPaint","opacity","color","strokeWidth","blendMode","style","strokeJoin","strokeCap","strokeMiter","antiAlias","dither","paint","paintRef","undefined","exports","processCTM","clip","invertClip","transform","origin","matrix","layer","ctm","pushColorFilters","recorder","colorFilters","forEach","colorFilter","children","length","pushColorFilter","type","props","needsComposition","NodeType","LerpColorFilter","composeColorFilter","pushPathEffects","pathEffects","pathEffect","pushPathEffect","SumPathEffect","composePathEffect","pushImageFilters","imageFilters","imageFilter","isImageFilter","pushImageFilter","isShader","pushShader","BlendImageFilter","composeImageFilter","pushShaders","shaders","shader","pushMaskFilters","maskFilters","pushBlurMaskFilter","pushPaints","paints","savePaint","sortNodeChildren","restorePaintDeclaration","visitNode","node","Group","saveGroup","drawings","shouldPushPaint","BackdropFilter","saveBackdropFilter","materializePaint","Layer","saveLayer","shouldRestore","saveCTM","Box","shadows","filter","n","BoxShadow","map","drawBox","Fill","drawPaint","Image","drawImage","Circle","drawCircle","Points","drawPoints","Path","drawPath","Rect","drawRect","RRect","drawRRect","Oval","drawOval","Line","drawLine","Patch","drawPatch","Vertices","drawVertices","DiffRect","drawDiffRect","Text","drawText","TextPath","drawTextPath","TextBlob","drawTextBlob","Glyphs","drawGlyphs","Picture","drawPicture","ImageSVG","drawImageSVG","Paragraph","drawParagraph","Skottie","drawSkottie","Atlas","drawAtlas","drawing","restorePaint","restoreCTM","restoreGroup","visit","root"],"sources":["Visitor.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type {\n CTMProps,\n DrawingNodeProps,\n BoxShadowProps,\n} from \"../../dom/types\";\nimport { NodeType } from \"../../dom/types\";\nimport type { BaseRecorder } from \"../../skia/types/Recorder\";\nimport type { Node } from \"../Node\";\nimport { isImageFilter, isShader, sortNodeChildren } from \"../Node\";\n\nexport const processPaint = ({\n opacity,\n color,\n strokeWidth,\n blendMode,\n style,\n strokeJoin,\n strokeCap,\n strokeMiter,\n antiAlias,\n dither,\n paint: paintRef,\n}: DrawingNodeProps) => {\n const paint: DrawingNodeProps = {};\n if (opacity !== undefined) {\n paint.opacity = opacity;\n }\n if (color !== undefined) {\n paint.color = color;\n }\n if (strokeWidth !== undefined) {\n paint.strokeWidth = strokeWidth;\n }\n if (blendMode !== undefined) {\n paint.blendMode = blendMode;\n }\n if (style !== undefined) {\n paint.style = style;\n }\n if (strokeJoin !== undefined) {\n paint.strokeJoin = strokeJoin;\n }\n if (strokeCap !== undefined) {\n paint.strokeCap = strokeCap;\n }\n if (strokeMiter !== undefined) {\n paint.strokeMiter = strokeMiter;\n }\n if (antiAlias !== undefined) {\n paint.antiAlias = antiAlias;\n }\n if (dither !== undefined) {\n paint.dither = dither;\n }\n\n if (paintRef !== undefined) {\n paint.paint = paintRef;\n }\n\n if (\n opacity !== undefined ||\n color !== undefined ||\n strokeWidth !== undefined ||\n blendMode !== undefined ||\n style !== undefined ||\n strokeJoin !== undefined ||\n strokeCap !== undefined ||\n strokeMiter !== undefined ||\n antiAlias !== undefined ||\n dither !== undefined ||\n paintRef !== undefined\n ) {\n return paint;\n }\n return null;\n};\n\nconst processCTM = ({\n clip,\n invertClip,\n transform,\n origin,\n matrix,\n layer,\n}: CTMProps) => {\n const ctm: CTMProps = {};\n if (clip) {\n ctm.clip = clip;\n }\n if (invertClip) {\n ctm.invertClip = invertClip;\n }\n if (transform) {\n ctm.transform = transform;\n }\n if (origin) {\n ctm.origin = origin;\n }\n if (matrix) {\n ctm.matrix = matrix;\n }\n if (layer) {\n ctm.layer = layer;\n }\n if (\n clip !== undefined ||\n invertClip !== undefined ||\n transform !== undefined ||\n origin !== undefined ||\n matrix !== undefined ||\n layer !== undefined\n ) {\n return ctm;\n }\n return null;\n};\n\nconst pushColorFilters = (\n recorder: BaseRecorder,\n colorFilters: Node<any>[]\n) => {\n colorFilters.forEach((colorFilter) => {\n if (colorFilter.children.length > 0) {\n pushColorFilters(recorder, colorFilter.children);\n }\n recorder.pushColorFilter(colorFilter.type, colorFilter.props);\n const needsComposition =\n colorFilter.type !== NodeType.LerpColorFilter &&\n colorFilter.children.length > 0;\n if (needsComposition) {\n recorder.composeColorFilter();\n }\n });\n};\n\nconst pushPathEffects = (recorder: BaseRecorder, pathEffects: Node<any>[]) => {\n pathEffects.forEach((pathEffect) => {\n if (pathEffect.children.length > 0) {\n pushPathEffects(recorder, pathEffect.children);\n }\n recorder.pushPathEffect(pathEffect.type, pathEffect.props);\n const needsComposition =\n pathEffect.type !== NodeType.SumPathEffect &&\n pathEffect.children.length > 0;\n if (needsComposition) {\n recorder.composePathEffect();\n }\n });\n};\n\nconst pushImageFilters = (\n recorder: BaseRecorder,\n imageFilters: Node<any>[]\n) => {\n imageFilters.forEach((imageFilter) => {\n if (imageFilter.children.length > 0) {\n pushImageFilters(recorder, imageFilter.children);\n }\n if (isImageFilter(imageFilter.type)) {\n recorder.pushImageFilter(imageFilter.type, imageFilter.props);\n } else if (isShader(imageFilter.type)) {\n recorder.pushShader(imageFilter.type, imageFilter.props, 0);\n }\n const needsComposition =\n imageFilter.type !== NodeType.BlendImageFilter &&\n imageFilter.children.length > 0;\n if (needsComposition) {\n recorder.composeImageFilter();\n }\n });\n};\n\nconst pushShaders = (recorder: BaseRecorder, shaders: Node<any>[]) => {\n shaders.forEach((shader) => {\n if (shader.children.length > 0) {\n pushShaders(recorder, shader.children);\n }\n recorder.pushShader(shader.type, shader.props, shader.children.length);\n });\n};\n\nconst pushMaskFilters = (recorder: BaseRecorder, maskFilters: Node<any>[]) => {\n if (maskFilters.length > 0) {\n recorder.pushBlurMaskFilter(maskFilters[maskFilters.length - 1].props);\n }\n};\n\nconst pushPaints = (recorder: BaseRecorder, paints: Node<any>[]) => {\n paints.forEach((paint) => {\n recorder.savePaint(paint.props, true);\n const { colorFilters, maskFilters, shaders, imageFilters, pathEffects } =\n sortNodeChildren(paint);\n pushColorFilters(recorder, colorFilters);\n pushImageFilters(recorder, imageFilters);\n pushMaskFilters(recorder, maskFilters);\n pushShaders(recorder, shaders);\n pushPathEffects(recorder, pathEffects);\n recorder.restorePaintDeclaration();\n });\n};\n\nconst visitNode = (recorder: BaseRecorder, node: Node<any>) => {\n if (node.type === NodeType.Group) {\n recorder.saveGroup();\n }\n const { props } = node;\n const {\n colorFilters,\n maskFilters,\n drawings,\n shaders,\n imageFilters,\n pathEffects,\n paints,\n } = sortNodeChildren(node);\n const paint = processPaint(props);\n const shouldPushPaint =\n paint ||\n colorFilters.length > 0 ||\n maskFilters.length > 0 ||\n imageFilters.length > 0 ||\n pathEffects.length > 0 ||\n shaders.length > 0;\n if (shouldPushPaint) {\n recorder.savePaint(paint ?? {}, false);\n pushColorFilters(recorder, colorFilters);\n pushImageFilters(recorder, imageFilters);\n pushMaskFilters(recorder, maskFilters);\n pushShaders(recorder, shaders);\n pushPathEffects(recorder, pathEffects);\n // For mixed nodes like BackdropFilters we don't materialize the paint\n if (node.type === NodeType.BackdropFilter) {\n recorder.saveBackdropFilter();\n } else {\n recorder.materializePaint();\n }\n }\n pushPaints(recorder, paints);\n if (node.type === NodeType.Layer) {\n recorder.saveLayer();\n }\n const ctm = processCTM(props);\n const shouldRestore = !!ctm || node.type === NodeType.Layer;\n if (ctm) {\n recorder.saveCTM(ctm);\n }\n switch (node.type) {\n case NodeType.Box:\n const shadows = node.children\n .filter((n) => n.type === NodeType.BoxShadow)\n // eslint-disable-next-line @typescript-eslint/no-shadow\n .map(({ props }) => ({ props }) as { props: BoxShadowProps });\n recorder.drawBox(props, shadows);\n break;\n case NodeType.Fill:\n recorder.drawPaint();\n break;\n case NodeType.Image:\n recorder.drawImage(props);\n break;\n case NodeType.Circle:\n recorder.drawCircle(props);\n break;\n case NodeType.Points:\n recorder.drawPoints(props);\n break;\n case NodeType.Path:\n recorder.drawPath(props);\n break;\n case NodeType.Rect:\n recorder.drawRect(props);\n break;\n case NodeType.RRect:\n recorder.drawRRect(props);\n break;\n case NodeType.Oval:\n recorder.drawOval(props);\n break;\n case NodeType.Line:\n recorder.drawLine(props);\n break;\n case NodeType.Patch:\n recorder.drawPatch(props);\n break;\n case NodeType.Vertices:\n recorder.drawVertices(props);\n break;\n case NodeType.DiffRect:\n recorder.drawDiffRect(props);\n break;\n case NodeType.Text:\n recorder.drawText(props);\n break;\n case NodeType.TextPath:\n recorder.drawTextPath(props);\n break;\n case NodeType.TextBlob:\n recorder.drawTextBlob(props);\n break;\n case NodeType.Glyphs:\n recorder.drawGlyphs(props);\n break;\n case NodeType.Picture:\n recorder.drawPicture(props);\n break;\n case NodeType.ImageSVG:\n recorder.drawImageSVG(props);\n break;\n case NodeType.Paragraph:\n recorder.drawParagraph(props);\n break;\n case NodeType.Skottie:\n recorder.drawSkottie(props);\n break;\n case NodeType.Atlas:\n recorder.drawAtlas(props);\n break;\n }\n drawings.forEach((drawing) => {\n visitNode(recorder, drawing);\n });\n if (shouldPushPaint) {\n recorder.restorePaint();\n }\n if (shouldRestore) {\n recorder.restoreCTM();\n }\n if (node.type === NodeType.Group) {\n recorder.restoreGroup();\n }\n};\n\nexport const visit = (recorder: BaseRecorder, root: Node[]) => {\n root.forEach((node) => {\n visitNode(recorder, node);\n });\n};\n"],"mappings":";;;;;;AAMA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,KAAA,GAAAD,OAAA;AATA;;AAWO,MAAME,YAAY,GAAGA,CAAC;EAC3BC,OAAO;EACPC,KAAK;EACLC,WAAW;EACXC,SAAS;EACTC,KAAK;EACLC,UAAU;EACVC,SAAS;EACTC,WAAW;EACXC,SAAS;EACTC,MAAM;EACNC,KAAK,EAAEC;AACS,CAAC,KAAK;EACtB,MAAMD,KAAuB,GAAG,CAAC,CAAC;EAClC,IAAIV,OAAO,KAAKY,SAAS,EAAE;IACzBF,KAAK,CAACV,OAAO,GAAGA,OAAO;EACzB;EACA,IAAIC,KAAK,KAAKW,SAAS,EAAE;IACvBF,KAAK,CAACT,KAAK,GAAGA,KAAK;EACrB;EACA,IAAIC,WAAW,KAAKU,SAAS,EAAE;IAC7BF,KAAK,CAACR,WAAW,GAAGA,WAAW;EACjC;EACA,IAAIC,SAAS,KAAKS,SAAS,EAAE;IAC3BF,KAAK,CAACP,SAAS,GAAGA,SAAS;EAC7B;EACA,IAAIC,KAAK,KAAKQ,SAAS,EAAE;IACvBF,KAAK,CAACN,KAAK,GAAGA,KAAK;EACrB;EACA,IAAIC,UAAU,KAAKO,SAAS,EAAE;IAC5BF,KAAK,CAACL,UAAU,GAAGA,UAAU;EAC/B;EACA,IAAIC,SAAS,KAAKM,SAAS,EAAE;IAC3BF,KAAK,CAACJ,SAAS,GAAGA,SAAS;EAC7B;EACA,IAAIC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AAC;EAC9B,CAAC,CAAC;EACF,IAAIzD,eAAe,EAAE;IACnB5C,QAAQ,CAACsG,YAAY,CAAC,CAAC;EACzB;EACA,IAAIpD,aAAa,EAAE;IACjBlD,QAAQ,CAACuG,UAAU,CAAC,CAAC;EACvB;EACA,IAAI/D,IAAI,CAACjC,IAAI,KAAKG,eAAQ,CAAC+B,KAAK,EAAE;IAChCzC,QAAQ,CAACwG,YAAY,CAAC,CAAC;EACzB;AACF,CAAC;AAEM,MAAMC,KAAK,GAAGA,CAACzG,QAAsB,EAAE0G,IAAY,KAAK;EAC7DA,IAAI,CAACxG,OAAO,CAAEsC,IAAI,IAAK;IACrBD,SAAS,CAACvC,QAAQ,EAAEwC,IAAI,CAAC;EAC3B,CAAC,CAAC;AACJ,CAAC;AAAClD,OAAA,CAAAmH,KAAA,GAAAA,KAAA","ignoreList":[]}
1
+ {"version":3,"names":["_types","require","_Node","processPaint","opacity","color","strokeWidth","blendMode","style","strokeJoin","strokeCap","strokeMiter","antiAlias","dither","paint","paintRef","undefined","exports","processCTM","clip","invertClip","transform","origin","matrix","layer","ctm","pushColorFilters","recorder","colorFilters","forEach","colorFilter","children","length","pushColorFilter","type","props","needsComposition","NodeType","LerpColorFilter","composeColorFilter","pushPathEffects","pathEffects","pathEffect","pushPathEffect","SumPathEffect","composePathEffect","pushImageFilters","imageFilters","imageFilter","isImageFilter","pushImageFilter","isShader","pushShader","BlendImageFilter","composeImageFilter","pushShaders","shaders","shader","pushMaskFilters","maskFilters","pushBlurMaskFilter","pushPaints","paints","savePaint","sortNodeChildren","restorePaintDeclaration","getStackingContextProps","zIndex","visitNode","node","stackingContextProps","saveGroup","drawings","shouldPushPaint","BackdropFilter","saveBackdropFilter","materializePaint","Layer","saveLayer","shouldRestore","saveCTM","Box","shadows","filter","n","BoxShadow","map","drawBox","Fill","drawPaint","Image","drawImage","Circle","drawCircle","Points","drawPoints","Path","drawPath","Rect","drawRect","RRect","drawRRect","Oval","drawOval","Line","drawLine","Patch","drawPatch","Vertices","drawVertices","DiffRect","drawDiffRect","Text","drawText","TextPath","drawTextPath","TextBlob","drawTextBlob","Glyphs","drawGlyphs","Picture","drawPicture","ImageSVG","drawImageSVG","Paragraph","drawParagraph","Skottie","drawSkottie","Atlas","drawAtlas","drawing","restorePaint","restoreCTM","restoreGroup","visit","root"],"sources":["Visitor.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type {\n CTMProps,\n DrawingNodeProps,\n BoxShadowProps,\n} from \"../../dom/types\";\nimport { NodeType } from \"../../dom/types\";\nimport type { BaseRecorder } from \"../../skia/types/Recorder\";\nimport type { Node } from \"../Node\";\nimport { isImageFilter, isShader, sortNodeChildren } from \"../Node\";\nimport type { AnimatedProps } from \"../../renderer\";\n\nexport const processPaint = ({\n opacity,\n color,\n strokeWidth,\n blendMode,\n style,\n strokeJoin,\n strokeCap,\n strokeMiter,\n antiAlias,\n dither,\n paint: paintRef,\n}: DrawingNodeProps) => {\n const paint: DrawingNodeProps = {};\n if (opacity !== undefined) {\n paint.opacity = opacity;\n }\n if (color !== undefined) {\n paint.color = color;\n }\n if (strokeWidth !== undefined) {\n paint.strokeWidth = strokeWidth;\n }\n if (blendMode !== undefined) {\n paint.blendMode = blendMode;\n }\n if (style !== undefined) {\n paint.style = style;\n }\n if (strokeJoin !== undefined) {\n paint.strokeJoin = strokeJoin;\n }\n if (strokeCap !== undefined) {\n paint.strokeCap = strokeCap;\n }\n if (strokeMiter !== undefined) {\n paint.strokeMiter = strokeMiter;\n }\n if (antiAlias !== undefined) {\n paint.antiAlias = antiAlias;\n }\n if (dither !== undefined) {\n paint.dither = dither;\n }\n\n if (paintRef !== undefined) {\n paint.paint = paintRef;\n }\n\n if (\n opacity !== undefined ||\n color !== undefined ||\n strokeWidth !== undefined ||\n blendMode !== undefined ||\n style !== undefined ||\n strokeJoin !== undefined ||\n strokeCap !== undefined ||\n strokeMiter !== undefined ||\n antiAlias !== undefined ||\n dither !== undefined ||\n paintRef !== undefined\n ) {\n return paint;\n }\n return null;\n};\n\nconst processCTM = ({\n clip,\n invertClip,\n transform,\n origin,\n matrix,\n layer,\n}: CTMProps) => {\n const ctm: CTMProps = {};\n if (clip) {\n ctm.clip = clip;\n }\n if (invertClip) {\n ctm.invertClip = invertClip;\n }\n if (transform) {\n ctm.transform = transform;\n }\n if (origin) {\n ctm.origin = origin;\n }\n if (matrix) {\n ctm.matrix = matrix;\n }\n if (layer) {\n ctm.layer = layer;\n }\n if (\n clip !== undefined ||\n invertClip !== undefined ||\n transform !== undefined ||\n origin !== undefined ||\n matrix !== undefined ||\n layer !== undefined\n ) {\n return ctm;\n }\n return null;\n};\n\nconst pushColorFilters = (\n recorder: BaseRecorder,\n colorFilters: Node<any>[]\n) => {\n colorFilters.forEach((colorFilter) => {\n if (colorFilter.children.length > 0) {\n pushColorFilters(recorder, colorFilter.children);\n }\n recorder.pushColorFilter(colorFilter.type, colorFilter.props);\n const needsComposition =\n colorFilter.type !== NodeType.LerpColorFilter &&\n colorFilter.children.length > 0;\n if (needsComposition) {\n recorder.composeColorFilter();\n }\n });\n};\n\nconst pushPathEffects = (recorder: BaseRecorder, pathEffects: Node<any>[]) => {\n pathEffects.forEach((pathEffect) => {\n if (pathEffect.children.length > 0) {\n pushPathEffects(recorder, pathEffect.children);\n }\n recorder.pushPathEffect(pathEffect.type, pathEffect.props);\n const needsComposition =\n pathEffect.type !== NodeType.SumPathEffect &&\n pathEffect.children.length > 0;\n if (needsComposition) {\n recorder.composePathEffect();\n }\n });\n};\n\nconst pushImageFilters = (\n recorder: BaseRecorder,\n imageFilters: Node<any>[]\n) => {\n imageFilters.forEach((imageFilter) => {\n if (imageFilter.children.length > 0) {\n pushImageFilters(recorder, imageFilter.children);\n }\n if (isImageFilter(imageFilter.type)) {\n recorder.pushImageFilter(imageFilter.type, imageFilter.props);\n } else if (isShader(imageFilter.type)) {\n recorder.pushShader(imageFilter.type, imageFilter.props, 0);\n }\n const needsComposition =\n imageFilter.type !== NodeType.BlendImageFilter &&\n imageFilter.children.length > 0;\n if (needsComposition) {\n recorder.composeImageFilter();\n }\n });\n};\n\nconst pushShaders = (recorder: BaseRecorder, shaders: Node<any>[]) => {\n shaders.forEach((shader) => {\n if (shader.children.length > 0) {\n pushShaders(recorder, shader.children);\n }\n recorder.pushShader(shader.type, shader.props, shader.children.length);\n });\n};\n\nconst pushMaskFilters = (recorder: BaseRecorder, maskFilters: Node<any>[]) => {\n if (maskFilters.length > 0) {\n recorder.pushBlurMaskFilter(maskFilters[maskFilters.length - 1].props);\n }\n};\n\nconst pushPaints = (recorder: BaseRecorder, paints: Node<any>[]) => {\n paints.forEach((paint) => {\n recorder.savePaint(paint.props, true);\n const { colorFilters, maskFilters, shaders, imageFilters, pathEffects } =\n sortNodeChildren(paint);\n pushColorFilters(recorder, colorFilters);\n pushImageFilters(recorder, imageFilters);\n pushMaskFilters(recorder, maskFilters);\n pushShaders(recorder, shaders);\n pushPathEffects(recorder, pathEffects);\n recorder.restorePaintDeclaration();\n });\n};\n\ntype StackingContextProps = Pick<DrawingNodeProps, \"zIndex\">;\n\nconst getStackingContextProps = (\n props: AnimatedProps<DrawingNodeProps>\n): AnimatedProps<StackingContextProps> | undefined => {\n const { zIndex } = props;\n if (zIndex === undefined) {\n return undefined;\n }\n return { zIndex };\n};\n\nconst visitNode = (recorder: BaseRecorder, node: Node<any>) => {\n const { props } = node;\n const stackingContextProps = getStackingContextProps(\n props as AnimatedProps<DrawingNodeProps>\n );\n recorder.saveGroup(stackingContextProps);\n const {\n colorFilters,\n maskFilters,\n drawings,\n shaders,\n imageFilters,\n pathEffects,\n paints,\n } = sortNodeChildren(node);\n const paint = processPaint(props);\n const shouldPushPaint =\n paint ||\n colorFilters.length > 0 ||\n maskFilters.length > 0 ||\n imageFilters.length > 0 ||\n pathEffects.length > 0 ||\n shaders.length > 0;\n if (shouldPushPaint) {\n recorder.savePaint(paint ?? {}, false);\n pushColorFilters(recorder, colorFilters);\n pushImageFilters(recorder, imageFilters);\n pushMaskFilters(recorder, maskFilters);\n pushShaders(recorder, shaders);\n pushPathEffects(recorder, pathEffects);\n // For mixed nodes like BackdropFilters we don't materialize the paint\n if (node.type === NodeType.BackdropFilter) {\n recorder.saveBackdropFilter();\n } else {\n recorder.materializePaint();\n }\n }\n pushPaints(recorder, paints);\n if (node.type === NodeType.Layer) {\n recorder.saveLayer();\n }\n const ctm = processCTM(props);\n const shouldRestore = !!ctm || node.type === NodeType.Layer;\n if (ctm) {\n recorder.saveCTM(ctm);\n }\n switch (node.type) {\n case NodeType.Box:\n const shadows = node.children\n .filter((n) => n.type === NodeType.BoxShadow)\n // eslint-disable-next-line @typescript-eslint/no-shadow\n .map(({ props }) => ({ props }) as { props: BoxShadowProps });\n recorder.drawBox(props, shadows);\n break;\n case NodeType.Fill:\n recorder.drawPaint();\n break;\n case NodeType.Image:\n recorder.drawImage(props);\n break;\n case NodeType.Circle:\n recorder.drawCircle(props);\n break;\n case NodeType.Points:\n recorder.drawPoints(props);\n break;\n case NodeType.Path:\n recorder.drawPath(props);\n break;\n case NodeType.Rect:\n recorder.drawRect(props);\n break;\n case NodeType.RRect:\n recorder.drawRRect(props);\n break;\n case NodeType.Oval:\n recorder.drawOval(props);\n break;\n case NodeType.Line:\n recorder.drawLine(props);\n break;\n case NodeType.Patch:\n recorder.drawPatch(props);\n break;\n case NodeType.Vertices:\n recorder.drawVertices(props);\n break;\n case NodeType.DiffRect:\n recorder.drawDiffRect(props);\n break;\n case NodeType.Text:\n recorder.drawText(props);\n break;\n case NodeType.TextPath:\n recorder.drawTextPath(props);\n break;\n case NodeType.TextBlob:\n recorder.drawTextBlob(props);\n break;\n case NodeType.Glyphs:\n recorder.drawGlyphs(props);\n break;\n case NodeType.Picture:\n recorder.drawPicture(props);\n break;\n case NodeType.ImageSVG:\n recorder.drawImageSVG(props);\n break;\n case NodeType.Paragraph:\n recorder.drawParagraph(props);\n break;\n case NodeType.Skottie:\n recorder.drawSkottie(props);\n break;\n case NodeType.Atlas:\n recorder.drawAtlas(props);\n break;\n }\n drawings.forEach((drawing) => {\n visitNode(recorder, drawing);\n });\n if (shouldPushPaint) {\n recorder.restorePaint();\n }\n if (shouldRestore) {\n recorder.restoreCTM();\n }\n recorder.restoreGroup();\n};\n\nexport const visit = (recorder: BaseRecorder, root: Node[]) => {\n root.forEach((node) => {\n visitNode(recorder, node);\n });\n};\n"],"mappings":";;;;;;AAMA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,KAAA,GAAAD,OAAA;AATA;;AAYO,MAAME,YAAY,GAAGA,CAAC;EAC3BC,OAAO;EACPC,KAAK;EACLC,WAAW;EACXC,SAAS;EACTC,KAAK;EACLC,UAAU;EACVC,SAAS;EACTC,WAAW;EACXC,SAAS;EACTC,MAAM;EACNC,KAAK,EAAEC;AACS,CAAC,KAAK;EACtB,MAAMD,KAAuB,GAAG,CAAC,CAAC;EAClC,IAAIV,OAAO,KAAKY,SAAS,EAAE;IACzBF,KAAK,CAACV,OAAO,GAAGA,OAAO;EACzB;EACA,IAAIC,KAAK,KAAKW,SAAS,EAAE;IACvBF,KAAK,CAACT,KAAK,GAAGA,KAAK;EACrB;EACA,IAAIC,WAAW,KAAKU,SAAS,EAAE;IAC7BF,KAAK,CAACR,WAAW,GAAGA,WAAW;EACjC;EACA,IAAIC,SAAS,KAAKS,SAAS,EAAE;IAC3BF,KAAK,CAACP,SAAS,GAAGA,SAAS;EAC7B;EACA,IAAIC,KAAK,KAAKQ,SAAS,EAAE;IACvBF,KAAK,CAACN,KAAK,GAAGA,KAAK;EACrB;EACA,IAAIC,UAAU,KAAKO,SAAS,EAAE;IAC5BF,KAAK,CAACL,UAAU,GAAGA,UAAU;EAC/B;EACA,IAAIC,SAAS,KAAKM,SAAS,EAAE;IAC3BF,KAAK,CAACJ,SAAS,GAAGA,SAAS;EAC7B;EACA,IAAIC,WAAW,KAAKK,SAAS,EAAE;IAC7BF,KAAK,CAACH,WAAW,GAAGA,WAAW;EACjC;EACA,IAAIC,SAAS,KA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J;EACAqC,QAAQ,CAAC3C,OAAO,CAAEqG,OAAO,IAAK;IAC5B9D,SAAS,CAACzC,QAAQ,EAAEuG,OAAO,CAAC;EAC9B,CAAC,CAAC;EACF,IAAIzD,eAAe,EAAE;IACnB9C,QAAQ,CAACwG,YAAY,CAAC,CAAC;EACzB;EACA,IAAIpD,aAAa,EAAE;IACjBpD,QAAQ,CAACyG,UAAU,CAAC,CAAC;EACvB;EACAzG,QAAQ,CAAC0G,YAAY,CAAC,CAAC;AACzB,CAAC;AAEM,MAAMC,KAAK,GAAGA,CAAC3G,QAAsB,EAAE4G,IAAY,KAAK;EAC7DA,IAAI,CAAC1G,OAAO,CAAEwC,IAAI,IAAK;IACrBD,SAAS,CAACzC,QAAQ,EAAE0C,IAAI,CAAC;EAC3B,CAAC,CAAC;AACJ,CAAC;AAACpD,OAAA,CAAAqH,KAAA,GAAAA,KAAA","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 { mode, debug = false, opaque = false, coldStart = false, ...viewProps } = 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,SAAA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AAQ,OAAA,CAAA4D,aAAA,CAACjC,qBAAqB,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
+ {"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,eAAA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4D,aAAA,CAACjC,qBAAqB,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":[]}
@@ -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(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":[]}
@@ -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;
@@ -1,45 +1,3 @@
1
- // export enum CommandType {
2
- // // Context
3
- // Group = "Group",
4
- // SavePaint = "SavePaint",
5
- // RestorePaint = "RestorePaint",
6
- // SaveCTM = "SaveCTM",
7
- // RestoreCTM = "RestoreCTM",
8
- // PushColorFilter = "PushColorFilter",
9
- // PushBlurMaskFilter = "PushBlurMaskFilter",
10
- // PushImageFilter = "PushImageFilter",
11
- // PushPathEffect = "PushPathEffect",
12
- // PushShader = "PushShader",
13
- // ComposeColorFilter = "ComposeColorFilter",
14
- // ComposeImageFilter = "ComposeImageFilter",
15
- // ComposePathEffect = "ComposePathEffect",
16
- // MaterializePaint = "MaterializePaint",
17
- // SaveBackdropFilter = "SaveBackdropFilter",
18
- // SaveLayer = "SaveLayer",
19
- // RestorePaintDeclaration = "RestorePaintDeclaration",
20
- // // Drawing
21
- // DrawBox = "DrawBox",
22
- // DrawImage = "DrawImage",
23
- // DrawCircle = "DrawCircle",
24
- // DrawPaint = "DrawPaint",
25
- // DrawPoints = "DrawPoints",
26
- // DrawPath = "DrawPath",
27
- // DrawRect = "DrawRect",
28
- // DrawRRect = "DrawRRect",
29
- // DrawOval = "DrawOval",
30
- // DrawLine = "DrawLine",
31
- // DrawPatch = "DrawPatch",
32
- // DrawVertices = "DrawVertices",
33
- // DrawDiffRect = "DrawDiffRect",
34
- // DrawText = "DrawText",
35
- // DrawTextPath = "DrawTextPath",
36
- // DrawTextBlob = "DrawTextBlob",
37
- // DrawGlyphs = "DrawGlyphs",
38
- // DrawPicture = "DrawPicture",
39
- // DrawImageSVG = "DrawImageSVG",
40
- // DrawParagraph = "DrawParagraph",
41
- // DrawAtlas = "DrawAtlas",
42
- // }
43
1
  export let CommandType = /*#__PURE__*/function (CommandType) {
44
2
  // Context
45
3
  CommandType[CommandType["Group"] = 0] = "Group";
@@ -1 +1 @@
1
- {"version":3,"names":["CommandType","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;A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OAAO,MAAMC,kBAAkB,GAAIC,OAAY,IAAK;EAClD,SAAS;;EACT,MAAMC,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;AAED,OAAO,MAAMK,SAAS,GAAGA,CACvBN,OAAgB,EAChBO,IAAO,KACmB;EAC1B,SAAS;;EACT,OAAOP,OAAO,CAACO,IAAI,KAAKA,IAAI;AAC9B,CAAC;AAMD,OAAO,MAAMC,OAAO,GAAIR,OAAgB,IAA8B;EACpE,SAAS;;EACT,OAAOA,OAAO,CAACO,IAAI,KAAKT,WAAW,CAACW,KAAK;AAC3C,CAAC;AAgCD,OAAO,MAAMC,aAAa,GAAGA,CAC3BV,OAAgB,EAChBO,IAAO,KACuB;EAC9B,SAAS;;EACT,OAAOP,OAAO,CAACO,IAAI,KAAKA,IAAI;AAC9B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["CommandType","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":"AA0BA,WAAYA,WAAW,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,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAA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Tree: (commands: Command[], indent?: number) => string;
@@ -0,0 +1,79 @@
1
+ import { CommandType, isGroup } from "./Core";
2
+ const CommandTypeNames = {
3
+ [CommandType.Group]: "Group",
4
+ [CommandType.SavePaint]: "SavePaint",
5
+ [CommandType.RestorePaint]: "RestorePaint",
6
+ [CommandType.SaveCTM]: "SaveCTM",
7
+ [CommandType.RestoreCTM]: "RestoreCTM",
8
+ [CommandType.PushColorFilter]: "PushColorFilter",
9
+ [CommandType.PushBlurMaskFilter]: "PushBlurMaskFilter",
10
+ [CommandType.PushImageFilter]: "PushImageFilter",
11
+ [CommandType.PushPathEffect]: "PushPathEffect",
12
+ [CommandType.PushShader]: "PushShader",
13
+ [CommandType.ComposeColorFilter]: "ComposeColorFilter",
14
+ [CommandType.ComposeImageFilter]: "ComposeImageFilter",
15
+ [CommandType.ComposePathEffect]: "ComposePathEffect",
16
+ [CommandType.MaterializePaint]: "MaterializePaint",
17
+ [CommandType.SaveBackdropFilter]: "SaveBackdropFilter",
18
+ [CommandType.SaveLayer]: "SaveLayer",
19
+ [CommandType.RestorePaintDeclaration]: "RestorePaintDeclaration",
20
+ [CommandType.DrawBox]: "DrawBox",
21
+ [CommandType.DrawImage]: "DrawImage",
22
+ [CommandType.DrawCircle]: "DrawCircle",
23
+ [CommandType.DrawPaint]: "DrawPaint",
24
+ [CommandType.DrawPoints]: "DrawPoints",
25
+ [CommandType.DrawPath]: "DrawPath",
26
+ [CommandType.DrawRect]: "DrawRect",
27
+ [CommandType.DrawRRect]: "DrawRRect",
28
+ [CommandType.DrawOval]: "DrawOval",
29
+ [CommandType.DrawLine]: "DrawLine",
30
+ [CommandType.DrawPatch]: "DrawPatch",
31
+ [CommandType.DrawVertices]: "DrawVertices",
32
+ [CommandType.DrawDiffRect]: "DrawDiffRect",
33
+ [CommandType.DrawText]: "DrawText",
34
+ [CommandType.DrawTextPath]: "DrawTextPath",
35
+ [CommandType.DrawTextBlob]: "DrawTextBlob",
36
+ [CommandType.DrawGlyphs]: "DrawGlyphs",
37
+ [CommandType.DrawPicture]: "DrawPicture",
38
+ [CommandType.DrawImageSVG]: "DrawImageSVG",
39
+ [CommandType.DrawParagraph]: "DrawParagraph",
40
+ [CommandType.DrawAtlas]: "DrawAtlas",
41
+ [CommandType.DrawSkottie]: "DrawSkottie"
42
+ };
43
+ const serializeProps = props => {
44
+ try {
45
+ return JSON.stringify(props, (key, value) => {
46
+ if (key === "children") {
47
+ return undefined;
48
+ }
49
+ if (typeof value === "bigint") {
50
+ return value.toString();
51
+ }
52
+ return value;
53
+ });
54
+ } catch (e) {
55
+ return `"Error serializing props: ${e}"`;
56
+ }
57
+ };
58
+ export const debugTree = (commands, indent = 0) => {
59
+ let result = "[\n";
60
+ const prefix = " ".repeat(indent + 2);
61
+ commands.forEach((cmd, index) => {
62
+ const type = CommandTypeNames[cmd.type] || "Unknown";
63
+ result += `${prefix}{ "type": "${type}"`;
64
+ if ("props" in cmd) {
65
+ result += `, "props": ${serializeProps(cmd.props)}`;
66
+ }
67
+ if (isGroup(cmd)) {
68
+ result += `, "children": ${debugTree(cmd.children, indent + 2)}`;
69
+ }
70
+ result += " }";
71
+ if (index < commands.length - 1) {
72
+ result += ",";
73
+ }
74
+ result += "\n";
75
+ });
76
+ result += " ".repeat(indent) + "]";
77
+ return result;
78
+ };
79
+ //# sourceMappingURL=Debug.js.map
@@ -0,0 +1 @@
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,iB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AG,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":[]}
@@ -1,3 +1,3 @@
1
1
  import type { Command } from "./Core";
2
2
  import type { DrawingContext } from "./DrawingContext";
3
- export declare const replay: (ctx: DrawingContext, commands: Command[]) => void;
3
+ export declare function replay(ctx: DrawingContext, commands: Command[]): void;
@@ -7,11 +7,55 @@ import { setPaintProperties } from "./commands/Paint";
7
7
  import { composePathEffects, isPushPathEffect, pushPathEffect } from "./commands/PathEffects";
8
8
  import { isPushShader, pushShader } from "./commands/Shaders";
9
9
  import { CommandType, isCommand, isDrawCommand, isGroup, materializeCommand } from "./Core";
10
- function play(ctx, _command) {
10
+ const getZIndex = command => {
11
11
  "worklet";
12
12
 
13
+ var _materialized$props;
14
+ const materialized = materializeCommand(command);
15
+ const {
16
+ zIndex
17
+ } = (_materialized$props = materialized.props) !== null && _materialized$props !== void 0 ? _materialized$props : {};
18
+ if (typeof zIndex !== "number" || Number.isNaN(zIndex)) {
19
+ return 0;
20
+ }
21
+ return zIndex;
22
+ };
23
+ const flushPendingGroups = (ctx, pendingGroups) => {
24
+ "worklet";
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 play = (ctx, _command) => {
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
+ });
54
+ flushPendingGroups(ctx, pending);
55
+ };
56
+ "worklet";
13
57
  if (isGroup(_command)) {
14
- _command.children.forEach(child => play(ctx, child));
58
+ playGroup(ctx, _command);
15
59
  return;
16
60
  }
17
61
  const command = materializeCommand(_command);
@@ -126,12 +170,13 @@ function play(ctx, _command) {
126
170
  ctx.paints.pop();
127
171
  });
128
172
  }
129
- }
130
- export const replay = (ctx, commands) => {
173
+ };
174
+ export function replay(ctx, commands) {
131
175
  "worklet";
132
176
 
177
+ //console.log(debugTree(commands));
133
178
  commands.forEach(command => {
134
179
  play(ctx, command);
135
180
  });
136
- };
181
+ }
137
182
  //# sourceMappingURL=Player.js.map