framer-motion 12.4.12 → 12.5.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/client.js +1 -1
- package/dist/cjs/{create-Da6xW2BP.js → create-BErQMR-o.js} +4283 -4778
- package/dist/cjs/debug.js +5 -281
- package/dist/cjs/dom-mini.js +9 -7
- package/dist/cjs/dom.js +164 -659
- package/dist/cjs/index.js +1555 -1553
- package/dist/cjs/m.js +11 -179
- package/dist/cjs/mini.js +8 -0
- package/dist/debug.d.ts +2 -35
- package/dist/dom-mini.d.ts +1 -181
- package/dist/dom-mini.js +1 -1
- package/dist/dom.d.ts +3 -242
- package/dist/dom.js +1 -1
- package/dist/es/animation/animate/single-value.mjs +1 -1
- package/dist/es/animation/animators/BaseAnimation.mjs +1 -1
- package/dist/es/animation/animators/MainThreadAnimation.mjs +1 -2
- package/dist/es/animation/animators/drivers/driver-frameloop.mjs +1 -2
- package/dist/es/animation/animators/waapi/index.mjs +1 -3
- package/dist/es/animation/generators/utils/velocity.mjs +1 -1
- package/dist/es/animation/interfaces/motion-value.mjs +2 -4
- package/dist/es/animation/interfaces/visual-element-target.mjs +1 -2
- package/dist/es/animation/optimized-appear/start.mjs +3 -3
- package/dist/es/animation/sequence/utils/edit.mjs +1 -1
- package/dist/es/components/AnimatePresence/index.mjs +1 -1
- package/dist/es/components/Reorder/utils/check-reorder.mjs +1 -1
- package/dist/es/debug.mjs +1 -1
- package/dist/es/dom.mjs +1 -5
- package/dist/es/gestures/drag/VisualElementDragControls.mjs +1 -2
- package/dist/es/gestures/hover.mjs +1 -2
- package/dist/es/gestures/pan/PanSession.mjs +1 -2
- package/dist/es/gestures/pan/index.mjs +1 -1
- package/dist/es/gestures/press.mjs +1 -2
- package/dist/es/index.mjs +14 -19
- package/dist/es/motion/features/layout/MeasureLayout.mjs +1 -2
- package/dist/es/motion/utils/use-visual-element.mjs +6 -6
- package/dist/es/projection/node/create-projection-node.mjs +2 -8
- package/dist/es/projection/shared/stack.mjs +1 -1
- package/dist/es/projection.mjs +1 -3
- package/dist/es/render/VisualElement.mjs +2 -5
- package/dist/es/render/components/create-proxy.mjs +1 -1
- package/dist/es/render/dom/DOMVisualElement.mjs +1 -1
- package/dist/es/render/dom/scroll/info.mjs +1 -2
- package/dist/es/render/dom/scroll/observe.mjs +1 -1
- package/dist/es/render/dom/scroll/on-scroll-handler.mjs +1 -1
- package/dist/es/render/dom/scroll/track.mjs +1 -1
- package/dist/es/render/dom/utils/unit-conversion.mjs +3 -20
- package/dist/es/render/html/HTMLVisualElement.mjs +2 -3
- package/dist/es/render/html/utils/parse-transform.mjs +83 -0
- package/dist/es/render/svg/SVGVisualElement.mjs +1 -1
- package/dist/es/render/svg/config-motion.mjs +1 -1
- package/dist/es/render/utils/KeyframesResolver.mjs +1 -1
- package/dist/es/render/utils/flat-tree.mjs +1 -1
- package/dist/es/render/utils/motion-values.mjs +3 -3
- package/dist/es/render/utils/setters.mjs +1 -1
- package/dist/es/utils/delay.mjs +1 -2
- package/dist/es/utils/reduced-motion/use-reduced-motion.mjs +1 -1
- package/dist/es/utils/use-animation-frame.mjs +1 -1
- package/dist/es/utils/use-force-update.mjs +1 -1
- package/dist/es/utils/use-instant-transition.mjs +1 -1
- package/dist/es/value/scroll/use-element-scroll.mjs +1 -1
- package/dist/es/value/scroll/use-viewport-scroll.mjs +1 -1
- package/dist/es/value/use-combine-values.mjs +2 -2
- package/dist/es/value/use-computed.mjs +1 -1
- package/dist/es/value/use-inverted-scale.mjs +3 -3
- package/dist/es/value/use-motion-value.mjs +1 -1
- package/dist/es/value/use-scroll.mjs +4 -4
- package/dist/es/value/use-spring.mjs +1 -1
- package/dist/es/value/use-transform.mjs +1 -1
- package/dist/es/value/use-velocity.mjs +1 -1
- package/dist/es/value/use-will-change/WillChangeMotionValue.mjs +2 -2
- package/dist/framer-motion.dev.js +8320 -8281
- package/dist/framer-motion.js +1 -1
- package/dist/m.d.ts +49 -241
- package/dist/size-rollup-animate.js +1 -1
- package/dist/size-rollup-dom-animation-assets.js +1 -1
- package/dist/size-rollup-dom-animation.js +1 -1
- package/dist/size-rollup-dom-max-assets.js +1 -1
- package/dist/size-rollup-dom-max.js +1 -1
- package/dist/size-rollup-m.js +1 -1
- package/dist/size-rollup-motion.js +1 -1
- package/dist/size-rollup-scroll.js +1 -1
- package/dist/types/client.d.ts +2 -2
- package/dist/types/index.d.ts +43 -79
- package/dist/{types.d-6pKw1mTI.d.ts → types.d-B50aGbjN.d.ts} +81 -289
- package/package.json +5 -6
- package/dist/es/frameloop/batcher.mjs +0 -69
- package/dist/es/frameloop/frame.mjs +0 -6
- package/dist/es/frameloop/index-legacy.mjs +0 -20
- package/dist/es/frameloop/microtask.mjs +0 -5
- package/dist/es/frameloop/order.mjs +0 -10
- package/dist/es/frameloop/render-step.mjs +0 -92
- package/dist/es/frameloop/sync-time.mjs +0 -31
- package/dist/es/stats/animation-count.mjs +0 -7
- package/dist/es/stats/buffer.mjs +0 -6
- package/dist/es/stats/index.mjs +0 -113
- package/dist/es/utils/GlobalConfig.mjs +0 -6
- package/dist/es/utils/array.mjs +0 -21
- package/dist/es/utils/subscription-manager.mjs +0 -40
- package/dist/es/utils/velocity-per-second.mjs +0 -11
- package/dist/es/utils/warn-once.mjs +0 -11
- package/dist/es/value/index.mjs +0 -319
- package/dist/three.d.ts +0 -2833
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { time } from '
|
|
1
|
+
import { time } from 'motion-dom';
|
|
2
2
|
import { flushKeyframeResolvers } from '../../render/utils/KeyframesResolver.mjs';
|
|
3
3
|
import { instantAnimationState } from '../../utils/use-instant-transition-state.mjs';
|
|
4
4
|
import { canAnimate } from './utils/can-animate.mjs';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { isGenerator, calcGeneratorDuration } from 'motion-dom';
|
|
1
|
+
import { isGenerator, calcGeneratorDuration, activeAnimations } from 'motion-dom';
|
|
2
2
|
import { invariant, millisecondsToSeconds, secondsToMilliseconds } from 'motion-utils';
|
|
3
3
|
import { KeyframeResolver } from '../../render/utils/KeyframesResolver.mjs';
|
|
4
|
-
import { activeAnimations } from '../../stats/animation-count.mjs';
|
|
5
4
|
import { clamp } from '../../utils/clamp.mjs';
|
|
6
5
|
import { mix } from '../../utils/mix/index.mjs';
|
|
7
6
|
import { pipe } from '../../utils/pipe.mjs';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { time } from '
|
|
2
|
-
import { frame, cancelFrame, frameData } from '../../../frameloop/frame.mjs';
|
|
1
|
+
import { frame, cancelFrame, frameData, time } from 'motion-dom';
|
|
3
2
|
|
|
4
3
|
const frameloopDriver = (update) => {
|
|
5
4
|
const passTimestamp = ({ timestamp }) => update(timestamp);
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { mapEasingToNativeEasing } from 'motion-dom';
|
|
2
|
-
import { activeAnimations } from '../../../stats/animation-count.mjs';
|
|
3
|
-
import { statsBuffer } from '../../../stats/buffer.mjs';
|
|
1
|
+
import { mapEasingToNativeEasing, statsBuffer, activeAnimations } from 'motion-dom';
|
|
4
2
|
|
|
5
3
|
function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = "loop", ease = "easeInOut", times, } = {}) {
|
|
6
4
|
const keyframeOptions = { [valueName]: keyframes };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { getValueTransition, GroupPlaybackControls } from 'motion-dom';
|
|
2
|
-
import { secondsToMilliseconds } from 'motion-utils';
|
|
3
|
-
import { frame } from '../../frameloop/frame.mjs';
|
|
4
|
-
import { MotionGlobalConfig } from '../../utils/GlobalConfig.mjs';
|
|
1
|
+
import { getValueTransition, frame, GroupPlaybackControls } from 'motion-dom';
|
|
2
|
+
import { secondsToMilliseconds, MotionGlobalConfig } from 'motion-utils';
|
|
5
3
|
import { instantAnimationState } from '../../utils/use-instant-transition-state.mjs';
|
|
6
4
|
import { AcceleratedAnimation } from '../animators/AcceleratedAnimation.mjs';
|
|
7
5
|
import { MainThreadAnimation } from '../animators/MainThreadAnimation.mjs';
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { getValueTransition } from 'motion-dom';
|
|
1
|
+
import { getValueTransition, frame } from 'motion-dom';
|
|
2
2
|
import { positionalKeys } from '../../render/html/utils/keys-position.mjs';
|
|
3
3
|
import { setTarget } from '../../render/utils/setters.mjs';
|
|
4
4
|
import { addValueToWillChange } from '../../value/use-will-change/add-will-change.mjs';
|
|
5
5
|
import { getOptimisedAppearId } from '../optimized-appear/get-appear-id.mjs';
|
|
6
6
|
import { animateMotionValue } from './motion-value.mjs';
|
|
7
|
-
import { frame } from '../../frameloop/frame.mjs';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Decide whether we should block this animation. Previously, we achieved this
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { noop } from 'motion-utils';
|
|
2
2
|
import { startWaapiAnimation } from '../animators/waapi/index.mjs';
|
|
3
3
|
import { optimizedAppearDataId } from './data-id.mjs';
|
|
4
|
+
import { getOptimisedAppearId } from './get-appear-id.mjs';
|
|
4
5
|
import { handoffOptimizedAppearAnimation } from './handoff.mjs';
|
|
5
6
|
import { appearAnimationStore, appearComplete } from './store.mjs';
|
|
6
|
-
import {
|
|
7
|
-
import { getOptimisedAppearId } from './get-appear-id.mjs';
|
|
7
|
+
import { appearStoreId } from './store-id.mjs';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* A single time to use across all animations to manually set startTime
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { removeItem } from 'motion-utils';
|
|
1
2
|
import { getEasingForSegment } from '../../../easing/utils/get-easing-for-segment.mjs';
|
|
2
|
-
import { removeItem } from '../../../utils/array.mjs';
|
|
3
3
|
import { mixNumber } from '../../../utils/mix/number.mjs';
|
|
4
4
|
|
|
5
5
|
function eraseKeyframes(sequence, startTime, endTime) {
|
|
@@ -3,10 +3,10 @@ import { jsx, Fragment } from 'react/jsx-runtime';
|
|
|
3
3
|
import { useMemo, useRef, useState, useContext } from 'react';
|
|
4
4
|
import { LayoutGroupContext } from '../../context/LayoutGroupContext.mjs';
|
|
5
5
|
import { useConstant } from '../../utils/use-constant.mjs';
|
|
6
|
+
import { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';
|
|
6
7
|
import { PresenceChild } from './PresenceChild.mjs';
|
|
7
8
|
import { usePresence } from './use-presence.mjs';
|
|
8
9
|
import { onlyElements, getChildKey } from './utils.mjs';
|
|
9
|
-
import { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* `AnimatePresence` enables the animation of components that have been removed from the tree.
|
package/dist/es/debug.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { recordStats } from '
|
|
1
|
+
export { recordStats } from 'motion-dom';
|
package/dist/es/dom.mjs
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
export { hover, isDragActive, press } from 'motion-dom';
|
|
1
|
+
export { MotionValue, cancelFrame, frame, frameData, hover, isDragActive, motionValue, press, time } from 'motion-dom';
|
|
2
2
|
export { invariant, noop, progress } from 'motion-utils';
|
|
3
3
|
export { animate, createScopedAnimate } from './animation/animate/index.mjs';
|
|
4
4
|
export { animateMini } from './animation/animators/waapi/animate-style.mjs';
|
|
5
5
|
export { scroll } from './render/dom/scroll/index.mjs';
|
|
6
6
|
export { scrollInfo } from './render/dom/scroll/track.mjs';
|
|
7
7
|
export { inView } from './render/dom/viewport/index.mjs';
|
|
8
|
-
export { MotionValue, motionValue } from './value/index.mjs';
|
|
9
8
|
export { anticipate } from './easing/anticipate.mjs';
|
|
10
9
|
export { backIn, backInOut, backOut } from './easing/back.mjs';
|
|
11
10
|
export { circIn, circInOut, circOut } from './easing/circ.mjs';
|
|
@@ -18,7 +17,6 @@ export { inertia } from './animation/generators/inertia.mjs';
|
|
|
18
17
|
export { keyframes } from './animation/generators/keyframes.mjs';
|
|
19
18
|
export { spring } from './animation/generators/spring/index.mjs';
|
|
20
19
|
export { stagger } from './animation/utils/stagger.mjs';
|
|
21
|
-
export { time } from './frameloop/sync-time.mjs';
|
|
22
20
|
export { clamp } from './utils/clamp.mjs';
|
|
23
21
|
export { delayInSeconds as delay } from './utils/delay.mjs';
|
|
24
22
|
export { distance, distance2D } from './utils/distance.mjs';
|
|
@@ -27,5 +25,3 @@ export { mix } from './utils/mix/index.mjs';
|
|
|
27
25
|
export { pipe } from './utils/pipe.mjs';
|
|
28
26
|
export { transform } from './utils/transform.mjs';
|
|
29
27
|
export { wrap } from './utils/wrap.mjs';
|
|
30
|
-
export { cancelSync, sync } from './frameloop/index-legacy.mjs';
|
|
31
|
-
export { cancelFrame, frame, frameData, frameSteps } from './frameloop/frame.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { setDragLock } from 'motion-dom';
|
|
1
|
+
import { frame, setDragLock } from 'motion-dom';
|
|
2
2
|
import { invariant } from 'motion-utils';
|
|
3
3
|
import { animateMotionValue } from '../../animation/interfaces/motion-value.mjs';
|
|
4
4
|
import { addDomEvent } from '../../events/add-dom-event.mjs';
|
|
@@ -16,7 +16,6 @@ import { percent } from '../../value/types/numbers/units.mjs';
|
|
|
16
16
|
import { addValueToWillChange } from '../../value/use-will-change/add-will-change.mjs';
|
|
17
17
|
import { PanSession } from '../pan/PanSession.mjs';
|
|
18
18
|
import { applyConstraints, calcRelativeConstraints, resolveDragElastic, rebaseAxisConstraints, calcViewportConstraints, calcOrigin, defaultElastic } from './utils/constraints.mjs';
|
|
19
|
-
import { frame } from '../../frameloop/frame.mjs';
|
|
20
19
|
|
|
21
20
|
const elementDragControls = new WeakMap();
|
|
22
21
|
/**
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { hover } from 'motion-dom';
|
|
1
|
+
import { hover, frame } from 'motion-dom';
|
|
2
2
|
import { extractEventInfo } from '../events/event-info.mjs';
|
|
3
3
|
import { Feature } from '../motion/features/Feature.mjs';
|
|
4
|
-
import { frame } from '../frameloop/frame.mjs';
|
|
5
4
|
|
|
6
5
|
function handleHoverEvent(node, event, lifecycle) {
|
|
7
6
|
const { props } = node;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { isPrimaryPointer } from 'motion-dom';
|
|
1
|
+
import { frame, isPrimaryPointer, cancelFrame, frameData } from 'motion-dom';
|
|
2
2
|
import { secondsToMilliseconds, millisecondsToSeconds } from 'motion-utils';
|
|
3
3
|
import { addPointerEvent } from '../../events/add-pointer-event.mjs';
|
|
4
4
|
import { extractEventInfo } from '../../events/event-info.mjs';
|
|
5
5
|
import { distance2D } from '../../utils/distance.mjs';
|
|
6
6
|
import { pipe } from '../../utils/pipe.mjs';
|
|
7
|
-
import { frame, cancelFrame, frameData } from '../../frameloop/frame.mjs';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* @internal
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { frame } from 'motion-dom';
|
|
1
2
|
import { noop } from 'motion-utils';
|
|
2
3
|
import { addPointerEvent } from '../../events/add-pointer-event.mjs';
|
|
3
4
|
import { Feature } from '../../motion/features/Feature.mjs';
|
|
4
5
|
import { getContextWindow } from '../../utils/get-context-window.mjs';
|
|
5
6
|
import { PanSession } from './PanSession.mjs';
|
|
6
|
-
import { frame } from '../../frameloop/frame.mjs';
|
|
7
7
|
|
|
8
8
|
const asyncHandler = (handler) => (event, info) => {
|
|
9
9
|
if (handler) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { press } from 'motion-dom';
|
|
1
|
+
import { press, frame } from 'motion-dom';
|
|
2
2
|
import { extractEventInfo } from '../events/event-info.mjs';
|
|
3
3
|
import { Feature } from '../motion/features/Feature.mjs';
|
|
4
|
-
import { frame } from '../frameloop/frame.mjs';
|
|
5
4
|
|
|
6
5
|
function handlePressEvent(node, event, lifecycle) {
|
|
7
6
|
const { props } = node;
|
package/dist/es/index.mjs
CHANGED
|
@@ -5,6 +5,18 @@ export { LazyMotion } from './components/LazyMotion/index.mjs';
|
|
|
5
5
|
export { MotionConfig } from './components/MotionConfig/index.mjs';
|
|
6
6
|
export { m } from './render/components/m/proxy.mjs';
|
|
7
7
|
export { motion } from './render/components/motion/proxy.mjs';
|
|
8
|
+
export { addPointerEvent } from './events/add-pointer-event.mjs';
|
|
9
|
+
export { addPointerInfo } from './events/event-info.mjs';
|
|
10
|
+
export { animations } from './motion/features/animations.mjs';
|
|
11
|
+
export { makeUseVisualState } from './motion/utils/use-visual-state.mjs';
|
|
12
|
+
export { calcLength } from './projection/geometry/delta-calc.mjs';
|
|
13
|
+
export { createBox } from './projection/geometry/models.mjs';
|
|
14
|
+
export { filterProps } from './render/dom/utils/filter-props.mjs';
|
|
15
|
+
export { isBrowser } from './utils/is-browser.mjs';
|
|
16
|
+
export { useForceUpdate } from './utils/use-force-update.mjs';
|
|
17
|
+
export { useIsomorphicLayoutEffect } from './utils/use-isomorphic-effect.mjs';
|
|
18
|
+
export { useUnmountEffect } from './utils/use-unmount-effect.mjs';
|
|
19
|
+
export { isMotionValue } from './value/utils/is-motion-value.mjs';
|
|
8
20
|
export { domAnimation } from './render/dom/features-animation.mjs';
|
|
9
21
|
export { domMax } from './render/dom/features-max.mjs';
|
|
10
22
|
export { domMin } from './render/dom/features-min.mjs';
|
|
@@ -22,6 +34,7 @@ export { useWillChange } from './value/use-will-change/index.mjs';
|
|
|
22
34
|
export { resolveMotionValue } from './value/utils/resolve-motion-value.mjs';
|
|
23
35
|
export { useReducedMotion } from './utils/reduced-motion/use-reduced-motion.mjs';
|
|
24
36
|
export { useReducedMotionConfig } from './utils/reduced-motion/use-reduced-motion-config.mjs';
|
|
37
|
+
export { MotionGlobalConfig, invariant, noop, progress } from 'motion-utils';
|
|
25
38
|
export { AcceleratedAnimation } from './animation/animators/AcceleratedAnimation.mjs';
|
|
26
39
|
export { animateValue } from './animation/animators/MainThreadAnimation.mjs';
|
|
27
40
|
export { animationControls } from './animation/hooks/animation-controls.mjs';
|
|
@@ -43,7 +56,6 @@ export { useResetProjection } from './projection/use-reset-projection.mjs';
|
|
|
43
56
|
export { buildTransform } from './render/html/utils/build-transform.mjs';
|
|
44
57
|
export { visualElementStore } from './render/store.mjs';
|
|
45
58
|
export { VisualElement } from './render/VisualElement.mjs';
|
|
46
|
-
export { MotionGlobalConfig } from './utils/GlobalConfig.mjs';
|
|
47
59
|
export { useAnimationFrame } from './utils/use-animation-frame.mjs';
|
|
48
60
|
export { useCycle } from './utils/use-cycle.mjs';
|
|
49
61
|
export { useInView } from './utils/use-in-view.mjs';
|
|
@@ -68,24 +80,20 @@ export { useInvertedScale as useDeprecatedInvertedScale } from './value/use-inve
|
|
|
68
80
|
export { delay } from './utils/delay.mjs';
|
|
69
81
|
import * as namespace from './components/Reorder/namespace.mjs';
|
|
70
82
|
export { namespace as Reorder };
|
|
71
|
-
export { hover, isDragActive, press } from 'motion-dom';
|
|
72
|
-
export { invariant, noop, progress } from 'motion-utils';
|
|
83
|
+
export { MotionValue, cancelFrame, frame, frameData, hover, isDragActive, motionValue, press, time } from 'motion-dom';
|
|
73
84
|
export { animate, createScopedAnimate } from './animation/animate/index.mjs';
|
|
74
85
|
export { animateMini } from './animation/animators/waapi/animate-style.mjs';
|
|
75
86
|
export { scroll } from './render/dom/scroll/index.mjs';
|
|
76
87
|
export { scrollInfo } from './render/dom/scroll/track.mjs';
|
|
77
88
|
export { inView } from './render/dom/viewport/index.mjs';
|
|
78
|
-
export { MotionValue, motionValue } from './value/index.mjs';
|
|
79
89
|
export { inertia } from './animation/generators/inertia.mjs';
|
|
80
90
|
export { keyframes } from './animation/generators/keyframes.mjs';
|
|
81
91
|
export { stagger } from './animation/utils/stagger.mjs';
|
|
82
|
-
export { time } from './frameloop/sync-time.mjs';
|
|
83
92
|
export { clamp } from './utils/clamp.mjs';
|
|
84
93
|
export { mix } from './utils/mix/index.mjs';
|
|
85
94
|
export { pipe } from './utils/pipe.mjs';
|
|
86
95
|
export { transform } from './utils/transform.mjs';
|
|
87
96
|
export { wrap } from './utils/wrap.mjs';
|
|
88
|
-
export { cancelSync, sync } from './frameloop/index-legacy.mjs';
|
|
89
97
|
export { anticipate } from './easing/anticipate.mjs';
|
|
90
98
|
export { backIn, backInOut, backOut } from './easing/back.mjs';
|
|
91
99
|
export { circIn, circInOut, circOut } from './easing/circ.mjs';
|
|
@@ -94,18 +102,5 @@ export { easeIn, easeInOut, easeOut } from './easing/ease.mjs';
|
|
|
94
102
|
export { mirrorEasing } from './easing/modifiers/mirror.mjs';
|
|
95
103
|
export { reverseEasing } from './easing/modifiers/reverse.mjs';
|
|
96
104
|
export { steps } from './easing/steps.mjs';
|
|
97
|
-
export { cancelFrame, frame, frameData, frameSteps } from './frameloop/frame.mjs';
|
|
98
105
|
export { distance, distance2D } from './utils/distance.mjs';
|
|
99
106
|
export { interpolate } from './utils/interpolate.mjs';
|
|
100
|
-
export { animations } from './motion/features/animations.mjs';
|
|
101
|
-
export { createBox } from './projection/geometry/models.mjs';
|
|
102
|
-
export { calcLength } from './projection/geometry/delta-calc.mjs';
|
|
103
|
-
export { filterProps } from './render/dom/utils/filter-props.mjs';
|
|
104
|
-
export { makeUseVisualState } from './motion/utils/use-visual-state.mjs';
|
|
105
|
-
export { addPointerEvent } from './events/add-pointer-event.mjs';
|
|
106
|
-
export { addPointerInfo } from './events/event-info.mjs';
|
|
107
|
-
export { isMotionValue } from './value/utils/is-motion-value.mjs';
|
|
108
|
-
export { isBrowser } from './utils/is-browser.mjs';
|
|
109
|
-
export { useUnmountEffect } from './utils/use-unmount-effect.mjs';
|
|
110
|
-
export { useIsomorphicLayoutEffect } from './utils/use-isomorphic-effect.mjs';
|
|
111
|
-
export { useForceUpdate } from './utils/use-force-update.mjs';
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { frame, microtask } from 'motion-dom';
|
|
3
4
|
import { useContext, Component } from 'react';
|
|
4
5
|
import { usePresence } from '../../../components/AnimatePresence/use-presence.mjs';
|
|
5
6
|
import { LayoutGroupContext } from '../../../context/LayoutGroupContext.mjs';
|
|
6
7
|
import { SwitchLayoutGroupContext } from '../../../context/SwitchLayoutGroupContext.mjs';
|
|
7
|
-
import { microtask } from '../../../frameloop/microtask.mjs';
|
|
8
8
|
import { globalProjectionState } from '../../../projection/node/state.mjs';
|
|
9
9
|
import { correctBorderRadius } from '../../../projection/styles/scale-border-radius.mjs';
|
|
10
10
|
import { correctBoxShadow } from '../../../projection/styles/scale-box-shadow.mjs';
|
|
11
11
|
import { addScaleCorrector } from '../../../projection/styles/scale-correction.mjs';
|
|
12
|
-
import { frame } from '../../../frameloop/frame.mjs';
|
|
13
12
|
|
|
14
13
|
class MeasureLayoutWithContext extends Component {
|
|
15
14
|
/**
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { microtask } from 'motion-dom';
|
|
1
2
|
import { useContext, useRef, useInsertionEffect, useEffect } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { MotionContext } from '../../context/MotionContext/index.mjs';
|
|
4
|
-
import { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';
|
|
3
|
+
import { optimizedAppearDataAttribute } from '../../animation/optimized-appear/data-id.mjs';
|
|
5
4
|
import { LazyContext } from '../../context/LazyContext.mjs';
|
|
6
5
|
import { MotionConfigContext } from '../../context/MotionConfigContext.mjs';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { isRefObject } from '../../utils/is-ref-object.mjs';
|
|
6
|
+
import { MotionContext } from '../../context/MotionContext/index.mjs';
|
|
7
|
+
import { PresenceContext } from '../../context/PresenceContext.mjs';
|
|
10
8
|
import { SwitchLayoutGroupContext } from '../../context/SwitchLayoutGroupContext.mjs';
|
|
9
|
+
import { isRefObject } from '../../utils/is-ref-object.mjs';
|
|
10
|
+
import { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';
|
|
11
11
|
|
|
12
12
|
function useVisualElement(Component, visualState, props, createVisualElement, ProjectionNodeConstructor) {
|
|
13
13
|
var _a, _b;
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import { getValueTransition } from 'motion-dom';
|
|
2
|
-
import { noop } from 'motion-utils';
|
|
1
|
+
import { statsBuffer, getValueTransition, cancelFrame, time, frameData, frameSteps, microtask, frame, activeAnimations } from 'motion-dom';
|
|
2
|
+
import { SubscriptionManager, noop } from 'motion-utils';
|
|
3
3
|
import { animateSingleValue } from '../../animation/animate/single-value.mjs';
|
|
4
4
|
import { getOptimisedAppearId } from '../../animation/optimized-appear/get-appear-id.mjs';
|
|
5
|
-
import { cancelFrame, frameData, frameSteps, frame } from '../../frameloop/frame.mjs';
|
|
6
|
-
import { microtask } from '../../frameloop/microtask.mjs';
|
|
7
|
-
import { time } from '../../frameloop/sync-time.mjs';
|
|
8
5
|
import { isSVGElement } from '../../render/dom/utils/is-svg-element.mjs';
|
|
9
6
|
import { FlatTree } from '../../render/utils/flat-tree.mjs';
|
|
10
|
-
import { activeAnimations } from '../../stats/animation-count.mjs';
|
|
11
|
-
import { statsBuffer } from '../../stats/buffer.mjs';
|
|
12
7
|
import { clamp } from '../../utils/clamp.mjs';
|
|
13
8
|
import { delay } from '../../utils/delay.mjs';
|
|
14
9
|
import { mixNumber } from '../../utils/mix/number.mjs';
|
|
15
|
-
import { SubscriptionManager } from '../../utils/subscription-manager.mjs';
|
|
16
10
|
import { resolveMotionValue } from '../../value/utils/resolve-motion-value.mjs';
|
|
17
11
|
import { mixValues } from '../animation/mix-values.mjs';
|
|
18
12
|
import { copyBoxInto, copyAxisDeltaInto } from '../geometry/copy.mjs';
|
package/dist/es/projection.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { frame, frameData, recordStats, statsBuffer } from 'motion-dom';
|
|
1
2
|
export { calcBoxDelta } from './projection/geometry/delta-calc.mjs';
|
|
2
3
|
export { nodeGroup } from './projection/node/group.mjs';
|
|
3
4
|
export { HTMLProjectionNode } from './projection/node/HTMLProjectionNode.mjs';
|
|
@@ -6,8 +7,5 @@ export { correctBoxShadow } from './projection/styles/scale-box-shadow.mjs';
|
|
|
6
7
|
export { addScaleCorrector } from './projection/styles/scale-correction.mjs';
|
|
7
8
|
export { HTMLVisualElement } from './render/html/HTMLVisualElement.mjs';
|
|
8
9
|
export { buildTransform } from './render/html/utils/build-transform.mjs';
|
|
9
|
-
export { recordStats } from './stats/index.mjs';
|
|
10
|
-
export { statsBuffer } from './stats/buffer.mjs';
|
|
11
10
|
export { animateValue as animate } from './animation/animators/MainThreadAnimation.mjs';
|
|
12
11
|
export { mix } from './utils/mix/index.mjs';
|
|
13
|
-
export { frame, frameData } from './frameloop/frame.mjs';
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { time } from '
|
|
1
|
+
import { time, frame, cancelFrame, motionValue } from 'motion-dom';
|
|
2
|
+
import { warnOnce, SubscriptionManager } from 'motion-utils';
|
|
2
3
|
import { featureDefinitions } from '../motion/features/definitions.mjs';
|
|
3
4
|
import { createBox } from '../projection/geometry/models.mjs';
|
|
4
5
|
import { isNumericalString } from '../utils/is-numerical-string.mjs';
|
|
5
6
|
import { isZeroValueString } from '../utils/is-zero-value-string.mjs';
|
|
6
7
|
import { initPrefersReducedMotion } from '../utils/reduced-motion/index.mjs';
|
|
7
8
|
import { hasReducedMotionListener, prefersReducedMotion } from '../utils/reduced-motion/state.mjs';
|
|
8
|
-
import { SubscriptionManager } from '../utils/subscription-manager.mjs';
|
|
9
|
-
import { warnOnce } from '../utils/warn-once.mjs';
|
|
10
|
-
import { motionValue } from '../value/index.mjs';
|
|
11
9
|
import { complex } from '../value/types/complex/index.mjs';
|
|
12
10
|
import { isMotionValue } from '../value/utils/is-motion-value.mjs';
|
|
13
11
|
import { getAnimatableNone } from './dom/value-types/animatable-none.mjs';
|
|
@@ -18,7 +16,6 @@ import { isControllingVariants, isVariantNode } from './utils/is-controlling-var
|
|
|
18
16
|
import { KeyframeResolver } from './utils/KeyframesResolver.mjs';
|
|
19
17
|
import { updateMotionValuesFromProps } from './utils/motion-values.mjs';
|
|
20
18
|
import { resolveVariantFromProps } from './utils/resolve-variants.mjs';
|
|
21
|
-
import { frame, cancelFrame } from '../frameloop/frame.mjs';
|
|
22
19
|
|
|
23
20
|
const propEventHandlers = [
|
|
24
21
|
"AnimationStart",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { isMotionValue } from '../../value/utils/is-motion-value.mjs';
|
|
1
2
|
import { VisualElement } from '../VisualElement.mjs';
|
|
2
3
|
import { DOMKeyframesResolver } from './DOMKeyframesResolver.mjs';
|
|
3
|
-
import { isMotionValue } from '../../value/utils/is-motion-value.mjs';
|
|
4
4
|
|
|
5
5
|
class DOMVisualElement extends VisualElement {
|
|
6
6
|
constructor() {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { progress } from 'motion-utils';
|
|
2
|
-
import { velocityPerSecond } from '../../../utils/velocity-per-second.mjs';
|
|
1
|
+
import { progress, velocityPerSecond } from 'motion-utils';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* A time in milliseconds, beyond which we consider the scroll velocity to be 0.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { frame, cancelFrame, frameData } from 'motion-dom';
|
|
1
2
|
import { resize } from '../resize/index.mjs';
|
|
2
3
|
import { createScrollInfo } from './info.mjs';
|
|
3
4
|
import { createOnScrollHandler } from './on-scroll-handler.mjs';
|
|
4
|
-
import { frame, cancelFrame, frameData } from '../../../frameloop/frame.mjs';
|
|
5
5
|
|
|
6
6
|
const scrollListeners = new WeakMap();
|
|
7
7
|
const resizeListeners = new WeakMap();
|
|
@@ -1,26 +1,9 @@
|
|
|
1
1
|
import { number } from '../../../value/types/numbers/index.mjs';
|
|
2
2
|
import { px } from '../../../value/types/numbers/units.mjs';
|
|
3
3
|
import { transformPropOrder } from '../../html/utils/keys-transform.mjs';
|
|
4
|
+
import { parseValueFromTransform } from '../../html/utils/parse-transform.mjs';
|
|
4
5
|
|
|
5
6
|
const isNumOrPxType = (v) => v === number || v === px;
|
|
6
|
-
const getPosFromMatrix = (matrix, pos) => parseFloat(matrix.split(", ")[pos]);
|
|
7
|
-
const getTranslateFromMatrix = (pos2, pos3) => (_bbox, { transform }) => {
|
|
8
|
-
if (transform === "none" || !transform)
|
|
9
|
-
return 0;
|
|
10
|
-
const matrix3d = transform.match(/^matrix3d\((.+)\)$/u);
|
|
11
|
-
if (matrix3d) {
|
|
12
|
-
return getPosFromMatrix(matrix3d[1], pos3);
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
const matrix = transform.match(/^matrix\((.+)\)$/u);
|
|
16
|
-
if (matrix) {
|
|
17
|
-
return getPosFromMatrix(matrix[1], pos2);
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
return 0;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
7
|
const transformKeys = new Set(["x", "y", "z"]);
|
|
25
8
|
const nonTranslationalTransformKeys = transformPropOrder.filter((key) => !transformKeys.has(key));
|
|
26
9
|
function removeNonTranslationalTransform(visualElement) {
|
|
@@ -43,8 +26,8 @@ const positionalValues = {
|
|
|
43
26
|
bottom: ({ y }, { top }) => parseFloat(top) + (y.max - y.min),
|
|
44
27
|
right: ({ x }, { left }) => parseFloat(left) + (x.max - x.min),
|
|
45
28
|
// Transform
|
|
46
|
-
x:
|
|
47
|
-
y:
|
|
29
|
+
x: (_bbox, { transform }) => parseValueFromTransform(transform, "x"),
|
|
30
|
+
y: (_bbox, { transform }) => parseValueFromTransform(transform, "y"),
|
|
48
31
|
};
|
|
49
32
|
// Alias translate longform names
|
|
50
33
|
positionalValues.translateX = positionalValues.x;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { measureViewportBox } from '../../projection/utils/measure.mjs';
|
|
2
2
|
import { DOMVisualElement } from '../dom/DOMVisualElement.mjs';
|
|
3
3
|
import { isCSSVariableName } from '../dom/utils/is-css-variable.mjs';
|
|
4
|
-
import { getDefaultValueType } from '../dom/value-types/defaults.mjs';
|
|
5
4
|
import { buildHTMLStyles } from './utils/build-styles.mjs';
|
|
6
5
|
import { transformProps } from './utils/keys-transform.mjs';
|
|
6
|
+
import { readTransformValue } from './utils/parse-transform.mjs';
|
|
7
7
|
import { renderHTML } from './utils/render.mjs';
|
|
8
8
|
import { scrapeMotionValuesFromProps } from './utils/scrape-motion-values.mjs';
|
|
9
9
|
|
|
@@ -18,8 +18,7 @@ class HTMLVisualElement extends DOMVisualElement {
|
|
|
18
18
|
}
|
|
19
19
|
readValueFromInstance(instance, key) {
|
|
20
20
|
if (transformProps.has(key)) {
|
|
21
|
-
|
|
22
|
-
return defaultType ? defaultType.default || 0 : 0;
|
|
21
|
+
return readTransformValue(instance, key);
|
|
23
22
|
}
|
|
24
23
|
else {
|
|
25
24
|
const computedStyle = getComputedStyle(instance);
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
const radToDeg = (rad) => (rad * 180) / Math.PI;
|
|
2
|
+
const rotate = (v) => {
|
|
3
|
+
const angle = radToDeg(Math.atan2(v[1], v[0]));
|
|
4
|
+
return rebaseAngle(angle);
|
|
5
|
+
};
|
|
6
|
+
const matrix2dParsers = {
|
|
7
|
+
x: 4,
|
|
8
|
+
y: 5,
|
|
9
|
+
translateX: 4,
|
|
10
|
+
translateY: 5,
|
|
11
|
+
scaleX: 0,
|
|
12
|
+
scaleY: 3,
|
|
13
|
+
scale: (v) => (Math.abs(v[0]) + Math.abs(v[3])) / 2,
|
|
14
|
+
rotate,
|
|
15
|
+
rotateZ: rotate,
|
|
16
|
+
skewX: (v) => radToDeg(Math.atan(v[1])),
|
|
17
|
+
skewY: (v) => radToDeg(Math.atan(v[2])),
|
|
18
|
+
skew: (v) => (Math.abs(v[1]) + Math.abs(v[2])) / 2,
|
|
19
|
+
};
|
|
20
|
+
const rebaseAngle = (angle) => {
|
|
21
|
+
angle = angle % 360;
|
|
22
|
+
if (angle < 0)
|
|
23
|
+
angle += 360;
|
|
24
|
+
return angle;
|
|
25
|
+
};
|
|
26
|
+
const rotateZ = rotate;
|
|
27
|
+
const scaleX = (v) => Math.sqrt(v[0] * v[0] + v[1] * v[1]);
|
|
28
|
+
const scaleY = (v) => Math.sqrt(v[4] * v[4] + v[5] * v[5]);
|
|
29
|
+
const matrix3dParsers = {
|
|
30
|
+
x: 12,
|
|
31
|
+
y: 13,
|
|
32
|
+
z: 14,
|
|
33
|
+
translateX: 12,
|
|
34
|
+
translateY: 13,
|
|
35
|
+
translateZ: 14,
|
|
36
|
+
scaleX,
|
|
37
|
+
scaleY,
|
|
38
|
+
scale: (v) => (scaleX(v) + scaleY(v)) / 2,
|
|
39
|
+
rotateX: (v) => rebaseAngle(radToDeg(Math.atan2(v[6], v[5]))),
|
|
40
|
+
rotateY: (v) => rebaseAngle(radToDeg(Math.atan2(-v[2], v[0]))),
|
|
41
|
+
rotateZ,
|
|
42
|
+
rotate: rotateZ,
|
|
43
|
+
skewX: (v) => radToDeg(Math.atan(v[4])),
|
|
44
|
+
skewY: (v) => radToDeg(Math.atan(v[1])),
|
|
45
|
+
skew: (v) => (Math.abs(v[1]) + Math.abs(v[4])) / 2,
|
|
46
|
+
};
|
|
47
|
+
function defaultTransformValue(name) {
|
|
48
|
+
return name.includes("scale") ? 1 : 0;
|
|
49
|
+
}
|
|
50
|
+
function parseValueFromTransform(transform, name) {
|
|
51
|
+
if (!transform || transform === "none") {
|
|
52
|
+
return defaultTransformValue(name);
|
|
53
|
+
}
|
|
54
|
+
const matrix3dMatch = transform.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);
|
|
55
|
+
let parsers;
|
|
56
|
+
let match;
|
|
57
|
+
if (matrix3dMatch) {
|
|
58
|
+
parsers = matrix3dParsers;
|
|
59
|
+
match = matrix3dMatch;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
const matrix2dMatch = transform.match(/^matrix\(([-\d.e\s,]+)\)$/u);
|
|
63
|
+
parsers = matrix2dParsers;
|
|
64
|
+
match = matrix2dMatch;
|
|
65
|
+
}
|
|
66
|
+
if (!match) {
|
|
67
|
+
return defaultTransformValue(name);
|
|
68
|
+
}
|
|
69
|
+
const valueParser = parsers[name];
|
|
70
|
+
const values = match[1].split(",").map(convertTransformToNumber);
|
|
71
|
+
return typeof valueParser === "function"
|
|
72
|
+
? valueParser(values)
|
|
73
|
+
: values[valueParser];
|
|
74
|
+
}
|
|
75
|
+
const readTransformValue = (instance, name) => {
|
|
76
|
+
const { transform = "none" } = getComputedStyle(instance);
|
|
77
|
+
return parseValueFromTransform(transform, name);
|
|
78
|
+
};
|
|
79
|
+
function convertTransformToNumber(value) {
|
|
80
|
+
return parseFloat(value.trim());
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { parseValueFromTransform, readTransformValue };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { frame } from '
|
|
1
|
+
import { frame } from 'motion-dom';
|
|
2
2
|
import { createBox } from '../../projection/geometry/models.mjs';
|
|
3
3
|
import { DOMVisualElement } from '../dom/DOMVisualElement.mjs';
|
|
4
4
|
import { camelToDash } from '../dom/utils/camel-to-dash.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { frame } from '
|
|
1
|
+
import { frame } from 'motion-dom';
|
|
2
2
|
import { makeUseVisualState } from '../../motion/utils/use-visual-state.mjs';
|
|
3
3
|
import { transformProps } from '../html/utils/keys-transform.mjs';
|
|
4
4
|
import { buildSVGAttrs } from './utils/build-attrs.mjs';
|