@shopify/react-native-skia 2.0.0-next.2 → 2.0.0-next.4
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/build.gradle +14 -10
- package/cpp/api/JsiSkCanvas.h +45 -2
- package/cpp/api/recorder/Drawings.h +31 -2
- package/cpp/api/recorder/Shaders.h +40 -0
- package/cpp/skia/include/codec/SkCodec.h +39 -1
- package/cpp/skia/include/config/SkUserConfig.h +1 -10
- package/cpp/skia/include/core/SkCanvas.h +8 -4
- package/cpp/skia/include/core/SkContourMeasure.h +2 -2
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPaint.h +8 -5
- package/cpp/skia/include/core/SkStream.h +8 -3
- package/cpp/skia/include/core/SkTextBlob.h +9 -9
- package/cpp/skia/include/core/SkTypeface.h +4 -6
- package/cpp/skia/include/core/SkTypes.h +5 -0
- package/cpp/skia/include/docs/SkPDFDocument.h +47 -2
- package/cpp/skia/include/docs/SkPDFJpegHelpers.h +41 -0
- package/cpp/skia/include/effects/SkRuntimeEffect.h +5 -1
- package/cpp/skia/include/effects/SkTableMaskFilter.h +4 -0
- package/cpp/skia/include/gpu/graphite/BackendTexture.h +0 -2
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +17 -0
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +21 -18
- package/cpp/skia/include/gpu/graphite/PrecompileContext.h +24 -0
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +87 -42
- package/cpp/skia/include/gpu/graphite/YUVABackendTextures.h +13 -4
- package/cpp/skia/include/gpu/graphite/dawn/DawnBackendContext.h +9 -0
- package/cpp/skia/include/gpu/graphite/dawn/DawnGraphiteTypes.h +166 -0
- package/cpp/skia/include/gpu/graphite/dawn/DawnTypes.h +3 -141
- package/cpp/skia/include/gpu/graphite/dawn/DawnUtils.h +2 -21
- package/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h +4 -0
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +30 -6
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypesUtils.h +4 -42
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes_cpp.h +50 -0
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteUtils.h +2 -20
- package/cpp/skia/include/gpu/graphite/precompile/Precompile.h +14 -4
- package/cpp/skia/include/gpu/graphite/precompile/PrecompileShader.h +14 -6
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteContext.h +31 -0
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +36 -14
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteUtils.h +3 -21
- package/cpp/skia/include/ports/SkTypeface_fontations.h +3 -0
- package/cpp/skia/include/private/SkJpegMetadataDecoder.h +7 -0
- package/cpp/skia/include/private/base/SkAnySubclass.h +6 -0
- package/cpp/skia/include/private/chromium/SkPMColor.h +38 -0
- package/cpp/skia/modules/skparagraph/include/Paragraph.h +2 -2
- package/cpp/skia/modules/skunicode/include/SkUnicode.h +10 -6
- package/cpp/skia/modules/svg/include/SkSVGDOM.h +1 -3
- package/cpp/skia/src/base/SkTInternalLList.h +1 -1
- package/cpp/skia/src/core/SkLRUCache.h +6 -3
- package/lib/commonjs/external/reanimated/textures.d.ts +2 -4
- package/lib/commonjs/external/reanimated/textures.js +8 -15
- package/lib/commonjs/external/reanimated/textures.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.d.ts +1 -2
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/sksg/HostConfig.js +2 -1
- package/lib/commonjs/sksg/HostConfig.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Player.d.ts +1 -1
- package/lib/commonjs/sksg/Recorder/Player.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/commands/Box.js +2 -2
- package/lib/commonjs/sksg/Recorder/commands/Box.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/commands/Drawing.d.ts +1 -3
- package/lib/commonjs/sksg/Recorder/commands/Drawing.js +1 -58
- package/lib/commonjs/sksg/Recorder/commands/Drawing.js.map +1 -1
- package/lib/module/external/reanimated/textures.d.ts +2 -4
- package/lib/module/external/reanimated/textures.js +7 -12
- package/lib/module/external/reanimated/textures.js.map +1 -1
- package/lib/module/renderer/Canvas.d.ts +1 -2
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/sksg/HostConfig.js +2 -1
- package/lib/module/sksg/HostConfig.js.map +1 -1
- package/lib/module/sksg/Recorder/Player.d.ts +1 -1
- package/lib/module/sksg/Recorder/Player.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/Box.js +2 -2
- package/lib/module/sksg/Recorder/commands/Box.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/Drawing.d.ts +1 -3
- package/lib/module/sksg/Recorder/commands/Drawing.js +2 -58
- package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -1
- package/lib/typescript/lib/commonjs/external/reanimated/textures.d.ts +1 -3
- package/lib/typescript/lib/commonjs/sksg/HostConfig.d.ts +1 -1
- package/lib/typescript/lib/commonjs/sksg/Recorder/commands/Drawing.d.ts +0 -1
- package/lib/typescript/lib/module/external/reanimated/textures.d.ts +1 -3
- package/lib/typescript/lib/module/sksg/HostConfig.d.ts +1 -1
- package/lib/typescript/lib/module/sksg/Recorder/commands/Drawing.d.ts +0 -1
- package/lib/typescript/src/external/reanimated/textures.d.ts +2 -4
- package/lib/typescript/src/renderer/Canvas.d.ts +1 -2
- package/lib/typescript/src/sksg/Recorder/Player.d.ts +1 -1
- package/lib/typescript/src/sksg/Recorder/commands/Drawing.d.ts +1 -3
- 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/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/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/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/libskia.xcframework/Info.plist +15 -15
- 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 +7 -7
- 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 +13 -13
- 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 +14 -14
- 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 +12 -12
- package/libs/apple/libskunicode_core.xcframework/ios-arm64_arm64e/libskunicode_core.a +0 -0
- 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/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 +15 -15
- 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 +8 -8
- 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 +3 -3
- package/src/__tests__/snapshots/box/box-shadow-opacity.png +0 -0
- package/src/__tests__/snapshots/platform-buffer.png +0 -0
- package/src/__tests__/snapshots/screens/snapshot2-android-ci.png +0 -0
- package/src/external/reanimated/textures.tsx +12 -20
- package/src/renderer/Canvas.tsx +1 -1
- package/src/renderer/__tests__/e2e/Box.spec.tsx +22 -0
- package/src/renderer/__tests__/e2e/NativeBuffer.spec.tsx +2 -0
- package/src/sksg/HostConfig.ts +2 -1
- package/src/sksg/Recorder/Player.ts +1 -1
- package/src/sksg/Recorder/commands/Box.ts +2 -2
- package/src/sksg/Recorder/commands/Drawing.ts +0 -65
- package/cpp/skia/include/core/SkColorPriv.h +0 -165
- package/cpp/skia/include/private/SkColorData.h +0 -385
@@ -0,0 +1,38 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2025 Google LLC
|
3
|
+
*
|
4
|
+
* Use of this source code is governed by a BSD-style license that can be
|
5
|
+
* found in the LICENSE file.
|
6
|
+
*/
|
7
|
+
|
8
|
+
#ifndef SkPMColor_DEFINED
|
9
|
+
#define SkPMColor_DEFINED
|
10
|
+
|
11
|
+
#include "include/core/SkColor.h"
|
12
|
+
#include "include/private/base/SkAPI.h"
|
13
|
+
|
14
|
+
#include <cstdint>
|
15
|
+
|
16
|
+
/** Returns a SkPMColor value from already premultiplied 8-bit component values.
|
17
|
+
|
18
|
+
@param a amount of alpha, from fully transparent (0) to fully opaque (255)
|
19
|
+
@param r amount of red, from no red (0) to full red (255)
|
20
|
+
@param g amount of green, from no green (0) to full green (255)
|
21
|
+
@param b amount of blue, from no blue (0) to full blue (255)
|
22
|
+
@return premultiplied color
|
23
|
+
*/
|
24
|
+
SK_API SkPMColor SkPMColorSetARGB(SkAlpha a, uint8_t r, uint8_t g, uint8_t b);
|
25
|
+
|
26
|
+
/** Returns alpha component of premultiplied color. */
|
27
|
+
SK_API SkAlpha SkPMColorGetA(SkPMColor);
|
28
|
+
|
29
|
+
/** Returns red component of premultiplied color. */
|
30
|
+
SK_API uint8_t SkPMColorGetR(SkPMColor);
|
31
|
+
|
32
|
+
/** Returns green component of premultiplied color. */
|
33
|
+
SK_API uint8_t SkPMColorGetG(SkPMColor);
|
34
|
+
|
35
|
+
/** Returns blue component of premultiplied color. */
|
36
|
+
SK_API uint8_t SkPMColorGetB(SkPMColor);
|
37
|
+
|
38
|
+
#endif
|
@@ -88,7 +88,7 @@ public:
|
|
88
88
|
SkPoint origin;
|
89
89
|
SkScalar advanceX;
|
90
90
|
int count;
|
91
|
-
const
|
91
|
+
const SkGlyphID* glyphs; // count values
|
92
92
|
const SkPoint* positions; // count values
|
93
93
|
const uint32_t* utf8Starts; // count+1 values
|
94
94
|
unsigned flags;
|
@@ -103,7 +103,7 @@ public:
|
|
103
103
|
SkPoint origin;
|
104
104
|
SkSize advance;
|
105
105
|
int count;
|
106
|
-
const
|
106
|
+
const SkGlyphID* glyphs; // count values
|
107
107
|
SkPoint* positions; // count values
|
108
108
|
const SkRect* bounds; // count values
|
109
109
|
const uint32_t* utf8Starts; // count+1 values
|
@@ -271,18 +271,22 @@ class SKUNICODE_API SkUnicode : public SkRefCnt {
|
|
271
271
|
|
272
272
|
SkBidiIterator::Position pos16 = 0;
|
273
273
|
while (pos16 <= iter->getLength()) {
|
274
|
-
|
275
|
-
|
274
|
+
uint16_t nextPos16 = start16 - utf16;
|
275
|
+
auto level = iter->getLevelAt(nextPos16);
|
276
|
+
if (nextPos16 == 0) {
|
276
277
|
currentLevel = level;
|
277
278
|
} else if (level != currentLevel) {
|
278
|
-
callback(pos16,
|
279
|
+
callback(pos16, nextPos16, currentLevel);
|
279
280
|
currentLevel = level;
|
281
|
+
pos16 = nextPos16;
|
280
282
|
}
|
281
283
|
if (start16 == end16) {
|
282
|
-
|
284
|
+
if (pos16 != nextPos16) {
|
285
|
+
callback(pos16, nextPos16, currentLevel);
|
286
|
+
}
|
287
|
+
return;
|
283
288
|
}
|
284
|
-
|
285
|
-
pos16 += SkUTF::ToUTF16(u);
|
289
|
+
SkUTF::NextUTF16(&start16, end16);
|
286
290
|
}
|
287
291
|
}
|
288
292
|
|
@@ -53,9 +53,7 @@ public:
|
|
53
53
|
sk_sp<SkShapers::Factory> fTextShapingFactory;
|
54
54
|
};
|
55
55
|
|
56
|
-
static sk_sp<SkSVGDOM> MakeFromStream(SkStream& str)
|
57
|
-
return Builder().make(str);
|
58
|
-
}
|
56
|
+
static sk_sp<SkSVGDOM> MakeFromStream(SkStream& str);
|
59
57
|
|
60
58
|
/**
|
61
59
|
* Returns the root (outermost) SVG element.
|
@@ -238,7 +238,7 @@ public:
|
|
238
238
|
/**
|
239
239
|
* C++11 range-for interface.
|
240
240
|
*/
|
241
|
-
bool operator!=(const Iter& that) { return fCurr != that.fCurr; }
|
241
|
+
bool operator!=(const Iter& that) const { return fCurr != that.fCurr; }
|
242
242
|
T* operator*() { return this->get(); }
|
243
243
|
void operator++() { this->next(); }
|
244
244
|
|
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
struct SkNoOpPurge {
|
16
16
|
template <typename K, typename V>
|
17
|
-
void operator()(const K& /* k */, const V* /* v */) const {}
|
17
|
+
void operator()(void* /* context */, const K& /* k */, const V* /* v */) const {}
|
18
18
|
};
|
19
19
|
|
20
20
|
/**
|
@@ -35,7 +35,9 @@ private:
|
|
35
35
|
};
|
36
36
|
|
37
37
|
public:
|
38
|
-
explicit SkLRUCache(int maxCount
|
38
|
+
explicit SkLRUCache(int maxCount, void* context = nullptr)
|
39
|
+
: fMaxCount(maxCount)
|
40
|
+
, fContext(context) {}
|
39
41
|
SkLRUCache() = delete;
|
40
42
|
|
41
43
|
~SkLRUCache() {
|
@@ -111,7 +113,7 @@ public:
|
|
111
113
|
SkASSERT(value);
|
112
114
|
Entry* entry = *value;
|
113
115
|
SkASSERT(key == entry->fKey);
|
114
|
-
PurgeCB()(key, &entry->fValue);
|
116
|
+
PurgeCB()(fContext, key, &entry->fValue);
|
115
117
|
fMap.remove(key);
|
116
118
|
fLRU.remove(entry);
|
117
119
|
delete entry;
|
@@ -131,6 +133,7 @@ private:
|
|
131
133
|
int fMaxCount;
|
132
134
|
skia_private::THashTable<Entry*, K, Traits> fMap;
|
133
135
|
SkTInternalLList<Entry> fLRU;
|
136
|
+
void* fContext;
|
134
137
|
};
|
135
138
|
|
136
139
|
#endif
|
@@ -1,8 +1,6 @@
|
|
1
|
-
import type { ReactElement } from "react";
|
1
|
+
import type { DependencyList, ReactElement } from "react";
|
2
2
|
import type { SharedValue } from "react-native-reanimated";
|
3
3
|
import type { DataSourceParam, SkImage, SkPicture, SkSize } from "../../skia/types";
|
4
|
-
export declare const useTexture: (element: ReactElement, size: SkSize) => SharedValue<SkImage | null>;
|
5
|
-
export declare const useTextureAsValue: (element: ReactElement, size: SkSize) => SharedValue<SkImage | null>;
|
6
|
-
export declare const useTextureValueFromPicture: (picture: SkPicture | null, size: SkSize) => SharedValue<SkImage | null>;
|
4
|
+
export declare const useTexture: (element: ReactElement, size: SkSize, deps?: DependencyList) => SharedValue<SkImage | null>;
|
7
5
|
export declare const usePictureAsTexture: (picture: SkPicture | null, size: SkSize) => SharedValue<SkImage | null>;
|
8
6
|
export declare const useImageAsTexture: (source: DataSourceParam) => SharedValue<SkImage | null>;
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.useTexture = exports.usePictureAsTexture = exports.useImageAsTexture = void 0;
|
7
7
|
var _react = require("react");
|
8
8
|
var _Offscreen = require("../../renderer/Offscreen");
|
9
9
|
var _skia = require("../../skia");
|
@@ -14,7 +14,7 @@ const createTexture = (texture, picture, size) => {
|
|
14
14
|
|
15
15
|
texture.value = (0, _Offscreen.drawAsImageFromPicture)(picture, size);
|
16
16
|
};
|
17
|
-
const useTexture = (element, size) => {
|
17
|
+
const useTexture = (element, size, deps) => {
|
18
18
|
const {
|
19
19
|
width,
|
20
20
|
height
|
@@ -26,28 +26,21 @@ const useTexture = (element, size) => {
|
|
26
26
|
y: 0,
|
27
27
|
width,
|
28
28
|
height
|
29
|
-
}).then(pic =>
|
30
|
-
|
29
|
+
}).then(pic => {
|
30
|
+
setPicture(pic);
|
31
|
+
});
|
32
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
33
|
+
}, deps !== null && deps !== void 0 ? deps : []);
|
31
34
|
return usePictureAsTexture(picture, size);
|
32
35
|
};
|
33
36
|
exports.useTexture = useTexture;
|
34
|
-
const useTextureAsValue = (element, size) => {
|
35
|
-
console.warn("useTextureAsValue has been renamed to use useTexture");
|
36
|
-
return useTexture(element, size);
|
37
|
-
};
|
38
|
-
exports.useTextureAsValue = useTextureAsValue;
|
39
|
-
const useTextureValueFromPicture = (picture, size) => {
|
40
|
-
console.warn("useTextureValueFromPicture has been renamed to use usePictureAsTexture");
|
41
|
-
return usePictureAsTexture(picture, size);
|
42
|
-
};
|
43
|
-
exports.useTextureValueFromPicture = useTextureValueFromPicture;
|
44
37
|
const usePictureAsTexture = (picture, size) => {
|
45
38
|
const texture = _ReanimatedProxy.default.useSharedValue(null);
|
46
39
|
(0, _react.useEffect)(() => {
|
47
40
|
if (picture !== null) {
|
48
41
|
_ReanimatedProxy.default.runOnUI(createTexture)(texture, picture, size);
|
49
42
|
}
|
50
|
-
}, [
|
43
|
+
}, [picture, size, texture]);
|
51
44
|
return texture;
|
52
45
|
};
|
53
46
|
exports.usePictureAsTexture = usePictureAsTexture;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","require","_Offscreen","_skia","_ReanimatedProxy","_interopRequireDefault","e","__esModule","default","createTexture","texture","picture","size","value","drawAsImageFromPicture","useTexture","element","width","height","setPicture","useState","useEffect","drawAsPicture","x","y","then","pic","usePictureAsTexture","exports","
|
1
|
+
{"version":3,"names":["_react","require","_Offscreen","_skia","_ReanimatedProxy","_interopRequireDefault","e","__esModule","default","createTexture","texture","picture","size","value","drawAsImageFromPicture","useTexture","element","deps","width","height","setPicture","useState","useEffect","drawAsPicture","x","y","then","pic","usePictureAsTexture","exports","Rea","useSharedValue","runOnUI","useImageAsTexture","source","image","useImage","useMemo","recorder","Skia","PictureRecorder","canvas","beginRecording","drawImage","finishRecordingAsPicture"],"sources":["textures.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from \"react\";\nimport type { DependencyList, ReactElement } from \"react\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nimport type {\n DataSourceParam,\n SkImage,\n SkPicture,\n SkSize,\n} from \"../../skia/types\";\nimport {\n drawAsImageFromPicture,\n drawAsPicture,\n} from \"../../renderer/Offscreen\";\nimport { Skia, useImage } from \"../../skia\";\n\nimport Rea from \"./ReanimatedProxy\";\n\nconst createTexture = (\n texture: SharedValue<SkImage | null>,\n picture: SkPicture,\n size: SkSize\n) => {\n \"worklet\";\n texture.value = drawAsImageFromPicture(picture, size);\n};\n\nexport const useTexture = (\n element: ReactElement,\n size: SkSize,\n deps?: DependencyList\n) => {\n const { width, height } = size;\n const [picture, setPicture] = useState<SkPicture | null>(null);\n useEffect(() => {\n drawAsPicture(element, {\n x: 0,\n y: 0,\n width,\n height,\n }).then((pic) => {\n setPicture(pic);\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps ?? []);\n return usePictureAsTexture(picture, size);\n};\n\nexport const usePictureAsTexture = (\n picture: SkPicture | null,\n size: SkSize\n) => {\n const texture = Rea.useSharedValue<SkImage | null>(null);\n useEffect(() => {\n if (picture !== null) {\n Rea.runOnUI(createTexture)(texture, picture, size);\n }\n }, [picture, size, texture]);\n return texture;\n};\n\nexport const useImageAsTexture = (source: DataSourceParam) => {\n const image = useImage(source);\n const size = useMemo(() => {\n if (image) {\n return { width: image.width(), height: image.height() };\n }\n return { width: 0, height: 0 };\n }, [image]);\n const picture = useMemo(() => {\n if (image) {\n const recorder = Skia.PictureRecorder();\n const canvas = recorder.beginRecording({\n x: 0,\n y: 0,\n width: size.width,\n height: size.height,\n });\n canvas.drawImage(image, 0, 0);\n return recorder.finishRecordingAsPicture();\n } else {\n return null;\n }\n }, [size, image]);\n return usePictureAsTexture(picture, size);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAUA,IAAAC,UAAA,GAAAD,OAAA;AAIA,IAAAE,KAAA,GAAAF,OAAA;AAEA,IAAAG,gBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAAoC,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ViewProps } from "react-native";
|
4
4
|
import type { SharedValue } from "react-native-reanimated";
|
5
5
|
import type { SkImage, SkRect, SkSize } from "../skia/types";
|
6
|
-
interface CanvasRef extends FC<CanvasProps> {
|
6
|
+
export interface CanvasRef extends FC<CanvasProps> {
|
7
7
|
makeImageSnapshot(rect?: SkRect): SkImage;
|
8
8
|
makeImageSnapshotAsync(rect?: SkRect): Promise<SkImage>;
|
9
9
|
redraw(): void;
|
@@ -17,4 +17,3 @@ export interface CanvasProps extends ViewProps {
|
|
17
17
|
ref?: React.Ref<CanvasRef>;
|
18
18
|
}
|
19
19
|
export declare const Canvas: ({ debug, opaque, children, onSize, onLayout: _onLayout, ref, ...viewProps }: CanvasProps) => React.JSX.Element;
|
20
|
-
export {};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_SkiaViewNativeId","_SkiaPictureViewNativeComponent","_interopRequireDefault","_Reconciler","_skia","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","useCanvasRef","useRef","exports","useOnSizeEvent","resultValue","onLayout","useCallback","event","width","height","nativeEvent","layout","value","Canvas","debug","opaque","children","onSize","_onLayout","ref","viewProps","nativeId","useMemo","SkiaViewNativeId","current","root","SkiaSGRoot","Skia","useLayoutEffect","render","useEffect","unmount","useImperativeHandle","makeImageSnapshot","rect","SkiaViewApi","makeImageSnapshotAsync","redraw","requestRedraw","getNativeId","createElement","collapsable","nativeID"],"sources":["Canvas.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport React, {\n useCallback,\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport type { LayoutChangeEvent, ViewProps } from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nimport { SkiaViewNativeId } from \"../views/SkiaViewNativeId\";\nimport SkiaPictureViewNativeComponent from \"../specs/SkiaPictureViewNativeComponent\";\nimport type { SkImage, SkRect, SkSize } from \"../skia/types\";\nimport { SkiaSGRoot } from \"../sksg/Reconciler\";\nimport { Skia } from \"../skia\";\nimport type { SkiaBaseViewProps } from \"../views\";\n\
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_SkiaViewNativeId","_SkiaPictureViewNativeComponent","_interopRequireDefault","_Reconciler","_skia","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","useCanvasRef","useRef","exports","useOnSizeEvent","resultValue","onLayout","useCallback","event","width","height","nativeEvent","layout","value","Canvas","debug","opaque","children","onSize","_onLayout","ref","viewProps","nativeId","useMemo","SkiaViewNativeId","current","root","SkiaSGRoot","Skia","useLayoutEffect","render","useEffect","unmount","useImperativeHandle","makeImageSnapshot","rect","SkiaViewApi","makeImageSnapshotAsync","redraw","requestRedraw","getNativeId","createElement","collapsable","nativeID"],"sources":["Canvas.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport React, {\n useCallback,\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport type { LayoutChangeEvent, ViewProps } from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nimport { SkiaViewNativeId } from \"../views/SkiaViewNativeId\";\nimport SkiaPictureViewNativeComponent from \"../specs/SkiaPictureViewNativeComponent\";\nimport type { SkImage, SkRect, SkSize } from \"../skia/types\";\nimport { SkiaSGRoot } from \"../sksg/Reconciler\";\nimport { Skia } from \"../skia\";\nimport type { SkiaBaseViewProps } from \"../views\";\n\nexport interface CanvasRef extends FC<CanvasProps> {\n makeImageSnapshot(rect?: SkRect): SkImage;\n makeImageSnapshotAsync(rect?: SkRect): Promise<SkImage>;\n redraw(): void;\n getNativeId(): number;\n}\n\nexport const useCanvasRef = () => useRef<CanvasRef>(null);\n\n//const NativeSkiaPictureView = SkiaPictureViewNativeComponent;\n\n// TODO: no need to go through the JS thread for this\nconst useOnSizeEvent = (\n resultValue: SkiaBaseViewProps[\"onSize\"],\n onLayout?: (event: LayoutChangeEvent) => void\n) => {\n return useCallback(\n (event: LayoutChangeEvent) => {\n if (onLayout) {\n onLayout(event);\n }\n const { width, height } = event.nativeEvent.layout;\n\n if (resultValue) {\n resultValue.value = { width, height };\n }\n },\n [onLayout, resultValue]\n );\n};\n\nexport interface CanvasProps extends ViewProps {\n debug?: boolean;\n opaque?: boolean;\n onSize?: SharedValue<SkSize>;\n ref?: React.Ref<CanvasRef>;\n}\n\nexport const Canvas = ({\n debug,\n opaque,\n children,\n onSize,\n onLayout: _onLayout,\n ref,\n ...viewProps\n}: CanvasProps) => {\n const onLayout = useOnSizeEvent(onSize, _onLayout);\n // Native ID\n const nativeId = useMemo(() => {\n return SkiaViewNativeId.current++;\n }, []);\n\n // Root\n const root = useMemo(() => new SkiaSGRoot(Skia, nativeId), [nativeId]);\n\n // Render effects\n useLayoutEffect(() => {\n root.render(children);\n }, [children, root]);\n\n useEffect(() => {\n return () => {\n root.unmount();\n };\n }, [root]);\n\n // Component methods\n useImperativeHandle(\n ref,\n () =>\n ({\n makeImageSnapshot: (rect?: SkRect) => {\n return SkiaViewApi.makeImageSnapshot(nativeId, rect);\n },\n makeImageSnapshotAsync: (rect?: SkRect) => {\n return SkiaViewApi.makeImageSnapshotAsync(nativeId, rect);\n },\n redraw: () => {\n SkiaViewApi.requestRedraw(nativeId);\n },\n getNativeId: () => {\n return nativeId;\n },\n } as CanvasRef)\n );\n return (\n <SkiaPictureViewNativeComponent\n collapsable={false}\n nativeID={`${nativeId}`}\n debug={debug}\n opaque={opaque}\n onLayout={onLayout}\n {...viewProps}\n />\n );\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAWA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,+BAAA,G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AAClB,OAAA,CAAAW,MAAA,GAAAA,MAAA","ignoreList":[]}
|
@@ -75,8 +75,9 @@ const sksgHostConfig = exports.sksgHostConfig = {
|
|
75
75
|
debug("prepareForCommit");
|
76
76
|
return null;
|
77
77
|
},
|
78
|
-
resetAfterCommit(
|
78
|
+
resetAfterCommit(container) {
|
79
79
|
debug("resetAfterCommit");
|
80
|
+
container.redraw();
|
80
81
|
},
|
81
82
|
getPublicInstance(node) {
|
82
83
|
debug("getPublicInstance");
|
@@ -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,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AC;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":["_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","container","redraw","getPublicInstance","node","commitTextUpdate","_textInstance","_oldText","_newText","clearContainer","prepareUpdate","_instance","oldProps","newProps","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: 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 _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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eAAe,EAAE;MAC7C,OAAOO,qBAAqB;IAC9B;IACA,OAAOqE,+BAAoB;EAC7B,CAAC;EACD0B,iBAAiBA,CAAA,EAAG,CAAC;AACvB,CAAC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_Drawing","require","_Box","_ColorFilters","_CTM","_ImageFilters","_Paint","_PathEffects","_Shaders","_Core","play","ctx","_command","isGroup","children","forEach","child","command","materializeCommand","isCommand","CommandType","SaveBackdropFilter","saveBackdropFilter","SaveLayer","materializePaint","paint","paintDeclarations","pop","canvas","saveLayer","isDrawCommand","SavePaint","props","paints","push","savePaint","setPaintProperties","Skia","RestorePaint","restorePaint","ComposeColorFilter","composeColorFilters","RestorePaintDeclaration","Error","MaterializePaint","isPushColorFilter","pushColorFilter","isPushShader","pushShader","isPushImageFilter","pushImageFilter","isPushPathEffect","pushPathEffect","ComposePathEffect","composePathEffects","ComposeImageFilter","composeImageFilters","PushBlurMaskFilter","setBlurMaskFilter","SaveCTM","saveCTM","RestoreCTM","restore","p","isBoxCommand","drawBox","DrawPaint","drawPaint","DrawImage","drawImage","DrawCircle","drawCircle","DrawPoints","drawPoints","DrawPath","drawPath","DrawRect","drawRect","DrawRRect","drawRRect","DrawOval","drawOval","DrawLine","drawLine","DrawPatch","drawPatch","DrawVertices","drawVertices","DrawDiffRect","drawDiffRect","DrawText","drawText","DrawTextPath","drawTextPath","DrawTextBlob","drawTextBlob","DrawGlyphs","drawGlyphs","DrawPicture","drawPicture","DrawImageSVG","drawImageSVG","DrawParagraph","drawParagraph","DrawAtlas","drawAtlas","console","warn","type","replay","commands","exports"],"sources":["Player.ts"],"sourcesContent":["import {\n drawCircle,\n drawImage,\n drawOval,\n drawPath,\n drawPoints,\n drawRect,\n drawRRect,\n drawLine,\n drawAtlas,\n drawParagraph,\n drawImageSVG,\n drawPicture,\n drawGlyphs,\n drawTextBlob,\n drawTextPath,\n drawText,\n drawDiffRect,\n drawVertices,\n drawPatch,\n} from \"./commands/Drawing\";\nimport { drawBox, isBoxCommand } from \"./commands/Box\";\nimport {\n composeColorFilters,\n isPushColorFilter,\n pushColorFilter,\n} from \"./commands/ColorFilters\";\nimport { saveCTM } from \"./commands/CTM\";\nimport {\n setBlurMaskFilter,\n isPushImageFilter,\n pushImageFilter,\n composeImageFilters,\n} from \"./commands/ImageFilters\";\nimport { setPaintProperties } from \"./commands/Paint\";\nimport {\n composePathEffects,\n isPushPathEffect,\n pushPathEffect,\n} from \"./commands/PathEffects\";\nimport { isPushShader, pushShader } from \"./commands/Shaders\";\nimport {\n CommandType,\n isCommand,\n isDrawCommand,\n isGroup,\n materializeCommand,\n type Command,\n} from \"./Core\";\nimport type { DrawingContext } from \"./DrawingContext\";\n\nfunction play(ctx: DrawingContext, _command: Command) {\n \"worklet\";\n if (isGroup(_command)) {\n _command.children.forEach((child) => play(ctx, child));\n return;\n }\n const command = materializeCommand(_command);\n if (isCommand(command, CommandType.SaveBackdropFilter)) {\n ctx.saveBackdropFilter();\n } else if (isCommand(command, CommandType.SaveLayer)) {\n ctx.materializePaint();\n const paint = ctx.paintDeclarations.pop();\n ctx.canvas.saveLayer(paint);\n } else if (isDrawCommand(command, CommandType.SavePaint)) {\n if (command.props.paint) {\n ctx.paints.push(command.props.paint);\n } else {\n ctx.savePaint();\n setPaintProperties(ctx.Skia, ctx.paint, command.props);\n }\n } else if (isCommand(command, CommandType.RestorePaint)) {\n ctx.restorePaint();\n } else if (isCommand(command, CommandType.ComposeColorFilter)) {\n composeColorFilters(ctx);\n } else if (isCommand(command, CommandType.RestorePaintDeclaration)) {\n ctx.materializePaint();\n const paint = ctx.restorePaint();\n if (!paint) {\n throw new Error(\"No paint declaration to push\");\n }\n ctx.paintDeclarations.push(paint);\n } else if (isCommand(command, CommandType.MaterializePaint)) {\n ctx.materializePaint();\n } else if (isPushColorFilter(command)) {\n pushColorFilter(ctx, command);\n } else if (isPushShader(command)) {\n pushShader(ctx, command);\n } else if (isPushImageFilter(command)) {\n pushImageFilter(ctx, command);\n } else if (isPushPathEffect(command)) {\n pushPathEffect(ctx, command);\n } else if (isCommand(command, CommandType.ComposePathEffect)) {\n composePathEffects(ctx);\n } else if (isCommand(command, CommandType.ComposeImageFilter)) {\n composeImageFilters(ctx);\n } else if (isDrawCommand(command, CommandType.PushBlurMaskFilter)) {\n setBlurMaskFilter(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.SaveCTM)) {\n saveCTM(ctx, command.props);\n } else if (isCommand(command, CommandType.RestoreCTM)) {\n ctx.canvas.restore();\n } else {\n const paints = [ctx.paint, ...ctx.paintDeclarations];\n ctx.paintDeclarations = [];\n paints.forEach((p) => {\n ctx.paints.push(p);\n if (isBoxCommand(command)) {\n drawBox(ctx, command);\n } else if (isCommand(command, CommandType.DrawPaint)) {\n ctx.canvas.drawPaint(ctx.paint);\n } else if (isDrawCommand(command, CommandType.DrawImage)) {\n drawImage(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawCircle)) {\n drawCircle(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPoints)) {\n drawPoints(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPath)) {\n drawPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRect)) {\n drawRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRRect)) {\n drawRRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawOval)) {\n drawOval(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawLine)) {\n drawLine(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPatch)) {\n drawPatch(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawVertices)) {\n drawVertices(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawDiffRect)) {\n drawDiffRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawText)) {\n drawText(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextPath)) {\n drawTextPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextBlob)) {\n drawTextBlob(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawGlyphs)) {\n drawGlyphs(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPicture)) {\n drawPicture(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawImageSVG)) {\n drawImageSVG(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawParagraph)) {\n drawParagraph(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawAtlas)) {\n drawAtlas(ctx, command.props);\n } else {\n console.warn(`Unknown command: ${command.type}`);\n }\n ctx.paints.pop();\n });\n }\n}\n\nexport const replay = (ctx: DrawingContext, commands: Command[]) => {\n \"worklet\";\n commands.forEach((command) => {\n play(ctx, command);\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAqBA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAKA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAMA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAKA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AAUA,SAASS,IAAIA,CAACC,GAAmB,EAAEC,QAAiB,EAAE;EACpD,SAAS;;EACT,IAAI,IAAAC,aAAO,EAACD,QAAQ,CAAC,EAAE;IACrBA,QAAQ,CAACE,QAAQ,CAACC,OAAO,CAAEC,KAAK,IAAKN,IAAI,CAACC,GAAG,EAAEK,KAAK,CAAC,CAAC;IACtD;EACF;EACA,MAAMC,OAAO,GAAG,IAAAC,wBAAkB,EAACN,QAAQ,CAAC;EAC5C,IAAI,IAAAO,eAAS,EAACF,OAAO,EAAEG,iBAAW,CAACC,kBAAkB,CAAC,EAAE;IACtDV,GAAG,CAACW,kBAAkB,CAAC,CAAC;EAC1B,CAAC,MAAM,IAAI,IAA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F,IAAI,EAAE,CAAC;MAClD;MACAjG,GAAG,CAACsB,MAAM,CAACN,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC;EACJ;AACF;AAEO,MAAMkF,MAAM,GAAGA,CAAClG,GAAmB,EAAEmG,QAAmB,KAAK;EAClE,SAAS;;EACTA,QAAQ,CAAC/F,OAAO,CAAEE,OAAO,IAAK;IAC5BP,IAAI,CAACC,GAAG,EAAEM,OAAO,CAAC;EACpB,CAAC,CAAC;AACJ,CAAC;AAAC8F,OAAA,CAAAF,MAAA,GAAAA,MAAA","ignoreList":[]}
|
1
|
+
{"version":3,"names":["_Drawing","require","_Box","_ColorFilters","_CTM","_ImageFilters","_Paint","_PathEffects","_Shaders","_Core","play","ctx","_command","isGroup","children","forEach","child","command","materializeCommand","isCommand","CommandType","SaveBackdropFilter","saveBackdropFilter","SaveLayer","materializePaint","paint","paintDeclarations","pop","canvas","saveLayer","isDrawCommand","SavePaint","props","paints","push","savePaint","setPaintProperties","Skia","RestorePaint","restorePaint","ComposeColorFilter","composeColorFilters","RestorePaintDeclaration","Error","MaterializePaint","isPushColorFilter","pushColorFilter","isPushShader","pushShader","isPushImageFilter","pushImageFilter","isPushPathEffect","pushPathEffect","ComposePathEffect","composePathEffects","ComposeImageFilter","composeImageFilters","PushBlurMaskFilter","setBlurMaskFilter","SaveCTM","saveCTM","RestoreCTM","restore","p","isBoxCommand","drawBox","DrawPaint","drawPaint","DrawImage","drawImage","DrawCircle","drawCircle","DrawPoints","drawPoints","DrawPath","drawPath","DrawRect","drawRect","DrawRRect","drawRRect","DrawOval","drawOval","DrawLine","drawLine","DrawPatch","drawPatch","DrawVertices","drawVertices","DrawDiffRect","drawDiffRect","DrawText","drawText","DrawTextPath","drawTextPath","DrawTextBlob","drawTextBlob","DrawGlyphs","drawGlyphs","DrawPicture","drawPicture","DrawImageSVG","drawImageSVG","DrawParagraph","drawParagraph","DrawAtlas","drawAtlas","console","warn","type","replay","commands","exports"],"sources":["Player.ts"],"sourcesContent":["import {\n drawCircle,\n drawImage,\n drawOval,\n drawPath,\n drawPoints,\n drawRect,\n drawRRect,\n drawLine,\n drawAtlas,\n drawParagraph,\n drawImageSVG,\n drawPicture,\n drawGlyphs,\n drawTextBlob,\n drawTextPath,\n drawText,\n drawDiffRect,\n drawVertices,\n drawPatch,\n} from \"./commands/Drawing\";\nimport { drawBox, isBoxCommand } from \"./commands/Box\";\nimport {\n composeColorFilters,\n isPushColorFilter,\n pushColorFilter,\n} from \"./commands/ColorFilters\";\nimport { saveCTM } from \"./commands/CTM\";\nimport {\n setBlurMaskFilter,\n isPushImageFilter,\n pushImageFilter,\n composeImageFilters,\n} from \"./commands/ImageFilters\";\nimport { setPaintProperties } from \"./commands/Paint\";\nimport {\n composePathEffects,\n isPushPathEffect,\n pushPathEffect,\n} from \"./commands/PathEffects\";\nimport { isPushShader, pushShader } from \"./commands/Shaders\";\nimport {\n CommandType,\n isCommand,\n isDrawCommand,\n isGroup,\n materializeCommand,\n} from \"./Core\";\nimport type { Command } from \"./Core\";\nimport type { DrawingContext } from \"./DrawingContext\";\n\nfunction play(ctx: DrawingContext, _command: Command) {\n \"worklet\";\n if (isGroup(_command)) {\n _command.children.forEach((child) => play(ctx, child));\n return;\n }\n const command = materializeCommand(_command);\n if (isCommand(command, CommandType.SaveBackdropFilter)) {\n ctx.saveBackdropFilter();\n } else if (isCommand(command, CommandType.SaveLayer)) {\n ctx.materializePaint();\n const paint = ctx.paintDeclarations.pop();\n ctx.canvas.saveLayer(paint);\n } else if (isDrawCommand(command, CommandType.SavePaint)) {\n if (command.props.paint) {\n ctx.paints.push(command.props.paint);\n } else {\n ctx.savePaint();\n setPaintProperties(ctx.Skia, ctx.paint, command.props);\n }\n } else if (isCommand(command, CommandType.RestorePaint)) {\n ctx.restorePaint();\n } else if (isCommand(command, CommandType.ComposeColorFilter)) {\n composeColorFilters(ctx);\n } else if (isCommand(command, CommandType.RestorePaintDeclaration)) {\n ctx.materializePaint();\n const paint = ctx.restorePaint();\n if (!paint) {\n throw new Error(\"No paint declaration to push\");\n }\n ctx.paintDeclarations.push(paint);\n } else if (isCommand(command, CommandType.MaterializePaint)) {\n ctx.materializePaint();\n } else if (isPushColorFilter(command)) {\n pushColorFilter(ctx, command);\n } else if (isPushShader(command)) {\n pushShader(ctx, command);\n } else if (isPushImageFilter(command)) {\n pushImageFilter(ctx, command);\n } else if (isPushPathEffect(command)) {\n pushPathEffect(ctx, command);\n } else if (isCommand(command, CommandType.ComposePathEffect)) {\n composePathEffects(ctx);\n } else if (isCommand(command, CommandType.ComposeImageFilter)) {\n composeImageFilters(ctx);\n } else if (isDrawCommand(command, CommandType.PushBlurMaskFilter)) {\n setBlurMaskFilter(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.SaveCTM)) {\n saveCTM(ctx, command.props);\n } else if (isCommand(command, CommandType.RestoreCTM)) {\n ctx.canvas.restore();\n } else {\n const paints = [ctx.paint, ...ctx.paintDeclarations];\n ctx.paintDeclarations = [];\n paints.forEach((p) => {\n ctx.paints.push(p);\n if (isBoxCommand(command)) {\n drawBox(ctx, command);\n } else if (isCommand(command, CommandType.DrawPaint)) {\n ctx.canvas.drawPaint(ctx.paint);\n } else if (isDrawCommand(command, CommandType.DrawImage)) {\n drawImage(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawCircle)) {\n drawCircle(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPoints)) {\n drawPoints(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPath)) {\n drawPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRect)) {\n drawRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRRect)) {\n drawRRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawOval)) {\n drawOval(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawLine)) {\n drawLine(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPatch)) {\n drawPatch(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawVertices)) {\n drawVertices(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawDiffRect)) {\n drawDiffRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawText)) {\n drawText(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextPath)) {\n drawTextPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextBlob)) {\n drawTextBlob(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawGlyphs)) {\n drawGlyphs(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPicture)) {\n drawPicture(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawImageSVG)) {\n drawImageSVG(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawParagraph)) {\n drawParagraph(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawAtlas)) {\n drawAtlas(ctx, command.props);\n } else {\n console.warn(`Unknown command: ${command.type}`);\n }\n ctx.paints.pop();\n });\n }\n}\n\nexport const replay = (ctx: DrawingContext, commands: Command[]) => {\n \"worklet\";\n commands.forEach((command) => {\n play(ctx, command);\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAqBA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAKA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAMA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAKA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AAUA,SAASS,IAAIA,CAACC,GAAmB,EAAEC,QAAiB,EAAE;EACpD,SAAS;;EACT,IAAI,IAAAC,aAAO,EAACD,QAAQ,CAAC,EAAE;IACrBA,QAAQ,CAACE,QAAQ,CAACC,OAAO,CAAEC,KAAK,IAAKN,IAAI,CAACC,GAAG,EAAEK,KAAK,CAAC,CAAC;I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AAM,IAAI,IAAAF,mBAAa,EAACb,OAAO,EAAEG,iBAAW,CAACoF,SAAS,CAAC,EAAE;QACxD,IAAAC,kBAAS,EAAC9F,GAAG,EAAEM,OAAO,CAACe,KAAK,CAAC;MAC/B,CAAC,MAAM;QACL0E,OAAO,CAACC,IAAI,CAAC,oBAAoB1F,OAAO,CAAC2F,IAAI,EAAE,CAAC;MAClD;MACAjG,GAAG,CAACsB,MAAM,CAACN,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC;EACJ;AACF;AAEO,MAAMkF,MAAM,GAAGA,CAAClG,GAAmB,EAAEmG,QAAmB,KAAK;EAClE,SAAS;;EACTA,QAAQ,CAAC/F,OAAO,CAAEE,OAAO,IAAK;IAC5BP,IAAI,CAACC,GAAG,EAAEM,OAAO,CAAC;EACpB,CAAC,CAAC;AACJ,CAAC;AAAC8F,OAAA,CAAAF,MAAA,GAAAA,MAAA","ignoreList":[]}
|
@@ -39,7 +39,7 @@ const drawBox = (ctx, command) => {
|
|
39
39
|
} = shadow;
|
40
40
|
const lPaint = Skia.Paint();
|
41
41
|
lPaint.setColor((0, _nodes.processColor)(Skia, color));
|
42
|
-
lPaint.setAlphaf(
|
42
|
+
lPaint.setAlphaf(lPaint.getAlphaf() * opacity);
|
43
43
|
lPaint.setMaskFilter(Skia.MaskFilter.MakeBlur(_types.BlurStyle.Normal, blur, true));
|
44
44
|
canvas.drawRRect((0, _nodes.inflate)(Skia, box, spread, spread, dx, dy), lPaint);
|
45
45
|
});
|
@@ -57,7 +57,7 @@ const drawBox = (ctx, command) => {
|
|
57
57
|
canvas.clipRRect(box, _types.ClipOp.Intersect, false);
|
58
58
|
const lPaint = Skia.Paint();
|
59
59
|
lPaint.setColor(Skia.Color(color));
|
60
|
-
lPaint.setAlphaf(
|
60
|
+
lPaint.setAlphaf(lPaint.getAlphaf() * opacity);
|
61
61
|
lPaint.setMaskFilter(Skia.MaskFilter.MakeBlur(_types.BlurStyle.Normal, blur, true));
|
62
62
|
const inner = (0, _nodes.deflate)(Skia, box, spread, spread, dx, dy);
|
63
63
|
const outer = (0, _nodes.inflate)(Skia, box, delta.x, delta.y);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_nodes","require","_types","_Core","isBoxCommand","command","type","CommandType","DrawBox","exports","drawBox","ctx","shadows","map","shadow","materializeCommand","props","paint","Skia","canvas","box","defaultBox","opacity","getAlphaf","isRRect","RRectXY","filter","inner","color","blur","spread","dx","dy","lPaint","Paint","setColor","processColor","setAlphaf","setMaskFilter","MaskFilter","MakeBlur","BlurStyle","Normal","drawRRect","inflate","delta","Point","Math","abs","save","clipRRect","ClipOp","Intersect","Color","deflate","outer","x","y","drawDRRect","restore"],"sources":["Box.ts"],"sourcesContent":["import { deflate, inflate, processColor } from \"../../../dom/nodes\";\nimport type { BoxProps, BoxShadowProps } from \"../../../dom/types\";\nimport { BlurStyle, ClipOp, isRRect } from \"../../../skia/types\";\nimport type { Command } from \"../Core\";\nimport { CommandType, materializeCommand } from \"../Core\";\nimport type { DrawingContext } from \"../DrawingContext\";\n\ninterface BoxCommand extends Command<CommandType.DrawBox> {\n props: BoxProps;\n shadows: { props: BoxShadowProps }[];\n}\n\nexport const isBoxCommand = (command: Command): command is BoxCommand => {\n \"worklet\";\n return command.type === CommandType.DrawBox;\n};\n\nexport const drawBox = (ctx: DrawingContext, command: BoxCommand) => {\n \"worklet\";\n const shadows = command.shadows.map((shadow) => {\n return materializeCommand(shadow).props;\n });\n const { paint, Skia, canvas } = ctx;\n const { box: defaultBox } = command.props;\n const opacity = paint.getAlphaf();\n const box = isRRect(defaultBox) ? defaultBox : Skia.RRectXY(defaultBox, 0, 0);\n shadows\n .filter((shadow) => !shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const lPaint = Skia.Paint();\n lPaint.setColor(processColor(Skia, color));\n lPaint.setAlphaf(
|
1
|
+
{"version":3,"names":["_nodes","require","_types","_Core","isBoxCommand","command","type","CommandType","DrawBox","exports","drawBox","ctx","shadows","map","shadow","materializeCommand","props","paint","Skia","canvas","box","defaultBox","opacity","getAlphaf","isRRect","RRectXY","filter","inner","color","blur","spread","dx","dy","lPaint","Paint","setColor","processColor","setAlphaf","setMaskFilter","MaskFilter","MakeBlur","BlurStyle","Normal","drawRRect","inflate","delta","Point","Math","abs","save","clipRRect","ClipOp","Intersect","Color","deflate","outer","x","y","drawDRRect","restore"],"sources":["Box.ts"],"sourcesContent":["import { deflate, inflate, processColor } from \"../../../dom/nodes\";\nimport type { BoxProps, BoxShadowProps } from \"../../../dom/types\";\nimport { BlurStyle, ClipOp, isRRect } from \"../../../skia/types\";\nimport type { Command } from \"../Core\";\nimport { CommandType, materializeCommand } from \"../Core\";\nimport type { DrawingContext } from \"../DrawingContext\";\n\ninterface BoxCommand extends Command<CommandType.DrawBox> {\n props: BoxProps;\n shadows: { props: BoxShadowProps }[];\n}\n\nexport const isBoxCommand = (command: Command): command is BoxCommand => {\n \"worklet\";\n return command.type === CommandType.DrawBox;\n};\n\nexport const drawBox = (ctx: DrawingContext, command: BoxCommand) => {\n \"worklet\";\n const shadows = command.shadows.map((shadow) => {\n return materializeCommand(shadow).props;\n });\n const { paint, Skia, canvas } = ctx;\n const { box: defaultBox } = command.props;\n const opacity = paint.getAlphaf();\n const box = isRRect(defaultBox) ? defaultBox : Skia.RRectXY(defaultBox, 0, 0);\n shadows\n .filter((shadow) => !shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const lPaint = Skia.Paint();\n lPaint.setColor(processColor(Skia, color));\n lPaint.setAlphaf(lPaint.getAlphaf() * opacity);\n lPaint.setMaskFilter(\n Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n canvas.drawRRect(inflate(Skia, box, spread, spread, dx, dy), lPaint);\n });\n\n canvas.drawRRect(box, paint);\n\n shadows\n .filter((shadow) => shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const delta = Skia.Point(10 + Math.abs(dx), 10 + Math.abs(dy));\n canvas.save();\n canvas.clipRRect(box, ClipOp.Intersect, false);\n const lPaint = Skia.Paint();\n lPaint.setColor(Skia.Color(color));\n lPaint.setAlphaf(lPaint.getAlphaf() * opacity);\n\n lPaint.setMaskFilter(\n Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n const inner = deflate(Skia, box, spread, spread, dx, dy);\n const outer = inflate(Skia, box, delta.x, delta.y);\n canvas.drawDRRect(outer, inner, lPaint);\n canvas.restore();\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,KAAA,GAAAF,OAAA;AAQO,MAAMG,YAAY,GAAIC,OAAgB,IAA4B;EACvE,SAAS;;EACT,OAAOA,OAAO,CAACC,IAAI,KAAKC,iBAAW,CAACC,OAAO;AAC7C,CAAC;AAACC,OAAA,CAAAL,YAAA,GAAAA,YAAA;AAEK,MAAMM,OAAO,GAAGA,CAACC,GAAmB,EAAEN,OAAmB,KAAK;EACnE,SAAS;;EACT,MAAMO,OAAO,GAAGP,OAAO,CAACO,OAAO,CAACC,GAAG,CAAEC,MAAM,IAAK;IAC9C,OAAO,IAAAC,wBAAkB,EAACD,MAAM,CAAC,CAACE,KAAK;EACzC,CAAC,CAAC;EACF,MAAM;IAAEC,KAAK;IAAEC,IAAI;IAAEC;EAAO,CAAC,GAAGR,GAAG;EACnC,MAAM;IAAES,GAAG,EAAEC;EAAW,CAAC,GAAGhB,OAAO,CAACW,KAAK;EACzC,MAAMM,OAAO,GAAGL,KAAK,CAACM,SAAS,CAAC,CAAC;EACjC,MAAMH,GAAG,GAAG,IAAAI,cAAO,EAACH,UAAU,CAAC,GAAGA,UAAU,GAAGH,IAAI,CAACO,OAAO,CAACJ,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;EAC7ET,OAAO,CACJc,MA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CAAC;IAC9Db,MAAM,CAAC8B,IAAI,CAAC,CAAC;IACb9B,MAAM,CAAC+B,SAAS,CAAC9B,GAAG,EAAE+B,aAAM,CAACC,SAAS,EAAE,KAAK,CAAC;IAC9C,MAAMnB,MAAM,GAAGf,IAAI,CAACgB,KAAK,CAAC,CAAC;IAC3BD,MAAM,CAACE,QAAQ,CAACjB,IAAI,CAACmC,KAAK,CAACzB,KAAK,CAAC,CAAC;IAClCK,MAAM,CAACI,SAAS,CAACJ,MAAM,CAACV,SAAS,CAAC,CAAC,GAAGD,OAAO,CAAC;IAE9CW,MAAM,CAACK,aAAa,CAClBpB,IAAI,CAACqB,UAAU,CAACC,QAAQ,CAACC,gBAAS,CAACC,MAAM,EAAEb,IAAI,EAAE,IAAI,CACvD,CAAC;IACD,MAAMF,KAAK,GAAG,IAAA2B,cAAO,EAACpC,IAAI,EAAEE,GAAG,EAAEU,MAAM,EAAEA,MAAM,EAAEC,EAAE,EAAEC,EAAE,CAAC;IACxD,MAAMuB,KAAK,GAAG,IAAAX,cAAO,EAAC1B,IAAI,EAAEE,GAAG,EAAEyB,KAAK,CAACW,CAAC,EAAEX,KAAK,CAACY,CAAC,CAAC;IAClDtC,MAAM,CAACuC,UAAU,CAACH,KAAK,EAAE5B,KAAK,EAAEM,MAAM,CAAC;IACvCd,MAAM,CAACwC,OAAO,CAAC,CAAC;EAClB,CAAC,CAAC;AACN,CAAC;AAAClD,OAAA,CAAAC,OAAA,GAAAA,OAAA","ignoreList":[]}
|
@@ -1,9 +1,7 @@
|
|
1
|
-
import type { AtlasProps,
|
2
|
-
import type { Node } from "../../Node";
|
1
|
+
import type { AtlasProps, CircleProps, DiffRectProps, DrawingNodeProps, GlyphsProps, ImageProps, ImageSVGProps, LineProps, OvalProps, ParagraphProps, PatchProps, PathProps, PictureProps, PointsProps, RectProps, RoundedRectProps, TextBlobProps, TextPathProps, TextProps, VerticesProps } from "../../../dom/types";
|
3
2
|
import type { DrawingContext } from "../DrawingContext";
|
4
3
|
export declare const drawLine: (ctx: DrawingContext, props: LineProps) => void;
|
5
4
|
export declare const drawOval: (ctx: DrawingContext, props: OvalProps) => void;
|
6
|
-
export declare const drawBox: (ctx: DrawingContext, props: BoxProps, children: Node<any>[]) => void;
|
7
5
|
export declare const drawImage: (ctx: DrawingContext, props: ImageProps) => void;
|
8
6
|
export declare const drawPoints: (ctx: DrawingContext, props: PointsProps) => void;
|
9
7
|
export declare const drawVertices: (ctx: DrawingContext, props: VerticesProps) => void;
|
@@ -3,11 +3,10 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.drawVertices = exports.drawTextPath = exports.drawTextBlob = exports.drawText = exports.drawRect = exports.drawRRect = exports.drawPoints = exports.drawPicture = exports.drawPath = exports.drawPatch = exports.drawParagraph = exports.drawOval = exports.drawLine = exports.drawImageSVG = exports.drawImage = exports.drawGlyphs = exports.drawFill = exports.drawDiffRect = exports.drawCircle = exports.
|
6
|
+
exports.drawVertices = exports.drawTextPath = exports.drawTextBlob = exports.drawText = exports.drawRect = exports.drawRRect = exports.drawPoints = exports.drawPicture = exports.drawPath = exports.drawPatch = exports.drawParagraph = exports.drawOval = exports.drawLine = exports.drawImageSVG = exports.drawImage = exports.drawGlyphs = exports.drawFill = exports.drawDiffRect = exports.drawCircle = exports.drawAtlas = void 0;
|
7
7
|
var _nodes = require("../../../dom/nodes");
|
8
8
|
var _processors = require("../../../renderer/processors");
|
9
9
|
var _types = require("../../../skia/types");
|
10
|
-
var _utils = require("../../utils");
|
11
10
|
const drawLine = (ctx, props) => {
|
12
11
|
"worklet";
|
13
12
|
|
@@ -25,62 +24,6 @@ const drawOval = (ctx, props) => {
|
|
25
24
|
ctx.canvas.drawOval(rect, ctx.paint);
|
26
25
|
};
|
27
26
|
exports.drawOval = drawOval;
|
28
|
-
const drawBox = (ctx, props, children) => {
|
29
|
-
"worklet";
|
30
|
-
|
31
|
-
const {
|
32
|
-
paint,
|
33
|
-
Skia,
|
34
|
-
canvas
|
35
|
-
} = ctx;
|
36
|
-
const {
|
37
|
-
box: defaultBox
|
38
|
-
} = props;
|
39
|
-
const opacity = paint.getAlphaf();
|
40
|
-
const box = (0, _types.isRRect)(defaultBox) ? defaultBox : Skia.RRectXY(defaultBox, 0, 0);
|
41
|
-
const shadows = children.map(node => {
|
42
|
-
if (node.type === _nodes.NodeType.BoxShadow) {
|
43
|
-
return (0, _utils.materialize)(node.props);
|
44
|
-
}
|
45
|
-
return null;
|
46
|
-
}).filter(n => n !== null);
|
47
|
-
shadows.filter(shadow => !shadow.inner).map(shadow => {
|
48
|
-
const {
|
49
|
-
color = "black",
|
50
|
-
blur,
|
51
|
-
spread = 0,
|
52
|
-
dx = 0,
|
53
|
-
dy = 0
|
54
|
-
} = shadow;
|
55
|
-
const lPaint = Skia.Paint();
|
56
|
-
lPaint.setColor((0, _nodes.processColor)(Skia, color));
|
57
|
-
lPaint.setAlphaf(paint.getAlphaf() * opacity);
|
58
|
-
lPaint.setMaskFilter(Skia.MaskFilter.MakeBlur(_types.BlurStyle.Normal, blur, true));
|
59
|
-
canvas.drawRRect((0, _nodes.inflate)(Skia, box, spread, spread, dx, dy), lPaint);
|
60
|
-
});
|
61
|
-
canvas.drawRRect(box, paint);
|
62
|
-
shadows.filter(shadow => shadow.inner).map(shadow => {
|
63
|
-
const {
|
64
|
-
color = "black",
|
65
|
-
blur,
|
66
|
-
spread = 0,
|
67
|
-
dx = 0,
|
68
|
-
dy = 0
|
69
|
-
} = shadow;
|
70
|
-
const delta = Skia.Point(10 + Math.abs(dx), 10 + Math.abs(dy));
|
71
|
-
canvas.save();
|
72
|
-
canvas.clipRRect(box, _types.ClipOp.Intersect, false);
|
73
|
-
const lPaint = Skia.Paint();
|
74
|
-
lPaint.setColor((0, _nodes.processColor)(Skia, color));
|
75
|
-
lPaint.setAlphaf(paint.getAlphaf() * opacity);
|
76
|
-
lPaint.setMaskFilter(Skia.MaskFilter.MakeBlur(_types.BlurStyle.Normal, blur, true));
|
77
|
-
const inner = (0, _nodes.deflate)(Skia, box, spread, spread, dx, dy);
|
78
|
-
const outer = (0, _nodes.inflate)(Skia, box, delta.x, delta.y);
|
79
|
-
canvas.drawDRRect(outer, inner, lPaint);
|
80
|
-
canvas.restore();
|
81
|
-
});
|
82
|
-
};
|
83
|
-
exports.drawBox = drawBox;
|
84
27
|
const drawImage = (ctx, props) => {
|
85
28
|
"worklet";
|
86
29
|
|