@jsenv/dom 0.17.79 → 0.17.80

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 +14 -1
  2. package/package.json +1 -1
package/dist/jsenv_dom.js CHANGED
@@ -17496,13 +17496,26 @@ const visibleRectEffect = (
17496
17496
  }
17497
17497
  }
17498
17498
  {
17499
+ // One check per frame, in the frame's animation callbacks: a touchmove
17500
+ // arrives after the pointermove handlers wrote to the DOM, so checking
17501
+ // synchronously forces a layout inside every move of every drag on the
17502
+ // page (a wheel spun in an open sheet), for a position the frame's own
17503
+ // layout gives for free a moment later, before anything is painted.
17504
+ let touchMoveRafId = null;
17499
17505
  const onWindowTouchMove = (e) => {
17500
- autoCheck(e);
17506
+ if (touchMoveRafId !== null) {
17507
+ return;
17508
+ }
17509
+ touchMoveRafId = requestAnimationFrame(() => {
17510
+ touchMoveRafId = null;
17511
+ autoCheck(e);
17512
+ });
17501
17513
  };
17502
17514
  window.addEventListener("touchmove", onWindowTouchMove, {
17503
17515
  passive: true,
17504
17516
  });
17505
17517
  addTeardown(() => {
17518
+ cancelAnimationFrame(touchMoveRafId);
17506
17519
  window.removeEventListener("touchmove", onWindowTouchMove, {
17507
17520
  passive: true,
17508
17521
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/dom",
3
- "version": "0.17.79",
3
+ "version": "0.17.80",
4
4
  "type": "module",
5
5
  "description": "DOM utilities for writing frontend code",
6
6
  "repository": {