react-ui-animate 2.0.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 (117) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +115 -115
  3. package/dist/animation/core/controllers/Animation.d.ts +16 -0
  4. package/dist/animation/core/controllers/FluidValue.d.ts +32 -0
  5. package/dist/animation/core/controllers/RequestAnimationFrame.d.ts +8 -0
  6. package/dist/animation/core/controllers/SpringAnimation.d.ts +41 -0
  7. package/dist/animation/core/controllers/TimingAnimation.d.ts +35 -0
  8. package/dist/animation/core/easing/Bezier.d.ts +8 -0
  9. package/dist/animation/core/easing/Easing.d.ts +40 -0
  10. package/dist/animation/core/helpers/camelCaseToKebabCase.d.ts +8 -0
  11. package/dist/animation/core/helpers/getCleanProps.d.ts +10 -0
  12. package/dist/animation/core/helpers/getCssValue.d.ts +8 -0
  13. package/dist/animation/core/helpers/index.d.ts +5 -0
  14. package/dist/animation/core/helpers/isDefined.d.ts +12 -0
  15. package/dist/animation/core/helpers/isFluidValue.d.ts +6 -0
  16. package/dist/animation/core/index.d.ts +11 -0
  17. package/dist/animation/core/interpolation/Colors.d.ts +25 -0
  18. package/dist/animation/core/interpolation/Interpolation.d.ts +80 -0
  19. package/dist/animation/core/interpolation/__tests__/Colors.test.d.ts +1 -0
  20. package/dist/animation/core/react/fluid.d.ts +6 -0
  21. package/dist/animation/core/react/makeFluid.d.ts +30 -0
  22. package/dist/animation/core/react/transforms.d.ts +6 -0
  23. package/dist/animation/core/react/useFluidValue.d.ts +9 -0
  24. package/dist/animation/core/react/useMount.d.ts +20 -0
  25. package/dist/animation/lib/animationType.d.ts +15 -0
  26. package/dist/animation/lib/getInitialConfig.d.ts +3 -0
  27. package/dist/animation/lib/index.d.ts +5 -0
  28. package/dist/animation/{interpolation.d.ts → lib/interpolation.d.ts} +20 -21
  29. package/dist/animation/lib/modules/AnimatedBlock.d.ts +8 -0
  30. package/dist/animation/lib/modules/AnimatedImage.d.ts +8 -0
  31. package/dist/animation/lib/modules/AnimatedInline.d.ts +8 -0
  32. package/dist/animation/lib/modules/MountedBlock.d.ts +29 -0
  33. package/dist/animation/{modules → lib/modules}/ScrollableBlock.d.ts +22 -21
  34. package/dist/animation/{modules → lib/modules}/TransitionBlock.d.ts +18 -17
  35. package/dist/animation/{modules → lib/modules}/index.d.ts +6 -6
  36. package/dist/animation/{useAnimatedValue.d.ts → lib/useAnimatedValue.d.ts} +17 -22
  37. package/dist/animation/{useMountedValue.d.ts → lib/useMountedValue.d.ts} +14 -15
  38. package/dist/gestures/controllers/DragGesture.d.ts +17 -17
  39. package/dist/gestures/controllers/Gesture.d.ts +20 -20
  40. package/dist/gestures/controllers/MouseMoveGesture.d.ts +13 -13
  41. package/dist/gestures/controllers/ScrollGesture.d.ts +14 -14
  42. package/dist/gestures/controllers/WheelGesture.d.ts +15 -15
  43. package/dist/gestures/controllers/index.d.ts +4 -4
  44. package/dist/gestures/helpers/eventAttacher.d.ts +11 -0
  45. package/dist/gestures/helpers/index.d.ts +1 -0
  46. package/dist/gestures/{math.d.ts → helpers/math.d.ts} +34 -34
  47. package/dist/gestures/{withDefault.d.ts → helpers/withDefault.d.ts} +4 -4
  48. package/dist/gestures/hooks/index.d.ts +5 -5
  49. package/dist/gestures/hooks/useDrag.d.ts +4 -4
  50. package/dist/gestures/hooks/useGesture.d.ts +9 -9
  51. package/dist/gestures/hooks/useMouseMove.d.ts +4 -4
  52. package/dist/gestures/hooks/useRecognizer.d.ts +10 -10
  53. package/dist/gestures/hooks/useScroll.d.ts +4 -4
  54. package/dist/gestures/hooks/useWheel.d.ts +4 -4
  55. package/dist/hooks/index.d.ts +3 -3
  56. package/dist/hooks/useMeasure.d.ts +14 -14
  57. package/dist/hooks/useOutsideClick.d.ts +2 -2
  58. package/dist/hooks/useWindowDimension.d.ts +9 -9
  59. package/dist/index.d.ts +9 -5
  60. package/dist/index.js +1 -1191
  61. package/dist/index.js.map +1 -1
  62. package/dist/utils/delay.d.ts +5 -5
  63. package/dist/utils/index.d.ts +1 -2
  64. package/package.json +49 -48
  65. package/.vscode/settings.json +0 -3
  66. package/dist/animation/animationType.d.ts +0 -15
  67. package/dist/animation/getInitialConfig.d.ts +0 -3
  68. package/dist/animation/index.d.ts +0 -6
  69. package/dist/animation/modules/AnimatedBlock.d.ts +0 -8
  70. package/dist/animation/modules/AnimatedImage.d.ts +0 -8
  71. package/dist/animation/modules/AnimatedInline.d.ts +0 -8
  72. package/dist/animation/modules/MountedBlock.d.ts +0 -18
  73. package/dist/gestures/eventAttacher.d.ts +0 -11
  74. package/dist/gestures/index.d.ts +0 -2
  75. package/dist/gestures/types.d.ts +0 -51
  76. package/dist/utils/isDefined.d.ts +0 -1
  77. package/rollup.config.js +0 -18
  78. package/src/animation/animationType.ts +0 -17
  79. package/src/animation/getInitialConfig.ts +0 -61
  80. package/src/animation/index.ts +0 -10
  81. package/src/animation/interpolation.ts +0 -48
  82. package/src/animation/modules/AnimatedBlock.ts +0 -8
  83. package/src/animation/modules/AnimatedImage.ts +0 -8
  84. package/src/animation/modules/AnimatedInline.ts +0 -8
  85. package/src/animation/modules/MountedBlock.tsx +0 -25
  86. package/src/animation/modules/ScrollableBlock.tsx +0 -69
  87. package/src/animation/modules/TransitionBlock.tsx +0 -29
  88. package/src/animation/modules/index.ts +0 -6
  89. package/src/animation/useAnimatedValue.ts +0 -71
  90. package/src/animation/useMountedValue.ts +0 -19
  91. package/src/gestures/controllers/DragGesture.ts +0 -177
  92. package/src/gestures/controllers/Gesture.ts +0 -54
  93. package/src/gestures/controllers/MouseMoveGesture.ts +0 -111
  94. package/src/gestures/controllers/ScrollGesture.ts +0 -107
  95. package/src/gestures/controllers/WheelGesture.ts +0 -123
  96. package/src/gestures/controllers/index.ts +0 -4
  97. package/src/gestures/eventAttacher.ts +0 -67
  98. package/src/gestures/hooks/index.ts +0 -5
  99. package/src/gestures/hooks/useDrag.ts +0 -14
  100. package/src/gestures/hooks/useGesture.ts +0 -38
  101. package/src/gestures/hooks/useMouseMove.ts +0 -11
  102. package/src/gestures/hooks/useRecognizer.ts +0 -59
  103. package/src/gestures/hooks/useScroll.ts +0 -11
  104. package/src/gestures/hooks/useWheel.ts +0 -11
  105. package/src/gestures/index.ts +0 -2
  106. package/src/gestures/math.ts +0 -120
  107. package/src/gestures/types.ts +0 -49
  108. package/src/gestures/withDefault.ts +0 -3
  109. package/src/hooks/index.ts +0 -3
  110. package/src/hooks/useMeasure.ts +0 -133
  111. package/src/hooks/useOutsideClick.ts +0 -36
  112. package/src/hooks/useWindowDimension.ts +0 -59
  113. package/src/index.ts +0 -5
  114. package/src/utils/delay.ts +0 -9
  115. package/src/utils/index.ts +0 -2
  116. package/src/utils/isDefined.ts +0 -4
  117. package/tsconfig.json +0 -25
