@shopify/react-native-skia 1.7.5 → 1.7.7
Sign up to get free protection for your applications and to get access to all the features.
- package/android/cpp/rnskia-android/OpenGLWindowContext.h +8 -1
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +4 -4
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +2 -2
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +13 -0
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaTextureView.java +24 -1
- package/cpp/rnskia/RNSkJsiViewApi.h +0 -3
- package/cpp/rnskia/RNSkView.h +6 -6
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.h +2 -2
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +2 -2
- package/lib/commonjs/dom/nodes/JsiSkDOM.js +2 -2
- package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Circle.d.ts +2 -3
- package/lib/commonjs/dom/nodes/datatypes/Circle.js +11 -6
- package/lib/commonjs/dom/nodes/datatypes/Circle.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Enum.js +1 -0
- package/lib/commonjs/dom/nodes/datatypes/Enum.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Fitting.js +1 -10
- package/lib/commonjs/dom/nodes/datatypes/Fitting.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Gradient.js +3 -2
- package/lib/commonjs/dom/nodes/datatypes/Gradient.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Path.js +4 -1
- package/lib/commonjs/dom/nodes/datatypes/Path.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Radius.js +1 -0
- package/lib/commonjs/dom/nodes/datatypes/Radius.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Rect.d.ts +3 -1
- package/lib/commonjs/dom/nodes/datatypes/Rect.js +17 -7
- package/lib/commonjs/dom/nodes/datatypes/Rect.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Transform.d.ts +2 -1
- package/lib/commonjs/dom/nodes/datatypes/Transform.js +32 -1
- package/lib/commonjs/dom/nodes/datatypes/Transform.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/Box.js +4 -5
- package/lib/commonjs/dom/nodes/drawings/Box.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/CircleNode.js +1 -1
- package/lib/commonjs/dom/nodes/drawings/CircleNode.js.map +1 -1
- package/lib/commonjs/dom/types/DeclarationContext.d.ts +4 -4
- package/lib/commonjs/dom/types/DeclarationContext.js +8 -2
- package/lib/commonjs/dom/types/DeclarationContext.js.map +1 -1
- package/lib/commonjs/external/reanimated/renderHelpers.d.ts +2 -0
- package/lib/commonjs/external/reanimated/renderHelpers.js +11 -6
- package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/commonjs/renderer/HostConfig.js +8 -4
- package/lib/commonjs/renderer/HostConfig.js.map +1 -1
- package/lib/commonjs/renderer/__tests__/setup.d.ts +2 -3
- package/lib/commonjs/renderer/processors/Animations/Animations.d.ts +1 -2
- package/lib/commonjs/renderer/processors/Animations/Animations.js.map +1 -1
- package/lib/commonjs/renderer/typeddash.js +5 -1
- package/lib/commonjs/renderer/typeddash.js.map +1 -1
- package/lib/commonjs/skia/__tests__/setup.d.ts +0 -3
- package/lib/commonjs/skia/types/Path/Path.js +5 -1
- package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
- package/lib/commonjs/skia/types/RRect.d.ts +1 -1
- package/lib/commonjs/skia/types/RRect.js +7 -3
- package/lib/commonjs/skia/types/RRect.js.map +1 -1
- package/lib/commonjs/skia/types/Shader/Shader.js +8 -6
- package/lib/commonjs/skia/types/Shader/Shader.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkParagraphStyle.js +1 -1
- package/lib/commonjs/skia/web/JsiSkParagraphStyle.js.map +1 -1
- package/lib/commonjs/sksg/Container.d.ts +19 -0
- package/lib/commonjs/sksg/Container.js +102 -0
- package/lib/commonjs/sksg/Container.js.map +1 -0
- package/lib/commonjs/sksg/DrawingContext.d.ts +16 -0
- package/lib/commonjs/sksg/DrawingContext.js +186 -0
- package/lib/commonjs/sksg/DrawingContext.js.map +1 -0
- package/lib/commonjs/sksg/HostConfig.d.ts +19 -0
- package/lib/commonjs/sksg/HostConfig.js +168 -0
- package/lib/commonjs/sksg/HostConfig.js.map +1 -0
- package/lib/commonjs/sksg/Reconciler.d.ts +17 -0
- package/lib/commonjs/sksg/Reconciler.js +54 -0
- package/lib/commonjs/sksg/Reconciler.js.map +1 -0
- package/lib/commonjs/sksg/__tests__/MockDeclaration.d.ts +57 -0
- package/lib/commonjs/sksg/nodes/Node.d.ts +7 -0
- package/lib/commonjs/sksg/nodes/Node.js +6 -0
- package/lib/commonjs/sksg/nodes/Node.js.map +1 -0
- package/lib/commonjs/sksg/nodes/colorFilters.d.ts +7 -0
- package/lib/commonjs/sksg/nodes/colorFilters.js +55 -0
- package/lib/commonjs/sksg/nodes/colorFilters.js.map +1 -0
- package/lib/commonjs/sksg/nodes/context.d.ts +3 -0
- package/lib/commonjs/sksg/nodes/context.js +448 -0
- package/lib/commonjs/sksg/nodes/context.js.map +1 -0
- package/lib/commonjs/sksg/nodes/drawings.d.ts +31 -0
- package/lib/commonjs/sksg/nodes/drawings.js +361 -0
- package/lib/commonjs/sksg/nodes/drawings.js.map +1 -0
- package/lib/commonjs/sksg/nodes/imageFilters.d.ts +14 -0
- package/lib/commonjs/sksg/nodes/imageFilters.js +135 -0
- package/lib/commonjs/sksg/nodes/imageFilters.js.map +1 -0
- package/lib/commonjs/sksg/nodes/index.d.ts +3 -0
- package/lib/commonjs/sksg/nodes/index.js +39 -0
- package/lib/commonjs/sksg/nodes/index.js.map +1 -0
- package/lib/commonjs/sksg/nodes/paint.d.ts +2 -0
- package/lib/commonjs/sksg/nodes/paint.js +80 -0
- package/lib/commonjs/sksg/nodes/paint.js.map +1 -0
- package/lib/commonjs/sksg/nodes/pathEffects.d.ts +8 -0
- package/lib/commonjs/sksg/nodes/pathEffects.js +84 -0
- package/lib/commonjs/sksg/nodes/pathEffects.js.map +1 -0
- package/lib/commonjs/sksg/nodes/shaders.d.ts +10 -0
- package/lib/commonjs/sksg/nodes/shaders.js +156 -0
- package/lib/commonjs/sksg/nodes/shaders.js.map +1 -0
- package/lib/commonjs/sksg/nodes/utils.d.ts +3 -0
- package/lib/commonjs/sksg/nodes/utils.js +25 -0
- package/lib/commonjs/sksg/nodes/utils.js.map +1 -0
- package/lib/commonjs/views/SkiaDomView.js +3 -1
- package/lib/commonjs/views/SkiaDomView.js.map +1 -1
- package/lib/commonjs/views/SkiaPictureView.js +0 -2
- package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
- package/lib/commonjs/views/types.d.ts +2 -2
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/dom/nodes/JsiSkDOM.js +2 -2
- package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Circle.d.ts +2 -3
- package/lib/module/dom/nodes/datatypes/Circle.js +12 -6
- package/lib/module/dom/nodes/datatypes/Circle.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Enum.js +2 -0
- package/lib/module/dom/nodes/datatypes/Enum.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Fitting.js +2 -10
- package/lib/module/dom/nodes/datatypes/Fitting.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Gradient.js +4 -2
- package/lib/module/dom/nodes/datatypes/Gradient.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Path.js +5 -1
- package/lib/module/dom/nodes/datatypes/Path.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Radius.js +2 -0
- package/lib/module/dom/nodes/datatypes/Radius.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Rect.d.ts +3 -1
- package/lib/module/dom/nodes/datatypes/Rect.js +14 -5
- package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Transform.d.ts +2 -1
- package/lib/module/dom/nodes/datatypes/Transform.js +31 -0
- package/lib/module/dom/nodes/datatypes/Transform.js.map +1 -1
- package/lib/module/dom/nodes/drawings/Box.js +1 -2
- package/lib/module/dom/nodes/drawings/Box.js.map +1 -1
- package/lib/module/dom/nodes/drawings/CircleNode.js +1 -1
- package/lib/module/dom/nodes/drawings/CircleNode.js.map +1 -1
- package/lib/module/dom/types/DeclarationContext.d.ts +4 -4
- package/lib/module/dom/types/DeclarationContext.js +9 -2
- package/lib/module/dom/types/DeclarationContext.js.map +1 -1
- package/lib/module/external/reanimated/renderHelpers.d.ts +2 -0
- package/lib/module/external/reanimated/renderHelpers.js +8 -4
- package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/module/renderer/HostConfig.js +8 -4
- package/lib/module/renderer/HostConfig.js.map +1 -1
- package/lib/module/renderer/__tests__/setup.d.ts +2 -3
- package/lib/module/renderer/processors/Animations/Animations.d.ts +1 -2
- package/lib/module/renderer/processors/Animations/Animations.js.map +1 -1
- package/lib/module/renderer/typeddash.js +5 -1
- package/lib/module/renderer/typeddash.js.map +1 -1
- package/lib/module/skia/__tests__/setup.d.ts +0 -3
- package/lib/module/skia/types/Path/Path.js +5 -1
- package/lib/module/skia/types/Path/Path.js.map +1 -1
- package/lib/module/skia/types/RRect.d.ts +1 -1
- package/lib/module/skia/types/RRect.js +7 -3
- package/lib/module/skia/types/RRect.js.map +1 -1
- package/lib/module/skia/types/Shader/Shader.js +9 -6
- package/lib/module/skia/types/Shader/Shader.js.map +1 -1
- package/lib/module/skia/web/JsiSkParagraphStyle.js +1 -1
- package/lib/module/skia/web/JsiSkParagraphStyle.js.map +1 -1
- package/lib/module/sksg/Container.d.ts +19 -0
- package/lib/module/sksg/Container.js +94 -0
- package/lib/module/sksg/Container.js.map +1 -0
- package/lib/module/sksg/DrawingContext.d.ts +16 -0
- package/lib/module/sksg/DrawingContext.js +180 -0
- package/lib/module/sksg/DrawingContext.js.map +1 -0
- package/lib/module/sksg/HostConfig.d.ts +19 -0
- package/lib/module/sksg/HostConfig.js +161 -0
- package/lib/module/sksg/HostConfig.js.map +1 -0
- package/lib/module/sksg/Reconciler.d.ts +17 -0
- package/lib/module/sksg/Reconciler.js +46 -0
- package/lib/module/sksg/Reconciler.js.map +1 -0
- package/lib/module/sksg/__tests__/MockDeclaration.d.ts +57 -0
- package/lib/module/sksg/nodes/Node.d.ts +7 -0
- package/lib/module/sksg/nodes/Node.js +2 -0
- package/lib/module/sksg/nodes/Node.js.map +1 -0
- package/lib/module/sksg/nodes/colorFilters.d.ts +7 -0
- package/lib/module/sksg/nodes/colorFilters.js +44 -0
- package/lib/module/sksg/nodes/colorFilters.js.map +1 -0
- package/lib/module/sksg/nodes/context.d.ts +3 -0
- package/lib/module/sksg/nodes/context.js +443 -0
- package/lib/module/sksg/nodes/context.js.map +1 -0
- package/lib/module/sksg/nodes/drawings.d.ts +31 -0
- package/lib/module/sksg/nodes/drawings.js +334 -0
- package/lib/module/sksg/nodes/drawings.js.map +1 -0
- package/lib/module/sksg/nodes/imageFilters.d.ts +14 -0
- package/lib/module/sksg/nodes/imageFilters.js +122 -0
- package/lib/module/sksg/nodes/imageFilters.js.map +1 -0
- package/lib/module/sksg/nodes/index.d.ts +3 -0
- package/lib/module/sksg/nodes/index.js +4 -0
- package/lib/module/sksg/nodes/index.js.map +1 -0
- package/lib/module/sksg/nodes/paint.d.ts +2 -0
- package/lib/module/sksg/nodes/paint.js +74 -0
- package/lib/module/sksg/nodes/paint.js.map +1 -0
- package/lib/module/sksg/nodes/pathEffects.d.ts +8 -0
- package/lib/module/sksg/nodes/pathEffects.js +72 -0
- package/lib/module/sksg/nodes/pathEffects.js.map +1 -0
- package/lib/module/sksg/nodes/shaders.d.ts +10 -0
- package/lib/module/sksg/nodes/shaders.js +142 -0
- package/lib/module/sksg/nodes/shaders.js.map +1 -0
- package/lib/module/sksg/nodes/utils.d.ts +3 -0
- package/lib/module/sksg/nodes/utils.js +18 -0
- package/lib/module/sksg/nodes/utils.js.map +1 -0
- package/lib/module/views/SkiaDomView.js +3 -1
- package/lib/module/views/SkiaDomView.js.map +1 -1
- package/lib/module/views/SkiaPictureView.js +0 -2
- package/lib/module/views/SkiaPictureView.js.map +1 -1
- package/lib/module/views/types.d.ts +2 -2
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/lib/commonjs/dom/nodes/datatypes/Circle.d.ts +1 -1
- package/lib/typescript/lib/commonjs/dom/nodes/datatypes/Rect.d.ts +2 -0
- package/lib/typescript/lib/commonjs/dom/nodes/datatypes/Transform.d.ts +1 -0
- package/lib/typescript/lib/commonjs/external/reanimated/renderHelpers.d.ts +2 -0
- package/lib/typescript/lib/commonjs/renderer/HostConfig.d.ts +3 -1
- package/lib/typescript/lib/commonjs/sksg/Container.d.ts +16 -0
- package/lib/typescript/lib/commonjs/sksg/DrawingContext.d.ts +26 -0
- package/lib/typescript/lib/commonjs/sksg/HostConfig.d.ts +50 -0
- package/lib/typescript/lib/commonjs/sksg/Reconciler.d.ts +16 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/Node.d.ts +1 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/colorFilters.d.ts +7 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/context.d.ts +2 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/drawings.d.ts +23 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/imageFilters.d.ts +10 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/index.d.ts +1 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/paint.d.ts +2 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/pathEffects.d.ts +8 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/shaders.d.ts +10 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/utils.d.ts +3 -0
- package/lib/typescript/lib/module/dom/nodes/datatypes/Circle.d.ts +1 -1
- package/lib/typescript/lib/module/dom/nodes/datatypes/Rect.d.ts +2 -0
- package/lib/typescript/lib/module/dom/nodes/datatypes/Transform.d.ts +1 -0
- package/lib/typescript/lib/module/external/reanimated/renderHelpers.d.ts +2 -0
- package/lib/typescript/lib/module/mock/index.d.ts +4 -1
- package/lib/typescript/lib/module/renderer/HostConfig.d.ts +3 -1
- package/lib/typescript/lib/module/sksg/Container.d.ts +15 -0
- package/lib/typescript/lib/module/sksg/DrawingContext.d.ts +26 -0
- package/lib/typescript/lib/module/sksg/HostConfig.d.ts +49 -0
- package/lib/typescript/lib/module/sksg/Reconciler.d.ts +15 -0
- package/lib/typescript/lib/module/sksg/nodes/colorFilters.d.ts +6 -0
- package/lib/typescript/lib/module/sksg/nodes/context.d.ts +1 -0
- package/lib/typescript/lib/module/sksg/nodes/drawings.d.ts +22 -0
- package/lib/typescript/lib/module/sksg/nodes/imageFilters.d.ts +9 -0
- package/lib/typescript/lib/module/sksg/nodes/index.d.ts +3 -0
- package/lib/typescript/lib/module/sksg/nodes/paint.d.ts +1 -0
- package/lib/typescript/lib/module/sksg/nodes/pathEffects.d.ts +7 -0
- package/lib/typescript/lib/module/sksg/nodes/shaders.d.ts +9 -0
- package/lib/typescript/lib/module/sksg/nodes/utils.d.ts +2 -0
- package/lib/typescript/src/dom/nodes/datatypes/Circle.d.ts +2 -3
- package/lib/typescript/src/dom/nodes/datatypes/Rect.d.ts +3 -1
- package/lib/typescript/src/dom/nodes/datatypes/Transform.d.ts +2 -1
- package/lib/typescript/src/dom/types/DeclarationContext.d.ts +4 -4
- package/lib/typescript/src/external/reanimated/renderHelpers.d.ts +2 -0
- package/lib/typescript/src/renderer/__tests__/setup.d.ts +2 -3
- package/lib/typescript/src/renderer/processors/Animations/Animations.d.ts +1 -2
- package/lib/typescript/src/skia/__tests__/setup.d.ts +0 -3
- package/lib/typescript/src/skia/types/RRect.d.ts +1 -1
- package/lib/typescript/src/sksg/Container.d.ts +19 -0
- package/lib/typescript/src/sksg/DrawingContext.d.ts +16 -0
- package/lib/typescript/src/sksg/HostConfig.d.ts +19 -0
- package/lib/typescript/src/sksg/Reconciler.d.ts +17 -0
- package/lib/typescript/src/sksg/__tests__/MockDeclaration.d.ts +57 -0
- package/lib/typescript/src/sksg/nodes/Node.d.ts +7 -0
- package/lib/typescript/src/sksg/nodes/colorFilters.d.ts +7 -0
- package/lib/typescript/src/sksg/nodes/context.d.ts +3 -0
- package/lib/typescript/src/sksg/nodes/drawings.d.ts +31 -0
- package/lib/typescript/src/sksg/nodes/imageFilters.d.ts +14 -0
- package/lib/typescript/src/sksg/nodes/index.d.ts +3 -0
- package/lib/typescript/src/sksg/nodes/paint.d.ts +2 -0
- package/lib/typescript/src/sksg/nodes/pathEffects.d.ts +8 -0
- package/lib/typescript/src/sksg/nodes/shaders.d.ts +10 -0
- package/lib/typescript/src/sksg/nodes/utils.d.ts +3 -0
- package/lib/typescript/src/views/types.d.ts +2 -2
- package/libs/{ios → apple}/libskia.xcframework/Info.plist +15 -0
- package/libs/{ios → apple}/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/{ios → apple}/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/macos-arm64_x86_64/libskia.a +0 -0
- package/libs/{ios → apple}/libskottie.xcframework/Info.plist +20 -5
- package/libs/{ios → apple}/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/{ios → apple}/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/apple/libskottie.xcframework/macos-arm64_x86_64/libskottie.a +0 -0
- package/libs/{ios → apple}/libskparagraph.xcframework/Info.plist +20 -5
- package/libs/{ios → apple}/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/{ios → apple}/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/apple/libskparagraph.xcframework/macos-arm64_x86_64/libskparagraph.a +0 -0
- package/libs/{ios → apple}/libsksg.xcframework/Info.plist +15 -0
- package/libs/{ios → apple}/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/{ios → apple}/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/apple/libsksg.xcframework/macos-arm64_x86_64/libsksg.a +0 -0
- package/libs/{ios → apple}/libskshaper.xcframework/Info.plist +20 -5
- package/libs/{ios → apple}/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/{ios → apple}/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/apple/libskshaper.xcframework/macos-arm64_x86_64/libskshaper.a +0 -0
- package/libs/{ios → apple}/libskunicode_core.xcframework/Info.plist +18 -3
- package/libs/{ios → apple}/libskunicode_core.xcframework/ios-arm64_arm64e/libskunicode_core.a +0 -0
- package/libs/{ios → apple}/libskunicode_core.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
- package/libs/apple/libskunicode_core.xcframework/macos-arm64_x86_64/libskunicode_core.a +0 -0
- package/libs/{ios → apple}/libskunicode_libgrapheme.xcframework/Info.plist +15 -0
- package/libs/{ios → apple}/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
- package/libs/{ios → apple}/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/macos-arm64_x86_64/libskunicode_libgrapheme.a +0 -0
- package/libs/{ios → apple}/libsvg.xcframework/Info.plist +15 -0
- package/libs/{ios → apple}/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/{ios → apple}/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/libs/apple/libsvg.xcframework/macos-arm64_x86_64/libsvg.a +0 -0
- package/package.json +3 -3
- package/react-native-skia.podspec +9 -9
- package/src/__tests__/setup.ts +1 -1
- package/src/__tests__/snapshots/sksg/breathe-0.png +0 -0
- package/src/__tests__/snapshots/sksg/breathe.png +0 -0
- package/src/__tests__/snapshots/sksg/simple.png +0 -0
- package/src/__tests__/snapshots/sksg/simple2.png +0 -0
- package/src/dom/nodes/JsiSkDOM.ts +2 -4
- package/src/dom/nodes/datatypes/Circle.ts +7 -5
- package/src/dom/nodes/datatypes/Enum.ts +2 -0
- package/src/dom/nodes/datatypes/Fitting.ts +2 -5
- package/src/dom/nodes/datatypes/Gradient.ts +4 -7
- package/src/dom/nodes/datatypes/Path.ts +5 -2
- package/src/dom/nodes/datatypes/Radius.ts +2 -0
- package/src/dom/nodes/datatypes/Rect.ts +40 -6
- package/src/dom/nodes/datatypes/Transform.ts +29 -1
- package/src/dom/nodes/drawings/Box.ts +1 -29
- package/src/dom/nodes/drawings/CircleNode.ts +1 -1
- package/src/dom/types/DeclarationContext.ts +12 -2
- package/src/external/reanimated/renderHelpers.ts +8 -4
- package/src/renderer/HostConfig.ts +10 -4
- package/src/renderer/__tests__/documentation/shapes/Box.spec.tsx +2 -2
- package/src/renderer/__tests__/setup.tsx +17 -15
- package/src/renderer/processors/Animations/Animations.ts +1 -5
- package/src/renderer/typeddash.ts +4 -2
- package/src/skia/__tests__/setup.ts +1 -51
- package/src/skia/types/Path/Path.ts +4 -2
- package/src/skia/types/RRect.ts +9 -3
- package/src/skia/types/Shader/Shader.ts +7 -4
- package/src/skia/web/JsiSkParagraphStyle.ts +1 -3
- package/src/sksg/Container.ts +102 -0
- package/src/sksg/DrawingContext.ts +221 -0
- package/src/sksg/HostConfig.ts +287 -0
- package/src/sksg/Reconciler.ts +59 -0
- package/src/sksg/__tests__/Declarations.spec.tsx +235 -0
- package/src/sksg/__tests__/MockDeclaration.ts +140 -0
- package/src/sksg/__tests__/Simple.spec.tsx +148 -0
- package/src/sksg/nodes/Node.ts +8 -0
- package/src/sksg/nodes/colorFilters.ts +60 -0
- package/src/sksg/nodes/context.ts +489 -0
- package/src/sksg/nodes/drawings.ts +393 -0
- package/src/sksg/nodes/imageFilters.ts +183 -0
- package/src/sksg/nodes/index.ts +3 -0
- package/src/sksg/nodes/paint.ts +75 -0
- package/src/sksg/nodes/pathEffects.ts +95 -0
- package/src/sksg/nodes/shaders.ts +203 -0
- package/src/sksg/nodes/utils.ts +23 -0
- package/src/views/SkiaDomView.tsx +3 -1
- package/src/views/SkiaPictureView.tsx +0 -2
- package/src/views/types.ts +2 -2
- package/lib/commonjs/dom/__tests__/Shaders.spec.d.ts +0 -1
- package/lib/commonjs/renderer/__tests__/SkiaDOM.spec.d.ts +0 -1
- package/lib/module/dom/__tests__/Compose.spec.d.ts +0 -1
- package/lib/module/dom/__tests__/Demos.spec.d.ts +0 -1
- package/lib/module/dom/__tests__/DrawingContext.spec.d.ts +0 -1
- package/lib/module/dom/__tests__/Drawings.spec.d.ts +0 -1
- package/lib/module/dom/__tests__/Group.spec.d.ts +0 -1
- package/lib/module/dom/__tests__/Paint.spec.d.ts +0 -1
- package/lib/module/dom/__tests__/RenderNodes.spec.d.ts +0 -1
- package/lib/module/dom/__tests__/Shaders.spec.d.ts +0 -1
- package/lib/module/renderer/__tests__/SkiaDOM.spec.d.ts +0 -1
- package/lib/typescript/src/dom/__tests__/Compose.spec.d.ts +0 -1
- package/lib/typescript/src/dom/__tests__/Demos.spec.d.ts +0 -1
- package/lib/typescript/src/dom/__tests__/DrawingContext.spec.d.ts +0 -1
- package/lib/typescript/src/dom/__tests__/Drawings.spec.d.ts +0 -1
- package/lib/typescript/src/dom/__tests__/Group.spec.d.ts +0 -1
- package/lib/typescript/src/dom/__tests__/Paint.spec.d.ts +0 -1
- package/lib/typescript/src/dom/__tests__/RenderNodes.spec.d.ts +0 -1
- package/lib/typescript/src/dom/__tests__/Shaders.spec.d.ts +0 -1
- package/lib/typescript/src/renderer/__tests__/SkiaDOM.spec.d.ts +0 -1
- package/src/dom/__tests__/Compose.spec.tsx +0 -42
- package/src/dom/__tests__/Demos.spec.tsx +0 -145
- package/src/dom/__tests__/DrawingContext.spec.tsx +0 -99
- package/src/dom/__tests__/Drawings.spec.tsx +0 -95
- package/src/dom/__tests__/Group.spec.tsx +0 -132
- package/src/dom/__tests__/Paint.spec.tsx +0 -100
- package/src/dom/__tests__/RenderNodes.spec.tsx +0 -44
- package/src/dom/__tests__/Shaders.spec.tsx +0 -123
- package/src/renderer/__tests__/SkiaDOM.spec.tsx +0 -46
- /package/lib/commonjs/{dom/__tests__/Compose.spec.d.ts → sksg/__tests__/Declarations.spec.d.ts} +0 -0
- /package/lib/commonjs/{dom/__tests__/Demos.spec.d.ts → sksg/__tests__/Simple.spec.d.ts} +0 -0
- /package/lib/{commonjs/dom/__tests__/DrawingContext.spec.d.ts → module/sksg/__tests__/Declarations.spec.d.ts} +0 -0
- /package/lib/{commonjs/dom/__tests__/Drawings.spec.d.ts → module/sksg/__tests__/Simple.spec.d.ts} +0 -0
- /package/lib/{commonjs/dom/__tests__/Group.spec.d.ts → typescript/lib/module/sksg/nodes/Node.d.ts} +0 -0
- /package/lib/{commonjs/dom/__tests__/Paint.spec.d.ts → typescript/src/sksg/__tests__/Declarations.spec.d.ts} +0 -0
- /package/lib/{commonjs/dom/__tests__/RenderNodes.spec.d.ts → typescript/src/sksg/__tests__/Simple.spec.d.ts} +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["Object","defineProperty","exports","value","DrawingContext","_nodes","require","_types","_types2","_defineProperty","e","r","t","_toPropertyKey","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","computeClip","Skia","clip","isPathDef","clipPath","processPath","isRRect","clipRRect","clipRect","undefined","constructor","canvas","paints","Paint","declCtx","DeclarationContext","save","push","paint","copy","restore","pop","length","Error","getLocalPaints","popAll","processPaint","opacity","color","strokeWidth","blendMode","style","strokeJoin","strokeCap","strokeMiter","antiAlias","dither","paintProp","shouldRestore","colorFilter","colorFilters","popAllAsOne","imageFilter","imageFilters","shader","shaders","maskFilter","maskFilters","pathEffect","pathEffects","setAlphaf","getAlphaf","currentOpacity","setShader","setColor","Color","Array","isArray","Float32Array","setStrokeWidth","setBlendMode","BlendMode","enumKey","setStyle","PaintStyle","setStrokeJoin","StrokeJoin","setStrokeCap","StrokeCap","setStrokeMiter","setAntiAlias","setDither","setColorFilter","setImageFilter","setMaskFilter","setPathEffect","processMatrixAndClipping","props","layer","hasTransform","matrix","transform","hasClip","op","invertClip","ClipOp","Difference","Intersect","m3","processTransformProps2","shouldSave","saveLayer","concat"],"sources":["DrawingContext.ts"],"sourcesContent":["\"worklet\";\n\nimport {\n enumKey,\n isPathDef,\n processPath,\n processTransformProps2,\n} from \"../dom/nodes\";\nimport type { ClipDef, DrawingNodeProps, GroupProps } from \"../dom/types\";\nimport { DeclarationContext } from \"../dom/types\";\nimport {\n BlendMode,\n ClipOp,\n isRRect,\n PaintStyle,\n StrokeCap,\n StrokeJoin,\n} from \"../skia/types\";\nimport type {\n SkPath,\n SkRect,\n SkRRect,\n SkCanvas,\n Skia,\n SkPaint,\n} from \"../skia/types\";\n\nconst computeClip = (\n Skia: Skia,\n clip: ClipDef | undefined\n):\n | undefined\n | { clipPath: SkPath }\n | { clipRect: SkRect }\n | { clipRRect: SkRRect } => {\n if (clip) {\n if (isPathDef(clip)) {\n return { clipPath: processPath(Skia, clip) };\n } else if (isRRect(clip)) {\n return { clipRRect: clip };\n } else {\n return { clipRect: clip };\n }\n }\n return undefined;\n};\n\nexport class DrawingContext {\n private paints: SkPaint[];\n public declCtx: DeclarationContext;\n public Skia: Skia;\n public canvas: SkCanvas;\n\n constructor(Skia: Skia, canvas: SkCanvas) {\n this.Skia = Skia;\n this.canvas = canvas;\n this.paints = [Skia.Paint()];\n this.declCtx = new DeclarationContext(this.Skia);\n }\n\n save() {\n this.paints.push(this.paint.copy());\n }\n\n restore() {\n this.paints.pop();\n }\n\n get paint() {\n const paint = this.paints[this.paints.length - 1];\n if (!paint) {\n throw new Error(\"Paint is undefined\");\n }\n return paint;\n }\n\n getLocalPaints() {\n const { paint } = this;\n return [paint, ...this.declCtx.paints.popAll()];\n }\n\n processPaint({\n opacity,\n color,\n strokeWidth,\n blendMode,\n style,\n strokeJoin,\n strokeCap,\n strokeMiter,\n antiAlias,\n dither,\n paint: paintProp,\n }: DrawingNodeProps) {\n if (paintProp) {\n this.declCtx.paints.push(paintProp);\n return true;\n }\n let shouldRestore = false;\n const colorFilter = this.declCtx.colorFilters.popAllAsOne();\n const imageFilter = this.declCtx.imageFilters.popAllAsOne();\n const shader = this.declCtx.shaders.pop();\n const maskFilter = this.declCtx.maskFilters.pop();\n const pathEffect = this.declCtx.pathEffects.popAllAsOne();\n if (\n opacity !== undefined ||\n color !== undefined ||\n strokeWidth !== undefined ||\n blendMode !== undefined ||\n style !== undefined ||\n strokeJoin !== undefined ||\n strokeCap !== undefined ||\n strokeMiter !== undefined ||\n antiAlias !== undefined ||\n dither !== undefined ||\n colorFilter !== undefined ||\n imageFilter !== undefined ||\n shader !== undefined ||\n maskFilter !== undefined ||\n pathEffect !== undefined\n ) {\n if (!shouldRestore) {\n this.save();\n shouldRestore = true;\n }\n }\n const { paint } = this;\n if (opacity !== undefined) {\n paint.setAlphaf(paint.getAlphaf() * opacity);\n }\n if (color !== undefined) {\n const currentOpacity = paint.getAlphaf();\n paint.setShader(null);\n if (typeof color === \"string\" || typeof color === \"number\") {\n paint.setColor(this.Skia.Color(color));\n } else if (Array.isArray(color)) {\n paint.setColor(new Float32Array(color));\n } else if (color instanceof Float32Array) {\n paint.setColor(color);\n } else {\n throw new Error(\"Invalid color\");\n }\n paint.setAlphaf(currentOpacity * paint.getAlphaf());\n }\n if (strokeWidth !== undefined) {\n paint.setStrokeWidth(strokeWidth);\n }\n if (blendMode !== undefined) {\n paint.setBlendMode(BlendMode[enumKey(blendMode)]);\n }\n if (style !== undefined) {\n paint.setStyle(PaintStyle[enumKey(style)]);\n }\n if (strokeJoin !== undefined) {\n paint.setStrokeJoin(StrokeJoin[enumKey(strokeJoin)]);\n }\n if (strokeCap !== undefined) {\n paint.setStrokeCap(StrokeCap[enumKey(strokeCap)]);\n }\n if (strokeMiter !== undefined) {\n paint.setStrokeMiter(strokeMiter);\n }\n if (antiAlias !== undefined) {\n paint.setAntiAlias(antiAlias);\n }\n if (dither !== undefined) {\n paint.setDither(dither);\n }\n if (colorFilter) {\n paint.setColorFilter(colorFilter);\n }\n if (imageFilter) {\n paint.setImageFilter(imageFilter);\n }\n if (shader) {\n paint.setShader(shader);\n }\n if (maskFilter) {\n paint.setMaskFilter(maskFilter);\n }\n if (pathEffect) {\n paint.setPathEffect(pathEffect);\n }\n return shouldRestore;\n }\n\n processMatrixAndClipping(props: GroupProps, layer?: boolean | SkPaint) {\n const hasTransform =\n props.matrix !== undefined || props.transform !== undefined;\n const clip = computeClip(this.Skia, props.clip);\n const hasClip = clip !== undefined;\n const op = props.invertClip ? ClipOp.Difference : ClipOp.Intersect;\n const m3 = processTransformProps2(this.Skia, props);\n const shouldSave = hasTransform || hasClip || !!layer;\n if (shouldSave) {\n if (layer) {\n if (typeof layer === \"boolean\") {\n this.canvas.saveLayer();\n } else {\n this.canvas.saveLayer(layer);\n }\n } else {\n this.canvas.save();\n }\n }\n\n if (m3) {\n this.canvas.concat(m3);\n }\n if (clip) {\n if (\"clipRect\" in clip) {\n this.canvas.clipRect(clip.clipRect, op, true);\n } else if (\"clipRRect\" in clip) {\n this.canvas.clipRRect(clip.clipRRect, op, true);\n } else {\n this.canvas.clipPath(clip.clipPath, op, true);\n }\n }\n return shouldSave;\n }\n}\n"],"mappings":";AAAA,SAAS;;AAACA,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,KAAA;AAAA;AAAAD,OAAA,CAAAE,cAAA;AAEV,IAAAC,MAAA,GAAAC,OAAA;AAOA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAOuB,SAAAG,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAA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E;UAC9B,IAAI,CAACnE,MAAM,CAACgF,SAAS,CAAC,CAAC;QACzB,CAAC,MAAM;UACL,IAAI,CAAChF,MAAM,CAACgF,SAAS,CAACb,KAAK,CAAC;QAC9B;MACF,CAAC,MAAM;QACL,IAAI,CAACnE,MAAM,CAACK,IAAI,CAAC,CAAC;MACpB;IACF;IAEA,IAAIwE,EAAE,EAAE;MACN,IAAI,CAAC7E,MAAM,CAACiF,MAAM,CAACJ,EAAE,CAAC;IACxB;IACA,IAAItF,IAAI,EAAE;MACR,IAAI,UAAU,IAAIA,IAAI,EAAE;QACtB,IAAI,CAACS,MAAM,CAACH,QAAQ,CAACN,IAAI,CAACM,QAAQ,EAAE2E,EAAE,EAAE,IAAI,CAAC;MAC/C,CAAC,MAAM,IAAI,WAAW,IAAIjF,IAAI,EAAE;QAC9B,IAAI,CAACS,MAAM,CAACJ,SAAS,CAACL,IAAI,CAACK,SAAS,EAAE4E,EAAE,EAAE,IAAI,CAAC;MACjD,CAAC,MAAM;QACL,IAAI,CAACxE,MAAM,CAACP,QAAQ,CAACF,IAAI,CAACE,QAAQ,EAAE+E,EAAE,EAAE,IAAI,CAAC;MAC/C;IACF;IACA,OAAOO,UAAU;EACnB;AACF;AAACjH,OAAA,CAAAE,cAAA,GAAAA,cAAA","ignoreList":[]}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import type { HostConfig } from "react-reconciler";
|
2
|
+
import { NodeType } from "../dom/types";
|
3
|
+
import type { Node } from "./nodes/Node";
|
4
|
+
import type { Container } from "./Container";
|
5
|
+
export declare const debug: (message?: any, ...optionalParams: any[]) => void;
|
6
|
+
type Instance = Node;
|
7
|
+
type Props = object;
|
8
|
+
type TextInstance = Node;
|
9
|
+
type SuspenseInstance = Instance;
|
10
|
+
type HydratableInstance = Instance;
|
11
|
+
type PublicInstance = Instance;
|
12
|
+
type HostContext = null;
|
13
|
+
type UpdatePayload = Container;
|
14
|
+
type ChildSet = Node[];
|
15
|
+
type TimeoutHandle = NodeJS.Timeout;
|
16
|
+
type NoTimeout = -1;
|
17
|
+
type SkiaHostConfig = HostConfig<NodeType, Props, Container, Instance, TextInstance, SuspenseInstance, HydratableInstance, PublicInstance, HostContext, UpdatePayload, ChildSet, TimeoutHandle, NoTimeout>;
|
18
|
+
export declare const sksgHostConfig: SkiaHostConfig;
|
19
|
+
export {};
|
@@ -0,0 +1,168 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.sksgHostConfig = exports.debug = void 0;
|
7
|
+
var _constants = require("react-reconciler/constants");
|
8
|
+
var _types = require("../dom/types");
|
9
|
+
var _typeddash = require("../renderer/typeddash");
|
10
|
+
/*global NodeJS*/
|
11
|
+
|
12
|
+
const DEBUG = false;
|
13
|
+
const debug = (...args) => {
|
14
|
+
if (DEBUG) {
|
15
|
+
console.log(...args);
|
16
|
+
}
|
17
|
+
};
|
18
|
+
exports.debug = debug;
|
19
|
+
const isDeclaration = type => {
|
20
|
+
"worklet";
|
21
|
+
|
22
|
+
return (
|
23
|
+
// BlurMaskFilters
|
24
|
+
type === _types.NodeType.BlurMaskFilter ||
|
25
|
+
// ImageFilters
|
26
|
+
type === _types.NodeType.BlendImageFilter || type === _types.NodeType.BlurImageFilter || type === _types.NodeType.OffsetImageFilter || type === _types.NodeType.DropShadowImageFilter || type === _types.NodeType.MorphologyImageFilter || type === _types.NodeType.DisplacementMapImageFilter || type === _types.NodeType.RuntimeShaderImageFilter ||
|
27
|
+
// ColorFilters
|
28
|
+
type === _types.NodeType.MatrixColorFilter || type === _types.NodeType.BlendColorFilter || type === _types.NodeType.LumaColorFilter || type === _types.NodeType.LinearToSRGBGammaColorFilter || type === _types.NodeType.SRGBToLinearGammaColorFilter || type === _types.NodeType.LerpColorFilter ||
|
29
|
+
// Shaders
|
30
|
+
type === _types.NodeType.Shader || type === _types.NodeType.ImageShader || type === _types.NodeType.ColorShader || type === _types.NodeType.Turbulence || type === _types.NodeType.FractalNoise || type === _types.NodeType.LinearGradient || type === _types.NodeType.RadialGradient || type === _types.NodeType.SweepGradient || type === _types.NodeType.TwoPointConicalGradient ||
|
31
|
+
// Path Effects
|
32
|
+
type === _types.NodeType.CornerPathEffect || type === _types.NodeType.DiscretePathEffect || type === _types.NodeType.DashPathEffect || type === _types.NodeType.Path1DPathEffect || type === _types.NodeType.Path2DPathEffect || type === _types.NodeType.SumPathEffect || type === _types.NodeType.Line2DPathEffect ||
|
33
|
+
// Mixed
|
34
|
+
type === _types.NodeType.Blend ||
|
35
|
+
// Paint
|
36
|
+
type === _types.NodeType.Paint
|
37
|
+
);
|
38
|
+
};
|
39
|
+
const sksgHostConfig = exports.sksgHostConfig = {
|
40
|
+
/**
|
41
|
+
* This function is used by the reconciler in order to calculate current time for prioritising work.
|
42
|
+
*/
|
43
|
+
supportsMutation: false,
|
44
|
+
isPrimaryRenderer: false,
|
45
|
+
supportsPersistence: true,
|
46
|
+
supportsHydration: false,
|
47
|
+
//supportsMicrotask: true,
|
48
|
+
scheduleTimeout: setTimeout,
|
49
|
+
cancelTimeout: clearTimeout,
|
50
|
+
noTimeout: -1,
|
51
|
+
getRootHostContext: _rootContainerInstance => {
|
52
|
+
debug("getRootHostContext");
|
53
|
+
return null;
|
54
|
+
},
|
55
|
+
getChildHostContext(_parentHostContext, _type, _rootContainerInstance) {
|
56
|
+
debug("getChildHostContext");
|
57
|
+
return null;
|
58
|
+
},
|
59
|
+
shouldSetTextContent(_type, _props) {
|
60
|
+
return false;
|
61
|
+
},
|
62
|
+
createTextInstance(_text, _rootContainerInstance, _hostContext, _internalInstanceHandle) {
|
63
|
+
debug("createTextInstance");
|
64
|
+
// return SpanNode({}, text) as SkNode;
|
65
|
+
throw new Error("Text nodes are not supported yet");
|
66
|
+
},
|
67
|
+
createInstance(type, props, container, _hostContext, _internalInstanceHandle) {
|
68
|
+
debug("createInstance", type);
|
69
|
+
container.registerValues(props);
|
70
|
+
const instance = {
|
71
|
+
type,
|
72
|
+
isDeclaration: isDeclaration(type),
|
73
|
+
props,
|
74
|
+
children: []
|
75
|
+
};
|
76
|
+
return instance;
|
77
|
+
},
|
78
|
+
appendInitialChild(parentInstance, child) {
|
79
|
+
parentInstance.children.push(child);
|
80
|
+
},
|
81
|
+
finalizeInitialChildren(parentInstance, _type, _props, _rootContainerInstance, _hostContext) {
|
82
|
+
debug("finalizeInitialChildren", parentInstance);
|
83
|
+
return false;
|
84
|
+
},
|
85
|
+
commitMount() {
|
86
|
+
// if finalizeInitialChildren = true
|
87
|
+
debug("commitMount");
|
88
|
+
},
|
89
|
+
prepareForCommit(_containerInfo) {
|
90
|
+
debug("prepareForCommit");
|
91
|
+
return null;
|
92
|
+
},
|
93
|
+
resetAfterCommit(container) {
|
94
|
+
debug("resetAfterCommit");
|
95
|
+
container.redraw();
|
96
|
+
},
|
97
|
+
getPublicInstance(node) {
|
98
|
+
debug("getPublicInstance");
|
99
|
+
return node;
|
100
|
+
},
|
101
|
+
commitTextUpdate: (_textInstance, _oldText, _newText) => {
|
102
|
+
// textInstance.instance = newText;
|
103
|
+
},
|
104
|
+
clearContainer: container => {
|
105
|
+
debug("clearContainer");
|
106
|
+
container.clear();
|
107
|
+
},
|
108
|
+
prepareUpdate(_instance, _type, oldProps, newProps, container, _hostContext) {
|
109
|
+
debug("prepareUpdate");
|
110
|
+
const propsAreEqual = (0, _typeddash.shallowEq)(oldProps, newProps);
|
111
|
+
if (propsAreEqual) {
|
112
|
+
return null;
|
113
|
+
}
|
114
|
+
container.unregisterValues(oldProps);
|
115
|
+
container.registerValues(newProps);
|
116
|
+
return container;
|
117
|
+
},
|
118
|
+
preparePortalMount: () => {
|
119
|
+
debug("preparePortalMount");
|
120
|
+
},
|
121
|
+
cloneInstance(instance, _updatePayload, _type, _oldProps, newProps, _internalInstanceHandle, keepChildren, _recyclableInstance) {
|
122
|
+
debug("cloneInstance");
|
123
|
+
return {
|
124
|
+
type: instance.type,
|
125
|
+
props: newProps,
|
126
|
+
children: keepChildren ? [...instance.children] : [],
|
127
|
+
isDeclaration: instance.isDeclaration
|
128
|
+
};
|
129
|
+
},
|
130
|
+
createContainerChildSet() {
|
131
|
+
debug("createContainerChildSet");
|
132
|
+
return [];
|
133
|
+
},
|
134
|
+
appendChildToContainerChildSet(childSet, child) {
|
135
|
+
childSet.push(child);
|
136
|
+
},
|
137
|
+
finalizeContainerChildren(container, newChildren) {
|
138
|
+
debug("finalizeContainerChildren");
|
139
|
+
container.root = newChildren;
|
140
|
+
},
|
141
|
+
replaceContainerChildren(container, newChildren) {
|
142
|
+
debug("replaceContainerChildren");
|
143
|
+
container.root = newChildren;
|
144
|
+
},
|
145
|
+
cloneHiddenInstance(_instance, _type, _props) {
|
146
|
+
debug("cloneHiddenInstance");
|
147
|
+
throw new Error("Not yet implemented.");
|
148
|
+
},
|
149
|
+
cloneHiddenTextInstance(_instance, _text) {
|
150
|
+
debug("cloneHiddenTextInstance");
|
151
|
+
throw new Error("Not yet implemented.");
|
152
|
+
},
|
153
|
+
// see https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874
|
154
|
+
getCurrentEventPriority: () => _constants.DefaultEventPriority,
|
155
|
+
beforeActiveInstanceBlur: () => {},
|
156
|
+
afterActiveInstanceBlur: () => {},
|
157
|
+
detachDeletedInstance: () => {},
|
158
|
+
getInstanceFromNode: function (_node) {
|
159
|
+
throw new Error("Function not implemented.");
|
160
|
+
},
|
161
|
+
prepareScopeUpdate: function (_scopeInstance, _instance) {
|
162
|
+
throw new Error("Function not implemented.");
|
163
|
+
},
|
164
|
+
getInstanceFromScope: function (_scopeInstance) {
|
165
|
+
throw new Error("Function not implemented.");
|
166
|
+
}
|
167
|
+
};
|
168
|
+
//# sourceMappingURL=HostConfig.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_constants","require","_types","_typeddash","DEBUG","debug","args","console","log","exports","isDeclaration","type","NodeType","BlurMaskFilter","BlendImageFilter","BlurImageFilter","OffsetImageFilter","DropShadowImageFilter","MorphologyImageFilter","DisplacementMapImageFilter","RuntimeShaderImageFilter","MatrixColorFilter","BlendColorFilter","LumaColorFilter","LinearToSRGBGammaColorFilter","SRGBToLinearGammaColorFilter","LerpColorFilter","Shader","ImageShader","ColorShader","Turbulence","FractalNoise","LinearGradient","RadialGradient","SweepGradient","TwoPointConicalGradient","CornerPathEffect","DiscretePathEffect","DashPathEffect","Path1DPathEffect","Path2DPathEffect","SumPathEffect","Line2DPathEffect","Blend","Paint","sksgHostConfig","supportsMutation","isPrimaryRenderer","supportsPersistence","supportsHydration","scheduleTimeout","setTimeout","cancelTimeout","clearTimeout","noTimeout","getRootHostContext","_rootContainerInstance","getChildHostContext","_parentHostContext","_type","shouldSetTextContent","_props","createTextInstance","_text","_hostContext","_internalInstanceHandle","Error","createInstance","props","container","registerValues","instance","children","appendInitialChild","parentInstance","child","push","finalizeInitialChildren","commitMount","prepareForCommit","_containerInfo","resetAfterCommit","redraw","getPublicInstance","node","commitTextUpdate","_textInstance","_oldText","_newText","clearContainer","clear","prepareUpdate","_instance","oldProps","newProps","propsAreEqual","shallowEq","unregisterValues","preparePortalMount","cloneInstance","_updatePayload","_oldProps","keepChildren","_recyclableInstance","createContainerChildSet","appendChildToContainerChildSet","childSet","finalizeContainerChildren","newChildren","root","replaceContainerChildren","cloneHiddenInstance","cloneHiddenTextInstance","getCurrentEventPriority","DefaultEventPriority","beforeActiveInstanceBlur","afterActiveInstanceBlur","detachDeletedInstance","getInstanceFromNode","_node","prepareScopeUpdate","_scopeInstance","getInstanceFromScope"],"sources":["HostConfig.ts"],"sourcesContent":["/*global NodeJS*/\nimport type { Fiber, HostConfig } from \"react-reconciler\";\nimport { DefaultEventPriority } from \"react-reconciler/constants\";\n\nimport { NodeType } from \"../dom/types\";\nimport { shallowEq } from \"../renderer/typeddash\";\n\nimport type { Node } from \"./nodes/Node\";\nimport type { Container } from \"./Container\";\n\nconst DEBUG = false;\nexport const debug = (...args: Parameters<typeof console.log>) => {\n if (DEBUG) {\n console.log(...args);\n }\n};\n\nconst isDeclaration = (type: NodeType) => {\n \"worklet\";\n return (\n // BlurMaskFilters\n type === NodeType.BlurMaskFilter ||\n // ImageFilters\n type === NodeType.BlendImageFilter ||\n type === NodeType.BlurImageFilter ||\n type === NodeType.OffsetImageFilter ||\n type === NodeType.DropShadowImageFilter ||\n type === NodeType.MorphologyImageFilter ||\n type === NodeType.DisplacementMapImageFilter ||\n type === NodeType.RuntimeShaderImageFilter ||\n // ColorFilters\n type === NodeType.MatrixColorFilter ||\n type === NodeType.BlendColorFilter ||\n type === NodeType.LumaColorFilter ||\n type === NodeType.LinearToSRGBGammaColorFilter ||\n type === NodeType.SRGBToLinearGammaColorFilter ||\n type === NodeType.LerpColorFilter ||\n // Shaders\n type === NodeType.Shader ||\n type === NodeType.ImageShader ||\n type === NodeType.ColorShader ||\n type === NodeType.Turbulence ||\n type === NodeType.FractalNoise ||\n type === NodeType.LinearGradient ||\n type === NodeType.RadialGradient ||\n type === NodeType.SweepGradient ||\n type === NodeType.TwoPointConicalGradient ||\n // Path Effects\n type === NodeType.CornerPathEffect ||\n type === NodeType.DiscretePathEffect ||\n type === NodeType.DashPathEffect ||\n type === NodeType.Path1DPathEffect ||\n type === NodeType.Path2DPathEffect ||\n type === NodeType.SumPathEffect ||\n type === NodeType.Line2DPathEffect ||\n // Mixed\n type === NodeType.Blend ||\n // Paint\n type === NodeType.Paint\n );\n};\n\ntype Instance = Node;\n\ntype Props = object;\ntype TextInstance = Node;\ntype SuspenseInstance = Instance;\ntype HydratableInstance = Instance;\ntype PublicInstance = Instance;\ntype HostContext = null;\ntype UpdatePayload = Container;\ntype ChildSet = Node[];\ntype TimeoutHandle = NodeJS.Timeout;\ntype NoTimeout = -1;\n\ntype SkiaHostConfig = HostConfig<\n NodeType,\n Props,\n Container,\n Instance,\n TextInstance,\n SuspenseInstance,\n HydratableInstance,\n PublicInstance,\n HostContext,\n UpdatePayload,\n ChildSet,\n TimeoutHandle,\n NoTimeout\n>;\n\nexport const sksgHostConfig: SkiaHostConfig = {\n /**\n * This function is used by the reconciler in order to calculate current time for prioritising work.\n */\n supportsMutation: false,\n isPrimaryRenderer: false,\n supportsPersistence: true,\n supportsHydration: false,\n //supportsMicrotask: true,\n scheduleTimeout: setTimeout,\n cancelTimeout: clearTimeout,\n noTimeout: -1,\n\n getRootHostContext: (_rootContainerInstance: Container) => {\n debug(\"getRootHostContext\");\n return null;\n },\n\n getChildHostContext(_parentHostContext, _type, _rootContainerInstance) {\n debug(\"getChildHostContext\");\n return null;\n },\n\n shouldSetTextContent(_type, _props) {\n return false;\n },\n\n createTextInstance(\n _text,\n _rootContainerInstance,\n _hostContext,\n _internalInstanceHandle\n ) {\n debug(\"createTextInstance\");\n // return SpanNode({}, text) as SkNode;\n throw new Error(\"Text nodes are not supported yet\");\n },\n\n createInstance(\n type,\n props,\n container,\n _hostContext,\n _internalInstanceHandle\n ) {\n debug(\"createInstance\", type);\n container.registerValues(props);\n const instance = {\n type,\n isDeclaration: isDeclaration(type),\n props,\n children: [],\n };\n return instance;\n },\n\n appendInitialChild(parentInstance: Instance, child: Instance | TextInstance) {\n parentInstance.children.push(child);\n },\n\n finalizeInitialChildren(\n parentInstance,\n _type,\n _props,\n _rootContainerInstance,\n _hostContext\n ) {\n debug(\"finalizeInitialChildren\", parentInstance);\n return false;\n },\n\n commitMount() {\n // if finalizeInitialChildren = true\n debug(\"commitMount\");\n },\n\n prepareForCommit(_containerInfo) {\n debug(\"prepareForCommit\");\n return null;\n },\n\n resetAfterCommit(container) {\n debug(\"resetAfterCommit\");\n container.redraw();\n },\n\n getPublicInstance(node: Instance) {\n debug(\"getPublicInstance\");\n return node;\n },\n\n commitTextUpdate: (\n _textInstance: TextInstance,\n _oldText: string,\n _newText: string\n ) => {\n // textInstance.instance = newText;\n },\n\n clearContainer: (container) => {\n debug(\"clearContainer\");\n container.clear();\n },\n\n prepareUpdate(\n _instance: Instance,\n _type: string,\n oldProps: Props,\n newProps: Props,\n container: Container,\n _hostContext: HostContext\n ) {\n debug(\"prepareUpdate\");\n const propsAreEqual = shallowEq(oldProps, newProps);\n if (propsAreEqual) {\n return null;\n }\n container.unregisterValues(oldProps);\n container.registerValues(newProps);\n return container;\n },\n\n preparePortalMount: () => {\n debug(\"preparePortalMount\");\n },\n\n cloneInstance(\n instance,\n _updatePayload,\n _type,\n _oldProps,\n newProps,\n _internalInstanceHandle,\n keepChildren: boolean,\n _recyclableInstance: null | Instance\n ) {\n debug(\"cloneInstance\");\n\n return {\n type: instance.type,\n props: newProps,\n children: keepChildren ? [...instance.children] : [],\n isDeclaration: instance.isDeclaration,\n };\n },\n\n createContainerChildSet(): ChildSet {\n debug(\"createContainerChildSet\");\n return [];\n },\n\n appendChildToContainerChildSet(\n childSet: ChildSet,\n child: Instance | TextInstance\n ): void {\n childSet.push(child);\n },\n\n finalizeContainerChildren(container: Container, newChildren: ChildSet) {\n debug(\"finalizeContainerChildren\");\n container.root = newChildren;\n },\n\n replaceContainerChildren(container: Container, newChildren: ChildSet) {\n debug(\"replaceContainerChildren\");\n container.root = newChildren;\n },\n\n cloneHiddenInstance(\n _instance: Instance,\n _type: string,\n _props: Props\n ): Instance {\n debug(\"cloneHiddenInstance\");\n throw new Error(\"Not yet implemented.\");\n },\n\n cloneHiddenTextInstance(_instance: Instance, _text: string): TextInstance {\n debug(\"cloneHiddenTextInstance\");\n throw new Error(\"Not yet implemented.\");\n },\n // see https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874\n getCurrentEventPriority: () => DefaultEventPriority,\n beforeActiveInstanceBlur: () => {},\n afterActiveInstanceBlur: () => {},\n detachDeletedInstance: () => {},\n getInstanceFromNode: function (_node): Fiber | null | undefined {\n throw new Error(\"Function not implemented.\");\n },\n prepareScopeUpdate: function (_scopeInstance, _instance): void {\n throw new Error(\"Function not implemented.\");\n },\n getInstanceFromScope: function (_scopeInstance): Instance | null {\n throw new Error(\"Function not implemented.\");\n },\n};\n"],"mappings":";;;;;;AAEA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KAAK,CAAC,2BAA2B,CAAC;IAClCgE,SAAS,CAACwC,IAAI,GAAGD,WAAW;EAC9B,CAAC;EAEDE,wBAAwBA,CAACzC,SAAoB,EAAEuC,WAAqB,EAAE;IACpEvG,KAAK,CAAC,0BAA0B,CAAC;IACjCgE,SAAS,CAACwC,IAAI,GAAGD,WAAW;EAC9B,CAAC;EAEDG,mBAAmBA,CACjBnB,SAAmB,EACnBjC,KAAa,EACbE,MAAa,EACH;IACVxD,KAAK,CAAC,qBAAqB,CAAC;IAC5B,MAAM,IAAI6D,KAAK,CAAC,sBAAsB,CAAC;EACzC,CAAC;EAED8C,uBAAuBA,CAACpB,SAAmB,EAAE7B,KAAa,EAAgB;IACxE1D,KAAK,CAAC,yBAAyB,CAAC;IAChC,MAAM,IAAI6D,KAAK,CAAC,sBAAsB,CAAC;EACzC,CAAC;EACD;EACA+C,uBAAuB,EAAEA,CAAA,KAAMC,+BAAoB;EACnDC,wBAAwB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAClCC,uBAAuB,EAAEA,CAAA,KAAM,CAAC,CAAC;EACjCC,qBAAqB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAC/BC,mBAAmB,EAAE,SAAAA,CAAUC,KAAK,EAA4B;IAC9D,MAAM,IAAIrD,KAAK,CAAC,2BAA2B,CAAC;EAC9C,CAAC;EACDsD,kBAAkB,EAAE,SAAAA,CAAUC,cAAc,EAAE7B,SAAS,EAAQ;IAC7D,MAAM,IAAI1B,KAAK,CAAC,2BAA2B,CAAC;EAC9C,CAAC;EACDwD,oBAAoB,EAAE,SAAAA,CAAUD,cAAc,EAAmB;IAC/D,MAAM,IAAIvD,KAAK,CAAC,2BAA2B,CAAC;EAC9C;AACF,CAAC","ignoreList":[]}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import type { ReactNode } from "react";
|
2
|
+
import type { SkCanvas, Skia } from "../skia/types";
|
3
|
+
import { NodeType } from "../dom/types";
|
4
|
+
export declare class SkiaSGRoot {
|
5
|
+
private root;
|
6
|
+
private container;
|
7
|
+
constructor(Skia: Skia, nativeId?: number);
|
8
|
+
get sg(): {
|
9
|
+
type: NodeType;
|
10
|
+
props: {};
|
11
|
+
children: import("./nodes").Node<unknown>[];
|
12
|
+
isDeclaration: boolean;
|
13
|
+
};
|
14
|
+
render(element: ReactNode): void;
|
15
|
+
drawOnCanvas(canvas: SkCanvas): void;
|
16
|
+
unmount(): void;
|
17
|
+
}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.SkiaSGRoot = void 0;
|
7
|
+
var _reactReconciler = _interopRequireDefault(require("react-reconciler"));
|
8
|
+
var _types = require("../dom/types");
|
9
|
+
var _HostConfig = require("./HostConfig");
|
10
|
+
var _Container = require("./Container");
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
12
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
14
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
15
|
+
const skiaReconciler = (0, _reactReconciler.default)(_HostConfig.sksgHostConfig);
|
16
|
+
skiaReconciler.injectIntoDevTools({
|
17
|
+
bundleType: 1,
|
18
|
+
version: "0.0.1",
|
19
|
+
rendererPackageName: "react-native-skia"
|
20
|
+
});
|
21
|
+
class SkiaSGRoot {
|
22
|
+
constructor(Skia, nativeId = -1) {
|
23
|
+
_defineProperty(this, "root", void 0);
|
24
|
+
_defineProperty(this, "container", void 0);
|
25
|
+
this.container = new _Container.Container(Skia, nativeId);
|
26
|
+
this.root = skiaReconciler.createContainer(this.container, 0, null, true, null, "", console.error, null);
|
27
|
+
}
|
28
|
+
get sg() {
|
29
|
+
const children = this.container.root;
|
30
|
+
return {
|
31
|
+
type: _types.NodeType.Group,
|
32
|
+
props: {},
|
33
|
+
children,
|
34
|
+
isDeclaration: false
|
35
|
+
};
|
36
|
+
}
|
37
|
+
render(element) {
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
39
|
+
skiaReconciler.updateContainer(element, this.root, null, () => {
|
40
|
+
(0, _HostConfig.debug)("updateContainer");
|
41
|
+
});
|
42
|
+
}
|
43
|
+
drawOnCanvas(canvas) {
|
44
|
+
this.container.drawOnCanvas(canvas);
|
45
|
+
}
|
46
|
+
unmount() {
|
47
|
+
this.container.unmounted = true;
|
48
|
+
skiaReconciler.updateContainer(null, this.root, null, () => {
|
49
|
+
(0, _HostConfig.debug)("unmountContainer");
|
50
|
+
});
|
51
|
+
}
|
52
|
+
}
|
53
|
+
exports.SkiaSGRoot = SkiaSGRoot;
|
54
|
+
//# sourceMappingURL=Reconciler.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_reactReconciler","_interopRequireDefault","require","_types","_HostConfig","_Container","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","skiaReconciler","ReactReconciler","sksgHostConfig","injectIntoDevTools","bundleType","version","rendererPackageName","SkiaSGRoot","constructor","Skia","nativeId","container","Container","root","createContainer","console","error","sg","children","type","NodeType","Group","props","isDeclaration","render","element","updateContainer","debug","drawOnCanvas","canvas","unmount","unmounted","exports"],"sources":["Reconciler.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport type { OpaqueRoot } from \"react-reconciler\";\nimport ReactReconciler from \"react-reconciler\";\n\nimport type { SkCanvas, Skia } from \"../skia/types\";\nimport { NodeType } from \"../dom/types\";\n\nimport { debug, sksgHostConfig } from \"./HostConfig\";\nimport { Container } from \"./Container\";\n\nconst skiaReconciler = ReactReconciler(sksgHostConfig);\n\nskiaReconciler.injectIntoDevTools({\n bundleType: 1,\n version: \"0.0.1\",\n rendererPackageName: \"react-native-skia\",\n});\n\nexport class SkiaSGRoot {\n private root: OpaqueRoot;\n private container: Container;\n\n constructor(Skia: Skia, nativeId = -1) {\n this.container = new Container(Skia, nativeId);\n this.root = skiaReconciler.createContainer(\n this.container,\n 0,\n null,\n true,\n null,\n \"\",\n console.error,\n null\n );\n }\n\n get sg() {\n const children = this.container.root;\n return { type: NodeType.Group, props: {}, children, isDeclaration: false };\n }\n\n render(element: ReactNode) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n skiaReconciler.updateContainer(element as any, this.root, null, () => {\n debug(\"updateContainer\");\n });\n }\n\n drawOnCanvas(canvas: SkCanvas) {\n this.container.drawOnCanvas(canvas);\n }\n\n unmount() {\n this.container.unmounted = true;\n skiaReconciler.updateContainer(null, this.root, null, () => {\n debug(\"unmountContainer\");\n });\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAAwC,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,C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AAMA,CAACC,OAAkB,EAAE;IACzB;IACAzB,cAAc,CAAC0B,eAAe,CAACD,OAAO,EAAS,IAAI,CAACZ,IAAI,EAAE,IAAI,EAAE,MAAM;MACpE,IAAAc,iBAAK,EAAC,iBAAiB,CAAC;IAC1B,CAAC,CAAC;EACJ;EAEAC,YAAYA,CAACC,MAAgB,EAAE;IAC7B,IAAI,CAAClB,SAAS,CAACiB,YAAY,CAACC,MAAM,CAAC;EACrC;EAEAC,OAAOA,CAAA,EAAG;IACR,IAAI,CAACnB,SAAS,CAACoB,SAAS,GAAG,IAAI;IAC/B/B,cAAc,CAAC0B,eAAe,CAAC,IAAI,EAAE,IAAI,CAACb,IAAI,EAAE,IAAI,EAAE,MAAM;MAC1D,IAAAc,iBAAK,EAAC,kBAAkB,CAAC;IAC3B,CAAC,CAAC;EACJ;AACF;AAACK,OAAA,CAAAzB,UAAA,GAAAA,UAAA","ignoreList":[]}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
export declare enum DeclarationType {
|
2
|
+
ColorFilter = 0,
|
3
|
+
ImageFilter = 1,
|
4
|
+
Shader = 2,
|
5
|
+
MaskFilter = 3,
|
6
|
+
PathEffect = 4,
|
7
|
+
Paint = 5
|
8
|
+
}
|
9
|
+
interface Filter {
|
10
|
+
tag: string;
|
11
|
+
}
|
12
|
+
export interface SkColorFilter extends Filter {
|
13
|
+
type: DeclarationType.ColorFilter;
|
14
|
+
}
|
15
|
+
interface SkImageFilter extends Filter {
|
16
|
+
type: DeclarationType.ImageFilter;
|
17
|
+
}
|
18
|
+
interface SkShader extends Filter {
|
19
|
+
type: DeclarationType.Shader;
|
20
|
+
}
|
21
|
+
interface SkMaskFilter extends Filter {
|
22
|
+
type: DeclarationType.MaskFilter;
|
23
|
+
}
|
24
|
+
interface SkPathEffect extends Filter {
|
25
|
+
type: DeclarationType.PathEffect;
|
26
|
+
}
|
27
|
+
interface SkPaint extends Filter {
|
28
|
+
type: DeclarationType.Paint;
|
29
|
+
}
|
30
|
+
type Composer<T> = (outer: T, inner: T) => T;
|
31
|
+
export declare const compose: any;
|
32
|
+
export declare const composeDeclarations: <T>(filters: T[], composer: Composer<T>) => T;
|
33
|
+
declare class Declaration<T extends Filter> {
|
34
|
+
decls: T[];
|
35
|
+
indexes: number[];
|
36
|
+
composer?: Composer<T>;
|
37
|
+
constructor(composer?: Composer<T>);
|
38
|
+
private get index();
|
39
|
+
save(): void;
|
40
|
+
restore(): void;
|
41
|
+
pop(): T | undefined;
|
42
|
+
push(decl: T): void;
|
43
|
+
popAll(): T[];
|
44
|
+
popAllAsOne(): T | undefined;
|
45
|
+
}
|
46
|
+
export declare class DeclarationContext {
|
47
|
+
readonly paints: Declaration<SkPaint>;
|
48
|
+
readonly maskFilters: Declaration<SkMaskFilter>;
|
49
|
+
readonly shaders: Declaration<SkShader>;
|
50
|
+
readonly pathEffects: Declaration<SkPathEffect>;
|
51
|
+
readonly imageFilters: Declaration<SkImageFilter>;
|
52
|
+
readonly colorFilters: Declaration<SkColorFilter>;
|
53
|
+
constructor();
|
54
|
+
save(): void;
|
55
|
+
restore(): void;
|
56
|
+
}
|
57
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sources":["Node.ts"],"sourcesContent":["import type { NodeType } from \"../../dom/types\";\n\nexport interface Node<Props = unknown> {\n type: NodeType;\n isDeclaration: boolean;\n props: Props;\n children: Node[];\n}\n"],"mappings":"","ignoreList":[]}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import type { BlendColorFilterProps, DeclarationContext, LerpColorFilterProps, MatrixColorFilterProps } from "../../dom/types";
|
2
|
+
export declare const makeBlendColorFilter: (ctx: DeclarationContext, props: BlendColorFilterProps) => import("../../skia/types").SkColorFilter;
|
3
|
+
export declare const makeSRGBToLinearGammaColorFilter: (ctx: DeclarationContext) => import("../../skia/types").SkColorFilter;
|
4
|
+
export declare const makeLinearToSRGBGammaColorFilter: (ctx: DeclarationContext) => import("../../skia/types").SkColorFilter;
|
5
|
+
export declare const declareLerpColorFilter: (ctx: DeclarationContext, props: LerpColorFilterProps) => void;
|
6
|
+
export declare const makeMatrixColorFilter: (ctx: DeclarationContext, props: MatrixColorFilterProps) => import("../../skia/types").SkColorFilter;
|
7
|
+
export declare const makeLumaColorFilter: (ctx: DeclarationContext) => import("../../skia/types").SkColorFilter;
|
@@ -0,0 +1,55 @@
|
|
1
|
+
"use strict";
|
2
|
+
"worklet";
|
3
|
+
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports.makeSRGBToLinearGammaColorFilter = exports.makeMatrixColorFilter = exports.makeLumaColorFilter = exports.makeLinearToSRGBGammaColorFilter = exports.makeBlendColorFilter = exports.declareLerpColorFilter = void 0;
|
8
|
+
var _nodes = require("../../dom/nodes");
|
9
|
+
var _types = require("../../skia/types");
|
10
|
+
const makeBlendColorFilter = (ctx, props) => {
|
11
|
+
const {
|
12
|
+
mode
|
13
|
+
} = props;
|
14
|
+
const color = ctx.Skia.Color(props.color);
|
15
|
+
const cf = ctx.Skia.ColorFilter.MakeBlend(color, _types.BlendMode[(0, _nodes.enumKey)(mode)]);
|
16
|
+
return cf;
|
17
|
+
};
|
18
|
+
exports.makeBlendColorFilter = makeBlendColorFilter;
|
19
|
+
const makeSRGBToLinearGammaColorFilter = ctx => {
|
20
|
+
const cf = ctx.Skia.ColorFilter.MakeSRGBToLinearGamma();
|
21
|
+
return cf;
|
22
|
+
};
|
23
|
+
exports.makeSRGBToLinearGammaColorFilter = makeSRGBToLinearGammaColorFilter;
|
24
|
+
const makeLinearToSRGBGammaColorFilter = ctx => {
|
25
|
+
const cf = ctx.Skia.ColorFilter.MakeLinearToSRGBGamma();
|
26
|
+
return cf;
|
27
|
+
};
|
28
|
+
exports.makeLinearToSRGBGammaColorFilter = makeLinearToSRGBGammaColorFilter;
|
29
|
+
const declareLerpColorFilter = (ctx, props) => {
|
30
|
+
const {
|
31
|
+
t
|
32
|
+
} = props;
|
33
|
+
const second = ctx.colorFilters.pop();
|
34
|
+
const first = ctx.colorFilters.pop();
|
35
|
+
if (!first || !second) {
|
36
|
+
throw new Error("LerpColorFilterNode: missing two color filters as children");
|
37
|
+
}
|
38
|
+
const cf = ctx.Skia.ColorFilter.MakeLerp(t, first, second);
|
39
|
+
ctx.colorFilters.push(cf);
|
40
|
+
};
|
41
|
+
exports.declareLerpColorFilter = declareLerpColorFilter;
|
42
|
+
const makeMatrixColorFilter = (ctx, props) => {
|
43
|
+
const {
|
44
|
+
matrix
|
45
|
+
} = props;
|
46
|
+
const cf = ctx.Skia.ColorFilter.MakeMatrix(matrix);
|
47
|
+
return cf;
|
48
|
+
};
|
49
|
+
exports.makeMatrixColorFilter = makeMatrixColorFilter;
|
50
|
+
const makeLumaColorFilter = ctx => {
|
51
|
+
const cf = ctx.Skia.ColorFilter.MakeLumaColorFilter();
|
52
|
+
return cf;
|
53
|
+
};
|
54
|
+
exports.makeLumaColorFilter = makeLumaColorFilter;
|
55
|
+
//# sourceMappingURL=colorFilters.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["Object","defineProperty","exports","value","makeSRGBToLinearGammaColorFilter","makeMatrixColorFilter","makeLumaColorFilter","makeLinearToSRGBGammaColorFilter","makeBlendColorFilter","declareLerpColorFilter","_nodes","require","_types","ctx","props","mode","color","Skia","Color","cf","ColorFilter","MakeBlend","BlendMode","enumKey","MakeSRGBToLinearGamma","MakeLinearToSRGBGamma","t","second","colorFilters","pop","first","Error","MakeLerp","push","matrix","MakeMatrix","MakeLumaColorFilter"],"sources":["colorFilters.ts"],"sourcesContent":["\"worklet\";\n\nimport { enumKey } from \"../../dom/nodes\";\nimport type {\n BlendColorFilterProps,\n DeclarationContext,\n LerpColorFilterProps,\n MatrixColorFilterProps,\n} from \"../../dom/types\";\nimport { BlendMode } from \"../../skia/types\";\n\nexport const makeBlendColorFilter = (\n ctx: DeclarationContext,\n props: BlendColorFilterProps\n) => {\n const { mode } = props;\n const color = ctx.Skia.Color(props.color);\n const cf = ctx.Skia.ColorFilter.MakeBlend(color, BlendMode[enumKey(mode)]);\n return cf;\n};\n\nexport const makeSRGBToLinearGammaColorFilter = (ctx: DeclarationContext) => {\n const cf = ctx.Skia.ColorFilter.MakeSRGBToLinearGamma();\n return cf;\n};\n\nexport const makeLinearToSRGBGammaColorFilter = (ctx: DeclarationContext) => {\n const cf = ctx.Skia.ColorFilter.MakeLinearToSRGBGamma();\n return cf;\n};\n\nexport const declareLerpColorFilter = (\n ctx: DeclarationContext,\n props: LerpColorFilterProps\n) => {\n const { t } = props;\n const second = ctx.colorFilters.pop();\n const first = ctx.colorFilters.pop();\n if (!first || !second) {\n throw new Error(\n \"LerpColorFilterNode: missing two color filters as children\"\n );\n }\n const cf = ctx.Skia.ColorFilter.MakeLerp(t, first, second);\n ctx.colorFilters.push(cf);\n};\n\nexport const makeMatrixColorFilter = (\n ctx: DeclarationContext,\n props: MatrixColorFilterProps\n) => {\n const { matrix } = props;\n const cf = ctx.Skia.ColorFilter.MakeMatrix(matrix);\n return cf;\n};\n\nexport const makeLumaColorFilter = (ctx: DeclarationContext) => {\n const cf = ctx.Skia.ColorFilter.MakeLumaColorFilter();\n return cf;\n};\n"],"mappings":";AAAA,SAAS;;AAACA,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,KAAA;AAAA;AAAAD,OAAA,CAAAE,gCAAA,GAAAF,OAAA,CAAAG,qBAAA,GAAAH,OAAA,CAAAI,mBAAA,GAAAJ,OAAA,CAAAK,gCAAA,GAAAL,OAAA,CAAAM,oBAAA,GAAAN,OAAA,CAAAO,sBAAA;AAEV,IAAAC,MAAA,GAAAC,OAAA;AAOA,IAAAC,MAAA,GAAAD,OAAA;AAEO,MAAMH,oBAAoB,GAAGA,CAClCK,GAAuB,EACvBC,KAA4B,KACzB;EACH,MAAM;IAAEC;EAAK,CAAC,GAAGD,KAAK;EACtB,MAAME,KAAK,GAAGH,GAAG,CAACI,IAAI,CAACC,KAAK,CAACJ,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