@shopify/react-native-skia 0.1.216 → 0.1.219
Sign up to get free protection for your applications and to get access to all the features.
- package/android/build.gradle +22 -0
- package/android/src/main/java/com/shopify/reactnative/skia/PlatformContext.java +9 -10
- package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaModule.java +3 -3
- package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaPackage.java +56 -2
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +5 -1
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseViewManager.java +3 -3
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDomViewManager.java +14 -1
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDrawViewManager.java +16 -1
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaPictureViewManager.java +15 -1
- package/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java +2 -2
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaDomViewManagerDelegate.java +34 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaDomViewManagerInterface.java +18 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaDrawViewManagerDelegate.java +34 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaDrawViewManagerInterface.java +18 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaPictureViewManagerDelegate.java +34 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaPictureViewManagerInterface.java +18 -0
- package/android/src/paper/java/com/shopify/reactnative/skia/NativeSkiaModuleSpec.java +38 -0
- package/cpp/rnskia/RNSkView.h +1 -1
- package/cpp/rnskia/dom/nodes/JsiImageNode.h +1 -1
- package/ios/RNSkia-iOS/SkiaDomView.h +7 -0
- package/ios/RNSkia-iOS/SkiaDomView.mm +64 -0
- package/ios/RNSkia-iOS/SkiaDomViewManager.mm +1 -1
- package/ios/RNSkia-iOS/SkiaDrawView.h +7 -0
- package/ios/RNSkia-iOS/SkiaDrawView.mm +72 -0
- package/ios/RNSkia-iOS/SkiaDrawViewManager.mm +1 -1
- package/ios/RNSkia-iOS/SkiaPictureView.h +7 -0
- package/ios/RNSkia-iOS/SkiaPictureView.mm +66 -0
- package/ios/RNSkia-iOS/SkiaPictureViewManager.mm +1 -1
- package/ios/RNSkia-iOS/SkiaUIView.h +15 -2
- package/ios/RNSkia-iOS/SkiaUIView.mm +48 -16
- package/ios/RNSkiaModule.h +10 -1
- package/ios/RNSkiaModule.mm +8 -1
- package/lib/commonjs/Platform/IPlatform.d.ts +1 -3
- package/lib/commonjs/Platform/IPlatform.js.map +1 -1
- package/lib/commonjs/Platform/Platform.js +0 -2
- package/lib/commonjs/Platform/Platform.js.map +1 -1
- package/lib/commonjs/Platform/Platform.web.js +0 -4
- package/lib/commonjs/Platform/Platform.web.js.map +1 -1
- package/lib/commonjs/animation/functions/interpolate.d.ts +1 -1
- package/lib/commonjs/animation/timing/functions/types.d.ts +1 -1
- package/lib/commonjs/animation/types.d.ts +2 -2
- package/lib/commonjs/dom/nodes/Node.d.ts +1 -1
- package/lib/commonjs/dom/types/Common.d.ts +8 -8
- package/lib/commonjs/dom/types/DeclarationContext.d.ts +1 -1
- package/lib/commonjs/dom/types/DrawingContext.js.map +1 -1
- package/lib/commonjs/dom/types/Drawings.d.ts +5 -5
- package/lib/commonjs/dom/types/Node.d.ts +1 -1
- package/lib/commonjs/dom/types/SkDOM.d.ts +4 -4
- package/lib/commonjs/external/reanimated/renderHelpers.js +0 -2
- package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.d.ts +1 -1
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/DependencyManager.d.ts +3 -3
- package/lib/commonjs/renderer/HostConfig.d.ts +12 -12
- package/lib/commonjs/renderer/Reconciler.d.ts +1 -1
- package/lib/commonjs/renderer/Reconciler.js +1 -0
- package/lib/commonjs/renderer/Reconciler.js.map +1 -1
- package/lib/commonjs/renderer/components/Blend.d.ts +2 -2
- package/lib/commonjs/renderer/components/Drawing.d.ts +2 -2
- package/lib/commonjs/renderer/components/Group.d.ts +2 -2
- package/lib/commonjs/renderer/components/Mask.d.ts +2 -1
- package/lib/commonjs/renderer/components/Paint.d.ts +2 -2
- package/lib/commonjs/renderer/components/Picture.d.ts +2 -2
- package/lib/commonjs/renderer/components/backdrop/BackdropBlur.d.ts +2 -2
- package/lib/commonjs/renderer/components/backdrop/BackdropFilter.d.ts +2 -1
- package/lib/commonjs/renderer/components/colorFilters/BlendColor.d.ts +2 -2
- package/lib/commonjs/renderer/components/colorFilters/Lerp.d.ts +2 -2
- package/lib/commonjs/renderer/components/colorFilters/LinearToSRGBGamma.d.ts +2 -2
- package/lib/commonjs/renderer/components/colorFilters/LumaColorFilter.d.ts +2 -2
- package/lib/commonjs/renderer/components/colorFilters/Matrix.d.ts +2 -2
- package/lib/commonjs/renderer/components/colorFilters/SRGBToLinearGamma.d.ts +2 -2
- package/lib/commonjs/renderer/components/image/Image.d.ts +2 -2
- package/lib/commonjs/renderer/components/image/ImageSVG.d.ts +2 -2
- package/lib/commonjs/renderer/components/image/ImageShader.d.ts +2 -2
- package/lib/commonjs/renderer/components/imageFilters/Blur.d.ts +2 -2
- package/lib/commonjs/renderer/components/imageFilters/DisplacementMap.d.ts +2 -2
- package/lib/commonjs/renderer/components/imageFilters/Morphology.d.ts +2 -2
- package/lib/commonjs/renderer/components/imageFilters/Offset.d.ts +2 -2
- package/lib/commonjs/renderer/components/imageFilters/RuntimeShader.d.ts +2 -2
- package/lib/commonjs/renderer/components/imageFilters/Shadow.d.ts +2 -2
- package/lib/commonjs/renderer/components/maskFilters/Blur.d.ts +2 -2
- package/lib/commonjs/renderer/components/pathEffects/Corner.d.ts +2 -2
- package/lib/commonjs/renderer/components/pathEffects/Dash.d.ts +2 -2
- package/lib/commonjs/renderer/components/pathEffects/Discrete.d.ts +2 -2
- package/lib/commonjs/renderer/components/pathEffects/Line2D.d.ts +2 -2
- package/lib/commonjs/renderer/components/pathEffects/Path1D.d.ts +2 -2
- package/lib/commonjs/renderer/components/pathEffects/Path2D.d.ts +2 -2
- package/lib/commonjs/renderer/components/pathEffects/Sum.d.ts +2 -2
- package/lib/commonjs/renderer/components/shaders/Color.d.ts +2 -2
- package/lib/commonjs/renderer/components/shaders/FractalNoise.d.ts +2 -2
- package/lib/commonjs/renderer/components/shaders/LinearGradient.d.ts +2 -2
- package/lib/commonjs/renderer/components/shaders/RadialGradient.d.ts +2 -2
- package/lib/commonjs/renderer/components/shaders/Shader.d.ts +2 -2
- package/lib/commonjs/renderer/components/shaders/SweepGradient.d.ts +2 -2
- package/lib/commonjs/renderer/components/shaders/Turbulence.d.ts +2 -2
- package/lib/commonjs/renderer/components/shaders/TwoPointConicalGradient.d.ts +2 -2
- package/lib/commonjs/renderer/components/shapes/Box.d.ts +3 -3
- package/lib/commonjs/renderer/components/shapes/Circle.d.ts +2 -2
- package/lib/commonjs/renderer/components/shapes/DiffRect.d.ts +2 -2
- package/lib/commonjs/renderer/components/shapes/Fill.d.ts +2 -2
- package/lib/commonjs/renderer/components/shapes/FitBox.d.ts +2 -1
- package/lib/commonjs/renderer/components/shapes/Line.d.ts +2 -2
- package/lib/commonjs/renderer/components/shapes/Oval.d.ts +2 -2
- package/lib/commonjs/renderer/components/shapes/Patch.d.ts +2 -2
- package/lib/commonjs/renderer/components/shapes/Path.d.ts +2 -2
- package/lib/commonjs/renderer/components/shapes/Points.d.ts +2 -2
- package/lib/commonjs/renderer/components/shapes/Rect.d.ts +2 -2
- package/lib/commonjs/renderer/components/shapes/RoundedRect.d.ts +2 -2
- package/lib/commonjs/renderer/components/shapes/Vertices.d.ts +2 -2
- package/lib/commonjs/renderer/components/text/Glyphs.d.ts +2 -2
- package/lib/commonjs/renderer/components/text/Text.d.ts +2 -2
- package/lib/commonjs/renderer/components/text/TextBlob.d.ts +2 -2
- package/lib/commonjs/renderer/components/text/TextPath.d.ts +2 -2
- package/lib/commonjs/renderer/processors/Animations/Animations.d.ts +6 -6
- package/lib/commonjs/skia/NativeSetup.js +5 -1
- package/lib/commonjs/skia/NativeSetup.js.map +1 -1
- package/lib/commonjs/skia/core/Font.d.ts +2 -2
- package/lib/commonjs/skia/types/Color.d.ts +2 -2
- package/lib/commonjs/skia/types/ColorFilter/ColorFilter.d.ts +1 -1
- package/lib/commonjs/skia/types/ColorFilter/ColorFilterFactory.d.ts +1 -1
- package/lib/commonjs/skia/types/Data/Data.d.ts +6 -6
- package/lib/commonjs/skia/types/ImageFilter/ImageFilter.d.ts +1 -1
- package/lib/commonjs/skia/types/MaskFilter.d.ts +1 -1
- package/lib/commonjs/skia/types/Matrix.d.ts +3 -3
- package/lib/commonjs/skia/types/Path/Path.d.ts +1 -1
- package/lib/commonjs/skia/types/PathEffect.d.ts +1 -1
- package/lib/commonjs/skia/types/Point.d.ts +1 -1
- package/lib/commonjs/skia/types/RSXform.d.ts +1 -1
- package/lib/commonjs/skia/types/Shader/Shader.d.ts +2 -2
- package/lib/commonjs/skia/types/TextBlob.d.ts +1 -1
- package/lib/commonjs/skia/web/JsiSkData.d.ts +1 -1
- package/lib/commonjs/skia/web/JsiSkRSXform.d.ts +1 -1
- package/lib/commonjs/specs/NativeSkiaModule.d.ts +6 -0
- package/lib/commonjs/specs/NativeSkiaModule.js +14 -0
- package/lib/commonjs/specs/NativeSkiaModule.js.map +1 -0
- package/lib/commonjs/specs/NativeSkiaModule.web.d.ts +2 -0
- package/lib/commonjs/specs/NativeSkiaModule.web.js +13 -0
- package/lib/commonjs/specs/NativeSkiaModule.web.js.map +1 -0
- package/lib/commonjs/specs/SkiaDomViewNativeComponent.d.ts +8 -0
- package/lib/commonjs/specs/SkiaDomViewNativeComponent.js +16 -0
- package/lib/commonjs/specs/SkiaDomViewNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/SkiaDrawViewNativeComponent.d.ts +8 -0
- package/lib/commonjs/specs/SkiaDrawViewNativeComponent.js +16 -0
- package/lib/commonjs/specs/SkiaDrawViewNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.d.ts +8 -0
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js +16 -0
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js.map +1 -0
- package/lib/commonjs/values/selector.d.ts +1 -1
- package/lib/commonjs/views/SkiaBaseWebView.d.ts +1 -1
- package/lib/commonjs/views/SkiaDomView.d.ts +1 -1
- package/lib/commonjs/views/SkiaDomView.js +3 -1
- package/lib/commonjs/views/SkiaDomView.js.map +1 -1
- package/lib/commonjs/views/SkiaPictureView.d.ts +1 -1
- package/lib/commonjs/views/SkiaPictureView.js +3 -3
- package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
- package/lib/commonjs/views/SkiaView.d.ts +1 -1
- package/lib/commonjs/views/SkiaView.js +3 -4
- package/lib/commonjs/views/SkiaView.js.map +1 -1
- package/lib/commonjs/views/types.d.ts +6 -6
- package/lib/commonjs/web/WithSkiaWeb.d.ts +2 -2
- package/lib/module/Platform/IPlatform.d.ts +1 -3
- package/lib/module/Platform/IPlatform.js.map +1 -1
- package/lib/module/Platform/Platform.js +1 -3
- package/lib/module/Platform/Platform.js.map +1 -1
- package/lib/module/Platform/Platform.web.js +0 -4
- package/lib/module/Platform/Platform.web.js.map +1 -1
- package/lib/module/animation/functions/interpolate.d.ts +1 -1
- package/lib/module/animation/timing/functions/types.d.ts +1 -1
- package/lib/module/animation/types.d.ts +2 -2
- package/lib/module/dom/nodes/Node.d.ts +1 -1
- package/lib/module/dom/types/Common.d.ts +8 -8
- package/lib/module/dom/types/DeclarationContext.d.ts +1 -1
- package/lib/module/dom/types/DrawingContext.js.map +1 -1
- package/lib/module/dom/types/Drawings.d.ts +5 -5
- package/lib/module/dom/types/Node.d.ts +1 -1
- package/lib/module/dom/types/SkDOM.d.ts +4 -4
- package/lib/module/external/reanimated/renderHelpers.js +0 -2
- package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/module/renderer/Canvas.d.ts +1 -1
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/DependencyManager.d.ts +3 -3
- package/lib/module/renderer/HostConfig.d.ts +12 -12
- package/lib/module/renderer/Reconciler.d.ts +1 -1
- package/lib/module/renderer/Reconciler.js +1 -0
- package/lib/module/renderer/Reconciler.js.map +1 -1
- package/lib/module/renderer/components/Blend.d.ts +2 -2
- package/lib/module/renderer/components/Drawing.d.ts +2 -2
- package/lib/module/renderer/components/Group.d.ts +2 -2
- package/lib/module/renderer/components/Mask.d.ts +2 -1
- package/lib/module/renderer/components/Paint.d.ts +2 -2
- package/lib/module/renderer/components/Picture.d.ts +2 -2
- package/lib/module/renderer/components/backdrop/BackdropBlur.d.ts +2 -2
- package/lib/module/renderer/components/backdrop/BackdropFilter.d.ts +2 -1
- package/lib/module/renderer/components/colorFilters/BlendColor.d.ts +2 -2
- package/lib/module/renderer/components/colorFilters/Lerp.d.ts +2 -2
- package/lib/module/renderer/components/colorFilters/LinearToSRGBGamma.d.ts +2 -2
- package/lib/module/renderer/components/colorFilters/LumaColorFilter.d.ts +2 -2
- package/lib/module/renderer/components/colorFilters/Matrix.d.ts +2 -2
- package/lib/module/renderer/components/colorFilters/SRGBToLinearGamma.d.ts +2 -2
- package/lib/module/renderer/components/image/Image.d.ts +2 -2
- package/lib/module/renderer/components/image/ImageSVG.d.ts +2 -2
- package/lib/module/renderer/components/image/ImageShader.d.ts +2 -2
- package/lib/module/renderer/components/imageFilters/Blur.d.ts +2 -2
- package/lib/module/renderer/components/imageFilters/DisplacementMap.d.ts +2 -2
- package/lib/module/renderer/components/imageFilters/Morphology.d.ts +2 -2
- package/lib/module/renderer/components/imageFilters/Offset.d.ts +2 -2
- package/lib/module/renderer/components/imageFilters/RuntimeShader.d.ts +2 -2
- package/lib/module/renderer/components/imageFilters/Shadow.d.ts +2 -2
- package/lib/module/renderer/components/maskFilters/Blur.d.ts +2 -2
- package/lib/module/renderer/components/pathEffects/Corner.d.ts +2 -2
- package/lib/module/renderer/components/pathEffects/Dash.d.ts +2 -2
- package/lib/module/renderer/components/pathEffects/Discrete.d.ts +2 -2
- package/lib/module/renderer/components/pathEffects/Line2D.d.ts +2 -2
- package/lib/module/renderer/components/pathEffects/Path1D.d.ts +2 -2
- package/lib/module/renderer/components/pathEffects/Path2D.d.ts +2 -2
- package/lib/module/renderer/components/pathEffects/Sum.d.ts +2 -2
- package/lib/module/renderer/components/shaders/Color.d.ts +2 -2
- package/lib/module/renderer/components/shaders/FractalNoise.d.ts +2 -2
- package/lib/module/renderer/components/shaders/LinearGradient.d.ts +2 -2
- package/lib/module/renderer/components/shaders/RadialGradient.d.ts +2 -2
- package/lib/module/renderer/components/shaders/Shader.d.ts +2 -2
- package/lib/module/renderer/components/shaders/SweepGradient.d.ts +2 -2
- package/lib/module/renderer/components/shaders/Turbulence.d.ts +2 -2
- package/lib/module/renderer/components/shaders/TwoPointConicalGradient.d.ts +2 -2
- package/lib/module/renderer/components/shapes/Box.d.ts +3 -3
- package/lib/module/renderer/components/shapes/Circle.d.ts +2 -2
- package/lib/module/renderer/components/shapes/DiffRect.d.ts +2 -2
- package/lib/module/renderer/components/shapes/Fill.d.ts +2 -2
- package/lib/module/renderer/components/shapes/FitBox.d.ts +2 -1
- package/lib/module/renderer/components/shapes/Line.d.ts +2 -2
- package/lib/module/renderer/components/shapes/Oval.d.ts +2 -2
- package/lib/module/renderer/components/shapes/Patch.d.ts +2 -2
- package/lib/module/renderer/components/shapes/Path.d.ts +2 -2
- package/lib/module/renderer/components/shapes/Points.d.ts +2 -2
- package/lib/module/renderer/components/shapes/Rect.d.ts +2 -2
- package/lib/module/renderer/components/shapes/RoundedRect.d.ts +2 -2
- package/lib/module/renderer/components/shapes/Vertices.d.ts +2 -2
- package/lib/module/renderer/components/text/Glyphs.d.ts +2 -2
- package/lib/module/renderer/components/text/Text.d.ts +2 -2
- package/lib/module/renderer/components/text/TextBlob.d.ts +2 -2
- package/lib/module/renderer/components/text/TextPath.d.ts +2 -2
- package/lib/module/renderer/processors/Animations/Animations.d.ts +6 -6
- package/lib/module/skia/NativeSetup.js +2 -1
- package/lib/module/skia/NativeSetup.js.map +1 -1
- package/lib/module/skia/core/Font.d.ts +2 -2
- package/lib/module/skia/types/Color.d.ts +2 -2
- package/lib/module/skia/types/ColorFilter/ColorFilter.d.ts +1 -1
- package/lib/module/skia/types/ColorFilter/ColorFilterFactory.d.ts +1 -1
- package/lib/module/skia/types/Data/Data.d.ts +6 -6
- package/lib/module/skia/types/ImageFilter/ImageFilter.d.ts +1 -1
- package/lib/module/skia/types/MaskFilter.d.ts +1 -1
- package/lib/module/skia/types/Matrix.d.ts +3 -3
- package/lib/module/skia/types/Path/Path.d.ts +1 -1
- package/lib/module/skia/types/PathEffect.d.ts +1 -1
- package/lib/module/skia/types/Point.d.ts +1 -1
- package/lib/module/skia/types/RSXform.d.ts +1 -1
- package/lib/module/skia/types/Shader/Shader.d.ts +2 -2
- package/lib/module/skia/types/TextBlob.d.ts +1 -1
- package/lib/module/skia/web/JsiSkData.d.ts +1 -1
- package/lib/module/skia/web/JsiSkRSXform.d.ts +1 -1
- package/lib/module/specs/NativeSkiaModule.d.ts +6 -0
- package/lib/module/specs/NativeSkiaModule.js +4 -0
- package/lib/module/specs/NativeSkiaModule.js.map +1 -0
- package/lib/module/specs/NativeSkiaModule.web.d.ts +2 -0
- package/lib/module/specs/NativeSkiaModule.web.js +4 -0
- package/lib/module/specs/NativeSkiaModule.web.js.map +1 -0
- package/lib/module/specs/SkiaDomViewNativeComponent.d.ts +8 -0
- package/lib/module/specs/SkiaDomViewNativeComponent.js +4 -0
- package/lib/module/specs/SkiaDomViewNativeComponent.js.map +1 -0
- package/lib/module/specs/SkiaDrawViewNativeComponent.d.ts +8 -0
- package/lib/module/specs/SkiaDrawViewNativeComponent.js +4 -0
- package/lib/module/specs/SkiaDrawViewNativeComponent.js.map +1 -0
- package/lib/module/specs/SkiaPictureViewNativeComponent.d.ts +8 -0
- package/lib/module/specs/SkiaPictureViewNativeComponent.js +4 -0
- package/lib/module/specs/SkiaPictureViewNativeComponent.js.map +1 -0
- package/lib/module/values/selector.d.ts +1 -1
- package/lib/module/views/SkiaBaseWebView.d.ts +1 -1
- package/lib/module/views/SkiaDomView.d.ts +1 -1
- package/lib/module/views/SkiaDomView.js +2 -1
- package/lib/module/views/SkiaDomView.js.map +1 -1
- package/lib/module/views/SkiaPictureView.d.ts +1 -1
- package/lib/module/views/SkiaPictureView.js +3 -3
- package/lib/module/views/SkiaPictureView.js.map +1 -1
- package/lib/module/views/SkiaView.d.ts +1 -1
- package/lib/module/views/SkiaView.js +3 -3
- package/lib/module/views/SkiaView.js.map +1 -1
- package/lib/module/views/types.d.ts +6 -6
- package/lib/module/web/WithSkiaWeb.d.ts +2 -2
- package/lib/typescript/src/Platform/IPlatform.d.ts +1 -3
- package/lib/typescript/src/animation/functions/interpolate.d.ts +1 -1
- package/lib/typescript/src/animation/timing/functions/types.d.ts +1 -1
- package/lib/typescript/src/animation/types.d.ts +2 -2
- package/lib/typescript/src/dom/nodes/Node.d.ts +1 -1
- package/lib/typescript/src/dom/types/Common.d.ts +8 -8
- package/lib/typescript/src/dom/types/DeclarationContext.d.ts +1 -1
- package/lib/typescript/src/dom/types/Drawings.d.ts +5 -5
- package/lib/typescript/src/dom/types/Node.d.ts +1 -1
- package/lib/typescript/src/dom/types/SkDOM.d.ts +4 -4
- package/lib/typescript/src/renderer/Canvas.d.ts +1 -1
- package/lib/typescript/src/renderer/DependencyManager.d.ts +3 -3
- package/lib/typescript/src/renderer/HostConfig.d.ts +12 -12
- package/lib/typescript/src/renderer/Reconciler.d.ts +1 -1
- package/lib/typescript/src/renderer/components/Blend.d.ts +2 -2
- package/lib/typescript/src/renderer/components/Drawing.d.ts +2 -2
- package/lib/typescript/src/renderer/components/Group.d.ts +2 -2
- package/lib/typescript/src/renderer/components/Mask.d.ts +2 -1
- package/lib/typescript/src/renderer/components/Paint.d.ts +2 -2
- package/lib/typescript/src/renderer/components/Picture.d.ts +2 -2
- package/lib/typescript/src/renderer/components/backdrop/BackdropBlur.d.ts +2 -2
- package/lib/typescript/src/renderer/components/backdrop/BackdropFilter.d.ts +2 -1
- package/lib/typescript/src/renderer/components/colorFilters/BlendColor.d.ts +2 -2
- package/lib/typescript/src/renderer/components/colorFilters/Lerp.d.ts +2 -2
- package/lib/typescript/src/renderer/components/colorFilters/LinearToSRGBGamma.d.ts +2 -2
- package/lib/typescript/src/renderer/components/colorFilters/LumaColorFilter.d.ts +2 -2
- package/lib/typescript/src/renderer/components/colorFilters/Matrix.d.ts +2 -2
- package/lib/typescript/src/renderer/components/colorFilters/SRGBToLinearGamma.d.ts +2 -2
- package/lib/typescript/src/renderer/components/image/Image.d.ts +2 -2
- package/lib/typescript/src/renderer/components/image/ImageSVG.d.ts +2 -2
- package/lib/typescript/src/renderer/components/image/ImageShader.d.ts +2 -2
- package/lib/typescript/src/renderer/components/imageFilters/Blur.d.ts +2 -2
- package/lib/typescript/src/renderer/components/imageFilters/DisplacementMap.d.ts +2 -2
- package/lib/typescript/src/renderer/components/imageFilters/Morphology.d.ts +2 -2
- package/lib/typescript/src/renderer/components/imageFilters/Offset.d.ts +2 -2
- package/lib/typescript/src/renderer/components/imageFilters/RuntimeShader.d.ts +2 -2
- package/lib/typescript/src/renderer/components/imageFilters/Shadow.d.ts +2 -2
- package/lib/typescript/src/renderer/components/maskFilters/Blur.d.ts +2 -2
- package/lib/typescript/src/renderer/components/pathEffects/Corner.d.ts +2 -2
- package/lib/typescript/src/renderer/components/pathEffects/Dash.d.ts +2 -2
- package/lib/typescript/src/renderer/components/pathEffects/Discrete.d.ts +2 -2
- package/lib/typescript/src/renderer/components/pathEffects/Line2D.d.ts +2 -2
- package/lib/typescript/src/renderer/components/pathEffects/Path1D.d.ts +2 -2
- package/lib/typescript/src/renderer/components/pathEffects/Path2D.d.ts +2 -2
- package/lib/typescript/src/renderer/components/pathEffects/Sum.d.ts +2 -2
- package/lib/typescript/src/renderer/components/shaders/Color.d.ts +2 -2
- package/lib/typescript/src/renderer/components/shaders/FractalNoise.d.ts +2 -2
- package/lib/typescript/src/renderer/components/shaders/LinearGradient.d.ts +2 -2
- package/lib/typescript/src/renderer/components/shaders/RadialGradient.d.ts +2 -2
- package/lib/typescript/src/renderer/components/shaders/Shader.d.ts +2 -2
- package/lib/typescript/src/renderer/components/shaders/SweepGradient.d.ts +2 -2
- package/lib/typescript/src/renderer/components/shaders/Turbulence.d.ts +2 -2
- package/lib/typescript/src/renderer/components/shaders/TwoPointConicalGradient.d.ts +2 -2
- package/lib/typescript/src/renderer/components/shapes/Box.d.ts +3 -3
- package/lib/typescript/src/renderer/components/shapes/Circle.d.ts +2 -2
- package/lib/typescript/src/renderer/components/shapes/DiffRect.d.ts +2 -2
- package/lib/typescript/src/renderer/components/shapes/Fill.d.ts +2 -2
- package/lib/typescript/src/renderer/components/shapes/FitBox.d.ts +2 -1
- package/lib/typescript/src/renderer/components/shapes/Line.d.ts +2 -2
- package/lib/typescript/src/renderer/components/shapes/Oval.d.ts +2 -2
- package/lib/typescript/src/renderer/components/shapes/Patch.d.ts +2 -2
- package/lib/typescript/src/renderer/components/shapes/Path.d.ts +2 -2
- package/lib/typescript/src/renderer/components/shapes/Points.d.ts +2 -2
- package/lib/typescript/src/renderer/components/shapes/Rect.d.ts +2 -2
- package/lib/typescript/src/renderer/components/shapes/RoundedRect.d.ts +2 -2
- package/lib/typescript/src/renderer/components/shapes/Vertices.d.ts +2 -2
- package/lib/typescript/src/renderer/components/text/Glyphs.d.ts +2 -2
- package/lib/typescript/src/renderer/components/text/Text.d.ts +2 -2
- package/lib/typescript/src/renderer/components/text/TextBlob.d.ts +2 -2
- package/lib/typescript/src/renderer/components/text/TextPath.d.ts +2 -2
- package/lib/typescript/src/renderer/processors/Animations/Animations.d.ts +6 -6
- package/lib/typescript/src/skia/core/Font.d.ts +2 -2
- package/lib/typescript/src/skia/types/Color.d.ts +2 -2
- package/lib/typescript/src/skia/types/ColorFilter/ColorFilter.d.ts +1 -1
- package/lib/typescript/src/skia/types/ColorFilter/ColorFilterFactory.d.ts +1 -1
- package/lib/typescript/src/skia/types/Data/Data.d.ts +6 -6
- package/lib/typescript/src/skia/types/ImageFilter/ImageFilter.d.ts +1 -1
- package/lib/typescript/src/skia/types/MaskFilter.d.ts +1 -1
- package/lib/typescript/src/skia/types/Matrix.d.ts +3 -3
- package/lib/typescript/src/skia/types/Path/Path.d.ts +1 -1
- package/lib/typescript/src/skia/types/PathEffect.d.ts +1 -1
- package/lib/typescript/src/skia/types/Point.d.ts +1 -1
- package/lib/typescript/src/skia/types/RSXform.d.ts +1 -1
- package/lib/typescript/src/skia/types/Shader/Shader.d.ts +2 -2
- package/lib/typescript/src/skia/types/TextBlob.d.ts +1 -1
- package/lib/typescript/src/skia/web/JsiSkData.d.ts +1 -1
- package/lib/typescript/src/skia/web/JsiSkRSXform.d.ts +1 -1
- package/lib/typescript/src/specs/NativeSkiaModule.d.ts +6 -0
- package/lib/typescript/src/specs/NativeSkiaModule.web.d.ts +2 -0
- package/lib/typescript/src/specs/SkiaDomViewNativeComponent.d.ts +8 -0
- package/lib/typescript/src/specs/SkiaDrawViewNativeComponent.d.ts +8 -0
- package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.d.ts +8 -0
- package/lib/typescript/src/values/selector.d.ts +1 -1
- package/lib/typescript/src/views/SkiaBaseWebView.d.ts +1 -1
- package/lib/typescript/src/views/SkiaDomView.d.ts +1 -1
- package/lib/typescript/src/views/SkiaPictureView.d.ts +1 -1
- package/lib/typescript/src/views/SkiaView.d.ts +1 -1
- package/lib/typescript/src/views/types.d.ts +6 -6
- package/lib/typescript/src/web/WithSkiaWeb.d.ts +2 -2
- package/package.json +18 -6
- package/react-native-skia.podspec +11 -3
- package/src/Platform/IPlatform.ts +1 -3
- package/src/Platform/Platform.ts +0 -4
- package/src/Platform/Platform.web.tsx +0 -4
- package/src/dom/types/DrawingContext.ts +1 -1
- package/src/external/reanimated/renderHelpers.ts +1 -1
- package/src/renderer/Canvas.tsx +2 -1
- package/src/renderer/Reconciler.tsx +2 -1
- package/src/skia/NativeSetup.ts +2 -1
- package/src/specs/NativeSkiaModule.ts +9 -0
- package/src/specs/NativeSkiaModule.web.ts +4 -0
- package/src/specs/SkiaDomViewNativeComponent.ts +10 -0
- package/src/specs/SkiaDrawViewNativeComponent.ts +10 -0
- package/src/specs/SkiaPictureViewNativeComponent.ts +10 -0
- package/src/views/SkiaDomView.tsx +3 -2
- package/src/views/SkiaPictureView.tsx +4 -5
- package/src/views/SkiaView.tsx +4 -5
- /package/cpp/rnskia/dom/props/{ImageProps.h → SkImageProps.h} +0 -0
@@ -0,0 +1,72 @@
|
|
1
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
2
|
+
#import <SkiaDrawView.h>
|
3
|
+
|
4
|
+
#import <RNSkDomView.h>
|
5
|
+
#import <RNSkIOSView.h>
|
6
|
+
#import <RNSkPlatformContext.h>
|
7
|
+
|
8
|
+
#import <RNSkJsView.h>
|
9
|
+
#import <SkiaUIView.h>
|
10
|
+
|
11
|
+
#import <React/RCTBridge+Private.h>
|
12
|
+
#import <React/RCTConversions.h>
|
13
|
+
#import <React/RCTFabricComponentsPlugins.h>
|
14
|
+
|
15
|
+
#import <react/renderer/components/rnskia/ComponentDescriptors.h>
|
16
|
+
#import <react/renderer/components/rnskia/EventEmitters.h>
|
17
|
+
#import <react/renderer/components/rnskia/Props.h>
|
18
|
+
#import <react/renderer/components/rnskia/RCTComponentViewHelpers.h>
|
19
|
+
|
20
|
+
using namespace facebook::react;
|
21
|
+
|
22
|
+
@implementation SkiaDrawView
|
23
|
+
|
24
|
+
- (instancetype)initWithFrame:(CGRect)frame {
|
25
|
+
if (self = [super initWithFrame:frame]) {
|
26
|
+
[self prepareView];
|
27
|
+
static const auto defaultProps =
|
28
|
+
std::make_shared<const SkiaDrawViewProps>();
|
29
|
+
_props = defaultProps;
|
30
|
+
}
|
31
|
+
return self;
|
32
|
+
}
|
33
|
+
|
34
|
+
- (void)prepareView {
|
35
|
+
auto skManager = [[self skiaManager] skManager];
|
36
|
+
// Pass SkManager as a raw pointer to avoid circular dependenciesr
|
37
|
+
[self initCommon:skManager.get()
|
38
|
+
factory:[](std::shared_ptr<RNSkia::RNSkPlatformContext> context) {
|
39
|
+
return std::make_shared<RNSkiOSView<RNSkia::RNSkJsView>>(context);
|
40
|
+
}];
|
41
|
+
}
|
42
|
+
|
43
|
+
- (void)prepareForRecycle {
|
44
|
+
[super prepareForRecycle];
|
45
|
+
[self prepareView];
|
46
|
+
}
|
47
|
+
|
48
|
+
#pragma mark - RCTComponentViewProtocol
|
49
|
+
|
50
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider {
|
51
|
+
return concreteComponentDescriptorProvider<SkiaDrawViewComponentDescriptor>();
|
52
|
+
}
|
53
|
+
|
54
|
+
- (void)updateProps:(const Props::Shared &)props
|
55
|
+
oldProps:(const Props::Shared &)oldProps {
|
56
|
+
const auto &newProps =
|
57
|
+
*std::static_pointer_cast<const SkiaDrawViewProps>(props);
|
58
|
+
[super updateProps:props oldProps:oldProps];
|
59
|
+
int nativeId =
|
60
|
+
[[RCTConvert NSString:RCTNSStringFromString(newProps.nativeId)] intValue];
|
61
|
+
[self setNativeId:nativeId];
|
62
|
+
[self setDrawingMode:newProps.mode];
|
63
|
+
[self setDebugMode:newProps.debug];
|
64
|
+
}
|
65
|
+
|
66
|
+
@end
|
67
|
+
|
68
|
+
Class<RCTComponentViewProtocol> SkiaDrawViewCls(void) {
|
69
|
+
return SkiaDrawView.class;
|
70
|
+
}
|
71
|
+
|
72
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
@@ -15,7 +15,7 @@ RCT_EXPORT_MODULE(SkiaDrawView)
|
|
15
15
|
|
16
16
|
- (SkiaManager *)skiaManager {
|
17
17
|
auto bridge = [RCTBridge currentBridge];
|
18
|
-
auto skiaModule = (RNSkiaModule *)[bridge moduleForName:@"
|
18
|
+
auto skiaModule = (RNSkiaModule *)[bridge moduleForName:@"RNSkiaModule"];
|
19
19
|
return [skiaModule manager];
|
20
20
|
}
|
21
21
|
|
@@ -0,0 +1,66 @@
|
|
1
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
2
|
+
#import <SkiaPictureView.h>
|
3
|
+
|
4
|
+
#import <RNSkIOSView.h>
|
5
|
+
#import <RNSkPictureView.h>
|
6
|
+
#import <RNSkPlatformContext.h>
|
7
|
+
|
8
|
+
#import <RNSkiaModule.h>
|
9
|
+
#import <SkiaManager.h>
|
10
|
+
#import <SkiaUIView.h>
|
11
|
+
|
12
|
+
#import <React/RCTBridge+Private.h>
|
13
|
+
#import <React/RCTConversions.h>
|
14
|
+
#import <React/RCTFabricComponentsPlugins.h>
|
15
|
+
|
16
|
+
#import <react/renderer/components/rnskia/ComponentDescriptors.h>
|
17
|
+
#import <react/renderer/components/rnskia/EventEmitters.h>
|
18
|
+
#import <react/renderer/components/rnskia/Props.h>
|
19
|
+
#import <react/renderer/components/rnskia/RCTComponentViewHelpers.h>
|
20
|
+
|
21
|
+
using namespace facebook::react;
|
22
|
+
|
23
|
+
@implementation SkiaPictureView
|
24
|
+
|
25
|
+
- (instancetype)initWithFrame:(CGRect)frame {
|
26
|
+
if (self = [super initWithFrame:frame]) {
|
27
|
+
auto skManager = [[self skiaManager] skManager];
|
28
|
+
// Pass SkManager as a raw pointer to avoid circular dependenciesr
|
29
|
+
[self initCommon:skManager.get()
|
30
|
+
factory:[](std::shared_ptr<RNSkia::RNSkPlatformContext> context) {
|
31
|
+
return std::make_shared<RNSkiOSView<RNSkia::RNSkPictureView>>(
|
32
|
+
context);
|
33
|
+
}];
|
34
|
+
static const auto defaultProps =
|
35
|
+
std::make_shared<const SkiaPictureViewProps>();
|
36
|
+
_props = defaultProps;
|
37
|
+
}
|
38
|
+
return self;
|
39
|
+
}
|
40
|
+
|
41
|
+
#pragma mark - RCTComponentViewProtocol
|
42
|
+
|
43
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider {
|
44
|
+
return concreteComponentDescriptorProvider<
|
45
|
+
SkiaPictureViewComponentDescriptor>();
|
46
|
+
}
|
47
|
+
|
48
|
+
- (void)updateProps:(const Props::Shared &)props
|
49
|
+
oldProps:(const Props::Shared &)oldProps {
|
50
|
+
const auto &newProps =
|
51
|
+
*std::static_pointer_cast<const SkiaPictureViewProps>(props);
|
52
|
+
[super updateProps:props oldProps:oldProps];
|
53
|
+
int nativeId =
|
54
|
+
[[RCTConvert NSString:RCTNSStringFromString(newProps.nativeId)] intValue];
|
55
|
+
[self setNativeId:nativeId];
|
56
|
+
[self setDrawingMode:newProps.mode];
|
57
|
+
[self setDebugMode:newProps.debug];
|
58
|
+
}
|
59
|
+
|
60
|
+
@end
|
61
|
+
|
62
|
+
Class<RCTComponentViewProtocol> SkiaPictureViewCls(void) {
|
63
|
+
return SkiaPictureView.class;
|
64
|
+
}
|
65
|
+
|
66
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
@@ -16,7 +16,7 @@ RCT_EXPORT_MODULE(SkiaPictureView)
|
|
16
16
|
|
17
17
|
- (SkiaManager *)skiaManager {
|
18
18
|
auto bridge = [RCTBridge currentBridge];
|
19
|
-
auto skiaModule = (RNSkiaModule *)[bridge moduleForName:@"
|
19
|
+
auto skiaModule = (RNSkiaModule *)[bridge moduleForName:@"RNSkiaModule"];
|
20
20
|
return [skiaModule manager];
|
21
21
|
}
|
22
22
|
|
@@ -8,17 +8,30 @@
|
|
8
8
|
|
9
9
|
#import <RNSkManager.h>
|
10
10
|
#import <RNSkiOSView.h>
|
11
|
+
#import <SkiaManager.h>
|
12
|
+
|
13
|
+
#if RCT_NEW_ARCH_ENABLED
|
14
|
+
#import <React/RCTViewComponentView.h>
|
15
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
11
16
|
|
12
17
|
class RNSkiOSJsView;
|
13
18
|
|
14
|
-
@interface SkiaUIView :
|
19
|
+
@interface SkiaUIView :
|
20
|
+
#if RCT_NEW_ARCH_ENABLED
|
21
|
+
RCTViewComponentView
|
22
|
+
#else
|
23
|
+
UIView
|
24
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
15
25
|
|
16
26
|
- (instancetype)
|
17
27
|
initWithManager:(RNSkia::RNSkManager *)manager
|
18
28
|
factory:(std::function<std::shared_ptr<RNSkBaseiOSView>(
|
19
29
|
std::shared_ptr<RNSkia::RNSkPlatformContext>)>)factory;
|
20
|
-
|
30
|
+
- (void)initCommon:(RNSkia::RNSkManager *)manager
|
31
|
+
factory:(std::function<std::shared_ptr<RNSkBaseiOSView>(
|
32
|
+
std::shared_ptr<RNSkia::RNSkPlatformContext>)>)factory;
|
21
33
|
- (std::shared_ptr<RNSkBaseiOSView>)impl;
|
34
|
+
- (SkiaManager *)skiaManager;
|
22
35
|
|
23
36
|
- (void)setDrawingMode:(std::string)mode;
|
24
37
|
- (void)setDebugMode:(bool)debugMode;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
#import <React/RCTBridge.h>
|
2
2
|
|
3
3
|
#import "SkiaUIView.h"
|
4
|
+
#import <RNSkiaModule.h>
|
4
5
|
|
5
6
|
#include <utility>
|
6
7
|
#include <vector>
|
@@ -27,22 +28,33 @@
|
|
27
28
|
factory {
|
28
29
|
self = [super init];
|
29
30
|
if (self) {
|
30
|
-
|
31
|
-
_nativeId = 0;
|
32
|
-
_debugMode = false;
|
33
|
-
_drawingMode = RNSkia::RNSkDrawingMode::Default;
|
34
|
-
_factory = factory;
|
35
|
-
|
36
|
-
// Listen to notifications about module invalidation
|
37
|
-
[[NSNotificationCenter defaultCenter]
|
38
|
-
addObserver:self
|
39
|
-
selector:@selector(willInvalidateModules)
|
40
|
-
name:RCTBridgeWillInvalidateModulesNotification
|
41
|
-
object:nil];
|
31
|
+
[self initCommon:manager factory:factory];
|
42
32
|
}
|
33
|
+
// Listen to notifications about module invalidation
|
34
|
+
[[NSNotificationCenter defaultCenter]
|
35
|
+
addObserver:self
|
36
|
+
selector:@selector(willInvalidateModules)
|
37
|
+
name:RCTBridgeWillInvalidateModulesNotification
|
38
|
+
object:nil];
|
43
39
|
return self;
|
44
40
|
}
|
45
41
|
|
42
|
+
- (void)initCommon:(RNSkia::RNSkManager *)manager
|
43
|
+
factory:(std::function<std::shared_ptr<RNSkBaseiOSView>(
|
44
|
+
std::shared_ptr<RNSkia::RNSkPlatformContext>)>)factory {
|
45
|
+
_manager = manager;
|
46
|
+
_nativeId = 0;
|
47
|
+
_debugMode = false;
|
48
|
+
_drawingMode = RNSkia::RNSkDrawingMode::Default;
|
49
|
+
_factory = factory;
|
50
|
+
}
|
51
|
+
|
52
|
+
- (SkiaManager *)skiaManager {
|
53
|
+
auto bridge = [RCTBridge currentBridge];
|
54
|
+
auto skiaModule = (RNSkiaModule *)[bridge moduleForName:@"RNSkiaModule"];
|
55
|
+
return [skiaModule manager];
|
56
|
+
}
|
57
|
+
|
46
58
|
- (void)willInvalidateModules {
|
47
59
|
_impl = nullptr;
|
48
60
|
_manager = nullptr;
|
@@ -81,14 +93,34 @@
|
|
81
93
|
}
|
82
94
|
|
83
95
|
- (void)dealloc {
|
84
|
-
|
85
|
-
_manager->unregisterSkiaView(_nativeId);
|
86
|
-
}
|
87
|
-
|
96
|
+
[self unregisterView];
|
88
97
|
[[NSNotificationCenter defaultCenter]
|
89
98
|
removeObserver:self
|
90
99
|
name:RCTBridgeWillInvalidateModulesNotification
|
91
100
|
object:nil];
|
101
|
+
}
|
102
|
+
|
103
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
104
|
+
- (void)prepareForRecycle {
|
105
|
+
[super prepareForRecycle];
|
106
|
+
[self unregisterView];
|
107
|
+
}
|
108
|
+
|
109
|
+
- (void)finalizeUpdates:(RNComponentViewUpdateMask)updateMask {
|
110
|
+
[super finalizeUpdates:updateMask];
|
111
|
+
if (updateMask == RNComponentViewUpdateMaskAll) {
|
112
|
+
// this flag is only set when the view is inserted and we want to set the
|
113
|
+
// manager here since the view could be recycled or the app could be
|
114
|
+
// refreshed and we would have a stale manager then
|
115
|
+
_manager = [[self skiaManager] skManager].get();
|
116
|
+
}
|
117
|
+
}
|
118
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
119
|
+
|
120
|
+
- (void)unregisterView {
|
121
|
+
if (_manager != nullptr && _nativeId != 0) {
|
122
|
+
_manager->unregisterSkiaView(_nativeId);
|
123
|
+
}
|
92
124
|
|
93
125
|
assert(_impl == nullptr);
|
94
126
|
}
|
package/ios/RNSkiaModule.h
CHANGED
@@ -1,10 +1,19 @@
|
|
1
1
|
#pragma once
|
2
2
|
|
3
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
4
|
+
#import <rnskia/rnskia.h>
|
5
|
+
#else
|
3
6
|
#import <React/RCTBridgeModule.h>
|
7
|
+
#endif
|
4
8
|
|
5
9
|
#include "SkiaManager.h"
|
6
10
|
|
7
|
-
@interface RNSkiaModule : NSObject
|
11
|
+
@interface RNSkiaModule : NSObject
|
12
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
13
|
+
<NativeSkiaModuleSpec>
|
14
|
+
#else
|
15
|
+
<RCTBridgeModule>
|
16
|
+
#endif
|
8
17
|
|
9
18
|
- (SkiaManager *)manager;
|
10
19
|
|
package/ios/RNSkiaModule.mm
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
SkiaManager *skiaManager;
|
7
7
|
}
|
8
8
|
|
9
|
-
RCT_EXPORT_MODULE(
|
9
|
+
RCT_EXPORT_MODULE()
|
10
10
|
|
11
11
|
#pragma Accessors
|
12
12
|
|
@@ -37,4 +37,11 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install) {
|
|
37
37
|
return @true;
|
38
38
|
}
|
39
39
|
|
40
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
41
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
42
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params {
|
43
|
+
return std::make_shared<facebook::react::NativeSkiaModuleSpecJSI>(params);
|
44
|
+
}
|
45
|
+
#endif
|
46
|
+
|
40
47
|
@end
|
@@ -1,11 +1,9 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
import type {
|
2
|
+
import type { NodeHandle, ViewComponent } from "react-native";
|
3
3
|
import type { DataModule } from "../skia/types";
|
4
4
|
export interface IPlatform {
|
5
5
|
OS: string;
|
6
|
-
requireNativeComponent: <T>(viewName: string) => HostComponent<T>;
|
7
6
|
PixelRatio: number;
|
8
|
-
NativeModules: Record<string, any>;
|
9
7
|
findNodeHandle: (componentOrHandle: null | number | React.Component<any, any> | React.ComponentClass<any>) => null | NodeHandle;
|
10
8
|
resolveAsset: (source: DataModule) => string;
|
11
9
|
View: typeof ViewComponent;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":[],"sources":["IPlatform.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type {
|
1
|
+
{"version":3,"names":[],"sources":["IPlatform.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { NodeHandle, ViewComponent } from \"react-native\";\n\nimport type { DataModule } from \"../skia/types\";\n\nexport interface IPlatform {\n OS: string;\n PixelRatio: number;\n findNodeHandle: (\n componentOrHandle:\n | null\n | number\n | React.Component<any, any>\n | React.ComponentClass<any>\n ) => null | NodeHandle;\n resolveAsset: (source: DataModule) => string;\n View: typeof ViewComponent;\n}\n"],"mappings":""}
|
@@ -12,12 +12,10 @@ var _types = require("../skia/types");
|
|
12
12
|
const Platform = {
|
13
13
|
OS: _reactNative.Platform.OS,
|
14
14
|
PixelRatio: _reactNative.PixelRatio.get(),
|
15
|
-
requireNativeComponent: _reactNative.requireNativeComponent,
|
16
15
|
resolveAsset: source => {
|
17
16
|
return (0, _types.isRNModule)(source) ? _reactNative.Image.resolveAssetSource(source).uri : source.default;
|
18
17
|
},
|
19
18
|
findNodeHandle: _reactNative.findNodeHandle,
|
20
|
-
NativeModules: _reactNative.NativeModules,
|
21
19
|
View: _reactNative.View
|
22
20
|
};
|
23
21
|
exports.Platform = Platform;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["Platform","OS","RNPlatform","PixelRatio","get","
|
1
|
+
{"version":3,"names":["Platform","OS","RNPlatform","PixelRatio","get","resolveAsset","source","isRNModule","Image","resolveAssetSource","uri","default","findNodeHandle","View"],"sources":["Platform.ts"],"sourcesContent":["import {\n Image,\n PixelRatio,\n Platform as RNPlatform,\n findNodeHandle,\n View,\n} from \"react-native\";\n\nimport type { DataModule } from \"../skia/types\";\nimport { isRNModule } from \"../skia/types\";\n\nimport type { IPlatform } from \"./IPlatform\";\n\nexport const Platform: IPlatform = {\n OS: RNPlatform.OS,\n PixelRatio: PixelRatio.get(),\n resolveAsset: (source: DataModule) => {\n return isRNModule(source)\n ? Image.resolveAssetSource(source).uri\n : source.default;\n },\n findNodeHandle,\n View,\n};\n"],"mappings":";;;;;;;AAAA;;AASA;;AAIO,MAAMA,QAAmB,GAAG;EACjCC,EAAE,EAAEC,qBAAA,CAAWD,EADkB;EAEjCE,UAAU,EAAEA,uBAAA,CAAWC,GAAX,EAFqB;EAGjCC,YAAY,EAAGC,MAAD,IAAwB;IACpC,OAAO,IAAAC,iBAAA,EAAWD,MAAX,IACHE,kBAAA,CAAMC,kBAAN,CAAyBH,MAAzB,EAAiCI,GAD9B,GAEHJ,MAAM,CAACK,OAFX;EAGD,CAPgC;EAQjCC,cAAc,EAAdA,2BARiC;EASjCC,IAAI,EAAJA;AATiC,CAA5B"}
|
@@ -137,9 +137,6 @@ const View = _ref => {
|
|
137
137
|
const Platform = {
|
138
138
|
OS: "web",
|
139
139
|
PixelRatio: window.devicePixelRatio,
|
140
|
-
requireNativeComponent: () => {
|
141
|
-
throw new Error("requireNativeComponent is not supported on the web");
|
142
|
-
},
|
143
140
|
resolveAsset: source => {
|
144
141
|
if ((0, _types.isRNModule)(source)) {
|
145
142
|
throw new Error("Image source is a number - this is not supported on the web");
|
@@ -150,7 +147,6 @@ const Platform = {
|
|
150
147
|
findNodeHandle: () => {
|
151
148
|
throw new Error("findNodeHandle is not supported on the web");
|
152
149
|
},
|
153
|
-
NativeModules: {},
|
154
150
|
View
|
155
151
|
};
|
156
152
|
exports.Platform = Platform;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["DOM_LAYOUT_HANDLER_NAME","resizeObserver","getObserver","window","ResizeObserver","entries","forEach","entry","node","target","left","top","width","height","contentRect","onLayout","setTimeout","timeStamp","Date","now","nativeEvent","layout","x","y","currentTarget","bubbles","cancelable","defaultPrevented","eventPhase","isDefaultPrevented","Error","isPropagationStopped","persist","preventDefault","stopPropagation","isTrusted","type","useElementLayout","ref","observer","useLayoutEffect","current","observe","unobserve","View","children","style","rawStyle","useMemo","useRef","cssStyles","display","flexDirection","flexWrap","justifyContent","alignItems","alignContent","Platform","OS","PixelRatio","devicePixelRatio","
|
1
|
+
{"version":3,"names":["DOM_LAYOUT_HANDLER_NAME","resizeObserver","getObserver","window","ResizeObserver","entries","forEach","entry","node","target","left","top","width","height","contentRect","onLayout","setTimeout","timeStamp","Date","now","nativeEvent","layout","x","y","currentTarget","bubbles","cancelable","defaultPrevented","eventPhase","isDefaultPrevented","Error","isPropagationStopped","persist","preventDefault","stopPropagation","isTrusted","type","useElementLayout","ref","observer","useLayoutEffect","current","observe","unobserve","View","children","style","rawStyle","useMemo","useRef","cssStyles","display","flexDirection","flexWrap","justifyContent","alignItems","alignContent","Platform","OS","PixelRatio","devicePixelRatio","resolveAsset","source","isRNModule","default","findNodeHandle"],"sources":["Platform.web.tsx"],"sourcesContent":["import type { RefObject, CSSProperties } from \"react\";\nimport React, { useLayoutEffect, useMemo, useRef } from \"react\";\nimport type { LayoutChangeEvent, ViewComponent, ViewProps } from \"react-native\";\n\nimport type { DataModule } from \"../skia/types\";\nimport { isRNModule } from \"../skia/types\";\n\nimport type { IPlatform } from \"./IPlatform\";\n\n// eslint-disable-next-line max-len\n// https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/modules/useElementLayout/index.js\nconst DOM_LAYOUT_HANDLER_NAME = \"__reactLayoutHandler\";\ntype OnLayout = ((event: LayoutChangeEvent) => void) | undefined;\ntype Div = HTMLDivElement & {\n __reactLayoutHandler: OnLayout;\n};\n\nlet resizeObserver: ResizeObserver | null = null;\n\nconst getObserver = () => {\n if (resizeObserver == null) {\n resizeObserver = new window.ResizeObserver(function (entries) {\n entries.forEach((entry) => {\n const node = entry.target as Div;\n const { left, top, width, height } = entry.contentRect;\n const onLayout = node[DOM_LAYOUT_HANDLER_NAME];\n if (typeof onLayout === \"function\") {\n // setTimeout 0 is taken from react-native-web (UIManager)\n setTimeout(\n () =>\n onLayout({\n timeStamp: Date.now(),\n nativeEvent: { layout: { x: left, y: top, width, height } },\n currentTarget: 0,\n target: 0,\n bubbles: false,\n cancelable: false,\n defaultPrevented: false,\n eventPhase: 0,\n isDefaultPrevented() {\n throw new Error(\"Method not supported on web.\");\n },\n isPropagationStopped() {\n throw new Error(\"Method not supported on web.\");\n },\n persist() {\n throw new Error(\"Method not supported on web.\");\n },\n preventDefault() {\n throw new Error(\"Method not supported on web.\");\n },\n stopPropagation() {\n throw new Error(\"Method not supported on web.\");\n },\n isTrusted: true,\n type: \"\",\n }),\n 0\n );\n }\n });\n });\n }\n return resizeObserver;\n};\n\nconst useElementLayout = (ref: RefObject<Div>, onLayout: OnLayout) => {\n const observer = getObserver();\n\n useLayoutEffect(() => {\n const node = ref.current;\n if (node !== null) {\n node[DOM_LAYOUT_HANDLER_NAME] = onLayout;\n }\n }, [ref, onLayout]);\n\n useLayoutEffect(() => {\n const node = ref.current;\n if (node != null && observer != null) {\n if (typeof node[DOM_LAYOUT_HANDLER_NAME] === \"function\") {\n observer.observe(node);\n } else {\n observer.unobserve(node);\n }\n }\n return () => {\n if (node != null && observer != null) {\n observer.unobserve(node);\n }\n };\n }, [observer, ref]);\n};\n\nconst View = (({ children, onLayout, style: rawStyle }: ViewProps) => {\n const style = useMemo(() => (rawStyle ?? {}) as CSSProperties, [rawStyle]);\n const ref = useRef<Div>(null);\n useElementLayout(ref, onLayout);\n const cssStyles = useMemo(() => {\n return {\n ...style,\n display: \"flex\",\n flexDirection: style.flexDirection || \"inherit\",\n flexWrap: style.flexWrap || \"nowrap\",\n justifyContent: style.justifyContent || \"flex-start\",\n alignItems: style.alignItems || \"stretch\",\n alignContent: style.alignContent || \"stretch\",\n };\n }, [style]);\n\n return (\n <div ref={ref} style={cssStyles}>\n {children}\n </div>\n );\n}) as unknown as typeof ViewComponent;\n\nexport const Platform: IPlatform = {\n OS: \"web\",\n PixelRatio: window.devicePixelRatio,\n resolveAsset: (source: DataModule) => {\n if (isRNModule(source)) {\n throw new Error(\n \"Image source is a number - this is not supported on the web\"\n );\n }\n return source.default;\n },\n findNodeHandle: () => {\n throw new Error(\"findNodeHandle is not supported on the web\");\n },\n View,\n};\n"],"mappings":";;;;;;;AACA;;AAIA;;;;;;AAIA;AACA;AACA,MAAMA,uBAAuB,GAAG,sBAAhC;AAMA,IAAIC,cAAqC,GAAG,IAA5C;;AAEA,MAAMC,WAAW,GAAG,MAAM;EACxB,IAAID,cAAc,IAAI,IAAtB,EAA4B;IAC1BA,cAAc,GAAG,IAAIE,MAAM,CAACC,cAAX,CAA0B,UAAUC,OAAV,EAAmB;MAC5DA,OAAO,CAACC,OAAR,CAAiBC,KAAD,IAAW;QACzB,MAAMC,IAAI,GAAGD,KAAK,CAACE,MAAnB;QACA,MAAM;UAAEC,IAAF;UAAQC,GAAR;UAAaC,KAAb;UAAoBC;QAApB,IAA+BN,KAAK,CAACO,WAA3C;QACA,MAAMC,QAAQ,GAAGP,IAAI,CAACR,uBAAD,CAArB;;QACA,IAAI,OAAOe,QAAP,KAAoB,UAAxB,EAAoC;UAClC;UACAC,UAAU,CACR,MACED,QAAQ,CAAC;YACPE,SAAS,EAAEC,IAAI,CAACC,GAAL,EADJ;YAEPC,WAAW,EAAE;cAAEC,MAAM,EAAE;gBAAEC,CAAC,EAAEZ,IAAL;gBAAWa,CAAC,EAAEZ,GAAd;gBAAmBC,KAAnB;gBAA0BC;cAA1B;YAAV,CAFN;Y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EAAE,EAAE,KAD6B;EAEjCC,UAAU,EAAExD,MAAM,CAACyD,gBAFc;EAGjCC,YAAY,EAAGC,MAAD,IAAwB;IACpC,IAAI,IAAAC,iBAAA,EAAWD,MAAX,CAAJ,EAAwB;MACtB,MAAM,IAAIhC,KAAJ,CACJ,6DADI,CAAN;IAGD;;IACD,OAAOgC,MAAM,CAACE,OAAd;EACD,CAVgC;EAWjCC,cAAc,EAAE,MAAM;IACpB,MAAM,IAAInC,KAAJ,CAAU,4CAAV,CAAN;EACD,CAbgC;EAcjCc;AAdiC,CAA5B"}
|
@@ -11,7 +11,7 @@ interface RequiredExtrapolationConfig {
|
|
11
11
|
extrapolateLeft: Extrapolate;
|
12
12
|
extrapolateRight: Extrapolate;
|
13
13
|
}
|
14
|
-
export
|
14
|
+
export type ExtrapolationType = ExtrapolationConfig | Extrapolate | string | undefined;
|
15
15
|
export declare function validateInterpolationOptions(type: ExtrapolationType): RequiredExtrapolationConfig;
|
16
16
|
export declare function interpolate(x: number, input: readonly number[], output: readonly number[], type?: ExtrapolationType): number;
|
17
17
|
export {};
|
@@ -14,5 +14,5 @@ export interface AnimationParams {
|
|
14
14
|
loop?: boolean;
|
15
15
|
yoyo?: boolean;
|
16
16
|
}
|
17
|
-
export
|
18
|
-
export
|
17
|
+
export type RequiredAnimationParams = Required<Omit<AnimationParams, "from">> & Pick<AnimationParams, "from">;
|
18
|
+
export type AnimationCallback = (current: number) => void;
|
@@ -22,7 +22,7 @@ export declare abstract class JsiNode<P> implements Node<P> {
|
|
22
22
|
removeChild(child: Node<unknown>): void;
|
23
23
|
insertChildBefore(child: Node<unknown>, before: Node<unknown>): void;
|
24
24
|
}
|
25
|
-
export
|
25
|
+
export type Invalidate = () => void;
|
26
26
|
export declare abstract class JsiDeclarationNode<P> extends JsiNode<P> implements DeclarationNode<P> {
|
27
27
|
declarationType: DeclarationType;
|
28
28
|
private invalidate;
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import type { ReactNode } from "react";
|
2
2
|
import type { BlendMode, Color, PaintStyle, SkMatrix, SkPaint, SkPath, SkRect, SkRRect, StrokeCap, StrokeJoin, Transforms2d, Vector } from "../../skia/types";
|
3
|
-
export
|
4
|
-
export
|
5
|
-
export
|
6
|
-
export
|
7
|
-
export
|
3
|
+
export type SkEnum<T> = Uncapitalize<keyof T extends string ? keyof T : never>;
|
4
|
+
export type PathDef = string | SkPath;
|
5
|
+
export type ClipDef = SkRRect | SkRect | PathDef;
|
6
|
+
export type Fit = "cover" | "contain" | "fill" | "fitHeight" | "fitWidth" | "none" | "scaleDown";
|
7
|
+
export type Radius = number | Vector;
|
8
8
|
export interface ChildrenProps {
|
9
9
|
children?: ReactNode | ReactNode[];
|
10
10
|
}
|
@@ -17,10 +17,10 @@ export interface RectCtor {
|
|
17
17
|
export interface RRectCtor extends RectCtor {
|
18
18
|
r?: Radius;
|
19
19
|
}
|
20
|
-
export
|
20
|
+
export type RectDef = RectCtor | {
|
21
21
|
rect: SkRect;
|
22
22
|
};
|
23
|
-
export
|
23
|
+
export type RRectDef = RRectCtor | {
|
24
24
|
rect: SkRRect;
|
25
25
|
};
|
26
26
|
export interface PointCircleDef {
|
@@ -32,7 +32,7 @@ export interface ScalarCircleDef {
|
|
32
32
|
cy: number;
|
33
33
|
r: number;
|
34
34
|
}
|
35
|
-
export
|
35
|
+
export type CircleDef = PointCircleDef | ScalarCircleDef;
|
36
36
|
export interface TransformProps {
|
37
37
|
transform?: Transforms2d;
|
38
38
|
origin?: Vector;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { SkShader, SkPaint, SkImageFilter, SkMaskFilter, SkPathEffect, Skia, SkColorFilter } from "../../skia/types";
|
2
|
-
|
2
|
+
type Composer<T> = (outer: T, inner: T) => T;
|
3
3
|
export declare const composeDeclarations: <T>(filters: T[], composer: Composer<T>) => T;
|
4
4
|
declare class Declaration<T> {
|
5
5
|
private composer?;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["JsiDrawingContext","constructor","Skia","canvas","paint","Paint","paints","declarationCtx","DeclarationContext","length","save","childPaint","copy","push","restore","pop","saveAndConcat","node","cache","ConcatablePaint","isPristine","concatTo","declCtx","props","getProps","children","setColor","color","undefined","Color","setStrokeWidth","strokeWidth","setBlendMode","blendMode","setStyle","style","setStrokeJoin","strokeJoin","setStrokeCap","strokeCap","setStrokeMiter","strokeMiter","setOpacity","opacity","setAntiAlias","antiAlias","setDither","dither","forEach","child","JsiDeclarationNode","decorate","colorFilter","colorFilters","popAllAsOne","imageFilter","imageFilters","shader","shaders","maskFilter","maskFilters","pathEffect","pathEffects","setImageFilter","setShader","setPathEffect","setColorFilter","setMaskFilter","enum","value","key","enumKey","setValue","pristine","getColor","_color","getStrokeWidth","_strokeWidth","BlendMode","getBlendMode","_blendMode","PaintStyle","getStyle","_style","StrokeJoin","getStrokeJoin","_strokeJoin","StrokeCap","getStrokeCap","_strokeCap","getStrokeMiter","_strokeMiter","getOpacity","_opacity","getAntiAlias","_antiAlias","getDither","_dither","getImageFilter","_imageFilter","getShader","_shader","getPathEffect","_pathEffect","getColorFilter","_colorFilter","getMaskFilter","_maskFilter","setAlphaf","getAlphaf","currentOpacity"],"sources":["DrawingContext.ts"],"sourcesContent":["import type {\n SkCanvas,\n SkColor,\n SkColorFilter,\n SkImageFilter,\n SkMaskFilter,\n SkPaint,\n SkPathEffect,\n SkShader,\n Skia,\n} from \"../../skia/types\";\nimport { BlendMode, PaintStyle, StrokeCap, StrokeJoin } from \"../../skia/types\";\nimport { enumKey } from \"../nodes/datatypes/Enum\";\nimport { JsiDeclarationNode } from \"../nodes/Node\";\n\nimport type { PaintProps, SkEnum } from \"./Common\";\nimport { DeclarationContext } from \"./DeclarationContext\";\nimport type { Node } from \"./Node\";\n\nexport interface DrawingContext {\n canvas: SkCanvas;\n paint: SkPaint;\n saveAndConcat(node: Node<PaintProps>, cache?: SkPaint): boolean;\n restore(): void;\n declarationCtx: DeclarationContext;\n}\n\nexport class JsiDrawingContext implements DrawingContext {\n paints: SkPaint[];\n\n declarationCtx: DeclarationContext;\n\n constructor(private readonly Skia: Skia, public readonly canvas: SkCanvas) {\n const paint = this.Skia.Paint();\n this.paints = [paint];\n this.declarationCtx = new DeclarationContext(Skia);\n }\n\n get paint() {\n return this.paints[this.paints.length - 1];\n }\n\n private save() {\n const childPaint = this.paint.copy();\n this.paints.push(childPaint);\n }\n\n restore(): void {\n this.paints.pop();\n }\n\n saveAndConcat(node: Node<PaintProps>, cache?: SkPaint) {\n if (cache) {\n this.paints.push(cache);\n return true;\n }\n const paint = new ConcatablePaint(this.Skia, this.declarationCtx, node);\n if (!paint.isPristine()) {\n this.save();\n paint.concatTo(this.paint);\n return true;\n }\n return false;\n }\n}\n\nclass ConcatablePaint {\n private pristine = true;\n\n _color?: SkColor;\n _strokeWidth?: number;\n _blendMode?: BlendMode;\n _style?: PaintStyle;\n _strokeJoin?: StrokeJoin;\n _strokeCap?: StrokeCap;\n _strokeMiter?: number;\n _opacity = 1;\n _antiAlias?: boolean;\n _dither?: boolean;\n\n _imageFilter?: SkImageFilter;\n _shader?: SkShader;\n _pathEffect?: SkPathEffect;\n _colorFilter?: SkColorFilter;\n _maskFilter?: SkMaskFilter;\n\n constructor(Skia: Skia, declCtx: DeclarationContext, node: Node<PaintProps>) {\n const props = node.getProps();\n const children = node.children();\n this.setColor(\n props.color !== undefined ? Skia.Color(props.color) : props.color\n );\n this.setStrokeWidth(props.strokeWidth);\n this.setBlendMode(props.blendMode);\n this.setStyle(props.style);\n this.setStrokeJoin(props.strokeJoin);\n this.setStrokeCap(props.strokeCap);\n this.setStrokeMiter(props.strokeMiter);\n this.setOpacity(props.opacity);\n this.setAntiAlias(props.antiAlias);\n this.setDither(props.dither);\n declCtx.save();\n children.forEach((child) => {\n if (child instanceof JsiDeclarationNode) {\n child.decorate(declCtx);\n }\n });\n const colorFilter = declCtx.colorFilters.popAllAsOne();\n const imageFilter = declCtx.imageFilters.popAllAsOne();\n const shader = declCtx.shaders.pop();\n const maskFilter = declCtx.maskFilters.pop();\n const pathEffect = declCtx.pathEffects.popAllAsOne();\n declCtx.restore();\n if (imageFilter) {\n this.setImageFilter(imageFilter);\n }\n if (shader) {\n this.setShader(shader);\n }\n if (pathEffect) {\n this.setPathEffect(pathEffect);\n }\n if (colorFilter) {\n this.setColorFilter(colorFilter);\n }\n if (maskFilter) {\n this.setMaskFilter(maskFilter);\n }\n }\n\n private enum<T>(value: T, key?: Uncapitalize<string>) {\n if (key !== undefined) {\n return value[enumKey(key) as keyof T];\n }\n return undefined;\n }\n\n private setValue<T extends keyof typeof this>(\n key: T,\n value?: typeof this[T]\n ) {\n if (value !== undefined) {\n this[key] = value;\n this.pristine = false;\n }\n }\n\n setColor(color?: SkColor) {\n this.setValue(\"_color\", color);\n }\n\n getColor() {\n return this._color;\n }\n\n setStrokeWidth(strokeWidth?: number) {\n this.setValue(\"_strokeWidth\", strokeWidth);\n }\n\n getStrokeWidth() {\n return this._strokeWidth;\n }\n\n setBlendMode(blendMode?: SkEnum<typeof BlendMode>) {\n this.setValue(\"_blendMode\", this.enum(BlendMode, blendMode));\n }\n\n getBlendMode() {\n return this._blendMode;\n }\n\n setStyle(style?: SkEnum<typeof PaintStyle>) {\n this.setValue(\"_style\", this.enum(PaintStyle, style));\n }\n\n getStyle() {\n return this._style;\n }\n\n setStrokeJoin(strokeJoin?: SkEnum<typeof StrokeJoin>) {\n this.setValue(\"_strokeJoin\", this.enum(StrokeJoin, strokeJoin));\n }\n\n getStrokeJoin() {\n return this._strokeJoin;\n }\n\n setStrokeCap(strokeCap?: SkEnum<typeof StrokeCap>) {\n this.setValue(\"_strokeCap\", this.enum(StrokeCap, strokeCap));\n }\n\n getStrokeCap() {\n return this._strokeCap;\n }\n\n setStrokeMiter(strokeMiter?: number) {\n this.setValue(\"_strokeMiter\", strokeMiter);\n }\n\n getStrokeMiter() {\n return this._strokeMiter;\n }\n\n setOpacity(opacity?: number) {\n this.setValue(\"_opacity\", opacity);\n }\n\n getOpacity() {\n return this._opacity;\n }\n\n setAntiAlias(antiAlias?: boolean) {\n this.setValue(\"_antiAlias\", antiAlias);\n }\n\n getAntiAlias() {\n return this._antiAlias;\n }\n\n setDither(dither?: boolean) {\n this.setValue(\"_dither\", dither);\n }\n\n getDither() {\n return this._dither;\n }\n\n setImageFilter(imageFilter?: SkImageFilter) {\n this.setValue(\"_imageFilter\", imageFilter);\n }\n\n getImageFilter() {\n return this._imageFilter;\n }\n\n setShader(shader?: SkShader) {\n this.setValue(\"_shader\", shader);\n }\n\n getShader() {\n return this._shader;\n }\n\n setPathEffect(pathEffect?: SkPathEffect) {\n this.setValue(\"_pathEffect\", pathEffect);\n }\n\n getPathEffect() {\n return this._pathEffect;\n }\n\n setColorFilter(colorFilter?: SkColorFilter) {\n this.setValue(\"_colorFilter\", colorFilter);\n }\n\n getColorFilter() {\n return this._colorFilter;\n }\n\n setMaskFilter(maskFilter?: SkMaskFilter) {\n this.setValue(\"_maskFilter\", maskFilter);\n }\n\n getMaskFilter() {\n return this._maskFilter;\n }\n\n isPristine() {\n return this.pristine;\n }\n\n concatTo(paint: SkPaint) {\n if (this._opacity !== undefined) {\n paint.setAlphaf(paint.getAlphaf() * this._opacity);\n }\n if (this._color !== undefined) {\n const currentOpacity = paint.getAlphaf();\n paint.setShader(null);\n paint.setColor(this._color);\n paint.setAlphaf(currentOpacity * paint.getAlphaf());\n }\n if (this._strokeWidth !== undefined) {\n paint.setStrokeWidth(this._strokeWidth);\n }\n if (this._blendMode !== undefined) {\n paint.setBlendMode(this._blendMode);\n }\n if (this._style !== undefined) {\n paint.setStyle(this._style);\n }\n if (this._strokeJoin !== undefined) {\n paint.setStrokeJoin(this._strokeJoin);\n }\n if (this._strokeCap !== undefined) {\n paint.setStrokeCap(this._strokeCap);\n }\n if (this._strokeMiter !== undefined) {\n paint.setStrokeMiter(this._strokeMiter);\n }\n if (this._antiAlias !== undefined) {\n paint.setAntiAlias(this._antiAlias);\n }\n if (this._dither !== undefined) {\n paint.setDither(this._dither);\n }\n if (this._imageFilter !== undefined) {\n paint.setImageFilter(this._imageFilter);\n }\n if (this._shader !== undefined) {\n paint.setShader(this._shader);\n }\n if (this._pathEffect !== undefined) {\n paint.setPathEffect(this._pathEffect);\n }\n if (this._colorFilter !== undefined) {\n paint.setColorFilter(this._colorFilter);\n }\n if (this._maskFilter !== undefined) {\n paint.setMaskFilter(this._maskFilter);\n }\n }\n}\n"],"mappings":";;;;;;;AAWA;;AACA;;AACA;;AAGA;;;;AAWO,MAAMA,iBAAN,CAAkD;EAKvDC,WAAW,CAAkBC,IAAlB,EAA8CC,MAA9C,EAAgE;IAAA,KAA9CD,IAA8C,GAA9CA,IAA8C;IAAA,KAAlBC,MAAkB,GAAlBA,MAAkB;;IAAA;;IAAA;;IACzE,MAAMC,KAAK,GAAG,KAAKF,IAAL,CAAUG,KAAV,EAAd;IACA,KAAKC,MAAL,GAAc,CAACF,KAAD,CAAd;IACA,KAAKG,cAAL,GAAsB,IAAIC,sCAAJ,CAAuBN,IAAvB,CAAtB;EACD;;EAEQ,IAALE,KAAK,GAAG;IACV,OAAO,KAAKE,MAAL,CAAY,KAAKA,MAAL,CAAYG,MAAZ,GAAqB,CAAjC,CAAP;EACD;;EAEOC,IAAI,GAAG;IACb,MAAMC,UAAU,GAAG,KAAKP,KAAL,CAAWQ,IAAX,EAAnB;IACA,KAAKN,MAAL,CAAYO,IAAZ,CAAiBF,UAAjB;EACD;;EAEDG,OAAO,GAAS;IACd,KAAKR,MAAL,CAAYS,GAAZ;EACD;;EAEDC,aAAa,CAACC,IAAD,EAAyBC,KAAzB,EAA0C;IACrD,IAAIA,KAAJ,EAAW;MACT,KAAKZ,MAAL,CAAYO,IAAZ,CAAiBK,KAAjB;MACA,OAAO,IAAP;IACD;;IACD,MAAMd,KAAK,GAAG,IAAIe,eAAJ,CAAoB,KAAKjB,IAAzB,EAA+B,KAAKK,cAApC,EAAoDU,IAApD,CAAd;;IACA,IAAI,CAACb,KAAK,CAACgB,UAAN,EAAL,EAAyB;MACvB,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AAN,CAAoB,KAAKsC,WAAzB;IACD;;IACD,IAAI,KAAKE,YAAL,KAAsB7E,SAA1B,EAAqC;MACnCxB,KAAK,CAAC8D,cAAN,CAAqB,KAAKuC,YAA1B;IACD;;IACD,IAAI,KAAKE,WAAL,KAAqB/E,SAAzB,EAAoC;MAClCxB,KAAK,CAAC+D,aAAN,CAAoB,KAAKwC,WAAzB;IACD;EACF;;AA9PmB"}
|
1
|
+
{"version":3,"names":["JsiDrawingContext","constructor","Skia","canvas","paint","Paint","paints","declarationCtx","DeclarationContext","length","save","childPaint","copy","push","restore","pop","saveAndConcat","node","cache","ConcatablePaint","isPristine","concatTo","declCtx","props","getProps","children","setColor","color","undefined","Color","setStrokeWidth","strokeWidth","setBlendMode","blendMode","setStyle","style","setStrokeJoin","strokeJoin","setStrokeCap","strokeCap","setStrokeMiter","strokeMiter","setOpacity","opacity","setAntiAlias","antiAlias","setDither","dither","forEach","child","JsiDeclarationNode","decorate","colorFilter","colorFilters","popAllAsOne","imageFilter","imageFilters","shader","shaders","maskFilter","maskFilters","pathEffect","pathEffects","setImageFilter","setShader","setPathEffect","setColorFilter","setMaskFilter","enum","value","key","enumKey","setValue","pristine","getColor","_color","getStrokeWidth","_strokeWidth","BlendMode","getBlendMode","_blendMode","PaintStyle","getStyle","_style","StrokeJoin","getStrokeJoin","_strokeJoin","StrokeCap","getStrokeCap","_strokeCap","getStrokeMiter","_strokeMiter","getOpacity","_opacity","getAntiAlias","_antiAlias","getDither","_dither","getImageFilter","_imageFilter","getShader","_shader","getPathEffect","_pathEffect","getColorFilter","_colorFilter","getMaskFilter","_maskFilter","setAlphaf","getAlphaf","currentOpacity"],"sources":["DrawingContext.ts"],"sourcesContent":["import type {\n SkCanvas,\n SkColor,\n SkColorFilter,\n SkImageFilter,\n SkMaskFilter,\n SkPaint,\n SkPathEffect,\n SkShader,\n Skia,\n} from \"../../skia/types\";\nimport { BlendMode, PaintStyle, StrokeCap, StrokeJoin } from \"../../skia/types\";\nimport { enumKey } from \"../nodes/datatypes/Enum\";\nimport { JsiDeclarationNode } from \"../nodes/Node\";\n\nimport type { PaintProps, SkEnum } from \"./Common\";\nimport { DeclarationContext } from \"./DeclarationContext\";\nimport type { Node } from \"./Node\";\n\nexport interface DrawingContext {\n canvas: SkCanvas;\n paint: SkPaint;\n saveAndConcat(node: Node<PaintProps>, cache?: SkPaint): boolean;\n restore(): void;\n declarationCtx: DeclarationContext;\n}\n\nexport class JsiDrawingContext implements DrawingContext {\n paints: SkPaint[];\n\n declarationCtx: DeclarationContext;\n\n constructor(private readonly Skia: Skia, public readonly canvas: SkCanvas) {\n const paint = this.Skia.Paint();\n this.paints = [paint];\n this.declarationCtx = new DeclarationContext(Skia);\n }\n\n get paint() {\n return this.paints[this.paints.length - 1];\n }\n\n private save() {\n const childPaint = this.paint.copy();\n this.paints.push(childPaint);\n }\n\n restore(): void {\n this.paints.pop();\n }\n\n saveAndConcat(node: Node<PaintProps>, cache?: SkPaint) {\n if (cache) {\n this.paints.push(cache);\n return true;\n }\n const paint = new ConcatablePaint(this.Skia, this.declarationCtx, node);\n if (!paint.isPristine()) {\n this.save();\n paint.concatTo(this.paint);\n return true;\n }\n return false;\n }\n}\n\nclass ConcatablePaint {\n private pristine = true;\n\n _color?: SkColor;\n _strokeWidth?: number;\n _blendMode?: BlendMode;\n _style?: PaintStyle;\n _strokeJoin?: StrokeJoin;\n _strokeCap?: StrokeCap;\n _strokeMiter?: number;\n _opacity = 1;\n _antiAlias?: boolean;\n _dither?: boolean;\n\n _imageFilter?: SkImageFilter;\n _shader?: SkShader;\n _pathEffect?: SkPathEffect;\n _colorFilter?: SkColorFilter;\n _maskFilter?: SkMaskFilter;\n\n constructor(Skia: Skia, declCtx: DeclarationContext, node: Node<PaintProps>) {\n const props = node.getProps();\n const children = node.children();\n this.setColor(\n props.color !== undefined ? Skia.Color(props.color) : props.color\n );\n this.setStrokeWidth(props.strokeWidth);\n this.setBlendMode(props.blendMode);\n this.setStyle(props.style);\n this.setStrokeJoin(props.strokeJoin);\n this.setStrokeCap(props.strokeCap);\n this.setStrokeMiter(props.strokeMiter);\n this.setOpacity(props.opacity);\n this.setAntiAlias(props.antiAlias);\n this.setDither(props.dither);\n declCtx.save();\n children.forEach((child) => {\n if (child instanceof JsiDeclarationNode) {\n child.decorate(declCtx);\n }\n });\n const colorFilter = declCtx.colorFilters.popAllAsOne();\n const imageFilter = declCtx.imageFilters.popAllAsOne();\n const shader = declCtx.shaders.pop();\n const maskFilter = declCtx.maskFilters.pop();\n const pathEffect = declCtx.pathEffects.popAllAsOne();\n declCtx.restore();\n if (imageFilter) {\n this.setImageFilter(imageFilter);\n }\n if (shader) {\n this.setShader(shader);\n }\n if (pathEffect) {\n this.setPathEffect(pathEffect);\n }\n if (colorFilter) {\n this.setColorFilter(colorFilter);\n }\n if (maskFilter) {\n this.setMaskFilter(maskFilter);\n }\n }\n\n private enum<T>(value: T, key?: Uncapitalize<string>) {\n if (key !== undefined) {\n return value[enumKey(key) as keyof T];\n }\n return undefined;\n }\n\n private setValue<T extends keyof typeof this>(\n key: T,\n value?: (typeof this)[T]\n ) {\n if (value !== undefined) {\n this[key] = value;\n this.pristine = false;\n }\n }\n\n setColor(color?: SkColor) {\n this.setValue(\"_color\", color);\n }\n\n getColor() {\n return this._color;\n }\n\n setStrokeWidth(strokeWidth?: number) {\n this.setValue(\"_strokeWidth\", strokeWidth);\n }\n\n getStrokeWidth() {\n return this._strokeWidth;\n }\n\n setBlendMode(blendMode?: SkEnum<typeof BlendMode>) {\n this.setValue(\"_blendMode\", this.enum(BlendMode, blendMode));\n }\n\n getBlendMode() {\n return this._blendMode;\n }\n\n setStyle(style?: SkEnum<typeof PaintStyle>) {\n this.setValue(\"_style\", this.enum(PaintStyle, style));\n }\n\n getStyle() {\n return this._style;\n }\n\n setStrokeJoin(strokeJoin?: SkEnum<typeof StrokeJoin>) {\n this.setValue(\"_strokeJoin\", this.enum(StrokeJoin, strokeJoin));\n }\n\n getStrokeJoin() {\n return this._strokeJoin;\n }\n\n setStrokeCap(strokeCap?: SkEnum<typeof StrokeCap>) {\n this.setValue(\"_strokeCap\", this.enum(StrokeCap, strokeCap));\n }\n\n getStrokeCap() {\n return this._strokeCap;\n }\n\n setStrokeMiter(strokeMiter?: number) {\n this.setValue(\"_strokeMiter\", strokeMiter);\n }\n\n getStrokeMiter() {\n return this._strokeMiter;\n }\n\n setOpacity(opacity?: number) {\n this.setValue(\"_opacity\", opacity);\n }\n\n getOpacity() {\n return this._opacity;\n }\n\n setAntiAlias(antiAlias?: boolean) {\n this.setValue(\"_antiAlias\", antiAlias);\n }\n\n getAntiAlias() {\n return this._antiAlias;\n }\n\n setDither(dither?: boolean) {\n this.setValue(\"_dither\", dither);\n }\n\n getDither() {\n return this._dither;\n }\n\n setImageFilter(imageFilter?: SkImageFilter) {\n this.setValue(\"_imageFilter\", imageFilter);\n }\n\n getImageFilter() {\n return this._imageFilter;\n }\n\n setShader(shader?: SkShader) {\n this.setValue(\"_shader\", shader);\n }\n\n getShader() {\n return this._shader;\n }\n\n setPathEffect(pathEffect?: SkPathEffect) {\n this.setValue(\"_pathEffect\", pathEffect);\n }\n\n getPathEffect() {\n return this._pathEffect;\n }\n\n setColorFilter(colorFilter?: SkColorFilter) {\n this.setValue(\"_colorFilter\", colorFilter);\n }\n\n getColorFilter() {\n return this._colorFilter;\n }\n\n setMaskFilter(maskFilter?: SkMaskFilter) {\n this.setValue(\"_maskFilter\", maskFilter);\n }\n\n getMaskFilter() {\n return this._maskFilter;\n }\n\n isPristine() {\n return this.pristine;\n }\n\n concatTo(paint: SkPaint) {\n if (this._opacity !== undefined) {\n paint.setAlphaf(paint.getAlphaf() * this._opacity);\n }\n if (this._color !== undefined) {\n const currentOpacity = paint.getAlphaf();\n paint.setShader(null);\n paint.setColor(this._color);\n paint.setAlphaf(currentOpacity * paint.getAlphaf());\n }\n if (this._strokeWidth !== undefined) {\n paint.setStrokeWidth(this._strokeWidth);\n }\n if (this._blendMode !== undefined) {\n paint.setBlendMode(this._blendMode);\n }\n if (this._style !== undefined) {\n paint.setStyle(this._style);\n }\n if (this._strokeJoin !== undefined) {\n paint.setStrokeJoin(this._strokeJoin);\n }\n if (this._strokeCap !== undefined) {\n paint.setStrokeCap(this._strokeCap);\n }\n if (this._strokeMiter !== undefined) {\n paint.setStrokeMiter(this._strokeMiter);\n }\n if (this._antiAlias !== undefined) {\n paint.setAntiAlias(this._antiAlias);\n }\n if (this._dither !== undefined) {\n paint.setDither(this._dither);\n }\n if (this._imageFilter !== undefined) {\n paint.setImageFilter(this._imageFilter);\n }\n if (this._shader !== undefined) {\n paint.setShader(this._shader);\n }\n if (this._pathEffect !== undefined) {\n paint.setPathEffect(this._pathEffect);\n }\n if (this._colorFilter !== undefined) {\n paint.setColorFilter(this._colorFilter);\n }\n if (this._maskFilter !== undefined) {\n paint.setMaskFilter(this._maskFilter);\n }\n }\n}\n"],"mappings":";;;;;;;AAWA;;AACA;;AACA;;AAGA;;;;AAWO,MAAMA,iBAAN,CAAkD;EAKvDC,WAAW,CAAkBC,IAAlB,EAA8CC,MAA9C,EAAgE;IAAA,KAA9CD,IAA8C,GAA9CA,IAA8C;IAAA,KAAlBC,MAAkB,GAAlBA,MAAkB;;IAAA;;IAAA;;IACzE,MAAMC,KAAK,GAAG,KAAKF,IAAL,CAAUG,KAAV,EAAd;IACA,KAAKC,MAAL,GAAc,CAACF,KAAD,CAAd;IACA,KAAKG,cAAL,GAAsB,IAAIC,sCAAJ,CAAuBN,IAAvB,CAAtB;EACD;;EAEQ,IAALE,KAAK,GAAG;IACV,OAAO,KAAKE,MAAL,CAAY,KAAKA,MAAL,CAAYG,MAAZ,GAAqB,CAAjC,CAAP;EACD;;EAEOC,IAAI,GAAG;IACb,MAAMC,UAAU,GAAG,KAAKP,KAAL,CAAWQ,IAAX,EAAnB;IACA,KAAKN,MAAL,CAAYO,IAAZ,CAAiBF,UAAjB;EACD;;EAEDG,OAAO,GAAS;IACd,KAAKR,MAAL,CAAYS,GAAZ;EACD;;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B,KAAKmD,OAArB;IACD;;IACD,IAAI,KAAKE,YAAL,KAAsBvE,SAA1B,EAAqC;MACnCxB,KAAK,CAAC2D,cAAN,CAAqB,KAAKoC,YAA1B;IACD;;IACD,IAAI,KAAKE,OAAL,KAAiBzE,SAArB,EAAgC;MAC9BxB,KAAK,CAAC4D,SAAN,CAAgB,KAAKqC,OAArB;IACD;;IACD,IAAI,KAAKE,WAAL,KAAqB3E,SAAzB,EAAoC;MAClCxB,KAAK,CAAC6D,aAAN,CAAoB,KAAKsC,WAAzB;IACD;;IACD,IAAI,KAAKE,YAAL,KAAsB7E,SAA1B,EAAqC;MACnCxB,KAAK,CAAC8D,cAAN,CAAqB,KAAKuC,YAA1B;IACD;;IACD,IAAI,KAAKE,WAAL,KAAqB/E,SAAzB,EAAoC;MAClCxB,KAAK,CAAC+D,aAAN,CAAoB,KAAKwC,WAAzB;IACD;EACF;;AA9PmB"}
|
@@ -4,11 +4,11 @@ import type { DrawingContext } from "./DrawingContext";
|
|
4
4
|
export interface DrawingNodeProps extends GroupProps {
|
5
5
|
paint?: SkPaint;
|
6
6
|
}
|
7
|
-
export
|
7
|
+
export type ImageProps = DrawingNodeProps & RectDef & {
|
8
8
|
fit?: Fit;
|
9
9
|
image: SkImage | null;
|
10
10
|
};
|
11
|
-
export
|
11
|
+
export type CircleProps = CircleDef & DrawingNodeProps;
|
12
12
|
export interface PathProps extends DrawingNodeProps {
|
13
13
|
path: PathDef;
|
14
14
|
start: number;
|
@@ -23,9 +23,9 @@ export interface LineProps extends DrawingNodeProps {
|
|
23
23
|
p1: Vector;
|
24
24
|
p2: Vector;
|
25
25
|
}
|
26
|
-
export
|
27
|
-
export
|
28
|
-
export
|
26
|
+
export type OvalProps = RectDef & DrawingNodeProps;
|
27
|
+
export type RectProps = RectDef & DrawingNodeProps;
|
28
|
+
export type RoundedRectProps = RRectDef & DrawingNodeProps;
|
29
29
|
export interface CubicBezierHandle {
|
30
30
|
pos: Vector;
|
31
31
|
c1: Vector;
|