@coreui/angular 4.7.7 → 4.7.8

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,15 +1,15 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Directive, Input, NgModule, HostBinding, Injectable, Component, EventEmitter, Output, booleanAttribute, ContentChildren, HostListener, inject, RendererFactory2, Inject, ViewChild, forwardRef, Optional, ElementRef, ContentChild, DestroyRef, signal, effect, PLATFORM_ID, TemplateRef, ViewContainerRef, numberAttribute, Pipe, ChangeDetectionStrategy } from '@angular/core';
2
+ import { Directive, Input, NgModule, HostBinding, Injectable, Component, EventEmitter, Output, booleanAttribute, ContentChildren, HostListener, inject, RendererFactory2, PLATFORM_ID, DestroyRef, Inject, ViewChild, forwardRef, Optional, ElementRef, ContentChild, signal, effect, TemplateRef, ViewContainerRef, numberAttribute, Pipe, ChangeDetectionStrategy } from '@angular/core';
3
3
  import { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';
4
4
  import * as i3$1 from '@angular/common';
5
- import { NgTemplateOutlet, NgIf, NgClass, DOCUMENT, NgForOf, AsyncPipe, isPlatformBrowser, CommonModule, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault } from '@angular/common';
5
+ import { NgTemplateOutlet, NgIf, NgClass, DOCUMENT, NgForOf, AsyncPipe, isPlatformServer, isPlatformBrowser, CommonModule, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault } from '@angular/common';
6
6
  import * as i1 from '@angular/animations';
7
7
  import { animate, animation, style, useAnimation, state, transition, trigger, query, group } from '@angular/animations';
8
- import { Subject, BehaviorSubject, Observable, fromEvent, withLatestFrom, zipWith } from 'rxjs';
8
+ import { Subject, BehaviorSubject, Observable, fromEvent } from 'rxjs';
9
9
  import * as i1$1 from '@angular/router';
10
10
  import { RouterModule, NavigationEnd, RouterLink } from '@angular/router';
11
11
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
12
- import { filter, debounceTime } from 'rxjs/operators';
12
+ import { filter, finalize, withLatestFrom, zipWith, debounceTime } from 'rxjs/operators';
13
13
  import { createPopper } from '@popperjs/core';
14
14
  import * as i1$2 from '@angular/cdk/layout';
15
15
  import * as i3 from '@angular/cdk/a11y';
@@ -1083,7 +1083,8 @@ class BackdropService {
1083
1083
  get #scrollbarWidth() {
1084
1084
  // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
1085
1085
  const documentWidth = this.#document.documentElement.clientWidth;
1086
- const scrollbarWidth = Math.abs((window?.innerWidth ?? documentWidth) - documentWidth);
1086
+ // const scrollbarWidth = Math.abs((window?.innerWidth ?? documentWidth) - documentWidth);
1087
+ const scrollbarWidth = Math.abs((this.#document.defaultView?.innerWidth ?? documentWidth) - documentWidth);
1087
1088
  return `${scrollbarWidth}px`;
1088
1089
  }
1089
1090
  setBackdrop(type = 'modal') {
@@ -1760,37 +1761,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImpor
1760
1761
  }]
1761
1762
  }] });
1762
1763
 
