@skyux/core 6.0.0 → 6.1.0

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.
Files changed (31) hide show
  1. package/documentation.json +137 -134
  2. package/esm2020/lib/modules/adapter-service/adapter.service.mjs +11 -7
  3. package/esm2020/lib/modules/affix/affix.service.mjs +7 -3
  4. package/esm2020/lib/modules/numeric/numeric.pipe.mjs +4 -5
  5. package/esm2020/lib/modules/numeric/numeric.service.mjs +2 -2
  6. package/esm2020/lib/modules/resize-observer/resize-observer-media-query.service.mjs +42 -29
  7. package/esm2020/lib/modules/resize-observer/resize-observer.service.mjs +17 -11
  8. package/esm2020/lib/modules/scrollable-host/scrollable-host.service.mjs +29 -26
  9. package/esm2020/testing/core-testing.module.mjs +29 -0
  10. package/esm2020/testing/mock-media-query.service.mjs +3 -1
  11. package/esm2020/testing/mock-ui-config.service.mjs +1 -1
  12. package/esm2020/testing/public-api.mjs +2 -1
  13. package/fesm2015/skyux-core-testing.mjs +28 -2
  14. package/fesm2015/skyux-core-testing.mjs.map +1 -1
  15. package/fesm2015/skyux-core.mjs +102 -77
  16. package/fesm2015/skyux-core.mjs.map +1 -1
  17. package/fesm2020/skyux-core-testing.mjs +28 -2
  18. package/fesm2020/skyux-core-testing.mjs.map +1 -1
  19. package/fesm2020/skyux-core.mjs +102 -76
  20. package/fesm2020/skyux-core.mjs.map +1 -1
  21. package/lib/modules/adapter-service/adapter.service.d.ts +1 -1
  22. package/lib/modules/affix/affix.service.d.ts +1 -1
  23. package/lib/modules/numeric/numeric.pipe.d.ts +3 -4
  24. package/lib/modules/numeric/numeric.service.d.ts +1 -1
  25. package/lib/modules/resize-observer/resize-observer-media-query.service.d.ts +2 -4
  26. package/lib/modules/resize-observer/resize-observer.service.d.ts +1 -2
  27. package/lib/modules/scrollable-host/scrollable-host.service.d.ts +7 -4
  28. package/package.json +2 -2
  29. package/testing/core-testing.module.d.ts +6 -0
  30. package/testing/mock-ui-config.service.d.ts +2 -1
  31. package/testing/public-api.d.ts +1 -0
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { NgZone, Injectable } from '@angular/core';
2
+ import { NgZone, Injectable, NgModule } from '@angular/core';
3
3
  import { SkyMediaQueryService, SkyMediaBreakpoints, SkyUIConfigService } from '@skyux/core';
4
4
  import { BehaviorSubject, of } from 'rxjs';
5
5
 
@@ -28,6 +28,8 @@ class MockSkyMediaQueryService extends SkyMediaQueryService {
28
28
  this._currentBreakpoints = args;
29
29
  this.currentMockSubject.next(this._currentBreakpoints);
30
30
  }
31
+ /* istanbul ignore next */
32
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
31
33
  destroy() { }
32
34
  }
33
35
  MockSkyMediaQueryService.xs = '(max-width: 767px)';
@@ -95,9 +97,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
95
97
  type: Injectable
96
98
  }] });
97
99
 
100
+ class SkyCoreTestingModule {
101
+ }
102
+ SkyCoreTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyCoreTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
103
+ SkyCoreTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyCoreTestingModule });
104
+ SkyCoreTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyCoreTestingModule, providers: [
105
+ { provide: SkyMediaQueryService, useClass: MockSkyMediaQueryService },
106
+ {
107
+ provide: SkyUIConfigService,
108
+ useClass: MockSkyUIConfigService,
109
+ },
110
+ ] });
111
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyCoreTestingModule, decorators: [{
112
+ type: NgModule,
113
+ args: [{
114
+ providers: [
115
+ { provide: SkyMediaQueryService, useClass: MockSkyMediaQueryService },
116
+ {
117
+ provide: SkyUIConfigService,
118
+ useClass: MockSkyUIConfigService,
119
+ },
120
+ ],
121
+ }]
122
+ }] });
123
+
98
124
  /**
99
125
  * Generated bundle index. Do not edit.
100
126
  */
101
127
 
