@jsenv/dom 0.11.0 → 0.11.1
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 +29 -4
- 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:
|
|
@@ -9632,9 +9657,10 @@ const dragCSSVars = ["--drop-hint-size", "--drop-hint-background-color", "--drop
|
|
|
9632
9657
|
* (e.g. `areaConstraint`, `autoScrollAreaPadding`, `stickyFrontiers`).
|
|
9633
9658
|
* `releasePositionEffect` is always set to `"manual"` internally and cannot be overridden.
|
|
9634
9659
|
*/
|
|
9635
|
-
const startDragToReorder = (event,
|
|
9660
|
+
const startDragToReorder = (event, {
|
|
9661
|
+
draggedElement = event.currentTarget,
|
|
9662
|
+
containerElement = draggedElement.parentElement,
|
|
9636
9663
|
itemSelector,
|
|
9637
|
-
containerElement,
|
|
9638
9664
|
getItemId,
|
|
9639
9665
|
onReorder,
|
|
9640
9666
|
direction = {
|
|
@@ -9684,11 +9710,10 @@ const startDragToReorder = (event, draggedElement, {
|
|
|
9684
9710
|
currentReleaseElement = undefined;
|
|
9685
9711
|
clearDropHintDOM();
|
|
9686
9712
|
};
|
|
9687
|
-
const itemsContainer = containerElement || draggedElement.parentElement;
|
|
9688
9713
|
dragGesture.addDragCallback(gestureInfo => {
|
|
9689
9714
|
const allItems = [];
|
|
9690
9715
|
const items = [];
|
|
9691
|
-
for (const el of
|
|
9716
|
+
for (const el of containerElement.querySelectorAll(itemSelector)) {
|
|
9692
9717
|
allItems.push(el);
|
|
9693
9718
|
if (el !== draggedElement) {
|
|
9694
9719
|
items.push(el);
|