framer-motion 5.3.0 → 5.4.0-beta

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.
Files changed (73) hide show
  1. package/dist/es/animation/utils/easing.mjs +1 -1
  2. package/dist/es/animation/utils/transitions.mjs +9 -3
  3. package/dist/es/components/AnimatePresence/index.mjs +1 -1
  4. package/dist/es/components/AnimatePresence/use-presence.mjs +1 -27
  5. package/dist/es/components/AnimateSharedLayout.mjs +1 -1
  6. package/dist/es/components/Reorder/Item.mjs +5 -4
  7. package/dist/es/context/MotionContext/index.mjs +1 -1
  8. package/dist/es/events/use-dom-event.mjs +2 -31
  9. package/dist/es/events/use-pointer-event.mjs +2 -5
  10. package/dist/es/gestures/use-hover-gesture.mjs +4 -1
  11. package/dist/es/gestures/use-tap-gesture.mjs +4 -1
  12. package/dist/es/gestures/utils/event-type.mjs +1 -8
  13. package/dist/es/index.mjs +1 -0
  14. package/dist/es/motion/features/viewport/use-viewport.mjs +2 -2
  15. package/dist/es/motion/index.mjs +1 -1
  16. package/dist/es/motion/utils/use-visual-state.mjs +29 -10
  17. package/dist/es/motion/utils/valid-prop.mjs +1 -0
  18. package/dist/es/projection/animation/mix-values.mjs +1 -1
  19. package/dist/es/projection/geometry/models.mjs +1 -11
  20. package/dist/es/projection/node/create-projection-node.mjs +4 -1167
  21. package/dist/es/projection/styles/scale-border-radius.mjs +1 -1
  22. package/dist/es/projection/styles/transform.mjs +5 -5
  23. package/dist/es/render/dom/motion-proxy.mjs +3 -0
  24. package/dist/es/render/dom/utils/css-variables-conversion.mjs +2 -2
  25. package/dist/es/render/dom/utils/filter-props.mjs +3 -1
  26. package/dist/es/render/dom/value-types/dimensions.mjs +1 -8
  27. package/dist/es/render/html/use-props.mjs +6 -4
  28. package/dist/es/render/html/utils/build-transform.mjs +2 -2
  29. package/dist/es/render/svg/utils/path.mjs +1 -1
  30. package/dist/es/render/svg/utils/transform-origin.mjs +1 -1
  31. package/dist/es/render/three/create-visual-element.mjs +42 -0
  32. package/dist/es/render/three/gestures/use-hover.mjs +22 -0
  33. package/dist/es/render/three/gestures/use-tap.mjs +56 -0
  34. package/dist/es/render/three/motion.mjs +30 -0
  35. package/dist/es/render/three/use-render.mjs +11 -0
  36. package/dist/es/render/three/utils/read-value.mjs +43 -0
  37. package/dist/es/render/three/utils/set-value.mjs +59 -0
  38. package/dist/es/render/utils/animation-state.mjs +5 -4
  39. package/dist/es/render/utils/animation.mjs +1 -4
  40. package/dist/es/render/utils/setters.mjs +3 -42
  41. package/dist/es/three-entry.mjs +1 -0
  42. package/dist/es/utils/array.mjs +2 -13
  43. package/dist/es/utils/use-force-update.mjs +13 -9
  44. package/dist/es/utils/use-instant-transition-state.mjs +5 -0
  45. package/dist/es/utils/use-instant-transition.mjs +28 -0
  46. package/dist/framer-motion-three.cjs.js +2995 -0
  47. package/dist/framer-motion.cjs.js +147 -84
  48. package/dist/framer-motion.dev.js +139 -76
  49. package/dist/framer-motion.js +1 -1
  50. package/dist/projection.dev.js +35 -23
  51. package/dist/size-rollup-dom-animation.js +1 -1
  52. package/dist/size-rollup-dom-max.js +1 -1
  53. package/dist/size-rollup-m.js +1 -1
  54. package/package.json +179 -158
  55. package/types/components/Reorder/Item.d.ts +1 -1
  56. package/types/index.d.ts +1 -0
  57. package/types/motion/features/types.d.ts +1 -1
  58. package/types/motion/features/viewport/types.d.ts +1 -1
  59. package/types/render/three/create-visual-element.d.ts +6 -0
  60. package/types/render/three/gestures/use-hover.d.ts +10 -0
  61. package/types/render/three/gestures/use-tap.d.ts +8 -0
  62. package/types/render/three/motion.d.ts +5 -0
  63. package/types/render/three/types.d.ts +24 -0
  64. package/types/render/three/use-render.d.ts +4 -0
  65. package/types/render/three/utils/read-value.d.ts +2 -0
  66. package/types/render/three/utils/set-value.d.ts +2 -0
  67. package/types/render/utils/animation-state.d.ts +1 -1
  68. package/types/render/utils/lifecycles.d.ts +8 -8
  69. package/types/render/utils/setters.d.ts +1 -0
  70. package/types/three-entry.d.ts +1 -0
  71. package/types/utils/use-instant-transition-state.d.ts +3 -0
  72. package/types/utils/use-instant-transition.d.ts +1 -0
  73. package/CHANGELOG.md +0 -1953
