@ibragim-dev-org/ui-forge-library 1.4.74 → 1.4.76

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.
@@ -1,11 +1,10 @@
1
1
  import * as i2 from '@angular/router';
2
2
  import { NavigationEnd, NavigationStart, ActivationEnd } from '@angular/router';
3
- import { BehaviorSubject, filter, take, scheduled, fromEvent, asyncScheduler, mergeAll, tap, debounceTime, Subject, Subscription, timer, switchMap, interval, takeWhile, finalize, ReplaySubject, takeUntil as takeUntil$1 } from 'rxjs';
3
+ import { BehaviorSubject, filter, take, scheduled, fromEvent, asyncScheduler, mergeAll, tap, debounceTime, Subject, takeUntil, throttleTime, Subscription, timer, switchMap, interval, takeWhile, finalize, ReplaySubject } from 'rxjs';
4
4
  import * as i0 from '@angular/core';
5
- import { model, effect, Directive, Injectable, output, Input, input, PLATFORM_ID, Inject, EventEmitter, Output, signal, inject, Pipe, Attribute, ChangeDetectionStrategy, Component, computed, viewChild, untracked, Injector, afterRenderEffect, contentChildren, contentChild, ViewChildren } from '@angular/core';
5
+ import { model, effect, Directive, Injectable, output, Input, input, PLATFORM_ID, Inject, EventEmitter, Output, signal, inject, ElementRef, NgZone, Pipe, Attribute, ChangeDetectionStrategy, Component, computed, viewChild, untracked, Injector, afterRenderEffect, contentChildren, contentChild, ViewChildren } from '@angular/core';
6
6
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
7
7
  import { isPlatformBrowser, DOCUMENT, NgStyle } from '@angular/common';
8
- import { throttleTime, tap as tap$1, takeUntil, debounceTime as debounceTime$1 } from 'rxjs/operators';
9
8
  import { ulid } from 'ulid';
10
9
  import * as i1 from '@angular/cdk/overlay';
11
10
  import { OverlayConfig, FlexibleConnectedPositionStrategy } from '@angular/cdk/overlay';
@@ -869,32 +868,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
869
868
  args: [PLATFORM_ID]
870
869
  }] }], propDecorators: { sizeChange: [{ type: i0.Output, args: ["sizeChange"] }] } });
871
870
 
