framer-motion 6.4.3 → 7.0.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/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  import * as React$1 from 'react';
3
3
  import { RefObject, CSSProperties, SVGAttributes, ForwardRefExoticComponent, PropsWithoutRef, RefAttributes, ReactHTML, DetailedHTMLFactory, HTMLAttributes, useEffect } from 'react';
4
4
  import { Easing as Easing$1, SpringOptions } from 'popmotion';
5
- import { InViewOptions } from '@motionone/dom';
5
+ import { ScrollOptions, InViewOptions } from '@motionone/dom';
6
6
 
7
7
  /**
8
8
  * @public
@@ -3333,7 +3333,9 @@ declare const Reorder: {
3333
3333
  unselectable?: "off" | "on" | undefined;
3334
3334
  inputMode?: "none" | "text" | "search" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
3335
3335
  is?: string | undefined;
3336
- } & MotionProps & React$1.RefAttributes<any>>;
3336
+ } & MotionProps & {
3337
+ children?: React$1.ReactNode;
3338
+ } & React$1.RefAttributes<any>>;
3337
3339
  Item: React$1.ForwardRefExoticComponent<Props$1<unknown> & {
3338
3340
  color?: string | undefined;
3339
3341
  translate?: "no" | "yes" | undefined;
@@ -3586,7 +3588,9 @@ declare const Reorder: {
3586
3588
  unselectable?: "off" | "on" | undefined;
3587
3589
  inputMode?: "none" | "text" | "search" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
3588
3590
  is?: string | undefined;
3589
- } & MotionProps & React$1.RefAttributes<any>>;
3591
+ } & MotionProps & {
3592
+ children?: React$1.ReactNode;
3593
+ } & React$1.RefAttributes<any>>;
3590
3594
  };
3591
3595
 
3592
3596
  declare const animations: FeatureComponents;
@@ -3700,6 +3704,12 @@ interface TransformOptions<T> {
3700
3704
  * @public
3701
3705
  */
3702
3706
  ease?: Easing$1 | Easing$1[];
3707
+ /**
3708
+ * Provide a function that can interpolate between any two values in the provided range.
3709
+ *
3710
+ * @public
3711
+ */
3712
+ mixer?: (from: T, to: T) => (v: number) => any;
3703
3713
  }
3704
3714
  /**
3705
3715
  * Transforms numbers into other values by mapping them from an input range to an output range.
@@ -3894,64 +3904,36 @@ declare function useSpring(source: MotionValue | number, config?: SpringOptions)
3894
3904
  */
3895
3905
  declare function useVelocity(value: MotionValue<number>): MotionValue<number>;
3896
3906
 
3897
- /**
3898
- * @public
3899
- */
3900
- interface ScrollMotionValues {
3907
+ interface UseScrollOptions extends Omit<ScrollOptions, "container" | "target"> {
3908
+ container?: RefObject<HTMLElement>;
3909
+ target?: RefObject<HTMLElement>;
3910
+ }
3911
+ declare function useScroll({ container, target, ...options }?: UseScrollOptions): {
3901
3912
  scrollX: MotionValue<number>;
3902
3913
  scrollY: MotionValue<number>;
3903
3914
  scrollXProgress: MotionValue<number>;
3904
3915
  scrollYProgress: MotionValue<number>;
3905
- }
3916
+ };
3906
3917
 
3907
3918
  /**
3908
- * Returns MotionValues that update when the provided element scrolls:
3909
- *
3910
- * - `scrollX` — Horizontal scroll distance in pixels.
3911
- * - `scrollY` — Vertical scroll distance in pixels.
3912
- * - `scrollXProgress` — Horizontal scroll progress between `0` and `1`.
3913
- * - `scrollYProgress` — Vertical scroll progress between `0` and `1`.
3914
- *
3915
- * This element must be set to `overflow: scroll` on either or both axes to report scroll offset.
3916
- *
3917
- * ```jsx
3918
- * export const MyComponent = () => {
3919
- * const ref = useRef()
3920
- * const { scrollYProgress } = useElementScroll(ref)
3921
- *
3922
- * return (
3923
- * <div ref={ref}>
3924
- * <motion.div style={{ scaleX: scrollYProgress }} />
3925
- * </div>
3926
- * )
3927
- * }
3928
- * ```
3929
- *
3930
- * @public
3919
+ * @deprecated useElementScroll is deprecated. Convert to useScroll({ container: ref })
3931
3920
  */
