@dnd-kit/dom 0.1.1 → 0.1.2-beta-20250420122611
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 +17 -5
- package/index.cjs.map +1 -1
- package/index.js +17 -5
- package/index.js.map +1 -1
- package/package.json +5 -5
package/index.cjs
CHANGED
|
@@ -1194,16 +1194,21 @@ var KeyboardSensor = class extends abstract.Sensor {
|
|
|
1194
1194
|
event.stopImmediatePropagation();
|
|
1195
1195
|
utilities.scrollIntoViewIfNeeded(element);
|
|
1196
1196
|
const { center } = new utilities.DOMRectangle(element);
|
|
1197
|
+
let aborted = false;
|
|
1197
1198
|
state.batch(() => {
|
|
1198
1199
|
this.manager.actions.setDragSource(source.id);
|
|
1199
|
-
this.manager.actions.start({
|
|
1200
|
+
aborted = this.manager.actions.start({
|
|
1200
1201
|
event,
|
|
1201
1202
|
coordinates: {
|
|
1202
1203
|
x: center.x,
|
|
1203
1204
|
y: center.y
|
|
1204
1205
|
}
|
|
1205
|
-
});
|
|
1206
|
+
}) === false;
|
|
1206
1207
|
});
|
|
1208
|
+
if (aborted) {
|
|
1209
|
+
this.cleanup();
|
|
1210
|
+
return;
|
|
1211
|
+
}
|
|
1207
1212
|
this.sideEffects();
|
|
1208
1213
|
const sourceDocument = utilities.getDocument(element);
|
|
1209
1214
|
const sourceWindow = utilities.getWindow(sourceDocument);
|
|
@@ -1290,6 +1295,7 @@ var KeyboardSensor = class extends abstract.Sensor {
|
|
|
1290
1295
|
}
|
|
1291
1296
|
cleanup() {
|
|
1292
1297
|
__privateGet(this, _cleanupFunctions).forEach((cleanup) => cleanup());
|
|
1298
|
+
__privateSet(this, _cleanupFunctions, []);
|
|
1293
1299
|
}
|
|
1294
1300
|
destroy() {
|
|
1295
1301
|
this.cleanup();
|
|
@@ -1450,17 +1456,23 @@ var _PointerSensor = class _PointerSensor extends abstract.Sensor {
|
|
|
1450
1456
|
var _a4;
|
|
1451
1457
|
const { manager, initialCoordinates } = this;
|
|
1452
1458
|
(_a4 = __privateGet(this, _clearTimeout)) == null ? void 0 : _a4.call(this);
|
|
1453
|
-
if (!initialCoordinates || manager.dragOperation.status.
|
|
1459
|
+
if (!initialCoordinates || !manager.dragOperation.status.idle) {
|
|
1454
1460
|
return;
|
|
1455
1461
|
}
|
|
1456
1462
|
if (event.defaultPrevented) {
|
|
1457
1463
|
return;
|
|
1458
1464
|
}
|
|
1459
|
-
|
|
1465
|
+
let aborted = false;
|
|
1460
1466
|
state.batch(() => {
|
|
1461
1467
|
manager.actions.setDragSource(source.id);
|
|
1462
|
-
manager.actions.start({ coordinates: initialCoordinates, event });
|
|
1468
|
+
aborted = manager.actions.start({ coordinates: initialCoordinates, event }) === false;
|
|
1463
1469
|
});
|
|
1470
|
+
if (aborted) {
|
|
1471
|
+
this.cleanup.forEach((cleanup) => cleanup());
|
|
1472
|
+
this.cleanup.clear();
|
|
1473
|
+
return;
|
|
1474
|
+
}
|
|
1475
|
+
event.preventDefault();
|
|
1464
1476
|
const ownerDocument = utilities.getDocument(event.target);
|
|
1465
1477
|
const pointerCaptureTarget = ownerDocument.body;
|
|
1466
1478
|
pointerCaptureTarget.setPointerCapture(event.pointerId);
|