@inertiajs/core 2.3.0 → 2.3.1
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/index.esm.js +8 -7
- package/dist/index.esm.js.map +2 -2
- package/dist/index.js +8 -7
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
- package/types/scroll.d.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -631,12 +631,13 @@ var prefetchedRequests = new PrefetchedRequests();
|
|
|
631
631
|
// src/scroll.ts
|
|
632
632
|
var Scroll = class {
|
|
633
633
|
static save() {
|
|
634
|
-
history.saveScrollPositions(
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
634
|
+
history.saveScrollPositions(this.getScrollRegions());
|
|
635
|
+
}
|
|
636
|
+
static getScrollRegions() {
|
|
637
|
+
return Array.from(this.regions()).map((region) => ({
|
|
638
|
+
top: region.scrollTop,
|
|
639
|
+
left: region.scrollLeft
|
|
640
|
+
}));
|
|
640
641
|
}
|
|
641
642
|
static regions() {
|
|
642
643
|
return document.querySelectorAll("[scroll-region]");
|
|
@@ -875,7 +876,7 @@ var CurrentPage = class {
|
|
|
875
876
|
page2.rememberedState ?? (page2.rememberedState = {});
|
|
876
877
|
const isServer2 = typeof window === "undefined";
|
|
877
878
|
const location = !isServer2 ? window.location : new URL(page2.url);
|
|
878
|
-
const scrollRegions = !isServer2 && preserveScroll ?
|
|
879
|
+
const scrollRegions = !isServer2 && preserveScroll ? Scroll.getScrollRegions() : [];
|
|
879
880
|
replace = replace || isSameUrlWithoutHash(hrefToUrl(page2.url), location);
|
|
880
881
|
return new Promise((resolve) => {
|
|
881
882
|
replace ? history.replaceState(page2, () => resolve(null)) : history.pushState(page2, () => resolve(null));
|