framer-motion 5.1.0 → 5.3.0

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,166 +1,166 @@
1
1
  {
2
- "name": "framer-motion",
3
- "version": "5.1.0",
4
- "description": "A simple and powerful React animation library",
5
- "main": "dist/framer-motion.cjs.js",
6
- "module": "dist/es/index.mjs",
7
- "exports": {
8
- ".": {
9
- "require": "./dist/framer-motion.cjs.js",
10
- "import": "./dist/es/index.mjs",
11
- "default": "./dist/framer-motion.cjs.js"
12
- },
13
- "./package.json": "./package.json"
2
+ "name": "framer-motion",
3
+ "version": "5.3.0",
4
+ "description": "A simple and powerful React animation library",
5
+ "main": "dist/framer-motion.cjs.js",
6
+ "module": "dist/es/index.mjs",
7
+ "exports": {
8
+ ".": {
9
+ "require": "./dist/framer-motion.cjs.js",
10
+ "import": "./dist/es/index.mjs",
11
+ "default": "./dist/framer-motion.cjs.js"
14
12
  },
15
- "types": "types/index.d.ts",
16
- "author": "Framer",
17
- "license": "MIT",
18
- "repository": "https://github.com/framer/motion/",
19
- "sideEffects": false,
20
- "keywords": [
21
- "react animation",
22
- "react",
23
- "pose",
24
- "react pose",
25
- "animation",
26
- "gestures",
27
- "drag",
28
- "spring",
29
- "popmotion",
30
- "framer"
31
- ],
32
- "scripts": {
33
- "lint": "yarn eslint src/**/*.ts",
34
- "test": "yarn build && yarn test-server && yarn test-client && yarn test-projection && yarn test-e2e && yarn measure",
35
- "build": "yarn clean && tsc -p . && rollup -c",
36
- "clean": "rm -rf types dist lib",
37
- "test-ci": "yarn test-client && yarn test-server",
38
- "test-client": "jest --coverage --config jest.config.json --max-workers=2",
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://localhost:8000 'yarn run cypress run -s cypress/integration/projection.chrome.ts --config baseUrl=http://0.0.0.0:8000/'",
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
- "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-chrome && yarn test-e2e-electron",
44
- "test-e2e-file": "start-server-and-test start-dev-server http://localhost:9990 'cypress run --headless --spec \"cypress/integration/drag-framer-page.ts\"'",
45
- "test-watch": "jest --watch --coverage --coverageReporters=lcov --config jest.config.json",
46
- "projection-dev": "python -m SimpleHTTPServer",
47
- "collect-projection-tests": "node ./dev/projection/collect-projection-tests.js",
48
- "prettier": "prettier ./src/* --write",
49
- "watch": "concurrently -c blue,red -n tsc,rollup --kill-others \"tsc --watch -p . --preserveWatchOutput\" \"rollup --config --watch --no-watch.clearScreen\"",
50
- "prepack": "yarn build",
51
- "prepublishOnly": "yarn test",
52
- "postpublish": "git push --tags",
53
- "measure": "webpack --config webpack.size.config.js && bundlesize",
54
- "start-dev-server": "webpack serve --config dev/webpack/config.js --hot"
13
+ "./package.json": "./package.json"
14
+ },
15
+ "types": "types/index.d.ts",
16
+ "author": "Framer",
17
+ "license": "MIT",
18
+ "repository": "https://github.com/framer/motion/",
19
+ "sideEffects": false,
20
+ "keywords": [
21
+ "react animation",
22
+ "react",
23
+ "pose",
24
+ "react pose",
25
+ "animation",
26
+ "gestures",
27
+ "drag",
28
+ "spring",
29
+ "popmotion",
30
+ "framer"
31
+ ],
32
+ "scripts": {
33
+ "lint": "yarn eslint src/**/*.ts",
34
+ "test": "yarn build && yarn test-server && yarn test-client && yarn test-projection && yarn test-e2e && yarn measure",
35
+ "build": "yarn clean && tsc -p . && rollup -c",
36
+ "clean": "rm -rf types dist lib",
37
+ "test-ci": "yarn test-client && yarn test-server",
38
+ "test-client": "jest --coverage --config jest.config.json --max-workers=2",
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://0.0.0.0:8000 'yarn run cypress run -s cypress/integration/projection.chrome.ts --config baseUrl=http://localhost:8000/'",
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
+ "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-chrome && 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
+ "test-watch": "jest --watch --coverage --coverageReporters=lcov --config jest.config.json",
46
+ "projection-dev": "python -m SimpleHTTPServer",
47
+ "collect-projection-tests": "node ./dev/projection/collect-projection-tests.js",
48
+ "prettier": "prettier ./src/* --write",
49
+ "watch": "concurrently -c blue,red -n tsc,rollup --kill-others \"tsc --watch -p . --preserveWatchOutput\" \"rollup --config --watch --no-watch.clearScreen\"",
50
+ "prepack": "yarn build",
51
+ "prepublishOnly": "yarn test",
52
+ "postpublish": "git push --tags",
53
+ "measure": "webpack --config webpack.size.config.js && bundlesize",
54
+ "start-dev-server": "webpack serve --config dev/webpack/config.js --hot"
55
+ },
56
+ "peerDependencies": {
57
+ "react": ">=16.8 || ^17.0.0",
58
+ "react-dom": ">=16.8 || ^17.0.0"
59
+ },
60
+ "devDependencies": {
61
+ "@cypress/webpack-preprocessor": "^4.1.0",
62
+ "@pmmmwh/react-refresh-webpack-plugin": "^0.4.3",
63
+ "@rollup/plugin-node-resolve": "^8.0.0",
64
+ "@rollup/plugin-replace": "^2.3.2",
65
+ "@testing-library/dom": "^6.10.1",
66
+ "@testing-library/react": "^9.3.2",
67
+ "@testing-library/react-hooks": "^5.1.0",
68
+ "@types/jest": "^23.3.9",
69
+ "@types/node": "12.7.4",
70
+ "@types/react": "17.0.9",
71
+ "@types/react-dom": "17.0.6",
72
+ "@types/styled-components": "^4.1.0",
73
+ "@typescript-eslint/eslint-plugin": "^1.5.0",
74
+ "@typescript-eslint/parser": "^1.5.0",
75
+ "bundlesize": "^0.18.0",
76
+ "cache-loader": "^1.2.5",
77
+ "concurrently": "^5.2.0",
78
+ "convert-tsconfig-paths-to-webpack-aliases": "^0.9.2",
79
+ "cypress": "^3.4.0",
80
+ "eslint": "^5.16.0",
81
+ "eslint-config-prettier": "^4.1.0",
82
+ "eslint-plugin-import": "^2.16.0",
83
+ "eslint-plugin-react": "^7.12.4",
84
+ "eslint-plugin-react-hooks": "^1.6.0",
85
+ "fork-ts-checker-webpack-plugin": "^6.2.0",
86
+ "husky": "1.1.4",
87
+ "jest": "^24.8.0",
88
+ "jest-dom": "^3.5.0",
89
+ "jest-junit": "^6.4.0",
90
+ "jest-watch-typeahead": "^0.4.2",
91
+ "lint-staged": "^8.0.4",
92
+ "lodash": "^4.17.13",
93
+ "path-browserify": "^1.0.1",
94
+ "prettier": "^2.1.0",
95
+ "react": "^17.0.0-rc.0",
96
+ "react-dev-utils": "^11.0.4",
97
+ "react-dom": "^17.0.0-rc.0",
98
+ "react-refresh": "^0.9.0",
99
+ "rollup": "^2.10.5",
100
+ "rollup-plugin-terser": "^5.3.0",
101
+ "rollup-plugin-visualizer": "^2.4.3",
102
+ "start-server-and-test": "^1.9.1",
103
+ "styled-components": "^4.1.1",
104
+ "ts-jest": "^24.0.2",
105
+ "ts-loader": "^5.3.0",
106
+ "type-fest": "^1.0.1",
107
+ "typescript": "^4.2.3",
108
+ "webpack": "^5.27.2",
109
+ "webpack-cli": "^4.5.0",
110
+ "webpack-dev-server": "^3.11.2",
111
+ "yarn-deduplicate": "^1.1.1"
112
+ },
113
+ "dependencies": {
114
+ "framesync": "6.0.1",
115
+ "hey-listen": "^1.0.8",
116
+ "popmotion": "11.0.0",
117
+ "style-value-types": "5.0.0",
118
+ "tslib": "^2.1.0"
119
+ },
120
+ "optionalDependencies": {
121
+ "@emotion/is-prop-valid": "^0.8.2"
122
+ },
123
+ "husky": {
124
+ "hooks": {
125
+ "pre-commit": "lint-staged"
126
+ }
127
+ },
128
+ "lint-staged": {
129
+ "linters": {
130
+ "*.{ts,tsx}": [
131
+ "prettier --write",
132
+ "git add"
133
+ ]
134
+ }
135
+ },
136
+ "bundlesize": [
137
+ {
138
+ "path": "./dist/framer-motion.js",
139
+ "maxSize": "34.7 kB"
55
140
  },
56
- "peerDependencies": {
57
- "react": ">=16.8 || ^17.0.0",
58
- "react-dom": ">=16.8 || ^17.0.0"
141
+ {
142
+ "path": "./dist/size-rollup-m.js",
143
+ "maxSize": "6.0 kB"
59
144
  },
60
- "devDependencies": {
61
- "@cypress/webpack-preprocessor": "^4.1.0",
62
- "@pmmmwh/react-refresh-webpack-plugin": "^0.4.3",
63
- "@rollup/plugin-node-resolve": "^8.0.0",
64
- "@rollup/plugin-replace": "^2.3.2",
65
- "@testing-library/dom": "^6.10.1",
66
- "@testing-library/react": "^9.3.2",
67
- "@testing-library/react-hooks": "^5.1.0",
68
- "@types/jest": "^23.3.9",
69
- "@types/node": "12.7.4",
70
- "@types/react": "17.0.9",
71
- "@types/react-dom": "17.0.6",
72
- "@types/styled-components": "^4.1.0",
73
- "@typescript-eslint/eslint-plugin": "^1.5.0",
74
- "@typescript-eslint/parser": "^1.5.0",
75
- "bundlesize": "^0.18.0",
76
- "cache-loader": "^1.2.5",
77
- "concurrently": "^5.2.0",
78
- "convert-tsconfig-paths-to-webpack-aliases": "^0.9.2",
79
- "cypress": "^3.4.0",
80
- "eslint": "^5.16.0",
81
- "eslint-config-prettier": "^4.1.0",
82
- "eslint-plugin-import": "^2.16.0",
83
- "eslint-plugin-react": "^7.12.4",
84
- "eslint-plugin-react-hooks": "^1.6.0",
85
- "fork-ts-checker-webpack-plugin": "^6.2.0",
86
- "husky": "1.1.4",
87
- "jest": "^24.8.0",
88
- "jest-dom": "^3.5.0",
89
- "jest-junit": "^6.4.0",
90
- "jest-watch-typeahead": "^0.4.2",
91
- "lint-staged": "^8.0.4",
92
- "lodash": "^4.17.13",
93
- "path-browserify": "^1.0.1",
94
- "prettier": "^2.1.0",
95
- "react": "^17.0.0-rc.0",
96
- "react-dev-utils": "^11.0.4",
97
- "react-dom": "^17.0.0-rc.0",
98
- "react-refresh": "^0.9.0",
99
- "rollup": "^2.10.5",
100
- "rollup-plugin-terser": "^5.3.0",
101
- "rollup-plugin-visualizer": "^2.4.3",
102
- "start-server-and-test": "^1.9.1",
103
- "styled-components": "^4.1.1",
104
- "ts-jest": "^24.0.2",
105
- "ts-loader": "^5.3.0",
106
- "type-fest": "^1.0.1",
107
- "typescript": "^4.2.3",
108
- "webpack": "^5.27.2",
109
- "webpack-cli": "^4.5.0",
110
- "webpack-dev-server": "^3.11.2",
111
- "yarn-deduplicate": "^1.1.1"
145
+ {
146
+ "path": "./dist/size-rollup-dom-animation.js",
147
+ "maxSize": "16.9 kB"
112
148
  },
113
- "dependencies": {
114
- "framesync": "6.0.1",
115
- "hey-listen": "^1.0.8",
116
- "popmotion": "10.0.2",
117
- "style-value-types": "5.0.0",
118
- "tslib": "^2.1.0"
149
+ {
150
+ "path": "./dist/size-rollup-dom-max.js",
151
+ "maxSize": "27.8 kB"
119
152
  },
120
- "optionalDependencies": {
121
- "@emotion/is-prop-valid": "^0.8.2"
153
+ {
154
+ "path": "./dist/size-webpack-m.js",
155
+ "maxSize": "6.3 kB"
122
156
  },
123
- "husky": {
124
- "hooks": {
125
- "pre-commit": "lint-staged"
126
- }
157
+ {
158
+ "path": "./dist/size-webpack-dom-animation.js",
159
+ "maxSize": "19.3 kB"
127
160
  },
128
- "lint-staged": {
129
- "linters": {
130
- "*.{ts,tsx}": [
131
- "prettier --write",
132
- "git add"
133
- ]
134
- }
135
- },
136
- "bundlesize": [
137
- {
138
- "path": "./dist/framer-motion.js",
139
- "maxSize": "34 kB"
140
- },
141
- {
142
- "path": "./dist/size-rollup-m.js",
143
- "maxSize": "6.5 kB"
144
- },
145
- {
146
- "path": "./dist/size-rollup-dom-animation.js",
147
- "maxSize": "17 kB"
148
- },
149
- {
150
- "path": "./dist/size-rollup-dom-max.js",
151
- "maxSize": "28.1 kB"
152
- },
153
- {
154
- "path": "./dist/size-webpack-m.js",
155
- "maxSize": "6.5 kB"
156
- },
157
- {
158
- "path": "./dist/size-webpack-dom-animation.js",
159
- "maxSize": "19 kB"
160
- },
161
- {
162
- "path": "./dist/size-webpack-dom-max.js",
163
- "maxSize": "30.3 kB"
164
- }
165
- ]
166
- }
161
+ {
162
+ "path": "./dist/size-webpack-dom-max.js",
163
+ "maxSize": "31 kB"
164
+ }
165
+ ]
166
+ }
@@ -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,3 @@
1
+ declare type IntersectionHandler = (entry: IntersectionObserverEntry) => void;
2
+ export declare function observeIntersection(element: Element, options: IntersectionObserverInit, callback: IntersectionHandler): () => void;
3
+ export {};
@@ -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
+ };
@@ -0,0 +1,2 @@
1
+ import { FeatureProps } from "../types";
2
+ export declare function useViewport({ visualElement, whileInView, onViewportEnter, onViewportLeave, viewport, }: FeatureProps): void;
@@ -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
  *
@@ -4,5 +4,6 @@ export declare enum AnimationType {
4
4
  Tap = "whileTap",
5
5
  Drag = "whileDrag",
6
6
  Focus = "whileFocus",
7
+ InView = "whileInView",
7
8
  Exit = "exit"
8
9
  }
@@ -0,0 +1,2 @@
1
+ export declare function hasWarned(message: string): boolean;
2
+ export declare function warnOnce(condition: boolean, message: string, element?: Element): void;