motion 11.13.0-beta.0 → 11.13.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 (52) hide show
  1. package/.turbo/turbo-build.log +45 -45
  2. package/dist/cjs/index.js +15 -31
  3. package/dist/cjs/react-client.js +123 -85
  4. package/dist/es/framer-motion/dist/es/animation/animate/resolve-subjects.mjs +1 -1
  5. package/dist/es/framer-motion/dist/es/animation/animate/subject.mjs +1 -1
  6. package/dist/es/framer-motion/dist/es/animation/animators/AcceleratedAnimation.mjs +2 -2
  7. package/dist/es/framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs +1 -1
  8. package/dist/es/framer-motion/dist/es/animation/animators/utils/can-animate.mjs +1 -1
  9. package/dist/es/framer-motion/dist/es/animation/animators/waapi/NativeAnimation.mjs +2 -2
  10. package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +2 -2
  11. package/dist/es/framer-motion/dist/es/animation/generators/spring/find.mjs +1 -1
  12. package/dist/es/framer-motion/dist/es/animation/hooks/animation-controls.mjs +1 -1
  13. package/dist/es/framer-motion/dist/es/animation/optimized-appear/start.mjs +2 -2
  14. package/dist/es/framer-motion/dist/es/components/AnimatePresence/index.mjs +1 -1
  15. package/dist/es/framer-motion/dist/es/components/AnimateSharedLayout.mjs +1 -1
  16. package/dist/es/framer-motion/dist/es/components/Reorder/Group.mjs +1 -1
  17. package/dist/es/framer-motion/dist/es/components/Reorder/Item.mjs +1 -1
  18. package/dist/es/framer-motion/dist/es/easing/cubic-bezier.mjs +2 -2
  19. package/dist/es/framer-motion/dist/es/easing/utils/map.mjs +2 -2
  20. package/dist/es/framer-motion/dist/es/frameloop/frame.mjs +2 -2
  21. package/dist/es/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs +11 -14
  22. package/dist/es/framer-motion/dist/es/gestures/drag/index.mjs +2 -2
  23. package/dist/es/framer-motion/dist/es/gestures/hover.mjs +18 -22
  24. package/dist/es/framer-motion/dist/es/gestures/pan/index.mjs +2 -2
  25. package/dist/es/framer-motion/dist/es/gestures/press.mjs +3 -3
  26. package/dist/es/framer-motion/dist/es/motion/index.mjs +1 -1
  27. package/dist/es/framer-motion/dist/es/projection/animation/mix-values.mjs +2 -2
  28. package/dist/es/framer-motion/dist/es/projection/node/create-projection-node.mjs +2 -2
  29. package/dist/es/framer-motion/dist/es/render/dom/resize/handle-element.mjs +1 -1
  30. package/dist/es/framer-motion/dist/es/render/dom/scroll/index.mjs +2 -2
  31. package/dist/es/framer-motion/dist/es/render/dom/utils/css-variables-conversion.mjs +1 -1
  32. package/dist/es/framer-motion/dist/es/render/dom/viewport/index.mjs +1 -1
  33. package/dist/es/framer-motion/dist/es/render/utils/motion-values.mjs +1 -1
  34. package/dist/es/framer-motion/dist/es/utils/interpolate.mjs +2 -2
  35. package/dist/es/framer-motion/dist/es/utils/mix/color.mjs +1 -1
  36. package/dist/es/framer-motion/dist/es/utils/mix/complex.mjs +1 -1
  37. package/dist/es/framer-motion/dist/es/value/index.mjs +1 -1
  38. package/dist/es/framer-motion/dist/es/value/use-inverted-scale.mjs +1 -1
  39. package/dist/es/framer-motion/dist/es/value/use-scroll.mjs +1 -1
  40. package/dist/es/motion/lib/index.mjs +3 -4
  41. package/dist/es/motion/lib/react.mjs +3 -5
  42. package/dist/es/motion-dom/dist/es/gestures/drag/state/is-active.mjs +9 -0
  43. package/dist/es/motion-dom/dist/es/gestures/drag/state/set-active.mjs +28 -0
  44. package/dist/es/motion-dom/dist/es/gestures/hover.mjs +46 -0
  45. package/dist/motion.dev.js +15 -31
  46. package/dist/motion.js +1 -1
  47. package/package.json +3 -3
  48. package/dist/es/dom/dist/es/gestures/hover.mjs +0 -26
  49. package/dist/es/framer-motion/dist/es/gestures/drag/utils/lock.mjs +0 -53
  50. /package/dist/es/{dom → motion-dom}/dist/es/utils/resolve-elements.mjs +0 -0
  51. /package/dist/es/{utils → motion-utils}/dist/es/errors.mjs +0 -0
  52. /package/dist/es/{utils → motion-utils}/dist/es/noop.mjs +0 -0
