@react-native-ohos/react-native-reanimated 3.18.2-rc.2 → 4.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compatibility.json +161 -0
- package/harmony/reanimated/BuildProfile.ets +16 -16
- package/harmony/reanimated/build-profile.json5 +18 -11
- package/harmony/reanimated/oh-package.json5 +12 -11
- package/harmony/reanimated/src/main/cpp/CMakeLists.txt +31 -40
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.cpp +81 -86
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.h +46 -47
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/InterpolatorRegistry.cpp +390 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/InterpolatorRegistry.h +16 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/definitions.h +30 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/filters/FilterOp.cpp +46 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/filters/FilterOp.h +23 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/Quaternion.cpp +53 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/Quaternion.h +21 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix.cpp +166 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix.h +71 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix2D.cpp +368 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix2D.h +53 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix3D.cpp +594 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix3D.h +67 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformOp.cpp +52 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformOp.h +26 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/vectors.cpp +156 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/vectors.h +76 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSAngle.cpp +93 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSAngle.h +33 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSBoolean.cpp +48 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSBoolean.h +31 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSColor.cpp +135 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSColor.h +61 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSDiscreteArray.cpp +100 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSDiscreteArray.h +44 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSKeyword.cpp +81 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSKeyword.h +53 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSLength.cpp +122 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSLength.h +38 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSNumber.cpp +82 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSNumber.h +63 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValue.h +118 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValueVariant.cpp +174 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValueVariant.h +111 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSBoxShadow.cpp +196 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSBoxShadow.h +66 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSDropShadow.cpp +134 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSDropShadow.h +44 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSAnimationConfig.cpp +174 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSAnimationConfig.h +49 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSKeyframesConfig.cpp +45 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSKeyframesConfig.h +26 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSTransitionConfig.cpp +90 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSTransitionConfig.h +43 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/common.cpp +17 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/common.h +13 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimation.cpp +127 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimation.h +51 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSTransition.cpp +145 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSTransition.h +47 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/EasingFunctions.cpp +69 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/EasingFunctions.h +22 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/cubicBezier.cpp +66 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/cubicBezier.h +15 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/linear.cpp +28 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/linear.h +15 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/steps.cpp +13 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/steps.h +12 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/InterpolatorFactory.cpp +157 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/InterpolatorFactory.h +189 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/PropertyInterpolator.cpp +76 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/PropertyInterpolator.h +66 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/configs.h +20 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperation.cpp +136 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperation.h +40 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperationInterpolator.cpp +38 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperationInterpolator.h +24 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterStyleInterpolator.cpp +58 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterStyleInterpolator.h +24 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/blur.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/brightness.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/contrast.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/dropShadow.h +17 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/grayscale.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/hueRotate.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/invert.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/opacity.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/saturate.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/sepia.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/ArrayPropertiesInterpolator.cpp +95 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/ArrayPropertiesInterpolator.h +36 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/GroupPropertiesInterpolator.cpp +41 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/GroupPropertiesInterpolator.h +32 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/RecordPropertiesInterpolator.cpp +99 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/RecordPropertiesInterpolator.h +37 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/OperationsStyleInterpolator.cpp +308 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/OperationsStyleInterpolator.h +100 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperation.cpp +19 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperation.h +94 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperationInterpolator.cpp +18 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperationInterpolator.h +43 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolator.h +26 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/TransitionStyleInterpolator.cpp +103 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/TransitionStyleInterpolator.h +42 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperation.cpp +224 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperation.h +52 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.cpp +218 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.h +89 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformsStyleInterpolator.cpp +149 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformsStyleInterpolator.h +33 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/matrix.cpp +208 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/matrix.h +56 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/perspective.cpp +42 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/perspective.h +20 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/rotate.cpp +41 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/rotate.h +39 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/scale.cpp +28 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/scale.h +25 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/skew.cpp +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/skew.h +20 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/translate.cpp +39 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/translate.h +25 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ResolvableValueInterpolator.cpp +47 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ResolvableValueInterpolator.h +43 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/SimpleValueInterpolator.cpp +70 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/SimpleValueInterpolator.h +40 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ValueInterpolator.cpp +146 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ValueInterpolator.h +71 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/misc/ViewStylesRepository.cpp +155 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/misc/ViewStylesRepository.h +53 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/AnimationProgressProvider.cpp +170 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/AnimationProgressProvider.h +67 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/KeyframeProgressProvider.h +12 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/RawProgressProvider.cpp +41 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/RawProgressProvider.h +31 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/TransitionProgressProvider.cpp +193 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/TransitionProgressProvider.h +77 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.cpp +340 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.h +80 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSKeyframesRegistry.cpp +45 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSKeyframesRegistry.h +29 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.cpp +167 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.h +51 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/StaticPropsRegistry.cpp +61 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/StaticPropsRegistry.h +33 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGBrush.cpp +80 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGBrush.h +39 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGLength.cpp +93 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGLength.h +36 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStrokeDashArray.cpp +110 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStrokeDashArray.h +33 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.cpp +75 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.h +45 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/algorithms.cpp +12 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/algorithms.h +10 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/interpolators.cpp +36 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/interpolators.h +23 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/props.cpp +149 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/props.h +32 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.cpp +113 -101
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.h +49 -51
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitShadowNode.h +46 -49
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp +56 -96
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.h +37 -33
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.cpp +104 -95
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.h +22 -29
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.cpp +72 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.h +25 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.cpp +160 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.h +71 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.cpp +161 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.h +65 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationType.h +11 -9
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.cpp +137 -232
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.h +82 -90
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.cpp +79 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h +81 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpp +864 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.h +214 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/{LayoutAnimationsProxy.cpp → LayoutAnimationsProxy_Legacy.cpp} +897 -870
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.h +220 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.cpp +31 -91
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.h +146 -176
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/PropsDiffer.cpp +456 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/PropsDiffer.h +102 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/SharedTransitions.cpp +544 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/PropValueProcessor.cpp +119 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/PropValueProcessor.h +39 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +1376 -971
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +228 -252
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.cpp +183 -231
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.h +93 -109
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp +54 -56
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.h +28 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp +58 -70
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.h +31 -35
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeatureFlags.cpp +18 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeatureFlags.h +44 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/PlatformDepMethodsHolder.h +67 -98
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedSystraceSection.h +114 -135
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedVersion.cpp +46 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/{worklets → reanimated}/Tools/ReanimatedVersion.h +18 -19
- package/harmony/reanimated/src/main/cpp/ReanimatedModule.cpp +60 -85
- package/harmony/reanimated/src/main/cpp/ReanimatedNodesManager.cpp +1 -0
- package/harmony/reanimated/src/main/cpp/ReanimatedPackage.cpp +0 -3
- package/harmony/reanimated/src/main/cpp/ReanimatedSensor.cpp +266 -0
- package/harmony/reanimated/src/main/cpp/ReanimatedSensor.h +36 -0
- package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.cpp +36 -0
- package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.h +23 -0
- package/harmony/reanimated/src/main/cpp/ReanimatedUIScheduler.h +3 -3
- package/harmony/reanimated/src/main/ets/ReanimatedModule.ts +5 -1
- package/harmony/reanimated/src/main/ets/ReanimatedPackage.ts +1 -4
- package/harmony/reanimated/src/main/module.json5 +12 -12
- package/harmony/reanimated/src/main/resources/base/element/color.json +7 -7
- package/harmony/reanimated/src/main/resources/base/element/string.json +15 -15
- package/harmony/reanimated/src/main/resources/base/profile/main_pages.json +5 -5
- package/harmony/reanimated/src/main/resources/en_US/element/string.json +15 -15
- package/harmony/reanimated/src/main/resources/zh_CN/element/string.json +15 -15
- package/harmony/reanimated/ts.ts +6 -6
- package/harmony/reanimated.har +0 -0
- package/package.json +68 -50
- package/scripts/deploy.js +191 -0
- package/scripts/set-reanimated-version.js +37 -0
- package/scripts/update-version.js +119 -0
- package/scripts/validate-react-native-version.js +46 -0
- package/scripts/validate-worklets-build.js +17 -0
- package/scripts/validate-worklets-version.js +79 -0
- package/scripts/worklets-version.json +4 -0
- package/LICENSE +0 -21
- package/README.OpenSource +0 -11
- package/README.md +0 -10
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/PropsRegistry.cpp +0 -68
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/PropsRegistry.h +0 -68
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy.h +0 -147
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/CollectionUtils.h +0 -14
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeaturesConfig.cpp +0 -5
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeaturesConfig.h +0 -19
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.cpp +0 -47
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.h +0 -59
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.cpp +0 -27
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.h +0 -25
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/EventHandlerRegistry.cpp +0 -94
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/EventHandlerRegistry.h +0 -49
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.cpp +0 -8
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.h +0 -39
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/SharedItems/Shareables.cpp +0 -326
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/SharedItems/Shareables.h +0 -345
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/AsyncQueue.cpp +0 -52
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/AsyncQueue.h +0 -35
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/Defs.h +0 -10
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSISerializer.cpp +0 -342
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSISerializer.h +0 -47
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSLogger.cpp +0 -16
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSLogger.h +0 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSScheduler.cpp +0 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSScheduler.h +0 -29
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/PlatformLogger.h +0 -16
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedJSIUtils.cpp +0 -26
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedJSIUtils.h +0 -199
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedVersion.cpp +0 -95
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/SingleInstanceChecker.h +0 -72
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ThreadSafeQueue.h +0 -49
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/UIScheduler.cpp +0 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/UIScheduler.h +0 -22
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/WorkletEventHandler.cpp +0 -29
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/WorkletEventHandler.h +0 -41
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp +0 -16
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.h +0 -19
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.cpp +0 -112
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.h +0 -127
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.cpp +0 -53
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.h +0 -22
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RuntimeInitialization.md +0 -191
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.cpp +0 -173
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.h +0 -90
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeCollector.h +0 -36
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp +0 -189
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.h +0 -22
- package/harmony/reanimated/src/main/cpp/ReanimatedLogger.cpp +0 -33
- package/harmony/reanimated/src/main/cpp/WorkletsModule.cpp +0 -61
- package/harmony/reanimated/src/main/cpp/WorkletsModule.h +0 -22
- package/harmony/reanimated/src/main/cpp/patches/AnimatedSensor/AnimatedSensorModule.cpp +0 -89
- package/harmony/reanimated/src/main/cpp/patches/Fabric/ShadowTreeCloner.cpp +0 -95
- package/harmony/reanimated/src/main/cpp/patches/NativeModules/ReanimatedModuleProxy.cpp +0 -964
- package/harmony/reanimated/src/main/ets/WorkletsModule.ts +0 -15
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
#include <reanimated/CSS/interpolation/InterpolatorFactory.h>
|
|
2
|
+
#include <reanimated/CSS/interpolation/filters/FilterStyleInterpolator.h>
|
|
3
|
+
|
|
4
|
+
#include <memory>
|
|
5
|
+
#include <string>
|
|
6
|
+
#include <unordered_map>
|
|
7
|
+
|
|
8
|
+
namespace reanimated::css {
|
|
9
|
+
|
|
10
|
+
class RecordInterpolatorFactory : public PropertyInterpolatorFactory {
|
|
11
|
+
public:
|
|
12
|
+
explicit RecordInterpolatorFactory(const InterpolatorFactoriesRecord &factories)
|
|
13
|
+
: PropertyInterpolatorFactory(), factories_(factories) {}
|
|
14
|
+
|
|
15
|
+
const CSSValue &getDefaultValue() const override {
|
|
16
|
+
static EmptyObjectValue emptyObjectValue;
|
|
17
|
+
return emptyObjectValue;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
std::shared_ptr<PropertyInterpolator> create(
|
|
21
|
+
const PropertyPath &propertyPath,
|
|
22
|
+
const std::shared_ptr<ViewStylesRepository> &viewStylesRepository) const override {
|
|
23
|
+
return std::make_shared<RecordPropertiesInterpolator>(factories_, propertyPath, viewStylesRepository);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
private:
|
|
27
|
+
// Helper private type just for a default value
|
|
28
|
+
struct EmptyObjectValue : public CSSValue {
|
|
29
|
+
folly::dynamic toDynamic() const override {
|
|
30
|
+
return folly::dynamic::object;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
std::string toString() const override {
|
|
34
|
+
return "{}";
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const InterpolatorFactoriesRecord factories_;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
class ArrayLikeInterpolatorFactory : public PropertyInterpolatorFactory {
|
|
42
|
+
public:
|
|
43
|
+
const CSSValue &getDefaultValue() const override {
|
|
44
|
+
static EmptyArrayValue emptyArrayValue;
|
|
45
|
+
return emptyArrayValue;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
private:
|
|
49
|
+
// Helper private type just for a default value
|
|
50
|
+
struct EmptyArrayValue : public CSSValue {
|
|
51
|
+
folly::dynamic toDynamic() const override {
|
|
52
|
+
return folly::dynamic::array;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
std::string toString() const override {
|
|
56
|
+
return "[]";
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
class ArrayInterpolatorFactory : public ArrayLikeInterpolatorFactory {
|
|
62
|
+
public:
|
|
63
|
+
explicit ArrayInterpolatorFactory(const InterpolatorFactoriesArray &factories)
|
|
64
|
+
: ArrayLikeInterpolatorFactory(), factories_(factories) {}
|
|
65
|
+
|
|
66
|
+
std::shared_ptr<PropertyInterpolator> create(
|
|
67
|
+
const PropertyPath &propertyPath,
|
|
68
|
+
const std::shared_ptr<ViewStylesRepository> &viewStylesRepository) const override {
|
|
69
|
+
return std::make_shared<ArrayPropertiesInterpolator>(factories_, propertyPath, viewStylesRepository);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private:
|
|
73
|
+
const InterpolatorFactoriesArray factories_;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
class FiltersInterpolatorFactory : public ArrayLikeInterpolatorFactory {
|
|
77
|
+
public:
|
|
78
|
+
explicit FiltersInterpolatorFactory(const std::shared_ptr<StyleOperationInterpolators> &interpolators)
|
|
79
|
+
: ArrayLikeInterpolatorFactory(), interpolators_(interpolators) {}
|
|
80
|
+
|
|
81
|
+
std::shared_ptr<PropertyInterpolator> create(
|
|
82
|
+
const PropertyPath &propertyPath,
|
|
83
|
+
const std::shared_ptr<ViewStylesRepository> &viewStylesRepository) const override {
|
|
84
|
+
return std::make_shared<FilterStyleInterpolator>(propertyPath, interpolators_, viewStylesRepository);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
private:
|
|
88
|
+
const std::shared_ptr<StyleOperationInterpolators> interpolators_;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
class TransformsInterpolatorFactory : public PropertyInterpolatorFactory {
|
|
92
|
+
public:
|
|
93
|
+
explicit TransformsInterpolatorFactory(const std::shared_ptr<StyleOperationInterpolators> &interpolators)
|
|
94
|
+
: PropertyInterpolatorFactory(), interpolators_(interpolators) {}
|
|
95
|
+
|
|
96
|
+
const CSSValue &getDefaultValue() const override {
|
|
97
|
+
static EmptyTransformsValue emptyTransformsValue;
|
|
98
|
+
return emptyTransformsValue;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
std::shared_ptr<PropertyInterpolator> create(
|
|
102
|
+
const PropertyPath &propertyPath,
|
|
103
|
+
const std::shared_ptr<ViewStylesRepository> &viewStylesRepository) const override {
|
|
104
|
+
return std::make_shared<TransformsStyleInterpolator>(propertyPath, interpolators_, viewStylesRepository);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
private:
|
|
108
|
+
static TransformMatrix2D &getIdentityMatrix() {
|
|
109
|
+
static TransformMatrix2D identityMatrix = TransformMatrix2D();
|
|
110
|
+
return identityMatrix;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Helper private type just for a default value
|
|
114
|
+
struct EmptyTransformsValue : public CSSValue {
|
|
115
|
+
folly::dynamic toDynamic() const override {
|
|
116
|
+
return getIdentityMatrix().toDynamic();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
std::string toString() const override {
|
|
120
|
+
return getIdentityMatrix().toString();
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const std::shared_ptr<StyleOperationInterpolators> interpolators_;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// Non-template function implementations
|
|
128
|
+
std::shared_ptr<PropertyInterpolatorFactory> record(const InterpolatorFactoriesRecord &factories) {
|
|
129
|
+
return std::make_shared<RecordInterpolatorFactory>(factories);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
std::shared_ptr<PropertyInterpolatorFactory> array(const InterpolatorFactoriesArray &factories) {
|
|
133
|
+
return std::make_shared<ArrayInterpolatorFactory>(factories);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
std::shared_ptr<PropertyInterpolatorFactory> transforms(
|
|
137
|
+
const std::unordered_map<std::string, std::shared_ptr<StyleOperationInterpolator>> &interpolators) {
|
|
138
|
+
StyleOperationInterpolators result;
|
|
139
|
+
result.reserve(interpolators.size());
|
|
140
|
+
for (const auto &[property, interpolator] : interpolators) {
|
|
141
|
+
result.emplace(static_cast<size_t>(getTransformOperationType(property)), interpolator);
|
|
142
|
+
}
|
|
143
|
+
return std::make_shared<TransformsInterpolatorFactory>(
|
|
144
|
+
std::make_shared<StyleOperationInterpolators>(std::move(result)));
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
std::shared_ptr<PropertyInterpolatorFactory> filters(
|
|
148
|
+
const std::unordered_map<std::string, std::shared_ptr<StyleOperationInterpolator>> &interpolators) {
|
|
149
|
+
StyleOperationInterpolators result;
|
|
150
|
+
result.reserve(interpolators.size());
|
|
151
|
+
for (const auto &[property, interpolator] : interpolators) {
|
|
152
|
+
result.emplace(static_cast<size_t>(getFilterOperationType(property)), interpolator);
|
|
153
|
+
}
|
|
154
|
+
return std::make_shared<FiltersInterpolatorFactory>(std::make_shared<StyleOperationInterpolators>(std::move(result)));
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
} // namespace reanimated::css
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <reanimated/CSS/interpolation/PropertyInterpolator.h>
|
|
4
|
+
#include <reanimated/CSS/interpolation/configs.h>
|
|
5
|
+
#include <reanimated/CSS/interpolation/filters/FilterOperation.h>
|
|
6
|
+
#include <reanimated/CSS/interpolation/filters/FilterOperationInterpolator.h>
|
|
7
|
+
#include <reanimated/CSS/interpolation/groups/ArrayPropertiesInterpolator.h>
|
|
8
|
+
#include <reanimated/CSS/interpolation/groups/RecordPropertiesInterpolator.h>
|
|
9
|
+
#include <reanimated/CSS/interpolation/operations/StyleOperationInterpolator.h>
|
|
10
|
+
#include <reanimated/CSS/interpolation/transforms/TransformOperation.h>
|
|
11
|
+
#include <reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.h>
|
|
12
|
+
#include <reanimated/CSS/interpolation/transforms/TransformsStyleInterpolator.h>
|
|
13
|
+
#include <reanimated/CSS/interpolation/values/ResolvableValueInterpolator.h>
|
|
14
|
+
#include <reanimated/CSS/interpolation/values/SimpleValueInterpolator.h>
|
|
15
|
+
|
|
16
|
+
#include <memory>
|
|
17
|
+
#include <string>
|
|
18
|
+
#include <unordered_map>
|
|
19
|
+
#include <utility>
|
|
20
|
+
|
|
21
|
+
namespace reanimated::css {
|
|
22
|
+
|
|
23
|
+
// Template class implementations
|
|
24
|
+
template <typename... AllowedTypes>
|
|
25
|
+
class SimpleValueInterpolatorFactory : public PropertyInterpolatorFactory {
|
|
26
|
+
public:
|
|
27
|
+
template <typename TValue>
|
|
28
|
+
explicit SimpleValueInterpolatorFactory(const TValue &defaultValue)
|
|
29
|
+
: PropertyInterpolatorFactory(), defaultValue_(defaultValue) {}
|
|
30
|
+
|
|
31
|
+
bool isDiscreteProperty() const override {
|
|
32
|
+
// The property is considered discrete if all of the allowed types are
|
|
33
|
+
// discrete
|
|
34
|
+
return (Discrete<AllowedTypes> && ...);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const CSSValue &getDefaultValue() const override {
|
|
38
|
+
return defaultValue_;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
std::shared_ptr<PropertyInterpolator> create(
|
|
42
|
+
const PropertyPath &propertyPath,
|
|
43
|
+
const std::shared_ptr<ViewStylesRepository> &viewStylesRepository) const override {
|
|
44
|
+
return std::make_shared<SimpleValueInterpolator<AllowedTypes...>>(
|
|
45
|
+
propertyPath, defaultValue_, viewStylesRepository);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
private:
|
|
49
|
+
const CSSValueVariant<AllowedTypes...> defaultValue_;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
template <typename... AllowedTypes>
|
|
53
|
+
class ResolvableValueInterpolatorFactory : public PropertyInterpolatorFactory {
|
|
54
|
+
public:
|
|
55
|
+
template <typename TValue>
|
|
56
|
+
explicit ResolvableValueInterpolatorFactory(const TValue &defaultValue, ResolvableValueInterpolatorConfig config)
|
|
57
|
+
: PropertyInterpolatorFactory(), defaultValue_(defaultValue), config_(std::move(config)) {}
|
|
58
|
+
|
|
59
|
+
const CSSValue &getDefaultValue() const override {
|
|
60
|
+
return defaultValue_;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
std::shared_ptr<PropertyInterpolator> create(
|
|
64
|
+
const PropertyPath &propertyPath,
|
|
65
|
+
const std::shared_ptr<ViewStylesRepository> &viewStylesRepository) const override {
|
|
66
|
+
return std::make_shared<ResolvableValueInterpolator<AllowedTypes...>>(
|
|
67
|
+
propertyPath, defaultValue_, viewStylesRepository, config_);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
private:
|
|
71
|
+
const CSSValueVariant<AllowedTypes...> defaultValue_;
|
|
72
|
+
ResolvableValueInterpolatorConfig config_;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Helper function to create a concrete CSSValue from defaultValue
|
|
77
|
+
*/
|
|
78
|
+
template <typename... AllowedTypes>
|
|
79
|
+
CSSValueVariant<AllowedTypes...> createCSSValue(const auto &defaultValue) {
|
|
80
|
+
using ValueType = decltype(defaultValue);
|
|
81
|
+
CSSValueVariant<AllowedTypes...> result;
|
|
82
|
+
|
|
83
|
+
auto tryOne = [&]<typename TCSSValue>() -> bool {
|
|
84
|
+
if constexpr (std::is_constructible_v<TCSSValue, ValueType>) {
|
|
85
|
+
if constexpr (ValueConstructibleCSSValue<TCSSValue, ValueType>) {
|
|
86
|
+
// For construction from a non-jsi::Value, we perform a runtime
|
|
87
|
+
// canConstruct check only if the type has a canConstruct method.
|
|
88
|
+
// (this is needed e.g. when different CSS value types can be
|
|
89
|
+
// constructed from the same value type, like CSSLength and CSSKeyword)
|
|
90
|
+
if (!TCSSValue::canConstruct(defaultValue)) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
result = CSSValueVariant<AllowedTypes...>(std::variant<AllowedTypes...>(TCSSValue(defaultValue)));
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
return false;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// Try constructing with each allowed type until one succeeds
|
|
101
|
+
if (!(tryOne.template operator()<AllowedTypes>() || ...)) {
|
|
102
|
+
throw std::runtime_error("[Reanimated] No compatible type found for construction from defaultValue");
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Value interpolator factories
|
|
110
|
+
*/
|
|
111
|
+
template <typename... AllowedTypes>
|
|
112
|
+
auto value(const auto &defaultValue) -> std::enable_if_t<
|
|
113
|
+
(std::is_constructible_v<AllowedTypes, decltype(defaultValue)> || ...),
|
|
114
|
+
std::shared_ptr<PropertyInterpolatorFactory>> {
|
|
115
|
+
// Create a concrete CSSValue from the defaultValue
|
|
116
|
+
auto cssValue = createCSSValue<AllowedTypes...>(defaultValue);
|
|
117
|
+
return std::make_shared<SimpleValueInterpolatorFactory<AllowedTypes...>>(std::move(cssValue));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
template <typename... AllowedTypes>
|
|
121
|
+
auto value(const auto &defaultValue, ResolvableValueInterpolatorConfig config) -> std::enable_if_t<
|
|
122
|
+
(std::is_constructible_v<AllowedTypes, decltype(defaultValue)> || ...),
|
|
123
|
+
std::shared_ptr<PropertyInterpolatorFactory>> {
|
|
124
|
+
// Create a concrete CSSValue from the defaultValue
|
|
125
|
+
auto cssValue = createCSSValue<AllowedTypes...>(defaultValue);
|
|
126
|
+
return std::make_shared<ResolvableValueInterpolatorFactory<AllowedTypes...>>(std::move(cssValue), std::move(config));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Transform operation interpolator factories
|
|
131
|
+
*/
|
|
132
|
+
template <typename TOperation>
|
|
133
|
+
auto transformOp(const auto &defaultValue) -> std::enable_if_t<
|
|
134
|
+
std::is_base_of_v<TransformOperation, TOperation> && std::is_constructible_v<TOperation, decltype(defaultValue)>,
|
|
135
|
+
std::shared_ptr<StyleOperationInterpolator>> {
|
|
136
|
+
return std::make_shared<TransformOperationInterpolator<TOperation>>(std::make_shared<TOperation>(defaultValue));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
template <typename TOperation>
|
|
140
|
+
auto transformOp(const auto &defaultValue, ResolvableValueInterpolatorConfig config) -> std::enable_if_t<
|
|
141
|
+
std::is_base_of_v<TransformOperation, TOperation> && std::is_constructible_v<TOperation, decltype(defaultValue)> &&
|
|
142
|
+
ResolvableOp<TOperation>,
|
|
143
|
+
std::shared_ptr<StyleOperationInterpolator>> {
|
|
144
|
+
return std::make_shared<TransformOperationInterpolator<TOperation>>(
|
|
145
|
+
std::make_shared<TOperation>(defaultValue), std::move(config));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Filter operation interpolator factories
|
|
150
|
+
*/
|
|
151
|
+
template <typename TOperation>
|
|
152
|
+
auto filterOp(const auto &defaultValue) -> std::enable_if_t<
|
|
153
|
+
std::is_base_of_v<FilterOperation, TOperation> && std::is_constructible_v<TOperation, decltype(defaultValue)>,
|
|
154
|
+
std::shared_ptr<StyleOperationInterpolator>> {
|
|
155
|
+
return std::make_shared<FilterOperationInterpolator<TOperation>>(std::make_shared<TOperation>(defaultValue));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
template <typename TOperation>
|
|
159
|
+
auto filterOp(const auto &defaultValue, ResolvableValueInterpolatorConfig config) -> std::enable_if_t<
|
|
160
|
+
std::is_base_of_v<FilterOperation, TOperation> && std::is_constructible_v<TOperation, decltype(defaultValue)> &&
|
|
161
|
+
ResolvableOp<TOperation>,
|
|
162
|
+
std::shared_ptr<StyleOperationInterpolator>> {
|
|
163
|
+
return std::make_shared<FilterOperationInterpolator<TOperation>>(
|
|
164
|
+
std::make_shared<TOperation>(defaultValue), std::move(config));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Record property interpolator factory
|
|
169
|
+
*/
|
|
170
|
+
std::shared_ptr<PropertyInterpolatorFactory> record(const InterpolatorFactoriesRecord &factories);
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Array property interpolator factory
|
|
174
|
+
*/
|
|
175
|
+
std::shared_ptr<PropertyInterpolatorFactory> array(const InterpolatorFactoriesArray &factories);
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Transform interpolators
|
|
179
|
+
*/
|
|
180
|
+
std::shared_ptr<PropertyInterpolatorFactory> transforms(
|
|
181
|
+
const std::unordered_map<std::string, std::shared_ptr<StyleOperationInterpolator>> &interpolators);
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Filter interpolators
|
|
185
|
+
*/
|
|
186
|
+
std::shared_ptr<PropertyInterpolatorFactory> filters(
|
|
187
|
+
const std::unordered_map<std::string, std::shared_ptr<StyleOperationInterpolator>> &interpolators);
|
|
188
|
+
|
|
189
|
+
} // namespace reanimated::css
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#include <reanimated/CSS/interpolation/PropertyInterpolator.h>
|
|
2
|
+
|
|
3
|
+
#include <worklets/Tools/JSISerializer.h>
|
|
4
|
+
|
|
5
|
+
#include <memory>
|
|
6
|
+
#include <utility>
|
|
7
|
+
|
|
8
|
+
namespace reanimated::css {
|
|
9
|
+
|
|
10
|
+
PropertyInterpolator::PropertyInterpolator(
|
|
11
|
+
PropertyPath propertyPath,
|
|
12
|
+
const std::shared_ptr<ViewStylesRepository> &viewStylesRepository)
|
|
13
|
+
: propertyPath_(std::move(propertyPath)), viewStylesRepository_(viewStylesRepository) {}
|
|
14
|
+
|
|
15
|
+
bool PropertyInterpolatorFactory::isDiscreteProperty() const {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
std::string PropertyInterpolator::getPropertyPathString() const {
|
|
20
|
+
if (propertyPath_.empty()) {
|
|
21
|
+
return "";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
std::string result = propertyPath_[0];
|
|
25
|
+
for (size_t i = 1; i < propertyPath_.size(); ++i) {
|
|
26
|
+
result += "." + propertyPath_[i];
|
|
27
|
+
}
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
std::vector<std::pair<double, jsi::Value>> PropertyInterpolator::parseJSIKeyframes(
|
|
32
|
+
jsi::Runtime &rt,
|
|
33
|
+
const jsi::Value &keyframes) const {
|
|
34
|
+
if (!keyframes.isObject() || !keyframes.asObject(rt).isArray(rt)) {
|
|
35
|
+
throw std::invalid_argument(
|
|
36
|
+
"[Reanimated] Received invalid keyframes object for property: " + getPropertyPathString() +
|
|
37
|
+
".\n\nExpected an array of objects with 'offset' and 'value' properties, got: " +
|
|
38
|
+
worklets::stringifyJSIValue(rt, keyframes));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const auto keyframeArray = keyframes.asObject(rt).asArray(rt);
|
|
42
|
+
const auto keyframesCount = keyframeArray.size(rt);
|
|
43
|
+
|
|
44
|
+
const auto getKeyframeAtIndexOffset = [&](size_t index) -> double {
|
|
45
|
+
return keyframeArray.getValueAtIndex(rt, index).asObject(rt).getProperty(rt, "offset").asNumber();
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const bool hasOffset0 = getKeyframeAtIndexOffset(0) == 0;
|
|
49
|
+
const bool hasOffset1 = getKeyframeAtIndexOffset(keyframesCount - 1) == 1;
|
|
50
|
+
|
|
51
|
+
std::vector<std::pair<double, jsi::Value>> result;
|
|
52
|
+
result.reserve(keyframesCount + (hasOffset0 ? 0 : 1) + (hasOffset1 ? 0 : 1));
|
|
53
|
+
|
|
54
|
+
// Insert the keyframe without value at offset 0 if it is not present
|
|
55
|
+
if (!hasOffset0) {
|
|
56
|
+
result.emplace_back(0.0, jsi::Value::undefined());
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Insert all provided keyframes
|
|
60
|
+
for (size_t i = 0; i < keyframesCount; ++i) {
|
|
61
|
+
jsi::Object keyframeObject = keyframeArray.getValueAtIndex(rt, i).asObject(rt);
|
|
62
|
+
double offset = keyframeObject.getProperty(rt, "offset").asNumber();
|
|
63
|
+
jsi::Value value = keyframeObject.getProperty(rt, "value");
|
|
64
|
+
|
|
65
|
+
result.emplace_back(offset, std::move(value));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Insert the keyframe without value at offset 1 if it is not present
|
|
69
|
+
if (!hasOffset1) {
|
|
70
|
+
result.emplace_back(1.0, jsi::Value::undefined());
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
} // namespace reanimated::css
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <reanimated/CSS/common/definitions.h>
|
|
4
|
+
#include <reanimated/CSS/common/values/CSSValue.h>
|
|
5
|
+
#include <reanimated/CSS/misc/ViewStylesRepository.h>
|
|
6
|
+
#include <reanimated/CSS/progress/KeyframeProgressProvider.h>
|
|
7
|
+
|
|
8
|
+
#include <memory>
|
|
9
|
+
#include <string>
|
|
10
|
+
#include <unordered_map>
|
|
11
|
+
#include <utility>
|
|
12
|
+
#include <vector>
|
|
13
|
+
|
|
14
|
+
namespace reanimated::css {
|
|
15
|
+
|
|
16
|
+
class PropertyInterpolator {
|
|
17
|
+
public:
|
|
18
|
+
explicit PropertyInterpolator(
|
|
19
|
+
PropertyPath propertyPath,
|
|
20
|
+
const std::shared_ptr<ViewStylesRepository> &viewStylesRepository);
|
|
21
|
+
|
|
22
|
+
virtual folly::dynamic getStyleValue(const std::shared_ptr<const ShadowNode> &shadowNode) const = 0;
|
|
23
|
+
virtual folly::dynamic getResetStyle(const std::shared_ptr<const ShadowNode> &shadowNode) const = 0;
|
|
24
|
+
virtual folly::dynamic getFirstKeyframeValue() const = 0;
|
|
25
|
+
virtual folly::dynamic getLastKeyframeValue() const = 0;
|
|
26
|
+
virtual bool equalsReversingAdjustedStartValue(const folly::dynamic &propertyValue) const = 0;
|
|
27
|
+
|
|
28
|
+
virtual void updateKeyframes(jsi::Runtime &rt, const jsi::Value &keyframes) = 0;
|
|
29
|
+
virtual void updateKeyframesFromStyleChange(
|
|
30
|
+
const folly::dynamic &oldStyleValue,
|
|
31
|
+
const folly::dynamic &newStyleValue,
|
|
32
|
+
const folly::dynamic &lastUpdateValue) = 0;
|
|
33
|
+
|
|
34
|
+
virtual folly::dynamic interpolate(
|
|
35
|
+
const std::shared_ptr<const ShadowNode> &shadowNode,
|
|
36
|
+
const std::shared_ptr<KeyframeProgressProvider> &progressProvider,
|
|
37
|
+
double fallbackInterpolateThreshold) const = 0;
|
|
38
|
+
|
|
39
|
+
protected:
|
|
40
|
+
const PropertyPath propertyPath_;
|
|
41
|
+
const std::shared_ptr<ViewStylesRepository> viewStylesRepository_;
|
|
42
|
+
|
|
43
|
+
std::string getPropertyPathString() const;
|
|
44
|
+
std::vector<std::pair<double, jsi::Value>> parseJSIKeyframes(jsi::Runtime &rt, const jsi::Value &keyframes) const;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
class PropertyInterpolatorFactory {
|
|
48
|
+
public:
|
|
49
|
+
PropertyInterpolatorFactory() = default;
|
|
50
|
+
virtual ~PropertyInterpolatorFactory() = default;
|
|
51
|
+
|
|
52
|
+
virtual bool isDiscreteProperty() const;
|
|
53
|
+
virtual const CSSValue &getDefaultValue() const = 0;
|
|
54
|
+
|
|
55
|
+
virtual std::shared_ptr<PropertyInterpolator> create(
|
|
56
|
+
const PropertyPath &propertyPath,
|
|
57
|
+
const std::shared_ptr<ViewStylesRepository> &viewStylesRepository) const = 0;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
using PropertyInterpolatorsRecord = std::unordered_map<std::string, std::shared_ptr<PropertyInterpolator>>;
|
|
61
|
+
using InterpolatorFactoriesRecord = std::unordered_map<std::string, std::shared_ptr<PropertyInterpolatorFactory>>;
|
|
62
|
+
|
|
63
|
+
using PropertyInterpolatorsArray = std::vector<std::shared_ptr<PropertyInterpolator>>;
|
|
64
|
+
using InterpolatorFactoriesArray = std::vector<std::shared_ptr<PropertyInterpolatorFactory>>;
|
|
65
|
+
|
|
66
|
+
} // namespace reanimated::css
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <reanimated/CSS/common/values/CSSLength.h>
|
|
4
|
+
|
|
5
|
+
#include <string>
|
|
6
|
+
#include <utility>
|
|
7
|
+
|
|
8
|
+
namespace reanimated::css {
|
|
9
|
+
|
|
10
|
+
struct ResolvableValueInterpolatorConfig {
|
|
11
|
+
RelativeTo relativeTo;
|
|
12
|
+
std::string relativeProperty;
|
|
13
|
+
|
|
14
|
+
ResolvableValueInterpolatorConfig(RelativeTo relativeTo, std::string relativeProperty)
|
|
15
|
+
: relativeTo(relativeTo), relativeProperty(std::move(relativeProperty)) {}
|
|
16
|
+
|
|
17
|
+
ResolvableValueInterpolatorConfig() = default;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
} // namespace reanimated::css
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
#include <reanimated/CSS/interpolation/filters/FilterOperation.h>
|
|
2
|
+
|
|
3
|
+
#include <reanimated/CSS/common/values/CSSAngle.h>
|
|
4
|
+
#include <reanimated/CSS/common/values/CSSNumber.h>
|
|
5
|
+
#include <reanimated/CSS/common/values/complex/CSSDropShadow.h>
|
|
6
|
+
|
|
7
|
+
#include <reanimated/CSS/interpolation/filters/operations/blur.h>
|
|
8
|
+
#include <reanimated/CSS/interpolation/filters/operations/brightness.h>
|
|
9
|
+
#include <reanimated/CSS/interpolation/filters/operations/contrast.h>
|
|
10
|
+
#include <reanimated/CSS/interpolation/filters/operations/dropShadow.h>
|
|
11
|
+
#include <reanimated/CSS/interpolation/filters/operations/grayscale.h>
|
|
12
|
+
#include <reanimated/CSS/interpolation/filters/operations/hueRotate.h>
|
|
13
|
+
#include <reanimated/CSS/interpolation/filters/operations/invert.h>
|
|
14
|
+
#include <reanimated/CSS/interpolation/filters/operations/opacity.h>
|
|
15
|
+
#include <reanimated/CSS/interpolation/filters/operations/saturate.h>
|
|
16
|
+
#include <reanimated/CSS/interpolation/filters/operations/sepia.h>
|
|
17
|
+
|
|
18
|
+
#include <utility>
|
|
19
|
+
|
|
20
|
+
namespace reanimated::css {
|
|
21
|
+
|
|
22
|
+
FilterOperation::FilterOperation(FilterOp type) : StyleOperation(static_cast<uint8_t>(type)) {}
|
|
23
|
+
|
|
24
|
+
std::string FilterOperation::getOperationName() const {
|
|
25
|
+
return getFilterOperationName(static_cast<FilterOp>(type));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
std::shared_ptr<FilterOperation> FilterOperation::fromJSIValue(jsi::Runtime &rt, const jsi::Value &value) {
|
|
29
|
+
if (!value.isObject()) {
|
|
30
|
+
throw std::invalid_argument("[Reanimated] FilterOperation must be an object.");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
jsi::Object obj = value.asObject(rt);
|
|
34
|
+
auto propertyNames = obj.getPropertyNames(rt);
|
|
35
|
+
|
|
36
|
+
if (propertyNames.size(rt) != 1) {
|
|
37
|
+
throw std::invalid_argument("[Reanimated] FilterOperation must have exactly one property.");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const auto propertyName = propertyNames.getValueAtIndex(rt, 0).asString(rt).utf8(rt);
|
|
41
|
+
const auto propertyValue = obj.getProperty(rt, jsi::PropNameID::forUtf8(rt, propertyName));
|
|
42
|
+
FilterOp operationType = getFilterOperationType(propertyName);
|
|
43
|
+
|
|
44
|
+
switch (operationType) {
|
|
45
|
+
case FilterOp::Blur:
|
|
46
|
+
return std::make_shared<BlurOperation>(propertyValue.asNumber());
|
|
47
|
+
case FilterOp::Brightness:
|
|
48
|
+
return std::make_shared<BrightnessOperation>(propertyValue.asNumber());
|
|
49
|
+
case FilterOp::Contrast:
|
|
50
|
+
return std::make_shared<ContrastOperation>(propertyValue.asNumber());
|
|
51
|
+
case FilterOp::DropShadow:
|
|
52
|
+
return std::make_shared<DropShadowOperation>(CSSDropShadow(rt, propertyValue));
|
|
53
|
+
case FilterOp::Grayscale:
|
|
54
|
+
return std::make_shared<GrayscaleOperation>(propertyValue.asNumber());
|
|
55
|
+
case FilterOp::HueRotate:
|
|
56
|
+
return std::make_shared<HueRotateOperation>(propertyValue.asNumber());
|
|
57
|
+
case FilterOp::Invert:
|
|
58
|
+
return std::make_shared<InvertOperation>(propertyValue.asNumber());
|
|
59
|
+
case FilterOp::Opacity:
|
|
60
|
+
return std::make_shared<OpacityOperation>(propertyValue.asNumber());
|
|
61
|
+
case FilterOp::Saturate:
|
|
62
|
+
return std::make_shared<SaturateOperation>(propertyValue.asNumber());
|
|
63
|
+
case FilterOp::Sepia:
|
|
64
|
+
return std::make_shared<SepiaOperation>(propertyValue.asNumber());
|
|
65
|
+
default:
|
|
66
|
+
throw std::invalid_argument("[Reanimated] Unknown filter operation: " + propertyName);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
std::shared_ptr<FilterOperation> FilterOperation::fromDynamic(const folly::dynamic &value) {
|
|
71
|
+
if (!value.isObject()) {
|
|
72
|
+
throw std::invalid_argument("[Reanimated] FilterOperation must be an object.");
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
auto &obj = value;
|
|
76
|
+
if (obj.size() != 1) {
|
|
77
|
+
throw std::invalid_argument("[Reanimated] FilterOperation must have exactly one property.");
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
auto propertyName = obj.items().begin()->first.getString();
|
|
81
|
+
auto propertyValue = obj.items().begin()->second;
|
|
82
|
+
FilterOp operationType = getFilterOperationType(propertyName);
|
|
83
|
+
|
|
84
|
+
switch (operationType) {
|
|
85
|
+
case FilterOp::Blur:
|
|
86
|
+
return std::make_shared<BlurOperation>(propertyValue.getDouble());
|
|
87
|
+
case FilterOp::Brightness:
|
|
88
|
+
return std::make_shared<BrightnessOperation>(propertyValue.getDouble());
|
|
89
|
+
case FilterOp::Contrast:
|
|
90
|
+
return std::make_shared<ContrastOperation>(propertyValue.getDouble());
|
|
91
|
+
case FilterOp::DropShadow:
|
|
92
|
+
return std::make_shared<DropShadowOperation>(CSSDropShadow(propertyValue));
|
|
93
|
+
case FilterOp::Grayscale:
|
|
94
|
+
return std::make_shared<GrayscaleOperation>(propertyValue.getDouble());
|
|
95
|
+
case FilterOp::HueRotate:
|
|
96
|
+
return std::make_shared<HueRotateOperation>(propertyValue.getDouble());
|
|
97
|
+
case FilterOp::Invert:
|
|
98
|
+
return std::make_shared<InvertOperation>(propertyValue.getDouble());
|
|
99
|
+
case FilterOp::Opacity:
|
|
100
|
+
return std::make_shared<OpacityOperation>(propertyValue.getDouble());
|
|
101
|
+
case FilterOp::Saturate:
|
|
102
|
+
return std::make_shared<SaturateOperation>(propertyValue.getDouble());
|
|
103
|
+
case FilterOp::Sepia:
|
|
104
|
+
return std::make_shared<SepiaOperation>(propertyValue.getDouble());
|
|
105
|
+
default:
|
|
106
|
+
throw std::invalid_argument("[Reanimated] Unknown filter operation: " + propertyName);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// FilterOperationBase implementation
|
|
111
|
+
template <FilterOp TOperation, typename TValue>
|
|
112
|
+
FilterOperationBase<TOperation, TValue>::FilterOperationBase(TValue value)
|
|
113
|
+
: FilterOperation(TOperation), value(std::move(value)) {}
|
|
114
|
+
|
|
115
|
+
template <FilterOp TOperation, typename TValue>
|
|
116
|
+
folly::dynamic FilterOperationBase<TOperation, TValue>::valueToDynamic() const {
|
|
117
|
+
return value.toDynamic();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
template <FilterOp TOperation, typename TValue>
|
|
121
|
+
bool FilterOperationBase<TOperation, TValue>::areValuesEqual(const StyleOperation &other) const {
|
|
122
|
+
return value == static_cast<const FilterOperationBase<TOperation, TValue> &>(other).value;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
template struct FilterOperationBase<FilterOp::Blur, CSSDouble>;
|
|
126
|
+
template struct FilterOperationBase<FilterOp::Brightness, CSSDouble>;
|
|
127
|
+
template struct FilterOperationBase<FilterOp::Contrast, CSSDouble>;
|
|
128
|
+
template struct FilterOperationBase<FilterOp::DropShadow, CSSDropShadow>;
|
|
129
|
+
template struct FilterOperationBase<FilterOp::Grayscale, CSSDouble>;
|
|
130
|
+
template struct FilterOperationBase<FilterOp::HueRotate, CSSDouble>;
|
|
131
|
+
template struct FilterOperationBase<FilterOp::Invert, CSSDouble>;
|
|
132
|
+
template struct FilterOperationBase<FilterOp::Opacity, CSSDouble>;
|
|
133
|
+
template struct FilterOperationBase<FilterOp::Saturate, CSSDouble>;
|
|
134
|
+
template struct FilterOperationBase<FilterOp::Sepia, CSSDouble>;
|
|
135
|
+
|
|
136
|
+
} // namespace reanimated::css
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <reanimated/CSS/common/filters/FilterOp.h>
|
|
4
|
+
#include <reanimated/CSS/common/values/CSSValue.h>
|
|
5
|
+
#include <reanimated/CSS/interpolation/operations/StyleOperation.h>
|
|
6
|
+
|
|
7
|
+
#include <jsi/jsi.h>
|
|
8
|
+
#include <memory>
|
|
9
|
+
#include <string>
|
|
10
|
+
#include <vector>
|
|
11
|
+
|
|
12
|
+
namespace reanimated::css {
|
|
13
|
+
|
|
14
|
+
using namespace facebook;
|
|
15
|
+
|
|
16
|
+
// Base struct for FilterOperations
|
|
17
|
+
struct FilterOperation : public StyleOperation {
|
|
18
|
+
explicit FilterOperation(FilterOp type);
|
|
19
|
+
|
|
20
|
+
std::string getOperationName() const override;
|
|
21
|
+
|
|
22
|
+
static std::shared_ptr<FilterOperation> fromJSIValue(jsi::Runtime &rt, const jsi::Value &value);
|
|
23
|
+
static std::shared_ptr<FilterOperation> fromDynamic(const folly::dynamic &value);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
using FilterOperations = std::vector<std::shared_ptr<FilterOperation>>;
|
|
27
|
+
|
|
28
|
+
// Base implementation for filter operations
|
|
29
|
+
template <FilterOp TOperation, typename TValue>
|
|
30
|
+
struct FilterOperationBase : public FilterOperation {
|
|
31
|
+
const TValue value;
|
|
32
|
+
|
|
33
|
+
explicit FilterOperationBase(TValue value);
|
|
34
|
+
|
|
35
|
+
protected:
|
|
36
|
+
folly::dynamic valueToDynamic() const override;
|
|
37
|
+
bool areValuesEqual(const StyleOperation &other) const override;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
} // namespace reanimated::css
|