@jsenv/dom 0.17.70 → 0.17.72

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.
Files changed (2) hide show
  1. package/dist/jsenv_dom.js +40 -24
  2. package/package.json +1 -1
package/dist/jsenv_dom.js CHANGED
@@ -7152,14 +7152,7 @@ const getScrollContainer = (arg, { includeHidden } = {}) => {
7152
7152
  }
7153
7153
  return null;
7154
7154
  }
7155
- if (element.hasAttribute("popover")) {
7156
- return getScrollingElement(element.ownerDocument);
7157
- }
7158
- if (element.tagName === "DIALOG" && element.matches(":modal")) {
7159
- return getScrollingElement(element.ownerDocument);
7160
- }
7161
- const position = getStyle(element, "position");
7162
- if (position === "fixed") {
7155
+ if (isScrollBoundary(element)) {
7163
7156
  return getScrollingElement(element.ownerDocument);
7164
7157
  }
7165
7158
  return (
@@ -7190,6 +7183,9 @@ const findScrollContainer = (element, { includeHidden } = {}) => {
7190
7183
  if (parent === document) {
7191
7184
  return null;
7192
7185
  }
7186
+ if (isScrollBoundary(parent)) {
7187
+ return null;
7188
+ }
7193
7189
  if (isScrollable(parent, { includeHidden })) {
7194
7190
  return parent;
7195
7191
  }
@@ -7198,6 +7194,24 @@ const findScrollContainer = (element, { includeHidden } = {}) => {
7198
7194
  return null;
7199
7195
  };
7200
7196
 
7197
+ // A popover, a modal dialog or a fixed box is not scrolled by the boxes around
7198
+ // it: the page is its scroll container, and the parent walk of any element
7199
+ // inside it stops there too. A scrolling box between that boundary and the
7200
+ // outer ancestors would otherwise be found, although nothing it scrolls moves
7201
+ // the element.
7202
+ const isScrollBoundary = (node) => {
7203
+ if (node.nodeType !== 1) {
7204
+ return false;
7205
+ }
7206
+ if (node.hasAttribute("popover")) {
7207
+ return true;
7208
+ }
7209
+ if (node.tagName === "DIALOG" && node.matches(":modal")) {
7210
+ return true;
7211
+ }
7212
+ return getStyle(node, "position") === "fixed";
7213
+ };
7214
+
7201
7215
  const getSelfAndAncestorScrolls = (element, startOnParent) => {
7202
7216
  let scrollX = 0;
7203
7217
  let scrollY = 0;
@@ -8903,12 +8917,15 @@ const captureHolderByPointerId = new Map();
8903
8917
  * @param {boolean} [options.backdrop=true]
8904
8918
  * @param {number} [options.backdropZIndex=999999]
8905
8919
  * @returns {{grab: function, grabViaPointer: function}}
8906
- * `grabViaPointer(pointerdownEvent, { element, direction, cursor, scrollContainer })` for a
8907
- * gesture a hand starts, `grab({ element, grabX, grabY })` for one nothing pressed. Both give
8908
- * back the gesture — `gestureInfo` (its `layout` with `xDelta`/`yDelta`, its velocity, the way
8909
- * it is going), `drag`, `release`, and `addDragCallback`/`addReleaseCallback` for whoever joins
8910
- * after it started. `grabViaPointer` gives back `null` when the press is not one it can read: a
8911
- * secondary button, a text node, an element that has left the document since the press.
8920
+ * `grabViaPointer(pointerdownEvent, { element, direction, cursor, scrollContainer,
8921
+ * pointerCaptureElement })` for a gesture a hand starts — `pointerCaptureElement` (the
8922
+ * pressed target by default) must outlive whatever the gesture re-renders, or the capture
8923
+ * is lost and the gesture ends cancelled; `grab({ element, grabX, grabY })` for one nothing
8924
+ * pressed. Both give back the gesture — `gestureInfo` (its `layout` with `xDelta`/`yDelta`,
8925
+ * its velocity, the way it is going), `drag`, `release`, and
8926
+ * `addDragCallback`/`addReleaseCallback` for whoever joins after it started.
8927
+ * `grabViaPointer` gives back `null` when the press is not one it can read: a secondary
8928
+ * button, a text node, an element that has left the document since the press.
8912
8929
  */
8913
8930
  const createDragGestureController = (options = {}) => {
8914
8931
  const {
@@ -11952,8 +11969,6 @@ const roundForConstraints = (value) => {
11952
11969
  * @param {Object} gestureInfo - Gesture information
11953
11970
  * @param {Element[]} targetElements - Array of potential drop target elements
11954
11971
  * @param {object} [options]
11955
- * @param {Element} [options.dragElement] - The element being dragged. When provided and
11956
- * `fallbackToEdge` is true, used to compute the fallback rect.
11957
11972
  * @param {boolean} [options.fallbackToEdge=false] - When true and the drag element does
11958
11973
  * not intersect any target, falls back to the first item (if above all items) or the
11959
11974
  * last item (if below all items) so there is always a valid drop target at list edges.
@@ -14517,8 +14532,8 @@ const createDragToMoveGestureController = ({
14517
14532
  * @param {("move"|"reorder"|"toss"|"land"|"leave")[]} effects
14518
14533
  * What letting go of this element can mean. `reorder`, `toss` and `land` carry a
14519
14534
  * copy; `move` carries the element itself, and `leave` goes with either. Asking
14520
- * for `move` and `reorder` together is asking one release to mean two things,
14521
- * and so is asking for `reorder` and `land`.
14535
+ * for `move` beside any of the three that carry a copy is asking one release to
14536
+ * mean two things, and so is asking for `reorder` and `land`.
14522
14537
  * @param {object} [options]
14523
14538
  * @param {Element} [options.draggedElement=event.currentTarget]
14524
14539
  * @param {(detail: {gestureInfo: object, x: number, y: number}) => void} [options.onMoving]
@@ -14538,8 +14553,8 @@ const createDragToMoveGestureController = ({
14538
14553
  * a node rebuilt), and the element's own translate otherwise, baked in — see
14539
14554
  * settleMovedElement.
14540
14555
  * @param {(detail: {gestureInfo: object, x: number, y: number}) => Promise|void} [options.onLeave]
14541
- * It was let go of away from every place: with places (`itemSelector`), away
14542
- * from all of them; without, out of `outsideOf`. Beside `move` the element
14556
+ * It was let go of away from every place: beside `reorder` or `land`, away
14557
+ * from all of their places; otherwise, out of `outsideOf`. Beside `move` the element
14543
14558
  * itself is left where the hand put it while this runs, and the answer says
14544
14559
  * what becomes of that position — let go of on a resolve (the caller has
14545
14560
  * removed the thing, or drawn it where it goes back to), travelled home on a
@@ -14574,7 +14589,7 @@ const createDragToMoveGestureController = ({
14574
14589
  * if the promise rejects, because the thing still exists and the screen has to
14575
14590
  * say so.
14576
14591
  * @param {(detail: {fromId: string, toId: string, x: number, y: number, width: number, height: number, syncCloneWithDropTarget: Function}) => Promise|void} [options.onLand]
14577
- * It came down on `toId`, which is an element and never null: nothing under the
14592
+ * It came down on the element `toId` names, never null: nothing under the
14578
14593
  * copy is a cancelled release. `x`/`y`/`width`/`height` say WHERE on it, which
14579
14594
  * is the whole answer when the place is a surface — a plan, a map — with no
14580
14595
  * element under the copy to name. The copy is held until what comes back
@@ -15417,13 +15432,14 @@ const getRectInside = (element, containerElement) => {
15417
15432
  // Creates the two-layer clone structure used for drag-to-reorder.
15418
15433
  //
15419
15434
  // Layer 1 — wrapper (navi-drag-clone-wrapper):
15420
- // Positioned absolutely via --clone-top/--clone-left CSS vars.
15435
+ // Positioned fixed via --clone-top/--clone-left CSS vars.
15421
15436
  // Carries the box-shadow and size. Moved every drag frame via dragStyleController.
15422
15437
  // Has a view-transition-name so the View Transitions API can animate it on release.
15423
15438
  //
15424
15439
  // Layer 2 — inner clone (navi-drag-clone):
15425
15440
  // A deep clone of the grabbed element.
15426
- // Applies transform: scale(1.15) via the CSS rule for [navi-drag-clone],
15441
+ // Applies transform: scale(var(--drag-clone-scale, 1.03)) via the CSS rule
15442
+ // for [navi-drag-clone],
15427
15443
  // giving the "lifted" feel. The transform-origin is set to the grab point
15428
15444
  // so the element expands naturally from where the user clicked.
15429
15445
  // On release, the `navi-drag-clone` attribute is removed inside
@@ -15688,7 +15704,7 @@ const createDragClone = (element, pointerEvent) => {
15688
15704
  wrapper.viewTransitionName = "navi-drag-clone-wrapper";
15689
15705
  setCloneViewportRect(wrapper, element);
15690
15706
  // Grab point within the element — used as transform-origin so the
15691
- // scale(1.15) expands from where the user clicked, not the element center.
15707
+ // scale expands from where the user clicked, not the element center.
15692
15708
  // These offsets are element-relative so viewport coords are correct here.
15693
15709
  wrapper.style.setProperty(
15694
15710
  "--drag-origin",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/dom",
3
- "version": "0.17.70",
3
+ "version": "0.17.72",
4
4
  "type": "module",
5
5
  "description": "DOM utilities for writing frontend code",
6
6
  "repository": {