framer-motion 5.2.0 → 5.3.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/dist/es/animation/utils/transitions.mjs +8 -2
- package/dist/es/components/Reorder/Item.mjs +4 -3
- package/dist/es/gestures/use-hover-gesture.mjs +4 -1
- package/dist/es/gestures/use-tap-gesture.mjs +4 -1
- package/dist/es/index.mjs +1 -0
- package/dist/es/motion/features/definitions.mjs +6 -0
- package/dist/es/motion/features/gestures.mjs +2 -0
- package/dist/es/motion/features/viewport/observers.mjs +52 -0
- package/dist/es/motion/features/viewport/use-viewport.mjs +97 -0
- package/dist/es/motion/utils/use-visual-state.mjs +29 -10
- package/dist/es/motion/utils/valid-prop.mjs +5 -0
- package/dist/es/projection/node/create-projection-node.mjs +1 -1
- package/dist/es/render/dom/utils/unit-conversion.mjs +8 -1
- package/dist/es/render/utils/animation-state.mjs +7 -4
- package/dist/es/render/utils/setters.mjs +1 -3
- package/dist/es/render/utils/types.mjs +1 -0
- package/dist/es/utils/use-instant-transition-state.mjs +5 -0
- package/dist/es/utils/use-instant-transition.mjs +28 -0
- package/dist/es/utils/warn-once.mjs +11 -0
- package/dist/framer-motion.cjs.js +259 -33
- package/dist/framer-motion.dev.js +259 -33
- package/dist/framer-motion.js +1 -1
- package/dist/projection.dev.js +29 -8
- package/dist/size-rollup-dom-animation.js +1 -1
- package/dist/size-rollup-dom-max.js +1 -1
- package/dist/size-rollup-m.js +1 -1
- package/package.json +11 -11
- package/types/components/Reorder/Item.d.ts +1 -1
- package/types/index.d.ts +1 -0
- package/types/motion/features/types.d.ts +2 -0
- package/types/motion/features/viewport/observers.d.ts +3 -0
- package/types/motion/features/viewport/types.d.ts +20 -0
- package/types/motion/features/viewport/use-viewport.d.ts +2 -0
- package/types/motion/types.d.ts +2 -1
- package/types/render/utils/animation-state.d.ts +1 -1
- package/types/render/utils/types.d.ts +1 -0
- package/types/utils/use-instant-transition-state.d.ts +3 -0
- package/types/utils/use-instant-transition.d.ts +1 -0
- package/types/utils/warn-once.d.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "framer-motion",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.1",
|
|
4
4
|
"description": "A simple and powerful React animation library",
|
|
5
5
|
"main": "dist/framer-motion.cjs.js",
|
|
6
6
|
"module": "dist/es/index.mjs",
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"test-ci": "yarn test-client && yarn test-server",
|
|
38
38
|
"test-client": "jest --coverage --config jest.config.json --max-workers=2",
|
|
39
39
|
"test-server": "jest --config jest.config.ssr.json",
|
|
40
|
-
"test-projection": "yarn run collect-projection-tests && start-server-and-test 'python -m SimpleHTTPServer' http://
|
|
40
|
+
"test-projection": "yarn run collect-projection-tests && start-server-and-test 'python -m SimpleHTTPServer' http://0.0.0.0:8000 'yarn run cypress run -s cypress/integration/projection.chrome.ts --config baseUrl=http://localhost:8000/'",
|
|
41
41
|
"test-e2e-chrome": "start-server-and-test start-dev-server http://localhost:9990 'cypress run --headless --browser chrome --spec \"cypress/integration/layout-relative.chrome.ts\"'",
|
|
42
42
|
"test-e2e-electron": "start-server-and-test start-dev-server http://localhost:9990 'cypress run --headless --config ignoreTestFiles=*.chrome.ts'",
|
|
43
|
-
"test-e2e": "yarn test-e2e-
|
|
44
|
-
"test-e2e-file": "start-server-and-test start-dev-server http://localhost:9990 'cypress run --headless --spec \"cypress/integration/
|
|
43
|
+
"test-e2e": "yarn test-e2e-electron",
|
|
44
|
+
"test-e2e-file": "start-server-and-test start-dev-server http://localhost:9990 'cypress run --headless --spec \"cypress/integration/while-in-view.ts\"'",
|
|
45
45
|
"test-watch": "jest --watch --coverage --coverageReporters=lcov --config jest.config.json",
|
|
46
46
|
"projection-dev": "python -m SimpleHTTPServer",
|
|
47
47
|
"collect-projection-tests": "node ./dev/projection/collect-projection-tests.js",
|
|
@@ -136,31 +136,31 @@
|
|
|
136
136
|
"bundlesize": [
|
|
137
137
|
{
|
|
138
138
|
"path": "./dist/framer-motion.js",
|
|
139
|
-
"maxSize": "34.
|
|
139
|
+
"maxSize": "34.8 kB"
|
|
140
140
|
},
|
|
141
141
|
{
|
|
142
142
|
"path": "./dist/size-rollup-m.js",
|
|
143
|
-
"maxSize": "6.
|
|
143
|
+
"maxSize": "6.0 kB"
|
|
144
144
|
},
|
|
145
145
|
{
|
|
146
146
|
"path": "./dist/size-rollup-dom-animation.js",
|
|
147
|
-
"maxSize": "
|
|
147
|
+
"maxSize": "16.9 kB"
|
|
148
148
|
},
|
|
149
149
|
{
|
|
150
150
|
"path": "./dist/size-rollup-dom-max.js",
|
|
151
|
-
"maxSize": "
|
|
151
|
+
"maxSize": "27.9 kB"
|
|
152
152
|
},
|
|
153
153
|
{
|
|
154
154
|
"path": "./dist/size-webpack-m.js",
|
|
155
|
-
"maxSize": "6.
|
|
155
|
+
"maxSize": "6.3 kB"
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
158
|
"path": "./dist/size-webpack-dom-animation.js",
|
|
159
|
-
"maxSize": "19 kB"
|
|
159
|
+
"maxSize": "19.4 kB"
|
|
160
160
|
},
|
|
161
161
|
{
|
|
162
162
|
"path": "./dist/size-webpack-dom-max.js",
|
|
163
|
-
"maxSize": "
|
|
163
|
+
"maxSize": "31 kB"
|
|
164
164
|
}
|
|
165
165
|
]
|
|
166
166
|
}
|
|
@@ -15,7 +15,7 @@ export interface Props<V> {
|
|
|
15
15
|
*/
|
|
16
16
|
value: V;
|
|
17
17
|
}
|
|
18
|
-
export declare function ReorderItem<V>({ children, style, value, as, ...props }: Props<V> & HTMLMotionProps<any> & React.PropsWithChildren<{}>, externalRef?: React.Ref<any>): JSX.Element;
|
|
18
|
+
export declare function ReorderItem<V>({ children, style, value, as, onDrag, ...props }: Props<V> & HTMLMotionProps<any> & React.PropsWithChildren<{}>, externalRef?: React.Ref<any>): JSX.Element;
|
|
19
19
|
export declare const Item: React.ForwardRefExoticComponent<Props<unknown> & {
|
|
20
20
|
color?: string | undefined;
|
|
21
21
|
translate?: "no" | "yes" | undefined;
|
package/types/index.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ export { createMotionComponent } from "./motion";
|
|
|
50
50
|
export { visualElement } from "./render";
|
|
51
51
|
export { VisualElement } from "./render/types";
|
|
52
52
|
export { addScaleCorrector } from "./projection/styles/scale-correction";
|
|
53
|
+
export { useInstantTransition } from "./utils/use-instant-transition";
|
|
53
54
|
export { useInstantLayoutTransition } from "./projection/use-instant-layout-transition";
|
|
54
55
|
export { useResetProjection } from "./projection/use-reset-projection";
|
|
55
56
|
/**
|
|
@@ -16,6 +16,7 @@ export declare type FeatureNames = {
|
|
|
16
16
|
focus: true;
|
|
17
17
|
hover: true;
|
|
18
18
|
pan: true;
|
|
19
|
+
inView: true;
|
|
19
20
|
measureLayout: true;
|
|
20
21
|
};
|
|
21
22
|
export declare type FeatureComponent = React.ComponentType<FeatureProps>;
|
|
@@ -34,6 +35,7 @@ export interface FeatureComponents {
|
|
|
34
35
|
focus?: FeatureComponent;
|
|
35
36
|
hover?: FeatureComponent;
|
|
36
37
|
pan?: FeatureComponent;
|
|
38
|
+
inView?: FeatureComponent;
|
|
37
39
|
measureLayout?: FeatureComponent;
|
|
38
40
|
}
|
|
39
41
|
export interface FeatureBundle extends FeatureComponents {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
import { TargetAndTransition } from "../../../types";
|
|
3
|
+
import { VariantLabels } from "../../types";
|
|
4
|
+
export declare type ViewportEventHandler = () => void;
|
|
5
|
+
export interface ViewportOptions {
|
|
6
|
+
root?: RefObject<Element>;
|
|
7
|
+
once?: boolean;
|
|
8
|
+
margin?: string;
|
|
9
|
+
amount?: "some" | "all" | number;
|
|
10
|
+
}
|
|
11
|
+
export interface ViewportProps {
|
|
12
|
+
whileInView?: VariantLabels | TargetAndTransition;
|
|
13
|
+
onViewportEnter?: ViewportEventHandler;
|
|
14
|
+
onViewportLeave?: ViewportEventHandler;
|
|
15
|
+
viewport?: ViewportOptions;
|
|
16
|
+
}
|
|
17
|
+
export declare type ViewportState = {
|
|
18
|
+
hasEnteredView: boolean;
|
|
19
|
+
isInView: boolean;
|
|
20
|
+
};
|
package/types/motion/types.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { LayoutProps } from "./features/layout/types";
|
|
|
7
7
|
import { ResolvedValues } from "../render/types";
|
|
8
8
|
import { VisualElementLifecycles } from "../render/utils/lifecycles";
|
|
9
9
|
import { PanHandlers, TapHandlers, HoverHandlers, FocusHandlers } from "../gestures/types";
|
|
10
|
+
import { ViewportProps } from "./features/viewport/types";
|
|
10
11
|
export declare type MotionStyleProp = string | number | MotionValue;
|
|
11
12
|
/**
|
|
12
13
|
* Either a string, or array of strings, that reference variants defined via the `variants` prop.
|
|
@@ -206,7 +207,7 @@ export interface MotionAdvancedProps {
|
|
|
206
207
|
*
|
|
207
208
|
* @public
|
|
208
209
|
*/
|
|
209
|
-
export interface MotionProps extends AnimationProps, VisualElementLifecycles, PanHandlers, TapHandlers, HoverHandlers, FocusHandlers, DraggableProps, LayoutProps, MotionAdvancedProps {
|
|
210
|
+
export interface MotionProps extends AnimationProps, VisualElementLifecycles, PanHandlers, TapHandlers, HoverHandlers, FocusHandlers, ViewportProps, DraggableProps, LayoutProps, MotionAdvancedProps {
|
|
210
211
|
/**
|
|
211
212
|
* Properties, variant label or array of variant labels to start in.
|
|
212
213
|
*
|
|
@@ -15,7 +15,7 @@ export interface AnimationState {
|
|
|
15
15
|
export declare type AnimationList = string[] | TargetAndTransition[];
|
|
16
16
|
export declare const variantPriorityOrder: AnimationType[];
|
|
17
17
|
export declare function createAnimationState(visualElement: VisualElement): AnimationState;
|
|
18
|
-
export declare function
|
|
18
|
+
export declare function checkVariantsDidChange(prev: any, next: any): boolean;
|
|
19
19
|
export interface AnimationTypeState {
|
|
20
20
|
isActive: boolean;
|
|
21
21
|
protectedKeys: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useInstantTransition(): (callback: () => void) => void;
|