3932
- declare function useElementScroll(ref: RefObject<HTMLElement>): ScrollMotionValues;
3921
+ declare function useElementScroll(ref: RefObject<HTMLElement>): {
3922
+ scrollX: MotionValue<number>;
3923
+ scrollY: MotionValue<number>;
3924
+ scrollXProgress: MotionValue<number>;
3925
+ scrollYProgress: MotionValue<number>;
3926
+ };
3933
3927
 
3934
3928
  /**
3935
- * Returns MotionValues that update when the viewport scrolls:
3936
- *
3937
- * - `scrollX` — Horizontal scroll distance in pixels.
3938
- * - `scrollY` — Vertical scroll distance in pixels.
3939
- * - `scrollXProgress` — Horizontal scroll progress between `0` and `1`.
3940
- * - `scrollYProgress` — Vertical scroll progress between `0` and `1`.
3941
- *
3942
- * **Warning:** Setting `body` or `html` to `height: 100%` or similar will break the `Progress`
3943
- * values as this breaks the browser's capability to accurately measure the page length.
3944
- *
3945
- * ```jsx
3946
- * export const MyComponent = () => {
3947
- * const { scrollYProgress } = useViewportScroll()
3948
- * return <motion.div style={{ scaleX: scrollYProgress }} />
3949
- * }
3950
- * ```
3951
- *
3952
- * @public
3929
+ * @deprecated useViewportScroll is deprecated. Convert to useScroll()
3953
3930
  */
3954
- declare function useViewportScroll(): ScrollMotionValues;
3931
+ declare function useViewportScroll(): {
3932
+ scrollX: MotionValue<number>;
3933
+ scrollY: MotionValue<number>;
3934
+ scrollXProgress: MotionValue<number>;
3935
+ scrollYProgress: MotionValue<number>;
3936
+ };
3955
3937
 
3956
3938
  declare function useTime(): MotionValue<number>;
3957
3939
 
@@ -4197,6 +4179,16 @@ declare const LayoutGroupContext: React$1.Context<LayoutGroupContextProps>;
4197
4179
  */
4198
4180
  declare const DeprecatedLayoutGroupContext: React$1.Context<string | null>;
4199
4181
 
4182
+ /**
4183
+ * @public
4184
+ */
4185
+ interface ScrollMotionValues {
4186
+ scrollX: MotionValue<number>;
4187
+ scrollY: MotionValue<number>;
4188
+ scrollXProgress: MotionValue<number>;
4189
+ scrollYProgress: MotionValue<number>;
4190
+ }
4191
+
4200
4192
  /**
4201
4193
  * This is not an officially supported API and may be removed
4202
4194
  * on any version.
@@ -4228,4 +4220,4 @@ interface ScaleMotionValues {
4228
4220
  */
4229
4221
  declare function useInvertedScale(scale?: Partial<ScaleMotionValues>): ScaleMotionValues;
4230
4222
 
