@ionic/core 8.7.16-dev.11767111768.1552e96d → 8.7.16-dev.11767205737.13557925

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/hydrate/index.js CHANGED
@@ -21533,7 +21533,7 @@ const calculateSpringStep = (t) => {
21533
21533
  const SwipeToCloseDefaults = {
21534
21534
  MIN_PRESENTING_SCALE: 0.915,
21535
21535
  };
21536
- const createSwipeToCloseGesture = (el, animation, statusBarStyle, onDismiss) => {
21536
+ const createSwipeToCloseGesture = (el, animation, statusBarStyle, onDismiss, onGestureMove) => {
21537
21537
  /**
21538
21538
  * The step value at which a card modal
21539
21539
  * is eligible for dismissing via gesture.
@@ -21690,6 +21690,8 @@ const createSwipeToCloseGesture = (el, animation, statusBarStyle, onDismiss) =>
21690
21690
  const processedStep = isAttemptingDismissWithCanDismiss ? calculateSpringStep(step / maxStep) : step;
21691
21691
  const clampedStep = clamp(0.0001, processedStep, maxStep);
21692
21692
  animation.progressStep(clampedStep);
21693
+ // Notify modal of position change for safe-area updates
21694
+ onGestureMove === null || onGestureMove === void 0 ? void 0 : onGestureMove();
21693
21695
  /**
21694
21696
  * When swiping down half way, the status bar style
21695
21697
  * should be reset to its default value.
@@ -22233,7 +22235,7 @@ const mdLeaveAnimation$2 = (baseEl, opts) => {
22233
22235
  return baseAnimation;
22234
22236
  };
22235
22237
 
22236
- const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpoint, backdropBreakpoint, animation, breakpoints = [], expandToScroll, getCurrentBreakpoint, onDismiss, onBreakpointChange) => {
22238
+ const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpoint, backdropBreakpoint, animation, breakpoints = [], expandToScroll, getCurrentBreakpoint, onDismiss, onBreakpointChange, onGestureMove) => {
22237
22239
  // Defaults for the sheet swipe animation
22238
22240
  const defaultBackdrop = [
22239
22241
  { offset: 0, opacity: 'var(--backdrop-opacity)' },
@@ -22564,6 +22566,8 @@ const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpoint, ba
22564
22566
  : step;
22565
22567
  offset = clamp(0.0001, processedStep, maxStep);
22566
22568
  animation.progressStep(offset);
22569
+ // Notify modal of position change for safe-area updates
22570
+ onGestureMove === null || onGestureMove === void 0 ? void 0 : onGestureMove();
22567
22571
  };
22568
22572
  const onEnd = (detail) => {
22569
22573
  /**
@@ -22758,9 +22762,9 @@ const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpoint, ba
22758
22762
  };
22759
22763
  };
22760
22764
 
22761
- const modalIosCss = ":host{--width:100%;--min-width:auto;--max-width:auto;--height:100%;--min-height:auto;--max-height:auto;--overflow:hidden;--border-radius:0;--border-width:0;--border-style:none;--border-color:transparent;--background:var(--ion-background-color, #fff);--box-shadow:none;--backdrop-opacity:0;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:absolute;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;outline:none;color:var(--ion-text-color, #000);contain:strict}.modal-wrapper,ion-backdrop{pointer-events:auto}:host(.overlay-hidden){display:none}.modal-wrapper,.modal-shadow{border-radius:var(--border-radius);width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);overflow:var(--overflow);z-index:10}.modal-shadow{position:absolute;background:transparent}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--width:600px;--height:500px;--ion-safe-area-top:0px;--ion-safe-area-bottom:0px;--ion-safe-area-right:0px;--ion-safe-area-left:0px}}@media only screen and (min-width: 768px) and (min-height: 768px){:host{--width:600px;--height:600px}}.modal-handle{left:0px;right:0px;top:5px;border-radius:8px;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;position:absolute;width:36px;height:5px;-webkit-transform:translateZ(0);transform:translateZ(0);border:0;background:var(--ion-color-step-350, var(--ion-background-color-step-350, #c0c0be));cursor:pointer;z-index:11}.modal-handle::before{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px;padding-top:4px;padding-bottom:4px;position:absolute;width:36px;height:5px;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);content:\"\"}:host(.modal-sheet){--height:calc(100% - (var(--ion-safe-area-top) + 10px))}:host(.modal-sheet) .modal-wrapper,:host(.modal-sheet) .modal-shadow{position:absolute;bottom:0}:host(.modal-sheet.modal-no-expand-scroll) ion-footer{position:absolute;bottom:0;width:var(--width)}:host{--backdrop-opacity:var(--ion-backdrop-opacity, 0.4)}:host(.modal-card),:host(.modal-sheet){--border-radius:10px}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--border-radius:10px}}.modal-wrapper{-webkit-transform:translate3d(0, 100%, 0);transform:translate3d(0, 100%, 0)}@media screen and (max-width: 767px){@supports (width: max(0px, 1px)){:host(.modal-card){--height:calc(100% - max(30px, var(--ion-safe-area-top)) - 10px)}}@supports not (width: max(0px, 1px)){:host(.modal-card){--height:calc(100% - 40px)}}:host(.modal-card) .modal-wrapper{border-start-start-radius:var(--border-radius);border-start-end-radius:var(--border-radius);border-end-end-radius:0;border-end-start-radius:0}:host(.modal-card){--backdrop-opacity:0;--width:100%;-ms-flex-align:end;align-items:flex-end}:host(.modal-card) .modal-shadow{display:none}:host(.modal-card) ion-backdrop{pointer-events:none}}@media screen and (min-width: 768px){:host(.modal-card){--width:calc(100% - 120px);--height:calc(100% - (120px + var(--ion-safe-area-top) + var(--ion-safe-area-bottom)));--max-width:720px;--max-height:1000px;--backdrop-opacity:0;--box-shadow:0px 0px 30px 10px rgba(0, 0, 0, 0.1);-webkit-transition:all 0.5s ease-in-out;transition:all 0.5s ease-in-out}:host(.modal-card) .modal-wrapper{-webkit-box-shadow:none;box-shadow:none}:host(.modal-card) .modal-shadow{-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow)}}:host(.modal-sheet) .modal-wrapper{border-start-start-radius:var(--border-radius);border-start-end-radius:var(--border-radius);border-end-end-radius:0;border-end-start-radius:0}";
22765
+ const modalIosCss = ":host{--width:100%;--min-width:auto;--max-width:auto;--height:100%;--min-height:auto;--max-height:auto;--overflow:hidden;--border-radius:0;--border-width:0;--border-style:none;--border-color:transparent;--background:var(--ion-background-color, #fff);--box-shadow:none;--backdrop-opacity:0;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:absolute;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;outline:none;color:var(--ion-text-color, #000);contain:strict}.modal-wrapper,ion-backdrop{pointer-events:auto}:host(.overlay-hidden){display:none}.modal-wrapper,.modal-shadow{border-radius:var(--border-radius);width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);overflow:var(--overflow);z-index:10}.modal-shadow{position:absolute;background:transparent}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--width:600px;--height:500px}}@media only screen and (min-width: 768px) and (min-height: 768px){:host{--width:600px;--height:600px}}.modal-handle{left:0px;right:0px;top:5px;border-radius:8px;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;position:absolute;width:36px;height:5px;-webkit-transform:translateZ(0);transform:translateZ(0);border:0;background:var(--ion-color-step-350, var(--ion-background-color-step-350, #c0c0be));cursor:pointer;z-index:11}.modal-handle::before{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px;padding-top:4px;padding-bottom:4px;position:absolute;width:36px;height:5px;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);content:\"\"}:host(.modal-sheet){--height:calc(100% - (var(--ion-safe-area-top) + 10px))}:host(.modal-sheet) .modal-wrapper,:host(.modal-sheet) .modal-shadow{position:absolute;bottom:0}:host(.modal-sheet.modal-no-expand-scroll) ion-footer{position:absolute;bottom:0;width:var(--width)}:host{--backdrop-opacity:var(--ion-backdrop-opacity, 0.4)}:host(.modal-card),:host(.modal-sheet){--border-radius:10px}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--border-radius:10px}}.modal-wrapper{-webkit-transform:translate3d(0, 100%, 0);transform:translate3d(0, 100%, 0)}@media screen and (max-width: 767px){@supports (width: max(0px, 1px)){:host(.modal-card){--height:calc(100% - max(30px, var(--ion-safe-area-top)) - 10px)}}@supports not (width: max(0px, 1px)){:host(.modal-card){--height:calc(100% - 40px)}}:host(.modal-card) .modal-wrapper{border-start-start-radius:var(--border-radius);border-start-end-radius:var(--border-radius);border-end-end-radius:0;border-end-start-radius:0}:host(.modal-card){--backdrop-opacity:0;--width:100%;-ms-flex-align:end;align-items:flex-end}:host(.modal-card) .modal-shadow{display:none}:host(.modal-card) ion-backdrop{pointer-events:none}}@media screen and (min-width: 768px){:host(.modal-card){--width:calc(100% - 120px);--height:calc(100% - (120px + var(--ion-safe-area-top) + var(--ion-safe-area-bottom)));--max-width:720px;--max-height:1000px;--backdrop-opacity:0;--box-shadow:0px 0px 30px 10px rgba(0, 0, 0, 0.1);-webkit-transition:all 0.5s ease-in-out;transition:all 0.5s ease-in-out}:host(.modal-card) .modal-wrapper{-webkit-box-shadow:none;box-shadow:none}:host(.modal-card) .modal-shadow{-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow)}}:host(.modal-sheet) .modal-wrapper{border-start-start-radius:var(--border-radius);border-start-end-radius:var(--border-radius);border-end-end-radius:0;border-end-start-radius:0}";
22762
22766
 
22763
- const modalMdCss = ":host{--width:100%;--min-width:auto;--max-width:auto;--height:100%;--min-height:auto;--max-height:auto;--overflow:hidden;--border-radius:0;--border-width:0;--border-style:none;--border-color:transparent;--background:var(--ion-background-color, #fff);--box-shadow:none;--backdrop-opacity:0;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:absolute;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;outline:none;color:var(--ion-text-color, #000);contain:strict}.modal-wrapper,ion-backdrop{pointer-events:auto}:host(.overlay-hidden){display:none}.modal-wrapper,.modal-shadow{border-radius:var(--border-radius);width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);overflow:var(--overflow);z-index:10}.modal-shadow{position:absolute;background:transparent}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--width:600px;--height:500px;--ion-safe-area-top:0px;--ion-safe-area-bottom:0px;--ion-safe-area-right:0px;--ion-safe-area-left:0px}}@media only screen and (min-width: 768px) and (min-height: 768px){:host{--width:600px;--height:600px}}.modal-handle{left:0px;right:0px;top:5px;border-radius:8px;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;position:absolute;width:36px;height:5px;-webkit-transform:translateZ(0);transform:translateZ(0);border:0;background:var(--ion-color-step-350, var(--ion-background-color-step-350, #c0c0be));cursor:pointer;z-index:11}.modal-handle::before{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px;padding-top:4px;padding-bottom:4px;position:absolute;width:36px;height:5px;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);content:\"\"}:host(.modal-sheet){--height:calc(100% - (var(--ion-safe-area-top) + 10px))}:host(.modal-sheet) .modal-wrapper,:host(.modal-sheet) .modal-shadow{position:absolute;bottom:0}:host(.modal-sheet.modal-no-expand-scroll) ion-footer{position:absolute;bottom:0;width:var(--width)}:host{--backdrop-opacity:var(--ion-backdrop-opacity, 0.32)}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--border-radius:2px;--box-shadow:0 28px 48px rgba(0, 0, 0, 0.4)}}.modal-wrapper{-webkit-transform:translate3d(0, 40px, 0);transform:translate3d(0, 40px, 0);opacity:0.01}";
22767
+ const modalMdCss = ":host{--width:100%;--min-width:auto;--max-width:auto;--height:100%;--min-height:auto;--max-height:auto;--overflow:hidden;--border-radius:0;--border-width:0;--border-style:none;--border-color:transparent;--background:var(--ion-background-color, #fff);--box-shadow:none;--backdrop-opacity:0;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:absolute;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;outline:none;color:var(--ion-text-color, #000);contain:strict}.modal-wrapper,ion-backdrop{pointer-events:auto}:host(.overlay-hidden){display:none}.modal-wrapper,.modal-shadow{border-radius:var(--border-radius);width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);overflow:var(--overflow);z-index:10}.modal-shadow{position:absolute;background:transparent}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--width:600px;--height:500px}}@media only screen and (min-width: 768px) and (min-height: 768px){:host{--width:600px;--height:600px}}.modal-handle{left:0px;right:0px;top:5px;border-radius:8px;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;position:absolute;width:36px;height:5px;-webkit-transform:translateZ(0);transform:translateZ(0);border:0;background:var(--ion-color-step-350, var(--ion-background-color-step-350, #c0c0be));cursor:pointer;z-index:11}.modal-handle::before{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px;padding-top:4px;padding-bottom:4px;position:absolute;width:36px;height:5px;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);content:\"\"}:host(.modal-sheet){--height:calc(100% - (var(--ion-safe-area-top) + 10px))}:host(.modal-sheet) .modal-wrapper,:host(.modal-sheet) .modal-shadow{position:absolute;bottom:0}:host(.modal-sheet.modal-no-expand-scroll) ion-footer{position:absolute;bottom:0;width:var(--width)}:host{--backdrop-opacity:var(--ion-backdrop-opacity, 0.32)}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--border-radius:2px;--box-shadow:0 28px 48px rgba(0, 0, 0, 0.4)}}.modal-wrapper{-webkit-transform:translate3d(0, 40px, 0);transform:translate3d(0, 40px, 0);opacity:0.01}";
22764
22768
 
22765
22769
  // TODO(FW-2832): types
22766
22770
  /**
@@ -22793,6 +22797,8 @@ class Modal {
22793
22797
  this.inline = false;
22794
22798
  // Whether or not modal is being dismissed via gesture
22795
22799
  this.gestureAnimationDismissing = false;
22800
+ // Whether to skip coordinate-based safe-area detection (for fullscreen phone modals)
22801
+ this.skipSafeAreaCoordinateDetection = false;
22796
22802
  this.presented = false;
22797
22803
  /** @internal */
22798
22804
  this.hasController = false;
@@ -22983,7 +22989,9 @@ class Modal {
22983
22989
  }
22984
22990
  }
22985
22991
  onWindowResize() {
22986
- // Only handle resize for iOS card modals when no custom animations are provided
22992
+ // Update safe-area overrides for all modal types on resize
22993
+ this.updateSafeAreaOverrides();
22994
+ // Only handle view transition for iOS card modals when no custom animations are provided
22987
22995
  if (getIonMode$1(this) !== 'ios' || !this.presentingElement || this.enterAnimation || this.leaveAnimation) {
22988
22996
  return;
22989
22997
  }
@@ -23165,6 +23173,8 @@ class Modal {
23165
23173
  else if (!this.keepContentsMounted) {
23166
23174
  await waitForMount();
23167
23175
  }
23176
+ // Predict safe-area needs based on modal configuration to avoid visual snap
23177
+ this.setInitialSafeAreaOverrides(presentingElement);
23168
23178
  writeTask(() => this.el.classList.add('show-modal'));
23169
23179
  const hasCardModal = presentingElement !== undefined;
23170
23180
  /**
@@ -23226,6 +23236,8 @@ class Modal {
23226
23236
  else if (hasCardModal) {
23227
23237
  this.initSwipeToClose();
23228
23238
  }
23239
+ // Now that animation is complete, update safe-area based on actual position
23240
+ this.updateSafeAreaOverrides();
23229
23241
  // Initialize view transition listener for iOS card modals
23230
23242
  this.initViewTransitionListener();
23231
23243
  // Initialize parent removal observer
@@ -23277,7 +23289,7 @@ class Modal {
23277
23289
  await this.dismiss(undefined, GESTURE);
23278
23290
  this.gestureAnimationDismissing = false;
23279
23291
  });
23280
- });
23292
+ }, () => this.updateSafeAreaOverrides());
23281
23293
  this.gesture.enable(true);
23282
23294
  }
23283
23295
  initSheetGesture() {
@@ -23298,7 +23310,8 @@ class Modal {
23298
23310
  this.currentBreakpoint = breakpoint;
23299
23311
  this.ionBreakpointDidChange.emit({ breakpoint });
23300
23312
  }
23301
- });
23313
+ this.updateSafeAreaOverrides();
23314
+ }, () => this.updateSafeAreaOverrides());
23302
23315
  this.gesture = gesture;
23303
23316
  this.moveSheetToBreakpoint = moveSheetToBreakpoint;
23304
23317
  this.gesture.enable(true);
@@ -23376,6 +23389,97 @@ class Modal {
23376
23389
  // Clear the cached reference
23377
23390
  this.cachedPageParent = undefined;
23378
23391
  }
23392
+ /**
23393
+ * Sets initial safe-area overrides based on modal configuration before
23394
+ * the modal becomes visible. This predicts whether the modal will touch
23395
+ * screen edges to avoid a visual snap after animation completes.
23396
+ */
23397
+ setInitialSafeAreaOverrides(presentingElement) {
23398
+ const style = this.el.style;
23399
+ const isSheetModal = this.breakpoints !== undefined && this.initialBreakpoint !== undefined;
23400
+ const isCardModal = presentingElement !== undefined;
23401
+ const isTablet = window.innerWidth >= 768;
23402
+ // Sheet modals always touch bottom edge, never top/left/right
23403
+ if (isSheetModal) {
23404
+ style.setProperty('--ion-safe-area-top', '0px');
23405
+ style.setProperty('--ion-safe-area-left', '0px');
23406
+ style.setProperty('--ion-safe-area-right', '0px');
23407
+ return;
23408
+ }
23409
+ // Card modals are inset from all edges
23410
+ if (isCardModal) {
23411
+ this.zeroAllSafeAreas();
23412
+ return;
23413
+ }
23414
+ // Phone-sized fullscreen modals inherit safe areas and use wrapper padding
23415
+ if (!isTablet) {
23416
+ this.applyFullscreenSafeArea();
23417
+ return;
23418
+ }
23419
+ // Check if tablet modal is fullscreen via CSS custom properties
23420
+ const computedStyle = getComputedStyle(this.el);
23421
+ const width = computedStyle.getPropertyValue('--width').trim();
23422
+ const height = computedStyle.getPropertyValue('--height').trim();
23423
+ const isFullscreen = width === '100%' && height === '100%';
23424
+ if (isFullscreen) {
23425
+ this.applyFullscreenSafeArea();
23426
+ }
23427
+ else {
23428
+ // Centered dialog doesn't touch edges
23429
+ this.zeroAllSafeAreas();
23430
+ }
23431
+ }
23432
+ /**
23433
+ * Applies safe-area handling for fullscreen modals.
23434
+ * Adds wrapper padding when no footer is present to prevent
23435
+ * content from overlapping system navigation areas.
23436
+ */
23437
+ applyFullscreenSafeArea() {
23438
+ this.skipSafeAreaCoordinateDetection = true;
23439
+ const hasFooter = this.el.querySelector('ion-footer') !== null;
23440
+ if (!hasFooter && this.wrapperEl) {
23441
+ this.wrapperEl.style.setProperty('padding-bottom', 'var(--ion-safe-area-bottom, 0px)');
23442
+ this.wrapperEl.style.setProperty('box-sizing', 'border-box');
23443
+ }
23444
+ }
23445
+ /**
23446
+ * Sets all safe-area CSS variables to 0px for modals that
23447
+ * don't touch screen edges.
23448
+ */
23449
+ zeroAllSafeAreas() {
23450
+ const style = this.el.style;
23451
+ style.setProperty('--ion-safe-area-top', '0px');
23452
+ style.setProperty('--ion-safe-area-bottom', '0px');
23453
+ style.setProperty('--ion-safe-area-left', '0px');
23454
+ style.setProperty('--ion-safe-area-right', '0px');
23455
+ }
23456
+ /**
23457
+ * Updates safe-area CSS variable overrides based on whether the modal
23458
+ * is touching each edge of the viewport. Called after animation
23459
+ * and during gestures to handle dynamic position changes.
23460
+ */
23461
+ updateSafeAreaOverrides() {
23462
+ if (this.skipSafeAreaCoordinateDetection) {
23463
+ return;
23464
+ }
23465
+ const wrapper = this.wrapperEl;
23466
+ if (!wrapper) {
23467
+ return;
23468
+ }
23469
+ const rect = wrapper.getBoundingClientRect();
23470
+ const threshold = 2;
23471
+ const touchingTop = rect.top <= threshold;
23472
+ const touchingBottom = rect.bottom >= window.innerHeight - threshold;
23473
+ const touchingLeft = rect.left <= threshold;
23474
+ const touchingRight = rect.right >= window.innerWidth - threshold;
23475
+ const style = this.el.style;
23476
+ touchingTop ? style.removeProperty('--ion-safe-area-top') : style.setProperty('--ion-safe-area-top', '0px');
23477
+ touchingBottom
23478
+ ? style.removeProperty('--ion-safe-area-bottom')
23479
+ : style.setProperty('--ion-safe-area-bottom', '0px');
23480
+ touchingLeft ? style.removeProperty('--ion-safe-area-left') : style.setProperty('--ion-safe-area-left', '0px');
23481
+ touchingRight ? style.removeProperty('--ion-safe-area-right') : style.setProperty('--ion-safe-area-right', '0px');
23482
+ }
23379
23483
  sheetOnDismiss() {
23380
23484
  /**
23381
23485
  * While the gesture animation is finishing
@@ -23468,6 +23572,8 @@ class Modal {
23468
23572
  }
23469
23573
  this.currentBreakpoint = undefined;
23470
23574
  this.animation = undefined;
23575
+ // Reset safe-area detection flag for potential re-presentation
23576
+ this.skipSafeAreaCoordinateDetection = false;
23471
23577
  unlock();
23472
23578
  return dismissed;
23473
23579
  }
@@ -23549,6 +23655,10 @@ class Modal {
23549
23655
  this.currentViewIsPortrait = window.innerWidth < 768;
23550
23656
  }
23551
23657
  handleViewTransition() {
23658
+ // Only run view transitions when the modal is presented
23659
+ if (!this.presented) {
23660
+ return;
23661
+ }
23552
23662
  const isPortrait = window.innerWidth < 768;
23553
23663
  // Only transition if view state actually changed
23554
23664
  if (this.currentViewIsPortrait === isPortrait) {
@@ -23713,20 +23823,20 @@ class Modal {
23713
23823
  const isCardModal = presentingElement !== undefined && mode === 'ios';
23714
23824
  const isHandleCycle = handleBehavior === 'cycle';
23715
23825
  const isSheetModalWithHandle = isSheetModal && showHandle;
23716
- return (hAsync(Host, Object.assign({ key: '9a75095a13de0cfc96f1fa69fd92777d25da8daa', "no-router": true,
23826
+ return (hAsync(Host, Object.assign({ key: 'b93c9d20985ca4800b34c0165957b12b0a9d6789', "no-router": true,
23717
23827
  // Allow the modal to be navigable when the handle is focusable
23718
23828
  tabIndex: isHandleCycle && isSheetModalWithHandle ? 0 : -1 }, htmlAttributes, { style: {
23719
23829
  zIndex: `${20000 + this.overlayIndex}`,
23720
- }, class: Object.assign({ [mode]: true, ['modal-default']: !isCardModal && !isSheetModal, [`modal-card`]: isCardModal, [`modal-sheet`]: isSheetModal, [`modal-no-expand-scroll`]: isSheetModal && !expandToScroll, 'overlay-hidden': true, [FOCUS_TRAP_DISABLE_CLASS]: focusTrap === false }, getClassMap(this.cssClass)), onIonBackdropTap: this.onBackdropTap, onIonModalDidPresent: this.onLifecycle, onIonModalWillPresent: this.onLifecycle, onIonModalWillDismiss: this.onLifecycle, onIonModalDidDismiss: this.onLifecycle, onFocus: this.onModalFocus }), hAsync("ion-backdrop", { key: 'd02612d8063ef20f59f173ff47795f71cdaaf63e', ref: (el) => (this.backdropEl = el), visible: this.showBackdrop, tappable: this.backdropDismiss, part: "backdrop" }), mode === 'ios' && hAsync("div", { key: '708761b70a93e34c08faae079569f444c7416a4c', class: "modal-shadow" }), hAsync("div", Object.assign({ key: 'a72226ff1a98229f9bfd9207b98fc57e02baa430',
23830
+ }, class: Object.assign({ [mode]: true, ['modal-default']: !isCardModal && !isSheetModal, [`modal-card`]: isCardModal, [`modal-sheet`]: isSheetModal, [`modal-no-expand-scroll`]: isSheetModal && !expandToScroll, 'overlay-hidden': true, [FOCUS_TRAP_DISABLE_CLASS]: focusTrap === false }, getClassMap(this.cssClass)), onIonBackdropTap: this.onBackdropTap, onIonModalDidPresent: this.onLifecycle, onIonModalWillPresent: this.onLifecycle, onIonModalWillDismiss: this.onLifecycle, onIonModalDidDismiss: this.onLifecycle, onFocus: this.onModalFocus }), hAsync("ion-backdrop", { key: '732b9355b3c0b051d19e1e0cedd7c49e3ad6fdda', ref: (el) => (this.backdropEl = el), visible: this.showBackdrop, tappable: this.backdropDismiss, part: "backdrop" }), mode === 'ios' && hAsync("div", { key: '874dcbb38da5a9feecafc5d3d1cb9f140f7fe48c', class: "modal-shadow" }), hAsync("div", Object.assign({ key: '0d0c28581d49aeb0f764387a76ad54f68c35a6d5',
23721
23831
  /*
23722
23832
  role and aria-modal must be used on the
23723
23833
  same element. They must also be set inside the
23724
23834
  shadow DOM otherwise ion-button will not be highlighted
23725
23835
  when using VoiceOver: https://bugs.webkit.org/show_bug.cgi?id=247134
23726
23836
  */
23727
- role: "dialog" }, inheritedAttributes, { "aria-modal": "true", class: "modal-wrapper ion-overlay-wrapper", part: "content", ref: (el) => (this.wrapperEl = el) }), showHandle && (hAsync("button", { key: '0547f32323882660221385d84d492929caa77c6b', class: "modal-handle",
23837
+ role: "dialog" }, inheritedAttributes, { "aria-modal": "true", class: "modal-wrapper ion-overlay-wrapper", part: "content", ref: (el) => (this.wrapperEl = el) }), showHandle && (hAsync("button", { key: 'a27a7ecc9857b4dc2f8a6f64bb01487ac578f5aa', class: "modal-handle",
23728
23838
  // Prevents the handle from receiving keyboard focus when it does not cycle
23729
- tabIndex: !isHandleCycle ? -1 : 0, "aria-label": "Activate to adjust the size of the dialog overlaying the screen", onClick: isHandleCycle ? this.onHandleClick : undefined, part: "handle", ref: (el) => (this.dragHandleEl = el) })), hAsync("slot", { key: 'fccbd64518b6fa22f9e874deb6b4ba55d8d89c3b', onSlotchange: this.onSlotChange }))));
23839
+ tabIndex: !isHandleCycle ? -1 : 0, "aria-label": "Activate to adjust the size of the dialog overlaying the screen", onClick: isHandleCycle ? this.onHandleClick : undefined, part: "handle", ref: (el) => (this.dragHandleEl = el) })), hAsync("slot", { key: '2ca0a826798dbc5cfe06e94b6a2d0ef375d018bc', onSlotchange: this.onSlotChange }))));
23730
23840
  }
