@jsenv/dom 0.17.6 → 0.17.8
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 +239 -34
- package/package.json +1 -1
package/dist/jsenv_dom.js
CHANGED
|
@@ -7491,6 +7491,86 @@ const trapScrollInside = (element, { boundaryElement } = {}) => {
|
|
|
7491
7491
|
};
|
|
7492
7492
|
};
|
|
7493
7493
|
|
|
7494
|
+
/**
|
|
7495
|
+
* Who is answering the wheel gesture happening right now.
|
|
7496
|
+
*
|
|
7497
|
+
* A wheel gesture has no beginning and no end of its own: it is a burst of
|
|
7498
|
+
* events that starts when the fingers move and goes on after they are gone —
|
|
7499
|
+
* the tail of it is the momentum the system keeps sending. And it has no target
|
|
7500
|
+
* either: every event is aimed at whatever happens to be under the pointer at
|
|
7501
|
+
* that instant. So a burst that began over one box lands on another as soon as
|
|
7502
|
+
* the hand drifts, or as soon as what was under it has travelled away — and
|
|
7503
|
+
* read box by box, ONE gesture is answered twice: a slide moves, then the box
|
|
7504
|
+
* around it moves too, under a hand that pushed once.
|
|
7505
|
+
*
|
|
7506
|
+
* Hence an owner. Whoever answers a burst first says so, everyone else asks
|
|
7507
|
+
* before answering, and the owner keeps it until the events stop coming.
|
|
7508
|
+
* Silence is the only end there is, which is why an owner has to say it is
|
|
7509
|
+
* still there on every event of its gesture — a claim nobody renews is a
|
|
7510
|
+
* gesture that is over.
|
|
7511
|
+
*/
|
|
7512
|
+
|
|
7513
|
+
// How long a silence ends a gesture, for an owner that says nothing else: long
|
|
7514
|
+
// enough to survive a page that is busy — the frames right after something sets
|
|
7515
|
+
// off are the ones where the main thread has the most to do, and a silence read
|
|
7516
|
+
// there as "the hand is gone" would cut one gesture into several.
|
|
7517
|
+
const GESTURE_END_DELAY = 150;
|
|
7518
|
+
|
|
7519
|
+
let gestureOwner = null;
|
|
7520
|
+
let gestureOnEnd = null;
|
|
7521
|
+
let gestureEndTimeout = null;
|
|
7522
|
+
|
|
7523
|
+
const endGesture = () => {
|
|
7524
|
+
const onEnd = gestureOnEnd;
|
|
7525
|
+
gestureOwner = null;
|
|
7526
|
+
gestureOnEnd = null;
|
|
7527
|
+
gestureEndTimeout = null;
|
|
7528
|
+
onEnd?.();
|
|
7529
|
+
};
|
|
7530
|
+
|
|
7531
|
+
/**
|
|
7532
|
+
* Is the burst going on right now somebody else's? Asked before answering a
|
|
7533
|
+
* wheel event: `false` means it is free, or already this one's.
|
|
7534
|
+
*/
|
|
7535
|
+
const wheelGestureIsTakenFrom = (candidate) =>
|
|
7536
|
+
gestureOwner !== null && gestureOwner !== candidate;
|
|
7537
|
+
|
|
7538
|
+
/**
|
|
7539
|
+
* Take the gesture, or say it is still going. Called on every event of it: the
|
|
7540
|
+
* claim lapses on its own once `delay` goes by without a word, and `onEnd` is
|
|
7541
|
+
* how the owner hears about that — it is the only end a wheel gesture has.
|
|
7542
|
+
*
|
|
7543
|
+
* @param {any} owner - anything that can be compared, usually the element.
|
|
7544
|
+
* @param {object} [options]
|
|
7545
|
+
* @param {() => void} [options.onEnd] - the silence was long enough.
|
|
7546
|
+
* @param {number} [options.delay] - how long that silence is.
|
|
7547
|
+
*/
|
|
7548
|
+
const claimWheelGesture = (
|
|
7549
|
+
owner,
|
|
7550
|
+
{ onEnd, delay = GESTURE_END_DELAY } = {},
|
|
7551
|
+
) => {
|
|
7552
|
+
if (wheelGestureIsTakenFrom(owner)) {
|
|
7553
|
+
return false;
|
|
7554
|
+
}
|
|
7555
|
+
gestureOwner = owner;
|
|
7556
|
+
gestureOnEnd = onEnd;
|
|
7557
|
+
clearTimeout(gestureEndTimeout);
|
|
7558
|
+
gestureEndTimeout = setTimeout(endGesture, delay);
|
|
7559
|
+
return true;
|
|
7560
|
+
};
|
|
7561
|
+
|
|
7562
|
+
/**
|
|
7563
|
+
* Give it back before the silence does — the box is going away, the gesture was
|
|
7564
|
+
* handed to something else. Whoever does not own it says nothing.
|
|
7565
|
+
*/
|
|
7566
|
+
const releaseWheelGesture = (owner) => {
|
|
7567
|
+
if (gestureOwner !== owner) {
|
|
7568
|
+
return;
|
|
7569
|
+
}
|
|
7570
|
+
clearTimeout(gestureEndTimeout);
|
|
7571
|
+
endGesture();
|
|
7572
|
+
};
|
|
7573
|
+
|
|
7494
7574
|
/**
|
|
7495
7575
|
* Creates intuitive scrolling behavior when scrolling over an element that needs to stay interactive
|
|
7496
7576
|
* (we can't use pointer-events: none). Instead of scrolling the document unexpectedly,
|
|
@@ -7856,7 +7936,19 @@ const css$5 = /* css */`
|
|
|
7856
7936
|
touch-action: none;
|
|
7857
7937
|
user-select: none;
|
|
7858
7938
|
}
|
|
7939
|
+
/* Chrome matches :focus-visible on a programmatic focus, so focusing what the
|
|
7940
|
+
gesture holds draws a ring around an object the user already has under the
|
|
7941
|
+
pointer — a frame blinking for the length of the gesture, saying something
|
|
7942
|
+
the finger knows. The ring stays whole where it earns its place: at the
|
|
7943
|
+
keyboard, outside any gesture.
|
|
7944
|
+
focus({ focusVisible: false }) would say the intent better but does not
|
|
7945
|
+
hold — Chrome's heuristic does not always obey the option (see
|
|
7946
|
+
isMatchingFocusVisible). */
|
|
7947
|
+
[data-drag-focus]:focus-visible {
|
|
7948
|
+
outline: none;
|
|
7949
|
+
}
|
|
7859
7950
|
`;
|
|
7951
|
+
import.meta.css = [css$5, "@jsenv/dom/src/interaction/drag/drag_gesture.js"];
|
|
7860
7952
|
const createDragGestureController = (options = {}) => {
|
|
7861
7953
|
const {
|
|
7862
7954
|
name,
|
|
@@ -8017,7 +8109,6 @@ const createDragGestureController = (options = {}) => {
|
|
|
8017
8109
|
|
|
8018
8110
|
// 2. VISUAL CONTROL: Backdrop for consistent cursor and pointer event blocking
|
|
8019
8111
|
if (backdrop) {
|
|
8020
|
-
import.meta.css = [css$5, "@jsenv/dom/src/interaction/drag/drag_gesture.js"];
|
|
8021
8112
|
const backdropElement = document.createElement("div");
|
|
8022
8113
|
backdropElement.className = "navi_drag_gesture_backdrop";
|
|
8023
8114
|
backdropElement.ariaHidden = "true";
|
|
@@ -8054,10 +8145,12 @@ const createDragGestureController = (options = {}) => {
|
|
|
8054
8145
|
// This also ensure any keydown event listened by the currently focused element
|
|
8055
8146
|
// won't be available during drag
|
|
8056
8147
|
const elementToFocus = focusableElement || document.body;
|
|
8148
|
+
elementToFocus.setAttribute("data-drag-focus", "");
|
|
8057
8149
|
elementToFocus.focus({
|
|
8058
8150
|
preventScroll: true
|
|
8059
8151
|
});
|
|
8060
8152
|
addReleaseCallback(() => {
|
|
8153
|
+
elementToFocus.removeAttribute("data-drag-focus");
|
|
8061
8154
|
// Restore original focus on release
|
|
8062
8155
|
activeElement.focus({
|
|
8063
8156
|
preventScroll: true
|
|
@@ -8589,18 +8682,47 @@ installImportMetaCssBuild(import.meta);/**
|
|
|
8589
8682
|
* starts at the first pixel, without a second threshold to cross.
|
|
8590
8683
|
*/
|
|
8591
8684
|
|
|
8592
|
-
/*
|
|
8593
|
-
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
8685
|
+
/* At module scope, and on the markers rather than on the pressed element: both
|
|
8686
|
+
rules below have to be true BEFORE the finger lands — a stylesheet, never a
|
|
8687
|
+
line of JS in the pointerdown.
|
|
8688
|
+
|
|
8689
|
+
-webkit-touch-callout: iOS shows its callout (Copy / Look Up) and selects the
|
|
8690
|
+
text under the finger on a long press, and does not always route that through
|
|
8691
|
+
an event that can be refused — see preventContextMenu below for the half that
|
|
8692
|
+
is an event.
|
|
8693
|
+
|
|
8694
|
+
touch-action: a touchmove can only be refused if the region was out of the
|
|
8695
|
+
compositor's fast path when the touch BEGAN (see preventTouchScroll in
|
|
8696
|
+
drag_gesture.js, which does the refusing). Left at `auto`, Chrome has already
|
|
8697
|
+
decided the touch is its own by the time a long press turns into a grab, and
|
|
8698
|
+
every preventDefault from then on is a "Unable to preventDefault inside
|
|
8699
|
+
passive event listener" intervention — on Android, a scroll that runs away
|
|
8700
|
+
with the object. Any explicit value other than `auto` is enough: `pan-y` still
|
|
8701
|
+
lets the page scroll and still makes the refusal effective. */
|
|
8597
8702
|
const css$4 = /* css */`
|
|
8598
8703
|
[data-drag-handle],
|
|
8599
8704
|
[data-drag-source] {
|
|
8600
8705
|
-webkit-touch-callout: none;
|
|
8601
8706
|
}
|
|
8707
|
+
[data-drag-handle] {
|
|
8708
|
+
/* A dedicated handle has nothing to share: it takes the gesture on contact. */
|
|
8709
|
+
touch-action: none;
|
|
8710
|
+
}
|
|
8711
|
+
[data-drag-source] {
|
|
8712
|
+
/* A source taken by long press must let the scroll through until the grab —
|
|
8713
|
+
which is exactly what the long press is there to tell apart. Zoom has
|
|
8714
|
+
nothing to do with the gesture and nobody should lose it by resting a
|
|
8715
|
+
finger on a word. */
|
|
8716
|
+
touch-action: pan-y pinch-zoom;
|
|
8717
|
+
}
|
|
8718
|
+
[data-drag-source="x"] {
|
|
8719
|
+
/* The axis is the one thing the caller has to say, being the only one who
|
|
8720
|
+
knows which way what surrounds the source scrolls. */
|
|
8721
|
+
touch-action: pan-x pinch-zoom;
|
|
8722
|
+
}
|
|
8602
8723
|
[data-drag-ignore] {
|
|
8603
8724
|
-webkit-touch-callout: default;
|
|
8725
|
+
touch-action: auto;
|
|
8604
8726
|
}
|
|
8605
8727
|
`;
|
|
8606
8728
|
import.meta.css = [css$4, "@jsenv/dom/src/interaction/drag/drag_after_intent.js"];
|
|
@@ -11811,12 +11933,15 @@ installImportMetaCssBuild(import.meta);/**
|
|
|
11811
11933
|
* what to paint while the finger moves. The caller knows those and nothing else
|
|
11812
11934
|
* does — this reads the gesture and calls back.
|
|
11813
11935
|
*
|
|
11814
|
-
* Who owns a gesture is decided in
|
|
11936
|
+
* Who owns a gesture is decided in three places, and all three are read here:
|
|
11815
11937
|
* - what says so itself, with [data-no-drag-travel] or by being a field — a
|
|
11816
11938
|
* component that reads the pointer marks itself, because the container it
|
|
11817
11939
|
* ends up in cannot know what it is;
|
|
11818
11940
|
* - a scroller between the pointer and the box with room left that way, which
|
|
11819
|
-
* keeps the gesture until it has none
|
|
11941
|
+
* keeps the gesture until it has none;
|
|
11942
|
+
* - another box that travels, between the pointer and this one: the innermost
|
|
11943
|
+
* one walks the axis it walks, and leaves the others whatever axis it does
|
|
11944
|
+
* not (see axesLeftBy).
|
|
11820
11945
|
*/
|
|
11821
11946
|
|
|
11822
11947
|
// While a pointer is on something that travels: said on the document, because
|
|
@@ -11896,6 +12021,56 @@ const DRAG_RESISTANCE = 0.3;
|
|
|
11896
12021
|
// click it would have made is swallowed on the way out.
|
|
11897
12022
|
const DRAG_EXCLUDED_SELECTOR = ["input", "textarea", "select", '[contenteditable=""]', '[contenteditable="true"]', "[data-no-drag-travel]"].join(",");
|
|
11898
12023
|
|
|
12024
|
+
// Which axes a box travels on, one attribute per gesture, said in the DOM by
|
|
12025
|
+
// whoever owns the box: it is what a box ABOVE another reads to know the
|
|
12026
|
+
// gesture is not its own, and the DOM is the only place where that is knowable
|
|
12027
|
+
// from the outside.
|
|
12028
|
+
const DRAG_AXES_ATTRIBUTE = "data-travel-by-drag";
|
|
12029
|
+
const WHEEL_AXES_ATTRIBUTE = "data-travel-by-wheel";
|
|
12030
|
+
|
|
12031
|
+
/**
|
|
12032
|
+
* What is left for this box of the axes it travels, once the boxes it CONTAINS
|
|
12033
|
+
* have taken theirs: a row of slides inside a page that walks between pages, a
|
|
12034
|
+
* carousel inside a carousel. Both get the same press (it bubbles), both answer
|
|
12035
|
+
* the same finger, and the one under it is the one the hand is pointing at — so
|
|
12036
|
+
* the innermost takes the axes it walks, and what it does not walk is left to
|
|
12037
|
+
* whoever is above: a row swiped sideways inside a column of screens keeps the
|
|
12038
|
+
* sideways gesture, and the column still answers a finger going down.
|
|
12039
|
+
*
|
|
12040
|
+
* Read at the press and nowhere else, because that is the only moment where the
|
|
12041
|
+
* order is still ours: from the first pixel the gesture is held by whoever asked
|
|
12042
|
+
* the browser for the pointer LAST, which is the outermost box — the wrong one,
|
|
12043
|
+
* and past that point the inner one stops being told anything. So the box that
|
|
12044
|
+
* does not own the gesture must never ask for it.
|
|
12045
|
+
*/
|
|
12046
|
+
const axesLeftBy = (axes, fromElement, stopElement, attribute) => {
|
|
12047
|
+
if (!stopElement.contains(fromElement)) {
|
|
12048
|
+
// Not a press that came up through this box: a browser view transition
|
|
12049
|
+
// delivers one to the document root instead, and the caller hands it over
|
|
12050
|
+
// by hand. Nothing was walked past, so nothing was taken.
|
|
12051
|
+
return axes;
|
|
12052
|
+
}
|
|
12053
|
+
let left = axes;
|
|
12054
|
+
let element = fromElement;
|
|
12055
|
+
while (element && element !== stopElement && element.nodeType === 1) {
|
|
12056
|
+
const taken = element.getAttribute(attribute);
|
|
12057
|
+
if (taken) {
|
|
12058
|
+
let rest = "";
|
|
12059
|
+
for (const axis of left) {
|
|
12060
|
+
if (!taken.includes(axis)) {
|
|
12061
|
+
rest += axis;
|
|
12062
|
+
}
|
|
12063
|
+
}
|
|
12064
|
+
left = rest;
|
|
12065
|
+
if (!left) {
|
|
12066
|
+
return "";
|
|
12067
|
+
}
|
|
12068
|
+
}
|
|
12069
|
+
element = element.parentElement;
|
|
12070
|
+
}
|
|
12071
|
+
return left;
|
|
12072
|
+
};
|
|
12073
|
+
|
|
11899
12074
|
/**
|
|
11900
12075
|
* A scroller between the pointer and the box it is in, with room left the way
|
|
11901
12076
|
* the gesture goes: it gets the gesture, and nothing travels — dragging a row
|
|
@@ -11986,7 +12161,10 @@ const travelsAfter = ({
|
|
|
11986
12161
|
* travel, which the element under the finger may not.
|
|
11987
12162
|
* @param {"x"|"y"|"xy"} [options.axes="xy"] - which ways this box can travel. A
|
|
11988
12163
|
* finger leaning on any other axis is given up on at once, whole, so whatever
|
|
11989
|
-
* else wants it (a scroller, the page) gets it whole.
|
|
12164
|
+
* else wants it (a scroller, the page) gets it whole. An axis a box NESTED in
|
|
12165
|
+
* this one travels is not one of them: it is that box's, and this call
|
|
12166
|
+
* returns null when nothing is left (see axesLeftBy). Say so in the DOM with
|
|
12167
|
+
* [data-travel-by-drag] for the boxes above to read.
|
|
11990
12168
|
* @param {false|"x"|"y"} [options.immediate=false] - the axis this press is
|
|
11991
12169
|
* already on, for a press that landed on something moving: the gesture is
|
|
11992
12170
|
* then read from its first pixel instead of waiting for an intent, and every
|
|
@@ -12033,6 +12211,19 @@ const startDragToTravel = (pointerDownEvent, {
|
|
|
12033
12211
|
if (!target.closest || target.closest(DRAG_EXCLUDED_SELECTOR)) {
|
|
12034
12212
|
return null;
|
|
12035
12213
|
}
|
|
12214
|
+
// A box between the finger and this one that travels the same way: the
|
|
12215
|
+
// gesture is its, and this one is left with the axes it does not walk — none
|
|
12216
|
+
// at all, most of the time, and then there is no gesture here to read.
|
|
12217
|
+
const axesLeft = axesLeftBy(axes, target, element, DRAG_AXES_ATTRIBUTE);
|
|
12218
|
+
if (!axesLeft) {
|
|
12219
|
+
return null;
|
|
12220
|
+
}
|
|
12221
|
+
// What was caught in flight travels on an axis of its own, and it is not up
|
|
12222
|
+
// for decision: a box below has taken that axis, so what this press caught it
|
|
12223
|
+
// cannot carry on either.
|
|
12224
|
+
if (immediate && !axesLeft.includes(immediate)) {
|
|
12225
|
+
return null;
|
|
12226
|
+
}
|
|
12036
12227
|
|
|
12037
12228
|
// The travel in hand: null until the finger has picked an axis and the caller
|
|
12038
12229
|
// has accepted it.
|
|
@@ -12146,7 +12337,7 @@ const startDragToTravel = (pointerDownEvent, {
|
|
|
12146
12337
|
return;
|
|
12147
12338
|
}
|
|
12148
12339
|
axis = reachX >= reachY ? "x" : "y";
|
|
12149
|
-
if (!
|
|
12340
|
+
if (!axesLeft.includes(axis)) {
|
|
12150
12341
|
giveUp();
|
|
12151
12342
|
return;
|
|
12152
12343
|
}
|
|
@@ -12319,14 +12510,6 @@ const startDragToTravel = (pointerDownEvent, {
|
|
|
12319
12510
|
};
|
|
12320
12511
|
};
|
|
12321
12512
|
|
|
12322
|
-
// A wheel gesture has no beginning and no end of its own: it is a stream of
|
|
12323
|
-
// events that starts when the fingers move and stops some time after they are
|
|
12324
|
-
// gone — the tail of it is the momentum the system keeps sending. So the end is
|
|
12325
|
-
// read from silence, and long enough to survive a page that is busy: the frames
|
|
12326
|
-
// right after a travel sets off are the ones where the main thread has the most
|
|
12327
|
-
// to do, and a silence read there as "the hand is gone" would cut one gesture
|
|
12328
|
-
// into several.
|
|
12329
|
-
const WHEEL_GESTURE_END_DELAY = 150;
|
|
12330
12513
|
// What each screen AFTER the first costs inside one gesture. Deliberately
|
|
12331
12514
|
// steep: reconstructing "how much did that flick mean" from a stream nobody
|
|
12332
12515
|
// agrees on is guesswork, and a guess that overshoots leaves someone three
|
|
@@ -12365,6 +12548,12 @@ const WHEEL_FADE_RUN = 2;
|
|
|
12365
12548
|
* no idea how they got there. Under-shooting costs one more push, so that is
|
|
12366
12549
|
* the side to be wrong on.
|
|
12367
12550
|
*
|
|
12551
|
+
* A burst has no target either — every event lands on whatever is under the
|
|
12552
|
+
* pointer at that instant — so it is CLAIMED at its first event and answered to
|
|
12553
|
+
* the end wherever the pointer wanders (see wheel_gesture.js). Without that, a
|
|
12554
|
+
* hand pushing a nested carousel and drifting off it walks a slide, then walks
|
|
12555
|
+
* the box around it, on one push.
|
|
12556
|
+
*
|
|
12368
12557
|
* The rest of the stream is mostly momentum, still arriving with the fingers
|
|
12369
12558
|
* gone, and it must not be counted. What gives it away is that momentum only
|
|
12370
12559
|
* ever WEAKENS: a stream that keeps shrinking is a push already answered, and a
|
|
@@ -12373,7 +12562,9 @@ const WHEEL_FADE_RUN = 2;
|
|
|
12373
12562
|
* @param {Element} element
|
|
12374
12563
|
* @param {object} options
|
|
12375
12564
|
* @param {"x"|"y"|"xy"} [options.axes="xy"] - which ways this box can travel.
|
|
12376
|
-
* The other one is the content's own scrolling and is left alone
|
|
12565
|
+
* The other one is the content's own scrolling and is left alone, and an axis
|
|
12566
|
+
* a box NESTED in this one travels is that box's (see axesLeftBy). Say so in
|
|
12567
|
+
* the DOM with [data-travel-by-wheel] for the boxes above to read.
|
|
12377
12568
|
* @param {(detail: {axis: string, sign: number, event: WheelEvent}) => void} options.onStep
|
|
12378
12569
|
* - one push, one screen. `sign` is positive towards the start of the axis,
|
|
12379
12570
|
* which brings in what comes BEFORE — a wheel says how far the CONTENT
|
|
@@ -12385,9 +12576,7 @@ const watchWheelTravel = (element, {
|
|
|
12385
12576
|
onStep
|
|
12386
12577
|
}) => {
|
|
12387
12578
|
let gesture = null;
|
|
12388
|
-
let endTimeout = null;
|
|
12389
12579
|
const forgetGesture = () => {
|
|
12390
|
-
endTimeout = null;
|
|
12391
12580
|
gesture = null;
|
|
12392
12581
|
document.documentElement.removeAttribute(GESTURE_ATTRIBUTE);
|
|
12393
12582
|
document.documentElement.removeAttribute(WALKING_ATTRIBUTE);
|
|
@@ -12429,7 +12618,10 @@ const watchWheelTravel = (element, {
|
|
|
12429
12618
|
return clientX >= left && clientX <= right && clientY >= top && clientY <= bottom;
|
|
12430
12619
|
};
|
|
12431
12620
|
const onWheel = wheelEvent => {
|
|
12432
|
-
|
|
12621
|
+
// The burst is already somebody else's — the box inside this one, a wheel
|
|
12622
|
+
// picker, whoever answered its first event. It is theirs to the end of it,
|
|
12623
|
+
// wherever the pointer has drifted since (see wheel_gesture.js).
|
|
12624
|
+
if (wheelGestureIsTakenFrom(element)) {
|
|
12433
12625
|
return;
|
|
12434
12626
|
}
|
|
12435
12627
|
const axis = Math.abs(wheelEvent.deltaX) > Math.abs(wheelEvent.deltaY) ? "x" : "y";
|
|
@@ -12442,19 +12634,30 @@ const watchWheelTravel = (element, {
|
|
|
12442
12634
|
// right.
|
|
12443
12635
|
const sign = delta > 0 ? -1 : 1;
|
|
12444
12636
|
if (!gesture) {
|
|
12637
|
+
// Where the hand is pushing, asked at the START of a burst and never
|
|
12638
|
+
// again: from there on the gesture is this box's, and a pointer that has
|
|
12639
|
+
// wandered off it says nothing about what the hand is pushing.
|
|
12640
|
+
if (!isOverElement(wheelEvent)) {
|
|
12641
|
+
return;
|
|
12642
|
+
}
|
|
12445
12643
|
if (!axes.includes(axis)) {
|
|
12446
12644
|
// The other axis: the content's own scrolling, left whole to whatever
|
|
12447
12645
|
// wants it.
|
|
12448
12646
|
return;
|
|
12449
12647
|
}
|
|
12450
12648
|
// Who owns it, asked once for the gesture rather than for every event of
|
|
12451
|
-
// it — the same
|
|
12452
|
-
// file), and
|
|
12453
|
-
// prevented and the browser scrolls as it would have.
|
|
12649
|
+
// it — the same claims a press is read against (see the top of this
|
|
12650
|
+
// file), and all of them are answered by giving the gesture up whole:
|
|
12651
|
+
// nothing is prevented and the browser scrolls as it would have.
|
|
12454
12652
|
const {
|
|
12455
12653
|
target
|
|
12456
12654
|
} = wheelEvent;
|
|
12457
|
-
if (target.closest && target.closest(DRAG_EXCLUDED_SELECTOR) || scrollRoomTowards(target, element, axis, sign)
|
|
12655
|
+
if (target.closest && target.closest(DRAG_EXCLUDED_SELECTOR) || scrollRoomTowards(target, element, axis, sign) ||
|
|
12656
|
+
// …plus the third: a box below this one that travels on this axis. Its
|
|
12657
|
+
// watcher hears the same wheel event this one does — they all listen at
|
|
12658
|
+
// the document — so without this both step, and one push moves two
|
|
12659
|
+
// things.
|
|
12660
|
+
!axesLeftBy(axis, target, element, WHEEL_AXES_ATTRIBUTE)) {
|
|
12458
12661
|
return;
|
|
12459
12662
|
}
|
|
12460
12663
|
gesture = {
|
|
@@ -12472,8 +12675,11 @@ const watchWheelTravel = (element, {
|
|
|
12472
12675
|
// — scroll the page behind the box, bounce it, go back in history — is one
|
|
12473
12676
|
// gesture answered twice.
|
|
12474
12677
|
wheelEvent.preventDefault();
|
|
12475
|
-
|
|
12476
|
-
|
|
12678
|
+
// …and said on every event of it, because a claim nobody renews is a
|
|
12679
|
+
// gesture that is over: silence is the only end a wheel has.
|
|
12680
|
+
claimWheelGesture(element, {
|
|
12681
|
+
onEnd: forgetGesture
|
|
12682
|
+
});
|
|
12477
12683
|
if (axis !== gesture.axis) {
|
|
12478
12684
|
// The other axis mid-gesture: a hand is never perfectly straight, and the
|
|
12479
12685
|
// axis was decided when the gesture set off.
|
|
@@ -12530,11 +12736,10 @@ const watchWheelTravel = (element, {
|
|
|
12530
12736
|
document.removeEventListener("wheel", onWheel, {
|
|
12531
12737
|
capture: true
|
|
12532
12738
|
});
|
|
12533
|
-
|
|
12534
|
-
|
|
12535
|
-
|
|
12536
|
-
|
|
12537
|
-
document.documentElement.removeAttribute(WALKING_ATTRIBUTE);
|
|
12739
|
+
// Handed back rather than left to lapse: a box that is gone must not hold a
|
|
12740
|
+
// gesture the boxes still there are asking about.
|
|
12741
|
+
releaseWheelGesture(element);
|
|
12742
|
+
forgetGesture();
|
|
12538
12743
|
};
|
|
12539
12744
|
};
|
|
12540
12745
|
|
|
@@ -18075,4 +18280,4 @@ const useResizeStatus = (elementRef, { as = "number" } = {}) => {
|
|
|
18075
18280
|
};
|
|
18076
18281
|
};
|
|
18077
18282
|
|
|
18078
|
-
export { EASING, ELEMENT_SIZE_CHANGE, activeElementSignal, addActiveElementEffect, addAttributeEffect, allowWheelThrough, appendStyles, applyNewPosition, canScroll, captureScrollState, chainEvent, closestOpenableAncestor, contrastColor, createBackgroundColorTransition, createBackgroundTransition, createBorderRadiusTransition, createBorderTransition, createDragGestureController, createDragToMoveGestureController, createEventGroupLogger, createGroupTransitionController, createHeightTransition, createIterableWeakSet, createOpacityTransition, createPubSub, createStyleController, createTimelineTransition, createTransition, createTranslateXTransition, createValueEffect, createWidthTransition, cubicBezier, dispatchCustomEvent, dispatchInternalCustomEvent, dispatchPublicCustomEvent, dragAfterIntent, elementIsFocusable, elementIsVisibleForFocus, elementIsVisuallyVisible, findAfter, findAncestor, findBefore, findDescendant, findEvent, findFocusDelegateTarget, findFocusable, findSelfOrAncestorFixedPosition, formatEventSideEffect, getAncestorOpenType, getAvailableHeight, getAvailableWidth, getBackground, getBackgroundColor, getBorder, getBorderRadius, getBorderSizes, getContrastRatio, getDefaultStyles, getDragCoordinates, getDropTargetInfo, getElementSignature, getFirstVisuallyVisibleAncestor, getFocusVisibilityInfo, getHeight, getHeightWithoutTransition, getInnerHeight, getInnerWidth, getKeyboardEventDefaultAction, getLuminance, getMarginSizes, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpacity, getOpacityWithoutTransition, getPaddingSizes, getPositionedParent, getPositioningScrollOffset, getPreferedColorScheme, getScrollBox, getScrollContainer, getScrollContainerSet, getScrollRelativeRect, getSelfAndAncestorScrolls, getStyle, getTranslateX, getTranslateXWithoutTransition, getTranslateY, getVisuallyVisibleInfo, getWidth, getWidthWithoutTransition, hasCSSSizeUnit, initFlexDetailsSet, initFocusGroup, initPositionSticky, isAncestorOpen, isPrimaryButtonEvent, isSameColor, isScrollable, measureLongestVisualLineWidth, measureScrollbar, measureWidestChildRow, mergeOneStyle, mergeTwoStyles, normalizeKeyboardKey, normalizeStyle, normalizeStyles, observeAncestorOpenState, onAncestorReopen, parsePositionArea, parseStyle, performTabNavigation, pickPositionRelativeTo, prefersDarkColors, prefersLightColors, preventFocusNav, preventFocusNavViaKeyboard, preventIntermediateScrollbar, resolveCSSColor, resolveCSSSize, resolveColorLuminance, resolveOklchLightness, scrollIntoViewScoped, scrollIntoViewWithStickyAwareness, scrollRoomTowards, setAttribute, setAttributes, setStyles, snapToPixel, startDragToReorder, startDragToResizeGesture, startDragToTravel, stickyAsRelativeCoords, stringifyStyle, subscribeVisualViewportResizeSettled, subscribeWindowResizeSettled, trapFocusInside, trapScrollInside, useActiveElement, useAvailableHeight, useAvailableWidth, useMaxHeight, useMaxWidth, useResizeStatus, visibleRectEffect, watchWheelTravel };
|
|
18283
|
+
export { EASING, ELEMENT_SIZE_CHANGE, activeElementSignal, addActiveElementEffect, addAttributeEffect, allowWheelThrough, appendStyles, applyNewPosition, canScroll, captureScrollState, chainEvent, claimWheelGesture, closestOpenableAncestor, contrastColor, createBackgroundColorTransition, createBackgroundTransition, createBorderRadiusTransition, createBorderTransition, createDragGestureController, createDragToMoveGestureController, createEventGroupLogger, createGroupTransitionController, createHeightTransition, createIterableWeakSet, createOpacityTransition, createPubSub, createStyleController, createTimelineTransition, createTransition, createTranslateXTransition, createValueEffect, createWidthTransition, cubicBezier, dispatchCustomEvent, dispatchInternalCustomEvent, dispatchPublicCustomEvent, dragAfterIntent, elementIsFocusable, elementIsVisibleForFocus, elementIsVisuallyVisible, findAfter, findAncestor, findBefore, findDescendant, findEvent, findFocusDelegateTarget, findFocusable, findSelfOrAncestorFixedPosition, formatEventSideEffect, getAncestorOpenType, getAvailableHeight, getAvailableWidth, getBackground, getBackgroundColor, getBorder, getBorderRadius, getBorderSizes, getContrastRatio, getDefaultStyles, getDragCoordinates, getDropTargetInfo, getElementSignature, getFirstVisuallyVisibleAncestor, getFocusVisibilityInfo, getHeight, getHeightWithoutTransition, getInnerHeight, getInnerWidth, getKeyboardEventDefaultAction, getLuminance, getMarginSizes, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpacity, getOpacityWithoutTransition, getPaddingSizes, getPositionedParent, getPositioningScrollOffset, getPreferedColorScheme, getScrollBox, getScrollContainer, getScrollContainerSet, getScrollRelativeRect, getSelfAndAncestorScrolls, getStyle, getTranslateX, getTranslateXWithoutTransition, getTranslateY, getVisuallyVisibleInfo, getWidth, getWidthWithoutTransition, hasCSSSizeUnit, initFlexDetailsSet, initFocusGroup, initPositionSticky, isAncestorOpen, isPrimaryButtonEvent, isSameColor, isScrollable, measureLongestVisualLineWidth, measureScrollbar, measureWidestChildRow, mergeOneStyle, mergeTwoStyles, normalizeKeyboardKey, normalizeStyle, normalizeStyles, observeAncestorOpenState, onAncestorReopen, parsePositionArea, parseStyle, performTabNavigation, pickPositionRelativeTo, prefersDarkColors, prefersLightColors, preventFocusNav, preventFocusNavViaKeyboard, preventIntermediateScrollbar, releaseWheelGesture, resolveCSSColor, resolveCSSSize, resolveColorLuminance, resolveOklchLightness, scrollIntoViewScoped, scrollIntoViewWithStickyAwareness, scrollRoomTowards, setAttribute, setAttributes, setStyles, snapToPixel, startDragToReorder, startDragToResizeGesture, startDragToTravel, stickyAsRelativeCoords, stringifyStyle, subscribeVisualViewportResizeSettled, subscribeWindowResizeSettled, trapFocusInside, trapScrollInside, useActiveElement, useAvailableHeight, useAvailableWidth, useMaxHeight, useMaxWidth, useResizeStatus, visibleRectEffect, watchWheelTravel, wheelGestureIsTakenFrom };
|