@skyux/core 9.0.0-alpha.3 → 9.0.0-alpha.5
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 +698 -745
- package/esm2022/lib/modules/dock/dock.component.mjs +8 -12
- package/esm2022/lib/modules/dock/dock.module.mjs +4 -3
- package/esm2022/lib/modules/dock/dock.service.mjs +10 -15
- package/esm2022/lib/modules/dynamic-component/dynamic-component-options.mjs +1 -1
- package/esm2022/lib/modules/dynamic-component/dynamic-component.service.mjs +10 -15
- package/esm2022/lib/modules/live-announcer/live-announcer.service.mjs +4 -2
- package/esm2022/lib/modules/numeric/numeric.module.mjs +6 -6
- package/esm2022/lib/modules/numeric/numeric.service.mjs +3 -6
- package/esm2022/lib/modules/overlay/overlay.service.mjs +13 -27
- package/esm2022/lib/modules/resize-observer/resize-observer-media-query.service.mjs +37 -16
- package/esm2022/lib/modules/resize-observer/resize-observer.service.mjs +3 -3
- package/esm2022/testing/public-api.mjs +2 -1
- package/esm2022/testing/resize-observer-mock.mjs +35 -0
- package/fesm2022/skyux-core-testing.mjs +36 -1
- package/fesm2022/skyux-core-testing.mjs.map +1 -1
- package/fesm2022/skyux-core.mjs +93 -102
- package/fesm2022/skyux-core.mjs.map +1 -1
- package/lib/modules/dock/dock.component.d.ts +2 -2
- package/lib/modules/dynamic-component/dynamic-component-options.d.ts +1 -1
- package/lib/modules/dynamic-component/dynamic-component.service.d.ts +3 -3
- package/lib/modules/numeric/numeric.module.d.ts +2 -3
- package/lib/modules/overlay/overlay.service.d.ts +1 -4
- package/lib/modules/resize-observer/resize-observer-media-query.service.d.ts +4 -2
- package/package.json +2 -2
- package/testing/public-api.d.ts +1 -0
- package/testing/resize-observer-mock.d.ts +6 -0
package/fesm2022/skyux-core.mjs
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { NgModule, Injectable, EventEmitter, Directive, Input, Output,
|
2
|
+
import { NgModule, Injectable, EventEmitter, Directive, Input, Output, inject, EnvironmentInjector, createEnvironmentInjector, ViewContainerRef, Component, ChangeDetectionStrategy, ViewChild, createComponent, InjectionToken, Optional, Inject, Pipe, Injector, ElementRef, HostBinding, ApplicationRef } from '@angular/core';
|
3
3
|
import * as i5 from '@angular/common';
|
4
4
|
import { CommonModule, DOCUMENT } from '@angular/common';
|
5
5
|
import { Subject, fromEvent, ReplaySubject, BehaviorSubject, Observable, of, concat, animationFrameScheduler } from 'rxjs';
|
@@ -1101,13 +1101,12 @@ class SkyDockComponent {
|
|
1101
1101
|
#changeDetector;
|
1102
1102
|
#domAdapter;
|
1103
1103
|
#elementRef;
|
1104
|
-
#
|
1104
|
+
#environmentInjector = inject(EnvironmentInjector);
|
1105
1105
|
#itemRefs = [];
|
1106
1106
|
#options;
|
1107
|
-
constructor(changeDetector, elementRef,
|
1107
|
+
constructor(changeDetector, elementRef, domAdapter) {
|
1108
1108
|
this.#changeDetector = changeDetector;
|
1109
1109
|
this.#elementRef = elementRef;
|
1110
|
-
this.#injector = injector;
|
1111
1110
|
this.#domAdapter = domAdapter;
|
1112
1111
|
}
|
1113
1112
|
insertComponent(component, config = {}) {
|
@@ -1115,12 +1114,9 @@ class SkyDockComponent {
|
|
1115
1114
|
if (!this.target) {
|
1116
1115
|
throw Error('[SkyDockComponent] Could not insert the component because the target element could not be found.');
|
1117
1116
|
}
|
1118
|
-
const
|
1119
|
-
providers: config.providers || [],
|
1120
|
-
parent: this.#injector,
|
1121
|
-
});
|
1117
|
+
const environmentInjector = createEnvironmentInjector(config.providers || [], this.#environmentInjector);
|
1122
1118
|
const componentRef = this.target.createComponent(component, {
|
1123
|
-
|
1119
|
+
environmentInjector,
|
1124
1120
|
});
|
1125
1121
|
const stackOrder = config.stackOrder !== null && config.stackOrder !== undefined
|
1126
1122
|
? config.stackOrder
|
@@ -1182,13 +1178,13 @@ class SkyDockComponent {
|
|
1182
1178
|
}
|
1183
1179
|
return this.#itemRefs[0].stackOrder + 1;
|
1184
1180
|
}
|
1185
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyDockComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token:
|
1181
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyDockComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: SkyDockDomAdapterService }], target: i0.ɵɵFactoryTarget.Component }); }
|
1186
1182
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SkyDockComponent, selector: "sky-dock", providers: [SkyDockDomAdapterService], viewQueries: [{ propertyName: "target", first: true, predicate: ["target"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<ng-container #target></ng-container>\n", styles: [":host{display:flex;flex-direction:column;width:100%}:host:not(.sky-dock-unbound){position:fixed;left:var(--sky-viewport-left, 0);bottom:var(--sky-viewport-bottom, 0);right:var(--sky-viewport-right, 0);width:auto}:host.sky-dock-sticky{position:sticky}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
1187
1183
|
}
|
1188
1184
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyDockComponent, decorators: [{
|
1189
1185
|
type: Component,
|
1190
1186
|
args: [{ selector: 'sky-dock', providers: [SkyDockDomAdapterService], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container #target></ng-container>\n", styles: [":host{display:flex;flex-direction:column;width:100%}:host:not(.sky-dock-unbound){position:fixed;left:var(--sky-viewport-left, 0);bottom:var(--sky-viewport-bottom, 0);right:var(--sky-viewport-right, 0);width:auto}:host.sky-dock-sticky{position:sticky}\n"] }]
|
1191
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type:
|
1187
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: SkyDockDomAdapterService }]; }, propDecorators: { target: [{
|
1192
1188
|
type: ViewChild,
|
1193
1189
|
args: ['target', {
|
1194
1190
|
read: ViewContainerRef,
|
@@ -1196,20 +1192,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
1196
1192
|
}]
|
1197
1193
|
}] } });
|
1198
1194
|
|
1199
|
-
class SkyDockModule {
|
1200
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyDockModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
1201
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SkyDockModule, declarations: [SkyDockComponent], imports: [CommonModule] }); }
|
1202
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyDockModule, providers: [SkyMutationObserverService], imports: [CommonModule] }); }
|
1203
|
-
}
|
1204
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyDockModule, decorators: [{
|
1205
|
-
type: NgModule,
|
1206
|
-
args: [{
|
1207
|
-
imports: [CommonModule],
|
1208
|
-
declarations: [SkyDockComponent],
|
1209
|
-
providers: [SkyMutationObserverService],
|
1210
|
-
}]
|
1211
|
-
}] });
|
1212
|
-
|
1213
1195
|
/**
|
1214
1196
|
* The location on the page where the dynamic component should be rendered.
|
1215
1197
|
*/
|
@@ -1271,13 +1253,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
1271
1253
|
*/
|
1272
1254
|
class SkyDynamicComponentService {
|
1273
1255
|
#applicationRef;
|
1274
|
-
#environmentInjector;
|
1275
1256
|
#renderer;
|
1276
1257
|
#windowRef;
|
1277
|
-
constructor(applicationRef, windowRef, rendererFactory
|
1258
|
+
constructor(applicationRef, windowRef, rendererFactory) {
|
1278
1259
|
this.#applicationRef = applicationRef;
|
1279
1260
|
this.#windowRef = windowRef;
|
1280
|
-
this.#environmentInjector = environmentInjector;
|
1281
1261
|
// Based on suggestions from https://github.com/angular/angular/issues/17824
|
1282
1262
|
// for accessing an instance of Renderer2 in a service since Renderer2 can't
|
1283
1263
|
// be injected into a service. Passing undefined for both parameters results
|
@@ -1289,10 +1269,10 @@ class SkyDynamicComponentService {
|
|
1289
1269
|
* on the page.
|
1290
1270
|
*/
|
1291
1271
|
createComponent(componentType, options) {
|
1292
|
-
options
|
1293
|
-
location
|
1294
|
-
}
|
1295
|
-
const environmentInjector = createEnvironmentInjector(options.providers ?? [], options.environmentInjector
|
1272
|
+
if (options.location === undefined) {
|
1273
|
+
options.location = SkyDynamicComponentLocation.BodyBottom;
|
1274
|
+
}
|
1275
|
+
const environmentInjector = createEnvironmentInjector(options.providers ?? [], options.environmentInjector);
|
1296
1276
|
let componentRef;
|
1297
1277
|
if (options.viewContainerRef) {
|
1298
1278
|
componentRef = options.viewContainerRef.createComponent(componentType, {
|
@@ -1348,18 +1328,15 @@ class SkyDynamicComponentService {
|
|
1348
1328
|
// https://malcoded.com/posts/angular-dynamic-components
|
1349
1329
|
return componentRef.hostView.rootNodes[0];
|
1350
1330
|
}
|
1351
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyDynamicComponentService, deps: [{ token: i0.ApplicationRef }, { token: SkyAppWindowRef }, { token: i0.RendererFactory2 }
|
1352
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyDynamicComponentService, providedIn: '
|
1331
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyDynamicComponentService, deps: [{ token: i0.ApplicationRef }, { token: SkyAppWindowRef }, { token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
1332
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyDynamicComponentService, providedIn: 'root' }); }
|
1353
1333
|
}
|
1354
1334
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyDynamicComponentService, decorators: [{
|
1355
1335
|
type: Injectable,
|
1356
1336
|
args: [{
|
1357
|
-
|
1358
|
-
// If set to 'root', the component's dependency injections would only be derived from the root
|
1359
|
-
// injector and may lose context if the component is created within a lazy-loaded module.
|
1360
|
-
providedIn: 'any',
|
1337
|
+
providedIn: 'root',
|
1361
1338
|
}]
|
1362
|
-
}], ctorParameters: function () { return [{ type: i0.ApplicationRef }, { type: SkyAppWindowRef }, { type: i0.RendererFactory2 }
|
1339
|
+
}], ctorParameters: function () { return [{ type: i0.ApplicationRef }, { type: SkyAppWindowRef }, { type: i0.RendererFactory2 }]; } });
|
1363
1340
|
|
1364
1341
|
/**
|
1365
1342
|
* This service docks components to specific areas on the page.
|
@@ -1373,6 +1350,7 @@ class SkyDockService {
|
|
1373
1350
|
return SkyDockService._items;
|
1374
1351
|
}
|
1375
1352
|
#dynamicComponentSvc;
|
1353
|
+
#environmentInjector = inject(EnvironmentInjector);
|
1376
1354
|
#options;
|
1377
1355
|
constructor(dynamicComponentSvc) {
|
1378
1356
|
this.#dynamicComponentSvc = dynamicComponentSvc;
|
@@ -1409,7 +1387,9 @@ class SkyDockService {
|
|
1409
1387
|
this.#options = options;
|
1410
1388
|
}
|
1411
1389
|
#createDock() {
|
1412
|
-
|
1390
|
+
const dockOptions = {
|
1391
|
+
environmentInjector: this.#environmentInjector,
|
1392
|
+
};
|
1413
1393
|
if (this.#options) {
|
1414
1394
|
let dynamicLocation;
|
1415
1395
|
switch (this.#options.location) {
|
@@ -1423,10 +1403,8 @@ class SkyDockService {
|
|
1423
1403
|
dynamicLocation = SkyDynamicComponentLocation.BodyTop;
|
1424
1404
|
break;
|
1425
1405
|
}
|
1426
|
-
dockOptions =
|
1427
|
-
|
1428
|
-
referenceEl: this.#options.referenceEl,
|
1429
|
-
};
|
1406
|
+
dockOptions.location = dynamicLocation;
|
1407
|
+
dockOptions.referenceEl = this.#options.referenceEl;
|
1430
1408
|
}
|
1431
1409
|
const dockRef = this.#dynamicComponentSvc.createComponent(SkyDockComponent, dockOptions);
|
1432
1410
|
dockRef.instance.setOptions(this.#options);
|
@@ -1437,17 +1415,25 @@ class SkyDockService {
|
|
1437
1415
|
SkyDockService.dockRef = undefined;
|
1438
1416
|
}
|
1439
1417
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyDockService, deps: [{ token: SkyDynamicComponentService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
1440
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyDockService
|
1418
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyDockService }); }
|
1441
1419
|
}
|
1442
1420
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyDockService, decorators: [{
|
1443
|
-
type: Injectable
|
1421
|
+
type: Injectable
|
1422
|
+
}], ctorParameters: function () { return [{ type: SkyDynamicComponentService }]; } });
|
1423
|
+
|
1424
|
+
class SkyDockModule {
|
1425
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyDockModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
1426
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SkyDockModule, declarations: [SkyDockComponent], imports: [CommonModule] }); }
|
1427
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyDockModule, providers: [SkyDockService, SkyMutationObserverService], imports: [CommonModule] }); }
|
1428
|
+
}
|
1429
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyDockModule, decorators: [{
|
1430
|
+
type: NgModule,
|
1444
1431
|
args: [{
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
providedIn: 'any',
|
1432
|
+
imports: [CommonModule],
|
1433
|
+
declarations: [SkyDockComponent],
|
1434
|
+
providers: [SkyDockService, SkyMutationObserverService],
|
1449
1435
|
}]
|
1450
|
-
}]
|
1436
|
+
}] });
|
1451
1437
|
|
1452
1438
|
/**
|
1453
1439
|
* Provides services required to create dynamic components on the page.
|
@@ -1633,7 +1619,9 @@ class SkyLiveAnnouncerService {
|
|
1633
1619
|
}
|
1634
1620
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyLiveAnnouncerService, decorators: [{
|
1635
1621
|
type: Injectable,
|
1636
|
-
args: [{
|
1622
|
+
args: [{
|
1623
|
+
providedIn: 'root',
|
1624
|
+
}]
|
1637
1625
|
}], ctorParameters: function () { return []; } });
|
1638
1626
|
|
1639
1627
|
/**
|
@@ -2265,13 +2253,10 @@ class SkyNumericService {
|
|
2265
2253
|
return this.#resourcesSvc.getStringForLocale({ locale: 'en_US' }, key);
|
2266
2254
|
}
|
2267
2255
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyNumericService, deps: [{ token: i1.SkyLibResourcesService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
2268
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyNumericService
|
2256
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyNumericService }); }
|
2269
2257
|
}
|
2270
2258
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyNumericService, decorators: [{
|
2271
|
-
type: Injectable
|
2272
|
-
args: [{
|
2273
|
-
providedIn: 'any',
|
2274
|
-
}]
|
2259
|
+
type: Injectable
|
2275
2260
|
}], ctorParameters: function () { return [{ type: i1.SkyLibResourcesService }]; } });
|
2276
2261
|
|
2277
2262
|
/**
|
@@ -2350,15 +2335,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
2350
2335
|
|
2351
2336
|
class SkyNumericModule {
|
2352
2337
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyNumericModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
2353
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SkyNumericModule, declarations: [SkyNumericPipe], imports: [
|
2354
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyNumericModule, providers: [SkyNumericPipe], imports: [
|
2338
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SkyNumericModule, declarations: [SkyNumericPipe], imports: [SkyCoreResourcesModule], exports: [SkyNumericPipe] }); }
|
2339
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyNumericModule, providers: [SkyNumericPipe, SkyNumericService], imports: [SkyCoreResourcesModule] }); }
|
2355
2340
|
}
|
2356
2341
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyNumericModule, decorators: [{
|
2357
2342
|
type: NgModule,
|
2358
2343
|
args: [{
|
2359
2344
|
declarations: [SkyNumericPipe],
|
2360
|
-
providers: [SkyNumericPipe],
|
2361
|
-
imports: [
|
2345
|
+
providers: [SkyNumericPipe, SkyNumericService],
|
2346
|
+
imports: [SkyCoreResourcesModule],
|
2362
2347
|
exports: [SkyNumericPipe],
|
2363
2348
|
}]
|
2364
2349
|
}] });
|
@@ -2678,21 +2663,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
2678
2663
|
|
2679
2664
|
/**
|
2680
2665
|
* This service is used to create new overlays.
|
2681
|
-
* @
|
2666
|
+
* @internal
|
2682
2667
|
*/
|
2683
2668
|
class SkyOverlayService {
|
2684
2669
|
static { this.overlays = []; }
|
2685
|
-
#adapter;
|
2686
|
-
#applicationRef;
|
2687
|
-
#
|
2688
|
-
#
|
2689
|
-
// TODO: Replace deprecated `ComponentFactoryResolver`.
|
2690
|
-
constructor(applicationRef, componentFactoryResolver, injector, adapter) {
|
2691
|
-
this.#applicationRef = applicationRef;
|
2692
|
-
this.#componentFactoryResolver = componentFactoryResolver;
|
2693
|
-
this.#injector = injector;
|
2694
|
-
this.#adapter = adapter;
|
2695
|
-
}
|
2670
|
+
#adapter = inject(SkyOverlayAdapterService);
|
2671
|
+
#applicationRef = inject(ApplicationRef);
|
2672
|
+
#dynamicComponentSvc = inject(SkyDynamicComponentService);
|
2673
|
+
#environmentInjector = inject(EnvironmentInjector);
|
2696
2674
|
/**
|
2697
2675
|
* Creates an empty overlay. Use the returned `SkyOverlayInstance` to append content.
|
2698
2676
|
* @param config Configuration for the overlay.
|
@@ -2745,8 +2723,8 @@ class SkyOverlayService {
|
|
2745
2723
|
}
|
2746
2724
|
}
|
2747
2725
|
#createOverlay(config) {
|
2748
|
-
|
2749
|
-
|
2726
|
+
return this.#dynamicComponentSvc.createComponent(SkyOverlayComponent, {
|
2727
|
+
environmentInjector: this.#environmentInjector,
|
2750
2728
|
providers: [
|
2751
2729
|
{
|
2752
2730
|
provide: SkyOverlayContext,
|
@@ -2754,14 +2732,6 @@ class SkyOverlayService {
|
|
2754
2732
|
},
|
2755
2733
|
],
|
2756
2734
|
});
|
2757
|
-
const componentRef = this.#componentFactoryResolver
|
2758
|
-
.resolveComponentFactory(SkyOverlayComponent)
|
2759
|
-
.create(injector);
|
2760
|
-
this.#applicationRef.attachView(componentRef.hostView);
|
2761
|
-
const domElem = componentRef.hostView
|
2762
|
-
.rootNodes[0];
|
2763
|
-
document.body.appendChild(domElem);
|
2764
|
-
return componentRef;
|
2765
2735
|
}
|
2766
2736
|
#prepareConfig(config = {}) {
|
2767
2737
|
const defaults = {
|
@@ -2784,7 +2754,7 @@ class SkyOverlayService {
|
|
2784
2754
|
}
|
2785
2755
|
}
|
2786
2756
|
}
|
2787
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyOverlayService, deps: [
|
2757
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyOverlayService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
2788
2758
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyOverlayService, providedIn: 'root' }); }
|
2789
2759
|
}
|
2790
2760
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyOverlayService, decorators: [{
|
@@ -2792,7 +2762,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
2792
2762
|
args: [{
|
2793
2763
|
providedIn: 'root',
|
2794
2764
|
}]
|
2795
|
-
}]
|
2765
|
+
}] });
|
2796
2766
|
|
2797
2767
|
class SkyPercentPipe {
|
2798
2768
|
get defaultLocale() {
|
@@ -2922,12 +2892,12 @@ class SkyResizeObserverService {
|
|
2922
2892
|
});
|
2923
2893
|
}
|
2924
2894
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyResizeObserverService, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
2925
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyResizeObserverService, providedIn: '
|
2895
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyResizeObserverService, providedIn: 'root' }); }
|
2926
2896
|
}
|
2927
2897
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyResizeObserverService, decorators: [{
|
2928
2898
|
type: Injectable,
|
2929
2899
|
args: [{
|
2930
|
-
providedIn: '
|
2900
|
+
providedIn: 'root',
|
2931
2901
|
}]
|
2932
2902
|
}], ctorParameters: function () { return [{ type: i0.NgZone }]; } });
|
2933
2903
|
|
@@ -2983,7 +2953,7 @@ class SkyResizeObserverMediaQueryService {
|
|
2983
2953
|
* Sets the container element to watch. The `SkyResizeObserverMediaQueryService` will only observe one element at a
|
2984
2954
|
* time. Any previous subscriptions will be unsubscribed when a new element is observed.
|
2985
2955
|
*/
|
2986
|
-
observe(element) {
|
2956
|
+
observe(element, options) {
|
2987
2957
|
if (this.#target) {
|
2988
2958
|
if (this.#target === element) {
|
2989
2959
|
return this;
|
@@ -2991,22 +2961,23 @@ class SkyResizeObserverMediaQueryService {
|
|
2991
2961
|
this.unobserve();
|
2992
2962
|
}
|
2993
2963
|
this.#target = element;
|
2994
|
-
this.#checkWidth(element);
|
2964
|
+
this.#checkWidth(element, options?.updateResponsiveClasses);
|
2995
2965
|
this.#resizeObserverSvc
|
2996
2966
|
.observe(element)
|
2997
2967
|
.pipe(takeUntil(this.#ngUnsubscribe))
|
2998
2968
|
.subscribe((value) => {
|
2999
2969
|
const breakpoint = this.#checkBreakpoint(value.contentRect.width);
|
3000
|
-
if (breakpoint
|
3001
|
-
this.#updateBreakpoint(breakpoint);
|
2970
|
+
if (breakpoint) {
|
2971
|
+
this.#updateBreakpoint(breakpoint, options?.updateResponsiveClasses);
|
3002
2972
|
}
|
3003
2973
|
});
|
3004
2974
|
return this;
|
3005
2975
|
}
|
3006
2976
|
/**
|
3007
|
-
* Stop watching the container element.
|
2977
|
+
* Stop watching the container element and remove any added classes.
|
3008
2978
|
*/
|
3009
2979
|
unobserve() {
|
2980
|
+
this.#removeResponsiveClasses();
|
3010
2981
|
this.#ngUnsubscribe.next();
|
3011
2982
|
this.#ngUnsubscribe.complete();
|
3012
2983
|
}
|
@@ -3020,29 +2991,49 @@ class SkyResizeObserverMediaQueryService {
|
|
3020
2991
|
listener(value);
|
3021
2992
|
});
|
3022
2993
|
}
|
3023
|
-
#updateBreakpoint(breakpoint) {
|
2994
|
+
#updateBreakpoint(breakpoint, updateResponsiveClasses) {
|
2995
|
+
if (updateResponsiveClasses) {
|
2996
|
+
this.#updateResponsiveClasses(this.current, breakpoint);
|
2997
|
+
}
|
2998
|
+
if (this.current !== breakpoint) {
|
2999
|
+
this.#currentBreakpointObs.next(breakpoint);
|
3000
|
+
}
|
3024
3001
|
this.#currentBreakpoint = breakpoint;
|
3025
|
-
|
3002
|
+
}
|
3003
|
+
#updateResponsiveClasses(oldBreakpoint, newBreakpoint) {
|
3004
|
+
const oldClass = this.#getClassForBreakpoint(oldBreakpoint);
|
3005
|
+
const newClass = this.#getClassForBreakpoint(newBreakpoint);
|
3006
|
+
const targetClassList = this.#target?.nativeElement?.classList;
|
3007
|
+
targetClassList?.remove(oldClass);
|
3008
|
+
targetClassList?.add(newClass);
|
3009
|
+
}
|
3010
|
+
#removeResponsiveClasses() {
|
3011
|
+
for (const breakpoint of Object.values(SkyMediaBreakpoints)) {
|
3012
|
+
if (typeof breakpoint === 'number') {
|
3013
|
+
const className = this.#getClassForBreakpoint(breakpoint);
|
3014
|
+
this.#target?.nativeElement?.classList?.remove(className);
|
3015
|
+
}
|
3016
|
+
}
|
3017
|
+
}
|
3018
|
+
#getClassForBreakpoint(breakpoint) {
|
3019
|
+
return `sky-responsive-container-${SkyMediaBreakpoints[breakpoint]}`;
|
3026
3020
|
}
|
3027
3021
|
#checkBreakpoint(width) {
|
3028
3022
|
const breakpoint = this.#breakpoints.find((breakpoint) => breakpoint.check(width));
|
3029
3023
|
return breakpoint ? breakpoint.name : undefined;
|
3030
3024
|
}
|
3031
|
-
#checkWidth(el) {
|
3025
|
+
#checkWidth(el, updateResponsiveClasses) {
|
3032
3026
|
const width = el.nativeElement.offsetWidth || 0;
|
3033
3027
|
const breakpoint = this.#checkBreakpoint(width);
|
3034
|
-
if (breakpoint
|
3035
|
-
this.#updateBreakpoint(breakpoint);
|
3028
|
+
if (breakpoint) {
|
3029
|
+
this.#updateBreakpoint(breakpoint, updateResponsiveClasses);
|
3036
3030
|
}
|
3037
3031
|
}
|
3038
3032
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyResizeObserverMediaQueryService, deps: [{ token: SkyResizeObserverService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
3039
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyResizeObserverMediaQueryService
|
3033
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyResizeObserverMediaQueryService }); }
|
3040
3034
|
}
|
3041
3035
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyResizeObserverMediaQueryService, decorators: [{
|
3042
|
-
type: Injectable
|
3043
|
-
args: [{
|
3044
|
-
providedIn: 'any',
|
3045
|
-
}]
|
3036
|
+
type: Injectable
|
3046
3037
|
}], ctorParameters: function () { return [{ type: SkyResizeObserverService }]; } });
|
3047
3038
|
|
3048
3039
|
function notifySubscribers(subscribers, item) {
|