@@ -1,36 +0,0 @@
1
- import * as React from "react";
2
-
3
- import { attachEvents } from "../gestures/eventAttacher";
4
-
5
- export function useOutsideClick(
6
- elementRef: React.RefObject<HTMLElement>,
7
- callback: (event: MouseEvent) => void,
8
- deps?: React.DependencyList
9
- ) {
10
- const callbackRef = React.useRef<(event: MouseEvent) => void>();
11
-
12
- if (!callbackRef.current) {
13
- callbackRef.current = callback;
14
- }
15
-
16
- // Reinitiate callback when dependency change
17
- React.useEffect(() => {
18
- callbackRef.current = callback;
19
-
20
- return () => {
21
- callbackRef.current = () => false;
22
- };
23
- }, deps);
24
-
25
- React.useEffect(() => {
26
- const handleOutsideClick = (e: MouseEvent) => {
27
- if (!elementRef?.current?.contains(e.target as Element)) {
28
- callbackRef.current && callbackRef.current(e);
29
- }
30
- };
31
-
32
- const subscribe = attachEvents([document], [["click", handleOutsideClick]]);
33
-
34
- return () => subscribe && subscribe();
35
- }, []);
36
- }
@@ -1,59 +0,0 @@
1
- import * as React from "react";
2
-
3
- type WindowDimensionType = {
4
- width: number;
5
- height: number;
6
- innerWidth: number;
7
- innerHeight: number;
8
- };
9
-
10
- export function useWindowDimension(
11
- callback: (event: WindowDimensionType) => void,
12
- deps?: React.DependencyList
13
- ) {
14
- const windowDimensionsRef = React.useRef<WindowDimensionType>({
15
- width: 0,
16
- height: 0,
17
- innerWidth: 0,
18
- innerHeight: 0,
19
- });
20
- const callbackRef =
21
- React.useRef<(event: WindowDimensionType) => void>(callback);
22
-
23
- const handleCallback: () => void = () => {
24
- if (callbackRef) {
25
- callbackRef.current({
26
- ...windowDimensionsRef.current,
27
- });
28
- }
29
- };
30
-
31
- // Reinitiate callback when dependency change
32
- React.useEffect(() => {
33
- callbackRef.current = callback;
34
-
35
- return () => {
36
- callbackRef.current = () => false;
37
- };
38
- }, deps);
39
-
40
- React.useEffect(() => {
41
- const resizeObserver = new ResizeObserver(([entry]) => {
42
- const { clientWidth, clientHeight } = entry.target;
43
- const { innerWidth, innerHeight } = window;
44
-
45
- windowDimensionsRef.current = {
46
- width: clientWidth,
47
- height: clientHeight,
48
- innerWidth,
49
- innerHeight,
50
- };
51
-
52
- handleCallback();
53
- });
54
-
55
- resizeObserver.observe(document.documentElement);
56
-
57
- return () => resizeObserver.unobserve(document.documentElement);
58
- }, []);
59
- }
package/src/index.ts DELETED
@@ -1,5 +0,0 @@
1
- export { Easing, makeAnimatedComponent } from '@raidipesh78/re-motion';
2
- export { delay } from './utils';
3
- export * from './animation';
4
- export * from './gestures';
5
- export * from './hooks';
@@ -1,9 +0,0 @@
1
- /**
2
- * @param { number } ms - number of milliseconds to delay code execution
3
- * @returns Promise
4
- */
5
- export function delay(ms: number) {
6
- return new Promise((resolve) => {
7
- setTimeout(() => resolve(null), ms);
8
- });
9
- }
@@ -1,2 +0,0 @@
1
- export * from './isDefined';
2
- export * from './delay';
@@ -1,4 +0,0 @@
1
- // check undefined or null
2
- export const isDefined = <T>(value: T): boolean => {
3
- return value !== undefined && value !== null;
4
- };
package/tsconfig.json DELETED
@@ -1,25 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "outDir": "dist",
4
- "module": "esnext",
5
- "target": "es5",
6
- "lib": ["es6", "dom", "es2016", "es2017", "es2019"],
7
- "downlevelIteration": true,
8
- "sourceMap": true,
9
- "allowJs": false,
10
- "jsx": "react",
11
- "declaration": true,
12
- "moduleResolution": "node",
13
- "forceConsistentCasingInFileNames": true,
14
- "noImplicitReturns": true,
15
- "noImplicitThis": true,
16
- "noImplicitAny": true,
17
- "strictNullChecks": true,
18
- "suppressImplicitAnyIndexErrors": true,
19
- "noUnusedLocals": true,
20
- "noUnusedParameters": true,
21
- "types": ["resize-observer-browser", "node"]
22
- },
23
- "include": ["src"],
24
- "exclude": ["node_modules", "dist", "example", "rollup.config.js"]
25
- }