motion 11.12.0 → 11.13.0-beta.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/.turbo/turbo-build.log +45 -45
- package/dist/cjs/index.js +66 -44
- package/dist/cjs/mini.js +21 -25
- package/dist/cjs/react-client.js +21 -21
- package/dist/cjs/react-mini.js +21 -25
- package/dist/es/dom/dist/es/gestures/hover.mjs +26 -0
- package/dist/es/dom/dist/es/utils/resolve-elements.mjs +22 -0
- 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 -1
- 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 -1
- 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 -1
- package/dist/es/framer-motion/dist/es/easing/utils/map.mjs +2 -2
- package/dist/es/framer-motion/dist/es/events/event-info.mjs +3 -3
- package/dist/es/framer-motion/dist/es/frameloop/frame.mjs +2 -1
- package/dist/es/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs +2 -2
- package/dist/es/framer-motion/dist/es/gestures/drag/index.mjs +2 -1
- package/dist/es/framer-motion/dist/es/gestures/pan/index.mjs +2 -1
- package/dist/es/framer-motion/dist/es/gestures/press.mjs +2 -1
- 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 -1
- package/dist/es/framer-motion/dist/es/projection/node/create-projection-node.mjs +2 -1
- 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 -1
- 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/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 +4 -1
- package/dist/es/motion/lib/react.mjs +4 -1
- package/dist/motion.dev.js +66 -44
- package/dist/motion.js +1 -1
- package/package.json +3 -3
- package/dist/es/framer-motion/dist/es/render/dom/utils/resolve-element.mjs +0 -28
- /package/dist/es/{framer-motion/dist/es/utils → utils/dist/es}/errors.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/utils → utils/dist/es}/noop.mjs +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
[36m
|
|
2
|
-
[1mlib/index.js[22m → [1mdist/motion.dev.js[22m...[39m
|
|
3
|
-
[32mcreated [1mdist/motion.dev.js[22m in [
|
|
4
|
-
[36m
|
|
5
|
-
[1mlib/index.js[22m → [1mdist/motion.js[22m...[39m
|
|
6
|
-
[32mcreated [1mdist/motion.js[22m in [
|
|
7
|
-
[36m
|
|
8
|
-
[1mlib/index.js[22m → [1mdist/cjs[22m...[39m
|
|
9
|
-
[32mcreated [1mdist/cjs[22m in [
|
|
10
|
-
[36m
|
|
11
|
-
[1mlib/react-client.js[22m → [1mdist/cjs[22m...[39m
|
|
12
|
-
[32mcreated [1mdist/cjs[22m in [
|
|
13
|
-
[36m
|
|
14
|
-
[1mlib/react.js[22m → [1mdist/cjs[22m...[39m
|
|
15
|
-
[32mcreated [1mdist/cjs[22m in [
|
|
16
|
-
[36m
|
|
17
|
-
[1mlib/mini.js[22m → [1mdist/cjs[22m...[39m
|
|
18
|
-
[32mcreated [1mdist/cjs[22m in [1m24ms[22m[39m
|
|
19
|
-
[36m
|
|
20
|
-
[1mlib/react-mini.js[22m → [1mdist/cjs[22m...[39m
|
|
21
|
-
[32mcreated [1mdist/cjs[22m in [
|
|
22
|
-
[36m
|
|
23
|
-
[1mlib/react-m.js[22m → [1mdist/cjs[22m...[39m
|
|
24
|
-
[32mcreated [1mdist/cjs[22m in [
|
|
25
|
-
[36m
|
|
26
|
-
[1mlib/index.js, lib/mini.js, lib/react.js, lib/react-mini.js, lib/react-client.js, lib/react-m.js[22m → [1mdist/es[22m...[39m
|
|
27
|
-
[32mcreated [1mdist/es[22m in [
|
|
28
|
-
[36m
|
|
29
|
-
[1mtypes/index.d.ts[22m → [1mdist/index.d.ts[22m...[39m
|
|
30
|
-
[32mcreated [1mdist/index.d.ts[22m in [
|
|
31
|
-
[36m
|
|
32
|
-
[1mtypes/react.d.ts[22m → [1mdist/react.d.ts[22m...[39m
|
|
33
|
-
[32mcreated [1mdist/react.d.ts[22m in [
|
|
34
|
-
[36m
|
|
35
|
-
[1mtypes/react-mini.d.ts[22m → [1mdist/react-mini.d.ts[22m...[39m
|
|
36
|
-
[32mcreated [1mdist/react-mini.d.ts[22m in [
|
|
37
|
-
[36m
|
|
38
|
-
[1mtypes/react-m.d.ts[22m → [1mdist/react-m.d.ts[22m...[39m
|
|
39
|
-
[32mcreated [1mdist/react-m.d.ts[22m in [
|
|
40
|
-
[36m
|
|
41
|
-
[1mtypes/mini.d.ts[22m → [1mdist/mini.d.ts[22m...[39m
|
|
42
|
-
[32mcreated [1mdist/mini.d.ts[22m in [
|
|
43
|
-
[36m
|
|
44
|
-
[1mtypes/react-client.d.ts[22m → [1mdist/react-client.d.ts[22m...[39m
|
|
45
|
-
[32mcreated [1mdist/react-client.d.ts[22m in [
|
|
1
|
+
[36m
|
|
2
|
+
[1mlib/index.js[22m → [1mdist/motion.dev.js[22m...[39m
|
|
3
|
+
[32mcreated [1mdist/motion.dev.js[22m in [1m669ms[22m[39m
|
|
4
|
+
[36m
|
|
5
|
+
[1mlib/index.js[22m → [1mdist/motion.js[22m...[39m
|
|
6
|
+
[32mcreated [1mdist/motion.js[22m in [1m804ms[22m[39m
|
|
7
|
+
[36m
|
|
8
|
+
[1mlib/index.js[22m → [1mdist/cjs[22m...[39m
|
|
9
|
+
[32mcreated [1mdist/cjs[22m in [1m195ms[22m[39m
|
|
10
|
+
[36m
|
|
11
|
+
[1mlib/react-client.js[22m → [1mdist/cjs[22m...[39m
|
|
12
|
+
[32mcreated [1mdist/cjs[22m in [1m323ms[22m[39m
|
|
13
|
+
[36m
|
|
14
|
+
[1mlib/react.js[22m → [1mdist/cjs[22m...[39m
|
|
15
|
+
[32mcreated [1mdist/cjs[22m in [1m2ms[22m[39m
|
|
16
|
+
[36m
|
|
17
|
+
[1mlib/mini.js[22m → [1mdist/cjs[22m...[39m
|
|
18
|
+
[32mcreated [1mdist/cjs[22m in [1m24ms[22m[39m
|
|
19
|
+
[36m
|
|
20
|
+
[1mlib/react-mini.js[22m → [1mdist/cjs[22m...[39m
|
|
21
|
+
[32mcreated [1mdist/cjs[22m in [1m20ms[22m[39m
|
|
22
|
+
[36m
|
|
23
|
+
[1mlib/react-m.js[22m → [1mdist/cjs[22m...[39m
|
|
24
|
+
[32mcreated [1mdist/cjs[22m in [1m117ms[22m[39m
|
|
25
|
+
[36m
|
|
26
|
+
[1mlib/index.js, lib/mini.js, lib/react.js, lib/react-mini.js, lib/react-client.js, lib/react-m.js[22m → [1mdist/es[22m...[39m
|
|
27
|
+
[32mcreated [1mdist/es[22m in [1m599ms[22m[39m
|
|
28
|
+
[36m
|
|
29
|
+
[1mtypes/index.d.ts[22m → [1mdist/index.d.ts[22m...[39m
|
|
30
|
+
[32mcreated [1mdist/index.d.ts[22m in [1m10ms[22m[39m
|
|
31
|
+
[36m
|
|
32
|
+
[1mtypes/react.d.ts[22m → [1mdist/react.d.ts[22m...[39m
|
|
33
|
+
[32mcreated [1mdist/react.d.ts[22m in [1m9ms[22m[39m
|
|
34
|
+
[36m
|
|
35
|
+
[1mtypes/react-mini.d.ts[22m → [1mdist/react-mini.d.ts[22m...[39m
|
|
36
|
+
[32mcreated [1mdist/react-mini.d.ts[22m in [1m3ms[22m[39m
|
|
37
|
+
[36m
|
|
38
|
+
[1mtypes/react-m.d.ts[22m → [1mdist/react-m.d.ts[22m...[39m
|
|
39
|
+
[32mcreated [1mdist/react-m.d.ts[22m in [1m5ms[22m[39m
|
|
40
|
+
[36m
|
|
41
|
+
[1mtypes/mini.d.ts[22m → [1mdist/mini.d.ts[22m...[39m
|
|
42
|
+
[32mcreated [1mdist/mini.d.ts[22m in [1m3ms[22m[39m
|
|
43
|
+
[36m
|
|
44
|
+
[1mtypes/react-client.d.ts[22m → [1mdist/react-client.d.ts[22m...[39m
|
|
45
|
+
[32mcreated [1mdist/react-client.d.ts[22m in [1m1ms[22m[39m
|
package/dist/cjs/index.js
CHANGED
|
@@ -2,6 +2,67 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
const noop = (any) => any;
|
|
6
|
+
|
|
7
|
+
exports.warning = noop;
|
|
8
|
+
exports.invariant = noop;
|
|
9
|
+
if (process.env.NODE_ENV !== "production") {
|
|
10
|
+
exports.warning = (check, message) => {
|
|
11
|
+
if (!check && typeof console !== "undefined") {
|
|
12
|
+
console.warn(message);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
exports.invariant = (check, message) => {
|
|
16
|
+
if (!check) {
|
|
17
|
+
throw new Error(message);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function resolveElements(elementOrSelector, scope, selectorCache) {
|
|
23
|
+
var _a;
|
|
24
|
+
if (elementOrSelector instanceof Element) {
|
|
25
|
+
return [elementOrSelector];
|
|
26
|
+
}
|
|
27
|
+
else if (typeof elementOrSelector === "string") {
|
|
28
|
+
let root = document;
|
|
29
|
+
if (scope) {
|
|
30
|
+
// TODO: Refactor to utils package
|
|
31
|
+
// invariant(
|
|
32
|
+
// Boolean(scope.current),
|
|
33
|
+
// "Scope provided, but no element detected."
|
|
34
|
+
// )
|
|
35
|
+
root = scope.current;
|
|
36
|
+
}
|
|
37
|
+
const elements = (_a = selectorCache === null || selectorCache === void 0 ? void 0 : selectorCache[elementOrSelector]) !== null && _a !== void 0 ? _a : root.querySelectorAll(elementOrSelector);
|
|
38
|
+
return elements ? Array.from(elements) : [];
|
|
39
|
+
}
|
|
40
|
+
return Array.from(elementOrSelector);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function hover(elementOrSelector, onHoverStart) {
|
|
44
|
+
const elements = resolveElements(elementOrSelector);
|
|
45
|
+
const cancelGesture = new AbortController();
|
|
46
|
+
const options = { signal: cancelGesture.signal };
|
|
47
|
+
const onPointerEnter = (enterEvent) => {
|
|
48
|
+
if (enterEvent.pointerType === "touch")
|
|
49
|
+
return;
|
|
50
|
+
const { target } = enterEvent;
|
|
51
|
+
const onHoverEnd = onHoverStart(enterEvent);
|
|
52
|
+
if (onHoverEnd && target) {
|
|
53
|
+
const onPointerLeave = (leaveEvent) => {
|
|
54
|
+
onHoverEnd(leaveEvent);
|
|
55
|
+
target.removeEventListener("pointerleave", onPointerLeave);
|
|
56
|
+
};
|
|
57
|
+
target.addEventListener("pointerleave", onPointerLeave, options);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
elements.forEach((element) => {
|
|
61
|
+
element.addEventListener("pointerenter", onPointerEnter, options);
|
|
62
|
+
});
|
|
63
|
+
return () => cancelGesture.abort();
|
|
64
|
+
}
|
|
65
|
+
|
|
5
66
|
function addUniqueItem(arr, item) {
|
|
6
67
|
if (arr.indexOf(item) === -1)
|
|
7
68
|
arr.push(item);
|
|
@@ -74,8 +135,6 @@ const MotionGlobalConfig = {
|
|
|
74
135
|
useManualTiming: false,
|
|
75
136
|
};
|
|
76
137
|
|
|
77
|
-
const noop = (any) => any;
|
|
78
|
-
|
|
79
138
|
function createRenderStep(runNextFrame) {
|
|
80
139
|
/**
|
|
81
140
|
* We create and reuse two queues, one to queue jobs for the current frame
|
|
@@ -279,7 +338,7 @@ class MotionValue {
|
|
|
279
338
|
* This will be replaced by the build step with the latest version number.
|
|
280
339
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
281
340
|
*/
|
|
282
|
-
this.version = "11.
|
|
341
|
+
this.version = "11.13.0-beta.0";
|
|
283
342
|
/**
|
|
284
343
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
285
344
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
@@ -690,21 +749,6 @@ function calcGeneratorVelocity(resolveValue, t, current) {
|
|
|
690
749
|
return velocityPerSecond(current - resolveValue(prevT), t - prevT);
|
|
691
750
|
}
|
|
692
751
|
|
|
693
|
-
exports.warning = noop;
|
|
694
|
-
exports.invariant = noop;
|
|
695
|
-
if (process.env.NODE_ENV !== "production") {
|
|
696
|
-
exports.warning = (check, message) => {
|
|
697
|
-
if (!check && typeof console !== "undefined") {
|
|
698
|
-
console.warn(message);
|
|
699
|
-
}
|
|
700
|
-
};
|
|
701
|
-
exports.invariant = (check, message) => {
|
|
702
|
-
if (!check) {
|
|
703
|
-
throw new Error(message);
|
|
704
|
-
}
|
|
705
|
-
};
|
|
706
|
-
}
|
|
707
|
-
|
|
708
752
|
const clamp = (min, max, v) => {
|
|
709
753
|
if (v > max)
|
|
710
754
|
return max;
|
|
@@ -1045,31 +1089,6 @@ function defaultOffset$1(arr) {
|
|
|
1045
1089
|
|
|
1046
1090
|
const isMotionValue = (value) => Boolean(value && value.getVelocity);
|
|
1047
1091
|
|
|
1048
|
-
function resolveElements(elements, scope, selectorCache) {
|
|
1049
|
-
var _a;
|
|
1050
|
-
if (typeof elements === "string") {
|
|
1051
|
-
let root = document;
|
|
1052
|
-
if (scope) {
|
|
1053
|
-
exports.invariant(Boolean(scope.current), "Scope provided, but no element detected.");
|
|
1054
|
-
root = scope.current;
|
|
1055
|
-
}
|
|
1056
|
-
if (selectorCache) {
|
|
1057
|
-
(_a = selectorCache[elements]) !== null && _a !== void 0 ? _a : (selectorCache[elements] = root.querySelectorAll(elements));
|
|
1058
|
-
elements = selectorCache[elements];
|
|
1059
|
-
}
|
|
1060
|
-
else {
|
|
1061
|
-
elements = root.querySelectorAll(elements);
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
else if (elements instanceof Element) {
|
|
1065
|
-
elements = [elements];
|
|
1066
|
-
}
|
|
1067
|
-
/**
|
|
1068
|
-
* Return an empty array
|
|
1069
|
-
*/
|
|
1070
|
-
return Array.from(elements || []);
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
1092
|
function isDOMKeyframes(keyframes) {
|
|
1074
1093
|
return typeof keyframes === "object" && !Array.isArray(keyframes);
|
|
1075
1094
|
}
|
|
@@ -4156,7 +4175,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
4156
4175
|
* and warn against mismatches.
|
|
4157
4176
|
*/
|
|
4158
4177
|
if (process.env.NODE_ENV === "development") {
|
|
4159
|
-
warnOnce(nextValue.version === "11.
|
|
4178
|
+
warnOnce(nextValue.version === "11.13.0-beta.0", `Attempting to mix Motion versions ${nextValue.version} with 11.13.0-beta.0 may not work as expected.`);
|
|
4160
4179
|
}
|
|
4161
4180
|
}
|
|
4162
4181
|
else if (isMotionValue(prevValue)) {
|
|
@@ -6177,6 +6196,7 @@ exports.easeOut = easeOut;
|
|
|
6177
6196
|
exports.frame = frame;
|
|
6178
6197
|
exports.frameData = frameData;
|
|
6179
6198
|
exports.frameSteps = frameSteps;
|
|
6199
|
+
exports.hover = hover;
|
|
6180
6200
|
exports.inView = inView;
|
|
6181
6201
|
exports.inertia = inertia;
|
|
6182
6202
|
exports.interpolate = interpolate;
|
|
@@ -6184,8 +6204,10 @@ exports.keyframes = keyframes;
|
|
|
6184
6204
|
exports.mirrorEasing = mirrorEasing;
|
|
6185
6205
|
exports.mix = mix;
|
|
6186
6206
|
exports.motionValue = motionValue;
|
|
6207
|
+
exports.noop = noop;
|
|
6187
6208
|
exports.pipe = pipe;
|
|
6188
6209
|
exports.progress = progress;
|
|
6210
|
+
exports.resolveElements = resolveElements;
|
|
6189
6211
|
exports.reverseEasing = reverseEasing;
|
|
6190
6212
|
exports.scroll = scroll;
|
|
6191
6213
|
exports.scrollInfo = scrollInfo;
|
package/dist/cjs/mini.js
CHANGED
|
@@ -91,6 +91,27 @@ class GroupPlaybackControls {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
function resolveElements(elementOrSelector, scope, selectorCache) {
|
|
95
|
+
var _a;
|
|
96
|
+
if (elementOrSelector instanceof Element) {
|
|
97
|
+
return [elementOrSelector];
|
|
98
|
+
}
|
|
99
|
+
else if (typeof elementOrSelector === "string") {
|
|
100
|
+
let root = document;
|
|
101
|
+
if (scope) {
|
|
102
|
+
// TODO: Refactor to utils package
|
|
103
|
+
// invariant(
|
|
104
|
+
// Boolean(scope.current),
|
|
105
|
+
// "Scope provided, but no element detected."
|
|
106
|
+
// )
|
|
107
|
+
root = scope.current;
|
|
108
|
+
}
|
|
109
|
+
const elements = (_a = selectorCache === null || selectorCache === void 0 ? void 0 : selectorCache[elementOrSelector]) !== null && _a !== void 0 ? _a : root.querySelectorAll(elementOrSelector);
|
|
110
|
+
return elements ? Array.from(elements) : [];
|
|
111
|
+
}
|
|
112
|
+
return Array.from(elementOrSelector);
|
|
113
|
+
}
|
|
114
|
+
|
|
94
115
|
const noop = (any) => any;
|
|
95
116
|
|
|
96
117
|
let invariant = noop;
|
|
@@ -102,31 +123,6 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
102
123
|
};
|
|
103
124
|
}
|
|
104
125
|
|
|
105
|
-
function resolveElements(elements, scope, selectorCache) {
|
|
106
|
-
var _a;
|
|
107
|
-
if (typeof elements === "string") {
|
|
108
|
-
let root = document;
|
|
109
|
-
if (scope) {
|
|
110
|
-
invariant(Boolean(scope.current), "Scope provided, but no element detected.");
|
|
111
|
-
root = scope.current;
|
|
112
|
-
}
|
|
113
|
-
if (selectorCache) {
|
|
114
|
-
(_a = selectorCache[elements]) !== null && _a !== void 0 ? _a : (selectorCache[elements] = root.querySelectorAll(elements));
|
|
115
|
-
elements = selectorCache[elements];
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
elements = root.querySelectorAll(elements);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
else if (elements instanceof Element) {
|
|
122
|
-
elements = [elements];
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Return an empty array
|
|
126
|
-
*/
|
|
127
|
-
return Array.from(elements || []);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
126
|
/**
|
|
131
127
|
* Converts seconds to milliseconds
|
|
132
128
|
*
|
package/dist/cjs/react-client.js
CHANGED
|
@@ -185,6 +185,21 @@ function getFinalKeyframe(keyframes, { repeat, repeatType = "loop" }, finalKeyfr
|
|
|
185
185
|
|
|
186
186
|
const noop = (any) => any;
|
|
187
187
|
|
|
188
|
+
let warning = noop;
|
|
189
|
+
let invariant = noop;
|
|
190
|
+
if (process.env.NODE_ENV !== "production") {
|
|
191
|
+
warning = (check, message) => {
|
|
192
|
+
if (!check && typeof console !== "undefined") {
|
|
193
|
+
console.warn(message);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
invariant = (check, message) => {
|
|
197
|
+
if (!check) {
|
|
198
|
+
throw new Error(message);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
|
|
188
203
|
function createRenderStep(runNextFrame) {
|
|
189
204
|
/**
|
|
190
205
|
* We create and reuse two queues, one to queue jobs for the current frame
|
|
@@ -417,21 +432,6 @@ function isNone(value) {
|
|
|
417
432
|
}
|
|
418
433
|
}
|
|
419
434
|
|
|
420
|
-
let warning = noop;
|
|
421
|
-
let invariant = noop;
|
|
422
|
-
if (process.env.NODE_ENV !== "production") {
|
|
423
|
-
warning = (check, message) => {
|
|
424
|
-
if (!check && typeof console !== "undefined") {
|
|
425
|
-
console.warn(message);
|
|
426
|
-
}
|
|
427
|
-
};
|
|
428
|
-
invariant = (check, message) => {
|
|
429
|
-
if (!check) {
|
|
430
|
-
throw new Error(message);
|
|
431
|
-
}
|
|
432
|
-
};
|
|
433
|
-
}
|
|
434
|
-
|
|
435
435
|
/**
|
|
436
436
|
* Check if value is a numerical string, ie a string that is purely a number eg "100" or "-100.1"
|
|
437
437
|
*/
|
|
@@ -3348,7 +3348,7 @@ class MotionValue {
|
|
|
3348
3348
|
* This will be replaced by the build step with the latest version number.
|
|
3349
3349
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
3350
3350
|
*/
|
|
3351
|
-
this.version = "11.
|
|
3351
|
+
this.version = "11.13.0-beta.0";
|
|
3352
3352
|
/**
|
|
3353
3353
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
3354
3354
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
@@ -4271,11 +4271,11 @@ const isPrimaryPointer = (event) => {
|
|
|
4271
4271
|
}
|
|
4272
4272
|
};
|
|
4273
4273
|
|
|
4274
|
-
function extractEventInfo(event
|
|
4274
|
+
function extractEventInfo(event) {
|
|
4275
4275
|
return {
|
|
4276
4276
|
point: {
|
|
4277
|
-
x: event
|
|
4278
|
-
y: event
|
|
4277
|
+
x: event.pageX,
|
|
4278
|
+
y: event.pageY,
|
|
4279
4279
|
},
|
|
4280
4280
|
};
|
|
4281
4281
|
}
|
|
@@ -4925,7 +4925,7 @@ class VisualElementDragControls {
|
|
|
4925
4925
|
// the component.
|
|
4926
4926
|
dragSnapToOrigin ? this.pauseAnimation() : this.stopAnimation();
|
|
4927
4927
|
if (snapToCursor) {
|
|
4928
|
-
this.snapToCursor(extractEventInfo(event
|
|
4928
|
+
this.snapToCursor(extractEventInfo(event).point);
|
|
4929
4929
|
}
|
|
4930
4930
|
};
|
|
4931
4931
|
const onStart = (event, info) => {
|
|
@@ -9091,7 +9091,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
9091
9091
|
* and warn against mismatches.
|
|
9092
9092
|
*/
|
|
9093
9093
|
if (process.env.NODE_ENV === "development") {
|
|
9094
|
-
warnOnce(nextValue.version === "11.
|
|
9094
|
+
warnOnce(nextValue.version === "11.13.0-beta.0", `Attempting to mix Motion versions ${nextValue.version} with 11.13.0-beta.0 may not work as expected.`);
|
|
9095
9095
|
}
|
|
9096
9096
|
}
|
|
9097
9097
|
else if (isMotionValue(prevValue)) {
|
package/dist/cjs/react-mini.js
CHANGED
|
@@ -112,6 +112,27 @@ class GroupPlaybackControls {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
function resolveElements(elementOrSelector, scope, selectorCache) {
|
|
116
|
+
var _a;
|
|
117
|
+
if (elementOrSelector instanceof Element) {
|
|
118
|
+
return [elementOrSelector];
|
|
119
|
+
}
|
|
120
|
+
else if (typeof elementOrSelector === "string") {
|
|
121
|
+
let root = document;
|
|
122
|
+
if (scope) {
|
|
123
|
+
// TODO: Refactor to utils package
|
|
124
|
+
// invariant(
|
|
125
|
+
// Boolean(scope.current),
|
|
126
|
+
// "Scope provided, but no element detected."
|
|
127
|
+
// )
|
|
128
|
+
root = scope.current;
|
|
129
|
+
}
|
|
130
|
+
const elements = (_a = selectorCache === null || selectorCache === void 0 ? void 0 : selectorCache[elementOrSelector]) !== null && _a !== void 0 ? _a : root.querySelectorAll(elementOrSelector);
|
|
131
|
+
return elements ? Array.from(elements) : [];
|
|
132
|
+
}
|
|
133
|
+
return Array.from(elementOrSelector);
|
|
134
|
+
}
|
|
135
|
+
|
|
115
136
|
const noop = (any) => any;
|
|
116
137
|
|
|
117
138
|
let invariant = noop;
|
|
@@ -123,31 +144,6 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
123
144
|
};
|
|
124
145
|
}
|
|
125
146
|
|
|
126
|
-
function resolveElements(elements, scope, selectorCache) {
|
|
127
|
-
var _a;
|
|
128
|
-
if (typeof elements === "string") {
|
|
129
|
-
let root = document;
|
|
130
|
-
if (scope) {
|
|
131
|
-
invariant(Boolean(scope.current), "Scope provided, but no element detected.");
|
|
132
|
-
root = scope.current;
|
|
133
|
-
}
|
|
134
|
-
if (selectorCache) {
|
|
135
|
-
(_a = selectorCache[elements]) !== null && _a !== void 0 ? _a : (selectorCache[elements] = root.querySelectorAll(elements));
|
|
136
|
-
elements = selectorCache[elements];
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
elements = root.querySelectorAll(elements);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
else if (elements instanceof Element) {
|
|
143
|
-
elements = [elements];
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Return an empty array
|
|
147
|
-
*/
|
|
148
|
-
return Array.from(elements || []);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
147
|
/**
|
|
152
148
|
* Converts seconds to milliseconds
|
|
153
149
|
*
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { resolveElements } from '../utils/resolve-elements.mjs';
|
|
2
|
+
|
|
3
|
+
function hover(elementOrSelector, onHoverStart) {
|
|
4
|
+
const elements = resolveElements(elementOrSelector);
|
|
5
|
+
const cancelGesture = new AbortController();
|
|
6
|
+
const options = { signal: cancelGesture.signal };
|
|
7
|
+
const onPointerEnter = (enterEvent) => {
|
|
8
|
+
if (enterEvent.pointerType === "touch")
|
|
9
|
+
return;
|
|
10
|
+
const { target } = enterEvent;
|
|
11
|
+
const onHoverEnd = onHoverStart(enterEvent);
|
|
12
|
+
if (onHoverEnd && target) {
|
|
13
|
+
const onPointerLeave = (leaveEvent) => {
|
|
14
|
+
onHoverEnd(leaveEvent);
|
|
15
|
+
target.removeEventListener("pointerleave", onPointerLeave);
|
|
16
|
+
};
|
|
17
|
+
target.addEventListener("pointerleave", onPointerLeave, options);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
elements.forEach((element) => {
|
|
21
|
+
element.addEventListener("pointerenter", onPointerEnter, options);
|
|
22
|
+
});
|
|
23
|
+
return () => cancelGesture.abort();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { hover };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function resolveElements(elementOrSelector, scope, selectorCache) {
|
|
2
|
+
var _a;
|
|
3
|
+
if (elementOrSelector instanceof Element) {
|
|
4
|
+
return [elementOrSelector];
|
|
5
|
+
}
|
|
6
|
+
else if (typeof elementOrSelector === "string") {
|
|
7
|
+
let root = document;
|
|
8
|
+
if (scope) {
|
|
9
|
+
// TODO: Refactor to utils package
|
|
10
|
+
// invariant(
|
|
11
|
+
// Boolean(scope.current),
|
|
12
|
+
// "Scope provided, but no element detected."
|
|
13
|
+
// )
|
|
14
|
+
root = scope.current;
|
|
15
|
+
}
|
|
16
|
+
const elements = (_a = selectorCache === null || selectorCache === void 0 ? void 0 : selectorCache[elementOrSelector]) !== null && _a !== void 0 ? _a : root.querySelectorAll(elementOrSelector);
|
|
17
|
+
return elements ? Array.from(elements) : [];
|
|
18
|
+
}
|
|
19
|
+
return Array.from(elementOrSelector);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { resolveElements };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { resolveElements } from '
|
|
1
|
+
import { resolveElements } from '../../../../../dom/dist/es/utils/resolve-elements.mjs';
|
|
2
2
|
import { isDOMKeyframes } from '../utils/is-dom-keyframes.mjs';
|
|
3
3
|
|
|
4
4
|
function resolveSubjects(subject, keyframes, scope, selectorCache) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { invariant } from '../../../../../utils/dist/es/errors.mjs';
|
|
1
2
|
import { visualElementStore } from '../../render/store.mjs';
|
|
2
|
-
import { invariant } from '../../utils/errors.mjs';
|
|
3
3
|
import { isMotionValue } from '../../value/utils/is-motion-value.mjs';
|
|
4
4
|
import { animateTarget } from '../interfaces/visual-element-target.mjs';
|
|
5
5
|
import { createDOMVisualElement, createObjectVisualElement } from '../utils/create-visual-element.mjs';
|
|
@@ -2,7 +2,8 @@ import { anticipate } from '../../easing/anticipate.mjs';
|
|
|
2
2
|
import { backInOut } from '../../easing/back.mjs';
|
|
3
3
|
import { circInOut } from '../../easing/circ.mjs';
|
|
4
4
|
import { DOMKeyframesResolver } from '../../render/dom/DOMKeyframesResolver.mjs';
|
|
5
|
-
import
|
|
5
|
+
import '../../../../../utils/dist/es/errors.mjs';
|
|
6
|
+
import { noop } from '../../../../../utils/dist/es/noop.mjs';
|
|
6
7
|
import { millisecondsToSeconds, secondsToMilliseconds } from '../../utils/time-conversion.mjs';
|
|
7
8
|
import { isGenerator } from '../generators/utils/is-generator.mjs';
|
|
8
9
|
import { BaseAnimation } from './BaseAnimation.mjs';
|
|
@@ -8,7 +8,7 @@ import { mix } from '../../utils/mix/index.mjs';
|
|
|
8
8
|
import { calcGeneratorDuration } from '../generators/utils/calc-duration.mjs';
|
|
9
9
|
import { millisecondsToSeconds, secondsToMilliseconds } from '../../utils/time-conversion.mjs';
|
|
10
10
|
import { clamp } from '../../utils/clamp.mjs';
|
|
11
|
-
import { invariant } from '
|
|
11
|
+
import { invariant } from '../../../../../utils/dist/es/errors.mjs';
|
|
12
12
|
import { frameloopDriver } from './drivers/driver-frameloop.mjs';
|
|
13
13
|
import { getFinalKeyframe } from './waapi/utils/get-final-keyframe.mjs';
|
|
14
14
|
import { isGenerator } from '../generators/utils/is-generator.mjs';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { startWaapiAnimation } from './index.mjs';
|
|
2
2
|
import { createGeneratorEasing } from '../../../easing/utils/create-generator-easing.mjs';
|
|
3
3
|
import { browserNumberValueTypes } from '../../../render/dom/value-types/number-browser.mjs';
|
|
4
|
-
import { invariant } from '
|
|
5
|
-
import { noop } from '
|
|
4
|
+
import { invariant } from '../../../../../../utils/dist/es/errors.mjs';
|
|
5
|
+
import { noop } from '../../../../../../utils/dist/es/noop.mjs';
|
|
6
6
|
import { secondsToMilliseconds, millisecondsToSeconds } from '../../../utils/time-conversion.mjs';
|
|
7
7
|
import { isGenerator } from '../../generators/utils/is-generator.mjs';
|
|
8
8
|
import { attachTimeline } from './utils/attach-timeline.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { resolveElements } from '
|
|
2
|
-
import { invariant } from '
|
|
1
|
+
import { resolveElements } from '../../../../../../dom/dist/es/utils/resolve-elements.mjs';
|
|
2
|
+
import { invariant } from '../../../../../../utils/dist/es/errors.mjs';
|
|
3
3
|
import { secondsToMilliseconds } from '../../../utils/time-conversion.mjs';
|
|
4
4
|
import { getValueTransition } from '../../utils/get-value-transition.mjs';
|
|
5
5
|
import { NativeAnimation } from './NativeAnimation.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { warning } from '
|
|
1
|
+
import { warning } from '../../../../../../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';
|
|
@@ -3,7 +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
|
|
6
|
+
import '../../../../../utils/dist/es/errors.mjs';
|
|
7
|
+
import { noop } from '../../../../../utils/dist/es/noop.mjs';
|
|
7
8
|
import { getOptimisedAppearId } from './get-appear-id.mjs';
|
|
8
9
|
|
|
9
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 '
|
|
6
|
+
import { invariant } from '../../../../../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 '
|
|
2
|
+
import { invariant } from '../../../../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 '
|
|
3
|
+
import { invariant } from '../../../../../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 '
|
|
3
|
+
import { invariant } from '../../../../../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';
|