motion-dom 12.31.3 → 12.32.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 +25 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/animation/interfaces/visual-element-target.mjs +6 -1
- package/dist/es/animation/interfaces/visual-element-target.mjs.map +1 -1
- package/dist/es/animation/utils/get-value-transition.mjs +8 -2
- package/dist/es/animation/utils/get-value-transition.mjs.map +1 -1
- package/dist/es/animation/utils/resolve-transition.mjs +15 -0
- package/dist/es/animation/utils/resolve-transition.mjs.map +1 -0
- package/dist/es/index.mjs +1 -0
- package/dist/es/index.mjs.map +1 -1
- package/dist/index.d.ts +15 -1
- package/dist/motion-dom.dev.js +25 -3
- package/dist/motion-dom.js +1 -1
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -2760,10 +2760,27 @@ function getFinalKeyframe(keyframes, { repeat, repeatType = "loop" }, finalKeyfr
|
|
|
2760
2760
|
: finalKeyframe;
|
|
2761
2761
|
}
|
|
2762
2762
|
|
|
2763
|
+
/**
|
|
2764
|
+
* If `transition` has `inherit: true`, shallow-merge it with
|
|
2765
|
+
* `parentTransition` (child keys win) and strip the `inherit` key.
|
|
2766
|
+
* Otherwise return `transition` unchanged.
|
|
2767
|
+
*/
|
|
2768
|
+
function resolveTransition(transition, parentTransition) {
|
|
2769
|
+
if (transition?.inherit && parentTransition) {
|
|
2770
|
+
const { inherit: _, ...rest } = transition;
|
|
2771
|
+
return { ...parentTransition, ...rest };
|
|
2772
|
+
}
|
|
2773
|
+
return transition;
|
|
2774
|
+
}
|
|
2775
|
+
|
|
2763
2776
|
function getValueTransition(transition, key) {
|
|
2764
|
-
|
|
2777
|
+
const valueTransition = transition?.[key] ??
|
|
2765
2778
|
transition?.["default"] ??
|
|
2766
|
-
transition
|
|
2779
|
+
transition;
|
|
2780
|
+
if (valueTransition !== transition) {
|
|
2781
|
+
return resolveTransition(valueTransition, transition);
|
|
2782
|
+
}
|
|
2783
|
+
return valueTransition;
|
|
2767
2784
|
}
|
|
2768
2785
|
|
|
2769
2786
|
/**
|
|
@@ -3310,7 +3327,11 @@ function shouldBlockAnimation({ protectedKeys, needsAnimating }, key) {
|
|
|
3310
3327
|
return shouldBlock;
|
|
3311
3328
|
}
|
|
3312
3329
|
function animateTarget(visualElement, targetAndTransition, { delay = 0, transitionOverride, type } = {}) {
|
|
3313
|
-
let { transition
|
|
3330
|
+
let { transition, transitionEnd, ...target } = targetAndTransition;
|
|
3331
|
+
const defaultTransition = visualElement.getDefaultTransition();
|
|
3332
|
+
transition = transition
|
|
3333
|
+
? resolveTransition(transition, defaultTransition)
|
|
3334
|
+
: defaultTransition;
|
|
3314
3335
|
const reduceMotion = transition?.reduceMotion;
|
|
3315
3336
|
if (transitionOverride)
|
|
3316
3337
|
transition = transitionOverride;
|
|
@@ -9638,6 +9659,7 @@ exports.renderSVG = renderSVG;
|
|
|
9638
9659
|
exports.resize = resize;
|
|
9639
9660
|
exports.resolveElements = resolveElements;
|
|
9640
9661
|
exports.resolveMotionValue = resolveMotionValue;
|
|
9662
|
+
exports.resolveTransition = resolveTransition;
|
|
9641
9663
|
exports.resolveVariant = resolveVariant;
|
|
9642
9664
|
exports.resolveVariantFromProps = resolveVariantFromProps;
|
|
9643
9665
|
exports.rgbUnit = rgbUnit;
|