react-ui-animate 4.0.0-rc.3 → 4.0.0-rc.5

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.
Files changed (47) hide show
  1. package/.idea/codeStyles/Project.xml +59 -0
  2. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  3. package/.idea/misc.xml +15 -0
  4. package/.idea/modules.xml +8 -0
  5. package/.idea/prettier.xml +7 -0
  6. package/.idea/react-ui-animate.iml +9 -0
  7. package/.idea/vcs.xml +6 -0
  8. package/README.md +17 -17
  9. package/dist/animation/controllers/index.d.ts +8 -0
  10. package/dist/animation/controllers/withConfig.d.ts +5 -0
  11. package/dist/animation/controllers/withDecay.d.ts +7 -0
  12. package/dist/animation/controllers/withDelay.d.ts +6 -0
  13. package/dist/animation/controllers/withEase.d.ts +6 -0
  14. package/dist/animation/controllers/withLoop.d.ts +2 -0
  15. package/dist/animation/controllers/withSequence.d.ts +2 -0
  16. package/dist/animation/controllers/withSpring.d.ts +7 -0
  17. package/dist/animation/controllers/withTiming.d.ts +7 -0
  18. package/dist/animation/core/FluidArrayController.d.ts +2 -2
  19. package/dist/animation/core/FluidController.d.ts +5 -3
  20. package/dist/animation/core/useFluidValue.d.ts +2 -2
  21. package/dist/animation/core/useFluidValues.d.ts +3 -0
  22. package/dist/animation/core/useMount.d.ts +3 -3
  23. package/dist/animation/helpers/animationType.d.ts +59 -0
  24. package/dist/animation/helpers/getToValue.d.ts +2 -0
  25. package/dist/animation/helpers/index.d.ts +2 -0
  26. package/dist/animation/hooks/index.d.ts +3 -0
  27. package/dist/animation/hooks/useMount.d.ts +15 -0
  28. package/dist/animation/hooks/useValue.d.ts +17 -0
  29. package/dist/animation/hooks/useValues.d.ts +8 -0
  30. package/dist/animation/index.d.ts +3 -5
  31. package/dist/animation/interpolation/colors.d.ts +25 -0
  32. package/dist/animation/interpolation/index.d.ts +1 -0
  33. package/dist/animation/interpolation/interpolate.d.ts +11 -0
  34. package/dist/animation/interpolation/interpolateNumbers.d.ts +8 -0
  35. package/dist/animation/modules/MountedBlock.d.ts +7 -10
  36. package/dist/animation/modules/ScrollableBlock.d.ts +5 -4
  37. package/dist/animation/modules/TransitionBlock.d.ts +5 -4
  38. package/dist/index.d.ts +5 -5
  39. package/dist/index.js +1 -1
  40. package/dist/index.js.map +1 -1
  41. package/package.json +1 -1
  42. package/dist/animation/animationType.d.ts +0 -16
  43. package/dist/animation/core/inerpolate.d.ts +0 -9
  44. package/dist/animation/interpolation.d.ts +0 -25
  45. package/dist/animation/useAnimatedValue.d.ts +0 -21
  46. package/dist/animation/useMountedValue.d.ts +0 -15
  47. package/dist/animation/withFunctions.d.ts +0 -107
