@inertiajs/core 2.2.3 → 2.2.4
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 +20 -19
- package/dist/index.esm.js.map +2 -2
- package/dist/index.js +20 -19
- package/dist/index.js.map +2 -2
- package/package.json +4 -2
- package/types/types.d.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -307,25 +307,28 @@ var Scroll = class {
|
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
309
|
static restore(scrollRegions) {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
region.
|
|
321
|
-
|
|
310
|
+
if (typeof window === "undefined") {
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
window.requestAnimationFrame(() => {
|
|
314
|
+
this.restoreDocument();
|
|
315
|
+
this.regions().forEach((region, index) => {
|
|
316
|
+
const scrollPosition = scrollRegions[index];
|
|
317
|
+
if (!scrollPosition) {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
if (typeof region.scrollTo === "function") {
|
|
321
|
+
region.scrollTo(scrollPosition.left, scrollPosition.top);
|
|
322
|
+
} else {
|
|
323
|
+
region.scrollTop = scrollPosition.top;
|
|
324
|
+
region.scrollLeft = scrollPosition.left;
|
|
325
|
+
}
|
|
326
|
+
});
|
|
322
327
|
});
|
|
323
328
|
}
|
|
324
329
|
static restoreDocument() {
|
|
325
330
|
const scrollPosition = history.getDocumentScrollPosition();
|
|
326
|
-
|
|
327
|
-
window.scrollTo(scrollPosition.left, scrollPosition.top);
|
|
328
|
-
}
|
|
331
|
+
window.scrollTo(scrollPosition.left, scrollPosition.top);
|
|
329
332
|
}
|
|
330
333
|
static onScroll(event) {
|
|
331
334
|
const target = event.target;
|
|
@@ -836,9 +839,7 @@ var EventHandler = class {
|
|
|
836
839
|
}
|
|
837
840
|
router.cancelAll();
|
|
838
841
|
page.setQuietly(data, { preserveState: false }).then(() => {
|
|
839
|
-
|
|
840
|
-
Scroll.restore(history.getScrollRegions());
|
|
841
|
-
});
|
|
842
|
+
Scroll.restore(history.getScrollRegions());
|
|
842
843
|
fireNavigateEvent(page.get());
|
|
843
844
|
});
|
|
844
845
|
}).catch(() => {
|
|
@@ -1665,7 +1666,7 @@ var Response = class _Response {
|
|
|
1665
1666
|
pageResponse.props[prop] = deepMerge(currentProp, incomingProp, prop);
|
|
1666
1667
|
});
|
|
1667
1668
|
pageResponse.props = { ...page.get().props, ...pageResponse.props };
|
|
1668
|
-
if (
|
|
1669
|
+
if (page.get().scrollProps) {
|
|
1669
1670
|
pageResponse.scrollProps = {
|
|
1670
1671
|
...page.get().scrollProps || {},
|
|
1671
1672
|
...pageResponse.scrollProps || {}
|