@@ -1,6 +1,6 @@
1
- import { invariant } from '../../../../../utils/dist/es/errors.mjs';
1
+ import { invariant } from '../../../../../motion-utils/dist/es/errors.mjs';
2
+ import { setDragLock } from '../../../../../motion-dom/dist/es/gestures/drag/state/set-active.mjs';
2
3
  import { PanSession } from '../pan/PanSession.mjs';
3
- import { getGlobalLock } from './utils/lock.mjs';
4
4
  import { isRefObject } from '../../utils/is-ref-object.mjs';
5
5
  import { addPointerEvent } from '../../events/add-pointer-event.mjs';
6
6
  import { applyConstraints, calcRelativeConstraints, resolveDragElastic, calcViewportConstraints, rebaseAxisConstraints, calcOrigin, defaultElastic } from './utils/constraints.mjs';
@@ -25,10 +25,7 @@ const elementDragControls = new WeakMap();
25
25
  // let latestPointerEvent: PointerEvent
26
26
  class VisualElementDragControls {
27
27
  constructor(visualElement) {
28
- // This is a reference to the global drag gesture lock, ensuring only one component
29
- // can "capture" the drag of one or both axes.
30
- // TODO: Look into moving this into pansession?
31
- this.openGlobalLock = null;
28
+ this.openDragLock = null;
32
29
  this.isDragging = false;
33
30
  this.currentDirection = null;
34
31
  this.originPoint = { x: 0, y: 0 };
@@ -63,11 +60,11 @@ class VisualElementDragControls {
63
60
  // Attempt to grab the global drag gesture lock - maybe make this part of PanSession
64
61
  const { drag, dragPropagation, onDragStart } = this.getProps();
65
62
  if (drag && !dragPropagation) {
66
- if (this.openGlobalLock)
67
- this.openGlobalLock();
68
- this.openGlobalLock = getGlobalLock(drag);
63
+ if (this.openDragLock)
64
+ this.openDragLock();
65
+ this.openDragLock = setDragLock(drag);
69
66
  // If we don 't have the lock, don't start dragging
70
- if (!this.openGlobalLock)
67
+ if (!this.openDragLock)
71
68
  return;
72
69
  }
73
70
  this.isDragging = true;
@@ -109,7 +106,7 @@ class VisualElementDragControls {
109
106
  // latestPointerEvent = event
110
107
  const { dragPropagation, dragDirectionLock, onDirectionLock, onDrag, } = this.getProps();
111
108
  // If we didn't successfully receive the gesture lock, early return.
112
- if (!dragPropagation && !this.openGlobalLock)
109
+ if (!dragPropagation && !this.openDragLock)
113
110
  return;
114
111
  const { offset } = info;
115
112
  // Attempt to detect drag direction if directionLock is true
@@ -177,9 +174,9 @@ class VisualElementDragControls {
177
174
  this.panSession && this.panSession.end();
178
175
  this.panSession = undefined;
179
176
  const { dragPropagation } = this.getProps();
180
- if (!dragPropagation && this.openGlobalLock) {
181
- this.openGlobalLock();
182
- this.openGlobalLock = null;
177
+ if (!dragPropagation && this.openDragLock) {
178
+ this.openDragLock();
179
+ this.openDragLock = null;
183
180
  }
184
181
  animationState && animationState.setActive("whileDrag", false);
185
182
  }
@@ -1,6 +1,6 @@
1
1
  import { Feature } from '../../motion/features/Feature.mjs';
2
- import '../../../../../utils/dist/es/errors.mjs';
3
- import { noop } from '../../../../../utils/dist/es/noop.mjs';
2
+ import '../../../../../motion-utils/dist/es/errors.mjs';
3
+ import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
4
4
  import { VisualElementDragControls } from './VisualElementDragControls.mjs';
5
5
 
6
6
  class DragGesture extends Feature {
@@ -1,31 +1,27 @@
1
- import { addPointerEvent } from '../events/add-pointer-event.mjs';
2
- import { pipe } from '../utils/pipe.mjs';
3
- import { isDragActive } from './drag/utils/lock.mjs';
4
1
  import { Feature } from '../motion/features/Feature.mjs';
2
+ import { hover } from '../../../../motion-dom/dist/es/gestures/hover.mjs';
3
+ import { extractEventInfo } from '../events/event-info.mjs';
5
4
  import { frame } from '../frameloop/frame.mjs';
6
5
 
7
- function addHoverEvent(node, isActive) {
8
- const eventName = isActive ? "pointerenter" : "pointerleave";
9
- const callbackName = isActive ? "onHoverStart" : "onHoverEnd";
10
- const handleEvent = (event, info) => {
11
- if (event.pointerType === "touch" || isDragActive())
12
- return;
13
- const props = node.getProps();
14
- if (node.animationState && props.whileHover) {
15
- node.animationState.setActive("whileHover", isActive);
16
- }
17
- const callback = props[callbackName];
18
- if (callback) {
19
- frame.postRender(() => callback(event, info));
20
- }
21
- };
22
- return addPointerEvent(node.current, eventName, handleEvent, {
23
- passive: !node.getProps()[callbackName],
24
- });
6
+ function handleHoverEvent(node, event, isActive) {
7
+ const { props } = node;
8
+ if (node.animationState && props.whileHover) {
9
+ node.animationState.setActive("whileHover", isActive);
10
+ }
11
+ const callback = props[isActive ? "onHoverStart" : "onHoverEnd"];
12
+ if (callback) {
13
+ frame.postRender(() => callback(event, extractEventInfo(event)));
14
+ }
25
15
  }
26
16
  class HoverGesture extends Feature {
27
17
  mount() {
28
- this.unmount = pipe(addHoverEvent(this.node, true), addHoverEvent(this.node, false));
18
+ const { current, props } = this.node;
19
+ if (!current)
20
+ return;
21
+ this.unmount = hover(current, (startEvent) => {
22
+ handleHoverEvent(this.node, startEvent, true);
23
+ return (endEvent) => handleHoverEvent(this.node, endEvent, false);
24
+ }, { passive: !props.onHoverStart && !props.onHoverEnd });
29
25
  }
30
26
  unmount() { }
31
27
  }
@@ -1,8 +1,8 @@
1
1
  import { PanSession } from './PanSession.mjs';
2
2
  import { addPointerEvent } from '../../events/add-pointer-event.mjs';
3
3
  import { Feature } from '../../motion/features/Feature.mjs';
4
- import '../../../../../utils/dist/es/errors.mjs';
5
- import { noop } from '../../../../../utils/dist/es/noop.mjs';
4
+ import '../../../../../motion-utils/dist/es/errors.mjs';
5
+ import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
6
6
  import { getContextWindow } from '../../utils/get-context-window.mjs';
7
7
  import { frame } from '../../frameloop/frame.mjs';
8
8
 
@@ -3,10 +3,10 @@ import { addDomEvent } from '../events/add-dom-event.mjs';
3
3
  import { addPointerEvent } from '../events/add-pointer-event.mjs';
4
4
  import { Feature } from '../motion/features/Feature.mjs';
5
5
  import { pipe } from '../utils/pipe.mjs';
6
- import { isDragActive } from './drag/utils/lock.mjs';
6
+ import { isDragActive } from '../../../../motion-dom/dist/es/gestures/drag/state/is-active.mjs';
7
7
  import { isNodeOrChild } from './utils/is-node-or-child.mjs';
8
- import '../../../../utils/dist/es/errors.mjs';
9
- import { noop } from '../../../../utils/dist/es/noop.mjs';
8
+ import '../../../../motion-utils/dist/es/errors.mjs';
9
+ import { noop } from '../../../../motion-utils/dist/es/noop.mjs';
10
10
  import { frame } from '../frameloop/frame.mjs';
11
11
 
12
12
  function fireSyntheticPointerEvent(name, handler) {
@@ -11,7 +11,7 @@ import { isBrowser } from '../utils/is-browser.mjs';
11
11
  import { LayoutGroupContext } from '../context/LayoutGroupContext.mjs';
12
12
  import { LazyContext } from '../context/LazyContext.mjs';
13
13
  import { motionComponentSymbol } from './utils/symbol.mjs';
14
- import { warning, invariant } from '../../../../utils/dist/es/errors.mjs';
14
+ import { warning, invariant } from '../../../../motion-utils/dist/es/errors.mjs';
15
15
  import { featureDefinitions } from './features/definitions.mjs';
16
16
 
17
17
  /**
@@ -1,8 +1,8 @@
1
1
  import { circOut } from '../../easing/circ.mjs';
2
2
  import { progress } from '../../utils/progress.mjs';
3
3
  import { mixNumber } from '../../utils/mix/number.mjs';
4
- import '../../../../../utils/dist/es/errors.mjs';
5
- import { noop } from '../../../../../utils/dist/es/noop.mjs';
4
+ import '../../../../../motion-utils/dist/es/errors.mjs';
5
+ import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
6
6
  import { percent, px } from '../../value/types/numbers/units.mjs';
7
7
 
8
8
  const borders = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"];
@@ -20,8 +20,8 @@ import { isSVGElement } from '../../render/dom/utils/is-svg-element.mjs';
20
20
  import { animateSingleValue } from '../../animation/animate/single-value.mjs';
21
21
  import { clamp } from '../../utils/clamp.mjs';
22
22
  import { cancelFrame, frameData, frameSteps, frame } from '../../frameloop/frame.mjs';
23
- import '../../../../../utils/dist/es/errors.mjs';
24
- import { noop } from '../../../../../utils/dist/es/noop.mjs';
23
+ import '../../../../../motion-utils/dist/es/errors.mjs';
24
+ import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
25
25
  import { time } from '../../frameloop/sync-time.mjs';
26
26
  import { microtask } from '../../frameloop/microtask.mjs';
27
27
  import { getOptimisedAppearId } from '../../animation/optimized-appear/get-appear-id.mjs';
@@ -1,4 +1,4 @@
1
- import { resolveElements } from '../../../../../../dom/dist/es/utils/resolve-elements.mjs';
1
+ import { resolveElements } from '../../../../../../motion-dom/dist/es/utils/resolve-elements.mjs';
2
2
 
3
3
  const resizeHandlers = new WeakMap();
4
4
  let observer;
@@ -1,8 +1,8 @@
1
1
  import { scrollInfo } from './track.mjs';
2
2
  import { observeTimeline } from './observe.mjs';
3
3
  import { supportsScrollTimeline } from './supports.mjs';
4
- import '../../../../../../utils/dist/es/errors.mjs';
5
- import { noop } from '../../../../../../utils/dist/es/noop.mjs';
4
+ import '../../../../../../motion-utils/dist/es/errors.mjs';
5
+ import { noop } from '../../../../../../motion-utils/dist/es/noop.mjs';
6
6
 
7
7
  function scrollTimelineFallback({ source, container, axis = "y", }) {
8
8
  // Support legacy source argument. Deprecate later.
@@ -1,4 +1,4 @@
1
- import { invariant } from '../../../../../../utils/dist/es/errors.mjs';
1
+ import { invariant } from '../../../../../../motion-utils/dist/es/errors.mjs';
2
2
  import { isNumericalString } from '../../../utils/is-numerical-string.mjs';
3
3
  import { isCSSVariableToken } from './is-css-variable.mjs';
4
4
 
@@ -1,4 +1,4 @@
1
- import { resolveElements } from '../../../../../../dom/dist/es/utils/resolve-elements.mjs';
1
+ import { resolveElements } from '../../../../../../motion-dom/dist/es/utils/resolve-elements.mjs';
2
2
 
3
3
  const thresholds = {
4
4
  some: 0,
@@ -17,7 +17,7 @@ function updateMotionValuesFromProps(element, next, prev) {
17
17
  * and warn against mismatches.
18
18
  */
19
19
  if (process.env.NODE_ENV === "development") {
20
- warnOnce(nextValue.version === "11.13.0-beta.0", `Attempting to mix Motion versions ${nextValue.version} with 11.13.0-beta.0 may not work as expected.`);
20
+ warnOnce(nextValue.version === "11.13.0", `Attempting to mix Motion versions ${nextValue.version} with 11.13.0 may not work as expected.`);
21
21
  }
22
22
  }
23
23
  else if (isMotionValue(prevValue)) {
@@ -1,8 +1,8 @@
1
1
  import { clamp } from './clamp.mjs';
2
2
  import { pipe } from './pipe.mjs';
3
3
  import { progress } from './progress.mjs';
4
- import { invariant } from '../../../../utils/dist/es/errors.mjs';
5
- import { noop } from '../../../../utils/dist/es/noop.mjs';
4
+ import { invariant } from '../../../../motion-utils/dist/es/errors.mjs';
5
+ import { noop } from '../../../../motion-utils/dist/es/noop.mjs';
6
6
  import { mix } from './mix/index.mjs';
7
7
 
8
8
  function createMixers(output, ease, customMixer) {
@@ -1,5 +1,5 @@
1
1
  import { mixNumber } from './number.mjs';
2
- import { warning } from '../../../../../utils/dist/es/errors.mjs';
2
+ import { warning } from '../../../../../motion-utils/dist/es/errors.mjs';
3
3
  import { hslaToRgba } from '../hsla-to-rgba.mjs';
4
4
  import { hex } from '../../value/types/color/hex.mjs';
5
5
  import { rgba } from '../../value/types/color/rgba.mjs';
@@ -1,7 +1,7 @@
1
1
  import { mixNumber as mixNumber$1 } from './number.mjs';
2
2
  import { mixColor } from './color.mjs';
3
3
  import { pipe } from '../pipe.mjs';
4
- import { warning } from '../../../../../utils/dist/es/errors.mjs';
4
+ import { warning } from '../../../../../motion-utils/dist/es/errors.mjs';
5
5
  import { color } from '../../value/types/color/index.mjs';
6
6
  import { complex, analyseComplexValue } from '../../value/types/complex/index.mjs';
7
7
  import { isCSSVariableToken } from '../../render/dom/utils/is-css-variable.mjs';
@@ -34,7 +34,7 @@ class MotionValue {
34
34
  * This will be replaced by the build step with the latest version number.
35
35
  * When MotionValues are provided to motion components, warn if versions are mixed.
36
36
  */
37
- this.version = "11.13.0-beta.0";
37
+ this.version = "11.13.0";
38
38
  /**
39
39
  * Tracks whether this value can output a velocity. Currently this is only true
40
40
  * if the value is numerical, but we might be able to widen the scope here and support
@@ -1,5 +1,5 @@
1
1
  import { useTransform } from './use-transform.mjs';
2
- import { invariant, warning } from '../../../../utils/dist/es/errors.mjs';
2
+ import { invariant, warning } from '../../../../motion-utils/dist/es/errors.mjs';
3
3
  import { useMotionValue } from './use-motion-value.mjs';
4
4
  import { MotionContext } from '../context/MotionContext/index.mjs';
5
5
  import { useContext } from 'react';
@@ -1,7 +1,7 @@
1
1
  import { motionValue } from './index.mjs';
2
2
  import { useConstant } from '../utils/use-constant.mjs';
3
3
  import { useEffect } from 'react';
4
- import { warning } from '../../../../utils/dist/es/errors.mjs';
4
+ import { warning } from '../../../../motion-utils/dist/es/errors.mjs';
5
5
  import { scroll } from '../render/dom/scroll/index.mjs';
6
6
  import { useIsomorphicLayoutEffect } from '../utils/use-isomorphic-effect.mjs';
7
7
 
@@ -1,3 +1,6 @@
1
+ export { invariant } from '../../motion-utils/dist/es/errors.mjs';
2
+ export { noop } from '../../motion-utils/dist/es/noop.mjs';
3
+ export { isDragActive } from '../../motion-dom/dist/es/gestures/drag/state/is-active.mjs';
1
4
  export { MotionValue, motionValue } from '../../framer-motion/dist/es/value/index.mjs';
2
5
  export { animate, createScopedAnimate } from '../../framer-motion/dist/es/animation/animate/index.mjs';
3
6
  export { animateMini } from '../../framer-motion/dist/es/animation/animators/waapi/animate-style.mjs';
@@ -27,7 +30,3 @@ export { progress } from '../../framer-motion/dist/es/utils/progress.mjs';
27
30
  export { wrap } from '../../framer-motion/dist/es/utils/wrap.mjs';
28
31
  export { cancelSync, sync } from '../../framer-motion/dist/es/frameloop/index-legacy.mjs';
29
32
  export { cancelFrame, frame, frameData, frameSteps } from '../../framer-motion/dist/es/frameloop/frame.mjs';
30
- export { invariant, warning } from '../../utils/dist/es/errors.mjs';
31
- export { noop } from '../../utils/dist/es/noop.mjs';
32
- export { hover } from '../../dom/dist/es/gestures/hover.mjs';
33
- export { resolveElements } from '../../dom/dist/es/utils/resolve-elements.mjs';
@@ -65,6 +65,9 @@ export { useAnimatedState as useDeprecatedAnimatedState } from '../../framer-mot
65
65
  export { useInvertedScale as useDeprecatedInvertedScale } from '../../framer-motion/dist/es/value/use-inverted-scale.mjs';
66
66
  export { AnimateSharedLayout } from '../../framer-motion/dist/es/components/AnimateSharedLayout.mjs';
67
67
  export { delay } from '../../framer-motion/dist/es/utils/delay.mjs';
68
+ export { invariant } from '../../motion-utils/dist/es/errors.mjs';
69
+ export { noop } from '../../motion-utils/dist/es/noop.mjs';
70
+ export { isDragActive } from '../../motion-dom/dist/es/gestures/drag/state/is-active.mjs';
68
71
  export { MotionValue, motionValue } from '../../framer-motion/dist/es/value/index.mjs';
69
72
  export { animate, createScopedAnimate } from '../../framer-motion/dist/es/animation/animate/index.mjs';
70
73
  export { animateMini } from '../../framer-motion/dist/es/animation/animators/waapi/animate-style.mjs';
@@ -97,7 +100,6 @@ export { createBox } from '../../framer-motion/dist/es/projection/geometry/model
97
100
  export { calcLength } from '../../framer-motion/dist/es/projection/geometry/delta-calc.mjs';
98
101
  export { filterProps } from '../../framer-motion/dist/es/render/dom/utils/filter-props.mjs';
99
102
  export { makeUseVisualState } from '../../framer-motion/dist/es/motion/utils/use-visual-state.mjs';
100
- export { isDragActive } from '../../framer-motion/dist/es/gestures/drag/utils/lock.mjs';
101
103
  export { addPointerEvent } from '../../framer-motion/dist/es/events/add-pointer-event.mjs';
102
104
  export { addPointerInfo } from '../../framer-motion/dist/es/events/event-info.mjs';
103
105
  export { isMotionValue } from '../../framer-motion/dist/es/value/utils/is-motion-value.mjs';
@@ -105,9 +107,5 @@ export { isBrowser } from '../../framer-motion/dist/es/utils/is-browser.mjs';
105
107
  export { useUnmountEffect } from '../../framer-motion/dist/es/utils/use-unmount-effect.mjs';
106
108
  export { useIsomorphicLayoutEffect } from '../../framer-motion/dist/es/utils/use-isomorphic-effect.mjs';
107
109
  export { useForceUpdate } from '../../framer-motion/dist/es/utils/use-force-update.mjs';
108
- export { invariant, warning } from '../../utils/dist/es/errors.mjs';
109
- export { noop } from '../../utils/dist/es/noop.mjs';
110
- export { hover } from '../../dom/dist/es/gestures/hover.mjs';
111
- export { resolveElements } from '../../dom/dist/es/utils/resolve-elements.mjs';
112
110
  import * as namespace from '../../framer-motion/dist/es/components/Reorder/namespace.mjs';
113
111
  export { namespace as Reorder };
@@ -0,0 +1,9 @@
1
+ const isDragging = {
2
+ x: false,
3
+ y: false,
4
+ };
5
+ function isDragActive() {
6
+ return isDragging.x || isDragging.y;
7
+ }
8
+
9
+ export { isDragActive, isDragging };
@@ -0,0 +1,28 @@
1
+ import { isDragging } from './is-active.mjs';
2
+
3
+ function setDragLock(axis) {
4
+ if (axis === "x" || axis === "y") {
5
+ if (isDragging[axis]) {
6
+ return null;
7
+ }
8
+ else {
9
+ isDragging[axis] = true;
10
+ return () => {
11
+ isDragging[axis] = false;
12
+ };
13
+ }
14
+ }
15
+ else {
16
+ if (isDragging.x || isDragging.y) {
17
+ return null;
18
+ }
19
+ else {
20
+ isDragging.x = isDragging.y = true;
21
+ return () => {
22
+ isDragging.x = isDragging.y = false;
23
+ };
24
+ }
25
+ }
26
+ }
27
+
28
+ export { setDragLock };
@@ -0,0 +1,46 @@
1
+ import { resolveElements } from '../utils/resolve-elements.mjs';
2
+ import { isDragActive } from './drag/state/is-active.mjs';
3
+
4
+ /**
5
+ * Filter out events that are not pointer events, or are triggering
6
+ * while a Motion gesture is active.
7
+ */
8
+ function filterEvents(callback) {
9
+ return (event) => {
10
+ if (event.pointerType === "touch" || isDragActive())
11
+ return;
12
+ callback(event);
13
+ };
14
+ }
15
+ /**
16
+ * Create a hover gesture. hover() is different to .addEventListener("pointerenter")
17
+ * in that it has an easier syntax, filters out polyfilled touch events, interoperates
18
+ * with drag gestures, and automatically removes the "pointerennd" event listener when the hover ends.
19
+ *
20
+ * @public
21
+ */
22
+ function hover(elementOrSelector, onHoverStart, options = {}) {
23
+ const gestureAbortController = new AbortController();
24
+ const eventOptions = {
25
+ passive: true,
26
+ ...options,
27
+ signal: gestureAbortController.signal,
28
+ };
29
+ const onPointerEnter = filterEvents((enterEvent) => {
30
+ const { target } = enterEvent;
31
+ const onHoverEnd = onHoverStart(enterEvent);
32
+ if (!onHoverEnd || !target)
33
+ return;
34
+ const onPointerLeave = filterEvents((leaveEvent) => {
35
+ onHoverEnd(leaveEvent);
36
+ target.removeEventListener("pointerleave", onPointerLeave);
37
+ });
38
+ target.addEventListener("pointerleave", onPointerLeave, eventOptions);
39
+ });
40
+ resolveElements(elementOrSelector).forEach((element) => {
41
+ element.addEventListener("pointerenter", onPointerEnter, eventOptions);
42
+ });
43
+ return () => gestureAbortController.abort();
44
+ }
45
+
46
+ export { hover };
@@ -6,10 +6,10 @@
6
6
 
7
7
  const noop = (any) => any;
8
8
 
9
- exports.warning = noop;
9
+ let warning = noop;
10
10
  exports.invariant = noop;
11
11
  {
12
- exports.warning = (check, message) => {
12
+ warning = (check, message) => {
13
13
  if (!check && typeof console !== "undefined") {
14
14
  console.warn(message);
15
15
  }
@@ -42,27 +42,12 @@
42
42
  return Array.from(elementOrSelector);
43
43
  }
44
44
 
45
- function hover(elementOrSelector, onHoverStart) {
46
- const elements = resolveElements(elementOrSelector);
47
- const cancelGesture = new AbortController();
48
- const options = { signal: cancelGesture.signal };
49
- const onPointerEnter = (enterEvent) => {
50
- if (enterEvent.pointerType === "touch")
51
- return;
52
- const { target } = enterEvent;
53
- const onHoverEnd = onHoverStart(enterEvent);
54
- if (onHoverEnd && target) {
55
- const onPointerLeave = (leaveEvent) => {
56
- onHoverEnd(leaveEvent);
57
- target.removeEventListener("pointerleave", onPointerLeave);
58
- };
59
- target.addEventListener("pointerleave", onPointerLeave, options);
60
- }
61
- };
62
- elements.forEach((element) => {
63
- element.addEventListener("pointerenter", onPointerEnter, options);
64
- });
65
- return () => cancelGesture.abort();
45
+ const isDragging = {
46
+ x: false,
47
+ y: false,
48
+ };
49
+ function isDragActive() {
50
+ return isDragging.y;
66
51
  }
67
52
 
68
53
  function addUniqueItem(arr, item) {
@@ -340,7 +325,7 @@
340
325
  * This will be replaced by the build step with the latest version number.
341
326
  * When MotionValues are provided to motion components, warn if versions are mixed.
342
327
  */
343
- this.version = "11.13.0-beta.0";
328
+ this.version = "11.13.0";
344
329
  /**
345
330
  * Tracks whether this value can output a velocity. Currently this is only true
346
331
  * if the value is numerical, but we might be able to widen the scope here and support
@@ -789,7 +774,7 @@
789
774
  function findSpring({ duration = springDefaults.duration, bounce = springDefaults.bounce, velocity = springDefaults.velocity, mass = springDefaults.mass, }) {
790
775
  let envelope;
791
776
  let derivative;
792
- exports.warning(duration <= secondsToMilliseconds(springDefaults.maxDuration), "Spring duration must be 10 seconds or less");
777
+ warning(duration <= secondsToMilliseconds(springDefaults.maxDuration), "Spring duration must be 10 seconds or less");
793
778
  let dampingRatio = 1 - bounce;
794
779
  /**
795
780
  * Restrict dampingRatio and duration to within acceptable ranges.
@@ -2460,7 +2445,7 @@
2460
2445
  const targetKeyframe = keyframes[keyframes.length - 1];
2461
2446
  const isOriginAnimatable = isAnimatable(originKeyframe, name);
2462
2447
  const isTargetAnimatable = isAnimatable(targetKeyframe, name);
2463
- exports.warning(isOriginAnimatable === isTargetAnimatable, `You are trying to animate ${name} from "${originKeyframe}" to "${targetKeyframe}". ${originKeyframe} is not an animatable value - to enable this animation set ${originKeyframe} to a value animatable to ${targetKeyframe} via the \`style\` property.`);
2448
+ warning(isOriginAnimatable === isTargetAnimatable, `You are trying to animate ${name} from "${originKeyframe}" to "${targetKeyframe}". ${originKeyframe} is not an animatable value - to enable this animation set ${originKeyframe} to a value animatable to ${targetKeyframe} via the \`style\` property.`);
2464
2449
  // Always skip if any of these are true
2465
2450
  if (!isOriginAnimatable || !isTargetAnimatable) {
2466
2451
  return false;
@@ -2763,7 +2748,7 @@
2763
2748
  const getColorType = (v) => colorTypes.find((type) => type.test(v));
2764
2749
  function asRGBA(color) {
2765
2750
  const type = getColorType(color);
2766
- exports.warning(Boolean(type), `'${color}' is not an animatable color. Use the equivalent color code instead.`);
2751
+ warning(Boolean(type), `'${color}' is not an animatable color. Use the equivalent color code instead.`);
2767
2752
  if (!Boolean(type))
2768
2753
  return false;
2769
2754
  let model = type.parse(color);
@@ -2882,7 +2867,7 @@
2882
2867
  return pipe(mixArray(matchOrder(originStats, targetStats), targetStats.values), template);
2883
2868
  }
2884
2869
  else {
2885
- exports.warning(true, `Complex values '${origin}' and '${target}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`);
2870
+ warning(true, `Complex values '${origin}' and '${target}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`);
2886
2871
  return mixImmediate(origin, target);
2887
2872
  }
2888
2873
  };
@@ -4177,7 +4162,7 @@
4177
4162
  * and warn against mismatches.
4178
4163
  */
4179
4164
  {
4180
- warnOnce(nextValue.version === "11.13.0-beta.0", `Attempting to mix Motion versions ${nextValue.version} with 11.13.0-beta.0 may not work as expected.`);
4165
+ warnOnce(nextValue.version === "11.13.0", `Attempting to mix Motion versions ${nextValue.version} with 11.13.0 may not work as expected.`);
4181
4166
  }
4182
4167
  }
4183
4168
  else if (isMotionValue(prevValue)) {
@@ -6198,10 +6183,10 @@
6198
6183
  exports.frame = frame;
6199
6184
  exports.frameData = frameData;
6200
6185
  exports.frameSteps = frameSteps;
6201
- exports.hover = hover;
6202
6186
  exports.inView = inView;
6203
6187
  exports.inertia = inertia;
6204
6188
  exports.interpolate = interpolate;
6189
+ exports.isDragActive = isDragActive;
6205
6190
  exports.keyframes = keyframes;
6206
6191
  exports.mirrorEasing = mirrorEasing;
6207
6192
  exports.mix = mix;
@@ -6209,7 +6194,6 @@
6209
6194
  exports.noop = noop;
6210
6195
  exports.pipe = pipe;
6211
6196
  exports.progress = progress;
6212
- exports.resolveElements = resolveElements;
6213
6197
  exports.reverseEasing = reverseEasing;
6214
6198
  exports.scroll = scroll;
6215
6199
  exports.scrollInfo = scrollInfo;