mn-angular-lib 1.0.138 → 1.0.139
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.
|
@@ -10548,6 +10548,20 @@ class MnTabComponent {
|
|
|
10548
10548
|
indicator;
|
|
10549
10549
|
/** Pending indicator remeasure, cancelled on destroy so a post-destroy frame can't read a detached ref. */
|
|
10550
10550
|
indicatorFrame;
|
|
10551
|
+
/**
|
|
10552
|
+
* True while a click-initiated slide is animating. The active tab's
|
|
10553
|
+
* `font-bold` widens the row, which fires {@link resizeObserver}; without
|
|
10554
|
+
* this guard the observer's snap ({@link updateIndicator} with `animate:
|
|
10555
|
+
* false`) would land the indicator at its target the same frame the slide
|
|
10556
|
+
* starts, so the transition never paints. Set synchronously in
|
|
10557
|
+
* {@link setActive} — before the frame runs — so the guard doesn't depend on
|
|
10558
|
+
* rAF-vs-ResizeObserver callback ordering.
|
|
10559
|
+
*/
|
|
10560
|
+
sliding = false;
|
|
10561
|
+
/** Clears {@link sliding} after the slide finishes; re-armed per click, cancelled on destroy. */
|
|
10562
|
+
slidingTimer;
|
|
10563
|
+
/** Slide duration in ms; matches the indicator's `duration-300` transition. */
|
|
10564
|
+
static SLIDE_MS = 300;
|
|
10551
10565
|
/** How far the fade reaches in from each overflowing edge. */
|
|
10552
10566
|
static FADE = '2rem';
|
|
10553
10567
|
/** Data source containing tab items and default active index. */
|
|
@@ -10615,7 +10629,10 @@ class MnTabComponent {
|
|
|
10615
10629
|
this.updateEdgeFades();
|
|
10616
10630
|
// Tabs may have reflowed (viewport change, justified widths); snap the
|
|
10617
10631
|
// indicator to the new geometry — animating a resize tick reads as jank.
|
|
10618
|
-
|
|
10632
|
+
// But skip the snap mid-slide: a click's own `font-bold` resizes the row
|
|
10633
|
+
// and fires this observer, and snapping there kills the slide it triggered.
|
|
10634
|
+
if (!this.sliding)
|
|
10635
|
+
this.updateIndicator(false);
|
|
10619
10636
|
});
|
|
10620
10637
|
this.resizeObserver.observe(el);
|
|
10621
10638
|
if (el.firstElementChild)
|
|
@@ -10628,6 +10645,8 @@ class MnTabComponent {
|
|
|
10628
10645
|
this.resizeObserver?.disconnect();
|
|
10629
10646
|
if (this.indicatorFrame !== undefined)
|
|
10630
10647
|
cancelAnimationFrame(this.indicatorFrame);
|
|
10648
|
+
if (this.slidingTimer !== undefined)
|
|
10649
|
+
clearTimeout(this.slidingTimer);
|
|
10631
10650
|
}
|
|
10632
10651
|
/**
|
|
10633
10652
|
* Paints a fade over whichever edge has tabs scrolled out of view — a soft
|
|
@@ -10669,9 +10688,25 @@ class MnTabComponent {
|
|
|
10669
10688
|
this.activeChange.emit(item);
|
|
10670
10689
|
// Slide the underline to the new tab. Measure on the next frame, after
|
|
10671
10690
|
// change detection has applied the active tab's `font-bold` (which widens
|
|
10672
|
-
// it) so the indicator lands on the final, bolded geometry.
|
|
10691
|
+
// it) so the indicator lands on the final, bolded geometry. Guard the slide
|
|
10692
|
+
// against the resize snap the same `font-bold` triggers (see {@link sliding}).
|
|
10693
|
+
this.beginSlide();
|
|
10673
10694
|
this.scheduleIndicator(true);
|
|
10674
10695
|
}
|
|
10696
|
+
/**
|
|
10697
|
+
* Marks a click-driven slide as in progress and schedules the guard to lift
|
|
10698
|
+
* once the transition has finished. A timeout (not `transitionend`) so the
|
|
10699
|
+
* flag still clears under `motion-reduce`, where no transition event fires.
|
|
10700
|
+
*/
|
|
10701
|
+
beginSlide() {
|
|
10702
|
+
this.sliding = true;
|
|
10703
|
+
if (this.slidingTimer !== undefined)
|
|
10704
|
+
clearTimeout(this.slidingTimer);
|
|
10705
|
+
this.slidingTimer = setTimeout(() => {
|
|
10706
|
+
this.slidingTimer = undefined;
|
|
10707
|
+
this.sliding = false;
|
|
10708
|
+
}, MnTabComponent.SLIDE_MS);
|
|
10709
|
+
}
|
|
10675
10710
|
/**
|
|
10676
10711
|
* Moves the shared underline to the active tab. When `animate` is false the
|
|
10677
10712
|
* move is snapped (no slide) by disabling the transition for one reflow —
|