4231
- export { AnimatePresence, AnimatePresenceProps, AnimateSharedLayout, AnimationControls, AnimationLifecycles, AnimationOptions, AnimationPlaybackControls, AnimationProps, AnimationType, Axis, AxisDelta, BoundingBox, Box, CreateVisualElement, CustomDomComponent, CustomValueType, Delta, DeprecatedLayoutGroupContext, DragControls, DragElastic, DragHandlers, DraggableProps, EasingFunction, EventInfo, FeatureBundle, FeatureComponent, FeatureComponents, FeatureDefinition, FeatureDefinitions, FeatureNames, FeatureProps, FlatTree, FocusHandlers, ForwardRefComponent, HTMLMotionProps, HoverHandlers, IProjectionNode, Inertia, Keyframes, KeyframesTarget, LayoutGroup, LayoutGroupContext, LayoutProps, LazyFeatureBundle$1 as LazyFeatureBundle, LazyMotion, LazyProps, LoadedFeatures, 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, Subscriber, SwitchLayoutGroupContext, TapHandlers, TapInfo, Target, TargetAndTransition, TransformPoint, Transition, Tween, ValueTarget, Variant, VariantLabels, Variants, VisualElement, VisualElementLifecycles, VisualState, addPointerEvent, addScaleCorrector, animate, animateVisualElement, animationControls, animations, calcLength, checkTargetForNewValues, createBox, createDomMotionComponent, createMotionComponent, domAnimation, domMax, filterProps, isBrowser, isDragActive, isMotionValue, isValidMotionProp, m, makeUseVisualState, motion, motionValue, resolveMotionValue, transform, useAnimation, useAnimationControls, useAnimationFrame, useCycle, useAnimatedState as useDeprecatedAnimatedState, useInvertedScale as useDeprecatedInvertedScale, useDomEvent, useDragControls, useElementScroll, useForceUpdate, useInView, useInstantLayoutTransition, useInstantTransition, useIsPresent, useIsomorphicLayoutEffect, useMotionTemplate, useMotionValue, usePresence, useReducedMotion, useReducedMotionConfig, useResetProjection, useSpring, useTime, useTransform, useUnmountEffect, useVelocity, useViewportScroll, useVisualElementContext, visualElement, wrapHandler };
4223
+ export { AnimatePresence, AnimatePresenceProps, AnimateSharedLayout, AnimationControls, AnimationLifecycles, AnimationOptions, AnimationPlaybackControls, AnimationProps, AnimationType, Axis, AxisDelta, BoundingBox, Box, CreateVisualElement, CustomDomComponent, CustomValueType, Delta, DeprecatedLayoutGroupContext, DragControls, DragElastic, DragHandlers, DraggableProps, EasingFunction, EventInfo, FeatureBundle, FeatureComponent, FeatureComponents, FeatureDefinition, FeatureDefinitions, FeatureNames, FeatureProps, FlatTree, FocusHandlers, ForwardRefComponent, HTMLMotionProps, HoverHandlers, IProjectionNode, Inertia, Keyframes, KeyframesTarget, LayoutGroup, LayoutGroupContext, LayoutProps, LazyFeatureBundle$1 as LazyFeatureBundle, LazyMotion, LazyProps, LoadedFeatures, 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, Subscriber, SwitchLayoutGroupContext, TapHandlers, TapInfo, Target, TargetAndTransition, TransformPoint, Transition, Tween, ValueTarget, Variant, VariantLabels, Variants, VisualElement, VisualElementLifecycles, VisualState, addPointerEvent, addScaleCorrector, animate, animateVisualElement, animationControls, animations, calcLength, checkTargetForNewValues, createBox, createDomMotionComponent, createMotionComponent, domAnimation, domMax, filterProps, isBrowser, isDragActive, isMotionValue, isValidMotionProp, m, makeUseVisualState, motion, motionValue, resolveMotionValue, transform, useAnimation, useAnimationControls, useAnimationFrame, useCycle, useAnimatedState as useDeprecatedAnimatedState, useInvertedScale as useDeprecatedInvertedScale, useDomEvent, useDragControls, useElementScroll, useForceUpdate, useInView, useInstantLayoutTransition, useInstantTransition, useIsPresent, useIsomorphicLayoutEffect, useMotionTemplate, useMotionValue, usePresence, useReducedMotion, useReducedMotionConfig, useResetProjection, useScroll, useSpring, useTime, useTransform, useUnmountEffect, useVelocity, useViewportScroll, useVisualElementContext, visualElement, wrapHandler };