1763
- class IntersectionService {
1764
- constructor() {
1765
- this.intersecting = new BehaviorSubject(false);
1766
- this.intersecting$ = this.intersecting.asObservable();
1767
- this.defaultObserverOptions = {
1768
- root: null,
1769
- rootMargin: '0px',
1770
- threshold: 0.2
1771
- };
1772
- }
1773
- createIntersectionObserver(hostElement, observerOptions = this.defaultObserverOptions) {
1774
- const options = { ...this.defaultObserverOptions, ...observerOptions };
1775
- this.hostElement = hostElement;
1776
- const handleIntersect = (entries, observer) => {
1777
- entries.forEach((entry) => {
1778
- this.intersecting.next(entry.isIntersecting);
1779
- });
1780
- };
1781
- this.intersectionObserver = new IntersectionObserver(handleIntersect, options);
1782
- this.intersectionObserver.observe(hostElement.nativeElement);
1783
- }
1784
- ngOnDestroy() {
1785
- this.intersectionObserver?.unobserve(this.hostElement?.nativeElement);
1786
- }
1787
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: IntersectionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1788
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: IntersectionService }); }
1789
- }
1790
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: IntersectionService, decorators: [{
1791
- type: Injectable
1792
- }], ctorParameters: () => [] });
1793
-
1794
1764
  class ListenersService {
1795
1765
  constructor(renderer) {
1796
1766
  this.renderer = renderer;
@@ -1939,6 +1909,53 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImpor
1939
1909
  type: Injectable
1940
1910
  }] });
1941
1911
 
