motion-dom 12.31.3 → 12.33.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 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
- return (transition?.[key] ??
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 = visualElement.getDefaultTransition(), transitionEnd, ...target } = targetAndTransition;
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;
@@ -4394,6 +4415,7 @@ const enableKeyboardPress = (focusEvent, eventOptions) => {
4394
4415
  function isValidPressEvent(event) {
4395
4416
  return isPrimaryPointer(event) && !isDragActive();
4396
4417
  }
4418
+ const claimedPointerDownEvents = new WeakSet();
4397
4419
  /**
4398
4420
  * Create a press gesture.
4399
4421
  *
@@ -4419,7 +4441,12 @@ function press(targetOrSelector, onPressStart, options = {}) {
4419
4441
  const target = startEvent.currentTarget;
4420
4442
  if (!isValidPressEvent(startEvent))
4421
4443
  return;
4444
+ if (claimedPointerDownEvents.has(startEvent))
4445
+ return;
4422
4446
  isPressing.add(target);
4447
+ if (options.stopPropagation) {
4448
+ claimedPointerDownEvents.add(startEvent);
4449
+ }
4423
4450
  const onPressEnd = onPressStart(target, startEvent);
4424
4451
  const onPointerEnd = (endEvent, success) => {
4425
4452
  window.removeEventListener("pointerup", onPointerUp);
@@ -9638,6 +9665,7 @@ exports.renderSVG = renderSVG;
9638
9665
  exports.resize = resize;
9639
9666
  exports.resolveElements = resolveElements;
9640
9667
  exports.resolveMotionValue = resolveMotionValue;
9668
+ exports.resolveTransition = resolveTransition;
9641
9669
  exports.resolveVariant = resolveVariant;
9642
9670
  exports.resolveVariantFromProps = resolveVariantFromProps;
9643
9671
  exports.rgbUnit = rgbUnit;