@shopify/react-native-skia 0.1.141 → 0.1.145
Sign up to get free protection for your applications and to get access to all the features.
- package/android/cpp/rnskia-android/RNSkDrawViewImpl.cpp +2 -2
- package/android/cpp/rnskia-android/RNSkDrawViewImpl.h +1 -1
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +15 -16
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +2 -2
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDrawView.java +69 -27
- package/cpp/api/JsiSkPaint.h +6 -0
- package/cpp/api/JsiSkPathFactory.h +1 -1
- package/cpp/api/JsiSkPicture.h +7 -1
- package/cpp/rnskia/RNSkDrawView.cpp +66 -66
- package/cpp/rnskia/RNSkDrawView.h +22 -6
- package/cpp/rnskia/RNSkJsiViewApi.h +2 -2
- package/cpp/rnskia/values/RNSkComputedValue.h +10 -7
- package/cpp/rnskia/values/RNSkReadonlyValue.h +21 -2
- package/cpp/rnskia/values/RNSkValue.h +1 -0
- package/ios/RNSkia-iOS/RNSkDrawViewImpl.h +1 -1
- package/ios/RNSkia-iOS/RNSkDrawViewImpl.mm +2 -2
- package/ios/RNSkia-iOS/SkiaDrawView.mm +4 -0
- package/lib/commonjs/mock/index.js +3 -1
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +17 -7
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/DependencyManager.js +144 -36
- package/lib/commonjs/renderer/DependencyManager.js.map +1 -1
- package/lib/commonjs/renderer/HostConfig.js +1 -1
- package/lib/commonjs/renderer/HostConfig.js.map +1 -1
- package/lib/commonjs/renderer/components/Blend.js +20 -5
- package/lib/commonjs/renderer/components/Blend.js.map +1 -1
- package/lib/commonjs/renderer/components/backdrop/BackdropFilter.js.map +1 -1
- package/lib/commonjs/renderer/components/imageFilters/Morphology.js +1 -1
- package/lib/commonjs/renderer/components/imageFilters/Morphology.js.map +1 -1
- package/lib/commonjs/renderer/components/imageFilters/Shadow.js +1 -1
- package/lib/commonjs/renderer/components/imageFilters/Shadow.js.map +1 -1
- package/lib/commonjs/renderer/nodes/Declaration.js +2 -3
- package/lib/commonjs/renderer/nodes/Declaration.js.map +1 -1
- package/lib/commonjs/renderer/nodes/Drawing.js +3 -7
- package/lib/commonjs/renderer/nodes/Drawing.js.map +1 -1
- package/lib/commonjs/renderer/nodes/Node.js +9 -7
- package/lib/commonjs/renderer/nodes/Node.js.map +1 -1
- package/lib/commonjs/renderer/processors/Animations/Animations.js +14 -20
- package/lib/commonjs/renderer/processors/Animations/Animations.js.map +1 -1
- package/lib/commonjs/skia/core/Data.js +10 -22
- package/lib/commonjs/skia/core/Data.js.map +1 -1
- package/lib/commonjs/skia/core/Font.js +2 -3
- package/lib/commonjs/skia/core/Font.js.map +1 -1
- package/lib/commonjs/skia/core/Image.js.map +1 -1
- package/lib/commonjs/skia/core/SVG.js.map +1 -1
- package/lib/commonjs/skia/core/Typeface.js.map +1 -1
- package/lib/commonjs/skia/types/Data/Data.js +5 -0
- package/lib/commonjs/skia/types/Data/Data.js.map +1 -1
- package/lib/commonjs/skia/types/Paint/Paint.js.map +1 -1
- package/lib/commonjs/skia/web/Host.js +12 -21
- package/lib/commonjs/skia/web/Host.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.js +50 -28
- package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js +4 -4
- package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkFont.js +7 -3
- package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.js +4 -2
- package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFactory.js +4 -2
- package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js +61 -19
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkMatrix.js +1 -1
- package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPaint.js +19 -6
- package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.js +16 -60
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js +7 -3
- package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkPathFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js +5 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPictureRecorder.js +3 -1
- package/lib/commonjs/skia/web/JsiSkPictureRecorder.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPoint.js +9 -1
- package/lib/commonjs/skia/web/JsiSkPoint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRRect.js +9 -1
- package/lib/commonjs/skia/web/JsiSkRRect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRSXform.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRect.js +3 -3
- package/lib/commonjs/skia/web/JsiSkRect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js +4 -2
- package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkShaderFactory.js +10 -6
- package/lib/commonjs/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkSurface.js +3 -1
- package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkTextBlobFactory.js +8 -4
- package/lib/commonjs/skia/web/JsiSkTextBlobFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkTypefaceFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkTypefaceFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkia.js +12 -6
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/commonjs/values/hooks/useComputedValue.js +6 -2
- package/lib/commonjs/values/hooks/useComputedValue.js.map +1 -1
- package/lib/commonjs/values/index.js +13 -0
- package/lib/commonjs/values/index.js.map +1 -1
- package/lib/commonjs/values/selector.js +24 -0
- package/lib/commonjs/values/selector.js.map +1 -0
- package/lib/commonjs/values/web/RNSkComputedValue.js +8 -0
- package/lib/commonjs/values/web/RNSkComputedValue.js.map +1 -1
- package/lib/commonjs/values/web/RNSkReadonlyValue.js +4 -0
- package/lib/commonjs/values/web/RNSkReadonlyValue.js.map +1 -1
- package/lib/module/mock/index.js +2 -1
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/renderer/Canvas.js +17 -6
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/DependencyManager.js +141 -34
- package/lib/module/renderer/DependencyManager.js.map +1 -1
- package/lib/module/renderer/HostConfig.js +1 -1
- package/lib/module/renderer/HostConfig.js.map +1 -1
- package/lib/module/renderer/components/Blend.js +21 -5
- package/lib/module/renderer/components/Blend.js.map +1 -1
- package/lib/module/renderer/components/backdrop/BackdropFilter.js.map +1 -1
- package/lib/module/renderer/components/imageFilters/Morphology.js +1 -1
- package/lib/module/renderer/components/imageFilters/Morphology.js.map +1 -1
- package/lib/module/renderer/components/imageFilters/Shadow.js +1 -1
- package/lib/module/renderer/components/imageFilters/Shadow.js.map +1 -1
- package/lib/module/renderer/nodes/Declaration.js +3 -4
- package/lib/module/renderer/nodes/Declaration.js.map +1 -1
- package/lib/module/renderer/nodes/Drawing.js +3 -6
- package/lib/module/renderer/nodes/Drawing.js.map +1 -1
- package/lib/module/renderer/nodes/Node.js +9 -7
- package/lib/module/renderer/nodes/Node.js.map +1 -1
- package/lib/module/renderer/processors/Animations/Animations.js +9 -15
- package/lib/module/renderer/processors/Animations/Animations.js.map +1 -1
- package/lib/module/skia/core/Data.js +10 -20
- package/lib/module/skia/core/Data.js.map +1 -1
- package/lib/module/skia/core/Font.js +2 -3
- package/lib/module/skia/core/Font.js.map +1 -1
- package/lib/module/skia/core/Image.js.map +1 -1
- package/lib/module/skia/core/SVG.js.map +1 -1
- package/lib/module/skia/core/Typeface.js.map +1 -1
- package/lib/module/skia/types/Data/Data.js +1 -1
- package/lib/module/skia/types/Data/Data.js.map +1 -1
- package/lib/module/skia/types/Paint/Paint.js.map +1 -1
- package/lib/module/skia/web/Host.js +9 -9
- package/lib/module/skia/web/Host.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.js +40 -29
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkColorFilterFactory.js +5 -5
- package/lib/module/skia/web/JsiSkColorFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkFont.js +6 -4
- package/lib/module/skia/web/JsiSkFont.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.js +4 -3
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFactory.js +4 -3
- package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFilterFactory.js +61 -20
- package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkMatrix.js +2 -2
- package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/module/skia/web/JsiSkPaint.js +15 -7
- package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.js +15 -62
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathEffectFactory.js +6 -4
- package/lib/module/skia/web/JsiSkPathEffectFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathFactory.js +2 -2
- package/lib/module/skia/web/JsiSkPathFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPicture.js +4 -2
- package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/module/skia/web/JsiSkPictureRecorder.js +3 -2
- package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -1
- package/lib/module/skia/web/JsiSkPoint.js +10 -2
- package/lib/module/skia/web/JsiSkPoint.js.map +1 -1
- package/lib/module/skia/web/JsiSkRRect.js +10 -2
- package/lib/module/skia/web/JsiSkRRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkRSXform.js.map +1 -1
- package/lib/module/skia/web/JsiSkRect.js +4 -4
- package/lib/module/skia/web/JsiSkRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkRuntimeEffect.js +4 -3
- package/lib/module/skia/web/JsiSkRuntimeEffect.js.map +1 -1
- package/lib/module/skia/web/JsiSkShaderFactory.js +9 -7
- package/lib/module/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurface.js +3 -2
- package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/module/skia/web/JsiSkTextBlobFactory.js +7 -5
- package/lib/module/skia/web/JsiSkTextBlobFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkTypefaceFactory.js +2 -2
- package/lib/module/skia/web/JsiSkTypefaceFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkia.js +10 -5
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/values/hooks/useComputedValue.js +7 -3
- package/lib/module/values/hooks/useComputedValue.js.map +1 -1
- package/lib/module/values/index.js +1 -0
- package/lib/module/values/index.js.map +1 -1
- package/lib/module/values/selector.js +15 -0
- package/lib/module/values/selector.js.map +1 -0
- package/lib/module/values/web/RNSkComputedValue.js +8 -0
- package/lib/module/values/web/RNSkComputedValue.js.map +1 -1
- package/lib/module/values/web/RNSkReadonlyValue.js +4 -0
- package/lib/module/values/web/RNSkReadonlyValue.js.map +1 -1
- package/lib/typescript/src/renderer/Canvas.d.ts +1 -1
- package/lib/typescript/src/renderer/DependencyManager.d.ts +40 -14
- package/lib/typescript/src/renderer/nodes/Declaration.d.ts +2 -2
- package/lib/typescript/src/renderer/nodes/Drawing.d.ts +2 -2
- package/lib/typescript/src/renderer/nodes/Node.d.ts +3 -2
- package/lib/typescript/src/renderer/processors/Animations/Animations.d.ts +7 -3
- package/lib/typescript/src/skia/core/Data.d.ts +3 -5
- package/lib/typescript/src/skia/core/Font.d.ts +2 -2
- package/lib/typescript/src/skia/core/Image.d.ts +2 -2
- package/lib/typescript/src/skia/core/SVG.d.ts +2 -2
- package/lib/typescript/src/skia/core/Typeface.d.ts +2 -2
- package/lib/typescript/src/skia/types/Data/Data.d.ts +10 -3
- package/lib/typescript/src/skia/types/Paint/Paint.d.ts +5 -0
- package/lib/typescript/src/skia/types/Picture/Picture.d.ts +2 -1
- package/lib/typescript/src/skia/web/Host.d.ts +6 -8
- package/lib/typescript/src/skia/web/JsiSkImageFilterFactory.d.ts +8 -8
- package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkPoint.d.ts +3 -2
- package/lib/typescript/src/skia/web/JsiSkRRect.d.ts +3 -2
- package/lib/typescript/src/skia/web/JsiSkRSXform.d.ts +1 -2
- package/lib/typescript/src/skia/web/JsiSkRect.d.ts +3 -3
- package/lib/typescript/src/skia/web/JsiSkTextBlobFactory.d.ts +2 -1
- package/lib/typescript/src/values/index.d.ts +1 -0
- package/lib/typescript/src/values/selector.d.ts +14 -0
- package/lib/typescript/src/values/types.d.ts +4 -0
- package/lib/typescript/src/values/web/RNSkComputedValue.d.ts +1 -0
- package/lib/typescript/src/values/web/RNSkReadonlyValue.d.ts +1 -0
- package/libs/ios/libskia.xcframework/Info.plist +5 -5
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +3 -3
- package/src/mock/index.ts +2 -1
- package/src/renderer/Canvas.tsx +19 -7
- package/src/renderer/DependencyManager.tsx +171 -37
- package/src/renderer/HostConfig.ts +1 -1
- package/src/renderer/components/Blend.tsx +25 -5
- package/src/renderer/components/backdrop/BackdropFilter.tsx +1 -1
- package/src/renderer/components/imageFilters/Morphology.tsx +2 -2
- package/src/renderer/components/imageFilters/Shadow.tsx +2 -2
- package/src/renderer/nodes/Declaration.tsx +6 -8
- package/src/renderer/nodes/Drawing.tsx +5 -7
- package/src/renderer/nodes/Node.ts +11 -9
- package/src/renderer/processors/Animations/Animations.ts +23 -14
- package/src/skia/core/Data.ts +20 -51
- package/src/skia/core/Font.ts +4 -5
- package/src/skia/core/Image.ts +2 -2
- package/src/skia/core/SVG.ts +2 -2
- package/src/skia/core/Typeface.ts +2 -2
- package/src/skia/types/Data/Data.ts +11 -1
- package/src/skia/types/Paint/Paint.ts +6 -0
- package/src/skia/types/Picture/Picture.ts +2 -1
- package/src/skia/web/Host.ts +12 -22
- package/src/skia/web/JsiSkCanvas.ts +99 -56
- package/src/skia/web/JsiSkColorFilterFactory.ts +15 -5
- package/src/skia/web/JsiSkFont.ts +11 -4
- package/src/skia/web/JsiSkImage.ts +4 -3
- package/src/skia/web/JsiSkImageFactory.ts +6 -3
- package/src/skia/web/JsiSkImageFilterFactory.ts +124 -52
- package/src/skia/web/JsiSkMatrix.ts +4 -2
- package/src/skia/web/JsiSkPaint.ts +15 -7
- package/src/skia/web/JsiSkPath.ts +30 -56
- package/src/skia/web/JsiSkPathEffectFactory.ts +10 -5
- package/src/skia/web/JsiSkPathFactory.ts +3 -3
- package/src/skia/web/JsiSkPicture.ts +5 -3
- package/src/skia/web/JsiSkPictureRecorder.ts +3 -2
- package/src/skia/web/JsiSkPoint.ts +12 -2
- package/src/skia/web/JsiSkRRect.ts +16 -2
- package/src/skia/web/JsiSkRSXform.ts +1 -1
- package/src/skia/web/JsiSkRect.ts +4 -7
- package/src/skia/web/JsiSkRuntimeEffect.ts +9 -4
- package/src/skia/web/JsiSkShaderFactory.ts +24 -15
- package/src/skia/web/JsiSkSurface.ts +7 -2
- package/src/skia/web/JsiSkTextBlobFactory.ts +14 -8
- package/src/skia/web/JsiSkTypefaceFactory.tsx +4 -2
- package/src/skia/web/JsiSkia.ts +17 -5
- package/src/values/hooks/useComputedValue.ts +6 -3
- package/src/values/index.ts +1 -0
- package/src/values/selector.ts +24 -0
- package/src/values/types.ts +4 -0
- package/src/values/web/RNSkComputedValue.ts +6 -0
- package/src/values/web/RNSkReadonlyValue.ts +4 -0
@@ -39,7 +39,7 @@ const onDeclare = (0, _Declaration.createDeclaration)((_ref, children, _ref2) =>
|
|
39
39
|
if (inner) {
|
40
40
|
factory = _InnerShadow.MakeInnerShadow.bind(null, Skia, shadowOnly);
|
41
41
|
} else {
|
42
|
-
factory = shadowOnly ? Skia.ImageFilter.MakeDropShadowOnly : Skia.ImageFilter.MakeDropShadow;
|
42
|
+
factory = shadowOnly ? Skia.ImageFilter.MakeDropShadowOnly.bind(Skia.ImageFilter) : Skia.ImageFilter.MakeDropShadow.bind(Skia.ImageFilter);
|
43
43
|
}
|
44
44
|
|
45
45
|
return factory(dx, dy, blur, blur, color, input);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Shadow.tsx"],"names":["onDeclare","children","dx","dy","blur","color","cl","shadowOnly","inner","opacity","Skia","input","factory","MakeInnerShadow","bind","ImageFilter","MakeDropShadowOnly","MakeDropShadow","Shadow","props"],"mappings":";;;;;;;AAAA;;AAEA;;AAGA;;AAEA;;AACA;;;;;;AAWA,MAAMA,SAAS,GAAG,oCAChB,OAEEC,QAFF,YAIK;AAAA,MAHH;AAAEC,IAAAA,EAAF;AAAMC,IAAAA,EAAN;AAAUC,IAAAA,IAAV;AAAgBC,IAAAA,KAAK,EAAEC,EAAvB;AAA2BC,IAAAA,UAA3B;AAAuCC,IAAAA;AAAvC,GAGG;AAAA,MADH;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,GACG;AACH,QAAMC,KAAK,GAAG,wBAASD,IAAT,EAAeT,QAAf,CAAd;AACA,QAAMI,KAAK,GAAG,yBAAaK,IAAb,EAAmBJ,EAAnB,EAAuBG,OAAvB,CAAd;AACA,MAAIG,OAAJ;;AACA,MAAIJ,KAAJ,EAAW;AACTI,IAAAA,OAAO,GAAGC,6BAAgBC,IAAhB,CAAqB,IAArB,EAA2BJ,IAA3B,EAAiCH,UAAjC,CAAV;AACD,GAFD,MAEO;AACLK,IAAAA,OAAO,GAAGL,UAAU,GAChBG,IAAI,CAACK,WAAL,CAAiBC,
|
1
|
+
{"version":3,"sources":["Shadow.tsx"],"names":["onDeclare","children","dx","dy","blur","color","cl","shadowOnly","inner","opacity","Skia","input","factory","MakeInnerShadow","bind","ImageFilter","MakeDropShadowOnly","MakeDropShadow","Shadow","props"],"mappings":";;;;;;;AAAA;;AAEA;;AAGA;;AAEA;;AACA;;;;;;AAWA,MAAMA,SAAS,GAAG,oCAChB,OAEEC,QAFF,YAIK;AAAA,MAHH;AAAEC,IAAAA,EAAF;AAAMC,IAAAA,EAAN;AAAUC,IAAAA,IAAV;AAAgBC,IAAAA,KAAK,EAAEC,EAAvB;AAA2BC,IAAAA,UAA3B;AAAuCC,IAAAA;AAAvC,GAGG;AAAA,MADH;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,GACG;AACH,QAAMC,KAAK,GAAG,wBAASD,IAAT,EAAeT,QAAf,CAAd;AACA,QAAMI,KAAK,GAAG,yBAAaK,IAAb,EAAmBJ,EAAnB,EAAuBG,OAAvB,CAAd;AACA,MAAIG,OAAJ;;AACA,MAAIJ,KAAJ,EAAW;AACTI,IAAAA,OAAO,GAAGC,6BAAgBC,IAAhB,CAAqB,IAArB,EAA2BJ,IAA3B,EAAiCH,UAAjC,CAAV;AACD,GAFD,MAEO;AACLK,IAAAA,OAAO,GAAGL,UAAU,GAChBG,IAAI,CAACK,WAAL,CAAiBC,kBAAjB,CAAoCF,IAApC,CAAyCJ,IAAI,CAACK,WAA9C,CADgB,GAEhBL,IAAI,CAACK,WAAL,CAAiBE,cAAjB,CAAgCH,IAAhC,CAAqCJ,IAAI,CAACK,WAA1C,CAFJ;AAGD;;AACD,SAAOH,OAAO,CAACV,EAAD,EAAKC,EAAL,EAASC,IAAT,EAAeA,IAAf,EAAqBC,KAArB,EAA4BM,KAA5B,CAAd;AACD,CAjBe,CAAlB;;AAoBO,MAAMO,MAAM,GAAIC,KAAD,IAAuC;AAC3D,sBAAO;AAAe,IAAA,SAAS,EAAEnB;AAA1B,KAAyCmB,KAAzC,EAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\n\nimport { createDeclaration } from \"../../nodes/Declaration\";\nimport type { AnimatedProps } from \"../../processors/Animations/Animations\";\nimport type { Color } from \"../../../skia/types\";\nimport { processColor } from \"../../processors/Color\";\n\nimport { getInput } from \"./getInput\";\nimport { MakeInnerShadow } from \"./InnerShadow\";\n\nexport interface ShadowProps {\n dx: number;\n dy: number;\n blur: number;\n color: Color;\n inner?: boolean;\n shadowOnly?: boolean;\n}\n\nconst onDeclare = createDeclaration<ShadowProps>(\n (\n { dx, dy, blur, color: cl, shadowOnly, inner },\n children,\n { opacity, Skia }\n ) => {\n const input = getInput(Skia, children);\n const color = processColor(Skia, cl, opacity);\n let factory;\n if (inner) {\n factory = MakeInnerShadow.bind(null, Skia, shadowOnly);\n } else {\n factory = shadowOnly\n ? Skia.ImageFilter.MakeDropShadowOnly.bind(Skia.ImageFilter)\n : Skia.ImageFilter.MakeDropShadow.bind(Skia.ImageFilter);\n }\n return factory(dx, dy, blur, blur, color, input);\n }\n);\n\nexport const Shadow = (props: AnimatedProps<ShadowProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n"]}
|
@@ -42,13 +42,12 @@ class DeclarationNode extends _Node.Node {
|
|
42
42
|
}
|
43
43
|
|
44
44
|
get props() {
|
45
|
-
return this.
|
45
|
+
return this.resolvedProps;
|
46
46
|
}
|
47
47
|
|
48
48
|
draw(ctx) {
|
49
49
|
const children = this.visit(ctx);
|
50
|
-
const
|
51
|
-
const obj = this.onDeclare(props, children, ctx);
|
50
|
+
const obj = this.onDeclare(this.props, children, ctx);
|
52
51
|
return obj;
|
53
52
|
}
|
54
53
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Declaration.tsx"],"names":["createDeclaration","cb","useDeclaration","deps","isDeclarationNode","node","DeclarationNode","Node","constructor","depMgr","onDeclare","props","memoizable","
|
1
|
+
{"version":3,"sources":["Declaration.tsx"],"names":["createDeclaration","cb","useDeclaration","deps","isDeclarationNode","node","DeclarationNode","Node","constructor","depMgr","onDeclare","props","memoizable","resolvedProps","draw","ctx","children","visit","obj"],"mappings":";;;;;;;AACA;;AAIA;;AAIA;;;;AAUO,MAAMA,iBAAiB,GAC5BC,EAD+B,IAEJA,EAFtB;;;;AAIA,MAAMC,cAAc,GAAG,CAC5BD,EAD4B,EAE5BE,IAF4B,KAI5B;AACA,wBAAYF,EAAZ,EAAgBE,IAAhB,aAAgBA,IAAhB,cAAgBA,IAAhB,GAAwB,EAAxB,CALK;;;;AAOA,MAAMC,iBAAiB,GAAQC,IAAL,IAC/BA,IAAI,YAAYC,eADX;;;;AAOA,MAAMA,eAAN,SAAiCC,UAAjC,CAAyC;AAG9CC,EAAAA,WAAW,CACTC,MADS,EAETC,SAFS,EAGTC,KAHS,EAIT;AACA,UAAMF,MAAN,EAAcE,KAAd;;AADA;;AAEA,UAAMC,UAAN,GAAmB,CAAC,4BAAWD,KAAX,CAApB;AACA,SAAKD,SAAL,GAAiBA,SAAjB;AACD;;AAEQ,MAALC,KAAK,CAACA,KAAD,EAA0B;AACjC,SAAKC,UAAL,GAAkB,CAAC,4BAAWD,KAAX,CAAnB;AACA,UAAMA,KAAN,GAAcA,KAAd;AACD;;AAEQ,MAALA,KAAK,GAAM;AACb,WAAO,KAAKE,aAAZ;AACD;;AAEDC,EAAAA,IAAI,CAACC,GAAD,EAAsB;AACxB,UAAMC,QAAQ,GAAG,KAAKC,KAAL,CAAWF,GAAX,CAAjB;AACA,UAAMG,GAAG,GAAG,KAAKR,SAAL,CAAe,KAAKC,KAApB,EAA2BK,QAA3B,EAAqCD,GAArC,CAAZ;AACA,WAAOG,GAAP;AACD;;AA1B6C","sourcesContent":["import type { DependencyList } from \"react\";\nimport { useCallback } from \"react\";\n\nimport type { DrawingContext } from \"../DrawingContext\";\nimport type { AnimatedProps } from \"../processors\";\nimport { isAnimated } from \"../processors\";\nimport type { DependencyManager } from \"../DependencyManager\";\nimport type { SkJSIInstance } from \"../../skia/types\";\n\nimport { Node } from \"./Node\";\n\nexport type DeclarationResult = SkJSIInstance<string> | null;\n\ntype DeclarationCallback<T> = (\n props: T,\n children: DeclarationResult[],\n ctx: DrawingContext\n) => DeclarationResult;\n\nexport const createDeclaration = <T,>(\n cb: DeclarationCallback<T>\n): DeclarationCallback<T> => cb;\n\nexport const useDeclaration = <P,>(\n cb: DeclarationCallback<P>,\n deps?: DependencyList\n) =>\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useCallback(cb, deps ?? []);\n\nexport const isDeclarationNode = <P,>(node: Node): node is DeclarationNode<P> =>\n node instanceof DeclarationNode;\n\nexport interface DeclarationProps<P> {\n onDeclare: DeclarationCallback<P>;\n}\n\nexport class DeclarationNode<P> extends Node<P> {\n private onDeclare: DeclarationCallback<P>;\n\n constructor(\n depMgr: DependencyManager,\n onDeclare: DeclarationCallback<P>,\n props: AnimatedProps<P>\n ) {\n super(depMgr, props);\n super.memoizable = !isAnimated(props);\n this.onDeclare = onDeclare;\n }\n\n set props(props: AnimatedProps<P>) {\n this.memoizable = !isAnimated(props);\n super.props = props;\n }\n\n get props(): P {\n return this.resolvedProps;\n }\n\n draw(ctx: DrawingContext) {\n const children = this.visit(ctx);\n const obj = this.onDeclare(this.props, children, ctx);\n return obj;\n }\n}\n"]}
|
@@ -7,8 +7,6 @@ exports.useDrawing = exports.createDrawing = exports.DrawingNode = void 0;
|
|
7
7
|
|
8
8
|
var _react = require("react");
|
9
9
|
|
10
|
-
var _Animations = require("../processors/Animations/Animations");
|
11
|
-
|
12
10
|
var _types = require("../../skia/types");
|
13
11
|
|
14
12
|
var _processors = require("../processors");
|
@@ -39,17 +37,15 @@ class DrawingNode extends _Node.Node {
|
|
39
37
|
}
|
40
38
|
|
41
39
|
draw(ctx) {
|
42
|
-
const drawingProps = (0, _Animations.materialize)(this.props);
|
43
|
-
|
44
40
|
if (this.skipProcessing) {
|
45
|
-
this.onDraw(ctx,
|
41
|
+
this.onDraw(ctx, this.props, this);
|
46
42
|
} else {
|
47
43
|
const declarations = this.visit(ctx);
|
48
|
-
const paint = (0, _processors.processPaint)(ctx.Skia, ctx.paint.copy(), ctx.opacity,
|
44
|
+
const paint = (0, _processors.processPaint)(ctx.Skia, ctx.paint.copy(), ctx.opacity, this.props, declarations);
|
49
45
|
[paint, ...declarations.filter(_types.isPaint)].forEach(currentPaint => {
|
50
46
|
this.onDraw({ ...ctx,
|
51
47
|
paint: currentPaint
|
52
|
-
},
|
48
|
+
}, this.props, this);
|
53
49
|
});
|
54
50
|
}
|
55
51
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Drawing.tsx"],"names":["createDrawing","cb","useDrawing","deps","DrawingNode","Node","constructor","depMgr","onDraw","skipProcessing","props","draw","ctx","
|
1
|
+
{"version":3,"sources":["Drawing.tsx"],"names":["createDrawing","cb","useDrawing","deps","DrawingNode","Node","constructor","depMgr","onDraw","skipProcessing","props","draw","ctx","declarations","visit","paint","Skia","copy","opacity","filter","isPaint","forEach","currentPaint"],"mappings":";;;;;;;AACA;;AAIA;;AAEA;;AAEA;;;;AAUO,MAAMA,aAAa,GAAQC,EAAL,IAC3BA,EADK;;;;AAGA,MAAMC,UAAU,GAAG,CAAKD,EAAL,EAA4BE,IAA5B,KACxB;AACA,wBAAYF,EAAZ,EAAgBE,IAAhB,aAAgBA,IAAhB,cAAgBA,IAAhB,GAAwB,EAAxB,CAFK;;;;AAUA,MAAMC,WAAN,SAA6BC,UAA7B,CAAqC;AAI1CC,EAAAA,WAAW,CACTC,MADS,EAETC,MAFS,EAGTC,cAHS,EAITC,KAJS,EAKT;AACA,UAAMH,MAAN,EAAcG,KAAd;;AADA;;AAAA;;AAEA,SAAKF,MAAL,GAAcA,MAAd;AACA,SAAKC,cAAL,GAAsBA,cAAtB;AACD;;AAEDE,EAAAA,IAAI,CAACC,GAAD,EAAsB;AACxB,QAAI,KAAKH,cAAT,EAAyB;AACvB,WAAKD,MAAL,CAAYI,GAAZ,EAAiB,KAAKF,KAAtB,EAA6B,IAA7B;AACD,KAFD,MAEO;AACL,YAAMG,YAAY,GAAG,KAAKC,KAAL,CAAWF,GAAX,CAArB;AACA,YAAMG,KAAK,GAAG,8BACZH,GAAG,CAACI,IADQ,EAEZJ,GAAG,CAACG,KAAJ,CAAUE,IAAV,EAFY,EAGZL,GAAG,CAACM,OAHQ,EAIZ,KAAKR,KAJO,EAKZG,YALY,CAAd;AAOA,OAACE,KAAD,EAAQ,GAAGF,YAAY,CAACM,MAAb,CAAoBC,cAApB,CAAX,EAAyCC,OAAzC,CAAkDC,YAAD,IAAkB;AACjE,aAAKd,MAAL,CAAY,EAAE,GAAGI,GAAL;AAAUG,UAAAA,KAAK,EAAEO;AAAjB,SAAZ,EAA6C,KAAKZ,KAAlD,EAAyD,IAAzD;AACD,OAFD;AAGD;AACF;;AA/ByC","sourcesContent":["import type { DependencyList, ReactNode } from \"react\";\nimport { useCallback } from \"react\";\n\nimport type { DrawingContext } from \"../DrawingContext\";\nimport type { AnimatedProps } from \"../processors/Animations/Animations\";\nimport { isPaint } from \"../../skia/types\";\nimport type { DependencyManager } from \"../DependencyManager\";\nimport { processPaint } from \"../processors\";\n\nimport { Node } from \"./Node\";\n\ntype DrawingCallback<P> = (\n ctx: DrawingContext,\n props: P,\n node: Node<P>\n) => void;\n\ntype OnDrawCallback<P> = (ctx: DrawingContext, props: P, node: Node<P>) => void;\n\nexport const createDrawing = <P,>(cb: OnDrawCallback<P>): DrawingCallback<P> =>\n cb;\n\nexport const useDrawing = <P,>(cb: OnDrawCallback<P>, deps?: DependencyList) =>\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useCallback(cb, deps ?? []);\n\nexport type DrawingProps<P> = {\n onDraw: DrawingCallback<P>;\n skipProcessing?: boolean;\n children?: ReactNode | ReactNode[];\n};\n\nexport class DrawingNode<P> extends Node<P> {\n onDraw: DrawingCallback<P>;\n skipProcessing: boolean;\n\n constructor(\n depMgr: DependencyManager,\n onDraw: DrawingCallback<P>,\n skipProcessing: boolean,\n props: AnimatedProps<P>\n ) {\n super(depMgr, props);\n this.onDraw = onDraw;\n this.skipProcessing = skipProcessing;\n }\n\n draw(ctx: DrawingContext) {\n if (this.skipProcessing) {\n this.onDraw(ctx, this.props, this);\n } else {\n const declarations = this.visit(ctx);\n const paint = processPaint(\n ctx.Skia,\n ctx.paint.copy(),\n ctx.opacity,\n this.props,\n declarations\n );\n [paint, ...declarations.filter(isPaint)].forEach((currentPaint) => {\n this.onDraw({ ...ctx, paint: currentPaint }, this.props, this);\n });\n }\n }\n}\n"]}
|
@@ -16,10 +16,11 @@ exports.NodeType = NodeType;
|
|
16
16
|
})(NodeType || (exports.NodeType = NodeType = {}));
|
17
17
|
|
18
18
|
class Node {
|
19
|
+
// This cast is ok because we understand that the dependency manager will setup the initial props
|
19
20
|
constructor(depMgr, props) {
|
20
21
|
_defineProperty(this, "children", []);
|
21
22
|
|
22
|
-
_defineProperty(this, "
|
23
|
+
_defineProperty(this, "resolvedProps", {});
|
23
24
|
|
24
25
|
_defineProperty(this, "memoizable", false);
|
25
26
|
|
@@ -29,20 +30,21 @@ class Node {
|
|
29
30
|
|
30
31
|
_defineProperty(this, "depMgr", void 0);
|
31
32
|
|
32
|
-
this._props = props;
|
33
33
|
this.depMgr = depMgr;
|
34
|
-
this.
|
34
|
+
this.updatePropSubscriptions(props);
|
35
|
+
}
|
36
|
+
|
37
|
+
updatePropSubscriptions(props) {
|
35
38
|
this.depMgr.subscribeNode(this, props);
|
36
39
|
}
|
37
40
|
|
38
41
|
set props(props) {
|
39
|
-
this.depMgr.
|
40
|
-
this.
|
41
|
-
this._props = props;
|
42
|
+
this.depMgr.unsubscribeNode(this);
|
43
|
+
this.updatePropSubscriptions(props);
|
42
44
|
}
|
43
45
|
|
44
46
|
get props() {
|
45
|
-
return this.
|
47
|
+
return this.resolvedProps;
|
46
48
|
}
|
47
49
|
|
48
50
|
visit(ctx, children) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Node.ts"],"names":["NodeType","Node","constructor","depMgr","props","
|
1
|
+
{"version":3,"sources":["Node.ts"],"names":["NodeType","Node","constructor","depMgr","props","updatePropSubscriptions","subscribeNode","unsubscribeNode","resolvedProps","visit","ctx","children","returnedValues","forEach","child","memoized","memoizable","push","ret","draw"],"mappings":";;;;;;;;;IAKYA,Q;;;WAAAA,Q;AAAAA,EAAAA,Q;AAAAA,EAAAA,Q;GAAAA,Q,wBAAAA,Q;;AAOL,MAAeC,IAAf,CAAiC;AAEtC;AAOAC,EAAAA,WAAW,CAACC,MAAD,EAA4BC,KAA5B,EAAqD;AAAA,sCARpC,EAQoC;;AAAA,2CAN7C,EAM6C;;AAAA,wCALnD,KAKmD;;AAAA,sCAJ3B,IAI2B;;AAAA;;AAAA;;AAC9D,SAAKD,MAAL,GAAcA,MAAd;AACA,SAAKE,uBAAL,CAA6BD,KAA7B;AACD;;AAIDC,EAAAA,uBAAuB,CAACD,KAAD,EAA0B;AAC/C,SAAKD,MAAL,CAAYG,aAAZ,CAA0B,IAA1B,EAAgCF,KAAhC;AACD;;AAEQ,MAALA,KAAK,CAACA,KAAD,EAA0B;AACjC,SAAKD,MAAL,CAAYI,eAAZ,CAA4B,IAA5B;AACA,SAAKF,uBAAL,CAA6BD,KAA7B;AACD;;AAEQ,MAALA,KAAK,GAAM;AACb,WAAO,KAAKI,aAAZ;AACD;;AAEDC,EAAAA,KAAK,CAACC,GAAD,EAAsBC,QAAtB,EAAyC;AAC5C,UAAMC,cAAkD,GAAG,EAA3D;AACA,KAACD,QAAD,aAACA,QAAD,cAACA,QAAD,GAAa,KAAKA,QAAlB,EAA4BE,OAA5B,CAAqCC,KAAD,IAAW;AAC7C,UAAIA,KAAK,CAACC,QAAN,IAAkBD,KAAK,CAACE,UAA5B,EAAwC;AACtCJ,QAAAA,cAAc,CAACK,IAAf,CAAoBH,KAAK,CAACC,QAA1B;AACD,OAFD,MAEO;AACL,cAAMG,GAAG,GAAGJ,KAAK,CAACK,IAAN,CAAWT,GAAX,CAAZ;;AACA,YAAIQ,GAAJ,EAAS;AACPN,UAAAA,cAAc,CAACK,IAAf,CAAoBC,GAApB;;AACA,cAAIJ,KAAK,CAACE,UAAV,EAAsB;AACpBF,YAAAA,KAAK,CAACC,QAAN,GAAiBG,GAAjB;AACD;AACF;AACF;AACF,KAZD;AAaA,WAAON,cAAP;AACD;;AA7CqC","sourcesContent":["import type { SkJSIInstance } from \"../../skia/types\";\nimport type { DependencyManager } from \"../DependencyManager\";\nimport type { DrawingContext } from \"../DrawingContext\";\nimport type { AnimatedProps } from \"../processors\";\n\nexport enum NodeType {\n Declaration = \"skDeclaration\",\n Drawing = \"skDrawing\",\n}\n\ntype DeclarationResult = SkJSIInstance<string> | null;\n\nexport abstract class Node<P = unknown> {\n readonly children: Node[] = [];\n // This cast is ok because we understand that the dependency manager will setup the initial props\n resolvedProps: P = {} as P;\n memoizable = false;\n memoized: DeclarationResult | null = null;\n parent?: Node;\n depMgr: DependencyManager;\n\n constructor(depMgr: DependencyManager, props: AnimatedProps<P>) {\n this.depMgr = depMgr;\n this.updatePropSubscriptions(props);\n }\n\n abstract draw(ctx: DrawingContext): void | DeclarationResult;\n\n updatePropSubscriptions(props: AnimatedProps<P>) {\n this.depMgr.subscribeNode(this, props);\n }\n\n set props(props: AnimatedProps<P>) {\n this.depMgr.unsubscribeNode(this);\n this.updatePropSubscriptions(props);\n }\n\n get props(): P {\n return this.resolvedProps;\n }\n\n visit(ctx: DrawingContext, children?: Node[]) {\n const returnedValues: Exclude<DeclarationResult, null>[] = [];\n (children ?? this.children).forEach((child) => {\n if (child.memoized && child.memoizable) {\n returnedValues.push(child.memoized);\n } else {\n const ret = child.draw(ctx);\n if (ret) {\n returnedValues.push(ret);\n if (child.memoizable) {\n child.memoized = ret;\n }\n }\n }\n });\n return returnedValues;\n }\n}\n"]}
|
@@ -3,9 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
7
|
-
|
8
|
-
var _typeddash = require("../../typeddash");
|
6
|
+
exports.isValue = exports.isSelector = exports.isAnimated = void 0;
|
9
7
|
|
10
8
|
const isValue = value => {
|
11
9
|
if (value === undefined || value === null) {
|
@@ -23,30 +21,26 @@ const isValue = value => {
|
|
23
21
|
|
24
22
|
exports.isValue = isValue;
|
25
23
|
|
24
|
+
const isSelector = value => {
|
25
|
+
if (value) {
|
26
|
+
return typeof value === "object" && "selector" in value && "value" in value && value.selector !== undefined && value.value !== undefined;
|
27
|
+
}
|
28
|
+
|
29
|
+
return false;
|
30
|
+
};
|
31
|
+
|
32
|
+
exports.isSelector = isSelector;
|
33
|
+
|
26
34
|
const isAnimated = props => {
|
27
35
|
for (const value of Object.values(props)) {
|
28
|
-
if (isValue(value)) {
|
36
|
+
if (isValue(value) || isSelector(value)) {
|
29
37
|
return true;
|
30
38
|
}
|
31
39
|
}
|
32
40
|
|
33
41
|
return false;
|
34
|
-
};
|
35
|
-
|
36
|
-
exports.isAnimated = isAnimated;
|
42
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
37
43
|
|
38
|
-
const materialize = props => {
|
39
|
-
const result = { ...props
|
40
|
-
};
|
41
|
-
(0, _typeddash.mapKeys)(props).forEach(key => {
|
42
|
-
const value = props[key];
|
43
44
|
|
44
|
-
|
45
|
-
result[key] = value.current;
|
46
|
-
}
|
47
|
-
});
|
48
|
-
return result;
|
49
|
-
};
|
50
|
-
|
51
|
-
exports.materialize = materialize;
|
45
|
+
exports.isAnimated = isAnimated;
|
52
46
|
//# sourceMappingURL=Animations.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Animations.ts"],"names":["isValue","value","undefined","__typename__","
|
1
|
+
{"version":3,"sources":["Animations.ts"],"names":["isValue","value","undefined","__typename__","isSelector","selector","isAnimated","props","Object","values"],"mappings":";;;;;;;AAEO,MAAMA,OAAO,GAAIC,KAAD,IAAiD;AACtE,MAAIA,KAAK,KAAKC,SAAV,IAAuBD,KAAK,KAAK,IAArC,EAA2C;AACzC,WAAO,KAAP;AACD;;AACD,MAAI;AACF,QACE,OAAOA,KAAP,KAAiB,QAAjB,IACA,kBAAkBA,KADlB,IAECA,KAAD,CAAyCE,YAAzC,KAA0D,WAH5D,EAIE;AACA,aAAO,IAAP;AACD;AACF,GARD,CAQE,MAAM,CAAE;;AACV,SAAO,KAAP;AACD,CAdM;;;;AAgBA,MAAMC,UAAU,GACrBH,KADwB,IAKrB;AACH,MAAIA,KAAJ,EAAW;AACT,WACE,OAAOA,KAAP,KAAiB,QAAjB,IACA,cAAcA,KADd,IAEA,WAAWA,KAFX,IAGCA,KAAD,CAAmCI,QAAnC,KAAgDH,SAHhD,IAICD,KAAD,CAAmCA,KAAnC,KAA6CC,SAL/C;AAOD;;AACD,SAAO,KAAP;AACD,CAhBM;;;;AAkBA,MAAMI,UAAU,GAAOC,KAAJ,IAAgC;AACxD,OAAK,MAAMN,KAAX,IAAoBO,MAAM,CAACC,MAAP,CAAcF,KAAd,CAApB,EAA0C;AACxC,QAAIP,OAAO,CAACC,KAAD,CAAP,IAAkBG,UAAU,CAACH,KAAD,CAAhC,EAAyC;AACvC,aAAO,IAAP;AACD;AACF;;AACD,SAAO,KAAP;AACD,CAPM,C,CASP","sourcesContent":["import type { SkiaSelector, SkiaValue } from \"../../../values\";\n\nexport const isValue = (value: unknown): value is SkiaValue<unknown> => {\n if (value === undefined || value === null) {\n return false;\n }\n try {\n if (\n typeof value === \"object\" &&\n \"__typename__\" in value &&\n (value as unknown as SkiaValue<unknown>).__typename__ === \"RNSkValue\"\n ) {\n return true;\n }\n } catch {}\n return false;\n};\n\nexport const isSelector = <T, R>(\n value: unknown\n): value is {\n selector: (v: T) => R;\n value: SkiaValue<T>;\n} => {\n if (value) {\n return (\n typeof value === \"object\" &&\n \"selector\" in value &&\n \"value\" in value &&\n (value as Record<string, unknown>).selector !== undefined &&\n (value as Record<string, unknown>).value !== undefined\n );\n }\n return false;\n};\n\nexport const isAnimated = <T>(props: AnimatedProps<T>) => {\n for (const value of Object.values(props)) {\n if (isValue(value) || isSelector(value)) {\n return true;\n }\n }\n return false;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnimatedProp<T, P = any> = T | SkiaValue<T> | SkiaSelector<T, P>;\n\nexport type AnimatedProps<T> = {\n [K in keyof T]: AnimatedProp<T[K]>;\n};\n"]}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.useRawData = exports.
|
6
|
+
exports.useRawData = exports.useData = void 0;
|
7
7
|
|
8
8
|
var _react = require("react");
|
9
9
|
|
@@ -11,8 +11,10 @@ var _reactNative = require("react-native");
|
|
11
11
|
|
12
12
|
var _Skia = require("../Skia");
|
13
13
|
|
14
|
+
var _types = require("../types");
|
15
|
+
|
14
16
|
const resolveAsset = source => {
|
15
|
-
return
|
17
|
+
return (0, _types.isRNModule)(source) ? _reactNative.Image.resolveAssetSource(source).uri : source.default;
|
16
18
|
};
|
17
19
|
|
18
20
|
const factoryWrapper = (data2, factory, onError) => {
|
@@ -26,10 +28,8 @@ const factoryWrapper = (data2, factory, onError) => {
|
|
26
28
|
}
|
27
29
|
};
|
28
30
|
|
29
|
-
const loadDataCollection = (sources, factory, onError) => Promise.all(sources.map(source => loadData(source, factory, onError)));
|
30
|
-
|
31
31
|
const loadData = (source, factory, onError) => {
|
32
|
-
if (source === null) {
|
32
|
+
if (source === null || source === undefined) {
|
33
33
|
return new Promise(resolve => resolve(null));
|
34
34
|
} else if (source instanceof Uint8Array) {
|
35
35
|
return new Promise(resolve => resolve(factoryWrapper(_Skia.Skia.Data.fromBytes(source), factory, onError)));
|
@@ -39,33 +39,21 @@ const loadData = (source, factory, onError) => {
|
|
39
39
|
}
|
40
40
|
};
|
41
41
|
|
42
|
-
const useLoading =
|
43
|
-
let deps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
42
|
+
const useLoading = (source, loader) => {
|
44
43
|
const [data, setData] = (0, _react.useState)(null);
|
45
|
-
const prevSourceRef = (0, _react.useRef)();
|
46
44
|
(0, _react.useEffect)(() => {
|
47
|
-
|
48
|
-
|
49
|
-
loader().then(setData);
|
50
|
-
} else {
|
51
|
-
setData(null);
|
52
|
-
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
53
|
-
|
54
|
-
}, deps);
|
45
|
+
loader().then(setData); // eslint-disable-next-line react-hooks/exhaustive-deps
|
46
|
+
}, [source]);
|
55
47
|
return data;
|
56
48
|
};
|
57
49
|
|
58
|
-
const
|
59
|
-
|
60
|
-
exports.useDataCollection = useDataCollection;
|
61
|
-
|
62
|
-
const useRawData = (source, factory, onError, deps) => useLoading(source, () => loadData(source, factory, onError), deps);
|
50
|
+
const useRawData = (source, factory, onError) => useLoading(source, () => loadData(source, factory, onError));
|
63
51
|
|
64
52
|
exports.useRawData = useRawData;
|
65
53
|
|
66
54
|
const identity = data => data;
|
67
55
|
|
68
|
-
const useData = (source, onError
|
56
|
+
const useData = (source, onError) => useRawData(source, identity, onError);
|
69
57
|
|
70
58
|
exports.useData = useData;
|
71
59
|
//# sourceMappingURL=Data.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Data.ts"],"names":["resolveAsset","source","
|
1
|
+
{"version":3,"sources":["Data.ts"],"names":["resolveAsset","source","Image","resolveAssetSource","uri","default","factoryWrapper","data2","factory","onError","factoryResult","Error","loadData","undefined","Promise","resolve","Uint8Array","Skia","Data","fromBytes","fromURI","then","d","useLoading","loader","data","setData","useRawData","identity","useData"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AAGA,MAAMA,YAAY,GAAIC,MAAD,IAAwB;AAC3C,SAAO,uBAAWA,MAAX,IACHC,mBAAMC,kBAAN,CAAyBF,MAAzB,EAAiCG,GAD9B,GAEHH,MAAM,CAACI,OAFX;AAGD,CAJD;;AAMA,MAAMC,cAAc,GAAG,CACrBC,KADqB,EAErBC,OAFqB,EAGrBC,OAHqB,KAIlB;AACH,QAAMC,aAAa,GAAGF,OAAO,CAACD,KAAD,CAA7B;;AACA,MAAIG,aAAa,KAAK,IAAtB,EAA4B;AAC1BD,IAAAA,OAAO,IAAIA,OAAO,CAAC,IAAIE,KAAJ,CAAU,qBAAV,CAAD,CAAlB;AACA,WAAO,IAAP;AACD,GAHD,MAGO;AACL,WAAOD,aAAP;AACD;AACF,CAZD;;AAcA,MAAME,QAAQ,GAAG,CACfX,MADe,EAEfO,OAFe,EAGfC,OAHe,KAIO;AACtB,MAAIR,MAAM,KAAK,IAAX,IAAmBA,MAAM,KAAKY,SAAlC,EAA6C;AAC3C,WAAO,IAAIC,OAAJ,CAAaC,OAAD,IAAaA,OAAO,CAAC,IAAD,CAAhC,CAAP;AACD,GAFD,MAEO,IAAId,MAAM,YAAYe,UAAtB,EAAkC;AACvC,WAAO,IAAIF,OAAJ,CAAaC,OAAD,IACjBA,OAAO,CAACT,cAAc,CAACW,WAAKC,IAAL,CAAUC,SAAV,CAAoBlB,MAApB,CAAD,EAA8BO,OAA9B,EAAuCC,OAAvC,CAAf,CADF,CAAP;AAGD,GAJM,MAIA;AACL,UAAML,GAAG,GAAG,OAAOH,MAAP,KAAkB,QAAlB,GAA6BA,MAA7B,GAAsCD,YAAY,CAACC,MAAD,CAA9D;AACA,WAAOgB,WAAKC,IAAL,CAAUE,OAAV,CAAkBhB,GAAlB,EAAuBiB,IAAvB,CAA6BC,CAAD,IACjChB,cAAc,CAACgB,CAAD,EAAId,OAAJ,EAAaC,OAAb,CADT,CAAP;AAGD;AACF,CAjBD;;AAkBA,MAAMc,UAAU,GAAG,CACjBtB,MADiB,EAEjBuB,MAFiB,KAGd;AACH,QAAM,CAACC,IAAD,EAAOC,OAAP,IAAkB,qBAAmB,IAAnB,CAAxB;AACA,wBAAU,MAAM;AACdF,IAAAA,MAAM,GAAGH,IAAT,CAAcK,OAAd,EADc,CAEd;AACD,GAHD,EAGG,CAACzB,MAAD,CAHH;AAIA,SAAOwB,IAAP;AACD,CAVD;;AAYO,MAAME,UAAU,GAAG,CACxB1B,MADwB,EAExBO,OAFwB,EAGxBC,OAHwB,KAIrBc,UAAU,CAACtB,MAAD,EAAS,MAAMW,QAAQ,CAACX,MAAD,EAASO,OAAT,EAAkBC,OAAlB,CAAvB,CAJR;;;;AAMP,MAAMmB,QAAQ,GAAIH,IAAD,IAAkBA,IAAnC;;AAEO,MAAMI,OAAO,GAAG,CACrB5B,MADqB,EAErBQ,OAFqB,KAGlBkB,UAAU,CAAC1B,MAAD,EAAS2B,QAAT,EAAmBnB,OAAnB,CAHR","sourcesContent":["import { useEffect, useState } from \"react\";\nimport { Image } from \"react-native\";\n\nimport { Skia } from \"../Skia\";\nimport { isRNModule } from \"../types\";\nimport type { SkData, DataModule, DataSourceParam } from \"../types\";\n\nconst resolveAsset = (source: DataModule) => {\n return isRNModule(source)\n ? Image.resolveAssetSource(source).uri\n : source.default;\n};\n\nconst factoryWrapper = <T>(\n data2: SkData,\n factory: (data: SkData) => T,\n onError?: (err: Error) => void\n) => {\n const factoryResult = factory(data2);\n if (factoryResult === null) {\n onError && onError(new Error(\"Could not load data\"));\n return null;\n } else {\n return factoryResult;\n }\n};\n\nconst loadData = <T>(\n source: DataSourceParam,\n factory: (data: SkData) => T,\n onError?: (err: Error) => void\n): Promise<T | null> => {\n if (source === null || source === undefined) {\n return new Promise((resolve) => resolve(null));\n } else if (source instanceof Uint8Array) {\n return new Promise((resolve) =>\n resolve(factoryWrapper(Skia.Data.fromBytes(source), factory, onError))\n );\n } else {\n const uri = typeof source === \"string\" ? source : resolveAsset(source);\n return Skia.Data.fromURI(uri).then((d) =>\n factoryWrapper(d, factory, onError)\n );\n }\n};\nconst useLoading = <T>(\n source: DataSourceParam,\n loader: () => Promise<T | null>\n) => {\n const [data, setData] = useState<T | null>(null);\n useEffect(() => {\n loader().then(setData);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [source]);\n return data;\n};\n\nexport const useRawData = <T>(\n source: DataSourceParam,\n factory: (data: SkData) => T,\n onError?: (err: Error) => void\n) => useLoading(source, () => loadData(source, factory, onError));\n\nconst identity = (data: SkData) => data;\n\nexport const useData = (\n source: DataSourceParam,\n onError?: (err: Error) => void\n) => useRawData(source, identity, onError);\n"]}
|
@@ -25,9 +25,8 @@ const useFont = (font, size, onError) => {
|
|
25
25
|
return _Skia.Skia.Font(typeface);
|
26
26
|
} else {
|
27
27
|
return null;
|
28
|
-
}
|
29
|
-
|
30
|
-
}, [typeface]);
|
28
|
+
}
|
29
|
+
}, [size, typeface]);
|
31
30
|
};
|
32
31
|
|
33
32
|
exports.useFont = useFont;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Font.ts"],"names":["useFont","font","size","onError","typeface","Skia","Font"],"mappings":";;;;;;;AACA;;AAEA;;AAGA;;AANA;;AAQA;AACA;AACA;AACO,MAAMA,OAAO,GAAG,CACrBC,IADqB,EAErBC,IAFqB,EAGrBC,OAHqB,
|
1
|
+
{"version":3,"sources":["Font.ts"],"names":["useFont","font","size","onError","typeface","Skia","Font"],"mappings":";;;;;;;AACA;;AAEA;;AAGA;;AANA;;AAQA;AACA;AACA;AACO,MAAMA,OAAO,GAAG,CACrBC,IADqB,EAErBC,IAFqB,EAGrBC,OAHqB,KAIlB;AACH,QAAMC,QAAQ,GAAG,2BAAYH,IAAZ,EAAkBE,OAAlB,CAAjB;AACA,SAAO,oBAAQ,MAAM;AACnB,QAAIC,QAAQ,IAAIF,IAAhB,EAAsB;AACpB,aAAOG,WAAKC,IAAL,CAAUF,QAAV,EAAoBF,IAApB,CAAP;AACD,KAFD,MAEO,IAAIE,QAAQ,IAAI,CAACF,IAAjB,EAAuB;AAC5B,aAAOG,WAAKC,IAAL,CAAUF,QAAV,CAAP;AACD,KAFM,MAEA;AACL,aAAO,IAAP;AACD;AACF,GARM,EAQJ,CAACF,IAAD,EAAOE,QAAP,CARI,CAAP;AASD,CAfM","sourcesContent":["/*global SkiaApi*/\nimport { useMemo } from \"react\";\n\nimport { Skia } from \"../Skia\";\nimport type { DataSourceParam } from \"../types\";\n\nimport { useTypeface } from \"./Typeface\";\n\n/**\n * Returns a Skia Font object\n * */\nexport const useFont = (\n font: DataSourceParam,\n size?: number,\n onError?: (err: Error) => void\n) => {\n const typeface = useTypeface(font, onError);\n return useMemo(() => {\n if (typeface && size) {\n return Skia.Font(typeface, size);\n } else if (typeface && !size) {\n return Skia.Font(typeface);\n } else {\n return null;\n }\n }, [size, typeface]);\n};\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Image.ts"],"names":["imgFactory","Skia","Image","MakeImageFromEncoded","bind","useImage","source","onError"],"mappings":";;;;;;;AAAA;;AAGA;;AAEA,MAAMA,UAAU,GAAGC,WAAKC,KAAL,CAAWC,oBAAX,CAAgCC,IAAhC,CAAqCH,WAAKC,KAA1C,CAAnB;AAEA;AACA;AACA;;;AACO,MAAMG,QAAQ,GAAG,CACtBC,MADsB,EAEtBC,OAFsB,KAGnB,sBAAWD,MAAX,EAAmBN,UAAnB,EAA+BO,OAA/B,CAHE","sourcesContent":["import { Skia } from \"../Skia\";\nimport type {
|
1
|
+
{"version":3,"sources":["Image.ts"],"names":["imgFactory","Skia","Image","MakeImageFromEncoded","bind","useImage","source","onError"],"mappings":";;;;;;;AAAA;;AAGA;;AAEA,MAAMA,UAAU,GAAGC,WAAKC,KAAL,CAAWC,oBAAX,CAAgCC,IAAhC,CAAqCH,WAAKC,KAA1C,CAAnB;AAEA;AACA;AACA;;;AACO,MAAMG,QAAQ,GAAG,CACtBC,MADsB,EAEtBC,OAFsB,KAGnB,sBAAWD,MAAX,EAAmBN,UAAnB,EAA+BO,OAA/B,CAHE","sourcesContent":["import { Skia } from \"../Skia\";\nimport type { DataSourceParam } from \"../types\";\n\nimport { useRawData } from \"./Data\";\n\nconst imgFactory = Skia.Image.MakeImageFromEncoded.bind(Skia.Image);\n\n/**\n * Returns a Skia Image object\n * */\nexport const useImage = (\n source: DataSourceParam,\n onError?: (err: Error) => void\n) => useRawData(source, imgFactory, onError);\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["SVG.ts"],"names":["svgFactory","Skia","SVG","MakeFromData","bind","useSVG","source","onError"],"mappings":";;;;;;;AAAA;;AAGA;;AAEA,MAAMA,UAAU,GAAGC,WAAKC,GAAL,CAASC,YAAT,CAAsBC,IAAtB,CAA2BH,WAAKC,GAAhC,CAAnB;;AAEO,MAAMG,MAAM,GAAG,CACpBC,MADoB,EAEpBC,OAFoB,KAGjB,sBAAWD,MAAX,EAAmBN,UAAnB,EAA+BO,OAA/B,CAHE","sourcesContent":["import { Skia } from \"../Skia\";\nimport type {
|
1
|
+
{"version":3,"sources":["SVG.ts"],"names":["svgFactory","Skia","SVG","MakeFromData","bind","useSVG","source","onError"],"mappings":";;;;;;;AAAA;;AAGA;;AAEA,MAAMA,UAAU,GAAGC,WAAKC,GAAL,CAASC,YAAT,CAAsBC,IAAtB,CAA2BH,WAAKC,GAAhC,CAAnB;;AAEO,MAAMG,MAAM,GAAG,CACpBC,MADoB,EAEpBC,OAFoB,KAGjB,sBAAWD,MAAX,EAAmBN,UAAnB,EAA+BO,OAA/B,CAHE","sourcesContent":["import { Skia } from \"../Skia\";\nimport type { DataSourceParam } from \"../types\";\n\nimport { useRawData } from \"./Data\";\n\nconst svgFactory = Skia.SVG.MakeFromData.bind(Skia.SVG);\n\nexport const useSVG = (\n source: DataSourceParam,\n onError?: (err: Error) => void\n) => useRawData(source, svgFactory, onError);\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Typeface.ts"],"names":["tfFactory","Skia","Typeface","MakeFreeTypeFaceFromData","bind","useTypeface","source","onError"],"mappings":";;;;;;;AAAA;;AAGA;;AAEA,MAAMA,SAAS,GAAGC,WAAKC,QAAL,CAAcC,wBAAd,CAAuCC,IAAvC,CAA4CH,WAAKC,QAAjD,CAAlB;AAEA;AACA;AACA;;;AACO,MAAMG,WAAW,GAAG,CACzBC,MADyB,EAEzBC,OAFyB,KAGtB,sBAAWD,MAAX,EAAmBN,SAAnB,EAA8BO,OAA9B,CAHE","sourcesContent":["import { Skia } from \"../Skia\";\nimport type {
|
1
|
+
{"version":3,"sources":["Typeface.ts"],"names":["tfFactory","Skia","Typeface","MakeFreeTypeFaceFromData","bind","useTypeface","source","onError"],"mappings":";;;;;;;AAAA;;AAGA;;AAEA,MAAMA,SAAS,GAAGC,WAAKC,QAAL,CAAcC,wBAAd,CAAuCC,IAAvC,CAA4CH,WAAKC,QAAjD,CAAlB;AAEA;AACA;AACA;;;AACO,MAAMG,WAAW,GAAG,CACzBC,MADyB,EAEzBC,OAFyB,KAGtB,sBAAWD,MAAX,EAAmBN,SAAnB,EAA8BO,OAA9B,CAHE","sourcesContent":["import { Skia } from \"../Skia\";\nimport type { DataSourceParam } from \"../types\";\n\nimport { useRawData } from \"./Data\";\n\nconst tfFactory = Skia.Typeface.MakeFreeTypeFaceFromData.bind(Skia.Typeface);\n\n/**\n * Returns a Skia Typeface object\n * */\nexport const useTypeface = (\n source: DataSourceParam,\n onError?: (err: Error) => void\n) => useRawData(source, tfFactory, onError);\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
1
|
+
{"version":3,"sources":["Data.ts"],"names":["isRNModule","mod"],"mappings":";;;;;;;AAaO,MAAMA,UAAU,GAAIC,GAAD,IACxB,OAAOA,GAAP,KAAe,QADV","sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\n\nexport type SkData = SkJSIInstance<\"Data\">;\n\ntype RNModule = number;\ntype ESModule = {\n __esModule: true;\n default: string;\n};\nexport type DataModule = RNModule | ESModule;\nexport type DataSource = DataModule | string | Uint8Array;\nexport type DataSourceParam = DataSource | null | undefined;\n\nexport const isRNModule = (mod: DataModule): mod is RNModule =>\n typeof mod === \"number\";\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Paint.ts"],"names":["PaintStyle","StrokeCap","StrokeJoin","isPaint","obj","__typename__"],"mappings":";;;;;;IAUYA,U;;;WAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,0BAAAA,U;;IAKAC,S;;;WAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;GAAAA,S,yBAAAA,S;;IAMAC,U;;;WAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,0BAAAA,U;;AAML,MAAMC,OAAO,GAAIC,GAAD,IACrBA,GAAG,KAAK,IAAR,IAAgBA,GAAG,CAACC,YAAJ,KAAqB,OADhC","sourcesContent":["import type { SkImageFilter } from \"../ImageFilter\";\nimport type { SkMaskFilter } from \"../MaskFilter\";\nimport type { SkColorFilter } from \"../ColorFilter\";\nimport type { SkColor } from \"../Color\";\nimport type { SkPathEffect } from \"../PathEffect\";\nimport type { SkJSIInstance } from \"../JsiInstance\";\nimport type { SkShader } from \"../Shader\";\n\nimport type { BlendMode } from \"./BlendMode\";\n\nexport enum PaintStyle {\n Fill,\n Stroke,\n}\n\nexport enum StrokeCap {\n Butt,\n Round,\n Square,\n}\n\nexport enum StrokeJoin {\n Miter,\n Round,\n Bevel,\n}\n\nexport const isPaint = (obj: SkJSIInstance<string> | null): obj is SkPaint =>\n obj !== null && obj.__typename__ === \"Paint\";\n\nexport interface SkPaint extends SkJSIInstance<\"Paint\"> {\n /**\n * Returns a copy of this paint.\n */\n copy(): SkPaint;\n\n /**\n * Retrieves the alpha and RGB unpremultiplied. RGB are extended sRGB values\n * (sRGB gamut, and encoded with the sRGB transfer function).\n */\n getColor(): SkColor;\n\n /**\n * Returns the geometry drawn at the beginning and end of strokes.\n */\n getStrokeCap(): StrokeCap;\n\n /**\n * Returns the geometry drawn at the corners of strokes.\n */\n getStrokeJoin(): StrokeJoin;\n\n /**\n * Returns the limit at which a sharp corner is drawn beveled.\n */\n getStrokeMiter(): number;\n\n /**\n * Returns the thickness of the pen used to outline the shape.\n */\n getStrokeWidth(): number;\n\n /**\n * Replaces alpha, leaving RGBA unchanged. 0 means fully transparent, 1.0 means opaque.\n * @param alpha\n */\n setAlphaf(alpha: number): void;\n\n /**\n * Requests, but does not require, that edge pixels draw opaque or with\n * partial transparency.\n * @param aa\n */\n setAntiAlias: (aa: boolean) => void;\n\n /**\n * Sets the blend mode that is, the mode used to combine source color\n * with destination color.\n * @param mode\n */\n setBlendMode: (blendMode: BlendMode) => void;\n\n /**\n * Sets alpha and RGB used when stroking and filling. The color is a 32-bit\n * value, unpremultiplied, packing 8-bit components for alpha, red, blue,\n * and green.\n *\n * @param color unpremultiplied ARGB\n *\n * example: https://fiddle.skia.org/c/@Paint_setColor\n */\n setColor(color: SkColor): void;\n\n /**\n * Sets the current color filter, replacing the existing one if there was one.\n * @param filter\n */\n setColorFilter(filter: SkColorFilter | null): void;\n\n /**\n * Sets the current image filter, replacing the existing one if there was one.\n * @param filter\n */\n setImageFilter(filter: SkImageFilter | null): void;\n\n /**\n * Sets the current mask filter, replacing the existing one if there was one.\n * @param filter\n */\n setMaskFilter(filter: SkMaskFilter | null): void;\n\n /**\n * Sets the current path effect, replacing the existing one if there was one.\n * @param effect\n */\n setPathEffect(effect: SkPathEffect | null): void;\n\n /**\n * Sets the current shader, replacing the existing one if there was one.\n * @param shader\n */\n setShader(shader: SkShader | null): void;\n\n /**\n * Sets the geometry drawn at the beginning and end of strokes.\n * @param cap\n */\n setStrokeCap(cap: StrokeCap): void;\n\n /**\n * Sets the geometry drawn at the corners of strokes.\n * @param join\n */\n setStrokeJoin(join: StrokeJoin): void;\n\n /**\n * Sets the limit at which a sharp corner is drawn beveled.\n * @param limit\n */\n setStrokeMiter(limit: number): void;\n\n /**\n * Sets the thickness of the pen used to outline the shape.\n * @param width\n */\n setStrokeWidth(width: number): void;\n\n /**\n * Sets whether the geometry is filled or stroked.\n * @param style\n */\n setStyle(style: PaintStyle): void;\n}\n"]}
|
1
|
+
{"version":3,"sources":["Paint.ts"],"names":["PaintStyle","StrokeCap","StrokeJoin","isPaint","obj","__typename__"],"mappings":";;;;;;IAUYA,U;;;WAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,0BAAAA,U;;IAKAC,S;;;WAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;GAAAA,S,yBAAAA,S;;IAMAC,U;;;WAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,0BAAAA,U;;AAML,MAAMC,OAAO,GAAIC,GAAD,IACrBA,GAAG,KAAK,IAAR,IAAgBA,GAAG,CAACC,YAAJ,KAAqB,OADhC","sourcesContent":["import type { SkImageFilter } from \"../ImageFilter\";\nimport type { SkMaskFilter } from \"../MaskFilter\";\nimport type { SkColorFilter } from \"../ColorFilter\";\nimport type { SkColor } from \"../Color\";\nimport type { SkPathEffect } from \"../PathEffect\";\nimport type { SkJSIInstance } from \"../JsiInstance\";\nimport type { SkShader } from \"../Shader\";\n\nimport type { BlendMode } from \"./BlendMode\";\n\nexport enum PaintStyle {\n Fill,\n Stroke,\n}\n\nexport enum StrokeCap {\n Butt,\n Round,\n Square,\n}\n\nexport enum StrokeJoin {\n Miter,\n Round,\n Bevel,\n}\n\nexport const isPaint = (obj: SkJSIInstance<string> | null): obj is SkPaint =>\n obj !== null && obj.__typename__ === \"Paint\";\n\nexport interface SkPaint extends SkJSIInstance<\"Paint\"> {\n /**\n * Returns a copy of this paint.\n */\n copy(): SkPaint;\n\n /**\n * Sets all SkPaint contents to their initial values. This is equivalent to replacing\n SkPaint with the result of SkPaint().\n */\n reset(): void;\n\n /**\n * Retrieves the alpha and RGB unpremultiplied. RGB are extended sRGB values\n * (sRGB gamut, and encoded with the sRGB transfer function).\n */\n getColor(): SkColor;\n\n /**\n * Returns the geometry drawn at the beginning and end of strokes.\n */\n getStrokeCap(): StrokeCap;\n\n /**\n * Returns the geometry drawn at the corners of strokes.\n */\n getStrokeJoin(): StrokeJoin;\n\n /**\n * Returns the limit at which a sharp corner is drawn beveled.\n */\n getStrokeMiter(): number;\n\n /**\n * Returns the thickness of the pen used to outline the shape.\n */\n getStrokeWidth(): number;\n\n /**\n * Replaces alpha, leaving RGBA unchanged. 0 means fully transparent, 1.0 means opaque.\n * @param alpha\n */\n setAlphaf(alpha: number): void;\n\n /**\n * Requests, but does not require, that edge pixels draw opaque or with\n * partial transparency.\n * @param aa\n */\n setAntiAlias: (aa: boolean) => void;\n\n /**\n * Sets the blend mode that is, the mode used to combine source color\n * with destination color.\n * @param mode\n */\n setBlendMode: (blendMode: BlendMode) => void;\n\n /**\n * Sets alpha and RGB used when stroking and filling. The color is a 32-bit\n * value, unpremultiplied, packing 8-bit components for alpha, red, blue,\n * and green.\n *\n * @param color unpremultiplied ARGB\n *\n * example: https://fiddle.skia.org/c/@Paint_setColor\n */\n setColor(color: SkColor): void;\n\n /**\n * Sets the current color filter, replacing the existing one if there was one.\n * @param filter\n */\n setColorFilter(filter: SkColorFilter | null): void;\n\n /**\n * Sets the current image filter, replacing the existing one if there was one.\n * @param filter\n */\n setImageFilter(filter: SkImageFilter | null): void;\n\n /**\n * Sets the current mask filter, replacing the existing one if there was one.\n * @param filter\n */\n setMaskFilter(filter: SkMaskFilter | null): void;\n\n /**\n * Sets the current path effect, replacing the existing one if there was one.\n * @param effect\n */\n setPathEffect(effect: SkPathEffect | null): void;\n\n /**\n * Sets the current shader, replacing the existing one if there was one.\n * @param shader\n */\n setShader(shader: SkShader | null): void;\n\n /**\n * Sets the geometry drawn at the beginning and end of strokes.\n * @param cap\n */\n setStrokeCap(cap: StrokeCap): void;\n\n /**\n * Sets the geometry drawn at the corners of strokes.\n * @param join\n */\n setStrokeJoin(join: StrokeJoin): void;\n\n /**\n * Sets the limit at which a sharp corner is drawn beveled.\n * @param limit\n */\n setStrokeMiter(limit: number): void;\n\n /**\n * Sets the thickness of the pen used to outline the shape.\n * @param width\n */\n setStrokeWidth(width: number): void;\n\n /**\n * Sets whether the geometry is filled or stroked.\n * @param style\n */\n setStyle(style: PaintStyle): void;\n}\n"]}
|
@@ -3,14 +3,13 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.optEnum = exports.ckEnum = exports.NotImplementedOnRNWeb = exports.HostObject = exports.Host = exports.BaseHostObject = void 0;
|
7
7
|
|
8
8
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
9
9
|
|
10
|
-
/* eslint-disable no-nested-ternary */
|
11
10
|
class NotImplementedOnRNWeb extends Error {
|
12
|
-
constructor() {
|
13
|
-
super("Not implemented on React Native Web");
|
11
|
+
constructor(msg) {
|
12
|
+
super(msg !== null && msg !== void 0 ? msg : "Not implemented on React Native Web");
|
14
13
|
}
|
15
14
|
|
16
15
|
}
|
@@ -28,7 +27,7 @@ class Host {
|
|
28
27
|
|
29
28
|
exports.Host = Host;
|
30
29
|
|
31
|
-
class
|
30
|
+
class BaseHostObject extends Host {
|
32
31
|
constructor(CanvasKit, ref, typename) {
|
33
32
|
super(CanvasKit);
|
34
33
|
|
@@ -40,26 +39,18 @@ class HostObject extends Host {
|
|
40
39
|
this.__typename__ = typename;
|
41
40
|
}
|
42
41
|
|
43
|
-
}
|
44
|
-
|
45
|
-
|
46
|
-
exports.HostObject = HostObject;
|
47
|
-
|
48
|
-
const toOptionalValue = value => value === undefined ? undefined : value === null ? null : toValue(value);
|
49
|
-
|
50
|
-
exports.toOptionalValue = toOptionalValue;
|
51
|
-
|
52
|
-
const toUndefinedableValue = value => value === undefined ? undefined : toValue(value);
|
53
|
-
|
54
|
-
exports.toUndefinedableValue = toUndefinedableValue;
|
42
|
+
}
|
55
43
|
|
56
|
-
|
44
|
+
exports.BaseHostObject = BaseHostObject;
|
57
45
|
|
58
|
-
|
46
|
+
class HostObject extends BaseHostObject {
|
47
|
+
static fromValue(value) {
|
48
|
+
return value.ref;
|
49
|
+
}
|
59
50
|
|
60
|
-
|
51
|
+
}
|
61
52
|
|
62
|
-
exports.
|
53
|
+
exports.HostObject = HostObject;
|
63
54
|
|
64
55
|
const ckEnum = value => ({
|
65
56
|
value
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Host.ts"],"names":["NotImplementedOnRNWeb","Error","constructor","Host","CanvasKit","
|
1
|
+
{"version":3,"sources":["Host.ts"],"names":["NotImplementedOnRNWeb","Error","constructor","msg","Host","CanvasKit","BaseHostObject","ref","typename","__typename__","HostObject","fromValue","value","ckEnum","optEnum","undefined"],"mappings":";;;;;;;;;AAIO,MAAMA,qBAAN,SAAoCC,KAApC,CAA0C;AAC/CC,EAAAA,WAAW,CAACC,GAAD,EAAe;AACxB,UAAMA,GAAN,aAAMA,GAAN,cAAMA,GAAN,GAAa,qCAAb;AACD;;AAH8C;;;;AAM1C,MAAeC,IAAf,CAAoB;AAGzBF,EAAAA,WAAW,CAACG,SAAD,EAAuB;AAAA;;AAChC,SAAKA,SAAL,GAAiBA,SAAjB;AACD;;AALwB;;;;AAQpB,MAAeC,cAAf,SACGF,IADH,CAGP;AAIEF,EAAAA,WAAW,CAACG,SAAD,EAAuBE,GAAvB,EAA+BC,QAA/B,EAA4C;AACrD,UAAMH,SAAN;;AADqD;;AAAA;;AAErD,SAAKE,GAAL,GAAWA,GAAX;AACA,SAAKE,YAAL,GAAoBD,QAApB;AACD;;AARH;;;;AAWO,MAAeE,UAAf,SAAuDJ,cAAvD,CAGL;AACgB,SAATK,SAAS,CAAIC,KAAJ,EAAkC;AAChD,WAAQA,KAAD,CAAiCL,GAAxC;AACD;;AAHD;;;;AAMK,MAAMM,MAAM,GAAID,KAAD,KAAsC;AAAEA,EAAAA;AAAF,CAAtC,CAAf;;;;AACA,MAAME,OAAO,GAClBF,KADqB,IAGrBA,KAAK,KAAKG,SAAV,GAAsBA,SAAtB,GAAkC;AAAEH,EAAAA;AAAF,CAH7B","sourcesContent":["import type { CanvasKit, EmbindEnumEntity } from \"canvaskit-wasm\";\n\nimport type { SkJSIInstance } from \"../types\";\n\nexport class NotImplementedOnRNWeb extends Error {\n constructor(msg?: string) {\n super(msg ?? \"Not implemented on React Native Web\");\n }\n}\n\nexport abstract class Host {\n readonly CanvasKit: CanvasKit;\n\n constructor(CanvasKit: CanvasKit) {\n this.CanvasKit = CanvasKit;\n }\n}\n\nexport abstract class BaseHostObject<T, N extends string>\n extends Host\n implements SkJSIInstance<N>\n{\n readonly __typename__: N;\n ref: T;\n\n constructor(CanvasKit: CanvasKit, ref: T, typename: N) {\n super(CanvasKit);\n this.ref = ref;\n this.__typename__ = typename;\n }\n}\n\nexport abstract class HostObject<T, N extends string> extends BaseHostObject<\n T,\n N\n> {\n static fromValue<T>(value: SkJSIInstance<string>) {\n return (value as HostObject<T, string>).ref;\n }\n}\n\nexport const ckEnum = (value: number): EmbindEnumEntity => ({ value });\nexport const optEnum = (\n value: number | undefined\n): EmbindEnumEntity | undefined =>\n value === undefined ? undefined : { value };\n"]}
|