react-ui-animate 3.0.0-rc.3 → 3.0.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/dist/animation/{lib/animationType.d.ts → animationType.d.ts} +1 -1
- package/dist/animation/helpers/index.d.ts +2 -0
- package/dist/animation/helpers/isDefined.d.ts +1 -0
- package/dist/animation/{lib/index.d.ts → index.d.ts} +2 -1
- package/dist/animation/{lib/interpolation.d.ts → interpolation.d.ts} +1 -1
- package/dist/animation/{lib/modules → modules}/AnimatedBlock.d.ts +2 -2
- package/dist/animation/{lib/modules → modules}/AnimatedImage.d.ts +2 -2
- package/dist/animation/{lib/modules → modules}/AnimatedInline.d.ts +2 -2
- package/dist/animation/{lib/modules → modules}/MountedBlock.d.ts +1 -1
- package/dist/animation/{lib/useAnimatedValue.d.ts → useAnimatedValue.d.ts} +1 -1
- package/dist/animation/{lib/useMountedValue.d.ts → useMountedValue.d.ts} +1 -1
- package/dist/animation/{lib/withFunctions.d.ts → withFunctions.d.ts} +5 -5
- package/dist/index.d.ts +6 -7
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
- package/dist/animation/core/controllers/Animation.d.ts +0 -16
- package/dist/animation/core/controllers/FluidValue.d.ts +0 -32
- package/dist/animation/core/controllers/RequestAnimationFrame.d.ts +0 -8
- package/dist/animation/core/controllers/SpringAnimation.d.ts +0 -41
- package/dist/animation/core/controllers/TimingAnimation.d.ts +0 -35
- package/dist/animation/core/easing/Bezier.d.ts +0 -8
- package/dist/animation/core/easing/Easing.d.ts +0 -40
- package/dist/animation/core/helpers/camelCaseToKebabCase.d.ts +0 -8
- package/dist/animation/core/helpers/getCleanProps.d.ts +0 -10
- package/dist/animation/core/helpers/getCssValue.d.ts +0 -8
- package/dist/animation/core/helpers/index.d.ts +0 -5
- package/dist/animation/core/helpers/isDefined.d.ts +0 -12
- package/dist/animation/core/helpers/isFluidValue.d.ts +0 -10
- package/dist/animation/core/index.d.ts +0 -11
- package/dist/animation/core/interpolation/Colors.d.ts +0 -25
- package/dist/animation/core/interpolation/Interpolation.d.ts +0 -80
- package/dist/animation/core/interpolation/__tests__/Colors.test.d.ts +0 -1
- package/dist/animation/core/react/fluid.d.ts +0 -6
- package/dist/animation/core/react/makeFluid.d.ts +0 -30
- package/dist/animation/core/react/transforms.d.ts +0 -6
- package/dist/animation/core/react/useFluidValue.d.ts +0 -9
- package/dist/animation/core/react/useMount.d.ts +0 -20
- package/dist/animation/lib/getInitialConfig.d.ts +0 -4
- package/dist/utils/index.d.ts +0 -1
- /package/dist/{utils → animation/helpers}/delay.d.ts +0 -0
- /package/dist/animation/{lib/modules → modules}/ScrollableBlock.d.ts +0 -0
- /package/dist/animation/{lib/modules → modules}/TransitionBlock.d.ts +0 -0
- /package/dist/animation/{lib/modules → modules}/index.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-ui-animate",
|
|
3
|
-
"version": "3.0.0
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "React library for gestures and animation",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"peerDependencies": {
|
|
7
7
|
"react": ">=16.8.0 || >=17.0.0 || >=18.0.0"
|
|
8
8
|
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@raidipesh78/re-motion": "^3.0.7"
|
|
11
|
+
},
|
|
9
12
|
"devDependencies": {
|
|
10
13
|
"@rollup/plugin-terser": "^0.4.4",
|
|
11
14
|
"@types/jest": "^29.5.12",
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ResultType } from '../types/animation';
|
|
2
|
-
/**
|
|
3
|
-
* Base Animation class
|
|
4
|
-
*/
|
|
5
|
-
export declare class Animation {
|
|
6
|
-
_active: boolean;
|
|
7
|
-
_onEnd: any;
|
|
8
|
-
/**
|
|
9
|
-
* it is necessary to add _onRest function as well
|
|
10
|
-
* because _onEnd is always re-assigned with onUpdate callback
|
|
11
|
-
* so that _onRest function is not fired, so we have to duplicate it
|
|
12
|
-
*/
|
|
13
|
-
_onRest?: any;
|
|
14
|
-
_debounceOnEnd(result: ResultType): void;
|
|
15
|
-
stop(): void;
|
|
16
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { Length, ResultType, SubscribeFn, FluidValueConfig, OnUpdateFn, AssignValue } from '../types/animation';
|
|
2
|
-
import type { Fn } from '../types/common';
|
|
3
|
-
/**
|
|
4
|
-
* Represents a fluid value that can animate between states.
|
|
5
|
-
*/
|
|
6
|
-
export declare class FluidValue {
|
|
7
|
-
_subscribe: SubscribeFn;
|
|
8
|
-
_value: Length;
|
|
9
|
-
_config?: FluidValueConfig;
|
|
10
|
-
_currentValue: {
|
|
11
|
-
current: Length;
|
|
12
|
-
};
|
|
13
|
-
_subscriptions: Map<{
|
|
14
|
-
uuid: number;
|
|
15
|
-
property: string;
|
|
16
|
-
}, OnUpdateFn>;
|
|
17
|
-
get: () => Length;
|
|
18
|
-
/**
|
|
19
|
-
* Creates a new FluidValue instance.
|
|
20
|
-
* @param initialValue - The initial value of the fluid value.
|
|
21
|
-
* @param config - Optional configuration for the fluid value.
|
|
22
|
-
*/
|
|
23
|
-
constructor(initialValue: Length, config?: FluidValueConfig);
|
|
24
|
-
/**
|
|
25
|
-
* Animates from the current value to the updated value.
|
|
26
|
-
* Determines whether to perform a multi-stage or single-stage transition.
|
|
27
|
-
* @param updatedValue - The value to animate to, or a function that defines a multi-stage transition.
|
|
28
|
-
* @param config - Optional configuration for the animation.
|
|
29
|
-
* @param callback - Optional callback to be called after the animation ends.
|
|
30
|
-
*/
|
|
31
|
-
setValue(updatedValue: AssignValue, callback?: Fn<ResultType, void>): void;
|
|
32
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Animation } from './Animation';
|
|
2
|
-
import type { FluidValueConfig, ResultType } from '../types/animation';
|
|
3
|
-
/**
|
|
4
|
-
* Class implementing spring based animation
|
|
5
|
-
*/
|
|
6
|
-
export declare class SpringAnimation extends Animation {
|
|
7
|
-
_overshootClamping: boolean;
|
|
8
|
-
_restDisplacementThreshold: number;
|
|
9
|
-
_restSpeedThreshold: number;
|
|
10
|
-
_initialVelocity?: number;
|
|
11
|
-
_lastVelocity: number;
|
|
12
|
-
_startPosition: number;
|
|
13
|
-
_lastPosition: number;
|
|
14
|
-
_position: number;
|
|
15
|
-
_fromValue: number;
|
|
16
|
-
_toValue: any;
|
|
17
|
-
_mass: number;
|
|
18
|
-
_tension: number;
|
|
19
|
-
_friction: number;
|
|
20
|
-
_lastTime: number;
|
|
21
|
-
_onFrame: (value: number) => void;
|
|
22
|
-
_animationFrame: any;
|
|
23
|
-
_timeout: any;
|
|
24
|
-
_delay: number;
|
|
25
|
-
_onRest?: (value: ResultType) => void;
|
|
26
|
-
_onChange?: (value: number) => void;
|
|
27
|
-
constructor({ initialPosition, config, }: {
|
|
28
|
-
initialPosition: number;
|
|
29
|
-
config?: Omit<FluidValueConfig, 'duration' | 'easing'>;
|
|
30
|
-
});
|
|
31
|
-
onChange(value: number): void;
|
|
32
|
-
onUpdate(): void;
|
|
33
|
-
stop(): void;
|
|
34
|
-
set(toValue: number): void;
|
|
35
|
-
start({ toValue, onFrame, previousAnimation, onEnd, }: {
|
|
36
|
-
toValue: number;
|
|
37
|
-
onFrame: (value: number) => void;
|
|
38
|
-
previousAnimation?: SpringAnimation;
|
|
39
|
-
onEnd?: (result: ResultType) => void;
|
|
40
|
-
}): void;
|
|
41
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Animation } from './Animation';
|
|
2
|
-
import type { FluidValueConfig, ResultType } from '../types/animation';
|
|
3
|
-
/**
|
|
4
|
-
* Class implementing timing based animation
|
|
5
|
-
*/
|
|
6
|
-
export declare class TimingAnimation extends Animation {
|
|
7
|
-
_startTime: number;
|
|
8
|
-
_fromValue: number;
|
|
9
|
-
_toValue: any;
|
|
10
|
-
_duration: number;
|
|
11
|
-
_easing: (value: number) => number;
|
|
12
|
-
_onFrame: (value: number) => void;
|
|
13
|
-
_animationFrame: any;
|
|
14
|
-
_timeout: any;
|
|
15
|
-
_lastPosition: number;
|
|
16
|
-
_position: number;
|
|
17
|
-
_delay: number;
|
|
18
|
-
_tempDuration: number;
|
|
19
|
-
_onRest?: (value: ResultType) => void;
|
|
20
|
-
_onChange?: (value: number) => void;
|
|
21
|
-
constructor({ initialPosition, config, }: {
|
|
22
|
-
initialPosition: number;
|
|
23
|
-
config?: Omit<FluidValueConfig, 'mass' | 'friction' | 'tension'>;
|
|
24
|
-
});
|
|
25
|
-
onChange(value: number): void;
|
|
26
|
-
onUpdate(): void;
|
|
27
|
-
stop(): void;
|
|
28
|
-
set(toValue: number): void;
|
|
29
|
-
start({ toValue, onFrame, previousAnimation, onEnd, }: {
|
|
30
|
-
toValue: number;
|
|
31
|
-
onFrame: (value: number) => void;
|
|
32
|
-
previousAnimation?: TimingAnimation;
|
|
33
|
-
onEnd?: (result: ResultType) => void;
|
|
34
|
-
}): void;
|
|
35
|
-
}
|
|
@@ -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 };
|
|
@@ -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
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts a camelCase string to kebab-case.
|
|
3
|
-
* e.g. backgroundColor -> background-color
|
|
4
|
-
*
|
|
5
|
-
* @param str - The camelCase string to convert.
|
|
6
|
-
* @returns The converted kebab-case string.
|
|
7
|
-
*/
|
|
8
|
-
export declare function camelCaseToKebabCase(str: string): string;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filters out properties with fluid values from a given props object.
|
|
3
|
-
* This function removes any properties that are considered fluid values,
|
|
4
|
-
* typically those that subscribe to updates and therefore should not be
|
|
5
|
-
* included in a static props object.
|
|
6
|
-
*
|
|
7
|
-
* @param props - The original props object, which may include fluid values.
|
|
8
|
-
* @returns A new props object with fluid values removed.
|
|
9
|
-
*/
|
|
10
|
-
export declare const getCleanProps: ({ style, ...props }: any) => any;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* getCssValue() function to get css value with unit or without unit
|
|
3
|
-
* it is only for style property - it cannot be used with transform keys
|
|
4
|
-
* @param property - style property
|
|
5
|
-
* @param value - style value
|
|
6
|
-
* @returns - value with unit or without unit
|
|
7
|
-
*/
|
|
8
|
-
export declare function getCssValue(property: string, value: number | string): string | number;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks if a value is defined (not null or undefined).
|
|
3
|
-
*
|
|
4
|
-
* This utility function helps in determining whether a given value is neither `null` nor `undefined`.
|
|
5
|
-
* It can be useful for validation checks to ensure that a value is properly defined before proceeding
|
|
6
|
-
* with further operations.
|
|
7
|
-
*
|
|
8
|
-
* @param {T} value - The value to check.
|
|
9
|
-
* @returns {boolean} - Returns `true` if the value is neither `null` nor `undefined`, otherwise returns `false`.
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
export declare const isDefined: <T>(value: T) => value is NonNullable<T>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { FluidValue } from '../controllers/FluidValue';
|
|
2
|
-
/**
|
|
3
|
-
* Checks if the given value is of type FluidValue.
|
|
4
|
-
* A value is considered a FluidValue if it is defined,
|
|
5
|
-
* an object, and contains the '_subscribe' property.
|
|
6
|
-
*
|
|
7
|
-
* @param value - The value to check.
|
|
8
|
-
* @returns - True if the value is a FluidValue, false otherwise.
|
|
9
|
-
*/
|
|
10
|
-
export declare const isFluidValue: (value: unknown) => value is FluidValue;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { fluid } from './react/fluid';
|
|
2
|
-
export { makeFluid } from './react/makeFluid';
|
|
3
|
-
export { useFluidValue } from './react/useFluidValue';
|
|
4
|
-
export { useMount } from './react/useMount';
|
|
5
|
-
export { isFluidValue } from './helpers/isFluidValue';
|
|
6
|
-
export { Easing } from './easing/Easing';
|
|
7
|
-
export { interpolate } from './interpolation/Interpolation';
|
|
8
|
-
export { FluidValue } from './controllers/FluidValue';
|
|
9
|
-
export type { FluidValueConfig, Length } from './types/animation';
|
|
10
|
-
export type { UseMountConfig } from './react/useMount';
|
|
11
|
-
export type { ExtrapolateConfig } from './interpolation/Interpolation';
|
|
@@ -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 {};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { FluidValue } from '../controllers/FluidValue';
|
|
2
|
-
type ExtrapolateType = 'identity' | 'extend' | 'clamp';
|
|
3
|
-
export declare const _getTemplateString: (str: string) => string;
|
|
4
|
-
/**
|
|
5
|
-
* Function returns if the template of two strings are matched
|
|
6
|
-
* i.e. they can be interpolated
|
|
7
|
-
* @param str1 - first string
|
|
8
|
-
* @param str2 - second string
|
|
9
|
-
* @returns boolean indicating two strings matched or not
|
|
10
|
-
*/
|
|
11
|
-
export declare const stringMatched: (str1: string, str2: string) => boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Function which proccess the
|
|
14
|
-
* hexadecimal colors to its proper formats
|
|
15
|
-
* @param str - string
|
|
16
|
-
* @returns hex color string
|
|
17
|
-
*/
|
|
18
|
-
export declare const getProcessedColor: (str: string) => string;
|
|
19
|
-
export interface ExtrapolateConfig {
|
|
20
|
-
extrapolate?: ExtrapolateType;
|
|
21
|
-
extrapolateRight?: ExtrapolateType;
|
|
22
|
-
extrapolateLeft?: ExtrapolateType;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* interpolateNumbers to interpolate the numeric value
|
|
26
|
-
* @param value - number
|
|
27
|
-
* @param inputRange
|
|
28
|
-
* @param outputRange
|
|
29
|
-
* @param extrapolateConfig
|
|
30
|
-
* @returns - number | string
|
|
31
|
-
*/
|
|
32
|
-
export declare function interpolateNumbers(value: number, inputRange: Array<number>, outputRange: Array<number | string>, extrapolateConfig?: ExtrapolateConfig): any;
|
|
33
|
-
/**
|
|
34
|
-
* interpolateTransitionValue to interpolating TransitionValue type value
|
|
35
|
-
* @param value
|
|
36
|
-
* @param inputRange
|
|
37
|
-
* @param outputRange
|
|
38
|
-
* @param extrapolateConfig
|
|
39
|
-
* @returns TransitionValue
|
|
40
|
-
*/
|
|
41
|
-
export declare const interpolateTransitionValue: (value: FluidValue, inputRange: Array<number>, outputRange: Array<number | string>, extrapolateConfig?: ExtrapolateConfig) => {
|
|
42
|
-
isInterpolation: boolean;
|
|
43
|
-
interpolationConfig: {
|
|
44
|
-
inputRange: number[];
|
|
45
|
-
outputRange: (string | number)[];
|
|
46
|
-
extrapolateConfig: ExtrapolateConfig | undefined;
|
|
47
|
-
};
|
|
48
|
-
_subscribe: import("../types/animation").SubscribeFn;
|
|
49
|
-
_value: import("../types/animation").Length;
|
|
50
|
-
_config?: import("..").FluidValueConfig;
|
|
51
|
-
_currentValue: {
|
|
52
|
-
current: import("../types/animation").Length;
|
|
53
|
-
};
|
|
54
|
-
_subscriptions: Map<{
|
|
55
|
-
uuid: number;
|
|
56
|
-
property: string;
|
|
57
|
-
}, import("../types/animation").OnUpdateFn>;
|
|
58
|
-
get: () => import("../types/animation").Length;
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* interpolate function to interpolate both transition
|
|
62
|
-
* as well as numerical value
|
|
63
|
-
* @param value
|
|
64
|
-
* @param inputRange
|
|
65
|
-
* @param outputRange
|
|
66
|
-
* @param extrapolateConfig
|
|
67
|
-
*/
|
|
68
|
-
export declare const interpolate: (value: number | FluidValue, inputRange: Array<number>, outputRange: Array<number | string>, extrapolateConfig?: ExtrapolateConfig) => any;
|
|
69
|
-
/**
|
|
70
|
-
* Determines if two values can be interpolated.
|
|
71
|
-
* This function checks if two values, either numbers or strings,
|
|
72
|
-
* can be interpolated by ensuring they are of the same type and, in the case of strings,
|
|
73
|
-
* that they are compatible for interpolation based on processed color values.
|
|
74
|
-
*
|
|
75
|
-
* @param previousValue - The previous value to compare. Can be a number or a string.
|
|
76
|
-
* @param newValue - The new value to compare. Can be a number or a string.
|
|
77
|
-
* @returns True if interpolation is possible, false otherwise.
|
|
78
|
-
*/
|
|
79
|
-
export declare function canInterpolate(previousValue: number | string, newValue: number | string): boolean;
|
|
80
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { WrappedComponentOrTag } from '../types/fluid';
|
|
2
|
-
/**
|
|
3
|
-
* Higher-order component to make any component animatable.
|
|
4
|
-
*
|
|
5
|
-
* This function takes a React component or an HTML tag and returns a new component
|
|
6
|
-
* that can smoothly transition between states using fluid animations. It enhances
|
|
7
|
-
* the user experience by adding dynamic and engaging animations to the wrapped component.
|
|
8
|
-
*
|
|
9
|
-
* @param WrapperComponent - The React component or HTML tag to be wrapped with animation functionality.
|
|
10
|
-
* @returns - A new component with added animation capabilities.
|
|
11
|
-
*
|
|
12
|
-
* The returned component uses fluid animations to smoothly transition between different
|
|
13
|
-
* states. It supports both style and prop animations, handling transforms and other
|
|
14
|
-
* properties seamlessly. The component ensures that animations are efficiently applied
|
|
15
|
-
* and updated based on the current state and configuration of fluid values.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* const AnimatedDiv = makeFluid('div');
|
|
19
|
-
*
|
|
20
|
-
* const MyComponent = () => {
|
|
21
|
-
* const opacity = useAnimatedValue(1)
|
|
22
|
-
* return (
|
|
23
|
-
* <AnimatedDiv style={{ opacity: opacity.value }}>
|
|
24
|
-
* Hello, world!
|
|
25
|
-
* </AnimatedDiv>
|
|
26
|
-
* )};
|
|
27
|
-
*/
|
|
28
|
-
export declare function makeFluid<C extends WrappedComponentOrTag>(WrapperComponent: C): import("react").ForwardRefExoticComponent<Omit<import("../types/fluid").FluidHTMLAttributes<C> & import("../types/fluid").FluidSVGAttributes<C>, "style"> & {
|
|
29
|
-
style?: import("../types/fluid").FluidCSSProperties;
|
|
30
|
-
} & import("react").RefAttributes<unknown>>;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const styleTrasformKeys: readonly ["translate", "translateX", "translateY", "translateZ", "scale", "scaleX", "scaleY", "scaleZ", "rotate", "rotateX", "rotateY", "rotateZ", "skew", "skewX", "skewY"];
|
|
2
|
-
/**
|
|
3
|
-
* getTransform function returns transform string from style object
|
|
4
|
-
*/
|
|
5
|
-
export declare function getTransform(style: Record<string, any>): string;
|
|
6
|
-
export declare function isTransformKey(key: string): boolean;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FluidValue } from '../controllers/FluidValue';
|
|
2
|
-
import type { FluidValueConfig, Length, OnUpdateFn } from '../types/animation';
|
|
3
|
-
/**
|
|
4
|
-
* useFluidValue
|
|
5
|
-
*
|
|
6
|
-
* @param value - initial value
|
|
7
|
-
* @param config - the config object for `FluidValue`
|
|
8
|
-
*/
|
|
9
|
-
export declare const useFluidValue: (value: Length, config?: FluidValueConfig) => [FluidValue, OnUpdateFn];
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { FluidValue } from '../controllers/FluidValue';
|
|
2
|
-
import type { FluidValueConfig } from '../types/animation';
|
|
3
|
-
export interface UseMountConfig {
|
|
4
|
-
from: number;
|
|
5
|
-
enter: number;
|
|
6
|
-
exit: number;
|
|
7
|
-
enterConfig?: FluidValueConfig;
|
|
8
|
-
exitConfig?: FluidValueConfig;
|
|
9
|
-
config?: FluidValueConfig;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* `useMount`
|
|
13
|
-
*
|
|
14
|
-
* applies mounting and unmounting of a component according to state change
|
|
15
|
-
* applying transitions
|
|
16
|
-
*
|
|
17
|
-
* @param state - boolean indicating mount state of a component
|
|
18
|
-
* @param config - the config object `UseMountConfig`
|
|
19
|
-
*/
|
|
20
|
-
export declare const useMount: (state: boolean, config: UseMountConfig) => (callback: (animation: FluidValue, mounted: boolean) => React.ReactNode) => import("react").ReactNode;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { FluidValueConfig } from '../core';
|
|
2
|
-
type InitialConfigType = 'linear' | 'easein' | 'easeout' | 'easeinout' | 'ease' | 'power1' | 'power2' | 'power3' | 'power4' | 'elastic' | 'stiff' | 'wooble' | 'bounce';
|
|
3
|
-
export declare const getInitialConfig: (animationType?: InitialConfigType) => FluidValueConfig;
|
|
4
|
-
export {};
|
package/dist/utils/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './delay';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|