@jsenv/navi 0.29.308 → 0.29.309
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/dev/jsenv_navi.js +49 -0
- package/dist/dev/jsenv_navi.js.map +5 -3
- package/dist/jsenv_navi.js +49 -0
- package/dist/jsenv_navi.js.map +5 -3
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -10192,6 +10192,42 @@ const readNumberFromDom = (element, attribute, defaultValue) => {
|
|
|
10192
10192
|
return value;
|
|
10193
10193
|
};
|
|
10194
10194
|
|
|
10195
|
+
/**
|
|
10196
|
+
* Where a press really landed, for an element reading a gesture out of it.
|
|
10197
|
+
*
|
|
10198
|
+
* A popup is painted OVER the page and stays a DOM descendant of whatever it
|
|
10199
|
+
* was written in — a dialog inside the card that opens it, a callout beside the
|
|
10200
|
+
* button it belongs to. Its pointer events therefore bubble through boxes it
|
|
10201
|
+
* covers, and a box reading a gesture off one of them answers for something
|
|
10202
|
+
* nobody aimed at it: a finger held in a sheet opening the card underneath the
|
|
10203
|
+
* sheet, a card the sheet is drawn from and that the finger cannot even reach.
|
|
10204
|
+
*
|
|
10205
|
+
* The same list, read for the same reason, as the drag sources in @jsenv/dom
|
|
10206
|
+
* (see DRAG_IGNORED_SELECTOR in drag_to.js) and as the selection rule in
|
|
10207
|
+
* interaction_press.js: a layer over the element (`[popover]`, `dialog`), and
|
|
10208
|
+
* something saying its press is its own business (`data-drag-ignore`, which is
|
|
10209
|
+
* what a popup outside the top layer says for itself).
|
|
10210
|
+
*/
|
|
10211
|
+
|
|
10212
|
+
const LAYER_OVER_SELECTOR = "[data-drag-ignore],[popover],dialog";
|
|
10213
|
+
|
|
10214
|
+
/**
|
|
10215
|
+
* The nearest word wins: a layer INSIDE the element takes the press away from
|
|
10216
|
+
* it, one AROUND it does not — an element that IS the dialog, or that sits in
|
|
10217
|
+
* one, goes on answering its own presses.
|
|
10218
|
+
*
|
|
10219
|
+
* @param {EventTarget} target Where the event says the press landed.
|
|
10220
|
+
* @param {Element} element The element reading a gesture out of that press.
|
|
10221
|
+
* @returns {boolean}
|
|
10222
|
+
*/
|
|
10223
|
+
const isPressOnLayerOver = (target, element) => {
|
|
10224
|
+
if (!target || typeof target.closest !== "function") {
|
|
10225
|
+
return false;
|
|
10226
|
+
}
|
|
10227
|
+
const layer = target.closest(LAYER_OVER_SELECTOR);
|
|
10228
|
+
return Boolean(layer) && !layer.contains(element);
|
|
10229
|
+
};
|
|
10230
|
+
|
|
10195
10231
|
/**
|
|
10196
10232
|
* The interactions the browser already has an event for.
|
|
10197
10233
|
*
|
|
@@ -10210,6 +10246,11 @@ const readNumberFromDom = (element, attribute, defaultValue) => {
|
|
|
10210
10246
|
* refuses what is already `defaultPrevented`. Cancelling first would therefore
|
|
10211
10247
|
* make the interaction refuse itself, and no right click could ever get through.
|
|
10212
10248
|
* So: ask, and only cover the browser's menu once something answered.
|
|
10249
|
+
*
|
|
10250
|
+
* They are read off the element and not off whatever bubbles to it: a popup is
|
|
10251
|
+
* a DOM descendant of what it was opened from, so a right click in a sheet
|
|
10252
|
+
* reaches the card the sheet was drawn from, and answering it there answers a
|
|
10253
|
+
* request nobody made (see isPressOnLayerOver).
|
|
10213
10254
|
*/
|
|
10214
10255
|
|
|
10215
10256
|
|
|
@@ -10226,6 +10267,9 @@ defineInteractionDetector({
|
|
|
10226
10267
|
setup: (element, trigger, { types }) => {
|
|
10227
10268
|
const listeners = types.map((type) => {
|
|
10228
10269
|
const listener = (nativeEvent) => {
|
|
10270
|
+
if (isPressOnLayerOver(nativeEvent.target, element)) {
|
|
10271
|
+
return;
|
|
10272
|
+
}
|
|
10229
10273
|
const performed = trigger(type, nativeEvent);
|
|
10230
10274
|
if (type === "contextmenu" && performed) {
|
|
10231
10275
|
// Something answered the request, so the browser's own menu would only
|
|
@@ -10513,6 +10557,11 @@ defineInteractionDetector({
|
|
|
10513
10557
|
if (pointerDownEvent.button !== 0) {
|
|
10514
10558
|
return;
|
|
10515
10559
|
}
|
|
10560
|
+
// A press aimed at a layer over this element, merely bubbling through it
|
|
10561
|
+
// — the same layers the stylesheet above hands the selection back to.
|
|
10562
|
+
if (isPressOnLayerOver(pointerDownEvent.target, element)) {
|
|
10563
|
+
return;
|
|
10564
|
+
}
|
|
10516
10565
|
let swipe = null;
|
|
10517
10566
|
let press = null;
|
|
10518
10567
|
// Set below, with the hold; a no-op until then so the swipe can call it.
|