@jsenv/dom 0.14.5 → 0.14.7
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 +48 -19
- package/package.json +1 -1
package/dist/jsenv_dom.js
CHANGED
|
@@ -11348,25 +11348,6 @@ const visibleRectEffect = (
|
|
|
11348
11348
|
});
|
|
11349
11349
|
}
|
|
11350
11350
|
}
|
|
11351
|
-
{
|
|
11352
|
-
// visualViewport resize is a superset of window resize:
|
|
11353
|
-
// it also fires when the virtual keyboard opens/closes on mobile.
|
|
11354
|
-
// Fall back to window resize when visualViewport is unavailable.
|
|
11355
|
-
const onResize = (e) => {
|
|
11356
|
-
autoCheck(e);
|
|
11357
|
-
};
|
|
11358
|
-
if (window.visualViewport) {
|
|
11359
|
-
window.visualViewport.addEventListener("resize", onResize);
|
|
11360
|
-
addTeardown(() => {
|
|
11361
|
-
window.visualViewport.removeEventListener("resize", onResize);
|
|
11362
|
-
});
|
|
11363
|
-
} else {
|
|
11364
|
-
window.addEventListener("resize", onResize);
|
|
11365
|
-
addTeardown(() => {
|
|
11366
|
-
window.removeEventListener("resize", onResize);
|
|
11367
|
-
});
|
|
11368
|
-
}
|
|
11369
|
-
}
|
|
11370
11351
|
{
|
|
11371
11352
|
// visualViewport scroll fires when the visual viewport pans independently
|
|
11372
11353
|
// of the layout viewport (e.g. during pinch-zoom). This is distinct from
|
|
@@ -11387,6 +11368,42 @@ const visibleRectEffect = (
|
|
|
11387
11368
|
});
|
|
11388
11369
|
}
|
|
11389
11370
|
}
|
|
11371
|
+
{
|
|
11372
|
+
if (window.visualViewport) {
|
|
11373
|
+
// visualViewport resize fires when the virtual keyboard opens/closes on mobile.
|
|
11374
|
+
// On mobile, tapping from one input to another triggers a resize because
|
|
11375
|
+
// the virtual keyboard briefly starts to close before the new input receives
|
|
11376
|
+
// focus and the keyboard reopens. Debouncing prevents repositioning the
|
|
11377
|
+
// during that transient state, which would cause a visible flicker.
|
|
11378
|
+
let resizeTimeout;
|
|
11379
|
+
const cancelDelayedAutoCheck = () => {
|
|
11380
|
+
clearTimeout(resizeTimeout);
|
|
11381
|
+
};
|
|
11382
|
+
const onVisualViewportResize = (e) => {
|
|
11383
|
+
cancelDelayedAutoCheck();
|
|
11384
|
+
resizeTimeout = setTimeout(() => {
|
|
11385
|
+
autoCheck(e);
|
|
11386
|
+
}, 100);
|
|
11387
|
+
};
|
|
11388
|
+
window.visualViewport.addEventListener(
|
|
11389
|
+
"resize",
|
|
11390
|
+
onVisualViewportResize,
|
|
11391
|
+
);
|
|
11392
|
+
addTeardown(() => {
|
|
11393
|
+
window.visualViewport.removeEventListener(
|
|
11394
|
+
"resize",
|
|
11395
|
+
onVisualViewportResize,
|
|
11396
|
+
);
|
|
11397
|
+
});
|
|
11398
|
+
}
|
|
11399
|
+
const onWindowResize = (e) => {
|
|
11400
|
+
autoCheck(e);
|
|
11401
|
+
};
|
|
11402
|
+
window.addEventListener("resize", onWindowResize);
|
|
11403
|
+
addTeardown(() => {
|
|
11404
|
+
window.removeEventListener("resize", onWindowResize);
|
|
11405
|
+
});
|
|
11406
|
+
}
|
|
11390
11407
|
on_element_resize: {
|
|
11391
11408
|
if (skipElementResize) {
|
|
11392
11409
|
break on_element_resize;
|
|
@@ -11528,8 +11545,20 @@ const visibleRectEffect = (
|
|
|
11528
11545
|
}
|
|
11529
11546
|
};
|
|
11530
11547
|
ancestor.addEventListener("toggle", onToggle);
|
|
11548
|
+
|
|
11549
|
+
const onNaviPositionUpdate = (e) => {
|
|
11550
|
+
autoCheck(e);
|
|
11551
|
+
};
|
|
11552
|
+
ancestor.addEventListener(
|
|
11553
|
+
"navi_position_update",
|
|
11554
|
+
onNaviPositionUpdate,
|
|
11555
|
+
);
|
|
11531
11556
|
addTeardown(() => {
|
|
11532
11557
|
ancestor.removeEventListener("toggle", onToggle);
|
|
11558
|
+
ancestor.removeEventListener(
|
|
11559
|
+
"navi_position_update",
|
|
11560
|
+
onNaviPositionUpdate,
|
|
11561
|
+
);
|
|
11533
11562
|
});
|
|
11534
11563
|
}
|
|
11535
11564
|
current = current.parentElement;
|