1912
+ class IntersectionService {
1913
+ constructor() {
1914
+ this.platformId = inject(PLATFORM_ID);
1915
+ this.#intersecting = new BehaviorSubject({ isIntersecting: false });
1916
+ this.intersecting$ = this.#intersecting.asObservable();
1917
+ this.defaultObserverOptions = {
1918
+ root: null,
1919
+ rootMargin: '0px',
1920
+ threshold: 0.2
1921
+ };
1922
+ this.hostElementRefs = new Map();
1923
+ }
1924
+ #intersecting;
1925
+ createIntersectionObserver(hostElement, observerOptions = this.defaultObserverOptions) {
1926
+ if (isPlatformServer(this.platformId)) {
1927
+ this.#intersecting.next({ isIntersecting: true, hostElement });
1928
+ return;
1929
+ }
1930
+ const options = { ...this.defaultObserverOptions, ...observerOptions };
1931
+ const handleIntersect = (entries, observer) => {
1932
+ entries.forEach((entry) => {
1933
+ this.#intersecting.next({ isIntersecting: entry.isIntersecting, hostElement });
1934
+ });
1935
+ };
1936
+ this.hostElementRefs.set(hostElement, new IntersectionObserver(handleIntersect, options));
1937
+ this.hostElementRefs.get(hostElement)?.observe(hostElement.nativeElement);
1938
+ }
1939
+ unobserve(elementRef) {
1940
+ this.hostElementRefs.get(elementRef)?.unobserve(elementRef.nativeElement);
1941
+ this.hostElementRefs.set(elementRef, null);
1942
+ this.hostElementRefs.delete(elementRef);
1943
+ }
1944
+ ngOnDestroy() {
1945
+ this.hostElementRefs.forEach((observer, elementRef) => {
1946
+ observer?.unobserve(elementRef.nativeElement);
1947
+ });
1948
+ }
1949
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: IntersectionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1950
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: IntersectionService, providedIn: 'root' }); }
1951
+ }
1952
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: IntersectionService, decorators: [{
1953
+ type: Injectable,
1954
+ args: [{
1955
+ providedIn: 'root'
1956
+ }]
1957
+ }] });
1958
+
1942
1959
  class CarouselComponent {
1943
1960
  get hostClasses() {
1944
1961
  return {
@@ -1948,6 +1965,7 @@ class CarouselComponent {
1948
1965
  'carousel-fade': this.transition === 'crossfade'
1949
1966
  };
1950
1967
  }
1968
+ #destroyRef;
1951
1969
  constructor(config, hostElement, carouselService, carouselState, intersectionService, listenersService) {
1952
1970
  this.config = config;
1953
1971
  this.hostElement = hostElement;
@@ -2004,7 +2022,9 @@ class CarouselComponent {
2004
2022
  * @type number
2005
2023
  */
2006
2024
  this.itemChange = new EventEmitter();
2025
+ this.timerId = undefined;
2007
2026
  this.activeItemInterval = 0;
2027
+ this.#destroyRef = inject(DestroyRef);
2008
2028
  this._visible = true;
2009
2029
  Object.assign(this, config);
2010
2030
  }
@@ -2012,13 +2032,11 @@ class CarouselComponent {
2012
2032
  this.carouselStateSubscribe();
2013
2033
  }
2014
2034
  ngOnDestroy() {
2035
+ this.resetTimer();
2015
2036
  this.clearListeners();
2016
- this.carouselStateSubscribe(false);
2017
- this.intersectionServiceSubscribe(false);
2018
2037
  this.swipeSubscribe(false);
2019
2038
  }
2020
2039
  ngAfterContentInit() {
2021
- this.intersectionService.createIntersectionObserver(this.hostElement);
2022
2040
  this.intersectionServiceSubscribe();
2023
2041
  this.carouselState.state = { activeItemIndex: this.activeIndex, animate: this.animate };
2024
2042
  this.setListeners();
@@ -2058,32 +2076,30 @@ class CarouselComponent {
2058
2076
  }
2059
2077
  resetTimer() {
2060
2078
  clearTimeout(this.timerId);
2079
+ this.timerId = undefined;
2061
2080
  }
2062
- carouselStateSubscribe(subscribe = true) {
2063
- if (subscribe) {
2064
- this.carouselIndexSubscription = this.carouselService.carouselIndex$.subscribe((nextItem) => {
2065
- if ('active' in nextItem) {
2066
- this.itemChange.emit(nextItem.active);
2067
- }
2068
- this.activeItemInterval = typeof nextItem.interval === 'number' && nextItem.interval > -1 ? nextItem.interval : this.interval;
2069
- const isLastItem = ((nextItem.active === nextItem.lastItemIndex) && this.direction === 'next') || ((nextItem.active === 0) && this.direction === 'prev');
2070
- !this.wrap && isLastItem ? this.resetTimer() : this.setTimer();
2071
- });
2072
- }
2073
- else {
2074
- this.carouselIndexSubscription?.unsubscribe();
2075
- }
2081
+ carouselStateSubscribe() {
2082
+ this.carouselService.carouselIndex$
2083
+ .pipe(takeUntilDestroyed(this.#destroyRef))
2084
+ .subscribe((nextItem) => {
2085
+ if ('active' in nextItem) {
2086
+ this.itemChange.emit(nextItem.active);
2087
+ }
2088
+ this.activeItemInterval = typeof nextItem.interval === 'number' && nextItem.interval > -1 ? nextItem.interval : this.interval;
2089
+ const isLastItem = ((nextItem.active === nextItem.lastItemIndex) && this.direction === 'next') || ((nextItem.active === 0) && this.direction === 'prev');
2090
+ !this.wrap && isLastItem ? this.resetTimer() : this.setTimer();
2091
+ });
2076
2092
  }
2077
- intersectionServiceSubscribe(subscribe = true) {
2078
- if (subscribe) {
2079
- this.intersectingSubscription = this.intersectionService.intersecting$.subscribe(isIntersecting => {
2080
- this.visible = isIntersecting;
2081
- isIntersecting ? this.setTimer() : this.resetTimer();
2082
- });
2083
- }
2084
- else {
2085
- this.intersectingSubscription?.unsubscribe();
2086
- }
2093
+ intersectionServiceSubscribe() {
2094
+ this.intersectionService.intersecting$
2095
+ .pipe(filter(next => next.hostElement === this.hostElement), finalize(() => {
2096
+ this.intersectionService.unobserve(this.hostElement);
2097
+ }), takeUntilDestroyed(this.#destroyRef))
2098
+ .subscribe(next => {
2099
+ this.visible = next.isIntersecting;
2100
+ next.isIntersecting ? this.setTimer() : this.resetTimer();
2101
+ });
2102
+ this.intersectionService.createIntersectionObserver(this.hostElement);
2087
2103
  }
2088
2104
  swipeSubscribe(subscribe = true) {
2089
2105
  if (this.touch && subscribe) {
@@ -2091,7 +2107,7 @@ class CarouselComponent {
2091
2107
  const touchStart$ = fromEvent(carouselElement, 'touchstart');
2092
2108
  const touchEnd$ = fromEvent(carouselElement, 'touchend');
2093
2109
  const touchMove$ = fromEvent(carouselElement, 'touchmove');
2094
- this.swipeSubscription = touchStart$.pipe(zipWith(touchEnd$.pipe(withLatestFrom(touchMove$))))
2110
+ this.swipeSubscription = touchStart$.pipe(zipWith(touchEnd$.pipe(withLatestFrom(touchMove$))), takeUntilDestroyed(this.#destroyRef))
2095
2111
  .subscribe(([touchstart, [touchend, touchmove]]) => {
2096
2112
  touchstart.stopPropagation();
2097
2113
  touchmove.stopPropagation();
@@ -2107,11 +2123,11 @@ class CarouselComponent {
2107
2123
  }
2108
2124
  }
2109
2125
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: CarouselComponent, deps: [{ token: CarouselConfig }, { token: i0.ElementRef }, { token: CarouselService }, { token: CarouselState }, { token: IntersectionService }, { token: ListenersService }], target: i0.ɵɵFactoryTarget.Component }); }
2110
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: CarouselComponent, isStandalone: true, selector: "c-carousel", inputs: { activeIndex: "activeIndex", animate: "animate", dark: "dark", direction: "direction", interval: "interval", pause: "pause", touch: "touch", transition: "transition", wrap: "wrap" }, outputs: { itemChange: "itemChange" }, host: { properties: { "class": "this.hostClasses" } }, providers: [CarouselService, CarouselState, CarouselConfig, IntersectionService, ListenersService], ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host{display:block}\n"] }); }
2126
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: CarouselComponent, isStandalone: true, selector: "c-carousel", inputs: { activeIndex: "activeIndex", animate: "animate", dark: "dark", direction: "direction", interval: "interval", pause: "pause", touch: "touch", transition: "transition", wrap: "wrap" }, outputs: { itemChange: "itemChange" }, host: { properties: { "class": "this.hostClasses" } }, providers: [CarouselService, CarouselState, CarouselConfig, ListenersService], ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host{display:block}\n"] }); }
2111
2127
  }
2112
2128
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: CarouselComponent, decorators: [{
2113
2129
  type: Component,
2114
- args: [{ selector: 'c-carousel', template: '<ng-content></ng-content>', providers: [CarouselService, CarouselState, CarouselConfig, IntersectionService, ListenersService], standalone: true, styles: [":host{display:block}\n"] }]
2130
+ args: [{ selector: 'c-carousel', template: '<ng-content></ng-content>', providers: [CarouselService, CarouselState, CarouselConfig, ListenersService], standalone: true, styles: [":host{display:block}\n"] }]
2115
2131
  }], ctorParameters: () => [{ type: CarouselConfig, decorators: [{
2116
2132
  type: Inject,
2117
2133
  args: [CarouselConfig]
@@ -4720,7 +4736,7 @@ class NavbarComponent {
4720
4736
  }
4721
4737
  get breakpoint() {
4722
4738
  if (typeof this.expand === 'string') {
4723
- return getComputedStyle(this.hostElement.nativeElement).getPropertyValue(`--cui-breakpoint-${this.expand}`);
4739
+ return getComputedStyle(this.hostElement.nativeElement)?.getPropertyValue(`--cui-breakpoint-${this.expand}`) ?? false;
4724
4740
  }
4725
4741
  return false;
4726
4742
  }
@@ -5617,7 +5633,7 @@ class OffcanvasComponent {
5617
5633
  }
5618
5634
  const element = this.document.documentElement;
5619
5635
  const responsiveBreakpoint = this.responsive;
5620
- const breakpointValue = getComputedStyle(element).getPropertyValue(`--cui-breakpoint-${responsiveBreakpoint.trim()}`) || false;
5636
+ const breakpointValue = getComputedStyle(element)?.getPropertyValue(`--cui-breakpoint-${responsiveBreakpoint.trim()}`) ?? false;
5621
5637
  return breakpointValue ? `${parseFloat(breakpointValue.trim()) - 0.02}px` : false;
5622
5638
  }
5623
5639
  animateStart(event) {
@@ -5716,7 +5732,7 @@ class OffcanvasComponent {
5716
5732
  }
5717
5733
  }
5718
5734
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: OffcanvasComponent, deps: [{ token: DOCUMENT }, { token: PLATFORM_ID }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: OffcanvasService }, { token: BackdropService }, { token: i1$2.BreakpointObserver }], target: i0.ɵɵFactoryTarget.Component }); }
5719
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "17.0.8", type: OffcanvasComponent, isStandalone: true, selector: "c-offcanvas", inputs: { backdrop: "backdrop", keyboard: ["keyboard", "keyboard", booleanAttribute], placement: "placement", responsive: "responsive", id: "id", role: "role", ariaModal: ["ariaModal", "ariaModal", booleanAttribute], scroll: ["scroll", "scroll", booleanAttribute], visible: ["visible", "visible", booleanAttribute] }, outputs: { visibleChange: "visibleChange" }, host: { listeners: { "@showHide.start": "animateStart($event)", "@showHide.done": "animateDone($event)", "document:keydown": "onKeyDownHandler($event)" }, properties: { "attr.role": "this.role", "attr.aria-modal": "this.ariaModal", "class": "this.hostClasses", "attr.aria-hidden": "this.ariaHidden", "attr.tabindex": "this.tabIndex", "@showHide": "this.animateTrigger" } }, exportAs: ["cOffcanvas"], ngImport: i0, template: "<div cdkTrapFocus cdkTrapFocusAutoCapture>\n <ng-content></ng-content>\n</div>\n\n", styles: [":host{display:none}\n"], dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i3.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }], animations: [
5735
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "17.0.8", type: OffcanvasComponent, isStandalone: true, selector: "c-offcanvas", inputs: { backdrop: "backdrop", keyboard: ["keyboard", "keyboard", booleanAttribute], placement: "placement", responsive: "responsive", id: "id", role: "role", ariaModal: ["ariaModal", "ariaModal", booleanAttribute], scroll: ["scroll", "scroll", booleanAttribute], visible: ["visible", "visible", booleanAttribute] }, outputs: { visibleChange: "visibleChange" }, host: { attributes: { "ngSkipHydration": "true" }, listeners: { "@showHide.start": "animateStart($event)", "@showHide.done": "animateDone($event)", "document:keydown": "onKeyDownHandler($event)" }, properties: { "attr.role": "this.role", "attr.aria-modal": "this.ariaModal", "class": "this.hostClasses", "attr.aria-hidden": "this.ariaHidden", "attr.tabindex": "this.tabIndex", "@showHide": "this.animateTrigger" } }, exportAs: ["cOffcanvas"], ngImport: i0, template: "<div cdkTrapFocus cdkTrapFocusAutoCapture>\n <ng-content></ng-content>\n</div>\n\n", styles: [":host{display:none}\n"], dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i3.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }], animations: [
5720
5736
  trigger('showHide', [
5721
5737
  state('visible', style({
5722
5738
  // visibility: 'visible'
@@ -5740,7 +5756,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImpor
5740
5756
  })),
5741
5757
  transition('visible <=> *', [animate('300ms')])
5742
5758
  ])
5743
- ], exportAs: 'cOffcanvas', standalone: true, imports: [A11yModule], template: "<div cdkTrapFocus cdkTrapFocusAutoCapture>\n <ng-content></ng-content>\n</div>\n\n", styles: [":host{display:none}\n"] }]
5759
+ ], exportAs: 'cOffcanvas', standalone: true, imports: [A11yModule], host: { ngSkipHydration: 'true' }, template: "<div cdkTrapFocus cdkTrapFocusAutoCapture>\n <ng-content></ng-content>\n</div>\n\n", styles: [":host{display:none}\n"] }]
5744
5760
  }], ctorParameters: () => [{ type: Document, decorators: [{
5745
5761
  type: Inject,
5746
5762
  args: [DOCUMENT]
@@ -6319,6 +6335,7 @@ class PopoverDirective {
6319
6335
  get ariaDescribedBy() {
6320
6336
  return this.popoverId ? this.popoverId : null;
6321
6337
  }
6338
+ #destroyRef;
6322
6339
  constructor(document, renderer, hostElement, viewContainerRef, listenersService, changeDetectorRef, intersectionService) {
6323
6340
  this.document = document;
6324
6341
  this.renderer = renderer;
@@ -6352,9 +6369,9 @@ class PopoverDirective {
6352
6369
  }
6353
6370
  ]
6354
6371
  };
6372
+ this.#destroyRef = inject(DestroyRef);
6355
6373
  }
6356
6374
  ngAfterViewInit() {
6357
- this.intersectionService.createIntersectionObserver(this.hostElement);
6358
6375
  this.intersectionServiceSubscribe();
6359
6376
  }
6360
6377
  ngOnChanges(changes) {
@@ -6365,7 +6382,6 @@ class PopoverDirective {
6365
6382
  ngOnDestroy() {
6366
6383
  this.clearListeners();
6367
6384
  this.destroyPopoverElement();
6368
- this.intersectionServiceSubscribe(false);
6369
6385
  }
6370
6386
  ngOnInit() {
6371
6387
  this.setListeners();
@@ -6392,18 +6408,16 @@ class PopoverDirective {
6392
6408
  clearListeners() {
6393
6409
  this.listenersService.clearListeners();
6394
6410
  }
6395
- intersectionServiceSubscribe(subscribe = true) {
6396
- if (subscribe) {
6397
- this.intersectingSubscription = this.intersectionService.intersecting$
6398
- .pipe(debounceTime(100))
6399
- .subscribe(isIntersecting => {
6400
- this.visible = isIntersecting ? this.visible : false;
6401
- !this.visible && this.removePopoverElement();
6402
- });
6403
- }
6404
- else {
6405
- this.intersectingSubscription?.unsubscribe();
6406
- }
6411
+ intersectionServiceSubscribe() {
6412
+ this.intersectionService.createIntersectionObserver(this.hostElement);
6413
+ this.intersectionService.intersecting$
6414
+ .pipe(filter(next => next.hostElement === this.hostElement), debounceTime(100), finalize(() => {
6415
+ this.intersectionService.unobserve(this.hostElement);
6416
+ }), takeUntilDestroyed(this.#destroyRef))
6417
+ .subscribe(next => {
6418
+ this.visible = next.isIntersecting ? this.visible : false;
6419
+ !this.visible && this.removePopoverElement();
6420
+ });
6407
6421
  }
6408
6422
  getUID(prefix) {
6409
6423
  let uid = prefix ?? 'random-id';
@@ -6467,18 +6481,18 @@ class PopoverDirective {
6467
6481
  this.popoverRef.instance.id = undefined;
6468
6482
  this.changeDetectorRef.markForCheck();
6469
6483
  setTimeout(() => {
6470
- this.viewContainerRef.detach();
6484
+ this.viewContainerRef?.detach();
6471
6485
  }, 300);
6472
6486
  }
6473
6487
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: PopoverDirective, deps: [{ token: DOCUMENT }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.ViewContainerRef }, { token: ListenersService }, { token: i0.ChangeDetectorRef }, { token: IntersectionService }], target: i0.ɵɵFactoryTarget.Directive }); }
6474
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.0.8", type: PopoverDirective, isStandalone: true, selector: "[cPopover]", inputs: { content: ["cPopover", "content"], popperOptions: ["cPopoverOptions", "popperOptions"], placement: ["cPopoverPlacement", "placement"], trigger: ["cPopoverTrigger", "trigger"], visible: ["cPopoverVisible", "visible"] }, host: { properties: { "attr.aria-describedby": "this.ariaDescribedBy" } }, providers: [ListenersService, IntersectionService], exportAs: ["cPopover"], usesOnChanges: true, ngImport: i0 }); }
6488
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.0.8", type: PopoverDirective, isStandalone: true, selector: "[cPopover]", inputs: { content: ["cPopover", "content"], popperOptions: ["cPopoverOptions", "popperOptions"], placement: ["cPopoverPlacement", "placement"], trigger: ["cPopoverTrigger", "trigger"], visible: ["cPopoverVisible", "visible"] }, host: { properties: { "attr.aria-describedby": "this.ariaDescribedBy" } }, providers: [ListenersService], exportAs: ["cPopover"], usesOnChanges: true, ngImport: i0 }); }
6475
6489
  }
6476
6490
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: PopoverDirective, decorators: [{
6477
6491
  type: Directive,
6478
6492
  args: [{
6479
6493
  selector: '[cPopover]',
6480
6494
  exportAs: 'cPopover',
6481
- providers: [ListenersService, IntersectionService],
6495
+ providers: [ListenersService],
6482
6496
  standalone: true
6483
6497
  }]
6484
6498
  }], ctorParameters: () => [{ type: Document, decorators: [{
@@ -6908,7 +6922,7 @@ class SidebarComponent {
6908
6922
  }
6909
6923
  this.state = {
6910
6924
  ...this.state,
6911
- ...newState,
6925
+ ...newState
6912
6926
  };
6913
6927
  this.state.mobile && this.state.visible
6914
6928
  ? this.backdropService.setBackdrop(this)
@@ -6919,9 +6933,8 @@ class SidebarComponent {
6919
6933
  }
6920
6934
  get getMobileBreakpoint() {
6921
6935
  const element = this.document.documentElement;
6922
- const mobileBreakpoint = getComputedStyle(element).getPropertyValue('--cui-mobile-breakpoint') ||
6923
- 'md';
6924
- const breakpointValue = getComputedStyle(element).getPropertyValue(`--cui-breakpoint-${mobileBreakpoint.trim()}`) || '768px';
6936
+ const mobileBreakpoint = this.document.defaultView?.getComputedStyle(element)?.getPropertyValue('--cui-mobile-breakpoint') ?? 'md';
6937
+ const breakpointValue = this.document.defaultView?.getComputedStyle(element)?.getPropertyValue(`--cui-breakpoint-${mobileBreakpoint.trim()}`) ?? '768px';
6925
6938
  return `${parseFloat(breakpointValue.trim()) - 0.02}px` || '767.98px';
6926
6939
  }
6927
6940
  constructor(document, renderer, breakpointObserver, sidebarService, backdropService) {
@@ -6936,12 +6949,12 @@ class SidebarComponent {
6936
6949
  this.#visible = false;
6937
6950
  this.#onMobile = false;
6938
6951
  this.state = {
6939
- sidebar: this,
6952
+ sidebar: this
6940
6953
  };
6941
6954
  this.#stateInitial = {
6942
6955
  narrow: false,
6943
6956
  visible: false,
6944
- unfoldable: false,
6957
+ unfoldable: false
6945
6958
  };
6946
6959
  /**
6947
6960
  * Place sidebar in non-static positions. [docs]
@@ -6965,7 +6978,7 @@ class SidebarComponent {
6965
6978
  'sidebar-overlaid': this.overlaid,
6966
6979
  [`sidebar-${this.size}`]: !!this.size,
6967
6980
  show: visible && this.#onMobile,
6968
- hide: !visible,
6981
+ hide: !visible
6969
6982
  };
6970
6983
  }
6971
6984
  ngOnInit() {
@@ -7001,11 +7014,11 @@ class SidebarComponent {
7001
7014
  this.#stateInitial = {
7002
7015
  narrow: this.narrow,
7003
7016
  visible: this.visible,
7004
- unfoldable: this.unfoldable,
7017
+ unfoldable: this.unfoldable
7005
7018
  };
7006
7019
  this.sidebarService.toggle({
7007
7020
  ...this.#stateInitial,
7008
- sidebar: this,
7021
+ sidebar: this
7009
7022
  });
7010
7023
  }
7011
7024
  stateToggleSubscribe(subscribe = true) {
@@ -7034,7 +7047,7 @@ class SidebarComponent {
7034
7047
  mobile: isOnMobile,
7035
7048
  unfoldable: isUnfoldable,
7036
7049
  visible: isOnMobile ? !isOnMobile : this.#stateInitial.visible,
7037
- sidebar: this,
7050
+ sidebar: this
7038
7051
  });
7039
7052
  }
7040
7053
  });
@@ -8946,6 +8959,7 @@ class TooltipDirective {
8946
8959
  get ariaDescribedBy() {
8947
8960
  return this.tooltipId ? this.tooltipId : null;
8948
8961
  }
8962
+ #destroyRef;
8949
8963
  constructor(document, renderer, hostElement, viewContainerRef, listenersService, changeDetectorRef, intersectionService) {
8950
8964
  this.document = document;
8951
8965
  this.renderer = renderer;
@@ -8979,9 +8993,9 @@ class TooltipDirective {
8979
8993
  }
8980
8994
  ]
8981
8995
  };
8996
+ this.#destroyRef = inject(DestroyRef);
8982
8997
  }
8983
8998
  ngAfterViewInit() {
8984
- this.intersectionService.createIntersectionObserver(this.hostElement);
8985
8999
  this.intersectionServiceSubscribe();
8986
9000
  }
8987
9001
  ngOnChanges(changes) {
@@ -8992,7 +9006,6 @@ class TooltipDirective {
8992
9006
  ngOnDestroy() {
8993
9007
  this.clearListeners();
8994
9008
  this.destroyTooltipElement();
8995
- this.intersectionServiceSubscribe(false);
8996
9009
  }
8997
9010
  ngOnInit() {
8998
9011
  this.setListeners();
@@ -9019,18 +9032,16 @@ class TooltipDirective {
9019
9032
  clearListeners() {
9020
9033
  this.listenersService.clearListeners();
9021
9034
  }
9022
- intersectionServiceSubscribe(subscribe = true) {
9023
- if (subscribe) {
9024
- this.intersectingSubscription = this.intersectionService.intersecting$
9025
- .pipe(debounceTime(100))
9026
- .subscribe(isIntersecting => {
9027
- this.visible = isIntersecting ? this.visible : false;
9028
- !this.visible && this.removeTooltipElement();
9029
- });
9030
- }
9031
- else {
9032
- this.intersectingSubscription?.unsubscribe();
9033
- }
9035
+ intersectionServiceSubscribe() {
9036
+ this.intersectionService.createIntersectionObserver(this.hostElement);
9037
+ this.intersectionService.intersecting$
9038
+ .pipe(filter(next => next.hostElement === this.hostElement), debounceTime(100), finalize(() => {
9039
+ this.intersectionService.unobserve(this.hostElement);
9040
+ }), takeUntilDestroyed(this.#destroyRef))
9041
+ .subscribe(next => {
9042
+ this.visible = next.isIntersecting ? this.visible : false;
9043
+ !this.visible && this.removeTooltipElement();
9044
+ });
9034
9045
  }
9035
9046
  getUID(prefix) {
9036
9047
  let uid = prefix ?? 'random-id';