@inertiajs/core 2.3.13 → 2.3.15

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.js CHANGED
@@ -91,7 +91,8 @@ var Config = class {
91
91
  var config = new Config({
92
92
  form: {
93
93
  recentlySuccessfulDuration: 2e3,
94
- forceIndicesArrayFormatInFormData: true
94
+ forceIndicesArrayFormatInFormData: true,
95
+ withAllErrors: false
95
96
  },
96
97
  future: {
97
98
  preserveEqualProps: false,
@@ -655,7 +656,7 @@ var getScrollableParent = (element) => {
655
656
  if (["visible", "clip"].includes(computedStyle.overflowX)) {
656
657
  return true;
657
658
  }
658
- return hasDimensionConstraint(computedStyle.maxHeight, el.style.height);
659
+ return hasDimensionConstraint(computedStyle.maxHeight, el.style.height) || isConstrainedByLayout(el, "height");
659
660
  };
660
661
  const allowsHorizontalScroll = (el) => {
661
662
  const computedStyle = window.getComputedStyle(el);
@@ -668,7 +669,7 @@ var getScrollableParent = (element) => {
668
669
  if (["visible", "clip"].includes(computedStyle.overflowY)) {
669
670
  return true;
670
671
  }
671
- return hasDimensionConstraint(computedStyle.maxWidth, el.style.width);
672
+ return hasDimensionConstraint(computedStyle.maxWidth, el.style.width) || isConstrainedByLayout(el, "width");
672
673
  };
673
674
  const hasDimensionConstraint = (computedMaxDimension, inlineStyleDimension) => {
674
675
  if (computedMaxDimension && computedMaxDimension !== "none" && computedMaxDimension !== "0px") {
@@ -679,6 +680,18 @@ var getScrollableParent = (element) => {
679
680
  }
680
681
  return false;
681
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
+ };
682
695
  let parent = element?.parentElement;
683
696
  while (parent) {
684
697
  const allowsScroll = allowsVerticalScroll(parent) || allowsHorizontalScroll(parent);
@@ -1299,7 +1312,8 @@ var History = class {
1299
1312
  cb && cb();
1300
1313
  return;
1301
1314
  }
1302
- page.merge(page2);
1315
+ const { flash, ...pageWithoutFlash } = page2;
1316
+ page.merge(pageWithoutFlash);
1303
1317
  if (isServer2) {
1304
1318
  return;
1305
1319
  }
@@ -1407,6 +1421,7 @@ var EventHandler = class {
1407
1421
  init() {
1408
1422
  if (typeof window !== "undefined") {
1409
1423
  window.addEventListener("popstate", this.handlePopstateEvent.bind(this));
1424
+ window.addEventListener("pageshow", this.handlePageshowEvent.bind(this));
1410
1425
  window.addEventListener("scroll", debounce(Scroll.onWindowScroll.bind(Scroll), 100), true);
1411
1426
  }
1412
1427
  if (typeof document !== "undefined") {
@@ -1439,6 +1454,14 @@ var EventHandler = class {
1439
1454
  document.addEventListener(type, listener);
1440
1455
  return () => document.removeEventListener(type, listener);
1441
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
+ }
1442
1465
  handlePopstateEvent(event) {
1443
1466
  const state = event.state || null;
1444
1467
  if (state === null) {