@jsenv/dom 0.11.0 → 0.11.2
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/dist/jsenv_dom.js +32 -9
- package/package.json +1 -1
package/dist/jsenv_dom.js
CHANGED
|
@@ -7456,6 +7456,23 @@ const createDragGestureController = (options = {}) => {
|
|
|
7456
7456
|
gestureInfo
|
|
7457
7457
|
});
|
|
7458
7458
|
onDragStart?.(gestureInfo);
|
|
7459
|
+
// Suppress the click that the browser fires after pointerup following a real drag.
|
|
7460
|
+
// The capture phase runs before any element onClick handler.
|
|
7461
|
+
const suppressClick = clickEvent => {
|
|
7462
|
+
clickEvent.stopPropagation();
|
|
7463
|
+
clickEvent.preventDefault();
|
|
7464
|
+
document.removeEventListener("click", suppressClick, {
|
|
7465
|
+
capture: true
|
|
7466
|
+
});
|
|
7467
|
+
};
|
|
7468
|
+
document.addEventListener("click", suppressClick, {
|
|
7469
|
+
capture: true
|
|
7470
|
+
});
|
|
7471
|
+
addReleaseCallback(() => {
|
|
7472
|
+
document.removeEventListener("click", suppressClick, {
|
|
7473
|
+
capture: true
|
|
7474
|
+
});
|
|
7475
|
+
});
|
|
7459
7476
|
}
|
|
7460
7477
|
const someLayoutChange = gestureInfo.layout !== layoutPrevious;
|
|
7461
7478
|
dispatchPublicCustomEvent(element, "navi_drag", {
|
|
@@ -7596,6 +7613,14 @@ const createDragGestureController = (options = {}) => {
|
|
|
7596
7613
|
return dragGestureController;
|
|
7597
7614
|
};
|
|
7598
7615
|
const dragAfterThreshold = (grabEvent, dragGestureInitializer, threshold) => {
|
|
7616
|
+
const target = grabEvent.target;
|
|
7617
|
+
const isDedicatedHandle = target.closest && target.closest("[data-drag-handle]");
|
|
7618
|
+
if (isDedicatedHandle) {
|
|
7619
|
+
// Element is dedicated to drag — skip the threshold and start immediately.
|
|
7620
|
+
const dragGesture = dragGestureInitializer();
|
|
7621
|
+
dragGesture.dragViaPointer(grabEvent);
|
|
7622
|
+
return;
|
|
7623
|
+
}
|
|
7599
7624
|
const significantDragGestureController = createDragGestureController({
|
|
7600
7625
|
threshold,
|
|
7601
7626
|
// allow interaction for this intermediate gesture:
|
|
@@ -8405,6 +8430,9 @@ const initDragConstraints = (
|
|
|
8405
8430
|
);
|
|
8406
8431
|
|
|
8407
8432
|
const logConstraintEnforcement = (axis, constraint) => {
|
|
8433
|
+
if (constraint.type === "bounds") {
|
|
8434
|
+
return;
|
|
8435
|
+
}
|
|
8408
8436
|
if (constraint.type === "obstacle") {
|
|
8409
8437
|
return;
|
|
8410
8438
|
}
|
|
@@ -8467,11 +8495,6 @@ const initDragConstraints = (
|
|
|
8467
8495
|
const leftModified = elementLeft !== elementLeftRequested;
|
|
8468
8496
|
const topModified = elementTop !== elementTopRequested;
|
|
8469
8497
|
if (!leftModified && !topModified) {
|
|
8470
|
-
{
|
|
8471
|
-
console.debug(
|
|
8472
|
-
`Drag by ${dragEvent.type}: no constraint enforcement needed (${elementLeftRequested.toFixed(2)}, ${elementTopRequested.toFixed(2)})`,
|
|
8473
|
-
);
|
|
8474
|
-
}
|
|
8475
8498
|
return;
|
|
8476
8499
|
}
|
|
8477
8500
|
|
|
@@ -9632,9 +9655,10 @@ const dragCSSVars = ["--drop-hint-size", "--drop-hint-background-color", "--drop
|
|
|
9632
9655
|
* (e.g. `areaConstraint`, `autoScrollAreaPadding`, `stickyFrontiers`).
|
|
9633
9656
|
* `releasePositionEffect` is always set to `"manual"` internally and cannot be overridden.
|
|
9634
9657
|
*/
|
|
9635
|
-
const startDragToReorder = (event,
|
|
9658
|
+
const startDragToReorder = (event, {
|
|
9659
|
+
draggedElement = event.currentTarget,
|
|
9660
|
+
containerElement = draggedElement.parentElement,
|
|
9636
9661
|
itemSelector,
|
|
9637
|
-
containerElement,
|
|
9638
9662
|
getItemId,
|
|
9639
9663
|
onReorder,
|
|
9640
9664
|
direction = {
|
|
@@ -9684,11 +9708,10 @@ const startDragToReorder = (event, draggedElement, {
|
|
|
9684
9708
|
currentReleaseElement = undefined;
|
|
9685
9709
|
clearDropHintDOM();
|
|
9686
9710
|
};
|
|
9687
|
-
const itemsContainer = containerElement || draggedElement.parentElement;
|
|
9688
9711
|
dragGesture.addDragCallback(gestureInfo => {
|
|
9689
9712
|
const allItems = [];
|
|
9690
9713
|
const items = [];
|
|
9691
|
-
for (const el of
|
|
9714
|
+
for (const el of containerElement.querySelectorAll(itemSelector)) {
|
|
9692
9715
|
allItems.push(el);
|
|
9693
9716
|
if (el !== draggedElement) {
|
|
9694
9717
|
items.push(el);
|