framer-motion 5.3.3 → 5.4.0-beta
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/components/AnimatePresence/use-presence.mjs +1 -27
- 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/geometry/models.mjs +1 -11
- package/dist/es/projection/node/create-projection-node.mjs +4 -1167
- package/dist/es/render/dom/value-types/dimensions.mjs +1 -8
- 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 +1 -0
- package/dist/es/utils/array.mjs +2 -13
- package/dist/framer-motion-three.cjs.js +2995 -0
- package/dist/framer-motion.cjs.js +19 -21
- package/dist/framer-motion.dev.js +8 -10
- package/dist/framer-motion.js +1 -1
- package/dist/projection.dev.js +2 -2
- package/dist/size-rollup-m.js +1 -1
- package/package.json +24 -3
- 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 +1 -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`.
|
|
@@ -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;
|
|
@@ -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
|
}
|
|
@@ -5017,7 +5015,7 @@ var PanSession = /** @class */ (function () {
|
|
|
5017
5015
|
return;
|
|
5018
5016
|
}
|
|
5019
5017
|
// Throttle mouse move event to once per frame
|
|
5020
|
-
sync__default[
|
|
5018
|
+
sync__default["default"].update(_this.updatePoint, true);
|
|
5021
5019
|
};
|
|
5022
5020
|
this.handlePointerUp = function (event, info) {
|
|
5023
5021
|
_this.end();
|
|
@@ -5922,7 +5920,7 @@ var visualElement = function (_a) {
|
|
|
5922
5920
|
function bindToMotionValue(key, value) {
|
|
5923
5921
|
var removeOnChange = value.onChange(function (latestValue) {
|
|
5924
5922
|
latestValues[key] = latestValue;
|
|
5925
|
-
props.onUpdate && sync__default[
|
|
5923
|
+
props.onUpdate && sync__default["default"].update(update, false, true);
|
|
5926
5924
|
});
|
|
5927
5925
|
var removeOnRenderRequest = value.onRenderRequest(element.scheduleRender);
|
|
5928
5926
|
valueSubscriptions.set(key, function () {
|
|
@@ -6181,7 +6179,7 @@ var visualElement = function (_a) {
|
|
|
6181
6179
|
* Schedule a render on the next animation frame.
|
|
6182
6180
|
*/
|
|
6183
6181
|
scheduleRender: function () {
|
|
6184
|
-
sync__default[
|
|
6182
|
+
sync__default["default"].render(render, false, true);
|
|
6185
6183
|
},
|
|
6186
6184
|
/**
|
|
6187
6185
|
* Synchronously fire render. It's prefered that we batch renders but
|
|
@@ -6855,7 +6853,7 @@ var MeasureLayoutWithContext = /** @class */ (function (_super) {
|
|
|
6855
6853
|
* it's in charge of the exit animation and therefore should
|
|
6856
6854
|
* be in charge of the safe to remove. Otherwise we call it here.
|
|
6857
6855
|
*/
|
|
6858
|
-
sync__default[
|
|
6856
|
+
sync__default["default"].postRender(function () {
|
|
6859
6857
|
var _a;
|
|
6860
6858
|
if (!((_a = projection.getStack()) === null || _a === void 0 ? void 0 : _a.members.length)) {
|
|
6861
6859
|
_this.safeToRemove();
|
|
@@ -6893,11 +6891,11 @@ var MeasureLayoutWithContext = /** @class */ (function (_super) {
|
|
|
6893
6891
|
return null;
|
|
6894
6892
|
};
|
|
6895
6893
|
return MeasureLayoutWithContext;
|
|
6896
|
-
}(React__default[
|
|
6894
|
+
}(React__default["default"].Component));
|
|
6897
6895
|
function MeasureLayout(props) {
|
|
6898
6896
|
var _a = tslib.__read(usePresence(), 2), isPresent = _a[0], safeToRemove = _a[1];
|
|
6899
6897
|
var layoutGroup = React.useContext(LayoutGroupContext);
|
|
6900
|
-
return (React__default[
|
|
6898
|
+
return (React__default["default"].createElement(MeasureLayoutWithContext, tslib.__assign({}, props, { layoutGroup: layoutGroup, switchLayoutGroup: React.useContext(SwitchLayoutGroupContext), isPresent: isPresent, safeToRemove: safeToRemove })));
|
|
6901
6899
|
}
|
|
6902
6900
|
var defaultScaleCorrectors = {
|
|
6903
6901
|
borderRadius: tslib.__assign(tslib.__assign({}, correctBorderRadius), { applyTo: [
|
|
@@ -6995,7 +6993,7 @@ function useForceUpdate() {
|
|
|
6995
6993
|
* Defer this to the end of the next animation frame in case there are multiple
|
|
6996
6994
|
* synchronous calls.
|
|
6997
6995
|
*/
|
|
6998
|
-
var deferredForceRender = React.useCallback(function () { return sync__default[
|
|
6996
|
+
var deferredForceRender = React.useCallback(function () { return sync__default["default"].postRender(forceRender); }, [forceRender]);
|
|
6999
6997
|
return [deferredForceRender, forcedRenderCount];
|
|
7000
6998
|
}
|
|
7001
6999
|
|
|
@@ -7529,7 +7527,7 @@ function useCombineMotionValues(values, combineValues) {
|
|
|
7529
7527
|
* Subscribe to all motion values found within the template. Whenever any of them change,
|
|
7530
7528
|
* schedule an update.
|
|
7531
7529
|
*/
|
|
7532
|
-
useMultiOnChange(values, function () { return sync__default[
|
|
7530
|
+
useMultiOnChange(values, function () { return sync__default["default"].update(updateValue, false, true); });
|
|
7533
7531
|
return value;
|
|
7534
7532
|
}
|
|
7535
7533
|
|
|
@@ -8151,8 +8149,8 @@ function useInstantTransition() {
|
|
|
8151
8149
|
/**
|
|
8152
8150
|
* Unblock after two animation frames, otherwise this will unblock too soon.
|
|
8153
8151
|
*/
|
|
8154
|
-
sync__default[
|
|
8155
|
-
return sync__default[
|
|
8152
|
+
sync__default["default"].postRender(function () {
|
|
8153
|
+
return sync__default["default"].postRender(function () { return (instantAnimationState.current = false); });
|
|
8156
8154
|
});
|
|
8157
8155
|
}, [forcedRenderCount]);
|
|
8158
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
|
|
|
@@ -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
|
}
|
|
@@ -8124,11 +8122,11 @@
|
|
|
8124
8122
|
return null;
|
|
8125
8123
|
};
|
|
8126
8124
|
return MeasureLayoutWithContext;
|
|
8127
|
-
}(React__default[
|
|
8125
|
+
}(React__default["default"].Component));
|
|
8128
8126
|
function MeasureLayout(props) {
|
|
8129
8127
|
var _a = __read(usePresence(), 2), isPresent = _a[0], safeToRemove = _a[1];
|
|
8130
8128
|
var layoutGroup = React.useContext(LayoutGroupContext);
|
|
8131
|
-
return (React__default[
|
|
8129
|
+
return (React__default["default"].createElement(MeasureLayoutWithContext, __assign({}, props, { layoutGroup: layoutGroup, switchLayoutGroup: React.useContext(SwitchLayoutGroupContext), isPresent: isPresent, safeToRemove: safeToRemove })));
|
|
8132
8130
|
}
|
|
8133
8131
|
var defaultScaleCorrectors = {
|
|
8134
8132
|
borderRadius: __assign(__assign({}, correctBorderRadius), { applyTo: [
|
|
@@ -9552,4 +9550,4 @@
|
|
|
9552
9550
|
|
|
9553
9551
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9554
9552
|
|
|
9555
|
-
}))
|
|
9553
|
+
}));
|