@shopify/react-native-skia 1.11.0 → 1.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/CMakeLists.txt +0 -8
- package/android/cpp/jni/JniLoad.cpp +0 -2
- package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaPackage.java +1 -1
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaPictureViewManagerDelegate.java +4 -2
- package/cpp/api/recorder/Convertor.h +2 -1
- package/cpp/api/recorder/DataTypes.h +70 -72
- package/cpp/api/recorder/Drawings.h +25 -24
- package/cpp/api/recorder/RNRecorder.h +12 -10
- package/cpp/api/recorder/Shaders.h +5 -5
- package/cpp/jsi/ViewProperty.h +5 -16
- package/cpp/rnskia/RNSkManager.cpp +1 -7
- package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.mm +8 -4
- package/lib/commonjs/dom/nodes/index.d.ts +0 -1
- package/lib/commonjs/dom/nodes/index.js +0 -11
- package/lib/commonjs/dom/nodes/index.js.map +1 -1
- package/lib/commonjs/external/reanimated/renderHelpers.d.ts +0 -6
- package/lib/commonjs/external/reanimated/renderHelpers.js +0 -73
- package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/commonjs/index.d.ts +0 -1
- package/lib/commonjs/index.js +0 -12
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.d.ts +10 -1
- package/lib/commonjs/renderer/Canvas.js +3 -1
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/sksg/Container.d.ts +2 -0
- package/lib/commonjs/sksg/Container.js +10 -0
- package/lib/commonjs/sksg/Container.js.map +1 -1
- package/lib/commonjs/sksg/Elements.d.ts +65 -0
- package/lib/commonjs/sksg/Elements.js +6 -0
- package/lib/commonjs/sksg/Elements.js.map +1 -0
- package/lib/commonjs/sksg/Reconciler.d.ts +1 -0
- package/lib/commonjs/sksg/Reconciler.js +2 -0
- package/lib/commonjs/sksg/Reconciler.js.map +1 -1
- package/lib/commonjs/views/index.d.ts +0 -1
- package/lib/commonjs/views/index.js +0 -11
- package/lib/commonjs/views/index.js.map +1 -1
- package/lib/module/dom/nodes/index.d.ts +0 -1
- package/lib/module/dom/nodes/index.js +0 -1
- package/lib/module/dom/nodes/index.js.map +1 -1
- package/lib/module/external/reanimated/renderHelpers.d.ts +0 -6
- package/lib/module/external/reanimated/renderHelpers.js +0 -68
- package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/module/index.d.ts +0 -1
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/renderer/Canvas.d.ts +10 -1
- package/lib/module/renderer/Canvas.js +1 -0
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/sksg/Container.d.ts +2 -0
- package/lib/module/sksg/Container.js +10 -0
- package/lib/module/sksg/Container.js.map +1 -1
- package/lib/module/sksg/Elements.d.ts +65 -0
- package/lib/module/sksg/Elements.js +2 -0
- package/lib/module/sksg/Elements.js.map +1 -0
- package/lib/module/sksg/Reconciler.d.ts +1 -0
- package/lib/module/sksg/Reconciler.js +2 -0
- package/lib/module/sksg/Reconciler.js.map +1 -1
- package/lib/module/views/index.d.ts +0 -1
- package/lib/module/views/index.js +0 -1
- package/lib/module/views/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/external/reanimated/renderHelpers.d.ts +0 -3
- package/lib/typescript/lib/commonjs/renderer/Canvas.d.ts +1 -0
- package/lib/typescript/lib/commonjs/sksg/Container.d.ts +2 -0
- package/lib/typescript/lib/commonjs/sksg/Elements.d.ts +1 -0
- package/lib/typescript/lib/commonjs/sksg/Reconciler.d.ts +6 -0
- package/lib/typescript/lib/module/dom/nodes/index.d.ts +0 -1
- package/lib/typescript/lib/module/external/reanimated/renderHelpers.d.ts +0 -3
- package/lib/typescript/lib/module/index.d.ts +0 -1
- package/lib/typescript/lib/module/mock/index.d.ts +0 -1
- package/lib/typescript/lib/module/renderer/Canvas.d.ts +1 -0
- package/lib/typescript/lib/module/sksg/Container.d.ts +2 -0
- package/lib/typescript/lib/module/sksg/Elements.d.ts +1 -0
- package/lib/typescript/lib/module/sksg/Reconciler.d.ts +6 -0
- package/lib/typescript/lib/module/views/index.d.ts +0 -1
- package/lib/typescript/src/dom/nodes/index.d.ts +0 -1
- package/lib/typescript/src/external/reanimated/renderHelpers.d.ts +0 -6
- package/lib/typescript/src/index.d.ts +0 -1
- package/lib/typescript/src/renderer/Canvas.d.ts +10 -1
- package/lib/typescript/src/sksg/Container.d.ts +2 -0
- package/lib/typescript/src/sksg/Elements.d.ts +65 -0
- package/lib/typescript/src/sksg/Reconciler.d.ts +1 -0
- package/lib/typescript/src/views/index.d.ts +0 -1
- package/package.json +1 -1
- package/src/dom/nodes/index.ts +0 -1
- package/src/external/reanimated/renderHelpers.ts +1 -78
- package/src/index.ts +0 -1
- package/src/renderer/Canvas.tsx +11 -1
- package/src/sksg/Container.ts +11 -0
- package/src/sksg/Elements.tsx +136 -0
- package/src/sksg/Reconciler.ts +2 -0
- package/src/views/index.ts +0 -1
- package/android/cpp/jni/include/JniSkiaDomView.h +0 -82
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDomView.java +0 -41
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDomViewManager.java +0 -32
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaDomViewManagerDelegate.java +0 -34
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaDomViewManagerInterface.java +0 -18
- package/cpp/rnskia/RNSkDomView.cpp +0 -121
- package/cpp/rnskia/RNSkDomView.h +0 -97
- package/cpp/rnskia/dom/JsiDomApi.h +0 -165
- package/cpp/rnskia/dom/base/BaseNodeProp.h +0 -72
- package/cpp/rnskia/dom/base/ConcatablePaint.cpp +0 -117
- package/cpp/rnskia/dom/base/ConcatablePaint.h +0 -49
- package/cpp/rnskia/dom/base/Declaration.h +0 -86
- package/cpp/rnskia/dom/base/DeclarationContext.h +0 -79
- package/cpp/rnskia/dom/base/DerivedNodeProp.h +0 -203
- package/cpp/rnskia/dom/base/DrawingContext.cpp +0 -55
- package/cpp/rnskia/dom/base/DrawingContext.h +0 -104
- package/cpp/rnskia/dom/base/JsiDomDeclarationNode.h +0 -119
- package/cpp/rnskia/dom/base/JsiDomDrawingNode.h +0 -71
- package/cpp/rnskia/dom/base/JsiDomNode.h +0 -572
- package/cpp/rnskia/dom/base/JsiDomRenderNode.h +0 -262
- package/cpp/rnskia/dom/base/NodeProp.h +0 -139
- package/cpp/rnskia/dom/base/NodePropsContainer.h +0 -158
- package/cpp/rnskia/dom/nodes/JsiAtlasNode.h +0 -64
- package/cpp/rnskia/dom/nodes/JsiBackdropFilterNode.h +0 -49
- package/cpp/rnskia/dom/nodes/JsiBlendNode.h +0 -94
- package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +0 -75
- package/cpp/rnskia/dom/nodes/JsiBoxNode.h +0 -94
- package/cpp/rnskia/dom/nodes/JsiBoxShadowNode.h +0 -33
- package/cpp/rnskia/dom/nodes/JsiCircleNode.h +0 -35
- package/cpp/rnskia/dom/nodes/JsiColorFilterNodes.h +0 -164
- package/cpp/rnskia/dom/nodes/JsiDiffRectNode.h +0 -37
- package/cpp/rnskia/dom/nodes/JsiFillNode.h +0 -22
- package/cpp/rnskia/dom/nodes/JsiGlyphsNode.h +0 -53
- package/cpp/rnskia/dom/nodes/JsiGroupNode.h +0 -25
- package/cpp/rnskia/dom/nodes/JsiImageFilterNodes.h +0 -361
- package/cpp/rnskia/dom/nodes/JsiImageNode.h +0 -43
- package/cpp/rnskia/dom/nodes/JsiImageSvgNode.h +0 -63
- package/cpp/rnskia/dom/nodes/JsiLayerNode.h +0 -74
- package/cpp/rnskia/dom/nodes/JsiLineNode.h +0 -38
- package/cpp/rnskia/dom/nodes/JsiOvalNode.h +0 -32
- package/cpp/rnskia/dom/nodes/JsiPaintNode.h +0 -119
- package/cpp/rnskia/dom/nodes/JsiParagraphNode.h +0 -62
- package/cpp/rnskia/dom/nodes/JsiPatchNode.h +0 -50
- package/cpp/rnskia/dom/nodes/JsiPathEffectNodes.h +0 -268
- package/cpp/rnskia/dom/nodes/JsiPathNode.h +0 -181
- package/cpp/rnskia/dom/nodes/JsiPictureNode.h +0 -31
- package/cpp/rnskia/dom/nodes/JsiPointsNode.h +0 -48
- package/cpp/rnskia/dom/nodes/JsiRRectNode.h +0 -33
- package/cpp/rnskia/dom/nodes/JsiRectNode.h +0 -33
- package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +0 -434
- package/cpp/rnskia/dom/nodes/JsiTextBlobNode.h +0 -44
- package/cpp/rnskia/dom/nodes/JsiTextNode.h +0 -51
- package/cpp/rnskia/dom/nodes/JsiTextPathNode.h +0 -33
- package/cpp/rnskia/dom/nodes/JsiVerticesNode.h +0 -41
- package/cpp/rnskia/dom/props/BezierProps.h +0 -65
- package/cpp/rnskia/dom/props/BlendModeProp.h +0 -103
- package/cpp/rnskia/dom/props/BoxShadowProps.h +0 -62
- package/cpp/rnskia/dom/props/CircleProp.h +0 -49
- package/cpp/rnskia/dom/props/ClipProp.h +0 -57
- package/cpp/rnskia/dom/props/ColorProp.h +0 -96
- package/cpp/rnskia/dom/props/FontProp.h +0 -42
- package/cpp/rnskia/dom/props/GlyphsProp.h +0 -55
- package/cpp/rnskia/dom/props/LayerProp.h +0 -52
- package/cpp/rnskia/dom/props/MatrixProp.h +0 -54
- package/cpp/rnskia/dom/props/NumbersProp.h +0 -67
- package/cpp/rnskia/dom/props/PaintProps.h +0 -133
- package/cpp/rnskia/dom/props/ParagraphProp.h +0 -45
- package/cpp/rnskia/dom/props/PathProp.h +0 -59
- package/cpp/rnskia/dom/props/PictureProp.h +0 -40
- package/cpp/rnskia/dom/props/PointProp.h +0 -65
- package/cpp/rnskia/dom/props/PointsProp.h +0 -81
- package/cpp/rnskia/dom/props/RRectProp.h +0 -222
- package/cpp/rnskia/dom/props/RSXformProp.h +0 -52
- package/cpp/rnskia/dom/props/RadiusProp.h +0 -43
- package/cpp/rnskia/dom/props/RectProp.h +0 -164
- package/cpp/rnskia/dom/props/SamplingProp.h +0 -54
- package/cpp/rnskia/dom/props/SkImageProps.h +0 -196
- package/cpp/rnskia/dom/props/StrokeProps.h +0 -79
- package/cpp/rnskia/dom/props/SvgProp.h +0 -45
- package/cpp/rnskia/dom/props/TextBlobProp.h +0 -133
- package/cpp/rnskia/dom/props/TileModeProp.h +0 -52
- package/cpp/rnskia/dom/props/TransformProp.h +0 -147
- package/cpp/rnskia/dom/props/TransformsProps.h +0 -66
- package/cpp/rnskia/dom/props/UniformsProp.h +0 -159
- package/cpp/rnskia/dom/props/VertexModeProp.h +0 -49
- package/cpp/rnskia/dom/props/VerticesProps.h +0 -63
- package/ios/RNSkia-iOS/SkiaDomView.h +0 -7
- package/ios/RNSkia-iOS/SkiaDomView.mm +0 -63
- package/ios/RNSkia-iOS/SkiaDomViewManager.h +0 -8
- package/ios/RNSkia-iOS/SkiaDomViewManager.mm +0 -51
- package/lib/commonjs/dom/nodes/JsiSkDOM.d.ts +0 -64
- package/lib/commonjs/dom/nodes/JsiSkDOM.js +0 -196
- package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +0 -1
- package/lib/commonjs/renderer/CanvasOld.d.ts +0 -11
- package/lib/commonjs/renderer/CanvasOld.js +0 -96
- package/lib/commonjs/renderer/CanvasOld.js.map +0 -1
- package/lib/commonjs/renderer/Container.d.ts +0 -10
- package/lib/commonjs/renderer/Container.js +0 -26
- package/lib/commonjs/renderer/Container.js.map +0 -1
- package/lib/commonjs/renderer/HostComponents.d.ts +0 -129
- package/lib/commonjs/renderer/HostComponents.js +0 -141
- package/lib/commonjs/renderer/HostComponents.js.map +0 -1
- package/lib/commonjs/renderer/HostConfig.d.ts +0 -18
- package/lib/commonjs/renderer/HostConfig.js +0 -157
- package/lib/commonjs/renderer/HostConfig.js.map +0 -1
- package/lib/commonjs/renderer/Reconciler.d.ts +0 -9
- package/lib/commonjs/renderer/Reconciler.js +0 -44
- package/lib/commonjs/renderer/Reconciler.js.map +0 -1
- package/lib/commonjs/specs/SkiaDomViewNativeComponent.d.ts +0 -6
- package/lib/commonjs/specs/SkiaDomViewNativeComponent.js +0 -11
- package/lib/commonjs/specs/SkiaDomViewNativeComponent.js.map +0 -1
- package/lib/commonjs/views/SkiaDomView.d.ts +0 -33
- package/lib/commonjs/views/SkiaDomView.js +0 -119
- package/lib/commonjs/views/SkiaDomView.js.map +0 -1
- package/lib/commonjs/views/SkiaDomView.web.d.ts +0 -0
- package/lib/commonjs/views/SkiaDomView.web.js +0 -2
- package/lib/commonjs/views/SkiaDomView.web.js.map +0 -1
- package/lib/module/dom/nodes/JsiSkDOM.d.ts +0 -64
- package/lib/module/dom/nodes/JsiSkDOM.js +0 -189
- package/lib/module/dom/nodes/JsiSkDOM.js.map +0 -1
- package/lib/module/renderer/CanvasOld.d.ts +0 -11
- package/lib/module/renderer/CanvasOld.js +0 -87
- package/lib/module/renderer/CanvasOld.js.map +0 -1
- package/lib/module/renderer/Container.d.ts +0 -10
- package/lib/module/renderer/Container.js +0 -19
- package/lib/module/renderer/Container.js.map +0 -1
- package/lib/module/renderer/HostComponents.d.ts +0 -129
- package/lib/module/renderer/HostComponents.js +0 -134
- package/lib/module/renderer/HostComponents.js.map +0 -1
- package/lib/module/renderer/HostConfig.d.ts +0 -18
- package/lib/module/renderer/HostConfig.js +0 -150
- package/lib/module/renderer/HostConfig.js.map +0 -1
- package/lib/module/renderer/Reconciler.d.ts +0 -9
- package/lib/module/renderer/Reconciler.js +0 -36
- package/lib/module/renderer/Reconciler.js.map +0 -1
- package/lib/module/specs/SkiaDomViewNativeComponent.d.ts +0 -6
- package/lib/module/specs/SkiaDomViewNativeComponent.js +0 -4
- package/lib/module/specs/SkiaDomViewNativeComponent.js.map +0 -1
- package/lib/module/views/SkiaDomView.d.ts +0 -33
- package/lib/module/views/SkiaDomView.js +0 -111
- package/lib/module/views/SkiaDomView.js.map +0 -1
- package/lib/module/views/SkiaDomView.web.d.ts +0 -0
- package/lib/module/views/SkiaDomView.web.js +0 -2
- package/lib/module/views/SkiaDomView.web.js.map +0 -1
- package/lib/typescript/lib/commonjs/dom/nodes/JsiSkDOM.d.ts +0 -60
- package/lib/typescript/lib/commonjs/renderer/CanvasOld.d.ts +0 -3
- package/lib/typescript/lib/commonjs/renderer/Container.d.ts +0 -9
- package/lib/typescript/lib/commonjs/renderer/HostComponents.d.ts +0 -2
- package/lib/typescript/lib/commonjs/renderer/HostConfig.d.ts +0 -40
- package/lib/typescript/lib/commonjs/renderer/Reconciler.d.ts +0 -10
- package/lib/typescript/lib/commonjs/specs/SkiaDomViewNativeComponent.d.ts +0 -3
- package/lib/typescript/lib/commonjs/views/SkiaDomView.d.ts +0 -30
- package/lib/typescript/lib/commonjs/views/SkiaDomView.web.d.ts +0 -0
- package/lib/typescript/lib/module/dom/nodes/JsiSkDOM.d.ts +0 -59
- package/lib/typescript/lib/module/renderer/CanvasOld.d.ts +0 -3
- package/lib/typescript/lib/module/renderer/Container.d.ts +0 -9
- package/lib/typescript/lib/module/renderer/HostComponents.d.ts +0 -1
- package/lib/typescript/lib/module/renderer/HostConfig.d.ts +0 -39
- package/lib/typescript/lib/module/renderer/Reconciler.d.ts +0 -9
- package/lib/typescript/lib/module/specs/SkiaDomViewNativeComponent.d.ts +0 -2
- package/lib/typescript/lib/module/views/SkiaDomView.d.ts +0 -27
- package/lib/typescript/lib/module/views/SkiaDomView.web.d.ts +0 -0
- package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +0 -64
- package/lib/typescript/src/renderer/CanvasOld.d.ts +0 -11
- package/lib/typescript/src/renderer/Container.d.ts +0 -10
- package/lib/typescript/src/renderer/HostComponents.d.ts +0 -129
- package/lib/typescript/src/renderer/HostConfig.d.ts +0 -18
- package/lib/typescript/src/renderer/Reconciler.d.ts +0 -9
- package/lib/typescript/src/specs/SkiaDomViewNativeComponent.d.ts +0 -6
- package/lib/typescript/src/views/SkiaDomView.d.ts +0 -33
- package/lib/typescript/src/views/SkiaDomView.web.d.ts +0 -0
- package/src/dom/nodes/JsiSkDOM.ts +0 -298
- package/src/renderer/CanvasOld.tsx +0 -126
- package/src/renderer/Container.tsx +0 -19
- package/src/renderer/HostComponents.ts +0 -399
- package/src/renderer/HostConfig.ts +0 -258
- package/src/renderer/Reconciler.tsx +0 -54
- package/src/specs/SkiaDomViewNativeComponent.ts +0 -9
- package/src/views/SkiaDomView.tsx +0 -124
- package/src/views/SkiaDomView.web.tsx +0 -0
- /package/cpp/api/recorder/{Image.h → ImageFit.h} +0 -0
|
@@ -1,134 +0,0 @@
|
|
|
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
|
-
switch (type) {
|
|
8
|
-
case NodeType.Layer:
|
|
9
|
-
return Sk.Layer(props);
|
|
10
|
-
case NodeType.Group:
|
|
11
|
-
return Sk.Group(props);
|
|
12
|
-
case NodeType.Paint:
|
|
13
|
-
return Sk.Paint(props);
|
|
14
|
-
// Drawings
|
|
15
|
-
case NodeType.Fill:
|
|
16
|
-
return Sk.Fill(props);
|
|
17
|
-
case NodeType.Image:
|
|
18
|
-
return Sk.Image(props);
|
|
19
|
-
case NodeType.Circle:
|
|
20
|
-
return Sk.Circle(props);
|
|
21
|
-
case NodeType.Path:
|
|
22
|
-
return Sk.Path(props);
|
|
23
|
-
case NodeType.Line:
|
|
24
|
-
return Sk.Line(props);
|
|
25
|
-
case NodeType.Oval:
|
|
26
|
-
return Sk.Oval(props);
|
|
27
|
-
case NodeType.Patch:
|
|
28
|
-
return Sk.Patch(props);
|
|
29
|
-
case NodeType.Points:
|
|
30
|
-
return Sk.Points(props);
|
|
31
|
-
case NodeType.Rect:
|
|
32
|
-
return Sk.Rect(props);
|
|
33
|
-
case NodeType.RRect:
|
|
34
|
-
return Sk.RRect(props);
|
|
35
|
-
case NodeType.Vertices:
|
|
36
|
-
return Sk.Vertices(props);
|
|
37
|
-
case NodeType.Text:
|
|
38
|
-
return Sk.Text(props);
|
|
39
|
-
case NodeType.TextPath:
|
|
40
|
-
return Sk.TextPath(props);
|
|
41
|
-
case NodeType.TextBlob:
|
|
42
|
-
return Sk.TextBlob(props);
|
|
43
|
-
case NodeType.Glyphs:
|
|
44
|
-
return Sk.Glyphs(props);
|
|
45
|
-
case NodeType.Atlas:
|
|
46
|
-
return Sk.Atlas(props);
|
|
47
|
-
case NodeType.DiffRect:
|
|
48
|
-
return Sk.DiffRect(props);
|
|
49
|
-
case NodeType.Picture:
|
|
50
|
-
return Sk.Picture(props);
|
|
51
|
-
case NodeType.ImageSVG:
|
|
52
|
-
return Sk.ImageSVG(props);
|
|
53
|
-
// Mask Filter
|
|
54
|
-
case NodeType.BlurMaskFilter:
|
|
55
|
-
return Sk.BlurMaskFilter(props);
|
|
56
|
-
// Image Filter
|
|
57
|
-
case NodeType.BlendImageFilter:
|
|
58
|
-
return Sk.BlendImageFilter(props);
|
|
59
|
-
case NodeType.BlurImageFilter:
|
|
60
|
-
return Sk.BlurImageFilter(props);
|
|
61
|
-
case NodeType.OffsetImageFilter:
|
|
62
|
-
return Sk.OffsetImageFilter(props);
|
|
63
|
-
case NodeType.DropShadowImageFilter:
|
|
64
|
-
return Sk.DropShadowImageFilter(props);
|
|
65
|
-
case NodeType.DisplacementMapImageFilter:
|
|
66
|
-
return Sk.DisplacementMapImageFilter(props);
|
|
67
|
-
case NodeType.MorphologyImageFilter:
|
|
68
|
-
return Sk.MorphologyImageFilter(props);
|
|
69
|
-
case NodeType.RuntimeShaderImageFilter:
|
|
70
|
-
return Sk.RuntimeShaderImageFilter(props);
|
|
71
|
-
// Color Filter
|
|
72
|
-
case NodeType.MatrixColorFilter:
|
|
73
|
-
return Sk.MatrixColorFilter(props);
|
|
74
|
-
case NodeType.BlendColorFilter:
|
|
75
|
-
return Sk.BlendColorFilter(props);
|
|
76
|
-
case NodeType.LerpColorFilter:
|
|
77
|
-
return Sk.LerpColorFilter(props);
|
|
78
|
-
case NodeType.LumaColorFilter:
|
|
79
|
-
return Sk.LumaColorFilter();
|
|
80
|
-
case NodeType.LinearToSRGBGammaColorFilter:
|
|
81
|
-
return Sk.LinearToSRGBGammaColorFilter();
|
|
82
|
-
case NodeType.SRGBToLinearGammaColorFilter:
|
|
83
|
-
return Sk.SRGBToLinearGammaColorFilter();
|
|
84
|
-
// Shader
|
|
85
|
-
case NodeType.Shader:
|
|
86
|
-
return Sk.Shader(props);
|
|
87
|
-
case NodeType.ImageShader:
|
|
88
|
-
return Sk.ImageShader(props);
|
|
89
|
-
case NodeType.ColorShader:
|
|
90
|
-
return Sk.ColorShader(props);
|
|
91
|
-
case NodeType.Turbulence:
|
|
92
|
-
return Sk.Turbulence(props);
|
|
93
|
-
case NodeType.FractalNoise:
|
|
94
|
-
return Sk.FractalNoise(props);
|
|
95
|
-
case NodeType.LinearGradient:
|
|
96
|
-
return Sk.LinearGradient(props);
|
|
97
|
-
case NodeType.RadialGradient:
|
|
98
|
-
return Sk.RadialGradient(props);
|
|
99
|
-
case NodeType.SweepGradient:
|
|
100
|
-
return Sk.SweepGradient(props);
|
|
101
|
-
case NodeType.TwoPointConicalGradient:
|
|
102
|
-
return Sk.TwoPointConicalGradient(props);
|
|
103
|
-
// Path Effect
|
|
104
|
-
case NodeType.CornerPathEffect:
|
|
105
|
-
return Sk.CornerPathEffect(props);
|
|
106
|
-
case NodeType.DiscretePathEffect:
|
|
107
|
-
return Sk.DiscretePathEffect(props);
|
|
108
|
-
case NodeType.DashPathEffect:
|
|
109
|
-
return Sk.DashPathEffect(props);
|
|
110
|
-
case NodeType.Path1DPathEffect:
|
|
111
|
-
return Sk.Path1DPathEffect(props);
|
|
112
|
-
case NodeType.Path2DPathEffect:
|
|
113
|
-
return Sk.Path2DPathEffect(props);
|
|
114
|
-
case NodeType.SumPathEffect:
|
|
115
|
-
return Sk.SumPathEffect();
|
|
116
|
-
case NodeType.Line2DPathEffect:
|
|
117
|
-
return Sk.Line2DPathEffect(props);
|
|
118
|
-
// Mixed
|
|
119
|
-
case NodeType.Blend:
|
|
120
|
-
return Sk.Blend(props);
|
|
121
|
-
case NodeType.BackdropFilter:
|
|
122
|
-
return Sk.BackdropFilter(props);
|
|
123
|
-
case NodeType.Box:
|
|
124
|
-
return Sk.Box(props);
|
|
125
|
-
case NodeType.BoxShadow:
|
|
126
|
-
return Sk.BoxShadow(props);
|
|
127
|
-
// Paragraph
|
|
128
|
-
case NodeType.Paragraph:
|
|
129
|
-
return Sk.Paragraph(props);
|
|
130
|
-
default:
|
|
131
|
-
return exhaustiveCheck(type);
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
//# sourceMappingURL=HostComponents.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["NodeType","exhaustiveCheck","createNode","container","type","props","Sk","Layer","Group","Paint","Fill","Image","Circle","Path","Line","Oval","Patch","Points","Rect","RRect","Vertices","Text","TextPath","TextBlob","Glyphs","Atlas","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","Paragraph"],"sources":["HostComponents.ts"],"sourcesContent":["import { NodeType } from \"../dom/types\";\nimport type {\n DeclarationNode,\n FractalNoiseProps,\n RenderNode,\n CircleProps,\n DrawingNodeProps,\n ImageProps,\n PaintProps,\n PathProps,\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 ParagraphProps,\n AtlasProps,\n} from \"../dom/types\";\nimport type { ChildrenProps } from \"../dom/types/Common\";\nimport type {\n BlendProps,\n MorphologyImageFilterProps,\n} from \"../dom/types/ImageFilters\";\n\nimport type { Container } from \"./Container\";\nimport { exhaustiveCheck } from \"./typeddash\";\nimport type { SkiaProps } from \"./processors\";\n\ndeclare global {\n var SkiaDomApi: {\n RectNode: (props: RectProps) => RenderNode<RectProps>;\n RRectNode: (props: RoundedRectProps) => RenderNode<RoundedRectProps>;\n GroupNode: (props: GroupProps) => RenderNode<GroupProps>;\n PaintNode: (props: PaintProps) => DeclarationNode<PaintProps>;\n FillNode: (props: PaintProps) => RenderNode<PaintProps>;\n CircleNode: (props: CircleProps) => RenderNode<CircleProps>;\n PathNode: (props: PathProps) => RenderNode<PathProps>;\n LineNode: (props: LineProps) => RenderNode<LineProps>;\n ImageNode: (props: ImageProps) => RenderNode<ImageProps>;\n OvalNode: (props: OvalProps) => RenderNode<OvalProps>;\n PatchNode: (props: PatchProps) => RenderNode<PatchProps>;\n PointsNode: (props: PointsProps) => RenderNode<PointsProps>;\n DiffRectNode: (props: DiffRectProps) => RenderNode<DiffRectProps>;\n AtlasNode: (props: AtlasProps) => RenderNode<AtlasProps>;\n\n // Mask filters\n BlurMaskFilterNode: (\n props: BlurMaskFilterProps\n ) => DeclarationNode<BlurMaskFilterProps>;\n\n // Path effects\n DashPathEffectNode: (\n props: DashPathEffectProps\n ) => DeclarationNode<DashPathEffectProps>;\n DiscretePathEffectNode: (\n props: DiscretePathEffectProps\n ) => DeclarationNode<DiscretePathEffectProps>;\n CornerPathEffectNode: (\n props: CornerPathEffectProps\n ) => DeclarationNode<CornerPathEffectProps>;\n Path1DPathEffectNode: (\n props: Path1DPathEffectProps\n ) => DeclarationNode<Path1DPathEffectProps>;\n Path2DPathEffectNode: (\n props: Path2DPathEffectProps\n ) => DeclarationNode<Path2DPathEffectProps>;\n Line2DPathEffectNode: (\n props: Line2DPathEffectProps\n ) => DeclarationNode<Line2DPathEffectProps>;\n SumPathEffectNode: () => DeclarationNode<null>;\n\n // Image filters\n BlendImageFilterNode: (\n props: BlendImageFilterProps\n ) => DeclarationNode<BlendImageFilterProps>;\n DropShadowImageFilterNode: (\n props: DropShadowImageFilterProps\n ) => DeclarationNode<DropShadowImageFilterProps>;\n DisplacementMapImageFilterNode: (\n props: DisplacementMapImageFilterProps\n ) => DeclarationNode<DisplacementMapImageFilterProps>;\n BlurImageFilterNode: (\n props: BlurImageFilterProps\n ) => DeclarationNode<BlurImageFilterProps>;\n OffsetImageFilterNode: (\n props: OffsetImageFilterProps\n ) => DeclarationNode<OffsetImageFilterProps>;\n MorphologyImageFilterNode: (\n props: MorphologyImageFilterProps\n ) => DeclarationNode<MorphologyImageFilterProps>;\n RuntimeShaderImageFilterNode: (\n props: RuntimeShaderImageFilterProps\n ) => DeclarationNode<RuntimeShaderImageFilterProps>;\n\n // Color filters\n MatrixColorFilterNode: (\n props: MatrixColorFilterProps\n ) => DeclarationNode<MatrixColorFilterProps>;\n BlendColorFilterNode: (\n props: BlendColorFilterProps\n ) => DeclarationNode<BlendColorFilterProps>;\n LinearToSRGBGammaColorFilterNode: () => DeclarationNode<null>;\n SRGBToLinearGammaColorFilterNode: () => DeclarationNode<null>;\n LumaColorFilterNode: () => DeclarationNode<null>;\n LerpColorFilterNode: (\n props: LerpColorFilterProps\n ) => DeclarationNode<LerpColorFilterProps>;\n\n // Shaders\n ShaderNode: (props: ShaderProps) => DeclarationNode<ShaderProps>;\n ImageShaderNode: (\n props: ImageShaderProps\n ) => DeclarationNode<ImageShaderProps>;\n ColorShaderNode: (props: ColorProps) => DeclarationNode<ColorProps>;\n TurbulenceNode: (\n props: TurbulenceProps\n ) => DeclarationNode<TurbulenceProps>;\n FractalNoiseNode: (\n props: FractalNoiseProps\n ) => DeclarationNode<FractalNoiseProps>;\n LinearGradientNode: (\n props: LinearGradientProps\n ) => DeclarationNode<LinearGradientProps>;\n RadialGradientNode: (\n props: RadialGradientProps\n ) => DeclarationNode<RadialGradientProps>;\n SweepGradientNode: (\n props: SweepGradientProps\n ) => DeclarationNode<SweepGradientProps>;\n TwoPointConicalGradientNode: (\n props: TwoPointConicalGradientProps\n ) => DeclarationNode<TwoPointConicalGradientProps>;\n PictureNode: (props: PictureProps) => RenderNode<PictureProps>;\n ImageSVGNode: (props: ImageSVGProps) => RenderNode<ImageSVGProps>;\n VerticesNode: (props: VerticesProps) => RenderNode<VerticesProps>;\n TextNode: (prop: TextProps) => RenderNode<TextProps>;\n TextPathNode: (prop: TextPathProps) => RenderNode<TextPathProps>;\n TextBlobNode: (prop: TextBlobProps) => RenderNode<TextBlobProps>;\n GlyphsNode: (prop: GlyphsProps) => RenderNode<GlyphsProps>;\n BlendNode: (prop: BlendProps) => DeclarationNode<BlendProps>;\n BackdropFilterNode: (prop: ChildrenProps) => RenderNode<ChildrenProps>;\n BoxNode: (prop: BoxProps) => RenderNode<BoxProps>;\n BoxShadowNode: (prop: BoxShadowProps) => DeclarationNode<BoxShadowProps>;\n LayerNode: (prop: ChildrenProps) => RenderNode<ChildrenProps>;\n\n // Paragraph\n ParagraphNode: (props: ParagraphProps) => RenderNode<ParagraphProps>;\n };\n\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n skGroup: SkiaProps<GroupProps>;\n skLayer: SkiaProps<ChildrenProps>;\n skPaint: SkiaProps<PaintProps>;\n\n // Drawings\n skFill: SkiaProps<DrawingNodeProps>;\n skImage: SkiaProps<ImageProps>;\n skCircle: SkiaProps<CircleProps>;\n skPath: SkiaProps<PathProps>;\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 skAtlas: SkiaProps<AtlasProps>;\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<FractalNoiseProps>;\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 // Paragraph\n skParagraph: SkiaProps<ParagraphProps>;\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.Layer:\n return Sk.Layer(props);\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.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.Atlas:\n return Sk.Atlas(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 // Paragraph\n case NodeType.Paragraph:\n return Sk.Paragraph(props);\n default:\n return exhaustiveCheck(type);\n }\n};\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AA6DvC,SAASC,eAAe,QAAQ,aAAa;AA4M7C,OAAO,MAAMC,UAAU,GAAGA,CACxBC,SAAoB,EACpBC,IAAc,EAEdC,KAAU,KACP;EACH,MAAM;IAAEC;EAAG,CAAC,GAAGH,SAAS;EACxB,QAAQC,IAAI;IACV,KAAKJ,QAAQ,CAACO,KAAK;MACjB,OAAOD,EAAE,CAACC,KAAK,CAACF,KAAK,CAAC;IACxB,KAAKL,QAAQ,CAACQ,KAAK;MACjB,OAAOF,EAAE,CAACE,KAAK,CAACH,KAAK,CAAC;IACxB,KAAKL,QAAQ,CAACS,KAAK;MACjB,OAAOH,EAAE,CAACG,KAAK,CAACJ,KAAK,CAAC;IACxB;IACA,KAAKL,QAAQ,CAACU,IAAI;MAChB,OAAOJ,EAAE,CAACI,IAAI,C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gBAAgB;MAC5B,OAAO9C,EAAE,CAAC8C,gBAAgB,CAAC/C,KAAK,CAAC;IACnC,KAAKL,QAAQ,CAACqD,kBAAkB;MAC9B,OAAO/C,EAAE,CAAC+C,kBAAkB,CAAChD,KAAK,CAAC;IACrC,KAAKL,QAAQ,CAACsD,cAAc;MAC1B,OAAOhD,EAAE,CAACgD,cAAc,CAACjD,KAAK,CAAC;IACjC,KAAKL,QAAQ,CAACuD,gBAAgB;MAC5B,OAAOjD,EAAE,CAACiD,gBAAgB,CAAClD,KAAK,CAAC;IACnC,KAAKL,QAAQ,CAACwD,gBAAgB;MAC5B,OAAOlD,EAAE,CAACkD,gBAAgB,CAACnD,KAAK,CAAC;IACnC,KAAKL,QAAQ,CAACyD,aAAa;MACzB,OAAOnD,EAAE,CAACmD,aAAa,CAAC,CAAC;IAC3B,KAAKzD,QAAQ,CAAC0D,gBAAgB;MAC5B,OAAOpD,EAAE,CAACoD,gBAAgB,CAACrD,KAAK,CAAC;IACnC;IACA,KAAKL,QAAQ,CAAC2D,KAAK;MACjB,OAAOrD,EAAE,CAACqD,KAAK,CAACtD,KAAK,CAAC;IACxB,KAAKL,QAAQ,CAAC4D,cAAc;MAC1B,OAAOtD,EAAE,CAACsD,cAAc,CAACvD,KAAK,CAAC;IACjC,KAAKL,QAAQ,CAAC6D,GAAG;MACf,OAAOvD,EAAE,CAACuD,GAAG,CAACxD,KAAK,CAAC;IACtB,KAAKL,QAAQ,CAAC8D,SAAS;MACrB,OAAOxD,EAAE,CAACwD,SAAS,CAACzD,KAAK,CAAC;IAC5B;IACA,KAAKL,QAAQ,CAAC+D,SAAS;MACrB,OAAOzD,EAAE,CAACyD,SAAS,CAAC1D,KAAK,CAAC;IAC5B;MACE,OAAOJ,eAAe,CAACG,IAAI,CAAC;EAChC;AACF,CAAC","ignoreList":[]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { HostConfig } from "react-reconciler";
|
|
2
|
-
import type { NodeType, Node } from "../dom/types";
|
|
3
|
-
import type { Container } from "./Container";
|
|
4
|
-
export declare const debug: (message?: any, ...optionalParams: any[]) => void;
|
|
5
|
-
type Instance = Node<unknown>;
|
|
6
|
-
type Props = object;
|
|
7
|
-
type TextInstance = Node<unknown>;
|
|
8
|
-
type SuspenseInstance = Instance;
|
|
9
|
-
type HydratableInstance = Instance;
|
|
10
|
-
type PublicInstance = Instance;
|
|
11
|
-
type HostContext = null;
|
|
12
|
-
type UpdatePayload = Container;
|
|
13
|
-
type ChildSet = unknown;
|
|
14
|
-
type TimeoutHandle = NodeJS.Timeout;
|
|
15
|
-
type NoTimeout = -1;
|
|
16
|
-
type SkiaHostConfig = HostConfig<NodeType, Props, Container, Instance, TextInstance, SuspenseInstance, HydratableInstance, PublicInstance, HostContext, UpdatePayload, ChildSet, TimeoutHandle, NoTimeout>;
|
|
17
|
-
export declare const skHostConfig: SkiaHostConfig;
|
|
18
|
-
export {};
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
/*global NodeJS*/
|
|
2
|
-
|
|
3
|
-
import { DefaultEventPriority } from "react-reconciler/constants";
|
|
4
|
-
import { bindReanimatedProps, extractReanimatedProps, unbindReanimatedNode } from "../external/reanimated/renderHelpers";
|
|
5
|
-
import { createNode } from "./HostComponents";
|
|
6
|
-
import { shallowEq } from "./typeddash";
|
|
7
|
-
const DEBUG = false;
|
|
8
|
-
export const debug = (...args) => {
|
|
9
|
-
if (DEBUG) {
|
|
10
|
-
console.log(...args);
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
const appendNode = (parent, child) => {
|
|
14
|
-
parent.addChild(child);
|
|
15
|
-
};
|
|
16
|
-
const removeNode = (parent, child, unmounted = false) => {
|
|
17
|
-
// If the drawing is unmounted we don't want to update it.
|
|
18
|
-
// We can just stop the reanimated mappers
|
|
19
|
-
unbindReanimatedNode(child);
|
|
20
|
-
if (!unmounted) {
|
|
21
|
-
parent.removeChild(child);
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
const insertBefore = (parent, child, before) => {
|
|
25
|
-
parent.insertChildBefore(child, before);
|
|
26
|
-
};
|
|
27
|
-
export const skHostConfig = {
|
|
28
|
-
/**
|
|
29
|
-
* This function is used by the reconciler in order to calculate current time for prioritising work.
|
|
30
|
-
*/
|
|
31
|
-
supportsMutation: true,
|
|
32
|
-
isPrimaryRenderer: false,
|
|
33
|
-
supportsPersistence: false,
|
|
34
|
-
supportsHydration: false,
|
|
35
|
-
//supportsMicrotask: true,
|
|
36
|
-
|
|
37
|
-
scheduleTimeout: setTimeout,
|
|
38
|
-
cancelTimeout: clearTimeout,
|
|
39
|
-
noTimeout: -1,
|
|
40
|
-
appendChildToContainer(container, child) {
|
|
41
|
-
debug("appendChildToContainer");
|
|
42
|
-
appendNode(container.root, child);
|
|
43
|
-
},
|
|
44
|
-
appendChild(parent, child) {
|
|
45
|
-
debug("appendChild", parent, child);
|
|
46
|
-
appendNode(parent, child);
|
|
47
|
-
},
|
|
48
|
-
getRootHostContext: _rootContainerInstance => {
|
|
49
|
-
debug("getRootHostContext");
|
|
50
|
-
return null;
|
|
51
|
-
},
|
|
52
|
-
getChildHostContext(_parentHostContext, _type, _rootContainerInstance) {
|
|
53
|
-
debug("getChildHostContext");
|
|
54
|
-
return null;
|
|
55
|
-
},
|
|
56
|
-
shouldSetTextContent(_type, _props) {
|
|
57
|
-
return false;
|
|
58
|
-
},
|
|
59
|
-
createTextInstance(_text, _rootContainerInstance, _hostContext, _internalInstanceHandle) {
|
|
60
|
-
debug("createTextInstance");
|
|
61
|
-
// return SpanNode({}, text) as SkNode;
|
|
62
|
-
throw new Error("Text nodes are not supported yet");
|
|
63
|
-
},
|
|
64
|
-
createInstance(type, pristineProps, container, _hostContext, _internalInstanceHandle) {
|
|
65
|
-
debug("createInstance", type);
|
|
66
|
-
const [props, reanimatedProps] = extractReanimatedProps(pristineProps);
|
|
67
|
-
const node = createNode(container, type, props);
|
|
68
|
-
bindReanimatedProps(container, node, reanimatedProps);
|
|
69
|
-
return node;
|
|
70
|
-
},
|
|
71
|
-
appendInitialChild(parentInstance, child) {
|
|
72
|
-
debug("appendInitialChild");
|
|
73
|
-
appendNode(parentInstance, child);
|
|
74
|
-
},
|
|
75
|
-
finalizeInitialChildren(parentInstance, _type, _props, _rootContainerInstance, _hostContext) {
|
|
76
|
-
debug("finalizeInitialChildren", parentInstance);
|
|
77
|
-
return false;
|
|
78
|
-
},
|
|
79
|
-
commitMount() {
|
|
80
|
-
// if finalizeInitialChildren = true
|
|
81
|
-
debug("commitMount");
|
|
82
|
-
},
|
|
83
|
-
prepareForCommit(_containerInfo) {
|
|
84
|
-
debug("prepareForCommit");
|
|
85
|
-
return null;
|
|
86
|
-
},
|
|
87
|
-
resetAfterCommit(container) {
|
|
88
|
-
debug("resetAfterCommit");
|
|
89
|
-
container.redraw();
|
|
90
|
-
},
|
|
91
|
-
getPublicInstance(node) {
|
|
92
|
-
debug("getPublicInstance");
|
|
93
|
-
return node;
|
|
94
|
-
},
|
|
95
|
-
prepareUpdate: (_instance, type, oldProps, newProps, rootContainerInstance, _hostContext) => {
|
|
96
|
-
debug("prepareUpdate");
|
|
97
|
-
const propsAreEqual = shallowEq(oldProps, newProps);
|
|
98
|
-
if (propsAreEqual) {
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
debug("update ", type);
|
|
102
|
-
return rootContainerInstance;
|
|
103
|
-
},
|
|
104
|
-
commitUpdate(instance, updatePayload, type, prevProps, nextProps, _internalHandle) {
|
|
105
|
-
debug("commitUpdate: ", type);
|
|
106
|
-
if (shallowEq(prevProps, nextProps)) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
const [props, reanimatedProps] = extractReanimatedProps(nextProps);
|
|
110
|
-
instance.setProps(props);
|
|
111
|
-
bindReanimatedProps(updatePayload, instance, reanimatedProps);
|
|
112
|
-
},
|
|
113
|
-
commitTextUpdate: (_textInstance, _oldText, _newText) => {
|
|
114
|
-
// textInstance.instance = newText;
|
|
115
|
-
},
|
|
116
|
-
clearContainer: container => {
|
|
117
|
-
debug("clearContainer");
|
|
118
|
-
container.root.children().forEach(child => {
|
|
119
|
-
container.root.removeChild(child);
|
|
120
|
-
});
|
|
121
|
-
},
|
|
122
|
-
preparePortalMount: () => {
|
|
123
|
-
debug("preparePortalMount");
|
|
124
|
-
},
|
|
125
|
-
removeChild: (parent, child) => {
|
|
126
|
-
removeNode(parent, child);
|
|
127
|
-
},
|
|
128
|
-
removeChildFromContainer: (container, child) => {
|
|
129
|
-
removeNode(container.root, child, container.unmounted);
|
|
130
|
-
},
|
|
131
|
-
insertInContainerBefore: (container, child, before) => {
|
|
132
|
-
insertBefore(container.root, child, before);
|
|
133
|
-
},
|
|
134
|
-
insertBefore: (parent, child, before) => {
|
|
135
|
-
insertBefore(parent, child, before);
|
|
136
|
-
},
|
|
137
|
-
// see https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874
|
|
138
|
-
getCurrentEventPriority: () => DefaultEventPriority,
|
|
139
|
-
beforeActiveInstanceBlur: () => {},
|
|
140
|
-
afterActiveInstanceBlur: () => {},
|
|
141
|
-
detachDeletedInstance: () => {},
|
|
142
|
-
getInstanceFromNode: function (_node) {
|
|
143
|
-
return null;
|
|
144
|
-
},
|
|
145
|
-
prepareScopeUpdate: function (_scopeInstance, _instance) {},
|
|
146
|
-
getInstanceFromScope: function (_scopeInstance) {
|
|
147
|
-
return null;
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
//# sourceMappingURL=HostConfig.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["DefaultEventPriority","bindReanimatedProps","extractReanimatedProps","unbindReanimatedNode","createNode","shallowEq","DEBUG","debug","args","console","log","appendNode","parent","child","addChild","removeNode","unmounted","removeChild","insertBefore","before","insertChildBefore","skHostConfig","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","reanimatedProps","node","appendInitialChild","parentInstance","finalizeInitialChildren","commitMount","prepareForCommit","_containerInfo","resetAfterCommit","redraw","getPublicInstance","prepareUpdate","_instance","oldProps","newProps","rootContainerInstance","propsAreEqual","commitUpdate","instance","updatePayload","prevProps","nextProps","_internalHandle","setProps","commitTextUpdate","_textInstance","_oldText","_newText","clearContainer","children","forEach","preparePortalMount","removeChildFromContainer","insertInContainerBefore","getCurrentEventPriority","beforeActiveInstanceBlur","afterActiveInstanceBlur","detachDeletedInstance","getInstanceFromNode","_node","prepareScopeUpdate","_scopeInstance","getInstanceFromScope"],"sources":["HostConfig.ts"],"sourcesContent":["/*global NodeJS*/\nimport type { Fiber, HostConfig } from \"react-reconciler\";\nimport { DefaultEventPriority } from \"react-reconciler/constants\";\n\nimport type { NodeType, Node } from \"../dom/types\";\nimport {\n bindReanimatedProps,\n extractReanimatedProps,\n unbindReanimatedNode,\n} from \"../external/reanimated/renderHelpers\";\n\nimport type { Container } from \"./Container\";\nimport { createNode } from \"./HostComponents\";\nimport { 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 = object;\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 = (\n parent: Node<unknown>,\n child: Node<unknown>,\n unmounted = false\n) => {\n // If the drawing is unmounted we don't want to update it.\n // We can just stop the reanimated mappers\n unbindReanimatedNode(child);\n if (!unmounted) {\n parent.removeChild(child);\n }\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 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\");\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, reanimatedProps] = extractReanimatedProps(pristineProps);\n const node = createNode(container, type, props);\n bindReanimatedProps(container, node, reanimatedProps);\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, reanimatedProps] = extractReanimatedProps(nextProps);\n instance.setProps(props);\n bindReanimatedProps(updatePayload, instance, reanimatedProps);\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, container.unmounted);\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 // see https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874\n getCurrentEventPriority: () => DefaultEventPriority,\n beforeActiveInstanceBlur: () => {},\n afterActiveInstanceBlur: () => {},\n detachDeletedInstance: () => {},\n\n getInstanceFromNode: function (_node): Fiber | null | undefined {\n return null;\n },\n prepareScopeUpdate: function (_scopeInstance, _instance): void {},\n getInstanceFromScope: function (_scopeInstance): Instance | null {\n return null;\n },\n};\n"],"mappings":"AAAA;;AAEA,SAASA,oBAAoB,QAAQ,4BAA4B;AAGjE,SACEC,mBAAmB,EACnBC,sBAAsB,EACtBC,oBAAoB,QACf,sCAAsC;AAG7C,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,SAAS,QAAQ,aAAa;AAEvC,MAAMC,KAAK,GAAG,KAAK;AACnB,OAAO,MAAMC,KAAK,GAAGA,CAAC,GAAGC,IAAoC,KAAK;EAChE,IAAIF,KAAK,EAAE;IACTG,OAAO,CAACC,GAAG,CAAC,GAAGF,IAAI,CAAC;EACtB;AACF,CAAC;AA+BD,MAAMG,UAAU,GAAGA,CAACC,MAAqB,EAAEC,KAAoB,KAAK;EAClED,MAAM,CAACE,QAAQ,CAACD,KAAK,CAAC;AACxB,CAAC;AAED,MAAME,UAAU,GAAGA,CACjBH,MAAqB,EACrBC,KAAoB,EACpBG,SAAS,GAAG,KAAK,KACd;EACH;EACA;EACAb,oBAAoB,CAACU,KAAK,CAAC;EAC3B,IAAI,CAACG,SAAS,EAAE;IACdJ,MAAM,CAACK,WAAW,CAACJ,KAAK,CAAC;EAC3B;AACF,CAAC;AAED,MAAMK,YAAY,GAAGA,CACnBN,MAAqB,EACrBC,KAAoB,EACpBM,MAAqB,KAClB;EACHP,MAAM,CAACQ,iBAAiB,CAACP,KAAK,EAAEM,MAAM,CAAC;AACzC,CAAC;AAED,OAAO,MAAME,YAA4B,GAAG;EAC1C;AACF;AACA;EACEC,gBAAgB,EAAE,IAAI;EACtBC,iBAAiB,EAAE,KAAK;EACxBC,mBAAmB,EAAE,KAAK;EAC1BC,iBAAiB,EAAE,KAAK;EACxB;;EAEAC,eAAe,EAAEC,UAAU;EAC3BC,aAAa,EAAEC,YAAY;EAC3BC,SAAS,EAAE,CAAC,CAAC;EAEbC,sBAAsBA,CAACC,SAAS,EAAEnB,KAAK,EAAE;IACvCN,KAAK,CAAC,wBA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CAAA,KAAM,CAAC,CAAC;EACjCC,qBAAqB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAE/BC,mBAAmB,EAAE,SAAAA,CAAUC,KAAK,EAA4B;IAC9D,OAAO,IAAI;EACb,CAAC;EACDC,kBAAkB,EAAE,SAAAA,CAAUC,cAAc,EAAE7B,SAAS,EAAQ,CAAC,CAAC;EACjE8B,oBAAoB,EAAE,SAAAA,CAAUD,cAAc,EAAmB;IAC/D,OAAO,IAAI;EACb;AACF,CAAC","ignoreList":[]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
export declare class SkiaRoot {
|
|
3
|
-
private root;
|
|
4
|
-
private container;
|
|
5
|
-
constructor(redraw?: () => void, getNativeId?: () => number);
|
|
6
|
-
render(element: ReactNode): void;
|
|
7
|
-
unmount(): void;
|
|
8
|
-
get dom(): import("..").Node<unknown>;
|
|
9
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
|
-
import ReactReconciler from "react-reconciler";
|
|
5
|
-
import { skHostConfig, debug as hostDebug } from "./HostConfig";
|
|
6
|
-
import { Container } from "./Container";
|
|
7
|
-
const skiaReconciler = ReactReconciler(skHostConfig);
|
|
8
|
-
skiaReconciler.injectIntoDevTools({
|
|
9
|
-
bundleType: 1,
|
|
10
|
-
version: "0.0.1",
|
|
11
|
-
rendererPackageName: "react-native-skia"
|
|
12
|
-
});
|
|
13
|
-
export class SkiaRoot {
|
|
14
|
-
constructor(redraw = () => {}, getNativeId = () => 0) {
|
|
15
|
-
_defineProperty(this, "root", void 0);
|
|
16
|
-
_defineProperty(this, "container", void 0);
|
|
17
|
-
this.container = new Container(redraw, getNativeId);
|
|
18
|
-
this.root = skiaReconciler.createContainer(this.container, 0, null, true, null, "", console.error, null);
|
|
19
|
-
}
|
|
20
|
-
render(element) {
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
-
skiaReconciler.updateContainer(element, this.root, null, () => {
|
|
23
|
-
hostDebug("updateContainer");
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
unmount() {
|
|
27
|
-
this.container.unmounted = true;
|
|
28
|
-
skiaReconciler.updateContainer(null, this.root, null, () => {
|
|
29
|
-
hostDebug("unmountContainer");
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
get dom() {
|
|
33
|
-
return this.container.root;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=Reconciler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["ReactReconciler","skHostConfig","debug","hostDebug","Container","skiaReconciler","injectIntoDevTools","bundleType","version","rendererPackageName","SkiaRoot","constructor","redraw","getNativeId","_defineProperty","container","root","createContainer","console","error","render","element","updateContainer","unmount","unmounted","dom"],"sources":["Reconciler.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport type { OpaqueRoot } from \"react-reconciler\";\nimport ReactReconciler from \"react-reconciler\";\n\nimport { skHostConfig, debug as hostDebug } from \"./HostConfig\";\nimport { Container } from \"./Container\";\n\nconst skiaReconciler = ReactReconciler(skHostConfig);\n\nskiaReconciler.injectIntoDevTools({\n bundleType: 1,\n version: \"0.0.1\",\n rendererPackageName: \"react-native-skia\",\n});\n\nexport class SkiaRoot {\n private root: OpaqueRoot;\n private container: Container;\n\n constructor(\n redraw: () => void = () => {},\n getNativeId: () => number = () => 0\n ) {\n this.container = new Container(redraw, getNativeId);\n this.root = skiaReconciler.createContainer(\n this.container,\n 0,\n null,\n true,\n null,\n \"\",\n console.error,\n null\n );\n }\n\n render(element: ReactNode) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n skiaReconciler.updateContainer(element as any, this.root, null, () => {\n hostDebug(\"updateContainer\");\n });\n }\n\n unmount() {\n this.container.unmounted = true;\n skiaReconciler.updateContainer(null, this.root, null, () => {\n hostDebug(\"unmountContainer\");\n });\n }\n\n get dom() {\n return this.container.root;\n }\n}\n"],"mappings":";;;AAEA,OAAOA,eAAe,MAAM,kBAAkB;AAE9C,SAASC,YAAY,EAAEC,KAAK,IAAIC,SAAS,QAAQ,cAAc;AAC/D,SAASC,SAAS,QAAQ,aAAa;AAEvC,MAAMC,cAAc,GAAGL,eAAe,CAACC,YAAY,CAAC;AAEpDI,cAAc,CAACC,kBAAkB,CAAC;EAChCC,UAAU,EAAE,CAAC;EACbC,OAAO,EAAE,OAAO;EAChBC,mBAAmB,EAAE;AACvB,CAAC,CAAC;AAEF,OAAO,MAAMC,QAAQ,CAAC;EAIpBC,WAAWA,CACTC,MAAkB,GAAGA,CAAA,KAAM,CAAC,CAAC,EAC7BC,WAAyB,GAAGA,CAAA,KAAM,CAAC,EACnC;IAAAC,eAAA;IAAAA,eAAA;IACA,IAAI,CAACC,SAAS,GAAG,IAAIX,SAAS,CAACQ,MAAM,EAAEC,WAAW,CAAC;IACnD,IAAI,CAACG,IAAI,GAAGX,cAAc,CAACY,eAAe,CACxC,IAAI,CAACF,SAAS,EACd,CAAC,EACD,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,EAAE,EACFG,OAAO,CAACC,KAAK,EACb,IACF,CAAC;EACH;EAEAC,MAAMA,CAACC,OAAkB,EAAE;IACzB;IACAhB,cAAc,CAACiB,eAAe,CAACD,OAAO,EAAS,IAAI,CAACL,IAAI,EAAE,IAAI,EAAE,MAAM;MACpEb,SAAS,CAAC,iBAAiB,CAAC;IAC9B,CAAC,CAAC;EACJ;EAEAoB,OAAOA,CAAA,EAAG;IACR,IAAI,CAACR,SAAS,CAACS,SAAS,GAAG,IAAI;IAC/BnB,cAAc,CAACiB,eAAe,CAAC,IAAI,EAAE,IAAI,CAACN,IAAI,EAAE,IAAI,EAAE,MAAM;MAC1Db,SAAS,CAAC,kBAAkB,CAAC;IAC/B,CAAC,CAAC;EACJ;EAEA,IAAIsB,GAAGA,CAAA,EAAG;IACR,OAAO,IAAI,CAACV,SAAS,CAACC,IAAI;EAC5B;AACF","ignoreList":[]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ViewProps } from "react-native";
|
|
2
|
-
export interface NativeProps extends ViewProps {
|
|
3
|
-
debug?: boolean;
|
|
4
|
-
}
|
|
5
|
-
declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
|
|
6
|
-
export default _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["codegenNativeComponent"],"sources":["SkiaDomViewNativeComponent.ts"],"sourcesContent":["import codegenNativeComponent from \"react-native/Libraries/Utilities/codegenNativeComponent\";\nimport type { ViewProps } from \"react-native\";\n\nexport interface NativeProps extends ViewProps {\n debug?: boolean;\n}\n\n// eslint-disable-next-line import/no-default-export\nexport default codegenNativeComponent<NativeProps>(\"SkiaDomView\");\n"],"mappings":"AAAA,OAAOA,sBAAsB,MAAM,yDAAyD;AAO5F;AACA,eAAeA,sBAAsB,CAAc,aAAa,CAAC","ignoreList":[]}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { SkRect } from "../skia/types";
|
|
3
|
-
import type { SkiaDomViewNativeProps } from "./types";
|
|
4
|
-
interface SkiaDomViewProps extends SkiaDomViewNativeProps {
|
|
5
|
-
mode?: "default" | "continuous";
|
|
6
|
-
}
|
|
7
|
-
export declare class SkiaDomView extends React.Component<SkiaDomViewProps> {
|
|
8
|
-
constructor(props: SkiaDomViewProps);
|
|
9
|
-
private _nativeId;
|
|
10
|
-
private requestId;
|
|
11
|
-
get nativeId(): number;
|
|
12
|
-
componentDidUpdate(prevProps: SkiaDomViewProps): void;
|
|
13
|
-
componentWillUnmount(): void;
|
|
14
|
-
private tick;
|
|
15
|
-
/**
|
|
16
|
-
* Creates a snapshot from the canvas in the surface
|
|
17
|
-
* @param rect Rect to use as bounds. Optional.
|
|
18
|
-
* @returns An Image object.
|
|
19
|
-
*/
|
|
20
|
-
makeImageSnapshot(rect?: SkRect): import("../skia/types").SkImage;
|
|
21
|
-
/**
|
|
22
|
-
* Creates a snapshot from the canvas in the surface
|
|
23
|
-
* @param rect Rect to use as bounds. Optional.
|
|
24
|
-
* @returns An Image object.
|
|
25
|
-
*/
|
|
26
|
-
makeImageSnapshotAsync(rect?: SkRect): Promise<import("../skia/types").SkImage>;
|
|
27
|
-
/**
|
|
28
|
-
* Sends a redraw request to the native SkiaView.
|
|
29
|
-
*/
|
|
30
|
-
redraw(): void;
|
|
31
|
-
render(): React.JSX.Element;
|
|
32
|
-
}
|
|
33
|
-
export {};
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
3
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
4
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5
|
-
import React from "react";
|
|
6
|
-
import { Platform } from "../Platform";
|
|
7
|
-
import SkiaDomViewNativeComponent from "../specs/SkiaDomViewNativeComponent";
|
|
8
|
-
import { SkiaViewApi } from "./api";
|
|
9
|
-
import { SkiaViewNativeId } from "./SkiaViewNativeId";
|
|
10
|
-
const NativeSkiaDomView = Platform.OS !== "web" ? SkiaDomViewNativeComponent :
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
-
null;
|
|
13
|
-
export class SkiaDomView extends React.Component {
|
|
14
|
-
constructor(props) {
|
|
15
|
-
super(props);
|
|
16
|
-
_defineProperty(this, "_nativeId", void 0);
|
|
17
|
-
_defineProperty(this, "requestId", 0);
|
|
18
|
-
this._nativeId = SkiaViewNativeId.current++;
|
|
19
|
-
const {
|
|
20
|
-
root,
|
|
21
|
-
onSize
|
|
22
|
-
} = props;
|
|
23
|
-
if (root) {
|
|
24
|
-
assertSkiaViewApi();
|
|
25
|
-
SkiaViewApi.setJsiProperty(this._nativeId, "root", root);
|
|
26
|
-
}
|
|
27
|
-
if (onSize) {
|
|
28
|
-
assertSkiaViewApi();
|
|
29
|
-
SkiaViewApi.setJsiProperty(this._nativeId, "onSize", onSize);
|
|
30
|
-
}
|
|
31
|
-
this.tick();
|
|
32
|
-
}
|
|
33
|
-
get nativeId() {
|
|
34
|
-
return this._nativeId;
|
|
35
|
-
}
|
|
36
|
-
componentDidUpdate(prevProps) {
|
|
37
|
-
const {
|
|
38
|
-
root,
|
|
39
|
-
onSize
|
|
40
|
-
} = this.props;
|
|
41
|
-
if (root !== prevProps.root) {
|
|
42
|
-
assertSkiaViewApi();
|
|
43
|
-
SkiaViewApi.setJsiProperty(this._nativeId, "root", root);
|
|
44
|
-
}
|
|
45
|
-
if (onSize !== prevProps.onSize) {
|
|
46
|
-
assertSkiaViewApi();
|
|
47
|
-
SkiaViewApi.setJsiProperty(this._nativeId, "onSize", onSize);
|
|
48
|
-
}
|
|
49
|
-
if (onSize !== prevProps.onSize || root !== prevProps.root) {
|
|
50
|
-
this.tick();
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
componentWillUnmount() {
|
|
54
|
-
if (this.requestId) {
|
|
55
|
-
cancelAnimationFrame(this.requestId);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
tick() {
|
|
59
|
-
this.redraw();
|
|
60
|
-
if (this.props.mode === "continuous") {
|
|
61
|
-
this.requestId = requestAnimationFrame(this.tick.bind(this));
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Creates a snapshot from the canvas in the surface
|
|
67
|
-
* @param rect Rect to use as bounds. Optional.
|
|
68
|
-
* @returns An Image object.
|
|
69
|
-
*/
|
|
70
|
-
makeImageSnapshot(rect) {
|
|
71
|
-
assertSkiaViewApi();
|
|
72
|
-
return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Creates a snapshot from the canvas in the surface
|
|
77
|
-
* @param rect Rect to use as bounds. Optional.
|
|
78
|
-
* @returns An Image object.
|
|
79
|
-
*/
|
|
80
|
-
makeImageSnapshotAsync(rect) {
|
|
81
|
-
assertSkiaViewApi();
|
|
82
|
-
return SkiaViewApi.makeImageSnapshotAsync(this._nativeId, rect);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Sends a redraw request to the native SkiaView.
|
|
87
|
-
*/
|
|
88
|
-
redraw() {
|
|
89
|
-
assertSkiaViewApi();
|
|
90
|
-
SkiaViewApi.requestRedraw(this._nativeId);
|
|
91
|
-
}
|
|
92
|
-
render() {
|
|
93
|
-
const {
|
|
94
|
-
debug = false,
|
|
95
|
-
opaque = false,
|
|
96
|
-
...viewProps
|
|
97
|
-
} = this.props;
|
|
98
|
-
return /*#__PURE__*/React.createElement(NativeSkiaDomView, _extends({
|
|
99
|
-
collapsable: false,
|
|
100
|
-
nativeID: `${this._nativeId}`,
|
|
101
|
-
debug: debug,
|
|
102
|
-
opaque: opaque
|
|
103
|
-
}, viewProps));
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
const assertSkiaViewApi = () => {
|
|
107
|
-
if (SkiaViewApi === null || SkiaViewApi.setJsiProperty === null || SkiaViewApi.requestRedraw === null || SkiaViewApi.makeImageSnapshot === null) {
|
|
108
|
-
throw Error("Skia View Api was not found.");
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
//# sourceMappingURL=SkiaDomView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","Platform","SkiaDomViewNativeComponent","SkiaViewApi","SkiaViewNativeId","NativeSkiaDomView","OS","SkiaDomView","Component","constructor","props","_defineProperty","_nativeId","current","root","onSize","assertSkiaViewApi","setJsiProperty","tick","nativeId","componentDidUpdate","prevProps","componentWillUnmount","requestId","cancelAnimationFrame","redraw","mode","requestAnimationFrame","bind","makeImageSnapshot","rect","makeImageSnapshotAsync","requestRedraw","render","debug","opaque","viewProps","createElement","_extends","collapsable","nativeID","Error"],"sources":["SkiaDomView.tsx"],"sourcesContent":["import React from \"react\";\nimport type { HostComponent } from \"react-native\";\n\nimport type { SkRect } from \"../skia/types\";\nimport { Platform } from \"../Platform\";\nimport SkiaDomViewNativeComponent from \"../specs/SkiaDomViewNativeComponent\";\n\nimport { SkiaViewApi } from \"./api\";\nimport type { SkiaDomViewNativeProps } from \"./types\";\nimport { SkiaViewNativeId } from \"./SkiaViewNativeId\";\n\nconst NativeSkiaDomView: HostComponent<SkiaDomViewNativeProps> =\n Platform.OS !== \"web\"\n ? SkiaDomViewNativeComponent\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (null as any);\n\ninterface SkiaDomViewProps extends SkiaDomViewNativeProps {\n mode?: \"default\" | \"continuous\";\n}\n\nexport class SkiaDomView extends React.Component<SkiaDomViewProps> {\n constructor(props: SkiaDomViewProps) {\n super(props);\n this._nativeId = SkiaViewNativeId.current++;\n const { root, onSize } = props;\n if (root) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"root\", root);\n }\n if (onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n this.tick();\n }\n\n private _nativeId: number;\n private requestId = 0;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaDomViewProps) {\n const { root, onSize } = this.props;\n if (root !== prevProps.root) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"root\", root);\n }\n if (onSize !== prevProps.onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n if (onSize !== prevProps.onSize || root !== prevProps.root) {\n this.tick();\n }\n }\n\n componentWillUnmount(): void {\n if (this.requestId) {\n cancelAnimationFrame(this.requestId);\n }\n }\n\n private tick() {\n this.redraw();\n if (this.props.mode === \"continuous\") {\n this.requestId = requestAnimationFrame(this.tick.bind(this));\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshotAsync(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshotAsync(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertSkiaViewApi();\n SkiaViewApi.requestRedraw(this._nativeId);\n }\n\n render() {\n const { debug = false, opaque = false, ...viewProps } = this.props;\n return (\n <NativeSkiaDomView\n collapsable={false}\n nativeID={`${this._nativeId}`}\n debug={debug}\n opaque={opaque}\n {...viewProps}\n />\n );\n }\n}\n\nconst assertSkiaViewApi = () => {\n if (\n SkiaViewApi === null ||\n SkiaViewApi.setJsiProperty === null ||\n SkiaViewApi.requestRedraw === null ||\n SkiaViewApi.makeImageSnapshot === null\n ) {\n throw Error(\"Skia View Api was not found.\");\n }\n};\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAIzB,SAASC,QAAQ,QAAQ,aAAa;AACtC,OAAOC,0BAA0B,MAAM,qCAAqC;AAE5E,SAASC,WAAW,QAAQ,OAAO;AAEnC,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,MAAMC,iBAAwD,GAC5DJ,QAAQ,CAACK,EAAE,KAAK,KAAK,GACjBJ,0BAA0B;AAC1B;AACC,IAAY;AAMnB,OAAO,MAAMK,WAAW,SAASP,KAAK,CAACQ,SAAS,CAAmB;EACjEC,WAAWA,CAACC,KAAuB,EAAE;IACnC,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA,oBAeK,CAAC;IAdnB,IAAI,CAACC,SAAS,GAAGR,gBAAgB,CAACS,OAAO,EAAE;IAC3C,MAAM;MAAEC,IAAI;MAAEC;IAAO,CAAC,GAAGL,KAAK;IAC9B,IAAII,IAAI,EAAE;MACRE,iBAAiB,CAAC,CAAC;MACnBb,WAAW,CAACc,cAAc,CAAC,IAAI,CAACL,SAAS,EAAE,MAAM,EAAEE,IAAI,CAAC;IAC1D;IACA,IAAIC,MAAM,EAAE;MACVC,iBAAiB,CAAC,CAAC;MACnBb,WAAW,CAACc,cAAc,CAAC,IAAI,CAACL,SAAS,EAAE,QAAQ,EAAEG,MAAM,CAAC;IAC9D;IACA,IAAI,CAACG,IAAI,CAAC,CAAC;EACb;EAKA,IAAWC,QAAQA,CAAA,EAAG;IACpB,OAAO,IAAI,CAACP,SAAS;EACvB;EAEAQ,kBAAkBA,CAACC,SAA2B,EAAE;IAC9C,MAAM;MAAEP,IAAI;MAAEC;IAAO,CAAC,GAAG,IAAI,CAACL,KAAK;IACnC,IAAII,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C;IACnBb,WAAW,CAAC6B,aAAa,CAAC,IAAI,CAACpB,SAAS,CAAC;EAC3C;EAEAqB,MAAMA,CAAA,EAAG;IACP,MAAM;MAAEC,KAAK,GAAG,KAAK;MAAEC,MAAM,GAAG,KAAK;MAAE,GAAGC;IAAU,CAAC,GAAG,IAAI,CAAC1B,KAAK;IAClE,oBACEV,KAAA,CAAAqC,aAAA,CAAChC,iBAAiB,EAAAiC,QAAA;MAChBC,WAAW,EAAE,KAAM;MACnBC,QAAQ,EAAE,GAAG,IAAI,CAAC5B,SAAS,EAAG;MAC9BsB,KAAK,EAAEA,KAAM;MACbC,MAAM,EAAEA;IAAO,GACXC,SAAS,CACd,CAAC;EAEN;AACF;AAEA,MAAMpB,iBAAiB,GAAGA,CAAA,KAAM;EAC9B,IACEb,WAAW,KAAK,IAAI,IACpBA,WAAW,CAACc,cAAc,KAAK,IAAI,IACnCd,WAAW,CAAC6B,aAAa,KAAK,IAAI,IAClC7B,WAAW,CAAC0B,iBAAiB,KAAK,IAAI,EACtC;IACA,MAAMY,KAAK,CAAC,8BAA8B,CAAC;EAC7C;AACF,CAAC","ignoreList":[]}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["SkiaDomView.web.tsx"],"sourcesContent":[""],"mappings":"","ignoreList":[]}
|