871
+ const ANCHOR_CLASS = 'ui-forge-anchor';
872
+ const EDGE_PIN_PX = 2;
873
+ // Drop-in replacement for ui-forge-library's StableScrollDirective (same inputs, outputs and API).
874
+ // Keeps the topmost visible `.ui-forge-anchor` child in place while content above it is added, removed or resized,
875
+ // like native scroll anchoring - which is switched off on the host so the browser doesn't correct a second time.
872
876
  class StableScrollDirective {
873
- el;
874
- platformId = inject(PLATFORM_ID);
875
- isBrowser = isPlatformBrowser(this.platformId);
876
- destroy$ = new Subject();
877
- scrolling$ = new Subject();
878
- _isScrolling = false;
879
- mutationObserver;
880
- restoreFrameId = null;
881
- restoreMicrotaskPending = false;
882
- // Restoration only runs after captureBeforeChange(); otherwise the element scrolls natively.
883
- restoreArmed = false;
884
- // ---- thresholds ----
885
877
  $topThreshold = input(0, ...(ngDevMode ? [{ debugName: "$topThreshold" }] : []));
886
878
  $bottomThreshold = input(0, ...(ngDevMode ? [{ debugName: "$bottomThreshold" }] : []));
887
879
  reachedTop = output();
888
880
  reachedBottom = output();
889
- // ---- anchor ----
890
- anchorSnapshot = null;
891
- // ---- direction tracking ----
881
+ el = inject(ElementRef).nativeElement;
882
+ zone = inject(NgZone);
883
+ isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
884
+ destroy$ = new Subject();
885
+ scrolling$ = new Subject();
886
+ mutationObserver;
887
+ resizeObserver;
888
+ anchor = null;
892
889
  lastScrollTop = 0;
893
- scrollingUp = false;
894
- scrollingDown = false;
895
- constructor(elRef) {
896
- this.el = elRef.nativeElement;
897
- }
890
+ wasPinnedToTop = false;
891
+ wasPinnedToBottom = false;
892
+ restoreArmed = false;
893
+ disarmFrameId = null;
894
+ _isScrolling = false;
898
895
  get scrolling() {
899
896
  return this._isScrolling;
900
897
  }
@@ -903,29 +900,31 @@ class StableScrollDirective {
903
900
  return;
904
901
  }
905
902
  this.lastScrollTop = this.el.scrollTop;
906
- this.refreshAnchorSnapshot();
907
- this.observeContentChanges();
908
- fromEvent(this.el, 'scroll')
909
- .pipe(throttleTime(50), tap$1(() => {
910
- const { scrollTop } = this.el;
911
- // detect direction
912
- this.scrollingUp = scrollTop < this.lastScrollTop;
913
- this.scrollingDown = scrollTop > this.lastScrollTop;
914
- this.lastScrollTop = scrollTop;
915
- this._isScrolling = true;
916
- this.scrolling$.next();
917
- this.checkThresholds();
918
- this.refreshAnchorSnapshot();
919
- }), takeUntil(this.destroy$))
920
- .subscribe();
921
- this.scrolling$
922
- .pipe(debounceTime$1(120), tap$1(() => (this._isScrolling = false)), takeUntil(this.destroy$))
923
- .subscribe();
903
+ this.refreshAnchor();
904
+ // Scroll handling stays outside Angular; only the threshold outputs re-enter the zone
905
+ this.zone.runOutsideAngular(() => {
906
+ this.observeContent();
907
+ const scroll$ = fromEvent(this.el, 'scroll', { passive: true });
908
+ // Every scroll event, so the anchor is always the element actually on screen
909
+ scroll$.pipe(takeUntil(this.destroy$)).subscribe(() => {
910
+ this._isScrolling = true;
911
+ this.scrolling$.next();
912
+ this.refreshAnchor();
913
+ });
914
+ // Trailing edge too, otherwise the final position of a scroll is never checked
915
+ scroll$
916
+ .pipe(throttleTime(50, asyncScheduler, { leading: true, trailing: true }), tap(() => this.checkThresholds()), takeUntil(this.destroy$))
917
+ .subscribe();
918
+ this.scrolling$
919
+ .pipe(debounceTime(120), tap(() => (this._isScrolling = false)), takeUntil(this.destroy$))
920
+ .subscribe();
921
+ });
924
922
  }
