react-native-skia 3.0.1 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Package.swift +14 -13
- package/README.md +19 -2
- package/android/CMakeLists.txt +13 -42
- package/android/build.gradle +54 -63
- package/android/cpp/jni/JniLoad.cpp +2 -4
- package/android/cpp/jni/include/JniSkiaView.h +123 -0
- package/android/cpp/rnskia-android/{RNSkOpenGLCanvasProvider.cpp → RNSkAndroidCanvasProvider.cpp} +45 -100
- package/android/cpp/rnskia-android/{RNSkOpenGLCanvasProvider.h → RNSkAndroidCanvasProvider.h} +24 -22
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +0 -83
- package/android/cpp/rnskia-android/RNSkAndroidVideo.cpp +0 -8
- package/android/src/main/java/com/reactnative/skia/RNSkiaPackage.java +1 -2
- package/android/src/main/java/com/reactnative/skia/SkiaSurfaceView.java +1 -3
- package/android/src/main/java/com/reactnative/skia/SkiaTextureView.java +1 -17
- package/android/src/main/java/com/reactnative/skia/{SkiaBaseView.java → SkiaView.java} +78 -16
- package/android/src/main/java/com/reactnative/skia/SkiaViewManager.java +85 -0
- package/apple/MetalLayerColorSpace.mm +10 -12
- package/apple/RNSkApplePlatformContext.h +12 -14
- package/apple/RNSkApplePlatformContext.mm +19 -112
- package/apple/RNSkMetalCanvasProvider.h +14 -19
- package/apple/RNSkMetalCanvasProvider.mm +39 -70
- package/apple/RNSkiaModule.mm +10 -0
- package/apple/SkiaView.h +20 -0
- package/apple/SkiaView.mm +210 -0
- package/cpp/api/JsiSkApi.h +2 -13
- package/cpp/api/JsiSkCanvas.h +4 -18
- package/cpp/api/JsiSkGraphiteContext.h +1 -5
- package/cpp/api/JsiSkGraphiteRecording.h +1 -5
- package/cpp/api/JsiSkImage.h +7 -41
- package/cpp/api/JsiSkImageFactory.h +0 -14
- package/cpp/api/JsiSkSurface.h +2 -16
- package/cpp/api/JsiSkSurfaceFactory.h +0 -8
- package/cpp/rnskia/RNDawnContext.h +3 -2
- package/cpp/rnskia/RNDawnInterop.cpp +0 -4
- package/cpp/rnskia/RNDawnUtils.h +12 -1
- package/cpp/rnskia/RNDawnWindowContext.cpp +12 -1
- package/cpp/rnskia/RNDawnWindowContext.h +19 -7
- package/cpp/rnskia/RNMetalLayerColorSpace.h +4 -2
- package/cpp/rnskia/RNSkCanvasProvider.h +231 -0
- package/cpp/rnskia/RNSkGraphiteProducer.cpp +36 -14
- package/cpp/rnskia/RNSkGraphiteProducer.h +23 -8
- package/cpp/rnskia/RNSkGraphiteTarget.h +396 -0
- package/cpp/rnskia/RNSkJsiViewApi.h +9 -18
- package/cpp/rnskia/RNSkPlatformContext.h +17 -15
- package/cpp/rnskia/RNSkView.h +362 -246
- package/jestSetup.js +1 -3
- package/lib/commonjs/Platform/Platform.web.js +1 -1
- package/lib/commonjs/Platform/Platform.web.js.map +1 -1
- package/lib/commonjs/external/reanimated/interpolators.js +1 -1
- package/lib/commonjs/external/reanimated/interpolators.js.map +1 -1
- package/lib/commonjs/index.d.ts +1 -3
- package/lib/commonjs/index.js +3 -12
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mock/index.js +0 -1
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.d.ts +15 -12
- package/lib/commonjs/renderer/Canvas.js +25 -21
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/skia/types/Graphite.d.ts +3 -3
- package/lib/commonjs/skia/types/Graphite.js.map +1 -1
- package/lib/commonjs/skia/types/Image/ImageFactory.d.ts +2 -2
- package/lib/commonjs/skia/types/Image/ImageFactory.js.map +1 -1
- package/lib/commonjs/skia/types/Skia.d.ts +1 -2
- package/lib/commonjs/skia/types/Skia.js.map +1 -1
- package/lib/commonjs/skia/types/Surface/SurfaceFactory.d.ts +1 -1
- package/lib/commonjs/skia/types/Surface/SurfaceFactory.js.map +1 -1
- package/lib/commonjs/specs/NativeSkiaModule.web.d.ts +5 -4
- package/lib/commonjs/specs/NativeSkiaModule.web.js +5 -9
- package/lib/commonjs/specs/NativeSkiaModule.web.js.map +1 -1
- package/lib/{typescript/src/specs/SkiaPictureViewNativeComponent.d.ts → commonjs/specs/SkiaViewNativeComponent.d.ts} +0 -3
- package/lib/commonjs/specs/{SkiaPictureViewNativeComponent.js → SkiaViewNativeComponent.js} +2 -2
- package/lib/commonjs/specs/SkiaViewNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/SkiaViewNativeComponent.web.d.ts +10 -0
- package/lib/commonjs/specs/SkiaViewNativeComponent.web.js +27 -0
- package/lib/commonjs/specs/SkiaViewNativeComponent.web.js.map +1 -0
- package/lib/commonjs/views/SkiaGraphiteView.d.ts +3 -4
- package/lib/commonjs/views/SkiaGraphiteView.js +23 -12
- package/lib/commonjs/views/SkiaGraphiteView.js.map +1 -1
- package/lib/commonjs/views/SkiaPictureView.d.ts +4 -1
- package/lib/commonjs/views/SkiaPictureView.js +12 -10
- package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
- package/lib/commonjs/views/SkiaView.web.d.ts +12 -0
- package/lib/commonjs/views/{SkiaGraphiteView.web.js → SkiaView.web.js} +82 -38
- package/lib/commonjs/views/SkiaView.web.js.map +1 -0
- package/lib/commonjs/views/SkiaWebRenderer.js +1 -1
- package/lib/commonjs/views/SkiaWebRenderer.js.map +1 -1
- package/lib/commonjs/views/android.d.ts +6 -0
- package/lib/commonjs/views/android.js +17 -0
- package/lib/commonjs/views/android.js.map +1 -0
- package/lib/commonjs/views/types.d.ts +3 -12
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/Platform/Platform.web.js +1 -1
- package/lib/module/Platform/Platform.web.js.map +1 -1
- package/lib/module/external/reanimated/interpolators.js +1 -1
- package/lib/module/external/reanimated/interpolators.js.map +1 -1
- package/lib/module/index.d.ts +1 -3
- package/lib/module/index.js +1 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/mock/index.js +0 -1
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/renderer/Canvas.d.ts +15 -12
- package/lib/module/renderer/Canvas.js +25 -20
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/skia/types/Graphite.d.ts +3 -3
- package/lib/module/skia/types/Graphite.js.map +1 -1
- package/lib/module/skia/types/Image/ImageFactory.d.ts +2 -2
- package/lib/module/skia/types/Image/ImageFactory.js.map +1 -1
- package/lib/module/skia/types/Skia.d.ts +1 -2
- package/lib/module/skia/types/Skia.js.map +1 -1
- package/lib/module/skia/types/Surface/SurfaceFactory.d.ts +1 -1
- package/lib/module/skia/types/Surface/SurfaceFactory.js.map +1 -1
- package/lib/module/specs/NativeSkiaModule.web.d.ts +5 -4
- package/lib/module/specs/NativeSkiaModule.web.js +5 -9
- package/lib/module/specs/NativeSkiaModule.web.js.map +1 -1
- package/lib/{commonjs/specs/SkiaPictureViewNativeComponent.d.ts → module/specs/SkiaViewNativeComponent.d.ts} +0 -3
- package/lib/module/specs/{SkiaPictureViewNativeComponent.js → SkiaViewNativeComponent.js} +2 -2
- package/lib/module/specs/SkiaViewNativeComponent.js.map +1 -0
- package/lib/module/specs/SkiaViewNativeComponent.web.d.ts +10 -0
- package/lib/module/specs/SkiaViewNativeComponent.web.js +21 -0
- package/lib/module/specs/SkiaViewNativeComponent.web.js.map +1 -0
- package/lib/module/views/SkiaGraphiteView.d.ts +3 -4
- package/lib/module/views/SkiaGraphiteView.js +23 -12
- package/lib/module/views/SkiaGraphiteView.js.map +1 -1
- package/lib/module/views/SkiaPictureView.d.ts +4 -1
- package/lib/module/views/SkiaPictureView.js +12 -10
- package/lib/module/views/SkiaPictureView.js.map +1 -1
- package/lib/module/views/SkiaView.web.d.ts +12 -0
- package/lib/module/views/{SkiaGraphiteView.web.js → SkiaView.web.js} +80 -36
- package/lib/module/views/SkiaView.web.js.map +1 -0
- package/lib/module/views/SkiaWebRenderer.js +1 -1
- package/lib/module/views/SkiaWebRenderer.js.map +1 -1
- package/lib/module/views/android.d.ts +6 -0
- package/lib/module/views/android.js +10 -0
- package/lib/module/views/android.js.map +1 -0
- package/lib/module/views/types.d.ts +3 -12
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -3
- package/lib/typescript/src/renderer/Canvas.d.ts +15 -12
- package/lib/typescript/src/skia/types/Graphite.d.ts +3 -3
- package/lib/typescript/src/skia/types/Image/ImageFactory.d.ts +2 -2
- package/lib/typescript/src/skia/types/Skia.d.ts +1 -2
- package/lib/typescript/src/skia/types/Surface/SurfaceFactory.d.ts +1 -1
- package/lib/typescript/src/specs/NativeSkiaModule.web.d.ts +5 -4
- package/lib/{module/specs/SkiaPictureViewNativeComponent.d.ts → typescript/src/specs/SkiaViewNativeComponent.d.ts} +0 -3
- package/lib/typescript/src/specs/SkiaViewNativeComponent.web.d.ts +10 -0
- package/lib/typescript/src/views/SkiaGraphiteView.d.ts +3 -4
- package/lib/typescript/src/views/SkiaPictureView.d.ts +4 -1
- package/lib/typescript/src/views/SkiaView.web.d.ts +12 -0
- package/lib/typescript/src/views/android.d.ts +6 -0
- package/lib/typescript/src/views/types.d.ts +3 -12
- package/package.json +5 -13
- package/react-native-skia.podspec +34 -58
- package/src/Platform/Platform.web.tsx +1 -1
- package/src/external/reanimated/interpolators.ts +1 -1
- package/src/index.ts +1 -3
- package/src/mock/index.ts +0 -1
- package/src/renderer/Canvas.tsx +24 -28
- package/src/skia/types/Graphite.ts +3 -3
- package/src/skia/types/Image/ImageFactory.ts +2 -2
- package/src/skia/types/Skia.ts +1 -2
- package/src/skia/types/Surface/SurfaceFactory.ts +1 -1
- package/src/specs/NativeSkiaModule.web.ts +9 -21
- package/src/specs/{SkiaPictureViewNativeComponent.ts → SkiaViewNativeComponent.ts} +1 -4
- package/src/specs/{SkiaPictureViewNativeComponent.web.ts → SkiaViewNativeComponent.web.ts} +8 -10
- package/src/views/SkiaGraphiteView.tsx +27 -16
- package/src/views/SkiaPictureView.tsx +11 -10
- package/src/views/{SkiaGraphiteView.web.tsx → SkiaView.web.tsx} +100 -53
- package/src/views/SkiaWebRenderer.ts +1 -1
- package/src/views/android.ts +16 -0
- package/src/views/types.ts +3 -14
- package/android/cpp/jni/include/JniSkiaBaseView.h +0 -92
- package/android/cpp/jni/include/JniSkiaGraphiteView.h +0 -176
- package/android/cpp/jni/include/JniSkiaPictureView.h +0 -172
- package/android/cpp/rnskia-android/GrAHardwareBufferUtils.cpp +0 -245
- package/android/cpp/rnskia-android/GrAHardwareBufferUtils.h +0 -33
- package/android/cpp/rnskia-android/OpenGLContext.h +0 -248
- package/android/cpp/rnskia-android/OpenGLWindowContext.cpp +0 -67
- package/android/cpp/rnskia-android/OpenGLWindowContext.h +0 -75
- package/android/cpp/rnskia-android/RNSkAndroidView.h +0 -67
- package/android/cpp/rnskia-android/gl/Context.h +0 -80
- package/android/cpp/rnskia-android/gl/Display.h +0 -123
- package/android/cpp/rnskia-android/gl/Error.cpp +0 -45
- package/android/cpp/rnskia-android/gl/Error.h +0 -8
- package/android/cpp/rnskia-android/gl/Surface.h +0 -43
- package/android/src/main/java/com/reactnative/skia/SkiaBaseViewManager.java +0 -65
- package/android/src/main/java/com/reactnative/skia/SkiaGraphiteView.java +0 -78
- package/android/src/main/java/com/reactnative/skia/SkiaGraphiteViewManager.java +0 -32
- package/android/src/main/java/com/reactnative/skia/SkiaPictureView.java +0 -105
- package/android/src/main/java/com/reactnative/skia/SkiaPictureViewManager.java +0 -44
- package/apple/MetalContext.h +0 -116
- package/apple/MetalContext.mm +0 -38
- package/apple/MetalWindowContext.h +0 -42
- package/apple/MetalWindowContext.mm +0 -95
- package/apple/RNSkAppleView.h +0 -49
- package/apple/RNSkAppleView.mm +0 -35
- package/apple/SkiaCVPixelBufferUtils.h +0 -122
- package/apple/SkiaCVPixelBufferUtils.mm +0 -535
- package/apple/SkiaGraphiteView.h +0 -26
- package/apple/SkiaGraphiteView.mm +0 -180
- package/apple/SkiaPictureView.h +0 -7
- package/apple/SkiaPictureView.mm +0 -70
- package/apple/SkiaUIView.h +0 -31
- package/apple/SkiaUIView.mm +0 -164
- package/cpp/rnskia/RNSkGraphiteView.h +0 -708
- package/cpp/rnskia/RNSkPictureView.cpp +0 -69
- package/cpp/rnskia/RNSkPictureView.h +0 -211
- package/cpp/skia/src/gpu/ganesh/gl/GrGLDefines.h +0 -1162
- package/lib/commonjs/renderer/DefaultCanvas.d.ts +0 -8
- package/lib/commonjs/renderer/DefaultCanvas.js +0 -42
- package/lib/commonjs/renderer/DefaultCanvas.js.map +0 -1
- package/lib/commonjs/renderer/GraphiteCanvas.d.ts +0 -22
- package/lib/commonjs/renderer/GraphiteCanvas.js +0 -64
- package/lib/commonjs/renderer/GraphiteCanvas.js.map +0 -1
- package/lib/commonjs/renderer/GraphiteCanvas.web.d.ts +0 -1
- package/lib/commonjs/renderer/GraphiteCanvas.web.js +0 -13
- package/lib/commonjs/renderer/GraphiteCanvas.web.js.map +0 -1
- package/lib/commonjs/specs/SkiaGraphiteViewNativeComponent.d.ts +0 -10
- package/lib/commonjs/specs/SkiaGraphiteViewNativeComponent.js +0 -12
- package/lib/commonjs/specs/SkiaGraphiteViewNativeComponent.js.map +0 -1
- package/lib/commonjs/specs/SkiaGraphiteViewNativeComponent.web.d.ts +0 -9
- package/lib/commonjs/specs/SkiaGraphiteViewNativeComponent.web.js +0 -28
- package/lib/commonjs/specs/SkiaGraphiteViewNativeComponent.web.js.map +0 -1
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js.map +0 -1
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.d.ts +0 -10
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.js +0 -29
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.js.map +0 -1
- package/lib/commonjs/views/SkiaGraphiteView.web.d.ts +0 -14
- package/lib/commonjs/views/SkiaGraphiteView.web.js.map +0 -1
- package/lib/commonjs/views/SkiaPictureView.web.d.ts +0 -11
- package/lib/commonjs/views/SkiaPictureView.web.js +0 -165
- package/lib/commonjs/views/SkiaPictureView.web.js.map +0 -1
- package/lib/module/renderer/DefaultCanvas.d.ts +0 -8
- package/lib/module/renderer/DefaultCanvas.js +0 -34
- package/lib/module/renderer/DefaultCanvas.js.map +0 -1
- package/lib/module/renderer/GraphiteCanvas.d.ts +0 -22
- package/lib/module/renderer/GraphiteCanvas.js +0 -57
- package/lib/module/renderer/GraphiteCanvas.js.map +0 -1
- package/lib/module/renderer/GraphiteCanvas.web.d.ts +0 -1
- package/lib/module/renderer/GraphiteCanvas.web.js +0 -4
- package/lib/module/renderer/GraphiteCanvas.web.js.map +0 -1
- package/lib/module/specs/SkiaGraphiteViewNativeComponent.d.ts +0 -10
- package/lib/module/specs/SkiaGraphiteViewNativeComponent.js +0 -8
- package/lib/module/specs/SkiaGraphiteViewNativeComponent.js.map +0 -1
- package/lib/module/specs/SkiaGraphiteViewNativeComponent.web.d.ts +0 -9
- package/lib/module/specs/SkiaGraphiteViewNativeComponent.web.js +0 -22
- package/lib/module/specs/SkiaGraphiteViewNativeComponent.web.js.map +0 -1
- package/lib/module/specs/SkiaPictureViewNativeComponent.js.map +0 -1
- package/lib/module/specs/SkiaPictureViewNativeComponent.web.d.ts +0 -10
- package/lib/module/specs/SkiaPictureViewNativeComponent.web.js +0 -23
- package/lib/module/specs/SkiaPictureViewNativeComponent.web.js.map +0 -1
- package/lib/module/views/SkiaGraphiteView.web.d.ts +0 -14
- package/lib/module/views/SkiaGraphiteView.web.js.map +0 -1
- package/lib/module/views/SkiaPictureView.web.d.ts +0 -11
- package/lib/module/views/SkiaPictureView.web.js +0 -156
- package/lib/module/views/SkiaPictureView.web.js.map +0 -1
- package/lib/typescript/src/renderer/DefaultCanvas.d.ts +0 -8
- package/lib/typescript/src/renderer/GraphiteCanvas.d.ts +0 -22
- package/lib/typescript/src/renderer/GraphiteCanvas.web.d.ts +0 -1
- package/lib/typescript/src/specs/SkiaGraphiteViewNativeComponent.d.ts +0 -10
- package/lib/typescript/src/specs/SkiaGraphiteViewNativeComponent.web.d.ts +0 -9
- package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.web.d.ts +0 -10
- package/lib/typescript/src/views/SkiaGraphiteView.web.d.ts +0 -14
- package/lib/typescript/src/views/SkiaPictureView.web.d.ts +0 -11
- package/libs/.graphite +0 -1
- package/src/renderer/DefaultCanvas.tsx +0 -41
- package/src/renderer/GraphiteCanvas.tsx +0 -61
- package/src/renderer/GraphiteCanvas.web.tsx +0 -3
- package/src/specs/SkiaGraphiteViewNativeComponent.ts +0 -17
- package/src/specs/SkiaGraphiteViewNativeComponent.web.ts +0 -31
- package/src/views/SkiaPictureView.web.tsx +0 -224
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { SkGraphiteContext, SkImage, SkPicture, SkRect } from "../skia/types";
|
|
2
2
|
import type { ISkiaViewApi } from "../views/types";
|
|
3
|
-
/** What
|
|
3
|
+
/** What the web view registers under its native id. */
|
|
4
4
|
export interface SkiaWebViewHandle {
|
|
5
|
+
/** Shows a picture: the frame of a <Canvas> or a <SkiaPictureView>. */
|
|
6
|
+
setPicture(picture: SkPicture): void;
|
|
7
|
+
/** The recording side of the view, see SkiaGraphiteView. */
|
|
8
|
+
getContext(): SkGraphiteContext;
|
|
5
9
|
getSize(): {
|
|
6
10
|
width: number;
|
|
7
11
|
height: number;
|
|
@@ -11,9 +15,6 @@ export interface SkiaWebViewHandle {
|
|
|
11
15
|
measure(callback: (x: number, y: number, width: number, height: number, pageX: number, pageY: number) => void): void;
|
|
12
16
|
measureInWindow(callback: (x: number, y: number, width: number, height: number) => void): void;
|
|
13
17
|
}
|
|
14
|
-
export interface SkiaGraphiteViewHandle extends SkiaWebViewHandle {
|
|
15
|
-
getContext(): SkGraphiteContext;
|
|
16
|
-
}
|
|
17
18
|
export type ISkiaViewApiWeb = ISkiaViewApi & {
|
|
18
19
|
views: Record<string, SkiaWebViewHandle>;
|
|
19
20
|
deferedPictures: Record<string, SkPicture>;
|
|
@@ -6,10 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
/* eslint-disable import/no-anonymous-default-export */
|
|
8
8
|
|
|
9
|
-
/** What
|
|
9
|
+
/** What the web view registers under its native id. */
|
|
10
10
|
|
|
11
|
-
const hasPicture = view => "setPicture" in view;
|
|
12
|
-
const hasContext = view => "getContext" in view;
|
|
13
11
|
global.SkiaViewApi = {
|
|
14
12
|
views: {},
|
|
15
13
|
deferedPictures: {},
|
|
@@ -19,7 +17,7 @@ global.SkiaViewApi = {
|
|
|
19
17
|
registerView(nativeId, view) {
|
|
20
18
|
this.unregisteredViews.delete(nativeId);
|
|
21
19
|
// Maybe a picture for this view was already set
|
|
22
|
-
if (this.deferedPictures[nativeId]
|
|
20
|
+
if (this.deferedPictures[nativeId]) {
|
|
23
21
|
view.setPicture(this.deferedPictures[nativeId]);
|
|
24
22
|
delete this.deferedPictures[nativeId];
|
|
25
23
|
}
|
|
@@ -38,9 +36,7 @@ global.SkiaViewApi = {
|
|
|
38
36
|
const id = `${nativeId}`;
|
|
39
37
|
const view = this.views[id];
|
|
40
38
|
if (view) {
|
|
41
|
-
|
|
42
|
-
view.setPicture(value);
|
|
43
|
-
}
|
|
39
|
+
view.setPicture(value);
|
|
44
40
|
} else if (!this.unregisteredViews.has(id)) {
|
|
45
41
|
this.deferedPictures[id] = value;
|
|
46
42
|
}
|
|
@@ -77,8 +73,8 @@ global.SkiaViewApi = {
|
|
|
77
73
|
},
|
|
78
74
|
makeGraphiteContext(nativeId) {
|
|
79
75
|
const view = this.views[`${nativeId}`];
|
|
80
|
-
if (!view
|
|
81
|
-
throw new Error(`Cannot make a Graphite context: no
|
|
76
|
+
if (!view) {
|
|
77
|
+
throw new Error(`Cannot make a Graphite context: no view with nativeID ${nativeId} is mounted`);
|
|
82
78
|
}
|
|
83
79
|
return view.getContext();
|
|
84
80
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["global","SkiaViewApi","views","deferedPictures","unregisteredViews","Set","deferedOnSize","web","registerView","nativeId","view","delete","setPicture","unregisterView","add","setJsiProperty","name","value","id","has","size","getSize","width","height","requestRedraw","_this$views","redraw","applyUpdates","makeImageSnapshot","rect","Error","makeGraphiteContext","getContext","makeImageSnapshotAsync","Promise","resolve","reject","result","_default","exports","default"],"sources":["NativeSkiaModule.web.ts"],"sourcesContent":["/* eslint-disable import/no-anonymous-default-export */\nimport type {\n SkGraphiteContext,\n SkImage,\n SkPicture,\n SkRect,\n} from \"../skia/types\";\nimport type { ISkiaViewApi } from \"../views/types\";\n\n/** What the web view registers under its native id. */\nexport interface SkiaWebViewHandle {\n /** Shows a picture: the frame of a <Canvas> or a <SkiaPictureView>. */\n setPicture(picture: SkPicture): void;\n /** The recording side of the view, see SkiaGraphiteView. */\n getContext(): SkGraphiteContext;\n getSize(): { width: number; height: number };\n redraw(): void;\n makeImageSnapshot(rect?: SkRect): SkImage | null;\n measure(\n callback: (\n x: number,\n y: number,\n width: number,\n height: number,\n pageX: number,\n pageY: number\n ) => void\n ): void;\n measureInWindow(\n callback: (x: number, y: number, width: number, height: number) => void\n ): void;\n}\n\nexport type ISkiaViewApiWeb = ISkiaViewApi & {\n views: Record<string, SkiaWebViewHandle>;\n deferedPictures: Record<string, SkPicture>;\n unregisteredViews: Set<string>;\n registerView(nativeId: string, view: SkiaWebViewHandle): void;\n unregisterView(nativeId: string): void;\n};\n\nglobal.SkiaViewApi = {\n views: {},\n deferedPictures: {},\n unregisteredViews: new Set<string>(),\n deferedOnSize: {},\n web: true,\n registerView(nativeId: string, view: SkiaWebViewHandle) {\n this.unregisteredViews.delete(nativeId);\n // Maybe a picture for this view was already set\n if (this.deferedPictures[nativeId]) {\n view.setPicture(this.deferedPictures[nativeId] as SkPicture);\n delete this.deferedPictures[nativeId];\n }\n this.views[nativeId] = view;\n },\n unregisterView(nativeId: string) {\n // Views must be removed on unmount: the handle's closures capture the\n // canvas element, so a stale entry retains the whole detached DOM tree.\n this.unregisteredViews.add(nativeId);\n delete this.views[nativeId];\n delete this.deferedPictures[nativeId];\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setJsiProperty(nativeId: number, name: string, value: any) {\n if (name === \"picture\") {\n const id = `${nativeId}`;\n const view = this.views[id];\n if (view) {\n view.setPicture(value);\n } else if (!this.unregisteredViews.has(id)) {\n this.deferedPictures[id] = value;\n }\n // Otherwise the view has unmounted (e.g. a trailing animation frame):\n // drop the picture instead of deferring it for an id that will never\n // register again, which would retain it forever.\n }\n },\n size(nativeId: number) {\n if (this.views[`${nativeId}`]) {\n return this.views[`${nativeId}`].getSize();\n } else {\n return { width: 0, height: 0 };\n }\n },\n requestRedraw(nativeId: number) {\n // The view may already have unmounted (e.g. a trailing animation frame).\n this.views[`${nativeId}`]?.redraw();\n },\n applyUpdates() {\n // Web canvases are driven from JS (see Container.web.ts); there is no\n // view-owned recorder to update.\n },\n makeImageSnapshot(nativeId: number, rect?: SkRect) {\n const view = this.views[`${nativeId}`];\n if (!view) {\n throw new Error(\n `Cannot make image snapshot: view with nativeID ${nativeId} is not registered (it may have unmounted)`\n );\n }\n return view.makeImageSnapshot(rect);\n },\n makeGraphiteContext(nativeId: number) {\n const view = this.views[`${nativeId}`];\n if (!view) {\n throw new Error(\n `Cannot make a Graphite context: no view with nativeID ${nativeId} is mounted`\n );\n }\n return view.getContext();\n },\n makeImageSnapshotAsync(nativeId: number, rect?: SkRect) {\n return new Promise((resolve, reject) => {\n const view = this.views[`${nativeId}`];\n if (!view) {\n reject(\n new Error(\n `Cannot make image snapshot: view with nativeID ${nativeId} is not registered (it may have unmounted)`\n )\n );\n return;\n }\n const result = view.makeImageSnapshot(rect);\n if (result) {\n resolve(result);\n } else {\n reject(new Error(\"Failed to make image snapshot\"));\n }\n });\n },\n} as ISkiaViewApiWeb;\n\n// eslint-disable-next-line import/no-default-export\nexport default {};\n"],"mappings":";;;;;;AAAA;;AASA;;AAgCAA,MAAM,CAACC,WAAW,GAAG;EACnBC,KAAK,EA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C,IAAI,CAACC,IAAI,EAAE;QACT0B,MAAM,CACJ,IAAIN,KAAK,CACP,kDAAkDrB,QAAQ,4CAC5D,CACF,CAAC;QACD;MACF;MACA,MAAM4B,MAAM,GAAG3B,IAAI,CAACkB,iBAAiB,CAACC,IAAI,CAAC;MAC3C,IAAIQ,MAAM,EAAE;QACVF,OAAO,CAACE,MAAM,CAAC;MACjB,CAAC,MAAM;QACLD,MAAM,CAAC,IAAIN,KAAK,CAAC,+BAA+B,CAAC,CAAC;MACpD;IACF,CAAC,CAAC;EACJ;AACF,CAAoB;;AAEpB;AAAA,IAAAQ,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACe,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { type ViewProps } from "react-native";
|
|
2
2
|
import type { WithDefault } from "react-native/Libraries/Types/CodegenTypes";
|
|
3
3
|
export interface NativeProps extends ViewProps {
|
|
4
|
-
debug?: boolean;
|
|
5
4
|
opaque?: boolean;
|
|
6
|
-
colorSpace?: string;
|
|
7
5
|
highBitDepth?: boolean;
|
|
8
|
-
androidWarmup?: boolean;
|
|
9
6
|
androidSurfaceType?: WithDefault<"auto" | "SurfaceView" | "TextureView", "auto">;
|
|
10
7
|
androidZOrderOnTop?: WithDefault<boolean, false>;
|
|
11
8
|
pointerEvents?: WithDefault<"auto" | "none" | "box-none" | "box-only", "auto">;
|
|
@@ -8,5 +8,5 @@ var _reactNative = require("react-native");
|
|
|
8
8
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
9
9
|
// @ts-ignore - pointerEvents needs to be redeclared for codegen to generate native bindings
|
|
10
10
|
// eslint-disable-next-line import/no-default-export
|
|
11
|
-
var _default = exports.default = (0, _reactNative.codegenNativeComponent)("
|
|
12
|
-
//# sourceMappingURL=
|
|
11
|
+
var _default = exports.default = (0, _reactNative.codegenNativeComponent)("SkiaView");
|
|
12
|
+
//# sourceMappingURL=SkiaViewNativeComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","exports","default","codegenNativeComponent"],"sources":["SkiaViewNativeComponent.ts"],"sourcesContent":["import { codegenNativeComponent, type ViewProps } from \"react-native\";\nimport type { WithDefault } from \"react-native/Libraries/Types/CodegenTypes\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore - pointerEvents needs to be redeclared for codegen to generate native bindings\nexport interface NativeProps extends ViewProps {\n opaque?: boolean;\n highBitDepth?: boolean;\n androidSurfaceType?: WithDefault<\n \"auto\" | \"SurfaceView\" | \"TextureView\",\n \"auto\"\n >;\n androidZOrderOnTop?: WithDefault<boolean, false>;\n pointerEvents?: WithDefault<\n \"auto\" | \"none\" | \"box-none\" | \"box-only\",\n \"auto\"\n >;\n}\n\n// eslint-disable-next-line import/no-default-export\nexport default codegenNativeComponent<NativeProps>(\"SkiaView\");\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA;AACA;AAeA;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACe,IAAAC,mCAAsB,EAAc,UAAU,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ViewProps } from "react-native";
|
|
2
|
+
export interface NativeProps extends ViewProps {
|
|
3
|
+
opaque?: boolean;
|
|
4
|
+
highBitDepth?: boolean;
|
|
5
|
+
nativeID: string;
|
|
6
|
+
androidSurfaceType?: "auto" | "SurfaceView" | "TextureView";
|
|
7
|
+
androidZOrderOnTop?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const SkiaViewNativeComponent: ({ nativeID, onLayout, opaque: _opaque, highBitDepth: _highBitDepth, androidSurfaceType: _androidSurfaceType, androidZOrderOnTop: _androidZOrderOnTop, ...viewProps }: NativeProps) => import("react").FunctionComponentElement<import("../views/SkiaView.web").SkiaViewProps>;
|
|
10
|
+
export default SkiaViewNativeComponent;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _SkiaView = require("../views/SkiaView.web");
|
|
9
|
+
const SkiaViewNativeComponent = ({
|
|
10
|
+
nativeID,
|
|
11
|
+
onLayout,
|
|
12
|
+
// Surface settings, never reach the DOM
|
|
13
|
+
opaque: _opaque,
|
|
14
|
+
highBitDepth: _highBitDepth,
|
|
15
|
+
androidSurfaceType: _androidSurfaceType,
|
|
16
|
+
androidZOrderOnTop: _androidZOrderOnTop,
|
|
17
|
+
...viewProps
|
|
18
|
+
}) => {
|
|
19
|
+
return /*#__PURE__*/(0, _react.createElement)(_SkiaView.SkiaView, {
|
|
20
|
+
nativeID,
|
|
21
|
+
onLayout,
|
|
22
|
+
...viewProps
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
// eslint-disable-next-line import/no-default-export
|
|
26
|
+
var _default = exports.default = SkiaViewNativeComponent;
|
|
27
|
+
//# sourceMappingURL=SkiaViewNativeComponent.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_SkiaView","SkiaViewNativeComponent","nativeID","onLayout","opaque","_opaque","highBitDepth","_highBitDepth","androidSurfaceType","_androidSurfaceType","androidZOrderOnTop","_androidZOrderOnTop","viewProps","createElement","SkiaView","_default","exports","default"],"sources":["SkiaViewNativeComponent.web.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\nimport { createElement } from \"react\";\n\nimport { SkiaView } from \"../views/SkiaView.web\";\n\nexport interface NativeProps extends ViewProps {\n opaque?: boolean;\n highBitDepth?: boolean;\n nativeID: string;\n androidSurfaceType?: \"auto\" | \"SurfaceView\" | \"TextureView\";\n androidZOrderOnTop?: boolean;\n}\n\nconst SkiaViewNativeComponent = ({\n nativeID,\n onLayout,\n // Surface settings, never reach the DOM\n opaque: _opaque,\n highBitDepth: _highBitDepth,\n androidSurfaceType: _androidSurfaceType,\n androidZOrderOnTop: _androidZOrderOnTop,\n ...viewProps\n}: NativeProps) => {\n return createElement(SkiaView, {\n nativeID,\n onLayout,\n ...viewProps,\n });\n};\n// eslint-disable-next-line import/no-default-export\nexport default SkiaViewNativeComponent;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAUA,MAAME,uBAAuB,GAAGA,CAAC;EAC/BC,QAAQ;EACRC,QAAQ;EACR;EACAC,MAAM,EAAEC,OAAO;EACfC,YAAY,EAAEC,aAAa;EAC3BC,kBAAkB,EAAEC,mBAAmB;EACvCC,kBAAkB,EAAEC,mBAAmB;EACvC,GAAGC;AACQ,CAAC,KAAK;EACjB,oBAAO,IAAAC,oBAAa,EAACC,kBAAQ,EAAE;IAC7BZ,QAAQ;IACRC,QAAQ;IACR,GAAGS;EACL,CAAC,CAAC;AACJ,CAAC;AACD;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACehB,uBAAuB","ignoreList":[]}
|
|
@@ -13,8 +13,7 @@ export interface SkiaGraphiteViewProps extends SkiaGraphiteViewNativeProps {
|
|
|
13
13
|
ref?: React.Ref<SkiaGraphiteViewRef>;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* A view
|
|
17
|
-
*
|
|
18
|
-
* nothing. See {@link SkGraphiteContext}.
|
|
16
|
+
* A view whose frames are recorded from JavaScript, on any runtime, through
|
|
17
|
+
* the context of its ref. See {@link SkGraphiteContext}.
|
|
19
18
|
*/
|
|
20
|
-
export declare const SkiaGraphiteView: ({
|
|
19
|
+
export declare const SkiaGraphiteView: ({ opaque, highBitDepth, android, ref, ...viewProps }: SkiaGraphiteViewProps) => React.JSX.Element;
|
|
@@ -5,21 +5,36 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.SkiaGraphiteView = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var
|
|
8
|
+
var _SkiaViewNativeComponent = _interopRequireDefault(require("../specs/SkiaViewNativeComponent"));
|
|
9
|
+
var _Platform = require("../Platform");
|
|
9
10
|
var _api = require("./api");
|
|
11
|
+
var _android = require("./android");
|
|
10
12
|
var _SkiaViewNativeId = require("./SkiaViewNativeId");
|
|
11
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
14
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
15
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
16
|
+
// The layout is known synchronously on the new architecture;
|
|
17
|
+
// getBoundingClientRect became stable in React Native 0.83. On the web the
|
|
18
|
+
// view measures itself (see SkiaView.web).
|
|
19
|
+
const measureLayout = view => {
|
|
20
|
+
if (_Platform.Platform.OS === "web") {
|
|
21
|
+
return {
|
|
22
|
+
width: 0,
|
|
23
|
+
height: 0
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
const host = view;
|
|
27
|
+
return host.getBoundingClientRect ? host.getBoundingClientRect() : host.unstable_getBoundingClientRect();
|
|
28
|
+
};
|
|
29
|
+
|
|
14
30
|
/**
|
|
15
|
-
* A view
|
|
16
|
-
*
|
|
17
|
-
* nothing. See {@link SkGraphiteContext}.
|
|
31
|
+
* A view whose frames are recorded from JavaScript, on any runtime, through
|
|
32
|
+
* the context of its ref. See {@link SkGraphiteContext}.
|
|
18
33
|
*/
|
|
19
34
|
const SkiaGraphiteView = ({
|
|
20
|
-
debug = false,
|
|
21
35
|
opaque = false,
|
|
22
36
|
highBitDepth = false,
|
|
37
|
+
android,
|
|
23
38
|
ref,
|
|
24
39
|
...viewProps
|
|
25
40
|
}) => {
|
|
@@ -29,25 +44,21 @@ const SkiaGraphiteView = ({
|
|
|
29
44
|
getNativeId: () => nativeId,
|
|
30
45
|
getContext: () => {
|
|
31
46
|
assertSkiaViewApi();
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
47
|
const view = viewRef.current;
|
|
34
48
|
if (!view) {
|
|
35
49
|
throw new Error("SkiaGraphiteView: getContext() was called before the view was mounted.");
|
|
36
50
|
}
|
|
37
|
-
|
|
38
|
-
// getBoundingClientRect became stable in React Native 0.83.
|
|
39
|
-
const size = "getBoundingClientRect" in view ? view.getBoundingClientRect() : view.unstable_getBoundingClientRect();
|
|
51
|
+
const size = measureLayout(view);
|
|
40
52
|
return _api.SkiaViewApi.makeGraphiteContext(nativeId, size.width, size.height, opaque, highBitDepth);
|
|
41
53
|
}
|
|
42
54
|
}), [nativeId, opaque, highBitDepth]);
|
|
43
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
55
|
+
return /*#__PURE__*/_react.default.createElement(_SkiaViewNativeComponent.default, _extends({
|
|
44
56
|
ref: viewRef,
|
|
45
57
|
collapsable: false,
|
|
46
58
|
nativeID: `${nativeId}`,
|
|
47
|
-
debug: debug,
|
|
48
59
|
opaque: opaque,
|
|
49
60
|
highBitDepth: highBitDepth
|
|
50
|
-
}, viewProps));
|
|
61
|
+
}, (0, _android.androidNativeProps)(android), viewProps));
|
|
51
62
|
};
|
|
52
63
|
exports.SkiaGraphiteView = SkiaGraphiteView;
|
|
53
64
|
const assertSkiaViewApi = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_SkiaViewNativeComponent","_interopRequireDefault","_Platform","_api","_android","_SkiaViewNativeId","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","measureLayout","view","Platform","OS","width","height","host","getBoundingClientRect","unstable_getBoundingClientRect","SkiaGraphiteView","opaque","highBitDepth","android","ref","viewProps","nativeId","useMemo","SkiaViewNativeId","current","viewRef","useRef","useImperativeHandle","getNativeId","getContext","assertSkiaViewApi","Error","size","SkiaViewApi","makeGraphiteContext","createElement","collapsable","nativeID","androidNativeProps","exports"],"sources":["SkiaGraphiteView.tsx"],"sourcesContent":["import React, { useImperativeHandle, useMemo, useRef } from \"react\";\n\nimport type { SkGraphiteContext } from \"../skia/types\";\nimport SkiaViewNativeComponent from \"../specs/SkiaViewNativeComponent\";\nimport { Platform } from \"../Platform\";\n\nimport { SkiaViewApi } from \"./api\";\nimport { androidNativeProps } from \"./android\";\nimport type { SkiaGraphiteViewNativeProps } from \"./types\";\nimport { SkiaViewNativeId } from \"./SkiaViewNativeId\";\n\nexport interface SkiaGraphiteViewRef {\n /**\n * The recording side of the view. Call it once the view is mounted. The\n * returned context can be captured into worklets and used from any runtime.\n */\n getContext(): SkGraphiteContext;\n getNativeId(): number;\n}\n\nexport interface SkiaGraphiteViewProps extends SkiaGraphiteViewNativeProps {\n ref?: React.Ref<SkiaGraphiteViewRef>;\n}\n\n// The layout is known synchronously on the new architecture;\n// getBoundingClientRect became stable in React Native 0.83. On the web the\n// view measures itself (see SkiaView.web).\nconst measureLayout = (view: unknown) => {\n if (Platform.OS === \"web\") {\n return { width: 0, height: 0 };\n }\n const host = view as {\n getBoundingClientRect?: () => { width: number; height: number };\n unstable_getBoundingClientRect: () => { width: number; height: number };\n };\n return host.getBoundingClientRect\n ? host.getBoundingClientRect()\n : host.unstable_getBoundingClientRect();\n};\n\n/**\n * A view whose frames are recorded from JavaScript, on any runtime, through\n * the context of its ref. See {@link SkGraphiteContext}.\n */\nexport const SkiaGraphiteView = ({\n opaque = false,\n highBitDepth = false,\n android,\n ref,\n ...viewProps\n}: SkiaGraphiteViewProps) => {\n const nativeId = useMemo(() => SkiaViewNativeId.current++, []);\n const viewRef =\n useRef<React.ComponentRef<typeof SkiaViewNativeComponent>>(null);\n useImperativeHandle(\n ref,\n () => ({\n getNativeId: () => nativeId,\n getContext: () => {\n assertSkiaViewApi();\n const view = viewRef.current;\n if (!view) {\n throw new Error(\n \"SkiaGraphiteView: getContext() was called before the view was mounted.\"\n );\n }\n const size = measureLayout(view);\n return SkiaViewApi.makeGraphiteContext(\n nativeId,\n size.width,\n size.height,\n opaque,\n highBitDepth\n );\n },\n }),\n [nativeId, opaque, highBitDepth]\n );\n return (\n <SkiaViewNativeComponent\n ref={viewRef}\n collapsable={false}\n nativeID={`${nativeId}`}\n opaque={opaque}\n highBitDepth={highBitDepth}\n {...androidNativeProps(android)}\n {...viewProps}\n />\n );\n};\n\nconst assertSkiaViewApi = () => {\n if (SkiaViewApi === null || SkiaViewApi.makeGraphiteContext === null) {\n throw Error(\"Skia View Api was not found.\");\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,wBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAEA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAEA,IAAAM,iBAAA,GAAAN,OAAA;AAAsD,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAG,CAAA,6BAAAC,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,EAAEL,MAAM,EAAEC,YAAY,CACjC,CAAC;EACD,oBACE7C,MAAA,CAAAW,OAAA,CAAAoD,aAAA,CAAC5D,wBAAA,CAAAQ,OAAuB,EAAAiB,QAAA;IACtBmB,GAAG,EAAEM,OAAQ;IACbW,WAAW,EAAE,KAAM;IACnBC,QAAQ,EAAE,GAAGhB,QAAQ,EAAG;IACxBL,MAAM,EAAEA,MAAO;IACfC,YAAY,EAAEA;EAAa,GACvB,IAAAqB,2BAAkB,EAACpB,OAAO,CAAC,EAC3BE,SAAS,CACd,CAAC;AAEN,CAAC;AAACmB,OAAA,CAAAxB,gBAAA,GAAAA,gBAAA;AAEF,MAAMe,iBAAiB,GAAGA,CAAA,KAAM;EAC9B,IAAIG,gBAAW,KAAK,IAAI,IAAIA,gBAAW,CAACC,mBAAmB,KAAK,IAAI,EAAE;IACpE,MAAMH,KAAK,CAAC,8BAA8B,CAAC;EAC7C;AACF,CAAC","ignoreList":[]}
|
|
@@ -3,8 +3,11 @@ import type { SkRect } from "../skia/types";
|
|
|
3
3
|
import type { SkiaPictureViewNativeProps } from "./types";
|
|
4
4
|
interface SkiaPictureViewProps extends SkiaPictureViewNativeProps {
|
|
5
5
|
mode?: "default" | "continuous";
|
|
6
|
-
androidWarmup?: boolean;
|
|
7
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* A view showing a picture. The picture is handed to the native view, which
|
|
9
|
+
* records it once (and again on every redraw) for its surface.
|
|
10
|
+
*/
|
|
8
11
|
export declare class SkiaPictureView extends React.Component<SkiaPictureViewProps> {
|
|
9
12
|
private requestId;
|
|
10
13
|
constructor(props: SkiaPictureViewProps);
|
|
@@ -5,15 +5,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.SkiaPictureView = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var
|
|
8
|
+
var _SkiaViewNativeComponent = _interopRequireDefault(require("../specs/SkiaViewNativeComponent"));
|
|
9
9
|
var _api = require("./api");
|
|
10
|
+
var _android = require("./android");
|
|
10
11
|
var _SkiaViewNativeId = require("./SkiaViewNativeId");
|
|
11
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
13
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
13
14
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
14
15
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
15
16
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
|
-
|
|
17
|
+
/**
|
|
18
|
+
* A view showing a picture. The picture is handed to the native view, which
|
|
19
|
+
* records it once (and again on every redraw) for its surface.
|
|
20
|
+
*/
|
|
17
21
|
class SkiaPictureView extends _react.default.Component {
|
|
18
22
|
constructor(props) {
|
|
19
23
|
super(props);
|
|
@@ -73,21 +77,19 @@ class SkiaPictureView extends _react.default.Component {
|
|
|
73
77
|
}
|
|
74
78
|
render() {
|
|
75
79
|
const {
|
|
76
|
-
mode,
|
|
77
|
-
|
|
80
|
+
mode: _mode,
|
|
81
|
+
picture: _picture,
|
|
78
82
|
opaque = false,
|
|
79
83
|
highBitDepth = false,
|
|
80
|
-
|
|
84
|
+
android,
|
|
81
85
|
...viewProps
|
|
82
86
|
} = this.props;
|
|
83
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
87
|
+
return /*#__PURE__*/_react.default.createElement(_SkiaViewNativeComponent.default, _extends({
|
|
84
88
|
collapsable: false,
|
|
85
89
|
nativeID: `${this._nativeId}`,
|
|
86
|
-
debug: debug,
|
|
87
90
|
opaque: opaque,
|
|
88
|
-
highBitDepth: highBitDepth
|
|
89
|
-
|
|
90
|
-
}, viewProps));
|
|
91
|
+
highBitDepth: highBitDepth
|
|
92
|
+
}, (0, _android.androidNativeProps)(android), viewProps));
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
95
|
exports.SkiaPictureView = SkiaPictureView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_SkiaViewNativeComponent","_api","_android","_SkiaViewNativeId","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","_defineProperty","_toPropertyKey","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","SkiaPictureView","React","Component","constructor","props","_nativeId","SkiaViewNativeId","current","picture","assertSkiaViewApi","SkiaViewApi","setJsiProperty","tick","nativeId","componentDidUpdate","prevProps","componentWillUnmount","requestId","cancelAnimationFrame","redraw","mode","requestAnimationFrame","makeImageSnapshot","rect","requestRedraw","render","_mode","_picture","opaque","highBitDepth","android","viewProps","createElement","collapsable","nativeID","androidNativeProps","exports","Error"],"sources":["SkiaPictureView.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { SkRect } from \"../skia/types\";\nimport SkiaViewNativeComponent from \"../specs/SkiaViewNativeComponent\";\n\nimport { SkiaViewApi } from \"./api\";\nimport { androidNativeProps } from \"./android\";\nimport type { SkiaPictureViewNativeProps } from \"./types\";\nimport { SkiaViewNativeId } from \"./SkiaViewNativeId\";\n\ninterface SkiaPictureViewProps extends SkiaPictureViewNativeProps {\n mode?: \"default\" | \"continuous\";\n}\n\n/**\n * A view showing a picture. The picture is handed to the native view, which\n * records it once (and again on every redraw) for its surface.\n */\nexport class SkiaPictureView extends React.Component<SkiaPictureViewProps> {\n private requestId = 0;\n\n constructor(props: SkiaPictureViewProps) {\n super(props);\n this._nativeId = SkiaViewNativeId.current++;\n const { picture } = props;\n if (picture) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", picture);\n }\n this.tick();\n }\n\n private _nativeId: number;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaPictureViewProps) {\n const { picture } = this.props;\n if (picture !== prevProps.picture) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", picture);\n }\n this.tick();\n }\n\n componentWillUnmount() {\n if (this.requestId) {\n cancelAnimationFrame(this.requestId);\n }\n }\n\n private tick() {\n this.redraw();\n if (this.props.mode === \"continuous\") {\n this.requestId = requestAnimationFrame(this.tick.bind(this));\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertSkiaViewApi();\n SkiaViewApi.requestRedraw(this._nativeId);\n }\n\n render() {\n const {\n mode: _mode,\n picture: _picture,\n opaque = false,\n highBitDepth = false,\n android,\n ...viewProps\n } = this.props;\n return (\n <SkiaViewNativeComponent\n collapsable={false}\n nativeID={`${this._nativeId}`}\n opaque={opaque}\n highBitDepth={highBitDepth}\n {...androidNativeProps(android)}\n {...viewProps}\n />\n );\n }\n}\n\nconst assertSkiaViewApi = () => {\n if (\n SkiaViewApi === null ||\n SkiaViewApi.setJsiProperty === null ||\n SkiaViewApi.requestRedraw === null ||\n SkiaViewApi.makeImageSnapshot === null\n ) {\n throw Error(\"Skia View Api was not found.\");\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC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import React from "react";
|
|
2
|
+
import type { ViewProps } from "react-native";
|
|
3
|
+
import type { SkiaWebViewHandle } from "../specs/NativeSkiaModule.web";
|
|
4
|
+
export interface SkiaViewHandle extends SkiaWebViewHandle {
|
|
5
|
+
/** The canvas element, for Reanimated's measure(). */
|
|
6
|
+
readonly canvasRef: () => HTMLCanvasElement | null;
|
|
7
|
+
}
|
|
8
|
+
export interface SkiaViewProps extends ViewProps {
|
|
9
|
+
ref?: React.Ref<SkiaViewHandle>;
|
|
10
|
+
__destroyWebGLContextAfterRender?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const SkiaView: (props: SkiaViewProps) => React.JSX.Element;
|