framer-motion 10.2.2 → 10.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -877,142 +877,58 @@ interface CustomValueType {
877
877
  toValue: () => number | string;
878
878
  }
879
879
 
880
- interface Animation$1<V> {
881
- next: (t: number) => {
882
- value: V;
883
- done: boolean;
884
- };
885
- flipTarget: () => void;
886
- }
887
- /**
888
- * An update function. It accepts a timestamp used to advance the animation.
889
- */
890
- declare type Update = (timestamp: number) => void;
891
880
  /**
892
- * Drivers accept a update function and call it at an interval. This interval
893
- * could be a synchronous loop, a setInterval, or tied to the device's framerate.
881
+ * @public
894
882
  */
895
- interface DriverControls {
896
- start: () => void;
883
+ interface AnimationPlaybackControls {
884
+ currentTime?: number | null;
897
885
  stop: () => void;
898
886
  }
899
- declare type Driver = (update: Update) => DriverControls;
900
-
901
- interface VelocityOptions {
902
- velocity?: number;
903
- restSpeed?: number;
904
- restDelta?: number;
905
- }
906
- interface AnimationLifecycleOptions<V> {
907
- onUpdate?: (v: V) => void;
908
- onComplete?: VoidFunction;
909
- onPlay?: VoidFunction;
910
- onRepeat?: VoidFunction;
911
- onStop?: VoidFunction;
912
- }
913
- interface AnimationPlaybackOptions {
914
- repeat?: number;
915
- repeatType?: "loop" | "reverse" | "mirror";
916
- repeatDelay?: number;
917
- }
918
- interface DurationSpringOptions {
919
- duration?: number;
920
- bounce?: number;
921
- }
922
- interface SpringOptions extends DurationSpringOptions, VelocityOptions {
923
- stiffness?: number;
924
- damping?: number;
925
- mass?: number;
926
- }
927
- interface DecayOptions extends VelocityOptions {
928
- keyframes?: number[];
929
- power?: number;
930
- timeConstant?: number;
931
- modifyTarget?: (v: number) => number;
932
- }
933
- interface InertiaOptions$1 extends DecayOptions {
934
- bounceStiffness?: number;
935
- bounceDamping?: number;
936
- min?: number;
937
- max?: number;
938
- }
939
- interface KeyframeOptions {
940
- ease?: Easing | Easing[];
941
- times?: number[];
942
- }
943
- interface AnimationOptions$2<V = any> extends AnimationLifecycleOptions<V>, AnimationPlaybackOptions, Omit<SpringOptions, "keyframes">, Omit<InertiaOptions$1, "keyframes">, KeyframeOptions {
944
- keyframes: V[];
945
- elapsed?: number;
946
- driver?: Driver;
947
- type?: "decay" | "spring" | "keyframes" | "tween";
948
- duration?: number;
949
- autoplay?: boolean;
950
- }
951
887
  /**
952
888
  * @public
953
889
  */
954
- declare type ControlsAnimationDefinition = string | string[] | TargetAndTransition | TargetResolver;
955
- interface PlaybackControls {
956
- stop: () => void;
957
- currentTime?: number;
890
+ interface AnimationPlaybackLifecycles<V> {
891
+ onUpdate?: (latest: V) => void;
892
+ onPlay?: () => void;
893
+ onComplete?: () => void;
894
+ onRepeat?: () => void;
895
+ onStop?: () => void;
958
896
  }
959
897
  /**
960
898
  * @public
961
899
  */
962
- interface AnimationControls {
963
- /**
964
- * Starts an animation on all linked components.
965
- *
966
- * @remarks
967
- *
968
- * ```jsx
969
- * controls.start("variantLabel")
970
- * controls.start({
971
- * x: 0,
972
- * transition: { duration: 1 }
973
- * })
974
- * ```
975
- *
976
- * @param definition - Properties or variant label to animate to
977
- * @param transition - Optional `transtion` to apply to a variant
978
- * @returns - A `Promise` that resolves when all animations have completed.
979
- *
980
- * @public
981
- */
982
- start(definition: ControlsAnimationDefinition, transitionOverride?: Transition): Promise<any>;
983
- /**
984
- * Instantly set to a set of properties or a variant.
985
- *
986
- * ```jsx
987
- * // With properties
988
- * controls.set({ opacity: 0 })
989
- *
990
- * // With variants
991
- * controls.set("hidden")
992
- * ```
993
- *
994
- * @privateRemarks
995
- * We could perform a similar trick to `.start` where this can be called before mount
996
- * and we maintain a list of of pending actions that get applied on mount. But the
997
- * expectation of `set` is that it happens synchronously and this would be difficult
998
- * to do before any children have even attached themselves. It's also poor practise
999
- * and we should discourage render-synchronous `.start` calls rather than lean into this.
1000
- *
1001
- * @public
1002
- */
1003
- set(definition: ControlsAnimationDefinition): void;
1004
- /**
1005
- * Stops animations on all linked components.
1006
- *
1007
- * ```jsx
1008
- * controls.stop()
1009
- * ```
1010
- *
1011
- * @public
1012
- */
1013
- stop(): void;
1014
- mount(): () => void;
1015
- }
900
+ declare type AnimationOptions$2<V> = (Tween | Spring) & AnimationPlaybackLifecycles<V> & {
901
+ delay?: number;
902
+ type?: "tween" | "spring";
903
+ };
904
+ /**
905
+ * Animate a single value or a `MotionValue`.
906
+ *
907
+ * The first argument is either a `MotionValue` to animate, or an initial animation value.
908
+ *
909
+ * The second is either a value to animate to, or an array of keyframes to animate through.
910
+ *
911
+ * The third argument can be either tween or spring options, and optional lifecycle methods: `onUpdate`, `onPlay`, `onComplete`, `onRepeat` and `onStop`.
912
+ *
913
+ * Returns `AnimationPlaybackControls`, currently just a `stop` method.
914
+ *
915
+ * ```javascript
916
+ * const x = useMotionValue(0)
917
+ *
918
+ * useEffect(() => {
919
+ * const controls = animate(x, 100, {
920
+ * type: "spring",
921
+ * stiffness: 2000,
922
+ * onComplete: v => {}
923
+ * })
924
+ *
925
+ * return controls.stop
926
+ * })
927
+ * ```
928
+ *
929
+ * @public
930
+ */
931
+ declare function animate<V>(from: MotionValue<V> | V, to: V | V[], transition?: AnimationOptions$2<V>): AnimationPlaybackControls;
1016
932
 
1017
933
  /**
1018
934
  * @public
@@ -1176,6 +1092,139 @@ declare class MotionValue<V = any> {
1176
1092
  }
1177
1093
  declare function motionValue<V>(init: V, options?: MotionValueOptions): MotionValue<V>;
1178
1094
 
1095
+ interface Animation$1<V> {
1096
+ next: (t: number) => {
1097
+ value: V;
1098
+ done: boolean;
1099
+ };
1100
+ flipTarget: () => void;
1101
+ }
1102
+ /**
1103
+ * An update function. It accepts a timestamp used to advance the animation.
1104
+ */
1105
+ declare type Update = (timestamp: number) => void;
1106
+ /**
1107
+ * Drivers accept a update function and call it at an interval. This interval
1108
+ * could be a synchronous loop, a setInterval, or tied to the device's framerate.
1109
+ */
1110
+ interface DriverControls {
1111
+ start: () => void;
1112
+ stop: () => void;
1113
+ }
1114
+ declare type Driver = (update: Update) => DriverControls;
1115
+
1116
+ interface VelocityOptions {
1117
+ velocity?: number;
1118
+ restSpeed?: number;
1119
+ restDelta?: number;
1120
+ }
1121
+ interface AnimationLifecycleOptions<V> {
1122
+ onUpdate?: (v: V) => void;
1123
+ onComplete?: VoidFunction;
1124
+ onPlay?: VoidFunction;
1125
+ onRepeat?: VoidFunction;
1126
+ onStop?: VoidFunction;
1127
+ }
1128
+ interface AnimationPlaybackOptions {
1129
+ repeat?: number;
1130
+ repeatType?: "loop" | "reverse" | "mirror";
1131
+ repeatDelay?: number;
1132
+ }
1133
+ interface DurationSpringOptions {
1134
+ duration?: number;
1135
+ bounce?: number;
1136
+ }
1137
+ interface SpringOptions extends DurationSpringOptions, VelocityOptions {
1138
+ stiffness?: number;
1139
+ damping?: number;
1140
+ mass?: number;
1141
+ }
1142
+ interface DecayOptions extends VelocityOptions {
1143
+ keyframes?: number[];
1144
+ power?: number;
1145
+ timeConstant?: number;
1146
+ modifyTarget?: (v: number) => number;
1147
+ }
1148
+ interface InertiaOptions$1 extends DecayOptions {
1149
+ bounceStiffness?: number;
1150
+ bounceDamping?: number;
1151
+ min?: number;
1152
+ max?: number;
1153
+ }
1154
+ interface KeyframeOptions {
1155
+ ease?: Easing | Easing[];
1156
+ times?: number[];
1157
+ }
1158
+ interface AnimationOptions$1<V = any> extends AnimationLifecycleOptions<V>, AnimationPlaybackOptions, Omit<SpringOptions, "keyframes">, Omit<InertiaOptions$1, "keyframes">, KeyframeOptions {
1159
+ keyframes: V[];
1160
+ elapsed?: number;
1161
+ driver?: Driver;
1162
+ type?: "decay" | "spring" | "keyframes" | "tween";
1163
+ duration?: number;
1164
+ autoplay?: boolean;
1165
+ }
1166
+ /**
1167
+ * @public
1168
+ */
1169
+ declare type ControlsAnimationDefinition = string | string[] | TargetAndTransition | TargetResolver;
1170
+ /**
1171
+ * @public
1172
+ */
1173
+ interface AnimationControls {
1174
+ /**
1175
+ * Starts an animation on all linked components.
1176
+ *
1177
+ * @remarks
1178
+ *
1179
+ * ```jsx
1180
+ * controls.start("variantLabel")
1181
+ * controls.start({
1182
+ * x: 0,
1183
+ * transition: { duration: 1 }
1184
+ * })
1185
+ * ```
1186
+ *
1187
+ * @param definition - Properties or variant label to animate to
1188
+ * @param transition - Optional `transtion` to apply to a variant
1189
+ * @returns - A `Promise` that resolves when all animations have completed.
1190
+ *
1191
+ * @public
1192
+ */
1193
+ start(definition: ControlsAnimationDefinition, transitionOverride?: Transition): Promise<any>;
1194
+ /**
1195
+ * Instantly set to a set of properties or a variant.
1196
+ *
1197
+ * ```jsx
1198
+ * // With properties
1199
+ * controls.set({ opacity: 0 })
1200
+ *
1201
+ * // With variants
1202
+ * controls.set("hidden")
1203
+ * ```
1204
+ *
1205
+ * @privateRemarks
1206
+ * We could perform a similar trick to `.start` where this can be called before mount
1207
+ * and we maintain a list of of pending actions that get applied on mount. But the
1208
+ * expectation of `set` is that it happens synchronously and this would be difficult
1209
+ * to do before any children have even attached themselves. It's also poor practise
1210
+ * and we should discourage render-synchronous `.start` calls rather than lean into this.
1211
+ *
1212
+ * @public
1213
+ */
1214
+ set(definition: ControlsAnimationDefinition): void;
1215
+ /**
1216
+ * Stops animations on all linked components.
1217
+ *
1218
+ * ```jsx
1219
+ * controls.stop()
1220
+ * ```
1221
+ *
1222
+ * @public
1223
+ */
1224
+ stop(): void;
1225
+ mount(): () => void;
1226
+ }
1227
+
1179
1228
  interface RefObject<T> {
1180
1229
  current: T | null;
1181
1230
  }
@@ -1346,59 +1395,6 @@ declare class NodeStack {
1346
1395
  removeLeadSnapshot(): void;
1347
1396
  }
1348
1397
 
1349
- /**
1350
- * @public
1351
- */
1352
- interface AnimationPlaybackControls {
1353
- stop: () => void;
1354
- isAnimating: () => boolean;
1355
- }
1356
- /**
1357
- * @public
1358
- */
1359
- interface AnimationPlaybackLifecycles<V> {
1360
- onUpdate?: (latest: V) => void;
1361
- onPlay?: () => void;
1362
- onComplete?: () => void;
1363
- onRepeat?: () => void;
1364
- onStop?: () => void;
1365
- }
1366
- /**
1367
- * @public
1368
- */
1369
- declare type AnimationOptions$1<V> = (Tween | Spring) & AnimationPlaybackLifecycles<V> & {
1370
- delay?: number;
1371
- type?: "tween" | "spring";
1372
- };
1373
- /**
1374
- * Animate a single value or a `MotionValue`.
1375
- *
1376
- * The first argument is either a `MotionValue` to animate, or an initial animation value.
1377
- *
1378
- * The second is either a value to animate to, or an array of keyframes to animate through.
1379
- *
1380
- * The third argument can be either tween or spring options, and optional lifecycle methods: `onUpdate`, `onPlay`, `onComplete`, `onRepeat` and `onStop`.
1381
- *
1382
- * Returns `AnimationPlaybackControls`, currently just a `stop` method.
1383
- *
1384
- * ```javascript
1385
- * const x = useMotionValue(0)
1386
- *
1387
- * useEffect(() => {
1388
- * const controls = animate(x, 100, {
1389
- * type: "spring",
1390
- * stiffness: 2000,
1391
- * onComplete: v => {}
1392
- * })
1393
- *
1394
- * return controls.stop
1395
- * })
1396
- * ```
1397
- *
1398
- * @public
1399
- */
1400
- declare function animate<V>(from: MotionValue<V> | V, to: V | V[], transition?: AnimationOptions$1<V>): AnimationPlaybackControls;
1401
-
1402
1398
  interface WithDepth {
1403
1399
  depth: number;
1404
1400
  }
@@ -1572,9 +1568,12 @@ declare function MeasureLayout(props: MotionProps & {
1572
1568
  visualElement: VisualElement;
1573
1569
  }): JSX.Element;
1574
1570
 
1571
+ interface FeatureClass<Props = unknown> {
1572
+ new (props: Props): Feature<Props>;
1573
+ }
1575
1574
  declare type HydratedFeatureDefinition = {
1576
1575
  isEnabled: (props: MotionProps) => boolean;
1577
- Feature: typeof Feature<unknown>;
1576
+ Feature: FeatureClass<unknown>;
1578
1577
  ProjectionNode?: any;
1579
1578
  MeasureLayout?: typeof MeasureLayout;
1580
1579
  };
@@ -4418,7 +4417,7 @@ declare function useResetProjection(): () => void;
4418
4417
  */
4419
4418
  declare function buildTransform(transform: HTMLRenderState["transform"], { enableHardwareAcceleration, allowTransformNone, }: DOMVisualElementOptions, transformIsDefault: boolean, transformTemplate?: MotionProps["transformTemplate"]): string;
4420
4419
 
4421
- declare function animateValue<V = number>({ duration, driver, elapsed, repeat: repeatMax, repeatType, repeatDelay, keyframes, autoplay, onPlay, onStop, onComplete, onRepeat, onUpdate, type, ...options }: AnimationOptions$2<V>): {
4420
+ declare function animateValue<V = number>({ duration, driver, elapsed, repeat: repeatMax, repeatType, repeatDelay, keyframes, autoplay, onPlay, onStop, onComplete, onRepeat, onUpdate, type, ...options }: AnimationOptions$1<V>): {
4422
4421
  stop: () => void;
4423
4422
  /**
4424
4423
  * Set the current time of the animation. This is purposefully
@@ -4453,7 +4452,7 @@ declare function animateValue<V = number>({ duration, driver, elapsed, repeat: r
4453
4452
  };
4454
4453
  };
4455
4454
 
4456
- declare function inertia({ keyframes, velocity, min, max, power, timeConstant, bounceStiffness, bounceDamping, restDelta, modifyTarget, driver, onUpdate, onComplete, onStop, }: AnimationOptions$2): {
4455
+ declare function inertia({ keyframes, velocity, min, max, power, timeConstant, bounceStiffness, bounceDamping, restDelta, modifyTarget, driver, onUpdate, onComplete, onStop, }: AnimationOptions$1): {
4457
4456
  stop: () => void;
4458
4457
  };
4459
4458
 
@@ -4519,7 +4518,7 @@ declare const optimizedAppearDataAttribute: string;
4519
4518
  /**
4520
4519
  * This is based on the spring implementation of Wobble https://github.com/skevy/wobble
4521
4520
  */
4522
- declare function spring({ keyframes, restDelta, restSpeed, ...options }: AnimationOptions$2<number>): Animation$1<number>;
4521
+ declare function spring({ keyframes, restDelta, restSpeed, ...options }: AnimationOptions$1<number>): Animation$1<number>;
4523
4522
  declare namespace spring {
4524
4523
  var needsInterpolation: (a: any, b: any) => boolean;
4525
4524
  }
@@ -4587,4 +4586,4 @@ declare function useInvertedScale(scale?: Partial<ScaleMotionValues>): ScaleMoti
4587
4586
 
4588
4587
  declare const AnimateSharedLayout: React$1.FunctionComponent<React$1.PropsWithChildren<unknown>>;
4589
4588
 
4590
- export { AnimatePresence, AnimatePresenceProps, AnimateSharedLayout, AnimationControls, AnimationLifecycleOptions, AnimationLifecycles, AnimationOptions$1 as AnimationOptions, AnimationPlaybackControls, AnimationPlaybackOptions, AnimationProps, AnimationType, Axis, AxisDelta, BezierDefinition, BoundingBox, Box, ControlsAnimationDefinition, CreateVisualElement, CustomDomComponent, CustomValueType, Cycle, CycleState, DecayOptions, DelayedFunction, Delta, DeprecatedLayoutGroupContext, DevMessage, DragControls, DragElastic, DragHandlers, DraggableProps, DurationSpringOptions, Easing, EasingDefinition, EasingFunction, EasingModifier, EventInfo, FeatureBundle, FeatureDefinition, FeatureDefinitions, FeaturePackage, FeaturePackages, FlatTree, FocusHandlers, ForwardRefComponent, HTMLMotionProps, HoverHandlers, HydratedFeatureDefinition, HydratedFeatureDefinitions, IProjectionNode, Inertia, InertiaOptions$1 as InertiaOptions, InterpolateOptions, KeyframeOptions, Keyframes, KeyframesTarget, LayoutGroup, LayoutGroupContext, LayoutProps, LazyFeatureBundle$1 as LazyFeatureBundle, LazyMotion, LazyProps, MixerFactory, MotionAdvancedProps, MotionConfig, MotionConfigContext, MotionConfigProps, MotionContext, MotionProps, MotionStyle, MotionTransform, MotionValue, None, Orchestration, PanHandlers, PanInfo, PassiveEffect, PlaybackControls, Point, PresenceContext, RelayoutInfo, RenderComponent, Reorder, Repeat, ResolveLayoutTransition, ResolvedKeyframesTarget, ResolvedSingleTarget, ResolvedValueTarget, ResolvedValues, SVGAttributesAsMotionValues, SVGMotionProps, ScrapeMotionValuesFromProps, ScrollMotionValues, SingleTarget, Spring, SpringOptions, Subscriber, SwitchLayoutGroupContext, TapHandlers, TapInfo, Target, TargetAndTransition, TransformPoint, Transition, Tween, ValueTarget, ValueType, Variant, VariantLabels, Variants, VelocityOptions, VisualElement, VisualState, addPointerEvent, addPointerInfo, addScaleCorrector, animate, animateValue, animateVisualElement, animationControls, animations, anticipate, backIn, backInOut, backOut, buildTransform, calcLength, checkTargetForNewValues, circIn, circInOut, circOut, clamp, color, complex, createBox, createDomMotionComponent, createMotionComponent, cubicBezier, delay, distance, distance2D, domAnimation, domMax, easeIn, easeInOut, easeOut, filterProps, frameData, inView, inertia, interpolate, invariant, isBrowser, isDragActive, isMotionComponent, isMotionValue, isValidMotionProp, m, makeUseVisualState, mix, motion, motionValue, optimizedAppearDataAttribute, pipe, progress, px, resolveMotionValue, scroll, spring, startOptimizedAppearAnimation, sync, transform, unwrapMotionComponent, useAnimation, useAnimationControls, useAnimationFrame, useCycle, useAnimatedState as useDeprecatedAnimatedState, useInvertedScale as useDeprecatedInvertedScale, useDomEvent, useDragControls, useElementScroll, useForceUpdate, useInView, useInstantLayoutTransition, useInstantTransition, useIsPresent, useIsomorphicLayoutEffect, useMotionTemplate, useMotionValue, useMotionValueEvent, usePresence, useReducedMotion, useReducedMotionConfig, useResetProjection, useScroll, useSpring, useTime, useTransform, useUnmountEffect, useVelocity, useViewportScroll, useWillChange, warning, wrap };
4589
+ export { AnimatePresence, AnimatePresenceProps, AnimateSharedLayout, AnimationControls, AnimationLifecycleOptions, AnimationLifecycles, AnimationOptions$2 as AnimationOptions, AnimationPlaybackControls, AnimationPlaybackOptions, AnimationProps, AnimationType, Axis, AxisDelta, BezierDefinition, BoundingBox, Box, ControlsAnimationDefinition, CreateVisualElement, CustomDomComponent, CustomValueType, Cycle, CycleState, DecayOptions, DelayedFunction, Delta, DeprecatedLayoutGroupContext, DevMessage, DragControls, DragElastic, DragHandlers, DraggableProps, DurationSpringOptions, Easing, EasingDefinition, EasingFunction, EasingModifier, EventInfo, FeatureBundle, FeatureDefinition, FeatureDefinitions, FeaturePackage, FeaturePackages, FlatTree, FocusHandlers, ForwardRefComponent, HTMLMotionProps, HoverHandlers, HydratedFeatureDefinition, HydratedFeatureDefinitions, IProjectionNode, Inertia, InertiaOptions$1 as InertiaOptions, InterpolateOptions, KeyframeOptions, Keyframes, KeyframesTarget, LayoutGroup, LayoutGroupContext, LayoutProps, LazyFeatureBundle$1 as LazyFeatureBundle, LazyMotion, LazyProps, MixerFactory, MotionAdvancedProps, MotionConfig, MotionConfigContext, MotionConfigProps, MotionContext, MotionProps, MotionStyle, MotionTransform, MotionValue, None, Orchestration, PanHandlers, PanInfo, PassiveEffect, Point, PresenceContext, RelayoutInfo, RenderComponent, Reorder, Repeat, ResolveLayoutTransition, ResolvedKeyframesTarget, ResolvedSingleTarget, ResolvedValueTarget, ResolvedValues, SVGAttributesAsMotionValues, SVGMotionProps, ScrapeMotionValuesFromProps, ScrollMotionValues, SingleTarget, Spring, SpringOptions, Subscriber, SwitchLayoutGroupContext, TapHandlers, TapInfo, Target, TargetAndTransition, TransformPoint, Transition, Tween, ValueTarget, ValueType, Variant, VariantLabels, Variants, VelocityOptions, VisualElement, VisualState, addPointerEvent, addPointerInfo, addScaleCorrector, animate, animateValue, animateVisualElement, animationControls, animations, anticipate, backIn, backInOut, backOut, buildTransform, calcLength, checkTargetForNewValues, circIn, circInOut, circOut, clamp, color, complex, createBox, createDomMotionComponent, createMotionComponent, cubicBezier, delay, distance, distance2D, domAnimation, domMax, easeIn, easeInOut, easeOut, filterProps, frameData, inView, inertia, interpolate, invariant, isBrowser, isDragActive, isMotionComponent, isMotionValue, isValidMotionProp, m, makeUseVisualState, mix, motion, motionValue, optimizedAppearDataAttribute, pipe, progress, px, resolveMotionValue, scroll, spring, startOptimizedAppearAnimation, sync, transform, unwrapMotionComponent, useAnimation, useAnimationControls, useAnimationFrame, useCycle, useAnimatedState as useDeprecatedAnimatedState, useInvertedScale as useDeprecatedInvertedScale, useDomEvent, useDragControls, useElementScroll, useForceUpdate, useInView, useInstantLayoutTransition, useInstantTransition, useIsPresent, useIsomorphicLayoutEffect, useMotionTemplate, useMotionValue, useMotionValueEvent, usePresence, useReducedMotion, useReducedMotionConfig, useResetProjection, useScroll, useSpring, useTime, useTransform, useUnmountEffect, useVelocity, useViewportScroll, useWillChange, warning, wrap };
@@ -1992,7 +1992,7 @@
1992
1992
  * This will be replaced by the build step with the latest version number.
1993
1993
  * When MotionValues are provided to motion components, warn if versions are mixed.
1994
1994
  */
1995
- this.version = "10.2.2";
1995
+ this.version = "10.2.3";
1996
1996
  /**
1997
1997
  * Duration, in milliseconds, since last updating frame.
1998
1998
  *
@@ -2329,7 +2329,6 @@
2329
2329
  value.start(createMotionValueAnimation("", value, to, transition));
2330
2330
  return {
2331
2331
  stop: () => value.stop(),
2332
- isAnimating: () => value.isAnimating(),
2333
2332
  };
2334
2333
  }
2335
2334
 
@@ -5185,7 +5184,7 @@
5185
5184
  * and warn against mismatches.
5186
5185
  */
5187
5186
  {
5188
- warnOnce(nextValue.version === "10.2.2", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.2.2 may not work as expected.`);
5187
+ warnOnce(nextValue.version === "10.2.3", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.2.3 may not work as expected.`);
5189
5188
  }
5190
5189
  }
5191
5190
  else if (isMotionValue(prevValue)) {
@@ -855,63 +855,9 @@ interface CustomValueType {
855
855
  /**
856
856
  * @public
857
857
  */
858
- declare type ControlsAnimationDefinition = string | string[] | TargetAndTransition | TargetResolver;
859
- /**
860
- * @public
861
- */
862
- interface AnimationControls {
863
- /**
864
- * Starts an animation on all linked components.
865
- *
866
- * @remarks
867
- *
868
- * ```jsx
869
- * controls.start("variantLabel")
870
- * controls.start({
871
- * x: 0,
872
- * transition: { duration: 1 }
873
- * })
874
- * ```
875
- *
876
- * @param definition - Properties or variant label to animate to
877
- * @param transition - Optional `transtion` to apply to a variant
878
- * @returns - A `Promise` that resolves when all animations have completed.
879
- *
880
- * @public
881
- */
882
- start(definition: ControlsAnimationDefinition, transitionOverride?: Transition): Promise<any>;
883
- /**
884
- * Instantly set to a set of properties or a variant.
885
- *
886
- * ```jsx
887
- * // With properties
888
- * controls.set({ opacity: 0 })
889
- *
890
- * // With variants
891
- * controls.set("hidden")
892
- * ```
893
- *
894
- * @privateRemarks
895
- * We could perform a similar trick to `.start` where this can be called before mount
896
- * and we maintain a list of of pending actions that get applied on mount. But the
897
- * expectation of `set` is that it happens synchronously and this would be difficult
898
- * to do before any children have even attached themselves. It's also poor practise
899
- * and we should discourage render-synchronous `.start` calls rather than lean into this.
900
- *
901
- * @public
902
- */
903
- set(definition: ControlsAnimationDefinition): void;
904
- /**
905
- * Stops animations on all linked components.
906
- *
907
- * ```jsx
908
- * controls.stop()
909
- * ```
910
- *
911
- * @public
912
- */
913
- stop(): void;
914
- mount(): () => void;
858
+ interface AnimationPlaybackControls {
859
+ currentTime?: number | null;
860
+ stop: () => void;
915
861
  }
916
862
 
917
863
  /**
@@ -1068,6 +1014,68 @@ declare class MotionValue<V = any> {
1068
1014
  destroy(): void;
1069
1015
  }
1070
1016
 
1017
+ /**
1018
+ * @public
1019
+ */
1020
+ declare type ControlsAnimationDefinition = string | string[] | TargetAndTransition | TargetResolver;
1021
+ /**
1022
+ * @public
1023
+ */
1024
+ interface AnimationControls {
1025
+ /**
1026
+ * Starts an animation on all linked components.
1027
+ *
1028
+ * @remarks
1029
+ *
1030
+ * ```jsx
1031
+ * controls.start("variantLabel")
1032
+ * controls.start({
1033
+ * x: 0,
1034
+ * transition: { duration: 1 }
1035
+ * })
1036
+ * ```
1037
+ *
1038
+ * @param definition - Properties or variant label to animate to
1039
+ * @param transition - Optional `transtion` to apply to a variant
1040
+ * @returns - A `Promise` that resolves when all animations have completed.
1041
+ *
1042
+ * @public
1043
+ */
1044
+ start(definition: ControlsAnimationDefinition, transitionOverride?: Transition): Promise<any>;
1045
+ /**
1046
+ * Instantly set to a set of properties or a variant.
1047
+ *
1048
+ * ```jsx
1049
+ * // With properties
1050
+ * controls.set({ opacity: 0 })
1051
+ *
1052
+ * // With variants
1053
+ * controls.set("hidden")
1054
+ * ```
1055
+ *
1056
+ * @privateRemarks
1057
+ * We could perform a similar trick to `.start` where this can be called before mount
1058
+ * and we maintain a list of of pending actions that get applied on mount. But the
1059
+ * expectation of `set` is that it happens synchronously and this would be difficult
1060
+ * to do before any children have even attached themselves. It's also poor practise
1061
+ * and we should discourage render-synchronous `.start` calls rather than lean into this.
1062
+ *
1063
+ * @public
1064
+ */
1065
+ set(definition: ControlsAnimationDefinition): void;
1066
+ /**
1067
+ * Stops animations on all linked components.
1068
+ *
1069
+ * ```jsx
1070
+ * controls.stop()
1071
+ * ```
1072
+ *
1073
+ * @public
1074
+ */
1075
+ stop(): void;
1076
+ mount(): () => void;
1077
+ }
1078
+
1071
1079
  interface RefObject<T> {
1072
1080
  current: T | null;
1073
1081
  }
@@ -1233,14 +1241,6 @@ declare class NodeStack {
1233
1241
  removeLeadSnapshot(): void;
1234
1242
  }
1235
1243
 
1236
- /**
1237
- * @public
1238
- */
1239
- interface AnimationPlaybackControls {
1240
- stop: () => void;
1241
- isAnimating: () => boolean;
1242
- }
1243
-
1244
1244
  interface WithDepth {
1245
1245
  depth: number;
1246
1246
  }
@@ -1414,9 +1414,12 @@ declare function MeasureLayout(props: MotionProps & {
1414
1414
  visualElement: VisualElement;
1415
1415
  }): JSX.Element;
1416
1416
 
1417
+ interface FeatureClass<Props = unknown> {
1418
+ new (props: Props): Feature<Props>;
1419
+ }
1417
1420
  declare type HydratedFeatureDefinition = {
1418
1421
  isEnabled: (props: MotionProps) => boolean;
1419
- Feature: typeof Feature<unknown>;
1422
+ Feature: FeatureClass<unknown>;
1420
1423
  ProjectionNode?: any;
1421
1424
  MeasureLayout?: typeof MeasureLayout;
1422
1425
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "framer-motion",
3
- "version": "10.2.2",
3
+ "version": "10.2.3",
4
4
  "description": "A simple and powerful React and JavaScript animation library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/es/index.mjs",
@@ -103,6 +103,10 @@
103
103
  "path": "./dist/size-rollup-animate.js",
104
104
  "maxSize": "10 kB"
105
105
  },
106
+ {
107
+ "path": "./dist/size-rollup-animate.js",
108
+ "maxSize": "10 kB"
109
+ },
106
110
  {
107
111
  "path": "./dist/size-webpack-m.js",
108
112
  "maxSize": "4.8 kB"
@@ -116,5 +120,5 @@
116
120
  "maxSize": "30.55 kB"
117
121
  }
118
122
  ],
119
- "gitHead": "daeddff03d931dba8ca04611b66b64b4f40b4736"
123
+ "gitHead": "6e3a7c75b2da8e6d3f083e05fd5a6499ee8210ad"
120
124
  }