@shopify/react-native-skia 1.9.0 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cpp/api/JsiSkCanvas.h +1 -1
- package/lib/commonjs/index.d.ts +1 -1
- package/lib/commonjs/index.js +8 -8
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.d.ts +9 -10
- package/lib/commonjs/renderer/Canvas.js +67 -59
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/CanvasOld.d.ts +11 -0
- package/lib/commonjs/renderer/CanvasOld.js +96 -0
- package/lib/commonjs/renderer/CanvasOld.js.map +1 -0
- package/lib/commonjs/sksg/Container.js +12 -8
- package/lib/commonjs/sksg/Container.js.map +1 -1
- package/lib/commonjs/sksg/HostConfig2.d.ts +19 -0
- package/lib/commonjs/sksg/HostConfig2.js +159 -0
- package/lib/commonjs/sksg/HostConfig2.js.map +1 -0
- package/lib/commonjs/sksg/Recorder/Core.d.ts +42 -37
- package/lib/commonjs/sksg/Recorder/Core.js +46 -38
- package/lib/commonjs/sksg/Recorder/Core.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Player.js +6 -2
- package/lib/commonjs/sksg/Recorder/Player.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Recorder.d.ts +4 -0
- package/lib/commonjs/sksg/Recorder/Recorder.js +14 -2
- package/lib/commonjs/sksg/Recorder/Recorder.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Visitor.js +6 -0
- package/lib/commonjs/sksg/Recorder/Visitor.js.map +1 -1
- package/lib/module/index.d.ts +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/renderer/Canvas.d.ts +9 -10
- package/lib/module/renderer/Canvas.js +65 -55
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/CanvasOld.d.ts +11 -0
- package/lib/module/renderer/CanvasOld.js +87 -0
- package/lib/module/renderer/CanvasOld.js.map +1 -0
- package/lib/module/sksg/Container.js +12 -8
- package/lib/module/sksg/Container.js.map +1 -1
- package/lib/module/sksg/HostConfig2.d.ts +19 -0
- package/lib/module/sksg/HostConfig2.js +152 -0
- package/lib/module/sksg/HostConfig2.js.map +1 -0
- package/lib/module/sksg/Recorder/Core.d.ts +42 -37
- package/lib/module/sksg/Recorder/Core.js +44 -37
- package/lib/module/sksg/Recorder/Core.js.map +1 -1
- package/lib/module/sksg/Recorder/Player.js +7 -3
- package/lib/module/sksg/Recorder/Player.js.map +1 -1
- package/lib/module/sksg/Recorder/Recorder.d.ts +4 -0
- package/lib/module/sksg/Recorder/Recorder.js +14 -2
- package/lib/module/sksg/Recorder/Recorder.js.map +1 -1
- package/lib/module/sksg/Recorder/Visitor.js +6 -0
- package/lib/module/sksg/Recorder/Visitor.js.map +1 -1
- package/lib/typescript/lib/commonjs/renderer/Canvas.d.ts +2 -2
- package/lib/typescript/lib/commonjs/renderer/CanvasOld.d.ts +3 -0
- package/lib/typescript/lib/commonjs/sksg/HostConfig2.d.ts +44 -0
- package/lib/typescript/lib/commonjs/sksg/Recorder/Core.d.ts +1 -0
- package/lib/typescript/lib/commonjs/sksg/Recorder/Recorder.d.ts +2 -0
- package/lib/typescript/lib/module/index.d.ts +1 -1
- package/lib/typescript/lib/module/renderer/Canvas.d.ts +1 -3
- package/lib/typescript/lib/module/renderer/CanvasOld.d.ts +3 -0
- package/lib/typescript/lib/module/sksg/HostConfig2.d.ts +43 -0
- package/lib/typescript/lib/module/sksg/Recorder/Core.d.ts +1 -0
- package/lib/typescript/lib/module/sksg/Recorder/Recorder.d.ts +2 -0
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/renderer/Canvas.d.ts +9 -10
- package/lib/typescript/src/renderer/CanvasOld.d.ts +11 -0
- package/lib/typescript/src/sksg/HostConfig2.d.ts +19 -0
- package/lib/typescript/src/sksg/Recorder/Core.d.ts +42 -37
- package/lib/typescript/src/sksg/Recorder/Recorder.d.ts +4 -0
- package/package.json +3 -2
- package/src/index.ts +1 -1
- package/src/renderer/Canvas.tsx +80 -78
- package/src/renderer/CanvasOld.tsx +126 -0
- package/src/sksg/Container.ts +7 -4
- package/src/sksg/HostConfig2.ts +247 -0
- package/src/sksg/Recorder/Core.ts +11 -0
- package/src/sksg/Recorder/Player.ts +7 -3
- package/src/sksg/Recorder/Recorder.ts +16 -2
- package/src/sksg/Recorder/Visitor.ts +6 -0
- package/lib/commonjs/renderer/Canvas2.d.ts +0 -10
- package/lib/commonjs/renderer/Canvas2.js +0 -104
- package/lib/commonjs/renderer/Canvas2.js.map +0 -1
- package/lib/commonjs/renderer/Canvas2.web.d.ts +0 -3
- package/lib/commonjs/renderer/Canvas2.web.js +0 -9
- package/lib/commonjs/renderer/Canvas2.web.js.map +0 -1
- package/lib/module/renderer/Canvas2.d.ts +0 -10
- package/lib/module/renderer/Canvas2.js +0 -97
- package/lib/module/renderer/Canvas2.js.map +0 -1
- package/lib/module/renderer/Canvas2.web.d.ts +0 -3
- package/lib/module/renderer/Canvas2.web.js +0 -3
- package/lib/module/renderer/Canvas2.web.js.map +0 -1
- package/lib/typescript/lib/commonjs/renderer/Canvas2.d.ts +0 -3
- package/lib/typescript/lib/commonjs/renderer/Canvas2.web.d.ts +0 -2
- package/lib/typescript/lib/module/renderer/Canvas2.d.ts +0 -1
- package/lib/typescript/lib/module/renderer/Canvas2.web.d.ts +0 -1
- package/lib/typescript/src/renderer/Canvas2.d.ts +0 -10
- package/lib/typescript/src/renderer/Canvas2.web.d.ts +0 -3
- package/src/renderer/Canvas2.tsx +0 -128
- package/src/renderer/Canvas2.web.tsx +0 -6
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["NodeType","isSharedValue","isColorFilter","isImageFilter","isPathEffect","isShader","CommandType","Recorder","constructor","_defineProperty","Set","getRecording","commands","paintPool","animationValues","processProps","props","animatedProps","hasAnimatedProps","key","prop","add","value","undefined","command","push","savePaint","type","SavePaint","restorePaint","RestorePaint","restorePaintDeclaration","RestorePaintDeclaration","materializePaint","MaterializePaint","pushPathEffect","pathEffectType","Error","PushPathEffect","pushImageFilter","imageFilterType","PushImageFilter","pushColorFilter","colorFilterType","PushColorFilter","pushShader","shaderType","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"],"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} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer\";\nimport { isSharedValue } from \"../utils\";\nimport { isColorFilter, isImageFilter, isPathEffect, isShader } from \"../Node\";\nimport type { SkPaint } 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 {\n commands: Command[] = [];\n animationValues: Set<SharedValue<unknown>> = new Set();\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 props[key] = prop.value;\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.commands.push(command);\n }\n\n savePaint(props: AnimatedProps<PaintProps>) {\n this.add({ type: CommandType.SavePaint, props });\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(shaderType: NodeType, props: AnimatedProps<unknown>) {\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 });\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"],"mappings":";;;AAEA,SAASA,QAAQ,QAAQ,iBAAiB;AA4B1C,SAASC,aAAa,QAAQ,UAAU;AACxC,SAASC,aAAa,EAAEC,aAAa,EAAEC,YAAY,EAAEC,QAAQ,QAAQ,SAAS;AAG9E,SAASC,WAAW,QAAQ,QAAQ;AAYpC,OAAO,MAAMC,QAAQ,CAAC;EAAAC,YAAA;IAAAC,eAAA,mBACE,EAAE;IAAAA,eAAA,0BACqB,IAAIC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B,WAAW,CAAC8F,YAAY;MAAEpF;IAAM,CAAC,CAAC;EACrD;EAEAqF,UAAUA,CAACrF,KAAiC,EAAE;IAC5C,IAAI,CAACK,GAAG,CAAC;MAAEM,IAAI,EAAErB,WAAW,CAACgG,UAAU;MAAEtF;IAAM,CAAC,CAAC;EACnD;EAEAuF,WAAWA,CAACvF,KAAkC,EAAE;IAC9C,IAAI,CAACK,GAAG,CAAC;MAAEM,IAAI,EAAErB,WAAW,CAACkG,WAAW;MAAExF;IAAM,CAAC,CAAC;EACpD;EAEAyF,YAAYA,CAACzF,KAAmC,EAAE;IAChD,IAAI,CAACK,GAAG,CAAC;MAAEM,IAAI,EAAErB,WAAW,CAACoG,YAAY;MAAE1F;IAAM,CAAC,CAAC;EACrD;EAEA2F,aAAaA,CAAC3F,KAAoC,EAAE;IAClD,IAAI,CAACK,GAAG,CAAC;MAAEM,IAAI,EAAErB,WAAW,CAACsG,aAAa;MAAE5F;IAAM,CAAC,CAAC;EACtD;EAEA6F,SAASA,CAAC7F,KAAgC,EAAE;IAC1C,IAAI,CAACK,GAAG,CAAC;MAAEM,IAAI,EAAErB,WAAW,CAACwG,SAAS;MAAE9F;IAAM,CAAC,CAAC;EAClD;AACF","ignoreList":[]}
|
1
|
+
{"version":3,"names":["NodeType","isSharedValue","isColorFilter","isImageFilter","isPathEffect","isShader","CommandType","Recorder","constructor","_defineProperty","Set","cursors","push","commands","getRecording","paintPool","animationValues","processProps","props","animatedProps","hasAnimatedProps","key","prop","add","undefined","command","length","saveGroup","children","type","Group","restoreGroup","pop","savePaint","SavePaint","restorePaint","RestorePaint","restorePaintDeclaration","RestorePaintDeclaration","materializePaint","MaterializePaint","pushPathEffect","pathEffectType","Error","PushPathEffect","pushImageFilter","imageFilterType","PushImageFilter","pushColorFilter","colorFilterType","PushColorFilter","pushShader","shaderType","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"],"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} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer\";\nimport { isSharedValue } from \"../utils\";\nimport { isColorFilter, isImageFilter, isPathEffect, isShader } from \"../Node\";\nimport type { SkPaint } 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 {\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>) {\n this.add({ type: CommandType.SavePaint, props });\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(shaderType: NodeType, props: AnimatedProps<unknown>) {\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 });\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"],"mappings":";;;AAEA,SAASA,QAAQ,QAAQ,iBAAiB;AA4B1C,SAASC,aAAa,QAAQ,UAAU;AACxC,SAASC,aAAa,EAAEC,aAAa,EAAEC,YAAY,EAAEC,QAAQ,QAAQ,SAAS;AAG9E,SAASC,WAAW,QAAQ,QAAQ;AAYpC,OAAO,MAAMC,QAAQ,CAAC;EAKpBC,WAAWA,CAAA,EAAG;IAAAC,eAAA,mBAJQ,EAAE;IAAAA,eAAA,kBACD,EAAE;IAAAA,eAAA,0BACoB,IAAIC,GAAG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|
158
158
|
});
|
159
159
|
};
|
160
160
|
const visitNode = (recorder, node) => {
|
161
|
+
if (node.type === NodeType.Group) {
|
162
|
+
recorder.saveGroup();
|
163
|
+
}
|
161
164
|
const {
|
162
165
|
props
|
163
166
|
} = node;
|
@@ -276,6 +279,9 @@ const visitNode = (recorder, node) => {
|
|
276
279
|
if (shouldRestore) {
|
277
280
|
recorder.restoreCTM();
|
278
281
|
}
|
282
|
+
if (node.type === NodeType.Group) {
|
283
|
+
recorder.restoreGroup();
|
284
|
+
}
|
279
285
|
};
|
280
286
|
export const visit = (recorder, root) => {
|
281
287
|
root.forEach(node => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["NodeType","isImageFilter","isShader","sortNodeChildren","processPaint","opacity","color","strokeWidth","blendMode","style","strokeJoin","strokeCap","strokeMiter","antiAlias","dither","paint","paintRef","undefined","processCTM","clip","invertClip","transform","origin","matrix","layer","ctm","pushColorFilters","recorder","colorFilters","forEach","colorFilter","children","length","pushColorFilter","type","props","needsComposition","LerpColorFilter","composeColorFilter","pushPathEffects","pathEffects","pathEffect","pushPathEffect","SumPathEffect","composePathEffect","pushImageFilters","imageFilters","imageFilter","pushImageFilter","pushShader","BlendImageFilter","composeImageFilter","pushShaders","shaders","shader","pushMaskFilters","maskFilters","pushBlurMaskFilter","pushPaints","paints","savePaint","restorePaintDeclaration","visitNode","node","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","Atlas","drawAtlas","drawing","restorePaint","restoreCTM","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 { Node } from \"../Node\";\nimport { isImageFilter, isShader, sortNodeChildren } from \"../Node\";\n\nimport type { Recorder } from \"./Recorder\";\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 = (recorder: Recorder, colorFilters: Node<any>[]) => {\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: Recorder, 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 = (recorder: Recorder, imageFilters: Node<any>[]) => {\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);\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: Recorder, 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);\n });\n};\n\nconst pushMaskFilters = (recorder: Recorder, maskFilters: Node<any>[]) => {\n if (maskFilters.length > 0) {\n recorder.pushBlurMaskFilter(maskFilters[maskFilters.length - 1].props);\n }\n};\n\nconst pushPaints = (recorder: Recorder, paints: Node<any>[]) => {\n paints.forEach((paint) => {\n recorder.savePaint(paint.props);\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: Recorder, node: Node<any>) => {\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 ?? {});\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(node.props);\n break;\n case NodeType.Circle:\n recorder.drawCircle(node.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.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};\n\nexport const visit = (recorder: Recorder, root: Node[]) => {\n root.forEach((node) => {\n visitNode(recorder, node);\n });\n};\n"],"mappings":"AAAA;;AAMA,SAASA,QAAQ,QAAQ,iBAAiB;AAE1C,SAASC,aAAa,EAAEC,QAAQ,EAAEC,gBAAgB,QAAQ,SAAS;AAInE,OAAO,MAAMC,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,KA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,CAAChF,KAAK,CAAC;MAC5B;IACF,KAAKnC,QAAQ,CAACoH,SAAS;MACrBzF,QAAQ,CAAC0F,aAAa,CAAClF,KAAK,CAAC;MAC7B;IACF,KAAKnC,QAAQ,CAACsH,KAAK;MACjB3F,QAAQ,CAAC4F,SAAS,CAACpF,KAAK,CAAC;MACzB;EACJ;EACA6B,QAAQ,CAACnC,OAAO,CAAE2F,OAAO,IAAK;IAC5B1D,SAAS,CAACnC,QAAQ,EAAE6F,OAAO,CAAC;EAC9B,CAAC,CAAC;EACF,IAAIvD,eAAe,EAAE;IACnBtC,QAAQ,CAAC8F,YAAY,CAAC,CAAC;EACzB;EACA,IAAIlD,aAAa,EAAE;IACjB5C,QAAQ,CAAC+F,UAAU,CAAC,CAAC;EACvB;AACF,CAAC;AAED,OAAO,MAAMC,KAAK,GAAGA,CAAChG,QAAkB,EAAEiG,IAAY,KAAK;EACzDA,IAAI,CAAC/F,OAAO,CAAEkC,IAAI,IAAK;IACrBD,SAAS,CAACnC,QAAQ,EAAEoC,IAAI,CAAC;EAC3B,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
1
|
+
{"version":3,"names":["NodeType","isImageFilter","isShader","sortNodeChildren","processPaint","opacity","color","strokeWidth","blendMode","style","strokeJoin","strokeCap","strokeMiter","antiAlias","dither","paint","paintRef","undefined","processCTM","clip","invertClip","transform","origin","matrix","layer","ctm","pushColorFilters","recorder","colorFilters","forEach","colorFilter","children","length","pushColorFilter","type","props","needsComposition","LerpColorFilter","composeColorFilter","pushPathEffects","pathEffects","pathEffect","pushPathEffect","SumPathEffect","composePathEffect","pushImageFilters","imageFilters","imageFilter","pushImageFilter","pushShader","BlendImageFilter","composeImageFilter","pushShaders","shaders","shader","pushMaskFilters","maskFilters","pushBlurMaskFilter","pushPaints","paints","savePaint","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","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 { Node } from \"../Node\";\nimport { isImageFilter, isShader, sortNodeChildren } from \"../Node\";\n\nimport type { Recorder } from \"./Recorder\";\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 = (recorder: Recorder, colorFilters: Node<any>[]) => {\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: Recorder, 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 = (recorder: Recorder, imageFilters: Node<any>[]) => {\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);\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: Recorder, 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);\n });\n};\n\nconst pushMaskFilters = (recorder: Recorder, maskFilters: Node<any>[]) => {\n if (maskFilters.length > 0) {\n recorder.pushBlurMaskFilter(maskFilters[maskFilters.length - 1].props);\n }\n};\n\nconst pushPaints = (recorder: Recorder, paints: Node<any>[]) => {\n paints.forEach((paint) => {\n recorder.savePaint(paint.props);\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: Recorder, 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 ?? {});\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(node.props);\n break;\n case NodeType.Circle:\n recorder.drawCircle(node.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.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: Recorder, root: Node[]) => {\n root.forEach((node) => {\n visitNode(recor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ACnC,QAAQ,EAAEoC,IAAI,CAAC;EAC3B,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
@@ -1,3 +1,3 @@
|
|
1
1
|
export const __esModule: boolean;
|
2
|
-
export const Canvas: any
|
3
|
-
|
2
|
+
export const Canvas: _react.ForwardRefExoticComponent<_react.RefAttributes<any>>;
|
3
|
+
import _react = require("react");
|
@@ -0,0 +1,44 @@
|
|
1
|
+
export const __esModule: boolean;
|
2
|
+
export namespace sksgHostConfig {
|
3
|
+
let supportsMutation: boolean;
|
4
|
+
let isPrimaryRenderer: boolean;
|
5
|
+
let supportsPersistence: boolean;
|
6
|
+
let supportsHydration: boolean;
|
7
|
+
let scheduleTimeout: typeof setTimeout;
|
8
|
+
let cancelTimeout: typeof clearTimeout;
|
9
|
+
let noTimeout: number;
|
10
|
+
function appendChildToContainer(container: any, child: any): void;
|
11
|
+
function appendChild(parent: any, child: any): void;
|
12
|
+
function getRootHostContext(_rootContainerInstance: any): null;
|
13
|
+
function getChildHostContext(_parentHostContext: any, _type: any, _rootContainerInstance: any): null;
|
14
|
+
function shouldSetTextContent(_type: any, _props: any): boolean;
|
15
|
+
function createTextInstance(_text: any, _rootContainerInstance: any, _hostContext: any, _internalInstanceHandle: any): never;
|
16
|
+
function createInstance(type: any, propsWithChildren: any, _container: any, _hostContext: any, _internalInstanceHandle: any): {
|
17
|
+
type: any;
|
18
|
+
props: any;
|
19
|
+
children: never[];
|
20
|
+
};
|
21
|
+
function appendInitialChild(parentInstance: any, child: any): void;
|
22
|
+
function finalizeInitialChildren(parentInstance: any, _type: any, _props: any, _rootContainerInstance: any, _hostContext: any): boolean;
|
23
|
+
function commitMount(): void;
|
24
|
+
function prepareForCommit(_containerInfo: any): null;
|
25
|
+
function resetAfterCommit(container: any): void;
|
26
|
+
function getPublicInstance(node: any): any;
|
27
|
+
function prepareUpdate(_instance: any, type: any, oldProps: any, newProps: any, rootContainerInstance: any, _hostContext: any): any;
|
28
|
+
function commitUpdate(instance: any, _updatePayload: any, type: any, prevProps: any, nextProps: any, _internalHandle: any): void;
|
29
|
+
function commitTextUpdate(_textInstance: any, _oldText: any, _newText: any): void;
|
30
|
+
function clearContainer(container: any): void;
|
31
|
+
function preparePortalMount(): void;
|
32
|
+
function removeChild(parent: any, child: any): void;
|
33
|
+
function removeChildFromContainer(container: any, child: any): void;
|
34
|
+
function insertInContainerBefore(container: any, child: any, before: any): void;
|
35
|
+
function insertBefore(parent: any, child: any, before: any): void;
|
36
|
+
function getCurrentEventPriority(): number;
|
37
|
+
function beforeActiveInstanceBlur(): void;
|
38
|
+
function afterActiveInstanceBlur(): void;
|
39
|
+
function detachDeletedInstance(): void;
|
40
|
+
function getInstanceFromNode(_node: any): null;
|
41
|
+
function prepareScopeUpdate(_scopeInstance: any, _instance: any): void;
|
42
|
+
function getInstanceFromScope(_scopeInstance: any): null;
|
43
|
+
}
|
44
|
+
export function debug(...args: any[]): void;
|
@@ -2,4 +2,5 @@ export const __esModule: boolean;
|
|
2
2
|
export const CommandType: {};
|
3
3
|
export function materializeProps(command: any): void;
|
4
4
|
export function isCommand(command: any, type: any): boolean;
|
5
|
+
export function isGroup(command: any): boolean;
|
5
6
|
export function isDrawCommand(command: any, type: any): boolean;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
export { JsiSkImage } from "./skia/web/JsiSkImage";
|
2
2
|
export * from "./renderer";
|
3
|
+
export * from "./renderer/CanvasOld";
|
3
4
|
export * from "./renderer/Canvas";
|
4
|
-
export * from "./renderer/Canvas2";
|
5
5
|
export * from "./renderer/Offscreen";
|
6
6
|
export * from "./views";
|
7
7
|
export * from "./skia";
|
@@ -0,0 +1,43 @@
|
|
1
|
+
export function debug(...args: any[]): void;
|
2
|
+
export namespace sksgHostConfig {
|
3
|
+
let supportsMutation: boolean;
|
4
|
+
let isPrimaryRenderer: boolean;
|
5
|
+
let supportsPersistence: boolean;
|
6
|
+
let supportsHydration: boolean;
|
7
|
+
let scheduleTimeout: typeof setTimeout;
|
8
|
+
let cancelTimeout: typeof clearTimeout;
|
9
|
+
let noTimeout: number;
|
10
|
+
function appendChildToContainer(container: any, child: any): void;
|
11
|
+
function appendChild(parent: any, child: any): void;
|
12
|
+
function getRootHostContext(_rootContainerInstance: any): null;
|
13
|
+
function getChildHostContext(_parentHostContext: any, _type: any, _rootContainerInstance: any): null;
|
14
|
+
function shouldSetTextContent(_type: any, _props: any): boolean;
|
15
|
+
function createTextInstance(_text: any, _rootContainerInstance: any, _hostContext: any, _internalInstanceHandle: any): never;
|
16
|
+
function createInstance(type: any, propsWithChildren: any, _container: any, _hostContext: any, _internalInstanceHandle: any): {
|
17
|
+
type: any;
|
18
|
+
props: any;
|
19
|
+
children: never[];
|
20
|
+
};
|
21
|
+
function appendInitialChild(parentInstance: any, child: any): void;
|
22
|
+
function finalizeInitialChildren(parentInstance: any, _type: any, _props: any, _rootContainerInstance: any, _hostContext: any): boolean;
|
23
|
+
function commitMount(): void;
|
24
|
+
function prepareForCommit(_containerInfo: any): null;
|
25
|
+
function resetAfterCommit(container: any): void;
|
26
|
+
function getPublicInstance(node: any): any;
|
27
|
+
function prepareUpdate(_instance: any, type: any, oldProps: any, newProps: any, rootContainerInstance: any, _hostContext: any): any;
|
28
|
+
function commitUpdate(instance: any, _updatePayload: any, type: any, prevProps: any, nextProps: any, _internalHandle: any): void;
|
29
|
+
function commitTextUpdate(_textInstance: any, _oldText: any, _newText: any): void;
|
30
|
+
function clearContainer(container: any): void;
|
31
|
+
function preparePortalMount(): void;
|
32
|
+
function removeChild(parent: any, child: any): void;
|
33
|
+
function removeChildFromContainer(container: any, child: any): void;
|
34
|
+
function insertInContainerBefore(container: any, child: any, before: any): void;
|
35
|
+
function insertBefore(parent: any, child: any, before: any): void;
|
36
|
+
function getCurrentEventPriority(): number;
|
37
|
+
function beforeActiveInstanceBlur(): void;
|
38
|
+
function afterActiveInstanceBlur(): void;
|
39
|
+
function detachDeletedInstance(): void;
|
40
|
+
function getInstanceFromNode(_node: any): null;
|
41
|
+
function prepareScopeUpdate(_scopeInstance: any, _instance: any): void;
|
42
|
+
function getInstanceFromScope(_scopeInstance: any): null;
|
43
|
+
}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import "./skia/NativeSetup";
|
2
2
|
export { JsiSkImage } from "./skia/web/JsiSkImage";
|
3
3
|
export * from "./renderer";
|
4
|
+
export * from "./renderer/CanvasOld";
|
4
5
|
export * from "./renderer/Canvas";
|
5
|
-
export * from "./renderer/Canvas2";
|
6
6
|
export * from "./renderer/Offscreen";
|
7
7
|
export * from "./views";
|
8
8
|
export * from "./skia";
|
@@ -1,11 +1,10 @@
|
|
1
|
-
import
|
2
|
-
import type {
|
3
|
-
import {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
mode?: "default" | "continuous";
|
1
|
+
import type { ViewProps } from "react-native";
|
2
|
+
import type { SharedValue } from "react-native-reanimated";
|
3
|
+
import type { SkSize } from "../skia/types";
|
4
|
+
export interface CanvasProps extends ViewProps {
|
5
|
+
debug?: boolean;
|
6
|
+
opaque?: boolean;
|
7
|
+
onSize?: SharedValue<SkSize>;
|
8
|
+
mode?: "continuous" | "default";
|
10
9
|
}
|
11
|
-
export declare const Canvas:
|
10
|
+
export declare const Canvas: import("react").ForwardRefExoticComponent<CanvasProps & import("react").RefAttributes<unknown>>;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import type { RefObject, ReactNode, FunctionComponent } from "react";
|
3
|
+
import { SkiaDomView } from "../views";
|
4
|
+
import type { SkiaBaseViewProps } from "../views";
|
5
|
+
export declare const useCanvasRef: () => React.RefObject<SkiaDomView>;
|
6
|
+
export interface CanvasOldProps extends SkiaBaseViewProps {
|
7
|
+
ref?: RefObject<SkiaDomView>;
|
8
|
+
children: ReactNode;
|
9
|
+
mode?: "default" | "continuous";
|
10
|
+
}
|
11
|
+
export declare const CanvasOld: FunctionComponent<CanvasOldProps & React.RefAttributes<SkiaDomView>>;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import type { HostConfig } from "react-reconciler";
|
2
|
+
import type { NodeType } from "../dom/types";
|
3
|
+
import type { Container } from "./Container";
|
4
|
+
import type { Node } from "./Node";
|
5
|
+
export declare const debug: (message?: any, ...optionalParams: any[]) => void;
|
6
|
+
type Instance = Node<unknown>;
|
7
|
+
type Props = object;
|
8
|
+
type TextInstance = Node<unknown>;
|
9
|
+
type SuspenseInstance = Instance;
|
10
|
+
type HydratableInstance = Instance;
|
11
|
+
type PublicInstance = Instance;
|
12
|
+
type HostContext = null;
|
13
|
+
type UpdatePayload = Container;
|
14
|
+
type ChildSet = unknown;
|
15
|
+
type TimeoutHandle = NodeJS.Timeout;
|
16
|
+
type NoTimeout = -1;
|
17
|
+
type SkiaHostConfig = HostConfig<NodeType, Props, Container, Instance, TextInstance, SuspenseInstance, HydratableInstance, PublicInstance, HostContext, UpdatePayload, ChildSet, TimeoutHandle, NoTimeout>;
|
18
|
+
export declare const sksgHostConfig: SkiaHostConfig;
|
19
|
+
export {};
|
@@ -1,43 +1,44 @@
|
|
1
1
|
import type { SharedValue } from "react-native-reanimated";
|
2
2
|
import type { BlurMaskFilterProps, CircleProps, CTMProps, ImageProps, PointsProps, PathProps, RectProps, RoundedRectProps, OvalProps, LineProps, PatchProps, VerticesProps, DiffRectProps, TextProps, TextPathProps, TextBlobProps, GlyphsProps, PictureProps, ImageSVGProps, ParagraphProps, AtlasProps, DrawingNodeProps } from "../../dom/types";
|
3
3
|
export declare enum CommandType {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
4
|
+
Group = 0,
|
5
|
+
SavePaint = 1,
|
6
|
+
RestorePaint = 2,
|
7
|
+
SaveCTM = 3,
|
8
|
+
RestoreCTM = 4,
|
9
|
+
PushColorFilter = 5,
|
10
|
+
PushBlurMaskFilter = 6,
|
11
|
+
PushImageFilter = 7,
|
12
|
+
PushPathEffect = 8,
|
13
|
+
PushShader = 9,
|
14
|
+
ComposeColorFilter = 10,
|
15
|
+
ComposeImageFilter = 11,
|
16
|
+
ComposePathEffect = 12,
|
17
|
+
MaterializePaint = 13,
|
18
|
+
SaveBackdropFilter = 14,
|
19
|
+
SaveLayer = 15,
|
20
|
+
RestorePaintDeclaration = 16,
|
21
|
+
DrawBox = 17,
|
22
|
+
DrawImage = 18,
|
23
|
+
DrawCircle = 19,
|
24
|
+
DrawPaint = 20,
|
25
|
+
DrawPoints = 21,
|
26
|
+
DrawPath = 22,
|
27
|
+
DrawRect = 23,
|
28
|
+
DrawRRect = 24,
|
29
|
+
DrawOval = 25,
|
30
|
+
DrawLine = 26,
|
31
|
+
DrawPatch = 27,
|
32
|
+
DrawVertices = 28,
|
33
|
+
DrawDiffRect = 29,
|
34
|
+
DrawText = 30,
|
35
|
+
DrawTextPath = 31,
|
36
|
+
DrawTextBlob = 32,
|
37
|
+
DrawGlyphs = 33,
|
38
|
+
DrawPicture = 34,
|
39
|
+
DrawImageSVG = 35,
|
40
|
+
DrawParagraph = 36,
|
41
|
+
DrawAtlas = 37
|
41
42
|
}
|
42
43
|
export type Command<T extends CommandType = CommandType> = {
|
43
44
|
type: T;
|
@@ -48,6 +49,10 @@ export declare const materializeProps: (command: {
|
|
48
49
|
animatedProps?: Record<string, SharedValue<unknown>>;
|
49
50
|
}) => void;
|
50
51
|
export declare const isCommand: <T extends CommandType>(command: Command, type: T) => command is Command<T>;
|
52
|
+
interface GroupCommand extends Command<CommandType.Group> {
|
53
|
+
children: Command[];
|
54
|
+
}
|
55
|
+
export declare const isGroup: (command: Command) => command is GroupCommand;
|
51
56
|
interface Props {
|
52
57
|
[CommandType.DrawImage]: ImageProps;
|
53
58
|
[CommandType.DrawCircle]: CircleProps;
|
@@ -13,10 +13,14 @@ interface AnimationValues {
|
|
13
13
|
}
|
14
14
|
export declare class Recorder {
|
15
15
|
commands: Command[];
|
16
|
+
cursors: Command[][];
|
16
17
|
animationValues: Set<SharedValue<unknown>>;
|
18
|
+
constructor();
|
17
19
|
getRecording(): Recording & AnimationValues;
|
18
20
|
private processProps;
|
19
21
|
private add;
|
22
|
+
saveGroup(): void;
|
23
|
+
restoreGroup(): void;
|
20
24
|
savePaint(props: AnimatedProps<PaintProps>): void;
|
21
25
|
restorePaint(): void;
|
22
26
|
restorePaintDeclaration(): void;
|
package/package.json
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
"setup-skia-web": "./scripts/setup-canvaskit.js"
|
8
8
|
},
|
9
9
|
"title": "React Native Skia",
|
10
|
-
"version": "1.
|
10
|
+
"version": "1.10.0",
|
11
11
|
"description": "High-performance React Native Graphics using Skia",
|
12
12
|
"main": "lib/module/index.js",
|
13
13
|
"react-native": "src/index.ts",
|
@@ -49,7 +49,8 @@
|
|
49
49
|
"clang-format-android": "find android/cpp/ -iname '*.h' -o -iname '*.m' -o -iname '*.cpp' | xargs clang-format -i",
|
50
50
|
"clang-format-common": "find cpp/ \\( -path 'cpp//skia' -prune \\) -o \\( -iname '*.h' -o -iname '*.m' -o -iname '*.cpp' \\) -print | xargs clang-format -i",
|
51
51
|
"workflow-copy-libs": "yarn ts-node ./scripts/workflow-copy-libs.ts",
|
52
|
-
"cpplint": "cpplint --linelength=230 --filter=-legal/copyright,-whitespace/indent,-whitespace/comments,-whitespace/ending_newline,-build/include_order,-runtime/references,-readability/todo,-whitespace/blank_line,-whitespace/todo,-runtime/int,-build/c++11,-whitespace/parens --exclude=package/cpp/skia --exclude=package/ios --exclude=package/android/build --exclude=package/node_modules --recursive package"
|
52
|
+
"cpplint": "cpplint --linelength=230 --filter=-legal/copyright,-whitespace/indent,-whitespace/comments,-whitespace/ending_newline,-build/include_order,-runtime/references,-readability/todo,-whitespace/blank_line,-whitespace/todo,-runtime/int,-build/c++11,-whitespace/parens --exclude=package/cpp/skia --exclude=package/ios --exclude=package/android/build --exclude=package/node_modules --recursive package",
|
53
|
+
"download-artifacts": "ts-node ./scripts/download-artifacts.ts"
|
53
54
|
},
|
54
55
|
"repository": {
|
55
56
|
"type": "git",
|
package/src/index.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import "./skia/NativeSetup";
|
2
2
|
export { JsiSkImage } from "./skia/web/JsiSkImage";
|
3
3
|
export * from "./renderer";
|
4
|
+
export * from "./renderer/CanvasOld";
|
4
5
|
export * from "./renderer/Canvas";
|
5
|
-
export * from "./renderer/Canvas2";
|
6
6
|
export * from "./renderer/Offscreen";
|
7
7
|
export * from "./views";
|
8
8
|
export * from "./skia";
|