23731
23841
  get el() { return getElement(this); }
23732
23842
  static get watchers() { return {
@@ -27304,6 +27414,8 @@ const calculateWindowAdjustment = (side, coordTop, coordLeft, bodyPadding, bodyW
27304
27414
  let bottom;
27305
27415
  let originX = contentOriginX;
27306
27416
  let originY = contentOriginY;
27417
+ let checkSafeAreaTop = false;
27418
+ let checkSafeAreaBottom = false;
27307
27419
  let checkSafeAreaLeft = false;
27308
27420
  let checkSafeAreaRight = false;
27309
27421
  const triggerTop = triggerCoordinates
@@ -27348,10 +27460,18 @@ const calculateWindowAdjustment = (side, coordTop, coordLeft, bodyPadding, bodyW
27348
27460
  * We chose 12 here so that the popover position looks a bit nicer as
27349
27461
  * it is not right up against the edge of the screen.
27350
27462
  */
27351
- top = Math.max(12, triggerTop - contentHeight - triggerHeight - (arrowHeight - 1));
27463
+ top = Math.max(bodyPadding, triggerTop - contentHeight - triggerHeight - (arrowHeight - 1));
27352
27464
  arrowTop = top + contentHeight;
27353
27465
  originY = 'bottom';
27354
27466
  addPopoverBottomClass = true;
27467
+ /**
27468
+ * If the popover is positioned near the top edge, account for safe area.
27469
+ * This ensures the popover doesn't overlap with status bars or notches.
27470
+ */
27471
+ if (top <= bodyPadding + safeAreaMargin) {
27472
+ checkSafeAreaTop = true;
27473
+ top = bodyPadding;
27474
+ }
27355
27475
  /**
27356
27476
  * If not enough room for popover to appear
27357
27477
  * above trigger, then cut it off.
@@ -27359,6 +27479,12 @@ const calculateWindowAdjustment = (side, coordTop, coordLeft, bodyPadding, bodyW
27359
27479
  }
27360
27480
  else {
27361
27481
  bottom = bodyPadding;
27482
+ /**
27483
+ * When the popover is pinned to the bottom, account for safe area.
27484
+ * This ensures the popover doesn't overlap with home indicators
27485
+ * or navigation bars (e.g., Android API 36+ edge-to-edge).
27486
+ */
27487
+ checkSafeAreaBottom = true;
27362
27488
  }
27363
27489
  }
27364
27490
  return {
@@ -27367,6 +27493,8 @@ const calculateWindowAdjustment = (side, coordTop, coordLeft, bodyPadding, bodyW
27367
27493
  bottom,
27368
27494
  originX,
27369
27495
  originY,
27496
+ checkSafeAreaTop,
27497
+ checkSafeAreaBottom,
27370
27498
  checkSafeAreaLeft,
27371
27499
  checkSafeAreaRight,
27372
27500
  arrowTop,
@@ -27427,7 +27555,7 @@ const iosEnterAnimation$1 = (baseEl, opts) => {
27427
27555
  const results = getPopoverPosition(isRTL, contentWidth, contentHeight, arrowWidth, arrowHeight, reference, side, align, defaultPosition, trigger, ev);
27428
27556
  const padding = size === 'cover' ? 0 : POPOVER_IOS_BODY_PADDING;
27429
27557
  const margin = size === 'cover' ? 0 : 25;
27430
- const { originX, originY, top, left, bottom, checkSafeAreaLeft, checkSafeAreaRight, arrowTop, arrowLeft, addPopoverBottomClass, } = calculateWindowAdjustment(side, results.top, results.left, padding, bodyWidth, bodyHeight, contentWidth, contentHeight, margin, results.originX, results.originY, results.referenceCoordinates, results.arrowTop, results.arrowLeft, arrowHeight);
27558
+ const { originX, originY, top, left, bottom, checkSafeAreaTop, checkSafeAreaBottom, checkSafeAreaLeft, checkSafeAreaRight, arrowTop, arrowLeft, addPopoverBottomClass, } = calculateWindowAdjustment(side, results.top, results.left, padding, bodyWidth, bodyHeight, contentWidth, contentHeight, margin, results.originX, results.originY, results.referenceCoordinates, results.arrowTop, results.arrowLeft, arrowHeight);
27431
27559
  const baseAnimation = createAnimation();
27432
27560
  const backdropAnimation = createAnimation();
27433
27561
  const contentAnimation = createAnimation();
@@ -27457,19 +27585,35 @@ const iosEnterAnimation$1 = (baseEl, opts) => {
27457
27585
  if (addPopoverBottomClass) {
27458
27586
  baseEl.classList.add('popover-bottom');
27459
27587
  }
27460
- if (bottom !== undefined) {
27461
- contentEl.style.setProperty('bottom', `${bottom}px`);
27462
- }
27588
+ /**
27589
+ * Safe area CSS variable adjustments.
27590
+ * When the popover is positioned near an edge, we add the corresponding
27591
+ * safe-area inset to ensure the popover doesn't overlap with system UI
27592
+ * (status bars, home indicators, navigation bars on Android API 36+, etc.)
27593
+ */
27594
+ const safeAreaTop = ' + var(--ion-safe-area-top, 0)';
27595
+ const safeAreaBottom = ' + var(--ion-safe-area-bottom, 0)';
27463
27596
  const safeAreaLeft = ' + var(--ion-safe-area-left, 0)';
27464
27597
  const safeAreaRight = ' - var(--ion-safe-area-right, 0)';
27598
+ let topValue = `${top}px`;
27599
+ let bottomValue = bottom !== undefined ? `${bottom}px` : undefined;
27465
27600
  let leftValue = `${left}px`;
27601
+ if (checkSafeAreaTop) {
27602
+ topValue = `${top}px${safeAreaTop}`;
27603
+ }
27604
+ if (checkSafeAreaBottom && bottomValue !== undefined) {
27605
+ bottomValue = `${bottom}px${safeAreaBottom}`;
27606
+ }
27466
27607
  if (checkSafeAreaLeft) {
27467
27608
  leftValue = `${left}px${safeAreaLeft}`;
27468
27609
  }
27469
27610
  if (checkSafeAreaRight) {
27470
27611
  leftValue = `${left}px${safeAreaRight}`;
27471
27612
  }
27472
- contentEl.style.setProperty('top', `calc(${top}px + var(--offset-y, 0))`);
27613
+ if (bottomValue !== undefined) {
27614
+ contentEl.style.setProperty('bottom', `calc(${bottomValue})`);
27615
+ }
27616
+ contentEl.style.setProperty('top', `calc(${topValue} + var(--offset-y, 0))`);
27473
27617
  contentEl.style.setProperty('left', `calc(${leftValue} + var(--offset-x, 0))`);
27474
27618
  contentEl.style.setProperty('transform-origin', `${originY} ${originX}`);
27475
27619
  if (arrowEl !== null) {
@@ -27545,7 +27689,23 @@ const mdEnterAnimation$1 = (baseEl, opts) => {
27545
27689
  };
27546
27690
  const results = getPopoverPosition(isRTL, contentWidth, contentHeight, 0, 0, reference, side, align, defaultPosition, trigger, ev);
27547
27691
  const padding = size === 'cover' ? 0 : POPOVER_MD_BODY_PADDING;
27548
- const { originX, originY, top, left, bottom } = calculateWindowAdjustment(side, results.top, results.left, padding, bodyWidth, bodyHeight, contentWidth, contentHeight, 0, results.originX, results.originY, results.referenceCoordinates);
27692
+ const { originX, originY, top, left, bottom, checkSafeAreaTop, checkSafeAreaBottom } = calculateWindowAdjustment(side, results.top, results.left, padding, bodyWidth, bodyHeight, contentWidth, contentHeight, 0, results.originX, results.originY, results.referenceCoordinates);
27693
+ /**
27694
+ * Safe area CSS variable adjustments.
27695
+ * When the popover is positioned near an edge, we add the corresponding
27696
+ * safe-area inset to ensure the popover doesn't overlap with system UI
27697
+ * (status bars, home indicators, navigation bars on Android API 36+, etc.)
27698
+ */
27699
+ const safeAreaTop = ' + var(--ion-safe-area-top, 0)';
27700
+ const safeAreaBottom = ' + var(--ion-safe-area-bottom, 0)';
27701
+ let topValue = `${top}px`;
27702
+ let bottomValue = bottom !== undefined ? `${bottom}px` : undefined;
27703
+ if (checkSafeAreaTop) {
27704
+ topValue = `${top}px${safeAreaTop}`;
27705
+ }
27706
+ if (checkSafeAreaBottom && bottomValue !== undefined) {
27707
+ bottomValue = `${bottom}px${safeAreaBottom}`;
27708
+ }
27549
27709
  const baseAnimation = createAnimation();
27550
27710
  const backdropAnimation = createAnimation();
27551
27711
  const wrapperAnimation = createAnimation();
@@ -27562,13 +27722,13 @@ const mdEnterAnimation$1 = (baseEl, opts) => {
27562
27722
  contentAnimation
27563
27723
  .addElement(contentEl)
27564
27724
  .beforeStyles({
27565
- top: `calc(${top}px + var(--offset-y, 0px))`,
27725
+ top: `calc(${topValue} + var(--offset-y, 0px))`,
27566
27726
  left: `calc(${left}px + var(--offset-x, 0px))`,
27567
27727
  'transform-origin': `${originY} ${originX}`,
27568
27728
  })
27569
27729
  .beforeAddWrite(() => {
27570
- if (bottom !== undefined) {
27571
- contentEl.style.setProperty('bottom', `${bottom}px`);
27730
+ if (bottomValue !== undefined) {
27731
+ contentEl.style.setProperty('bottom', `calc(${bottomValue})`);
27572
27732
  }
27573
27733
  })
27574
27734
  .fromTo('transform', 'scale(0.8)', 'scale(1)');