925
923
  ngOnDestroy() {
926
924
  this.mutationObserver?.disconnect();
927
- if (this.restoreFrameId !== null && this.isBrowser) {
928
- cancelAnimationFrame(this.restoreFrameId);
925
+ this.resizeObserver?.disconnect();
926
+ if (this.disarmFrameId !== null && this.isBrowser) {
927
+ cancelAnimationFrame(this.disarmFrameId);
929
928
  }
930
929
  this.destroy$.next();
931
930
  this.destroy$.complete();
@@ -933,134 +932,146 @@ class StableScrollDirective {
933
932
  /** Call BEFORE data changes */
934
933
  captureBeforeChange() {
935
934
  this.restoreArmed = true;
936
- this.refreshAnchorSnapshot();
935
+ this.refreshAnchor();
937
936
  }
938
937
  /** Call AFTER render */
939
938
  restoreScrollPosition() {
940
- this.scheduleRestore();
939
+ this.compensate();
941
940
  }
942
- // ---- threshold logic ----
943
941
  checkThresholds() {
944
942
  const { scrollTop, scrollHeight, clientHeight } = this.el;
943
+ const movedUp = scrollTop < this.lastScrollTop;
944
+ const movedDown = scrollTop > this.lastScrollTop;
945
+ this.lastScrollTop = scrollTop;
945
946
  const topThreshold = this.$topThreshold();
946
947
  const topPx = topThreshold <= 1 ? scrollHeight * topThreshold : topThreshold;
947
948
  const bottomThreshold = this.$bottomThreshold();
948
949
  const bottomPx = bottomThreshold <= 1 ? scrollHeight * bottomThreshold : bottomThreshold;
949
- // emit top ONLY when scrolling UP
950
- if (this.scrollingUp && scrollTop <= topPx) {
951
- this.reachedTop.emit();
950
+ if (movedUp && scrollTop <= topPx) {
951
+ this.zone.run(() => this.reachedTop.emit());
952
952
  }
953
- // emit bottom ONLY when scrolling DOWN
954
- if (this.scrollingDown && scrollTop + clientHeight >= scrollHeight - bottomPx) {
955
- this.reachedBottom.emit();
953
+ if (movedDown && scrollTop + clientHeight >= scrollHeight - bottomPx) {
954
+ this.zone.run(() => this.reachedBottom.emit());
956
955
  }
957
956
  }
958
- observeContentChanges() {
957
+ observeContent() {
958
+ if (typeof ResizeObserver !== 'undefined') {
959
+ // Media loading or a message re-rendering above the viewport changes heights without adding nodes
960
+ this.resizeObserver = new ResizeObserver(() => this.compensate());
961
+ Array.from(this.el.children).forEach((child) => this.resizeObserver.observe(child));
962
+ }
959
963
  if (typeof MutationObserver === 'undefined') {
960
964
  return;
961
965
  }
962
966
  this.mutationObserver = new MutationObserver((mutations) => {
963
- if (!mutations.some((mutation) => mutation.addedNodes.length || mutation.removedNodes.length)) {
967
+ let hasListChange = false;
968
+ for (const mutation of mutations) {
969
+ mutation.addedNodes.forEach((node) => {
970
+ if (node instanceof Element) {
971
+ hasListChange = true;
972
+ this.resizeObserver?.observe(node);
973
+ }
974
+ });
975
+ mutation.removedNodes.forEach((node) => {
976
+ if (node instanceof Element) {
977
+ hasListChange = true;
978
+ this.resizeObserver?.unobserve(node);
979
+ }
980
+ });
981
+ }
982
+ if (!hasListChange) {
964
983
  return;
965
984
  }
966
- if (!this.restoreArmed) {
967
- this.refreshAnchorSnapshot();
985
+ // Unrequested changes at an edge show up rather than being held off-screen: a new message at the bottom
986
+ // (the host scrolls to it) or a chat moving to the top of a list
987
+ if (!this.restoreArmed && (this.wasPinnedToTop || this.wasPinnedToBottom)) {
988
+ this.refreshAnchor();
968
989
  return;
969
990
  }
970
- this.scheduleRestore();
971
- });
972
- this.mutationObserver.observe(this.el, {
973
- childList: true,
991
+ this.compensate();
992
+ this.scheduleDisarm();
974
993
  });
994
+ this.mutationObserver.observe(this.el, { childList: true });
975
995
  }
976
- scheduleRestore() {
977
- if (!this.isBrowser || this.restoreMicrotaskPending) {
996
+ // Scrolls by exactly how far the anchor moved within the content, then re-anchors
997
+ compensate() {
998
+ const anchor = this.anchor;
999
+ if (!anchor || !anchor.element.isConnected || anchor.element.parentElement !== this.el) {
1000
+ this.refreshAnchor();
978
1001
  return;
979
1002
  }
980
- this.restoreMicrotaskPending = true;
981
- queueMicrotask(() => {
982
- this.restoreMicrotaskPending = false;
983
- this.restoreFromSnapshot();
984
- this.scheduleAnimationFrameRestore();
985
- });
986
- }
987
- restoreFromSnapshot() {
988
- if (!this.anchorSnapshot) {
989
- return;
1003
+ const shift = this.contentTopOf(anchor.element) - anchor.contentTop;
1004
+ if (Math.abs(shift) >= 0.5) {
1005
+ this.el.scrollTop += shift;
1006
+ // The browser coalesces this into the next scroll event; shifting the baseline keeps it from reading as
1007
+ // the user scrolling the other way, which would fire the opposite threshold
1008
+ this.lastScrollTop += shift;
990
1009
  }
991
- const { element, topOffset } = this.anchorSnapshot;
992
- if (!element.isConnected || element.parentElement !== this.el) {
993
- this.anchorSnapshot = null;
994
- return;
995
- }
996
- const containerTop = this.el.getBoundingClientRect().top;
997
- const nextTopOffset = element.getBoundingClientRect().top - containerTop;
998
- const delta = nextTopOffset - topOffset;
999
- if (delta !== 0) {
1000
- this.el.scrollTop += delta;
1001
- }
1002
- this.lastScrollTop = this.el.scrollTop;
1003
- this.refreshAnchorSnapshot();
1010
+ this.refreshAnchor();
1004
1011
  }
1005
- scheduleAnimationFrameRestore() {
1006
- if (!this.isBrowser) {
1012
+ scheduleDisarm() {
1013
+ if (!this.restoreArmed) {
1007
1014
  return;
1008
1015
  }
1009
- if (this.restoreFrameId !== null) {
1010
- cancelAnimationFrame(this.restoreFrameId);
1016
+ if (this.disarmFrameId !== null) {
1017
+ cancelAnimationFrame(this.disarmFrameId);
1011
1018
  }
1012
- this.restoreFrameId = requestAnimationFrame(() => {
1013
- this.restoreFrameId = null;
1014
- this.restoreFromSnapshot();
1019
+ this.disarmFrameId = requestAnimationFrame(() => {
1020
+ this.disarmFrameId = null;
1021
+ this.compensate();
1015
1022
  this.restoreArmed = false;
1016
1023
  });
1017
1024
  }
1018
- refreshAnchorSnapshot() {
1019
- const anchor = this.resolveAnchorElement();
1020
- if (!anchor) {
1021
- this.anchorSnapshot = null;
1022
- return;
1023
- }
1024
- const containerTop = this.el.getBoundingClientRect().top;
1025
- const topOffset = anchor.getBoundingClientRect().top - containerTop;
1026
- this.anchorSnapshot = {
1027
- element: anchor,
1028
- topOffset,
1029
- };
1030
- }
1031
- resolveAnchorElement() {
1032
- const containerRect = this.el.getBoundingClientRect();
1033
- const candidates = this.resolveAnchorCandidates();
1025
+ refreshAnchor() {
1026
+ const { scrollTop, scrollHeight, clientHeight } = this.el;
1027
+ this.wasPinnedToTop = scrollTop <= EDGE_PIN_PX;
1028
+ this.wasPinnedToBottom = scrollHeight - clientHeight - scrollTop <= EDGE_PIN_PX;
1029
+ const element = this.findTopVisibleCandidate();
1030
+ this.anchor = element ? { element, contentTop: this.contentTopOf(element) } : null;
1031
+ }
1032
+ // Candidates are in document order, so the first one reaching into the viewport is found by binary search
1033
+ findTopVisibleCandidate() {
1034
+ const candidates = this.getCandidates();
1034
1035
  if (!candidates.length) {
1035
1036
  return null;
1036
1037
  }
1037
- const visibleCandidate = candidates.find((candidate) => {
1038
- const rect = candidate.getBoundingClientRect();
1039
- return rect.bottom > containerRect.top && rect.top < containerRect.bottom;
1040
- });
1041
- if (visibleCandidate) {
1042
- return visibleCandidate;
1038
+ const viewportTop = this.el.getBoundingClientRect().top;
1039
+ let low = 0;
1040
+ let high = candidates.length - 1;
1041
+ let found = candidates.length - 1;
1042
+ while (low <= high) {
1043
+ const middle = (low + high) >> 1;
1044
+ if (candidates[middle].getBoundingClientRect().bottom > viewportTop) {
1045
+ found = middle;
1046
+ high = middle - 1;
1047
+ }
1048
+ else {
1049
+ low = middle + 1;
1050
+ }
1043
1051
  }
1044
- return candidates.reduce((closest, candidate) => {
1045
- const closestDistance = Math.abs(closest.getBoundingClientRect().top - containerRect.top);
1046
- const candidateDistance = Math.abs(candidate.getBoundingClientRect().top - containerRect.top);
1047
- return candidateDistance < closestDistance ? candidate : closest;
1048
- });
1052
+ return candidates[found];
1049
1053
  }
1050
- resolveAnchorCandidates() {
1054
+ getCandidates() {
1051
1055
  const children = Array.from(this.el.children);
1052
- const anchor = children.filter((child) => child.classList.contains('ui-forge-anchor'));
1053
- return anchor.length ? anchor : children;
1056
+ const anchors = children.filter((child) => child.classList.contains(ANCHOR_CLASS));
1057
+ return anchors.length ? anchors : children;
1058
+ }
1059
+ contentTopOf(element) {
1060
+ return element.getBoundingClientRect().top - this.el.getBoundingClientRect().top + this.el.scrollTop;
1054
1061
  }
1055
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: StableScrollDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1056
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.1", type: StableScrollDirective, isStandalone: true, selector: "[stableScroll]", inputs: { $topThreshold: { classPropertyName: "$topThreshold", publicName: "$topThreshold", isSignal: true, isRequired: false, transformFunction: null }, $bottomThreshold: { classPropertyName: "$bottomThreshold", publicName: "$bottomThreshold", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { reachedTop: "reachedTop", reachedBottom: "reachedBottom" }, ngImport: i0 });
1062
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: StableScrollDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1063
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.1", type: StableScrollDirective, isStandalone: true, selector: "[stableScroll]", inputs: { $topThreshold: { classPropertyName: "$topThreshold", publicName: "$topThreshold", isSignal: true, isRequired: false, transformFunction: null }, $bottomThreshold: { classPropertyName: "$bottomThreshold", publicName: "$bottomThreshold", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { reachedTop: "reachedTop", reachedBottom: "reachedBottom" }, host: { properties: { "style.overflow-anchor": "\"none\"" } }, ngImport: i0 });
1057
1064
  }
1058
1065
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: StableScrollDirective, decorators: [{
1059
1066
  type: Directive,
1060
1067
  args: [{
1061
1068
  selector: '[stableScroll]',
1069
+ standalone: true,
1070
+ host: {
1071
+ '[style.overflow-anchor]': '"none"',
1072
+ },
1062
1073
  }]
1063
- }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { $topThreshold: [{ type: i0.Input, args: [{ isSignal: true, alias: "$topThreshold", required: false }] }], $bottomThreshold: [{ type: i0.Input, args: [{ isSignal: true, alias: "$bottomThreshold", required: false }] }], reachedTop: [{ type: i0.Output, args: ["reachedTop"] }], reachedBottom: [{ type: i0.Output, args: ["reachedBottom"] }] } });
1074
+ }], propDecorators: { $topThreshold: [{ type: i0.Input, args: [{ isSignal: true, alias: "$topThreshold", required: false }] }], $bottomThreshold: [{ type: i0.Input, args: [{ isSignal: true, alias: "$bottomThreshold", required: false }] }], reachedTop: [{ type: i0.Output, args: ["reachedTop"] }], reachedBottom: [{ type: i0.Output, args: ["reachedBottom"] }] } });
1064
1075
 
1065
1076
  class CenterEllipsisPipe {
1066
1077
  transform(value, visibleStart = 4, visibleEnd = 4) {
@@ -1554,6 +1565,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
1554
1565
  args: [PLATFORM_ID]
1555
1566
  }] }], propDecorators: { $isOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "$isOpen", required: false }] }, { type: i0.Output, args: ["$isOpenChange"] }], $durationMs: [{ type: i0.Input, args: [{ isSignal: true, alias: "$durationMs", required: false }] }], $content: [{ type: i0.ViewChild, args: ['container', { isSignal: true }] }], $button: [{ type: i0.ViewChild, args: ['buttonContainer', { isSignal: true }] }] } });
1556
1567
 
1568
+ /**
1569
+ * OverlayStackService
1570
+ * Hands out increasing z-index values so the most recently shown overlay (alert or dropdown)
1571
+ * always renders above the ones shown before it. Starts above the CDK default (1000) used by popups.
1572
+ */
1573
+ class OverlayStackService {
1574
+ zIndex = 1000;
1575
+ next() {
1576
+ return String(++this.zIndex);
1577
+ }
1578
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: OverlayStackService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1579
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: OverlayStackService, providedIn: 'root' });
1580
+ }
1581
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: OverlayStackService, decorators: [{
1582
+ type: Injectable,
1583
+ args: [{ providedIn: 'root' }]
1584
+ }] });
1585
+
1557
1586
  var AlertType;
