@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.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { configurator, Plugin, CorePlugin, Sensor, DragDropManager as DragDropManager$1, Draggable as Draggable$1, descriptor, Droppable as Droppable$1 } from '@dnd-kit/abstract';
|
|
2
|
-
import { ScrollDirection, isElement, generateUniqueId, isSafari, getDocument, getFrameTransform, DOMRectangle, Styles, getComputedStyles, isKeyboardEvent, parseTranslate, supportsPopover, showPopover, getWindow, supportsStyle,
|
|
2
|
+
import { ScrollDirection, isElement, generateUniqueId, isSafari, getDocument, getFrameTransform, DOMRectangle, Styles, getComputedStyles, isKeyboardEvent, parseTranslate, supportsPopover, showPopover, getWindow, supportsStyle, canScroll, detectScrollIntent, scheduler, getElementFromPoint, getScrollableAncestors, Listeners, scrollIntoViewIfNeeded, isHTMLElement, cloneElement, ProxiedElements, getFrameElement, isKeyframeEffect, animateTransform, isPointerEvent, PositionObserver } from '@dnd-kit/dom/utilities';
|
|
3
3
|
import { effects, computed, effect, untracked, deepEqual, signal, reactive, batch } from '@dnd-kit/state';
|
|
4
|
-
import {
|
|
4
|
+
import { Axes, exceedsDistance, Rectangle } from '@dnd-kit/geometry';
|
|
5
5
|
import { defaultCollisionDetection } from '@dnd-kit/collision';
|
|
6
6
|
|
|
7
7
|
var __create = Object.create;
|
|
@@ -707,69 +707,74 @@ render_fn = function() {
|
|
|
707
707
|
onComplete == null ? void 0 : onComplete();
|
|
708
708
|
return;
|
|
709
709
|
}
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
animations.
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
710
|
+
const dropAnimation = () => {
|
|
711
|
+
{
|
|
712
|
+
showPopover(feedbackElement);
|
|
713
|
+
const target = placeholder != null ? placeholder : element;
|
|
714
|
+
const animations = feedbackElement.getAnimations();
|
|
715
|
+
if (animations.length) {
|
|
716
|
+
animations.forEach((animation) => {
|
|
717
|
+
const { effect: effect9 } = animation;
|
|
718
|
+
if (isKeyframeEffect(effect9) && effect9.getKeyframes().some((keyframe) => keyframe.translate)) {
|
|
719
|
+
animation.finish();
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
const options2 = {
|
|
724
|
+
frameTransform: isSameFrame(feedbackElement, target) ? null : void 0
|
|
725
|
+
};
|
|
726
|
+
const current = new DOMRectangle(feedbackElement, options2);
|
|
727
|
+
const final = new DOMRectangle(target, options2);
|
|
728
|
+
const delta2 = Rectangle.delta(current, final, source.alignment);
|
|
729
|
+
const finalTranslate = {
|
|
730
|
+
x: translate2.x - delta2.x,
|
|
731
|
+
y: translate2.y - delta2.y
|
|
732
|
+
};
|
|
733
|
+
const heightKeyframes = Math.round(current.intrinsicHeight) !== Math.round(final.intrinsicHeight) ? {
|
|
734
|
+
minHeight: [
|
|
735
|
+
`${current.intrinsicHeight}px`,
|
|
736
|
+
`${final.intrinsicHeight}px`
|
|
737
|
+
],
|
|
738
|
+
maxHeight: [
|
|
739
|
+
`${current.intrinsicHeight}px`,
|
|
740
|
+
`${final.intrinsicHeight}px`
|
|
741
|
+
]
|
|
742
|
+
} : {};
|
|
743
|
+
const widthKeyframes = Math.round(current.intrinsicWidth) !== Math.round(final.intrinsicWidth) ? {
|
|
744
|
+
minWidth: [
|
|
745
|
+
`${current.intrinsicWidth}px`,
|
|
746
|
+
`${final.intrinsicWidth}px`
|
|
747
|
+
],
|
|
748
|
+
maxWidth: [
|
|
749
|
+
`${current.intrinsicWidth}px`,
|
|
750
|
+
`${final.intrinsicWidth}px`
|
|
751
|
+
]
|
|
752
|
+
} : {};
|
|
753
|
+
animateTransform({
|
|
754
|
+
element: feedbackElement,
|
|
755
|
+
keyframes: __spreadProps(__spreadValues(__spreadValues({}, heightKeyframes), widthKeyframes), {
|
|
756
|
+
translate: [
|
|
757
|
+
`${translate2.x}px ${translate2.y}px 0`,
|
|
758
|
+
`${finalTranslate.x}px ${finalTranslate.y}px 0`
|
|
759
|
+
]
|
|
760
|
+
}),
|
|
761
|
+
options: {
|
|
762
|
+
duration: moved || feedbackElement !== element ? 250 : 0,
|
|
763
|
+
easing: "ease"
|
|
764
|
+
},
|
|
765
|
+
onReady() {
|
|
766
|
+
styles.remove(["translate"], CSS_PREFIX);
|
|
767
|
+
},
|
|
768
|
+
onFinish() {
|
|
769
|
+
onComplete == null ? void 0 : onComplete();
|
|
770
|
+
requestAnimationFrame(restoreFocus);
|
|
719
771
|
}
|
|
720
772
|
});
|
|
721
773
|
}
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
const final = new DOMRectangle(target, options2);
|
|
727
|
-
const delta2 = Rectangle.delta(current, final, source.alignment);
|
|
728
|
-
const finalTranslate = {
|
|
729
|
-
x: translate2.x - delta2.x,
|
|
730
|
-
y: translate2.y - delta2.y
|
|
731
|
-
};
|
|
732
|
-
const heightKeyframes = Math.round(current.intrinsicHeight) !== Math.round(final.intrinsicHeight) ? {
|
|
733
|
-
minHeight: [
|
|
734
|
-
`${current.intrinsicHeight}px`,
|
|
735
|
-
`${final.intrinsicHeight}px`
|
|
736
|
-
],
|
|
737
|
-
maxHeight: [
|
|
738
|
-
`${current.intrinsicHeight}px`,
|
|
739
|
-
`${final.intrinsicHeight}px`
|
|
740
|
-
]
|
|
741
|
-
} : {};
|
|
742
|
-
const widthKeyframes = Math.round(current.intrinsicWidth) !== Math.round(final.intrinsicWidth) ? {
|
|
743
|
-
minWidth: [
|
|
744
|
-
`${current.intrinsicWidth}px`,
|
|
745
|
-
`${final.intrinsicWidth}px`
|
|
746
|
-
],
|
|
747
|
-
maxWidth: [
|
|
748
|
-
`${current.intrinsicWidth}px`,
|
|
749
|
-
`${final.intrinsicWidth}px`
|
|
750
|
-
]
|
|
751
|
-
} : {};
|
|
752
|
-
animateTransform({
|
|
753
|
-
element: feedbackElement,
|
|
754
|
-
keyframes: __spreadProps(__spreadValues(__spreadValues({}, heightKeyframes), widthKeyframes), {
|
|
755
|
-
translate: [
|
|
756
|
-
`${translate2.x}px ${translate2.y}px 0`,
|
|
757
|
-
`${finalTranslate.x}px ${finalTranslate.y}px 0`
|
|
758
|
-
]
|
|
759
|
-
}),
|
|
760
|
-
options: {
|
|
761
|
-
duration: moved || feedbackElement !== element ? 250 : 0,
|
|
762
|
-
easing: "ease"
|
|
763
|
-
},
|
|
764
|
-
onReady() {
|
|
765
|
-
styles.remove(["translate"], CSS_PREFIX);
|
|
766
|
-
},
|
|
767
|
-
onFinish() {
|
|
768
|
-
onComplete == null ? void 0 : onComplete();
|
|
769
|
-
requestAnimationFrame(restoreFocus);
|
|
770
|
-
}
|
|
771
|
-
});
|
|
772
|
-
});
|
|
774
|
+
};
|
|
775
|
+
manager.renderer.rendering.then(
|
|
776
|
+
() => requestAnimationFrame(dropAnimation)
|
|
777
|
+
);
|
|
773
778
|
}
|
|
774
779
|
});
|
|
775
780
|
return () => cleanup == null ? void 0 : cleanup();
|