react-native-reanimated 2.9.1 → 3.0.0-rc.2
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/Common/cpp/AnimatedSensor/AnimatedSensorModule.cpp +4 -4
- package/Common/cpp/Fabric/FabricUtils.cpp +133 -0
- package/Common/cpp/Fabric/ReanimatedUIManagerBinding.cpp +220 -0
- package/Common/cpp/Fabric/ShadowTreeCloner.cpp +92 -0
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +336 -6
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +23 -0
- package/Common/cpp/Registries/EventHandlerRegistry.cpp +14 -1
- package/Common/cpp/Registries/NewestShadowNodesRegistry.cpp +68 -0
- package/Common/cpp/SharedItems/ShareableValue.cpp +18 -0
- package/Common/cpp/Tools/Mapper.cpp +23 -4
- package/Common/cpp/Tools/RuntimeDecorator.cpp +92 -32
- package/Common/cpp/Tools/Scheduler.cpp +4 -0
- package/Common/cpp/headers/Fabric/FabricUtils.h +79 -0
- package/Common/cpp/headers/Fabric/ReanimatedUIManagerBinding.h +47 -0
- package/Common/cpp/headers/Fabric/ShadowTreeCloner.h +41 -0
- package/Common/cpp/headers/NativeModules/NativeReanimatedModule.h +81 -2
- package/Common/cpp/headers/NativeModules/NativeReanimatedModuleSpec.h +8 -0
- package/Common/cpp/headers/Registries/EventHandlerRegistry.h +8 -0
- package/Common/cpp/headers/Registries/NewestShadowNodesRegistry.h +41 -0
- package/Common/cpp/headers/SharedItems/SharedParent.h +3 -0
- package/Common/cpp/headers/SharedItems/ValueWrapper.h +25 -0
- package/Common/cpp/headers/SpecTools/ErrorHandler.h +5 -0
- package/Common/cpp/headers/Tools/Mapper.h +1 -1
- package/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h +48 -8
- package/Common/cpp/headers/Tools/RuntimeDecorator.h +8 -3
- package/README.md +4 -0
- package/RNReanimated.podspec +48 -15
- package/android/CMakeLists.txt +205 -86
- package/android/build.gradle +242 -236
- package/android/src/fabric/java/com/swmansion/reanimated/NativeProxy.java +335 -0
- package/android/src/fabric/java/com/swmansion/reanimated/ReaCompatibility.java +25 -0
- package/android/src/main/cpp/NativeProxy.cpp +220 -51
- package/android/src/main/cpp/OnLoad.cpp +1 -0
- package/android/src/main/cpp/headers/NativeProxy.h +72 -7
- package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +16 -246
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedModule.java +0 -125
- package/android/src/main/java/com/swmansion/reanimated/keyboardObserver/ReanimatedKeyboardEventListener.java +165 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +19 -16
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/LayoutAnimations.java +2 -1
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +5 -1
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorType.java +1 -1
- package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +326 -0
- package/android/src/paper/java/com/swmansion/reanimated/ReaCompatibility.java +17 -0
- package/ios/Fabric/REAInitializerRCTFabricSurface.h +12 -0
- package/ios/Fabric/REAInitializerRCTFabricSurface.mm +73 -0
- package/ios/REAEventDispatcher.m +0 -1
- package/ios/REAModule.h +10 -1
- package/ios/REAModule.mm +284 -0
- package/ios/REANodesManager.h +27 -51
- package/ios/REANodesManager.mm +517 -0
- package/ios/keyboardObserver/REAKeyboardEventObserver.h +17 -0
- package/ios/keyboardObserver/REAKeyboardEventObserver.m +198 -0
- package/ios/native/NativeProxy.mm +95 -17
- package/ios/native/REAInitializer.mm +10 -12
- package/ios/native/REAJSIUtils.h +66 -0
- package/ios/native/UIResponder+Reanimated.h +3 -1
- package/ios/native/UIResponder+Reanimated.mm +3 -1
- package/ios/sensor/ReanimatedSensor.m +26 -17
- package/lib/commonjs/Animated.js +70 -0
- package/lib/commonjs/Animated.js.map +1 -0
- package/lib/commonjs/ConfigHelper.js +173 -0
- package/lib/commonjs/ConfigHelper.js.map +1 -0
- package/lib/commonjs/createAnimatedComponent.js +474 -0
- package/lib/commonjs/createAnimatedComponent.js.map +1 -0
- package/lib/commonjs/index.js +44 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/index.web.js +32 -0
- package/lib/commonjs/index.web.js.map +1 -0
- package/lib/commonjs/reanimated2/Bezier.js +166 -0
- package/lib/commonjs/reanimated2/Bezier.js.map +1 -0
- package/lib/commonjs/reanimated2/Colors.js +673 -0
- package/lib/commonjs/reanimated2/Colors.js.map +1 -0
- package/lib/commonjs/reanimated2/Easing.js +274 -0
- package/lib/commonjs/reanimated2/Easing.js.map +1 -0
- package/lib/commonjs/reanimated2/NativeMethods.js +100 -0
- package/lib/commonjs/reanimated2/NativeMethods.js.map +1 -0
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +99 -0
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -0
- package/lib/commonjs/reanimated2/NativeReanimated/index.js +26 -0
- package/lib/commonjs/reanimated2/NativeReanimated/index.js.map +1 -0
- package/lib/commonjs/reanimated2/PlatformChecker.js +33 -0
- package/lib/commonjs/reanimated2/PlatformChecker.js.map +1 -0
- package/lib/commonjs/reanimated2/PropAdapters.js +68 -0
- package/lib/commonjs/reanimated2/PropAdapters.js.map +1 -0
- package/lib/commonjs/reanimated2/UpdateProps.js +82 -0
- package/lib/commonjs/reanimated2/UpdateProps.js.map +1 -0
- package/lib/commonjs/reanimated2/ViewDescriptorsSet.js +96 -0
- package/lib/commonjs/reanimated2/ViewDescriptorsSet.js.map +1 -0
- package/lib/commonjs/reanimated2/WorkletEventHandler.js +75 -0
- package/lib/commonjs/reanimated2/WorkletEventHandler.js.map +1 -0
- package/lib/commonjs/reanimated2/animation/commonTypes.js +6 -0
- package/lib/commonjs/reanimated2/animation/commonTypes.js.map +1 -0
- package/lib/commonjs/reanimated2/animation/decay.js +132 -0
- package/lib/commonjs/reanimated2/animation/decay.js.map +1 -0
- package/lib/commonjs/reanimated2/animation/delay.js +89 -0
- package/lib/commonjs/reanimated2/animation/delay.js.map +1 -0
- package/lib/commonjs/reanimated2/animation/index.js +82 -0
- package/lib/commonjs/reanimated2/animation/index.js.map +1 -0
- package/lib/commonjs/reanimated2/animation/repeat.js +107 -0
- package/lib/commonjs/reanimated2/animation/repeat.js.map +1 -0
- package/lib/commonjs/reanimated2/animation/sequence.js +103 -0
- package/lib/commonjs/reanimated2/animation/sequence.js.map +1 -0
- package/lib/commonjs/reanimated2/animation/spring.js +121 -0
- package/lib/commonjs/reanimated2/animation/spring.js.map +1 -0
- package/lib/commonjs/reanimated2/animation/styleAnimation.js +206 -0
- package/lib/commonjs/reanimated2/animation/styleAnimation.js.map +1 -0
- package/lib/commonjs/reanimated2/animation/timing.js +82 -0
- package/lib/commonjs/reanimated2/animation/timing.js.map +1 -0
- package/lib/commonjs/reanimated2/animation/util.js +233 -0
- package/lib/commonjs/reanimated2/animation/util.js.map +1 -0
- package/lib/commonjs/reanimated2/commonTypes.js +17 -0
- package/lib/commonjs/reanimated2/commonTypes.js.map +1 -0
- package/lib/commonjs/reanimated2/component/FlatList.js +53 -0
- package/lib/commonjs/reanimated2/component/FlatList.js.map +1 -0
- package/lib/commonjs/reanimated2/component/Image.js +17 -0
- package/lib/commonjs/reanimated2/component/Image.js.map +1 -0
- package/lib/commonjs/reanimated2/component/ScrollView.js +17 -0
- package/lib/commonjs/reanimated2/component/ScrollView.js.map +1 -0
- package/lib/commonjs/reanimated2/component/Text.js +17 -0
- package/lib/commonjs/reanimated2/component/Text.js.map +1 -0
- package/lib/commonjs/reanimated2/component/View.js +17 -0
- package/lib/commonjs/reanimated2/component/View.js.map +1 -0
- package/lib/commonjs/reanimated2/core.js +360 -0
- package/lib/commonjs/reanimated2/core.js.map +1 -0
- package/lib/commonjs/reanimated2/fabricUtils.js +27 -0
- package/lib/commonjs/reanimated2/fabricUtils.js.map +1 -0
- package/lib/commonjs/reanimated2/fabricUtils.web.js +21 -0
- package/lib/commonjs/reanimated2/fabricUtils.web.js.map +1 -0
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js +55 -0
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -0
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js +64 -0
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -0
- package/lib/commonjs/reanimated2/globals.d.js +6 -0
- package/lib/commonjs/reanimated2/globals.d.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/Hooks.js +35 -0
- package/lib/commonjs/reanimated2/hook/Hooks.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/commonTypes.js +6 -0
- package/lib/commonjs/reanimated2/hook/commonTypes.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/index.js +118 -0
- package/lib/commonjs/reanimated2/hook/index.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedGestureHandler.js +66 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +48 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js +44 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +43 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedScrollHandler.js +62 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +94 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +471 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/useDerivedValue.js +49 -0
- package/lib/commonjs/reanimated2/hook/useDerivedValue.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/useFrameCallback.js +36 -0
- package/lib/commonjs/reanimated2/hook/useFrameCallback.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/useSharedValue.js +30 -0
- package/lib/commonjs/reanimated2/hook/useSharedValue.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/utils.js +247 -0
- package/lib/commonjs/reanimated2/hook/utils.js.map +1 -0
- package/lib/commonjs/reanimated2/index.js +162 -0
- package/lib/commonjs/reanimated2/index.js.map +1 -0
- package/lib/commonjs/reanimated2/interpolateColor.js +154 -0
- package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -0
- package/lib/commonjs/reanimated2/interpolation.js +143 -0
- package/lib/commonjs/reanimated2/interpolation.js.map +1 -0
- package/lib/commonjs/reanimated2/jestUtils.js +239 -0
- package/lib/commonjs/reanimated2/jestUtils.js.map +1 -0
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +160 -0
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -0
- package/lib/commonjs/reanimated2/js-reanimated/Mapper.js +74 -0
- package/lib/commonjs/reanimated2/js-reanimated/Mapper.js.map +1 -0
- package/lib/commonjs/reanimated2/js-reanimated/MapperRegistry.js +146 -0
- package/lib/commonjs/reanimated2/js-reanimated/MapperRegistry.js.map +1 -0
- package/lib/commonjs/reanimated2/js-reanimated/MutableValue.js +57 -0
- package/lib/commonjs/reanimated2/js-reanimated/MutableValue.js.map +1 -0
- package/lib/commonjs/reanimated2/js-reanimated/commonTypes.js +6 -0
- package/lib/commonjs/reanimated2/js-reanimated/commonTypes.js.map +1 -0
- package/lib/commonjs/reanimated2/js-reanimated/global.js +57 -0
- package/lib/commonjs/reanimated2/js-reanimated/global.js.map +1 -0
- package/lib/commonjs/reanimated2/js-reanimated/index.js +57 -0
- package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/LayoutAnimationRepository.js +97 -0
- package/lib/commonjs/reanimated2/layoutReanimation/LayoutAnimationRepository.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +100 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +203 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +244 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +6 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js +30 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +570 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Default.js +55 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Default.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Fade.js +409 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Flip.js +559 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +221 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +101 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js +189 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +403 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js +298 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +167 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +700 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/index.js +136 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +120 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +180 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +66 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +64 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +52 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +68 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/index.js +84 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/index.js +47 -0
- package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -0
- package/lib/commonjs/reanimated2/mock.js +88 -0
- package/lib/commonjs/reanimated2/mock.js.map +1 -0
- package/lib/commonjs/reanimated2/platform-specific/RNRenderer.js +16 -0
- package/lib/commonjs/reanimated2/platform-specific/RNRenderer.js.map +1 -0
- package/lib/commonjs/reanimated2/platform-specific/RNRenderer.web.js +5 -0
- package/lib/commonjs/reanimated2/platform-specific/RNRenderer.web.js.map +1 -0
- package/lib/commonjs/reanimated2/utils.js +19 -0
- package/lib/commonjs/reanimated2/utils.js.map +1 -0
- package/lib/commonjs/setAndForwardRef.js +63 -0
- package/lib/commonjs/setAndForwardRef.js.map +1 -0
- package/lib/module/Animated.js +8 -0
- package/lib/module/Animated.js.map +1 -0
- package/lib/module/ConfigHelper.js +161 -0
- package/lib/module/ConfigHelper.js.map +1 -0
- package/lib/module/createAnimatedComponent.js +452 -0
- package/lib/module/createAnimatedComponent.js.map +1 -0
- package/lib/module/index.js +15 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/index.web.js +6 -0
- package/lib/module/index.web.js.map +1 -0
- package/lib/module/reanimated2/Bezier.js +159 -0
- package/lib/module/reanimated2/Bezier.js.map +1 -0
- package/lib/module/reanimated2/Colors.js +632 -0
- package/lib/module/reanimated2/Colors.js.map +1 -0
- package/lib/module/reanimated2/Easing.js +311 -0
- package/lib/module/reanimated2/Easing.js.map +1 -0
- package/lib/module/reanimated2/NativeMethods.js +82 -0
- package/lib/module/reanimated2/NativeMethods.js.map +1 -0
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +89 -0
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -0
- package/lib/module/reanimated2/NativeReanimated/index.js +13 -0
- package/lib/module/reanimated2/NativeReanimated/index.js.map +1 -0
- package/lib/module/reanimated2/PlatformChecker.js +17 -0
- package/lib/module/reanimated2/PlatformChecker.js.map +1 -0
- package/lib/module/reanimated2/PropAdapters.js +56 -0
- package/lib/module/reanimated2/PropAdapters.js.map +1 -0
- package/lib/module/reanimated2/UpdateProps.js +64 -0
- package/lib/module/reanimated2/UpdateProps.js.map +1 -0
- package/lib/module/reanimated2/ViewDescriptorsSet.js +83 -0
- package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -0
- package/lib/module/reanimated2/WorkletEventHandler.js +64 -0
- package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -0
- package/lib/module/reanimated2/animation/commonTypes.js +2 -0
- package/lib/module/reanimated2/animation/commonTypes.js.map +1 -0
- package/lib/module/reanimated2/animation/decay.js +123 -0
- package/lib/module/reanimated2/animation/decay.js.map +1 -0
- package/lib/module/reanimated2/animation/delay.js +79 -0
- package/lib/module/reanimated2/animation/delay.js.map +1 -0
- package/lib/module/reanimated2/animation/index.js +9 -0
- package/lib/module/reanimated2/animation/index.js.map +1 -0
- package/lib/module/reanimated2/animation/repeat.js +95 -0
- package/lib/module/reanimated2/animation/repeat.js.map +1 -0
- package/lib/module/reanimated2/animation/sequence.js +93 -0
- package/lib/module/reanimated2/animation/sequence.js.map +1 -0
- package/lib/module/reanimated2/animation/spring.js +113 -0
- package/lib/module/reanimated2/animation/spring.js.map +1 -0
- package/lib/module/reanimated2/animation/styleAnimation.js +191 -0
- package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -0
- package/lib/module/reanimated2/animation/timing.js +73 -0
- package/lib/module/reanimated2/animation/timing.js.map +1 -0
- package/lib/module/reanimated2/animation/util.js +216 -0
- package/lib/module/reanimated2/animation/util.js.map +1 -0
- package/lib/module/reanimated2/commonTypes.js +10 -0
- package/lib/module/reanimated2/commonTypes.js.map +1 -0
- package/lib/module/reanimated2/component/FlatList.js +33 -0
- package/lib/module/reanimated2/component/FlatList.js.map +1 -0
- package/lib/module/reanimated2/component/Image.js +5 -0
- package/lib/module/reanimated2/component/Image.js.map +1 -0
- package/lib/module/reanimated2/component/ScrollView.js +5 -0
- package/lib/module/reanimated2/component/ScrollView.js.map +1 -0
- package/lib/module/reanimated2/component/Text.js +5 -0
- package/lib/module/reanimated2/component/Text.js.map +1 -0
- package/lib/module/reanimated2/component/View.js +5 -0
- package/lib/module/reanimated2/component/View.js.map +1 -0
- package/lib/module/reanimated2/core.js +314 -0
- package/lib/module/reanimated2/core.js.map +1 -0
- package/lib/module/reanimated2/fabricUtils.js +18 -0
- package/lib/module/reanimated2/fabricUtils.js.map +1 -0
- package/lib/module/reanimated2/fabricUtils.web.js +12 -0
- package/lib/module/reanimated2/fabricUtils.web.js.map +1 -0
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js +44 -0
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -0
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js +55 -0
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -0
- package/lib/module/reanimated2/globals.d.js +2 -0
- package/lib/module/reanimated2/globals.d.js.map +1 -0
- package/lib/module/reanimated2/hook/Hooks.js +10 -0
- package/lib/module/reanimated2/hook/Hooks.js.map +1 -0
- package/lib/module/reanimated2/hook/commonTypes.js +2 -0
- package/lib/module/reanimated2/hook/commonTypes.js.map +1 -0
- package/lib/module/reanimated2/hook/index.js +12 -0
- package/lib/module/reanimated2/hook/index.js.map +1 -0
- package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js +56 -0
- package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -0
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +34 -0
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -0
- package/lib/module/reanimated2/hook/useAnimatedReaction.js +35 -0
- package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -0
- package/lib/module/reanimated2/hook/useAnimatedRef.js +32 -0
- package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -0
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js +54 -0
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -0
- package/lib/module/reanimated2/hook/useAnimatedSensor.js +79 -0
- package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -0
- package/lib/module/reanimated2/hook/useAnimatedStyle.js +450 -0
- package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -0
- package/lib/module/reanimated2/hook/useDerivedValue.js +39 -0
- package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -0
- package/lib/module/reanimated2/hook/useFrameCallback.js +24 -0
- package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -0
- package/lib/module/reanimated2/hook/useSharedValue.js +20 -0
- package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -0
- package/lib/module/reanimated2/hook/utils.js +208 -0
- package/lib/module/reanimated2/hook/utils.js.map +1 -0
- package/lib/module/reanimated2/index.js +13 -0
- package/lib/module/reanimated2/index.js.map +1 -0
- package/lib/module/reanimated2/interpolateColor.js +135 -0
- package/lib/module/reanimated2/interpolateColor.js.map +1 -0
- package/lib/module/reanimated2/interpolation.js +135 -0
- package/lib/module/reanimated2/interpolation.js.map +1 -0
- package/lib/module/reanimated2/jestUtils.js +217 -0
- package/lib/module/reanimated2/jestUtils.js.map +1 -0
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js +144 -0
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -0
- package/lib/module/reanimated2/js-reanimated/Mapper.js +62 -0
- package/lib/module/reanimated2/js-reanimated/Mapper.js.map +1 -0
- package/lib/module/reanimated2/js-reanimated/MapperRegistry.js +137 -0
- package/lib/module/reanimated2/js-reanimated/MapperRegistry.js.map +1 -0
- package/lib/module/reanimated2/js-reanimated/MutableValue.js +48 -0
- package/lib/module/reanimated2/js-reanimated/MutableValue.js.map +1 -0
- package/lib/module/reanimated2/js-reanimated/commonTypes.js +2 -0
- package/lib/module/reanimated2/js-reanimated/commonTypes.js.map +1 -0
- package/lib/module/reanimated2/js-reanimated/global.js +48 -0
- package/lib/module/reanimated2/js-reanimated/global.js.map +1 -0
- package/lib/module/reanimated2/js-reanimated/index.js +43 -0
- package/lib/module/reanimated2/js-reanimated/index.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/LayoutAnimationRepository.js +91 -0
- package/lib/module/reanimated2/layoutReanimation/LayoutAnimationRepository.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +90 -0
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +192 -0
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +233 -0
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +2 -0
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js +4 -0
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +530 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Default.js +40 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Default.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js +372 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js +516 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +199 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +88 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +168 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +372 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +265 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +148 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +643 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/index.js +11 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +108 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +166 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +55 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +52 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +41 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +57 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/index.js +7 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/index.js +5 -0
- package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -0
- package/lib/module/reanimated2/mock.js +86 -0
- package/lib/module/reanimated2/mock.js.map +1 -0
- package/lib/module/reanimated2/platform-specific/RNRenderer.js +4 -0
- package/lib/module/reanimated2/platform-specific/RNRenderer.js.map +1 -0
- package/lib/module/reanimated2/platform-specific/RNRenderer.web.js +3 -0
- package/lib/module/reanimated2/platform-specific/RNRenderer.web.js.map +1 -0
- package/lib/module/reanimated2/utils.js +11 -0
- package/lib/module/reanimated2/utils.js.map +1 -0
- package/lib/module/setAndForwardRef.js +55 -0
- package/lib/module/setAndForwardRef.js.map +1 -0
- package/mock.js +1 -0
- package/package.json +29 -25
- package/plugin.js +11 -17
- package/react-native-reanimated.d.ts +57 -4
- package/src/Animated.ts +0 -2
- package/src/createAnimatedComponent.tsx +37 -197
- package/src/index.ts +11 -5
- package/src/index.web.ts +5 -0
- package/src/reanimated2/Colors.ts +1 -1
- package/src/reanimated2/Easing.ts +0 -53
- package/src/reanimated2/NativeMethods.ts +44 -7
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +9 -0
- package/src/reanimated2/UpdateProps.ts +38 -19
- package/src/reanimated2/animation/decay.ts +79 -30
- package/src/reanimated2/animation/index.ts +7 -4
- package/src/reanimated2/animation/util.ts +8 -1
- package/src/reanimated2/commonTypes.ts +17 -1
- package/src/reanimated2/component/FlatList.tsx +29 -19
- package/src/reanimated2/core.ts +15 -9
- package/src/reanimated2/fabricUtils.ts +27 -0
- package/src/reanimated2/fabricUtils.web.ts +19 -0
- package/src/reanimated2/frameCallback/FrameCallbackRegistryJS.ts +43 -0
- package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +64 -0
- package/src/reanimated2/globals.d.ts +20 -1
- package/src/reanimated2/hook/commonTypes.ts +4 -2
- package/src/reanimated2/hook/index.ts +14 -14
- package/src/reanimated2/hook/useAnimatedGestureHandler.ts +2 -2
- package/src/reanimated2/hook/useAnimatedKeyboard.ts +35 -0
- package/src/reanimated2/hook/useAnimatedRef.ts +8 -3
- package/src/reanimated2/hook/useAnimatedScrollHandler.ts +2 -2
- package/src/reanimated2/hook/useAnimatedSensor.ts +5 -5
- package/src/reanimated2/hook/useFrameCallback.ts +39 -0
- package/src/reanimated2/hook/utils.ts +2 -5
- package/src/reanimated2/interpolateColor.ts +6 -2
- package/src/reanimated2/interpolation.ts +1 -26
- package/src/reanimated2/jestUtils.ts +11 -3
- package/src/reanimated2/js-reanimated/JSReanimated.ts +16 -1
- package/src/reanimated2/js-reanimated/global.ts +46 -29
- package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +1 -1
- package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +1 -1
- package/android/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.2/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.2/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/7.2/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.2/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.2/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/7.2/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/react-native-reanimated-65-hermes.aar +0 -0
- package/android/react-native-reanimated-65-jsc.aar +0 -0
- package/android/react-native-reanimated-66-hermes.aar +0 -0
- package/android/react-native-reanimated-66-jsc.aar +0 -0
- package/android/react-native-reanimated-67-hermes.aar +0 -0
- package/android/react-native-reanimated-67-jsc.aar +0 -0
- package/android/react-native-reanimated-68-hermes.aar +0 -0
- package/android/react-native-reanimated-68-jsc.aar +0 -0
- package/android/react-native-reanimated-69-hermes.aar +0 -0
- package/android/react-native-reanimated-69-jsc.aar +0 -0
- package/android/rnVersionPatch/69/.gitkeep +0 -0
- package/android/src/main/java/com/swmansion/reanimated/NativeProxy.java +0 -288
- package/android/src/main/java/com/swmansion/reanimated/UpdateContext.java +0 -11
- package/android/src/main/java/com/swmansion/reanimated/nodes/AlwaysNode.java +0 -29
- package/android/src/main/java/com/swmansion/reanimated/nodes/BezierNode.java +0 -87
- package/android/src/main/java/com/swmansion/reanimated/nodes/BlockNode.java +0 -24
- package/android/src/main/java/com/swmansion/reanimated/nodes/CallFuncNode.java +0 -49
- package/android/src/main/java/com/swmansion/reanimated/nodes/ClockNode.java +0 -38
- package/android/src/main/java/com/swmansion/reanimated/nodes/ClockOpNode.java +0 -73
- package/android/src/main/java/com/swmansion/reanimated/nodes/ConcatNode.java +0 -36
- package/android/src/main/java/com/swmansion/reanimated/nodes/CondNode.java +0 -41
- package/android/src/main/java/com/swmansion/reanimated/nodes/DebugNode.java +0 -33
- package/android/src/main/java/com/swmansion/reanimated/nodes/EventNode.java +0 -83
- package/android/src/main/java/com/swmansion/reanimated/nodes/FinalNode.java +0 -5
- package/android/src/main/java/com/swmansion/reanimated/nodes/FunctionNode.java +0 -20
- package/android/src/main/java/com/swmansion/reanimated/nodes/JSCallNode.java +0 -41
- package/android/src/main/java/com/swmansion/reanimated/nodes/Node.java +0 -139
- package/android/src/main/java/com/swmansion/reanimated/nodes/NoopNode.java +0 -37
- package/android/src/main/java/com/swmansion/reanimated/nodes/OperatorNode.java +0 -377
- package/android/src/main/java/com/swmansion/reanimated/nodes/ParamNode.java +0 -71
- package/android/src/main/java/com/swmansion/reanimated/nodes/PropsNode.java +0 -153
- package/android/src/main/java/com/swmansion/reanimated/nodes/SetNode.java +0 -32
- package/android/src/main/java/com/swmansion/reanimated/nodes/StyleNode.java +0 -40
- package/android/src/main/java/com/swmansion/reanimated/nodes/TransformNode.java +0 -84
- package/android/src/main/java/com/swmansion/reanimated/nodes/ValueNode.java +0 -40
- package/android/src/main/java/com/swmansion/reanimated/transitions/ChangeTransition.java +0 -84
- package/android/src/main/java/com/swmansion/reanimated/transitions/SaneSidePropagation.java +0 -25
- package/android/src/main/java/com/swmansion/reanimated/transitions/Scale.java +0 -86
- package/android/src/main/java/com/swmansion/reanimated/transitions/TransitionModule.java +0 -41
- package/android/src/main/java/com/swmansion/reanimated/transitions/TransitionUtils.java +0 -161
- package/ios/Nodes/REAAlwaysNode.h +0 -4
- package/ios/Nodes/REAAlwaysNode.m +0 -35
- package/ios/Nodes/REABezierNode.h +0 -5
- package/ios/Nodes/REABezierNode.m +0 -103
- package/ios/Nodes/REABlockNode.h +0 -5
- package/ios/Nodes/REABlockNode.m +0 -25
- package/ios/Nodes/REACallFuncNode.h +0 -6
- package/ios/Nodes/REACallFuncNode.m +0 -69
- package/ios/Nodes/REAClockNodes.h +0 -19
- package/ios/Nodes/REAClockNodes.m +0 -118
- package/ios/Nodes/REAConcatNode.h +0 -5
- package/ios/Nodes/REAConcatNode.m +0 -32
- package/ios/Nodes/REACondNode.h +0 -5
- package/ios/Nodes/REACondNode.m +0 -36
- package/ios/Nodes/READebugNode.h +0 -5
- package/ios/Nodes/READebugNode.m +0 -30
- package/ios/Nodes/REAEventNode.h +0 -8
- package/ios/Nodes/REAEventNode.m +0 -35
- package/ios/Nodes/REAFunctionNode.h +0 -6
- package/ios/Nodes/REAFunctionNode.m +0 -24
- package/ios/Nodes/REAJSCallNode.h +0 -5
- package/ios/Nodes/REAJSCallNode.m +0 -30
- package/ios/Nodes/REANode.h +0 -40
- package/ios/Nodes/REANode.m +0 -155
- package/ios/Nodes/REAOperatorNode.h +0 -5
- package/ios/Nodes/REAOperatorNode.m +0 -114
- package/ios/Nodes/REAParamNode.h +0 -10
- package/ios/Nodes/REAParamNode.m +0 -79
- package/ios/Nodes/REAPropsNode.h +0 -9
- package/ios/Nodes/REAPropsNode.m +0 -96
- package/ios/Nodes/REASetNode.h +0 -5
- package/ios/Nodes/REASetNode.m +0 -34
- package/ios/Nodes/REAStyleNode.h +0 -5
- package/ios/Nodes/REAStyleNode.m +0 -27
- package/ios/Nodes/REATransformNode.h +0 -5
- package/ios/Nodes/REATransformNode.m +0 -36
- package/ios/Nodes/REAValueNode.h +0 -9
- package/ios/Nodes/REAValueNode.m +0 -26
- package/ios/REAModule.m +0 -184
- package/ios/REANodesManager.m +0 -626
- package/ios/Transitioning/RCTConvert+REATransition.h +0 -11
- package/ios/Transitioning/RCTConvert+REATransition.m +0 -53
- package/ios/Transitioning/REAAllTransitions.h +0 -26
- package/ios/Transitioning/REAAllTransitions.m +0 -296
- package/ios/Transitioning/REATransition.h +0 -64
- package/ios/Transitioning/REATransition.m +0 -210
- package/ios/Transitioning/REATransitionAnimation.h +0 -17
- package/ios/Transitioning/REATransitionAnimation.m +0 -79
- package/ios/Transitioning/REATransitionManager.h +0 -9
- package/ios/Transitioning/REATransitionManager.m +0 -60
- package/ios/Transitioning/REATransitionValues.h +0 -15
- package/ios/Transitioning/REATransitionValues.m +0 -25
- package/lib/Animated.js +0 -9
- package/lib/ConfigHelper.js +0 -145
- package/lib/ReanimatedEventEmitter.js +0 -3
- package/lib/ReanimatedModule.js +0 -2
- package/lib/ReanimatedModule.macos.js +0 -2
- package/lib/ReanimatedModule.native.js +0 -12
- package/lib/ReanimatedModule.windows.js +0 -2
- package/lib/ReanimatedModuleCompat.js +0 -66
- package/lib/__mocks__/ReanimatedEventEmitter.js +0 -8
- package/lib/__mocks__/ReanimatedModule.native.js +0 -11
- package/lib/createAnimatedComponent.js +0 -514
- package/lib/index.js +0 -6
- package/lib/reanimated1/Easing.js +0 -231
- package/lib/reanimated1/SpringConfig.js +0 -79
- package/lib/reanimated1/Transitioning.js +0 -158
- package/lib/reanimated1/animations/Animation.js +0 -32
- package/lib/reanimated1/animations/SpringUtils.js +0 -199
- package/lib/reanimated1/animations/backwardCompatibleAnimWrapper.js +0 -117
- package/lib/reanimated1/animations/decay.js +0 -54
- package/lib/reanimated1/animations/spring.js +0 -198
- package/lib/reanimated1/animations/timing.js +0 -74
- package/lib/reanimated1/base.js +0 -13
- package/lib/reanimated1/core/AnimatedAlways.js +0 -33
- package/lib/reanimated1/core/AnimatedBezier.js +0 -150
- package/lib/reanimated1/core/AnimatedBlock.js +0 -52
- package/lib/reanimated1/core/AnimatedCall.js +0 -55
- package/lib/reanimated1/core/AnimatedCallFunc.js +0 -72
- package/lib/reanimated1/core/AnimatedClock.js +0 -90
- package/lib/reanimated1/core/AnimatedClockTest.js +0 -22
- package/lib/reanimated1/core/AnimatedCode.js +0 -32
- package/lib/reanimated1/core/AnimatedConcat.js +0 -32
- package/lib/reanimated1/core/AnimatedCond.js +0 -57
- package/lib/reanimated1/core/AnimatedDebug.js +0 -62
- package/lib/reanimated1/core/AnimatedEvent.js +0 -126
- package/lib/reanimated1/core/AnimatedFunction.js +0 -55
- package/lib/reanimated1/core/AnimatedNode.js +0 -223
- package/lib/reanimated1/core/AnimatedOperator.js +0 -103
- package/lib/reanimated1/core/AnimatedParam.js +0 -88
- package/lib/reanimated1/core/AnimatedProps.js +0 -108
- package/lib/reanimated1/core/AnimatedSet.js +0 -38
- package/lib/reanimated1/core/AnimatedStartClock.js +0 -30
- package/lib/reanimated1/core/AnimatedStopClock.js +0 -30
- package/lib/reanimated1/core/AnimatedStyle.js +0 -78
- package/lib/reanimated1/core/AnimatedTransform.js +0 -78
- package/lib/reanimated1/core/AnimatedValue.js +0 -38
- package/lib/reanimated1/core/Core.test.js +0 -30
- package/lib/reanimated1/core/InternalAnimatedValue.js +0 -87
- package/lib/reanimated1/core/__mocks__/AnimatedProps.js +0 -86
- package/lib/reanimated1/core/createEventObjectProxyPolyfill.js +0 -44
- package/lib/reanimated1/derived/__mocks__/evaluateOnce.js +0 -14
- package/lib/reanimated1/derived/acc.js +0 -11
- package/lib/reanimated1/derived/color.js +0 -47
- package/lib/reanimated1/derived/diff.js +0 -16
- package/lib/reanimated1/derived/diffClamp.js +0 -11
- package/lib/reanimated1/derived/evaluateOnce.js +0 -35
- package/lib/reanimated1/derived/index.js +0 -8
- package/lib/reanimated1/derived/interpolate.js +0 -152
- package/lib/reanimated1/derived/interpolateColors.js +0 -62
- package/lib/reanimated1/derived/onChange.js +0 -14
- package/lib/reanimated1/derived/useCode.js +0 -41
- package/lib/reanimated1/index.js +0 -53
- package/lib/reanimated1/operators.js +0 -35
- package/lib/reanimated1/useValue.js +0 -10
- package/lib/reanimated1/val.js +0 -3
- package/lib/reanimated2/Bezier.js +0 -126
- package/lib/reanimated2/Colors.js +0 -522
- package/lib/reanimated2/Easing.js +0 -248
- package/lib/reanimated2/NativeMethods.js +0 -42
- package/lib/reanimated2/NativeReanimated/NativeReanimated.js +0 -50
- package/lib/reanimated2/NativeReanimated/index.js +0 -11
- package/lib/reanimated2/PlatformChecker.js +0 -16
- package/lib/reanimated2/PropAdapters.js +0 -55
- package/lib/reanimated2/UpdateProps.js +0 -55
- package/lib/reanimated2/ViewDescriptorsSet.js +0 -75
- package/lib/reanimated2/WorkletEventHandler.js +0 -37
- package/lib/reanimated2/__mocks__/MutableValue.js +0 -13
- package/lib/reanimated2/__mocks__/NativeReanimated.js +0 -20
- package/lib/reanimated2/__mocks__/NativeReanimated.native.js +0 -20
- package/lib/reanimated2/animation/commonTypes.js +0 -1
- package/lib/reanimated2/animation/decay.js +0 -71
- package/lib/reanimated2/animation/delay.js +0 -64
- package/lib/reanimated2/animation/index.js +0 -8
- package/lib/reanimated2/animation/repeat.js +0 -69
- package/lib/reanimated2/animation/sequence.js +0 -69
- package/lib/reanimated2/animation/spring.js +0 -103
- package/lib/reanimated2/animation/styleAnimation.js +0 -171
- package/lib/reanimated2/animation/timing.js +0 -64
- package/lib/reanimated2/animation/util.js +0 -180
- package/lib/reanimated2/commonTypes.js +0 -1
- package/lib/reanimated2/component/FlatList.js +0 -30
- package/lib/reanimated2/component/Image.js +0 -4
- package/lib/reanimated2/component/ScrollView.js +0 -4
- package/lib/reanimated2/component/Text.js +0 -4
- package/lib/reanimated2/component/View.js +0 -4
- package/lib/reanimated2/core.js +0 -268
- package/lib/reanimated2/globals.d.ts +0 -60
- package/lib/reanimated2/hook/Hooks.js +0 -9
- package/lib/reanimated2/hook/commonTypes.js +0 -1
- package/lib/reanimated2/hook/index.js +0 -9
- package/lib/reanimated2/hook/useAnimatedGestureHandler.js +0 -49
- package/lib/reanimated2/hook/useAnimatedReaction.js +0 -37
- package/lib/reanimated2/hook/useAnimatedRef.js +0 -25
- package/lib/reanimated2/hook/useAnimatedScrollHandler.js +0 -41
- package/lib/reanimated2/hook/useAnimatedSensor.js +0 -66
- package/lib/reanimated2/hook/useAnimatedStyle.js +0 -393
- package/lib/reanimated2/hook/useDerivedValue.js +0 -36
- package/lib/reanimated2/hook/useSharedValue.js +0 -17
- package/lib/reanimated2/hook/utils.js +0 -173
- package/lib/reanimated2/index.js +0 -12
- package/lib/reanimated2/interpolateColor.js +0 -98
- package/lib/reanimated2/interpolation.js +0 -127
- package/lib/reanimated2/jestUtils.js +0 -160
- package/lib/reanimated2/js-reanimated/JSReanimated.js +0 -99
- package/lib/reanimated2/js-reanimated/Mapper.js +0 -43
- package/lib/reanimated2/js-reanimated/MapperRegistry.js +0 -101
- package/lib/reanimated2/js-reanimated/MutableValue.js +0 -29
- package/lib/reanimated2/js-reanimated/commonTypes.js +0 -1
- package/lib/reanimated2/js-reanimated/global.js +0 -25
- package/lib/reanimated2/js-reanimated/index.js +0 -35
- package/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.js +0 -67
- package/lib/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +0 -69
- package/lib/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +0 -133
- package/lib/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +0 -194
- package/lib/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +0 -1
- package/lib/reanimated2/layoutReanimation/animationBuilder/index.js +0 -3
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +0 -376
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Default.js +0 -36
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Fade.js +0 -275
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.js +0 -385
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +0 -138
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +0 -81
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.js +0 -115
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +0 -273
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.js +0 -203
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +0 -101
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +0 -451
- package/lib/reanimated2/layoutReanimation/defaultAnimations/index.js +0 -10
- package/lib/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +0 -90
- package/lib/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +0 -132
- package/lib/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +0 -37
- package/lib/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +0 -41
- package/lib/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +0 -34
- package/lib/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +0 -46
- package/lib/reanimated2/layoutReanimation/defaultTransitions/index.js +0 -6
- package/lib/reanimated2/layoutReanimation/index.js +0 -4
- package/lib/reanimated2/mock.js +0 -75
- package/lib/reanimated2/platform-specific/RNRenderer.js +0 -3
- package/lib/reanimated2/platform-specific/RNRenderer.web.js +0 -3
- package/lib/reanimated2/utils.js +0 -9
- package/lib/setAndForwardRef.js +0 -19
- package/lib/types/lib/Animated.d.ts +0 -8
- package/lib/types/lib/ConfigHelper.d.ts +0 -12
- package/lib/types/lib/ReanimatedEventEmitter.d.ts +0 -3
- package/lib/types/lib/ReanimatedModule.d.ts +0 -2
- package/lib/types/lib/ReanimatedModule.macos.d.ts +0 -2
- package/lib/types/lib/ReanimatedModule.native.d.ts +0 -2
- package/lib/types/lib/ReanimatedModule.windows.d.ts +0 -2
- package/lib/types/lib/ReanimatedModuleCompat.d.ts +0 -14
- package/lib/types/lib/createAnimatedComponent.d.ts +0 -33
- package/lib/types/lib/index.d.ts +0 -4
- package/lib/types/lib/reanimated2/Bezier.d.ts +0 -6
- package/lib/types/lib/reanimated2/Colors.d.ts +0 -31
- package/lib/types/lib/reanimated2/Easing.d.ts +0 -172
- package/lib/types/lib/reanimated2/NativeMethods.d.ts +0 -14
- package/lib/types/lib/reanimated2/NativeReanimated/NativeReanimated.d.ts +0 -20
- package/lib/types/lib/reanimated2/NativeReanimated/index.d.ts +0 -3
- package/lib/types/lib/reanimated2/PlatformChecker.d.ts +0 -5
- package/lib/types/lib/reanimated2/PropAdapters.d.ts +0 -4
- package/lib/types/lib/reanimated2/UpdateProps.d.ts +0 -9
- package/lib/types/lib/reanimated2/ViewDescriptorsSet.d.ts +0 -20
- package/lib/types/lib/reanimated2/WorkletEventHandler.d.ts +0 -13
- package/lib/types/lib/reanimated2/__mocks__/MutableValue.d.ts +0 -5
- package/lib/types/lib/reanimated2/__mocks__/NativeReanimated.d.ts +0 -13
- package/lib/types/lib/reanimated2/__mocks__/NativeReanimated.native.d.ts +0 -13
- package/lib/types/lib/reanimated2/animation/commonTypes.d.ts +0 -27
- package/lib/types/lib/reanimated2/animation/decay.d.ts +0 -19
- package/lib/types/lib/reanimated2/animation/delay.d.ts +0 -7
- package/lib/types/lib/reanimated2/animation/index.d.ts +0 -9
- package/lib/types/lib/reanimated2/animation/repeat.d.ts +0 -12
- package/lib/types/lib/reanimated2/animation/sequence.d.ts +0 -7
- package/lib/types/lib/reanimated2/animation/spring.d.ts +0 -22
- package/lib/types/lib/reanimated2/animation/styleAnimation.d.ts +0 -7
- package/lib/types/lib/reanimated2/animation/timing.d.ts +0 -21
- package/lib/types/lib/reanimated2/animation/util.d.ts +0 -9
- package/lib/types/lib/reanimated2/commonTypes.d.ts +0 -79
- package/lib/types/lib/reanimated2/component/FlatList.d.ts +0 -9
- package/lib/types/lib/reanimated2/component/Image.d.ts +0 -3
- package/lib/types/lib/reanimated2/component/ScrollView.d.ts +0 -3
- package/lib/types/lib/reanimated2/component/Text.d.ts +0 -3
- package/lib/types/lib/reanimated2/component/View.d.ts +0 -3
- package/lib/types/lib/reanimated2/core.d.ts +0 -24
- package/lib/types/lib/reanimated2/hook/Hooks.d.ts +0 -5
- package/lib/types/lib/reanimated2/hook/commonTypes.d.ts +0 -14
- package/lib/types/lib/reanimated2/hook/index.d.ts +0 -10
- package/lib/types/lib/reanimated2/hook/useAnimatedGestureHandler.d.ts +0 -35
- package/lib/types/lib/reanimated2/hook/useAnimatedReaction.d.ts +0 -12
- package/lib/types/lib/reanimated2/hook/useAnimatedRef.d.ts +0 -3
- package/lib/types/lib/reanimated2/hook/useAnimatedScrollHandler.d.ts +0 -21
- package/lib/types/lib/reanimated2/hook/useAnimatedSensor.d.ts +0 -18
- package/lib/types/lib/reanimated2/hook/useAnimatedStyle.d.ts +0 -11
- package/lib/types/lib/reanimated2/hook/useDerivedValue.d.ts +0 -4
- package/lib/types/lib/reanimated2/hook/useSharedValue.d.ts +0 -2
- package/lib/types/lib/reanimated2/hook/utils.d.ts +0 -28
- package/lib/types/lib/reanimated2/index.d.ts +0 -12
- package/lib/types/lib/reanimated2/interpolateColor.d.ts +0 -26
- package/lib/types/lib/reanimated2/interpolation.d.ts +0 -14
- package/lib/types/lib/reanimated2/jestUtils.d.ts +0 -12
- package/lib/types/lib/reanimated2/js-reanimated/JSReanimated.d.ts +0 -30
- package/lib/types/lib/reanimated2/js-reanimated/Mapper.d.ts +0 -14
- package/lib/types/lib/reanimated2/js-reanimated/MapperRegistry.d.ts +0 -14
- package/lib/types/lib/reanimated2/js-reanimated/MutableValue.d.ts +0 -14
- package/lib/types/lib/reanimated2/js-reanimated/commonTypes.d.ts +0 -44
- package/lib/types/lib/reanimated2/js-reanimated/global.d.ts +0 -1
- package/lib/types/lib/reanimated2/js-reanimated/index.d.ts +0 -15
- package/lib/types/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.d.ts +0 -1
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.d.ts +0 -22
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts +0 -38
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/Keyframe.d.ts +0 -25
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/commonTypes.d.ts +0 -77
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/index.d.ts +0 -4
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.d.ts +0 -62
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Default.d.ts +0 -4
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Fade.d.ts +0 -42
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.d.ts +0 -50
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.d.ts +0 -18
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.d.ts +0 -10
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.d.ts +0 -18
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.d.ts +0 -34
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.d.ts +0 -34
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Stretch.d.ts +0 -18
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.d.ts +0 -66
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/index.d.ts +0 -10
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.d.ts +0 -19
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.d.ts +0 -13
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.d.ts +0 -6
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.d.ts +0 -6
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.d.ts +0 -7
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.d.ts +0 -9
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/index.d.ts +0 -6
- package/lib/types/lib/reanimated2/layoutReanimation/index.d.ts +0 -4
- package/lib/types/lib/reanimated2/mock.d.ts +0 -61
- package/lib/types/lib/reanimated2/platform-specific/RNRenderer.d.ts +0 -1
- package/lib/types/lib/reanimated2/platform-specific/RNRenderer.web.d.ts +0 -0
- package/lib/types/lib/reanimated2/utils.d.ts +0 -7
- package/lib/types/lib/setAndForwardRef.d.ts +0 -40
- package/lib/types/react-native-reanimated-tests.d.ts +0 -1
- package/src/ReanimatedEventEmitter.ts +0 -4
- package/src/ReanimatedModule.macos.ts +0 -3
- package/src/ReanimatedModule.native.ts +0 -13
- package/src/ReanimatedModule.ts +0 -3
- package/src/ReanimatedModule.windows.ts +0 -3
- package/src/ReanimatedModuleCompat.ts +0 -51
- package/src/__mocks__/ReanimatedEventEmitter.js +0 -8
- package/src/__mocks__/ReanimatedModule.native.js +0 -11
- package/src/reanimated1/Easing.js +0 -231
- package/src/reanimated1/SpringConfig.js +0 -79
- package/src/reanimated1/Transitioning.js +0 -158
- package/src/reanimated1/animations/Animation.js +0 -32
- package/src/reanimated1/animations/SpringUtils.js +0 -199
- package/src/reanimated1/animations/backwardCompatibleAnimWrapper.js +0 -117
- package/src/reanimated1/animations/decay.js +0 -54
- package/src/reanimated1/animations/spring.js +0 -198
- package/src/reanimated1/animations/timing.js +0 -74
- package/src/reanimated1/base.js +0 -13
- package/src/reanimated1/core/AnimatedAlways.js +0 -33
- package/src/reanimated1/core/AnimatedBezier.js +0 -150
- package/src/reanimated1/core/AnimatedBlock.js +0 -52
- package/src/reanimated1/core/AnimatedCall.js +0 -55
- package/src/reanimated1/core/AnimatedCallFunc.js +0 -72
- package/src/reanimated1/core/AnimatedClock.js +0 -90
- package/src/reanimated1/core/AnimatedClockTest.js +0 -22
- package/src/reanimated1/core/AnimatedCode.js +0 -32
- package/src/reanimated1/core/AnimatedConcat.js +0 -32
- package/src/reanimated1/core/AnimatedCond.js +0 -57
- package/src/reanimated1/core/AnimatedDebug.js +0 -62
- package/src/reanimated1/core/AnimatedEvent.js +0 -126
- package/src/reanimated1/core/AnimatedFunction.js +0 -55
- package/src/reanimated1/core/AnimatedNode.js +0 -223
- package/src/reanimated1/core/AnimatedOperator.js +0 -103
- package/src/reanimated1/core/AnimatedParam.js +0 -88
- package/src/reanimated1/core/AnimatedProps.js +0 -108
- package/src/reanimated1/core/AnimatedSet.js +0 -38
- package/src/reanimated1/core/AnimatedStartClock.js +0 -30
- package/src/reanimated1/core/AnimatedStopClock.js +0 -30
- package/src/reanimated1/core/AnimatedStyle.js +0 -78
- package/src/reanimated1/core/AnimatedTransform.js +0 -78
- package/src/reanimated1/core/AnimatedValue.js +0 -38
- package/src/reanimated1/core/Core.test.js +0 -30
- package/src/reanimated1/core/InternalAnimatedValue.js +0 -87
- package/src/reanimated1/core/__mocks__/AnimatedProps.js +0 -86
- package/src/reanimated1/core/createEventObjectProxyPolyfill.js +0 -44
- package/src/reanimated1/derived/__mocks__/evaluateOnce.js +0 -14
- package/src/reanimated1/derived/acc.js +0 -11
- package/src/reanimated1/derived/color.js +0 -47
- package/src/reanimated1/derived/diff.js +0 -16
- package/src/reanimated1/derived/diffClamp.js +0 -11
- package/src/reanimated1/derived/evaluateOnce.js +0 -35
- package/src/reanimated1/derived/index.js +0 -8
- package/src/reanimated1/derived/interpolate.js +0 -152
- package/src/reanimated1/derived/interpolateColors.js +0 -62
- package/src/reanimated1/derived/onChange.js +0 -14
- package/src/reanimated1/derived/useCode.js +0 -41
- package/src/reanimated1/index.js +0 -53
- package/src/reanimated1/operators.js +0 -35
- package/src/reanimated1/useValue.js +0 -10
- package/src/reanimated1/val.js +0 -3
- package/src/reanimated2/__mocks__/MutableValue.ts +0 -15
- package/src/reanimated2/__mocks__/NativeReanimated.ts +0 -23
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import { jestResetJsReanimatedModule } from './core';
|
|
4
|
+
let config = {
|
|
5
|
+
fps: 60
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const isAnimatedStyle = style => {
|
|
9
|
+
return !!style.animatedStyle;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const getAnimatedStyleFromObject = style => {
|
|
13
|
+
return style.animatedStyle.current.value;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const getCurrentStyle = received => {
|
|
17
|
+
const styleObject = received.props.style;
|
|
18
|
+
let currentStyle = {};
|
|
19
|
+
|
|
20
|
+
if (Array.isArray(styleObject)) {
|
|
21
|
+
received.props.style.forEach(style => {
|
|
22
|
+
if (isAnimatedStyle(style)) {
|
|
23
|
+
currentStyle = { ...currentStyle,
|
|
24
|
+
...getAnimatedStyleFromObject(style)
|
|
25
|
+
};
|
|
26
|
+
} else {
|
|
27
|
+
currentStyle = { ...currentStyle,
|
|
28
|
+
...style
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
} else {
|
|
33
|
+
if (isAnimatedStyle(styleObject)) {
|
|
34
|
+
currentStyle = getAnimatedStyleFromObject(styleObject);
|
|
35
|
+
} else {
|
|
36
|
+
currentStyle = { ...styleObject,
|
|
37
|
+
...received.props.animatedStyle.value
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return currentStyle;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const checkEqual = (currentStyle, expectStyle) => {
|
|
46
|
+
if (Array.isArray(expectStyle)) {
|
|
47
|
+
if (expectStyle.length !== currentStyle.length) return false;
|
|
48
|
+
|
|
49
|
+
for (let i = 0; i < currentStyle.length; i++) {
|
|
50
|
+
if (!checkEqual(currentStyle[i], expectStyle[i])) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
} else if (typeof currentStyle === 'object' && currentStyle) {
|
|
55
|
+
for (const property in expectStyle) {
|
|
56
|
+
if (!checkEqual(currentStyle[property], expectStyle[property])) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
return currentStyle === expectStyle;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return true;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const findStyleDiff = (current, expect, requireAllMatch) => {
|
|
68
|
+
const diffs = [];
|
|
69
|
+
let isEqual = true;
|
|
70
|
+
|
|
71
|
+
for (const property in expect) {
|
|
72
|
+
if (!checkEqual(current[property], expect[property])) {
|
|
73
|
+
isEqual = false;
|
|
74
|
+
diffs.push({
|
|
75
|
+
property: property,
|
|
76
|
+
current: current[property],
|
|
77
|
+
expect: expect[property]
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (requireAllMatch && Object.keys(current).length !== Object.keys(expect).length) {
|
|
83
|
+
isEqual = false;
|
|
84
|
+
|
|
85
|
+
for (const property in current) {
|
|
86
|
+
if (expect[property] === undefined) {
|
|
87
|
+
diffs.push({
|
|
88
|
+
property: property,
|
|
89
|
+
current: current[property],
|
|
90
|
+
expect: expect[property]
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
isEqual,
|
|
98
|
+
diffs
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const compareStyle = (received, expectedStyle, config) => {
|
|
103
|
+
if (!received.props.style) {
|
|
104
|
+
return {
|
|
105
|
+
message: () => message,
|
|
106
|
+
pass: false
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const {
|
|
111
|
+
exact
|
|
112
|
+
} = config;
|
|
113
|
+
const currentStyle = getCurrentStyle(received);
|
|
114
|
+
const {
|
|
115
|
+
isEqual,
|
|
116
|
+
diffs
|
|
117
|
+
} = findStyleDiff(currentStyle, expectedStyle, exact);
|
|
118
|
+
|
|
119
|
+
if (isEqual) {
|
|
120
|
+
return {
|
|
121
|
+
message: () => 'ok',
|
|
122
|
+
pass: true
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const currentStyleStr = JSON.stringify(currentStyle);
|
|
127
|
+
const expectedStyleStr = JSON.stringify(expectedStyle);
|
|
128
|
+
const differences = diffs.map(diff => `- '${diff.property}' should be ${JSON.stringify(diff.expect)}, but is ${JSON.stringify(diff.current)}`).join('\n');
|
|
129
|
+
return {
|
|
130
|
+
message: () => `Expected: ${expectedStyleStr}\nReceived: ${currentStyleStr}\n\nDifferences:\n${differences}`,
|
|
131
|
+
pass: false
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
let frameTime = 1000 / config.fps;
|
|
136
|
+
let requestAnimationFrameCopy;
|
|
137
|
+
let currentTimestamp = 0;
|
|
138
|
+
|
|
139
|
+
const requestAnimationFrame = callback => {
|
|
140
|
+
setTimeout(callback, frameTime);
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const beforeTest = () => {
|
|
144
|
+
jestResetJsReanimatedModule();
|
|
145
|
+
requestAnimationFrameCopy = global.requestAnimationFrame;
|
|
146
|
+
global.requestAnimationFrame = requestAnimationFrame;
|
|
147
|
+
global.ReanimatedDataMock = {
|
|
148
|
+
now: () => currentTimestamp
|
|
149
|
+
};
|
|
150
|
+
currentTimestamp = 0;
|
|
151
|
+
jest.useFakeTimers();
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const afterTest = () => {
|
|
155
|
+
jest.useRealTimers();
|
|
156
|
+
global.requestAnimationFrame = requestAnimationFrameCopy;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const tickTravel = () => {
|
|
160
|
+
currentTimestamp += frameTime;
|
|
161
|
+
jest.advanceTimersByTime(frameTime);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export const withReanimatedTimer = animationTest => {
|
|
165
|
+
beforeTest();
|
|
166
|
+
animationTest();
|
|
167
|
+
afterTest();
|
|
168
|
+
};
|
|
169
|
+
export const advanceAnimationByTime = function () {
|
|
170
|
+
let time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : frameTime;
|
|
171
|
+
|
|
172
|
+
for (let i = 0; i <= Math.ceil(time / frameTime); i++) {
|
|
173
|
+
tickTravel();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
jest.advanceTimersByTime(frameTime);
|
|
177
|
+
};
|
|
178
|
+
export const advanceAnimationByFrame = count => {
|
|
179
|
+
for (let i = 0; i <= count; i++) {
|
|
180
|
+
tickTravel();
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
jest.advanceTimersByTime(frameTime);
|
|
184
|
+
};
|
|
185
|
+
export const setUpTests = function () {
|
|
186
|
+
let userConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
187
|
+
let expect;
|
|
188
|
+
|
|
189
|
+
try {
|
|
190
|
+
expect = require('expect');
|
|
191
|
+
} catch (_) {
|
|
192
|
+
// for Jest in version 28+
|
|
193
|
+
const {
|
|
194
|
+
expect: expectModule
|
|
195
|
+
} = require('@jest/globals');
|
|
196
|
+
|
|
197
|
+
expect = expectModule;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
require('setimmediate');
|
|
201
|
+
|
|
202
|
+
frameTime = Math.round(1000 / config.fps);
|
|
203
|
+
config = { ...config,
|
|
204
|
+
...userConfig
|
|
205
|
+
};
|
|
206
|
+
expect.extend({
|
|
207
|
+
toHaveAnimatedStyle(received, expectedStyle) {
|
|
208
|
+
let config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
209
|
+
return compareStyle(received, expectedStyle, config);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
export const getAnimatedStyle = received => {
|
|
215
|
+
return getCurrentStyle(received);
|
|
216
|
+
};
|
|
217
|
+
//# sourceMappingURL=jestUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["jestResetJsReanimatedModule","config","fps","isAnimatedStyle","style","animatedStyle","getAnimatedStyleFromObject","current","value","getCurrentStyle","received","styleObject","props","currentStyle","Array","isArray","forEach","checkEqual","expectStyle","length","i","property","findStyleDiff","expect","requireAllMatch","diffs","isEqual","push","Object","keys","undefined","compareStyle","expectedStyle","message","pass","exact","currentStyleStr","JSON","stringify","expectedStyleStr","differences","map","diff","join","frameTime","requestAnimationFrameCopy","currentTimestamp","requestAnimationFrame","callback","setTimeout","beforeTest","global","ReanimatedDataMock","now","jest","useFakeTimers","afterTest","useRealTimers","tickTravel","advanceTimersByTime","withReanimatedTimer","animationTest","advanceAnimationByTime","time","Math","ceil","advanceAnimationByFrame","count","setUpTests","userConfig","require","_","expectModule","round","extend","toHaveAnimatedStyle","getAnimatedStyle"],"sources":["jestUtils.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nimport { jestResetJsReanimatedModule } from './core';\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R> {\n toHaveAnimatedStyle(\n style: Record<string, unknown>[] | Record<string, unknown>\n ): R;\n }\n }\n}\n\nlet config = {\n fps: 60,\n};\n\nconst isAnimatedStyle = (style) => {\n return !!style.animatedStyle;\n};\n\nconst getAnimatedStyleFromObject = (style) => {\n return style.animatedStyle.current.value;\n};\n\nconst getCurrentStyle = (received) => {\n const styleObject = received.props.style;\n let currentStyle = {};\n if (Array.isArray(styleObject)) {\n received.props.style.forEach((style) => {\n if (isAnimatedStyle(style)) {\n currentStyle = {\n ...currentStyle,\n ...getAnimatedStyleFromObject(style),\n };\n } else {\n currentStyle = {\n ...currentStyle,\n ...style,\n };\n }\n });\n } else {\n if (isAnimatedStyle(styleObject)) {\n currentStyle = getAnimatedStyleFromObject(styleObject);\n } else {\n currentStyle = {\n ...styleObject,\n ...received.props.animatedStyle.value,\n };\n }\n }\n return currentStyle;\n};\n\nconst checkEqual = (currentStyle, expectStyle) => {\n if (Array.isArray(expectStyle)) {\n if (expectStyle.length !== currentStyle.length) return false;\n for (let i = 0; i < currentStyle.length; i++) {\n if (!checkEqual(currentStyle[i], expectStyle[i])) {\n return false;\n }\n }\n } else if (typeof currentStyle === 'object' && currentStyle) {\n for (const property in expectStyle) {\n if (!checkEqual(currentStyle[property], expectStyle[property])) {\n return false;\n }\n }\n } else {\n return currentStyle === expectStyle;\n }\n return true;\n};\n\nconst findStyleDiff = (current, expect, requireAllMatch) => {\n const diffs = [];\n let isEqual = true;\n for (const property in expect) {\n if (!checkEqual(current[property], expect[property])) {\n isEqual = false;\n diffs.push({\n property: property,\n current: current[property],\n expect: expect[property],\n });\n }\n }\n\n if (\n requireAllMatch &&\n Object.keys(current).length !== Object.keys(expect).length\n ) {\n isEqual = false;\n for (const property in current) {\n if (expect[property] === undefined) {\n diffs.push({\n property: property,\n current: current[property],\n expect: expect[property],\n });\n }\n }\n }\n\n return { isEqual, diffs };\n};\n\nconst compareStyle = (received, expectedStyle, config) => {\n if (!received.props.style) {\n return { message: () => message, pass: false };\n }\n const { exact } = config;\n const currentStyle = getCurrentStyle(received);\n const { isEqual, diffs } = findStyleDiff(currentStyle, expectedStyle, exact);\n\n if (isEqual) {\n return { message: () => 'ok', pass: true };\n }\n\n const currentStyleStr = JSON.stringify(currentStyle);\n const expectedStyleStr = JSON.stringify(expectedStyle);\n const differences = diffs\n .map(\n (diff) =>\n `- '${diff.property}' should be ${JSON.stringify(\n diff.expect\n )}, but is ${JSON.stringify(diff.current)}`\n )\n .join('\\n');\n\n return {\n message: () =>\n `Expected: ${expectedStyleStr}\\nReceived: ${currentStyleStr}\\n\\nDifferences:\\n${differences}`,\n pass: false,\n };\n};\n\nlet frameTime = 1000 / config.fps;\nlet requestAnimationFrameCopy;\nlet currentTimestamp = 0;\n\nconst requestAnimationFrame = (callback) => {\n setTimeout(callback, frameTime);\n};\n\nconst beforeTest = () => {\n jestResetJsReanimatedModule();\n requestAnimationFrameCopy = global.requestAnimationFrame;\n global.requestAnimationFrame = requestAnimationFrame;\n global.ReanimatedDataMock = {\n now: () => currentTimestamp,\n };\n currentTimestamp = 0;\n jest.useFakeTimers();\n};\n\nconst afterTest = () => {\n jest.useRealTimers();\n global.requestAnimationFrame = requestAnimationFrameCopy;\n};\n\nconst tickTravel = () => {\n currentTimestamp += frameTime;\n jest.advanceTimersByTime(frameTime);\n};\n\nexport const withReanimatedTimer = (animationTest) => {\n beforeTest();\n animationTest();\n afterTest();\n};\n\nexport const advanceAnimationByTime = (time = frameTime) => {\n for (let i = 0; i <= Math.ceil(time / frameTime); i++) {\n tickTravel();\n }\n jest.advanceTimersByTime(frameTime);\n};\n\nexport const advanceAnimationByFrame = (count) => {\n for (let i = 0; i <= count; i++) {\n tickTravel();\n }\n jest.advanceTimersByTime(frameTime);\n};\n\nexport const setUpTests = (userConfig = {}) => {\n let expect;\n try {\n expect = require('expect');\n } catch (_) {\n // for Jest in version 28+\n const { expect: expectModule } = require('@jest/globals');\n expect = expectModule;\n }\n\n require('setimmediate');\n frameTime = Math.round(1000 / config.fps);\n\n config = {\n ...config,\n ...userConfig,\n };\n\n expect.extend({\n toHaveAnimatedStyle(received, expectedStyle, config = {}) {\n return compareStyle(received, expectedStyle, config);\n },\n });\n};\n\nexport const getAnimatedStyle = (received) => {\n return getCurrentStyle(received);\n};\n"],"mappings":"AAAA;AACA;AACA,SAASA,2BAAT,QAA4C,QAA5C;AAaA,IAAIC,MAAM,GAAG;EACXC,GAAG,EAAE;AADM,CAAb;;AAIA,MAAMC,eAAe,GAAIC,KAAD,IAAW;EACjC,OAAO,CAAC,CAACA,KAAK,CAACC,aAAf;AACD,CAFD;;AAIA,MAAMC,0BAA0B,GAAIF,KAAD,IAAW;EAC5C,OAAOA,KAAK,CAACC,aAAN,CAAoBE,OAApB,CAA4BC,KAAnC;AACD,CAFD;;AAIA,MAAMC,eAAe,GAAIC,QAAD,IAAc;EACpC,MAAMC,WAAW,GAAGD,QAAQ,CAACE,KAAT,CAAeR,KAAnC;EACA,IAAIS,YAAY,GAAG,EAAnB;;EACA,IAAIC,KAAK,CAACC,OAAN,CAAcJ,WAAd,CAAJ,EAAgC;IAC9BD,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eAAD,CAAxC;;IACA/C,MAAM,GAAGiD,YAAT;EACD;;EAEDF,OAAO,CAAC,cAAD,CAAP;;EACA1B,SAAS,GAAGoB,IAAI,CAACS,KAAL,CAAW,OAAOxE,MAAM,CAACC,GAAzB,CAAZ;EAEAD,MAAM,GAAG,EACP,GAAGA,MADI;IAEP,GAAGoE;EAFI,CAAT;EAKA9C,MAAM,CAACmD,MAAP,CAAc;IACZC,mBAAmB,CAACjE,QAAD,EAAWsB,aAAX,EAAuC;MAAA,IAAb/B,MAAa,uEAAJ,EAAI;MACxD,OAAO8B,YAAY,CAACrB,QAAD,EAAWsB,aAAX,EAA0B/B,MAA1B,CAAnB;IACD;;EAHW,CAAd;AAKD,CAvBM;AAyBP,OAAO,MAAM2E,gBAAgB,GAAIlE,QAAD,IAAc;EAC5C,OAAOD,eAAe,CAACC,QAAD,CAAtB;AACD,CAFM"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
import MapperRegistry from './MapperRegistry';
|
|
4
|
+
import Mapper from './Mapper';
|
|
5
|
+
import MutableValue from './MutableValue';
|
|
6
|
+
import { NativeReanimated } from '../NativeReanimated/NativeReanimated';
|
|
7
|
+
import { isJest } from '../PlatformChecker';
|
|
8
|
+
export default class JSReanimated extends NativeReanimated {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(false);
|
|
11
|
+
|
|
12
|
+
_defineProperty(this, "_valueSetter", undefined);
|
|
13
|
+
|
|
14
|
+
_defineProperty(this, "_renderRequested", false);
|
|
15
|
+
|
|
16
|
+
_defineProperty(this, "_mapperRegistry", new MapperRegistry(this));
|
|
17
|
+
|
|
18
|
+
_defineProperty(this, "_frames", []);
|
|
19
|
+
|
|
20
|
+
_defineProperty(this, "timeProvider", void 0);
|
|
21
|
+
|
|
22
|
+
if (isJest()) {
|
|
23
|
+
this.timeProvider = {
|
|
24
|
+
now: () => global.ReanimatedDataMock.now()
|
|
25
|
+
};
|
|
26
|
+
} else {
|
|
27
|
+
this.timeProvider = {
|
|
28
|
+
now: () => window.performance.now()
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
pushFrame(frame) {
|
|
34
|
+
this._frames.push(frame);
|
|
35
|
+
|
|
36
|
+
this.maybeRequestRender();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
getTimestamp() {
|
|
40
|
+
return this.timeProvider.now();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
maybeRequestRender() {
|
|
44
|
+
if (!this._renderRequested) {
|
|
45
|
+
this._renderRequested = true;
|
|
46
|
+
requestAnimationFrame(_timestampMs => {
|
|
47
|
+
this._renderRequested = false;
|
|
48
|
+
|
|
49
|
+
this._onRender(this.getTimestamp());
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
_onRender(timestampMs) {
|
|
55
|
+
this._mapperRegistry.execute();
|
|
56
|
+
|
|
57
|
+
const frames = [...this._frames];
|
|
58
|
+
this._frames = [];
|
|
59
|
+
|
|
60
|
+
for (let i = 0, len = frames.length; i < len; ++i) {
|
|
61
|
+
frames[i](timestampMs);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (this._mapperRegistry.needRunOnRender) {
|
|
65
|
+
this._mapperRegistry.execute();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
installCoreFunctions(valueSetter) {
|
|
70
|
+
this._valueSetter = valueSetter;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
makeShareable(value) {
|
|
74
|
+
return value;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
makeMutable(value) {
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
79
|
+
return new MutableValue(value, this._valueSetter);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
makeRemote() {
|
|
83
|
+
let object = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
84
|
+
return object;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
startMapper(mapper) {
|
|
88
|
+
let inputs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
89
|
+
let outputs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
90
|
+
const instance = new Mapper(this, mapper, inputs, outputs);
|
|
91
|
+
|
|
92
|
+
const mapperId = this._mapperRegistry.startMapper(instance);
|
|
93
|
+
|
|
94
|
+
this.maybeRequestRender();
|
|
95
|
+
return mapperId;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
stopMapper(mapperId) {
|
|
99
|
+
this._mapperRegistry.stopMapper(mapperId);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
registerEventHandler(_, __) {
|
|
103
|
+
// noop
|
|
104
|
+
return '';
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
unregisterEventHandler(_) {// noop
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
enableLayoutAnimations() {
|
|
111
|
+
console.warn('[Reanimated] enableLayoutAnimations is not available for WEB yet');
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
registerSensor() {
|
|
115
|
+
console.warn('[Reanimated] useAnimatedSensor is not available on web yet.');
|
|
116
|
+
return -1;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
unregisterSensor() {// noop
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
jestResetModule() {
|
|
123
|
+
if (isJest()) {
|
|
124
|
+
/**
|
|
125
|
+
* If someone used timers to stop animation before the end,
|
|
126
|
+
* then _renderRequested was set as true
|
|
127
|
+
* and any new update from another test wasn't applied.
|
|
128
|
+
*/
|
|
129
|
+
this._renderRequested = false;
|
|
130
|
+
} else {
|
|
131
|
+
throw Error('This method can be only use in Jest testing.');
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
subscribeForKeyboardEvents(_) {
|
|
136
|
+
console.warn('[Reanimated] useAnimatedKeyboard is not available on web yet.');
|
|
137
|
+
return -1;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
unsubscribeFromKeyboardEvents(_) {// noop
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=JSReanimated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MapperRegistry","Mapper","MutableValue","NativeReanimated","isJest","JSReanimated","constructor","undefined","timeProvider","now","global","ReanimatedDataMock","window","performance","pushFrame","frame","_frames","push","maybeRequestRender","getTimestamp","_renderRequested","requestAnimationFrame","_timestampMs","_onRender","timestampMs","_mapperRegistry","execute","frames","i","len","length","needRunOnRender","installCoreFunctions","valueSetter","_valueSetter","makeShareable","value","makeMutable","makeRemote","object","startMapper","mapper","inputs","outputs","instance","mapperId","stopMapper","registerEventHandler","_","__","unregisterEventHandler","enableLayoutAnimations","console","warn","registerSensor","unregisterSensor","jestResetModule","Error","subscribeForKeyboardEvents","unsubscribeFromKeyboardEvents"],"sources":["JSReanimated.ts"],"sourcesContent":["import MapperRegistry from './MapperRegistry';\nimport Mapper from './Mapper';\nimport MutableValue from './MutableValue';\nimport { NativeReanimated } from '../NativeReanimated/NativeReanimated';\nimport {\n Timestamp,\n NestedObjectValues,\n AnimatedKeyboardInfo,\n} from '../commonTypes';\nimport { isJest } from '../PlatformChecker';\n\nexport default class JSReanimated extends NativeReanimated {\n _valueSetter?: <T>(value: T) => void = undefined;\n\n _renderRequested = false;\n _mapperRegistry: MapperRegistry<any> = new MapperRegistry(this);\n _frames: ((timestamp: Timestamp) => void)[] = [];\n timeProvider: { now: () => number };\n\n constructor() {\n super(false);\n if (isJest()) {\n this.timeProvider = { now: () => global.ReanimatedDataMock.now() };\n } else {\n this.timeProvider = { now: () => window.performance.now() };\n }\n }\n\n pushFrame(frame: (timestamp: Timestamp) => void): void {\n this._frames.push(frame);\n this.maybeRequestRender();\n }\n\n getTimestamp(): number {\n return this.timeProvider.now();\n }\n\n maybeRequestRender(): void {\n if (!this._renderRequested) {\n this._renderRequested = true;\n\n requestAnimationFrame((_timestampMs) => {\n this._renderRequested = false;\n\n this._onRender(this.getTimestamp());\n });\n }\n }\n\n _onRender(timestampMs: number): void {\n this._mapperRegistry.execute();\n\n const frames = [...this._frames];\n this._frames = [];\n\n for (let i = 0, len = frames.length; i < len; ++i) {\n frames[i](timestampMs);\n }\n\n if (this._mapperRegistry.needRunOnRender) {\n this._mapperRegistry.execute();\n }\n }\n\n installCoreFunctions(valueSetter: <T>(value: T) => void): void {\n this._valueSetter = valueSetter;\n }\n\n makeShareable<T>(value: T): T {\n return value;\n }\n\n makeMutable<T>(value: T): MutableValue<T> {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return new MutableValue(value, this._valueSetter!);\n }\n\n makeRemote<T>(object = {}): T {\n return object as T;\n }\n\n startMapper(\n mapper: () => void,\n inputs: NestedObjectValues<MutableValue<unknown>>[] = [],\n outputs: NestedObjectValues<MutableValue<unknown>>[] = []\n ): number {\n const instance = new Mapper(this, mapper, inputs, outputs);\n const mapperId = this._mapperRegistry.startMapper(instance);\n this.maybeRequestRender();\n return mapperId;\n }\n\n stopMapper(mapperId: number): void {\n this._mapperRegistry.stopMapper(mapperId);\n }\n\n registerEventHandler<T>(_: string, __: (event: T) => void): string {\n // noop\n return '';\n }\n\n unregisterEventHandler(_: string): void {\n // noop\n }\n\n enableLayoutAnimations() {\n console.warn(\n '[Reanimated] enableLayoutAnimations is not available for WEB yet'\n );\n }\n\n registerSensor(): number {\n console.warn('[Reanimated] useAnimatedSensor is not available on web yet.');\n return -1;\n }\n\n unregisterSensor(): void {\n // noop\n }\n\n jestResetModule() {\n if (isJest()) {\n /**\n * If someone used timers to stop animation before the end,\n * then _renderRequested was set as true\n * and any new update from another test wasn't applied.\n */\n this._renderRequested = false;\n } else {\n throw Error('This method can be only use in Jest testing.');\n }\n }\n\n subscribeForKeyboardEvents(_: AnimatedKeyboardInfo): number {\n console.warn(\n '[Reanimated] useAnimatedKeyboard is not available on web yet.'\n );\n return -1;\n }\n\n unsubscribeFromKeyboardEvents(_: number): void {\n // noop\n }\n}\n"],"mappings":";;AAAA,OAAOA,cAAP,MAA2B,kBAA3B;AACA,OAAOC,MAAP,MAAmB,UAAnB;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AACA,SAASC,gBAAT,QAAiC,sCAAjC;AAMA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,eAAe,MAAMC,YAAN,SAA2BF,gBAA3B,CAA4C;EAQzDG,WAAW,GAAG;IACZ,MAAM,KAAN;;IADY,sCAPyBC,SAOzB;;IAAA,0CALK,KAKL;;IAAA,yCAJyB,IAAIP,cAAJ,CAAmB,IAAnB,CAIzB;;IAAA,iCAHgC,EAGhC;;IAAA;;IAEZ,IAAII,MAAM,EAAV,EAAc;MACZ,KAAKI,YAAL,GAAoB;QAAEC,GAAG,EAAE,MAAMC,MAAM,CAACC,kBAAP,CAA0BF,GAA1B;MAAb,CAApB;IACD,CAFD,MAEO;MACL,KAAKD,YAAL,GAAoB;QAAEC,GAAG,EAAE,MAAMG,MAAM,CAACC,WAAP,CAAmBJ,GAAnB;MAAb,CAApB;IACD;EACF;;EAEDK,SAAS,CAACC,KAAD,EAA8C;IACrD,KAAKC,OAAL,CAAaC,IAAb,CAAkBF,KAAlB;;IACA,KAAKG,kBAAL;EACD;;EAEDC,YAAY,GAAW;IACrB,OAAO,KAAKX,YAAL,CAAkBC,GAAlB,EAAP;EACD;;EAEDS,kBAAkB,GAAS;IACzB,IAAI,CAAC,KAAKE,gBAAV,EAA4B;MAC1B,KAAKA,gBAAL,GAAwB,IAAxB;MAEAC,qBAAqB,CAAEC,YAAD,IAAkB;QACtC,KAAKF,gBAAL,GAAwB,KAAxB;;QAEA,KAAKG,SAAL,CAAe,KAAKJ,YAAL,EA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AAoB,CAAIC,CAAJ,EAAeC,EAAf,EAA+C;IACjE;IACA,OAAO,EAAP;EACD;;EAEDC,sBAAsB,CAACF,CAAD,EAAkB,CACtC;EACD;;EAEDG,sBAAsB,GAAG;IACvBC,OAAO,CAACC,IAAR,CACE,kEADF;EAGD;;EAEDC,cAAc,GAAW;IACvBF,OAAO,CAACC,IAAR,CAAa,6DAAb;IACA,OAAO,CAAC,CAAR;EACD;;EAEDE,gBAAgB,GAAS,CACvB;EACD;;EAEDC,eAAe,GAAG;IAChB,IAAIpD,MAAM,EAAV,EAAc;MACZ;AACN;AACA;AACA;AACA;MACM,KAAKgB,gBAAL,GAAwB,KAAxB;IACD,CAPD,MAOO;MACL,MAAMqC,KAAK,CAAC,8CAAD,CAAX;IACD;EACF;;EAEDC,0BAA0B,CAACV,CAAD,EAAkC;IAC1DI,OAAO,CAACC,IAAR,CACE,+DADF;IAGA,OAAO,CAAC,CAAR;EACD;;EAEDM,6BAA6B,CAACX,CAAD,EAAkB,CAC7C;EACD;;AAnIwD"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
import MutableValue from './MutableValue';
|
|
4
|
+
export default class Mapper {
|
|
5
|
+
constructor(module, mapper) {
|
|
6
|
+
let inputs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
7
|
+
let outputs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
8
|
+
|
|
9
|
+
_defineProperty(this, "id", void 0);
|
|
10
|
+
|
|
11
|
+
_defineProperty(this, "inputs", void 0);
|
|
12
|
+
|
|
13
|
+
_defineProperty(this, "outputs", void 0);
|
|
14
|
+
|
|
15
|
+
_defineProperty(this, "mapper", void 0);
|
|
16
|
+
|
|
17
|
+
_defineProperty(this, "dirty", true);
|
|
18
|
+
|
|
19
|
+
this.id = Mapper.MAPPER_ID++;
|
|
20
|
+
this.inputs = this.extractMutablesFromArray(inputs);
|
|
21
|
+
this.outputs = this.extractMutablesFromArray(outputs);
|
|
22
|
+
this.mapper = mapper;
|
|
23
|
+
|
|
24
|
+
const markDirty = () => {
|
|
25
|
+
this.dirty = true;
|
|
26
|
+
module.maybeRequestRender();
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
this.inputs.forEach(input => {
|
|
30
|
+
input.addListener(markDirty);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
execute() {
|
|
35
|
+
this.dirty = false;
|
|
36
|
+
this.mapper();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
extractMutablesFromArray(array) {
|
|
40
|
+
const res = [];
|
|
41
|
+
|
|
42
|
+
function extractMutables(value) {
|
|
43
|
+
if (value == null) {// return;
|
|
44
|
+
} else if (value instanceof MutableValue) {
|
|
45
|
+
res.push(value);
|
|
46
|
+
} else if (Array.isArray(value)) {
|
|
47
|
+
value.forEach(v => extractMutables(v));
|
|
48
|
+
} else if (typeof value === 'object') {
|
|
49
|
+
Object.keys(value).forEach(key => {
|
|
50
|
+
extractMutables(value[key]);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
extractMutables(array);
|
|
56
|
+
return res;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
_defineProperty(Mapper, "MAPPER_ID", 1);
|
|
62
|
+
//# sourceMappingURL=Mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MutableValue","Mapper","constructor","module","mapper","inputs","outputs","id","MAPPER_ID","extractMutablesFromArray","markDirty","dirty","maybeRequestRender","forEach","input","addListener","execute","array","res","extractMutables","value","push","Array","isArray","v","Object","keys","key"],"sources":["Mapper.ts"],"sourcesContent":["import { NestedObjectValues } from '../commonTypes';\nimport { JSReanimated } from './commonTypes';\nimport MutableValue from './MutableValue';\n\nexport default class Mapper<T> {\n static MAPPER_ID = 1;\n id: number;\n inputs: MutableValue<T>[];\n outputs: MutableValue<T>[];\n mapper: () => void;\n\n dirty = true;\n\n constructor(\n module: JSReanimated,\n mapper: () => void,\n inputs: NestedObjectValues<MutableValue<T>>[] = [],\n outputs: NestedObjectValues<MutableValue<T>>[] = []\n ) {\n this.id = Mapper.MAPPER_ID++;\n this.inputs = this.extractMutablesFromArray(inputs);\n this.outputs = this.extractMutablesFromArray(outputs);\n this.mapper = mapper;\n\n const markDirty = () => {\n this.dirty = true;\n module.maybeRequestRender();\n };\n\n this.inputs.forEach((input) => {\n input.addListener(markDirty);\n });\n }\n\n execute(): void {\n this.dirty = false;\n this.mapper();\n }\n\n extractMutablesFromArray<T>(\n array: NestedObjectValues<MutableValue<T>>\n ): MutableValue<T>[] {\n const res: MutableValue<T>[] = [];\n\n function extractMutables(value: NestedObjectValues<MutableValue<T>>) {\n if (value == null) {\n // return;\n } else if (value instanceof MutableValue) {\n res.push(value);\n } else if (Array.isArray(value)) {\n value.forEach((v) => extractMutables(v));\n } else if (typeof value === 'object') {\n Object.keys(value).forEach((key) => {\n extractMutables(value[key]);\n });\n }\n }\n\n extractMutables(array);\n return res;\n }\n}\n"],"mappings":";;AAEA,OAAOA,YAAP,MAAyB,gBAAzB;AAEA,eAAe,MAAMC,MAAN,CAAgB;EAS7BC,WAAW,CACTC,MADS,EAETC,MAFS,EAKT;IAAA,IAFAC,MAEA,uEAFgD,EAEhD;IAAA,IADAC,OACA,uEADiD,EACjD;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA,+BAPM,IAON;;IACA,KAAKC,EAAL,GAAUN,MAAM,CAACO,SAAP,EAAV;IACA,KAAKH,MAAL,GAAc,KAAKI,wBAAL,CAA8BJ,MAA9B,CAAd;IACA,KAAKC,OAAL,GAAe,KAAKG,wBAAL,CAA8BH,OAA9B,CAAf;IACA,KAAKF,MAAL,GAAcA,MAAd;;IAEA,MAAMM,SAAS,GAAG,MAAM;MACtB,KAAKC,KAAL,GAAa,IAAb;MACAR,MAAM,CAACS,kBAAP;IACD,CAHD;;IAKA,KAAKP,MAAL,CAAYQ,OAAZ,CAAqBC,KAAD,IAAW;MAC7BA,KAAK,CAACC,WAAN,CAAkBL,SAAlB;IACD,CAFD;EAGD;;EAEDM,OAAO,GAAS;IACd,KAAKL,KAAL,GAAa,KAAb;IACA,KAAKP,MAAL;EACD;;EAEDK,wBAAwB,CACtBQ,KADsB,EAEH;IACnB,MAAMC,GAAsB,GAAG,EAA/B;;IAEA,SAASC,eAAT,CAAyBC,KAAzB,EAAqE;MACnE,IAAIA,KAAK,IAAI,IAAb,EAAmB,CACjB;MACD,CAFD,MAEO,IAAIA,KAAK,YAAYpB,YAArB,EAAmC;QACxCkB,GAAG,CAACG,IAAJ,CAASD,KAAT;MACD,CAFM,MAEA,IAAIE,KAAK,CAACC,OAAN,CAAcH,KAAd,CAAJ,EAA0B;QAC/BA,KAAK,CAACP,OAAN,CAAeW,CAAD,IAAOL,eAAe,CAACK,CAAD,CAApC;MACD,CAFM,MAEA,IAAI,OAAOJ,KAAP,KAAiB,QAArB,EAA+B;QACpCK,MAAM,CAACC,IAAP,CAAYN,KAAZ,EAAmBP,OAAnB,CAA4Bc,GAAD,IAAS;UAClCR,eAAe,CAACC,KAAK,CAACO,GAAD,CAAN,CAAf;QACD,CAFD;MAGD;IACF;;IAEDR,eAAe,CAACF,KAAD,CAAf;IACA,OAAOC,GAAP;EACD;;AAxD4B;;gBAAVjB,M,eACA,C"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
export default class MapperRegistry {
|
|
4
|
+
constructor(module) {
|
|
5
|
+
_defineProperty(this, "sortedMappers", []);
|
|
6
|
+
|
|
7
|
+
_defineProperty(this, "mappers", new Map());
|
|
8
|
+
|
|
9
|
+
_defineProperty(this, "_module", void 0);
|
|
10
|
+
|
|
11
|
+
_defineProperty(this, "updatedSinceLastExecute", false);
|
|
12
|
+
|
|
13
|
+
this._module = module;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
startMapper(mapper) {
|
|
17
|
+
this.mappers.set(mapper.id, mapper);
|
|
18
|
+
this.updatedSinceLastExecute = true;
|
|
19
|
+
return mapper.id;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
stopMapper(id) {
|
|
23
|
+
this.mappers.delete(id);
|
|
24
|
+
this.updatedSinceLastExecute = true;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
execute() {
|
|
28
|
+
if (this.updatedSinceLastExecute) {
|
|
29
|
+
this.updateOrder();
|
|
30
|
+
this.updatedSinceLastExecute = false;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
for (let i = 0, len = this.sortedMappers.length; i < len; ++i) {
|
|
34
|
+
const mapper = this.sortedMappers[i];
|
|
35
|
+
|
|
36
|
+
if (mapper.dirty) {
|
|
37
|
+
mapper.execute();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
updateOrder() {
|
|
43
|
+
const nodes = [...this.mappers.values()].map(mapper => new Node(mapper));
|
|
44
|
+
const mappersById = {};
|
|
45
|
+
this.mappers.forEach(mapper => {
|
|
46
|
+
mappersById[mapper.id] = mapper;
|
|
47
|
+
}); // create a graph from array of nodes
|
|
48
|
+
|
|
49
|
+
for (let i = 0, nodesLen = nodes.length; i < nodesLen; ++i) {
|
|
50
|
+
const node = nodes[i];
|
|
51
|
+
|
|
52
|
+
if (node.mapper.outputs.length === 0) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
for (let j = 0; j < nodesLen; ++j) {
|
|
57
|
+
const restNode = nodes[j];
|
|
58
|
+
|
|
59
|
+
if (i === j || restNode.mapper.inputs.length === 0) {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
for (let outi = 0, outputsLen = node.mapper.outputs.length; outi < outputsLen; ++outi) {
|
|
64
|
+
for (let resti = 0, restLen = restNode.mapper.inputs.length; resti < restLen; ++resti) {
|
|
65
|
+
if (node.mapper.outputs[outi]._id === restNode.mapper.inputs[resti]._id) {
|
|
66
|
+
node.children.push(restNode);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const post = {};
|
|
74
|
+
let postCounter = 1;
|
|
75
|
+
|
|
76
|
+
const dfs = node => {
|
|
77
|
+
const index = nodes.indexOf(node);
|
|
78
|
+
|
|
79
|
+
if (index === -1) {
|
|
80
|
+
// this node has already been handled
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
++postCounter;
|
|
85
|
+
nodes.splice(index, 1);
|
|
86
|
+
|
|
87
|
+
if (node.children.length === 0 && nodes.length > 0) {
|
|
88
|
+
post[node.mapper.id] = postCounter++;
|
|
89
|
+
dfs(nodes[0]);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
for (let i = 0, len = node.children.length; i < len; ++i) {
|
|
94
|
+
dfs(node.children[i]);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
post[node.mapper.id] = postCounter++;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
while (nodes.length) dfs(nodes[0]);
|
|
101
|
+
|
|
102
|
+
const postArray = Object.keys(post).map(key => {
|
|
103
|
+
const num = parseInt(key);
|
|
104
|
+
return [num, post[num]];
|
|
105
|
+
});
|
|
106
|
+
postArray.sort((a, b) => {
|
|
107
|
+
return b[1] - a[1];
|
|
108
|
+
}); // clear sorted mappers
|
|
109
|
+
|
|
110
|
+
this.sortedMappers = [];
|
|
111
|
+
|
|
112
|
+
for (let i = 0, len = postArray.length; i < len; ++i) {
|
|
113
|
+
const [id] = postArray[i];
|
|
114
|
+
this.sortedMappers.push(mappersById[id]);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
get needRunOnRender() {
|
|
119
|
+
return this.updatedSinceLastExecute;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
class Node {
|
|
125
|
+
constructor(mapper) {
|
|
126
|
+
let children = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
127
|
+
|
|
128
|
+
_defineProperty(this, "mapper", void 0);
|
|
129
|
+
|
|
130
|
+
_defineProperty(this, "children", void 0);
|
|
131
|
+
|
|
132
|
+
this.mapper = mapper;
|
|
133
|
+
this.children = children;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=MapperRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MapperRegistry","constructor","module","Map","_module","startMapper","mapper","mappers","set","id","updatedSinceLastExecute","stopMapper","delete","execute","updateOrder","i","len","sortedMappers","length","dirty","nodes","values","map","Node","mappersById","forEach","nodesLen","node","outputs","j","restNode","inputs","outi","outputsLen","resti","restLen","_id","children","push","post","postCounter","dfs","index","indexOf","splice","postArray","Object","keys","key","num","parseInt","sort","a","b","needRunOnRender"],"sources":["MapperRegistry.ts"],"sourcesContent":["import { JSReanimated } from './commonTypes';\nimport Mapper from './Mapper';\n\nexport default class MapperRegistry<T> {\n sortedMappers: Mapper<T>[] = [];\n mappers: Map<number, Mapper<T>> = new Map();\n _module: JSReanimated;\n\n updatedSinceLastExecute = false;\n\n constructor(module: JSReanimated) {\n this._module = module;\n }\n\n startMapper(mapper: Mapper<T>): number {\n this.mappers.set(mapper.id, mapper);\n this.updatedSinceLastExecute = true;\n return mapper.id;\n }\n\n stopMapper(id: number): void {\n this.mappers.delete(id);\n this.updatedSinceLastExecute = true;\n }\n\n execute(): void {\n if (this.updatedSinceLastExecute) {\n this.updateOrder();\n this.updatedSinceLastExecute = false;\n }\n\n for (let i = 0, len = this.sortedMappers.length; i < len; ++i) {\n const mapper = this.sortedMappers[i];\n if (mapper.dirty) {\n mapper.execute();\n }\n }\n }\n\n updateOrder(): void {\n const nodes = [...this.mappers.values()].map((mapper) => new Node(mapper));\n\n const mappersById: Record<number, Mapper<T>> = {};\n this.mappers.forEach((mapper) => {\n mappersById[mapper.id] = mapper;\n });\n\n // create a graph from array of nodes\n for (let i = 0, nodesLen = nodes.length; i < nodesLen; ++i) {\n const node = nodes[i];\n if (node.mapper.outputs.length === 0) {\n continue;\n }\n for (let j = 0; j < nodesLen; ++j) {\n const restNode = nodes[j];\n if (i === j || restNode.mapper.inputs.length === 0) {\n continue;\n }\n for (\n let outi = 0, outputsLen = node.mapper.outputs.length;\n outi < outputsLen;\n ++outi\n ) {\n for (\n let resti = 0, restLen = restNode.mapper.inputs.length;\n resti < restLen;\n ++resti\n ) {\n if (\n node.mapper.outputs[outi]._id ===\n restNode.mapper.inputs[resti]._id\n ) {\n node.children.push(restNode);\n }\n }\n }\n }\n }\n\n const post: Record<number, number> = {};\n let postCounter = 1;\n const dfs = (node: Node<T>) => {\n const index = nodes.indexOf(node);\n if (index === -1) {\n // this node has already been handled\n return;\n }\n ++postCounter;\n nodes.splice(index, 1);\n if (node.children.length === 0 && nodes.length > 0) {\n post[node.mapper.id] = postCounter++;\n dfs(nodes[0]);\n return;\n }\n for (let i = 0, len = node.children.length; i < len; ++i) {\n dfs(node.children[i]);\n }\n post[node.mapper.id] = postCounter++;\n };\n\n while (nodes.length) dfs(nodes[0]);\n\n const postArray = Object.keys(post).map((key) => {\n const num = parseInt(key);\n return [num, post[num]];\n });\n postArray.sort((a, b) => {\n return b[1] - a[1];\n });\n\n // clear sorted mappers\n this.sortedMappers = [];\n\n for (let i = 0, len = postArray.length; i < len; ++i) {\n const [id] = postArray[i];\n this.sortedMappers.push(mappersById[id]);\n }\n }\n\n get needRunOnRender(): boolean {\n return this.updatedSinceLastExecute;\n }\n}\n\nclass Node<T> {\n mapper: Mapper<T>;\n children: Node<T>[];\n\n constructor(mapper: Mapper<T>, children = []) {\n this.mapper = mapper;\n this.children = children;\n }\n}\n"],"mappings":";;AAGA,eAAe,MAAMA,cAAN,CAAwB;EAOrCC,WAAW,CAACC,MAAD,EAAuB;IAAA,uCANL,EAMK;;IAAA,iCALA,IAAIC,GAAJ,EAKA;;IAAA;;IAAA,iDAFR,KAEQ;;IAChC,KAAKC,OAAL,GAAeF,MAAf;EACD;;EAEDG,WAAW,CAACC,MAAD,EAA4B;IACrC,KAAKC,OAAL,CAAaC,GAAb,CAAiBF,MAAM,CAACG,EAAxB,EAA4BH,MAA5B;IACA,KAAKI,uBAAL,GAA+B,IAA/B;IACA,OAAOJ,MAAM,CAACG,EAAd;EACD;;EAEDE,UAAU,CAACF,EAAD,EAAmB;IAC3B,KAAKF,OAAL,CAAaK,MAAb,CAAoBH,EAApB;IACA,KAAKC,uBAAL,GAA+B,IAA/B;EACD;;EAEDG,OAAO,GAAS;IACd,IAAI,KAAKH,uBAAT,EAAkC;MAChC,KAAKI,WAAL;MACA,KAAKJ,uBAAL,GAA+B,KAA/B;IACD;;IAED,KAAK,IAAIK,CAAC,GAAG,CAAR,EAAWC,GAAG,GAAG,KAAKC,aAAL,CAAmBC,MAAzC,EAAiDH,CAAC,GAAGC,GAArD,EAA0D,EAAED,CAA5D,EAA+D;MAC7D,MAAMT,MAAM,GAAG,KAAKW,aAAL,CAAmBF,CAAnB,CAAf;;MACA,IAAIT,MAAM,CAACa,KAAX,EAAkB;QAChBb,MAAM,CAACO,OAAP;MACD;IACF;EACF;;EAEDC,WAAW,GAAS;IAClB,MAAMM,KAAK,GAAG,CAAC,GAAG,KAAKb,OAAL,CAAac,MAAb,EAAJ,EAA2BC,GAA3B,CAAgChB,MAAD,IAAY,IAAIiB,IAAJ,CAASjB,MAAT,CAA3C,CAAd;IAEA,MAAMkB,WAAsC,GAAG,EAA/C;IACA,KAAKjB,O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CAAJ,KAAU;MACvB,OAAOA,CAAC,CAAC,CAAD,CAAD,GAAOD,CAAC,CAAC,CAAD,CAAf;IACD,CAFD,EAnEkB,CAuElB;;IACA,KAAKnC,aAAL,GAAqB,EAArB;;IAEA,KAAK,IAAIF,CAAC,GAAG,CAAR,EAAWC,GAAG,GAAG6B,SAAS,CAAC3B,MAAhC,EAAwCH,CAAC,GAAGC,GAA5C,EAAiD,EAAED,CAAnD,EAAsD;MACpD,MAAM,CAACN,EAAD,IAAOoC,SAAS,CAAC9B,CAAD,CAAtB;MACA,KAAKE,aAAL,CAAmBqB,IAAnB,CAAwBd,WAAW,CAACf,EAAD,CAAnC;IACD;EACF;;EAEkB,IAAf6C,eAAe,GAAY;IAC7B,OAAO,KAAK5C,uBAAZ;EACD;;AAtHoC;;AAyHvC,MAAMa,IAAN,CAAc;EAIZtB,WAAW,CAACK,MAAD,EAAmC;IAAA,IAAf+B,QAAe,uEAAJ,EAAI;;IAAA;;IAAA;;IAC5C,KAAK/B,MAAL,GAAcA,MAAd;IACA,KAAK+B,QAAL,GAAgBA,QAAhB;EACD;;AAPW"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
export default class MutableValue {
|
|
4
|
+
constructor(value, setter) {
|
|
5
|
+
_defineProperty(this, "_id", void 0);
|
|
6
|
+
|
|
7
|
+
_defineProperty(this, "_value", void 0);
|
|
8
|
+
|
|
9
|
+
_defineProperty(this, "_setter", void 0);
|
|
10
|
+
|
|
11
|
+
_defineProperty(this, "_animation", null);
|
|
12
|
+
|
|
13
|
+
_defineProperty(this, "_listeners", []);
|
|
14
|
+
|
|
15
|
+
this._id = MutableValue.MUTABLE_ID++;
|
|
16
|
+
this._value = value;
|
|
17
|
+
this._setter = setter;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get value() {
|
|
21
|
+
return this._value;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
set value(nextValue) {
|
|
25
|
+
this._setter(nextValue);
|
|
26
|
+
} // this changes the value finally and is supposed to be called from this._setter
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
_setValue(newValue) {
|
|
30
|
+
this._value = newValue;
|
|
31
|
+
|
|
32
|
+
this._triggerListener();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
addListener(listener) {
|
|
36
|
+
this._listeners.push(listener);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
_triggerListener() {
|
|
40
|
+
for (let i = 0, len = this._listeners.length; i < len; ++i) {
|
|
41
|
+
this._listeners[i]();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
_defineProperty(MutableValue, "MUTABLE_ID", 1);
|
|
48
|
+
//# sourceMappingURL=MutableValue.js.map
|