@inertiajs/core 2.3.14 → 2.3.16
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 -3
- package/dist/index.esm.js.map +3 -3
- package/dist/index.js +25 -3
- package/dist/index.js.map +3 -3
- package/package.json +6 -6
- package/types/eventHandler.d.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -656,7 +656,7 @@ var getScrollableParent = (element) => {
|
|
|
656
656
|
if (["visible", "clip"].includes(computedStyle.overflowX)) {
|
|
657
657
|
return true;
|
|
658
658
|
}
|
|
659
|
-
return hasDimensionConstraint(computedStyle.maxHeight, el.style.height);
|
|
659
|
+
return hasDimensionConstraint(computedStyle.maxHeight, el.style.height) || isConstrainedByLayout(el, "height");
|
|
660
660
|
};
|
|
661
661
|
const allowsHorizontalScroll = (el) => {
|
|
662
662
|
const computedStyle = window.getComputedStyle(el);
|
|
@@ -669,7 +669,7 @@ var getScrollableParent = (element) => {
|
|
|
669
669
|
if (["visible", "clip"].includes(computedStyle.overflowY)) {
|
|
670
670
|
return true;
|
|
671
671
|
}
|
|
672
|
-
return hasDimensionConstraint(computedStyle.maxWidth, el.style.width);
|
|
672
|
+
return hasDimensionConstraint(computedStyle.maxWidth, el.style.width) || isConstrainedByLayout(el, "width");
|
|
673
673
|
};
|
|
674
674
|
const hasDimensionConstraint = (computedMaxDimension, inlineStyleDimension) => {
|
|
675
675
|
if (computedMaxDimension && computedMaxDimension !== "none" && computedMaxDimension !== "0px") {
|
|
@@ -680,6 +680,18 @@ var getScrollableParent = (element) => {
|
|
|
680
680
|
}
|
|
681
681
|
return false;
|
|
682
682
|
};
|
|
683
|
+
const isConstrainedByLayout = (el, dimension) => {
|
|
684
|
+
const parent2 = el.parentElement;
|
|
685
|
+
if (!parent2) {
|
|
686
|
+
return false;
|
|
687
|
+
}
|
|
688
|
+
const parentStyle = window.getComputedStyle(parent2);
|
|
689
|
+
if (["flex", "inline-flex"].includes(parentStyle.display)) {
|
|
690
|
+
const isColumnLayout = ["column", "column-reverse"].includes(parentStyle.flexDirection);
|
|
691
|
+
return dimension === "height" ? isColumnLayout : !isColumnLayout;
|
|
692
|
+
}
|
|
693
|
+
return ["grid", "inline-grid"].includes(parentStyle.display);
|
|
694
|
+
};
|
|
683
695
|
let parent = element?.parentElement;
|
|
684
696
|
while (parent) {
|
|
685
697
|
const allowsScroll = allowsVerticalScroll(parent) || allowsHorizontalScroll(parent);
|
|
@@ -1300,7 +1312,8 @@ var History = class {
|
|
|
1300
1312
|
cb && cb();
|
|
1301
1313
|
return;
|
|
1302
1314
|
}
|
|
1303
|
-
|
|
1315
|
+
const { flash, ...pageWithoutFlash } = page2;
|
|
1316
|
+
page.merge(pageWithoutFlash);
|
|
1304
1317
|
if (isServer2) {
|
|
1305
1318
|
return;
|
|
1306
1319
|
}
|
|
@@ -1408,6 +1421,7 @@ var EventHandler = class {
|
|
|
1408
1421
|
init() {
|
|
1409
1422
|
if (typeof window !== "undefined") {
|
|
1410
1423
|
window.addEventListener("popstate", this.handlePopstateEvent.bind(this));
|
|
1424
|
+
window.addEventListener("pageshow", this.handlePageshowEvent.bind(this));
|
|
1411
1425
|
window.addEventListener("scroll", debounce(Scroll.onWindowScroll.bind(Scroll), 100), true);
|
|
1412
1426
|
}
|
|
1413
1427
|
if (typeof document !== "undefined") {
|
|
@@ -1440,6 +1454,14 @@ var EventHandler = class {
|
|
|
1440
1454
|
document.addEventListener(type, listener);
|
|
1441
1455
|
return () => document.removeEventListener(type, listener);
|
|
1442
1456
|
}
|
|
1457
|
+
// bfcache restores pages without firing `popstate`, so we use `pageshow` to
|
|
1458
|
+
// re-validate encrypted history entries after `clearHistory` removed the keys.
|
|
1459
|
+
// https://web.dev/articles/bfcache
|
|
1460
|
+
handlePageshowEvent(event) {
|
|
1461
|
+
if (event.persisted) {
|
|
1462
|
+
history.decrypt().catch(() => this.onMissingHistoryItem());
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1443
1465
|
handlePopstateEvent(event) {
|
|
1444
1466
|
const state = event.state || null;
|
|
1445
1467
|
if (state === null) {
|