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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "framer-motion",
3
- "version": "6.0.0",
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 build && yarn measure && yarn test-server && yarn test-client",
40
- "test-ci": "yarn test-client --ci --reporters=jest-junit && yarn test-server --ci --reporters=jest-junit",
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.3 kB"
74
+ "maxSize": "35.5 kB"
68
75
  },
69
76
  {
70
77
  "path": "./dist/size-rollup-m.js",
71
- "maxSize": "6.1 kB"
78
+ "maxSize": "6.4 kB"
72
79
  },
73
80
  {
74
81
  "path": "./dist/size-rollup-dom-animation.js",
75
- "maxSize": "16.9 kB"
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.4 kB"
90
+ "maxSize": "6.7 kB"
84
91
  },
85
92
  {
86
93
  "path": "./dist/size-webpack-dom-animation.js",
87
- "maxSize": "19.4 kB"
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": "e655edf09c72fbff16f5445e7ae17236c0e10405"
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
@@ -7,6 +7,7 @@ export interface ViewportOptions {
7
7
  once?: boolean;
8
8
  margin?: string;
9
9
  amount?: "some" | "all" | number;
10
+ fallback?: boolean;
10
11
  }
11
12
  export interface ViewportProps {
12
13
  whileInView?: VariantLabels | TargetAndTransition;
@@ -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>;
@@ -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>;
@@ -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
  /**
@@ -25,3 +25,4 @@
25
25
  * @public
26
26
  */
27
27
  export declare function useReducedMotion(): boolean | null;
28
+ export declare function useReducedMotionConfig(): boolean | null;