framer-motion 6.0.0 → 6.2.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/cjs/index.js +92 -60
- package/dist/es/context/MotionConfigContext.mjs +1 -0
- package/dist/es/motion/features/viewport/use-viewport.mjs +3 -2
- package/dist/es/motion/utils/use-visual-element.mjs +3 -0
- package/dist/es/projection/node/create-projection-node.mjs +6 -1
- package/dist/es/render/index.mjs +2 -2
- package/dist/es/render/utils/animation.mjs +9 -1
- package/dist/es/utils/use-reduced-motion.mjs +26 -11
- package/dist/framer-motion.dev.js +92 -60
- package/dist/framer-motion.js +1 -1
- package/dist/projection.dev.js +8 -3
- 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/dist/size-webpack-dom-animation.js +1 -1
- package/dist/size-webpack-dom-max.js +1 -1
- package/dist/size-webpack-m.js +1 -1
- package/package.json +18 -11
- package/types/context/MotionConfigContext.d.ts +7 -0
- package/types/motion/features/viewport/types.d.ts +1 -0
- package/types/render/html/visual-element.d.ts +1 -1
- package/types/render/index.d.ts +1 -1
- package/types/render/svg/visual-element.d.ts +1 -1
- package/types/render/types.d.ts +2 -0
- package/types/utils/use-reduced-motion.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "framer-motion",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.1",
|
|
4
4
|
"description": "A simple and powerful React animation library",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/es/index.mjs",
|
|
@@ -36,16 +36,23 @@
|
|
|
36
36
|
"build": "yarn clean && tsc -p . && rollup -c && webpack --config webpack.size.config.js",
|
|
37
37
|
"dev": "yarn watch",
|
|
38
38
|
"clean": "rm -rf types dist lib",
|
|
39
|
-
"test": "yarn
|
|
40
|
-
"test-ci": "yarn test
|
|
39
|
+
"test": "yarn test-server && yarn test-client",
|
|
40
|
+
"test-ci": "yarn test",
|
|
41
41
|
"test-client": "jest --coverage --config jest.config.json --max-workers=2",
|
|
42
42
|
"test-server": "jest --config jest.config.ssr.json",
|
|
43
43
|
"test-watch": "jest --watch --coverage --coverageReporters=lcov --config jest.config.json",
|
|
44
|
+
"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/'",
|
|
45
|
+
"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\"'",
|
|
46
|
+
"test-e2e-electron": "start-server-and-test start-dev-server http://localhost:9990 'cypress run --headless --config ignoreTestFiles=*.chrome.ts'",
|
|
47
|
+
"test-e2e": "yarn test-e2e-electron",
|
|
48
|
+
"test-e2e-file": "start-server-and-test start-dev-server http://localhost:9990 'cypress run --headless --spec \"cypress/integration/while-in-view.ts\"'",
|
|
49
|
+
"collect-projection-tests": "node ../../dev/projection/collect-projection-tests.js",
|
|
44
50
|
"prettier": "prettier ./src/* --write",
|
|
45
51
|
"watch": "concurrently -c blue,red -n tsc,rollup --kill-others \"tsc --watch -p . --preserveWatchOutput\" \"rollup --config --watch --no-watch.clearScreen\"",
|
|
46
52
|
"prepack": "yarn build",
|
|
47
53
|
"postpublish": "git push --tags",
|
|
48
|
-
"measure": "bundlesize"
|
|
54
|
+
"measure": "bundlesize",
|
|
55
|
+
"start-dev-server": "webpack serve --config ../../dev/webpack/config.js --hot"
|
|
49
56
|
},
|
|
50
57
|
"peerDependencies": {
|
|
51
58
|
"react": ">=16.8 || ^17.0.0",
|
|
@@ -64,32 +71,32 @@
|
|
|
64
71
|
"bundlesize": [
|
|
65
72
|
{
|
|
66
73
|
"path": "./dist/framer-motion.js",
|
|
67
|
-
"maxSize": "35.
|
|
74
|
+
"maxSize": "35.5 kB"
|
|
68
75
|
},
|
|
69
76
|
{
|
|
70
77
|
"path": "./dist/size-rollup-m.js",
|
|
71
|
-
"maxSize": "6.
|
|
78
|
+
"maxSize": "6.4 kB"
|
|
72
79
|
},
|
|
73
80
|
{
|
|
74
81
|
"path": "./dist/size-rollup-dom-animation.js",
|
|
75
|
-
"maxSize": "
|
|
82
|
+
"maxSize": "17 kB"
|
|
76
83
|
},
|
|
77
84
|
{
|
|
78
85
|
"path": "./dist/size-rollup-dom-max.js",
|
|
79
|
-
"maxSize": "28 kB"
|
|
86
|
+
"maxSize": "28.1 kB"
|
|
80
87
|
},
|
|
81
88
|
{
|
|
82
89
|
"path": "./dist/size-webpack-m.js",
|
|
83
|
-
"maxSize": "6.
|
|
90
|
+
"maxSize": "6.7 kB"
|
|
84
91
|
},
|
|
85
92
|
{
|
|
86
93
|
"path": "./dist/size-webpack-dom-animation.js",
|
|
87
|
-
"maxSize": "19.
|
|
94
|
+
"maxSize": "19.5 kB"
|
|
88
95
|
},
|
|
89
96
|
{
|
|
90
97
|
"path": "./dist/size-webpack-dom-max.js",
|
|
91
98
|
"maxSize": "31.5 kB"
|
|
92
99
|
}
|
|
93
100
|
],
|
|
94
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "ff23f073c81147dd4debbccb8fbcf48eda08f24a"
|
|
95
102
|
}
|
|
@@ -22,6 +22,13 @@ export interface MotionConfigContext {
|
|
|
22
22
|
* @public
|
|
23
23
|
*/
|
|
24
24
|
transition?: Transition;
|
|
25
|
+
/**
|
|
26
|
+
* If true, will respect the device prefersReducedMotion setting by switching
|
|
27
|
+
* transform animations off.
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
reducedMotion?: "always" | "never" | "user";
|
|
25
32
|
}
|
|
26
33
|
/**
|
|
27
34
|
* @public
|
|
@@ -3,4 +3,4 @@ import { VisualElementConfig } from "../types";
|
|
|
3
3
|
import { DOMVisualElementOptions } from "../dom/types";
|
|
4
4
|
export declare function getComputedStyle(element: HTMLElement): CSSStyleDeclaration;
|
|
5
5
|
export declare const htmlConfig: VisualElementConfig<HTMLElement, HTMLRenderState, DOMVisualElementOptions>;
|
|
6
|
-
export declare const htmlVisualElement: ({ parent, props, presenceId, blockInitialAnimation, visualState, }: import("../types").VisualElementOptions<HTMLElement, any>, options?: DOMVisualElementOptions) => import("../types").VisualElement<HTMLElement, any>;
|
|
6
|
+
export declare const htmlVisualElement: ({ parent, props, presenceId, blockInitialAnimation, visualState, shouldReduceMotion, }: import("../types").VisualElementOptions<HTMLElement, any>, options?: DOMVisualElementOptions) => import("../types").VisualElement<HTMLElement, any>;
|
package/types/render/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { VisualElement, VisualElementConfig, VisualElementOptions } from "./types";
|
|
2
|
-
export declare const visualElement: <Instance, MutableState, Options>({ treeType, build, getBaseTarget, makeTargetAnimatable, measureViewportBox, render: renderInstance, readValueFromInstance, removeValueFromRenderState, sortNodePosition, scrapeMotionValuesFromProps, }: VisualElementConfig<Instance, MutableState, Options>) => ({ parent, props, presenceId, blockInitialAnimation, visualState, }: VisualElementOptions<Instance, any>, options?: Options) => VisualElement<Instance, any>;
|
|
2
|
+
export declare const visualElement: <Instance, MutableState, Options>({ treeType, build, getBaseTarget, makeTargetAnimatable, measureViewportBox, render: renderInstance, readValueFromInstance, removeValueFromRenderState, sortNodePosition, scrapeMotionValuesFromProps, }: VisualElementConfig<Instance, MutableState, Options>) => ({ parent, props, presenceId, blockInitialAnimation, visualState, shouldReduceMotion, }: VisualElementOptions<Instance, any>, options?: Options) => VisualElement<Instance, any>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { DOMVisualElementOptions } from "../dom/types";
|
|
2
|
-
export declare const svgVisualElement: ({ parent, props, presenceId, blockInitialAnimation, visualState, }: import("../types").VisualElementOptions<SVGElement, any>, options?: DOMVisualElementOptions) => import("../types").VisualElement<SVGElement, any>;
|
|
2
|
+
export declare const svgVisualElement: ({ parent, props, presenceId, blockInitialAnimation, visualState, shouldReduceMotion, }: import("../types").VisualElementOptions<SVGElement, any>, options?: DOMVisualElementOptions) => import("../types").VisualElement<SVGElement, any>;
|
package/types/render/types.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export interface VisualElement<Instance = any, RenderState = any> extends Lifecy
|
|
|
32
32
|
measureViewportBox(withTransform?: boolean): Box;
|
|
33
33
|
addVariantChild(child: VisualElement): undefined | (() => void);
|
|
34
34
|
getClosestVariantNode(): VisualElement | undefined;
|
|
35
|
+
shouldReduceMotion?: boolean | null;
|
|
35
36
|
animateMotionValue?: typeof startAnimation;
|
|
36
37
|
projection?: IProjectionNode;
|
|
37
38
|
/**
|
|
@@ -101,6 +102,7 @@ export declare type VisualElementOptions<Instance, RenderState = any> = {
|
|
|
101
102
|
presenceId?: number | undefined;
|
|
102
103
|
props: MotionProps;
|
|
103
104
|
blockInitialAnimation?: boolean;
|
|
105
|
+
shouldReduceMotion?: boolean | null;
|
|
104
106
|
};
|
|
105
107
|
export declare type CreateVisualElement<Instance> = (Component: string | React.ComponentType, options: VisualElementOptions<Instance>) => VisualElement<Instance>;
|
|
106
108
|
/**
|