@shopify/react-native-skia 1.11.9-next.1 → 1.11.10
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 +153 -30
- package/android/build.gradle +1 -1
- package/cpp/skia/include/codec/SkCodec.h +2 -7
- package/cpp/skia/include/config/SkUserConfig.h +0 -11
- package/cpp/skia/include/core/SkCanvas.h +7 -11
- package/cpp/skia/include/core/SkColor.h +0 -10
- package/cpp/skia/include/core/SkColorSpace.h +2 -184
- package/cpp/skia/include/core/SkColorType.h +32 -114
- package/cpp/skia/include/core/SkFontScanner.h +8 -5
- package/cpp/skia/include/core/SkFontStyle.h +1 -1
- package/cpp/skia/include/core/SkMaskFilter.h +8 -0
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPath.h +1 -1
- package/cpp/skia/include/core/SkRRect.h +1 -3
- package/cpp/skia/include/core/SkShader.h +3 -3
- package/cpp/skia/include/core/SkString.h +8 -8
- package/cpp/skia/include/core/SkSurface.h +0 -14
- package/cpp/skia/include/core/SkTypeface.h +7 -24
- package/cpp/skia/include/effects/SkGradientShader.h +1 -6
- package/cpp/skia/include/effects/SkRuntimeEffect.h +0 -1
- package/cpp/skia/include/encode/SkPngEncoder.h +0 -14
- package/cpp/skia/include/gpu/GpuTypes.h +0 -9
- package/cpp/skia/include/gpu/ganesh/GrContextOptions.h +133 -135
- package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +0 -5
- package/cpp/skia/include/gpu/ganesh/GrDriverBugWorkarounds.h +3 -3
- package/cpp/skia/include/gpu/ganesh/GrTypes.h +9 -14
- package/cpp/skia/include/gpu/graphite/Context.h +2 -25
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +5 -23
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +1 -20
- package/cpp/skia/include/gpu/graphite/Image.h +0 -1
- package/cpp/skia/include/gpu/graphite/Recorder.h +0 -6
- package/cpp/skia/include/gpu/graphite/Recording.h +1 -3
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +36 -4
- package/cpp/skia/include/gpu/graphite/precompile/Precompile.h +2 -3
- package/cpp/skia/include/pathops/SkPathOps.h +1 -9
- package/cpp/skia/include/ports/SkFontMgr_FontConfigInterface.h +0 -3
- package/cpp/skia/include/private/SkPathRef.h +21 -15
- package/cpp/skia/include/private/base/SkAttributes.h +10 -16
- package/cpp/skia/include/private/base/SkMutex.h +0 -8
- package/cpp/skia/include/private/base/SkTArray.h +1 -1
- package/cpp/skia/include/private/base/SkTDArray.h +1 -1
- package/cpp/skia/include/private/base/SkTemplates.h +11 -24
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +1 -1
- package/cpp/skia/include/sksl/SkSLDebugTrace.h +3 -0
- package/cpp/skia/modules/skcms/src/Transform_inl.h +20 -20
- package/cpp/skia/modules/skcms/src/skcms_Transform.h +3 -4
- package/cpp/skia/modules/skcms/src/skcms_public.h +15 -19
- package/cpp/skia/modules/skresources/include/SkResources.h +1 -3
- package/cpp/skia/modules/svg/include/SkSVGCircle.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGContainer.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeLightSource.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGImage.h +2 -2
- package/cpp/skia/modules/svg/include/SkSVGPath.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGPoly.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGRect.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +0 -2
- package/cpp/skia/modules/svg/include/SkSVGShape.h +0 -1
- package/cpp/skia/modules/svg/include/SkSVGText.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGTransformableNode.h +0 -4
- package/cpp/skia/modules/svg/include/SkSVGUse.h +1 -1
- package/cpp/skia/src/core/SkLRUCache.h +13 -19
- package/cpp/skia/src/core/SkTHash.h +4 -50
- package/cpp/skia/src/gpu/ganesh/gl/GrGLDefines.h +0 -1
- package/lib/commonjs/external/reanimated/textures.js +3 -4
- package/lib/commonjs/external/reanimated/textures.js.map +1 -1
- package/lib/commonjs/headless/index.d.ts +1 -1
- package/lib/commonjs/headless/index.js +2 -2
- package/lib/commonjs/headless/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.d.ts +2 -2
- package/lib/commonjs/renderer/Canvas.js +28 -11
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/Offscreen.d.ts +2 -2
- package/lib/commonjs/renderer/Offscreen.js +4 -4
- package/lib/commonjs/renderer/Offscreen.js.map +1 -1
- package/lib/commonjs/renderer/__tests__/setup.d.ts +5 -5
- package/lib/commonjs/sksg/Container.d.ts +1 -3
- package/lib/commonjs/sksg/Container.js +1 -7
- package/lib/commonjs/sksg/Container.js.map +1 -1
- package/lib/commonjs/sksg/HostConfig.d.ts +1 -1
- package/lib/commonjs/sksg/HostConfig.js +6 -36
- package/lib/commonjs/sksg/HostConfig.js.map +1 -1
- package/lib/commonjs/sksg/HostConfig2.d.ts +19 -0
- package/lib/commonjs/sksg/HostConfig2.js +159 -0
- package/lib/commonjs/sksg/HostConfig2.js.map +1 -0
- package/lib/commonjs/sksg/Reconciler.d.ts +2 -3
- package/lib/commonjs/sksg/Reconciler.js +6 -16
- package/lib/commonjs/sksg/Reconciler.js.map +1 -1
- package/lib/module/Platform/Platform.web.js +1 -1
- package/lib/module/Platform/Platform.web.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Circle.js +2 -1
- package/lib/module/dom/nodes/datatypes/Circle.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Gradient.js +3 -3
- package/lib/module/dom/nodes/datatypes/Gradient.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Rect.js +5 -3
- package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
- package/lib/module/external/reanimated/buffers.js +2 -1
- package/lib/module/external/reanimated/buffers.js.map +1 -1
- package/lib/module/external/reanimated/textures.js +4 -5
- package/lib/module/external/reanimated/textures.js.map +1 -1
- package/lib/module/external/reanimated/useAnimatedImageValue.js +1 -1
- package/lib/module/external/reanimated/useAnimatedImageValue.js.map +1 -1
- package/lib/module/external/reanimated/useVideo.js +23 -10
- package/lib/module/external/reanimated/useVideo.js.map +1 -1
- package/lib/module/headless/index.d.ts +1 -1
- package/lib/module/headless/index.js +2 -2
- package/lib/module/headless/index.js.map +1 -1
- package/lib/module/renderer/Canvas.d.ts +2 -2
- package/lib/module/renderer/Canvas.js +28 -10
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/Offscreen.d.ts +2 -2
- package/lib/module/renderer/Offscreen.js +4 -4
- package/lib/module/renderer/Offscreen.js.map +1 -1
- package/lib/module/renderer/__tests__/setup.d.ts +5 -5
- package/lib/module/skia/core/Vector.js +1 -1
- package/lib/module/skia/core/Vector.js.map +1 -1
- package/lib/module/skia/web/CanvasKitWebGLBufferImpl.js +4 -1
- package/lib/module/skia/web/CanvasKitWebGLBufferImpl.js.map +1 -1
- package/lib/module/skia/web/Host.js +7 -1
- package/lib/module/skia/web/Host.js.map +1 -1
- package/lib/module/skia/web/JsiSkAnimatedImage.js +6 -3
- package/lib/module/skia/web/JsiSkAnimatedImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.js +6 -3
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkColorFilter.js +6 -3
- package/lib/module/skia/web/JsiSkColorFilter.js.map +1 -1
- package/lib/module/skia/web/JsiSkContourMeasure.js +6 -3
- package/lib/module/skia/web/JsiSkContourMeasure.js.map +1 -1
- package/lib/module/skia/web/JsiSkContourMeasureIter.js +6 -3
- package/lib/module/skia/web/JsiSkContourMeasureIter.js.map +1 -1
- package/lib/module/skia/web/JsiSkData.js +6 -3
- package/lib/module/skia/web/JsiSkData.js.map +1 -1
- package/lib/module/skia/web/JsiSkFont.js +6 -3
- package/lib/module/skia/web/JsiSkFont.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.js +12 -8
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFilter.js +6 -3
- package/lib/module/skia/web/JsiSkImageFilter.js.map +1 -1
- package/lib/module/skia/web/JsiSkMaskFilter.js +6 -3
- package/lib/module/skia/web/JsiSkMaskFilter.js.map +1 -1
- package/lib/module/skia/web/JsiSkMatrix.js +8 -5
- package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/module/skia/web/JsiSkPaint.js +6 -3
- package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/module/skia/web/JsiSkParagraphBuilder.js +3 -2
- package/lib/module/skia/web/JsiSkParagraphBuilder.js.map +1 -1
- package/lib/module/skia/web/JsiSkParagraphBuilderFactory.js +1 -1
- package/lib/module/skia/web/JsiSkParagraphBuilderFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkParagraphStyle.js +15 -15
- package/lib/module/skia/web/JsiSkParagraphStyle.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.js +6 -3
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathEffect.js +6 -3
- package/lib/module/skia/web/JsiSkPathEffect.js.map +1 -1
- package/lib/module/skia/web/JsiSkPicture.js +6 -3
- package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/module/skia/web/JsiSkPictureRecorder.js +6 -3
- package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -1
- package/lib/module/skia/web/JsiSkPoint.js +6 -3
- package/lib/module/skia/web/JsiSkPoint.js.map +1 -1
- package/lib/module/skia/web/JsiSkRRect.js +6 -3
- package/lib/module/skia/web/JsiSkRRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkRSXform.js +6 -3
- package/lib/module/skia/web/JsiSkRSXform.js.map +1 -1
- package/lib/module/skia/web/JsiSkRect.js +6 -3
- package/lib/module/skia/web/JsiSkRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkRuntimeEffect.js +6 -3
- package/lib/module/skia/web/JsiSkRuntimeEffect.js.map +1 -1
- package/lib/module/skia/web/JsiSkSVG.js +8 -5
- package/lib/module/skia/web/JsiSkSVG.js.map +1 -1
- package/lib/module/skia/web/JsiSkShader.js +6 -3
- package/lib/module/skia/web/JsiSkShader.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurface.js +6 -3
- package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/module/skia/web/JsiSkTextBlob.js +6 -3
- package/lib/module/skia/web/JsiSkTextBlob.js.map +1 -1
- package/lib/module/skia/web/JsiSkTypeface.js +6 -3
- package/lib/module/skia/web/JsiSkTypeface.js.map +1 -1
- package/lib/module/skia/web/JsiSkTypefaceFontProvider.js +4 -1
- package/lib/module/skia/web/JsiSkTypefaceFontProvider.js.map +1 -1
- package/lib/module/skia/web/JsiSkVertices.js +6 -3
- package/lib/module/skia/web/JsiSkVertices.js.map +1 -1
- package/lib/module/skia/web/JsiVideo.js +5 -2
- package/lib/module/skia/web/JsiVideo.js.map +1 -1
- package/lib/module/sksg/Container.d.ts +1 -3
- package/lib/module/sksg/Container.js +8 -11
- package/lib/module/sksg/Container.js.map +1 -1
- package/lib/module/sksg/HostConfig.d.ts +1 -1
- package/lib/module/sksg/HostConfig.js +7 -36
- package/lib/module/sksg/HostConfig.js.map +1 -1
- package/lib/module/sksg/HostConfig2.d.ts +19 -0
- package/lib/module/sksg/HostConfig2.js +152 -0
- package/lib/module/sksg/HostConfig2.js.map +1 -0
- package/lib/module/sksg/Reconciler.d.ts +2 -3
- package/lib/module/sksg/Reconciler.js +11 -16
- package/lib/module/sksg/Reconciler.js.map +1 -1
- package/lib/module/sksg/Recorder/ReanimatedRecorder.js +5 -1
- package/lib/module/sksg/Recorder/ReanimatedRecorder.js.map +1 -1
- package/lib/module/sksg/Recorder/Recorder.js +6 -3
- package/lib/module/sksg/Recorder/Recorder.js.map +1 -1
- package/lib/module/sksg/Recorder/Visitor.js +1 -1
- package/lib/module/sksg/Recorder/Visitor.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/Drawing.js +4 -2
- package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/Shaders.js +3 -2
- package/lib/module/sksg/Recorder/commands/Shaders.js.map +1 -1
- package/lib/module/views/SkiaBaseWebView.js +12 -9
- package/lib/module/views/SkiaBaseWebView.js.map +1 -1
- package/lib/module/views/SkiaPictureView.js +5 -1
- package/lib/module/views/SkiaPictureView.js.map +1 -1
- package/lib/module/views/SkiaPictureView.web.js +4 -1
- package/lib/module/views/SkiaPictureView.web.js.map +1 -1
- package/lib/module/web/LoadSkiaWeb.js +2 -1
- package/lib/module/web/LoadSkiaWeb.js.map +1 -1
- package/lib/module/web/WithSkiaWeb.js +1 -1
- package/lib/module/web/WithSkiaWeb.js.map +1 -1
- package/lib/typescript/lib/commonjs/headless/index.d.ts +1 -1
- package/lib/typescript/lib/commonjs/renderer/Canvas.d.ts +1 -9
- package/lib/typescript/lib/commonjs/renderer/Offscreen.d.ts +2 -2
- package/lib/typescript/lib/commonjs/sksg/Container.d.ts +0 -3
- package/lib/typescript/lib/commonjs/sksg/HostConfig.d.ts +4 -21
- package/lib/typescript/lib/commonjs/sksg/HostConfig2.d.ts +44 -0
- package/lib/typescript/lib/commonjs/sksg/Reconciler.d.ts +2 -9
- package/lib/typescript/lib/module/headless/index.d.ts +1 -1
- package/lib/typescript/lib/module/renderer/Canvas.d.ts +1 -9
- package/lib/typescript/lib/module/renderer/Offscreen.d.ts +2 -2
- package/lib/typescript/lib/module/skia/web/CanvasKitWebGLBufferImpl.d.ts +2 -2
- package/lib/typescript/lib/module/skia/web/JsiSkAnimatedImage.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkCanvas.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkColorFilter.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkContourMeasure.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkContourMeasureIter.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkData.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkFont.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkImage.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkImageFilter.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkMaskFilter.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkMatrix.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPaint.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPath.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPathEffect.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPicture.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPictureRecorder.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPoint.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkRRect.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkRSXform.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkRect.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkRuntimeEffect.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkSVG.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkShader.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkSurface.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkTextBlob.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkTypeface.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkTypefaceFontProvider.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkVertices.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiVideo.d.ts +2 -2
- package/lib/typescript/lib/module/sksg/Container.d.ts +12 -7
- package/lib/typescript/lib/module/sksg/HostConfig.d.ts +4 -20
- package/lib/typescript/lib/module/sksg/HostConfig2.d.ts +43 -0
- package/lib/typescript/lib/module/sksg/Reconciler.d.ts +17 -18
- package/lib/typescript/lib/module/sksg/Recorder/ReanimatedRecorder.d.ts +0 -1
- package/lib/typescript/lib/module/sksg/Recorder/Recorder.d.ts +2 -5
- package/lib/typescript/lib/module/views/SkiaBaseWebView.d.ts +11 -12
- package/lib/typescript/lib/module/views/SkiaPictureView.d.ts +2 -2
- package/lib/typescript/lib/module/views/SkiaPictureView.web.d.ts +1 -1
- package/lib/typescript/src/headless/index.d.ts +1 -1
- package/lib/typescript/src/renderer/Canvas.d.ts +2 -2
- package/lib/typescript/src/renderer/Offscreen.d.ts +2 -2
- package/lib/typescript/src/renderer/__tests__/setup.d.ts +5 -5
- package/lib/typescript/src/sksg/Container.d.ts +1 -3
- package/lib/typescript/src/sksg/HostConfig.d.ts +1 -1
- package/lib/typescript/src/sksg/HostConfig2.d.ts +19 -0
- package/lib/typescript/src/sksg/Reconciler.d.ts +2 -3
- package/package.json +9 -10
- package/src/external/reanimated/textures.tsx +4 -5
- package/src/headless/index.ts +2 -2
- package/src/renderer/Canvas.tsx +81 -57
- package/src/renderer/Offscreen.tsx +4 -4
- package/src/renderer/__tests__/Data.spec.tsx +10 -9
- package/src/renderer/__tests__/Drawings.spec.tsx +11 -11
- package/src/renderer/__tests__/FitBox.spec.tsx +10 -10
- package/src/renderer/__tests__/Glyphs.spec.tsx +2 -2
- package/src/renderer/__tests__/Image.spec.tsx +2 -2
- package/src/renderer/__tests__/Paths.spec.tsx +8 -8
- package/src/renderer/__tests__/Picture.spec.tsx +12 -10
- package/src/renderer/__tests__/Simple.spec.tsx +6 -6
- package/src/renderer/__tests__/Surfaces.spec.tsx +2 -2
- package/src/renderer/__tests__/Text.spec.tsx +12 -12
- package/src/renderer/__tests__/Transform.spec.tsx +8 -8
- package/src/renderer/__tests__/documentation/Group.spec.tsx +12 -12
- package/src/renderer/__tests__/documentation/getting-started/HelloWorld.spec.tsx +2 -2
- package/src/renderer/__tests__/documentation/paint/Overview.spec.tsx +8 -8
- package/src/renderer/__tests__/documentation/shapes/Box.spec.tsx +4 -4
- package/src/renderer/__tests__/e2e/Atlas.spec.tsx +3 -3
- package/src/renderer/__tests__/e2e/Offscreen.spec.tsx +1 -1
- package/src/renderer/__tests__/examples/BlendModes.spec.tsx +4 -4
- package/src/renderer/__tests__/setup.tsx +13 -13
- package/src/sksg/Container.ts +1 -9
- package/src/sksg/HostConfig.ts +7 -37
- package/src/sksg/HostConfig2.ts +247 -0
- package/src/sksg/Reconciler.ts +6 -17
- package/src/sksg/__tests__/Simple.spec.tsx +8 -8
- package/cpp/skia/include/gpu/graphite/LogPriority.h +0 -36
- package/cpp/skia/include/gpu/graphite/PrecompileContext.h +0 -52
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypesUtils.h +0 -48
@@ -9,7 +9,7 @@ type TextInstance = Node;
|
|
9
9
|
type SuspenseInstance = Instance;
|
10
10
|
type HydratableInstance = Instance;
|
11
11
|
type PublicInstance = Instance;
|
12
|
-
type HostContext =
|
12
|
+
type HostContext = null;
|
13
13
|
type UpdatePayload = Container;
|
14
14
|
type ChildSet = Node[];
|
15
15
|
type TimeoutHandle = NodeJS.Timeout;
|
@@ -4,12 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.sksgHostConfig = exports.debug = void 0;
|
7
|
-
var _react = require("react");
|
8
7
|
var _constants = require("react-reconciler/constants");
|
9
8
|
var _typeddash = require("../renderer/typeddash");
|
10
9
|
/*global NodeJS*/
|
11
10
|
|
12
|
-
const NoEventPriority = 0;
|
13
11
|
const DEBUG = false;
|
14
12
|
const debug = (...args) => {
|
15
13
|
if (DEBUG) {
|
@@ -17,7 +15,6 @@ const debug = (...args) => {
|
|
17
15
|
}
|
18
16
|
};
|
19
17
|
exports.debug = debug;
|
20
|
-
let currentUpdatePriority = NoEventPriority;
|
21
18
|
const sksgHostConfig = exports.sksgHostConfig = {
|
22
19
|
/**
|
23
20
|
* This function is used by the reconciler in order to calculate current time for prioritising work.
|
@@ -32,11 +29,11 @@ const sksgHostConfig = exports.sksgHostConfig = {
|
|
32
29
|
noTimeout: -1,
|
33
30
|
getRootHostContext: _rootContainerInstance => {
|
34
31
|
debug("getRootHostContext");
|
35
|
-
return
|
32
|
+
return null;
|
36
33
|
},
|
37
34
|
getChildHostContext(_parentHostContext, _type, _rootContainerInstance) {
|
38
35
|
debug("getChildHostContext");
|
39
|
-
return
|
36
|
+
return null;
|
40
37
|
},
|
41
38
|
shouldSetTextContent(_type, _props) {
|
42
39
|
return false;
|
@@ -75,8 +72,9 @@ const sksgHostConfig = exports.sksgHostConfig = {
|
|
75
72
|
debug("prepareForCommit");
|
76
73
|
return null;
|
77
74
|
},
|
78
|
-
resetAfterCommit(
|
75
|
+
resetAfterCommit(container) {
|
79
76
|
debug("resetAfterCommit");
|
77
|
+
container.redraw();
|
80
78
|
},
|
81
79
|
getPublicInstance(node) {
|
82
80
|
debug("getPublicInstance");
|
@@ -99,7 +97,7 @@ const sksgHostConfig = exports.sksgHostConfig = {
|
|
99
97
|
preparePortalMount: () => {
|
100
98
|
debug("preparePortalMount");
|
101
99
|
},
|
102
|
-
cloneInstance(instance, _type, _oldProps, newProps,
|
100
|
+
cloneInstance(instance, _updatePayload, _type, _oldProps, newProps, _internalInstanceHandle, keepChildren, _recyclableInstance) {
|
103
101
|
debug("cloneInstance");
|
104
102
|
return {
|
105
103
|
type: instance.type,
|
@@ -142,34 +140,6 @@ const sksgHostConfig = exports.sksgHostConfig = {
|
|
142
140
|
},
|
143
141
|
getInstanceFromScope: function (_scopeInstance) {
|
144
142
|
throw new Error("Function not implemented.");
|
145
|
-
}
|
146
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
147
|
-
// @ts-expect-error
|
148
|
-
shouldAttemptEagerTransition: () => false,
|
149
|
-
trackSchedulerEvent: () => {},
|
150
|
-
resolveEventType: () => null,
|
151
|
-
resolveEventTimeStamp: () => -1.1,
|
152
|
-
requestPostPaintCallback() {},
|
153
|
-
maySuspendCommit: () => false,
|
154
|
-
preloadInstance: () => true,
|
155
|
-
// true indicates already loaded
|
156
|
-
startSuspendingCommit() {},
|
157
|
-
suspendInstance() {},
|
158
|
-
waitForCommitToBeReady: () => null,
|
159
|
-
NotPendingTransition: null,
|
160
|
-
HostTransitionContext: /*#__PURE__*/(0, _react.createContext)(null),
|
161
|
-
setCurrentUpdatePriority(newPriority) {
|
162
|
-
currentUpdatePriority = newPriority;
|
163
|
-
},
|
164
|
-
getCurrentUpdatePriority() {
|
165
|
-
return currentUpdatePriority;
|
166
|
-
},
|
167
|
-
resolveUpdatePriority() {
|
168
|
-
if (currentUpdatePriority !== NoEventPriority) {
|
169
|
-
return currentUpdatePriority;
|
170
|
-
}
|
171
|
-
return _constants.DefaultEventPriority;
|
172
|
-
},
|
173
|
-
resetFormInstance() {}
|
143
|
+
}
|
174
144
|
};
|
175
145
|
//# sourceMappingURL=HostConfig.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","require","_constants","_typeddash","NoEventPriority","DEBUG","debug","args","console","log","exports","currentUpdatePriority","sksgHostConfig","supportsMutation","isPrimaryRenderer","supportsPersistence","supportsHydration","scheduleTimeout","setTimeout","cancelTimeout","clearTimeout","noTimeout","getRootHostContext","_rootContainerInstance","getChildHostContext","_parentHostContext","_type","shouldSetTextContent","_props","createTextInstance","_text","_hostContext","_internalInstanceHandle","Error","createInstance","type","propsWithChildren","_container","children","props","instance","appendInitialChild","parentInstance","child","push","finalizeInitialChildren","commitMount","prepareForCommit","resetAfterCommit","getPublicInstance","node","commitTextUpdate","_textInstance","_oldText","_newText","clearContainer","prepareUpdate","_instance","oldProps","newProps","container","propsAreEqual","shallowEq","preparePortalMount","cloneInstance","_oldProps","_updatePayload","keepChildren","_recyclableInstance","createContainerChildSet","appendChildToContainerChildSet","childSet","finalizeContainerChildren","newChildren","root","replaceContainerChildren","cloneHiddenInstance","cloneHiddenTextInstance","getCurrentEventPriority","DefaultEventPriority","beforeActiveInstanceBlur","afterActiveInstanceBlur","detachDeletedInstance","_node","getInstanceFromNode","prepareScopeUpdate","_scopeInstance","getInstanceFromScope","shouldAttemptEagerTransition","trackSchedulerEvent","resolveEventType","resolveEventTimeStamp","requestPostPaintCallback","maySuspendCommit","preloadInstance","startSuspendingCommit","suspendInstance","waitForCommitToBeReady","NotPendingTransition","HostTransitionContext","createContext","setCurrentUpdatePriority","newPriority","getCurrentUpdatePriority","resolveUpdatePriority","resetFormInstance"],"sources":["HostConfig.ts"],"sourcesContent":["/*global NodeJS*/\nimport { createContext } from \"react\";\nimport type { Fiber, HostConfig } from \"react-reconciler\";\nimport { DefaultEventPriority } from \"react-reconciler/constants\";\n\nimport type { NodeType } from \"../dom/types\";\nimport { shallowEq } from \"../renderer/typeddash\";\n\nimport type { Node } from \"./Node\";\nimport type { Container } from \"./Container\";\n\ntype EventPriority = number;\nconst NoEventPriority = 0;\n\nconst DEBUG = false;\nexport const debug = (...args: Parameters<typeof console.log>) => {\n if (DEBUG) {\n console.log(...args);\n }\n};\n\ntype Instance = Node;\n\ntype Props = object;\ntype TextInstance = Node;\ntype SuspenseInstance = Instance;\ntype HydratableInstance = Instance;\ntype PublicInstance = Instance;\ntype HostContext = object;\ntype UpdatePayload = Container;\ntype ChildSet = Node[];\ntype TimeoutHandle = NodeJS.Timeout;\ntype NoTimeout = -1;\n\ntype SkiaHostConfig = HostConfig<\n NodeType,\n Props,\n Container,\n Instance,\n TextInstance,\n SuspenseInstance,\n HydratableInstance,\n PublicInstance,\n HostContext,\n UpdatePayload,\n ChildSet,\n TimeoutHandle,\n NoTimeout\n>;\nlet currentUpdatePriority: EventPriority = NoEventPriority;\n\nexport const sksgHostConfig: SkiaHostConfig = {\n /**\n * This function is used by the reconciler in order to calculate current time for prioritising work.\n */\n supportsMutation: false,\n isPrimaryRenderer: false,\n supportsPersistence: true,\n supportsHydration: false,\n //supportsMicrotask: true,\n scheduleTimeout: setTimeout,\n cancelTimeout: clearTimeout,\n noTimeout: -1,\n\n getRootHostContext: (_rootContainerInstance: Container) => {\n debug(\"getRootHostContext\");\n return {};\n },\n\n getChildHostContext(_parentHostContext, _type, _rootContainerInstance) {\n debug(\"getChildHostContext\");\n return {};\n },\n\n shouldSetTextContent(_type, _props) {\n return false;\n },\n\n createTextInstance(\n _text,\n _rootContainerInstance,\n _hostContext,\n _internalInstanceHandle\n ) {\n debug(\"createTextInstance\");\n // return SpanNode({}, text) as SkNode;\n throw new Error(\"Text nodes are not supported yet\");\n },\n\n createInstance(\n type,\n propsWithChildren,\n _container,\n _hostContext,\n _internalInstanceHandle\n ) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { children, ...props } = propsWithChildren as any;\n debug(\"createInstance\", type);\n const instance = {\n type,\n props,\n children: [],\n };\n return instance;\n },\n\n appendInitialChild(parentInstance: Instance, child: Instance | TextInstance) {\n parentInstance.children.push(child);\n },\n\n finalizeInitialChildren(\n parentInstance,\n _type,\n _props,\n _rootContainerInstance,\n _hostContext\n ) {\n debug(\"finalizeInitialChildren\", parentInstance);\n return false;\n },\n\n commitMount() {\n // if finalizeInitialChildren = true\n debug(\"commitMount\");\n },\n\n prepareForCommit(_container: Container) {\n debug(\"prepareForCommit\");\n return null;\n },\n\n resetAfterCommit(_container) {\n debug(\"resetAfterCommit\");\n },\n\n getPublicInstance(node: Instance) {\n debug(\"getPublicInstance\");\n return node;\n },\n\n commitTextUpdate: (\n _textInstance: TextInstance,\n _oldText: string,\n _newText: string\n ) => {\n // textInstance.instance = newText;\n },\n\n clearContainer: (_container) => {\n debug(\"clearContainer\");\n },\n\n prepareUpdate(\n _instance: Instance,\n _type: string,\n oldProps: Props,\n newProps: Props,\n container: Container,\n _hostContext: HostContext\n ) {\n debug(\"prepareUpdate\");\n const propsAreEqual = shallowEq(oldProps, newProps);\n if (propsAreEqual) {\n return null;\n }\n return container;\n },\n\n preparePortalMount: () => {\n debug(\"preparePortalMount\");\n },\n\n cloneInstance(\n instance,\n _type,\n _oldProps,\n newProps,\n _updatePayload,\n _internalInstanceHandle,\n keepChildren: boolean,\n _recyclableInstance: null | Instance\n ) {\n debug(\"cloneInstance\");\n return {\n type: instance.type,\n props: newProps,\n children: keepChildren ? [...instance.children] : [],\n };\n },\n\n createContainerChildSet(): ChildSet {\n debug(\"createContainerChildSet\");\n return [];\n },\n\n appendChildToContainerChildSet(\n childSet: ChildSet,\n child: Instance | TextInstance\n ): void {\n childSet.push(child);\n },\n\n finalizeContainerChildren(container: Container, newChildren: ChildSet) {\n debug(\"finalizeContainerChildren\");\n container.root = newChildren;\n },\n\n replaceContainerChildren(container: Container, newChildren: ChildSet) {\n container.root = newChildren;\n },\n\n cloneHiddenInstance(\n _instance: Instance,\n _type: string,\n _props: Props\n ): Instance {\n debug(\"cloneHiddenInstance\");\n throw new Error(\"Not yet implemented.\");\n },\n\n cloneHiddenTextInstance(_instance: Instance, _text: string): TextInstance {\n debug(\"cloneHiddenTextInstance\");\n throw new Error(\"Not yet implemented.\");\n },\n // see https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874\n getCurrentEventPriority: () => DefaultEventPriority,\n beforeActiveInstanceBlur: () => {},\n afterActiveInstanceBlur: () => {},\n detachDeletedInstance: (_node: Instance) => {},\n getInstanceFromNode: function (_node): Fiber | null | undefined {\n throw new Error(\"Function not implemented.\");\n },\n prepareScopeUpdate: function (_scopeInstance, _instance): void {\n throw new Error(\"Function not implemented.\");\n },\n getInstanceFromScope: function (_scopeInstance): Instance | null {\n throw new Error(\"Function not implemented.\");\n },\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n shouldAttemptEagerTransition: () => false,\n trackSchedulerEvent: () => {},\n resolveEventType: () => null,\n resolveEventTimeStamp: () => -1.1,\n requestPostPaintCallback() {},\n maySuspendCommit: () => false,\n preloadInstance: () => true, // true indicates already loaded\n startSuspendingCommit() {},\n suspendInstance() {},\n waitForCommitToBeReady: () => null,\n NotPendingTransition: null,\n HostTransitionContext: createContext(null),\n setCurrentUpdatePriority(newPriority: number) {\n currentUpdatePriority = newPriority;\n },\n getCurrentUpdatePriority() {\n return currentUpdatePriority;\n },\n resolveUpdatePriority() {\n if (currentUpdatePriority !== NoEventPriority) {\n return currentUpdatePriority;\n }\n return DefaultEventPriority;\n },\n resetFormInstance() {},\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAGA,IAAAE,UAAA,GAAAF,OAAA;AANA;;AAYA,MAAMG,eAAe,GAAG,CAAC;AAEzB,MAAMC,KAAK,GAAG,KAAK;AACZ,MAAMC,KAAK,GAAGA,CAAC,GAAGC,IAAoC,KAAK;EAChE,IAAIF,KAAK,EAAE;IACTG,OAAO,CAACC,GAAG,CAAC,GAAGF,IAAI,CAAC;EACtB;AACF,CAAC;AAACG,OAAA,CAAAJ,KAAA,GAAAA,KAAA;AA8BF,IAAIK,qBAAoC,GAAGP,eAAe;AAEnD,MAAMQ,cAA8B,GAAAF,OAAA,CAAAE,cAAA,GAAG;EAC5C;AACF;AACA;EACEC,gBAAgB,EAAE,KAAK;EACvBC,iBAAiB,EAAE,KAAK;EACxBC,mBAAmB,EAAE,IAAI;EACzBC,iBAAiB,EAAE,KAAK;EACxB;EACAC,eAAe,EAAEC,UAAU;EAC3BC,aAAa,EAAEC,YAAY;EAC3BC,SAAS,EAAE,CAAC,CAAC;EAEbC,kBAAkB,EAAGC,sBAAiC,IAAK;IACzDjB,KAAK,CAAC,oBAAoB,CAAC;IAC3B,OAAO,CAAC,CAAC;EACX,CAAC;EAEDkB,mBAAmBA,CAACC,kBAAkB,EAAEC,KAAK,EAAEH,sBAAsB,EAAE;IACrEjB,KAAK,CAAC,qBAAqB,CAAC;IAC5B,OAAO,CAAC,CAAC;EACX,CAAC;E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AEA,CAAA,KAAM,IAAI;EAAE;EAC7BC,qBAAqBA,CAAA,EAAG,CAAC,CAAC;EAC1BC,eAAeA,CAAA,EAAG,CAAC,CAAC;EACpBC,sBAAsB,EAAEA,CAAA,KAAM,IAAI;EAClCC,oBAAoB,EAAE,IAAI;EAC1BC,qBAAqB,eAAE,IAAAC,oBAAa,EAAC,IAAI,CAAC;EAC1CC,wBAAwBA,CAACC,WAAmB,EAAE;IAC5C3F,qBAAqB,GAAG2F,WAAW;EACrC,CAAC;EACDC,wBAAwBA,CAAA,EAAG;IACzB,OAAO5F,qBAAqB;EAC9B,CAAC;EACD6F,qBAAqBA,CAAA,EAAG;IACtB,IAAI7F,qBAAqB,KAAKP,eAAe,EAAE;MAC7C,OAAOO,qBAAqB;IAC9B;IACA,OAAOoE,+BAAoB;EAC7B,CAAC;EACD0B,iBAAiBA,CAAA,EAAG,CAAC;AACvB,CAAC","ignoreList":[]}
|
1
|
+
{"version":3,"names":["_constants","require","_typeddash","DEBUG","debug","args","console","log","exports","sksgHostConfig","supportsMutation","isPrimaryRenderer","supportsPersistence","supportsHydration","scheduleTimeout","setTimeout","cancelTimeout","clearTimeout","noTimeout","getRootHostContext","_rootContainerInstance","getChildHostContext","_parentHostContext","_type","shouldSetTextContent","_props","createTextInstance","_text","_hostContext","_internalInstanceHandle","Error","createInstance","type","propsWithChildren","_container","children","props","instance","appendInitialChild","parentInstance","child","push","finalizeInitialChildren","commitMount","prepareForCommit","resetAfterCommit","container","redraw","getPublicInstance","node","commitTextUpdate","_textInstance","_oldText","_newText","clearContainer","prepareUpdate","_instance","oldProps","newProps","propsAreEqual","shallowEq","preparePortalMount","cloneInstance","_updatePayload","_oldProps","keepChildren","_recyclableInstance","createContainerChildSet","appendChildToContainerChildSet","childSet","finalizeContainerChildren","newChildren","root","replaceContainerChildren","cloneHiddenInstance","cloneHiddenTextInstance","getCurrentEventPriority","DefaultEventPriority","beforeActiveInstanceBlur","afterActiveInstanceBlur","detachDeletedInstance","_node","getInstanceFromNode","prepareScopeUpdate","_scopeInstance","getInstanceFromScope"],"sources":["HostConfig.ts"],"sourcesContent":["/*global NodeJS*/\nimport type { Fiber, HostConfig } from \"react-reconciler\";\nimport { DefaultEventPriority } from \"react-reconciler/constants\";\n\nimport type { NodeType } from \"../dom/types\";\nimport { shallowEq } from \"../renderer/typeddash\";\n\nimport type { Node } from \"./Node\";\nimport type { Container } from \"./Container\";\n\nconst DEBUG = false;\nexport const debug = (...args: Parameters<typeof console.log>) => {\n if (DEBUG) {\n console.log(...args);\n }\n};\n\ntype Instance = Node;\n\ntype Props = object;\ntype TextInstance = Node;\ntype SuspenseInstance = Instance;\ntype HydratableInstance = Instance;\ntype PublicInstance = Instance;\ntype HostContext = null;\ntype UpdatePayload = Container;\ntype ChildSet = Node[];\ntype TimeoutHandle = NodeJS.Timeout;\ntype NoTimeout = -1;\n\ntype SkiaHostConfig = HostConfig<\n NodeType,\n Props,\n Container,\n Instance,\n TextInstance,\n SuspenseInstance,\n HydratableInstance,\n PublicInstance,\n HostContext,\n UpdatePayload,\n ChildSet,\n TimeoutHandle,\n NoTimeout\n>;\n\nexport const sksgHostConfig: SkiaHostConfig = {\n /**\n * This function is used by the reconciler in order to calculate current time for prioritising work.\n */\n supportsMutation: false,\n isPrimaryRenderer: false,\n supportsPersistence: true,\n supportsHydration: false,\n //supportsMicrotask: true,\n scheduleTimeout: setTimeout,\n cancelTimeout: clearTimeout,\n noTimeout: -1,\n\n getRootHostContext: (_rootContainerInstance: Container) => {\n debug(\"getRootHostContext\");\n return null;\n },\n\n getChildHostContext(_parentHostContext, _type, _rootContainerInstance) {\n debug(\"getChildHostContext\");\n return null;\n },\n\n shouldSetTextContent(_type, _props) {\n return false;\n },\n\n createTextInstance(\n _text,\n _rootContainerInstance,\n _hostContext,\n _internalInstanceHandle\n ) {\n debug(\"createTextInstance\");\n // return SpanNode({}, text) as SkNode;\n throw new Error(\"Text nodes are not supported yet\");\n },\n\n createInstance(\n type,\n propsWithChildren,\n _container,\n _hostContext,\n _internalInstanceHandle\n ) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { children, ...props } = propsWithChildren as any;\n debug(\"createInstance\", type);\n const instance = {\n type,\n props,\n children: [],\n };\n return instance;\n },\n\n appendInitialChild(parentInstance: Instance, child: Instance | TextInstance) {\n parentInstance.children.push(child);\n },\n\n finalizeInitialChildren(\n parentInstance,\n _type,\n _props,\n _rootContainerInstance,\n _hostContext\n ) {\n debug(\"finalizeInitialChildren\", parentInstance);\n return false;\n },\n\n commitMount() {\n // if finalizeInitialChildren = true\n debug(\"commitMount\");\n },\n\n prepareForCommit(_container: Container) {\n debug(\"prepareForCommit\");\n return null;\n },\n\n resetAfterCommit(container) {\n debug(\"resetAfterCommit\");\n container.redraw();\n },\n\n getPublicInstance(node: Instance) {\n debug(\"getPublicInstance\");\n return node;\n },\n\n commitTextUpdate: (\n _textInstance: TextInstance,\n _oldText: string,\n _newText: string\n ) => {\n // textInstance.instance = newText;\n },\n\n clearContainer: (_container) => {\n debug(\"clearContainer\");\n },\n\n prepareUpdate(\n _instance: Instance,\n _type: string,\n oldProps: Props,\n newProps: Props,\n container: Container,\n _hostContext: HostContext\n ) {\n debug(\"prepareUpdate\");\n const propsAreEqual = shallowEq(oldProps, newProps);\n if (propsAreEqual) {\n return null;\n }\n return container;\n },\n\n preparePortalMount: () => {\n debug(\"preparePortalMount\");\n },\n\n cloneInstance(\n instance,\n _updatePayload,\n _type,\n _oldProps,\n newProps,\n _internalInstanceHandle,\n keepChildren: boolean,\n _recyclableInstance: null | Instance\n ) {\n debug(\"cloneInstance\");\n\n return {\n type: instance.type,\n props: newProps,\n children: keepChildren ? [...instance.children] : [],\n };\n },\n\n createContainerChildSet(): ChildSet {\n debug(\"createContainerChildSet\");\n return [];\n },\n\n appendChildToContainerChildSet(\n childSet: ChildSet,\n child: Instance | TextInstance\n ): void {\n childSet.push(child);\n },\n\n finalizeContainerChildren(container: Container, newChildren: ChildSet) {\n debug(\"finalizeContainerChildren\");\n container.root = newChildren;\n },\n\n replaceContainerChildren(container: Container, newChildren: ChildSet) {\n container.root = newChildren;\n },\n\n cloneHiddenInstance(\n _instance: Instance,\n _type: string,\n _props: Props\n ): Instance {\n debug(\"cloneHiddenInstance\");\n throw new Error(\"Not yet implemented.\");\n },\n\n cloneHiddenTextInstance(_instance: Instance, _text: string): TextInstance {\n debug(\"cloneHiddenTextInstance\");\n throw new Error(\"Not yet implemented.\");\n },\n // see https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874\n getCurrentEventPriority: () => DefaultEventPriority,\n beforeActiveInstanceBlur: () => {},\n afterActiveInstanceBlur: () => {},\n detachDeletedInstance: (_node: Instance) => {},\n getInstanceFromNode: function (_node): Fiber | null | undefined {\n throw new Error(\"Function not implemented.\");\n },\n prepareScopeUpdate: function (_scopeInstance, _instance): void {\n throw new Error(\"Function not implemented.\");\n },\n getInstanceFromScope: function (_scopeInstance): Instance | null {\n throw new Error(\"Function not implemented.\");\n },\n};\n"],"mappings":";;;;;;AAEA,IAAAA,UAAA,GAAAC,OAAA;AAGA,IAAAC,UAAA,GAAAD,OAAA;AALA;;AAUA,MAAME,KAAK,GAAG,KAAK;AACZ,MAAMC,KAAK,GAAGA,CAAC,GAAGC,IAAoC,KAAK;EAChE,IAAIF,KAAK,EAAE;IACTG,OAAO,CAACC,GAAG,CAAC,GAAGF,IAAI,CAAC;EACtB;AACF,CAAC;AAACG,OAAA,CAAAJ,KAAA,GAAAA,KAAA;AA+BK,MAAMK,cAA8B,GAAAD,OAAA,CAAAC,cAAA,GAAG;EAC5C;AACF;AACA;EACEC,gBAAgB,EAAE,KAAK;EACvBC,iBAAiB,EAAE,KAAK;EACxBC,mBAAmB,EAAE,IAAI;EACzBC,iBAAiB,EAAE,KAAK;EACxB;EACAC,eAAe,EAAEC,UAAU;EAC3BC,aAAa,EAAEC,YAAY;EAC3BC,SAAS,EAAE,CAAC,CAAC;EAEbC,kBAAkB,EAAGC,sBAAiC,IAAK;IACzD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|
1
|
+
import type { HostConfig } from "react-reconciler";
|
2
|
+
import type { NodeType } from "../dom/types";
|
3
|
+
import type { Container } from "./Container";
|
4
|
+
import type { Node } from "./Node";
|
5
|
+
export declare const debug: (message?: any, ...optionalParams: any[]) => void;
|
6
|
+
type Instance = Node<unknown>;
|
7
|
+
type Props = object;
|
8
|
+
type TextInstance = Node<unknown>;
|
9
|
+
type SuspenseInstance = Instance;
|
10
|
+
type HydratableInstance = Instance;
|
11
|
+
type PublicInstance = Instance;
|
12
|
+
type HostContext = null;
|
13
|
+
type UpdatePayload = Container;
|
14
|
+
type ChildSet = unknown;
|
15
|
+
type TimeoutHandle = NodeJS.Timeout;
|
16
|
+
type NoTimeout = -1;
|
17
|
+
type SkiaHostConfig = HostConfig<NodeType, Props, Container, Instance, TextInstance, SuspenseInstance, HydratableInstance, PublicInstance, HostContext, UpdatePayload, ChildSet, TimeoutHandle, NoTimeout>;
|
18
|
+
export declare const sksgHostConfig: SkiaHostConfig;
|
19
|
+
export {};
|
@@ -0,0 +1,159 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.sksgHostConfig = exports.debug = void 0;
|
7
|
+
var _constants = require("react-reconciler/constants");
|
8
|
+
var _typeddash = require("../renderer/typeddash");
|
9
|
+
/*global NodeJS*/
|
10
|
+
|
11
|
+
const DEBUG = false;
|
12
|
+
const debug = (...args) => {
|
13
|
+
if (DEBUG) {
|
14
|
+
console.log(...args);
|
15
|
+
}
|
16
|
+
};
|
17
|
+
exports.debug = debug;
|
18
|
+
const appendNode = (parent, child) => {
|
19
|
+
parent.children.push(child);
|
20
|
+
};
|
21
|
+
const removeNode = (parent, child) => {
|
22
|
+
parent.children.splice(parent.children.indexOf(child), 1);
|
23
|
+
};
|
24
|
+
const insertBefore = (parent, child, before) => {
|
25
|
+
parent.children.splice(parent.children.indexOf(before), 0, child);
|
26
|
+
};
|
27
|
+
const sksgHostConfig = exports.sksgHostConfig = {
|
28
|
+
/**
|
29
|
+
* This function is used by the reconciler in order to calculate current time for prioritising work.
|
30
|
+
*/
|
31
|
+
supportsMutation: true,
|
32
|
+
isPrimaryRenderer: false,
|
33
|
+
supportsPersistence: false,
|
34
|
+
supportsHydration: false,
|
35
|
+
//supportsMicrotask: true,
|
36
|
+
|
37
|
+
scheduleTimeout: setTimeout,
|
38
|
+
cancelTimeout: clearTimeout,
|
39
|
+
noTimeout: -1,
|
40
|
+
appendChildToContainer(container, child) {
|
41
|
+
debug("appendChildToContainer");
|
42
|
+
container.root.push(child);
|
43
|
+
},
|
44
|
+
appendChild(parent, child) {
|
45
|
+
debug("appendChild", parent, child);
|
46
|
+
appendNode(parent, child);
|
47
|
+
},
|
48
|
+
getRootHostContext: _rootContainerInstance => {
|
49
|
+
debug("getRootHostContext");
|
50
|
+
return null;
|
51
|
+
},
|
52
|
+
getChildHostContext(_parentHostContext, _type, _rootContainerInstance) {
|
53
|
+
debug("getChildHostContext");
|
54
|
+
return null;
|
55
|
+
},
|
56
|
+
shouldSetTextContent(_type, _props) {
|
57
|
+
return false;
|
58
|
+
},
|
59
|
+
createTextInstance(_text, _rootContainerInstance, _hostContext, _internalInstanceHandle) {
|
60
|
+
debug("createTextInstance");
|
61
|
+
// return SpanNode({}, text) as SkNode;
|
62
|
+
throw new Error("Text nodes are not supported yet");
|
63
|
+
},
|
64
|
+
createInstance(type, propsWithChildren, _container, _hostContext, _internalInstanceHandle) {
|
65
|
+
debug("createInstance", type);
|
66
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
67
|
+
const {
|
68
|
+
children,
|
69
|
+
...props
|
70
|
+
} = propsWithChildren;
|
71
|
+
debug("createInstance", type);
|
72
|
+
const instance = {
|
73
|
+
type,
|
74
|
+
props,
|
75
|
+
children: []
|
76
|
+
};
|
77
|
+
return instance;
|
78
|
+
},
|
79
|
+
appendInitialChild(parentInstance, child) {
|
80
|
+
debug("appendInitialChild");
|
81
|
+
appendNode(parentInstance, child);
|
82
|
+
},
|
83
|
+
finalizeInitialChildren(parentInstance, _type, _props, _rootContainerInstance, _hostContext) {
|
84
|
+
debug("finalizeInitialChildren", parentInstance);
|
85
|
+
return false;
|
86
|
+
},
|
87
|
+
commitMount() {
|
88
|
+
// if finalizeInitialChildren = true
|
89
|
+
debug("commitMount");
|
90
|
+
},
|
91
|
+
prepareForCommit(_containerInfo) {
|
92
|
+
debug("prepareForCommit");
|
93
|
+
return null;
|
94
|
+
},
|
95
|
+
resetAfterCommit(container) {
|
96
|
+
debug("resetAfterCommit");
|
97
|
+
container.redraw();
|
98
|
+
},
|
99
|
+
getPublicInstance(node) {
|
100
|
+
debug("getPublicInstance");
|
101
|
+
return node;
|
102
|
+
},
|
103
|
+
prepareUpdate: (_instance, type, oldProps, newProps, rootContainerInstance, _hostContext) => {
|
104
|
+
debug("prepareUpdate");
|
105
|
+
const propsAreEqual = (0, _typeddash.shallowEq)(oldProps, newProps);
|
106
|
+
if (propsAreEqual) {
|
107
|
+
return null;
|
108
|
+
}
|
109
|
+
debug("update ", type);
|
110
|
+
return rootContainerInstance;
|
111
|
+
},
|
112
|
+
commitUpdate(instance, _updatePayload, type, prevProps, nextProps, _internalHandle) {
|
113
|
+
debug("commitUpdate: ", type);
|
114
|
+
if ((0, _typeddash.shallowEq)(prevProps, nextProps)) {
|
115
|
+
return;
|
116
|
+
}
|
117
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
118
|
+
const {
|
119
|
+
children,
|
120
|
+
...props
|
121
|
+
} = nextProps;
|
122
|
+
instance.props = props;
|
123
|
+
},
|
124
|
+
commitTextUpdate: (_textInstance, _oldText, _newText) => {
|
125
|
+
// textInstance.instance = newText;
|
126
|
+
},
|
127
|
+
clearContainer: container => {
|
128
|
+
debug("clearContainer");
|
129
|
+
container.root = [];
|
130
|
+
},
|
131
|
+
preparePortalMount: () => {
|
132
|
+
debug("preparePortalMount");
|
133
|
+
},
|
134
|
+
removeChild: (parent, child) => {
|
135
|
+
removeNode(parent, child);
|
136
|
+
},
|
137
|
+
removeChildFromContainer: (container, child) => {
|
138
|
+
container.root.splice(container.root.indexOf(child), 1);
|
139
|
+
},
|
140
|
+
insertInContainerBefore: (container, child, before) => {
|
141
|
+
container.root.splice(container.root.indexOf(before), 0, child);
|
142
|
+
},
|
143
|
+
insertBefore: (parent, child, before) => {
|
144
|
+
insertBefore(parent, child, before);
|
145
|
+
},
|
146
|
+
// see https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874
|
147
|
+
getCurrentEventPriority: () => _constants.DefaultEventPriority,
|
148
|
+
beforeActiveInstanceBlur: () => {},
|
149
|
+
afterActiveInstanceBlur: () => {},
|
150
|
+
detachDeletedInstance: () => {},
|
151
|
+
getInstanceFromNode: function (_node) {
|
152
|
+
return null;
|
153
|
+
},
|
154
|
+
prepareScopeUpdate: function (_scopeInstance, _instance) {},
|
155
|
+
getInstanceFromScope: function (_scopeInstance) {
|
156
|
+
return null;
|
157
|
+
}
|
158
|
+
};
|
159
|
+
//# sourceMappingURL=HostConfig2.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_constants","require","_typeddash","DEBUG","debug","args","console","log","exports","appendNode","parent","child","children","push","removeNode","splice","indexOf","insertBefore","before","sksgHostConfig","supportsMutation","isPrimaryRenderer","supportsPersistence","supportsHydration","scheduleTimeout","setTimeout","cancelTimeout","clearTimeout","noTimeout","appendChildToContainer","container","root","appendChild","getRootHostContext","_rootContainerInstance","getChildHostContext","_parentHostContext","_type","shouldSetTextContent","_props","createTextInstance","_text","_hostContext","_internalInstanceHandle","Error","createInstance","type","propsWithChildren","_container","props","instance","appendInitialChild","parentInstance","finalizeInitialChildren","commitMount","prepareForCommit","_containerInfo","resetAfterCommit","redraw","getPublicInstance","node","prepareUpdate","_instance","oldProps","newProps","rootContainerInstance","propsAreEqual","shallowEq","commitUpdate","_updatePayload","prevProps","nextProps","_internalHandle","commitTextUpdate","_textInstance","_oldText","_newText","clearContainer","preparePortalMount","removeChild","removeChildFromContainer","insertInContainerBefore","getCurrentEventPriority","DefaultEventPriority","beforeActiveInstanceBlur","afterActiveInstanceBlur","detachDeletedInstance","getInstanceFromNode","_node","prepareScopeUpdate","_scopeInstance","getInstanceFromScope"],"sources":["HostConfig2.ts"],"sourcesContent":["/*global NodeJS*/\nimport type { Fiber, HostConfig } from \"react-reconciler\";\nimport { DefaultEventPriority } from \"react-reconciler/constants\";\n\nimport type { NodeType } from \"../dom/types\";\nimport { shallowEq } from \"../renderer/typeddash\";\n\nimport type { Container } from \"./Container\";\nimport type { Node } from \"./Node\";\n\nconst DEBUG = false;\nexport const debug = (...args: Parameters<typeof console.log>) => {\n if (DEBUG) {\n console.log(...args);\n }\n};\n\ntype Instance = Node<unknown>;\n\ntype Props = object;\ntype TextInstance = Node<unknown>;\ntype SuspenseInstance = Instance;\ntype HydratableInstance = Instance;\ntype PublicInstance = Instance;\ntype HostContext = null;\ntype UpdatePayload = Container;\ntype ChildSet = unknown;\ntype TimeoutHandle = NodeJS.Timeout;\ntype NoTimeout = -1;\n\ntype SkiaHostConfig = HostConfig<\n NodeType,\n Props,\n Container,\n Instance,\n TextInstance,\n SuspenseInstance,\n HydratableInstance,\n PublicInstance,\n HostContext,\n UpdatePayload,\n ChildSet,\n TimeoutHandle,\n NoTimeout\n>;\n\nconst appendNode = (parent: Node<unknown>, child: Node<unknown>) => {\n parent.children.push(child);\n};\n\nconst removeNode = (parent: Node<unknown>, child: Node<unknown>) => {\n parent.children.splice(parent.children.indexOf(child), 1);\n};\n\nconst insertBefore = (\n parent: Node<unknown>,\n child: Node<unknown>,\n before: Node<unknown>\n) => {\n parent.children.splice(parent.children.indexOf(before), 0, child);\n};\n\nexport const sksgHostConfig: SkiaHostConfig = {\n /**\n * This function is used by the reconciler in order to calculate current time for prioritising work.\n */\n supportsMutation: true,\n isPrimaryRenderer: false,\n supportsPersistence: false,\n supportsHydration: false,\n //supportsMicrotask: true,\n\n scheduleTimeout: setTimeout,\n cancelTimeout: clearTimeout,\n noTimeout: -1,\n\n appendChildToContainer(container, child) {\n debug(\"appendChildToContainer\");\n container.root.push(child);\n },\n\n appendChild(parent, child) {\n debug(\"appendChild\", parent, child);\n appendNode(parent, child);\n },\n\n getRootHostContext: (_rootContainerInstance: Container) => {\n debug(\"getRootHostContext\");\n return null;\n },\n\n getChildHostContext(_parentHostContext, _type, _rootContainerInstance) {\n debug(\"getChildHostContext\");\n return null;\n },\n\n shouldSetTextContent(_type, _props) {\n return false;\n },\n\n createTextInstance(\n _text,\n _rootContainerInstance,\n _hostContext,\n _internalInstanceHandle\n ) {\n debug(\"createTextInstance\");\n // return SpanNode({}, text) as SkNode;\n throw new Error(\"Text nodes are not supported yet\");\n },\n\n createInstance(\n type,\n propsWithChildren,\n _container,\n _hostContext,\n _internalInstanceHandle\n ) {\n debug(\"createInstance\", type);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { children, ...props } = propsWithChildren as any;\n debug(\"createInstance\", type);\n const instance = {\n type,\n props,\n children: [],\n };\n return instance;\n },\n\n appendInitialChild(parentInstance, child) {\n debug(\"appendInitialChild\");\n appendNode(parentInstance, child);\n },\n\n finalizeInitialChildren(\n parentInstance,\n _type,\n _props,\n _rootContainerInstance,\n _hostContext\n ) {\n debug(\"finalizeInitialChildren\", parentInstance);\n return false;\n },\n\n commitMount() {\n // if finalizeInitialChildren = true\n debug(\"commitMount\");\n },\n\n prepareForCommit(_containerInfo) {\n debug(\"prepareForCommit\");\n return null;\n },\n\n resetAfterCommit(container) {\n debug(\"resetAfterCommit\");\n container.redraw();\n },\n\n getPublicInstance(node: Instance) {\n debug(\"getPublicInstance\");\n return node;\n },\n\n prepareUpdate: (\n _instance,\n type,\n oldProps,\n newProps,\n rootContainerInstance,\n _hostContext\n ) => {\n debug(\"prepareUpdate\");\n const propsAreEqual = shallowEq(oldProps, newProps);\n if (propsAreEqual) {\n return null;\n }\n debug(\"update \", type);\n return rootContainerInstance;\n },\n\n commitUpdate(\n instance,\n _updatePayload,\n type,\n prevProps,\n nextProps,\n _internalHandle\n ) {\n debug(\"commitUpdate: \", type);\n if (shallowEq(prevProps, nextProps)) {\n return;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { children, ...props } = nextProps as any;\n instance.props = props;\n },\n\n commitTextUpdate: (\n _textInstance: TextInstance,\n _oldText: string,\n _newText: string\n ) => {\n // textInstance.instance = newText;\n },\n\n clearContainer: (container) => {\n debug(\"clearContainer\");\n container.root = [];\n },\n\n preparePortalMount: () => {\n debug(\"preparePortalMount\");\n },\n\n removeChild: (parent, child) => {\n removeNode(parent, child);\n },\n\n removeChildFromContainer: (container, child) => {\n container.root.splice(container.root.indexOf(child), 1);\n },\n\n insertInContainerBefore: (container, child, before) => {\n container.root.splice(container.root.indexOf(before), 0, child);\n },\n\n insertBefore: (parent, child, before) => {\n insertBefore(parent, child, before);\n },\n\n // see https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874\n getCurrentEventPriority: () => DefaultEventPriority,\n beforeActiveInstanceBlur: () => {},\n afterActiveInstanceBlur: () => {},\n detachDeletedInstance: () => {},\n\n getInstanceFromNode: function (_node): Fiber | null | undefined {\n return null;\n },\n prepareScopeUpdate: function (_scopeInstance, _instance): void {},\n getInstanceFromScope: function (_scopeInstance): Instance | null {\n return null;\n },\n};\n"],"mappings":";;;;;;AAEA,IAAAA,UAAA,GAAAC,OAAA;AAGA,IAAAC,UAAA,GAAAD,OAAA;AALA;;AAUA,MAAME,KAAK,GAAG,KAAK;AACZ,MAAMC,KAAK,GAAGA,CAAC,GAAGC,IAAoC,KAAK;EAChE,IAAIF,KAAK,EAAE;IACTG,OAAO,CAACC,GAAG,CAAC,GAAGF,IAAI,CAAC;EACtB;AACF,CAAC;AAACG,OAAA,CAAAJ,KAAA,GAAAA,KAAA;AA+BF,MAAMK,UAAU,GAAGA,CAACC,MAAqB,EAAEC,KAAoB,KAAK;EAClED,MAAM,CAACE,QAAQ,CAACC,IA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3B,CAAC;EAEDqE,wBAAwB,EAAEA,CAAClD,SAAS,EAAEnB,KAAK,KAAK;IAC9CmB,SAAS,CAACC,IAAI,CAAChB,MAAM,CAACe,SAAS,CAACC,IAAI,CAACf,OAAO,CAACL,KAAK,CAAC,EAAE,CAAC,CAAC;EACzD,CAAC;EAEDsE,uBAAuB,EAAEA,CAACnD,SAAS,EAAEnB,KAAK,EAAEO,MAAM,KAAK;IACrDY,SAAS,CAACC,IAAI,CAAChB,MAAM,CAACe,SAAS,CAACC,IAAI,CAACf,OAAO,CAACE,MAAM,CAAC,EAAE,CAAC,EAAEP,KAAK,CAAC;EACjE,CAAC;EAEDM,YAAY,EAAEA,CAACP,MAAM,EAAEC,KAAK,EAAEO,MAAM,KAAK;IACvCD,YAAY,CAACP,MAAM,EAAEC,KAAK,EAAEO,MAAM,CAAC;EACrC,CAAC;EAED;EACAgE,uBAAuB,EAAEA,CAAA,KAAMC,+BAAoB;EACnDC,wBAAwB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAClCC,uBAAuB,EAAEA,CAAA,KAAM,CAAC,CAAC;EACjCC,qBAAqB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAE/BC,mBAAmB,EAAE,SAAAA,CAAUC,KAAK,EAA4B;IAC9D,OAAO,IAAI;EACb,CAAC;EACDC,kBAAkB,EAAE,SAAAA,CAAUC,cAAc,EAAE5B,SAAS,EAAQ,CAAC,CAAC;EACjE6B,oBAAoB,EAAE,SAAAA,CAAUD,cAAc,EAAmB;IAC/D,OAAO,IAAI;EACb;AACF,CAAC","ignoreList":[]}
|
@@ -13,9 +13,8 @@ export declare class SkiaSGRoot {
|
|
13
13
|
children: import("./Node").Node<unknown>[];
|
14
14
|
isDeclaration: boolean;
|
15
15
|
};
|
16
|
-
|
17
|
-
render(element: ReactNode): Promise<void>;
|
16
|
+
render(element: ReactNode): void;
|
18
17
|
drawOnCanvas(canvas: SkCanvas): void;
|
19
18
|
getPicture(): import("../skia/types").SkPicture;
|
20
|
-
unmount():
|
19
|
+
unmount(): void;
|
21
20
|
}
|
@@ -36,19 +36,12 @@ class SkiaSGRoot {
|
|
36
36
|
isDeclaration: false
|
37
37
|
};
|
38
38
|
}
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
(0, _HostConfig.debug)("updateContainer");
|
44
|
-
resolve(true);
|
45
|
-
});
|
39
|
+
render(element) {
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
41
|
+
skiaReconciler.updateContainer(element, this.root, null, () => {
|
42
|
+
(0, _HostConfig.debug)("updateContainer");
|
46
43
|
});
|
47
44
|
}
|
48
|
-
async render(element) {
|
49
|
-
await this.updateContainer(element);
|
50
|
-
this.container.redraw();
|
51
|
-
}
|
52
45
|
drawOnCanvas(canvas) {
|
53
46
|
this.container.drawOnCanvas(canvas);
|
54
47
|
}
|
@@ -60,11 +53,8 @@ class SkiaSGRoot {
|
|
60
53
|
}
|
61
54
|
unmount() {
|
62
55
|
this.container.unmount();
|
63
|
-
|
64
|
-
|
65
|
-
(0, _HostConfig.debug)("unmountContainer");
|
66
|
-
resolve(true);
|
67
|
-
});
|
56
|
+
skiaReconciler.updateContainer(null, this.root, null, () => {
|
57
|
+
(0, _HostConfig.debug)("unmountContainer");
|
68
58
|
});
|
69
59
|
}
|
70
60
|
}
|
@@ -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","
|
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","render","element","updateContainer","debug","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 render(element: ReactNode) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n skiaReconciler.updateContainer(element as any, this.root, null, () => {\n debug(\"updateContainer\");\n });\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 skiaReconciler.updateContainer(null, this.root, null, () => {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AAc,CAACyB,eAAe,CAAC,IAAI,EAAE,IAAI,CAACZ,IAAI,EAAE,IAAI,EAAE,MAAM;MAC1D,IAAAa,iBAAK,EAAC,kBAAkB,CAAC;IAC3B,CAAC,CAAC;EACJ;AACF;AAACS,OAAA,CAAA5B,UAAA,GAAAA,UAAA","ignoreList":[]}
|
@@ -91,7 +91,7 @@ const View = ({
|
|
91
91
|
onLayout,
|
92
92
|
style: rawStyle
|
93
93
|
}) => {
|
94
|
-
const style = useMemo(() => rawStyle
|
94
|
+
const style = useMemo(() => rawStyle !== null && rawStyle !== void 0 ? rawStyle : {}, [rawStyle]);
|
95
95
|
const ref = useRef(null);
|
96
96
|
useElementLayout(ref, onLayout);
|
97
97
|
const cssStyles = useMemo(() => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","useLayoutEffect","useMemo","useRef","isRNModule","DOM_LAYOUT_HANDLER_NAME","resizeObserver","getObserver","window","ResizeObserver","entries","forEach","entry","node","target","left","top","width","height","contentRect","onLayout","setTimeout","timeStamp","Date","now","nativeEvent","layout","x","y","currentTarget","bubbles","cancelable","defaultPrevented","eventPhase","isDefaultPrevented","Error","isPropagationStopped","persist","preventDefault","stopPropagation","isTrusted","type","useElementLayout","ref","observer","current","observe","unobserve","View","children","style","rawStyle","cssStyles","alignItems","backgroundColor","border","boxSizing","display","flexBasis","flexDirection","flexShrink","listStyle","margin","minHeight","minWidth","padding","position","textDecoration","zIndex","createElement","Platform","OS","PixelRatio","devicePixelRatio","resolveAsset","source","require","getAssetByID","httpServerLocation","name","uri","default","findNodeHandle"],"sources":["Platform.web.tsx"],"sourcesContent":["import type { RefObject, CSSProperties } from \"react\";\nimport React, { useLayoutEffect, useMemo, useRef } from \"react\";\nimport type { LayoutChangeEvent, ViewComponent, ViewProps } from \"react-native\";\n\nimport type { DataModule } from \"../skia/types\";\nimport { isRNModule } from \"../skia/types\";\n\nimport type { IPlatform } from \"./IPlatform\";\n\n// eslint-disable-next-line max-len\n// https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/modules/useElementLayout/index.js\nconst DOM_LAYOUT_HANDLER_NAME = \"__reactLayoutHandler\";\ntype OnLayout = ((event: LayoutChangeEvent) => void) | undefined;\ntype Div = HTMLDivElement & {\n __reactLayoutHandler: OnLayout;\n};\n\nlet resizeObserver: ResizeObserver | null = null;\n\nconst getObserver = () => {\n if (resizeObserver == null) {\n resizeObserver = new window.ResizeObserver(function (entries) {\n entries.forEach((entry) => {\n const node = entry.target as Div;\n const { left, top, width, height } = entry.contentRect;\n const onLayout = node[DOM_LAYOUT_HANDLER_NAME];\n if (typeof onLayout === \"function\") {\n // setTimeout 0 is taken from react-native-web (UIManager)\n setTimeout(\n () =>\n onLayout({\n timeStamp: Date.now(),\n nativeEvent: { layout: { x: left, y: top, width, height } },\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n currentTarget: 0,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n target: 0,\n bubbles: false,\n cancelable: false,\n defaultPrevented: false,\n eventPhase: 0,\n isDefaultPrevented() {\n throw new Error(\"Method not supported on web.\");\n },\n isPropagationStopped() {\n throw new Error(\"Method not supported on web.\");\n },\n persist() {\n throw new Error(\"Method not supported on web.\");\n },\n preventDefault() {\n throw new Error(\"Method not supported on web.\");\n },\n stopPropagation() {\n throw new Error(\"Method not supported on web.\");\n },\n isTrusted: true,\n type: \"\",\n }),\n 0\n );\n }\n });\n });\n }\n return resizeObserver;\n};\n\nconst useElementLayout = (ref: RefObject<Div>, onLayout: OnLayout) => {\n const observer = getObserver();\n\n useLayoutEffect(() => {\n const node = ref.current;\n if (node !== null) {\n node[DOM_LAYOUT_HANDLER_NAME] = onLayout;\n }\n }, [ref, onLayout]);\n\n useLayoutEffect(() => {\n const node = ref.current;\n if (node != null && observer != null) {\n if (typeof node[DOM_LAYOUT_HANDLER_NAME] === \"function\") {\n observer.observe(node);\n } else {\n observer.unobserve(node);\n }\n }\n return () => {\n if (node != null && observer != null) {\n observer.unobserve(node);\n }\n };\n }, [observer, ref]);\n};\n\nconst View = (({ children, onLayout, style: rawStyle }: ViewProps) => {\n const style = useMemo(() => (rawStyle ?? {}) as CSSProperties, [rawStyle]);\n const ref = useRef<Div>(null);\n useElementLayout(ref, onLayout);\n const cssStyles = useMemo(() => {\n return {\n alignItems: \"stretch\" as const,\n backgroundColor: \"transparent\" as const,\n border: \"0 solid black\" as const,\n boxSizing: \"border-box\" as const,\n display: \"flex\" as const,\n flexBasis: \"auto\" as const,\n flexDirection: \"column\" as const,\n flexShrink: 0,\n listStyle: \"none\" as const,\n margin: 0,\n minHeight: 0,\n minWidth: 0,\n padding: 0,\n position: \"relative\" as const,\n textDecoration: \"none\" as const,\n zIndex: 0,\n ...style,\n };\n }, [style]);\n\n return (\n <div ref={ref} style={cssStyles}>\n {children}\n </div>\n );\n}) as unknown as typeof ViewComponent;\n\nexport const Platform: IPlatform = {\n OS: \"web\",\n PixelRatio: typeof window !== \"undefined\" ? window.devicePixelRatio : 1, // window is not defined on node\n resolveAsset: (source: DataModule) => {\n if (isRNModule(source)) {\n if (typeof source === \"number\" && typeof require === \"function\") {\n const {\n getAssetByID,\n } = require(\"react-native/Libraries/Image/AssetRegistry\");\n const { httpServerLocation, name, type } = getAssetByID(source);\n const uri = `${httpServerLocation}/${name}.${type}`;\n return uri;\n }\n throw new Error(\n \"Asset source is a number - this is not supported on the web\"\n );\n }\n return source.default;\n },\n findNodeHandle: () => {\n throw new Error(\"findNodeHandle is not supported on the web\");\n },\n View,\n};\n"],"mappings":"AACA,OAAOA,KAAK,IAAIC,eAAe,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAI/D,SAASC,UAAU,QAAQ,eAAe;AAI1C;AACA;AACA,MAAMC,uBAAuB,GAAG,sBAAsB;AAMtD,IAAIC,cAAqC,GAAG,IAAI;AAEhD,MAAMC,WAAW,GAAGA,CAAA,KAAM;EACxB,IAAID,cAAc,IAAI,IAAI,EAAE;I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,EACJ,CACF,CAAC;QACH;MACF,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;EACA,OAAOnC,cAAc;AACvB,CAAC;AAED,MAAMoC,gBAAgB,GAAGA,CAACC,GAAmB,EAAEvB,QAAkB,KAAK;EACpE,MAAMwB,QAAQ,GAAGrC,WAAW,CAAC,CAAC;EAE9BN,eAAe,CAAC,MAAM;IACpB,MAAMY,IAAI,GAAG8B,GAAG,CAACE,OAAO;IACxB,IAAIhC,IAAI,KAAK,IAAI,EAAE;MACjBA,IAAI,CAACR,uBAAuB,CAAC,GAAGe,QAAQ;IAC1C;EACF,CAAC,EAAE,CAACuB,GAAG,EAAEvB,QAAQ,CAAC,CAAC;EAEnBnB,eAAe,CAAC,MAAM;IACpB,MAAMY,IAAI,GAAG8B,GAAG,CAACE,OAAO;IACxB,IAAIhC,IAAI,IAAI,IAAI,IAAI+B,QAAQ,IAAI,IAAI,EAAE;MACpC,IAAI,OAAO/B,IAAI,CAACR,uBAAuB,CAAC,KAAK,UAAU,EAAE;QACvDuC,QAAQ,CAACE,OAAO,CAACjC,IAAI,CAAC;MACxB,CAAC,MAAM;QACL+B,QAAQ,CAACG,SAAS,CAAClC,IAAI,CAAC;MAC1B;IACF;IACA,OAAO,MAAM;MACX,IAAIA,IAAI,IAAI,IAAI,IAAI+B,QAAQ,IAAI,IAAI,EAAE;QACpCA,QAAQ,CAACG,SAAS,CAAClC,IAAI,CAAC;MAC1B;IACF,CAAC;EACH,CAAC,EAAE,CAAC+B,QAAQ,EAAED,GAAG,CAAC,CAAC;AACrB,CAAC;AAED,MAAMK,IAAI,GAAIA,CAAC;EAAEC,QAAQ;EAAE7B,QAAQ;EAAE8B,KAAK,EAAEC;AAAoB,CAAC,KAAK;EACpE,MAAMD,KAAK,GAAGhD,OAAO,CAAC,MAAOiD,QAAQ,
|
1
|
+
{"version":3,"names":["React","useLayoutEffect","useMemo","useRef","isRNModule","DOM_LAYOUT_HANDLER_NAME","resizeObserver","getObserver","window","ResizeObserver","entries","forEach","entry","node","target","left","top","width","height","contentRect","onLayout","setTimeout","timeStamp","Date","now","nativeEvent","layout","x","y","currentTarget","bubbles","cancelable","defaultPrevented","eventPhase","isDefaultPrevented","Error","isPropagationStopped","persist","preventDefault","stopPropagation","isTrusted","type","useElementLayout","ref","observer","current","observe","unobserve","View","children","style","rawStyle","cssStyles","alignItems","backgroundColor","border","boxSizing","display","flexBasis","flexDirection","flexShrink","listStyle","margin","minHeight","minWidth","padding","position","textDecoration","zIndex","createElement","Platform","OS","PixelRatio","devicePixelRatio","resolveAsset","source","require","getAssetByID","httpServerLocation","name","uri","default","findNodeHandle"],"sources":["Platform.web.tsx"],"sourcesContent":["import type { RefObject, CSSProperties } from \"react\";\nimport React, { useLayoutEffect, useMemo, useRef } from \"react\";\nimport type { LayoutChangeEvent, ViewComponent, ViewProps } from \"react-native\";\n\nimport type { DataModule } from \"../skia/types\";\nimport { isRNModule } from \"../skia/types\";\n\nimport type { IPlatform } from \"./IPlatform\";\n\n// eslint-disable-next-line max-len\n// https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/modules/useElementLayout/index.js\nconst DOM_LAYOUT_HANDLER_NAME = \"__reactLayoutHandler\";\ntype OnLayout = ((event: LayoutChangeEvent) => void) | undefined;\ntype Div = HTMLDivElement & {\n __reactLayoutHandler: OnLayout;\n};\n\nlet resizeObserver: ResizeObserver | null = null;\n\nconst getObserver = () => {\n if (resizeObserver == null) {\n resizeObserver = new window.ResizeObserver(function (entries) {\n entries.forEach((entry) => {\n const node = entry.target as Div;\n const { left, top, width, height } = entry.contentRect;\n const onLayout = node[DOM_LAYOUT_HANDLER_NAME];\n if (typeof onLayout === \"function\") {\n // setTimeout 0 is taken from react-native-web (UIManager)\n setTimeout(\n () =>\n onLayout({\n timeStamp: Date.now(),\n nativeEvent: { layout: { x: left, y: top, width, height } },\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n currentTarget: 0,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n target: 0,\n bubbles: false,\n cancelable: false,\n defaultPrevented: false,\n eventPhase: 0,\n isDefaultPrevented() {\n throw new Error(\"Method not supported on web.\");\n },\n isPropagationStopped() {\n throw new Error(\"Method not supported on web.\");\n },\n persist() {\n throw new Error(\"Method not supported on web.\");\n },\n preventDefault() {\n throw new Error(\"Method not supported on web.\");\n },\n stopPropagation() {\n throw new Error(\"Method not supported on web.\");\n },\n isTrusted: true,\n type: \"\",\n }),\n 0\n );\n }\n });\n });\n }\n return resizeObserver;\n};\n\nconst useElementLayout = (ref: RefObject<Div>, onLayout: OnLayout) => {\n const observer = getObserver();\n\n useLayoutEffect(() => {\n const node = ref.current;\n if (node !== null) {\n node[DOM_LAYOUT_HANDLER_NAME] = onLayout;\n }\n }, [ref, onLayout]);\n\n useLayoutEffect(() => {\n const node = ref.current;\n if (node != null && observer != null) {\n if (typeof node[DOM_LAYOUT_HANDLER_NAME] === \"function\") {\n observer.observe(node);\n } else {\n observer.unobserve(node);\n }\n }\n return () => {\n if (node != null && observer != null) {\n observer.unobserve(node);\n }\n };\n }, [observer, ref]);\n};\n\nconst View = (({ children, onLayout, style: rawStyle }: ViewProps) => {\n const style = useMemo(() => (rawStyle ?? {}) as CSSProperties, [rawStyle]);\n const ref = useRef<Div>(null);\n useElementLayout(ref, onLayout);\n const cssStyles = useMemo(() => {\n return {\n alignItems: \"stretch\" as const,\n backgroundColor: \"transparent\" as const,\n border: \"0 solid black\" as const,\n boxSizing: \"border-box\" as const,\n display: \"flex\" as const,\n flexBasis: \"auto\" as const,\n flexDirection: \"column\" as const,\n flexShrink: 0,\n listStyle: \"none\" as const,\n margin: 0,\n minHeight: 0,\n minWidth: 0,\n padding: 0,\n position: \"relative\" as const,\n textDecoration: \"none\" as const,\n zIndex: 0,\n ...style,\n };\n }, [style]);\n\n return (\n <div ref={ref} style={cssStyles}>\n {children}\n </div>\n );\n}) as unknown as typeof ViewComponent;\n\nexport const Platform: IPlatform = {\n OS: \"web\",\n PixelRatio: typeof window !== \"undefined\" ? window.devicePixelRatio : 1, // window is not defined on node\n resolveAsset: (source: DataModule) => {\n if (isRNModule(source)) {\n if (typeof source === \"number\" && typeof require === \"function\") {\n const {\n getAssetByID,\n } = require(\"react-native/Libraries/Image/AssetRegistry\");\n const { httpServerLocation, name, type } = getAssetByID(source);\n const uri = `${httpServerLocation}/${name}.${type}`;\n return uri;\n }\n throw new Error(\n \"Asset source is a number - this is not supported on the web\"\n );\n }\n return source.default;\n },\n findNodeHandle: () => {\n throw new Error(\"findNodeHandle is not supported on the web\");\n },\n View,\n};\n"],"mappings":"AACA,OAAOA,KAAK,IAAIC,eAAe,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAI/D,SAASC,UAAU,QAAQ,eAAe;AAI1C;AACA;AACA,MAAMC,uBAAuB,GAAG,sBAAsB;AAMtD,IAAIC,cAAqC,GAAG,IAAI;AAEhD,MAAMC,WAAW,GAAGA,CAAA,KAAM;EACxB,IAAID,cAAc,IAAI,IAAI,EAAE;IAC1BA,cAAc,GAAG,IAAIE,MAAM,CAACC,cAAc,CAAC,UAAUC,OAAO,EAAE;MAC5DA,OAAO,CAACC,OAAO,CAAEC,KAAK,IAAK;QACzB,MAAMC,IAAI,GAAGD,KAAK,CAACE,MAAa;QAChC,MAAM;UAAEC,IAAI;UAAEC,GAAG;UAAEC,KAAK;UAAEC;QAAO,CAAC,GAAGN,KAAK,CAACO,WAAW;QACtD,MAAMC,QAAQ,GAAGP,IAAI,CAACR,uBAAuB,CAAC;QAC9C,IAAI,OAAOe,QAAQ,KAAK,UAAU,EAAE;UAClC;UACAC,UAAU,CACR,MACED,QAAQ,CAAC;YACPE,SAAS,EAAEC,IAAI,CAACC,GAAG,CAAC,CAAC;YACrBC,WAAW,EAAE;cAAEC,MAAM,EAAE;gBAAEC,CAAC,EAAEZ,IAAI;gBAAEa,CAAC,EAAEZ,GAAG;gBAAEC,KAAK;gBAAEC;cAAO;YAAE,CAAC;YAC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,EAAE,CAACA,KAAK,CAAC,CAAC;EAEX,oBACElD,KAAA,CAAAqE,aAAA;IAAK1B,GAAG,EAAEA,GAAI;IAACO,KAAK,EAAEE;EAAU,GAC7BH,QACE,CAAC;AAEV,CAAqC;AAErC,OAAO,MAAMqB,QAAmB,GAAG;EACjCC,EAAE,EAAE,KAAK;EACTC,UAAU,EAAE,OAAOhE,MAAM,KAAK,WAAW,GAAGA,MAAM,CAACiE,gBAAgB,GAAG,CAAC;EAAE;EACzEC,YAAY,EAAGC,MAAkB,IAAK;IACpC,IAAIvE,UAAU,CAACuE,MAAM,CAAC,EAAE;MACtB,IAAI,OAAOA,MAAM,KAAK,QAAQ,IAAI,OAAOC,OAAO,KAAK,UAAU,EAAE;QAC/D,MAAM;UACJC;QACF,CAAC,GAAGD,OAAO,CAAC,4CAA4C,CAAC;QACzD,MAAM;UAAEE,kBAAkB;UAAEC,IAAI;UAAEtC;QAAK,CAAC,GAAGoC,YAAY,CAACF,MAAM,CAAC;QAC/D,MAAMK,GAAG,GAAG,GAAGF,kBAAkB,IAAIC,IAAI,IAAItC,IAAI,EAAE;QACnD,OAAOuC,GAAG;MACZ;MACA,MAAM,IAAI7C,KAAK,CACb,6DACF,CAAC;IACH;IACA,OAAOwC,MAAM,CAACM,OAAO;EACvB,CAAC;EACDC,cAAc,EAAEA,CAAA,KAAM;IACpB,MAAM,IAAI/C,KAAK,CAAC,4CAA4C,CAAC;EAC/D,CAAC;EACDa;AACF,CAAC","ignoreList":[]}
|
@@ -8,6 +8,7 @@ export const isCircleScalarDef = def => {
|
|
8
8
|
export const processCircle = def => {
|
9
9
|
"worklet";
|
10
10
|
|
11
|
+
var _def$c;
|
11
12
|
if (isCircleScalarDef(def)) {
|
12
13
|
return {
|
13
14
|
c: {
|
@@ -19,7 +20,7 @@ export const processCircle = def => {
|
|
19
20
|
}
|
20
21
|
return {
|
21
22
|
...def,
|
22
|
-
c: def.c
|
23
|
+
c: (_def$c = def.c) !== null && _def$c !== void 0 ? _def$c : {
|
23
24
|
x: 0,
|
24
25
|
y: 0
|
25
26
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["isCircleScalarDef","def","cx","undefined","processCircle","c","x","y","cy","r"],"sources":["Circle.ts"],"sourcesContent":["import type { CircleDef, ScalarCircleDef } from \"../../types\";\n\nexport const isCircleScalarDef = (def: CircleDef): def is ScalarCircleDef => {\n \"worklet\";\n // We have an issue to check property existence on JSI backed instances\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (def as any).cx !== undefined;\n};\n\nexport const processCircle = (def: CircleDef) => {\n \"worklet\";\n if (isCircleScalarDef(def)) {\n return { c: { x: def.cx, y: def.cy }, r: def.r };\n }\n return { ...def, c: def.c ?? { x: 0, y: 0 } };\n};\n"],"mappings":"AAEA,OAAO,MAAMA,iBAAiB,GAAIC,GAAc,IAA6B;EAC3E,SAAS;;EACT;EACA;EACA,OAAQA,GAAG,CAASC,EAAE,KAAKC,SAAS;AACtC,CAAC;AAED,OAAO,MAAMC,aAAa,GAAIH,GAAc,IAAK;EAC/C,SAAS;;
|
1
|
+
{"version":3,"names":["isCircleScalarDef","def","cx","undefined","processCircle","_def$c","c","x","y","cy","r"],"sources":["Circle.ts"],"sourcesContent":["import type { CircleDef, ScalarCircleDef } from \"../../types\";\n\nexport const isCircleScalarDef = (def: CircleDef): def is ScalarCircleDef => {\n \"worklet\";\n // We have an issue to check property existence on JSI backed instances\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (def as any).cx !== undefined;\n};\n\nexport const processCircle = (def: CircleDef) => {\n \"worklet\";\n if (isCircleScalarDef(def)) {\n return { c: { x: def.cx, y: def.cy }, r: def.r };\n }\n return { ...def, c: def.c ?? { x: 0, y: 0 } };\n};\n"],"mappings":"AAEA,OAAO,MAAMA,iBAAiB,GAAIC,GAAc,IAA6B;EAC3E,SAAS;;EACT;EACA;EACA,OAAQA,GAAG,CAASC,EAAE,KAAKC,SAAS;AACtC,CAAC;AAED,OAAO,MAAMC,aAAa,GAAIH,GAAc,IAAK;EAC/C,SAAS;;EAAC,IAAAI,MAAA;EACV,IAAIL,iBAAiB,CAACC,GAAG,CAAC,EAAE;IAC1B,OAAO;MAAEK,CAAC,EAAE;QAAEC,CAAC,EAAEN,GAAG,CAACC,EAAE;QAAEM,CAAC,EAAEP,GAAG,CAACQ;MAAG,CAAC;MAAEC,CAAC,EAAET,GAAG,CAACS;IAAE,CAAC;EAClD;EACA,OAAO;IAAE,GAAGT,GAAG;IAAEK,CAAC,GAAAD,MAAA,GAAEJ,GAAG,CAACK,CAAC,cAAAD,MAAA,cAAAA,MAAA,GAAI;MAAEE,CAAC,EAAE,CAAC;MAAEC,CAAC,EAAE;IAAE;EAAE,CAAC;AAC/C,CAAC","ignoreList":[]}
|
@@ -38,8 +38,8 @@ export const processGradientProps = (Skia, {
|
|
38
38
|
processTransformProps(localMatrix, transform);
|
39
39
|
return {
|
40
40
|
colors: colors.map(color => processColor(Skia, color)),
|
41
|
-
positions: positions
|
42
|
-
mode: TileMode[enumKey(mode
|
41
|
+
positions: positions !== null && positions !== void 0 ? positions : null,
|
42
|
+
mode: TileMode[enumKey(mode !== null && mode !== void 0 ? mode : "clamp")],
|
43
43
|
flags,
|
44
44
|
localMatrix
|
45
45
|
};
|
@@ -56,7 +56,7 @@ export const getRect = (Skia, props) => {
|
|
56
56
|
if (props.rect) {
|
57
57
|
return props.rect;
|
58
58
|
} else if (width !== undefined && height !== undefined) {
|
59
|
-
return Skia.XYWHRect(x
|
59
|
+
return Skia.XYWHRect(x !== null && x !== void 0 ? x : 0, y !== null && y !== void 0 ? y : 0, width, height);
|
60
60
|
} else {
|
61
61
|
return undefined;
|
62
62
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["TileMode","enumKey","processTransformProps","transformOrigin","origin","transform","translateX","x","translateY","y","processColor","Skia","color","Color","Array","isArray","Float32Array","Error","processGradientProps","colors","positions","mode","flags","localMatrix","Matrix","map","getRect","props","width","height","rect","undefined","XYWHRect"],"sources":["Gradient.ts"],"sourcesContent":["import type { Skia, SkRect, Transforms3d, Vector } from \"../../../skia/types\";\nimport { TileMode } from \"../../../skia/types\";\nimport type { GradientProps, ImageShaderProps } from \"../../types\";\n\nimport { enumKey } from \"./Enum\";\nimport { processTransformProps } from \"./Transform\";\n\nexport const transformOrigin = (origin: Vector, transform: Transforms3d) => {\n \"worklet\";\n return [\n { translateX: origin.x },\n { translateY: origin.y },\n ...transform,\n { translateX: -origin.x },\n { translateY: -origin.y },\n ];\n};\n\nexport const processColor = (\n Skia: Skia,\n color: number | string | Float32Array | number[]\n) => {\n \"worklet\";\n if (typeof color === \"string\" || typeof color === \"number\") {\n return Skia.Color(color);\n } else if (Array.isArray(color) || color instanceof Float32Array) {\n return color instanceof Float32Array ? color : new Float32Array(color);\n } else {\n throw new Error(\n `Invalid color type: ${typeof color}. Expected number, string, or array.`\n );\n }\n};\n\nexport const processGradientProps = (\n Skia: Skia,\n { colors, positions, mode, flags, ...transform }: GradientProps\n) => {\n \"worklet\";\n const localMatrix = Skia.Matrix();\n processTransformProps(localMatrix, transform);\n return {\n colors: colors.map((color) => processColor(Skia, color)),\n positions: positions ?? null,\n mode: TileMode[enumKey(mode ?? \"clamp\")],\n flags,\n localMatrix,\n };\n};\n\nexport const getRect = (\n Skia: Skia,\n props: Omit<ImageShaderProps, \"tx\" | \"ty\" | \"fm\" | \"mm\" | \"fit\" | \"image\">\n): SkRect | undefined => {\n \"worklet\";\n const { x, y, width, height } = props;\n if (props.rect) {\n return props.rect;\n } else if (width !== undefined && height !== undefined) {\n return Skia.XYWHRect(x ?? 0, y ?? 0, width, height);\n } else {\n return undefined;\n }\n};\n"],"mappings":"AACA,SAASA,QAAQ,QAAQ,qBAAqB;AAG9C,SAASC,OAAO,QAAQ,QAAQ;AAChC,SAASC,qBAAqB,QAAQ,aAAa;AAEnD,OAAO,MAAMC,eAAe,GAAGA,CAACC,MAAc,EAAEC,SAAuB,KAAK;EAC1E,SAAS;;EACT,OAAO,CACL;IAAEC,UAAU,EAAEF,MAAM,CAACG;EAAE,CAAC,EACxB;IAAEC,UAAU,EAAEJ,MAAM,CAACK;EAAE,CAAC,EACxB,GAAGJ,SAAS,EACZ;IAAEC,UAAU,EAAE,CAACF,MAAM,CAACG;EAAE,CAAC,EACzB;IAAEC,UAAU,EAAE,CAACJ,MAAM,CAACK;EAAE,CAAC,CAC1B;AACH,CAAC;AAED,OAAO,MAAMC,YAAY,GAAGA,CAC1BC,IAAU,EACVC,KAAgD,KAC7C;EACH,SAAS;;EACT,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC1D,OAAOD,IAAI,CAACE,KAAK,CAACD,KAAK,CAAC;EAC1B,CAAC,MAAM,IAAIE,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,IAAIA,KAAK,YAAYI,YAAY,EAAE;IAChE,OAAOJ,KAAK,YAAYI,YAAY,GAAGJ,KAAK,GAAG,IAAII,YAAY,CAACJ,KAAK,CAAC;EACxE,CAAC,MAAM;IACL,MAAM,IAAIK,KAAK,CACb,uBAAuB,OAAOL,KAAK,sCACrC,CAAC;EACH;AACF,CAAC;AAED,OAAO,MAAMM,oBAAoB,GAAGA,CAClCP,IAAU,EACV;EAAEQ,MAAM;EAAEC,SAAS;EAAEC,IAAI;EAAEC,KAAK;EAAE,GAAGjB;AAAyB,CAAC,KAC5D;EACH,SAAS;;EACT,MAAMkB,WAAW,GAAGZ,IAAI,CAACa,MAAM,CAAC,CAAC;EACjCtB,qBAAqB,CAACqB,WAAW,EAAElB,SAAS,CAAC;EAC7C,OAAO;IACLc,MAAM,EAAEA,MAAM,CAACM,GAAG,CAAEb,KAAK,IAAKF,YAAY,CAACC,IAAI,EAAEC,KAAK,CAAC,CAAC;IACxDQ,SAAS,EAAEA,SAAS,
|
1
|
+
{"version":3,"names":["TileMode","enumKey","processTransformProps","transformOrigin","origin","transform","translateX","x","translateY","y","processColor","Skia","color","Color","Array","isArray","Float32Array","Error","processGradientProps","colors","positions","mode","flags","localMatrix","Matrix","map","getRect","props","width","height","rect","undefined","XYWHRect"],"sources":["Gradient.ts"],"sourcesContent":["import type { Skia, SkRect, Transforms3d, Vector } from \"../../../skia/types\";\nimport { TileMode } from \"../../../skia/types\";\nimport type { GradientProps, ImageShaderProps } from \"../../types\";\n\nimport { enumKey } from \"./Enum\";\nimport { processTransformProps } from \"./Transform\";\n\nexport const transformOrigin = (origin: Vector, transform: Transforms3d) => {\n \"worklet\";\n return [\n { translateX: origin.x },\n { translateY: origin.y },\n ...transform,\n { translateX: -origin.x },\n { translateY: -origin.y },\n ];\n};\n\nexport const processColor = (\n Skia: Skia,\n color: number | string | Float32Array | number[]\n) => {\n \"worklet\";\n if (typeof color === \"string\" || typeof color === \"number\") {\n return Skia.Color(color);\n } else if (Array.isArray(color) || color instanceof Float32Array) {\n return color instanceof Float32Array ? color : new Float32Array(color);\n } else {\n throw new Error(\n `Invalid color type: ${typeof color}. Expected number, string, or array.`\n );\n }\n};\n\nexport const processGradientProps = (\n Skia: Skia,\n { colors, positions, mode, flags, ...transform }: GradientProps\n) => {\n \"worklet\";\n const localMatrix = Skia.Matrix();\n processTransformProps(localMatrix, transform);\n return {\n colors: colors.map((color) => processColor(Skia, color)),\n positions: positions ?? null,\n mode: TileMode[enumKey(mode ?? \"clamp\")],\n flags,\n localMatrix,\n };\n};\n\nexport const getRect = (\n Skia: Skia,\n props: Omit<ImageShaderProps, \"tx\" | \"ty\" | \"fm\" | \"mm\" | \"fit\" | \"image\">\n): SkRect | undefined => {\n \"worklet\";\n const { x, y, width, height } = props;\n if (props.rect) {\n return props.rect;\n } else if (width !== undefined && height !== undefined) {\n return Skia.XYWHRect(x ?? 0, y ?? 0, width, height);\n } else {\n return undefined;\n }\n};\n"],"mappings":"AACA,SAASA,QAAQ,QAAQ,qBAAqB;AAG9C,SAASC,OAAO,QAAQ,QAAQ;AAChC,SAASC,qBAAqB,QAAQ,aAAa;AAEnD,OAA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A,SAAS,GAAI,IAAI;IAC5BC,IAAI,EAAErB,QAAQ,CAACC,OAAO,CAACoB,IAAI,aAAJA,IAAI,cAAJA,IAAI,GAAI,OAAO,CAAC,CAAC;IACxCC,KAAK;IACLC;EACF,CAAC;AACH,CAAC;AAED,OAAO,MAAMG,OAAO,GAAGA,CACrBf,IAAU,EACVgB,KAA0E,KACnD;EACvB,SAAS;;EACT,MAAM;IAAEpB,CAAC;IAAEE,CAAC;IAAEmB,KAAK;IAAEC;EAAO,CAAC,GAAGF,KAAK;EACrC,IAAIA,KAAK,CAACG,IAAI,EAAE;IACd,OAAOH,KAAK,CAACG,IAAI;EACnB,CAAC,MAAM,IAAIF,KAAK,KAAKG,SAAS,IAAIF,MAAM,KAAKE,SAAS,EAAE;IACtD,OAAOpB,IAAI,CAACqB,QAAQ,CAACzB,CAAC,aAADA,CAAC,cAADA,CAAC,GAAI,CAAC,EAAEE,CAAC,aAADA,CAAC,cAADA,CAAC,GAAI,CAAC,EAAEmB,KAAK,EAAEC,MAAM,CAAC;EACrD,CAAC,MAAM;IACL,OAAOE,SAAS;EAClB;AACF,CAAC","ignoreList":[]}
|
@@ -23,7 +23,8 @@ export const processRect = (Skia, def) => {
|
|
23
23
|
"worklet";
|
24
24
|
|
25
25
|
if (isRectCtor(def)) {
|
26
|
-
|
26
|
+
var _def$x, _def$y;
|
27
|
+
return Skia.XYWHRect((_def$x = def.x) !== null && _def$x !== void 0 ? _def$x : 0, (_def$y = def.y) !== null && _def$y !== void 0 ? _def$y : 0, def.width, def.height);
|
27
28
|
} else {
|
28
29
|
return def.rect;
|
29
30
|
}
|
@@ -32,8 +33,9 @@ export const processRRect = (Skia, def) => {
|
|
32
33
|
"worklet";
|
33
34
|
|
34
35
|
if (isRRectCtor(def)) {
|
35
|
-
|
36
|
-
|
36
|
+
var _def$r, _def$x2, _def$y2;
|
37
|
+
const r = processRadius(Skia, (_def$r = def.r) !== null && _def$r !== void 0 ? _def$r : 0);
|
38
|
+
return Skia.RRectXY(Skia.XYWHRect((_def$x2 = def.x) !== null && _def$x2 !== void 0 ? _def$x2 : 0, (_def$y2 = def.y) !== null && _def$y2 !== void 0 ? _def$y2 : 0, def.width, def.height), r.x, r.y);
|
37
39
|
} else {
|
38
40
|
return def.rect;
|
39
41
|
}
|