motion-dom 12.38.0 → 12.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/cjs/index.js +694 -445
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/es/animation/interfaces/motion-value.mjs +2 -1
  4. package/dist/es/animation/interfaces/motion-value.mjs.map +1 -1
  5. package/dist/es/animation/interfaces/visual-element-target.mjs +8 -0
  6. package/dist/es/animation/interfaces/visual-element-target.mjs.map +1 -1
  7. package/dist/es/animation/utils/arc.mjs +188 -0
  8. package/dist/es/animation/utils/arc.mjs.map +1 -0
  9. package/dist/es/effects/style/transform.mjs +9 -0
  10. package/dist/es/effects/style/transform.mjs.map +1 -1
  11. package/dist/es/index.mjs +1 -0
  12. package/dist/es/index.mjs.map +1 -1
  13. package/dist/es/projection/node/create-projection-node.mjs +30 -6
  14. package/dist/es/projection/node/create-projection-node.mjs.map +1 -1
  15. package/dist/es/projection/styles/transform.mjs +4 -1
  16. package/dist/es/projection/styles/transform.mjs.map +1 -1
  17. package/dist/es/render/VisualElement.mjs +2 -2
  18. package/dist/es/render/VisualElement.mjs.map +1 -1
  19. package/dist/es/render/html/utils/build-transform.mjs +8 -0
  20. package/dist/es/render/html/utils/build-transform.mjs.map +1 -1
  21. package/dist/es/render/utils/animation-state.mjs +2 -1
  22. package/dist/es/render/utils/animation-state.mjs.map +1 -1
  23. package/dist/es/render/utils/keys-transform.mjs +8 -1
  24. package/dist/es/render/utils/keys-transform.mjs.map +1 -1
  25. package/dist/es/value/types/maps/transform.mjs +6 -0
  26. package/dist/es/value/types/maps/transform.mjs.map +1 -1
  27. package/dist/index.d.ts +1160 -1062
  28. package/dist/motion-dom.dev.js +694 -445
  29. package/dist/motion-dom.js +1 -1
  30. package/dist/size-rollup-motion-value.js.map +1 -1
  31. package/dist/size-rollup-style-effect.js +1 -1
  32. package/dist/size-rollup-style-effect.js.map +1 -1
  33. package/package.json +3 -3
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as motion_utils from 'motion-utils';
2
- import { Point, BoundingBox, Axis, Box, TransformPoint, Easing, EasingFunction, BezierDefinition, Delta, AxisDelta, SubscriptionManager } from 'motion-utils';
2
+ import { Point, BoundingBox, Axis, Box, TransformPoint, Easing, Delta, EasingFunction, BezierDefinition, AxisDelta, SubscriptionManager } from 'motion-utils';
3
3
 
4
4
  /**
5
5
  * Passed in to pan event handlers like `onPan` the `PanInfo` object contains
@@ -1460,1394 +1460,1485 @@ interface SVGAttributes {
1460
1460
  zoomAndPan?: string | undefined;
1461
1461
  }
1462
1462
 
1463
+ interface VisualElementAnimationOptions {
1464
+ delay?: number;
1465
+ transitionOverride?: Transition;
1466
+ custom?: any;
1467
+ type?: AnimationType;
1468
+ }
1469
+
1470
+ interface AnimationState$1 {
1471
+ animateChanges: (type?: AnimationType) => Promise<any>;
1472
+ setActive: (type: AnimationType, isActive: boolean, options?: VisualElementAnimationOptions) => Promise<any>;
1473
+ setAnimateFunction: (fn: any) => void;
1474
+ getState: () => {
1475
+ [key: string]: AnimationTypeState;
1476
+ };
1477
+ reset: () => void;
1478
+ }
1479
+ type AnimationList = string[] | TargetAndTransition[];
1480
+ declare function createAnimationState(visualElement: any): AnimationState$1;
1481
+ declare function checkVariantsDidChange(prev: any, next: any): boolean;
1482
+ interface AnimationTypeState {
1483
+ isActive: boolean;
1484
+ protectedKeys: {
1485
+ [key: string]: true;
1486
+ };
1487
+ needsAnimating: {
1488
+ [key: string]: boolean;
1489
+ };
1490
+ prevResolvedValues: {
1491
+ [key: string]: any;
1492
+ };
1493
+ prevProp?: VariantLabels | TargetAndTransition;
1494
+ }
1495
+
1463
1496
  /**
1464
- * An update function. It accepts a timestamp used to advance the animation.
1497
+ * Set feature definitions for all VisualElements.
1498
+ * This should be called by the framework layer (e.g., framer-motion) during initialization.
1465
1499
  */
1466
- type Update$1 = (timestamp: number) => void;
1500
+ declare function setFeatureDefinitions(definitions: Partial<FeatureDefinitions>): void;
1467
1501
  /**
1468
- * Drivers accept a update function and call it at an interval. This interval
1469
- * could be a synchronous loop, a setInterval, or tied to the device's framerate.
1502
+ * Get the current feature definitions
1470
1503
  */
1471
- interface DriverControls {
1472
- start: (keepAlive?: boolean) => void;
1473
- stop: () => void;
1474
- now: () => number;
1475
- }
1476
- type Driver = (update: Update$1) => DriverControls;
1477
-
1504
+ declare function getFeatureDefinitions(): Partial<FeatureDefinitions>;
1478
1505
  /**
1479
- * Temporary subset of VisualElement until VisualElement is
1480
- * moved to motion-dom
1506
+ * Motion style type - a subset of CSS properties that can contain motion values
1481
1507
  */
1482
- interface WithRender {
1483
- render: () => void;
1484
- readValue: (name: string, keyframe: any) => any;
1485
- getValue: (name: string, defaultValue?: any) => any;
1486
- current?: HTMLElement | SVGElement;
1487
- measureViewportBox: () => Box;
1488
- }
1489
-
1490
- type AnyResolvedKeyframe = string | number;
1491
- interface ProgressTimeline {
1492
- currentTime: null | {
1493
- value: number;
1494
- };
1495
- cancel?: VoidFunction;
1496
- }
1497
- interface ValueAnimationOptionsWithRenderContext<V extends AnyResolvedKeyframe = number> extends ValueAnimationOptions<V> {
1498
- KeyframeResolver?: typeof KeyframeResolver;
1499
- motionValue?: MotionValue<V>;
1500
- element?: WithRender;
1501
- }
1502
- interface TimelineWithFallback {
1503
- timeline?: ProgressTimeline;
1504
- rangeStart?: string;
1505
- rangeEnd?: string;
1506
- observe: (animation: AnimationPlaybackControls) => VoidFunction;
1507
- }
1508
+ type MotionStyle = {
1509
+ [K: string]: AnyResolvedKeyframe | MotionValue | undefined;
1510
+ };
1508
1511
  /**
1509
- * Methods to control an animation.
1512
+ * A VisualElement is an imperative abstraction around UI elements such as
1513
+ * HTMLElement, SVGElement, Three.Object3D etc.
1510
1514
  */
