mn-angular-lib 1.0.78 → 1.0.79

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mn-angular-lib",
3
- "version": "1.0.78",
3
+ "version": "1.0.79",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.1.3",
6
6
  "@angular/core": "^21.1.3"
@@ -1,4 +1,9 @@
1
1
  :host {
2
+ /* Native-feeling sheet curve (iOS-style decelerate, no out-of-bounds overshoot
3
+ which would expose a gap below a bottom-anchored sheet). Shared by the
4
+ slide keyframes, the drag spring-back, and the swipe-dismiss glide. */
5
+ --mn-sheet-ease: cubic-bezier(0.32, 0.72, 0, 1);
6
+
2
7
  position: fixed;
3
8
  inset: 0;
4
9
  z-index: 1000;
@@ -17,7 +22,7 @@
17
22
 
18
23
  /* Swipe-to-dismiss: animate the spring-back, but follow the finger 1:1 while dragging. */
19
24
  .modal-container {
20
- transition: transform 0.2s ease;
25
+ transition: transform 0.35s var(--mn-sheet-ease);
21
26
  }
22
27
 
23
28
  .modal-container.sheet-dragging {
@@ -30,7 +35,7 @@
30
35
  :host(.swipe-dismissing) .modal-container,
31
36
  :host(.swipe-dismissing).closing .modal-container {
32
37
  animation: none !important;
33
- transition: transform 0.2s ease-in;
38
+ transition: transform 0.3s var(--mn-sheet-ease);
34
39
  }
35
40
 
36
41
  @keyframes fadeIn {
@@ -130,20 +135,35 @@
130
135
  max-width: 100%;
131
136
  max-height: 92vh;
132
137
  border-radius: 1rem 1rem 0 0;
133
- animation: slideUpIn 0.25s ease-out;
138
+ animation: slideUpIn 0.35s var(--mn-sheet-ease);
134
139
  }
135
140
 
136
141
  /* Override whichever anim-* open animation was selected */
137
142
  :host(.mobile-sheet).anim-slide .modal-container,
138
143
  :host(.mobile-sheet).anim-fade .modal-container,
139
144
  :host(.mobile-sheet).anim-zoom .modal-container {
140
- animation: slideUpIn 0.25s ease-out;
145
+ animation: slideUpIn 0.35s var(--mn-sheet-ease);
141
146
  }
142
147
 
143
148
  :host(.mobile-sheet).closing .modal-container,
144
149
  :host(.mobile-sheet).closing.anim-slide .modal-container,
145
150
  :host(.mobile-sheet).closing.anim-fade .modal-container,
146
151
  :host(.mobile-sheet).closing.anim-zoom .modal-container {
147
- animation: slideUpOut 0.2s ease-in forwards;
152
+ animation: slideUpOut 0.25s var(--mn-sheet-ease) forwards;
153
+ }
154
+ }
155
+
156
+ /* =========================
157
+ Reduced motion: collapse every open/close/drag animation to ~instant.
158
+ Kept at 0.01ms (not `none`) so animationend still fires for the
159
+ event-driven close teardown in the shell component. The shell also
160
+ short-circuits its close wait when reduced motion is requested.
161
+ ========================= */
162
+ @media (prefers-reduced-motion: reduce) {
163
+ :host .modal-backdrop,
164
+ :host .modal-container {
165
+ animation-duration: 0.01ms !important;
166
+ animation-delay: 0ms !important;
167
+ transition-duration: 0.01ms !important;
148
168
  }
149
169
  }
@@ -3745,10 +3745,24 @@ declare class MnModalShellComponent<TResult = unknown> implements OnInit, AfterV
3745
3745
  asConfirmation(config: ModalConfig<TResult>): ConfirmationModalConfig;
3746
3746
  asCustom(config: ModalConfig<TResult>): CustomModalConfig;
3747
3747
  private static readonly SWIPE_DISMISS_THRESHOLD;
3748
+ /** Upper bound for the close wait if no animation/transition end event fires
3749
+ * (e.g. an animation was suppressed). Longer than the slowest close path
3750
+ * (mobile slide-down 0.25s, swipe glide 0.3s) so it never preempts. */
3751
+ private static readonly CLOSE_FALLBACK_MS;
3748
3752
  /** Whether this modal renders as a bottom sheet on small screens (default: true). */
3749
3753
  get isMobileSheet(): boolean;
3750
- /** Triggers the closing animation. Deferred to avoid NG0100 when called during a CD cycle. */
3754
+ /**
3755
+ * Triggers the closing animation and resolves once it has actually finished.
3756
+ *
3757
+ * Deferred via setTimeout to avoid NG0100 when called during a CD cycle.
3758
+ * Rather than guess a fixed duration (the old hardcoded 150ms truncated the
3759
+ * mobile slide-down, which runs 250ms — and the swipe glide, 300ms), we wait
3760
+ * for the container's `animationend`/`transitionend` and tear down then. A
3761
+ * fallback timeout guarantees resolution if no such event fires, and we
3762
+ * short-circuit entirely under reduced motion (the CSS collapses to instant).
3763
+ */
3751
3764
  startClosing(): Promise<void>;
3765
+ private prefersReducedMotion;
3752
3766
  onEscapeKey(event: Event): void;
3753
3767
  onBackdropClick(): void;
3754
3768
  onCloseButtonClick(): void;