1558
1587
  (function (AlertType) {
1559
1588
  AlertType["SUCCESS"] = "success";
@@ -1598,10 +1627,14 @@ class UiAlertMessagesOverlayService {
1598
1627
  positionStrategy: strategy,
1599
1628
  });
1600
1629
  this.overlayRef = this.overlay.create(config);
1601
- this.overlayRef.hostElement.style.zIndex = '1001';
1602
1630
  this.overlayRef.attach(new ComponentPortal(this.component));
1603
1631
  this.isAttached = true;
1604
1632
  }
1633
+ setZIndex(zIndex) {
1634
+ if (this.overlayRef) {
1635
+ this.overlayRef.hostElement.style.zIndex = zIndex;
1636
+ }
1637
+ }
1605
1638
  init(component) {
1606
1639
  this.component = component;
1607
1640
  }
@@ -1630,6 +1663,7 @@ class UiAlertMessagesService {
1630
1663
  overlayRef;
1631
1664
  timerSubscriptions = new Map();
1632
1665
  timerState = new Map();
1666
+ overlayStackService = inject(OverlayStackService);
1633
1667
  constructor(uiAlertMessagesOverlayService, router) {
1634
1668
  this.uiAlertMessagesOverlayService = uiAlertMessagesOverlayService;
1635
1669
  this.router = router;
@@ -1725,6 +1759,7 @@ class UiAlertMessagesService {
1725
1759
  if (!this.$alerts().length) {
1726
1760
  this.uiAlertMessagesOverlayService.attachComponent();
1727
1761
  }
1762
+ this.uiAlertMessagesOverlayService.setZIndex(this.overlayStackService.next());
1728
1763
  this.router.events
1729
1764
  .pipe(filter((v) => v instanceof NavigationEnd), tap(() => {
1730
1765
  this.removeAll();
@@ -2469,11 +2504,11 @@ class UiModal {
2469
2504
  this.destroyOutsideClickSubscription$.next();
2470
2505
  if (isBrowser()) {
2471
2506
  fromEvent(window, 'scroll')
2472
- .pipe(tap(() => this.closeAll()), takeUntil$1(this.destroyOutsideClickSubscription$))
2507
+ .pipe(tap(() => this.closeAll()), takeUntil(this.destroyOutsideClickSubscription$))
2473
2508
  .subscribe();
2474
2509
  }
2475
2510
  this.router.events
2476
- .pipe(debounceTime(100), tap(() => this.closeAll()), takeUntil$1(this.destroyOutsideClickSubscription$))
2511
+ .pipe(debounceTime(100), tap(() => this.closeAll()), takeUntil(this.destroyOutsideClickSubscription$))
2477
2512
  .subscribe();
2478
2513
  }
2479
2514
  destroy() {
@@ -2621,7 +2656,7 @@ class UiPopupContainerDirective {
2621
2656
  if (!this.popupInstance.isClosing) {
2622
2657
  this.$isShow.set(true);
2623
2658
  }
2624
- }), takeUntil$1(this.destroyAnimationOrigin$), takeUntilDestroyed(this.destroyRef))
2659
+ }), takeUntil(this.destroyAnimationOrigin$), takeUntilDestroyed(this.destroyRef))
2625
2660
  .subscribe();
2626
2661
  if (isBrowser()) {
2627
2662
  fromEvent(window, 'keydown')
@@ -3074,6 +3109,7 @@ class UiDropdownService extends UiModal {
3074
3109
  width: 0,
3075
3110
  height: 0,
3076
3111
  });
3112
+ overlayStackService = inject(OverlayStackService);
3077
3113
  connectedPositions = {
3078
3114
  bottom: {
3079
3115
  animationOrigin: 'top center',
@@ -3242,6 +3278,7 @@ class UiDropdownService extends UiModal {
3242
3278
  backdropClass: 'cdk-overlay-transparent-backdrop',
3243
3279
  positionStrategy: this.createPositionStrategy(attachedRef, fetchedParameters, offsetX, offsetY),
3244
3280
  });
3281
+ overlayRef.hostElement.style.zIndex = this.overlayStackService.next();
3245
3282
  if (fetchedParameters.removePrevious) {
3246
3283
  this.subscribeToOutsideEvents(overlayRef);
3247
3284
  }
@@ -3274,6 +3311,7 @@ class UiDropdownService extends UiModal {
3274
3311
  backdropClass: 'cdk-overlay-transparent-backdrop',
3275
3312
  positionStrategy: this.createMousePositionStrategy(event),
3276
3313
  });
3314
+ overlayRef.hostElement.style.zIndex = this.overlayStackService.next();
3277
3315
  if (fetchedParameters.removePrevious) {
3278
3316
  this.subscribeToOutsideEvents(overlayRef);
3279
3317
  }
@@ -3302,7 +3340,7 @@ class UiDropdownService extends UiModal {
3302
3340
  positionStrategy.setOrigin({ x: positionAdjustment.left, y: positionAdjustment.top });
3303
3341
  overlayRef.updatePosition();
3304
3342
  }
3305
- }), takeUntil$1(this.destroyOutsideClickSubscription$))
3343
+ }), takeUntil(this.destroyOutsideClickSubscription$))
3306
3344
  .subscribe();
3307
3345
  }
3308
3346
  /**
@@ -3389,7 +3427,7 @@ class UiDropdownService extends UiModal {
3389
3427
  timer(150)
3390
3428
  .pipe(switchMap(() => overlayRef.outsidePointerEvents()), tap(() => {
3391
3429
  this.closeAll();
3392
- }), takeUntil$1(this.destroyOutsideClickSubscription$))
3430
+ }), takeUntil(this.destroyOutsideClickSubscription$))
3393
3431
  .subscribe();
3394
3432
  }
3395
3433
  /**
@@ -3793,7 +3831,7 @@ class UiCopyButtonDirective {
3793
3831
  timer(5000)
3794
3832
  .pipe(tap(() => {
3795
3833
  this.$isCopied.set(false);
3796
- }), takeUntil$1(this.destroyTimer$), takeUntilDestroyed(this.destroyRef))
3834
+ }), takeUntil(this.destroyTimer$), takeUntilDestroyed(this.destroyRef))
3797
3835
  .subscribe();
3798
3836
  })
3799
3837
  .catch((err) => {