1511
- interface AnimationPlaybackControls {
1515
+ declare abstract class VisualElement<Instance = unknown, RenderState = unknown, Options extends {} = {}> {
1512
1516
  /**
1513
- * The current time of the animation, in seconds.
1517
+ * VisualElements are arranged in trees mirroring that of the React tree.
1518
+ * Each type of VisualElement has a unique name, to detect when we're crossing
1519
+ * type boundaries within that tree.
1514
1520
  */
1515
- time: number;
1521
+ abstract type: string;
1516
1522
  /**
1517
- * The playback speed of the animation.
1518
- * 1 = normal speed, 2 = double speed, 0.5 = half speed.
1523
+ * An `Array.sort` compatible function that will compare two Instances and
1524
+ * compare their respective positions within the tree.
1519
1525
  */
1520
- speed: number;
1526
+ abstract sortInstanceNodePosition(a: Instance, b: Instance): number;
1521
1527
  /**
1522
- * The start time of the animation, in milliseconds.
1528
+ * Measure the viewport-relative bounding box of the Instance.
1523
1529
  */
1524
- startTime: number | null;
1530
+ abstract measureInstanceViewportBox(instance: Instance, props: MotionNodeOptions & Partial<MotionConfigContextProps>): Box;
1525
1531
  /**
1526
- * The state of the animation.
1527
- *
1528
- * This is currently for internal use only.
1532
+ * When a value has been removed from all animation props we need to
1533
+ * pick a target to animate back to. For instance, for HTMLElements
1534
+ * we can look in the style prop.
1529
1535
  */
1530
- state: AnimationPlayState;
1531
- duration: number;
1536
+ abstract getBaseTargetFromProps(props: MotionNodeOptions, key: string): AnyResolvedKeyframe | undefined | MotionValue;
1532
1537
  /**
1533
- * The duration of the animation, including any delay.
1538
+ * When we first animate to a value we need to animate it *from* a value.
1539
+ * Often this have been specified via the initial prop but it might be
1540
+ * that the value needs to be read from the Instance.
1534
1541
  */
1535
- iterationDuration: number;
1542
+ abstract readValueFromInstance(instance: Instance, key: string, options: Options): AnyResolvedKeyframe | null | undefined;
1536
1543
  /**
1537
- * Stops the animation at its current state, and prevents it from
1538
- * resuming when the animation is played again.
1544
+ * When a value has been removed from the VisualElement we use this to remove
1545
+ * it from the inherting class' unique render state.
1539
1546
  */
1540
- stop: () => void;
1547
+ abstract removeValueFromRenderState(key: string, renderState: RenderState): void;
1541
1548
  /**
1542
- * Plays the animation.
1549
+ * Run before a React or VisualElement render, builds the latest motion
1550
+ * values into an Instance-specific format. For example, HTMLVisualElement
1551
+ * will use this step to build `style` and `var` values.
1543
1552
  */
1544
- play: () => void;
1553
+ abstract build(renderState: RenderState, latestValues: ResolvedValues$1, props: MotionNodeOptions): void;
1545
1554
  /**
1546
- * Pauses the animation.
1555
+ * Apply the built values to the Instance. For example, HTMLElements will have
1556
+ * styles applied via `setProperty` and the style attribute, whereas SVGElements
1557
+ * will have values applied to attributes.
1547
1558
  */
1548
- pause: () => void;
1559
+ abstract renderInstance(instance: Instance, renderState: RenderState, styleProp?: MotionStyle, projection?: any): void;
1549
1560
  /**
1550
- * Completes the animation and applies the final state.
1561
+ * This method is called when a transform property is bound to a motion value.
1562
+ * It's currently used to measure SVG elements when a new transform property is bound.
1551
1563
  */
1552
- complete: () => void;
1564
+ onBindTransform?(): void;
1553
1565
  /**
1554
- * Cancels the animation and applies the initial state.
1566
+ * If the component child is provided as a motion value, handle subscriptions
1567
+ * with the renderer-specific VisualElement.
1555
1568
  */
1556
- cancel: () => void;
1569
+ handleChildMotionValue?(): void;
1557
1570
  /**
1558
- * Attaches a timeline to the animation, for instance the `ScrollTimeline`.
1571
+ * This method takes React props and returns found MotionValues. For example, HTML
1572
+ * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
1559
1573
  *
1560
- * This is currently for internal use only.
1574
+ * This isn't an abstract method as it needs calling in the constructor, but it is
1575
+ * intended to be one.
1561
1576
  */
1562
- attachTimeline: (timeline: TimelineWithFallback) => VoidFunction;
1563
- finished: Promise<any>;
1564
- }
1565
- type AnimationPlaybackControlsWithThen = AnimationPlaybackControls & {
1566
- then: (onResolve: VoidFunction, onReject?: VoidFunction) => Promise<void>;
1567
- };
1568
- interface AnimationState$1<V> {
1569
- value: V;
1570
- done: boolean;
1571
- }
1572
- interface KeyframeGenerator<V> {
1573
- calculatedDuration: null | number;
1574
- next: (t: number) => AnimationState$1<V>;
1575
- velocity?: (t: number) => number;
1576
- toString: () => string;
1577
- }
1578
- interface DOMValueAnimationOptions<V extends AnyResolvedKeyframe = number> extends ValueAnimationTransition<V> {
1579
- element: HTMLElement | SVGElement;
1580
- keyframes: ValueKeyframesDefinition;
1581
- name: string;
1582
- pseudoElement?: string;
1583
- allowFlatten?: boolean;
1584
- }
1585
- interface ValueAnimationOptions<V extends AnyResolvedKeyframe = number> extends ValueAnimationTransition {
1586
- keyframes: V[];
1587
- element?: any;
1588
- name?: string;
1589
- motionValue?: MotionValue<V>;
1590
- from?: any;
1591
- isHandoff?: boolean;
1592
- allowFlatten?: boolean;
1593
- finalKeyframe?: V;
1594
- }
1595
- type GeneratorFactoryFunction = (options: ValueAnimationOptions<any>) => KeyframeGenerator<any>;
1596
- interface GeneratorFactory extends GeneratorFactoryFunction {
1597
- applyToOptions?: (options: Transition) => Transition;
1598
- }
1599
- type AnimationGeneratorName = "decay" | "spring" | "keyframes" | "tween" | "inertia";
1600
- type AnimationGeneratorType = GeneratorFactory | AnimationGeneratorName | false;
1601
- interface AnimationPlaybackLifecycles<V> {
1602
- onUpdate?: (latest: V) => void;
1603
- onPlay?: () => void;
1604
- onComplete?: () => void;
1605
- onRepeat?: () => void;
1606
- onStop?: () => void;
1607
- }
1608
- interface ValueAnimationTransition<V = any> extends ValueTransition, AnimationPlaybackLifecycles<V> {
1609
- isSync?: boolean;
1610
- }
1611
- type RepeatType = "loop" | "reverse" | "mirror";
1612
- interface AnimationPlaybackOptions {
1577
+ scrapeMotionValuesFromProps(_props: MotionNodeOptions, _prevProps: MotionNodeOptions, _visualElement: VisualElement): {
1578
+ [key: string]: MotionValue | AnyResolvedKeyframe;
1579
+ };
1613
1580
  /**
1614
- * The number of times to repeat the transition. Set to `Infinity` for perpetual repeating.
1615
- *
1616
- * Without setting `repeatType`, this will loop the animation.
1617
- *
1618
- * @public
1581
+ * A reference to the current underlying Instance, e.g. a HTMLElement
1582
+ * or Three.Mesh etc.
1619
1583
  */
1620
- repeat?: number;
1584
+ current: Instance | null;
1621
1585
  /**
1622
- * How to repeat the animation. This can be either:
1623
- *
1624
- * "loop": Repeats the animation from the start
1625
- *
1626
- * "reverse": Alternates between forward and backwards playback
1627
- *
1628
- * "mirror": Switches `from` and `to` alternately
1629
- *
1630
- * @public
1586
+ * A reference to the parent VisualElement (if exists).
1631
1587
  */
1632
- repeatType?: RepeatType;
1588
+ parent: VisualElement | undefined;
1633
1589
  /**
1634
- * When repeating an animation, `repeatDelay` will set the
1635
- * duration of the time to wait, in seconds, between each repetition.
1636
- *
1637
- * @public
1590
+ * A set containing references to this VisualElement's children.
1638
1591
  */
1639
- repeatDelay?: number;
1640
- }
1641
- interface VelocityOptions {
1642
- velocity?: number;
1592
+ children: Set<VisualElement<unknown, unknown, {}>>;
1643
1593
  /**
1644
- * End animation if absolute speed (in units per second) drops below this
1645
- * value and delta is smaller than `restDelta`. Set to `0.01` by default.
1646
- *
1647
- * @public
1594
+ * A set containing the latest children of this VisualElement. This is flushed
1595
+ * at the start of every commit. We use it to calculate the stagger delay
1596
+ * for newly-added children.
1648
1597
  */
1649
- restSpeed?: number;
1598
+ enteringChildren?: Set<VisualElement>;
1650
1599
  /**
1651
- * End animation if distance is below this value and speed is below
1652
- * `restSpeed`. When animation ends, spring gets "snapped" to. Set to
1653
- * `0.01` by default.
1654
- *
1655
- * @public
1600
+ * The depth of this VisualElement within the overall VisualElement tree.
1656
1601
  */
1657
- restDelta?: number;
1658
- }
1659
- interface DurationSpringOptions {
1602
+ depth: number;
1660
1603
  /**
1661
- * The total duration of the animation. Set to `0.3` by default.
1662
- *
1663
- * @public
1604
+ * The current render state of this VisualElement. Defined by inherting VisualElements.
1664
1605
  */
1665
- duration?: number;
1606
+ renderState: RenderState;
1666
1607
  /**
1667
- * If visualDuration is set, this will override duration.
1668
- *
1669
- * The visual duration is a time, set in seconds, that the animation will take to visually appear to reach its target.
1670
- *
1671
- * In other words, the bulk of the transition will occur before this time, and the "bouncy bit" will mostly happen after.
1672
- *
1673
- * This makes it easier to edit a spring, as well as visually coordinate it with other time-based animations.
1674
- *
1675
- * @public
1608
+ * An object containing the latest static values for each of this VisualElement's
1609
+ * MotionValues.
1676
1610
  */
1677
- visualDuration?: number;
1611
+ latestValues: ResolvedValues$1;
1678
1612
  /**
1679
- * `bounce` determines the "bounciness" of a spring animation.
1680
- *
1681
- * `0` is no bounce, and `1` is extremely bouncy.
1682
- *
1683
- * If `duration` is set, this defaults to `0.25`.
1684
- *
1685
- * Note: `bounce` and `duration` will be overridden if `stiffness`, `damping` or `mass` are set.
1686
- *
1687
- * @public
1613
+ * Determine what role this visual element should take in the variant tree.
1688
1614
  */
1689
- bounce?: number;
1690
- }
1691
- interface SpringOptions extends DurationSpringOptions, VelocityOptions {
1615
+ isVariantNode: boolean;
1616
+ isControllingVariants: boolean;
1692
1617
  /**
1693
- * Stiffness of the spring. Higher values will create more sudden movement.
1694
- * Set to `100` by default.
1695
- *
1696
- * @public
1618
+ * If this component is part of the variant tree, it should track
1619
+ * any children that are also part of the tree. This is essentially
1620
+ * a shadow tree to simplify logic around how to stagger over children.
1697
1621
  */
1698
- stiffness?: number;
1622
+ variantChildren?: Set<VisualElement>;
1699
1623
  /**
1700
- * Strength of opposing force. If set to 0, spring will oscillate
1701
- * indefinitely. Set to `10` by default.
1624
+ * Decides whether this VisualElement should animate in reduced motion
1625
+ * mode.
1702
1626
  *
1703
- * @public
1627
+ * TODO: This is currently set on every individual VisualElement but feels
1628
+ * like it could be set globally.
1704
1629
  */
1705
- damping?: number;
1630
+ shouldReduceMotion: boolean | null;
1706
1631
  /**
1707
- * Mass of the moving object. Higher values will result in more lethargic
1708
- * movement. Set to `1` by default.
1709
- *
1710
- * @public
1632
+ * Decides whether animations should be skipped for this VisualElement.
1633
+ * Useful for E2E tests and visual regression testing.
1711
1634
  */
1712
- mass?: number;
1713
- }
1714
- /**
1715
- * @deprecated Use SpringOptions instead
1716
- */
1717
- interface Spring extends SpringOptions {
1718
- }
1719
- interface DecayOptions extends VelocityOptions {
1720
- keyframes?: number[];
1635
+ shouldSkipAnimations: boolean;
1721
1636
  /**
1722
- * A higher power value equals a further target. Set to `0.8` by default.
1637
+ * Normally, if a component is controlled by a parent's variants, it can
1638
+ * rely on that ancestor to trigger animations further down the tree.
1639
+ * However, if a component is created after its parent is mounted, the parent
1640
+ * won't trigger that mount animation so the child needs to.
1723
1641
  *
1724
- * @public
1642
+ * TODO: This might be better replaced with a method isParentMounted
1725
1643
  */
1726
- power?: number;
1644
+ manuallyAnimateOnMount: boolean;
1727
1645
  /**
1728
- * Adjusting the time constant will change the duration of the
1729
- * deceleration, thereby affecting its feel. Set to `700` by default.
1730
- *
1731
- * @public
1646
+ * This can be set by AnimatePresence to force components that mount
1647
+ * at the same time as it to mount as if they have initial={false} set.
1732
1648
  */
1733
- timeConstant?: number;
1649
+ blockInitialAnimation: boolean;
1734
1650
  /**
1735
- * A function that receives the automatically-calculated target and returns a new one. Useful for snapping the target to a grid.
1736
- *
1737
- * @public
1651
+ * A reference to this VisualElement's projection node, used in layout animations.
1738
1652
  */
1739
- modifyTarget?: (v: number) => number;
1740
- }
1741
- interface InertiaOptions extends DecayOptions {
1653
+ projection?: any;
1742
1654
  /**
1743
- * If `min` or `max` is set, this affects the stiffness of the bounce
1744
- * spring. Higher values will create more sudden movement. Set to `500` by
1745
- * default.
1746
- *
1747
- * @public
1655
+ * A map of all motion values attached to this visual element. Motion
1656
+ * values are source of truth for any given animated value. A motion
1657
+ * value might be provided externally by the component via props.
1748
1658
  */
1749
- bounceStiffness?: number;
1659
+ values: Map<string, MotionValue<any>>;
1750
1660
  /**
1751
- * If `min` or `max` is set, this affects the damping of the bounce spring.
1752
- * If set to `0`, spring will oscillate indefinitely. Set to `10` by
1753
- * default.
1754
- *
1755
- * @public
1661
+ * The AnimationState, this is hydrated by the animation Feature.
1756
1662
  */
1757
- bounceDamping?: number;
1663
+ animationState?: AnimationState$1;
1664
+ KeyframeResolver: typeof KeyframeResolver;
1758
1665
  /**
1759
- * 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).
1760
- *
1761
- * @public
1666
+ * The options used to create this VisualElement. The Options type is defined
1667
+ * by the inheriting VisualElement and is passed straight through to the render functions.
1762
1668
  */
1763
- min?: number;
1669
+ readonly options: Options;
1764
1670
  /**
1765
- * Maximum constraint. If set, the value will "bump" against this value (or immediately snap to it, if the initial animation value exceeds this value).
1766
- *
1767
- * @public
1671
+ * A reference to the latest props provided to the VisualElement's host React component.
1768
1672
  */
1769
- max?: number;
1770
- }
1771
- interface AnimationOrchestrationOptions {
1673
+ props: MotionNodeOptions;
1674
+ prevProps?: MotionNodeOptions;
1675
+ presenceContext: PresenceContextProps | null;
1676
+ prevPresenceContext?: PresenceContextProps | null;
1772
1677
  /**
1773
- * Delay the animation by this duration (in seconds). Defaults to `0`.
1774
- *
1775
- * @public
1678
+ * Cleanup functions for active features (hover/tap/exit etc)
1776
1679
  */
1777
- delay?: number;
1680
+ private features;
1778
1681
  /**
1779
- * Describes the relationship between the transition and its children. Set
1780
- * to `false` by default.
1781
- *
1782
- * @remarks
1783
- * When using variants, the transition can be scheduled in relation to its
1784
- * children with either `"beforeChildren"` to finish this transition before
1785
- * starting children transitions, `"afterChildren"` to finish children
1786
- * transitions before starting this transition.
1787
- *
1788
- * @public
1682
+ * A map of every subscription that binds the provided or generated
1683
+ * motion values onChange listeners to this visual element.
1789
1684
  */
1790
- when?: false | "beforeChildren" | "afterChildren" | string;
1685
+ private valueSubscriptions;
1791
1686
  /**
1792
- * When using variants, children animations will start after this duration
1793
- * (in seconds). You can add the `transition` property to both the `motion.div` and the
1794
- * `variant` directly. Adding it to the `variant` generally offers more flexibility,
1795
- * as it allows you to customize the delay per visual state.
1796
- *
1797
- * @public
1687
+ * A reference to the ReducedMotionConfig passed to the VisualElement's host React component.
1798
1688
  */
1799
- delayChildren?: number | DynamicOption<number>;
1689
+ private reducedMotionConfig;
1800
1690
  /**
1801
- * When using variants, animations of child components can be staggered by this
1802
- * duration (in seconds).
1803
- *
1804
- * For instance, if `staggerChildren` is `0.01`, the first child will be
1805
- * delayed by `0` seconds, the second by `0.01`, the third by `0.02` and so
1806
- * on.
1807
- *
1808
- * The calculated stagger delay will be added to `delayChildren`.
1809
- *
1810
- * @deprecated - Use `delayChildren: stagger(interval)` instead.
1691
+ * A reference to the skipAnimations config passed to the VisualElement's host React component.
1811
1692
  */
1812
- staggerChildren?: number;
1693
+ private skipAnimationsConfig;
1813
1694
  /**
1814
- * The direction in which to stagger children.
1815
- *
1816
- * A value of `1` staggers from the first to the last while `-1`
1817
- * staggers from the last to the first.
1818
- *
1819
- * @deprecated - Use `delayChildren: stagger(interval, { from: "last" })` instead.
1695
+ * On mount, this will be hydrated with a callback to disconnect
1696
+ * this visual element from its parent on unmount.
1820
1697
  */
1821
- staggerDirection?: number;
1822
- }
1823
- interface KeyframeOptions {
1698
+ private removeFromVariantTree;
1824
1699
  /**
1825
- * The total duration of the animation. Set to `0.3` by default.
1826
- *
1827
- * @public
1700
+ * A reference to the previously-provided motion values as returned
1701
+ * from scrapeMotionValuesFromProps. We use the keys in here to determine
1702
+ * if any motion values need to be removed after props are updated.
1828
1703
  */
1829
- duration?: number;
1830
- ease?: Easing | Easing[];
1831
- times?: number[];
1832
- }
1833
- interface ValueTransition extends AnimationOrchestrationOptions, AnimationPlaybackOptions, Omit<SpringOptions, "keyframes">, Omit<InertiaOptions, "keyframes">, KeyframeOptions {
1704
+ private prevMotionValues;
1834
1705
  /**
1835
- * Delay the animation by this duration (in seconds). Defaults to `0`.
1836
- *
1837
- * @public
1706
+ * When values are removed from all animation props we need to search
1707
+ * for a fallback value to animate to. These values are tracked in baseTarget.
1838
1708
  */
1839
- delay?: number;
1709
+ private baseTarget;
1840
1710
  /**
1841
- * The duration of time already elapsed in the animation. Set to `0` by
1842
- * default.
1711
+ * Create an object of the values we initially animated from (if initial prop present).
1843
1712
  */
1844
- elapsed?: number;
1845
- driver?: Driver;
1713
+ private initialValues;
1846
1714
  /**
1847
- * Type of animation to use.
1848
- *
1849
- * - "tween": Duration-based animation with ease curve
1850
- * - "spring": Physics or duration-based spring animation
1851
- * - false: Use an instant animation
1715
+ * Track whether this element has been mounted before, to detect
1716
+ * remounts after Suspense unmount/remount cycles.
1852
1717
  */
1853
- type?: AnimationGeneratorType;
1718
+ private hasBeenMounted;
1854
1719
  /**
1855
- * The duration of the tween animation. Set to `0.3` by default, 0r `0.8` if animating a series of keyframes.
1856
- *
1857
- * @public
1720
+ * An object containing a SubscriptionManager for each active event.
1858
1721
  */
1859
- duration?: number;
1860
- autoplay?: boolean;
1861
- startTime?: number;
1862
- from?: any;
1722
+ private events;
1863
1723
  /**
1864
- * If true, this transition will shallow-merge with its parent transition
1865
- * instead of replacing it. Inner keys win.
1866
- *
1867
- * @public
1724
+ * An object containing an unsubscribe function for each prop event subscription.
1725
+ * For example, every "Update" event can have multiple subscribers via
1726
+ * VisualElement.on(), but only one of those can be defined via the onUpdate prop.
1868
1727
  */
1869
- inherit?: boolean;
1870
- }
1871
- /**
1872
- * @deprecated Use KeyframeOptions instead
1873
- */
1874
- interface Tween extends KeyframeOptions {
1875
- }
1876
- type SVGForcedAttrTransitions = {
1877
- [K in keyof SVGForcedAttrProperties]: ValueTransition;
1878
- };
1879
- type SVGPathTransitions = {
1880
- [K in keyof SVGPathProperties]: ValueTransition;
1881
- };
1882
- type SVGTransitions = {
1883
- [K in keyof Omit<SVGAttributes, "from">]: ValueTransition;
1884
- };
1885
- interface VariableTransitions {
1886
- [key: `--${string}`]: ValueTransition;
1887
- }
1888
- type StyleTransitions = {
1889
- [K in keyof CSSStyleDeclarationWithTransform]?: ValueTransition;
1890
- };
1891
- type ValueKeyframe<T extends AnyResolvedKeyframe = AnyResolvedKeyframe> = T;
1892
- type UnresolvedValueKeyframe<T extends AnyResolvedKeyframe = AnyResolvedKeyframe> = ValueKeyframe<T> | null;
1893
- type ResolvedValueKeyframe = ValueKeyframe | ValueKeyframe[];
1894
- type ValueKeyframesDefinition = ValueKeyframe | ValueKeyframe[] | UnresolvedValueKeyframe[];
1895
- type StyleKeyframesDefinition = {
1896
- [K in keyof CSSStyleDeclarationWithTransform]?: ValueKeyframesDefinition;
1897
- };
1898
- type SVGKeyframesDefinition = {
1899
- [K in keyof Omit<SVGAttributes, "from">]?: ValueKeyframesDefinition;
1900
- };
1901
- interface VariableKeyframesDefinition {
1902
- [key: `--${string}`]: ValueKeyframesDefinition;
1903
- }
1904
- type SVGForcedAttrKeyframesDefinition = {
1905
- [K in keyof SVGForcedAttrProperties]?: ValueKeyframesDefinition;
1906
- };
1907
- type SVGPathKeyframesDefinition = {
1908
- [K in keyof SVGPathProperties]?: ValueKeyframesDefinition;
1909
- };
1910
- type DOMKeyframesDefinition = StyleKeyframesDefinition & SVGKeyframesDefinition & SVGPathKeyframesDefinition & SVGForcedAttrKeyframesDefinition & VariableKeyframesDefinition;
1911
- interface Target extends DOMKeyframesDefinition {
1912
- }
1913
- type CSSPropertyKeys = {
1914
- [K in keyof CSSStyleDeclaration as K extends string ? CSSStyleDeclaration[K] extends AnyResolvedKeyframe ? K : never : never]: CSSStyleDeclaration[K];
1915
- };
1916
- interface CSSStyleDeclarationWithTransform extends Omit<CSSPropertyKeys, "direction" | "transition" | "x" | "y" | "z"> {
1917
- x: number | string;
1918
- y: number | string;
1919
- z: number | string;
1920
- originX: number;
1921
- originY: number;
1922
- originZ: number;
1923
- translateX: number | string;
1924
- translateY: number | string;
1925
- translateZ: number | string;
1926
- rotateX: number | string;
1927
- rotateY: number | string;
1928
- rotateZ: number | string;
1929
- scaleX: number;
1930
- scaleY: number;
1931
- scaleZ: number;
1932
- skewX: number | string;
1933
- skewY: number | string;
1934
- transformPerspective: number;
1935
- }
1936
- type TransitionWithValueOverrides<V> = ValueAnimationTransition<V> & StyleTransitions & SVGPathTransitions & SVGForcedAttrTransitions & SVGTransitions & VariableTransitions & {
1937
- default?: ValueTransition;
1938
- layout?: ValueTransition;
1939
- };
1940
- type Transition<V = any> = ValueAnimationTransition<V> | TransitionWithValueOverrides<V>;
1941
- type DynamicOption<T> = (i: number, total: number) => T;
1942
- type ValueAnimationWithDynamicDelay = Omit<ValueAnimationTransition<any>, "delay"> & {
1943
- delay?: number | DynamicOption<number>;
1944
- };
1945
- interface ReduceMotionOption {
1728
+ private propEventSubscriptions;
1729
+ constructor({ parent, props, presenceContext, reducedMotionConfig, skipAnimations, blockInitialAnimation, visualState, }: VisualElementOptions<Instance, RenderState>, options?: Options);
1730
+ mount(instance: Instance): void;
1731
+ unmount(): void;
1732
+ addChild(child: VisualElement): void;
1733
+ removeChild(child: VisualElement): void;
1734
+ private bindToMotionValue;
1735
+ sortNodePosition(other: VisualElement<Instance>): number;
1736
+ updateFeatures(): void;
1737
+ notifyUpdate: () => void;
1738
+ triggerBuild(): void;
1739
+ render: () => void;
1740
+ private renderScheduledAt;
1741
+ scheduleRender: () => void;
1946
1742
  /**
1947
- * Whether to reduce motion for transform/layout animations.
1948
- *
1949
- * - `true`: Skip transform/layout animations (instant transition)
1950
- * - `false`: Always animate transforms/layout
1951
- * - `undefined`: Use device preference (default behavior)
1743
+ * Measure the current viewport box with or without transforms.
1744
+ * Only measures axis-aligned boxes, rotate and skew must be manually
1745
+ * removed with a re-render to work.
1952
1746
  */
1953
- reduceMotion?: boolean;
1954
- }
1955
- type AnimationOptions = (ValueAnimationWithDynamicDelay & ReduceMotionOption) | (ValueAnimationWithDynamicDelay & ReduceMotionOption & StyleTransitions & SVGPathTransitions & SVGForcedAttrTransitions & SVGTransitions & VariableTransitions & {
1956
- default?: ValueTransition;
1957
- layout?: ValueTransition;
1958
- });
1959
- interface TransformProperties {
1960
- x?: AnyResolvedKeyframe;
1961
- y?: AnyResolvedKeyframe;
1962
- z?: AnyResolvedKeyframe;
1963
- translateX?: AnyResolvedKeyframe;
1964
- translateY?: AnyResolvedKeyframe;
1965
- translateZ?: AnyResolvedKeyframe;
1966
- rotate?: AnyResolvedKeyframe;
1967
- rotateX?: AnyResolvedKeyframe;
1968
- rotateY?: AnyResolvedKeyframe;
1969
- rotateZ?: AnyResolvedKeyframe;
1970
- scale?: AnyResolvedKeyframe;
1971
- scaleX?: AnyResolvedKeyframe;
1972
- scaleY?: AnyResolvedKeyframe;
1973
- scaleZ?: AnyResolvedKeyframe;
1974
- skew?: AnyResolvedKeyframe;
1975
- skewX?: AnyResolvedKeyframe;
1976
- skewY?: AnyResolvedKeyframe;
1977
- originX?: AnyResolvedKeyframe;
1978
- originY?: AnyResolvedKeyframe;
1979
- originZ?: AnyResolvedKeyframe;
1980
- perspective?: AnyResolvedKeyframe;
1981
- transformPerspective?: AnyResolvedKeyframe;
1982
- }
1983
- interface SVGForcedAttrProperties {
1984
- attrX?: number;
1985
- attrY?: number;
1986
- attrScale?: number;
1987
- }
1988
- interface SVGPathProperties {
1989
- pathLength?: number;
1990
- pathOffset?: number;
1991
- pathSpacing?: number;
1747
+ measureViewportBox(): Box;
1748
+ getStaticValue(key: string): AnyResolvedKeyframe;
1749
+ setStaticValue(key: string, value: AnyResolvedKeyframe): void;
1750
+ /**
1751
+ * Update the provided props. Ensure any newly-added motion values are
1752
+ * added to our map, old ones removed, and listeners updated.
1753
+ */
1754
+ update(props: MotionNodeOptions, presenceContext: PresenceContextProps | null): void;
1755
+ getProps(): MotionNodeOptions;
1756
+ /**
1757
+ * Returns the variant definition with a given name.
1758
+ */
1759
+ getVariant(name: string): Variant | undefined;
1760
+ /**
1761
+ * Returns the defined default transition on this component.
1762
+ */
1763
+ getDefaultTransition(): Transition | undefined;
1764
+ getTransformPagePoint(): any;
1765
+ getClosestVariantNode(): VisualElement | undefined;
1766
+ /**
1767
+ * Add a child visual element to our set of children.
1768
+ */
1769
+ addVariantChild(child: VisualElement): (() => boolean) | undefined;
1770
+ /**
1771
+ * Add a motion value and bind it to this visual element.
1772
+ */
1773
+ addValue(key: string, value: MotionValue): void;
1774
+ /**
1775
+ * Remove a motion value and unbind any active subscriptions.
1776
+ */
1777
+ removeValue(key: string): void;
1778
+ /**
1779
+ * Check whether we have a motion value for this key
1780
+ */
1781
+ hasValue(key: string): boolean;
1782
+ /**
1783
+ * Get a motion value for this key. If called with a default
1784
+ * value, we'll create one if none exists.
1785
+ */
1786
+ getValue(key: string): MotionValue | undefined;
1787
+ getValue(key: string, defaultValue: AnyResolvedKeyframe | null): MotionValue;
1788
+ /**
1789
+ * If we're trying to animate to a previously unencountered value,
1790
+ * we need to check for it in our state and as a last resort read it
1791
+ * directly from the instance (which might have performance implications).
1792
+ */
1793
+ readValue(key: string, target?: AnyResolvedKeyframe | null): any;
1794
+ /**
1795
+ * Set the base target to later animate back to. This is currently
1796
+ * only hydrated on creation and when we first read a value.
1797
+ */
1798
+ setBaseTarget(key: string, value: AnyResolvedKeyframe): void;
1799
+ /**
1800
+ * Find the base target for a value thats been removed from all animation
1801
+ * props.
1802
+ */
1803
+ getBaseTarget(key: string): ResolvedValues$1[string] | undefined | null;
1804
+ on<EventName extends keyof VisualElementEventCallbacks>(eventName: EventName, callback: VisualElementEventCallbacks[EventName]): VoidFunction;
1805
+ notify<EventName extends keyof VisualElementEventCallbacks>(eventName: EventName, ...args: any): void;
1806
+ scheduleRenderMicrotask(): void;
1992
1807
  }
1993
1808
 
1994
1809
  /**
1995
- * @public
1810
+ * An update function. It accepts a timestamp used to advance the animation.
1996
1811
  */
1997
- type Subscriber<T> = (v: T) => void;
1812
+ type Update$1 = (timestamp: number) => void;
1998
1813
  /**
1999
- * @public
1814
+ * Drivers accept a update function and call it at an interval. This interval
1815
+ * could be a synchronous loop, a setInterval, or tied to the device's framerate.
2000
1816
  */
2001
- type PassiveEffect<T> = (v: T, safeSetter: (v: T) => void) => void;
2002
- type StartAnimation = (complete: () => void) => AnimationPlaybackControlsWithThen | undefined;
2003
- interface MotionValueEventCallbacks<V> {
2004
- animationStart: () => void;
2005
- animationComplete: () => void;
2006
- animationCancel: () => void;
2007
- change: (latestValue: V) => void;
2008
- destroy: () => void;
1817
+ interface DriverControls {
1818
+ start: (keepAlive?: boolean) => void;
1819
+ stop: () => void;
1820
+ now: () => number;
2009
1821
  }
2010
- interface ResolvedValues {
2011
- [key: string]: AnyResolvedKeyframe;
1822
+ type Driver = (update: Update$1) => DriverControls;
1823
+
1824
+ /**
1825
+ * Temporary subset of VisualElement until VisualElement is
1826
+ * moved to motion-dom
1827
+ */
1828
+ interface WithRender {
1829
+ render: () => void;
1830
+ readValue: (name: string, keyframe: any) => any;
1831
+ getValue: (name: string, defaultValue?: any) => any;
1832
+ current?: HTMLElement | SVGElement;
1833
+ measureViewportBox: () => Box;
2012
1834
  }
2013
- interface Owner {
2014
- current: HTMLElement | unknown;
2015
- getProps: () => {
2016
- onUpdate?: (latest: ResolvedValues) => void;
2017
- transformTemplate?: (transform: TransformProperties, generatedTransform: string) => string;
1835
+
1836
+ type AnyResolvedKeyframe = string | number;
1837
+ interface ProgressTimeline {
1838
+ currentTime: null | {
1839
+ value: number;
2018
1840
  };
1841
+ cancel?: VoidFunction;
2019
1842
  }
2020
- interface AccelerateConfig {
2021
- factory: (animation: AnimationPlaybackControlsWithThen) => VoidFunction;
2022
- times: number[];
2023
- keyframes: any[];
2024
- ease?: EasingFunction | EasingFunction[];
2025
- duration: number;
2026
- isTransformed?: boolean;
1843
+ interface ValueAnimationOptionsWithRenderContext<V extends AnyResolvedKeyframe = number> extends ValueAnimationOptions<V> {
1844
+ KeyframeResolver?: typeof KeyframeResolver;
1845
+ motionValue?: MotionValue<V>;
1846
+ element?: WithRender;
2027
1847
  }
2028
- interface MotionValueOptions {
2029
- owner?: Owner;
1848
+ interface TimelineWithFallback {
1849
+ timeline?: ProgressTimeline;
1850
+ rangeStart?: string;
1851
+ rangeEnd?: string;
1852
+ observe: (animation: AnimationPlaybackControls) => VoidFunction;
2030
1853
  }
2031
- declare const collectMotionValues: {
2032
- current: MotionValue[] | undefined;
2033
- };
2034
1854
  /**
2035
- * `MotionValue` is used to track the state and velocity of motion values.
2036
- *
2037
- * @public
1855
+ * Methods to control an animation.
2038
1856
  */
2039
- declare class MotionValue<V = any> {
1857
+ interface AnimationPlaybackControls {
2040
1858
  /**
2041
- * If a MotionValue has an owner, it was created internally within Motion
2042
- * and therefore has no external listeners. It is therefore safe to animate via WAAPI.
1859
+ * The current time of the animation, in seconds.
2043
1860
  */
2044
- owner?: Owner;
1861
+ time: number;
2045
1862
  /**
2046
- * The current state of the `MotionValue`.
1863
+ * The playback speed of the animation.
1864
+ * 1 = normal speed, 2 = double speed, 0.5 = half speed.
2047
1865
  */
2048
- private current;
1866
+ speed: number;
2049
1867
  /**
2050
- * The previous state of the `MotionValue`.
1868
+ * The start time of the animation, in milliseconds.
2051
1869
  */
2052
- private prev;
1870
+ startTime: number | null;
2053
1871
  /**
2054
- * The previous state of the `MotionValue` at the end of the previous frame.
1872
+ * The state of the animation.
1873
+ *
1874
+ * This is currently for internal use only.
2055
1875
  */
2056
- private prevFrameValue;
1876
+ state: AnimationPlayState;
1877
+ duration: number;
2057
1878
  /**
2058
- * The last time the `MotionValue` was updated.
1879
+ * The duration of the animation, including any delay.
2059
1880
  */
2060
- updatedAt: number;
1881
+ iterationDuration: number;
2061
1882
  /**
2062
- * The time `prevFrameValue` was updated.
1883
+ * Stops the animation at its current state, and prevents it from
1884
+ * resuming when the animation is played again.
2063
1885
  */
2064
- prevUpdatedAt: number | undefined;
2065
- private stopPassiveEffect?;
1886
+ stop: () => void;
2066
1887
  /**
2067
- * Whether the passive effect is active.
1888
+ * Plays the animation.
2068
1889
  */
2069
- isEffectActive?: boolean;
1890
+ play: () => void;
2070
1891
  /**
2071
- * A reference to the currently-controlling animation.
1892
+ * Pauses the animation.
2072
1893
  */
2073
- animation?: AnimationPlaybackControlsWithThen;
1894
+ pause: () => void;
2074
1895
  /**
2075
- * A list of MotionValues whose values are computed from this one.
2076
- * This is a rough start to a proper signal-like dirtying system.
1896
+ * Completes the animation and applies the final state.
2077
1897
  */
2078
- private dependents;
1898
+ complete: () => void;
2079
1899
  /**
2080
- * Tracks whether this value should be removed
1900
+ * Cancels the animation and applies the initial state.
2081
1901
  */
2082
- liveStyle?: boolean;
1902
+ cancel: () => void;
2083
1903
  /**
2084
- * Scroll timeline acceleration metadata. When set, VisualElement
2085
- * can create a native WAAPI animation attached to a scroll timeline
2086
- * instead of driving updates through JS.
1904
+ * Attaches a timeline to the animation, for instance the `ScrollTimeline`.
1905
+ *
1906
+ * This is currently for internal use only.
2087
1907
  */
2088
- accelerate?: AccelerateConfig;
1908
+ attachTimeline: (timeline: TimelineWithFallback) => VoidFunction;
1909
+ finished: Promise<any>;
1910
+ }
1911
+ type AnimationPlaybackControlsWithThen = AnimationPlaybackControls & {
1912
+ then: (onResolve: VoidFunction, onReject?: VoidFunction) => Promise<void>;
1913
+ };
1914
+ interface AnimationState<V> {
1915
+ value: V;
1916
+ done: boolean;
1917
+ }
1918
+ interface KeyframeGenerator<V> {
1919
+ calculatedDuration: null | number;
1920
+ next: (t: number) => AnimationState<V>;
1921
+ velocity?: (t: number) => number;
1922
+ toString: () => string;
1923
+ }
1924
+ interface DOMValueAnimationOptions<V extends AnyResolvedKeyframe = number> extends ValueAnimationTransition<V> {
1925
+ element: HTMLElement | SVGElement;
1926
+ keyframes: ValueKeyframesDefinition;
1927
+ name: string;
1928
+ pseudoElement?: string;
1929
+ allowFlatten?: boolean;
1930
+ }
1931
+ interface ValueAnimationOptions<V extends AnyResolvedKeyframe = number> extends ValueAnimationTransition {
1932
+ keyframes: V[];
1933
+ element?: any;
1934
+ name?: string;
1935
+ motionValue?: MotionValue<V>;
1936
+ from?: any;
1937
+ isHandoff?: boolean;
1938
+ allowFlatten?: boolean;
1939
+ finalKeyframe?: V;
1940
+ }
1941
+ type GeneratorFactoryFunction = (options: ValueAnimationOptions<any>) => KeyframeGenerator<any>;
1942
+ interface GeneratorFactory extends GeneratorFactoryFunction {
1943
+ applyToOptions?: (options: Transition) => Transition;
1944
+ }
1945
+ type AnimationGeneratorName = "decay" | "spring" | "keyframes" | "tween" | "inertia";
1946
+ type AnimationGeneratorType = GeneratorFactory | AnimationGeneratorName | false;
1947
+ interface AnimationPlaybackLifecycles<V> {
1948
+ onUpdate?: (latest: V) => void;
1949
+ onPlay?: () => void;
1950
+ onComplete?: () => void;
1951
+ onRepeat?: () => void;
1952
+ onStop?: () => void;
1953
+ }
1954
+ interface ValueAnimationTransition<V = any> extends ValueTransition, AnimationPlaybackLifecycles<V> {
1955
+ isSync?: boolean;
1956
+ }
1957
+ type RepeatType = "loop" | "reverse" | "mirror";
1958
+ interface AnimationPlaybackOptions {
2089
1959
  /**
2090
- * @param init - The initiating value
2091
- * @param config - Optional configuration options
1960
+ * The number of times to repeat the transition. Set to `Infinity` for perpetual repeating.
2092
1961
  *
2093
- * - `transformer`: A function to transform incoming values with.
1962
+ * Without setting `repeatType`, this will loop the animation.
1963
+ *
1964
+ * @public
2094
1965
  */
2095
- constructor(init: V, options?: MotionValueOptions);
2096
- setCurrent(current: V): void;
2097
- setPrevFrameValue(prevFrameValue?: V | undefined): void;
1966
+ repeat?: number;
2098
1967
  /**
2099
- * Adds a function that will be notified when the `MotionValue` is updated.
2100
- *
2101
- * It returns a function that, when called, will cancel the subscription.
2102
- *
2103
- * When calling `onChange` inside a React component, it should be wrapped with the
2104
- * `useEffect` hook. As it returns an unsubscribe function, this should be returned
2105
- * from the `useEffect` function to ensure you don't add duplicate subscribers..
2106
- *
2107
- * ```jsx
2108
- * export const MyComponent = () => {
2109
- * const x = useMotionValue(0)
2110
- * const y = useMotionValue(0)
2111
- * const opacity = useMotionValue(1)
1968
+ * How to repeat the animation. This can be either:
2112
1969
  *
2113
- * useEffect(() => {
2114
- * function updateOpacity() {
2115
- * const maxXY = Math.max(x.get(), y.get())
2116
- * const newOpacity = transform(maxXY, [0, 100], [1, 0])
2117
- * opacity.set(newOpacity)
2118
- * }
1970
+ * "loop": Repeats the animation from the start
2119
1971
  *
2120
- * const unsubscribeX = x.on("change", updateOpacity)
2121
- * const unsubscribeY = y.on("change", updateOpacity)
1972
+ * "reverse": Alternates between forward and backwards playback
2122
1973
  *
2123
- * return () => {
2124
- * unsubscribeX()
2125
- * unsubscribeY()
2126
- * }
2127
- * }, [])
1974
+ * "mirror": Switches `from` and `to` alternately
2128
1975
  *
2129
- * return <motion.div style={{ x }} />
2130
- * }
2131
- * ```
1976
+ * @public
1977
+ */
1978
+ repeatType?: RepeatType;
1979
+ /**
1980
+ * When repeating an animation, `repeatDelay` will set the
1981
+ * duration of the time to wait, in seconds, between each repetition.
2132
1982
  *
2133
- * @param subscriber - A function that receives the latest value.
2134
- * @returns A function that, when called, will cancel this subscription.
1983
+ * @public
1984
+ */
1985
+ repeatDelay?: number;
1986
+ }
1987
+ interface VelocityOptions {
1988
+ velocity?: number;
1989
+ /**
1990
+ * End animation if absolute speed (in units per second) drops below this
1991
+ * value and delta is smaller than `restDelta`. Set to `0.01` by default.
2135
1992
  *
2136
- * @deprecated
1993
+ * @public
2137
1994
  */
2138
- onChange(subscription: Subscriber<V>): () => void;
1995
+ restSpeed?: number;
2139
1996
  /**
2140
- * An object containing a SubscriptionManager for each active event.
1997
+ * End animation if distance is below this value and speed is below
1998
+ * `restSpeed`. When animation ends, spring gets "snapped" to. Set to
1999
+ * `0.01` by default.
2000
+ *
2001
+ * @public
2141
2002
  */
2142
- private events;
2143
- on<EventName extends keyof MotionValueEventCallbacks<V>>(eventName: EventName, callback: MotionValueEventCallbacks<V>[EventName]): VoidFunction;
2144
- clearListeners(): void;
2003
+ restDelta?: number;
2004
+ }
2005
+ interface DurationSpringOptions {
2145
2006
  /**
2146
- * Attaches a passive effect to the `MotionValue`.
2007
+ * The total duration of the animation. Set to `0.3` by default.
2008
+ *
2009
+ * @public
2147
2010
  */
2148
- attach(passiveEffect: PassiveEffect<V>, stopPassiveEffect: VoidFunction): void;
2011
+ duration?: number;
2149
2012
  /**
2150
- * Sets the state of the `MotionValue`.
2013
+ * If visualDuration is set, this will override duration.
2151
2014
  *
2152
- * @remarks
2015
+ * The visual duration is a time, set in seconds, that the animation will take to visually appear to reach its target.
2153
2016
  *
2154
- * ```jsx
2155
- * const x = useMotionValue(0)
2156
- * x.set(10)
2157
- * ```
2017
+ * In other words, the bulk of the transition will occur before this time, and the "bouncy bit" will mostly happen after.
2158
2018
  *
2159
- * @param latest - Latest value to set.
2160
- * @param render - Whether to notify render subscribers. Defaults to `true`
2019
+ * This makes it easier to edit a spring, as well as visually coordinate it with other time-based animations.
2161
2020
  *
2162
2021
  * @public
2163
2022
  */
2164
- set(v: V): void;
2165
- setWithVelocity(prev: V, current: V, delta: number): void;
2166
- /**
2167
- * Set the state of the `MotionValue`, stopping any active animations,
2168
- * effects, and resets velocity to `0`.
2169
- */
2170
- jump(v: V, endAnimation?: boolean): void;
2171
- dirty(): void;
2172
- addDependent(dependent: MotionValue): void;
2173
- removeDependent(dependent: MotionValue): void;
2174
- updateAndNotify: (v: V) => void;
2023
+ visualDuration?: number;
2175
2024
  /**
2176
- * Returns the latest state of `MotionValue`
2025
+ * `bounce` determines the "bounciness" of a spring animation.
2177
2026
  *
2178
- * @returns - The latest state of `MotionValue`
2027
+ * `0` is no bounce, and `1` is extremely bouncy.
2028
+ *
2029
+ * If `duration` is set, this defaults to `0.25`.
2030
+ *
2031
+ * Note: `bounce` and `duration` will be overridden if `stiffness`, `damping` or `mass` are set.
2179
2032
  *
2180
2033
  * @public
2181
2034
  */
2182
- get(): NonNullable<V>;
2035
+ bounce?: number;
2036
+ }
2037
+ interface SpringOptions extends DurationSpringOptions, VelocityOptions {
2183
2038
  /**
2039
+ * Stiffness of the spring. Higher values will create more sudden movement.
2040
+ * Set to `100` by default.
2041
+ *
2042
+ * @default 100
2043
+ *
2184
2044
  * @public
2185
2045
  */
2186
- getPrevious(): V | undefined;
2046
+ stiffness?: number;
2187
2047
  /**
2188
- * Returns the latest velocity of `MotionValue`
2048
+ * Strength of opposing force. If set to 0, spring will oscillate
2049
+ * indefinitely. Set to `10` by default.
2189
2050
  *
2190
- * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
2051
+ * @default 10
2191
2052
  *
2192
2053
  * @public
2193
2054
  */
2194
- getVelocity(): number;
2195
- hasAnimated: boolean;
2055
+ damping?: number;
2196
2056
  /**
2197
- * Registers a new animation to control this `MotionValue`. Only one
2198
- * animation can drive a `MotionValue` at one time.
2057
+ * Mass of the moving object. Higher values will result in more lethargic
2058
+ * movement. Set to `1` by default.
2199
2059
  *
2200
- * ```jsx
2201
- * value.start()
2202
- * ```
2060
+ * @default 1
2203
2061
  *
2204
- * @param animation - A function that starts the provided animation
2062
+ * @public
2205
2063
  */
2206
- start(startAnimation: StartAnimation): Promise<void>;
2064
+ mass?: number;
2065
+ }
2066
+ /**
2067
+ * @deprecated Use SpringOptions instead
2068
+ */
2069
+ interface Spring extends SpringOptions {
2070
+ }
2071
+ interface DecayOptions extends VelocityOptions {
2072
+ keyframes?: number[];
2207
2073
  /**
2208
- * Stop the currently active animation.
2074
+ * A higher power value equals a further target. Set to `0.8` by default.
2209
2075
  *
2210
2076
  * @public
2211
2077
  */
2212
- stop(): void;
2078
+ power?: number;
2213
2079
  /**
2214
- * Returns `true` if this value is currently animating.
2080
+ * Adjusting the time constant will change the duration of the
2081
+ * deceleration, thereby affecting its feel. Set to `700` by default.
2215
2082
  *
2216
2083
  * @public
2217
2084
  */
2218
- isAnimating(): boolean;
2219
- private clearAnimation;
2085
+ timeConstant?: number;
2220
2086
  /**
2221
- * Destroy and clean up subscribers to this `MotionValue`.
2222
- *
2223
- * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
2224
- * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
2225
- * created a `MotionValue` via the `motionValue` function.
2087
+ * A function that receives the automatically-calculated target and returns a new one. Useful for snapping the target to a grid.
2226
2088
  *
2227
2089
  * @public
2228
2090
  */
2229
- destroy(): void;
2091
+ modifyTarget?: (v: number) => number;
2230
2092
  }
2231
- declare function motionValue<V>(init: V, options?: MotionValueOptions): MotionValue<V>;
2232
-
2233
- type UnresolvedKeyframes<T extends AnyResolvedKeyframe> = Array<T | null>;
2234
- type ResolvedKeyframes<T extends AnyResolvedKeyframe> = Array<T>;
2235
- declare function flushKeyframeResolvers(): void;
2236
- type OnKeyframesResolved<T extends AnyResolvedKeyframe> = (resolvedKeyframes: ResolvedKeyframes<T>, finalKeyframe: T, forced: boolean) => void;
2237
- declare class KeyframeResolver<T extends AnyResolvedKeyframe = any> {
2238
- name?: string;
2239
- element?: WithRender;
2240
- finalKeyframe?: T;
2241
- suspendedScrollY?: number;
2242
- protected unresolvedKeyframes: UnresolvedKeyframes<AnyResolvedKeyframe>;
2243
- private motionValue?;
2244
- private onComplete;
2245
- state: "pending" | "scheduled" | "complete";
2246
- /**
2247
- * Track whether this resolver is async. If it is, it'll be added to the
2248
- * resolver queue and flushed in the next frame. Resolvers that aren't going
2249
- * to trigger read/write thrashing don't need to be async.
2250
- */
2251
- private isAsync;
2093
+ interface InertiaOptions extends DecayOptions {
2252
2094
  /**
2253
- * Track whether this resolver needs to perform a measurement
2254
- * to resolve its keyframes.
2095
+ * If `min` or `max` is set, this affects the stiffness of the bounce
2096
+ * spring. Higher values will create more sudden movement. Set to `500` by
2097
+ * default.
2098
+ *
2099
+ * @public
2255
2100
  */
2256
- needsMeasurement: boolean;
2257
- constructor(unresolvedKeyframes: UnresolvedKeyframes<AnyResolvedKeyframe>, onComplete: OnKeyframesResolved<T>, name?: string, motionValue?: MotionValue<T>, element?: WithRender, isAsync?: boolean);
2258
- scheduleResolve(): void;
2259
- readKeyframes(): void;
2260
- setFinalKeyframe(): void;
2261
- measureInitialState(): void;
2262
- renderEndStyles(): void;
2263
- measureEndState(): void;
2264
- complete(isForcedComplete?: boolean): void;
2265
- cancel(): void;
2266
- resume(): void;
2267
- }
2268
-
2269
- declare class WithPromise {
2270
- protected _finished: Promise<void>;
2271
- resolve: VoidFunction;
2272
- constructor();
2273
- get finished(): Promise<void>;
2274
- protected updateFinished(): void;
2275
- protected notifyFinished(): void;
2101
+ bounceStiffness?: number;
2276
2102
  /**
2277
- * Allows the animation to be awaited.
2103
+ * If `min` or `max` is set, this affects the damping of the bounce spring.
2104
+ * If set to `0`, spring will oscillate indefinitely. Set to `10` by
2105
+ * default.
2278
2106
  *
2279
- * @deprecated Use `finished` instead.
2107
+ * @public
2280
2108
  */
2281
- then(onResolve: VoidFunction, onReject?: VoidFunction): Promise<void>;
2282
- }
2283
-
2284
- type OptionsWithoutKeyframes<T extends AnyResolvedKeyframe> = Omit<ValueAnimationOptions<T>, "keyframes">;
2285
- declare class AsyncMotionValueAnimation<T extends AnyResolvedKeyframe> extends WithPromise implements AnimationPlaybackControls {
2286
- private createdAt;
2287
- private resolvedAt;
2288
- private _animation;
2289
- private pendingTimeline;
2290
- private keyframeResolver;
2291
- private stopTimeline;
2292
- constructor({ autoplay, delay, type, repeat, repeatDelay, repeatType, keyframes, name, motionValue, element, ...options }: ValueAnimationOptions<T>);
2293
- onKeyframesResolved(keyframes: ResolvedKeyframes<T>, finalKeyframe: T, options: OptionsWithoutKeyframes<T>, sync: boolean): void;
2294
- get finished(): Promise<any>;
2295
- then(onResolve: VoidFunction, _onReject?: VoidFunction): Promise<void>;
2296
- get animation(): AnimationPlaybackControls;
2297
- get duration(): number;
2298
- get iterationDuration(): number;
2299
- get time(): number;
2300
- set time(newTime: number);
2301
- get speed(): number;
2302
- get state(): AnimationPlayState;
2303
- set speed(newSpeed: number);
2304
- get startTime(): number | null;
2305
- attachTimeline(timeline: TimelineWithFallback): () => void;
2306
- play(): void;
2307
- pause(): void;
2308
- complete(): void;
2309
- cancel(): void;
2109
+ bounceDamping?: number;
2310
2110
  /**
2311
- * Bound to support return animation.stop pattern
2111
+ * 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).
2112
+ *
2113
+ * @public
2312
2114
  */
2313
- stop: () => void;
2314
- }
2315
-
2316
- type AcceptedAnimations = AnimationPlaybackControls;
2317
- type GroupedAnimations = AcceptedAnimations[];
2318
- declare class GroupAnimation implements AnimationPlaybackControls {
2319
- animations: GroupedAnimations;
2320
- constructor(animations: Array<AcceptedAnimations | undefined>);
2321
- get finished(): Promise<any[]>;
2115
+ min?: number;
2322
2116
  /**
2323
- * TODO: Filter out cancelled or stopped animations before returning
2117
+ * Maximum constraint. If set, the value will "bump" against this value (or immediately snap to it, if the initial animation value exceeds this value).
2118
+ *
2119
+ * @public
2324
2120
  */
2325
- private getAll;
2326
- private setAll;
2327
- attachTimeline(timeline: TimelineWithFallback): () => void;
2328
- get time(): number;
2329
- set time(time: number);
2330
- get speed(): number;
2331
- set speed(speed: number);
2332
- get state(): any;
2333
- get startTime(): any;
2334
- get duration(): number;
2335
- get iterationDuration(): number;
2336
- private runAll;
2337
- play(): void;
2338
- pause(): void;
2339
- stop: () => void;
2340
- cancel(): void;
2341
- complete(): void;
2342
- }
2343
-
2344
- declare class GroupAnimationWithThen extends GroupAnimation implements AnimationPlaybackControlsWithThen {
2345
- then(onResolve: VoidFunction, _onReject?: VoidFunction): Promise<void>;
2121
+ max?: number;
2346
2122
  }
2347
-
2348
- declare class JSAnimation<T extends number | string> extends WithPromise implements AnimationPlaybackControlsWithThen {
2349
- state: AnimationPlayState;
2350
- startTime: number | null;
2123
+ interface AnimationOrchestrationOptions {
2351
2124
  /**
2352
- * The driver that's controlling the animation loop. Normally this is a requestAnimationFrame loop
2353
- * but in tests we can pass in a synchronous loop.
2125
+ * Delay the animation by this duration (in seconds). Defaults to `0`.
2126
+ *
2127
+ * @public
2354
2128
  */
2355
- private driver?;
2356
- private isStopped;
2357
- private generator;
2358
- private calculatedDuration;
2359
- private resolvedDuration;
2360
- private totalDuration;
2361
- private options;
2129
+ delay?: number;
2362
2130
  /**
2363
- * The current time of the animation.
2131
+ * Describes the relationship between the transition and its children. Set
2132
+ * to `false` by default.
2133
+ *
2134
+ * @remarks
2135
+ * When using variants, the transition can be scheduled in relation to its
2136
+ * children with either `"beforeChildren"` to finish this transition before
2137
+ * starting children transitions, `"afterChildren"` to finish children
2138
+ * transitions before starting this transition.
2139
+ *
2140
+ * @public
2364
2141
  */
2365
- private currentTime;
2142
+ when?: false | "beforeChildren" | "afterChildren" | string;
2366
2143
  /**
2367
- * The time at which the animation was paused.
2144
+ * When using variants, children animations will start after this duration
2145
+ * (in seconds). You can add the `transition` property to both the `motion.div` and the
2146
+ * `variant` directly. Adding it to the `variant` generally offers more flexibility,
2147
+ * as it allows you to customize the delay per visual state.
2148
+ *
2149
+ * @public
2368
2150
  */
2369
- private holdTime;
2151
+ delayChildren?: number | DynamicOption<number>;
2370
2152
  /**
2371
- * Playback speed as a factor. 0 would be stopped, -1 reverse and 2 double speed.
2153
+ * When using variants, animations of child components can be staggered by this
2154
+ * duration (in seconds).
2155
+ *
2156
+ * For instance, if `staggerChildren` is `0.01`, the first child will be
2157
+ * delayed by `0` seconds, the second by `0.01`, the third by `0.02` and so
2158
+ * on.
2159
+ *
2160
+ * The calculated stagger delay will be added to `delayChildren`.
2161
+ *
2162
+ * @deprecated - Use `delayChildren: stagger(interval)` instead.
2372
2163
  */
2373
- private playbackSpeed;
2374
- private mixKeyframes;
2375
- private mirroredGenerator;
2164
+ staggerChildren?: number;
2376
2165
  /**
2377
- * Reusable state object for the delay phase to avoid
2378
- * allocating a new object every frame.
2166
+ * The direction in which to stagger children.
2167
+ *
2168
+ * A value of `1` staggers from the first to the last while `-1`
2169
+ * staggers from the last to the first.
2170
+ *
2171
+ * @deprecated - Use `delayChildren: stagger(interval, { from: "last" })` instead.
2379
2172
  */
2380
- private delayState;
2381
- constructor(options: ValueAnimationOptions<T>);
2382
- initAnimation(): void;
2383
- updateTime(timestamp: number): void;
2384
- tick(timestamp: number, sample?: boolean): AnimationState$1<T>;
2173
+ staggerDirection?: number;
2174
+ }
2175
+ interface KeyframeOptions {
2385
2176
  /**
2386
- * Allows the returned animation to be awaited or promise-chained. Currently
2387
- * resolves when the animation finishes at all but in a future update could/should
2388
- * reject if its cancels.
2177
+ * The total duration of the animation. Set to `0.3` by default.
2178
+ *
2179
+ * @public
2389
2180
  */
2390
- then(resolve: VoidFunction, reject?: VoidFunction): Promise<void>;
2391
- get duration(): number;
2392
- get iterationDuration(): number;
2393
- get time(): number;
2394
- set time(newTime: number);
2181
+ duration?: number;
2182
+ ease?: Easing | Easing[];
2183
+ times?: number[];
2184
+ }
2185
+ interface ValueTransition extends AnimationOrchestrationOptions, AnimationPlaybackOptions, Omit<SpringOptions, "keyframes">, Omit<InertiaOptions, "keyframes">, KeyframeOptions {
2395
2186
  /**
2396
- * Returns the generator's velocity at the current time in units/second.
2397
- * Uses the analytical derivative when available (springs), avoiding
2398
- * the MotionValue's frame-dependent velocity estimation.
2187
+ * Delay the animation by this duration (in seconds). Defaults to `0`.
2188
+ *
2189
+ * @public
2399
2190
  */
2400
- getGeneratorVelocity(): number;
2401
- get speed(): number;
2402
- set speed(newSpeed: number);
2403
- play(): void;
2404
- pause(): void;
2191
+ delay?: number;
2405
2192
  /**
2406
- * This method is bound to the instance to fix a pattern where
2407
- * animation.stop is returned as a reference from a useEffect.
2193
+ * The duration of time already elapsed in the animation. Set to `0` by
2194
+ * default.
2408
2195
  */
2409
- stop: () => void;
2410
- complete(): void;
2411
- finish(): void;
2412
- cancel(): void;
2413
- private teardown;
2414
- private stopDriver;
2415
- sample(sampleTime: number): AnimationState$1<T>;
2416
- attachTimeline(timeline: TimelineWithFallback): VoidFunction;
2417
- }
2418
- declare function animateValue<T extends number | string>(options: ValueAnimationOptions<T>): JSAnimation<T>;
2419
-
2420
- interface NativeAnimationOptions<V extends AnyResolvedKeyframe = number> extends DOMValueAnimationOptions<V> {
2421
- pseudoElement?: string;
2422
- startTime?: number;
2423
- }
2424
- /**
2425
- * NativeAnimation implements AnimationPlaybackControls for the browser's Web Animations API.
2426
- */
2427
- declare class NativeAnimation<T extends AnyResolvedKeyframe> extends WithPromise implements AnimationPlaybackControlsWithThen {
2196
+ elapsed?: number;
2197
+ driver?: Driver;
2428
2198
  /**
2429
- * The interfaced Web Animation API animation
2199
+ * Type of animation to use.
2200
+ *
2201
+ * - "tween": Duration-based animation with ease curve
2202
+ * - "spring": Physics or duration-based spring animation
2203
+ * - false: Use an instant animation
2430
2204
  */
2431
- protected animation: Animation;
2432
- protected finishedTime: number | null;
2433
- protected options: NativeAnimationOptions;
2434
- private allowFlatten;
2435
- private isStopped;
2436
- private isPseudoElement;
2205
+ type?: AnimationGeneratorType;
2437
2206
  /**
2438
- * Tracks a manually-set start time that takes precedence over WAAPI's
2439
- * dynamic startTime. This is cleared when play() or time setter is called,
2440
- * allowing WAAPI to take over timing.
2207
+ * The duration of the tween animation. Set to `0.3` by default, 0r `0.8` if animating a series of keyframes.
2208
+ *
2209
+ * @public
2441
2210
  */
2442
- protected manualStartTime: number | null;
2443
- constructor(options?: NativeAnimationOptions);
2444
- updateMotionValue?(value?: T): void;
2445
- play(): void;
2446
- pause(): void;
2447
- complete(): void;
2448
- cancel(): void;
2449
- stop(): void;
2211
+ duration?: number;
2212
+ autoplay?: boolean;
2213
+ startTime?: number;
2214
+ from?: any;
2450
2215
  /**
2451
- * WAAPI doesn't natively have any interruption capabilities.
2216
+ * If true, this transition will shallow-merge with its parent transition
2217
+ * instead of replacing it. Inner keys win.
2452
2218
  *
2453
- * In this method, we commit styles back to the DOM before cancelling
2454
- * the animation.
2219
+ * @public
2220
+ */
2221
+ inherit?: boolean;
2222
+ /**
2223
+ * If true, the animation skips straight to its final value instead of
2224
+ * tweening. Used by `MotionConfig`'s `skipAnimations` to opt entire
2225
+ * subtrees out of animation (e.g. for E2E screenshot stability).
2455
2226
  *
2456
- * This is designed to be overridden by NativeAnimationExtended, which
2457
- * will create a renderless JS animation and sample it twice to calculate
2458
- * its current value, "previous" value, and therefore allow
2459
- * Motion to also correctly calculate velocity for any subsequent animation
2460
- * while deferring the commit until the next animation frame.
2227
+ * @public
2461
2228
  */
2462
- protected commitStyles(): void;
2463
- get duration(): number;
2464
- get iterationDuration(): number;
2465
- get time(): number;
2466
- set time(newTime: number);
2229
+ skipAnimations?: boolean;
2467
2230
  /**
2468
- * The playback speed of the animation.
2469
- * 1 = normal speed, 2 = double speed, 0.5 = half speed.
2231
+ * The path the element travels between its old and new x/y positions.
2232
+ * Slot in a path factory (e.g. `arc()`) to swap the default
2233
+ * straight-line interpolation for something curved.
2234
+ *
2235
+ * Can be used in keyframe animations (`transition.path`) and layout
2236
+ * animations (`transition.layout.path`), including with `useAnimate`.
2237
+ *
2238
+ * @public
2470
2239
  */
2471
- get speed(): number;
2472
- set speed(newSpeed: number);
2473
- get state(): AnimationPlayState;
2474
- get startTime(): number;
2475
- set startTime(newStartTime: number);
2240
+ path?: MotionPath;
2241
+ }
2242
+ /**
2243
+ * @deprecated Use KeyframeOptions instead
2244
+ */
2245
+ interface Tween extends KeyframeOptions {
2246
+ }
2247
+ type SVGForcedAttrTransitions = {
2248
+ [K in keyof SVGForcedAttrProperties]: ValueTransition;
2249
+ };
2250
+ type SVGPathTransitions = {
2251
+ [K in keyof SVGPathProperties]: ValueTransition;
2252
+ };
2253
+ type SVGTransitions = {
2254
+ [K in keyof Omit<SVGAttributes, "from">]: ValueTransition;
2255
+ };
2256
+ interface VariableTransitions {
2257
+ [key: `--${string}`]: ValueTransition;
2258
+ }
2259
+ type StyleTransitions = {
2260
+ [K in keyof CSSStyleDeclarationWithTransform]?: ValueTransition;
2261
+ };
2262
+ type ValueKeyframe<T extends AnyResolvedKeyframe = AnyResolvedKeyframe> = T;
2263
+ type UnresolvedValueKeyframe<T extends AnyResolvedKeyframe = AnyResolvedKeyframe> = ValueKeyframe<T> | null;
2264
+ type ResolvedValueKeyframe = ValueKeyframe | ValueKeyframe[];
2265
+ type ValueKeyframesDefinition = ValueKeyframe | ValueKeyframe[] | UnresolvedValueKeyframe[];
2266
+ type StyleKeyframesDefinition = {
2267
+ [K in keyof CSSStyleDeclarationWithTransform]?: ValueKeyframesDefinition;
2268
+ };
2269
+ type SVGKeyframesDefinition = {
2270
+ [K in keyof Omit<SVGAttributes, "from">]?: ValueKeyframesDefinition;
2271
+ };
2272
+ interface VariableKeyframesDefinition {
2273
+ [key: `--${string}`]: ValueKeyframesDefinition;
2274
+ }
2275
+ type SVGForcedAttrKeyframesDefinition = {
2276
+ [K in keyof SVGForcedAttrProperties]?: ValueKeyframesDefinition;
2277
+ };
2278
+ type SVGPathKeyframesDefinition = {
2279
+ [K in keyof SVGPathProperties]?: ValueKeyframesDefinition;
2280
+ };
2281
+ type DOMKeyframesDefinition = StyleKeyframesDefinition & SVGKeyframesDefinition & SVGPathKeyframesDefinition & SVGForcedAttrKeyframesDefinition & VariableKeyframesDefinition;
2282
+ interface Target extends DOMKeyframesDefinition {
2283
+ }
2284
+ type CSSPropertyKeys = {
2285
+ [K in keyof CSSStyleDeclaration as K extends string ? CSSStyleDeclaration[K] extends AnyResolvedKeyframe ? K : never : never]: CSSStyleDeclaration[K];
2286
+ };
2287
+ interface CSSStyleDeclarationWithTransform extends Omit<CSSPropertyKeys, "direction" | "transition" | "x" | "y" | "z"> {
2288
+ x: number | string;
2289
+ y: number | string;
2290
+ z: number | string;
2291
+ originX: number;
2292
+ originY: number;
2293
+ originZ: number;
2294
+ translateX: number | string;
2295
+ translateY: number | string;
2296
+ translateZ: number | string;
2297
+ rotateX: number | string;
2298
+ rotateY: number | string;
2299
+ rotateZ: number | string;
2300
+ scaleX: number;
2301
+ scaleY: number;
2302
+ scaleZ: number;
2303
+ skewX: number | string;
2304
+ skewY: number | string;
2305
+ transformPerspective: number;
2306
+ }
2307
+ type TransitionWithValueOverrides<V> = ValueAnimationTransition<V> & StyleTransitions & SVGPathTransitions & SVGForcedAttrTransitions & SVGTransitions & VariableTransitions & {
2308
+ default?: ValueTransition;
2309
+ layout?: ValueTransition;
2310
+ };
2311
+ type Transition<V = any> = ValueAnimationTransition<V> | TransitionWithValueOverrides<V>;
2312
+ interface Point2D {
2313
+ x: number;
2314
+ y: number;
2315
+ }
2316
+ interface PathState {
2317
+ x: number;
2318
+ y: number;
2476
2319
  /**
2477
- * Attaches a timeline to the animation, for instance the `ScrollTimeline`.
2320
+ * Optional rotation in degrees. If returned, the engine will apply it
2321
+ * to the element's `rotate` value for the duration of the animation.
2478
2322
  */
2479
- attachTimeline({ timeline, rangeStart, rangeEnd, observe, }: TimelineWithFallback): VoidFunction;
2323
+ rotate?: number;
2480
2324
  }
2481
-
2482
- type NativeAnimationOptionsExtended<T extends AnyResolvedKeyframe> = NativeAnimationOptions & ValueAnimationOptions<T> & NativeAnimationOptions;
2483
- declare class NativeAnimationExtended<T extends AnyResolvedKeyframe> extends NativeAnimation<T> {
2484
- options: NativeAnimationOptionsExtended<T>;
2485
- constructor(options: NativeAnimationOptionsExtended<T>);
2325
+ /**
2326
+ * Sampling function — returns position (and optionally rotation) at
2327
+ * progress `t` (0–1).
2328
+ */
2329
+ interface PathInterpolator {
2330
+ (t: number): PathState;
2331
+ }
2332
+ /**
2333
+ * Returned by a path factory such as `arc()` and passed to `transition.path`.
2334
+ * Implements both the keyframe-animation hook (`animateVisualElement`) and
2335
+ * the layout-projection hook (`interpolateProjection`).
2336
+ */
2337
+ interface MotionPath {
2338
+ animateVisualElement(visualElement: VisualElement, target: TargetAndTransition, transition: Transition | undefined, delay: number, animations: AnimationPlaybackControlsWithThen[]): void;
2339
+ interpolateProjection(delta: Delta): PathInterpolator | undefined;
2340
+ }
2341
+ type DynamicOption<T> = (i: number, total: number) => T;
2342
+ type ValueAnimationWithDynamicDelay = Omit<ValueAnimationTransition<any>, "delay"> & {
2343
+ delay?: number | DynamicOption<number>;
2344
+ };
2345
+ interface ReduceMotionOption {
2486
2346
  /**
2487
- * WAAPI doesn't natively have any interruption capabilities.
2347
+ * Whether to reduce motion for transform/layout animations.
2488
2348
  *
2489
- * Rather than read committed styles back out of the DOM, we can
2490
- * create a renderless JS animation and sample it twice to calculate
2491
- * its current value, "previous" value, and therefore allow
2492
- * Motion to calculate velocity for any subsequent animation.
2349
+ * - `true`: Skip transform/layout animations (instant transition)
2350
+ * - `false`: Always animate transforms/layout
2351
+ * - `undefined`: Use device preference (default behavior)
2493
2352
  */
2494
- updateMotionValue(value?: T): void;
2495
- }
2496
-
2497
- declare class NativeAnimationWrapper<T extends AnyResolvedKeyframe> extends NativeAnimation<T> {
2498
- constructor(animation: Animation);
2353
+ reduceMotion?: boolean;
2499
2354
  }
2500
-
2501
- declare const animationMapKey: (name: string, pseudoElement?: string) => string;
2502
- declare function getAnimationMap(element: Element): Map<string, NativeAnimation<AnyResolvedKeyframe>>;
2503
-
2504
- interface VisualElementAnimationOptions {
2505
- delay?: number;
2506
- transitionOverride?: Transition;
2507
- custom?: any;
2508
- type?: AnimationType;
2355
+ type AnimationOptions = (ValueAnimationWithDynamicDelay & ReduceMotionOption) | (ValueAnimationWithDynamicDelay & ReduceMotionOption & StyleTransitions & SVGPathTransitions & SVGForcedAttrTransitions & SVGTransitions & VariableTransitions & {
2356
+ default?: ValueTransition;
2357
+ layout?: ValueTransition;
2358
+ });
2359
+ interface TransformProperties {
2360
+ x?: AnyResolvedKeyframe;
2361
+ y?: AnyResolvedKeyframe;
2362
+ z?: AnyResolvedKeyframe;
2363
+ translateX?: AnyResolvedKeyframe;
2364
+ translateY?: AnyResolvedKeyframe;
2365
+ translateZ?: AnyResolvedKeyframe;
2366
+ rotate?: AnyResolvedKeyframe;
2367
+ rotateX?: AnyResolvedKeyframe;
2368
+ rotateY?: AnyResolvedKeyframe;
2369
+ rotateZ?: AnyResolvedKeyframe;
2370
+ scale?: AnyResolvedKeyframe;
2371
+ scaleX?: AnyResolvedKeyframe;
2372
+ scaleY?: AnyResolvedKeyframe;
2373
+ scaleZ?: AnyResolvedKeyframe;
2374
+ skew?: AnyResolvedKeyframe;
2375
+ skewX?: AnyResolvedKeyframe;
2376
+ skewY?: AnyResolvedKeyframe;
2377
+ originX?: AnyResolvedKeyframe;
2378
+ originY?: AnyResolvedKeyframe;
2379
+ originZ?: AnyResolvedKeyframe;
2380
+ perspective?: AnyResolvedKeyframe;
2381
+ transformPerspective?: AnyResolvedKeyframe;
2509
2382
  }
2510
-
2511
- interface AnimationState {
2512
- animateChanges: (type?: AnimationType) => Promise<any>;
2513
- setActive: (type: AnimationType, isActive: boolean, options?: VisualElementAnimationOptions) => Promise<any>;
2514
- setAnimateFunction: (fn: any) => void;
2515
- getState: () => {
2516
- [key: string]: AnimationTypeState;
2517
- };
2518
- reset: () => void;
2383
+ interface SVGForcedAttrProperties {
2384
+ attrX?: number;
2385
+ attrY?: number;
2386
+ attrScale?: number;
2519
2387
  }
2520
- type AnimationList = string[] | TargetAndTransition[];
2521
- declare function createAnimationState(visualElement: any): AnimationState;
2522
- declare function checkVariantsDidChange(prev: any, next: any): boolean;
2523
- interface AnimationTypeState {
2524
- isActive: boolean;
2525
- protectedKeys: {
2526
- [key: string]: true;
2527
- };
2528
- needsAnimating: {
2529
- [key: string]: boolean;
2530
- };
2531
- prevResolvedValues: {
2532
- [key: string]: any;
2533
- };
2534
- prevProp?: VariantLabels | TargetAndTransition;
2388
+ interface SVGPathProperties {
2389
+ pathLength?: number;
2390
+ pathOffset?: number;
2391
+ pathSpacing?: number;
2535
2392
  }
2536
2393
 
2537
2394
  /**
2538
- * Set feature definitions for all VisualElements.
2539
- * This should be called by the framework layer (e.g., framer-motion) during initialization.
2540
- */
2541
- declare function setFeatureDefinitions(definitions: Partial<FeatureDefinitions>): void;
2542
- /**
2543
- * Get the current feature definitions
2395
+ * @public
2544
2396
  */
2545
- declare function getFeatureDefinitions(): Partial<FeatureDefinitions>;
2397
+ type Subscriber<T> = (v: T) => void;
2546
2398
  /**
2547
- * Motion style type - a subset of CSS properties that can contain motion values
2399
+ * @public
2548
2400
  */
2549
- type MotionStyle = {
2550
- [K: string]: AnyResolvedKeyframe | MotionValue | undefined;
2401
+ type PassiveEffect<T> = (v: T, safeSetter: (v: T) => void) => void;
2402
+ type StartAnimation = (complete: () => void) => AnimationPlaybackControlsWithThen | undefined;
2403
+ interface MotionValueEventCallbacks<V> {
2404
+ animationStart: () => void;
2405
+ animationComplete: () => void;
2406
+ animationCancel: () => void;
2407
+ change: (latestValue: V) => void;
2408
+ destroy: () => void;
2409
+ }
2410
+ interface ResolvedValues {
2411
+ [key: string]: AnyResolvedKeyframe;
2412
+ }
2413
+ interface Owner {
2414
+ current: HTMLElement | unknown;
2415
+ getProps: () => {
2416
+ onUpdate?: (latest: ResolvedValues) => void;
2417
+ transformTemplate?: (transform: TransformProperties, generatedTransform: string) => string;
2418
+ };
2419
+ }
2420
+ interface AccelerateConfig {
2421
+ factory: (animation: AnimationPlaybackControlsWithThen) => VoidFunction;
2422
+ times: number[];
2423
+ keyframes: any[];
2424
+ ease?: EasingFunction | EasingFunction[];
2425
+ duration: number;
2426
+ isTransformed?: boolean;
2427
+ }
2428
+ interface MotionValueOptions {
2429
+ owner?: Owner;
2430
+ }
2431
+ declare const collectMotionValues: {
2432
+ current: MotionValue[] | undefined;
2551
2433
  };
2552
2434
  /**
2553
- * A VisualElement is an imperative abstraction around UI elements such as
2554
- * HTMLElement, SVGElement, Three.Object3D etc.
2435
+ * `MotionValue` is used to track the state and velocity of motion values.
2436
+ *
2437
+ * @public
2555
2438
  */
2556
- declare abstract class VisualElement<Instance = unknown, RenderState = unknown, Options extends {} = {}> {
2557
- /**
2558
- * VisualElements are arranged in trees mirroring that of the React tree.
2559
- * Each type of VisualElement has a unique name, to detect when we're crossing
2560
- * type boundaries within that tree.
2561
- */
2562
- abstract type: string;
2563
- /**
2564
- * An `Array.sort` compatible function that will compare two Instances and
2565
- * compare their respective positions within the tree.
2566
- */
2567
- abstract sortInstanceNodePosition(a: Instance, b: Instance): number;
2568
- /**
2569
- * Measure the viewport-relative bounding box of the Instance.
2570
- */
2571
- abstract measureInstanceViewportBox(instance: Instance, props: MotionNodeOptions & Partial<MotionConfigContextProps>): Box;
2572
- /**
2573
- * When a value has been removed from all animation props we need to
2574
- * pick a target to animate back to. For instance, for HTMLElements
2575
- * we can look in the style prop.
2576
- */
2577
- abstract getBaseTargetFromProps(props: MotionNodeOptions, key: string): AnyResolvedKeyframe | undefined | MotionValue;
2578
- /**
2579
- * When we first animate to a value we need to animate it *from* a value.
2580
- * Often this have been specified via the initial prop but it might be
2581
- * that the value needs to be read from the Instance.
2582
- */
2583
- abstract readValueFromInstance(instance: Instance, key: string, options: Options): AnyResolvedKeyframe | null | undefined;
2439
+ declare class MotionValue<V = any> {
2584
2440
  /**
2585
- * When a value has been removed from the VisualElement we use this to remove
2586
- * it from the inherting class' unique render state.
2441
+ * If a MotionValue has an owner, it was created internally within Motion
2442
+ * and therefore has no external listeners. It is therefore safe to animate via WAAPI.
2587
2443
  */
2588
- abstract removeValueFromRenderState(key: string, renderState: RenderState): void;
2444
+ owner?: Owner;
2589
2445
  /**
2590
- * Run before a React or VisualElement render, builds the latest motion
2591
- * values into an Instance-specific format. For example, HTMLVisualElement
2592
- * will use this step to build `style` and `var` values.
2446
+ * The current state of the `MotionValue`.
2593
2447
  */
2594
- abstract build(renderState: RenderState, latestValues: ResolvedValues$1, props: MotionNodeOptions): void;
2448
+ private current;
2595
2449
  /**
2596
- * Apply the built values to the Instance. For example, HTMLElements will have
2597
- * styles applied via `setProperty` and the style attribute, whereas SVGElements
2598
- * will have values applied to attributes.
2450
+ * The previous state of the `MotionValue`.
2599
2451
  */
2600
- abstract renderInstance(instance: Instance, renderState: RenderState, styleProp?: MotionStyle, projection?: any): void;
2452
+ private prev;
2601
2453
  /**
2602
- * This method is called when a transform property is bound to a motion value.
2603
- * It's currently used to measure SVG elements when a new transform property is bound.
2454
+ * The previous state of the `MotionValue` at the end of the previous frame.
2604
2455
  */
2605
- onBindTransform?(): void;
2456
+ private prevFrameValue;
2606
2457
  /**
2607
- * If the component child is provided as a motion value, handle subscriptions
2608
- * with the renderer-specific VisualElement.
2458
+ * The last time the `MotionValue` was updated.
2609
2459
  */
2610
- handleChildMotionValue?(): void;
2460
+ updatedAt: number;
2611
2461
  /**
2612
- * This method takes React props and returns found MotionValues. For example, HTML
2613
- * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
2614
- *
2615
- * This isn't an abstract method as it needs calling in the constructor, but it is
2616
- * intended to be one.
2462
+ * The time `prevFrameValue` was updated.
2617
2463
  */
2618
- scrapeMotionValuesFromProps(_props: MotionNodeOptions, _prevProps: MotionNodeOptions, _visualElement: VisualElement): {
2619
- [key: string]: MotionValue | AnyResolvedKeyframe;
2620
- };
2464
+ prevUpdatedAt: number | undefined;
2465
+ private stopPassiveEffect?;
2621
2466
  /**
2622
- * A reference to the current underlying Instance, e.g. a HTMLElement
2623
- * or Three.Mesh etc.
2467
+ * Whether the passive effect is active.
2624
2468
  */
2625
- current: Instance | null;
2469
+ isEffectActive?: boolean;
2626
2470
  /**
2627
- * A reference to the parent VisualElement (if exists).
2471
+ * A reference to the currently-controlling animation.
2628
2472
  */
2629
- parent: VisualElement | undefined;
2473
+ animation?: AnimationPlaybackControlsWithThen;
2630
2474
  /**
2631
- * A set containing references to this VisualElement's children.
2475
+ * A list of MotionValues whose values are computed from this one.
2476
+ * This is a rough start to a proper signal-like dirtying system.
2632
2477
  */
2633
- children: Set<VisualElement<unknown, unknown, {}>>;
2478
+ private dependents;
2634
2479
  /**
2635
- * A set containing the latest children of this VisualElement. This is flushed
2636
- * at the start of every commit. We use it to calculate the stagger delay
2637
- * for newly-added children.
2480
+ * Tracks whether this value should be removed
2638
2481
  */
2639
- enteringChildren?: Set<VisualElement>;
2482
+ liveStyle?: boolean;
2640
2483
  /**
2641
- * The depth of this VisualElement within the overall VisualElement tree.
2484
+ * Scroll timeline acceleration metadata. When set, VisualElement
2485
+ * can create a native WAAPI animation attached to a scroll timeline
2486
+ * instead of driving updates through JS.
2642
2487
  */
2643
- depth: number;
2488
+ accelerate?: AccelerateConfig;
2644
2489
  /**
2645
- * The current render state of this VisualElement. Defined by inherting VisualElements.
2490
+ * @param init - The initiating value
2491
+ * @param config - Optional configuration options
2492
+ *
2493
+ * - `transformer`: A function to transform incoming values with.
2646
2494
  */
2647
- renderState: RenderState;
2495
+ constructor(init: V, options?: MotionValueOptions);
2496
+ setCurrent(current: V): void;
2497
+ setPrevFrameValue(prevFrameValue?: V | undefined): void;
2648
2498
  /**
2649
- * An object containing the latest static values for each of this VisualElement's
2650
- * MotionValues.
2499
+ * Adds a function that will be notified when the `MotionValue` is updated.
2500
+ *
2501
+ * It returns a function that, when called, will cancel the subscription.
2502
+ *
2503
+ * When calling `onChange` inside a React component, it should be wrapped with the
2504
+ * `useEffect` hook. As it returns an unsubscribe function, this should be returned
2505
+ * from the `useEffect` function to ensure you don't add duplicate subscribers..
2506
+ *
2507
+ * ```jsx
2508
+ * export const MyComponent = () => {
2509
+ * const x = useMotionValue(0)
2510
+ * const y = useMotionValue(0)
2511
+ * const opacity = useMotionValue(1)
2512
+ *
2513
+ * useEffect(() => {
2514
+ * function updateOpacity() {
2515
+ * const maxXY = Math.max(x.get(), y.get())
2516
+ * const newOpacity = transform(maxXY, [0, 100], [1, 0])
2517
+ * opacity.set(newOpacity)
2518
+ * }
2519
+ *
2520
+ * const unsubscribeX = x.on("change", updateOpacity)
2521
+ * const unsubscribeY = y.on("change", updateOpacity)
2522
+ *
2523
+ * return () => {
2524
+ * unsubscribeX()
2525
+ * unsubscribeY()
2526
+ * }
2527
+ * }, [])
2528
+ *
2529
+ * return <motion.div style={{ x }} />
2530
+ * }
2531
+ * ```
2532
+ *
2533
+ * @param subscriber - A function that receives the latest value.
2534
+ * @returns A function that, when called, will cancel this subscription.
2535
+ *
2536
+ * @deprecated
2651
2537
  */
2652
- latestValues: ResolvedValues$1;
2538
+ onChange(subscription: Subscriber<V>): () => void;
2653
2539
  /**
2654
- * Determine what role this visual element should take in the variant tree.
2540
+ * An object containing a SubscriptionManager for each active event.
2655
2541
  */
2656
- isVariantNode: boolean;
2657
- isControllingVariants: boolean;
2542
+ private events;
2543
+ on<EventName extends keyof MotionValueEventCallbacks<V>>(eventName: EventName, callback: MotionValueEventCallbacks<V>[EventName]): VoidFunction;
2544
+ clearListeners(): void;
2658
2545
  /**
2659
- * If this component is part of the variant tree, it should track
2660
- * any children that are also part of the tree. This is essentially
2661
- * a shadow tree to simplify logic around how to stagger over children.
2546
+ * Attaches a passive effect to the `MotionValue`.
2662
2547
  */
2663
- variantChildren?: Set<VisualElement>;
2548
+ attach(passiveEffect: PassiveEffect<V>, stopPassiveEffect: VoidFunction): void;
2664
2549
  /**
2665
- * Decides whether this VisualElement should animate in reduced motion
2666
- * mode.
2550
+ * Sets the state of the `MotionValue`.
2667
2551
  *
2668
- * TODO: This is currently set on every individual VisualElement but feels
2669
- * like it could be set globally.
2552
+ * @remarks
2553
+ *
2554
+ * ```jsx
2555
+ * const x = useMotionValue(0)
2556
+ * x.set(10)
2557
+ * ```
2558
+ *
2559
+ * @param latest - Latest value to set.
2560
+ * @param render - Whether to notify render subscribers. Defaults to `true`
2561
+ *
2562
+ * @public
2670
2563
  */
2671
- shouldReduceMotion: boolean | null;
2564
+ set(v: V): void;
2565
+ setWithVelocity(prev: V, current: V, delta: number): void;
2672
2566
  /**
2673
- * Decides whether animations should be skipped for this VisualElement.
2674
- * Useful for E2E tests and visual regression testing.
2567
+ * Set the state of the `MotionValue`, stopping any active animations,
2568
+ * effects, and resets velocity to `0`.
2675
2569
  */
2676
- shouldSkipAnimations: boolean;
2570
+ jump(v: V, endAnimation?: boolean): void;
2571
+ dirty(): void;
2572
+ addDependent(dependent: MotionValue): void;
2573
+ removeDependent(dependent: MotionValue): void;
2574
+ updateAndNotify: (v: V) => void;
2677
2575
  /**
2678
- * Normally, if a component is controlled by a parent's variants, it can
2679
- * rely on that ancestor to trigger animations further down the tree.
2680
- * However, if a component is created after its parent is mounted, the parent
2681
- * won't trigger that mount animation so the child needs to.
2576
+ * Returns the latest state of `MotionValue`
2682
2577
  *
2683
- * TODO: This might be better replaced with a method isParentMounted
2578
+ * @returns - The latest state of `MotionValue`
2579
+ *
2580
+ * @public
2684
2581
  */
2685
- manuallyAnimateOnMount: boolean;
2582
+ get(): NonNullable<V>;
2686
2583
  /**
2687
- * This can be set by AnimatePresence to force components that mount
2688
- * at the same time as it to mount as if they have initial={false} set.
2584
+ * @public
2689
2585
  */
2690
- blockInitialAnimation: boolean;
2586
+ getPrevious(): V | undefined;
2691
2587
  /**
2692
- * A reference to this VisualElement's projection node, used in layout animations.
2588
+ * Returns the latest velocity of `MotionValue`
2589
+ *
2590
+ * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
2591
+ *
2592
+ * @public
2693
2593
  */
2694
- projection?: any;
2594
+ getVelocity(): number;
2595
+ hasAnimated: boolean;
2695
2596
  /**
2696
- * A map of all motion values attached to this visual element. Motion
2697
- * values are source of truth for any given animated value. A motion
2698
- * value might be provided externally by the component via props.
2597
+ * Registers a new animation to control this `MotionValue`. Only one
2598
+ * animation can drive a `MotionValue` at one time.
2599
+ *
2600
+ * ```jsx
2601
+ * value.start()
2602
+ * ```
2603
+ *
2604
+ * @param animation - A function that starts the provided animation
2699
2605
  */
2700
- values: Map<string, MotionValue<any>>;
2606
+ start(startAnimation: StartAnimation): Promise<void>;
2701
2607
  /**
2702
- * The AnimationState, this is hydrated by the animation Feature.
2608
+ * Stop the currently active animation.
2609
+ *
2610
+ * @public
2703
2611
  */
2704
- animationState?: AnimationState;
2705
- KeyframeResolver: typeof KeyframeResolver;
2612
+ stop(): void;
2706
2613
  /**
2707
- * The options used to create this VisualElement. The Options type is defined
2708
- * by the inheriting VisualElement and is passed straight through to the render functions.
2614
+ * Returns `true` if this value is currently animating.
2615
+ *
2616
+ * @public
2709
2617
  */
2710
- readonly options: Options;
2618
+ isAnimating(): boolean;
2619
+ private clearAnimation;
2711
2620
  /**
2712
- * A reference to the latest props provided to the VisualElement's host React component.
2621
+ * Destroy and clean up subscribers to this `MotionValue`.
2622
+ *
2623
+ * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
2624
+ * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
2625
+ * created a `MotionValue` via the `motionValue` function.
2626
+ *
2627
+ * @public
2713
2628
  */
2714
- props: MotionNodeOptions;
2715
- prevProps?: MotionNodeOptions;
2716
- presenceContext: PresenceContextProps | null;
2717
- prevPresenceContext?: PresenceContextProps | null;
2629
+ destroy(): void;
2630
+ }
2631
+ declare function motionValue<V>(init: V, options?: MotionValueOptions): MotionValue<V>;
2632
+
2633
+ type UnresolvedKeyframes<T extends AnyResolvedKeyframe> = Array<T | null>;
2634
+ type ResolvedKeyframes<T extends AnyResolvedKeyframe> = Array<T>;
2635
+ declare function flushKeyframeResolvers(): void;
2636
+ type OnKeyframesResolved<T extends AnyResolvedKeyframe> = (resolvedKeyframes: ResolvedKeyframes<T>, finalKeyframe: T, forced: boolean) => void;
2637
+ declare class KeyframeResolver<T extends AnyResolvedKeyframe = any> {
2638
+ name?: string;
2639
+ element?: WithRender;
2640
+ finalKeyframe?: T;
2641
+ suspendedScrollY?: number;
2642
+ protected unresolvedKeyframes: UnresolvedKeyframes<AnyResolvedKeyframe>;
2643
+ private motionValue?;
2644
+ private onComplete;
2645
+ state: "pending" | "scheduled" | "complete";
2718
2646
  /**
2719
- * Cleanup functions for active features (hover/tap/exit etc)
2647
+ * Track whether this resolver is async. If it is, it'll be added to the
2648
+ * resolver queue and flushed in the next frame. Resolvers that aren't going
2649
+ * to trigger read/write thrashing don't need to be async.
2720
2650
  */
2721
- private features;
2651
+ private isAsync;
2722
2652
  /**
2723
- * A map of every subscription that binds the provided or generated
2724
- * motion values onChange listeners to this visual element.
2653
+ * Track whether this resolver needs to perform a measurement
2654
+ * to resolve its keyframes.
2725
2655
  */
2726
- private valueSubscriptions;
2656
+ needsMeasurement: boolean;
2657
+ constructor(unresolvedKeyframes: UnresolvedKeyframes<AnyResolvedKeyframe>, onComplete: OnKeyframesResolved<T>, name?: string, motionValue?: MotionValue<T>, element?: WithRender, isAsync?: boolean);
2658
+ scheduleResolve(): void;
2659
+ readKeyframes(): void;
2660
+ setFinalKeyframe(): void;
2661
+ measureInitialState(): void;
2662
+ renderEndStyles(): void;
2663
+ measureEndState(): void;
2664
+ complete(isForcedComplete?: boolean): void;
2665
+ cancel(): void;
2666
+ resume(): void;
2667
+ }
2668
+
2669
+ declare class WithPromise {
2670
+ protected _finished: Promise<void>;
2671
+ resolve: VoidFunction;
2672
+ constructor();
2673
+ get finished(): Promise<void>;
2674
+ protected updateFinished(): void;
2675
+ protected notifyFinished(): void;
2727
2676
  /**
2728
- * A reference to the ReducedMotionConfig passed to the VisualElement's host React component.
2677
+ * Allows the animation to be awaited.
2678
+ *
2679
+ * @deprecated Use `finished` instead.
2729
2680
  */
2730
- private reducedMotionConfig;
2681
+ then(onResolve: VoidFunction, onReject?: VoidFunction): Promise<void>;
2682
+ }
2683
+
2684
+ type OptionsWithoutKeyframes<T extends AnyResolvedKeyframe> = Omit<ValueAnimationOptions<T>, "keyframes">;
2685
+ declare class AsyncMotionValueAnimation<T extends AnyResolvedKeyframe> extends WithPromise implements AnimationPlaybackControls {
2686
+ private createdAt;
2687
+ private resolvedAt;
2688
+ private _animation;
2689
+ private pendingTimeline;
2690
+ private keyframeResolver;
2691
+ private stopTimeline;
2692
+ constructor({ autoplay, delay, type, repeat, repeatDelay, repeatType, keyframes, name, motionValue, element, ...options }: ValueAnimationOptions<T>);
2693
+ onKeyframesResolved(keyframes: ResolvedKeyframes<T>, finalKeyframe: T, options: OptionsWithoutKeyframes<T>, sync: boolean): void;
2694
+ get finished(): Promise<any>;
2695
+ then(onResolve: VoidFunction, _onReject?: VoidFunction): Promise<void>;
2696
+ get animation(): AnimationPlaybackControls;
2697
+ get duration(): number;
2698
+ get iterationDuration(): number;
2699
+ get time(): number;
2700
+ set time(newTime: number);
2701
+ get speed(): number;
2702
+ get state(): AnimationPlayState;
2703
+ set speed(newSpeed: number);
2704
+ get startTime(): number | null;
2705
+ attachTimeline(timeline: TimelineWithFallback): () => void;
2706
+ play(): void;
2707
+ pause(): void;
2708
+ complete(): void;
2709
+ cancel(): void;
2731
2710
  /**
2732
- * A reference to the skipAnimations config passed to the VisualElement's host React component.
2711
+ * Bound to support return animation.stop pattern
2733
2712
  */
2734
- private skipAnimationsConfig;
2713
+ stop: () => void;
2714
+ }
2715
+
2716
+ type AcceptedAnimations = AnimationPlaybackControls;
2717
+ type GroupedAnimations = AcceptedAnimations[];
2718
+ declare class GroupAnimation implements AnimationPlaybackControls {
2719
+ animations: GroupedAnimations;
2720
+ constructor(animations: Array<AcceptedAnimations | undefined>);
2721
+ get finished(): Promise<any[]>;
2735
2722
  /**
2736
- * On mount, this will be hydrated with a callback to disconnect
2737
- * this visual element from its parent on unmount.
2723
+ * TODO: Filter out cancelled or stopped animations before returning
2738
2724
  */
2739
- private removeFromVariantTree;
2725
+ private getAll;
2726
+ private setAll;
2727
+ attachTimeline(timeline: TimelineWithFallback): () => void;
2728
+ get time(): number;
2729
+ set time(time: number);
2730
+ get speed(): number;
2731
+ set speed(speed: number);
2732
+ get state(): any;
2733
+ get startTime(): any;
2734
+ get duration(): number;
2735
+ get iterationDuration(): number;
2736
+ private runAll;
2737
+ play(): void;
2738
+ pause(): void;
2739
+ stop: () => void;
2740
+ cancel(): void;
2741
+ complete(): void;
2742
+ }
2743
+
2744
+ declare class GroupAnimationWithThen extends GroupAnimation implements AnimationPlaybackControlsWithThen {
2745
+ then(onResolve: VoidFunction, _onReject?: VoidFunction): Promise<void>;
2746
+ }
2747
+
2748
+ declare class JSAnimation<T extends number | string> extends WithPromise implements AnimationPlaybackControlsWithThen {
2749
+ state: AnimationPlayState;
2750
+ startTime: number | null;
2740
2751
  /**
2741
- * A reference to the previously-provided motion values as returned
2742
- * from scrapeMotionValuesFromProps. We use the keys in here to determine
2743
- * if any motion values need to be removed after props are updated.
2752
+ * The driver that's controlling the animation loop. Normally this is a requestAnimationFrame loop
2753
+ * but in tests we can pass in a synchronous loop.
2744
2754
  */
2745
- private prevMotionValues;
2755
+ private driver?;
2756
+ private isStopped;
2757
+ private generator;
2758
+ private calculatedDuration;
2759
+ private resolvedDuration;
2760
+ private totalDuration;
2761
+ private options;
2746
2762
  /**
2747
- * When values are removed from all animation props we need to search
2748
- * for a fallback value to animate to. These values are tracked in baseTarget.
2763
+ * The current time of the animation.
2749
2764
  */
2750
- private baseTarget;
2765
+ private currentTime;
2751
2766
  /**
2752
- * Create an object of the values we initially animated from (if initial prop present).
2767
+ * The time at which the animation was paused.
2753
2768
  */
2754
- private initialValues;
2769
+ private holdTime;
2755
2770
  /**
2756
- * Track whether this element has been mounted before, to detect
2757
- * remounts after Suspense unmount/remount cycles.
2771
+ * Playback speed as a factor. 0 would be stopped, -1 reverse and 2 double speed.
2758
2772
  */
2759
- private hasBeenMounted;
2773
+ private playbackSpeed;
2774
+ private mixKeyframes;
2775
+ private mirroredGenerator;
2760
2776
  /**
2761
- * An object containing a SubscriptionManager for each active event.
2777
+ * Reusable state object for the delay phase to avoid
2778
+ * allocating a new object every frame.
2762
2779
  */
2763
- private events;
2780
+ private delayState;
2781
+ constructor(options: ValueAnimationOptions<T>);
2782
+ initAnimation(): void;
2783
+ updateTime(timestamp: number): void;
2784
+ tick(timestamp: number, sample?: boolean): AnimationState<T>;
2764
2785
  /**
2765
- * An object containing an unsubscribe function for each prop event subscription.
2766
- * For example, every "Update" event can have multiple subscribers via
2767
- * VisualElement.on(), but only one of those can be defined via the onUpdate prop.
2786
+ * Allows the returned animation to be awaited or promise-chained. Currently
2787
+ * resolves when the animation finishes at all but in a future update could/should
2788
+ * reject if its cancels.
2768
2789
  */
2769
- private propEventSubscriptions;
2770
- constructor({ parent, props, presenceContext, reducedMotionConfig, skipAnimations, blockInitialAnimation, visualState, }: VisualElementOptions<Instance, RenderState>, options?: Options);
2771
- mount(instance: Instance): void;
2772
- unmount(): void;
2773
- addChild(child: VisualElement): void;
2774
- removeChild(child: VisualElement): void;
2775
- private bindToMotionValue;
2776
- sortNodePosition(other: VisualElement<Instance>): number;
2777
- updateFeatures(): void;
2778
- notifyUpdate: () => void;
2779
- triggerBuild(): void;
2780
- render: () => void;
2781
- private renderScheduledAt;
2782
- scheduleRender: () => void;
2790
+ then(resolve: VoidFunction, reject?: VoidFunction): Promise<void>;
2791
+ get duration(): number;
2792
+ get iterationDuration(): number;
2793
+ get time(): number;
2794
+ set time(newTime: number);
2783
2795
  /**
2784
- * Measure the current viewport box with or without transforms.
2785
- * Only measures axis-aligned boxes, rotate and skew must be manually
2786
- * removed with a re-render to work.
2796
+ * Returns the generator's velocity at the current time in units/second.
2797
+ * Uses the analytical derivative when available (springs), avoiding
2798
+ * the MotionValue's frame-dependent velocity estimation.
2787
2799
  */
2788
- measureViewportBox(): Box;
2789
- getStaticValue(key: string): AnyResolvedKeyframe;
2790
- setStaticValue(key: string, value: AnyResolvedKeyframe): void;
2800
+ getGeneratorVelocity(): number;
2801
+ get speed(): number;
2802
+ set speed(newSpeed: number);
2803
+ play(): void;
2804
+ pause(): void;
2791
2805
  /**
2792
- * Update the provided props. Ensure any newly-added motion values are
2793
- * added to our map, old ones removed, and listeners updated.
2806
+ * This method is bound to the instance to fix a pattern where
2807
+ * animation.stop is returned as a reference from a useEffect.
2794
2808
  */
2795
- update(props: MotionNodeOptions, presenceContext: PresenceContextProps | null): void;
2796
- getProps(): MotionNodeOptions;
2809
+ stop: () => void;
2810
+ complete(): void;
2811
+ finish(): void;
2812
+ cancel(): void;
2813
+ private teardown;
2814
+ private stopDriver;
2815
+ sample(sampleTime: number): AnimationState<T>;
2816
+ attachTimeline(timeline: TimelineWithFallback): VoidFunction;
2817
+ }
2818
+ declare function animateValue<T extends number | string>(options: ValueAnimationOptions<T>): JSAnimation<T>;
2819
+
2820
+ interface NativeAnimationOptions<V extends AnyResolvedKeyframe = number> extends DOMValueAnimationOptions<V> {
2821
+ pseudoElement?: string;
2822
+ startTime?: number;
2823
+ }
2824
+ /**
2825
+ * NativeAnimation implements AnimationPlaybackControls for the browser's Web Animations API.
2826
+ */
2827
+ declare class NativeAnimation<T extends AnyResolvedKeyframe> extends WithPromise implements AnimationPlaybackControlsWithThen {
2797
2828
  /**
2798
- * Returns the variant definition with a given name.
2829
+ * The interfaced Web Animation API animation
2799
2830
  */
2800
- getVariant(name: string): Variant | undefined;
2831
+ protected animation: Animation;
2832
+ protected finishedTime: number | null;
2833
+ protected options: NativeAnimationOptions;
2834
+ private allowFlatten;
2835
+ private isStopped;
2836
+ private isPseudoElement;
2801
2837
  /**
2802
- * Returns the defined default transition on this component.
2838
+ * Tracks a manually-set start time that takes precedence over WAAPI's
2839
+ * dynamic startTime. This is cleared when play() or time setter is called,
2840
+ * allowing WAAPI to take over timing.
2803
2841
  */
2804
- getDefaultTransition(): Transition | undefined;
2805
- getTransformPagePoint(): any;
2806
- getClosestVariantNode(): VisualElement | undefined;
2842
+ protected manualStartTime: number | null;
2843
+ constructor(options?: NativeAnimationOptions);
2844
+ updateMotionValue?(value?: T): void;
2845
+ play(): void;
2846
+ pause(): void;
2847
+ complete(): void;
2848
+ cancel(): void;
2849
+ stop(): void;
2807
2850
  /**
2808
- * Add a child visual element to our set of children.
2851
+ * WAAPI doesn't natively have any interruption capabilities.
2852
+ *
2853
+ * In this method, we commit styles back to the DOM before cancelling
2854
+ * the animation.
2855
+ *
2856
+ * This is designed to be overridden by NativeAnimationExtended, which
2857
+ * will create a renderless JS animation and sample it twice to calculate
2858
+ * its current value, "previous" value, and therefore allow
2859
+ * Motion to also correctly calculate velocity for any subsequent animation
2860
+ * while deferring the commit until the next animation frame.
2809
2861
  */
2810
- addVariantChild(child: VisualElement): (() => boolean) | undefined;
2862
+ protected commitStyles(): void;
2863
+ get duration(): number;
2864
+ get iterationDuration(): number;
2865
+ get time(): number;
2866
+ set time(newTime: number);
2811
2867
  /**
2812
- * Add a motion value and bind it to this visual element.
2868
+ * The playback speed of the animation.
2869
+ * 1 = normal speed, 2 = double speed, 0.5 = half speed.
2813
2870
  */
2814
- addValue(key: string, value: MotionValue): void;
2871
+ get speed(): number;
2872
+ set speed(newSpeed: number);
2873
+ get state(): AnimationPlayState;
2874
+ get startTime(): number;
2875
+ set startTime(newStartTime: number);
2815
2876
  /**
2816
- * Remove a motion value and unbind any active subscriptions.
2877
+ * Attaches a timeline to the animation, for instance the `ScrollTimeline`.
2817
2878
  */
2818
- removeValue(key: string): void;
2879
+ attachTimeline({ timeline, rangeStart, rangeEnd, observe, }: TimelineWithFallback): VoidFunction;
2880
+ }
2881
+
2882
+ type NativeAnimationOptionsExtended<T extends AnyResolvedKeyframe> = NativeAnimationOptions & ValueAnimationOptions<T> & NativeAnimationOptions;
2883
+ declare class NativeAnimationExtended<T extends AnyResolvedKeyframe> extends NativeAnimation<T> {
2884
+ options: NativeAnimationOptionsExtended<T>;
2885
+ constructor(options: NativeAnimationOptionsExtended<T>);
2819
2886
  /**
2820
- * Check whether we have a motion value for this key
2887
+ * WAAPI doesn't natively have any interruption capabilities.
2888
+ *
2889
+ * Rather than read committed styles back out of the DOM, we can
2890
+ * create a renderless JS animation and sample it twice to calculate
2891
+ * its current value, "previous" value, and therefore allow
2892
+ * Motion to calculate velocity for any subsequent animation.
2821
2893
  */
2822
- hasValue(key: string): boolean;
2894
+ updateMotionValue(value?: T): void;
2895
+ }
2896
+
2897
+ declare class NativeAnimationWrapper<T extends AnyResolvedKeyframe> extends NativeAnimation<T> {
2898
+ constructor(animation: Animation);
2899
+ }
2900
+
2901
+ declare const animationMapKey: (name: string, pseudoElement?: string) => string;
2902
+ declare function getAnimationMap(element: Element): Map<string, NativeAnimation<AnyResolvedKeyframe>>;
2903
+
2904
+ declare function calcChildStagger(children: Set<VisualElement>, child: VisualElement, delayChildren?: number | DynamicOption<number>, staggerChildren?: number, staggerDirection?: number): number;
2905
+
2906
+ interface ArcOptions {
2823
2907
  /**
2824
- * Get a motion value for this key. If called with a default
2825
- * value, we'll create one if none exists.
2908
+ * How far the arc bulges perpendicular to the straight-line path,
2909
+ * as a fraction of the total distance. A value of `1` means the arc
2910
+ * peaks at a height equal to the full travel distance. Default `0.5`.
2826
2911
  */
2827
- getValue(key: string): MotionValue | undefined;
2828
- getValue(key: string, defaultValue: AnyResolvedKeyframe | null): MotionValue;
2912
+ strength?: number;
2829
2913
  /**
2830
- * If we're trying to animate to a previously unencountered value,
2831
- * we need to check for it in our state and as a last resort read it
2832
- * directly from the instance (which might have performance implications).
2914
+ * Where along the path (0–1) the arc reaches its maximum height.
2915
+ * Default `0.5` (symmetric).
2833
2916
  */
2834
- readValue(key: string, target?: AnyResolvedKeyframe | null): any;
2917
+ peak?: number;
2835
2918
  /**
2836
- * Set the base target to later animate back to. This is currently
2837
- * only hydrated on creation and when we first read a value.
2919
+ * Which side the arc bulges toward.
2920
+ * - `"cw"` / `"ccw"` — locked relative to direction of travel
2921
+ * - unset — auto-pick a stable screen-space side
2838
2922
  */
2839
- setBaseTarget(key: string, value: AnyResolvedKeyframe): void;
2923
+ direction?: "cw" | "ccw";
2840
2924
  /**
2841
- * Find the base target for a value thats been removed from all animation
2842
- * props.
2925
+ * Rotates the element to follow the tangent of the arc path.
2926
+ * - `true` — full tangent following (1.0)
2927
+ * - number 0–1 — scale factor
2843
2928
  */
2844
- getBaseTarget(key: string): ResolvedValues$1[string] | undefined | null;
2845
- on<EventName extends keyof VisualElementEventCallbacks>(eventName: EventName, callback: VisualElementEventCallbacks[EventName]): VoidFunction;
2846
- notify<EventName extends keyof VisualElementEventCallbacks>(eventName: EventName, ...args: any): void;
2847
- scheduleRenderMicrotask(): void;
2929
+ rotate?: boolean | number;
2848
2930
  }
2849
-
2850
- declare function calcChildStagger(children: Set<VisualElement>, child: VisualElement, delayChildren?: number | DynamicOption<number>, staggerChildren?: number, staggerDirection?: number): number;
2931
+ /**
2932
+ * Creates a curved path for `transition.path`:
2933
+ *
2934
+ * ```ts
2935
+ * <motion.div animate={{ x: 200, y: 100 }} transition={{ path: arc() }} />
2936
+ * ```
2937
+ *
2938
+ * Reuse the returned value (module scope / useMemo / useRef) so its
2939
+ * continuity closure survives re-renders — a fresh `arc()` has no memory.
2940
+ */
2941
+ declare function arc(options?: ArcOptions): MotionPath;
2851
2942
 
2852
2943
  type CSSVariableName = `--${string}`;
2853
2944
  type CSSVariableToken = `var(${CSSVariableName})`;
@@ -3232,6 +3323,13 @@ declare const positionalKeys: Set<string>;
3232
3323
  declare const transformPropOrder: string[];
3233
3324
  /**
3234
3325
  * A quick lookup for transform props.
3326
+ *
3327
+ * `pathRotation` is a transform for routing purposes (skipped from raw
3328
+ * style application, wired to the transform composite, flags transform
3329
+ * dirty) but is intentionally NOT in `transformPropOrder` — it is
3330
+ * composed onto `rotate` at the build sites, not serialized in its own
3331
+ * slot, and must stay out of the order-array consumers (parse-transform,
3332
+ * unit-conversion, keys-position).
3235
3333
  */
3236
3334
  declare const transformProps: Set<string>;
3237
3335
 
@@ -4328,7 +4426,7 @@ interface IProjectionNode<I = unknown> {
4328
4426
  isTreeAnimating?: boolean;
4329
4427
  isAnimationBlocked?: boolean;
4330
4428
  isTreeAnimationBlocked: () => boolean;
4331
- setAnimationOrigin(delta: Delta): void;
4429
+ setAnimationOrigin(delta: Delta, hasOnlyRelativeTargetChanged?: boolean, pathFn?: MotionPath): void;
4332
4430
  startAnimation(transition: ValueTransition): void;
4333
4431
  finishAnimation(): void;
4334
4432
  hasCheckedOptimisedAppear: boolean;
@@ -4697,7 +4795,7 @@ declare function createProjectionNode<I>({ attachResizeListener, defaultParent,
4697
4795
  currentAnimation?: JSAnimation<number> | undefined;
4698
4796
  mixTargetDelta: (progress: number) => void;
4699
4797
  animationProgress: number;
4700
- setAnimationOrigin(delta: Delta, hasOnlyRelativeTargetChanged?: boolean): void;
4798
+ setAnimationOrigin(delta: Delta, hasOnlyRelativeTargetChanged?: boolean, pathFn?: MotionPath): void;
4701
4799
  motionValue?: MotionValue<number> | undefined;
4702
4800
  startAnimation(options: ValueAnimationOptions<number>): void;
4703
4801
  completeAnimation(): void;
@@ -4837,7 +4935,7 @@ declare const DocumentProjectionNode: {
4837
4935
  currentAnimation?: JSAnimation<number> | undefined;
4838
4936
  mixTargetDelta: (progress: number) => void;
4839
4937
  animationProgress: number;
4840
- setAnimationOrigin(delta: motion_utils.Delta, hasOnlyRelativeTargetChanged?: boolean): void;
4938
+ setAnimationOrigin(delta: motion_utils.Delta, hasOnlyRelativeTargetChanged?: boolean, pathFn?: MotionPath | undefined): void;
4841
4939
  motionValue?: MotionValue<number> | undefined;
4842
4940
  startAnimation(options: ValueAnimationOptions<number>): void;
4843
4941
  completeAnimation(): void;
@@ -4982,7 +5080,7 @@ declare const HTMLProjectionNode: {
4982
5080
  currentAnimation?: JSAnimation<number> | undefined;
4983
5081
  mixTargetDelta: (progress: number) => void;
4984
5082
  animationProgress: number;
4985
- setAnimationOrigin(delta: motion_utils.Delta, hasOnlyRelativeTargetChanged?: boolean): void;
5083
+ setAnimationOrigin(delta: motion_utils.Delta, hasOnlyRelativeTargetChanged?: boolean, pathFn?: MotionPath | undefined): void;
4986
5084
  motionValue?: MotionValue<number> | undefined;
4987
5085
  startAnimation(options: ValueAnimationOptions<number>): void;
4988
5086
  completeAnimation(): void;
@@ -5108,4 +5206,4 @@ declare const sync: Batcher;
5108
5206
  */
5109
5207
  declare const cancelSync: Record<string, (process: Process) => void>;
5110
5208
 
5111
- export { type AccelerateConfig, type AcceptedAnimations, type ActiveStatsBuffer, type AnimationDefinition, type AnimationGeneratorName, type AnimationGeneratorType, type AnimationList, type AnimationOptions, type AnimationOrchestrationOptions, type AnimationPlaybackControls, type AnimationPlaybackControlsWithThen, type AnimationPlaybackLifecycles, type AnimationPlaybackOptions, type AnimationScope, type AnimationState, type AnimationType, type AnimationTypeState, type AnyResolvedKeyframe, AsyncMotionValueAnimation, type Batcher, type CSSStyleDeclarationWithTransform, type CSSVariableName, type CSSVariableToken, type CancelProcess, type Color, type ComplexValueInfo, type ComplexValues, type DOMKeyframesDefinition, DOMKeyframesResolver, type DOMValueAnimationOptions, DOMVisualElement, type DOMVisualElementOptions, type DecayOptions, type DelayedFunction, DocumentProjectionNode, type DragElastic, type DragHandler, type DraggableProps, type DurationSpringOptions, type DynamicOption, type ElementOrSelector, type EventInfo, type EventOptions, Feature, type FeatureClass, FlatTree, type FollowValueOptions, type FrameData, type FrameStats, type GeneratorFactory, type GeneratorFactoryFunction, GroupAnimation, GroupAnimationWithThen, type GroupedAnimations, type HSLA, HTMLProjectionNode, type HTMLRenderState, HTMLVisualElement, type HandoffFunction, type IProjectionNode, type InactiveStatsBuffer, type InertiaOptions, type InitialPromotionConfig, type InterpolateOptions, JSAnimation, type KeyframeGenerator, type KeyframeOptions, KeyframeResolver, LayoutAnimationBuilder, type LayoutEvents, type LayoutLifecycles, type LayoutUpdateData, type LayoutUpdateHandler, type LegacyAnimationControls, type MapInputRange, type Measurements, type Mixer, type MixerFactory, type MotionConfigContextProps, type MotionNodeAdvancedOptions, type MotionNodeAnimationOptions, type MotionNodeDragHandlers, type MotionNodeDraggableOptions, type MotionNodeEventOptions, type MotionNodeFocusHandlers, type MotionNodeHoverHandlers, type MotionNodeLayoutOptions, type MotionNodeOptions, type MotionNodePanHandlers, type MotionNodeTapHandlers, type MotionNodeViewportOptions, type MotionStyle, MotionValue, type MotionValueEventCallbacks, type MotionValueOptions, type MultiTransformer, NativeAnimation, NativeAnimationExtended, type NativeAnimationOptions, type NativeAnimationOptionsExtended, NativeAnimationWrapper, type NodeGroup, NodeStack, type NumberMap, ObjectVisualElement, type OnHoverEndEvent, type OnHoverStartEvent, type OnKeyframesResolved, type OnPressEndEvent, type OnPressStartEvent, type Owner, type PanHandler, type PanInfo, type PassiveEffect, type Phase, type PointerEventOptions, type PresenceContextProps, type PressGestureInfo, type Process, type ProgressTimeline, type ProjectionEventName, type ProjectionNodeConfig, type ProjectionNodeOptions, type PropagateOptions, type RGBA, type ReducedMotionConfig, type RepeatType, type ResolvedConstraints, type ResolvedElastic, type ResolvedKeyframes, type ResolvedValueKeyframe, type ResolvedValues$1 as ResolvedValues, type SVGAttributes, type SVGForcedAttrKeyframesDefinition, type SVGForcedAttrProperties, type SVGForcedAttrTransitions, type SVGKeyframesDefinition, type SVGPathKeyframesDefinition, type SVGPathProperties, type SVGPathTransitions, type SVGRenderState, type SVGTransitions, SVGVisualElement, type ScaleCorrectionNode, type ScaleCorrector, type ScaleCorrectorDefinition, type ScaleCorrectorMap, type Schedule, type ScrapeMotionValuesFromProps, type ScrollMeasurements, type SelectorCache, type SingleTransformer, type Spring, type SpringOptions, type StaggerOptions, type StaggerOrigin, type StartAnimation, type Stats, type StatsBuffer, type StatsRecording, type StatsSummary, type Step, type StepId, type Steps, type StyleKeyframesDefinition, type StyleTransitions, type Subscriber, type Summary, type TapHandlers, type TapInfo, type Target, type TargetAndTransition, type TargetResolver, type TimelineWithFallback, type TransformInputRange, type TransformOptions, type TransformOrigin, type TransformProperties, type TransformTemplate, type Transformer, type Transition, type TransitionWithValueOverrides, type Tween, type UnresolvedKeyframes, type UnresolvedValueKeyframe, type UseRenderState, type ValueAnimationOptions, type ValueAnimationOptionsWithRenderContext, type ValueAnimationTransition, type ValueAnimationWithDynamicDelay, type ValueIndexes, type ValueKeyframe, type ValueKeyframesDefinition, type ValueTransformer, type ValueTransition, type ValueType, type ValueTypeMap, type VariableKeyframesDefinition, type VariableTransitions, type Variant, type VariantLabels, type Variants, type VelocityOptions, type ViewTransitionAnimationDefinition, ViewTransitionBuilder, type ViewTransitionOptions, type ViewTransitionTarget, type ViewTransitionTargetDefinition, type ViewportEventHandler, type ViewportOptions, VisualElement, type VisualElementAnimationOptions, type VisualElementEventCallbacks, type VisualElementOptions, type VisualState, type WillChange, type WithAppearProps, type WithDepth, type WithQuerySelectorAll, acceleratedValues, activeAnimations, addAttrValue, addDomEvent, addScaleCorrector, addStyleValue, addValueToWillChange, alpha, analyseComplexValue, animateMotionValue, animateSingleValue, animateTarget, animateValue, animateVariant, animateView, animateVisualElement, animationMapKey, applyAxisDelta, applyBoxDelta, applyGeneratorOptions, applyPointDelta, applyPxDefaults, applyTreeDeltas, aspectRatio, attachFollow, attachSpring, attrEffect, axisDeltaEquals, axisEquals, axisEqualsRounded, boxEquals, boxEqualsRounded, buildHTMLStyles, buildProjectionTransform, buildSVGAttrs, buildSVGPath, buildTransform, calcAxisDelta, calcBoxDelta, calcChildStagger, calcGeneratorDuration, calcLength, calcRelativeAxis, calcRelativeAxisPosition, calcRelativeBox, calcRelativePosition, camelCaseAttributes, camelToDash, cancelFrame, cancelMicrotask, cancelSync, checkVariantsDidChange, cleanDirtyNodes, collectMotionValues, color, compareByDepth, complex, containsCSSVariable, convertBoundingBoxToBox, convertBoxToBoundingBox, convertOffsetToTimes, copyAxisDeltaInto, copyAxisInto, copyBoxInto, correctBorderRadius, correctBoxShadow, createAnimationState, createAxis, createAxisDelta, createBox, createDelta, createGeneratorEasing, createProjectionNode, createRenderBatcher, cubicBezierAsString, defaultEasing, defaultOffset, defaultTransformValue, defaultValueTypes, degrees, delay, delayInSeconds, dimensionValueTypes, eachAxis, fillOffset, fillWildcards, findDimensionValueType, findValueType, flushKeyframeResolvers, followValue, frame, frameData, frameSteps, generateLinearEasing, getAnimatableNone, getAnimationMap, getComputedStyle, getDefaultTransition, getDefaultValueType, getFeatureDefinitions, getFinalKeyframe, getMixer, getOptimisedAppearId, getOriginIndex, getValueAsType, getValueTransition, getVariableValue, getVariantContext, getViewAnimationLayerInfo, getViewAnimations, globalProjectionState, has2DTranslate, hasReducedMotionListener, hasScale, hasTransform, hex, hover, hsla, hslaToRgba, inertia, initPrefersReducedMotion, interpolate, invisibleValues, isAnimationControls, isCSSVariableName, isCSSVariableToken, isControllingVariants, isDeltaZero, isDragActive, isDragging, isElementKeyboardAccessible, isElementTextInput, isForcedMotionValue, isGenerator, isHTMLElement, isKeyframesTarget, isMotionValue, isNear, isNodeOrChild, isPrimaryPointer, isSVGElement, isSVGSVGElement, isSVGTag, isTransitionDefined, isVariantLabel, isVariantNode, isWaapiSupportedEasing, isWillChangeMotionValue, keyframes, makeAnimationInstant, mapEasingToNativeEasing, mapValue, maxGeneratorDuration, measurePageBox, measureViewportBox, microtask, mix, mixArray, mixColor, mixComplex, mixImmediate, mixLinearColor, mixNumber, mixObject, mixValues, mixVisibility, motionValue, nodeGroup, number, numberValueTypes, observeTimeline, optimizedAppearDataAttribute, optimizedAppearDataId, parseAnimateLayoutArgs, parseCSSVariable, parseValueFromTransform, percent, pixelsToPercent, positionalKeys, prefersReducedMotion, press, progressPercentage, propEffect, propagateDirtyNodes, px, readTransformValue, recordStats, removeAxisDelta, removeAxisTransforms, removeBoxTransforms, removePointDelta, renderHTML, renderSVG, resize, resolveElements, resolveMotionValue, resolveTransition, resolveVariant, resolveVariantFromProps, rgbUnit, rgba, rootProjectionNode, scale, scaleCorrectors, scalePoint, scrapeMotionValuesFromProps$1 as scrapeHTMLMotionValuesFromProps, scrapeMotionValuesFromProps as scrapeSVGMotionValuesFromProps, setDragLock, setFeatureDefinitions, setStyle, setTarget, spring, springValue, stagger, startWaapiAnimation, statsBuffer, styleEffect, supportedWaapiEasing, supportsBrowserAnimation, supportsFlags, supportsLinearEasing, supportsPartialKeyframes, supportsScrollTimeline, supportsViewTimeline, svgEffect, sync, testValueType, time, transform, transformAxis, transformBox, transformBoxPoints, transformPropOrder, transformProps, transformValue, transformValueTypes, translateAxis, updateMotionValuesFromProps, variantPriorityOrder, variantProps, vh, visualElementStore, vw };
5209
+ export { type AccelerateConfig, type AcceptedAnimations, type ActiveStatsBuffer, type AnimationDefinition, type AnimationGeneratorName, type AnimationGeneratorType, type AnimationList, type AnimationOptions, type AnimationOrchestrationOptions, type AnimationPlaybackControls, type AnimationPlaybackControlsWithThen, type AnimationPlaybackLifecycles, type AnimationPlaybackOptions, type AnimationScope, type AnimationState$1 as AnimationState, type AnimationType, type AnimationTypeState, type AnyResolvedKeyframe, type ArcOptions, AsyncMotionValueAnimation, type Batcher, type CSSStyleDeclarationWithTransform, type CSSVariableName, type CSSVariableToken, type CancelProcess, type Color, type ComplexValueInfo, type ComplexValues, type DOMKeyframesDefinition, DOMKeyframesResolver, type DOMValueAnimationOptions, DOMVisualElement, type DOMVisualElementOptions, type DecayOptions, type DelayedFunction, DocumentProjectionNode, type DragElastic, type DragHandler, type DraggableProps, type DurationSpringOptions, type DynamicOption, type ElementOrSelector, type EventInfo, type EventOptions, Feature, type FeatureClass, FlatTree, type FollowValueOptions, type FrameData, type FrameStats, type GeneratorFactory, type GeneratorFactoryFunction, GroupAnimation, GroupAnimationWithThen, type GroupedAnimations, type HSLA, HTMLProjectionNode, type HTMLRenderState, HTMLVisualElement, type HandoffFunction, type IProjectionNode, type InactiveStatsBuffer, type InertiaOptions, type InitialPromotionConfig, type InterpolateOptions, JSAnimation, type KeyframeGenerator, type KeyframeOptions, KeyframeResolver, LayoutAnimationBuilder, type LayoutEvents, type LayoutLifecycles, type LayoutUpdateData, type LayoutUpdateHandler, type LegacyAnimationControls, type MapInputRange, type Measurements, type Mixer, type MixerFactory, type MotionConfigContextProps, type MotionNodeAdvancedOptions, type MotionNodeAnimationOptions, type MotionNodeDragHandlers, type MotionNodeDraggableOptions, type MotionNodeEventOptions, type MotionNodeFocusHandlers, type MotionNodeHoverHandlers, type MotionNodeLayoutOptions, type MotionNodeOptions, type MotionNodePanHandlers, type MotionNodeTapHandlers, type MotionNodeViewportOptions, type MotionPath, type MotionStyle, MotionValue, type MotionValueEventCallbacks, type MotionValueOptions, type MultiTransformer, NativeAnimation, NativeAnimationExtended, type NativeAnimationOptions, type NativeAnimationOptionsExtended, NativeAnimationWrapper, type NodeGroup, NodeStack, type NumberMap, ObjectVisualElement, type OnHoverEndEvent, type OnHoverStartEvent, type OnKeyframesResolved, type OnPressEndEvent, type OnPressStartEvent, type Owner, type PanHandler, type PanInfo, type PassiveEffect, type PathInterpolator, type PathState, type Phase, type Point2D, type PointerEventOptions, type PresenceContextProps, type PressGestureInfo, type Process, type ProgressTimeline, type ProjectionEventName, type ProjectionNodeConfig, type ProjectionNodeOptions, type PropagateOptions, type RGBA, type ReducedMotionConfig, type RepeatType, type ResolvedConstraints, type ResolvedElastic, type ResolvedKeyframes, type ResolvedValueKeyframe, type ResolvedValues$1 as ResolvedValues, type SVGAttributes, type SVGForcedAttrKeyframesDefinition, type SVGForcedAttrProperties, type SVGForcedAttrTransitions, type SVGKeyframesDefinition, type SVGPathKeyframesDefinition, type SVGPathProperties, type SVGPathTransitions, type SVGRenderState, type SVGTransitions, SVGVisualElement, type ScaleCorrectionNode, type ScaleCorrector, type ScaleCorrectorDefinition, type ScaleCorrectorMap, type Schedule, type ScrapeMotionValuesFromProps, type ScrollMeasurements, type SelectorCache, type SingleTransformer, type Spring, type SpringOptions, type StaggerOptions, type StaggerOrigin, type StartAnimation, type Stats, type StatsBuffer, type StatsRecording, type StatsSummary, type Step, type StepId, type Steps, type StyleKeyframesDefinition, type StyleTransitions, type Subscriber, type Summary, type TapHandlers, type TapInfo, type Target, type TargetAndTransition, type TargetResolver, type TimelineWithFallback, type TransformInputRange, type TransformOptions, type TransformOrigin, type TransformProperties, type TransformTemplate, type Transformer, type Transition, type TransitionWithValueOverrides, type Tween, type UnresolvedKeyframes, type UnresolvedValueKeyframe, type UseRenderState, type ValueAnimationOptions, type ValueAnimationOptionsWithRenderContext, type ValueAnimationTransition, type ValueAnimationWithDynamicDelay, type ValueIndexes, type ValueKeyframe, type ValueKeyframesDefinition, type ValueTransformer, type ValueTransition, type ValueType, type ValueTypeMap, type VariableKeyframesDefinition, type VariableTransitions, type Variant, type VariantLabels, type Variants, type VelocityOptions, type ViewTransitionAnimationDefinition, ViewTransitionBuilder, type ViewTransitionOptions, type ViewTransitionTarget, type ViewTransitionTargetDefinition, type ViewportEventHandler, type ViewportOptions, VisualElement, type VisualElementAnimationOptions, type VisualElementEventCallbacks, type VisualElementOptions, type VisualState, type WillChange, type WithAppearProps, type WithDepth, type WithQuerySelectorAll, acceleratedValues, activeAnimations, addAttrValue, addDomEvent, addScaleCorrector, addStyleValue, addValueToWillChange, alpha, analyseComplexValue, animateMotionValue, animateSingleValue, animateTarget, animateValue, animateVariant, animateView, animateVisualElement, animationMapKey, applyAxisDelta, applyBoxDelta, applyGeneratorOptions, applyPointDelta, applyPxDefaults, applyTreeDeltas, arc, aspectRatio, attachFollow, attachSpring, attrEffect, axisDeltaEquals, axisEquals, axisEqualsRounded, boxEquals, boxEqualsRounded, buildHTMLStyles, buildProjectionTransform, buildSVGAttrs, buildSVGPath, buildTransform, calcAxisDelta, calcBoxDelta, calcChildStagger, calcGeneratorDuration, calcLength, calcRelativeAxis, calcRelativeAxisPosition, calcRelativeBox, calcRelativePosition, camelCaseAttributes, camelToDash, cancelFrame, cancelMicrotask, cancelSync, checkVariantsDidChange, cleanDirtyNodes, collectMotionValues, color, compareByDepth, complex, containsCSSVariable, convertBoundingBoxToBox, convertBoxToBoundingBox, convertOffsetToTimes, copyAxisDeltaInto, copyAxisInto, copyBoxInto, correctBorderRadius, correctBoxShadow, createAnimationState, createAxis, createAxisDelta, createBox, createDelta, createGeneratorEasing, createProjectionNode, createRenderBatcher, cubicBezierAsString, defaultEasing, defaultOffset, defaultTransformValue, defaultValueTypes, degrees, delay, delayInSeconds, dimensionValueTypes, eachAxis, fillOffset, fillWildcards, findDimensionValueType, findValueType, flushKeyframeResolvers, followValue, frame, frameData, frameSteps, generateLinearEasing, getAnimatableNone, getAnimationMap, getComputedStyle, getDefaultTransition, getDefaultValueType, getFeatureDefinitions, getFinalKeyframe, getMixer, getOptimisedAppearId, getOriginIndex, getValueAsType, getValueTransition, getVariableValue, getVariantContext, getViewAnimationLayerInfo, getViewAnimations, globalProjectionState, has2DTranslate, hasReducedMotionListener, hasScale, hasTransform, hex, hover, hsla, hslaToRgba, inertia, initPrefersReducedMotion, interpolate, invisibleValues, isAnimationControls, isCSSVariableName, isCSSVariableToken, isControllingVariants, isDeltaZero, isDragActive, isDragging, isElementKeyboardAccessible, isElementTextInput, isForcedMotionValue, isGenerator, isHTMLElement, isKeyframesTarget, isMotionValue, isNear, isNodeOrChild, isPrimaryPointer, isSVGElement, isSVGSVGElement, isSVGTag, isTransitionDefined, isVariantLabel, isVariantNode, isWaapiSupportedEasing, isWillChangeMotionValue, keyframes, makeAnimationInstant, mapEasingToNativeEasing, mapValue, maxGeneratorDuration, measurePageBox, measureViewportBox, microtask, mix, mixArray, mixColor, mixComplex, mixImmediate, mixLinearColor, mixNumber, mixObject, mixValues, mixVisibility, motionValue, nodeGroup, number, numberValueTypes, observeTimeline, optimizedAppearDataAttribute, optimizedAppearDataId, parseAnimateLayoutArgs, parseCSSVariable, parseValueFromTransform, percent, pixelsToPercent, positionalKeys, prefersReducedMotion, press, progressPercentage, propEffect, propagateDirtyNodes, px, readTransformValue, recordStats, removeAxisDelta, removeAxisTransforms, removeBoxTransforms, removePointDelta, renderHTML, renderSVG, resize, resolveElements, resolveMotionValue, resolveTransition, resolveVariant, resolveVariantFromProps, rgbUnit, rgba, rootProjectionNode, scale, scaleCorrectors, scalePoint, scrapeMotionValuesFromProps$1 as scrapeHTMLMotionValuesFromProps, scrapeMotionValuesFromProps as scrapeSVGMotionValuesFromProps, setDragLock, setFeatureDefinitions, setStyle, setTarget, spring, springValue, stagger, startWaapiAnimation, statsBuffer, styleEffect, supportedWaapiEasing, supportsBrowserAnimation, supportsFlags, supportsLinearEasing, supportsPartialKeyframes, supportsScrollTimeline, supportsViewTimeline, svgEffect, sync, testValueType, time, transform, transformAxis, transformBox, transformBoxPoints, transformPropOrder, transformProps, transformValue, transformValueTypes, translateAxis, updateMotionValuesFromProps, variantPriorityOrder, variantProps, vh, visualElementStore, vw };