react-ui-animate 1.2.1 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{animate → animation}/getInitialConfig.d.ts +0 -0
- package/dist/animation/index.d.ts +4 -0
- package/dist/{Interpolation.d.ts → animation/interpolation.d.ts} +0 -0
- package/dist/{Modules.d.ts → animation/modules.d.ts} +15 -0
- package/dist/{useAnimatedValue.d.ts → animation/useAnimatedValue.d.ts} +2 -2
- package/dist/{useMountedValue.d.ts → animation/useMountedValue.d.ts} +3 -3
- package/dist/gestures/controllers/DragGesture.d.ts +17 -0
- package/dist/gestures/controllers/Gesture.d.ts +20 -0
- package/dist/gestures/controllers/MouseMoveGesture.d.ts +13 -0
- package/dist/gestures/controllers/ScrollGesture.d.ts +14 -0
- package/dist/gestures/controllers/WheelGesture.d.ts +15 -0
- package/dist/gestures/controllers/index.d.ts +4 -0
- package/dist/gestures/eventAttacher.d.ts +11 -0
- package/dist/{animate → gestures}/hooks/index.d.ts +2 -4
- package/dist/gestures/hooks/useDrag.d.ts +4 -0
- package/dist/gestures/hooks/useGesture.d.ts +9 -0
- package/dist/gestures/hooks/useMouseMove.d.ts +4 -0
- package/dist/gestures/hooks/useRecognizer.d.ts +10 -0
- package/dist/gestures/hooks/useScroll.d.ts +4 -0
- package/dist/gestures/hooks/useWheel.d.ts +4 -0
- package/dist/gestures/index.d.ts +2 -0
- package/dist/{Math.d.ts → gestures/math.d.ts} +0 -0
- package/dist/{animate/Types.d.ts → gestures/types.d.ts} +17 -30
- package/dist/gestures/withDefault.d.ts +4 -0
- package/dist/hooks/index.d.ts +0 -4
- package/dist/hooks/useMeasure.d.ts +10 -1
- package/dist/hooks/useWindowDimension.d.ts +7 -1
- package/dist/index.d.ts +2 -5
- package/dist/index.js +848 -707
- package/dist/index.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/{animate → utils}/isDefined.d.ts +0 -0
- package/package.json +6 -3
- package/src/{getInitialConfig.ts → animation/getInitialConfig.ts} +0 -0
- package/src/animation/index.ts +4 -0
- package/src/{Interpolation.ts → animation/interpolation.ts} +0 -0
- package/src/{Modules.tsx → animation/modules.tsx} +26 -1
- package/src/{useAnimatedValue.ts → animation/useAnimatedValue.ts} +5 -8
- package/src/{useMountedValue.ts → animation/useMountedValue.ts} +4 -7
- package/src/gestures/controllers/DragGesture.ts +176 -0
- package/src/gestures/controllers/Gesture.ts +54 -0
- package/src/gestures/controllers/MouseMoveGesture.ts +111 -0
- package/src/gestures/controllers/ScrollGesture.ts +107 -0
- package/src/gestures/controllers/WheelGesture.ts +123 -0
- package/src/gestures/controllers/index.ts +4 -0
- package/src/gestures/eventAttacher.ts +67 -0
- package/src/gestures/hooks/index.ts +5 -0
- package/src/gestures/hooks/useDrag.ts +14 -0
- package/src/gestures/hooks/useGesture.ts +38 -0
- package/src/gestures/hooks/useMouseMove.ts +11 -0
- package/src/gestures/hooks/useRecognizer.ts +59 -0
- package/src/gestures/hooks/useScroll.ts +11 -0
- package/src/gestures/hooks/useWheel.ts +11 -0
- package/src/gestures/index.ts +2 -0
- package/src/{Math.ts → gestures/math.ts} +0 -0
- package/src/{Types.ts → gestures/types.ts} +19 -36
- package/src/gestures/withDefault.ts +3 -0
- package/src/hooks/index.ts +0 -4
- package/src/hooks/useMeasure.ts +11 -1
- package/src/hooks/useOutsideClick.ts +3 -2
- package/src/hooks/useWindowDimension.ts +7 -1
- package/src/index.ts +2 -5
- package/src/utils/index.ts +1 -0
- package/src/{isDefined.ts → utils/isDefined.ts} +0 -0
- package/tsconfig.json +1 -0
- package/dist/Types.d.ts +0 -64
- package/dist/animate/Interpolation.d.ts +0 -20
- package/dist/animate/Math.d.ts +0 -34
- package/dist/animate/Modules.d.ts +0 -32
- package/dist/animate/controllers/EventAttacher.d.ts +0 -8
- package/dist/animate/controllers/index.d.ts +0 -1
- package/dist/animate/hooks/useDrag.d.ts +0 -5
- package/dist/animate/hooks/useMeasure.d.ts +0 -5
- package/dist/animate/hooks/useMouseMove.d.ts +0 -5
- package/dist/animate/hooks/useOutsideClick.d.ts +0 -2
- package/dist/animate/hooks/useScroll.d.ts +0 -5
- package/dist/animate/hooks/useWheel.d.ts +0 -5
- package/dist/animate/hooks/useWindowDimension.d.ts +0 -3
- package/dist/animate/index.d.ts +0 -8
- package/dist/animate/useAnimatedValue.d.ts +0 -30
- package/dist/animate/useMountedValue.d.ts +0 -22
- package/dist/controllers/EventAttacher.d.ts +0 -8
- package/dist/controllers/index.d.ts +0 -1
- package/dist/core/Animation.d.ts +0 -13
- package/dist/core/Bezier.d.ts +0 -8
- package/dist/core/Colors.d.ts +0 -25
- package/dist/core/Easing.d.ts +0 -40
- package/dist/core/Interpolation.d.ts +0 -38
- package/dist/core/RequestAnimationFrame.d.ts +0 -8
- package/dist/core/SpringAnimation.d.ts +0 -39
- package/dist/core/Tags.d.ts +0 -2
- package/dist/core/TimingAnimation.d.ts +0 -34
- package/dist/core/TransformStyles.d.ts +0 -8
- package/dist/core/animated.d.ts +0 -9
- package/dist/core/index.d.ts +0 -7
- package/dist/core/useTransition.d.ts +0 -46
- package/dist/getInitialConfig.d.ts +0 -3
- package/dist/hooks/useDrag.d.ts +0 -5
- package/dist/hooks/useMouseMove.d.ts +0 -5
- package/dist/hooks/useScroll.d.ts +0 -5
- package/dist/hooks/useWheel.d.ts +0 -5
- package/dist/isDefined.d.ts +0 -1
- package/src/controllers/EventAttacher.ts +0 -35
- package/src/controllers/index.ts +0 -1
- package/src/hooks/useDrag.ts +0 -231
- package/src/hooks/useMouseMove.ts +0 -123
- package/src/hooks/useScroll.ts +0 -124
- package/src/hooks/useWheel.ts +0 -144
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { MouseMoveEventType } from "../types";
|
|
4
|
+
import { MouseMoveGesture } from "../controllers";
|
|
5
|
+
import { useRecognizer } from "./useRecognizer";
|
|
6
|
+
|
|
7
|
+
export function useMouseMove(callback: (event: MouseMoveEventType) => void) {
|
|
8
|
+
const gesture = React.useRef(new MouseMoveGesture()).current;
|
|
9
|
+
|
|
10
|
+
return useRecognizer([["move", gesture, callback]]);
|
|
11
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
type UseRecognizerHandlerType = Array<
|
|
5
|
+
[
|
|
6
|
+
key: "drag" | "wheel" | "move" | "scroll",
|
|
7
|
+
gesture: any,
|
|
8
|
+
callback: any,
|
|
9
|
+
config?: any
|
|
10
|
+
]
|
|
11
|
+
>;
|
|
12
|
+
|
|
13
|
+
export const useRecognizer = (handlers: UseRecognizerHandlerType) => {
|
|
14
|
+
const ref = React.useRef<any>();
|
|
15
|
+
const elementRefs = React.useRef<Array<any>>([]);
|
|
16
|
+
const subscribers = React.useRef<
|
|
17
|
+
Map<string, { keyIndex: number; gesture: any; unsubscribe: any }>
|
|
18
|
+
>(new Map()).current;
|
|
19
|
+
|
|
20
|
+
// re-initiate callback on change
|
|
21
|
+
React.useEffect(() => {
|
|
22
|
+
for (let [, { keyIndex, gesture }] of subscribers.entries()) {
|
|
23
|
+
const [, , callback] = handlers[keyIndex];
|
|
24
|
+
gesture.applyCallback(callback);
|
|
25
|
+
}
|
|
26
|
+
}, [handlers]);
|
|
27
|
+
|
|
28
|
+
React.useEffect(() => {
|
|
29
|
+
handlers.forEach(([key, gesture, callback, config], keyIndex) => {
|
|
30
|
+
subscribers.set(key, {
|
|
31
|
+
keyIndex,
|
|
32
|
+
gesture,
|
|
33
|
+
unsubscribe: gesture.applyGesture({
|
|
34
|
+
targetElement: ref.current,
|
|
35
|
+
targetElements: elementRefs.current,
|
|
36
|
+
callback,
|
|
37
|
+
config,
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return () => {
|
|
43
|
+
for (let [, { unsubscribe }] of subscribers.entries()) {
|
|
44
|
+
unsubscribe && unsubscribe();
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}, []);
|
|
48
|
+
|
|
49
|
+
return (index?: number) => {
|
|
50
|
+
if (index === null || index === undefined) {
|
|
51
|
+
return { ref };
|
|
52
|
+
} else {
|
|
53
|
+
elementRefs.current[index] =
|
|
54
|
+
elementRefs.current[index] || React.createRef();
|
|
55
|
+
|
|
56
|
+
return { ref: elementRefs.current[index] };
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { ScrollEventType } from "../types";
|
|
4
|
+
import { ScrollGesture } from "../controllers";
|
|
5
|
+
import { useRecognizer } from "./useRecognizer";
|
|
6
|
+
|
|
7
|
+
export function useScroll(callback: (event: ScrollEventType) => void) {
|
|
8
|
+
const gesture = React.useRef(new ScrollGesture()).current;
|
|
9
|
+
|
|
10
|
+
return useRecognizer([["scroll", gesture, callback]]);
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { WheelEventType } from "../types";
|
|
4
|
+
import { WheelGesture } from "../controllers";
|
|
5
|
+
import { useRecognizer } from "./useRecognizer";
|
|
6
|
+
|
|
7
|
+
export function useWheel(callback: (event: WheelEventType) => void) {
|
|
8
|
+
const gesture = React.useRef(new WheelGesture()).current;
|
|
9
|
+
|
|
10
|
+
return useRecognizer([["wheel", gesture, callback]]);
|
|
11
|
+
}
|
|
File without changes
|
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
export type MeasurementValue = number | Array<number>;
|
|
2
|
-
|
|
3
|
-
export type MeasurementType = {
|
|
4
|
-
left: MeasurementValue;
|
|
5
|
-
top: MeasurementValue;
|
|
6
|
-
width: MeasurementValue;
|
|
7
|
-
height: MeasurementValue;
|
|
8
|
-
vLeft: MeasurementValue;
|
|
9
|
-
vTop: MeasurementValue;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type WindowDimensionType = {
|
|
13
|
-
width: number;
|
|
14
|
-
height: number;
|
|
15
|
-
innerWidth: number;
|
|
16
|
-
innerHeight: number;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
1
|
type GenericEventType = {
|
|
20
2
|
velocityX: number;
|
|
21
3
|
velocityY: number;
|
|
@@ -23,23 +5,6 @@ type GenericEventType = {
|
|
|
23
5
|
directionY: number;
|
|
24
6
|
};
|
|
25
7
|
|
|
26
|
-
export type ScrollEventType = {
|
|
27
|
-
isScrolling: boolean;
|
|
28
|
-
scrollX: number;
|
|
29
|
-
scrollY: number;
|
|
30
|
-
} & GenericEventType;
|
|
31
|
-
|
|
32
|
-
export type WheelEventType = {
|
|
33
|
-
target: HTMLElement | undefined | null;
|
|
34
|
-
isWheeling: boolean;
|
|
35
|
-
movementX: number;
|
|
36
|
-
movementY: number;
|
|
37
|
-
offsetX: number;
|
|
38
|
-
offsetY: number;
|
|
39
|
-
deltaX: number;
|
|
40
|
-
deltaY: number;
|
|
41
|
-
} & GenericEventType;
|
|
42
|
-
|
|
43
8
|
export type DragEventType = {
|
|
44
9
|
args: Array<number | undefined>;
|
|
45
10
|
down: boolean;
|
|
@@ -53,14 +18,32 @@ export type DragEventType = {
|
|
|
53
18
|
} & GenericEventType;
|
|
54
19
|
|
|
55
20
|
export type MouseMoveEventType = {
|
|
21
|
+
args: Array<number | undefined>;
|
|
22
|
+
event: MouseEvent;
|
|
56
23
|
target: EventTarget | undefined | null;
|
|
57
24
|
isMoving: boolean;
|
|
58
25
|
mouseX: number;
|
|
59
26
|
mouseY: number;
|
|
60
27
|
} & GenericEventType;
|
|
61
28
|
|
|
29
|
+
export type ScrollEventType = {
|
|
30
|
+
isScrolling: boolean;
|
|
31
|
+
scrollX: number;
|
|
32
|
+
scrollY: number;
|
|
33
|
+
} & GenericEventType;
|
|
34
|
+
|
|
35
|
+
export type WheelEventType = {
|
|
36
|
+
target: HTMLElement | undefined | null;
|
|
37
|
+
isWheeling: boolean;
|
|
38
|
+
movementX: number;
|
|
39
|
+
movementY: number;
|
|
40
|
+
offsetX: number;
|
|
41
|
+
offsetY: number;
|
|
42
|
+
deltaX: number;
|
|
43
|
+
deltaY: number;
|
|
44
|
+
} & GenericEventType;
|
|
45
|
+
|
|
62
46
|
export type UseDragConfig = {
|
|
63
47
|
initial?: () => { movementX: number; movementY: number };
|
|
64
48
|
};
|
|
65
|
-
|
|
66
49
|
export type Vector2 = { x: number; y: number };
|
package/src/hooks/index.ts
CHANGED
package/src/hooks/useMeasure.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
type MeasurementValue = number | Array<number>;
|
|
4
|
+
|
|
5
|
+
type MeasurementType = {
|
|
6
|
+
left: MeasurementValue;
|
|
7
|
+
top: MeasurementValue;
|
|
8
|
+
width: MeasurementValue;
|
|
9
|
+
height: MeasurementValue;
|
|
10
|
+
vLeft: MeasurementValue;
|
|
11
|
+
vTop: MeasurementValue;
|
|
12
|
+
};
|
|
3
13
|
|
|
4
14
|
export function useMeasure(
|
|
5
15
|
callback: (event: MeasurementType) => void,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import { attachEvents } from "../gestures/eventAttacher";
|
|
3
4
|
|
|
4
5
|
export function useOutsideClick(
|
|
5
6
|
elementRef: React.RefObject<HTMLElement>,
|
|
@@ -28,7 +29,7 @@ export function useOutsideClick(
|
|
|
28
29
|
}
|
|
29
30
|
};
|
|
30
31
|
|
|
31
|
-
const subscribe = attachEvents(document, [["click", handleOutsideClick]]);
|
|
32
|
+
const subscribe = attachEvents([document], [["click", handleOutsideClick]]);
|
|
32
33
|
|
|
33
34
|
return () => subscribe && subscribe();
|
|
34
35
|
}, []);
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
type WindowDimensionType = {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
innerWidth: number;
|
|
7
|
+
innerHeight: number;
|
|
8
|
+
};
|
|
3
9
|
|
|
4
10
|
export function useWindowDimension(
|
|
5
11
|
callback: (event: WindowDimensionType) => void,
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
export { Easing } from "@raidipesh78/re-motion";
|
|
2
|
-
export
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./Interpolation";
|
|
5
|
-
export * from "./Modules";
|
|
6
|
-
export * from "./Math";
|
|
2
|
+
export * from "./animation";
|
|
3
|
+
export * from "./gestures";
|
|
7
4
|
export * from "./hooks";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./isDefined";
|
|
File without changes
|
package/tsconfig.json
CHANGED
package/dist/Types.d.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
export declare type MeasurementValue = number | Array<number>;
|
|
2
|
-
export declare type MeasurementType = {
|
|
3
|
-
left: MeasurementValue;
|
|
4
|
-
top: MeasurementValue;
|
|
5
|
-
width: MeasurementValue;
|
|
6
|
-
height: MeasurementValue;
|
|
7
|
-
vLeft: MeasurementValue;
|
|
8
|
-
vTop: MeasurementValue;
|
|
9
|
-
};
|
|
10
|
-
export declare type WindowDimensionType = {
|
|
11
|
-
width: number;
|
|
12
|
-
height: number;
|
|
13
|
-
innerWidth: number;
|
|
14
|
-
innerHeight: number;
|
|
15
|
-
};
|
|
16
|
-
declare type GenericEventType = {
|
|
17
|
-
velocityX: number;
|
|
18
|
-
velocityY: number;
|
|
19
|
-
directionX: number;
|
|
20
|
-
directionY: number;
|
|
21
|
-
};
|
|
22
|
-
export declare type ScrollEventType = {
|
|
23
|
-
isScrolling: boolean;
|
|
24
|
-
scrollX: number;
|
|
25
|
-
scrollY: number;
|
|
26
|
-
} & GenericEventType;
|
|
27
|
-
export declare type WheelEventType = {
|
|
28
|
-
target: HTMLElement | undefined | null;
|
|
29
|
-
isWheeling: boolean;
|
|
30
|
-
movementX: number;
|
|
31
|
-
movementY: number;
|
|
32
|
-
offsetX: number;
|
|
33
|
-
offsetY: number;
|
|
34
|
-
deltaX: number;
|
|
35
|
-
deltaY: number;
|
|
36
|
-
} & GenericEventType;
|
|
37
|
-
export declare type DragEventType = {
|
|
38
|
-
args: Array<number | undefined>;
|
|
39
|
-
down: boolean;
|
|
40
|
-
movementX: number;
|
|
41
|
-
movementY: number;
|
|
42
|
-
offsetX: number;
|
|
43
|
-
offsetY: number;
|
|
44
|
-
distanceX: number;
|
|
45
|
-
distanceY: number;
|
|
46
|
-
cancel: () => void;
|
|
47
|
-
} & GenericEventType;
|
|
48
|
-
export declare type MouseMoveEventType = {
|
|
49
|
-
target: EventTarget | undefined | null;
|
|
50
|
-
isMoving: boolean;
|
|
51
|
-
mouseX: number;
|
|
52
|
-
mouseY: number;
|
|
53
|
-
} & GenericEventType;
|
|
54
|
-
export declare type UseDragConfig = {
|
|
55
|
-
initial?: () => {
|
|
56
|
-
movementX: number;
|
|
57
|
-
movementY: number;
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
export declare type Vector2 = {
|
|
61
|
-
x: number;
|
|
62
|
-
y: number;
|
|
63
|
-
};
|
|
64
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ExtrapolateConfig } from "../core";
|
|
2
|
-
/**
|
|
3
|
-
* interpolate function maps input range to output range
|
|
4
|
-
* @param value - number | TransitionValue
|
|
5
|
-
* @param inputRange - Array<number>
|
|
6
|
-
* @param outputRange - Array<string | number>
|
|
7
|
-
* @param extrapolateConfig - "clamp" | "identity" | "extend"
|
|
8
|
-
* @returns - number | TransitionValue
|
|
9
|
-
*/
|
|
10
|
-
export declare function interpolate(value: any, inputRange: Array<number>, outputRange: Array<number | string>, extrapolateConfig?: ExtrapolateConfig): any;
|
|
11
|
-
/**
|
|
12
|
-
* bInterpolate functions maps input range [0, 1] to given [minOutput, maxOutput]
|
|
13
|
-
* sorthand function to interpolate input range [0, 1]
|
|
14
|
-
* @param value - number | TransitionValue
|
|
15
|
-
* @param minOutput - number | string
|
|
16
|
-
* @param maxOutput - number | string
|
|
17
|
-
* @param extrapolateConfig - "clamp" | "identity" | "extend"
|
|
18
|
-
* @returns - number | TransitionValue
|
|
19
|
-
*/
|
|
20
|
-
export declare function bInterpolate(value: any, minOutput: number | string, maxOutput: number | string, extrapolateConfig?: ExtrapolateConfig): any;
|
package/dist/animate/Math.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* bin(booleanValue)
|
|
3
|
-
* returns 1 if booleanValue == true and 0 if booleanValue == false
|
|
4
|
-
*/
|
|
5
|
-
export declare function bin(bool: boolean): 1 | 0;
|
|
6
|
-
/**
|
|
7
|
-
* mix(progress, a, b)
|
|
8
|
-
* linear interpolation between a and b
|
|
9
|
-
*/
|
|
10
|
-
export declare function mix(perc: number, val1: number, val2: number): number;
|
|
11
|
-
/**
|
|
12
|
-
* clamp(value, min, max)
|
|
13
|
-
* clamps value for min and max bounds
|
|
14
|
-
*/
|
|
15
|
-
export declare function clamp(value: number, lowerbound: number, upperbound: number): number;
|
|
16
|
-
/**
|
|
17
|
-
* rubberClamp(value, min, max, constant?)
|
|
18
|
-
* constant is optional : default 0.15
|
|
19
|
-
* clamps the value for min and max value and
|
|
20
|
-
* extends beyond min and max values with constant
|
|
21
|
-
* factor to create elastic rubber band effect
|
|
22
|
-
*/
|
|
23
|
-
export declare function rubberClamp(value: number, lowerbound: number, upperbound: number, constant?: number): number;
|
|
24
|
-
/**
|
|
25
|
-
* snapTo(value, velocity, snapPoints[])
|
|
26
|
-
* Calculates the final snapPoint according to given current value,
|
|
27
|
-
* velocity and snapPoints array
|
|
28
|
-
*/
|
|
29
|
-
export declare function snapTo(value: number, velocity: number, snapPoints: Array<number>): number;
|
|
30
|
-
/**
|
|
31
|
-
* move(array, moveIndex, toIndex)
|
|
32
|
-
* move array item from moveIndex to toIndex without array modification
|
|
33
|
-
*/
|
|
34
|
-
export declare function move(array: Array<any>, moveIndex: number, toIndex: number): any[];
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { UseAnimatedValueConfig } from "./useAnimatedValue";
|
|
3
|
-
/**
|
|
4
|
-
* Make any component animatable
|
|
5
|
-
*/
|
|
6
|
-
export declare function makeAnimatedComponent(WrappedComponent: React.ElementType<any>): React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<unknown>>;
|
|
7
|
-
/**
|
|
8
|
-
* AnimatedBlock : Animated Div
|
|
9
|
-
*/
|
|
10
|
-
export declare const AnimatedBlock: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<unknown>>;
|
|
11
|
-
/**
|
|
12
|
-
* AnimatedInline : Animated Span
|
|
13
|
-
*/
|
|
14
|
-
export declare const AnimatedInline: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<unknown>>;
|
|
15
|
-
/**
|
|
16
|
-
* AnimatedImage : Animated Image
|
|
17
|
-
*/
|
|
18
|
-
export declare const AnimatedImage: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<unknown>>;
|
|
19
|
-
interface ScrollableBlockProps {
|
|
20
|
-
children?: (animation: any) => React.ReactNode;
|
|
21
|
-
direction?: "single" | "both";
|
|
22
|
-
threshold?: number;
|
|
23
|
-
animationConfig?: UseAnimatedValueConfig;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* ScrollableBlock
|
|
27
|
-
* Used to animate element when enter into viewport
|
|
28
|
-
* Render props pattern with children accepts animation node
|
|
29
|
-
* animated value goes from 0 to 1 when appear on viewport & vice versa.
|
|
30
|
-
*/
|
|
31
|
-
export declare const ScrollableBlock: React.FC<ScrollableBlockProps>;
|
|
32
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Attach single document / window event / HTMLElement
|
|
3
|
-
*/
|
|
4
|
-
export declare function attachEvent(domTarget: Window | Document | HTMLElement, event: string, callback: (e: any) => void, capture?: any): () => void;
|
|
5
|
-
/**
|
|
6
|
-
* Attach multiple document / window event / HTMLElement
|
|
7
|
-
*/
|
|
8
|
-
export declare function attachEvents(domTarget: Window | Document | HTMLElement, events: Array<[event: string, callback: (e: any) => void, capture?: any]>): () => void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./EventAttacher";
|
package/dist/animate/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * as Core from "../core";
|
|
2
|
-
export { useAnimatedValue } from "./useAnimatedValue";
|
|
3
|
-
export * from "./useMountedValue";
|
|
4
|
-
export * from "./Interpolation";
|
|
5
|
-
export * from "./Modules";
|
|
6
|
-
export * from "./Math";
|
|
7
|
-
export * from "../core/Easing";
|
|
8
|
-
export * from "./hooks";
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { TransitionValue, ResultType } from "../core";
|
|
2
|
-
import { InitialConfigType } from "./getInitialConfig";
|
|
3
|
-
declare type AnimatedValueType = number | boolean | string;
|
|
4
|
-
export interface GenericAnimationConfig {
|
|
5
|
-
duration?: number;
|
|
6
|
-
mass?: number;
|
|
7
|
-
friction?: number;
|
|
8
|
-
tension?: number;
|
|
9
|
-
easing?: (t: number) => number;
|
|
10
|
-
delay?: number;
|
|
11
|
-
}
|
|
12
|
-
export interface UseAnimatedValueConfig extends GenericAnimationConfig {
|
|
13
|
-
animationType?: InitialConfigType;
|
|
14
|
-
onAnimationEnd?: (value: ResultType) => void;
|
|
15
|
-
listener?: (value: number) => void;
|
|
16
|
-
immediate?: boolean;
|
|
17
|
-
}
|
|
18
|
-
export declare type ValueReturnType = TransitionValue | number | string | {
|
|
19
|
-
toValue: number | string;
|
|
20
|
-
immediate?: boolean;
|
|
21
|
-
};
|
|
22
|
-
interface UseAnimatedValueReturn {
|
|
23
|
-
value: ValueReturnType;
|
|
24
|
-
currentValue: number | string;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* useAnimatedValue for animated transitions
|
|
28
|
-
*/
|
|
29
|
-
export declare const useAnimatedValue: (initialValue: AnimatedValueType, config?: UseAnimatedValueConfig | undefined) => UseAnimatedValueReturn;
|
|
30
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { TransitionValue, UseTransitionConfig } from "../core";
|
|
3
|
-
interface InternalUseMountedValueConfig extends UseTransitionConfig {
|
|
4
|
-
enterDuration?: number;
|
|
5
|
-
exitDuration?: number;
|
|
6
|
-
}
|
|
7
|
-
interface UseMountedValueConfig {
|
|
8
|
-
from: number;
|
|
9
|
-
enter: number;
|
|
10
|
-
exit: number;
|
|
11
|
-
config?: InternalUseMountedValueConfig;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* useMountedValue handles mounting and unmounting of a component
|
|
15
|
-
* @param state - boolean
|
|
16
|
-
* @param config - useTransitionConfig
|
|
17
|
-
* @returns mountedValueFunction with a callback with argument ( animationNode, mounted )
|
|
18
|
-
*/
|
|
19
|
-
export declare const useMountedValue: (state: boolean, config: UseMountedValueConfig) => (callback: ({ value }: {
|
|
20
|
-
value: TransitionValue;
|
|
21
|
-
}, mounted: boolean) => React.ReactNode) => React.ReactNode;
|
|
22
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Attach single document / window event / HTMLElement
|
|
3
|
-
*/
|
|
4
|
-
export declare function attachEvent(domTarget: Window | Document | HTMLElement, event: string, callback: (e: any) => void, capture?: any): () => void;
|
|
5
|
-
/**
|
|
6
|
-
* Attach multiple document / window event / HTMLElement
|
|
7
|
-
*/
|
|
8
|
-
export declare function attachEvents(domTarget: Window | Document | HTMLElement, events: Array<[event: string, callback: (e: any) => void, capture?: any]>): () => void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./EventAttacher";
|
package/dist/core/Animation.d.ts
DELETED
package/dist/core/Bezier.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* https://github.com/gre/bezier-easing
|
|
3
|
-
* BezierEasing - use bezier curve for transition easing function
|
|
4
|
-
* by Gaëtan Renaudeau 2014 - 2015 – MIT License
|
|
5
|
-
*/
|
|
6
|
-
declare function LinearEasing(x: number): number;
|
|
7
|
-
declare function bezier(mX1: number, mY1: number, mX2: number, mY2: number): typeof LinearEasing;
|
|
8
|
-
export { bezier };
|
package/dist/core/Colors.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export declare const COLOR_NUMBER_REGEX: RegExp;
|
|
2
|
-
export declare const HEX_NAME_COLOR: RegExp;
|
|
3
|
-
interface classNameType {
|
|
4
|
-
[name: string]: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const colorNames: classNameType;
|
|
7
|
-
export declare function hexToRgba(hex: string): {
|
|
8
|
-
r: number;
|
|
9
|
-
g: number;
|
|
10
|
-
b: number;
|
|
11
|
-
a: number;
|
|
12
|
-
};
|
|
13
|
-
export declare function rgbaToHex(rgba: {
|
|
14
|
-
r: number;
|
|
15
|
-
g: number;
|
|
16
|
-
b: number;
|
|
17
|
-
a: number;
|
|
18
|
-
}): string;
|
|
19
|
-
export declare function processColor(color: number | string): {
|
|
20
|
-
r: number;
|
|
21
|
-
g: number;
|
|
22
|
-
b: number;
|
|
23
|
-
a: number;
|
|
24
|
-
};
|
|
25
|
-
export {};
|
package/dist/core/Easing.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This class implements common easing functions. The math is pretty obscure,
|
|
3
|
-
* but this cool website has nice visual illustrations of what they represent:
|
|
4
|
-
* http://xaedes.de/dev/transitions/
|
|
5
|
-
*/
|
|
6
|
-
export declare class Easing {
|
|
7
|
-
static step0(n: number): 0 | 1;
|
|
8
|
-
static step1(n: number): 0 | 1;
|
|
9
|
-
static linear(t: number): number;
|
|
10
|
-
static ease(t: number): number;
|
|
11
|
-
static quad(t: number): number;
|
|
12
|
-
static cubic(t: number): number;
|
|
13
|
-
static poly(n: number): (t: number) => number;
|
|
14
|
-
static sin(t: number): number;
|
|
15
|
-
static circle(t: number): number;
|
|
16
|
-
static exp(t: number): number;
|
|
17
|
-
/**
|
|
18
|
-
* A simple elastic interaction, similar to a spring. Default bounciness
|
|
19
|
-
* is 1, which overshoots a little bit once. 0 bounciness doesn't overshoot
|
|
20
|
-
* at all, and bounciness of N > 1 will overshoot about N times.
|
|
21
|
-
*
|
|
22
|
-
* Wolfram Plots:
|
|
23
|
-
*
|
|
24
|
-
* http://tiny.cc/elastic_b_1 (default bounciness = 1)
|
|
25
|
-
* http://tiny.cc/elastic_b_3 (bounciness = 3)
|
|
26
|
-
*/
|
|
27
|
-
static elastic(bounciness?: number): (t: number) => number;
|
|
28
|
-
static back(s: number): (t: number) => number;
|
|
29
|
-
static bounce(t: number): number;
|
|
30
|
-
static bezier(x1: number, y1: number, x2: number, y2: number): (t: number) => number;
|
|
31
|
-
static in(easing: (t: number) => number): (t: number) => number;
|
|
32
|
-
/**
|
|
33
|
-
* Runs an easing function backwards.
|
|
34
|
-
*/
|
|
35
|
-
static out(easing: (t: number) => number): (t: number) => number;
|
|
36
|
-
/**
|
|
37
|
-
* Makes any easing function symmetrical.
|
|
38
|
-
*/
|
|
39
|
-
static inOut(easing: (t: number) => number): (t: number) => number;
|
|
40
|
-
}
|