@angular/common 14.2.0-next.1 → 15.0.0-next.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/esm2020/http/src/client.mjs +3 -3
- package/esm2020/http/src/interceptor.mjs +3 -3
- package/esm2020/http/src/jsonp.mjs +7 -7
- package/esm2020/http/src/module.mjs +15 -15
- package/esm2020/http/src/xhr.mjs +3 -3
- package/esm2020/http/src/xsrf.mjs +7 -7
- package/esm2020/http/testing/src/backend.mjs +3 -3
- package/esm2020/http/testing/src/module.mjs +4 -4
- package/esm2020/src/common.mjs +2 -1
- package/esm2020/src/common_module.mjs +4 -4
- package/esm2020/src/directives/ng_class.mjs +3 -3
- package/esm2020/src/directives/ng_component_outlet.mjs +3 -3
- package/esm2020/src/directives/ng_for_of.mjs +3 -3
- package/esm2020/src/directives/ng_if.mjs +3 -3
- package/esm2020/src/directives/ng_optimized_image/asserts.mjs +20 -0
- package/esm2020/src/directives/ng_optimized_image/error_helper.mjs +13 -0
- package/esm2020/src/directives/ng_optimized_image/image_loaders/cloudflare_loader.mjs +35 -0
- package/esm2020/src/directives/ng_optimized_image/image_loaders/cloudinary_loader.mjs +43 -0
- package/esm2020/src/directives/ng_optimized_image/image_loaders/image_loader.mjs +79 -0
- package/esm2020/src/directives/ng_optimized_image/image_loaders/imagekit_loader.mjs +35 -0
- package/esm2020/src/directives/ng_optimized_image/image_loaders/imgix_loader.mjs +33 -0
- package/esm2020/src/directives/ng_optimized_image/index.mjs +16 -0
- package/esm2020/src/directives/ng_optimized_image/lcp_image_observer.mjs +99 -0
- package/esm2020/src/directives/ng_optimized_image/ng_optimized_image.mjs +559 -0
- package/esm2020/src/directives/ng_optimized_image/preconnect_link_checker.mjs +137 -0
- package/esm2020/src/directives/ng_optimized_image/url.mjs +42 -0
- package/esm2020/src/directives/ng_plural.mjs +7 -7
- package/esm2020/src/directives/ng_style.mjs +3 -3
- package/esm2020/src/directives/ng_switch.mjs +10 -10
- package/esm2020/src/directives/ng_template_outlet.mjs +3 -3
- package/esm2020/src/errors.mjs +1 -1
- package/esm2020/src/i18n/localization.mjs +6 -6
- package/esm2020/src/location/hash_location_strategy.mjs +3 -3
- package/esm2020/src/location/location.mjs +4 -4
- package/esm2020/src/location/location_strategy.mjs +6 -6
- package/esm2020/src/location/platform_location.mjs +6 -6
- package/esm2020/src/pipes/async_pipe.mjs +3 -3
- package/esm2020/src/pipes/case_conversion_pipes.mjs +9 -9
- package/esm2020/src/pipes/date_pipe.mjs +3 -3
- package/esm2020/src/pipes/i18n_plural_pipe.mjs +3 -3
- package/esm2020/src/pipes/i18n_select_pipe.mjs +3 -3
- package/esm2020/src/pipes/json_pipe.mjs +3 -3
- package/esm2020/src/pipes/keyvalue_pipe.mjs +3 -3
- package/esm2020/src/pipes/number_pipe.mjs +9 -9
- package/esm2020/src/pipes/slice_pipe.mjs +3 -3
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/location_mock.mjs +3 -3
- package/esm2020/testing/src/mock_location_strategy.mjs +3 -3
- package/esm2020/testing/src/mock_platform_location.mjs +3 -3
- package/esm2020/upgrade/src/location_upgrade_module.mjs +4 -4
- package/fesm2015/common.mjs +1183 -104
- package/fesm2015/common.mjs.map +1 -1
- package/fesm2015/http/testing.mjs +8 -8
- package/fesm2015/http.mjs +37 -37
- package/fesm2015/http.mjs.map +1 -1
- package/fesm2015/testing.mjs +10 -10
- package/fesm2015/upgrade.mjs +5 -5
- package/fesm2020/common.mjs +1181 -104
- package/fesm2020/common.mjs.map +1 -1
- package/fesm2020/http/testing.mjs +8 -8
- package/fesm2020/http.mjs +37 -37
- package/fesm2020/http.mjs.map +1 -1
- package/fesm2020/testing.mjs +10 -10
- package/fesm2020/upgrade.mjs +5 -5
- package/http/index.d.ts +1 -1
- package/http/testing/index.d.ts +1 -1
- package/index.d.ts +319 -12
- package/package.json +2 -2
- package/testing/index.d.ts +1 -1
- package/upgrade/index.d.ts +1 -1
package/fesm2015/common.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular
|
|
2
|
+
* @license Angular v15.0.0-next.0
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as i0 from '@angular/core';
|
|
8
|
-
import { InjectionToken, Injectable, ɵɵinject, Inject, inject, Optional, EventEmitter, ɵfindLocaleData, ɵLocaleDataIndex, ɵgetLocaleCurrencyCode, ɵgetLocalePluralCase, LOCALE_ID, ɵregisterLocaleData, ɵisListLikeIterable, ɵstringify, Directive, Input, createNgModule, NgModuleRef, ɵRuntimeError, Host, Attribute, RendererStyleFlags2, ɵisPromise, ɵisSubscribable, Pipe, DEFAULT_CURRENCY_CODE, NgModule, Version, ɵɵdefineInjectable } from '@angular/core';
|
|
8
|
+
import { InjectionToken, Injectable, ɵɵinject, Inject, inject, Optional, EventEmitter, ɵfindLocaleData, ɵLocaleDataIndex, ɵgetLocaleCurrencyCode, ɵgetLocalePluralCase, LOCALE_ID, ɵregisterLocaleData, ɵisListLikeIterable, ɵstringify, Directive, Input, createNgModule, NgModuleRef, ɵRuntimeError, Host, Attribute, RendererStyleFlags2, ɵisPromise, ɵisSubscribable, Pipe, DEFAULT_CURRENCY_CODE, NgModule, Version, ɵɵdefineInjectable, ɵformatRuntimeError, Renderer2, ElementRef, Injector, NgZone } from '@angular/core';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @license
|
|
@@ -87,9 +87,9 @@ class PlatformLocation {
|
|
|
87
87
|
throw new Error('Not implemented');
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
PlatformLocation.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
91
|
-
PlatformLocation.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
92
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
90
|
+
PlatformLocation.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: PlatformLocation, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
91
|
+
PlatformLocation.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: PlatformLocation, providedIn: 'platform', useFactory: useBrowserPlatformLocation });
|
|
92
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: PlatformLocation, decorators: [{
|
|
93
93
|
type: Injectable,
|
|
94
94
|
args: [{
|
|
95
95
|
providedIn: 'platform',
|
|
@@ -190,9 +190,9 @@ class BrowserPlatformLocation extends PlatformLocation {
|
|
|
190
190
|
return this._history.state;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
BrowserPlatformLocation.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
194
|
-
BrowserPlatformLocation.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
195
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
193
|
+
BrowserPlatformLocation.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: BrowserPlatformLocation, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
194
|
+
BrowserPlatformLocation.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: BrowserPlatformLocation, providedIn: 'platform', useFactory: createBrowserPlatformLocation });
|
|
195
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: BrowserPlatformLocation, decorators: [{
|
|
196
196
|
type: Injectable,
|
|
197
197
|
args: [{
|
|
198
198
|
providedIn: 'platform',
|
|
@@ -313,9 +313,9 @@ class LocationStrategy {
|
|
|
313
313
|
throw new Error('Not implemented');
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
|
-
LocationStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
317
|
-
LocationStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
318
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
316
|
+
LocationStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: LocationStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
317
|
+
LocationStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: LocationStrategy, providedIn: 'root', useFactory: () => inject(PathLocationStrategy) });
|
|
318
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: LocationStrategy, decorators: [{
|
|
319
319
|
type: Injectable,
|
|
320
320
|
args: [{ providedIn: 'root', useFactory: () => inject(PathLocationStrategy) }]
|
|
321
321
|
}] });
|
|
@@ -424,9 +424,9 @@ class PathLocationStrategy extends LocationStrategy {
|
|
|
424
424
|
(_b = (_a = this._platformLocation).historyGo) === null || _b === void 0 ? void 0 : _b.call(_a, relativePosition);
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
|
-
PathLocationStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
428
|
-
PathLocationStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
429
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
427
|
+
PathLocationStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: PathLocationStrategy, deps: [{ token: PlatformLocation }, { token: APP_BASE_HREF, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
428
|
+
PathLocationStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: PathLocationStrategy, providedIn: 'root' });
|
|
429
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: PathLocationStrategy, decorators: [{
|
|
430
430
|
type: Injectable,
|
|
431
431
|
args: [{ providedIn: 'root' }]
|
|
432
432
|
}], ctorParameters: function () {
|
|
@@ -525,9 +525,9 @@ class HashLocationStrategy extends LocationStrategy {
|
|
|
525
525
|
(_b = (_a = this._platformLocation).historyGo) === null || _b === void 0 ? void 0 : _b.call(_a, relativePosition);
|
|
526
526
|
}
|
|
527
527
|
}
|
|
528
|
-
HashLocationStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
529
|
-
HashLocationStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
530
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
528
|
+
HashLocationStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: HashLocationStrategy, deps: [{ token: PlatformLocation }, { token: APP_BASE_HREF, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
529
|
+
HashLocationStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: HashLocationStrategy });
|
|
530
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: HashLocationStrategy, decorators: [{
|
|
531
531
|
type: Injectable
|
|
532
532
|
}], ctorParameters: function () {
|
|
533
533
|
return [{ type: PlatformLocation }, { type: undefined, decorators: [{
|
|
@@ -783,9 +783,9 @@ Location.joinWithSlash = joinWithSlash;
|
|
|
783
783
|
* @returns The URL string, modified if needed.
|
|
784
784
|
*/
|
|
785
785
|
Location.stripTrailingSlash = stripTrailingSlash;
|
|
786
|
-
Location.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
787
|
-
Location.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
788
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
786
|
+
Location.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: Location, deps: [{ token: LocationStrategy }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
787
|
+
Location.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: Location, providedIn: 'root', useFactory: createLocation });
|
|
788
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: Location, decorators: [{
|
|
789
789
|
type: Injectable,
|
|
790
790
|
args: [{
|
|
791
791
|
providedIn: 'root',
|
|
@@ -2601,9 +2601,9 @@ function parseIntAutoRadix(text) {
|
|
|
2601
2601
|
*/
|
|
2602
2602
|
class NgLocalization {
|
|
2603
2603
|
}
|
|
2604
|
-
NgLocalization.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2605
|
-
NgLocalization.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
2606
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2604
|
+
NgLocalization.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgLocalization, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2605
|
+
NgLocalization.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgLocalization, providedIn: 'root', useFactory: (locale) => new NgLocaleLocalization(locale), deps: [{ token: LOCALE_ID }] });
|
|
2606
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgLocalization, decorators: [{
|
|
2607
2607
|
type: Injectable,
|
|
2608
2608
|
args: [{
|
|
2609
2609
|
providedIn: 'root',
|
|
@@ -2658,9 +2658,9 @@ class NgLocaleLocalization extends NgLocalization {
|
|
|
2658
2658
|
}
|
|
2659
2659
|
}
|
|
2660
2660
|
}
|
|
2661
|
-
NgLocaleLocalization.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2662
|
-
NgLocaleLocalization.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
2663
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2661
|
+
NgLocaleLocalization.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgLocaleLocalization, deps: [{ token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2662
|
+
NgLocaleLocalization.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgLocaleLocalization });
|
|
2663
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgLocaleLocalization, decorators: [{
|
|
2664
2664
|
type: Injectable
|
|
2665
2665
|
}], ctorParameters: function () {
|
|
2666
2666
|
return [{ type: undefined, decorators: [{
|
|
@@ -2855,9 +2855,9 @@ class NgClass {
|
|
|
2855
2855
|
}
|
|
2856
2856
|
}
|
|
2857
2857
|
}
|
|
2858
|
-
NgClass.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2859
|
-
NgClass.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
2860
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2858
|
+
NgClass.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgClass, deps: [{ token: i0.IterableDiffers }, { token: i0.KeyValueDiffers }, { token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2859
|
+
NgClass.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0-next.0", type: NgClass, isStandalone: true, selector: "[ngClass]", inputs: { klass: ["class", "klass"], ngClass: "ngClass" }, ngImport: i0 });
|
|
2860
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgClass, decorators: [{
|
|
2861
2861
|
type: Directive,
|
|
2862
2862
|
args: [{
|
|
2863
2863
|
selector: '[ngClass]',
|
|
@@ -2976,9 +2976,9 @@ class NgComponentOutlet {
|
|
|
2976
2976
|
this._moduleRef.destroy();
|
|
2977
2977
|
}
|
|
2978
2978
|
}
|
|
2979
|
-
NgComponentOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2980
|
-
NgComponentOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
2981
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2979
|
+
NgComponentOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgComponentOutlet, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2980
|
+
NgComponentOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0-next.0", type: NgComponentOutlet, isStandalone: true, selector: "[ngComponentOutlet]", inputs: { ngComponentOutlet: "ngComponentOutlet", ngComponentOutletInjector: "ngComponentOutletInjector", ngComponentOutletContent: "ngComponentOutletContent", ngComponentOutletNgModule: "ngComponentOutletNgModule", ngComponentOutletNgModuleFactory: "ngComponentOutletNgModuleFactory" }, usesOnChanges: true, ngImport: i0 });
|
|
2981
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgComponentOutlet, decorators: [{
|
|
2982
2982
|
type: Directive,
|
|
2983
2983
|
args: [{
|
|
2984
2984
|
selector: '[ngComponentOutlet]',
|
|
@@ -3268,9 +3268,9 @@ class NgForOf {
|
|
|
3268
3268
|
return true;
|
|
3269
3269
|
}
|
|
3270
3270
|
}
|
|
3271
|
-
NgForOf.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3272
|
-
NgForOf.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
3273
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3271
|
+
NgForOf.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgForOf, deps: [{ token: i0.ViewContainerRef }, { token: i0.TemplateRef }, { token: i0.IterableDiffers }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3272
|
+
NgForOf.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0-next.0", type: NgForOf, isStandalone: true, selector: "[ngFor][ngForOf]", inputs: { ngForOf: "ngForOf", ngForTrackBy: "ngForTrackBy", ngForTemplate: "ngForTemplate" }, ngImport: i0 });
|
|
3273
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgForOf, decorators: [{
|
|
3274
3274
|
type: Directive,
|
|
3275
3275
|
args: [{
|
|
3276
3276
|
selector: '[ngFor][ngForOf]',
|
|
@@ -3503,9 +3503,9 @@ class NgIf {
|
|
|
3503
3503
|
return true;
|
|
3504
3504
|
}
|
|
3505
3505
|
}
|
|
3506
|
-
NgIf.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3507
|
-
NgIf.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
3508
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3506
|
+
NgIf.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgIf, deps: [{ token: i0.ViewContainerRef }, { token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3507
|
+
NgIf.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0-next.0", type: NgIf, isStandalone: true, selector: "[ngIf]", inputs: { ngIf: "ngIf", ngIfThen: "ngIfThen", ngIfElse: "ngIfElse" }, ngImport: i0 });
|
|
3508
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgIf, decorators: [{
|
|
3509
3509
|
type: Directive,
|
|
3510
3510
|
args: [{
|
|
3511
3511
|
selector: '[ngIf]',
|
|
@@ -3676,9 +3676,9 @@ class NgSwitch {
|
|
|
3676
3676
|
}
|
|
3677
3677
|
}
|
|
3678
3678
|
}
|
|
3679
|
-
NgSwitch.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3680
|
-
NgSwitch.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
3681
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3679
|
+
NgSwitch.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgSwitch, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3680
|
+
NgSwitch.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0-next.0", type: NgSwitch, isStandalone: true, selector: "[ngSwitch]", inputs: { ngSwitch: "ngSwitch" }, ngImport: i0 });
|
|
3681
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgSwitch, decorators: [{
|
|
3682
3682
|
type: Directive,
|
|
3683
3683
|
args: [{
|
|
3684
3684
|
selector: '[ngSwitch]',
|
|
@@ -3737,9 +3737,9 @@ class NgSwitchCase {
|
|
|
3737
3737
|
this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase));
|
|
3738
3738
|
}
|
|
3739
3739
|
}
|
|
3740
|
-
NgSwitchCase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3741
|
-
NgSwitchCase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
3742
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3740
|
+
NgSwitchCase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgSwitchCase, deps: [{ token: i0.ViewContainerRef }, { token: i0.TemplateRef }, { token: NgSwitch, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3741
|
+
NgSwitchCase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0-next.0", type: NgSwitchCase, isStandalone: true, selector: "[ngSwitchCase]", inputs: { ngSwitchCase: "ngSwitchCase" }, ngImport: i0 });
|
|
3742
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgSwitchCase, decorators: [{
|
|
3743
3743
|
type: Directive,
|
|
3744
3744
|
args: [{
|
|
3745
3745
|
selector: '[ngSwitchCase]',
|
|
@@ -3776,9 +3776,9 @@ class NgSwitchDefault {
|
|
|
3776
3776
|
ngSwitch._addDefault(new SwitchView(viewContainer, templateRef));
|
|
3777
3777
|
}
|
|
3778
3778
|
}
|
|
3779
|
-
NgSwitchDefault.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3780
|
-
NgSwitchDefault.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
3781
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3779
|
+
NgSwitchDefault.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgSwitchDefault, deps: [{ token: i0.ViewContainerRef }, { token: i0.TemplateRef }, { token: NgSwitch, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3780
|
+
NgSwitchDefault.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0-next.0", type: NgSwitchDefault, isStandalone: true, selector: "[ngSwitchDefault]", ngImport: i0 });
|
|
3781
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgSwitchDefault, decorators: [{
|
|
3782
3782
|
type: Directive,
|
|
3783
3783
|
args: [{
|
|
3784
3784
|
selector: '[ngSwitchDefault]',
|
|
@@ -3864,9 +3864,9 @@ class NgPlural {
|
|
|
3864
3864
|
}
|
|
3865
3865
|
}
|
|
3866
3866
|
}
|
|
3867
|
-
NgPlural.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3868
|
-
NgPlural.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
3869
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3867
|
+
NgPlural.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgPlural, deps: [{ token: NgLocalization }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3868
|
+
NgPlural.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0-next.0", type: NgPlural, isStandalone: true, selector: "[ngPlural]", inputs: { ngPlural: "ngPlural" }, ngImport: i0 });
|
|
3869
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgPlural, decorators: [{
|
|
3870
3870
|
type: Directive,
|
|
3871
3871
|
args: [{
|
|
3872
3872
|
selector: '[ngPlural]',
|
|
@@ -3902,9 +3902,9 @@ class NgPluralCase {
|
|
|
3902
3902
|
ngPlural.addCase(isANumber ? `=${value}` : value, new SwitchView(viewContainer, template));
|
|
3903
3903
|
}
|
|
3904
3904
|
}
|
|
3905
|
-
NgPluralCase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3906
|
-
NgPluralCase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
3907
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3905
|
+
NgPluralCase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgPluralCase, deps: [{ token: 'ngPluralCase', attribute: true }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: NgPlural, host: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3906
|
+
NgPluralCase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0-next.0", type: NgPluralCase, isStandalone: true, selector: "[ngPluralCase]", ngImport: i0 });
|
|
3907
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgPluralCase, decorators: [{
|
|
3908
3908
|
type: Directive,
|
|
3909
3909
|
args: [{
|
|
3910
3910
|
selector: '[ngPluralCase]',
|
|
@@ -4000,9 +4000,9 @@ class NgStyle {
|
|
|
4000
4000
|
changes.forEachChangedItem((record) => this._setStyle(record.key, record.currentValue));
|
|
4001
4001
|
}
|
|
4002
4002
|
}
|
|
4003
|
-
NgStyle.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4004
|
-
NgStyle.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
4005
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4003
|
+
NgStyle.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgStyle, deps: [{ token: i0.ElementRef }, { token: i0.KeyValueDiffers }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
|
|
4004
|
+
NgStyle.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0-next.0", type: NgStyle, isStandalone: true, selector: "[ngStyle]", inputs: { ngStyle: "ngStyle" }, ngImport: i0 });
|
|
4005
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgStyle, decorators: [{
|
|
4006
4006
|
type: Directive,
|
|
4007
4007
|
args: [{
|
|
4008
4008
|
selector: '[ngStyle]',
|
|
@@ -4082,9 +4082,9 @@ class NgTemplateOutlet {
|
|
|
4082
4082
|
}
|
|
4083
4083
|
}
|
|
4084
4084
|
}
|
|
4085
|
-
NgTemplateOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4086
|
-
NgTemplateOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
4087
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4085
|
+
NgTemplateOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgTemplateOutlet, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
4086
|
+
NgTemplateOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0-next.0", type: NgTemplateOutlet, isStandalone: true, selector: "[ngTemplateOutlet]", inputs: { ngTemplateOutletContext: "ngTemplateOutletContext", ngTemplateOutlet: "ngTemplateOutlet", ngTemplateOutletInjector: "ngTemplateOutletInjector" }, usesOnChanges: true, ngImport: i0 });
|
|
4087
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgTemplateOutlet, decorators: [{
|
|
4088
4088
|
type: Directive,
|
|
4089
4089
|
args: [{
|
|
4090
4090
|
selector: '[ngTemplateOutlet]',
|
|
@@ -4256,9 +4256,9 @@ class AsyncPipe {
|
|
|
4256
4256
|
}
|
|
4257
4257
|
}
|
|
4258
4258
|
}
|
|
4259
|
-
AsyncPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4260
|
-
AsyncPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
4261
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4259
|
+
AsyncPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: AsyncPipe, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
4260
|
+
AsyncPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: AsyncPipe, isStandalone: true, name: "async", pure: false });
|
|
4261
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: AsyncPipe, decorators: [{
|
|
4262
4262
|
type: Pipe,
|
|
4263
4263
|
args: [{
|
|
4264
4264
|
name: 'async',
|
|
@@ -4299,9 +4299,9 @@ class LowerCasePipe {
|
|
|
4299
4299
|
return value.toLowerCase();
|
|
4300
4300
|
}
|
|
4301
4301
|
}
|
|
4302
|
-
LowerCasePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4303
|
-
LowerCasePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
4304
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4302
|
+
LowerCasePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: LowerCasePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
4303
|
+
LowerCasePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: LowerCasePipe, isStandalone: true, name: "lowercase" });
|
|
4304
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: LowerCasePipe, decorators: [{
|
|
4305
4305
|
type: Pipe,
|
|
4306
4306
|
args: [{
|
|
4307
4307
|
name: 'lowercase',
|
|
@@ -4344,9 +4344,9 @@ class TitleCasePipe {
|
|
|
4344
4344
|
return value.replace(unicodeWordMatch, (txt => txt[0].toUpperCase() + txt.slice(1).toLowerCase()));
|
|
4345
4345
|
}
|
|
4346
4346
|
}
|
|
4347
|
-
TitleCasePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4348
|
-
TitleCasePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
4349
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4347
|
+
TitleCasePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: TitleCasePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
4348
|
+
TitleCasePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: TitleCasePipe, isStandalone: true, name: "titlecase" });
|
|
4349
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: TitleCasePipe, decorators: [{
|
|
4350
4350
|
type: Pipe,
|
|
4351
4351
|
args: [{
|
|
4352
4352
|
name: 'titlecase',
|
|
@@ -4371,9 +4371,9 @@ class UpperCasePipe {
|
|
|
4371
4371
|
return value.toUpperCase();
|
|
4372
4372
|
}
|
|
4373
4373
|
}
|
|
4374
|
-
UpperCasePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4375
|
-
UpperCasePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
4376
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4374
|
+
UpperCasePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: UpperCasePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
4375
|
+
UpperCasePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: UpperCasePipe, isStandalone: true, name: "uppercase" });
|
|
4376
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: UpperCasePipe, decorators: [{
|
|
4377
4377
|
type: Pipe,
|
|
4378
4378
|
args: [{
|
|
4379
4379
|
name: 'uppercase',
|
|
@@ -4569,9 +4569,9 @@ class DatePipe {
|
|
|
4569
4569
|
}
|
|
4570
4570
|
}
|
|
4571
4571
|
}
|
|
4572
|
-
DatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4573
|
-
DatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
4574
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4572
|
+
DatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: DatePipe, deps: [{ token: LOCALE_ID }, { token: DATE_PIPE_DEFAULT_TIMEZONE, optional: true }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
4573
|
+
DatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: DatePipe, isStandalone: true, name: "date" });
|
|
4574
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: DatePipe, decorators: [{
|
|
4575
4575
|
type: Pipe,
|
|
4576
4576
|
args: [{
|
|
4577
4577
|
name: 'date',
|
|
@@ -4633,9 +4633,9 @@ class I18nPluralPipe {
|
|
|
4633
4633
|
return pluralMap[key].replace(_INTERPOLATION_REGEXP, value.toString());
|
|
4634
4634
|
}
|
|
4635
4635
|
}
|
|
4636
|
-
I18nPluralPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4637
|
-
I18nPluralPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
4638
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4636
|
+
I18nPluralPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: I18nPluralPipe, deps: [{ token: NgLocalization }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
4637
|
+
I18nPluralPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: I18nPluralPipe, isStandalone: true, name: "i18nPlural" });
|
|
4638
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: I18nPluralPipe, decorators: [{
|
|
4639
4639
|
type: Pipe,
|
|
4640
4640
|
args: [{
|
|
4641
4641
|
name: 'i18nPlural',
|
|
@@ -4689,9 +4689,9 @@ class I18nSelectPipe {
|
|
|
4689
4689
|
return '';
|
|
4690
4690
|
}
|
|
4691
4691
|
}
|
|
4692
|
-
I18nSelectPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4693
|
-
I18nSelectPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
4694
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4692
|
+
I18nSelectPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: I18nSelectPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
4693
|
+
I18nSelectPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: I18nSelectPipe, isStandalone: true, name: "i18nSelect" });
|
|
4694
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: I18nSelectPipe, decorators: [{
|
|
4695
4695
|
type: Pipe,
|
|
4696
4696
|
args: [{
|
|
4697
4697
|
name: 'i18nSelect',
|
|
@@ -4730,9 +4730,9 @@ class JsonPipe {
|
|
|
4730
4730
|
return JSON.stringify(value, null, 2);
|
|
4731
4731
|
}
|
|
4732
4732
|
}
|
|
4733
|
-
JsonPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4734
|
-
JsonPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
4735
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4733
|
+
JsonPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: JsonPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
4734
|
+
JsonPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: JsonPipe, isStandalone: true, name: "json", pure: false });
|
|
4735
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: JsonPipe, decorators: [{
|
|
4736
4736
|
type: Pipe,
|
|
4737
4737
|
args: [{
|
|
4738
4738
|
name: 'json',
|
|
@@ -4800,9 +4800,9 @@ class KeyValuePipe {
|
|
|
4800
4800
|
return this.keyValues;
|
|
4801
4801
|
}
|
|
4802
4802
|
}
|
|
4803
|
-
KeyValuePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4804
|
-
KeyValuePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
4805
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4803
|
+
KeyValuePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: KeyValuePipe, deps: [{ token: i0.KeyValueDiffers }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
4804
|
+
KeyValuePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: KeyValuePipe, isStandalone: true, name: "keyvalue", pure: false });
|
|
4805
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: KeyValuePipe, decorators: [{
|
|
4806
4806
|
type: Pipe,
|
|
4807
4807
|
args: [{
|
|
4808
4808
|
name: 'keyvalue',
|
|
@@ -4935,9 +4935,9 @@ class DecimalPipe {
|
|
|
4935
4935
|
}
|
|
4936
4936
|
}
|
|
4937
4937
|
}
|
|
4938
|
-
DecimalPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4939
|
-
DecimalPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
4940
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4938
|
+
DecimalPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: DecimalPipe, deps: [{ token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
4939
|
+
DecimalPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: DecimalPipe, isStandalone: true, name: "number" });
|
|
4940
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: DecimalPipe, decorators: [{
|
|
4941
4941
|
type: Pipe,
|
|
4942
4942
|
args: [{
|
|
4943
4943
|
name: 'number',
|
|
@@ -5002,9 +5002,9 @@ class PercentPipe {
|
|
|
5002
5002
|
}
|
|
5003
5003
|
}
|
|
5004
5004
|
}
|
|
5005
|
-
PercentPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
5006
|
-
PercentPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
5007
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
5005
|
+
PercentPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: PercentPipe, deps: [{ token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
5006
|
+
PercentPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: PercentPipe, isStandalone: true, name: "percent" });
|
|
5007
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: PercentPipe, decorators: [{
|
|
5008
5008
|
type: Pipe,
|
|
5009
5009
|
args: [{
|
|
5010
5010
|
name: 'percent',
|
|
@@ -5122,9 +5122,9 @@ class CurrencyPipe {
|
|
|
5122
5122
|
}
|
|
5123
5123
|
}
|
|
5124
5124
|
}
|
|
5125
|
-
CurrencyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
5126
|
-
CurrencyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
5127
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
5125
|
+
CurrencyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: CurrencyPipe, deps: [{ token: LOCALE_ID }, { token: DEFAULT_CURRENCY_CODE }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
5126
|
+
CurrencyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: CurrencyPipe, isStandalone: true, name: "currency" });
|
|
5127
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: CurrencyPipe, decorators: [{
|
|
5128
5128
|
type: Pipe,
|
|
5129
5129
|
args: [{
|
|
5130
5130
|
name: 'currency',
|
|
@@ -5211,9 +5211,9 @@ class SlicePipe {
|
|
|
5211
5211
|
return typeof obj === 'string' || Array.isArray(obj);
|
|
5212
5212
|
}
|
|
5213
5213
|
}
|
|
5214
|
-
SlicePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
5215
|
-
SlicePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
5216
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
5214
|
+
SlicePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: SlicePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
5215
|
+
SlicePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: SlicePipe, isStandalone: true, name: "slice", pure: false });
|
|
5216
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: SlicePipe, decorators: [{
|
|
5217
5217
|
type: Pipe,
|
|
5218
5218
|
args: [{
|
|
5219
5219
|
name: 'slice',
|
|
@@ -5267,10 +5267,10 @@ const COMMON_PIPES = [
|
|
|
5267
5267
|
*/
|
|
5268
5268
|
class CommonModule {
|
|
5269
5269
|
}
|
|
5270
|
-
CommonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
5271
|
-
CommonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
5272
|
-
CommonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
5273
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
5270
|
+
CommonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: CommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
5271
|
+
CommonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: CommonModule, imports: [NgClass, NgComponentOutlet, NgForOf, NgIf, NgTemplateOutlet, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgPlural, NgPluralCase, AsyncPipe, UpperCasePipe, LowerCasePipe, JsonPipe, SlicePipe, DecimalPipe, PercentPipe, TitleCasePipe, CurrencyPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, KeyValuePipe], exports: [NgClass, NgComponentOutlet, NgForOf, NgIf, NgTemplateOutlet, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgPlural, NgPluralCase, AsyncPipe, UpperCasePipe, LowerCasePipe, JsonPipe, SlicePipe, DecimalPipe, PercentPipe, TitleCasePipe, CurrencyPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, KeyValuePipe] });
|
|
5272
|
+
CommonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: CommonModule });
|
|
5273
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: CommonModule, decorators: [{
|
|
5274
5274
|
type: NgModule,
|
|
5275
5275
|
args: [{
|
|
5276
5276
|
imports: [COMMON_DIRECTIVES, COMMON_PIPES],
|
|
@@ -5328,7 +5328,7 @@ function isPlatformWorkerUi(platformId) {
|
|
|
5328
5328
|
/**
|
|
5329
5329
|
* @publicApi
|
|
5330
5330
|
*/
|
|
5331
|
-
const VERSION = new Version('
|
|
5331
|
+
const VERSION = new Version('15.0.0-next.0');
|
|
5332
5332
|
|
|
5333
5333
|
/**
|
|
5334
5334
|
* @license
|
|
@@ -5553,6 +5553,1085 @@ class NullViewportScroller {
|
|
|
5553
5553
|
class XhrFactory {
|
|
5554
5554
|
}
|
|
5555
5555
|
|
|
5556
|
+
/**
|
|
5557
|
+
* @license
|
|
5558
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5559
|
+
*
|
|
5560
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
5561
|
+
* found in the LICENSE file at https://angular.io/license
|
|
5562
|
+
*/
|
|
5563
|
+
/**
|
|
5564
|
+
* Asserts that the application is in development mode. Throws an error if the application is in
|
|
5565
|
+
* production mode. This assert can be used to make sure that there is no dev-mode code invoked in
|
|
5566
|
+
* the prod mode accidentally.
|
|
5567
|
+
*/
|
|
5568
|
+
function assertDevMode(checkName) {
|
|
5569
|
+
if (!ngDevMode) {
|
|
5570
|
+
throw new ɵRuntimeError(2958 /* RuntimeErrorCode.UNEXPECTED_DEV_MODE_CHECK_IN_PROD_MODE */, `Unexpected invocation of the ${checkName} in the prod mode. ` +
|
|
5571
|
+
`Please make sure that the prod mode is enabled for production builds.`);
|
|
5572
|
+
}
|
|
5573
|
+
}
|
|
5574
|
+
|
|
5575
|
+
/**
|
|
5576
|
+
* @license
|
|
5577
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5578
|
+
*
|
|
5579
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
5580
|
+
* found in the LICENSE file at https://angular.io/license
|
|
5581
|
+
*/
|
|
5582
|
+
// Assembles directive details string, useful for error messages.
|
|
5583
|
+
function imgDirectiveDetails(rawSrc, includeRawSrc = true) {
|
|
5584
|
+
const rawSrcInfo = includeRawSrc ? `(activated on an <img> element with the \`rawSrc="${rawSrc}"\`) ` : '';
|
|
5585
|
+
return `The NgOptimizedImage directive ${rawSrcInfo}has detected that`;
|
|
5586
|
+
}
|
|
5587
|
+
|
|
5588
|
+
/**
|
|
5589
|
+
* @license
|
|
5590
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5591
|
+
*
|
|
5592
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
5593
|
+
* found in the LICENSE file at https://angular.io/license
|
|
5594
|
+
*/
|
|
5595
|
+
// Converts a string that represents a URL into a URL class instance.
|
|
5596
|
+
function getUrl(src, win) {
|
|
5597
|
+
// Don't use a base URL is the URL is absolute.
|
|
5598
|
+
return isAbsoluteUrl(src) ? new URL(src) : new URL(src, win.location.href);
|
|
5599
|
+
}
|
|
5600
|
+
// Checks whether a URL is absolute (i.e. starts with `http://` or `https://`).
|
|
5601
|
+
function isAbsoluteUrl(src) {
|
|
5602
|
+
return /^https?:\/\//.test(src);
|
|
5603
|
+
}
|
|
5604
|
+
// Given a URL, extract the hostname part.
|
|
5605
|
+
// If a URL is a relative one - the URL is returned as is.
|
|
5606
|
+
function extractHostname(url) {
|
|
5607
|
+
return isAbsoluteUrl(url) ? (new URL(url)).hostname : url;
|
|
5608
|
+
}
|
|
5609
|
+
function isValidPath(path) {
|
|
5610
|
+
const isString = typeof path === 'string';
|
|
5611
|
+
if (!isString || path.trim() === '') {
|
|
5612
|
+
return false;
|
|
5613
|
+
}
|
|
5614
|
+
// Calling new URL() will throw if the path string is malformed
|
|
5615
|
+
try {
|
|
5616
|
+
const url = new URL(path);
|
|
5617
|
+
return true;
|
|
5618
|
+
}
|
|
5619
|
+
catch (_a) {
|
|
5620
|
+
return false;
|
|
5621
|
+
}
|
|
5622
|
+
}
|
|
5623
|
+
function normalizePath(path) {
|
|
5624
|
+
return path.endsWith('/') ? path.slice(0, -1) : path;
|
|
5625
|
+
}
|
|
5626
|
+
function normalizeSrc(src) {
|
|
5627
|
+
return src.startsWith('/') ? src.slice(1) : src;
|
|
5628
|
+
}
|
|
5629
|
+
|
|
5630
|
+
/**
|
|
5631
|
+
* @license
|
|
5632
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5633
|
+
*
|
|
5634
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
5635
|
+
* found in the LICENSE file at https://angular.io/license
|
|
5636
|
+
*/
|
|
5637
|
+
// Set of origins that are always excluded from the preconnect checks.
|
|
5638
|
+
const INTERNAL_PRECONNECT_CHECK_BLOCKLIST = new Set(['localhost', '127.0.0.1', '0.0.0.0']);
|
|
5639
|
+
/**
|
|
5640
|
+
* Multi-provider injection token to configure which origins should be excluded
|
|
5641
|
+
* from the preconnect checks. It can either be a single string or an array of strings
|
|
5642
|
+
* to represent a group of origins, for example:
|
|
5643
|
+
*
|
|
5644
|
+
* ```typescript
|
|
5645
|
+
* {provide: PRECONNECT_CHECK_BLOCKLIST, multi: true, useValue: 'https://your-domain.com'}
|
|
5646
|
+
* ```
|
|
5647
|
+
*
|
|
5648
|
+
* or:
|
|
5649
|
+
*
|
|
5650
|
+
* ```typescript
|
|
5651
|
+
* {provide: PRECONNECT_CHECK_BLOCKLIST, multi: true,
|
|
5652
|
+
* useValue: ['https://your-domain-1.com', 'https://your-domain-2.com']}
|
|
5653
|
+
* ```
|
|
5654
|
+
*
|
|
5655
|
+
* @publicApi
|
|
5656
|
+
* @developerPreview
|
|
5657
|
+
*/
|
|
5658
|
+
const PRECONNECT_CHECK_BLOCKLIST = new InjectionToken('PRECONNECT_CHECK_BLOCKLIST');
|
|
5659
|
+
/**
|
|
5660
|
+
* Contains the logic to detect whether an image, marked with the "priority" attribute
|
|
5661
|
+
* has a corresponding `<link rel="preconnect">` tag in the `document.head`.
|
|
5662
|
+
*
|
|
5663
|
+
* Note: this is a dev-mode only class, which should not appear in prod bundles,
|
|
5664
|
+
* thus there is no `ngDevMode` use in the code.
|
|
5665
|
+
*/
|
|
5666
|
+
class PreconnectLinkChecker {
|
|
5667
|
+
constructor() {
|
|
5668
|
+
/**
|
|
5669
|
+
* Set of <link rel="preconnect"> tags found on this page.
|
|
5670
|
+
* The `null` value indicates that there was no DOM query operation performed.
|
|
5671
|
+
*/
|
|
5672
|
+
this.preconnectLinks = null;
|
|
5673
|
+
/*
|
|
5674
|
+
* Keep track of all already seen origin URLs to avoid repeating the same check.
|
|
5675
|
+
*/
|
|
5676
|
+
this.alreadySeen = new Set();
|
|
5677
|
+
this.window = null;
|
|
5678
|
+
this.blocklist = new Set(INTERNAL_PRECONNECT_CHECK_BLOCKLIST);
|
|
5679
|
+
assertDevMode('preconnect link checker');
|
|
5680
|
+
const win = inject(DOCUMENT).defaultView;
|
|
5681
|
+
if (typeof win !== 'undefined') {
|
|
5682
|
+
this.window = win;
|
|
5683
|
+
}
|
|
5684
|
+
const blocklist = inject(PRECONNECT_CHECK_BLOCKLIST, { optional: true });
|
|
5685
|
+
if (blocklist) {
|
|
5686
|
+
this.populateBlocklist(blocklist);
|
|
5687
|
+
}
|
|
5688
|
+
}
|
|
5689
|
+
populateBlocklist(origins) {
|
|
5690
|
+
if (Array.isArray(origins)) {
|
|
5691
|
+
deepForEach(origins, origin => {
|
|
5692
|
+
this.blocklist.add(extractHostname(origin));
|
|
5693
|
+
});
|
|
5694
|
+
}
|
|
5695
|
+
else {
|
|
5696
|
+
throw new ɵRuntimeError(2957 /* RuntimeErrorCode.INVALID_PRECONNECT_CHECK_BLOCKLIST */, `The blocklist for the preconnect check was not provided as an array. ` +
|
|
5697
|
+
`Check that the \`PRECONNECT_CHECK_BLOCKLIST\` token is configured as a \`multi: true\` provider.`);
|
|
5698
|
+
}
|
|
5699
|
+
}
|
|
5700
|
+
/**
|
|
5701
|
+
* Checks that a preconnect resource hint exists in the head fo rthe
|
|
5702
|
+
* given src.
|
|
5703
|
+
*
|
|
5704
|
+
* @param rewrittenSrc src formatted with loader
|
|
5705
|
+
* @param rawSrc rawSrc value
|
|
5706
|
+
*/
|
|
5707
|
+
assertPreconnect(rewrittenSrc, rawSrc) {
|
|
5708
|
+
if (!this.window)
|
|
5709
|
+
return;
|
|
5710
|
+
const imgUrl = getUrl(rewrittenSrc, this.window);
|
|
5711
|
+
if (this.blocklist.has(imgUrl.hostname) || this.alreadySeen.has(imgUrl.origin))
|
|
5712
|
+
return;
|
|
5713
|
+
// Register this origin as seen, so we don't check it again later.
|
|
5714
|
+
this.alreadySeen.add(imgUrl.origin);
|
|
5715
|
+
if (!this.preconnectLinks) {
|
|
5716
|
+
// Note: we query for preconnect links only *once* and cache the results
|
|
5717
|
+
// for the entire lifespan of an application, since it's unlikely that the
|
|
5718
|
+
// list would change frequently. This allows to make sure there are no
|
|
5719
|
+
// performance implications of making extra DOM lookups for each image.
|
|
5720
|
+
this.preconnectLinks = this.queryPreconnectLinks();
|
|
5721
|
+
}
|
|
5722
|
+
if (!this.preconnectLinks.has(imgUrl.origin)) {
|
|
5723
|
+
console.warn(ɵformatRuntimeError(2956 /* RuntimeErrorCode.PRIORITY_IMG_MISSING_PRECONNECT_TAG */, `${imgDirectiveDetails(rawSrc)} there is no preconnect tag present for this image. ` +
|
|
5724
|
+
`Preconnecting to the origin(s) that serve priority images ensures that these ` +
|
|
5725
|
+
`images are delivered as soon as possible. To fix this, please add the following ` +
|
|
5726
|
+
`element into the <head> of the document:\n` +
|
|
5727
|
+
` <link rel="preconnect" href="${imgUrl.origin}">`));
|
|
5728
|
+
}
|
|
5729
|
+
}
|
|
5730
|
+
queryPreconnectLinks() {
|
|
5731
|
+
const preconnectUrls = new Set();
|
|
5732
|
+
const selector = 'link[rel=preconnect]';
|
|
5733
|
+
const links = Array.from(document.querySelectorAll(selector));
|
|
5734
|
+
for (let link of links) {
|
|
5735
|
+
const url = getUrl(link.href, this.window);
|
|
5736
|
+
preconnectUrls.add(url.origin);
|
|
5737
|
+
}
|
|
5738
|
+
return preconnectUrls;
|
|
5739
|
+
}
|
|
5740
|
+
ngOnDestroy() {
|
|
5741
|
+
var _a;
|
|
5742
|
+
(_a = this.preconnectLinks) === null || _a === void 0 ? void 0 : _a.clear();
|
|
5743
|
+
this.alreadySeen.clear();
|
|
5744
|
+
}
|
|
5745
|
+
}
|
|
5746
|
+
PreconnectLinkChecker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: PreconnectLinkChecker, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5747
|
+
PreconnectLinkChecker.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: PreconnectLinkChecker, providedIn: 'root' });
|
|
5748
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: PreconnectLinkChecker, decorators: [{
|
|
5749
|
+
type: Injectable,
|
|
5750
|
+
args: [{ providedIn: 'root' }]
|
|
5751
|
+
}], ctorParameters: function () { return []; } });
|
|
5752
|
+
/**
|
|
5753
|
+
* Invokes a callback for each element in the array. Also invokes a callback
|
|
5754
|
+
* recursively for each nested array.
|
|
5755
|
+
*/
|
|
5756
|
+
function deepForEach(input, fn) {
|
|
5757
|
+
for (let value of input) {
|
|
5758
|
+
Array.isArray(value) ? deepForEach(value, fn) : fn(value);
|
|
5759
|
+
}
|
|
5760
|
+
}
|
|
5761
|
+
|
|
5762
|
+
/**
|
|
5763
|
+
* @license
|
|
5764
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5765
|
+
*
|
|
5766
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
5767
|
+
* found in the LICENSE file at https://angular.io/license
|
|
5768
|
+
*/
|
|
5769
|
+
/**
|
|
5770
|
+
* Noop image loader that does no transformation to the original src and just returns it as is.
|
|
5771
|
+
* This loader is used as a default one if more specific logic is not provided in an app config.
|
|
5772
|
+
*
|
|
5773
|
+
* @see `ImageLoader`
|
|
5774
|
+
* @see `NgOptimizedImage`
|
|
5775
|
+
*/
|
|
5776
|
+
const noopImageLoader = (config) => config.src;
|
|
5777
|
+
/**
|
|
5778
|
+
* Injection token that configures the image loader function.
|
|
5779
|
+
*
|
|
5780
|
+
* @see `ImageLoader`
|
|
5781
|
+
* @see `NgOptimizedImage`
|
|
5782
|
+
* @publicApi
|
|
5783
|
+
* @developerPreview
|
|
5784
|
+
*/
|
|
5785
|
+
const IMAGE_LOADER = new InjectionToken('ImageLoader', {
|
|
5786
|
+
providedIn: 'root',
|
|
5787
|
+
factory: () => noopImageLoader,
|
|
5788
|
+
});
|
|
5789
|
+
/**
|
|
5790
|
+
* Internal helper function that makes it easier to introduce custom image loaders for the
|
|
5791
|
+
* `NgOptimizedImage` directive. It is enough to specify a URL builder function to obtain full DI
|
|
5792
|
+
* configuration for a given loader: a DI token corresponding to the actual loader function, plus DI
|
|
5793
|
+
* tokens managing preconnect check functionality.
|
|
5794
|
+
* @param buildUrlFn a function returning a full URL based on loader's configuration
|
|
5795
|
+
* @param exampleUrls example of full URLs for a given loader (used in error messages)
|
|
5796
|
+
* @returns a set of DI providers corresponding to the configured image loader
|
|
5797
|
+
*/
|
|
5798
|
+
function createImageLoader(buildUrlFn, exampleUrls) {
|
|
5799
|
+
return function provideImageLoader(path, options = { ensurePreconnect: true }) {
|
|
5800
|
+
if (!isValidPath(path)) {
|
|
5801
|
+
throwInvalidPathError(path, exampleUrls || []);
|
|
5802
|
+
}
|
|
5803
|
+
// The trailing / is stripped (if provided) to make URL construction (concatenation) easier in
|
|
5804
|
+
// the individual loader functions.
|
|
5805
|
+
path = normalizePath(path);
|
|
5806
|
+
const loaderFn = (config) => {
|
|
5807
|
+
if (isAbsoluteUrl(config.src)) {
|
|
5808
|
+
// Image loader functions expect an image file name (e.g. `my-image.png`)
|
|
5809
|
+
// or a relative path + a file name (e.g. `/a/b/c/my-image.png`) as an input,
|
|
5810
|
+
// so the final absolute URL can be constructed.
|
|
5811
|
+
// When an absolute URL is provided instead - the loader can not
|
|
5812
|
+
// build a final URL, thus the error is thrown to indicate that.
|
|
5813
|
+
throwUnexpectedAbsoluteUrlError(path, config.src);
|
|
5814
|
+
}
|
|
5815
|
+
return buildUrlFn(path, Object.assign(Object.assign({}, config), { src: normalizeSrc(config.src) }));
|
|
5816
|
+
};
|
|
5817
|
+
const providers = [{ provide: IMAGE_LOADER, useValue: loaderFn }];
|
|
5818
|
+
if (ngDevMode && options.ensurePreconnect === false) {
|
|
5819
|
+
providers.push({ provide: PRECONNECT_CHECK_BLOCKLIST, useValue: [path], multi: true });
|
|
5820
|
+
}
|
|
5821
|
+
return providers;
|
|
5822
|
+
};
|
|
5823
|
+
}
|
|
5824
|
+
function throwInvalidPathError(path, exampleUrls) {
|
|
5825
|
+
throw new ɵRuntimeError(2959 /* RuntimeErrorCode.INVALID_LOADER_ARGUMENTS */, ngDevMode &&
|
|
5826
|
+
`Image loader has detected an invalid path (\`${path}\`). ` +
|
|
5827
|
+
`To fix this, supply a path using one of the following formats: ${exampleUrls.join(' or ')}`);
|
|
5828
|
+
}
|
|
5829
|
+
function throwUnexpectedAbsoluteUrlError(path, url) {
|
|
5830
|
+
throw new ɵRuntimeError(2959 /* RuntimeErrorCode.INVALID_LOADER_ARGUMENTS */, ngDevMode &&
|
|
5831
|
+
`Image loader has detected a \`<img>\` tag with an invalid \`rawSrc\` attribute: ${url}. ` +
|
|
5832
|
+
`This image loader expects \`rawSrc\` to be a relative URL - ` +
|
|
5833
|
+
`however the provided value is an absolute URL. ` +
|
|
5834
|
+
`To fix this, provide \`rawSrc\` as a path relative to the base URL ` +
|
|
5835
|
+
`configured for this loader (\`${path}\`).`);
|
|
5836
|
+
}
|
|
5837
|
+
|
|
5838
|
+
/**
|
|
5839
|
+
* @license
|
|
5840
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5841
|
+
*
|
|
5842
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
5843
|
+
* found in the LICENSE file at https://angular.io/license
|
|
5844
|
+
*/
|
|
5845
|
+
/**
|
|
5846
|
+
* Function that generates an ImageLoader for [Cloudflare Image
|
|
5847
|
+
* Resizing](https://developers.cloudflare.com/images/image-resizing/) and turns it into an Angular
|
|
5848
|
+
* provider. Note: Cloudflare has multiple image products - this provider is specifically for
|
|
5849
|
+
* Cloudflare Image Resizing; it will not work with Cloudflare Images or Cloudflare Polish.
|
|
5850
|
+
*
|
|
5851
|
+
* @param path Your domain name, e.g. https://mysite.com
|
|
5852
|
+
* @param options An object with extra configuration:
|
|
5853
|
+
* - `ensurePreconnect`: boolean flag indicating whether the NgOptimizedImage directive
|
|
5854
|
+
* should verify that there is a corresponding `<link rel="preconnect">`
|
|
5855
|
+
* present in the document's `<head>`.
|
|
5856
|
+
* @returns Provider that provides an ImageLoader function
|
|
5857
|
+
*
|
|
5858
|
+
* @publicApi
|
|
5859
|
+
* @developerPreview
|
|
5860
|
+
*/
|
|
5861
|
+
const provideCloudflareLoader = createImageLoader(createCloudflareUrl, ngDevMode ? ['https://<ZONE>/cdn-cgi/image/<OPTIONS>/<SOURCE-IMAGE>'] : undefined);
|
|
5862
|
+
function createCloudflareUrl(path, config) {
|
|
5863
|
+
let params = `format=auto`;
|
|
5864
|
+
if (config.width) {
|
|
5865
|
+
params += `,width=${config.width}`;
|
|
5866
|
+
}
|
|
5867
|
+
// Cloudflare image URLs format:
|
|
5868
|
+
// https://developers.cloudflare.com/images/image-resizing/url-format/
|
|
5869
|
+
return `${path}/cdn-cgi/image/${params}/${config.src}`;
|
|
5870
|
+
}
|
|
5871
|
+
|
|
5872
|
+
/**
|
|
5873
|
+
* @license
|
|
5874
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5875
|
+
*
|
|
5876
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
5877
|
+
* found in the LICENSE file at https://angular.io/license
|
|
5878
|
+
*/
|
|
5879
|
+
/**
|
|
5880
|
+
* Function that generates an ImageLoader for Cloudinary and turns it into an Angular provider.
|
|
5881
|
+
*
|
|
5882
|
+
* @param path Base URL of your Cloudinary images
|
|
5883
|
+
* This URL should match one of the following formats:
|
|
5884
|
+
* https://res.cloudinary.com/mysite
|
|
5885
|
+
* https://mysite.cloudinary.com
|
|
5886
|
+
* https://subdomain.mysite.com
|
|
5887
|
+
* @param options An object with extra configuration:
|
|
5888
|
+
* - `ensurePreconnect`: boolean flag indicating whether the NgOptimizedImage directive
|
|
5889
|
+
* should verify that there is a corresponding `<link rel="preconnect">`
|
|
5890
|
+
* present in the document's `<head>`.
|
|
5891
|
+
* @returns Set of providers to configure the Cloudinary loader.
|
|
5892
|
+
*
|
|
5893
|
+
* @publicApi
|
|
5894
|
+
* @developerPreview
|
|
5895
|
+
*/
|
|
5896
|
+
const provideCloudinaryLoader = createImageLoader(createCloudinaryUrl, ngDevMode ?
|
|
5897
|
+
[
|
|
5898
|
+
'https://res.cloudinary.com/mysite', 'https://mysite.cloudinary.com',
|
|
5899
|
+
'https://subdomain.mysite.com'
|
|
5900
|
+
] :
|
|
5901
|
+
undefined);
|
|
5902
|
+
function createCloudinaryUrl(path, config) {
|
|
5903
|
+
// Cloudinary image URLformat:
|
|
5904
|
+
// https://cloudinary.com/documentation/image_transformations#transformation_url_structure
|
|
5905
|
+
// Example of a Cloudinary image URL:
|
|
5906
|
+
// https://res.cloudinary.com/mysite/image/upload/c_scale,f_auto,q_auto,w_600/marketing/tile-topics-m.png
|
|
5907
|
+
let params = `f_auto,q_auto`; // sets image format and quality to "auto"
|
|
5908
|
+
if (config.width) {
|
|
5909
|
+
params += `,w_${config.width}`;
|
|
5910
|
+
}
|
|
5911
|
+
return `${path}/image/upload/${params}/${config.src}`;
|
|
5912
|
+
}
|
|
5913
|
+
|
|
5914
|
+
/**
|
|
5915
|
+
* @license
|
|
5916
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5917
|
+
*
|
|
5918
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
5919
|
+
* found in the LICENSE file at https://angular.io/license
|
|
5920
|
+
*/
|
|
5921
|
+
/**
|
|
5922
|
+
* Function that generates an ImageLoader for ImageKit and turns it into an Angular provider.
|
|
5923
|
+
*
|
|
5924
|
+
* @param path Base URL of your ImageKit images
|
|
5925
|
+
* This URL should match one of the following formats:
|
|
5926
|
+
* https://ik.imagekit.io/myaccount
|
|
5927
|
+
* https://subdomain.mysite.com
|
|
5928
|
+
* @param options An object with extra configuration:
|
|
5929
|
+
* - `ensurePreconnect`: boolean flag indicating whether the NgOptimizedImage directive
|
|
5930
|
+
* should verify that there is a corresponding `<link rel="preconnect">`
|
|
5931
|
+
* present in the document's `<head>`.
|
|
5932
|
+
* @returns Set of providers to configure the ImageKit loader.
|
|
5933
|
+
*
|
|
5934
|
+
* @publicApi
|
|
5935
|
+
* @developerPreview
|
|
5936
|
+
*/
|
|
5937
|
+
const provideImageKitLoader = createImageLoader(createImagekitUrl, ngDevMode ? ['https://ik.imagekit.io/mysite', 'https://subdomain.mysite.com'] : undefined);
|
|
5938
|
+
function createImagekitUrl(path, config) {
|
|
5939
|
+
// Example of an ImageKit image URL:
|
|
5940
|
+
// https://ik.imagekit.io/demo/tr:w-300,h-300/medium_cafe_B1iTdD0C.jpg
|
|
5941
|
+
let params = `tr:q-auto`; // applies the "auto quality" transformation
|
|
5942
|
+
if (config.width) {
|
|
5943
|
+
params += `,w-${config.width}`;
|
|
5944
|
+
}
|
|
5945
|
+
return `${path}/${params}/${config.src}`;
|
|
5946
|
+
}
|
|
5947
|
+
|
|
5948
|
+
/**
|
|
5949
|
+
* @license
|
|
5950
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5951
|
+
*
|
|
5952
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
5953
|
+
* found in the LICENSE file at https://angular.io/license
|
|
5954
|
+
*/
|
|
5955
|
+
/**
|
|
5956
|
+
* Function that generates an ImageLoader for Imgix and turns it into an Angular provider.
|
|
5957
|
+
*
|
|
5958
|
+
* @param path path to the desired Imgix origin,
|
|
5959
|
+
* e.g. https://somepath.imgix.net or https://images.mysite.com
|
|
5960
|
+
* @param options An object with extra configuration:
|
|
5961
|
+
* - `ensurePreconnect`: boolean flag indicating whether the NgOptimizedImage directive
|
|
5962
|
+
* should verify that there is a corresponding `<link rel="preconnect">`
|
|
5963
|
+
* present in the document's `<head>`.
|
|
5964
|
+
* @returns Set of providers to configure the Imgix loader.
|
|
5965
|
+
*
|
|
5966
|
+
* @publicApi
|
|
5967
|
+
* @developerPreview
|
|
5968
|
+
*/
|
|
5969
|
+
const provideImgixLoader = createImageLoader(createImgixUrl, ngDevMode ? ['https://somepath.imgix.net/'] : undefined);
|
|
5970
|
+
function createImgixUrl(path, config) {
|
|
5971
|
+
const url = new URL(`${path}/${config.src}`);
|
|
5972
|
+
// This setting ensures the smallest allowable format is set.
|
|
5973
|
+
url.searchParams.set('auto', 'format');
|
|
5974
|
+
if (config.width) {
|
|
5975
|
+
url.searchParams.set('w', config.width.toString());
|
|
5976
|
+
}
|
|
5977
|
+
return url.href;
|
|
5978
|
+
}
|
|
5979
|
+
|
|
5980
|
+
/**
|
|
5981
|
+
* @license
|
|
5982
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5983
|
+
*
|
|
5984
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
5985
|
+
* found in the LICENSE file at https://angular.io/license
|
|
5986
|
+
*/
|
|
5987
|
+
/**
|
|
5988
|
+
* Observer that detects whether an image with `NgOptimizedImage`
|
|
5989
|
+
* is treated as a Largest Contentful Paint (LCP) element. If so,
|
|
5990
|
+
* asserts that the image has the `priority` attribute.
|
|
5991
|
+
*
|
|
5992
|
+
* Note: this is a dev-mode only class and it does not appear in prod bundles,
|
|
5993
|
+
* thus there is no `ngDevMode` use in the code.
|
|
5994
|
+
*
|
|
5995
|
+
* Based on https://web.dev/lcp/#measure-lcp-in-javascript.
|
|
5996
|
+
*/
|
|
5997
|
+
class LCPImageObserver {
|
|
5998
|
+
constructor() {
|
|
5999
|
+
// Map of full image URLs -> original `rawSrc` values.
|
|
6000
|
+
this.images = new Map();
|
|
6001
|
+
// Keep track of images for which `console.warn` was produced.
|
|
6002
|
+
this.alreadyWarned = new Set();
|
|
6003
|
+
this.window = null;
|
|
6004
|
+
this.observer = null;
|
|
6005
|
+
assertDevMode('LCP checker');
|
|
6006
|
+
const win = inject(DOCUMENT).defaultView;
|
|
6007
|
+
if (typeof win !== 'undefined' && typeof PerformanceObserver !== 'undefined') {
|
|
6008
|
+
this.window = win;
|
|
6009
|
+
this.observer = this.initPerformanceObserver();
|
|
6010
|
+
}
|
|
6011
|
+
}
|
|
6012
|
+
/**
|
|
6013
|
+
* Inits PerformanceObserver and subscribes to LCP events.
|
|
6014
|
+
* Based on https://web.dev/lcp/#measure-lcp-in-javascript
|
|
6015
|
+
*/
|
|
6016
|
+
initPerformanceObserver() {
|
|
6017
|
+
const observer = new PerformanceObserver((entryList) => {
|
|
6018
|
+
var _a, _b;
|
|
6019
|
+
const entries = entryList.getEntries();
|
|
6020
|
+
if (entries.length === 0)
|
|
6021
|
+
return;
|
|
6022
|
+
// We use the latest entry produced by the `PerformanceObserver` as the best
|
|
6023
|
+
// signal on which element is actually an LCP one. As an example, the first image to load on
|
|
6024
|
+
// a page, by virtue of being the only thing on the page so far, is often a LCP candidate
|
|
6025
|
+
// and gets reported by PerformanceObserver, but isn't necessarily the LCP element.
|
|
6026
|
+
const lcpElement = entries[entries.length - 1];
|
|
6027
|
+
// Cast to `any` due to missing `element` on the `LargestContentfulPaint` type of entry.
|
|
6028
|
+
// See https://developer.mozilla.org/en-US/docs/Web/API/LargestContentfulPaint
|
|
6029
|
+
const imgSrc = (_b = (_a = lcpElement.element) === null || _a === void 0 ? void 0 : _a.src) !== null && _b !== void 0 ? _b : '';
|
|
6030
|
+
// Exclude `data:` and `blob:` URLs, since they are not supported by the directive.
|
|
6031
|
+
if (imgSrc.startsWith('data:') || imgSrc.startsWith('blob:'))
|
|
6032
|
+
return;
|
|
6033
|
+
const imgRawSrc = this.images.get(imgSrc);
|
|
6034
|
+
if (imgRawSrc && !this.alreadyWarned.has(imgSrc)) {
|
|
6035
|
+
this.alreadyWarned.add(imgSrc);
|
|
6036
|
+
logMissingPriorityWarning(imgSrc);
|
|
6037
|
+
}
|
|
6038
|
+
});
|
|
6039
|
+
observer.observe({ type: 'largest-contentful-paint', buffered: true });
|
|
6040
|
+
return observer;
|
|
6041
|
+
}
|
|
6042
|
+
registerImage(rewrittenSrc, rawSrc) {
|
|
6043
|
+
if (!this.observer)
|
|
6044
|
+
return;
|
|
6045
|
+
this.images.set(getUrl(rewrittenSrc, this.window).href, rawSrc);
|
|
6046
|
+
}
|
|
6047
|
+
unregisterImage(rewrittenSrc) {
|
|
6048
|
+
if (!this.observer)
|
|
6049
|
+
return;
|
|
6050
|
+
this.images.delete(getUrl(rewrittenSrc, this.window).href);
|
|
6051
|
+
}
|
|
6052
|
+
ngOnDestroy() {
|
|
6053
|
+
if (!this.observer)
|
|
6054
|
+
return;
|
|
6055
|
+
this.observer.disconnect();
|
|
6056
|
+
this.images.clear();
|
|
6057
|
+
this.alreadyWarned.clear();
|
|
6058
|
+
}
|
|
6059
|
+
}
|
|
6060
|
+
LCPImageObserver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: LCPImageObserver, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6061
|
+
LCPImageObserver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: LCPImageObserver, providedIn: 'root' });
|
|
6062
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: LCPImageObserver, decorators: [{
|
|
6063
|
+
type: Injectable,
|
|
6064
|
+
args: [{ providedIn: 'root' }]
|
|
6065
|
+
}], ctorParameters: function () { return []; } });
|
|
6066
|
+
function logMissingPriorityWarning(rawSrc) {
|
|
6067
|
+
const directiveDetails = imgDirectiveDetails(rawSrc);
|
|
6068
|
+
console.warn(ɵformatRuntimeError(2955 /* RuntimeErrorCode.LCP_IMG_MISSING_PRIORITY */, `${directiveDetails} this image is the Largest Contentful Paint (LCP) ` +
|
|
6069
|
+
`element but was not marked "priority". This image should be marked ` +
|
|
6070
|
+
`"priority" in order to prioritize its loading. ` +
|
|
6071
|
+
`To fix this, add the "priority" attribute.`));
|
|
6072
|
+
}
|
|
6073
|
+
|
|
6074
|
+
/**
|
|
6075
|
+
* @license
|
|
6076
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6077
|
+
*
|
|
6078
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6079
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6080
|
+
*/
|
|
6081
|
+
/**
|
|
6082
|
+
* When a Base64-encoded image is passed as an input to the `NgOptimizedImage` directive,
|
|
6083
|
+
* an error is thrown. The image content (as a string) might be very long, thus making
|
|
6084
|
+
* it hard to read an error message if the entire string is included. This const defines
|
|
6085
|
+
* the number of characters that should be included into the error message. The rest
|
|
6086
|
+
* of the content is truncated.
|
|
6087
|
+
*/
|
|
6088
|
+
const BASE64_IMG_MAX_LENGTH_IN_ERROR = 50;
|
|
6089
|
+
/**
|
|
6090
|
+
* RegExpr to determine whether a src in a srcset is using width descriptors.
|
|
6091
|
+
* Should match something like: "100w, 200w".
|
|
6092
|
+
*/
|
|
6093
|
+
const VALID_WIDTH_DESCRIPTOR_SRCSET = /^((\s*\d+w\s*(,|$)){1,})$/;
|
|
6094
|
+
/**
|
|
6095
|
+
* RegExpr to determine whether a src in a srcset is using density descriptors.
|
|
6096
|
+
* Should match something like: "1x, 2x, 50x". Also supports decimals like "1.5x, 1.50x".
|
|
6097
|
+
*/
|
|
6098
|
+
const VALID_DENSITY_DESCRIPTOR_SRCSET = /^((\s*\d+(\.\d+)?x\s*(,|$)){1,})$/;
|
|
6099
|
+
/**
|
|
6100
|
+
* Srcset values with a density descriptor higher than this value will actively
|
|
6101
|
+
* throw an error. Such densities are not permitted as they cause image sizes
|
|
6102
|
+
* to be unreasonably large and slow down LCP.
|
|
6103
|
+
*/
|
|
6104
|
+
const ABSOLUTE_SRCSET_DENSITY_CAP = 3;
|
|
6105
|
+
/**
|
|
6106
|
+
* Used only in error message text to communicate best practices, as we will
|
|
6107
|
+
* only throw based on the slightly more conservative ABSOLUTE_SRCSET_DENSITY_CAP.
|
|
6108
|
+
*/
|
|
6109
|
+
const RECOMMENDED_SRCSET_DENSITY_CAP = 2;
|
|
6110
|
+
/**
|
|
6111
|
+
* Used to determine whether two aspect ratios are similar in value.
|
|
6112
|
+
*/
|
|
6113
|
+
const ASPECT_RATIO_TOLERANCE = .1;
|
|
6114
|
+
/**
|
|
6115
|
+
* Used to determine whether the image has been requested at an overly
|
|
6116
|
+
* large size compared to the actual rendered image size (after taking
|
|
6117
|
+
* into account a typical device pixel ratio). In pixels.
|
|
6118
|
+
*/
|
|
6119
|
+
const OVERSIZED_IMAGE_TOLERANCE = 1000;
|
|
6120
|
+
/**
|
|
6121
|
+
* Directive that improves image loading performance by enforcing best practices.
|
|
6122
|
+
*
|
|
6123
|
+
* `NgOptimizedImage` ensures that the loading of the Largest Contentful Paint (LCP) image is
|
|
6124
|
+
* prioritized by:
|
|
6125
|
+
* - Automatically setting the `fetchpriority` attribute on the `<img>` tag
|
|
6126
|
+
* - Lazy loading non-priority images by default
|
|
6127
|
+
* - Asserting that there is a corresponding preconnect link tag in the document head
|
|
6128
|
+
*
|
|
6129
|
+
* In addition, the directive:
|
|
6130
|
+
* - Generates appropriate asset URLs if a corresponding `ImageLoader` function is provided
|
|
6131
|
+
* - Requires that `width` and `height` are set
|
|
6132
|
+
* - Warns if `width` or `height` have been set incorrectly
|
|
6133
|
+
* - Warns if the image will be visually distorted when rendered
|
|
6134
|
+
*
|
|
6135
|
+
* @usageNotes
|
|
6136
|
+
* The `NgOptimizedImage` directive is marked as [standalone](guide/standalone-components) and can
|
|
6137
|
+
* be imported directly.
|
|
6138
|
+
*
|
|
6139
|
+
* Follow the steps below to enable and use the directive:
|
|
6140
|
+
* 1. Import it into the necessary NgModule or a standalone Component.
|
|
6141
|
+
* 2. Optionally provide an `ImageLoader` if you use an image hosting service.
|
|
6142
|
+
* 3. Update the necessary `<img>` tags in templates and replace `src` attributes with `rawSrc`.
|
|
6143
|
+
* Using a `rawSrc` allows the directive to control when the `src` gets set, which triggers an image
|
|
6144
|
+
* download.
|
|
6145
|
+
*
|
|
6146
|
+
* Step 1: import the `NgOptimizedImage` directive.
|
|
6147
|
+
*
|
|
6148
|
+
* ```typescript
|
|
6149
|
+
* import { NgOptimizedImage } from '@angular/common';
|
|
6150
|
+
*
|
|
6151
|
+
* // Include it into the necessary NgModule
|
|
6152
|
+
* @NgModule({
|
|
6153
|
+
* imports: [NgOptimizedImage],
|
|
6154
|
+
* })
|
|
6155
|
+
* class AppModule {}
|
|
6156
|
+
*
|
|
6157
|
+
* // ... or a standalone Component
|
|
6158
|
+
* @Component({
|
|
6159
|
+
* standalone: true
|
|
6160
|
+
* imports: [NgOptimizedImage],
|
|
6161
|
+
* })
|
|
6162
|
+
* class MyStandaloneComponent {}
|
|
6163
|
+
* ```
|
|
6164
|
+
*
|
|
6165
|
+
* Step 2: configure a loader.
|
|
6166
|
+
*
|
|
6167
|
+
* To use the **default loader**: no additional code changes are necessary. The URL returned by the
|
|
6168
|
+
* generic loader will always match the value of "src". In other words, this loader applies no
|
|
6169
|
+
* transformations to the resource URL and the value of the `rawSrc` attribute will be used as is.
|
|
6170
|
+
*
|
|
6171
|
+
* To use an existing loader for a **third-party image service**: add the provider factory for your
|
|
6172
|
+
* chosen service to the `providers` array. In the example below, the Imgix loader is used:
|
|
6173
|
+
*
|
|
6174
|
+
* ```typescript
|
|
6175
|
+
* import {provideImgixLoader} from '@angular/common';
|
|
6176
|
+
*
|
|
6177
|
+
* // Call the function and add the result to the `providers` array:
|
|
6178
|
+
* providers: [
|
|
6179
|
+
* provideImgixLoader("https://my.base.url/"),
|
|
6180
|
+
* ],
|
|
6181
|
+
* ```
|
|
6182
|
+
*
|
|
6183
|
+
* The `NgOptimizedImage` directive provides the following functions:
|
|
6184
|
+
* - `provideCloudflareLoader`
|
|
6185
|
+
* - `provideCloudinaryLoader`
|
|
6186
|
+
* - `provideImageKitLoader`
|
|
6187
|
+
* - `provideImgixLoader`
|
|
6188
|
+
*
|
|
6189
|
+
* If you use a different image provider, you can create a custom loader function as described
|
|
6190
|
+
* below.
|
|
6191
|
+
*
|
|
6192
|
+
* To use a **custom loader**: provide your loader function as a value for the `IMAGE_LOADER` DI
|
|
6193
|
+
* token.
|
|
6194
|
+
*
|
|
6195
|
+
* ```typescript
|
|
6196
|
+
* import {IMAGE_LOADER, ImageLoaderConfig} from '@angular/common';
|
|
6197
|
+
*
|
|
6198
|
+
* // Configure the loader using the `IMAGE_LOADER` token.
|
|
6199
|
+
* providers: [
|
|
6200
|
+
* {
|
|
6201
|
+
* provide: IMAGE_LOADER,
|
|
6202
|
+
* useValue: (config: ImageLoaderConfig) => {
|
|
6203
|
+
* return `https://example.com/${config.src}-${config.width}.jpg}`;
|
|
6204
|
+
* }
|
|
6205
|
+
* },
|
|
6206
|
+
* ],
|
|
6207
|
+
* ```
|
|
6208
|
+
*
|
|
6209
|
+
* Step 3: update `<img>` tags in templates to use `rawSrc` instead of `src`.
|
|
6210
|
+
*
|
|
6211
|
+
* ```
|
|
6212
|
+
* <img rawSrc="logo.png" width="200" height="100">
|
|
6213
|
+
* ```
|
|
6214
|
+
*
|
|
6215
|
+
* @publicApi
|
|
6216
|
+
* @developerPreview
|
|
6217
|
+
*/
|
|
6218
|
+
class NgOptimizedImage {
|
|
6219
|
+
constructor() {
|
|
6220
|
+
this.imageLoader = inject(IMAGE_LOADER);
|
|
6221
|
+
this.renderer = inject(Renderer2);
|
|
6222
|
+
this.imgElement = inject(ElementRef).nativeElement;
|
|
6223
|
+
this.injector = inject(Injector);
|
|
6224
|
+
// a LCP image observer - should be injected only in the dev mode
|
|
6225
|
+
this.lcpObserver = ngDevMode ? this.injector.get(LCPImageObserver) : null;
|
|
6226
|
+
/**
|
|
6227
|
+
* Calculate the rewritten `src` once and store it.
|
|
6228
|
+
* This is needed to avoid repetitive calculations and make sure the directive cleanup in the
|
|
6229
|
+
* `ngOnDestroy` does not rely on the `IMAGE_LOADER` logic (which in turn can rely on some other
|
|
6230
|
+
* instance that might be already destroyed).
|
|
6231
|
+
*/
|
|
6232
|
+
this._renderedSrc = null;
|
|
6233
|
+
this._priority = false;
|
|
6234
|
+
}
|
|
6235
|
+
/**
|
|
6236
|
+
* The intrinsic width of the image in pixels.
|
|
6237
|
+
*/
|
|
6238
|
+
set width(value) {
|
|
6239
|
+
ngDevMode && assertGreaterThanZero(this, value, 'width');
|
|
6240
|
+
this._width = inputToInteger(value);
|
|
6241
|
+
}
|
|
6242
|
+
get width() {
|
|
6243
|
+
return this._width;
|
|
6244
|
+
}
|
|
6245
|
+
/**
|
|
6246
|
+
* The intrinsic height of the image in pixels.
|
|
6247
|
+
*/
|
|
6248
|
+
set height(value) {
|
|
6249
|
+
ngDevMode && assertGreaterThanZero(this, value, 'height');
|
|
6250
|
+
this._height = inputToInteger(value);
|
|
6251
|
+
}
|
|
6252
|
+
get height() {
|
|
6253
|
+
return this._height;
|
|
6254
|
+
}
|
|
6255
|
+
/**
|
|
6256
|
+
* Indicates whether this image should have a high priority.
|
|
6257
|
+
*/
|
|
6258
|
+
set priority(value) {
|
|
6259
|
+
this._priority = inputToBoolean(value);
|
|
6260
|
+
}
|
|
6261
|
+
get priority() {
|
|
6262
|
+
return this._priority;
|
|
6263
|
+
}
|
|
6264
|
+
ngOnInit() {
|
|
6265
|
+
if (ngDevMode) {
|
|
6266
|
+
assertNonEmptyInput(this, 'rawSrc', this.rawSrc);
|
|
6267
|
+
assertValidRawSrcset(this, this.rawSrcset);
|
|
6268
|
+
assertNoConflictingSrc(this);
|
|
6269
|
+
assertNoConflictingSrcset(this);
|
|
6270
|
+
assertNotBase64Image(this);
|
|
6271
|
+
assertNotBlobUrl(this);
|
|
6272
|
+
assertNonEmptyWidthAndHeight(this);
|
|
6273
|
+
assertValidLoadingInput(this);
|
|
6274
|
+
assertNoImageDistortion(this, this.imgElement, this.renderer);
|
|
6275
|
+
if (this.priority) {
|
|
6276
|
+
const checker = this.injector.get(PreconnectLinkChecker);
|
|
6277
|
+
checker.assertPreconnect(this.getRewrittenSrc(), this.rawSrc);
|
|
6278
|
+
}
|
|
6279
|
+
else {
|
|
6280
|
+
// Monitor whether an image is an LCP element only in case
|
|
6281
|
+
// the `priority` attribute is missing. Otherwise, an image
|
|
6282
|
+
// has the necessary settings and no extra checks are required.
|
|
6283
|
+
if (this.lcpObserver !== null) {
|
|
6284
|
+
const ngZone = this.injector.get(NgZone);
|
|
6285
|
+
ngZone.runOutsideAngular(() => {
|
|
6286
|
+
this.lcpObserver.registerImage(this.getRewrittenSrc(), this.rawSrc);
|
|
6287
|
+
});
|
|
6288
|
+
}
|
|
6289
|
+
}
|
|
6290
|
+
}
|
|
6291
|
+
this.setHostAttributes();
|
|
6292
|
+
}
|
|
6293
|
+
setHostAttributes() {
|
|
6294
|
+
// Must set width/height explicitly in case they are bound (in which case they will
|
|
6295
|
+
// only be reflected and not found by the browser)
|
|
6296
|
+
this.setHostAttribute('width', this.width.toString());
|
|
6297
|
+
this.setHostAttribute('height', this.height.toString());
|
|
6298
|
+
this.setHostAttribute('loading', this.getLoadingBehavior());
|
|
6299
|
+
this.setHostAttribute('fetchpriority', this.getFetchPriority());
|
|
6300
|
+
// The `src` and `srcset` attributes should be set last since other attributes
|
|
6301
|
+
// could affect the image's loading behavior.
|
|
6302
|
+
this.setHostAttribute('src', this.getRewrittenSrc());
|
|
6303
|
+
if (this.rawSrcset) {
|
|
6304
|
+
this.setHostAttribute('srcset', this.getRewrittenSrcset());
|
|
6305
|
+
}
|
|
6306
|
+
}
|
|
6307
|
+
ngOnChanges(changes) {
|
|
6308
|
+
if (ngDevMode) {
|
|
6309
|
+
assertNoPostInitInputChange(this, changes, ['rawSrc', 'rawSrcset', 'width', 'height', 'priority']);
|
|
6310
|
+
}
|
|
6311
|
+
}
|
|
6312
|
+
getLoadingBehavior() {
|
|
6313
|
+
if (!this.priority && this.loading !== undefined) {
|
|
6314
|
+
return this.loading;
|
|
6315
|
+
}
|
|
6316
|
+
return this.priority ? 'eager' : 'lazy';
|
|
6317
|
+
}
|
|
6318
|
+
getFetchPriority() {
|
|
6319
|
+
return this.priority ? 'high' : 'auto';
|
|
6320
|
+
}
|
|
6321
|
+
getRewrittenSrc() {
|
|
6322
|
+
// ImageLoaderConfig supports setting a width property. However, we're not setting width here
|
|
6323
|
+
// because if the developer uses rendered width instead of intrinsic width in the HTML width
|
|
6324
|
+
// attribute, the image requested may be too small for 2x+ screens.
|
|
6325
|
+
if (!this._renderedSrc) {
|
|
6326
|
+
const imgConfig = { src: this.rawSrc };
|
|
6327
|
+
// Cache calculated image src to reuse it later in the code.
|
|
6328
|
+
this._renderedSrc = this.imageLoader(imgConfig);
|
|
6329
|
+
}
|
|
6330
|
+
return this._renderedSrc;
|
|
6331
|
+
}
|
|
6332
|
+
getRewrittenSrcset() {
|
|
6333
|
+
const widthSrcSet = VALID_WIDTH_DESCRIPTOR_SRCSET.test(this.rawSrcset);
|
|
6334
|
+
const finalSrcs = this.rawSrcset.split(',').filter(src => src !== '').map(srcStr => {
|
|
6335
|
+
srcStr = srcStr.trim();
|
|
6336
|
+
const width = widthSrcSet ? parseFloat(srcStr) : parseFloat(srcStr) * this.width;
|
|
6337
|
+
return `${this.imageLoader({ src: this.rawSrc, width })} ${srcStr}`;
|
|
6338
|
+
});
|
|
6339
|
+
return finalSrcs.join(', ');
|
|
6340
|
+
}
|
|
6341
|
+
ngOnDestroy() {
|
|
6342
|
+
if (ngDevMode) {
|
|
6343
|
+
if (!this.priority && this._renderedSrc !== null && this.lcpObserver !== null) {
|
|
6344
|
+
this.lcpObserver.unregisterImage(this._renderedSrc);
|
|
6345
|
+
}
|
|
6346
|
+
}
|
|
6347
|
+
}
|
|
6348
|
+
setHostAttribute(name, value) {
|
|
6349
|
+
this.renderer.setAttribute(this.imgElement, name, value);
|
|
6350
|
+
}
|
|
6351
|
+
}
|
|
6352
|
+
NgOptimizedImage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgOptimizedImage, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
6353
|
+
NgOptimizedImage.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0-next.0", type: NgOptimizedImage, isStandalone: true, selector: "img[rawSrc]", inputs: { rawSrc: "rawSrc", rawSrcset: "rawSrcset", width: "width", height: "height", loading: "loading", priority: "priority", src: "src", srcset: "srcset" }, usesOnChanges: true, ngImport: i0 });
|
|
6354
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgOptimizedImage, decorators: [{
|
|
6355
|
+
type: Directive,
|
|
6356
|
+
args: [{
|
|
6357
|
+
standalone: true,
|
|
6358
|
+
selector: 'img[rawSrc]',
|
|
6359
|
+
}]
|
|
6360
|
+
}], propDecorators: { rawSrc: [{
|
|
6361
|
+
type: Input
|
|
6362
|
+
}], rawSrcset: [{
|
|
6363
|
+
type: Input
|
|
6364
|
+
}], width: [{
|
|
6365
|
+
type: Input
|
|
6366
|
+
}], height: [{
|
|
6367
|
+
type: Input
|
|
6368
|
+
}], loading: [{
|
|
6369
|
+
type: Input
|
|
6370
|
+
}], priority: [{
|
|
6371
|
+
type: Input
|
|
6372
|
+
}], src: [{
|
|
6373
|
+
type: Input
|
|
6374
|
+
}], srcset: [{
|
|
6375
|
+
type: Input
|
|
6376
|
+
}] } });
|
|
6377
|
+
/***** Helpers *****/
|
|
6378
|
+
/**
|
|
6379
|
+
* Convert input value to integer.
|
|
6380
|
+
*/
|
|
6381
|
+
function inputToInteger(value) {
|
|
6382
|
+
return typeof value === 'string' ? parseInt(value, 10) : value;
|
|
6383
|
+
}
|
|
6384
|
+
/**
|
|
6385
|
+
* Convert input value to boolean.
|
|
6386
|
+
*/
|
|
6387
|
+
function inputToBoolean(value) {
|
|
6388
|
+
return value != null && `${value}` !== 'false';
|
|
6389
|
+
}
|
|
6390
|
+
/***** Assert functions *****/
|
|
6391
|
+
/**
|
|
6392
|
+
* Verifies that there is no `src` set on a host element.
|
|
6393
|
+
*/
|
|
6394
|
+
function assertNoConflictingSrc(dir) {
|
|
6395
|
+
if (dir.src) {
|
|
6396
|
+
throw new ɵRuntimeError(2950 /* RuntimeErrorCode.UNEXPECTED_SRC_ATTR */, `${imgDirectiveDetails(dir.rawSrc)} both \`src\` and \`rawSrc\` have been set. ` +
|
|
6397
|
+
`Supplying both of these attributes breaks lazy loading. ` +
|
|
6398
|
+
`The NgOptimizedImage directive sets \`src\` itself based on the value of \`rawSrc\`. ` +
|
|
6399
|
+
`To fix this, please remove the \`src\` attribute.`);
|
|
6400
|
+
}
|
|
6401
|
+
}
|
|
6402
|
+
/**
|
|
6403
|
+
* Verifies that there is no `srcset` set on a host element.
|
|
6404
|
+
*/
|
|
6405
|
+
function assertNoConflictingSrcset(dir) {
|
|
6406
|
+
if (dir.srcset) {
|
|
6407
|
+
throw new ɵRuntimeError(2951 /* RuntimeErrorCode.UNEXPECTED_SRCSET_ATTR */, `${imgDirectiveDetails(dir.rawSrc)} both \`srcset\` and \`rawSrcset\` have been set. ` +
|
|
6408
|
+
`Supplying both of these attributes breaks lazy loading. ` +
|
|
6409
|
+
`The NgOptimizedImage directive sets \`srcset\` itself based on the value of ` +
|
|
6410
|
+
`\`rawSrcset\`. To fix this, please remove the \`srcset\` attribute.`);
|
|
6411
|
+
}
|
|
6412
|
+
}
|
|
6413
|
+
/**
|
|
6414
|
+
* Verifies that the `rawSrc` is not a Base64-encoded image.
|
|
6415
|
+
*/
|
|
6416
|
+
function assertNotBase64Image(dir) {
|
|
6417
|
+
let rawSrc = dir.rawSrc.trim();
|
|
6418
|
+
if (rawSrc.startsWith('data:')) {
|
|
6419
|
+
if (rawSrc.length > BASE64_IMG_MAX_LENGTH_IN_ERROR) {
|
|
6420
|
+
rawSrc = rawSrc.substring(0, BASE64_IMG_MAX_LENGTH_IN_ERROR) + '...';
|
|
6421
|
+
}
|
|
6422
|
+
throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.rawSrc, false)} \`rawSrc\` is a Base64-encoded string ` +
|
|
6423
|
+
`(${rawSrc}). NgOptimizedImage does not support Base64-encoded strings. ` +
|
|
6424
|
+
`To fix this, disable the NgOptimizedImage directive for this element ` +
|
|
6425
|
+
`by removing \`rawSrc\` and using a standard \`src\` attribute instead.`);
|
|
6426
|
+
}
|
|
6427
|
+
}
|
|
6428
|
+
/**
|
|
6429
|
+
* Verifies that the `rawSrc` is not a Blob URL.
|
|
6430
|
+
*/
|
|
6431
|
+
function assertNotBlobUrl(dir) {
|
|
6432
|
+
const rawSrc = dir.rawSrc.trim();
|
|
6433
|
+
if (rawSrc.startsWith('blob:')) {
|
|
6434
|
+
throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.rawSrc)} \`rawSrc\` was set to a blob URL (${rawSrc}). ` +
|
|
6435
|
+
`Blob URLs are not supported by the NgOptimizedImage directive. ` +
|
|
6436
|
+
`To fix this, disable the NgOptimizedImage directive for this element ` +
|
|
6437
|
+
`by removing \`rawSrc\` and using a regular \`src\` attribute instead.`);
|
|
6438
|
+
}
|
|
6439
|
+
}
|
|
6440
|
+
/**
|
|
6441
|
+
* Verifies that the input is set to a non-empty string.
|
|
6442
|
+
*/
|
|
6443
|
+
function assertNonEmptyInput(dir, name, value) {
|
|
6444
|
+
const isString = typeof value === 'string';
|
|
6445
|
+
const isEmptyString = isString && value.trim() === '';
|
|
6446
|
+
if (!isString || isEmptyString) {
|
|
6447
|
+
throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.rawSrc)} \`${name}\` has an invalid value ` +
|
|
6448
|
+
`(\`${value}\`). To fix this, change the value to a non-empty string.`);
|
|
6449
|
+
}
|
|
6450
|
+
}
|
|
6451
|
+
/**
|
|
6452
|
+
* Verifies that the `rawSrcset` is in a valid format, e.g. "100w, 200w" or "1x, 2x".
|
|
6453
|
+
*/
|
|
6454
|
+
function assertValidRawSrcset(dir, value) {
|
|
6455
|
+
if (value == null)
|
|
6456
|
+
return;
|
|
6457
|
+
assertNonEmptyInput(dir, 'rawSrcset', value);
|
|
6458
|
+
const stringVal = value;
|
|
6459
|
+
const isValidWidthDescriptor = VALID_WIDTH_DESCRIPTOR_SRCSET.test(stringVal);
|
|
6460
|
+
const isValidDensityDescriptor = VALID_DENSITY_DESCRIPTOR_SRCSET.test(stringVal);
|
|
6461
|
+
if (isValidDensityDescriptor) {
|
|
6462
|
+
assertUnderDensityCap(dir, stringVal);
|
|
6463
|
+
}
|
|
6464
|
+
const isValidSrcset = isValidWidthDescriptor || isValidDensityDescriptor;
|
|
6465
|
+
if (!isValidSrcset) {
|
|
6466
|
+
throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.rawSrc)} \`rawSrcset\` has an invalid value (\`${value}\`). ` +
|
|
6467
|
+
`To fix this, supply \`rawSrcset\` using a comma-separated list of one or more width ` +
|
|
6468
|
+
`descriptors (e.g. "100w, 200w") or density descriptors (e.g. "1x, 2x").`);
|
|
6469
|
+
}
|
|
6470
|
+
}
|
|
6471
|
+
function assertUnderDensityCap(dir, value) {
|
|
6472
|
+
const underDensityCap = value.split(',').every(num => num === '' || parseFloat(num) <= ABSOLUTE_SRCSET_DENSITY_CAP);
|
|
6473
|
+
if (!underDensityCap) {
|
|
6474
|
+
throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.rawSrc)} the \`rawSrcset\` contains an unsupported image density:` +
|
|
6475
|
+
`\`${value}\`. NgOptimizedImage generally recommends a max image density of ` +
|
|
6476
|
+
`${RECOMMENDED_SRCSET_DENSITY_CAP}x but supports image densities up to ` +
|
|
6477
|
+
`${ABSOLUTE_SRCSET_DENSITY_CAP}x. The human eye cannot distinguish between image densities ` +
|
|
6478
|
+
`greater than ${RECOMMENDED_SRCSET_DENSITY_CAP}x - which makes them unnecessary for ` +
|
|
6479
|
+
`most use cases. Images that will be pinch-zoomed are typically the primary use case for ` +
|
|
6480
|
+
`${ABSOLUTE_SRCSET_DENSITY_CAP}x images. Please remove the high density descriptor and try again.`);
|
|
6481
|
+
}
|
|
6482
|
+
}
|
|
6483
|
+
/**
|
|
6484
|
+
* Creates a `RuntimeError` instance to represent a situation when an input is set after
|
|
6485
|
+
* the directive has initialized.
|
|
6486
|
+
*/
|
|
6487
|
+
function postInitInputChangeError(dir, inputName) {
|
|
6488
|
+
return new ɵRuntimeError(2953 /* RuntimeErrorCode.UNEXPECTED_INPUT_CHANGE */, `${imgDirectiveDetails(dir.rawSrc)} \`${inputName}\` was updated after initialization. ` +
|
|
6489
|
+
`The NgOptimizedImage directive will not react to this input change. ` +
|
|
6490
|
+
`To fix this, switch \`${inputName}\` a static value or wrap the image element ` +
|
|
6491
|
+
`in an *ngIf that is gated on the necessary value.`);
|
|
6492
|
+
}
|
|
6493
|
+
/**
|
|
6494
|
+
* Verify that none of the listed inputs has changed.
|
|
6495
|
+
*/
|
|
6496
|
+
function assertNoPostInitInputChange(dir, changes, inputs) {
|
|
6497
|
+
inputs.forEach(input => {
|
|
6498
|
+
const isUpdated = changes.hasOwnProperty(input);
|
|
6499
|
+
if (isUpdated && !changes[input].isFirstChange()) {
|
|
6500
|
+
if (input === 'rawSrc') {
|
|
6501
|
+
// When the `rawSrc` input changes, we detect that only in the
|
|
6502
|
+
// `ngOnChanges` hook, thus the `rawSrc` is already set. We use
|
|
6503
|
+
// `rawSrc` in the error message, so we use a previous value, but
|
|
6504
|
+
// not the updated one in it.
|
|
6505
|
+
dir = { rawSrc: changes[input].previousValue };
|
|
6506
|
+
}
|
|
6507
|
+
throw postInitInputChangeError(dir, input);
|
|
6508
|
+
}
|
|
6509
|
+
});
|
|
6510
|
+
}
|
|
6511
|
+
/**
|
|
6512
|
+
* Verifies that a specified input is a number greater than 0.
|
|
6513
|
+
*/
|
|
6514
|
+
function assertGreaterThanZero(dir, inputValue, inputName) {
|
|
6515
|
+
const validNumber = typeof inputValue === 'number' && inputValue > 0;
|
|
6516
|
+
const validString = typeof inputValue === 'string' && /^\d+$/.test(inputValue.trim()) && parseInt(inputValue) > 0;
|
|
6517
|
+
if (!validNumber && !validString) {
|
|
6518
|
+
throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.rawSrc)} \`${inputName}\` has an invalid value ` +
|
|
6519
|
+
`(\`${inputValue}\`). To fix this, provide \`${inputName}\` ` +
|
|
6520
|
+
`as a number greater than 0.`);
|
|
6521
|
+
}
|
|
6522
|
+
}
|
|
6523
|
+
/**
|
|
6524
|
+
* Verifies that the rendered image is not visually distorted. Effectively this is checking:
|
|
6525
|
+
* - Whether the "width" and "height" attributes reflect the actual dimensions of the image.
|
|
6526
|
+
* - Whether image styling is "correct" (see below for a longer explanation).
|
|
6527
|
+
*/
|
|
6528
|
+
function assertNoImageDistortion(dir, img, renderer) {
|
|
6529
|
+
const removeListenerFn = renderer.listen(img, 'load', () => {
|
|
6530
|
+
removeListenerFn();
|
|
6531
|
+
// TODO: `clientWidth`, `clientHeight`, `naturalWidth` and `naturalHeight`
|
|
6532
|
+
// are typed as number, but we run `parseFloat` (which accepts strings only).
|
|
6533
|
+
// Verify whether `parseFloat` is needed in the cases below.
|
|
6534
|
+
const renderedWidth = parseFloat(img.clientWidth);
|
|
6535
|
+
const renderedHeight = parseFloat(img.clientHeight);
|
|
6536
|
+
const renderedAspectRatio = renderedWidth / renderedHeight;
|
|
6537
|
+
const nonZeroRenderedDimensions = renderedWidth !== 0 && renderedHeight !== 0;
|
|
6538
|
+
const intrinsicWidth = parseFloat(img.naturalWidth);
|
|
6539
|
+
const intrinsicHeight = parseFloat(img.naturalHeight);
|
|
6540
|
+
const intrinsicAspectRatio = intrinsicWidth / intrinsicHeight;
|
|
6541
|
+
const suppliedWidth = dir.width;
|
|
6542
|
+
const suppliedHeight = dir.height;
|
|
6543
|
+
const suppliedAspectRatio = suppliedWidth / suppliedHeight;
|
|
6544
|
+
// Tolerance is used to account for the impact of subpixel rendering.
|
|
6545
|
+
// Due to subpixel rendering, the rendered, intrinsic, and supplied
|
|
6546
|
+
// aspect ratios of a correctly configured image may not exactly match.
|
|
6547
|
+
// For example, a `width=4030 height=3020` image might have a rendered
|
|
6548
|
+
// size of "1062w, 796.48h". (An aspect ratio of 1.334... vs. 1.333...)
|
|
6549
|
+
const inaccurateDimensions = Math.abs(suppliedAspectRatio - intrinsicAspectRatio) > ASPECT_RATIO_TOLERANCE;
|
|
6550
|
+
const stylingDistortion = nonZeroRenderedDimensions &&
|
|
6551
|
+
Math.abs(intrinsicAspectRatio - renderedAspectRatio) > ASPECT_RATIO_TOLERANCE;
|
|
6552
|
+
if (inaccurateDimensions) {
|
|
6553
|
+
console.warn(ɵformatRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.rawSrc)} the aspect ratio of the image does not match ` +
|
|
6554
|
+
`the aspect ratio indicated by the width and height attributes. ` +
|
|
6555
|
+
`Intrinsic image size: ${intrinsicWidth}w x ${intrinsicHeight}h ` +
|
|
6556
|
+
`(aspect-ratio: ${intrinsicAspectRatio}). Supplied width and height attributes: ` +
|
|
6557
|
+
`${suppliedWidth}w x ${suppliedHeight}h (aspect-ratio: ${suppliedAspectRatio}). ` +
|
|
6558
|
+
`To fix this, update the width and height attributes.`));
|
|
6559
|
+
}
|
|
6560
|
+
else if (stylingDistortion) {
|
|
6561
|
+
console.warn(ɵformatRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.rawSrc)} the aspect ratio of the rendered image ` +
|
|
6562
|
+
`does not match the image's intrinsic aspect ratio. ` +
|
|
6563
|
+
`Intrinsic image size: ${intrinsicWidth}w x ${intrinsicHeight}h ` +
|
|
6564
|
+
`(aspect-ratio: ${intrinsicAspectRatio}). Rendered image size: ` +
|
|
6565
|
+
`${renderedWidth}w x ${renderedHeight}h (aspect-ratio: ` +
|
|
6566
|
+
`${renderedAspectRatio}). This issue can occur if "width" and "height" ` +
|
|
6567
|
+
`attributes are added to an image without updating the corresponding ` +
|
|
6568
|
+
`image styling. To fix this, adjust image styling. In most cases, ` +
|
|
6569
|
+
`adding "height: auto" or "width: auto" to the image styling will fix ` +
|
|
6570
|
+
`this issue.`));
|
|
6571
|
+
}
|
|
6572
|
+
else if (!dir.rawSrcset && nonZeroRenderedDimensions) {
|
|
6573
|
+
// If `rawSrcset` hasn't been set, sanity check the intrinsic size.
|
|
6574
|
+
const recommendedWidth = RECOMMENDED_SRCSET_DENSITY_CAP * renderedWidth;
|
|
6575
|
+
const recommendedHeight = RECOMMENDED_SRCSET_DENSITY_CAP * renderedHeight;
|
|
6576
|
+
const oversizedWidth = (intrinsicWidth - recommendedWidth) >= OVERSIZED_IMAGE_TOLERANCE;
|
|
6577
|
+
const oversizedHeight = (intrinsicHeight - recommendedHeight) >= OVERSIZED_IMAGE_TOLERANCE;
|
|
6578
|
+
if (oversizedWidth || oversizedHeight) {
|
|
6579
|
+
console.warn(ɵformatRuntimeError(2960 /* RuntimeErrorCode.OVERSIZED_IMAGE */, `${imgDirectiveDetails(dir.rawSrc)} the intrinsic image is significantly ` +
|
|
6580
|
+
`larger than necessary. ` +
|
|
6581
|
+
`\nRendered image size: ${renderedWidth}w x ${renderedHeight}h. ` +
|
|
6582
|
+
`\nIntrinsic image size: ${intrinsicWidth}w x ${intrinsicHeight}h. ` +
|
|
6583
|
+
`\nRecommended intrinsic image size: ${recommendedWidth}w x ${recommendedHeight}h. ` +
|
|
6584
|
+
`\nNote: Recommended intrinsic image size is calculated assuming a maximum DPR of ` +
|
|
6585
|
+
`${RECOMMENDED_SRCSET_DENSITY_CAP}. To improve loading time, resize the image ` +
|
|
6586
|
+
`or consider using the "rawSrcset" and "sizes" attributes.`));
|
|
6587
|
+
}
|
|
6588
|
+
}
|
|
6589
|
+
});
|
|
6590
|
+
}
|
|
6591
|
+
/**
|
|
6592
|
+
* Verifies that a specified input is set.
|
|
6593
|
+
*/
|
|
6594
|
+
function assertNonEmptyWidthAndHeight(dir) {
|
|
6595
|
+
let missingAttributes = [];
|
|
6596
|
+
if (dir.width === undefined)
|
|
6597
|
+
missingAttributes.push('width');
|
|
6598
|
+
if (dir.height === undefined)
|
|
6599
|
+
missingAttributes.push('height');
|
|
6600
|
+
if (missingAttributes.length > 0) {
|
|
6601
|
+
throw new ɵRuntimeError(2954 /* RuntimeErrorCode.REQUIRED_INPUT_MISSING */, `${imgDirectiveDetails(dir.rawSrc)} these required attributes ` +
|
|
6602
|
+
`are missing: ${missingAttributes.map(attr => `"${attr}"`).join(', ')}. ` +
|
|
6603
|
+
`Including "width" and "height" attributes will prevent image-related layout shifts. ` +
|
|
6604
|
+
`To fix this, include "width" and "height" attributes on the image tag.`);
|
|
6605
|
+
}
|
|
6606
|
+
}
|
|
6607
|
+
/**
|
|
6608
|
+
* Verifies that the `loading` attribute is set to a valid input &
|
|
6609
|
+
* is not used on priority images.
|
|
6610
|
+
*/
|
|
6611
|
+
function assertValidLoadingInput(dir) {
|
|
6612
|
+
if (dir.loading && dir.priority) {
|
|
6613
|
+
throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.rawSrc)} the \`loading\` attribute ` +
|
|
6614
|
+
`was used on an image that was marked "priority". ` +
|
|
6615
|
+
`Setting \`loading\` on priority images is not allowed ` +
|
|
6616
|
+
`because these images will always be eagerly loaded. ` +
|
|
6617
|
+
`To fix this, remove the “loading” attribute from the priority image.`);
|
|
6618
|
+
}
|
|
6619
|
+
const validInputs = ['auto', 'eager', 'lazy'];
|
|
6620
|
+
if (typeof dir.loading === 'string' && !validInputs.includes(dir.loading)) {
|
|
6621
|
+
throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.rawSrc)} the \`loading\` attribute ` +
|
|
6622
|
+
`has an invalid value (\`${dir.loading}\`). ` +
|
|
6623
|
+
`To fix this, provide a valid value ("lazy", "eager", or "auto").`);
|
|
6624
|
+
}
|
|
6625
|
+
}
|
|
6626
|
+
|
|
6627
|
+
/**
|
|
6628
|
+
* @license
|
|
6629
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6630
|
+
*
|
|
6631
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6632
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6633
|
+
*/
|
|
6634
|
+
|
|
5556
6635
|
/**
|
|
5557
6636
|
* @license
|
|
5558
6637
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -5582,5 +6661,5 @@ class XhrFactory {
|
|
|
5582
6661
|
* Generated bundle index. Do not edit.
|
|
5583
6662
|
*/
|
|
5584
6663
|
|
|
5585
|
-
export { APP_BASE_HREF, AsyncPipe, CommonModule, CurrencyPipe, DATE_PIPE_DEFAULT_TIMEZONE, DOCUMENT, DatePipe, DecimalPipe, FormStyle, FormatWidth, HashLocationStrategy, I18nPluralPipe, I18nSelectPipe, JsonPipe, KeyValuePipe, LOCATION_INITIALIZED, Location, LocationStrategy, LowerCasePipe, NgClass, NgComponentOutlet, NgForOf, NgForOfContext, NgIf, NgIfContext, NgLocaleLocalization, NgLocalization, NgPlural, NgPluralCase, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgTemplateOutlet, NumberFormatStyle, NumberSymbol, PathLocationStrategy, PercentPipe, PlatformLocation, Plural, SlicePipe, TitleCasePipe, TranslationWidth, UpperCasePipe, VERSION, ViewportScroller, WeekDay, XhrFactory, formatCurrency, formatDate, formatNumber, formatPercent, getCurrencySymbol, getLocaleCurrencyCode, getLocaleCurrencyName, getLocaleCurrencySymbol, getLocaleDateFormat, getLocaleDateTimeFormat, getLocaleDayNames, getLocaleDayPeriods, getLocaleDirection, getLocaleEraNames, getLocaleExtraDayPeriodRules, getLocaleExtraDayPeriods, getLocaleFirstDayOfWeek, getLocaleId, getLocaleMonthNames, getLocaleNumberFormat, getLocaleNumberSymbol, getLocalePluralCase, getLocaleTimeFormat, getLocaleWeekEndRange, getNumberOfCurrencyDigits, isPlatformBrowser, isPlatformServer, isPlatformWorkerApp, isPlatformWorkerUi, registerLocaleData, BrowserPlatformLocation as ɵBrowserPlatformLocation, DomAdapter as ɵDomAdapter, NullViewportScroller as ɵNullViewportScroller, PLATFORM_BROWSER_ID as ɵPLATFORM_BROWSER_ID, PLATFORM_SERVER_ID as ɵPLATFORM_SERVER_ID, PLATFORM_WORKER_APP_ID as ɵPLATFORM_WORKER_APP_ID, PLATFORM_WORKER_UI_ID as ɵPLATFORM_WORKER_UI_ID, getDOM as ɵgetDOM, parseCookieValue as ɵparseCookieValue, setRootDomAdapter as ɵsetRootDomAdapter };
|
|
6664
|
+
export { APP_BASE_HREF, AsyncPipe, CommonModule, CurrencyPipe, DATE_PIPE_DEFAULT_TIMEZONE, DOCUMENT, DatePipe, DecimalPipe, FormStyle, FormatWidth, HashLocationStrategy, I18nPluralPipe, I18nSelectPipe, IMAGE_LOADER, JsonPipe, KeyValuePipe, LOCATION_INITIALIZED, Location, LocationStrategy, LowerCasePipe, NgClass, NgComponentOutlet, NgForOf, NgForOfContext, NgIf, NgIfContext, NgLocaleLocalization, NgLocalization, NgOptimizedImage, NgPlural, NgPluralCase, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgTemplateOutlet, NumberFormatStyle, NumberSymbol, PRECONNECT_CHECK_BLOCKLIST, PathLocationStrategy, PercentPipe, PlatformLocation, Plural, SlicePipe, TitleCasePipe, TranslationWidth, UpperCasePipe, VERSION, ViewportScroller, WeekDay, XhrFactory, formatCurrency, formatDate, formatNumber, formatPercent, getCurrencySymbol, getLocaleCurrencyCode, getLocaleCurrencyName, getLocaleCurrencySymbol, getLocaleDateFormat, getLocaleDateTimeFormat, getLocaleDayNames, getLocaleDayPeriods, getLocaleDirection, getLocaleEraNames, getLocaleExtraDayPeriodRules, getLocaleExtraDayPeriods, getLocaleFirstDayOfWeek, getLocaleId, getLocaleMonthNames, getLocaleNumberFormat, getLocaleNumberSymbol, getLocalePluralCase, getLocaleTimeFormat, getLocaleWeekEndRange, getNumberOfCurrencyDigits, isPlatformBrowser, isPlatformServer, isPlatformWorkerApp, isPlatformWorkerUi, provideCloudflareLoader, provideCloudinaryLoader, provideImageKitLoader, provideImgixLoader, registerLocaleData, BrowserPlatformLocation as ɵBrowserPlatformLocation, DomAdapter as ɵDomAdapter, NullViewportScroller as ɵNullViewportScroller, PLATFORM_BROWSER_ID as ɵPLATFORM_BROWSER_ID, PLATFORM_SERVER_ID as ɵPLATFORM_SERVER_ID, PLATFORM_WORKER_APP_ID as ɵPLATFORM_WORKER_APP_ID, PLATFORM_WORKER_UI_ID as ɵPLATFORM_WORKER_UI_ID, getDOM as ɵgetDOM, parseCookieValue as ɵparseCookieValue, setRootDomAdapter as ɵsetRootDomAdapter };
|
|
5586
6665
|
//# sourceMappingURL=common.mjs.map
|