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
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/* global _WORKLET */
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Copied from:
|
|
5
4
|
* react-native/Libraries/StyleSheet/normalizeColor.js
|
|
@@ -13,28 +12,24 @@ import { makeRemote, makeShareable, isConfigured } from './core';
|
|
|
13
12
|
// var INTEGER = '[-+]?\\d+';
|
|
14
13
|
const NUMBER = '[-+]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)';
|
|
15
14
|
const PERCENTAGE = NUMBER + '%';
|
|
16
|
-
|
|
17
15
|
function call() {
|
|
18
16
|
'worklet';
|
|
19
17
|
|
|
20
18
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
21
19
|
args[_key] = arguments[_key];
|
|
22
20
|
}
|
|
23
|
-
|
|
24
21
|
return '\\(\\s*(' + args.join(')\\s*,\\s*(') + ')\\s*\\)';
|
|
25
|
-
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// matchers use RegExp objects which needs to be created separately on JS and on
|
|
26
25
|
// the UI thread. We keep separate cache of Regexes for UI and JS using the below
|
|
27
26
|
// objects, then pick the right cache in getMatchers() method.
|
|
28
|
-
|
|
29
|
-
|
|
30
27
|
const jsCachedMatchers = {};
|
|
31
28
|
const uiCachedMatchers = !isConfigured() ? {} : makeRemote({});
|
|
32
|
-
|
|
33
29
|
function getMatchers() {
|
|
34
30
|
'worklet';
|
|
35
31
|
|
|
36
32
|
const cachedMatchers = _WORKLET ? uiCachedMatchers : jsCachedMatchers;
|
|
37
|
-
|
|
38
33
|
if (cachedMatchers.rgb === undefined) {
|
|
39
34
|
cachedMatchers.rgb = new RegExp('rgb' + call(NUMBER, NUMBER, NUMBER));
|
|
40
35
|
cachedMatchers.rgba = new RegExp('rgba' + call(NUMBER, NUMBER, NUMBER, NUMBER));
|
|
@@ -45,41 +40,32 @@ function getMatchers() {
|
|
|
45
40
|
cachedMatchers.hex6 = /^#([0-9a-fA-F]{6})$/;
|
|
46
41
|
cachedMatchers.hex8 = /^#([0-9a-fA-F]{8})$/;
|
|
47
42
|
}
|
|
48
|
-
|
|
49
43
|
return cachedMatchers;
|
|
50
|
-
}
|
|
44
|
+
}
|
|
45
|
+
// cachedMatchers is lazy loaded and it is frozen when worklet is being created,
|
|
51
46
|
// it is possible to call getMatchers() when the object is frozen, then cachedMatchers
|
|
52
47
|
// has no assigned regexes
|
|
53
|
-
|
|
54
|
-
|
|
55
48
|
getMatchers();
|
|
56
|
-
|
|
57
49
|
function hue2rgb(p, q, t) {
|
|
58
50
|
'worklet';
|
|
59
51
|
|
|
60
52
|
if (t < 0) {
|
|
61
53
|
t += 1;
|
|
62
54
|
}
|
|
63
|
-
|
|
64
55
|
if (t > 1) {
|
|
65
56
|
t -= 1;
|
|
66
57
|
}
|
|
67
|
-
|
|
68
58
|
if (t < 1 / 6) {
|
|
69
59
|
return p + (q - p) * 6 * t;
|
|
70
60
|
}
|
|
71
|
-
|
|
72
61
|
if (t < 1 / 2) {
|
|
73
62
|
return q;
|
|
74
63
|
}
|
|
75
|
-
|
|
76
64
|
if (t < 2 / 3) {
|
|
77
65
|
return p + (q - p) * (2 / 3 - t) * 6;
|
|
78
66
|
}
|
|
79
|
-
|
|
80
67
|
return p;
|
|
81
68
|
}
|
|
82
|
-
|
|
83
69
|
function hslToRgb(h, s, l) {
|
|
84
70
|
'worklet';
|
|
85
71
|
|
|
@@ -90,62 +76,49 @@ function hslToRgb(h, s, l) {
|
|
|
90
76
|
const b = hue2rgb(p, q, h - 1 / 3);
|
|
91
77
|
return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8;
|
|
92
78
|
}
|
|
93
|
-
|
|
94
79
|
function parse255(str) {
|
|
95
80
|
'worklet';
|
|
96
81
|
|
|
97
82
|
const int = Number.parseInt(str, 10);
|
|
98
|
-
|
|
99
83
|
if (int < 0) {
|
|
100
84
|
return 0;
|
|
101
85
|
}
|
|
102
|
-
|
|
103
86
|
if (int > 255) {
|
|
104
87
|
return 255;
|
|
105
88
|
}
|
|
106
|
-
|
|
107
89
|
return int;
|
|
108
90
|
}
|
|
109
|
-
|
|
110
91
|
function parse360(str) {
|
|
111
92
|
'worklet';
|
|
112
93
|
|
|
113
94
|
const int = Number.parseFloat(str);
|
|
114
95
|
return (int % 360 + 360) % 360 / 360;
|
|
115
96
|
}
|
|
116
|
-
|
|
117
97
|
function parse1(str) {
|
|
118
98
|
'worklet';
|
|
119
99
|
|
|
120
100
|
const num = Number.parseFloat(str);
|
|
121
|
-
|
|
122
101
|
if (num < 0) {
|
|
123
102
|
return 0;
|
|
124
103
|
}
|
|
125
|
-
|
|
126
104
|
if (num > 1) {
|
|
127
105
|
return 255;
|
|
128
106
|
}
|
|
129
|
-
|
|
130
107
|
return Math.round(num * 255);
|
|
131
108
|
}
|
|
132
|
-
|
|
133
109
|
function parsePercentage(str) {
|
|
134
|
-
'worklet';
|
|
110
|
+
'worklet';
|
|
135
111
|
|
|
112
|
+
// parseFloat conveniently ignores the final %
|
|
136
113
|
const int = Number.parseFloat(str);
|
|
137
|
-
|
|
138
114
|
if (int < 0) {
|
|
139
115
|
return 0;
|
|
140
116
|
}
|
|
141
|
-
|
|
142
117
|
if (int > 100) {
|
|
143
118
|
return 1;
|
|
144
119
|
}
|
|
145
|
-
|
|
146
120
|
return int / 100;
|
|
147
121
|
}
|
|
148
|
-
|
|
149
122
|
const names = !isConfigured() ? null : makeShareable({
|
|
150
123
|
transparent: 0x00000000,
|
|
151
124
|
// http://www.w3.org/TR/css3-color/#svg-color
|
|
@@ -299,93 +272,102 @@ const names = !isConfigured() ? null : makeShareable({
|
|
|
299
272
|
yellow: 0xffff00ff,
|
|
300
273
|
yellowgreen: 0x9acd32ff
|
|
301
274
|
});
|
|
302
|
-
|
|
303
275
|
function normalizeColor(color) {
|
|
304
276
|
'worklet';
|
|
305
277
|
|
|
306
278
|
var _matchers$hex, _matchers$rgb, _matchers$rgba, _matchers$hex2, _matchers$hex3, _matchers$hex4, _matchers$hsl, _matchers$hsla;
|
|
307
|
-
|
|
308
279
|
if (typeof color === 'number') {
|
|
309
280
|
if (color >>> 0 === color && color >= 0 && color <= 0xffffffff) {
|
|
310
281
|
return color;
|
|
311
282
|
}
|
|
312
|
-
|
|
313
283
|
return null;
|
|
314
284
|
}
|
|
315
|
-
|
|
316
285
|
if (typeof color !== 'string') {
|
|
317
286
|
return null;
|
|
318
287
|
}
|
|
319
|
-
|
|
320
288
|
const matchers = getMatchers();
|
|
321
|
-
let match;
|
|
289
|
+
let match;
|
|
322
290
|
|
|
291
|
+
// Ordered based on occurrences on Facebook codebase
|
|
323
292
|
if (match = matchers === null || matchers === void 0 ? void 0 : (_matchers$hex = matchers.hex6) === null || _matchers$hex === void 0 ? void 0 : _matchers$hex.exec(color)) {
|
|
324
293
|
return Number.parseInt(match[1] + 'ff', 16) >>> 0;
|
|
325
294
|
}
|
|
326
|
-
|
|
327
295
|
if (names[color] !== undefined) {
|
|
328
296
|
return names[color];
|
|
329
297
|
}
|
|
330
|
-
|
|
331
298
|
if (match = matchers === null || matchers === void 0 ? void 0 : (_matchers$rgb = matchers.rgb) === null || _matchers$rgb === void 0 ? void 0 : _matchers$rgb.exec(color)) {
|
|
332
|
-
return (
|
|
333
|
-
|
|
334
|
-
parse255(match[
|
|
335
|
-
|
|
299
|
+
return (
|
|
300
|
+
// b
|
|
301
|
+
(parse255(match[1]) << 24 |
|
|
302
|
+
// r
|
|
303
|
+
parse255(match[2]) << 16 |
|
|
304
|
+
// g
|
|
305
|
+
parse255(match[3]) << 8 | 0x000000ff) >>>
|
|
306
|
+
// a
|
|
336
307
|
0
|
|
337
308
|
);
|
|
338
309
|
}
|
|
339
|
-
|
|
340
310
|
if (match = matchers === null || matchers === void 0 ? void 0 : (_matchers$rgba = matchers.rgba) === null || _matchers$rgba === void 0 ? void 0 : _matchers$rgba.exec(color)) {
|
|
341
|
-
return (
|
|
342
|
-
|
|
343
|
-
parse255(match[
|
|
344
|
-
|
|
311
|
+
return (
|
|
312
|
+
// b
|
|
313
|
+
(parse255(match[1]) << 24 |
|
|
314
|
+
// r
|
|
315
|
+
parse255(match[2]) << 16 |
|
|
316
|
+
// g
|
|
317
|
+
parse255(match[3]) << 8 | parse1(match[4])) >>>
|
|
318
|
+
// a
|
|
345
319
|
0
|
|
346
320
|
);
|
|
347
321
|
}
|
|
348
|
-
|
|
349
322
|
if (match = matchers === null || matchers === void 0 ? void 0 : (_matchers$hex2 = matchers.hex3) === null || _matchers$hex2 === void 0 ? void 0 : _matchers$hex2.exec(color)) {
|
|
350
|
-
return Number.parseInt(match[1] + match[1] +
|
|
351
|
-
|
|
352
|
-
match[
|
|
353
|
-
|
|
323
|
+
return Number.parseInt(match[1] + match[1] +
|
|
324
|
+
// r
|
|
325
|
+
match[2] + match[2] +
|
|
326
|
+
// g
|
|
327
|
+
match[3] + match[3] +
|
|
328
|
+
// b
|
|
329
|
+
'ff',
|
|
330
|
+
// a
|
|
354
331
|
16) >>> 0;
|
|
355
|
-
}
|
|
356
|
-
|
|
332
|
+
}
|
|
357
333
|
|
|
334
|
+
// https://drafts.csswg.org/css-color-4/#hex-notation
|
|
358
335
|
if (match = matchers === null || matchers === void 0 ? void 0 : (_matchers$hex3 = matchers.hex8) === null || _matchers$hex3 === void 0 ? void 0 : _matchers$hex3.exec(color)) {
|
|
359
336
|
return Number.parseInt(match[1], 16) >>> 0;
|
|
360
337
|
}
|
|
361
|
-
|
|
362
338
|
if (match = matchers === null || matchers === void 0 ? void 0 : (_matchers$hex4 = matchers.hex4) === null || _matchers$hex4 === void 0 ? void 0 : _matchers$hex4.exec(color)) {
|
|
363
|
-
return Number.parseInt(match[1] + match[1] +
|
|
364
|
-
|
|
365
|
-
match[
|
|
366
|
-
|
|
339
|
+
return Number.parseInt(match[1] + match[1] +
|
|
340
|
+
// r
|
|
341
|
+
match[2] + match[2] +
|
|
342
|
+
// g
|
|
343
|
+
match[3] + match[3] +
|
|
344
|
+
// b
|
|
345
|
+
match[4] + match[4],
|
|
346
|
+
// a
|
|
367
347
|
16) >>> 0;
|
|
368
348
|
}
|
|
369
|
-
|
|
370
349
|
if (match = matchers === null || matchers === void 0 ? void 0 : (_matchers$hsl = matchers.hsl) === null || _matchers$hsl === void 0 ? void 0 : _matchers$hsl.exec(color)) {
|
|
371
|
-
return (hslToRgb(parse360(match[1]),
|
|
372
|
-
|
|
350
|
+
return (hslToRgb(parse360(match[1]),
|
|
351
|
+
// h
|
|
352
|
+
parsePercentage(match[2]),
|
|
353
|
+
// s
|
|
373
354
|
parsePercentage(match[3]) // l
|
|
374
|
-
) | 0x000000ff) >>>
|
|
355
|
+
) | 0x000000ff) >>>
|
|
356
|
+
// a
|
|
375
357
|
0;
|
|
376
358
|
}
|
|
377
|
-
|
|
378
359
|
if (match = matchers === null || matchers === void 0 ? void 0 : (_matchers$hsla = matchers.hsla) === null || _matchers$hsla === void 0 ? void 0 : _matchers$hsla.exec(color)) {
|
|
379
|
-
return (hslToRgb(parse360(match[1]),
|
|
380
|
-
|
|
360
|
+
return (hslToRgb(parse360(match[1]),
|
|
361
|
+
// h
|
|
362
|
+
parsePercentage(match[2]),
|
|
363
|
+
// s
|
|
381
364
|
parsePercentage(match[3]) // l
|
|
382
|
-
) | parse1(match[4])) >>>
|
|
365
|
+
) | parse1(match[4])) >>>
|
|
366
|
+
// a
|
|
383
367
|
0;
|
|
384
368
|
}
|
|
385
|
-
|
|
386
369
|
return null;
|
|
387
370
|
}
|
|
388
|
-
|
|
389
371
|
export const opacity = c => {
|
|
390
372
|
'worklet';
|
|
391
373
|
|
|
@@ -410,13 +392,10 @@ export const rgbaColor = function (r, g, b) {
|
|
|
410
392
|
'worklet';
|
|
411
393
|
|
|
412
394
|
let alpha = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
413
|
-
|
|
414
395
|
if (Platform.OS === 'web' || !_WORKLET) {
|
|
415
396
|
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
416
397
|
}
|
|
417
|
-
|
|
418
398
|
const c = Math.round(alpha * 255) * (1 << 24) + Math.round(r) * (1 << 16) + Math.round(g) * (1 << 8) + Math.round(b);
|
|
419
|
-
|
|
420
399
|
if (Platform.OS === 'android') {
|
|
421
400
|
// on Android color is represented as signed 32 bit int
|
|
422
401
|
return c < 1 << 31 >>> 0 ? c : c - 4294967296; // 4294967296 == Math.pow(2, 32);
|
|
@@ -424,6 +403,7 @@ export const rgbaColor = function (r, g, b) {
|
|
|
424
403
|
|
|
425
404
|
return c;
|
|
426
405
|
};
|
|
406
|
+
|
|
427
407
|
/* accepts parameters
|
|
428
408
|
* r Object = {r:x, g:y, b:z}
|
|
429
409
|
* OR
|
|
@@ -434,45 +414,38 @@ export const rgbaColor = function (r, g, b) {
|
|
|
434
414
|
|
|
435
415
|
export function RGBtoHSV(r, g, b) {
|
|
436
416
|
'worklet';
|
|
437
|
-
/* eslint-disable */
|
|
438
417
|
|
|
418
|
+
/* eslint-disable */
|
|
439
419
|
if (arguments.length === 1) {
|
|
440
420
|
g = r.g;
|
|
441
421
|
b = r.b;
|
|
442
422
|
r = r.r;
|
|
443
423
|
}
|
|
444
|
-
|
|
445
424
|
const max = Math.max(r, g, b);
|
|
446
425
|
const min = Math.min(r, g, b);
|
|
447
426
|
const d = max - min;
|
|
448
427
|
const s = max === 0 ? 0 : d / max;
|
|
449
428
|
const v = max / 255;
|
|
450
429
|
let h;
|
|
451
|
-
|
|
452
430
|
switch (max) {
|
|
453
431
|
default:
|
|
454
432
|
/* fallthrough */
|
|
455
|
-
|
|
456
433
|
case min:
|
|
457
434
|
h = 0;
|
|
458
435
|
break;
|
|
459
|
-
|
|
460
436
|
case r:
|
|
461
437
|
h = g - b + d * (g < b ? 6 : 0);
|
|
462
438
|
h /= 6 * d;
|
|
463
439
|
break;
|
|
464
|
-
|
|
465
440
|
case g:
|
|
466
441
|
h = b - r + d * 2;
|
|
467
442
|
h /= 6 * d;
|
|
468
443
|
break;
|
|
469
|
-
|
|
470
444
|
case b:
|
|
471
445
|
h = r - g + d * 4;
|
|
472
446
|
h /= 6 * d;
|
|
473
447
|
break;
|
|
474
448
|
}
|
|
475
|
-
|
|
476
449
|
return {
|
|
477
450
|
h: h,
|
|
478
451
|
s: s,
|
|
@@ -480,6 +453,7 @@ export function RGBtoHSV(r, g, b) {
|
|
|
480
453
|
};
|
|
481
454
|
/* eslint-enable */
|
|
482
455
|
}
|
|
456
|
+
|
|
483
457
|
/* accepts parameters
|
|
484
458
|
* h Object = {h:x, s:y, v:z}
|
|
485
459
|
* OR
|
|
@@ -490,48 +464,39 @@ export function RGBtoHSV(r, g, b) {
|
|
|
490
464
|
|
|
491
465
|
function HSVtoRGB(h, s, v) {
|
|
492
466
|
'worklet';
|
|
493
|
-
/* eslint-disable */
|
|
494
467
|
|
|
468
|
+
/* eslint-disable */
|
|
495
469
|
var r, g, b, i, f, p, q, t;
|
|
496
|
-
|
|
497
470
|
if (arguments.length === 1) {
|
|
498
471
|
s = h.s;
|
|
499
472
|
v = h.v;
|
|
500
473
|
h = h.h;
|
|
501
474
|
}
|
|
502
|
-
|
|
503
475
|
i = Math.floor(h * 6);
|
|
504
476
|
f = h * 6 - i;
|
|
505
477
|
p = v * (1 - s);
|
|
506
478
|
q = v * (1 - f * s);
|
|
507
479
|
t = v * (1 - (1 - f) * s);
|
|
508
|
-
|
|
509
480
|
switch (i % 6) {
|
|
510
481
|
case 0:
|
|
511
482
|
r = v, g = t, b = p;
|
|
512
483
|
break;
|
|
513
|
-
|
|
514
484
|
case 1:
|
|
515
485
|
r = q, g = v, b = p;
|
|
516
486
|
break;
|
|
517
|
-
|
|
518
487
|
case 2:
|
|
519
488
|
r = p, g = v, b = t;
|
|
520
489
|
break;
|
|
521
|
-
|
|
522
490
|
case 3:
|
|
523
491
|
r = p, g = q, b = v;
|
|
524
492
|
break;
|
|
525
|
-
|
|
526
493
|
case 4:
|
|
527
494
|
r = t, g = p, b = v;
|
|
528
495
|
break;
|
|
529
|
-
|
|
530
496
|
case 5:
|
|
531
497
|
r = v, g = p, b = q;
|
|
532
498
|
break;
|
|
533
499
|
}
|
|
534
|
-
|
|
535
500
|
return {
|
|
536
501
|
r: Math.round(r * 255),
|
|
537
502
|
g: Math.round(g * 255),
|
|
@@ -556,19 +521,14 @@ export function processColorInitially(color) {
|
|
|
556
521
|
if (color === null || color === undefined || typeof color === 'number') {
|
|
557
522
|
return color;
|
|
558
523
|
}
|
|
559
|
-
|
|
560
524
|
let normalizedColor = normalizeColor(color);
|
|
561
|
-
|
|
562
525
|
if (normalizedColor === null || normalizedColor === undefined) {
|
|
563
526
|
return undefined;
|
|
564
527
|
}
|
|
565
|
-
|
|
566
528
|
if (typeof normalizedColor !== 'number') {
|
|
567
529
|
return null;
|
|
568
530
|
}
|
|
569
|
-
|
|
570
531
|
normalizedColor = (normalizedColor << 24 | normalizedColor >>> 8) >>> 0; // argb
|
|
571
|
-
|
|
572
532
|
return normalizedColor;
|
|
573
533
|
}
|
|
574
534
|
export function isColor(value) {
|
|
@@ -577,22 +537,18 @@ export function isColor(value) {
|
|
|
577
537
|
if (typeof value !== 'string') {
|
|
578
538
|
return false;
|
|
579
539
|
}
|
|
580
|
-
|
|
581
540
|
return processColorInitially(value) != null;
|
|
582
541
|
}
|
|
583
542
|
export function processColor(color) {
|
|
584
543
|
'worklet';
|
|
585
544
|
|
|
586
545
|
let normalizedColor = processColorInitially(color);
|
|
587
|
-
|
|
588
546
|
if (normalizedColor === null || normalizedColor === undefined) {
|
|
589
547
|
return undefined;
|
|
590
548
|
}
|
|
591
|
-
|
|
592
549
|
if (typeof normalizedColor !== 'number') {
|
|
593
550
|
return null;
|
|
594
551
|
}
|
|
595
|
-
|
|
596
552
|
if (Platform.OS === 'android') {
|
|
597
553
|
// Android use 32 bit *signed* integer to represent the color
|
|
598
554
|
// We utilize the fact that bitwise operations in JS also operates on
|
|
@@ -600,14 +556,12 @@ export function processColor(color) {
|
|
|
600
556
|
// *unsigned* to *signed* 32bit int that way.
|
|
601
557
|
normalizedColor = normalizedColor | 0x0;
|
|
602
558
|
}
|
|
603
|
-
|
|
604
559
|
return normalizedColor;
|
|
605
560
|
}
|
|
606
561
|
export function convertToRGBA(color) {
|
|
607
562
|
'worklet';
|
|
608
563
|
|
|
609
564
|
const processedColor = processColorInitially(color); // argb;
|
|
610
|
-
|
|
611
565
|
const a = (processedColor >>> 24) / 255;
|
|
612
566
|
const r = (processedColor << 8 >>> 24) / 255;
|
|
613
567
|
const g = (processedColor << 16 >>> 24) / 255;
|
|
@@ -624,11 +578,9 @@ export function toLinearSpace(RGBA) {
|
|
|
624
578
|
|
|
625
579
|
let gamma = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2.2;
|
|
626
580
|
const res = [];
|
|
627
|
-
|
|
628
581
|
for (let i = 0; i < 3; ++i) {
|
|
629
582
|
res.push(Math.pow(RGBA[i], gamma));
|
|
630
583
|
}
|
|
631
|
-
|
|
632
584
|
res.push(RGBA[3]);
|
|
633
585
|
return res;
|
|
634
586
|
}
|
|
@@ -637,11 +589,9 @@ export function toGammaSpace(RGBA) {
|
|
|
637
589
|
|
|
638
590
|
let gamma = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2.2;
|
|
639
591
|
const res = [];
|
|
640
|
-
|
|
641
592
|
for (let i = 0; i < 3; ++i) {
|
|
642
593
|
res.push(Math.pow(RGBA[i], 1 / gamma));
|
|
643
594
|
}
|
|
644
|
-
|
|
645
595
|
res.push(RGBA[3]);
|
|
646
596
|
return res;
|
|
647
597
|
}
|