framer-motion 12.17.2 → 12.18.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/dist/cjs/dom-mini.js +4 -1
- package/dist/cjs/dom.js +4 -1
- package/dist/cjs/index.js +6 -3
- package/dist/dom-mini.d.ts +1 -3
- package/dist/dom-mini.js +1 -1
- package/dist/dom.d.ts +8 -10
- package/dist/dom.js +1 -1
- package/dist/es/animation/hooks/use-animated-state.mjs +1 -1
- package/dist/es/animation/hooks/use-animation.mjs +3 -3
- package/dist/es/animation/sequence/create.mjs +1 -1
- package/dist/es/animation/sequence/utils/calc-time.mjs +3 -0
- package/dist/framer-motion.dev.js +6 -3
- package/dist/framer-motion.js +1 -1
- package/dist/m.d.ts +5 -1877
- package/dist/size-rollup-animate.js +1 -1
- package/dist/types/client.d.ts +2 -2
- package/dist/types/index.d.ts +98 -24
- package/dist/types.d-B_QPEvFK.d.ts +941 -0
- package/package.json +3 -3
- package/dist/types.d-CtuPurYT.d.ts +0 -2851
|
@@ -1,2851 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import * as React$1 from 'react';
|
|
3
|
-
import { SVGAttributes, CSSProperties, PropsWithoutRef, RefAttributes, JSX } from 'react';
|
|
4
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
-
import { TransformProperties, SVGPathProperties, VariableKeyframesDefinition, MotionValue, JSAnimation, KeyframeResolver, OnKeyframesResolved, Transition as Transition$1, Batcher } from 'motion-dom';
|
|
6
|
-
import { Easing, Point, TransformPoint, Box, Axis, Delta, BoundingBox } from 'motion-utils';
|
|
7
|
-
|
|
8
|
-
type GenericKeyframesTarget<V> = V[] | Array<null | V>;
|
|
9
|
-
/**
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
type ResolvedKeyframesTarget = GenericKeyframesTarget<number> | GenericKeyframesTarget<string>;
|
|
13
|
-
/**
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
type KeyframesTarget = ResolvedKeyframesTarget;
|
|
17
|
-
/**
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
type ResolvedSingleTarget = string | number;
|
|
21
|
-
/**
|
|
22
|
-
* @public
|
|
23
|
-
*/
|
|
24
|
-
type SingleTarget = ResolvedSingleTarget;
|
|
25
|
-
/**
|
|
26
|
-
* @public
|
|
27
|
-
*/
|
|
28
|
-
type ResolvedValueTarget = ResolvedSingleTarget | ResolvedKeyframesTarget;
|
|
29
|
-
/**
|
|
30
|
-
* @public
|
|
31
|
-
*/
|
|
32
|
-
type ValueTarget = SingleTarget | KeyframesTarget;
|
|
33
|
-
/**
|
|
34
|
-
* Options for orchestrating the timing of animations.
|
|
35
|
-
*
|
|
36
|
-
* @public
|
|
37
|
-
*/
|
|
38
|
-
interface Orchestration {
|
|
39
|
-
/**
|
|
40
|
-
* Delay the animation by this duration (in seconds). Defaults to `0`.
|
|
41
|
-
*
|
|
42
|
-
* @remarks
|
|
43
|
-
* ```javascript
|
|
44
|
-
* const transition = {
|
|
45
|
-
* delay: 0.2
|
|
46
|
-
* }
|
|
47
|
-
* ```
|
|
48
|
-
*
|
|
49
|
-
* @public
|
|
50
|
-
*/
|
|
51
|
-
delay?: number;
|
|
52
|
-
/**
|
|
53
|
-
* Describes the relationship between the transition and its children. Set
|
|
54
|
-
* to `false` by default.
|
|
55
|
-
*
|
|
56
|
-
* @remarks
|
|
57
|
-
* When using variants, the transition can be scheduled in relation to its
|
|
58
|
-
* children with either `"beforeChildren"` to finish this transition before
|
|
59
|
-
* starting children transitions, `"afterChildren"` to finish children
|
|
60
|
-
* transitions before starting this transition.
|
|
61
|
-
*
|
|
62
|
-
* ```jsx
|
|
63
|
-
* const list = {
|
|
64
|
-
* hidden: {
|
|
65
|
-
* opacity: 0,
|
|
66
|
-
* transition: { when: "afterChildren" }
|
|
67
|
-
* }
|
|
68
|
-
* }
|
|
69
|
-
*
|
|
70
|
-
* const item = {
|
|
71
|
-
* hidden: {
|
|
72
|
-
* opacity: 0,
|
|
73
|
-
* transition: { duration: 2 }
|
|
74
|
-
* }
|
|
75
|
-
* }
|
|
76
|
-
*
|
|
77
|
-
* return (
|
|
78
|
-
* <motion.ul variants={list} animate="hidden">
|
|
79
|
-
* <motion.li variants={item} />
|
|
80
|
-
* <motion.li variants={item} />
|
|
81
|
-
* </motion.ul>
|
|
82
|
-
* )
|
|
83
|
-
* ```
|
|
84
|
-
*
|
|
85
|
-
* @public
|
|
86
|
-
*/
|
|
87
|
-
when?: false | "beforeChildren" | "afterChildren" | string;
|
|
88
|
-
/**
|
|
89
|
-
* When using variants, children animations will start after this duration
|
|
90
|
-
* (in seconds). You can add the `transition` property to both the `Frame` and the `variant` directly. Adding it to the `variant` generally offers more flexibility, as it allows you to customize the delay per visual state.
|
|
91
|
-
*
|
|
92
|
-
* ```jsx
|
|
93
|
-
* const container = {
|
|
94
|
-
* hidden: { opacity: 0 },
|
|
95
|
-
* show: {
|
|
96
|
-
* opacity: 1,
|
|
97
|
-
* transition: {
|
|
98
|
-
* delayChildren: 0.5
|
|
99
|
-
* }
|
|
100
|
-
* }
|
|
101
|
-
* }
|
|
102
|
-
*
|
|
103
|
-
* const item = {
|
|
104
|
-
* hidden: { opacity: 0 },
|
|
105
|
-
* show: { opacity: 1 }
|
|
106
|
-
* }
|
|
107
|
-
*
|
|
108
|
-
* return (
|
|
109
|
-
* <motion.ul
|
|
110
|
-
* variants={container}
|
|
111
|
-
* initial="hidden"
|
|
112
|
-
* animate="show"
|
|
113
|
-
* >
|
|
114
|
-
* <motion.li variants={item} />
|
|
115
|
-
* <motion.li variants={item} />
|
|
116
|
-
* </motion.ul>
|
|
117
|
-
* )
|
|
118
|
-
* ```
|
|
119
|
-
*
|
|
120
|
-
* @public
|
|
121
|
-
*/
|
|
122
|
-
delayChildren?: number;
|
|
123
|
-
/**
|
|
124
|
-
* When using variants, animations of child components can be staggered by this
|
|
125
|
-
* duration (in seconds).
|
|
126
|
-
*
|
|
127
|
-
* For instance, if `staggerChildren` is `0.01`, the first child will be
|
|
128
|
-
* delayed by `0` seconds, the second by `0.01`, the third by `0.02` and so
|
|
129
|
-
* on.
|
|
130
|
-
*
|
|
131
|
-
* The calculated stagger delay will be added to `delayChildren`.
|
|
132
|
-
*
|
|
133
|
-
* ```jsx
|
|
134
|
-
* const container = {
|
|
135
|
-
* hidden: { opacity: 0 },
|
|
136
|
-
* show: {
|
|
137
|
-
* opacity: 1,
|
|
138
|
-
* transition: {
|
|
139
|
-
* staggerChildren: 0.5
|
|
140
|
-
* }
|
|
141
|
-
* }
|
|
142
|
-
* }
|
|
143
|
-
*
|
|
144
|
-
* const item = {
|
|
145
|
-
* hidden: { opacity: 0 },
|
|
146
|
-
* show: { opacity: 1 }
|
|
147
|
-
* }
|
|
148
|
-
*
|
|
149
|
-
* return (
|
|
150
|
-
* <motion.ol
|
|
151
|
-
* variants={container}
|
|
152
|
-
* initial="hidden"
|
|
153
|
-
* animate="show"
|
|
154
|
-
* >
|
|
155
|
-
* <motion.li variants={item} />
|
|
156
|
-
* <motion.li variants={item} />
|
|
157
|
-
* </motion.ol>
|
|
158
|
-
* )
|
|
159
|
-
* ```
|
|
160
|
-
*
|
|
161
|
-
* @public
|
|
162
|
-
*/
|
|
163
|
-
staggerChildren?: number;
|
|
164
|
-
/**
|
|
165
|
-
* The direction in which to stagger children.
|
|
166
|
-
*
|
|
167
|
-
* A value of `1` staggers from the first to the last while `-1`
|
|
168
|
-
* staggers from the last to the first.
|
|
169
|
-
*
|
|
170
|
-
* ```jsx
|
|
171
|
-
* const container = {
|
|
172
|
-
* hidden: { opacity: 0 },
|
|
173
|
-
* show: {
|
|
174
|
-
* opacity: 1,
|
|
175
|
-
* transition: {
|
|
176
|
-
* staggerChildren: 0.5,
|
|
177
|
-
* staggerDirection: -1
|
|
178
|
-
* }
|
|
179
|
-
* }
|
|
180
|
-
* }
|
|
181
|
-
*
|
|
182
|
-
* const item = {
|
|
183
|
-
* hidden: { opacity: 0 },
|
|
184
|
-
* show: { opacity: 1 }
|
|
185
|
-
* }
|
|
186
|
-
*
|
|
187
|
-
* return (
|
|
188
|
-
* <motion.ul
|
|
189
|
-
* variants={container}
|
|
190
|
-
* initial="hidden"
|
|
191
|
-
* animate="show"
|
|
192
|
-
* >
|
|
193
|
-
* <motion.li variants={item} size={50} />
|
|
194
|
-
* <motion.li variants={item} size={50} />
|
|
195
|
-
* </motion.ul>
|
|
196
|
-
* )
|
|
197
|
-
* ```
|
|
198
|
-
*
|
|
199
|
-
* @public
|
|
200
|
-
*/
|
|
201
|
-
staggerDirection?: number;
|
|
202
|
-
}
|
|
203
|
-
interface Repeat {
|
|
204
|
-
/**
|
|
205
|
-
* The number of times to repeat the transition. Set to `Infinity` for perpetual repeating.
|
|
206
|
-
*
|
|
207
|
-
* Without setting `repeatType`, this will loop the animation.
|
|
208
|
-
*
|
|
209
|
-
* ```jsx
|
|
210
|
-
* <motion.div
|
|
211
|
-
* animate={{ rotate: 180 }}
|
|
212
|
-
* transition={{ repeat: Infinity, duration: 2 }}
|
|
213
|
-
* />
|
|
214
|
-
* ```
|
|
215
|
-
*
|
|
216
|
-
* @public
|
|
217
|
-
*/
|
|
218
|
-
repeat?: number;
|
|
219
|
-
/**
|
|
220
|
-
* How to repeat the animation. This can be either:
|
|
221
|
-
*
|
|
222
|
-
* "loop": Repeats the animation from the start
|
|
223
|
-
*
|
|
224
|
-
* "reverse": Alternates between forward and backwards playback
|
|
225
|
-
*
|
|
226
|
-
* "mirror": Switches `from` and `to` alternately
|
|
227
|
-
*
|
|
228
|
-
* ```jsx
|
|
229
|
-
* <motion.div
|
|
230
|
-
* animate={{ rotate: 180 }}
|
|
231
|
-
* transition={{
|
|
232
|
-
* repeat: 1,
|
|
233
|
-
* repeatType: "reverse",
|
|
234
|
-
* duration: 2
|
|
235
|
-
* }}
|
|
236
|
-
* />
|
|
237
|
-
* ```
|
|
238
|
-
*
|
|
239
|
-
* @public
|
|
240
|
-
*/
|
|
241
|
-
repeatType?: "loop" | "reverse" | "mirror";
|
|
242
|
-
/**
|
|
243
|
-
* When repeating an animation, `repeatDelay` will set the
|
|
244
|
-
* duration of the time to wait, in seconds, between each repetition.
|
|
245
|
-
*
|
|
246
|
-
* ```jsx
|
|
247
|
-
* <motion.div
|
|
248
|
-
* animate={{ rotate: 180 }}
|
|
249
|
-
* transition={{ repeat: Infinity, repeatDelay: 1 }}
|
|
250
|
-
* />
|
|
251
|
-
* ```
|
|
252
|
-
*
|
|
253
|
-
* @public
|
|
254
|
-
*/
|
|
255
|
-
repeatDelay?: number;
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* An animation that animates between two or more values over a specific duration of time.
|
|
259
|
-
* This is the default animation for non-physical values like `color` and `opacity`.
|
|
260
|
-
*
|
|
261
|
-
* @public
|
|
262
|
-
*/
|
|
263
|
-
interface Tween extends Repeat {
|
|
264
|
-
/**
|
|
265
|
-
* Set `type` to `"tween"` to use a duration-based tween animation.
|
|
266
|
-
* If any non-orchestration `transition` values are set without a `type` property,
|
|
267
|
-
* this is used as the default animation.
|
|
268
|
-
*
|
|
269
|
-
* ```jsx
|
|
270
|
-
* <motion.path
|
|
271
|
-
* animate={{ pathLength: 1 }}
|
|
272
|
-
* transition={{ duration: 2, type: "tween" }}
|
|
273
|
-
* />
|
|
274
|
-
* ```
|
|
275
|
-
*
|
|
276
|
-
* @public
|
|
277
|
-
*/
|
|
278
|
-
type?: "tween";
|
|
279
|
-
/**
|
|
280
|
-
* The duration of the tween animation. Set to `0.3` by default, 0r `0.8` if animating a series of keyframes.
|
|
281
|
-
*
|
|
282
|
-
* ```jsx
|
|
283
|
-
* const variants = {
|
|
284
|
-
* visible: {
|
|
285
|
-
* opacity: 1,
|
|
286
|
-
* transition: { duration: 2 }
|
|
287
|
-
* }
|
|
288
|
-
* }
|
|
289
|
-
* ```
|
|
290
|
-
*
|
|
291
|
-
* @public
|
|
292
|
-
*/
|
|
293
|
-
duration?: number;
|
|
294
|
-
/**
|
|
295
|
-
* The easing function to use. Set as one of the below.
|
|
296
|
-
*
|
|
297
|
-
* - The name of an existing easing function.
|
|
298
|
-
*
|
|
299
|
-
* - An array of four numbers to define a cubic bezier curve.
|
|
300
|
-
*
|
|
301
|
-
* - An easing function, that accepts and returns a value `0-1`.
|
|
302
|
-
*
|
|
303
|
-
* If the animating value is set as an array of multiple values for a keyframes
|
|
304
|
-
* animation, `ease` can be set as an array of easing functions to set different easings between
|
|
305
|
-
* each of those values.
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
* ```jsx
|
|
309
|
-
* <motion.div
|
|
310
|
-
* animate={{ opacity: 0 }}
|
|
311
|
-
* transition={{ ease: [0.17, 0.67, 0.83, 0.67] }}
|
|
312
|
-
* />
|
|
313
|
-
* ```
|
|
314
|
-
*
|
|
315
|
-
* @public
|
|
316
|
-
*/
|
|
317
|
-
ease?: Easing | Easing[];
|
|
318
|
-
/**
|
|
319
|
-
* When animating keyframes, `times` can be used to determine where in the animation each keyframe is reached.
|
|
320
|
-
* Each value in `times` is a value between `0` and `1`, representing `duration`.
|
|
321
|
-
*
|
|
322
|
-
* There must be the same number of `times` as there are keyframes.
|
|
323
|
-
* Defaults to an array of evenly-spread durations.
|
|
324
|
-
*
|
|
325
|
-
* ```jsx
|
|
326
|
-
* <motion.div
|
|
327
|
-
* animate={{ scale: [0, 1, 0.5, 1] }}
|
|
328
|
-
* transition={{ times: [0, 0.1, 0.9, 1] }}
|
|
329
|
-
* />
|
|
330
|
-
* ```
|
|
331
|
-
*
|
|
332
|
-
* @public
|
|
333
|
-
*/
|
|
334
|
-
times?: number[];
|
|
335
|
-
/**
|
|
336
|
-
* When animating keyframes, `easings` can be used to define easing functions between each keyframe. This array should be one item fewer than the number of keyframes, as these easings apply to the transitions between the keyframes.
|
|
337
|
-
*
|
|
338
|
-
* ```jsx
|
|
339
|
-
* <motion.div
|
|
340
|
-
* animate={{ backgroundColor: ["#0f0", "#00f", "#f00"] }}
|
|
341
|
-
* transition={{ easings: ["easeIn", "easeOut"] }}
|
|
342
|
-
* />
|
|
343
|
-
* ```
|
|
344
|
-
*
|
|
345
|
-
* @public
|
|
346
|
-
*/
|
|
347
|
-
easings?: Easing[];
|
|
348
|
-
/**
|
|
349
|
-
* The value to animate from.
|
|
350
|
-
* By default, this is the current state of the animating value.
|
|
351
|
-
*
|
|
352
|
-
* ```jsx
|
|
353
|
-
* <motion.div
|
|
354
|
-
* animate={{ rotate: 180 }}
|
|
355
|
-
* transition={{ from: 90, duration: 2 }}
|
|
356
|
-
* />
|
|
357
|
-
* ```
|
|
358
|
-
*
|
|
359
|
-
* @public
|
|
360
|
-
*/
|
|
361
|
-
from?: number | string;
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* An animation that simulates spring physics for realistic motion.
|
|
365
|
-
* This is the default animation for physical values like `x`, `y`, `scale` and `rotate`.
|
|
366
|
-
*
|
|
367
|
-
* @public
|
|
368
|
-
*/
|
|
369
|
-
interface Spring extends Repeat {
|
|
370
|
-
/**
|
|
371
|
-
* Set `type` to `"spring"` to animate using spring physics for natural
|
|
372
|
-
* movement. Type is set to `"spring"` by default.
|
|
373
|
-
*
|
|
374
|
-
* ```jsx
|
|
375
|
-
* <motion.div
|
|
376
|
-
* animate={{ rotate: 180 }}
|
|
377
|
-
* transition={{ type: 'spring' }}
|
|
378
|
-
* />
|
|
379
|
-
* ```
|
|
380
|
-
*
|
|
381
|
-
* @public
|
|
382
|
-
*/
|
|
383
|
-
type: "spring";
|
|
384
|
-
/**
|
|
385
|
-
* Stiffness of the spring. Higher values will create more sudden movement.
|
|
386
|
-
* Set to `100` by default.
|
|
387
|
-
*
|
|
388
|
-
* ```jsx
|
|
389
|
-
* <motion.section
|
|
390
|
-
* animate={{ rotate: 180 }}
|
|
391
|
-
* transition={{ type: 'spring', stiffness: 50 }}
|
|
392
|
-
* />
|
|
393
|
-
* ```
|
|
394
|
-
*
|
|
395
|
-
* @public
|
|
396
|
-
*/
|
|
397
|
-
stiffness?: number;
|
|
398
|
-
/**
|
|
399
|
-
* Strength of opposing force. If set to 0, spring will oscillate
|
|
400
|
-
* indefinitely. Set to `10` by default.
|
|
401
|
-
*
|
|
402
|
-
* ```jsx
|
|
403
|
-
* <motion.a
|
|
404
|
-
* animate={{ rotate: 180 }}
|
|
405
|
-
* transition={{ type: 'spring', damping: 300 }}
|
|
406
|
-
* />
|
|
407
|
-
* ```
|
|
408
|
-
*
|
|
409
|
-
* @public
|
|
410
|
-
*/
|
|
411
|
-
damping?: number;
|
|
412
|
-
/**
|
|
413
|
-
* Mass of the moving object. Higher values will result in more lethargic
|
|
414
|
-
* movement. Set to `1` by default.
|
|
415
|
-
*
|
|
416
|
-
* ```jsx
|
|
417
|
-
* <motion.feTurbulence
|
|
418
|
-
* animate={{ baseFrequency: 0.5 } as any}
|
|
419
|
-
* transition={{ type: "spring", mass: 0.5 }}
|
|
420
|
-
* />
|
|
421
|
-
* ```
|
|
422
|
-
*
|
|
423
|
-
* @public
|
|
424
|
-
*/
|
|
425
|
-
mass?: number;
|
|
426
|
-
/**
|
|
427
|
-
* The duration of the animation, defined in seconds. Spring animations can be a maximum of 10 seconds.
|
|
428
|
-
*
|
|
429
|
-
* If `bounce` is set, this defaults to `0.8`.
|
|
430
|
-
*
|
|
431
|
-
* Note: `duration` and `bounce` will be overridden if `stiffness`, `damping` or `mass` are set.
|
|
432
|
-
*
|
|
433
|
-
* ```jsx
|
|
434
|
-
* <motion.div
|
|
435
|
-
* animate={{ x: 100 }}
|
|
436
|
-
* transition={{ type: "spring", duration: 0.8 }}
|
|
437
|
-
* />
|
|
438
|
-
* ```
|
|
439
|
-
*
|
|
440
|
-
* @public
|
|
441
|
-
*/
|
|
442
|
-
duration?: number;
|
|
443
|
-
/**
|
|
444
|
-
* If visualDuration is set, this will override duration.
|
|
445
|
-
*
|
|
446
|
-
* The visual duration is a time, set in seconds, that the animation will take to visually appear to reach its target.
|
|
447
|
-
*
|
|
448
|
-
* In other words, the bulk of the transition will occur before this time, and the "bouncy bit" will mostly happen after.
|
|
449
|
-
*
|
|
450
|
-
* This makes it easier to edit a spring, as well as visually coordinate it with other time-based animations.
|
|
451
|
-
*
|
|
452
|
-
* ```jsx
|
|
453
|
-
* <motion.div
|
|
454
|
-
* animate={{ x: 100 }}
|
|
455
|
-
* transition={{ type: "spring", visualDuration: 0.5 }}
|
|
456
|
-
* />
|
|
457
|
-
* ```
|
|
458
|
-
*
|
|
459
|
-
* @public
|
|
460
|
-
*/
|
|
461
|
-
visualDuration?: number;
|
|
462
|
-
/**
|
|
463
|
-
* `bounce` determines the "bounciness" of a spring animation.
|
|
464
|
-
*
|
|
465
|
-
* `0` is no bounce, and `1` is extremely bouncy.
|
|
466
|
-
*
|
|
467
|
-
* If `duration` is set, this defaults to `0.25`.
|
|
468
|
-
*
|
|
469
|
-
* Note: `bounce` and `duration` will be overridden if `stiffness`, `damping` or `mass` are set.
|
|
470
|
-
*
|
|
471
|
-
* ```jsx
|
|
472
|
-
* <motion.div
|
|
473
|
-
* animate={{ x: 100 }}
|
|
474
|
-
* transition={{ type: "spring", bounce: 0.25 }}
|
|
475
|
-
* />
|
|
476
|
-
* ```
|
|
477
|
-
*
|
|
478
|
-
* @public
|
|
479
|
-
*/
|
|
480
|
-
bounce?: number;
|
|
481
|
-
/**
|
|
482
|
-
* End animation if absolute speed (in units per second) drops below this
|
|
483
|
-
* value and delta is smaller than `restDelta`. Set to `0.01` by default.
|
|
484
|
-
*
|
|
485
|
-
* ```jsx
|
|
486
|
-
* <motion.div
|
|
487
|
-
* animate={{ rotate: 180 }}
|
|
488
|
-
* transition={{ type: 'spring', restSpeed: 0.5 }}
|
|
489
|
-
* />
|
|
490
|
-
* ```
|
|
491
|
-
*
|
|
492
|
-
* @public
|
|
493
|
-
*/
|
|
494
|
-
restSpeed?: number;
|
|
495
|
-
/**
|
|
496
|
-
* End animation if distance is below this value and speed is below
|
|
497
|
-
* `restSpeed`. When animation ends, spring gets “snapped” to. Set to
|
|
498
|
-
* `0.01` by default.
|
|
499
|
-
*
|
|
500
|
-
* ```jsx
|
|
501
|
-
* <motion.div
|
|
502
|
-
* animate={{ rotate: 180 }}
|
|
503
|
-
* transition={{ type: 'spring', restDelta: 0.5 }}
|
|
504
|
-
* />
|
|
505
|
-
* ```
|
|
506
|
-
*
|
|
507
|
-
* @public
|
|
508
|
-
*/
|
|
509
|
-
restDelta?: number;
|
|
510
|
-
/**
|
|
511
|
-
* The value to animate from.
|
|
512
|
-
* By default, this is the initial state of the animating value.
|
|
513
|
-
*
|
|
514
|
-
* ```jsx
|
|
515
|
-
* <motion.div
|
|
516
|
-
* animate={{ rotate: 180 }}
|
|
517
|
-
* transition={{ type: 'spring', from: 90 }}
|
|
518
|
-
* />
|
|
519
|
-
* ```
|
|
520
|
-
*
|
|
521
|
-
* @public
|
|
522
|
-
*/
|
|
523
|
-
from?: number | string;
|
|
524
|
-
/**
|
|
525
|
-
* The initial velocity of the spring. By default this is the current velocity of the component.
|
|
526
|
-
*
|
|
527
|
-
* ```jsx
|
|
528
|
-
* <motion.div
|
|
529
|
-
* animate={{ rotate: 180 }}
|
|
530
|
-
* transition={{ type: 'spring', velocity: 2 }}
|
|
531
|
-
* />
|
|
532
|
-
* ```
|
|
533
|
-
*
|
|
534
|
-
* @public
|
|
535
|
-
*/
|
|
536
|
-
velocity?: number;
|
|
537
|
-
}
|
|
538
|
-
/**
|
|
539
|
-
* An animation that decelerates a value based on its initial velocity,
|
|
540
|
-
* usually used to implement inertial scrolling.
|
|
541
|
-
*
|
|
542
|
-
* Optionally, `min` and `max` boundaries can be defined, and inertia
|
|
543
|
-
* will snap to these with a spring animation.
|
|
544
|
-
*
|
|
545
|
-
* This animation will automatically precalculate a target value,
|
|
546
|
-
* which can be modified with the `modifyTarget` property.
|
|
547
|
-
*
|
|
548
|
-
* This allows you to add snap-to-grid or similar functionality.
|
|
549
|
-
*
|
|
550
|
-
* Inertia is also the animation used for `dragTransition`, and can be configured via that prop.
|
|
551
|
-
*
|
|
552
|
-
* @public
|
|
553
|
-
*/
|
|
554
|
-
interface Inertia {
|
|
555
|
-
/**
|
|
556
|
-
* Set `type` to animate using the inertia animation. Set to `"tween"` by
|
|
557
|
-
* default. This can be used for natural deceleration, like momentum scrolling.
|
|
558
|
-
*
|
|
559
|
-
* ```jsx
|
|
560
|
-
* <motion.div
|
|
561
|
-
* animate={{ rotate: 180 }}
|
|
562
|
-
* transition={{ type: "inertia", velocity: 50 }}
|
|
563
|
-
* />
|
|
564
|
-
* ```
|
|
565
|
-
*
|
|
566
|
-
* @public
|
|
567
|
-
*/
|
|
568
|
-
type: "inertia";
|
|
569
|
-
/**
|
|
570
|
-
* A function that receives the automatically-calculated target and returns a new one. Useful for snapping the target to a grid.
|
|
571
|
-
*
|
|
572
|
-
* ```jsx
|
|
573
|
-
* <motion.div
|
|
574
|
-
* drag
|
|
575
|
-
* dragTransition={{
|
|
576
|
-
* power: 0,
|
|
577
|
-
* // Snap calculated target to nearest 50 pixels
|
|
578
|
-
* modifyTarget: target => Math.round(target / 50) * 50
|
|
579
|
-
* }}
|
|
580
|
-
* />
|
|
581
|
-
* ```
|
|
582
|
-
*
|
|
583
|
-
* @public
|
|
584
|
-
*/
|
|
585
|
-
modifyTarget?(v: number): number;
|
|
586
|
-
/**
|
|
587
|
-
* If `min` or `max` is set, this affects the stiffness of the bounce
|
|
588
|
-
* spring. Higher values will create more sudden movement. Set to `500` by
|
|
589
|
-
* default.
|
|
590
|
-
*
|
|
591
|
-
* ```jsx
|
|
592
|
-
* <motion.div
|
|
593
|
-
* drag
|
|
594
|
-
* dragTransition={{
|
|
595
|
-
* min: 0,
|
|
596
|
-
* max: 100,
|
|
597
|
-
* bounceStiffness: 100
|
|
598
|
-
* }}
|
|
599
|
-
* />
|
|
600
|
-
* ```
|
|
601
|
-
*
|
|
602
|
-
* @public
|
|
603
|
-
*/
|
|
604
|
-
bounceStiffness?: number;
|
|
605
|
-
/**
|
|
606
|
-
* If `min` or `max` is set, this affects the damping of the bounce spring.
|
|
607
|
-
* If set to `0`, spring will oscillate indefinitely. Set to `10` by
|
|
608
|
-
* default.
|
|
609
|
-
*
|
|
610
|
-
* ```jsx
|
|
611
|
-
* <motion.div
|
|
612
|
-
* drag
|
|
613
|
-
* dragTransition={{
|
|
614
|
-
* min: 0,
|
|
615
|
-
* max: 100,
|
|
616
|
-
* bounceDamping: 8
|
|
617
|
-
* }}
|
|
618
|
-
* />
|
|
619
|
-
* ```
|
|
620
|
-
*
|
|
621
|
-
* @public
|
|
622
|
-
*/
|
|
623
|
-
bounceDamping?: number;
|
|
624
|
-
/**
|
|
625
|
-
* A higher power value equals a further target. Set to `0.8` by default.
|
|
626
|
-
*
|
|
627
|
-
* ```jsx
|
|
628
|
-
* <motion.div
|
|
629
|
-
* drag
|
|
630
|
-
* dragTransition={{ power: 0.2 }}
|
|
631
|
-
* />
|
|
632
|
-
* ```
|
|
633
|
-
*
|
|
634
|
-
* @public
|
|
635
|
-
*/
|
|
636
|
-
power?: number;
|
|
637
|
-
/**
|
|
638
|
-
* Adjusting the time constant will change the duration of the
|
|
639
|
-
* deceleration, thereby affecting its feel. Set to `700` by default.
|
|
640
|
-
*
|
|
641
|
-
* ```jsx
|
|
642
|
-
* <motion.div
|
|
643
|
-
* drag
|
|
644
|
-
* dragTransition={{ timeConstant: 200 }}
|
|
645
|
-
* />
|
|
646
|
-
* ```
|
|
647
|
-
*
|
|
648
|
-
* @public
|
|
649
|
-
*/
|
|
650
|
-
timeConstant?: number;
|
|
651
|
-
/**
|
|
652
|
-
* End the animation if the distance to the animation target is below this value, and the absolute speed is below `restSpeed`.
|
|
653
|
-
* When the animation ends, the value gets snapped to the animation target. Set to `0.01` by default.
|
|
654
|
-
* Generally the default values provide smooth animation endings, only in rare cases should you need to customize these.
|
|
655
|
-
*
|
|
656
|
-
* ```jsx
|
|
657
|
-
* <motion.div
|
|
658
|
-
* drag
|
|
659
|
-
* dragTransition={{ restDelta: 10 }}
|
|
660
|
-
* />
|
|
661
|
-
* ```
|
|
662
|
-
*
|
|
663
|
-
* @public
|
|
664
|
-
*/
|
|
665
|
-
restDelta?: number;
|
|
666
|
-
/**
|
|
667
|
-
* Minimum constraint. If set, the value will "bump" against this value (or immediately spring to it if the animation starts as less than this value).
|
|
668
|
-
*
|
|
669
|
-
* ```jsx
|
|
670
|
-
* <motion.div
|
|
671
|
-
* drag
|
|
672
|
-
* dragTransition={{ min: 0, max: 100 }}
|
|
673
|
-
* />
|
|
674
|
-
* ```
|
|
675
|
-
*
|
|
676
|
-
* @public
|
|
677
|
-
*/
|
|
678
|
-
min?: number;
|
|
679
|
-
/**
|
|
680
|
-
* Maximum constraint. If set, the value will "bump" against this value (or immediately snap to it, if the initial animation value exceeds this value).
|
|
681
|
-
*
|
|
682
|
-
* ```jsx
|
|
683
|
-
* <motion.div
|
|
684
|
-
* drag
|
|
685
|
-
* dragTransition={{ min: 0, max: 100 }}
|
|
686
|
-
* />
|
|
687
|
-
* ```
|
|
688
|
-
*
|
|
689
|
-
* @public
|
|
690
|
-
*/
|
|
691
|
-
max?: number;
|
|
692
|
-
/**
|
|
693
|
-
* The value to animate from. By default, this is the current state of the animating value.
|
|
694
|
-
*
|
|
695
|
-
* ```jsx
|
|
696
|
-
* <Frame
|
|
697
|
-
* drag
|
|
698
|
-
* dragTransition={{ from: 50 }}
|
|
699
|
-
* />
|
|
700
|
-
* ```
|
|
701
|
-
*
|
|
702
|
-
* @public
|
|
703
|
-
*/
|
|
704
|
-
from?: number | string;
|
|
705
|
-
/**
|
|
706
|
-
* The initial velocity of the animation.
|
|
707
|
-
* By default this is the current velocity of the component.
|
|
708
|
-
*
|
|
709
|
-
* ```jsx
|
|
710
|
-
* <motion.div
|
|
711
|
-
* animate={{ rotate: 180 }}
|
|
712
|
-
* transition={{ type: 'inertia', velocity: 200 }}
|
|
713
|
-
* />
|
|
714
|
-
* ```
|
|
715
|
-
*
|
|
716
|
-
* @public
|
|
717
|
-
*/
|
|
718
|
-
velocity?: number;
|
|
719
|
-
}
|
|
720
|
-
/**
|
|
721
|
-
* Keyframes tweens between multiple `values`.
|
|
722
|
-
*
|
|
723
|
-
* These tweens can be arranged using the `duration`, `easings`, and `times` properties.
|
|
724
|
-
*/
|
|
725
|
-
interface Keyframes {
|
|
726
|
-
/**
|
|
727
|
-
* Set `type` to `"keyframes"` to animate using the keyframes animation.
|
|
728
|
-
* Set to `"tween"` by default. This can be used to animate between a series of values.
|
|
729
|
-
*
|
|
730
|
-
* @public
|
|
731
|
-
*/
|
|
732
|
-
type: "keyframes";
|
|
733
|
-
/**
|
|
734
|
-
* An array of numbers between 0 and 1, where `1` represents the `total` duration.
|
|
735
|
-
*
|
|
736
|
-
* Each value represents at which point during the animation each item in the animation target should be hit, so the array should be the same length as `values`.
|
|
737
|
-
*
|
|
738
|
-
* Defaults to an array of evenly-spread durations.
|
|
739
|
-
*
|
|
740
|
-
* @public
|
|
741
|
-
*/
|
|
742
|
-
times?: number[];
|
|
743
|
-
/**
|
|
744
|
-
* An array of easing functions for each generated tween, or a single easing function applied to all tweens.
|
|
745
|
-
*
|
|
746
|
-
* This array should be one item less than `values`, as these easings apply to the transitions *between* the `values`.
|
|
747
|
-
*
|
|
748
|
-
* ```jsx
|
|
749
|
-
* const transition = {
|
|
750
|
-
* backgroundColor: {
|
|
751
|
-
* type: 'keyframes',
|
|
752
|
-
* easings: ['circIn', 'circOut']
|
|
753
|
-
* }
|
|
754
|
-
* }
|
|
755
|
-
* ```
|
|
756
|
-
*
|
|
757
|
-
* @public
|
|
758
|
-
*/
|
|
759
|
-
ease?: Easing | Easing[];
|
|
760
|
-
/**
|
|
761
|
-
* The total duration of the animation. Set to `0.3` by default.
|
|
762
|
-
*
|
|
763
|
-
* ```jsx
|
|
764
|
-
* const transition = {
|
|
765
|
-
* type: "keyframes",
|
|
766
|
-
* duration: 2
|
|
767
|
-
* }
|
|
768
|
-
*
|
|
769
|
-
* <Frame
|
|
770
|
-
* animate={{ opacity: 0 }}
|
|
771
|
-
* transition={transition}
|
|
772
|
-
* />
|
|
773
|
-
* ```
|
|
774
|
-
*
|
|
775
|
-
* @public
|
|
776
|
-
*/
|
|
777
|
-
duration?: number;
|
|
778
|
-
/**
|
|
779
|
-
* @public
|
|
780
|
-
*/
|
|
781
|
-
repeatDelay?: number;
|
|
782
|
-
}
|
|
783
|
-
/**
|
|
784
|
-
* @public
|
|
785
|
-
*/
|
|
786
|
-
interface None {
|
|
787
|
-
/**
|
|
788
|
-
* Set `type` to `false` for an instant transition.
|
|
789
|
-
*
|
|
790
|
-
* @public
|
|
791
|
-
*/
|
|
792
|
-
type: false;
|
|
793
|
-
}
|
|
794
|
-
/**
|
|
795
|
-
* @public
|
|
796
|
-
*/
|
|
797
|
-
type PermissiveTransitionDefinition = {
|
|
798
|
-
[key: string]: any;
|
|
799
|
-
};
|
|
800
|
-
/**
|
|
801
|
-
* @public
|
|
802
|
-
*/
|
|
803
|
-
type TransitionDefinition = Tween | Spring | Keyframes | Inertia | None | PermissiveTransitionDefinition;
|
|
804
|
-
type TransitionMap = Orchestration & TransitionDefinition & {
|
|
805
|
-
[key: string]: TransitionDefinition;
|
|
806
|
-
};
|
|
807
|
-
/**
|
|
808
|
-
* Transition props
|
|
809
|
-
*
|
|
810
|
-
* @public
|
|
811
|
-
*/
|
|
812
|
-
type Transition = (Orchestration & Repeat & TransitionDefinition) | (Orchestration & Repeat & TransitionMap);
|
|
813
|
-
type Omit$1<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
814
|
-
type CSSPropertiesWithoutTransitionOrSingleTransforms = Omit$1<CSSProperties, "transition" | "rotate" | "scale" | "perspective">;
|
|
815
|
-
type SVGTransformAttributes = {
|
|
816
|
-
attrX?: number;
|
|
817
|
-
attrY?: number;
|
|
818
|
-
attrScale?: number;
|
|
819
|
-
};
|
|
820
|
-
type TargetProperties = CSSPropertiesWithoutTransitionOrSingleTransforms & SVGAttributes<SVGElement> & SVGTransformAttributes & TransformProperties & SVGPathProperties & VariableKeyframesDefinition;
|
|
821
|
-
/**
|
|
822
|
-
* @public
|
|
823
|
-
*/
|
|
824
|
-
type Target = {
|
|
825
|
-
[K in keyof TargetProperties]: TargetProperties[K];
|
|
826
|
-
};
|
|
827
|
-
/**
|
|
828
|
-
* @public
|
|
829
|
-
*/
|
|
830
|
-
type MakeKeyframes<T> = {
|
|
831
|
-
[K in keyof T]: T[K] | T[K][] | [null, ...T[K][]];
|
|
832
|
-
};
|
|
833
|
-
/**
|
|
834
|
-
* @public
|
|
835
|
-
*/
|
|
836
|
-
type TargetWithKeyframes = MakeKeyframes<Target>;
|
|
837
|
-
/**
|
|
838
|
-
* An object that specifies values to animate to. Each value may be set either as
|
|
839
|
-
* a single value, or an array of values.
|
|
840
|
-
*
|
|
841
|
-
* It may also option contain these properties:
|
|
842
|
-
*
|
|
843
|
-
* - `transition`: Specifies transitions for all or individual values.
|
|
844
|
-
* - `transitionEnd`: Specifies values to set when the animation finishes.
|
|
845
|
-
*
|
|
846
|
-
* ```jsx
|
|
847
|
-
* const target = {
|
|
848
|
-
* x: "0%",
|
|
849
|
-
* opacity: 0,
|
|
850
|
-
* transition: { duration: 1 },
|
|
851
|
-
* transitionEnd: { display: "none" }
|
|
852
|
-
* }
|
|
853
|
-
* ```
|
|
854
|
-
*
|
|
855
|
-
* @public
|
|
856
|
-
*/
|
|
857
|
-
type TargetAndTransition = TargetWithKeyframes & {
|
|
858
|
-
transition?: Transition;
|
|
859
|
-
transitionEnd?: Target;
|
|
860
|
-
};
|
|
861
|
-
type TargetResolver = (custom: any, current: Target, velocity: Target) => TargetAndTransition | string;
|
|
862
|
-
/**
|
|
863
|
-
* @public
|
|
864
|
-
*/
|
|
865
|
-
type Variant = TargetAndTransition | TargetResolver;
|
|
866
|
-
/**
|
|
867
|
-
* @public
|
|
868
|
-
*/
|
|
869
|
-
type Variants = {
|
|
870
|
-
[key: string]: Variant;
|
|
871
|
-
};
|
|
872
|
-
|
|
873
|
-
type RefObject<T> = {
|
|
874
|
-
current: T | null;
|
|
875
|
-
};
|
|
876
|
-
|
|
877
|
-
/**
|
|
878
|
-
* Passed in to pan event handlers like `onPan` the `PanInfo` object contains
|
|
879
|
-
* information about the current state of the tap gesture such as its
|
|
880
|
-
* `point`, `delta`, `offset` and `velocity`.
|
|
881
|
-
*
|
|
882
|
-
* ```jsx
|
|
883
|
-
* <motion.div onPan={(event, info) => {
|
|
884
|
-
* console.log(info.point.x, info.point.y)
|
|
885
|
-
* }} />
|
|
886
|
-
* ```
|
|
887
|
-
*
|
|
888
|
-
* @public
|
|
889
|
-
*/
|
|
890
|
-
interface PanInfo {
|
|
891
|
-
/**
|
|
892
|
-
* Contains `x` and `y` values for the current pan position relative
|
|
893
|
-
* to the device or page.
|
|
894
|
-
*
|
|
895
|
-
* ```jsx
|
|
896
|
-
* function onPan(event, info) {
|
|
897
|
-
* console.log(info.point.x, info.point.y)
|
|
898
|
-
* }
|
|
899
|
-
*
|
|
900
|
-
* <motion.div onPan={onPan} />
|
|
901
|
-
* ```
|
|
902
|
-
*
|
|
903
|
-
* @public
|
|
904
|
-
*/
|
|
905
|
-
point: Point;
|
|
906
|
-
/**
|
|
907
|
-
* Contains `x` and `y` values for the distance moved since
|
|
908
|
-
* the last event.
|
|
909
|
-
*
|
|
910
|
-
* ```jsx
|
|
911
|
-
* function onPan(event, info) {
|
|
912
|
-
* console.log(info.delta.x, info.delta.y)
|
|
913
|
-
* }
|
|
914
|
-
*
|
|
915
|
-
* <motion.div onPan={onPan} />
|
|
916
|
-
* ```
|
|
917
|
-
*
|
|
918
|
-
* @public
|
|
919
|
-
*/
|
|
920
|
-
delta: Point;
|
|
921
|
-
/**
|
|
922
|
-
* Contains `x` and `y` values for the distance moved from
|
|
923
|
-
* the first pan event.
|
|
924
|
-
*
|
|
925
|
-
* ```jsx
|
|
926
|
-
* function onPan(event, info) {
|
|
927
|
-
* console.log(info.offset.x, info.offset.y)
|
|
928
|
-
* }
|
|
929
|
-
*
|
|
930
|
-
* <motion.div onPan={onPan} />
|
|
931
|
-
* ```
|
|
932
|
-
*
|
|
933
|
-
* @public
|
|
934
|
-
*/
|
|
935
|
-
offset: Point;
|
|
936
|
-
/**
|
|
937
|
-
* Contains `x` and `y` values for the current velocity of the pointer, in px/ms.
|
|
938
|
-
*
|
|
939
|
-
* ```jsx
|
|
940
|
-
* function onPan(event, info) {
|
|
941
|
-
* console.log(info.velocity.x, info.velocity.y)
|
|
942
|
-
* }
|
|
943
|
-
*
|
|
944
|
-
* <motion.div onPan={onPan} />
|
|
945
|
-
* ```
|
|
946
|
-
*
|
|
947
|
-
* @public
|
|
948
|
-
*/
|
|
949
|
-
velocity: Point;
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
type ReducedMotionConfig = "always" | "never" | "user";
|
|
953
|
-
/**
|
|
954
|
-
* @public
|
|
955
|
-
*/
|
|
956
|
-
interface MotionConfigContext {
|
|
957
|
-
/**
|
|
958
|
-
* Internal, exported only for usage in Framer
|
|
959
|
-
*/
|
|
960
|
-
transformPagePoint: TransformPoint;
|
|
961
|
-
/**
|
|
962
|
-
* Internal. Determines whether this is a static context ie the Framer canvas. If so,
|
|
963
|
-
* it'll disable all dynamic functionality.
|
|
964
|
-
*/
|
|
965
|
-
isStatic: boolean;
|
|
966
|
-
/**
|
|
967
|
-
* Defines a new default transition for the entire tree.
|
|
968
|
-
*
|
|
969
|
-
* @public
|
|
970
|
-
*/
|
|
971
|
-
transition?: Transition;
|
|
972
|
-
/**
|
|
973
|
-
* If true, will respect the device prefersReducedMotion setting by switching
|
|
974
|
-
* transform animations off.
|
|
975
|
-
*
|
|
976
|
-
* @public
|
|
977
|
-
*/
|
|
978
|
-
reducedMotion?: ReducedMotionConfig;
|
|
979
|
-
/**
|
|
980
|
-
* A custom `nonce` attribute used when wanting to enforce a Content Security Policy (CSP).
|
|
981
|
-
* For more details see:
|
|
982
|
-
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src#unsafe_inline_styles
|
|
983
|
-
*
|
|
984
|
-
* @public
|
|
985
|
-
*/
|
|
986
|
-
nonce?: string;
|
|
987
|
-
}
|
|
988
|
-
/**
|
|
989
|
-
* @public
|
|
990
|
-
*/
|
|
991
|
-
declare const MotionConfigContext: React$1.Context<MotionConfigContext>;
|
|
992
|
-
|
|
993
|
-
/**
|
|
994
|
-
* @public
|
|
995
|
-
*/
|
|
996
|
-
interface PresenceContextProps {
|
|
997
|
-
id: string;
|
|
998
|
-
isPresent: boolean;
|
|
999
|
-
register: (id: string | number) => () => void;
|
|
1000
|
-
onExitComplete?: (id: string | number) => void;
|
|
1001
|
-
initial?: false | VariantLabels;
|
|
1002
|
-
custom?: any;
|
|
1003
|
-
}
|
|
1004
|
-
/**
|
|
1005
|
-
* @public
|
|
1006
|
-
*/
|
|
1007
|
-
declare const PresenceContext: React$1.Context<PresenceContextProps | null>;
|
|
1008
|
-
|
|
1009
|
-
interface SwitchLayoutGroup {
|
|
1010
|
-
register?: (member: IProjectionNode) => void;
|
|
1011
|
-
deregister?: (member: IProjectionNode) => void;
|
|
1012
|
-
}
|
|
1013
|
-
type InitialPromotionConfig = {
|
|
1014
|
-
/**
|
|
1015
|
-
* The initial transition to use when the elements in this group mount (and automatically promoted).
|
|
1016
|
-
* Subsequent updates should provide a transition in the promote method.
|
|
1017
|
-
*/
|
|
1018
|
-
transition?: Transition;
|
|
1019
|
-
/**
|
|
1020
|
-
* If the follow tree should preserve its opacity when the lead is promoted on mount
|
|
1021
|
-
*/
|
|
1022
|
-
shouldPreserveFollowOpacity?: (member: IProjectionNode) => boolean;
|
|
1023
|
-
};
|
|
1024
|
-
type SwitchLayoutGroupContext = SwitchLayoutGroup & InitialPromotionConfig;
|
|
1025
|
-
/**
|
|
1026
|
-
* Internal, exported only for usage in Framer
|
|
1027
|
-
*/
|
|
1028
|
-
declare const SwitchLayoutGroupContext: React$1.Context<SwitchLayoutGroupContext>;
|
|
1029
|
-
|
|
1030
|
-
interface VisualState<Instance, RenderState> {
|
|
1031
|
-
renderState: RenderState;
|
|
1032
|
-
latestValues: ResolvedValues;
|
|
1033
|
-
onMount?: (instance: Instance) => void;
|
|
1034
|
-
}
|
|
1035
|
-
type UseVisualState<Instance, RenderState> = (props: MotionProps, isStatic: boolean) => VisualState<Instance, RenderState>;
|
|
1036
|
-
interface UseVisualStateConfig<RenderState> {
|
|
1037
|
-
scrapeMotionValuesFromProps: ScrapeMotionValuesFromProps;
|
|
1038
|
-
createRenderState: () => RenderState;
|
|
1039
|
-
}
|
|
1040
|
-
declare const makeUseVisualState: <I, RS>(config: UseVisualStateConfig<RS>) => UseVisualState<I, RS>;
|
|
1041
|
-
|
|
1042
|
-
type ScrapeMotionValuesFromProps = (props: MotionProps, prevProps: MotionProps, visualElement?: VisualElement) => {
|
|
1043
|
-
[key: string]: MotionValue | string | number;
|
|
1044
|
-
};
|
|
1045
|
-
type VisualElementOptions<Instance, RenderState = any> = {
|
|
1046
|
-
visualState: VisualState<Instance, RenderState>;
|
|
1047
|
-
parent?: VisualElement<unknown>;
|
|
1048
|
-
variantParent?: VisualElement<unknown>;
|
|
1049
|
-
presenceContext: PresenceContextProps | null;
|
|
1050
|
-
props: MotionProps;
|
|
1051
|
-
blockInitialAnimation?: boolean;
|
|
1052
|
-
reducedMotionConfig?: ReducedMotionConfig;
|
|
1053
|
-
};
|
|
1054
|
-
/**
|
|
1055
|
-
* A generic set of string/number values
|
|
1056
|
-
*/
|
|
1057
|
-
interface ResolvedValues {
|
|
1058
|
-
[key: string]: string | number;
|
|
1059
|
-
}
|
|
1060
|
-
interface VisualElementEventCallbacks {
|
|
1061
|
-
BeforeLayoutMeasure: () => void;
|
|
1062
|
-
LayoutMeasure: (layout: Box, prevLayout?: Box) => void;
|
|
1063
|
-
LayoutUpdate: (layout: Axis, prevLayout: Axis) => void;
|
|
1064
|
-
Update: (latest: ResolvedValues) => void;
|
|
1065
|
-
AnimationStart: (definition: AnimationDefinition) => void;
|
|
1066
|
-
AnimationComplete: (definition: AnimationDefinition) => void;
|
|
1067
|
-
LayoutAnimationStart: () => void;
|
|
1068
|
-
LayoutAnimationComplete: () => void;
|
|
1069
|
-
SetAxisTarget: () => void;
|
|
1070
|
-
Unmount: () => void;
|
|
1071
|
-
}
|
|
1072
|
-
interface LayoutLifecycles {
|
|
1073
|
-
onBeforeLayoutMeasure?(box: Box): void;
|
|
1074
|
-
onLayoutMeasure?(box: Box, prevBox: Box): void;
|
|
1075
|
-
}
|
|
1076
|
-
interface AnimationLifecycles {
|
|
1077
|
-
/**
|
|
1078
|
-
* Callback with latest motion values, fired max once per frame.
|
|
1079
|
-
*
|
|
1080
|
-
* ```jsx
|
|
1081
|
-
* function onUpdate(latest) {
|
|
1082
|
-
* console.log(latest.x, latest.opacity)
|
|
1083
|
-
* }
|
|
1084
|
-
*
|
|
1085
|
-
* <motion.div animate={{ x: 100, opacity: 0 }} onUpdate={onUpdate} />
|
|
1086
|
-
* ```
|
|
1087
|
-
*/
|
|
1088
|
-
onUpdate?(latest: ResolvedValues): void;
|
|
1089
|
-
/**
|
|
1090
|
-
* Callback when animation defined in `animate` begins.
|
|
1091
|
-
*
|
|
1092
|
-
* The provided callback will be called with the triggering animation definition.
|
|
1093
|
-
* If this is a variant, it'll be the variant name, and if a target object
|
|
1094
|
-
* then it'll be the target object.
|
|
1095
|
-
*
|
|
1096
|
-
* This way, it's possible to figure out which animation has started.
|
|
1097
|
-
*
|
|
1098
|
-
* ```jsx
|
|
1099
|
-
* function onStart() {
|
|
1100
|
-
* console.log("Animation started")
|
|
1101
|
-
* }
|
|
1102
|
-
*
|
|
1103
|
-
* <motion.div animate={{ x: 100 }} onAnimationStart={onStart} />
|
|
1104
|
-
* ```
|
|
1105
|
-
*/
|
|
1106
|
-
onAnimationStart?(definition: AnimationDefinition): void;
|
|
1107
|
-
/**
|
|
1108
|
-
* Callback when animation defined in `animate` is complete.
|
|
1109
|
-
*
|
|
1110
|
-
* The provided callback will be called with the triggering animation definition.
|
|
1111
|
-
* If this is a variant, it'll be the variant name, and if a target object
|
|
1112
|
-
* then it'll be the target object.
|
|
1113
|
-
*
|
|
1114
|
-
* This way, it's possible to figure out which animation has completed.
|
|
1115
|
-
*
|
|
1116
|
-
* ```jsx
|
|
1117
|
-
* function onComplete() {
|
|
1118
|
-
* console.log("Animation completed")
|
|
1119
|
-
* }
|
|
1120
|
-
*
|
|
1121
|
-
* <motion.div
|
|
1122
|
-
* animate={{ x: 100 }}
|
|
1123
|
-
* onAnimationComplete={definition => {
|
|
1124
|
-
* console.log('Completed animating', definition)
|
|
1125
|
-
* }}
|
|
1126
|
-
* />
|
|
1127
|
-
* ```
|
|
1128
|
-
*/
|
|
1129
|
-
onAnimationComplete?(definition: AnimationDefinition): void;
|
|
1130
|
-
}
|
|
1131
|
-
type EventProps = LayoutLifecycles & AnimationLifecycles;
|
|
1132
|
-
type CreateVisualElement<Instance> = (Component: string | React.ComponentType<React.PropsWithChildren<unknown>>, options: VisualElementOptions<Instance>) => VisualElement<Instance>;
|
|
1133
|
-
|
|
1134
|
-
interface WithDepth {
|
|
1135
|
-
depth: number;
|
|
1136
|
-
}
|
|
1137
|
-
|
|
1138
|
-
declare class FlatTree {
|
|
1139
|
-
private children;
|
|
1140
|
-
private isDirty;
|
|
1141
|
-
add(child: WithDepth): void;
|
|
1142
|
-
remove(child: WithDepth): void;
|
|
1143
|
-
forEach(callback: (child: WithDepth) => void): void;
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
|
-
declare class NodeStack {
|
|
1147
|
-
lead?: IProjectionNode;
|
|
1148
|
-
prevLead?: IProjectionNode;
|
|
1149
|
-
members: IProjectionNode[];
|
|
1150
|
-
add(node: IProjectionNode): void;
|
|
1151
|
-
remove(node: IProjectionNode): void;
|
|
1152
|
-
relegate(node: IProjectionNode): boolean;
|
|
1153
|
-
promote(node: IProjectionNode, preserveFollowOpacity?: boolean): void;
|
|
1154
|
-
exitAnimationComplete(): void;
|
|
1155
|
-
scheduleRender(): void;
|
|
1156
|
-
/**
|
|
1157
|
-
* Clear any leads that have been removed this render to prevent them from being
|
|
1158
|
-
* used in future animations and to prevent memory leaks
|
|
1159
|
-
*/
|
|
1160
|
-
removeLeadSnapshot(): void;
|
|
1161
|
-
}
|
|
1162
|
-
|
|
1163
|
-
interface Measurements {
|
|
1164
|
-
animationId: number;
|
|
1165
|
-
measuredBox: Box;
|
|
1166
|
-
layoutBox: Box;
|
|
1167
|
-
latestValues: ResolvedValues;
|
|
1168
|
-
source: number;
|
|
1169
|
-
}
|
|
1170
|
-
type Phase = "snapshot" | "measure";
|
|
1171
|
-
interface ScrollMeasurements {
|
|
1172
|
-
animationId: number;
|
|
1173
|
-
phase: Phase;
|
|
1174
|
-
offset: Point;
|
|
1175
|
-
isRoot: boolean;
|
|
1176
|
-
wasRoot: boolean;
|
|
1177
|
-
}
|
|
1178
|
-
type LayoutEvents = "willUpdate" | "didUpdate" | "beforeMeasure" | "measure" | "projectionUpdate" | "animationStart" | "animationComplete";
|
|
1179
|
-
interface IProjectionNode<I = unknown> {
|
|
1180
|
-
id: number;
|
|
1181
|
-
animationId: number;
|
|
1182
|
-
parent?: IProjectionNode;
|
|
1183
|
-
relativeParent?: IProjectionNode;
|
|
1184
|
-
root?: IProjectionNode;
|
|
1185
|
-
children: Set<IProjectionNode>;
|
|
1186
|
-
path: IProjectionNode[];
|
|
1187
|
-
nodes?: FlatTree;
|
|
1188
|
-
depth: number;
|
|
1189
|
-
instance: I | undefined;
|
|
1190
|
-
mount: (node: I, isLayoutDirty?: boolean) => void;
|
|
1191
|
-
unmount: () => void;
|
|
1192
|
-
options: ProjectionNodeOptions;
|
|
1193
|
-
setOptions(options: ProjectionNodeOptions): void;
|
|
1194
|
-
layout?: Measurements;
|
|
1195
|
-
snapshot?: Measurements;
|
|
1196
|
-
target?: Box;
|
|
1197
|
-
relativeTarget?: Box;
|
|
1198
|
-
relativeTargetOrigin?: Box;
|
|
1199
|
-
targetDelta?: Delta;
|
|
1200
|
-
targetWithTransforms?: Box;
|
|
1201
|
-
scroll?: ScrollMeasurements;
|
|
1202
|
-
treeScale?: Point;
|
|
1203
|
-
projectionDelta?: Delta;
|
|
1204
|
-
projectionDeltaWithTransform?: Delta;
|
|
1205
|
-
latestValues: ResolvedValues;
|
|
1206
|
-
isLayoutDirty: boolean;
|
|
1207
|
-
isProjectionDirty: boolean;
|
|
1208
|
-
isSharedProjectionDirty: boolean;
|
|
1209
|
-
isTransformDirty: boolean;
|
|
1210
|
-
resolvedRelativeTargetAt?: number;
|
|
1211
|
-
shouldResetTransform: boolean;
|
|
1212
|
-
prevTransformTemplateValue: string | undefined;
|
|
1213
|
-
isUpdateBlocked(): boolean;
|
|
1214
|
-
updateManuallyBlocked: boolean;
|
|
1215
|
-
updateBlockedByResize: boolean;
|
|
1216
|
-
blockUpdate(): void;
|
|
1217
|
-
unblockUpdate(): void;
|
|
1218
|
-
isUpdating: boolean;
|
|
1219
|
-
needsReset: boolean;
|
|
1220
|
-
startUpdate(): void;
|
|
1221
|
-
willUpdate(notifyListeners?: boolean): void;
|
|
1222
|
-
didUpdate(): void;
|
|
1223
|
-
measure(removeTransform?: boolean): Measurements;
|
|
1224
|
-
measurePageBox(): Box;
|
|
1225
|
-
updateLayout(): void;
|
|
1226
|
-
updateSnapshot(): void;
|
|
1227
|
-
clearSnapshot(): void;
|
|
1228
|
-
updateScroll(phase?: Phase): void;
|
|
1229
|
-
scheduleUpdateProjection(): void;
|
|
1230
|
-
scheduleCheckAfterUnmount(): void;
|
|
1231
|
-
checkUpdateFailed(): void;
|
|
1232
|
-
sharedNodes: Map<string, NodeStack>;
|
|
1233
|
-
registerSharedNode(id: string, node: IProjectionNode): void;
|
|
1234
|
-
getStack(): NodeStack | undefined;
|
|
1235
|
-
isVisible: boolean;
|
|
1236
|
-
hide(): void;
|
|
1237
|
-
show(): void;
|
|
1238
|
-
scheduleRender(notifyAll?: boolean): void;
|
|
1239
|
-
getClosestProjectingParent(): IProjectionNode | undefined;
|
|
1240
|
-
setTargetDelta(delta: Delta): void;
|
|
1241
|
-
resetTransform(): void;
|
|
1242
|
-
resetSkewAndRotation(): void;
|
|
1243
|
-
applyTransform(box: Box, transformOnly?: boolean): Box;
|
|
1244
|
-
resolveTargetDelta(force?: boolean): void;
|
|
1245
|
-
calcProjection(): void;
|
|
1246
|
-
getProjectionStyles(styleProp?: MotionStyle): MotionStyle | undefined;
|
|
1247
|
-
clearMeasurements(): void;
|
|
1248
|
-
resetTree(): void;
|
|
1249
|
-
isProjecting(): boolean;
|
|
1250
|
-
animationValues?: ResolvedValues;
|
|
1251
|
-
currentAnimation?: JSAnimation<number>;
|
|
1252
|
-
isTreeAnimating?: boolean;
|
|
1253
|
-
isAnimationBlocked?: boolean;
|
|
1254
|
-
isTreeAnimationBlocked: () => boolean;
|
|
1255
|
-
setAnimationOrigin(delta: Delta): void;
|
|
1256
|
-
startAnimation(transition: Transition): void;
|
|
1257
|
-
finishAnimation(): void;
|
|
1258
|
-
hasCheckedOptimisedAppear: boolean;
|
|
1259
|
-
isLead(): boolean;
|
|
1260
|
-
promote(options?: {
|
|
1261
|
-
needsReset?: boolean;
|
|
1262
|
-
transition?: Transition;
|
|
1263
|
-
preserveFollowOpacity?: boolean;
|
|
1264
|
-
}): void;
|
|
1265
|
-
relegate(): boolean;
|
|
1266
|
-
resumeFrom?: IProjectionNode;
|
|
1267
|
-
resumingFrom?: IProjectionNode;
|
|
1268
|
-
isPresent?: boolean;
|
|
1269
|
-
addEventListener(name: LayoutEvents, handler: any): VoidFunction;
|
|
1270
|
-
notifyListeners(name: LayoutEvents, ...args: any): void;
|
|
1271
|
-
hasListeners(name: LayoutEvents): boolean;
|
|
1272
|
-
hasTreeAnimated: boolean;
|
|
1273
|
-
preserveOpacity?: boolean;
|
|
1274
|
-
}
|
|
1275
|
-
interface ProjectionNodeOptions {
|
|
1276
|
-
animate?: boolean;
|
|
1277
|
-
layoutScroll?: boolean;
|
|
1278
|
-
layoutRoot?: boolean;
|
|
1279
|
-
alwaysMeasureLayout?: boolean;
|
|
1280
|
-
onExitComplete?: VoidFunction;
|
|
1281
|
-
animationType?: "size" | "position" | "both" | "preserve-aspect";
|
|
1282
|
-
layoutId?: string;
|
|
1283
|
-
layout?: boolean | string;
|
|
1284
|
-
visualElement?: VisualElement;
|
|
1285
|
-
crossfade?: boolean;
|
|
1286
|
-
transition?: Transition;
|
|
1287
|
-
initialPromotionConfig?: InitialPromotionConfig;
|
|
1288
|
-
}
|
|
1289
|
-
|
|
1290
|
-
type AnimationType = "animate" | "whileHover" | "whileTap" | "whileDrag" | "whileFocus" | "whileInView" | "exit";
|
|
1291
|
-
|
|
1292
|
-
type VisualElementAnimationOptions = {
|
|
1293
|
-
delay?: number;
|
|
1294
|
-
transitionOverride?: Transition;
|
|
1295
|
-
custom?: any;
|
|
1296
|
-
type?: AnimationType;
|
|
1297
|
-
};
|
|
1298
|
-
|
|
1299
|
-
interface AnimationState {
|
|
1300
|
-
animateChanges: (type?: AnimationType) => Promise<any>;
|
|
1301
|
-
setActive: (type: AnimationType, isActive: boolean, options?: VisualElementAnimationOptions) => Promise<any>;
|
|
1302
|
-
setAnimateFunction: (fn: any) => void;
|
|
1303
|
-
getState: () => {
|
|
1304
|
-
[key: string]: AnimationTypeState;
|
|
1305
|
-
};
|
|
1306
|
-
reset: () => void;
|
|
1307
|
-
}
|
|
1308
|
-
interface AnimationTypeState {
|
|
1309
|
-
isActive: boolean;
|
|
1310
|
-
protectedKeys: {
|
|
1311
|
-
[key: string]: true;
|
|
1312
|
-
};
|
|
1313
|
-
needsAnimating: {
|
|
1314
|
-
[key: string]: boolean;
|
|
1315
|
-
};
|
|
1316
|
-
prevResolvedValues: {
|
|
1317
|
-
[key: string]: any;
|
|
1318
|
-
};
|
|
1319
|
-
prevProp?: VariantLabels | TargetAndTransition;
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
/**
|
|
1323
|
-
* A VisualElement is an imperative abstraction around UI elements such as
|
|
1324
|
-
* HTMLElement, SVGElement, Three.Object3D etc.
|
|
1325
|
-
*/
|
|
1326
|
-
declare abstract class VisualElement<Instance = unknown, RenderState = unknown, Options extends {} = {}> {
|
|
1327
|
-
/**
|
|
1328
|
-
* VisualElements are arranged in trees mirroring that of the React tree.
|
|
1329
|
-
* Each type of VisualElement has a unique name, to detect when we're crossing
|
|
1330
|
-
* type boundaries within that tree.
|
|
1331
|
-
*/
|
|
1332
|
-
abstract type: string;
|
|
1333
|
-
/**
|
|
1334
|
-
* An `Array.sort` compatible function that will compare two Instances and
|
|
1335
|
-
* compare their respective positions within the tree.
|
|
1336
|
-
*/
|
|
1337
|
-
abstract sortInstanceNodePosition(a: Instance, b: Instance): number;
|
|
1338
|
-
/**
|
|
1339
|
-
* Measure the viewport-relative bounding box of the Instance.
|
|
1340
|
-
*/
|
|
1341
|
-
abstract measureInstanceViewportBox(instance: Instance, props: MotionProps & Partial<MotionConfigContext>): Box;
|
|
1342
|
-
/**
|
|
1343
|
-
* When a value has been removed from all animation props we need to
|
|
1344
|
-
* pick a target to animate back to. For instance, for HTMLElements
|
|
1345
|
-
* we can look in the style prop.
|
|
1346
|
-
*/
|
|
1347
|
-
abstract getBaseTargetFromProps(props: MotionProps, key: string): string | number | undefined | MotionValue;
|
|
1348
|
-
/**
|
|
1349
|
-
* When we first animate to a value we need to animate it *from* a value.
|
|
1350
|
-
* Often this have been specified via the initial prop but it might be
|
|
1351
|
-
* that the value needs to be read from the Instance.
|
|
1352
|
-
*/
|
|
1353
|
-
abstract readValueFromInstance(instance: Instance, key: string, options: Options): string | number | null | undefined;
|
|
1354
|
-
/**
|
|
1355
|
-
* When a value has been removed from the VisualElement we use this to remove
|
|
1356
|
-
* it from the inherting class' unique render state.
|
|
1357
|
-
*/
|
|
1358
|
-
abstract removeValueFromRenderState(key: string, renderState: RenderState): void;
|
|
1359
|
-
/**
|
|
1360
|
-
* Run before a React or VisualElement render, builds the latest motion
|
|
1361
|
-
* values into an Instance-specific format. For example, HTMLVisualElement
|
|
1362
|
-
* will use this step to build `style` and `var` values.
|
|
1363
|
-
*/
|
|
1364
|
-
abstract build(renderState: RenderState, latestValues: ResolvedValues, props: MotionProps): void;
|
|
1365
|
-
/**
|
|
1366
|
-
* Apply the built values to the Instance. For example, HTMLElements will have
|
|
1367
|
-
* styles applied via `setProperty` and the style attribute, whereas SVGElements
|
|
1368
|
-
* will have values applied to attributes.
|
|
1369
|
-
*/
|
|
1370
|
-
abstract renderInstance(instance: Instance, renderState: RenderState, styleProp?: MotionStyle, projection?: IProjectionNode): void;
|
|
1371
|
-
/**
|
|
1372
|
-
* This method is called when a transform property is bound to a motion value.
|
|
1373
|
-
* It's currently used to measure SVG elements when a new transform property is bound.
|
|
1374
|
-
*/
|
|
1375
|
-
onBindTransform?(): void;
|
|
1376
|
-
/**
|
|
1377
|
-
* If the component child is provided as a motion value, handle subscriptions
|
|
1378
|
-
* with the renderer-specific VisualElement.
|
|
1379
|
-
*/
|
|
1380
|
-
handleChildMotionValue?(): void;
|
|
1381
|
-
/**
|
|
1382
|
-
* This method takes React props and returns found MotionValues. For example, HTML
|
|
1383
|
-
* MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
|
|
1384
|
-
*
|
|
1385
|
-
* This isn't an abstract method as it needs calling in the constructor, but it is
|
|
1386
|
-
* intended to be one.
|
|
1387
|
-
*/
|
|
1388
|
-
scrapeMotionValuesFromProps(_props: MotionProps, _prevProps: MotionProps, _visualElement: VisualElement): {
|
|
1389
|
-
[key: string]: MotionValue | string | number;
|
|
1390
|
-
};
|
|
1391
|
-
/**
|
|
1392
|
-
* A reference to the current underlying Instance, e.g. a HTMLElement
|
|
1393
|
-
* or Three.Mesh etc.
|
|
1394
|
-
*/
|
|
1395
|
-
current: Instance | null;
|
|
1396
|
-
/**
|
|
1397
|
-
* A reference to the parent VisualElement (if exists).
|
|
1398
|
-
*/
|
|
1399
|
-
parent: VisualElement | undefined;
|
|
1400
|
-
/**
|
|
1401
|
-
* A set containing references to this VisualElement's children.
|
|
1402
|
-
*/
|
|
1403
|
-
children: Set<VisualElement<unknown, unknown, {}>>;
|
|
1404
|
-
/**
|
|
1405
|
-
* The depth of this VisualElement within the overall VisualElement tree.
|
|
1406
|
-
*/
|
|
1407
|
-
depth: number;
|
|
1408
|
-
/**
|
|
1409
|
-
* The current render state of this VisualElement. Defined by inherting VisualElements.
|
|
1410
|
-
*/
|
|
1411
|
-
renderState: RenderState;
|
|
1412
|
-
/**
|
|
1413
|
-
* An object containing the latest static values for each of this VisualElement's
|
|
1414
|
-
* MotionValues.
|
|
1415
|
-
*/
|
|
1416
|
-
latestValues: ResolvedValues;
|
|
1417
|
-
/**
|
|
1418
|
-
* Determine what role this visual element should take in the variant tree.
|
|
1419
|
-
*/
|
|
1420
|
-
isVariantNode: boolean;
|
|
1421
|
-
isControllingVariants: boolean;
|
|
1422
|
-
/**
|
|
1423
|
-
* If this component is part of the variant tree, it should track
|
|
1424
|
-
* any children that are also part of the tree. This is essentially
|
|
1425
|
-
* a shadow tree to simplify logic around how to stagger over children.
|
|
1426
|
-
*/
|
|
1427
|
-
variantChildren?: Set<VisualElement>;
|
|
1428
|
-
/**
|
|
1429
|
-
* Decides whether this VisualElement should animate in reduced motion
|
|
1430
|
-
* mode.
|
|
1431
|
-
*
|
|
1432
|
-
* TODO: This is currently set on every individual VisualElement but feels
|
|
1433
|
-
* like it could be set globally.
|
|
1434
|
-
*/
|
|
1435
|
-
shouldReduceMotion: boolean | null;
|
|
1436
|
-
/**
|
|
1437
|
-
* Normally, if a component is controlled by a parent's variants, it can
|
|
1438
|
-
* rely on that ancestor to trigger animations further down the tree.
|
|
1439
|
-
* However, if a component is created after its parent is mounted, the parent
|
|
1440
|
-
* won't trigger that mount animation so the child needs to.
|
|
1441
|
-
*
|
|
1442
|
-
* TODO: This might be better replaced with a method isParentMounted
|
|
1443
|
-
*/
|
|
1444
|
-
manuallyAnimateOnMount: boolean;
|
|
1445
|
-
/**
|
|
1446
|
-
* This can be set by AnimatePresence to force components that mount
|
|
1447
|
-
* at the same time as it to mount as if they have initial={false} set.
|
|
1448
|
-
*/
|
|
1449
|
-
blockInitialAnimation: boolean;
|
|
1450
|
-
/**
|
|
1451
|
-
* A reference to this VisualElement's projection node, used in layout animations.
|
|
1452
|
-
*/
|
|
1453
|
-
projection?: IProjectionNode;
|
|
1454
|
-
/**
|
|
1455
|
-
* A map of all motion values attached to this visual element. Motion
|
|
1456
|
-
* values are source of truth for any given animated value. A motion
|
|
1457
|
-
* value might be provided externally by the component via props.
|
|
1458
|
-
*/
|
|
1459
|
-
values: Map<string, MotionValue<any>>;
|
|
1460
|
-
/**
|
|
1461
|
-
* The AnimationState, this is hydrated by the animation Feature.
|
|
1462
|
-
*/
|
|
1463
|
-
animationState?: AnimationState;
|
|
1464
|
-
KeyframeResolver: typeof KeyframeResolver;
|
|
1465
|
-
/**
|
|
1466
|
-
* The options used to create this VisualElement. The Options type is defined
|
|
1467
|
-
* by the inheriting VisualElement and is passed straight through to the render functions.
|
|
1468
|
-
*/
|
|
1469
|
-
readonly options: Options;
|
|
1470
|
-
/**
|
|
1471
|
-
* A reference to the latest props provided to the VisualElement's host React component.
|
|
1472
|
-
*/
|
|
1473
|
-
props: MotionProps;
|
|
1474
|
-
prevProps?: MotionProps;
|
|
1475
|
-
presenceContext: PresenceContextProps | null;
|
|
1476
|
-
prevPresenceContext?: PresenceContextProps | null;
|
|
1477
|
-
/**
|
|
1478
|
-
* Cleanup functions for active features (hover/tap/exit etc)
|
|
1479
|
-
*/
|
|
1480
|
-
private features;
|
|
1481
|
-
/**
|
|
1482
|
-
* A map of every subscription that binds the provided or generated
|
|
1483
|
-
* motion values onChange listeners to this visual element.
|
|
1484
|
-
*/
|
|
1485
|
-
private valueSubscriptions;
|
|
1486
|
-
/**
|
|
1487
|
-
* A reference to the ReducedMotionConfig passed to the VisualElement's host React component.
|
|
1488
|
-
*/
|
|
1489
|
-
private reducedMotionConfig;
|
|
1490
|
-
/**
|
|
1491
|
-
* On mount, this will be hydrated with a callback to disconnect
|
|
1492
|
-
* this visual element from its parent on unmount.
|
|
1493
|
-
*/
|
|
1494
|
-
private removeFromVariantTree;
|
|
1495
|
-
/**
|
|
1496
|
-
* A reference to the previously-provided motion values as returned
|
|
1497
|
-
* from scrapeMotionValuesFromProps. We use the keys in here to determine
|
|
1498
|
-
* if any motion values need to be removed after props are updated.
|
|
1499
|
-
*/
|
|
1500
|
-
private prevMotionValues;
|
|
1501
|
-
/**
|
|
1502
|
-
* When values are removed from all animation props we need to search
|
|
1503
|
-
* for a fallback value to animate to. These values are tracked in baseTarget.
|
|
1504
|
-
*/
|
|
1505
|
-
private baseTarget;
|
|
1506
|
-
/**
|
|
1507
|
-
* Create an object of the values we initially animated from (if initial prop present).
|
|
1508
|
-
*/
|
|
1509
|
-
private initialValues;
|
|
1510
|
-
/**
|
|
1511
|
-
* An object containing a SubscriptionManager for each active event.
|
|
1512
|
-
*/
|
|
1513
|
-
private events;
|
|
1514
|
-
/**
|
|
1515
|
-
* An object containing an unsubscribe function for each prop event subscription.
|
|
1516
|
-
* For example, every "Update" event can have multiple subscribers via
|
|
1517
|
-
* VisualElement.on(), but only one of those can be defined via the onUpdate prop.
|
|
1518
|
-
*/
|
|
1519
|
-
private propEventSubscriptions;
|
|
1520
|
-
constructor({ parent, props, presenceContext, reducedMotionConfig, blockInitialAnimation, visualState, }: VisualElementOptions<Instance, RenderState>, options?: Options);
|
|
1521
|
-
mount(instance: Instance): void;
|
|
1522
|
-
unmount(): void;
|
|
1523
|
-
private bindToMotionValue;
|
|
1524
|
-
sortNodePosition(other: VisualElement<Instance>): number;
|
|
1525
|
-
updateFeatures(): void;
|
|
1526
|
-
notifyUpdate: () => void;
|
|
1527
|
-
triggerBuild(): void;
|
|
1528
|
-
render: () => void;
|
|
1529
|
-
private renderScheduledAt;
|
|
1530
|
-
scheduleRender: () => void;
|
|
1531
|
-
/**
|
|
1532
|
-
* Measure the current viewport box with or without transforms.
|
|
1533
|
-
* Only measures axis-aligned boxes, rotate and skew must be manually
|
|
1534
|
-
* removed with a re-render to work.
|
|
1535
|
-
*/
|
|
1536
|
-
measureViewportBox(): Box;
|
|
1537
|
-
getStaticValue(key: string): string | number;
|
|
1538
|
-
setStaticValue(key: string, value: string | number): void;
|
|
1539
|
-
/**
|
|
1540
|
-
* Update the provided props. Ensure any newly-added motion values are
|
|
1541
|
-
* added to our map, old ones removed, and listeners updated.
|
|
1542
|
-
*/
|
|
1543
|
-
update(props: MotionProps, presenceContext: PresenceContextProps | null): void;
|
|
1544
|
-
getProps(): MotionProps;
|
|
1545
|
-
/**
|
|
1546
|
-
* Returns the variant definition with a given name.
|
|
1547
|
-
*/
|
|
1548
|
-
getVariant(name: string): Variant | undefined;
|
|
1549
|
-
/**
|
|
1550
|
-
* Returns the defined default transition on this component.
|
|
1551
|
-
*/
|
|
1552
|
-
getDefaultTransition(): Transition | undefined;
|
|
1553
|
-
getTransformPagePoint(): any;
|
|
1554
|
-
getClosestVariantNode(): VisualElement | undefined;
|
|
1555
|
-
/**
|
|
1556
|
-
* Add a child visual element to our set of children.
|
|
1557
|
-
*/
|
|
1558
|
-
addVariantChild(child: VisualElement): (() => boolean) | undefined;
|
|
1559
|
-
/**
|
|
1560
|
-
* Add a motion value and bind it to this visual element.
|
|
1561
|
-
*/
|
|
1562
|
-
addValue(key: string, value: MotionValue): void;
|
|
1563
|
-
/**
|
|
1564
|
-
* Remove a motion value and unbind any active subscriptions.
|
|
1565
|
-
*/
|
|
1566
|
-
removeValue(key: string): void;
|
|
1567
|
-
/**
|
|
1568
|
-
* Check whether we have a motion value for this key
|
|
1569
|
-
*/
|
|
1570
|
-
hasValue(key: string): boolean;
|
|
1571
|
-
/**
|
|
1572
|
-
* Get a motion value for this key. If called with a default
|
|
1573
|
-
* value, we'll create one if none exists.
|
|
1574
|
-
*/
|
|
1575
|
-
getValue(key: string): MotionValue | undefined;
|
|
1576
|
-
getValue(key: string, defaultValue: string | number | null): MotionValue;
|
|
1577
|
-
/**
|
|
1578
|
-
* If we're trying to animate to a previously unencountered value,
|
|
1579
|
-
* we need to check for it in our state and as a last resort read it
|
|
1580
|
-
* directly from the instance (which might have performance implications).
|
|
1581
|
-
*/
|
|
1582
|
-
readValue(key: string, target?: string | number | null): any;
|
|
1583
|
-
/**
|
|
1584
|
-
* Set the base target to later animate back to. This is currently
|
|
1585
|
-
* only hydrated on creation and when we first read a value.
|
|
1586
|
-
*/
|
|
1587
|
-
setBaseTarget(key: string, value: string | number): void;
|
|
1588
|
-
/**
|
|
1589
|
-
* Find the base target for a value thats been removed from all animation
|
|
1590
|
-
* props.
|
|
1591
|
-
*/
|
|
1592
|
-
getBaseTarget(key: string): ResolvedValues[string] | undefined | null;
|
|
1593
|
-
on<EventName extends keyof VisualElementEventCallbacks>(eventName: EventName, callback: VisualElementEventCallbacks[EventName]): VoidFunction;
|
|
1594
|
-
notify<EventName extends keyof VisualElementEventCallbacks>(eventName: EventName, ...args: any): void;
|
|
1595
|
-
}
|
|
1596
|
-
|
|
1597
|
-
interface DragControlOptions {
|
|
1598
|
-
snapToCursor?: boolean;
|
|
1599
|
-
cursorProgress?: Point;
|
|
1600
|
-
}
|
|
1601
|
-
|
|
1602
|
-
/**
|
|
1603
|
-
* Can manually trigger a drag gesture on one or more `drag`-enabled `motion` components.
|
|
1604
|
-
*
|
|
1605
|
-
* ```jsx
|
|
1606
|
-
* const dragControls = useDragControls()
|
|
1607
|
-
*
|
|
1608
|
-
* function startDrag(event) {
|
|
1609
|
-
* dragControls.start(event, { snapToCursor: true })
|
|
1610
|
-
* }
|
|
1611
|
-
*
|
|
1612
|
-
* return (
|
|
1613
|
-
* <>
|
|
1614
|
-
* <div onPointerDown={startDrag} />
|
|
1615
|
-
* <motion.div drag="x" dragControls={dragControls} />
|
|
1616
|
-
* </>
|
|
1617
|
-
* )
|
|
1618
|
-
* ```
|
|
1619
|
-
*
|
|
1620
|
-
* @public
|
|
1621
|
-
*/
|
|
1622
|
-
declare class DragControls {
|
|
1623
|
-
private componentControls;
|
|
1624
|
-
/**
|
|
1625
|
-
* Start a drag gesture on every `motion` component that has this set of drag controls
|
|
1626
|
-
* passed into it via the `dragControls` prop.
|
|
1627
|
-
*
|
|
1628
|
-
* ```jsx
|
|
1629
|
-
* dragControls.start(e, {
|
|
1630
|
-
* snapToCursor: true
|
|
1631
|
-
* })
|
|
1632
|
-
* ```
|
|
1633
|
-
*
|
|
1634
|
-
* @param event - PointerEvent
|
|
1635
|
-
* @param options - Options
|
|
1636
|
-
*
|
|
1637
|
-
* @public
|
|
1638
|
-
*/
|
|
1639
|
-
start(event: React$1.PointerEvent | PointerEvent, options?: DragControlOptions): void;
|
|
1640
|
-
}
|
|
1641
|
-
/**
|
|
1642
|
-
* Usually, dragging is initiated by pressing down on a `motion` component with a `drag` prop
|
|
1643
|
-
* and moving it. For some use-cases, for instance clicking at an arbitrary point on a video scrubber, we
|
|
1644
|
-
* might want to initiate that dragging from a different component than the draggable one.
|
|
1645
|
-
*
|
|
1646
|
-
* By creating a `dragControls` using the `useDragControls` hook, we can pass this into
|
|
1647
|
-
* the draggable component's `dragControls` prop. It exposes a `start` method
|
|
1648
|
-
* that can start dragging from pointer events on other components.
|
|
1649
|
-
*
|
|
1650
|
-
* ```jsx
|
|
1651
|
-
* const dragControls = useDragControls()
|
|
1652
|
-
*
|
|
1653
|
-
* function startDrag(event) {
|
|
1654
|
-
* dragControls.start(event, { snapToCursor: true })
|
|
1655
|
-
* }
|
|
1656
|
-
*
|
|
1657
|
-
* return (
|
|
1658
|
-
* <>
|
|
1659
|
-
* <div onPointerDown={startDrag} />
|
|
1660
|
-
* <motion.div drag="x" dragControls={dragControls} />
|
|
1661
|
-
* </>
|
|
1662
|
-
* )
|
|
1663
|
-
* ```
|
|
1664
|
-
*
|
|
1665
|
-
* @public
|
|
1666
|
-
*/
|
|
1667
|
-
declare function useDragControls(): DragControls;
|
|
1668
|
-
|
|
1669
|
-
type DragElastic = boolean | number | Partial<BoundingBox>;
|
|
1670
|
-
/**
|
|
1671
|
-
* @public
|
|
1672
|
-
*/
|
|
1673
|
-
interface DragHandlers {
|
|
1674
|
-
/**
|
|
1675
|
-
* Callback function that fires when dragging starts.
|
|
1676
|
-
*
|
|
1677
|
-
* ```jsx
|
|
1678
|
-
* <motion.div
|
|
1679
|
-
* drag
|
|
1680
|
-
* onDragStart={
|
|
1681
|
-
* (event, info) => console.log(info.point.x, info.point.y)
|
|
1682
|
-
* }
|
|
1683
|
-
* />
|
|
1684
|
-
* ```
|
|
1685
|
-
*
|
|
1686
|
-
* @public
|
|
1687
|
-
*/
|
|
1688
|
-
onDragStart?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
|
|
1689
|
-
/**
|
|
1690
|
-
* Callback function that fires when dragging ends.
|
|
1691
|
-
*
|
|
1692
|
-
* ```jsx
|
|
1693
|
-
* <motion.div
|
|
1694
|
-
* drag
|
|
1695
|
-
* onDragEnd={
|
|
1696
|
-
* (event, info) => console.log(info.point.x, info.point.y)
|
|
1697
|
-
* }
|
|
1698
|
-
* />
|
|
1699
|
-
* ```
|
|
1700
|
-
*
|
|
1701
|
-
* @public
|
|
1702
|
-
*/
|
|
1703
|
-
onDragEnd?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
|
|
1704
|
-
/**
|
|
1705
|
-
* Callback function that fires when the component is dragged.
|
|
1706
|
-
*
|
|
1707
|
-
* ```jsx
|
|
1708
|
-
* <motion.div
|
|
1709
|
-
* drag
|
|
1710
|
-
* onDrag={
|
|
1711
|
-
* (event, info) => console.log(info.point.x, info.point.y)
|
|
1712
|
-
* }
|
|
1713
|
-
* />
|
|
1714
|
-
* ```
|
|
1715
|
-
*
|
|
1716
|
-
* @public
|
|
1717
|
-
*/
|
|
1718
|
-
onDrag?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
|
|
1719
|
-
/**
|
|
1720
|
-
* Callback function that fires a drag direction is determined.
|
|
1721
|
-
*
|
|
1722
|
-
* ```jsx
|
|
1723
|
-
* <motion.div
|
|
1724
|
-
* drag
|
|
1725
|
-
* dragDirectionLock
|
|
1726
|
-
* onDirectionLock={axis => console.log(axis)}
|
|
1727
|
-
* />
|
|
1728
|
-
* ```
|
|
1729
|
-
*
|
|
1730
|
-
* @public
|
|
1731
|
-
*/
|
|
1732
|
-
onDirectionLock?(axis: "x" | "y"): void;
|
|
1733
|
-
/**
|
|
1734
|
-
* Callback function that fires when drag momentum/bounce transition finishes.
|
|
1735
|
-
*
|
|
1736
|
-
* ```jsx
|
|
1737
|
-
* <motion.div
|
|
1738
|
-
* drag
|
|
1739
|
-
* onDragTransitionEnd={() => console.log('Drag transition complete')}
|
|
1740
|
-
* />
|
|
1741
|
-
* ```
|
|
1742
|
-
*
|
|
1743
|
-
* @public
|
|
1744
|
-
*/
|
|
1745
|
-
onDragTransitionEnd?(): void;
|
|
1746
|
-
}
|
|
1747
|
-
/**
|
|
1748
|
-
* @public
|
|
1749
|
-
*/
|
|
1750
|
-
type InertiaOptions = Partial<Omit<Inertia, "velocity" | "type">>;
|
|
1751
|
-
/**
|
|
1752
|
-
* @public
|
|
1753
|
-
*/
|
|
1754
|
-
interface DraggableProps extends DragHandlers {
|
|
1755
|
-
/**
|
|
1756
|
-
* Enable dragging for this element. Set to `false` by default.
|
|
1757
|
-
* Set `true` to drag in both directions.
|
|
1758
|
-
* Set `"x"` or `"y"` to only drag in a specific direction.
|
|
1759
|
-
*
|
|
1760
|
-
* ```jsx
|
|
1761
|
-
* <motion.div drag="x" />
|
|
1762
|
-
* ```
|
|
1763
|
-
*/
|
|
1764
|
-
drag?: boolean | "x" | "y";
|
|
1765
|
-
/**
|
|
1766
|
-
* Properties or variant label to animate to while the drag gesture is recognised.
|
|
1767
|
-
*
|
|
1768
|
-
* ```jsx
|
|
1769
|
-
* <motion.div whileDrag={{ scale: 1.2 }} />
|
|
1770
|
-
* ```
|
|
1771
|
-
*/
|
|
1772
|
-
whileDrag?: VariantLabels | TargetAndTransition;
|
|
1773
|
-
/**
|
|
1774
|
-
* If `true`, this will lock dragging to the initially-detected direction. Defaults to `false`.
|
|
1775
|
-
*
|
|
1776
|
-
* ```jsx
|
|
1777
|
-
* <motion.div drag dragDirectionLock />
|
|
1778
|
-
* ```
|
|
1779
|
-
*/
|
|
1780
|
-
dragDirectionLock?: boolean;
|
|
1781
|
-
/**
|
|
1782
|
-
* Allows drag gesture propagation to child components. Set to `false` by
|
|
1783
|
-
* default.
|
|
1784
|
-
*
|
|
1785
|
-
* ```jsx
|
|
1786
|
-
* <motion.div drag="x" dragPropagation />
|
|
1787
|
-
* ```
|
|
1788
|
-
*/
|
|
1789
|
-
dragPropagation?: boolean;
|
|
1790
|
-
/**
|
|
1791
|
-
* Applies constraints on the permitted draggable area.
|
|
1792
|
-
*
|
|
1793
|
-
* It can accept an object of optional `top`, `left`, `right`, and `bottom` values, measured in pixels.
|
|
1794
|
-
* This will define a distance from the named edge of the draggable component.
|
|
1795
|
-
*
|
|
1796
|
-
* Alternatively, it can accept a `ref` to another component created with React's `useRef` hook.
|
|
1797
|
-
* This `ref` should be passed both to the draggable component's `dragConstraints` prop, and the `ref`
|
|
1798
|
-
* of the component you want to use as constraints.
|
|
1799
|
-
*
|
|
1800
|
-
* ```jsx
|
|
1801
|
-
* // In pixels
|
|
1802
|
-
* <motion.div
|
|
1803
|
-
* drag="x"
|
|
1804
|
-
* dragConstraints={{ left: 0, right: 300 }}
|
|
1805
|
-
* />
|
|
1806
|
-
*
|
|
1807
|
-
* // As a ref to another component
|
|
1808
|
-
* const MyComponent = () => {
|
|
1809
|
-
* const constraintsRef = useRef(null)
|
|
1810
|
-
*
|
|
1811
|
-
* return (
|
|
1812
|
-
* <motion.div ref={constraintsRef}>
|
|
1813
|
-
* <motion.div drag dragConstraints={constraintsRef} />
|
|
1814
|
-
* </motion.div>
|
|
1815
|
-
* )
|
|
1816
|
-
* }
|
|
1817
|
-
* ```
|
|
1818
|
-
*/
|
|
1819
|
-
dragConstraints?: false | Partial<BoundingBox> | RefObject<Element | null>;
|
|
1820
|
-
/**
|
|
1821
|
-
* The degree of movement allowed outside constraints. 0 = no movement, 1 =
|
|
1822
|
-
* full movement.
|
|
1823
|
-
*
|
|
1824
|
-
* Set to `0.5` by default. Can also be set as `false` to disable movement.
|
|
1825
|
-
*
|
|
1826
|
-
* By passing an object of `top`/`right`/`bottom`/`left`, individual values can be set
|
|
1827
|
-
* per constraint. Any missing values will be set to `0`.
|
|
1828
|
-
*
|
|
1829
|
-
* ```jsx
|
|
1830
|
-
* <motion.div
|
|
1831
|
-
* drag
|
|
1832
|
-
* dragConstraints={{ left: 0, right: 300 }}
|
|
1833
|
-
* dragElastic={0.2}
|
|
1834
|
-
* />
|
|
1835
|
-
* ```
|
|
1836
|
-
*/
|
|
1837
|
-
dragElastic?: DragElastic;
|
|
1838
|
-
/**
|
|
1839
|
-
* Apply momentum from the pan gesture to the component when dragging
|
|
1840
|
-
* finishes. Set to `true` by default.
|
|
1841
|
-
*
|
|
1842
|
-
* ```jsx
|
|
1843
|
-
* <motion.div
|
|
1844
|
-
* drag
|
|
1845
|
-
* dragConstraints={{ left: 0, right: 300 }}
|
|
1846
|
-
* dragMomentum={false}
|
|
1847
|
-
* />
|
|
1848
|
-
* ```
|
|
1849
|
-
*/
|
|
1850
|
-
dragMomentum?: boolean;
|
|
1851
|
-
/**
|
|
1852
|
-
* Allows you to change dragging inertia parameters.
|
|
1853
|
-
* When releasing a draggable Frame, an animation with type `inertia` starts. The animation is based on your dragging velocity. This property allows you to customize it.
|
|
1854
|
-
* See {@link https://motion.dev/docs/react-motion-component#dragtransition | Inertia} for all properties you can use.
|
|
1855
|
-
*
|
|
1856
|
-
* ```jsx
|
|
1857
|
-
* <motion.div
|
|
1858
|
-
* drag
|
|
1859
|
-
* dragTransition={{ bounceStiffness: 600, bounceDamping: 10 }}
|
|
1860
|
-
* />
|
|
1861
|
-
* ```
|
|
1862
|
-
*/
|
|
1863
|
-
dragTransition?: InertiaOptions;
|
|
1864
|
-
/**
|
|
1865
|
-
* Usually, dragging is initiated by pressing down on a component and moving it. For some
|
|
1866
|
-
* use-cases, for instance clicking at an arbitrary point on a video scrubber, we
|
|
1867
|
-
* might want to initiate dragging from a different component than the draggable one.
|
|
1868
|
-
*
|
|
1869
|
-
* By creating a `dragControls` using the `useDragControls` hook, we can pass this into
|
|
1870
|
-
* the draggable component's `dragControls` prop. It exposes a `start` method
|
|
1871
|
-
* that can start dragging from pointer events on other components.
|
|
1872
|
-
*
|
|
1873
|
-
* ```jsx
|
|
1874
|
-
* const dragControls = useDragControls()
|
|
1875
|
-
*
|
|
1876
|
-
* function startDrag(event) {
|
|
1877
|
-
* dragControls.start(event, { snapToCursor: true })
|
|
1878
|
-
* }
|
|
1879
|
-
*
|
|
1880
|
-
* return (
|
|
1881
|
-
* <>
|
|
1882
|
-
* <div onPointerDown={startDrag} />
|
|
1883
|
-
* <motion.div drag="x" dragControls={dragControls} />
|
|
1884
|
-
* </>
|
|
1885
|
-
* )
|
|
1886
|
-
* ```
|
|
1887
|
-
*/
|
|
1888
|
-
dragControls?: DragControls;
|
|
1889
|
-
/**
|
|
1890
|
-
* If true, element will snap back to its origin when dragging ends.
|
|
1891
|
-
*
|
|
1892
|
-
* Enabling this is the equivalent of setting all `dragConstraints` axes to `0`
|
|
1893
|
-
* with `dragElastic={1}`, but when used together `dragConstraints` can define
|
|
1894
|
-
* a wider draggable area and `dragSnapToOrigin` will ensure the element
|
|
1895
|
-
* animates back to its origin on release.
|
|
1896
|
-
*/
|
|
1897
|
-
dragSnapToOrigin?: boolean;
|
|
1898
|
-
/**
|
|
1899
|
-
* By default, if `drag` is defined on a component then an event listener will be attached
|
|
1900
|
-
* to automatically initiate dragging when a user presses down on it.
|
|
1901
|
-
*
|
|
1902
|
-
* By setting `dragListener` to `false`, this event listener will not be created.
|
|
1903
|
-
*
|
|
1904
|
-
* ```jsx
|
|
1905
|
-
* const dragControls = useDragControls()
|
|
1906
|
-
*
|
|
1907
|
-
* function startDrag(event) {
|
|
1908
|
-
* dragControls.start(event, { snapToCursor: true })
|
|
1909
|
-
* }
|
|
1910
|
-
*
|
|
1911
|
-
* return (
|
|
1912
|
-
* <>
|
|
1913
|
-
* <div onPointerDown={startDrag} />
|
|
1914
|
-
* <motion.div
|
|
1915
|
-
* drag="x"
|
|
1916
|
-
* dragControls={dragControls}
|
|
1917
|
-
* dragListener={false}
|
|
1918
|
-
* />
|
|
1919
|
-
* </>
|
|
1920
|
-
* )
|
|
1921
|
-
* ```
|
|
1922
|
-
*/
|
|
1923
|
-
dragListener?: boolean;
|
|
1924
|
-
/**
|
|
1925
|
-
* If `dragConstraints` is set to a React ref, this callback will call with the measured drag constraints.
|
|
1926
|
-
*
|
|
1927
|
-
* @public
|
|
1928
|
-
*/
|
|
1929
|
-
onMeasureDragConstraints?: (constraints: BoundingBox) => BoundingBox | void;
|
|
1930
|
-
/**
|
|
1931
|
-
* Usually, dragging uses the layout project engine, and applies transforms to the underlying VisualElement.
|
|
1932
|
-
* Passing MotionValues as _dragX and _dragY instead applies drag updates to these motion values.
|
|
1933
|
-
* This allows you to manually control how updates from a drag gesture on an element is applied.
|
|
1934
|
-
*
|
|
1935
|
-
* @public
|
|
1936
|
-
*/
|
|
1937
|
-
_dragX?: MotionValue<number>;
|
|
1938
|
-
/**
|
|
1939
|
-
* Usually, dragging uses the layout project engine, and applies transforms to the underlying VisualElement.
|
|
1940
|
-
* Passing MotionValues as _dragX and _dragY instead applies drag updates to these motion values.
|
|
1941
|
-
* This allows you to manually control how updates from a drag gesture on an element is applied.
|
|
1942
|
-
*
|
|
1943
|
-
* @public
|
|
1944
|
-
*/
|
|
1945
|
-
_dragY?: MotionValue<number>;
|
|
1946
|
-
}
|
|
1947
|
-
|
|
1948
|
-
/** @public */
|
|
1949
|
-
interface EventInfo {
|
|
1950
|
-
point: Point;
|
|
1951
|
-
}
|
|
1952
|
-
|
|
1953
|
-
/**
|
|
1954
|
-
* @public
|
|
1955
|
-
*/
|
|
1956
|
-
interface FocusHandlers {
|
|
1957
|
-
/**
|
|
1958
|
-
* Properties or variant label to animate to while the focus gesture is recognised.
|
|
1959
|
-
*
|
|
1960
|
-
* ```jsx
|
|
1961
|
-
* <motion.input whileFocus={{ scale: 1.2 }} />
|
|
1962
|
-
* ```
|
|
1963
|
-
*/
|
|
1964
|
-
whileFocus?: VariantLabels | TargetAndTransition;
|
|
1965
|
-
}
|
|
1966
|
-
/**
|
|
1967
|
-
* Passed in to tap event handlers like `onTap` the `TapInfo` object contains
|
|
1968
|
-
* information about the tap gesture such as it‘s location.
|
|
1969
|
-
*
|
|
1970
|
-
* ```jsx
|
|
1971
|
-
* function onTap(event, info) {
|
|
1972
|
-
* console.log(info.point.x, info.point.y)
|
|
1973
|
-
* }
|
|
1974
|
-
*
|
|
1975
|
-
* <motion.div onTap={onTap} />
|
|
1976
|
-
* ```
|
|
1977
|
-
*
|
|
1978
|
-
* @public
|
|
1979
|
-
*/
|
|
1980
|
-
interface TapInfo {
|
|
1981
|
-
/**
|
|
1982
|
-
* Contains `x` and `y` values for the tap gesture relative to the
|
|
1983
|
-
* device or page.
|
|
1984
|
-
*
|
|
1985
|
-
* ```jsx
|
|
1986
|
-
* function onTapStart(event, info) {
|
|
1987
|
-
* console.log(info.point.x, info.point.y)
|
|
1988
|
-
* }
|
|
1989
|
-
*
|
|
1990
|
-
* <motion.div onTapStart={onTapStart} />
|
|
1991
|
-
* ```
|
|
1992
|
-
*
|
|
1993
|
-
* @public
|
|
1994
|
-
*/
|
|
1995
|
-
point: Point;
|
|
1996
|
-
}
|
|
1997
|
-
/**
|
|
1998
|
-
* @public
|
|
1999
|
-
*/
|
|
2000
|
-
interface TapHandlers {
|
|
2001
|
-
/**
|
|
2002
|
-
* Callback when the tap gesture successfully ends on this element.
|
|
2003
|
-
*
|
|
2004
|
-
* ```jsx
|
|
2005
|
-
* function onTap(event, info) {
|
|
2006
|
-
* console.log(info.point.x, info.point.y)
|
|
2007
|
-
* }
|
|
2008
|
-
*
|
|
2009
|
-
* <motion.div onTap={onTap} />
|
|
2010
|
-
* ```
|
|
2011
|
-
*
|
|
2012
|
-
* @param event - The originating pointer event.
|
|
2013
|
-
* @param info - An {@link TapInfo} object containing `x` and `y` values for the `point` relative to the device or page.
|
|
2014
|
-
*/
|
|
2015
|
-
onTap?(event: MouseEvent | TouchEvent | PointerEvent, info: TapInfo): void;
|
|
2016
|
-
/**
|
|
2017
|
-
* Callback when the tap gesture starts on this element.
|
|
2018
|
-
*
|
|
2019
|
-
* ```jsx
|
|
2020
|
-
* function onTapStart(event, info) {
|
|
2021
|
-
* console.log(info.point.x, info.point.y)
|
|
2022
|
-
* }
|
|
2023
|
-
*
|
|
2024
|
-
* <motion.div onTapStart={onTapStart} />
|
|
2025
|
-
* ```
|
|
2026
|
-
*
|
|
2027
|
-
* @param event - The originating pointer event.
|
|
2028
|
-
* @param info - An {@link TapInfo} object containing `x` and `y` values for the `point` relative to the device or page.
|
|
2029
|
-
*/
|
|
2030
|
-
onTapStart?(event: MouseEvent | TouchEvent | PointerEvent, info: TapInfo): void;
|
|
2031
|
-
/**
|
|
2032
|
-
* Callback when the tap gesture ends outside this element.
|
|
2033
|
-
*
|
|
2034
|
-
* ```jsx
|
|
2035
|
-
* function onTapCancel(event, info) {
|
|
2036
|
-
* console.log(info.point.x, info.point.y)
|
|
2037
|
-
* }
|
|
2038
|
-
*
|
|
2039
|
-
* <motion.div onTapCancel={onTapCancel} />
|
|
2040
|
-
* ```
|
|
2041
|
-
*
|
|
2042
|
-
* @param event - The originating pointer event.
|
|
2043
|
-
* @param info - An {@link TapInfo} object containing `x` and `y` values for the `point` relative to the device or page.
|
|
2044
|
-
*/
|
|
2045
|
-
onTapCancel?(event: MouseEvent | TouchEvent | PointerEvent, info: TapInfo): void;
|
|
2046
|
-
/**
|
|
2047
|
-
* Properties or variant label to animate to while the component is pressed.
|
|
2048
|
-
*
|
|
2049
|
-
* ```jsx
|
|
2050
|
-
* <motion.div whileTap={{ scale: 0.8 }} />
|
|
2051
|
-
* ```
|
|
2052
|
-
*/
|
|
2053
|
-
whileTap?: VariantLabels | TargetAndTransition;
|
|
2054
|
-
/**
|
|
2055
|
-
* If `true`, the tap gesture will attach its start listener to window.
|
|
2056
|
-
*
|
|
2057
|
-
* Note: This is not supported publically.
|
|
2058
|
-
*/
|
|
2059
|
-
globalTapTarget?: boolean;
|
|
2060
|
-
}
|
|
2061
|
-
/**
|
|
2062
|
-
* @public
|
|
2063
|
-
*/
|
|
2064
|
-
interface PanHandlers {
|
|
2065
|
-
/**
|
|
2066
|
-
* Callback function that fires when the pan gesture is recognised on this element.
|
|
2067
|
-
*
|
|
2068
|
-
* **Note:** For pan gestures to work correctly with touch input, the element needs
|
|
2069
|
-
* touch scrolling to be disabled on either x/y or both axis with the
|
|
2070
|
-
* [touch-action](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) CSS rule.
|
|
2071
|
-
*
|
|
2072
|
-
* ```jsx
|
|
2073
|
-
* function onPan(event, info) {
|
|
2074
|
-
* console.log(info.point.x, info.point.y)
|
|
2075
|
-
* }
|
|
2076
|
-
*
|
|
2077
|
-
* <motion.div onPan={onPan} />
|
|
2078
|
-
* ```
|
|
2079
|
-
*
|
|
2080
|
-
* @param event - The originating pointer event.
|
|
2081
|
-
* @param info - A {@link PanInfo} object containing `x` and `y` values for:
|
|
2082
|
-
*
|
|
2083
|
-
* - `point`: Relative to the device or page.
|
|
2084
|
-
* - `delta`: Distance moved since the last event.
|
|
2085
|
-
* - `offset`: Offset from the original pan event.
|
|
2086
|
-
* - `velocity`: Current velocity of the pointer.
|
|
2087
|
-
*/
|
|
2088
|
-
onPan?(event: PointerEvent, info: PanInfo): void;
|
|
2089
|
-
/**
|
|
2090
|
-
* Callback function that fires when the pan gesture begins on this element.
|
|
2091
|
-
*
|
|
2092
|
-
* ```jsx
|
|
2093
|
-
* function onPanStart(event, info) {
|
|
2094
|
-
* console.log(info.point.x, info.point.y)
|
|
2095
|
-
* }
|
|
2096
|
-
*
|
|
2097
|
-
* <motion.div onPanStart={onPanStart} />
|
|
2098
|
-
* ```
|
|
2099
|
-
*
|
|
2100
|
-
* @param event - The originating pointer event.
|
|
2101
|
-
* @param info - A {@link PanInfo} object containing `x`/`y` values for:
|
|
2102
|
-
*
|
|
2103
|
-
* - `point`: Relative to the device or page.
|
|
2104
|
-
* - `delta`: Distance moved since the last event.
|
|
2105
|
-
* - `offset`: Offset from the original pan event.
|
|
2106
|
-
* - `velocity`: Current velocity of the pointer.
|
|
2107
|
-
*/
|
|
2108
|
-
onPanStart?(event: PointerEvent, info: PanInfo): void;
|
|
2109
|
-
/**
|
|
2110
|
-
* Callback function that fires when we begin detecting a pan gesture. This
|
|
2111
|
-
* is analogous to `onMouseStart` or `onTouchStart`.
|
|
2112
|
-
*
|
|
2113
|
-
* ```jsx
|
|
2114
|
-
* function onPanSessionStart(event, info) {
|
|
2115
|
-
* console.log(info.point.x, info.point.y)
|
|
2116
|
-
* }
|
|
2117
|
-
*
|
|
2118
|
-
* <motion.div onPanSessionStart={onPanSessionStart} />
|
|
2119
|
-
* ```
|
|
2120
|
-
*
|
|
2121
|
-
* @param event - The originating pointer event.
|
|
2122
|
-
* @param info - An {@link EventInfo} object containing `x`/`y` values for:
|
|
2123
|
-
*
|
|
2124
|
-
* - `point`: Relative to the device or page.
|
|
2125
|
-
*/
|
|
2126
|
-
onPanSessionStart?(event: PointerEvent, info: EventInfo): void;
|
|
2127
|
-
/**
|
|
2128
|
-
* Callback function that fires when the pan gesture ends on this element.
|
|
2129
|
-
*
|
|
2130
|
-
* ```jsx
|
|
2131
|
-
* function onPanEnd(event, info) {
|
|
2132
|
-
* console.log(info.point.x, info.point.y)
|
|
2133
|
-
* }
|
|
2134
|
-
*
|
|
2135
|
-
* <motion.div onPanEnd={onPanEnd} />
|
|
2136
|
-
* ```
|
|
2137
|
-
*
|
|
2138
|
-
* @param event - The originating pointer event.
|
|
2139
|
-
* @param info - A {@link PanInfo} object containing `x`/`y` values for:
|
|
2140
|
-
*
|
|
2141
|
-
* - `point`: Relative to the device or page.
|
|
2142
|
-
* - `delta`: Distance moved since the last event.
|
|
2143
|
-
* - `offset`: Offset from the original pan event.
|
|
2144
|
-
* - `velocity`: Current velocity of the pointer.
|
|
2145
|
-
*/
|
|
2146
|
-
onPanEnd?(event: PointerEvent, info: PanInfo): void;
|
|
2147
|
-
}
|
|
2148
|
-
/**
|
|
2149
|
-
* @public
|
|
2150
|
-
*/
|
|
2151
|
-
interface HoverHandlers {
|
|
2152
|
-
/**
|
|
2153
|
-
* Properties or variant label to animate to while the hover gesture is recognised.
|
|
2154
|
-
*
|
|
2155
|
-
* ```jsx
|
|
2156
|
-
* <motion.div whileHover={{ scale: 1.2 }} />
|
|
2157
|
-
* ```
|
|
2158
|
-
*/
|
|
2159
|
-
whileHover?: VariantLabels | TargetAndTransition;
|
|
2160
|
-
/**
|
|
2161
|
-
* Callback function that fires when pointer starts hovering over the component.
|
|
2162
|
-
*
|
|
2163
|
-
* ```jsx
|
|
2164
|
-
* <motion.div onHoverStart={() => console.log('Hover starts')} />
|
|
2165
|
-
* ```
|
|
2166
|
-
*/
|
|
2167
|
-
onHoverStart?(event: MouseEvent, info: EventInfo): void;
|
|
2168
|
-
/**
|
|
2169
|
-
* Callback function that fires when pointer stops hovering over the component.
|
|
2170
|
-
*
|
|
2171
|
-
* ```jsx
|
|
2172
|
-
* <motion.div onHoverEnd={() => console.log("Hover ends")} />
|
|
2173
|
-
* ```
|
|
2174
|
-
*/
|
|
2175
|
-
onHoverEnd?(event: MouseEvent, info: EventInfo): void;
|
|
2176
|
-
}
|
|
2177
|
-
|
|
2178
|
-
/**
|
|
2179
|
-
* @public
|
|
2180
|
-
*/
|
|
2181
|
-
interface LayoutProps {
|
|
2182
|
-
/**
|
|
2183
|
-
* If `true`, this component will automatically animate to its new position when
|
|
2184
|
-
* its layout changes.
|
|
2185
|
-
*
|
|
2186
|
-
* ```jsx
|
|
2187
|
-
* <motion.div layout />
|
|
2188
|
-
* ```
|
|
2189
|
-
*
|
|
2190
|
-
* This will perform a layout animation using performant transforms. Part of this technique
|
|
2191
|
-
* involved animating an element's scale. This can introduce visual distortions on children,
|
|
2192
|
-
* `boxShadow` and `borderRadius`.
|
|
2193
|
-
*
|
|
2194
|
-
* To correct distortion on immediate children, add `layout` to those too.
|
|
2195
|
-
*
|
|
2196
|
-
* `boxShadow` and `borderRadius` will automatically be corrected if they are already being
|
|
2197
|
-
* animated on this component. Otherwise, set them directly via the `initial` prop.
|
|
2198
|
-
*
|
|
2199
|
-
* If `layout` is set to `"position"`, the size of the component will change instantly and
|
|
2200
|
-
* only its position will animate.
|
|
2201
|
-
*
|
|
2202
|
-
* If `layout` is set to `"size"`, the position of the component will change instantly and
|
|
2203
|
-
* only its size will animate.
|
|
2204
|
-
*
|
|
2205
|
-
* If `layout` is set to `"preserve-aspect"`, the component will animate size & position if
|
|
2206
|
-
* the aspect ratio remains the same between renders, and just position if the ratio changes.
|
|
2207
|
-
*
|
|
2208
|
-
* @public
|
|
2209
|
-
*/
|
|
2210
|
-
layout?: boolean | "position" | "size" | "preserve-aspect";
|
|
2211
|
-
/**
|
|
2212
|
-
* Enable shared layout transitions between different components with the same `layoutId`.
|
|
2213
|
-
*
|
|
2214
|
-
* When a component with a layoutId is removed from the React tree, and then
|
|
2215
|
-
* added elsewhere, it will visually animate from the previous component's bounding box
|
|
2216
|
-
* and its latest animated values.
|
|
2217
|
-
*
|
|
2218
|
-
* ```jsx
|
|
2219
|
-
* {items.map(item => (
|
|
2220
|
-
* <motion.li layout>
|
|
2221
|
-
* {item.name}
|
|
2222
|
-
* {item.isSelected && <motion.div layoutId="underline" />}
|
|
2223
|
-
* </motion.li>
|
|
2224
|
-
* ))}
|
|
2225
|
-
* ```
|
|
2226
|
-
*
|
|
2227
|
-
* If the previous component remains in the tree it will crossfade with the new component.
|
|
2228
|
-
*
|
|
2229
|
-
* @public
|
|
2230
|
-
*/
|
|
2231
|
-
layoutId?: string;
|
|
2232
|
-
/**
|
|
2233
|
-
* A callback that will fire when a layout animation on this component starts.
|
|
2234
|
-
*
|
|
2235
|
-
* @public
|
|
2236
|
-
*/
|
|
2237
|
-
onLayoutAnimationStart?(): void;
|
|
2238
|
-
/**
|
|
2239
|
-
* A callback that will fire when a layout animation on this component completes.
|
|
2240
|
-
*
|
|
2241
|
-
* @public
|
|
2242
|
-
*/
|
|
2243
|
-
onLayoutAnimationComplete?(): void;
|
|
2244
|
-
/**
|
|
2245
|
-
* @public
|
|
2246
|
-
*/
|
|
2247
|
-
layoutDependency?: any;
|
|
2248
|
-
/**
|
|
2249
|
-
* Whether a projection node should measure its scroll when it or its descendants update their layout.
|
|
2250
|
-
*
|
|
2251
|
-
* @public
|
|
2252
|
-
*/
|
|
2253
|
-
layoutScroll?: boolean;
|
|
2254
|
-
/**
|
|
2255
|
-
* Whether an element should be considered a "layout root", where
|
|
2256
|
-
* all children will be forced to resolve relatively to it.
|
|
2257
|
-
* Currently used for `position: sticky` elements in Framer.
|
|
2258
|
-
*/
|
|
2259
|
-
layoutRoot?: boolean;
|
|
2260
|
-
/**
|
|
2261
|
-
* Attached to a portal root to ensure we attach the child to the document root and don't
|
|
2262
|
-
* perform scale correction on it.
|
|
2263
|
-
*/
|
|
2264
|
-
"data-framer-portal-id"?: string;
|
|
2265
|
-
}
|
|
2266
|
-
|
|
2267
|
-
type ViewportEventHandler = (entry: IntersectionObserverEntry | null) => void;
|
|
2268
|
-
interface ViewportOptions {
|
|
2269
|
-
root?: RefObject<Element | null>;
|
|
2270
|
-
once?: boolean;
|
|
2271
|
-
margin?: string;
|
|
2272
|
-
amount?: "some" | "all" | number;
|
|
2273
|
-
}
|
|
2274
|
-
interface ViewportProps {
|
|
2275
|
-
whileInView?: VariantLabels | TargetAndTransition;
|
|
2276
|
-
onViewportEnter?: ViewportEventHandler;
|
|
2277
|
-
onViewportLeave?: ViewportEventHandler;
|
|
2278
|
-
viewport?: ViewportOptions;
|
|
2279
|
-
}
|
|
2280
|
-
|
|
2281
|
-
/**
|
|
2282
|
-
* Either a string, or array of strings, that reference variants defined via the `variants` prop.
|
|
2283
|
-
* @public
|
|
2284
|
-
*/
|
|
2285
|
-
type VariantLabels = string | string[];
|
|
2286
|
-
|
|
2287
|
-
type MakeMotion<T> = {
|
|
2288
|
-
[K in keyof T]: T[K] | MotionValue<number> | MotionValue<string> | MotionValue<any>;
|
|
2289
|
-
};
|
|
2290
|
-
type MotionCSS = MakeMotion<Omit$1<CSSProperties, "rotate" | "scale" | "perspective">>;
|
|
2291
|
-
/**
|
|
2292
|
-
* @public
|
|
2293
|
-
*/
|
|
2294
|
-
type MotionTransform = MakeMotion<TransformProperties>;
|
|
2295
|
-
/**
|
|
2296
|
-
* @public
|
|
2297
|
-
*/
|
|
2298
|
-
type MotionStyle = MotionCSS & MotionTransform & MakeMotion<SVGPathProperties>;
|
|
2299
|
-
/**
|
|
2300
|
-
* @public
|
|
2301
|
-
*/
|
|
2302
|
-
interface AnimationProps {
|
|
2303
|
-
/**
|
|
2304
|
-
* Properties, variant label or array of variant labels to start in.
|
|
2305
|
-
*
|
|
2306
|
-
* Set to `false` to initialise with the values in `animate` (disabling the mount animation)
|
|
2307
|
-
*
|
|
2308
|
-
* ```jsx
|
|
2309
|
-
* // As values
|
|
2310
|
-
* <motion.div initial={{ opacity: 1 }} />
|
|
2311
|
-
*
|
|
2312
|
-
* // As variant
|
|
2313
|
-
* <motion.div initial="visible" variants={variants} />
|
|
2314
|
-
*
|
|
2315
|
-
* // Multiple variants
|
|
2316
|
-
* <motion.div initial={["visible", "active"]} variants={variants} />
|
|
2317
|
-
*
|
|
2318
|
-
* // As false (disable mount animation)
|
|
2319
|
-
* <motion.div initial={false} animate={{ opacity: 0 }} />
|
|
2320
|
-
* ```
|
|
2321
|
-
*/
|
|
2322
|
-
initial?: TargetAndTransition | VariantLabels | boolean;
|
|
2323
|
-
/**
|
|
2324
|
-
* Values to animate to, variant label(s), or `AnimationControls`.
|
|
2325
|
-
*
|
|
2326
|
-
* ```jsx
|
|
2327
|
-
* // As values
|
|
2328
|
-
* <motion.div animate={{ opacity: 1 }} />
|
|
2329
|
-
*
|
|
2330
|
-
* // As variant
|
|
2331
|
-
* <motion.div animate="visible" variants={variants} />
|
|
2332
|
-
*
|
|
2333
|
-
* // Multiple variants
|
|
2334
|
-
* <motion.div animate={["visible", "active"]} variants={variants} />
|
|
2335
|
-
*
|
|
2336
|
-
* // AnimationControls
|
|
2337
|
-
* <motion.div animate={animation} />
|
|
2338
|
-
* ```
|
|
2339
|
-
*/
|
|
2340
|
-
animate?: AnimationControls | TargetAndTransition | VariantLabels | boolean;
|
|
2341
|
-
/**
|
|
2342
|
-
* A target to animate to when this component is removed from the tree.
|
|
2343
|
-
*
|
|
2344
|
-
* This component **must** be the first animatable child of an `AnimatePresence` to enable this exit animation.
|
|
2345
|
-
*
|
|
2346
|
-
* This limitation exists because React doesn't allow components to defer unmounting until after
|
|
2347
|
-
* an animation is complete. Once this limitation is fixed, the `AnimatePresence` component will be unnecessary.
|
|
2348
|
-
*
|
|
2349
|
-
* ```jsx
|
|
2350
|
-
* import { AnimatePresence, motion } from 'framer-motion'
|
|
2351
|
-
*
|
|
2352
|
-
* export const MyComponent = ({ isVisible }) => {
|
|
2353
|
-
* return (
|
|
2354
|
-
* <AnimatePresence>
|
|
2355
|
-
* {isVisible && (
|
|
2356
|
-
* <motion.div
|
|
2357
|
-
* initial={{ opacity: 0 }}
|
|
2358
|
-
* animate={{ opacity: 1 }}
|
|
2359
|
-
* exit={{ opacity: 0 }}
|
|
2360
|
-
* />
|
|
2361
|
-
* )}
|
|
2362
|
-
* </AnimatePresence>
|
|
2363
|
-
* )
|
|
2364
|
-
* }
|
|
2365
|
-
* ```
|
|
2366
|
-
*/
|
|
2367
|
-
exit?: TargetAndTransition | VariantLabels;
|
|
2368
|
-
/**
|
|
2369
|
-
* Variants allow you to define animation states and organise them by name. They allow
|
|
2370
|
-
* you to control animations throughout a component tree by switching a single `animate` prop.
|
|
2371
|
-
*
|
|
2372
|
-
* Using `transition` options like `delayChildren` and `staggerChildren`, you can orchestrate
|
|
2373
|
-
* when children animations play relative to their parent.
|
|
2374
|
-
|
|
2375
|
-
*
|
|
2376
|
-
* After passing variants to one or more `motion` component's `variants` prop, these variants
|
|
2377
|
-
* can be used in place of values on the `animate`, `initial`, `whileFocus`, `whileTap` and `whileHover` props.
|
|
2378
|
-
*
|
|
2379
|
-
* ```jsx
|
|
2380
|
-
* const variants = {
|
|
2381
|
-
* active: {
|
|
2382
|
-
* backgroundColor: "#f00"
|
|
2383
|
-
* },
|
|
2384
|
-
* inactive: {
|
|
2385
|
-
* backgroundColor: "#fff",
|
|
2386
|
-
* transition: { duration: 2 }
|
|
2387
|
-
* }
|
|
2388
|
-
* }
|
|
2389
|
-
*
|
|
2390
|
-
* <motion.div variants={variants} animate="active" />
|
|
2391
|
-
* ```
|
|
2392
|
-
*/
|
|
2393
|
-
variants?: Variants;
|
|
2394
|
-
/**
|
|
2395
|
-
* Default transition. If no `transition` is defined in `animate`, it will use the transition defined here.
|
|
2396
|
-
* ```jsx
|
|
2397
|
-
* const spring = {
|
|
2398
|
-
* type: "spring",
|
|
2399
|
-
* damping: 10,
|
|
2400
|
-
* stiffness: 100
|
|
2401
|
-
* }
|
|
2402
|
-
*
|
|
2403
|
-
* <motion.div transition={spring} animate={{ scale: 1.2 }} />
|
|
2404
|
-
* ```
|
|
2405
|
-
*/
|
|
2406
|
-
transition?: Transition;
|
|
2407
|
-
}
|
|
2408
|
-
/**
|
|
2409
|
-
* @public
|
|
2410
|
-
*/
|
|
2411
|
-
interface MotionAdvancedProps {
|
|
2412
|
-
/**
|
|
2413
|
-
* Custom data to use to resolve dynamic variants differently for each animating component.
|
|
2414
|
-
*
|
|
2415
|
-
* ```jsx
|
|
2416
|
-
* const variants = {
|
|
2417
|
-
* visible: (custom) => ({
|
|
2418
|
-
* opacity: 1,
|
|
2419
|
-
* transition: { delay: custom * 0.2 }
|
|
2420
|
-
* })
|
|
2421
|
-
* }
|
|
2422
|
-
*
|
|
2423
|
-
* <motion.div custom={0} animate="visible" variants={variants} />
|
|
2424
|
-
* <motion.div custom={1} animate="visible" variants={variants} />
|
|
2425
|
-
* <motion.div custom={2} animate="visible" variants={variants} />
|
|
2426
|
-
* ```
|
|
2427
|
-
*
|
|
2428
|
-
* @public
|
|
2429
|
-
*/
|
|
2430
|
-
custom?: any;
|
|
2431
|
-
/**
|
|
2432
|
-
* @public
|
|
2433
|
-
* Set to `false` to prevent inheriting variant changes from its parent.
|
|
2434
|
-
*/
|
|
2435
|
-
inherit?: boolean;
|
|
2436
|
-
/**
|
|
2437
|
-
* @public
|
|
2438
|
-
* Set to `false` to prevent throwing an error when a `motion` component is used within a `LazyMotion` set to strict.
|
|
2439
|
-
*/
|
|
2440
|
-
ignoreStrict?: boolean;
|
|
2441
|
-
}
|
|
2442
|
-
/**
|
|
2443
|
-
* Props for `motion` components.
|
|
2444
|
-
*
|
|
2445
|
-
* @public
|
|
2446
|
-
*/
|
|
2447
|
-
interface MotionProps extends AnimationProps, EventProps, PanHandlers, TapHandlers, HoverHandlers, FocusHandlers, ViewportProps, DraggableProps, LayoutProps, MotionAdvancedProps {
|
|
2448
|
-
/**
|
|
2449
|
-
*
|
|
2450
|
-
* The React DOM `style` prop, enhanced with support for `MotionValue`s and separate `transform` values.
|
|
2451
|
-
*
|
|
2452
|
-
* ```jsx
|
|
2453
|
-
* export const MyComponent = () => {
|
|
2454
|
-
* const x = useMotionValue(0)
|
|
2455
|
-
*
|
|
2456
|
-
* return <motion.div style={{ x, opacity: 1, scale: 0.5 }} />
|
|
2457
|
-
* }
|
|
2458
|
-
* ```
|
|
2459
|
-
*/
|
|
2460
|
-
style?: MotionStyle;
|
|
2461
|
-
/**
|
|
2462
|
-
* By default, Motion generates a `transform` property with a sensible transform order. `transformTemplate`
|
|
2463
|
-
* can be used to create a different order, or to append/preprend the automatically generated `transform` property.
|
|
2464
|
-
*
|
|
2465
|
-
* ```jsx
|
|
2466
|
-
* <motion.div
|
|
2467
|
-
* style={{ x: 0, rotate: 180 }}
|
|
2468
|
-
* transformTemplate={
|
|
2469
|
-
* ({ x, rotate }) => `rotate(${rotate}deg) translateX(${x}px)`
|
|
2470
|
-
* }
|
|
2471
|
-
* />
|
|
2472
|
-
* ```
|
|
2473
|
-
*
|
|
2474
|
-
* @param transform - The latest animated transform props.
|
|
2475
|
-
* @param generatedTransform - The transform string as automatically generated by Motion
|
|
2476
|
-
*
|
|
2477
|
-
* @public
|
|
2478
|
-
*/
|
|
2479
|
-
transformTemplate?(transform: TransformProperties, generatedTransform: string): string;
|
|
2480
|
-
children?: React.ReactNode | MotionValue<number> | MotionValue<string>;
|
|
2481
|
-
"data-framer-appear-id"?: string;
|
|
2482
|
-
}
|
|
2483
|
-
|
|
2484
|
-
type ResolveKeyframes<V extends string | number> = (keyframes: V[], onComplete: OnKeyframesResolved<V>, name?: string, motionValue?: any) => KeyframeResolver<V>;
|
|
2485
|
-
type AnimationDefinition = VariantLabels | TargetAndTransition | TargetResolver;
|
|
2486
|
-
/**
|
|
2487
|
-
* @public
|
|
2488
|
-
*/
|
|
2489
|
-
interface AnimationControls {
|
|
2490
|
-
/**
|
|
2491
|
-
* Starts an animation on all linked components.
|
|
2492
|
-
*
|
|
2493
|
-
* @remarks
|
|
2494
|
-
*
|
|
2495
|
-
* ```jsx
|
|
2496
|
-
* controls.start("variantLabel")
|
|
2497
|
-
* controls.start({
|
|
2498
|
-
* x: 0,
|
|
2499
|
-
* transition: { duration: 1 }
|
|
2500
|
-
* })
|
|
2501
|
-
* ```
|
|
2502
|
-
*
|
|
2503
|
-
* @param definition - Properties or variant label to animate to
|
|
2504
|
-
* @param transition - Optional `transition` to apply to a variant
|
|
2505
|
-
* @returns - A `Promise` that resolves when all animations have completed.
|
|
2506
|
-
*
|
|
2507
|
-
* @public
|
|
2508
|
-
*/
|
|
2509
|
-
start(definition: AnimationDefinition, transitionOverride?: Transition$1): Promise<any>;
|
|
2510
|
-
/**
|
|
2511
|
-
* Instantly set to a set of properties or a variant.
|
|
2512
|
-
*
|
|
2513
|
-
* ```jsx
|
|
2514
|
-
* // With properties
|
|
2515
|
-
* controls.set({ opacity: 0 })
|
|
2516
|
-
*
|
|
2517
|
-
* // With variants
|
|
2518
|
-
* controls.set("hidden")
|
|
2519
|
-
* ```
|
|
2520
|
-
*
|
|
2521
|
-
* @privateRemarks
|
|
2522
|
-
* We could perform a similar trick to `.start` where this can be called before mount
|
|
2523
|
-
* and we maintain a list of of pending actions that get applied on mount. But the
|
|
2524
|
-
* expectation of `set` is that it happens synchronously and this would be difficult
|
|
2525
|
-
* to do before any children have even attached themselves. It's also poor practise
|
|
2526
|
-
* and we should discourage render-synchronous `.start` calls rather than lean into this.
|
|
2527
|
-
*
|
|
2528
|
-
* @public
|
|
2529
|
-
*/
|
|
2530
|
-
set(definition: AnimationDefinition): void;
|
|
2531
|
-
/**
|
|
2532
|
-
* Stops animations on all linked components.
|
|
2533
|
-
*
|
|
2534
|
-
* ```jsx
|
|
2535
|
-
* controls.stop()
|
|
2536
|
-
* ```
|
|
2537
|
-
*
|
|
2538
|
-
* @public
|
|
2539
|
-
*/
|
|
2540
|
-
stop(): void;
|
|
2541
|
-
mount(): () => void;
|
|
2542
|
-
}
|
|
2543
|
-
|
|
2544
|
-
declare abstract class Feature<T extends any = any> {
|
|
2545
|
-
isMounted: boolean;
|
|
2546
|
-
node: VisualElement<T>;
|
|
2547
|
-
constructor(node: VisualElement<T>);
|
|
2548
|
-
abstract mount(): void;
|
|
2549
|
-
abstract unmount(): void;
|
|
2550
|
-
update(): void;
|
|
2551
|
-
}
|
|
2552
|
-
|
|
2553
|
-
declare function MeasureLayout(props: MotionProps & {
|
|
2554
|
-
visualElement: VisualElement;
|
|
2555
|
-
}): react_jsx_runtime.JSX.Element;
|
|
2556
|
-
|
|
2557
|
-
interface FeatureClass<Props = unknown> {
|
|
2558
|
-
new (props: Props): Feature<Props>;
|
|
2559
|
-
}
|
|
2560
|
-
type HydratedFeatureDefinition = {
|
|
2561
|
-
isEnabled: (props: MotionProps) => boolean;
|
|
2562
|
-
Feature: FeatureClass<unknown>;
|
|
2563
|
-
ProjectionNode?: any;
|
|
2564
|
-
MeasureLayout?: typeof MeasureLayout;
|
|
2565
|
-
};
|
|
2566
|
-
interface HydratedFeatureDefinitions {
|
|
2567
|
-
animation?: HydratedFeatureDefinition;
|
|
2568
|
-
exit?: HydratedFeatureDefinition;
|
|
2569
|
-
drag?: HydratedFeatureDefinition;
|
|
2570
|
-
tap?: HydratedFeatureDefinition;
|
|
2571
|
-
focus?: HydratedFeatureDefinition;
|
|
2572
|
-
hover?: HydratedFeatureDefinition;
|
|
2573
|
-
pan?: HydratedFeatureDefinition;
|
|
2574
|
-
inView?: HydratedFeatureDefinition;
|
|
2575
|
-
layout?: HydratedFeatureDefinition;
|
|
2576
|
-
}
|
|
2577
|
-
type FeatureDefinition = {
|
|
2578
|
-
isEnabled: HydratedFeatureDefinition["isEnabled"];
|
|
2579
|
-
Feature?: HydratedFeatureDefinition["Feature"];
|
|
2580
|
-
ProjectionNode?: HydratedFeatureDefinition["ProjectionNode"];
|
|
2581
|
-
MeasureLayout?: HydratedFeatureDefinition["MeasureLayout"];
|
|
2582
|
-
};
|
|
2583
|
-
type FeatureDefinitions = {
|
|
2584
|
-
[K in keyof HydratedFeatureDefinitions]: FeatureDefinition;
|
|
2585
|
-
};
|
|
2586
|
-
type FeaturePackage = {
|
|
2587
|
-
Feature?: HydratedFeatureDefinition["Feature"];
|
|
2588
|
-
ProjectionNode?: HydratedFeatureDefinition["ProjectionNode"];
|
|
2589
|
-
MeasureLayout?: HydratedFeatureDefinition["MeasureLayout"];
|
|
2590
|
-
};
|
|
2591
|
-
type FeaturePackages = {
|
|
2592
|
-
[K in keyof HydratedFeatureDefinitions]: FeaturePackage;
|
|
2593
|
-
};
|
|
2594
|
-
interface FeatureBundle extends FeaturePackages {
|
|
2595
|
-
renderer: CreateVisualElement<any>;
|
|
2596
|
-
}
|
|
2597
|
-
type LazyFeatureBundle = () => Promise<FeatureBundle>;
|
|
2598
|
-
type RenderComponent<Instance, RenderState> = (Component: string | React$1.ComponentType<React$1.PropsWithChildren<unknown>>, props: MotionProps, ref: React$1.Ref<Instance>, visualState: VisualState<Instance, RenderState>, isStatic: boolean, visualElement?: VisualElement<Instance>) => any;
|
|
2599
|
-
|
|
2600
|
-
interface HTMLElements {
|
|
2601
|
-
a: HTMLAnchorElement;
|
|
2602
|
-
abbr: HTMLElement;
|
|
2603
|
-
address: HTMLElement;
|
|
2604
|
-
area: HTMLAreaElement;
|
|
2605
|
-
article: HTMLElement;
|
|
2606
|
-
aside: HTMLElement;
|
|
2607
|
-
audio: HTMLAudioElement;
|
|
2608
|
-
b: HTMLElement;
|
|
2609
|
-
base: HTMLBaseElement;
|
|
2610
|
-
bdi: HTMLElement;
|
|
2611
|
-
bdo: HTMLElement;
|
|
2612
|
-
big: HTMLElement;
|
|
2613
|
-
blockquote: HTMLQuoteElement;
|
|
2614
|
-
body: HTMLBodyElement;
|
|
2615
|
-
br: HTMLBRElement;
|
|
2616
|
-
button: HTMLButtonElement;
|
|
2617
|
-
canvas: HTMLCanvasElement;
|
|
2618
|
-
caption: HTMLElement;
|
|
2619
|
-
center: HTMLElement;
|
|
2620
|
-
cite: HTMLElement;
|
|
2621
|
-
code: HTMLElement;
|
|
2622
|
-
col: HTMLTableColElement;
|
|
2623
|
-
colgroup: HTMLTableColElement;
|
|
2624
|
-
data: HTMLDataElement;
|
|
2625
|
-
datalist: HTMLDataListElement;
|
|
2626
|
-
dd: HTMLElement;
|
|
2627
|
-
del: HTMLModElement;
|
|
2628
|
-
details: HTMLDetailsElement;
|
|
2629
|
-
dfn: HTMLElement;
|
|
2630
|
-
dialog: HTMLDialogElement;
|
|
2631
|
-
div: HTMLDivElement;
|
|
2632
|
-
dl: HTMLDListElement;
|
|
2633
|
-
dt: HTMLElement;
|
|
2634
|
-
em: HTMLElement;
|
|
2635
|
-
embed: HTMLEmbedElement;
|
|
2636
|
-
fieldset: HTMLFieldSetElement;
|
|
2637
|
-
figcaption: HTMLElement;
|
|
2638
|
-
figure: HTMLElement;
|
|
2639
|
-
footer: HTMLElement;
|
|
2640
|
-
form: HTMLFormElement;
|
|
2641
|
-
h1: HTMLHeadingElement;
|
|
2642
|
-
h2: HTMLHeadingElement;
|
|
2643
|
-
h3: HTMLHeadingElement;
|
|
2644
|
-
h4: HTMLHeadingElement;
|
|
2645
|
-
h5: HTMLHeadingElement;
|
|
2646
|
-
h6: HTMLHeadingElement;
|
|
2647
|
-
head: HTMLHeadElement;
|
|
2648
|
-
header: HTMLElement;
|
|
2649
|
-
hgroup: HTMLElement;
|
|
2650
|
-
hr: HTMLHRElement;
|
|
2651
|
-
html: HTMLHtmlElement;
|
|
2652
|
-
i: HTMLElement;
|
|
2653
|
-
iframe: HTMLIFrameElement;
|
|
2654
|
-
img: HTMLImageElement;
|
|
2655
|
-
input: HTMLInputElement;
|
|
2656
|
-
ins: HTMLModElement;
|
|
2657
|
-
kbd: HTMLElement;
|
|
2658
|
-
keygen: HTMLElement;
|
|
2659
|
-
label: HTMLLabelElement;
|
|
2660
|
-
legend: HTMLLegendElement;
|
|
2661
|
-
li: HTMLLIElement;
|
|
2662
|
-
link: HTMLLinkElement;
|
|
2663
|
-
main: HTMLElement;
|
|
2664
|
-
map: HTMLMapElement;
|
|
2665
|
-
mark: HTMLElement;
|
|
2666
|
-
menu: HTMLElement;
|
|
2667
|
-
menuitem: HTMLElement;
|
|
2668
|
-
meta: HTMLMetaElement;
|
|
2669
|
-
meter: HTMLMeterElement;
|
|
2670
|
-
nav: HTMLElement;
|
|
2671
|
-
noindex: HTMLElement;
|
|
2672
|
-
noscript: HTMLElement;
|
|
2673
|
-
object: HTMLObjectElement;
|
|
2674
|
-
ol: HTMLOListElement;
|
|
2675
|
-
optgroup: HTMLOptGroupElement;
|
|
2676
|
-
option: HTMLOptionElement;
|
|
2677
|
-
output: HTMLOutputElement;
|
|
2678
|
-
p: HTMLParagraphElement;
|
|
2679
|
-
param: HTMLParamElement;
|
|
2680
|
-
picture: HTMLElement;
|
|
2681
|
-
pre: HTMLPreElement;
|
|
2682
|
-
progress: HTMLProgressElement;
|
|
2683
|
-
q: HTMLQuoteElement;
|
|
2684
|
-
rp: HTMLElement;
|
|
2685
|
-
rt: HTMLElement;
|
|
2686
|
-
ruby: HTMLElement;
|
|
2687
|
-
s: HTMLElement;
|
|
2688
|
-
samp: HTMLElement;
|
|
2689
|
-
search: HTMLElement;
|
|
2690
|
-
slot: HTMLSlotElement;
|
|
2691
|
-
script: HTMLScriptElement;
|
|
2692
|
-
section: HTMLElement;
|
|
2693
|
-
select: HTMLSelectElement;
|
|
2694
|
-
small: HTMLElement;
|
|
2695
|
-
source: HTMLSourceElement;
|
|
2696
|
-
span: HTMLSpanElement;
|
|
2697
|
-
strong: HTMLElement;
|
|
2698
|
-
style: HTMLStyleElement;
|
|
2699
|
-
sub: HTMLElement;
|
|
2700
|
-
summary: HTMLElement;
|
|
2701
|
-
sup: HTMLElement;
|
|
2702
|
-
table: HTMLTableElement;
|
|
2703
|
-
template: HTMLTemplateElement;
|
|
2704
|
-
tbody: HTMLTableSectionElement;
|
|
2705
|
-
td: HTMLTableDataCellElement;
|
|
2706
|
-
textarea: HTMLTextAreaElement;
|
|
2707
|
-
tfoot: HTMLTableSectionElement;
|
|
2708
|
-
th: HTMLTableHeaderCellElement;
|
|
2709
|
-
thead: HTMLTableSectionElement;
|
|
2710
|
-
time: HTMLTimeElement;
|
|
2711
|
-
title: HTMLTitleElement;
|
|
2712
|
-
tr: HTMLTableRowElement;
|
|
2713
|
-
track: HTMLTrackElement;
|
|
2714
|
-
u: HTMLElement;
|
|
2715
|
-
ul: HTMLUListElement;
|
|
2716
|
-
var: HTMLElement;
|
|
2717
|
-
video: HTMLVideoElement;
|
|
2718
|
-
wbr: HTMLElement;
|
|
2719
|
-
webview: HTMLWebViewElement;
|
|
2720
|
-
}
|
|
2721
|
-
|
|
2722
|
-
interface TransformOrigin {
|
|
2723
|
-
originX?: number | string;
|
|
2724
|
-
originY?: number | string;
|
|
2725
|
-
originZ?: number | string;
|
|
2726
|
-
}
|
|
2727
|
-
interface HTMLRenderState {
|
|
2728
|
-
/**
|
|
2729
|
-
* A mutable record of transforms we want to apply directly to the rendered Element
|
|
2730
|
-
* every frame. We use a mutable data structure to reduce GC during animations.
|
|
2731
|
-
*/
|
|
2732
|
-
transform: ResolvedValues;
|
|
2733
|
-
/**
|
|
2734
|
-
* A mutable record of transform origins we want to apply directly to the rendered Element
|
|
2735
|
-
* every frame. We use a mutable data structure to reduce GC during animations.
|
|
2736
|
-
*/
|
|
2737
|
-
transformOrigin: TransformOrigin;
|
|
2738
|
-
/**
|
|
2739
|
-
* A mutable record of styles we want to apply directly to the rendered Element
|
|
2740
|
-
* every frame. We use a mutable data structure to reduce GC during animations.
|
|
2741
|
-
*/
|
|
2742
|
-
style: ResolvedValues;
|
|
2743
|
-
/**
|
|
2744
|
-
* A mutable record of CSS variables we want to apply directly to the rendered Element
|
|
2745
|
-
* every frame. We use a mutable data structure to reduce GC during animations.
|
|
2746
|
-
*/
|
|
2747
|
-
vars: ResolvedValues;
|
|
2748
|
-
}
|
|
2749
|
-
/**
|
|
2750
|
-
* @public
|
|
2751
|
-
*/
|
|
2752
|
-
type ForwardRefComponent<T, P> = {
|
|
2753
|
-
readonly $$typeof: symbol;
|
|
2754
|
-
} & ((props: PropsWithoutRef<P> & RefAttributes<T>) => JSX.Element);
|
|
2755
|
-
type AttributesWithoutMotionProps<Attributes> = {
|
|
2756
|
-
[K in Exclude<keyof Attributes, keyof MotionProps>]?: Attributes[K];
|
|
2757
|
-
};
|
|
2758
|
-
/**
|
|
2759
|
-
* @public
|
|
2760
|
-
*/
|
|
2761
|
-
type HTMLMotionProps<Tag extends keyof HTMLElements> = AttributesWithoutMotionProps<JSX.IntrinsicElements[Tag]> & MotionProps;
|
|
2762
|
-
/**
|
|
2763
|
-
* Motion-optimised versions of React's HTML components.
|
|
2764
|
-
*
|
|
2765
|
-
* @public
|
|
2766
|
-
*/
|
|
2767
|
-
type HTMLMotionComponents = {
|
|
2768
|
-
[K in keyof HTMLElements]: ForwardRefComponent<HTMLElements[K], HTMLMotionProps<K>>;
|
|
2769
|
-
};
|
|
2770
|
-
|
|
2771
|
-
type UnionStringArray<T extends Readonly<string[]>> = T[number];
|
|
2772
|
-
declare const svgElements: readonly ["animate", "circle", "defs", "desc", "ellipse", "g", "image", "line", "filter", "marker", "mask", "metadata", "path", "pattern", "polygon", "polyline", "rect", "stop", "svg", "switch", "symbol", "text", "tspan", "use", "view", "clipPath", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "foreignObject", "linearGradient", "radialGradient", "textPath"];
|
|
2773
|
-
type SVGElements = UnionStringArray<typeof svgElements>;
|
|
2774
|
-
|
|
2775
|
-
interface SVGAttributesWithoutMotionProps<T> extends Pick<SVGAttributes<T>, Exclude<keyof SVGAttributes<T>, keyof MotionProps>> {
|
|
2776
|
-
}
|
|
2777
|
-
/**
|
|
2778
|
-
* Blanket-accept any SVG attribute as a `MotionValue`
|
|
2779
|
-
* @public
|
|
2780
|
-
*/
|
|
2781
|
-
type SVGAttributesAsMotionValues<T> = MakeMotion<SVGAttributesWithoutMotionProps<T>>;
|
|
2782
|
-
type UnwrapSVGFactoryElement<F> = F extends React.SVGProps<infer P> ? P : never;
|
|
2783
|
-
/**
|
|
2784
|
-
* @public
|
|
2785
|
-
*/
|
|
2786
|
-
interface SVGMotionProps<T> extends SVGAttributesAsMotionValues<T>, MotionProps {
|
|
2787
|
-
}
|
|
2788
|
-
/**
|
|
2789
|
-
* Motion-optimised versions of React's SVG components.
|
|
2790
|
-
*
|
|
2791
|
-
* @public
|
|
2792
|
-
*/
|
|
2793
|
-
type SVGMotionComponents = {
|
|
2794
|
-
[K in SVGElements]: ForwardRefComponent<UnwrapSVGFactoryElement<JSX.IntrinsicElements[K]>, SVGMotionProps<UnwrapSVGFactoryElement<JSX.IntrinsicElements[K]>>>;
|
|
2795
|
-
};
|
|
2796
|
-
|
|
2797
|
-
interface MotionComponentConfig<Instance, RenderState> {
|
|
2798
|
-
preloadedFeatures?: FeatureBundle;
|
|
2799
|
-
createVisualElement?: CreateVisualElement<Instance>;
|
|
2800
|
-
useRender: RenderComponent<Instance, RenderState>;
|
|
2801
|
-
useVisualState: UseVisualState<Instance, RenderState>;
|
|
2802
|
-
Component: string | React$1.ComponentType<React$1.PropsWithChildren<unknown>>;
|
|
2803
|
-
}
|
|
2804
|
-
type MotionComponentProps<Props> = {
|
|
2805
|
-
[K in Exclude<keyof Props, keyof MotionProps>]?: Props[K];
|
|
2806
|
-
} & MotionProps;
|
|
2807
|
-
/**
|
|
2808
|
-
* Create a `motion` component.
|
|
2809
|
-
*
|
|
2810
|
-
* This function accepts a Component argument, which can be either a string (ie "div"
|
|
2811
|
-
* for `motion.div`), or an actual React component.
|
|
2812
|
-
*
|
|
2813
|
-
* Alongside this is a config option which provides a way of rendering the provided
|
|
2814
|
-
* component "offline", or outside the React render cycle.
|
|
2815
|
-
*/
|
|
2816
|
-
declare function createRendererMotionComponent<Props extends {}, Instance, RenderState>({ preloadedFeatures, createVisualElement, useRender, useVisualState, Component, }: MotionComponentConfig<Instance, RenderState>): React$1.ForwardRefExoticComponent<React$1.RefAttributes<unknown>>;
|
|
2817
|
-
|
|
2818
|
-
declare const optimizedAppearDataAttribute: "data-framer-appear-id";
|
|
2819
|
-
|
|
2820
|
-
/**
|
|
2821
|
-
* Expose only the needed part of the VisualElement interface to
|
|
2822
|
-
* ensure React types don't end up in the generic DOM bundle.
|
|
2823
|
-
*/
|
|
2824
|
-
interface WithAppearProps {
|
|
2825
|
-
props: {
|
|
2826
|
-
[optimizedAppearDataAttribute]?: string;
|
|
2827
|
-
values?: {
|
|
2828
|
-
[key: string]: MotionValue<number> | MotionValue<string>;
|
|
2829
|
-
};
|
|
2830
|
-
};
|
|
2831
|
-
}
|
|
2832
|
-
type HandoffFunction = (storeId: string, valueName: string, frame: Batcher) => number | null;
|
|
2833
|
-
/**
|
|
2834
|
-
* The window global object acts as a bridge between our inline script
|
|
2835
|
-
* triggering the optimized appear animations, and Motion.
|
|
2836
|
-
*/
|
|
2837
|
-
declare global {
|
|
2838
|
-
interface Window {
|
|
2839
|
-
MotionHandoffAnimation?: HandoffFunction;
|
|
2840
|
-
MotionHandoffMarkAsComplete?: (elementId: string) => void;
|
|
2841
|
-
MotionHandoffIsComplete?: (elementId: string) => boolean;
|
|
2842
|
-
MotionHasOptimisedAnimation?: (elementId?: string, valueName?: string) => boolean;
|
|
2843
|
-
MotionCancelOptimisedAnimation?: (elementId?: string, valueName?: string, frame?: Batcher, canResume?: boolean) => void;
|
|
2844
|
-
MotionCheckAppearSync?: (visualElement: WithAppearProps, valueName: string, value: MotionValue) => VoidFunction | void;
|
|
2845
|
-
MotionIsMounted?: boolean;
|
|
2846
|
-
}
|
|
2847
|
-
}
|
|
2848
|
-
|
|
2849
|
-
type DOMMotionComponents = HTMLMotionComponents & SVGMotionComponents;
|
|
2850
|
-
|
|
2851
|
-
export { type None as $, type AnimationControls as A, type MotionAdvancedProps as B, type MotionStyle as C, type DOMMotionComponents as D, type EventInfo as E, type FeatureBundle as F, type GenericKeyframesTarget as G, type HTMLMotionProps as H, type IProjectionNode as I, type MotionTransform as J, type VariantLabels as K, type LayoutProps as L, type MotionProps as M, type ForwardRefComponent as N, type SVGAttributesAsMotionValues as O, type PanInfo as P, type SVGMotionProps as Q, type ResolvedValues as R, type SVGMotionComponents as S, type TapHandlers as T, type AnimationLifecycles as U, VisualElement as V, type CreateVisualElement as W, FlatTree as X, type Inertia as Y, type Keyframes as Z, type KeyframesTarget as _, MotionConfigContext as a, type Orchestration as a0, type Repeat as a1, type ResolvedKeyframesTarget as a2, type ResolvedSingleTarget as a3, type ResolvedValueTarget as a4, type SingleTarget as a5, type Spring as a6, type Target as a7, type TargetAndTransition as a8, type Transition as a9, type Tween as aa, type ValueTarget as ab, type Variant as ac, type Variants as ad, type ResolveKeyframes as ae, type HydratedFeatureDefinition as af, type HydratedFeatureDefinitions as ag, type FeatureDefinition as ah, type FeatureDefinitions as ai, type FeaturePackage as aj, type LazyFeatureBundle as ak, type RenderComponent as al, type HTMLElements as b, type MotionComponentProps as c, type HTMLMotionComponents as d, type FeaturePackages as e, type AnimationDefinition as f, type VisualElementAnimationOptions as g, type HTMLRenderState as h, type ScrapeMotionValuesFromProps as i, type VisualState as j, type AnimationType as k, DragControls as l, makeUseVisualState as m, type FocusHandlers as n, type HoverHandlers as o, type PanHandlers as p, type TapInfo as q, createRendererMotionComponent as r, optimizedAppearDataAttribute as s, PresenceContext as t, useDragControls as u, SwitchLayoutGroupContext as v, type DragElastic as w, type DraggableProps as x, type DragHandlers as y, type AnimationProps as z };
|