react-native-reanimated 3.0.2 → 3.1.0
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/Fabric/FabricUtils.h +1 -1
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +38 -27
- package/Common/cpp/SharedItems/Shareables.h +22 -0
- package/Common/cpp/Tools/PlatformDepMethodsHolder.h +2 -0
- package/Common/cpp/Tools/RuntimeDecorator.cpp +4 -1
- package/Common/cpp/Tools/RuntimeDecorator.h +2 -1
- package/Common/cpp/Tools/SingleInstanceChecker.h +14 -2
- package/RNReanimated.podspec +5 -2
- package/android/CMakeLists.txt +4 -0
- package/android/build.gradle +18 -10
- package/android/src/main/cpp/NativeProxy.cpp +316 -337
- package/android/src/main/cpp/NativeProxy.h +53 -11
- package/android/src/main/java/com/swmansion/reanimated/NativeMethodsHelper.java +7 -12
- package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +11 -8
- package/android/src/main/java/com/swmansion/reanimated/nativeProxy/NativeProxyCommon.java +21 -14
- package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +0 -3
- package/ios/Fabric/REAInitializerRCTFabricSurface.mm +1 -0
- package/ios/REANodesManager.h +1 -0
- package/ios/REANodesManager.mm +30 -4
- package/ios/keyboardObserver/REAKeyboardEventObserver.m +51 -130
- package/ios/native/NativeMethods.mm +1 -1
- package/ios/native/NativeProxy.mm +4 -1
- package/ios/native/REAIOSErrorHandler.mm +1 -1
- package/ios/native/REAIOSLogger.mm +1 -1
- package/ios/native/REAIOSScheduler.mm +1 -1
- package/ios/native/REAInitializer.mm +1 -1
- package/ios/native/REAMessageThread.mm +2 -2
- package/lib/commonjs/Animated.js +0 -8
- package/lib/commonjs/Animated.js.map +1 -1
- package/lib/commonjs/ConfigHelper.js +8 -19
- package/lib/commonjs/ConfigHelper.js.map +1 -1
- package/lib/commonjs/createAnimatedComponent.js +20 -158
- package/lib/commonjs/createAnimatedComponent.js.map +1 -1
- package/lib/commonjs/index.js +0 -9
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +0 -7
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/reanimated2/Bezier.js +14 -34
- package/lib/commonjs/reanimated2/Bezier.js.map +1 -1
- package/lib/commonjs/reanimated2/Colors.js +60 -132
- package/lib/commonjs/reanimated2/Colors.js.map +1 -1
- package/lib/commonjs/reanimated2/Easing.js +81 -34
- package/lib/commonjs/reanimated2/Easing.js.map +1 -1
- package/lib/commonjs/reanimated2/NativeMethods.js +8 -20
- package/lib/commonjs/reanimated2/NativeMethods.js.map +1 -1
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +5 -31
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/NativeReanimated/index.js +0 -7
- package/lib/commonjs/reanimated2/NativeReanimated/index.js.map +1 -1
- package/lib/commonjs/reanimated2/PlatformChecker.js +0 -6
- package/lib/commonjs/reanimated2/PlatformChecker.js.map +1 -1
- package/lib/commonjs/reanimated2/PropAdapters.js +10 -12
- package/lib/commonjs/reanimated2/PropAdapters.js.map +1 -1
- package/lib/commonjs/reanimated2/UpdateProps.js +3 -12
- package/lib/commonjs/reanimated2/UpdateProps.js.map +1 -1
- package/lib/commonjs/reanimated2/ViewDescriptorsSet.js +0 -10
- package/lib/commonjs/reanimated2/ViewDescriptorsSet.js.map +1 -1
- package/lib/commonjs/reanimated2/WorkletEventHandler.js +5 -22
- package/lib/commonjs/reanimated2/WorkletEventHandler.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/decay.js +7 -18
- package/lib/commonjs/reanimated2/animation/decay.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/delay.js +0 -11
- package/lib/commonjs/reanimated2/animation/delay.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/index.js +0 -8
- package/lib/commonjs/reanimated2/animation/index.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/repeat.js +6 -22
- package/lib/commonjs/reanimated2/animation/repeat.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/sequence.js +3 -20
- package/lib/commonjs/reanimated2/animation/sequence.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/spring.js +11 -23
- package/lib/commonjs/reanimated2/animation/spring.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/styleAnimation.js +3 -35
- package/lib/commonjs/reanimated2/animation/styleAnimation.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/timing.js +0 -11
- package/lib/commonjs/reanimated2/animation/timing.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/util.js +11 -41
- package/lib/commonjs/reanimated2/animation/util.js.map +1 -1
- package/lib/commonjs/reanimated2/commonTypes.js +16 -23
- package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/component/FlatList.js +0 -16
- package/lib/commonjs/reanimated2/component/FlatList.js.map +1 -1
- package/lib/commonjs/reanimated2/component/Image.js +0 -4
- package/lib/commonjs/reanimated2/component/Image.js.map +1 -1
- package/lib/commonjs/reanimated2/component/ScrollView.js +0 -4
- package/lib/commonjs/reanimated2/component/ScrollView.js.map +1 -1
- package/lib/commonjs/reanimated2/component/Text.js +0 -4
- package/lib/commonjs/reanimated2/component/Text.js.map +1 -1
- package/lib/commonjs/reanimated2/component/View.js +0 -4
- package/lib/commonjs/reanimated2/component/View.js.map +1 -1
- package/lib/commonjs/reanimated2/core.js +6 -48
- package/lib/commonjs/reanimated2/core.js.map +1 -1
- package/lib/commonjs/reanimated2/errors.js +3 -14
- package/lib/commonjs/reanimated2/errors.js.map +1 -1
- package/lib/commonjs/reanimated2/fabricUtils.js +3 -5
- package/lib/commonjs/reanimated2/fabricUtils.js.map +1 -1
- package/lib/commonjs/reanimated2/fabricUtils.web.js +1 -3
- package/lib/commonjs/reanimated2/fabricUtils.web.js.map +1 -1
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js +3 -12
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js +13 -17
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
- package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/Hooks.js +0 -5
- package/lib/commonjs/reanimated2/hook/Hooks.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/index.js +0 -12
- package/lib/commonjs/reanimated2/hook/index.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedGestureHandler.js +4 -17
- package/lib/commonjs/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +2 -9
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js +1 -11
- package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +0 -12
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedScrollHandler.js +2 -9
- package/lib/commonjs/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +8 -23
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +13 -71
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useDerivedValue.js +4 -13
- package/lib/commonjs/reanimated2/hook/useDerivedValue.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useFrameCallback.js +0 -5
- package/lib/commonjs/reanimated2/hook/useFrameCallback.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js +0 -7
- package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useSharedValue.js +2 -7
- package/lib/commonjs/reanimated2/hook/useSharedValue.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/utils.js +8 -39
- package/lib/commonjs/reanimated2/hook/utils.js.map +1 -1
- package/lib/commonjs/reanimated2/index.js +0 -26
- package/lib/commonjs/reanimated2/index.js.map +1 -1
- package/lib/commonjs/reanimated2/initializers.js +21 -43
- package/lib/commonjs/reanimated2/initializers.js.map +1 -1
- package/lib/commonjs/reanimated2/interpolateColor.js +6 -43
- package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -1
- package/lib/commonjs/reanimated2/interpolation.js +14 -29
- package/lib/commonjs/reanimated2/interpolation.js.map +1 -1
- package/lib/commonjs/reanimated2/jestUtils.js +11 -44
- package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +15 -39
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/Mapper.js +9 -28
- package/lib/commonjs/reanimated2/js-reanimated/Mapper.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/MapperRegistry.js +7 -37
- package/lib/commonjs/reanimated2/js-reanimated/MapperRegistry.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/MutableValue.js +5 -18
- package/lib/commonjs/reanimated2/js-reanimated/MutableValue.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/global.js +2 -9
- package/lib/commonjs/reanimated2/js-reanimated/global.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/index.js +3 -14
- package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +7 -26
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +3 -49
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +7 -43
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +4 -5
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js +0 -4
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +4 -23
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +3 -74
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Fade.js +3 -53
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Flip.js +3 -63
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +7 -26
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +3 -13
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js +3 -23
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +3 -43
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js +3 -43
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +3 -23
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +3 -83
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/index.js +0 -20
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +3 -22
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +5 -29
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +3 -9
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +5 -11
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +3 -8
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +3 -12
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/index.js +0 -12
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/index.js +0 -9
- package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js +3 -17
- package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -1
- package/lib/commonjs/reanimated2/mappers.js +26 -32
- package/lib/commonjs/reanimated2/mappers.js.map +1 -1
- package/lib/commonjs/reanimated2/mock.js +5 -15
- package/lib/commonjs/reanimated2/mock.js.map +1 -1
- package/lib/commonjs/reanimated2/mutables.js +2 -28
- package/lib/commonjs/reanimated2/mutables.js.map +1 -1
- package/lib/commonjs/reanimated2/platform-specific/RNRenderer.js +0 -2
- package/lib/commonjs/reanimated2/platform-specific/RNRenderer.js.map +1 -1
- package/lib/commonjs/reanimated2/platform-specific/RNRenderer.web.js.map +1 -1
- package/lib/commonjs/reanimated2/platform-specific/checkCppVersion.js +31 -0
- package/lib/commonjs/reanimated2/platform-specific/checkCppVersion.js.map +1 -0
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js +0 -2
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js.map +1 -1
- package/lib/commonjs/reanimated2/platform-specific/jsVersion.js +14 -0
- package/lib/commonjs/reanimated2/platform-specific/jsVersion.js.map +1 -0
- package/lib/commonjs/reanimated2/pluginUtils.js +0 -1
- package/lib/commonjs/reanimated2/pluginUtils.js.map +1 -1
- package/lib/commonjs/reanimated2/shareables.js +92 -49
- package/lib/commonjs/reanimated2/shareables.js.map +1 -1
- package/lib/commonjs/reanimated2/threads.js +42 -46
- package/lib/commonjs/reanimated2/threads.js.map +1 -1
- package/lib/commonjs/reanimated2/utils.js +0 -5
- package/lib/commonjs/reanimated2/utils.js.map +1 -1
- package/lib/commonjs/reanimated2/valueSetter.js +6 -21
- package/lib/commonjs/reanimated2/valueSetter.js.map +1 -1
- package/lib/commonjs/setAndForwardRef.js +3 -3
- package/lib/commonjs/setAndForwardRef.js.map +1 -1
- package/lib/module/Animated.js.map +1 -1
- package/lib/module/ConfigHelper.js +9 -15
- package/lib/module/ConfigHelper.js.map +1 -1
- package/lib/module/createAnimatedComponent.js +20 -139
- package/lib/module/createAnimatedComponent.js.map +1 -1
- package/lib/module/index.js +0 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/reanimated2/Bezier.js +14 -33
- package/lib/module/reanimated2/Bezier.js.map +1 -1
- package/lib/module/reanimated2/Colors.js +59 -109
- package/lib/module/reanimated2/Colors.js.map +1 -1
- package/lib/module/reanimated2/Easing.js +37 -33
- package/lib/module/reanimated2/Easing.js.map +1 -1
- package/lib/module/reanimated2/NativeMethods.js +8 -15
- package/lib/module/reanimated2/NativeMethods.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +5 -27
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/index.js +0 -2
- package/lib/module/reanimated2/NativeReanimated/index.js.map +1 -1
- package/lib/module/reanimated2/PlatformChecker.js.map +1 -1
- package/lib/module/reanimated2/PropAdapters.js +12 -10
- package/lib/module/reanimated2/PropAdapters.js.map +1 -1
- package/lib/module/reanimated2/UpdateProps.js +3 -5
- package/lib/module/reanimated2/UpdateProps.js.map +1 -1
- package/lib/module/reanimated2/ViewDescriptorsSet.js +0 -6
- package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -1
- package/lib/module/reanimated2/WorkletEventHandler.js +5 -18
- package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -1
- package/lib/module/reanimated2/animation/decay.js +7 -15
- package/lib/module/reanimated2/animation/decay.js.map +1 -1
- package/lib/module/reanimated2/animation/delay.js +0 -9
- package/lib/module/reanimated2/animation/delay.js.map +1 -1
- package/lib/module/reanimated2/animation/index.js.map +1 -1
- package/lib/module/reanimated2/animation/repeat.js +6 -20
- package/lib/module/reanimated2/animation/repeat.js.map +1 -1
- package/lib/module/reanimated2/animation/sequence.js +3 -18
- package/lib/module/reanimated2/animation/sequence.js.map +1 -1
- package/lib/module/reanimated2/animation/spring.js +11 -21
- package/lib/module/reanimated2/animation/spring.js.map +1 -1
- package/lib/module/reanimated2/animation/styleAnimation.js +7 -31
- package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
- package/lib/module/reanimated2/animation/timing.js +0 -8
- package/lib/module/reanimated2/animation/timing.js.map +1 -1
- package/lib/module/reanimated2/animation/util.js +10 -33
- package/lib/module/reanimated2/animation/util.js.map +1 -1
- package/lib/module/reanimated2/commonTypes.js +12 -19
- package/lib/module/reanimated2/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/component/FlatList.js +0 -4
- package/lib/module/reanimated2/component/FlatList.js.map +1 -1
- package/lib/module/reanimated2/component/Image.js.map +1 -1
- package/lib/module/reanimated2/component/ScrollView.js.map +1 -1
- package/lib/module/reanimated2/component/Text.js.map +1 -1
- package/lib/module/reanimated2/component/View.js.map +1 -1
- package/lib/module/reanimated2/core.js +6 -22
- package/lib/module/reanimated2/core.js.map +1 -1
- package/lib/module/reanimated2/errors.js +3 -13
- package/lib/module/reanimated2/errors.js.map +1 -1
- package/lib/module/reanimated2/fabricUtils.js +3 -3
- package/lib/module/reanimated2/fabricUtils.js.map +1 -1
- package/lib/module/reanimated2/fabricUtils.web.js +1 -1
- package/lib/module/reanimated2/fabricUtils.web.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js +3 -8
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js +13 -15
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
- package/lib/module/reanimated2/globals.d.js.map +1 -1
- package/lib/module/reanimated2/hook/Hooks.js +3 -2
- package/lib/module/reanimated2/hook/Hooks.js.map +1 -1
- package/lib/module/reanimated2/hook/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/hook/index.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js +3 -14
- package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +2 -5
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedReaction.js +1 -7
- package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedRef.js +0 -6
- package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js +2 -7
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedSensor.js +9 -20
- package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedStyle.js +13 -59
- package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/module/reanimated2/hook/useDerivedValue.js +4 -8
- package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -1
- package/lib/module/reanimated2/hook/useScrollViewOffset.js +0 -1
- package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
- package/lib/module/reanimated2/hook/useSharedValue.js +2 -3
- package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/utils.js +8 -21
- package/lib/module/reanimated2/hook/utils.js.map +1 -1
- package/lib/module/reanimated2/index.js.map +1 -1
- package/lib/module/reanimated2/initializers.js +23 -37
- package/lib/module/reanimated2/initializers.js.map +1 -1
- package/lib/module/reanimated2/interpolateColor.js +5 -34
- package/lib/module/reanimated2/interpolateColor.js.map +1 -1
- package/lib/module/reanimated2/interpolation.js +13 -28
- package/lib/module/reanimated2/interpolation.js.map +1 -1
- package/lib/module/reanimated2/jestUtils.js +11 -35
- package/lib/module/reanimated2/jestUtils.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js +15 -35
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/Mapper.js +9 -23
- package/lib/module/reanimated2/js-reanimated/Mapper.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/MapperRegistry.js +7 -35
- package/lib/module/reanimated2/js-reanimated/MapperRegistry.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/MutableValue.js +5 -16
- package/lib/module/reanimated2/js-reanimated/MutableValue.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/global.js +2 -6
- package/lib/module/reanimated2/js-reanimated/global.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/index.js +3 -9
- package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +7 -23
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +3 -45
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +7 -39
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +3 -3
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js +4 -19
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +3 -52
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js +3 -32
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js +3 -38
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +7 -16
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +3 -8
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +3 -14
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +3 -26
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +3 -26
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +3 -14
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +3 -50
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +3 -17
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +5 -23
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +3 -5
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +5 -6
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +3 -5
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +3 -8
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js +3 -13
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -1
- package/lib/module/reanimated2/mappers.js +26 -25
- package/lib/module/reanimated2/mappers.js.map +1 -1
- package/lib/module/reanimated2/mock.js +5 -15
- package/lib/module/reanimated2/mock.js.map +1 -1
- package/lib/module/reanimated2/mutables.js +2 -19
- package/lib/module/reanimated2/mutables.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/RNRenderer.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/RNRenderer.web.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/checkCppVersion.js +24 -0
- package/lib/module/reanimated2/platform-specific/checkCppVersion.js.map +1 -0
- package/lib/module/reanimated2/platform-specific/checkVersion.web.js +0 -1
- package/lib/module/reanimated2/platform-specific/checkVersion.web.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/jsVersion.js +7 -0
- package/lib/module/reanimated2/platform-specific/jsVersion.js.map +1 -0
- package/lib/module/reanimated2/pluginUtils.js.map +1 -1
- package/lib/module/reanimated2/shareables.js +96 -44
- package/lib/module/reanimated2/shareables.js.map +1 -1
- package/lib/module/reanimated2/threads.js +39 -33
- package/lib/module/reanimated2/threads.js.map +1 -1
- package/lib/module/reanimated2/utils.js +0 -3
- package/lib/module/reanimated2/utils.js.map +1 -1
- package/lib/module/reanimated2/valueSetter.js +6 -19
- package/lib/module/reanimated2/valueSetter.js.map +1 -1
- package/lib/module/setAndForwardRef.js +3 -2
- package/lib/module/setAndForwardRef.js.map +1 -1
- package/package.json +46 -40
- package/plugin/.eslintrc.js +7 -0
- package/plugin/README.md +241 -0
- package/plugin/build/plugin.js +714 -0
- package/plugin/build/plugin.js.map +7 -0
- package/plugin/index.js +1 -807
- package/plugin/package.json +23 -0
- package/plugin/src/buildWorkletString.ts +213 -0
- package/plugin/src/commonObjects.ts +60 -0
- package/plugin/src/injectVersion.ts +37 -0
- package/plugin/src/makeWorklet.ts +375 -0
- package/plugin/src/plugin.ts +49 -0
- package/plugin/src/processForCalleesWorklets.ts +106 -0
- package/plugin/src/processIfGestureHandlerEventCallbackFunctionNode.ts +156 -0
- package/plugin/src/processIfWorkletFunction.ts +55 -0
- package/plugin/src/processIfWorkletNode.ts +44 -0
- package/plugin/src/processInlineStylesWarning.ts +129 -0
- package/plugin/src/processWorkletObjectMethod.ts +31 -0
- package/plugin/src/types.ts +15 -0
- package/plugin/src/utils.ts +6 -0
- package/plugin/tsconfig.json +15 -0
- package/plugin/yarn.lock +2193 -0
- package/react-native-reanimated.d.ts +1 -0
- package/scripts/reanimated_utils.rb +2 -2
- package/src/createAnimatedComponent.tsx +2 -3
- package/src/reanimated2/Easing.ts +19 -0
- package/src/reanimated2/NativeMethods.ts +9 -4
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +2 -2
- package/src/reanimated2/UpdateProps.ts +2 -2
- package/src/reanimated2/animation/decay.ts +7 -1
- package/src/reanimated2/animation/styleAnimation.ts +5 -1
- package/src/reanimated2/core.ts +4 -4
- package/src/reanimated2/errors.ts +1 -0
- package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +12 -4
- package/src/reanimated2/globals.d.ts +71 -112
- package/src/reanimated2/hook/commonTypes.ts +1 -1
- package/src/reanimated2/hook/useAnimatedReaction.ts +2 -2
- package/src/reanimated2/hook/useAnimatedSensor.ts +2 -2
- package/src/reanimated2/initializers.ts +11 -8
- package/src/reanimated2/jestUtils.ts +0 -1
- package/src/reanimated2/js-reanimated/JSReanimated.ts +5 -1
- package/src/reanimated2/js-reanimated/index.ts +1 -1
- package/src/reanimated2/mappers.ts +26 -4
- package/src/reanimated2/mock.ts +1 -0
- package/src/reanimated2/platform-specific/checkCppVersion.ts +29 -0
- package/src/reanimated2/platform-specific/jsVersion.ts +6 -0
- package/src/reanimated2/shareables.ts +107 -8
- package/src/reanimated2/threads.ts +36 -17
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.js +0 -42
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.js.map +0 -1
- package/lib/module/reanimated2/platform-specific/checkVersion.js +0 -35
- package/lib/module/reanimated2/platform-specific/checkVersion.js.map +0 -1
- package/src/reanimated2/platform-specific/checkVersion.ts +0 -39
|
@@ -16,13 +16,9 @@ exports.rgbaArrayToRGBAColor = rgbaArrayToRGBAColor;
|
|
|
16
16
|
exports.rgbaColor = void 0;
|
|
17
17
|
exports.toGammaSpace = toGammaSpace;
|
|
18
18
|
exports.toLinearSpace = toLinearSpace;
|
|
19
|
-
|
|
20
19
|
var _reactNative = require("react-native");
|
|
21
|
-
|
|
22
20
|
var _core = require("./core");
|
|
23
|
-
|
|
24
21
|
/* global _WORKLET */
|
|
25
|
-
|
|
26
22
|
/**
|
|
27
23
|
* Copied from:
|
|
28
24
|
* react-native/Libraries/StyleSheet/normalizeColor.js
|
|
@@ -31,31 +27,28 @@ var _core = require("./core");
|
|
|
31
27
|
*/
|
|
32
28
|
|
|
33
29
|
/* eslint no-bitwise: 0 */
|
|
30
|
+
|
|
34
31
|
// var INTEGER = '[-+]?\\d+';
|
|
35
32
|
const NUMBER = '[-+]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)';
|
|
36
33
|
const PERCENTAGE = NUMBER + '%';
|
|
37
|
-
|
|
38
34
|
function call() {
|
|
39
35
|
'worklet';
|
|
40
36
|
|
|
41
37
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
42
38
|
args[_key] = arguments[_key];
|
|
43
39
|
}
|
|
44
|
-
|
|
45
40
|
return '\\(\\s*(' + args.join(')\\s*,\\s*(') + ')\\s*\\)';
|
|
46
|
-
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// matchers use RegExp objects which needs to be created separately on JS and on
|
|
47
44
|
// the UI thread. We keep separate cache of Regexes for UI and JS using the below
|
|
48
45
|
// objects, then pick the right cache in getMatchers() method.
|
|
49
|
-
|
|
50
|
-
|
|
51
46
|
const jsCachedMatchers = {};
|
|
52
47
|
const uiCachedMatchers = !(0, _core.isConfigured)() ? {} : (0, _core.makeRemote)({});
|
|
53
|
-
|
|
54
48
|
function getMatchers() {
|
|
55
49
|
'worklet';
|
|
56
50
|
|
|
57
51
|
const cachedMatchers = _WORKLET ? uiCachedMatchers : jsCachedMatchers;
|
|
58
|
-
|
|
59
52
|
if (cachedMatchers.rgb === undefined) {
|
|
60
53
|
cachedMatchers.rgb = new RegExp('rgb' + call(NUMBER, NUMBER, NUMBER));
|
|
61
54
|
cachedMatchers.rgba = new RegExp('rgba' + call(NUMBER, NUMBER, NUMBER, NUMBER));
|
|
@@ -66,41 +59,32 @@ function getMatchers() {
|
|
|
66
59
|
cachedMatchers.hex6 = /^#([0-9a-fA-F]{6})$/;
|
|
67
60
|
cachedMatchers.hex8 = /^#([0-9a-fA-F]{8})$/;
|
|
68
61
|
}
|
|
69
|
-
|
|
70
62
|
return cachedMatchers;
|
|
71
|
-
}
|
|
63
|
+
}
|
|
64
|
+
// cachedMatchers is lazy loaded and it is frozen when worklet is being created,
|
|
72
65
|
// it is possible to call getMatchers() when the object is frozen, then cachedMatchers
|
|
73
66
|
// has no assigned regexes
|
|
74
|
-
|
|
75
|
-
|
|
76
67
|
getMatchers();
|
|
77
|
-
|
|
78
68
|
function hue2rgb(p, q, t) {
|
|
79
69
|
'worklet';
|
|
80
70
|
|
|
81
71
|
if (t < 0) {
|
|
82
72
|
t += 1;
|
|
83
73
|
}
|
|
84
|
-
|
|
85
74
|
if (t > 1) {
|
|
86
75
|
t -= 1;
|
|
87
76
|
}
|
|
88
|
-
|
|
89
77
|
if (t < 1 / 6) {
|
|
90
78
|
return p + (q - p) * 6 * t;
|
|
91
79
|
}
|
|
92
|
-
|
|
93
80
|
if (t < 1 / 2) {
|
|
94
81
|
return q;
|
|
95
82
|
}
|
|
96
|
-
|
|
97
83
|
if (t < 2 / 3) {
|
|
98
84
|
return p + (q - p) * (2 / 3 - t) * 6;
|
|
99
85
|
}
|
|
100
|
-
|
|
101
86
|
return p;
|
|
102
87
|
}
|
|
103
|
-
|
|
104
88
|
function hslToRgb(h, s, l) {
|
|
105
89
|
'worklet';
|
|
106
90
|
|
|
@@ -111,62 +95,49 @@ function hslToRgb(h, s, l) {
|
|
|
111
95
|
const b = hue2rgb(p, q, h - 1 / 3);
|
|
112
96
|
return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8;
|
|
113
97
|
}
|
|
114
|
-
|
|
115
98
|
function parse255(str) {
|
|
116
99
|
'worklet';
|
|
117
100
|
|
|
118
101
|
const int = Number.parseInt(str, 10);
|
|
119
|
-
|
|
120
102
|
if (int < 0) {
|
|
121
103
|
return 0;
|
|
122
104
|
}
|
|
123
|
-
|
|
124
105
|
if (int > 255) {
|
|
125
106
|
return 255;
|
|
126
107
|
}
|
|
127
|
-
|
|
128
108
|
return int;
|
|
129
109
|
}
|
|
130
|
-
|
|
131
110
|
function parse360(str) {
|
|
132
111
|
'worklet';
|
|
133
112
|
|
|
134
113
|
const int = Number.parseFloat(str);
|
|
135
114
|
return (int % 360 + 360) % 360 / 360;
|
|
136
115
|
}
|
|
137
|
-
|
|
138
116
|
function parse1(str) {
|
|
139
117
|
'worklet';
|
|
140
118
|
|
|
141
119
|
const num = Number.parseFloat(str);
|
|
142
|
-
|
|
143
120
|
if (num < 0) {
|
|
144
121
|
return 0;
|
|
145
122
|
}
|
|
146
|
-
|
|
147
123
|
if (num > 1) {
|
|
148
124
|
return 255;
|
|
149
125
|
}
|
|
150
|
-
|
|
151
126
|
return Math.round(num * 255);
|
|
152
127
|
}
|
|
153
|
-
|
|
154
128
|
function parsePercentage(str) {
|
|
155
|
-
'worklet';
|
|
129
|
+
'worklet';
|
|
156
130
|
|
|
131
|
+
// parseFloat conveniently ignores the final %
|
|
157
132
|
const int = Number.parseFloat(str);
|
|
158
|
-
|
|
159
133
|
if (int < 0) {
|
|
160
134
|
return 0;
|
|
161
135
|
}
|
|
162
|
-
|
|
163
136
|
if (int > 100) {
|
|
164
137
|
return 1;
|
|
165
138
|
}
|
|
166
|
-
|
|
167
139
|
return int / 100;
|
|
168
140
|
}
|
|
169
|
-
|
|
170
141
|
const names = !(0, _core.isConfigured)() ? null : (0, _core.makeShareable)({
|
|
171
142
|
transparent: 0x00000000,
|
|
172
143
|
// http://www.w3.org/TR/css3-color/#svg-color
|
|
@@ -320,136 +291,134 @@ const names = !(0, _core.isConfigured)() ? null : (0, _core.makeShareable)({
|
|
|
320
291
|
yellow: 0xffff00ff,
|
|
321
292
|
yellowgreen: 0x9acd32ff
|
|
322
293
|
});
|
|
323
|
-
|
|
324
294
|
function normalizeColor(color) {
|
|
325
295
|
'worklet';
|
|
326
296
|
|
|
327
297
|
var _matchers$hex, _matchers$rgb, _matchers$rgba, _matchers$hex2, _matchers$hex3, _matchers$hex4, _matchers$hsl, _matchers$hsla;
|
|
328
|
-
|
|
329
298
|
if (typeof color === 'number') {
|
|
330
299
|
if (color >>> 0 === color && color >= 0 && color <= 0xffffffff) {
|
|
331
300
|
return color;
|
|
332
301
|
}
|
|
333
|
-
|
|
334
302
|
return null;
|
|
335
303
|
}
|
|
336
|
-
|
|
337
304
|
if (typeof color !== 'string') {
|
|
338
305
|
return null;
|
|
339
306
|
}
|
|
340
|
-
|
|
341
307
|
const matchers = getMatchers();
|
|
342
|
-
let match;
|
|
308
|
+
let match;
|
|
343
309
|
|
|
310
|
+
// Ordered based on occurrences on Facebook codebase
|
|
344
311
|
if (match = matchers === null || matchers === void 0 ? void 0 : (_matchers$hex = matchers.hex6) === null || _matchers$hex === void 0 ? void 0 : _matchers$hex.exec(color)) {
|
|
345
312
|
return Number.parseInt(match[1] + 'ff', 16) >>> 0;
|
|
346
313
|
}
|
|
347
|
-
|
|
348
314
|
if (names[color] !== undefined) {
|
|
349
315
|
return names[color];
|
|
350
316
|
}
|
|
351
|
-
|
|
352
317
|
if (match = matchers === null || matchers === void 0 ? void 0 : (_matchers$rgb = matchers.rgb) === null || _matchers$rgb === void 0 ? void 0 : _matchers$rgb.exec(color)) {
|
|
353
|
-
return (
|
|
354
|
-
|
|
355
|
-
parse255(match[
|
|
356
|
-
|
|
318
|
+
return (
|
|
319
|
+
// b
|
|
320
|
+
(parse255(match[1]) << 24 |
|
|
321
|
+
// r
|
|
322
|
+
parse255(match[2]) << 16 |
|
|
323
|
+
// g
|
|
324
|
+
parse255(match[3]) << 8 | 0x000000ff) >>>
|
|
325
|
+
// a
|
|
357
326
|
0
|
|
358
327
|
);
|
|
359
328
|
}
|
|
360
|
-
|
|
361
329
|
if (match = matchers === null || matchers === void 0 ? void 0 : (_matchers$rgba = matchers.rgba) === null || _matchers$rgba === void 0 ? void 0 : _matchers$rgba.exec(color)) {
|
|
362
|
-
return (
|
|
363
|
-
|
|
364
|
-
parse255(match[
|
|
365
|
-
|
|
330
|
+
return (
|
|
331
|
+
// b
|
|
332
|
+
(parse255(match[1]) << 24 |
|
|
333
|
+
// r
|
|
334
|
+
parse255(match[2]) << 16 |
|
|
335
|
+
// g
|
|
336
|
+
parse255(match[3]) << 8 | parse1(match[4])) >>>
|
|
337
|
+
// a
|
|
366
338
|
0
|
|
367
339
|
);
|
|
368
340
|
}
|
|
369
|
-
|
|
370
341
|
if (match = matchers === null || matchers === void 0 ? void 0 : (_matchers$hex2 = matchers.hex3) === null || _matchers$hex2 === void 0 ? void 0 : _matchers$hex2.exec(color)) {
|
|
371
|
-
return Number.parseInt(match[1] + match[1] +
|
|
372
|
-
|
|
373
|
-
match[
|
|
374
|
-
|
|
342
|
+
return Number.parseInt(match[1] + match[1] +
|
|
343
|
+
// r
|
|
344
|
+
match[2] + match[2] +
|
|
345
|
+
// g
|
|
346
|
+
match[3] + match[3] +
|
|
347
|
+
// b
|
|
348
|
+
'ff',
|
|
349
|
+
// a
|
|
375
350
|
16) >>> 0;
|
|
376
|
-
}
|
|
377
|
-
|
|
351
|
+
}
|
|
378
352
|
|
|
353
|
+
// https://drafts.csswg.org/css-color-4/#hex-notation
|
|
379
354
|
if (match = matchers === null || matchers === void 0 ? void 0 : (_matchers$hex3 = matchers.hex8) === null || _matchers$hex3 === void 0 ? void 0 : _matchers$hex3.exec(color)) {
|
|
380
355
|
return Number.parseInt(match[1], 16) >>> 0;
|
|
381
356
|
}
|
|
382
|
-
|
|
383
357
|
if (match = matchers === null || matchers === void 0 ? void 0 : (_matchers$hex4 = matchers.hex4) === null || _matchers$hex4 === void 0 ? void 0 : _matchers$hex4.exec(color)) {
|
|
384
|
-
return Number.parseInt(match[1] + match[1] +
|
|
385
|
-
|
|
386
|
-
match[
|
|
387
|
-
|
|
358
|
+
return Number.parseInt(match[1] + match[1] +
|
|
359
|
+
// r
|
|
360
|
+
match[2] + match[2] +
|
|
361
|
+
// g
|
|
362
|
+
match[3] + match[3] +
|
|
363
|
+
// b
|
|
364
|
+
match[4] + match[4],
|
|
365
|
+
// a
|
|
388
366
|
16) >>> 0;
|
|
389
367
|
}
|
|
390
|
-
|
|
391
368
|
if (match = matchers === null || matchers === void 0 ? void 0 : (_matchers$hsl = matchers.hsl) === null || _matchers$hsl === void 0 ? void 0 : _matchers$hsl.exec(color)) {
|
|
392
|
-
return (hslToRgb(parse360(match[1]),
|
|
393
|
-
|
|
369
|
+
return (hslToRgb(parse360(match[1]),
|
|
370
|
+
// h
|
|
371
|
+
parsePercentage(match[2]),
|
|
372
|
+
// s
|
|
394
373
|
parsePercentage(match[3]) // l
|
|
395
|
-
) | 0x000000ff) >>>
|
|
374
|
+
) | 0x000000ff) >>>
|
|
375
|
+
// a
|
|
396
376
|
0;
|
|
397
377
|
}
|
|
398
|
-
|
|
399
378
|
if (match = matchers === null || matchers === void 0 ? void 0 : (_matchers$hsla = matchers.hsla) === null || _matchers$hsla === void 0 ? void 0 : _matchers$hsla.exec(color)) {
|
|
400
|
-
return (hslToRgb(parse360(match[1]),
|
|
401
|
-
|
|
379
|
+
return (hslToRgb(parse360(match[1]),
|
|
380
|
+
// h
|
|
381
|
+
parsePercentage(match[2]),
|
|
382
|
+
// s
|
|
402
383
|
parsePercentage(match[3]) // l
|
|
403
|
-
) | parse1(match[4])) >>>
|
|
384
|
+
) | parse1(match[4])) >>>
|
|
385
|
+
// a
|
|
404
386
|
0;
|
|
405
387
|
}
|
|
406
|
-
|
|
407
388
|
return null;
|
|
408
389
|
}
|
|
409
|
-
|
|
410
390
|
const opacity = c => {
|
|
411
391
|
'worklet';
|
|
412
392
|
|
|
413
393
|
return (c >> 24 & 255) / 255;
|
|
414
394
|
};
|
|
415
|
-
|
|
416
395
|
exports.opacity = opacity;
|
|
417
|
-
|
|
418
396
|
const red = c => {
|
|
419
397
|
'worklet';
|
|
420
398
|
|
|
421
399
|
return c >> 16 & 255;
|
|
422
400
|
};
|
|
423
|
-
|
|
424
401
|
exports.red = red;
|
|
425
|
-
|
|
426
402
|
const green = c => {
|
|
427
403
|
'worklet';
|
|
428
404
|
|
|
429
405
|
return c >> 8 & 255;
|
|
430
406
|
};
|
|
431
|
-
|
|
432
407
|
exports.green = green;
|
|
433
|
-
|
|
434
408
|
const blue = c => {
|
|
435
409
|
'worklet';
|
|
436
410
|
|
|
437
411
|
return c & 255;
|
|
438
412
|
};
|
|
439
|
-
|
|
440
413
|
exports.blue = blue;
|
|
441
|
-
|
|
442
414
|
const rgbaColor = function (r, g, b) {
|
|
443
415
|
'worklet';
|
|
444
416
|
|
|
445
417
|
let alpha = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
446
|
-
|
|
447
418
|
if (_reactNative.Platform.OS === 'web' || !_WORKLET) {
|
|
448
419
|
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
449
420
|
}
|
|
450
|
-
|
|
451
421
|
const c = Math.round(alpha * 255) * (1 << 24) + Math.round(r) * (1 << 16) + Math.round(g) * (1 << 8) + Math.round(b);
|
|
452
|
-
|
|
453
422
|
if (_reactNative.Platform.OS === 'android') {
|
|
454
423
|
// on Android color is represented as signed 32 bit int
|
|
455
424
|
return c < 1 << 31 >>> 0 ? c : c - 4294967296; // 4294967296 == Math.pow(2, 32);
|
|
@@ -457,6 +426,7 @@ const rgbaColor = function (r, g, b) {
|
|
|
457
426
|
|
|
458
427
|
return c;
|
|
459
428
|
};
|
|
429
|
+
|
|
460
430
|
/* accepts parameters
|
|
461
431
|
* r Object = {r:x, g:y, b:z}
|
|
462
432
|
* OR
|
|
@@ -464,51 +434,41 @@ const rgbaColor = function (r, g, b) {
|
|
|
464
434
|
* 0 <= r, g, b <= 255
|
|
465
435
|
* returns 0 <= h, s, v <= 1
|
|
466
436
|
*/
|
|
467
|
-
|
|
468
|
-
|
|
469
437
|
exports.rgbaColor = rgbaColor;
|
|
470
|
-
|
|
471
438
|
function RGBtoHSV(r, g, b) {
|
|
472
439
|
'worklet';
|
|
473
|
-
/* eslint-disable */
|
|
474
440
|
|
|
441
|
+
/* eslint-disable */
|
|
475
442
|
if (arguments.length === 1) {
|
|
476
443
|
g = r.g;
|
|
477
444
|
b = r.b;
|
|
478
445
|
r = r.r;
|
|
479
446
|
}
|
|
480
|
-
|
|
481
447
|
const max = Math.max(r, g, b);
|
|
482
448
|
const min = Math.min(r, g, b);
|
|
483
449
|
const d = max - min;
|
|
484
450
|
const s = max === 0 ? 0 : d / max;
|
|
485
451
|
const v = max / 255;
|
|
486
452
|
let h;
|
|
487
|
-
|
|
488
453
|
switch (max) {
|
|
489
454
|
default:
|
|
490
455
|
/* fallthrough */
|
|
491
|
-
|
|
492
456
|
case min:
|
|
493
457
|
h = 0;
|
|
494
458
|
break;
|
|
495
|
-
|
|
496
459
|
case r:
|
|
497
460
|
h = g - b + d * (g < b ? 6 : 0);
|
|
498
461
|
h /= 6 * d;
|
|
499
462
|
break;
|
|
500
|
-
|
|
501
463
|
case g:
|
|
502
464
|
h = b - r + d * 2;
|
|
503
465
|
h /= 6 * d;
|
|
504
466
|
break;
|
|
505
|
-
|
|
506
467
|
case b:
|
|
507
468
|
h = r - g + d * 4;
|
|
508
469
|
h /= 6 * d;
|
|
509
470
|
break;
|
|
510
471
|
}
|
|
511
|
-
|
|
512
472
|
return {
|
|
513
473
|
h: h,
|
|
514
474
|
s: s,
|
|
@@ -516,6 +476,7 @@ function RGBtoHSV(r, g, b) {
|
|
|
516
476
|
};
|
|
517
477
|
/* eslint-enable */
|
|
518
478
|
}
|
|
479
|
+
|
|
519
480
|
/* accepts parameters
|
|
520
481
|
* h Object = {h:x, s:y, v:z}
|
|
521
482
|
* OR
|
|
@@ -524,51 +485,41 @@ function RGBtoHSV(r, g, b) {
|
|
|
524
485
|
* returns 0 <= r, g, b <= 255
|
|
525
486
|
*/
|
|
526
487
|
|
|
527
|
-
|
|
528
488
|
function HSVtoRGB(h, s, v) {
|
|
529
489
|
'worklet';
|
|
530
|
-
/* eslint-disable */
|
|
531
490
|
|
|
491
|
+
/* eslint-disable */
|
|
532
492
|
var r, g, b, i, f, p, q, t;
|
|
533
|
-
|
|
534
493
|
if (arguments.length === 1) {
|
|
535
494
|
s = h.s;
|
|
536
495
|
v = h.v;
|
|
537
496
|
h = h.h;
|
|
538
497
|
}
|
|
539
|
-
|
|
540
498
|
i = Math.floor(h * 6);
|
|
541
499
|
f = h * 6 - i;
|
|
542
500
|
p = v * (1 - s);
|
|
543
501
|
q = v * (1 - f * s);
|
|
544
502
|
t = v * (1 - (1 - f) * s);
|
|
545
|
-
|
|
546
503
|
switch (i % 6) {
|
|
547
504
|
case 0:
|
|
548
505
|
r = v, g = t, b = p;
|
|
549
506
|
break;
|
|
550
|
-
|
|
551
507
|
case 1:
|
|
552
508
|
r = q, g = v, b = p;
|
|
553
509
|
break;
|
|
554
|
-
|
|
555
510
|
case 2:
|
|
556
511
|
r = p, g = v, b = t;
|
|
557
512
|
break;
|
|
558
|
-
|
|
559
513
|
case 3:
|
|
560
514
|
r = p, g = q, b = v;
|
|
561
515
|
break;
|
|
562
|
-
|
|
563
516
|
case 4:
|
|
564
517
|
r = t, g = p, b = v;
|
|
565
518
|
break;
|
|
566
|
-
|
|
567
519
|
case 5:
|
|
568
520
|
r = v, g = p, b = q;
|
|
569
521
|
break;
|
|
570
522
|
}
|
|
571
|
-
|
|
572
523
|
return {
|
|
573
524
|
r: Math.round(r * 255),
|
|
574
525
|
g: Math.round(g * 255),
|
|
@@ -587,54 +538,41 @@ const hsvToColor = (h, s, v, a) => {
|
|
|
587
538
|
} = HSVtoRGB(h, s, v);
|
|
588
539
|
return rgbaColor(r, g, b, a);
|
|
589
540
|
};
|
|
590
|
-
|
|
591
541
|
exports.hsvToColor = hsvToColor;
|
|
592
|
-
|
|
593
542
|
function processColorInitially(color) {
|
|
594
543
|
'worklet';
|
|
595
544
|
|
|
596
545
|
if (color === null || color === undefined || typeof color === 'number') {
|
|
597
546
|
return color;
|
|
598
547
|
}
|
|
599
|
-
|
|
600
548
|
let normalizedColor = normalizeColor(color);
|
|
601
|
-
|
|
602
549
|
if (normalizedColor === null || normalizedColor === undefined) {
|
|
603
550
|
return undefined;
|
|
604
551
|
}
|
|
605
|
-
|
|
606
552
|
if (typeof normalizedColor !== 'number') {
|
|
607
553
|
return null;
|
|
608
554
|
}
|
|
609
|
-
|
|
610
555
|
normalizedColor = (normalizedColor << 24 | normalizedColor >>> 8) >>> 0; // argb
|
|
611
|
-
|
|
612
556
|
return normalizedColor;
|
|
613
557
|
}
|
|
614
|
-
|
|
615
558
|
function isColor(value) {
|
|
616
559
|
'worklet';
|
|
617
560
|
|
|
618
561
|
if (typeof value !== 'string') {
|
|
619
562
|
return false;
|
|
620
563
|
}
|
|
621
|
-
|
|
622
564
|
return processColorInitially(value) != null;
|
|
623
565
|
}
|
|
624
|
-
|
|
625
566
|
function processColor(color) {
|
|
626
567
|
'worklet';
|
|
627
568
|
|
|
628
569
|
let normalizedColor = processColorInitially(color);
|
|
629
|
-
|
|
630
570
|
if (normalizedColor === null || normalizedColor === undefined) {
|
|
631
571
|
return undefined;
|
|
632
572
|
}
|
|
633
|
-
|
|
634
573
|
if (typeof normalizedColor !== 'number') {
|
|
635
574
|
return null;
|
|
636
575
|
}
|
|
637
|
-
|
|
638
576
|
if (_reactNative.Platform.OS === 'android') {
|
|
639
577
|
// Android use 32 bit *signed* integer to represent the color
|
|
640
578
|
// We utilize the fact that bitwise operations in JS also operates on
|
|
@@ -642,52 +580,42 @@ function processColor(color) {
|
|
|
642
580
|
// *unsigned* to *signed* 32bit int that way.
|
|
643
581
|
normalizedColor = normalizedColor | 0x0;
|
|
644
582
|
}
|
|
645
|
-
|
|
646
583
|
return normalizedColor;
|
|
647
584
|
}
|
|
648
|
-
|
|
649
585
|
function convertToRGBA(color) {
|
|
650
586
|
'worklet';
|
|
651
587
|
|
|
652
588
|
const processedColor = processColorInitially(color); // argb;
|
|
653
|
-
|
|
654
589
|
const a = (processedColor >>> 24) / 255;
|
|
655
590
|
const r = (processedColor << 8 >>> 24) / 255;
|
|
656
591
|
const g = (processedColor << 16 >>> 24) / 255;
|
|
657
592
|
const b = (processedColor << 24 >>> 24) / 255;
|
|
658
593
|
return [r, g, b, a];
|
|
659
594
|
}
|
|
660
|
-
|
|
661
595
|
function rgbaArrayToRGBAColor(RGBA) {
|
|
662
596
|
'worklet';
|
|
663
597
|
|
|
664
598
|
return `rgba(${Math.round(RGBA[0] * 255)}, ${Math.round(RGBA[1] * 255)}, ${Math.round(RGBA[2] * 255)}, ${RGBA[3]})`;
|
|
665
599
|
}
|
|
666
|
-
|
|
667
600
|
function toLinearSpace(RGBA) {
|
|
668
601
|
'worklet';
|
|
669
602
|
|
|
670
603
|
let gamma = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2.2;
|
|
671
604
|
const res = [];
|
|
672
|
-
|
|
673
605
|
for (let i = 0; i < 3; ++i) {
|
|
674
606
|
res.push(Math.pow(RGBA[i], gamma));
|
|
675
607
|
}
|
|
676
|
-
|
|
677
608
|
res.push(RGBA[3]);
|
|
678
609
|
return res;
|
|
679
610
|
}
|
|
680
|
-
|
|
681
611
|
function toGammaSpace(RGBA) {
|
|
682
612
|
'worklet';
|
|
683
613
|
|
|
684
614
|
let gamma = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2.2;
|
|
685
615
|
const res = [];
|
|
686
|
-
|
|
687
616
|
for (let i = 0; i < 3; ++i) {
|
|
688
617
|
res.push(Math.pow(RGBA[i], 1 / gamma));
|
|
689
618
|
}
|
|
690
|
-
|
|
691
619
|
res.push(RGBA[3]);
|
|
692
620
|
return res;
|
|
693
621
|
}
|