@shopify/react-native-skia 0.1.123 → 0.1.126
Sign up to get free protection for your applications and to get access to all the features.
- package/android/CMakeLists.txt +3 -0
- package/android/build.gradle +1 -1
- package/android/cpp/rnskia-android/RNSkDrawViewImpl.cpp +5 -5
- package/android/cpp/rnskia-android/RNSkDrawViewImpl.h +4 -4
- package/cpp/api/JsiSkApi.h +3 -1
- package/cpp/api/JsiSkCanvas.h +1 -1
- package/cpp/api/JsiSkColor.h +41 -7
- package/cpp/api/JsiSkColorFilterFactory.h +2 -1
- package/cpp/api/JsiSkImageFilter.h +0 -2
- package/cpp/api/JsiSkImageFilterFactory.h +37 -17
- package/cpp/api/JsiSkMatrix.h +44 -2
- package/cpp/api/JsiSkPaint.h +4 -7
- package/cpp/api/JsiSkRuntimeEffect.h +7 -0
- package/cpp/api/JsiSkRuntimeEffectFactory.h +3 -2
- package/cpp/api/JsiSkRuntimeShaderBuilder.h +70 -0
- package/cpp/api/JsiSkShaderFactory.h +2 -2
- package/cpp/api/JsiSkVertices.h +1 -1
- package/cpp/api/third_party/CSSColorParser.cpp +194 -0
- package/cpp/api/third_party/CSSColorParser.h +1 -191
- package/cpp/jsi/JsiSimpleValueWrapper.h +108 -0
- package/cpp/rnskia/RNSkAnimation.h +0 -2
- package/cpp/rnskia/RNSkDrawView.cpp +10 -13
- package/cpp/rnskia/RNSkDrawView.h +2 -2
- package/cpp/rnskia/RNSkValueApi.h +6 -2
- package/cpp/rnskia/values/RNSkClockValue.h +2 -2
- package/cpp/rnskia/values/RNSkDerivedValue.h +12 -5
- package/cpp/rnskia/values/RNSkReadonlyValue.h +14 -12
- package/cpp/rnskia/values/RNSkValue.h +8 -3
- package/ios/RNSkia-iOS/PlatformContext.h +30 -4
- package/ios/RNSkia-iOS/RNSkDrawViewImpl.h +4 -4
- package/ios/RNSkia-iOS/SkiaDrawView.mm +9 -13
- package/lib/commonjs/{values/animation → animation}/decay/decay.js +0 -0
- package/lib/commonjs/{values/animation → animation}/decay/decay.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/decay/index.js +0 -0
- package/lib/commonjs/{values/animation → animation}/decay/index.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/decay/runDecay.js +1 -1
- package/lib/commonjs/animation/decay/runDecay.js.map +1 -0
- package/lib/commonjs/{values/animation → animation}/decay/types.js +0 -0
- package/lib/commonjs/{values/animation → animation}/decay/types.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/functions/index.js +0 -0
- package/lib/commonjs/{values/animation → animation}/functions/index.js.map +0 -0
- package/lib/commonjs/animation/functions/interpolate.js +141 -0
- package/lib/commonjs/animation/functions/interpolate.js.map +1 -0
- package/lib/commonjs/animation/functions/interpolateColors.js +39 -0
- package/lib/commonjs/animation/functions/interpolateColors.js.map +1 -0
- package/lib/commonjs/{values/animation → animation}/index.js +0 -0
- package/lib/commonjs/{values/animation → animation}/index.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/spring/Spring.js +0 -0
- package/lib/commonjs/{values/animation → animation}/spring/Spring.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/spring/functions/index.js +0 -0
- package/lib/commonjs/{values/animation → animation}/spring/functions/index.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/spring/functions/spring.js +0 -0
- package/lib/commonjs/{values/animation → animation}/spring/functions/spring.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/spring/index.js +0 -0
- package/lib/commonjs/{values/animation → animation}/spring/index.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/spring/runSpring.js +0 -0
- package/lib/commonjs/animation/spring/runSpring.js.map +1 -0
- package/lib/commonjs/{values/animation → animation}/spring/types.js +0 -0
- package/lib/commonjs/{values/animation → animation}/spring/types.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/spring/useSpring.js +0 -0
- package/lib/commonjs/animation/spring/useSpring.js.map +1 -0
- package/lib/commonjs/{values/animation → animation}/timing/Easing.js +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/Easing.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/createTiming.js +1 -1
- package/lib/commonjs/animation/timing/createTiming.js.map +1 -0
- package/lib/commonjs/{values/animation → animation}/timing/functions/bezier.js +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/functions/bezier.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/functions/getResolvedParams.js +3 -3
- package/lib/commonjs/animation/timing/functions/getResolvedParams.js.map +1 -0
- package/lib/commonjs/{values/animation → animation}/timing/functions/index.js +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/functions/index.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/functions/timing.js +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/functions/timing.js.map +1 -1
- package/lib/commonjs/{values/animation → animation}/timing/functions/types.js +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/functions/types.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/index.js +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/index.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/runTiming.js +0 -0
- package/lib/commonjs/animation/timing/runTiming.js.map +1 -0
- package/lib/commonjs/{values/animation → animation}/timing/useLoop.js +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/useLoop.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/useTiming.js +1 -1
- package/lib/commonjs/animation/timing/useTiming.js.map +1 -0
- package/lib/commonjs/{values/animation → animation}/types.js +0 -0
- package/lib/commonjs/{values/animation → animation}/types.js.map +0 -0
- package/lib/commonjs/index.js +13 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +14 -5
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/components/colorFilters/BlendColor.js.map +1 -1
- package/lib/commonjs/renderer/components/colorFilters/Lerp.js +1 -1
- package/lib/commonjs/renderer/components/colorFilters/Lerp.js.map +1 -1
- package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js +4 -2
- package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js.map +1 -1
- package/lib/commonjs/renderer/components/imageFilters/RuntimeShader.js +37 -0
- package/lib/commonjs/renderer/components/imageFilters/RuntimeShader.js.map +1 -0
- package/lib/commonjs/renderer/components/imageFilters/index.js +13 -0
- package/lib/commonjs/renderer/components/imageFilters/index.js.map +1 -1
- package/lib/commonjs/renderer/components/shaders/Gradient.js +1 -1
- package/lib/commonjs/renderer/components/shaders/Gradient.js.map +1 -1
- package/lib/commonjs/renderer/components/shaders/Shader.js +2 -2
- package/lib/commonjs/renderer/components/shaders/Shader.js.map +1 -1
- package/lib/commonjs/renderer/processors/Circles.js +3 -2
- package/lib/commonjs/renderer/processors/Circles.js.map +1 -1
- package/lib/commonjs/renderer/processors/Font.js +1 -1
- package/lib/commonjs/renderer/processors/Font.js.map +1 -1
- package/lib/commonjs/renderer/processors/Rects.js +11 -21
- package/lib/commonjs/renderer/processors/Rects.js.map +1 -1
- package/lib/commonjs/renderer/processors/math/Matrix3.js +42 -63
- package/lib/commonjs/renderer/processors/math/Matrix3.js.map +1 -1
- package/lib/commonjs/renderer/processors/math/Vector.js +4 -5
- package/lib/commonjs/renderer/processors/math/Vector.js.map +1 -1
- package/lib/commonjs/skia/Color.js +14 -38
- package/lib/commonjs/skia/Color.js.map +1 -1
- package/lib/commonjs/skia/ImageFilter/ImageFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/Matrix.js.map +1 -1
- package/lib/commonjs/skia/Shader/useShader.js +4 -1
- package/lib/commonjs/skia/Shader/useShader.js.map +1 -1
- package/lib/commonjs/skia/Skia.js +3 -45
- package/lib/commonjs/skia/Skia.js.map +1 -1
- package/lib/commonjs/skia/SkiaApi.js +4 -0
- package/lib/commonjs/skia/SkiaApi.js.map +1 -0
- package/lib/commonjs/values/api.js +4 -6
- package/lib/commonjs/values/api.js.map +1 -1
- package/lib/commonjs/values/api.web.js +18 -0
- package/lib/commonjs/values/api.web.js.map +1 -0
- package/lib/commonjs/values/index.js +0 -13
- package/lib/commonjs/values/index.js.map +1 -1
- package/lib/commonjs/values/web/RNSkAnimation.js +46 -0
- package/lib/commonjs/values/web/RNSkAnimation.js.map +1 -0
- package/lib/commonjs/values/web/RNSkClockValue.js +75 -0
- package/lib/commonjs/values/web/RNSkClockValue.js.map +1 -0
- package/lib/commonjs/values/web/RNSkDerivedValue.js +51 -0
- package/lib/commonjs/values/web/RNSkDerivedValue.js.map +1 -0
- package/lib/commonjs/values/web/RNSkReadonlyValue.js +45 -0
- package/lib/commonjs/values/web/RNSkReadonlyValue.js.map +1 -0
- package/lib/commonjs/values/web/RNSkValue.js +73 -0
- package/lib/commonjs/values/web/RNSkValue.js.map +1 -0
- package/lib/commonjs/values/web/api.js +31 -0
- package/lib/commonjs/values/web/api.js.map +1 -0
- package/lib/commonjs/values/web/index.js +19 -0
- package/lib/commonjs/values/web/index.js.map +1 -0
- package/lib/commonjs/views/SkiaView.js +13 -10
- package/lib/commonjs/views/SkiaView.js.map +1 -1
- package/lib/commonjs/views/api.js +11 -0
- package/lib/commonjs/views/api.js.map +1 -0
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/{values/animation → animation}/decay/decay.js +0 -0
- package/lib/module/{values/animation → animation}/decay/decay.js.map +0 -0
- package/lib/module/{values/animation → animation}/decay/index.js +0 -0
- package/lib/module/{values/animation → animation}/decay/index.js.map +0 -0
- package/lib/module/{values/animation → animation}/decay/runDecay.js +1 -1
- package/lib/module/animation/decay/runDecay.js.map +1 -0
- package/lib/module/{values/animation → animation}/decay/types.js +0 -0
- package/lib/module/{values/animation → animation}/decay/types.js.map +0 -0
- package/lib/module/{values/animation → animation}/functions/index.js +0 -0
- package/lib/module/{values/animation → animation}/functions/index.js.map +0 -0
- package/lib/module/animation/functions/interpolate.js +132 -0
- package/lib/module/animation/functions/interpolate.js.map +1 -0
- package/lib/module/animation/functions/interpolateColors.js +23 -0
- package/lib/module/animation/functions/interpolateColors.js.map +1 -0
- package/lib/module/{values/animation → animation}/index.js +0 -0
- package/lib/module/{values/animation → animation}/index.js.map +0 -0
- package/lib/module/{values/animation → animation}/spring/Spring.js +0 -0
- package/lib/module/{values/animation → animation}/spring/Spring.js.map +0 -0
- package/lib/module/{values/animation → animation}/spring/functions/index.js +0 -0
- package/lib/module/{values/animation → animation}/spring/functions/index.js.map +0 -0
- package/lib/module/{values/animation → animation}/spring/functions/spring.js +0 -0
- package/lib/module/{values/animation → animation}/spring/functions/spring.js.map +0 -0
- package/lib/module/{values/animation → animation}/spring/index.js +0 -0
- package/lib/module/{values/animation → animation}/spring/index.js.map +0 -0
- package/lib/module/{values/animation → animation}/spring/runSpring.js +0 -0
- package/lib/module/animation/spring/runSpring.js.map +1 -0
- package/lib/module/{values/animation → animation}/spring/types.js +0 -0
- package/lib/module/{values/animation → animation}/spring/types.js.map +0 -0
- package/lib/module/{values/animation → animation}/spring/useSpring.js +0 -0
- package/lib/module/animation/spring/useSpring.js.map +1 -0
- package/lib/module/{values/animation → animation}/timing/Easing.js +0 -0
- package/lib/module/{values/animation → animation}/timing/Easing.js.map +0 -0
- package/lib/module/{values/animation → animation}/timing/createTiming.js +1 -1
- package/lib/module/animation/timing/createTiming.js.map +1 -0
- package/lib/module/{values/animation → animation}/timing/functions/bezier.js +0 -0
- package/lib/module/{values/animation → animation}/timing/functions/bezier.js.map +0 -0
- package/lib/module/{values/animation → animation}/timing/functions/getResolvedParams.js +3 -3
- package/lib/module/animation/timing/functions/getResolvedParams.js.map +1 -0
- package/lib/module/{values/animation → animation}/timing/functions/index.js +0 -0
- package/lib/module/{values/animation → animation}/timing/functions/index.js.map +0 -0
- package/lib/module/{values/animation → animation}/timing/functions/timing.js +0 -0
- package/lib/module/{values/animation → animation}/timing/functions/timing.js.map +1 -1
- package/lib/module/{values/animation → animation}/timing/functions/types.js +0 -0
- package/lib/module/{values/animation → animation}/timing/functions/types.js.map +0 -0
- package/lib/module/{values/animation → animation}/timing/index.js +0 -0
- package/lib/module/{values/animation → animation}/timing/index.js.map +0 -0
- package/lib/module/{values/animation → animation}/timing/runTiming.js +0 -0
- package/lib/module/animation/timing/runTiming.js.map +1 -0
- package/lib/module/{values/animation → animation}/timing/useLoop.js +0 -0
- package/lib/module/{values/animation → animation}/timing/useLoop.js.map +0 -0
- package/lib/module/{values/animation → animation}/timing/useTiming.js +1 -1
- package/lib/module/animation/timing/useTiming.js.map +1 -0
- package/lib/module/{values/animation → animation}/types.js +0 -0
- package/lib/module/{values/animation → animation}/types.js.map +0 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/renderer/Canvas.js +10 -4
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/components/colorFilters/BlendColor.js.map +1 -1
- package/lib/module/renderer/components/colorFilters/Lerp.js +1 -1
- package/lib/module/renderer/components/colorFilters/Lerp.js.map +1 -1
- package/lib/module/renderer/components/imageFilters/InnerShadow.js +3 -2
- package/lib/module/renderer/components/imageFilters/InnerShadow.js.map +1 -1
- package/lib/module/renderer/components/imageFilters/RuntimeShader.js +19 -0
- package/lib/module/renderer/components/imageFilters/RuntimeShader.js.map +1 -0
- package/lib/module/renderer/components/imageFilters/index.js +1 -0
- package/lib/module/renderer/components/imageFilters/index.js.map +1 -1
- package/lib/module/renderer/components/shaders/Gradient.js +2 -2
- package/lib/module/renderer/components/shaders/Gradient.js.map +1 -1
- package/lib/module/renderer/components/shaders/Shader.js +3 -2
- package/lib/module/renderer/components/shaders/Shader.js.map +1 -1
- package/lib/module/renderer/processors/Circles.js +3 -2
- package/lib/module/renderer/processors/Circles.js.map +1 -1
- package/lib/module/renderer/processors/Font.js +1 -1
- package/lib/module/renderer/processors/Font.js.map +1 -1
- package/lib/module/renderer/processors/Rects.js +9 -21
- package/lib/module/renderer/processors/Rects.js.map +1 -1
- package/lib/module/renderer/processors/math/Matrix3.js +52 -72
- package/lib/module/renderer/processors/math/Matrix3.js.map +1 -1
- package/lib/module/renderer/processors/math/Vector.js +3 -5
- package/lib/module/renderer/processors/math/Vector.js.map +1 -1
- package/lib/module/skia/Color.js +9 -25
- package/lib/module/skia/Color.js.map +1 -1
- package/lib/module/skia/ImageFilter/ImageFilterFactory.js.map +1 -1
- package/lib/module/skia/Matrix.js.map +1 -1
- package/lib/module/skia/Shader/useShader.js +4 -1
- package/lib/module/skia/Shader/useShader.js.map +1 -1
- package/lib/module/skia/Skia.js +2 -46
- package/lib/module/skia/Skia.js.map +1 -1
- package/lib/module/skia/SkiaApi.js +2 -0
- package/lib/module/skia/SkiaApi.js.map +1 -0
- package/lib/module/values/api.js +4 -6
- package/lib/module/values/api.js.map +1 -1
- package/lib/module/values/api.web.js +7 -0
- package/lib/module/values/api.web.js.map +1 -0
- package/lib/module/values/index.js +0 -1
- package/lib/module/values/index.js.map +1 -1
- package/lib/module/values/web/RNSkAnimation.js +36 -0
- package/lib/module/values/web/RNSkAnimation.js.map +1 -0
- package/lib/module/values/web/RNSkClockValue.js +65 -0
- package/lib/module/values/web/RNSkClockValue.js.map +1 -0
- package/lib/module/values/web/RNSkDerivedValue.js +41 -0
- package/lib/module/values/web/RNSkDerivedValue.js.map +1 -0
- package/lib/module/values/web/RNSkReadonlyValue.js +36 -0
- package/lib/module/values/web/RNSkReadonlyValue.js.map +1 -0
- package/lib/module/values/web/RNSkValue.js +63 -0
- package/lib/module/values/web/RNSkValue.js.map +1 -0
- package/lib/module/values/web/api.js +19 -0
- package/lib/module/values/web/api.js.map +1 -0
- package/lib/module/values/web/index.js +2 -0
- package/lib/module/values/web/index.js.map +1 -0
- package/lib/module/views/SkiaView.js +1 -3
- package/lib/module/views/SkiaView.js.map +1 -1
- package/lib/module/views/api.js +4 -0
- package/lib/module/views/api.js.map +1 -0
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/src/{values/animation → animation}/decay/decay.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/decay/index.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/decay/runDecay.d.ts +2 -2
- package/lib/typescript/src/{values/animation → animation}/decay/types.d.ts +1 -1
- package/lib/typescript/src/{values/animation → animation}/functions/index.d.ts +0 -0
- package/lib/typescript/src/animation/functions/interpolate.d.ts +11 -0
- package/lib/typescript/src/animation/functions/interpolateColors.d.ts +3 -0
- package/lib/typescript/src/{values/animation → animation}/index.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/spring/Spring.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/spring/functions/index.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/spring/functions/spring.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/spring/index.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/spring/runSpring.d.ts +1 -1
- package/lib/typescript/src/{values/animation → animation}/spring/types.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/spring/useSpring.d.ts +1 -1
- package/lib/typescript/src/{values/animation → animation}/timing/Easing.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/timing/createTiming.d.ts +2 -2
- package/lib/typescript/src/{values/animation → animation}/timing/functions/bezier.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/timing/functions/getResolvedParams.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/timing/functions/index.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/timing/functions/timing.d.ts +1 -1
- package/lib/typescript/src/{values/animation → animation}/timing/functions/types.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/timing/index.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/timing/runTiming.d.ts +1 -1
- package/lib/typescript/src/{values/animation → animation}/timing/useLoop.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/timing/useTiming.d.ts +1 -1
- package/lib/typescript/src/{values/animation → animation}/types.d.ts +5 -5
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/renderer/Canvas.d.ts +6 -0
- package/lib/typescript/src/renderer/components/colorFilters/BlendColor.d.ts +1 -1
- package/lib/typescript/src/renderer/components/imageFilters/RuntimeShader.d.ts +7 -0
- package/lib/typescript/src/renderer/components/imageFilters/index.d.ts +1 -0
- package/lib/typescript/src/renderer/components/shaders/Gradient.d.ts +1 -1
- package/lib/typescript/src/renderer/components/shaders/Shader.d.ts +2 -2
- package/lib/typescript/src/renderer/components/shapes/Circle.d.ts +1 -4
- package/lib/typescript/src/renderer/processors/Rects.d.ts +9 -41
- package/lib/typescript/src/renderer/processors/math/Matrix3.d.ts +1 -5
- package/lib/typescript/src/renderer/processors/math/Vector.d.ts +5 -17
- package/lib/typescript/src/skia/Color.d.ts +8 -9
- package/lib/typescript/src/skia/ImageFilter/ImageFilterFactory.d.ts +16 -0
- package/lib/typescript/src/skia/Matrix.d.ts +7 -1
- package/lib/typescript/src/skia/RuntimeEffect/RuntimeEffect.d.ts +2 -1
- package/lib/typescript/src/skia/RuntimeEffect/RuntimeEffectFactory.d.ts +2 -2
- package/lib/typescript/src/skia/Shader/useShader.d.ts +1 -1
- package/lib/typescript/src/skia/Skia.d.ts +28 -95
- package/lib/typescript/src/skia/SkiaApi.d.ts +71 -0
- package/lib/typescript/src/skia/Surface/Surface.d.ts +1 -1
- package/lib/typescript/src/skia/Surface/SurfaceFactory.d.ts +2 -2
- package/lib/typescript/src/values/api.d.ts +2 -25
- package/lib/typescript/src/values/api.web.d.ts +2 -0
- package/lib/typescript/src/values/index.d.ts +0 -1
- package/lib/typescript/src/values/types.d.ts +24 -1
- package/lib/typescript/src/values/web/RNSkAnimation.d.ts +9 -0
- package/lib/typescript/src/values/web/RNSkClockValue.d.ts +13 -0
- package/lib/typescript/src/values/web/RNSkDerivedValue.d.ts +9 -0
- package/lib/typescript/src/values/web/RNSkReadonlyValue.d.ts +11 -0
- package/lib/typescript/src/values/web/RNSkValue.d.ts +14 -0
- package/lib/typescript/src/values/web/api.d.ts +2 -0
- package/lib/typescript/src/values/web/index.d.ts +1 -0
- package/lib/typescript/src/views/SkiaView.d.ts +3 -36
- package/lib/typescript/src/views/api.d.ts +5 -0
- package/lib/typescript/src/views/types.d.ts +32 -0
- package/package.json +2 -2
- package/src/{values/animation → animation}/decay/decay.ts +0 -0
- package/src/{values/animation → animation}/decay/index.ts +0 -0
- package/src/{values/animation → animation}/decay/runDecay.ts +2 -2
- package/src/{values/animation → animation}/decay/types.ts +1 -1
- package/src/{values/animation → animation}/functions/index.ts +0 -0
- package/src/animation/functions/interpolate.ts +182 -0
- package/src/animation/functions/interpolateColors.ts +58 -0
- package/src/{values/animation → animation}/index.ts +0 -0
- package/src/{values/animation → animation}/spring/Spring.ts +0 -0
- package/src/{values/animation → animation}/spring/functions/index.ts +0 -0
- package/src/{values/animation → animation}/spring/functions/spring.ts +0 -0
- package/src/{values/animation → animation}/spring/index.ts +0 -0
- package/src/{values/animation → animation}/spring/runSpring.ts +1 -1
- package/src/{values/animation → animation}/spring/types.ts +0 -0
- package/src/{values/animation → animation}/spring/useSpring.ts +1 -1
- package/src/{values/animation → animation}/timing/Easing.ts +0 -0
- package/src/{values/animation → animation}/timing/createTiming.ts +2 -2
- package/src/{values/animation → animation}/timing/functions/__tests__/timing.spec.ts +0 -0
- package/src/{values/animation → animation}/timing/functions/bezier.ts +0 -0
- package/src/{values/animation → animation}/timing/functions/getResolvedParams.ts +2 -2
- package/src/{values/animation → animation}/timing/functions/index.ts +0 -0
- package/src/{values/animation → animation}/timing/functions/timing.ts +1 -1
- package/src/{values/animation → animation}/timing/functions/types.ts +0 -0
- package/src/{values/animation → animation}/timing/index.ts +0 -0
- package/src/{values/animation → animation}/timing/runTiming.ts +1 -1
- package/src/{values/animation → animation}/timing/useLoop.ts +0 -0
- package/src/{values/animation → animation}/timing/useTiming.ts +2 -2
- package/src/{values/animation → animation}/types.ts +5 -5
- package/src/index.ts +1 -0
- package/src/renderer/Canvas.tsx +11 -4
- package/src/renderer/components/colorFilters/BlendColor.tsx +1 -1
- package/src/renderer/components/colorFilters/Lerp.tsx +1 -1
- package/src/renderer/components/imageFilters/InnerShadow.tsx +4 -2
- package/src/renderer/components/imageFilters/RuntimeShader.tsx +23 -0
- package/src/renderer/components/imageFilters/index.ts +1 -0
- package/src/renderer/components/shaders/Gradient.ts +2 -4
- package/src/renderer/components/shaders/Shader.tsx +3 -3
- package/src/renderer/processors/Circles.ts +2 -1
- package/src/renderer/processors/Font.ts +1 -1
- package/src/renderer/processors/Rects.ts +9 -14
- package/src/renderer/processors/math/Matrix3.ts +24 -105
- package/src/renderer/processors/math/Vector.ts +3 -2
- package/src/skia/Color.ts +13 -27
- package/src/skia/ImageFilter/ImageFilterFactory.ts +20 -0
- package/src/skia/Matrix.ts +8 -1
- package/src/skia/RuntimeEffect/RuntimeEffect.ts +3 -1
- package/src/skia/RuntimeEffect/RuntimeEffectFactory.ts +2 -2
- package/src/skia/Shader/useShader.ts +4 -1
- package/src/skia/Skia.ts +4 -126
- package/src/skia/SkiaApi.ts +86 -0
- package/src/skia/Surface/Surface.ts +1 -1
- package/src/skia/Surface/SurfaceFactory.ts +2 -2
- package/src/values/api.ts +3 -42
- package/src/values/api.web.ts +5 -0
- package/src/values/index.ts +0 -1
- package/src/values/types.ts +30 -1
- package/src/values/web/RNSkAnimation.ts +33 -0
- package/src/values/web/RNSkClockValue.ts +58 -0
- package/src/values/web/RNSkDerivedValue.ts +38 -0
- package/src/values/web/RNSkReadonlyValue.ts +32 -0
- package/src/values/web/RNSkValue.ts +57 -0
- package/src/values/web/__tests__/RNSkAnimation.spec.ts +21 -0
- package/src/values/web/__tests__/RNSkDerivedValue.spec.ts +15 -0
- package/src/values/web/__tests__/RNSkReadonlyValue.spec.ts +8 -0
- package/src/values/web/__tests__/RNSkValue.spec.ts +11 -0
- package/src/values/web/api.ts +33 -0
- package/src/values/web/index.ts +1 -0
- package/src/views/SkiaView.tsx +3 -49
- package/src/views/api.ts +7 -0
- package/src/views/types.ts +40 -0
- package/lib/commonjs/values/animation/decay/runDecay.js.map +0 -1
- package/lib/commonjs/values/animation/functions/interpolate.js +0 -139
- package/lib/commonjs/values/animation/functions/interpolate.js.map +0 -1
- package/lib/commonjs/values/animation/functions/interpolateColors.js +0 -47
- package/lib/commonjs/values/animation/functions/interpolateColors.js.map +0 -1
- package/lib/commonjs/values/animation/spring/runSpring.js.map +0 -1
- package/lib/commonjs/values/animation/spring/useSpring.js.map +0 -1
- package/lib/commonjs/values/animation/timing/createTiming.js.map +0 -1
- package/lib/commonjs/values/animation/timing/functions/getResolvedParams.js.map +0 -1
- package/lib/commonjs/values/animation/timing/runTiming.js.map +0 -1
- package/lib/commonjs/values/animation/timing/useTiming.js.map +0 -1
- package/lib/module/values/animation/decay/runDecay.js.map +0 -1
- package/lib/module/values/animation/functions/interpolate.js +0 -132
- package/lib/module/values/animation/functions/interpolate.js.map +0 -1
- package/lib/module/values/animation/functions/interpolateColors.js +0 -32
- package/lib/module/values/animation/functions/interpolateColors.js.map +0 -1
- package/lib/module/values/animation/spring/runSpring.js.map +0 -1
- package/lib/module/values/animation/spring/useSpring.js.map +0 -1
- package/lib/module/values/animation/timing/createTiming.js.map +0 -1
- package/lib/module/values/animation/timing/functions/getResolvedParams.js.map +0 -1
- package/lib/module/values/animation/timing/runTiming.js.map +0 -1
- package/lib/module/values/animation/timing/useTiming.js.map +0 -1
- package/lib/typescript/scripts/install-npm.d.ts +0 -1
- package/lib/typescript/src/values/animation/functions/interpolate.d.ts +0 -7
- package/lib/typescript/src/values/animation/functions/interpolateColors.d.ts +0 -3
- package/src/values/animation/functions/interpolate.ts +0 -169
- package/src/values/animation/functions/interpolateColors.ts +0 -62
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Matrix3.ts"],"names":["
|
1
|
+
{"version":3,"sources":["Matrix3.ts"],"names":["processTransform2d","transforms","m","Skia","Matrix","transform","key","Object","keys","value","preTranslate","preScale","preSkew","preRotate","Math","PI"],"mappings":";;;;;;;AAAA;;AACA;;AA+BO,MAAMA,kBAAkB,GAAIC,UAAD,IAA8B;AAC9D,QAAMC,CAAC,GAAGC,WAAKC,MAAL,EAAV;;AACA,OAAK,MAAMC,SAAX,IAAwBJ,UAAxB,EAAoC;AAClC,UAAMK,GAAG,GAAGC,MAAM,CAACC,IAAP,CAAYH,SAAZ,EAAuB,CAAvB,CAAZ;AACA,UAAMI,KAAK,GAAIJ,SAAD,CAAiDC,GAAjD,CAAd;;AACA,QAAIA,GAAG,KAAK,YAAZ,EAA0B;AACxBJ,MAAAA,CAAC,CAACQ,YAAF,CAAeD,KAAf,EAAsB,CAAtB;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,YAAZ,EAA0B;AACxBJ,MAAAA,CAAC,CAACQ,YAAF,CAAe,CAAf,EAAkBD,KAAlB;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,OAAZ,EAAqB;AACnBJ,MAAAA,CAAC,CAACS,QAAF,CAAWF,KAAX,EAAkBA,KAAlB;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,QAAZ,EAAsB;AACpBJ,MAAAA,CAAC,CAACS,QAAF,CAAWF,KAAX,EAAkB,CAAlB;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,QAAZ,EAAsB;AACpBJ,MAAAA,CAAC,CAACS,QAAF,CAAW,CAAX,EAAcF,KAAd;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,OAAZ,EAAqB;AACnBJ,MAAAA,CAAC,CAACU,OAAF,CAAUH,KAAV,EAAiB,CAAjB;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,OAAZ,EAAqB;AACnBJ,MAAAA,CAAC,CAACU,OAAF,CAAU,CAAV,EAAaH,KAAb;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,QAAR,IAAoBA,GAAG,KAAK,SAAhC,EAA2C;AACzCJ,MAAAA,CAAC,CAACW,SAAF,CAAaJ,KAAK,GAAG,GAAT,GAAgBK,IAAI,CAACC,EAAjC;AACA;AACD;;AACD,oCAAgBT,GAAhB;AACD;;AACD,SAAOJ,CAAP;AACD,CAxCM","sourcesContent":["import { exhaustiveCheck } from \"../../typeddash\";\nimport { Skia } from \"../../../skia\";\n\ntype Transform2dName =\n | \"translateX\"\n | \"translateY\"\n | \"scale\"\n | \"skewX\"\n | \"skewY\"\n | \"scaleX\"\n | \"scaleY\"\n | \"rotateZ\"\n | \"rotate\";\n\nexport interface TransformProp {\n transform?: Transforms2d;\n}\n\ntype Transformations = {\n readonly [Name in Transform2dName]: number;\n};\nexport type Transforms2d = readonly (\n | Pick<Transformations, \"translateX\">\n | Pick<Transformations, \"translateY\">\n | Pick<Transformations, \"scale\">\n | Pick<Transformations, \"scaleX\">\n | Pick<Transformations, \"scaleY\">\n | Pick<Transformations, \"skewX\">\n | Pick<Transformations, \"skewY\">\n | Pick<Transformations, \"rotate\">\n)[];\n\nexport const processTransform2d = (transforms: Transforms2d) => {\n const m = Skia.Matrix();\n for (const transform of transforms) {\n const key = Object.keys(transform)[0] as Transform2dName;\n const value = (transform as Pick<Transformations, typeof key>)[key];\n if (key === \"translateX\") {\n m.preTranslate(value, 0);\n continue;\n }\n if (key === \"translateY\") {\n m.preTranslate(0, value);\n continue;\n }\n if (key === \"scale\") {\n m.preScale(value, value);\n continue;\n }\n if (key === \"scaleX\") {\n m.preScale(value, 0);\n continue;\n }\n if (key === \"scaleY\") {\n m.preScale(0, value);\n continue;\n }\n if (key === \"skewX\") {\n m.preSkew(value, 0);\n continue;\n }\n if (key === \"skewY\") {\n m.preSkew(0, value);\n continue;\n }\n if (key === \"rotate\" || key === \"rotateZ\") {\n m.preRotate((value * 180) / Math.PI);\n continue;\n }\n exhaustiveCheck(key);\n }\n return m;\n};\n"]}
|
@@ -5,15 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.vec = exports.translate = exports.sub = exports.neg = exports.mixVector = exports.interpolateVector = exports.dist = exports.add = void 0;
|
7
7
|
|
8
|
-
var _interpolate = require("../../../
|
8
|
+
var _interpolate = require("../../../animation/functions/interpolate");
|
9
|
+
|
10
|
+
var _skia = require("../../../skia");
|
9
11
|
|
10
12
|
const vec = function () {
|
11
13
|
let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
12
14
|
let y = arguments.length > 1 ? arguments[1] : undefined;
|
13
|
-
return
|
14
|
-
x,
|
15
|
-
y: y !== null && y !== void 0 ? y : x
|
16
|
-
};
|
15
|
+
return _skia.Skia.Point(x, y !== null && y !== void 0 ? y : x);
|
17
16
|
};
|
18
17
|
|
19
18
|
exports.vec = vec;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Vector.ts"],"names":["vec","x","y","neg","a","add","b","sub","dist","Math","hypot","translate","translateX","translateY","interpolateVector","value","inputRange","outputRange","options","map","v","mixVector","from","to"],"mappings":";;;;;;;AAAA;;AAOO,MAAMA,GAAG,GAAG;AAAA,MAACC,CAAD,uEAAK,CAAL;AAAA,MAAQC,CAAR;AAAA,
|
1
|
+
{"version":3,"sources":["Vector.ts"],"names":["vec","x","y","Skia","Point","neg","a","add","b","sub","dist","Math","hypot","translate","translateX","translateY","interpolateVector","value","inputRange","outputRange","options","map","v","mixVector","from","to"],"mappings":";;;;;;;AAAA;;AACA;;AAOO,MAAMA,GAAG,GAAG;AAAA,MAACC,CAAD,uEAAK,CAAL;AAAA,MAAQC,CAAR;AAAA,SAAuBC,WAAKC,KAAL,CAAWH,CAAX,EAAcC,CAAd,aAAcA,CAAd,cAAcA,CAAd,GAAmBD,CAAnB,CAAvB;AAAA,CAAZ;;;;AACA,MAAMI,GAAG,GAAIC,CAAD,IAAeN,GAAG,CAAC,CAACM,CAAC,CAACL,CAAJ,EAAO,CAACK,CAAC,CAACJ,CAAV,CAA9B;;;;AACA,MAAMK,GAAG,GAAG,CAACD,CAAD,EAAYE,CAAZ,KAA0BR,GAAG,CAACM,CAAC,CAACL,CAAF,GAAMO,CAAC,CAACP,CAAT,EAAYK,CAAC,CAACJ,CAAF,GAAMM,CAAC,CAACN,CAApB,CAAzC;;;;AACA,MAAMO,GAAG,GAAG,CAACH,CAAD,EAAYE,CAAZ,KAA0BR,GAAG,CAACM,CAAC,CAACL,CAAF,GAAMO,CAAC,CAACP,CAAT,EAAYK,CAAC,CAACJ,CAAF,GAAMM,CAAC,CAACN,CAApB,CAAzC;;;;AACA,MAAMQ,IAAI,GAAG,CAACJ,CAAD,EAAYE,CAAZ,KAA0BG,IAAI,CAACC,KAAL,CAAWN,CAAC,CAACL,CAAF,GAAMO,CAAC,CAACP,CAAnB,EAAsBK,CAAC,CAACJ,CAAF,GAAMM,CAAC,CAACN,CAA9B,CAAvC;;;;AACA,MAAMW,SAAS,GAAG;AAAA,MAAC;AAAEZ,IAAAA,CAAF;AAAKC,IAAAA;AAAL,GAAD;AAAA,SACvB,CAAC;AAAEY,IAAAA,UAAU,EAAEb;AAAd,GAAD,EAAoB;AAAEc,IAAAA,UAAU,EAAEb;AAAd,GAApB,CADuB;AAAA,CAAlB;;;;AAGA,MAAMc,iBAAiB,GAAG,CAC/BC,KAD+B,EAE/BC,UAF+B,EAG/BC,WAH+B,EAI/BC,OAJ+B,MAK3B;AACJnB,EAAAA,CAAC,EAAE,8BACDgB,KADC,EAEDC,UAFC,EAGDC,WAAW,CAACE,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAACrB,CAAzB,CAHC,EAIDmB,OAJC,CADC;AAOJlB,EAAAA,CAAC,EAAE,8BACDe,KADC,EAEDC,UAFC,EAGDC,WAAW,CAACE,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAACpB,CAAzB,CAHC,EAIDkB,OAJC;AAPC,CAL2B,CAA1B;;;;AAoBA,MAAMG,SAAS,GAAG,CAACN,KAAD,EAAgBO,IAAhB,EAA8BC,EAA9B,KACvBT,iBAAiB,CAACC,KAAD,EAAQ,CAAC,CAAD,EAAI,CAAJ,CAAR,EAAgB,CAACO,IAAD,EAAOC,EAAP,CAAhB,CADZ","sourcesContent":["import { interpolate } from \"../../../animation/functions/interpolate\";\nimport { Skia } from \"../../../skia\";\n\nexport interface Vector {\n x: number;\n y: number;\n}\n\nexport const vec = (x = 0, y?: number) => Skia.Point(x, y ?? x);\nexport const neg = (a: Vector) => vec(-a.x, -a.y);\nexport const add = (a: Vector, b: Vector) => vec(a.x + b.x, a.y + b.y);\nexport const sub = (a: Vector, b: Vector) => vec(a.x - b.x, a.y - b.y);\nexport const dist = (a: Vector, b: Vector) => Math.hypot(a.x - b.x, a.y - b.y);\nexport const translate = ({ x, y }: Vector) =>\n [{ translateX: x }, { translateY: y }] as const;\n\nexport const interpolateVector = (\n value: number,\n inputRange: readonly number[],\n outputRange: readonly Vector[],\n options?: Parameters<typeof interpolate>[3]\n) => ({\n x: interpolate(\n value,\n inputRange,\n outputRange.map((v) => v.x),\n options\n ),\n y: interpolate(\n value,\n inputRange,\n outputRange.map((v) => v.y),\n options\n ),\n});\n\nexport const mixVector = (value: number, from: Vector, to: Vector) =>\n interpolateVector(value, [0, 1], [from, to]);\n"]}
|
@@ -3,53 +3,29 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.rgbaColor = exports.
|
6
|
+
exports.rgbaColor = exports.processColor = exports.RED = exports.GREEN = exports.BLUE = exports.ALPHA = void 0;
|
7
7
|
|
8
8
|
var _Skia = require("./Skia");
|
9
9
|
|
10
|
-
const
|
10
|
+
const RED = 0;
|
11
|
+
exports.RED = RED;
|
12
|
+
const GREEN = 1;
|
13
|
+
exports.GREEN = GREEN;
|
14
|
+
const BLUE = 2;
|
15
|
+
exports.BLUE = BLUE;
|
16
|
+
const ALPHA = 3;
|
17
|
+
exports.ALPHA = ALPHA;
|
11
18
|
|
12
|
-
|
13
|
-
|
14
|
-
const red = c => c >> 16 & 255;
|
15
|
-
|
16
|
-
exports.red = red;
|
17
|
-
|
18
|
-
const green = c => c >> 8 & 255;
|
19
|
-
|
20
|
-
exports.green = green;
|
21
|
-
|
22
|
-
const blue = c => c & 255;
|
23
|
-
|
24
|
-
exports.blue = blue;
|
25
|
-
|
26
|
-
const rgbaColor = (r, g, b, af) => {
|
27
|
-
const a = Math.round(af * 255);
|
28
|
-
return (a << 24 | r << 16 | g << 8 | b) >>> 0;
|
29
|
-
};
|
19
|
+
const rgbaColor = (r, g, b, a) => new Float32Array([r, g, b, a]);
|
30
20
|
|
31
21
|
exports.rgbaColor = rgbaColor;
|
32
22
|
|
33
|
-
const processColorAsArray = cl => {
|
34
|
-
const icl = typeof cl === "string" ? _Skia.Skia.Color(cl) : cl;
|
35
|
-
const r = red(icl);
|
36
|
-
const g = green(icl);
|
37
|
-
const b = blue(icl);
|
38
|
-
const a = alphaf(icl);
|
39
|
-
return [r, g, b, a];
|
40
|
-
};
|
41
|
-
|
42
23
|
const processColor = (cl, currentOpacity) => {
|
43
|
-
const
|
44
|
-
return rgbaColor(r, g, b, a * currentOpacity);
|
45
|
-
};
|
24
|
+
const color = _Skia.Skia.Color(cl);
|
46
25
|
|
47
|
-
|
48
|
-
|
49
|
-
const processColorAsUnitArray = (cl, currentOpacity) => {
|
50
|
-
const [r, g, b, a] = processColorAsArray(cl);
|
51
|
-
return [r / 255, g / 255, b / 255, a * currentOpacity];
|
26
|
+
color[ALPHA] *= currentOpacity;
|
27
|
+
return color;
|
52
28
|
};
|
53
29
|
|
54
|
-
exports.
|
30
|
+
exports.processColor = processColor;
|
55
31
|
//# sourceMappingURL=Color.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Color.ts"],"names":["
|
1
|
+
{"version":3,"sources":["Color.ts"],"names":["RED","GREEN","BLUE","ALPHA","rgbaColor","r","g","b","a","Float32Array","processColor","cl","currentOpacity","color","Skia","Color"],"mappings":";;;;;;;AAAA;;AAOO,MAAMA,GAAG,GAAG,CAAZ;;AACA,MAAMC,KAAK,GAAG,CAAd;;AACA,MAAMC,IAAI,GAAG,CAAb;;AACA,MAAMC,KAAK,GAAG,CAAd;;;AAEA,MAAMC,SAAS,GAAG,CAACC,CAAD,EAAYC,CAAZ,EAAuBC,CAAvB,EAAkCC,CAAlC,KACvB,IAAIC,YAAJ,CAAiB,CAACJ,CAAD,EAAIC,CAAJ,EAAOC,CAAP,EAAUC,CAAV,CAAjB,CADK;;;;AAGA,MAAME,YAAY,GAAG,CAACC,EAAD,EAAYC,cAAZ,KAAuC;AACjE,QAAMC,KAAK,GAAGC,WAAKC,KAAL,CAAWJ,EAAX,CAAd;;AACAE,EAAAA,KAAK,CAACV,KAAD,CAAL,IAAgBS,cAAhB;AACA,SAAOC,KAAP;AACD,CAJM","sourcesContent":["import { Skia } from \"./Skia\";\n\n// This is the JSI color\nexport type SkColor = Float32Array;\n// Input colors can be string, number or Float32Array\nexport type Color = string | Float32Array | number;\n\nexport const RED = 0;\nexport const GREEN = 1;\nexport const BLUE = 2;\nexport const ALPHA = 3;\n\nexport const rgbaColor = (r: number, g: number, b: number, a: number) =>\n new Float32Array([r, g, b, a]);\n\nexport const processColor = (cl: Color, currentOpacity: number) => {\n const color = Skia.Color(cl);\n color[ALPHA] *= currentOpacity;\n return color;\n};\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["ImageFilterFactory.ts"],"names":["ColorChannel"],"mappings":";;;;;;
|
1
|
+
{"version":3,"sources":["ImageFilterFactory.ts"],"names":["ColorChannel"],"mappings":";;;;;;IASYA,Y;;;WAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;GAAAA,Y,4BAAAA,Y","sourcesContent":["import type { SkColor } from \"../Color\";\nimport type { SkColorFilter } from \"../ColorFilter/ColorFilter\";\nimport type { SkShader } from \"../Shader/Shader\";\nimport type { SkRect } from \"../Rect\";\nimport type { BlendMode } from \"../Paint/BlendMode\";\nimport type { SkRuntimeShaderBuilder } from \"../RuntimeEffect\";\n\nimport type { SkImageFilter, TileMode } from \"./ImageFilter\";\n\nexport enum ColorChannel {\n R,\n G,\n B,\n A,\n}\n\nexport interface ImageFilterFactory {\n /**\n * Offsets the input image\n *\n * @param dx - Offset along the X axis\n * @param dy - Offset along the X axis\n * @param input - if null, it will use the dynamic source image\n */\n MakeOffset(\n dx: number,\n dy: number,\n input: SkImageFilter | null\n ): SkImageFilter;\n /**\n * Spatially displace pixel values of the filtered image\n *\n * @param channelX - Color channel to be used along the X axis\n * @param channelY - Color channel to be used along the Y axis\n * @param scale - Scale factor to be used in the displacement\n * @param in1 - Source image filter to use for the displacement\n * @param input - if null, it will use the dynamic source image\n */\n MakeDisplacementMap(\n channelX: ColorChannel,\n channelY: ColorChannel,\n scale: number,\n in1: SkImageFilter,\n input: SkImageFilter | null\n ): SkImageFilter;\n /**\n * Transforms a shader into an impage filter\n *\n * @param shader - The Shader to be transformed\n * @param input - if null, it will use the dynamic source image\n */\n MakeShader(shader: SkShader, input: SkImageFilter | null): SkImageFilter;\n /**\n * Create a filter that blurs its input by the separate X and Y sigmas. The provided tile mode\n * is used when the blur kernel goes outside the input image.\n *\n * @param sigmaX - The Gaussian sigma value for blurring along the X axis.\n * @param sigmaY - The Gaussian sigma value for blurring along the Y axis.\n * @param mode\n * @param input - if null, it will use the dynamic source image (e.g. a saved layer)\n */\n MakeBlur(\n sigmaX: number,\n sigmaY: number,\n mode: TileMode,\n input: SkImageFilter | null\n ): SkImageFilter;\n\n /**\n * Create a filter that applies the color filter to the input filter results.\n * @param cf\n * @param input - if null, it will use the dynamic source image (e.g. a saved layer)\n */\n MakeColorFilter(\n cf: SkColorFilter,\n input: SkImageFilter | null\n ): SkImageFilter;\n\n /**\n * Create a filter that composes 'inner' with 'outer', such that the results of 'inner' are\n * treated as the source bitmap passed to 'outer'.\n * If either param is null, the other param will be returned.\n * @param outer\n * @param inner - if null, it will use the dynamic source image (e.g. a saved layer)\n */\n MakeCompose(\n outer: SkImageFilter | null,\n inner: SkImageFilter | null\n ): SkImageFilter;\n\n /**\n * Create a filter that draws a drop shadow under the input content.\n * This filter produces an image that includes the inputs' content.\n * @param dx The X offset of the shadow.\n * @param dy\tThe Y offset of the shadow.\n * @param sigmaX\tThe blur radius for the shadow, along the X axis.\n * @param sigmaY\tThe blur radius for the shadow, along the Y axis.\n * @param color\tThe color of the drop shadow.\n * @param input\tThe input filter, or will use the source bitmap if this is null.\n * @param cropRect\tOptional rectangle that crops the input and output.\n */\n MakeDropShadow: (\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * Create a filter that renders a drop shadow, in exactly the same manner as ::DropShadow, except\n * that the resulting image does not include the input content.\n * This allows the shadow and input to be composed by a filter DAG in a more flexible manner.\n * @param dx The X offset of the shadow.\n * @param dy\tThe Y offset of the shadow.\n * @param sigmaX\tThe blur radius for the shadow, along the X axis.\n * @param sigmaY\tThe blur radius for the shadow, along the Y axis.\n * @param color\tThe color of the drop shadow.\n * @param input\tThe input filter, or will use the source bitmap if this is null.\n * @param cropRect\tOptional rectangle that crops the input and output.\n */\n MakeDropShadowOnly: (\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * Create a filter that erodes each input pixel's channel values to the minimum channel value\n * within the given radii along the x and y axes.\n * @param radiusX The distance to erode along the x axis to either side of each pixel.\n * @param radiusY The distance to erode along the y axis to either side of each pixel.\n * @param input The image filter that is eroded, using source bitmap if this is null.\n * @param cropRect Optional rectangle that crops the input and output.\n */\n MakeErode: (\n rx: number,\n ry: number,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * Create a filter that dilates each input pixel's channel values to the max value within the\n * given radii along the x and y axes.\n * @param radiusX The distance to dilate along the x axis to either side of each pixel.\n * @param radiusY The distance to dilate along the y axis to either side of each pixel.\n * @param input The image filter that is dilated, using source bitmap if this is null.\n * @param cropRect Optional rectangle that crops the input and output.\n */\n MakeDilate: (\n rx: number,\n ry: number,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * This filter takes an SkBlendMode and uses it to composite the two filters together.\n * @param mode The blend mode that defines the compositing operation\n * @param background The Dst pixels used in blending, if null the source bitmap is used.\n * @param foreground The Src pixels used in blending, if null the source bitmap is used.\n * @cropRect Optional rectangle to crop input and output.\n */\n MakeBlend: (\n mode: BlendMode,\n background: SkImageFilter,\n foreground: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * Create a filter that fills the output with the per-pixel evaluation of the SkShader produced\n * by the SkRuntimeShaderBuilder. The shader is defined in the image filter's local coordinate\n * system, so it will automatically be affected by SkCanvas' transform.\n *\n * @param builder The builder used to produce the runtime shader, that will in turn\n * fill the result image\n * @param childShaderName The name of the child shader defined in the builder that will be\n * bound to the input param (or the source image if the input param\n * is null). If null the builder can have exactly one child shader,\n * which automatically binds the input param.\n * @param input The image filter that will be provided as input to the runtime\n * shader. If null the implicit source image is used instead\n */\n MakeRuntimeShader: (\n builder: SkRuntimeShaderBuilder,\n childShaderName: string | null,\n input: SkImageFilter | null\n ) => SkImageFilter;\n}\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Matrix.ts"],"names":["MatrixIndex"],"mappings":";;;;;;
|
1
|
+
{"version":3,"sources":["Matrix.ts"],"names":["MatrixIndex"],"mappings":";;;;;;IACYA,W;;;WAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;GAAAA,W,2BAAAA,W","sourcesContent":["import type { SkJSIInstance } from \"./JsiInstance\";\nexport enum MatrixIndex {\n ScaleX = 0,\n SkewX = 1,\n TransX = 2,\n SkewY = 3,\n ScaleY = 4,\n TransY = 5,\n Persp0 = 6,\n Persp1 = 7,\n persp2 = 8,\n}\n\nexport interface SkMatrix extends SkJSIInstance<\"Matrix\"> {\n 0: number;\n 1: number;\n 2: number;\n 3: number;\n 4: number;\n 5: number;\n 6: number;\n 7: number;\n 8: number;\n\n preConcat: (matrix: SkMatrix) => void;\n preTranslate: (x: number, y: number) => void;\n preScale: (x: number, y: number) => void;\n preSkew: (x: number, y: number) => void;\n preRotate: (theta: number) => void;\n}\n"]}
|
@@ -9,7 +9,10 @@ var _react = require("react");
|
|
9
9
|
|
10
10
|
var _Skia = require("../Skia");
|
11
11
|
|
12
|
-
const useShader = sksl => (0, _react.useMemo)(() =>
|
12
|
+
const useShader = sksl => (0, _react.useMemo)(() => {
|
13
|
+
console.warn("Use shader will be deprecated.");
|
14
|
+
return _Skia.Skia.RuntimeEffect.Make(sksl);
|
15
|
+
}, [sksl]);
|
13
16
|
|
14
17
|
exports.useShader = useShader;
|
15
18
|
//# sourceMappingURL=useShader.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useShader.ts"],"names":["useShader","sksl","Skia","RuntimeEffect","Make"],"mappings":";;;;;;;AAAA;;AAEA;;AAEO,MAAMA,SAAS,GAAIC,IAAD,IACvB,oBAAQ,
|
1
|
+
{"version":3,"sources":["useShader.ts"],"names":["useShader","sksl","console","warn","Skia","RuntimeEffect","Make"],"mappings":";;;;;;;AAAA;;AAEA;;AAEO,MAAMA,SAAS,GAAIC,IAAD,IACvB,oBAAQ,MAAM;AACZC,EAAAA,OAAO,CAACC,IAAR,CAAa,gCAAb;AACA,SAAOC,WAAKC,aAAL,CAAmBC,IAAnB,CAAwBL,IAAxB,CAAP;AACD,CAHD,EAGG,CAACA,IAAD,CAHH,CADK","sourcesContent":["import { useMemo } from \"react\";\n\nimport { Skia } from \"../Skia\";\n\nexport const useShader = (sksl: string) =>\n useMemo(() => {\n console.warn(\"Use shader will be deprecated.\");\n return Skia.RuntimeEffect.Make(sksl);\n }, [sksl]);\n"]}
|
@@ -5,49 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.Skia = void 0;
|
7
7
|
|
8
|
-
var _reactNative = require("react-native");
|
9
|
-
|
10
8
|
require("./NativeSetup");
|
11
9
|
|
12
|
-
/*
|
13
|
-
* Parse CSS colors
|
14
|
-
*/
|
15
|
-
const SkiaColor = cl => {
|
16
|
-
if (typeof cl === "number") {
|
17
|
-
return cl;
|
18
|
-
}
|
19
|
-
|
20
|
-
const color = Skia.parseColorString(cl);
|
21
|
-
|
22
|
-
if (color !== undefined) {
|
23
|
-
return color;
|
24
|
-
} else {
|
25
|
-
// If the color is not recognized, we fallback to React Native
|
26
|
-
let rnColor = (0, _reactNative.processColor)(cl); // 1. Neither Skia or RN could parse the color
|
27
|
-
|
28
|
-
if (typeof rnColor !== "number") {
|
29
|
-
console.warn("Skia couldn't parse the following color " + cl);
|
30
|
-
return BLACK; // 2. The color is recognized by RN but not by Skia
|
31
|
-
} else {
|
32
|
-
console.warn("Skia couldn't parse the following color " + cl + ". The color parsing was delegated to React Native. Please file on issue with that color."); // On android we need to move the alpha byte to the start of the structure
|
33
|
-
|
34
|
-
if (_reactNative.Platform.OS === "android") {
|
35
|
-
rnColor = rnColor >>> 0;
|
36
|
-
const a = rnColor >> 24 & 0xff;
|
37
|
-
const r = rnColor >> 16 & 0xff;
|
38
|
-
const g = rnColor >> 8 & 0xff;
|
39
|
-
const b = rnColor & 0xff;
|
40
|
-
rnColor = (a << 24 | r << 16 | g << 8 | b) >>> 0;
|
41
|
-
}
|
42
|
-
|
43
|
-
return rnColor;
|
44
|
-
}
|
45
|
-
}
|
46
|
-
};
|
47
|
-
/**
|
48
|
-
* Declares the interface for the native Skia API
|
49
|
-
*/
|
50
|
-
|
10
|
+
/*global SkiaApi*/
|
51
11
|
|
52
12
|
/**
|
53
13
|
* Declares the implemented API with overrides.
|
@@ -70,15 +30,14 @@ const Skia = {
|
|
70
30
|
Point: SkiaApi.Point,
|
71
31
|
XYWHRect: SkiaApi.XYWHRect,
|
72
32
|
RRectXY: SkiaApi.RRectXY,
|
33
|
+
RuntimeShaderBuilder: SkiaApi.RuntimeShaderBuilder,
|
73
34
|
Paint: SkiaApi.Paint,
|
74
35
|
PictureRecorder: SkiaApi.PictureRecorder,
|
75
36
|
Picture: SkiaApi.Picture,
|
76
37
|
Path: SkiaApi.Path,
|
77
38
|
ColorFilter: SkiaApi.ColorFilter,
|
78
39
|
ContourMeasureIter: SkiaApi.ContourMeasureIter,
|
79
|
-
|
80
|
-
Color: SkiaColor,
|
81
|
-
parseColorString: SkiaApi.parseColorString,
|
40
|
+
Color: SkiaApi.Color,
|
82
41
|
RSXform: SkiaApi.RSXform,
|
83
42
|
// For the following methods the factory symmetry is broken to be comptatible with CanvasKit
|
84
43
|
MakeSurface: SkiaApi.Surface.Make,
|
@@ -87,5 +46,4 @@ const Skia = {
|
|
87
46
|
MakeVertices: SkiaApi.MakeVertices
|
88
47
|
};
|
89
48
|
exports.Skia = Skia;
|
90
|
-
const BLACK = Skia.parseColorString("black");
|
91
49
|
//# sourceMappingURL=Skia.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Skia.ts"],"names":["
|
1
|
+
{"version":3,"sources":["Skia.ts"],"names":["Skia","Typeface","SkiaApi","MaskFilter","RuntimeEffect","Shader","ImageFilter","PathEffect","Data","SVG","FontMgr","TextBlob","Matrix","Font","Point","XYWHRect","RRectXY","RuntimeShaderBuilder","Paint","PictureRecorder","Picture","Path","ColorFilter","ContourMeasureIter","Color","RSXform","MakeSurface","Surface","Make","MakeImageFromEncoded","Image","MakeImage","MakeVertices"],"mappings":";;;;;;;AACA;;AADA;;AAWA;AACA;AACA;AACO,MAAMA,IAAI,GAAG;AAClB;AACAC,EAAAA,QAAQ,EAAEC,OAAO,CAACD,QAFA;AAGlBE,EAAAA,UAAU,EAAED,OAAO,CAACC,UAHF;AAIlBC,EAAAA,aAAa,EAAEF,OAAO,CAACE,aAJL;AAKlBC,EAAAA,MAAM,EAAEH,OAAO,CAACG,MALE;AAMlBC,EAAAA,WAAW,EAAEJ,OAAO,CAACI,WANH;AAOlBC,EAAAA,UAAU,EAAEL,OAAO,CAACK,UAPF;AAQlBC,EAAAA,IAAI,EAAEN,OAAO,CAACM,IARI;AASlBC,EAAAA,GAAG,EAAEP,OAAO,CAACO,GATK;AAUlBC,EAAAA,OAAO,EAAER,OAAO,CAACQ,OAVC;AAWlBC,EAAAA,QAAQ,EAAET,OAAO,CAACS,QAXA;AAYlB;AACAC,EAAAA,MAAM,EAAEV,OAAO,CAACU,MAbE;AAclBC,EAAAA,IAAI,EAAEX,OAAO,CAACW,IAdI;AAelBC,EAAAA,KAAK,EAAEZ,OAAO,CAACY,KAfG;AAgBlBC,EAAAA,QAAQ,EAAEb,OAAO,CAACa,QAhBA;AAiBlBC,EAAAA,OAAO,EAAEd,OAAO,CAACc,OAjBC;AAkBlBC,EAAAA,oBAAoB,EAAEf,OAAO,CAACe,oBAlBZ;AAmBlBC,EAAAA,KAAK,EAAEhB,OAAO,CAACgB,KAnBG;AAoBlBC,EAAAA,eAAe,EAAEjB,OAAO,CAACiB,eApBP;AAqBlBC,EAAAA,OAAO,EAAElB,OAAO,CAACkB,OArBC;AAsBlBC,EAAAA,IAAI,EAAEnB,OAAO,CAACmB,IAtBI;AAuBlBC,EAAAA,WAAW,EAAEpB,OAAO,CAACoB,WAvBH;AAwBlBC,EAAAA,kBAAkB,EAAErB,OAAO,CAACqB,kBAxBV;AAyBlBC,EAAAA,KAAK,EAAEtB,OAAO,CAACsB,KAzBG;AA0BlBC,EAAAA,OAAO,EAAEvB,OAAO,CAACuB,OA1BC;AA2BlB;AACAC,EAAAA,WAAW,EAAExB,OAAO,CAACyB,OAAR,CAAgBC,IA5BX;AA6BlBC,EAAAA,oBAAoB,EAAE3B,OAAO,CAAC4B,KAAR,CAAcD,oBA7BlB;AA8BlBE,EAAAA,SAAS,EAAE7B,OAAO,CAAC4B,KAAR,CAAcC,SA9BP;AA+BlBC,EAAAA,YAAY,EAAE9B,OAAO,CAAC8B;AA/BJ,CAAb","sourcesContent":["/*global SkiaApi*/\nimport \"./NativeSetup\";\nimport type { SkiaApi as SkSkiaApi } from \"./SkiaApi\";\n\n/**\n * Declares the SkiaApi as an available object in the global scope\n */\ndeclare global {\n var SkiaApi: SkSkiaApi;\n}\n\n/**\n * Declares the implemented API with overrides.\n */\nexport const Skia = {\n // Factories\n Typeface: SkiaApi.Typeface,\n MaskFilter: SkiaApi.MaskFilter,\n RuntimeEffect: SkiaApi.RuntimeEffect,\n Shader: SkiaApi.Shader,\n ImageFilter: SkiaApi.ImageFilter,\n PathEffect: SkiaApi.PathEffect,\n Data: SkiaApi.Data,\n SVG: SkiaApi.SVG,\n FontMgr: SkiaApi.FontMgr,\n TextBlob: SkiaApi.TextBlob,\n // Constructors\n Matrix: SkiaApi.Matrix,\n Font: SkiaApi.Font,\n Point: SkiaApi.Point,\n XYWHRect: SkiaApi.XYWHRect,\n RRectXY: SkiaApi.RRectXY,\n RuntimeShaderBuilder: SkiaApi.RuntimeShaderBuilder,\n Paint: SkiaApi.Paint,\n PictureRecorder: SkiaApi.PictureRecorder,\n Picture: SkiaApi.Picture,\n Path: SkiaApi.Path,\n ColorFilter: SkiaApi.ColorFilter,\n ContourMeasureIter: SkiaApi.ContourMeasureIter,\n Color: SkiaApi.Color,\n RSXform: SkiaApi.RSXform,\n // For the following methods the factory symmetry is broken to be comptatible with CanvasKit\n MakeSurface: SkiaApi.Surface.Make,\n MakeImageFromEncoded: SkiaApi.Image.MakeImageFromEncoded,\n MakeImage: SkiaApi.Image.MakeImage,\n MakeVertices: SkiaApi.MakeVertices,\n};\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["SkiaApi.ts"],"names":[],"mappings":";;AAqBA","sourcesContent":["import type { ImageFilterFactory } from \"./ImageFilter\";\nimport type { PathFactory } from \"./Path\";\nimport type { ColorFilterFactory } from \"./ColorFilter\";\nimport type { SkFont } from \"./Font\";\nimport type { SkTypeface, TypefaceFactory } from \"./Typeface\";\nimport type { ImageFactory } from \"./Image\";\nimport type { MaskFilterFactory } from \"./MaskFilter\";\nimport type { SkPaint } from \"./Paint\";\nimport type { SkRect } from \"./Rect\";\nimport type { SkRRect } from \"./RRect\";\nimport type { RuntimeEffectFactory } from \"./RuntimeEffect\";\nimport type { ShaderFactory } from \"./Shader\";\nimport type { SkMatrix } from \"./Matrix\";\nimport type { PathEffectFactory } from \"./PathEffect\";\nimport type { SkPoint } from \"./Point\";\nimport type { SkVertices, VertexMode } from \"./Vertices/Vertices\";\nimport type { DataFactory } from \"./Data\";\nimport type { SVGFactory } from \"./SVG\";\nimport type { TextBlobFactory } from \"./TextBlob\";\nimport type { FontMgrFactory } from \"./FontMgr/FontMgrFactory\";\nimport type { SurfaceFactory } from \"./Surface\";\nimport \"./NativeSetup\";\nimport type { SkRSXform } from \"./RSXform\";\nimport type { SkPath } from \"./Path/Path\";\nimport type { SkContourMeasureIter } from \"./ContourMeasure\";\nimport type { PictureFactory, SkPictureRecorder } from \"./Picture\";\nimport type { Color, SkColor } from \"./Color\";\nimport type {\n SkRuntimeShaderBuilder,\n SkRuntimeEffect,\n} from \"./RuntimeEffect/RuntimeEffect\";\n\n/**\n * Declares the interface for the native Skia API\n */\nexport interface SkiaApi {\n Point: (x: number, y: number) => SkPoint;\n XYWHRect: (x: number, y: number, width: number, height: number) => SkRect;\n RuntimeShaderBuilder: (rt: SkRuntimeEffect) => SkRuntimeShaderBuilder;\n RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;\n RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;\n Color: (color: Color) => SkColor;\n parseColorString: (color: string) => SkColor | undefined;\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ) => SkContourMeasureIter;\n Paint: () => SkPaint;\n PictureRecorder: () => SkPictureRecorder;\n Picture: PictureFactory;\n Path: PathFactory;\n Matrix: () => SkMatrix;\n ColorFilter: ColorFilterFactory;\n Font: (typeface?: SkTypeface, size?: number) => SkFont;\n Typeface: TypefaceFactory;\n MaskFilter: MaskFilterFactory;\n RuntimeEffect: RuntimeEffectFactory;\n ImageFilter: ImageFilterFactory;\n Shader: ShaderFactory;\n PathEffect: PathEffectFactory;\n /**\n * Returns an Vertices based on the given positions and optional parameters.\n * See SkVertices.h (especially the Builder) for more details.\n * @param mode\n * @param positions\n * @param textureCoordinates\n * @param colors - either a list of int colors or a flattened color array.\n * @param indices\n * @param isVolatile\n */\n MakeVertices(\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n ): SkVertices;\n Data: DataFactory;\n Image: ImageFactory;\n SVG: SVGFactory;\n FontMgr: FontMgrFactory;\n TextBlob: TextBlobFactory;\n Surface: SurfaceFactory;\n}\n"]}
|
@@ -4,12 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.createValue = exports.createDerivedValue = exports.ValueApi = void 0;
|
7
|
-
const
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
createAnimation: global.SkiaValueApi.createAnimation
|
12
|
-
};
|
7
|
+
const {
|
8
|
+
SkiaValueApi
|
9
|
+
} = global;
|
10
|
+
const ValueApi = SkiaValueApi;
|
13
11
|
exports.ValueApi = ValueApi;
|
14
12
|
const {
|
15
13
|
createValue,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["api.ts"],"names":["
|
1
|
+
{"version":3,"sources":["api.ts"],"names":["SkiaValueApi","global","ValueApi","createValue","createDerivedValue"],"mappings":";;;;;;AAMA,MAAM;AAAEA,EAAAA;AAAF,IAAmBC,MAAzB;AACO,MAAMC,QAAQ,GAAGF,YAAjB;;AAEA,MAAM;AAAEG,EAAAA,WAAF;AAAeC,EAAAA;AAAf,IAAsCF,QAA5C","sourcesContent":["import type { ISkiaValueApi } from \"./types\";\n\ndeclare global {\n var SkiaValueApi: ISkiaValueApi;\n}\n\nconst { SkiaValueApi } = global;\nexport const ValueApi = SkiaValueApi;\n\nexport const { createValue, createDerivedValue } = ValueApi;\n"]}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.createValue = exports.createDerivedValue = exports.ValueApi = void 0;
|
7
|
+
|
8
|
+
var _web = require("./web");
|
9
|
+
|
10
|
+
const ValueApi = _web.ValueApi;
|
11
|
+
exports.ValueApi = ValueApi;
|
12
|
+
const {
|
13
|
+
createValue,
|
14
|
+
createDerivedValue
|
15
|
+
} = ValueApi;
|
16
|
+
exports.createDerivedValue = createDerivedValue;
|
17
|
+
exports.createValue = createValue;
|
18
|
+
//# sourceMappingURL=api.web.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["api.web.ts"],"names":["ValueApi","ValueApiWeb","createValue","createDerivedValue"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,QAAQ,GAAGC,aAAjB;;AAEA,MAAM;AAAEC,EAAAA,WAAF;AAAeC,EAAAA;AAAf,IAAsCH,QAA5C","sourcesContent":["import { ValueApi as ValueApiWeb } from \"./web\";\n\nexport const ValueApi = ValueApiWeb;\n\nexport const { createValue, createDerivedValue } = ValueApi;\n"]}
|
@@ -30,19 +30,6 @@ Object.keys(_hooks).forEach(function (key) {
|
|
30
30
|
});
|
31
31
|
});
|
32
32
|
|
33
|
-
var _animation = require("./animation");
|
34
|
-
|
35
|
-
Object.keys(_animation).forEach(function (key) {
|
36
|
-
if (key === "default" || key === "__esModule") return;
|
37
|
-
if (key in exports && exports[key] === _animation[key]) return;
|
38
|
-
Object.defineProperty(exports, key, {
|
39
|
-
enumerable: true,
|
40
|
-
get: function () {
|
41
|
-
return _animation[key];
|
42
|
-
}
|
43
|
-
});
|
44
|
-
});
|
45
|
-
|
46
33
|
var _api = require("./api");
|
47
34
|
|
48
35
|
Object.keys(_api).forEach(function (key) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from \"./types\";\nexport * from \"./hooks\";\nexport * from \"./api\";\n"]}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.RNSkAnimation = void 0;
|
7
|
+
|
8
|
+
var _RNSkClockValue = require("./RNSkClockValue");
|
9
|
+
|
10
|
+
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; }
|
11
|
+
|
12
|
+
class RNSkAnimation extends _RNSkClockValue.RNSkClockValue {
|
13
|
+
constructor(callback, raf) {
|
14
|
+
super(raf);
|
15
|
+
|
16
|
+
_defineProperty(this, "_callback", void 0);
|
17
|
+
|
18
|
+
_defineProperty(this, "_animationState", undefined);
|
19
|
+
|
20
|
+
this._callback = callback;
|
21
|
+
}
|
22
|
+
|
23
|
+
cancel() {
|
24
|
+
this.stop();
|
25
|
+
}
|
26
|
+
|
27
|
+
update(nextValue) {
|
28
|
+
var _this$_animationState2, _this$_animationState3;
|
29
|
+
|
30
|
+
if (this._callback) {
|
31
|
+
var _this$_animationState;
|
32
|
+
|
33
|
+
this._animationState = this._callback(nextValue, this._animationState);
|
34
|
+
|
35
|
+
if ((_this$_animationState = this._animationState) !== null && _this$_animationState !== void 0 && _this$_animationState.finished) {
|
36
|
+
this.stop();
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
super.update((_this$_animationState2 = (_this$_animationState3 = this._animationState) === null || _this$_animationState3 === void 0 ? void 0 : _this$_animationState3.current) !== null && _this$_animationState2 !== void 0 ? _this$_animationState2 : nextValue);
|
41
|
+
}
|
42
|
+
|
43
|
+
}
|
44
|
+
|
45
|
+
exports.RNSkAnimation = RNSkAnimation;
|
46
|
+
//# sourceMappingURL=RNSkAnimation.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["RNSkAnimation.ts"],"names":["RNSkAnimation","RNSkClockValue","constructor","callback","raf","undefined","_callback","cancel","stop","update","nextValue","_animationState","finished","current"],"mappings":";;;;;;;AAEA;;;;AAEO,MAAMA,aAAN,SACGC,8BADH,CAGP;AACEC,EAAAA,WAAW,CACTC,QADS,EAETC,GAFS,EAGT;AACA,UAAMA,GAAN;;AADA;;AAAA,6CAMuCC,SANvC;;AAEA,SAAKC,SAAL,GAAiBH,QAAjB;AACD;;AAKMI,EAAAA,MAAM,GAAG;AACd,SAAKC,IAAL;AACD;;AAESC,EAAAA,MAAM,CAACC,SAAD,EAA0B;AAAA;;AACxC,QAAI,KAAKJ,SAAT,EAAoB;AAAA;;AAClB,WAAKK,eAAL,GAAuB,KAAKL,SAAL,CAAeI,SAAf,EAA0B,KAAKC,eAA/B,CAAvB;;AACA,mCAAI,KAAKA,eAAT,kDAAI,sBAAsBC,QAA1B,EAAoC;AAClC,aAAKJ,IAAL;AACD;AACF;;AACD,UAAMC,MAAN,qDAAa,KAAKE,eAAlB,2DAAa,uBAAsBE,OAAnC,2EAA8CH,SAA9C;AACD;;AAxBH","sourcesContent":["import type { AnimationState, SkiaAnimation } from \"../types\";\n\nimport { RNSkClockValue } from \"./RNSkClockValue\";\n\nexport class RNSkAnimation<S extends AnimationState = AnimationState>\n extends RNSkClockValue\n implements SkiaAnimation\n{\n constructor(\n callback: (t: number, state: S | undefined) => S,\n raf: (callback: (time: number) => void) => number\n ) {\n super(raf);\n this._callback = callback;\n }\n\n private _callback: (t: number, state: S | undefined) => S;\n private _animationState: S | undefined = undefined;\n\n public cancel() {\n this.stop();\n }\n\n protected update(nextValue: number): void {\n if (this._callback) {\n this._animationState = this._callback(nextValue, this._animationState);\n if (this._animationState?.finished) {\n this.stop();\n }\n }\n super.update(this._animationState?.current ?? nextValue);\n }\n}\n"]}
|
@@ -0,0 +1,75 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.RNSkClockValue = void 0;
|
7
|
+
|
8
|
+
var _RNSkReadonlyValue = require("./RNSkReadonlyValue");
|
9
|
+
|
10
|
+
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; }
|
11
|
+
|
12
|
+
var RNSkClockState;
|
13
|
+
|
14
|
+
(function (RNSkClockState) {
|
15
|
+
RNSkClockState[RNSkClockState["NotStarted"] = 0] = "NotStarted";
|
16
|
+
RNSkClockState[RNSkClockState["Running"] = 1] = "Running";
|
17
|
+
RNSkClockState[RNSkClockState["Stopped"] = 2] = "Stopped";
|
18
|
+
})(RNSkClockState || (RNSkClockState = {}));
|
19
|
+
|
20
|
+
class RNSkClockValue extends _RNSkReadonlyValue.RNSkReadonlyValue {
|
21
|
+
constructor(raf) {
|
22
|
+
super(0);
|
23
|
+
|
24
|
+
_defineProperty(this, "_raf", void 0);
|
25
|
+
|
26
|
+
_defineProperty(this, "_start", void 0);
|
27
|
+
|
28
|
+
_defineProperty(this, "_stop", void 0);
|
29
|
+
|
30
|
+
_defineProperty(this, "_state", RNSkClockState.NotStarted);
|
31
|
+
|
32
|
+
_defineProperty(this, "notifyUpdate", _ => {
|
33
|
+
if (this._state === RNSkClockState.Running) {
|
34
|
+
const now = Date.now();
|
35
|
+
const deltaFromStart = now - this._start;
|
36
|
+
this.tick(deltaFromStart);
|
37
|
+
|
38
|
+
this._raf(this.notifyUpdate);
|
39
|
+
}
|
40
|
+
});
|
41
|
+
|
42
|
+
this._raf = raf;
|
43
|
+
this.update(0);
|
44
|
+
}
|
45
|
+
|
46
|
+
tick(value) {
|
47
|
+
this.update(value);
|
48
|
+
}
|
49
|
+
|
50
|
+
start() {
|
51
|
+
if (this._state === RNSkClockState.NotStarted) {
|
52
|
+
this._start = Date.now();
|
53
|
+
this._stop = this._start;
|
54
|
+
} // Subtract pause time from start
|
55
|
+
|
56
|
+
|
57
|
+
const timeSinceStop = Date.now() - this._stop;
|
58
|
+
|
59
|
+
this._start += timeSinceStop;
|
60
|
+
this._state = RNSkClockState.Running;
|
61
|
+
|
62
|
+
this._raf(this.notifyUpdate);
|
63
|
+
}
|
64
|
+
|
65
|
+
stop() {
|
66
|
+
if (this._state === RNSkClockState.Running) {
|
67
|
+
this._state = RNSkClockState.Stopped;
|
68
|
+
this._stop = Date.now();
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
}
|
73
|
+
|
74
|
+
exports.RNSkClockValue = RNSkClockValue;
|
75
|
+
//# sourceMappingURL=RNSkClockValue.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["RNSkClockValue.ts"],"names":["RNSkClockState","RNSkClockValue","RNSkReadonlyValue","constructor","raf","NotStarted","_","_state","Running","now","Date","deltaFromStart","_start","tick","_raf","notifyUpdate","update","value","start","_stop","timeSinceStop","stop","Stopped"],"mappings":";;;;;;;AAEA;;;;IAEKA,c;;WAAAA,c;AAAAA,EAAAA,c,CAAAA,c;AAAAA,EAAAA,c,CAAAA,c;AAAAA,EAAAA,c,CAAAA,c;GAAAA,c,KAAAA,c;;AAME,MAAMC,cAAN,SACGC,oCADH,CAGP;AACEC,EAAAA,WAAW,CAACC,GAAD,EAAoD;AAC7D,UAAM,CAAN;;AAD6D;;AAAA;;AAAA;;AAAA,oCAS9BJ,cAAc,CAACK,UATe;;AAAA,0CAWvCC,CAAD,IAAe;AACpC,UAAI,KAAKC,MAAL,KAAgBP,cAAc,CAACQ,OAAnC,EAA4C;AAC1C,cAAMC,GAAG,GAAGC,IAAI,CAACD,GAAL,EAAZ;AACA,cAAME,cAAc,GAAGF,GAAG,GAAG,KAAKG,MAAlC;AACA,aAAKC,IAAL,CAAUF,cAAV;;AACA,aAAKG,IAAL,CAAU,KAAKC,YAAf;AACD;AACF,KAlB8D;;AAE7D,SAAKD,IAAL,GAAYV,GAAZ;AACA,SAAKY,MAAL,CAAY,CAAZ;AACD;;AAgBSH,EAAAA,IAAI,CAACI,KAAD,EAAgB;AAC5B,SAAKD,MAAL,CAAYC,KAAZ;AACD;;AAEMC,EAAAA,KAAK,GAAG;AACb,QAAI,KAAKX,MAAL,KAAgBP,cAAc,CAACK,UAAnC,EAA+C;AAC7C,WAAKO,MAAL,GAAcF,IAAI,CAACD,GAAL,EAAd;AACA,WAAKU,KAAL,GAAa,KAAKP,MAAlB;AACD,KAJY,CAKb;;;AACA,UAAMQ,aAAa,GAAGV,IAAI,CAACD,GAAL,KAAa,KAAKU,KAAxC;;AACA,SAAKP,MAAL,IAAgBQ,aAAhB;AAEA,SAAKb,MAAL,GAAcP,cAAc,CAACQ,OAA7B;;AACA,SAAKM,IAAL,CAAU,KAAKC,YAAf;AACD;;AAEMM,EAAAA,IAAI,GAAG;AACZ,QAAI,KAAKd,MAAL,KAAgBP,cAAc,CAACQ,OAAnC,EAA4C;AAC1C,WAAKD,MAAL,GAAcP,cAAc,CAACsB,OAA7B;AACA,WAAKH,KAAL,GAAaT,IAAI,CAACD,GAAL,EAAb;AACD;AACF;;AA3CH","sourcesContent":["import type { SkiaClockValue } from \"../types\";\n\nimport { RNSkReadonlyValue } from \"./RNSkReadonlyValue\";\n\nenum RNSkClockState {\n NotStarted = 0,\n Running = 1,\n Stopped = 2,\n}\n\nexport class RNSkClockValue\n extends RNSkReadonlyValue<number>\n implements SkiaClockValue\n{\n constructor(raf: (callback: (time: number) => void) => number) {\n super(0);\n this._raf = raf;\n this.update(0);\n }\n\n private _raf: (callback: (time: number) => void) => number;\n private _start: number | undefined;\n private _stop: number | undefined;\n private _state: RNSkClockState = RNSkClockState.NotStarted;\n\n private notifyUpdate = (_: number) => {\n if (this._state === RNSkClockState.Running) {\n const now = Date.now();\n const deltaFromStart = now - this._start!;\n this.tick(deltaFromStart);\n this._raf(this.notifyUpdate);\n }\n };\n\n protected tick(value: number) {\n this.update(value);\n }\n\n public start() {\n if (this._state === RNSkClockState.NotStarted) {\n this._start = Date.now();\n this._stop = this._start;\n }\n // Subtract pause time from start\n const timeSinceStop = Date.now() - this._stop!;\n this._start! += timeSinceStop;\n\n this._state = RNSkClockState.Running;\n this._raf(this.notifyUpdate);\n }\n\n public stop() {\n if (this._state === RNSkClockState.Running) {\n this._state = RNSkClockState.Stopped;\n this._stop = Date.now();\n }\n }\n}\n"]}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.RNSkDerivedValue = void 0;
|
7
|
+
|
8
|
+
var _RNSkReadonlyValue = require("./RNSkReadonlyValue");
|
9
|
+
|
10
|
+
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; }
|
11
|
+
|
12
|
+
class RNSkDerivedValue extends _RNSkReadonlyValue.RNSkReadonlyValue {
|
13
|
+
constructor(callback, dependencies) {
|
14
|
+
// Initialize dependencies - we can't call this yet, since
|
15
|
+
// super if not called and it requires a start value to be set.
|
16
|
+
const unsubscribers = [];
|
17
|
+
const notifyUpdateRef = {
|
18
|
+
current: undefined
|
19
|
+
};
|
20
|
+
dependencies.forEach(dep => {
|
21
|
+
if ("__typename__" in dep && "addListener" in dep) {
|
22
|
+
unsubscribers.push(dep.addListener(() => {
|
23
|
+
var _notifyUpdateRef$curr;
|
24
|
+
|
25
|
+
return (_notifyUpdateRef$curr = notifyUpdateRef.current) === null || _notifyUpdateRef$curr === void 0 ? void 0 : _notifyUpdateRef$curr.call(notifyUpdateRef);
|
26
|
+
}));
|
27
|
+
}
|
28
|
+
});
|
29
|
+
super(callback());
|
30
|
+
|
31
|
+
_defineProperty(this, "_callback", void 0);
|
32
|
+
|
33
|
+
_defineProperty(this, "_unsubscribers", void 0);
|
34
|
+
|
35
|
+
this._unsubscribers = unsubscribers;
|
36
|
+
notifyUpdateRef.current = this.dependecyUpdated.bind(this);
|
37
|
+
this._callback = callback;
|
38
|
+
}
|
39
|
+
|
40
|
+
dependecyUpdated() {
|
41
|
+
this.update(this._callback());
|
42
|
+
}
|
43
|
+
|
44
|
+
unsubscribe() {
|
45
|
+
this._unsubscribers.forEach(unsubscribe => unsubscribe());
|
46
|
+
}
|
47
|
+
|
48
|
+
}
|
49
|
+
|
50
|
+
exports.RNSkDerivedValue = RNSkDerivedValue;
|
51
|
+
//# sourceMappingURL=RNSkDerivedValue.js.map
|