UNPKG

175 kBTypeScriptView Raw
1/// <reference types="react" />
2import * as React$1 from 'react';
3import { SVGAttributes as SVGAttributes$1, CSSProperties, PropsWithoutRef, RefAttributes, JSX, useEffect, RefObject as RefObject$1 } from 'react';
4import * as react_jsx_runtime from 'react/jsx-runtime';
5export { invariant, noop } from 'motion-utils';
6import * as motion_dom from 'motion-dom';
7import { ElementOrSelector, AnimationScope } from 'motion-dom';
8export { isDragActive } from 'motion-dom';
9
10type EasingFunction = (v: number) => number;
11type EasingModifier = (easing: EasingFunction) => EasingFunction;
12type BezierDefinition = readonly [number, number, number, number];
13type EasingDefinition = BezierDefinition | "linear" | "easeIn" | "easeOut" | "easeInOut" | "circIn" | "circOut" | "circInOut" | "backIn" | "backOut" | "backInOut" | "anticipate";
14/**
15 * The easing function to use. Set as one of:
16 *
17 * - The name of an in-built easing function.
18 * - An array of four numbers to define a cubic bezier curve.
19 * - An easing function, that accepts and returns a progress value between `0` and `1`.
20 *
21 * @public
22 */
23type Easing = EasingDefinition | EasingFunction;
24
25type GenericKeyframesTarget<V> = V[] | Array<null | V>;
26/**
27 * @public
28 */
29type ResolvedKeyframesTarget = GenericKeyframesTarget<number> | GenericKeyframesTarget<string>;
30/**
31 * @public
32 */
33type KeyframesTarget = ResolvedKeyframesTarget | GenericKeyframesTarget<CustomValueType>;
34/**
35 * @public
36 */
37type ResolvedSingleTarget = string | number;
38/**
39 * @public
40 */
41type SingleTarget = ResolvedSingleTarget | CustomValueType;
42/**
43 * @public
44 */
45type ResolvedValueTarget = ResolvedSingleTarget | ResolvedKeyframesTarget;
46/**
47 * @public
48 */
49type ValueTarget = SingleTarget | KeyframesTarget;
50/**
51 * Options for orchestrating the timing of animations.
52 *
53 * @public
54 */
55interface Orchestration {
56 /**
57 * Delay the animation by this duration (in seconds). Defaults to `0`.
58 *
59 * @remarks
60 * ```javascript
61 * const transition = {
62 * delay: 0.2
63 * }
64 * ```
65 *
66 * @public
67 */
68 delay?: number;
69 /**
70 * Describes the relationship between the transition and its children. Set
71 * to `false` by default.
72 *
73 * @remarks
74 * When using variants, the transition can be scheduled in relation to its
75 * children with either `"beforeChildren"` to finish this transition before
76 * starting children transitions, `"afterChildren"` to finish children
77 * transitions before starting this transition.
78 *
79 * ```jsx
80 * const list = {
81 * hidden: {
82 * opacity: 0,
83 * transition: { when: "afterChildren" }
84 * }
85 * }
86 *
87 * const item = {
88 * hidden: {
89 * opacity: 0,
90 * transition: { duration: 2 }
91 * }
92 * }
93 *
94 * return (
95 * <motion.ul variants={list} animate="hidden">
96 * <motion.li variants={item} />
97 * <motion.li variants={item} />
98 * </motion.ul>
99 * )
100 * ```
101 *
102 * @public
103 */
104 when?: false | "beforeChildren" | "afterChildren" | string;
105 /**
106 * When using variants, children animations will start after this duration
107 * (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.
108 *
109 * ```jsx
110 * const container = {
111 * hidden: { opacity: 0 },
112 * show: {
113 * opacity: 1,
114 * transition: {
115 * delayChildren: 0.5
116 * }
117 * }
118 * }
119 *
120 * const item = {
121 * hidden: { opacity: 0 },
122 * show: { opacity: 1 }
123 * }
124 *
125 * return (
126 * <motion.ul
127 * variants={container}
128 * initial="hidden"
129 * animate="show"
130 * >
131 * <motion.li variants={item} />
132 * <motion.li variants={item} />
133 * </motion.ul>
134 * )
135 * ```
136 *
137 * @public
138 */
139 delayChildren?: number;
140 /**
141 * When using variants, animations of child components can be staggered by this
142 * duration (in seconds).
143 *
144 * For instance, if `staggerChildren` is `0.01`, the first child will be
145 * delayed by `0` seconds, the second by `0.01`, the third by `0.02` and so
146 * on.
147 *
148 * The calculated stagger delay will be added to `delayChildren`.
149 *
150 * ```jsx
151 * const container = {
152 * hidden: { opacity: 0 },
153 * show: {
154 * opacity: 1,
155 * transition: {
156 * staggerChildren: 0.5
157 * }
158 * }
159 * }
160 *
161 * const item = {
162 * hidden: { opacity: 0 },
163 * show: { opacity: 1 }
164 * }
165 *
166 * return (
167 * <motion.ol
168 * variants={container}
169 * initial="hidden"
170 * animate="show"
171 * >
172 * <motion.li variants={item} />
173 * <motion.li variants={item} />
174 * </motion.ol>
175 * )
176 * ```
177 *
178 * @public
179 */
180 staggerChildren?: number;
181 /**
182 * The direction in which to stagger children.
183 *
184 * A value of `1` staggers from the first to the last while `-1`
185 * staggers from the last to the first.
186 *
187 * ```jsx
188 * const container = {
189 * hidden: { opacity: 0 },
190 * show: {
191 * opacity: 1,
192 * transition: {
193 * staggerChildren: 0.5,
194 * staggerDirection: -1
195 * }
196 * }
197 * }
198 *
199 * const item = {
200 * hidden: { opacity: 0 },
201 * show: { opacity: 1 }
202 * }
203 *
204 * return (
205 * <motion.ul
206 * variants={container}
207 * initial="hidden"
208 * animate="show"
209 * >
210 * <motion.li variants={item} size={50} />
211 * <motion.li variants={item} size={50} />
212 * </motion.ul>
213 * )
214 * ```
215 *
216 * @public
217 */
218 staggerDirection?: number;
219}
220interface Repeat {
221 /**
222 * The number of times to repeat the transition. Set to `Infinity` for perpetual repeating.
223 *
224 * Without setting `repeatType`, this will loop the animation.
225 *
226 * ```jsx
227 * <motion.div
228 * animate={{ rotate: 180 }}
229 * transition={{ repeat: Infinity, duration: 2 }}
230 * />
231 * ```
232 *
233 * @public
234 */
235 repeat?: number;
236 /**
237 * How to repeat the animation. This can be either:
238 *
239 * "loop": Repeats the animation from the start
240 *
241 * "reverse": Alternates between forward and backwards playback
242 *
243 * "mirror": Switches `from` and `to` alternately
244 *
245 * ```jsx
246 * <motion.div
247 * animate={{ rotate: 180 }}
248 * transition={{
249 * repeat: 1,
250 * repeatType: "reverse",
251 * duration: 2
252 * }}
253 * />
254 * ```
255 *
256 * @public
257 */
258 repeatType?: "loop" | "reverse" | "mirror";
259 /**
260 * When repeating an animation, `repeatDelay` will set the
261 * duration of the time to wait, in seconds, between each repetition.
262 *
263 * ```jsx
264 * <motion.div
265 * animate={{ rotate: 180 }}
266 * transition={{ repeat: Infinity, repeatDelay: 1 }}
267 * />
268 * ```
269 *
270 * @public
271 */
272 repeatDelay?: number;
273}
274/**
275 * An animation that animates between two or more values over a specific duration of time.
276 * This is the default animation for non-physical values like `color` and `opacity`.
277 *
278 * @public
279 */
280interface Tween extends Repeat {
281 /**
282 * Set `type` to `"tween"` to use a duration-based tween animation.
283 * If any non-orchestration `transition` values are set without a `type` property,
284 * this is used as the default animation.
285 *
286 * ```jsx
287 * <motion.path
288 * animate={{ pathLength: 1 }}
289 * transition={{ duration: 2, type: "tween" }}
290 * />
291 * ```
292 *
293 * @public
294 */
295 type?: "tween";
296 /**
297 * The duration of the tween animation. Set to `0.3` by default, 0r `0.8` if animating a series of keyframes.
298 *
299 * ```jsx
300 * const variants = {
301 * visible: {
302 * opacity: 1,
303 * transition: { duration: 2 }
304 * }
305 * }
306 * ```
307 *
308 * @public
309 */
310 duration?: number;
311 /**
312 * The easing function to use. Set as one of the below.
313 *
314 * - The name of an existing easing function.
315 *
316 * - An array of four numbers to define a cubic bezier curve.
317 *
318 * - An easing function, that accepts and returns a value `0-1`.
319 *
320 * If the animating value is set as an array of multiple values for a keyframes
321 * animation, `ease` can be set as an array of easing functions to set different easings between
322 * each of those values.
323 *
324 *
325 * ```jsx
326 * <motion.div
327 * animate={{ opacity: 0 }}
328 * transition={{ ease: [0.17, 0.67, 0.83, 0.67] }}
329 * />
330 * ```
331 *
332 * @public
333 */
334 ease?: Easing | Easing[];
335 /**
336 * When animating keyframes, `times` can be used to determine where in the animation each keyframe is reached.
337 * Each value in `times` is a value between `0` and `1`, representing `duration`.
338 *
339 * There must be the same number of `times` as there are keyframes.
340 * Defaults to an array of evenly-spread durations.
341 *
342 * ```jsx
343 * <motion.div
344 * animate={{ scale: [0, 1, 0.5, 1] }}
345 * transition={{ times: [0, 0.1, 0.9, 1] }}
346 * />
347 * ```
348 *
349 * @public
350 */
351 times?: number[];
352 /**
353 * 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.
354 *
355 * ```jsx
356 * <motion.div
357 * animate={{ backgroundColor: ["#0f0", "#00f", "#f00"] }}
358 * transition={{ easings: ["easeIn", "easeOut"] }}
359 * />
360 * ```
361 *
362 * @public
363 */
364 easings?: Easing[];
365 /**
366 * The value to animate from.
367 * By default, this is the current state of the animating value.
368 *
369 * ```jsx
370 * <motion.div
371 * animate={{ rotate: 180 }}
372 * transition={{ from: 90, duration: 2 }}
373 * />
374 * ```
375 *
376 * @public
377 */
378 from?: number | string;
379}
380/**
381 * An animation that simulates spring physics for realistic motion.
382 * This is the default animation for physical values like `x`, `y`, `scale` and `rotate`.
383 *
384 * @public
385 */
386interface Spring extends Repeat {
387 /**
388 * Set `type` to `"spring"` to animate using spring physics for natural
389 * movement. Type is set to `"spring"` by default.
390 *
391 * ```jsx
392 * <motion.div
393 * animate={{ rotate: 180 }}
394 * transition={{ type: 'spring' }}
395 * />
396 * ```
397 *
398 * @public
399 */
400 type: "spring";
401 /**
402 * Stiffness of the spring. Higher values will create more sudden movement.
403 * Set to `100` by default.
404 *
405 * ```jsx
406 * <motion.section
407 * animate={{ rotate: 180 }}
408 * transition={{ type: 'spring', stiffness: 50 }}
409 * />
410 * ```
411 *
412 * @public
413 */
414 stiffness?: number;
415 /**
416 * Strength of opposing force. If set to 0, spring will oscillate
417 * indefinitely. Set to `10` by default.
418 *
419 * ```jsx
420 * <motion.a
421 * animate={{ rotate: 180 }}
422 * transition={{ type: 'spring', damping: 300 }}
423 * />
424 * ```
425 *
426 * @public
427 */
428 damping?: number;
429 /**
430 * Mass of the moving object. Higher values will result in more lethargic
431 * movement. Set to `1` by default.
432 *
433 * ```jsx
434 * <motion.feTurbulence
435 * animate={{ baseFrequency: 0.5 } as any}
436 * transition={{ type: "spring", mass: 0.5 }}
437 * />
438 * ```
439 *
440 * @public
441 */
442 mass?: number;
443 /**
444 * The duration of the animation, defined in seconds. Spring animations can be a maximum of 10 seconds.
445 *
446 * If `bounce` is set, this defaults to `0.8`.
447 *
448 * Note: `duration` and `bounce` will be overridden if `stiffness`, `damping` or `mass` are set.
449 *
450 * ```jsx
451 * <motion.div
452 * animate={{ x: 100 }}
453 * transition={{ type: "spring", duration: 0.8 }}
454 * />
455 * ```
456 *
457 * @public
458 */
459 duration?: number;
460 /**
461 * If visualDuration is set, this will override duration.
462 *
463 * The visual duration is a time, set in seconds, that the animation will take to visually appear to reach its target.
464 *
465 * In other words, the bulk of the transition will occur before this time, and the "bouncy bit" will mostly happen after.
466 *
467 * This makes it easier to edit a spring, as well as visually coordinate it with other time-based animations.
468 *
469 * ```jsx
470 * <motion.div
471 * animate={{ x: 100 }}
472 * transition={{ type: "spring", visualDuration: 0.5 }}
473 * />
474 * ```
475 *
476 * @public
477 */
478 visualDuration?: number;
479 /**
480 * `bounce` determines the "bounciness" of a spring animation.
481 *
482 * `0` is no bounce, and `1` is extremely bouncy.
483 *
484 * If `duration` is set, this defaults to `0.25`.
485 *
486 * Note: `bounce` and `duration` will be overridden if `stiffness`, `damping` or `mass` are set.
487 *
488 * ```jsx
489 * <motion.div
490 * animate={{ x: 100 }}
491 * transition={{ type: "spring", bounce: 0.25 }}
492 * />
493 * ```
494 *
495 * @public
496 */
497 bounce?: number;
498 /**
499 * End animation if absolute speed (in units per second) drops below this
500 * value and delta is smaller than `restDelta`. Set to `0.01` by default.
501 *
502 * ```jsx
503 * <motion.div
504 * animate={{ rotate: 180 }}
505 * transition={{ type: 'spring', restSpeed: 0.5 }}
506 * />
507 * ```
508 *
509 * @public
510 */
511 restSpeed?: number;
512 /**
513 * End animation if distance is below this value and speed is below
514 * `restSpeed`. When animation ends, spring gets “snapped” to. Set to
515 * `0.01` by default.
516 *
517 * ```jsx
518 * <motion.div
519 * animate={{ rotate: 180 }}
520 * transition={{ type: 'spring', restDelta: 0.5 }}
521 * />
522 * ```
523 *
524 * @public
525 */
526 restDelta?: number;
527 /**
528 * The value to animate from.
529 * By default, this is the initial state of the animating value.
530 *
531 * ```jsx
532 * <motion.div
533 * animate={{ rotate: 180 }}
534 * transition={{ type: 'spring', from: 90 }}
535 * />
536 * ```
537 *
538 * @public
539 */
540 from?: number | string;
541 /**
542 * The initial velocity of the spring. By default this is the current velocity of the component.
543 *
544 * ```jsx
545 * <motion.div
546 * animate={{ rotate: 180 }}
547 * transition={{ type: 'spring', velocity: 2 }}
548 * />
549 * ```
550 *
551 * @public
552 */
553 velocity?: number;
554}
555/**
556 * An animation that decelerates a value based on its initial velocity,
557 * usually used to implement inertial scrolling.
558 *
559 * Optionally, `min` and `max` boundaries can be defined, and inertia
560 * will snap to these with a spring animation.
561 *
562 * This animation will automatically precalculate a target value,
563 * which can be modified with the `modifyTarget` property.
564 *
565 * This allows you to add snap-to-grid or similar functionality.
566 *
567 * Inertia is also the animation used for `dragTransition`, and can be configured via that prop.
568 *
569 * @public
570 */
571interface Inertia {
572 /**
573 * Set `type` to animate using the inertia animation. Set to `"tween"` by
574 * default. This can be used for natural deceleration, like momentum scrolling.
575 *
576 * ```jsx
577 * <motion.div
578 * animate={{ rotate: 180 }}
579 * transition={{ type: "inertia", velocity: 50 }}
580 * />
581 * ```
582 *
583 * @public
584 */
585 type: "inertia";
586 /**
587 * A function that receives the automatically-calculated target and returns a new one. Useful for snapping the target to a grid.
588 *
589 * ```jsx
590 * <motion.div
591 * drag
592 * dragTransition={{
593 * power: 0,
594 * // Snap calculated target to nearest 50 pixels
595 * modifyTarget: target => Math.round(target / 50) * 50
596 * }}
597 * />
598 * ```
599 *
600 * @public
601 */
602 modifyTarget?(v: number): number;
603 /**
604 * If `min` or `max` is set, this affects the stiffness of the bounce
605 * spring. Higher values will create more sudden movement. Set to `500` by
606 * default.
607 *
608 * ```jsx
609 * <motion.div
610 * drag
611 * dragTransition={{
612 * min: 0,
613 * max: 100,
614 * bounceStiffness: 100
615 * }}
616 * />
617 * ```
618 *
619 * @public
620 */
621 bounceStiffness?: number;
622 /**
623 * If `min` or `max` is set, this affects the damping of the bounce spring.
624 * If set to `0`, spring will oscillate indefinitely. Set to `10` by
625 * default.
626 *
627 * ```jsx
628 * <motion.div
629 * drag
630 * dragTransition={{
631 * min: 0,
632 * max: 100,
633 * bounceDamping: 8
634 * }}
635 * />
636 * ```
637 *
638 * @public
639 */
640 bounceDamping?: number;
641 /**
642 * A higher power value equals a further target. Set to `0.8` by default.
643 *
644 * ```jsx
645 * <motion.div
646 * drag
647 * dragTransition={{ power: 0.2 }}
648 * />
649 * ```
650 *
651 * @public
652 */
653 power?: number;
654 /**
655 * Adjusting the time constant will change the duration of the
656 * deceleration, thereby affecting its feel. Set to `700` by default.
657 *
658 * ```jsx
659 * <motion.div
660 * drag
661 * dragTransition={{ timeConstant: 200 }}
662 * />
663 * ```
664 *
665 * @public
666 */
667 timeConstant?: number;
668 /**
669 * End the animation if the distance to the animation target is below this value, and the absolute speed is below `restSpeed`.
670 * When the animation ends, the value gets snapped to the animation target. Set to `0.01` by default.
671 * Generally the default values provide smooth animation endings, only in rare cases should you need to customize these.
672 *
673 * ```jsx
674 * <motion.div
675 * drag
676 * dragTransition={{ restDelta: 10 }}
677 * />
678 * ```
679 *
680 * @public
681 */
682 restDelta?: number;
683 /**
684 * 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).
685 *
686 * ```jsx
687 * <motion.div
688 * drag
689 * dragTransition={{ min: 0, max: 100 }}
690 * />
691 * ```
692 *
693 * @public
694 */
695 min?: number;
696 /**
697 * Maximum constraint. If set, the value will "bump" against this value (or immediately snap to it, if the initial animation value exceeds this value).
698 *
699 * ```jsx
700 * <motion.div
701 * drag
702 * dragTransition={{ min: 0, max: 100 }}
703 * />
704 * ```
705 *
706 * @public
707 */
708 max?: number;
709 /**
710 * The value to animate from. By default, this is the current state of the animating value.
711 *
712 * ```jsx
713 * <Frame
714 * drag
715 * dragTransition={{ from: 50 }}
716 * />
717 * ```
718 *
719 * @public
720 */
721 from?: number | string;
722 /**
723 * The initial velocity of the animation.
724 * By default this is the current velocity of the component.
725 *
726 * ```jsx
727 * <motion.div
728 * animate={{ rotate: 180 }}
729 * transition={{ type: 'inertia', velocity: 200 }}
730 * />
731 * ```
732 *
733 * @public
734 */
735 velocity?: number;
736}
737/**
738 * Keyframes tweens between multiple `values`.
739 *
740 * These tweens can be arranged using the `duration`, `easings`, and `times` properties.
741 */
742interface Keyframes {
743 /**
744 * Set `type` to `"keyframes"` to animate using the keyframes animation.
745 * Set to `"tween"` by default. This can be used to animate between a series of values.
746 *
747 * @public
748 */
749 type: "keyframes";
750 /**
751 * An array of numbers between 0 and 1, where `1` represents the `total` duration.
752 *
753 * 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`.
754 *
755 * Defaults to an array of evenly-spread durations.
756 *
757 * @public
758 */
759 times?: number[];
760 /**
761 * An array of easing functions for each generated tween, or a single easing function applied to all tweens.
762 *
763 * This array should be one item less than `values`, as these easings apply to the transitions *between* the `values`.
764 *
765 * ```jsx
766 * const transition = {
767 * backgroundColor: {
768 * type: 'keyframes',
769 * easings: ['circIn', 'circOut']
770 * }
771 * }
772 * ```
773 *
774 * @public
775 */
776 ease?: Easing | Easing[];
777 /**
778 * The total duration of the animation. Set to `0.3` by default.
779 *
780 * ```jsx
781 * const transition = {
782 * type: "keyframes",
783 * duration: 2
784 * }
785 *
786 * <Frame
787 * animate={{ opacity: 0 }}
788 * transition={transition}
789 * />
790 * ```
791 *
792 * @public
793 */
794 duration?: number;
795 /**
796 * @public
797 */
798 repeatDelay?: number;
799}
800/**
801 * @public
802 */
803interface None {
804 /**
805 * Set `type` to `false` for an instant transition.
806 *
807 * @public
808 */
809 type: false;
810}
811/**
812 * @public
813 */
814type PermissiveTransitionDefinition = {
815 [key: string]: any;
816};
817/**
818 * @public
819 */
820type TransitionDefinition = Tween | Spring | Keyframes | Inertia | None | PermissiveTransitionDefinition;
821type TransitionMap = Orchestration & TransitionDefinition & {
822 [key: string]: TransitionDefinition;
823};
824/**
825 * Transition props
826 *
827 * @public
828 */
829type Transition$1 = (Orchestration & Repeat & TransitionDefinition) | (Orchestration & Repeat & TransitionMap);
830type Omit$1<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
831type CSSPropertiesWithoutTransitionOrSingleTransforms = Omit$1<CSSProperties, "transition" | "rotate" | "scale" | "perspective">;
832type SVGTransformAttributes = {
833 attrX?: number;
834 attrY?: number;
835 attrScale?: number;
836};
837type TargetProperties = CSSPropertiesWithoutTransitionOrSingleTransforms & SVGAttributes$1<SVGElement> & SVGTransformAttributes & TransformProperties & CustomStyles & SVGPathProperties & VariableKeyframesDefinition;
838/**
839 * @public
840 */
841type MakeCustomValueType<T> = {
842 [K in keyof T]: T[K] | CustomValueType;
843};
844/**
845 * @public
846 */
847type Target = MakeCustomValueType<TargetProperties>;
848/**
849 * @public
850 */
851type MakeKeyframes<T> = {
852 [K in keyof T]: T[K] | T[K][] | [null, ...T[K][]];
853};
854/**
855 * @public
856 */
857type TargetWithKeyframes = MakeKeyframes<Target>;
858/**
859 * An object that specifies values to animate to. Each value may be set either as
860 * a single value, or an array of values.
861 *
862 * It may also option contain these properties:
863 *
864 * - `transition`: Specifies transitions for all or individual values.
865 * - `transitionEnd`: Specifies values to set when the animation finishes.
866 *
867 * ```jsx
868 * const target = {
869 * x: "0%",
870 * opacity: 0,
871 * transition: { duration: 1 },
872 * transitionEnd: { display: "none" }
873 * }
874 * ```
875 *
876 * @public
877 */
878type TargetAndTransition = TargetWithKeyframes & {
879 transition?: Transition$1;
880 transitionEnd?: Target;
881};
882type TargetResolver = (custom: any, current: Target, velocity: Target) => TargetAndTransition | string;
883/**
884 * @public
885 */
886type Variant = TargetAndTransition | TargetResolver;
887/**
888 * @public
889 */
890type Variants = {
891 [key: string]: Variant;
892};
893/**
894 * @public
895 */
896interface CustomValueType {
897 mix: (from: any, to: any) => (p: number) => number | string;
898 toValue: () => number | string;
899}
900
901interface Point {
902 x: number;
903 y: number;
904}
905interface Axis {
906 min: number;
907 max: number;
908}
909interface Box {
910 x: Axis;
911 y: Axis;
912}
913interface BoundingBox {
914 top: number;
915 right: number;
916 bottom: number;
917 left: number;
918}
919interface AxisDelta {
920 translate: number;
921 scale: number;
922 origin: number;
923 originPoint: number;
924}
925interface Delta {
926 x: AxisDelta;
927 y: AxisDelta;
928}
929type TransformPoint = (point: Point) => Point;
930
931type ReducedMotionConfig = "always" | "never" | "user";
932/**
933 * @public
934 */
935interface MotionConfigContext {
936 /**
937 * Internal, exported only for usage in Framer
938 */
939 transformPagePoint: TransformPoint;
940 /**
941 * Internal. Determines whether this is a static context ie the Framer canvas. If so,
942 * it'll disable all dynamic functionality.
943 */
944 isStatic: boolean;
945 /**
946 * Defines a new default transition for the entire tree.
947 *
948 * @public
949 */
950 transition?: Transition$1;
951 /**
952 * If true, will respect the device prefersReducedMotion setting by switching
953 * transform animations off.
954 *
955 * @public
956 */
957 reducedMotion?: ReducedMotionConfig;
958 /**
959 * A custom `nonce` attribute used when wanting to enforce a Content Security Policy (CSP).
960 * For more details see:
961 * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src#unsafe_inline_styles
962 *
963 * @public
964 */
965 nonce?: string;
966}
967/**
968 * @public
969 */
970declare const MotionConfigContext: React$1.Context<MotionConfigContext>;
971
972declare class NodeStack {
973 lead?: IProjectionNode;
974 prevLead?: IProjectionNode;
975 members: IProjectionNode[];
976 add(node: IProjectionNode): void;
977 remove(node: IProjectionNode): void;
978 relegate(node: IProjectionNode): boolean;
979 promote(node: IProjectionNode, preserveFollowOpacity?: boolean): void;
980 exitAnimationComplete(): void;
981 scheduleRender(): void;
982 /**
983 * Clear any leads that have been removed this render to prevent them from being
984 * used in future animations and to prevent memory leaks
985 */
986 removeLeadSnapshot(): void;
987}
988
989interface WithDepth {
990 depth: number;
991}
992
993declare class FlatTree {
994 private children;
995 private isDirty;
996 add(child: WithDepth): void;
997 remove(child: WithDepth): void;
998 forEach(callback: (child: WithDepth) => void): void;
999}
1000
1001interface SwitchLayoutGroup {
1002 register?: (member: IProjectionNode) => void;
1003 deregister?: (member: IProjectionNode) => void;
1004}
1005type InitialPromotionConfig = {
1006 /**
1007 * The initial transition to use when the elements in this group mount (and automatically promoted).
1008 * Subsequent updates should provide a transition in the promote method.
1009 */
1010 transition?: Transition$1;
1011 /**
1012 * If the follow tree should preserve its opacity when the lead is promoted on mount
1013 */
1014 shouldPreserveFollowOpacity?: (member: IProjectionNode) => boolean;
1015};
1016type SwitchLayoutGroupContext = SwitchLayoutGroup & InitialPromotionConfig;
1017/**
1018 * Internal, exported only for usage in Framer
1019 */
1020declare const SwitchLayoutGroupContext: React$1.Context<SwitchLayoutGroupContext>;
1021
1022interface Measurements {
1023 animationId: number;
1024 measuredBox: Box;
1025 layoutBox: Box;
1026 latestValues: ResolvedValues;
1027 source: number;
1028}
1029type Phase = "snapshot" | "measure";
1030interface ScrollMeasurements {
1031 animationId: number;
1032 phase: Phase;
1033 offset: Point;
1034 isRoot: boolean;
1035 wasRoot: boolean;
1036}
1037type LayoutEvents = "willUpdate" | "didUpdate" | "beforeMeasure" | "measure" | "projectionUpdate" | "animationStart" | "animationComplete";
1038interface IProjectionNode<I = unknown> {
1039 id: number;
1040 animationId: number;
1041 parent?: IProjectionNode;
1042 relativeParent?: IProjectionNode;
1043 root?: IProjectionNode;
1044 children: Set<IProjectionNode>;
1045 path: IProjectionNode[];
1046 nodes?: FlatTree;
1047 depth: number;
1048 instance: I;
1049 mount: (node: I, isLayoutDirty?: boolean) => void;
1050 unmount: () => void;
1051 options: ProjectionNodeOptions;
1052 setOptions(options: ProjectionNodeOptions): void;
1053 layout?: Measurements;
1054 snapshot?: Measurements;
1055 target?: Box;
1056 relativeTarget?: Box;
1057 relativeTargetOrigin?: Box;
1058 targetDelta?: Delta;
1059 targetWithTransforms?: Box;
1060 scroll?: ScrollMeasurements;
1061 treeScale?: Point;
1062 projectionDelta?: Delta;
1063 projectionDeltaWithTransform?: Delta;
1064 latestValues: ResolvedValues;
1065 isLayoutDirty: boolean;
1066 isProjectionDirty: boolean;
1067 isSharedProjectionDirty: boolean;
1068 isTransformDirty: boolean;
1069 resolvedRelativeTargetAt?: number;
1070 shouldResetTransform: boolean;
1071 prevTransformTemplateValue: string | undefined;
1072 isUpdateBlocked(): boolean;
1073 updateManuallyBlocked: boolean;
1074 updateBlockedByResize: boolean;
1075 blockUpdate(): void;
1076 unblockUpdate(): void;
1077 isUpdating: boolean;
1078 needsReset: boolean;
1079 startUpdate(): void;
1080 willUpdate(notifyListeners?: boolean): void;
1081 didUpdate(): void;
1082 measure(removeTransform?: boolean): Measurements;
1083 measurePageBox(): Box;
1084 updateLayout(): void;
1085 updateSnapshot(): void;
1086 clearSnapshot(): void;
1087 updateScroll(phase?: Phase): void;
1088 scheduleUpdateProjection(): void;
1089 scheduleCheckAfterUnmount(): void;
1090 checkUpdateFailed(): void;
1091 sharedNodes: Map<string, NodeStack>;
1092 registerSharedNode(id: string, node: IProjectionNode): void;
1093 getStack(): NodeStack | undefined;
1094 isVisible: boolean;
1095 hide(): void;
1096 show(): void;
1097 scheduleRender(notifyAll?: boolean): void;
1098 getClosestProjectingParent(): IProjectionNode | undefined;
1099 setTargetDelta(delta: Delta): void;
1100 resetTransform(): void;
1101 resetSkewAndRotation(): void;
1102 applyTransform(box: Box, transformOnly?: boolean): Box;
1103 resolveTargetDelta(force?: boolean): void;
1104 calcProjection(): void;
1105 getProjectionStyles(styleProp?: MotionStyle): MotionStyle | undefined;
1106 clearMeasurements(): void;
1107 resetTree(): void;
1108 isProjecting(): boolean;
1109 animationValues?: ResolvedValues;
1110 currentAnimation?: AnimationPlaybackControls;
1111 isTreeAnimating?: boolean;
1112 isAnimationBlocked?: boolean;
1113 isTreeAnimationBlocked: () => boolean;
1114 setAnimationOrigin(delta: Delta): void;
1115 startAnimation(transition: Transition$1): void;
1116 finishAnimation(): void;
1117 hasCheckedOptimisedAppear: boolean;
1118 isLead(): boolean;
1119 promote(options?: {
1120 needsReset?: boolean;
1121 transition?: Transition$1;
1122 preserveFollowOpacity?: boolean;
1123 }): void;
1124 relegate(): boolean;
1125 resumeFrom?: IProjectionNode;
1126 resumingFrom?: IProjectionNode;
1127 isPresent?: boolean;
1128 addEventListener(name: LayoutEvents, handler: any): VoidFunction;
1129 notifyListeners(name: LayoutEvents, ...args: any): void;
1130 hasListeners(name: LayoutEvents): boolean;
1131 hasTreeAnimated: boolean;
1132 preserveOpacity?: boolean;
1133}
1134interface ProjectionNodeOptions {
1135 animate?: boolean;
1136 layoutScroll?: boolean;
1137 layoutRoot?: boolean;
1138 alwaysMeasureLayout?: boolean;
1139 onExitComplete?: VoidFunction;
1140 animationType?: "size" | "position" | "both" | "preserve-aspect";
1141 layoutId?: string;
1142 layout?: boolean | string;
1143 visualElement?: VisualElement;
1144 crossfade?: boolean;
1145 transition?: Transition$1;
1146 initialPromotionConfig?: InitialPromotionConfig;
1147}
1148
1149type AnimationType = "animate" | "whileHover" | "whileTap" | "whileDrag" | "whileFocus" | "whileInView" | "exit";
1150
1151type VisualElementAnimationOptions = {
1152 delay?: number;
1153 transitionOverride?: Transition$1;
1154 custom?: any;
1155 type?: AnimationType;
1156};
1157
1158interface AnimationState$1 {
1159 animateChanges: (type?: AnimationType) => Promise<any>;
1160 setActive: (type: AnimationType, isActive: boolean, options?: VisualElementAnimationOptions) => Promise<any>;
1161 setAnimateFunction: (fn: any) => void;
1162 getState: () => {
1163 [key: string]: AnimationTypeState;
1164 };
1165 reset: () => void;
1166}
1167interface AnimationTypeState {
1168 isActive: boolean;
1169 protectedKeys: {
1170 [key: string]: true;
1171 };
1172 needsAnimating: {
1173 [key: string]: boolean;
1174 };
1175 prevResolvedValues: {
1176 [key: string]: any;
1177 };
1178 prevProp?: VariantLabels | TargetAndTransition;
1179}
1180
1181/**
1182 * @public
1183 */
1184interface PresenceContextProps {
1185 id: string;
1186 isPresent: boolean;
1187 register: (id: string | number) => () => void;
1188 onExitComplete?: (id: string | number) => void;
1189 initial?: false | VariantLabels;
1190 custom?: any;
1191}
1192/**
1193 * @public
1194 */
1195declare const PresenceContext: React$1.Context<PresenceContextProps | null>;
1196
1197type UnresolvedKeyframes<T extends string | number> = Array<T | null>;
1198type ResolvedKeyframes<T extends string | number> = Array<T>;
1199type OnKeyframesResolved<T extends string | number> = (resolvedKeyframes: ResolvedKeyframes<T>, finalKeyframe: T) => void;
1200declare class KeyframeResolver<T extends string | number = any> {
1201 name?: string;
1202 element?: VisualElement<any>;
1203 finalKeyframe?: T;
1204 suspendedScrollY?: number;
1205 protected unresolvedKeyframes: UnresolvedKeyframes<string | number>;
1206 private motionValue?;
1207 private onComplete;
1208 /**
1209 * Track whether this resolver has completed. Once complete, it never
1210 * needs to attempt keyframe resolution again.
1211 */
1212 private isComplete;
1213 /**
1214 * Track whether this resolver is async. If it is, it'll be added to the
1215 * resolver queue and flushed in the next frame. Resolvers that aren't going
1216 * to trigger read/write thrashing don't need to be async.
1217 */
1218 private isAsync;
1219 /**
1220 * Track whether this resolver needs to perform a measurement
1221 * to resolve its keyframes.
1222 */
1223 needsMeasurement: boolean;
1224 /**
1225 * Track whether this resolver is currently scheduled to resolve
1226 * to allow it to be cancelled and resumed externally.
1227 */
1228 isScheduled: boolean;
1229 constructor(unresolvedKeyframes: UnresolvedKeyframes<string | number>, onComplete: OnKeyframesResolved<T>, name?: string, motionValue?: MotionValue<T>, element?: VisualElement<any>, isAsync?: boolean);
1230 scheduleResolve(): void;
1231 readKeyframes(): void;
1232 setFinalKeyframe(): void;
1233 measureInitialState(): void;
1234 renderEndStyles(): void;
1235 measureEndState(): void;
1236 complete(): void;
1237 cancel(): void;
1238 resume(): void;
1239}
1240
1241/**
1242 * A VisualElement is an imperative abstraction around UI elements such as
1243 * HTMLElement, SVGElement, Three.Object3D etc.
1244 */
1245declare abstract class VisualElement<Instance = unknown, RenderState = unknown, Options extends {} = {}> {
1246 /**
1247 * VisualElements are arranged in trees mirroring that of the React tree.
1248 * Each type of VisualElement has a unique name, to detect when we're crossing
1249 * type boundaries within that tree.
1250 */
1251 abstract type: string;
1252 /**
1253 * An `Array.sort` compatible function that will compare two Instances and
1254 * compare their respective positions within the tree.
1255 */
1256 abstract sortInstanceNodePosition(a: Instance, b: Instance): number;
1257 /**
1258 * Measure the viewport-relative bounding box of the Instance.
1259 */
1260 abstract measureInstanceViewportBox(instance: Instance, props: MotionProps & Partial<MotionConfigContext>): Box;
1261 /**
1262 * When a value has been removed from all animation props we need to
1263 * pick a target to animate back to. For instance, for HTMLElements
1264 * we can look in the style prop.
1265 */
1266 abstract getBaseTargetFromProps(props: MotionProps, key: string): string | number | undefined | MotionValue;
1267 /**
1268 * When we first animate to a value we need to animate it *from* a value.
1269 * Often this have been specified via the initial prop but it might be
1270 * that the value needs to be read from the Instance.
1271 */
1272 abstract readValueFromInstance(instance: Instance, key: string, options: Options): string | number | null | undefined;
1273 /**
1274 * When a value has been removed from the VisualElement we use this to remove
1275 * it from the inherting class' unique render state.
1276 */
1277 abstract removeValueFromRenderState(key: string, renderState: RenderState): void;
1278 /**
1279 * Run before a React or VisualElement render, builds the latest motion
1280 * values into an Instance-specific format. For example, HTMLVisualElement
1281 * will use this step to build `style` and `var` values.
1282 */
1283 abstract build(renderState: RenderState, latestValues: ResolvedValues, props: MotionProps): void;
1284 /**
1285 * Apply the built values to the Instance. For example, HTMLElements will have
1286 * styles applied via `setProperty` and the style attribute, whereas SVGElements
1287 * will have values applied to attributes.
1288 */
1289 abstract renderInstance(instance: Instance, renderState: RenderState, styleProp?: MotionStyle, projection?: IProjectionNode): void;
1290 /**
1291 * If the component child is provided as a motion value, handle subscriptions
1292 * with the renderer-specific VisualElement.
1293 */
1294 handleChildMotionValue?(): void;
1295 /**
1296 * This method takes React props and returns found MotionValues. For example, HTML
1297 * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
1298 *
1299 * This isn't an abstract method as it needs calling in the constructor, but it is
1300 * intended to be one.
1301 */
1302 scrapeMotionValuesFromProps(_props: MotionProps, _prevProps: MotionProps, _visualElement: VisualElement): {
1303 [key: string]: MotionValue | string | number;
1304 };
1305 /**
1306 * A reference to the current underlying Instance, e.g. a HTMLElement
1307 * or Three.Mesh etc.
1308 */
1309 current: Instance | null;
1310 /**
1311 * A reference to the parent VisualElement (if exists).
1312 */
1313 parent: VisualElement | undefined;
1314 /**
1315 * A set containing references to this VisualElement's children.
1316 */
1317 children: Set<VisualElement<unknown, unknown, {}>>;
1318 /**
1319 * The depth of this VisualElement within the overall VisualElement tree.
1320 */
1321 depth: number;
1322 /**
1323 * The current render state of this VisualElement. Defined by inherting VisualElements.
1324 */
1325 renderState: RenderState;
1326 /**
1327 * An object containing the latest static values for each of this VisualElement's
1328 * MotionValues.
1329 */
1330 latestValues: ResolvedValues;
1331 /**
1332 * Determine what role this visual element should take in the variant tree.
1333 */
1334 isVariantNode: boolean;
1335 isControllingVariants: boolean;
1336 /**
1337 * If this component is part of the variant tree, it should track
1338 * any children that are also part of the tree. This is essentially
1339 * a shadow tree to simplify logic around how to stagger over children.
1340 */
1341 variantChildren?: Set<VisualElement>;
1342 /**
1343 * Decides whether this VisualElement should animate in reduced motion
1344 * mode.
1345 *
1346 * TODO: This is currently set on every individual VisualElement but feels
1347 * like it could be set globally.
1348 */
1349 shouldReduceMotion: boolean | null;
1350 /**
1351 * Normally, if a component is controlled by a parent's variants, it can
1352 * rely on that ancestor to trigger animations further down the tree.
1353 * However, if a component is created after its parent is mounted, the parent
1354 * won't trigger that mount animation so the child needs to.
1355 *
1356 * TODO: This might be better replaced with a method isParentMounted
1357 */
1358 manuallyAnimateOnMount: boolean;
1359 /**
1360 * This can be set by AnimatePresence to force components that mount
1361 * at the same time as it to mount as if they have initial={false} set.
1362 */
1363 blockInitialAnimation: boolean;
1364 /**
1365 * A reference to this VisualElement's projection node, used in layout animations.
1366 */
1367 projection?: IProjectionNode;
1368 /**
1369 * A map of all motion values attached to this visual element. Motion
1370 * values are source of truth for any given animated value. A motion
1371 * value might be provided externally by the component via props.
1372 */
1373 values: Map<string, MotionValue<any>>;
1374 /**
1375 * The AnimationState, this is hydrated by the animation Feature.
1376 */
1377 animationState?: AnimationState$1;
1378 KeyframeResolver: typeof KeyframeResolver;
1379 /**
1380 * The options used to create this VisualElement. The Options type is defined
1381 * by the inheriting VisualElement and is passed straight through to the render functions.
1382 */
1383 readonly options: Options;
1384 /**
1385 * A reference to the latest props provided to the VisualElement's host React component.
1386 */
1387 props: MotionProps;
1388 prevProps?: MotionProps;
1389 presenceContext: PresenceContextProps | null;
1390 prevPresenceContext?: PresenceContextProps | null;
1391 /**
1392 * Cleanup functions for active features (hover/tap/exit etc)
1393 */
1394 private features;
1395 /**
1396 * A map of every subscription that binds the provided or generated
1397 * motion values onChange listeners to this visual element.
1398 */
1399 private valueSubscriptions;
1400 /**
1401 * A reference to the ReducedMotionConfig passed to the VisualElement's host React component.
1402 */
1403 private reducedMotionConfig;
1404 /**
1405 * On mount, this will be hydrated with a callback to disconnect
1406 * this visual element from its parent on unmount.
1407 */
1408 private removeFromVariantTree;
1409 /**
1410 * A reference to the previously-provided motion values as returned
1411 * from scrapeMotionValuesFromProps. We use the keys in here to determine
1412 * if any motion values need to be removed after props are updated.
1413 */
1414 private prevMotionValues;
1415 /**
1416 * When values are removed from all animation props we need to search
1417 * for a fallback value to animate to. These values are tracked in baseTarget.
1418 */
1419 private baseTarget;
1420 /**
1421 * Create an object of the values we initially animated from (if initial prop present).
1422 */
1423 private initialValues;
1424 /**
1425 * An object containing a SubscriptionManager for each active event.
1426 */
1427 private events;
1428 /**
1429 * An object containing an unsubscribe function for each prop event subscription.
1430 * For example, every "Update" event can have multiple subscribers via
1431 * VisualElement.on(), but only one of those can be defined via the onUpdate prop.
1432 */
1433 private propEventSubscriptions;
1434 constructor({ parent, props, presenceContext, reducedMotionConfig, blockInitialAnimation, visualState, }: VisualElementOptions<Instance, RenderState>, options?: Options);
1435 mount(instance: Instance): void;
1436 unmount(): void;
1437 private bindToMotionValue;
1438 sortNodePosition(other: VisualElement<Instance>): number;
1439 updateFeatures(): void;
1440 notifyUpdate: () => void;
1441 triggerBuild(): void;
1442 render: () => void;
1443 private renderScheduledAt;
1444 scheduleRender: () => void;
1445 /**
1446 * Measure the current viewport box with or without transforms.
1447 * Only measures axis-aligned boxes, rotate and skew must be manually
1448 * removed with a re-render to work.
1449 */
1450 measureViewportBox(): Box;
1451 getStaticValue(key: string): string | number;
1452 setStaticValue(key: string, value: string | number): void;
1453 /**
1454 * Update the provided props. Ensure any newly-added motion values are
1455 * added to our map, old ones removed, and listeners updated.
1456 */
1457 update(props: MotionProps, presenceContext: PresenceContextProps | null): void;
1458 getProps(): MotionProps;
1459 /**
1460 * Returns the variant definition with a given name.
1461 */
1462 getVariant(name: string): Variant | undefined;
1463 /**
1464 * Returns the defined default transition on this component.
1465 */
1466 getDefaultTransition(): Transition$1 | undefined;
1467 getTransformPagePoint(): any;
1468 getClosestVariantNode(): VisualElement | undefined;
1469 /**
1470 * Add a child visual element to our set of children.
1471 */
1472 addVariantChild(child: VisualElement): (() => boolean) | undefined;
1473 /**
1474 * Add a motion value and bind it to this visual element.
1475 */
1476 addValue(key: string, value: MotionValue): void;
1477 /**
1478 * Remove a motion value and unbind any active subscriptions.
1479 */
1480 removeValue(key: string): void;
1481 /**
1482 * Check whether we have a motion value for this key
1483 */
1484 hasValue(key: string): boolean;
1485 /**
1486 * Get a motion value for this key. If called with a default
1487 * value, we'll create one if none exists.
1488 */
1489 getValue(key: string): MotionValue | undefined;
1490 getValue(key: string, defaultValue: string | number | null): MotionValue;
1491 /**
1492 * If we're trying to animate to a previously unencountered value,
1493 * we need to check for it in our state and as a last resort read it
1494 * directly from the instance (which might have performance implications).
1495 */
1496 readValue(key: string, target?: string | number | null): any;
1497 /**
1498 * Set the base target to later animate back to. This is currently
1499 * only hydrated on creation and when we first read a value.
1500 */
1501 setBaseTarget(key: string, value: string | number): void;
1502 /**
1503 * Find the base target for a value thats been removed from all animation
1504 * props.
1505 */
1506 getBaseTarget(key: string): ResolvedValues[string] | undefined | null;
1507 on<EventName extends keyof VisualElementEventCallbacks>(eventName: EventName, callback: VisualElementEventCallbacks[EventName]): VoidFunction;
1508 notify<EventName extends keyof VisualElementEventCallbacks>(eventName: EventName, ...args: any): void;
1509}
1510
1511/**
1512 * An update function. It accepts a timestamp used to advance the animation.
1513 */
1514type Update = (timestamp: number) => void;
1515/**
1516 * Drivers accept a update function and call it at an interval. This interval
1517 * could be a synchronous loop, a setInterval, or tied to the device's framerate.
1518 */
1519interface DriverControls {
1520 start: () => void;
1521 stop: () => void;
1522 now: () => number;
1523}
1524type Driver = (update: Update) => DriverControls;
1525
1526interface SVGAttributes {
1527 accentHeight?: number | string | undefined;
1528 accumulate?: "none" | "sum" | undefined;
1529 additive?: "replace" | "sum" | undefined;
1530 alignmentBaseline?: "auto" | "baseline" | "before-edge" | "text-before-edge" | "middle" | "central" | "after-edge" | "text-after-edge" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "inherit" | undefined;
1531 allowReorder?: "no" | "yes" | undefined;
1532 alphabetic?: number | string | undefined;
1533 amplitude?: number | string | undefined;
1534 arabicForm?: "initial" | "medial" | "terminal" | "isolated" | undefined;
1535 ascent?: number | string | undefined;
1536 attributeName?: string | undefined;
1537 attributeType?: string | undefined;
1538 autoReverse?: boolean | undefined;
1539 azimuth?: number | string | undefined;
1540 baseFrequency?: number | string | undefined;
1541 baselineShift?: number | string | undefined;
1542 baseProfile?: number | string | undefined;
1543 bbox?: number | string | undefined;
1544 begin?: number | string | undefined;
1545 bias?: number | string | undefined;
1546 by?: number | string | undefined;
1547 calcMode?: number | string | undefined;
1548 capHeight?: number | string | undefined;
1549 clip?: number | string | undefined;
1550 clipPath?: string | undefined;
1551 clipPathUnits?: number | string | undefined;
1552 clipRule?: number | string | undefined;
1553 colorInterpolation?: number | string | undefined;
1554 colorInterpolationFilters?: "auto" | "sRGB" | "linearRGB" | "inherit" | undefined;
1555 colorProfile?: number | string | undefined;
1556 colorRendering?: number | string | undefined;
1557 contentScriptType?: number | string | undefined;
1558 contentStyleType?: number | string | undefined;
1559 cursor?: number | string | undefined;
1560 cx?: number | string | undefined;
1561 cy?: number | string | undefined;
1562 d?: string | undefined;
1563 decelerate?: number | string | undefined;
1564 descent?: number | string | undefined;
1565 diffuseConstant?: number | string | undefined;
1566 direction?: number | string | undefined;
1567 display?: number | string | undefined;
1568 divisor?: number | string | undefined;
1569 dominantBaseline?: number | string | undefined;
1570 dur?: number | string | undefined;
1571 dx?: number | string | undefined;
1572 dy?: number | string | undefined;
1573 edgeMode?: number | string | undefined;
1574 elevation?: number | string | undefined;
1575 enableBackground?: number | string | undefined;
1576 end?: number | string | undefined;
1577 exponent?: number | string | undefined;
1578 externalResourcesRequired?: boolean | undefined;
1579 fill?: string | undefined;
1580 fillOpacity?: number | string | undefined;
1581 fillRule?: "nonzero" | "evenodd" | "inherit" | undefined;
1582 filter?: string | undefined;
1583 filterRes?: number | string | undefined;
1584 filterUnits?: number | string | undefined;
1585 floodColor?: number | string | undefined;
1586 floodOpacity?: number | string | undefined;
1587 focusable?: boolean | "auto" | undefined;
1588 fontFamily?: string | undefined;
1589 fontSize?: number | string | undefined;
1590 fontSizeAdjust?: number | string | undefined;
1591 fontStretch?: number | string | undefined;
1592 fontStyle?: number | string | undefined;
1593 fontVariant?: number | string | undefined;
1594 fontWeight?: number | string | undefined;
1595 format?: number | string | undefined;
1596 fr?: number | string | undefined;
1597 from?: number | string | undefined;
1598 fx?: number | string | undefined;
1599 fy?: number | string | undefined;
1600 g1?: number | string | undefined;
1601 g2?: number | string | undefined;
1602 glyphName?: number | string | undefined;
1603 glyphOrientationHorizontal?: number | string | undefined;
1604 glyphOrientationVertical?: number | string | undefined;
1605 glyphRef?: number | string | undefined;
1606 gradientTransform?: string | undefined;
1607 gradientUnits?: string | undefined;
1608 hanging?: number | string | undefined;
1609 horizAdvX?: number | string | undefined;
1610 horizOriginX?: number | string | undefined;
1611 href?: string | undefined;
1612 ideographic?: number | string | undefined;
1613 imageRendering?: number | string | undefined;
1614 in2?: number | string | undefined;
1615 in?: string | undefined;
1616 intercept?: number | string | undefined;
1617 k1?: number | string | undefined;
1618 k2?: number | string | undefined;
1619 k3?: number | string | undefined;
1620 k4?: number | string | undefined;
1621 k?: number | string | undefined;
1622 kernelMatrix?: number | string | undefined;
1623 kernelUnitLength?: number | string | undefined;
1624 kerning?: number | string | undefined;
1625 keyPoints?: number | string | undefined;
1626 keySplines?: number | string | undefined;
1627 keyTimes?: number | string | undefined;
1628 lengthAdjust?: number | string | undefined;
1629 letterSpacing?: number | string | undefined;
1630 lightingColor?: number | string | undefined;
1631 limitingConeAngle?: number | string | undefined;
1632 local?: number | string | undefined;
1633 markerEnd?: string | undefined;
1634 markerHeight?: number | string | undefined;
1635 markerMid?: string | undefined;
1636 markerStart?: string | undefined;
1637 markerUnits?: number | string | undefined;
1638 markerWidth?: number | string | undefined;
1639 mask?: string | undefined;
1640 maskContentUnits?: number | string | undefined;
1641 maskUnits?: number | string | undefined;
1642 mathematical?: number | string | undefined;
1643 mode?: number | string | undefined;
1644 numOctaves?: number | string | undefined;
1645 offset?: number | string | undefined;
1646 opacity?: number | string | undefined;
1647 operator?: number | string | undefined;
1648 order?: number | string | undefined;
1649 orient?: number | string | undefined;
1650 orientation?: number | string | undefined;
1651 origin?: number | string | undefined;
1652 overflow?: number | string | undefined;
1653 overlinePosition?: number | string | undefined;
1654 overlineThickness?: number | string | undefined;
1655 paintOrder?: number | string | undefined;
1656 panose1?: number | string | undefined;
1657 path?: string | undefined;
1658 pathLength?: number | string | undefined;
1659 patternContentUnits?: string | undefined;
1660 patternTransform?: number | string | undefined;
1661 patternUnits?: string | undefined;
1662 pointerEvents?: number | string | undefined;
1663 points?: string | undefined;
1664 pointsAtX?: number | string | undefined;
1665 pointsAtY?: number | string | undefined;
1666 pointsAtZ?: number | string | undefined;
1667 preserveAlpha?: boolean | undefined;
1668 preserveAspectRatio?: string | undefined;
1669 primitiveUnits?: number | string | undefined;
1670 r?: number | string | undefined;
1671 radius?: number | string | undefined;
1672 refX?: number | string | undefined;
1673 refY?: number | string | undefined;
1674 renderingIntent?: number | string | undefined;
1675 repeatCount?: number | string | undefined;
1676 repeatDur?: number | string | undefined;
1677 requiredExtensions?: number | string | undefined;
1678 requiredFeatures?: number | string | undefined;
1679 restart?: number | string | undefined;
1680 result?: string | undefined;
1681 rotate?: number | string | undefined;
1682 rx?: number | string | undefined;
1683 ry?: number | string | undefined;
1684 scale?: number | string | undefined;
1685 seed?: number | string | undefined;
1686 shapeRendering?: number | string | undefined;
1687 slope?: number | string | undefined;
1688 spacing?: number | string | undefined;
1689 specularConstant?: number | string | undefined;
1690 specularExponent?: number | string | undefined;
1691 speed?: number | string | undefined;
1692 spreadMethod?: string | undefined;
1693 startOffset?: number | string | undefined;
1694 stdDeviation?: number | string | undefined;
1695 stemh?: number | string | undefined;
1696 stemv?: number | string | undefined;
1697 stitchTiles?: number | string | undefined;
1698 stopColor?: string | undefined;
1699 stopOpacity?: number | string | undefined;
1700 strikethroughPosition?: number | string | undefined;
1701 strikethroughThickness?: number | string | undefined;
1702 string?: number | string | undefined;
1703 stroke?: string | undefined;
1704 strokeDasharray?: string | number | undefined;
1705 strokeDashoffset?: string | number | undefined;
1706 strokeLinecap?: "butt" | "round" | "square" | "inherit" | undefined;
1707 strokeLinejoin?: "miter" | "round" | "bevel" | "inherit" | undefined;
1708 strokeMiterlimit?: number | string | undefined;
1709 strokeOpacity?: number | string | undefined;
1710 strokeWidth?: number | string | undefined;
1711 surfaceScale?: number | string | undefined;
1712 systemLanguage?: number | string | undefined;
1713 tableValues?: number | string | undefined;
1714 targetX?: number | string | undefined;
1715 targetY?: number | string | undefined;
1716 textAnchor?: string | undefined;
1717 textDecoration?: number | string | undefined;
1718 textLength?: number | string | undefined;
1719 textRendering?: number | string | undefined;
1720 to?: number | string | undefined;
1721 transform?: string | undefined;
1722 u1?: number | string | undefined;
1723 u2?: number | string | undefined;
1724 underlinePosition?: number | string | undefined;
1725 underlineThickness?: number | string | undefined;
1726 unicode?: number | string | undefined;
1727 unicodeBidi?: number | string | undefined;
1728 unicodeRange?: number | string | undefined;
1729 unitsPerEm?: number | string | undefined;
1730 vAlphabetic?: number | string | undefined;
1731 values?: string | undefined;
1732 vectorEffect?: number | string | undefined;
1733 version?: string | undefined;
1734 vertAdvY?: number | string | undefined;
1735 vertOriginX?: number | string | undefined;
1736 vertOriginY?: number | string | undefined;
1737 vHanging?: number | string | undefined;
1738 vIdeographic?: number | string | undefined;
1739 viewBox?: string | undefined;
1740 viewTarget?: number | string | undefined;
1741 visibility?: number | string | undefined;
1742 vMathematical?: number | string | undefined;
1743 widths?: number | string | undefined;
1744 wordSpacing?: number | string | undefined;
1745 writingMode?: number | string | undefined;
1746 x1?: number | string | undefined;
1747 x2?: number | string | undefined;
1748 x?: number | string | undefined;
1749 xChannelSelector?: string | undefined;
1750 xHeight?: number | string | undefined;
1751 xlinkActuate?: string | undefined;
1752 xlinkArcrole?: string | undefined;
1753 xlinkHref?: string | undefined;
1754 xlinkRole?: string | undefined;
1755 xlinkShow?: string | undefined;
1756 xlinkTitle?: string | undefined;
1757 xlinkType?: string | undefined;
1758 xmlBase?: string | undefined;
1759 xmlLang?: string | undefined;
1760 xmlns?: string | undefined;
1761 xmlnsXlink?: string | undefined;
1762 xmlSpace?: string | undefined;
1763 y1?: number | string | undefined;
1764 y2?: number | string | undefined;
1765 y?: number | string | undefined;
1766 yChannelSelector?: string | undefined;
1767 z?: number | string | undefined;
1768 zoomAndPan?: string | undefined;
1769}
1770
1771interface ProgressTimeline {
1772 currentTime: null | {
1773 value: number;
1774 };
1775 cancel?: VoidFunction;
1776}
1777
1778interface AnimationState<V> {
1779 value: V;
1780 done: boolean;
1781}
1782interface KeyframeGenerator<V> {
1783 calculatedDuration: null | number;
1784 next: (t: number) => AnimationState<V>;
1785 toString: () => string;
1786}
1787
1788interface AnimationPlaybackLifecycles<V> {
1789 onUpdate?: (latest: V) => void;
1790 onPlay?: () => void;
1791 onComplete?: () => void;
1792 onRepeat?: () => void;
1793 onStop?: () => void;
1794}
1795type GeneratorFactory = (options: ValueAnimationOptions<any>) => KeyframeGenerator<any>;
1796type AnimationGeneratorType = GeneratorFactory | "decay" | "spring" | "keyframes" | "tween" | "inertia";
1797interface Transition extends AnimationPlaybackOptions, Omit<SpringOptions, "keyframes">, Omit<InertiaOptions$1, "keyframes">, KeyframeOptions {
1798 delay?: number;
1799 elapsed?: number;
1800 driver?: Driver;
1801 type?: AnimationGeneratorType;
1802 duration?: number;
1803 autoplay?: boolean;
1804 startTime?: number;
1805}
1806interface ValueAnimationTransition<V = any> extends Transition, AnimationPlaybackLifecycles<V> {
1807}
1808type ResolveKeyframes<V extends string | number> = (keyframes: V[], onComplete: OnKeyframesResolved<V>, name?: string, motionValue?: any) => KeyframeResolver<V>;
1809interface ValueAnimationOptions<V extends string | number = number> extends ValueAnimationTransition {
1810 keyframes: V[];
1811 name?: string;
1812 from?: V;
1813 isGenerator?: boolean;
1814}
1815interface ValueAnimationOptionsWithRenderContext<V extends string | number = number> extends ValueAnimationOptions<V> {
1816 KeyframeResolver?: typeof KeyframeResolver;
1817 motionValue?: MotionValue<V>;
1818 element?: VisualElement;
1819}
1820type StyleTransitions = {
1821 [K in keyof CSSStyleDeclarationWithTransform]?: Transition;
1822};
1823type SVGPathTransitions = {
1824 [K in keyof SVGPathProperties]: Transition;
1825};
1826type SVGTransitions = {
1827 [K in keyof SVGAttributes]: Transition;
1828};
1829type VariableTransitions = {
1830 [key: `--${string}`]: Transition;
1831};
1832type AnimationOptionsWithValueOverrides<V = any> = StyleTransitions & SVGPathTransitions & SVGTransitions & VariableTransitions & ValueAnimationTransition<V>;
1833interface DynamicAnimationOptions extends Omit<AnimationOptionsWithValueOverrides, "delay"> {
1834 delay?: number | DynamicOption<number>;
1835}
1836/**
1837 * @public
1838 */
1839interface AnimationPlaybackControls {
1840 time: number;
1841 speed: number;
1842 startTime: number | null;
1843 state?: AnimationPlayState;
1844 duration: number;
1845 stop: () => void;
1846 play: () => void;
1847 pause: () => void;
1848 complete: () => void;
1849 cancel: () => void;
1850 then: (onResolve: VoidFunction, onReject?: VoidFunction) => Promise<void>;
1851 attachTimeline?: (timeline: ProgressTimeline, fallback?: (animation: AnimationPlaybackControls) => VoidFunction) => VoidFunction;
1852 flatten: () => void;
1853}
1854type DynamicOption<T> = (i: number, total: number) => T;
1855interface CSSStyleDeclarationWithTransform extends Omit<CSSStyleDeclaration, "direction" | "transition" | "x" | "y" | "z"> {
1856 x: number | string;
1857 y: number | string;
1858 z: number | string;
1859 rotateX: number | string;
1860 rotateY: number | string;
1861 rotateZ: number | string;
1862 scaleX: number;
1863 scaleY: number;
1864 scaleZ: number;
1865 skewX: number | string;
1866 skewY: number | string;
1867}
1868type ValueKeyframe = string | number;
1869type UnresolvedValueKeyframe = ValueKeyframe | null;
1870type ValueKeyframesDefinition = ValueKeyframe | ValueKeyframe[] | UnresolvedValueKeyframe[];
1871type StyleKeyframesDefinition = {
1872 [K in keyof CSSStyleDeclarationWithTransform]?: ValueKeyframesDefinition;
1873};
1874type SVGKeyframesDefinition = {
1875 [K in keyof SVGAttributes]?: ValueKeyframesDefinition;
1876};
1877type VariableKeyframesDefinition = {
1878 [key: `--${string}`]: ValueKeyframesDefinition;
1879};
1880type SVGPathKeyframesDefinition = {
1881 [K in keyof SVGPathProperties]?: ValueKeyframesDefinition;
1882};
1883type DOMKeyframesDefinition = StyleKeyframesDefinition & SVGKeyframesDefinition & SVGPathKeyframesDefinition & VariableKeyframesDefinition;
1884interface VelocityOptions {
1885 velocity?: number;
1886 restSpeed?: number;
1887 restDelta?: number;
1888}
1889type RepeatType = "loop" | "reverse" | "mirror";
1890interface AnimationPlaybackOptions {
1891 repeat?: number;
1892 repeatType?: RepeatType;
1893 repeatDelay?: number;
1894}
1895interface DurationSpringOptions {
1896 duration?: number;
1897 visualDuration?: number;
1898 bounce?: number;
1899}
1900interface SpringOptions extends DurationSpringOptions, VelocityOptions {
1901 stiffness?: number;
1902 damping?: number;
1903 mass?: number;
1904}
1905interface DecayOptions extends VelocityOptions {
1906 keyframes?: number[];
1907 power?: number;
1908 timeConstant?: number;
1909 modifyTarget?: (v: number) => number;
1910}
1911interface InertiaOptions$1 extends DecayOptions {
1912 bounceStiffness?: number;
1913 bounceDamping?: number;
1914 min?: number;
1915 max?: number;
1916}
1917interface KeyframeOptions {
1918 ease?: Easing | Easing[];
1919 times?: number[];
1920}
1921type AnimationDefinition = VariantLabels | TargetAndTransition | TargetResolver;
1922/**
1923 * @public
1924 */
1925interface AnimationControls {
1926 /**
1927 * Starts an animation on all linked components.
1928 *
1929 * @remarks
1930 *
1931 * ```jsx
1932 * controls.start("variantLabel")
1933 * controls.start({
1934 * x: 0,
1935 * transition: { duration: 1 }
1936 * })
1937 * ```
1938 *
1939 * @param definition - Properties or variant label to animate to
1940 * @param transition - Optional `transtion` to apply to a variant
1941 * @returns - A `Promise` that resolves when all animations have completed.
1942 *
1943 * @public
1944 */
1945 start(definition: AnimationDefinition, transitionOverride?: Transition): Promise<any>;
1946 /**
1947 * Instantly set to a set of properties or a variant.
1948 *
1949 * ```jsx
1950 * // With properties
1951 * controls.set({ opacity: 0 })
1952 *
1953 * // With variants
1954 * controls.set("hidden")
1955 * ```
1956 *
1957 * @privateRemarks
1958 * We could perform a similar trick to `.start` where this can be called before mount
1959 * and we maintain a list of of pending actions that get applied on mount. But the
1960 * expectation of `set` is that it happens synchronously and this would be difficult
1961 * to do before any children have even attached themselves. It's also poor practise
1962 * and we should discourage render-synchronous `.start` calls rather than lean into this.
1963 *
1964 * @public
1965 */
1966 set(definition: AnimationDefinition): void;
1967 /**
1968 * Stops animations on all linked components.
1969 *
1970 * ```jsx
1971 * controls.stop()
1972 * ```
1973 *
1974 * @public
1975 */
1976 stop(): void;
1977 mount(): () => void;
1978}
1979
1980/**
1981 * @public
1982 */
1983type Subscriber<T> = (v: T) => void;
1984/**
1985 * @public
1986 */
1987type PassiveEffect<T> = (v: T, safeSetter: (v: T) => void) => void;
1988interface MotionValueEventCallbacks<V> {
1989 animationStart: () => void;
1990 animationComplete: () => void;
1991 animationCancel: () => void;
1992 change: (latestValue: V) => void;
1993 renderRequest: () => void;
1994}
1995interface ResolvedValues$1 {
1996 [key: string]: string | number;
1997}
1998interface Owner {
1999 current: HTMLElement | unknown;
2000 getProps: () => {
2001 onUpdate?: (latest: ResolvedValues$1) => void;
2002 };
2003}
2004interface MotionValueOptions {
2005 owner?: Owner;
2006}
2007/**
2008 * `MotionValue` is used to track the state and velocity of motion values.
2009 *
2010 * @public
2011 */
2012declare class MotionValue<V = any> {
2013 /**
2014 * This will be replaced by the build step with the latest version number.
2015 * When MotionValues are provided to motion components, warn if versions are mixed.
2016 */
2017 version: string;
2018 /**
2019 * If a MotionValue has an owner, it was created internally within Motion
2020 * and therefore has no external listeners. It is therefore safe to animate via WAAPI.
2021 */
2022 owner?: Owner;
2023 /**
2024 * The current state of the `MotionValue`.
2025 */
2026 private current;
2027 /**
2028 * The previous state of the `MotionValue`.
2029 */
2030 private prev;
2031 /**
2032 * The previous state of the `MotionValue` at the end of the previous frame.
2033 */
2034 private prevFrameValue;
2035 /**
2036 * The last time the `MotionValue` was updated.
2037 */
2038 updatedAt: number;
2039 /**
2040 * The time `prevFrameValue` was updated.
2041 */
2042 prevUpdatedAt: number | undefined;
2043 private stopPassiveEffect?;
2044 /**
2045 * A reference to the currently-controlling animation.
2046 */
2047 animation?: AnimationPlaybackControls;
2048 setCurrent(current: V): void;
2049 setPrevFrameValue(prevFrameValue?: V | undefined): void;
2050 /**
2051 * Adds a function that will be notified when the `MotionValue` is updated.
2052 *
2053 * It returns a function that, when called, will cancel the subscription.
2054 *
2055 * When calling `onChange` inside a React component, it should be wrapped with the
2056 * `useEffect` hook. As it returns an unsubscribe function, this should be returned
2057 * from the `useEffect` function to ensure you don't add duplicate subscribers..
2058 *
2059 * ```jsx
2060 * export const MyComponent = () => {
2061 * const x = useMotionValue(0)
2062 * const y = useMotionValue(0)
2063 * const opacity = useMotionValue(1)
2064 *
2065 * useEffect(() => {
2066 * function updateOpacity() {
2067 * const maxXY = Math.max(x.get(), y.get())
2068 * const newOpacity = transform(maxXY, [0, 100], [1, 0])
2069 * opacity.set(newOpacity)
2070 * }
2071 *
2072 * const unsubscribeX = x.on("change", updateOpacity)
2073 * const unsubscribeY = y.on("change", updateOpacity)
2074 *
2075 * return () => {
2076 * unsubscribeX()
2077 * unsubscribeY()
2078 * }
2079 * }, [])
2080 *
2081 * return <motion.div style={{ x }} />
2082 * }
2083 * ```
2084 *
2085 * @param subscriber - A function that receives the latest value.
2086 * @returns A function that, when called, will cancel this subscription.
2087 *
2088 * @deprecated
2089 */
2090 onChange(subscription: Subscriber<V>): () => void;
2091 /**
2092 * An object containing a SubscriptionManager for each active event.
2093 */
2094 private events;
2095 on<EventName extends keyof MotionValueEventCallbacks<V>>(eventName: EventName, callback: MotionValueEventCallbacks<V>[EventName]): VoidFunction;
2096 clearListeners(): void;
2097 /**
2098 * Sets the state of the `MotionValue`.
2099 *
2100 * @remarks
2101 *
2102 * ```jsx
2103 * const x = useMotionValue(0)
2104 * x.set(10)
2105 * ```
2106 *
2107 * @param latest - Latest value to set.
2108 * @param render - Whether to notify render subscribers. Defaults to `true`
2109 *
2110 * @public
2111 */
2112 set(v: V, render?: boolean): void;
2113 setWithVelocity(prev: V, current: V, delta: number): void;
2114 /**
2115 * Set the state of the `MotionValue`, stopping any active animations,
2116 * effects, and resets velocity to `0`.
2117 */
2118 jump(v: V, endAnimation?: boolean): void;
2119 updateAndNotify: (v: V, render?: boolean) => void;
2120 /**
2121 * Returns the latest state of `MotionValue`
2122 *
2123 * @returns - The latest state of `MotionValue`
2124 *
2125 * @public
2126 */
2127 get(): NonNullable<V>;
2128 /**
2129 * @public
2130 */
2131 getPrevious(): V | undefined;
2132 /**
2133 * Returns the latest velocity of `MotionValue`
2134 *
2135 * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
2136 *
2137 * @public
2138 */
2139 getVelocity(): number;
2140 hasAnimated: boolean;
2141 /**
2142 * Stop the currently active animation.
2143 *
2144 * @public
2145 */
2146 stop(): void;
2147 /**
2148 * Returns `true` if this value is currently animating.
2149 *
2150 * @public
2151 */
2152 isAnimating(): boolean;
2153 private clearAnimation;
2154 /**
2155 * Destroy and clean up subscribers to this `MotionValue`.
2156 *
2157 * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
2158 * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
2159 * created a `MotionValue` via the `motionValue` function.
2160 *
2161 * @public
2162 */
2163 destroy(): void;
2164}
2165declare function motionValue<V>(init: V, options?: MotionValueOptions): MotionValue<V>;
2166
2167type RefObject<T> = {
2168 current: T | null;
2169};
2170
2171/**
2172 * Passed in to pan event handlers like `onPan` the `PanInfo` object contains
2173 * information about the current state of the tap gesture such as its
2174 * `point`, `delta`, `offset` and `velocity`.
2175 *
2176 * ```jsx
2177 * <motion.div onPan={(event, info) => {
2178 * console.log(info.point.x, info.point.y)
2179 * }} />
2180 * ```
2181 *
2182 * @public
2183 */
2184interface PanInfo {
2185 /**
2186 * Contains `x` and `y` values for the current pan position relative
2187 * to the device or page.
2188 *
2189 * ```jsx
2190 * function onPan(event, info) {
2191 * console.log(info.point.x, info.point.y)
2192 * }
2193 *
2194 * <motion.div onPan={onPan} />
2195 * ```
2196 *
2197 * @public
2198 */
2199 point: Point;
2200 /**
2201 * Contains `x` and `y` values for the distance moved since
2202 * the last event.
2203 *
2204 * ```jsx
2205 * function onPan(event, info) {
2206 * console.log(info.delta.x, info.delta.y)
2207 * }
2208 *
2209 * <motion.div onPan={onPan} />
2210 * ```
2211 *
2212 * @public
2213 */
2214 delta: Point;
2215 /**
2216 * Contains `x` and `y` values for the distance moved from
2217 * the first pan event.
2218 *
2219 * ```jsx
2220 * function onPan(event, info) {
2221 * console.log(info.offset.x, info.offset.y)
2222 * }
2223 *
2224 * <motion.div onPan={onPan} />
2225 * ```
2226 *
2227 * @public
2228 */
2229 offset: Point;
2230 /**
2231 * Contains `x` and `y` values for the current velocity of the pointer, in px/ms.
2232 *
2233 * ```jsx
2234 * function onPan(event, info) {
2235 * console.log(info.velocity.x, info.velocity.y)
2236 * }
2237 *
2238 * <motion.div onPan={onPan} />
2239 * ```
2240 *
2241 * @public
2242 */
2243 velocity: Point;
2244}
2245
2246interface DragControlOptions {
2247 snapToCursor?: boolean;
2248 cursorProgress?: Point;
2249}
2250
2251/**
2252 * Can manually trigger a drag gesture on one or more `drag`-enabled `motion` components.
2253 *
2254 * ```jsx
2255 * const dragControls = useDragControls()
2256 *
2257 * function startDrag(event) {
2258 * dragControls.start(event, { snapToCursor: true })
2259 * }
2260 *
2261 * return (
2262 * <>
2263 * <div onPointerDown={startDrag} />
2264 * <motion.div drag="x" dragControls={dragControls} />
2265 * </>
2266 * )
2267 * ```
2268 *
2269 * @public
2270 */
2271declare class DragControls {
2272 private componentControls;
2273 /**
2274 * Start a drag gesture on every `motion` component that has this set of drag controls
2275 * passed into it via the `dragControls` prop.
2276 *
2277 * ```jsx
2278 * dragControls.start(e, {
2279 * snapToCursor: true
2280 * })
2281 * ```
2282 *
2283 * @param event - PointerEvent
2284 * @param options - Options
2285 *
2286 * @public
2287 */
2288 start(event: React$1.PointerEvent | PointerEvent, options?: DragControlOptions): void;
2289}
2290/**
2291 * Usually, dragging is initiated by pressing down on a `motion` component with a `drag` prop
2292 * and moving it. For some use-cases, for instance clicking at an arbitrary point on a video scrubber, we
2293 * might want to initiate that dragging from a different component than the draggable one.
2294 *
2295 * By creating a `dragControls` using the `useDragControls` hook, we can pass this into
2296 * the draggable component's `dragControls` prop. It exposes a `start` method
2297 * that can start dragging from pointer events on other components.
2298 *
2299 * ```jsx
2300 * const dragControls = useDragControls()
2301 *
2302 * function startDrag(event) {
2303 * dragControls.start(event, { snapToCursor: true })
2304 * }
2305 *
2306 * return (
2307 * <>
2308 * <div onPointerDown={startDrag} />
2309 * <motion.div drag="x" dragControls={dragControls} />
2310 * </>
2311 * )
2312 * ```
2313 *
2314 * @public
2315 */
2316declare function useDragControls(): DragControls;
2317
2318type DragElastic = boolean | number | Partial<BoundingBox>;
2319/**
2320 * @public
2321 */
2322interface DragHandlers {
2323 /**
2324 * Callback function that fires when dragging starts.
2325 *
2326 * ```jsx
2327 * <motion.div
2328 * drag
2329 * onDragStart={
2330 * (event, info) => console.log(info.point.x, info.point.y)
2331 * }
2332 * />
2333 * ```
2334 *
2335 * @public
2336 */
2337 onDragStart?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
2338 /**
2339 * Callback function that fires when dragging ends.
2340 *
2341 * ```jsx
2342 * <motion.div
2343 * drag
2344 * onDragEnd={
2345 * (event, info) => console.log(info.point.x, info.point.y)
2346 * }
2347 * />
2348 * ```
2349 *
2350 * @public
2351 */
2352 onDragEnd?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
2353 /**
2354 * Callback function that fires when the component is dragged.
2355 *
2356 * ```jsx
2357 * <motion.div
2358 * drag
2359 * onDrag={
2360 * (event, info) => console.log(info.point.x, info.point.y)
2361 * }
2362 * />
2363 * ```
2364 *
2365 * @public
2366 */
2367 onDrag?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
2368 /**
2369 * Callback function that fires a drag direction is determined.
2370 *
2371 * ```jsx
2372 * <motion.div
2373 * drag
2374 * dragDirectionLock
2375 * onDirectionLock={axis => console.log(axis)}
2376 * />
2377 * ```
2378 *
2379 * @public
2380 */
2381 onDirectionLock?(axis: "x" | "y"): void;
2382 /**
2383 * Callback function that fires when drag momentum/bounce transition finishes.
2384 *
2385 * ```jsx
2386 * <motion.div
2387 * drag
2388 * onDragTransitionEnd={() => console.log('Drag transition complete')}
2389 * />
2390 * ```
2391 *
2392 * @public
2393 */
2394 onDragTransitionEnd?(): void;
2395}
2396/**
2397 * @public
2398 */
2399type InertiaOptions = Partial<Omit<Inertia, "velocity" | "type">>;
2400/**
2401 * @public
2402 */
2403interface DraggableProps extends DragHandlers {
2404 /**
2405 * Enable dragging for this element. Set to `false` by default.
2406 * Set `true` to drag in both directions.
2407 * Set `"x"` or `"y"` to only drag in a specific direction.
2408 *
2409 * ```jsx
2410 * <motion.div drag="x" />
2411 * ```
2412 */
2413 drag?: boolean | "x" | "y";
2414 /**
2415 * Properties or variant label to animate to while the drag gesture is recognised.
2416 *
2417 * ```jsx
2418 * <motion.div whileDrag={{ scale: 1.2 }} />
2419 * ```
2420 */
2421 whileDrag?: VariantLabels | TargetAndTransition;
2422 /**
2423 * If `true`, this will lock dragging to the initially-detected direction. Defaults to `false`.
2424 *
2425 * ```jsx
2426 * <motion.div drag dragDirectionLock />
2427 * ```
2428 */
2429 dragDirectionLock?: boolean;
2430 /**
2431 * Allows drag gesture propagation to child components. Set to `false` by
2432 * default.
2433 *
2434 * ```jsx
2435 * <motion.div drag="x" dragPropagation />
2436 * ```
2437 */
2438 dragPropagation?: boolean;
2439 /**
2440 * Applies constraints on the permitted draggable area.
2441 *
2442 * It can accept an object of optional `top`, `left`, `right`, and `bottom` values, measured in pixels.
2443 * This will define a distance the named edge of the draggable component.
2444 *
2445 * Alternatively, it can accept a `ref` to another component created with React's `useRef` hook.
2446 * This `ref` should be passed both to the draggable component's `dragConstraints` prop, and the `ref`
2447 * of the component you want to use as constraints.
2448 *
2449 * ```jsx
2450 * // In pixels
2451 * <motion.div
2452 * drag="x"
2453 * dragConstraints={{ left: 0, right: 300 }}
2454 * />
2455 *
2456 * // As a ref to another component
2457 * const MyComponent = () => {
2458 * const constraintsRef = useRef(null)
2459 *
2460 * return (
2461 * <motion.div ref={constraintsRef}>
2462 * <motion.div drag dragConstraints={constraintsRef} />
2463 * </motion.div>
2464 * )
2465 * }
2466 * ```
2467 */
2468 dragConstraints?: false | Partial<BoundingBox> | RefObject<Element | null>;
2469 /**
2470 * The degree of movement allowed outside constraints. 0 = no movement, 1 =
2471 * full movement.
2472 *
2473 * Set to `0.5` by default. Can also be set as `false` to disable movement.
2474 *
2475 * By passing an object of `top`/`right`/`bottom`/`left`, individual values can be set
2476 * per constraint. Any missing values will be set to `0`.
2477 *
2478 * ```jsx
2479 * <motion.div
2480 * drag
2481 * dragConstraints={{ left: 0, right: 300 }}
2482 * dragElastic={0.2}
2483 * />
2484 * ```
2485 */
2486 dragElastic?: DragElastic;
2487 /**
2488 * Apply momentum from the pan gesture to the component when dragging
2489 * finishes. Set to `true` by default.
2490 *
2491 * ```jsx
2492 * <motion.div
2493 * drag
2494 * dragConstraints={{ left: 0, right: 300 }}
2495 * dragMomentum={false}
2496 * />
2497 * ```
2498 */
2499 dragMomentum?: boolean;
2500 /**
2501 * Allows you to change dragging inertia parameters.
2502 * 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.
2503 * See {@link https://framer.com/api/animation/#inertia | Inertia} for all properties you can use.
2504 *
2505 * ```jsx
2506 * <motion.div
2507 * drag
2508 * dragTransition={{ bounceStiffness: 600, bounceDamping: 10 }}
2509 * />
2510 * ```
2511 */
2512 dragTransition?: InertiaOptions;
2513 /**
2514 * Usually, dragging is initiated by pressing down on a component and moving it. For some
2515 * use-cases, for instance clicking at an arbitrary point on a video scrubber, we
2516 * might want to initiate dragging from a different component than the draggable one.
2517 *
2518 * By creating a `dragControls` using the `useDragControls` hook, we can pass this into
2519 * the draggable component's `dragControls` prop. It exposes a `start` method
2520 * that can start dragging from pointer events on other components.
2521 *
2522 * ```jsx
2523 * const dragControls = useDragControls()
2524 *
2525 * function startDrag(event) {
2526 * dragControls.start(event, { snapToCursor: true })
2527 * }
2528 *
2529 * return (
2530 * <>
2531 * <div onPointerDown={startDrag} />
2532 * <motion.div drag="x" dragControls={dragControls} />
2533 * </>
2534 * )
2535 * ```
2536 */
2537 dragControls?: DragControls;
2538 /**
2539 * If true, element will snap back to its origin when dragging ends.
2540 *
2541 * Enabling this is the equivalent of setting all `dragConstraints` axes to `0`
2542 * with `dragElastic={1}`, but when used together `dragConstraints` can define
2543 * a wider draggable area and `dragSnapToOrigin` will ensure the element
2544 * animates back to its origin on release.
2545 */
2546 dragSnapToOrigin?: boolean;
2547 /**
2548 * By default, if `drag` is defined on a component then an event listener will be attached
2549 * to automatically initiate dragging when a user presses down on it.
2550 *
2551 * By setting `dragListener` to `false`, this event listener will not be created.
2552 *
2553 * ```jsx
2554 * const dragControls = useDragControls()
2555 *
2556 * function startDrag(event) {
2557 * dragControls.start(event, { snapToCursor: true })
2558 * }
2559 *
2560 * return (
2561 * <>
2562 * <div onPointerDown={startDrag} />
2563 * <motion.div
2564 * drag="x"
2565 * dragControls={dragControls}
2566 * dragListener={false}
2567 * />
2568 * </>
2569 * )
2570 * ```
2571 */
2572 dragListener?: boolean;
2573 /**
2574 * If `dragConstraints` is set to a React ref, this callback will call with the measured drag constraints.
2575 *
2576 * @public
2577 */
2578 onMeasureDragConstraints?: (constraints: BoundingBox) => BoundingBox | void;
2579 /**
2580 * Usually, dragging uses the layout project engine, and applies transforms to the underlying VisualElement.
2581 * Passing MotionValues as _dragX and _dragY instead applies drag updates to these motion values.
2582 * This allows you to manually control how updates from a drag gesture on an element is applied.
2583 *
2584 * @public
2585 */
2586 _dragX?: MotionValue<number>;
2587 /**
2588 * Usually, dragging uses the layout project engine, and applies transforms to the underlying VisualElement.
2589 * Passing MotionValues as _dragX and _dragY instead applies drag updates to these motion values.
2590 * This allows you to manually control how updates from a drag gesture on an element is applied.
2591 *
2592 * @public
2593 */
2594 _dragY?: MotionValue<number>;
2595}
2596
2597/**
2598 * @public
2599 */
2600interface LayoutProps {
2601 /**
2602 * If `true`, this component will automatically animate to its new position when
2603 * its layout changes.
2604 *
2605 * ```jsx
2606 * <motion.div layout />
2607 * ```
2608 *
2609 * This will perform a layout animation using performant transforms. Part of this technique
2610 * involved animating an element's scale. This can introduce visual distortions on children,
2611 * `boxShadow` and `borderRadius`.
2612 *
2613 * To correct distortion on immediate children, add `layout` to those too.
2614 *
2615 * `boxShadow` and `borderRadius` will automatically be corrected if they are already being
2616 * animated on this component. Otherwise, set them directly via the `initial` prop.
2617 *
2618 * If `layout` is set to `"position"`, the size of the component will change instantly and
2619 * only its position will animate.
2620 *
2621 * If `layout` is set to `"size"`, the position of the component will change instantly and
2622 * only its size will animate.
2623 *
2624 * If `layout` is set to `"preserve-aspect"`, the component will animate size & position if
2625 * the aspect ratio remains the same between renders, and just position if the ratio changes.
2626 *
2627 * @public
2628 */
2629 layout?: boolean | "position" | "size" | "preserve-aspect";
2630 /**
2631 * Enable shared layout transitions between different components with the same `layoutId`.
2632 *
2633 * When a component with a layoutId is removed from the React tree, and then
2634 * added elsewhere, it will visually animate from the previous component's bounding box
2635 * and its latest animated values.
2636 *
2637 * ```jsx
2638 * {items.map(item => (
2639 * <motion.li layout>
2640 * {item.name}
2641 * {item.isSelected && <motion.div layoutId="underline" />}
2642 * </motion.li>
2643 * ))}
2644 * ```
2645 *
2646 * If the previous component remains in the tree it will crossfade with the new component.
2647 *
2648 * @public
2649 */
2650 layoutId?: string;
2651 /**
2652 * A callback that will fire when a layout animation on this component starts.
2653 *
2654 * @public
2655 */
2656 onLayoutAnimationStart?(): void;
2657 /**
2658 * A callback that will fire when a layout animation on this component completes.
2659 *
2660 * @public
2661 */
2662 onLayoutAnimationComplete?(): void;
2663 /**
2664 * @public
2665 */
2666 layoutDependency?: any;
2667 /**
2668 * Whether a projection node should measure its scroll when it or its descendants update their layout.
2669 *
2670 * @public
2671 */
2672 layoutScroll?: boolean;
2673 /**
2674 * Whether an element should be considered a "layout root", where
2675 * all children will be forced to resolve relatively to it.
2676 * Currently used for `position: sticky` elements in Framer.
2677 */
2678 layoutRoot?: boolean;
2679 /**
2680 * Attached to a portal root to ensure we attach the child to the document root and don't
2681 * perform scale correction on it.
2682 */
2683 "data-framer-portal-id"?: string;
2684}
2685
2686/** @public */
2687interface EventInfo {
2688 point: Point;
2689}
2690
2691/**
2692 * @public
2693 */
2694interface FocusHandlers {
2695 /**
2696 * Properties or variant label to animate to while the focus gesture is recognised.
2697 *
2698 * ```jsx
2699 * <motion.input whileFocus={{ scale: 1.2 }} />
2700 * ```
2701 */
2702 whileFocus?: VariantLabels | TargetAndTransition;
2703}
2704/**
2705 * Passed in to tap event handlers like `onTap` the `TapInfo` object contains
2706 * information about the tap gesture such as it‘s location.
2707 *
2708 * ```jsx
2709 * function onTap(event, info) {
2710 * console.log(info.point.x, info.point.y)
2711 * }
2712 *
2713 * <motion.div onTap={onTap} />
2714 * ```
2715 *
2716 * @public
2717 */
2718interface TapInfo {
2719 /**
2720 * Contains `x` and `y` values for the tap gesture relative to the
2721 * device or page.
2722 *
2723 * ```jsx
2724 * function onTapStart(event, info) {
2725 * console.log(info.point.x, info.point.y)
2726 * }
2727 *
2728 * <motion.div onTapStart={onTapStart} />
2729 * ```
2730 *
2731 * @public
2732 */
2733 point: Point;
2734}
2735/**
2736 * @public
2737 */
2738interface TapHandlers {
2739 /**
2740 * Callback when the tap gesture successfully ends on this element.
2741 *
2742 * ```jsx
2743 * function onTap(event, info) {
2744 * console.log(info.point.x, info.point.y)
2745 * }
2746 *
2747 * <motion.div onTap={onTap} />
2748 * ```
2749 *
2750 * @param event - The originating pointer event.
2751 * @param info - An {@link TapInfo} object containing `x` and `y` values for the `point` relative to the device or page.
2752 */
2753 onTap?(event: MouseEvent | TouchEvent | PointerEvent, info: TapInfo): void;
2754 /**
2755 * Callback when the tap gesture starts on this element.
2756 *
2757 * ```jsx
2758 * function onTapStart(event, info) {
2759 * console.log(info.point.x, info.point.y)
2760 * }
2761 *
2762 * <motion.div onTapStart={onTapStart} />
2763 * ```
2764 *
2765 * @param event - The originating pointer event.
2766 * @param info - An {@link TapInfo} object containing `x` and `y` values for the `point` relative to the device or page.
2767 */
2768 onTapStart?(event: MouseEvent | TouchEvent | PointerEvent, info: TapInfo): void;
2769 /**
2770 * Callback when the tap gesture ends outside this element.
2771 *
2772 * ```jsx
2773 * function onTapCancel(event, info) {
2774 * console.log(info.point.x, info.point.y)
2775 * }
2776 *
2777 * <motion.div onTapCancel={onTapCancel} />
2778 * ```
2779 *
2780 * @param event - The originating pointer event.
2781 * @param info - An {@link TapInfo} object containing `x` and `y` values for the `point` relative to the device or page.
2782 */
2783 onTapCancel?(event: MouseEvent | TouchEvent | PointerEvent, info: TapInfo): void;
2784 /**
2785 * Properties or variant label to animate to while the component is pressed.
2786 *
2787 * ```jsx
2788 * <motion.div whileTap={{ scale: 0.8 }} />
2789 * ```
2790 */
2791 whileTap?: VariantLabels | TargetAndTransition;
2792 /**
2793 * If `true`, the tap gesture will attach its start listener to window.
2794 *
2795 * Note: This is not supported publically.
2796 */
2797 globalTapTarget?: boolean;
2798}
2799/**
2800 * @public
2801 */
2802interface PanHandlers {
2803 /**
2804 * Callback function that fires when the pan gesture is recognised on this element.
2805 *
2806 * **Note:** For pan gestures to work correctly with touch input, the element needs
2807 * touch scrolling to be disabled on either x/y or both axis with the
2808 * [touch-action](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) CSS rule.
2809 *
2810 * ```jsx
2811 * function onPan(event, info) {
2812 * console.log(info.point.x, info.point.y)
2813 * }
2814 *
2815 * <motion.div onPan={onPan} />
2816 * ```
2817 *
2818 * @param event - The originating pointer event.
2819 * @param info - A {@link PanInfo} object containing `x` and `y` values for:
2820 *
2821 * - `point`: Relative to the device or page.
2822 * - `delta`: Distance moved since the last event.
2823 * - `offset`: Offset from the original pan event.
2824 * - `velocity`: Current velocity of the pointer.
2825 */
2826 onPan?(event: PointerEvent, info: PanInfo): void;
2827 /**
2828 * Callback function that fires when the pan gesture begins on this element.
2829 *
2830 * ```jsx
2831 * function onPanStart(event, info) {
2832 * console.log(info.point.x, info.point.y)
2833 * }
2834 *
2835 * <motion.div onPanStart={onPanStart} />
2836 * ```
2837 *
2838 * @param event - The originating pointer event.
2839 * @param info - A {@link PanInfo} object containing `x`/`y` values for:
2840 *
2841 * - `point`: Relative to the device or page.
2842 * - `delta`: Distance moved since the last event.
2843 * - `offset`: Offset from the original pan event.
2844 * - `velocity`: Current velocity of the pointer.
2845 */
2846 onPanStart?(event: PointerEvent, info: PanInfo): void;
2847 /**
2848 * Callback function that fires when we begin detecting a pan gesture. This
2849 * is analogous to `onMouseStart` or `onTouchStart`.
2850 *
2851 * ```jsx
2852 * function onPanSessionStart(event, info) {
2853 * console.log(info.point.x, info.point.y)
2854 * }
2855 *
2856 * <motion.div onPanSessionStart={onPanSessionStart} />
2857 * ```
2858 *
2859 * @param event - The originating pointer event.
2860 * @param info - An {@link EventInfo} object containing `x`/`y` values for:
2861 *
2862 * - `point`: Relative to the device or page.
2863 */
2864 onPanSessionStart?(event: PointerEvent, info: EventInfo): void;
2865 /**
2866 * Callback function that fires when the pan gesture ends on this element.
2867 *
2868 * ```jsx
2869 * function onPanEnd(event, info) {
2870 * console.log(info.point.x, info.point.y)
2871 * }
2872 *
2873 * <motion.div onPanEnd={onPanEnd} />
2874 * ```
2875 *
2876 * @param event - The originating pointer event.
2877 * @param info - A {@link PanInfo} object containing `x`/`y` values for:
2878 *
2879 * - `point`: Relative to the device or page.
2880 * - `delta`: Distance moved since the last event.
2881 * - `offset`: Offset from the original pan event.
2882 * - `velocity`: Current velocity of the pointer.
2883 */
2884 onPanEnd?(event: PointerEvent, info: PanInfo): void;
2885}
2886/**
2887 * @public
2888 */
2889interface HoverHandlers {
2890 /**
2891 * Properties or variant label to animate to while the hover gesture is recognised.
2892 *
2893 * ```jsx
2894 * <motion.div whileHover={{ scale: 1.2 }} />
2895 * ```
2896 */
2897 whileHover?: VariantLabels | TargetAndTransition;
2898 /**
2899 * Callback function that fires when pointer starts hovering over the component.
2900 *
2901 * ```jsx
2902 * <motion.div onHoverStart={() => console.log('Hover starts')} />
2903 * ```
2904 */
2905 onHoverStart?(event: MouseEvent, info: EventInfo): void;
2906 /**
2907 * Callback function that fires when pointer stops hovering over the component.
2908 *
2909 * ```jsx
2910 * <motion.div onHoverEnd={() => console.log("Hover ends")} />
2911 * ```
2912 */
2913 onHoverEnd?(event: MouseEvent, info: EventInfo): void;
2914}
2915
2916type ViewportEventHandler = (entry: IntersectionObserverEntry | null) => void;
2917interface ViewportOptions {
2918 root?: RefObject<Element | null>;
2919 once?: boolean;
2920 margin?: string;
2921 amount?: "some" | "all" | number;
2922}
2923interface ViewportProps {
2924 whileInView?: VariantLabels | TargetAndTransition;
2925 onViewportEnter?: ViewportEventHandler;
2926 onViewportLeave?: ViewportEventHandler;
2927 viewport?: ViewportOptions;
2928}
2929
2930/**
2931 * Either a string, or array of strings, that reference variants defined via the `variants` prop.
2932 * @public
2933 */
2934type VariantLabels = string | string[];
2935interface TransformProperties {
2936 x?: string | number;
2937 y?: string | number;
2938 z?: string | number;
2939 translateX?: string | number;
2940 translateY?: string | number;
2941 translateZ?: string | number;
2942 rotate?: string | number;
2943 rotateX?: string | number;
2944 rotateY?: string | number;
2945 rotateZ?: string | number;
2946 scale?: string | number;
2947 scaleX?: string | number;
2948 scaleY?: string | number;
2949 scaleZ?: string | number;
2950 skew?: string | number;
2951 skewX?: string | number;
2952 skewY?: string | number;
2953 originX?: string | number;
2954 originY?: string | number;
2955 originZ?: string | number;
2956 perspective?: string | number;
2957 transformPerspective?: string | number;
2958}
2959/**
2960 * @public
2961 */
2962interface SVGPathProperties {
2963 pathLength?: number;
2964 pathOffset?: number;
2965 pathSpacing?: number;
2966}
2967interface CustomStyles {
2968 /**
2969 * Framer Library custom prop types. These are not actually supported in Motion - preferably
2970 * we'd have a way of external consumers injecting supported styles into this library.
2971 */
2972 size?: string | number;
2973 radius?: string | number;
2974 shadow?: string;
2975 image?: string;
2976}
2977type MakeMotion<T> = MakeCustomValueType<{
2978 [K in keyof T]: T[K] | MotionValue<number> | MotionValue<string> | MotionValue<any>;
2979}>;
2980type MotionCSS = MakeMotion<Omit$1<CSSProperties, "rotate" | "scale" | "perspective">>;
2981/**
2982 * @public
2983 */
2984type MotionTransform = MakeMotion<TransformProperties>;
2985/**
2986 * @public
2987 */
2988type MotionStyle = MotionCSS & MotionTransform & MakeMotion<SVGPathProperties> & MakeCustomValueType<CustomStyles>;
2989/**
2990 * @public
2991 */
2992interface AnimationProps {
2993 /**
2994 * Properties, variant label or array of variant labels to start in.
2995 *
2996 * Set to `false` to initialise with the values in `animate` (disabling the mount animation)
2997 *
2998 * ```jsx
2999 * // As values
3000 * <motion.div initial={{ opacity: 1 }} />
3001 *
3002 * // As variant
3003 * <motion.div initial="visible" variants={variants} />
3004 *
3005 * // Multiple variants
3006 * <motion.div initial={["visible", "active"]} variants={variants} />
3007 *
3008 * // As false (disable mount animation)
3009 * <motion.div initial={false} animate={{ opacity: 0 }} />
3010 * ```
3011 */
3012 initial?: boolean | Target | VariantLabels;
3013 /**
3014 * Values to animate to, variant label(s), or `AnimationControls`.
3015 *
3016 * ```jsx
3017 * // As values
3018 * <motion.div animate={{ opacity: 1 }} />
3019 *
3020 * // As variant
3021 * <motion.div animate="visible" variants={variants} />
3022 *
3023 * // Multiple variants
3024 * <motion.div animate={["visible", "active"]} variants={variants} />
3025 *
3026 * // AnimationControls
3027 * <motion.div animate={animation} />
3028 * ```
3029 */
3030 animate?: AnimationControls | TargetAndTransition | VariantLabels | boolean;
3031 /**
3032 * A target to animate to when this component is removed from the tree.
3033 *
3034 * This component **must** be the first animatable child of an `AnimatePresence` to enable this exit animation.
3035 *
3036 * This limitation exists because React doesn't allow components to defer unmounting until after
3037 * an animation is complete. Once this limitation is fixed, the `AnimatePresence` component will be unnecessary.
3038 *
3039 * ```jsx
3040 * import { AnimatePresence, motion } from 'framer-motion'
3041 *
3042 * export const MyComponent = ({ isVisible }) => {
3043 * return (
3044 * <AnimatePresence>
3045 * {isVisible && (
3046 * <motion.div
3047 * initial={{ opacity: 0 }}
3048 * animate={{ opacity: 1 }}
3049 * exit={{ opacity: 0 }}
3050 * />
3051 * )}
3052 * </AnimatePresence>
3053 * )
3054 * }
3055 * ```
3056 */
3057 exit?: TargetAndTransition | VariantLabels;
3058 /**
3059 * Variants allow you to define animation states and organise them by name. They allow
3060 * you to control animations throughout a component tree by switching a single `animate` prop.
3061 *
3062 * Using `transition` options like `delayChildren` and `staggerChildren`, you can orchestrate
3063 * when children animations play relative to their parent.
3064
3065 *
3066 * After passing variants to one or more `motion` component's `variants` prop, these variants
3067 * can be used in place of values on the `animate`, `initial`, `whileFocus`, `whileTap` and `whileHover` props.
3068 *
3069 * ```jsx
3070 * const variants = {
3071 * active: {
3072 * backgroundColor: "#f00"
3073 * },
3074 * inactive: {
3075 * backgroundColor: "#fff",
3076 * transition: { duration: 2 }
3077 * }
3078 * }
3079 *
3080 * <motion.div variants={variants} animate="active" />
3081 * ```
3082 */
3083 variants?: Variants;
3084 /**
3085 * Default transition. If no `transition` is defined in `animate`, it will use the transition defined here.
3086 * ```jsx
3087 * const spring = {
3088 * type: "spring",
3089 * damping: 10,
3090 * stiffness: 100
3091 * }
3092 *
3093 * <motion.div transition={spring} animate={{ scale: 1.2 }} />
3094 * ```
3095 */
3096 transition?: Transition$1;
3097}
3098/**
3099 * @public
3100 */
3101interface MotionAdvancedProps {
3102 /**
3103 * Custom data to use to resolve dynamic variants differently for each animating component.
3104 *
3105 * ```jsx
3106 * const variants = {
3107 * visible: (custom) => ({
3108 * opacity: 1,
3109 * transition: { delay: custom * 0.2 }
3110 * })
3111 * }
3112 *
3113 * <motion.div custom={0} animate="visible" variants={variants} />
3114 * <motion.div custom={1} animate="visible" variants={variants} />
3115 * <motion.div custom={2} animate="visible" variants={variants} />
3116 * ```
3117 *
3118 * @public
3119 */
3120 custom?: any;
3121 /**
3122 * @public
3123 * Set to `false` to prevent inheriting variant changes from its parent.
3124 */
3125 inherit?: boolean;
3126 /**
3127 * @public
3128 * Set to `false` to prevent throwing an error when a `motion` component is used within a `LazyMotion` set to strict.
3129 */
3130 ignoreStrict?: boolean;
3131}
3132/**
3133 * Props for `motion` components.
3134 *
3135 * @public
3136 */
3137interface MotionProps extends AnimationProps, EventProps, PanHandlers, TapHandlers, HoverHandlers, FocusHandlers, ViewportProps, DraggableProps, LayoutProps, MotionAdvancedProps {
3138 /**
3139 *
3140 * The React DOM `style` prop, enhanced with support for `MotionValue`s and separate `transform` values.
3141 *
3142 * ```jsx
3143 * export const MyComponent = () => {
3144 * const x = useMotionValue(0)
3145 *
3146 * return <motion.div style={{ x, opacity: 1, scale: 0.5 }} />
3147 * }
3148 * ```
3149 */
3150 style?: MotionStyle;
3151 /**
3152 * By default, Motion generates a `transform` property with a sensible transform order. `transformTemplate`
3153 * can be used to create a different order, or to append/preprend the automatically generated `transform` property.
3154 *
3155 * ```jsx
3156 * <motion.div
3157 * style={{ x: 0, rotate: 180 }}
3158 * transformTemplate={
3159 * ({ x, rotate }) => `rotate(${rotate}deg) translateX(${x}px)`
3160 * }
3161 * />
3162 * ```
3163 *
3164 * @param transform - The latest animated transform props.
3165 * @param generatedTransform - The transform string as automatically generated by Motion
3166 *
3167 * @public
3168 */
3169 transformTemplate?(transform: TransformProperties, generatedTransform: string): string;
3170 children?: React.ReactNode | MotionValue<number> | MotionValue<string>;
3171 "data-framer-appear-id"?: string;
3172}
3173
3174interface VisualState<Instance, RenderState> {
3175 renderState: RenderState;
3176 latestValues: ResolvedValues;
3177 mount?: (instance: Instance) => void;
3178}
3179type UseVisualState<Instance, RenderState> = (props: MotionProps, isStatic: boolean) => VisualState<Instance, RenderState>;
3180interface UseVisualStateConfig<Instance, RenderState> {
3181 scrapeMotionValuesFromProps: ScrapeMotionValuesFromProps;
3182 createRenderState: () => RenderState;
3183 onMount?: (props: MotionProps, instance: Instance, visualState: VisualState<Instance, RenderState>) => void;
3184}
3185declare const makeUseVisualState: <I, RS>(config: UseVisualStateConfig<I, RS>) => UseVisualState<I, RS>;
3186
3187type ScrapeMotionValuesFromProps = (props: MotionProps, prevProps: MotionProps, visualElement?: VisualElement) => {
3188 [key: string]: MotionValue | string | number;
3189};
3190type VisualElementOptions<Instance, RenderState = any> = {
3191 visualState: VisualState<Instance, RenderState>;
3192 parent?: VisualElement<unknown>;
3193 variantParent?: VisualElement<unknown>;
3194 presenceContext: PresenceContextProps | null;
3195 props: MotionProps;
3196 blockInitialAnimation?: boolean;
3197 reducedMotionConfig?: ReducedMotionConfig;
3198};
3199/**
3200 * A generic set of string/number values
3201 */
3202interface ResolvedValues {
3203 [key: string]: string | number;
3204}
3205interface VisualElementEventCallbacks {
3206 BeforeLayoutMeasure: () => void;
3207 LayoutMeasure: (layout: Box, prevLayout?: Box) => void;
3208 LayoutUpdate: (layout: Axis, prevLayout: Axis) => void;
3209 Update: (latest: ResolvedValues) => void;
3210 AnimationStart: (definition: AnimationDefinition) => void;
3211 AnimationComplete: (definition: AnimationDefinition) => void;
3212 LayoutAnimationStart: () => void;
3213 LayoutAnimationComplete: () => void;
3214 SetAxisTarget: () => void;
3215 Unmount: () => void;
3216}
3217interface LayoutLifecycles {
3218 onBeforeLayoutMeasure?(box: Box): void;
3219 onLayoutMeasure?(box: Box, prevBox: Box): void;
3220}
3221interface AnimationLifecycles {
3222 /**
3223 * Callback with latest motion values, fired max once per frame.
3224 *
3225 * ```jsx
3226 * function onUpdate(latest) {
3227 * console.log(latest.x, latest.opacity)
3228 * }
3229 *
3230 * <motion.div animate={{ x: 100, opacity: 0 }} onUpdate={onUpdate} />
3231 * ```
3232 */
3233 onUpdate?(latest: ResolvedValues): void;
3234 /**
3235 * Callback when animation defined in `animate` begins.
3236 *
3237 * The provided callback will be called with the triggering animation definition.
3238 * If this is a variant, it'll be the variant name, and if a target object
3239 * then it'll be the target object.
3240 *
3241 * This way, it's possible to figure out which animation has started.
3242 *
3243 * ```jsx
3244 * function onStart() {
3245 * console.log("Animation started")
3246 * }
3247 *
3248 * <motion.div animate={{ x: 100 }} onAnimationStart={onStart} />
3249 * ```
3250 */
3251 onAnimationStart?(definition: AnimationDefinition): void;
3252 /**
3253 * Callback when animation defined in `animate` is complete.
3254 *
3255 * The provided callback will be called with the triggering animation definition.
3256 * If this is a variant, it'll be the variant name, and if a target object
3257 * then it'll be the target object.
3258 *
3259 * This way, it's possible to figure out which animation has completed.
3260 *
3261 * ```jsx
3262 * function onComplete() {
3263 * console.log("Animation completed")
3264 * }
3265 *
3266 * <motion.div
3267 * animate={{ x: 100 }}
3268 * onAnimationComplete={definition => {
3269 * console.log('Completed animating', definition)
3270 * }}
3271 * />
3272 * ```
3273 */
3274 onAnimationComplete?(definition: AnimationDefinition): void;
3275}
3276type EventProps = LayoutLifecycles & AnimationLifecycles;
3277type CreateVisualElement<Instance> = (Component: string | React.ComponentType<React.PropsWithChildren<unknown>>, options: VisualElementOptions<Instance>) => VisualElement<Instance>;
3278
3279type UnionStringArray<T extends Readonly<string[]>> = T[number];
3280declare 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"];
3281type SVGElements = UnionStringArray<typeof svgElements>;
3282
3283interface HTMLElements {
3284 a: HTMLAnchorElement;
3285 abbr: HTMLElement;
3286 address: HTMLElement;
3287 area: HTMLAreaElement;
3288 article: HTMLElement;
3289 aside: HTMLElement;
3290 audio: HTMLAudioElement;
3291 b: HTMLElement;
3292 base: HTMLBaseElement;
3293 bdi: HTMLElement;
3294 bdo: HTMLElement;
3295 big: HTMLElement;
3296 blockquote: HTMLQuoteElement;
3297 body: HTMLBodyElement;
3298 br: HTMLBRElement;
3299 button: HTMLButtonElement;
3300 canvas: HTMLCanvasElement;
3301 caption: HTMLElement;
3302 center: HTMLElement;
3303 cite: HTMLElement;
3304 code: HTMLElement;
3305 col: HTMLTableColElement;
3306 colgroup: HTMLTableColElement;
3307 data: HTMLDataElement;
3308 datalist: HTMLDataListElement;
3309 dd: HTMLElement;
3310 del: HTMLModElement;
3311 details: HTMLDetailsElement;
3312 dfn: HTMLElement;
3313 dialog: HTMLDialogElement;
3314 div: HTMLDivElement;
3315 dl: HTMLDListElement;
3316 dt: HTMLElement;
3317 em: HTMLElement;
3318 embed: HTMLEmbedElement;
3319 fieldset: HTMLFieldSetElement;
3320 figcaption: HTMLElement;
3321 figure: HTMLElement;
3322 footer: HTMLElement;
3323 form: HTMLFormElement;
3324 h1: HTMLHeadingElement;
3325 h2: HTMLHeadingElement;
3326 h3: HTMLHeadingElement;
3327 h4: HTMLHeadingElement;
3328 h5: HTMLHeadingElement;
3329 h6: HTMLHeadingElement;
3330 head: HTMLHeadElement;
3331 header: HTMLElement;
3332 hgroup: HTMLElement;
3333 hr: HTMLHRElement;
3334 html: HTMLHtmlElement;
3335 i: HTMLElement;
3336 iframe: HTMLIFrameElement;
3337 img: HTMLImageElement;
3338 input: HTMLInputElement;
3339 ins: HTMLModElement;
3340 kbd: HTMLElement;
3341 keygen: HTMLElement;
3342 label: HTMLLabelElement;
3343 legend: HTMLLegendElement;
3344 li: HTMLLIElement;
3345 link: HTMLLinkElement;
3346 main: HTMLElement;
3347 map: HTMLMapElement;
3348 mark: HTMLElement;
3349 menu: HTMLElement;
3350 menuitem: HTMLElement;
3351 meta: HTMLMetaElement;
3352 meter: HTMLMeterElement;
3353 nav: HTMLElement;
3354 noindex: HTMLElement;
3355 noscript: HTMLElement;
3356 object: HTMLObjectElement;
3357 ol: HTMLOListElement;
3358 optgroup: HTMLOptGroupElement;
3359 option: HTMLOptionElement;
3360 output: HTMLOutputElement;
3361 p: HTMLParagraphElement;
3362 param: HTMLParamElement;
3363 picture: HTMLElement;
3364 pre: HTMLPreElement;
3365 progress: HTMLProgressElement;
3366 q: HTMLQuoteElement;
3367 rp: HTMLElement;
3368 rt: HTMLElement;
3369 ruby: HTMLElement;
3370 s: HTMLElement;
3371 samp: HTMLElement;
3372 search: HTMLElement;
3373 slot: HTMLSlotElement;
3374 script: HTMLScriptElement;
3375 section: HTMLElement;
3376 select: HTMLSelectElement;
3377 small: HTMLElement;
3378 source: HTMLSourceElement;
3379 span: HTMLSpanElement;
3380 strong: HTMLElement;
3381 style: HTMLStyleElement;
3382 sub: HTMLElement;
3383 summary: HTMLElement;
3384 sup: HTMLElement;
3385 table: HTMLTableElement;
3386 template: HTMLTemplateElement;
3387 tbody: HTMLTableSectionElement;
3388 td: HTMLTableDataCellElement;
3389 textarea: HTMLTextAreaElement;
3390 tfoot: HTMLTableSectionElement;
3391 th: HTMLTableHeaderCellElement;
3392 thead: HTMLTableSectionElement;
3393 time: HTMLTimeElement;
3394 title: HTMLTitleElement;
3395 tr: HTMLTableRowElement;
3396 track: HTMLTrackElement;
3397 u: HTMLElement;
3398 ul: HTMLUListElement;
3399 var: HTMLElement;
3400 video: HTMLVideoElement;
3401 wbr: HTMLElement;
3402 webview: HTMLWebViewElement;
3403}
3404
3405interface TransformOrigin {
3406 originX?: number | string;
3407 originY?: number | string;
3408 originZ?: number | string;
3409}
3410interface HTMLRenderState {
3411 /**
3412 * A mutable record of transforms we want to apply directly to the rendered Element
3413 * every frame. We use a mutable data structure to reduce GC during animations.
3414 */
3415 transform: ResolvedValues;
3416 /**
3417 * A mutable record of transform origins we want to apply directly to the rendered Element
3418 * every frame. We use a mutable data structure to reduce GC during animations.
3419 */
3420 transformOrigin: TransformOrigin;
3421 /**
3422 * A mutable record of styles we want to apply directly to the rendered Element
3423 * every frame. We use a mutable data structure to reduce GC during animations.
3424 */
3425 style: ResolvedValues;
3426 /**
3427 * A mutable record of CSS variables we want to apply directly to the rendered Element
3428 * every frame. We use a mutable data structure to reduce GC during animations.
3429 */
3430 vars: ResolvedValues;
3431}
3432/**
3433 * @public
3434 */
3435type ForwardRefComponent<T, P> = {
3436 readonly $$typeof: symbol;
3437} & ((props: PropsWithoutRef<P> & RefAttributes<T>) => JSX.Element);
3438type AttributesWithoutMotionProps<Attributes> = {
3439 [K in Exclude<keyof Attributes, keyof MotionProps>]?: Attributes[K];
3440};
3441/**
3442 * @public
3443 */
3444type HTMLMotionProps<Tag extends keyof HTMLElements> = AttributesWithoutMotionProps<JSX.IntrinsicElements[Tag]> & MotionProps;
3445/**
3446 * Motion-optimised versions of React's HTML components.
3447 *
3448 * @public
3449 */
3450type HTMLMotionComponents = {
3451 [K in keyof HTMLElements]: ForwardRefComponent<HTMLElements[K], HTMLMotionProps<K>>;
3452};
3453
3454interface SVGAttributesWithoutMotionProps<T> extends Pick<SVGAttributes$1<T>, Exclude<keyof SVGAttributes$1<T>, keyof MotionProps>> {
3455}
3456/**
3457 * Blanket-accept any SVG attribute as a `MotionValue`
3458 * @public
3459 */
3460type SVGAttributesAsMotionValues<T> = MakeMotion<SVGAttributesWithoutMotionProps<T>>;
3461type UnwrapSVGFactoryElement<F> = F extends React.SVGProps<infer P> ? P : never;
3462/**
3463 * @public
3464 */
3465interface SVGMotionProps<T> extends SVGAttributesAsMotionValues<T>, MotionProps {
3466}
3467/**
3468 * Motion-optimised versions of React's SVG components.
3469 *
3470 * @public
3471 */
3472type SVGMotionComponents = {
3473 [K in SVGElements]: ForwardRefComponent<UnwrapSVGFactoryElement<JSX.IntrinsicElements[K]>, SVGMotionProps<UnwrapSVGFactoryElement<JSX.IntrinsicElements[K]>>>;
3474};
3475
3476declare abstract class Feature<T extends any = any> {
3477 isMounted: boolean;
3478 node: VisualElement<T>;
3479 constructor(node: VisualElement<T>);
3480 abstract mount(): void;
3481 abstract unmount(): void;
3482 update(): void;
3483}
3484
3485declare function MeasureLayout(props: MotionProps & {
3486 visualElement: VisualElement;
3487}): react_jsx_runtime.JSX.Element;
3488
3489interface FeatureClass<Props = unknown> {
3490 new (props: Props): Feature<Props>;
3491}
3492type HydratedFeatureDefinition = {
3493 isEnabled: (props: MotionProps) => boolean;
3494 Feature: FeatureClass<unknown>;
3495 ProjectionNode?: any;
3496 MeasureLayout?: typeof MeasureLayout;
3497};
3498interface HydratedFeatureDefinitions {
3499 animation?: HydratedFeatureDefinition;
3500 exit?: HydratedFeatureDefinition;
3501 drag?: HydratedFeatureDefinition;
3502 tap?: HydratedFeatureDefinition;
3503 focus?: HydratedFeatureDefinition;
3504 hover?: HydratedFeatureDefinition;
3505 pan?: HydratedFeatureDefinition;
3506 inView?: HydratedFeatureDefinition;
3507 layout?: HydratedFeatureDefinition;
3508}
3509type FeatureDefinition = {
3510 isEnabled: HydratedFeatureDefinition["isEnabled"];
3511 Feature?: HydratedFeatureDefinition["Feature"];
3512 ProjectionNode?: HydratedFeatureDefinition["ProjectionNode"];
3513 MeasureLayout?: HydratedFeatureDefinition["MeasureLayout"];
3514};
3515type FeatureDefinitions = {
3516 [K in keyof HydratedFeatureDefinitions]: FeatureDefinition;
3517};
3518type FeaturePackage = {
3519 Feature?: HydratedFeatureDefinition["Feature"];
3520 ProjectionNode?: HydratedFeatureDefinition["ProjectionNode"];
3521 MeasureLayout?: HydratedFeatureDefinition["MeasureLayout"];
3522};
3523type FeaturePackages = {
3524 [K in keyof HydratedFeatureDefinitions]: FeaturePackage;
3525};
3526interface FeatureBundle extends FeaturePackages {
3527 renderer: CreateVisualElement<any>;
3528}
3529type LazyFeatureBundle$1 = () => Promise<FeatureBundle>;
3530type 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;
3531
3532interface MotionComponentConfig<Instance, RenderState> {
3533 preloadedFeatures?: FeatureBundle;
3534 createVisualElement?: CreateVisualElement<Instance>;
3535 useRender: RenderComponent<Instance, RenderState>;
3536 useVisualState: UseVisualState<Instance, RenderState>;
3537 Component: string | React$1.ComponentType<React$1.PropsWithChildren<unknown>>;
3538}
3539type MotionComponentProps<Props> = {
3540 [K in Exclude<keyof Props, keyof MotionProps>]?: Props[K];
3541} & MotionProps;
3542/**
3543 * Create a `motion` component.
3544 *
3545 * This function accepts a Component argument, which can be either a string (ie "div"
3546 * for `motion.div`), or an actual React component.
3547 *
3548 * Alongside this is a config option which provides a way of rendering the provided
3549 * component "offline", or outside the React render cycle.
3550 */
3551declare function createRendererMotionComponent<Props extends {}, Instance, RenderState>({ preloadedFeatures, createVisualElement, useRender, useVisualState, Component, }: MotionComponentConfig<Instance, RenderState>): React$1.ForwardRefExoticComponent<React$1.RefAttributes<unknown>>;
3552
3553declare const motion: (<Props, TagName extends string = "div">(Component: string | TagName | React$1.ComponentType<Props>, { forwardMotionProps }?: {
3554 forwardMotionProps: boolean;
3555}) => TagName extends "symbol" | "filter" | "stop" | "clipPath" | "mask" | "marker" | "animate" | "text" | "path" | "image" | "circle" | "switch" | "svg" | keyof HTMLElements | "defs" | "desc" | "ellipse" | "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" | "g" | "line" | "linearGradient" | "metadata" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "textPath" | "tspan" | "use" | "view" ? DOMMotionComponents[TagName] : React$1.ComponentType<MotionComponentProps<React$1.PropsWithChildren<Props>>>) & HTMLMotionComponents & SVGMotionComponents & {
3556 create: <Props, TagName extends string = "div">(Component: string | TagName | React$1.ComponentType<Props>, { forwardMotionProps }?: {
3557 forwardMotionProps: boolean;
3558 }) => TagName extends "symbol" | "filter" | "stop" | "clipPath" | "mask" | "marker" | "animate" | "text" | "path" | "image" | "circle" | "switch" | "svg" | keyof HTMLElements | "defs" | "desc" | "ellipse" | "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" | "g" | "line" | "linearGradient" | "metadata" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "textPath" | "tspan" | "use" | "view" ? DOMMotionComponents[TagName] : React$1.ComponentType<MotionComponentProps<React$1.PropsWithChildren<Props>>>;
3559};
3560
3561declare const m: (<Props, TagName extends string = "div">(Component: string | TagName | React$1.ComponentType<Props>, { forwardMotionProps }?: {
3562 forwardMotionProps: boolean;
3563}) => TagName extends "symbol" | "filter" | "stop" | "clipPath" | "mask" | "marker" | "animate" | "text" | "path" | "image" | "circle" | "switch" | "svg" | keyof HTMLElements | "defs" | "desc" | "ellipse" | "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" | "g" | "line" | "linearGradient" | "metadata" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "textPath" | "tspan" | "use" | "view" ? DOMMotionComponents[TagName] : React$1.ComponentType<MotionComponentProps<React$1.PropsWithChildren<Props>>>) & HTMLMotionComponents & SVGMotionComponents & {
3564 create: <Props, TagName extends string = "div">(Component: string | TagName | React$1.ComponentType<Props>, { forwardMotionProps }?: {
3565 forwardMotionProps: boolean;
3566 }) => TagName extends "symbol" | "filter" | "stop" | "clipPath" | "mask" | "marker" | "animate" | "text" | "path" | "image" | "circle" | "switch" | "svg" | keyof HTMLElements | "defs" | "desc" | "ellipse" | "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" | "g" | "line" | "linearGradient" | "metadata" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "textPath" | "tspan" | "use" | "view" ? DOMMotionComponents[TagName] : React$1.ComponentType<MotionComponentProps<React$1.PropsWithChildren<Props>>>;
3567};
3568
3569/**
3570 * @public
3571 */
3572interface AnimatePresenceProps {
3573 /**
3574 * By passing `initial={false}`, `AnimatePresence` will disable any initial animations on children
3575 * that are present when the component is first rendered.
3576 *
3577 * ```jsx
3578 * <AnimatePresence initial={false}>
3579 * {isVisible && (
3580 * <motion.div
3581 * key="modal"
3582 * initial={{ opacity: 0 }}
3583 * animate={{ opacity: 1 }}
3584 * exit={{ opacity: 0 }}
3585 * />
3586 * )}
3587 * </AnimatePresence>
3588 * ```
3589 *
3590 * @public
3591 */
3592 initial?: boolean;
3593 /**
3594 * When a component is removed, there's no longer a chance to update its props. So if a component's `exit`
3595 * prop is defined as a dynamic variant and you want to pass a new `custom` prop, you can do so via `AnimatePresence`.
3596 * This will ensure all leaving components animate using the latest data.
3597 *
3598 * @public
3599 */
3600 custom?: any;
3601 /**
3602 * Fires when all exiting nodes have completed animating out.
3603 *
3604 * @public
3605 */
3606 onExitComplete?: () => void;
3607 /**
3608 * Replace with `mode="wait"`
3609 *
3610 * @deprecated
3611 *
3612 * Replace with `mode="wait"`
3613 */
3614 exitBeforeEnter?: boolean;
3615 /**
3616 * Determines how to handle entering and exiting elements.
3617 *
3618 * - `"sync"`: Default. Elements animate in and out as soon as they're added/removed.
3619 * - `"popLayout"`: Exiting elements are "popped" from the page layout, allowing sibling
3620 * elements to immediately occupy their new layouts.
3621 * - `"wait"`: Only renders one component at a time. Wait for the exiting component to animate out
3622 * before animating the next component in.
3623 *
3624 * @public
3625 */
3626 mode?: "sync" | "popLayout" | "wait";
3627 /**
3628 * Internal. Used in Framer to flag that sibling children *shouldn't* re-render as a result of a
3629 * child being removed.
3630 */
3631 presenceAffectsLayout?: boolean;
3632}
3633
3634/**
3635 * `AnimatePresence` enables the animation of components that have been removed from the tree.
3636 *
3637 * When adding/removing more than a single child, every child **must** be given a unique `key` prop.
3638 *
3639 * Any `motion` components that have an `exit` property defined will animate out when removed from
3640 * the tree.
3641 *
3642 * ```jsx
3643 * import { motion, AnimatePresence } from 'framer-motion'
3644 *
3645 * export const Items = ({ items }) => (
3646 * <AnimatePresence>
3647 * {items.map(item => (
3648 * <motion.div
3649 * key={item.id}
3650 * initial={{ opacity: 0 }}
3651 * animate={{ opacity: 1 }}
3652 * exit={{ opacity: 0 }}
3653 * />
3654 * ))}
3655 * </AnimatePresence>
3656 * )
3657 * ```
3658 *
3659 * You can sequence exit animations throughout a tree using variants.
3660 *
3661 * If a child contains multiple `motion` components with `exit` props, it will only unmount the child
3662 * once all `motion` components have finished animating out. Likewise, any components using
3663 * `usePresence` all need to call `safeToRemove`.
3664 *
3665 * @public
3666 */
3667declare const AnimatePresence: React$1.FunctionComponent<React$1.PropsWithChildren<AnimatePresenceProps>>;
3668
3669type IsValidProp = (key: string) => boolean;
3670declare function filterProps(props: MotionProps, isDom: boolean, forwardMotionProps: boolean): MotionProps;
3671
3672interface MotionConfigProps extends Partial<MotionConfigContext> {
3673 children?: React$1.ReactNode;
3674 isValidProp?: IsValidProp;
3675}
3676/**
3677 * `MotionConfig` is used to set configuration options for all children `motion` components.
3678 *
3679 * ```jsx
3680 * import { motion, MotionConfig } from "framer-motion"
3681 *
3682 * export function App() {
3683 * return (
3684 * <MotionConfig transition={{ type: "spring" }}>
3685 * <motion.div animate={{ x: 100 }} />
3686 * </MotionConfig>
3687 * )
3688 * }
3689 * ```
3690 *
3691 * @public
3692 */
3693declare function MotionConfig({ children, isValidProp, ...config }: MotionConfigProps): react_jsx_runtime.JSX.Element;
3694
3695type LazyFeatureBundle = () => Promise<FeatureBundle>;
3696/**
3697 * @public
3698 */
3699interface LazyProps {
3700 children?: React.ReactNode;
3701 /**
3702 * Can be used to provide a feature bundle synchronously or asynchronously.
3703 *
3704 * ```jsx
3705 * // features.js
3706 * import { domAnimation } from "framer-motion"
3707 * export default domAnimation
3708 *
3709 * // index.js
3710 * import { LazyMotion, m } from "framer-motion"
3711 *
3712 * const loadFeatures = import("./features.js")
3713 * .then(res => res.default)
3714 *
3715 * function Component() {
3716 * return (
3717 * <LazyMotion features={loadFeatures}>
3718 * <m.div animate={{ scale: 1.5 }} />
3719 * </LazyMotion>
3720 * )
3721 * }
3722 * ```
3723 *
3724 * @public
3725 */
3726 features: FeatureBundle | LazyFeatureBundle;
3727 /**
3728 * If `true`, will throw an error if a `motion` component renders within
3729 * a `LazyMotion` component.
3730 *
3731 * ```jsx
3732 * // This component will throw an error that explains using a motion component
3733 * // instead of the m component will break the benefits of code-splitting.
3734 * function Component() {
3735 * return (
3736 * <LazyMotion features={domAnimation} strict>
3737 * <motion.div />
3738 * </LazyMotion>
3739 * )
3740 * }
3741 * ```
3742 *
3743 * @public
3744 */
3745 strict?: boolean;
3746}
3747
3748/**
3749 * Used in conjunction with the `m` component to reduce bundle size.
3750 *
3751 * `m` is a version of the `motion` component that only loads functionality
3752 * critical for the initial render.
3753 *
3754 * `LazyMotion` can then be used to either synchronously or asynchronously
3755 * load animation and gesture support.
3756 *
3757 * ```jsx
3758 * // Synchronous loading
3759 * import { LazyMotion, m, domAnimation } from "framer-motion"
3760 *
3761 * function App() {
3762 * return (
3763 * <LazyMotion features={domAnimation}>
3764 * <m.div animate={{ scale: 2 }} />
3765 * </LazyMotion>
3766 * )
3767 * }
3768 *
3769 * // Asynchronous loading
3770 * import { LazyMotion, m } from "framer-motion"
3771 *
3772 * function App() {
3773 * return (
3774 * <LazyMotion features={() => import('./path/to/domAnimation')}>
3775 * <m.div animate={{ scale: 2 }} />
3776 * </LazyMotion>
3777 * )
3778 * }
3779 * ```
3780 *
3781 * @public
3782 */
3783declare function LazyMotion({ children, features, strict }: LazyProps): react_jsx_runtime.JSX.Element;
3784
3785type InheritOption = boolean | "id";
3786interface Props$2 {
3787 id?: string;
3788 inherit?: InheritOption;
3789}
3790declare const LayoutGroup: React$1.FunctionComponent<React$1.PropsWithChildren<Props$2>>;
3791
3792interface Props$1<V> {
3793 /**
3794 * A HTML element to render this component as. Defaults to `"ul"`.
3795 *
3796 * @public
3797 */
3798 as?: keyof HTMLElements;
3799 /**
3800 * The axis to reorder along. By default, items will be draggable on this axis.
3801 * To make draggable on both axes, set `<Reorder.Item drag />`
3802 *
3803 * @public
3804 */
3805 axis?: "x" | "y";
3806 /**
3807 * A callback to fire with the new value order. For instance, if the values
3808 * are provided as a state from `useState`, this could be the set state function.
3809 *
3810 * @public
3811 */
3812 onReorder: (newOrder: V[]) => void;
3813 /**
3814 * The latest values state.
3815 *
3816 * ```jsx
3817 * function Component() {
3818 * const [items, setItems] = useState([0, 1, 2])
3819 *
3820 * return (
3821 * <Reorder.Group values={items} onReorder={setItems}>
3822 * {items.map((item) => <Reorder.Item key={item} value={item} />)}
3823 * </Reorder.Group>
3824 * )
3825 * }
3826 * ```
3827 *
3828 * @public
3829 */
3830 values: V[];
3831}
3832type ReorderGroupProps<V> = Props$1<V> & Omit<HTMLMotionProps<any>, "values"> & React$1.PropsWithChildren<{}>;
3833declare function ReorderGroupComponent<V>({ children, as, axis, onReorder, values, ...props }: ReorderGroupProps<V>, externalRef?: React$1.ForwardedRef<any>): react_jsx_runtime.JSX.Element;
3834declare const ReorderGroup: <V>(props: ReorderGroupProps<V> & {
3835 ref?: React$1.ForwardedRef<any>;
3836}) => ReturnType<typeof ReorderGroupComponent>;
3837
3838interface Props<V> {
3839 /**
3840 * A HTML element to render this component as. Defaults to `"li"`.
3841 *
3842 * @public
3843 */
3844 as?: keyof HTMLElements;
3845 /**
3846 * The value in the list that this component represents.
3847 *
3848 * @public
3849 */
3850 value: V;
3851 /**
3852 * A subset of layout options primarily used to disable layout="size"
3853 *
3854 * @public
3855 * @default true
3856 */
3857 layout?: true | "position";
3858}
3859type ReorderItemProps<V> = Props<V> & HTMLMotionProps<any> & React$1.PropsWithChildren<{}>;
3860declare function ReorderItemComponent<V>({ children, style, value, as, onDrag, layout, ...props }: ReorderItemProps<V>, externalRef?: React$1.ForwardedRef<any>): react_jsx_runtime.JSX.Element;
3861declare const ReorderItem: <V>(props: ReorderItemProps<V> & {
3862 ref?: React$1.ForwardedRef<any>;
3863}) => ReturnType<typeof ReorderItemComponent>;
3864
3865declare namespace namespace_d {
3866 export { ReorderGroup as Group, ReorderItem as Item };
3867}
3868
3869type ObjectTarget<O> = {
3870 [K in keyof O]?: O[K] | GenericKeyframesTarget<O[K]>;
3871};
3872type SequenceTime = number | "<" | `+${number}` | `-${number}` | `${string}`;
3873type SequenceLabel = string;
3874interface SequenceLabelWithTime {
3875 name: SequenceLabel;
3876 at: SequenceTime;
3877}
3878interface At {
3879 at?: SequenceTime;
3880}
3881type MotionValueSegment = [
3882 MotionValue,
3883 UnresolvedValueKeyframe | UnresolvedValueKeyframe[]
3884];
3885type MotionValueSegmentWithTransition = [
3886 MotionValue,
3887 UnresolvedValueKeyframe | UnresolvedValueKeyframe[],
3888 Transition & At
3889];
3890type DOMSegment = [ElementOrSelector, DOMKeyframesDefinition];
3891type DOMSegmentWithTransition = [
3892 ElementOrSelector,
3893 DOMKeyframesDefinition,
3894 DynamicAnimationOptions & At
3895];
3896type ObjectSegment<O extends {} = {}> = [O, ObjectTarget<O>];
3897type ObjectSegmentWithTransition<O extends {} = {}> = [
3898 O,
3899 ObjectTarget<O>,
3900 DynamicAnimationOptions & At
3901];
3902type Segment = ObjectSegment | ObjectSegmentWithTransition | SequenceLabel | SequenceLabelWithTime | MotionValueSegment | MotionValueSegmentWithTransition | DOMSegment | DOMSegmentWithTransition;
3903type AnimationSequence = Segment[];
3904interface SequenceOptions extends AnimationPlaybackOptions {
3905 delay?: number;
3906 duration?: number;
3907 defaultTransition?: Transition;
3908}
3909interface AbsoluteKeyframe {
3910 value: string | number | null;
3911 at: number;
3912 easing?: Easing;
3913}
3914type ValueSequence = AbsoluteKeyframe[];
3915interface SequenceMap {
3916 [key: string]: ValueSequence;
3917}
3918type ResolvedAnimationDefinition = {
3919 keyframes: {
3920 [key: string]: UnresolvedValueKeyframe[];
3921 };
3922 transition: {
3923 [key: string]: Transition;
3924 };
3925};
3926type ResolvedAnimationDefinitions = Map<Element | MotionValue, ResolvedAnimationDefinition>;
3927
3928/**
3929 * Creates an animation function that is optionally scoped
3930 * to a specific element.
3931 */
3932declare function createScopedAnimate(scope?: AnimationScope): {
3933 (sequence: AnimationSequence, options?: SequenceOptions): AnimationPlaybackControls;
3934 (value: string | MotionValue<string>, keyframes: string | GenericKeyframesTarget<string>, options?: ValueAnimationTransition<string>): AnimationPlaybackControls;
3935 (value: number | MotionValue<number>, keyframes: number | GenericKeyframesTarget<number>, options?: ValueAnimationTransition<number>): AnimationPlaybackControls;
3936 <V>(value: V | MotionValue<V>, keyframes: V | GenericKeyframesTarget<V>, options?: ValueAnimationTransition<V>): AnimationPlaybackControls;
3937 (element: ElementOrSelector, keyframes: DOMKeyframesDefinition, options?: DynamicAnimationOptions): AnimationPlaybackControls;
3938 <O extends {}>(object: O | O[], keyframes: ObjectTarget<O>, options?: DynamicAnimationOptions): AnimationPlaybackControls;
3939};
3940declare const animate: {
3941 (sequence: AnimationSequence, options?: SequenceOptions): AnimationPlaybackControls;
3942 (value: string | MotionValue<string>, keyframes: string | GenericKeyframesTarget<string>, options?: ValueAnimationTransition<string>): AnimationPlaybackControls;
3943 (value: number | MotionValue<number>, keyframes: number | GenericKeyframesTarget<number>, options?: ValueAnimationTransition<number>): AnimationPlaybackControls;
3944 <V>(value: V | MotionValue<V>, keyframes: V | GenericKeyframesTarget<V>, options?: ValueAnimationTransition<V>): AnimationPlaybackControls;
3945 (element: ElementOrSelector, keyframes: DOMKeyframesDefinition, options?: DynamicAnimationOptions): AnimationPlaybackControls;
3946 <O extends {}>(object: O | O[], keyframes: ObjectTarget<O>, options?: DynamicAnimationOptions): AnimationPlaybackControls;
3947};
3948
3949declare const animateMini: (elementOrSelector: ElementOrSelector, keyframes: DOMKeyframesDefinition, options?: DynamicAnimationOptions) => AnimationPlaybackControls;
3950
3951interface ScrollOptions {
3952 source?: HTMLElement;
3953 container?: HTMLElement;
3954 target?: Element;
3955 axis?: "x" | "y";
3956 offset?: ScrollOffset;
3957}
3958type OnScrollProgress = (progress: number) => void;
3959type OnScrollWithInfo = (progress: number, info: ScrollInfo) => void;
3960type OnScroll = OnScrollProgress | OnScrollWithInfo;
3961interface AxisScrollInfo {
3962 current: number;
3963 offset: number[];
3964 progress: number;
3965 scrollLength: number;
3966 velocity: number;
3967 targetOffset: number;
3968 targetLength: number;
3969 containerLength: number;
3970 interpolatorOffsets?: number[];
3971 interpolate?: EasingFunction;
3972}
3973interface ScrollInfo {
3974 time: number;
3975 x: AxisScrollInfo;
3976 y: AxisScrollInfo;
3977}
3978type OnScrollInfo = (info: ScrollInfo) => void;
3979type SupportedEdgeUnit = "px" | "vw" | "vh" | "%";
3980type EdgeUnit = `${number}${SupportedEdgeUnit}`;
3981type NamedEdges = "start" | "end" | "center";
3982type EdgeString = NamedEdges | EdgeUnit | `${number}`;
3983type Edge = EdgeString | number;
3984type ProgressIntersection = [number, number];
3985type Intersection = `${Edge} ${Edge}`;
3986type ScrollOffset = Array<Edge | Intersection | ProgressIntersection>;
3987interface ScrollInfoOptions {
3988 container?: HTMLElement;
3989 target?: Element;
3990 axis?: "x" | "y";
3991 offset?: ScrollOffset;
3992}
3993
3994declare class ScrollTimeline implements ProgressTimeline {
3995 constructor(options: ScrollOptions);
3996 currentTime: null | {
3997 value: number;
3998 };
3999 cancel?: VoidFunction;
4000}
4001declare global {
4002 interface Window {
4003 ScrollTimeline: ScrollTimeline;
4004 }
4005}
4006declare function scroll(onScroll: OnScroll | AnimationPlaybackControls, { axis, ...options }?: ScrollOptions): VoidFunction;
4007
4008declare function scrollInfo(onScroll: OnScrollInfo, { container, ...options }?: ScrollInfoOptions): () => void;
4009
4010type ViewChangeHandler = (entry: IntersectionObserverEntry) => void;
4011type MarginValue = `${number}${"px" | "%"}`;
4012type MarginType = MarginValue | `${MarginValue} ${MarginValue}` | `${MarginValue} ${MarginValue} ${MarginValue}` | `${MarginValue} ${MarginValue} ${MarginValue} ${MarginValue}`;
4013interface InViewOptions {
4014 root?: Element | Document;
4015 margin?: MarginType;
4016 amount?: "some" | "all" | number;
4017}
4018declare function inView(elementOrSelector: ElementOrSelector, onStart: (entry: IntersectionObserverEntry) => void | ViewChangeHandler, { root, margin: rootMargin, amount }?: InViewOptions): VoidFunction;
4019
4020declare const anticipate: (p: number) => number;
4021
4022declare const backOut: (t: number) => number;
4023declare const backIn: EasingFunction;
4024declare const backInOut: EasingFunction;
4025
4026declare const circIn: EasingFunction;
4027declare const circOut: EasingFunction;
4028declare const circInOut: EasingFunction;
4029
4030declare const easeIn: (t: number) => number;
4031declare const easeOut: (t: number) => number;
4032declare const easeInOut: (t: number) => number;
4033
4034declare function cubicBezier(mX1: number, mY1: number, mX2: number, mY2: number): (t: number) => number;
4035
4036type Direction = "start" | "end";
4037declare function steps(numSteps: number, direction?: Direction): EasingFunction;
4038
4039declare const mirrorEasing: EasingModifier;
4040
4041declare const reverseEasing: EasingModifier;
4042
4043declare function spring(optionsOrVisualDuration?: ValueAnimationOptions<number> | number, bounce?: number): KeyframeGenerator<number>;
4044
4045declare function inertia({ keyframes, velocity, power, timeConstant, bounceDamping, bounceStiffness, modifyTarget, min, max, restDelta, restSpeed, }: ValueAnimationOptions<number>): KeyframeGenerator<number>;
4046
4047declare function keyframes<T extends string | number>({ duration, keyframes: keyframeValues, times, ease, }: ValueAnimationOptions<T>): KeyframeGenerator<T>;
4048
4049type StaggerOrigin = "first" | "last" | "center" | number;
4050type StaggerOptions = {
4051 startDelay?: number;
4052 from?: StaggerOrigin;
4053 ease?: Easing;
4054};
4055declare function stagger(duration?: number, { startDelay, from, ease }?: StaggerOptions): DynamicOption<number>;
4056
4057/**
4058 * @public
4059 */
4060interface TransformOptions<T> {
4061 /**
4062 * Clamp values to within the given range. Defaults to `true`
4063 *
4064 * @public
4065 */
4066 clamp?: boolean;
4067 /**
4068 * Easing functions to use on the interpolations between each value in the input and output ranges.
4069 *
4070 * If provided as an array, the array must be one item shorter than the input and output ranges, as the easings apply to the transition **between** each.
4071 *
4072 * @public
4073 */
4074 ease?: EasingFunction | EasingFunction[];
4075 /**
4076 * Provide a function that can interpolate between any two values in the provided range.
4077 *
4078 * @public
4079 */
4080 mixer?: (from: T, to: T) => (v: number) => any;
4081}
4082/**
4083 * Transforms numbers into other values by mapping them from an input range to an output range.
4084 * Returns the type of the input provided.
4085 *
4086 * @remarks
4087 *
4088 * Given an input range of `[0, 200]` and an output range of
4089 * `[0, 1]`, this function will return a value between `0` and `1`.
4090 * The input range must be a linear series of numbers. The output range
4091 * can be any supported value type, such as numbers, colors, shadows, arrays, objects and more.
4092 * Every value in the output range must be of the same type and in the same format.
4093 *
4094 * ```jsx
4095 * import * as React from "react"
4096 * import { transform } from "framer-motion"
4097 *
4098 * export function MyComponent() {
4099 * const inputRange = [0, 200]
4100 * const outputRange = [0, 1]
4101 * const output = transform(100, inputRange, outputRange)
4102 *
4103 * // Returns 0.5
4104 * return <div>{output}</div>
4105 * }
4106 * ```
4107 *
4108 * @param inputValue - A number to transform between the input and output ranges.
4109 * @param inputRange - A linear series of numbers (either all increasing or decreasing).
4110 * @param outputRange - A series of numbers, colors, strings, or arrays/objects of those. Must be the same length as `inputRange`.
4111 * @param options - Clamp: Clamp values to within the given range. Defaults to `true`.
4112 *
4113 * @public
4114 */
4115declare function transform<T>(inputValue: number, inputRange: number[], outputRange: T[], options?: TransformOptions<T>): T;
4116/**
4117 *
4118 * Transforms numbers into other values by mapping them from an input range to an output range.
4119 *
4120 * Given an input range of `[0, 200]` and an output range of
4121 * `[0, 1]`, this function will return a value between `0` and `1`.
4122 * The input range must be a linear series of numbers. The output range
4123 * can be any supported value type, such as numbers, colors, shadows, arrays, objects and more.
4124 * Every value in the output range must be of the same type and in the same format.
4125 *
4126 * ```jsx
4127 * import * as React from "react"
4128 * import { Frame, transform } from "framer"
4129 *
4130 * export function MyComponent() {
4131 * const inputRange = [-200, -100, 100, 200]
4132 * const outputRange = [0, 1, 1, 0]
4133 * const convertRange = transform(inputRange, outputRange)
4134 * const output = convertRange(-150)
4135 *
4136 * // Returns 0.5
4137 * return <div>{output}</div>
4138 * }
4139 *
4140 * ```
4141 *
4142 * @param inputRange - A linear series of numbers (either all increasing or decreasing).
4143 * @param outputRange - A series of numbers, colors or strings. Must be the same length as `inputRange`.
4144 * @param options - Clamp: clamp values to within the given range. Defaults to `true`.
4145 *
4146 * @public
4147 */
4148declare function transform<T>(inputRange: number[], outputRange: T[], options?: TransformOptions<T>): (inputValue: number) => T;
4149
4150declare const clamp: (min: number, max: number, v: number) => number;
4151
4152type DelayedFunction = (overshoot: number) => void;
4153/**
4154 * Timeout defined in ms
4155 */
4156declare function delay(callback: DelayedFunction, timeout: number): () => void;
4157
4158declare const distance: (a: number, b: number) => number;
4159declare function distance2D(a: Point, b: Point): number;
4160
4161type Mix<T> = (v: number) => T;
4162type MixerFactory<T> = (from: T, to: T) => Mix<T>;
4163interface InterpolateOptions<T> {
4164 clamp?: boolean;
4165 ease?: EasingFunction | EasingFunction[];
4166 mixer?: MixerFactory<T>;
4167}
4168/**
4169 * Create a function that maps from a numerical input array to a generic output array.
4170 *
4171 * Accepts:
4172 * - Numbers
4173 * - Colors (hex, hsl, hsla, rgb, rgba)
4174 * - Complex (combinations of one or more numbers or strings)
4175 *
4176 * ```jsx
4177 * const mixColor = interpolate([0, 1], ['#fff', '#000'])
4178 *
4179 * mixColor(0.5) // 'rgba(128, 128, 128, 1)'
4180 * ```
4181 *
4182 * TODO Revist this approach once we've moved to data models for values,
4183 * probably not needed to pregenerate mixer functions.
4184 *
4185 * @public
4186 */
4187declare function interpolate<T>(input: number[], output: T[], { clamp: isClamp, ease, mixer }?: InterpolateOptions<T>): (v: number) => T;
4188
4189type Mixer<T> = (p: number) => T;
4190
4191declare function mix<T>(from: T, to: T): Mixer<T>;
4192declare function mix(from: number, to: number, p: number): number;
4193
4194declare const pipe: (...transformers: Function[]) => Function;
4195
4196declare const progress: (from: number, to: number, value: number) => number;
4197
4198declare const wrap: (min: number, max: number, v: number) => number;
4199
4200type Process = (data: FrameData) => void;
4201type Schedule = (process: Process, keepAlive?: boolean, immediate?: boolean) => Process;
4202interface Step {
4203 schedule: Schedule;
4204 cancel: (process: Process) => void;
4205 process: (data: FrameData) => void;
4206}
4207type StepId = "read" | "resolveKeyframes" | "update" | "preRender" | "render" | "postRender";
4208type Batcher = {
4209 [key in StepId]: Schedule;
4210};
4211type Steps = {
4212 [key in StepId]: Step;
4213};
4214interface FrameData {
4215 delta: number;
4216 timestamp: number;
4217 isProcessing: boolean;
4218}
4219
4220declare const frame: Batcher;
4221declare const cancelFrame: (process: Process) => void;
4222declare const frameData: FrameData;
4223declare const frameSteps: Steps;
4224
4225/**
4226 * An eventloop-synchronous alternative to performance.now().
4227 *
4228 * Ensures that time measurements remain consistent within a synchronous context.
4229 * Usually calling performance.now() twice within the same synchronous context
4230 * will return different values which isn't useful for animations when we're usually
4231 * trying to sync animations to the same frame.
4232 */
4233declare const time: {
4234 now: () => number;
4235 set: (newTime: number) => void;
4236};
4237
4238/**
4239 * @deprecated
4240 *
4241 * Import as `frame` instead.
4242 */
4243declare const sync: Batcher;
4244/**
4245 * @deprecated
4246 *
4247 * Use cancelFrame(callback) instead.
4248 */
4249declare const cancelSync: Record<string, (process: Process) => void>;
4250
4251declare const animations: FeaturePackages;
4252
4253interface MotionContextProps<Instance = unknown> {
4254 visualElement?: VisualElement<Instance>;
4255 initial?: false | string | string[];
4256 animate?: string | string[];
4257}
4258declare const MotionContext: React$1.Context<MotionContextProps<unknown>>;
4259
4260declare const createBox: () => Box;
4261
4262declare function calcLength(axis: Axis): number;
4263
4264type EventListenerWithPointInfo = (e: PointerEvent, info: EventInfo) => void;
4265declare const addPointerInfo: (handler: EventListenerWithPointInfo) => EventListener;
4266
4267declare function addPointerEvent(target: EventTarget, eventName: string, handler: EventListenerWithPointInfo, options?: AddEventListenerOptions): () => void;
4268
4269declare const isMotionValue: (value: any) => value is MotionValue<any>;
4270
4271declare const isBrowser: boolean;
4272
4273declare function useUnmountEffect(callback: () => void): void;
4274
4275declare const useIsomorphicLayoutEffect: typeof useEffect;
4276
4277declare function useForceUpdate(): [VoidFunction, number];
4278
4279/**
4280 * @public
4281 */
4282declare const domMin: FeatureBundle;
4283
4284/**
4285 * @public
4286 */
4287declare const domAnimation: FeatureBundle;
4288
4289/**
4290 * @public
4291 */
4292declare const domMax: FeatureBundle;
4293
4294/**
4295 * Creates a `MotionValue` to track the state and velocity of a value.
4296 *
4297 * Usually, these are created automatically. For advanced use-cases, like use with `useTransform`, you can create `MotionValue`s externally and pass them into the animated component via the `style` prop.
4298 *
4299 * ```jsx
4300 * export const MyComponent = () => {
4301 * const scale = useMotionValue(1)
4302 *
4303 * return <motion.div style={{ scale }} />
4304 * }
4305 * ```
4306 *
4307 * @param initial - The initial state.
4308 *
4309 * @public
4310 */
4311declare function useMotionValue<T>(initial: T): MotionValue<T>;
4312
4313/**
4314 * Combine multiple motion values into a new one using a string template literal.
4315 *
4316 * ```jsx
4317 * import {
4318 * motion,
4319 * useSpring,
4320 * useMotionValue,
4321 * useMotionTemplate
4322 * } from "framer-motion"
4323 *
4324 * function Component() {
4325 * const shadowX = useSpring(0)
4326 * const shadowY = useMotionValue(0)
4327 * const shadow = useMotionTemplate`drop-shadow(${shadowX}px ${shadowY}px 20px rgba(0,0,0,0.3))`
4328 *
4329 * return <motion.div style={{ filter: shadow }} />
4330 * }
4331 * ```
4332 *
4333 * @public
4334 */
4335declare function useMotionTemplate(fragments: TemplateStringsArray, ...values: Array<MotionValue | number | string>): MotionValue<string>;
4336
4337/**
4338 * If the provided value is a MotionValue, this returns the actual value, otherwise just the value itself
4339 *
4340 * TODO: Remove and move to library
4341 */
4342declare function resolveMotionValue(value?: string | number | CustomValueType | MotionValue): string | number;
4343
4344type InputRange = number[];
4345type SingleTransformer<I, O> = (input: I) => O;
4346type MultiTransformer<I, O> = (input: I[]) => O;
4347/**
4348 * Create a `MotionValue` that transforms the output of another `MotionValue` by mapping it from one range of values into another.
4349 *
4350 * @remarks
4351 *
4352 * Given an input range of `[-200, -100, 100, 200]` and an output range of
4353 * `[0, 1, 1, 0]`, the returned `MotionValue` will:
4354 *
4355 * - When provided a value between `-200` and `-100`, will return a value between `0` and `1`.
4356 * - When provided a value between `-100` and `100`, will return `1`.
4357 * - When provided a value between `100` and `200`, will return a value between `1` and `0`
4358 *
4359 *
4360 * The input range must be a linear series of numbers. The output range
4361 * can be any value type supported by Motion: numbers, colors, shadows, etc.
4362 *
4363 * Every value in the output range must be of the same type and in the same format.
4364 *
4365 * ```jsx
4366 * export const MyComponent = () => {
4367 * const x = useMotionValue(0)
4368 * const xRange = [-200, -100, 100, 200]
4369 * const opacityRange = [0, 1, 1, 0]
4370 * const opacity = useTransform(x, xRange, opacityRange)
4371 *
4372 * return (
4373 * <motion.div
4374 * animate={{ x: 200 }}
4375 * style={{ opacity, x }}
4376 * />
4377 * )
4378 * }
4379 * ```
4380 *
4381 * @param inputValue - `MotionValue`
4382 * @param inputRange - A linear series of numbers (either all increasing or decreasing)
4383 * @param outputRange - A series of numbers, colors or strings. Must be the same length as `inputRange`.
4384 * @param options -
4385 *
4386 * - clamp: boolean. Clamp values to within the given range. Defaults to `true`
4387 * - ease: EasingFunction[]. Easing functions to use on the interpolations between each value in the input and output ranges. If provided as an array, the array must be one item shorter than the input and output ranges, as the easings apply to the transition between each.
4388 *
4389 * @returns `MotionValue`
4390 *
4391 * @public
4392 */
4393declare function useTransform<I, O>(value: MotionValue<number>, inputRange: InputRange, outputRange: O[], options?: TransformOptions<O>): MotionValue<O>;
4394/**
4395 * Create a `MotionValue` that transforms the output of another `MotionValue` through a function.
4396 * In this example, `y` will always be double `x`.
4397 *
4398 * ```jsx
4399 * export const MyComponent = () => {
4400 * const x = useMotionValue(10)
4401 * const y = useTransform(x, value => value * 2)
4402 *
4403 * return <motion.div style={{ x, y }} />
4404 * }
4405 * ```
4406 *
4407 * @param input - A `MotionValue` that will pass its latest value through `transform` to update the returned `MotionValue`.
4408 * @param transform - A function that accepts the latest value from `input` and returns a new value.
4409 * @returns `MotionValue`
4410 *
4411 * @public
4412 */
4413declare function useTransform<I, O>(input: MotionValue<I>, transformer: SingleTransformer<I, O>): MotionValue<O>;
4414/**
4415 * Pass an array of `MotionValue`s and a function to combine them. In this example, `z` will be the `x` multiplied by `y`.
4416 *
4417 * ```jsx
4418 * export const MyComponent = () => {
4419 * const x = useMotionValue(0)
4420 * const y = useMotionValue(0)
4421 * const z = useTransform([x, y], ([latestX, latestY]) => latestX * latestY)
4422 *
4423 * return <motion.div style={{ x, y, z }} />
4424 * }
4425 * ```
4426 *
4427 * @param input - An array of `MotionValue`s that will pass their latest values through `transform` to update the returned `MotionValue`.
4428 * @param transform - A function that accepts the latest values from `input` and returns a new value.
4429 * @returns `MotionValue`
4430 *
4431 * @public
4432 */
4433declare function useTransform<I, O>(input: MotionValue<string>[] | MotionValue<number>[] | MotionValue<string | number>[], transformer: MultiTransformer<I, O>): MotionValue<O>;
4434declare function useTransform<I, O>(transformer: () => O): MotionValue<O>;
4435
4436/**
4437 * Creates a `MotionValue` that, when `set`, will use a spring animation to animate to its new state.
4438 *
4439 * It can either work as a stand-alone `MotionValue` by initialising it with a value, or as a subscriber
4440 * to another `MotionValue`.
4441 *
4442 * @remarks
4443 *
4444 * ```jsx
4445 * const x = useSpring(0, { stiffness: 300 })
4446 * const y = useSpring(x, { damping: 10 })
4447 * ```
4448 *
4449 * @param inputValue - `MotionValue` or number. If provided a `MotionValue`, when the input `MotionValue` changes, the created `MotionValue` will spring towards that value.
4450 * @param springConfig - Configuration options for the spring.
4451 * @returns `MotionValue`
4452 *
4453 * @public
4454 */
4455declare function useSpring(source: MotionValue<string> | MotionValue<number> | number, config?: SpringOptions): MotionValue<number>;
4456
4457/**
4458 * Creates a `MotionValue` that updates when the velocity of the provided `MotionValue` changes.
4459 *
4460 * ```javascript
4461 * const x = useMotionValue(0)
4462 * const xVelocity = useVelocity(x)
4463 * const xAcceleration = useVelocity(xVelocity)
4464 * ```
4465 *
4466 * @public
4467 */
4468declare function useVelocity(value: MotionValue<number>): MotionValue<number>;
4469
4470interface UseScrollOptions extends Omit<ScrollInfoOptions, "container" | "target"> {
4471 container?: RefObject$1<HTMLElement | null>;
4472 target?: RefObject$1<HTMLElement | null>;
4473 layoutEffect?: boolean;
4474}
4475declare function useScroll({ container, target, layoutEffect, ...options }?: UseScrollOptions): {
4476 scrollX: MotionValue<number>;
4477 scrollY: MotionValue<number>;
4478 scrollXProgress: MotionValue<number>;
4479 scrollYProgress: MotionValue<number>;
4480};
4481
4482/**
4483 * @deprecated useElementScroll is deprecated. Convert to useScroll({ container: ref })
4484 */
4485declare function useElementScroll(ref: RefObject$1<HTMLElement | null>): {
4486 scrollX: MotionValue<number>;
4487 scrollY: MotionValue<number>;
4488 scrollXProgress: MotionValue<number>;
4489 scrollYProgress: MotionValue<number>;
4490};
4491
4492/**
4493 * @deprecated useViewportScroll is deprecated. Convert to useScroll()
4494 */
4495declare function useViewportScroll(): {
4496 scrollX: MotionValue<number>;
4497 scrollY: MotionValue<number>;
4498 scrollXProgress: MotionValue<number>;
4499 scrollYProgress: MotionValue<number>;
4500};
4501
4502declare function useTime(): MotionValue<number>;
4503
4504interface WillChange extends MotionValue {
4505 add(name: string): void;
4506}
4507
4508declare function useWillChange(): WillChange;
4509
4510declare function useMotionValueEvent<V, EventName extends keyof MotionValueEventCallbacks<V>>(value: MotionValue<V>, event: EventName, callback: MotionValueEventCallbacks<V>[EventName]): void;
4511
4512/**
4513 * A hook that returns `true` if we should be using reduced motion based on the current device's Reduced Motion setting.
4514 *
4515 * This can be used to implement changes to your UI based on Reduced Motion. For instance, replacing motion-sickness inducing
4516 * `x`/`y` animations with `opacity`, disabling the autoplay of background videos, or turning off parallax motion.
4517 *
4518 * It will actively respond to changes and re-render your components with the latest setting.
4519 *
4520 * ```jsx
4521 * export function Sidebar({ isOpen }) {
4522 * const shouldReduceMotion = useReducedMotion()
4523 * const closedX = shouldReduceMotion ? 0 : "-100%"
4524 *
4525 * return (
4526 * <motion.div animate={{
4527 * opacity: isOpen ? 1 : 0,
4528 * x: isOpen ? 0 : closedX
4529 * }} />
4530 * )
4531 * }
4532 * ```
4533 *
4534 * @return boolean
4535 *
4536 * @public
4537 */
4538declare function useReducedMotion(): boolean | null;
4539
4540declare function useReducedMotionConfig(): boolean | null;
4541
4542/**
4543 * @public
4544 */
4545declare function animationControls(): AnimationControls;
4546
4547declare function useAnimate<T extends Element = any>(): [AnimationScope<T>, {
4548 (sequence: AnimationSequence, options?: SequenceOptions | undefined): AnimationPlaybackControls;
4549 (value: string | MotionValue<string>, keyframes: string | GenericKeyframesTarget<string>, options?: ValueAnimationTransition<string> | undefined): AnimationPlaybackControls;
4550 (value: number | MotionValue<number>, keyframes: number | GenericKeyframesTarget<number>, options?: ValueAnimationTransition<number> | undefined): AnimationPlaybackControls;
4551 <V>(value: V | MotionValue<V>, keyframes: V | GenericKeyframesTarget<V>, options?: ValueAnimationTransition<V> | undefined): AnimationPlaybackControls;
4552 (element: motion_dom.ElementOrSelector, keyframes: DOMKeyframesDefinition, options?: DynamicAnimationOptions | undefined): AnimationPlaybackControls;
4553 <O extends {}>(object: O | O[], keyframes: ObjectTarget<O>, options?: DynamicAnimationOptions | undefined): AnimationPlaybackControls;
4554}];
4555
4556declare function useAnimateMini<T extends Element = any>(): [AnimationScope<T>, (elementOrSelector: motion_dom.ElementOrSelector, keyframes: DOMKeyframesDefinition, options?: DynamicAnimationOptions | undefined) => AnimationPlaybackControls];
4557
4558/**
4559 * Creates `AnimationControls`, which can be used to manually start, stop
4560 * and sequence animations on one or more components.
4561 *
4562 * The returned `AnimationControls` should be passed to the `animate` property
4563 * of the components you want to animate.
4564 *
4565 * These components can then be animated with the `start` method.
4566 *
4567 * ```jsx
4568 * import * as React from 'react'
4569 * import { motion, useAnimation } from 'framer-motion'
4570 *
4571 * export function MyComponent(props) {
4572 * const controls = useAnimation()
4573 *
4574 * controls.start({
4575 * x: 100,
4576 * transition: { duration: 0.5 },
4577 * })
4578 *
4579 * return <motion.div animate={controls} />
4580 * }
4581 * ```
4582 *
4583 * @returns Animation controller with `start` and `stop` methods
4584 *
4585 * @public
4586 */
4587declare function useAnimationControls(): AnimationControls;
4588declare const useAnimation: typeof useAnimationControls;
4589
4590type FrameCallback = (timestamp: number, delta: number) => void;
4591declare function useAnimationFrame(callback: FrameCallback): void;
4592
4593declare function animateVisualElement(visualElement: VisualElement, definition: AnimationDefinition, options?: VisualElementAnimationOptions): Promise<void>;
4594
4595type Cycle = (i?: number) => void;
4596type CycleState<T> = [T, Cycle];
4597/**
4598 * Cycles through a series of visual properties. Can be used to toggle between or cycle through animations. It works similar to `useState` in React. It is provided an initial array of possible states, and returns an array of two arguments.
4599 *
4600 * An index value can be passed to the returned `cycle` function to cycle to a specific index.
4601 *
4602 * ```jsx
4603 * import * as React from "react"
4604 * import { motion, useCycle } from "framer-motion"
4605 *
4606 * export const MyComponent = () => {
4607 * const [x, cycleX] = useCycle(0, 50, 100)
4608 *
4609 * return (
4610 * <motion.div
4611 * animate={{ x: x }}
4612 * onTap={() => cycleX()}
4613 * />
4614 * )
4615 * }
4616 * ```
4617 *
4618 * @param items - items to cycle through
4619 * @returns [currentState, cycleState]
4620 *
4621 * @public
4622 */
4623declare function useCycle<T>(...items: T[]): CycleState<T>;
4624
4625/**
4626 * Check whether a prop name is a valid `MotionProp` key.
4627 *
4628 * @param key - Name of the property to check
4629 * @returns `true` is key is a valid `MotionProp`.
4630 *
4631 * @public
4632 */
4633declare function isValidMotionProp(key: string): boolean;
4634
4635type SafeToRemove = () => void;
4636type AlwaysPresent = [true, null];
4637type Present = [true];
4638type NotPresent = [false, SafeToRemove];
4639/**
4640 * When a component is the child of `AnimatePresence`, it can use `usePresence`
4641 * to access information about whether it's still present in the React tree.
4642 *
4643 * ```jsx
4644 * import { usePresence } from "framer-motion"
4645 *
4646 * export const Component = () => {
4647 * const [isPresent, safeToRemove] = usePresence()
4648 *
4649 * useEffect(() => {
4650 * !isPresent && setTimeout(safeToRemove, 1000)
4651 * }, [isPresent])
4652 *
4653 * return <div />
4654 * }
4655 * ```
4656 *
4657 * If `isPresent` is `false`, it means that a component has been removed the tree, but
4658 * `AnimatePresence` won't really remove it until `safeToRemove` has been called.
4659 *
4660 * @public
4661 */
4662declare function usePresence(): AlwaysPresent | Present | NotPresent;
4663/**
4664 * Similar to `usePresence`, except `useIsPresent` simply returns whether or not the component is present.
4665 * There is no `safeToRemove` function.
4666 *
4667 * ```jsx
4668 * import { useIsPresent } from "framer-motion"
4669 *
4670 * export const Component = () => {
4671 * const isPresent = useIsPresent()
4672 *
4673 * useEffect(() => {
4674 * !isPresent && console.log("I've been removed!")
4675 * }, [isPresent])
4676 *
4677 * return <div />
4678 * }
4679 * ```
4680 *
4681 * @public
4682 */
4683declare function useIsPresent(): boolean;
4684
4685interface UseInViewOptions extends Omit<InViewOptions, "root" | "amount"> {
4686 root?: RefObject$1<Element | null>;
4687 once?: boolean;
4688 amount?: "some" | "all" | number;
4689}
4690declare function useInView(ref: RefObject$1<Element | null>, { root, margin, amount, once }?: UseInViewOptions): boolean;
4691
4692/**
4693 * Attaches an event listener directly to the provided DOM element.
4694 *
4695 * Bypassing React's event system can be desirable, for instance when attaching non-passive
4696 * event handlers.
4697 *
4698 * ```jsx
4699 * const ref = useRef(null)
4700 *
4701 * useDomEvent(ref, 'wheel', onWheel, { passive: false })
4702 *
4703 * return <div ref={ref} />
4704 * ```
4705 *
4706 * @param ref - React.RefObject that's been provided to the element you want to bind the listener to.
4707 * @param eventName - Name of the event you want listen for.
4708 * @param handler - Function to fire when receiving the event.
4709 * @param options - Options to pass to `Event.addEventListener`.
4710 *
4711 * @public
4712 */
4713declare function useDomEvent(ref: RefObject$1<EventTarget | null>, eventName: string, handler?: EventListener | undefined, options?: AddEventListenerOptions): void;
4714
4715/**
4716 * Checks if a component is a `motion` component.
4717 */
4718declare function isMotionComponent(component: React.ComponentType | string): boolean;
4719
4720/**
4721 * Unwraps a `motion` component and returns either a string for `motion.div` or
4722 * the React component for `motion(Component)`.
4723 *
4724 * If the component is not a `motion` component it returns undefined.
4725 */
4726declare function unwrapMotionComponent(component: React.ComponentType | string): React.ComponentType | string | undefined;
4727
4728type ScaleCorrector = (latest: string | number, node: IProjectionNode) => string | number;
4729interface ScaleCorrectorDefinition {
4730 correct: ScaleCorrector;
4731 applyTo?: string[];
4732}
4733interface ScaleCorrectorMap {
4734 [key: string]: ScaleCorrectorDefinition;
4735}
4736
4737declare function addScaleCorrector(correctors: ScaleCorrectorMap): void;
4738
4739declare function useInstantTransition(): (callback: () => void) => void;
4740declare function disableInstantTransitions(): void;
4741
4742declare function useInstantLayoutTransition(): (cb?: (() => void) | undefined) => void;
4743
4744declare function useResetProjection(): () => void;
4745
4746/**
4747 * Build a CSS transform style from individual x/y/scale etc properties.
4748 *
4749 * This outputs with a default order of transforms/scales/rotations, this can be customised by
4750 * providing a transformTemplate function.
4751 */
4752declare function buildTransform(latestValues: ResolvedValues, transform: HTMLRenderState["transform"], transformTemplate?: MotionProps["transformTemplate"]): string;
4753
4754declare const visualElementStore: WeakMap<any, VisualElement<unknown, unknown, {}>>;
4755
4756interface ValueAnimationOptionsWithDefaults<T extends string | number> extends ValueAnimationOptionsWithRenderContext<T> {
4757 autoplay: boolean;
4758 delay: number;
4759 repeat: number;
4760 repeatDelay: number;
4761 repeatType: RepeatType;
4762}
4763declare abstract class BaseAnimation<T extends string | number, Resolved> implements AnimationPlaybackControls {
4764 protected options: ValueAnimationOptionsWithDefaults<T>;
4765 protected resolveFinishedPromise: VoidFunction;
4766 protected currentFinishedPromise: Promise<void>;
4767 protected isStopped: boolean;
4768 protected _resolved: Resolved & {
4769 keyframes: ResolvedKeyframes<T>;
4770 };
4771 protected hasAttemptedResolve: boolean;
4772 protected resolver: KeyframeResolver<T>;
4773 private createdAt;
4774 private resolvedAt;
4775 constructor({ autoplay, delay, type, repeat, repeatDelay, repeatType, ...options }: ValueAnimationOptions<T>);
4776 /**
4777 * This method uses the createdAt and resolvedAt to calculate the
4778 * animation startTime. *Ideally*, we would use the createdAt time as t=0
4779 * as the following frame would then be the first frame of the animation in
4780 * progress, which would feel snappier.
4781 *
4782 * However, if there's a delay (main thread work) between the creation of
4783 * the animation and the first commited frame, we prefer to use resolvedAt
4784 * to avoid a sudden jump into the animation.
4785 */
4786 calcStartTime(): number;
4787 protected abstract initPlayback(keyframes: ResolvedKeyframes<T>, finalKeyframe?: T): Resolved | false;
4788 abstract play(): void;
4789 abstract pause(): void;
4790 abstract stop(): void;
4791 abstract cancel(): void;
4792 abstract complete(): void;
4793 abstract get speed(): number;
4794 abstract set speed(newSpeed: number);
4795 abstract get time(): number;
4796 abstract set time(newTime: number);
4797 abstract get duration(): number;
4798 abstract get state(): AnimationPlayState;
4799 abstract get startTime(): number | null;
4800 /**
4801 * A getter for resolved data. If keyframes are not yet resolved, accessing
4802 * this.resolved will synchronously flush all pending keyframe resolvers.
4803 * This is a deoptimisation, but at its worst still batches read/writes.
4804 */
4805 get resolved(): (Resolved & {
4806 keyframes: ResolvedKeyframes<T>;
4807 finalKeyframe?: T;
4808 }) | undefined;
4809 /**
4810 * A method to be called when the keyframes resolver completes. This method
4811 * will check if its possible to run the animation and, if not, skip it.
4812 * Otherwise, it will call initPlayback on the implementing class.
4813 */
4814 protected onKeyframesResolved(keyframes: ResolvedKeyframes<T>, finalKeyframe?: T): void;
4815 onPostResolved(): void;
4816 /**
4817 * Allows the returned animation to be awaited or promise-chained. Currently
4818 * resolves when the animation finishes at all but in a future update could/should
4819 * reject if its cancels.
4820 */
4821 then(resolve: VoidFunction, reject?: VoidFunction): Promise<void>;
4822 flatten(): void;
4823 protected updateFinishedPromise(): void;
4824}
4825
4826interface ResolvedData<T extends string | number> {
4827 generator: KeyframeGenerator<T>;
4828 mirroredGenerator: KeyframeGenerator<T> | undefined;
4829 mapPercentToKeyframes: ((v: number) => T) | undefined;
4830 /**
4831 * Duration of the animation as calculated by the generator.
4832 */
4833 calculatedDuration: number;
4834 /**
4835 * Duration of the animation plus repeatDelay.
4836 */
4837 resolvedDuration: number;
4838 /**
4839 * Total duration of the animation including repeats.
4840 */
4841 totalDuration: number;
4842}
4843/**
4844 * Animation that runs on the main thread. Designed to be WAAPI-spec in the subset of
4845 * features we expose publically. Mostly the compatibility is to ensure visual identity
4846 * between both WAAPI and main thread animations.
4847 */
4848declare class MainThreadAnimation<T extends string | number> extends BaseAnimation<T, ResolvedData<T>> {
4849 /**
4850 * The driver that's controlling the animation loop. Normally this is a requestAnimationFrame loop
4851 * but in tests we can pass in a synchronous loop.
4852 */
4853 private driver?;
4854 /**
4855 * The time at which the animation was paused.
4856 */
4857 private holdTime;
4858 /**
4859 * The time at which the animation was cancelled.
4860 */
4861 private cancelTime;
4862 /**
4863 * The current time of the animation.
4864 */
4865 private currentTime;
4866 /**
4867 * Playback speed as a factor. 0 would be stopped, -1 reverse and 2 double speed.
4868 */
4869 private playbackSpeed;
4870 /**
4871 * The state of the animation to apply when the animation is resolved. This
4872 * allows calls to the public API to control the animation before it is resolved,
4873 * without us having to resolve it first.
4874 */
4875 private pendingPlayState;
4876 /**
4877 * The time at which the animation was started.
4878 */
4879 startTime: number | null;
4880 constructor(options: ValueAnimationOptions<T>);
4881 flatten(): void;
4882 protected initPlayback(keyframes: ResolvedKeyframes<T>): {
4883 generator: KeyframeGenerator<any>;
4884 mirroredGenerator: KeyframeGenerator<T> | undefined;
4885 mapPercentToKeyframes: ((v: number) => T) | undefined;
4886 calculatedDuration: number;
4887 resolvedDuration: number;
4888 totalDuration: number;
4889 };
4890 onPostResolved(): void;
4891 tick(timestamp: number, sample?: boolean): {
4892 done: boolean;
4893 value: T;
4894 };
4895 state: AnimationPlayState;
4896 get duration(): number;
4897 get time(): number;
4898 set time(newTime: number);
4899 get speed(): number;
4900 set speed(newSpeed: number);
4901 play(): void;
4902 pause(): void;
4903 /**
4904 * This method is bound to the instance to fix a pattern where
4905 * animation.stop is returned as a reference from a useEffect.
4906 */
4907 stop: () => void;
4908 complete(): void;
4909 finish(): void;
4910 cancel(): void;
4911 private teardown;
4912 private stopDriver;
4913 sample(time: number): AnimationState<T>;
4914}
4915declare function animateValue(options: ValueAnimationOptionsWithRenderContext<any>): MainThreadAnimation<any>;
4916
4917type Transformer = (v: any) => any;
4918type ValueType = {
4919 test: (v: any) => boolean;
4920 parse: (v: any) => any;
4921 transform?: Transformer;
4922 createTransformer?: (template: string) => Transformer;
4923 default?: any;
4924 getAnimatableNone?: (v: any) => any;
4925};
4926type RGBA = {
4927 red: number;
4928 green: number;
4929 blue: number;
4930 alpha: number;
4931};
4932type HSLA = {
4933 hue: number;
4934 saturation: number;
4935 lightness: number;
4936 alpha: number;
4937};
4938type Color = HSLA | RGBA;
4939
4940declare const color: {
4941 test: (v: any) => boolean;
4942 parse: (v: any) => RGBA | HSLA;
4943 transform: (v: HSLA | RGBA | string) => string;
4944};
4945
4946type CSSVariableName = `--${string}`;
4947type CSSVariableToken = `var(${CSSVariableName})`;
4948
4949declare function test(v: any): boolean;
4950type ComplexValues = Array<CSSVariableToken | string | number | Color>;
4951declare function parseComplexValue(v: string | number): ComplexValues;
4952declare function createTransformer(source: string | number): (v: Array<CSSVariableToken | Color | number | string>) => string;
4953declare function getAnimatableNone(v: string | number): string;
4954declare const complex: {
4955 test: typeof test;
4956 parse: typeof parseComplexValue;
4957 createTransformer: typeof createTransformer;
4958 getAnimatableNone: typeof getAnimatableNone;
4959};
4960
4961declare const px: {
4962 test: (v: string | number) => boolean;
4963 parse: typeof parseFloat;
4964 transform: (v: number | string) => string;
4965};
4966
4967declare const MotionGlobalConfig: {
4968 skipAnimations: boolean;
4969 useManualTiming: boolean;
4970};
4971
4972interface AcceleratedValueAnimationOptions<T extends string | number = number> extends ValueAnimationOptions<T> {
4973 name: string;
4974 motionValue: MotionValue<T>;
4975}
4976interface ResolvedAcceleratedAnimation {
4977 animation: Animation;
4978 duration: number;
4979 times: ValueAnimationOptions["times"];
4980 type: ValueAnimationOptions["type"];
4981 ease: ValueAnimationOptions["ease"];
4982 keyframes: string[] | number[];
4983}
4984declare class AcceleratedAnimation<T extends string | number> extends BaseAnimation<T, ResolvedAcceleratedAnimation> {
4985 protected options: ValueAnimationOptionsWithDefaults<T> & {
4986 name: string;
4987 motionValue: MotionValue<T>;
4988 };
4989 constructor(options: ValueAnimationOptionsWithRenderContext<T>);
4990 /**
4991 * An AnimationTimline to attach to the WAAPI animation once it's created.
4992 */
4993 private pendingTimeline;
4994 protected initPlayback(keyframes: ResolvedKeyframes<T>, finalKeyframe: T): false | {
4995 animation: Animation;
4996 duration: number;
4997 times: number[] | undefined;
4998 type: AnimationGeneratorType | undefined;
4999 ease: Easing | Easing[] | undefined;
5000 keyframes: number[] | string[];
5001 };
5002 get duration(): number;
5003 get time(): number;
5004 set time(newTime: number);
5005 get speed(): number;
5006 set speed(newSpeed: number);
5007 get state(): AnimationPlayState;
5008 get startTime(): number | null;
5009 /**
5010 * Replace the default DocumentTimeline with another AnimationTimeline.
5011 * Currently used for scroll animations.
5012 */
5013 attachTimeline(timeline: any): (any: void) => void;
5014 play(): void;
5015 pause(): void;
5016 stop(): void;
5017 complete(): void;
5018 cancel(): void;
5019 static supports(options: ValueAnimationOptionsWithRenderContext): options is AcceleratedValueAnimationOptions;
5020}
5021
5022interface NativeAnimationOptions {
5023 delay?: number;
5024 duration?: number;
5025 ease?: EasingFunction | Easing | Easing[];
5026 times?: number[];
5027 repeat?: number;
5028 repeatType?: "loop" | "reverse" | "mirror";
5029}
5030
5031declare const optimizedAppearDataAttribute: "data-framer-appear-id";
5032
5033/**
5034 * Expose only the needed part of the VisualElement interface to
5035 * ensure React types don't end up in the generic DOM bundle.
5036 */
5037interface WithAppearProps {
5038 props: {
5039 [optimizedAppearDataAttribute]?: string;
5040 values?: {
5041 [key: string]: MotionValue<number> | MotionValue<string>;
5042 };
5043 };
5044}
5045type HandoffFunction = (storeId: string, valueName: string, frame: Batcher) => number | null;
5046/**
5047 * The window global object acts as a bridge between our inline script
5048 * triggering the optimized appear animations, and Motion.
5049 */
5050declare global {
5051 interface Window {
5052 MotionHandoffAnimation?: HandoffFunction;
5053 MotionHandoffMarkAsComplete?: (elementId: string) => void;
5054 MotionHandoffIsComplete?: (elementId: string) => boolean;
5055 MotionHasOptimisedAnimation?: (elementId?: string, valueName?: string) => boolean;
5056 MotionCancelOptimisedAnimation?: (elementId?: string, valueName?: string, frame?: Batcher, canResume?: boolean) => void;
5057 MotionCheckAppearSync?: (visualElement: WithAppearProps, valueName: string, value: MotionValue) => VoidFunction | void;
5058 MotionIsMounted?: boolean;
5059 }
5060}
5061
5062declare function startOptimizedAppearAnimation(element: HTMLElement, name: string, keyframes: string[] | number[], options: NativeAnimationOptions, onReady?: (animation: Animation) => void): void;
5063
5064declare function findSpring({ duration, bounce, velocity, mass, }: SpringOptions): {
5065 stiffness: number;
5066 damping: number;
5067 duration: number;
5068};
5069
5070interface NodeGroup {
5071 add: (node: IProjectionNode) => void;
5072 remove: (node: IProjectionNode) => void;
5073 dirty: VoidFunction;
5074}
5075
5076interface LayoutGroupContextProps {
5077 id?: string;
5078 group?: NodeGroup;
5079 forceRender?: VoidFunction;
5080}
5081declare const LayoutGroupContext: React$1.Context<LayoutGroupContextProps>;
5082
5083type DOMMotionComponents = HTMLMotionComponents & SVGMotionComponents;
5084
5085/**
5086 * @public
5087 */
5088interface ScrollMotionValues {
5089 scrollX: MotionValue<number>;
5090 scrollY: MotionValue<number>;
5091 scrollXProgress: MotionValue<number>;
5092 scrollYProgress: MotionValue<number>;
5093}
5094
5095/**
5096 * Note: Still used by components generated by old versions of Framer
5097 *
5098 * @deprecated
5099 */
5100declare const DeprecatedLayoutGroupContext: React$1.Context<string | null>;
5101
5102/**
5103 * This is not an officially supported API and may be removed
5104 * on any version.
5105 */
5106declare function useAnimatedState(initialState: any): any[];
5107
5108interface ScaleMotionValues {
5109 scaleX: MotionValue<number>;
5110 scaleY: MotionValue<number>;
5111}
5112/**
5113 * Returns a `MotionValue` each for `scaleX` and `scaleY` that update with the inverse
5114 * of their respective parent scales.
5115 *
5116 * This is useful for undoing the distortion of content when scaling a parent component.
5117 *
5118 * By default, `useInvertedScale` will automatically fetch `scaleX` and `scaleY` from the nearest parent.
5119 * By passing other `MotionValue`s in as `useInvertedScale({ scaleX, scaleY })`, it will invert the output
5120 * of those instead.
5121 *
5122 * ```jsx
5123 * const MyComponent = () => {
5124 * const { scaleX, scaleY } = useInvertedScale()
5125 * return <motion.div style={{ scaleX, scaleY }} />
5126 * }
5127 * ```
5128 *
5129 * @deprecated
5130 */
5131declare function useInvertedScale(scale?: Partial<ScaleMotionValues>): ScaleMotionValues;
5132
5133declare const AnimateSharedLayout: React$1.FunctionComponent<React$1.PropsWithChildren<unknown>>;
5134
5135export { type AbsoluteKeyframe, AcceleratedAnimation, AnimatePresence, type AnimatePresenceProps, AnimateSharedLayout, type AnimationControls, type AnimationDefinition, type AnimationGeneratorType, type AnimationLifecycles, type AnimationOptionsWithValueOverrides, type AnimationPlaybackControls, type AnimationPlaybackLifecycles, type AnimationPlaybackOptions, type AnimationProps, type AnimationSequence, type AnimationType, type At, type Axis, type AxisDelta, type BezierDefinition, type BoundingBox, type Box, type CSSStyleDeclarationWithTransform, type CreateVisualElement, type CustomValueType, type Cycle, type CycleState, type DOMKeyframesDefinition, type DOMMotionComponents, type DOMSegment, type DOMSegmentWithTransition, type DecayOptions, type DelayedFunction, type Delta, DeprecatedLayoutGroupContext, type Direction, DragControls, type DragElastic, type DragHandlers, type DraggableProps, type DurationSpringOptions, type DynamicAnimationOptions, type DynamicOption, type Easing, type EasingDefinition, type EasingFunction, type EasingModifier, type EventInfo, type FeatureBundle, type FeatureDefinition, type FeatureDefinitions, type FeaturePackage, type FeaturePackages, FlatTree, type FocusHandlers, type ForwardRefComponent, type GeneratorFactory, type HTMLMotionProps, type HoverHandlers, type HydratedFeatureDefinition, type HydratedFeatureDefinitions, type IProjectionNode, type Inertia, type InertiaOptions$1 as InertiaOptions, type InterpolateOptions, type KeyframeOptions, type Keyframes, type KeyframesTarget, LayoutGroup, LayoutGroupContext, type LayoutProps, type LazyFeatureBundle$1 as LazyFeatureBundle, LazyMotion, type LazyProps, type MixerFactory, type MotionAdvancedProps, MotionConfig, MotionConfigContext, type MotionConfigProps, MotionContext, MotionGlobalConfig, type MotionProps, type MotionStyle, type MotionTransform, MotionValue, type MotionValueSegment, type MotionValueSegmentWithTransition, type None, type ObjectSegment, type ObjectSegmentWithTransition, type ObjectTarget, type Orchestration, type PanHandlers, type PanInfo, type PassiveEffect, type Point, PresenceContext, type RenderComponent, namespace_d as Reorder, type Repeat, type RepeatType, type ResolveKeyframes, type ResolvedAnimationDefinition, type ResolvedAnimationDefinitions, type ResolvedKeyframesTarget, type ResolvedSingleTarget, type ResolvedValueTarget, type ResolvedValues, type SVGAttributesAsMotionValues, type SVGKeyframesDefinition, type SVGMotionProps, type SVGPathKeyframesDefinition, type SVGPathTransitions, type SVGTransitions, type ScrapeMotionValuesFromProps, type ScrollMotionValues, type Segment, type SequenceLabel, type SequenceLabelWithTime, type SequenceMap, type SequenceOptions, type SequenceTime, type SingleTarget, type Spring, type SpringOptions, type StyleKeyframesDefinition, type StyleTransitions, type Subscriber, SwitchLayoutGroupContext, type TapHandlers, type TapInfo, type Target, type TargetAndTransition, type TransformPoint, type Transition$1 as Transition, type Tween, type UnresolvedValueKeyframe, type UseInViewOptions, type UseScrollOptions, type ValueAnimationOptions, type ValueAnimationOptionsWithRenderContext, type ValueAnimationTransition, type ValueKeyframe, type ValueKeyframesDefinition, type ValueSequence, type ValueTarget, type ValueType, type VariableKeyframesDefinition, type VariableTransitions, type Variant, type VariantLabels, type Variants, type VelocityOptions, VisualElement, type VisualState, addPointerEvent, addPointerInfo, addScaleCorrector, animate, animateMini, animateValue, animateVisualElement, animationControls, animations, anticipate, backIn, backInOut, backOut, buildTransform, calcLength, cancelFrame, cancelSync, circIn, circInOut, circOut, clamp, color, complex, createBox, createRendererMotionComponent, createScopedAnimate, cubicBezier, delay, disableInstantTransitions, distance, distance2D, domAnimation, domMax, domMin, easeIn, easeInOut, easeOut, filterProps, findSpring, frame, frameData, frameSteps, inView, inertia, interpolate, isBrowser, isMotionComponent, isMotionValue, isValidMotionProp, keyframes, m, makeUseVisualState, mirrorEasing, mix, motion, motionValue, optimizedAppearDataAttribute, pipe, progress, px, resolveMotionValue, reverseEasing, scroll, scrollInfo, spring, stagger, startOptimizedAppearAnimation, steps, sync, time, transform, unwrapMotionComponent, useAnimate, useAnimateMini, useAnimation, useAnimationControls, useAnimationFrame, useCycle, useAnimatedState as useDeprecatedAnimatedState, useInvertedScale as useDeprecatedInvertedScale, useDomEvent, useDragControls, useElementScroll, useForceUpdate, useInView, useInstantLayoutTransition, useInstantTransition, useIsPresent, useIsomorphicLayoutEffect, useMotionTemplate, useMotionValue, useMotionValueEvent, usePresence, useReducedMotion, useReducedMotionConfig, useResetProjection, useScroll, useSpring, useTime, useTransform, useUnmountEffect, useVelocity, useViewportScroll, useWillChange, visualElementStore, wrap };