@shopify/react-native-skia 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- package/android/CMakeLists.txt +4 -8
- package/android/build.gradle +9 -2
- package/android/cpp/jni/JniPlatformContext.cpp +7 -7
- package/android/cpp/jni/JniSkiaManager.cpp +1 -1
- package/android/cpp/jni/include/JniSkiaBaseView.h +2 -2
- package/android/cpp/jni/include/JniSkiaDomView.h +4 -4
- package/android/cpp/jni/include/JniSkiaManager.h +4 -4
- package/android/cpp/jni/include/JniSkiaPictureView.h +4 -4
- package/android/cpp/rnskia-android/GrAHardwareBufferUtils.cpp +245 -0
- package/android/cpp/rnskia-android/GrAHardwareBufferUtils.h +33 -0
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +3 -3
- package/android/cpp/rnskia-android/RNSkAndroidView.h +1 -1
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +2 -2
- package/android/cpp/rnskia-android/SkiaOpenGLHelper.h +4 -4
- package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp +32 -2
- package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.h +7 -4
- package/cpp/api/JsiSkAnimatedImage.h +1 -1
- package/cpp/api/JsiSkCanvas.h +8 -8
- package/cpp/api/JsiSkColor.h +1 -1
- package/cpp/api/JsiSkColorFilter.h +1 -1
- package/cpp/api/JsiSkColorFilterFactory.h +2 -2
- package/cpp/api/JsiSkContourMeasure.h +1 -1
- package/cpp/api/JsiSkContourMeasureIter.h +1 -1
- package/cpp/api/JsiSkData.h +2 -2
- package/cpp/api/JsiSkFont.h +2 -2
- package/cpp/api/JsiSkFontMgr.h +1 -1
- package/cpp/api/JsiSkFontMgrFactory.h +1 -1
- package/cpp/api/JsiSkFontStyle.h +2 -2
- package/cpp/api/JsiSkImage.h +2 -2
- package/cpp/api/JsiSkImageFilter.h +1 -1
- package/cpp/api/JsiSkImageFilterFactory.h +1 -1
- package/cpp/api/JsiSkImageInfo.h +1 -1
- package/cpp/api/JsiSkMaskFilter.h +1 -1
- package/cpp/api/JsiSkMaskFilterFactory.h +1 -1
- package/cpp/api/JsiSkMatrix.h +1 -1
- package/cpp/api/JsiSkPaint.h +1 -1
- package/cpp/api/JsiSkParagraph.h +7 -7
- package/cpp/api/JsiSkParagraphBuilder.h +9 -9
- package/cpp/api/JsiSkParagraphBuilderFactory.h +4 -4
- package/cpp/api/JsiSkParagraphStyle.h +3 -3
- package/cpp/api/JsiSkPath.h +11 -11
- package/cpp/api/JsiSkPathEffect.h +1 -1
- package/cpp/api/JsiSkPathEffectFactory.h +4 -4
- package/cpp/api/JsiSkPathFactory.h +2 -2
- package/cpp/api/JsiSkPicture.h +1 -1
- package/cpp/api/JsiSkPictureFactory.h +2 -2
- package/cpp/api/JsiSkPictureRecorder.h +2 -2
- package/cpp/api/JsiSkPoint.h +1 -1
- package/cpp/api/JsiSkRRect.h +1 -1
- package/cpp/api/JsiSkRSXform.h +1 -1
- package/cpp/api/JsiSkRect.h +1 -1
- package/cpp/api/JsiSkRuntimeEffect.h +1 -1
- package/cpp/api/JsiSkRuntimeShaderBuilder.h +1 -1
- package/cpp/api/JsiSkSVGFactory.h +1 -1
- package/cpp/api/JsiSkShader.h +2 -2
- package/cpp/api/JsiSkShaderFactory.h +3 -3
- package/cpp/api/JsiSkStrutStyle.h +1 -1
- package/cpp/api/JsiSkSurface.h +1 -1
- package/cpp/api/JsiSkSurfaceFactory.h +1 -1
- package/cpp/api/JsiSkTextBlob.h +1 -1
- package/cpp/api/JsiSkTextBlobFactory.h +1 -1
- package/cpp/api/JsiSkTextStyle.h +2 -2
- package/cpp/api/JsiSkTypeface.h +3 -3
- package/cpp/api/JsiSkTypefaceFontProvider.h +2 -2
- package/cpp/api/JsiSkVertices.h +1 -1
- package/cpp/jsi/JsiHostObject.cpp +1 -1
- package/cpp/rnskia/RNSkDomView.cpp +1 -1
- package/cpp/rnskia/RNSkDomView.h +3 -3
- package/cpp/rnskia/RNSkManager.cpp +5 -5
- package/cpp/rnskia/RNSkPictureView.h +3 -3
- package/cpp/rnskia/RNSkPlatformContext.h +5 -5
- package/cpp/rnskia/RNSkView.h +2 -2
- package/cpp/rnskia/dom/base/ConcatablePaint.h +6 -6
- package/cpp/rnskia/dom/base/Declaration.h +1 -1
- package/cpp/rnskia/dom/base/DeclarationContext.h +7 -7
- package/cpp/rnskia/dom/base/DrawingContext.h +3 -3
- package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +2 -2
- package/cpp/rnskia/dom/nodes/JsiColorFilterNodes.h +1 -1
- package/cpp/rnskia/dom/nodes/JsiImageFilterNodes.h +1 -1
- package/cpp/rnskia/dom/nodes/JsiPathEffectNodes.h +1 -1
- package/cpp/rnskia/dom/nodes/JsiPathNode.h +1 -1
- package/cpp/rnskia/dom/nodes/JsiPointsNode.h +1 -1
- package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +1 -1
- package/cpp/rnskia/dom/props/BlendModeProp.h +1 -1
- package/cpp/rnskia/dom/props/BoxShadowProps.h +1 -1
- package/cpp/rnskia/dom/props/CircleProp.h +1 -1
- package/cpp/rnskia/dom/props/ClipProp.h +2 -2
- package/cpp/rnskia/dom/props/PaintProps.h +1 -1
- package/cpp/rnskia/dom/props/PathProp.h +1 -1
- package/cpp/rnskia/dom/props/PointProp.h +1 -1
- package/cpp/rnskia/dom/props/PointsProp.h +1 -1
- package/cpp/rnskia/dom/props/RRectProp.h +2 -2
- package/cpp/rnskia/dom/props/RSXformProp.h +1 -1
- package/cpp/rnskia/dom/props/RadiusProp.h +1 -1
- package/cpp/rnskia/dom/props/RectProp.h +1 -1
- package/cpp/rnskia/dom/props/StrokeProps.h +1 -1
- package/cpp/rnskia/dom/props/TileModeProp.h +1 -1
- package/cpp/rnskia/dom/props/UniformsProp.h +1 -1
- package/cpp/rnskia/dom/props/VertexModeProp.h +1 -1
- package/cpp/rnskia/dom/props/VerticesProps.h +1 -1
- package/cpp/skia/src/gpu/ganesh/gl/GrGLDefines.h +1158 -0
- package/cpp/utils/RNSkTypedArray.h +1 -1
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +6 -6
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +3 -3
- package/ios/RNSkia-iOS/SkiaDomView.mm +7 -7
- package/ios/RNSkia-iOS/SkiaDomViewManager.mm +7 -7
- package/ios/RNSkia-iOS/SkiaManager.h +1 -1
- package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.h +1 -1
- package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +5 -5
- package/ios/RNSkia-iOS/SkiaPictureView.mm +7 -7
- package/ios/RNSkia-iOS/SkiaPictureViewManager.mm +4 -4
- package/ios/RNSkia-iOS/SkiaUIView.h +3 -3
- package/ios/RNSkia-iOS/SkiaUIView.mm +2 -2
- package/ios/RNSkia-iOS/ViewScreenshotService.h +1 -1
- package/ios/RNSkia-iOS/ViewScreenshotService.mm +1 -1
- package/lib/commonjs/headless/index.d.ts +1 -0
- package/lib/commonjs/headless/index.js +17 -0
- package/lib/commonjs/headless/index.js.map +1 -1
- package/lib/module/headless/index.d.ts +1 -0
- package/lib/module/headless/index.js +1 -0
- package/lib/module/headless/index.js.map +1 -1
- package/lib/typescript/src/headless/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/headless/index.ts +2 -0
@@ -1,13 +1,13 @@
|
|
1
|
-
#import
|
2
|
-
#import
|
3
|
-
#import
|
1
|
+
#import "RNSkMetalCanvasProvider.h"
|
2
|
+
#import "RNSkLog.h"
|
3
|
+
#import "SkiaMetalSurfaceFactory.h"
|
4
4
|
|
5
5
|
#pragma clang diagnostic push
|
6
6
|
#pragma clang diagnostic ignored "-Wdocumentation"
|
7
7
|
|
8
|
-
#import "SkCanvas.h"
|
9
|
-
#import "SkColorSpace.h"
|
10
|
-
#import "SkSurface.h"
|
8
|
+
#import "include/core/SkCanvas.h"
|
9
|
+
#import "include/core/SkColorSpace.h"
|
10
|
+
#import "include/core/SkSurface.h"
|
11
11
|
|
12
12
|
#import <include/gpu/GrBackendSurface.h>
|
13
13
|
#import <include/gpu/GrDirectContext.h>
|
@@ -4,13 +4,13 @@
|
|
4
4
|
#include <thread>
|
5
5
|
#include <utility>
|
6
6
|
|
7
|
-
#include
|
7
|
+
#include "SkiaMetalSurfaceFactory.h"
|
8
8
|
|
9
9
|
#pragma clang diagnostic push
|
10
10
|
#pragma clang diagnostic ignored "-Wdocumentation"
|
11
11
|
|
12
|
-
#include "SkFontMgr.h"
|
13
|
-
#include "SkSurface.h"
|
12
|
+
#include "include/core/SkFontMgr.h"
|
13
|
+
#include "include/core/SkSurface.h"
|
14
14
|
|
15
15
|
#include "include/ports/SkFontMgr_mac_ct.h"
|
16
16
|
|
@@ -1,13 +1,13 @@
|
|
1
1
|
#ifdef RCT_NEW_ARCH_ENABLED
|
2
|
-
#import
|
2
|
+
#import "SkiaDomView.h"
|
3
3
|
|
4
|
-
#import
|
5
|
-
#import
|
6
|
-
#import
|
4
|
+
#import "RNSkDomView.h"
|
5
|
+
#import "RNSkIOSView.h"
|
6
|
+
#import "RNSkPlatformContext.h"
|
7
7
|
|
8
|
-
#import
|
9
|
-
#import
|
10
|
-
#import
|
8
|
+
#import "RNSkiaModule.h"
|
9
|
+
#import "SkiaManager.h"
|
10
|
+
#import "SkiaUIView.h"
|
11
11
|
|
12
12
|
#import <React/RCTBridge+Private.h>
|
13
13
|
#import <React/RCTConversions.h>
|
@@ -1,14 +1,14 @@
|
|
1
1
|
|
2
|
+
#include "SkiaDomViewManager.h"
|
2
3
|
#include <React/RCTBridge+Private.h>
|
3
|
-
#include <SkiaDomViewManager.h>
|
4
4
|
|
5
|
-
#include
|
6
|
-
#include
|
7
|
-
#include
|
5
|
+
#include "RNSkDomView.h"
|
6
|
+
#include "RNSkIOSView.h"
|
7
|
+
#include "RNSkPlatformContext.h"
|
8
8
|
|
9
|
-
#include
|
10
|
-
#include
|
11
|
-
#include
|
9
|
+
#include "RNSkiaModule.h"
|
10
|
+
#include "SkiaManager.h"
|
11
|
+
#include "SkiaUIView.h"
|
12
12
|
|
13
13
|
@implementation SkiaDomViewManager
|
14
14
|
|
@@ -1,13 +1,13 @@
|
|
1
|
-
#import
|
1
|
+
#import "RNSkLog.h"
|
2
2
|
|
3
|
-
#include
|
3
|
+
#include "SkiaMetalSurfaceFactory.h"
|
4
4
|
|
5
5
|
#pragma clang diagnostic push
|
6
6
|
#pragma clang diagnostic ignored "-Wdocumentation"
|
7
7
|
|
8
|
-
#import "SkCanvas.h"
|
9
|
-
#import "SkColorSpace.h"
|
10
|
-
#import "SkSurface.h"
|
8
|
+
#import "include/core/SkCanvas.h"
|
9
|
+
#import "include/core/SkColorSpace.h"
|
10
|
+
#import "include/core/SkSurface.h"
|
11
11
|
|
12
12
|
#import <include/gpu/GrBackendSurface.h>
|
13
13
|
#import <include/gpu/GrDirectContext.h>
|
@@ -1,13 +1,13 @@
|
|
1
1
|
#ifdef RCT_NEW_ARCH_ENABLED
|
2
|
-
#import
|
2
|
+
#import "SkiaPictureView.h"
|
3
3
|
|
4
|
-
#import
|
5
|
-
#import
|
6
|
-
#import
|
4
|
+
#import "RNSkIOSView.h"
|
5
|
+
#import "RNSkPictureView.h"
|
6
|
+
#import "RNSkPlatformContext.h"
|
7
7
|
|
8
|
-
#import
|
9
|
-
#import
|
10
|
-
#import
|
8
|
+
#import "RNSkiaModule.h"
|
9
|
+
#import "SkiaManager.h"
|
10
|
+
#import "SkiaUIView.h"
|
11
11
|
|
12
12
|
#import <React/RCTBridge+Private.h>
|
13
13
|
#import <React/RCTConversions.h>
|
@@ -2,13 +2,13 @@
|
|
2
2
|
#include "SkiaPictureViewManager.h"
|
3
3
|
#include <React/RCTBridge+Private.h>
|
4
4
|
|
5
|
-
#include
|
6
|
-
#include
|
7
|
-
#include
|
5
|
+
#include "RNSkIOSView.h"
|
6
|
+
#include "RNSkPictureView.h"
|
7
|
+
#include "RNSkPlatformContext.h"
|
8
8
|
|
9
|
+
#include "RNSkiaModule.h"
|
9
10
|
#include "SkiaManager.h"
|
10
11
|
#include "SkiaUIView.h"
|
11
|
-
#include <RNSkiaModule.h>
|
12
12
|
|
13
13
|
@implementation SkiaPictureViewManager
|
14
14
|
|
@@ -6,9 +6,9 @@
|
|
6
6
|
#import <CoreFoundation/CoreFoundation.h>
|
7
7
|
#import <UIKit/UIKit.h>
|
8
8
|
|
9
|
-
#import
|
10
|
-
#import
|
11
|
-
#import
|
9
|
+
#import "RNSkManager.h"
|
10
|
+
#import "RNSkiOSView.h"
|
11
|
+
#import "SkiaManager.h"
|
12
12
|
|
13
13
|
#if RCT_NEW_ARCH_ENABLED
|
14
14
|
#import <React/RCTViewComponentView.h>
|
@@ -1,12 +1,12 @@
|
|
1
1
|
#import <React/RCTBridge.h>
|
2
2
|
|
3
|
+
#import "RNSkiaModule.h"
|
3
4
|
#import "SkiaUIView.h"
|
4
|
-
#import <RNSkiaModule.h>
|
5
5
|
|
6
6
|
#include <utility>
|
7
7
|
#include <vector>
|
8
8
|
|
9
|
-
#import
|
9
|
+
#import "RNSkManager.h"
|
10
10
|
|
11
11
|
@implementation SkiaUIView {
|
12
12
|
std::shared_ptr<RNSkBaseiOSView> _impl;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { ReactNode } from "react";
|
2
2
|
import type { SkSurface } from "../skia";
|
3
|
+
export * from "../renderer/components";
|
3
4
|
export declare const makeOffscreenSurface: (width: number, height: number) => SkSurface;
|
4
5
|
export declare const getSkiaExports: () => {
|
5
6
|
Skia: import("../skia/types").Skia;
|
@@ -3,10 +3,27 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
+
var _exportNames = {
|
7
|
+
makeOffscreenSurface: true,
|
8
|
+
getSkiaExports: true,
|
9
|
+
drawOffscreen: true
|
10
|
+
};
|
6
11
|
exports.makeOffscreenSurface = exports.getSkiaExports = exports.drawOffscreen = void 0;
|
7
12
|
var _web = require("../skia/web");
|
8
13
|
var _Reconciler = require("../renderer/Reconciler");
|
9
14
|
var _types = require("../dom/types");
|
15
|
+
var _components = require("../renderer/components");
|
16
|
+
Object.keys(_components).forEach(function (key) {
|
17
|
+
if (key === "default" || key === "__esModule") return;
|
18
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
19
|
+
if (key in exports && exports[key] === _components[key]) return;
|
20
|
+
Object.defineProperty(exports, key, {
|
21
|
+
enumerable: true,
|
22
|
+
get: function () {
|
23
|
+
return _components[key];
|
24
|
+
}
|
25
|
+
});
|
26
|
+
});
|
10
27
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
11
28
|
// @ts-ignore
|
12
29
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_web","require","_Reconciler","_types","Skia","makeOffscreenSurface","width","height","JsiSkApi","CanvasKit","surface","Surface","MakeOffscreen","Error","
|
1
|
+
{"version":3,"names":["_web","require","_Reconciler","_types","_components","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","Skia","makeOffscreenSurface","width","height","JsiSkApi","CanvasKit","surface","Surface","MakeOffscreen","Error","getSkiaExports","drawOffscreen","element","root","SkiaRoot","render","canvas","getCanvas","ctx","JsiDrawingContext","dom","unmount","flush","makeImageSnapshot"],"sources":["index.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport CanvasKitInit from \"canvaskit-wasm/bin/full/canvaskit\";\nimport type { ReactNode } from \"react\";\n\nimport { JsiSkApi } from \"../skia/web\";\nimport { SkiaRoot } from \"../renderer/Reconciler\";\nimport { JsiDrawingContext } from \"../dom/types\";\nimport type { SkSurface } from \"../skia\";\n\nexport * from \"../renderer/components\";\n\nlet Skia: ReturnType<typeof JsiSkApi>;\n\nexport const makeOffscreenSurface = (width: number, height: number) => {\n if (!Skia) {\n Skia = JsiSkApi(CanvasKit);\n }\n const surface = Skia.Surface.MakeOffscreen(width, height);\n if (surface === null) {\n throw new Error(\"Couldn't create surface!\");\n }\n return surface;\n};\n\nexport const getSkiaExports = () => {\n if (!Skia) {\n Skia = JsiSkApi(CanvasKit);\n }\n return { Skia };\n};\n\nexport const drawOffscreen = (surface: SkSurface, element: ReactNode) => {\n const root = new SkiaRoot(Skia, false);\n root.render(element);\n const canvas = surface.getCanvas();\n const ctx = new JsiDrawingContext(Skia, canvas);\n root.dom.render(ctx);\n root.unmount();\n surface.flush();\n return surface.makeImageSnapshot();\n};\n"],"mappings":";;;;;;;;;;;AAKA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAGA,IAAAG,WAAA,GAAAH,OAAA;AAAAI,MAAA,CAAAC,IAAA,CAAAF,WAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,WAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,WAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAVA;AACA;;AAWA,IAAIS,IAAiC;AAE9B,MAAMC,oBAAoB,GAAGA,CAACC,KAAa,EAAEC,MAAc,KAAK;EACrE,IAAI,CAACH,IAAI,EAAE;IACTA,IAAI,GAAG,IAAAI,aAAQ,EAACC,SAAS,CAAC;EAC5B;EACA,MAAMC,OAAO,GAAGN,IAAI,CAACO,OAAO,CAACC,aAAa,CAACN,KAAK,EAAEC,MAAM,CAAC;EACzD,IAAIG,OAAO,KAAK,IAAI,EAAE;IACpB,MAAM,IAAIG,KAAK,CAAC,0BAA0B,CAAC;EAC7C;EACA,OAAOH,OAAO;AAChB,CAAC;AAACV,OAAA,CAAAK,oBAAA,GAAAA,oBAAA;AAEK,MAAMS,cAAc,GAAGA,CAAA,KAAM;EAClC,IAAI,CAACV,IAAI,EAAE;IACTA,IAAI,GAAG,IAAAI,aAAQ,EAACC,SAAS,CAAC;EAC5B;EACA,OAAO;IAAEL;EAAK,CAAC;AACjB,CAAC;AAACJ,OAAA,CAAAc,cAAA,GAAAA,cAAA;AAEK,MAAMC,aAAa,GAAGA,CAACL,OAAkB,EAAEM,OAAkB,KAAK;EACvE,MAAMC,IAAI,GAAG,IAAIC,oBAAQ,CAACd,IAAI,EAAE,KAAK,CAAC;EACtCa,IAAI,CAACE,MAAM,CAACH,OAAO,CAAC;EACpB,MAAMI,MAAM,GAAGV,OAAO,CAACW,SAAS,CAAC,CAAC;EAClC,MAAMC,GAAG,GAAG,IAAIC,wBAAiB,CAACnB,IAAI,EAAEgB,MAAM,CAAC;EAC/CH,IAAI,CAACO,GAAG,CAACL,MAAM,CAACG,GAAG,CAAC;EACpBL,IAAI,CAACQ,OAAO,CAAC,CAAC;EACdf,OAAO,CAACgB,KAAK,CAAC,CAAC;EACf,OAAOhB,OAAO,CAACiB,iBAAiB,CAAC,CAAC;AACpC,CAAC;AAAC3B,OAAA,CAAAe,aAAA,GAAAA,aAAA"}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { ReactNode } from "react";
|
2
2
|
import type { SkSurface } from "../skia";
|
3
|
+
export * from "../renderer/components";
|
3
4
|
export declare const makeOffscreenSurface: (width: number, height: number) => SkSurface;
|
4
5
|
export declare const getSkiaExports: () => {
|
5
6
|
Skia: import("../skia/types").Skia;
|
@@ -4,6 +4,7 @@
|
|
4
4
|
import { JsiSkApi } from "../skia/web";
|
5
5
|
import { SkiaRoot } from "../renderer/Reconciler";
|
6
6
|
import { JsiDrawingContext } from "../dom/types";
|
7
|
+
export * from "../renderer/components";
|
7
8
|
let Skia;
|
8
9
|
export const makeOffscreenSurface = (width, height) => {
|
9
10
|
if (!Skia) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["JsiSkApi","SkiaRoot","JsiDrawingContext","Skia","makeOffscreenSurface","width","height","CanvasKit","surface","Surface","MakeOffscreen","Error","getSkiaExports","drawOffscreen","element","root","render","canvas","getCanvas","ctx","dom","unmount","flush","makeImageSnapshot"],"sources":["index.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport CanvasKitInit from \"canvaskit-wasm/bin/full/canvaskit\";\nimport type { ReactNode } from \"react\";\n\nimport { JsiSkApi } from \"../skia/web\";\nimport { SkiaRoot } from \"../renderer/Reconciler\";\nimport { JsiDrawingContext } from \"../dom/types\";\nimport type { SkSurface } from \"../skia\";\n\nlet Skia: ReturnType<typeof JsiSkApi>;\n\nexport const makeOffscreenSurface = (width: number, height: number) => {\n if (!Skia) {\n Skia = JsiSkApi(CanvasKit);\n }\n const surface = Skia.Surface.MakeOffscreen(width, height);\n if (surface === null) {\n throw new Error(\"Couldn't create surface!\");\n }\n return surface;\n};\n\nexport const getSkiaExports = () => {\n if (!Skia) {\n Skia = JsiSkApi(CanvasKit);\n }\n return { Skia };\n};\n\nexport const drawOffscreen = (surface: SkSurface, element: ReactNode) => {\n const root = new SkiaRoot(Skia, false);\n root.render(element);\n const canvas = surface.getCanvas();\n const ctx = new JsiDrawingContext(Skia, canvas);\n root.dom.render(ctx);\n root.unmount();\n surface.flush();\n return surface.makeImageSnapshot();\n};\n"],"mappings":"AAAA;AACA;;AAIA,SAASA,QAAQ,QAAQ,aAAa;AACtC,SAASC,QAAQ,QAAQ,wBAAwB;AACjD,SAASC,iBAAiB,QAAQ,cAAc;AAGhD,IAAIC,IAAiC;AAErC,OAAO,MAAMC,oBAAoB,GAAGA,CAACC,KAAa,EAAEC,MAAc,KAAK;EACrE,IAAI,CAACH,IAAI,EAAE;IACTA,IAAI,GAAGH,QAAQ,CAACO,SAAS,CAAC;EAC5B;EACA,MAAMC,OAAO,GAAGL,IAAI,CAACM,OAAO,CAACC,aAAa,CAACL,KAAK,EAAEC,MAAM,CAAC;EACzD,IAAIE,OAAO,KAAK,IAAI,EAAE;IACpB,MAAM,IAAIG,KAAK,CAAC,0BAA0B,CAAC;EAC7C;EACA,OAAOH,OAAO;AAChB,CAAC;AAED,OAAO,MAAMI,cAAc,GAAGA,CAAA,KAAM;EAClC,IAAI,CAACT,IAAI,EAAE;IACTA,IAAI,GAAGH,QAAQ,CAACO,SAAS,CAAC;EAC5B;EACA,OAAO;IAAEJ;EAAK,CAAC;AACjB,CAAC;AAED,OAAO,MAAMU,aAAa,GAAGA,CAACL,OAAkB,EAAEM,OAAkB,KAAK;EACvE,MAAMC,IAAI,GAAG,IAAId,QAAQ,CAACE,IAAI,EAAE,KAAK,CAAC;EACtCY,IAAI,CAACC,MAAM,CAACF,OAAO,CAAC;EACpB,MAAMG,MAAM,GAAGT,OAAO,CAACU,SAAS,CAAC,CAAC;EAClC,MAAMC,GAAG,GAAG,IAAIjB,iBAAiB,CAACC,IAAI,EAAEc,MAAM,CAAC;EAC/CF,IAAI,CAACK,GAAG,CAACJ,MAAM,CAACG,GAAG,CAAC;EACpBJ,IAAI,CAACM,OAAO,CAAC,CAAC;EACdb,OAAO,CAACc,KAAK,CAAC,CAAC;EACf,OAAOd,OAAO,CAACe,iBAAiB,CAAC,CAAC;AACpC,CAAC"}
|
1
|
+
{"version":3,"names":["JsiSkApi","SkiaRoot","JsiDrawingContext","Skia","makeOffscreenSurface","width","height","CanvasKit","surface","Surface","MakeOffscreen","Error","getSkiaExports","drawOffscreen","element","root","render","canvas","getCanvas","ctx","dom","unmount","flush","makeImageSnapshot"],"sources":["index.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport CanvasKitInit from \"canvaskit-wasm/bin/full/canvaskit\";\nimport type { ReactNode } from \"react\";\n\nimport { JsiSkApi } from \"../skia/web\";\nimport { SkiaRoot } from \"../renderer/Reconciler\";\nimport { JsiDrawingContext } from \"../dom/types\";\nimport type { SkSurface } from \"../skia\";\n\nexport * from \"../renderer/components\";\n\nlet Skia: ReturnType<typeof JsiSkApi>;\n\nexport const makeOffscreenSurface = (width: number, height: number) => {\n if (!Skia) {\n Skia = JsiSkApi(CanvasKit);\n }\n const surface = Skia.Surface.MakeOffscreen(width, height);\n if (surface === null) {\n throw new Error(\"Couldn't create surface!\");\n }\n return surface;\n};\n\nexport const getSkiaExports = () => {\n if (!Skia) {\n Skia = JsiSkApi(CanvasKit);\n }\n return { Skia };\n};\n\nexport const drawOffscreen = (surface: SkSurface, element: ReactNode) => {\n const root = new SkiaRoot(Skia, false);\n root.render(element);\n const canvas = surface.getCanvas();\n const ctx = new JsiDrawingContext(Skia, canvas);\n root.dom.render(ctx);\n root.unmount();\n surface.flush();\n return surface.makeImageSnapshot();\n};\n"],"mappings":"AAAA;AACA;;AAIA,SAASA,QAAQ,QAAQ,aAAa;AACtC,SAASC,QAAQ,QAAQ,wBAAwB;AACjD,SAASC,iBAAiB,QAAQ,cAAc;AAGhD,cAAc,wBAAwB;AAEtC,IAAIC,IAAiC;AAErC,OAAO,MAAMC,oBAAoB,GAAGA,CAACC,KAAa,EAAEC,MAAc,KAAK;EACrE,IAAI,CAACH,IAAI,EAAE;IACTA,IAAI,GAAGH,QAAQ,CAACO,SAAS,CAAC;EAC5B;EACA,MAAMC,OAAO,GAAGL,IAAI,CAACM,OAAO,CAACC,aAAa,CAACL,KAAK,EAAEC,MAAM,CAAC;EACzD,IAAIE,OAAO,KAAK,IAAI,EAAE;IACpB,MAAM,IAAIG,KAAK,CAAC,0BAA0B,CAAC;EAC7C;EACA,OAAOH,OAAO;AAChB,CAAC;AAED,OAAO,MAAMI,cAAc,GAAGA,CAAA,KAAM;EAClC,IAAI,CAACT,IAAI,EAAE;IACTA,IAAI,GAAGH,QAAQ,CAACO,SAAS,CAAC;EAC5B;EACA,OAAO;IAAEJ;EAAK,CAAC;AACjB,CAAC;AAED,OAAO,MAAMU,aAAa,GAAGA,CAACL,OAAkB,EAAEM,OAAkB,KAAK;EACvE,MAAMC,IAAI,GAAG,IAAId,QAAQ,CAACE,IAAI,EAAE,KAAK,CAAC;EACtCY,IAAI,CAACC,MAAM,CAACF,OAAO,CAAC;EACpB,MAAMG,MAAM,GAAGT,OAAO,CAACU,SAAS,CAAC,CAAC;EAClC,MAAMC,GAAG,GAAG,IAAIjB,iBAAiB,CAACC,IAAI,EAAEc,MAAM,CAAC;EAC/CF,IAAI,CAACK,GAAG,CAACJ,MAAM,CAACG,GAAG,CAAC;EACpBJ,IAAI,CAACM,OAAO,CAAC,CAAC;EACdb,OAAO,CAACc,KAAK,CAAC,CAAC;EACf,OAAOd,OAAO,CAACe,iBAAiB,CAAC,CAAC;AACpC,CAAC"}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { ReactNode } from "react";
|
2
2
|
import type { SkSurface } from "../skia";
|
3
|
+
export * from "../renderer/components";
|
3
4
|
export declare const makeOffscreenSurface: (width: number, height: number) => SkSurface;
|
4
5
|
export declare const getSkiaExports: () => {
|
5
6
|
Skia: import("../skia/types").Skia;
|
package/package.json
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
"setup-skia-web": "./scripts/setup-canvaskit.js"
|
8
8
|
},
|
9
9
|
"title": "React Native Skia",
|
10
|
-
"version": "1.0.
|
10
|
+
"version": "1.0.6",
|
11
11
|
"description": "High-performance React Native Graphics using Skia",
|
12
12
|
"main": "lib/module/index.js",
|
13
13
|
"react-native": "src/index.ts",
|
package/src/headless/index.ts
CHANGED
@@ -8,6 +8,8 @@ import { SkiaRoot } from "../renderer/Reconciler";
|
|
8
8
|
import { JsiDrawingContext } from "../dom/types";
|
9
9
|
import type { SkSurface } from "../skia";
|
10
10
|
|
11
|
+
export * from "../renderer/components";
|
12
|
+
|
11
13
|
let Skia: ReturnType<typeof JsiSkApi>;
|
12
14
|
|
13
15
|
export const makeOffscreenSurface = (width: number, height: number) => {
|