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
|
File without changes
|
|
File without changes
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { TransitionValue } from "@raidipesh78/re-motion";
|
|
2
3
|
import { UseAnimatedValueConfig } from "./useAnimatedValue";
|
|
4
|
+
import { InnerUseMountedValueConfig } from "./useMountedValue";
|
|
3
5
|
/**
|
|
4
6
|
* Make any component animatable
|
|
5
7
|
*/
|
|
@@ -29,4 +31,17 @@ interface ScrollableBlockProps {
|
|
|
29
31
|
* animated value goes from 0 to 1 when appear on viewport & vice versa.
|
|
30
32
|
*/
|
|
31
33
|
export declare const ScrollableBlock: React.FC<ScrollableBlockProps>;
|
|
34
|
+
interface MountedBlockProps {
|
|
35
|
+
state: boolean;
|
|
36
|
+
children: (animation: {
|
|
37
|
+
value: TransitionValue;
|
|
38
|
+
}) => React.ReactNode;
|
|
39
|
+
config?: InnerUseMountedValueConfig;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* MountedBlock handles mounting and unmounting of a component
|
|
43
|
+
* @props - state: boolean, config: InnerUseMountedValueConfig
|
|
44
|
+
* @children - (animation: { value: TransitionValue }) => React.ReactNode
|
|
45
|
+
*/
|
|
46
|
+
export declare const MountedBlock: ({ state, children, config, }: MountedBlockProps) => JSX.Element;
|
|
32
47
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TransitionValue, ResultType } from "@raidipesh78/re-motion";
|
|
2
2
|
import { InitialConfigType } from "./getInitialConfig";
|
|
3
|
-
declare type AnimatedValueType = number |
|
|
3
|
+
declare type AnimatedValueType = number | string;
|
|
4
4
|
export interface GenericAnimationConfig {
|
|
5
5
|
duration?: number;
|
|
6
6
|
mass?: number;
|
|
@@ -26,5 +26,5 @@ interface UseAnimatedValueReturn {
|
|
|
26
26
|
/**
|
|
27
27
|
* useAnimatedValue for animated transitions
|
|
28
28
|
*/
|
|
29
|
-
export declare
|
|
29
|
+
export declare function useAnimatedValue(initialValue: AnimatedValueType, config?: UseAnimatedValueConfig): UseAnimatedValueReturn;
|
|
30
30
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { TransitionValue, UseTransitionConfig } from "@raidipesh78/re-motion";
|
|
3
|
-
interface
|
|
3
|
+
export interface InnerUseMountedValueConfig extends UseTransitionConfig {
|
|
4
4
|
enterDuration?: number;
|
|
5
5
|
exitDuration?: number;
|
|
6
6
|
}
|
|
@@ -8,7 +8,7 @@ interface UseMountedValueConfig {
|
|
|
8
8
|
from: number;
|
|
9
9
|
enter: number;
|
|
10
10
|
exit: number;
|
|
11
|
-
config?:
|
|
11
|
+
config?: InnerUseMountedValueConfig;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* useMountedValue handles mounting and unmounting of a component
|
|
@@ -16,7 +16,7 @@ interface UseMountedValueConfig {
|
|
|
16
16
|
* @param config - useTransitionConfig
|
|
17
17
|
* @returns mountedValueFunction with a callback with argument ( animationNode, mounted )
|
|
18
18
|
*/
|
|
19
|
-
export declare
|
|
19
|
+
export declare function useMountedValue(state: boolean, config: UseMountedValueConfig): (callback: ({ value }: {
|
|
20
20
|
value: TransitionValue;
|
|
21
21
|
}, mounted: boolean) => React.ReactNode) => React.ReactNode;
|
|
22
22
|
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Vector2 } from "../types";
|
|
2
|
+
import { Gesture } from "./Gesture";
|
|
3
|
+
export declare class DragGesture extends Gesture {
|
|
4
|
+
movementStart: Vector2;
|
|
5
|
+
initialMovement: Vector2;
|
|
6
|
+
movement: Vector2;
|
|
7
|
+
previousMovement: Vector2;
|
|
8
|
+
translation: Vector2;
|
|
9
|
+
offset: Vector2;
|
|
10
|
+
velocity: Vector2;
|
|
11
|
+
_initEvents(): void;
|
|
12
|
+
_cancelEvents(): void;
|
|
13
|
+
_handleCallback(): void;
|
|
14
|
+
pointerDown(e: any): void;
|
|
15
|
+
pointerMove(e: any): void;
|
|
16
|
+
pointerUp(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare class Gesture {
|
|
2
|
+
currentIndex?: number;
|
|
3
|
+
lastTimeStamp: number;
|
|
4
|
+
isActive: boolean;
|
|
5
|
+
targetElement?: HTMLElement;
|
|
6
|
+
targetElements: Array<HTMLElement>;
|
|
7
|
+
config?: any;
|
|
8
|
+
callback?: <T>(event: T) => void;
|
|
9
|
+
_subscribe?: (eventKeys?: Array<string>) => void;
|
|
10
|
+
static _VELOCITY_LIMIT: number;
|
|
11
|
+
_initEvents(): void;
|
|
12
|
+
_cancelEvents(): void;
|
|
13
|
+
applyCallback(callback: <T>(event: T) => void): void;
|
|
14
|
+
applyGesture({ targetElement, targetElements, callback, config, }: {
|
|
15
|
+
targetElement?: any;
|
|
16
|
+
targetElements?: any;
|
|
17
|
+
callback: <T>(event: T) => void;
|
|
18
|
+
config?: any;
|
|
19
|
+
}): () => void | undefined;
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Vector2 } from "../types";
|
|
2
|
+
import { Gesture } from "./Gesture";
|
|
3
|
+
export declare class MouseMoveGesture extends Gesture {
|
|
4
|
+
event?: MouseEvent;
|
|
5
|
+
isActiveID?: any;
|
|
6
|
+
movement: Vector2;
|
|
7
|
+
previousMovement: Vector2;
|
|
8
|
+
velocity: Vector2;
|
|
9
|
+
direction: Vector2;
|
|
10
|
+
_initEvents(): void;
|
|
11
|
+
_handleCallback(): void;
|
|
12
|
+
onMouseMove(e: MouseEvent): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Vector2 } from "../types";
|
|
2
|
+
import { Gesture } from "./Gesture";
|
|
3
|
+
export declare class ScrollGesture extends Gesture {
|
|
4
|
+
isActiveID?: any;
|
|
5
|
+
movement: Vector2;
|
|
6
|
+
previousMovement: Vector2;
|
|
7
|
+
direction: Vector2;
|
|
8
|
+
velocity: Vector2;
|
|
9
|
+
_initEvents(): void;
|
|
10
|
+
_handleCallback(): void;
|
|
11
|
+
onScroll({ x, y }: Vector2): void;
|
|
12
|
+
scrollListener(): void;
|
|
13
|
+
scrollElementListener(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Vector2 } from "../types";
|
|
2
|
+
import { Gesture } from "./Gesture";
|
|
3
|
+
export declare class WheelGesture extends Gesture {
|
|
4
|
+
isActiveID?: any;
|
|
5
|
+
movement: Vector2;
|
|
6
|
+
previousMovement: Vector2;
|
|
7
|
+
direction: Vector2;
|
|
8
|
+
velocity: Vector2;
|
|
9
|
+
delta: Vector2;
|
|
10
|
+
offset: Vector2;
|
|
11
|
+
translation: Vector2;
|
|
12
|
+
_initEvents(): void;
|
|
13
|
+
_handleCallback(): void;
|
|
14
|
+
onWheel(event: WheelEvent): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare type MouseEventType = "click" | "dblclick" | "mousedown" | "mousemove" | "mouseup" | "touchstart" | "touchmove" | "touchend" | "mouseenter" | "mouseleave" | "mouseout" | "mouseover" | "scroll" | "wheel" | "contextmenu";
|
|
2
|
+
declare type DomTargetTypes = Array<Window | Document | HTMLElement>;
|
|
3
|
+
/**
|
|
4
|
+
* Attach multiple document / window event / HTMLElement
|
|
5
|
+
*/
|
|
6
|
+
export declare function attachEvents(domTargets: DomTargetTypes, events: Array<[
|
|
7
|
+
event: MouseEventType,
|
|
8
|
+
callback: (e: any) => void,
|
|
9
|
+
capture?: any
|
|
10
|
+
]>): (eventKeys?: string[] | undefined) => void;
|
|
11
|
+
export {};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
export * from "./useOutsideClick";
|
|
2
|
-
export * from "./useMeasure";
|
|
3
|
-
export * from "./useWindowDimension";
|
|
4
|
-
export * from "./useScroll";
|
|
5
1
|
export * from "./useDrag";
|
|
6
2
|
export * from "./useMouseMove";
|
|
3
|
+
export * from "./useScroll";
|
|
7
4
|
export * from "./useWheel";
|
|
5
|
+
export * from "./useGesture";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DragEventType, WheelEventType, ScrollEventType, MouseMoveEventType } from "../types";
|
|
2
|
+
export declare function useGesture({ onDrag, onWheel, onScroll, onMouseMove, }: {
|
|
3
|
+
onDrag?: (event: DragEventType) => void;
|
|
4
|
+
onWheel?: (event: WheelEventType) => void;
|
|
5
|
+
onScroll?: (event: ScrollEventType) => void;
|
|
6
|
+
onMouseMove?: (event: MouseMoveEventType) => void;
|
|
7
|
+
}): (index?: number | undefined) => {
|
|
8
|
+
ref: any;
|
|
9
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare type UseRecognizerHandlerType = Array<[
|
|
2
|
+
key: "drag" | "wheel" | "move" | "scroll",
|
|
3
|
+
gesture: any,
|
|
4
|
+
callback: any,
|
|
5
|
+
config?: any
|
|
6
|
+
]>;
|
|
7
|
+
export declare const useRecognizer: (handlers: UseRecognizerHandlerType) => (index?: number | undefined) => {
|
|
8
|
+
ref: any;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
File without changes
|
|
@@ -1,39 +1,9 @@
|
|
|
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
1
|
declare type GenericEventType = {
|
|
17
2
|
velocityX: number;
|
|
18
3
|
velocityY: number;
|
|
19
4
|
directionX: number;
|
|
20
5
|
directionY: number;
|
|
21
6
|
};
|
|
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
7
|
export declare type DragEventType = {
|
|
38
8
|
args: Array<number | undefined>;
|
|
39
9
|
down: boolean;
|
|
@@ -46,11 +16,28 @@ export declare type DragEventType = {
|
|
|
46
16
|
cancel: () => void;
|
|
47
17
|
} & GenericEventType;
|
|
48
18
|
export declare type MouseMoveEventType = {
|
|
19
|
+
args: Array<number | undefined>;
|
|
20
|
+
event: MouseEvent;
|
|
49
21
|
target: EventTarget | undefined | null;
|
|
50
22
|
isMoving: boolean;
|
|
51
23
|
mouseX: number;
|
|
52
24
|
mouseY: number;
|
|
53
25
|
} & GenericEventType;
|
|
26
|
+
export declare type ScrollEventType = {
|
|
27
|
+
isScrolling: boolean;
|
|
28
|
+
scrollX: number;
|
|
29
|
+
scrollY: number;
|
|
30
|
+
} & GenericEventType;
|
|
31
|
+
export declare type WheelEventType = {
|
|
32
|
+
target: HTMLElement | undefined | null;
|
|
33
|
+
isWheeling: boolean;
|
|
34
|
+
movementX: number;
|
|
35
|
+
movementY: number;
|
|
36
|
+
offsetX: number;
|
|
37
|
+
offsetY: number;
|
|
38
|
+
deltaX: number;
|
|
39
|
+
deltaY: number;
|
|
40
|
+
} & GenericEventType;
|
|
54
41
|
export declare type UseDragConfig = {
|
|
55
42
|
initial?: () => {
|
|
56
43
|
movementX: number;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
declare type MeasurementValue = number | Array<number>;
|
|
3
|
+
declare type MeasurementType = {
|
|
4
|
+
left: MeasurementValue;
|
|
5
|
+
top: MeasurementValue;
|
|
6
|
+
width: MeasurementValue;
|
|
7
|
+
height: MeasurementValue;
|
|
8
|
+
vLeft: MeasurementValue;
|
|
9
|
+
vTop: MeasurementValue;
|
|
10
|
+
};
|
|
3
11
|
export declare function useMeasure(callback: (event: MeasurementType) => void, deps?: React.DependencyList): (index?: number | undefined) => {
|
|
4
12
|
ref: React.MutableRefObject<null>;
|
|
5
13
|
};
|
|
14
|
+
export {};
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
declare type WindowDimensionType = {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
innerWidth: number;
|
|
6
|
+
innerHeight: number;
|
|
7
|
+
};
|
|
3
8
|
export declare function useWindowDimension(callback: (event: WindowDimensionType) => void, deps?: React.DependencyList): void;
|
|
9
|
+
export {};
|
package/dist/index.d.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";
|