102
- export { MockSkyMediaQueryService, MockSkyUIConfigService };
128
+ export { MockSkyMediaQueryService, MockSkyUIConfigService, SkyCoreTestingModule };
103
129
  //# sourceMappingURL=skyux-core-testing.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"skyux-core-testing.mjs","sources":["../../../../../libs/components/core/testing/src/mock-media-query.service.ts","../../../../../libs/components/core/testing/src/mock-ui-config.service.ts","../../../../../libs/components/core/testing/src/skyux-core-testing.ts"],"sourcesContent":["import { Injectable, NgZone } from '@angular/core';\nimport {\n SkyMediaBreakpoints,\n SkyMediaQueryListener,\n SkyMediaQueryService,\n} from '@skyux/core';\n\nimport { BehaviorSubject, Subscription } from 'rxjs';\n\n@Injectable()\nexport class MockSkyMediaQueryService extends SkyMediaQueryService {\n public static xs = '(max-width: 767px)';\n public static sm = '(min-width: 768px) and (max-width: 991px)';\n public static md = '(min-width: 992px) and (max-width: 1199px)';\n public static lg = '(min-width: 1200px)';\n\n public get current(): SkyMediaBreakpoints {\n return this._currentBreakpoints;\n }\n\n public set current(breakpoints: SkyMediaBreakpoints) {\n this._currentBreakpoints = breakpoints;\n }\n\n public currentMockSubject = new BehaviorSubject<SkyMediaBreakpoints>(\n this.current\n );\n\n private _currentBreakpoints = SkyMediaBreakpoints.md;\n\n constructor() {\n super(\n new NgZone({\n enableLongStackTrace: true,\n })\n );\n }\n\n public subscribe(listener: SkyMediaQueryListener): Subscription {\n return this.currentMockSubject.subscribe({\n next: (breakpoints: SkyMediaBreakpoints) => {\n listener(breakpoints);\n },\n });\n }\n\n public fire(args: SkyMediaBreakpoints): void {\n this._currentBreakpoints = args;\n this.currentMockSubject.next(this._currentBreakpoints);\n }\n\n public destroy(): void {}\n}\n","import { Injectable } from '@angular/core';\nimport { SkyUIConfigService } from '@skyux/core';\n\nimport { of as observableOf } from 'rxjs';\n\n@Injectable()\nexport class MockSkyUIConfigService extends SkyUIConfigService {\n public getConfig(key: string, defaultConfig?: any): any {\n switch (key) {\n case 'defaultSettings':\n return observableOf(defaultConfig);\n case 'badData':\n return observableOf({ invalidProperty: 'invalidData' });\n default: {\n return observableOf({\n settings: {\n userSettings: {\n singleColumn: {\n tiles: [\n {\n id: 'tile-1',\n isCollapsed: true,\n },\n {\n id: 'tile-2',\n isCollapsed: true,\n },\n ],\n },\n multiColumn: [\n {\n tiles: [\n {\n id: 'tile-2',\n isCollapsed: true,\n },\n ],\n },\n {\n tiles: [\n {\n id: 'tile-1',\n isCollapsed: true,\n },\n ],\n },\n ],\n },\n defaultSettings: ['tile-1', 'tile-2'],\n },\n });\n }\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["observableOf"],"mappings":"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"}
