@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.esm.js CHANGED
@@ -33,7 +33,8 @@ var Config = class {
33
33
  var config = new Config({
34
34
  form: {
35
35
  recentlySuccessfulDuration: 2e3,
36
- forceIndicesArrayFormatInFormData: true
36
+ forceIndicesArrayFormatInFormData: true,
37
+ withAllErrors: false
37
38
  },
38
39
  future: {
39
40
  preserveEqualProps: false,
@@ -597,7 +598,7 @@ var getScrollableParent = (element) => {
597
598
  if (["visible", "clip"].includes(computedStyle.overflowX)) {
598
599
  return true;
599
600
  }
600
- return hasDimensionConstraint(computedStyle.maxHeight, el.style.height);
601
+ return hasDimensionConstraint(computedStyle.maxHeight, el.style.height) || isConstrainedByLayout(el, "height");
601
602
  };
602
603
  const allowsHorizontalScroll = (el) => {
603
604
  const computedStyle = window.getComputedStyle(el);
@@ -610,7 +611,7 @@ var getScrollableParent = (element) => {
610
611
  if (["visible", "clip"].includes(computedStyle.overflowY)) {
611
612
  return true;
612
613
  }
613
- return hasDimensionConstraint(computedStyle.maxWidth, el.style.width);
614
+ return hasDimensionConstraint(computedStyle.maxWidth, el.style.width) || isConstrainedByLayout(el, "width");
614
615
  };
615
616
  const hasDimensionConstraint = (computedMaxDimension, inlineStyleDimension) => {
616
617
  if (computedMaxDimension && computedMaxDimension !== "none" && computedMaxDimension !== "0px") {
@@ -621,6 +622,18 @@ var getScrollableParent = (element) => {
621
622
  }
622
623
  return false;
623
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
+ };
624
637
  let parent = element?.parentElement;
625
638
  while (parent) {
626
639
  const allowsScroll = allowsVerticalScroll(parent) || allowsHorizontalScroll(parent);
@@ -1241,7 +1254,8 @@ var History = class {
1241
1254
  cb && cb();
1242
1255
  return;
1243
1256
  }
1244
- page.merge(page2);
1257
+ const { flash, ...pageWithoutFlash } = page2;
1258
+ page.merge(pageWithoutFlash);
1245
1259
  if (isServer2) {
1246
1260
  return;
1247
1261
  }
@@ -1349,6 +1363,7 @@ var EventHandler = class {
1349
1363
  init() {
1350
1364
  if (typeof window !== "undefined") {
1351
1365
  window.addEventListener("popstate", this.handlePopstateEvent.bind(this));
1366
+ window.addEventListener("pageshow", this.handlePageshowEvent.bind(this));
1352
1367
  window.addEventListener("scroll", debounce(Scroll.onWindowScroll.bind(Scroll), 100), true);
1353
1368
  }
1354
1369
  if (typeof document !== "undefined") {
@@ -1381,6 +1396,14 @@ var EventHandler = class {
1381
1396
  document.addEventListener(type, listener);
1382
1397
  return () => document.removeEventListener(type, listener);
1383
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
+ }
1384
1407
  handlePopstateEvent(event) {
1385
1408
  const state = event.state || null;
1386
1409
  if (state === null) {