motion 12.6.2 → 12.6.3
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/debug.js +12 -12
- package/dist/cjs/index.js +402 -347
- package/dist/cjs/mini.js +339 -352
- package/dist/cjs/react-client.js +169 -176
- package/dist/cjs/react-m.js +18 -22
- package/dist/cjs/react-mini.js +275 -336
- package/dist/es/framer-motion/dist/es/animation/animate/index.mjs +2 -2
- package/dist/es/framer-motion/dist/es/animation/animators/AcceleratedAnimation.mjs +7 -4
- package/dist/es/framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs +8 -6
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +10 -8
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-sequence.mjs +2 -2
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-style.mjs +2 -2
- package/dist/es/framer-motion/dist/es/animation/generators/spring/index.mjs +11 -1
- package/dist/es/framer-motion/dist/es/animation/interfaces/motion-value.mjs +3 -3
- package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs +1 -2
- package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-variant.mjs +1 -2
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/handoff.mjs +2 -4
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/start.mjs +4 -6
- package/dist/es/framer-motion/dist/es/animation/sequence/create.mjs +3 -3
- package/dist/es/framer-motion/dist/es/animation/sequence/utils/calc-time.mjs +1 -2
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/index.mjs +2 -2
- package/dist/es/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs +5 -10
- package/dist/es/framer-motion/dist/es/motion/features/animation/index.mjs +1 -2
- package/dist/es/framer-motion/dist/es/motion/index.mjs +2 -3
- package/dist/es/framer-motion/dist/es/motion/utils/use-visual-element.mjs +3 -5
- package/dist/es/framer-motion/dist/es/projection/node/create-projection-node.mjs +19 -27
- package/dist/es/framer-motion/dist/es/projection/styles/transform.mjs +1 -1
- package/dist/es/framer-motion/dist/es/render/VisualElement.mjs +3 -4
- package/dist/es/framer-motion/dist/es/render/dom/DOMKeyframesResolver.mjs +1 -2
- package/dist/es/framer-motion/dist/es/render/dom/resize/handle-element.mjs +5 -6
- package/dist/es/framer-motion/dist/es/render/dom/scroll/track.mjs +1 -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/utils/filter-props.mjs +1 -1
- package/dist/es/framer-motion/dist/es/render/html/utils/scrape-motion-values.mjs +1 -2
- package/dist/es/framer-motion/dist/es/render/utils/KeyframesResolver.mjs +2 -3
- package/dist/es/framer-motion/dist/es/render/utils/animation-state.mjs +3 -5
- package/dist/es/framer-motion/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/framer-motion/dist/es/render/utils/resolve-variants.mjs +1 -1
- package/dist/es/framer-motion/dist/es/utils/mix/complex.mjs +1 -2
- package/dist/es/framer-motion/dist/es/value/types/complex/index.mjs +2 -3
- package/dist/es/framer-motion/dist/es/value/use-scroll.mjs +2 -2
- package/dist/es/motion-dom/dist/es/animation/{controls/BaseGroup.mjs → GroupAnimation.mjs} +4 -5
- package/dist/es/motion-dom/dist/es/animation/GroupAnimationWithThen.mjs +9 -0
- package/dist/es/motion-dom/dist/es/animation/NativeAnimation.mjs +161 -0
- package/dist/es/motion-dom/dist/es/animation/generators/utils/is-generator.mjs +1 -1
- package/dist/es/motion-dom/dist/es/animation/keyframes/get-final.mjs +12 -0
- package/dist/es/motion-dom/dist/es/animation/keyframes/hydrate.mjs +26 -0
- package/dist/es/motion-dom/dist/es/animation/utils/get-value-transition.mjs +3 -5
- package/dist/es/motion-dom/dist/es/animation/waapi/easing/cubic-bezier.mjs +3 -0
- package/dist/es/motion-dom/dist/es/animation/waapi/easing/is-supported.mjs +14 -0
- package/dist/es/motion-dom/dist/es/animation/waapi/easing/map-easing.mjs +26 -0
- package/dist/es/motion-dom/dist/es/animation/waapi/easing/supported.mjs +15 -0
- package/dist/es/{framer-motion/dist/es/animation/animators/waapi/index.mjs → motion-dom/dist/es/animation/waapi/start-waapi-animation.mjs} +8 -6
- package/dist/es/{framer-motion/dist/es/animation/animators/waapi/utils/supports-partial-keyframes.mjs → motion-dom/dist/es/animation/waapi/supports/partial-keyframes.mjs} +2 -2
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/apply-generator.mjs +14 -0
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/linear.mjs +1 -4
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/px-values.mjs +39 -0
- package/dist/es/motion-dom/dist/es/gestures/press/index.mjs +1 -1
- package/dist/es/motion-dom/dist/es/render/dom/style.mjs +15 -0
- package/dist/es/motion-dom/dist/es/utils/resolve-elements.mjs +2 -7
- package/dist/es/motion-dom/dist/es/utils/supports/flags.mjs +1 -3
- package/dist/es/motion-dom/dist/es/utils/supports/memo.mjs +1 -1
- package/dist/es/motion-dom/dist/es/value/index.mjs +1 -1
- package/dist/es/motion-utils/dist/es/errors.mjs +2 -4
- package/dist/motion.dev.js +402 -347
- package/dist/motion.js +1 -1
- package/package.json +3 -3
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/NativeAnimation.mjs +0 -116
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/style.mjs +0 -8
- package/dist/es/motion-dom/dist/es/animation/controls/Group.mjs +0 -13
- package/dist/es/motion-dom/dist/es/animation/waapi/NativeAnimationControls.mjs +0 -85
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/easing.mjs +0 -44
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { style } from '../../render/dom/style.mjs';
|
|
2
|
+
import { supportsPartialKeyframes } from '../waapi/supports/partial-keyframes.mjs';
|
|
3
|
+
import { pxValues } from '../waapi/utils/px-values.mjs';
|
|
4
|
+
|
|
5
|
+
function hydrateKeyframes(element, name, keyframes, pseudoElement) {
|
|
6
|
+
if (!Array.isArray(keyframes)) {
|
|
7
|
+
keyframes = [keyframes];
|
|
8
|
+
}
|
|
9
|
+
for (let i = 0; i < keyframes.length; i++) {
|
|
10
|
+
if (keyframes[i] === null) {
|
|
11
|
+
keyframes[i] =
|
|
12
|
+
i === 0 && !pseudoElement
|
|
13
|
+
? style.get(element, name)
|
|
14
|
+
: keyframes[i - 1];
|
|
15
|
+
}
|
|
16
|
+
if (typeof keyframes[i] === "number" && pxValues.has(name)) {
|
|
17
|
+
keyframes[i] = keyframes[i] + "px";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (!pseudoElement && !supportsPartialKeyframes() && keyframes.length < 2) {
|
|
21
|
+
keyframes.unshift(style.get(element, name));
|
|
22
|
+
}
|
|
23
|
+
return keyframes;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { hydrateKeyframes };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
function getValueTransition(transition, key) {
|
|
2
|
-
return transition
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
transition
|
|
6
|
-
: undefined;
|
|
2
|
+
return (transition?.[key] ??
|
|
3
|
+
transition?.["default"] ??
|
|
4
|
+
transition);
|
|
7
5
|
}
|
|
8
6
|
|
|
9
7
|
export { getValueTransition };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { isBezierDefinition } from '../../../utils/is-bezier-definition.mjs';
|
|
2
|
+
import { supportsLinearEasing } from '../../../utils/supports/linear-easing.mjs';
|
|
3
|
+
import { supportedWaapiEasing } from './supported.mjs';
|
|
4
|
+
|
|
5
|
+
function isWaapiSupportedEasing(easing) {
|
|
6
|
+
return Boolean((typeof easing === "function" && supportsLinearEasing()) ||
|
|
7
|
+
!easing ||
|
|
8
|
+
(typeof easing === "string" &&
|
|
9
|
+
(easing in supportedWaapiEasing || supportsLinearEasing())) ||
|
|
10
|
+
isBezierDefinition(easing) ||
|
|
11
|
+
(Array.isArray(easing) && easing.every(isWaapiSupportedEasing)));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { isWaapiSupportedEasing };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { isBezierDefinition } from '../../../utils/is-bezier-definition.mjs';
|
|
2
|
+
import { supportsLinearEasing } from '../../../utils/supports/linear-easing.mjs';
|
|
3
|
+
import { generateLinearEasing } from '../utils/linear.mjs';
|
|
4
|
+
import { cubicBezierAsString } from './cubic-bezier.mjs';
|
|
5
|
+
import { supportedWaapiEasing } from './supported.mjs';
|
|
6
|
+
|
|
7
|
+
function mapEasingToNativeEasing(easing, duration) {
|
|
8
|
+
if (!easing) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
else if (typeof easing === "function" && supportsLinearEasing()) {
|
|
12
|
+
return generateLinearEasing(easing, duration);
|
|
13
|
+
}
|
|
14
|
+
else if (isBezierDefinition(easing)) {
|
|
15
|
+
return cubicBezierAsString(easing);
|
|
16
|
+
}
|
|
17
|
+
else if (Array.isArray(easing)) {
|
|
18
|
+
return easing.map((segmentEasing) => mapEasingToNativeEasing(segmentEasing, duration) ||
|
|
19
|
+
supportedWaapiEasing.easeOut);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
return supportedWaapiEasing[easing];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { mapEasingToNativeEasing };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { cubicBezierAsString } from './cubic-bezier.mjs';
|
|
2
|
+
|
|
3
|
+
const supportedWaapiEasing = {
|
|
4
|
+
linear: "linear",
|
|
5
|
+
ease: "ease",
|
|
6
|
+
easeIn: "ease-in",
|
|
7
|
+
easeOut: "ease-out",
|
|
8
|
+
easeInOut: "ease-in-out",
|
|
9
|
+
circIn: /*@__PURE__*/ cubicBezierAsString([0, 0.65, 0.55, 1]),
|
|
10
|
+
circOut: /*@__PURE__*/ cubicBezierAsString([0.55, 0, 1, 0.45]),
|
|
11
|
+
backIn: /*@__PURE__*/ cubicBezierAsString([0.31, 0.01, 0.66, -0.59]),
|
|
12
|
+
backOut: /*@__PURE__*/ cubicBezierAsString([0.33, 1.53, 0.69, 0.99]),
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { supportedWaapiEasing };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import '
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { activeAnimations } from '../../../../../../motion-dom/dist/es/stats/animation-count.mjs';
|
|
1
|
+
import { activeAnimations } from '../../stats/animation-count.mjs';
|
|
2
|
+
import { statsBuffer } from '../../stats/buffer.mjs';
|
|
3
|
+
import { mapEasingToNativeEasing } from './easing/map-easing.mjs';
|
|
5
4
|
|
|
6
|
-
function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = "loop", ease = "easeInOut", times, } = {}) {
|
|
7
|
-
const keyframeOptions = {
|
|
5
|
+
function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = "loop", ease = "easeInOut", times, } = {}, pseudoElement = undefined) {
|
|
6
|
+
const keyframeOptions = {
|
|
7
|
+
[valueName]: keyframes,
|
|
8
|
+
};
|
|
8
9
|
if (times)
|
|
9
10
|
keyframeOptions.offset = times;
|
|
10
11
|
const easing = mapEasingToNativeEasing(ease, duration);
|
|
@@ -23,6 +24,7 @@ function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duratio
|
|
|
23
24
|
fill: "both",
|
|
24
25
|
iterations: repeat + 1,
|
|
25
26
|
direction: repeatType === "reverse" ? "alternate" : "normal",
|
|
27
|
+
pseudoElement,
|
|
26
28
|
});
|
|
27
29
|
if (statsBuffer.value) {
|
|
28
30
|
animation.finished.finally(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import '
|
|
2
|
-
import { memo } from '
|
|
1
|
+
import '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { memo } from '../../../../../../motion-utils/dist/es/memo.mjs';
|
|
3
3
|
|
|
4
4
|
const supportsPartialKeyframes = /*@__PURE__*/ memo(() => {
|
|
5
5
|
try {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { isGenerator } from '../../generators/utils/is-generator.mjs';
|
|
2
|
+
|
|
3
|
+
function applyGeneratorOptions({ type, ...options }) {
|
|
4
|
+
if (isGenerator(type)) {
|
|
5
|
+
return type.applyToOptions(options);
|
|
6
|
+
}
|
|
7
|
+
else {
|
|
8
|
+
options.duration ?? (options.duration = 300);
|
|
9
|
+
options.ease ?? (options.ease = "easeOut");
|
|
10
|
+
}
|
|
11
|
+
return options;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { applyGeneratorOptions };
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
-
import { progress } from '../../../../../../motion-utils/dist/es/progress.mjs';
|
|
3
|
-
|
|
4
1
|
const generateLinearEasing = (easing, duration, // as milliseconds
|
|
5
2
|
resolution = 10 // as milliseconds
|
|
6
3
|
) => {
|
|
7
4
|
let points = "";
|
|
8
5
|
const numPoints = Math.max(Math.round(duration / resolution), 2);
|
|
9
6
|
for (let i = 0; i < numPoints; i++) {
|
|
10
|
-
points += easing(
|
|
7
|
+
points += easing(i / (numPoints - 1)) + ", ";
|
|
11
8
|
}
|
|
12
9
|
return `linear(${points.substring(0, points.length - 2)})`;
|
|
13
10
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const pxValues = new Set([
|
|
2
|
+
// Border props
|
|
3
|
+
"borderWidth",
|
|
4
|
+
"borderTopWidth",
|
|
5
|
+
"borderRightWidth",
|
|
6
|
+
"borderBottomWidth",
|
|
7
|
+
"borderLeftWidth",
|
|
8
|
+
"borderRadius",
|
|
9
|
+
"radius",
|
|
10
|
+
"borderTopLeftRadius",
|
|
11
|
+
"borderTopRightRadius",
|
|
12
|
+
"borderBottomRightRadius",
|
|
13
|
+
"borderBottomLeftRadius",
|
|
14
|
+
// Positioning props
|
|
15
|
+
"width",
|
|
16
|
+
"maxWidth",
|
|
17
|
+
"height",
|
|
18
|
+
"maxHeight",
|
|
19
|
+
"top",
|
|
20
|
+
"right",
|
|
21
|
+
"bottom",
|
|
22
|
+
"left",
|
|
23
|
+
// Spacing props
|
|
24
|
+
"padding",
|
|
25
|
+
"paddingTop",
|
|
26
|
+
"paddingRight",
|
|
27
|
+
"paddingBottom",
|
|
28
|
+
"paddingLeft",
|
|
29
|
+
"margin",
|
|
30
|
+
"marginTop",
|
|
31
|
+
"marginRight",
|
|
32
|
+
"marginBottom",
|
|
33
|
+
"marginLeft",
|
|
34
|
+
// Misc
|
|
35
|
+
"backgroundPositionX",
|
|
36
|
+
"backgroundPositionY",
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
export { pxValues };
|
|
@@ -69,7 +69,7 @@ function press(targetOrSelector, onPressStart, options = {}) {
|
|
|
69
69
|
if (target instanceof HTMLElement) {
|
|
70
70
|
target.addEventListener("focus", (event) => enableKeyboardPress(event, eventOptions));
|
|
71
71
|
if (!isElementKeyboardAccessible(target) &&
|
|
72
|
-
target.
|
|
72
|
+
!target.hasAttribute("tabindex")) {
|
|
73
73
|
target.tabIndex = 0;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const isCSSVar = (name) => name.startsWith("--");
|
|
2
|
+
const style = {
|
|
3
|
+
set: (element, name, value) => {
|
|
4
|
+
isCSSVar(name)
|
|
5
|
+
? element.style.setProperty(name, value)
|
|
6
|
+
: (element.style[name] = value);
|
|
7
|
+
},
|
|
8
|
+
get: (element, name) => {
|
|
9
|
+
return isCSSVar(name)
|
|
10
|
+
? element.style.getPropertyValue(name)
|
|
11
|
+
: element.style[name];
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { style };
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
function resolveElements(elementOrSelector, scope, selectorCache) {
|
|
2
|
-
var _a;
|
|
3
2
|
if (elementOrSelector instanceof EventTarget) {
|
|
4
3
|
return [elementOrSelector];
|
|
5
4
|
}
|
|
6
5
|
else if (typeof elementOrSelector === "string") {
|
|
7
6
|
let root = document;
|
|
8
7
|
if (scope) {
|
|
9
|
-
// TODO: Refactor to utils package
|
|
10
|
-
// invariant(
|
|
11
|
-
// Boolean(scope.current),
|
|
12
|
-
// "Scope provided, but no element detected."
|
|
13
|
-
// )
|
|
14
8
|
root = scope.current;
|
|
15
9
|
}
|
|
16
|
-
const elements =
|
|
10
|
+
const elements = selectorCache?.[elementOrSelector] ??
|
|
11
|
+
root.querySelectorAll(elementOrSelector);
|
|
17
12
|
return elements ? Array.from(elements) : [];
|
|
18
13
|
}
|
|
19
14
|
return Array.from(elementOrSelector);
|
|
@@ -4,7 +4,7 @@ import { supportsFlags } from './flags.mjs';
|
|
|
4
4
|
|
|
5
5
|
function memoSupports(callback, supportsFlag) {
|
|
6
6
|
const memoized = memo(callback);
|
|
7
|
-
return () =>
|
|
7
|
+
return () => supportsFlags[supportsFlag] ?? memoized();
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export { memoSupports };
|
|
@@ -33,7 +33,7 @@ class MotionValue {
|
|
|
33
33
|
* This will be replaced by the build step with the latest version number.
|
|
34
34
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
35
35
|
*/
|
|
36
|
-
this.version = "12.6.
|
|
36
|
+
this.version = "12.6.3";
|
|
37
37
|
/**
|
|
38
38
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
39
39
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
let warning = noop;
|
|
4
|
-
let invariant = noop;
|
|
1
|
+
let warning = () => { };
|
|
2
|
+
let invariant = () => { };
|
|
5
3
|
if (process.env.NODE_ENV !== "production") {
|
|
6
4
|
warning = (check, message) => {
|
|
7
5
|
if (!check && typeof console !== "undefined") {
|