framer-motion 12.20.5 → 12.23.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.
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import * as motion_dom from 'motion-dom';
3
- import { AnyResolvedKeyframe, OnKeyframesResolved, KeyframeResolver, UnresolvedValueKeyframe, MotionValue, Transition, ElementOrSelector, DOMKeyframesDefinition, AnimationOptions, AnimationPlaybackOptions, AnimationScope, AnimationPlaybackControlsWithThen, ValueAnimationTransition, AnimationPlaybackControls, DynamicOption, EventInfo, MotionValueEventCallbacks, SpringOptions, TransformOptions, LegacyAnimationControls, AnimationDefinition } from 'motion-dom';
3
+ import { AnyResolvedKeyframe, OnKeyframesResolved, KeyframeResolver, UnresolvedValueKeyframe, MotionValue, Transition, ElementOrSelector, DOMKeyframesDefinition, AnimationOptions, AnimationPlaybackOptions, AnimationScope, AnimationPlaybackControlsWithThen, ValueAnimationTransition, AnimationPlaybackControls, EventInfo, MotionValueEventCallbacks, SpringOptions, TransformOptions, LegacyAnimationControls, AnimationDefinition } from 'motion-dom';
4
4
  export * from 'motion-dom';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import * as React$1 from 'react';
@@ -459,14 +459,6 @@ interface InViewOptions {
459
459
  }
460
460
  declare function inView(elementOrSelector: ElementOrSelector, onStart: (element: Element, entry: IntersectionObserverEntry) => void | ViewChangeHandler, { root, margin: rootMargin, amount }?: InViewOptions): VoidFunction;
461
461
 
462
- type StaggerOrigin = "first" | "last" | "center" | number;
463
- type StaggerOptions = {
464
- startDelay?: number;
465
- from?: StaggerOrigin;
466
- ease?: Easing;
467
- };
468
- declare function stagger(duration?: number, { startDelay, from, ease }?: StaggerOptions): DynamicOption<number>;
469
-
470
462
  type DelayedFunction = (overshoot: number) => void;
471
463
  /**
472
464
  * Timeout defined in ms
@@ -917,8 +909,18 @@ declare function usePresenceData(): any;
917
909
  declare function useDomEvent(ref: RefObject<EventTarget | null>, eventName: string, handler?: EventListener | undefined, options?: AddEventListenerOptions): void;
918
910
 
919
911
  interface DragControlOptions {
912
+ /**
913
+ * This distance after which dragging starts and a direction is locked in.
914
+ *
915
+ * @public
916
+ */
917
+ distanceThreshold?: number;
918
+ /**
919
+ * Whether to immediately snap to the cursor when dragging starts.
920
+ *
921
+ * @public
922
+ */
920
923
  snapToCursor?: boolean;
921
- cursorProgress?: Point;
922
924
  }
923
925
 
924
926
  /**
@@ -959,6 +961,26 @@ declare class DragControls {
959
961
  * @public
960
962
  */
961
963
  start(event: React$1.PointerEvent | PointerEvent, options?: DragControlOptions): void;
964
+ /**
965
+ * Cancels a drag gesture.
966
+ *
967
+ * ```jsx
968
+ * dragControls.cancel()
969
+ * ```
970
+ *
971
+ * @public
972
+ */
973
+ cancel(): void;
974
+ /**
975
+ * Stops a drag gesture.
976
+ *
977
+ * ```jsx
978
+ * dragControls.stop()
979
+ * ```
980
+ *
981
+ * @public
982
+ */
983
+ stop(): void;
962
984
  }
963
985
  /**
964
986
  * Usually, dragging is initiated by pressing down on a `motion` component with a `drag` prop
@@ -1155,4 +1177,4 @@ interface ScaleMotionValues {
1155
1177
  */
1156
1178
  declare function useInvertedScale(scale?: Partial<ScaleMotionValues>): ScaleMotionValues;
1157
1179
 