package/package.json CHANGED
@@ -1,166 +1,187 @@
1
1
  {
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"
2
+ "name": "framer-motion",
3
+ "version": "5.4.0-beta",
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
+ "./three": {
14
+ "require": "./dist/framer-motion-three.cjs.js",
15
+ "import": "./dist/es/render/three/index.mjs",
16
+ "default": "./dist/framer-motion-three.cjs.js"
17
+ },
18
+ "./package.json": "./package.json"
12
19
  },
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"
20
+ "types": "types/index.d.ts",
21
+ "author": "Framer",
22
+ "license": "MIT",
23
+ "repository": "https://github.com/framer/motion/",
24
+ "sideEffects": false,
25
+ "keywords": [
26
+ "react animation",
27
+ "react",
28
+ "three",
29
+ "3d",
30
+ "pose",
31
+ "react pose",
32
+ "animation",
33
+ "gestures",
34
+ "drag",
35
+ "spring",
36
+ "popmotion",
37
+ "framer"
38
+ ],
39
+ "scripts": {
40
+ "lint": "yarn eslint src/**/*.ts",
41
+ "test": "yarn build && yarn test-server && yarn test-client && yarn test-projection && yarn test-e2e && yarn measure",
42
+ "build": "yarn clean && tsc -p . && rollup -c",
43
+ "clean": "rm -rf types dist lib",
44
+ "test-ci": "yarn test-client && yarn test-server",
45
+ "test-client": "jest --coverage --config jest.config.json --max-workers=2",
46
+ "test-server": "jest --config jest.config.ssr.json",
47
+ "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/'",
48
+ "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\"'",
49
+ "test-e2e-electron": "start-server-and-test start-dev-server http://localhost:9990 'cypress run --headless --config ignoreTestFiles=*.chrome.ts'",
50
+ "test-e2e": "yarn test-e2e-electron",
51
+ "test-e2e-file": "start-server-and-test start-dev-server http://localhost:9990 'cypress run --headless --spec \"cypress/integration/while-in-view.ts\"'",
52
+ "test-watch": "jest --watch --coverage --coverageReporters=lcov --config jest.config.json",
53
+ "projection-dev": "python -m SimpleHTTPServer",
54
+ "collect-projection-tests": "node ./dev/projection/collect-projection-tests.js",
55
+ "prettier": "prettier ./src/* --write",
56
+ "watch": "concurrently -c blue,red -n tsc,rollup --kill-others \"tsc --watch -p . --preserveWatchOutput\" \"rollup --config --watch --no-watch.clearScreen\"",
57
+ "prepack": "yarn build",
58
+ "prepublishOnly": "yarn test",
59
+ "postpublish": "git push --tags",
60
+ "measure": "webpack --config webpack.size.config.js && bundlesize",
61
+ "start-dev-server": "webpack serve --config dev/webpack/config.js --hot"
140
62
  },
