framer-motion 5.3.2 → 5.4.0-beta.2
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/es/animation/utils/easing.mjs +1 -1
- package/dist/es/animation/utils/transitions.mjs +1 -1
- package/dist/es/components/AnimatePresence/index.mjs +1 -1
- package/dist/es/components/AnimatePresence/use-presence.mjs +1 -27
- package/dist/es/components/AnimateSharedLayout.mjs +1 -1
- package/dist/es/components/MotionCanvas/index.mjs +14 -0
- package/dist/es/components/Reorder/Item.mjs +1 -1
- package/dist/es/context/MotionContext/index.mjs +1 -1
- package/dist/es/events/use-dom-event.mjs +2 -31
- package/dist/es/events/use-pointer-event.mjs +2 -5
- package/dist/es/gestures/utils/event-type.mjs +1 -8
- package/dist/es/motion/index.mjs +1 -1
- package/dist/es/projection/animation/mix-values.mjs +1 -1
- package/dist/es/projection/geometry/models.mjs +1 -11
- package/dist/es/projection/node/create-projection-node.mjs +4 -1167
- package/dist/es/projection/styles/scale-border-radius.mjs +1 -1
- package/dist/es/projection/styles/transform.mjs +5 -5
- package/dist/es/render/dom/motion-proxy.mjs +3 -0
- package/dist/es/render/dom/utils/css-variables-conversion.mjs +2 -2
- package/dist/es/render/dom/utils/filter-props.mjs +3 -1
- package/dist/es/render/dom/value-types/dimensions.mjs +1 -8
- package/dist/es/render/html/use-props.mjs +1 -1
- package/dist/es/render/html/utils/build-transform.mjs +2 -2
- package/dist/es/render/svg/utils/path.mjs +1 -1
- package/dist/es/render/svg/utils/transform-origin.mjs +1 -1
- package/dist/es/render/three/create-visual-element.mjs +42 -0
- package/dist/es/render/three/gestures/use-hover.mjs +22 -0
- package/dist/es/render/three/gestures/use-tap.mjs +56 -0
- package/dist/es/render/three/motion.mjs +30 -0
- package/dist/es/render/three/use-render.mjs +11 -0
- package/dist/es/render/three/utils/read-value.mjs +43 -0
- package/dist/es/render/three/utils/set-value.mjs +59 -0
- package/dist/es/render/utils/animation.mjs +1 -4
- package/dist/es/render/utils/setters.mjs +2 -39
- package/dist/es/three-entry.mjs +2 -0
- package/dist/es/utils/array.mjs +2 -13
- package/dist/framer-motion-three.cjs.js +3004 -0
- package/dist/framer-motion.cjs.js +46 -43
- package/dist/framer-motion.dev.js +35 -32
- package/dist/framer-motion.js +1 -1
- package/dist/projection.dev.js +17 -17
- package/dist/size-rollup-dom-animation.js +1 -1
- package/dist/size-rollup-dom-max.js +1 -1
- package/dist/size-rollup-m.js +1 -1
- package/package.json +27 -6
- package/types/components/MotionCanvas/index.d.ts +4 -0
- package/types/motion/features/types.d.ts +1 -1
- package/types/render/three/create-visual-element.d.ts +6 -0
- package/types/render/three/gestures/use-hover.d.ts +10 -0
- package/types/render/three/gestures/use-tap.d.ts +8 -0
- package/types/render/three/motion.d.ts +5 -0
- package/types/render/three/types.d.ts +24 -0
- package/types/render/three/use-render.d.ts +4 -0
- package/types/render/three/utils/read-value.d.ts +2 -0
- package/types/render/three/utils/set-value.d.ts +2 -0
- package/types/render/utils/lifecycles.d.ts +8 -8
- package/types/render/utils/setters.d.ts +1 -0
- package/types/three-entry.d.ts +2 -0
|
@@ -20,14 +20,12 @@ function _interopNamespace(e) {
|
|
|
20
20
|
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
21
21
|
Object.defineProperty(n, k, d.get ? d : {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return e[k];
|
|
25
|
-
}
|
|
23
|
+
get: function () { return e[k]; }
|
|
26
24
|
});
|
|
27
25
|
}
|
|
28
26
|
});
|
|
29
27
|
}
|
|
30
|
-
n[
|
|
28
|
+
n["default"] = e;
|
|
31
29
|
return Object.freeze(n);
|
|
32
30
|
}
|
|
33
31
|
|
|
@@ -438,7 +436,7 @@ var MotionValue = /** @class */ (function () {
|
|
|
438
436
|
if (_this.lastUpdated !== timestamp) {
|
|
439
437
|
_this.timeDelta = delta;
|
|
440
438
|
_this.lastUpdated = timestamp;
|
|
441
|
-
sync__default[
|
|
439
|
+
sync__default["default"].postRender(_this.scheduleVelocityCheck);
|
|
442
440
|
}
|
|
443
441
|
// Update update subscribers
|
|
444
442
|
if (_this.prev !== _this.current) {
|
|
@@ -461,7 +459,7 @@ var MotionValue = /** @class */ (function () {
|
|
|
461
459
|
*
|
|
462
460
|
* @internal
|
|
463
461
|
*/
|
|
464
|
-
this.scheduleVelocityCheck = function () { return sync__default[
|
|
462
|
+
this.scheduleVelocityCheck = function () { return sync__default["default"].postRender(_this.velocityCheck); };
|
|
465
463
|
/**
|
|
466
464
|
* Updates `prev` with `current` if the value hasn't been updated this frame.
|
|
467
465
|
* This ensures velocity calculations return `0`.
|
|
@@ -713,7 +711,7 @@ var easingDefinitionToFunction = function (definition) {
|
|
|
713
711
|
}
|
|
714
712
|
else if (typeof definition === "string") {
|
|
715
713
|
// Else lookup from table
|
|
716
|
-
heyListen.invariant(easingLookup[definition] !== undefined, "Invalid easing type '"
|
|
714
|
+
heyListen.invariant(easingLookup[definition] !== undefined, "Invalid easing type '".concat(definition, "'"));
|
|
717
715
|
return easingLookup[definition];
|
|
718
716
|
}
|
|
719
717
|
return definition;
|
|
@@ -1025,7 +1023,7 @@ function getAnimation(key, value, target, transition, onComplete) {
|
|
|
1025
1023
|
target = getZeroUnit(origin);
|
|
1026
1024
|
}
|
|
1027
1025
|
var isOriginAnimatable = isAnimatable(key, origin);
|
|
1028
|
-
heyListen.warning(isOriginAnimatable === isTargetAnimatable, "You are trying to animate "
|
|
1026
|
+
heyListen.warning(isOriginAnimatable === isTargetAnimatable, "You are trying to animate ".concat(key, " from \"").concat(origin, "\" to \"").concat(target, "\". ").concat(origin, " is not an animatable value - to enable this animation set ").concat(origin, " to a value animatable to ").concat(target, " via the `style` property."));
|
|
1029
1027
|
function start() {
|
|
1030
1028
|
var options = {
|
|
1031
1029
|
from: origin,
|
|
@@ -1161,7 +1159,7 @@ function mixValues(target, follow, lead, progress, shouldCrossfadeOpacity, isOnl
|
|
|
1161
1159
|
* Mix border radius
|
|
1162
1160
|
*/
|
|
1163
1161
|
for (var i = 0; i < numBorders; i++) {
|
|
1164
|
-
var borderLabel = "border"
|
|
1162
|
+
var borderLabel = "border".concat(borders[i], "Radius");
|
|
1165
1163
|
var followRadius = getRadius(follow, borderLabel);
|
|
1166
1164
|
var leadRadius = getRadius(lead, borderLabel);
|
|
1167
1165
|
if (followRadius === undefined && leadRadius === undefined)
|
|
@@ -1618,17 +1616,17 @@ function buildProjectionTransform(delta, treeScale, latestTransform) {
|
|
|
1618
1616
|
*/
|
|
1619
1617
|
var xTranslate = delta.x.translate / treeScale.x;
|
|
1620
1618
|
var yTranslate = delta.y.translate / treeScale.y;
|
|
1621
|
-
var transform = "translate3d("
|
|
1619
|
+
var transform = "translate3d(".concat(xTranslate, "px, ").concat(yTranslate, "px, 0) ");
|
|
1622
1620
|
if (latestTransform) {
|
|
1623
1621
|
var rotate = latestTransform.rotate, rotateX = latestTransform.rotateX, rotateY = latestTransform.rotateY;
|
|
1624
1622
|
if (rotate)
|
|
1625
|
-
transform += "rotate("
|
|
1623
|
+
transform += "rotate(".concat(rotate, "deg) ");
|
|
1626
1624
|
if (rotateX)
|
|
1627
|
-
transform += "rotateX("
|
|
1625
|
+
transform += "rotateX(".concat(rotateX, "deg) ");
|
|
1628
1626
|
if (rotateY)
|
|
1629
|
-
transform += "rotateY("
|
|
1627
|
+
transform += "rotateY(".concat(rotateY, "deg) ");
|
|
1630
1628
|
}
|
|
1631
|
-
transform += "scale("
|
|
1629
|
+
transform += "scale(".concat(delta.x.scale, ", ").concat(delta.y.scale, ")");
|
|
1632
1630
|
return transform === identityProjection ? "none" : transform;
|
|
1633
1631
|
}
|
|
1634
1632
|
|
|
@@ -2059,7 +2057,7 @@ function createProjectionNode(_a) {
|
|
|
2059
2057
|
this.sharedNodes.forEach(removeLeadSnapshots);
|
|
2060
2058
|
};
|
|
2061
2059
|
ProjectionNode.prototype.scheduleUpdateProjection = function () {
|
|
2062
|
-
sync__default[
|
|
2060
|
+
sync__default["default"].preRender(this.updateProjection, false, true);
|
|
2063
2061
|
};
|
|
2064
2062
|
ProjectionNode.prototype.scheduleCheckAfterUnmount = function () {
|
|
2065
2063
|
var _this = this;
|
|
@@ -2068,7 +2066,7 @@ function createProjectionNode(_a) {
|
|
|
2068
2066
|
* we manually call didUpdate to give a chance to the siblings to animate.
|
|
2069
2067
|
* Otherwise, cleanup all snapshots to prevents future nodes from reusing them.
|
|
2070
2068
|
*/
|
|
2071
|
-
sync__default[
|
|
2069
|
+
sync__default["default"].postRender(function () {
|
|
2072
2070
|
if (_this.isLayoutDirty) {
|
|
2073
2071
|
_this.root.didUpdate();
|
|
2074
2072
|
}
|
|
@@ -2468,7 +2466,7 @@ function createProjectionNode(_a) {
|
|
|
2468
2466
|
* where the target is the same as when the animation started, so we can
|
|
2469
2467
|
* calculate the relative positions correctly for instant transitions.
|
|
2470
2468
|
*/
|
|
2471
|
-
this.pendingAnimation = sync__default[
|
|
2469
|
+
this.pendingAnimation = sync__default["default"].update(function () {
|
|
2472
2470
|
globalProjectionState.hasAnimatedSinceResize = true;
|
|
2473
2471
|
_this.currentAnimation = animate(0, animationTarget, tslib.__assign(tslib.__assign({}, options), { onUpdate: function (latest) {
|
|
2474
2472
|
var _a;
|
|
@@ -2659,7 +2657,7 @@ function createProjectionNode(_a) {
|
|
|
2659
2657
|
styles.transform = transformTemplate(valuesToRender, styles.transform);
|
|
2660
2658
|
}
|
|
2661
2659
|
var _g = this.projectionDelta, x = _g.x, y = _g.y;
|
|
2662
|
-
styles.transformOrigin = x.origin * 100
|
|
2660
|
+
styles.transformOrigin = "".concat(x.origin * 100, "% ").concat(y.origin * 100, "% 0");
|
|
2663
2661
|
if (lead.animationValues) {
|
|
2664
2662
|
/**
|
|
2665
2663
|
* If the lead component is animating, assign this either the entering/leaving
|
|
@@ -2865,7 +2863,7 @@ function mountNodeEarly(node, id) {
|
|
|
2865
2863
|
}
|
|
2866
2864
|
}
|
|
2867
2865
|
var searchElement = searchNode && searchNode !== node.root ? searchNode.instance : document;
|
|
2868
|
-
var element = searchElement.querySelector("[data-projection-id=\""
|
|
2866
|
+
var element = searchElement.querySelector("[data-projection-id=\"".concat(id, "\"]"));
|
|
2869
2867
|
if (element)
|
|
2870
2868
|
node.mount(element, true);
|
|
2871
2869
|
}
|
|
@@ -2948,7 +2946,7 @@ var VisualElementHandler = /** @class */ (function (_super) {
|
|
|
2948
2946
|
return this.props.children;
|
|
2949
2947
|
};
|
|
2950
2948
|
return VisualElementHandler;
|
|
2951
|
-
}(React__default[
|
|
2949
|
+
}(React__default["default"].Component));
|
|
2952
2950
|
|
|
2953
2951
|
/**
|
|
2954
2952
|
* Create a `motion` component.
|
|
@@ -3014,7 +3012,7 @@ function createMotionComponent(_a) {
|
|
|
3014
3012
|
*/
|
|
3015
3013
|
return (React__namespace.createElement(VisualElementHandler, { visualElement: context.visualElement, props: tslib.__assign(tslib.__assign({}, config), props) },
|
|
3016
3014
|
features,
|
|
3017
|
-
React__namespace.createElement(MotionContext.Provider, { value: context }, useRender(Component, props, projectionId, useMotionRef(visualState, context.visualElement, externalRef), visualState, config.isStatic))));
|
|
3015
|
+
React__namespace.createElement(MotionContext.Provider, { value: context }, useRender(Component, props, projectionId, useMotionRef(visualState, context.visualElement, externalRef), visualState, config.isStatic, context.visualElement))));
|
|
3018
3016
|
}
|
|
3019
3017
|
return React.forwardRef(MotionComponent);
|
|
3020
3018
|
}
|
|
@@ -3046,6 +3044,9 @@ function createMotionProxy(createConfig) {
|
|
|
3046
3044
|
if (customMotionComponentConfig === void 0) { customMotionComponentConfig = {}; }
|
|
3047
3045
|
return createMotionComponent(createConfig(Component, customMotionComponentConfig));
|
|
3048
3046
|
}
|
|
3047
|
+
if (typeof Proxy === "undefined") {
|
|
3048
|
+
return custom;
|
|
3049
|
+
}
|
|
3049
3050
|
/**
|
|
3050
3051
|
* A cache of generated `motion` components, e.g `motion.div`, `motion.input` etc.
|
|
3051
3052
|
* Rather than generating them anew every render.
|
|
@@ -3162,7 +3163,7 @@ function buildTransform(_a, _b, transformIsDefault, transformTemplate) {
|
|
|
3162
3163
|
var numTransformKeys = transformKeys.length;
|
|
3163
3164
|
for (var i = 0; i < numTransformKeys; i++) {
|
|
3164
3165
|
var key = transformKeys[i];
|
|
3165
|
-
transformString += (translateAlias[key] || key
|
|
3166
|
+
transformString += "".concat(translateAlias[key] || key, "(").concat(transform[key], ") ");
|
|
3166
3167
|
if (key === "z")
|
|
3167
3168
|
transformHasZ = true;
|
|
3168
3169
|
}
|
|
@@ -3188,7 +3189,7 @@ function buildTransform(_a, _b, transformIsDefault, transformTemplate) {
|
|
|
3188
3189
|
*/
|
|
3189
3190
|
function buildTransformOrigin(_a) {
|
|
3190
3191
|
var _b = _a.originX, originX = _b === void 0 ? "50%" : _b, _c = _a.originY, originY = _c === void 0 ? "50%" : _c, _d = _a.originZ, originZ = _d === void 0 ? 0 : _d;
|
|
3191
|
-
return originX
|
|
3192
|
+
return "".concat(originX, " ").concat(originY, " ").concat(originZ);
|
|
3192
3193
|
}
|
|
3193
3194
|
|
|
3194
3195
|
/**
|
|
@@ -3322,7 +3323,7 @@ function useHTMLProps(props, visualState, isStatic) {
|
|
|
3322
3323
|
style.touchAction =
|
|
3323
3324
|
props.drag === true
|
|
3324
3325
|
? "none"
|
|
3325
|
-
: "pan-"
|
|
3326
|
+
: "pan-".concat(props.drag === "x" ? "y" : "x");
|
|
3326
3327
|
}
|
|
3327
3328
|
htmlProps.style = style;
|
|
3328
3329
|
return htmlProps;
|
|
@@ -3437,7 +3438,9 @@ function filterProps(props, isDom, forwardMotionProps) {
|
|
|
3437
3438
|
for (var key in props) {
|
|
3438
3439
|
if (shouldForward(key) ||
|
|
3439
3440
|
(forwardMotionProps === true && isValidMotionProp(key)) ||
|
|
3440
|
-
(!isDom && !isValidMotionProp(key))
|
|
3441
|
+
(!isDom && !isValidMotionProp(key)) ||
|
|
3442
|
+
// If trying to use native HTML drag events, forward drag listeners
|
|
3443
|
+
(props["draggable"] && key.startsWith("onDrag"))) {
|
|
3441
3444
|
filteredProps[key] = props[key];
|
|
3442
3445
|
}
|
|
3443
3446
|
}
|
|
@@ -3456,7 +3459,7 @@ function calcOrigin$1(origin, offset, size) {
|
|
|
3456
3459
|
function calcSVGTransformOrigin(dimensions, originX, originY) {
|
|
3457
3460
|
var pxOriginX = calcOrigin$1(originX, dimensions.x, dimensions.width);
|
|
3458
3461
|
var pxOriginY = calcOrigin$1(originY, dimensions.y, dimensions.height);
|
|
3459
|
-
return pxOriginX
|
|
3462
|
+
return "".concat(pxOriginX, " ").concat(pxOriginY);
|
|
3460
3463
|
}
|
|
3461
3464
|
|
|
3462
3465
|
var dashKeys = {
|
|
@@ -3488,7 +3491,7 @@ function buildSVGPath(attrs, length, spacing, offset, useDashCase) {
|
|
|
3488
3491
|
// Build the dash array
|
|
3489
3492
|
var pathLength = styleValueTypes.px.transform(length);
|
|
3490
3493
|
var pathSpacing = styleValueTypes.px.transform(spacing);
|
|
3491
|
-
attrs[keys.array] = pathLength
|
|
3494
|
+
attrs[keys.array] = "".concat(pathLength, " ").concat(pathSpacing);
|
|
3492
3495
|
}
|
|
3493
3496
|
|
|
3494
3497
|
/**
|
|
@@ -5012,7 +5015,7 @@ var PanSession = /** @class */ (function () {
|
|
|
5012
5015
|
return;
|
|
5013
5016
|
}
|
|
5014
5017
|
// Throttle mouse move event to once per frame
|
|
5015
|
-
sync__default[
|
|
5018
|
+
sync__default["default"].update(_this.updatePoint, true);
|
|
5016
5019
|
};
|
|
5017
5020
|
this.handlePointerUp = function (event, info) {
|
|
5018
5021
|
_this.end();
|
|
@@ -5917,7 +5920,7 @@ var visualElement = function (_a) {
|
|
|
5917
5920
|
function bindToMotionValue(key, value) {
|
|
5918
5921
|
var removeOnChange = value.onChange(function (latestValue) {
|
|
5919
5922
|
latestValues[key] = latestValue;
|
|
5920
|
-
props.onUpdate && sync__default[
|
|
5923
|
+
props.onUpdate && sync__default["default"].update(update, false, true);
|
|
5921
5924
|
});
|
|
5922
5925
|
var removeOnRenderRequest = value.onRenderRequest(element.scheduleRender);
|
|
5923
5926
|
valueSubscriptions.set(key, function () {
|
|
@@ -6176,7 +6179,7 @@ var visualElement = function (_a) {
|
|
|
6176
6179
|
* Schedule a render on the next animation frame.
|
|
6177
6180
|
*/
|
|
6178
6181
|
scheduleRender: function () {
|
|
6179
|
-
sync__default[
|
|
6182
|
+
sync__default["default"].render(render, false, true);
|
|
6180
6183
|
},
|
|
6181
6184
|
/**
|
|
6182
6185
|
* Synchronously fire render. It's prefered that we batch renders but
|
|
@@ -6258,7 +6261,7 @@ function parseCSSVariable(current) {
|
|
|
6258
6261
|
var maxDepth = 4;
|
|
6259
6262
|
function getVariableValue(current, element, depth) {
|
|
6260
6263
|
if (depth === void 0) { depth = 1; }
|
|
6261
|
-
heyListen.invariant(depth <= maxDepth, "Max CSS variable fallback depth detected in property \""
|
|
6264
|
+
heyListen.invariant(depth <= maxDepth, "Max CSS variable fallback depth detected in property \"".concat(current, "\". This may indicate a circular fallback dependency."));
|
|
6262
6265
|
var _a = tslib.__read(parseCSSVariable(current), 2), token = _a[0], fallback = _a[1];
|
|
6263
6266
|
// No CSS variable detected
|
|
6264
6267
|
if (!token)
|
|
@@ -6285,7 +6288,7 @@ function resolveCSSVariables(visualElement, _a, transitionEnd) {
|
|
|
6285
6288
|
var _b;
|
|
6286
6289
|
var target = tslib.__rest(_a, []);
|
|
6287
6290
|
var element = visualElement.getInstance();
|
|
6288
|
-
if (!(element instanceof
|
|
6291
|
+
if (!(element instanceof Element))
|
|
6289
6292
|
return { target: target, transitionEnd: transitionEnd };
|
|
6290
6293
|
// If `transitionEnd` isn't `undefined`, clone it. We could clone `target` and `transitionEnd`
|
|
6291
6294
|
// only if they change but I think this reads clearer and this isn't a performance-critical path.
|
|
@@ -6732,7 +6735,7 @@ var correctBorderRadius = {
|
|
|
6732
6735
|
*/
|
|
6733
6736
|
var x = pixelsToPercent(latest, node.target.x);
|
|
6734
6737
|
var y = pixelsToPercent(latest, node.target.y);
|
|
6735
|
-
return x
|
|
6738
|
+
return "".concat(x, "% ").concat(y, "%");
|
|
6736
6739
|
},
|
|
6737
6740
|
};
|
|
6738
6741
|
|
|
@@ -6850,7 +6853,7 @@ var MeasureLayoutWithContext = /** @class */ (function (_super) {
|
|
|
6850
6853
|
* it's in charge of the exit animation and therefore should
|
|
6851
6854
|
* be in charge of the safe to remove. Otherwise we call it here.
|
|
6852
6855
|
*/
|
|
6853
|
-
sync__default[
|
|
6856
|
+
sync__default["default"].postRender(function () {
|
|
6854
6857
|
var _a;
|
|
6855
6858
|
if (!((_a = projection.getStack()) === null || _a === void 0 ? void 0 : _a.members.length)) {
|
|
6856
6859
|
_this.safeToRemove();
|
|
@@ -6888,11 +6891,11 @@ var MeasureLayoutWithContext = /** @class */ (function (_super) {
|
|
|
6888
6891
|
return null;
|
|
6889
6892
|
};
|
|
6890
6893
|
return MeasureLayoutWithContext;
|
|
6891
|
-
}(React__default[
|
|
6894
|
+
}(React__default["default"].Component));
|
|
6892
6895
|
function MeasureLayout(props) {
|
|
6893
6896
|
var _a = tslib.__read(usePresence(), 2), isPresent = _a[0], safeToRemove = _a[1];
|
|
6894
6897
|
var layoutGroup = React.useContext(LayoutGroupContext);
|
|
6895
|
-
return (React__default[
|
|
6898
|
+
return (React__default["default"].createElement(MeasureLayoutWithContext, tslib.__assign({}, props, { layoutGroup: layoutGroup, switchLayoutGroup: React.useContext(SwitchLayoutGroupContext), isPresent: isPresent, safeToRemove: safeToRemove })));
|
|
6896
6899
|
}
|
|
6897
6900
|
var defaultScaleCorrectors = {
|
|
6898
6901
|
borderRadius: tslib.__assign(tslib.__assign({}, correctBorderRadius), { applyTo: [
|
|
@@ -6990,7 +6993,7 @@ function useForceUpdate() {
|
|
|
6990
6993
|
* Defer this to the end of the next animation frame in case there are multiple
|
|
6991
6994
|
* synchronous calls.
|
|
6992
6995
|
*/
|
|
6993
|
-
var deferredForceRender = React.useCallback(function () { return sync__default[
|
|
6996
|
+
var deferredForceRender = React.useCallback(function () { return sync__default["default"].postRender(forceRender); }, [forceRender]);
|
|
6994
6997
|
return [deferredForceRender, forcedRenderCount];
|
|
6995
6998
|
}
|
|
6996
6999
|
|
|
@@ -7064,7 +7067,7 @@ function updateChildLookup(children, allChildren) {
|
|
|
7064
7067
|
var key = getChildKey(child);
|
|
7065
7068
|
if (process.env.NODE_ENV !== "production" && seenChildren) {
|
|
7066
7069
|
if (seenChildren.has(key)) {
|
|
7067
|
-
console.warn("Children of AnimatePresence require unique keys. \""
|
|
7070
|
+
console.warn("Children of AnimatePresence require unique keys. \"".concat(key, "\" is a duplicate."));
|
|
7068
7071
|
}
|
|
7069
7072
|
seenChildren.add(key);
|
|
7070
7073
|
}
|
|
@@ -7265,7 +7268,7 @@ var LayoutGroup = function (_a) {
|
|
|
7265
7268
|
var id = 0;
|
|
7266
7269
|
var AnimateSharedLayout = function (_a) {
|
|
7267
7270
|
var children = _a.children;
|
|
7268
|
-
return (React__namespace.createElement(LayoutGroup, { id: useConstant(function () { return "asl-"
|
|
7271
|
+
return (React__namespace.createElement(LayoutGroup, { id: useConstant(function () { return "asl-".concat(id++); }) }, children));
|
|
7269
7272
|
};
|
|
7270
7273
|
|
|
7271
7274
|
/**
|
|
@@ -7524,7 +7527,7 @@ function useCombineMotionValues(values, combineValues) {
|
|
|
7524
7527
|
* Subscribe to all motion values found within the template. Whenever any of them change,
|
|
7525
7528
|
* schedule an update.
|
|
7526
7529
|
*/
|
|
7527
|
-
useMultiOnChange(values, function () { return sync__default[
|
|
7530
|
+
useMultiOnChange(values, function () { return sync__default["default"].update(updateValue, false, true); });
|
|
7528
7531
|
return value;
|
|
7529
7532
|
}
|
|
7530
7533
|
|
|
@@ -7565,7 +7568,7 @@ function ReorderItem(_a, externalRef) {
|
|
|
7565
7568
|
};
|
|
7566
7569
|
var zIndex = useTransform([point.x, point.y], function (_a) {
|
|
7567
7570
|
var _b = tslib.__read(_a, 2), latestX = _b[0], latestY = _b[1];
|
|
7568
|
-
return latestX || latestY ? 1 :
|
|
7571
|
+
return latestX || latestY ? 1 : "unset";
|
|
7569
7572
|
});
|
|
7570
7573
|
var layout = React.useRef(null);
|
|
7571
7574
|
heyListen.invariant(Boolean(context), "Reorder.Item must be a child of Reorder.Group");
|
|
@@ -8146,8 +8149,8 @@ function useInstantTransition() {
|
|
|
8146
8149
|
/**
|
|
8147
8150
|
* Unblock after two animation frames, otherwise this will unblock too soon.
|
|
8148
8151
|
*/
|
|
8149
|
-
sync__default[
|
|
8150
|
-
return sync__default[
|
|
8152
|
+
sync__default["default"].postRender(function () {
|
|
8153
|
+
return sync__default["default"].postRender(function () { return (instantAnimationState.current = false); });
|
|
8151
8154
|
});
|
|
8152
8155
|
}, [forcedRenderCount]);
|
|
8153
8156
|
return function (callback) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Motion = {}, global.React));
|
|
5
|
-
}(this, (function (exports, React) { 'use strict';
|
|
5
|
+
})(this, (function (exports, React) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -15,14 +15,12 @@
|
|
|
15
15
|
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
16
|
Object.defineProperty(n, k, d.get ? d : {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () {
|
|
19
|
-
return e[k];
|
|
20
|
-
}
|
|
18
|
+
get: function () { return e[k]; }
|
|
21
19
|
});
|
|
22
20
|
}
|
|
23
21
|
});
|
|
24
22
|
}
|
|
25
|
-
n[
|
|
23
|
+
n["default"] = e;
|
|
26
24
|
return Object.freeze(n);
|
|
27
25
|
}
|
|
28
26
|
|
|
@@ -1944,7 +1942,7 @@
|
|
|
1944
1942
|
}
|
|
1945
1943
|
else if (typeof definition === "string") {
|
|
1946
1944
|
// Else lookup from table
|
|
1947
|
-
invariant(easingLookup[definition] !== undefined, "Invalid easing type '"
|
|
1945
|
+
invariant(easingLookup[definition] !== undefined, "Invalid easing type '".concat(definition, "'"));
|
|
1948
1946
|
return easingLookup[definition];
|
|
1949
1947
|
}
|
|
1950
1948
|
return definition;
|
|
@@ -2256,7 +2254,7 @@
|
|
|
2256
2254
|
target = getZeroUnit(origin);
|
|
2257
2255
|
}
|
|
2258
2256
|
var isOriginAnimatable = isAnimatable(key, origin);
|
|
2259
|
-
warning(isOriginAnimatable === isTargetAnimatable, "You are trying to animate "
|
|
2257
|
+
warning(isOriginAnimatable === isTargetAnimatable, "You are trying to animate ".concat(key, " from \"").concat(origin, "\" to \"").concat(target, "\". ").concat(origin, " is not an animatable value - to enable this animation set ").concat(origin, " to a value animatable to ").concat(target, " via the `style` property."));
|
|
2260
2258
|
function start() {
|
|
2261
2259
|
var options = {
|
|
2262
2260
|
from: origin,
|
|
@@ -2392,7 +2390,7 @@
|
|
|
2392
2390
|
* Mix border radius
|
|
2393
2391
|
*/
|
|
2394
2392
|
for (var i = 0; i < numBorders; i++) {
|
|
2395
|
-
var borderLabel = "border"
|
|
2393
|
+
var borderLabel = "border".concat(borders[i], "Radius");
|
|
2396
2394
|
var followRadius = getRadius(follow, borderLabel);
|
|
2397
2395
|
var leadRadius = getRadius(lead, borderLabel);
|
|
2398
2396
|
if (followRadius === undefined && leadRadius === undefined)
|
|
@@ -2849,17 +2847,17 @@
|
|
|
2849
2847
|
*/
|
|
2850
2848
|
var xTranslate = delta.x.translate / treeScale.x;
|
|
2851
2849
|
var yTranslate = delta.y.translate / treeScale.y;
|
|
2852
|
-
var transform = "translate3d("
|
|
2850
|
+
var transform = "translate3d(".concat(xTranslate, "px, ").concat(yTranslate, "px, 0) ");
|
|
2853
2851
|
if (latestTransform) {
|
|
2854
2852
|
var rotate = latestTransform.rotate, rotateX = latestTransform.rotateX, rotateY = latestTransform.rotateY;
|
|
2855
2853
|
if (rotate)
|
|
2856
|
-
transform += "rotate("
|
|
2854
|
+
transform += "rotate(".concat(rotate, "deg) ");
|
|
2857
2855
|
if (rotateX)
|
|
2858
|
-
transform += "rotateX("
|
|
2856
|
+
transform += "rotateX(".concat(rotateX, "deg) ");
|
|
2859
2857
|
if (rotateY)
|
|
2860
|
-
transform += "rotateY("
|
|
2858
|
+
transform += "rotateY(".concat(rotateY, "deg) ");
|
|
2861
2859
|
}
|
|
2862
|
-
transform += "scale("
|
|
2860
|
+
transform += "scale(".concat(delta.x.scale, ", ").concat(delta.y.scale, ")");
|
|
2863
2861
|
return transform === identityProjection ? "none" : transform;
|
|
2864
2862
|
}
|
|
2865
2863
|
|
|
@@ -3890,7 +3888,7 @@
|
|
|
3890
3888
|
styles.transform = transformTemplate(valuesToRender, styles.transform);
|
|
3891
3889
|
}
|
|
3892
3890
|
var _g = this.projectionDelta, x = _g.x, y = _g.y;
|
|
3893
|
-
styles.transformOrigin = x.origin * 100
|
|
3891
|
+
styles.transformOrigin = "".concat(x.origin * 100, "% ").concat(y.origin * 100, "% 0");
|
|
3894
3892
|
if (lead.animationValues) {
|
|
3895
3893
|
/**
|
|
3896
3894
|
* If the lead component is animating, assign this either the entering/leaving
|
|
@@ -4096,7 +4094,7 @@
|
|
|
4096
4094
|
}
|
|
4097
4095
|
}
|
|
4098
4096
|
var searchElement = searchNode && searchNode !== node.root ? searchNode.instance : document;
|
|
4099
|
-
var element = searchElement.querySelector("[data-projection-id=\""
|
|
4097
|
+
var element = searchElement.querySelector("[data-projection-id=\"".concat(id, "\"]"));
|
|
4100
4098
|
if (element)
|
|
4101
4099
|
node.mount(element, true);
|
|
4102
4100
|
}
|
|
@@ -4179,7 +4177,7 @@
|
|
|
4179
4177
|
return this.props.children;
|
|
4180
4178
|
};
|
|
4181
4179
|
return VisualElementHandler;
|
|
4182
|
-
}(React__default[
|
|
4180
|
+
}(React__default["default"].Component));
|
|
4183
4181
|
|
|
4184
4182
|
/**
|
|
4185
4183
|
* Create a `motion` component.
|
|
@@ -4245,7 +4243,7 @@
|
|
|
4245
4243
|
*/
|
|
4246
4244
|
return (React__namespace.createElement(VisualElementHandler, { visualElement: context.visualElement, props: __assign(__assign({}, config), props) },
|
|
4247
4245
|
features,
|
|
4248
|
-
React__namespace.createElement(MotionContext.Provider, { value: context }, useRender(Component, props, projectionId, useMotionRef(visualState, context.visualElement, externalRef), visualState, config.isStatic))));
|
|
4246
|
+
React__namespace.createElement(MotionContext.Provider, { value: context }, useRender(Component, props, projectionId, useMotionRef(visualState, context.visualElement, externalRef), visualState, config.isStatic, context.visualElement))));
|
|
4249
4247
|
}
|
|
4250
4248
|
return React.forwardRef(MotionComponent);
|
|
4251
4249
|
}
|
|
@@ -4277,6 +4275,9 @@
|
|
|
4277
4275
|
if (customMotionComponentConfig === void 0) { customMotionComponentConfig = {}; }
|
|
4278
4276
|
return createMotionComponent(createConfig(Component, customMotionComponentConfig));
|
|
4279
4277
|
}
|
|
4278
|
+
if (typeof Proxy === "undefined") {
|
|
4279
|
+
return custom;
|
|
4280
|
+
}
|
|
4280
4281
|
/**
|
|
4281
4282
|
* A cache of generated `motion` components, e.g `motion.div`, `motion.input` etc.
|
|
4282
4283
|
* Rather than generating them anew every render.
|
|
@@ -4393,7 +4394,7 @@
|
|
|
4393
4394
|
var numTransformKeys = transformKeys.length;
|
|
4394
4395
|
for (var i = 0; i < numTransformKeys; i++) {
|
|
4395
4396
|
var key = transformKeys[i];
|
|
4396
|
-
transformString += (translateAlias[key] || key
|
|
4397
|
+
transformString += "".concat(translateAlias[key] || key, "(").concat(transform[key], ") ");
|
|
4397
4398
|
if (key === "z")
|
|
4398
4399
|
transformHasZ = true;
|
|
4399
4400
|
}
|
|
@@ -4419,7 +4420,7 @@
|
|
|
4419
4420
|
*/
|
|
4420
4421
|
function buildTransformOrigin(_a) {
|
|
4421
4422
|
var _b = _a.originX, originX = _b === void 0 ? "50%" : _b, _c = _a.originY, originY = _c === void 0 ? "50%" : _c, _d = _a.originZ, originZ = _d === void 0 ? 0 : _d;
|
|
4422
|
-
return originX
|
|
4423
|
+
return "".concat(originX, " ").concat(originY, " ").concat(originZ);
|
|
4423
4424
|
}
|
|
4424
4425
|
|
|
4425
4426
|
/**
|
|
@@ -4553,7 +4554,7 @@
|
|
|
4553
4554
|
style.touchAction =
|
|
4554
4555
|
props.drag === true
|
|
4555
4556
|
? "none"
|
|
4556
|
-
: "pan-"
|
|
4557
|
+
: "pan-".concat(props.drag === "x" ? "y" : "x");
|
|
4557
4558
|
}
|
|
4558
4559
|
htmlProps.style = style;
|
|
4559
4560
|
return htmlProps;
|
|
@@ -4668,7 +4669,9 @@
|
|
|
4668
4669
|
for (var key in props) {
|
|
4669
4670
|
if (shouldForward(key) ||
|
|
4670
4671
|
(forwardMotionProps === true && isValidMotionProp(key)) ||
|
|
4671
|
-
(!isDom && !isValidMotionProp(key))
|
|
4672
|
+
(!isDom && !isValidMotionProp(key)) ||
|
|
4673
|
+
// If trying to use native HTML drag events, forward drag listeners
|
|
4674
|
+
(props["draggable"] && key.startsWith("onDrag"))) {
|
|
4672
4675
|
filteredProps[key] = props[key];
|
|
4673
4676
|
}
|
|
4674
4677
|
}
|
|
@@ -4687,7 +4690,7 @@
|
|
|
4687
4690
|
function calcSVGTransformOrigin(dimensions, originX, originY) {
|
|
4688
4691
|
var pxOriginX = calcOrigin$1(originX, dimensions.x, dimensions.width);
|
|
4689
4692
|
var pxOriginY = calcOrigin$1(originY, dimensions.y, dimensions.height);
|
|
4690
|
-
return pxOriginX
|
|
4693
|
+
return "".concat(pxOriginX, " ").concat(pxOriginY);
|
|
4691
4694
|
}
|
|
4692
4695
|
|
|
4693
4696
|
var dashKeys = {
|
|
@@ -4719,7 +4722,7 @@
|
|
|
4719
4722
|
// Build the dash array
|
|
4720
4723
|
var pathLength = px.transform(length);
|
|
4721
4724
|
var pathSpacing = px.transform(spacing);
|
|
4722
|
-
attrs[keys.array] = pathLength
|
|
4725
|
+
attrs[keys.array] = "".concat(pathLength, " ").concat(pathSpacing);
|
|
4723
4726
|
}
|
|
4724
4727
|
|
|
4725
4728
|
/**
|
|
@@ -7489,7 +7492,7 @@
|
|
|
7489
7492
|
var maxDepth = 4;
|
|
7490
7493
|
function getVariableValue(current, element, depth) {
|
|
7491
7494
|
if (depth === void 0) { depth = 1; }
|
|
7492
|
-
invariant(depth <= maxDepth, "Max CSS variable fallback depth detected in property \""
|
|
7495
|
+
invariant(depth <= maxDepth, "Max CSS variable fallback depth detected in property \"".concat(current, "\". This may indicate a circular fallback dependency."));
|
|
7493
7496
|
var _a = __read(parseCSSVariable(current), 2), token = _a[0], fallback = _a[1];
|
|
7494
7497
|
// No CSS variable detected
|
|
7495
7498
|
if (!token)
|
|
@@ -7516,7 +7519,7 @@
|
|
|
7516
7519
|
var _b;
|
|
7517
7520
|
var target = __rest(_a, []);
|
|
7518
7521
|
var element = visualElement.getInstance();
|
|
7519
|
-
if (!(element instanceof
|
|
7522
|
+
if (!(element instanceof Element))
|
|
7520
7523
|
return { target: target, transitionEnd: transitionEnd };
|
|
7521
7524
|
// If `transitionEnd` isn't `undefined`, clone it. We could clone `target` and `transitionEnd`
|
|
7522
7525
|
// only if they change but I think this reads clearer and this isn't a performance-critical path.
|
|
@@ -7963,7 +7966,7 @@
|
|
|
7963
7966
|
*/
|
|
7964
7967
|
var x = pixelsToPercent(latest, node.target.x);
|
|
7965
7968
|
var y = pixelsToPercent(latest, node.target.y);
|
|
7966
|
-
return x
|
|
7969
|
+
return "".concat(x, "% ").concat(y, "%");
|
|
7967
7970
|
},
|
|
7968
7971
|
};
|
|
7969
7972
|
|
|
@@ -8119,11 +8122,11 @@
|
|
|
8119
8122
|
return null;
|
|
8120
8123
|
};
|
|
8121
8124
|
return MeasureLayoutWithContext;
|
|
8122
|
-
}(React__default[
|
|
8125
|
+
}(React__default["default"].Component));
|
|
8123
8126
|
function MeasureLayout(props) {
|
|
8124
8127
|
var _a = __read(usePresence(), 2), isPresent = _a[0], safeToRemove = _a[1];
|
|
8125
8128
|
var layoutGroup = React.useContext(LayoutGroupContext);
|
|
8126
|
-
return (React__default[
|
|
8129
|
+
return (React__default["default"].createElement(MeasureLayoutWithContext, __assign({}, props, { layoutGroup: layoutGroup, switchLayoutGroup: React.useContext(SwitchLayoutGroupContext), isPresent: isPresent, safeToRemove: safeToRemove })));
|
|
8127
8130
|
}
|
|
8128
8131
|
var defaultScaleCorrectors = {
|
|
8129
8132
|
borderRadius: __assign(__assign({}, correctBorderRadius), { applyTo: [
|
|
@@ -8295,7 +8298,7 @@
|
|
|
8295
8298
|
var key = getChildKey(child);
|
|
8296
8299
|
if (seenChildren) {
|
|
8297
8300
|
if (seenChildren.has(key)) {
|
|
8298
|
-
console.warn("Children of AnimatePresence require unique keys. \""
|
|
8301
|
+
console.warn("Children of AnimatePresence require unique keys. \"".concat(key, "\" is a duplicate."));
|
|
8299
8302
|
}
|
|
8300
8303
|
seenChildren.add(key);
|
|
8301
8304
|
}
|
|
@@ -8495,7 +8498,7 @@
|
|
|
8495
8498
|
var id = 0;
|
|
8496
8499
|
var AnimateSharedLayout = function (_a) {
|
|
8497
8500
|
var children = _a.children;
|
|
8498
|
-
return (React__namespace.createElement(LayoutGroup, { id: useConstant(function () { return "asl-"
|
|
8501
|
+
return (React__namespace.createElement(LayoutGroup, { id: useConstant(function () { return "asl-".concat(id++); }) }, children));
|
|
8499
8502
|
};
|
|
8500
8503
|
|
|
8501
8504
|
/**
|
|
@@ -8795,7 +8798,7 @@
|
|
|
8795
8798
|
};
|
|
8796
8799
|
var zIndex = useTransform([point.x, point.y], function (_a) {
|
|
8797
8800
|
var _b = __read(_a, 2), latestX = _b[0], latestY = _b[1];
|
|
8798
|
-
return latestX || latestY ? 1 :
|
|
8801
|
+
return latestX || latestY ? 1 : "unset";
|
|
8799
8802
|
});
|
|
8800
8803
|
var layout = React.useRef(null);
|
|
8801
8804
|
invariant(Boolean(context), "Reorder.Item must be a child of Reorder.Group");
|
|
@@ -9547,4 +9550,4 @@
|
|
|
9547
9550
|
|
|
9548
9551
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9549
9552
|
|
|
9550
|
-
}))
|
|
9553
|
+
}));
|