@shopify/react-native-skia 0.1.158 → 0.1.160
Sign up to get free protection for your applications and to get access to all the features.
- package/android/CMakeLists.txt +35 -11
- package/android/build.gradle +21 -25
- package/android/cpp/jni/JniLoad.cpp +2 -0
- package/android/cpp/jni/include/JniSkiaDomView.h +89 -0
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +4 -3
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +4 -3
- package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaPackage.java +2 -1
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDomView.java +45 -0
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDomViewManager.java +64 -0
- package/cpp/api/JsiSkHostObjects.h +6 -0
- package/cpp/api/JsiSkImageFilterFactory.h +1 -1
- package/cpp/api/JsiSkPaint.h +9 -2
- package/cpp/api/JsiSkPath.h +1 -0
- package/cpp/api/JsiSkRuntimeEffect.h +36 -36
- package/cpp/jsi/JsiHostObject.cpp +16 -28
- package/cpp/jsi/JsiHostObject.h +127 -7
- package/cpp/jsi/JsiValue.cpp +346 -0
- package/cpp/jsi/JsiValue.h +222 -0
- package/cpp/jsi/JsiValueWrapper.h +33 -5
- package/cpp/rnskia/RNSkDomView.cpp +222 -0
- package/cpp/rnskia/RNSkDomView.h +140 -0
- package/cpp/rnskia/RNSkJsView.cpp +0 -4
- package/cpp/rnskia/RNSkJsView.h +6 -4
- package/cpp/rnskia/RNSkManager.cpp +7 -0
- package/cpp/rnskia/RNSkPictureView.h +5 -8
- package/cpp/rnskia/RNSkView.h +113 -5
- package/cpp/rnskia/dom/JsiDomApi.h +167 -0
- package/cpp/rnskia/dom/base/BaseNodeProp.h +72 -0
- package/cpp/rnskia/dom/base/DerivedNodeProp.h +187 -0
- package/cpp/rnskia/dom/base/DrawingContext.cpp +227 -0
- package/cpp/rnskia/dom/base/DrawingContext.h +136 -0
- package/cpp/rnskia/dom/base/JsiDependencyManager.h +293 -0
- package/cpp/rnskia/dom/base/JsiDomDeclarationNode.h +176 -0
- package/cpp/rnskia/dom/base/JsiDomDrawingNode.h +50 -0
- package/cpp/rnskia/dom/base/JsiDomNode.h +384 -0
- package/cpp/rnskia/dom/base/JsiDomRenderNode.h +267 -0
- package/cpp/rnskia/dom/base/NodeProp.h +130 -0
- package/cpp/rnskia/dom/base/NodePropsContainer.h +119 -0
- package/cpp/rnskia/dom/nodes/JsiBackdropFilterNode.h +38 -0
- package/cpp/rnskia/dom/nodes/JsiBlendNode.h +112 -0
- package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +78 -0
- package/cpp/rnskia/dom/nodes/JsiBoxNode.h +104 -0
- package/cpp/rnskia/dom/nodes/JsiBoxShadowNode.h +33 -0
- package/cpp/rnskia/dom/nodes/JsiCircleNode.h +38 -0
- package/cpp/rnskia/dom/nodes/JsiColorFilterNodes.h +192 -0
- package/cpp/rnskia/dom/nodes/JsiCustomDrawingNode.h +123 -0
- package/cpp/rnskia/dom/nodes/JsiDiffRectNode.h +42 -0
- package/cpp/rnskia/dom/nodes/JsiFillNode.h +22 -0
- package/cpp/rnskia/dom/nodes/JsiGlyphsNode.h +56 -0
- package/cpp/rnskia/dom/nodes/JsiGroupNode.h +26 -0
- package/cpp/rnskia/dom/nodes/JsiImageFilterNodes.h +415 -0
- package/cpp/rnskia/dom/nodes/JsiImageNode.h +34 -0
- package/cpp/rnskia/dom/nodes/JsiImageSvgNode.h +44 -0
- package/cpp/rnskia/dom/nodes/JsiLayerNode.h +64 -0
- package/cpp/rnskia/dom/nodes/JsiLineNode.h +43 -0
- package/cpp/rnskia/dom/nodes/JsiOvalNode.h +34 -0
- package/cpp/rnskia/dom/nodes/JsiPaintNode.h +79 -0
- package/cpp/rnskia/dom/nodes/JsiPatchNode.h +54 -0
- package/cpp/rnskia/dom/nodes/JsiPathEffectNodes.h +315 -0
- package/cpp/rnskia/dom/nodes/JsiPathNode.h +181 -0
- package/cpp/rnskia/dom/nodes/JsiPictureNode.h +32 -0
- package/cpp/rnskia/dom/nodes/JsiPointsNode.h +51 -0
- package/cpp/rnskia/dom/nodes/JsiRRectNode.h +34 -0
- package/cpp/rnskia/dom/nodes/JsiRectNode.h +34 -0
- package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +517 -0
- package/cpp/rnskia/dom/nodes/JsiTextBlobNode.h +47 -0
- package/cpp/rnskia/dom/nodes/JsiTextNode.h +54 -0
- package/cpp/rnskia/dom/nodes/JsiTextPathNode.h +32 -0
- package/cpp/rnskia/dom/nodes/JsiVerticesNode.h +43 -0
- package/cpp/rnskia/dom/props/BezierProps.h +63 -0
- package/cpp/rnskia/dom/props/BlendModeProp.h +101 -0
- package/cpp/rnskia/dom/props/BoxShadowProps.h +62 -0
- package/cpp/rnskia/dom/props/CircleProp.h +46 -0
- package/cpp/rnskia/dom/props/ClipProp.h +62 -0
- package/cpp/rnskia/dom/props/ColorProp.h +80 -0
- package/cpp/rnskia/dom/props/DrawingProp.h +33 -0
- package/cpp/rnskia/dom/props/FontProp.h +34 -0
- package/cpp/rnskia/dom/props/GlyphsProp.h +53 -0
- package/cpp/rnskia/dom/props/ImageProps.h +173 -0
- package/cpp/rnskia/dom/props/LayerProp.h +50 -0
- package/cpp/rnskia/dom/props/MatrixProp.h +33 -0
- package/cpp/rnskia/dom/props/NumbersProp.h +63 -0
- package/cpp/rnskia/dom/props/PaintProps.h +171 -0
- package/cpp/rnskia/dom/props/PathProp.h +55 -0
- package/cpp/rnskia/dom/props/PictureProp.h +38 -0
- package/cpp/rnskia/dom/props/PointProp.h +72 -0
- package/cpp/rnskia/dom/props/PointsProp.h +83 -0
- package/cpp/rnskia/dom/props/RRectProp.h +134 -0
- package/cpp/rnskia/dom/props/RadiusProp.h +43 -0
- package/cpp/rnskia/dom/props/RectProp.h +118 -0
- package/cpp/rnskia/dom/props/StrokeProps.h +75 -0
- package/cpp/rnskia/dom/props/SvgProp.h +37 -0
- package/cpp/rnskia/dom/props/TextBlobProp.h +128 -0
- package/cpp/rnskia/dom/props/TileModeProp.h +50 -0
- package/cpp/rnskia/dom/props/TransformProp.h +80 -0
- package/cpp/rnskia/dom/props/TransformsProps.h +68 -0
- package/cpp/rnskia/dom/props/UniformsProp.h +194 -0
- package/cpp/rnskia/dom/props/VertexModeProp.h +47 -0
- package/cpp/rnskia/dom/props/VerticesProps.h +67 -0
- package/cpp/rnskia/values/RNSkReadonlyValue.h +13 -4
- package/cpp/skia/include/android/SkAndroidFrameworkUtils.h +35 -1
- package/cpp/skia/include/codec/SkAndroidCodec.h +17 -1
- package/cpp/skia/include/codec/SkCodec.h +8 -5
- package/cpp/skia/include/core/SkAnnotation.h +2 -0
- package/cpp/skia/include/core/SkBitmap.h +52 -1
- package/cpp/skia/include/core/SkBlendMode.h +2 -0
- package/cpp/skia/include/core/SkCanvas.h +52 -31
- package/cpp/skia/include/core/SkCapabilities.h +44 -0
- package/cpp/skia/include/core/SkColor.h +7 -0
- package/cpp/skia/include/core/SkColorFilter.h +37 -0
- package/cpp/skia/include/core/SkColorSpace.h +1 -1
- package/cpp/skia/include/core/SkFont.h +4 -0
- package/cpp/skia/include/core/SkFontMgr.h +3 -0
- package/cpp/skia/include/core/SkGraphics.h +9 -0
- package/cpp/skia/include/core/SkImage.h +77 -17
- package/cpp/skia/include/core/SkImageEncoder.h +5 -3
- package/cpp/skia/include/core/SkImageGenerator.h +27 -17
- package/cpp/skia/include/core/SkM44.h +1 -0
- package/cpp/skia/include/core/SkMesh.h +120 -34
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkOverdrawCanvas.h +2 -1
- package/cpp/skia/include/core/SkPaint.h +15 -2
- package/cpp/skia/include/core/SkPath.h +4 -0
- package/cpp/skia/include/core/SkPathBuilder.h +1 -1
- package/cpp/skia/include/core/SkPicture.h +0 -3
- package/cpp/skia/include/core/SkPictureRecorder.h +0 -2
- package/cpp/skia/include/core/SkPixmap.h +19 -0
- package/cpp/skia/include/core/SkRasterHandleAllocator.h +3 -1
- package/cpp/skia/include/core/SkRect.h +11 -4
- package/cpp/skia/include/core/SkRefCnt.h +13 -1
- package/cpp/skia/include/core/SkRegion.h +6 -0
- package/cpp/skia/include/core/SkSamplingOptions.h +8 -6
- package/cpp/skia/include/core/SkScalar.h +6 -25
- package/cpp/skia/include/core/SkShader.h +20 -12
- package/cpp/skia/include/core/SkSpan.h +51 -19
- package/cpp/skia/include/core/SkStream.h +2 -2
- package/cpp/skia/include/core/SkString.h +11 -3
- package/cpp/skia/include/core/SkSurface.h +85 -8
- package/cpp/skia/include/core/SkTextBlob.h +5 -2
- package/cpp/skia/include/core/SkTypes.h +11 -10
- package/cpp/skia/include/docs/SkPDFDocument.h +0 -5
- package/cpp/skia/include/effects/Sk1DPathEffect.h +6 -1
- package/cpp/skia/include/effects/Sk2DPathEffect.h +4 -1
- package/cpp/skia/include/effects/SkColorMatrix.h +1 -0
- package/cpp/skia/include/effects/SkColorMatrixFilter.h +5 -8
- package/cpp/skia/include/effects/SkCornerPathEffect.h +5 -1
- package/cpp/skia/include/effects/SkDashPathEffect.h +5 -1
- package/cpp/skia/include/effects/SkGradientShader.h +68 -38
- package/cpp/skia/include/effects/SkHighContrastFilter.h +5 -1
- package/cpp/skia/include/effects/SkImageFilters.h +5 -4
- package/cpp/skia/include/effects/SkLumaColorFilter.h +4 -1
- package/cpp/skia/include/effects/SkOpPathEffect.h +6 -2
- package/cpp/skia/include/effects/SkOverdrawColorFilter.h +5 -2
- package/cpp/skia/include/effects/SkRuntimeEffect.h +54 -62
- package/cpp/skia/include/effects/SkShaderMaskFilter.h +3 -1
- package/cpp/skia/include/effects/SkTableColorFilter.h +8 -21
- package/cpp/skia/include/effects/SkTableMaskFilter.h +5 -1
- package/cpp/skia/include/effects/SkTrimPathEffect.h +5 -1
- package/cpp/skia/include/encode/SkEncoder.h +17 -0
- package/cpp/skia/include/encode/SkWebpEncoder.h +17 -0
- package/cpp/skia/include/gpu/GpuTypes.h +18 -0
- package/cpp/skia/include/gpu/GrBackendSurface.h +38 -17
- package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +6 -71
- package/cpp/skia/include/gpu/GrContextOptions.h +1 -1
- package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +10 -9
- package/cpp/skia/include/gpu/GrDirectContext.h +42 -22
- package/cpp/skia/include/gpu/GrRecordingContext.h +6 -3
- package/cpp/skia/include/gpu/GrTypes.h +11 -11
- package/cpp/skia/include/gpu/MutableTextureState.h +122 -0
- package/cpp/skia/include/gpu/gl/GrGLFunctions.h +1 -0
- package/cpp/skia/include/gpu/gl/GrGLInterface.h +1 -0
- package/cpp/skia/include/gpu/graphite/BackendTexture.h +7 -0
- package/cpp/skia/include/gpu/graphite/CombinationBuilder.h +195 -0
- package/cpp/skia/include/gpu/graphite/Context.h +47 -55
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +85 -0
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +1 -17
- package/cpp/skia/include/gpu/graphite/ImageProvider.h +61 -0
- package/cpp/skia/include/gpu/graphite/Recorder.h +87 -8
- package/cpp/skia/include/gpu/graphite/Recording.h +19 -9
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +40 -8
- package/cpp/skia/include/gpu/graphite/dawn/DawnBackendContext.h +25 -0
- package/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h +3 -2
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +69 -0
- package/cpp/skia/include/gpu/mtl/MtlMemoryAllocator.h +39 -0
- package/cpp/skia/include/gpu/vk/GrVkBackendContext.h +21 -19
- package/cpp/skia/include/gpu/vk/GrVkExtensions.h +2 -50
- package/cpp/skia/include/gpu/vk/GrVkMemoryAllocator.h +2 -127
- package/cpp/skia/include/gpu/vk/GrVkTypes.h +5 -43
- package/cpp/skia/include/gpu/vk/VulkanBackendContext.h +46 -0
- package/cpp/skia/include/gpu/vk/VulkanExtensions.h +67 -0
- package/cpp/skia/include/gpu/vk/VulkanMemoryAllocator.h +116 -0
- package/cpp/skia/include/gpu/vk/VulkanTypes.h +59 -0
- package/cpp/skia/include/pathops/SkPathOps.h +1 -1
- package/cpp/skia/include/private/SkColorData.h +10 -40
- package/cpp/skia/include/private/SkEncodedInfo.h +9 -3
- package/cpp/skia/include/private/SkFloatingPoint.h +9 -6
- package/cpp/skia/include/private/SkHalf.h +5 -52
- package/cpp/skia/include/private/SkMacros.h +1 -1
- package/cpp/skia/include/private/SkMalloc.h +4 -0
- package/cpp/skia/include/private/SkPathRef.h +10 -10
- package/cpp/skia/include/private/SkSLModifiers.h +59 -23
- package/cpp/skia/include/private/SkSLProgramKind.h +1 -0
- package/cpp/skia/include/private/SkSLSymbol.h +7 -3
- package/cpp/skia/include/private/SkStringView.h +4 -0
- package/cpp/skia/include/private/SkTArray.h +21 -7
- package/cpp/skia/include/private/SkTDArray.h +173 -285
- package/cpp/skia/include/private/SkTHash.h +33 -32
- package/cpp/skia/include/private/SkTemplates.h +24 -26
- package/cpp/skia/include/private/SkVx.h +218 -135
- package/cpp/skia/include/private/chromium/GrSlug.h +3 -65
- package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +6 -3
- package/cpp/skia/include/private/chromium/Slug.h +76 -0
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +6 -1
- package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +5 -39
- package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +63 -0
- package/cpp/skia/include/{gpu/vk/GrVkVulkan.h → private/gpu/vk/SkiaVulkan.h} +2 -2
- package/cpp/skia/include/private/gpu/vk/VulkanTypesPriv.h +57 -0
- package/cpp/skia/include/sksl/DSL.h +0 -1
- package/cpp/skia/include/sksl/DSLBlock.h +4 -18
- package/cpp/skia/include/sksl/DSLCase.h +2 -8
- package/cpp/skia/include/sksl/DSLCore.h +8 -15
- package/cpp/skia/include/sksl/DSLExpression.h +51 -142
- package/cpp/skia/include/sksl/DSLFunction.h +7 -15
- package/cpp/skia/include/sksl/DSLModifiers.h +5 -2
- package/cpp/skia/include/sksl/DSLStatement.h +4 -39
- package/cpp/skia/include/sksl/DSLSymbols.h +1 -11
- package/cpp/skia/include/sksl/DSLType.h +20 -12
- package/cpp/skia/include/sksl/DSLVar.h +56 -146
- package/cpp/skia/include/sksl/SkSLErrorReporter.h +2 -15
- package/cpp/skia/include/sksl/SkSLOperator.h +62 -59
- package/cpp/skia/include/sksl/SkSLPosition.h +2 -0
- package/cpp/skia/include/sksl/SkSLVersion.h +27 -0
- package/cpp/skia/include/svg/SkSVGCanvas.h +1 -0
- package/cpp/skia/include/utils/SkAnimCodecPlayer.h +1 -1
- package/cpp/skia/include/utils/SkBase64.h +2 -0
- package/cpp/skia/include/utils/SkCustomTypeface.h +24 -11
- package/cpp/skia/include/utils/SkEventTracer.h +12 -1
- package/cpp/skia/include/utils/SkNWayCanvas.h +11 -4
- package/cpp/skia/include/utils/SkPaintFilterCanvas.h +9 -4
- package/cpp/skia/include/utils/SkParse.h +3 -0
- package/cpp/skia/include/utils/SkShadowUtils.h +2 -0
- package/cpp/skia/include/utils/SkTextUtils.h +2 -1
- package/cpp/skia/{include/third_party → modules}/skcms/skcms.h +10 -0
- package/cpp/skia/modules/skcms/skcms_internal.h +56 -0
- package/cpp/skia/modules/skcms/src/Transform_inl.h +1609 -0
- package/cpp/skia/modules/skparagraph/include/DartTypes.h +153 -0
- package/cpp/skia/modules/skparagraph/include/FontArguments.h +46 -0
- package/cpp/skia/modules/skparagraph/include/FontCollection.h +84 -0
- package/cpp/skia/modules/skparagraph/include/Metrics.h +98 -0
- package/cpp/skia/modules/skparagraph/include/Paragraph.h +111 -0
- package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +69 -0
- package/cpp/skia/modules/skparagraph/include/ParagraphCache.h +77 -0
- package/cpp/skia/modules/skparagraph/include/ParagraphStyle.h +143 -0
- package/cpp/skia/modules/skparagraph/include/TextShadow.h +30 -0
- package/cpp/skia/modules/skparagraph/include/TextStyle.h +352 -0
- package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +81 -0
- package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGTypes.h +3 -3
- package/cpp/skia/src/core/SkLRUCache.h +126 -0
- package/cpp/skia/src/core/SkTInternalLList.h +302 -0
- package/cpp/utils/RNSkTimingInfo.h +1 -0
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.h +15 -4
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +41 -55
- package/ios/RNSkia-iOS/SkiaDomViewManager.h +8 -0
- package/ios/RNSkia-iOS/SkiaDomViewManager.mm +51 -0
- package/lib/commonjs/dom/nodes/JsiSkDOM.js +56 -56
- package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/commonjs/dom/nodes/RenderNode.js +1 -1
- package/lib/commonjs/dom/nodes/RenderNode.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +24 -66
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/DependencyManager.js +0 -5
- package/lib/commonjs/renderer/DependencyManager.js.map +1 -1
- package/lib/commonjs/renderer/HostComponents.js.map +1 -1
- package/lib/commonjs/renderer/useCanvas.js +4 -18
- package/lib/commonjs/renderer/useCanvas.js.map +1 -1
- package/lib/commonjs/views/SkiaBaseWebView.js +15 -0
- package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
- package/lib/commonjs/views/SkiaDomView.js +152 -0
- package/lib/commonjs/views/SkiaDomView.js.map +1 -0
- package/lib/commonjs/views/SkiaDomView.web.js +55 -0
- package/lib/commonjs/views/SkiaDomView.web.js.map +1 -0
- package/lib/commonjs/views/SkiaPictureView.js +16 -2
- package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
- package/lib/commonjs/views/SkiaView.js +17 -2
- package/lib/commonjs/views/SkiaView.js.map +1 -1
- package/lib/commonjs/views/index.js +13 -0
- package/lib/commonjs/views/index.js.map +1 -1
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/dom/nodes/JsiSkDOM.js +56 -56
- package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/module/dom/nodes/RenderNode.js +1 -1
- package/lib/module/dom/nodes/RenderNode.js.map +1 -1
- package/lib/module/renderer/Canvas.js +25 -66
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/DependencyManager.js +0 -5
- package/lib/module/renderer/DependencyManager.js.map +1 -1
- package/lib/module/renderer/HostComponents.js.map +1 -1
- package/lib/module/renderer/useCanvas.js +2 -13
- package/lib/module/renderer/useCanvas.js.map +1 -1
- package/lib/module/views/SkiaBaseWebView.js +15 -0
- package/lib/module/views/SkiaBaseWebView.js.map +1 -1
- package/lib/module/views/SkiaDomView.js +128 -0
- package/lib/module/views/SkiaDomView.js.map +1 -0
- package/lib/module/views/SkiaDomView.web.js +41 -0
- package/lib/module/views/SkiaDomView.web.js.map +1 -0
- package/lib/module/views/SkiaPictureView.js +14 -2
- package/lib/module/views/SkiaPictureView.js.map +1 -1
- package/lib/module/views/SkiaView.js +15 -2
- package/lib/module/views/SkiaView.js.map +1 -1
- package/lib/module/views/index.js +1 -0
- package/lib/module/views/index.js.map +1 -1
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +57 -64
- package/lib/typescript/src/renderer/Canvas.d.ts +5 -8
- package/lib/typescript/src/renderer/DependencyManager.d.ts +0 -2
- package/lib/typescript/src/renderer/HostComponents.d.ts +66 -3
- package/lib/typescript/src/renderer/useCanvas.d.ts +0 -6
- package/lib/typescript/src/views/SkiaBaseWebView.d.ts +4 -0
- package/lib/typescript/src/views/SkiaDomView.d.ts +31 -0
- package/lib/typescript/src/views/SkiaDomView.web.d.ts +7 -0
- package/lib/typescript/src/views/index.d.ts +1 -0
- package/lib/typescript/src/views/types.d.ts +12 -2
- package/libs/android/arm64-v8a/libskia.a +0 -0
- package/libs/android/arm64-v8a/libskottie.a +0 -0
- package/libs/android/arm64-v8a/libskparagraph.a +0 -0
- package/libs/android/arm64-v8a/libsksg.a +0 -0
- package/libs/android/arm64-v8a/libskshaper.a +0 -0
- package/libs/android/arm64-v8a/libskunicode.a +0 -0
- package/libs/android/arm64-v8a/libsvg.a +0 -0
- package/libs/android/armeabi-v7a/libskia.a +0 -0
- package/libs/android/armeabi-v7a/libskottie.a +0 -0
- package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
- package/libs/android/armeabi-v7a/libsksg.a +0 -0
- package/libs/android/armeabi-v7a/libskshaper.a +0 -0
- package/libs/android/armeabi-v7a/libskunicode.a +0 -0
- package/libs/android/armeabi-v7a/libsvg.a +0 -0
- package/libs/android/x86/libskia.a +0 -0
- package/libs/android/x86/libskottie.a +0 -0
- package/libs/android/x86/libskparagraph.a +0 -0
- package/libs/android/x86/libsksg.a +0 -0
- package/libs/android/x86/libskshaper.a +0 -0
- package/libs/android/x86/libskunicode.a +0 -0
- package/libs/android/x86/libsvg.a +0 -0
- package/libs/android/x86_64/libskia.a +0 -0
- package/libs/android/x86_64/libskottie.a +0 -0
- package/libs/android/x86_64/libskparagraph.a +0 -0
- package/libs/android/x86_64/libsksg.a +0 -0
- package/libs/android/x86_64/libskshaper.a +0 -0
- package/libs/android/x86_64/libskunicode.a +0 -0
- package/libs/android/x86_64/libsvg.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/libskparagraph.xcframework/Info.plist +42 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/ios/libsksg.xcframework/Info.plist +5 -5
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libskunicode.xcframework/Info.plist +42 -0
- package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
- package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +5 -3
- package/react-native-skia.podspec +5 -2
- package/src/dom/nodes/JsiSkDOM.ts +170 -56
- package/src/dom/nodes/RenderNode.ts +1 -1
- package/src/renderer/Canvas.tsx +37 -57
- package/src/renderer/DependencyManager.tsx +0 -5
- package/src/renderer/HostComponents.ts +152 -1
- package/src/renderer/useCanvas.ts +1 -15
- package/src/views/SkiaBaseWebView.tsx +9 -0
- package/src/views/SkiaDomView.tsx +120 -0
- package/src/views/SkiaDomView.web.tsx +37 -0
- package/src/views/SkiaPictureView.tsx +10 -2
- package/src/views/SkiaView.tsx +11 -3
- package/src/views/index.ts +1 -0
- package/src/views/types.ts +19 -2
- package/cpp/jsi/JsiSimpleValueWrapper.h +0 -99
- package/cpp/skia/include/c/sk_canvas.h +0 -159
- package/cpp/skia/include/c/sk_colorspace.h +0 -25
- package/cpp/skia/include/c/sk_data.h +0 -65
- package/cpp/skia/include/c/sk_image.h +0 -71
- package/cpp/skia/include/c/sk_imageinfo.h +0 -62
- package/cpp/skia/include/c/sk_maskfilter.h +0 -47
- package/cpp/skia/include/c/sk_matrix.h +0 -49
- package/cpp/skia/include/c/sk_paint.h +0 -145
- package/cpp/skia/include/c/sk_path.h +0 -102
- package/cpp/skia/include/c/sk_picture.h +0 -70
- package/cpp/skia/include/c/sk_shader.h +0 -143
- package/cpp/skia/include/c/sk_surface.h +0 -73
- package/cpp/skia/include/c/sk_types.h +0 -278
- package/cpp/skia/include/gpu/graphite/SkStuff.h +0 -47
- package/cpp/skia/include/private/SkNx.h +0 -430
- package/cpp/skia/include/private/SkNx_neon.h +0 -713
- package/cpp/skia/include/private/SkNx_sse.h +0 -823
- package/cpp/skia/include/sksl/DSLRuntimeEffects.h +0 -32
- package/cpp/skia/include/sksl/DSLWrapper.h +0 -77
@@ -1,7 +1,9 @@
|
|
1
|
-
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
2
|
+
|
3
|
+
import React, { useEffect, useCallback, useMemo, forwardRef, useRef, useState } from "react";
|
2
4
|
import ReactReconciler from "react-reconciler";
|
3
|
-
import {
|
4
|
-
import {
|
5
|
+
import { Platform } from "react-native";
|
6
|
+
import { SkiaDomView } from "../views";
|
5
7
|
import { Skia } from "../skia/Skia";
|
6
8
|
import { debug as hostDebug, skHostConfig } from "./HostConfig"; // import { debugTree } from "./nodes";
|
7
9
|
|
@@ -23,6 +25,9 @@ const render = (element, root, container) => {
|
|
23
25
|
};
|
24
26
|
|
25
27
|
export const useCanvasRef = () => useRef(null);
|
28
|
+
|
29
|
+
const createDependencyManager = registerValues => global.SkiaDomApi && global.SkiaDomApi.DependencyManager ? global.SkiaDomApi.DependencyManager(registerValues) : new DependencyManager(registerValues);
|
30
|
+
|
26
31
|
export const Canvas = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
|
27
32
|
let {
|
28
33
|
children,
|
@@ -30,22 +35,17 @@ export const Canvas = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
|
|
30
35
|
debug,
|
31
36
|
mode,
|
32
37
|
onTouch,
|
33
|
-
onSize
|
38
|
+
onSize,
|
39
|
+
...props
|
34
40
|
} = _ref;
|
35
|
-
const size = useValue({
|
36
|
-
width: 0,
|
37
|
-
height: 0
|
38
|
-
});
|
39
|
-
const canvasCtx = useMemo(() => ({
|
40
|
-
Skia,
|
41
|
-
size
|
42
|
-
}), [size]);
|
43
41
|
const innerRef = useCanvasRef();
|
44
42
|
const ref = useCombinedRefs(forwardedRef, innerRef);
|
45
|
-
const [
|
43
|
+
const [, setTick] = useState(0);
|
46
44
|
const redraw = useCallback(() => {
|
47
|
-
|
48
|
-
|
45
|
+
var _innerRef$current;
|
46
|
+
|
47
|
+
Platform.OS === "web" ? setTick(tick => tick + 1) : (_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.redraw();
|
48
|
+
}, [innerRef]);
|
49
49
|
const registerValues = useCallback(values => {
|
50
50
|
if (ref.current === null) {
|
51
51
|
throw new Error("Canvas ref is not set");
|
@@ -54,60 +54,17 @@ export const Canvas = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
|
|
54
54
|
return ref.current.registerValues(values);
|
55
55
|
}, [ref]);
|
56
56
|
const container = useMemo(() => {
|
57
|
-
return new Container(Skia,
|
57
|
+
return new Container(Skia, createDependencyManager(registerValues), redraw);
|
58
58
|
}, [redraw, registerValues]);
|
59
59
|
const root = useMemo(() => skiaReconciler.createContainer(container, 0, null, true, null, "", console.error, null), [container]); // Render effect
|
60
60
|
|
61
61
|
useEffect(() => {
|
62
62
|
render( /*#__PURE__*/React.createElement(CanvasProvider, {
|
63
|
-
value:
|
64
|
-
|
65
|
-
}, [children, root, redraw, container, canvasCtx]);
|
66
|
-
const paint = useMemo(() => Skia.Paint(), []); // Draw callback
|
67
|
-
|
68
|
-
const onDraw = useDrawCallback((canvas, info) => {
|
69
|
-
// TODO: if tree is empty (count === 1) maybe we should not render?
|
70
|
-
const {
|
71
|
-
width,
|
72
|
-
height,
|
73
|
-
timestamp
|
74
|
-
} = info;
|
75
|
-
|
76
|
-
if (onTouch) {
|
77
|
-
onTouch(info.touches);
|
78
|
-
}
|
79
|
-
|
80
|
-
if (width !== canvasCtx.size.current.width || height !== canvasCtx.size.current.height) {
|
81
|
-
canvasCtx.size.current = {
|
82
|
-
width,
|
83
|
-
height
|
84
|
-
};
|
85
|
-
|
86
|
-
if (onSize) {
|
87
|
-
onSize.current = {
|
88
|
-
width,
|
89
|
-
height
|
90
|
-
};
|
63
|
+
value: {
|
64
|
+
Skia
|
91
65
|
}
|
92
|
-
}
|
93
|
-
|
94
|
-
paint.reset();
|
95
|
-
const ctx = {
|
96
|
-
width,
|
97
|
-
height,
|
98
|
-
timestamp,
|
99
|
-
canvas,
|
100
|
-
paint,
|
101
|
-
opacity: 1,
|
102
|
-
ref,
|
103
|
-
center: {
|
104
|
-
x: width / 2,
|
105
|
-
y: height / 2
|
106
|
-
},
|
107
|
-
Skia
|
108
|
-
};
|
109
|
-
container.draw(ctx);
|
110
|
-
}, [tick, onTouch]);
|
66
|
+
}, children), root, container);
|
67
|
+
}, [children, root, redraw, container]);
|
111
68
|
useEffect(() => {
|
112
69
|
return () => {
|
113
70
|
skiaReconciler.updateContainer(null, root, null, () => {
|
@@ -115,13 +72,15 @@ export const Canvas = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
|
|
115
72
|
});
|
116
73
|
};
|
117
74
|
}, [container, root]);
|
118
|
-
return /*#__PURE__*/React.createElement(
|
75
|
+
return /*#__PURE__*/React.createElement(SkiaDomView, _extends({
|
119
76
|
ref: ref,
|
120
77
|
style: style,
|
121
|
-
|
78
|
+
root: container.root,
|
79
|
+
onTouch: onTouch,
|
80
|
+
onSize: onSize,
|
122
81
|
mode: mode,
|
123
82
|
debug: debug
|
124
|
-
});
|
83
|
+
}, props));
|
125
84
|
});
|
126
85
|
/**
|
127
86
|
* Combines a list of refs into a single ref. This can be used to provide
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","useEffect","
|
1
|
+
{"version":3,"names":["React","useEffect","useCallback","useMemo","forwardRef","useRef","useState","ReactReconciler","Platform","SkiaDomView","Skia","debug","hostDebug","skHostConfig","Container","DependencyManager","CanvasProvider","skiaReconciler","injectIntoDevTools","bundleType","version","rendererPackageName","render","element","root","container","updateContainer","depMgr","update","useCanvasRef","createDependencyManager","registerValues","global","SkiaDomApi","Canvas","forwardedRef","children","style","mode","onTouch","onSize","props","innerRef","ref","useCombinedRefs","setTick","redraw","OS","tick","current","values","Error","createContainer","console","error","remove","refs","targetRef","forEach"],"sources":["Canvas.tsx"],"sourcesContent":["import React, {\n useEffect,\n useCallback,\n useMemo,\n forwardRef,\n useRef,\n useState,\n} from \"react\";\nimport type {\n RefObject,\n ReactNode,\n ComponentProps,\n MutableRefObject,\n ForwardedRef,\n} from \"react\";\nimport type { OpaqueRoot } from \"react-reconciler\";\nimport ReactReconciler from \"react-reconciler\";\nimport { Platform } from \"react-native\";\n\nimport { SkiaDomView } from \"../views\";\nimport type { TouchHandler } from \"../views\";\nimport { Skia } from \"../skia/Skia\";\nimport type { SkiaValue } from \"../values\";\n\nimport { debug as hostDebug, skHostConfig } from \"./HostConfig\";\n// import { debugTree } from \"./nodes\";\nimport { Container } from \"./Container\";\nimport { DependencyManager } from \"./DependencyManager\";\nimport { CanvasProvider } from \"./useCanvas\";\n\nexport const skiaReconciler = ReactReconciler(skHostConfig);\n\nskiaReconciler.injectIntoDevTools({\n bundleType: 1,\n version: \"0.0.1\",\n rendererPackageName: \"react-native-skia\",\n});\n\nconst render = (element: ReactNode, root: OpaqueRoot, container: Container) => {\n skiaReconciler.updateContainer(element, root, null, () => {\n hostDebug(\"updateContainer\");\n container.depMgr.update();\n });\n};\n\nexport const useCanvasRef = () => useRef<SkiaDomView>(null);\n\nconst createDependencyManager = (\n registerValues: (values: Array<SkiaValue<unknown>>) => () => void\n) =>\n global.SkiaDomApi && global.SkiaDomApi.DependencyManager\n ? global.SkiaDomApi.DependencyManager(registerValues)\n : new DependencyManager(registerValues);\n\nexport interface CanvasProps extends ComponentProps<typeof SkiaDomView> {\n ref?: RefObject<SkiaDomView>;\n children: ReactNode;\n onTouch?: TouchHandler;\n}\n\nexport const Canvas = forwardRef<SkiaDomView, CanvasProps>(\n (\n { children, style, debug, mode, onTouch, onSize, ...props },\n forwardedRef\n ) => {\n const innerRef = useCanvasRef();\n const ref = useCombinedRefs(forwardedRef, innerRef);\n const [, setTick] = useState(0);\n const redraw = useCallback(() => {\n Platform.OS === \"web\"\n ? setTick((tick) => tick + 1)\n : innerRef.current?.redraw();\n }, [innerRef]);\n\n const registerValues = useCallback(\n (values: Array<SkiaValue<unknown>>) => {\n if (ref.current === null) {\n throw new Error(\"Canvas ref is not set\");\n }\n return ref.current.registerValues(values);\n },\n [ref]\n );\n\n const container = useMemo(() => {\n return new Container(\n Skia,\n createDependencyManager(registerValues),\n redraw\n );\n }, [redraw, registerValues]);\n\n const root = useMemo(\n () =>\n skiaReconciler.createContainer(\n container,\n 0,\n null,\n true,\n null,\n \"\",\n console.error,\n null\n ),\n [container]\n );\n\n // Render effect\n useEffect(() => {\n render(\n <CanvasProvider value={{ Skia }}>{children}</CanvasProvider>,\n root,\n container\n );\n }, [children, root, redraw, container]);\n\n useEffect(() => {\n return () => {\n skiaReconciler.updateContainer(null, root, null, () => {\n container.depMgr.remove();\n });\n };\n }, [container, root]);\n\n return (\n <SkiaDomView\n ref={ref}\n style={style}\n root={container.root}\n onTouch={onTouch}\n onSize={onSize}\n mode={mode}\n debug={debug}\n {...props}\n />\n );\n }\n);\n\n/**\n * Combines a list of refs into a single ref. This can be used to provide\n * both a forwarded ref and an internal ref keeping the same functionality\n * on both of the refs.\n * @param refs Array of refs to combine\n * @returns A single ref that can be used in a ref prop.\n */\nconst useCombinedRefs = <T,>(\n ...refs: Array<MutableRefObject<T> | ForwardedRef<T>>\n) => {\n const targetRef = React.useRef<T>(null);\n React.useEffect(() => {\n refs.forEach((ref) => {\n if (ref) {\n if (typeof ref === \"function\") {\n ref(targetRef.current);\n } else {\n ref.current = targetRef.current;\n }\n }\n });\n }, [refs]);\n return targetRef;\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,IACEC,SADF,EAEEC,WAFF,EAGEC,OAHF,EAIEC,UAJF,EAKEC,MALF,EAMEC,QANF,QAOO,OAPP;AAgBA,OAAOC,eAAP,MAA4B,kBAA5B;AACA,SAASC,QAAT,QAAyB,cAAzB;AAEA,SAASC,WAAT,QAA4B,UAA5B;AAEA,SAASC,IAAT,QAAqB,cAArB;AAGA,SAASC,KAAK,IAAIC,SAAlB,EAA6BC,YAA7B,QAAiD,cAAjD,C,CACA;;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,SAASC,cAAT,QAA+B,aAA/B;AAEA,OAAO,MAAMC,cAAc,GAAGV,eAAe,CAACM,YAAD,CAAtC;AAEPI,cAAc,CAACC,kBAAf,CAAkC;EAChCC,UAAU,EAAE,CADoB;EAEhCC,OAAO,EAAE,OAFuB;EAGhCC,mBAAmB,EAAE;AAHW,CAAlC;;AAMA,MAAMC,MAAM,GAAG,CAACC,OAAD,EAAqBC,IAArB,EAAuCC,SAAvC,KAAgE;EAC7ER,cAAc,CAACS,eAAf,CAA+BH,OAA/B,EAAwCC,IAAxC,EAA8C,IAA9C,EAAoD,MAAM;IACxDZ,SAAS,CAAC,iBAAD,CAAT;IACAa,SAAS,CAACE,MAAV,CAAiBC,MAAjB;EACD,CAHD;AAID,CALD;;AAOA,OAAO,MAAMC,YAAY,GAAG,MAAMxB,MAAM,CAAc,IAAd,CAAjC;;AAEP,MAAMyB,uBAAuB,GAC3BC,cAD8B,IAG9BC,MAAM,CAACC,UAAP,IAAqBD,MAAM,CAACC,UAAP,CAAkBlB,iBAAvC,GACIiB,MAAM,CAACC,UAAP,CAAkBlB,iBAAlB,CAAoCgB,cAApC,CADJ,GAEI,IAAIhB,iBAAJ,CAAsBgB,cAAtB,CALN;;AAaA,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M,OAAJ,GAAcQ,SAAS,CAACR,OAAxB;QACD;MACF;IACF,CARD;EASD,CAVD,EAUG,CAACO,IAAD,CAVH;EAWA,OAAOC,SAAP;AACD,CAhBD"}
|
@@ -12,10 +12,6 @@ export class DependencyManager {
|
|
12
12
|
|
13
13
|
this.registerValues = registerValues;
|
14
14
|
}
|
15
|
-
|
16
|
-
unsubscribeNodes(nodes) {
|
17
|
-
nodes.forEach(n => this.unsubscribeNode(n));
|
18
|
-
}
|
19
15
|
/**
|
20
16
|
* Call to unsubscribe all value listeners from the given node based
|
21
17
|
* on the current list of subscriptions for the node. This function
|
@@ -66,7 +62,6 @@ export class DependencyManager {
|
|
66
62
|
* when the node is mounted and when one or more props on the node changes.
|
67
63
|
* @param node Node to subscribe to value changes for
|
68
64
|
* @param props Node's properties
|
69
|
-
* @param onResolveProp Callback when a property value changes
|
70
65
|
*/
|
71
66
|
|
72
67
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"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"],"sources":["DependencyManager.tsx"],"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"],"mappings":";;AAIA,SAASA,UAAT,EAAqBC,OAArB,QAAoC,cAApC;AACA,SAASC,OAAT,QAAwB,aAAxB;AAUA,OAAO,MAAMC,iBAAN,CAAwB;EAK7BC,WAAW,CACTC,cADS,EAET;IAAA;;IAAA,uCAL0D,IAAIC,GAAJ,EAK1D;;IAAA,mDAJ8C,IAI9C;;IACA,KAAKD,cAAL,GAAsBA,cAAtB;EACD;;EAEDE,gBAAgB,CAACC,KAAD,EAAyB;IACvCA,KAAK,CAACC,OAAN,CAAeC,CAAD,IAAO,KAAKC,eAAL,CAAqBD,CAArB,CAArB;EACD;EAED;AACF;AACA;AACA;AACA;AACA;AACA;;;EACEC,eAAe,CAACC,IAAD,EAAsB;IACnC,MAAMC,aAAa,GAAGC,KAAK,CAACC,IAAN,CAAW,KAAKF,aAAL,CAAmBG,MAAnB,EAAX,EAAwCC,MAAxC,CAAgDC,CAAD,IACnEA,CAAC,CAACV,KAAF,CAAQW,GAAR,CAAYP,IAAZ,CADoB,CAAtB;;IAIA,IAAIC,aAAJ,EAAmB;MACjBA,aAAa,CAACJ,OAAd,CAAuBW,EAAD,IAAQ;QAC5B;QACAA,EAAE,CAACZ,KAAH,CAASa,MAAT,CAAgBT,IAAhB,EAF4B,CAI5B;;QACA,IAAIQ,EAAE,CAACZ,KAAH,CAASc,IAAT,KAAkB,CAAtB,EAAyB;UACvB;UACA;UACA,IAAI,CAACF,EAAE,CAACG,WAAR,EAAqB;YACnB,MAAM,IAAIC,KAAJ,CAAU,6CAAV,CAAN;UACD;;UACDJ,EAAE,CAACG,WAAH,IAAkBH,EAAE,CAACG,WAAH,EAAlB,CANuB,CAQ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,KAAD,CAAP,CAAetB,OAAf,CAAwB2C,GAAD,IAAS;IAC9B,IAAIA,GAAG,KAAK,UAAZ,EAAwB;MACtB;IACD;;IACD,MAAMC,SAAS,GAAGtB,KAAK,CAACqB,GAAD,CAAvB;;IAEA,IAAInD,OAAO,CAACoD,SAAD,CAAX,EAAwB;MACtB;MACAF,qBAAqB,CAACG,IAAtB,CAA2B;QACzBhB,KAAK,EAAEe,SADkB;QAEzBR,OAAO,EAAGL,CAAD,IAAO;UACd5B,IAAI,CAAC2C,OAAL,CAAaH,GAAb,EAAkBZ,CAAlB;QACD;MAJwB,CAA3B,EAFsB,CAQtB;;MACA5B,IAAI,CAAC2C,OAAL,CAAaH,GAAb,EAAmBC,SAAD,CAAwCG,OAA1D;IACD,CAVD,MAUO,IAAIxD,UAAU,CAACqD,SAAD,CAAd,EAA2B;MAChC;MACAF,qBAAqB,CAACG,IAAtB,CAA2B;QACzBhB,KAAK,EAAEe,SAAS,CAACf,KADQ;QAEzBO,OAAO,EAAGL,CAAD,IAAO;UACd5B,IAAI,CAAC2C,OAAL,CAAaH,GAAb,EAAkBC,SAAS,CAACI,QAAV,CAAmBjB,CAAnB,CAAlB;QACD;MAJwB,CAA3B,EAFgC,CAQhC;;MACA5B,IAAI,CAAC2C,OAAL,CACEH,GADF,EAEEC,SAAS,CAACI,QAAV,CAAmBJ,SAAS,CAACf,KAAV,CAAgBkB,OAAnC,CAFF;IAID,CAbM,MAaA;MACL;MACA5C,IAAI,CAAC2C,OAAL,CAAaH,GAAb,EAAkBC,SAAlB;IACD;EACF,CAjCD;EAmCA,OAAOF,qBAAP;AACD,CA7CD"}
|
1
|
+
{"version":3,"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","setProp","current","selector"],"sources":["DependencyManager.tsx"],"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 /**\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 */\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"],"mappings":";;AAIA,SAASA,UAAT,EAAqBC,OAArB,QAAoC,cAApC;AACA,SAASC,OAAT,QAAwB,aAAxB;AAUA,OAAO,MAAMC,iBAAN,CAAwB;EAK7BC,WAAW,CACTC,cADS,EAET;IAAA;;IAAA,uCAL0D,IAAIC,GAAJ,EAK1D;;IAAA,mDAJ8C,IAI9C;;IACA,KAAKD,cAAL,GAAsBA,cAAtB;EACD;EAED;AACF;AACA;AACA;AACA;AACA;AACA;;;EACEE,eAAe,CAACC,IAAD,EAAsB;IACnC,MAAMC,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;;IAIA,IAAIC,aAAJ,EAAmB;MACjBA,aAAa,CAACQ,OAAd,CAAuBC,EAAD,IAAQ;QAC5B;QACAA,EAAE,CAACH,KAAH,CAASI,MAAT,CAAgBX,IAAhB,EAF4B,CAI5B;;QACA,IAAIU,EAAE,CAACH,KAAH,CAASK,IAAT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3,"names":["NodeType","exhaustiveCheck","createNode","container","type","props","Sk","Layer","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"],"sources":["HostComponents.ts"],"sourcesContent":["import { 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\";\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 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 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.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.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"],"mappings":"AAAA,SAASA,QAAT,QAAyB,cAAzB;AAyDA,SAASC,eAAT,QAAgC,aAAhC;AAiFA,OAAO,MAAMC,UAAU,GAAG,CACxBC,SADwB,EAExBC,IAFwB,EAIxBC,KAJwB,KAKrB;EACH,MAAM;IAAEC;EAAF,IAASH,SAAf;;EACA,QAAQC,IAAR;IACE,KAAKJ,QAAQ,CAACO,KAAd;MACE,OAAOD,EAAE,CAACC,KAAH,CAASF,KAAT,CAAP;;IACF,KAAKL,QAAQ,CAACQ,KAAd;MACE,OAAOF,EAAE,CAACE,KAAH,CAASH,KAAT,CAAP;;IACF,KAAKL,QAAQ,CAACS,KAAd;MACE,OAAOH,EAAE,CAACG,KAAH,CAASJ,KAAT,CAAP;IACF;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D,gBAAd;MACE,OAAO/C,EAAE,CAAC+C,gBAAH,CAAoBhD,KAApB,CAAP;;IACF,KAAKL,QAAQ,CAACsD,kBAAd;MACE,OAAOhD,EAAE,CAACgD,kBAAH,CAAsBjD,KAAtB,CAAP;;IACF,KAAKL,QAAQ,CAACuD,cAAd;MACE,OAAOjD,EAAE,CAACiD,cAAH,CAAkBlD,KAAlB,CAAP;;IACF,KAAKL,QAAQ,CAACwD,gBAAd;MACE,OAAOlD,EAAE,CAACkD,gBAAH,CAAoBnD,KAApB,CAAP;;IACF,KAAKL,QAAQ,CAACyD,gBAAd;MACE,OAAOnD,EAAE,CAACmD,gBAAH,CAAoBpD,KAApB,CAAP;;IACF,KAAKL,QAAQ,CAAC0D,aAAd;MACE,OAAOpD,EAAE,CAACoD,aAAH,EAAP;;IACF,KAAK1D,QAAQ,CAAC2D,gBAAd;MACE,OAAOrD,EAAE,CAACqD,gBAAH,CAAoBtD,KAApB,CAAP;IACF;;IACA,KAAKL,QAAQ,CAAC4D,KAAd;MACE,OAAOtD,EAAE,CAACsD,KAAH,CAASvD,KAAT,CAAP;;IACF,KAAKL,QAAQ,CAAC6D,cAAd;MACE,OAAOvD,EAAE,CAACuD,cAAH,CAAkBxD,KAAlB,CAAP;;IACF,KAAKL,QAAQ,CAAC8D,GAAd;MACE,OAAOxD,EAAE,CAACwD,GAAH,CAAOzD,KAAP,CAAP;;IACF,KAAKL,QAAQ,CAAC+D,SAAd;MACE,OAAOzD,EAAE,CAACyD,SAAH,CAAa1D,KAAb,CAAP;;IACF;MACE,OAAOJ,eAAe,CAACG,IAAD,CAAtB;EAzHJ;AA2HD,CAlIM"}
|
1
|
+
{"version":3,"names":["NodeType","exhaustiveCheck","createNode","container","type","props","Sk","Layer","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"],"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 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 {\n SkColorFilter,\n SkImageFilter,\n SkMaskFilter,\n SkPaint,\n SkPathEffect,\n SkRect,\n SkRRect,\n SkShader,\n} from \"../skia\";\nimport type { JsiDrawingNode } from \"../dom/nodes/DrawingNode\";\nimport type { SkiaValue } from \"../values\";\n\nimport type { Container } from \"./Container\";\nimport { exhaustiveCheck } from \"./typeddash\";\nimport type { SkiaProps } from \"./processors\";\nimport type { DependencyManager } from \"./DependencyManager\";\n\ndeclare global {\n var SkiaDomApi: {\n DependencyManager: (\n registerValues: (values: Array<SkiaValue<unknown>>) => () => void\n ) => DependencyManager;\n\n // FIXME: We need a better type for this\n RectNode: (props: RectProps) => JsiDrawingNode<RectProps, SkRect>;\n RRectNode: (\n props: RoundedRectProps\n ) => JsiDrawingNode<RoundedRectProps, SkRRect>;\n GroupNode: (props: GroupProps) => RenderNode<GroupProps>;\n PaintNode: (props: PaintProps) => DeclarationNode<PaintProps, SkPaint>;\n FillNode: (props: PaintProps) => RenderNode<PaintProps>;\n CircleNode: (props: CircleProps) => RenderNode<CircleProps>;\n PathNode: (props: PathProps) => RenderNode<PathProps>;\n CustomDrawingNode: (\n props: CustomDrawingNodeProps\n ) => RenderNode<CustomDrawingNodeProps>;\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 // Mask filters\n BlurMaskFilterNode: (\n props: BlurMaskFilterProps\n ) => DeclarationNode<BlurMaskFilterProps, SkMaskFilter>;\n\n // Path effects\n DashPathEffectNode: (\n props: DashPathEffectProps\n ) => DeclarationNode<DashPathEffectProps, SkPathEffect>;\n DiscretePathEffectNode: (\n props: DiscretePathEffectProps\n ) => DeclarationNode<DiscretePathEffectProps, SkPathEffect>;\n CornerPathEffectNode: (\n props: CornerPathEffectProps\n ) => DeclarationNode<CornerPathEffectProps, SkPathEffect>;\n Path1DPathEffectNode: (\n props: Path1DPathEffectProps\n ) => DeclarationNode<Path1DPathEffectProps, SkPathEffect>;\n Path2DPathEffectNode: (\n props: Path2DPathEffectProps\n ) => DeclarationNode<Path2DPathEffectProps, SkPathEffect>;\n Line2DPathEffectNode: (\n props: Line2DPathEffectProps\n ) => DeclarationNode<Line2DPathEffectProps, SkPathEffect>;\n SumPathEffectNode: () => DeclarationNode<null, SkPathEffect>;\n\n // Image filters\n BlendImageFilterNode: (\n props: BlendImageFilterProps\n ) => DeclarationNode<BlendImageFilterProps, SkImageFilter>;\n DropShadowImageFilterNode: (\n props: DropShadowImageFilterProps\n ) => DeclarationNode<DropShadowImageFilterProps, SkImageFilter>;\n DisplacementMapImageFilterNode: (\n props: DisplacementMapImageFilterProps\n ) => DeclarationNode<DisplacementMapImageFilterProps, SkImageFilter>;\n BlurImageFilterNode: (\n props: BlurImageFilterProps\n ) => DeclarationNode<BlurImageFilterProps, SkImageFilter>;\n OffsetImageFilterNode: (\n props: OffsetImageFilterProps\n ) => DeclarationNode<OffsetImageFilterProps, SkImageFilter>;\n MorphologyImageFilterNode: (\n props: MorphologyImageFilterProps\n ) => DeclarationNode<MorphologyImageFilterProps, SkImageFilter>;\n RuntimeShaderImageFilterNode: (\n props: RuntimeShaderImageFilterProps\n ) => DeclarationNode<RuntimeShaderImageFilterProps, SkImageFilter>;\n\n // Color filters\n MatrixColorFilterNode: (\n props: MatrixColorFilterProps\n ) => DeclarationNode<MatrixColorFilterProps, SkColorFilter>;\n BlendColorFilterNode: (\n props: BlendColorFilterProps\n ) => DeclarationNode<BlendColorFilterProps, SkColorFilter>;\n LinearToSRGBGammaColorFilterNode: () => DeclarationNode<\n null,\n SkColorFilter\n >;\n SRGBToLinearGammaColorFilterNode: () => DeclarationNode<\n null,\n SkColorFilter\n >;\n LumaColorFilterNode: () => DeclarationNode<null, SkColorFilter>;\n LerpColorFilterNode: (\n props: LerpColorFilterProps\n ) => DeclarationNode<LerpColorFilterProps, SkColorFilter>;\n\n // Shaders\n ShaderNode: (props: ShaderProps) => DeclarationNode<ShaderProps, SkShader>;\n ImageShaderNode: (\n props: ImageShaderProps\n ) => DeclarationNode<ImageShaderProps, SkShader>;\n ColorShaderNode: (\n props: ColorProps\n ) => DeclarationNode<ColorProps, SkShader>;\n TurbulenceNode: (\n props: TurbulenceProps\n ) => DeclarationNode<TurbulenceProps, SkShader>;\n FractalNoiseNode: (\n props: FractalNoiseProps\n ) => DeclarationNode<FractalNoiseProps, SkShader>;\n LinearGradientNode: (\n props: LinearGradientProps\n ) => DeclarationNode<LinearGradientProps, SkShader>;\n RadialGradientNode: (\n props: RadialGradientProps\n ) => DeclarationNode<RadialGradientProps, SkShader>;\n SweepGradientNode: (\n props: SweepGradientProps\n ) => DeclarationNode<SweepGradientProps, SkShader>;\n TwoPointConicalGradientNode: (\n props: TwoPointConicalGradientProps\n ) => DeclarationNode<TwoPointConicalGradientProps, SkShader>;\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, SkImageFilter>;\n BackdropFilterNode: (prop: ChildrenProps) => RenderNode<ChildrenProps>;\n BoxNode: (prop: BoxProps) => RenderNode<BoxProps>;\n BoxShadowNode: (\n prop: BoxShadowProps\n ) => DeclarationNode<BoxShadowProps, BoxShadowProps>;\n LayerNode: (prop: ChildrenProps) => RenderNode<ChildrenProps>;\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 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<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 }\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.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"],"mappings":"AAAA,SAASA,QAAT,QAAyB,cAAzB;AAwEA,SAASC,eAAT,QAAgC,aAAhC;AAyNA,OAAO,MAAMC,UAAU,GAAG,CACxBC,SADwB,EAExBC,IAFwB,EAIxBC,KAJwB,KAKrB;EACH,MAAM;IAAEC;EAAF,IAASH,SAAf;;EACA,QAAQC,IAAR;IACE,KAAKJ,QAAQ,CAACO,KAAd;MACE,OAAOD,EAAE,CAACC,KAAH,CAASF,KAAT,CAAP;;IACF,KAAKL,QAAQ,CAACQ,KAAd;MACE,OAAOF,EAAE,CAACE,KAAH,CAASH,KAAT,CAAP;;IACF,KAAKL,QAAQ,CAACS,KAAd;MACE,OAAOH,EAAE,CAACG,KAAH,CAASJ,KAAT,CAAP;IACF;;IACA,KAAKL,QAAQ,CAACU,IAAd;MACE,OAAOJ,EAAE,CAACI,IAAH,CAAQL,KAAR,CAAP;;IACF,KAAKL,QAAQ,CAACW,KAAd;MACE,OAAOL,EAAE,CAACK,KAAH,CAASN,KAAT,CAAP;;IACF,KAAKL,QAAQ,CAACY,MAAd;MACE,OAAON,EAAE,CAACM,MAAH,CAAUP,KAAV,CAAP;;IACF,KAAKL,QAAQ,CAACa,IAAd;MACE,OA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E,OAAOlD,EAAE,CAACkD,gBAAH,CAAoBnD,KAApB,CAAP;;IACF,KAAKL,QAAQ,CAACyD,gBAAd;MACE,OAAOnD,EAAE,CAACmD,gBAAH,CAAoBpD,KAApB,CAAP;;IACF,KAAKL,QAAQ,CAAC0D,aAAd;MACE,OAAOpD,EAAE,CAACoD,aAAH,EAAP;;IACF,KAAK1D,QAAQ,CAAC2D,gBAAd;MACE,OAAOrD,EAAE,CAACqD,gBAAH,CAAoBtD,KAApB,CAAP;IACF;;IACA,KAAKL,QAAQ,CAAC4D,KAAd;MACE,OAAOtD,EAAE,CAACsD,KAAH,CAASvD,KAAT,CAAP;;IACF,KAAKL,QAAQ,CAAC6D,cAAd;MACE,OAAOvD,EAAE,CAACuD,cAAH,CAAkBxD,KAAlB,CAAP;;IACF,KAAKL,QAAQ,CAAC8D,GAAd;MACE,OAAOxD,EAAE,CAACwD,GAAH,CAAOzD,KAAP,CAAP;;IACF,KAAKL,QAAQ,CAAC+D,SAAd;MACE,OAAOzD,EAAE,CAACyD,SAAH,CAAa1D,KAAb,CAAP;;IACF;MACE,OAAOJ,eAAe,CAACG,IAAD,CAAtB;EAzHJ;AA2HD,CAlIM"}
|
@@ -1,24 +1,13 @@
|
|
1
1
|
import React, { useContext } from "react";
|
2
2
|
const CanvasContext = /*#__PURE__*/React.createContext(null);
|
3
|
-
export const CanvasProvider = CanvasContext.Provider;
|
4
|
-
export const useCanvas = () => {
|
5
|
-
const ctx = useContext(CanvasContext);
|
6
|
-
console.warn( // eslint-disable-next-line max-len
|
7
|
-
"useCanvas is deprecated. use the onSize property instead: https://shopify.github.io/react-native-skia/docs/canvas/overview");
|
8
|
-
|
9
|
-
if (!ctx) {
|
10
|
-
throw new Error("Canvas context is not available");
|
11
|
-
}
|
12
|
-
|
13
|
-
return ctx;
|
14
|
-
}; // This private function will be removed once we remove the useCanvas hook and
|
3
|
+
export const CanvasProvider = CanvasContext.Provider; // This private function will be removed once we remove the useCanvas hook and
|
15
4
|
// implement the Mask component as a node (will be faster too)
|
16
5
|
|
17
6
|
export const useSkiaPrivate = () => {
|
18
7
|
const ctx = useContext(CanvasContext);
|
19
8
|
|
20
9
|
if (!ctx) {
|
21
|
-
throw new Error("Canvas context is not available");
|
10
|
+
throw new Error("Skia Canvas context is not available");
|
22
11
|
}
|
23
12
|
|
24
13
|
return ctx.Skia;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","useContext","CanvasContext","createContext","CanvasProvider","Provider","
|
1
|
+
{"version":3,"names":["React","useContext","CanvasContext","createContext","CanvasProvider","Provider","useSkiaPrivate","ctx","Error","Skia"],"sources":["useCanvas.ts"],"sourcesContent":["import React, { useContext } from \"react\";\n\nimport type { Skia } from \"../skia/types\";\n\ninterface CanvasContext {\n Skia: Skia;\n}\n\nconst CanvasContext = React.createContext<CanvasContext | null>(null);\n\nexport const CanvasProvider = CanvasContext.Provider;\n\n// This private function will be removed once we remove the useCanvas hook and\n// implement the Mask component as a node (will be faster too)\nexport const useSkiaPrivate = () => {\n const ctx = useContext(CanvasContext);\n if (!ctx) {\n throw new Error(\"Skia Canvas context is not available\");\n }\n return ctx.Skia;\n};\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,UAAhB,QAAkC,OAAlC;AAQA,MAAMC,aAAa,gBAAGF,KAAK,CAACG,aAAN,CAA0C,IAA1C,CAAtB;AAEA,OAAO,MAAMC,cAAc,GAAGF,aAAa,CAACG,QAArC,C,CAEP;AACA;;AACA,OAAO,MAAMC,cAAc,GAAG,MAAM;EAClC,MAAMC,GAAG,GAAGN,UAAU,CAACC,aAAD,CAAtB;;EACA,IAAI,CAACK,GAAL,EAAU;IACR,MAAM,IAAIC,KAAJ,CAAU,sCAAV,CAAN;EACD;;EACD,OAAOD,GAAG,CAACE,IAAX;AACD,CANM"}
|
@@ -67,9 +67,21 @@ export class SkiaBaseWebView extends React.Component {
|
|
67
67
|
this._surface = new JsiSkSurface(CanvasKit, surface);
|
68
68
|
this._canvas = this._surface.getCanvas();
|
69
69
|
this.redraw();
|
70
|
+
} // Call onLayout callback if it exists
|
71
|
+
|
72
|
+
|
73
|
+
if (this.props.onLayout) {
|
74
|
+
this.props.onLayout(evt);
|
70
75
|
}
|
71
76
|
}
|
72
77
|
|
78
|
+
getSize() {
|
79
|
+
return {
|
80
|
+
width: this.width,
|
81
|
+
height: this.height
|
82
|
+
};
|
83
|
+
}
|
84
|
+
|
73
85
|
componentDidMount() {
|
74
86
|
// Start render loop
|
75
87
|
this.tick();
|
@@ -112,6 +124,9 @@ export class SkiaBaseWebView extends React.Component {
|
|
112
124
|
|
113
125
|
const touches = [...this._touches];
|
114
126
|
this._touches = [];
|
127
|
+
|
128
|
+
this._canvas.clear(CanvasKit.TRANSPARENT);
|
129
|
+
|
115
130
|
this.renderInCanvas(this._canvas, touches);
|
116
131
|
(_this$_surface2 = this._surface) === null || _this$_surface2 === void 0 ? void 0 : _this$_surface2.ref.flush();
|
117
132
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","PixelRatio","View","JsiSkSurface","TouchType","pd","get","SkiaBaseWebView","Component","constructor","props","createRef","_mode","mode","unsubscribeAll","_unsubscriptions","forEach","u","onLayout","evt","CanvasKit","global","width","height","nativeEvent","layout","_canvasRef","current","canvas","surface","MakeWebGLCanvasSurface","Error","_surface","_canvas","getCanvas","redraw","componentDidMount","tick","componentDidUpdate","componentWillUnmount","cancelAnimationFrame","requestId","makeImageSnapshot","rect","_redrawRequests","touches","_touches","renderInCanvas","ref","flush","requestAnimationFrame","bind","setDrawMode","registerValues","_values","v","push","addListener","handleTouchEvent","touchType","id","pointerId","x","clientX","currentTarget","getClientRects","left","y","clientY","top","force","pressure","type","timestamp","Date","now","createTouchHandler","render","debug","viewProps","display","flex","Start","Active","End","Cancelled"],"sources":["SkiaBaseWebView.tsx"],"sourcesContent":["/* global HTMLCanvasElement */\nimport React from \"react\";\nimport type { PointerEvent } from \"react\";\nimport type { LayoutChangeEvent } from \"react-native\";\nimport { PixelRatio, View } from \"react-native\";\n\nimport type { SkRect, SkCanvas } from \"../skia/types\";\nimport type { SkiaValue } from \"../values\";\nimport { JsiSkSurface } from \"../skia/web/JsiSkSurface\";\n\nimport type { DrawMode, SkiaBaseViewProps, TouchInfo } from \"./types\";\nimport { TouchType } from \"./types\";\n\nconst pd = PixelRatio.get();\n\nexport abstract class SkiaBaseWebView<\n TProps extends SkiaBaseViewProps\n> extends React.Component<TProps> {\n constructor(props: TProps) {\n super(props);\n this._mode = props.mode ?? \"default\";\n }\n\n private _surface: JsiSkSurface | null = null;\n private _unsubscriptions: Array<() => void> = [];\n private _touches: Array<TouchInfo> = [];\n private _canvas: SkCanvas | null = null;\n private _canvasRef = React.createRef<HTMLCanvasElement>();\n private _mode: DrawMode;\n private _redrawRequests = 0;\n private requestId = 0;\n\n protected width = 0;\n protected height = 0;\n\n private unsubscribeAll() {\n this._unsubscriptions.forEach((u) => u());\n this._unsubscriptions = [];\n }\n\n private onLayout(evt: LayoutChangeEvent) {\n const { CanvasKit } = global;\n const { width, height } = evt.nativeEvent.layout;\n this.width = width;\n this.height = height;\n // Reset canvas / surface on layout change\n if (this._canvasRef.current) {\n const canvas = this._canvasRef.current;\n canvas.width = width * pd;\n canvas.height = height * pd;\n const surface = CanvasKit.MakeWebGLCanvasSurface(this._canvasRef.current);\n if (!surface) {\n throw new Error(\"Could not create surface\");\n }\n this._surface = new JsiSkSurface(CanvasKit, surface);\n this._canvas = this._surface.getCanvas();\n this.redraw();\n }\n }\n\n componentDidMount() {\n // Start render loop\n this.tick();\n }\n\n componentDidUpdate() {\n this.redraw();\n }\n\n componentWillUnmount() {\n this.unsubscribeAll();\n cancelAnimationFrame(this.requestId);\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 return this._surface?.makeImageSnapshot(rect);\n }\n\n /**\n * Override to render\n */\n protected abstract renderInCanvas(\n canvas: SkCanvas,\n touches: TouchInfo[]\n ): void;\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n private tick() {\n if (this._mode === \"continuous\" || this._redrawRequests > 0) {\n this._redrawRequests = 0;\n if (this._canvas) {\n const touches = [...this._touches];\n this._touches = [];\n this.renderInCanvas(this._canvas!, touches);\n this._surface?.ref.flush();\n }\n }\n this.requestId = requestAnimationFrame(this.tick.bind(this));\n }\n\n public redraw() {\n this._redrawRequests++;\n }\n\n /**\n * Updates the drawing mode for the skia view. This is the same\n * as declaratively setting the mode property on the SkiaView.\n * There are two drawing modes, \"continuous\" and \"default\",\n * where the continuous mode will continuously redraw the view and\n * the default mode will only redraw when any of the regular react\n * properties are changed like size and margins.\n * @param mode Drawing mode to use.\n */\n public setDrawMode(mode: DrawMode) {\n this._mode = mode;\n this.tick();\n }\n\n /**\n * Registers one or move values as a dependant value of the Skia View. The view will\n * The view will redraw itself when any of the values change.\n * @param values Values to register\n */\n public registerValues(_values: SkiaValue<unknown>[]) {\n // Unsubscribe from dependency values\n this.unsubscribeAll();\n // Register redraw dependencies on values\n _values.forEach((v) => {\n this._unsubscriptions.push(\n v.addListener(() => {\n this.redraw();\n })\n );\n });\n }\n\n private handleTouchEvent(evt: PointerEvent, touchType: TouchType) {\n this._touches.push({\n id: evt.pointerId,\n x: evt.clientX - evt.currentTarget.getClientRects()[0].left,\n y: evt.clientY - evt.currentTarget.getClientRects()[0].top,\n force: evt.pressure,\n type: touchType,\n timestamp: Date.now(),\n });\n this.redraw();\n }\n\n createTouchHandler(touchType: TouchType) {\n return (evt: PointerEvent) => this.handleTouchEvent(evt, touchType);\n }\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <View {...viewProps} onLayout={this.onLayout.bind(this)}>\n <canvas\n ref={this._canvasRef}\n style={{ display: \"flex\", flex: 1 }}\n onPointerDown={this.createTouchHandler(TouchType.Start)}\n onPointerMove={this.createTouchHandler(TouchType.Active)}\n onPointerUp={this.createTouchHandler(TouchType.End)}\n onPointerCancel={this.createTouchHandler(TouchType.Cancelled)}\n onPointerLeave={this.createTouchHandler(TouchType.End)}\n onPointerOut={this.createTouchHandler(TouchType.End)}\n />\n </View>\n );\n }\n}\n"],"mappings":";;;;AAAA;AACA,OAAOA,KAAP,MAAkB,OAAlB;AAGA,SAASC,UAAT,EAAqBC,IAArB,QAAiC,cAAjC;AAIA,SAASC,YAAT,QAA6B,0BAA7B;AAGA,SAASC,SAAT,QAA0B,SAA1B;AAEA,MAAMC,EAAE,GAAGJ,UAAU,CAACK,GAAX,EAAX;AAEA,OAAO,MAAeC,eAAf,SAEGP,KAAK,CAACQ,SAFT,CAE2B;EAChCC,WAAW,CAACC,KAAD,EAAgB;IAAA;;IACzB,MAAMA,KAAN;;IADyB,kCAKa,IALb;;IAAA,0CAMmB,EANnB;;IAAA,kCAOU,EAPV;;IAAA,iCAQQ,IARR;;IAAA,iDASNV,KAAK,CAACW,SAAN,EATM;;IAAA;;IAAA,yCAWD,CAXC;;IAAA,mCAYP,CAZO;;IAAA,+BAcT,CAdS;;IAAA,gCAeR,CAfQ;;IAEzB,KAAKC,KAAL,kBAAaF,KAAK,CAACG,IAAnB,qDAA2B,SAA3B;EACD;;EAcOC,cAAc,GAAG;IACvB,KAAKC,gBAAL,CAAsBC,OAAtB,CAA+BC,CAAD,IAAOA,CAAC,EAAtC;;IACA,KAAKF,gBAAL,GAAwB,EAAxB;EACD;;EAEOG,QAAQ,CAACC,GAAD,EAAyB;IACvC,MAAM;MAAEC;IAAF,IAAgBC,MAAtB;IACA,MAAM;MAAEC,KAAF;MAASC;IAAT,IAAoBJ,GAAG,CAACK,WAAJ,CAAgBC,MAA1C;IACA,KAAKH,KAAL,GAAaA,KAAb;IACA,KAAKC,MAAL,GAAcA,MAAd,CAJuC,CAKvC;;IACA,IAAI,KAAKG,UAAL,CAAgBC,OAApB,EAA6B;MAC3B,MAAMC,MAAM,GAAG,KAAKF,UAAL,CAAgBC,OAA/B;MACAC,MAAM,CAACN,KAAP,GAAeA,KA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KAAnD;IACA,oBACE,oBAAC,IAAD,eAAUqE,SAAV;MAAqB,QAAQ,EAAE,KAAK7D,QAAL,CAAciC,IAAd,CAAmB,IAAnB;IAA/B,iBACE;MACE,GAAG,EAAE,KAAKzB,UADZ;MAEE,KAAK,EAAE;QAAEsD,OAAO,EAAE,MAAX;QAAmBC,IAAI,EAAE;MAAzB,CAFT;MAGE,aAAa,EAAE,KAAKL,kBAAL,CAAwBxE,SAAS,CAAC8E,KAAlC,CAHjB;MAIE,aAAa,EAAE,KAAKN,kBAAL,CAAwBxE,SAAS,CAAC+E,MAAlC,CAJjB;MAKE,WAAW,EAAE,KAAKP,kBAAL,CAAwBxE,SAAS,CAACgF,GAAlC,CALf;MAME,eAAe,EAAE,KAAKR,kBAAL,CAAwBxE,SAAS,CAACiF,SAAlC,CANnB;MAOE,cAAc,EAAE,KAAKT,kBAAL,CAAwBxE,SAAS,CAACgF,GAAlC,CAPlB;MAQE,YAAY,EAAE,KAAKR,kBAAL,CAAwBxE,SAAS,CAACgF,GAAlC;IARhB,EADF,CADF;EAcD;;AA9J+B"}
|
1
|
+
{"version":3,"names":["React","PixelRatio","View","JsiSkSurface","TouchType","pd","get","SkiaBaseWebView","Component","constructor","props","createRef","_mode","mode","unsubscribeAll","_unsubscriptions","forEach","u","onLayout","evt","CanvasKit","global","width","height","nativeEvent","layout","_canvasRef","current","canvas","surface","MakeWebGLCanvasSurface","Error","_surface","_canvas","getCanvas","redraw","getSize","componentDidMount","tick","componentDidUpdate","componentWillUnmount","cancelAnimationFrame","requestId","makeImageSnapshot","rect","_redrawRequests","touches","_touches","clear","TRANSPARENT","renderInCanvas","ref","flush","requestAnimationFrame","bind","setDrawMode","registerValues","_values","v","push","addListener","handleTouchEvent","touchType","id","pointerId","x","clientX","currentTarget","getClientRects","left","y","clientY","top","force","pressure","type","timestamp","Date","now","createTouchHandler","render","debug","viewProps","display","flex","Start","Active","End","Cancelled"],"sources":["SkiaBaseWebView.tsx"],"sourcesContent":["/* global HTMLCanvasElement */\nimport React from \"react\";\nimport type { PointerEvent } from \"react\";\nimport type { LayoutChangeEvent } from \"react-native\";\nimport { PixelRatio, View } from \"react-native\";\n\nimport type { SkRect, SkCanvas } from \"../skia/types\";\nimport type { SkiaValue } from \"../values\";\nimport { JsiSkSurface } from \"../skia/web/JsiSkSurface\";\n\nimport type { DrawMode, SkiaBaseViewProps, TouchInfo } from \"./types\";\nimport { TouchType } from \"./types\";\n\nconst pd = PixelRatio.get();\n\nexport abstract class SkiaBaseWebView<\n TProps extends SkiaBaseViewProps\n> extends React.Component<TProps> {\n constructor(props: TProps) {\n super(props);\n this._mode = props.mode ?? \"default\";\n }\n\n private _surface: JsiSkSurface | null = null;\n private _unsubscriptions: Array<() => void> = [];\n private _touches: Array<TouchInfo> = [];\n private _canvas: SkCanvas | null = null;\n private _canvasRef = React.createRef<HTMLCanvasElement>();\n private _mode: DrawMode;\n private _redrawRequests = 0;\n private requestId = 0;\n\n protected width = 0;\n protected height = 0;\n\n private unsubscribeAll() {\n this._unsubscriptions.forEach((u) => u());\n this._unsubscriptions = [];\n }\n\n private onLayout(evt: LayoutChangeEvent) {\n const { CanvasKit } = global;\n const { width, height } = evt.nativeEvent.layout;\n this.width = width;\n this.height = height;\n // Reset canvas / surface on layout change\n if (this._canvasRef.current) {\n const canvas = this._canvasRef.current;\n canvas.width = width * pd;\n canvas.height = height * pd;\n const surface = CanvasKit.MakeWebGLCanvasSurface(this._canvasRef.current);\n if (!surface) {\n throw new Error(\"Could not create surface\");\n }\n this._surface = new JsiSkSurface(CanvasKit, surface);\n this._canvas = this._surface.getCanvas();\n this.redraw();\n }\n // Call onLayout callback if it exists\n if (this.props.onLayout) {\n this.props.onLayout(evt);\n }\n }\n\n protected getSize() {\n return { width: this.width, height: this.height };\n }\n\n componentDidMount() {\n // Start render loop\n this.tick();\n }\n\n componentDidUpdate() {\n this.redraw();\n }\n\n componentWillUnmount() {\n this.unsubscribeAll();\n cancelAnimationFrame(this.requestId);\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 return this._surface?.makeImageSnapshot(rect);\n }\n\n /**\n * Override to render\n */\n protected abstract renderInCanvas(\n canvas: SkCanvas,\n touches: TouchInfo[]\n ): void;\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n private tick() {\n if (this._mode === \"continuous\" || this._redrawRequests > 0) {\n this._redrawRequests = 0;\n if (this._canvas) {\n const touches = [...this._touches];\n this._touches = [];\n this._canvas!.clear(CanvasKit.TRANSPARENT);\n this.renderInCanvas(this._canvas!, touches);\n this._surface?.ref.flush();\n }\n }\n this.requestId = requestAnimationFrame(this.tick.bind(this));\n }\n\n public redraw() {\n this._redrawRequests++;\n }\n\n /**\n * Updates the drawing mode for the skia view. This is the same\n * as declaratively setting the mode property on the SkiaView.\n * There are two drawing modes, \"continuous\" and \"default\",\n * where the continuous mode will continuously redraw the view and\n * the default mode will only redraw when any of the regular react\n * properties are changed like size and margins.\n * @param mode Drawing mode to use.\n */\n public setDrawMode(mode: DrawMode) {\n this._mode = mode;\n this.tick();\n }\n\n /**\n * Registers one or move values as a dependant value of the Skia View. The view will\n * The view will redraw itself when any of the values change.\n * @param values Values to register\n */\n public registerValues(_values: SkiaValue<unknown>[]) {\n // Unsubscribe from dependency values\n this.unsubscribeAll();\n // Register redraw dependencies on values\n _values.forEach((v) => {\n this._unsubscriptions.push(\n v.addListener(() => {\n this.redraw();\n })\n );\n });\n }\n\n private handleTouchEvent(evt: PointerEvent, touchType: TouchType) {\n this._touches.push({\n id: evt.pointerId,\n x: evt.clientX - evt.currentTarget.getClientRects()[0].left,\n y: evt.clientY - evt.currentTarget.getClientRects()[0].top,\n force: evt.pressure,\n type: touchType,\n timestamp: Date.now(),\n });\n this.redraw();\n }\n\n createTouchHandler(touchType: TouchType) {\n return (evt: PointerEvent) => this.handleTouchEvent(evt, touchType);\n }\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <View {...viewProps} onLayout={this.onLayout.bind(this)}>\n <canvas\n ref={this._canvasRef}\n style={{ display: \"flex\", flex: 1 }}\n onPointerDown={this.createTouchHandler(TouchType.Start)}\n onPointerMove={this.createTouchHandler(TouchType.Active)}\n onPointerUp={this.createTouchHandler(TouchType.End)}\n onPointerCancel={this.createTouchHandler(TouchType.Cancelled)}\n onPointerLeave={this.createTouchHandler(TouchType.End)}\n onPointerOut={this.createTouchHandler(TouchType.End)}\n />\n </View>\n );\n }\n}\n"],"mappings":";;;;AAAA;AACA,OAAOA,KAAP,MAAkB,OAAlB;AAGA,SAASC,UAAT,EAAqBC,IAArB,QAAiC,cAAjC;AAIA,SAASC,YAAT,QAA6B,0BAA7B;AAGA,SAASC,SAAT,QAA0B,SAA1B;AAEA,MAAMC,EAAE,GAAGJ,UAAU,CAACK,GAAX,EAAX;AAEA,OAAO,MAAeC,eAAf,SAEGP,KAAK,CAACQ,SAFT,CAE2B;EAChCC,WAAW,CAACC,KAAD,EAAgB;IAAA;;IACzB,MAAMA,KAAN;;IADyB,kCAKa,IALb;;IAAA,0CAMmB,EANnB;;IAAA,kCAOU,EAPV;;IAAA,iCAQQ,IARR;;IAAA,iDASNV,KAAK,CAACW,SAAN,EATM;;IAAA;;IAAA,yCAWD,CAXC;;IAAA,mCAYP,CAZO;;IAAA,+BAcT,CAdS;;IAAA,gCAeR,CAfQ;;IAEzB,KAAKC,KAAL,kBAAaF,KAAK,CAACG,IAAnB,qDAA2B,SAA3B;EACD;;EAcOC,cAAc,GAAG;IACvB,KAAKC,gBAAL,CAAsBC,OAAtB,CAA+BC,CAAD,IAAOA,CAAC,EAAtC;;IACA,KAAKF,gBAAL,GAAwB,EAAxB;EACD;;EAEOG,QAAQ,CAACC,GAAD,EAAyB;IACvC,MAAM;MAAEC;IAAF,IAAgBC,MAAtB;IACA,MAAM;MAAEC,KAAF;MAASC;IAAT,IAAoBJ,GAAG,CAACK,WAAJ,CAAgBC,MAA1C;IAC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assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
2
|
+
|
3
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
4
|
+
|
5
|
+
import React from "react";
|
6
|
+
import { requireNativeComponent, Platform } from "react-native";
|
7
|
+
import { SkiaViewApi } from "./api";
|
8
|
+
import { SkiaViewNativeId } from "./SkiaView";
|
9
|
+
const NativeSkiaDomView = Platform.OS !== "web" ? requireNativeComponent("SkiaDomView") : // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
10
|
+
null;
|
11
|
+
export class SkiaDomView extends React.Component {
|
12
|
+
constructor(props) {
|
13
|
+
super(props);
|
14
|
+
|
15
|
+
_defineProperty(this, "_nativeId", void 0);
|
16
|
+
|
17
|
+
this._nativeId = SkiaViewNativeId.current++;
|
18
|
+
const {
|
19
|
+
root,
|
20
|
+
onTouch,
|
21
|
+
onSize
|
22
|
+
} = props;
|
23
|
+
|
24
|
+
if (root) {
|
25
|
+
assertSkiaViewApi();
|
26
|
+
SkiaViewApi.setJsiProperty(this._nativeId, "root", root);
|
27
|
+
}
|
28
|
+
|
29
|
+
if (onTouch) {
|
30
|
+
assertSkiaViewApi();
|
31
|
+
SkiaViewApi.setJsiProperty(this._nativeId, "onTouch", onTouch);
|
32
|
+
}
|
33
|
+
|
34
|
+
if (onSize) {
|
35
|
+
assertSkiaViewApi();
|
36
|
+
SkiaViewApi.setJsiProperty(this._nativeId, "onSize", onSize);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
get nativeId() {
|
41
|
+
return this._nativeId;
|
42
|
+
}
|
43
|
+
|
44
|
+
componentDidUpdate(prevProps) {
|
45
|
+
const {
|
46
|
+
root,
|
47
|
+
onTouch,
|
48
|
+
onSize
|
49
|
+
} = this.props;
|
50
|
+
|
51
|
+
if (root !== prevProps.root) {
|
52
|
+
assertSkiaViewApi();
|
53
|
+
SkiaViewApi.setJsiProperty(this._nativeId, "root", root);
|
54
|
+
}
|
55
|
+
|
56
|
+
if (onTouch !== prevProps.onTouch) {
|
57
|
+
assertSkiaViewApi();
|
58
|
+
SkiaViewApi.setJsiProperty(this._nativeId, "onTouch", onTouch);
|
59
|
+
}
|
60
|
+
|
61
|
+
if (onSize !== prevProps.onSize) {
|
62
|
+
assertSkiaViewApi();
|
63
|
+
SkiaViewApi.setJsiProperty(this._nativeId, "onSize", onSize);
|
64
|
+
}
|
65
|
+
}
|
66
|
+
/**
|
67
|
+
* Creates a snapshot from the canvas in the surface
|
68
|
+
* @param rect Rect to use as bounds. Optional.
|
69
|
+
* @returns An Image object.
|
70
|
+
*/
|
71
|
+
|
72
|
+
|
73
|
+
makeImageSnapshot(rect) {
|
74
|
+
assertSkiaViewApi();
|
75
|
+
return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);
|
76
|
+
}
|
77
|
+
/**
|
78
|
+
* Sends a redraw request to the native SkiaView.
|
79
|
+
*/
|
80
|
+
|
81
|
+
|
82
|
+
redraw() {
|
83
|
+
assertSkiaViewApi();
|
84
|
+
SkiaViewApi.requestRedraw(this._nativeId);
|
85
|
+
}
|
86
|
+
/**
|
87
|
+
* Registers one or move values as a dependant value of the Skia View. The view will
|
88
|
+
* The view will redraw itself when any of the values change.
|
89
|
+
* @param values Values to register
|
90
|
+
*/
|
91
|
+
|
92
|
+
|
93
|
+
registerValues(values) {
|
94
|
+
assertSkiaViewApi();
|
95
|
+
return SkiaViewApi.registerValuesInView(this._nativeId, values);
|
96
|
+
}
|
97
|
+
/**
|
98
|
+
* Clear up the dom node when unmounting to release resources.
|
99
|
+
*/
|
100
|
+
|
101
|
+
|
102
|
+
componentWillUnmount() {
|
103
|
+
assertSkiaViewApi();
|
104
|
+
SkiaViewApi.setJsiProperty(this._nativeId, "root", null);
|
105
|
+
}
|
106
|
+
|
107
|
+
render() {
|
108
|
+
const {
|
109
|
+
mode,
|
110
|
+
debug = false,
|
111
|
+
...viewProps
|
112
|
+
} = this.props;
|
113
|
+
return /*#__PURE__*/React.createElement(NativeSkiaDomView, _extends({
|
114
|
+
collapsable: false,
|
115
|
+
nativeID: `${this._nativeId}`,
|
116
|
+
mode: mode,
|
117
|
+
debug: debug
|
118
|
+
}, viewProps));
|
119
|
+
}
|
120
|
+
|
121
|
+
}
|
122
|
+
|
123
|
+
const assertSkiaViewApi = () => {
|
124
|
+
if (SkiaViewApi === null || SkiaViewApi.setJsiProperty === null || SkiaViewApi.callJsiMethod === null || SkiaViewApi.registerValuesInView === null || SkiaViewApi.requestRedraw === null || SkiaViewApi.makeImageSnapshot === null) {
|
125
|
+
throw Error("Skia View Api was not found.");
|
126
|
+
}
|
127
|
+
};
|
128
|
+
//# sourceMappingURL=SkiaDomView.js.map
|