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