1
+ {"version":3,"file":"skyux-core-testing.mjs","sources":["../../../../../libs/components/core/testing/src/mock-media-query.service.ts","../../../../../libs/components/core/testing/src/mock-ui-config.service.ts","../../../../../libs/components/core/testing/src/core-testing.module.ts","../../../../../libs/components/core/testing/src/skyux-core-testing.ts"],"sourcesContent":["import { Injectable, NgZone } from '@angular/core';\nimport {\n SkyMediaBreakpoints,\n SkyMediaQueryListener,\n SkyMediaQueryService,\n} from '@skyux/core';\n\nimport { BehaviorSubject, Subscription } from 'rxjs';\n\n@Injectable()\nexport class MockSkyMediaQueryService extends SkyMediaQueryService {\n public static xs = '(max-width: 767px)';\n public static sm = '(min-width: 768px) and (max-width: 991px)';\n public static md = '(min-width: 992px) and (max-width: 1199px)';\n public static lg = '(min-width: 1200px)';\n\n public get current(): SkyMediaBreakpoints {\n return this._currentBreakpoints;\n }\n\n public set current(breakpoints: SkyMediaBreakpoints) {\n this._currentBreakpoints = breakpoints;\n }\n\n public currentMockSubject = new BehaviorSubject<SkyMediaBreakpoints>(\n this.current\n );\n\n private _currentBreakpoints = SkyMediaBreakpoints.md;\n\n constructor() {\n super(\n new NgZone({\n enableLongStackTrace: true,\n })\n );\n }\n\n public subscribe(listener: SkyMediaQueryListener): Subscription {\n return this.currentMockSubject.subscribe({\n next: (breakpoints: SkyMediaBreakpoints) => {\n listener(breakpoints);\n },\n });\n }\n\n public fire(args: SkyMediaBreakpoints): void {\n this._currentBreakpoints = args;\n this.currentMockSubject.next(this._currentBreakpoints);\n }\n\n /* istanbul ignore next */\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n public destroy(): void {}\n}\n","import { Injectable } from '@angular/core';\nimport { SkyUIConfigService } from '@skyux/core';\n\nimport { Observable, of as observableOf } from 'rxjs';\n\n@Injectable()\nexport class MockSkyUIConfigService extends SkyUIConfigService {\n public getConfig(key: string, defaultConfig?: any): Observable<any> {\n switch (key) {\n case 'defaultSettings':\n return observableOf(defaultConfig);\n case 'badData':\n return observableOf({ invalidProperty: 'invalidData' });\n default: {\n return observableOf({\n settings: {\n userSettings: {\n singleColumn: {\n tiles: [\n {\n id: 'tile-1',\n isCollapsed: true,\n },\n {\n id: 'tile-2',\n isCollapsed: true,\n },\n ],\n },\n multiColumn: [\n {\n tiles: [\n {\n id: 'tile-2',\n isCollapsed: true,\n },\n ],\n },\n {\n tiles: [\n {\n id: 'tile-1',\n isCollapsed: true,\n },\n ],\n },\n ],\n },\n defaultSettings: ['tile-1', 'tile-2'],\n },\n });\n }\n }\n }\n}\n","import { NgModule } from '@angular/core';\nimport { SkyMediaQueryService, SkyUIConfigService } from '@skyux/core';\n\nimport { MockSkyMediaQueryService } from './mock-media-query.service';\nimport { MockSkyUIConfigService } from './mock-ui-config.service';\n\n@NgModule({\n providers: [\n { provide: SkyMediaQueryService, useClass: MockSkyMediaQueryService },\n {\n provide: SkyUIConfigService,\n useClass: MockSkyUIConfigService,\n },\n ],\n})\nexport class SkyCoreTestingModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["observableOf"],"mappings":"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"}
@@ -1,5 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { NgModule, Injectable, EventEmitter, Directive, Input, Output, Injector, ViewContainerRef, Component, ChangeDetectionStrategy, ViewChild, InjectionToken, Optional, Inject, Pipe, ElementRef } from '@angular/core';
3
+ import { __classPrivateFieldSet, __classPrivateFieldGet } from 'tslib';
3
4
  import * as i4 from '@angular/common';
4
5
  import { CommonModule } from '@angular/common';
5
6
  import { Subject, fromEvent, BehaviorSubject, ReplaySubject, Observable, of } from 'rxjs';
@@ -44,6 +45,7 @@ var SkyMediaBreakpoints;
44
45
  SkyMediaBreakpoints[SkyMediaBreakpoints["lg"] = 4] = "lg";
45
46
  })(SkyMediaBreakpoints || (SkyMediaBreakpoints = {}));
46
47
 
