framer-motion 7.8.0 → 7.9.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/README.md +6 -5
- package/dist/cjs/index.js +2030 -1920
- package/dist/es/animation/animate.mjs +2 -2
- 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 +124 -0
- package/dist/es/animation/legacy-popmotion/decay.mjs +11 -4
- package/dist/es/animation/legacy-popmotion/index.mjs +22 -11
- 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 +13 -11
- 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 -166
- package/dist/es/animation/waapi/create-accelerated-animation.mjs +82 -0
- package/dist/es/animation/waapi/index.mjs +4 -6
- package/dist/es/gestures/drag/VisualElementDragControls.mjs +2 -2
- package/dist/es/index.mjs +3 -3
- package/dist/es/render/VisualElement.mjs +1 -1
- package/dist/es/render/utils/animation.mjs +2 -2
- package/dist/es/render/utils/motion-values.mjs +2 -2
- package/dist/es/render/utils/setters.mjs +1 -1
- package/dist/es/value/index.mjs +11 -5
- package/dist/es/value/use-spring.mjs +1 -2
- package/dist/framer-motion.dev.js +2051 -1941
- package/dist/framer-motion.js +1 -1
- package/dist/index.d.ts +409 -348
- package/dist/projection.dev.js +1672 -1535
- 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 +287 -281
- package/package.json +8 -8
package/dist/three-entry.d.ts
CHANGED
|
@@ -2,134 +2,6 @@
|
|
|
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;
|
|
134
6
|
declare type BezierDefinition = [number, number, number, number];
|
|
135
7
|
declare type EasingDefinition = BezierDefinition | "linear" | "easeIn" | "easeOut" | "easeInOut" | "circIn" | "circOut" | "circInOut" | "backIn" | "backOut" | "backInOut" | "anticipate";
|
|
@@ -980,67 +852,11 @@ interface CustomValueType {
|
|
|
980
852
|
toValue: () => number | string;
|
|
981
853
|
}
|
|
982
854
|
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
* @public
|
|
989
|
-
*/
|
|
990
|
-
interface AnimationControls {
|
|
991
|
-
/**
|
|
992
|
-
* Starts an animation on all linked components.
|
|
993
|
-
*
|
|
994
|
-
* @remarks
|
|
995
|
-
*
|
|
996
|
-
* ```jsx
|
|
997
|
-
* controls.start("variantLabel")
|
|
998
|
-
* controls.start({
|
|
999
|
-
* x: 0,
|
|
1000
|
-
* transition: { duration: 1 }
|
|
1001
|
-
* })
|
|
1002
|
-
* ```
|
|
1003
|
-
*
|
|
1004
|
-
* @param definition - Properties or variant label to animate to
|
|
1005
|
-
* @param transition - Optional `transtion` to apply to a variant
|
|
1006
|
-
* @returns - A `Promise` that resolves when all animations have completed.
|
|
1007
|
-
*
|
|
1008
|
-
* @public
|
|
1009
|
-
*/
|
|
1010
|
-
start(definition: ControlsAnimationDefinition, transitionOverride?: Transition): Promise<any>;
|
|
1011
|
-
/**
|
|
1012
|
-
* Instantly set to a set of properties or a variant.
|
|
1013
|
-
*
|
|
1014
|
-
* ```jsx
|
|
1015
|
-
* // With properties
|
|
1016
|
-
* controls.set({ opacity: 0 })
|
|
1017
|
-
*
|
|
1018
|
-
* // With variants
|
|
1019
|
-
* controls.set("hidden")
|
|
1020
|
-
* ```
|
|
1021
|
-
*
|
|
1022
|
-
* @privateRemarks
|
|
1023
|
-
* We could perform a similar trick to `.start` where this can be called before mount
|
|
1024
|
-
* and we maintain a list of of pending actions that get applied on mount. But the
|
|
1025
|
-
* expectation of `set` is that it happens synchronously and this would be difficult
|
|
1026
|
-
* to do before any children have even attached themselves. It's also poor practise
|
|
1027
|
-
* and we should discourage render-synchronous `.start` calls rather than lean into this.
|
|
1028
|
-
*
|
|
1029
|
-
* @public
|
|
1030
|
-
*/
|
|
1031
|
-
set(definition: ControlsAnimationDefinition): void;
|
|
1032
|
-
/**
|
|
1033
|
-
* Stops animations on all linked components.
|
|
1034
|
-
*
|
|
1035
|
-
* ```jsx
|
|
1036
|
-
* controls.stop()
|
|
1037
|
-
* ```
|
|
1038
|
-
*
|
|
1039
|
-
* @public
|
|
1040
|
-
*/
|
|
1041
|
-
stop(): void;
|
|
1042
|
-
mount(): () => void;
|
|
1043
|
-
}
|
|
855
|
+
declare type FrameData = {
|
|
856
|
+
delta: number;
|
|
857
|
+
timestamp: number;
|
|
858
|
+
};
|
|
859
|
+
declare type Process = (data: FrameData) => void;
|
|
1044
860
|
|
|
1045
861
|
interface Point {
|
|
1046
862
|
x: number;
|
|
@@ -1072,110 +888,29 @@ interface Delta {
|
|
|
1072
888
|
}
|
|
1073
889
|
declare type TransformPoint = (point: Point) => Point;
|
|
1074
890
|
|
|
891
|
+
declare type ReducedMotionConfig = "always" | "never" | "user";
|
|
1075
892
|
/**
|
|
1076
|
-
* Passed in to pan event handlers like `onPan` the `PanInfo` object contains
|
|
1077
|
-
* information about the current state of the tap gesture such as its
|
|
1078
|
-
* `point`, `delta`, `offset` and `velocity`.
|
|
1079
|
-
*
|
|
1080
|
-
* ```jsx
|
|
1081
|
-
* <motion.div onPan={(event, info) => {
|
|
1082
|
-
* console.log(info.point.x, info.point.y)
|
|
1083
|
-
* }} />
|
|
1084
|
-
* ```
|
|
1085
|
-
*
|
|
1086
893
|
* @public
|
|
1087
894
|
*/
|
|
1088
|
-
interface
|
|
895
|
+
interface MotionConfigContext {
|
|
1089
896
|
/**
|
|
1090
|
-
*
|
|
1091
|
-
* to the device or page.
|
|
1092
|
-
*
|
|
1093
|
-
* ```jsx
|
|
1094
|
-
* function onPan(event, info) {
|
|
1095
|
-
* console.log(info.point.x, info.point.y)
|
|
1096
|
-
* }
|
|
1097
|
-
*
|
|
1098
|
-
* <motion.div onPan={onPan} />
|
|
1099
|
-
* ```
|
|
1100
|
-
*
|
|
1101
|
-
* @public
|
|
897
|
+
* Internal, exported only for usage in Framer
|
|
1102
898
|
*/
|
|
1103
|
-
|
|
899
|
+
transformPagePoint: TransformPoint;
|
|
1104
900
|
/**
|
|
1105
|
-
*
|
|
1106
|
-
*
|
|
1107
|
-
*
|
|
1108
|
-
* ```jsx
|
|
1109
|
-
* function onPan(event, info) {
|
|
1110
|
-
* console.log(info.delta.x, info.delta.y)
|
|
1111
|
-
* }
|
|
1112
|
-
*
|
|
1113
|
-
* <motion.div onPan={onPan} />
|
|
1114
|
-
* ```
|
|
1115
|
-
*
|
|
1116
|
-
* @public
|
|
901
|
+
* Internal. Determines whether this is a static context ie the Framer canvas. If so,
|
|
902
|
+
* it'll disable all dynamic functionality.
|
|
1117
903
|
*/
|
|
1118
|
-
|
|
904
|
+
isStatic: boolean;
|
|
1119
905
|
/**
|
|
1120
|
-
*
|
|
1121
|
-
* the first pan event.
|
|
1122
|
-
*
|
|
1123
|
-
* ```jsx
|
|
1124
|
-
* function onPan(event, info) {
|
|
1125
|
-
* console.log(info.offset.x, info.offset.y)
|
|
1126
|
-
* }
|
|
1127
|
-
*
|
|
1128
|
-
* <motion.div onPan={onPan} />
|
|
1129
|
-
* ```
|
|
906
|
+
* Defines a new default transition for the entire tree.
|
|
1130
907
|
*
|
|
1131
908
|
* @public
|
|
1132
909
|
*/
|
|
1133
|
-
|
|
910
|
+
transition?: Transition;
|
|
1134
911
|
/**
|
|
1135
|
-
*
|
|
1136
|
-
*
|
|
1137
|
-
* ```jsx
|
|
1138
|
-
* function onPan(event, info) {
|
|
1139
|
-
* console.log(info.velocity.x, info.velocity.y)
|
|
1140
|
-
* }
|
|
1141
|
-
*
|
|
1142
|
-
* <motion.div onPan={onPan} />
|
|
1143
|
-
* ```
|
|
1144
|
-
*
|
|
1145
|
-
* @public
|
|
1146
|
-
*/
|
|
1147
|
-
velocity: Point;
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
declare type FrameData = {
|
|
1151
|
-
delta: number;
|
|
1152
|
-
timestamp: number;
|
|
1153
|
-
};
|
|
1154
|
-
declare type Process = (data: FrameData) => void;
|
|
1155
|
-
|
|
1156
|
-
declare type ReducedMotionConfig = "always" | "never" | "user";
|
|
1157
|
-
/**
|
|
1158
|
-
* @public
|
|
1159
|
-
*/
|
|
1160
|
-
interface MotionConfigContext {
|
|
1161
|
-
/**
|
|
1162
|
-
* Internal, exported only for usage in Framer
|
|
1163
|
-
*/
|
|
1164
|
-
transformPagePoint: TransformPoint;
|
|
1165
|
-
/**
|
|
1166
|
-
* Internal. Determines whether this is a static context ie the Framer canvas. If so,
|
|
1167
|
-
* it'll disable all dynamic functionality.
|
|
1168
|
-
*/
|
|
1169
|
-
isStatic: boolean;
|
|
1170
|
-
/**
|
|
1171
|
-
* Defines a new default transition for the entire tree.
|
|
1172
|
-
*
|
|
1173
|
-
* @public
|
|
1174
|
-
*/
|
|
1175
|
-
transition?: Transition;
|
|
1176
|
-
/**
|
|
1177
|
-
* If true, will respect the device prefersReducedMotion setting by switching
|
|
1178
|
-
* transform animations off.
|
|
912
|
+
* If true, will respect the device prefersReducedMotion setting by switching
|
|
913
|
+
* transform animations off.
|
|
1179
914
|
*
|
|
1180
915
|
* @public
|
|
1181
916
|
*/
|
|
@@ -1725,6 +1460,277 @@ declare abstract class VisualElement<Instance = unknown, RenderState = unknown,
|
|
|
1725
1460
|
notify<EventName extends keyof VisualElementEventCallbacks>(eventName: EventName, ...args: any): void;
|
|
1726
1461
|
}
|
|
1727
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
|
+
setWithVelocity(prev: V, current: V, delta: number): void;
|
|
1550
|
+
updateAndNotify: (v: V, render?: boolean) => void;
|
|
1551
|
+
/**
|
|
1552
|
+
* Returns the latest state of `MotionValue`
|
|
1553
|
+
*
|
|
1554
|
+
* @returns - The latest state of `MotionValue`
|
|
1555
|
+
*
|
|
1556
|
+
* @public
|
|
1557
|
+
*/
|
|
1558
|
+
get(): V;
|
|
1559
|
+
/**
|
|
1560
|
+
* @public
|
|
1561
|
+
*/
|
|
1562
|
+
getPrevious(): V;
|
|
1563
|
+
/**
|
|
1564
|
+
* Returns the latest velocity of `MotionValue`
|
|
1565
|
+
*
|
|
1566
|
+
* @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
|
|
1567
|
+
*
|
|
1568
|
+
* @public
|
|
1569
|
+
*/
|
|
1570
|
+
getVelocity(): number;
|
|
1571
|
+
hasAnimated: boolean;
|
|
1572
|
+
/**
|
|
1573
|
+
* Stop the currently active animation.
|
|
1574
|
+
*
|
|
1575
|
+
* @public
|
|
1576
|
+
*/
|
|
1577
|
+
stop(): void;
|
|
1578
|
+
/**
|
|
1579
|
+
* Returns `true` if this value is currently animating.
|
|
1580
|
+
*
|
|
1581
|
+
* @public
|
|
1582
|
+
*/
|
|
1583
|
+
isAnimating(): boolean;
|
|
1584
|
+
private clearAnimation;
|
|
1585
|
+
/**
|
|
1586
|
+
* Destroy and clean up subscribers to this `MotionValue`.
|
|
1587
|
+
*
|
|
1588
|
+
* The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
|
|
1589
|
+
* handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
|
|
1590
|
+
* created a `MotionValue` via the `motionValue` function.
|
|
1591
|
+
*
|
|
1592
|
+
* @public
|
|
1593
|
+
*/
|
|
1594
|
+
destroy(): void;
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
/**
|
|
1598
|
+
* @public
|
|
1599
|
+
*/
|
|
1600
|
+
declare type ControlsAnimationDefinition = string | string[] | TargetAndTransition | TargetResolver;
|
|
1601
|
+
/**
|
|
1602
|
+
* @public
|
|
1603
|
+
*/
|
|
1604
|
+
interface AnimationControls {
|
|
1605
|
+
/**
|
|
1606
|
+
* Starts an animation on all linked components.
|
|
1607
|
+
*
|
|
1608
|
+
* @remarks
|
|
1609
|
+
*
|
|
1610
|
+
* ```jsx
|
|
1611
|
+
* controls.start("variantLabel")
|
|
1612
|
+
* controls.start({
|
|
1613
|
+
* x: 0,
|
|
1614
|
+
* transition: { duration: 1 }
|
|
1615
|
+
* })
|
|
1616
|
+
* ```
|
|
1617
|
+
*
|
|
1618
|
+
* @param definition - Properties or variant label to animate to
|
|
1619
|
+
* @param transition - Optional `transtion` to apply to a variant
|
|
1620
|
+
* @returns - A `Promise` that resolves when all animations have completed.
|
|
1621
|
+
*
|
|
1622
|
+
* @public
|
|
1623
|
+
*/
|
|
1624
|
+
start(definition: ControlsAnimationDefinition, transitionOverride?: Transition): Promise<any>;
|
|
1625
|
+
/**
|
|
1626
|
+
* Instantly set to a set of properties or a variant.
|
|
1627
|
+
*
|
|
1628
|
+
* ```jsx
|
|
1629
|
+
* // With properties
|
|
1630
|
+
* controls.set({ opacity: 0 })
|
|
1631
|
+
*
|
|
1632
|
+
* // With variants
|
|
1633
|
+
* controls.set("hidden")
|
|
1634
|
+
* ```
|
|
1635
|
+
*
|
|
1636
|
+
* @privateRemarks
|
|
1637
|
+
* We could perform a similar trick to `.start` where this can be called before mount
|
|
1638
|
+
* and we maintain a list of of pending actions that get applied on mount. But the
|
|
1639
|
+
* expectation of `set` is that it happens synchronously and this would be difficult
|
|
1640
|
+
* to do before any children have even attached themselves. It's also poor practise
|
|
1641
|
+
* and we should discourage render-synchronous `.start` calls rather than lean into this.
|
|
1642
|
+
*
|
|
1643
|
+
* @public
|
|
1644
|
+
*/
|
|
1645
|
+
set(definition: ControlsAnimationDefinition): void;
|
|
1646
|
+
/**
|
|
1647
|
+
* Stops animations on all linked components.
|
|
1648
|
+
*
|
|
1649
|
+
* ```jsx
|
|
1650
|
+
* controls.stop()
|
|
1651
|
+
* ```
|
|
1652
|
+
*
|
|
1653
|
+
* @public
|
|
1654
|
+
*/
|
|
1655
|
+
stop(): void;
|
|
1656
|
+
mount(): () => void;
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
/**
|
|
1660
|
+
* Passed in to pan event handlers like `onPan` the `PanInfo` object contains
|
|
1661
|
+
* information about the current state of the tap gesture such as its
|
|
1662
|
+
* `point`, `delta`, `offset` and `velocity`.
|
|
1663
|
+
*
|
|
1664
|
+
* ```jsx
|
|
1665
|
+
* <motion.div onPan={(event, info) => {
|
|
1666
|
+
* console.log(info.point.x, info.point.y)
|
|
1667
|
+
* }} />
|
|
1668
|
+
* ```
|
|
1669
|
+
*
|
|
1670
|
+
* @public
|
|
1671
|
+
*/
|
|
1672
|
+
interface PanInfo {
|
|
1673
|
+
/**
|
|
1674
|
+
* Contains `x` and `y` values for the current pan position relative
|
|
1675
|
+
* to the device or page.
|
|
1676
|
+
*
|
|
1677
|
+
* ```jsx
|
|
1678
|
+
* function onPan(event, info) {
|
|
1679
|
+
* console.log(info.point.x, info.point.y)
|
|
1680
|
+
* }
|
|
1681
|
+
*
|
|
1682
|
+
* <motion.div onPan={onPan} />
|
|
1683
|
+
* ```
|
|
1684
|
+
*
|
|
1685
|
+
* @public
|
|
1686
|
+
*/
|
|
1687
|
+
point: Point;
|
|
1688
|
+
/**
|
|
1689
|
+
* Contains `x` and `y` values for the distance moved since
|
|
1690
|
+
* the last event.
|
|
1691
|
+
*
|
|
1692
|
+
* ```jsx
|
|
1693
|
+
* function onPan(event, info) {
|
|
1694
|
+
* console.log(info.delta.x, info.delta.y)
|
|
1695
|
+
* }
|
|
1696
|
+
*
|
|
1697
|
+
* <motion.div onPan={onPan} />
|
|
1698
|
+
* ```
|
|
1699
|
+
*
|
|
1700
|
+
* @public
|
|
1701
|
+
*/
|
|
1702
|
+
delta: Point;
|
|
1703
|
+
/**
|
|
1704
|
+
* Contains `x` and `y` values for the distance moved from
|
|
1705
|
+
* the first pan event.
|
|
1706
|
+
*
|
|
1707
|
+
* ```jsx
|
|
1708
|
+
* function onPan(event, info) {
|
|
1709
|
+
* console.log(info.offset.x, info.offset.y)
|
|
1710
|
+
* }
|
|
1711
|
+
*
|
|
1712
|
+
* <motion.div onPan={onPan} />
|
|
1713
|
+
* ```
|
|
1714
|
+
*
|
|
1715
|
+
* @public
|
|
1716
|
+
*/
|
|
1717
|
+
offset: Point;
|
|
1718
|
+
/**
|
|
1719
|
+
* Contains `x` and `y` values for the current velocity of the pointer, in px/ms.
|
|
1720
|
+
*
|
|
1721
|
+
* ```jsx
|
|
1722
|
+
* function onPan(event, info) {
|
|
1723
|
+
* console.log(info.velocity.x, info.velocity.y)
|
|
1724
|
+
* }
|
|
1725
|
+
*
|
|
1726
|
+
* <motion.div onPan={onPan} />
|
|
1727
|
+
* ```
|
|
1728
|
+
*
|
|
1729
|
+
* @public
|
|
1730
|
+
*/
|
|
1731
|
+
velocity: Point;
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1728
1734
|
interface DragControlOptions {
|
|
1729
1735
|
snapToCursor?: boolean;
|
|
1730
1736
|
cursorProgress?: Point;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "framer-motion",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.9.0",
|
|
4
4
|
"description": "A simple and powerful React animation library",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/es/index.mjs",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"clean": "rm -rf types dist lib",
|
|
40
40
|
"test": "yarn test-server && yarn test-client",
|
|
41
41
|
"test-ci": "yarn test",
|
|
42
|
-
"test-client": "jest --config jest.config.json --max-workers=2",
|
|
42
|
+
"test-client": "jest --config jest.config.json --max-workers=2 src/motion/__tests__/waapi.test.tsx",
|
|
43
43
|
"test-server": "jest --config jest.config.ssr.json ",
|
|
44
44
|
"test-watch": "jest --watch --coverage --coverageReporters=lcov --config jest.config.json",
|
|
45
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/'",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"bundlesize": [
|
|
73
73
|
{
|
|
74
74
|
"path": "./dist/size-rollup-motion.js",
|
|
75
|
-
"maxSize": "
|
|
75
|
+
"maxSize": "29.5 kB"
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
"path": "./dist/size-rollup-m.js",
|
|
@@ -80,11 +80,11 @@
|
|
|
80
80
|
},
|
|
81
81
|
{
|
|
82
82
|
"path": "./dist/size-rollup-dom-animation.js",
|
|
83
|
-
"maxSize": "14.
|
|
83
|
+
"maxSize": "14.65kB"
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
86
|
"path": "./dist/size-rollup-dom-max.js",
|
|
87
|
-
"maxSize": "
|
|
87
|
+
"maxSize": "25.4 kB"
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
90
|
"path": "./dist/size-webpack-m.js",
|
|
@@ -92,12 +92,12 @@
|
|
|
92
92
|
},
|
|
93
93
|
{
|
|
94
94
|
"path": "./dist/size-webpack-dom-animation.js",
|
|
95
|
-
"maxSize": "18.
|
|
95
|
+
"maxSize": "18.85 kB"
|
|
96
96
|
},
|
|
97
97
|
{
|
|
98
98
|
"path": "./dist/size-webpack-dom-max.js",
|
|
99
|
-
"maxSize": "
|
|
99
|
+
"maxSize": "30.5kB"
|
|
100
100
|
}
|
|
101
101
|
],
|
|
102
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "eb9d9a9df5f911a5906c05df56dcc47207100bbc"
|
|
103
103
|
}
|