react-ui-animate 2.0.0-rc.7 → 3.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +3 -3
- package/LICENSE +21 -21
- package/README.md +115 -115
- package/dist/animation/animationType.d.ts +15 -15
- package/dist/animation/core/animation/Animation.d.ts +16 -0
- package/dist/animation/core/animation/FluidValue.d.ts +21 -0
- package/dist/animation/core/animation/RequestAnimationFrame.d.ts +8 -0
- package/dist/animation/core/animation/SpringAnimation.d.ts +41 -0
- package/dist/animation/core/animation/TimingAnimation.d.ts +35 -0
- package/dist/animation/core/animation/TransitionValue.d.ts +21 -0
- package/dist/animation/core/controllers/Animation.d.ts +16 -0
- package/dist/animation/core/controllers/FluidValue.d.ts +32 -0
- package/dist/animation/core/controllers/RequestAnimationFrame.d.ts +8 -0
- package/dist/animation/core/controllers/SpringAnimation.d.ts +41 -0
- package/dist/animation/core/controllers/TimingAnimation.d.ts +35 -0
- package/dist/animation/core/easing/Bezier.d.ts +8 -0
- package/dist/animation/core/easing/Easing.d.ts +40 -0
- package/dist/animation/core/helpers/camelCaseToKebabCase.d.ts +8 -0
- package/dist/animation/core/helpers/camelToDash.d.ts +7 -0
- package/dist/animation/core/helpers/canInterpolate.d.ts +11 -0
- package/dist/animation/core/helpers/getAnimatableObject.d.ts +22 -0
- package/dist/animation/core/helpers/getCleanProps.d.ts +10 -0
- package/dist/animation/core/helpers/getCssValue.d.ts +8 -0
- package/dist/animation/core/helpers/getNonAnimatableStyle.d.ts +6 -0
- package/dist/animation/core/helpers/index.d.ts +5 -0
- package/dist/animation/core/helpers/isDefined.d.ts +12 -0
- package/dist/animation/core/helpers/isFluidValue.d.ts +6 -0
- package/dist/animation/core/index.d.ts +11 -0
- package/dist/animation/core/interpolation/Colors.d.ts +25 -0
- package/dist/animation/core/interpolation/Interpolation.d.ts +80 -0
- package/dist/animation/core/interpolation/__tests__/Colors.test.d.ts +1 -0
- package/dist/animation/core/react/Tags.d.ts +3 -0
- package/dist/animation/core/react/TransformStyles.d.ts +8 -0
- package/dist/animation/core/react/animated.d.ts +29 -0
- package/dist/animation/core/react/combineRefs.d.ts +2 -0
- package/dist/animation/core/react/fluid.d.ts +6 -0
- package/dist/animation/core/react/functions/camelToDash.d.ts +7 -0
- package/dist/animation/core/react/functions/getAnimatableObject.d.ts +22 -0
- package/dist/animation/core/react/functions/getCleanProps.d.ts +4 -0
- package/dist/animation/core/react/functions/getCssValue.d.ts +8 -0
- package/dist/animation/core/react/functions/getNonAnimatableStyle.d.ts +6 -0
- package/dist/animation/core/react/functions/index.d.ts +7 -0
- package/dist/animation/core/react/functions/isDefined.d.ts +6 -0
- package/dist/animation/core/react/functions/isTransitionValue.d.ts +6 -0
- package/dist/animation/core/react/helpers/camelToDash.d.ts +7 -0
- package/dist/animation/core/react/helpers/canInterpolate.d.ts +7 -0
- package/dist/animation/core/react/helpers/getAnimatableObject.d.ts +22 -0
- package/dist/animation/core/react/helpers/getCleanProps.d.ts +4 -0
- package/dist/animation/core/react/helpers/getCssValue.d.ts +8 -0
- package/dist/animation/core/react/helpers/getNonAnimatableStyle.d.ts +6 -0
- package/dist/animation/core/react/helpers/index.d.ts +7 -0
- package/dist/animation/core/react/helpers/isDefined.d.ts +6 -0
- package/dist/animation/core/react/helpers/isFluidValue.d.ts +6 -0
- package/dist/animation/core/react/helpers/isTransitionValue.d.ts +6 -0
- package/dist/animation/core/react/makeFluid.d.ts +30 -0
- package/dist/animation/core/react/transforms.d.ts +6 -0
- package/dist/animation/core/react/useFluidValue.d.ts +9 -0
- package/dist/animation/core/react/useMount.d.ts +20 -0
- package/dist/animation/core/react/useMounts.d.ts +26 -0
- package/dist/animation/core/react/useTransition.d.ts +9 -0
- package/dist/animation/core/react/useTransitions.d.ts +11 -0
- package/dist/animation/core/types/animation.d.ts +54 -0
- package/dist/animation/core/types/common.d.ts +4 -0
- package/dist/animation/core/types/fluid.d.ts +19 -0
- package/dist/animation/core/types/index.d.ts +2 -0
- package/dist/animation/getInitialConfig.d.ts +3 -3
- package/dist/animation/index.d.ts +6 -6
- package/dist/animation/interpolation.d.ts +21 -21
- package/dist/animation/lib/animationType.d.ts +15 -0
- package/dist/animation/lib/getInitialConfig.d.ts +3 -0
- package/dist/animation/lib/index.d.ts +5 -0
- package/dist/animation/lib/interpolation.d.ts +20 -0
- package/dist/animation/lib/modules/AnimatedBlock.d.ts +8 -0
- package/dist/animation/lib/modules/AnimatedImage.d.ts +8 -0
- package/dist/animation/lib/modules/AnimatedInline.d.ts +8 -0
- package/dist/animation/lib/modules/MountedBlock.d.ts +29 -0
- package/dist/animation/lib/modules/ScrollableBlock.d.ts +22 -0
- package/dist/animation/lib/modules/TransitionBlock.d.ts +18 -0
- package/dist/animation/lib/modules/index.d.ts +6 -0
- package/dist/animation/lib/useAnimatedValue.d.ts +17 -0
- package/dist/animation/lib/useMountedValue.d.ts +14 -0
- package/dist/animation/modules/AnimatedBlock.d.ts +8 -8
- package/dist/animation/modules/AnimatedImage.d.ts +8 -8
- package/dist/animation/modules/AnimatedInline.d.ts +8 -8
- package/dist/animation/modules/MountedBlock.d.ts +29 -18
- package/dist/animation/modules/ScrollableBlock.d.ts +21 -21
- package/dist/animation/modules/TransitionBlock.d.ts +17 -17
- package/dist/animation/modules/index.d.ts +6 -6
- package/dist/animation/useAnimatedValue.d.ts +22 -22
- package/dist/animation/useMountedValue.d.ts +15 -15
- package/dist/gestures/controllers/DragGesture.d.ts +17 -17
- package/dist/gestures/controllers/Gesture.d.ts +20 -20
- package/dist/gestures/controllers/MouseMoveGesture.d.ts +13 -13
- package/dist/gestures/controllers/ScrollGesture.d.ts +14 -14
- package/dist/gestures/controllers/WheelGesture.d.ts +15 -15
- package/dist/gestures/controllers/index.d.ts +4 -4
- package/dist/gestures/eventAttacher.d.ts +11 -11
- package/dist/gestures/helpers/eventAttacher.d.ts +11 -0
- package/dist/gestures/helpers/index.d.ts +1 -0
- package/dist/gestures/helpers/math.d.ts +34 -0
- package/dist/gestures/helpers/withDefault.d.ts +4 -0
- package/dist/gestures/hooks/index.d.ts +5 -5
- package/dist/gestures/hooks/useDrag.d.ts +4 -4
- package/dist/gestures/hooks/useGesture.d.ts +9 -9
- package/dist/gestures/hooks/useMouseMove.d.ts +4 -4
- package/dist/gestures/hooks/useRecognizer.d.ts +10 -10
- package/dist/gestures/hooks/useScroll.d.ts +4 -4
- package/dist/gestures/hooks/useWheel.d.ts +4 -4
- package/dist/gestures/index.d.ts +2 -2
- package/dist/gestures/math.d.ts +34 -34
- package/dist/gestures/types.d.ts +51 -51
- package/dist/gestures/withDefault.d.ts +4 -4
- package/dist/hooks/index.d.ts +3 -3
- package/dist/hooks/useMeasure.d.ts +14 -14
- package/dist/hooks/useOutsideClick.d.ts +2 -2
- package/dist/hooks/useWindowDimension.d.ts +9 -9
- package/dist/index.d.ts +9 -5
- package/dist/index.js +2758 -1052
- package/dist/index.js.map +1 -1
- package/dist/utils/delay.d.ts +5 -5
- package/dist/utils/index.d.ts +1 -2
- package/dist/utils/isDefined.d.ts +1 -1
- package/ecosystem.config.js +12 -0
- package/example/README.md +46 -0
- package/example/package-lock.json +19597 -0
- package/example/package.json +45 -0
- package/example/public/favicon.ico +0 -0
- package/example/public/index.html +20 -0
- package/example/public/logo192.png +0 -0
- package/example/public/logo512.png +0 -0
- package/example/public/manifest.json +25 -0
- package/example/public/robots.txt +3 -0
- package/example/src/App.tsx +41 -0
- package/example/src/components/Draggable.tsx +46 -0
- package/example/src/components/Gestures.tsx +151 -0
- package/example/src/components/Interpolation.tsx +21 -0
- package/example/src/components/Loop.tsx +48 -0
- package/example/src/components/MountedBlock.tsx +25 -0
- package/example/src/components/MouseMove.tsx +59 -0
- package/example/src/components/MultistageTransition.tsx +34 -0
- package/example/src/components/Scroll.tsx +39 -0
- package/example/src/components/ScrollableBlock.tsx +27 -0
- package/example/src/components/SnapTo.tsx +55 -0
- package/example/src/components/TransitionBlock.tsx +37 -0
- package/example/src/components/Wheel.tsx +39 -0
- package/example/src/components/index.ts +18 -0
- package/example/src/components/svgLine.tsx +48 -0
- package/example/src/components/useAnimatedValue.tsx +57 -0
- package/example/src/components/useMountedValue.tsx +62 -0
- package/example/src/index.css +8 -0
- package/example/src/index.tsx +16 -0
- package/example/tsconfig.json +26 -0
- package/package.json +48 -48
- package/{rollup.config.js → rollup.config.mjs} +18 -18
- package/src/animation/core/controllers/Animation.ts +27 -0
- package/src/animation/core/controllers/FluidValue.ts +97 -0
- package/src/animation/core/controllers/RequestAnimationFrame.ts +13 -0
- package/src/animation/core/controllers/SpringAnimation.ts +218 -0
- package/src/animation/core/controllers/TimingAnimation.ts +152 -0
- package/src/animation/core/easing/Bezier.ts +146 -0
- package/src/animation/core/easing/Easing.ts +132 -0
- package/src/animation/core/helpers/camelCaseToKebabCase.ts +10 -0
- package/src/animation/core/helpers/getCleanProps.ts +16 -0
- package/src/animation/core/helpers/getCssValue.ts +60 -0
- package/src/animation/core/helpers/index.ts +5 -0
- package/src/animation/core/helpers/isDefined.ts +14 -0
- package/src/animation/core/helpers/isFluidValue.ts +11 -0
- package/src/animation/core/index.ts +16 -0
- package/src/animation/core/interpolation/Colors.ts +232 -0
- package/src/animation/core/interpolation/Interpolation.ts +395 -0
- package/src/animation/core/interpolation/__tests__/Colors.test.tsx +35 -0
- package/src/animation/core/react/fluid.ts +197 -0
- package/src/animation/core/react/makeFluid.ts +294 -0
- package/src/animation/core/react/transforms.ts +90 -0
- package/src/animation/core/react/useFluidValue.ts +43 -0
- package/src/animation/core/react/useMount.ts +58 -0
- package/src/animation/core/types/animation.d.ts +56 -0
- package/src/animation/core/types/common.d.ts +4 -0
- package/src/animation/core/types/fluid.d.ts +38 -0
- package/src/animation/{animationType.ts → lib/animationType.ts} +17 -17
- package/src/animation/{getInitialConfig.ts → lib/getInitialConfig.ts} +61 -61
- package/src/animation/lib/index.ts +12 -0
- package/src/animation/{interpolation.ts → lib/interpolation.ts} +47 -48
- package/src/animation/{modules → lib/modules}/AnimatedBlock.ts +8 -8
- package/src/animation/{modules → lib/modules}/AnimatedImage.ts +8 -8
- package/src/animation/{modules → lib/modules}/AnimatedInline.ts +8 -8
- package/src/animation/lib/modules/MountedBlock.tsx +51 -0
- package/src/animation/{modules → lib/modules}/ScrollableBlock.tsx +68 -69
- package/src/animation/{modules → lib/modules}/TransitionBlock.tsx +28 -29
- package/src/animation/{modules → lib/modules}/index.ts +6 -6
- package/src/animation/{useAnimatedValue.ts → lib/useAnimatedValue.ts} +60 -71
- package/src/animation/{useMountedValue.ts → lib/useMountedValue.ts} +18 -19
- package/src/gestures/controllers/DragGesture.ts +178 -177
- package/src/gestures/controllers/Gesture.ts +54 -54
- package/src/gestures/controllers/MouseMoveGesture.ts +111 -111
- package/src/gestures/controllers/ScrollGesture.ts +107 -107
- package/src/gestures/controllers/WheelGesture.ts +123 -123
- package/src/gestures/controllers/index.ts +4 -4
- package/src/gestures/{eventAttacher.ts → helpers/eventAttacher.ts} +67 -67
- package/src/gestures/helpers/index.ts +1 -0
- package/src/gestures/{math.ts → helpers/math.ts} +120 -120
- package/src/gestures/{withDefault.ts → helpers/withDefault.ts} +3 -3
- package/src/gestures/hooks/index.ts +5 -5
- package/src/gestures/hooks/useDrag.ts +14 -14
- package/src/gestures/hooks/useGesture.ts +38 -38
- package/src/gestures/hooks/useMouseMove.ts +11 -11
- package/src/gestures/hooks/useRecognizer.ts +59 -59
- package/src/gestures/hooks/useScroll.ts +11 -11
- package/src/gestures/hooks/useWheel.ts +11 -11
- package/src/gestures/{types.ts → types/index.d.ts} +49 -49
- package/src/hooks/index.ts +3 -3
- package/src/hooks/useMeasure.ts +132 -133
- package/src/hooks/useOutsideClick.ts +36 -36
- package/src/hooks/useWindowDimension.ts +58 -59
- package/src/index.ts +42 -5
- package/src/utils/delay.ts +9 -9
- package/src/utils/index.ts +1 -2
- package/tsconfig.json +24 -25
- package/src/animation/index.ts +0 -10
- package/src/animation/modules/MountedBlock.tsx +0 -25
- package/src/gestures/index.ts +0 -2
- package/src/utils/isDefined.ts +0 -4
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export interface UseAnimatedValueConfig extends
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
toValue: Length;
|
|
7
|
-
config?: UseAnimatedValueConfig;
|
|
8
|
-
};
|
|
9
|
-
export
|
|
10
|
-
/**
|
|
11
|
-
* `useAnimatedValue` returns an animation value with `.value` and `.currentValue` property which is
|
|
12
|
-
* initialized when passed to argument (`initialValue`). The retured value persist until the lifetime of
|
|
13
|
-
* a component. It doesnot cast any re-renders which can is very good for performance optimization.
|
|
14
|
-
*
|
|
15
|
-
* @param { string | number } initialValue - Initial value
|
|
16
|
-
* @param { UseAnimatedValueConfig } config - Animation configuration object.
|
|
17
|
-
*/
|
|
18
|
-
export declare function useAnimatedValue(initialValue: Length, config?: UseAnimatedValueConfig): {
|
|
19
|
-
value: ValueType;
|
|
20
|
-
currentValue: number | string;
|
|
21
|
-
};
|
|
22
|
-
export {};
|
|
1
|
+
import { FluidValueConfig } from './core';
|
|
2
|
+
type Length = number | string;
|
|
3
|
+
export interface UseAnimatedValueConfig extends FluidValueConfig {
|
|
4
|
+
}
|
|
5
|
+
type AssignValue = {
|
|
6
|
+
toValue: Length;
|
|
7
|
+
config?: UseAnimatedValueConfig;
|
|
8
|
+
};
|
|
9
|
+
export type ValueType = Length | AssignValue | ((update: (next: AssignValue) => Promise<any>) => void);
|
|
10
|
+
/**
|
|
11
|
+
* `useAnimatedValue` returns an animation value with `.value` and `.currentValue` property which is
|
|
12
|
+
* initialized when passed to argument (`initialValue`). The retured value persist until the lifetime of
|
|
13
|
+
* a component. It doesnot cast any re-renders which can is very good for performance optimization.
|
|
14
|
+
*
|
|
15
|
+
* @param { string | number } initialValue - Initial value
|
|
16
|
+
* @param { UseAnimatedValueConfig } config - Animation configuration object.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useAnimatedValue(initialValue: Length, config?: UseAnimatedValueConfig): {
|
|
19
|
+
value: ValueType;
|
|
20
|
+
currentValue: number | string;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { UseMountConfig, FluidValue } from '
|
|
3
|
-
export interface UseMountedValueConfig extends UseMountConfig {
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* `useMountedValue` handles mounting and unmounting of a component which captures current state
|
|
7
|
-
* passed as an arugment (`state`) and exposes the shadow state which handles the mount and unmount
|
|
8
|
-
* of a component.
|
|
9
|
-
*
|
|
10
|
-
* @param { boolean } state - Boolean indicating the component should mount or unmount.
|
|
11
|
-
* @param { UseMountedValueConfig } config - Animation configuration.
|
|
12
|
-
*/
|
|
13
|
-
export declare function useMountedValue(state: boolean, config: UseMountedValueConfig): (cb: (value: {
|
|
14
|
-
value: FluidValue;
|
|
15
|
-
}, mounted: boolean) => React.ReactNode) =>
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { UseMountConfig, FluidValue } from './core';
|
|
3
|
+
export interface UseMountedValueConfig extends UseMountConfig {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* `useMountedValue` handles mounting and unmounting of a component which captures current state
|
|
7
|
+
* passed as an arugment (`state`) and exposes the shadow state which handles the mount and unmount
|
|
8
|
+
* of a component.
|
|
9
|
+
*
|
|
10
|
+
* @param { boolean } state - Boolean indicating the component should mount or unmount.
|
|
11
|
+
* @param { UseMountedValueConfig } config - Animation configuration.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useMountedValue(state: boolean, config: UseMountedValueConfig): (cb: (value: {
|
|
14
|
+
value: FluidValue;
|
|
15
|
+
}, mounted: boolean) => React.ReactNode) => React.ReactNode;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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
|
-
}
|
|
1
|
+
import { Gesture } from './Gesture';
|
|
2
|
+
import type { Vector2 } from '../types';
|
|
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
|
+
}
|
|
@@ -1,20 +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
|
-
}
|
|
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
|
+
}
|
|
@@ -1,13 +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
|
-
}
|
|
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
|
+
}
|
|
@@ -1,14 +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
|
-
}
|
|
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
|
+
}
|
|
@@ -1,15 +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
|
-
}
|
|
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
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './DragGesture';
|
|
2
|
-
export * from './MouseMoveGesture';
|
|
3
|
-
export * from './ScrollGesture';
|
|
4
|
-
export * from './WheelGesture';
|
|
1
|
+
export * from './DragGesture';
|
|
2
|
+
export * from './MouseMoveGesture';
|
|
3
|
+
export * from './ScrollGesture';
|
|
4
|
+
export * from './WheelGesture';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
|
11
|
-
export {};
|
|
1
|
+
type MouseEventType = 'click' | 'dblclick' | 'mousedown' | 'mousemove' | 'mouseup' | 'touchstart' | 'touchmove' | 'touchend' | 'mouseenter' | 'mouseleave' | 'mouseout' | 'mouseover' | 'scroll' | 'wheel' | 'contextmenu';
|
|
2
|
+
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?: Array<string>) => void;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type MouseEventType = 'click' | 'dblclick' | 'mousedown' | 'mousemove' | 'mouseup' | 'touchstart' | 'touchmove' | 'touchend' | 'mouseenter' | 'mouseleave' | 'mouseout' | 'mouseover' | 'scroll' | 'wheel' | 'contextmenu';
|
|
2
|
+
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?: Array<string>) => void;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './math';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* bin(booleanValue)
|
|
3
|
+
* returns 1 if booleanValue == true and 0 if booleanValue == false
|
|
4
|
+
*/
|
|
5
|
+
export declare function bin(bool: boolean): 0 | 1;
|
|
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,5 +1,5 @@
|
|
|
1
|
-
export * from './useDrag';
|
|
2
|
-
export * from './useMouseMove';
|
|
3
|
-
export * from './useScroll';
|
|
4
|
-
export * from './useWheel';
|
|
5
|
-
export * from './useGesture';
|
|
1
|
+
export * from './useDrag';
|
|
2
|
+
export * from './useMouseMove';
|
|
3
|
+
export * from './useScroll';
|
|
4
|
+
export * from './useWheel';
|
|
5
|
+
export * from './useGesture';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DragEventType, UseDragConfig } from '../types';
|
|
2
|
-
export declare function useDrag(callback: (event: DragEventType) => void, config?: UseDragConfig): (index?: number
|
|
3
|
-
ref: any;
|
|
4
|
-
};
|
|
1
|
+
import { DragEventType, UseDragConfig } from '../types';
|
|
2
|
+
export declare function useDrag(callback: (event: DragEventType) => void, config?: UseDragConfig): (index?: number) => {
|
|
3
|
+
ref: any;
|
|
4
|
+
};
|
|
@@ -1,9 +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
|
|
8
|
-
ref: any;
|
|
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) => {
|
|
8
|
+
ref: any;
|
|
9
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MouseMoveEventType } from '../types';
|
|
2
|
-
export declare function useMouseMove(callback: (event: MouseMoveEventType) => void): (index?: number
|
|
3
|
-
ref: any;
|
|
4
|
-
};
|
|
1
|
+
import { MouseMoveEventType } from '../types';
|
|
2
|
+
export declare function useMouseMove(callback: (event: MouseMoveEventType) => void): (index?: number) => {
|
|
3
|
+
ref: any;
|
|
4
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
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
|
|
8
|
-
ref: any;
|
|
9
|
-
};
|
|
10
|
-
export {};
|
|
1
|
+
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) => {
|
|
8
|
+
ref: any;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ScrollEventType } from '../types';
|
|
2
|
-
export declare function useScroll(callback: (event: ScrollEventType) => void): (index?: number
|
|
3
|
-
ref: any;
|
|
4
|
-
};
|
|
1
|
+
import { ScrollEventType } from '../types';
|
|
2
|
+
export declare function useScroll(callback: (event: ScrollEventType) => void): (index?: number) => {
|
|
3
|
+
ref: any;
|
|
4
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WheelEventType } from '../types';
|
|
2
|
-
export declare function useWheel(callback: (event: WheelEventType) => void): (index?: number
|
|
3
|
-
ref: any;
|
|
4
|
-
};
|
|
1
|
+
import { WheelEventType } from '../types';
|
|
2
|
+
export declare function useWheel(callback: (event: WheelEventType) => void): (index?: number) => {
|
|
3
|
+
ref: any;
|
|
4
|
+
};
|
package/dist/gestures/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './hooks';
|
|
2
|
-
export * from './math';
|
|
1
|
+
export * from './hooks';
|
|
2
|
+
export * from './helpers/math';
|
package/dist/gestures/math.d.ts
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
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
|
+
/**
|
|
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[];
|
package/dist/gestures/types.d.ts
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
velocityX: number;
|
|
3
|
-
velocityY: number;
|
|
4
|
-
directionX: number;
|
|
5
|
-
directionY: number;
|
|
6
|
-
};
|
|
7
|
-
export
|
|
8
|
-
args: Array<number | undefined>;
|
|
9
|
-
down: boolean;
|
|
10
|
-
movementX: number;
|
|
11
|
-
movementY: number;
|
|
12
|
-
offsetX: number;
|
|
13
|
-
offsetY: number;
|
|
14
|
-
distanceX: number;
|
|
15
|
-
distanceY: number;
|
|
16
|
-
cancel: () => void;
|
|
17
|
-
} & GenericEventType;
|
|
18
|
-
export
|
|
19
|
-
args: Array<number | undefined>;
|
|
20
|
-
event: MouseEvent;
|
|
21
|
-
target: EventTarget | undefined | null;
|
|
22
|
-
isMoving: boolean;
|
|
23
|
-
mouseX: number;
|
|
24
|
-
mouseY: number;
|
|
25
|
-
} & GenericEventType;
|
|
26
|
-
export
|
|
27
|
-
isScrolling: boolean;
|
|
28
|
-
scrollX: number;
|
|
29
|
-
scrollY: number;
|
|
30
|
-
} & GenericEventType;
|
|
31
|
-
export
|
|
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;
|
|
41
|
-
export
|
|
42
|
-
initial?: () => {
|
|
43
|
-
movementX: number;
|
|
44
|
-
movementY: number;
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
export
|
|
48
|
-
x: number;
|
|
49
|
-
y: number;
|
|
50
|
-
};
|
|
51
|
-
export {};
|
|
1
|
+
type GenericEventType = {
|
|
2
|
+
velocityX: number;
|
|
3
|
+
velocityY: number;
|
|
4
|
+
directionX: number;
|
|
5
|
+
directionY: number;
|
|
6
|
+
};
|
|
7
|
+
export type DragEventType = {
|
|
8
|
+
args: Array<number | undefined>;
|
|
9
|
+
down: boolean;
|
|
10
|
+
movementX: number;
|
|
11
|
+
movementY: number;
|
|
12
|
+
offsetX: number;
|
|
13
|
+
offsetY: number;
|
|
14
|
+
distanceX: number;
|
|
15
|
+
distanceY: number;
|
|
16
|
+
cancel: () => void;
|
|
17
|
+
} & GenericEventType;
|
|
18
|
+
export type MouseMoveEventType = {
|
|
19
|
+
args: Array<number | undefined>;
|
|
20
|
+
event: MouseEvent;
|
|
21
|
+
target: EventTarget | undefined | null;
|
|
22
|
+
isMoving: boolean;
|
|
23
|
+
mouseX: number;
|
|
24
|
+
mouseY: number;
|
|
25
|
+
} & GenericEventType;
|
|
26
|
+
export type ScrollEventType = {
|
|
27
|
+
isScrolling: boolean;
|
|
28
|
+
scrollX: number;
|
|
29
|
+
scrollY: number;
|
|
30
|
+
} & GenericEventType;
|
|
31
|
+
export 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;
|
|
41
|
+
export type UseDragConfig = {
|
|
42
|
+
initial?: () => {
|
|
43
|
+
movementX: number;
|
|
44
|
+
movementY: number;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export type Vector2 = {
|
|
48
|
+
x: number;
|
|
49
|
+
y: number;
|
|
50
|
+
};
|
|
51
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const withDefault: (x: number, y: number) => {
|
|
2
|
-
x: number;
|
|
3
|
-
y: number;
|
|
4
|
-
};
|
|
1
|
+
export declare const withDefault: (x: number, y: number) => {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
};
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./useOutsideClick";
|
|
2
|
-
export * from "./useMeasure";
|
|
3
|
-
export * from "./useWindowDimension";
|
|
1
|
+
export * from "./useOutsideClick";
|
|
2
|
+
export * from "./useMeasure";
|
|
3
|
+
export * from "./useWindowDimension";
|