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.
- package/LICENSE +21 -21
- package/README.md +115 -115
- package/dist/animation/core/controllers/Animation.d.ts +16 -0
- package/dist/animation/core/controllers/FluidValue.d.ts +32 -0
- package/dist/animation/core/controllers/RequestAnimationFrame.d.ts +8 -0
- package/dist/animation/core/controllers/SpringAnimation.d.ts +41 -0
- package/dist/animation/core/controllers/TimingAnimation.d.ts +35 -0
- package/dist/animation/core/easing/Bezier.d.ts +8 -0
- package/dist/animation/core/easing/Easing.d.ts +40 -0
- package/dist/animation/core/helpers/camelCaseToKebabCase.d.ts +8 -0
- package/dist/animation/core/helpers/getCleanProps.d.ts +10 -0
- package/dist/animation/core/helpers/getCssValue.d.ts +8 -0
- package/dist/animation/core/helpers/index.d.ts +5 -0
- package/dist/animation/core/helpers/isDefined.d.ts +12 -0
- package/dist/animation/core/helpers/isFluidValue.d.ts +6 -0
- package/dist/animation/core/index.d.ts +11 -0
- package/dist/animation/core/interpolation/Colors.d.ts +25 -0
- package/dist/animation/core/interpolation/Interpolation.d.ts +80 -0
- package/dist/animation/core/interpolation/__tests__/Colors.test.d.ts +1 -0
- package/dist/animation/core/react/fluid.d.ts +6 -0
- package/dist/animation/core/react/makeFluid.d.ts +30 -0
- package/dist/animation/core/react/transforms.d.ts +6 -0
- package/dist/animation/core/react/useFluidValue.d.ts +9 -0
- package/dist/animation/core/react/useMount.d.ts +20 -0
- package/dist/animation/lib/animationType.d.ts +15 -0
- package/dist/animation/lib/getInitialConfig.d.ts +3 -0
- package/dist/animation/lib/index.d.ts +5 -0
- package/dist/animation/{interpolation.d.ts → lib/interpolation.d.ts} +20 -21
- package/dist/animation/lib/modules/AnimatedBlock.d.ts +8 -0
- package/dist/animation/lib/modules/AnimatedImage.d.ts +8 -0
- package/dist/animation/lib/modules/AnimatedInline.d.ts +8 -0
- package/dist/animation/lib/modules/MountedBlock.d.ts +29 -0
- package/dist/animation/{modules → lib/modules}/ScrollableBlock.d.ts +22 -21
- package/dist/animation/{modules → lib/modules}/TransitionBlock.d.ts +18 -17
- package/dist/animation/{modules → lib/modules}/index.d.ts +6 -6
- package/dist/animation/{useAnimatedValue.d.ts → lib/useAnimatedValue.d.ts} +17 -22
- package/dist/animation/{useMountedValue.d.ts → lib/useMountedValue.d.ts} +14 -15
- package/dist/gestures/controllers/DragGesture.d.ts +17 -17
- package/dist/gestures/controllers/Gesture.d.ts +20 -20
- package/dist/gestures/controllers/MouseMoveGesture.d.ts +13 -13
- package/dist/gestures/controllers/ScrollGesture.d.ts +14 -14
- package/dist/gestures/controllers/WheelGesture.d.ts +15 -15
- package/dist/gestures/controllers/index.d.ts +4 -4
- package/dist/gestures/helpers/eventAttacher.d.ts +11 -0
- package/dist/gestures/helpers/index.d.ts +1 -0
- package/dist/gestures/{math.d.ts → helpers/math.d.ts} +34 -34
- package/dist/gestures/{withDefault.d.ts → helpers/withDefault.d.ts} +4 -4
- package/dist/gestures/hooks/index.d.ts +5 -5
- package/dist/gestures/hooks/useDrag.d.ts +4 -4
- package/dist/gestures/hooks/useGesture.d.ts +9 -9
- package/dist/gestures/hooks/useMouseMove.d.ts +4 -4
- package/dist/gestures/hooks/useRecognizer.d.ts +10 -10
- package/dist/gestures/hooks/useScroll.d.ts +4 -4
- package/dist/gestures/hooks/useWheel.d.ts +4 -4
- package/dist/hooks/index.d.ts +3 -3
- package/dist/hooks/useMeasure.d.ts +14 -14
- package/dist/hooks/useOutsideClick.d.ts +2 -2
- package/dist/hooks/useWindowDimension.d.ts +9 -9
- package/dist/index.d.ts +9 -5
- package/dist/index.js +1 -1191
- package/dist/index.js.map +1 -1
- package/dist/utils/delay.d.ts +5 -5
- package/dist/utils/index.d.ts +1 -2
- package/package.json +49 -48
- package/.vscode/settings.json +0 -3
- package/dist/animation/animationType.d.ts +0 -15
- package/dist/animation/getInitialConfig.d.ts +0 -3
- package/dist/animation/index.d.ts +0 -6
- package/dist/animation/modules/AnimatedBlock.d.ts +0 -8
- package/dist/animation/modules/AnimatedImage.d.ts +0 -8
- package/dist/animation/modules/AnimatedInline.d.ts +0 -8
- package/dist/animation/modules/MountedBlock.d.ts +0 -18
- package/dist/gestures/eventAttacher.d.ts +0 -11
- package/dist/gestures/index.d.ts +0 -2
- package/dist/gestures/types.d.ts +0 -51
- package/dist/utils/isDefined.d.ts +0 -1
- package/rollup.config.js +0 -18
- package/src/animation/animationType.ts +0 -17
- package/src/animation/getInitialConfig.ts +0 -61
- package/src/animation/index.ts +0 -10
- package/src/animation/interpolation.ts +0 -48
- package/src/animation/modules/AnimatedBlock.ts +0 -8
- package/src/animation/modules/AnimatedImage.ts +0 -8
- package/src/animation/modules/AnimatedInline.ts +0 -8
- package/src/animation/modules/MountedBlock.tsx +0 -25
- package/src/animation/modules/ScrollableBlock.tsx +0 -69
- package/src/animation/modules/TransitionBlock.tsx +0 -29
- package/src/animation/modules/index.ts +0 -6
- package/src/animation/useAnimatedValue.ts +0 -71
- package/src/animation/useMountedValue.ts +0 -19
- package/src/gestures/controllers/DragGesture.ts +0 -177
- package/src/gestures/controllers/Gesture.ts +0 -54
- package/src/gestures/controllers/MouseMoveGesture.ts +0 -111
- package/src/gestures/controllers/ScrollGesture.ts +0 -107
- package/src/gestures/controllers/WheelGesture.ts +0 -123
- package/src/gestures/controllers/index.ts +0 -4
- package/src/gestures/eventAttacher.ts +0 -67
- package/src/gestures/hooks/index.ts +0 -5
- package/src/gestures/hooks/useDrag.ts +0 -14
- package/src/gestures/hooks/useGesture.ts +0 -38
- package/src/gestures/hooks/useMouseMove.ts +0 -11
- package/src/gestures/hooks/useRecognizer.ts +0 -59
- package/src/gestures/hooks/useScroll.ts +0 -11
- package/src/gestures/hooks/useWheel.ts +0 -11
- package/src/gestures/index.ts +0 -2
- package/src/gestures/math.ts +0 -120
- package/src/gestures/types.ts +0 -49
- package/src/gestures/withDefault.ts +0 -3
- package/src/hooks/index.ts +0 -3
- package/src/hooks/useMeasure.ts +0 -133
- package/src/hooks/useOutsideClick.ts +0 -36
- package/src/hooks/useWindowDimension.ts +0 -59
- package/src/index.ts +0 -5
- package/src/utils/delay.ts +0 -9
- package/src/utils/index.ts +0 -2
- package/src/utils/isDefined.ts +0 -4
- 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
package/src/utils/delay.ts
DELETED
package/src/utils/index.ts
DELETED
package/src/utils/isDefined.ts
DELETED
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
|
-
}
|