@@ -0,0 +1,59 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <code_scheme name="Project" version="173">
3
+ <HTMLCodeStyleSettings>
4
+ <option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
5
+ </HTMLCodeStyleSettings>
6
+ <JSCodeStyleSettings version="0">
7
+ <option name="FORCE_SEMICOLON_STYLE" value="true" />
8
+ <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
9
+ <option name="USE_DOUBLE_QUOTES" value="false" />
10
+ <option name="FORCE_QUOTE_STYlE" value="true" />
11
+ <option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
12
+ <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
13
+ <option name="SPACES_WITHIN_IMPORTS" value="true" />
14
+ </JSCodeStyleSettings>
15
+ <TypeScriptCodeStyleSettings version="0">
16
+ <option name="FORCE_SEMICOLON_STYLE" value="true" />
17
+ <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
18
+ <option name="USE_DOUBLE_QUOTES" value="false" />
19
+ <option name="FORCE_QUOTE_STYlE" value="true" />
20
+ <option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
21
+ <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
22
+ <option name="SPACES_WITHIN_IMPORTS" value="true" />
23
+ </TypeScriptCodeStyleSettings>
24
+ <VueCodeStyleSettings>
25
+ <option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
26
+ <option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
27
+ </VueCodeStyleSettings>
28
+ <codeStyleSettings language="HTML">
29
+ <option name="SOFT_MARGINS" value="80" />
30
+ <indentOptions>
31
+ <option name="INDENT_SIZE" value="2" />
32
+ <option name="CONTINUATION_INDENT_SIZE" value="2" />
33
+ <option name="TAB_SIZE" value="2" />
34
+ </indentOptions>
35
+ </codeStyleSettings>
36
+ <codeStyleSettings language="JavaScript">
37
+ <option name="SOFT_MARGINS" value="80" />
38
+ <indentOptions>
39
+ <option name="INDENT_SIZE" value="2" />
40
+ <option name="CONTINUATION_INDENT_SIZE" value="2" />
41
+ <option name="TAB_SIZE" value="2" />
42
+ </indentOptions>
43
+ </codeStyleSettings>
44
+ <codeStyleSettings language="TypeScript">
45
+ <option name="SOFT_MARGINS" value="80" />
46
+ <indentOptions>
47
+ <option name="INDENT_SIZE" value="2" />
48
+ <option name="CONTINUATION_INDENT_SIZE" value="2" />
49
+ <option name="TAB_SIZE" value="2" />
50
+ </indentOptions>
51
+ </codeStyleSettings>
52
+ <codeStyleSettings language="Vue">
53
+ <option name="SOFT_MARGINS" value="80" />
54
+ <indentOptions>
55
+ <option name="CONTINUATION_INDENT_SIZE" value="2" />
56
+ </indentOptions>
57
+ </codeStyleSettings>
58
+ </code_scheme>
59
+ </component>
@@ -0,0 +1,5 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <state>
3
+ <option name="USE_PER_PROJECT_SETTINGS" value="true" />
4
+ </state>
5
+ </component>
package/.idea/misc.xml ADDED
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="MaterialThemeProjectNewConfig">
4
+ <option name="metadata">
5
+ <MTProjectMetadataState>
6
+ <option name="migrated" value="true" />
7
+ <option name="pristineConfig" value="false" />
8
+ <option name="userId" value="66c3e7aa:1918d7077fc:-7ffe" />
9
+ </MTProjectMetadataState>
10
+ </option>
11
+ </component>
12
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_22" default="true" project-jdk-name="openjdk-22" project-jdk-type="JavaSDK">
13
+ <output url="file://$PROJECT_DIR$/out" />
14
+ </component>
15
+ </project>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/react-ui-animate.iml" filepath="$PROJECT_DIR$/.idea/react-ui-animate.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="PrettierConfiguration">
4
+ <option name="myConfigurationMode" value="AUTOMATIC" />
5
+ <option name="myRunOnSave" value="true" />
6
+ </component>
7
+ </project>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="JAVA_MODULE" version="4">
3
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
4
+ <exclude-output />
5
+ <content url="file://$MODULE_DIR$" />
6
+ <orderEntry type="inheritedJdk" />
7
+ <orderEntry type="sourceFolder" forTests="false" />
8
+ </component>
9
+ </module>
package/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
package/README.md CHANGED
@@ -21,11 +21,11 @@ yarn add react-ui-animate
21
21
  The `react-ui-animate` library provides a straightforward way to add animations and gestures to your React components. Here’s how you can get started quickly:
22
22
 
