@dnd-kit/dom 0.1.13 → 0.1.14-beta-20250519222703
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 +19 -15
- package/index.cjs.map +1 -1
- package/index.js +20 -16
- package/index.js.map +1 -1
- package/package.json +5 -5
- package/utilities.cjs +32 -10
- package/utilities.cjs.map +1 -1
- package/utilities.js +32 -10
- package/utilities.js.map +1 -1
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { configurator, Sensor, Plugin, CorePlugin, DragDropManager as DragDropManager$1, Draggable as Draggable$1, Droppable as Droppable$1, descriptor } from '@dnd-kit/abstract';
|
|
2
|
-
import { ScrollDirection, Listeners, isElement, scrollIntoViewIfNeeded, DOMRectangle, getDocument,
|
|
2
|
+
import { ScrollDirection, Listeners, isElement, scrollIntoViewIfNeeded, DOMRectangle, getDocument, isHTMLElement, getFrameTransform, scheduler, isTextInput, isKeyboardEvent, isPointerEvent, canScroll, detectScrollIntent, getElementFromPoint, getScrollableAncestors, generateUniqueId, isSafari, Styles, getComputedStyles, parseTranslate, supportsPopover, showPopover, getWindow, supportsStyle, getFrameElement, cloneElement, isKeyframeEffect, animateTransform, ProxiedElements, PositionObserver } from '@dnd-kit/dom/utilities';
|
|
3
3
|
import { effect, computed, deepEqual, signal, batch, untracked, reactive } from '@dnd-kit/state';
|
|
4
4
|
import { exceedsDistance, Axes, Point, Rectangle } from '@dnd-kit/geometry';
|
|
5
5
|
import { defaultCollisionDetection } from '@dnd-kit/collision';
|
|
@@ -599,7 +599,7 @@ render_fn = function() {
|
|
|
599
599
|
const initialTranslate = (_b2 = initial.translate) != null ? _b2 : { x: 0, y: 0 };
|
|
600
600
|
const tX = transform.x * frameTransform.scaleX + initialTranslate.x;
|
|
601
601
|
const tY = transform.y * frameTransform.scaleY + initialTranslate.y;
|
|
602
|
-
const translateString = `${tX}px
|
|
602
|
+
const translateString = `${tX}px ${tY}px 0`;
|
|
603
603
|
styles.set(
|
|
604
604
|
{
|
|
605
605
|
width: width - widthOffset,
|
|
@@ -608,7 +608,6 @@ render_fn = function() {
|
|
|
608
608
|
left: projected.left,
|
|
609
609
|
translate: translateString,
|
|
610
610
|
scale: crossFrame ? `${scaleDelta.x} ${scaleDelta.y}` : "",
|
|
611
|
-
transition,
|
|
612
611
|
"transform-origin": `${transformOrigin.x * 100}% ${transformOrigin.y * 100}%`
|
|
613
612
|
},
|
|
614
613
|
CSS_PREFIX
|
|
@@ -654,9 +653,17 @@ render_fn = function() {
|
|
|
654
653
|
cell.style.width = `${placeholderCell.offsetWidth}px`;
|
|
655
654
|
}
|
|
656
655
|
}
|
|
657
|
-
dragOperation.shape = new DOMRectangle(
|
|
656
|
+
dragOperation.shape = new DOMRectangle(feedbackElement);
|
|
658
657
|
});
|
|
659
|
-
|
|
658
|
+
const initialShape = new DOMRectangle(feedbackElement);
|
|
659
|
+
untracked(() => dragOperation.shape = initialShape);
|
|
660
|
+
const feedbackWindow = getWindow(feedbackElement);
|
|
661
|
+
const handleWindowResize = (event) => {
|
|
662
|
+
this.manager.actions.stop({ event });
|
|
663
|
+
};
|
|
664
|
+
if (isKeyboardOperation) {
|
|
665
|
+
feedbackWindow.addEventListener("resize", handleWindowResize);
|
|
666
|
+
}
|
|
660
667
|
if (untracked(() => source.status) === "idle") {
|
|
661
668
|
requestAnimationFrame(() => source.status = "dragging");
|
|
662
669
|
}
|
|
@@ -742,6 +749,12 @@ render_fn = function() {
|
|
|
742
749
|
x: transform2.x / frameTransform.scaleX + initialTranslate2.x,
|
|
743
750
|
y: transform2.y / frameTransform.scaleY + initialTranslate2.y
|
|
744
751
|
};
|
|
752
|
+
const previousTranslate = state.current.translate;
|
|
753
|
+
const modifiers = untracked(() => dragOperation.modifiers);
|
|
754
|
+
const currentShape = untracked(() => {
|
|
755
|
+
var _a6;
|
|
756
|
+
return (_a6 = dragOperation.shape) == null ? void 0 : _a6.current;
|
|
757
|
+
});
|
|
745
758
|
const translateTransition = isKeyboardOperation ? "250ms cubic-bezier(0.25, 1, 0.5, 1)" : "0ms linear";
|
|
746
759
|
styles.set(
|
|
747
760
|
{
|
|
@@ -751,13 +764,7 @@ render_fn = function() {
|
|
|
751
764
|
CSS_PREFIX
|
|
752
765
|
);
|
|
753
766
|
elementMutationObserver == null ? void 0 : elementMutationObserver.takeRecords();
|
|
754
|
-
|
|
755
|
-
const modifiers = untracked(() => dragOperation.modifiers);
|
|
756
|
-
const currentShape = untracked(() => {
|
|
757
|
-
var _a6;
|
|
758
|
-
return (_a6 = dragOperation.shape) == null ? void 0 : _a6.current;
|
|
759
|
-
});
|
|
760
|
-
if (currentShape && previousTranslate && !modifiers.length) {
|
|
767
|
+
if (currentShape && currentShape !== initialShape && previousTranslate && !modifiers.length) {
|
|
761
768
|
const delta2 = Point.delta(translate2, previousTranslate);
|
|
762
769
|
dragOperation.shape = Rectangle.from(
|
|
763
770
|
currentShape.boundingRectangle
|
|
@@ -785,6 +792,7 @@ render_fn = function() {
|
|
|
785
792
|
elementMutationObserver == null ? void 0 : elementMutationObserver.disconnect();
|
|
786
793
|
documentMutationObserver == null ? void 0 : documentMutationObserver.disconnect();
|
|
787
794
|
resizeObserver.disconnect();
|
|
795
|
+
feedbackWindow.removeEventListener("resize", handleWindowResize);
|
|
788
796
|
if (supportsPopover(feedbackElement)) {
|
|
789
797
|
feedbackElement.removeEventListener(
|
|
790
798
|
"beforetoggle",
|
|
@@ -1372,7 +1380,6 @@ var _KeyboardSensor = class _KeyboardSensor extends Sensor {
|
|
|
1372
1380
|
if (controller.signal.aborted) return this.cleanup();
|
|
1373
1381
|
this.sideEffects();
|
|
1374
1382
|
const sourceDocument = getDocument(element);
|
|
1375
|
-
const sourceWindow = getWindow(sourceDocument);
|
|
1376
1383
|
const listeners = [
|
|
1377
1384
|
this.listeners.bind(sourceDocument, [
|
|
1378
1385
|
{
|
|
@@ -1380,9 +1387,6 @@ var _KeyboardSensor = class _KeyboardSensor extends Sensor {
|
|
|
1380
1387
|
listener: (event2) => this.handleKeyDown(event2, source, options),
|
|
1381
1388
|
options: { capture: true }
|
|
1382
1389
|
}
|
|
1383
|
-
]),
|
|
1384
|
-
this.listeners.bind(sourceWindow, [
|
|
1385
|
-
{ type: "resize", listener: () => this.handleEnd(event, true) }
|
|
1386
1390
|
])
|
|
1387
1391
|
];
|
|
1388
1392
|
__privateGet(this, _cleanupFunctions).push(...listeners);
|