@shopify/react-native-skia 2.0.4 → 2.0.6
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/CMakeLists.txt +10 -0
- package/android/build.gradle +2 -1
- package/apple/SkiaCVPixelBufferUtils.mm +8 -4
- package/cpp/api/JsiSkCanvas.h +10 -8
- package/cpp/api/JsiSkFont.h +14 -18
- package/cpp/api/JsiSkPath.h +4 -2
- package/cpp/api/JsiSkPathEffectFactory.h +2 -2
- package/cpp/api/JsiSkTextBlobFactory.h +5 -3
- package/cpp/api/JsiSkTypeface.h +5 -4
- package/cpp/api/recorder/Drawings.h +26 -20
- package/cpp/api/recorder/PathEffects.h +3 -2
- package/cpp/skia/include/android/SkAndroidFrameworkUtils.h +1 -1
- package/cpp/skia/include/android/SkImageAndroid.h +1 -8
- package/cpp/skia/include/config/SkUserConfig.h +9 -0
- package/cpp/skia/include/core/SkCPUContext.h +31 -0
- package/cpp/skia/include/core/SkCPURecorder.h +69 -0
- package/cpp/skia/include/core/SkCanvas.h +57 -13
- package/cpp/skia/include/core/SkContourMeasure.h +1 -1
- package/cpp/skia/include/core/SkData.h +63 -37
- package/cpp/skia/include/core/SkFont.h +94 -65
- package/cpp/skia/include/core/SkImage.h +10 -9
- package/cpp/skia/include/core/SkImageGenerator.h +3 -0
- package/cpp/skia/include/core/SkMatrix.h +102 -116
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPath.h +163 -60
- package/cpp/skia/include/core/SkPathBuilder.h +713 -30
- package/cpp/skia/include/core/SkPathTypes.h +5 -1
- package/cpp/skia/include/core/SkPictureRecorder.h +6 -6
- package/cpp/skia/include/core/SkRecorder.h +35 -0
- package/cpp/skia/include/core/SkRect.h +57 -27
- package/cpp/skia/include/core/SkRegion.h +1 -1
- package/cpp/skia/include/core/SkSurface.h +8 -1
- package/cpp/skia/include/core/SkTextBlob.h +50 -6
- package/cpp/skia/include/core/SkTraceMemoryDump.h +7 -0
- package/cpp/skia/include/core/SkTypeface.h +53 -26
- package/cpp/skia/include/core/SkTypes.h +6 -0
- package/cpp/skia/include/effects/SkDashPathEffect.h +9 -3
- package/cpp/skia/include/effects/SkRuntimeEffect.h +1 -1
- package/cpp/skia/include/encode/SkEncoder.h +1 -1
- package/cpp/skia/include/encode/SkICC.h +1 -1
- package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +23 -0
- package/cpp/skia/include/gpu/ganesh/GrRecordingContext.h +12 -0
- package/cpp/skia/include/gpu/graphite/Context.h +32 -8
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +22 -4
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +21 -4
- package/cpp/skia/include/gpu/graphite/PrecompileContext.h +16 -2
- package/cpp/skia/include/gpu/graphite/Recorder.h +30 -10
- package/cpp/skia/include/gpu/graphite/Recording.h +7 -3
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +3 -3
- package/cpp/skia/include/gpu/graphite/precompile/PaintOptions.h +15 -0
- package/cpp/skia/include/gpu/graphite/precompile/PrecompileShader.h +89 -13
- package/cpp/skia/include/gpu/graphite/vk/precompile/VulkanPrecompileShader.h +39 -0
- package/cpp/skia/include/gpu/vk/VulkanBackendContext.h +1 -1
- package/cpp/skia/include/gpu/vk/VulkanPreferredFeatures.h +214 -0
- package/cpp/skia/include/pathops/SkPathOps.h +7 -111
- package/cpp/skia/include/ports/SkFontMgr_fontconfig.h +3 -0
- package/cpp/skia/include/private/SkGainmapShader.h +10 -4
- package/cpp/skia/include/private/SkPathRef.h +6 -2
- package/cpp/skia/include/private/base/SkAlign.h +11 -0
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_icd.h +255 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_layer.h +203 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_platform.h +1 -2
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_av1std.h +390 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_av1std_decode.h +106 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_av1std_encode.h +140 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std_decode.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std_encode.h +144 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std_decode.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std_encode.h +158 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codecs_common.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_android.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_beta.h +242 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_core.h +10094 -5707
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_directfb.h +55 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_fuchsia.h +288 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_ggp.h +59 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_ios.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_macos.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_metal.h +238 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_screen.h +110 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_vi.h +47 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_wayland.h +55 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_win32.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xcb.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xlib.h +60 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xlib_xrandr.h +46 -0
- package/cpp/skia/modules/pathops/include/SkPathOps.h +121 -0
- package/cpp/skia/modules/skcms/src/skcms_internals.h +10 -2
- package/cpp/skia/modules/skcms/src/skcms_public.h +39 -10
- package/lib/commonjs/sksg/Container.d.ts +1 -0
- package/lib/commonjs/sksg/Container.js +3 -0
- package/lib/commonjs/sksg/Container.js.map +1 -1
- package/lib/commonjs/sksg/Reconciler.js +1 -0
- package/lib/commonjs/sksg/Reconciler.js.map +1 -1
- package/lib/module/sksg/Container.d.ts +1 -0
- package/lib/module/sksg/Container.js +3 -0
- package/lib/module/sksg/Container.js.map +1 -1
- package/lib/module/sksg/Reconciler.js +1 -0
- package/lib/module/sksg/Reconciler.js.map +1 -1
- package/lib/typescript/lib/commonjs/sksg/Container.d.ts +2 -1
- package/lib/typescript/lib/commonjs/sksg/Reconciler.d.ts +6 -3
- package/lib/typescript/lib/module/sksg/Container.d.ts +2 -1
- package/lib/typescript/lib/module/sksg/Reconciler.d.ts +6 -3
- package/lib/typescript/src/sksg/Container.d.ts +1 -0
- package/libs/android/arm64-v8a/libpathops.a +0 -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_icu.a +0 -0
- package/libs/android/arm64-v8a/libsvg.a +0 -0
- package/libs/android/armeabi-v7a/libpathops.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_icu.a +0 -0
- package/libs/android/armeabi-v7a/libsvg.a +0 -0
- package/libs/android/x86/libpathops.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_icu.a +0 -0
- package/libs/android/x86/libsvg.a +0 -0
- package/libs/android/x86_64/libpathops.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_icu.a +0 -0
- package/libs/android/x86_64/libsvg.a +0 -0
- package/libs/apple/libpathops.xcframework/Info.plist +94 -0
- package/libs/apple/libpathops.xcframework/ios-arm64_arm64e/libpathops.a +0 -0
- package/libs/apple/libpathops.xcframework/ios-arm64_arm64e_x86_64-simulator/libpathops.a +0 -0
- package/libs/apple/libpathops.xcframework/macos-arm64_x86_64/libpathops.a +0 -0
- package/libs/apple/libpathops.xcframework/tvos-arm64_arm64e/libpathops.a +0 -0
- package/libs/apple/libpathops.xcframework/tvos-arm64_arm64e_x86_64-simulator/libpathops.a +0 -0
- package/libs/apple/libskia.xcframework/Info.plist +7 -7
- package/libs/apple/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/macos-arm64_x86_64/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/tvos-arm64_arm64e/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/apple/libskottie.xcframework/Info.plist +10 -10
- package/libs/apple/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/apple/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/apple/libskottie.xcframework/macos-arm64_x86_64/libskottie.a +0 -0
- package/libs/apple/libskottie.xcframework/tvos-arm64_arm64e/libskottie.a +0 -0
- package/libs/apple/libskottie.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/apple/libskparagraph.xcframework/Info.plist +13 -13
- package/libs/apple/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/apple/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/apple/libskparagraph.xcframework/macos-arm64_x86_64/libskparagraph.a +0 -0
- package/libs/apple/libskparagraph.xcframework/tvos-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/apple/libskparagraph.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/apple/libsksg.xcframework/Info.plist +11 -11
- package/libs/apple/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/apple/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/apple/libsksg.xcframework/macos-arm64_x86_64/libsksg.a +0 -0
- package/libs/apple/libsksg.xcframework/tvos-arm64_arm64e/libsksg.a +0 -0
- package/libs/apple/libsksg.xcframework/tvos-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/apple/libskshaper.xcframework/Info.plist +12 -12
- package/libs/apple/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/apple/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/apple/libskshaper.xcframework/macos-arm64_x86_64/libskshaper.a +0 -0
- package/libs/apple/libskshaper.xcframework/tvos-arm64_arm64e/libskshaper.a +0 -0
- package/libs/apple/libskshaper.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/apple/libskunicode_core.xcframework/Info.plist +14 -14
- package/libs/apple/libskunicode_core.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
- package/libs/apple/libskunicode_core.xcframework/macos-arm64_x86_64/libskunicode_core.a +0 -0
- package/libs/apple/libskunicode_core.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/Info.plist +13 -13
- package/libs/apple/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/macos-arm64_x86_64/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/tvos-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libsvg.xcframework/Info.plist +17 -17
- package/libs/apple/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/apple/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/libs/apple/libsvg.xcframework/macos-arm64_x86_64/libsvg.a +0 -0
- package/libs/apple/libsvg.xcframework/tvos-arm64_arm64e/libsvg.a +0 -0
- package/libs/apple/libsvg.xcframework/tvos-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +1 -1
- package/react-native-skia.podspec +2 -1
- package/src/renderer/__tests__/e2e/BackdropFilters.spec.tsx +23 -0
- package/src/sksg/Container.ts +4 -0
- package/src/sksg/Reconciler.ts +1 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_reactReconciler","_interopRequireDefault","require","_types","_HostConfig","_Container","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","skiaReconciler","ReactReconciler","sksgHostConfig","injectIntoDevTools","bundleType","version","rendererPackageName","SkiaSGRoot","constructor","Skia","nativeId","container","createContainer","root","console","error","sg","children","type","NodeType","Group","props","isDeclaration","updateContainer","element","Promise","resolve","debug","render","redraw","drawOnCanvas","canvas","getPicture","recorder","PictureRecorder","beginRecording","finishRecordingAsPicture","unmount","exports"],"sources":["Reconciler.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport type { OpaqueRoot } from \"react-reconciler\";\nimport ReactReconciler from \"react-reconciler\";\n\nimport type { SkCanvas, Skia } from \"../skia/types\";\nimport { NodeType } from \"../dom/types\";\n\nimport { debug, sksgHostConfig } from \"./HostConfig\";\nimport type { Container } from \"./Container\";\nimport { createContainer } from \"./Container\";\nimport \"./Elements\";\n\nconst skiaReconciler = ReactReconciler(sksgHostConfig);\n\nskiaReconciler.injectIntoDevTools({\n bundleType: 1,\n version: \"0.0.1\",\n rendererPackageName: \"react-native-skia\",\n});\n\nexport class SkiaSGRoot {\n private root: OpaqueRoot;\n private container: Container;\n\n constructor(public Skia: Skia, nativeId = -1) {\n this.container = createContainer(Skia, nativeId);\n this.root = skiaReconciler.createContainer(\n this.container,\n 0,\n null,\n true,\n null,\n \"\",\n console.error,\n null\n );\n }\n\n get sg() {\n const children = this.container.root;\n return { type: NodeType.Group, props: {}, children, isDeclaration: false };\n }\n\n private updateContainer(element: ReactNode) {\n return new Promise((resolve) => {\n skiaReconciler.updateContainer(element, this.root, null, () => {\n debug(\"updateContainer\");\n resolve(true);\n });\n });\n }\n\n async render(element: ReactNode) {\n await this.updateContainer(element);\n this.container.redraw();\n }\n\n drawOnCanvas(canvas: SkCanvas) {\n this.container.drawOnCanvas(canvas);\n }\n\n getPicture() {\n const recorder = this.Skia.PictureRecorder();\n const canvas = recorder.beginRecording();\n this.drawOnCanvas(canvas);\n return recorder.finishRecordingAsPicture();\n }\n\n unmount() {\n this.container.unmount();\n return new Promise((resolve) => {\n skiaReconciler.updateContainer(null, this.root, null, () => {\n debug(\"unmountContainer\");\n resolve(true);\n });\n });\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AACAA,OAAA;AAAoB,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAL,CAAA,GAAAK,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAhB,CAAA,QAAAa,CAAA,GAAAb,CAAA,CAAAiB,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAA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ault","require","_types","_HostConfig","_Container","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","skiaReconciler","ReactReconciler","sksgHostConfig","injectIntoDevTools","bundleType","version","rendererPackageName","SkiaSGRoot","constructor","Skia","nativeId","container","createContainer","root","console","error","sg","children","type","NodeType","Group","props","isDeclaration","updateContainer","element","Promise","resolve","debug","render","mount","redraw","drawOnCanvas","canvas","getPicture","recorder","PictureRecorder","beginRecording","finishRecordingAsPicture","unmount","exports"],"sources":["Reconciler.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport type { OpaqueRoot } from \"react-reconciler\";\nimport ReactReconciler from \"react-reconciler\";\n\nimport type { SkCanvas, Skia } from \"../skia/types\";\nimport { NodeType } from \"../dom/types\";\n\nimport { debug, sksgHostConfig } from \"./HostConfig\";\nimport type { Container } from \"./Container\";\nimport { createContainer } from \"./Container\";\nimport \"./Elements\";\n\nconst skiaReconciler = ReactReconciler(sksgHostConfig);\n\nskiaReconciler.injectIntoDevTools({\n bundleType: 1,\n version: \"0.0.1\",\n rendererPackageName: \"react-native-skia\",\n});\n\nexport class SkiaSGRoot {\n private root: OpaqueRoot;\n private container: Container;\n\n constructor(public Skia: Skia, nativeId = -1) {\n this.container = createContainer(Skia, nativeId);\n this.root = skiaReconciler.createContainer(\n this.container,\n 0,\n null,\n true,\n null,\n \"\",\n console.error,\n null\n );\n }\n\n get sg() {\n const children = this.container.root;\n return { type: NodeType.Group, props: {}, children, isDeclaration: false };\n }\n\n private updateContainer(element: ReactNode) {\n return new Promise((resolve) => {\n skiaReconciler.updateContainer(element, this.root, null, () => {\n debug(\"updateContainer\");\n resolve(true);\n });\n });\n }\n\n async render(element: ReactNode) {\n this.container.mount();\n await this.updateContainer(element);\n this.container.redraw();\n }\n\n drawOnCanvas(canvas: SkCanvas) {\n this.container.drawOnCanvas(canvas);\n }\n\n getPicture() {\n const recorder = this.Skia.PictureRecorder();\n const canvas = recorder.beginRecording();\n this.drawOnCanvas(canvas);\n return recorder.finishRecordingAsPicture();\n }\n\n unmount() {\n this.container.unmount();\n return new Promise((resolve) => {\n skiaReconciler.updateContainer(null, this.root, null, () => {\n debug(\"unmountContainer\");\n resolve(true);\n });\n });\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AACAA,OAAA;AAAoB,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAL,CAAA,GAAAK,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAhB,CAAA,QAAAa,CAAA,GAAAb,CAAA,CAAAiB,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAEpB,MAAMgB,cAAc,GAAG,IAAAC,wBAAe,EAACC,0BA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CAAC;EACzB;EAEAC,YAAYA,CAACC,MAAgB,EAAE;IAC7B,IAAI,CAACrB,SAAS,CAACoB,YAAY,CAACC,MAAM,CAAC;EACrC;EAEAC,UAAUA,CAAA,EAAG;IACX,MAAMC,QAAQ,GAAG,IAAI,CAACzB,IAAI,CAAC0B,eAAe,CAAC,CAAC;IAC5C,MAAMH,MAAM,GAAGE,QAAQ,CAACE,cAAc,CAAC,CAAC;IACxC,IAAI,CAACL,YAAY,CAACC,MAAM,CAAC;IACzB,OAAOE,QAAQ,CAACG,wBAAwB,CAAC,CAAC;EAC5C;EAEAC,OAAOA,CAAA,EAAG;IACR,IAAI,CAAC3B,SAAS,CAAC2B,OAAO,CAAC,CAAC;IACxB,OAAO,IAAIb,OAAO,CAAEC,OAAO,IAAK;MAC9B1B,cAAc,CAACuB,eAAe,CAAC,IAAI,EAAE,IAAI,CAACV,IAAI,EAAE,IAAI,EAAE,MAAM;QAC1D,IAAAc,iBAAK,EAAC,kBAAkB,CAAC;QACzBD,OAAO,CAAC,IAAI,CAAC;MACf,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;AACF;AAACa,OAAA,CAAAhC,UAAA,GAAAA,UAAA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["Rea","HAS_REANIMATED_3","Recorder","visit","replay","createDrawingContext","ReanimatedRecorder","drawOnscreen","Skia","nativeId","recording","rec","PictureRecorder","canvas","beginRecording","ctx","paintPool","commands","picture","finishRecordingAsPicture","SkiaViewApi","setJsiProperty","nativeDrawOnscreen","recorder","play","Container","constructor","_defineProperty","root","_root","value","unmount","unmounted","drawOnCanvas","Error","StaticContainer","redraw","getRecording","isOnScreen","ReanimatedContainer","mapperId","stopMapper","record","animationValues","size","startMapper","Array","from","runOnUI","NativeReanimatedContainer","sharedValues","getSharedValues","sharedRecorder","getRecorder","length","applyUpdates","createContainer","web","global"],"sources":["Container.ts"],"sourcesContent":["import Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia, SkCanvas } from \"../skia/types\";\nimport { HAS_REANIMATED_3 } from \"../external/reanimated/renderHelpers\";\nimport type { JsiRecorder } from \"../skia/types/Recorder\";\n\nimport type { Node } from \"./Node\";\nimport type { Recording } from \"./Recorder/Recorder\";\nimport { Recorder } from \"./Recorder/Recorder\";\nimport { visit } from \"./Recorder/Visitor\";\nimport { replay } from \"./Recorder/Player\";\nimport { createDrawingContext } from \"./Recorder/DrawingContext\";\nimport { ReanimatedRecorder } from \"./Recorder/ReanimatedRecorder\";\n\nimport \"../views/api\";\n\nconst drawOnscreen = (Skia: Skia, nativeId: number, recording: Recording) => {\n \"worklet\";\n\n const rec = Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n //const start = performance.now();\n\n const ctx = createDrawingContext(Skia, recording.paintPool, canvas);\n replay(ctx, recording.commands);\n const picture = rec.finishRecordingAsPicture();\n //const end = performance.now();\n //console.log(\"Recording time: \", end - start);\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n};\n\nconst nativeDrawOnscreen = (nativeId: number, recorder: JsiRecorder) => {\n \"worklet\";\n\n //const start = performance.now();\n\n const picture = recorder.play();\n //const end = performance.now();\n //console.log(\"Recording time: \", end - start);\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n};\n\nexport abstract class Container {\n private _root: Node[] = [];\n protected recording: Recording | null = null;\n protected unmounted = false;\n\n constructor(protected Skia: Skia, protected nativeId: number) {}\n\n get root() {\n return this._root;\n }\n\n set root(value: Node[]) {\n this._root = value;\n }\n\n unmount() {\n this.unmounted = true;\n }\n\n drawOnCanvas(canvas: SkCanvas) {\n if (!this.recording) {\n throw new Error(\"No recording to draw\");\n }\n const ctx = createDrawingContext(\n this.Skia,\n this.recording.paintPool,\n canvas\n );\n replay(ctx, this.recording.commands);\n }\n\n abstract redraw(): void;\n}\n\nclass StaticContainer extends Container {\n constructor(Skia: Skia, nativeId: number) {\n super(Skia, nativeId);\n }\n\n redraw() {\n const recorder = new Recorder();\n visit(recorder, this.root);\n this.recording = recorder.getRecording();\n const isOnScreen = this.nativeId !== -1;\n if (isOnScreen) {\n const rec = this.Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n this.drawOnCanvas(canvas);\n const picture = rec.finishRecordingAsPicture();\n SkiaViewApi.setJsiProperty(this.nativeId, \"picture\", picture);\n }\n }\n}\n\nclass ReanimatedContainer extends Container {\n private mapperId: number | null = null;\n\n constructor(Skia: Skia, nativeId: number) {\n super(Skia, nativeId);\n }\n\n redraw() {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n }\n if (this.unmounted) {\n return;\n }\n const recorder = new Recorder();\n visit(recorder, this.root);\n const record = recorder.getRecording();\n const { animationValues } = record;\n this.recording = {\n commands: record.commands,\n paintPool: record.paintPool,\n };\n const { nativeId, Skia, recording } = this;\n if (animationValues.size > 0) {\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n drawOnscreen(Skia, nativeId, recording!);\n }, Array.from(animationValues));\n }\n Rea.runOnUI(() => {\n \"worklet\";\n drawOnscreen(Skia, nativeId, recording!);\n })();\n }\n}\n\nclass NativeReanimatedContainer extends Container {\n private mapperId: number | null = null;\n\n constructor(Skia: Skia, nativeId: number) {\n super(Skia, nativeId);\n }\n\n redraw() {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n }\n if (this.unmounted) {\n return;\n }\n const { nativeId, Skia } = this;\n const recorder = new ReanimatedRecorder(Skia);\n visit(recorder, this.root);\n const sharedValues = recorder.getSharedValues();\n const sharedRecorder = recorder.getRecorder();\n Rea.runOnUI(() => {\n \"worklet\";\n nativeDrawOnscreen(nativeId, sharedRecorder);\n })();\n if (sharedValues.length > 0) {\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n sharedRecorder.applyUpdates(sharedValues);\n nativeDrawOnscreen(nativeId, sharedRecorder);\n }, sharedValues);\n }\n }\n}\n\nexport const createContainer = (Skia: Skia, nativeId: number) => {\n const web = global.SkiaViewApi && global.SkiaViewApi.web;\n if (HAS_REANIMATED_3 && nativeId !== -1) {\n if (!web) {\n return new NativeReanimatedContainer(Skia, nativeId);\n } else {\n return new ReanimatedContainer(Skia, nativeId);\n }\n } else {\n return new StaticContainer(Skia, nativeId);\n }\n};\n"],"mappings":";;;AAAA,OAAOA,GAAG,MAAM,wCAAwC;AAExD,SAASC,gBAAgB,QAAQ,sCAAsC;AAKvE,SAASC,QAAQ,QAAQ,qBAAqB;AAC9C,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,kBAAkB,QAAQ,+BAA+B;AAElE,OAAO,cAAc;AAErB,MAAMC,YAAY,GAAGA,CAACC,IAAU,EAAEC,QAAgB,EAAEC,SAAoB,KAAK;EAC3E,SAAS;;EAET,MAAMC,GAAG,GAAGH,IAAI,CAACI,eAAe,CAAC,CAAC;EAClC,MAAMC,MAAM,GAAGF,GAAG,CAACG,cAAc,CAAC,CAAC;EACnC;;EAEA,MAAMC,GAAG,GAAGV,oBAAoB,CAACG,IAAI,EAAEE,SAAS,CAACM,SAAS,EAAEH,MAAM,CAAC;EACnET,MAAM,CAACW,GAAG,EAAEL,SAAS,CAACO,QAAQ,CAAC;EAC/B,MAAMC,OAAO,GAAGP,GAAG,CAACQ,wBAAwB,CAAC,CAAC;EAC9C;EACA;EACAC,WAAW,CAACC,cAAc,CAACZ,QAAQ,EAAE,SAAS,EAAES,OAAO,CAAC;AAC1D,CAAC;AAED,MAAMI,kBAAkB,GAAGA,CAACb,QAAgB,EAAEc,QAAqB,KAAK;EACtE,SAAS;;EAET;EAEA,MAAML,OAAO,GAAGK,QAAQ,CAACC,IAAI,CAAC,CAAC;EAC/B;EACA;EACAJ,WAAW,CAACC,cAAc,CAACZ,QAAQ,EAAE,SAAS,EAAES,OAAO,CAAC;AAC1D,CAAC;AAED,OAAO,MAAeO,SAAS,CAAC;EAK9BC,WAAWA,CAAWlB,IAAU,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YAAY,CAAC;IAClB;EACF;AACF;AAEA,OAAO,MAAMM,eAAe,GAAGA,CAAChD,IAAU,EAAEC,QAAgB,KAAK;EAC/D,MAAMgD,GAAG,GAAGC,MAAM,CAACtC,WAAW,IAAIsC,MAAM,CAACtC,WAAW,CAACqC,GAAG;EACxD,IAAIxD,gBAAgB,IAAIQ,QAAQ,KAAK,CAAC,CAAC,EAAE;IACvC,IAAI,CAACgD,GAAG,EAAE;MACR,OAAO,IAAIR,yBAAyB,CAACzC,IAAI,EAAEC,QAAQ,CAAC;IACtD,CAAC,MAAM;MACL,OAAO,IAAI8B,mBAAmB,CAAC/B,IAAI,EAAEC,QAAQ,CAAC;IAChD;EACF,CAAC,MAAM;IACL,OAAO,IAAI0B,eAAe,CAAC3B,IAAI,EAAEC,QAAQ,CAAC;EAC5C;AACF,CAAC","ignoreList":[]}
|
1
|
+
{"version":3,"names":["Rea","HAS_REANIMATED_3","Recorder","visit","replay","createDrawingContext","ReanimatedRecorder","drawOnscreen","Skia","nativeId","recording","rec","PictureRecorder","canvas","beginRecording","ctx","paintPool","commands","picture","finishRecordingAsPicture","SkiaViewApi","setJsiProperty","nativeDrawOnscreen","recorder","play","Container","constructor","_defineProperty","root","_root","value","mount","unmounted","unmount","drawOnCanvas","Error","StaticContainer","redraw","getRecording","isOnScreen","ReanimatedContainer","mapperId","stopMapper","record","animationValues","size","startMapper","Array","from","runOnUI","NativeReanimatedContainer","sharedValues","getSharedValues","sharedRecorder","getRecorder","length","applyUpdates","createContainer","web","global"],"sources":["Container.ts"],"sourcesContent":["import Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia, SkCanvas } from \"../skia/types\";\nimport { HAS_REANIMATED_3 } from \"../external/reanimated/renderHelpers\";\nimport type { JsiRecorder } from \"../skia/types/Recorder\";\n\nimport type { Node } from \"./Node\";\nimport type { Recording } from \"./Recorder/Recorder\";\nimport { Recorder } from \"./Recorder/Recorder\";\nimport { visit } from \"./Recorder/Visitor\";\nimport { replay } from \"./Recorder/Player\";\nimport { createDrawingContext } from \"./Recorder/DrawingContext\";\nimport { ReanimatedRecorder } from \"./Recorder/ReanimatedRecorder\";\n\nimport \"../views/api\";\n\nconst drawOnscreen = (Skia: Skia, nativeId: number, recording: Recording) => {\n \"worklet\";\n\n const rec = Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n //const start = performance.now();\n\n const ctx = createDrawingContext(Skia, recording.paintPool, canvas);\n replay(ctx, recording.commands);\n const picture = rec.finishRecordingAsPicture();\n //const end = performance.now();\n //console.log(\"Recording time: \", end - start);\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n};\n\nconst nativeDrawOnscreen = (nativeId: number, recorder: JsiRecorder) => {\n \"worklet\";\n\n //const start = performance.now();\n\n const picture = recorder.play();\n //const end = performance.now();\n //console.log(\"Recording time: \", end - start);\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n};\n\nexport abstract class Container {\n private _root: Node[] = [];\n protected recording: Recording | null = null;\n protected unmounted = false;\n\n constructor(protected Skia: Skia, protected nativeId: number) {}\n\n get root() {\n return this._root;\n }\n\n set root(value: Node[]) {\n this._root = value;\n }\n\n mount() {\n this.unmounted = false;\n }\n\n unmount() {\n this.unmounted = true;\n }\n\n drawOnCanvas(canvas: SkCanvas) {\n if (!this.recording) {\n throw new Error(\"No recording to draw\");\n }\n const ctx = createDrawingContext(\n this.Skia,\n this.recording.paintPool,\n canvas\n );\n replay(ctx, this.recording.commands);\n }\n\n abstract redraw(): void;\n}\n\nclass StaticContainer extends Container {\n constructor(Skia: Skia, nativeId: number) {\n super(Skia, nativeId);\n }\n\n redraw() {\n const recorder = new Recorder();\n visit(recorder, this.root);\n this.recording = recorder.getRecording();\n const isOnScreen = this.nativeId !== -1;\n if (isOnScreen) {\n const rec = this.Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n this.drawOnCanvas(canvas);\n const picture = rec.finishRecordingAsPicture();\n SkiaViewApi.setJsiProperty(this.nativeId, \"picture\", picture);\n }\n }\n}\n\nclass ReanimatedContainer extends Container {\n private mapperId: number | null = null;\n\n constructor(Skia: Skia, nativeId: number) {\n super(Skia, nativeId);\n }\n\n redraw() {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n }\n if (this.unmounted) {\n return;\n }\n const recorder = new Recorder();\n visit(recorder, this.root);\n const record = recorder.getRecording();\n const { animationValues } = record;\n this.recording = {\n commands: record.commands,\n paintPool: record.paintPool,\n };\n const { nativeId, Skia, recording } = this;\n if (animationValues.size > 0) {\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n drawOnscreen(Skia, nativeId, recording!);\n }, Array.from(animationValues));\n }\n Rea.runOnUI(() => {\n \"worklet\";\n drawOnscreen(Skia, nativeId, recording!);\n })();\n }\n}\n\nclass NativeReanimatedContainer extends Container {\n private mapperId: number | null = null;\n\n constructor(Skia: Skia, nativeId: number) {\n super(Skia, nativeId);\n }\n\n redraw() {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n }\n if (this.unmounted) {\n return;\n }\n const { nativeId, Skia } = this;\n const recorder = new ReanimatedRecorder(Skia);\n visit(recorder, this.root);\n const sharedValues = recorder.getSharedValues();\n const sharedRecorder = recorder.getRecorder();\n Rea.runOnUI(() => {\n \"worklet\";\n nativeDrawOnscreen(nativeId, sharedRecorder);\n })();\n if (sharedValues.length > 0) {\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n sharedRecorder.applyUpdates(sharedValues);\n nativeDrawOnscreen(nativeId, sharedRecorder);\n }, sharedValues);\n }\n }\n}\n\nexport const createContainer = (Skia: Skia, nativeId: number) => {\n const web = global.SkiaViewApi && global.SkiaViewApi.web;\n if (HAS_REANIMATED_3 && nativeId !== -1) {\n if (!web) {\n return new NativeReanimatedContainer(Skia, nativeId);\n } else {\n return new ReanimatedContainer(Skia, nativeId);\n }\n } else {\n return new StaticContainer(Skia, nativeId);\n }\n};\n"],"mappings":";;;AAAA,OAAOA,GAAG,MAAM,wCAAwC;AAExD,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vC,WAAW,IAAIuC,MAAM,CAACvC,WAAW,CAACsC,GAAG;EACxD,IAAIzD,gBAAgB,IAAIQ,QAAQ,KAAK,CAAC,CAAC,EAAE;IACvC,IAAI,CAACiD,GAAG,EAAE;MACR,OAAO,IAAIR,yBAAyB,CAAC1C,IAAI,EAAEC,QAAQ,CAAC;IACtD,CAAC,MAAM;MACL,OAAO,IAAI+B,mBAAmB,CAAChC,IAAI,EAAEC,QAAQ,CAAC;IAChD;EACF,CAAC,MAAM;IACL,OAAO,IAAI2B,eAAe,CAAC5B,IAAI,EAAEC,QAAQ,CAAC;EAC5C;AACF,CAAC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["ReactReconciler","NodeType","debug","sksgHostConfig","createContainer","skiaReconciler","injectIntoDevTools","bundleType","version","rendererPackageName","SkiaSGRoot","constructor","Skia","nativeId","_defineProperty","container","root","console","error","sg","children","type","Group","props","isDeclaration","updateContainer","element","Promise","resolve","render","redraw","drawOnCanvas","canvas","getPicture","recorder","PictureRecorder","beginRecording","finishRecordingAsPicture","unmount"],"sources":["Reconciler.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport type { OpaqueRoot } from \"react-reconciler\";\nimport ReactReconciler from \"react-reconciler\";\n\nimport type { SkCanvas, Skia } from \"../skia/types\";\nimport { NodeType } from \"../dom/types\";\n\nimport { debug, sksgHostConfig } from \"./HostConfig\";\nimport type { Container } from \"./Container\";\nimport { createContainer } from \"./Container\";\nimport \"./Elements\";\n\nconst skiaReconciler = ReactReconciler(sksgHostConfig);\n\nskiaReconciler.injectIntoDevTools({\n bundleType: 1,\n version: \"0.0.1\",\n rendererPackageName: \"react-native-skia\",\n});\n\nexport class SkiaSGRoot {\n private root: OpaqueRoot;\n private container: Container;\n\n constructor(public Skia: Skia, nativeId = -1) {\n this.container = createContainer(Skia, nativeId);\n this.root = skiaReconciler.createContainer(\n this.container,\n 0,\n null,\n true,\n null,\n \"\",\n console.error,\n null\n );\n }\n\n get sg() {\n const children = this.container.root;\n return { type: NodeType.Group, props: {}, children, isDeclaration: false };\n }\n\n private updateContainer(element: ReactNode) {\n return new Promise((resolve) => {\n skiaReconciler.updateContainer(element, this.root, null, () => {\n debug(\"updateContainer\");\n resolve(true);\n });\n });\n }\n\n async render(element: ReactNode) {\n await this.updateContainer(element);\n this.container.redraw();\n }\n\n drawOnCanvas(canvas: SkCanvas) {\n this.container.drawOnCanvas(canvas);\n }\n\n getPicture() {\n const recorder = this.Skia.PictureRecorder();\n const canvas = recorder.beginRecording();\n this.drawOnCanvas(canvas);\n return recorder.finishRecordingAsPicture();\n }\n\n unmount() {\n this.container.unmount();\n return new Promise((resolve) => {\n skiaReconciler.updateContainer(null, this.root, null, () => {\n debug(\"unmountContainer\");\n resolve(true);\n });\n });\n }\n}\n"],"mappings":";;;AAEA,OAAOA,eAAe,MAAM,kBAAkB;AAG9C,SAASC,QAAQ,QAAQ,cAAc;AAEvC,SAASC,KAAK,EAAEC,cAAc,QAAQ,cAAc;AAEpD,SAASC,eAAe,QAAQ,aAAa;AAC7C,OAAO,YAAY;AAEnB,MAAMC,cAAc,GAAGL,eAAe,CAACG,cAAc,CAAC;AAEtDE,cAAc,CAACC,kBAAkB,CAAC;EAChCC,UAAU,EAAE,CAAC;EACbC,OAAO,EAAE,OAAO;EAChBC,mBAAmB,EAAE;AACvB,CAAC,CAAC;AAEF,OAAO,MAAMC,UAAU,CAAC;EAItBC,WAAWA,CAAQC,IAAU,EAAEC,QAAQ,GAAG,CAAC,CAAC,EAAE;IAAA,KAA3BD,IAAU,GAAVA,IAAU;IAAAE,eAAA;IAAAA,eAAA;IAC3B,IAAI,CAACC,SAAS,GAAGX,eAAe,CAACQ,IAAI,EAAEC,QAAQ,CAAC;IAChD,IAAI,CAACG,IAAI,GAAGX,cAAc,CAACD,eAAe,CACxC,IAAI,CAACW,SAAS,EACd,CAAC,EACD,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,EAAE,EACFE,OAAO,CAACC,KAAK,EACb,IACF,CAAC;EACH;EAEA,IAAIC,EAAEA,CAAA,EAAG;IACP,MAAMC,QAAQ,GAAG,IAAI,CAACL,SAAS,CAACC,IAAI;IACpC,OAAO;MAAEK,IAAI,EAAEpB,QAAQ,CAACqB,KAAK;MAAEC,KAAK,EAAE,CAAC,CAAC;MAAEH,QAAQ;MAAEI,aAAa,EAAE;IAAM,CAAC;EAC5E;EAEQC,eAAeA,CAACC,OAAkB,EAAE;IAC1C,OAAO,IAAIC,OAAO,CAAEC,OAAO,IAAK;MAC9BvB,cAAc,CAACoB,eAAe,CAACC,OAAO,EAAE,IAAI,CAACV,IAAI,EAAE,IAAI,EAAE,MAAM;QAC7Dd,KAAK,CAAC,iBAAiB,CAAC;QACxB0B,OAAO,CAAC,IAAI,CAAC;MACf,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;EAEA,MAAMC,MAAMA,CAACH,OAAkB,EAAE;IAC/B,MAAM,IAAI,
|
1
|
+
{"version":3,"names":["ReactReconciler","NodeType","debug","sksgHostConfig","createContainer","skiaReconciler","injectIntoDevTools","bundleType","version","rendererPackageName","SkiaSGRoot","constructor","Skia","nativeId","_defineProperty","container","root","console","error","sg","children","type","Group","props","isDeclaration","updateContainer","element","Promise","resolve","render","mount","redraw","drawOnCanvas","canvas","getPicture","recorder","PictureRecorder","beginRecording","finishRecordingAsPicture","unmount"],"sources":["Reconciler.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport type { OpaqueRoot } from \"react-reconciler\";\nimport ReactReconciler from \"react-reconciler\";\n\nimport type { SkCanvas, Skia } from \"../skia/types\";\nimport { NodeType } from \"../dom/types\";\n\nimport { debug, sksgHostConfig } from \"./HostConfig\";\nimport type { Container } from \"./Container\";\nimport { createContainer } from \"./Container\";\nimport \"./Elements\";\n\nconst skiaReconciler = ReactReconciler(sksgHostConfig);\n\nskiaReconciler.injectIntoDevTools({\n bundleType: 1,\n version: \"0.0.1\",\n rendererPackageName: \"react-native-skia\",\n});\n\nexport class SkiaSGRoot {\n private root: OpaqueRoot;\n private container: Container;\n\n constructor(public Skia: Skia, nativeId = -1) {\n this.container = createContainer(Skia, nativeId);\n this.root = skiaReconciler.createContainer(\n this.container,\n 0,\n null,\n true,\n null,\n \"\",\n console.error,\n null\n );\n }\n\n get sg() {\n const children = this.container.root;\n return { type: NodeType.Group, props: {}, children, isDeclaration: false };\n }\n\n private updateContainer(element: ReactNode) {\n return new Promise((resolve) => {\n skiaReconciler.updateContainer(element, this.root, null, () => {\n debug(\"updateContainer\");\n resolve(true);\n });\n });\n }\n\n async render(element: ReactNode) {\n this.container.mount();\n await this.updateContainer(element);\n this.container.redraw();\n }\n\n drawOnCanvas(canvas: SkCanvas) {\n this.container.drawOnCanvas(canvas);\n }\n\n getPicture() {\n const recorder = this.Skia.PictureRecorder();\n const canvas = recorder.beginRecording();\n this.drawOnCanvas(canvas);\n return recorder.finishRecordingAsPicture();\n }\n\n unmount() {\n this.container.unmount();\n return new Promise((resolve) => {\n skiaReconciler.updateContainer(null, this.root, null, () => {\n debug(\"unmountContainer\");\n resolve(true);\n });\n });\n }\n}\n"],"mappings":";;;AAEA,OAAOA,eAAe,MAAM,kBAAkB;AAG9C,SAASC,QAAQ,QAAQ,cAAc;AAEvC,SAASC,KAAK,EAAEC,cAAc,QAAQ,cAAc;AAEpD,SAASC,eAAe,QAAQ,aAAa;AAC7C,OAAO,YAAY;AAEnB,MAAMC,cAAc,GAAGL,eAAe,CAACG,cAAc,CAAC;AAEtDE,cAAc,CAACC,kBAAkB,CAAC;EAChCC,UAAU,EAAE,CAAC;EACbC,OAAO,EAAE,OAAO;EAChBC,mBAAmB,EAAE;AACvB,CAAC,CAAC;AAEF,OAAO,MAAMC,UAAU,CAAC;EAItBC,WAAWA,CAAQC,IAAU,EAAEC,QAAQ,GAAG,CAAC,CAAC,EAAE;IAAA,KAA3BD,IAAU,GAAVA,IAAU;IAAAE,eAAA;IAAAA,eAAA;IAC3B,IAAI,CAACC,SAAS,GAAGX,eAAe,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wB,CAAC,CAAC;EAC5C;EAEAC,OAAOA,CAAA,EAAG;IACR,IAAI,CAACxB,SAAS,CAACwB,OAAO,CAAC,CAAC;IACxB,OAAO,IAAIZ,OAAO,CAAEC,OAAO,IAAK;MAC9BvB,cAAc,CAACoB,eAAe,CAAC,IAAI,EAAE,IAAI,CAACT,IAAI,EAAE,IAAI,EAAE,MAAM;QAC1Dd,KAAK,CAAC,kBAAkB,CAAC;QACzB0B,OAAO,CAAC,IAAI,CAAC;MACf,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
|
@@ -6,8 +6,9 @@ export class Container {
|
|
6
6
|
set root(value: any);
|
7
7
|
get root(): any;
|
8
8
|
_root: any;
|
9
|
-
|
9
|
+
mount(): void;
|
10
10
|
unmounted: boolean | undefined;
|
11
|
+
unmount(): void;
|
11
12
|
drawOnCanvas(canvas: any): void;
|
12
13
|
}
|
13
14
|
export function createContainer(Skia: any, nativeId: any): NativeReanimatedContainer | ReanimatedContainer | StaticContainer;
|
@@ -9,8 +9,9 @@ export class SkiaSGRoot {
|
|
9
9
|
nativeId: any;
|
10
10
|
root: any;
|
11
11
|
_root: any;
|
12
|
-
|
12
|
+
mount(): void;
|
13
13
|
unmounted: boolean | undefined;
|
14
|
+
unmount(): void;
|
14
15
|
drawOnCanvas(canvas: any): void;
|
15
16
|
} | {
|
16
17
|
redraw(): void;
|
@@ -23,8 +24,9 @@ export class SkiaSGRoot {
|
|
23
24
|
nativeId: any;
|
24
25
|
root: any;
|
25
26
|
_root: any;
|
26
|
-
|
27
|
+
mount(): void;
|
27
28
|
unmounted: boolean | undefined;
|
29
|
+
unmount(): void;
|
28
30
|
drawOnCanvas(canvas: any): void;
|
29
31
|
} | {
|
30
32
|
redraw(): void;
|
@@ -37,8 +39,9 @@ export class SkiaSGRoot {
|
|
37
39
|
nativeId: any;
|
38
40
|
root: any;
|
39
41
|
_root: any;
|
40
|
-
|
42
|
+
mount(): void;
|
41
43
|
unmounted: boolean | undefined;
|
44
|
+
unmount(): void;
|
42
45
|
drawOnCanvas(canvas: any): void;
|
43
46
|
};
|
44
47
|
root: any;
|
@@ -5,8 +5,9 @@ export class Container {
|
|
5
5
|
set root(value: any);
|
6
6
|
get root(): any;
|
7
7
|
_root: any;
|
8
|
-
|
8
|
+
mount(): void;
|
9
9
|
unmounted: boolean | undefined;
|
10
|
+
unmount(): void;
|
10
11
|
drawOnCanvas(canvas: any): void;
|
11
12
|
}
|
12
13
|
export function createContainer(Skia: any, nativeId: any): StaticContainer | ReanimatedContainer | NativeReanimatedContainer;
|
@@ -12,8 +12,9 @@ export class SkiaSGRoot {
|
|
12
12
|
nativeId: any;
|
13
13
|
root: any;
|
14
14
|
_root: any;
|
15
|
-
|
15
|
+
mount(): void;
|
16
16
|
unmounted: boolean | undefined;
|
17
|
+
unmount(): void;
|
17
18
|
drawOnCanvas(canvas: any): void;
|
18
19
|
} | {
|
19
20
|
redraw(): void;
|
@@ -26,8 +27,9 @@ export class SkiaSGRoot {
|
|
26
27
|
nativeId: any;
|
27
28
|
root: any;
|
28
29
|
_root: any;
|
29
|
-
|
30
|
+
mount(): void;
|
30
31
|
unmounted: boolean | undefined;
|
32
|
+
unmount(): void;
|
31
33
|
drawOnCanvas(canvas: any): void;
|
32
34
|
} | {
|
33
35
|
redraw(): void;
|
@@ -36,8 +38,9 @@ export class SkiaSGRoot {
|
|
36
38
|
nativeId: any;
|
37
39
|
root: any;
|
38
40
|
_root: any;
|
39
|
-
|
41
|
+
mount(): void;
|
40
42
|
unmounted: boolean | undefined;
|
43
|
+
unmount(): void;
|
41
44
|
drawOnCanvas(canvas: any): void;
|
42
45
|
};
|
43
46
|
root: any;
|
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
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,94 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>AvailableLibraries</key>
|
6
|
+
<array>
|
7
|
+
<dict>
|
8
|
+
<key>BinaryPath</key>
|
9
|
+
<string>libpathops.a</string>
|
10
|
+
<key>LibraryIdentifier</key>
|
11
|
+
<string>ios-arm64_arm64e</string>
|
12
|
+
<key>LibraryPath</key>
|
13
|
+
<string>libpathops.a</string>
|
14
|
+
<key>SupportedArchitectures</key>
|
15
|
+
<array>
|
16
|
+
<string>arm64</string>
|
17
|
+
<string>arm64e</string>
|
18
|
+
</array>
|
19
|
+
<key>SupportedPlatform</key>
|
20
|
+
<string>ios</string>
|
21
|
+
</dict>
|
22
|
+
<dict>
|
23
|
+
<key>BinaryPath</key>
|
24
|
+
<string>libpathops.a</string>
|
25
|
+
<key>LibraryIdentifier</key>
|
26
|
+
<string>ios-arm64_arm64e_x86_64-simulator</string>
|
27
|
+
<key>LibraryPath</key>
|
28
|
+
<string>libpathops.a</string>
|
29
|
+
<key>SupportedArchitectures</key>
|
30
|
+
<array>
|
31
|
+
<string>arm64</string>
|
32
|
+
<string>arm64e</string>
|
33
|
+
<string>x86_64</string>
|
34
|
+
</array>
|
35
|
+
<key>SupportedPlatform</key>
|
36
|
+
<string>ios</string>
|
37
|
+
<key>SupportedPlatformVariant</key>
|
38
|
+
<string>simulator</string>
|
39
|
+
</dict>
|
40
|
+
<dict>
|
41
|
+
<key>BinaryPath</key>
|
42
|
+
<string>libpathops.a</string>
|
43
|
+
<key>LibraryIdentifier</key>
|
44
|
+
<string>macos-arm64_x86_64</string>
|
45
|
+
<key>LibraryPath</key>
|
46
|
+
<string>libpathops.a</string>
|
47
|
+
<key>SupportedArchitectures</key>
|
48
|
+
<array>
|
49
|
+
<string>arm64</string>
|
50
|
+
<string>x86_64</string>
|
51
|
+
</array>
|
52
|
+
<key>SupportedPlatform</key>
|
53
|
+
<string>macos</string>
|
54
|
+
</dict>
|
55
|
+
<dict>
|
56
|
+
<key>BinaryPath</key>
|
57
|
+
<string>libpathops.a</string>
|
58
|
+
<key>LibraryIdentifier</key>
|
59
|
+
<string>tvos-arm64_arm64e</string>
|
60
|
+
<key>LibraryPath</key>
|
61
|
+
<string>libpathops.a</string>
|
62
|
+
<key>SupportedArchitectures</key>
|
63
|
+
<array>
|
64
|
+
<string>arm64</string>
|
65
|
+
<string>arm64e</string>
|
66
|
+
</array>
|
67
|
+
<key>SupportedPlatform</key>
|
68
|
+
<string>tvos</string>
|
69
|
+
</dict>
|
70
|
+
<dict>
|
71
|
+
<key>BinaryPath</key>
|
72
|
+
<string>libpathops.a</string>
|
73
|
+
<key>LibraryIdentifier</key>
|
74
|
+
<string>tvos-arm64_arm64e_x86_64-simulator</string>
|
75
|
+
<key>LibraryPath</key>
|
76
|
+
<string>libpathops.a</string>
|
77
|
+
<key>SupportedArchitectures</key>
|
78
|
+
<array>
|
79
|
+
<string>arm64</string>
|
80
|
+
<string>arm64e</string>
|
81
|
+
<string>x86_64</string>
|
82
|
+
</array>
|
83
|
+
<key>SupportedPlatform</key>
|
84
|
+
<string>tvos</string>
|
85
|
+
<key>SupportedPlatformVariant</key>
|
86
|
+
<string>simulator</string>
|
87
|
+
</dict>
|
88
|
+
</array>
|
89
|
+
<key>CFBundlePackageType</key>
|
90
|
+
<string>XFWK</string>
|
91
|
+
<key>XCFrameworkFormatVersion</key>
|
92
|
+
<string>1.0</string>
|
93
|
+
</dict>
|
94
|
+
</plist>
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -26,16 +26,19 @@
|
|
26
26
|
<key>BinaryPath</key>
|
27
27
|
<string>libskia.a</string>
|
28
28
|
<key>LibraryIdentifier</key>
|
29
|
-
<string>
|
29
|
+
<string>ios-arm64_arm64e_x86_64-simulator</string>
|
30
30
|
<key>LibraryPath</key>
|
31
31
|
<string>libskia.a</string>
|
32
32
|
<key>SupportedArchitectures</key>
|
33
33
|
<array>
|
34
34
|
<string>arm64</string>
|
35
35
|
<string>arm64e</string>
|
36
|
+
<string>x86_64</string>
|
36
37
|
</array>
|
37
38
|
<key>SupportedPlatform</key>
|
38
|
-
<string>
|
39
|
+
<string>ios</string>
|
40
|
+
<key>SupportedPlatformVariant</key>
|
41
|
+
<string>simulator</string>
|
39
42
|
</dict>
|
40
43
|
<dict>
|
41
44
|
<key>BinaryPath</key>
|
@@ -56,19 +59,16 @@
|
|
56
59
|
<key>BinaryPath</key>
|
57
60
|
<string>libskia.a</string>
|
58
61
|
<key>LibraryIdentifier</key>
|
59
|
-
<string>
|
62
|
+
<string>tvos-arm64_arm64e</string>
|
60
63
|
<key>LibraryPath</key>
|
61
64
|
<string>libskia.a</string>
|
62
65
|
<key>SupportedArchitectures</key>
|
63
66
|
<array>
|
64
67
|
<string>arm64</string>
|
65
68
|
<string>arm64e</string>
|
66
|
-
<string>x86_64</string>
|
67
69
|
</array>
|
68
70
|
<key>SupportedPlatform</key>
|
69
|
-
<string>
|
70
|
-
<key>SupportedPlatformVariant</key>
|
71
|
-
<string>simulator</string>
|
71
|
+
<string>tvos</string>
|
72
72
|
</dict>
|
73
73
|
<dict>
|
74
74
|
<key>BinaryPath</key>
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -23,22 +23,22 @@
|
|
23
23
|
<key>BinaryPath</key>
|
24
24
|
<string>libskottie.a</string>
|
25
25
|
<key>LibraryIdentifier</key>
|
26
|
-
<string>
|
26
|
+
<string>macos-arm64_x86_64</string>
|
27
27
|
<key>LibraryPath</key>
|
28
28
|
<string>libskottie.a</string>
|
29
29
|
<key>SupportedArchitectures</key>
|
30
30
|
<array>
|
31
31
|
<string>arm64</string>
|
32
|
-
<string>
|
32
|
+
<string>x86_64</string>
|
33
33
|
</array>
|
34
34
|
<key>SupportedPlatform</key>
|
35
|
-
<string>
|
35
|
+
<string>macos</string>
|
36
36
|
</dict>
|
37
37
|
<dict>
|
38
38
|
<key>BinaryPath</key>
|
39
39
|
<string>libskottie.a</string>
|
40
40
|
<key>LibraryIdentifier</key>
|
41
|
-
<string>
|
41
|
+
<string>ios-arm64_arm64e_x86_64-simulator</string>
|
42
42
|
<key>LibraryPath</key>
|
43
43
|
<string>libskottie.a</string>
|
44
44
|
<key>SupportedArchitectures</key>
|
@@ -48,7 +48,7 @@
|
|
48
48
|
<string>x86_64</string>
|
49
49
|
</array>
|
50
50
|
<key>SupportedPlatform</key>
|
51
|
-
<string>
|
51
|
+
<string>ios</string>
|
52
52
|
<key>SupportedPlatformVariant</key>
|
53
53
|
<string>simulator</string>
|
54
54
|
</dict>
|
@@ -56,22 +56,22 @@
|
|
56
56
|
<key>BinaryPath</key>
|
57
57
|
<string>libskottie.a</string>
|
58
58
|
<key>LibraryIdentifier</key>
|
59
|
-
<string>
|
59
|
+
<string>ios-arm64_arm64e</string>
|
60
60
|
<key>LibraryPath</key>
|
61
61
|
<string>libskottie.a</string>
|
62
62
|
<key>SupportedArchitectures</key>
|
63
63
|
<array>
|
64
64
|
<string>arm64</string>
|
65
|
-
<string>
|
65
|
+
<string>arm64e</string>
|
66
66
|
</array>
|
67
67
|
<key>SupportedPlatform</key>
|
68
|
-
<string>
|
68
|
+
<string>ios</string>
|
69
69
|
</dict>
|
70
70
|
<dict>
|
71
71
|
<key>BinaryPath</key>
|
72
72
|
<string>libskottie.a</string>
|
73
73
|
<key>LibraryIdentifier</key>
|
74
|
-
<string>
|
74
|
+
<string>tvos-arm64_arm64e_x86_64-simulator</string>
|
75
75
|
<key>LibraryPath</key>
|
76
76
|
<string>libskottie.a</string>
|
77
77
|
<key>SupportedArchitectures</key>
|
@@ -81,7 +81,7 @@
|
|
81
81
|
<string>x86_64</string>
|
82
82
|
</array>
|
83
83
|
<key>SupportedPlatform</key>
|
84
|
-
<string>
|
84
|
+
<string>tvos</string>
|
85
85
|
<key>SupportedPlatformVariant</key>
|
86
86
|
<string>simulator</string>
|
87
87
|
</dict>
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|