@shopify/react-native-skia 0.1.147 → 0.1.148
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/commonjs/dom/nodes/DrawingNode.js +84 -0
- package/lib/commonjs/dom/nodes/DrawingNode.js.map +1 -0
- package/lib/commonjs/dom/nodes/GroupNode.js +28 -0
- package/lib/commonjs/dom/nodes/GroupNode.js.map +1 -0
- package/lib/commonjs/dom/nodes/JsiSkDOM.js +256 -0
- package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -0
- package/lib/commonjs/dom/nodes/Node.js +158 -0
- package/lib/commonjs/dom/nodes/Node.js.map +1 -0
- package/lib/commonjs/dom/nodes/PaintContext.js +6 -0
- package/lib/commonjs/dom/nodes/PaintContext.js.map +1 -0
- package/lib/commonjs/dom/nodes/PaintNode.js +96 -0
- package/lib/commonjs/dom/nodes/PaintNode.js.map +1 -0
- package/lib/commonjs/dom/nodes/RenderNode.js +346 -0
- package/lib/commonjs/dom/nodes/RenderNode.js.map +1 -0
- package/lib/commonjs/{renderer/processors/Circles.js → dom/nodes/datatypes/Circle.js} +4 -2
- package/lib/commonjs/dom/nodes/datatypes/Circle.js.map +1 -0
- package/lib/commonjs/{renderer/processors → dom/nodes/datatypes}/Color.js +0 -0
- package/lib/commonjs/{renderer/processors → dom/nodes/datatypes}/Color.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Enum.js +11 -0
- package/lib/commonjs/dom/nodes/datatypes/Enum.js.map +1 -0
- package/lib/commonjs/{renderer/components/image/BoxFit.js → dom/nodes/datatypes/Fitting.js} +2 -2
- package/lib/commonjs/{renderer/components/image/BoxFit.js.map → dom/nodes/datatypes/Fitting.js.map} +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Gradient.js +65 -0
- package/lib/commonjs/dom/nodes/datatypes/Gradient.js.map +1 -0
- package/lib/commonjs/{renderer/processors/Paths.js → dom/nodes/datatypes/Path.js} +2 -2
- package/lib/commonjs/dom/nodes/datatypes/Path.js.map +1 -0
- package/lib/commonjs/{renderer/processors → dom/nodes/datatypes}/Radius.js +0 -0
- package/lib/commonjs/dom/nodes/datatypes/Radius.js.map +1 -0
- package/lib/commonjs/{renderer/processors/Rects.js → dom/nodes/datatypes/Rect.js} +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Rect.js.map +1 -0
- package/lib/commonjs/dom/nodes/datatypes/Transform.js +42 -0
- package/lib/commonjs/dom/nodes/datatypes/Transform.js.map +1 -0
- package/lib/commonjs/dom/nodes/datatypes/index.js +123 -0
- package/lib/commonjs/dom/nodes/datatypes/index.js.map +1 -0
- package/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.js +38 -0
- package/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.js.map +1 -0
- package/lib/commonjs/dom/nodes/drawings/Box.js +105 -0
- package/lib/commonjs/dom/nodes/drawings/Box.js.map +1 -0
- package/lib/commonjs/dom/nodes/drawings/CircleNode.js +43 -0
- package/lib/commonjs/dom/nodes/drawings/CircleNode.js.map +1 -0
- package/lib/commonjs/dom/nodes/drawings/CustomDrawingNode.js +28 -0
- package/lib/commonjs/dom/nodes/drawings/CustomDrawingNode.js.map +1 -0
- package/lib/commonjs/dom/nodes/drawings/DiffRectNode.js +36 -0
- package/lib/commonjs/dom/nodes/drawings/DiffRectNode.js.map +1 -0
- package/lib/commonjs/dom/nodes/drawings/FillNode.js +33 -0
- package/lib/commonjs/dom/nodes/drawings/FillNode.js.map +1 -0
- package/lib/commonjs/dom/nodes/drawings/ImageNode.js +63 -0
- package/lib/commonjs/dom/nodes/drawings/ImageNode.js.map +1 -0
- package/lib/commonjs/dom/nodes/drawings/ImageSVG.js +45 -0
- package/lib/commonjs/dom/nodes/drawings/ImageSVG.js.map +1 -0
- package/lib/commonjs/dom/nodes/drawings/LineNode.js +36 -0
- package/lib/commonjs/dom/nodes/drawings/LineNode.js.map +1 -0
- package/lib/commonjs/dom/nodes/drawings/OvalNode.js +39 -0
- package/lib/commonjs/dom/nodes/drawings/OvalNode.js.map +1 -0
- package/lib/commonjs/dom/nodes/drawings/PatchNode.js +69 -0
- package/lib/commonjs/dom/nodes/drawings/PatchNode.js.map +1 -0
- package/lib/commonjs/dom/nodes/drawings/PathNode.js +68 -0
- package/lib/commonjs/dom/nodes/drawings/PathNode.js.map +1 -0
- package/lib/commonjs/dom/nodes/drawings/PictureNode.js +34 -0
- package/lib/commonjs/dom/nodes/drawings/PictureNode.js.map +1 -0
- package/lib/commonjs/dom/nodes/drawings/PointsNode.js +40 -0
- package/lib/commonjs/dom/nodes/drawings/PointsNode.js.map +1 -0
- package/lib/commonjs/dom/nodes/drawings/RRectNode.js +43 -0
- package/lib/commonjs/dom/nodes/drawings/RRectNode.js.map +1 -0
- package/lib/commonjs/dom/nodes/drawings/RectNode.js +39 -0
- package/lib/commonjs/dom/nodes/drawings/RectNode.js.map +1 -0
- package/lib/commonjs/dom/nodes/drawings/Text.js +185 -0
- package/lib/commonjs/dom/nodes/drawings/Text.js.map +1 -0
- package/lib/commonjs/dom/nodes/drawings/VerticesNode.js +55 -0
- package/lib/commonjs/dom/nodes/drawings/VerticesNode.js.map +1 -0
- package/lib/commonjs/dom/nodes/drawings/index.js +240 -0
- package/lib/commonjs/dom/nodes/drawings/index.js.map +1 -0
- package/lib/commonjs/dom/nodes/index.js +45 -0
- package/lib/commonjs/dom/nodes/index.js.map +1 -0
- package/lib/commonjs/dom/nodes/paint/BlendNode.js +82 -0
- package/lib/commonjs/dom/nodes/paint/BlendNode.js.map +1 -0
- package/lib/commonjs/dom/nodes/paint/ColorFilters.js +152 -0
- package/lib/commonjs/dom/nodes/paint/ColorFilters.js.map +1 -0
- package/lib/commonjs/dom/nodes/paint/ImageFilters.js +225 -0
- package/lib/commonjs/dom/nodes/paint/ImageFilters.js.map +1 -0
- package/lib/commonjs/dom/nodes/paint/MaskFilters.js +33 -0
- package/lib/commonjs/dom/nodes/paint/MaskFilters.js.map +1 -0
- package/lib/commonjs/dom/nodes/paint/PathEffects.js +223 -0
- package/lib/commonjs/dom/nodes/paint/PathEffects.js.map +1 -0
- package/lib/commonjs/dom/nodes/paint/Shaders.js +242 -0
- package/lib/commonjs/dom/nodes/paint/Shaders.js.map +1 -0
- package/lib/commonjs/dom/nodes/paint/index.js +84 -0
- package/lib/commonjs/dom/nodes/paint/index.js.map +1 -0
- package/lib/commonjs/dom/types/ColorFilters.js +6 -0
- package/lib/commonjs/dom/types/ColorFilters.js.map +1 -0
- package/lib/commonjs/dom/types/Common.js +6 -0
- package/lib/commonjs/dom/types/Common.js.map +1 -0
- package/lib/commonjs/dom/types/DrawingContext.js +6 -0
- package/lib/commonjs/dom/types/DrawingContext.js.map +1 -0
- package/lib/commonjs/dom/types/Drawings.js +6 -0
- package/lib/commonjs/dom/types/Drawings.js.map +1 -0
- package/lib/commonjs/dom/types/ImageFilters.js +6 -0
- package/lib/commonjs/dom/types/ImageFilters.js.map +1 -0
- package/lib/commonjs/dom/types/MaskFilters.js +6 -0
- package/lib/commonjs/dom/types/MaskFilters.js.map +1 -0
- package/lib/commonjs/dom/types/Node.js +6 -0
- package/lib/commonjs/dom/types/Node.js.map +1 -0
- package/lib/commonjs/dom/types/NodeType.js +80 -0
- package/lib/commonjs/dom/types/NodeType.js.map +1 -0
- package/lib/commonjs/dom/types/PathEffects.js +6 -0
- package/lib/commonjs/dom/types/PathEffects.js.map +1 -0
- package/lib/commonjs/dom/types/Shaders.js +6 -0
- package/lib/commonjs/dom/types/Shaders.js.map +1 -0
- package/lib/commonjs/dom/types/SkDOM.js +6 -0
- package/lib/commonjs/dom/types/SkDOM.js.map +1 -0
- package/lib/commonjs/dom/types/index.js +149 -0
- package/lib/commonjs/dom/types/index.js.map +1 -0
- package/lib/commonjs/index.js +26 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +7 -3
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/Container.js +39 -0
- package/lib/commonjs/renderer/Container.js.map +1 -0
- package/lib/commonjs/renderer/DependencyManager.js +17 -5
- package/lib/commonjs/renderer/DependencyManager.js.map +1 -1
- package/lib/commonjs/renderer/HostComponents.js +196 -0
- package/lib/commonjs/renderer/HostComponents.js.map +1 -0
- package/lib/commonjs/renderer/HostConfig.js +47 -125
- package/lib/commonjs/renderer/HostConfig.js.map +1 -1
- package/lib/commonjs/renderer/components/Blend.js +1 -46
- package/lib/commonjs/renderer/components/Blend.js.map +1 -1
- package/lib/commonjs/renderer/components/Drawing.js +1 -15
- package/lib/commonjs/renderer/components/Drawing.js.map +1 -1
- package/lib/commonjs/renderer/components/Group.js +1 -69
- package/lib/commonjs/renderer/components/Group.js.map +1 -1
- package/lib/commonjs/renderer/components/Paint.js +2 -14
- package/lib/commonjs/renderer/components/Paint.js.map +1 -1
- package/lib/commonjs/renderer/components/Picture.js +1 -19
- package/lib/commonjs/renderer/components/Picture.js.map +1 -1
- package/lib/commonjs/renderer/components/backdrop/BackdropBlur.js.map +1 -1
- package/lib/commonjs/renderer/components/backdrop/BackdropFilter.js +2 -32
- package/lib/commonjs/renderer/components/backdrop/BackdropFilter.js.map +1 -1
- package/lib/commonjs/renderer/components/colorFilters/BlendColor.js +1 -25
- package/lib/commonjs/renderer/components/colorFilters/BlendColor.js.map +1 -1
- package/lib/commonjs/renderer/components/colorFilters/Lerp.js +1 -23
- package/lib/commonjs/renderer/components/colorFilters/Lerp.js.map +1 -1
- package/lib/commonjs/renderer/components/colorFilters/LinearToSRGBGamma.js +1 -17
- package/lib/commonjs/renderer/components/colorFilters/LinearToSRGBGamma.js.map +1 -1
- package/lib/commonjs/renderer/components/colorFilters/LumaColorFilter.js +1 -17
- package/lib/commonjs/renderer/components/colorFilters/LumaColorFilter.js.map +1 -1
- package/lib/commonjs/renderer/components/colorFilters/Matrix.js +1 -20
- package/lib/commonjs/renderer/components/colorFilters/Matrix.js.map +1 -1
- package/lib/commonjs/renderer/components/colorFilters/SRGBToLinearGamma.js +1 -17
- package/lib/commonjs/renderer/components/colorFilters/SRGBToLinearGamma.js.map +1 -1
- package/lib/commonjs/renderer/components/image/Image.js +1 -35
- package/lib/commonjs/renderer/components/image/Image.js.map +1 -1
- package/lib/commonjs/renderer/components/image/ImageSVG.js +1 -30
- package/lib/commonjs/renderer/components/image/ImageSVG.js.map +1 -1
- package/lib/commonjs/renderer/components/image/ImageShader.js +1 -61
- package/lib/commonjs/renderer/components/image/ImageShader.js.map +1 -1
- package/lib/commonjs/renderer/components/image/index.js +0 -13
- package/lib/commonjs/renderer/components/image/index.js.map +1 -1
- package/lib/commonjs/renderer/components/imageFilters/Blur.js +1 -27
- package/lib/commonjs/renderer/components/imageFilters/Blur.js.map +1 -1
- package/lib/commonjs/renderer/components/imageFilters/DisplacementMap.js +1 -38
- package/lib/commonjs/renderer/components/imageFilters/DisplacementMap.js.map +1 -1
- package/lib/commonjs/renderer/components/imageFilters/Morphology.js +1 -25
- package/lib/commonjs/renderer/components/imageFilters/Morphology.js.map +1 -1
- package/lib/commonjs/renderer/components/imageFilters/Offset.js +1 -20
- package/lib/commonjs/renderer/components/imageFilters/Offset.js.map +1 -1
- package/lib/commonjs/renderer/components/imageFilters/RuntimeShader.js +1 -28
- package/lib/commonjs/renderer/components/imageFilters/RuntimeShader.js.map +1 -1
- package/lib/commonjs/renderer/components/imageFilters/Shadow.js +1 -39
- package/lib/commonjs/renderer/components/imageFilters/Shadow.js.map +1 -1
- package/lib/commonjs/renderer/components/index.js +0 -13
- package/lib/commonjs/renderer/components/index.js.map +1 -1
- package/lib/commonjs/renderer/components/maskFilters/Blur.js +1 -23
- package/lib/commonjs/renderer/components/maskFilters/Blur.js.map +1 -1
- package/lib/commonjs/renderer/components/pathEffects/Corner.js +1 -30
- package/lib/commonjs/renderer/components/pathEffects/Corner.js.map +1 -1
- package/lib/commonjs/renderer/components/pathEffects/Dash.js +1 -27
- package/lib/commonjs/renderer/components/pathEffects/Dash.js.map +1 -1
- package/lib/commonjs/renderer/components/pathEffects/Discrete.js +1 -28
- package/lib/commonjs/renderer/components/pathEffects/Discrete.js.map +1 -1
- package/lib/commonjs/renderer/components/pathEffects/Line2D.js +1 -31
- package/lib/commonjs/renderer/components/pathEffects/Line2D.js.map +1 -1
- package/lib/commonjs/renderer/components/pathEffects/Path1D.js +1 -37
- package/lib/commonjs/renderer/components/pathEffects/Path1D.js.map +1 -1
- package/lib/commonjs/renderer/components/pathEffects/Path2D.js +1 -33
- package/lib/commonjs/renderer/components/pathEffects/Path2D.js.map +1 -1
- package/lib/commonjs/renderer/components/pathEffects/Sum.js +1 -17
- package/lib/commonjs/renderer/components/pathEffects/Sum.js.map +1 -1
- package/lib/commonjs/renderer/components/shaders/Color.js +1 -19
- package/lib/commonjs/renderer/components/shaders/Color.js.map +1 -1
- package/lib/commonjs/renderer/components/shaders/FractalNoise.js +1 -22
- package/lib/commonjs/renderer/components/shaders/FractalNoise.js.map +1 -1
- package/lib/commonjs/renderer/components/shaders/LinearGradient.js +1 -28
- package/lib/commonjs/renderer/components/shaders/LinearGradient.js.map +1 -1
- package/lib/commonjs/renderer/components/shaders/RadialGradient.js +1 -28
- package/lib/commonjs/renderer/components/shaders/RadialGradient.js.map +1 -1
- package/lib/commonjs/renderer/components/shaders/Shader.js +1 -23
- package/lib/commonjs/renderer/components/shaders/Shader.js.map +1 -1
- package/lib/commonjs/renderer/components/shaders/SweepGradient.js +1 -29
- package/lib/commonjs/renderer/components/shaders/SweepGradient.js.map +1 -1
- package/lib/commonjs/renderer/components/shaders/Turbulence.js +1 -22
- package/lib/commonjs/renderer/components/shaders/Turbulence.js.map +1 -1
- package/lib/commonjs/renderer/components/shaders/TwoPointConicalGradient.js +1 -30
- package/lib/commonjs/renderer/components/shaders/TwoPointConicalGradient.js.map +1 -1
- package/lib/commonjs/renderer/components/shapes/Box.js +2 -102
- package/lib/commonjs/renderer/components/shapes/Box.js.map +1 -1
- package/lib/commonjs/renderer/components/shapes/Circle.js +1 -22
- package/lib/commonjs/renderer/components/shapes/Circle.js.map +1 -1
- package/lib/commonjs/renderer/components/shapes/DiffRect.js +1 -19
- package/lib/commonjs/renderer/components/shapes/DiffRect.js.map +1 -1
- package/lib/commonjs/renderer/components/shapes/Fill.js +1 -15
- package/lib/commonjs/renderer/components/shapes/Fill.js.map +1 -1
- package/lib/commonjs/renderer/components/shapes/FitBox.js +3 -3
- package/lib/commonjs/renderer/components/shapes/FitBox.js.map +1 -1
- package/lib/commonjs/renderer/components/shapes/Line.js +1 -19
- package/lib/commonjs/renderer/components/shapes/Line.js.map +1 -1
- package/lib/commonjs/renderer/components/shapes/Oval.js +1 -19
- package/lib/commonjs/renderer/components/shapes/Oval.js.map +1 -1
- package/lib/commonjs/renderer/components/shapes/Patch.js +1 -37
- package/lib/commonjs/renderer/components/shapes/Patch.js.map +1 -1
- package/lib/commonjs/renderer/components/shapes/Path.js +1 -47
- package/lib/commonjs/renderer/components/shapes/Path.js.map +1 -1
- package/lib/commonjs/renderer/components/shapes/Points.js +1 -26
- package/lib/commonjs/renderer/components/shapes/Points.js.map +1 -1
- package/lib/commonjs/renderer/components/shapes/Rect.js +1 -19
- package/lib/commonjs/renderer/components/shapes/Rect.js.map +1 -1
- package/lib/commonjs/renderer/components/shapes/RoundedRect.js +1 -19
- package/lib/commonjs/renderer/components/shapes/RoundedRect.js.map +1 -1
- package/lib/commonjs/renderer/components/shapes/Vertices.js +1 -36
- package/lib/commonjs/renderer/components/shapes/Vertices.js.map +1 -1
- package/lib/commonjs/renderer/components/text/Glyphs.js +1 -39
- package/lib/commonjs/renderer/components/text/Glyphs.js.map +1 -1
- package/lib/commonjs/renderer/components/text/Text.js +1 -24
- package/lib/commonjs/renderer/components/text/Text.js.map +1 -1
- package/lib/commonjs/renderer/components/text/TextBlob.js +1 -20
- package/lib/commonjs/renderer/components/text/TextBlob.js.map +1 -1
- package/lib/commonjs/renderer/components/text/TextPath.js +1 -71
- package/lib/commonjs/renderer/components/text/TextPath.js.map +1 -1
- package/lib/commonjs/renderer/index.js +0 -13
- package/lib/commonjs/renderer/index.js.map +1 -1
- package/lib/commonjs/renderer/processors/Animations/Animations.js.map +1 -1
- package/lib/commonjs/renderer/processors/index.js +0 -117
- package/lib/commonjs/renderer/processors/index.js.map +1 -1
- package/lib/commonjs/web/WithSkiaWeb.js +3 -1
- package/lib/commonjs/web/WithSkiaWeb.js.map +1 -1
- package/lib/module/dom/nodes/DrawingNode.js +72 -0
- package/lib/module/dom/nodes/DrawingNode.js.map +1 -0
- package/lib/module/dom/nodes/GroupNode.js +17 -0
- package/lib/module/dom/nodes/GroupNode.js.map +1 -0
- package/lib/module/dom/nodes/JsiSkDOM.js +240 -0
- package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -0
- package/lib/module/dom/nodes/Node.js +145 -0
- package/lib/module/dom/nodes/Node.js.map +1 -0
- package/lib/module/dom/nodes/PaintContext.js +2 -0
- package/lib/module/dom/nodes/PaintContext.js.map +1 -0
- package/lib/module/dom/nodes/PaintNode.js +83 -0
- package/lib/module/dom/nodes/PaintNode.js.map +1 -0
- package/lib/module/dom/nodes/RenderNode.js +329 -0
- package/lib/module/dom/nodes/RenderNode.js.map +1 -0
- package/lib/module/{renderer/processors/Circles.js → dom/nodes/datatypes/Circle.js} +2 -3
- package/lib/module/dom/nodes/datatypes/Circle.js.map +1 -0
- package/lib/module/{renderer/processors → dom/nodes/datatypes}/Color.js +0 -0
- package/lib/module/{renderer/processors → dom/nodes/datatypes}/Color.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Enum.js +2 -0
- package/lib/module/dom/nodes/datatypes/Enum.js.map +1 -0
- package/lib/module/{renderer/components/image/BoxFit.js → dom/nodes/datatypes/Fitting.js} +2 -2
- package/lib/module/{renderer/components/image/BoxFit.js.map → dom/nodes/datatypes/Fitting.js.map} +1 -1
- package/lib/module/dom/nodes/datatypes/Gradient.js +47 -0
- package/lib/module/dom/nodes/datatypes/Gradient.js.map +1 -0
- package/lib/module/{renderer/processors/Paths.js → dom/nodes/datatypes/Path.js} +2 -2
- package/lib/module/dom/nodes/datatypes/Path.js.map +1 -0
- package/lib/module/{renderer/processors → dom/nodes/datatypes}/Radius.js +0 -0
- package/lib/module/dom/nodes/datatypes/Radius.js.map +1 -0
- package/lib/module/{renderer/processors/Rects.js → dom/nodes/datatypes/Rect.js} +1 -1
- package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -0
- package/lib/module/dom/nodes/datatypes/Transform.js +32 -0
- package/lib/module/dom/nodes/datatypes/Transform.js.map +1 -0
- package/lib/module/dom/nodes/datatypes/index.js +10 -0
- package/lib/module/dom/nodes/datatypes/index.js.map +1 -0
- package/lib/module/dom/nodes/drawings/BackdropFilterNode.js +25 -0
- package/lib/module/dom/nodes/drawings/BackdropFilterNode.js.map +1 -0
- package/lib/module/dom/nodes/drawings/Box.js +89 -0
- package/lib/module/dom/nodes/drawings/Box.js.map +1 -0
- package/lib/module/dom/nodes/drawings/CircleNode.js +31 -0
- package/lib/module/dom/nodes/drawings/CircleNode.js.map +1 -0
- package/lib/module/dom/nodes/drawings/CustomDrawingNode.js +17 -0
- package/lib/module/dom/nodes/drawings/CustomDrawingNode.js.map +1 -0
- package/lib/module/dom/nodes/drawings/DiffRectNode.js +25 -0
- package/lib/module/dom/nodes/drawings/DiffRectNode.js.map +1 -0
- package/lib/module/dom/nodes/drawings/FillNode.js +22 -0
- package/lib/module/dom/nodes/drawings/FillNode.js.map +1 -0
- package/lib/module/dom/nodes/drawings/ImageNode.js +51 -0
- package/lib/module/dom/nodes/drawings/ImageNode.js.map +1 -0
- package/lib/module/dom/nodes/drawings/ImageSVG.js +33 -0
- package/lib/module/dom/nodes/drawings/ImageSVG.js.map +1 -0
- package/lib/module/dom/nodes/drawings/LineNode.js +25 -0
- package/lib/module/dom/nodes/drawings/LineNode.js.map +1 -0
- package/lib/module/dom/nodes/drawings/OvalNode.js +27 -0
- package/lib/module/dom/nodes/drawings/OvalNode.js.map +1 -0
- package/lib/module/dom/nodes/drawings/PatchNode.js +56 -0
- package/lib/module/dom/nodes/drawings/PatchNode.js.map +1 -0
- package/lib/module/dom/nodes/drawings/PathNode.js +55 -0
- package/lib/module/dom/nodes/drawings/PathNode.js.map +1 -0
- package/lib/module/dom/nodes/drawings/PictureNode.js +23 -0
- package/lib/module/dom/nodes/drawings/PictureNode.js.map +1 -0
- package/lib/module/dom/nodes/drawings/PointsNode.js +27 -0
- package/lib/module/dom/nodes/drawings/PointsNode.js.map +1 -0
- package/lib/module/dom/nodes/drawings/RRectNode.js +31 -0
- package/lib/module/dom/nodes/drawings/RRectNode.js.map +1 -0
- package/lib/module/dom/nodes/drawings/RectNode.js +27 -0
- package/lib/module/dom/nodes/drawings/RectNode.js.map +1 -0
- package/lib/module/dom/nodes/drawings/Text.js +164 -0
- package/lib/module/dom/nodes/drawings/Text.js.map +1 -0
- package/lib/module/dom/nodes/drawings/VerticesNode.js +42 -0
- package/lib/module/dom/nodes/drawings/VerticesNode.js.map +1 -0
- package/lib/module/dom/nodes/drawings/index.js +19 -0
- package/lib/module/dom/nodes/drawings/index.js.map +1 -0
- package/lib/module/dom/nodes/index.js +4 -0
- package/lib/module/dom/nodes/index.js.map +1 -0
- package/lib/module/dom/nodes/paint/BlendNode.js +66 -0
- package/lib/module/dom/nodes/paint/BlendNode.js.map +1 -0
- package/lib/module/dom/nodes/paint/ColorFilters.js +120 -0
- package/lib/module/dom/nodes/paint/ColorFilters.js.map +1 -0
- package/lib/module/dom/nodes/paint/ImageFilters.js +191 -0
- package/lib/module/dom/nodes/paint/ImageFilters.js.map +1 -0
- package/lib/module/dom/nodes/paint/MaskFilters.js +20 -0
- package/lib/module/dom/nodes/paint/MaskFilters.js.map +1 -0
- package/lib/module/dom/nodes/paint/PathEffects.js +192 -0
- package/lib/module/dom/nodes/paint/PathEffects.js.map +1 -0
- package/lib/module/dom/nodes/paint/Shaders.js +201 -0
- package/lib/module/dom/nodes/paint/Shaders.js.map +1 -0
- package/lib/module/dom/nodes/paint/index.js +7 -0
- package/lib/module/dom/nodes/paint/index.js.map +1 -0
- package/lib/module/dom/types/ColorFilters.js +2 -0
- package/lib/module/dom/types/ColorFilters.js.map +1 -0
- package/lib/module/dom/types/Common.js +2 -0
- package/lib/module/dom/types/Common.js.map +1 -0
- package/lib/module/dom/types/DrawingContext.js +2 -0
- package/lib/module/dom/types/DrawingContext.js.map +1 -0
- package/lib/module/dom/types/Drawings.js +2 -0
- package/lib/module/dom/types/Drawings.js.map +1 -0
- package/lib/module/dom/types/ImageFilters.js +2 -0
- package/lib/module/dom/types/ImageFilters.js.map +1 -0
- package/lib/module/dom/types/MaskFilters.js +2 -0
- package/lib/module/dom/types/MaskFilters.js.map +1 -0
- package/lib/module/dom/types/Node.js +2 -0
- package/lib/module/dom/types/Node.js.map +1 -0
- package/lib/module/dom/types/NodeType.js +72 -0
- package/lib/module/dom/types/NodeType.js.map +1 -0
- package/lib/module/dom/types/PathEffects.js +2 -0
- package/lib/module/dom/types/PathEffects.js.map +1 -0
- package/lib/module/dom/types/Shaders.js +2 -0
- package/lib/module/dom/types/Shaders.js.map +1 -0
- package/lib/module/dom/types/SkDOM.js +2 -0
- package/lib/module/dom/types/SkDOM.js.map +1 -0
- package/lib/module/dom/types/index.js +12 -0
- package/lib/module/dom/types/index.js.map +1 -0
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/renderer/Canvas.js +7 -3
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/Container.js +29 -0
- package/lib/module/renderer/Container.js.map +1 -0
- package/lib/module/renderer/DependencyManager.js +17 -5
- package/lib/module/renderer/DependencyManager.js.map +1 -1
- package/lib/module/renderer/HostComponents.js +185 -0
- package/lib/module/renderer/HostComponents.js.map +1 -0
- package/lib/module/renderer/HostConfig.js +47 -126
- package/lib/module/renderer/HostConfig.js.map +1 -1
- package/lib/module/renderer/components/Blend.js +1 -42
- package/lib/module/renderer/components/Blend.js.map +1 -1
- package/lib/module/renderer/components/Drawing.js +1 -13
- package/lib/module/renderer/components/Drawing.js.map +1 -1
- package/lib/module/renderer/components/Group.js +1 -65
- package/lib/module/renderer/components/Group.js.map +1 -1
- package/lib/module/renderer/components/Paint.js +3 -12
- package/lib/module/renderer/components/Paint.js.map +1 -1
- package/lib/module/renderer/components/Picture.js +1 -17
- package/lib/module/renderer/components/Picture.js.map +1 -1
- package/lib/module/renderer/components/backdrop/BackdropBlur.js.map +1 -1
- package/lib/module/renderer/components/backdrop/BackdropFilter.js +2 -30
- package/lib/module/renderer/components/backdrop/BackdropFilter.js.map +1 -1
- package/lib/module/renderer/components/colorFilters/BlendColor.js +1 -20
- package/lib/module/renderer/components/colorFilters/BlendColor.js.map +1 -1
- package/lib/module/renderer/components/colorFilters/Lerp.js +1 -19
- package/lib/module/renderer/components/colorFilters/Lerp.js.map +1 -1
- package/lib/module/renderer/components/colorFilters/LinearToSRGBGamma.js +1 -15
- package/lib/module/renderer/components/colorFilters/LinearToSRGBGamma.js.map +1 -1
- package/lib/module/renderer/components/colorFilters/LumaColorFilter.js +1 -15
- package/lib/module/renderer/components/colorFilters/LumaColorFilter.js.map +1 -1
- package/lib/module/renderer/components/colorFilters/Matrix.js +1 -17
- package/lib/module/renderer/components/colorFilters/Matrix.js.map +1 -1
- package/lib/module/renderer/components/colorFilters/SRGBToLinearGamma.js +1 -15
- package/lib/module/renderer/components/colorFilters/SRGBToLinearGamma.js.map +1 -1
- package/lib/module/renderer/components/image/Image.js +1 -31
- package/lib/module/renderer/components/image/Image.js.map +1 -1
- package/lib/module/renderer/components/image/ImageSVG.js +1 -27
- package/lib/module/renderer/components/image/ImageSVG.js.map +1 -1
- package/lib/module/renderer/components/image/ImageShader.js +1 -57
- package/lib/module/renderer/components/image/ImageShader.js.map +1 -1
- package/lib/module/renderer/components/image/index.js +0 -1
- package/lib/module/renderer/components/image/index.js.map +1 -1
- package/lib/module/renderer/components/imageFilters/Blur.js +1 -21
- package/lib/module/renderer/components/imageFilters/Blur.js.map +1 -1
- package/lib/module/renderer/components/imageFilters/DisplacementMap.js +1 -30
- package/lib/module/renderer/components/imageFilters/DisplacementMap.js.map +1 -1
- package/lib/module/renderer/components/imageFilters/Morphology.js +1 -21
- package/lib/module/renderer/components/imageFilters/Morphology.js.map +1 -1
- package/lib/module/renderer/components/imageFilters/Offset.js +1 -17
- package/lib/module/renderer/components/imageFilters/Offset.js.map +1 -1
- package/lib/module/renderer/components/imageFilters/RuntimeShader.js +1 -24
- package/lib/module/renderer/components/imageFilters/RuntimeShader.js.map +1 -1
- package/lib/module/renderer/components/imageFilters/Shadow.js +1 -34
- package/lib/module/renderer/components/imageFilters/Shadow.js.map +1 -1
- package/lib/module/renderer/components/index.js +0 -1
- package/lib/module/renderer/components/index.js.map +1 -1
- package/lib/module/renderer/components/maskFilters/Blur.js +1 -19
- package/lib/module/renderer/components/maskFilters/Blur.js.map +1 -1
- package/lib/module/renderer/components/pathEffects/Corner.js +1 -27
- package/lib/module/renderer/components/pathEffects/Corner.js.map +1 -1
- package/lib/module/renderer/components/pathEffects/Dash.js +1 -24
- package/lib/module/renderer/components/pathEffects/Dash.js.map +1 -1
- package/lib/module/renderer/components/pathEffects/Discrete.js +1 -25
- package/lib/module/renderer/components/pathEffects/Discrete.js.map +1 -1
- package/lib/module/renderer/components/pathEffects/Line2D.js +1 -28
- package/lib/module/renderer/components/pathEffects/Line2D.js.map +1 -1
- package/lib/module/renderer/components/pathEffects/Path1D.js +1 -32
- package/lib/module/renderer/components/pathEffects/Path1D.js.map +1 -1
- package/lib/module/renderer/components/pathEffects/Path2D.js +1 -29
- package/lib/module/renderer/components/pathEffects/Path2D.js.map +1 -1
- package/lib/module/renderer/components/pathEffects/Sum.js +1 -14
- package/lib/module/renderer/components/pathEffects/Sum.js.map +1 -1
- package/lib/module/renderer/components/shaders/Color.js +1 -16
- package/lib/module/renderer/components/shaders/Color.js.map +1 -1
- package/lib/module/renderer/components/shaders/FractalNoise.js +1 -20
- package/lib/module/renderer/components/shaders/FractalNoise.js.map +1 -1
- package/lib/module/renderer/components/shaders/LinearGradient.js +1 -25
- package/lib/module/renderer/components/shaders/LinearGradient.js.map +1 -1
- package/lib/module/renderer/components/shaders/RadialGradient.js +1 -25
- package/lib/module/renderer/components/shaders/RadialGradient.js.map +1 -1
- package/lib/module/renderer/components/shaders/Shader.js +1 -19
- package/lib/module/renderer/components/shaders/Shader.js.map +1 -1
- package/lib/module/renderer/components/shaders/SweepGradient.js +1 -26
- package/lib/module/renderer/components/shaders/SweepGradient.js.map +1 -1
- package/lib/module/renderer/components/shaders/Turbulence.js +1 -20
- package/lib/module/renderer/components/shaders/Turbulence.js.map +1 -1
- package/lib/module/renderer/components/shaders/TwoPointConicalGradient.js +1 -27
- package/lib/module/renderer/components/shaders/TwoPointConicalGradient.js.map +1 -1
- package/lib/module/renderer/components/shapes/Box.js +2 -97
- package/lib/module/renderer/components/shapes/Box.js.map +1 -1
- package/lib/module/renderer/components/shapes/Circle.js +1 -19
- package/lib/module/renderer/components/shapes/Circle.js.map +1 -1
- package/lib/module/renderer/components/shapes/DiffRect.js +1 -17
- package/lib/module/renderer/components/shapes/DiffRect.js.map +1 -1
- package/lib/module/renderer/components/shapes/Fill.js +1 -13
- package/lib/module/renderer/components/shapes/Fill.js.map +1 -1
- package/lib/module/renderer/components/shapes/FitBox.js +1 -1
- package/lib/module/renderer/components/shapes/FitBox.js.map +1 -1
- package/lib/module/renderer/components/shapes/Line.js +1 -17
- package/lib/module/renderer/components/shapes/Line.js.map +1 -1
- package/lib/module/renderer/components/shapes/Oval.js +1 -16
- package/lib/module/renderer/components/shapes/Oval.js.map +1 -1
- package/lib/module/renderer/components/shapes/Patch.js +1 -32
- package/lib/module/renderer/components/shapes/Patch.js.map +1 -1
- package/lib/module/renderer/components/shapes/Path.js +1 -43
- package/lib/module/renderer/components/shapes/Path.js.map +1 -1
- package/lib/module/renderer/components/shapes/Points.js +1 -20
- package/lib/module/renderer/components/shapes/Points.js.map +1 -1
- package/lib/module/renderer/components/shapes/Rect.js +1 -16
- package/lib/module/renderer/components/shapes/Rect.js.map +1 -1
- package/lib/module/renderer/components/shapes/RoundedRect.js +1 -16
- package/lib/module/renderer/components/shapes/RoundedRect.js.map +1 -1
- package/lib/module/renderer/components/shapes/Vertices.js +1 -31
- package/lib/module/renderer/components/shapes/Vertices.js.map +1 -1
- package/lib/module/renderer/components/text/Glyphs.js +1 -37
- package/lib/module/renderer/components/text/Glyphs.js.map +1 -1
- package/lib/module/renderer/components/text/Text.js +1 -22
- package/lib/module/renderer/components/text/Text.js.map +1 -1
- package/lib/module/renderer/components/text/TextBlob.js +1 -18
- package/lib/module/renderer/components/text/TextBlob.js.map +1 -1
- package/lib/module/renderer/components/text/TextPath.js +1 -69
- package/lib/module/renderer/components/text/TextPath.js.map +1 -1
- package/lib/module/renderer/index.js +0 -1
- package/lib/module/renderer/index.js.map +1 -1
- package/lib/module/renderer/processors/Animations/Animations.js.map +1 -1
- package/lib/module/renderer/processors/index.js +0 -9
- package/lib/module/renderer/processors/index.js.map +1 -1
- package/lib/module/web/WithSkiaWeb.js +3 -1
- package/lib/module/web/WithSkiaWeb.js.map +1 -1
- package/lib/typescript/src/dom/nodes/DrawingNode.d.ts +14 -0
- package/lib/typescript/src/dom/nodes/GroupNode.d.ts +8 -0
- package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +70 -0
- package/lib/typescript/src/dom/nodes/Node.d.ts +43 -0
- package/lib/typescript/src/dom/nodes/PaintContext.d.ts +18 -0
- package/lib/typescript/src/dom/nodes/PaintNode.d.ts +8 -0
- package/lib/typescript/src/dom/nodes/RenderNode.d.ts +29 -0
- package/lib/typescript/src/dom/nodes/datatypes/Circle.d.ts +4 -0
- package/lib/typescript/src/{renderer/processors → dom/nodes/datatypes}/Color.d.ts +1 -1
- package/lib/typescript/src/dom/nodes/datatypes/Enum.d.ts +1 -0
- package/lib/typescript/src/{renderer/components/image/BoxFit.d.ts → dom/nodes/datatypes/Fitting.d.ts} +1 -1
- package/lib/typescript/src/{renderer/processors/Transform.d.ts → dom/nodes/datatypes/Gradient.d.ts} +11 -9
- package/lib/typescript/src/dom/nodes/datatypes/Path.d.ts +4 -0
- package/lib/typescript/src/dom/nodes/datatypes/Radius.d.ts +3 -0
- package/lib/typescript/src/dom/nodes/datatypes/Rect.d.ts +5 -0
- package/lib/typescript/src/dom/nodes/datatypes/Transform.d.ts +3 -0
- package/lib/typescript/src/dom/nodes/datatypes/index.d.ts +9 -0
- package/lib/typescript/src/dom/nodes/drawings/BackdropFilterNode.d.ts +8 -0
- package/lib/typescript/src/dom/nodes/drawings/Box.d.ts +13 -0
- package/lib/typescript/src/dom/nodes/drawings/CircleNode.d.ts +9 -0
- package/lib/typescript/src/dom/nodes/drawings/CustomDrawingNode.d.ts +8 -0
- package/lib/typescript/src/dom/nodes/drawings/DiffRectNode.d.ts +8 -0
- package/lib/typescript/src/dom/nodes/drawings/FillNode.d.ts +8 -0
- package/lib/typescript/src/dom/nodes/drawings/ImageNode.d.ts +25 -0
- package/lib/typescript/src/dom/nodes/drawings/ImageSVG.d.ts +8 -0
- package/lib/typescript/src/dom/nodes/drawings/LineNode.d.ts +8 -0
- package/lib/typescript/src/dom/nodes/drawings/OvalNode.d.ts +9 -0
- package/lib/typescript/src/dom/nodes/drawings/PatchNode.d.ts +18 -0
- package/lib/typescript/src/dom/nodes/drawings/PathNode.d.ts +9 -0
- package/lib/typescript/src/dom/nodes/drawings/PictureNode.d.ts +8 -0
- package/lib/typescript/src/dom/nodes/drawings/PointsNode.d.ts +8 -0
- package/lib/typescript/src/dom/nodes/drawings/RRectNode.d.ts +10 -0
- package/lib/typescript/src/dom/nodes/drawings/RectNode.d.ts +9 -0
- package/lib/typescript/src/dom/nodes/drawings/Text.d.ts +30 -0
- package/lib/typescript/src/dom/nodes/drawings/VerticesNode.d.ts +9 -0
- package/lib/typescript/src/dom/nodes/drawings/index.d.ts +18 -0
- package/lib/typescript/src/dom/nodes/index.d.ts +3 -0
- package/lib/typescript/src/dom/nodes/paint/BlendNode.d.ts +12 -0
- package/lib/typescript/src/dom/nodes/paint/ColorFilters.d.ts +36 -0
- package/lib/typescript/src/dom/nodes/paint/ImageFilters.d.ts +42 -0
- package/lib/typescript/src/dom/nodes/paint/MaskFilters.d.ts +8 -0
- package/lib/typescript/src/dom/nodes/paint/PathEffects.d.ts +42 -0
- package/lib/typescript/src/dom/nodes/paint/Shaders.d.ts +44 -0
- package/lib/typescript/src/dom/nodes/paint/index.d.ts +6 -0
- package/lib/typescript/src/dom/types/ColorFilters.d.ts +12 -0
- package/lib/typescript/src/dom/types/Common.d.ts +57 -0
- package/lib/typescript/src/dom/types/DrawingContext.d.ts +6 -0
- package/lib/typescript/src/dom/types/Drawings.d.ts +106 -0
- package/lib/typescript/src/dom/types/ImageFilters.d.ts +37 -0
- package/lib/typescript/src/dom/types/MaskFilters.d.ts +7 -0
- package/lib/typescript/src/dom/types/Node.d.ts +29 -0
- package/lib/typescript/src/dom/types/NodeType.d.ts +66 -0
- package/lib/typescript/src/dom/types/PathEffects.d.ts +28 -0
- package/lib/typescript/src/dom/types/Shaders.d.ts +59 -0
- package/lib/typescript/src/dom/types/SkDOM.d.ts +71 -0
- package/lib/typescript/src/dom/types/index.d.ts +11 -0
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/renderer/Canvas.d.ts +3 -3
- package/lib/typescript/src/renderer/Container.d.ts +12 -0
- package/lib/typescript/src/renderer/DependencyManager.d.ts +5 -4
- package/lib/typescript/src/renderer/HostComponents.d.ts +72 -0
- package/lib/typescript/src/renderer/HostConfig.d.ts +5 -13
- package/lib/typescript/src/renderer/components/Blend.d.ts +4 -9
- package/lib/typescript/src/renderer/components/Drawing.d.ts +2 -6
- package/lib/typescript/src/renderer/components/Group.d.ts +4 -9
- package/lib/typescript/src/renderer/components/Paint.d.ts +4 -8
- package/lib/typescript/src/renderer/components/Picture.d.ts +3 -5
- package/lib/typescript/src/renderer/components/backdrop/BackdropBlur.d.ts +2 -1
- package/lib/typescript/src/renderer/components/backdrop/BackdropFilter.d.ts +3 -3
- package/lib/typescript/src/renderer/components/colorFilters/BlendColor.d.ts +4 -10
- package/lib/typescript/src/renderer/components/colorFilters/Lerp.d.ts +4 -7
- package/lib/typescript/src/renderer/components/colorFilters/LinearToSRGBGamma.d.ts +3 -4
- package/lib/typescript/src/renderer/components/colorFilters/LumaColorFilter.d.ts +3 -4
- package/lib/typescript/src/renderer/components/colorFilters/Matrix.d.ts +4 -8
- package/lib/typescript/src/renderer/components/colorFilters/SRGBToLinearGamma.d.ts +3 -4
- package/lib/typescript/src/renderer/components/image/Image.d.ts +3 -11
- package/lib/typescript/src/renderer/components/image/ImageSVG.d.ts +2 -5
- package/lib/typescript/src/renderer/components/image/ImageShader.d.ts +3 -15
- package/lib/typescript/src/renderer/components/image/index.d.ts +0 -1
- package/lib/typescript/src/renderer/components/imageFilters/Blur.d.ts +4 -10
- package/lib/typescript/src/renderer/components/imageFilters/DisplacementMap.d.ts +4 -10
- package/lib/typescript/src/renderer/components/imageFilters/Morphology.d.ts +4 -8
- package/lib/typescript/src/renderer/components/imageFilters/Offset.d.ts +4 -8
- package/lib/typescript/src/renderer/components/imageFilters/RuntimeShader.d.ts +3 -7
- package/lib/typescript/src/renderer/components/imageFilters/Shadow.d.ts +3 -11
- package/lib/typescript/src/renderer/components/index.d.ts +0 -1
- package/lib/typescript/src/renderer/components/maskFilters/Blur.d.ts +3 -9
- package/lib/typescript/src/renderer/components/pathEffects/Corner.d.ts +4 -7
- package/lib/typescript/src/renderer/components/pathEffects/Dash.d.ts +4 -8
- package/lib/typescript/src/renderer/components/pathEffects/Discrete.d.ts +4 -9
- package/lib/typescript/src/renderer/components/pathEffects/Line2D.d.ts +4 -9
- package/lib/typescript/src/renderer/components/pathEffects/Path1D.d.ts +4 -13
- package/lib/typescript/src/renderer/components/pathEffects/Path2D.d.ts +4 -10
- package/lib/typescript/src/renderer/components/pathEffects/Sum.d.ts +3 -6
- package/lib/typescript/src/renderer/components/shaders/Color.d.ts +3 -6
- package/lib/typescript/src/renderer/components/shaders/FractalNoise.d.ts +3 -10
- package/lib/typescript/src/renderer/components/shaders/LinearGradient.d.ts +3 -8
- package/lib/typescript/src/renderer/components/shaders/RadialGradient.d.ts +3 -8
- package/lib/typescript/src/renderer/components/shaders/Shader.d.ts +4 -9
- package/lib/typescript/src/renderer/components/shaders/SweepGradient.d.ts +3 -9
- package/lib/typescript/src/renderer/components/shaders/Turbulence.d.ts +3 -10
- package/lib/typescript/src/renderer/components/shaders/TwoPointConicalGradient.d.ts +3 -10
- package/lib/typescript/src/renderer/components/shapes/Box.d.ts +4 -21
- package/lib/typescript/src/renderer/components/shapes/Circle.d.ts +3 -3
- package/lib/typescript/src/renderer/components/shapes/DiffRect.d.ts +3 -8
- package/lib/typescript/src/renderer/components/shapes/Fill.d.ts +3 -4
- package/lib/typescript/src/renderer/components/shapes/FitBox.d.ts +1 -1
- package/lib/typescript/src/renderer/components/shapes/Line.d.ts +3 -7
- package/lib/typescript/src/renderer/components/shapes/Oval.d.ts +3 -3
- package/lib/typescript/src/renderer/components/shapes/Patch.d.ts +3 -20
- package/lib/typescript/src/renderer/components/shapes/Path.d.ts +3 -16
- package/lib/typescript/src/renderer/components/shapes/Points.d.ts +3 -9
- package/lib/typescript/src/renderer/components/shapes/Rect.d.ts +3 -3
- package/lib/typescript/src/renderer/components/shapes/RoundedRect.d.ts +3 -3
- package/lib/typescript/src/renderer/components/shapes/Vertices.d.ts +3 -12
- package/lib/typescript/src/renderer/components/text/Glyphs.d.ts +3 -13
- package/lib/typescript/src/renderer/components/text/Text.d.ts +3 -8
- package/lib/typescript/src/renderer/components/text/TextBlob.d.ts +3 -8
- package/lib/typescript/src/renderer/components/text/TextPath.d.ts +3 -9
- package/lib/typescript/src/renderer/index.d.ts +0 -1
- package/lib/typescript/src/renderer/processors/Animations/Animations.d.ts +1 -0
- package/lib/typescript/src/renderer/processors/index.d.ts +0 -9
- package/package.json +1 -1
- package/src/dom/nodes/DrawingNode.ts +72 -0
- package/src/dom/nodes/GroupNode.ts +23 -0
- package/src/dom/nodes/JsiSkDOM.ts +353 -0
- package/src/dom/nodes/Node.ts +158 -0
- package/src/dom/nodes/PaintContext.ts +30 -0
- package/src/dom/nodes/PaintNode.ts +77 -0
- package/src/dom/nodes/RenderNode.ts +349 -0
- package/src/{renderer/processors/Circles.ts → dom/nodes/datatypes/Circle.ts} +3 -15
- package/src/{renderer/processors → dom/nodes/datatypes}/Color.ts +1 -1
- package/src/dom/nodes/datatypes/Enum.ts +2 -0
- package/src/{renderer/components/image/BoxFit.ts → dom/nodes/datatypes/Fitting.ts} +2 -11
- package/src/dom/nodes/datatypes/Gradient.ts +48 -0
- package/src/{renderer/processors/Paths.ts → dom/nodes/datatypes/Path.ts} +3 -4
- package/src/{renderer/processors → dom/nodes/datatypes}/Radius.ts +2 -3
- package/src/{renderer/processors/Rects.ts → dom/nodes/datatypes/Rect.ts} +2 -16
- package/src/dom/nodes/datatypes/Transform.ts +26 -0
- package/src/dom/nodes/datatypes/index.ts +9 -0
- package/src/dom/nodes/drawings/BackdropFilterNode.ts +30 -0
- package/src/dom/nodes/drawings/Box.ts +105 -0
- package/src/dom/nodes/drawings/CircleNode.ts +24 -0
- package/src/dom/nodes/drawings/CustomDrawingNode.ts +21 -0
- package/src/dom/nodes/drawings/DiffRectNode.ts +19 -0
- package/src/dom/nodes/drawings/FillNode.ts +18 -0
- package/src/dom/nodes/drawings/ImageNode.ts +40 -0
- package/src/dom/nodes/drawings/ImageSVG.ts +24 -0
- package/src/dom/nodes/drawings/LineNode.ts +19 -0
- package/src/dom/nodes/drawings/OvalNode.ts +23 -0
- package/src/dom/nodes/drawings/PatchNode.ts +68 -0
- package/src/dom/nodes/drawings/PathNode.ts +42 -0
- package/src/dom/nodes/drawings/PictureNode.ts +19 -0
- package/src/dom/nodes/drawings/PointsNode.ts +21 -0
- package/src/dom/nodes/drawings/RRectNode.ts +25 -0
- package/src/dom/nodes/drawings/RectNode.ts +23 -0
- package/src/dom/nodes/drawings/Text.ts +122 -0
- package/src/dom/nodes/drawings/VerticesNode.ts +35 -0
- package/src/dom/nodes/drawings/index.ts +18 -0
- package/src/dom/nodes/index.ts +3 -0
- package/src/dom/nodes/paint/BlendNode.ts +79 -0
- package/src/dom/nodes/paint/ColorFilters.ts +130 -0
- package/src/dom/nodes/paint/ImageFilters.ts +210 -0
- package/src/dom/nodes/paint/MaskFilters.ts +25 -0
- package/src/dom/nodes/paint/PathEffects.ts +192 -0
- package/src/dom/nodes/paint/Shaders.ts +228 -0
- package/src/dom/nodes/paint/index.ts +6 -0
- package/src/dom/types/ColorFilters.ts +16 -0
- package/src/dom/types/Common.ts +90 -0
- package/src/dom/types/DrawingContext.ts +7 -0
- package/src/dom/types/Drawings.ts +157 -0
- package/src/dom/types/ImageFilters.ts +53 -0
- package/src/dom/types/MaskFilters.ts +9 -0
- package/src/dom/types/Node.ts +46 -0
- package/src/dom/types/NodeType.ts +80 -0
- package/src/dom/types/PathEffects.ts +35 -0
- package/src/dom/types/Shaders.ts +86 -0
- package/src/dom/types/SkDOM.ts +202 -0
- package/src/dom/types/index.ts +11 -0
- package/src/index.ts +2 -0
- package/src/renderer/Canvas.tsx +7 -6
- package/src/renderer/Container.tsx +31 -0
- package/src/renderer/DependencyManager.tsx +23 -15
- package/src/renderer/HostComponents.ts +269 -0
- package/src/renderer/HostConfig.ts +60 -123
- package/src/renderer/components/Blend.tsx +4 -45
- package/src/renderer/components/Drawing.tsx +3 -12
- package/src/renderer/components/Group.tsx +4 -79
- package/src/renderer/components/Paint.tsx +7 -24
- package/src/renderer/components/Picture.tsx +4 -13
- package/src/renderer/components/backdrop/BackdropBlur.tsx +2 -1
- package/src/renderer/components/backdrop/BackdropFilter.tsx +5 -29
- package/src/renderer/components/colorFilters/BlendColor.tsx +4 -26
- package/src/renderer/components/colorFilters/Lerp.tsx +4 -23
- package/src/renderer/components/colorFilters/LinearToSRGBGamma.tsx +4 -16
- package/src/renderer/components/colorFilters/LumaColorFilter.tsx +4 -14
- package/src/renderer/components/colorFilters/Matrix.tsx +4 -19
- package/src/renderer/components/colorFilters/SRGBToLinearGamma.tsx +4 -16
- package/src/renderer/components/image/Image.tsx +4 -40
- package/src/renderer/components/image/ImageSVG.tsx +3 -19
- package/src/renderer/components/image/ImageShader.tsx +4 -69
- package/src/renderer/components/image/index.ts +0 -1
- package/src/renderer/components/imageFilters/Blur.tsx +4 -29
- package/src/renderer/components/imageFilters/DisplacementMap.tsx +6 -30
- package/src/renderer/components/imageFilters/Morphology.tsx +4 -25
- package/src/renderer/components/imageFilters/Offset.tsx +4 -19
- package/src/renderer/components/imageFilters/RuntimeShader.tsx +6 -27
- package/src/renderer/components/imageFilters/Shadow.tsx +4 -38
- package/src/renderer/components/index.ts +0 -1
- package/src/renderer/components/maskFilters/Blur.tsx +4 -23
- package/src/renderer/components/pathEffects/Corner.tsx +4 -27
- package/src/renderer/components/pathEffects/Dash.tsx +4 -23
- package/src/renderer/components/pathEffects/Discrete.tsx +4 -24
- package/src/renderer/components/pathEffects/Line2D.tsx +4 -29
- package/src/renderer/components/pathEffects/Path1D.tsx +4 -39
- package/src/renderer/components/pathEffects/Path2D.tsx +4 -31
- package/src/renderer/components/pathEffects/Sum.tsx +3 -17
- package/src/renderer/components/shaders/Color.tsx +4 -16
- package/src/renderer/components/shaders/FractalNoise.tsx +4 -26
- package/src/renderer/components/shaders/LinearGradient.tsx +4 -29
- package/src/renderer/components/shaders/RadialGradient.tsx +4 -29
- package/src/renderer/components/shaders/Shader.tsx +4 -24
- package/src/renderer/components/shaders/SweepGradient.tsx +4 -32
- package/src/renderer/components/shaders/Turbulence.tsx +4 -26
- package/src/renderer/components/shaders/TwoPointConicalGradient.tsx +4 -33
- package/src/renderer/components/shapes/Box.tsx +6 -109
- package/src/renderer/components/shapes/Circle.tsx +4 -16
- package/src/renderer/components/shapes/DiffRect.tsx +4 -17
- package/src/renderer/components/shapes/Fill.tsx +4 -11
- package/src/renderer/components/shapes/FitBox.tsx +2 -2
- package/src/renderer/components/shapes/Line.tsx +4 -13
- package/src/renderer/components/shapes/Oval.tsx +4 -18
- package/src/renderer/components/shapes/Patch.tsx +4 -59
- package/src/renderer/components/shapes/Path.tsx +4 -48
- package/src/renderer/components/shapes/Points.tsx +4 -20
- package/src/renderer/components/shapes/Rect.tsx +4 -18
- package/src/renderer/components/shapes/RoundedRect.tsx +4 -17
- package/src/renderer/components/shapes/Vertices.tsx +4 -37
- package/src/renderer/components/text/Glyphs.tsx +4 -39
- package/src/renderer/components/text/Text.tsx +4 -22
- package/src/renderer/components/text/TextBlob.tsx +4 -17
- package/src/renderer/components/text/TextPath.tsx +4 -59
- package/src/renderer/index.ts +0 -1
- package/src/renderer/processors/Animations/Animations.ts +5 -0
- package/src/renderer/processors/index.ts +0 -9
- package/src/web/WithSkiaWeb.tsx +3 -1
- package/lib/commonjs/renderer/components/Compose.js +0 -40
- package/lib/commonjs/renderer/components/Compose.js.map +0 -1
- package/lib/commonjs/renderer/components/colorFilters/Compose.js +0 -24
- package/lib/commonjs/renderer/components/colorFilters/Compose.js.map +0 -1
- package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js +0 -28
- package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js.map +0 -1
- package/lib/commonjs/renderer/components/imageFilters/getInput.js +0 -33
- package/lib/commonjs/renderer/components/imageFilters/getInput.js.map +0 -1
- package/lib/commonjs/renderer/components/shaders/Gradient.js +0 -32
- package/lib/commonjs/renderer/components/shaders/Gradient.js.map +0 -1
- package/lib/commonjs/renderer/nodes/Container.js +0 -28
- package/lib/commonjs/renderer/nodes/Container.js.map +0 -1
- package/lib/commonjs/renderer/nodes/Declaration.js +0 -57
- package/lib/commonjs/renderer/nodes/Declaration.js.map +0 -1
- package/lib/commonjs/renderer/nodes/Drawing.js +0 -56
- package/lib/commonjs/renderer/nodes/Drawing.js.map +0 -1
- package/lib/commonjs/renderer/nodes/Node.js +0 -73
- package/lib/commonjs/renderer/nodes/Node.js.map +0 -1
- package/lib/commonjs/renderer/nodes/index.js +0 -58
- package/lib/commonjs/renderer/nodes/index.js.map +0 -1
- package/lib/commonjs/renderer/processors/Circles.js.map +0 -1
- package/lib/commonjs/renderer/processors/Clips.js +0 -24
- package/lib/commonjs/renderer/processors/Clips.js.map +0 -1
- package/lib/commonjs/renderer/processors/Font.js +0 -13
- package/lib/commonjs/renderer/processors/Font.js.map +0 -1
- package/lib/commonjs/renderer/processors/Paint.js +0 -98
- package/lib/commonjs/renderer/processors/Paint.js.map +0 -1
- package/lib/commonjs/renderer/processors/Paths.js.map +0 -1
- package/lib/commonjs/renderer/processors/Radius.js.map +0 -1
- package/lib/commonjs/renderer/processors/Rects.js.map +0 -1
- package/lib/commonjs/renderer/processors/Transform.js +0 -58
- package/lib/commonjs/renderer/processors/Transform.js.map +0 -1
- package/lib/module/renderer/components/Compose.js +0 -25
- package/lib/module/renderer/components/Compose.js.map +0 -1
- package/lib/module/renderer/components/colorFilters/Compose.js +0 -14
- package/lib/module/renderer/components/colorFilters/Compose.js.map +0 -1
- package/lib/module/renderer/components/imageFilters/InnerShadow.js +0 -17
- package/lib/module/renderer/components/imageFilters/InnerShadow.js.map +0 -1
- package/lib/module/renderer/components/imageFilters/getInput.js +0 -23
- package/lib/module/renderer/components/imageFilters/getInput.js.map +0 -1
- package/lib/module/renderer/components/shaders/Gradient.js +0 -20
- package/lib/module/renderer/components/shaders/Gradient.js.map +0 -1
- package/lib/module/renderer/nodes/Container.js +0 -18
- package/lib/module/renderer/nodes/Container.js.map +0 -1
- package/lib/module/renderer/nodes/Declaration.js +0 -36
- package/lib/module/renderer/nodes/Declaration.js.map +0 -1
- package/lib/module/renderer/nodes/Drawing.js +0 -37
- package/lib/module/renderer/nodes/Drawing.js.map +0 -1
- package/lib/module/renderer/nodes/Node.js +0 -63
- package/lib/module/renderer/nodes/Node.js.map +0 -1
- package/lib/module/renderer/nodes/index.js +0 -5
- package/lib/module/renderer/nodes/index.js.map +0 -1
- package/lib/module/renderer/processors/Circles.js.map +0 -1
- package/lib/module/renderer/processors/Clips.js +0 -13
- package/lib/module/renderer/processors/Clips.js.map +0 -1
- package/lib/module/renderer/processors/Font.js +0 -4
- package/lib/module/renderer/processors/Font.js.map +0 -1
- package/lib/module/renderer/processors/Paint.js +0 -84
- package/lib/module/renderer/processors/Paint.js.map +0 -1
- package/lib/module/renderer/processors/Paths.js.map +0 -1
- package/lib/module/renderer/processors/Radius.js.map +0 -1
- package/lib/module/renderer/processors/Rects.js.map +0 -1
- package/lib/module/renderer/processors/Transform.js +0 -42
- package/lib/module/renderer/processors/Transform.js.map +0 -1
- package/lib/typescript/src/renderer/components/Compose.d.ts +0 -6
- package/lib/typescript/src/renderer/components/colorFilters/Compose.d.ts +0 -3
- package/lib/typescript/src/renderer/components/imageFilters/InnerShadow.d.ts +0 -2
- package/lib/typescript/src/renderer/components/imageFilters/getInput.d.ts +0 -3
- package/lib/typescript/src/renderer/components/shaders/Gradient.d.ts +0 -17
- package/lib/typescript/src/renderer/nodes/Container.d.ts +0 -8
- package/lib/typescript/src/renderer/nodes/Declaration.d.ts +0 -22
- package/lib/typescript/src/renderer/nodes/Drawing.d.ts +0 -21
- package/lib/typescript/src/renderer/nodes/Node.d.ts +0 -24
- package/lib/typescript/src/renderer/nodes/index.d.ts +0 -4
- package/lib/typescript/src/renderer/processors/Circles.d.ts +0 -13
- package/lib/typescript/src/renderer/processors/Clips.d.ts +0 -4
- package/lib/typescript/src/renderer/processors/Font.d.ts +0 -7
- package/lib/typescript/src/renderer/processors/Paint.d.ts +0 -22
- package/lib/typescript/src/renderer/processors/Paths.d.ts +0 -4
- package/lib/typescript/src/renderer/processors/Radius.d.ts +0 -3
- package/lib/typescript/src/renderer/processors/Rects.d.ts +0 -20
- package/src/renderer/components/Compose.tsx +0 -26
- package/src/renderer/components/colorFilters/Compose.ts +0 -18
- package/src/renderer/components/imageFilters/InnerShadow.tsx +0 -38
- package/src/renderer/components/imageFilters/getInput.ts +0 -20
- package/src/renderer/components/shaders/Gradient.ts +0 -24
- package/src/renderer/nodes/Container.tsx +0 -17
- package/src/renderer/nodes/Declaration.tsx +0 -65
- package/src/renderer/nodes/Drawing.tsx +0 -65
- package/src/renderer/nodes/Node.ts +0 -59
- package/src/renderer/nodes/index.ts +0 -4
- package/src/renderer/processors/Clips.ts +0 -23
- package/src/renderer/processors/Font.ts +0 -8
- package/src/renderer/processors/Paint.ts +0 -118
- package/src/renderer/processors/Transform.ts +0 -50
@@ -12,6 +12,10 @@ export class DependencyManager {
|
|
12
12
|
|
13
13
|
this.registerValues = registerValues;
|
14
14
|
}
|
15
|
+
|
16
|
+
unsubscribeNodes(nodes) {
|
17
|
+
nodes.forEach(n => this.unsubscribeNode(n));
|
18
|
+
}
|
15
19
|
/**
|
16
20
|
* Call to unsubscribe all value listeners from the given node based
|
17
21
|
* on the current list of subscriptions for the node. This function
|
@@ -139,27 +143,35 @@ export class DependencyManager {
|
|
139
143
|
const initializePropertySubscriptions = (node, props) => {
|
140
144
|
const nodePropSubscriptions = [];
|
141
145
|
mapKeys(props).forEach(key => {
|
146
|
+
if (key === "children") {
|
147
|
+
return;
|
148
|
+
}
|
149
|
+
|
142
150
|
const propvalue = props[key];
|
143
151
|
|
144
152
|
if (isValue(propvalue)) {
|
145
153
|
// Subscribe to changes
|
146
154
|
nodePropSubscriptions.push({
|
147
155
|
value: propvalue,
|
148
|
-
mutator: v =>
|
156
|
+
mutator: v => {
|
157
|
+
node.setProp(key, v);
|
158
|
+
}
|
149
159
|
}); // Set initial value
|
150
160
|
|
151
|
-
node.
|
161
|
+
node.setProp(key, propvalue.current);
|
152
162
|
} else if (isSelector(propvalue)) {
|
153
163
|
// Subscribe to changes
|
154
164
|
nodePropSubscriptions.push({
|
155
165
|
value: propvalue.value,
|
156
|
-
mutator: v =>
|
166
|
+
mutator: v => {
|
167
|
+
node.setProp(key, propvalue.selector(v));
|
168
|
+
}
|
157
169
|
}); // Set initial value
|
158
170
|
|
159
|
-
node.
|
171
|
+
node.setProp(key, propvalue.selector(propvalue.value.current));
|
160
172
|
} else {
|
161
173
|
// Set initial value
|
162
|
-
node.
|
174
|
+
node.setProp(key, propvalue);
|
163
175
|
}
|
164
176
|
});
|
165
177
|
return nodePropSubscriptions;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["DependencyManager.tsx"],"names":["isSelector","isValue","mapKeys","DependencyManager","constructor","registerValues","Map","unsubscribeNode","node","subscriptions","Array","from","values","filter","p","nodes","has","forEach","si","delete","size","unsubscribe","Error","element","entries","find","_","sub","subscribeNode","props","propSubscriptions","initializePropertySubscriptions","length","ps","subscriptionState","get","value","addListener","v","mutators","m","set","map","mutator","update","unregisterDependantValues","keys","remove","clear","nodePropSubscriptions","key","propvalue","push","resolvedProps","current","selector"],"mappings":";;AAIA,SAASA,UAAT,EAAqBC,OAArB,QAAoC,cAApC;AACA,SAASC,OAAT,QAAwB,aAAxB;AAUA,OAAO,MAAMC,iBAAN,CAAwB;AAK7BC,EAAAA,WAAW,CACTC,cADS,EAET;AAAA;;AAAA,2CAL0D,IAAIC,GAAJ,EAK1D;;AAAA,uDAJ8C,IAI9C;;AACA,SAAKD,cAAL,GAAsBA,cAAtB;AACD;AAED;AACF;AACA;AACA;AACA;AACA;AACA;;;AACEE,EAAAA,eAAe,CAACC,IAAD,EAAa;AAC1B,UAAMC,aAAa,GAAGC,KAAK,CAACC,IAAN,CAAW,KAAKF,aAAL,CAAmBG,MAAnB,EAAX,EAAwCC,MAAxC,CAAgDC,CAAD,IACnEA,CAAC,CAACC,KAAF,CAAQC,GAAR,CAAYR,IAAZ,CADoB,CAAtB;;AAIA,QAAIC,aAAJ,EAAmB;AACjBA,MAAAA,aAAa,CAACQ,OAAd,CAAuBC,EAAD,IAAQ;AAC5B;AACAA,QAAAA,EAAE,CAACH,KAAH,CAASI,MAAT,CAAgBX,IAAhB,EAF4B,CAI5B;;AACA,YAAIU,EAAE,CAACH,KAAH,CAASK,IAAT,KAAkB,CAAtB,EAAyB;AACvB;AACA;AACA,cAAI,CAACF,EAAE,CAACG,WAAR,EAAqB;AACnB,kBAAM,IAAIC,KAAJ,CAAU,6CAAV,CAAN;AACD;;AACDJ,UAAAA,EAA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AxI4B;;AA2I/B,MAAMjB,+BAA+B,GAAG,CACtCvB,IADsC,EAEtCqB,KAFsC,KAGnC;AACH,QAAMoB,qBAGJ,GAAG,EAHL;AAKA/C,EAAAA,OAAO,CAAC2B,KAAD,CAAP,CAAeZ,OAAf,CAAwBiC,GAAD,IAAS;AAC9B,UAAMC,SAAS,GAAGtB,KAAK,CAACqB,GAAD,CAAvB;;AAEA,QAAIjD,OAAO,CAACkD,SAAD,CAAX,EAAwB;AACtB;AACAF,MAAAA,qBAAqB,CAACG,IAAtB,CAA2B;AACzBhB,QAAAA,KAAK,EAAEe,SADkB;AAEzBR,QAAAA,OAAO,EAAGL,CAAD,IAAQ9B,IAAI,CAAC6C,aAAL,CAAmBH,GAAnB,IAA0BZ;AAFlB,OAA3B,EAFsB,CAMtB;;AACA9B,MAAAA,IAAI,CAAC6C,aAAL,CAAmBH,GAAnB,IAA2BC,SAAD,CAAwCG,OAAlE;AACD,KARD,MAQO,IAAItD,UAAU,CAACmD,SAAD,CAAd,EAA2B;AAChC;AACAF,MAAAA,qBAAqB,CAACG,IAAtB,CAA2B;AACzBhB,QAAAA,KAAK,EAAEe,SAAS,CAACf,KADQ;AAEzBO,QAAAA,OAAO,EAAGL,CAAD,IACN9B,IAAI,CAAC6C,aAAL,CAAmBH,GAAnB,IAA0BC,SAAS,CAACI,QAAV,CAAmBjB,CAAnB;AAHJ,OAA3B,EAFgC,CAOhC;;AACA9B,MAAAA,IAAI,CAAC6C,aAAL,CAAmBH,GAAnB,IAA0BC,SAAS,CAACI,QAAV,CACxBJ,SAAS,CAACf,KAAV,CAAgBkB,OADQ,CAA1B;AAGD,KAXM,MAWA;AACL;AACA9C,MAAAA,IAAI,CAAC6C,aAAL,CAAmBH,GAAnB,IAA0BC,SAA1B;AACD;AACF,GA1BD;AA4BA,SAAOF,qBAAP;AACD,CAtCD","sourcesContent":["import type { SkiaValue } from \"../values\";\n\nimport type { Node } from \"./nodes\";\nimport type { AnimatedProps } from \"./processors\";\nimport { isSelector, isValue } from \"./processors\";\nimport { mapKeys } from \"./typeddash\";\n\ntype Unsubscribe = () => void;\ntype Mutator = (value: unknown) => void;\n\ntype SubscriptionState = {\n nodes: Map<Node, Mutator[]>;\n unsubscribe: null | Unsubscribe;\n};\n\nexport class DependencyManager {\n registerValues: (values: Array<SkiaValue<unknown>>) => () => void;\n subscriptions: Map<SkiaValue<unknown>, SubscriptionState> = new Map();\n unregisterDependantValues: null | Unsubscribe = null;\n\n constructor(\n registerValues: (values: Array<SkiaValue<unknown>>) => () => void\n ) {\n this.registerValues = registerValues;\n }\n\n /**\n * Call to unsubscribe all value listeners from the given node based\n * on the current list of subscriptions for the node. This function\n * is typically called when the node is unmounted or when one or more\n * properties have changed.\n * @param node Node to unsubscribe value listeners from\n */\n unsubscribeNode(node: Node) {\n const subscriptions = Array.from(this.subscriptions.values()).filter((p) =>\n p.nodes.has(node)\n );\n\n if (subscriptions) {\n subscriptions.forEach((si) => {\n // Delete node from subscription\n si.nodes.delete(node);\n\n // Remove subscription if there are no listeneres left on the value\n if (si.nodes.size === 0) {\n // There are no more nodes subscribing to this value, we can call\n // unsubscribe on it.\n if (!si.unsubscribe) {\n throw new Error(\"Failed to unsubscribe to value subscription\");\n }\n si.unsubscribe && si.unsubscribe();\n\n // Remove from subscription states as well\n const element = Array.from(this.subscriptions.entries()).find(\n ([_, sub]) => sub === si\n );\n if (!element) {\n throw new Error(\"Failed to find value subscription\");\n }\n if (!this.subscriptions.delete(element[0])) {\n throw new Error(\"Failed to delete value subscription\");\n }\n }\n });\n }\n }\n\n /**\n * Adds listeners to the provided values so that the node is notified\n * when a value changes. This is done in an optimized way so that this\n * class only needs to listen to the value once and then forwards the\n * change to the node and its listener. This method is typically called\n * when the node is mounted and when one or more props on the node changes.\n * @param node Node to subscribe to value changes for\n * @param props Node's properties\n * @param onResolveProp Callback when a property value changes\n */\n subscribeNode<P extends Record<string, unknown>>(\n node: Node,\n props: AnimatedProps<P>\n ) {\n // Get mutators from node's properties\n const propSubscriptions = initializePropertySubscriptions(node, props);\n if (propSubscriptions.length === 0) {\n return;\n }\n\n // Install all mutators for the node\n propSubscriptions.forEach((ps) => {\n // Do we already have a state for this SkiaValue\n let subscriptionState = this.subscriptions.get(ps.value);\n if (!subscriptionState) {\n // Let's create a new subscription state for the skia value\n subscriptionState = {\n nodes: new Map(),\n unsubscribe: null,\n };\n // Add single subscription to the new value\n subscriptionState.unsubscribe = ps.value.addListener((v) => {\n subscriptionState!.nodes.forEach((mutators) =>\n mutators.forEach((m) => m(v))\n );\n });\n this.subscriptions.set(ps.value, subscriptionState);\n }\n // subscription mutators\n subscriptionState.nodes.set(\n node,\n propSubscriptions\n .filter((m) => m.value === ps.value)\n .map((m) => m.mutator)\n );\n });\n }\n\n /**\n * Called when the hosting container is mounted or updated. This ensures that we have\n * a ref to the underlying SkiaView so that we can registers redraw listeners\n * on values used in the current View automatically.\n */\n update() {\n // Remove any previous registrations\n if (this.unregisterDependantValues) {\n this.unregisterDependantValues();\n }\n\n // Register redraw requests on the SkiaView for each unique value\n this.unregisterDependantValues = this.registerValues(\n Array.from(this.subscriptions.keys())\n );\n }\n\n /**\n * Called when the hosting container is unmounted or recreated. This ensures that we remove\n * all subscriptions to Skia values so that we don't have any listeners left after\n * the component is removed.\n */\n remove() {\n // 1) Unregister redraw requests\n if (this.unregisterDependantValues) {\n this.unregisterDependantValues();\n this.unregisterDependantValues = null;\n }\n\n // 2) Unregister nodes\n Array.from(this.subscriptions.values()).forEach((si) => {\n Array.from(si.nodes.keys()).forEach((node) => this.unsubscribeNode(node));\n });\n\n // 3) Clear the rest of the subscriptions\n this.subscriptions.clear();\n }\n}\n\nconst initializePropertySubscriptions = <P,>(\n node: Node<P>,\n props: AnimatedProps<P>\n) => {\n const nodePropSubscriptions: Array<{\n value: SkiaValue<unknown>;\n mutator: Mutator;\n }> = [];\n\n mapKeys(props).forEach((key) => {\n const propvalue = props[key];\n\n if (isValue(propvalue)) {\n // Subscribe to changes\n nodePropSubscriptions.push({\n value: propvalue,\n mutator: (v) => (node.resolvedProps[key] = v as P[typeof key]),\n });\n // Set initial value\n node.resolvedProps[key] = (propvalue as SkiaValue<P[typeof key]>).current;\n } else if (isSelector(propvalue)) {\n // Subscribe to changes\n nodePropSubscriptions.push({\n value: propvalue.value,\n mutator: (v) =>\n (node.resolvedProps[key] = propvalue.selector(v) as P[typeof key]),\n });\n // Set initial value\n node.resolvedProps[key] = propvalue.selector(\n propvalue.value.current\n ) as P[typeof key];\n } else {\n // Set initial value\n node.resolvedProps[key] = propvalue as P[typeof key];\n }\n });\n\n return nodePropSubscriptions;\n};\n"]}
|
1
|
+
{"version":3,"sources":["DependencyManager.tsx"],"names":["isSelector","isValue","mapKeys","DependencyManager","constructor","registerValues","Map","unsubscribeNodes","nodes","forEach","n","unsubscribeNode","node","subscriptions","Array","from","values","filter","p","has","si","delete","size","unsubscribe","Error","element","entries","find","_","sub","subscribeNode","props","propSubscriptions","initializePropertySubscriptions","length","ps","subscriptionState","get","value","addListener","v","mutators","m","set","map","mutator","update","unregisterDependantValues","keys","remove","clear","nodePropSubscriptions","key","propvalue","push","setProp","current","selector"],"mappings":";;AAIA,SAASA,UAAT,EAAqBC,OAArB,QAAoC,cAApC;AACA,SAASC,OAAT,QAAwB,aAAxB;AAUA,OAAO,MAAMC,iBAAN,CAAwB;AAK7BC,EAAAA,WAAW,CACTC,cADS,EAET;AAAA;;AAAA,2CAL0D,IAAIC,GAAJ,EAK1D;;AAAA,uDAJ8C,IAI9C;;AACA,SAAKD,cAAL,GAAsBA,cAAtB;AACD;;AAEDE,EAAAA,gBAAgB,CAACC,KAAD,EAAyB;AACvCA,IAAAA,KAAK,CAACC,OAAN,CAAeC,CAAD,IAAO,KAAKC,eAAL,CAAqBD,CAArB,CAArB;AACD;AAED;AACF;AACA;AACA;AACA;AACA;AACA;;;AACEC,EAAAA,eAAe,CAACC,IAAD,EAAsB;AACnC,UAAMC,aAAa,GAAGC,KAAK,CAACC,IAAN,CAAW,KAAKF,aA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AAtB,CAA2B;AACzBhB,QAAAA,KAAK,EAAEe,SAAS,CAACf,KADQ;AAEzBO,QAAAA,OAAO,EAAGL,CAAD,IAAO;AACd5B,UAAAA,IAAI,CAAC2C,OAAL,CAAaH,GAAb,EAAkBC,SAAS,CAACI,QAAV,CAAmBjB,CAAnB,CAAlB;AACD;AAJwB,OAA3B,EAFgC,CAQhC;;AACA5B,MAAAA,IAAI,CAAC2C,OAAL,CACEH,GADF,EAEEC,SAAS,CAACI,QAAV,CAAmBJ,SAAS,CAACf,KAAV,CAAgBkB,OAAnC,CAFF;AAID,KAbM,MAaA;AACL;AACA5C,MAAAA,IAAI,CAAC2C,OAAL,CAAaH,GAAb,EAAkBC,SAAlB;AACD;AACF,GAjCD;AAmCA,SAAOF,qBAAP;AACD,CA7CD","sourcesContent":["import type { Node } from \"../dom/types\";\nimport type { SkiaValue } from \"../values\";\n\nimport type { AnimatedProps } from \"./processors\";\nimport { isSelector, isValue } from \"./processors\";\nimport { mapKeys } from \"./typeddash\";\n\ntype Unsubscribe = () => void;\ntype Mutator = (value: unknown) => void;\n\ntype SubscriptionState = {\n nodes: Map<Node<unknown>, Mutator[]>;\n unsubscribe: null | Unsubscribe;\n};\n\nexport class DependencyManager {\n registerValues: (values: Array<SkiaValue<unknown>>) => () => void;\n subscriptions: Map<SkiaValue<unknown>, SubscriptionState> = new Map();\n unregisterDependantValues: null | Unsubscribe = null;\n\n constructor(\n registerValues: (values: Array<SkiaValue<unknown>>) => () => void\n ) {\n this.registerValues = registerValues;\n }\n\n unsubscribeNodes(nodes: Node<unknown>[]) {\n nodes.forEach((n) => this.unsubscribeNode(n));\n }\n\n /**\n * Call to unsubscribe all value listeners from the given node based\n * on the current list of subscriptions for the node. This function\n * is typically called when the node is unmounted or when one or more\n * properties have changed.\n * @param node Node to unsubscribe value listeners from\n */\n unsubscribeNode(node: Node<unknown>) {\n const subscriptions = Array.from(this.subscriptions.values()).filter((p) =>\n p.nodes.has(node)\n );\n\n if (subscriptions) {\n subscriptions.forEach((si) => {\n // Delete node from subscription\n si.nodes.delete(node);\n\n // Remove subscription if there are no listeneres left on the value\n if (si.nodes.size === 0) {\n // There are no more nodes subscribing to this value, we can call\n // unsubscribe on it.\n if (!si.unsubscribe) {\n throw new Error(\"Failed to unsubscribe to value subscription\");\n }\n si.unsubscribe && si.unsubscribe();\n\n // Remove from subscription states as well\n const element = Array.from(this.subscriptions.entries()).find(\n ([_, sub]) => sub === si\n );\n if (!element) {\n throw new Error(\"Failed to find value subscription\");\n }\n if (!this.subscriptions.delete(element[0])) {\n throw new Error(\"Failed to delete value subscription\");\n }\n }\n });\n }\n }\n\n /**\n * Adds listeners to the provided values so that the node is notified\n * when a value changes. This is done in an optimized way so that this\n * class only needs to listen to the value once and then forwards the\n * change to the node and its listener. This method is typically called\n * when the node is mounted and when one or more props on the node changes.\n * @param node Node to subscribe to value changes for\n * @param props Node's properties\n * @param onResolveProp Callback when a property value changes\n */\n subscribeNode<P>(node: Node<unknown>, props: AnimatedProps<P>) {\n // Get mutators from node's properties\n const propSubscriptions = initializePropertySubscriptions(node, props);\n if (propSubscriptions.length === 0) {\n return;\n }\n\n // Install all mutators for the node\n propSubscriptions.forEach((ps) => {\n // Do we already have a state for this SkiaValue\n let subscriptionState = this.subscriptions.get(ps.value);\n if (!subscriptionState) {\n // Let's create a new subscription state for the skia value\n subscriptionState = {\n nodes: new Map(),\n unsubscribe: null,\n };\n // Add single subscription to the new value\n subscriptionState.unsubscribe = ps.value.addListener((v) => {\n subscriptionState!.nodes.forEach((mutators) =>\n mutators.forEach((m) => m(v))\n );\n });\n this.subscriptions.set(ps.value, subscriptionState);\n }\n // subscription mutators\n subscriptionState.nodes.set(\n node,\n propSubscriptions\n .filter((m) => m.value === ps.value)\n .map((m) => m.mutator)\n );\n });\n }\n\n /**\n * Called when the hosting container is mounted or updated. This ensures that we have\n * a ref to the underlying SkiaView so that we can registers redraw listeners\n * on values used in the current View automatically.\n */\n update() {\n // Remove any previous registrations\n if (this.unregisterDependantValues) {\n this.unregisterDependantValues();\n }\n\n // Register redraw requests on the SkiaView for each unique value\n this.unregisterDependantValues = this.registerValues(\n Array.from(this.subscriptions.keys())\n );\n }\n\n /**\n * Called when the hosting container is unmounted or recreated. This ensures that we remove\n * all subscriptions to Skia values so that we don't have any listeners left after\n * the component is removed.\n */\n remove() {\n // 1) Unregister redraw requests\n if (this.unregisterDependantValues) {\n this.unregisterDependantValues();\n this.unregisterDependantValues = null;\n }\n\n // 2) Unregister nodes\n Array.from(this.subscriptions.values()).forEach((si) => {\n Array.from(si.nodes.keys()).forEach((node) => this.unsubscribeNode(node));\n });\n\n // 3) Clear the rest of the subscriptions\n this.subscriptions.clear();\n }\n}\n\nconst initializePropertySubscriptions = <P,>(\n node: Node<P>,\n props: AnimatedProps<P>\n) => {\n const nodePropSubscriptions: Array<{\n value: SkiaValue<unknown>;\n mutator: Mutator;\n }> = [];\n\n mapKeys(props).forEach((key) => {\n if (key === \"children\") {\n return;\n }\n const propvalue = props[key];\n\n if (isValue(propvalue)) {\n // Subscribe to changes\n nodePropSubscriptions.push({\n value: propvalue,\n mutator: (v) => {\n node.setProp(key, v as P[typeof key]);\n },\n });\n // Set initial value\n node.setProp(key, (propvalue as SkiaValue<P[typeof key]>).current);\n } else if (isSelector(propvalue)) {\n // Subscribe to changes\n nodePropSubscriptions.push({\n value: propvalue.value,\n mutator: (v) => {\n node.setProp(key, propvalue.selector(v) as P[typeof key]);\n },\n });\n // Set initial value\n node.setProp(\n key,\n propvalue.selector(propvalue.value.current) as P[typeof key]\n );\n } else {\n // Set initial value\n node.setProp(key, propvalue as P[typeof key]);\n }\n });\n\n return nodePropSubscriptions;\n};\n"]}
|
@@ -0,0 +1,185 @@
|
|
1
|
+
import { NodeType } from "../dom/types";
|
2
|
+
import { exhaustiveCheck } from "./typeddash";
|
3
|
+
export const createNode = (container, type, props) => {
|
4
|
+
const {
|
5
|
+
Sk
|
6
|
+
} = container;
|
7
|
+
|
8
|
+
switch (type) {
|
9
|
+
case NodeType.Group:
|
10
|
+
return Sk.Group(props);
|
11
|
+
|
12
|
+
case NodeType.Paint:
|
13
|
+
return Sk.Paint(props);
|
14
|
+
// Drawings
|
15
|
+
|
16
|
+
case NodeType.Fill:
|
17
|
+
return Sk.Fill(props);
|
18
|
+
|
19
|
+
case NodeType.Image:
|
20
|
+
return Sk.Image(props);
|
21
|
+
|
22
|
+
case NodeType.Circle:
|
23
|
+
return Sk.Circle(props);
|
24
|
+
|
25
|
+
case NodeType.Path:
|
26
|
+
return Sk.Path(props);
|
27
|
+
|
28
|
+
case NodeType.Drawing:
|
29
|
+
return Sk.CustomDrawing(props);
|
30
|
+
|
31
|
+
case NodeType.Line:
|
32
|
+
return Sk.Line(props);
|
33
|
+
|
34
|
+
case NodeType.Oval:
|
35
|
+
return Sk.Oval(props);
|
36
|
+
|
37
|
+
case NodeType.Patch:
|
38
|
+
return Sk.Patch(props);
|
39
|
+
|
40
|
+
case NodeType.Points:
|
41
|
+
return Sk.Points(props);
|
42
|
+
|
43
|
+
case NodeType.Rect:
|
44
|
+
return Sk.Rect(props);
|
45
|
+
|
46
|
+
case NodeType.RRect:
|
47
|
+
return Sk.RRect(props);
|
48
|
+
|
49
|
+
case NodeType.Vertices:
|
50
|
+
return Sk.Vertices(props);
|
51
|
+
|
52
|
+
case NodeType.Text:
|
53
|
+
return Sk.Text(props);
|
54
|
+
|
55
|
+
case NodeType.TextPath:
|
56
|
+
return Sk.TextPath(props);
|
57
|
+
|
58
|
+
case NodeType.TextBlob:
|
59
|
+
return Sk.TextBlob(props);
|
60
|
+
|
61
|
+
case NodeType.Glyphs:
|
62
|
+
return Sk.Glyphs(props);
|
63
|
+
|
64
|
+
case NodeType.DiffRect:
|
65
|
+
return Sk.DiffRect(props);
|
66
|
+
|
67
|
+
case NodeType.Picture:
|
68
|
+
return Sk.Picture(props);
|
69
|
+
|
70
|
+
case NodeType.ImageSVG:
|
71
|
+
return Sk.ImageSVG(props);
|
72
|
+
// Mask Filter
|
73
|
+
|
74
|
+
case NodeType.BlurMaskFilter:
|
75
|
+
return Sk.BlurMaskFilter(props);
|
76
|
+
// Image Filter
|
77
|
+
|
78
|
+
case NodeType.BlendImageFilter:
|
79
|
+
return Sk.BlendImageFilter(props);
|
80
|
+
|
81
|
+
case NodeType.BlurImageFilter:
|
82
|
+
return Sk.BlurImageFilter(props);
|
83
|
+
|
84
|
+
case NodeType.OffsetImageFilter:
|
85
|
+
return Sk.OffsetImageFilter(props);
|
86
|
+
|
87
|
+
case NodeType.DropShadowImageFilter:
|
88
|
+
return Sk.DropShadowImageFilter(props);
|
89
|
+
|
90
|
+
case NodeType.DisplacementMapImageFilter:
|
91
|
+
return Sk.DisplacementMapImageFilter(props);
|
92
|
+
|
93
|
+
case NodeType.MorphologyImageFilter:
|
94
|
+
return Sk.MorphologyImageFilter(props);
|
95
|
+
|
96
|
+
case NodeType.RuntimeShaderImageFilter:
|
97
|
+
return Sk.RuntimeShaderImageFilter(props);
|
98
|
+
// Color Filter
|
99
|
+
|
100
|
+
case NodeType.MatrixColorFilter:
|
101
|
+
return Sk.MatrixColorFilter(props);
|
102
|
+
|
103
|
+
case NodeType.BlendColorFilter:
|
104
|
+
return Sk.BlendColorFilter(props);
|
105
|
+
|
106
|
+
case NodeType.LerpColorFilter:
|
107
|
+
return Sk.LerpColorFilter(props);
|
108
|
+
|
109
|
+
case NodeType.LumaColorFilter:
|
110
|
+
return Sk.LumaColorFilter();
|
111
|
+
|
112
|
+
case NodeType.LinearToSRGBGammaColorFilter:
|
113
|
+
return Sk.LinearToSRGBGammaColorFilter();
|
114
|
+
|
115
|
+
case NodeType.SRGBToLinearGammaColorFilter:
|
116
|
+
return Sk.SRGBToLinearGammaColorFilter();
|
117
|
+
// Shader
|
118
|
+
|
119
|
+
case NodeType.Shader:
|
120
|
+
return Sk.Shader(props);
|
121
|
+
|
122
|
+
case NodeType.ImageShader:
|
123
|
+
return Sk.ImageShader(props);
|
124
|
+
|
125
|
+
case NodeType.ColorShader:
|
126
|
+
return Sk.ColorShader(props);
|
127
|
+
|
128
|
+
case NodeType.Turbulence:
|
129
|
+
return Sk.Turbulence(props);
|
130
|
+
|
131
|
+
case NodeType.FractalNoise:
|
132
|
+
return Sk.FractalNoise(props);
|
133
|
+
|
134
|
+
case NodeType.LinearGradient:
|
135
|
+
return Sk.LinearGradient(props);
|
136
|
+
|
137
|
+
case NodeType.RadialGradient:
|
138
|
+
return Sk.RadialGradient(props);
|
139
|
+
|
140
|
+
case NodeType.SweepGradient:
|
141
|
+
return Sk.SweepGradient(props);
|
142
|
+
|
143
|
+
case NodeType.TwoPointConicalGradient:
|
144
|
+
return Sk.TwoPointConicalGradient(props);
|
145
|
+
// Path Effect
|
146
|
+
|
147
|
+
case NodeType.CornerPathEffect:
|
148
|
+
return Sk.CornerPathEffect(props);
|
149
|
+
|
150
|
+
case NodeType.DiscretePathEffect:
|
151
|
+
return Sk.DiscretePathEffect(props);
|
152
|
+
|
153
|
+
case NodeType.DashPathEffect:
|
154
|
+
return Sk.DashPathEffect(props);
|
155
|
+
|
156
|
+
case NodeType.Path1DPathEffect:
|
157
|
+
return Sk.Path1DPathEffect(props);
|
158
|
+
|
159
|
+
case NodeType.Path2DPathEffect:
|
160
|
+
return Sk.Path2DPathEffect(props);
|
161
|
+
|
162
|
+
case NodeType.SumPathEffect:
|
163
|
+
return Sk.SumPathEffect();
|
164
|
+
|
165
|
+
case NodeType.Line2DPathEffect:
|
166
|
+
return Sk.Line2DPathEffect(props);
|
167
|
+
// Mixed
|
168
|
+
|
169
|
+
case NodeType.Blend:
|
170
|
+
return Sk.Blend(props);
|
171
|
+
|
172
|
+
case NodeType.BackdropFilter:
|
173
|
+
return Sk.BackdropFilter(props);
|
174
|
+
|
175
|
+
case NodeType.Box:
|
176
|
+
return Sk.Box(props);
|
177
|
+
|
178
|
+
case NodeType.BoxShadow:
|
179
|
+
return Sk.BoxShadow(props);
|
180
|
+
|
181
|
+
default:
|
182
|
+
return exhaustiveCheck(type);
|
183
|
+
}
|
184
|
+
};
|
185
|
+
//# sourceMappingURL=HostComponents.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["HostComponents.ts"],"names":["NodeType","exhaustiveCheck","createNode","container","type","props","Sk","Group","Paint","Fill","Image","Circle","Path","Drawing","CustomDrawing","Line","Oval","Patch","Points","Rect","RRect","Vertices","Text","TextPath","TextBlob","Glyphs","DiffRect","Picture","ImageSVG","BlurMaskFilter","BlendImageFilter","BlurImageFilter","OffsetImageFilter","DropShadowImageFilter","DisplacementMapImageFilter","MorphologyImageFilter","RuntimeShaderImageFilter","MatrixColorFilter","BlendColorFilter","LerpColorFilter","LumaColorFilter","LinearToSRGBGammaColorFilter","SRGBToLinearGammaColorFilter","Shader","ImageShader","ColorShader","Turbulence","FractalNoise","LinearGradient","RadialGradient","SweepGradient","TwoPointConicalGradient","CornerPathEffect","DiscretePathEffect","DashPathEffect","Path1DPathEffect","Path2DPathEffect","SumPathEffect","Line2DPathEffect","Blend","BackdropFilter","Box","BoxShadow"],"mappings":"AAEA,SAASA,QAAT,QAAyB,cAAzB;AA0DA,SAASC,eAAT,QAAgC,aAAhC;AAgFA,OAAO,MAAMC,UAAU,GAAG,CACxBC,SADwB,EAExBC,IAFwB,EAIxBC,KAJwB,KAKrB;AACH,QAAM;AAAEC,IAAAA;AAAF,MAASH,SAAf;;AACA,UAAQC,IAAR;AACE,SAAKJ,QAAQ,CAACO,KAAd;AACE,aAAOD,EAAE,CAACC,KAAH,CAASF,KAAT,CAAP;;AACF,SAAKL,QAAQ,CAACQ,KAAd;AACE,aAAOF,EAAE,CAACE,KAAH,CAASH,KAAT,CAAP;AACF;;AACA,SAAKL,QAAQ,CAACS,IAAd;AACE,aAAOH,EAAE,CAACG,IAAH,CAAQJ,KAAR,CAAP;;AACF,SAAKL,QAAQ,CAACU,KAAd;AACE,aAAOJ,EAAE,CAACI,KAAH,CAASL,KAAT,CAAP;;AACF,SAAKL,QAAQ,CAACW,MAAd;AACE,aAAOL,EA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D,cAAH,CAAkBjD,KAAlB,CAAP;;AACF,SAAKL,QAAQ,CAACuD,gBAAd;AACE,aAAOjD,EAAE,CAACiD,gBAAH,CAAoBlD,KAApB,CAAP;;AACF,SAAKL,QAAQ,CAACwD,gBAAd;AACE,aAAOlD,EAAE,CAACkD,gBAAH,CAAoBnD,KAApB,CAAP;;AACF,SAAKL,QAAQ,CAACyD,aAAd;AACE,aAAOnD,EAAE,CAACmD,aAAH,EAAP;;AACF,SAAKzD,QAAQ,CAAC0D,gBAAd;AACE,aAAOpD,EAAE,CAACoD,gBAAH,CAAoBrD,KAApB,CAAP;AACF;;AACA,SAAKL,QAAQ,CAAC2D,KAAd;AACE,aAAOrD,EAAE,CAACqD,KAAH,CAAStD,KAAT,CAAP;;AACF,SAAKL,QAAQ,CAAC4D,cAAd;AACE,aAAOtD,EAAE,CAACsD,cAAH,CAAkBvD,KAAlB,CAAP;;AACF,SAAKL,QAAQ,CAAC6D,GAAd;AACE,aAAOvD,EAAE,CAACuD,GAAH,CAAOxD,KAAP,CAAP;;AACF,SAAKL,QAAQ,CAAC8D,SAAd;AACE,aAAOxD,EAAE,CAACwD,SAAH,CAAazD,KAAb,CAAP;;AACF;AACE,aAAOJ,eAAe,CAACG,IAAD,CAAtB;AAvHJ;AAyHD,CAhIM","sourcesContent":["import type { ForwardedRef } from \"react\";\n\nimport { NodeType } from \"../dom/types\";\nimport type {\n CircleProps,\n DrawingNodeProps,\n ImageProps,\n PaintProps,\n PathProps,\n CustomDrawingNodeProps,\n LineProps,\n OvalProps,\n DiffRectProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n TextProps,\n VerticesProps,\n BlurMaskFilterProps,\n BlendImageFilterProps,\n BlurImageFilterProps,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n OffsetImageFilterProps,\n RuntimeShaderImageFilterProps,\n MatrixColorFilterProps,\n ShaderProps,\n ImageShaderProps,\n LinearGradientProps,\n GroupProps,\n PatchProps,\n BlendColorFilterProps,\n DashPathEffectProps,\n DiscretePathEffectProps,\n CornerPathEffectProps,\n Line2DPathEffectProps,\n Path1DPathEffectProps,\n Path2DPathEffectProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n TwoPointConicalGradientProps,\n TurbulenceProps,\n SweepGradientProps,\n RadialGradientProps,\n ColorProps,\n PictureProps,\n ImageSVGProps,\n LerpColorFilterProps,\n BoxProps,\n BoxShadowProps,\n} from \"../dom/types\";\nimport type { ChildrenProps } from \"../dom/types/Common\";\nimport type {\n BlendProps,\n MorphologyImageFilterProps,\n} from \"../dom/types/ImageFilters\";\nimport type { PaintNode } from \"../dom/nodes/PaintNode\";\n\nimport type { Container } from \"./Container\";\nimport { exhaustiveCheck } from \"./typeddash\";\nimport type { SkiaProps } from \"./processors\";\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n skGroup: SkiaProps<GroupProps>;\n skPaint: SkiaProps<PaintProps> & { ref: ForwardedRef<PaintNode> };\n\n // Drawings\n skFill: SkiaProps<DrawingNodeProps>;\n skImage: SkiaProps<ImageProps>;\n skCircle: SkiaProps<CircleProps>;\n skPath: SkiaProps<PathProps>;\n skDrawing: SkiaProps<CustomDrawingNodeProps>;\n skLine: SkiaProps<LineProps>;\n skOval: SkiaProps<OvalProps>;\n skPatch: SkiaProps<PatchProps>;\n skPoints: SkiaProps<PointsProps>;\n skRect: SkiaProps<RectProps>;\n skRRect: SkiaProps<RoundedRectProps>;\n skVertices: SkiaProps<VerticesProps>;\n skText: SkiaProps<TextProps>;\n skTextPath: SkiaProps<TextPathProps>;\n skTextBlob: SkiaProps<TextBlobProps>;\n skGlyphs: SkiaProps<GlyphsProps>;\n skDiffRect: SkiaProps<DiffRectProps>;\n skPicture: SkiaProps<PictureProps>;\n skImageSVG: SkiaProps<ImageSVGProps>;\n\n // BlurMaskFilters\n skBlurMaskFilter: SkiaProps<BlurMaskFilterProps>;\n\n // ImageFilters\n skBlendImageFilter: SkiaProps<BlendImageFilterProps>;\n skBlurImageFilter: SkiaProps<BlurImageFilterProps>;\n skOffsetImageFilter: SkiaProps<OffsetImageFilterProps>;\n skDropShadowImageFilter: SkiaProps<DropShadowImageFilterProps>;\n skDisplacementMapImageFilter: SkiaProps<DisplacementMapImageFilterProps>;\n skRuntimeShaderImageFilter: SkiaProps<RuntimeShaderImageFilterProps>;\n skMorphologyImageFilter: SkiaProps<MorphologyImageFilterProps>;\n\n // ColorFilters\n skMatrixColorFilter: SkiaProps<MatrixColorFilterProps>;\n skBlendColorFilter: SkiaProps<BlendColorFilterProps>;\n skLinearToSRGBGammaColorFilter: SkiaProps<ChildrenProps>;\n skSRGBToLinearGammaColorFilter: SkiaProps<ChildrenProps>;\n skLumaColorFilter: SkiaProps<ChildrenProps>;\n skLerpColorFilter: SkiaProps<LerpColorFilterProps>;\n\n // Shaders\n skShader: SkiaProps<ShaderProps>;\n skImageShader: SkiaProps<ImageShaderProps>;\n skColorShader: SkiaProps<ColorProps>;\n skTurbulence: SkiaProps<TurbulenceProps>;\n skFractalNoise: SkiaProps<TurbulenceProps>;\n skLinearGradient: SkiaProps<LinearGradientProps>;\n skRadialGradient: SkiaProps<RadialGradientProps>;\n skSweepGradient: SkiaProps<SweepGradientProps>;\n skTwoPointConicalGradient: SkiaProps<TwoPointConicalGradientProps>;\n\n // Path Effects\n skDiscretePathEffect: SkiaProps<DiscretePathEffectProps>;\n skDashPathEffect: SkiaProps<DashPathEffectProps>;\n skPath1DPathEffect: SkiaProps<Path1DPathEffectProps>;\n skPath2DPathEffect: SkiaProps<Path2DPathEffectProps>;\n skCornerPathEffect: SkiaProps<CornerPathEffectProps>;\n skSumPathEffect: ChildrenProps;\n skLine2DPathEffect: SkiaProps<Line2DPathEffectProps>;\n\n // Mixed declarations/drawings\n skBlend: SkiaProps<BlendProps>;\n skBackdropFilter: SkiaProps<ChildrenProps>;\n skBox: SkiaProps<BoxProps>;\n skBoxShadow: SkiaProps<BoxShadowProps>;\n }\n }\n}\n\nexport const createNode = (\n container: Container,\n type: NodeType,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n props: any\n) => {\n const { Sk } = container;\n switch (type) {\n case NodeType.Group:\n return Sk.Group(props);\n case NodeType.Paint:\n return Sk.Paint(props);\n // Drawings\n case NodeType.Fill:\n return Sk.Fill(props);\n case NodeType.Image:\n return Sk.Image(props);\n case NodeType.Circle:\n return Sk.Circle(props);\n case NodeType.Path:\n return Sk.Path(props);\n case NodeType.Drawing:\n return Sk.CustomDrawing(props);\n case NodeType.Line:\n return Sk.Line(props);\n case NodeType.Oval:\n return Sk.Oval(props);\n case NodeType.Patch:\n return Sk.Patch(props);\n case NodeType.Points:\n return Sk.Points(props);\n case NodeType.Rect:\n return Sk.Rect(props);\n case NodeType.RRect:\n return Sk.RRect(props);\n case NodeType.Vertices:\n return Sk.Vertices(props);\n case NodeType.Text:\n return Sk.Text(props);\n case NodeType.TextPath:\n return Sk.TextPath(props);\n case NodeType.TextBlob:\n return Sk.TextBlob(props);\n case NodeType.Glyphs:\n return Sk.Glyphs(props);\n case NodeType.DiffRect:\n return Sk.DiffRect(props);\n case NodeType.Picture:\n return Sk.Picture(props);\n case NodeType.ImageSVG:\n return Sk.ImageSVG(props);\n // Mask Filter\n case NodeType.BlurMaskFilter:\n return Sk.BlurMaskFilter(props);\n // Image Filter\n case NodeType.BlendImageFilter:\n return Sk.BlendImageFilter(props);\n case NodeType.BlurImageFilter:\n return Sk.BlurImageFilter(props);\n case NodeType.OffsetImageFilter:\n return Sk.OffsetImageFilter(props);\n case NodeType.DropShadowImageFilter:\n return Sk.DropShadowImageFilter(props);\n case NodeType.DisplacementMapImageFilter:\n return Sk.DisplacementMapImageFilter(props);\n case NodeType.MorphologyImageFilter:\n return Sk.MorphologyImageFilter(props);\n case NodeType.RuntimeShaderImageFilter:\n return Sk.RuntimeShaderImageFilter(props);\n // Color Filter\n case NodeType.MatrixColorFilter:\n return Sk.MatrixColorFilter(props);\n case NodeType.BlendColorFilter:\n return Sk.BlendColorFilter(props);\n case NodeType.LerpColorFilter:\n return Sk.LerpColorFilter(props);\n case NodeType.LumaColorFilter:\n return Sk.LumaColorFilter();\n case NodeType.LinearToSRGBGammaColorFilter:\n return Sk.LinearToSRGBGammaColorFilter();\n case NodeType.SRGBToLinearGammaColorFilter:\n return Sk.SRGBToLinearGammaColorFilter();\n // Shader\n case NodeType.Shader:\n return Sk.Shader(props);\n case NodeType.ImageShader:\n return Sk.ImageShader(props);\n case NodeType.ColorShader:\n return Sk.ColorShader(props);\n case NodeType.Turbulence:\n return Sk.Turbulence(props);\n case NodeType.FractalNoise:\n return Sk.FractalNoise(props);\n case NodeType.LinearGradient:\n return Sk.LinearGradient(props);\n case NodeType.RadialGradient:\n return Sk.RadialGradient(props);\n case NodeType.SweepGradient:\n return Sk.SweepGradient(props);\n case NodeType.TwoPointConicalGradient:\n return Sk.TwoPointConicalGradient(props);\n // Path Effect\n case NodeType.CornerPathEffect:\n return Sk.CornerPathEffect(props);\n case NodeType.DiscretePathEffect:\n return Sk.DiscretePathEffect(props);\n case NodeType.DashPathEffect:\n return Sk.DashPathEffect(props);\n case NodeType.Path1DPathEffect:\n return Sk.Path1DPathEffect(props);\n case NodeType.Path2DPathEffect:\n return Sk.Path2DPathEffect(props);\n case NodeType.SumPathEffect:\n return Sk.SumPathEffect();\n case NodeType.Line2DPathEffect:\n return Sk.Line2DPathEffect(props);\n // Mixed\n case NodeType.Blend:\n return Sk.Blend(props);\n case NodeType.BackdropFilter:\n return Sk.BackdropFilter(props);\n case NodeType.Box:\n return Sk.Box(props);\n case NodeType.BoxShadow:\n return Sk.BoxShadow(props);\n default:\n return exhaustiveCheck(type);\n }\n};\n"]}
|
@@ -1,6 +1,9 @@
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
2
|
+
|
1
3
|
/*global NodeJS*/
|
2
|
-
import {
|
3
|
-
import {
|
4
|
+
import { createNode } from "./HostComponents";
|
5
|
+
import { isSelector, isValue } from "./processors";
|
6
|
+
import { mapKeys, shallowEq } from "./typeddash";
|
4
7
|
const DEBUG = false;
|
5
8
|
export const debug = function () {
|
6
9
|
if (DEBUG) {
|
@@ -8,102 +11,16 @@ export const debug = function () {
|
|
8
11
|
}
|
9
12
|
};
|
10
13
|
|
11
|
-
const allChildrenAreMemoized = node => {
|
12
|
-
if (!node.memoizable) {
|
13
|
-
return false;
|
14
|
-
}
|
15
|
-
|
16
|
-
for (const child of node.children) {
|
17
|
-
if (!child.memoized) {
|
18
|
-
return false;
|
19
|
-
}
|
20
|
-
}
|
21
|
-
|
22
|
-
return true;
|
23
|
-
};
|
24
|
-
|
25
|
-
const bustBranchMemoization = parent => {
|
26
|
-
if (parent.memoizable) {
|
27
|
-
let ancestor = parent;
|
28
|
-
|
29
|
-
while (ancestor) {
|
30
|
-
ancestor.memoized = null;
|
31
|
-
ancestor = ancestor.parent;
|
32
|
-
}
|
33
|
-
}
|
34
|
-
};
|
35
|
-
|
36
|
-
const bustBranchMemoizable = parent => {
|
37
|
-
if (parent.memoizable) {
|
38
|
-
let ancestor = parent;
|
39
|
-
|
40
|
-
while (ancestor) {
|
41
|
-
ancestor.memoizable = false;
|
42
|
-
ancestor = ancestor.parent;
|
43
|
-
}
|
44
|
-
}
|
45
|
-
};
|
46
|
-
|
47
14
|
const appendNode = (parent, child) => {
|
48
|
-
child
|
49
|
-
bustBranchMemoization(parent);
|
50
|
-
|
51
|
-
if (!child.memoizable) {
|
52
|
-
bustBranchMemoizable(parent);
|
53
|
-
}
|
54
|
-
|
55
|
-
if (!parent.memoizable) {
|
56
|
-
child.memoizable = false;
|
57
|
-
}
|
58
|
-
|
59
|
-
parent.children.push(child);
|
15
|
+
parent.addChild(child);
|
60
16
|
};
|
61
17
|
|
62
18
|
const removeNode = (parent, child) => {
|
63
|
-
|
64
|
-
const index = parent.children.indexOf(child);
|
65
|
-
parent.children.splice(index, 1);
|
66
|
-
child.depMgr.unsubscribeNode(child); // unsubscribe to all children as well
|
67
|
-
|
68
|
-
for (const c of child.children) {
|
69
|
-
removeNode(child, c);
|
70
|
-
}
|
19
|
+
return parent.removeChild(child);
|
71
20
|
};
|
72
21
|
|
73
22
|
const insertBefore = (parent, child, before) => {
|
74
|
-
|
75
|
-
const index = parent.children.indexOf(child);
|
76
|
-
|
77
|
-
if (index !== -1) {
|
78
|
-
parent.children.splice(index, 1);
|
79
|
-
}
|
80
|
-
|
81
|
-
const beforeIndex = parent.children.indexOf(before);
|
82
|
-
parent.children.splice(beforeIndex, 0, child);
|
83
|
-
};
|
84
|
-
|
85
|
-
const createNode = (container, type, props) => {
|
86
|
-
switch (type) {
|
87
|
-
case NodeType.Drawing:
|
88
|
-
const {
|
89
|
-
onDraw,
|
90
|
-
skipProcessing,
|
91
|
-
...p1
|
92
|
-
} = props;
|
93
|
-
return new DrawingNode(container.depMgr, onDraw, skipProcessing, p1);
|
94
|
-
|
95
|
-
case NodeType.Declaration:
|
96
|
-
const {
|
97
|
-
onDeclare,
|
98
|
-
...p2
|
99
|
-
} = props;
|
100
|
-
return new DeclarationNode(container.depMgr, onDeclare, p2);
|
101
|
-
|
102
|
-
default:
|
103
|
-
// TODO: here we need to throw a nice error message
|
104
|
-
// This is the error that will show up when the user uses nodes not supported by Skia (View, Audio, etc)
|
105
|
-
return exhaustiveCheck(type);
|
106
|
-
}
|
23
|
+
parent.insertChildBefore(child, before);
|
107
24
|
};
|
108
25
|
|
109
26
|
export const skHostConfig = {
|
@@ -122,7 +39,7 @@ export const skHostConfig = {
|
|
122
39
|
|
123
40
|
appendChildToContainer(container, child) {
|
124
41
|
debug("appendChildToContainer", container, child);
|
125
|
-
appendNode(container, child);
|
42
|
+
appendNode(container.root, child);
|
126
43
|
},
|
127
44
|
|
128
45
|
appendChild(parent, child) {
|
@@ -150,9 +67,13 @@ export const skHostConfig = {
|
|
150
67
|
throw new Error("Text nodes are not supported yet");
|
151
68
|
},
|
152
69
|
|
153
|
-
createInstance(type,
|
70
|
+
createInstance(type, pristineProps, container, _hostContext, _internalInstanceHandle) {
|
154
71
|
debug("createInstance", type);
|
155
|
-
|
72
|
+
const props = { ...pristineProps
|
73
|
+
};
|
74
|
+
const node = createNode(container, type, materialize(props));
|
75
|
+
container.depMgr.subscribeNode(node, props);
|
76
|
+
return node;
|
156
77
|
},
|
157
78
|
|
158
79
|
appendInitialChild(parentInstance, child) {
|
@@ -175,10 +96,6 @@ export const skHostConfig = {
|
|
175
96
|
return null;
|
176
97
|
},
|
177
98
|
|
178
|
-
finalizeContainerChildren: () => {
|
179
|
-
debug("finalizeContainerChildren");
|
180
|
-
},
|
181
|
-
|
182
99
|
resetAfterCommit(container) {
|
183
100
|
debug("resetAfterCommit");
|
184
101
|
container.redraw();
|
@@ -189,50 +106,39 @@ export const skHostConfig = {
|
|
189
106
|
return node;
|
190
107
|
},
|
191
108
|
|
192
|
-
prepareUpdate: (
|
109
|
+
prepareUpdate: (_instance, type, oldProps, newProps, rootContainerInstance, _hostContext) => {
|
193
110
|
debug("prepareUpdate");
|
194
111
|
const propsAreEqual = shallowEq(oldProps, newProps);
|
195
112
|
|
196
|
-
if (propsAreEqual
|
113
|
+
if (propsAreEqual) {
|
197
114
|
return null;
|
198
115
|
}
|
199
116
|
|
200
117
|
debug("update ", type);
|
201
|
-
return
|
118
|
+
return rootContainerInstance;
|
202
119
|
},
|
203
120
|
|
204
|
-
commitUpdate(instance,
|
121
|
+
commitUpdate(instance, updatePayload, type, prevProps, nextProps, _internalHandle) {
|
205
122
|
debug("commitUpdate: ", type);
|
206
123
|
|
207
|
-
if (shallowEq(prevProps, nextProps)
|
124
|
+
if (shallowEq(prevProps, nextProps)) {
|
208
125
|
return;
|
209
126
|
}
|
210
127
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
skipProcessing,
|
217
|
-
...props
|
218
|
-
} = nextProps;
|
219
|
-
instance.props = props;
|
220
|
-
} else if (instance instanceof DeclarationNode) {
|
221
|
-
const {
|
222
|
-
onDeclare,
|
223
|
-
...props
|
224
|
-
} = nextProps;
|
225
|
-
instance.props = props;
|
226
|
-
} else {
|
227
|
-
throw new Error("Unsupported instance commitUpdate " + instance.constructor.name);
|
228
|
-
}
|
128
|
+
const props = { ...nextProps
|
129
|
+
};
|
130
|
+
updatePayload.depMgr.unsubscribeNode(instance);
|
131
|
+
instance.setProps(materialize(props));
|
132
|
+
updatePayload.depMgr.subscribeNode(instance, props);
|
229
133
|
},
|
230
134
|
|
231
135
|
commitTextUpdate: (_textInstance, _oldText, _newText) => {// textInstance.instance = newText;
|
232
136
|
},
|
233
137
|
clearContainer: container => {
|
234
138
|
debug("clearContainer");
|
235
|
-
container.children.
|
139
|
+
container.root.children().forEach(child => {
|
140
|
+
container.root.removeChild(child);
|
141
|
+
});
|
236
142
|
},
|
237
143
|
preparePortalMount: () => {
|
238
144
|
debug("preparePortalMount");
|
@@ -240,14 +146,29 @@ export const skHostConfig = {
|
|
240
146
|
removeChild: (parent, child) => {
|
241
147
|
removeNode(parent, child);
|
242
148
|
},
|
243
|
-
removeChildFromContainer: (
|
244
|
-
removeNode(
|
149
|
+
removeChildFromContainer: (container, child) => {
|
150
|
+
removeNode(container.root, child);
|
245
151
|
},
|
246
|
-
insertInContainerBefore: (
|
247
|
-
insertBefore(
|
152
|
+
insertInContainerBefore: (container, child, before) => {
|
153
|
+
insertBefore(container.root, child, before);
|
248
154
|
},
|
249
155
|
insertBefore: (parent, child, before) => {
|
250
156
|
insertBefore(parent, child, before);
|
251
157
|
}
|
252
158
|
};
|
159
|
+
|
160
|
+
const materialize = props => {
|
161
|
+
const result = { ...props
|
162
|
+
};
|
163
|
+
mapKeys(props).forEach(key => {
|
164
|
+
const prop = props[key];
|
165
|
+
|
166
|
+
if (isValue(prop)) {
|
167
|
+
result[key] = prop.current;
|
168
|
+
} else if (isSelector(prop)) {
|
169
|
+
result[key] = prop.selector(prop.value.current);
|
170
|
+
}
|
171
|
+
});
|
172
|
+
return result;
|
173
|
+
};
|
253
174
|
//# sourceMappingURL=HostConfig.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["HostConfig.ts"],"names":["DeclarationNode","DrawingNode","NodeType","exhaustiveCheck","shallowEq","DEBUG","debug","console","log","allChildrenAreMemoized","node","memoizable","child","children","memoized","bustBranchMemoization","parent","ancestor","bustBranchMemoizable","appendNode","push","removeNode","index","indexOf","splice","depMgr","unsubscribeNode","c","insertBefore","before","beforeIndex","createNode","container","type","props","Drawing","onDraw","skipProcessing","p1","Declaration","onDeclare","p2","skHostConfig","now","Date","supportsMutation","isPrimaryRenderer","supportsPersistence","supportsHydration","scheduleTimeout","setTimeout","cancelTimeout","clearTimeout","noTimeout","appendChildToContainer","appendChild","getRootHostContext","_rootContainerInstance","getChildHostContext","_parentHostContext","_type","shouldSetTextContent","_props","createTextInstance","_text","_hostContext","_internalInstanceHandle","Error","createInstance","appendInitialChild","parentInstance","finalizeInitialChildren","commitMount","prepareForCommit","_containerInfo","finalizeContainerChildren","resetAfterCommit","redraw","getPublicInstance","prepareUpdate","instance","oldProps","newProps","propsAreEqual","commitUpdate","_updatePayload","prevProps","nextProps","_internalHandle","constructor","name","commitTextUpdate","_textInstance","_oldText","_newText","clearContainer","preparePortalMount","removeChild","removeChildFromContainer","insertInContainerBefore"],"mappings":"AAAA;AAIA,SAASA,eAAT,EAA0BC,WAA1B,EAAuCC,QAAvC,QAAuD,SAAvD;AACA,SAASC,eAAT,EAA0BC,SAA1B,QAA2C,aAA3C;AAEA,MAAMC,KAAK,GAAG,KAAd;AACA,OAAO,MAAMC,KAAK,GAAG,YAA6C;AAChE,MAAID,KAAJ,EAAW;AACTE,IAAAA,OAAO,CAACC,GAAR,CAAY,YAAZ;AACD;AACF,CAJM;;AA+CP,MAAMC,sBAAsB,GAAIC,IAAD,IAAoB;AACjD,MAAI,CAACA,IAAI,CAACC,UAAV,EAAsB;AACpB,WAAO,KAAP;AACD;;AACD,OAAK,MAAMC,KAAX,IAAoBF,IAAI,CAACG,QAAzB,EAAmC;AACjC,QAA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GA;AACL,YAAM,IAAIiC,KAAJ,CACJ,uCAAuCa,QAAQ,CAACS,WAAT,CAAqBC,IADxD,CAAN;AAGD;AACF,GA/IyC;;AAiJ1CC,EAAAA,gBAAgB,EAAE,CAChBC,aADgB,EAEhBC,QAFgB,EAGhBC,QAHgB,KAIb,CACH;AACD,GAvJyC;AAyJ1CC,EAAAA,cAAc,EAAG/D,SAAD,IAAe;AAC7B1B,IAAAA,KAAK,CAAC,gBAAD,CAAL;AACA0B,IAAAA,SAAS,CAACnB,QAAV,CAAmBW,MAAnB,CAA0B,CAA1B;AACD,GA5JyC;AA8J1CwE,EAAAA,kBAAkB,EAAE,MAAM;AACxB1F,IAAAA,KAAK,CAAC,oBAAD,CAAL;AACD,GAhKyC;AAkK1C2F,EAAAA,WAAW,EAAE,CAACjF,MAAD,EAASJ,KAAT,KAAmB;AAC9BS,IAAAA,UAAU,CAACL,MAAD,EAASJ,KAAT,CAAV;AACD,GApKyC;AAsK1CsF,EAAAA,wBAAwB,EAAE,CAAClF,MAAD,EAASJ,KAAT,KAAmB;AAC3CS,IAAAA,UAAU,CAACL,MAAD,EAASJ,KAAT,CAAV;AACD,GAxKyC;AA0K1CuF,EAAAA,uBAAuB,EAAE,CAACnF,MAAD,EAASJ,KAAT,EAAgBiB,MAAhB,KAA2B;AAClDD,IAAAA,YAAY,CAACZ,MAAD,EAASJ,KAAT,EAAgBiB,MAAhB,CAAZ;AACD,GA5KyC;AA8K1CD,EAAAA,YAAY,EAAE,CAACZ,MAAD,EAASJ,KAAT,EAAgBiB,MAAhB,KAA2B;AACvCD,IAAAA,YAAY,CAACZ,MAAD,EAASJ,KAAT,EAAgBiB,MAAhB,CAAZ;AACD;AAhLyC,CAArC","sourcesContent":["/*global NodeJS*/\nimport type { HostConfig } from \"react-reconciler\";\n\nimport type { Node, Container, DeclarationProps, DrawingProps } from \"./nodes\";\nimport { DeclarationNode, DrawingNode, NodeType } from \"./nodes\";\nimport { exhaustiveCheck, shallowEq } from \"./typeddash\";\n\nconst DEBUG = false;\nexport const debug = (...args: Parameters<typeof console.log>) => {\n if (DEBUG) {\n console.log(...args);\n }\n};\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n skDeclaration: DeclarationProps<any>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n skDrawing: DrawingProps<any>;\n }\n }\n}\n\ntype Instance = Node;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype Props = any;\ntype TextInstance = Node;\ntype SuspenseInstance = Instance;\ntype HydratableInstance = Instance;\ntype PublicInstance = Instance;\ntype HostContext = null;\ntype UpdatePayload = true;\ntype ChildSet = unknown;\ntype TimeoutHandle = NodeJS.Timeout;\ntype NoTimeout = -1;\n\ntype SkiaHostConfig = HostConfig<\n NodeType,\n Props,\n Container,\n Instance,\n TextInstance,\n SuspenseInstance,\n HydratableInstance,\n PublicInstance,\n HostContext,\n UpdatePayload,\n ChildSet,\n TimeoutHandle,\n NoTimeout\n>;\n\nconst allChildrenAreMemoized = (node: Instance) => {\n if (!node.memoizable) {\n return false;\n }\n for (const child of node.children) {\n if (!child.memoized) {\n return false;\n }\n }\n return true;\n};\n\nconst bustBranchMemoization = (parent: Node) => {\n if (parent.memoizable) {\n let ancestor: Node | undefined = parent;\n while (ancestor) {\n ancestor.memoized = null;\n ancestor = ancestor.parent;\n }\n }\n};\n\nconst bustBranchMemoizable = (parent: Node) => {\n if (parent.memoizable) {\n let ancestor: Node | undefined = parent;\n while (ancestor) {\n ancestor.memoizable = false;\n ancestor = ancestor.parent;\n }\n }\n};\n\nconst appendNode = (parent: Node, child: Node) => {\n child.parent = parent;\n bustBranchMemoization(parent);\n if (!child.memoizable) {\n bustBranchMemoizable(parent);\n }\n if (!parent.memoizable) {\n child.memoizable = false;\n }\n parent.children.push(child);\n};\n\nconst removeNode = (parent: Node, child: Node) => {\n bustBranchMemoization(parent);\n const index = parent.children.indexOf(child);\n parent.children.splice(index, 1);\n child.depMgr.unsubscribeNode(child);\n // unsubscribe to all children as well\n for (const c of child.children) {\n removeNode(child, c);\n }\n};\n\nconst insertBefore = (parent: Node, child: Node, before: Node) => {\n bustBranchMemoization(parent);\n const index = parent.children.indexOf(child);\n if (index !== -1) {\n parent.children.splice(index, 1);\n }\n const beforeIndex = parent.children.indexOf(before);\n parent.children.splice(beforeIndex, 0, child);\n};\n\nconst createNode = (container: Container, type: NodeType, props: Props) => {\n switch (type) {\n case NodeType.Drawing:\n const { onDraw, skipProcessing, ...p1 } = props;\n return new DrawingNode(container.depMgr, onDraw, skipProcessing, p1);\n case NodeType.Declaration:\n const { onDeclare, ...p2 } = props;\n return new DeclarationNode(container.depMgr, onDeclare, p2);\n default:\n // TODO: here we need to throw a nice error message\n // This is the error that will show up when the user uses nodes not supported by Skia (View, Audio, etc)\n return exhaustiveCheck(type);\n }\n};\n\nexport const skHostConfig: SkiaHostConfig = {\n /**\n * This function is used by the reconciler in order to calculate current time for prioritising work.\n */\n now: Date.now,\n\n supportsMutation: true,\n isPrimaryRenderer: false,\n supportsPersistence: false,\n supportsHydration: false,\n //supportsMicrotask: true,\n\n scheduleTimeout: setTimeout,\n cancelTimeout: clearTimeout,\n noTimeout: -1,\n\n appendChildToContainer(container, child) {\n debug(\"appendChildToContainer\", container, child);\n appendNode(container, child);\n },\n\n appendChild(parent, child) {\n debug(\"appendChild\", parent, child);\n appendNode(parent, child);\n },\n\n getRootHostContext: (_rootContainerInstance: Node) => {\n debug(\"getRootHostContext\");\n return null;\n },\n\n getChildHostContext(_parentHostContext, _type, _rootContainerInstance) {\n debug(\"getChildHostContext\");\n return null;\n },\n\n shouldSetTextContent(_type, _props) {\n return false;\n },\n\n createTextInstance(\n _text,\n _rootContainerInstance,\n _hostContext,\n _internalInstanceHandle\n ) {\n debug(\"createTextInstance\");\n // return SpanNode({}, text) as SkNode;\n throw new Error(\"Text nodes are not supported yet\");\n },\n\n createInstance(\n type,\n props,\n container,\n _hostContext,\n _internalInstanceHandle\n ) {\n debug(\"createInstance\", type);\n return createNode(container, type, props) as Node;\n },\n\n appendInitialChild(parentInstance, child) {\n debug(\"appendInitialChild\");\n appendNode(parentInstance, child);\n },\n\n finalizeInitialChildren(\n parentInstance,\n _type,\n _props,\n _rootContainerInstance,\n _hostContext\n ) {\n debug(\"finalizeInitialChildren\", parentInstance);\n return false;\n },\n\n commitMount() {\n // if finalizeInitialChildren = true\n debug(\"commitMount\");\n },\n\n prepareForCommit(_containerInfo) {\n debug(\"prepareForCommit\");\n return null;\n },\n\n finalizeContainerChildren: () => {\n debug(\"finalizeContainerChildren\");\n },\n\n resetAfterCommit(container) {\n debug(\"resetAfterCommit\");\n container.redraw();\n },\n\n getPublicInstance(node: Instance) {\n debug(\"getPublicInstance\");\n return node;\n },\n\n prepareUpdate: (\n instance,\n type,\n oldProps,\n newProps,\n _rootContainerInstance,\n _hostContext\n ) => {\n debug(\"prepareUpdate\");\n const propsAreEqual = shallowEq(oldProps, newProps);\n if (propsAreEqual && !instance.memoizable) {\n return null;\n }\n debug(\"update \", type);\n return true;\n },\n\n commitUpdate(\n instance,\n _updatePayload,\n type,\n prevProps,\n nextProps,\n _internalHandle\n ) {\n debug(\"commitUpdate: \", type);\n if (shallowEq(prevProps, nextProps) && allChildrenAreMemoized(instance)) {\n return;\n }\n bustBranchMemoization(instance);\n if (instance instanceof DrawingNode) {\n const { onDraw, skipProcessing, ...props } = nextProps;\n instance.props = props;\n } else if (instance instanceof DeclarationNode) {\n const { onDeclare, ...props } = nextProps;\n instance.props = props;\n } else {\n throw new Error(\n \"Unsupported instance commitUpdate \" + instance.constructor.name\n );\n }\n },\n\n commitTextUpdate: (\n _textInstance: TextInstance,\n _oldText: string,\n _newText: string\n ) => {\n // textInstance.instance = newText;\n },\n\n clearContainer: (container) => {\n debug(\"clearContainer\");\n container.children.splice(0);\n },\n\n preparePortalMount: () => {\n debug(\"preparePortalMount\");\n },\n\n removeChild: (parent, child) => {\n removeNode(parent, child);\n },\n\n removeChildFromContainer: (parent, child) => {\n removeNode(parent, child);\n },\n\n insertInContainerBefore: (parent, child, before) => {\n insertBefore(parent, child, before);\n },\n\n insertBefore: (parent, child, before) => {\n insertBefore(parent, child, before);\n },\n};\n"]}
|
1
|
+
{"version":3,"sources":["HostConfig.ts"],"names":["createNode","isSelector","isValue","mapKeys","shallowEq","DEBUG","debug","console","log","appendNode","parent","child","addChild","removeNode","removeChild","insertBefore","before","insertChildBefore","skHostConfig","now","Date","supportsMutation","isPrimaryRenderer","supportsPersistence","supportsHydration","scheduleTimeout","setTimeout","cancelTimeout","clearTimeout","noTimeout","appendChildToContainer","container","root","appendChild","getRootHostContext","_rootContainerInstance","getChildHostContext","_parentHostContext","_type","shouldSetTextContent","_props","createTextInstance","_text","_hostContext","_internalInstanceHandle","Error","createInstance","type","pristineProps","props","node","materialize","depMgr","subscribeNode","appendInitialChild","parentInstance","finalizeInitialChildren","commitMount","prepareForCommit","_containerInfo","resetAfterCommit","redraw","getPublicInstance","prepareUpdate","_instance","oldProps","newProps","rootContainerInstance","propsAreEqual","commitUpdate","instance","updatePayload","prevProps","nextProps","_internalHandle","unsubscribeNode","setProps","commitTextUpdate","_textInstance","_oldText","_newText","clearContainer","children","forEach","preparePortalMount","removeChildFromContainer","insertInContainerBefore","result","key","prop","current","selector","value"],"mappings":"AAAA;;AACA;AAOA,SAASA,UAAT,QAA2B,kBAA3B;AAEA,SAASC,UAAT,EAAqBC,OAArB,QAAoC,cAApC;AACA,SAASC,OAAT,EAAkBC,SAAlB,QAAmC,aAAnC;AAEA,MAAMC,KAAK,GAAG,KAAd;AACA,OAAO,MAAMC,KAAK,GAAG,YAA6C;AAChE,MAAID,KAAJ,EAAW;AACTE,IAAAA,OAAO,CAACC,GAAR,CAAY,YAAZ;AACD;AACF,CAJM;;AAmCP,MAAMC,UAAU,GAAG,CAACC,MAAD,EAAwBC,KAAxB,KAAiD;AAClED,EAAAA,MAAM,CAACE,QAAP,CAAg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9C,EAAAA,OAAO,CAAC8C,KAAD,CAAP,CAAekC,OAAf,CAAwBK,GAAD,IAAS;AAC9B,UAAMC,IAAI,GAAGxC,KAAK,CAACuC,GAAD,CAAlB;;AACA,QAAItF,OAAO,CAACuF,IAAD,CAAX,EAAmB;AACjBF,MAAAA,MAAM,CAACC,GAAD,CAAN,GAAeC,IAAD,CAAmCC,OAAjD;AACD,KAFD,MAEO,IAAIzF,UAAU,CAACwF,IAAD,CAAd,EAAsB;AAC3BF,MAAAA,MAAM,CAACC,GAAD,CAAN,GAAcC,IAAI,CAACE,QAAL,CAAcF,IAAI,CAACG,KAAL,CAAWF,OAAzB,CAAd;AACD;AACF,GAPD;AASA,SAAOH,MAAP;AACD,CAZD","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/*global NodeJS*/\nimport type { HostConfig } from \"react-reconciler\";\n\nimport type { NodeType, Node } from \"../dom/types\";\nimport type { SkiaValue } from \"../values\";\n\nimport type { Container } from \"./Container\";\nimport { createNode } from \"./HostComponents\";\nimport type { AnimatedProps } from \"./processors\";\nimport { isSelector, isValue } from \"./processors\";\nimport { mapKeys, shallowEq } from \"./typeddash\";\n\nconst DEBUG = false;\nexport const debug = (...args: Parameters<typeof console.log>) => {\n if (DEBUG) {\n console.log(...args);\n }\n};\n\ntype Instance = Node<unknown>;\n\ntype Props = any;\ntype TextInstance = Node<unknown>;\ntype SuspenseInstance = Instance;\ntype HydratableInstance = Instance;\ntype PublicInstance = Instance;\ntype HostContext = null;\ntype UpdatePayload = Container;\ntype ChildSet = unknown;\ntype TimeoutHandle = NodeJS.Timeout;\ntype NoTimeout = -1;\n\ntype SkiaHostConfig = HostConfig<\n NodeType,\n Props,\n Container,\n Instance,\n TextInstance,\n SuspenseInstance,\n HydratableInstance,\n PublicInstance,\n HostContext,\n UpdatePayload,\n ChildSet,\n TimeoutHandle,\n NoTimeout\n>;\n\nconst appendNode = (parent: Node<unknown>, child: Node<unknown>) => {\n parent.addChild(child);\n};\n\nconst removeNode = (parent: Node<unknown>, child: Node<unknown>) => {\n return parent.removeChild(child);\n};\n\nconst insertBefore = (\n parent: Node<unknown>,\n child: Node<unknown>,\n before: Node<unknown>\n) => {\n parent.insertChildBefore(child, before);\n};\n\nexport const skHostConfig: SkiaHostConfig = {\n /**\n * This function is used by the reconciler in order to calculate current time for prioritising work.\n */\n now: Date.now,\n\n supportsMutation: true,\n isPrimaryRenderer: false,\n supportsPersistence: false,\n supportsHydration: false,\n //supportsMicrotask: true,\n\n scheduleTimeout: setTimeout,\n cancelTimeout: clearTimeout,\n noTimeout: -1,\n\n appendChildToContainer(container, child) {\n debug(\"appendChildToContainer\", container, child);\n appendNode(container.root, child);\n },\n\n appendChild(parent, child) {\n debug(\"appendChild\", parent, child);\n appendNode(parent, child);\n },\n\n getRootHostContext: (_rootContainerInstance: Container) => {\n debug(\"getRootHostContext\");\n return null;\n },\n\n getChildHostContext(_parentHostContext, _type, _rootContainerInstance) {\n debug(\"getChildHostContext\");\n return null;\n },\n\n shouldSetTextContent(_type, _props) {\n return false;\n },\n\n createTextInstance(\n _text,\n _rootContainerInstance,\n _hostContext,\n _internalInstanceHandle\n ) {\n debug(\"createTextInstance\");\n // return SpanNode({}, text) as SkNode;\n throw new Error(\"Text nodes are not supported yet\");\n },\n\n createInstance(\n type,\n pristineProps,\n container,\n _hostContext,\n _internalInstanceHandle\n ) {\n debug(\"createInstance\", type);\n const props = { ...pristineProps };\n const node = createNode(container, type, materialize(props));\n container.depMgr.subscribeNode(node, props);\n return node;\n },\n\n appendInitialChild(parentInstance, child) {\n debug(\"appendInitialChild\");\n appendNode(parentInstance, child);\n },\n\n finalizeInitialChildren(\n parentInstance,\n _type,\n _props,\n _rootContainerInstance,\n _hostContext\n ) {\n debug(\"finalizeInitialChildren\", parentInstance);\n return false;\n },\n\n commitMount() {\n // if finalizeInitialChildren = true\n debug(\"commitMount\");\n },\n\n prepareForCommit(_containerInfo) {\n debug(\"prepareForCommit\");\n return null;\n },\n\n resetAfterCommit(container) {\n debug(\"resetAfterCommit\");\n container.redraw();\n },\n\n getPublicInstance(node: Instance) {\n debug(\"getPublicInstance\");\n return node;\n },\n\n prepareUpdate: (\n _instance,\n type,\n oldProps,\n newProps,\n rootContainerInstance,\n _hostContext\n ) => {\n debug(\"prepareUpdate\");\n const propsAreEqual = shallowEq(oldProps, newProps);\n if (propsAreEqual) {\n return null;\n }\n debug(\"update \", type);\n return rootContainerInstance;\n },\n\n commitUpdate(\n instance,\n updatePayload,\n type,\n prevProps,\n nextProps,\n _internalHandle\n ) {\n debug(\"commitUpdate: \", type);\n if (shallowEq(prevProps, nextProps)) {\n return;\n }\n const props = { ...nextProps };\n updatePayload.depMgr.unsubscribeNode(instance);\n instance.setProps(materialize(props));\n updatePayload.depMgr.subscribeNode(instance, props);\n },\n\n commitTextUpdate: (\n _textInstance: TextInstance,\n _oldText: string,\n _newText: string\n ) => {\n // textInstance.instance = newText;\n },\n\n clearContainer: (container) => {\n debug(\"clearContainer\");\n container.root.children().forEach((child) => {\n container.root.removeChild(child);\n });\n },\n\n preparePortalMount: () => {\n debug(\"preparePortalMount\");\n },\n\n removeChild: (parent, child) => {\n removeNode(parent, child);\n },\n\n removeChildFromContainer: (container, child) => {\n removeNode(container.root, child);\n },\n\n insertInContainerBefore: (container, child, before) => {\n insertBefore(container.root, child, before);\n },\n\n insertBefore: (parent, child, before) => {\n insertBefore(parent, child, before);\n },\n};\n\nconst materialize = <P>(props: AnimatedProps<P>) => {\n const result = { ...props };\n mapKeys(props).forEach((key) => {\n const prop = props[key];\n if (isValue(prop)) {\n result[key] = (prop as SkiaValue<P[typeof key]>).current;\n } else if (isSelector(prop)) {\n result[key] = prop.selector(prop.value.current) as P[typeof key];\n }\n });\n\n return result as any;\n};\n"]}
|