@skyux/core 11.15.0 → 11.16.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.
- package/documentation.json +2408 -1407
- package/esm2022/index.mjs +6 -1
- package/esm2022/lib/modules/adapter-service/adapter.service.mjs +12 -27
- package/esm2022/lib/modules/breakpoint-observer/breakpoint-observer.mjs +2 -0
- package/esm2022/lib/modules/breakpoint-observer/breakpoint-observer.token.mjs +7 -0
- package/esm2022/lib/modules/breakpoint-observer/breakpoint-utils.mjs +38 -0
- package/esm2022/lib/modules/breakpoint-observer/breakpoint.mjs +5 -0
- package/esm2022/lib/modules/breakpoint-observer/container-breakpoint-observer.mjs +64 -0
- package/esm2022/lib/modules/breakpoint-observer/media-breakpoint-observer.mjs +58 -0
- package/esm2022/lib/modules/breakpoint-observer/provide-breakpoint-observer.mjs +24 -0
- package/esm2022/lib/modules/breakpoint-observer/responsive-host.directive.mjs +55 -0
- package/esm2022/lib/modules/media-query/media-breakpoints.mjs +5 -1
- package/esm2022/lib/modules/media-query/media-query-listener.mjs +1 -1
- package/esm2022/lib/modules/media-query/media-query.service.mjs +34 -77
- package/esm2022/lib/modules/resize-observer/resize-observer-media-query.service.mjs +18 -3
- package/esm2022/testing/media-query/breakpoint-observer-testing.mjs +26 -0
- package/esm2022/testing/media-query/media-query-testing-controller.mjs +22 -0
- package/esm2022/testing/media-query/provide-media-query-testing.mjs +26 -0
- package/esm2022/testing/mock-media-query.service.mjs +3 -1
- package/esm2022/testing/public-api.mjs +6 -3
- package/esm2022/testing/resize-observer-mock.mjs +11 -1
- package/esm2022/testing/shared/input-harness.mjs +63 -0
- package/esm2022/version.mjs +1 -1
- package/fesm2022/skyux-core-testing.mjs +213 -74
- package/fesm2022/skyux-core-testing.mjs.map +1 -1
- package/fesm2022/skyux-core.mjs +422 -236
- package/fesm2022/skyux-core.mjs.map +1 -1
- package/index.d.ts +8 -1
- package/lib/modules/adapter-service/adapter.service.d.ts +5 -3
- package/lib/modules/breakpoint-observer/breakpoint-observer.d.ts +9 -0
- package/lib/modules/breakpoint-observer/breakpoint-observer.token.d.ts +7 -0
- package/lib/modules/breakpoint-observer/breakpoint-utils.d.ts +17 -0
- package/lib/modules/breakpoint-observer/breakpoint.d.ts +8 -0
- package/lib/modules/breakpoint-observer/container-breakpoint-observer.d.ts +18 -0
- package/lib/modules/breakpoint-observer/media-breakpoint-observer.d.ts +18 -0
- package/lib/modules/breakpoint-observer/provide-breakpoint-observer.d.ts +7 -0
- package/lib/modules/breakpoint-observer/responsive-host.directive.d.ts +32 -0
- package/lib/modules/media-query/media-breakpoints.d.ts +4 -0
- package/lib/modules/media-query/media-query-listener.d.ts +1 -0
- package/lib/modules/media-query/media-query.service.d.ts +16 -6
- package/lib/modules/resize-observer/resize-observer-media-query.service.d.ts +10 -2
- package/package.json +2 -2
- package/testing/media-query/breakpoint-observer-testing.d.ts +15 -0
- package/testing/media-query/media-query-testing-controller.d.ts +15 -0
- package/testing/media-query/provide-media-query-testing.d.ts +5 -0
- package/testing/mock-media-query.service.d.ts +1 -0
- package/testing/public-api.d.ts +5 -2
- package/testing/resize-observer-mock.d.ts +9 -0
- package/testing/shared/input-harness.d.ts +36 -0
package/fesm2022/skyux-core.mjs
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { NgModule, Injectable, inject, RendererFactory2, NgZone, EventEmitter, Directive, Input, Output, EnvironmentInjector, createEnvironmentInjector, createComponent, ChangeDetectorRef, ElementRef, ViewContainerRef, Component, ChangeDetectionStrategy, ViewChild, InjectionToken, Optional, Inject, Pipe, HostBinding,
|
2
|
+
import { NgModule, Injectable, inject, RendererFactory2, NgZone, EventEmitter, Directive, Input, Output, EnvironmentInjector, createEnvironmentInjector, createComponent, ChangeDetectorRef, ElementRef, ViewContainerRef, Component, ChangeDetectionStrategy, ViewChild, InjectionToken, Optional, Inject, ApplicationRef, afterNextRender, Injector, Pipe, HostBinding, Renderer2, HostListener } from '@angular/core';
|
3
3
|
import * as i1$1 from '@angular/common';
|
4
4
|
import { DOCUMENT, CommonModule } from '@angular/common';
|
5
|
-
import { Subject, Subscription, ReplaySubject, fromEvent, of,
|
5
|
+
import { Subject, Subscription, ReplaySubject, fromEvent, of, Observable, filter, map, distinctUntilChanged, shareReplay, throttle, animationFrames, take, takeUntil as takeUntil$1, BehaviorSubject, concat, animationFrameScheduler } from 'rxjs';
|
6
6
|
import { takeUntil, debounceTime, switchMap, map as map$1 } from 'rxjs/operators';
|
7
7
|
import { ViewportRuler } from '@angular/cdk/overlay';
|
8
|
+
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
8
9
|
import * as i1 from '@skyux/i18n';
|
9
10
|
import { SkyLibResourcesService, getLibStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS, SkyIntlNumberFormatStyle, SkyIntlNumberFormatter } from '@skyux/i18n';
|
10
11
|
import { Router, NavigationStart } from '@angular/router';
|
@@ -24,6 +25,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
|
|
24
25
|
args: [{}]
|
25
26
|
}] });
|
26
27
|
|
28
|
+
/**
|
29
|
+
* @internal
|
30
|
+
*/
|
31
|
+
const SKY_BREAKPOINTS = ['xs', 'sm', 'md', 'lg'];
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Represents all available media breakpoints.
|
35
|
+
* @deprecated Use `SkyBreakpoint` instead.
|
36
|
+
*/
|
27
37
|
var SkyMediaBreakpoints;
|
28
38
|
(function (SkyMediaBreakpoints) {
|
29
39
|
/**
|
@@ -44,6 +54,42 @@ var SkyMediaBreakpoints;
|
|
44
54
|
SkyMediaBreakpoints[SkyMediaBreakpoints["lg"] = 4] = "lg";
|
45
55
|
})(SkyMediaBreakpoints || (SkyMediaBreakpoints = {}));
|
46
56
|
|
57
|
+
const breakpointLookup = new Map([
|
58
|
+
[SkyMediaBreakpoints.xs, 'xs'],
|
59
|
+
[SkyMediaBreakpoints.sm, 'sm'],
|
60
|
+
[SkyMediaBreakpoints.md, 'md'],
|
61
|
+
[SkyMediaBreakpoints.lg, 'lg'],
|
62
|
+
]);
|
63
|
+
const legacyLookup = new Map([
|
64
|
+
['xs', SkyMediaBreakpoints.xs],
|
65
|
+
['sm', SkyMediaBreakpoints.sm],
|
66
|
+
['md', SkyMediaBreakpoints.md],
|
67
|
+
['lg', SkyMediaBreakpoints.lg],
|
68
|
+
]);
|
69
|
+
/**
|
70
|
+
* Whether the value is of type `SkyBreakpoint`.
|
71
|
+
* @internal
|
72
|
+
*/
|
73
|
+
function isSkyBreakpoint(value) {
|
74
|
+
return (value !== null &&
|
75
|
+
value !== undefined &&
|
76
|
+
SKY_BREAKPOINTS.includes(value));
|
77
|
+
}
|
78
|
+
/**
|
79
|
+
* Transforms a `SkyMediaBreakpoints` value to `SkyBreakpoint`.
|
80
|
+
* @internal
|
81
|
+
*/
|
82
|
+
function toSkyBreakpoint(breakpoint) {
|
83
|
+
return breakpointLookup.get(breakpoint);
|
84
|
+
}
|
85
|
+
/**
|
86
|
+
* Transforms a `SkyBreakpoint` value to `SkyMediaBreakpoints`.
|
87
|
+
* @internal
|
88
|
+
*/
|
89
|
+
function toSkyMediaBreakpoints(breakpoint) {
|
90
|
+
return legacyLookup.get(breakpoint);
|
91
|
+
}
|
92
|
+
|
47
93
|
const SKY_TABBABLE_SELECTOR = [
|
48
94
|
'a[href]',
|
49
95
|
'area[href]',
|
@@ -66,35 +112,19 @@ class SkyCoreAdapterService {
|
|
66
112
|
* Set the responsive container CSS class for a given element.
|
67
113
|
*
|
68
114
|
* @param elementRef - The element that will receive the new CSS class.
|
69
|
-
* @param breakpoint - The
|
70
|
-
*
|
115
|
+
* @param breakpoint - The breakpoint to determine which class gets set.
|
116
|
+
* For example a breakpoint of "xs" will set a CSS class of "sky-responsive-container-xs".
|
117
|
+
* @deprecated Use the `SkyResponsiveHostDirective` instead.
|
71
118
|
*/
|
72
119
|
setResponsiveContainerClass(elementRef, breakpoint) {
|
73
120
|
const nativeEl = elementRef.nativeElement;
|
74
|
-
|
75
|
-
|
76
|
-
this.#renderer.removeClass(nativeEl, 'sky-responsive-container-md');
|
77
|
-
this.#renderer.removeClass(nativeEl, 'sky-responsive-container-lg');
|
78
|
-
let newClass;
|
79
|
-
switch (breakpoint) {
|
80
|
-
case SkyMediaBreakpoints.xs: {
|
81
|
-
newClass = 'sky-responsive-container-xs';
|
82
|
-
break;
|
83
|
-
}
|
84
|
-
case SkyMediaBreakpoints.sm: {
|
85
|
-
newClass = 'sky-responsive-container-sm';
|
86
|
-
break;
|
87
|
-
}
|
88
|
-
case SkyMediaBreakpoints.md: {
|
89
|
-
newClass = 'sky-responsive-container-md';
|
90
|
-
break;
|
91
|
-
}
|
92
|
-
default: {
|
93
|
-
newClass = 'sky-responsive-container-lg';
|
94
|
-
break;
|
95
|
-
}
|
121
|
+
for (const breakpointType of SKY_BREAKPOINTS) {
|
122
|
+
this.#renderer.removeClass(nativeEl, `sky-responsive-container-${breakpointType}`);
|
96
123
|
}
|
97
|
-
|
124
|
+
if (!isSkyBreakpoint(breakpoint)) {
|
125
|
+
breakpoint = toSkyBreakpoint(breakpoint);
|
126
|
+
}
|
127
|
+
this.#renderer.addClass(nativeEl, `sky-responsive-container-${breakpoint}`);
|
98
128
|
}
|
99
129
|
/**
|
100
130
|
* This method temporarily enables/disables pointer events.
|
@@ -1482,7 +1512,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
|
|
1482
1512
|
}]
|
1483
1513
|
}] } });
|
1484
1514
|
|
1485
|
-
var _a$
|
1515
|
+
var _a$1;
|
1486
1516
|
/**
|
1487
1517
|
* This service docks components to specific areas on the page.
|
1488
1518
|
*/
|
@@ -1492,7 +1522,7 @@ class SkyDockService {
|
|
1492
1522
|
* Returns all docked items.
|
1493
1523
|
*/
|
1494
1524
|
get items() {
|
1495
|
-
return _a$
|
1525
|
+
return _a$1._items;
|
1496
1526
|
}
|
1497
1527
|
#dynamicComponentSvc;
|
1498
1528
|
#options;
|
@@ -1505,19 +1535,19 @@ class SkyDockService {
|
|
1505
1535
|
* @param config Options that affect the docking action.
|
1506
1536
|
*/
|
1507
1537
|
insertComponent(component, config) {
|
1508
|
-
const dockRef = (_a$
|
1509
|
-
_a$
|
1538
|
+
const dockRef = (_a$1.dockRef =
|
1539
|
+
_a$1.dockRef || this.#createDock());
|
1510
1540
|
const itemRef = dockRef.instance.insertComponent(component, config);
|
1511
1541
|
const item = new SkyDockItem(itemRef.componentRef.instance, itemRef.stackOrder);
|
1512
1542
|
item.destroyed.subscribe(() => {
|
1513
1543
|
dockRef.instance.removeItem(itemRef);
|
1514
|
-
_a$
|
1515
|
-
if (_a$
|
1544
|
+
_a$1._items.splice(_a$1._items.indexOf(item), 1);
|
1545
|
+
if (_a$1._items.length === 0) {
|
1516
1546
|
this.#destroyDock();
|
1517
1547
|
}
|
1518
1548
|
});
|
1519
|
-
_a$
|
1520
|
-
_a$
|
1549
|
+
_a$1._items.push(item);
|
1550
|
+
_a$1._items.sort(sortByStackOrder);
|
1521
1551
|
return item;
|
1522
1552
|
}
|
1523
1553
|
/**
|
@@ -1555,13 +1585,13 @@ class SkyDockService {
|
|
1555
1585
|
return dockRef;
|
1556
1586
|
}
|
1557
1587
|
#destroyDock() {
|
1558
|
-
this.#dynamicComponentSvc.removeComponent(_a$
|
1559
|
-
_a$
|
1588
|
+
this.#dynamicComponentSvc.removeComponent(_a$1.dockRef);
|
1589
|
+
_a$1.dockRef = undefined;
|
1560
1590
|
}
|
1561
1591
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyDockService, deps: [{ token: SkyDynamicComponentService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
1562
1592
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyDockService, providedIn: 'root' }); }
|
1563
1593
|
}
|
1564
|
-
_a$
|
1594
|
+
_a$1 = SkyDockService;
|
1565
1595
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyDockService, decorators: [{
|
1566
1596
|
type: Injectable,
|
1567
1597
|
args: [{
|
@@ -1955,22 +1985,248 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
|
|
1955
1985
|
}] }] });
|
1956
1986
|
|
1957
1987
|
/**
|
1958
|
-
*
|
1959
|
-
*
|
1988
|
+
* Used to override a breakpoint observer for specific execution contexts.
|
1989
|
+
* @internal
|
1960
1990
|
*/
|
1961
|
-
|
1962
|
-
|
1963
|
-
|
1964
|
-
|
1991
|
+
const SKY_BREAKPOINT_OBSERVER = new InjectionToken('SKY_BREAKPOINT_OBSERVER');
|
1992
|
+
|
1993
|
+
const errorTest = /ResizeObserver loop completed with undelivered notifications/i;
|
1994
|
+
let errorLogRegistered = false;
|
1995
|
+
let originalOnError = undefined;
|
1996
|
+
const errorHandler = (event) => {
|
1997
|
+
if (errorTest.test(event.message)) {
|
1998
|
+
event.stopImmediatePropagation();
|
1999
|
+
event.stopPropagation();
|
2000
|
+
event.preventDefault();
|
2001
|
+
return false;
|
2002
|
+
}
|
2003
|
+
return undefined;
|
2004
|
+
};
|
2005
|
+
const onError = (event) => {
|
2006
|
+
const message = typeof event === 'string' ? event : event.message;
|
2007
|
+
// This is necessary to prevent the test runner from failing on errors, but challenging to reliably test.
|
2008
|
+
/* istanbul ignore next */
|
2009
|
+
if (errorTest.test(message)) {
|
2010
|
+
if (event instanceof ErrorEvent) {
|
2011
|
+
event.stopImmediatePropagation();
|
2012
|
+
event.stopPropagation();
|
2013
|
+
event.preventDefault();
|
2014
|
+
}
|
2015
|
+
return false;
|
2016
|
+
}
|
2017
|
+
return originalOnError?.call(window, event);
|
2018
|
+
};
|
2019
|
+
/**
|
2020
|
+
* Service to create rxjs observables for changes to the content box dimensions of elements.
|
2021
|
+
*/
|
2022
|
+
class SkyResizeObserverService {
|
2023
|
+
#ngUnsubscribe = new Subject();
|
2024
|
+
#resizeObserver = new ResizeObserver((entries) => this.#resizeSubject.next(entries));
|
2025
|
+
#resizeSubject = new Subject();
|
2026
|
+
#tracking = new Map();
|
2027
|
+
#window = inject(SkyAppWindowRef);
|
2028
|
+
#zone = inject(NgZone);
|
2029
|
+
constructor() {
|
2030
|
+
this.#expectWindowError();
|
2031
|
+
// Because the resize observer is a native browser API, it does not shut down
|
2032
|
+
// synchronously when the service is destroyed. Leave the error handling
|
2033
|
+
// accommodation in place until the application is destroyed. This also works
|
2034
|
+
// for the test runner.
|
2035
|
+
inject(ApplicationRef).onDestroy(() => this.#resetWindowError());
|
2036
|
+
}
|
2037
|
+
ngOnDestroy() {
|
2038
|
+
this.#ngUnsubscribe.next();
|
2039
|
+
this.#ngUnsubscribe.complete();
|
2040
|
+
this.#resizeObserver.disconnect();
|
2041
|
+
}
|
2042
|
+
/**
|
2043
|
+
* Create rxjs observable to get size changes for an element ref.
|
2044
|
+
*/
|
2045
|
+
observe(element) {
|
2046
|
+
const checkTracking = this.#tracking.has(element.nativeElement);
|
2047
|
+
if (!checkTracking) {
|
2048
|
+
this.#tracking.set(element.nativeElement, new Observable((observer) => {
|
2049
|
+
const subscription = this.#resizeSubject.subscribe(observer);
|
2050
|
+
this.#resizeObserver?.observe(element.nativeElement);
|
2051
|
+
return () => {
|
2052
|
+
this.#resizeObserver?.unobserve(element.nativeElement);
|
2053
|
+
subscription.unsubscribe();
|
2054
|
+
this.#tracking.delete(element.nativeElement);
|
2055
|
+
};
|
2056
|
+
}).pipe(filter(Boolean), filter((entries) => entries.some((entry) => entry.target === element.nativeElement)), map((entries) => entries.find((entry) => entry.target === element.nativeElement)),
|
2057
|
+
// Ignore subpixel changes.
|
2058
|
+
distinctUntilChanged((a, b) => Math.round(a.contentRect.width) ===
|
2059
|
+
Math.round(b.contentRect.width) &&
|
2060
|
+
Math.round(a.contentRect.height) ===
|
2061
|
+
Math.round(b.contentRect.height)),
|
2062
|
+
// Emit the last value for late subscribers. Track references so it
|
2063
|
+
// un-observes when all subscribers are gone.
|
2064
|
+
shareReplay({ bufferSize: 1, refCount: true }),
|
2065
|
+
// Only emit prior to an animation frame to prevent layout thrashing.
|
2066
|
+
throttle(() => animationFrames().pipe(take(1)), {
|
2067
|
+
leading: false,
|
2068
|
+
trailing: true,
|
2069
|
+
}), takeUntil$1(this.#ngUnsubscribe)));
|
2070
|
+
}
|
2071
|
+
return this.#tracking.get(element.nativeElement);
|
2072
|
+
}
|
2073
|
+
#expectWindowError() {
|
2074
|
+
if (!errorLogRegistered) {
|
2075
|
+
errorLogRegistered = true;
|
2076
|
+
// ResizeObserver throws an error when it is disconnected while it is
|
2077
|
+
// still observing an element. When an element is no longer observed, this
|
2078
|
+
// is not a concern.
|
2079
|
+
this.#zone.runOutsideAngular(() => this.#window.nativeWindow.addEventListener('error', errorHandler));
|
2080
|
+
}
|
2081
|
+
if (this.#window.nativeWindow.onerror !== onError) {
|
2082
|
+
originalOnError = this.#window.nativeWindow.onerror;
|
2083
|
+
this.#window.nativeWindow.onerror = onError;
|
2084
|
+
}
|
2085
|
+
}
|
2086
|
+
#resetWindowError() {
|
2087
|
+
this.#window.nativeWindow.removeEventListener('error', errorHandler);
|
2088
|
+
if (originalOnError) {
|
2089
|
+
this.#window.nativeWindow.onerror = originalOnError;
|
2090
|
+
originalOnError = undefined;
|
2091
|
+
}
|
2092
|
+
errorLogRegistered = false;
|
2093
|
+
}
|
2094
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyResizeObserverService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
2095
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyResizeObserverService, providedIn: 'root' }); }
|
1965
2096
|
}
|
1966
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type:
|
1967
|
-
type:
|
1968
|
-
args: [{
|
1969
|
-
|
2097
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyResizeObserverService, decorators: [{
|
2098
|
+
type: Injectable,
|
2099
|
+
args: [{
|
2100
|
+
providedIn: 'root',
|
2101
|
+
}]
|
2102
|
+
}], ctorParameters: () => [] });
|
2103
|
+
|
2104
|
+
const QUERIES$1 = [
|
2105
|
+
['xs', (width) => width > 0 && width <= 767],
|
2106
|
+
['sm', (width) => width > 767 && width <= 991],
|
2107
|
+
['md', (width) => width > 991 && width <= 1199],
|
2108
|
+
['lg', (width) => width > 1199],
|
2109
|
+
];
|
2110
|
+
/**
|
2111
|
+
* Emits when the width of the host container changes.
|
2112
|
+
* @internal
|
2113
|
+
*/
|
2114
|
+
class SkyContainerBreakpointObserver {
|
2115
|
+
#elementRef = inject(ElementRef);
|
2116
|
+
#resizeObserver = inject(SkyResizeObserverService);
|
2117
|
+
get breakpointChange() {
|
2118
|
+
return this.#breakpointChangeObs;
|
2119
|
+
}
|
2120
|
+
#breakpoint;
|
2121
|
+
#breakpointChange = new ReplaySubject(1);
|
2122
|
+
#breakpointChangeObs = this.#breakpointChange.asObservable();
|
2123
|
+
constructor() {
|
2124
|
+
this.#resizeObserver
|
2125
|
+
.observe(this.#elementRef)
|
2126
|
+
.pipe(takeUntilDestroyed())
|
2127
|
+
.subscribe((entry) => {
|
2128
|
+
this.#checkBreakpoint(entry.contentRect.width);
|
2129
|
+
});
|
2130
|
+
afterNextRender(() => {
|
2131
|
+
this.#checkWidth();
|
2132
|
+
});
|
2133
|
+
}
|
2134
|
+
ngOnDestroy() {
|
2135
|
+
this.destroy();
|
2136
|
+
}
|
2137
|
+
destroy() {
|
2138
|
+
this.#breakpointChange.complete();
|
2139
|
+
}
|
2140
|
+
#checkBreakpoint(width) {
|
2141
|
+
for (const [breakpoint, check] of QUERIES$1) {
|
2142
|
+
if (breakpoint !== this.#breakpoint && check(width)) {
|
2143
|
+
this.#breakpoint = breakpoint;
|
2144
|
+
this.#notifyBreakpointChange(breakpoint);
|
2145
|
+
break;
|
2146
|
+
}
|
2147
|
+
}
|
2148
|
+
}
|
2149
|
+
#checkWidth() {
|
2150
|
+
const width = this.#elementRef.nativeElement.offsetWidth ?? 0;
|
2151
|
+
this.#checkBreakpoint(width);
|
2152
|
+
}
|
2153
|
+
#notifyBreakpointChange(breakpoint) {
|
2154
|
+
this.#breakpointChange.next(breakpoint);
|
2155
|
+
}
|
2156
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyContainerBreakpointObserver, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
2157
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyContainerBreakpointObserver }); }
|
2158
|
+
}
|
2159
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyContainerBreakpointObserver, decorators: [{
|
2160
|
+
type: Injectable
|
2161
|
+
}], ctorParameters: () => [] });
|
2162
|
+
|
2163
|
+
const QUERIES = new Map([
|
2164
|
+
['xs', '(max-width: 767px)'],
|
2165
|
+
['sm', '(min-width: 768px) and (max-width: 991px)'],
|
2166
|
+
['md', '(min-width: 992px) and (max-width: 1199px)'],
|
2167
|
+
['lg', '(min-width: 1200px)'],
|
2168
|
+
]);
|
2169
|
+
/**
|
2170
|
+
* Emits when the viewport width changes.
|
2171
|
+
* @internal
|
2172
|
+
*/
|
2173
|
+
class SkyMediaBreakpointObserver {
|
2174
|
+
get breakpointChange() {
|
2175
|
+
return this.#breakpointChangeObs;
|
2176
|
+
}
|
2177
|
+
#breakpointChange = new ReplaySubject(1);
|
2178
|
+
#breakpointChangeObs = this.#breakpointChange.asObservable();
|
2179
|
+
#listeners = new Map();
|
2180
|
+
constructor() {
|
2181
|
+
for (const [breakpoint, query] of QUERIES.entries()) {
|
2182
|
+
const mq = matchMedia(query);
|
2183
|
+
const listener = (evt) => {
|
2184
|
+
if (evt.matches) {
|
2185
|
+
this.#notifyBreakpointChange(breakpoint);
|
2186
|
+
}
|
2187
|
+
};
|
2188
|
+
mq.addEventListener('change', listener);
|
2189
|
+
if (mq.matches) {
|
2190
|
+
this.#notifyBreakpointChange(breakpoint);
|
2191
|
+
}
|
2192
|
+
this.#listeners.set(mq, listener);
|
2193
|
+
}
|
2194
|
+
}
|
2195
|
+
ngOnDestroy() {
|
2196
|
+
this.destroy();
|
2197
|
+
}
|
2198
|
+
destroy() {
|
2199
|
+
this.#breakpointChange.complete();
|
2200
|
+
for (const [query, listener] of this.#listeners.entries()) {
|
2201
|
+
query.removeEventListener('change', listener);
|
2202
|
+
}
|
2203
|
+
this.#listeners.clear();
|
2204
|
+
}
|
2205
|
+
#notifyBreakpointChange(breakpoint) {
|
2206
|
+
this.#breakpointChange.next(breakpoint);
|
2207
|
+
}
|
2208
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyMediaBreakpointObserver, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
2209
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyMediaBreakpointObserver, providedIn: 'root' }); }
|
2210
|
+
}
|
2211
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyMediaBreakpointObserver, decorators: [{
|
2212
|
+
type: Injectable,
|
2213
|
+
args: [{
|
2214
|
+
providedIn: 'root',
|
2215
|
+
}]
|
2216
|
+
}], ctorParameters: () => [] });
|
1970
2217
|
|
1971
|
-
var _a$1;
|
1972
2218
|
const DEFAULT_BREAKPOINT$1 = SkyMediaBreakpoints.md;
|
2219
|
+
/**
|
2220
|
+
* Utility used to subscribe to viewport and container breakpoint changes.
|
2221
|
+
*/
|
1973
2222
|
class SkyMediaQueryService {
|
2223
|
+
#breakpointObserver = inject(SkyMediaBreakpointObserver);
|
2224
|
+
/**
|
2225
|
+
* Emits when the breakpoint changes.
|
2226
|
+
*/
|
2227
|
+
get breakpointChange() {
|
2228
|
+
return this.#breakpointObserver.breakpointChange;
|
2229
|
+
}
|
1974
2230
|
/**
|
1975
2231
|
* The size for the `xs` breakpoint.
|
1976
2232
|
* @default "(max-width: 767px)"
|
@@ -1993,95 +2249,40 @@ class SkyMediaQueryService {
|
|
1993
2249
|
static { this.lg = '(min-width: 1200px)'; }
|
1994
2250
|
/**
|
1995
2251
|
* Returns the current breakpoint.
|
2252
|
+
* @deprecated Subscribe to the `breakpointChange` observable instead.
|
1996
2253
|
*/
|
1997
2254
|
get current() {
|
1998
|
-
return this.#currentBreakpoint;
|
1999
|
-
}
|
2000
|
-
#currentSubject = new BehaviorSubject(DEFAULT_BREAKPOINT$1);
|
2001
|
-
#currentBreakpoint = DEFAULT_BREAKPOINT$1;
|
2002
|
-
#breakpoints = [
|
2003
|
-
{
|
2004
|
-
mediaQueryString: _a$1.xs,
|
2005
|
-
name: SkyMediaBreakpoints.xs,
|
2006
|
-
},
|
2007
|
-
{
|
2008
|
-
mediaQueryString: _a$1.sm,
|
2009
|
-
name: SkyMediaBreakpoints.sm,
|
2010
|
-
},
|
2011
|
-
{
|
2012
|
-
mediaQueryString: _a$1.md,
|
2013
|
-
name: SkyMediaBreakpoints.md,
|
2014
|
-
},
|
2015
|
-
{
|
2016
|
-
mediaQueryString: _a$1.lg,
|
2017
|
-
name: SkyMediaBreakpoints.lg,
|
2018
|
-
},
|
2019
|
-
];
|
2020
|
-
#mediaQueries = [];
|
2021
|
-
#zone;
|
2022
|
-
constructor(zone) {
|
2023
|
-
this.#zone = zone;
|
2024
|
-
this.#addListeners();
|
2255
|
+
return this.#currentBreakpoint();
|
2025
2256
|
}
|
2257
|
+
#currentBreakpoint = toSignal(this.#breakpointObserver.breakpointChange.pipe(map((breakpoint) => toSkyMediaBreakpoints(breakpoint))), {
|
2258
|
+
initialValue: DEFAULT_BREAKPOINT$1,
|
2259
|
+
});
|
2260
|
+
// Keep NgZone as a constructor param so that consumer mocks don't encounter typing errors.
|
2261
|
+
constructor(_zone) { }
|
2026
2262
|
ngOnDestroy() {
|
2027
|
-
this
|
2028
|
-
|
2263
|
+
this.destroy();
|
2264
|
+
}
|
2265
|
+
/**
|
2266
|
+
* @internal
|
2267
|
+
*/
|
2268
|
+
destroy() {
|
2269
|
+
this.#breakpointObserver.destroy();
|
2029
2270
|
}
|
2030
2271
|
/**
|
2031
2272
|
* Subscribes to screen size changes.
|
2032
2273
|
* @param listener Specifies a function that is called when breakpoints change.
|
2274
|
+
* @deprecated Subscribe to the `breakpointChange` observable instead.
|
2033
2275
|
*/
|
2034
2276
|
subscribe(listener) {
|
2035
|
-
return this.#
|
2036
|
-
next: (
|
2037
|
-
listener(
|
2277
|
+
return this.#breakpointObserver.breakpointChange.subscribe({
|
2278
|
+
next: (breakpoint) => {
|
2279
|
+
listener(toSkyMediaBreakpoints(breakpoint));
|
2038
2280
|
},
|
2039
2281
|
});
|
2040
2282
|
}
|
2041
|
-
/**
|
2042
|
-
* @internal
|
2043
|
-
*/
|
2044
|
-
destroy() {
|
2045
|
-
this.#removeListeners();
|
2046
|
-
this.#currentSubject.complete();
|
2047
|
-
}
|
2048
|
-
#addListeners() {
|
2049
|
-
this.#mediaQueries = this.#breakpoints.map((breakpoint) => {
|
2050
|
-
const mq = matchMedia(breakpoint.mediaQueryString);
|
2051
|
-
const listener = (event) => {
|
2052
|
-
// Run the check outside of Angular's change detection since Angular
|
2053
|
-
// does not wrap matchMedia listeners in NgZone.
|
2054
|
-
// See: https://blog.assaf.co/angular-2-change-detection-zones-and-an-example/
|
2055
|
-
this.#zone.run(() => {
|
2056
|
-
if (event.matches) {
|
2057
|
-
this.#notifyBreakpointChange(breakpoint.name);
|
2058
|
-
}
|
2059
|
-
});
|
2060
|
-
};
|
2061
|
-
mq.addListener(listener);
|
2062
|
-
if (mq.matches) {
|
2063
|
-
this.#notifyBreakpointChange(breakpoint.name);
|
2064
|
-
}
|
2065
|
-
return {
|
2066
|
-
mediaQueryList: mq,
|
2067
|
-
listener,
|
2068
|
-
};
|
2069
|
-
});
|
2070
|
-
}
|
2071
|
-
#removeListeners() {
|
2072
|
-
this.#mediaQueries.forEach((mediaQuery) => {
|
2073
|
-
mediaQuery.mediaQueryList.removeListener(mediaQuery.listener);
|
2074
|
-
});
|
2075
|
-
this.#mediaQueries = [];
|
2076
|
-
}
|
2077
|
-
#notifyBreakpointChange(breakpoint) {
|
2078
|
-
this.#currentBreakpoint = breakpoint;
|
2079
|
-
this.#currentSubject.next(breakpoint);
|
2080
|
-
}
|
2081
2283
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyMediaQueryService, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
2082
2284
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyMediaQueryService, providedIn: 'root' }); }
|
2083
2285
|
}
|
2084
|
-
_a$1 = SkyMediaQueryService;
|
2085
2286
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyMediaQueryService, decorators: [{
|
2086
2287
|
type: Injectable,
|
2087
2288
|
args: [{
|
@@ -2089,6 +2290,89 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
|
|
2089
2290
|
}]
|
2090
2291
|
}], ctorParameters: () => [{ type: i0.NgZone }] });
|
2091
2292
|
|
2293
|
+
/**
|
2294
|
+
* Overrides the default media breakpoint observer with the given observer.
|
2295
|
+
* @internal
|
2296
|
+
*/
|
2297
|
+
function provideSkyBreakpointObserver(observer) {
|
2298
|
+
return [
|
2299
|
+
SkyMediaQueryService,
|
2300
|
+
observer,
|
2301
|
+
{
|
2302
|
+
provide: SkyMediaBreakpointObserver,
|
2303
|
+
useFactory() {
|
2304
|
+
return (
|
2305
|
+
// Yield to the injection token, if it's defined.
|
2306
|
+
inject(SKY_BREAKPOINT_OBSERVER, { optional: true }) ??
|
2307
|
+
inject(observer));
|
2308
|
+
},
|
2309
|
+
},
|
2310
|
+
];
|
2311
|
+
}
|
2312
|
+
|
2313
|
+
/**
|
2314
|
+
* Overrides the `SkyMediaQueryService` to emit breakpoint changes when the host
|
2315
|
+
* container is resized. This directive also adds SKY UX CSS classes to the
|
2316
|
+
* host element to allow for responsive styles.
|
2317
|
+
*/
|
2318
|
+
class SkyResponsiveHostDirective {
|
2319
|
+
#injector = inject(Injector);
|
2320
|
+
#mediaSvc = inject(SkyMediaQueryService);
|
2321
|
+
/**
|
2322
|
+
* Emits when the breakpoint changes.
|
2323
|
+
*/
|
2324
|
+
get breakpointChange() {
|
2325
|
+
return this.#mediaSvc.breakpointChange;
|
2326
|
+
}
|
2327
|
+
/**
|
2328
|
+
* The injector of the responsive host. Useful when displaying child components
|
2329
|
+
* via `ngTemplateOutlet`.
|
2330
|
+
* @example```
|
2331
|
+
* <my-container #responsiveHost="skyResponsiveHost">
|
2332
|
+
* <ng-container
|
2333
|
+
* [ngTemplateOutlet]="myTemplate"
|
2334
|
+
* [ngTemplateOutletInjector]="responsiveHost.injector"
|
2335
|
+
* />
|
2336
|
+
* </my-container>
|
2337
|
+
* ```
|
2338
|
+
*/
|
2339
|
+
get injector() {
|
2340
|
+
return this.#injector;
|
2341
|
+
}
|
2342
|
+
constructor() {
|
2343
|
+
const adapter = inject(SkyCoreAdapterService);
|
2344
|
+
const elementRef = inject(ElementRef);
|
2345
|
+
this.breakpointChange.subscribe((breakpoint) => {
|
2346
|
+
adapter.setResponsiveContainerClass(elementRef, breakpoint);
|
2347
|
+
});
|
2348
|
+
}
|
2349
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyResponsiveHostDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
2350
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.8", type: SkyResponsiveHostDirective, isStandalone: true, selector: "[skyResponsiveHost]", providers: [provideSkyBreakpointObserver(SkyContainerBreakpointObserver)], exportAs: ["skyResponsiveHost"], ngImport: i0 }); }
|
2351
|
+
}
|
2352
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyResponsiveHostDirective, decorators: [{
|
2353
|
+
type: Directive,
|
2354
|
+
args: [{
|
2355
|
+
exportAs: 'skyResponsiveHost',
|
2356
|
+
providers: [provideSkyBreakpointObserver(SkyContainerBreakpointObserver)],
|
2357
|
+
selector: '[skyResponsiveHost]',
|
2358
|
+
standalone: true,
|
2359
|
+
}]
|
2360
|
+
}], ctorParameters: () => [] });
|
2361
|
+
|
2362
|
+
/**
|
2363
|
+
* @deprecated The `SkyMediaQueryService` no longer needs the `SkyMediaQueryModule`.
|
2364
|
+
* The `SkyMediaQueryModule` can be removed from your project.
|
2365
|
+
*/
|
2366
|
+
class SkyMediaQueryModule {
|
2367
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyMediaQueryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
2368
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: SkyMediaQueryModule }); }
|
2369
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyMediaQueryModule }); }
|
2370
|
+
}
|
2371
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyMediaQueryModule, decorators: [{
|
2372
|
+
type: NgModule,
|
2373
|
+
args: [{}]
|
2374
|
+
}] });
|
2375
|
+
|
2092
2376
|
/* istanbul ignore file */
|
2093
2377
|
/**
|
2094
2378
|
* NOTICE: DO NOT MODIFY THIS FILE!
|
@@ -3063,128 +3347,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
|
|
3063
3347
|
}]
|
3064
3348
|
}] });
|
3065
3349
|
|
3066
|
-
const
|
3067
|
-
let errorLogRegistered = false;
|
3068
|
-
let originalOnError = undefined;
|
3069
|
-
const errorHandler = (event) => {
|
3070
|
-
if (errorTest.test(event.message)) {
|
3071
|
-
event.stopImmediatePropagation();
|
3072
|
-
event.stopPropagation();
|
3073
|
-
event.preventDefault();
|
3074
|
-
return false;
|
3075
|
-
}
|
3076
|
-
return undefined;
|
3077
|
-
};
|
3078
|
-
const onError = (event) => {
|
3079
|
-
const message = typeof event === 'string' ? event : event.message;
|
3080
|
-
// This is necessary to prevent the test runner from failing on errors, but challenging to reliably test.
|
3081
|
-
/* istanbul ignore next */
|
3082
|
-
if (errorTest.test(message)) {
|
3083
|
-
if (event instanceof ErrorEvent) {
|
3084
|
-
event.stopImmediatePropagation();
|
3085
|
-
event.stopPropagation();
|
3086
|
-
event.preventDefault();
|
3087
|
-
}
|
3088
|
-
return false;
|
3089
|
-
}
|
3090
|
-
return originalOnError?.call(window, event);
|
3091
|
-
};
|
3350
|
+
const DEFAULT_BREAKPOINT = SkyMediaBreakpoints.md;
|
3092
3351
|
/**
|
3093
|
-
*
|
3352
|
+
* Acts like `SkyMediaQueryService` for a container element, emitting the same responsive breakpoints.
|
3353
|
+
* @deprecated Use the `SkyResponsiveHostDirective` instead.
|
3094
3354
|
*/
|
3095
|
-
class
|
3096
|
-
#ngUnsubscribe = new Subject();
|
3097
|
-
#resizeObserver = new ResizeObserver((entries) => this.#resizeSubject.next(entries));
|
3098
|
-
#resizeSubject = new Subject();
|
3099
|
-
#tracking = new Map();
|
3100
|
-
#window = inject(SkyAppWindowRef);
|
3101
|
-
#zone = inject(NgZone);
|
3102
|
-
constructor() {
|
3103
|
-
this.#expectWindowError();
|
3104
|
-
// Because the resize observer is a native browser API, it does not shut down
|
3105
|
-
// synchronously when the service is destroyed. Leave the error handling
|
3106
|
-
// accommodation in place until the application is destroyed. This also works
|
3107
|
-
// for the test runner.
|
3108
|
-
inject(ApplicationRef).onDestroy(() => this.#resetWindowError());
|
3109
|
-
}
|
3110
|
-
ngOnDestroy() {
|
3111
|
-
this.#ngUnsubscribe.next();
|
3112
|
-
this.#ngUnsubscribe.complete();
|
3113
|
-
this.#resizeObserver.disconnect();
|
3114
|
-
}
|
3355
|
+
class SkyResizeObserverMediaQueryService extends SkyMediaQueryService {
|
3115
3356
|
/**
|
3116
|
-
*
|
3357
|
+
* Emits when the breakpoint changes.
|
3117
3358
|
*/
|
3118
|
-
|
3119
|
-
|
3120
|
-
if (!checkTracking) {
|
3121
|
-
this.#tracking.set(element.nativeElement, new Observable((observer) => {
|
3122
|
-
const subscription = this.#resizeSubject.subscribe(observer);
|
3123
|
-
this.#resizeObserver?.observe(element.nativeElement);
|
3124
|
-
return () => {
|
3125
|
-
this.#resizeObserver?.unobserve(element.nativeElement);
|
3126
|
-
subscription.unsubscribe();
|
3127
|
-
this.#tracking.delete(element.nativeElement);
|
3128
|
-
};
|
3129
|
-
}).pipe(filter(Boolean), filter((entries) => entries.some((entry) => entry.target === element.nativeElement)), map((entries) => entries.find((entry) => entry.target === element.nativeElement)),
|
3130
|
-
// Ignore subpixel changes.
|
3131
|
-
distinctUntilChanged((a, b) => Math.round(a.contentRect.width) ===
|
3132
|
-
Math.round(b.contentRect.width) &&
|
3133
|
-
Math.round(a.contentRect.height) ===
|
3134
|
-
Math.round(b.contentRect.height)),
|
3135
|
-
// Emit the last value for late subscribers. Track references so it
|
3136
|
-
// un-observes when all subscribers are gone.
|
3137
|
-
shareReplay({ bufferSize: 1, refCount: true }),
|
3138
|
-
// Only emit prior to an animation frame to prevent layout thrashing.
|
3139
|
-
throttle(() => animationFrames().pipe(take(1)), {
|
3140
|
-
leading: false,
|
3141
|
-
trailing: true,
|
3142
|
-
}), takeUntil$1(this.#ngUnsubscribe)));
|
3143
|
-
}
|
3144
|
-
return this.#tracking.get(element.nativeElement);
|
3145
|
-
}
|
3146
|
-
#expectWindowError() {
|
3147
|
-
if (!errorLogRegistered) {
|
3148
|
-
errorLogRegistered = true;
|
3149
|
-
// ResizeObserver throws an error when it is disconnected while it is
|
3150
|
-
// still observing an element. When an element is no longer observed, this
|
3151
|
-
// is not a concern.
|
3152
|
-
this.#zone.runOutsideAngular(() => this.#window.nativeWindow.addEventListener('error', errorHandler));
|
3153
|
-
}
|
3154
|
-
if (this.#window.nativeWindow.onerror !== onError) {
|
3155
|
-
originalOnError = this.#window.nativeWindow.onerror;
|
3156
|
-
this.#window.nativeWindow.onerror = onError;
|
3157
|
-
}
|
3359
|
+
get breakpointChange() {
|
3360
|
+
return this.#breakpointChangeObs;
|
3158
3361
|
}
|
3159
|
-
#resetWindowError() {
|
3160
|
-
this.#window.nativeWindow.removeEventListener('error', errorHandler);
|
3161
|
-
if (originalOnError) {
|
3162
|
-
this.#window.nativeWindow.onerror = originalOnError;
|
3163
|
-
originalOnError = undefined;
|
3164
|
-
}
|
3165
|
-
errorLogRegistered = false;
|
3166
|
-
}
|
3167
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyResizeObserverService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
3168
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyResizeObserverService, providedIn: 'root' }); }
|
3169
|
-
}
|
3170
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyResizeObserverService, decorators: [{
|
3171
|
-
type: Injectable,
|
3172
|
-
args: [{
|
3173
|
-
providedIn: 'root',
|
3174
|
-
}]
|
3175
|
-
}], ctorParameters: () => [] });
|
3176
|
-
|
3177
|
-
const DEFAULT_BREAKPOINT = SkyMediaBreakpoints.md;
|
3178
|
-
/**
|
3179
|
-
* Acts like `SkyMediaQueryService` for a container element, emitting the same responsive breakpoints.
|
3180
|
-
*/
|
3181
|
-
class SkyResizeObserverMediaQueryService {
|
3182
3362
|
/**
|
3183
3363
|
* Returns the current breakpoint.
|
3364
|
+
* @deprecated Subscribe to the `breakpointChange` observable instead.
|
3184
3365
|
*/
|
3185
3366
|
get current() {
|
3186
3367
|
return this.#currentBreakpoint;
|
3187
3368
|
}
|
3369
|
+
#breakpointChange = new ReplaySubject(1);
|
3370
|
+
#breakpointChangeObs = this.#breakpointChange.asObservable();
|
3188
3371
|
#breakpoints = [
|
3189
3372
|
{
|
3190
3373
|
check: (width) => width > 0 && width <= 767,
|
@@ -3212,6 +3395,7 @@ class SkyResizeObserverMediaQueryService {
|
|
3212
3395
|
this.unobserve();
|
3213
3396
|
this.#target = undefined;
|
3214
3397
|
this.#currentBreakpointObs.complete();
|
3398
|
+
this.#breakpointChange.complete();
|
3215
3399
|
}
|
3216
3400
|
/**
|
3217
3401
|
* @internal
|
@@ -3267,6 +3451,8 @@ class SkyResizeObserverMediaQueryService {
|
|
3267
3451
|
}
|
3268
3452
|
if (this.current !== breakpoint) {
|
3269
3453
|
this.#currentBreakpointObs.next(breakpoint);
|
3454
|
+
const breakpointType = toSkyBreakpoint(breakpoint);
|
3455
|
+
this.#breakpointChange.next(breakpointType);
|
3270
3456
|
}
|
3271
3457
|
this.#currentBreakpoint = breakpoint;
|
3272
3458
|
}
|
@@ -3299,7 +3485,7 @@ class SkyResizeObserverMediaQueryService {
|
|
3299
3485
|
this.#updateBreakpoint(breakpoint, updateResponsiveClasses);
|
3300
3486
|
}
|
3301
3487
|
}
|
3302
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyResizeObserverMediaQueryService, deps:
|
3488
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyResizeObserverMediaQueryService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
3303
3489
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyResizeObserverMediaQueryService }); }
|
3304
3490
|
}
|
3305
3491
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: SkyResizeObserverMediaQueryService, decorators: [{
|
@@ -4318,11 +4504,11 @@ class Version {
|
|
4318
4504
|
/**
|
4319
4505
|
* Represents the version of @skyux/core.
|
4320
4506
|
*/
|
4321
|
-
const VERSION = new Version('11.
|
4507
|
+
const VERSION = new Version('11.16.0');
|
4322
4508
|
|
4323
4509
|
/**
|
4324
4510
|
* Generated bundle index. Do not edit.
|
4325
4511
|
*/
|
4326
4512
|
|
4327
|
-
export { NumericOptions, SKY_HELP_GLOBAL_OPTIONS, SKY_LOG_LEVEL, SKY_STACKING_CONTEXT, SkyAffixAutoFitContext, SkyAffixModule, SkyAffixService, SkyAffixer, SkyAppFormat, SkyAppTitleService, SkyAppWindowRef, SkyContentInfoProvider, SkyCoreAdapterModule, SkyCoreAdapterService, SkyDefaultInputProvider, SkyDockItem, SkyDockLocation, SkyDockModule, SkyDockService, SkyDynamicComponentLegacyService, SkyDynamicComponentLocation, SkyDynamicComponentModule, SkyDynamicComponentService, SkyHelpService, SkyIdModule, SkyIdService, SkyLayoutHostService, SkyLiveAnnouncerService, SkyLogLevel, SkyLogModule, SkyLogService, SkyMediaBreakpoints, SkyMediaQueryModule, SkyMediaQueryService, SkyMutationObserverService, SkyNumericModule, SkyNumericPipe, SkyNumericService, SkyOverlayInstance, SkyOverlayLegacyService, SkyOverlayModule, SkyOverlayService, SkyPercentPipe, SkyPercentPipeModule, SkyResizeObserverMediaQueryService, SkyResizeObserverService, SkyScreenReaderLabelDirective, SkyScrollShadowDirective, SkyScrollableHostService, SkyTrimModule, SkyUIConfigService, SkyViewkeeperHostOptions, SkyViewkeeperModule, SkyViewkeeperService, VERSION, SkyAffixDirective as λ1, SkyIdDirective as λ2, SkyViewkeeperDirective as λ3, SkyTrimDirective as λ4 };
|
4513
|
+
export { NumericOptions, SKY_BREAKPOINT_OBSERVER, SKY_HELP_GLOBAL_OPTIONS, SKY_LOG_LEVEL, SKY_STACKING_CONTEXT, SkyAffixAutoFitContext, SkyAffixModule, SkyAffixService, SkyAffixer, SkyAppFormat, SkyAppTitleService, SkyAppWindowRef, SkyContainerBreakpointObserver, SkyContentInfoProvider, SkyCoreAdapterModule, SkyCoreAdapterService, SkyDefaultInputProvider, SkyDockItem, SkyDockLocation, SkyDockModule, SkyDockService, SkyDynamicComponentLegacyService, SkyDynamicComponentLocation, SkyDynamicComponentModule, SkyDynamicComponentService, SkyHelpService, SkyIdModule, SkyIdService, SkyLayoutHostService, SkyLiveAnnouncerService, SkyLogLevel, SkyLogModule, SkyLogService, SkyMediaBreakpointObserver, SkyMediaBreakpoints, SkyMediaQueryModule, SkyMediaQueryService, SkyMutationObserverService, SkyNumericModule, SkyNumericPipe, SkyNumericService, SkyOverlayInstance, SkyOverlayLegacyService, SkyOverlayModule, SkyOverlayService, SkyPercentPipe, SkyPercentPipeModule, SkyResizeObserverMediaQueryService, SkyResizeObserverService, SkyResponsiveHostDirective, SkyScreenReaderLabelDirective, SkyScrollShadowDirective, SkyScrollableHostService, SkyTrimModule, SkyUIConfigService, SkyViewkeeperHostOptions, SkyViewkeeperModule, SkyViewkeeperService, VERSION, provideSkyBreakpointObserver, SkyAffixDirective as λ1, SkyIdDirective as λ2, SkyViewkeeperDirective as λ3, SkyTrimDirective as λ4 };
|
4328
4514
|
//# sourceMappingURL=skyux-core.mjs.map
|