@shopify/react-native-skia 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +3 -3
- package/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java +13 -8
- package/cpp/api/JsiNativeBuffer.h +43 -0
- package/cpp/api/JsiSkApi.h +3 -3
- package/cpp/api/JsiSkImageFactory.h +3 -3
- package/cpp/rnskia/RNSkPlatformContext.h +5 -5
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +3 -3
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +70 -93
- package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.h +119 -0
- package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.mm +332 -0
- package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.h +2 -1
- package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +27 -6
- package/lib/commonjs/external/ModuleProxy.d.ts +10 -0
- package/lib/commonjs/external/ModuleProxy.js +36 -0
- package/lib/commonjs/external/ModuleProxy.js.map +1 -0
- package/lib/commonjs/external/reanimated/ReanimatedProxy.d.ts +3 -0
- package/lib/commonjs/external/reanimated/ReanimatedProxy.js +18 -0
- package/lib/commonjs/external/reanimated/ReanimatedProxy.js.map +1 -0
- package/lib/commonjs/external/reanimated/buffers.js +9 -6
- package/lib/commonjs/external/reanimated/buffers.js.map +1 -1
- package/lib/commonjs/external/reanimated/interpolators.js +8 -7
- package/lib/commonjs/external/reanimated/interpolators.js.map +1 -1
- package/lib/commonjs/external/reanimated/renderHelpers.js +27 -11
- package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/commonjs/external/reanimated/textures.js +4 -3
- package/lib/commonjs/external/reanimated/textures.js.map +1 -1
- package/lib/commonjs/external/reanimated/useAnimatedImageValue.js +6 -6
- package/lib/commonjs/external/reanimated/useAnimatedImageValue.js.map +1 -1
- package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js +6 -5
- package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js.map +1 -1
- package/lib/commonjs/renderer/Offscreen.js +1 -5
- package/lib/commonjs/renderer/Offscreen.js.map +1 -1
- package/lib/commonjs/skia/types/Image/ImageFactory.d.ts +8 -15
- package/lib/commonjs/skia/types/Image/ImageFactory.js +1 -10
- package/lib/commonjs/skia/types/Image/ImageFactory.js.map +1 -1
- package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.d.ts +18 -0
- package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js +13 -0
- package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -0
- package/lib/commonjs/skia/types/NativeBuffer/index.d.ts +1 -0
- package/lib/commonjs/skia/types/NativeBuffer/index.js +17 -0
- package/lib/commonjs/skia/types/NativeBuffer/index.js.map +1 -0
- package/lib/commonjs/skia/types/Skia.d.ts +2 -2
- package/lib/commonjs/skia/types/Skia.js.map +1 -1
- package/lib/commonjs/skia/types/index.d.ts +1 -1
- package/lib/commonjs/skia/types/index.js +4 -4
- package/lib/commonjs/skia/types/index.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +3 -2
- package/lib/commonjs/skia/web/JsiSkImageFactory.js +18 -2
- package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkNativeBufferFactory.d.ts +8 -0
- package/lib/commonjs/skia/web/JsiSkNativeBufferFactory.js +29 -0
- package/lib/commonjs/skia/web/JsiSkNativeBufferFactory.js.map +1 -0
- package/lib/commonjs/skia/web/JsiSkia.js +2 -2
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/commonjs/specs/NativeSkiaModule.web.d.ts +0 -2
- package/lib/commonjs/specs/NativeSkiaModule.web.js +0 -8
- package/lib/commonjs/specs/NativeSkiaModule.web.js.map +1 -1
- package/lib/module/external/ModuleProxy.d.ts +10 -0
- package/lib/module/external/ModuleProxy.js +28 -0
- package/lib/module/external/ModuleProxy.js.map +1 -0
- package/lib/module/external/reanimated/ReanimatedProxy.d.ts +3 -0
- package/lib/module/external/reanimated/ReanimatedProxy.js +12 -0
- package/lib/module/external/reanimated/ReanimatedProxy.js.map +1 -0
- package/lib/module/external/reanimated/buffers.js +8 -6
- package/lib/module/external/reanimated/buffers.js.map +1 -1
- package/lib/module/external/reanimated/interpolators.js +7 -7
- package/lib/module/external/reanimated/interpolators.js.map +1 -1
- package/lib/module/external/reanimated/renderHelpers.js +26 -11
- package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/module/external/reanimated/textures.js +3 -3
- package/lib/module/external/reanimated/textures.js.map +1 -1
- package/lib/module/external/reanimated/useAnimatedImageValue.js +5 -6
- package/lib/module/external/reanimated/useAnimatedImageValue.js.map +1 -1
- package/lib/module/external/reanimated/useDerivedValueOnJS.js +5 -5
- package/lib/module/external/reanimated/useDerivedValueOnJS.js.map +1 -1
- package/lib/module/renderer/Offscreen.js +1 -5
- package/lib/module/renderer/Offscreen.js.map +1 -1
- package/lib/module/skia/types/Image/ImageFactory.d.ts +8 -15
- package/lib/module/skia/types/Image/ImageFactory.js +1 -10
- package/lib/module/skia/types/Image/ImageFactory.js.map +1 -1
- package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.d.ts +18 -0
- package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js +4 -0
- package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -0
- package/lib/module/skia/types/NativeBuffer/index.d.ts +1 -0
- package/lib/module/skia/types/NativeBuffer/index.js +2 -0
- package/lib/module/skia/types/NativeBuffer/index.js.map +1 -0
- package/lib/module/skia/types/Skia.d.ts +2 -2
- package/lib/module/skia/types/Skia.js.map +1 -1
- package/lib/module/skia/types/index.d.ts +1 -1
- package/lib/module/skia/types/index.js +1 -1
- package/lib/module/skia/types/index.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFactory.d.ts +3 -2
- package/lib/module/skia/web/JsiSkImageFactory.js +18 -2
- package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkNativeBufferFactory.d.ts +8 -0
- package/lib/module/skia/web/JsiSkNativeBufferFactory.js +22 -0
- package/lib/module/skia/web/JsiSkNativeBufferFactory.js.map +1 -0
- package/lib/module/skia/web/JsiSkia.js +2 -2
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/specs/NativeSkiaModule.web.d.ts +0 -2
- package/lib/module/specs/NativeSkiaModule.web.js +0 -3
- package/lib/module/specs/NativeSkiaModule.web.js.map +1 -1
- package/lib/typescript/src/external/ModuleProxy.d.ts +10 -0
- package/lib/typescript/src/external/reanimated/ReanimatedProxy.d.ts +3 -0
- package/lib/typescript/src/skia/types/Image/ImageFactory.d.ts +8 -15
- package/lib/typescript/src/skia/types/NativeBuffer/NativeBufferFactory.d.ts +18 -0
- package/lib/typescript/src/skia/types/NativeBuffer/index.d.ts +1 -0
- package/lib/typescript/src/skia/types/Skia.d.ts +2 -2
- package/lib/typescript/src/skia/types/index.d.ts +1 -1
- package/lib/typescript/src/skia/web/JsiSkImageFactory.d.ts +3 -2
- package/lib/typescript/src/skia/web/JsiSkNativeBufferFactory.d.ts +8 -0
- package/lib/typescript/src/specs/NativeSkiaModule.web.d.ts +0 -2
- package/libs/ios/libskia.xcframework/Info.plist +5 -5
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskottie.xcframework/Info.plist +5 -5
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
- package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +1 -1
- package/src/external/ModuleProxy.ts +30 -0
- package/src/external/reanimated/ReanimatedProxy.ts +18 -0
- package/src/external/reanimated/buffers.ts +7 -6
- package/src/external/reanimated/interpolators.ts +7 -12
- package/src/external/reanimated/renderHelpers.ts +31 -18
- package/src/external/reanimated/textures.tsx +3 -3
- package/src/external/reanimated/useAnimatedImageValue.ts +5 -10
- package/src/external/reanimated/useDerivedValueOnJS.ts +5 -10
- package/src/renderer/Offscreen.tsx +1 -7
- package/src/skia/types/Image/ImageFactory.ts +7 -23
- package/src/skia/types/NativeBuffer/NativeBufferFactory.ts +38 -0
- package/src/skia/types/NativeBuffer/index.ts +1 -0
- package/src/skia/types/Skia.ts +2 -2
- package/src/skia/types/index.ts +1 -1
- package/src/skia/web/JsiSkImageFactory.ts +28 -6
- package/src/skia/web/JsiSkNativeBufferFactory.ts +35 -0
- package/src/skia/web/JsiSkia.ts +2 -2
- package/src/specs/NativeSkiaModule.web.ts +0 -4
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaDrawViewManagerDelegate.java +0 -34
- package/cpp/api/JsiPlatformBuffer.h +0 -51
- package/cpp/skia/include/gpu/GrBackendDrawableInfo.h +0 -9
- package/lib/commonjs/external/reanimated/moduleWrapper.d.ts +0 -15
- package/lib/commonjs/external/reanimated/moduleWrapper.js +0 -46
- package/lib/commonjs/external/reanimated/moduleWrapper.js.map +0 -1
- package/lib/commonjs/skia/types/PlatformBuffer/PlatformBufferFactory.d.ts +0 -12
- package/lib/commonjs/skia/types/PlatformBuffer/PlatformBufferFactory.js +0 -6
- package/lib/commonjs/skia/types/PlatformBuffer/PlatformBufferFactory.js.map +0 -1
- package/lib/commonjs/skia/types/PlatformBuffer/index.d.ts +0 -1
- package/lib/commonjs/skia/types/PlatformBuffer/index.js +0 -17
- package/lib/commonjs/skia/types/PlatformBuffer/index.js.map +0 -1
- package/lib/commonjs/skia/web/JsiSkPlatformBufferFactory.d.ts +0 -8
- package/lib/commonjs/skia/web/JsiSkPlatformBufferFactory.js +0 -20
- package/lib/commonjs/skia/web/JsiSkPlatformBufferFactory.js.map +0 -1
- package/lib/module/external/reanimated/moduleWrapper.d.ts +0 -15
- package/lib/module/external/reanimated/moduleWrapper.js +0 -37
- package/lib/module/external/reanimated/moduleWrapper.js.map +0 -1
- package/lib/module/skia/types/PlatformBuffer/PlatformBufferFactory.d.ts +0 -12
- package/lib/module/skia/types/PlatformBuffer/PlatformBufferFactory.js +0 -2
- package/lib/module/skia/types/PlatformBuffer/PlatformBufferFactory.js.map +0 -1
- package/lib/module/skia/types/PlatformBuffer/index.d.ts +0 -1
- package/lib/module/skia/types/PlatformBuffer/index.js +0 -2
- package/lib/module/skia/types/PlatformBuffer/index.js.map +0 -1
- package/lib/module/skia/web/JsiSkPlatformBufferFactory.d.ts +0 -8
- package/lib/module/skia/web/JsiSkPlatformBufferFactory.js +0 -13
- package/lib/module/skia/web/JsiSkPlatformBufferFactory.js.map +0 -1
- package/lib/typescript/src/external/reanimated/moduleWrapper.d.ts +0 -15
- package/lib/typescript/src/skia/types/PlatformBuffer/PlatformBufferFactory.d.ts +0 -12
- package/lib/typescript/src/skia/types/PlatformBuffer/index.d.ts +0 -1
- package/lib/typescript/src/skia/web/JsiSkPlatformBufferFactory.d.ts +0 -8
- package/src/external/reanimated/moduleWrapper.ts +0 -83
- package/src/skia/types/PlatformBuffer/PlatformBufferFactory.ts +0 -14
- package/src/skia/types/PlatformBuffer/index.ts +0 -1
- package/src/skia/web/JsiSkPlatformBufferFactory.ts +0 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["JsiSkPoint","JsiSkPaint","JsiSkRect","Color","JsiSkSurfaceFactory","JsiSkRRect","JsiSkRSXform","JsiSkContourMeasureIter","JsiSkPictureRecorder","JsiSkPictureFactory","JsiSkPathFactory","JsiSkMatrix","JsiSkColorFilterFactory","JsiSkTypefaceFactory","JsiSkMaskFilterFactory","JsiSkRuntimeEffectFactory","JsiSkImageFilterFactory","JsiSkShaderFactory","JsiSkPathEffectFactory","JsiSkDataFactory","JsiSkImageFactory","JsiSkSVGFactory","JsiSkTextBlobFactory","JsiSkFont","MakeVertices","JsiSkPath","JsiSkTypeface","JsiSkTypefaceFontProviderFactory","JsiSkFontMgrFactory","JsiSkAnimatedImageFactory","JsiSkParagraphBuilderFactory","JsiSkPlatformBufferFactory","JsiSkApi","CanvasKit","Point","x","y","Float32Array","of","RuntimeShaderBuilder","_","Error","RRectXY","rect","rx","ry","RSXform","scos","ssin","tx","ty","RSXformFromRadians","scale","r","px","py","s","Math","sin","c","cos","ContourMeasureIter","path","forceClosed","resScale","fromValue","Paint","paint","setAntiAlias","PictureRecorder","Picture","Path","Matrix","matrix","identity","ColorFilter","Font","typeface","size","undefined","Typeface","MaskFilter","RuntimeEffect","ImageFilter","Shader","PathEffect","bind","Data","Image","AnimatedImage","SVG","TextBlob","XYWHRect","width","height","Surface","TypefaceFontProvider","FontMgr","ParagraphBuilder","PlatformBuffer"],"sources":["JsiSkia.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n SkContourMeasureIter,\n Skia,\n SkPath,\n SkRect,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n SkTypeface,\n} from \"../types\";\n\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { Color } from \"./JsiSkColor\";\nimport { JsiSkSurfaceFactory } from \"./JsiSkSurfaceFactory\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\nimport { JsiSkContourMeasureIter } from \"./JsiSkContourMeasureIter\";\nimport { JsiSkPictureRecorder } from \"./JsiSkPictureRecorder\";\nimport { JsiSkPictureFactory } from \"./JsiSkPictureFactory\";\nimport { JsiSkPathFactory } from \"./JsiSkPathFactory\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkColorFilterFactory } from \"./JsiSkColorFilterFactory\";\nimport { JsiSkTypefaceFactory } from \"./JsiSkTypefaceFactory\";\nimport { JsiSkMaskFilterFactory } from \"./JsiSkMaskFilterFactory\";\nimport { JsiSkRuntimeEffectFactory } from \"./JsiSkRuntimeEffectFactory\";\nimport { JsiSkImageFilterFactory } from \"./JsiSkImageFilterFactory\";\nimport { JsiSkShaderFactory } from \"./JsiSkShaderFactory\";\nimport { JsiSkPathEffectFactory } from \"./JsiSkPathEffectFactory\";\nimport { JsiSkDataFactory } from \"./JsiSkDataFactory\";\nimport { JsiSkImageFactory } from \"./JsiSkImageFactory\";\nimport { JsiSkSVGFactory } from \"./JsiSkSVGFactory\";\nimport { JsiSkTextBlobFactory } from \"./JsiSkTextBlobFactory\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { MakeVertices } from \"./JsiSkVerticesFactory\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\nimport { JsiSkTypefaceFontProviderFactory } from \"./JsiSkTypefaceFontProviderFactory\";\nimport { JsiSkFontMgrFactory } from \"./JsiSkFontMgrFactory\";\nimport { JsiSkAnimatedImageFactory } from \"./JsiSkAnimatedImageFactory\";\nimport { JsiSkParagraphBuilderFactory } from \"./JsiSkParagraphBuilderFactory\";\nimport { JsiSkPlatformBufferFactory } from \"./JsiSkPlatformBufferFactory\";\n\nexport const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({\n Point: (x: number, y: number) =>\n new JsiSkPoint(CanvasKit, Float32Array.of(x, y)),\n RuntimeShaderBuilder: (_: SkRuntimeEffect): SkRuntimeShaderBuilder => {\n throw new Error(\"Not implemented on React Native Web\");\n },\n RRectXY: (rect: SkRect, rx: number, ry: number) =>\n new JsiSkRRect(CanvasKit, rect, rx, ry),\n RSXform: (scos: number, ssin: number, tx: number, ty: number) =>\n new JsiSkRSXform(CanvasKit, Float32Array.of(scos, ssin, tx, ty)),\n RSXformFromRadians: (\n scale: number,\n r: number,\n tx: number,\n ty: number,\n px: number,\n py: number\n ) => {\n const s = Math.sin(r) * scale;\n const c = Math.cos(r) * scale;\n return new JsiSkRSXform(\n CanvasKit,\n Float32Array.of(c, s, tx - c * px + s * py, ty - s * px - c * py)\n );\n },\n Color,\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ): SkContourMeasureIter =>\n new JsiSkContourMeasureIter(\n CanvasKit,\n new CanvasKit.ContourMeasureIter(\n JsiSkPath.fromValue(path),\n forceClosed,\n resScale\n )\n ),\n Paint: () => {\n const paint = new JsiSkPaint(CanvasKit, new CanvasKit.Paint());\n paint.setAntiAlias(true);\n return paint;\n },\n PictureRecorder: () =>\n new JsiSkPictureRecorder(CanvasKit, new CanvasKit.PictureRecorder()),\n Picture: new JsiSkPictureFactory(CanvasKit),\n Path: new JsiSkPathFactory(CanvasKit),\n Matrix: (matrix?: readonly number[]) =>\n new JsiSkMatrix(\n CanvasKit,\n matrix\n ? Float32Array.of(...matrix)\n : Float32Array.of(...CanvasKit.Matrix.identity())\n ),\n ColorFilter: new JsiSkColorFilterFactory(CanvasKit),\n Font: (typeface?: SkTypeface, size?: number) =>\n new JsiSkFont(\n CanvasKit,\n new CanvasKit.Font(\n typeface === undefined ? null : JsiSkTypeface.fromValue(typeface),\n size\n )\n ),\n Typeface: new JsiSkTypefaceFactory(CanvasKit),\n MaskFilter: new JsiSkMaskFilterFactory(CanvasKit),\n RuntimeEffect: new JsiSkRuntimeEffectFactory(CanvasKit),\n ImageFilter: new JsiSkImageFilterFactory(CanvasKit),\n Shader: new JsiSkShaderFactory(CanvasKit),\n PathEffect: new JsiSkPathEffectFactory(CanvasKit),\n MakeVertices: MakeVertices.bind(null, CanvasKit),\n Data: new JsiSkDataFactory(CanvasKit),\n Image: new JsiSkImageFactory(CanvasKit),\n AnimatedImage: new JsiSkAnimatedImageFactory(CanvasKit),\n SVG: new JsiSkSVGFactory(CanvasKit),\n TextBlob: new JsiSkTextBlobFactory(CanvasKit),\n XYWHRect: (x: number, y: number, width: number, height: number) => {\n return new JsiSkRect(CanvasKit, CanvasKit.XYWHRect(x, y, width, height));\n },\n Surface: new JsiSkSurfaceFactory(CanvasKit),\n TypefaceFontProvider: new JsiSkTypefaceFontProviderFactory(CanvasKit),\n FontMgr: new JsiSkFontMgrFactory(CanvasKit),\n ParagraphBuilder: new JsiSkParagraphBuilderFactory(CanvasKit),\n PlatformBuffer: new JsiSkPlatformBufferFactory(CanvasKit),\n});\n"],"mappings":"AAYA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,KAAK,QAAQ,cAAc;AACpC,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,WAAW,QAAQ,eAA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AAQ,EAAEA,CAACzD,CAAS,EAAEC,CAAS,EAAEyD,KAAa,EAAEC,MAAc,KAAK;IACjE,OAAO,IAAI5F,SAAS,CAAC+B,SAAS,EAAEA,SAAS,CAAC2D,QAAQ,CAACzD,CAAC,EAAEC,CAAC,EAAEyD,KAAK,EAAEC,MAAM,CAAC,CAAC;EAC1E,CAAC;EACDC,OAAO,EAAE,IAAI3F,mBAAmB,CAAC6B,SAAS,CAAC;EAC3C+D,oBAAoB,EAAE,IAAIrE,gCAAgC,CAACM,SAAS,CAAC;EACrEgE,OAAO,EAAE,IAAIrE,mBAAmB,CAACK,SAAS,CAAC;EAC3CiE,gBAAgB,EAAE,IAAIpE,4BAA4B,CAACG,SAAS,CAAC;EAC7DkE,cAAc,EAAE,IAAIpE,0BAA0B,CAACE,SAAS;AAC1D,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"names":["JsiSkPoint","JsiSkPaint","JsiSkRect","Color","JsiSkSurfaceFactory","JsiSkRRect","JsiSkRSXform","JsiSkContourMeasureIter","JsiSkPictureRecorder","JsiSkPictureFactory","JsiSkPathFactory","JsiSkMatrix","JsiSkColorFilterFactory","JsiSkTypefaceFactory","JsiSkMaskFilterFactory","JsiSkRuntimeEffectFactory","JsiSkImageFilterFactory","JsiSkShaderFactory","JsiSkPathEffectFactory","JsiSkDataFactory","JsiSkImageFactory","JsiSkSVGFactory","JsiSkTextBlobFactory","JsiSkFont","MakeVertices","JsiSkPath","JsiSkTypeface","JsiSkTypefaceFontProviderFactory","JsiSkFontMgrFactory","JsiSkAnimatedImageFactory","JsiSkParagraphBuilderFactory","JsiSkNativeBufferFactory","JsiSkApi","CanvasKit","Point","x","y","Float32Array","of","RuntimeShaderBuilder","_","Error","RRectXY","rect","rx","ry","RSXform","scos","ssin","tx","ty","RSXformFromRadians","scale","r","px","py","s","Math","sin","c","cos","ContourMeasureIter","path","forceClosed","resScale","fromValue","Paint","paint","setAntiAlias","PictureRecorder","Picture","Path","Matrix","matrix","identity","ColorFilter","Font","typeface","size","undefined","Typeface","MaskFilter","RuntimeEffect","ImageFilter","Shader","PathEffect","bind","Data","Image","AnimatedImage","SVG","TextBlob","XYWHRect","width","height","Surface","TypefaceFontProvider","FontMgr","ParagraphBuilder","NativeBuffer"],"sources":["JsiSkia.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n SkContourMeasureIter,\n Skia,\n SkPath,\n SkRect,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n SkTypeface,\n} from \"../types\";\n\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { Color } from \"./JsiSkColor\";\nimport { JsiSkSurfaceFactory } from \"./JsiSkSurfaceFactory\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\nimport { JsiSkContourMeasureIter } from \"./JsiSkContourMeasureIter\";\nimport { JsiSkPictureRecorder } from \"./JsiSkPictureRecorder\";\nimport { JsiSkPictureFactory } from \"./JsiSkPictureFactory\";\nimport { JsiSkPathFactory } from \"./JsiSkPathFactory\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkColorFilterFactory } from \"./JsiSkColorFilterFactory\";\nimport { JsiSkTypefaceFactory } from \"./JsiSkTypefaceFactory\";\nimport { JsiSkMaskFilterFactory } from \"./JsiSkMaskFilterFactory\";\nimport { JsiSkRuntimeEffectFactory } from \"./JsiSkRuntimeEffectFactory\";\nimport { JsiSkImageFilterFactory } from \"./JsiSkImageFilterFactory\";\nimport { JsiSkShaderFactory } from \"./JsiSkShaderFactory\";\nimport { JsiSkPathEffectFactory } from \"./JsiSkPathEffectFactory\";\nimport { JsiSkDataFactory } from \"./JsiSkDataFactory\";\nimport { JsiSkImageFactory } from \"./JsiSkImageFactory\";\nimport { JsiSkSVGFactory } from \"./JsiSkSVGFactory\";\nimport { JsiSkTextBlobFactory } from \"./JsiSkTextBlobFactory\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { MakeVertices } from \"./JsiSkVerticesFactory\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\nimport { JsiSkTypefaceFontProviderFactory } from \"./JsiSkTypefaceFontProviderFactory\";\nimport { JsiSkFontMgrFactory } from \"./JsiSkFontMgrFactory\";\nimport { JsiSkAnimatedImageFactory } from \"./JsiSkAnimatedImageFactory\";\nimport { JsiSkParagraphBuilderFactory } from \"./JsiSkParagraphBuilderFactory\";\nimport { JsiSkNativeBufferFactory } from \"./JsiSkNativeBufferFactory\";\n\nexport const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({\n Point: (x: number, y: number) =>\n new JsiSkPoint(CanvasKit, Float32Array.of(x, y)),\n RuntimeShaderBuilder: (_: SkRuntimeEffect): SkRuntimeShaderBuilder => {\n throw new Error(\"Not implemented on React Native Web\");\n },\n RRectXY: (rect: SkRect, rx: number, ry: number) =>\n new JsiSkRRect(CanvasKit, rect, rx, ry),\n RSXform: (scos: number, ssin: number, tx: number, ty: number) =>\n new JsiSkRSXform(CanvasKit, Float32Array.of(scos, ssin, tx, ty)),\n RSXformFromRadians: (\n scale: number,\n r: number,\n tx: number,\n ty: number,\n px: number,\n py: number\n ) => {\n const s = Math.sin(r) * scale;\n const c = Math.cos(r) * scale;\n return new JsiSkRSXform(\n CanvasKit,\n Float32Array.of(c, s, tx - c * px + s * py, ty - s * px - c * py)\n );\n },\n Color,\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ): SkContourMeasureIter =>\n new JsiSkContourMeasureIter(\n CanvasKit,\n new CanvasKit.ContourMeasureIter(\n JsiSkPath.fromValue(path),\n forceClosed,\n resScale\n )\n ),\n Paint: () => {\n const paint = new JsiSkPaint(CanvasKit, new CanvasKit.Paint());\n paint.setAntiAlias(true);\n return paint;\n },\n PictureRecorder: () =>\n new JsiSkPictureRecorder(CanvasKit, new CanvasKit.PictureRecorder()),\n Picture: new JsiSkPictureFactory(CanvasKit),\n Path: new JsiSkPathFactory(CanvasKit),\n Matrix: (matrix?: readonly number[]) =>\n new JsiSkMatrix(\n CanvasKit,\n matrix\n ? Float32Array.of(...matrix)\n : Float32Array.of(...CanvasKit.Matrix.identity())\n ),\n ColorFilter: new JsiSkColorFilterFactory(CanvasKit),\n Font: (typeface?: SkTypeface, size?: number) =>\n new JsiSkFont(\n CanvasKit,\n new CanvasKit.Font(\n typeface === undefined ? null : JsiSkTypeface.fromValue(typeface),\n size\n )\n ),\n Typeface: new JsiSkTypefaceFactory(CanvasKit),\n MaskFilter: new JsiSkMaskFilterFactory(CanvasKit),\n RuntimeEffect: new JsiSkRuntimeEffectFactory(CanvasKit),\n ImageFilter: new JsiSkImageFilterFactory(CanvasKit),\n Shader: new JsiSkShaderFactory(CanvasKit),\n PathEffect: new JsiSkPathEffectFactory(CanvasKit),\n MakeVertices: MakeVertices.bind(null, CanvasKit),\n Data: new JsiSkDataFactory(CanvasKit),\n Image: new JsiSkImageFactory(CanvasKit),\n AnimatedImage: new JsiSkAnimatedImageFactory(CanvasKit),\n SVG: new JsiSkSVGFactory(CanvasKit),\n TextBlob: new JsiSkTextBlobFactory(CanvasKit),\n XYWHRect: (x: number, y: number, width: number, height: number) => {\n return new JsiSkRect(CanvasKit, CanvasKit.XYWHRect(x, y, width, height));\n },\n Surface: new JsiSkSurfaceFactory(CanvasKit),\n TypefaceFontProvider: new JsiSkTypefaceFontProviderFactory(CanvasKit),\n FontMgr: new JsiSkFontMgrFactory(CanvasKit),\n ParagraphBuilder: new JsiSkParagraphBuilderFactory(CanvasKit),\n NativeBuffer: new JsiSkNativeBufferFactory(CanvasKit),\n});\n"],"mappings":"AAYA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,KAAK,QAAQ,cAAc;AACpC,SA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AE,IAAIpE,gBAAgB,CAACc,SAAS,CAAC;EACrCuD,KAAK,EAAE,IAAIpE,iBAAiB,CAACa,SAAS,CAAC;EACvCwD,aAAa,EAAE,IAAI5D,yBAAyB,CAACI,SAAS,CAAC;EACvDyD,GAAG,EAAE,IAAIrE,eAAe,CAACY,SAAS,CAAC;EACnC0D,QAAQ,EAAE,IAAIrE,oBAAoB,CAACW,SAAS,CAAC;EAC7C2D,QAAQ,EAAEA,CAACzD,CAAS,EAAEC,CAAS,EAAEyD,KAAa,EAAEC,MAAc,KAAK;IACjE,OAAO,IAAI5F,SAAS,CAAC+B,SAAS,EAAEA,SAAS,CAAC2D,QAAQ,CAACzD,CAAC,EAAEC,CAAC,EAAEyD,KAAK,EAAEC,MAAM,CAAC,CAAC;EAC1E,CAAC;EACDC,OAAO,EAAE,IAAI3F,mBAAmB,CAAC6B,SAAS,CAAC;EAC3C+D,oBAAoB,EAAE,IAAIrE,gCAAgC,CAACM,SAAS,CAAC;EACrEgE,OAAO,EAAE,IAAIrE,mBAAmB,CAACK,SAAS,CAAC;EAC3CiE,gBAAgB,EAAE,IAAIpE,4BAA4B,CAACG,SAAS,CAAC;EAC7DkE,YAAY,EAAE,IAAIpE,wBAAwB,CAACE,SAAS;AACtD,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[
|
|
1
|
+
{"version":3,"names":[],"sources":["NativeSkiaModule.web.ts"],"sourcesContent":[""],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type ImportType = ReturnType<typeof require>;
|
|
2
|
+
/**
|
|
3
|
+
* Create a lazily-imported module proxy.
|
|
4
|
+
* This is useful for lazily requiring optional dependencies.
|
|
5
|
+
*/
|
|
6
|
+
export declare const createModuleProxy: <TModule>(getModule: () => ImportType) => TModule;
|
|
7
|
+
export declare class OptionalDependencyNotInstalledError extends Error {
|
|
8
|
+
constructor(name: string);
|
|
9
|
+
}
|
|
10
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SkData } from "../Data";
|
|
2
|
+
import type { NativeBuffer } from "../NativeBuffer";
|
|
2
3
|
import type { SkImage } from "./Image";
|
|
3
4
|
export declare enum AlphaType {
|
|
4
5
|
Unknown = 0,
|
|
@@ -23,16 +24,7 @@ export declare enum ColorType {
|
|
|
23
24
|
Gray_8 = 13,
|
|
24
25
|
RGBA_F16Norm = 14,
|
|
25
26
|
RGBA_F16 = 15,
|
|
26
|
-
RGBA_F32 = 16
|
|
27
|
-
R8G8_unorm = 17,
|
|
28
|
-
A16_float = 18,
|
|
29
|
-
R16G16_float = 19,
|
|
30
|
-
A16_unorm = 20,
|
|
31
|
-
R16G16_unorm = 21,
|
|
32
|
-
R16G16B16A16_unorm = 22,
|
|
33
|
-
SRGBA_8888 = 23,
|
|
34
|
-
R8_unorm = 24,
|
|
35
|
-
N32_SkColorType = 25
|
|
27
|
+
RGBA_F32 = 16
|
|
36
28
|
}
|
|
37
29
|
export interface ImageInfo {
|
|
38
30
|
alphaType: AlphaType;
|
|
@@ -53,19 +45,20 @@ export interface ImageFactory {
|
|
|
53
45
|
*/
|
|
54
46
|
MakeImageFromEncoded: (encoded: SkData) => SkImage | null;
|
|
55
47
|
/**
|
|
56
|
-
* Return an Image backed by
|
|
48
|
+
* Return an Image backed by a given native buffer.
|
|
57
49
|
* The platform buffer must be a valid owning reference.
|
|
58
50
|
*
|
|
59
|
-
*
|
|
51
|
+
* For instance, this API is used by
|
|
52
|
+
* [react-native-vision-camera](https://github.com/mrousavy/react-native-vision-camera)
|
|
60
53
|
* to render a Skia Camera preview.
|
|
61
54
|
*
|
|
62
55
|
* - On Android; This is an `AHardwareBuffer*`
|
|
63
|
-
* - On iOS, this is a `
|
|
64
|
-
* @param
|
|
56
|
+
* - On iOS, this is a `CVPixelBufferRef`
|
|
57
|
+
* @param nativeBuffer A strong `uintptr_t` pointer to the native platform buffer
|
|
65
58
|
* @throws Throws an error if the Image could not be created, for example when the given
|
|
66
59
|
* platform buffer is invalid.
|
|
67
60
|
*/
|
|
68
|
-
|
|
61
|
+
MakeImageFromNativeBuffer: (nativeBuffer: NativeBuffer) => SkImage;
|
|
69
62
|
/**
|
|
70
63
|
* Returns an image that will be a screenshot of the view represented by
|
|
71
64
|
* the view tag
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SkImage } from "../Image";
|
|
2
|
+
export type NativeBuffer<T extends bigint | ArrayBuffer | CanvasImageSource | unknown = unknown> = T;
|
|
3
|
+
export type NativeBufferAddr = NativeBuffer<bigint>;
|
|
4
|
+
export type NativeBufferWeb = NativeBuffer<CanvasImageSource>;
|
|
5
|
+
export type NativeBufferNode = NativeBuffer<ArrayBuffer>;
|
|
6
|
+
export declare const isNativeBufferAddr: (buffer: NativeBuffer) => buffer is bigint;
|
|
7
|
+
export declare const isNativeBufferWeb: (buffer: NativeBuffer) => buffer is CanvasImageSource;
|
|
8
|
+
export declare const isNativeBufferNode: (buffer: NativeBuffer) => buffer is ArrayBuffer;
|
|
9
|
+
export interface NativeBufferFactory {
|
|
10
|
+
/**
|
|
11
|
+
* Copy pixels to a native buffer.
|
|
12
|
+
*/
|
|
13
|
+
MakeFromImage: (image: SkImage) => NativeBuffer;
|
|
14
|
+
/**
|
|
15
|
+
* Release a platform buffer that was created with `MakeFromImage`.
|
|
16
|
+
*/
|
|
17
|
+
Release: (platformBuffer: NativeBuffer) => void;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./NativeBufferFactory";
|
|
@@ -26,7 +26,7 @@ import type { Color, SkColor } from "./Color";
|
|
|
26
26
|
import type { TypefaceFontProviderFactory } from "./Paragraph/TypefaceFontProviderFactory";
|
|
27
27
|
import type { AnimatedImageFactory } from "./AnimatedImage";
|
|
28
28
|
import type { ParagraphBuilderFactory } from "./Paragraph/ParagraphBuilder";
|
|
29
|
-
import type {
|
|
29
|
+
import type { NativeBufferFactory } from "./NativeBuffer";
|
|
30
30
|
/**
|
|
31
31
|
* Declares the interface for the native Skia API
|
|
32
32
|
*/
|
|
@@ -72,5 +72,5 @@ export interface Skia {
|
|
|
72
72
|
TextBlob: TextBlobFactory;
|
|
73
73
|
Surface: SurfaceFactory;
|
|
74
74
|
ParagraphBuilder: ParagraphBuilderFactory;
|
|
75
|
-
|
|
75
|
+
NativeBuffer: NativeBufferFactory;
|
|
76
76
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { CanvasKit } from "canvaskit-wasm";
|
|
2
|
-
import type { SkData, ImageInfo, SkImage,
|
|
2
|
+
import type { SkData, ImageInfo, SkImage, NativeBuffer, ImageFactory } from "../types";
|
|
3
3
|
import { Host } from "./Host";
|
|
4
4
|
import { JsiSkImage } from "./JsiSkImage";
|
|
5
|
+
import type { JsiSkSurface } from "./JsiSkSurface";
|
|
5
6
|
export declare class JsiSkImageFactory extends Host implements ImageFactory {
|
|
6
7
|
constructor(CanvasKit: CanvasKit);
|
|
7
8
|
MakeImageFromViewTag(viewTag: number): Promise<SkImage | null>;
|
|
8
|
-
|
|
9
|
+
MakeImageFromNativeBuffer(buffer: NativeBuffer, surface?: JsiSkSurface, image?: JsiSkImage): JsiSkImage;
|
|
9
10
|
MakeImageFromEncoded(encoded: SkData): JsiSkImage | null;
|
|
10
11
|
MakeImage(info: ImageInfo, data: SkData, bytesPerRow: number): JsiSkImage | null;
|
|
11
12
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CanvasKit } from "canvaskit-wasm";
|
|
2
|
+
import { type NativeBuffer, type NativeBufferFactory, type SkImage } from "../types";
|
|
3
|
+
import { Host } from "./Host";
|
|
4
|
+
export declare class JsiSkNativeBufferFactory extends Host implements NativeBufferFactory {
|
|
5
|
+
constructor(CanvasKit: CanvasKit);
|
|
6
|
+
MakeFromImage(image: SkImage): NativeBuffer;
|
|
7
|
+
Release(_platformBuffer: NativeBuffer): void;
|
|
8
|
+
}
|
|
@@ -6,32 +6,32 @@
|
|
|
6
6
|
<array>
|
|
7
7
|
<dict>
|
|
8
8
|
<key>LibraryIdentifier</key>
|
|
9
|
-
<string>ios-
|
|
9
|
+
<string>ios-arm64_arm64e_x86_64-simulator</string>
|
|
10
10
|
<key>LibraryPath</key>
|
|
11
11
|
<string>libskia.a</string>
|
|
12
12
|
<key>SupportedArchitectures</key>
|
|
13
13
|
<array>
|
|
14
14
|
<string>arm64</string>
|
|
15
15
|
<string>arm64e</string>
|
|
16
|
+
<string>x86_64</string>
|
|
16
17
|
</array>
|
|
17
18
|
<key>SupportedPlatform</key>
|
|
18
19
|
<string>ios</string>
|
|
20
|
+
<key>SupportedPlatformVariant</key>
|
|
21
|
+
<string>simulator</string>
|
|
19
22
|
</dict>
|
|
20
23
|
<dict>
|
|
21
24
|
<key>LibraryIdentifier</key>
|
|
22
|
-
<string>ios-
|
|
25
|
+
<string>ios-arm64_arm64e</string>
|
|
23
26
|
<key>LibraryPath</key>
|
|
24
27
|
<string>libskia.a</string>
|
|
25
28
|
<key>SupportedArchitectures</key>
|
|
26
29
|
<array>
|
|
27
30
|
<string>arm64</string>
|
|
28
31
|
<string>arm64e</string>
|
|
29
|
-
<string>x86_64</string>
|
|
30
32
|
</array>
|
|
31
33
|
<key>SupportedPlatform</key>
|
|
32
34
|
<string>ios</string>
|
|
33
|
-
<key>SupportedPlatformVariant</key>
|
|
34
|
-
<string>simulator</string>
|
|
35
35
|
</dict>
|
|
36
36
|
</array>
|
|
37
37
|
<key>CFBundlePackageType</key>
|
|
Binary file
|
|
Binary file
|
|
@@ -6,32 +6,32 @@
|
|
|
6
6
|
<array>
|
|
7
7
|
<dict>
|
|
8
8
|
<key>LibraryIdentifier</key>
|
|
9
|
-
<string>ios-
|
|
9
|
+
<string>ios-arm64_arm64e</string>
|
|
10
10
|
<key>LibraryPath</key>
|
|
11
11
|
<string>libskottie.a</string>
|
|
12
12
|
<key>SupportedArchitectures</key>
|
|
13
13
|
<array>
|
|
14
14
|
<string>arm64</string>
|
|
15
15
|
<string>arm64e</string>
|
|
16
|
-
<string>x86_64</string>
|
|
17
16
|
</array>
|
|
18
17
|
<key>SupportedPlatform</key>
|
|
19
18
|
<string>ios</string>
|
|
20
|
-
<key>SupportedPlatformVariant</key>
|
|
21
|
-
<string>simulator</string>
|
|
22
19
|
</dict>
|
|
23
20
|
<dict>
|
|
24
21
|
<key>LibraryIdentifier</key>
|
|
25
|
-
<string>ios-
|
|
22
|
+
<string>ios-arm64_arm64e_x86_64-simulator</string>
|
|
26
23
|
<key>LibraryPath</key>
|
|
27
24
|
<string>libskottie.a</string>
|
|
28
25
|
<key>SupportedArchitectures</key>
|
|
29
26
|
<array>
|
|
30
27
|
<string>arm64</string>
|
|
31
28
|
<string>arm64e</string>
|
|
29
|
+
<string>x86_64</string>
|
|
32
30
|
</array>
|
|
33
31
|
<key>SupportedPlatform</key>
|
|
34
32
|
<string>ios</string>
|
|
33
|
+
<key>SupportedPlatformVariant</key>
|
|
34
|
+
<string>simulator</string>
|
|
35
35
|
</dict>
|
|
36
36
|
</array>
|
|
37
37
|
<key>CFBundlePackageType</key>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
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.2.
|
|
10
|
+
"version": "1.2.2",
|
|
11
11
|
"description": "High-performance React Native Graphics using Skia",
|
|
12
12
|
"main": "lib/module/index.js",
|
|
13
13
|
"react-native": "src/index.ts",
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// https://github.com/mrousavy/react-native-vision-camera/blob/main/package/src/dependencies/ModuleProxy.ts
|
|
2
|
+
type ImportType = ReturnType<typeof require>;
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Create a lazily-imported module proxy.
|
|
6
|
+
* This is useful for lazily requiring optional dependencies.
|
|
7
|
+
*/
|
|
8
|
+
export const createModuleProxy = <TModule>(
|
|
9
|
+
getModule: () => ImportType
|
|
10
|
+
): TModule => {
|
|
11
|
+
const holder: { module: TModule | undefined } = { module: undefined };
|
|
12
|
+
|
|
13
|
+
const proxy = new Proxy(holder, {
|
|
14
|
+
get: (target, property) => {
|
|
15
|
+
if (target.module == null) {
|
|
16
|
+
// lazy initialize module via require()
|
|
17
|
+
// caller needs to make sure the require() call is wrapped in a try/catch
|
|
18
|
+
target.module = getModule() as TModule;
|
|
19
|
+
}
|
|
20
|
+
return target.module[property as keyof typeof holder.module];
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
return proxy as unknown as TModule;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export class OptionalDependencyNotInstalledError extends Error {
|
|
27
|
+
constructor(name: string) {
|
|
28
|
+
super(`${name} is not installed!`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type * as ReanimatedT from "react-native-reanimated";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
OptionalDependencyNotInstalledError,
|
|
5
|
+
createModuleProxy,
|
|
6
|
+
} from "../ModuleProxy";
|
|
7
|
+
type TReanimated = typeof ReanimatedT;
|
|
8
|
+
|
|
9
|
+
const Reanimated = createModuleProxy<TReanimated>(() => {
|
|
10
|
+
try {
|
|
11
|
+
return require("react-native-reanimated");
|
|
12
|
+
} catch (e) {
|
|
13
|
+
throw new OptionalDependencyNotInstalledError("react-native-reanimated");
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line import/no-default-export
|
|
18
|
+
export default Reanimated;
|
|
@@ -4,17 +4,18 @@ import type { WorkletFunction } from "react-native-reanimated/lib/typescript/rea
|
|
|
4
4
|
import type { SkColor, SkHostRect, SkPoint, SkRSXform } from "../../skia/types";
|
|
5
5
|
import { Skia } from "../../skia";
|
|
6
6
|
|
|
7
|
-
import { startMapper, stopMapper, makeMutable } from "./moduleWrapper";
|
|
8
7
|
import { notifyChange } from "./interpolators";
|
|
8
|
+
import Rea from "./ReanimatedProxy";
|
|
9
9
|
|
|
10
10
|
type Modifier<T> = (input: T, index: number) => void;
|
|
11
11
|
|
|
12
|
-
const useBufferValue = <T>(size: number, bufferInitializer: () => T) =>
|
|
13
|
-
useMemo(
|
|
14
|
-
() => makeMutable(new Array(size).fill(0).map(bufferInitializer)),
|
|
12
|
+
const useBufferValue = <T>(size: number, bufferInitializer: () => T) => {
|
|
13
|
+
return useMemo(
|
|
14
|
+
() => Rea.makeMutable(new Array(size).fill(0).map(bufferInitializer)),
|
|
15
15
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16
16
|
[size]
|
|
17
17
|
);
|
|
18
|
+
};
|
|
18
19
|
|
|
19
20
|
const useBuffer = <T>(
|
|
20
21
|
size: number,
|
|
@@ -24,7 +25,7 @@ const useBuffer = <T>(
|
|
|
24
25
|
const values = useBufferValue(size, bufferInitializer);
|
|
25
26
|
const mod = modifier as WorkletFunction;
|
|
26
27
|
const deps = [size, ...Object.values(mod.__closure ?? {})];
|
|
27
|
-
const mapperId = startMapper(() => {
|
|
28
|
+
const mapperId = Rea.startMapper(() => {
|
|
28
29
|
"worklet";
|
|
29
30
|
values.value.forEach((val, index) => {
|
|
30
31
|
modifier(val, index);
|
|
@@ -34,7 +35,7 @@ const useBuffer = <T>(
|
|
|
34
35
|
|
|
35
36
|
useEffect(() => {
|
|
36
37
|
return () => {
|
|
37
|
-
stopMapper(mapperId);
|
|
38
|
+
Rea.stopMapper(mapperId);
|
|
38
39
|
};
|
|
39
40
|
}, [mapperId]);
|
|
40
41
|
|
|
@@ -10,12 +10,7 @@ import { interpolatePaths, interpolateVector } from "../../animation";
|
|
|
10
10
|
import { Skia } from "../../skia";
|
|
11
11
|
import { isOnMainThread } from "../../renderer/Offscreen";
|
|
12
12
|
|
|
13
|
-
import
|
|
14
|
-
useAnimatedReaction,
|
|
15
|
-
useFrameCallback,
|
|
16
|
-
useSharedValue,
|
|
17
|
-
useDerivedValue,
|
|
18
|
-
} from "./moduleWrapper";
|
|
13
|
+
import Rea from "./ReanimatedProxy";
|
|
19
14
|
|
|
20
15
|
export const notifyChange = (value: SharedValue<unknown>) => {
|
|
21
16
|
"worklet";
|
|
@@ -27,8 +22,8 @@ export const notifyChange = (value: SharedValue<unknown>) => {
|
|
|
27
22
|
|
|
28
23
|
export const usePathValue = (cb: (path: SkPath) => void, init?: SkPath) => {
|
|
29
24
|
const pathInit = useMemo(() => Skia.Path.Make(), []);
|
|
30
|
-
const path = useSharedValue(pathInit);
|
|
31
|
-
useDerivedValue(() => {
|
|
25
|
+
const path = Rea.useSharedValue(pathInit);
|
|
26
|
+
Rea.useDerivedValue(() => {
|
|
32
27
|
path.value.reset();
|
|
33
28
|
if (init !== undefined) {
|
|
34
29
|
path.value.addPath(init);
|
|
@@ -40,7 +35,7 @@ export const usePathValue = (cb: (path: SkPath) => void, init?: SkPath) => {
|
|
|
40
35
|
};
|
|
41
36
|
|
|
42
37
|
export const useClock = () => {
|
|
43
|
-
const clock = useSharedValue(0);
|
|
38
|
+
const clock = Rea.useSharedValue(0);
|
|
44
39
|
const callback = useCallback(
|
|
45
40
|
(info: FrameInfo) => {
|
|
46
41
|
"worklet";
|
|
@@ -48,7 +43,7 @@ export const useClock = () => {
|
|
|
48
43
|
},
|
|
49
44
|
[clock]
|
|
50
45
|
);
|
|
51
|
-
useFrameCallback(callback);
|
|
46
|
+
Rea.useFrameCallback(callback);
|
|
52
47
|
return clock;
|
|
53
48
|
};
|
|
54
49
|
|
|
@@ -73,8 +68,8 @@ const useInterpolator = <T>(
|
|
|
73
68
|
) => {
|
|
74
69
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
75
70
|
const init = useMemo(() => factory(), []);
|
|
76
|
-
const result = useSharedValue(init);
|
|
77
|
-
useAnimatedReaction(
|
|
71
|
+
const result = Rea.useSharedValue(init);
|
|
72
|
+
Rea.useAnimatedReaction(
|
|
78
73
|
() => value.value,
|
|
79
74
|
(val) => {
|
|
80
75
|
result.value = interpolator(val, input, output, options, result.value);
|
|
@@ -4,26 +4,39 @@ import type { Container } from "../../renderer/Container";
|
|
|
4
4
|
import type { AnimatedProps } from "../../renderer/processors";
|
|
5
5
|
import type { Node } from "../../dom/types";
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
import Rea from "./ReanimatedProxy";
|
|
8
|
+
|
|
9
|
+
let HAS_REANIMATED = false;
|
|
10
|
+
let HAS_REANIMATED_3 = false;
|
|
11
|
+
try {
|
|
12
|
+
require("react-native-reanimated");
|
|
13
|
+
HAS_REANIMATED = true;
|
|
14
|
+
const reanimatedVersion =
|
|
15
|
+
require("react-native-reanimated/package.json").version;
|
|
16
|
+
if (
|
|
17
|
+
reanimatedVersion &&
|
|
18
|
+
(reanimatedVersion >= "3.0.0" || reanimatedVersion.includes("3.0.0-"))
|
|
19
|
+
) {
|
|
20
|
+
HAS_REANIMATED_3 = true;
|
|
21
|
+
}
|
|
22
|
+
} catch (e) {
|
|
23
|
+
HAS_REANIMATED = false;
|
|
24
|
+
}
|
|
15
25
|
|
|
16
26
|
const _bindings = new WeakMap<Node<unknown>, unknown>();
|
|
17
27
|
|
|
18
28
|
export const unbindReanimatedNode = (node: Node<unknown>) => {
|
|
29
|
+
if (!HAS_REANIMATED) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
19
32
|
const previousMapperId = _bindings.get(node);
|
|
20
33
|
if (previousMapperId !== undefined) {
|
|
21
|
-
stopMapper(previousMapperId as number);
|
|
34
|
+
Rea.stopMapper(previousMapperId as number);
|
|
22
35
|
}
|
|
23
36
|
};
|
|
24
37
|
|
|
25
38
|
export function extractReanimatedProps(props: AnimatedProps<any>) {
|
|
26
|
-
if (!
|
|
39
|
+
if (!HAS_REANIMATED) {
|
|
27
40
|
return [props, {}];
|
|
28
41
|
}
|
|
29
42
|
const reanimatedProps = {} as AnimatedProps<any>;
|
|
@@ -33,7 +46,7 @@ export function extractReanimatedProps(props: AnimatedProps<any>) {
|
|
|
33
46
|
continue;
|
|
34
47
|
}
|
|
35
48
|
const propValue = props[propName];
|
|
36
|
-
if (isSharedValue(propValue)) {
|
|
49
|
+
if (Rea.isSharedValue(propValue)) {
|
|
37
50
|
reanimatedProps[propName] = propValue;
|
|
38
51
|
otherProps[propName] = propValue.value;
|
|
39
52
|
} else {
|
|
@@ -51,7 +64,7 @@ function bindReanimatedProps2(
|
|
|
51
64
|
const sharedValues = Object.values(reanimatedProps);
|
|
52
65
|
const previousMapperId = _bindings.get(node);
|
|
53
66
|
if (previousMapperId !== undefined) {
|
|
54
|
-
stopMapper(previousMapperId as number);
|
|
67
|
+
Rea.stopMapper(previousMapperId as number);
|
|
55
68
|
}
|
|
56
69
|
if (sharedValues.length > 0) {
|
|
57
70
|
const viewId = container.getNativeId();
|
|
@@ -70,9 +83,9 @@ function bindReanimatedProps2(
|
|
|
70
83
|
container.redraw();
|
|
71
84
|
}
|
|
72
85
|
};
|
|
73
|
-
const mapperId = startMapper(() => {
|
|
86
|
+
const mapperId = Rea.startMapper(() => {
|
|
74
87
|
"worklet";
|
|
75
|
-
runOnJS(updateProps)();
|
|
88
|
+
Rea.runOnJS(updateProps)();
|
|
76
89
|
}, sharedValues);
|
|
77
90
|
_bindings.set(node, mapperId);
|
|
78
91
|
}
|
|
@@ -83,21 +96,21 @@ export function bindReanimatedProps(
|
|
|
83
96
|
node: Node<any>,
|
|
84
97
|
reanimatedProps: AnimatedProps<any>
|
|
85
98
|
) {
|
|
86
|
-
if (
|
|
99
|
+
if (HAS_REANIMATED && !HAS_REANIMATED_3) {
|
|
87
100
|
return bindReanimatedProps2(container, node, reanimatedProps);
|
|
88
101
|
}
|
|
89
|
-
if (!
|
|
102
|
+
if (!HAS_REANIMATED) {
|
|
90
103
|
return;
|
|
91
104
|
}
|
|
92
105
|
const sharedValues = Object.values(reanimatedProps);
|
|
93
106
|
const previousMapperId = _bindings.get(node);
|
|
94
107
|
if (previousMapperId !== undefined) {
|
|
95
|
-
stopMapper(previousMapperId as number);
|
|
108
|
+
Rea.stopMapper(previousMapperId as number);
|
|
96
109
|
}
|
|
97
110
|
if (sharedValues.length > 0) {
|
|
98
111
|
const viewId = container.getNativeId();
|
|
99
112
|
const { SkiaViewApi } = global;
|
|
100
|
-
const mapperId = startMapper(() => {
|
|
113
|
+
const mapperId = Rea.startMapper(() => {
|
|
101
114
|
"worklet";
|
|
102
115
|
if (node) {
|
|
103
116
|
for (const propName in reanimatedProps) {
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "../../renderer/Offscreen";
|
|
15
15
|
import { Skia, useImage } from "../../skia";
|
|
16
16
|
|
|
17
|
-
import
|
|
17
|
+
import Rea from "./ReanimatedProxy";
|
|
18
18
|
|
|
19
19
|
const createTexture = (
|
|
20
20
|
texture: SharedValue<SkImage | null>,
|
|
@@ -57,10 +57,10 @@ export const usePictureAsTexture = (
|
|
|
57
57
|
picture: SkPicture | null,
|
|
58
58
|
size: SkSize
|
|
59
59
|
) => {
|
|
60
|
-
const texture = useSharedValue<SkImage | null>(null);
|
|
60
|
+
const texture = Rea.useSharedValue<SkImage | null>(null);
|
|
61
61
|
useEffect(() => {
|
|
62
62
|
if (picture !== null) {
|
|
63
|
-
runOnUI(createTexture)(texture, picture, size);
|
|
63
|
+
Rea.runOnUI(createTexture)(texture, picture, size);
|
|
64
64
|
}
|
|
65
65
|
}, [texture, picture, size]);
|
|
66
66
|
return texture;
|