@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.esm.js
CHANGED
|
@@ -598,7 +598,7 @@ var getScrollableParent = (element) => {
|
|
|
598
598
|
if (["visible", "clip"].includes(computedStyle.overflowX)) {
|
|
599
599
|
return true;
|
|
600
600
|
}
|
|
601
|
-
return hasDimensionConstraint(computedStyle.maxHeight, el.style.height);
|
|
601
|
+
return hasDimensionConstraint(computedStyle.maxHeight, el.style.height) || isConstrainedByLayout(el, "height");
|
|
602
602
|
};
|
|
603
603
|
const allowsHorizontalScroll = (el) => {
|
|
604
604
|
const computedStyle = window.getComputedStyle(el);
|
|
@@ -611,7 +611,7 @@ var getScrollableParent = (element) => {
|
|
|
611
611
|
if (["visible", "clip"].includes(computedStyle.overflowY)) {
|
|
612
612
|
return true;
|
|
613
613
|
}
|
|
614
|
-
return hasDimensionConstraint(computedStyle.maxWidth, el.style.width);
|
|
614
|
+
return hasDimensionConstraint(computedStyle.maxWidth, el.style.width) || isConstrainedByLayout(el, "width");
|
|
615
615
|
};
|
|
616
616
|
const hasDimensionConstraint = (computedMaxDimension, inlineStyleDimension) => {
|
|
617
617
|
if (computedMaxDimension && computedMaxDimension !== "none" && computedMaxDimension !== "0px") {
|
|
@@ -622,6 +622,18 @@ var getScrollableParent = (element) => {
|
|
|
622
622
|
}
|
|
623
623
|
return false;
|
|
624
624
|
};
|
|
625
|
+
const isConstrainedByLayout = (el, dimension) => {
|
|
626
|
+
const parent2 = el.parentElement;
|
|
627
|
+
if (!parent2) {
|
|
628
|
+
return false;
|
|
629
|
+
}
|
|
630
|
+
const parentStyle = window.getComputedStyle(parent2);
|
|
631
|
+
if (["flex", "inline-flex"].includes(parentStyle.display)) {
|
|
632
|
+
const isColumnLayout = ["column", "column-reverse"].includes(parentStyle.flexDirection);
|
|
633
|
+
return dimension === "height" ? isColumnLayout : !isColumnLayout;
|
|
634
|
+
}
|
|
635
|
+
return ["grid", "inline-grid"].includes(parentStyle.display);
|
|
636
|
+
};
|
|
625
637
|
let parent = element?.parentElement;
|
|
626
638
|
while (parent) {
|
|
627
639
|
const allowsScroll = allowsVerticalScroll(parent) || allowsHorizontalScroll(parent);
|
|
@@ -1242,7 +1254,8 @@ var History = class {
|
|
|
1242
1254
|
cb && cb();
|
|
1243
1255
|
return;
|
|
1244
1256
|
}
|
|
1245
|
-
|
|
1257
|
+
const { flash, ...pageWithoutFlash } = page2;
|
|
1258
|
+
page.merge(pageWithoutFlash);
|
|
1246
1259
|
if (isServer2) {
|
|
1247
1260
|
return;
|
|
1248
1261
|
}
|
|
@@ -1350,6 +1363,7 @@ var EventHandler = class {
|
|
|
1350
1363
|
init() {
|
|
1351
1364
|
if (typeof window !== "undefined") {
|
|
1352
1365
|
window.addEventListener("popstate", this.handlePopstateEvent.bind(this));
|
|
1366
|
+
window.addEventListener("pageshow", this.handlePageshowEvent.bind(this));
|
|
1353
1367
|
window.addEventListener("scroll", debounce(Scroll.onWindowScroll.bind(Scroll), 100), true);
|
|
1354
1368
|
}
|
|
1355
1369
|
if (typeof document !== "undefined") {
|
|
@@ -1382,6 +1396,14 @@ var EventHandler = class {
|
|
|
1382
1396
|
document.addEventListener(type, listener);
|
|
1383
1397
|
return () => document.removeEventListener(type, listener);
|
|
1384
1398
|
}
|
|
1399
|
+
// bfcache restores pages without firing `popstate`, so we use `pageshow` to
|
|
1400
|
+
// re-validate encrypted history entries after `clearHistory` removed the keys.
|
|
1401
|
+
// https://web.dev/articles/bfcache
|
|
1402
|
+
handlePageshowEvent(event) {
|
|
1403
|
+
if (event.persisted) {
|
|
1404
|
+
history.decrypt().catch(() => this.onMissingHistoryItem());
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1385
1407
|
handlePopstateEvent(event) {
|
|
1386
1408
|
const state = event.state || null;
|
|
1387
1409
|
if (state === null) {
|