motion-dom 12.29.2 → 12.30.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/dist/cjs/index.js +20 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/animation/NativeAnimation.mjs +2 -1
- package/dist/es/animation/NativeAnimation.mjs.map +1 -1
- package/dist/es/animation/interfaces/motion-value.mjs +2 -1
- package/dist/es/animation/interfaces/motion-value.mjs.map +1 -1
- package/dist/es/layout/LayoutAnimationBuilder.mjs +5 -0
- package/dist/es/layout/LayoutAnimationBuilder.mjs.map +1 -1
- package/dist/es/render/VisualElement.mjs +11 -1
- package/dist/es/render/VisualElement.mjs.map +1 -1
- package/dist/index.d.ts +22 -1
- package/dist/motion-dom.dev.js +20 -3
- package/dist/motion-dom.js +1 -1
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -2134,7 +2134,8 @@ class NativeAnimation extends WithPromise {
|
|
|
2134
2134
|
* while deferring the commit until the next animation frame.
|
|
2135
2135
|
*/
|
|
2136
2136
|
commitStyles() {
|
|
2137
|
-
|
|
2137
|
+
const element = this.options?.element;
|
|
2138
|
+
if (!this.isPseudoElement && element?.isConnected) {
|
|
2138
2139
|
this.animation.commitStyles?.();
|
|
2139
2140
|
}
|
|
2140
2141
|
}
|
|
@@ -2835,7 +2836,8 @@ const animateMotionValue = (name, value, target, transition = {}, element, isHan
|
|
|
2835
2836
|
}
|
|
2836
2837
|
}
|
|
2837
2838
|
if (motionUtils.MotionGlobalConfig.instantAnimations ||
|
|
2838
|
-
motionUtils.MotionGlobalConfig.skipAnimations
|
|
2839
|
+
motionUtils.MotionGlobalConfig.skipAnimations ||
|
|
2840
|
+
element?.shouldSkipAnimations) {
|
|
2839
2841
|
shouldSkip = true;
|
|
2840
2842
|
makeAnimationInstant(options);
|
|
2841
2843
|
options.delay = 0;
|
|
@@ -5379,7 +5381,7 @@ class VisualElement {
|
|
|
5379
5381
|
scrapeMotionValuesFromProps(_props, _prevProps, _visualElement) {
|
|
5380
5382
|
return {};
|
|
5381
5383
|
}
|
|
5382
|
-
constructor({ parent, props, presenceContext, reducedMotionConfig, blockInitialAnimation, visualState, }, options = {}) {
|
|
5384
|
+
constructor({ parent, props, presenceContext, reducedMotionConfig, skipAnimations, blockInitialAnimation, visualState, }, options = {}) {
|
|
5383
5385
|
/**
|
|
5384
5386
|
* A reference to the current underlying Instance, e.g. a HTMLElement
|
|
5385
5387
|
* or Three.Mesh etc.
|
|
@@ -5402,6 +5404,11 @@ class VisualElement {
|
|
|
5402
5404
|
* like it could be set globally.
|
|
5403
5405
|
*/
|
|
5404
5406
|
this.shouldReduceMotion = null;
|
|
5407
|
+
/**
|
|
5408
|
+
* Decides whether animations should be skipped for this VisualElement.
|
|
5409
|
+
* Useful for E2E tests and visual regression testing.
|
|
5410
|
+
*/
|
|
5411
|
+
this.shouldSkipAnimations = false;
|
|
5405
5412
|
/**
|
|
5406
5413
|
* A map of all motion values attached to this visual element. Motion
|
|
5407
5414
|
* values are source of truth for any given animated value. A motion
|
|
@@ -5459,6 +5466,7 @@ class VisualElement {
|
|
|
5459
5466
|
this.presenceContext = presenceContext;
|
|
5460
5467
|
this.depth = parent ? parent.depth + 1 : 0;
|
|
5461
5468
|
this.reducedMotionConfig = reducedMotionConfig;
|
|
5469
|
+
this.skipAnimationsConfig = skipAnimations;
|
|
5462
5470
|
this.options = options;
|
|
5463
5471
|
this.blockInitialAnimation = Boolean(blockInitialAnimation);
|
|
5464
5472
|
this.isControllingVariants = isControllingVariants(props);
|
|
@@ -5515,6 +5523,10 @@ class VisualElement {
|
|
|
5515
5523
|
if (process.env.NODE_ENV !== "production") {
|
|
5516
5524
|
motionUtils.warnOnce(this.shouldReduceMotion !== true, "You have Reduced Motion enabled on your device. Animations may not appear as expected.", "reduced-motion-disabled");
|
|
5517
5525
|
}
|
|
5526
|
+
/**
|
|
5527
|
+
* Set whether animations should be skipped based on the config.
|
|
5528
|
+
*/
|
|
5529
|
+
this.shouldSkipAnimations = this.skipAnimationsConfig ?? false;
|
|
5518
5530
|
this.parent?.addChild(this);
|
|
5519
5531
|
this.update(this.props, this.presenceContext);
|
|
5520
5532
|
}
|
|
@@ -9287,6 +9299,11 @@ function getOrCreateRecord(element, parentProjection, projectionOptions) {
|
|
|
9287
9299
|
if (!visualElement.current) {
|
|
9288
9300
|
visualElement.mount(element);
|
|
9289
9301
|
}
|
|
9302
|
+
else if (!visualElement.projection.instance) {
|
|
9303
|
+
// Mount projection if VisualElement is already mounted but projection isn't
|
|
9304
|
+
// This happens when animate() was called before animateLayout()
|
|
9305
|
+
visualElement.projection.mount(element);
|
|
9306
|
+
}
|
|
9290
9307
|
if (!existing) {
|
|
9291
9308
|
visualElementStore.set(element, visualElement);
|
|
9292
9309
|
}
|