motion 11.13.0-beta.0 → 11.13.1
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/.turbo/turbo-build.log +45 -45
- package/README.md +4 -4
- package/dist/cjs/index.js +29 -44
- package/dist/cjs/react-client.js +137 -98
- package/dist/es/framer-motion/dist/es/animation/animate/resolve-subjects.mjs +1 -1
- package/dist/es/framer-motion/dist/es/animation/animate/subject.mjs +1 -1
- package/dist/es/framer-motion/dist/es/animation/animators/AcceleratedAnimation.mjs +2 -2
- package/dist/es/framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs +1 -1
- package/dist/es/framer-motion/dist/es/animation/animators/utils/can-animate.mjs +1 -1
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/NativeAnimation.mjs +2 -2
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +2 -2
- package/dist/es/framer-motion/dist/es/animation/generators/spring/find.mjs +1 -1
- package/dist/es/framer-motion/dist/es/animation/hooks/animation-controls.mjs +1 -1
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/start.mjs +2 -2
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/index.mjs +1 -1
- package/dist/es/framer-motion/dist/es/components/AnimateSharedLayout.mjs +1 -1
- package/dist/es/framer-motion/dist/es/components/Reorder/Group.mjs +1 -1
- package/dist/es/framer-motion/dist/es/components/Reorder/Item.mjs +1 -1
- package/dist/es/framer-motion/dist/es/easing/cubic-bezier.mjs +2 -2
- package/dist/es/framer-motion/dist/es/easing/utils/map.mjs +2 -2
- package/dist/es/framer-motion/dist/es/frameloop/frame.mjs +2 -2
- package/dist/es/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs +11 -14
- package/dist/es/framer-motion/dist/es/gestures/drag/index.mjs +2 -2
- package/dist/es/framer-motion/dist/es/gestures/hover.mjs +18 -22
- package/dist/es/framer-motion/dist/es/gestures/pan/index.mjs +2 -2
- package/dist/es/framer-motion/dist/es/gestures/press.mjs +3 -3
- package/dist/es/framer-motion/dist/es/motion/index.mjs +1 -1
- package/dist/es/framer-motion/dist/es/projection/animation/mix-values.mjs +2 -2
- package/dist/es/framer-motion/dist/es/projection/node/create-projection-node.mjs +2 -2
- package/dist/es/framer-motion/dist/es/render/dom/DOMVisualElement.mjs +15 -0
- package/dist/es/framer-motion/dist/es/render/dom/resize/handle-element.mjs +1 -1
- package/dist/es/framer-motion/dist/es/render/dom/scroll/index.mjs +2 -2
- package/dist/es/framer-motion/dist/es/render/dom/utils/css-variables-conversion.mjs +1 -1
- package/dist/es/framer-motion/dist/es/render/dom/viewport/index.mjs +1 -1
- package/dist/es/framer-motion/dist/es/render/html/HTMLVisualElement.mjs +0 -14
- package/dist/es/framer-motion/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/framer-motion/dist/es/utils/interpolate.mjs +2 -2
- package/dist/es/framer-motion/dist/es/utils/mix/color.mjs +1 -1
- package/dist/es/framer-motion/dist/es/utils/mix/complex.mjs +1 -1
- package/dist/es/framer-motion/dist/es/value/index.mjs +1 -1
- package/dist/es/framer-motion/dist/es/value/use-inverted-scale.mjs +1 -1
- package/dist/es/framer-motion/dist/es/value/use-scroll.mjs +1 -1
- package/dist/es/motion/lib/index.mjs +3 -4
- package/dist/es/motion/lib/react.mjs +3 -5
- package/dist/es/motion-dom/dist/es/gestures/drag/state/is-active.mjs +9 -0
- package/dist/es/motion-dom/dist/es/gestures/drag/state/set-active.mjs +28 -0
- package/dist/es/motion-dom/dist/es/gestures/hover.mjs +46 -0
- package/dist/motion.dev.js +29 -44
- package/dist/motion.js +1 -1
- package/package.json +3 -3
- package/dist/es/dom/dist/es/gestures/hover.mjs +0 -26
- package/dist/es/framer-motion/dist/es/gestures/drag/utils/lock.mjs +0 -53
- /package/dist/es/{dom → motion-dom}/dist/es/utils/resolve-elements.mjs +0 -0
- /package/dist/es/{utils → motion-utils}/dist/es/errors.mjs +0 -0
- /package/dist/es/{utils → motion-utils}/dist/es/noop.mjs +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { warning } from '../../../../../../utils/dist/es/errors.mjs';
|
|
1
|
+
import { warning } from '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
2
|
import { clamp } from '../../../utils/clamp.mjs';
|
|
3
3
|
import { secondsToMilliseconds, millisecondsToSeconds } from '../../../utils/time-conversion.mjs';
|
|
4
4
|
import { springDefaults } from './defaults.mjs';
|
|
@@ -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 { setTarget } from '../../render/utils/setters.mjs';
|
|
3
3
|
import { animateVisualElement } from '../interfaces/visual-element.mjs';
|
|
4
4
|
|
|
@@ -3,8 +3,8 @@ import { startWaapiAnimation } from '../animators/waapi/index.mjs';
|
|
|
3
3
|
import { optimizedAppearDataId } from './data-id.mjs';
|
|
4
4
|
import { handoffOptimizedAppearAnimation } from './handoff.mjs';
|
|
5
5
|
import { appearAnimationStore, appearComplete } from './store.mjs';
|
|
6
|
-
import '../../../../../utils/dist/es/errors.mjs';
|
|
7
|
-
import { noop } from '../../../../../utils/dist/es/noop.mjs';
|
|
6
|
+
import '../../../../../motion-utils/dist/es/errors.mjs';
|
|
7
|
+
import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
|
|
8
8
|
import { getOptimisedAppearId } from './get-appear-id.mjs';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -3,7 +3,7 @@ import { jsx, Fragment } from 'react/jsx-runtime';
|
|
|
3
3
|
import { useMemo, useRef, useState, useContext } from 'react';
|
|
4
4
|
import { PresenceChild } from './PresenceChild.mjs';
|
|
5
5
|
import { LayoutGroupContext } from '../../context/LayoutGroupContext.mjs';
|
|
6
|
-
import { invariant } from '../../../../../utils/dist/es/errors.mjs';
|
|
6
|
+
import { invariant } from '../../../../../motion-utils/dist/es/errors.mjs';
|
|
7
7
|
import { useConstant } from '../../utils/use-constant.mjs';
|
|
8
8
|
import { onlyElements, getChildKey } from './utils.mjs';
|
|
9
9
|
import { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { invariant } from '../../../../utils/dist/es/errors.mjs';
|
|
2
|
+
import { invariant } from '../../../../motion-utils/dist/es/errors.mjs';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useConstant } from '../utils/use-constant.mjs';
|
|
5
5
|
import { LayoutGroup } from './LayoutGroup/index.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { invariant } from '../../../../../utils/dist/es/errors.mjs';
|
|
3
|
+
import { invariant } from '../../../../../motion-utils/dist/es/errors.mjs';
|
|
4
4
|
import { forwardRef, useRef, useEffect } from 'react';
|
|
5
5
|
import { ReorderContext } from '../../context/ReorderContext.mjs';
|
|
6
6
|
import { motion } from '../../render/components/motion/proxy.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { invariant } from '../../../../../utils/dist/es/errors.mjs';
|
|
3
|
+
import { invariant } from '../../../../../motion-utils/dist/es/errors.mjs';
|
|
4
4
|
import { forwardRef, useContext } from 'react';
|
|
5
5
|
import { ReorderContext } from '../../context/ReorderContext.mjs';
|
|
6
6
|
import { motion } from '../../render/components/motion/proxy.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { invariant } from '../../../../../utils/dist/es/errors.mjs';
|
|
2
|
-
import { noop } from '../../../../../utils/dist/es/noop.mjs';
|
|
1
|
+
import { invariant } from '../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
|
|
3
3
|
import { cubicBezier } from '../cubic-bezier.mjs';
|
|
4
4
|
import { easeIn, easeInOut, easeOut } from '../ease.mjs';
|
|
5
5
|
import { circIn, circInOut, circOut } from '../circ.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import '../../../../utils/dist/es/errors.mjs';
|
|
2
|
-
import { noop } from '../../../../utils/dist/es/noop.mjs';
|
|
1
|
+
import '../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { noop } from '../../../../motion-utils/dist/es/noop.mjs';
|
|
3
3
|
import { createRenderBatcher } from './batcher.mjs';
|
|
4
4
|
|
|
5
5
|
const { schedule: frame, cancel: cancelFrame, state: frameData, steps: frameSteps, } = createRenderBatcher(typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : noop, true);
|
|
@@ -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
|
-
|
|
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.
|
|
67
|
-
this.
|
|
68
|
-
this.
|
|
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.
|
|
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.
|
|
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.
|
|
181
|
-
this.
|
|
182
|
-
this.
|
|
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
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
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 '
|
|
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,5 +1,6 @@
|
|
|
1
1
|
import { VisualElement } from '../VisualElement.mjs';
|
|
2
2
|
import { DOMKeyframesResolver } from './DOMKeyframesResolver.mjs';
|
|
3
|
+
import { isMotionValue } from '../../value/utils/is-motion-value.mjs';
|
|
3
4
|
|
|
4
5
|
class DOMVisualElement extends VisualElement {
|
|
5
6
|
constructor() {
|
|
@@ -23,6 +24,20 @@ class DOMVisualElement extends VisualElement {
|
|
|
23
24
|
delete vars[key];
|
|
24
25
|
delete style[key];
|
|
25
26
|
}
|
|
27
|
+
handleChildMotionValue() {
|
|
28
|
+
if (this.childSubscription) {
|
|
29
|
+
this.childSubscription();
|
|
30
|
+
delete this.childSubscription;
|
|
31
|
+
}
|
|
32
|
+
const { children } = this.props;
|
|
33
|
+
if (isMotionValue(children)) {
|
|
34
|
+
this.childSubscription = children.on("change", (latest) => {
|
|
35
|
+
if (this.current) {
|
|
36
|
+
this.current.textContent = `${latest}`;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
26
41
|
}
|
|
27
42
|
|
|
28
43
|
export { DOMVisualElement };
|
|
@@ -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
|
|
|
@@ -6,7 +6,6 @@ import { renderHTML } from './utils/render.mjs';
|
|
|
6
6
|
import { getDefaultValueType } from '../dom/value-types/defaults.mjs';
|
|
7
7
|
import { measureViewportBox } from '../../projection/utils/measure.mjs';
|
|
8
8
|
import { DOMVisualElement } from '../dom/DOMVisualElement.mjs';
|
|
9
|
-
import { isMotionValue } from '../../value/utils/is-motion-value.mjs';
|
|
10
9
|
|
|
11
10
|
function getComputedStyle(element) {
|
|
12
11
|
return window.getComputedStyle(element);
|
|
@@ -39,19 +38,6 @@ class HTMLVisualElement extends DOMVisualElement {
|
|
|
39
38
|
scrapeMotionValuesFromProps(props, prevProps, visualElement) {
|
|
40
39
|
return scrapeMotionValuesFromProps(props, prevProps, visualElement);
|
|
41
40
|
}
|
|
42
|
-
handleChildMotionValue() {
|
|
43
|
-
if (this.childSubscription) {
|
|
44
|
-
this.childSubscription();
|
|
45
|
-
delete this.childSubscription;
|
|
46
|
-
}
|
|
47
|
-
const { children } = this.props;
|
|
48
|
-
if (isMotionValue(children)) {
|
|
49
|
-
this.childSubscription = children.on("change", (latest) => {
|
|
50
|
-
if (this.current)
|
|
51
|
-
this.current.textContent = `${latest}`;
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
41
|
}
|
|
56
42
|
|
|
57
43
|
export { HTMLVisualElement, getComputedStyle };
|
|
@@ -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.
|
|
20
|
+
warnOnce(nextValue.version === "11.13.1", `Attempting to mix Motion versions ${nextValue.version} with 11.13.1 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.
|
|
37
|
+
this.version = "11.13.1";
|
|
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,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 };
|