react-ui-animate 3.0.0-rc.0 → 3.0.0-rc.1

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 (158) hide show
  1. package/dist/gestures/helpers/math.d.ts +1 -1
  2. package/dist/index.js +1 -2897
  3. package/dist/index.js.map +1 -1
  4. package/package.json +2 -1
  5. package/.vscode/settings.json +0 -3
  6. package/dist/animation/animationType.d.ts +0 -15
  7. package/dist/animation/core/animation/Animation.d.ts +0 -16
  8. package/dist/animation/core/animation/FluidValue.d.ts +0 -21
  9. package/dist/animation/core/animation/RequestAnimationFrame.d.ts +0 -8
  10. package/dist/animation/core/animation/SpringAnimation.d.ts +0 -41
  11. package/dist/animation/core/animation/TimingAnimation.d.ts +0 -35
  12. package/dist/animation/core/animation/TransitionValue.d.ts +0 -21
  13. package/dist/animation/core/helpers/camelToDash.d.ts +0 -7
  14. package/dist/animation/core/helpers/canInterpolate.d.ts +0 -11
  15. package/dist/animation/core/helpers/getAnimatableObject.d.ts +0 -22
  16. package/dist/animation/core/helpers/getNonAnimatableStyle.d.ts +0 -6
  17. package/dist/animation/core/react/Tags.d.ts +0 -3
  18. package/dist/animation/core/react/TransformStyles.d.ts +0 -8
  19. package/dist/animation/core/react/animated.d.ts +0 -29
  20. package/dist/animation/core/react/combineRefs.d.ts +0 -2
  21. package/dist/animation/core/react/functions/camelToDash.d.ts +0 -7
  22. package/dist/animation/core/react/functions/getAnimatableObject.d.ts +0 -22
  23. package/dist/animation/core/react/functions/getCleanProps.d.ts +0 -4
  24. package/dist/animation/core/react/functions/getCssValue.d.ts +0 -8
  25. package/dist/animation/core/react/functions/getNonAnimatableStyle.d.ts +0 -6
  26. package/dist/animation/core/react/functions/index.d.ts +0 -7
  27. package/dist/animation/core/react/functions/isDefined.d.ts +0 -6
  28. package/dist/animation/core/react/functions/isTransitionValue.d.ts +0 -6
  29. package/dist/animation/core/react/helpers/camelToDash.d.ts +0 -7
  30. package/dist/animation/core/react/helpers/canInterpolate.d.ts +0 -7
  31. package/dist/animation/core/react/helpers/getAnimatableObject.d.ts +0 -22
  32. package/dist/animation/core/react/helpers/getCleanProps.d.ts +0 -4
  33. package/dist/animation/core/react/helpers/getCssValue.d.ts +0 -8
  34. package/dist/animation/core/react/helpers/getNonAnimatableStyle.d.ts +0 -6
  35. package/dist/animation/core/react/helpers/index.d.ts +0 -7
  36. package/dist/animation/core/react/helpers/isDefined.d.ts +0 -6
  37. package/dist/animation/core/react/helpers/isFluidValue.d.ts +0 -6
  38. package/dist/animation/core/react/helpers/isTransitionValue.d.ts +0 -6
  39. package/dist/animation/core/react/useMounts.d.ts +0 -26
  40. package/dist/animation/core/react/useTransition.d.ts +0 -9
  41. package/dist/animation/core/react/useTransitions.d.ts +0 -11
  42. package/dist/animation/core/types/animation.d.ts +0 -54
  43. package/dist/animation/core/types/common.d.ts +0 -4
  44. package/dist/animation/core/types/fluid.d.ts +0 -19
  45. package/dist/animation/core/types/index.d.ts +0 -2
  46. package/dist/animation/getInitialConfig.d.ts +0 -3
  47. package/dist/animation/index.d.ts +0 -6
  48. package/dist/animation/interpolation.d.ts +0 -21
  49. package/dist/animation/modules/AnimatedBlock.d.ts +0 -8
  50. package/dist/animation/modules/AnimatedImage.d.ts +0 -8
  51. package/dist/animation/modules/AnimatedInline.d.ts +0 -8
  52. package/dist/animation/modules/MountedBlock.d.ts +0 -29
  53. package/dist/animation/modules/ScrollableBlock.d.ts +0 -21
  54. package/dist/animation/modules/TransitionBlock.d.ts +0 -17
  55. package/dist/animation/modules/index.d.ts +0 -6
  56. package/dist/animation/useAnimatedValue.d.ts +0 -22
  57. package/dist/animation/useMountedValue.d.ts +0 -15
  58. package/dist/gestures/eventAttacher.d.ts +0 -11
  59. package/dist/gestures/index.d.ts +0 -2
  60. package/dist/gestures/math.d.ts +0 -34
  61. package/dist/gestures/types.d.ts +0 -51
  62. package/dist/gestures/withDefault.d.ts +0 -4
  63. package/dist/utils/isDefined.d.ts +0 -1
  64. package/ecosystem.config.js +0 -12
  65. package/example/README.md +0 -46
  66. package/example/package-lock.json +0 -19597
  67. package/example/package.json +0 -45
  68. package/example/public/favicon.ico +0 -0
  69. package/example/public/index.html +0 -20
  70. package/example/public/logo192.png +0 -0
  71. package/example/public/logo512.png +0 -0
  72. package/example/public/manifest.json +0 -25
  73. package/example/public/robots.txt +0 -3
  74. package/example/src/App.tsx +0 -41
  75. package/example/src/components/Draggable.tsx +0 -46
  76. package/example/src/components/Gestures.tsx +0 -151
  77. package/example/src/components/Interpolation.tsx +0 -21
  78. package/example/src/components/Loop.tsx +0 -48
  79. package/example/src/components/MountedBlock.tsx +0 -25
  80. package/example/src/components/MouseMove.tsx +0 -59
  81. package/example/src/components/MultistageTransition.tsx +0 -34
  82. package/example/src/components/Scroll.tsx +0 -39
  83. package/example/src/components/ScrollableBlock.tsx +0 -27
  84. package/example/src/components/SnapTo.tsx +0 -55
  85. package/example/src/components/TransitionBlock.tsx +0 -37
  86. package/example/src/components/Wheel.tsx +0 -39
  87. package/example/src/components/index.ts +0 -18
  88. package/example/src/components/svgLine.tsx +0 -48
  89. package/example/src/components/useAnimatedValue.tsx +0 -57
  90. package/example/src/components/useMountedValue.tsx +0 -62
  91. package/example/src/index.css +0 -8
  92. package/example/src/index.tsx +0 -16
  93. package/example/tsconfig.json +0 -26
  94. package/rollup.config.mjs +0 -18
  95. package/src/animation/core/controllers/Animation.ts +0 -27
  96. package/src/animation/core/controllers/FluidValue.ts +0 -97
  97. package/src/animation/core/controllers/RequestAnimationFrame.ts +0 -13
  98. package/src/animation/core/controllers/SpringAnimation.ts +0 -218
  99. package/src/animation/core/controllers/TimingAnimation.ts +0 -152
  100. package/src/animation/core/easing/Bezier.ts +0 -146
  101. package/src/animation/core/easing/Easing.ts +0 -132
  102. package/src/animation/core/helpers/camelCaseToKebabCase.ts +0 -10
  103. package/src/animation/core/helpers/getCleanProps.ts +0 -16
  104. package/src/animation/core/helpers/getCssValue.ts +0 -60
  105. package/src/animation/core/helpers/index.ts +0 -5
  106. package/src/animation/core/helpers/isDefined.ts +0 -14
  107. package/src/animation/core/helpers/isFluidValue.ts +0 -11
  108. package/src/animation/core/index.ts +0 -16
  109. package/src/animation/core/interpolation/Colors.ts +0 -232
  110. package/src/animation/core/interpolation/Interpolation.ts +0 -395
  111. package/src/animation/core/interpolation/__tests__/Colors.test.tsx +0 -35
  112. package/src/animation/core/react/fluid.ts +0 -197
  113. package/src/animation/core/react/makeFluid.ts +0 -294
  114. package/src/animation/core/react/transforms.ts +0 -90
  115. package/src/animation/core/react/useFluidValue.ts +0 -43
  116. package/src/animation/core/react/useMount.ts +0 -58
  117. package/src/animation/core/types/animation.d.ts +0 -56
  118. package/src/animation/core/types/common.d.ts +0 -4
  119. package/src/animation/core/types/fluid.d.ts +0 -38
  120. package/src/animation/lib/animationType.ts +0 -17
  121. package/src/animation/lib/getInitialConfig.ts +0 -61
  122. package/src/animation/lib/index.ts +0 -12
  123. package/src/animation/lib/interpolation.ts +0 -47
  124. package/src/animation/lib/modules/AnimatedBlock.ts +0 -8
  125. package/src/animation/lib/modules/AnimatedImage.ts +0 -8
  126. package/src/animation/lib/modules/AnimatedInline.ts +0 -8
  127. package/src/animation/lib/modules/MountedBlock.tsx +0 -51
  128. package/src/animation/lib/modules/ScrollableBlock.tsx +0 -68
  129. package/src/animation/lib/modules/TransitionBlock.tsx +0 -28
  130. package/src/animation/lib/modules/index.ts +0 -6
  131. package/src/animation/lib/useAnimatedValue.ts +0 -60
  132. package/src/animation/lib/useMountedValue.ts +0 -18
  133. package/src/gestures/controllers/DragGesture.ts +0 -178
  134. package/src/gestures/controllers/Gesture.ts +0 -54
  135. package/src/gestures/controllers/MouseMoveGesture.ts +0 -111
  136. package/src/gestures/controllers/ScrollGesture.ts +0 -107
  137. package/src/gestures/controllers/WheelGesture.ts +0 -123
  138. package/src/gestures/controllers/index.ts +0 -4
  139. package/src/gestures/helpers/eventAttacher.ts +0 -67
  140. package/src/gestures/helpers/index.ts +0 -1
  141. package/src/gestures/helpers/math.ts +0 -120
  142. package/src/gestures/helpers/withDefault.ts +0 -3
  143. package/src/gestures/hooks/index.ts +0 -5
  144. package/src/gestures/hooks/useDrag.ts +0 -14
  145. package/src/gestures/hooks/useGesture.ts +0 -38
  146. package/src/gestures/hooks/useMouseMove.ts +0 -11
  147. package/src/gestures/hooks/useRecognizer.ts +0 -59
  148. package/src/gestures/hooks/useScroll.ts +0 -11
  149. package/src/gestures/hooks/useWheel.ts +0 -11
  150. package/src/gestures/types/index.d.ts +0 -49
  151. package/src/hooks/index.ts +0 -3
  152. package/src/hooks/useMeasure.ts +0 -132
  153. package/src/hooks/useOutsideClick.ts +0 -36
  154. package/src/hooks/useWindowDimension.ts +0 -58
  155. package/src/index.ts +0 -42
  156. package/src/utils/delay.ts +0 -9
  157. package/src/utils/index.ts +0 -1
  158. package/tsconfig.json +0 -24