141
- {
142
- "path": "./dist/size-rollup-m.js",
143
- "maxSize": "6.0 kB"
63
+ "peerDependencies": {
64
+ "@react-three/fiber": "^7.0.21",
65
+ "react": ">=16.8 || ^17.0.0",
66
+ "react-dom": ">=16.8 || ^17.0.0",
67
+ "three": "^0.135.0"
144
68
  },
145
- {
146
- "path": "./dist/size-rollup-dom-animation.js",
147
- "maxSize": "16.9 kB"
69
+ "peerDependenciesMeta": {
70
+ "@react-three/fiber": {
71
+ "optional": true
72
+ },
73
+ "three": {
74
+ "optional": true
75
+ }
148
76
  },
149
- {
150
- "path": "./dist/size-rollup-dom-max.js",
151
- "maxSize": "27.8 kB"
77
+ "devDependencies": {
78
+ "@cypress/webpack-preprocessor": "^4.1.0",
79
+ "@pmmmwh/react-refresh-webpack-plugin": "^0.4.3",
80
+ "@react-three/fiber": "^7.0.21",
81
+ "@react-three/test-renderer": "^7.0.20",
82
+ "@rollup/plugin-node-resolve": "^8.0.0",
83
+ "@rollup/plugin-replace": "^2.3.2",
84
+ "@testing-library/dom": "^6.10.1",
85
+ "@testing-library/react": "^9.3.2",
86
+ "@testing-library/react-hooks": "^5.1.0",
87
+ "@types/jest": "^23.3.9",
88
+ "@types/node": "12.7.4",
89
+ "@types/react": "17.0.9",
90
+ "@types/react-dom": "17.0.6",
91
+ "@types/styled-components": "^4.1.0",
92
+ "@types/three": "^0.134.0",
93
+ "@typescript-eslint/eslint-plugin": "^1.5.0",
94
+ "@typescript-eslint/parser": "^1.5.0",
95
+ "bundlesize": "^0.18.0",
96
+ "cache-loader": "^1.2.5",
97
+ "concurrently": "^5.2.0",
98
+ "convert-tsconfig-paths-to-webpack-aliases": "^0.9.2",
99
+ "cypress": "^3.4.0",
100
+ "eslint": "^5.16.0",
101
+ "eslint-config-prettier": "^4.1.0",
102
+ "eslint-plugin-import": "^2.16.0",
103
+ "eslint-plugin-react": "^7.12.4",
104
+ "eslint-plugin-react-hooks": "^1.6.0",
105
+ "fork-ts-checker-webpack-plugin": "^6.2.0",
106
+ "husky": "1.1.4",
107
+ "jest": "^24.8.0",
108
+ "jest-dom": "^3.5.0",
109
+ "jest-junit": "^6.4.0",
110
+ "jest-watch-typeahead": "^0.4.2",
111
+ "lint-staged": "^8.0.4",
112
+ "lodash": "^4.17.13",
113
+ "path-browserify": "^1.0.1",
114
+ "prettier": "^2.1.0",
115
+ "react": "^17.0.0-rc.0",
116
+ "react-dev-utils": "^11.0.4",
117
+ "react-dom": "^17.0.0-rc.0",
118
+ "react-refresh": "^0.9.0",
119
+ "rollup": "^2.10.5",
120
+ "rollup-plugin-terser": "^5.3.0",
121
+ "rollup-plugin-visualizer": "^2.4.3",
122
+ "start-server-and-test": "^1.9.1",
123
+ "styled-components": "^4.1.1",
124
+ "three": "^0.135.0",
125
+ "ts-jest": "^24.0.2",
126
+ "ts-loader": "^5.3.0",
127
+ "type-fest": "^1.0.1",
128
+ "typescript": "^4.2.3",
129
+ "webpack": "^5.27.2",
130
+ "webpack-cli": "^4.5.0",
131
+ "webpack-dev-server": "^3.11.2",
132
+ "yarn-deduplicate": "^1.1.1"
152
133
  },
153
- {
154
- "path": "./dist/size-webpack-m.js",
155
- "maxSize": "6.3 kB"
134
+ "dependencies": {
135
+ "framesync": "6.0.1",
136
+ "hey-listen": "^1.0.8",
137
+ "popmotion": "11.0.2",
138
+ "style-value-types": "5.0.0",
139
+ "tslib": "^2.1.0"
156
140
  },
157
- {
158
- "path": "./dist/size-webpack-dom-animation.js",
159
- "maxSize": "19.3 kB"
141
+ "optionalDependencies": {
142
+ "@emotion/is-prop-valid": "^0.8.2"
160
143
  },
161
- {
162
- "path": "./dist/size-webpack-dom-max.js",
163
- "maxSize": "31 kB"
164
- }
165
- ]
166
- }
144
+ "husky": {
145
+ "hooks": {
146
+ "pre-commit": "lint-staged"
147
+ }
148
+ },
149
+ "lint-staged": {
150
+ "linters": {
151
+ "*.{ts,tsx}": [
152
+ "prettier --write",
153
+ "git add"
154
+ ]
155
+ }
156
+ },
157
+ "bundlesize": [
158
+ {
159
+ "path": "./dist/framer-motion.js",
160
+ "maxSize": "34.9 kB"
161
+ },
162
+ {
163
+ "path": "./dist/size-rollup-m.js",
164
+ "maxSize": "6.1 kB"
165
+ },
166
+ {
167
+ "path": "./dist/size-rollup-dom-animation.js",
168
+ "maxSize": "16.9 kB"
169
+ },
170
+ {
171
+ "path": "./dist/size-rollup-dom-max.js",
172
+ "maxSize": "27.9 kB"
173
+ },
174
+ {
175
+ "path": "./dist/size-webpack-m.js",
176
+ "maxSize": "6.4 kB"
177
+ },
178
+ {
179
+ "path": "./dist/size-webpack-dom-animation.js",
180
+ "maxSize": "19.4 kB"
181
+ },
182
+ {
183
+ "path": "./dist/size-webpack-dom-max.js",
184
+ "maxSize": "31 kB"
185
+ }
186
+ ]
187
+ }
@@ -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
  /**
@@ -49,4 +49,4 @@ export declare type FeatureDefinitions = {
49
49
  export declare type LoadedFeatures = FeatureDefinitions & {
50
50
  projectionNodeConstructor?: any;
51
51
  };
52
- export declare type RenderComponent<Instance, RenderState> = (Component: string | React.ComponentType, props: MotionProps, projectionId: number | undefined, ref: React.Ref<Instance>, visualState: VisualState<Instance, RenderState>, isStatic: boolean) => any;
52
+ export declare type RenderComponent<Instance, RenderState> = (Component: string | React.ComponentType, props: MotionProps, projectionId: number | undefined, ref: React.Ref<Instance>, visualState: VisualState<Instance, RenderState>, isStatic: boolean, visualElement?: VisualElement) => any;
@@ -1,7 +1,7 @@
1
1
  import { RefObject } from "react";
2
2
  import { TargetAndTransition } from "../../../types";
3
3
  import { VariantLabels } from "../../types";
4
- export declare type ViewportEventHandler = () => void;
4
+ export declare type ViewportEventHandler = (entry: IntersectionObserverEntry | null) => void;
5
5
  export interface ViewportOptions {
6
6
  root?: RefObject<Element>;
7
7
  once?: boolean;
@@ -0,0 +1,6 @@
1
+ import { CreateVisualElement, ScrapeMotionValuesFromProps } from "../types";
2
+ import { Object3DNode } from "@react-three/fiber";
3
+ export declare const scrapeMotionValuesFromProps: ScrapeMotionValuesFromProps;
4
+ export declare const createRenderState: () => {};
5
+ export declare const threeVisualElement: ({ parent, props, presenceId, blockInitialAnimation, visualState, }: import("../types").VisualElementOptions<Object3DNode<any, any>, any>, options?: {}) => import("../types").VisualElement<Object3DNode<any, any>, any>;
6
+ export declare const createVisualElement: CreateVisualElement<any>;
@@ -0,0 +1,10 @@
1
+ import { MeshProps, ThreeEvent } from "@react-three/fiber";
2
+ import { VisualElement } from "../../types";
3
+ import { ThreeMotionProps } from "../types";
4
+ export declare function useHover(isStatic: boolean, { whileHover, onHoverStart, onHoverEnd, onPointerOver, onPointerOut, }: ThreeMotionProps & MeshProps, visualElement?: VisualElement): {
5
+ onPointerOver?: undefined;
6
+ onPointerOut?: undefined;
7
+ } | {
8
+ onPointerOver: (event: ThreeEvent<any>) => void;
9
+ onPointerOut: (event: ThreeEvent<any>) => void;
10
+ };
@@ -0,0 +1,8 @@
1
+ import { MeshProps } from "@react-three/fiber";
2
+ import { VisualElement } from "../../types";
3
+ import { ThreeMotionProps } from "../types";
4
+ export declare function useTap(isStatic: boolean, { whileTap, onTapStart, onTap, onTapCancel, onPointerDown, }: ThreeMotionProps & MeshProps, visualElement?: VisualElement): {
5
+ onPointerDown?: undefined;
6
+ } | {
7
+ onPointerDown: EventListener;
8
+ };
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import type { ThreeMotionComponents } from "./types";
3
+ declare function custom<Props>(Component: string): import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<Props & import("../..").MotionProps> & import("react").RefAttributes<any>>;
4
+ export declare const motion: typeof custom & ThreeMotionComponents;
5
+ export {};
@@ -0,0 +1,24 @@
1
+ import { MeshProps } from "@react-three/fiber";
2
+ import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from "react";
3
+ import { HoverHandlers, TapHandlers } from "../..";
4
+ import { AnimationProps } from "../../motion/types";
5
+ import { ResolvedValues } from "../types";
6
+ import { AnimationLifecycles } from "../utils/lifecycles";
7
+ export interface ThreeMotionProps extends AnimationLifecycles, AnimationProps, TapHandlers, HoverHandlers {
8
+ onInstanceUpdate?: MeshProps["onUpdate"];
9
+ }
10
+ export interface ThreeRenderState {
11
+ latestValues: ResolvedValues;
12
+ }
13
+ /**
14
+ * @public
15
+ */
16
+ export declare type ForwardRefComponent<T, P> = ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
17
+ /**
18
+ * Motion-optimised versions of React's HTML components.
19
+ *
20
+ * @public
21
+ */
22
+ export declare type ThreeMotionComponents = {
23
+ [K in keyof JSX.IntrinsicElements]: ForwardRefComponent<JSX.IntrinsicElements[K], ThreeMotionProps & Omit<JSX.IntrinsicElements[K], "onUpdate">>;
24
+ };
@@ -0,0 +1,4 @@
1
+ import { RenderComponent } from "../..";
2
+ import { ThreeRenderState } from "./types";
3
+ import { Object3DNode } from "@react-three/fiber";
4
+ export declare const useRender: RenderComponent<Object3DNode<any, any>, ThreeRenderState>;
@@ -0,0 +1,2 @@
1
+ import { Object3DNode } from "@react-three/fiber";
2
+ export declare function readThreeValue(instance: Object3DNode<any, any>, name: string): any;
@@ -0,0 +1,2 @@
1
+ import { ThreeRenderState } from "../types";
2
+ export declare function setThreeValue(instance: any, key: string, values: ThreeRenderState): void;
@@ -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 variantsHaveChanged(prev: any, next: any): boolean;
18
+ export declare function checkVariantsDidChange(prev: any, next: any): boolean;
19
19
  export interface AnimationTypeState {
20
20
  isActive: boolean;
21
21
  protectedKeys: {
@@ -12,12 +12,15 @@ export declare type LayoutAnimationCompleteListener = () => void;
12
12
  export declare type SetAxisTargetListener = () => void;
13
13
  export declare type RenderListener = () => void;
14
14
  export declare type OnViewportBoxUpdate = (box: Axis, delta: Delta) => void;
15
- /**
16
- * TODO: Make more of these lifecycle events available as props
17
- */
18
- export interface VisualElementLifecycles {
15
+ export interface LayoutLifecycles {
19
16
  onBeforeLayoutMeasure?(box: Box): void;
20
17
  onLayoutMeasure?(box: Box, prevBox: Box): void;
18
+ /**
19
+ * @internal
20
+ */
21
+ onLayoutAnimationComplete?(): void;
22
+ }
23
+ export interface AnimationLifecycles {
21
24
  /**
22
25
  * Callback with latest motion values, fired max once per frame.
23
26
  *
@@ -71,15 +74,12 @@ export interface VisualElementLifecycles {
71
74
  * ```
72
75
  */
73
76
  onAnimationComplete?(definition: AnimationDefinition): void;
74
- /**
75
- * @internal
76
- */
77
- onLayoutAnimationComplete?(): void;
78
77
  /**
79
78
  * @internal
80
79
  */
81
80
  onUnmount?(): void;
82
81
  }
82
+ export declare type VisualElementLifecycles = LayoutLifecycles & AnimationLifecycles;
83
83
  export interface LifecycleManager {
84
84
  onLayoutMeasure: (callback: LayoutMeasureListener) => () => void;
85
85
  notifyLayoutMeasure: LayoutMeasureListener;
@@ -567,6 +567,7 @@ export declare function getOrigin(target: Target, transition: Transition, visual
567
567
  WebkitFontSmoothing?: import("csstype").Property.FontSmooth<string | number> | undefined;
568
568
  WebkitFontVariantLigatures?: import("csstype").Property.FontVariantLigatures | undefined;
569
569
  WebkitHyphens?: import("csstype").Property.Hyphens | undefined;
570
+ WebkitInitialLetter?: import("csstype").Property.InitialLetter | undefined;
570
571
  WebkitJustifyContent?: import("csstype").Property.JustifyContent | undefined;
571
572
  WebkitLineBreak?: import("csstype").Property.LineBreak | undefined;
572
573
  WebkitLineClamp?: import("csstype").Property.WebkitLineClamp | undefined;
@@ -0,0 +1 @@
1
+ export { motion } from "./render/three/motion";
@@ -0,0 +1,3 @@
1
+ export declare const instantAnimationState: {
2
+ current: boolean;
3
+ };
@@ -0,0 +1 @@
1
+ export declare function useInstantTransition(): (callback: () => void) => void;