48
+ var _SkyCoreAdapterService_renderer;
47
49
  const SKY_TABBABLE_SELECTOR = [
48
50
  'a[href]',
49
51
  'area[href]',
@@ -60,7 +62,8 @@ const SKY_TABBABLE_SELECTOR = [
60
62
  class SkyCoreAdapterService {
61
63
  constructor(rendererFactory) {
62
64
  this.rendererFactory = rendererFactory;
63
- this.renderer = this.rendererFactory.createRenderer(undefined, undefined);
65
+ _SkyCoreAdapterService_renderer.set(this, void 0);
66
+ __classPrivateFieldSet(this, _SkyCoreAdapterService_renderer, this.rendererFactory.createRenderer(undefined, null), "f");
64
67
  }
65
68
  /**
66
69
  * Set the responsive container CSS class for a given element.
@@ -71,10 +74,10 @@ class SkyCoreAdapterService {
71
74
  */
72
75
  setResponsiveContainerClass(elementRef, breakpoint) {
73
76
  const nativeEl = elementRef.nativeElement;
74
- this.renderer.removeClass(nativeEl, 'sky-responsive-container-xs');
75
- this.renderer.removeClass(nativeEl, 'sky-responsive-container-sm');
76
- this.renderer.removeClass(nativeEl, 'sky-responsive-container-md');
77
- this.renderer.removeClass(nativeEl, 'sky-responsive-container-lg');
77
+ __classPrivateFieldGet(this, _SkyCoreAdapterService_renderer, "f").removeClass(nativeEl, 'sky-responsive-container-xs');
78
+ __classPrivateFieldGet(this, _SkyCoreAdapterService_renderer, "f").removeClass(nativeEl, 'sky-responsive-container-sm');
79
+ __classPrivateFieldGet(this, _SkyCoreAdapterService_renderer, "f").removeClass(nativeEl, 'sky-responsive-container-md');
80
+ __classPrivateFieldGet(this, _SkyCoreAdapterService_renderer, "f").removeClass(nativeEl, 'sky-responsive-container-lg');
78
81
  let newClass;
79
82
  switch (breakpoint) {
80
83
  case SkyMediaBreakpoints.xs: {
@@ -94,7 +97,7 @@ class SkyCoreAdapterService {
94
97
  break;
95
98
  }
96
99
  }
97
- this.renderer.addClass(nativeEl, newClass);
100
+ __classPrivateFieldGet(this, _SkyCoreAdapterService_renderer, "f").addClass(nativeEl, newClass);
98
101
  }
99
102
  /**
100
103
  * This method temporarily enables/disables pointer events.
@@ -257,6 +260,7 @@ class SkyCoreAdapterService {
257
260
  return hasBounds;
258
261
  }
259
262
  }
263
+ _SkyCoreAdapterService_renderer = new WeakMap();
260
264
  SkyCoreAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyCoreAdapterService, deps: [{ token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
261
265
  SkyCoreAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyCoreAdapterService, providedIn: 'root' });
262
266
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyCoreAdapterService, decorators: [{
@@ -715,18 +719,21 @@ class SkyAffixer {
715
719
  }
716
720
  }
717
721
 
722
+ var _SkyAffixService_renderer;
718
723
  class SkyAffixService {
719
724
  constructor(rendererFactory) {
720
- this.renderer = rendererFactory.createRenderer(undefined, undefined);
725
+ _SkyAffixService_renderer.set(this, void 0);
726
+ __classPrivateFieldSet(this, _SkyAffixService_renderer, rendererFactory.createRenderer(undefined, null), "f");
721
727
  }
722
728
  /**
723
729
  * Creates an instance of [[SkyAffixer]].
724
730
  * @param affixed The element to be affixed.
725
731
  */
726
732
  createAffixer(affixed) {
727
- return new SkyAffixer(affixed.nativeElement, this.renderer);
733
+ return new SkyAffixer(affixed.nativeElement, __classPrivateFieldGet(this, _SkyAffixService_renderer, "f"));
728
734
  }
729
735
  }
736
+ _SkyAffixService_renderer = new WeakMap();
730
737
  SkyAffixService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyAffixService, deps: [{ token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
731
738
  SkyAffixService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyAffixService, providedIn: 'root' });
732
739
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyAffixService, decorators: [{
@@ -1809,7 +1816,7 @@ class SkyNumericService {
1809
1816
  return this._locale || 'en-US';
1810
1817
  }
1811
1818
  /**
1812
- * Shortens with or without symbol (K/M/B/T) depending on value of number.
1819
+ * Formats a number based on the provided options.
1813
1820
  * @param value The number to format.
1814
1821
  * @param options Format options.
1815
1822
  */
@@ -1974,10 +1981,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
1974
1981
  * M for millions, B for billions, and T for trillions. The pipe also formats for currency.
1975
1982
  * Be sure you have a space after the two curly brackets opening the pipe and
1976
1983
  * a space before the two curly brackets closing the pipe or it will not work.
1977
- * Usage:
1978
- * ```
1979
- * {{ value | skyNumeric(config) }}
1980
- * ```
1981
1984
  */
1982
1985
  class SkyNumericPipe {
1983
1986
  constructor(localeProvider, numericService, changeDetector) {
@@ -1998,6 +2001,9 @@ class SkyNumericPipe {
1998
2001
  this.ngUnsubscribe.next();
1999
2002
  this.ngUnsubscribe.complete();
2000
2003
  }
2004
+ /**
2005
+ * Formats a number based on the provided options.
2006
+ */
2001
2007
  transform(value, config) {
2002
2008
  const newCacheKey = (config ? JSON.stringify(config, Object.keys(config).sort()) : '') +
2003
2009
  `${value}_${config?.locale || this.providerLocale}`;
@@ -2478,19 +2484,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
2478
2484
  }]
2479
2485
  }] });
2480
2486
 
2487
+ var _SkyResizeObserverService_resizeObserver, _SkyResizeObserverService_tracking;
2481
2488
  /**
2482
2489
  * Service to create rxjs observables for changes to the content box dimensions of elements.
2483
2490
  */
2484
2491
  class SkyResizeObserverService {
2485
2492
  constructor(zone) {
2486
2493
  this.zone = zone;
2487
- this._tracking = [];
2488
- this._resizeObserver = new ResizeObserver((entries) => {
2494
+ _SkyResizeObserverService_resizeObserver.set(this, void 0);
2495
+ _SkyResizeObserverService_tracking.set(this, []);
2496
+ __classPrivateFieldSet(this, _SkyResizeObserverService_resizeObserver, new ResizeObserver((entries) => {
2489
2497
  entries.forEach((entry) => this.callback(entry));
2490
- });
2498
+ }), "f");
2491
2499
  }
2492
2500
  ngOnDestroy() {
2493
- this._resizeObserver.disconnect();
2501
+ __classPrivateFieldGet(this, _SkyResizeObserverService_resizeObserver, "f").disconnect();
2494
2502
  }
2495
2503
  /**
2496
2504
  * Create rxjs observable to get size changes for an element ref.
@@ -2499,22 +2507,22 @@ class SkyResizeObserverService {
2499
2507
  return this.observeAndTrack(element).subjectObservable;
2500
2508
  }
2501
2509
  observeAndTrack(element) {
2502
- const checkTracking = this._tracking.findIndex((value) => {
2510
+ const checkTracking = __classPrivateFieldGet(this, _SkyResizeObserverService_tracking, "f").findIndex((value) => {
2503
2511
  return !value.subject.closed && value.element === element.nativeElement;
2504
2512
  });
2505
2513
  if (checkTracking === -1) {
2506
- this._resizeObserver.observe(element.nativeElement);
2514
+ __classPrivateFieldGet(this, _SkyResizeObserverService_resizeObserver, "f").observe(element.nativeElement);
2507
2515
  }
2508
2516
  const subject = new Subject();
2509
2517
  const subjectObservable = subject.pipe(finalize(() => {
2510
2518
  // Are there any other tracking entries still watching this element?
2511
- const checkTracking = this._tracking.findIndex((value) => {
2519
+ const checkTracking = __classPrivateFieldGet(this, _SkyResizeObserverService_tracking, "f").findIndex((value) => {
2512
2520
  return (value.subject !== subject &&
2513
2521
  !value.subject.closed &&
2514
2522
  value.element === element.nativeElement);
2515
2523
  });
2516
2524
  if (checkTracking === -1) {
2517
- this._resizeObserver.unobserve(element.nativeElement);
2525
+ __classPrivateFieldGet(this, _SkyResizeObserverService_resizeObserver, "f").unobserve(element.nativeElement);
2518
2526
  }
2519
2527
  }));
2520
2528
  const tracking = {
@@ -2522,15 +2530,17 @@ class SkyResizeObserverService {
2522
2530
  subject,
2523
2531
  subjectObservable,
2524
2532
  };
2525
- this._tracking.push(tracking);
2533
+ __classPrivateFieldGet(this, _SkyResizeObserverService_tracking, "f").push(tracking);
2526
2534
  return tracking;
2527
2535
  }
2528
2536
  callback(entry) {
2529
- this._tracking
2537
+ __classPrivateFieldGet(this, _SkyResizeObserverService_tracking, "f")
2530
2538
  .filter((value) => !(value.subject.closed || value.subject.isStopped))
2531
2539
  .forEach((value) => {
2532
2540
  /* istanbul ignore else */
2533
2541
  if (value.element === entry.target) {
2542
+ // Execute the callback within NgZone because Angular does not "monkey patch"
2543
+ // ResizeObserver like it does for other features in the DOM.
2534
2544
  this.zone.run(() => {
2535
2545
  value.subject.next(entry);
2536
2546
  });
@@ -2538,6 +2548,7 @@ class SkyResizeObserverService {
2538
2548
  });
2539
2549
  }
2540
2550
  }
2551
+ _SkyResizeObserverService_resizeObserver = new WeakMap(), _SkyResizeObserverService_tracking = new WeakMap();
2541
2552
  SkyResizeObserverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyResizeObserverService, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
2542
2553
  SkyResizeObserverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyResizeObserverService, providedIn: 'any' });
