@inertiajs/core 2.2.2 → 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 +25 -18
- package/dist/index.esm.js.map +2 -2
- package/dist/index.js +25 -18
- package/dist/index.js.map +2 -2
- package/package.json +4 -2
- package/types/types.d.ts +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -255,25 +255,28 @@ var Scroll = class {
|
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
static restore(scrollRegions) {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
region.
|
|
269
|
-
|
|
258
|
+
if (typeof window === "undefined") {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
window.requestAnimationFrame(() => {
|
|
262
|
+
this.restoreDocument();
|
|
263
|
+
this.regions().forEach((region, index) => {
|
|
264
|
+
const scrollPosition = scrollRegions[index];
|
|
265
|
+
if (!scrollPosition) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
if (typeof region.scrollTo === "function") {
|
|
269
|
+
region.scrollTo(scrollPosition.left, scrollPosition.top);
|
|
270
|
+
} else {
|
|
271
|
+
region.scrollTop = scrollPosition.top;
|
|
272
|
+
region.scrollLeft = scrollPosition.left;
|
|
273
|
+
}
|
|
274
|
+
});
|
|
270
275
|
});
|
|
271
276
|
}
|
|
272
277
|
static restoreDocument() {
|
|
273
278
|
const scrollPosition = history.getDocumentScrollPosition();
|
|
274
|
-
|
|
275
|
-
window.scrollTo(scrollPosition.left, scrollPosition.top);
|
|
276
|
-
}
|
|
279
|
+
window.scrollTo(scrollPosition.left, scrollPosition.top);
|
|
277
280
|
}
|
|
278
281
|
static onScroll(event) {
|
|
279
282
|
const target = event.target;
|
|
@@ -784,9 +787,7 @@ var EventHandler = class {
|
|
|
784
787
|
}
|
|
785
788
|
router.cancelAll();
|
|
786
789
|
page.setQuietly(data, { preserveState: false }).then(() => {
|
|
787
|
-
|
|
788
|
-
Scroll.restore(history.getScrollRegions());
|
|
789
|
-
});
|
|
790
|
+
Scroll.restore(history.getScrollRegions());
|
|
790
791
|
fireNavigateEvent(page.get());
|
|
791
792
|
});
|
|
792
793
|
}).catch(() => {
|
|
@@ -1613,6 +1614,12 @@ var Response = class _Response {
|
|
|
1613
1614
|
pageResponse.props[prop] = deepMerge(currentProp, incomingProp, prop);
|
|
1614
1615
|
});
|
|
1615
1616
|
pageResponse.props = { ...page.get().props, ...pageResponse.props };
|
|
1617
|
+
if (page.get().scrollProps) {
|
|
1618
|
+
pageResponse.scrollProps = {
|
|
1619
|
+
...page.get().scrollProps || {},
|
|
1620
|
+
...pageResponse.scrollProps || {}
|
|
1621
|
+
};
|
|
1622
|
+
}
|
|
1616
1623
|
}
|
|
1617
1624
|
mergeOrMatchItems(existingItems, newItems, matchProp, matchPropsOn, shouldAppend = true) {
|
|
1618
1625
|
const items = Array.isArray(existingItems) ? existingItems : [];
|