23
23
  ```javascript
24
- import { animate, useAnimatedValue } from 'react-ui-animate';
24
+ import { animate, useValue } from 'react-ui-animate';
25
25
 
26
26
  export default function () {
27
27
  // Initialize an animated opacity value
28
- const opacity = useAnimatedValue(0);
28
+ const opacity = useValue(0);
29
29
 
30
30
  return (
31
31
  <div>
@@ -52,12 +52,12 @@ In this example, clicking the "Animate Me" button smoothly changes the opacity o
52
52
 
53
53
  ### Key Features
54
54
 
55
- #### `useAnimatedValue()`
55
+ #### `useValue()`
56
56
 
57
- The `useAnimatedValue()` hook is central to creating animations. It initializes an animated value and allows you to seamlessly update it to create dynamic effects.
57
+ The `useValue()` hook is central to creating animations. It initializes an animated value and allows you to seamlessly update it to create dynamic effects.
58
58
 
59
59
  ```javascript
60
- const opacity = useAnimatedValue(0); // Start with opacity set to 0
60
+ const opacity = useValue(0); // Start with opacity set to 0
61
61
 
62
62
  // Use in style
63
63
  style={{
@@ -70,10 +70,10 @@ onClick={() => (opacity.value = 1)} // Changes the opacity to 1
70
70
 
71
71
  #### `animate.div`
72
72
 
73
- `animate.div` is a special component designed to work with `useAnimatedValue()`. It simplifies animating elements by directly using animated values.
73
+ `animate.div` is a special component designed to work with `useValue()`. It simplifies animating elements by directly using animated values.
74
74
 
75
75
  ```javascript
76
- const width = useAnimatedValue(100); // Start with a width of 100
76
+ const width = useValue(100); // Start with a width of 100
77
77
 
78
78
  <animate.div
79
79
  style={{
@@ -89,9 +89,9 @@ const width = useAnimatedValue(100); // Start with a width of 100
89
89
  The `interpolate()` function is useful for mapping values from one range to another, enabling more complex animations.
90
90
 
91
91
  ```javascript
92
- import { useAnimatedValue, animate, interpolate } from 'react-ui-animate';
92
+ import { useValue, animate, interpolate } from 'react-ui-animate';
93
93
 
94
- const width = useAnimatedValue(100); // Start with a width of 100
94
+ const width = useValue(100); // Start with a width of 100
95
95
 
96
96
  <animate.div
97
97
  style={{
@@ -134,17 +134,17 @@ x.value = withDelay(1000, withSpring(100));
134
134
 
135
135
  In this example, a spring animation to `100` will be applied after a 1-second delay.
136
136
 
137
- #### `useMountedValue()`
137
+ #### `useMount()`
138
138
 
139
- The `useMountedValue()` hook facilitates managing the mounting and unmounting of a component with animations.
139
+ The `useMount()` hook facilitates managing the mounting and unmounting of a component with animations.
140
140
 
141
141
  ```jsx
142
- import { useMountedValue } from 'react-ui-animate';
142
+ import { useMount } from 'react-ui-animate';
143
143
 
144
144
  export default function App() {
145
145
  const [visible, setVisible] = useState(false);
146
146
 
147
- const open = useMountedValue(visible, {
147
+ const open = useMount(visible, {
148
148
  from: 0,
149
149
  enter: 1,
150
150
  exit: 0,
@@ -157,8 +157,8 @@ export default function App() {
157
157
  In this example,
158
158
 
159
159
  1. A state variable `visible` determines whether the component is visible.
160
- 2. The `useMountedValue` hook takes `visible` as an argument and provides animation states for mounting and unmounting.
161
- 3. The `open` function, returned by `useMountedValue`, is used to conditionally render `animate.div` based on the `mounted` boolean and apply the transition animation.
160
+ 2. The `useMount` hook takes `visible` as an argument and provides animation states for mounting and unmounting.
161
+ 3. The `open` function, returned by `useMount`, is used to conditionally render `animate.div` based on the `mounted` boolean and apply the transition animation.
162
162
 
163
163
  ### Gestures
164
164
 
@@ -175,10 +175,10 @@ The `react-ui-animate` library also provides several hooks for handling differen
175
175
  Here’s an example of using the useDrag hook to enable drag gestures:
176
176
 
177
177
  ```jsx
178
- import { useAnimatedValue, animate, useDrag } from 'react-ui-animate';
178
+ import { useValue, animate, useDrag } from 'react-ui-animate';
179
179
 
180
180
  export const Draggable = () => {
181
- const translateX = useAnimatedValue(0);
181
+ const translateX = useValue(0);
182
182
 
183
183
  const bind = useDrag(function ({ down, movementX }) {
184
184
  translateX.value = down ? movementX : 0;
@@ -0,0 +1,8 @@
1
+ export { withConfig } from './withConfig';
2
+ export { withDecay } from './withDecay';
3
+ export { withDelay } from './withDelay';
4
+ export { withEase } from './withEase';
5
+ export { withSequence } from './withSequence';
6
+ export { withSpring } from './withSpring';
7
+ export { withTiming } from './withTiming';
8
+ export { withLoop } from './withLoop';
@@ -0,0 +1,5 @@
1
+ import type { UseValueConfig } from '../hooks';
2
+ import type { UpdateValue } from '../core/FluidController';
3
+ export interface WithOnCallbacks extends Pick<UseValueConfig, 'onRest' | 'onStart' | 'onChange'> {
4
+ }
5
+ export declare const withConfig: (toValue: number, config?: UseValueConfig) => UpdateValue;
@@ -0,0 +1,7 @@
1
+ import type { UseValueConfig } from '../hooks';
2
+ import type { WithOnCallbacks } from './withConfig';
3
+ import type { UpdateValue } from '../core/FluidController';
4
+ interface WithDecayConfig extends Pick<UseValueConfig, 'velocity' | 'deceleration'>, WithOnCallbacks {
5
+ }
6
+ export declare const withDecay: (config?: WithDecayConfig) => UpdateValue;
7
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { UseValueConfig } from '../hooks';
2
+ import type { UpdateValue } from '../core/FluidController';
3
+ export declare const withDelay: (delay: number, animation: {
4
+ toValue: number;
5
+ config?: UseValueConfig;
6
+ }) => UpdateValue;
@@ -0,0 +1,6 @@
1
+ import { type WithOnCallbacks } from './withConfig';
2
+ import type { UpdateValue } from '../core/FluidController';
3
+ interface WithEaseConfig extends WithOnCallbacks {
4
+ }
5
+ export declare const withEase: (toValue: number, config?: WithEaseConfig) => UpdateValue;
6
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { UpdateValue } from '../core/FluidController';
2
+ export declare const withLoop: (updateValue: UpdateValue | UpdateValue[], loop: number) => UpdateValue[];
@@ -0,0 +1,2 @@
1
+ import { type UpdateValue } from '../core/FluidController';
2
+ export declare const withSequence: (animations: Array<UpdateValue | number | Array<UpdateValue | number>>) => UpdateValue[];
@@ -0,0 +1,7 @@
1
+ import { type UseValueConfig } from '../hooks';
2
+ import { type WithOnCallbacks } from './withConfig';
3
+ import type { UpdateValue } from '../core/FluidController';
4
+ interface WithSpringConfig extends Pick<UseValueConfig, 'mass' | 'friction' | 'tension'>, WithOnCallbacks {
5
+ }
6
+ export declare const withSpring: (toValue: number, config?: WithSpringConfig) => UpdateValue;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import { type UseValueConfig } from '../hooks';
2
+ import { type WithOnCallbacks } from './withConfig';
3
+ import type { UpdateValue } from '../core/FluidController';
4
+ interface WithTimingConfig extends Pick<UseValueConfig, 'duration' | 'easing'>, WithOnCallbacks {
5
+ }
6
+ export declare const withTiming: (toValue: number, config?: WithTimingConfig) => UpdateValue;
7
+ export {};
@@ -1,7 +1,7 @@
1
- import type { AssignValue, UseFluidValueConfig } from './FluidController';
1
+ import type { UpdateValue, UseFluidValueConfig } from './FluidController';
2
2
  export declare class FluidArrayController {
3
3
  private fluidControllers;
4
4
  constructor(values: number[], config?: UseFluidValueConfig);
5
- setFluid(updateValue: AssignValue[], callback?: () => void): void;
5
+ setFluid(updateValue: Array<UpdateValue | UpdateValue[]>, callback?: () => void): void;
6
6
  getFluid(): import("@raidipesh78/re-motion").FluidValue[];
7
7
  }
@@ -15,18 +15,20 @@ export interface UseFluidValueConfig {
15
15
  decay?: boolean;
16
16
  velocity?: number;
17
17
  deceleration?: number;
18
+ loop?: number;
18
19
  }
19
- type UpdateValue = {
20
+ export type UpdateValue = {
20
21
  toValue?: number;
21
22
  config?: UseFluidValueConfig;
22
23
  };
23
- export type AssignValue = UpdateValue | Fn<Fn<UpdateValue, Promise<any>>, void>;
24
24
  export declare class FluidController {
25
25
  private fluid;
26
26
  private defaultConfig?;
27
+ private iterationsSoFar;
27
28
  constructor(value: number, config?: UseFluidValueConfig);
29
+ private getAnimation;
28
30
  private runAnimation;
29
- setFluid(updateValue: AssignValue, callback?: (value: number) => void): void;
31
+ setFluid(updateValue: UpdateValue | UpdateValue[], callback?: (value: number) => void): void;
30
32
  getFluid(): FluidValue;
31
33
  }
32
34
  export {};
@@ -1,3 +1,3 @@
1
1
  import { FluidValue } from '@raidipesh78/re-motion';
2
- import { AssignValue, UseFluidValueConfig } from './FluidController';
3
- export declare const useFluidValue: <T extends number | number[]>(value: T, config?: UseFluidValueConfig) => [T extends number ? FluidValue : FluidValue[], (updateValue: T extends number ? AssignValue : AssignValue[], callback?: () => void) => void];
2
+ import { UpdateValue, UseFluidValueConfig } from './FluidController';
3
+ export declare const useFluidValue: <T extends number>(value: T, config?: UseFluidValueConfig) => [FluidValue, (updateValue: UpdateValue | UpdateValue[], callback?: () => void) => void];
@@ -0,0 +1,3 @@
1
+ import { FluidValue } from '@raidipesh78/re-motion';
2
+ import { UpdateValue, UseFluidValueConfig } from './FluidController';
3
+ export declare const useFluidValues: <T extends number[]>(value: T, config?: UseFluidValueConfig) => [FluidValue[], (updateValue: Array<UpdateValue | UpdateValue[]>, callback?: () => void) => void];
@@ -1,9 +1,9 @@
1
1
  import { FluidValue } from '@raidipesh78/re-motion';
2
- import type { AssignValue, UseFluidValueConfig } from './FluidController';
2
+ import type { UpdateValue, UseFluidValueConfig } from './FluidController';
3
3
  export interface UseMountConfig {
4
4
  from: number;
5
- enter: number | AssignValue;
6
- exit: number | AssignValue;
5
+ enter: number | UpdateValue | number[] | UpdateValue[];
6
+ exit: number | UpdateValue | number[] | UpdateValue[];
7
7
  config?: UseFluidValueConfig;
8
8
  }
9
9
  /**
@@ -0,0 +1,59 @@
1
+ import { Easing } from '@raidipesh78/re-motion';
2
+ export declare const AnimationConfig: {
3
+ ELASTIC: {
4
+ mass: number;
5
+ friction: number;
6
+ tension: number;
7
+ };
8
+ BOUNCE: {
9
+ duration: number;
10
+ easing: typeof Easing.bounce;
11
+ };
12
+ EASE: {
13
+ mass: number;
14
+ friction: number;
15
+ tension: number;
16
+ };
17
+ STIFF: {
18
+ mass: number;
19
+ friction: number;
20
+ tension: number;
21
+ };
22
+ WOOBLE: {
23
+ mass: number;
24
+ friction: number;
25
+ tension: number;
26
+ };
27
+ EASE_IN: {
28
+ duration: number;
29
+ easing: (t: number) => number;
30
+ };
31
+ EASE_OUT: {
32
+ duration: number;
33
+ easing: (t: number) => number;
34
+ };
35
+ EASE_IN_OUT: {
36
+ duration: number;
37
+ easing: (t: number) => number;
38
+ };
39
+ POWER1: {
40
+ duration: number;
41
+ easing: (t: number) => number;
42
+ };
43
+ POWER2: {
44
+ duration: number;
45
+ easing: (t: number) => number;
46
+ };
47
+ POWER3: {
48
+ duration: number;
49
+ easing: (t: number) => number;
50
+ };
51
+ POWER4: {
52
+ duration: number;
53
+ easing: (t: number) => number;
54
+ };
55
+ LINEAR: {
56
+ duration: number;
57
+ easing: typeof Easing.linear;
58
+ };
59
+ };
@@ -0,0 +1,2 @@
1
+ import { UpdateValue, UseFluidValueConfig } from '../core/FluidController';
2
+ export declare function getToValue(value: number | UpdateValue, config?: UseFluidValueConfig): UpdateValue;
@@ -1,2 +1,4 @@
1
1
  export * from './isDefined';
2
2
  export * from './delay';
3
+ export * from './getToValue';
4
+ export * from './animationType';
@@ -0,0 +1,3 @@
1
+ export * from './useValue';
2
+ export * from './useValues';
3
+ export * from './useMount';
@@ -0,0 +1,15 @@
1
+ import { FluidValue } from '@raidipesh78/re-motion';
2
+ import { UseMountConfig as UseInternalMountConfig } from '../core/useMount';
3
+ export interface UseMountConfig extends UseInternalMountConfig {
4
+ }
5
+ /**
6
+ * `useMount` handles mounting and unmounting of a component which captures current state
7
+ * passed as an argument (`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 { UseMountConfig } config - Animation configuration.
12
+ */
13
+ export declare function useMount(state: boolean, config: UseMountConfig): (cb: (value: {
14
+ value: FluidValue;
15
+ }, mounted: boolean) => React.ReactNode) => import("react").ReactNode;
@@ -0,0 +1,17 @@
1
+ import { FluidValue } from '@raidipesh78/re-motion';
2
+ import type { UpdateValue, UseFluidValueConfig } from '../core/FluidController';
3
+ export interface UseValueConfig extends UseFluidValueConfig {
4
+ }
5
+ /**
6
+ * `useValue` returns an animation value with `.value` and `.currentValue` property which is
7
+ * initialized when passed to argument (`initialValue`). The returned value persist until the lifetime of
8
+ * a component. It doesn't cast any re-renders which can is very good for performance optimization.
9
+ *
10
+ * @param { number } initialValue - Initial value
11
+ * @param { UseValueConfig } config - Animation configuration object.
12
+ */
13
+ export declare function useValue<T extends number>(initialValue: T, config?: UseValueConfig): {
14
+ get value(): FluidValue;
15
+ set value(to: number | UpdateValue | number[] | UpdateValue[]);
16
+ readonly currentValue: number;
17
+ };
@@ -0,0 +1,8 @@
1
+ import { FluidValue } from '@raidipesh78/re-motion';
2
+ import { type UpdateValue } from '../core/FluidController';
3
+ import { type UseValueConfig } from './useValue';
4
+ export declare function useValues<T extends number[]>(initialValue: T, config?: UseValueConfig): {
5
+ get value(): FluidValue[];
6
+ set value(to: Array<number | number[] | UpdateValue | UpdateValue[]>);
7
+ readonly currentValue: number[];
8
+ };
@@ -1,7 +1,5 @@
1
1
  export { interpolate, bInterpolate } from './interpolation';
2
2
  export { MountedBlock, ScrollableBlock, TransitionBlock } from './modules';
3
- export { useAnimatedValue, UseAnimatedValueConfig } from './useAnimatedValue';
4
- export { useMountedValue, UseMountedValueConfig } from './useMountedValue';
5
- export { AnimationConfigUtils } from './animationType';
6
- export { withSpring, withTiming, withSequence, withDelay, withEase, withConfig, withDecay, } from './withFunctions';
7
- export { delay } from './helpers';
3
+ export { useValue, useValues, useMount, type UseValueConfig, type UseMountConfig, } from './hooks';
4
+ export { withSpring, withTiming, withSequence, withDelay, withEase, withConfig, withDecay, withLoop, } from './controllers';
5
+ export { delay, AnimationConfig } from './helpers';
@@ -0,0 +1,25 @@
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 {};
@@ -0,0 +1 @@
1
+ export { interpolate, bInterpolate } from './interpolate';
@@ -0,0 +1,11 @@
1
+ import { FluidValue } from '@raidipesh78/re-motion';
2
+ type ExtrapolateType = 'identity' | 'extend' | 'clamp';
3
+ type ExtrapolateConfig = {
4
+ extrapolate?: ExtrapolateType;
5
+ extrapolateLeft?: ExtrapolateType;
6
+ extrapolateRight?: ExtrapolateType;
7
+ };
8
+ type InterpolateReturnType<T> = T extends number ? number : ReturnType<FluidValue['interpolate']>;
9
+ export declare const interpolate: <T extends number | FluidValue>(value: T, inputRange: number[], outputRange: number[] | string[], extrapolateConfig?: ExtrapolateConfig) => InterpolateReturnType<T>;
10
+ export declare const bInterpolate: <T extends number | FluidValue>(value: T, minOutput: number | string, maxOutput: number | string, extrapolateConfig?: ExtrapolateConfig) => InterpolateReturnType<T>;
11
+ export {};
@@ -0,0 +1,8 @@
1
+ type ExtrapolateType = 'identity' | 'extend' | 'clamp';
2
+ type ExtrapolateConfig = {
3
+ extrapolate?: ExtrapolateType;
4
+ extrapolateLeft?: ExtrapolateType;
5
+ extrapolateRight?: ExtrapolateType;
6
+ };
7
+ export declare function interpolateNumbers(value: number, inputRange: Array<number>, outputRange: Array<number | string>, extrapolateConfig?: ExtrapolateConfig): any;
8
+ export {};
@@ -1,23 +1,20 @@
1
1
  import * as React from 'react';
2
- import type { UpdateValue, UseAnimatedValueConfig } from '../useAnimatedValue';
3
- interface MountedBlockProps {
2
+ import { type UseMountConfig } from '../hooks';
3
+ import { FluidValue } from '@raidipesh78/re-motion';
4
+ interface MountedBlockProps extends Partial<UseMountConfig> {
4
5
  state: boolean;
5
6
  children: (animation: {
6
- value: any;
7
+ value: FluidValue;
7
8
  }) => React.ReactNode;
8
- from?: number;
9
- enter?: number | UpdateValue;
10
- exit?: number | UpdateValue;
11
- config?: UseAnimatedValueConfig;
12
9
  }
13
10
  /**
14
11
  * MountedBlock - Higher order component which handles mounting and unmounting of a component.
15
12
  * @param { boolean } state - Boolean indicating the component should mount or unmount.
16
13
  * @param { function } children - Child as a function with `AnimatedValue` on `.value` property.
17
14
  * @param { number } } from - Number that dictates the beginning state for animation.
18
- * @param { number | { toValue: number, config: MountedValueConfig } } enter - Number that dictates the entry state for animation.
19
- * @param { number | { toValue: number, config: MountedValueConfig } } exit - Number that dictates the exit state for animation.
20
- * @param { UseAnimatedValueConfig } config - Animation configuration for overall animation.
15
+ * @param { number } enter - Number that dictates the entry state for animation.
16
+ * @param { number } exit - Number that dictates the exit state for animation.
17
+ * @param { UseValueConfig } config - Animation configuration for overall animation.
21
18
  */
22
19
  export declare const MountedBlock: ({ state, children, from, enter, exit, config, }: MountedBlockProps) => import("react/jsx-runtime").JSX.Element;
23
20
  export {};
@@ -1,12 +1,13 @@
1
1
  import * as React from 'react';
2
- import { UseAnimatedValueConfig } from '../useAnimatedValue';
2
+ import { FluidValue } from '@raidipesh78/re-motion';
3
+ import { type UseValueConfig } from '../hooks';
3
4
  interface ScrollableBlockProps {
4
5
  children?: (animation: {
5
- value: any;
6
+ value: FluidValue;
6
7
  }) => React.ReactNode;
7
8
  direction?: 'single' | 'both';
8
9
  threshold?: number;
9
- animationConfig?: UseAnimatedValueConfig;
10
+ animationConfig?: UseValueConfig;
10
11
  }
11
12
  /**
12
13
  * ScrollableBlock - Higher order component to handle the entrance or exit animation
@@ -15,7 +16,7 @@ interface ScrollableBlockProps {
15
16
  * @prop { function } children - child as a function with `AnimatedValue` as its first argument.
16
17
  * @prop { 'single' | 'both' } direction - single applies animation on enter once, both applies on enter and exit.
17
18
  * @prop { number } threshold - should be in range 0 to 1 which equivalent to `IntersectionObserver` threshold.
18
- * @prop { UseAnimatedValueConfig } animationConfig - Animation config
19
+ * @prop { UseValueConfig } animationConfig - Animation config
19
20
  */
20
21
  export declare const ScrollableBlock: (props: ScrollableBlockProps) => import("react/jsx-runtime").JSX.Element;
21
22
  export {};
@@ -1,17 +1,18 @@
1
1
  import * as React from 'react';
2
- import { UseAnimatedValueConfig } from '../useAnimatedValue';
2
+ import { FluidValue } from '@raidipesh78/re-motion';
3
+ import { type UseValueConfig } from '../hooks';
3
4
  interface TransitionBlockProps {
4
5
  state: boolean;
5
6
  children: (animation: {
6
- value: any;
7
+ value: FluidValue;
7
8
  }) => React.ReactNode;
8
- config?: UseAnimatedValueConfig;
9
+ config?: UseValueConfig;
9
10
  }
10
11
  /**
11
12
  * TransitionBlock - Higher order component which animates on state change.
12
13
  * @prop { boolean } state - Boolean indicating the current state of animation, usually `false = 0 and true = 1`.
13
14
  * @prop { function } children - Child as a function with `AnimatedValue` on `.value` property.
14
- * @prop { UseAnimatedValueConfig } config - Animation configuration.
15
+ * @prop { UseValueConfig } config - Animation configuration.
15
16
  */
16
17
  export declare const TransitionBlock: ({ state, children, config, }: TransitionBlockProps) => import("react/jsx-runtime").JSX.Element;
17
18
  export {};
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  export { Easing, makeFluid as makeAnimated, fluid as animate, } from '@raidipesh78/re-motion';
2
- export { AnimationConfigUtils, MountedBlock, ScrollableBlock, TransitionBlock, } from './animation';
3
- export { bInterpolate, interpolate } from './animation';
4
- export { useAnimatedValue, useMountedValue } from './animation';
5
- export { withSpring, withTiming, withSequence, withDelay, withEase, withConfig, withDecay, delay, } from './animation';
2
+ export { AnimationConfig, MountedBlock, ScrollableBlock, TransitionBlock, } from './animation';
3
+ export { interpolate, bInterpolate } from './animation';
4
+ export { useValue, useMount, useValues } from './animation';
5
+ export { withSpring, withTiming, withSequence, withDelay, withEase, withConfig, withDecay, withLoop, delay, } from './animation';
6
6
  export { useMeasure, useOutsideClick, useWindowDimension } from './hooks';
7
7
  export { useDrag, useGesture, useMouseMove, useScroll, useWheel, } from './gestures/hooks';
8
8
  export { bin, clamp, mix, rubberClamp, move, snapTo } from './gestures/helpers';
9
- export type { UseAnimatedValueConfig, UseMountedValueConfig, } from './animation';
9
+ export type { UseValueConfig, UseMountConfig } from './animation';