react-ui-animate 5.0.0-rc.2 → 5.0.0-rc.4
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/README.md +6 -6
- package/dist/animation/AnimationConfig.d.ts +8 -8
- package/dist/animation/descriptors.d.ts +7 -0
- package/dist/animation/drivers.d.ts +4 -0
- package/dist/animation/helpers.d.ts +3 -0
- package/dist/animation/index.d.ts +4 -3
- package/dist/animation/to.d.ts +9 -0
- package/dist/animation/types.d.ts +33 -26
- package/dist/animation/useMount.d.ts +17 -0
- package/dist/animation/useValue.d.ts +9 -0
- package/dist/gestures/controllers/DragGesture.d.ts +43 -15
- package/dist/gestures/controllers/Gesture.d.ts +11 -19
- package/dist/gestures/controllers/MoveGesture.d.ts +29 -0
- package/dist/gestures/controllers/ScrollGesture.d.ts +26 -12
- package/dist/gestures/controllers/WheelGesture.d.ts +24 -13
- package/dist/gestures/hooks/index.d.ts +4 -5
- package/dist/gestures/hooks/useDrag.d.ts +5 -4
- package/dist/gestures/hooks/useMove.d.ts +8 -0
- package/dist/gestures/hooks/useScroll.d.ts +8 -4
- package/dist/gestures/hooks/useWheel.d.ts +8 -4
- package/dist/gestures/index.d.ts +1 -0
- package/dist/hooks/index.d.ts +3 -3
- package/dist/hooks/useDimension.d.ts +9 -0
- package/dist/hooks/useMeasure.d.ts +5 -7
- package/dist/hooks/useOutsideClick.d.ts +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/index.d.ts +6 -0
- package/package.json +2 -2
- package/dist/animation/Value.d.ts +0 -12
- package/dist/animation/controllers.d.ts +0 -41
- package/dist/animation/hooks/index.d.ts +0 -3
- package/dist/animation/hooks/useAnimatedList.d.ts +0 -24
- package/dist/animation/hooks/useMount.d.ts +0 -12
- package/dist/animation/hooks/useValue.d.ts +0 -15
- package/dist/animation/interpolation/colors.d.ts +0 -25
- package/dist/animation/interpolation/index.d.ts +0 -1
- package/dist/animation/interpolation/interpolateNumbers.d.ts +0 -8
- package/dist/gestures/controllers/MouseMoveGesture.d.ts +0 -13
- package/dist/gestures/controllers/index.d.ts +0 -4
- package/dist/gestures/helpers/eventAttacher.d.ts +0 -11
- package/dist/gestures/helpers/index.d.ts +0 -1
- package/dist/gestures/helpers/math.d.ts +0 -34
- package/dist/gestures/helpers/withDefault.d.ts +0 -4
- package/dist/gestures/hooks/useGesture.d.ts +0 -9
- package/dist/gestures/hooks/useMouseMove.d.ts +0 -4
- package/dist/gestures/hooks/useRecognizer.d.ts +0 -10
- package/dist/gestures/types/index.d.ts +0 -51
- package/dist/hooks/useWindowDimension.d.ts +0 -9
package/README.md
CHANGED
|
@@ -157,7 +157,7 @@ export const Interpolation: React.FC = () => {
|
|
|
157
157
|
|
|
158
158
|
- **`useValue(initial)`**: Initializes an animated value.
|
|
159
159
|
- **`animate`**: JSX wrapper for animatable elements (`animate.div`, `animate.span`, etc.).
|
|
160
|
-
- **Modifiers**: `withSpring`, `withTiming`, `withDecay`, `withSequence
|
|
160
|
+
- **Modifiers**: `withSpring`, `withTiming`, `withDecay`, `withSequence` — functions to define animation behavior.
|
|
161
161
|
- **`useMount(state, config)`**: Manages mount/unmount transitions. `config` includes `from`, `enter`, and `exit` values.
|
|
162
162
|
|
|
163
163
|
## Gestures
|
|
@@ -165,10 +165,9 @@ export const Interpolation: React.FC = () => {
|
|
|
165
165
|
`react-ui-animate` also provides hooks for handling gestures:
|
|
166
166
|
|
|
167
167
|
- `useDrag`
|
|
168
|
-
- `
|
|
168
|
+
- `useMove`
|
|
169
169
|
- `useScroll`
|
|
170
170
|
- `useWheel`
|
|
171
|
-
- `useGesture`
|
|
172
171
|
|
|
173
172
|
**Example: `useDrag`**
|
|
174
173
|
|
|
@@ -177,15 +176,16 @@ import React from 'react';
|
|
|
177
176
|
import { useValue, animate, useDrag, withSpring } from 'react-ui-animate';
|
|
178
177
|
|
|
179
178
|
export const Draggable: React.FC = () => {
|
|
179
|
+
const ref = useRef(null);
|
|
180
180
|
const [translateX, setTranslateX] = useValue(0);
|
|
181
181
|
|
|
182
|
-
|
|
183
|
-
setTranslateX(down ?
|
|
182
|
+
useDrag(ref, ({ down, movement }) => {
|
|
183
|
+
setTranslateX(down ? movement.x : withSpring(0));
|
|
184
184
|
});
|
|
185
185
|
|
|
186
186
|
return (
|
|
187
187
|
<animate.div
|
|
188
|
-
{
|
|
188
|
+
ref={ref}
|
|
189
189
|
style={{
|
|
190
190
|
width: 100,
|
|
191
191
|
height: 100,
|
|
@@ -41,23 +41,23 @@ export declare const AnimationConfig: {
|
|
|
41
41
|
Spring: {
|
|
42
42
|
ELASTIC: {
|
|
43
43
|
mass: number;
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
damping: number;
|
|
45
|
+
stiffness: number;
|
|
46
46
|
};
|
|
47
47
|
EASE: {
|
|
48
48
|
mass: number;
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
damping: number;
|
|
50
|
+
stiffness: number;
|
|
51
51
|
};
|
|
52
52
|
STIFF: {
|
|
53
53
|
mass: number;
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
damping: number;
|
|
55
|
+
stiffness: number;
|
|
56
56
|
};
|
|
57
57
|
WOBBLE: {
|
|
58
58
|
mass: number;
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
damping: number;
|
|
60
|
+
stiffness: number;
|
|
61
61
|
};
|
|
62
62
|
};
|
|
63
63
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Callbacks, DecayOptions, Descriptor, SpringOptions, TimingOptions } from './types';
|
|
2
|
+
export declare const withSpring: (to: Descriptor["to"], opts?: SpringOptions & Callbacks) => Descriptor;
|
|
3
|
+
export declare const withTiming: (to: Descriptor["to"], opts?: TimingOptions & Callbacks) => Descriptor;
|
|
4
|
+
export declare const withDecay: (velocity: number, opts?: DecayOptions & Callbacks) => Descriptor;
|
|
5
|
+
export declare const withDelay: (ms: number) => Descriptor;
|
|
6
|
+
export declare const withSequence: (animations: Descriptor[], opts?: Omit<Callbacks, "onChange">) => Descriptor;
|
|
7
|
+
export declare const withLoop: (animation: Descriptor, iterations?: number, opts?: Omit<Callbacks, "onChange">) => Descriptor;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { MotionValue } from '@raidipesh78/re-motion';
|
|
2
|
+
import type { Primitive, Descriptor } from './types';
|
|
3
|
+
export declare function buildAnimation(mv: MotionValue<Primitive>, { type, to, options }: Descriptor): import("@raidipesh78/re-motion/dist/drivers/AnimationController").AnimationController;
|
|
4
|
+
export declare function buildParallel(mvMap: Record<string, MotionValue<Primitive>>, step: Descriptor): import("@raidipesh78/re-motion/dist/drivers/AnimationController").AnimationController;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { useValue
|
|
2
|
-
export {
|
|
1
|
+
export { useValue } from './useValue';
|
|
2
|
+
export { useMount } from './useMount';
|
|
3
|
+
export { withDecay, withDelay, withLoop, withSequence, withSpring, withTiming, } from './descriptors';
|
|
3
4
|
export { AnimationConfig } from './AnimationConfig';
|
|
4
|
-
export {
|
|
5
|
+
export { to } from './to';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type ExtrapolateType = 'identity' | 'extend' | 'clamp';
|
|
2
|
+
interface ExtrapolateConfig {
|
|
3
|
+
extrapolate?: ExtrapolateType;
|
|
4
|
+
extrapolateRight?: ExtrapolateType;
|
|
5
|
+
extrapolateLeft?: ExtrapolateType;
|
|
6
|
+
easing?: (t: number) => number;
|
|
7
|
+
}
|
|
8
|
+
export declare function to(input: number, inRange: number[], outRange: (number | string)[], config?: ExtrapolateConfig): number | string;
|
|
9
|
+
export {};
|
|
@@ -1,27 +1,34 @@
|
|
|
1
1
|
export type Primitive = number | string;
|
|
2
|
-
export interface
|
|
3
|
-
onStart?: (
|
|
4
|
-
onChange?: (
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
2
|
+
export interface Callbacks {
|
|
3
|
+
onStart?: () => void;
|
|
4
|
+
onChange?: (v: number) => void;
|
|
5
|
+
onComplete?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export interface SpringOptions {
|
|
8
|
+
stiffness?: number;
|
|
9
|
+
damping?: number;
|
|
10
|
+
mass?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface TimingOptions {
|
|
13
|
+
duration?: number;
|
|
14
|
+
easing?: (t: number) => number;
|
|
15
|
+
}
|
|
16
|
+
export interface DecayOptions {
|
|
17
|
+
velocity?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface SequenceOptions {
|
|
20
|
+
animations?: Descriptor[];
|
|
21
|
+
}
|
|
22
|
+
export interface DelayOptions {
|
|
23
|
+
delay?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface LoopOptions {
|
|
26
|
+
iterations?: number;
|
|
27
|
+
animation?: Descriptor;
|
|
28
|
+
}
|
|
29
|
+
export type DriverType = 'spring' | 'timing' | 'decay' | 'delay' | 'sequence' | 'loop';
|
|
30
|
+
export interface Descriptor {
|
|
31
|
+
type: DriverType;
|
|
32
|
+
to?: Primitive | Primitive[] | Record<string, Primitive>;
|
|
33
|
+
options?: SpringOptions & TimingOptions & DecayOptions & SequenceOptions & DelayOptions & LoopOptions & Callbacks;
|
|
34
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MotionValue } from '@raidipesh78/re-motion';
|
|
2
|
+
import type { Primitive, Descriptor } from './types';
|
|
3
|
+
type ConfigSingle<T extends Primitive> = {
|
|
4
|
+
from?: T;
|
|
5
|
+
enter?: T | Descriptor;
|
|
6
|
+
exit?: T | Descriptor;
|
|
7
|
+
};
|
|
8
|
+
type ConfigMulti<I extends Record<string, Primitive>> = {
|
|
9
|
+
from: I;
|
|
10
|
+
enter?: I | Descriptor;
|
|
11
|
+
exit?: I | Descriptor;
|
|
12
|
+
};
|
|
13
|
+
export declare function useMount<T extends Primitive = number>(isOpen: boolean, config?: ConfigSingle<T>): (fn: (value: MotionValue<T>, mounted: boolean) => React.ReactNode) => React.ReactNode;
|
|
14
|
+
export declare function useMount<I extends Record<string, Primitive>>(isOpen: boolean, config: ConfigMulti<I>): (fn: (values: {
|
|
15
|
+
[K in keyof I]: MotionValue<I[K]>;
|
|
16
|
+
}, mounted: boolean) => React.ReactNode) => React.ReactNode;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MotionValue } from '@raidipesh78/re-motion';
|
|
2
|
+
import type { Primitive, Descriptor } from './types';
|
|
3
|
+
type Widen<T> = T extends number ? number : T extends string ? string : T;
|
|
4
|
+
type ValueReturn<T> = T extends Primitive ? MotionValue<Widen<T>> : T extends Primitive[] ? MotionValue<Widen<Primitive>>[] : {
|
|
5
|
+
[K in keyof T]: MotionValue<Widen<T[K]>>;
|
|
6
|
+
};
|
|
7
|
+
type Base = Primitive | Primitive[] | Record<string, Primitive>;
|
|
8
|
+
export declare function useValue<T extends Base>(initial: T): [ValueReturn<T>, (to: Base | Descriptor) => void];
|
|
9
|
+
export {};
|
|
@@ -1,17 +1,45 @@
|
|
|
1
1
|
import { Gesture } from './Gesture';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
export interface DragEvent {
|
|
3
|
+
down: boolean;
|
|
4
|
+
movement: {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
};
|
|
8
|
+
offset: {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
};
|
|
12
|
+
velocity: {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
};
|
|
16
|
+
event: PointerEvent;
|
|
17
|
+
cancel: () => void;
|
|
18
|
+
}
|
|
19
|
+
export interface DragConfig {
|
|
20
|
+
threshold?: number;
|
|
21
|
+
axis?: 'x' | 'y';
|
|
22
|
+
initial?: () => {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export declare class DragGesture extends Gesture<DragEvent> {
|
|
28
|
+
private config;
|
|
29
|
+
private prev;
|
|
30
|
+
private lastTime;
|
|
31
|
+
private movement;
|
|
32
|
+
private velocity;
|
|
33
|
+
private start;
|
|
34
|
+
private offset;
|
|
35
|
+
private activePointerId;
|
|
36
|
+
private attachedEl;
|
|
37
|
+
private pointerDownPos;
|
|
38
|
+
private thresholdPassed;
|
|
39
|
+
constructor(config?: DragConfig);
|
|
40
|
+
attach(element: HTMLElement): () => void;
|
|
41
|
+
private onDown;
|
|
42
|
+
private onMove;
|
|
43
|
+
private onUp;
|
|
44
|
+
private cancel;
|
|
17
45
|
}
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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;
|
|
1
|
+
type Listener<E> = (event: E) => void;
|
|
2
|
+
export declare abstract class Gesture<E> {
|
|
3
|
+
static readonly VELOCITY_LIMIT = 20;
|
|
4
|
+
private changeListeners;
|
|
5
|
+
private endListeners;
|
|
6
|
+
onChange(listener: Listener<E>): this;
|
|
7
|
+
onEnd(listener: Listener<E>): this;
|
|
8
|
+
protected emitChange(event: E): void;
|
|
9
|
+
protected emitEnd(event: E): void;
|
|
10
|
+
abstract attach(element: HTMLElement): () => void;
|
|
20
11
|
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Gesture } from './Gesture';
|
|
2
|
+
export interface MoveEvent {
|
|
3
|
+
movement: {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
};
|
|
7
|
+
offset: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
};
|
|
11
|
+
velocity: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
};
|
|
15
|
+
event: PointerEvent;
|
|
16
|
+
cancel?: () => void;
|
|
17
|
+
}
|
|
18
|
+
export declare class MoveGesture extends Gesture<MoveEvent> {
|
|
19
|
+
private prev;
|
|
20
|
+
private lastTime;
|
|
21
|
+
private attachedEl;
|
|
22
|
+
private movement;
|
|
23
|
+
private offset;
|
|
24
|
+
private velocity;
|
|
25
|
+
private startPos;
|
|
26
|
+
attach(element: HTMLElement | Window): () => void;
|
|
27
|
+
private onMove;
|
|
28
|
+
private onLeave;
|
|
29
|
+
}
|
|
@@ -1,14 +1,28 @@
|
|
|
1
|
-
import { Vector2 } from '../types';
|
|
2
1
|
import { Gesture } from './Gesture';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
export interface ScrollEvent {
|
|
3
|
+
movement: {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
};
|
|
7
|
+
offset: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
};
|
|
11
|
+
velocity: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
};
|
|
15
|
+
event: Event;
|
|
16
|
+
cancel?: () => void;
|
|
17
|
+
}
|
|
18
|
+
export declare class ScrollGesture extends Gesture<ScrollEvent> {
|
|
19
|
+
private attachedEl;
|
|
20
|
+
private movement;
|
|
21
|
+
private offset;
|
|
22
|
+
private velocity;
|
|
23
|
+
private prevScroll;
|
|
24
|
+
private lastTime;
|
|
25
|
+
private endTimeout?;
|
|
26
|
+
attach(element: HTMLElement | Window): () => void;
|
|
27
|
+
private onScroll;
|
|
14
28
|
}
|
|
@@ -1,15 +1,26 @@
|
|
|
1
|
-
import { Vector2 } from '../types';
|
|
2
1
|
import { Gesture } from './Gesture';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
export interface WheelEvent {
|
|
3
|
+
movement: {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
};
|
|
7
|
+
offset: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
};
|
|
11
|
+
velocity: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
};
|
|
15
|
+
event: globalThis.WheelEvent;
|
|
16
|
+
cancel?: () => void;
|
|
17
|
+
}
|
|
18
|
+
export declare class WheelGesture extends Gesture<WheelEvent> {
|
|
19
|
+
private movement;
|
|
20
|
+
private offset;
|
|
21
|
+
private velocity;
|
|
22
|
+
private lastTime;
|
|
23
|
+
private endTimeout?;
|
|
24
|
+
attach(element: HTMLElement | Window): () => void;
|
|
25
|
+
private onWheel;
|
|
15
26
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export * from './useGesture';
|
|
1
|
+
export { useDrag } from './useDrag';
|
|
2
|
+
export { useMove } from './useMove';
|
|
3
|
+
export { useScroll } from './useScroll';
|
|
4
|
+
export { useWheel } from './useWheel';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { type DragConfig, type DragEvent } from '../controllers/DragGesture';
|
|
3
|
+
export declare function useDrag<T extends HTMLElement>(refs: RefObject<T> | Array<RefObject<T>>, onDrag: (e: DragEvent & {
|
|
4
|
+
index: number;
|
|
5
|
+
}) => void, config?: DragConfig): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { type MoveEvent } from '../controllers/MoveGesture';
|
|
3
|
+
export declare function useMove(refs: Window, onMove: (e: MoveEvent & {
|
|
4
|
+
index: 0;
|
|
5
|
+
}) => void): void;
|
|
6
|
+
export declare function useMove<T extends HTMLElement>(refs: RefObject<T> | Array<RefObject<T>>, onMove: (e: MoveEvent & {
|
|
7
|
+
index: number;
|
|
8
|
+
}) => void): void;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { type ScrollEvent } from '../controllers/ScrollGesture';
|
|
3
|
+
export declare function useScroll(refs: Window, onScroll: (e: ScrollEvent & {
|
|
4
|
+
index: 0;
|
|
5
|
+
}) => void): void;
|
|
6
|
+
export declare function useScroll<T extends HTMLElement>(refs: RefObject<T> | Array<RefObject<T>>, onScroll: (e: ScrollEvent & {
|
|
7
|
+
index: number;
|
|
8
|
+
}) => void): void;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { type WheelEvent } from '../controllers/WheelGesture';
|
|
3
|
+
export declare function useWheel(refs: Window, onWheel: (e: WheelEvent & {
|
|
4
|
+
index: 0;
|
|
5
|
+
}) => void): void;
|
|
6
|
+
export declare function useWheel<T extends HTMLElement>(refs: RefObject<T> | Array<RefObject<T>>, onWheel: (e: WheelEvent & {
|
|
7
|
+
index: number;
|
|
8
|
+
}) => void): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './hooks';
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export { useOutsideClick } from './useOutsideClick';
|
|
2
|
+
export { useMeasure } from './useMeasure';
|
|
3
|
+
export { useDimension } from './useDimension';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DependencyList } from 'react';
|
|
2
|
+
type DimensionType = {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
innerWidth: number;
|
|
6
|
+
innerHeight: number;
|
|
7
|
+
};
|
|
8
|
+
export declare function useDimension(callback: (event: DimensionType) => void, deps?: DependencyList): void;
|
|
9
|
+
export {};
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { DependencyList } from 'react';
|
|
2
|
-
type MeasurementValue = number |
|
|
3
|
-
|
|
1
|
+
import { RefObject, DependencyList } from 'react';
|
|
2
|
+
type MeasurementValue = number | number[];
|
|
3
|
+
interface MeasurementType {
|
|
4
4
|
left: MeasurementValue;
|
|
5
5
|
top: MeasurementValue;
|
|
6
6
|
width: MeasurementValue;
|
|
7
7
|
height: MeasurementValue;
|
|
8
8
|
vLeft: MeasurementValue;
|
|
9
9
|
vTop: MeasurementValue;
|
|
10
|
-
}
|
|
11
|
-
export declare function useMeasure(callback: (
|
|
12
|
-
ref: import("react").MutableRefObject<null>;
|
|
13
|
-
};
|
|
10
|
+
}
|
|
11
|
+
export declare function useMeasure(refs: RefObject<HTMLElement>[], callback: (m: MeasurementType) => void, deps?: DependencyList): void;
|
|
14
12
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { RefObject, DependencyList } from 'react';
|
|
2
|
-
export declare function useOutsideClick(
|
|
2
|
+
export declare function useOutsideClick(ref: RefObject<HTMLElement>, callback: (event: MouseEvent | TouchEvent) => void, deps?: DependencyList): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { Easing, makeMotion as makeAnimated, motion as animate,
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
1
|
+
export { combine, Easing, makeMotion as makeAnimated, motion as animate, } from '@raidipesh78/re-motion';
|
|
2
|
+
export * from './animation';
|
|
3
|
+
export * from './hooks';
|
|
4
|
+
export * from './gestures';
|
|
5
|
+
export * from './utils';
|