@shopify/react-native-skia 0.1.212 → 0.1.214
Sign up to get free protection for your applications and to get access to all the features.
- package/android/build.gradle +5 -0
- package/android/cpp/rnskia-android/SkiaOpenGLHelper.h +3 -2
- package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp +9 -2
- package/cpp/api/JsiSkSurface.h +4 -1
- package/cpp/skia/include/android/GrAHardwareBufferUtils.h +99 -0
- package/cpp/skia/include/android/SkHeifDecoder.h +10 -3
- package/cpp/skia/include/codec/SkAvifDecoder.h +1 -0
- package/cpp/skia/include/codec/SkBmpDecoder.h +1 -0
- package/cpp/skia/include/codec/SkCodec.h +4 -3
- package/cpp/skia/include/codec/SkEncodedImageFormat.h +0 -3
- package/cpp/skia/include/codec/SkGifDecoder.h +1 -0
- package/cpp/skia/include/codec/SkIcoDecoder.h +1 -0
- package/cpp/skia/include/codec/SkJpegDecoder.h +1 -0
- package/cpp/skia/include/codec/SkJpegxlDecoder.h +1 -0
- package/cpp/skia/include/codec/SkPngDecoder.h +1 -0
- package/cpp/skia/include/codec/SkRawDecoder.h +1 -0
- package/cpp/skia/include/codec/SkWbmpDecoder.h +1 -0
- package/cpp/skia/include/codec/SkWebpDecoder.h +1 -0
- package/cpp/skia/include/config/SkUserConfig.h +0 -2
- package/cpp/skia/include/core/SkBitmap.h +8 -8
- package/cpp/skia/include/core/SkCanvas.h +37 -50
- package/cpp/skia/include/core/SkCapabilities.h +2 -7
- package/cpp/skia/include/core/SkColor.h +1 -1
- package/cpp/skia/include/core/SkColorFilter.h +6 -0
- package/cpp/skia/include/core/SkColorTable.h +3 -0
- package/cpp/skia/include/core/SkColorType.h +2 -0
- package/cpp/skia/include/core/SkContourMeasure.h +12 -8
- package/cpp/skia/include/core/SkDocument.h +1 -0
- package/cpp/skia/include/core/SkFont.h +11 -2
- package/cpp/skia/include/core/SkFontMgr.h +2 -3
- package/cpp/skia/include/core/SkGraphics.h +3 -13
- package/cpp/skia/include/core/SkImage.h +57 -111
- package/cpp/skia/include/core/SkImageFilter.h +6 -1
- package/cpp/skia/include/core/SkImageGenerator.h +8 -0
- package/cpp/skia/include/core/SkImageInfo.h +0 -2
- package/cpp/skia/include/core/SkM44.h +7 -3
- package/cpp/skia/include/core/SkMallocPixelRef.h +4 -1
- package/cpp/skia/include/core/SkMatrix.h +17 -17
- package/cpp/skia/include/core/SkMesh.h +71 -61
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkOverdrawCanvas.h +25 -0
- package/cpp/skia/include/core/SkPaint.h +1 -1
- package/cpp/skia/include/core/SkPath.h +12 -4
- package/cpp/skia/include/core/SkPathMeasure.h +3 -4
- package/cpp/skia/include/core/SkPicture.h +19 -6
- package/cpp/skia/include/core/SkPictureRecorder.h +6 -6
- package/cpp/skia/include/core/SkPixmap.h +2 -3
- package/cpp/skia/include/core/SkRRect.h +1 -1
- package/cpp/skia/include/core/SkRect.h +107 -110
- package/cpp/skia/include/core/SkRefCnt.h +1 -1
- package/cpp/skia/include/core/SkRegion.h +7 -1
- package/cpp/skia/include/core/SkSerialProcs.h +14 -0
- package/cpp/skia/include/core/SkShader.h +9 -0
- package/cpp/skia/include/core/SkStream.h +9 -9
- package/cpp/skia/include/core/SkString.h +1 -1
- package/cpp/skia/include/core/SkSurface.h +14 -25
- package/cpp/skia/include/core/SkTextBlob.h +17 -4
- package/cpp/skia/include/core/SkTiledImageUtils.h +28 -0
- package/cpp/skia/include/core/SkTypeface.h +7 -2
- package/cpp/skia/include/core/SkTypes.h +4 -12
- package/cpp/skia/include/docs/SkPDFDocument.h +17 -3
- package/cpp/skia/include/effects/SkImageFilters.h +73 -24
- package/cpp/skia/include/effects/SkRuntimeEffect.h +20 -51
- package/cpp/skia/include/gpu/GpuTypes.h +13 -0
- package/cpp/skia/include/gpu/GrBackendSurface.h +95 -262
- package/cpp/skia/include/gpu/GrContextOptions.h +7 -1
- package/cpp/skia/include/gpu/GrDirectContext.h +138 -128
- package/cpp/skia/include/gpu/GrRecordingContext.h +9 -4
- package/cpp/skia/include/gpu/GrSurfaceInfo.h +0 -24
- package/cpp/skia/include/gpu/GrTypes.h +16 -1
- package/cpp/skia/include/gpu/GrYUVABackendTextures.h +4 -4
- package/cpp/skia/include/gpu/d3d/GrD3DTypes.h +2 -2
- package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +44 -12
- package/cpp/skia/include/gpu/ganesh/SkMeshGanesh.h +57 -0
- package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +2 -1
- package/cpp/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h +58 -0
- package/cpp/skia/include/gpu/ganesh/gl/GrGLDirectContext.h +29 -0
- package/cpp/skia/include/gpu/ganesh/mtl/SkSurfaceMetal.h +1 -1
- package/cpp/skia/include/gpu/ganesh/vk/GrVkBackendSurface.h +67 -0
- package/cpp/skia/include/gpu/gl/GrGLInterface.h +2 -2
- package/cpp/skia/include/gpu/graphite/BackendTexture.h +14 -3
- package/cpp/skia/include/gpu/graphite/Context.h +93 -13
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +19 -8
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +23 -0
- package/cpp/skia/include/gpu/graphite/Image.h +56 -0
- package/cpp/skia/include/gpu/graphite/ImageProvider.h +5 -0
- package/cpp/skia/include/gpu/graphite/Recorder.h +26 -9
- package/cpp/skia/include/gpu/graphite/Recording.h +7 -5
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +8 -0
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +2 -2
- package/cpp/skia/include/gpu/mtl/GrMtlTypes.h +2 -2
- package/cpp/skia/include/gpu/vk/GrVkTypes.h +4 -3
- package/cpp/skia/include/ports/SkCFObject.h +1 -1
- package/cpp/skia/include/private/SkGainmapInfo.h +4 -13
- package/cpp/skia/include/private/SkJpegGainmapEncoder.h +1 -24
- package/cpp/skia/include/private/SkWeakRefCnt.h +1 -1
- package/cpp/skia/include/private/base/SkAnySubclass.h +73 -0
- package/cpp/skia/include/private/base/SkAssert.h +106 -12
- package/cpp/skia/include/private/base/SkAttributes.h +0 -12
- package/cpp/skia/include/private/base/SkFeatures.h +0 -3
- package/cpp/skia/include/private/base/SkFloatingPoint.h +58 -105
- package/cpp/skia/include/private/base/SkSpan_impl.h +18 -12
- package/cpp/skia/include/private/base/SkTArray.h +22 -17
- package/cpp/skia/include/private/base/SkTDArray.h +5 -6
- package/cpp/skia/include/private/base/SkTemplates.h +50 -30
- package/cpp/skia/include/private/chromium/GrDeferredDisplayListRecorder.h +5 -2
- package/cpp/skia/include/private/chromium/GrSurfaceCharacterization.h +2 -2
- package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +13 -8
- package/cpp/skia/include/private/chromium/SkDiscardableMemory.h +1 -1
- package/cpp/skia/include/private/chromium/SkImageChromium.h +16 -3
- package/cpp/skia/include/private/chromium/Slug.h +11 -4
- package/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +6 -9
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +29 -13
- package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +2 -28
- package/cpp/skia/include/private/gpu/graphite/ContextOptionsPriv.h +34 -0
- package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +6 -0
- package/cpp/skia/include/private/gpu/graphite/MtlGraphiteTypesPriv.h +8 -0
- package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +10 -0
- package/cpp/skia/include/utils/SkBase64.h +2 -2
- package/cpp/skia/include/utils/SkNWayCanvas.h +1 -11
- package/cpp/skia/include/utils/SkNoDrawCanvas.h +0 -2
- package/cpp/skia/include/utils/SkPaintFilterCanvas.h +1 -2
- package/cpp/skia/include/utils/SkShadowUtils.h +15 -1
- package/cpp/skia/include/utils/SkTextUtils.h +1 -1
- package/cpp/skia/modules/skparagraph/include/Paragraph.h +107 -1
- package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +3 -2
- package/cpp/skia/modules/skparagraph/include/ParagraphStyle.h +4 -0
- package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +5 -3
- package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +4 -0
- package/cpp/skia/src/core/SkChecksum.h +2 -1
- package/cpp/skia/src/core/SkPathPriv.h +1 -1
- package/cpp/skia/src/core/SkTHash.h +19 -9
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +3 -1
- package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Rect.js +5 -1
- package/lib/commonjs/dom/nodes/datatypes/Rect.js.map +1 -1
- package/lib/commonjs/external/reanimated/index.d.ts +1 -0
- package/lib/commonjs/external/reanimated/index.js +13 -0
- package/lib/commonjs/external/reanimated/index.js.map +1 -1
- package/lib/commonjs/external/reanimated/moduleWrapper.js +3 -8
- package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
- package/lib/commonjs/external/reanimated/renderHelpers.js +46 -1
- package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/commonjs/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
- package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js +26 -0
- package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js.map +1 -0
- package/lib/commonjs/external/reanimated/useSharedValueEffect.js +2 -5
- package/lib/commonjs/external/reanimated/useSharedValueEffect.js.map +1 -1
- package/lib/commonjs/index.d.ts +1 -0
- package/lib/commonjs/index.js +21 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/skia/types/MaskFilter.js +4 -0
- package/lib/commonjs/skia/types/MaskFilter.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js +2 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/commonjs/views/SkiaBaseWebView.js +1 -1
- package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
- package/lib/commonjs/views/types.js +3 -0
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Rect.js +5 -1
- package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
- package/lib/module/external/reanimated/index.d.ts +1 -0
- package/lib/module/external/reanimated/index.js +1 -0
- package/lib/module/external/reanimated/index.js.map +1 -1
- package/lib/module/external/reanimated/moduleWrapper.js +1 -9
- package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
- package/lib/module/external/reanimated/renderHelpers.js +48 -2
- package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/module/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
- package/lib/module/external/reanimated/useDerivedValueOnJS.js +15 -0
- package/lib/module/external/reanimated/useDerivedValueOnJS.js.map +1 -0
- package/lib/module/external/reanimated/useSharedValueEffect.js +3 -6
- package/lib/module/external/reanimated/useSharedValueEffect.js.map +1 -1
- package/lib/module/index.d.ts +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/skia/types/MaskFilter.js +3 -0
- package/lib/module/skia/types/MaskFilter.js.map +1 -1
- package/lib/module/views/types.js +3 -0
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/src/external/reanimated/index.d.ts +1 -0
- package/lib/typescript/src/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/libs/android/arm64-v8a/libskia.a +0 -0
- package/libs/android/arm64-v8a/libskottie.a +0 -0
- package/libs/android/arm64-v8a/libskparagraph.a +0 -0
- package/libs/android/arm64-v8a/libsksg.a +0 -0
- package/libs/android/arm64-v8a/libskshaper.a +0 -0
- package/libs/android/arm64-v8a/libskunicode.a +0 -0
- package/libs/android/arm64-v8a/libsvg.a +0 -0
- package/libs/android/armeabi-v7a/libskia.a +0 -0
- package/libs/android/armeabi-v7a/libskottie.a +0 -0
- package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
- package/libs/android/armeabi-v7a/libsksg.a +0 -0
- package/libs/android/armeabi-v7a/libskshaper.a +0 -0
- package/libs/android/armeabi-v7a/libskunicode.a +0 -0
- package/libs/android/armeabi-v7a/libsvg.a +0 -0
- package/libs/android/x86/libskia.a +0 -0
- package/libs/android/x86/libskottie.a +0 -0
- package/libs/android/x86/libskparagraph.a +0 -0
- package/libs/android/x86/libsksg.a +0 -0
- package/libs/android/x86/libskshaper.a +0 -0
- package/libs/android/x86/libskunicode.a +0 -0
- package/libs/android/x86/libsvg.a +0 -0
- package/libs/android/x86_64/libskia.a +0 -0
- package/libs/android/x86_64/libskottie.a +0 -0
- package/libs/android/x86_64/libskparagraph.a +0 -0
- package/libs/android/x86_64/libsksg.a +0 -0
- package/libs/android/x86_64/libskshaper.a +0 -0
- package/libs/android/x86_64/libskunicode.a +0 -0
- package/libs/android/x86_64/libsvg.a +0 -0
- package/libs/ios/libskia.xcframework/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/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/libskparagraph.xcframework/Info.plist +5 -5
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/ios/libsksg.xcframework/Info.plist +5 -5
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libskunicode.xcframework/Info.plist +5 -5
- 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/Info.plist +5 -5
- 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/react-native-skia.podspec +1 -1
- package/src/dom/nodes/datatypes/Rect.ts +6 -2
- package/src/external/reanimated/index.ts +1 -0
- package/src/external/reanimated/moduleWrapper.ts +6 -10
- package/src/external/reanimated/renderHelpers.ts +41 -1
- package/src/external/reanimated/useDerivedValueOnJS.ts +24 -0
- package/src/external/reanimated/useSharedValueEffect.ts +4 -7
- package/src/index.ts +1 -0
- package/cpp/skia/include/core/SkDeferredDisplayList.h +0 -15
- package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +0 -15
- package/cpp/skia/include/core/SkPromiseImageTexture.h +0 -20
- package/cpp/skia/include/core/SkSurfaceCharacterization.h +0 -15
- package/cpp/skia/include/core/SkTime.h +0 -63
- package/cpp/skia/include/effects/SkOpPathEffect.h +0 -43
- package/cpp/skia/include/effects/SkStrokeAndFillPathEffect.h +0 -28
- package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +0 -32
- package/cpp/skia/include/gpu/dawn/GrDawnTypes.h +0 -95
- package/cpp/skia/include/private/SkBitmaskEnum.h +0 -59
- package/cpp/skia/include/private/SkSLDefines.h +0 -64
- package/cpp/skia/include/private/SkShadowFlags.h +0 -27
- package/cpp/skia/include/private/gpu/ganesh/GrDawnTypesPriv.h +0 -26
- /package/cpp/skia/{include/private/base → src/core}/SkPathEnums.h +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["pd","Platform","PixelRatio","SkiaBaseWebView","React","Component","constructor","props","createRef","createTouchHandler","TouchType","Start","Active","Cancelled","End","onLayoutEvent","bind","_mode","mode","unsubscribeAll","_unsubscriptions","forEach","u","evt","CanvasKit","global","canvas","_canvasRef","current","width","clientWidth","height","clientHeight","surface","MakeWebGLCanvasSurface","Error","_surface","JsiSkSurface","_canvas","getCanvas","redraw","onLayout","getSize","componentDidMount","tick","componentDidUpdate","componentWillUnmount","cancelAnimationFrame","requestId","getContext","getExtension","loseContext","makeImageSnapshot","rect","clear","TRANSPARENT","renderInCanvas","ref","flush","_redrawRequests","touches","_touches","Float32Array","of","save","scale","restore","requestAnimationFrame","setDrawMode","registerValues","_values","v","push","addListener","handleTouchEvent","touchType","id","pointerId","x","clientX","currentTarget","getClientRects","left","y","clientY","top","force","pressure","type","timestamp","Date","now","render","debug","viewProps","display","flex","onStart","onActive","onEnd","onCancel"],"sources":["SkiaBaseWebView.tsx"],"sourcesContent":["/* global HTMLCanvasElement */\nimport React from \"react\";\nimport type { PointerEvent } from \"react\";\nimport type { LayoutChangeEvent } from \"react-native\";\n\nimport type { SkRect, SkCanvas } from \"../skia/types\";\nimport type { SkiaValue } from \"../values\";\nimport { JsiSkSurface } from \"../skia/web/JsiSkSurface\";\nimport { Platform } from \"../Platform\";\n\nimport type { DrawMode, SkiaBaseViewProps, TouchInfo } from \"./types\";\nimport { TouchType } from \"./types\";\n\nconst pd = Platform.PixelRatio;\n\nexport abstract class SkiaBaseWebView<\n TProps extends SkiaBaseViewProps\n> extends React.Component<TProps> {\n constructor(props: TProps) {\n super(props);\n this._mode = props.mode ?? \"default\";\n }\n\n private _surface: JsiSkSurface | null = null;\n private _unsubscriptions: Array<() => void> = [];\n private _touches: Array<TouchInfo> = [];\n private _canvas: SkCanvas | null = null;\n private _canvasRef = React.createRef<HTMLCanvasElement>();\n private _mode: DrawMode;\n private _redrawRequests = 0;\n private requestId = 0;\n\n protected width = 0;\n protected height = 0;\n\n private unsubscribeAll() {\n this._unsubscriptions.forEach((u) => u());\n this._unsubscriptions = [];\n }\n\n private onLayoutEvent(evt: LayoutChangeEvent) {\n const { CanvasKit } = global;\n // Reset canvas / surface on layout change\n const canvas = this._canvasRef.current;\n if (canvas) {\n this.width = canvas.clientWidth;\n this.height = canvas.clientHeight;\n canvas.width = this.width * pd;\n canvas.height = this.height * pd;\n const surface = CanvasKit.MakeWebGLCanvasSurface(canvas);\n if (!surface) {\n throw new Error(\"Could not create surface\");\n }\n this._surface = new JsiSkSurface(CanvasKit, surface);\n this._canvas = this._surface.getCanvas();\n this.redraw();\n }\n // Call onLayout callback if it exists\n if (this.props.onLayout) {\n this.props.onLayout(evt);\n }\n }\n\n protected getSize() {\n return { width: this.width, height: this.height };\n }\n\n componentDidMount() {\n // Start render loop\n this.tick();\n }\n\n componentDidUpdate() {\n this.redraw();\n }\n\n componentWillUnmount() {\n this.unsubscribeAll();\n cancelAnimationFrame(this.requestId);\n // eslint-disable-next-line max-len\n // https://stackoverflow.com/questions/23598471/how-do-i-clean-up-and-unload-a-webgl-canvas-context-from-gpu-after-use\n // https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_lose_context\n // We delete the context, only if the context has been intialized\n if (this._surface) {\n this._canvasRef.current\n ?.getContext(\"webgl2\")\n ?.getExtension(\"WEBGL_lose_context\")\n ?.loseContext();\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 this._canvas!.clear(CanvasKit.TRANSPARENT);\n this.renderInCanvas(this._canvas!, []);\n this._surface?.ref.flush();\n return this._surface?.makeImageSnapshot(rect);\n }\n\n /**\n * Override to render\n */\n protected abstract renderInCanvas(\n canvas: SkCanvas,\n touches: TouchInfo[]\n ): void;\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n private tick() {\n if (this._mode === \"continuous\" || this._redrawRequests > 0) {\n this._redrawRequests = 0;\n if (this._canvas) {\n const touches = [...this._touches];\n this._touches = [];\n const canvas = this._canvas!;\n canvas.clear(Float32Array.of(0, 0, 0, 0));\n canvas.save();\n canvas.scale(pd, pd);\n this.renderInCanvas(canvas, touches);\n canvas.restore();\n this._surface?.ref.flush();\n }\n }\n this.requestId = requestAnimationFrame(this.tick.bind(this));\n }\n\n public redraw() {\n this._redrawRequests++;\n }\n\n /**\n * Updates the drawing mode for the skia view. This is the same\n * as declaratively setting the mode property on the SkiaView.\n * There are two drawing modes, \"continuous\" and \"default\",\n * where the continuous mode will continuously redraw the view and\n * the default mode will only redraw when any of the regular react\n * properties are changed like size and margins.\n * @param mode Drawing mode to use.\n */\n public setDrawMode(mode: DrawMode) {\n this._mode = mode;\n this.tick();\n }\n\n /**\n * Registers one or move values as a dependant value of the Skia View. The view will\n * The view will redraw itself when any of the values change.\n * @param values Values to register\n */\n public registerValues(_values: SkiaValue<unknown>[]) {\n // Unsubscribe from dependency values\n this.unsubscribeAll();\n // Register redraw dependencies on values\n _values.forEach((v) => {\n this._unsubscriptions.push(\n v.addListener(() => {\n this.redraw();\n })\n );\n });\n }\n\n private handleTouchEvent(evt: PointerEvent, touchType: TouchType) {\n this._touches.push({\n id: evt.pointerId,\n x: evt.clientX - evt.currentTarget.getClientRects()[0].left,\n y: evt.clientY - evt.currentTarget.getClientRects()[0].top,\n force: evt.pressure,\n type: touchType,\n timestamp: Date.now(),\n });\n this.redraw();\n }\n\n createTouchHandler(touchType: TouchType) {\n return (evt: PointerEvent) => this.handleTouchEvent(evt, touchType);\n }\n\n private onStart = this.createTouchHandler(TouchType.Start);\n private onActive = this.createTouchHandler(TouchType.Active);\n private onCancel = this.createTouchHandler(TouchType.Cancelled);\n private onEnd = this.createTouchHandler(TouchType.End);\n private onLayout = this.onLayoutEvent.bind(this);\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <Platform.View {...viewProps} onLayout={this.onLayout}>\n <canvas\n ref={this._canvasRef}\n style={{ display: \"flex\", flex: 1 }}\n onPointerDown={this.onStart}\n onPointerMove={this.onActive}\n onPointerUp={this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W,EAAE,KAAKC,KALpB;MAME,eAAe,EAAE,KAAKC,QANxB;MAOE,cAAc,EAAE,KAAKD,KAPvB;MAQE,YAAY,EAAE,KAAKA;IARrB,EADF,CADF;EAcD;;AA7L+B"}
|
1
|
+
{"version":3,"names":["pd","Platform","PixelRatio","SkiaBaseWebView","React","Component","constructor","props","createRef","createTouchHandler","TouchType","Start","Active","Cancelled","End","onLayoutEvent","bind","_mode","mode","unsubscribeAll","_unsubscriptions","forEach","u","evt","CanvasKit","global","canvas","_canvasRef","current","width","clientWidth","height","clientHeight","surface","MakeWebGLCanvasSurface","Error","_surface","JsiSkSurface","_canvas","getCanvas","redraw","onLayout","getSize","componentDidMount","tick","componentDidUpdate","componentWillUnmount","cancelAnimationFrame","requestId","getContext","getExtension","loseContext","makeImageSnapshot","rect","clear","TRANSPARENT","renderInCanvas","ref","flush","_redrawRequests","touches","_touches","Float32Array","of","save","scale","restore","requestAnimationFrame","setDrawMode","registerValues","_values","v","push","addListener","handleTouchEvent","touchType","id","pointerId","x","clientX","currentTarget","getClientRects","left","y","clientY","top","force","pressure","type","timestamp","Date","now","render","debug","viewProps","display","flex","onStart","onActive","onEnd","onCancel"],"sources":["SkiaBaseWebView.tsx"],"sourcesContent":["/* global HTMLCanvasElement */\nimport React from \"react\";\nimport type { PointerEvent } from \"react\";\nimport type { LayoutChangeEvent } from \"react-native\";\n\nimport type { SkRect, SkCanvas } from \"../skia/types\";\nimport type { SkiaValue } from \"../values\";\nimport { JsiSkSurface } from \"../skia/web/JsiSkSurface\";\nimport { Platform } from \"../Platform\";\n\nimport type { DrawMode, SkiaBaseViewProps, TouchInfo } from \"./types\";\nimport { TouchType } from \"./types\";\n\nconst pd = Platform.PixelRatio;\n\nexport abstract class SkiaBaseWebView<\n TProps extends SkiaBaseViewProps\n> extends React.Component<TProps> {\n constructor(props: TProps) {\n super(props);\n this._mode = props.mode ?? \"default\";\n }\n\n private _surface: JsiSkSurface | null = null;\n private _unsubscriptions: Array<() => void> = [];\n private _touches: Array<TouchInfo> = [];\n private _canvas: SkCanvas | null = null;\n private _canvasRef = React.createRef<HTMLCanvasElement>();\n private _mode: DrawMode;\n private _redrawRequests = 0;\n private requestId = 0;\n\n protected width = 0;\n protected height = 0;\n\n private unsubscribeAll() {\n this._unsubscriptions.forEach((u) => u());\n this._unsubscriptions = [];\n }\n\n private onLayoutEvent(evt: LayoutChangeEvent) {\n const { CanvasKit } = global;\n // Reset canvas / surface on layout change\n const canvas = this._canvasRef.current;\n if (canvas) {\n this.width = canvas.clientWidth;\n this.height = canvas.clientHeight;\n canvas.width = this.width * pd;\n canvas.height = this.height * pd;\n const surface = CanvasKit.MakeWebGLCanvasSurface(canvas);\n if (!surface) {\n throw new Error(\"Could not create surface\");\n }\n this._surface = new JsiSkSurface(CanvasKit, surface);\n this._canvas = this._surface.getCanvas();\n this.redraw();\n }\n // Call onLayout callback if it exists\n if (this.props.onLayout) {\n this.props.onLayout(evt);\n }\n }\n\n protected getSize() {\n return { width: this.width, height: this.height };\n }\n\n componentDidMount() {\n // Start render loop\n this.tick();\n }\n\n componentDidUpdate() {\n this.redraw();\n }\n\n componentWillUnmount() {\n this.unsubscribeAll();\n cancelAnimationFrame(this.requestId);\n // eslint-disable-next-line max-len\n // https://stackoverflow.com/questions/23598471/how-do-i-clean-up-and-unload-a-webgl-canvas-context-from-gpu-after-use\n // https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_lose_context\n // We delete the context, only if the context has been intialized\n if (this._surface) {\n this._canvasRef.current\n ?.getContext(\"webgl2\")\n ?.getExtension(\"WEBGL_lose_context\")\n ?.loseContext();\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 this._canvas!.clear(CanvasKit.TRANSPARENT);\n this.renderInCanvas(this._canvas!, []);\n this._surface?.ref.flush();\n return this._surface?.makeImageSnapshot(rect);\n }\n\n /**\n * Override to render\n */\n protected abstract renderInCanvas(\n canvas: SkCanvas,\n touches: TouchInfo[]\n ): void;\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n private tick() {\n if (this._mode === \"continuous\" || this._redrawRequests > 0) {\n this._redrawRequests = 0;\n if (this._canvas) {\n const touches = [...this._touches];\n this._touches = [];\n const canvas = this._canvas!;\n canvas.clear(Float32Array.of(0, 0, 0, 0));\n canvas.save();\n canvas.scale(pd, pd);\n this.renderInCanvas(canvas, touches);\n canvas.restore();\n this._surface?.ref.flush();\n }\n }\n this.requestId = requestAnimationFrame(this.tick.bind(this));\n }\n\n public redraw() {\n this._redrawRequests++;\n }\n\n /**\n * Updates the drawing mode for the skia view. This is the same\n * as declaratively setting the mode property on the SkiaView.\n * There are two drawing modes, \"continuous\" and \"default\",\n * where the continuous mode will continuously redraw the view and\n * the default mode will only redraw when any of the regular react\n * properties are changed like size and margins.\n * @param mode Drawing mode to use.\n */\n public setDrawMode(mode: DrawMode) {\n this._mode = mode;\n this.tick();\n }\n\n /**\n * Registers one or move values as a dependant value of the Skia View. The view will\n * The view will redraw itself when any of the values change.\n * @param values Values to register\n */\n public registerValues(_values: SkiaValue<unknown>[]) {\n // Unsubscribe from dependency values\n this.unsubscribeAll();\n // Register redraw dependencies on values\n _values.forEach((v) => {\n this._unsubscriptions.push(\n v.addListener(() => {\n this.redraw();\n })\n );\n });\n }\n\n private handleTouchEvent(evt: PointerEvent, touchType: TouchType) {\n this._touches.push({\n id: evt.pointerId,\n x: evt.clientX - evt.currentTarget.getClientRects()[0].left,\n y: evt.clientY - evt.currentTarget.getClientRects()[0].top,\n force: evt.pressure,\n type: touchType,\n timestamp: Date.now(),\n });\n this.redraw();\n }\n\n createTouchHandler(touchType: TouchType) {\n return (evt: PointerEvent) => this.handleTouchEvent(evt, touchType);\n }\n\n private onStart = this.createTouchHandler(TouchType.Start);\n private onActive = this.createTouchHandler(TouchType.Active);\n private onCancel = this.createTouchHandler(TouchType.Cancelled);\n private onEnd = this.createTouchHandler(TouchType.End);\n private onLayout = this.onLayoutEvent.bind(this);\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <Platform.View {...viewProps} onLayout={this.onLayout}>\n <canvas\n ref={this._canvasRef}\n style={{ display: \"flex\", flex: 1 }}\n onPointerDown={this.onStart}\n onPointerMove={this.onActive}\n onPointerUp={this.onEnd}\n onPointerCancel={this.onCancel}\n onPointerLeave={this.onEnd}\n onPointerOut={this.onEnd}\n />\n </Platform.View>\n );\n }\n}\n"],"mappings":";;;;;;;AACA;;AAMA;;AACA;;AAGA;;;;;;kNAXA;;AAaA,MAAMA,EAAE,GAAGC,kBAAA,CAASC,UAApB;;AAEO,MAAeC,eAAf,SAEGC,cAAA,CAAMC,SAFT,CAE2B;EAChCC,WAAW,CAACC,KAAD,EAAgB;IACzB,MAAMA,KAAN;;IADyB,kCAKa,IALb;;IAAA,0CAMmB,EANnB;;IAAA,kCAOU,EAPV;;IAAA,iCAQQ,IARR;;IAAA,iDASNH,cAAA,CAAMI,SAAN,EATM;;IAAA;;IAAA,yCAWD,CAXC;;IAAA,mCAYP,CAZO;;IAAA,+BAcT,CAdS;;IAAA,gCAeR,CAfQ;;IAAA,iCAsKT,KAAKC,kBAAL,CAAwBC,gBAAA,CAAUC,KAAlC,CAtKS;;IAAA,kCAuKR,KAAKF,kBAAL,CAAwBC,gBAAA,CAAUE,MAAlC,CAvKQ;;IAAA,kCAwKR,KAAKH,kBAAL,CAAwBC,gBAAA,CAAUG,SAAlC,CAxKQ;;IAAA,+BAyKX,KAAKJ,kBAAL,CAAwBC,gBAAA,CAAUI,GAAlC,CAzKW;;IAAA,kCA0KR,KAAKC,aAAL,CAAmBC,IAAnB,CAAwB,IAAxB,CA1KQ;;IAEzB,KAAKC,KAAL,GAAaV,KAAK,CAACW,IAAN,IAAc,SAA3B;EACD;;EAcOC,cAAc,GAAG;IACvB,KAAKC,gBAAL,CAAsBC,OAAtB,CAA+BC,CAAD,IAAOA,CAAC,EAAtC;;IACA,KAAKF,gBAAL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AE,KAAKrD;IAA7C,iBACE;MACE,GAAG,EAAE,KAAKd,UADZ;MAEE,KAAK,EAAE;QAAEoE,OAAO,EAAE,MAAX;QAAmBC,IAAI,EAAE;MAAzB,CAFT;MAGE,aAAa,EAAE,KAAKC,OAHtB;MAIE,aAAa,EAAE,KAAKC,QAJtB;MAKE,WAAW,EAAE,KAAKC,KALpB;MAME,eAAe,EAAE,KAAKC,QANxB;MAOE,cAAc,EAAE,KAAKD,KAPvB;MAQE,YAAY,EAAE,KAAKA;IARrB,EADF,CADF;EAcD;;AA7L+B"}
|
@@ -13,4 +13,7 @@ exports.TouchType = TouchType;
|
|
13
13
|
TouchType[TouchType["End"] = 2] = "End";
|
14
14
|
TouchType[TouchType["Cancelled"] = 3] = "Cancelled";
|
15
15
|
})(TouchType || (exports.TouchType = TouchType = {}));
|
16
|
+
/**
|
17
|
+
* Listener interface for value changes
|
18
|
+
*/
|
16
19
|
//# sourceMappingURL=types.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["TouchType"],"sources":["types.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\n\nimport type { GroupProps, RenderNode } from \"../dom/types\";\nimport type {\n SkCanvas,\n SkImage,\n SkPicture,\n SkRect,\n SkSize,\n} from \"../skia/types\";\nimport type { SkiaMutableValue, SkiaValue } from \"../values\";\nimport type { SharedValueType } from \"../renderer/processors/Animations/Animations\";\n\nexport type DrawMode = \"continuous\" | \"default\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n mode?: DrawMode;\n debug?: boolean;\n};\n\nexport enum TouchType {\n Start,\n Active,\n End,\n Cancelled,\n}\n\nexport interface TouchInfo {\n x: number;\n y: number;\n force: number;\n type: TouchType;\n id: number;\n timestamp: number;\n}\n\nexport interface DrawingInfo {\n width: number;\n height: number;\n timestamp: number;\n touches: Array<Array<TouchInfo>>;\n}\n\nexport type ExtendedTouchInfo = TouchInfo & {\n // points per second\n velocityX: number;\n velocityY: number;\n};\n\nexport type TouchHandlers = {\n onStart?: (touchInfo: TouchInfo) => void;\n onActive?: (touchInfo: ExtendedTouchInfo) => void;\n onEnd?: (touchInfo: ExtendedTouchInfo) => void;\n};\n\nexport type TouchHandler = (touchInfo: Array<Array<TouchInfo>>) => void;\n\nexport type RNSkiaDrawCallback = (canvas: SkCanvas, info: DrawingInfo) => void;\n\n/**\n * Listener interface for value changes\n */\nexport interface ValueListener {\n addListener: (callback: () => void) => number;\n removeListener: (id: number) => void;\n}\n\nexport interface ISkiaViewApi {\n setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;\n callJsiMethod: <T extends Array<unknown>>(\n nativeId: number,\n name: string,\n ...args: T\n ) => void;\n registerValuesInView: (\n nativeId: number,\n values: SkiaValue<unknown>[]\n ) => () => void;\n requestRedraw: (nativeId: number) => void;\n makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;\n}\n\nexport interface SkiaBaseViewProps extends ViewProps {\n /**\n * Sets the drawing mode for the skia view. There are two drawing\n * modes, \"continuous\" and \"default\", where the continuous mode will\n * continuously redraw the view, and the default mode will only\n * redraw when any of the regular react properties are changed like\n * sizes and margins.\n */\n mode?: DrawMode;\n /**\n * When set to true the view will display information about the\n * average time it takes to render.\n */\n debug?: boolean;\n /**\n * Pass an animated value to the onSize property to get updates when\n * the Skia view is resized.\n */\n onSize?: SkiaMutableValue<SkSize> | SharedValueType<SkSize>;\n}\n\nexport interface SkiaDrawViewProps extends SkiaBaseViewProps {\n /**\n * Draw callback. Will be called whenever the view is invalidated and\n * needs to redraw. This is either caused by a change in a react\n * property, a touch event, or a call to redraw. If the view is in\n * continuous mode the callback will be called 60 frames per second\n * by the native view.\n */\n onDraw?: RNSkiaDrawCallback;\n}\n\nexport interface SkiaPictureViewProps extends SkiaBaseViewProps {\n picture?: SkPicture;\n}\n\nexport interface SkiaDomViewProps extends SkiaBaseViewProps {\n root?: RenderNode<GroupProps>;\n onTouch?: TouchHandler;\n}\n"],"mappings":";;;;;;IAoBYA,S;;;WAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;GAAAA,S,yBAAAA,S"}
|
1
|
+
{"version":3,"names":["TouchType"],"sources":["types.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\n\nimport type { GroupProps, RenderNode } from \"../dom/types\";\nimport type {\n SkCanvas,\n SkImage,\n SkPicture,\n SkRect,\n SkSize,\n} from \"../skia/types\";\nimport type { SkiaMutableValue, SkiaValue } from \"../values\";\nimport type { SharedValueType } from \"../renderer/processors/Animations/Animations\";\n\nexport type DrawMode = \"continuous\" | \"default\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n mode?: DrawMode;\n debug?: boolean;\n};\n\nexport enum TouchType {\n Start,\n Active,\n End,\n Cancelled,\n}\n\nexport interface TouchInfo {\n x: number;\n y: number;\n force: number;\n type: TouchType;\n id: number;\n timestamp: number;\n}\n\nexport interface DrawingInfo {\n width: number;\n height: number;\n timestamp: number;\n touches: Array<Array<TouchInfo>>;\n}\n\nexport type ExtendedTouchInfo = TouchInfo & {\n // points per second\n velocityX: number;\n velocityY: number;\n};\n\nexport type TouchHandlers = {\n onStart?: (touchInfo: TouchInfo) => void;\n onActive?: (touchInfo: ExtendedTouchInfo) => void;\n onEnd?: (touchInfo: ExtendedTouchInfo) => void;\n};\n\nexport type TouchHandler = (touchInfo: Array<Array<TouchInfo>>) => void;\n\nexport type RNSkiaDrawCallback = (canvas: SkCanvas, info: DrawingInfo) => void;\n\n/**\n * Listener interface for value changes\n */\nexport interface ValueListener {\n addListener: (callback: () => void) => number;\n removeListener: (id: number) => void;\n}\n\nexport interface ISkiaViewApi {\n setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;\n callJsiMethod: <T extends Array<unknown>>(\n nativeId: number,\n name: string,\n ...args: T\n ) => void;\n registerValuesInView: (\n nativeId: number,\n values: SkiaValue<unknown>[]\n ) => () => void;\n requestRedraw: (nativeId: number) => void;\n makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;\n}\n\nexport interface SkiaBaseViewProps extends ViewProps {\n /**\n * Sets the drawing mode for the skia view. There are two drawing\n * modes, \"continuous\" and \"default\", where the continuous mode will\n * continuously redraw the view, and the default mode will only\n * redraw when any of the regular react properties are changed like\n * sizes and margins.\n */\n mode?: DrawMode;\n /**\n * When set to true the view will display information about the\n * average time it takes to render.\n */\n debug?: boolean;\n /**\n * Pass an animated value to the onSize property to get updates when\n * the Skia view is resized.\n */\n onSize?: SkiaMutableValue<SkSize> | SharedValueType<SkSize>;\n}\n\nexport interface SkiaDrawViewProps extends SkiaBaseViewProps {\n /**\n * Draw callback. Will be called whenever the view is invalidated and\n * needs to redraw. This is either caused by a change in a react\n * property, a touch event, or a call to redraw. If the view is in\n * continuous mode the callback will be called 60 frames per second\n * by the native view.\n */\n onDraw?: RNSkiaDrawCallback;\n}\n\nexport interface SkiaPictureViewProps extends SkiaBaseViewProps {\n picture?: SkPicture;\n}\n\nexport interface SkiaDomViewProps extends SkiaBaseViewProps {\n root?: RenderNode<GroupProps>;\n onTouch?: TouchHandler;\n}\n"],"mappings":";;;;;;IAoBYA,S;;;WAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;GAAAA,S,yBAAAA,S;AAuCZ;AACA;AACA"}
|
@@ -1,6 +1,10 @@
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
2
2
|
import { processRadius } from "./Radius";
|
3
|
-
export const isEdge = (pos, b) =>
|
3
|
+
export const isEdge = (pos, b) => {
|
4
|
+
"worklet";
|
5
|
+
|
6
|
+
return pos.x === b.x || pos.y === b.y || pos.x === b.width || pos.y === b.height;
|
7
|
+
}; // We have an issue to check property existence on JSI backed instances
|
4
8
|
|
5
9
|
const isRRectCtor = def => def.rect === undefined; // We have an issue to check property existence on JSI backed instances
|
6
10
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["processRadius","isEdge","pos","b","x","y","width","height","isRRectCtor","def","rect","undefined","isRectCtor","processRect","Skia","XYWHRect","processRRect","r","RRectXY"],"sources":["Rect.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { Skia, SkRect, Vector } from \"../../../skia/types\";\nimport type { RectCtor, RectDef, RRectCtor, RRectDef } from \"../../types\";\n\nimport { processRadius } from \"./Radius\";\n\nexport const isEdge = (pos: Vector, b: SkRect)
|
1
|
+
{"version":3,"names":["processRadius","isEdge","pos","b","x","y","width","height","isRRectCtor","def","rect","undefined","isRectCtor","processRect","Skia","XYWHRect","processRRect","r","RRectXY"],"sources":["Rect.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { Skia, SkRect, Vector } from \"../../../skia/types\";\nimport type { RectCtor, RectDef, RRectCtor, RRectDef } from \"../../types\";\n\nimport { processRadius } from \"./Radius\";\n\nexport const isEdge = (pos: Vector, b: SkRect) => {\n \"worklet\";\n return (\n pos.x === b.x || pos.y === b.y || pos.x === b.width || pos.y === b.height\n );\n};\n\n// We have an issue to check property existence on JSI backed instances\nconst isRRectCtor = (def: RRectDef): def is RRectCtor =>\n (def as any).rect === undefined;\n// We have an issue to check property existence on JSI backed instances\nconst isRectCtor = (def: RectDef): def is RectCtor =>\n (def as any).rect === undefined;\n\nexport const processRect = (Skia: Skia, def: RectDef) => {\n if (isRectCtor(def)) {\n return Skia.XYWHRect(def.x ?? 0, def.y ?? 0, def.width, def.height);\n } else {\n return def.rect;\n }\n};\n\nexport const processRRect = (Skia: Skia, def: RRectDef) => {\n if (isRRectCtor(def)) {\n const r = processRadius(Skia, def.r ?? 0);\n return Skia.RRectXY(\n Skia.XYWHRect(def.x ?? 0, def.y ?? 0, def.width, def.height),\n r.x,\n r.y\n );\n } else {\n return def.rect;\n }\n};\n"],"mappings":"AAAA;AAIA,SAASA,aAAT,QAA8B,UAA9B;AAEA,OAAO,MAAMC,MAAM,GAAG,CAACC,GAAD,EAAcC,CAAd,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AKD,CAPD,MAOO;IACL,OAAOI,GAAG,CAACC,IAAX;EACD;AACF,CAXM"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./useSharedValueEffect\";\nexport * from \"./renderHelpers\";\n"],"mappings":"AAAA,cAAc,wBAAd;AACA,cAAc,iBAAd"}
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./useSharedValueEffect\";\nexport * from \"./useDerivedValueOnJS\";\nexport * from \"./renderHelpers\";\n"],"mappings":"AAAA,cAAc,wBAAd;AACA,cAAc,uBAAd;AACA,cAAc,iBAAd"}
|
@@ -26,13 +26,6 @@ export function throwOnMissingReanimated() {
|
|
26
26
|
react-native-skia's integration layer API.");
|
27
27
|
}
|
28
28
|
}
|
29
|
-
|
30
|
-
function throwOnMissingReanimated3() {
|
31
|
-
if (!HAS_REANIMATED3) {
|
32
|
-
throw new Error(`Reanimated version ${reanimatedVersion} is not supported, please upgrade to 3.0.0 or newer.`);
|
33
|
-
}
|
34
|
-
}
|
35
|
-
|
36
29
|
export const useSharedValue = ((_Reanimated = Reanimated2) === null || _Reanimated === void 0 ? void 0 : _Reanimated.useSharedValue) || (value => useMemo(() => ({
|
37
30
|
value
|
38
31
|
}), [value]));
|
@@ -41,7 +34,6 @@ export const startMapper = ((_Reanimated3 = Reanimated2) === null || _Reanimated
|
|
41
34
|
export const stopMapper = ((_Reanimated4 = Reanimated2) === null || _Reanimated4 === void 0 ? void 0 : _Reanimated4.stopMapper) || throwOnMissingReanimated;
|
42
35
|
export const runOnJS = ((_Reanimated5 = Reanimated2) === null || _Reanimated5 === void 0 ? void 0 : _Reanimated5.runOnJS) || throwOnMissingReanimated;
|
43
36
|
export const isSharedValue = value => {
|
44
|
-
|
45
|
-
return !!value && Reanimated3.isSharedValue(value);
|
37
|
+
return !!value && (Reanimated3 ? Reanimated3.isSharedValue(value) : value.value !== undefined);
|
46
38
|
};
|
47
39
|
//# sourceMappingURL=moduleWrapper.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["useMemo","Reanimated2","Reanimated3","reanimatedVersion","require","version","includes","e","HAS_REANIMATED2","HAS_REANIMATED3","throwOnMissingReanimated","Error","
|
1
|
+
{"version":3,"names":["useMemo","Reanimated2","Reanimated3","reanimatedVersion","require","version","includes","e","HAS_REANIMATED2","HAS_REANIMATED3","throwOnMissingReanimated","Error","useSharedValue","value","useFrameCallback","startMapper","stopMapper","runOnJS","isSharedValue","undefined"],"sources":["moduleWrapper.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { useMemo } from \"react\";\n\nimport type { SharedValueType } from \"../../renderer/processors/Animations\";\n\n// This one is needed for the deprecated useSharedValue function\n// We can remove it once we remove the deprecation\n\nlet Reanimated2: any;\n\nlet Reanimated3: any;\nlet reanimatedVersion: string;\n\ntry {\n Reanimated2 = require(\"react-native-reanimated\");\n reanimatedVersion =\n // eslint-disable-next-line import/extensions\n require(\"react-native-reanimated/package.json\").version;\n if (\n reanimatedVersion &&\n (reanimatedVersion >= \"3.0.0\" || reanimatedVersion.includes(\"3.0.0-\"))\n ) {\n Reanimated3 = Reanimated2;\n }\n} catch (e) {}\n\nexport const HAS_REANIMATED2 = !!Reanimated2;\nexport const HAS_REANIMATED3 = !!Reanimated3;\n\nexport function throwOnMissingReanimated() {\n if (!HAS_REANIMATED2) {\n throw new Error(\n \"Reanimated was not found, make sure react-native-reanimated package is installed if you want to use \\\n react-native-skia's integration layer API.\"\n );\n }\n}\n\nexport const useSharedValue =\n Reanimated2?.useSharedValue ||\n ((value: number) => useMemo(() => ({ value }), [value]));\nexport const useFrameCallback: (...args: any[]) => any =\n Reanimated2?.useFrameCallback || throwOnMissingReanimated;\n\nexport const startMapper = Reanimated2?.startMapper || throwOnMissingReanimated;\nexport const stopMapper = Reanimated2?.stopMapper || throwOnMissingReanimated;\nexport const runOnJS = Reanimated2?.runOnJS || throwOnMissingReanimated;\nexport const isSharedValue = <T>(\n value: unknown\n): value is SharedValueType<T> => {\n return (\n !!value &&\n (Reanimated3\n ? Reanimated3.isSharedValue(value)\n : (value as any).value !== undefined)\n );\n};\n"],"mappings":";;AAAA;AACA,SAASA,OAAT,QAAwB,OAAxB;AAIA;AACA;AAEA,IAAIC,WAAJ;AAEA,IAAIC,WAAJ;AACA,IAAIC,iBAAJ;;AAEA,IAAI;EACFF,WAAW,GAAGG,OAAO,CAAC,yBAAD,CAArB;EACAD,iBAAiB,GACf;EACAC,OAAO,CAAC,sCAAD,CAAP,CAAgDC,OAFlD;;EAGA,IACEF,iBAAiB,KAChBA,iBAAiB,IAAI,OAArB,IAAgCA,iBAAiB,CAACG,QAAlB,CAA2B,QAA3B,CADhB,CADnB,EAGE;IACAJ,WAAW,GAAGD,WAAd;EACD;AACF,CAXD,CAWE,OAAOM,CAAP,EAAU,CAAE;;AAEd,OAAO,MAAMC,eAAe,GAAG,CAAC,CAACP,WAA1B;AACP,OAAO,MAAMQ,eAAe,GAAG,CAAC,CAACP,WAA1B;AAEP,OAAO,SAASQ,wBAAT,GAAoC;EACzC,IAAI,CAACF,eAAL,EAAsB;IACpB,MAAM,IAAIG,KAAJ,CACJ;AACN,iDAFU,CAAN;EAID;AACF;AAED,OAAO,MAAMC,cAAc,GACzB,gBAAAX,WAAW,UAAX,kDAAaW,cAAb,MACEC,KAAD,IAAmBb,OAAO,CAAC,OAAO;EAAEa;AAAF,CAAP,CAAD,EAAoB,CAACA,KAAD,CAApB,CAD3B,CADK;AAGP,OAAO,MAAMC,gBAAyC,GACpD,iBAAAb,WAAW,UAAX,oDAAaa,gBAAb,KAAiCJ,wBAD5B;AAGP,OAAO,MAAMK,WAAW,GAAG,iBAAAd,WAAW,UAAX,oDAAac,WAAb,KAA4BL,wBAAhD;AACP,OAAO,MAAMM,UAAU,GAAG,iBAAAf,WAAW,UAAX,oDAAae,UAAb,KAA2BN,wBAA9C;AACP,OAAO,MAAMO,OAAO,GAAG,iBAAAhB,WAAW,UAAX,oDAAagB,OAAb,KAAwBP,wBAAxC;AACP,OAAO,MAAMQ,aAAa,GACxBL,KAD2B,IAEK;EAChC,OACE,CAAC,CAACA,KAAF,KACCX,WAAW,GACRA,WAAW,CAACgB,aAAZ,CAA0BL,KAA1B,CADQ,GAEPA,KAAD,CAAeA,KAAf,KAAyBM,SAH7B,CADF;AAMD,CATM"}
|
@@ -1,12 +1,12 @@
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
2
2
|
|
3
3
|
/* eslint-disable reanimated/js-function-in-worklet */
|
4
|
-
import { startMapper, stopMapper, isSharedValue, HAS_REANIMATED3 } from "./moduleWrapper";
|
4
|
+
import { startMapper, stopMapper, isSharedValue, HAS_REANIMATED3, HAS_REANIMATED2, runOnJS } from "./moduleWrapper";
|
5
5
|
|
6
6
|
const _bindings = new WeakMap();
|
7
7
|
|
8
8
|
export function extractReanimatedProps(props) {
|
9
|
-
if (!HAS_REANIMATED3) {
|
9
|
+
if (!HAS_REANIMATED3 && !HAS_REANIMATED2) {
|
10
10
|
return [props, {}];
|
11
11
|
}
|
12
12
|
|
@@ -30,7 +30,53 @@ export function extractReanimatedProps(props) {
|
|
30
30
|
|
31
31
|
return [otherProps, reanimatedProps];
|
32
32
|
}
|
33
|
+
|
34
|
+
function bindReanimatedProps2(container, node, reanimatedProps) {
|
35
|
+
const sharedValues = Object.values(reanimatedProps);
|
36
|
+
|
37
|
+
const previousMapperId = _bindings.get(node);
|
38
|
+
|
39
|
+
if (previousMapperId !== undefined) {
|
40
|
+
stopMapper(previousMapperId);
|
41
|
+
}
|
42
|
+
|
43
|
+
if (sharedValues.length > 0) {
|
44
|
+
const viewId = container.getNativeId();
|
45
|
+
const {
|
46
|
+
SkiaViewApi
|
47
|
+
} = global;
|
48
|
+
|
49
|
+
const updateProps = () => {
|
50
|
+
for (const propName in reanimatedProps) {
|
51
|
+
node && node.setProp(propName, reanimatedProps[propName].value);
|
52
|
+
} // On React Native we use the SkiaViewApi to redraw because it can
|
53
|
+
// run on the worklet thread (container.redraw can't)
|
54
|
+
// if SkiaViewApi is undefined, we are on web and container.redraw()
|
55
|
+
// can safely be invoked
|
56
|
+
|
57
|
+
|
58
|
+
if (SkiaViewApi) {
|
59
|
+
SkiaViewApi.requestRedraw(viewId);
|
60
|
+
} else {
|
61
|
+
container.redraw();
|
62
|
+
}
|
63
|
+
};
|
64
|
+
|
65
|
+
const mapperId = startMapper(() => {
|
66
|
+
"worklet";
|
67
|
+
|
68
|
+
runOnJS(updateProps)();
|
69
|
+
}, sharedValues);
|
70
|
+
|
71
|
+
_bindings.set(node, mapperId);
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
33
75
|
export function bindReanimatedProps(container, node, reanimatedProps) {
|
76
|
+
if (HAS_REANIMATED2) {
|
77
|
+
return bindReanimatedProps2(container, node, reanimatedProps);
|
78
|
+
}
|
79
|
+
|
34
80
|
if (!HAS_REANIMATED3) {
|
35
81
|
return;
|
36
82
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["startMapper","stopMapper","isSharedValue","HAS_REANIMATED3","_bindings","WeakMap","extractReanimatedProps","props","reanimatedProps","otherProps","propName","propValue","value","
|
1
|
+
{"version":3,"names":["startMapper","stopMapper","isSharedValue","HAS_REANIMATED3","HAS_REANIMATED2","runOnJS","_bindings","WeakMap","extractReanimatedProps","props","reanimatedProps","otherProps","propName","propValue","value","bindReanimatedProps2","container","node","sharedValues","Object","values","previousMapperId","get","undefined","length","viewId","getNativeId","SkiaViewApi","global","updateProps","setProp","requestRedraw","redraw","mapperId","set","bindReanimatedProps"],"sources":["renderHelpers.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable reanimated/js-function-in-worklet */\nimport type { Container } from \"../../renderer/Container\";\nimport type { AnimatedProps } from \"../../renderer/processors\";\nimport type { Node } from \"../../dom/types\";\n\nimport {\n startMapper,\n stopMapper,\n isSharedValue,\n HAS_REANIMATED3,\n HAS_REANIMATED2,\n runOnJS,\n} from \"./moduleWrapper\";\n\nconst _bindings = new WeakMap<Node<unknown>, unknown>();\n\nexport function extractReanimatedProps(props: AnimatedProps<any>) {\n if (!HAS_REANIMATED3 && !HAS_REANIMATED2) {\n return [props, {}];\n }\n const reanimatedProps = {} as AnimatedProps<any>;\n const otherProps = {} as AnimatedProps<any>;\n for (const propName in props) {\n if (propName === \"children\") {\n continue;\n }\n const propValue = props[propName];\n if (isSharedValue(propValue)) {\n reanimatedProps[propName] = propValue;\n otherProps[propName] = propValue.value;\n } else {\n otherProps[propName] = propValue;\n }\n }\n return [otherProps, reanimatedProps];\n}\n\nfunction bindReanimatedProps2(\n container: Container,\n node: Node<any>,\n reanimatedProps: AnimatedProps<any>\n) {\n const sharedValues = Object.values(reanimatedProps);\n const previousMapperId = _bindings.get(node);\n if (previousMapperId !== undefined) {\n stopMapper(previousMapperId);\n }\n if (sharedValues.length > 0) {\n const viewId = container.getNativeId();\n const { SkiaViewApi } = global;\n const updateProps = () => {\n for (const propName in reanimatedProps) {\n node && node.setProp(propName, reanimatedProps[propName].value);\n }\n // On React Native we use the SkiaViewApi to redraw because it can\n // run on the worklet thread (container.redraw can't)\n // if SkiaViewApi is undefined, we are on web and container.redraw()\n // can safely be invoked\n if (SkiaViewApi) {\n SkiaViewApi.requestRedraw(viewId);\n } else {\n container.redraw();\n }\n };\n const mapperId = startMapper(() => {\n \"worklet\";\n runOnJS(updateProps)();\n }, sharedValues);\n _bindings.set(node, mapperId);\n }\n}\n\nexport function bindReanimatedProps(\n container: Container,\n node: Node<any>,\n reanimatedProps: AnimatedProps<any>\n) {\n if (HAS_REANIMATED2) {\n return bindReanimatedProps2(container, node, reanimatedProps);\n }\n if (!HAS_REANIMATED3) {\n return;\n }\n const sharedValues = Object.values(reanimatedProps);\n const previousMapperId = _bindings.get(node);\n if (previousMapperId !== undefined) {\n stopMapper(previousMapperId);\n }\n if (sharedValues.length > 0) {\n const viewId = container.getNativeId();\n const { SkiaViewApi } = global;\n const mapperId = startMapper(() => {\n \"worklet\";\n for (const propName in reanimatedProps) {\n node && node.setProp(propName, reanimatedProps[propName].value);\n }\n // On React Native we use the SkiaViewApi to redraw because it can\n // run on the worklet thread (container.redraw can't)\n // if SkiaViewApi is undefined, we are on web and container.redraw()\n // can safely be invoked\n if (SkiaViewApi) {\n SkiaViewApi.requestRedraw(viewId);\n } else {\n container.redraw();\n }\n }, sharedValues);\n _bindings.set(node, mapperId);\n }\n}\n"],"mappings":"AAAA;;AACA;AAKA,SACEA,WADF,EAEEC,UAFF,EAGEC,aAHF,EAIEC,eAJF,EAKEC,eALF,EAMEC,OANF,QAOO,iBAPP;;AASA,MAAMC,SAAS,GAAG,IAAIC,OAAJ,EAAlB;;AAEA,OAAO,SAASC,sBAAT,CAAgCC,KAAhC,EAA2D;EAChE,IAAI,CAACN,eAAD,IAAoB,CAACC,eAAzB,EAA0C;IACxC,OAAO,CAACK,KAAD,EAAQ,EAAR,CAAP;EACD;;EACD,MAAMC,eAAe,GAAG,EAAxB;EACA,MAAMC,UAAU,GAAG,EAAnB;;EACA,KAAK,MAAMC,QAAX,IAAuBH,KAAvB,EAA8B;IAC5B,IAAIG,QAAQ,KAAK,UAAjB,EAA6B;MAC3B;IACD;;IACD,MAAMC,SAAS,GAAGJ,KAAK,CAACG,QAAD,CAAvB;;IACA,IAAIV,aAAa,CAACW,SAAD,CAAjB,EAA8B;MAC5BH,eAAe,CAACE,QAAD,CAAf,GAA4BC,SAA5B;MACAF,UAAU,CAACC,QAAD,CAAV,GAAuBC,SAAS,CAACC,KAAjC;IACD,CAHD,MAGO;MACLH,UAAU,CAACC,QAAD,CAAV,GAAuBC,SAAvB;IACD;EACF;;EACD,OAAO,CAACF,UAAD,EAAaD,eAAb,CAAP;AACD;;AAED,SAASK,oBAAT,CACEC,SADF,EAEEC,IAFF,EAGEP,eAHF,EAIE;EACA,MAAMQ,YAAY,GAAGC,MAAM,CAACC,MAAP,CAAcV,eAAd,CAArB;;EACA,MAAMW,gBAA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CAAV;EACD;;EACD,IAAIH,YAAY,CAACM,MAAb,GAAsB,CAA1B,EAA6B;IAC3B,MAAMC,MAAM,GAAGT,SAAS,CAACU,WAAV,EAAf;IACA,MAAM;MAAEC;IAAF,IAAkBC,MAAxB;IACA,MAAMK,QAAQ,GAAGjC,WAAW,CAAC,MAAM;MACjC;;MACA,KAAK,MAAMY,QAAX,IAAuBF,eAAvB,EAAwC;QACtCO,IAAI,IAAIA,IAAI,CAACa,OAAL,CAAalB,QAAb,EAAuBF,eAAe,CAACE,QAAD,CAAf,CAA0BE,KAAjD,CAAR;MACD,CAJgC,CAKjC;MACA;MACA;MACA;;;MACA,IAAIa,WAAJ,EAAiB;QACfA,WAAW,CAACI,aAAZ,CAA0BN,MAA1B;MACD,CAFD,MAEO;QACLT,SAAS,CAACgB,MAAV;MACD;IACF,CAd2B,EAczBd,YAdyB,CAA5B;;IAeAZ,SAAS,CAAC4B,GAAV,CAAcjB,IAAd,EAAoBgB,QAApB;EACD;AACF"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { useEffect } from "react";
|
2
|
+
import { useSharedValue, runOnJS, startMapper, stopMapper } from "./moduleWrapper";
|
3
|
+
export const useDerivedValueOnJS = (fn, deps) => {
|
4
|
+
const value = useSharedValue(fn());
|
5
|
+
useEffect(() => {
|
6
|
+
const mapperId = startMapper(() => {
|
7
|
+
"worklet";
|
8
|
+
|
9
|
+
runOnJS(fn)();
|
10
|
+
}, deps);
|
11
|
+
return () => stopMapper(mapperId);
|
12
|
+
}, [deps, fn]);
|
13
|
+
return value;
|
14
|
+
};
|
15
|
+
//# sourceMappingURL=useDerivedValueOnJS.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["useEffect","useSharedValue","runOnJS","startMapper","stopMapper","useDerivedValueOnJS","fn","deps","value","mapperId"],"sources":["useDerivedValueOnJS.ts"],"sourcesContent":["import { useEffect, type DependencyList } from \"react\";\n\nimport {\n useSharedValue,\n runOnJS,\n startMapper,\n stopMapper,\n} from \"./moduleWrapper\";\n\nexport const useDerivedValueOnJS = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fn: () => any,\n deps?: DependencyList\n) => {\n const value = useSharedValue(fn());\n useEffect(() => {\n const mapperId = startMapper(() => {\n \"worklet\";\n runOnJS(fn)();\n }, deps);\n return () => stopMapper(mapperId);\n }, [deps, fn]);\n return value;\n};\n"],"mappings":"AAAA,SAASA,SAAT,QAA+C,OAA/C;AAEA,SACEC,cADF,EAEEC,OAFF,EAGEC,WAHF,EAIEC,UAJF,QAKO,iBALP;AAOA,OAAO,MAAMC,mBAAmB,GAAG,CAEjCC,EAFiC,EAGjCC,IAHiC,KAI9B;EACH,MAAMC,KAAK,GAAGP,cAAc,CAACK,EAAE,EAAH,CAA5B;EACAN,SAAS,CAAC,MAAM;IACd,MAAMS,QAAQ,GAAGN,WAAW,CAAC,MAAM;MACjC;;MACAD,OAAO,CAACI,EAAD,CAAP;IACD,CAH2B,EAGzBC,IAHyB,CAA5B;IAIA,OAAO,MAAMH,UAAU,CAACK,QAAD,CAAvB;EACD,CANQ,EAMN,CAACF,IAAD,EAAOD,EAAP,CANM,CAAT;EAOA,OAAOE,KAAP;AACD,CAdM"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { useEffect } from "react";
|
2
|
-
import { HAS_REANIMATED2, useSharedValue, runOnJS, startMapper, stopMapper
|
2
|
+
import { HAS_REANIMATED2, useSharedValue, runOnJS, startMapper, stopMapper } from "./moduleWrapper";
|
3
3
|
/**
|
4
4
|
* Connects a shared value from reanimated to a SkiaView or Canvas
|
5
5
|
* so whenever the shared value changes the SkiaView will redraw.
|
@@ -12,11 +12,8 @@ export const useSharedValueEffect = function (cb, value) {
|
|
12
12
|
values[_key - 2] = arguments[_key];
|
13
13
|
}
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
Learn more at https://shopify.github.io/react-native-skia/docs/animations/reanimated.`);
|
18
|
-
}
|
19
|
-
|
15
|
+
console.warn(`useSharedValueEffect() is deprecated and will be removed in the next release
|
16
|
+
Learn more at https://shopify.github.io/react-native-skia/docs/animations/animations.`);
|
20
17
|
const input = useSharedValue(0);
|
21
18
|
useEffect(() => {
|
22
19
|
if (!HAS_REANIMATED2) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["useEffect","HAS_REANIMATED2","useSharedValue","runOnJS","startMapper","stopMapper","
|
1
|
+
{"version":3,"names":["useEffect","HAS_REANIMATED2","useSharedValue","runOnJS","startMapper","stopMapper","useSharedValueEffect","cb","value","values","console","warn","input","mapperId","undefined"],"sources":["useSharedValueEffect.ts"],"sourcesContent":["import { useEffect } from \"react\";\n\nimport type { SharedValueType } from \"../../renderer/processors/Animations\";\n\nimport {\n HAS_REANIMATED2,\n useSharedValue,\n runOnJS,\n startMapper,\n stopMapper,\n} from \"./moduleWrapper\";\n\n/**\n * Connects a shared value from reanimated to a SkiaView or Canvas\n * so whenever the shared value changes the SkiaView will redraw.\n * @param cb Callback that will be called whenever the shared value changes.\n * @param values One or more shared values to listen for.\n */\nexport const useSharedValueEffect = <T = number>(\n cb: () => void,\n value: SharedValueType<T>,\n ...values: SharedValueType<T>[]\n) => {\n console.warn(\n `useSharedValueEffect() is deprecated and will be removed in the next release\nLearn more at https://shopify.github.io/react-native-skia/docs/animations/animations.`\n );\n const input = useSharedValue(0);\n\n useEffect(() => {\n if (!HAS_REANIMATED2) {\n console.warn(\n \"Reanimated was not found and the useSharedValueEffect hook will have no effect.\"\n );\n } else {\n // Start a mapper in Reanimated\n const mapperId = startMapper(\n () => {\n \"worklet\";\n runOnJS(cb)();\n },\n [value, ...values],\n [input]\n );\n // Return unregistering the mapper\n return () => {\n if (stopMapper && mapperId !== undefined) {\n stopMapper(mapperId);\n }\n };\n }\n return () => {};\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [input, value, ...values]);\n};\n"],"mappings":"AAAA,SAASA,SAAT,QAA0B,OAA1B;AAIA,SACEC,eADF,EAEEC,cAFF,EAGEC,OAHF,EAIEC,WAJF,EAKEC,UALF,QAMO,iBANP;AAQA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,oBAAoB,GAAG,UAClCC,EADkC,EAElCC,KAFkC,EAI/B;EAAA,kCADAC,MACA;IADAA,MACA;EAAA;;EACHC,OAAO,CAACC,IAAR,CACG;AACL,sFAFE;EAIA,MAAMC,KAAK,GAAGV,cAAc,CAAC,CAAD,CAA5B;EAEAF,SAAS,CAAC,MAAM;IACd,IAAI,CAACC,eAAL,EAAsB;MACpBS,OAAO,CAACC,IAAR,CACE,iFADF;IAGD,CAJD,MAIO;MACL;MACA,MAAME,QAAQ,GAAGT,WAAW,CAC1B,MAAM;QACJ;;QACAD,OAAO,CAACI,EAAD,CAAP;MACD,CAJyB,EAK1B,CAACC,KAAD,EAAQ,GAAGC,MAAX,CAL0B,EAM1B,CAACG,KAAD,CAN0B,CAA5B,CAFK,CAUL;;MACA,OAAO,MAAM;QACX,IAAIP,UAAU,IAAIQ,QAAQ,KAAKC,SAA/B,EAA0C;UACxCT,UAAU,CAACQ,QAAD,CAAV;QACD;MACF,CAJD;IAKD;;IACD,OAAO,MAAM,CAAE,CAAf,CAtBc,CAuBd;EACD,CAxBQ,EAwBN,CAACD,KAAD,EAAQJ,KAAR,EAAe,GAAGC,MAAlB,CAxBM,CAAT;AAyBD,CApCM"}
|
package/lib/module/index.d.ts
CHANGED
package/lib/module/index.js
CHANGED
package/lib/module/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["import \"./skia/NativeSetup\";\nexport * from \"./renderer\";\nexport * from \"./renderer/Canvas\";\nexport * from \"./renderer/Offscreen\";\nexport * from \"./views\";\nexport * from \"./skia\";\nexport * from \"./external\";\nexport * from \"./values\";\nexport * from \"./animation\";\nexport * from \"./dom/types\";\nexport * from \"./dom/nodes\";\n"],"mappings":"AAAA,OAAO,oBAAP;AACA,cAAc,YAAd;AACA,cAAc,mBAAd;AACA,cAAc,sBAAd;AACA,cAAc,SAAd;AACA,cAAc,QAAd;AACA,cAAc,YAAd;AACA,cAAc,UAAd;AACA,cAAc,aAAd;AACA,cAAc,aAAd;AACA,cAAc,aAAd"}
|
1
|
+
{"version":3,"names":["JsiSkImage"],"sources":["index.ts"],"sourcesContent":["import \"./skia/NativeSetup\";\nexport { JsiSkImage } from \"./skia/web/JsiSkImage\";\nexport * from \"./renderer\";\nexport * from \"./renderer/Canvas\";\nexport * from \"./renderer/Offscreen\";\nexport * from \"./views\";\nexport * from \"./skia\";\nexport * from \"./external\";\nexport * from \"./values\";\nexport * from \"./animation\";\nexport * from \"./dom/types\";\nexport * from \"./dom/nodes\";\n"],"mappings":"AAAA,OAAO,oBAAP;AACA,SAASA,UAAT,QAA2B,uBAA3B;AACA,cAAc,YAAd;AACA,cAAc,mBAAd;AACA,cAAc,sBAAd;AACA,cAAc,SAAd;AACA,cAAc,QAAd;AACA,cAAc,YAAd;AACA,cAAc,UAAd;AACA,cAAc,aAAd;AACA,cAAc,aAAd;AACA,cAAc,aAAd"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["BlurStyle","isMaskFilter","obj","__typename__"],"sources":["MaskFilter.ts"],"sourcesContent":["import type { SkJSIInstance } from \"./JsiInstance\";\n\nexport enum BlurStyle {\n Normal, //!< fuzzy inside and outside\n Solid, //!< solid inside, fuzzy outside\n Outer, //!< nothing inside, fuzzy outside\n Inner, //!< fuzzy inside, nothing outside\n}\n\nexport const isMaskFilter = (\n obj: SkJSIInstance<string> | null\n): obj is SkMaskFilter => obj !== null && obj.__typename__ === \"MaskFilter\";\n\nexport type SkMaskFilter = SkJSIInstance<\"MaskFilter\">;\n\n/**\n * See SkMaskFilter.h for more details.\n */\nexport interface MaskFilterFactory {\n /**\n * Create a blur maskfilter\n * @param style\n * @param sigma - Standard deviation of the Gaussian blur to apply. Must be > 0.\n * @param respectCTM - if true the blur's sigma is modified by the CTM.\n */\n MakeBlur(style: BlurStyle, sigma: number, respectCTM: boolean): SkMaskFilter;\n}\n"],"mappings":"AAEA,WAAYA,SAAZ;;WAAYA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;GAAAA,S,KAAAA,S;;AAOZ,OAAO,MAAMC,YAAY,GACvBC,GAD0B,IAEFA,GAAG,KAAK,IAAR,IAAgBA,GAAG,CAACC,YAAJ,KAAqB,YAFxD"}
|
1
|
+
{"version":3,"names":["BlurStyle","isMaskFilter","obj","__typename__"],"sources":["MaskFilter.ts"],"sourcesContent":["import type { SkJSIInstance } from \"./JsiInstance\";\n\nexport enum BlurStyle {\n Normal, //!< fuzzy inside and outside\n Solid, //!< solid inside, fuzzy outside\n Outer, //!< nothing inside, fuzzy outside\n Inner, //!< fuzzy inside, nothing outside\n}\n\nexport const isMaskFilter = (\n obj: SkJSIInstance<string> | null\n): obj is SkMaskFilter => obj !== null && obj.__typename__ === \"MaskFilter\";\n\nexport type SkMaskFilter = SkJSIInstance<\"MaskFilter\">;\n\n/**\n * See SkMaskFilter.h for more details.\n */\nexport interface MaskFilterFactory {\n /**\n * Create a blur maskfilter\n * @param style\n * @param sigma - Standard deviation of the Gaussian blur to apply. Must be > 0.\n * @param respectCTM - if true the blur's sigma is modified by the CTM.\n */\n MakeBlur(style: BlurStyle, sigma: number, respectCTM: boolean): SkMaskFilter;\n}\n"],"mappings":"AAEA,WAAYA,SAAZ;;WAAYA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;GAAAA,S,KAAAA,S;;AAOZ,OAAO,MAAMC,YAAY,GACvBC,GAD0B,IAEFA,GAAG,KAAK,IAAR,IAAgBA,GAAG,CAACC,YAAJ,KAAqB,YAFxD;AAMP;AACA;AACA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["TouchType"],"sources":["types.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\n\nimport type { GroupProps, RenderNode } from \"../dom/types\";\nimport type {\n SkCanvas,\n SkImage,\n SkPicture,\n SkRect,\n SkSize,\n} from \"../skia/types\";\nimport type { SkiaMutableValue, SkiaValue } from \"../values\";\nimport type { SharedValueType } from \"../renderer/processors/Animations/Animations\";\n\nexport type DrawMode = \"continuous\" | \"default\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n mode?: DrawMode;\n debug?: boolean;\n};\n\nexport enum TouchType {\n Start,\n Active,\n End,\n Cancelled,\n}\n\nexport interface TouchInfo {\n x: number;\n y: number;\n force: number;\n type: TouchType;\n id: number;\n timestamp: number;\n}\n\nexport interface DrawingInfo {\n width: number;\n height: number;\n timestamp: number;\n touches: Array<Array<TouchInfo>>;\n}\n\nexport type ExtendedTouchInfo = TouchInfo & {\n // points per second\n velocityX: number;\n velocityY: number;\n};\n\nexport type TouchHandlers = {\n onStart?: (touchInfo: TouchInfo) => void;\n onActive?: (touchInfo: ExtendedTouchInfo) => void;\n onEnd?: (touchInfo: ExtendedTouchInfo) => void;\n};\n\nexport type TouchHandler = (touchInfo: Array<Array<TouchInfo>>) => void;\n\nexport type RNSkiaDrawCallback = (canvas: SkCanvas, info: DrawingInfo) => void;\n\n/**\n * Listener interface for value changes\n */\nexport interface ValueListener {\n addListener: (callback: () => void) => number;\n removeListener: (id: number) => void;\n}\n\nexport interface ISkiaViewApi {\n setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;\n callJsiMethod: <T extends Array<unknown>>(\n nativeId: number,\n name: string,\n ...args: T\n ) => void;\n registerValuesInView: (\n nativeId: number,\n values: SkiaValue<unknown>[]\n ) => () => void;\n requestRedraw: (nativeId: number) => void;\n makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;\n}\n\nexport interface SkiaBaseViewProps extends ViewProps {\n /**\n * Sets the drawing mode for the skia view. There are two drawing\n * modes, \"continuous\" and \"default\", where the continuous mode will\n * continuously redraw the view, and the default mode will only\n * redraw when any of the regular react properties are changed like\n * sizes and margins.\n */\n mode?: DrawMode;\n /**\n * When set to true the view will display information about the\n * average time it takes to render.\n */\n debug?: boolean;\n /**\n * Pass an animated value to the onSize property to get updates when\n * the Skia view is resized.\n */\n onSize?: SkiaMutableValue<SkSize> | SharedValueType<SkSize>;\n}\n\nexport interface SkiaDrawViewProps extends SkiaBaseViewProps {\n /**\n * Draw callback. Will be called whenever the view is invalidated and\n * needs to redraw. This is either caused by a change in a react\n * property, a touch event, or a call to redraw. If the view is in\n * continuous mode the callback will be called 60 frames per second\n * by the native view.\n */\n onDraw?: RNSkiaDrawCallback;\n}\n\nexport interface SkiaPictureViewProps extends SkiaBaseViewProps {\n picture?: SkPicture;\n}\n\nexport interface SkiaDomViewProps extends SkiaBaseViewProps {\n root?: RenderNode<GroupProps>;\n onTouch?: TouchHandler;\n}\n"],"mappings":"AAoBA,WAAYA,SAAZ;;WAAYA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;GAAAA,S,KAAAA,S"}
|
1
|
+
{"version":3,"names":["TouchType"],"sources":["types.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\n\nimport type { GroupProps, RenderNode } from \"../dom/types\";\nimport type {\n SkCanvas,\n SkImage,\n SkPicture,\n SkRect,\n SkSize,\n} from \"../skia/types\";\nimport type { SkiaMutableValue, SkiaValue } from \"../values\";\nimport type { SharedValueType } from \"../renderer/processors/Animations/Animations\";\n\nexport type DrawMode = \"continuous\" | \"default\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n mode?: DrawMode;\n debug?: boolean;\n};\n\nexport enum TouchType {\n Start,\n Active,\n End,\n Cancelled,\n}\n\nexport interface TouchInfo {\n x: number;\n y: number;\n force: number;\n type: TouchType;\n id: number;\n timestamp: number;\n}\n\nexport interface DrawingInfo {\n width: number;\n height: number;\n timestamp: number;\n touches: Array<Array<TouchInfo>>;\n}\n\nexport type ExtendedTouchInfo = TouchInfo & {\n // points per second\n velocityX: number;\n velocityY: number;\n};\n\nexport type TouchHandlers = {\n onStart?: (touchInfo: TouchInfo) => void;\n onActive?: (touchInfo: ExtendedTouchInfo) => void;\n onEnd?: (touchInfo: ExtendedTouchInfo) => void;\n};\n\nexport type TouchHandler = (touchInfo: Array<Array<TouchInfo>>) => void;\n\nexport type RNSkiaDrawCallback = (canvas: SkCanvas, info: DrawingInfo) => void;\n\n/**\n * Listener interface for value changes\n */\nexport interface ValueListener {\n addListener: (callback: () => void) => number;\n removeListener: (id: number) => void;\n}\n\nexport interface ISkiaViewApi {\n setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;\n callJsiMethod: <T extends Array<unknown>>(\n nativeId: number,\n name: string,\n ...args: T\n ) => void;\n registerValuesInView: (\n nativeId: number,\n values: SkiaValue<unknown>[]\n ) => () => void;\n requestRedraw: (nativeId: number) => void;\n makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;\n}\n\nexport interface SkiaBaseViewProps extends ViewProps {\n /**\n * Sets the drawing mode for the skia view. There are two drawing\n * modes, \"continuous\" and \"default\", where the continuous mode will\n * continuously redraw the view, and the default mode will only\n * redraw when any of the regular react properties are changed like\n * sizes and margins.\n */\n mode?: DrawMode;\n /**\n * When set to true the view will display information about the\n * average time it takes to render.\n */\n debug?: boolean;\n /**\n * Pass an animated value to the onSize property to get updates when\n * the Skia view is resized.\n */\n onSize?: SkiaMutableValue<SkSize> | SharedValueType<SkSize>;\n}\n\nexport interface SkiaDrawViewProps extends SkiaBaseViewProps {\n /**\n * Draw callback. Will be called whenever the view is invalidated and\n * needs to redraw. This is either caused by a change in a react\n * property, a touch event, or a call to redraw. If the view is in\n * continuous mode the callback will be called 60 frames per second\n * by the native view.\n */\n onDraw?: RNSkiaDrawCallback;\n}\n\nexport interface SkiaPictureViewProps extends SkiaBaseViewProps {\n picture?: SkPicture;\n}\n\nexport interface SkiaDomViewProps extends SkiaBaseViewProps {\n root?: RenderNode<GroupProps>;\n onTouch?: TouchHandler;\n}\n"],"mappings":"AAoBA,WAAYA,SAAZ;;WAAYA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;GAAAA,S,KAAAA,S;AAuCZ;AACA;AACA"}
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
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_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
|
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>libskparagraph.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>libskparagraph.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
|