framer-motion 10.3.4 → 10.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/dom-entry.js +1 -1
- package/dist/cjs/index.js +135 -1958
- package/dist/cjs/{wrap-196fd3c5.js → wrap-58c66ad3.js} +3790 -1847
- package/dist/dom-entry.d.ts +43 -34
- package/dist/es/animation/animate.mjs +38 -34
- package/dist/es/animation/{create-instant-animation.mjs → animators/instant.mjs} +5 -2
- package/dist/es/animation/{js → animators/js}/driver-frameloop.mjs +2 -2
- package/dist/es/animation/{js → animators/js}/index.mjs +10 -9
- package/dist/es/animation/{waapi → animators/waapi}/create-accelerated-animation.mjs +22 -3
- package/dist/es/animation/hooks/animation-controls.mjs +4 -1
- package/dist/es/animation/hooks/use-animated-state.mjs +1 -1
- package/dist/es/animation/{index.mjs → interfaces/motion-value.mjs} +12 -12
- package/dist/es/animation/interfaces/single-value.mjs +11 -0
- package/dist/es/animation/interfaces/visual-element-target.mjs +66 -0
- package/dist/es/animation/interfaces/visual-element-variant.mjs +63 -0
- package/dist/es/animation/interfaces/visual-element.mjs +24 -0
- package/dist/es/animation/optimized-appear/start.mjs +1 -1
- package/dist/es/animation/utils/create-visual-element.mjs +32 -0
- package/dist/es/animation/utils/is-dom-keyframes.mjs +5 -0
- package/dist/es/gestures/drag/VisualElementDragControls.mjs +2 -2
- package/dist/es/index.mjs +2 -2
- package/dist/es/projection/node/create-projection-node.mjs +5 -4
- package/dist/es/render/VisualElement.mjs +3 -0
- package/dist/es/render/dom/utils/is-svg-element.mjs +5 -0
- package/dist/es/render/store.mjs +3 -0
- package/dist/es/render/utils/animation-state.mjs +1 -1
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/utils/interpolate.mjs +6 -0
- package/dist/es/value/index.mjs +1 -1
- package/dist/es/value/use-spring.mjs +1 -1
- package/dist/framer-motion.dev.js +4948 -4872
- package/dist/framer-motion.js +1 -1
- package/dist/index.d.ts +57 -51
- package/dist/projection.dev.js +4982 -5008
- package/dist/three-entry.d.ts +6 -10
- package/package.json +5 -5
- package/dist/es/render/utils/animation.mjs +0 -145
- /package/dist/es/animation/{waapi → animators/waapi}/easing.mjs +0 -0
- /package/dist/es/animation/{waapi → animators/waapi}/index.mjs +0 -0
- /package/dist/es/animation/{waapi → animators/waapi}/supports.mjs +0 -0
- /package/dist/es/animation/{waapi → animators/waapi}/utils/get-final-keyframe.mjs +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -17,14 +17,15 @@ declare type EasingDefinition = BezierDefinition | "linear" | "easeIn" | "easeOu
|
|
|
17
17
|
*/
|
|
18
18
|
declare type Easing = EasingDefinition | EasingFunction;
|
|
19
19
|
|
|
20
|
+
declare type GenericKeyframesTarget<V> = [null, ...V[]] | V[];
|
|
20
21
|
/**
|
|
21
22
|
* @public
|
|
22
23
|
*/
|
|
23
|
-
declare type ResolvedKeyframesTarget =
|
|
24
|
+
declare type ResolvedKeyframesTarget = GenericKeyframesTarget<number> | GenericKeyframesTarget<string>;
|
|
24
25
|
/**
|
|
25
26
|
* @public
|
|
26
27
|
*/
|
|
27
|
-
declare type KeyframesTarget = ResolvedKeyframesTarget |
|
|
28
|
+
declare type KeyframesTarget = ResolvedKeyframesTarget | GenericKeyframesTarget<CustomValueType>;
|
|
28
29
|
/**
|
|
29
30
|
* @public
|
|
30
31
|
*/
|
|
@@ -892,6 +893,15 @@ interface DriverControls {
|
|
|
892
893
|
}
|
|
893
894
|
declare type Driver = (update: Update) => DriverControls;
|
|
894
895
|
|
|
896
|
+
interface AnimationPlaybackLifecycles<V> {
|
|
897
|
+
onUpdate?: (latest: V) => void;
|
|
898
|
+
onPlay?: () => void;
|
|
899
|
+
onComplete?: () => void;
|
|
900
|
+
onRepeat?: () => void;
|
|
901
|
+
onStop?: () => void;
|
|
902
|
+
}
|
|
903
|
+
declare type AnimateOptions<V = any> = Transition & AnimationPlaybackLifecycles<V>;
|
|
904
|
+
declare type ElementOrSelector$1 = Element | Element[] | NodeListOf<Element> | string;
|
|
895
905
|
/**
|
|
896
906
|
* @public
|
|
897
907
|
*/
|
|
@@ -902,6 +912,29 @@ interface AnimationPlaybackControls {
|
|
|
902
912
|
pause: () => void;
|
|
903
913
|
then: (onResolve: VoidFunction, onReject?: VoidFunction) => Promise<void>;
|
|
904
914
|
}
|
|
915
|
+
interface CSSStyleDeclarationWithTransform extends Omit<CSSStyleDeclaration, "direction" | "transition"> {
|
|
916
|
+
x: number | string;
|
|
917
|
+
y: number | string;
|
|
918
|
+
z: number | string;
|
|
919
|
+
rotateX: number | string;
|
|
920
|
+
rotateY: number | string;
|
|
921
|
+
rotateZ: number | string;
|
|
922
|
+
scaleX: number;
|
|
923
|
+
scaleY: number;
|
|
924
|
+
scaleZ: number;
|
|
925
|
+
skewX: number | string;
|
|
926
|
+
skewY: number | string;
|
|
927
|
+
}
|
|
928
|
+
declare type ValueKeyframe = string | number;
|
|
929
|
+
declare type UnresolvedValueKeyframe = ValueKeyframe | null;
|
|
930
|
+
declare type ValueKeyframesDefinition = ValueKeyframe | ValueKeyframe[] | UnresolvedValueKeyframe[];
|
|
931
|
+
declare type StyleKeyframesDefinition = {
|
|
932
|
+
[K in keyof CSSStyleDeclarationWithTransform]?: ValueKeyframesDefinition;
|
|
933
|
+
};
|
|
934
|
+
declare type VariableKeyframesDefinition = {
|
|
935
|
+
[key: `--${string}`]: ValueKeyframesDefinition;
|
|
936
|
+
};
|
|
937
|
+
declare type DOMKeyframesDefinition = StyleKeyframesDefinition & VariableKeyframesDefinition;
|
|
905
938
|
interface VelocityOptions {
|
|
906
939
|
velocity?: number;
|
|
907
940
|
restSpeed?: number;
|
|
@@ -944,7 +977,7 @@ interface KeyframeOptions {
|
|
|
944
977
|
ease?: Easing | Easing[];
|
|
945
978
|
times?: number[];
|
|
946
979
|
}
|
|
947
|
-
interface AnimationOptions
|
|
980
|
+
interface AnimationOptions<V = any> extends AnimationLifecycleOptions<V>, AnimationPlaybackOptions, Omit<SpringOptions, "keyframes">, Omit<InertiaOptions$1, "keyframes">, KeyframeOptions {
|
|
948
981
|
delay?: number;
|
|
949
982
|
keyframes: V[];
|
|
950
983
|
elapsed?: number;
|
|
@@ -953,10 +986,7 @@ interface AnimationOptions$1<V = any> extends AnimationLifecycleOptions<V>, Anim
|
|
|
953
986
|
duration?: number;
|
|
954
987
|
autoplay?: boolean;
|
|
955
988
|
}
|
|
956
|
-
|
|
957
|
-
* @public
|
|
958
|
-
*/
|
|
959
|
-
declare type ControlsAnimationDefinition = string | string[] | TargetAndTransition | TargetResolver;
|
|
989
|
+
declare type AnimationDefinition = VariantLabels | TargetAndTransition | TargetResolver;
|
|
960
990
|
/**
|
|
961
991
|
* @public
|
|
962
992
|
*/
|
|
@@ -980,7 +1010,7 @@ interface AnimationControls {
|
|
|
980
1010
|
*
|
|
981
1011
|
* @public
|
|
982
1012
|
*/
|
|
983
|
-
start(definition:
|
|
1013
|
+
start(definition: AnimationDefinition, transitionOverride?: Transition): Promise<any>;
|
|
984
1014
|
/**
|
|
985
1015
|
* Instantly set to a set of properties or a variant.
|
|
986
1016
|
*
|
|
@@ -1001,7 +1031,7 @@ interface AnimationControls {
|
|
|
1001
1031
|
*
|
|
1002
1032
|
* @public
|
|
1003
1033
|
*/
|
|
1004
|
-
set(definition:
|
|
1034
|
+
set(definition: AnimationDefinition): void;
|
|
1005
1035
|
/**
|
|
1006
1036
|
* Stops animations on all linked components.
|
|
1007
1037
|
*
|
|
@@ -1566,18 +1596,16 @@ declare type RenderComponent<Instance, RenderState> = (Component: string | React
|
|
|
1566
1596
|
|
|
1567
1597
|
declare type AnimationType = "animate" | "whileHover" | "whileTap" | "whileDrag" | "whileFocus" | "whileInView" | "exit";
|
|
1568
1598
|
|
|
1569
|
-
declare type
|
|
1570
|
-
declare type AnimationOptions = {
|
|
1599
|
+
declare type VisualElementAnimationOptions = {
|
|
1571
1600
|
delay?: number;
|
|
1572
1601
|
transitionOverride?: Transition;
|
|
1573
1602
|
custom?: any;
|
|
1574
1603
|
type?: AnimationType;
|
|
1575
1604
|
};
|
|
1576
|
-
declare function animateVisualElement(visualElement: VisualElement, definition: AnimationDefinition, options?: AnimationOptions): Promise<void>;
|
|
1577
1605
|
|
|
1578
1606
|
interface AnimationState$1 {
|
|
1579
|
-
animateChanges: (options?:
|
|
1580
|
-
setActive: (type: AnimationType, isActive: boolean, options?:
|
|
1607
|
+
animateChanges: (options?: VisualElementAnimationOptions, type?: AnimationType) => Promise<any>;
|
|
1608
|
+
setActive: (type: AnimationType, isActive: boolean, options?: VisualElementAnimationOptions) => Promise<any>;
|
|
1581
1609
|
setAnimateFunction: (fn: any) => void;
|
|
1582
1610
|
getState: () => {
|
|
1583
1611
|
[key: string]: AnimationTypeState;
|
|
@@ -3669,43 +3697,19 @@ declare const Reorder: {
|
|
|
3669
3697
|
};
|
|
3670
3698
|
|
|
3671
3699
|
/**
|
|
3672
|
-
*
|
|
3700
|
+
* Animate a single value
|
|
3673
3701
|
*/
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
onPlay?: () => void;
|
|
3677
|
-
onComplete?: () => void;
|
|
3678
|
-
onRepeat?: () => void;
|
|
3679
|
-
onStop?: () => void;
|
|
3680
|
-
}
|
|
3702
|
+
declare function animate(from: string, to: string | GenericKeyframesTarget<string>, options?: AnimateOptions<string>): AnimationPlaybackControls;
|
|
3703
|
+
declare function animate(from: number, to: number | GenericKeyframesTarget<number>, options?: AnimateOptions<number>): AnimationPlaybackControls;
|
|
3681
3704
|
/**
|
|
3682
|
-
* Animate a
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
*
|
|
3688
|
-
* The third argument can be either tween or spring options, and optional lifecycle methods: `onUpdate`, `onPlay`, `onComplete`, `onRepeat` and `onStop`.
|
|
3689
|
-
*
|
|
3690
|
-
* Returns `AnimationPlaybackControls`, currently just a `stop` method.
|
|
3691
|
-
*
|
|
3692
|
-
* ```javascript
|
|
3693
|
-
* const x = useMotionValue(0)
|
|
3694
|
-
*
|
|
3695
|
-
* useEffect(() => {
|
|
3696
|
-
* const controls = animate(x, 100, {
|
|
3697
|
-
* type: "spring",
|
|
3698
|
-
* stiffness: 2000,
|
|
3699
|
-
* onComplete: v => {}
|
|
3700
|
-
* })
|
|
3701
|
-
*
|
|
3702
|
-
* return controls.stop
|
|
3703
|
-
* })
|
|
3704
|
-
* ```
|
|
3705
|
-
*
|
|
3706
|
-
* @public
|
|
3705
|
+
* Animate a MotionValue
|
|
3706
|
+
*/
|
|
3707
|
+
declare function animate(value: MotionValue<string>, keyframes: string | GenericKeyframesTarget<string>, options?: AnimateOptions<string>): AnimationPlaybackControls;
|
|
3708
|
+
declare function animate(value: MotionValue<number>, keyframes: number | GenericKeyframesTarget<number>, options?: AnimateOptions<number>): AnimationPlaybackControls;
|
|
3709
|
+
/**
|
|
3710
|
+
* Animate DOM
|
|
3707
3711
|
*/
|
|
3708
|
-
declare function animate<V>(
|
|
3712
|
+
declare function animate<V>(value: ElementOrSelector$1, keyframes: DOMKeyframesDefinition, options?: AnimateOptions<V>): AnimationPlaybackControls;
|
|
3709
3713
|
|
|
3710
3714
|
interface AxisScrollInfo {
|
|
3711
3715
|
current: number;
|
|
@@ -4252,6 +4256,8 @@ declare const useAnimation: typeof useAnimationControls;
|
|
|
4252
4256
|
declare type FrameCallback = (timestamp: number, delta: number) => void;
|
|
4253
4257
|
declare function useAnimationFrame(callback: FrameCallback): void;
|
|
4254
4258
|
|
|
4259
|
+
declare function animateVisualElement(visualElement: VisualElement, definition: AnimationDefinition, options?: VisualElementAnimationOptions): Promise<void>;
|
|
4260
|
+
|
|
4255
4261
|
declare type Cycle = (i?: number) => void;
|
|
4256
4262
|
declare type CycleState<T> = [T, Cycle];
|
|
4257
4263
|
/**
|
|
@@ -4422,7 +4428,7 @@ interface KeyframeGenerator<V> {
|
|
|
4422
4428
|
interface MainThreadAnimationControls<V> extends AnimationPlaybackControls {
|
|
4423
4429
|
sample: (t: number) => AnimationState<V>;
|
|
4424
4430
|
}
|
|
4425
|
-
declare function animateValue<V = number>({ autoplay, delay, driver, keyframes, type, repeat, repeatDelay, repeatType, onPlay, onStop, onComplete, onUpdate, ...options }: AnimationOptions
|
|
4431
|
+
declare function animateValue<V = number>({ autoplay, delay, driver, keyframes, type, repeat, repeatDelay, repeatType, onPlay, onStop, onComplete, onUpdate, ...options }: AnimationOptions<V>): MainThreadAnimationControls<V>;
|
|
4426
4432
|
|
|
4427
4433
|
declare type Transformer = (v: any) => any;
|
|
4428
4434
|
declare type ValueType = {
|
|
@@ -4483,7 +4489,7 @@ declare function startOptimizedAppearAnimation(element: HTMLElement, name: strin
|
|
|
4483
4489
|
|
|
4484
4490
|
declare const optimizedAppearDataAttribute: string;
|
|
4485
4491
|
|
|
4486
|
-
declare function spring({ keyframes, restDelta, restSpeed, ...options }: AnimationOptions
|
|
4492
|
+
declare function spring({ keyframes, restDelta, restSpeed, ...options }: AnimationOptions<number>): KeyframeGenerator<number>;
|
|
4487
4493
|
|
|
4488
4494
|
interface NodeGroup {
|
|
4489
4495
|
add: (node: IProjectionNode) => void;
|
|
@@ -4548,4 +4554,4 @@ declare function useInvertedScale(scale?: Partial<ScaleMotionValues>): ScaleMoti
|
|
|
4548
4554
|
|
|
4549
4555
|
declare const AnimateSharedLayout: React$1.FunctionComponent<React$1.PropsWithChildren<unknown>>;
|
|
4550
4556
|
|
|
4551
|
-
export { AnimatePresence, AnimatePresenceProps, AnimateSharedLayout, AnimationControls, AnimationLifecycleOptions, AnimationLifecycles, AnimationOptions
|
|
4557
|
+
export { AnimateOptions, AnimatePresence, AnimatePresenceProps, AnimateSharedLayout, AnimationControls, AnimationDefinition, AnimationLifecycleOptions, AnimationLifecycles, AnimationOptions, AnimationPlaybackControls, AnimationPlaybackLifecycles, AnimationPlaybackOptions, AnimationProps, AnimationType, Axis, AxisDelta, BezierDefinition, BoundingBox, Box, CSSStyleDeclarationWithTransform, CreateVisualElement, CustomDomComponent, CustomValueType, Cycle, CycleState, DOMKeyframesDefinition, DecayOptions, DelayedFunction, Delta, DeprecatedLayoutGroupContext, DevMessage, DragControls, DragElastic, DragHandlers, DraggableProps, DurationSpringOptions, Easing, EasingDefinition, EasingFunction, EasingModifier, ElementOrSelector$1 as ElementOrSelector, 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, StyleKeyframesDefinition, Subscriber, SwitchLayoutGroupContext, TapHandlers, TapInfo, Target, TargetAndTransition, TransformPoint, Transition, Tween, UnresolvedValueKeyframe, ValueKeyframe, ValueKeyframesDefinition, ValueTarget, ValueType, VariableKeyframesDefinition, 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, 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 };
|