2543
2554
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyResizeObserverService, decorators: [{
@@ -2547,15 +2558,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
2547
2558
  }]
2548
2559
  }], ctorParameters: function () { return [{ type: i0.NgZone }]; } });
2549
2560
 
2561
+ var _SkyResizeObserverMediaQueryService_breakpoints, _SkyResizeObserverMediaQueryService_currentBreakpointObservable, _SkyResizeObserverMediaQueryService_stopListening, _SkyResizeObserverMediaQueryService_target;
2550
2562
  /**
2551
2563
  * Acts like `SkyMediaQueryService` for a container element, emitting the same responsive breakpoints.
2552
2564
  */
2553
2565
  class SkyResizeObserverMediaQueryService {
2554
2566
  constructor(resizeObserverService) {
2555
2567
  this.resizeObserverService = resizeObserverService;
2556
- this._breakpoints = [
2568
+ _SkyResizeObserverMediaQueryService_breakpoints.set(this, [
2557
2569
  {
2558
- check: (width) => width <= 767,
2570
+ check: (width) => width > 0 && width <= 767,
2559
2571
  name: SkyMediaBreakpoints.xs,
2560
2572
  },
2561
2573
  {
@@ -2570,11 +2582,12 @@ class SkyResizeObserverMediaQueryService {
2570
2582
  check: (width) => width > 1199,
2571
2583
  name: SkyMediaBreakpoints.lg,
2572
2584
  },
2573
- ];
2574
- this._currentBreakpointObservable = new ReplaySubject(1);
2575
- this._stopListening = new Subject();
2576
- this._stopListening.subscribe(() => {
2577
- this._target = undefined;
2585
+ ]);
2586
+ _SkyResizeObserverMediaQueryService_currentBreakpointObservable.set(this, new ReplaySubject(1));
2587
+ _SkyResizeObserverMediaQueryService_stopListening.set(this, new Subject());
2588
+ _SkyResizeObserverMediaQueryService_target.set(this, void 0);
2589
+ __classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_stopListening, "f").subscribe(() => {
2590
+ __classPrivateFieldSet(this, _SkyResizeObserverMediaQueryService_target, undefined, "f");
2578
2591
  this.updateBreakpoint(undefined);
2579
2592
  });
2580
2593
  }
@@ -2585,10 +2598,10 @@ class SkyResizeObserverMediaQueryService {
2585
2598
  return this._currentBreakpoint;
2586
2599
  }
2587
2600
  ngOnDestroy() {
2588
- this._stopListening.next();
2601
+ __classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_stopListening, "f").next();
2589
2602
  this._currentBreakpoint = undefined;
2590
- this._stopListening.complete();
2591
- this._currentBreakpointObservable.complete();
2603
+ __classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_stopListening, "f").complete();
2604
+ __classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_currentBreakpointObservable, "f").complete();
2592
2605
  }
