@dnd-kit/dom 0.1.4 → 0.1.5-beta-20250429023955
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/index.cjs +65 -60
- package/index.cjs.map +1 -1
- package/index.js +67 -62
- package/index.js.map +1 -1
- package/package.json +5 -5
package/index.cjs
CHANGED
|
@@ -709,69 +709,74 @@ render_fn = function() {
|
|
|
709
709
|
onComplete == null ? void 0 : onComplete();
|
|
710
710
|
return;
|
|
711
711
|
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
animations.
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
712
|
+
const dropAnimation = () => {
|
|
713
|
+
{
|
|
714
|
+
utilities.showPopover(feedbackElement);
|
|
715
|
+
const target = placeholder != null ? placeholder : element;
|
|
716
|
+
const animations = feedbackElement.getAnimations();
|
|
717
|
+
if (animations.length) {
|
|
718
|
+
animations.forEach((animation) => {
|
|
719
|
+
const { effect: effect9 } = animation;
|
|
720
|
+
if (utilities.isKeyframeEffect(effect9) && effect9.getKeyframes().some((keyframe) => keyframe.translate)) {
|
|
721
|
+
animation.finish();
|
|
722
|
+
}
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
const options2 = {
|
|
726
|
+
frameTransform: isSameFrame(feedbackElement, target) ? null : void 0
|
|
727
|
+
};
|
|
728
|
+
const current = new utilities.DOMRectangle(feedbackElement, options2);
|
|
729
|
+
const final = new utilities.DOMRectangle(target, options2);
|
|
730
|
+
const delta2 = geometry.Rectangle.delta(current, final, source.alignment);
|
|
731
|
+
const finalTranslate = {
|
|
732
|
+
x: translate2.x - delta2.x,
|
|
733
|
+
y: translate2.y - delta2.y
|
|
734
|
+
};
|
|
735
|
+
const heightKeyframes = Math.round(current.intrinsicHeight) !== Math.round(final.intrinsicHeight) ? {
|
|
736
|
+
minHeight: [
|
|
737
|
+
`${current.intrinsicHeight}px`,
|
|
738
|
+
`${final.intrinsicHeight}px`
|
|
739
|
+
],
|
|
740
|
+
maxHeight: [
|
|
741
|
+
`${current.intrinsicHeight}px`,
|
|
742
|
+
`${final.intrinsicHeight}px`
|
|
743
|
+
]
|
|
744
|
+
} : {};
|
|
745
|
+
const widthKeyframes = Math.round(current.intrinsicWidth) !== Math.round(final.intrinsicWidth) ? {
|
|
746
|
+
minWidth: [
|
|
747
|
+
`${current.intrinsicWidth}px`,
|
|
748
|
+
`${final.intrinsicWidth}px`
|
|
749
|
+
],
|
|
750
|
+
maxWidth: [
|
|
751
|
+
`${current.intrinsicWidth}px`,
|
|
752
|
+
`${final.intrinsicWidth}px`
|
|
753
|
+
]
|
|
754
|
+
} : {};
|
|
755
|
+
utilities.animateTransform({
|
|
756
|
+
element: feedbackElement,
|
|
757
|
+
keyframes: __spreadProps(__spreadValues(__spreadValues({}, heightKeyframes), widthKeyframes), {
|
|
758
|
+
translate: [
|
|
759
|
+
`${translate2.x}px ${translate2.y}px 0`,
|
|
760
|
+
`${finalTranslate.x}px ${finalTranslate.y}px 0`
|
|
761
|
+
]
|
|
762
|
+
}),
|
|
763
|
+
options: {
|
|
764
|
+
duration: moved || feedbackElement !== element ? 250 : 0,
|
|
765
|
+
easing: "ease"
|
|
766
|
+
},
|
|
767
|
+
onReady() {
|
|
768
|
+
styles.remove(["translate"], CSS_PREFIX);
|
|
769
|
+
},
|
|
770
|
+
onFinish() {
|
|
771
|
+
onComplete == null ? void 0 : onComplete();
|
|
772
|
+
requestAnimationFrame(restoreFocus);
|
|
721
773
|
}
|
|
722
774
|
});
|
|
723
775
|
}
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
const final = new utilities.DOMRectangle(target, options2);
|
|
729
|
-
const delta2 = geometry.Rectangle.delta(current, final, source.alignment);
|
|
730
|
-
const finalTranslate = {
|
|
731
|
-
x: translate2.x - delta2.x,
|
|
732
|
-
y: translate2.y - delta2.y
|
|
733
|
-
};
|
|
734
|
-
const heightKeyframes = Math.round(current.intrinsicHeight) !== Math.round(final.intrinsicHeight) ? {
|
|
735
|
-
minHeight: [
|
|
736
|
-
`${current.intrinsicHeight}px`,
|
|
737
|
-
`${final.intrinsicHeight}px`
|
|
738
|
-
],
|
|
739
|
-
maxHeight: [
|
|
740
|
-
`${current.intrinsicHeight}px`,
|
|
741
|
-
`${final.intrinsicHeight}px`
|
|
742
|
-
]
|
|
743
|
-
} : {};
|
|
744
|
-
const widthKeyframes = Math.round(current.intrinsicWidth) !== Math.round(final.intrinsicWidth) ? {
|
|
745
|
-
minWidth: [
|
|
746
|
-
`${current.intrinsicWidth}px`,
|
|
747
|
-
`${final.intrinsicWidth}px`
|
|
748
|
-
],
|
|
749
|
-
maxWidth: [
|
|
750
|
-
`${current.intrinsicWidth}px`,
|
|
751
|
-
`${final.intrinsicWidth}px`
|
|
752
|
-
]
|
|
753
|
-
} : {};
|
|
754
|
-
utilities.animateTransform({
|
|
755
|
-
element: feedbackElement,
|
|
756
|
-
keyframes: __spreadProps(__spreadValues(__spreadValues({}, heightKeyframes), widthKeyframes), {
|
|
757
|
-
translate: [
|
|
758
|
-
`${translate2.x}px ${translate2.y}px 0`,
|
|
759
|
-
`${finalTranslate.x}px ${finalTranslate.y}px 0`
|
|
760
|
-
]
|
|
761
|
-
}),
|
|
762
|
-
options: {
|
|
763
|
-
duration: moved || feedbackElement !== element ? 250 : 0,
|
|
764
|
-
easing: "ease"
|
|
765
|
-
},
|
|
766
|
-
onReady() {
|
|
767
|
-
styles.remove(["translate"], CSS_PREFIX);
|
|
768
|
-
},
|
|
769
|
-
onFinish() {
|
|
770
|
-
onComplete == null ? void 0 : onComplete();
|
|
771
|
-
requestAnimationFrame(restoreFocus);
|
|
772
|
-
}
|
|
773
|
-
});
|
|
774
|
-
});
|
|
776
|
+
};
|
|
777
|
+
manager.renderer.rendering.then(
|
|
778
|
+
() => requestAnimationFrame(dropAnimation)
|
|
779
|
+
);
|
|
775
780
|
}
|
|
776
781
|
});
|
|
777
782
|
return () => cleanup == null ? void 0 : cleanup();
|