1158
- export { type AbsoluteKeyframe, AnimatePresence, type AnimatePresenceProps, AnimateSharedLayout, type AnimationSequence, type At, type Cycle, type CycleState, DOMMotionComponents, type DOMSegment, type DOMSegmentWithTransition, type DelayedFunction, DeprecatedLayoutGroupContext, DragControls, FeatureBundle, FeaturePackages, HTMLMotionProps, IProjectionNode, LayoutGroup, LayoutGroupContext, LazyMotion, type LazyProps, MotionConfig, MotionConfigContext, type MotionConfigProps, MotionContext, MotionProps, type MotionValueSegment, type MotionValueSegmentWithTransition, type ObjectSegment, type ObjectSegmentWithTransition, type ObjectTarget, namespace_d as Reorder, type ResolveKeyframes, type ResolvedAnimationDefinition, type ResolvedAnimationDefinitions, ResolvedValues, type ScrollMotionValues, type Segment, type SequenceLabel, type SequenceLabelWithTime, type SequenceMap, type SequenceOptions, type SequenceTime, type UseInViewOptions, type UseScrollOptions, type ValueSequence, VisualElement, WillChangeMotionValue, addPointerEvent, addPointerInfo, addScaleCorrector, animate, animateMini, animateVisualElement, animationControls, animations, buildTransform, calcLength, createBox, createScopedAnimate, delay, disableInstantTransitions, distance, distance2D, domAnimation, domMax, domMin, filterProps, inView, isBrowser, isMotionComponent, isValidMotionProp, m, motion, resolveMotionValue, scroll, scrollInfo, stagger, startOptimizedAppearAnimation, unwrapMotionComponent, useAnimate, useAnimateMini, useAnimation, useAnimationControls, useAnimationFrame, useCycle, useAnimatedState as useDeprecatedAnimatedState, useInvertedScale as useDeprecatedInvertedScale, useDomEvent, useDragControls, useElementScroll, useForceUpdate, useInView, useInstantLayoutTransition, useInstantTransition, useIsPresent, useIsomorphicLayoutEffect, useMotionTemplate, useMotionValue, useMotionValueEvent, usePageInView, usePresence, usePresenceData, useReducedMotion, useReducedMotionConfig, useResetProjection, useScroll, useSpring, useTime, useTransform, useUnmountEffect, useVelocity, useViewportScroll, useWillChange, visualElementStore };
1180
+ export { type AbsoluteKeyframe, AnimatePresence, type AnimatePresenceProps, AnimateSharedLayout, type AnimationSequence, type At, type Cycle, type CycleState, DOMMotionComponents, type DOMSegment, type DOMSegmentWithTransition, type DelayedFunction, DeprecatedLayoutGroupContext, DragControls, FeatureBundle, FeaturePackages, HTMLMotionProps, IProjectionNode, LayoutGroup, LayoutGroupContext, LazyMotion, type LazyProps, MotionConfig, MotionConfigContext, type MotionConfigProps, MotionContext, MotionProps, type MotionValueSegment, type MotionValueSegmentWithTransition, type ObjectSegment, type ObjectSegmentWithTransition, type ObjectTarget, namespace_d as Reorder, type ResolveKeyframes, type ResolvedAnimationDefinition, type ResolvedAnimationDefinitions, ResolvedValues, type ScrollMotionValues, type Segment, type SequenceLabel, type SequenceLabelWithTime, type SequenceMap, type SequenceOptions, type SequenceTime, type UseInViewOptions, type UseScrollOptions, type ValueSequence, VisualElement, WillChangeMotionValue, addPointerEvent, addPointerInfo, addScaleCorrector, animate, animateMini, animateVisualElement, animationControls, animations, buildTransform, calcLength, createBox, createScopedAnimate, delay, disableInstantTransitions, distance, distance2D, domAnimation, domMax, domMin, filterProps, inView, isBrowser, isMotionComponent, isValidMotionProp, m, motion, resolveMotionValue, scroll, scrollInfo, startOptimizedAppearAnimation, unwrapMotionComponent, useAnimate, useAnimateMini, useAnimation, useAnimationControls, useAnimationFrame, useCycle, useAnimatedState as useDeprecatedAnimatedState, useInvertedScale as useDeprecatedInvertedScale, useDomEvent, useDragControls, useElementScroll, useForceUpdate, useInView, useInstantLayoutTransition, useInstantTransition, useIsPresent, useIsomorphicLayoutEffect, useMotionTemplate, useMotionValue, useMotionValueEvent, usePageInView, usePresence, usePresenceData, useReducedMotion, useReducedMotionConfig, useResetProjection, useScroll, useSpring, useTime, useTransform, useUnmountEffect, useVelocity, useViewportScroll, useWillChange, visualElementStore };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "framer-motion",
3
- "version": "12.20.5",
3
+ "version": "12.23.0",
4
4
  "description": "A simple and powerful JavaScript animation library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/es/index.mjs",
@@ -87,7 +87,7 @@
87
87
  "measure": "rollup -c ./rollup.size.config.mjs"
88
88
  },
89
89
  "dependencies": {
90
- "motion-dom": "^12.20.5",
90
+ "motion-dom": "^12.22.0",
91
91
  "motion-utils": "^12.19.0",
92
92
  "tslib": "^2.4.0"
93
93
  },
@@ -142,5 +142,5 @@
142
142
  "maxSize": "2.26 kB"
143
143
  }
144
144
  ],
145
- "gitHead": "daec570fff6493dbd530e68bf3637055552797d7"
145
+ "gitHead": "a373936bc35696ea3f7335d58aaa6b0be71a1fb7"
146
146
  }
@@ -1,26 +0,0 @@
1
- import { easingDefinitionToFunction } from 'motion-utils';
2
-
3
- function getOriginIndex(from, total) {
4
- if (from === "first") {
5
- return 0;
6
- }
7
- else {
8
- const lastIndex = total - 1;
9
- return from === "last" ? lastIndex : lastIndex / 2;
10
- }
11
- }
12
- function stagger(duration = 0.1, { startDelay = 0, from = 0, ease } = {}) {
13
- return (i, total) => {
14
- const fromIndex = typeof from === "number" ? from : getOriginIndex(from, total);
15
- const distance = Math.abs(fromIndex - i);
16
- let delay = duration * distance;
17
- if (ease) {
18
- const maxDelay = total * duration;
19
- const easingFunction = easingDefinitionToFunction(ease);
20
- delay = easingFunction(delay / maxDelay) * maxDelay;
21
- }
22
- return startDelay + delay;
23
- };
24
- }
25
-
26
- export { getOriginIndex, stagger };