react-ui-animate 1.4.2 → 1.4.3

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/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "react-ui-animate",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "React library for gestures and animation",
5
5
  "main": "dist/index.js",
6
6
  "dependencies": {
7
- "@raidipesh78/re-motion": "^1.0.5"
7
+ "@raidipesh78/re-motion": "^1.0.6"
8
8
  },
9
9
  "peerDependencies": {
10
10
  "react": ">=16.13.1",
@@ -1,20 +0,0 @@
1
- import { ExtrapolateConfig } from "@raidipesh78/re-motion";
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/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[];
package/dist/Modules.d.ts DELETED
@@ -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 {};
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,5 +0,0 @@
1
- /**
2
- * AnimatedBlock
3
- * <div /> element which can accept animation values
4
- */
5
- export declare const AnimatedBlock: any;
@@ -1,5 +0,0 @@
1
- /**
2
- * AnimatedImage
3
- * <img /> element which can accept animation values
4
- */
5
- export declare const AnimatedImage: any;
@@ -1,5 +0,0 @@
1
- /**
2
- * AnimatedInline
3
- * <span /> element which can accept animation values
4
- */
5
- export declare const AnimatedInline: any;
@@ -1,17 +0,0 @@
1
- import * as React from "react";
2
- import { TransitionValue } from "@raidipesh78/re-motion";
3
- import { InnerUseMountedValueConfig } from "../useMountedValue";
4
- interface MountedBlockProps {
5
- state: boolean;
6
- children: (animation: {
7
- value: TransitionValue;
8
- }) => React.ReactNode;
9
- config?: InnerUseMountedValueConfig;
10
- }
11
- /**
12
- * MountedBlock handles mounting and unmounting of a component
13
- * @props - state: boolean, config: InnerUseMountedValueConfig
14
- * @children - (animation: { value: TransitionValue }) => React.ReactNode
15
- */
16
- export declare const MountedBlock: ({ state, children, config, }: MountedBlockProps) => JSX.Element;
17
- export {};
@@ -1,16 +0,0 @@
1
- import * as React from "react";
2
- import { UseAnimatedValueConfig } from "../useAnimatedValue";
3
- interface ScrollableBlockProps {
4
- children?: (animation: any) => React.ReactNode;
5
- direction?: "single" | "both";
6
- threshold?: number;
7
- animationConfig?: UseAnimatedValueConfig;
8
- }
9
- /**
10
- * ScrollableBlock
11
- * Used to animate element when enter into viewport
12
- * Render props pattern with children accepts animation node
13
- * animated value goes from 0 to 1 when appear on viewport & vice versa.
14
- */
15
- export declare const ScrollableBlock: React.FC<ScrollableBlockProps>;
16
- export {};
@@ -1,6 +0,0 @@
1
- export * from "./makeAnimatedComponent";
2
- export * from "./AnimatedBlock";
3
- export * from "./AnimatedInline";
4
- export * from "./AnimatedImage";
5
- export * from "./ScrollableBlock";
6
- export * from "./MountedBlock";
@@ -1,4 +0,0 @@
1
- /**
2
- * Make any component animatable
3
- */
4
- export declare function makeAnimatedComponent(WrappedComponent: React.ElementType<any>): import("react").ForwardRefExoticComponent<Pick<any, string | number | symbol> & import("react").RefAttributes<unknown>>;
@@ -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";
@@ -1,3 +0,0 @@
1
- import { GenericAnimationConfig } from "./useAnimatedValue";
2
- export declare type InitialConfigType = "ease" | "elastic" | "stiff" | "wooble" | "bounce" | undefined;
3
- export declare const getInitialConfig: (animationType: InitialConfigType) => GenericAnimationConfig;
@@ -1,5 +0,0 @@
1
- import * as React from "react";
2
- import { DragEventType, UseDragConfig } from "../Types";
3
- export declare function useDrag(callback: (event: DragEventType) => void, config?: UseDragConfig, deps?: React.DependencyList): (index?: number | undefined) => {
4
- ref: any;
5
- };
@@ -1,5 +0,0 @@
1
- import * as React from "react";
2
- import { MouseMoveEventType } from "../Types";
3
- export declare function useMouseMove(callback: (event: MouseMoveEventType) => void, deps?: React.DependencyList): () => {
4
- ref: React.MutableRefObject<any>;
5
- };
@@ -1,5 +0,0 @@
1
- import * as React from "react";
2
- import { ScrollEventType } from "../Types";
3
- export declare function useScroll(callback: (event: ScrollEventType) => void, deps?: React.DependencyList): () => {
4
- ref: React.MutableRefObject<any>;
5
- };
@@ -1,5 +0,0 @@
1
- import * as React from "react";
2
- import { WheelEventType } from "../Types";
3
- export declare function useWheel(callback: (event: WheelEventType) => void, deps?: React.DependencyList): () => {
4
- ref: React.MutableRefObject<any>;
5
- };
@@ -1,30 +0,0 @@
1
- import { TransitionValue, ResultType } from "@raidipesh78/re-motion";
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 "@raidipesh78/re-motion";
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 {};