2593
2606
  /**
2594
2607
  * @internal
@@ -2601,25 +2614,21 @@ class SkyResizeObserverMediaQueryService {
2601
2614
  * time. Any previous subscriptions will be unsubscribed when a new element is observed.
2602
2615
  */
2603
2616
  observe(element) {
2604
- if (this._target) {
2605
- if (this._target === element) {
2617
+ if (__classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_target, "f")) {
2618
+ if (__classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_target, "f") === element) {
2606
2619
  return this;
2607
2620
  }
2608
- this._stopListening.next();
2609
- }
2610
- this._target = element;
2611
- const width = element.nativeElement.offsetWidth;
2612
- if (width) {
2613
- const breakpoint = this.checkBreakpoint(width);
2614
- this.updateBreakpoint(breakpoint);
2621
+ __classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_stopListening, "f").next();
2615
2622
  }
2623
+ __classPrivateFieldSet(this, _SkyResizeObserverMediaQueryService_target, element, "f");
2624
+ this.checkWidth(element);
2616
2625
  this.resizeObserverService
2617
2626
  .observe(element)
2618
- .pipe(takeUntil(this._stopListening))
2627
+ .pipe(takeUntil(__classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_stopListening, "f")))
2619
2628
  .subscribe((value) => {
2620
2629
  const breakpoint = this.checkBreakpoint(value.contentRect.width);
2621
2630
  /* istanbul ignore else */
2622
- if (breakpoint !== this._currentBreakpoint) {
2631
+ if (breakpoint !== this.current) {
2623
2632
  this.updateBreakpoint(breakpoint);
2624
2633
  }
2625
2634
  });
@@ -2629,25 +2638,39 @@ class SkyResizeObserverMediaQueryService {
2629
2638
  * Stop watching the container element.
2630
2639
  */
2631
2640
  unobserve() {
2632
- this._stopListening.next();
2641
+ __classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_stopListening, "f").next();
2633
2642
  }
2634
2643
  /**
2635
2644
  * Subscribes to element size changes that cross breakpoints.
2636
2645
  */
2637
2646
  subscribe(listener) {
2638
- return this._currentBreakpointObservable
2639
- .pipe(takeUntil(this._stopListening))
2640
- .subscribe(listener);
2647
+ return __classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_currentBreakpointObservable, "f")
2648
+ .pipe(takeUntil(__classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_stopListening, "f")))
2649
+ .subscribe((value) => {
2650
+ listener(value);
2651
+ });
2641
2652
  }
2642
2653
  updateBreakpoint(breakpoint) {
2643
2654
  this._currentBreakpoint = breakpoint;
2644
- this._currentBreakpointObservable.next(breakpoint);
2655
+ __classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_currentBreakpointObservable, "f").next(breakpoint);
2645
2656
  }
