framer-motion 12.7.4 → 12.7.5-alpha.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/README.md +1 -1
- package/dist/cjs/client.js +1 -1
- package/dist/cjs/{create-BErHrlzf.js → create-D5a67TOR.js} +99 -2828
- package/dist/cjs/dom-mini.js +82 -66
- package/dist/cjs/dom.js +276 -3011
- package/dist/cjs/index.js +149 -206
- package/dist/cjs/m.js +13 -170
- package/dist/cjs/mini.js +77 -9
- package/dist/dom-mini.js +1 -1
- package/dist/dom.d.ts +5 -94
- package/dist/dom.js +1 -1
- package/dist/es/animation/animate/sequence.mjs +1 -1
- package/dist/es/animation/animators/waapi/animate-elements.mjs +78 -10
- package/dist/es/animation/interfaces/motion-value.mjs +11 -30
- package/dist/es/animation/interfaces/visual-element-target.mjs +1 -2
- package/dist/es/animation/optimized-appear/store-id.mjs +1 -1
- package/dist/es/animation/sequence/create.mjs +2 -5
- package/dist/es/animation/sequence/utils/edit.mjs +2 -3
- package/dist/es/animation/utils/default-transitions.mjs +1 -1
- package/dist/es/animation/utils/stagger.mjs +1 -1
- package/dist/es/components/Reorder/utils/check-reorder.mjs +1 -1
- package/dist/es/dom.mjs +2 -18
- package/dist/es/gestures/drag/VisualElementDragControls.mjs +1 -3
- package/dist/es/gestures/drag/utils/constraints.mjs +2 -3
- package/dist/es/gestures/focus.mjs +1 -1
- package/dist/es/gestures/pan/PanSession.mjs +1 -2
- package/dist/es/index.mjs +3 -24
- package/dist/es/motion/utils/is-forced-motion-value.mjs +1 -1
- package/dist/es/projection/animation/mix-values.mjs +2 -4
- package/dist/es/projection/geometry/delta-apply.mjs +1 -1
- package/dist/es/projection/geometry/delta-calc.mjs +1 -1
- package/dist/es/projection/geometry/delta-remove.mjs +1 -2
- package/dist/es/projection/node/create-projection-node.mjs +3 -7
- package/dist/es/projection/styles/scale-border-radius.mjs +1 -1
- package/dist/es/projection/styles/scale-box-shadow.mjs +1 -2
- package/dist/es/projection/styles/scale-correction.mjs +1 -1
- package/dist/es/projection.mjs +1 -3
- package/dist/es/render/VisualElement.mjs +2 -9
- package/dist/es/render/dom/DOMVisualElement.mjs +1 -1
- package/dist/es/render/dom/scroll/attach-animation.mjs +17 -0
- package/dist/es/render/dom/scroll/attach-function.mjs +23 -0
- package/dist/es/render/dom/scroll/index.mjs +6 -82
- package/dist/es/render/dom/scroll/offsets/index.mjs +2 -3
- package/dist/es/render/dom/scroll/utils/get-timeline.mjs +30 -0
- package/dist/es/render/html/HTMLVisualElement.mjs +1 -3
- package/dist/es/render/html/utils/build-styles.mjs +1 -4
- package/dist/es/render/html/utils/build-transform.mjs +1 -3
- package/dist/es/render/svg/SVGVisualElement.mjs +1 -3
- package/dist/es/render/svg/config-motion.mjs +1 -2
- package/dist/es/render/svg/utils/path.mjs +1 -1
- package/dist/es/render/svg/utils/scrape-motion-values.mjs +1 -1
- package/dist/es/render/svg/utils/transform-origin.mjs +1 -1
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/utils/delay.mjs +1 -1
- package/dist/es/utils/transform.mjs +1 -1
- package/dist/es/utils/use-cycle.mjs +1 -1
- package/dist/es/utils/use-instant-transition.mjs +4 -4
- package/dist/es/value/use-spring.mjs +2 -3
- package/dist/es/value/use-will-change/get-will-change-name.mjs +1 -2
- package/dist/framer-motion.dev.js +3864 -3405
- package/dist/framer-motion.js +1 -1
- package/dist/m.d.ts +3 -50
- package/dist/mini.js +1 -1
- 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/size-rollup-waapi-animate.js +1 -1
- package/dist/types/client.d.ts +4 -3
- package/dist/types/index.d.ts +56 -351
- package/dist/{types.d-B50aGbjN.d.ts → types.d-B1Voffvi.d.ts} +3 -138
- package/package.json +9 -9
- package/dist/es/animation/animators/AcceleratedAnimation.mjs +0 -319
- package/dist/es/animation/animators/BaseAnimation.mjs +0 -120
- package/dist/es/animation/animators/MainThreadAnimation.mjs +0 -394
- package/dist/es/animation/animators/drivers/driver-frameloop.mjs +0 -16
- package/dist/es/animation/animators/utils/accelerated-values.mjs +0 -14
- package/dist/es/animation/animators/utils/can-animate.mjs +0 -42
- package/dist/es/animation/animators/waapi/utils/supports-waapi.mjs +0 -5
- package/dist/es/animation/generators/inertia.mjs +0 -87
- package/dist/es/animation/generators/keyframes.mjs +0 -51
- package/dist/es/animation/generators/spring/defaults.mjs +0 -27
- package/dist/es/animation/generators/spring/find.mjs +0 -85
- package/dist/es/animation/generators/spring/index.mjs +0 -174
- package/dist/es/animation/generators/utils/velocity.mjs +0 -9
- package/dist/es/animation/utils/is-animatable.mjs +0 -30
- package/dist/es/animation/utils/is-none.mjs +0 -15
- package/dist/es/easing/anticipate.mjs +0 -5
- package/dist/es/easing/back.mjs +0 -9
- package/dist/es/easing/circ.mjs +0 -8
- package/dist/es/easing/cubic-bezier.mjs +0 -51
- package/dist/es/easing/ease.mjs +0 -7
- package/dist/es/easing/modifiers/mirror.mjs +0 -5
- package/dist/es/easing/modifiers/reverse.mjs +0 -5
- package/dist/es/easing/steps.mjs +0 -15
- package/dist/es/easing/utils/get-easing-for-segment.mjs +0 -8
- package/dist/es/easing/utils/is-easing-array.mjs +0 -5
- package/dist/es/easing/utils/map.mjs +0 -37
- package/dist/es/render/dom/DOMKeyframesResolver.mjs +0 -130
- package/dist/es/render/dom/scroll/observe.mjs +0 -18
- package/dist/es/render/dom/utils/css-variables-conversion.mjs +0 -42
- package/dist/es/render/dom/utils/is-css-variable.mjs +0 -15
- package/dist/es/render/dom/utils/unit-conversion.mjs +0 -36
- package/dist/es/render/dom/value-types/animatable-none.mjs +0 -15
- package/dist/es/render/dom/value-types/defaults.mjs +0 -30
- package/dist/es/render/dom/value-types/dimensions.mjs +0 -15
- package/dist/es/render/dom/value-types/find.mjs +0 -15
- package/dist/es/render/dom/value-types/get-as-type.mjs +0 -10
- package/dist/es/render/dom/value-types/number-browser.mjs +0 -41
- package/dist/es/render/dom/value-types/number.mjs +0 -18
- package/dist/es/render/dom/value-types/test.mjs +0 -6
- package/dist/es/render/dom/value-types/transform.mjs +0 -31
- package/dist/es/render/dom/value-types/type-auto.mjs +0 -9
- package/dist/es/render/dom/value-types/type-int.mjs +0 -8
- package/dist/es/render/html/utils/keys-position.mjs +0 -13
- package/dist/es/render/html/utils/keys-transform.mjs +0 -28
- package/dist/es/render/html/utils/make-none-animatable.mjs +0 -30
- package/dist/es/render/html/utils/parse-transform.mjs +0 -83
- package/dist/es/render/utils/KeyframesResolver.mjs +0 -163
- package/dist/es/utils/clamp.mjs +0 -9
- package/dist/es/utils/hsla-to-rgba.mjs +0 -42
- package/dist/es/utils/interpolate.mjs +0 -76
- package/dist/es/utils/is-numerical-string.mjs +0 -6
- package/dist/es/utils/is-zero-value-string.mjs +0 -6
- package/dist/es/utils/mix/color.mjs +0 -47
- package/dist/es/utils/mix/complex.mjs +0 -93
- package/dist/es/utils/mix/immediate.mjs +0 -5
- package/dist/es/utils/mix/index.mjs +0 -14
- package/dist/es/utils/mix/number.mjs +0 -26
- package/dist/es/utils/mix/visibility.mjs +0 -16
- package/dist/es/utils/offsets/default.mjs +0 -9
- package/dist/es/utils/offsets/fill.mjs +0 -12
- package/dist/es/utils/offsets/time.mjs +0 -5
- package/dist/es/utils/pipe.mjs +0 -11
- package/dist/es/utils/use-instant-transition-state.mjs +0 -5
- package/dist/es/utils/wrap.mjs +0 -6
- package/dist/es/value/types/color/hex.mjs +0 -40
- package/dist/es/value/types/color/hsla.mjs +0 -22
- package/dist/es/value/types/color/index.mjs +0 -27
- package/dist/es/value/types/color/rgba.mjs +0 -25
- package/dist/es/value/types/color/utils.mjs +0 -29
- package/dist/es/value/types/complex/filter.mjs +0 -30
- package/dist/es/value/types/complex/index.mjs +0 -91
- package/dist/es/value/types/numbers/index.mjs +0 -17
- package/dist/es/value/types/numbers/units.mjs +0 -17
- package/dist/es/value/types/utils/color-regex.mjs +0 -3
- package/dist/es/value/types/utils/float-regex.mjs +0 -3
- package/dist/es/value/types/utils/is-nullish.mjs +0 -5
- package/dist/es/value/types/utils/sanitize.mjs +0 -5
- package/dist/es/value/types/utils/single-color-regex.mjs +0 -3
package/dist/es/dom.mjs
CHANGED
|
@@ -1,27 +1,11 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from 'motion-dom';
|
|
2
|
+
export * 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 { anticipate } from './easing/anticipate.mjs';
|
|
9
|
-
export { backIn, backInOut, backOut } from './easing/back.mjs';
|
|
10
|
-
export { circIn, circInOut, circOut } from './easing/circ.mjs';
|
|
11
|
-
export { cubicBezier } from './easing/cubic-bezier.mjs';
|
|
12
|
-
export { easeIn, easeInOut, easeOut } from './easing/ease.mjs';
|
|
13
|
-
export { mirrorEasing } from './easing/modifiers/mirror.mjs';
|
|
14
|
-
export { reverseEasing } from './easing/modifiers/reverse.mjs';
|
|
15
|
-
export { steps } from './easing/steps.mjs';
|
|
16
|
-
export { inertia } from './animation/generators/inertia.mjs';
|
|
17
|
-
export { keyframes } from './animation/generators/keyframes.mjs';
|
|
18
|
-
export { spring } from './animation/generators/spring/index.mjs';
|
|
19
8
|
export { stagger } from './animation/utils/stagger.mjs';
|
|
20
|
-
export { clamp } from './utils/clamp.mjs';
|
|
21
9
|
export { delayInSeconds as delay } from './utils/delay.mjs';
|
|
22
10
|
export { distance, distance2D } from './utils/distance.mjs';
|
|
23
|
-
export { interpolate } from './utils/interpolate.mjs';
|
|
24
|
-
export { mix } from './utils/mix/index.mjs';
|
|
25
|
-
export { pipe } from './utils/pipe.mjs';
|
|
26
11
|
export { transform } from './utils/transform.mjs';
|
|
27
|
-
export { wrap } from './utils/wrap.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { frame, setDragLock } from 'motion-dom';
|
|
1
|
+
import { frame, mixNumber, setDragLock, percent } 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';
|
|
@@ -11,8 +11,6 @@ import { eachAxis } from '../../projection/utils/each-axis.mjs';
|
|
|
11
11
|
import { measurePageBox } from '../../projection/utils/measure.mjs';
|
|
12
12
|
import { getContextWindow } from '../../utils/get-context-window.mjs';
|
|
13
13
|
import { isRefObject } from '../../utils/is-ref-object.mjs';
|
|
14
|
-
import { mixNumber } from '../../utils/mix/number.mjs';
|
|
15
|
-
import { percent } from '../../value/types/numbers/units.mjs';
|
|
16
14
|
import { addValueToWillChange } from '../../value/use-will-change/add-will-change.mjs';
|
|
17
15
|
import { PanSession } from '../pan/PanSession.mjs';
|
|
18
16
|
import { applyConstraints, calcRelativeConstraints, resolveDragElastic, rebaseAxisConstraints, calcViewportConstraints, calcOrigin, defaultElastic } from './utils/constraints.mjs';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { mixNumber } from 'motion-dom';
|
|
2
|
+
import { progress, clamp } from 'motion-utils';
|
|
2
3
|
import { calcLength } from '../../../projection/geometry/delta-calc.mjs';
|
|
3
|
-
import { clamp } from '../../../utils/clamp.mjs';
|
|
4
|
-
import { mixNumber } from '../../../utils/mix/number.mjs';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Apply constraints to a point. These constraints are both physical along an
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { frame, isPrimaryPointer, cancelFrame, frameData } from 'motion-dom';
|
|
2
|
-
import { secondsToMilliseconds, millisecondsToSeconds } from 'motion-utils';
|
|
2
|
+
import { pipe, 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
|
-
import { pipe } from '../../utils/pipe.mjs';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* @internal
|
package/dist/es/index.mjs
CHANGED
|
@@ -35,9 +35,8 @@ export { WillChangeMotionValue } from './value/use-will-change/WillChangeMotionV
|
|
|
35
35
|
export { resolveMotionValue } from './value/utils/resolve-motion-value.mjs';
|
|
36
36
|
export { useReducedMotion } from './utils/reduced-motion/use-reduced-motion.mjs';
|
|
37
37
|
export { useReducedMotionConfig } from './utils/reduced-motion/use-reduced-motion-config.mjs';
|
|
38
|
-
export
|
|
39
|
-
export {
|
|
40
|
-
export { animateValue } from './animation/animators/MainThreadAnimation.mjs';
|
|
38
|
+
export * from 'motion-utils';
|
|
39
|
+
export { MotionGlobalConfig } from 'motion-utils';
|
|
41
40
|
export { animationControls } from './animation/hooks/animation-controls.mjs';
|
|
42
41
|
export { useAnimate } from './animation/hooks/use-animate.mjs';
|
|
43
42
|
export { useAnimateMini } from './animation/hooks/use-animate-style.mjs';
|
|
@@ -61,11 +60,6 @@ export { useAnimationFrame } from './utils/use-animation-frame.mjs';
|
|
|
61
60
|
export { useCycle } from './utils/use-cycle.mjs';
|
|
62
61
|
export { useInView } from './utils/use-in-view.mjs';
|
|
63
62
|
export { disableInstantTransitions, useInstantTransition } from './utils/use-instant-transition.mjs';
|
|
64
|
-
export { color } from './value/types/color/index.mjs';
|
|
65
|
-
export { complex } from './value/types/complex/index.mjs';
|
|
66
|
-
export { px } from './value/types/numbers/units.mjs';
|
|
67
|
-
export { spring } from './animation/generators/spring/index.mjs';
|
|
68
|
-
export { findSpring } from './animation/generators/spring/find.mjs';
|
|
69
63
|
export { optimizedAppearDataAttribute } from './animation/optimized-appear/data-id.mjs';
|
|
70
64
|
export { startOptimizedAppearAnimation } from './animation/optimized-appear/start.mjs';
|
|
71
65
|
export { LayoutGroupContext } from './context/LayoutGroupContext.mjs';
|
|
@@ -81,27 +75,12 @@ export { useInvertedScale as useDeprecatedInvertedScale } from './value/use-inve
|
|
|
81
75
|
export { delay } from './utils/delay.mjs';
|
|
82
76
|
import * as namespace from './components/Reorder/namespace.mjs';
|
|
83
77
|
export { namespace as Reorder };
|
|
84
|
-
export { MotionValue, cancelFrame, cancelSync, frame, frameData, hover, isDragActive, motionValue, press, sync, time } from 'motion-dom';
|
|
85
78
|
export { animate, createScopedAnimate } from './animation/animate/index.mjs';
|
|
86
79
|
export { animateMini } from './animation/animators/waapi/animate-style.mjs';
|
|
87
80
|
export { scroll } from './render/dom/scroll/index.mjs';
|
|
88
81
|
export { scrollInfo } from './render/dom/scroll/track.mjs';
|
|
89
82
|
export { inView } from './render/dom/viewport/index.mjs';
|
|
90
|
-
export { inertia } from './animation/generators/inertia.mjs';
|
|
91
|
-
export { keyframes } from './animation/generators/keyframes.mjs';
|
|
92
83
|
export { stagger } from './animation/utils/stagger.mjs';
|
|
93
|
-
export { clamp } from './utils/clamp.mjs';
|
|
94
|
-
export { mix } from './utils/mix/index.mjs';
|
|
95
|
-
export { pipe } from './utils/pipe.mjs';
|
|
96
84
|
export { transform } from './utils/transform.mjs';
|
|
97
|
-
export { wrap } from './utils/wrap.mjs';
|
|
98
|
-
export { anticipate } from './easing/anticipate.mjs';
|
|
99
|
-
export { backIn, backInOut, backOut } from './easing/back.mjs';
|
|
100
|
-
export { circIn, circInOut, circOut } from './easing/circ.mjs';
|
|
101
|
-
export { cubicBezier } from './easing/cubic-bezier.mjs';
|
|
102
|
-
export { easeIn, easeInOut, easeOut } from './easing/ease.mjs';
|
|
103
|
-
export { mirrorEasing } from './easing/modifiers/mirror.mjs';
|
|
104
|
-
export { reverseEasing } from './easing/modifiers/reverse.mjs';
|
|
105
|
-
export { steps } from './easing/steps.mjs';
|
|
106
85
|
export { distance, distance2D } from './utils/distance.mjs';
|
|
107
|
-
export
|
|
86
|
+
export * from 'motion-dom';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { transformProps } from 'motion-dom';
|
|
1
2
|
import { scaleCorrectors } from '../../projection/styles/scale-correction.mjs';
|
|
2
|
-
import { transformProps } from '../../render/html/utils/keys-transform.mjs';
|
|
3
3
|
|
|
4
4
|
function isForcedMotionValue(key, { layout, layoutId }) {
|
|
5
5
|
return (transformProps.has(key) ||
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { circOut } from '
|
|
3
|
-
import { mixNumber } from '../../utils/mix/number.mjs';
|
|
4
|
-
import { percent, px } from '../../value/types/numbers/units.mjs';
|
|
1
|
+
import { mixNumber, percent, px } from 'motion-dom';
|
|
2
|
+
import { progress, circOut, noop } from 'motion-utils';
|
|
5
3
|
|
|
6
4
|
const borders = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"];
|
|
7
5
|
const numBorders = borders.length;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { statsBuffer, getValueTransition, cancelFrame, time, frameData, frameSteps, microtask, frame, activeAnimations } from 'motion-dom';
|
|
2
|
-
import { SubscriptionManager, noop } from 'motion-utils';
|
|
1
|
+
import { statsBuffer, getValueTransition, cancelFrame, time, frameData, frameSteps, microtask, frame, activeAnimations, mixNumber } from 'motion-dom';
|
|
2
|
+
import { SubscriptionManager, clamp, 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
5
|
import { isSVGElement } from '../../render/dom/utils/is-svg-element.mjs';
|
|
6
6
|
import { FlatTree } from '../../render/utils/flat-tree.mjs';
|
|
7
|
-
import { clamp } from '../../utils/clamp.mjs';
|
|
8
7
|
import { delay } from '../../utils/delay.mjs';
|
|
9
|
-
import { mixNumber } from '../../utils/mix/number.mjs';
|
|
10
8
|
import { resolveMotionValue } from '../../value/utils/resolve-motion-value.mjs';
|
|
11
9
|
import { mixValues } from '../animation/mix-values.mjs';
|
|
12
10
|
import { copyBoxInto, copyAxisDeltaInto } from '../geometry/copy.mjs';
|
|
@@ -994,9 +992,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
994
992
|
}
|
|
995
993
|
setAnimationOrigin(delta, hasOnlyRelativeTargetChanged = false) {
|
|
996
994
|
const snapshot = this.snapshot;
|
|
997
|
-
const snapshotLatestValues = snapshot
|
|
998
|
-
? snapshot.latestValues
|
|
999
|
-
: {};
|
|
995
|
+
const snapshotLatestValues = snapshot ? snapshot.latestValues : {};
|
|
1000
996
|
const mixedValues = { ...this.latestValues };
|
|
1001
997
|
const targetDelta = createDelta();
|
|
1002
998
|
if (!this.relativeParent ||
|
package/dist/es/projection.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { frame, frameData, recordStats, statsBuffer } from 'motion-dom';
|
|
1
|
+
export { frame, frameData, mix, recordStats, statsBuffer } from 'motion-dom';
|
|
2
2
|
export { calcBoxDelta } from './projection/geometry/delta-calc.mjs';
|
|
3
3
|
export { nodeGroup } from './projection/node/group.mjs';
|
|
4
4
|
export { HTMLProjectionNode } from './projection/node/HTMLProjectionNode.mjs';
|
|
@@ -7,5 +7,3 @@ export { correctBoxShadow } from './projection/styles/scale-box-shadow.mjs';
|
|
|
7
7
|
export { addScaleCorrector } from './projection/styles/scale-correction.mjs';
|
|
8
8
|
export { HTMLVisualElement } from './render/html/HTMLVisualElement.mjs';
|
|
9
9
|
export { buildTransform } from './render/html/utils/build-transform.mjs';
|
|
10
|
-
export { animateValue as animate } from './animation/animators/MainThreadAnimation.mjs';
|
|
11
|
-
export { mix } from './utils/mix/index.mjs';
|
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
import { time, frame, cancelFrame, motionValue } from 'motion-dom';
|
|
2
|
-
import { warnOnce, SubscriptionManager } from 'motion-utils';
|
|
1
|
+
import { KeyframeResolver, time, frame, cancelFrame, transformProps, motionValue, findValueType, complex, getAnimatableNone } from 'motion-dom';
|
|
2
|
+
import { warnOnce, isNumericalString, isZeroValueString, SubscriptionManager } from 'motion-utils';
|
|
3
3
|
import { featureDefinitions } from '../motion/features/definitions.mjs';
|
|
4
4
|
import { createBox } from '../projection/geometry/models.mjs';
|
|
5
|
-
import { isNumericalString } from '../utils/is-numerical-string.mjs';
|
|
6
|
-
import { isZeroValueString } from '../utils/is-zero-value-string.mjs';
|
|
7
5
|
import { initPrefersReducedMotion } from '../utils/reduced-motion/index.mjs';
|
|
8
6
|
import { hasReducedMotionListener, prefersReducedMotion } from '../utils/reduced-motion/state.mjs';
|
|
9
|
-
import { complex } from '../value/types/complex/index.mjs';
|
|
10
7
|
import { isMotionValue } from '../value/utils/is-motion-value.mjs';
|
|
11
|
-
import { getAnimatableNone } from './dom/value-types/animatable-none.mjs';
|
|
12
|
-
import { findValueType } from './dom/value-types/find.mjs';
|
|
13
|
-
import { transformProps } from './html/utils/keys-transform.mjs';
|
|
14
8
|
import { visualElementStore } from './store.mjs';
|
|
15
9
|
import { isControllingVariants, isVariantNode } from './utils/is-controlling-variants.mjs';
|
|
16
|
-
import { KeyframeResolver } from './utils/KeyframesResolver.mjs';
|
|
17
10
|
import { updateMotionValuesFromProps } from './utils/motion-values.mjs';
|
|
18
11
|
import { resolveVariantFromProps } from './utils/resolve-variants.mjs';
|
|
19
12
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { DOMKeyframesResolver } from 'motion-dom';
|
|
1
2
|
import { isMotionValue } from '../../value/utils/is-motion-value.mjs';
|
|
2
3
|
import { VisualElement } from '../VisualElement.mjs';
|
|
3
|
-
import { DOMKeyframesResolver } from './DOMKeyframesResolver.mjs';
|
|
4
4
|
|
|
5
5
|
class DOMVisualElement extends VisualElement {
|
|
6
6
|
constructor() {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { observeTimeline } from 'motion-dom';
|
|
2
|
+
import { getTimeline } from './utils/get-timeline.mjs';
|
|
3
|
+
|
|
4
|
+
function attachToAnimation(animation, options) {
|
|
5
|
+
const timeline = getTimeline(options);
|
|
6
|
+
return animation.attachTimeline({
|
|
7
|
+
timeline: options.target ? undefined : timeline,
|
|
8
|
+
observe: (valueAnimation) => {
|
|
9
|
+
valueAnimation.pause();
|
|
10
|
+
return observeTimeline((progress) => {
|
|
11
|
+
valueAnimation.time = valueAnimation.duration * progress;
|
|
12
|
+
}, timeline);
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { attachToAnimation };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { observeTimeline } from 'motion-dom';
|
|
2
|
+
import { scrollInfo } from './track.mjs';
|
|
3
|
+
import { getTimeline } from './utils/get-timeline.mjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* If the onScroll function has two arguments, it's expecting
|
|
7
|
+
* more specific information about the scroll from scrollInfo.
|
|
8
|
+
*/
|
|
9
|
+
function isOnScrollWithInfo(onScroll) {
|
|
10
|
+
return onScroll.length === 2;
|
|
11
|
+
}
|
|
12
|
+
function attachToFunction(onScroll, options) {
|
|
13
|
+
if (isOnScrollWithInfo(onScroll)) {
|
|
14
|
+
return scrollInfo((info) => {
|
|
15
|
+
onScroll(info[options.axis].progress, info);
|
|
16
|
+
}, options);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
return observeTimeline(onScroll, getTimeline(options));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { attachToFunction };
|
|
@@ -1,87 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { observeTimeline } from './observe.mjs';
|
|
4
|
-
import { scrollInfo } from './track.mjs';
|
|
1
|
+
import { attachToAnimation } from './attach-animation.mjs';
|
|
2
|
+
import { attachToFunction } from './attach-function.mjs';
|
|
5
3
|
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
if (source)
|
|
9
|
-
container = source;
|
|
10
|
-
// ScrollTimeline records progress as a percentage CSSUnitValue
|
|
11
|
-
const currentTime = { value: 0 };
|
|
12
|
-
const cancel = scrollInfo((info) => {
|
|
13
|
-
currentTime.value = info[axis].progress * 100;
|
|
14
|
-
}, { container, axis });
|
|
15
|
-
return { currentTime, cancel };
|
|
16
|
-
}
|
|
17
|
-
const timelineCache = new Map();
|
|
18
|
-
function getTimeline({ source, container = document.documentElement, axis = "y", } = {}) {
|
|
19
|
-
// Support legacy source argument. Deprecate later.
|
|
20
|
-
if (source)
|
|
21
|
-
container = source;
|
|
22
|
-
if (!timelineCache.has(container)) {
|
|
23
|
-
timelineCache.set(container, {});
|
|
24
|
-
}
|
|
25
|
-
const elementCache = timelineCache.get(container);
|
|
26
|
-
if (!elementCache[axis]) {
|
|
27
|
-
elementCache[axis] = supportsScrollTimeline()
|
|
28
|
-
? new ScrollTimeline({ source: container, axis })
|
|
29
|
-
: scrollTimelineFallback({ source: container, axis });
|
|
30
|
-
}
|
|
31
|
-
return elementCache[axis];
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* If the onScroll function has two arguments, it's expecting
|
|
35
|
-
* more specific information about the scroll from scrollInfo.
|
|
36
|
-
*/
|
|
37
|
-
function isOnScrollWithInfo(onScroll) {
|
|
38
|
-
return onScroll.length === 2;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Currently, we only support element tracking with `scrollInfo`, though in
|
|
42
|
-
* the future we can also offer ViewTimeline support.
|
|
43
|
-
*/
|
|
44
|
-
function needsElementTracking(options) {
|
|
45
|
-
return options && (options.target || options.offset);
|
|
46
|
-
}
|
|
47
|
-
function scrollFunction(onScroll, options) {
|
|
48
|
-
if (isOnScrollWithInfo(onScroll) || needsElementTracking(options)) {
|
|
49
|
-
return scrollInfo((info) => {
|
|
50
|
-
onScroll(info[options.axis].progress, info);
|
|
51
|
-
}, options);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
return observeTimeline(onScroll, getTimeline(options));
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function scrollAnimation(animation, options) {
|
|
58
|
-
animation.flatten();
|
|
59
|
-
if (needsElementTracking(options)) {
|
|
60
|
-
animation.pause();
|
|
61
|
-
return scrollInfo((info) => {
|
|
62
|
-
animation.time = animation.duration * info[options.axis].progress;
|
|
63
|
-
}, options);
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
const timeline = getTimeline(options);
|
|
67
|
-
if (animation.attachTimeline) {
|
|
68
|
-
return animation.attachTimeline(timeline, (valueAnimation) => {
|
|
69
|
-
valueAnimation.pause();
|
|
70
|
-
return observeTimeline((progress) => {
|
|
71
|
-
valueAnimation.time = valueAnimation.duration * progress;
|
|
72
|
-
}, timeline);
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
return noop;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
function scroll(onScroll, { axis = "y", ...options } = {}) {
|
|
81
|
-
const optionsWithDefaults = { axis, ...options };
|
|
4
|
+
function scroll(onScroll, { axis = "y", container = document.documentElement, ...options } = {}) {
|
|
5
|
+
const optionsWithDefaults = { axis, container, ...options };
|
|
82
6
|
return typeof onScroll === "function"
|
|
83
|
-
?
|
|
84
|
-
:
|
|
7
|
+
? attachToFunction(onScroll, optionsWithDefaults)
|
|
8
|
+
: attachToAnimation(onScroll, optionsWithDefaults);
|
|
85
9
|
}
|
|
86
10
|
|
|
87
11
|
export { scroll };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { defaultOffset } from '../../../../utils/offsets/default.mjs';
|
|
1
|
+
import { interpolate, defaultOffset } from 'motion-dom';
|
|
2
|
+
import { clamp } from 'motion-utils';
|
|
4
3
|
import { calcInset } from './inset.mjs';
|
|
5
4
|
import { resolveOffset } from './offset.mjs';
|
|
6
5
|
import { ScrollOffset } from './presets.mjs';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { supportsScrollTimeline } from 'motion-dom';
|
|
2
|
+
import { scrollInfo } from '../track.mjs';
|
|
3
|
+
|
|
4
|
+
const timelineCache = new Map();
|
|
5
|
+
function scrollTimelineFallback(options) {
|
|
6
|
+
const currentTime = { value: 0 };
|
|
7
|
+
const cancel = scrollInfo((info) => {
|
|
8
|
+
currentTime.value = info[options.axis].progress * 100;
|
|
9
|
+
}, options);
|
|
10
|
+
return { currentTime, cancel };
|
|
11
|
+
}
|
|
12
|
+
function getTimeline({ source, container, ...options }) {
|
|
13
|
+
const { axis } = options;
|
|
14
|
+
if (source)
|
|
15
|
+
container = source;
|
|
16
|
+
const containerCache = timelineCache.get(container) ?? new Map();
|
|
17
|
+
timelineCache.set(container, containerCache);
|
|
18
|
+
const targetKey = options.target ?? "self";
|
|
19
|
+
const targetCache = containerCache.get(targetKey) ?? {};
|
|
20
|
+
const axisKey = axis + (options.offset ?? []).join(",");
|
|
21
|
+
if (!targetCache[axisKey]) {
|
|
22
|
+
targetCache[axisKey] =
|
|
23
|
+
!options.target && supportsScrollTimeline()
|
|
24
|
+
? new ScrollTimeline({ source: container, axis })
|
|
25
|
+
: scrollTimelineFallback({ container, ...options });
|
|
26
|
+
}
|
|
27
|
+
return targetCache[axis];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { getTimeline };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
+
import { transformProps, readTransformValue, isCSSVariableName } from 'motion-dom';
|
|
1
2
|
import { measureViewportBox } from '../../projection/utils/measure.mjs';
|
|
2
3
|
import { DOMVisualElement } from '../dom/DOMVisualElement.mjs';
|
|
3
|
-
import { isCSSVariableName } from '../dom/utils/is-css-variable.mjs';
|
|
4
4
|
import { buildHTMLStyles } from './utils/build-styles.mjs';
|
|
5
|
-
import { transformProps } from './utils/keys-transform.mjs';
|
|
6
|
-
import { readTransformValue } from './utils/parse-transform.mjs';
|
|
7
5
|
import { renderHTML } from './utils/render.mjs';
|
|
8
6
|
import { scrapeMotionValuesFromProps } from './utils/scrape-motion-values.mjs';
|
|
9
7
|
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { isCSSVariableName } from '
|
|
2
|
-
import { getValueAsType } from '../../dom/value-types/get-as-type.mjs';
|
|
3
|
-
import { numberValueTypes } from '../../dom/value-types/number.mjs';
|
|
1
|
+
import { transformProps, isCSSVariableName, getValueAsType, numberValueTypes } from 'motion-dom';
|
|
4
2
|
import { buildTransform } from './build-transform.mjs';
|
|
5
|
-
import { transformProps } from './keys-transform.mjs';
|
|
6
3
|
|
|
7
4
|
function buildHTMLStyles(state, latestValues, transformTemplate) {
|
|
8
5
|
const { style, vars, transformOrigin } = state;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { getValueAsType } from '
|
|
2
|
-
import { numberValueTypes } from '../../dom/value-types/number.mjs';
|
|
3
|
-
import { transformPropOrder } from './keys-transform.mjs';
|
|
1
|
+
import { transformPropOrder, getValueAsType, numberValueTypes } from 'motion-dom';
|
|
4
2
|
|
|
5
3
|
const translateAlias = {
|
|
6
4
|
x: "translateX",
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { frame } from 'motion-dom';
|
|
1
|
+
import { transformProps, getDefaultValueType, 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';
|
|
5
|
-
import { getDefaultValueType } from '../dom/value-types/defaults.mjs';
|
|
6
|
-
import { transformProps } from '../html/utils/keys-transform.mjs';
|
|
7
5
|
import { buildSVGAttrs } from './utils/build-attrs.mjs';
|
|
8
6
|
import { camelCaseAttributes } from './utils/camel-case-attrs.mjs';
|
|
9
7
|
import { isSVGTag } from './utils/is-svg-tag.mjs';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { frame } from 'motion-dom';
|
|
1
|
+
import { transformProps, frame } from 'motion-dom';
|
|
2
2
|
import { makeUseVisualState } from '../../motion/utils/use-visual-state.mjs';
|
|
3
|
-
import { transformProps } from '../html/utils/keys-transform.mjs';
|
|
4
3
|
import { buildSVGAttrs } from './utils/build-attrs.mjs';
|
|
5
4
|
import { createSvgRenderState } from './utils/create-render-state.mjs';
|
|
6
5
|
import { isSVGTag } from './utils/is-svg-tag.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { transformPropOrder } from 'motion-dom';
|
|
1
2
|
import { isMotionValue } from '../../../value/utils/is-motion-value.mjs';
|
|
2
|
-
import { transformPropOrder } from '../../html/utils/keys-transform.mjs';
|
|
3
3
|
import { scrapeMotionValuesFromProps as scrapeMotionValuesFromProps$1 } from '../../html/utils/scrape-motion-values.mjs';
|
|
4
4
|
|
|
5
5
|
function scrapeMotionValuesFromProps(props, prevProps, visualElement) {
|
|
@@ -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 === "12.7.
|
|
20
|
+
warnOnce(nextValue.version === "12.7.5-alpha.1", `Attempting to mix Motion versions ${nextValue.version} with 12.7.5-alpha.1 may not work as expected.`);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
else if (isMotionValue(prevValue)) {
|
package/dist/es/utils/delay.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { wrap } from 'motion-utils';
|
|
1
2
|
import { useRef, useState, useCallback } from 'react';
|
|
2
|
-
import { wrap } from './wrap.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Cycles through a series of visual properties. Can be used to toggle between or cycle through animations. It works similar to `useState` in React. It is provided an initial array of possible states, and returns an array of two arguments.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { frame } from 'motion-dom';
|
|
2
|
+
import { MotionGlobalConfig } from 'motion-utils';
|
|
2
3
|
import { useRef, useEffect } from 'react';
|
|
3
4
|
import { useInstantLayoutTransition } from '../projection/use-instant-layout-transition.mjs';
|
|
4
5
|
import { useForceUpdate } from './use-force-update.mjs';
|
|
5
|
-
import { instantAnimationState } from './use-instant-transition-state.mjs';
|
|
6
6
|
|
|
7
7
|
function useInstantTransition() {
|
|
8
8
|
const [forceUpdate, forcedRenderCount] = useForceUpdate();
|
|
@@ -22,12 +22,12 @@ function useInstantTransition() {
|
|
|
22
22
|
*/
|
|
23
23
|
if (forcedRenderCount !== unlockOnFrameRef.current)
|
|
24
24
|
return;
|
|
25
|
-
|
|
25
|
+
MotionGlobalConfig.instantAnimations = false;
|
|
26
26
|
}));
|
|
27
27
|
}, [forcedRenderCount]);
|
|
28
28
|
return (callback) => {
|
|
29
29
|
startInstantLayoutTransition(() => {
|
|
30
|
-
|
|
30
|
+
MotionGlobalConfig.instantAnimations = true;
|
|
31
31
|
forceUpdate();
|
|
32
32
|
callback();
|
|
33
33
|
unlockOnFrameRef.current = forcedRenderCount + 1;
|
|
@@ -35,7 +35,7 @@ function useInstantTransition() {
|
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
function disableInstantTransitions() {
|
|
38
|
-
|
|
38
|
+
MotionGlobalConfig.instantAnimations = false;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export { disableInstantTransitions, useInstantTransition };
|