framer-motion 5.3.2 → 5.4.0-beta.2
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/easing.mjs +1 -1
- package/dist/es/animation/utils/transitions.mjs +1 -1
- package/dist/es/components/AnimatePresence/index.mjs +1 -1
- package/dist/es/components/AnimatePresence/use-presence.mjs +1 -27
- package/dist/es/components/AnimateSharedLayout.mjs +1 -1
- package/dist/es/components/MotionCanvas/index.mjs +14 -0
- package/dist/es/components/Reorder/Item.mjs +1 -1
- package/dist/es/context/MotionContext/index.mjs +1 -1
- package/dist/es/events/use-dom-event.mjs +2 -31
- package/dist/es/events/use-pointer-event.mjs +2 -5
- package/dist/es/gestures/utils/event-type.mjs +1 -8
- package/dist/es/motion/index.mjs +1 -1
- package/dist/es/projection/animation/mix-values.mjs +1 -1
- package/dist/es/projection/geometry/models.mjs +1 -11
- package/dist/es/projection/node/create-projection-node.mjs +4 -1167
- package/dist/es/projection/styles/scale-border-radius.mjs +1 -1
- package/dist/es/projection/styles/transform.mjs +5 -5
- package/dist/es/render/dom/motion-proxy.mjs +3 -0
- package/dist/es/render/dom/utils/css-variables-conversion.mjs +2 -2
- package/dist/es/render/dom/utils/filter-props.mjs +3 -1
- package/dist/es/render/dom/value-types/dimensions.mjs +1 -8
- package/dist/es/render/html/use-props.mjs +1 -1
- package/dist/es/render/html/utils/build-transform.mjs +2 -2
- package/dist/es/render/svg/utils/path.mjs +1 -1
- package/dist/es/render/svg/utils/transform-origin.mjs +1 -1
- package/dist/es/render/three/create-visual-element.mjs +42 -0
- package/dist/es/render/three/gestures/use-hover.mjs +22 -0
- package/dist/es/render/three/gestures/use-tap.mjs +56 -0
- package/dist/es/render/three/motion.mjs +30 -0
- package/dist/es/render/three/use-render.mjs +11 -0
- package/dist/es/render/three/utils/read-value.mjs +43 -0
- package/dist/es/render/three/utils/set-value.mjs +59 -0
- package/dist/es/render/utils/animation.mjs +1 -4
- package/dist/es/render/utils/setters.mjs +2 -39
- package/dist/es/three-entry.mjs +2 -0
- package/dist/es/utils/array.mjs +2 -13
- package/dist/framer-motion-three.cjs.js +3004 -0
- package/dist/framer-motion.cjs.js +46 -43
- package/dist/framer-motion.dev.js +35 -32
- package/dist/framer-motion.js +1 -1
- package/dist/projection.dev.js +17 -17
- 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 +27 -6
- package/types/components/MotionCanvas/index.d.ts +4 -0
- package/types/motion/features/types.d.ts +1 -1
- package/types/render/three/create-visual-element.d.ts +6 -0
- package/types/render/three/gestures/use-hover.d.ts +10 -0
- package/types/render/three/gestures/use-tap.d.ts +8 -0
- package/types/render/three/motion.d.ts +5 -0
- package/types/render/three/types.d.ts +24 -0
- package/types/render/three/use-render.d.ts +4 -0
- package/types/render/three/utils/read-value.d.ts +2 -0
- package/types/render/three/utils/set-value.d.ts +2 -0
- package/types/render/utils/lifecycles.d.ts +8 -8
- package/types/render/utils/setters.d.ts +1 -0
- package/types/three-entry.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.4.0-beta.2",
|
|
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",
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
"import": "./dist/es/index.mjs",
|
|
11
11
|
"default": "./dist/framer-motion.cjs.js"
|
|
12
12
|
},
|
|
13
|
+
"./three": {
|
|
14
|
+
"require": "./dist/framer-motion-three.cjs.js",
|
|
15
|
+
"import": "./dist/es/three-entry.mjs",
|
|
16
|
+
"default": "./dist/framer-motion-three.cjs.js"
|
|
17
|
+
},
|
|
13
18
|
"./package.json": "./package.json"
|
|
14
19
|
},
|
|
15
20
|
"types": "types/index.d.ts",
|
|
@@ -20,6 +25,8 @@
|
|
|
20
25
|
"keywords": [
|
|
21
26
|
"react animation",
|
|
22
27
|
"react",
|
|
28
|
+
"three",
|
|
29
|
+
"3d",
|
|
23
30
|
"pose",
|
|
24
31
|
"react pose",
|
|
25
32
|
"animation",
|
|
@@ -54,12 +61,24 @@
|
|
|
54
61
|
"start-dev-server": "webpack serve --config dev/webpack/config.js --hot"
|
|
55
62
|
},
|
|
56
63
|
"peerDependencies": {
|
|
64
|
+
"@react-three/fiber": "^7.0.21",
|
|
57
65
|
"react": ">=16.8 || ^17.0.0",
|
|
58
|
-
"react-dom": ">=16.8 || ^17.0.0"
|
|
66
|
+
"react-dom": ">=16.8 || ^17.0.0",
|
|
67
|
+
"three": "^0.135.0"
|
|
68
|
+
},
|
|
69
|
+
"peerDependenciesMeta": {
|
|
70
|
+
"@react-three/fiber": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"three": {
|
|
74
|
+
"optional": true
|
|
75
|
+
}
|
|
59
76
|
},
|
|
60
77
|
"devDependencies": {
|
|
61
78
|
"@cypress/webpack-preprocessor": "^4.1.0",
|
|
62
79
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.4.3",
|
|
80
|
+
"@react-three/fiber": "^7.0.21",
|
|
81
|
+
"@react-three/test-renderer": "^7.0.20",
|
|
63
82
|
"@rollup/plugin-node-resolve": "^8.0.0",
|
|
64
83
|
"@rollup/plugin-replace": "^2.3.2",
|
|
65
84
|
"@testing-library/dom": "^6.10.1",
|
|
@@ -70,6 +89,7 @@
|
|
|
70
89
|
"@types/react": "17.0.9",
|
|
71
90
|
"@types/react-dom": "17.0.6",
|
|
72
91
|
"@types/styled-components": "^4.1.0",
|
|
92
|
+
"@types/three": "^0.134.0",
|
|
73
93
|
"@typescript-eslint/eslint-plugin": "^1.5.0",
|
|
74
94
|
"@typescript-eslint/parser": "^1.5.0",
|
|
75
95
|
"bundlesize": "^0.18.0",
|
|
@@ -101,6 +121,7 @@
|
|
|
101
121
|
"rollup-plugin-visualizer": "^2.4.3",
|
|
102
122
|
"start-server-and-test": "^1.9.1",
|
|
103
123
|
"styled-components": "^4.1.1",
|
|
124
|
+
"three": "^0.135.0",
|
|
104
125
|
"ts-jest": "^24.0.2",
|
|
105
126
|
"ts-loader": "^5.3.0",
|
|
106
127
|
"type-fest": "^1.0.1",
|
|
@@ -113,7 +134,7 @@
|
|
|
113
134
|
"dependencies": {
|
|
114
135
|
"framesync": "6.0.1",
|
|
115
136
|
"hey-listen": "^1.0.8",
|
|
116
|
-
"popmotion": "11.0.
|
|
137
|
+
"popmotion": "11.0.2",
|
|
117
138
|
"style-value-types": "5.0.0",
|
|
118
139
|
"tslib": "^2.1.0"
|
|
119
140
|
},
|
|
@@ -136,11 +157,11 @@
|
|
|
136
157
|
"bundlesize": [
|
|
137
158
|
{
|
|
138
159
|
"path": "./dist/framer-motion.js",
|
|
139
|
-
"maxSize": "34.
|
|
160
|
+
"maxSize": "34.9 kB"
|
|
140
161
|
},
|
|
141
162
|
{
|
|
142
163
|
"path": "./dist/size-rollup-m.js",
|
|
143
|
-
"maxSize": "6.
|
|
164
|
+
"maxSize": "6.1 kB"
|
|
144
165
|
},
|
|
145
166
|
{
|
|
146
167
|
"path": "./dist/size-rollup-dom-animation.js",
|
|
@@ -152,7 +173,7 @@
|
|
|
152
173
|
},
|
|
153
174
|
{
|
|
154
175
|
"path": "./dist/size-webpack-m.js",
|
|
155
|
-
"maxSize": "6.
|
|
176
|
+
"maxSize": "6.4 kB"
|
|
156
177
|
},
|
|
157
178
|
{
|
|
158
179
|
"path": "./dist/size-webpack-dom-animation.js",
|
|
@@ -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;
|
|
@@ -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
|
+
};
|
|
@@ -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;
|