2646
2657
  checkBreakpoint(width) {
2647
- return this._breakpoints.find((breakpoint) => breakpoint.check(width))
2648
- ?.name;
2658
+ const breakpoint = __classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_breakpoints, "f").find((breakpoint) => breakpoint.check(width));
2659
+ /* istanbul ignore else */
2660
+ if (breakpoint) {
2661
+ return breakpoint.name;
2662
+ }
2663
+ }
2664
+ checkWidth(element) {
2665
+ const width = element.nativeElement.offsetWidth || 0;
2666
+ const breakpoint = this.checkBreakpoint(width);
2667
+ /* istanbul ignore else */
2668
+ if (breakpoint !== this._currentBreakpoint) {
2669
+ this.updateBreakpoint(breakpoint);
2670
+ }
2649
2671
  }
2650
2672
  }
2673
+ _SkyResizeObserverMediaQueryService_breakpoints = new WeakMap(), _SkyResizeObserverMediaQueryService_currentBreakpointObservable = new WeakMap(), _SkyResizeObserverMediaQueryService_stopListening = new WeakMap(), _SkyResizeObserverMediaQueryService_target = new WeakMap();
2651
2674
  SkyResizeObserverMediaQueryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyResizeObserverMediaQueryService, deps: [{ token: SkyResizeObserverService }], target: i0.ɵɵFactoryTarget.Injectable });
2652
2675
  SkyResizeObserverMediaQueryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyResizeObserverMediaQueryService, providedIn: 'any' });
