@moku-labs/web 1.6.1 → 1.6.2
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/browser.mjs +12 -6
- package/dist/index.cjs +12 -6
- package/dist/index.mjs +12 -6
- package/package.json +1 -1
package/dist/browser.mjs
CHANGED
|
@@ -3957,18 +3957,24 @@ function createSpaKernel(state, config, emit, deps) {
|
|
|
3957
3957
|
* Apply the in-flight navigation's scroll intent — the swap's `beforeCapture` hook.
|
|
3958
3958
|
* For a forward nav it scrolls to top BEFORE the snapshot is captured, so the old and
|
|
3959
3959
|
* new states share scrollY=0 (no delta → the sticky header never un-pins) and there is
|
|
3960
|
-
* no pre-fetch scroll pause.
|
|
3961
|
-
*
|
|
3962
|
-
*
|
|
3963
|
-
*
|
|
3960
|
+
* no pre-fetch scroll pause. Traverse (back/forward) sets `pendingScrollToTop = false`
|
|
3961
|
+
* and restores its saved position after the swap instead.
|
|
3962
|
+
*
|
|
3963
|
+
* Scroll behaviour: `"instant"` ONLY when view transitions are enabled — that is what
|
|
3964
|
+
* keeps scrollY=0 in the captured snapshot (a `scroll-behavior: smooth` would otherwise
|
|
3965
|
+
* animate the reset and re-create the delta → sticky-header flicker). With view
|
|
3966
|
+
* transitions OFF there is no snapshot to protect, so it honours the page's
|
|
3967
|
+
* `scroll-behavior` (`"auto"` = use the CSS value, e.g. a smooth scroll-to-top on nav).
|
|
3964
3968
|
*
|
|
3965
3969
|
* @example
|
|
3966
3970
|
* runSwap(renderAndMount, viewTransitions, applyPendingScroll);
|
|
3967
3971
|
*/
|
|
3968
3972
|
const applyPendingScroll = () => {
|
|
3969
|
-
if (pendingScrollToTop)
|
|
3973
|
+
if (!pendingScrollToTop) return;
|
|
3974
|
+
const behavior = resolved.viewTransitions ? "instant" : "auto";
|
|
3975
|
+
window.scrollTo({
|
|
3970
3976
|
top: 0,
|
|
3971
|
-
behavior
|
|
3977
|
+
behavior
|
|
3972
3978
|
});
|
|
3973
3979
|
};
|
|
3974
3980
|
/**
|
package/dist/index.cjs
CHANGED
|
@@ -10433,18 +10433,24 @@ function createSpaKernel(state, config, emit, deps) {
|
|
|
10433
10433
|
* Apply the in-flight navigation's scroll intent — the swap's `beforeCapture` hook.
|
|
10434
10434
|
* For a forward nav it scrolls to top BEFORE the snapshot is captured, so the old and
|
|
10435
10435
|
* new states share scrollY=0 (no delta → the sticky header never un-pins) and there is
|
|
10436
|
-
* no pre-fetch scroll pause.
|
|
10437
|
-
*
|
|
10438
|
-
*
|
|
10439
|
-
*
|
|
10436
|
+
* no pre-fetch scroll pause. Traverse (back/forward) sets `pendingScrollToTop = false`
|
|
10437
|
+
* and restores its saved position after the swap instead.
|
|
10438
|
+
*
|
|
10439
|
+
* Scroll behaviour: `"instant"` ONLY when view transitions are enabled — that is what
|
|
10440
|
+
* keeps scrollY=0 in the captured snapshot (a `scroll-behavior: smooth` would otherwise
|
|
10441
|
+
* animate the reset and re-create the delta → sticky-header flicker). With view
|
|
10442
|
+
* transitions OFF there is no snapshot to protect, so it honours the page's
|
|
10443
|
+
* `scroll-behavior` (`"auto"` = use the CSS value, e.g. a smooth scroll-to-top on nav).
|
|
10440
10444
|
*
|
|
10441
10445
|
* @example
|
|
10442
10446
|
* runSwap(renderAndMount, viewTransitions, applyPendingScroll);
|
|
10443
10447
|
*/
|
|
10444
10448
|
const applyPendingScroll = () => {
|
|
10445
|
-
if (pendingScrollToTop)
|
|
10449
|
+
if (!pendingScrollToTop) return;
|
|
10450
|
+
const behavior = resolved.viewTransitions ? "instant" : "auto";
|
|
10451
|
+
window.scrollTo({
|
|
10446
10452
|
top: 0,
|
|
10447
|
-
behavior
|
|
10453
|
+
behavior
|
|
10448
10454
|
});
|
|
10449
10455
|
};
|
|
10450
10456
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -10420,18 +10420,24 @@ function createSpaKernel(state, config, emit, deps) {
|
|
|
10420
10420
|
* Apply the in-flight navigation's scroll intent — the swap's `beforeCapture` hook.
|
|
10421
10421
|
* For a forward nav it scrolls to top BEFORE the snapshot is captured, so the old and
|
|
10422
10422
|
* new states share scrollY=0 (no delta → the sticky header never un-pins) and there is
|
|
10423
|
-
* no pre-fetch scroll pause.
|
|
10424
|
-
*
|
|
10425
|
-
*
|
|
10426
|
-
*
|
|
10423
|
+
* no pre-fetch scroll pause. Traverse (back/forward) sets `pendingScrollToTop = false`
|
|
10424
|
+
* and restores its saved position after the swap instead.
|
|
10425
|
+
*
|
|
10426
|
+
* Scroll behaviour: `"instant"` ONLY when view transitions are enabled — that is what
|
|
10427
|
+
* keeps scrollY=0 in the captured snapshot (a `scroll-behavior: smooth` would otherwise
|
|
10428
|
+
* animate the reset and re-create the delta → sticky-header flicker). With view
|
|
10429
|
+
* transitions OFF there is no snapshot to protect, so it honours the page's
|
|
10430
|
+
* `scroll-behavior` (`"auto"` = use the CSS value, e.g. a smooth scroll-to-top on nav).
|
|
10427
10431
|
*
|
|
10428
10432
|
* @example
|
|
10429
10433
|
* runSwap(renderAndMount, viewTransitions, applyPendingScroll);
|
|
10430
10434
|
*/
|
|
10431
10435
|
const applyPendingScroll = () => {
|
|
10432
|
-
if (pendingScrollToTop)
|
|
10436
|
+
if (!pendingScrollToTop) return;
|
|
10437
|
+
const behavior = resolved.viewTransitions ? "instant" : "auto";
|
|
10438
|
+
window.scrollTo({
|
|
10433
10439
|
top: 0,
|
|
10434
|
-
behavior
|
|
10440
|
+
behavior
|
|
10435
10441
|
});
|
|
10436
10442
|
};
|
|
10437
10443
|
/**
|
package/package.json
CHANGED