@dnd-kit/dom 0.1.13 → 0.1.14-beta-20250520125507
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 +22 -16
- package/index.cjs.map +1 -1
- package/index.js +23 -17
- 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.cjs
CHANGED
|
@@ -601,7 +601,8 @@ render_fn = function() {
|
|
|
601
601
|
const initialTranslate = (_b2 = initial.translate) != null ? _b2 : { x: 0, y: 0 };
|
|
602
602
|
const tX = transform.x * frameTransform.scaleX + initialTranslate.x;
|
|
603
603
|
const tY = transform.y * frameTransform.scaleY + initialTranslate.y;
|
|
604
|
-
const translateString = `${tX}px
|
|
604
|
+
const translateString = `${tX}px ${tY}px 0`;
|
|
605
|
+
const transitionString = transition ? `${transition}, translate 0ms linear` : "";
|
|
605
606
|
styles.set(
|
|
606
607
|
{
|
|
607
608
|
width: width - widthOffset,
|
|
@@ -609,8 +610,8 @@ render_fn = function() {
|
|
|
609
610
|
top: projected.top,
|
|
610
611
|
left: projected.left,
|
|
611
612
|
translate: translateString,
|
|
613
|
+
transition: transitionString,
|
|
612
614
|
scale: crossFrame ? `${scaleDelta.x} ${scaleDelta.y}` : "",
|
|
613
|
-
transition,
|
|
614
615
|
"transform-origin": `${transformOrigin.x * 100}% ${transformOrigin.y * 100}%`
|
|
615
616
|
},
|
|
616
617
|
CSS_PREFIX
|
|
@@ -656,9 +657,17 @@ render_fn = function() {
|
|
|
656
657
|
cell.style.width = `${placeholderCell.offsetWidth}px`;
|
|
657
658
|
}
|
|
658
659
|
}
|
|
659
|
-
dragOperation.shape = new utilities.DOMRectangle(
|
|
660
|
+
dragOperation.shape = new utilities.DOMRectangle(feedbackElement);
|
|
660
661
|
});
|
|
661
|
-
|
|
662
|
+
const initialShape = new utilities.DOMRectangle(feedbackElement);
|
|
663
|
+
state.untracked(() => dragOperation.shape = initialShape);
|
|
664
|
+
const feedbackWindow = utilities.getWindow(feedbackElement);
|
|
665
|
+
const handleWindowResize = (event) => {
|
|
666
|
+
this.manager.actions.stop({ event });
|
|
667
|
+
};
|
|
668
|
+
if (isKeyboardOperation) {
|
|
669
|
+
feedbackWindow.addEventListener("resize", handleWindowResize);
|
|
670
|
+
}
|
|
662
671
|
if (state.untracked(() => source.status) === "idle") {
|
|
663
672
|
requestAnimationFrame(() => source.status = "dragging");
|
|
664
673
|
}
|
|
@@ -744,6 +753,12 @@ render_fn = function() {
|
|
|
744
753
|
x: transform2.x / frameTransform.scaleX + initialTranslate2.x,
|
|
745
754
|
y: transform2.y / frameTransform.scaleY + initialTranslate2.y
|
|
746
755
|
};
|
|
756
|
+
const previousTranslate = state$1.current.translate;
|
|
757
|
+
const modifiers = state.untracked(() => dragOperation.modifiers);
|
|
758
|
+
const currentShape = state.untracked(() => {
|
|
759
|
+
var _a6;
|
|
760
|
+
return (_a6 = dragOperation.shape) == null ? void 0 : _a6.current;
|
|
761
|
+
});
|
|
747
762
|
const translateTransition = isKeyboardOperation ? "250ms cubic-bezier(0.25, 1, 0.5, 1)" : "0ms linear";
|
|
748
763
|
styles.set(
|
|
749
764
|
{
|
|
@@ -753,13 +768,7 @@ render_fn = function() {
|
|
|
753
768
|
CSS_PREFIX
|
|
754
769
|
);
|
|
755
770
|
elementMutationObserver == null ? void 0 : elementMutationObserver.takeRecords();
|
|
756
|
-
|
|
757
|
-
const modifiers = state.untracked(() => dragOperation.modifiers);
|
|
758
|
-
const currentShape = state.untracked(() => {
|
|
759
|
-
var _a6;
|
|
760
|
-
return (_a6 = dragOperation.shape) == null ? void 0 : _a6.current;
|
|
761
|
-
});
|
|
762
|
-
if (currentShape && previousTranslate && !modifiers.length) {
|
|
771
|
+
if (currentShape && currentShape !== initialShape && previousTranslate && !modifiers.length) {
|
|
763
772
|
const delta2 = geometry.Point.delta(translate2, previousTranslate);
|
|
764
773
|
dragOperation.shape = geometry.Rectangle.from(
|
|
765
774
|
currentShape.boundingRectangle
|
|
@@ -787,6 +796,7 @@ render_fn = function() {
|
|
|
787
796
|
elementMutationObserver == null ? void 0 : elementMutationObserver.disconnect();
|
|
788
797
|
documentMutationObserver == null ? void 0 : documentMutationObserver.disconnect();
|
|
789
798
|
resizeObserver.disconnect();
|
|
799
|
+
feedbackWindow.removeEventListener("resize", handleWindowResize);
|
|
790
800
|
if (utilities.supportsPopover(feedbackElement)) {
|
|
791
801
|
feedbackElement.removeEventListener(
|
|
792
802
|
"beforetoggle",
|
|
@@ -895,7 +905,7 @@ render_fn = function() {
|
|
|
895
905
|
injectStyles_fn = function() {
|
|
896
906
|
var _a4, _b2;
|
|
897
907
|
const { status, source, target } = this.manager.dragOperation;
|
|
898
|
-
if (status.
|
|
908
|
+
if (status.initializing) {
|
|
899
909
|
const sourceDocument = utilities.getDocument((_a4 = source == null ? void 0 : source.element) != null ? _a4 : null);
|
|
900
910
|
const targetDocument = utilities.getDocument((_b2 = target == null ? void 0 : target.element) != null ? _b2 : null);
|
|
901
911
|
const documents = /* @__PURE__ */ new Set([sourceDocument, targetDocument]);
|
|
@@ -1374,7 +1384,6 @@ var _KeyboardSensor = class _KeyboardSensor extends abstract.Sensor {
|
|
|
1374
1384
|
if (controller.signal.aborted) return this.cleanup();
|
|
1375
1385
|
this.sideEffects();
|
|
1376
1386
|
const sourceDocument = utilities.getDocument(element);
|
|
1377
|
-
const sourceWindow = utilities.getWindow(sourceDocument);
|
|
1378
1387
|
const listeners = [
|
|
1379
1388
|
this.listeners.bind(sourceDocument, [
|
|
1380
1389
|
{
|
|
@@ -1382,9 +1391,6 @@ var _KeyboardSensor = class _KeyboardSensor extends abstract.Sensor {
|
|
|
1382
1391
|
listener: (event2) => this.handleKeyDown(event2, source, options),
|
|
1383
1392
|
options: { capture: true }
|
|
1384
1393
|
}
|
|
1385
|
-
]),
|
|
1386
|
-
this.listeners.bind(sourceWindow, [
|
|
1387
|
-
{ type: "resize", listener: () => this.handleEnd(event, true) }
|
|
1388
1394
|
])
|
|
1389
1395
|
];
|
|
1390
1396
|
__privateGet(this, _cleanupFunctions).push(...listeners);
|