react-ui-animate 3.0.0-rc.0 → 3.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animation/core/helpers/isDefined.d.ts +1 -1
- package/dist/animation/core/helpers/isFluidValue.d.ts +8 -4
- package/dist/animation/lib/interpolation.d.ts +20 -15
- package/dist/gestures/helpers/math.d.ts +1 -1
- package/dist/index.js +1 -2897
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/.vscode/settings.json +0 -3
- package/dist/animation/animationType.d.ts +0 -15
- package/dist/animation/core/animation/Animation.d.ts +0 -16
- package/dist/animation/core/animation/FluidValue.d.ts +0 -21
- package/dist/animation/core/animation/RequestAnimationFrame.d.ts +0 -8
- package/dist/animation/core/animation/SpringAnimation.d.ts +0 -41
- package/dist/animation/core/animation/TimingAnimation.d.ts +0 -35
- package/dist/animation/core/animation/TransitionValue.d.ts +0 -21
- package/dist/animation/core/helpers/camelToDash.d.ts +0 -7
- package/dist/animation/core/helpers/canInterpolate.d.ts +0 -11
- package/dist/animation/core/helpers/getAnimatableObject.d.ts +0 -22
- package/dist/animation/core/helpers/getNonAnimatableStyle.d.ts +0 -6
- package/dist/animation/core/react/Tags.d.ts +0 -3
- package/dist/animation/core/react/TransformStyles.d.ts +0 -8
- package/dist/animation/core/react/animated.d.ts +0 -29
- package/dist/animation/core/react/combineRefs.d.ts +0 -2
- package/dist/animation/core/react/functions/camelToDash.d.ts +0 -7
- package/dist/animation/core/react/functions/getAnimatableObject.d.ts +0 -22
- package/dist/animation/core/react/functions/getCleanProps.d.ts +0 -4
- package/dist/animation/core/react/functions/getCssValue.d.ts +0 -8
- package/dist/animation/core/react/functions/getNonAnimatableStyle.d.ts +0 -6
- package/dist/animation/core/react/functions/index.d.ts +0 -7
- package/dist/animation/core/react/functions/isDefined.d.ts +0 -6
- package/dist/animation/core/react/functions/isTransitionValue.d.ts +0 -6
- package/dist/animation/core/react/helpers/camelToDash.d.ts +0 -7
- package/dist/animation/core/react/helpers/canInterpolate.d.ts +0 -7
- package/dist/animation/core/react/helpers/getAnimatableObject.d.ts +0 -22
- package/dist/animation/core/react/helpers/getCleanProps.d.ts +0 -4
- package/dist/animation/core/react/helpers/getCssValue.d.ts +0 -8
- package/dist/animation/core/react/helpers/getNonAnimatableStyle.d.ts +0 -6
- package/dist/animation/core/react/helpers/index.d.ts +0 -7
- package/dist/animation/core/react/helpers/isDefined.d.ts +0 -6
- package/dist/animation/core/react/helpers/isFluidValue.d.ts +0 -6
- package/dist/animation/core/react/helpers/isTransitionValue.d.ts +0 -6
- package/dist/animation/core/react/useMounts.d.ts +0 -26
- package/dist/animation/core/react/useTransition.d.ts +0 -9
- package/dist/animation/core/react/useTransitions.d.ts +0 -11
- package/dist/animation/core/types/animation.d.ts +0 -54
- package/dist/animation/core/types/common.d.ts +0 -4
- package/dist/animation/core/types/fluid.d.ts +0 -19
- package/dist/animation/core/types/index.d.ts +0 -2
- package/dist/animation/getInitialConfig.d.ts +0 -3
- package/dist/animation/index.d.ts +0 -6
- package/dist/animation/interpolation.d.ts +0 -21
- package/dist/animation/modules/AnimatedBlock.d.ts +0 -8
- package/dist/animation/modules/AnimatedImage.d.ts +0 -8
- package/dist/animation/modules/AnimatedInline.d.ts +0 -8
- package/dist/animation/modules/MountedBlock.d.ts +0 -29
- package/dist/animation/modules/ScrollableBlock.d.ts +0 -21
- package/dist/animation/modules/TransitionBlock.d.ts +0 -17
- package/dist/animation/modules/index.d.ts +0 -6
- package/dist/animation/useAnimatedValue.d.ts +0 -22
- package/dist/animation/useMountedValue.d.ts +0 -15
- package/dist/gestures/eventAttacher.d.ts +0 -11
- package/dist/gestures/index.d.ts +0 -2
- package/dist/gestures/math.d.ts +0 -34
- package/dist/gestures/types.d.ts +0 -51
- package/dist/gestures/withDefault.d.ts +0 -4
- package/dist/utils/isDefined.d.ts +0 -1
- package/ecosystem.config.js +0 -12
- package/example/README.md +0 -46
- package/example/package-lock.json +0 -19597
- package/example/package.json +0 -45
- package/example/public/favicon.ico +0 -0
- package/example/public/index.html +0 -20
- package/example/public/logo192.png +0 -0
- package/example/public/logo512.png +0 -0
- package/example/public/manifest.json +0 -25
- package/example/public/robots.txt +0 -3
- package/example/src/App.tsx +0 -41
- package/example/src/components/Draggable.tsx +0 -46
- package/example/src/components/Gestures.tsx +0 -151
- package/example/src/components/Interpolation.tsx +0 -21
- package/example/src/components/Loop.tsx +0 -48
- package/example/src/components/MountedBlock.tsx +0 -25
- package/example/src/components/MouseMove.tsx +0 -59
- package/example/src/components/MultistageTransition.tsx +0 -34
- package/example/src/components/Scroll.tsx +0 -39
- package/example/src/components/ScrollableBlock.tsx +0 -27
- package/example/src/components/SnapTo.tsx +0 -55
- package/example/src/components/TransitionBlock.tsx +0 -37
- package/example/src/components/Wheel.tsx +0 -39
- package/example/src/components/index.ts +0 -18
- package/example/src/components/svgLine.tsx +0 -48
- package/example/src/components/useAnimatedValue.tsx +0 -57
- package/example/src/components/useMountedValue.tsx +0 -62
- package/example/src/index.css +0 -8
- package/example/src/index.tsx +0 -16
- package/example/tsconfig.json +0 -26
- package/rollup.config.mjs +0 -18
- package/src/animation/core/controllers/Animation.ts +0 -27
- package/src/animation/core/controllers/FluidValue.ts +0 -97
- package/src/animation/core/controllers/RequestAnimationFrame.ts +0 -13
- package/src/animation/core/controllers/SpringAnimation.ts +0 -218
- package/src/animation/core/controllers/TimingAnimation.ts +0 -152
- package/src/animation/core/easing/Bezier.ts +0 -146
- package/src/animation/core/easing/Easing.ts +0 -132
- package/src/animation/core/helpers/camelCaseToKebabCase.ts +0 -10
- package/src/animation/core/helpers/getCleanProps.ts +0 -16
- package/src/animation/core/helpers/getCssValue.ts +0 -60
- package/src/animation/core/helpers/index.ts +0 -5
- package/src/animation/core/helpers/isDefined.ts +0 -14
- package/src/animation/core/helpers/isFluidValue.ts +0 -11
- package/src/animation/core/index.ts +0 -16
- package/src/animation/core/interpolation/Colors.ts +0 -232
- package/src/animation/core/interpolation/Interpolation.ts +0 -395
- package/src/animation/core/interpolation/__tests__/Colors.test.tsx +0 -35
- package/src/animation/core/react/fluid.ts +0 -197
- package/src/animation/core/react/makeFluid.ts +0 -294
- package/src/animation/core/react/transforms.ts +0 -90
- package/src/animation/core/react/useFluidValue.ts +0 -43
- package/src/animation/core/react/useMount.ts +0 -58
- package/src/animation/core/types/animation.d.ts +0 -56
- package/src/animation/core/types/common.d.ts +0 -4
- package/src/animation/core/types/fluid.d.ts +0 -38
- package/src/animation/lib/animationType.ts +0 -17
- package/src/animation/lib/getInitialConfig.ts +0 -61
- package/src/animation/lib/index.ts +0 -12
- package/src/animation/lib/interpolation.ts +0 -47
- package/src/animation/lib/modules/AnimatedBlock.ts +0 -8
- package/src/animation/lib/modules/AnimatedImage.ts +0 -8
- package/src/animation/lib/modules/AnimatedInline.ts +0 -8
- package/src/animation/lib/modules/MountedBlock.tsx +0 -51
- package/src/animation/lib/modules/ScrollableBlock.tsx +0 -68
- package/src/animation/lib/modules/TransitionBlock.tsx +0 -28
- package/src/animation/lib/modules/index.ts +0 -6
- package/src/animation/lib/useAnimatedValue.ts +0 -60
- package/src/animation/lib/useMountedValue.ts +0 -18
- package/src/gestures/controllers/DragGesture.ts +0 -178
- package/src/gestures/controllers/Gesture.ts +0 -54
- package/src/gestures/controllers/MouseMoveGesture.ts +0 -111
- package/src/gestures/controllers/ScrollGesture.ts +0 -107
- package/src/gestures/controllers/WheelGesture.ts +0 -123
- package/src/gestures/controllers/index.ts +0 -4
- package/src/gestures/helpers/eventAttacher.ts +0 -67
- package/src/gestures/helpers/index.ts +0 -1
- package/src/gestures/helpers/math.ts +0 -120
- package/src/gestures/helpers/withDefault.ts +0 -3
- package/src/gestures/hooks/index.ts +0 -5
- package/src/gestures/hooks/useDrag.ts +0 -14
- package/src/gestures/hooks/useGesture.ts +0 -38
- package/src/gestures/hooks/useMouseMove.ts +0 -11
- package/src/gestures/hooks/useRecognizer.ts +0 -59
- package/src/gestures/hooks/useScroll.ts +0 -11
- package/src/gestures/hooks/useWheel.ts +0 -11
- package/src/gestures/types/index.d.ts +0 -49
- package/src/hooks/index.ts +0 -3
- package/src/hooks/useMeasure.ts +0 -132
- package/src/hooks/useOutsideClick.ts +0 -36
- package/src/hooks/useWindowDimension.ts +0 -58
- package/src/index.ts +0 -42
- package/src/utils/delay.ts +0 -9
- package/src/utils/index.ts +0 -1
- package/tsconfig.json +0 -24
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-ui-animate",
|
|
3
|
-
"version": "3.0.0-rc.
|
|
3
|
+
"version": "3.0.0-rc.2",
|
|
4
4
|
"description": "React library for gestures and animation",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"peerDependencies": {
|
|
7
7
|
"react": ">=16.8.0 || >=17.0.0 || >=18.0.0"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
10
11
|
"@types/jest": "^29.5.12",
|
|
11
12
|
"@types/node": "^20.14.9",
|
|
12
13
|
"@types/react": "^18.3.3",
|
package/.vscode/settings.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare const AnimationConfigUtils: {
|
|
2
|
-
ELASTIC: import("./core").FluidValueConfig;
|
|
3
|
-
BOUNCE: import("./core").FluidValueConfig;
|
|
4
|
-
EASE: import("./core").FluidValueConfig;
|
|
5
|
-
STIFF: import("./core").FluidValueConfig;
|
|
6
|
-
WOOBLE: import("./core").FluidValueConfig;
|
|
7
|
-
EASE_IN: import("./core").FluidValueConfig;
|
|
8
|
-
EASE_OUT: import("./core").FluidValueConfig;
|
|
9
|
-
EASE_IN_OUT: import("./core").FluidValueConfig;
|
|
10
|
-
POWER1: import("./core").FluidValueConfig;
|
|
11
|
-
POWER2: import("./core").FluidValueConfig;
|
|
12
|
-
POWER3: import("./core").FluidValueConfig;
|
|
13
|
-
POWER4: import("./core").FluidValueConfig;
|
|
14
|
-
LINEAR: import("./core").FluidValueConfig;
|
|
15
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ResultType } from '../types/animation';
|
|
2
|
-
/**
|
|
3
|
-
* Base Animation class
|
|
4
|
-
*/
|
|
5
|
-
export declare class Animation {
|
|
6
|
-
_active: boolean;
|
|
7
|
-
_onEnd: any;
|
|
8
|
-
/**
|
|
9
|
-
* it is necessary to add _onRest function as well
|
|
10
|
-
* because _onEnd is always re-assigned with onUpdate callback
|
|
11
|
-
* so that _onRest function is not fired, so we have to duplicate it
|
|
12
|
-
*/
|
|
13
|
-
_onRest?: any;
|
|
14
|
-
_debounceOnEnd(result: ResultType): void;
|
|
15
|
-
stop(): void;
|
|
16
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Length, ResultType, SubscribeFn, FluidValueConfig, OnUpdateFn, AssignValue } from '../types/animation';
|
|
2
|
-
import { Fn } from '../types/common';
|
|
3
|
-
export declare class FluidValue {
|
|
4
|
-
_subscribe: SubscribeFn;
|
|
5
|
-
_value: Length;
|
|
6
|
-
_config?: FluidValueConfig;
|
|
7
|
-
_currentValue: {
|
|
8
|
-
current: Length;
|
|
9
|
-
};
|
|
10
|
-
_subscriptions: Map<{
|
|
11
|
-
uuid: number;
|
|
12
|
-
property: string;
|
|
13
|
-
}, OnUpdateFn>;
|
|
14
|
-
get: () => Length;
|
|
15
|
-
constructor(initialValue: Length, config?: FluidValueConfig);
|
|
16
|
-
/**
|
|
17
|
-
* Animates from initial value to updated value, determines the transition type `multistage`
|
|
18
|
-
* or `singlestage` according to updatedValue
|
|
19
|
-
*/
|
|
20
|
-
setValue(updatedValue: AssignValue, config?: FluidValueConfig, callback?: Fn<ResultType, void>): void;
|
|
21
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Animation } from './Animation';
|
|
2
|
-
import type { FluidValueConfig, ResultType } from '../types/animation';
|
|
3
|
-
/**
|
|
4
|
-
* Class implementing spring based animation
|
|
5
|
-
*/
|
|
6
|
-
export declare class SpringAnimation extends Animation {
|
|
7
|
-
_overshootClamping: boolean;
|
|
8
|
-
_restDisplacementThreshold: number;
|
|
9
|
-
_restSpeedThreshold: number;
|
|
10
|
-
_initialVelocity?: number;
|
|
11
|
-
_lastVelocity: number;
|
|
12
|
-
_startPosition: number;
|
|
13
|
-
_lastPosition: number;
|
|
14
|
-
_position: number;
|
|
15
|
-
_fromValue: number;
|
|
16
|
-
_toValue: any;
|
|
17
|
-
_mass: number;
|
|
18
|
-
_tension: number;
|
|
19
|
-
_friction: number;
|
|
20
|
-
_lastTime: number;
|
|
21
|
-
_onFrame: (value: number) => void;
|
|
22
|
-
_animationFrame: any;
|
|
23
|
-
_timeout: any;
|
|
24
|
-
_delay: number;
|
|
25
|
-
_onRest?: (value: ResultType) => void;
|
|
26
|
-
_onChange?: (value: number) => void;
|
|
27
|
-
constructor({ initialPosition, config, }: {
|
|
28
|
-
initialPosition: number;
|
|
29
|
-
config?: Omit<FluidValueConfig, 'duration' | 'easing'>;
|
|
30
|
-
});
|
|
31
|
-
onChange(value: number): void;
|
|
32
|
-
onUpdate(): void;
|
|
33
|
-
stop(): void;
|
|
34
|
-
set(toValue: number): void;
|
|
35
|
-
start({ toValue, onFrame, previousAnimation, onEnd, }: {
|
|
36
|
-
toValue: number;
|
|
37
|
-
onFrame: (value: number) => void;
|
|
38
|
-
previousAnimation?: SpringAnimation;
|
|
39
|
-
onEnd?: (result: ResultType) => void;
|
|
40
|
-
}): void;
|
|
41
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Animation } from './Animation';
|
|
2
|
-
import type { FluidValueConfig, ResultType } from '../types/animation';
|
|
3
|
-
/**
|
|
4
|
-
* Class implementing timing based animation
|
|
5
|
-
*/
|
|
6
|
-
export declare class TimingAnimation extends Animation {
|
|
7
|
-
_startTime: number;
|
|
8
|
-
_fromValue: number;
|
|
9
|
-
_toValue: any;
|
|
10
|
-
_duration: number;
|
|
11
|
-
_easing: (value: number) => number;
|
|
12
|
-
_onFrame: (value: number) => void;
|
|
13
|
-
_animationFrame: any;
|
|
14
|
-
_timeout: any;
|
|
15
|
-
_lastPosition: number;
|
|
16
|
-
_position: number;
|
|
17
|
-
_delay: number;
|
|
18
|
-
_tempDuration: number;
|
|
19
|
-
_onRest?: (value: ResultType) => void;
|
|
20
|
-
_onChange?: (value: number) => void;
|
|
21
|
-
constructor({ initialPosition, config, }: {
|
|
22
|
-
initialPosition: number;
|
|
23
|
-
config?: Omit<FluidValueConfig, 'mass' | 'friction' | 'tension'>;
|
|
24
|
-
});
|
|
25
|
-
onChange(value: number): void;
|
|
26
|
-
onUpdate(): void;
|
|
27
|
-
stop(): void;
|
|
28
|
-
set(toValue: number): void;
|
|
29
|
-
start({ toValue, onFrame, previousAnimation, onEnd, }: {
|
|
30
|
-
toValue: number;
|
|
31
|
-
onFrame: (value: number) => void;
|
|
32
|
-
previousAnimation?: TimingAnimation;
|
|
33
|
-
onEnd?: (result: ResultType) => void;
|
|
34
|
-
}): void;
|
|
35
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Length, ResultType, SubscribeFn, TransitionValueConfig, OnUpdateFn, AssignValue } from '../types/animation';
|
|
2
|
-
import { Fn } from '../types/common';
|
|
3
|
-
export declare class TransitionValue {
|
|
4
|
-
_subscribe: SubscribeFn;
|
|
5
|
-
_value: Length;
|
|
6
|
-
_config?: TransitionValueConfig;
|
|
7
|
-
_currentValue: {
|
|
8
|
-
current: Length;
|
|
9
|
-
};
|
|
10
|
-
_subscriptions: Map<{
|
|
11
|
-
uuid: number;
|
|
12
|
-
property: string;
|
|
13
|
-
}, OnUpdateFn>;
|
|
14
|
-
get: () => Length;
|
|
15
|
-
constructor(initialValue: Length, config?: TransitionValueConfig);
|
|
16
|
-
/**
|
|
17
|
-
* Animates from initial value to updated value, determines the transition type `multistage`
|
|
18
|
-
* or `singlestage` according to updatedValue
|
|
19
|
-
*/
|
|
20
|
-
setValue(updatedValue: AssignValue, config?: TransitionValueConfig, callback?: Fn<ResultType, void>): void;
|
|
21
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Determines if two values can be interpolated.
|
|
3
|
-
* This function checks if two values, either numbers or strings,
|
|
4
|
-
* can be interpolated by ensuring they are of the same type and, in the case of strings,
|
|
5
|
-
* that they are compatible for interpolation based on processed color values.
|
|
6
|
-
*
|
|
7
|
-
* @param previousValue - The previous value to compare. Can be a number or a string.
|
|
8
|
-
* @param newValue - The new value to compare. Can be a number or a string.
|
|
9
|
-
* @returns True if interpolation is possible, false otherwise.
|
|
10
|
-
*/
|
|
11
|
-
export declare function canInterpolate(previousValue: number | string, newValue: number | string): boolean;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { ExtrapolateConfig } from '../interpolation/Interpolation';
|
|
2
|
-
import { FluidValue } from '../controllers/FluidValue';
|
|
3
|
-
type PropertyType = 'style' | 'props';
|
|
4
|
-
export type AnimationObject = {
|
|
5
|
-
propertyType: PropertyType;
|
|
6
|
-
property: string;
|
|
7
|
-
animatable: boolean;
|
|
8
|
-
isInterpolation: boolean;
|
|
9
|
-
interpolationConfig: {
|
|
10
|
-
inputRange: Array<number>;
|
|
11
|
-
outputRange: Array<number | string>;
|
|
12
|
-
extrapolateConfig?: ExtrapolateConfig;
|
|
13
|
-
};
|
|
14
|
-
} & FluidValue;
|
|
15
|
-
/**
|
|
16
|
-
* Function to get the array of animatable objects
|
|
17
|
-
* @param propertyType - which property type "props" or "style"
|
|
18
|
-
*/
|
|
19
|
-
export declare function getAnimatableObject(propertyType: PropertyType, propertiesObject: {
|
|
20
|
-
[key: string]: any;
|
|
21
|
-
}): Array<AnimationObject>;
|
|
22
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* getNonAnimatableStyle function returns the non-animatable style object
|
|
3
|
-
* @param style - CSSProperties
|
|
4
|
-
* @returns - non-animatable CSSProperties
|
|
5
|
-
*/
|
|
6
|
-
export declare function getNonAnimatableStyle(style: React.CSSProperties, transformObjectRef: React.MutableRefObject<any>): any;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* style keys which can be accepted by animated component
|
|
3
|
-
*/
|
|
4
|
-
export declare const styleTrasformKeys: readonly ["perspective", "translate", "translateX", "translateY", "translateZ", "scale", "scaleX", "scaleY", "scaleZ", "rotate", "rotateX", "rotateY", "rotateZ", "skew", "skewX", "skewY"];
|
|
5
|
-
/**
|
|
6
|
-
* getTransform function returns transform string from style object
|
|
7
|
-
*/
|
|
8
|
-
export declare function getTransform(style: any): any;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { FluidValue } from '../types';
|
|
2
|
-
import { styleTrasformKeys } from './TransformStyles';
|
|
3
|
-
export type AnimatedCSSProperties = {
|
|
4
|
-
[key in keyof React.CSSProperties]: React.CSSProperties[key] | any;
|
|
5
|
-
} & {
|
|
6
|
-
[key in (typeof styleTrasformKeys)[number]]?: number | string | FluidValue | any;
|
|
7
|
-
};
|
|
8
|
-
export type AnimatedHTMLAttributes<T> = {
|
|
9
|
-
[property in keyof React.HTMLAttributes<T>]: React.HTMLAttributes<T>[property] | FluidValue | any;
|
|
10
|
-
};
|
|
11
|
-
export type AnimatedSVGAttributes<T> = {
|
|
12
|
-
[property in keyof React.SVGAttributes<T>]: React.SVGAttributes<T>[property] | FluidValue | any;
|
|
13
|
-
};
|
|
14
|
-
export type AnimatedProps<T> = Omit<AnimatedHTMLAttributes<T> & AnimatedSVGAttributes<T>, 'style'> & {
|
|
15
|
-
style?: AnimatedCSSProperties;
|
|
16
|
-
};
|
|
17
|
-
type WrappedComponentOrTag = React.ComponentType<any> | keyof JSX.IntrinsicElements;
|
|
18
|
-
/**
|
|
19
|
-
* Higher order component to make any component animatable
|
|
20
|
-
* @param WrapperComponent
|
|
21
|
-
*/
|
|
22
|
-
export declare function makeAnimatedComponent<C extends WrappedComponentOrTag>(WrapperComponent: C): import("react").ForwardRefExoticComponent<Omit<AnimatedHTMLAttributes<C> & AnimatedSVGAttributes<C>, "style"> & {
|
|
23
|
-
style?: AnimatedCSSProperties;
|
|
24
|
-
} & import("react").RefAttributes<unknown>>;
|
|
25
|
-
type WithAnimated = {
|
|
26
|
-
[element in keyof JSX.IntrinsicElements]: React.ComponentType<AnimatedProps<element>>;
|
|
27
|
-
} & any;
|
|
28
|
-
export declare const animated: WithAnimated;
|
|
29
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { ExtrapolateConfig } from '../../interpolation/Interpolation';
|
|
2
|
-
import type { FluidValue } from '../../types';
|
|
3
|
-
type PropertyType = 'style' | 'props';
|
|
4
|
-
export type AnimationObject = {
|
|
5
|
-
propertyType: PropertyType;
|
|
6
|
-
property: string;
|
|
7
|
-
animatable: boolean;
|
|
8
|
-
isInterpolation: boolean;
|
|
9
|
-
interpolationConfig: {
|
|
10
|
-
inputRange: Array<number>;
|
|
11
|
-
outputRange: Array<number | string>;
|
|
12
|
-
extrapolateConfig?: ExtrapolateConfig;
|
|
13
|
-
};
|
|
14
|
-
} & FluidValue;
|
|
15
|
-
/**
|
|
16
|
-
* Function to get the array of animatable objects
|
|
17
|
-
* @param propertyType - which property type "props" or "style"
|
|
18
|
-
*/
|
|
19
|
-
export declare function getAnimatableObject(propertyType: PropertyType, propertiesObject: {
|
|
20
|
-
[key: string]: any;
|
|
21
|
-
}): Array<AnimationObject>;
|
|
22
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* getCssValue() function to get css value with unit or without unit
|
|
3
|
-
* it is only for style property - it cannot be used with transform keys
|
|
4
|
-
* @param property - style property
|
|
5
|
-
* @param value - style value
|
|
6
|
-
* @returns - value with unit or without unit
|
|
7
|
-
*/
|
|
8
|
-
export declare function getCssValue(property: string, value: number | string): string | number;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* getNonAnimatableStyle function returns the non-animatable style object
|
|
3
|
-
* @param style - CSSProperties
|
|
4
|
-
* @returns - non-animatable CSSProperties
|
|
5
|
-
*/
|
|
6
|
-
export declare function getNonAnimatableStyle(style: React.CSSProperties, transformObjectRef: React.MutableRefObject<any>): any;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Determines if two values can be interpolated.
|
|
3
|
-
* @param previousValue - The previous value to compare.
|
|
4
|
-
* @param newValue - The new value to compare.
|
|
5
|
-
* @returns True if interpolation is possible, false otherwise.
|
|
6
|
-
*/
|
|
7
|
-
export declare function canInterpolate(previousValue: number | string, newValue: number | string): boolean;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { ExtrapolateConfig } from '../../interpolation/Interpolation';
|
|
2
|
-
import { FluidValue } from '../../controllers/FluidValue';
|
|
3
|
-
type PropertyType = 'style' | 'props';
|
|
4
|
-
export type AnimationObject = {
|
|
5
|
-
propertyType: PropertyType;
|
|
6
|
-
property: string;
|
|
7
|
-
animatable: boolean;
|
|
8
|
-
isInterpolation: boolean;
|
|
9
|
-
interpolationConfig: {
|
|
10
|
-
inputRange: Array<number>;
|
|
11
|
-
outputRange: Array<number | string>;
|
|
12
|
-
extrapolateConfig?: ExtrapolateConfig;
|
|
13
|
-
};
|
|
14
|
-
} & FluidValue;
|
|
15
|
-
/**
|
|
16
|
-
* Function to get the array of animatable objects
|
|
17
|
-
* @param propertyType - which property type "props" or "style"
|
|
18
|
-
*/
|
|
19
|
-
export declare function getAnimatableObject(propertyType: PropertyType, propertiesObject: {
|
|
20
|
-
[key: string]: any;
|
|
21
|
-
}): Array<AnimationObject>;
|
|
22
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* getCssValue() function to get css value with unit or without unit
|
|
3
|
-
* it is only for style property - it cannot be used with transform keys
|
|
4
|
-
* @param property - style property
|
|
5
|
-
* @param value - style value
|
|
6
|
-
* @returns - value with unit or without unit
|
|
7
|
-
*/
|
|
8
|
-
export declare function getCssValue(property: string, value: number | string): string | number;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* getNonAnimatableStyle function returns the non-animatable style object
|
|
3
|
-
* @param style - CSSProperties
|
|
4
|
-
* @returns - non-animatable CSSProperties
|
|
5
|
-
*/
|
|
6
|
-
export declare function getNonAnimatableStyle(style: React.CSSProperties, transformObjectRef: React.MutableRefObject<any>): any;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { TransitionValue } from '../animation/TransitionValue';
|
|
2
|
-
import type { AssignValue, Length, TransitionValueConfig } from '../types/animation';
|
|
3
|
-
export interface UseMountsConfig<T> {
|
|
4
|
-
from: T;
|
|
5
|
-
enter: Partial<{
|
|
6
|
-
[key in keyof T]: AssignValue;
|
|
7
|
-
}>;
|
|
8
|
-
exit: Partial<{
|
|
9
|
-
[key in keyof T]: AssignValue;
|
|
10
|
-
}>;
|
|
11
|
-
enterConfig?: TransitionValueConfig;
|
|
12
|
-
exitConfig?: TransitionValueConfig;
|
|
13
|
-
config?: TransitionValueConfig;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* `useMounts`
|
|
17
|
-
*
|
|
18
|
-
* applies mounting and unmounting of a component according to state change
|
|
19
|
-
* applying transitions for multiple keys
|
|
20
|
-
*
|
|
21
|
-
* @param state - boolean indicating mount state of a component
|
|
22
|
-
* @param config - the config object `UseMountsConfig`
|
|
23
|
-
*/
|
|
24
|
-
export declare const useMounts: <T extends {
|
|
25
|
-
[key: string]: Length;
|
|
26
|
-
}>(state: boolean, config: UseMountsConfig<T>) => (callback: (animation: { [key in keyof T]?: TransitionValue; }, mounted: boolean) => React.ReactNode) => import("react").ReactNode;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FluidValue } from '../controllers/FluidValue';
|
|
2
|
-
import type { FluidValueConfig, Length, AssignValue, OnUpdateCallback } from '../types/animation';
|
|
3
|
-
/**
|
|
4
|
-
* useTransition
|
|
5
|
-
*
|
|
6
|
-
* @param value - initial value
|
|
7
|
-
* @param config - the config object for `FluidValue`
|
|
8
|
-
*/
|
|
9
|
-
export declare const useTransition: (value: Length, config?: FluidValueConfig) => [FluidValue, (updateValue: AssignValue, config?: FluidValueConfig, callback?: OnUpdateCallback) => void];
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { TransitionValue } from '../animation/TransitionValue';
|
|
2
|
-
import type { TransitionValueConfig, Length, AssignValue, OnUpdateCallback } from '../types/animation';
|
|
3
|
-
/**
|
|
4
|
-
* useTransitions hook for multiple values transition
|
|
5
|
-
*
|
|
6
|
-
* @param values - object with different keys
|
|
7
|
-
* @param config - the config object for `TransitionValue`
|
|
8
|
-
*/
|
|
9
|
-
export declare const useTransitions: <T extends {
|
|
10
|
-
[key: string]: Length;
|
|
11
|
-
}>(values: T, config?: TransitionValueConfig) => [{ [key in keyof T]?: TransitionValue; }, (updateValues: Partial<{ [key in keyof T]?: AssignValue; }>, config?: TransitionValueConfig, callback?: OnUpdateCallback) => void];
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { Fn } from './common';
|
|
2
|
-
/**
|
|
3
|
-
* Base unit which is accepted by `TransitionValue`
|
|
4
|
-
*/
|
|
5
|
-
export type Length = number | string;
|
|
6
|
-
/**
|
|
7
|
-
* Object passed as an argument on `onRest` function
|
|
8
|
-
*/
|
|
9
|
-
export type ResultType = {
|
|
10
|
-
finished: boolean;
|
|
11
|
-
value: number;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Function read by `animated` hoc to determine whether it
|
|
15
|
-
* can be animated or not
|
|
16
|
-
*/
|
|
17
|
-
export type SubscribeFn = (onUpdate: OnUpdateFn, property: string, uuid: number) => void;
|
|
18
|
-
/**
|
|
19
|
-
* Configuration object for `TransitionValue`
|
|
20
|
-
*/
|
|
21
|
-
export interface TransitionValueConfig {
|
|
22
|
-
mass?: number;
|
|
23
|
-
tension?: number;
|
|
24
|
-
friction?: number;
|
|
25
|
-
duration?: number;
|
|
26
|
-
easing?: Fn<number, number>;
|
|
27
|
-
immediate?: boolean;
|
|
28
|
-
delay?: number;
|
|
29
|
-
restDistance?: number;
|
|
30
|
-
onChange?: Fn<number, void>;
|
|
31
|
-
onRest?: Fn<ResultType, void>;
|
|
32
|
-
onStart?: Fn<number, void>;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* FluidValue
|
|
36
|
-
*/
|
|
37
|
-
export type FluidValue = {
|
|
38
|
-
_subscribe: SubscribeFn;
|
|
39
|
-
_value: Length;
|
|
40
|
-
_currentValue: {
|
|
41
|
-
current: Length;
|
|
42
|
-
};
|
|
43
|
-
_config?: TransitionValueConfig;
|
|
44
|
-
get: () => Length;
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Object which can be assigned to animate
|
|
48
|
-
*/
|
|
49
|
-
export type AssignValue = Length | Fn<(next: Length, config?: TransitionValueConfig) => Promise<any>, void>;
|
|
50
|
-
export type OnUpdateCallback = Fn<ResultType, void>;
|
|
51
|
-
/**
|
|
52
|
-
* Function to start the animation (it starts the already subscribed animation)
|
|
53
|
-
*/
|
|
54
|
-
export type OnUpdateFn = (updatedValue: AssignValue, config?: TransitionValueConfig, callback?: OnUpdateCallback) => void;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { CSSProperties, HTMLAttributes, SVGAttributes, ComponentType } from 'react';
|
|
2
|
-
import { FluidValue } from '../controllers/FluidValue';
|
|
3
|
-
import { styleTrasformKeys } from '../react/transforms';
|
|
4
|
-
export type FluidTypes = 'spring' | 'timing';
|
|
5
|
-
export type FluidCSSProperties = {
|
|
6
|
-
[key in keyof CSSProperties]: CSSProperties[key];
|
|
7
|
-
} & {
|
|
8
|
-
[key in (typeof styleTrasformKeys)[number]]?: number | string | FluidValue;
|
|
9
|
-
};
|
|
10
|
-
export type FluidHTMLAttributes<T> = {
|
|
11
|
-
[property in keyof HTMLAttributes<T>]: HTMLAttributes<T>[property] | FluidValue;
|
|
12
|
-
};
|
|
13
|
-
export type FluidSVGAttributes<T> = {
|
|
14
|
-
[property in keyof SVGAttributes<T>]: SVGAttributes<T>[property] | FluidValue;
|
|
15
|
-
};
|
|
16
|
-
export type FluidProps<T> = Omit<FluidHTMLAttributes<T> & FluidSVGAttributes<T>, 'style'> & {
|
|
17
|
-
style?: FluidCSSProperties;
|
|
18
|
-
};
|
|
19
|
-
export type WrappedComponentOrTag = ComponentType<HTMLAttributes<HTMLElement>> | keyof JSX.IntrinsicElements;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { FluidValueConfig } from './core';
|
|
2
|
-
export type InitialConfigType = 'linear' | 'easein' | 'easeout' | 'easeinout' | 'ease' | 'power1' | 'power2' | 'power3' | 'power4' | 'elastic' | 'stiff' | 'wooble' | 'bounce';
|
|
3
|
-
export declare const getInitialConfig: (animationType?: InitialConfigType) => FluidValueConfig;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export * from './interpolation';
|
|
2
|
-
export * from './modules';
|
|
3
|
-
export { useAnimatedValue, ValueType, UseAnimatedValueConfig, } from './useAnimatedValue';
|
|
4
|
-
export { useMountedValue } from './useMountedValue';
|
|
5
|
-
export * from './animationType';
|
|
6
|
-
export * from './modules';
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ExtrapolateConfig, FluidValue } from './core';
|
|
2
|
-
import { ValueType } from './useAnimatedValue';
|
|
3
|
-
/**
|
|
4
|
-
* interpolate functions maps input range to given output range
|
|
5
|
-
* @param value - number | TransitionValue
|
|
6
|
-
* @param inputRange - Array<number>
|
|
7
|
-
* @param outputRange - Array<number | string>
|
|
8
|
-
* @param extrapolateConfig - "clamp" | "identity" | "extend"
|
|
9
|
-
* @returns - number | TransitionValue
|
|
10
|
-
*/
|
|
11
|
-
export declare function interpolate(value: number | FluidValue | ValueType, inputRange: Array<number>, outputRange: Array<number | string>, extrapolateConfig?: ExtrapolateConfig): any;
|
|
12
|
-
/**
|
|
13
|
-
* bInterpolate functions maps input range [0, 1] to given [minOutput, maxOutput]
|
|
14
|
-
* sorthand function to interpolate input range [0, 1]
|
|
15
|
-
* @param value - number | TransitionValue
|
|
16
|
-
* @param minOutput - number | string
|
|
17
|
-
* @param maxOutput - number | string
|
|
18
|
-
* @param extrapolateConfig - "clamp" | "identity" | "extend"
|
|
19
|
-
* @returns - number | TransitionValue
|
|
20
|
-
*/
|
|
21
|
-
export declare function bInterpolate(value: number | FluidValue | ValueType, minOutput: number | string, maxOutput: number | string, extrapolateConfig?: ExtrapolateConfig): any;
|