2653
2676
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyResizeObserverMediaQueryService, decorators: [{
@@ -2678,8 +2701,7 @@ class SkyScrollableHostService {
2678
2701
  /**
2679
2702
  * Returns an observable which emits the given element's current scrollable host
2680
2703
  * @param elementRef The element whose scrollable host is being requested
2681
- * @param completionObservable An observable which alerts the internal observers that they should complete
2682
- * @returns An observable which emits the current scrollable host
2704
+ * @returns An observable which emits the current scrollable host element.
2683
2705
  * @internal
2684
2706
  */
2685
2707
  watchScrollableHost(elementRef) {
@@ -2689,11 +2711,13 @@ class SkyScrollableHostService {
2689
2711
  return new Observable((subscriber) => {
2690
2712
  subscribers.push(subscriber);
2691
2713
  let scrollableHost = this.findScrollableHost(elementRef.nativeElement);
2714
+ // Setup mutation observers only once, for all subscribers.
2692
2715
  if (subscribers.length === 1) {
2693
2716
  parentMutationObserver = this.mutationObserverSvc.create(() => {
2694
2717
  const newScrollableHost = this.findScrollableHost(elementRef.nativeElement);
2718
+ // Reset observer if scrollable host changes.
2695
2719
  if (newScrollableHost !== scrollableHost &&
2696
- elementRef.nativeElement.offsetParent) {
2720
+ this.isElementVisible(elementRef)) {
2697
2721
  scrollableHost = newScrollableHost;
2698
2722
  this.observeForScrollableHostChanges(scrollableHost, parentMutationObserver);
2699
2723
  notifySubscribers(subscribers, scrollableHost);
@@ -2701,7 +2725,9 @@ class SkyScrollableHostService {
2701
2725
  });
2702
2726
  this.observeForScrollableHostChanges(scrollableHost, parentMutationObserver);
2703
2727
  documentHiddenElementMutationObserver = this.mutationObserverSvc.create(() => {
2704
- if (scrollableHost && !elementRef.nativeElement.offsetParent) {
2728
+ if (scrollableHost && !this.isElementVisible(elementRef)) {
2729
+ // If the scrollable host is not visible, set it to undefined and unsubscribe from its mutation changes.
2730
+ // Then, observe the document element so that a new scrollable host can be found.
2705
2731
  scrollableHost = undefined;
2706
2732
  this.observeForScrollableHostChanges(scrollableHost, parentMutationObserver);
2707
2733
  notifySubscribers(subscribers, scrollableHost);
@@ -2709,10 +2735,11 @@ class SkyScrollableHostService {
2709
2735
  });
2710
2736
  this.observeDocumentHiddenElementChanges(documentHiddenElementMutationObserver);
2711
2737
  }
2738
+ // Emit the scrollable host to the subscriber.
2712
2739
  subscriber.next(scrollableHost);
2740
+ // Teardown callback for the subscription.
2713
2741
  subscriber.add(() => {
2714
2742
  const subIndex = subscribers.indexOf(subscriber);
2715
- /* sanity check */
2716
2743
  /* istanbul ignore else */
2717
2744
  if (subIndex >= 0) {
2718
2745
  subscribers.splice(subIndex, 1);
@@ -2727,7 +2754,6 @@ class SkyScrollableHostService {
2727
2754
  /**
2728
2755
  * Returns an observable which emits whenever the element's scrollable host emits a scroll event. The observable will always emit the scroll events from the elements current scrollable host and will update based on any scrollable host changes. The observable will also emit once whenever the scrollable host changes.
2729
2756
  * @param elementRef The element whose scrollable host scroll events are being requested
2730
- * @param completionObservable An observable which alerts the internal observers that they should complete
2731
2757
  * @returns An observable which emits when the elements scrollable host is scrolled or is changed
2732
2758
  */
2733
2759
  watchScrollableHostScrollEvents(elementRef) {
@@ -2738,6 +2764,7 @@ class SkyScrollableHostService {
2738
2764
  let scrollEventSubscription;
2739
2765
  return new Observable((subscriber) => {
2740
2766
  subscribers.push(subscriber);
2767
+ // Setup mutation observers only once, for all subscribers.
2741
2768
  if (subscribers.length === 1) {
2742
2769
  scrollableHostSubscription = this.watchScrollableHost(elementRef).subscribe((newScrollableHost) => {
2743
2770
  newScrollableHostObservable.next();
@@ -2747,6 +2774,8 @@ class SkyScrollableHostService {
2747
2774
  }
2748
2775
  scrollableHost = newScrollableHost;
2749
2776
  newScrollableHostObservable = new Subject();
2777
+ // Only subscribe to scroll events if the host element is defined.
2778
+ /* istanbul ignore else */
2750
2779
  if (newScrollableHost) {
2751
2780
  scrollEventSubscription = fromEvent(newScrollableHost, 'scroll')
2752
2781
  .pipe(takeUntil(newScrollableHostObservable))
@@ -2756,9 +2785,9 @@ class SkyScrollableHostService {
2756
2785
  }
2757
2786
  });
2758
2787
  }
2788
+ // Teardown callback for the subscription.
2759
2789
  subscriber.add(() => {
2760
2790
  const subIndex = subscribers.indexOf(subscriber);
2761
- /* sanity check */
2762
2791
  /* istanbul ignore else */
2763
2792
  if (subIndex >= 0) {
2764
2793
  subscribers.splice(subIndex, 1);
@@ -2775,7 +2804,6 @@ class SkyScrollableHostService {
2775
2804
  const regex = /(auto|scroll)/;
2776
2805
  const windowObj = this.windowRef.nativeWindow;
2777
2806
  const bodyObj = windowObj.document.body;
2778
- /* Sanity check */
2779
2807
  if (!element) {
2780
2808
  return windowObj;
2781
2809
  }
@@ -2783,7 +2811,7 @@ class SkyScrollableHostService {
2783
2811
  let parent = element;
2784
2812
  do {
2785
2813
  parent = parent.parentNode;
2786
- /* Sanity check for if this function is called for an element which has been removed from the DOM */
2814
+ // Return `window` if the parent element has been removed from the DOM.
2787
2815
  if (!(parent instanceof HTMLElement)) {
2788
2816
  return windowObj;
2789
2817
  }
@@ -2806,22 +2834,20 @@ class SkyScrollableHostService {
2806
2834
  }
2807
2835
  observeForScrollableHostChanges(element, mutationObserver) {
2808
2836
  mutationObserver.disconnect();
2809
- if (element instanceof HTMLElement) {
2810
- mutationObserver.observe(element, {
2811
- attributes: true,
2812
- attributeFilter: ['class', 'style'],
2813
- childList: true,
2814
- subtree: true,
2815
- });
2816
- }
2817
- else {
2818
- mutationObserver.observe(document.documentElement, {
2819
- attributes: true,
2820
- attributeFilter: ['class', 'style'],
2821
- childList: true,
2822
- subtree: true,
2823
- });
2824
- }
2837
+ const target = element instanceof HTMLElement ? element : document.documentElement;
2838
+ mutationObserver.observe(target, {
2839
+ attributes: true,
2840
+ attributeFilter: ['class', 'style'],
2841
+ childList: true,
2842
+ subtree: true,
2843
+ });
2844
+ }
2845
+ /**
2846
+ * Determines if an element is "visible" in the DOM.
2847
+ * @see https://stackoverflow.com/a/11639664/6178885
2848
+ */
2849
+ isElementVisible(elementRef) {
2850
+ return elementRef.nativeElement.offsetParent;
2825
2851
  }
2826
2852
  }
2827
2853
  SkyScrollableHostService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyScrollableHostService, deps: [{ token: MutationObserverService }, { token: SkyAppWindowRef }], target: i0.ɵɵFactoryTarget.Injectable });