@@ -1,8 +0,0 @@
1
- /**
2
- * AnimatedBlock - A higher order component built upon `div` element
3
- * which can accept `AnimatedValue`. It also exposes some extra style properties like
4
- * translateX, translateY, rotateX, rotateY, scaleX, etc.
5
- */
6
- export declare const AnimatedBlock: import("react").ForwardRefExoticComponent<Omit<import("../core").FluidHTMLAttributes<"div"> & import("../core").FluidSVGAttributes<"div">, "style"> & {
7
- style?: import("../core").FluidCSSProperties;
8
- } & import("react").RefAttributes<unknown>>;
@@ -1,8 +0,0 @@
1
- /**
2
- * AnimatedImage - A higher order component built upon `img` element
3
- * which can accept `AnimatedValue`. It also exposes some extra style properties like
4
- * translateX, translateY, rotateX, rotateY, scaleX, etc.
5
- */
6
- export declare const AnimatedImage: import("react").ForwardRefExoticComponent<Omit<import("../core").FluidHTMLAttributes<"img"> & import("../core").FluidSVGAttributes<"img">, "style"> & {
7
- style?: import("../core").FluidCSSProperties;
8
- } & import("react").RefAttributes<unknown>>;
@@ -1,8 +0,0 @@
1
- /**
2
- * AnimatedInline - A higher order component built upon `span` element
3
- * which can accept `AnimatedValue`. It also exposes some extra style properties like
4
- * translateX, translateY, rotateX, rotateY, scaleX, etc.
5
- */
6
- export declare const AnimatedInline: import("react").ForwardRefExoticComponent<Omit<import("../core").FluidHTMLAttributes<"span"> & import("../core").FluidSVGAttributes<"span">, "style"> & {
7
- style?: import("../core").FluidCSSProperties;
8
- } & import("react").RefAttributes<unknown>>;
@@ -1,29 +0,0 @@
1
- import * as React from 'react';
2
- import { FluidValue, FluidValueConfig } from '../core';
3
- interface MountedValueConfig extends FluidValueConfig {
4
- }
5
- interface MountedBlockProps {
6
- state: boolean;
7
- children: (animation: {
8
- value: FluidValue;
9
- }) => React.ReactNode;
10
- from?: number;
11
- enter?: number;
12
- exit?: number;
13
- config?: MountedValueConfig;
14
- enterConfig?: MountedValueConfig;
15
- exitConfig?: MountedValueConfig;
16
- }
17
- /**
18
- * MountedBlock - Higher order component which handles mounting and unmounting of a component.
19
- * @prop { boolean } state - Boolean indicating the component should mount or unmount.
20
- * @prop { function } children - Child as a function with `AnimatedValue` on `.value` property.
21
- * @prop { number } from - Number that dictates the beginning state for animation.
22
- * @prop { number } enter - Number that dictates the entry state for animation.
23
- * @prop { number } exit - Number that dictates the exit state for animation.
24
- * @prop { MountedValueConfig } config - Animation configuration for overall animation.
25
- * @prop { MountedValueConfig } enterConfig - Animation configuration for the entering state of animation.
26
- * @prop { MountedValueConfig } exitConfig - Animation configuration for the entering state of animation.
27
- */
28
- export declare const MountedBlock: ({ state, children, from, enter, exit, config, enterConfig, exitConfig, }: MountedBlockProps) => import("react/jsx-runtime").JSX.Element;
29
- export {};
@@ -1,21 +0,0 @@
1
- import * as React from 'react';
2
- import { UseAnimatedValueConfig, ValueType } from '../useAnimatedValue';
3
- interface ScrollableBlockProps {
4
- children?: (animation: {
5
- value: ValueType;
6
- }) => React.ReactNode;
7
- direction?: 'single' | 'both';
8
- threshold?: number;
9
- animationConfig?: UseAnimatedValueConfig;
10
- }
11
- /**
12
- * ScrollableBlock - Higher order component to handle the entrance or exit animation
13
- * of a component when it enters or exit the viewport. Accepts child as a function with
14
- * `AnimatedValue` as its first argument which can be interpolated on input range [0, 1]
15
- * @prop { function } children - child as a function with `AnimatedValue` as its first argument.
16
- * @prop { 'single' | 'both' } direction - single applies animation on enter once, both applies on enter and exit.
17
- * @prop { number } threshold - should be in range 0 to 1 which equivalent to `IntersectionObserver` threshold.
18
- * @prop { UseAnimatedValueConfig } animationConfig - Animation config
19
- */
20
- export declare const ScrollableBlock: (props: ScrollableBlockProps) => import("react/jsx-runtime").JSX.Element;
21
- export {};
@@ -1,17 +0,0 @@
1
- import * as React from 'react';
2
- import { UseAnimatedValueConfig, ValueType } from '../useAnimatedValue';
3
- interface TransitionBlockProps {
4
- state: boolean;
5
- children: (animation: {
6
- value: ValueType;
7
- }) => React.ReactNode;
8
- config?: UseAnimatedValueConfig;
9
- }
10
- /**
11
- * TransitionBlock - Higher order component which animates on state change.
12
- * @prop { boolean } state - Boolean indicating the current state of animation, usually `false = 0 and true = 1`.
13
- * @prop { function } children - Child as a function with `AnimatedValue` on `.value` property.
14
- * @prop { UseAnimatedValueConfig } config - Animation configuration.
15
- */
16
- export declare const TransitionBlock: ({ state, children, config, }: TransitionBlockProps) => import("react/jsx-runtime").JSX.Element;
17
- export {};
@@ -1,6 +0,0 @@
1
- export * from './AnimatedBlock';
2
- export * from './AnimatedInline';
3
- export * from './AnimatedImage';
4
- export * from './MountedBlock';
5
- export * from './ScrollableBlock';
6
- export * from './TransitionBlock';
@@ -1,22 +0,0 @@
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 +0,0 @@
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,11 +0,0 @@
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 {};
@@ -1,2 +0,0 @@
1
- export * from './hooks';
2
- export * from './helpers/math';
@@ -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[];
@@ -1,51 +0,0 @@
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 +0,0 @@
1
- export declare const withDefault: (x: number, y: number) => {
2
- x: number;
3
- y: number;
4
- };
@@ -1 +0,0 @@
1
- export declare const isDefined: <T>(value: T) => boolean;
@@ -1,12 +0,0 @@
1
- module.exports = {
2
- apps : [
3
- {
4
- name : "core-library",
5
- script : "npm start"
6
- },
7
- {
8
- name: "example",
9
- script: "cd example && npm start"
10
- }
11
- ]
12
- }
package/example/README.md DELETED
@@ -1,46 +0,0 @@
1
- # Getting Started with Create React App
2
-
3
- This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4
-
5
- ## Available Scripts
6
-
7
- In the project directory, you can run:
8
-
9
- ### `npm start`
10
-
11
- Runs the app in the development mode.\
12
- Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
13
-
14
- The page will reload if you make edits.\
15
- You will also see any lint errors in the console.
16
-
17
- ### `npm test`
18
-
19
- Launches the test runner in the interactive watch mode.\
20
- See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21
-
22
- ### `npm run build`
23
-
24
- Builds the app for production to the `build` folder.\
25
- It correctly bundles React in production mode and optimizes the build for the best performance.
26
-
27
- The build is minified and the filenames include the hashes.\
28
- Your app is ready to be deployed!
29
-
30
- See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31
-
32
- ### `npm run eject`
33
-
34
- **Note: this is a one-way operation. Once you `eject`, you can’t go back!**
35
-
36
- If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37
-
38
- Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
39
-
40
- You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
41
-
42
- ## Learn More
43
-
44
- You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45
-
46
- To learn React, check out the [React documentation](https://reactjs.org/).