framer-motion 7.7.3 → 7.8.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 +1966 -1860
- package/dist/es/animation/animate.mjs +2 -2
- package/dist/es/animation/create-accelerated-animation.mjs +8 -0
- package/dist/es/animation/create-instant-animation.mjs +12 -0
- package/dist/es/animation/{animation-controls.mjs → hooks/animation-controls.mjs} +2 -2
- package/dist/es/animation/{use-animated-state.mjs → hooks/use-animated-state.mjs} +6 -6
- package/dist/es/animation/{use-animation.mjs → hooks/use-animation.mjs} +1 -1
- package/dist/es/animation/index.mjs +121 -0
- package/dist/es/animation/legacy-popmotion/decay.mjs +11 -4
- package/dist/es/animation/legacy-popmotion/index.mjs +23 -15
- package/dist/es/animation/legacy-popmotion/inertia.mjs +14 -8
- package/dist/es/animation/legacy-popmotion/keyframes.mjs +21 -13
- package/dist/es/animation/legacy-popmotion/spring.mjs +33 -39
- package/dist/es/animation/optimized-appear/data-id.mjs +6 -0
- package/dist/es/animation/optimized-appear/handoff.mjs +34 -0
- package/dist/es/animation/optimized-appear/start.mjs +15 -0
- package/dist/es/animation/optimized-appear/store-id.mjs +3 -0
- package/dist/es/animation/utils/default-transitions.mjs +9 -14
- package/dist/es/animation/utils/keyframes.mjs +41 -0
- package/dist/es/animation/utils/transitions.mjs +1 -171
- package/dist/es/animation/waapi/easing.mjs +3 -0
- package/dist/es/animation/waapi/index.mjs +16 -0
- package/dist/es/animation/waapi/supports.mjs +17 -0
- package/dist/es/gestures/drag/VisualElementDragControls.mjs +2 -2
- package/dist/es/index.mjs +6 -3
- package/dist/es/render/utils/animation.mjs +15 -3
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/utils/delay.mjs +3 -0
- package/dist/es/value/index.mjs +2 -2
- package/dist/es/value/use-spring.mjs +1 -2
- package/dist/framer-motion.dev.js +1971 -1865
- package/dist/framer-motion.js +1 -1
- package/dist/index.d.ts +424 -341
- package/dist/projection.dev.js +1655 -1623
- package/dist/size-rollup-dom-animation-assets.js +1 -1
- package/dist/size-rollup-dom-animation.js +1 -1
- package/dist/size-rollup-dom-max-assets.js +1 -1
- package/dist/size-rollup-dom-max.js +1 -1
- package/dist/size-rollup-motion.js +1 -1
- package/dist/size-webpack-dom-animation.js +1 -1
- package/dist/size-webpack-dom-max.js +1 -1
- package/dist/three-entry.d.ts +289 -282
- package/package.json +11 -9
package/dist/three-entry.d.ts
CHANGED
|
@@ -2,135 +2,9 @@
|
|
|
2
2
|
import * as React$1 from 'react';
|
|
3
3
|
import { SVGAttributes, CSSProperties, RefObject, useEffect } from 'react';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
8
|
-
declare type Subscriber<T> = (v: T) => void;
|
|
9
|
-
/**
|
|
10
|
-
* `MotionValue` is used to track the state and velocity of motion values.
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
declare class MotionValue<V = any> {
|
|
15
|
-
/**
|
|
16
|
-
* This will be replaced by the build step with the latest version number.
|
|
17
|
-
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
18
|
-
*/
|
|
19
|
-
version: string;
|
|
20
|
-
/**
|
|
21
|
-
* Adds a function that will be notified when the `MotionValue` is updated.
|
|
22
|
-
*
|
|
23
|
-
* It returns a function that, when called, will cancel the subscription.
|
|
24
|
-
*
|
|
25
|
-
* When calling `onChange` inside a React component, it should be wrapped with the
|
|
26
|
-
* `useEffect` hook. As it returns an unsubscribe function, this should be returned
|
|
27
|
-
* from the `useEffect` function to ensure you don't add duplicate subscribers..
|
|
28
|
-
*
|
|
29
|
-
* ```jsx
|
|
30
|
-
* export const MyComponent = () => {
|
|
31
|
-
* const x = useMotionValue(0)
|
|
32
|
-
* const y = useMotionValue(0)
|
|
33
|
-
* const opacity = useMotionValue(1)
|
|
34
|
-
*
|
|
35
|
-
* useEffect(() => {
|
|
36
|
-
* function updateOpacity() {
|
|
37
|
-
* const maxXY = Math.max(x.get(), y.get())
|
|
38
|
-
* const newOpacity = transform(maxXY, [0, 100], [1, 0])
|
|
39
|
-
* opacity.set(newOpacity)
|
|
40
|
-
* }
|
|
41
|
-
*
|
|
42
|
-
* const unsubscribeX = x.onChange(updateOpacity)
|
|
43
|
-
* const unsubscribeY = y.onChange(updateOpacity)
|
|
44
|
-
*
|
|
45
|
-
* return () => {
|
|
46
|
-
* unsubscribeX()
|
|
47
|
-
* unsubscribeY()
|
|
48
|
-
* }
|
|
49
|
-
* }, [])
|
|
50
|
-
*
|
|
51
|
-
* return <motion.div style={{ x }} />
|
|
52
|
-
* }
|
|
53
|
-
* ```
|
|
54
|
-
*
|
|
55
|
-
* @privateRemarks
|
|
56
|
-
*
|
|
57
|
-
* We could look into a `useOnChange` hook if the above lifecycle management proves confusing.
|
|
58
|
-
*
|
|
59
|
-
* ```jsx
|
|
60
|
-
* useOnChange(x, () => {})
|
|
61
|
-
* ```
|
|
62
|
-
*
|
|
63
|
-
* @param subscriber - A function that receives the latest value.
|
|
64
|
-
* @returns A function that, when called, will cancel this subscription.
|
|
65
|
-
*
|
|
66
|
-
* @public
|
|
67
|
-
*/
|
|
68
|
-
onChange(subscription: Subscriber<V>): () => void;
|
|
69
|
-
clearListeners(): void;
|
|
70
|
-
/**
|
|
71
|
-
* Sets the state of the `MotionValue`.
|
|
72
|
-
*
|
|
73
|
-
* @remarks
|
|
74
|
-
*
|
|
75
|
-
* ```jsx
|
|
76
|
-
* const x = useMotionValue(0)
|
|
77
|
-
* x.set(10)
|
|
78
|
-
* ```
|
|
79
|
-
*
|
|
80
|
-
* @param latest - Latest value to set.
|
|
81
|
-
* @param render - Whether to notify render subscribers. Defaults to `true`
|
|
82
|
-
*
|
|
83
|
-
* @public
|
|
84
|
-
*/
|
|
85
|
-
set(v: V, render?: boolean): void;
|
|
86
|
-
updateAndNotify: (v: V, render?: boolean) => void;
|
|
87
|
-
/**
|
|
88
|
-
* Returns the latest state of `MotionValue`
|
|
89
|
-
*
|
|
90
|
-
* @returns - The latest state of `MotionValue`
|
|
91
|
-
*
|
|
92
|
-
* @public
|
|
93
|
-
*/
|
|
94
|
-
get(): V;
|
|
95
|
-
/**
|
|
96
|
-
* @public
|
|
97
|
-
*/
|
|
98
|
-
getPrevious(): V;
|
|
99
|
-
/**
|
|
100
|
-
* Returns the latest velocity of `MotionValue`
|
|
101
|
-
*
|
|
102
|
-
* @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
|
|
103
|
-
*
|
|
104
|
-
* @public
|
|
105
|
-
*/
|
|
106
|
-
getVelocity(): number;
|
|
107
|
-
hasAnimated: boolean;
|
|
108
|
-
/**
|
|
109
|
-
* Stop the currently active animation.
|
|
110
|
-
*
|
|
111
|
-
* @public
|
|
112
|
-
*/
|
|
113
|
-
stop(): void;
|
|
114
|
-
/**
|
|
115
|
-
* Returns `true` if this value is currently animating.
|
|
116
|
-
*
|
|
117
|
-
* @public
|
|
118
|
-
*/
|
|
119
|
-
isAnimating(): boolean;
|
|
120
|
-
private clearAnimation;
|
|
121
|
-
/**
|
|
122
|
-
* Destroy and clean up subscribers to this `MotionValue`.
|
|
123
|
-
*
|
|
124
|
-
* The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
|
|
125
|
-
* handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
|
|
126
|
-
* created a `MotionValue` via the `motionValue` function.
|
|
127
|
-
*
|
|
128
|
-
* @public
|
|
129
|
-
*/
|
|
130
|
-
destroy(): void;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
5
|
declare type EasingFunction = (v: number) => number;
|
|
6
|
+
declare type BezierDefinition = [number, number, number, number];
|
|
7
|
+
declare type EasingDefinition = BezierDefinition | "linear" | "easeIn" | "easeOut" | "easeInOut" | "circIn" | "circOut" | "circInOut" | "backIn" | "backOut" | "backInOut" | "anticipate";
|
|
134
8
|
/**
|
|
135
9
|
* The easing function to use. Set as one of:
|
|
136
10
|
*
|
|
@@ -140,7 +14,7 @@ declare type EasingFunction = (v: number) => number;
|
|
|
140
14
|
*
|
|
141
15
|
* @public
|
|
142
16
|
*/
|
|
143
|
-
declare type Easing =
|
|
17
|
+
declare type Easing = EasingDefinition | EasingFunction;
|
|
144
18
|
|
|
145
19
|
/**
|
|
146
20
|
* Options for orchestrating the timing of animations.
|
|
@@ -978,67 +852,11 @@ interface CustomValueType {
|
|
|
978
852
|
toValue: () => number | string;
|
|
979
853
|
}
|
|
980
854
|
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
* @public
|
|
987
|
-
*/
|
|
988
|
-
interface AnimationControls {
|
|
989
|
-
/**
|
|
990
|
-
* Starts an animation on all linked components.
|
|
991
|
-
*
|
|
992
|
-
* @remarks
|
|
993
|
-
*
|
|
994
|
-
* ```jsx
|
|
995
|
-
* controls.start("variantLabel")
|
|
996
|
-
* controls.start({
|
|
997
|
-
* x: 0,
|
|
998
|
-
* transition: { duration: 1 }
|
|
999
|
-
* })
|
|
1000
|
-
* ```
|
|
1001
|
-
*
|
|
1002
|
-
* @param definition - Properties or variant label to animate to
|
|
1003
|
-
* @param transition - Optional `transtion` to apply to a variant
|
|
1004
|
-
* @returns - A `Promise` that resolves when all animations have completed.
|
|
1005
|
-
*
|
|
1006
|
-
* @public
|
|
1007
|
-
*/
|
|
1008
|
-
start(definition: ControlsAnimationDefinition, transitionOverride?: Transition): Promise<any>;
|
|
1009
|
-
/**
|
|
1010
|
-
* Instantly set to a set of properties or a variant.
|
|
1011
|
-
*
|
|
1012
|
-
* ```jsx
|
|
1013
|
-
* // With properties
|
|
1014
|
-
* controls.set({ opacity: 0 })
|
|
1015
|
-
*
|
|
1016
|
-
* // With variants
|
|
1017
|
-
* controls.set("hidden")
|
|
1018
|
-
* ```
|
|
1019
|
-
*
|
|
1020
|
-
* @privateRemarks
|
|
1021
|
-
* We could perform a similar trick to `.start` where this can be called before mount
|
|
1022
|
-
* and we maintain a list of of pending actions that get applied on mount. But the
|
|
1023
|
-
* expectation of `set` is that it happens synchronously and this would be difficult
|
|
1024
|
-
* to do before any children have even attached themselves. It's also poor practise
|
|
1025
|
-
* and we should discourage render-synchronous `.start` calls rather than lean into this.
|
|
1026
|
-
*
|
|
1027
|
-
* @public
|
|
1028
|
-
*/
|
|
1029
|
-
set(definition: ControlsAnimationDefinition): void;
|
|
1030
|
-
/**
|
|
1031
|
-
* Stops animations on all linked components.
|
|
1032
|
-
*
|
|
1033
|
-
* ```jsx
|
|
1034
|
-
* controls.stop()
|
|
1035
|
-
* ```
|
|
1036
|
-
*
|
|
1037
|
-
* @public
|
|
1038
|
-
*/
|
|
1039
|
-
stop(): void;
|
|
1040
|
-
mount(): () => void;
|
|
1041
|
-
}
|
|
855
|
+
declare type FrameData = {
|
|
856
|
+
delta: number;
|
|
857
|
+
timestamp: number;
|
|
858
|
+
};
|
|
859
|
+
declare type Process = (data: FrameData) => void;
|
|
1042
860
|
|
|
1043
861
|
interface Point {
|
|
1044
862
|
x: number;
|
|
@@ -1070,110 +888,29 @@ interface Delta {
|
|
|
1070
888
|
}
|
|
1071
889
|
declare type TransformPoint = (point: Point) => Point;
|
|
1072
890
|
|
|
891
|
+
declare type ReducedMotionConfig = "always" | "never" | "user";
|
|
1073
892
|
/**
|
|
1074
|
-
* Passed in to pan event handlers like `onPan` the `PanInfo` object contains
|
|
1075
|
-
* information about the current state of the tap gesture such as its
|
|
1076
|
-
* `point`, `delta`, `offset` and `velocity`.
|
|
1077
|
-
*
|
|
1078
|
-
* ```jsx
|
|
1079
|
-
* <motion.div onPan={(event, info) => {
|
|
1080
|
-
* console.log(info.point.x, info.point.y)
|
|
1081
|
-
* }} />
|
|
1082
|
-
* ```
|
|
1083
|
-
*
|
|
1084
893
|
* @public
|
|
1085
894
|
*/
|
|
1086
|
-
interface
|
|
895
|
+
interface MotionConfigContext {
|
|
1087
896
|
/**
|
|
1088
|
-
*
|
|
1089
|
-
* to the device or page.
|
|
1090
|
-
*
|
|
1091
|
-
* ```jsx
|
|
1092
|
-
* function onPan(event, info) {
|
|
1093
|
-
* console.log(info.point.x, info.point.y)
|
|
1094
|
-
* }
|
|
1095
|
-
*
|
|
1096
|
-
* <motion.div onPan={onPan} />
|
|
1097
|
-
* ```
|
|
1098
|
-
*
|
|
1099
|
-
* @public
|
|
897
|
+
* Internal, exported only for usage in Framer
|
|
1100
898
|
*/
|
|
1101
|
-
|
|
899
|
+
transformPagePoint: TransformPoint;
|
|
1102
900
|
/**
|
|
1103
|
-
*
|
|
1104
|
-
*
|
|
1105
|
-
*
|
|
1106
|
-
* ```jsx
|
|
1107
|
-
* function onPan(event, info) {
|
|
1108
|
-
* console.log(info.delta.x, info.delta.y)
|
|
1109
|
-
* }
|
|
1110
|
-
*
|
|
1111
|
-
* <motion.div onPan={onPan} />
|
|
1112
|
-
* ```
|
|
1113
|
-
*
|
|
1114
|
-
* @public
|
|
901
|
+
* Internal. Determines whether this is a static context ie the Framer canvas. If so,
|
|
902
|
+
* it'll disable all dynamic functionality.
|
|
1115
903
|
*/
|
|
1116
|
-
|
|
904
|
+
isStatic: boolean;
|
|
1117
905
|
/**
|
|
1118
|
-
*
|
|
1119
|
-
* the first pan event.
|
|
1120
|
-
*
|
|
1121
|
-
* ```jsx
|
|
1122
|
-
* function onPan(event, info) {
|
|
1123
|
-
* console.log(info.offset.x, info.offset.y)
|
|
1124
|
-
* }
|
|
1125
|
-
*
|
|
1126
|
-
* <motion.div onPan={onPan} />
|
|
1127
|
-
* ```
|
|
906
|
+
* Defines a new default transition for the entire tree.
|
|
1128
907
|
*
|
|
1129
908
|
* @public
|
|
1130
909
|
*/
|
|
1131
|
-
|
|
910
|
+
transition?: Transition;
|
|
1132
911
|
/**
|
|
1133
|
-
*
|
|
1134
|
-
*
|
|
1135
|
-
* ```jsx
|
|
1136
|
-
* function onPan(event, info) {
|
|
1137
|
-
* console.log(info.velocity.x, info.velocity.y)
|
|
1138
|
-
* }
|
|
1139
|
-
*
|
|
1140
|
-
* <motion.div onPan={onPan} />
|
|
1141
|
-
* ```
|
|
1142
|
-
*
|
|
1143
|
-
* @public
|
|
1144
|
-
*/
|
|
1145
|
-
velocity: Point;
|
|
1146
|
-
}
|
|
1147
|
-
|
|
1148
|
-
declare type FrameData = {
|
|
1149
|
-
delta: number;
|
|
1150
|
-
timestamp: number;
|
|
1151
|
-
};
|
|
1152
|
-
declare type Process = (data: FrameData) => void;
|
|
1153
|
-
|
|
1154
|
-
declare type ReducedMotionConfig = "always" | "never" | "user";
|
|
1155
|
-
/**
|
|
1156
|
-
* @public
|
|
1157
|
-
*/
|
|
1158
|
-
interface MotionConfigContext {
|
|
1159
|
-
/**
|
|
1160
|
-
* Internal, exported only for usage in Framer
|
|
1161
|
-
*/
|
|
1162
|
-
transformPagePoint: TransformPoint;
|
|
1163
|
-
/**
|
|
1164
|
-
* Internal. Determines whether this is a static context ie the Framer canvas. If so,
|
|
1165
|
-
* it'll disable all dynamic functionality.
|
|
1166
|
-
*/
|
|
1167
|
-
isStatic: boolean;
|
|
1168
|
-
/**
|
|
1169
|
-
* Defines a new default transition for the entire tree.
|
|
1170
|
-
*
|
|
1171
|
-
* @public
|
|
1172
|
-
*/
|
|
1173
|
-
transition?: Transition;
|
|
1174
|
-
/**
|
|
1175
|
-
* If true, will respect the device prefersReducedMotion setting by switching
|
|
1176
|
-
* transform animations off.
|
|
912
|
+
* If true, will respect the device prefersReducedMotion setting by switching
|
|
913
|
+
* transform animations off.
|
|
1177
914
|
*
|
|
1178
915
|
* @public
|
|
1179
916
|
*/
|
|
@@ -1723,6 +1460,276 @@ declare abstract class VisualElement<Instance = unknown, RenderState = unknown,
|
|
|
1723
1460
|
notify<EventName extends keyof VisualElementEventCallbacks>(eventName: EventName, ...args: any): void;
|
|
1724
1461
|
}
|
|
1725
1462
|
|
|
1463
|
+
/**
|
|
1464
|
+
* @public
|
|
1465
|
+
*/
|
|
1466
|
+
declare type Subscriber<T> = (v: T) => void;
|
|
1467
|
+
/**
|
|
1468
|
+
* `MotionValue` is used to track the state and velocity of motion values.
|
|
1469
|
+
*
|
|
1470
|
+
* @public
|
|
1471
|
+
*/
|
|
1472
|
+
declare class MotionValue<V = any> {
|
|
1473
|
+
/**
|
|
1474
|
+
* This will be replaced by the build step with the latest version number.
|
|
1475
|
+
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
1476
|
+
*/
|
|
1477
|
+
version: string;
|
|
1478
|
+
/**
|
|
1479
|
+
* If a MotionValue has an owner, it was created internally within Framer Motion
|
|
1480
|
+
* and therefore has no external listeners. It is therefore safe to animate via WAAPI.
|
|
1481
|
+
*/
|
|
1482
|
+
owner?: VisualElement;
|
|
1483
|
+
/**
|
|
1484
|
+
* Adds a function that will be notified when the `MotionValue` is updated.
|
|
1485
|
+
*
|
|
1486
|
+
* It returns a function that, when called, will cancel the subscription.
|
|
1487
|
+
*
|
|
1488
|
+
* When calling `onChange` inside a React component, it should be wrapped with the
|
|
1489
|
+
* `useEffect` hook. As it returns an unsubscribe function, this should be returned
|
|
1490
|
+
* from the `useEffect` function to ensure you don't add duplicate subscribers..
|
|
1491
|
+
*
|
|
1492
|
+
* ```jsx
|
|
1493
|
+
* export const MyComponent = () => {
|
|
1494
|
+
* const x = useMotionValue(0)
|
|
1495
|
+
* const y = useMotionValue(0)
|
|
1496
|
+
* const opacity = useMotionValue(1)
|
|
1497
|
+
*
|
|
1498
|
+
* useEffect(() => {
|
|
1499
|
+
* function updateOpacity() {
|
|
1500
|
+
* const maxXY = Math.max(x.get(), y.get())
|
|
1501
|
+
* const newOpacity = transform(maxXY, [0, 100], [1, 0])
|
|
1502
|
+
* opacity.set(newOpacity)
|
|
1503
|
+
* }
|
|
1504
|
+
*
|
|
1505
|
+
* const unsubscribeX = x.onChange(updateOpacity)
|
|
1506
|
+
* const unsubscribeY = y.onChange(updateOpacity)
|
|
1507
|
+
*
|
|
1508
|
+
* return () => {
|
|
1509
|
+
* unsubscribeX()
|
|
1510
|
+
* unsubscribeY()
|
|
1511
|
+
* }
|
|
1512
|
+
* }, [])
|
|
1513
|
+
*
|
|
1514
|
+
* return <motion.div style={{ x }} />
|
|
1515
|
+
* }
|
|
1516
|
+
* ```
|
|
1517
|
+
*
|
|
1518
|
+
* @privateRemarks
|
|
1519
|
+
*
|
|
1520
|
+
* We could look into a `useOnChange` hook if the above lifecycle management proves confusing.
|
|
1521
|
+
*
|
|
1522
|
+
* ```jsx
|
|
1523
|
+
* useOnChange(x, () => {})
|
|
1524
|
+
* ```
|
|
1525
|
+
*
|
|
1526
|
+
* @param subscriber - A function that receives the latest value.
|
|
1527
|
+
* @returns A function that, when called, will cancel this subscription.
|
|
1528
|
+
*
|
|
1529
|
+
* @public
|
|
1530
|
+
*/
|
|
1531
|
+
onChange(subscription: Subscriber<V>): () => void;
|
|
1532
|
+
clearListeners(): void;
|
|
1533
|
+
/**
|
|
1534
|
+
* Sets the state of the `MotionValue`.
|
|
1535
|
+
*
|
|
1536
|
+
* @remarks
|
|
1537
|
+
*
|
|
1538
|
+
* ```jsx
|
|
1539
|
+
* const x = useMotionValue(0)
|
|
1540
|
+
* x.set(10)
|
|
1541
|
+
* ```
|
|
1542
|
+
*
|
|
1543
|
+
* @param latest - Latest value to set.
|
|
1544
|
+
* @param render - Whether to notify render subscribers. Defaults to `true`
|
|
1545
|
+
*
|
|
1546
|
+
* @public
|
|
1547
|
+
*/
|
|
1548
|
+
set(v: V, render?: boolean): void;
|
|
1549
|
+
updateAndNotify: (v: V, render?: boolean) => void;
|
|
1550
|
+
/**
|
|
1551
|
+
* Returns the latest state of `MotionValue`
|
|
1552
|
+
*
|
|
1553
|
+
* @returns - The latest state of `MotionValue`
|
|
1554
|
+
*
|
|
1555
|
+
* @public
|
|
1556
|
+
*/
|
|
1557
|
+
get(): V;
|
|
1558
|
+
/**
|
|
1559
|
+
* @public
|
|
1560
|
+
*/
|
|
1561
|
+
getPrevious(): V;
|
|
1562
|
+
/**
|
|
1563
|
+
* Returns the latest velocity of `MotionValue`
|
|
1564
|
+
*
|
|
1565
|
+
* @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
|
|
1566
|
+
*
|
|
1567
|
+
* @public
|
|
1568
|
+
*/
|
|
1569
|
+
getVelocity(): number;
|
|
1570
|
+
hasAnimated: boolean;
|
|
1571
|
+
/**
|
|
1572
|
+
* Stop the currently active animation.
|
|
1573
|
+
*
|
|
1574
|
+
* @public
|
|
1575
|
+
*/
|
|
1576
|
+
stop(): void;
|
|
1577
|
+
/**
|
|
1578
|
+
* Returns `true` if this value is currently animating.
|
|
1579
|
+
*
|
|
1580
|
+
* @public
|
|
1581
|
+
*/
|
|
1582
|
+
isAnimating(): boolean;
|
|
1583
|
+
private clearAnimation;
|
|
1584
|
+
/**
|
|
1585
|
+
* Destroy and clean up subscribers to this `MotionValue`.
|
|
1586
|
+
*
|
|
1587
|
+
* The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
|
|
1588
|
+
* handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
|
|
1589
|
+
* created a `MotionValue` via the `motionValue` function.
|
|
1590
|
+
*
|
|
1591
|
+
* @public
|
|
1592
|
+
*/
|
|
1593
|
+
destroy(): void;
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
/**
|
|
1597
|
+
* @public
|
|
1598
|
+
*/
|
|
1599
|
+
declare type ControlsAnimationDefinition = string | string[] | TargetAndTransition | TargetResolver;
|
|
1600
|
+
/**
|
|
1601
|
+
* @public
|
|
1602
|
+
*/
|
|
1603
|
+
interface AnimationControls {
|
|
1604
|
+
/**
|
|
1605
|
+
* Starts an animation on all linked components.
|
|
1606
|
+
*
|
|
1607
|
+
* @remarks
|
|
1608
|
+
*
|
|
1609
|
+
* ```jsx
|
|
1610
|
+
* controls.start("variantLabel")
|
|
1611
|
+
* controls.start({
|
|
1612
|
+
* x: 0,
|
|
1613
|
+
* transition: { duration: 1 }
|
|
1614
|
+
* })
|
|
1615
|
+
* ```
|
|
1616
|
+
*
|
|
1617
|
+
* @param definition - Properties or variant label to animate to
|
|
1618
|
+
* @param transition - Optional `transtion` to apply to a variant
|
|
1619
|
+
* @returns - A `Promise` that resolves when all animations have completed.
|
|
1620
|
+
*
|
|
1621
|
+
* @public
|
|
1622
|
+
*/
|
|
1623
|
+
start(definition: ControlsAnimationDefinition, transitionOverride?: Transition): Promise<any>;
|
|
1624
|
+
/**
|
|
1625
|
+
* Instantly set to a set of properties or a variant.
|
|
1626
|
+
*
|
|
1627
|
+
* ```jsx
|
|
1628
|
+
* // With properties
|
|
1629
|
+
* controls.set({ opacity: 0 })
|
|
1630
|
+
*
|
|
1631
|
+
* // With variants
|
|
1632
|
+
* controls.set("hidden")
|
|
1633
|
+
* ```
|
|
1634
|
+
*
|
|
1635
|
+
* @privateRemarks
|
|
1636
|
+
* We could perform a similar trick to `.start` where this can be called before mount
|
|
1637
|
+
* and we maintain a list of of pending actions that get applied on mount. But the
|
|
1638
|
+
* expectation of `set` is that it happens synchronously and this would be difficult
|
|
1639
|
+
* to do before any children have even attached themselves. It's also poor practise
|
|
1640
|
+
* and we should discourage render-synchronous `.start` calls rather than lean into this.
|
|
1641
|
+
*
|
|
1642
|
+
* @public
|
|
1643
|
+
*/
|
|
1644
|
+
set(definition: ControlsAnimationDefinition): void;
|
|
1645
|
+
/**
|
|
1646
|
+
* Stops animations on all linked components.
|
|
1647
|
+
*
|
|
1648
|
+
* ```jsx
|
|
1649
|
+
* controls.stop()
|
|
1650
|
+
* ```
|
|
1651
|
+
*
|
|
1652
|
+
* @public
|
|
1653
|
+
*/
|
|
1654
|
+
stop(): void;
|
|
1655
|
+
mount(): () => void;
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
/**
|
|
1659
|
+
* Passed in to pan event handlers like `onPan` the `PanInfo` object contains
|
|
1660
|
+
* information about the current state of the tap gesture such as its
|
|
1661
|
+
* `point`, `delta`, `offset` and `velocity`.
|
|
1662
|
+
*
|
|
1663
|
+
* ```jsx
|
|
1664
|
+
* <motion.div onPan={(event, info) => {
|
|
1665
|
+
* console.log(info.point.x, info.point.y)
|
|
1666
|
+
* }} />
|
|
1667
|
+
* ```
|
|
1668
|
+
*
|
|
1669
|
+
* @public
|
|
1670
|
+
*/
|
|
1671
|
+
interface PanInfo {
|
|
1672
|
+
/**
|
|
1673
|
+
* Contains `x` and `y` values for the current pan position relative
|
|
1674
|
+
* to the device or page.
|
|
1675
|
+
*
|
|
1676
|
+
* ```jsx
|
|
1677
|
+
* function onPan(event, info) {
|
|
1678
|
+
* console.log(info.point.x, info.point.y)
|
|
1679
|
+
* }
|
|
1680
|
+
*
|
|
1681
|
+
* <motion.div onPan={onPan} />
|
|
1682
|
+
* ```
|
|
1683
|
+
*
|
|
1684
|
+
* @public
|
|
1685
|
+
*/
|
|
1686
|
+
point: Point;
|
|
1687
|
+
/**
|
|
1688
|
+
* Contains `x` and `y` values for the distance moved since
|
|
1689
|
+
* the last event.
|
|
1690
|
+
*
|
|
1691
|
+
* ```jsx
|
|
1692
|
+
* function onPan(event, info) {
|
|
1693
|
+
* console.log(info.delta.x, info.delta.y)
|
|
1694
|
+
* }
|
|
1695
|
+
*
|
|
1696
|
+
* <motion.div onPan={onPan} />
|
|
1697
|
+
* ```
|
|
1698
|
+
*
|
|
1699
|
+
* @public
|
|
1700
|
+
*/
|
|
1701
|
+
delta: Point;
|
|
1702
|
+
/**
|
|
1703
|
+
* Contains `x` and `y` values for the distance moved from
|
|
1704
|
+
* the first pan event.
|
|
1705
|
+
*
|
|
1706
|
+
* ```jsx
|
|
1707
|
+
* function onPan(event, info) {
|
|
1708
|
+
* console.log(info.offset.x, info.offset.y)
|
|
1709
|
+
* }
|
|
1710
|
+
*
|
|
1711
|
+
* <motion.div onPan={onPan} />
|
|
1712
|
+
* ```
|
|
1713
|
+
*
|
|
1714
|
+
* @public
|
|
1715
|
+
*/
|
|
1716
|
+
offset: Point;
|
|
1717
|
+
/**
|
|
1718
|
+
* Contains `x` and `y` values for the current velocity of the pointer, in px/ms.
|
|
1719
|
+
*
|
|
1720
|
+
* ```jsx
|
|
1721
|
+
* function onPan(event, info) {
|
|
1722
|
+
* console.log(info.velocity.x, info.velocity.y)
|
|
1723
|
+
* }
|
|
1724
|
+
*
|
|
1725
|
+
* <motion.div onPan={onPan} />
|
|
1726
|
+
* ```
|
|
1727
|
+
*
|
|
1728
|
+
* @public
|
|
1729
|
+
*/
|
|
1730
|
+
velocity: Point;
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1726
1733
|
interface DragControlOptions {
|
|
1727
1734
|
snapToCursor?: boolean;
|
|
1728
1735
|
cursorProgress?: Point;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "framer-motion",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.8.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",
|
|
@@ -42,11 +42,13 @@
|
|
|
42
42
|
"test-client": "jest --config jest.config.json --max-workers=2",
|
|
43
43
|
"test-server": "jest --config jest.config.ssr.json ",
|
|
44
44
|
"test-watch": "jest --watch --coverage --coverageReporters=lcov --config jest.config.json",
|
|
45
|
+
"test-appear": "yarn run collect-appear-tests && start-server-and-test 'pushd ../../; python -m SimpleHTTPServer; popd' http://0.0.0.0:8000 'cypress run -s cypress/integration/appear.chrome.ts --config baseUrl=http://localhost:8000/'",
|
|
45
46
|
"test-projection": "yarn run collect-projection-tests && start-server-and-test 'pushd ../../; python -m SimpleHTTPServer; popd' http://0.0.0.0:8000 'cypress run -s cypress/integration/projection.chrome.ts --config baseUrl=http://localhost:8000/'",
|
|
46
47
|
"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\"'",
|
|
47
48
|
"test-e2e-electron": "start-server-and-test start-dev-server http://localhost:9990 'cypress run --headless --config ignoreTestFiles=*.chrome.ts'",
|
|
48
|
-
"test-e2e": "yarn test-projection && yarn test-e2e-electron",
|
|
49
|
+
"test-e2e": "yarn test-appear && yarn test-projection && yarn test-e2e-electron",
|
|
49
50
|
"test-e2e-file": "start-server-and-test start-dev-server http://localhost:9990 'cypress run --headless --spec \"cypress/integration/while-in-view.ts\"'",
|
|
51
|
+
"collect-appear-tests": "node ../../dev/optimized-appear/collect-appear-tests.js",
|
|
50
52
|
"collect-projection-tests": "node ../../dev/projection/collect-projection-tests.js",
|
|
51
53
|
"prettier": "prettier ./src/* --write",
|
|
52
54
|
"watch": "concurrently -c blue,red -n tsc,rollup --kill-others \"tsc --watch -p . --preserveWatchOutput\" \"rollup --config --watch --no-watch.clearScreen\"",
|
|
@@ -60,7 +62,7 @@
|
|
|
60
62
|
"react-dom": "^18.0.0"
|
|
61
63
|
},
|
|
62
64
|
"dependencies": {
|
|
63
|
-
"@motionone/dom": "10.
|
|
65
|
+
"@motionone/dom": "^10.15.3",
|
|
64
66
|
"hey-listen": "^1.0.8",
|
|
65
67
|
"tslib": "2.4.0"
|
|
66
68
|
},
|
|
@@ -70,7 +72,7 @@
|
|
|
70
72
|
"bundlesize": [
|
|
71
73
|
{
|
|
72
74
|
"path": "./dist/size-rollup-motion.js",
|
|
73
|
-
"maxSize": "28.
|
|
75
|
+
"maxSize": "28.98 kB"
|
|
74
76
|
},
|
|
75
77
|
{
|
|
76
78
|
"path": "./dist/size-rollup-m.js",
|
|
@@ -78,11 +80,11 @@
|
|
|
78
80
|
},
|
|
79
81
|
{
|
|
80
82
|
"path": "./dist/size-rollup-dom-animation.js",
|
|
81
|
-
"maxSize": "14.
|
|
83
|
+
"maxSize": "14.21kB"
|
|
82
84
|
},
|
|
83
85
|
{
|
|
84
86
|
"path": "./dist/size-rollup-dom-max.js",
|
|
85
|
-
"maxSize": "24.
|
|
87
|
+
"maxSize": "24.9 kB"
|
|
86
88
|
},
|
|
87
89
|
{
|
|
88
90
|
"path": "./dist/size-webpack-m.js",
|
|
@@ -90,12 +92,12 @@
|
|
|
90
92
|
},
|
|
91
93
|
{
|
|
92
94
|
"path": "./dist/size-webpack-dom-animation.js",
|
|
93
|
-
"maxSize": "18.
|
|
95
|
+
"maxSize": "18.39 kB"
|
|
94
96
|
},
|
|
95
97
|
{
|
|
96
98
|
"path": "./dist/size-webpack-dom-max.js",
|
|
97
|
-
"maxSize": "29.
|
|
99
|
+
"maxSize": "29.96kB"
|
|
98
100
|
}
|
|
99
101
|
],
|
|
100
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "3a1308e2002989be77283c1ca977e0b08fdc85f2"
|
|
101
103
|
}
|