@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/fesm2020/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',
|
|
@@ -311,9 +311,9 @@ class LocationStrategy {
|
|
|
311
311
|
throw new Error('Not implemented');
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
|
-
LocationStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
315
|
-
LocationStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
316
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
314
|
+
LocationStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: LocationStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
315
|
+
LocationStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: LocationStrategy, providedIn: 'root', useFactory: () => inject(PathLocationStrategy) });
|
|
316
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: LocationStrategy, decorators: [{
|
|
317
317
|
type: Injectable,
|
|
318
318
|
args: [{ providedIn: 'root', useFactory: () => inject(PathLocationStrategy) }]
|
|
319
319
|
}] });
|
|
@@ -421,9 +421,9 @@ class PathLocationStrategy extends LocationStrategy {
|
|
|
421
421
|
this._platformLocation.historyGo?.(relativePosition);
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
|
-
PathLocationStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
425
|
-
PathLocationStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
426
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
424
|
+
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 });
|
|
425
|
+
PathLocationStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: PathLocationStrategy, providedIn: 'root' });
|
|
426
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: PathLocationStrategy, decorators: [{
|
|
427
427
|
type: Injectable,
|
|
428
428
|
args: [{ providedIn: 'root' }]
|
|
429
429
|
}], ctorParameters: function () { return [{ type: PlatformLocation }, { type: undefined, decorators: [{
|
|
@@ -519,9 +519,9 @@ class HashLocationStrategy extends LocationStrategy {
|
|
|
519
519
|
this._platformLocation.historyGo?.(relativePosition);
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
|
-
HashLocationStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
523
|
-
HashLocationStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
524
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
522
|
+
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 });
|
|
523
|
+
HashLocationStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: HashLocationStrategy });
|
|
524
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: HashLocationStrategy, decorators: [{
|
|
525
525
|
type: Injectable
|
|
526
526
|
}], ctorParameters: function () { return [{ type: PlatformLocation }, { type: undefined, decorators: [{
|
|
527
527
|
type: Optional
|
|
@@ -772,9 +772,9 @@ Location.joinWithSlash = joinWithSlash;
|
|
|
772
772
|
* @returns The URL string, modified if needed.
|
|
773
773
|
*/
|
|
774
774
|
Location.stripTrailingSlash = stripTrailingSlash;
|
|
775
|
-
Location.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
776
|
-
Location.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
777
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
775
|
+
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 });
|
|
776
|
+
Location.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: Location, providedIn: 'root', useFactory: createLocation });
|
|
777
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: Location, decorators: [{
|
|
778
778
|
type: Injectable,
|
|
779
779
|
args: [{
|
|
780
780
|
providedIn: 'root',
|
|
@@ -2590,9 +2590,9 @@ function parseIntAutoRadix(text) {
|
|
|
2590
2590
|
*/
|
|
2591
2591
|
class NgLocalization {
|
|
2592
2592
|
}
|
|
2593
|
-
NgLocalization.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2594
|
-
NgLocalization.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
2595
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2593
|
+
NgLocalization.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgLocalization, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2594
|
+
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 }] });
|
|
2595
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgLocalization, decorators: [{
|
|
2596
2596
|
type: Injectable,
|
|
2597
2597
|
args: [{
|
|
2598
2598
|
providedIn: 'root',
|
|
@@ -2647,9 +2647,9 @@ class NgLocaleLocalization extends NgLocalization {
|
|
|
2647
2647
|
}
|
|
2648
2648
|
}
|
|
2649
2649
|
}
|
|
2650
|
-
NgLocaleLocalization.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2651
|
-
NgLocaleLocalization.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
2652
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2650
|
+
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 });
|
|
2651
|
+
NgLocaleLocalization.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgLocaleLocalization });
|
|
2652
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgLocaleLocalization, decorators: [{
|
|
2653
2653
|
type: Injectable
|
|
2654
2654
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
2655
2655
|
type: Inject,
|
|
@@ -2842,9 +2842,9 @@ class NgClass {
|
|
|
2842
2842
|
}
|
|
2843
2843
|
}
|
|
2844
2844
|
}
|
|
2845
|
-
NgClass.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2846
|
-
NgClass.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
2847
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2845
|
+
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 });
|
|
2846
|
+
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 });
|
|
2847
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgClass, decorators: [{
|
|
2848
2848
|
type: Directive,
|
|
2849
2849
|
args: [{
|
|
2850
2850
|
selector: '[ngClass]',
|
|
@@ -2963,9 +2963,9 @@ class NgComponentOutlet {
|
|
|
2963
2963
|
this._moduleRef.destroy();
|
|
2964
2964
|
}
|
|
2965
2965
|
}
|
|
2966
|
-
NgComponentOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2967
|
-
NgComponentOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
2968
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2966
|
+
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 });
|
|
2967
|
+
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 });
|
|
2968
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgComponentOutlet, decorators: [{
|
|
2969
2969
|
type: Directive,
|
|
2970
2970
|
args: [{
|
|
2971
2971
|
selector: '[ngComponentOutlet]',
|
|
@@ -3255,9 +3255,9 @@ class NgForOf {
|
|
|
3255
3255
|
return true;
|
|
3256
3256
|
}
|
|
3257
3257
|
}
|
|
3258
|
-
NgForOf.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3259
|
-
NgForOf.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
3260
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3258
|
+
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 });
|
|
3259
|
+
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 });
|
|
3260
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgForOf, decorators: [{
|
|
3261
3261
|
type: Directive,
|
|
3262
3262
|
args: [{
|
|
3263
3263
|
selector: '[ngFor][ngForOf]',
|
|
@@ -3490,9 +3490,9 @@ class NgIf {
|
|
|
3490
3490
|
return true;
|
|
3491
3491
|
}
|
|
3492
3492
|
}
|
|
3493
|
-
NgIf.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3494
|
-
NgIf.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
3495
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3493
|
+
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 });
|
|
3494
|
+
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 });
|
|
3495
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgIf, decorators: [{
|
|
3496
3496
|
type: Directive,
|
|
3497
3497
|
args: [{
|
|
3498
3498
|
selector: '[ngIf]',
|
|
@@ -3663,9 +3663,9 @@ class NgSwitch {
|
|
|
3663
3663
|
}
|
|
3664
3664
|
}
|
|
3665
3665
|
}
|
|
3666
|
-
NgSwitch.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3667
|
-
NgSwitch.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
3668
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3666
|
+
NgSwitch.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgSwitch, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3667
|
+
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 });
|
|
3668
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgSwitch, decorators: [{
|
|
3669
3669
|
type: Directive,
|
|
3670
3670
|
args: [{
|
|
3671
3671
|
selector: '[ngSwitch]',
|
|
@@ -3724,9 +3724,9 @@ class NgSwitchCase {
|
|
|
3724
3724
|
this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase));
|
|
3725
3725
|
}
|
|
3726
3726
|
}
|
|
3727
|
-
NgSwitchCase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3728
|
-
NgSwitchCase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
3729
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3727
|
+
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 });
|
|
3728
|
+
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 });
|
|
3729
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgSwitchCase, decorators: [{
|
|
3730
3730
|
type: Directive,
|
|
3731
3731
|
args: [{
|
|
3732
3732
|
selector: '[ngSwitchCase]',
|
|
@@ -3761,9 +3761,9 @@ class NgSwitchDefault {
|
|
|
3761
3761
|
ngSwitch._addDefault(new SwitchView(viewContainer, templateRef));
|
|
3762
3762
|
}
|
|
3763
3763
|
}
|
|
3764
|
-
NgSwitchDefault.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3765
|
-
NgSwitchDefault.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
3766
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3764
|
+
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 });
|
|
3765
|
+
NgSwitchDefault.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0-next.0", type: NgSwitchDefault, isStandalone: true, selector: "[ngSwitchDefault]", ngImport: i0 });
|
|
3766
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgSwitchDefault, decorators: [{
|
|
3767
3767
|
type: Directive,
|
|
3768
3768
|
args: [{
|
|
3769
3769
|
selector: '[ngSwitchDefault]',
|
|
@@ -3847,9 +3847,9 @@ class NgPlural {
|
|
|
3847
3847
|
}
|
|
3848
3848
|
}
|
|
3849
3849
|
}
|
|
3850
|
-
NgPlural.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3851
|
-
NgPlural.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
3852
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3850
|
+
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 });
|
|
3851
|
+
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 });
|
|
3852
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgPlural, decorators: [{
|
|
3853
3853
|
type: Directive,
|
|
3854
3854
|
args: [{
|
|
3855
3855
|
selector: '[ngPlural]',
|
|
@@ -3885,9 +3885,9 @@ class NgPluralCase {
|
|
|
3885
3885
|
ngPlural.addCase(isANumber ? `=${value}` : value, new SwitchView(viewContainer, template));
|
|
3886
3886
|
}
|
|
3887
3887
|
}
|
|
3888
|
-
NgPluralCase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3889
|
-
NgPluralCase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
3890
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3888
|
+
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 });
|
|
3889
|
+
NgPluralCase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0-next.0", type: NgPluralCase, isStandalone: true, selector: "[ngPluralCase]", ngImport: i0 });
|
|
3890
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgPluralCase, decorators: [{
|
|
3891
3891
|
type: Directive,
|
|
3892
3892
|
args: [{
|
|
3893
3893
|
selector: '[ngPluralCase]',
|
|
@@ -3981,9 +3981,9 @@ class NgStyle {
|
|
|
3981
3981
|
changes.forEachChangedItem((record) => this._setStyle(record.key, record.currentValue));
|
|
3982
3982
|
}
|
|
3983
3983
|
}
|
|
3984
|
-
NgStyle.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3985
|
-
NgStyle.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
3986
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3984
|
+
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 });
|
|
3985
|
+
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 });
|
|
3986
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgStyle, decorators: [{
|
|
3987
3987
|
type: Directive,
|
|
3988
3988
|
args: [{
|
|
3989
3989
|
selector: '[ngStyle]',
|
|
@@ -4063,9 +4063,9 @@ class NgTemplateOutlet {
|
|
|
4063
4063
|
}
|
|
4064
4064
|
}
|
|
4065
4065
|
}
|
|
4066
|
-
NgTemplateOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4067
|
-
NgTemplateOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
4068
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4066
|
+
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 });
|
|
4067
|
+
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 });
|
|
4068
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgTemplateOutlet, decorators: [{
|
|
4069
4069
|
type: Directive,
|
|
4070
4070
|
args: [{
|
|
4071
4071
|
selector: '[ngTemplateOutlet]',
|
|
@@ -4237,9 +4237,9 @@ class AsyncPipe {
|
|
|
4237
4237
|
}
|
|
4238
4238
|
}
|
|
4239
4239
|
}
|
|
4240
|
-
AsyncPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4241
|
-
AsyncPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
4242
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4240
|
+
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 });
|
|
4241
|
+
AsyncPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: AsyncPipe, isStandalone: true, name: "async", pure: false });
|
|
4242
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: AsyncPipe, decorators: [{
|
|
4243
4243
|
type: Pipe,
|
|
4244
4244
|
args: [{
|
|
4245
4245
|
name: 'async',
|
|
@@ -4280,9 +4280,9 @@ class LowerCasePipe {
|
|
|
4280
4280
|
return value.toLowerCase();
|
|
4281
4281
|
}
|
|
4282
4282
|
}
|
|
4283
|
-
LowerCasePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4284
|
-
LowerCasePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
4285
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4283
|
+
LowerCasePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: LowerCasePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
4284
|
+
LowerCasePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: LowerCasePipe, isStandalone: true, name: "lowercase" });
|
|
4285
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: LowerCasePipe, decorators: [{
|
|
4286
4286
|
type: Pipe,
|
|
4287
4287
|
args: [{
|
|
4288
4288
|
name: 'lowercase',
|
|
@@ -4325,9 +4325,9 @@ class TitleCasePipe {
|
|
|
4325
4325
|
return value.replace(unicodeWordMatch, (txt => txt[0].toUpperCase() + txt.slice(1).toLowerCase()));
|
|
4326
4326
|
}
|
|
4327
4327
|
}
|
|
4328
|
-
TitleCasePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4329
|
-
TitleCasePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
4330
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4328
|
+
TitleCasePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: TitleCasePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
4329
|
+
TitleCasePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: TitleCasePipe, isStandalone: true, name: "titlecase" });
|
|
4330
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: TitleCasePipe, decorators: [{
|
|
4331
4331
|
type: Pipe,
|
|
4332
4332
|
args: [{
|
|
4333
4333
|
name: 'titlecase',
|
|
@@ -4352,9 +4352,9 @@ class UpperCasePipe {
|
|
|
4352
4352
|
return value.toUpperCase();
|
|
4353
4353
|
}
|
|
4354
4354
|
}
|
|
4355
|
-
UpperCasePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4356
|
-
UpperCasePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
4357
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4355
|
+
UpperCasePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: UpperCasePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
4356
|
+
UpperCasePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: UpperCasePipe, isStandalone: true, name: "uppercase" });
|
|
4357
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: UpperCasePipe, decorators: [{
|
|
4358
4358
|
type: Pipe,
|
|
4359
4359
|
args: [{
|
|
4360
4360
|
name: 'uppercase',
|
|
@@ -4549,9 +4549,9 @@ class DatePipe {
|
|
|
4549
4549
|
}
|
|
4550
4550
|
}
|
|
4551
4551
|
}
|
|
4552
|
-
DatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4553
|
-
DatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
4554
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4552
|
+
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 });
|
|
4553
|
+
DatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: DatePipe, isStandalone: true, name: "date" });
|
|
4554
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: DatePipe, decorators: [{
|
|
4555
4555
|
type: Pipe,
|
|
4556
4556
|
args: [{
|
|
4557
4557
|
name: 'date',
|
|
@@ -4611,9 +4611,9 @@ class I18nPluralPipe {
|
|
|
4611
4611
|
return pluralMap[key].replace(_INTERPOLATION_REGEXP, value.toString());
|
|
4612
4612
|
}
|
|
4613
4613
|
}
|
|
4614
|
-
I18nPluralPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4615
|
-
I18nPluralPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
4616
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4614
|
+
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 });
|
|
4615
|
+
I18nPluralPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: I18nPluralPipe, isStandalone: true, name: "i18nPlural" });
|
|
4616
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: I18nPluralPipe, decorators: [{
|
|
4617
4617
|
type: Pipe,
|
|
4618
4618
|
args: [{
|
|
4619
4619
|
name: 'i18nPlural',
|
|
@@ -4667,9 +4667,9 @@ class I18nSelectPipe {
|
|
|
4667
4667
|
return '';
|
|
4668
4668
|
}
|
|
4669
4669
|
}
|
|
4670
|
-
I18nSelectPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4671
|
-
I18nSelectPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
4672
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4670
|
+
I18nSelectPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: I18nSelectPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
4671
|
+
I18nSelectPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: I18nSelectPipe, isStandalone: true, name: "i18nSelect" });
|
|
4672
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: I18nSelectPipe, decorators: [{
|
|
4673
4673
|
type: Pipe,
|
|
4674
4674
|
args: [{
|
|
4675
4675
|
name: 'i18nSelect',
|
|
@@ -4708,9 +4708,9 @@ class JsonPipe {
|
|
|
4708
4708
|
return JSON.stringify(value, null, 2);
|
|
4709
4709
|
}
|
|
4710
4710
|
}
|
|
4711
|
-
JsonPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4712
|
-
JsonPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
4713
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4711
|
+
JsonPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: JsonPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
4712
|
+
JsonPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: JsonPipe, isStandalone: true, name: "json", pure: false });
|
|
4713
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: JsonPipe, decorators: [{
|
|
4714
4714
|
type: Pipe,
|
|
4715
4715
|
args: [{
|
|
4716
4716
|
name: 'json',
|
|
@@ -4778,9 +4778,9 @@ class KeyValuePipe {
|
|
|
4778
4778
|
return this.keyValues;
|
|
4779
4779
|
}
|
|
4780
4780
|
}
|
|
4781
|
-
KeyValuePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4782
|
-
KeyValuePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
4783
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4781
|
+
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 });
|
|
4782
|
+
KeyValuePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: KeyValuePipe, isStandalone: true, name: "keyvalue", pure: false });
|
|
4783
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: KeyValuePipe, decorators: [{
|
|
4784
4784
|
type: Pipe,
|
|
4785
4785
|
args: [{
|
|
4786
4786
|
name: 'keyvalue',
|
|
@@ -4913,9 +4913,9 @@ class DecimalPipe {
|
|
|
4913
4913
|
}
|
|
4914
4914
|
}
|
|
4915
4915
|
}
|
|
4916
|
-
DecimalPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4917
|
-
DecimalPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
4918
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4916
|
+
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 });
|
|
4917
|
+
DecimalPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: DecimalPipe, isStandalone: true, name: "number" });
|
|
4918
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: DecimalPipe, decorators: [{
|
|
4919
4919
|
type: Pipe,
|
|
4920
4920
|
args: [{
|
|
4921
4921
|
name: 'number',
|
|
@@ -4978,9 +4978,9 @@ class PercentPipe {
|
|
|
4978
4978
|
}
|
|
4979
4979
|
}
|
|
4980
4980
|
}
|
|
4981
|
-
PercentPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4982
|
-
PercentPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
4983
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4981
|
+
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 });
|
|
4982
|
+
PercentPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: PercentPipe, isStandalone: true, name: "percent" });
|
|
4983
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: PercentPipe, decorators: [{
|
|
4984
4984
|
type: Pipe,
|
|
4985
4985
|
args: [{
|
|
4986
4986
|
name: 'percent',
|
|
@@ -5096,9 +5096,9 @@ class CurrencyPipe {
|
|
|
5096
5096
|
}
|
|
5097
5097
|
}
|
|
5098
5098
|
}
|
|
5099
|
-
CurrencyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
5100
|
-
CurrencyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
5101
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
5099
|
+
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 });
|
|
5100
|
+
CurrencyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: CurrencyPipe, isStandalone: true, name: "currency" });
|
|
5101
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: CurrencyPipe, decorators: [{
|
|
5102
5102
|
type: Pipe,
|
|
5103
5103
|
args: [{
|
|
5104
5104
|
name: 'currency',
|
|
@@ -5183,9 +5183,9 @@ class SlicePipe {
|
|
|
5183
5183
|
return typeof obj === 'string' || Array.isArray(obj);
|
|
5184
5184
|
}
|
|
5185
5185
|
}
|
|
5186
|
-
SlicePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
5187
|
-
SlicePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
5188
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
5186
|
+
SlicePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: SlicePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
5187
|
+
SlicePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.0-next.0", ngImport: i0, type: SlicePipe, isStandalone: true, name: "slice", pure: false });
|
|
5188
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: SlicePipe, decorators: [{
|
|
5189
5189
|
type: Pipe,
|
|
5190
5190
|
args: [{
|
|
5191
5191
|
name: 'slice',
|
|
@@ -5239,10 +5239,10 @@ const COMMON_PIPES = [
|
|
|
5239
5239
|
*/
|
|
5240
5240
|
class CommonModule {
|
|
5241
5241
|
}
|
|
5242
|
-
CommonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
5243
|
-
CommonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
5244
|
-
CommonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
5245
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
5242
|
+
CommonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: CommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
5243
|
+
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] });
|
|
5244
|
+
CommonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: CommonModule });
|
|
5245
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: CommonModule, decorators: [{
|
|
5246
5246
|
type: NgModule,
|
|
5247
5247
|
args: [{
|
|
5248
5248
|
imports: [COMMON_DIRECTIVES, COMMON_PIPES],
|
|
@@ -5300,7 +5300,7 @@ function isPlatformWorkerUi(platformId) {
|
|
|
5300
5300
|
/**
|
|
5301
5301
|
* @publicApi
|
|
5302
5302
|
*/
|
|
5303
|
-
const VERSION = new Version('
|
|
5303
|
+
const VERSION = new Version('15.0.0-next.0');
|
|
5304
5304
|
|
|
5305
5305
|
/**
|
|
5306
5306
|
* @license
|
|
@@ -5525,6 +5525,1083 @@ class NullViewportScroller {
|
|
|
5525
5525
|
class XhrFactory {
|
|
5526
5526
|
}
|
|
5527
5527
|
|
|
5528
|
+
/**
|
|
5529
|
+
* @license
|
|
5530
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5531
|
+
*
|
|
5532
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
5533
|
+
* found in the LICENSE file at https://angular.io/license
|
|
5534
|
+
*/
|
|
5535
|
+
/**
|
|
5536
|
+
* Asserts that the application is in development mode. Throws an error if the application is in
|
|
5537
|
+
* production mode. This assert can be used to make sure that there is no dev-mode code invoked in
|
|
5538
|
+
* the prod mode accidentally.
|
|
5539
|
+
*/
|
|
5540
|
+
function assertDevMode(checkName) {
|
|
5541
|
+
if (!ngDevMode) {
|
|
5542
|
+
throw new ɵRuntimeError(2958 /* RuntimeErrorCode.UNEXPECTED_DEV_MODE_CHECK_IN_PROD_MODE */, `Unexpected invocation of the ${checkName} in the prod mode. ` +
|
|
5543
|
+
`Please make sure that the prod mode is enabled for production builds.`);
|
|
5544
|
+
}
|
|
5545
|
+
}
|
|
5546
|
+
|
|
5547
|
+
/**
|
|
5548
|
+
* @license
|
|
5549
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5550
|
+
*
|
|
5551
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
5552
|
+
* found in the LICENSE file at https://angular.io/license
|
|
5553
|
+
*/
|
|
5554
|
+
// Assembles directive details string, useful for error messages.
|
|
5555
|
+
function imgDirectiveDetails(rawSrc, includeRawSrc = true) {
|
|
5556
|
+
const rawSrcInfo = includeRawSrc ? `(activated on an <img> element with the \`rawSrc="${rawSrc}"\`) ` : '';
|
|
5557
|
+
return `The NgOptimizedImage directive ${rawSrcInfo}has detected that`;
|
|
5558
|
+
}
|
|
5559
|
+
|
|
5560
|
+
/**
|
|
5561
|
+
* @license
|
|
5562
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5563
|
+
*
|
|
5564
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
5565
|
+
* found in the LICENSE file at https://angular.io/license
|
|
5566
|
+
*/
|
|
5567
|
+
// Converts a string that represents a URL into a URL class instance.
|
|
5568
|
+
function getUrl(src, win) {
|
|
5569
|
+
// Don't use a base URL is the URL is absolute.
|
|
5570
|
+
return isAbsoluteUrl(src) ? new URL(src) : new URL(src, win.location.href);
|
|
5571
|
+
}
|
|
5572
|
+
// Checks whether a URL is absolute (i.e. starts with `http://` or `https://`).
|
|
5573
|
+
function isAbsoluteUrl(src) {
|
|
5574
|
+
return /^https?:\/\//.test(src);
|
|
5575
|
+
}
|
|
5576
|
+
// Given a URL, extract the hostname part.
|
|
5577
|
+
// If a URL is a relative one - the URL is returned as is.
|
|
5578
|
+
function extractHostname(url) {
|
|
5579
|
+
return isAbsoluteUrl(url) ? (new URL(url)).hostname : url;
|
|
5580
|
+
}
|
|
5581
|
+
function isValidPath(path) {
|
|
5582
|
+
const isString = typeof path === 'string';
|
|
5583
|
+
if (!isString || path.trim() === '') {
|
|
5584
|
+
return false;
|
|
5585
|
+
}
|
|
5586
|
+
// Calling new URL() will throw if the path string is malformed
|
|
5587
|
+
try {
|
|
5588
|
+
const url = new URL(path);
|
|
5589
|
+
return true;
|
|
5590
|
+
}
|
|
5591
|
+
catch {
|
|
5592
|
+
return false;
|
|
5593
|
+
}
|
|
5594
|
+
}
|
|
5595
|
+
function normalizePath(path) {
|
|
5596
|
+
return path.endsWith('/') ? path.slice(0, -1) : path;
|
|
5597
|
+
}
|
|
5598
|
+
function normalizeSrc(src) {
|
|
5599
|
+
return src.startsWith('/') ? src.slice(1) : src;
|
|
5600
|
+
}
|
|
5601
|
+
|
|
5602
|
+
/**
|
|
5603
|
+
* @license
|
|
5604
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5605
|
+
*
|
|
5606
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
5607
|
+
* found in the LICENSE file at https://angular.io/license
|
|
5608
|
+
*/
|
|
5609
|
+
// Set of origins that are always excluded from the preconnect checks.
|
|
5610
|
+
const INTERNAL_PRECONNECT_CHECK_BLOCKLIST = new Set(['localhost', '127.0.0.1', '0.0.0.0']);
|
|
5611
|
+
/**
|
|
5612
|
+
* Multi-provider injection token to configure which origins should be excluded
|
|
5613
|
+
* from the preconnect checks. It can either be a single string or an array of strings
|
|
5614
|
+
* to represent a group of origins, for example:
|
|
5615
|
+
*
|
|
5616
|
+
* ```typescript
|
|
5617
|
+
* {provide: PRECONNECT_CHECK_BLOCKLIST, multi: true, useValue: 'https://your-domain.com'}
|
|
5618
|
+
* ```
|
|
5619
|
+
*
|
|
5620
|
+
* or:
|
|
5621
|
+
*
|
|
5622
|
+
* ```typescript
|
|
5623
|
+
* {provide: PRECONNECT_CHECK_BLOCKLIST, multi: true,
|
|
5624
|
+
* useValue: ['https://your-domain-1.com', 'https://your-domain-2.com']}
|
|
5625
|
+
* ```
|
|
5626
|
+
*
|
|
5627
|
+
* @publicApi
|
|
5628
|
+
* @developerPreview
|
|
5629
|
+
*/
|
|
5630
|
+
const PRECONNECT_CHECK_BLOCKLIST = new InjectionToken('PRECONNECT_CHECK_BLOCKLIST');
|
|
5631
|
+
/**
|
|
5632
|
+
* Contains the logic to detect whether an image, marked with the "priority" attribute
|
|
5633
|
+
* has a corresponding `<link rel="preconnect">` tag in the `document.head`.
|
|
5634
|
+
*
|
|
5635
|
+
* Note: this is a dev-mode only class, which should not appear in prod bundles,
|
|
5636
|
+
* thus there is no `ngDevMode` use in the code.
|
|
5637
|
+
*/
|
|
5638
|
+
class PreconnectLinkChecker {
|
|
5639
|
+
constructor() {
|
|
5640
|
+
/**
|
|
5641
|
+
* Set of <link rel="preconnect"> tags found on this page.
|
|
5642
|
+
* The `null` value indicates that there was no DOM query operation performed.
|
|
5643
|
+
*/
|
|
5644
|
+
this.preconnectLinks = null;
|
|
5645
|
+
/*
|
|
5646
|
+
* Keep track of all already seen origin URLs to avoid repeating the same check.
|
|
5647
|
+
*/
|
|
5648
|
+
this.alreadySeen = new Set();
|
|
5649
|
+
this.window = null;
|
|
5650
|
+
this.blocklist = new Set(INTERNAL_PRECONNECT_CHECK_BLOCKLIST);
|
|
5651
|
+
assertDevMode('preconnect link checker');
|
|
5652
|
+
const win = inject(DOCUMENT).defaultView;
|
|
5653
|
+
if (typeof win !== 'undefined') {
|
|
5654
|
+
this.window = win;
|
|
5655
|
+
}
|
|
5656
|
+
const blocklist = inject(PRECONNECT_CHECK_BLOCKLIST, { optional: true });
|
|
5657
|
+
if (blocklist) {
|
|
5658
|
+
this.populateBlocklist(blocklist);
|
|
5659
|
+
}
|
|
5660
|
+
}
|
|
5661
|
+
populateBlocklist(origins) {
|
|
5662
|
+
if (Array.isArray(origins)) {
|
|
5663
|
+
deepForEach(origins, origin => {
|
|
5664
|
+
this.blocklist.add(extractHostname(origin));
|
|
5665
|
+
});
|
|
5666
|
+
}
|
|
5667
|
+
else {
|
|
5668
|
+
throw new ɵRuntimeError(2957 /* RuntimeErrorCode.INVALID_PRECONNECT_CHECK_BLOCKLIST */, `The blocklist for the preconnect check was not provided as an array. ` +
|
|
5669
|
+
`Check that the \`PRECONNECT_CHECK_BLOCKLIST\` token is configured as a \`multi: true\` provider.`);
|
|
5670
|
+
}
|
|
5671
|
+
}
|
|
5672
|
+
/**
|
|
5673
|
+
* Checks that a preconnect resource hint exists in the head fo rthe
|
|
5674
|
+
* given src.
|
|
5675
|
+
*
|
|
5676
|
+
* @param rewrittenSrc src formatted with loader
|
|
5677
|
+
* @param rawSrc rawSrc value
|
|
5678
|
+
*/
|
|
5679
|
+
assertPreconnect(rewrittenSrc, rawSrc) {
|
|
5680
|
+
if (!this.window)
|
|
5681
|
+
return;
|
|
5682
|
+
const imgUrl = getUrl(rewrittenSrc, this.window);
|
|
5683
|
+
if (this.blocklist.has(imgUrl.hostname) || this.alreadySeen.has(imgUrl.origin))
|
|
5684
|
+
return;
|
|
5685
|
+
// Register this origin as seen, so we don't check it again later.
|
|
5686
|
+
this.alreadySeen.add(imgUrl.origin);
|
|
5687
|
+
if (!this.preconnectLinks) {
|
|
5688
|
+
// Note: we query for preconnect links only *once* and cache the results
|
|
5689
|
+
// for the entire lifespan of an application, since it's unlikely that the
|
|
5690
|
+
// list would change frequently. This allows to make sure there are no
|
|
5691
|
+
// performance implications of making extra DOM lookups for each image.
|
|
5692
|
+
this.preconnectLinks = this.queryPreconnectLinks();
|
|
5693
|
+
}
|
|
5694
|
+
if (!this.preconnectLinks.has(imgUrl.origin)) {
|
|
5695
|
+
console.warn(ɵformatRuntimeError(2956 /* RuntimeErrorCode.PRIORITY_IMG_MISSING_PRECONNECT_TAG */, `${imgDirectiveDetails(rawSrc)} there is no preconnect tag present for this image. ` +
|
|
5696
|
+
`Preconnecting to the origin(s) that serve priority images ensures that these ` +
|
|
5697
|
+
`images are delivered as soon as possible. To fix this, please add the following ` +
|
|
5698
|
+
`element into the <head> of the document:\n` +
|
|
5699
|
+
` <link rel="preconnect" href="${imgUrl.origin}">`));
|
|
5700
|
+
}
|
|
5701
|
+
}
|
|
5702
|
+
queryPreconnectLinks() {
|
|
5703
|
+
const preconnectUrls = new Set();
|
|
5704
|
+
const selector = 'link[rel=preconnect]';
|
|
5705
|
+
const links = Array.from(document.querySelectorAll(selector));
|
|
5706
|
+
for (let link of links) {
|
|
5707
|
+
const url = getUrl(link.href, this.window);
|
|
5708
|
+
preconnectUrls.add(url.origin);
|
|
5709
|
+
}
|
|
5710
|
+
return preconnectUrls;
|
|
5711
|
+
}
|
|
5712
|
+
ngOnDestroy() {
|
|
5713
|
+
this.preconnectLinks?.clear();
|
|
5714
|
+
this.alreadySeen.clear();
|
|
5715
|
+
}
|
|
5716
|
+
}
|
|
5717
|
+
PreconnectLinkChecker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: PreconnectLinkChecker, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5718
|
+
PreconnectLinkChecker.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: PreconnectLinkChecker, providedIn: 'root' });
|
|
5719
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: PreconnectLinkChecker, decorators: [{
|
|
5720
|
+
type: Injectable,
|
|
5721
|
+
args: [{ providedIn: 'root' }]
|
|
5722
|
+
}], ctorParameters: function () { return []; } });
|
|
5723
|
+
/**
|
|
5724
|
+
* Invokes a callback for each element in the array. Also invokes a callback
|
|
5725
|
+
* recursively for each nested array.
|
|
5726
|
+
*/
|
|
5727
|
+
function deepForEach(input, fn) {
|
|
5728
|
+
for (let value of input) {
|
|
5729
|
+
Array.isArray(value) ? deepForEach(value, fn) : fn(value);
|
|
5730
|
+
}
|
|
5731
|
+
}
|
|
5732
|
+
|
|
5733
|
+
/**
|
|
5734
|
+
* @license
|
|
5735
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5736
|
+
*
|
|
5737
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
5738
|
+
* found in the LICENSE file at https://angular.io/license
|
|
5739
|
+
*/
|
|
5740
|
+
/**
|
|
5741
|
+
* Noop image loader that does no transformation to the original src and just returns it as is.
|
|
5742
|
+
* This loader is used as a default one if more specific logic is not provided in an app config.
|
|
5743
|
+
*
|
|
5744
|
+
* @see `ImageLoader`
|
|
5745
|
+
* @see `NgOptimizedImage`
|
|
5746
|
+
*/
|
|
5747
|
+
const noopImageLoader = (config) => config.src;
|
|
5748
|
+
/**
|
|
5749
|
+
* Injection token that configures the image loader function.
|
|
5750
|
+
*
|
|
5751
|
+
* @see `ImageLoader`
|
|
5752
|
+
* @see `NgOptimizedImage`
|
|
5753
|
+
* @publicApi
|
|
5754
|
+
* @developerPreview
|
|
5755
|
+
*/
|
|
5756
|
+
const IMAGE_LOADER = new InjectionToken('ImageLoader', {
|
|
5757
|
+
providedIn: 'root',
|
|
5758
|
+
factory: () => noopImageLoader,
|
|
5759
|
+
});
|
|
5760
|
+
/**
|
|
5761
|
+
* Internal helper function that makes it easier to introduce custom image loaders for the
|
|
5762
|
+
* `NgOptimizedImage` directive. It is enough to specify a URL builder function to obtain full DI
|
|
5763
|
+
* configuration for a given loader: a DI token corresponding to the actual loader function, plus DI
|
|
5764
|
+
* tokens managing preconnect check functionality.
|
|
5765
|
+
* @param buildUrlFn a function returning a full URL based on loader's configuration
|
|
5766
|
+
* @param exampleUrls example of full URLs for a given loader (used in error messages)
|
|
5767
|
+
* @returns a set of DI providers corresponding to the configured image loader
|
|
5768
|
+
*/
|
|
5769
|
+
function createImageLoader(buildUrlFn, exampleUrls) {
|
|
5770
|
+
return function provideImageLoader(path, options = { ensurePreconnect: true }) {
|
|
5771
|
+
if (!isValidPath(path)) {
|
|
5772
|
+
throwInvalidPathError(path, exampleUrls || []);
|
|
5773
|
+
}
|
|
5774
|
+
// The trailing / is stripped (if provided) to make URL construction (concatenation) easier in
|
|
5775
|
+
// the individual loader functions.
|
|
5776
|
+
path = normalizePath(path);
|
|
5777
|
+
const loaderFn = (config) => {
|
|
5778
|
+
if (isAbsoluteUrl(config.src)) {
|
|
5779
|
+
// Image loader functions expect an image file name (e.g. `my-image.png`)
|
|
5780
|
+
// or a relative path + a file name (e.g. `/a/b/c/my-image.png`) as an input,
|
|
5781
|
+
// so the final absolute URL can be constructed.
|
|
5782
|
+
// When an absolute URL is provided instead - the loader can not
|
|
5783
|
+
// build a final URL, thus the error is thrown to indicate that.
|
|
5784
|
+
throwUnexpectedAbsoluteUrlError(path, config.src);
|
|
5785
|
+
}
|
|
5786
|
+
return buildUrlFn(path, { ...config, src: normalizeSrc(config.src) });
|
|
5787
|
+
};
|
|
5788
|
+
const providers = [{ provide: IMAGE_LOADER, useValue: loaderFn }];
|
|
5789
|
+
if (ngDevMode && options.ensurePreconnect === false) {
|
|
5790
|
+
providers.push({ provide: PRECONNECT_CHECK_BLOCKLIST, useValue: [path], multi: true });
|
|
5791
|
+
}
|
|
5792
|
+
return providers;
|
|
5793
|
+
};
|
|
5794
|
+
}
|
|
5795
|
+
function throwInvalidPathError(path, exampleUrls) {
|
|
5796
|
+
throw new ɵRuntimeError(2959 /* RuntimeErrorCode.INVALID_LOADER_ARGUMENTS */, ngDevMode &&
|
|
5797
|
+
`Image loader has detected an invalid path (\`${path}\`). ` +
|
|
5798
|
+
`To fix this, supply a path using one of the following formats: ${exampleUrls.join(' or ')}`);
|
|
5799
|
+
}
|
|
5800
|
+
function throwUnexpectedAbsoluteUrlError(path, url) {
|
|
5801
|
+
throw new ɵRuntimeError(2959 /* RuntimeErrorCode.INVALID_LOADER_ARGUMENTS */, ngDevMode &&
|
|
5802
|
+
`Image loader has detected a \`<img>\` tag with an invalid \`rawSrc\` attribute: ${url}. ` +
|
|
5803
|
+
`This image loader expects \`rawSrc\` to be a relative URL - ` +
|
|
5804
|
+
`however the provided value is an absolute URL. ` +
|
|
5805
|
+
`To fix this, provide \`rawSrc\` as a path relative to the base URL ` +
|
|
5806
|
+
`configured for this loader (\`${path}\`).`);
|
|
5807
|
+
}
|
|
5808
|
+
|
|
5809
|
+
/**
|
|
5810
|
+
* @license
|
|
5811
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5812
|
+
*
|
|
5813
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
5814
|
+
* found in the LICENSE file at https://angular.io/license
|
|
5815
|
+
*/
|
|
5816
|
+
/**
|
|
5817
|
+
* Function that generates an ImageLoader for [Cloudflare Image
|
|
5818
|
+
* Resizing](https://developers.cloudflare.com/images/image-resizing/) and turns it into an Angular
|
|
5819
|
+
* provider. Note: Cloudflare has multiple image products - this provider is specifically for
|
|
5820
|
+
* Cloudflare Image Resizing; it will not work with Cloudflare Images or Cloudflare Polish.
|
|
5821
|
+
*
|
|
5822
|
+
* @param path Your domain name, e.g. https://mysite.com
|
|
5823
|
+
* @param options An object with extra configuration:
|
|
5824
|
+
* - `ensurePreconnect`: boolean flag indicating whether the NgOptimizedImage directive
|
|
5825
|
+
* should verify that there is a corresponding `<link rel="preconnect">`
|
|
5826
|
+
* present in the document's `<head>`.
|
|
5827
|
+
* @returns Provider that provides an ImageLoader function
|
|
5828
|
+
*
|
|
5829
|
+
* @publicApi
|
|
5830
|
+
* @developerPreview
|
|
5831
|
+
*/
|
|
5832
|
+
const provideCloudflareLoader = createImageLoader(createCloudflareUrl, ngDevMode ? ['https://<ZONE>/cdn-cgi/image/<OPTIONS>/<SOURCE-IMAGE>'] : undefined);
|
|
5833
|
+
function createCloudflareUrl(path, config) {
|
|
5834
|
+
let params = `format=auto`;
|
|
5835
|
+
if (config.width) {
|
|
5836
|
+
params += `,width=${config.width}`;
|
|
5837
|
+
}
|
|
5838
|
+
// Cloudflare image URLs format:
|
|
5839
|
+
// https://developers.cloudflare.com/images/image-resizing/url-format/
|
|
5840
|
+
return `${path}/cdn-cgi/image/${params}/${config.src}`;
|
|
5841
|
+
}
|
|
5842
|
+
|
|
5843
|
+
/**
|
|
5844
|
+
* @license
|
|
5845
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5846
|
+
*
|
|
5847
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
5848
|
+
* found in the LICENSE file at https://angular.io/license
|
|
5849
|
+
*/
|
|
5850
|
+
/**
|
|
5851
|
+
* Function that generates an ImageLoader for Cloudinary and turns it into an Angular provider.
|
|
5852
|
+
*
|
|
5853
|
+
* @param path Base URL of your Cloudinary images
|
|
5854
|
+
* This URL should match one of the following formats:
|
|
5855
|
+
* https://res.cloudinary.com/mysite
|
|
5856
|
+
* https://mysite.cloudinary.com
|
|
5857
|
+
* https://subdomain.mysite.com
|
|
5858
|
+
* @param options An object with extra configuration:
|
|
5859
|
+
* - `ensurePreconnect`: boolean flag indicating whether the NgOptimizedImage directive
|
|
5860
|
+
* should verify that there is a corresponding `<link rel="preconnect">`
|
|
5861
|
+
* present in the document's `<head>`.
|
|
5862
|
+
* @returns Set of providers to configure the Cloudinary loader.
|
|
5863
|
+
*
|
|
5864
|
+
* @publicApi
|
|
5865
|
+
* @developerPreview
|
|
5866
|
+
*/
|
|
5867
|
+
const provideCloudinaryLoader = createImageLoader(createCloudinaryUrl, ngDevMode ?
|
|
5868
|
+
[
|
|
5869
|
+
'https://res.cloudinary.com/mysite', 'https://mysite.cloudinary.com',
|
|
5870
|
+
'https://subdomain.mysite.com'
|
|
5871
|
+
] :
|
|
5872
|
+
undefined);
|
|
5873
|
+
function createCloudinaryUrl(path, config) {
|
|
5874
|
+
// Cloudinary image URLformat:
|
|
5875
|
+
// https://cloudinary.com/documentation/image_transformations#transformation_url_structure
|
|
5876
|
+
// Example of a Cloudinary image URL:
|
|
5877
|
+
// https://res.cloudinary.com/mysite/image/upload/c_scale,f_auto,q_auto,w_600/marketing/tile-topics-m.png
|
|
5878
|
+
let params = `f_auto,q_auto`; // sets image format and quality to "auto"
|
|
5879
|
+
if (config.width) {
|
|
5880
|
+
params += `,w_${config.width}`;
|
|
5881
|
+
}
|
|
5882
|
+
return `${path}/image/upload/${params}/${config.src}`;
|
|
5883
|
+
}
|
|
5884
|
+
|
|
5885
|
+
/**
|
|
5886
|
+
* @license
|
|
5887
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5888
|
+
*
|
|
5889
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
5890
|
+
* found in the LICENSE file at https://angular.io/license
|
|
5891
|
+
*/
|
|
5892
|
+
/**
|
|
5893
|
+
* Function that generates an ImageLoader for ImageKit and turns it into an Angular provider.
|
|
5894
|
+
*
|
|
5895
|
+
* @param path Base URL of your ImageKit images
|
|
5896
|
+
* This URL should match one of the following formats:
|
|
5897
|
+
* https://ik.imagekit.io/myaccount
|
|
5898
|
+
* https://subdomain.mysite.com
|
|
5899
|
+
* @param options An object with extra configuration:
|
|
5900
|
+
* - `ensurePreconnect`: boolean flag indicating whether the NgOptimizedImage directive
|
|
5901
|
+
* should verify that there is a corresponding `<link rel="preconnect">`
|
|
5902
|
+
* present in the document's `<head>`.
|
|
5903
|
+
* @returns Set of providers to configure the ImageKit loader.
|
|
5904
|
+
*
|
|
5905
|
+
* @publicApi
|
|
5906
|
+
* @developerPreview
|
|
5907
|
+
*/
|
|
5908
|
+
const provideImageKitLoader = createImageLoader(createImagekitUrl, ngDevMode ? ['https://ik.imagekit.io/mysite', 'https://subdomain.mysite.com'] : undefined);
|
|
5909
|
+
function createImagekitUrl(path, config) {
|
|
5910
|
+
// Example of an ImageKit image URL:
|
|
5911
|
+
// https://ik.imagekit.io/demo/tr:w-300,h-300/medium_cafe_B1iTdD0C.jpg
|
|
5912
|
+
let params = `tr:q-auto`; // applies the "auto quality" transformation
|
|
5913
|
+
if (config.width) {
|
|
5914
|
+
params += `,w-${config.width}`;
|
|
5915
|
+
}
|
|
5916
|
+
return `${path}/${params}/${config.src}`;
|
|
5917
|
+
}
|
|
5918
|
+
|
|
5919
|
+
/**
|
|
5920
|
+
* @license
|
|
5921
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5922
|
+
*
|
|
5923
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
5924
|
+
* found in the LICENSE file at https://angular.io/license
|
|
5925
|
+
*/
|
|
5926
|
+
/**
|
|
5927
|
+
* Function that generates an ImageLoader for Imgix and turns it into an Angular provider.
|
|
5928
|
+
*
|
|
5929
|
+
* @param path path to the desired Imgix origin,
|
|
5930
|
+
* e.g. https://somepath.imgix.net or https://images.mysite.com
|
|
5931
|
+
* @param options An object with extra configuration:
|
|
5932
|
+
* - `ensurePreconnect`: boolean flag indicating whether the NgOptimizedImage directive
|
|
5933
|
+
* should verify that there is a corresponding `<link rel="preconnect">`
|
|
5934
|
+
* present in the document's `<head>`.
|
|
5935
|
+
* @returns Set of providers to configure the Imgix loader.
|
|
5936
|
+
*
|
|
5937
|
+
* @publicApi
|
|
5938
|
+
* @developerPreview
|
|
5939
|
+
*/
|
|
5940
|
+
const provideImgixLoader = createImageLoader(createImgixUrl, ngDevMode ? ['https://somepath.imgix.net/'] : undefined);
|
|
5941
|
+
function createImgixUrl(path, config) {
|
|
5942
|
+
const url = new URL(`${path}/${config.src}`);
|
|
5943
|
+
// This setting ensures the smallest allowable format is set.
|
|
5944
|
+
url.searchParams.set('auto', 'format');
|
|
5945
|
+
if (config.width) {
|
|
5946
|
+
url.searchParams.set('w', config.width.toString());
|
|
5947
|
+
}
|
|
5948
|
+
return url.href;
|
|
5949
|
+
}
|
|
5950
|
+
|
|
5951
|
+
/**
|
|
5952
|
+
* @license
|
|
5953
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5954
|
+
*
|
|
5955
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
5956
|
+
* found in the LICENSE file at https://angular.io/license
|
|
5957
|
+
*/
|
|
5958
|
+
/**
|
|
5959
|
+
* Observer that detects whether an image with `NgOptimizedImage`
|
|
5960
|
+
* is treated as a Largest Contentful Paint (LCP) element. If so,
|
|
5961
|
+
* asserts that the image has the `priority` attribute.
|
|
5962
|
+
*
|
|
5963
|
+
* Note: this is a dev-mode only class and it does not appear in prod bundles,
|
|
5964
|
+
* thus there is no `ngDevMode` use in the code.
|
|
5965
|
+
*
|
|
5966
|
+
* Based on https://web.dev/lcp/#measure-lcp-in-javascript.
|
|
5967
|
+
*/
|
|
5968
|
+
class LCPImageObserver {
|
|
5969
|
+
constructor() {
|
|
5970
|
+
// Map of full image URLs -> original `rawSrc` values.
|
|
5971
|
+
this.images = new Map();
|
|
5972
|
+
// Keep track of images for which `console.warn` was produced.
|
|
5973
|
+
this.alreadyWarned = new Set();
|
|
5974
|
+
this.window = null;
|
|
5975
|
+
this.observer = null;
|
|
5976
|
+
assertDevMode('LCP checker');
|
|
5977
|
+
const win = inject(DOCUMENT).defaultView;
|
|
5978
|
+
if (typeof win !== 'undefined' && typeof PerformanceObserver !== 'undefined') {
|
|
5979
|
+
this.window = win;
|
|
5980
|
+
this.observer = this.initPerformanceObserver();
|
|
5981
|
+
}
|
|
5982
|
+
}
|
|
5983
|
+
/**
|
|
5984
|
+
* Inits PerformanceObserver and subscribes to LCP events.
|
|
5985
|
+
* Based on https://web.dev/lcp/#measure-lcp-in-javascript
|
|
5986
|
+
*/
|
|
5987
|
+
initPerformanceObserver() {
|
|
5988
|
+
const observer = new PerformanceObserver((entryList) => {
|
|
5989
|
+
const entries = entryList.getEntries();
|
|
5990
|
+
if (entries.length === 0)
|
|
5991
|
+
return;
|
|
5992
|
+
// We use the latest entry produced by the `PerformanceObserver` as the best
|
|
5993
|
+
// signal on which element is actually an LCP one. As an example, the first image to load on
|
|
5994
|
+
// a page, by virtue of being the only thing on the page so far, is often a LCP candidate
|
|
5995
|
+
// and gets reported by PerformanceObserver, but isn't necessarily the LCP element.
|
|
5996
|
+
const lcpElement = entries[entries.length - 1];
|
|
5997
|
+
// Cast to `any` due to missing `element` on the `LargestContentfulPaint` type of entry.
|
|
5998
|
+
// See https://developer.mozilla.org/en-US/docs/Web/API/LargestContentfulPaint
|
|
5999
|
+
const imgSrc = lcpElement.element?.src ?? '';
|
|
6000
|
+
// Exclude `data:` and `blob:` URLs, since they are not supported by the directive.
|
|
6001
|
+
if (imgSrc.startsWith('data:') || imgSrc.startsWith('blob:'))
|
|
6002
|
+
return;
|
|
6003
|
+
const imgRawSrc = this.images.get(imgSrc);
|
|
6004
|
+
if (imgRawSrc && !this.alreadyWarned.has(imgSrc)) {
|
|
6005
|
+
this.alreadyWarned.add(imgSrc);
|
|
6006
|
+
logMissingPriorityWarning(imgSrc);
|
|
6007
|
+
}
|
|
6008
|
+
});
|
|
6009
|
+
observer.observe({ type: 'largest-contentful-paint', buffered: true });
|
|
6010
|
+
return observer;
|
|
6011
|
+
}
|
|
6012
|
+
registerImage(rewrittenSrc, rawSrc) {
|
|
6013
|
+
if (!this.observer)
|
|
6014
|
+
return;
|
|
6015
|
+
this.images.set(getUrl(rewrittenSrc, this.window).href, rawSrc);
|
|
6016
|
+
}
|
|
6017
|
+
unregisterImage(rewrittenSrc) {
|
|
6018
|
+
if (!this.observer)
|
|
6019
|
+
return;
|
|
6020
|
+
this.images.delete(getUrl(rewrittenSrc, this.window).href);
|
|
6021
|
+
}
|
|
6022
|
+
ngOnDestroy() {
|
|
6023
|
+
if (!this.observer)
|
|
6024
|
+
return;
|
|
6025
|
+
this.observer.disconnect();
|
|
6026
|
+
this.images.clear();
|
|
6027
|
+
this.alreadyWarned.clear();
|
|
6028
|
+
}
|
|
6029
|
+
}
|
|
6030
|
+
LCPImageObserver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: LCPImageObserver, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6031
|
+
LCPImageObserver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: LCPImageObserver, providedIn: 'root' });
|
|
6032
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: LCPImageObserver, decorators: [{
|
|
6033
|
+
type: Injectable,
|
|
6034
|
+
args: [{ providedIn: 'root' }]
|
|
6035
|
+
}], ctorParameters: function () { return []; } });
|
|
6036
|
+
function logMissingPriorityWarning(rawSrc) {
|
|
6037
|
+
const directiveDetails = imgDirectiveDetails(rawSrc);
|
|
6038
|
+
console.warn(ɵformatRuntimeError(2955 /* RuntimeErrorCode.LCP_IMG_MISSING_PRIORITY */, `${directiveDetails} this image is the Largest Contentful Paint (LCP) ` +
|
|
6039
|
+
`element but was not marked "priority". This image should be marked ` +
|
|
6040
|
+
`"priority" in order to prioritize its loading. ` +
|
|
6041
|
+
`To fix this, add the "priority" attribute.`));
|
|
6042
|
+
}
|
|
6043
|
+
|
|
6044
|
+
/**
|
|
6045
|
+
* @license
|
|
6046
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6047
|
+
*
|
|
6048
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6049
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6050
|
+
*/
|
|
6051
|
+
/**
|
|
6052
|
+
* When a Base64-encoded image is passed as an input to the `NgOptimizedImage` directive,
|
|
6053
|
+
* an error is thrown. The image content (as a string) might be very long, thus making
|
|
6054
|
+
* it hard to read an error message if the entire string is included. This const defines
|
|
6055
|
+
* the number of characters that should be included into the error message. The rest
|
|
6056
|
+
* of the content is truncated.
|
|
6057
|
+
*/
|
|
6058
|
+
const BASE64_IMG_MAX_LENGTH_IN_ERROR = 50;
|
|
6059
|
+
/**
|
|
6060
|
+
* RegExpr to determine whether a src in a srcset is using width descriptors.
|
|
6061
|
+
* Should match something like: "100w, 200w".
|
|
6062
|
+
*/
|
|
6063
|
+
const VALID_WIDTH_DESCRIPTOR_SRCSET = /^((\s*\d+w\s*(,|$)){1,})$/;
|
|
6064
|
+
/**
|
|
6065
|
+
* RegExpr to determine whether a src in a srcset is using density descriptors.
|
|
6066
|
+
* Should match something like: "1x, 2x, 50x". Also supports decimals like "1.5x, 1.50x".
|
|
6067
|
+
*/
|
|
6068
|
+
const VALID_DENSITY_DESCRIPTOR_SRCSET = /^((\s*\d+(\.\d+)?x\s*(,|$)){1,})$/;
|
|
6069
|
+
/**
|
|
6070
|
+
* Srcset values with a density descriptor higher than this value will actively
|
|
6071
|
+
* throw an error. Such densities are not permitted as they cause image sizes
|
|
6072
|
+
* to be unreasonably large and slow down LCP.
|
|
6073
|
+
*/
|
|
6074
|
+
const ABSOLUTE_SRCSET_DENSITY_CAP = 3;
|
|
6075
|
+
/**
|
|
6076
|
+
* Used only in error message text to communicate best practices, as we will
|
|
6077
|
+
* only throw based on the slightly more conservative ABSOLUTE_SRCSET_DENSITY_CAP.
|
|
6078
|
+
*/
|
|
6079
|
+
const RECOMMENDED_SRCSET_DENSITY_CAP = 2;
|
|
6080
|
+
/**
|
|
6081
|
+
* Used to determine whether two aspect ratios are similar in value.
|
|
6082
|
+
*/
|
|
6083
|
+
const ASPECT_RATIO_TOLERANCE = .1;
|
|
6084
|
+
/**
|
|
6085
|
+
* Used to determine whether the image has been requested at an overly
|
|
6086
|
+
* large size compared to the actual rendered image size (after taking
|
|
6087
|
+
* into account a typical device pixel ratio). In pixels.
|
|
6088
|
+
*/
|
|
6089
|
+
const OVERSIZED_IMAGE_TOLERANCE = 1000;
|
|
6090
|
+
/**
|
|
6091
|
+
* Directive that improves image loading performance by enforcing best practices.
|
|
6092
|
+
*
|
|
6093
|
+
* `NgOptimizedImage` ensures that the loading of the Largest Contentful Paint (LCP) image is
|
|
6094
|
+
* prioritized by:
|
|
6095
|
+
* - Automatically setting the `fetchpriority` attribute on the `<img>` tag
|
|
6096
|
+
* - Lazy loading non-priority images by default
|
|
6097
|
+
* - Asserting that there is a corresponding preconnect link tag in the document head
|
|
6098
|
+
*
|
|
6099
|
+
* In addition, the directive:
|
|
6100
|
+
* - Generates appropriate asset URLs if a corresponding `ImageLoader` function is provided
|
|
6101
|
+
* - Requires that `width` and `height` are set
|
|
6102
|
+
* - Warns if `width` or `height` have been set incorrectly
|
|
6103
|
+
* - Warns if the image will be visually distorted when rendered
|
|
6104
|
+
*
|
|
6105
|
+
* @usageNotes
|
|
6106
|
+
* The `NgOptimizedImage` directive is marked as [standalone](guide/standalone-components) and can
|
|
6107
|
+
* be imported directly.
|
|
6108
|
+
*
|
|
6109
|
+
* Follow the steps below to enable and use the directive:
|
|
6110
|
+
* 1. Import it into the necessary NgModule or a standalone Component.
|
|
6111
|
+
* 2. Optionally provide an `ImageLoader` if you use an image hosting service.
|
|
6112
|
+
* 3. Update the necessary `<img>` tags in templates and replace `src` attributes with `rawSrc`.
|
|
6113
|
+
* Using a `rawSrc` allows the directive to control when the `src` gets set, which triggers an image
|
|
6114
|
+
* download.
|
|
6115
|
+
*
|
|
6116
|
+
* Step 1: import the `NgOptimizedImage` directive.
|
|
6117
|
+
*
|
|
6118
|
+
* ```typescript
|
|
6119
|
+
* import { NgOptimizedImage } from '@angular/common';
|
|
6120
|
+
*
|
|
6121
|
+
* // Include it into the necessary NgModule
|
|
6122
|
+
* @NgModule({
|
|
6123
|
+
* imports: [NgOptimizedImage],
|
|
6124
|
+
* })
|
|
6125
|
+
* class AppModule {}
|
|
6126
|
+
*
|
|
6127
|
+
* // ... or a standalone Component
|
|
6128
|
+
* @Component({
|
|
6129
|
+
* standalone: true
|
|
6130
|
+
* imports: [NgOptimizedImage],
|
|
6131
|
+
* })
|
|
6132
|
+
* class MyStandaloneComponent {}
|
|
6133
|
+
* ```
|
|
6134
|
+
*
|
|
6135
|
+
* Step 2: configure a loader.
|
|
6136
|
+
*
|
|
6137
|
+
* To use the **default loader**: no additional code changes are necessary. The URL returned by the
|
|
6138
|
+
* generic loader will always match the value of "src". In other words, this loader applies no
|
|
6139
|
+
* transformations to the resource URL and the value of the `rawSrc` attribute will be used as is.
|
|
6140
|
+
*
|
|
6141
|
+
* To use an existing loader for a **third-party image service**: add the provider factory for your
|
|
6142
|
+
* chosen service to the `providers` array. In the example below, the Imgix loader is used:
|
|
6143
|
+
*
|
|
6144
|
+
* ```typescript
|
|
6145
|
+
* import {provideImgixLoader} from '@angular/common';
|
|
6146
|
+
*
|
|
6147
|
+
* // Call the function and add the result to the `providers` array:
|
|
6148
|
+
* providers: [
|
|
6149
|
+
* provideImgixLoader("https://my.base.url/"),
|
|
6150
|
+
* ],
|
|
6151
|
+
* ```
|
|
6152
|
+
*
|
|
6153
|
+
* The `NgOptimizedImage` directive provides the following functions:
|
|
6154
|
+
* - `provideCloudflareLoader`
|
|
6155
|
+
* - `provideCloudinaryLoader`
|
|
6156
|
+
* - `provideImageKitLoader`
|
|
6157
|
+
* - `provideImgixLoader`
|
|
6158
|
+
*
|
|
6159
|
+
* If you use a different image provider, you can create a custom loader function as described
|
|
6160
|
+
* below.
|
|
6161
|
+
*
|
|
6162
|
+
* To use a **custom loader**: provide your loader function as a value for the `IMAGE_LOADER` DI
|
|
6163
|
+
* token.
|
|
6164
|
+
*
|
|
6165
|
+
* ```typescript
|
|
6166
|
+
* import {IMAGE_LOADER, ImageLoaderConfig} from '@angular/common';
|
|
6167
|
+
*
|
|
6168
|
+
* // Configure the loader using the `IMAGE_LOADER` token.
|
|
6169
|
+
* providers: [
|
|
6170
|
+
* {
|
|
6171
|
+
* provide: IMAGE_LOADER,
|
|
6172
|
+
* useValue: (config: ImageLoaderConfig) => {
|
|
6173
|
+
* return `https://example.com/${config.src}-${config.width}.jpg}`;
|
|
6174
|
+
* }
|
|
6175
|
+
* },
|
|
6176
|
+
* ],
|
|
6177
|
+
* ```
|
|
6178
|
+
*
|
|
6179
|
+
* Step 3: update `<img>` tags in templates to use `rawSrc` instead of `src`.
|
|
6180
|
+
*
|
|
6181
|
+
* ```
|
|
6182
|
+
* <img rawSrc="logo.png" width="200" height="100">
|
|
6183
|
+
* ```
|
|
6184
|
+
*
|
|
6185
|
+
* @publicApi
|
|
6186
|
+
* @developerPreview
|
|
6187
|
+
*/
|
|
6188
|
+
class NgOptimizedImage {
|
|
6189
|
+
constructor() {
|
|
6190
|
+
this.imageLoader = inject(IMAGE_LOADER);
|
|
6191
|
+
this.renderer = inject(Renderer2);
|
|
6192
|
+
this.imgElement = inject(ElementRef).nativeElement;
|
|
6193
|
+
this.injector = inject(Injector);
|
|
6194
|
+
// a LCP image observer - should be injected only in the dev mode
|
|
6195
|
+
this.lcpObserver = ngDevMode ? this.injector.get(LCPImageObserver) : null;
|
|
6196
|
+
/**
|
|
6197
|
+
* Calculate the rewritten `src` once and store it.
|
|
6198
|
+
* This is needed to avoid repetitive calculations and make sure the directive cleanup in the
|
|
6199
|
+
* `ngOnDestroy` does not rely on the `IMAGE_LOADER` logic (which in turn can rely on some other
|
|
6200
|
+
* instance that might be already destroyed).
|
|
6201
|
+
*/
|
|
6202
|
+
this._renderedSrc = null;
|
|
6203
|
+
this._priority = false;
|
|
6204
|
+
}
|
|
6205
|
+
/**
|
|
6206
|
+
* The intrinsic width of the image in pixels.
|
|
6207
|
+
*/
|
|
6208
|
+
set width(value) {
|
|
6209
|
+
ngDevMode && assertGreaterThanZero(this, value, 'width');
|
|
6210
|
+
this._width = inputToInteger(value);
|
|
6211
|
+
}
|
|
6212
|
+
get width() {
|
|
6213
|
+
return this._width;
|
|
6214
|
+
}
|
|
6215
|
+
/**
|
|
6216
|
+
* The intrinsic height of the image in pixels.
|
|
6217
|
+
*/
|
|
6218
|
+
set height(value) {
|
|
6219
|
+
ngDevMode && assertGreaterThanZero(this, value, 'height');
|
|
6220
|
+
this._height = inputToInteger(value);
|
|
6221
|
+
}
|
|
6222
|
+
get height() {
|
|
6223
|
+
return this._height;
|
|
6224
|
+
}
|
|
6225
|
+
/**
|
|
6226
|
+
* Indicates whether this image should have a high priority.
|
|
6227
|
+
*/
|
|
6228
|
+
set priority(value) {
|
|
6229
|
+
this._priority = inputToBoolean(value);
|
|
6230
|
+
}
|
|
6231
|
+
get priority() {
|
|
6232
|
+
return this._priority;
|
|
6233
|
+
}
|
|
6234
|
+
ngOnInit() {
|
|
6235
|
+
if (ngDevMode) {
|
|
6236
|
+
assertNonEmptyInput(this, 'rawSrc', this.rawSrc);
|
|
6237
|
+
assertValidRawSrcset(this, this.rawSrcset);
|
|
6238
|
+
assertNoConflictingSrc(this);
|
|
6239
|
+
assertNoConflictingSrcset(this);
|
|
6240
|
+
assertNotBase64Image(this);
|
|
6241
|
+
assertNotBlobUrl(this);
|
|
6242
|
+
assertNonEmptyWidthAndHeight(this);
|
|
6243
|
+
assertValidLoadingInput(this);
|
|
6244
|
+
assertNoImageDistortion(this, this.imgElement, this.renderer);
|
|
6245
|
+
if (this.priority) {
|
|
6246
|
+
const checker = this.injector.get(PreconnectLinkChecker);
|
|
6247
|
+
checker.assertPreconnect(this.getRewrittenSrc(), this.rawSrc);
|
|
6248
|
+
}
|
|
6249
|
+
else {
|
|
6250
|
+
// Monitor whether an image is an LCP element only in case
|
|
6251
|
+
// the `priority` attribute is missing. Otherwise, an image
|
|
6252
|
+
// has the necessary settings and no extra checks are required.
|
|
6253
|
+
if (this.lcpObserver !== null) {
|
|
6254
|
+
const ngZone = this.injector.get(NgZone);
|
|
6255
|
+
ngZone.runOutsideAngular(() => {
|
|
6256
|
+
this.lcpObserver.registerImage(this.getRewrittenSrc(), this.rawSrc);
|
|
6257
|
+
});
|
|
6258
|
+
}
|
|
6259
|
+
}
|
|
6260
|
+
}
|
|
6261
|
+
this.setHostAttributes();
|
|
6262
|
+
}
|
|
6263
|
+
setHostAttributes() {
|
|
6264
|
+
// Must set width/height explicitly in case they are bound (in which case they will
|
|
6265
|
+
// only be reflected and not found by the browser)
|
|
6266
|
+
this.setHostAttribute('width', this.width.toString());
|
|
6267
|
+
this.setHostAttribute('height', this.height.toString());
|
|
6268
|
+
this.setHostAttribute('loading', this.getLoadingBehavior());
|
|
6269
|
+
this.setHostAttribute('fetchpriority', this.getFetchPriority());
|
|
6270
|
+
// The `src` and `srcset` attributes should be set last since other attributes
|
|
6271
|
+
// could affect the image's loading behavior.
|
|
6272
|
+
this.setHostAttribute('src', this.getRewrittenSrc());
|
|
6273
|
+
if (this.rawSrcset) {
|
|
6274
|
+
this.setHostAttribute('srcset', this.getRewrittenSrcset());
|
|
6275
|
+
}
|
|
6276
|
+
}
|
|
6277
|
+
ngOnChanges(changes) {
|
|
6278
|
+
if (ngDevMode) {
|
|
6279
|
+
assertNoPostInitInputChange(this, changes, ['rawSrc', 'rawSrcset', 'width', 'height', 'priority']);
|
|
6280
|
+
}
|
|
6281
|
+
}
|
|
6282
|
+
getLoadingBehavior() {
|
|
6283
|
+
if (!this.priority && this.loading !== undefined) {
|
|
6284
|
+
return this.loading;
|
|
6285
|
+
}
|
|
6286
|
+
return this.priority ? 'eager' : 'lazy';
|
|
6287
|
+
}
|
|
6288
|
+
getFetchPriority() {
|
|
6289
|
+
return this.priority ? 'high' : 'auto';
|
|
6290
|
+
}
|
|
6291
|
+
getRewrittenSrc() {
|
|
6292
|
+
// ImageLoaderConfig supports setting a width property. However, we're not setting width here
|
|
6293
|
+
// because if the developer uses rendered width instead of intrinsic width in the HTML width
|
|
6294
|
+
// attribute, the image requested may be too small for 2x+ screens.
|
|
6295
|
+
if (!this._renderedSrc) {
|
|
6296
|
+
const imgConfig = { src: this.rawSrc };
|
|
6297
|
+
// Cache calculated image src to reuse it later in the code.
|
|
6298
|
+
this._renderedSrc = this.imageLoader(imgConfig);
|
|
6299
|
+
}
|
|
6300
|
+
return this._renderedSrc;
|
|
6301
|
+
}
|
|
6302
|
+
getRewrittenSrcset() {
|
|
6303
|
+
const widthSrcSet = VALID_WIDTH_DESCRIPTOR_SRCSET.test(this.rawSrcset);
|
|
6304
|
+
const finalSrcs = this.rawSrcset.split(',').filter(src => src !== '').map(srcStr => {
|
|
6305
|
+
srcStr = srcStr.trim();
|
|
6306
|
+
const width = widthSrcSet ? parseFloat(srcStr) : parseFloat(srcStr) * this.width;
|
|
6307
|
+
return `${this.imageLoader({ src: this.rawSrc, width })} ${srcStr}`;
|
|
6308
|
+
});
|
|
6309
|
+
return finalSrcs.join(', ');
|
|
6310
|
+
}
|
|
6311
|
+
ngOnDestroy() {
|
|
6312
|
+
if (ngDevMode) {
|
|
6313
|
+
if (!this.priority && this._renderedSrc !== null && this.lcpObserver !== null) {
|
|
6314
|
+
this.lcpObserver.unregisterImage(this._renderedSrc);
|
|
6315
|
+
}
|
|
6316
|
+
}
|
|
6317
|
+
}
|
|
6318
|
+
setHostAttribute(name, value) {
|
|
6319
|
+
this.renderer.setAttribute(this.imgElement, name, value);
|
|
6320
|
+
}
|
|
6321
|
+
}
|
|
6322
|
+
NgOptimizedImage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgOptimizedImage, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
6323
|
+
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 });
|
|
6324
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.0", ngImport: i0, type: NgOptimizedImage, decorators: [{
|
|
6325
|
+
type: Directive,
|
|
6326
|
+
args: [{
|
|
6327
|
+
standalone: true,
|
|
6328
|
+
selector: 'img[rawSrc]',
|
|
6329
|
+
}]
|
|
6330
|
+
}], propDecorators: { rawSrc: [{
|
|
6331
|
+
type: Input
|
|
6332
|
+
}], rawSrcset: [{
|
|
6333
|
+
type: Input
|
|
6334
|
+
}], width: [{
|
|
6335
|
+
type: Input
|
|
6336
|
+
}], height: [{
|
|
6337
|
+
type: Input
|
|
6338
|
+
}], loading: [{
|
|
6339
|
+
type: Input
|
|
6340
|
+
}], priority: [{
|
|
6341
|
+
type: Input
|
|
6342
|
+
}], src: [{
|
|
6343
|
+
type: Input
|
|
6344
|
+
}], srcset: [{
|
|
6345
|
+
type: Input
|
|
6346
|
+
}] } });
|
|
6347
|
+
/***** Helpers *****/
|
|
6348
|
+
/**
|
|
6349
|
+
* Convert input value to integer.
|
|
6350
|
+
*/
|
|
6351
|
+
function inputToInteger(value) {
|
|
6352
|
+
return typeof value === 'string' ? parseInt(value, 10) : value;
|
|
6353
|
+
}
|
|
6354
|
+
/**
|
|
6355
|
+
* Convert input value to boolean.
|
|
6356
|
+
*/
|
|
6357
|
+
function inputToBoolean(value) {
|
|
6358
|
+
return value != null && `${value}` !== 'false';
|
|
6359
|
+
}
|
|
6360
|
+
/***** Assert functions *****/
|
|
6361
|
+
/**
|
|
6362
|
+
* Verifies that there is no `src` set on a host element.
|
|
6363
|
+
*/
|
|
6364
|
+
function assertNoConflictingSrc(dir) {
|
|
6365
|
+
if (dir.src) {
|
|
6366
|
+
throw new ɵRuntimeError(2950 /* RuntimeErrorCode.UNEXPECTED_SRC_ATTR */, `${imgDirectiveDetails(dir.rawSrc)} both \`src\` and \`rawSrc\` have been set. ` +
|
|
6367
|
+
`Supplying both of these attributes breaks lazy loading. ` +
|
|
6368
|
+
`The NgOptimizedImage directive sets \`src\` itself based on the value of \`rawSrc\`. ` +
|
|
6369
|
+
`To fix this, please remove the \`src\` attribute.`);
|
|
6370
|
+
}
|
|
6371
|
+
}
|
|
6372
|
+
/**
|
|
6373
|
+
* Verifies that there is no `srcset` set on a host element.
|
|
6374
|
+
*/
|
|
6375
|
+
function assertNoConflictingSrcset(dir) {
|
|
6376
|
+
if (dir.srcset) {
|
|
6377
|
+
throw new ɵRuntimeError(2951 /* RuntimeErrorCode.UNEXPECTED_SRCSET_ATTR */, `${imgDirectiveDetails(dir.rawSrc)} both \`srcset\` and \`rawSrcset\` have been set. ` +
|
|
6378
|
+
`Supplying both of these attributes breaks lazy loading. ` +
|
|
6379
|
+
`The NgOptimizedImage directive sets \`srcset\` itself based on the value of ` +
|
|
6380
|
+
`\`rawSrcset\`. To fix this, please remove the \`srcset\` attribute.`);
|
|
6381
|
+
}
|
|
6382
|
+
}
|
|
6383
|
+
/**
|
|
6384
|
+
* Verifies that the `rawSrc` is not a Base64-encoded image.
|
|
6385
|
+
*/
|
|
6386
|
+
function assertNotBase64Image(dir) {
|
|
6387
|
+
let rawSrc = dir.rawSrc.trim();
|
|
6388
|
+
if (rawSrc.startsWith('data:')) {
|
|
6389
|
+
if (rawSrc.length > BASE64_IMG_MAX_LENGTH_IN_ERROR) {
|
|
6390
|
+
rawSrc = rawSrc.substring(0, BASE64_IMG_MAX_LENGTH_IN_ERROR) + '...';
|
|
6391
|
+
}
|
|
6392
|
+
throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.rawSrc, false)} \`rawSrc\` is a Base64-encoded string ` +
|
|
6393
|
+
`(${rawSrc}). NgOptimizedImage does not support Base64-encoded strings. ` +
|
|
6394
|
+
`To fix this, disable the NgOptimizedImage directive for this element ` +
|
|
6395
|
+
`by removing \`rawSrc\` and using a standard \`src\` attribute instead.`);
|
|
6396
|
+
}
|
|
6397
|
+
}
|
|
6398
|
+
/**
|
|
6399
|
+
* Verifies that the `rawSrc` is not a Blob URL.
|
|
6400
|
+
*/
|
|
6401
|
+
function assertNotBlobUrl(dir) {
|
|
6402
|
+
const rawSrc = dir.rawSrc.trim();
|
|
6403
|
+
if (rawSrc.startsWith('blob:')) {
|
|
6404
|
+
throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.rawSrc)} \`rawSrc\` was set to a blob URL (${rawSrc}). ` +
|
|
6405
|
+
`Blob URLs are not supported by the NgOptimizedImage directive. ` +
|
|
6406
|
+
`To fix this, disable the NgOptimizedImage directive for this element ` +
|
|
6407
|
+
`by removing \`rawSrc\` and using a regular \`src\` attribute instead.`);
|
|
6408
|
+
}
|
|
6409
|
+
}
|
|
6410
|
+
/**
|
|
6411
|
+
* Verifies that the input is set to a non-empty string.
|
|
6412
|
+
*/
|
|
6413
|
+
function assertNonEmptyInput(dir, name, value) {
|
|
6414
|
+
const isString = typeof value === 'string';
|
|
6415
|
+
const isEmptyString = isString && value.trim() === '';
|
|
6416
|
+
if (!isString || isEmptyString) {
|
|
6417
|
+
throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.rawSrc)} \`${name}\` has an invalid value ` +
|
|
6418
|
+
`(\`${value}\`). To fix this, change the value to a non-empty string.`);
|
|
6419
|
+
}
|
|
6420
|
+
}
|
|
6421
|
+
/**
|
|
6422
|
+
* Verifies that the `rawSrcset` is in a valid format, e.g. "100w, 200w" or "1x, 2x".
|
|
6423
|
+
*/
|
|
6424
|
+
function assertValidRawSrcset(dir, value) {
|
|
6425
|
+
if (value == null)
|
|
6426
|
+
return;
|
|
6427
|
+
assertNonEmptyInput(dir, 'rawSrcset', value);
|
|
6428
|
+
const stringVal = value;
|
|
6429
|
+
const isValidWidthDescriptor = VALID_WIDTH_DESCRIPTOR_SRCSET.test(stringVal);
|
|
6430
|
+
const isValidDensityDescriptor = VALID_DENSITY_DESCRIPTOR_SRCSET.test(stringVal);
|
|
6431
|
+
if (isValidDensityDescriptor) {
|
|
6432
|
+
assertUnderDensityCap(dir, stringVal);
|
|
6433
|
+
}
|
|
6434
|
+
const isValidSrcset = isValidWidthDescriptor || isValidDensityDescriptor;
|
|
6435
|
+
if (!isValidSrcset) {
|
|
6436
|
+
throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.rawSrc)} \`rawSrcset\` has an invalid value (\`${value}\`). ` +
|
|
6437
|
+
`To fix this, supply \`rawSrcset\` using a comma-separated list of one or more width ` +
|
|
6438
|
+
`descriptors (e.g. "100w, 200w") or density descriptors (e.g. "1x, 2x").`);
|
|
6439
|
+
}
|
|
6440
|
+
}
|
|
6441
|
+
function assertUnderDensityCap(dir, value) {
|
|
6442
|
+
const underDensityCap = value.split(',').every(num => num === '' || parseFloat(num) <= ABSOLUTE_SRCSET_DENSITY_CAP);
|
|
6443
|
+
if (!underDensityCap) {
|
|
6444
|
+
throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.rawSrc)} the \`rawSrcset\` contains an unsupported image density:` +
|
|
6445
|
+
`\`${value}\`. NgOptimizedImage generally recommends a max image density of ` +
|
|
6446
|
+
`${RECOMMENDED_SRCSET_DENSITY_CAP}x but supports image densities up to ` +
|
|
6447
|
+
`${ABSOLUTE_SRCSET_DENSITY_CAP}x. The human eye cannot distinguish between image densities ` +
|
|
6448
|
+
`greater than ${RECOMMENDED_SRCSET_DENSITY_CAP}x - which makes them unnecessary for ` +
|
|
6449
|
+
`most use cases. Images that will be pinch-zoomed are typically the primary use case for ` +
|
|
6450
|
+
`${ABSOLUTE_SRCSET_DENSITY_CAP}x images. Please remove the high density descriptor and try again.`);
|
|
6451
|
+
}
|
|
6452
|
+
}
|
|
6453
|
+
/**
|
|
6454
|
+
* Creates a `RuntimeError` instance to represent a situation when an input is set after
|
|
6455
|
+
* the directive has initialized.
|
|
6456
|
+
*/
|
|
6457
|
+
function postInitInputChangeError(dir, inputName) {
|
|
6458
|
+
return new ɵRuntimeError(2953 /* RuntimeErrorCode.UNEXPECTED_INPUT_CHANGE */, `${imgDirectiveDetails(dir.rawSrc)} \`${inputName}\` was updated after initialization. ` +
|
|
6459
|
+
`The NgOptimizedImage directive will not react to this input change. ` +
|
|
6460
|
+
`To fix this, switch \`${inputName}\` a static value or wrap the image element ` +
|
|
6461
|
+
`in an *ngIf that is gated on the necessary value.`);
|
|
6462
|
+
}
|
|
6463
|
+
/**
|
|
6464
|
+
* Verify that none of the listed inputs has changed.
|
|
6465
|
+
*/
|
|
6466
|
+
function assertNoPostInitInputChange(dir, changes, inputs) {
|
|
6467
|
+
inputs.forEach(input => {
|
|
6468
|
+
const isUpdated = changes.hasOwnProperty(input);
|
|
6469
|
+
if (isUpdated && !changes[input].isFirstChange()) {
|
|
6470
|
+
if (input === 'rawSrc') {
|
|
6471
|
+
// When the `rawSrc` input changes, we detect that only in the
|
|
6472
|
+
// `ngOnChanges` hook, thus the `rawSrc` is already set. We use
|
|
6473
|
+
// `rawSrc` in the error message, so we use a previous value, but
|
|
6474
|
+
// not the updated one in it.
|
|
6475
|
+
dir = { rawSrc: changes[input].previousValue };
|
|
6476
|
+
}
|
|
6477
|
+
throw postInitInputChangeError(dir, input);
|
|
6478
|
+
}
|
|
6479
|
+
});
|
|
6480
|
+
}
|
|
6481
|
+
/**
|
|
6482
|
+
* Verifies that a specified input is a number greater than 0.
|
|
6483
|
+
*/
|
|
6484
|
+
function assertGreaterThanZero(dir, inputValue, inputName) {
|
|
6485
|
+
const validNumber = typeof inputValue === 'number' && inputValue > 0;
|
|
6486
|
+
const validString = typeof inputValue === 'string' && /^\d+$/.test(inputValue.trim()) && parseInt(inputValue) > 0;
|
|
6487
|
+
if (!validNumber && !validString) {
|
|
6488
|
+
throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.rawSrc)} \`${inputName}\` has an invalid value ` +
|
|
6489
|
+
`(\`${inputValue}\`). To fix this, provide \`${inputName}\` ` +
|
|
6490
|
+
`as a number greater than 0.`);
|
|
6491
|
+
}
|
|
6492
|
+
}
|
|
6493
|
+
/**
|
|
6494
|
+
* Verifies that the rendered image is not visually distorted. Effectively this is checking:
|
|
6495
|
+
* - Whether the "width" and "height" attributes reflect the actual dimensions of the image.
|
|
6496
|
+
* - Whether image styling is "correct" (see below for a longer explanation).
|
|
6497
|
+
*/
|
|
6498
|
+
function assertNoImageDistortion(dir, img, renderer) {
|
|
6499
|
+
const removeListenerFn = renderer.listen(img, 'load', () => {
|
|
6500
|
+
removeListenerFn();
|
|
6501
|
+
// TODO: `clientWidth`, `clientHeight`, `naturalWidth` and `naturalHeight`
|
|
6502
|
+
// are typed as number, but we run `parseFloat` (which accepts strings only).
|
|
6503
|
+
// Verify whether `parseFloat` is needed in the cases below.
|
|
6504
|
+
const renderedWidth = parseFloat(img.clientWidth);
|
|
6505
|
+
const renderedHeight = parseFloat(img.clientHeight);
|
|
6506
|
+
const renderedAspectRatio = renderedWidth / renderedHeight;
|
|
6507
|
+
const nonZeroRenderedDimensions = renderedWidth !== 0 && renderedHeight !== 0;
|
|
6508
|
+
const intrinsicWidth = parseFloat(img.naturalWidth);
|
|
6509
|
+
const intrinsicHeight = parseFloat(img.naturalHeight);
|
|
6510
|
+
const intrinsicAspectRatio = intrinsicWidth / intrinsicHeight;
|
|
6511
|
+
const suppliedWidth = dir.width;
|
|
6512
|
+
const suppliedHeight = dir.height;
|
|
6513
|
+
const suppliedAspectRatio = suppliedWidth / suppliedHeight;
|
|
6514
|
+
// Tolerance is used to account for the impact of subpixel rendering.
|
|
6515
|
+
// Due to subpixel rendering, the rendered, intrinsic, and supplied
|
|
6516
|
+
// aspect ratios of a correctly configured image may not exactly match.
|
|
6517
|
+
// For example, a `width=4030 height=3020` image might have a rendered
|
|
6518
|
+
// size of "1062w, 796.48h". (An aspect ratio of 1.334... vs. 1.333...)
|
|
6519
|
+
const inaccurateDimensions = Math.abs(suppliedAspectRatio - intrinsicAspectRatio) > ASPECT_RATIO_TOLERANCE;
|
|
6520
|
+
const stylingDistortion = nonZeroRenderedDimensions &&
|
|
6521
|
+
Math.abs(intrinsicAspectRatio - renderedAspectRatio) > ASPECT_RATIO_TOLERANCE;
|
|
6522
|
+
if (inaccurateDimensions) {
|
|
6523
|
+
console.warn(ɵformatRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.rawSrc)} the aspect ratio of the image does not match ` +
|
|
6524
|
+
`the aspect ratio indicated by the width and height attributes. ` +
|
|
6525
|
+
`Intrinsic image size: ${intrinsicWidth}w x ${intrinsicHeight}h ` +
|
|
6526
|
+
`(aspect-ratio: ${intrinsicAspectRatio}). Supplied width and height attributes: ` +
|
|
6527
|
+
`${suppliedWidth}w x ${suppliedHeight}h (aspect-ratio: ${suppliedAspectRatio}). ` +
|
|
6528
|
+
`To fix this, update the width and height attributes.`));
|
|
6529
|
+
}
|
|
6530
|
+
else if (stylingDistortion) {
|
|
6531
|
+
console.warn(ɵformatRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.rawSrc)} the aspect ratio of the rendered image ` +
|
|
6532
|
+
`does not match the image's intrinsic aspect ratio. ` +
|
|
6533
|
+
`Intrinsic image size: ${intrinsicWidth}w x ${intrinsicHeight}h ` +
|
|
6534
|
+
`(aspect-ratio: ${intrinsicAspectRatio}). Rendered image size: ` +
|
|
6535
|
+
`${renderedWidth}w x ${renderedHeight}h (aspect-ratio: ` +
|
|
6536
|
+
`${renderedAspectRatio}). This issue can occur if "width" and "height" ` +
|
|
6537
|
+
`attributes are added to an image without updating the corresponding ` +
|
|
6538
|
+
`image styling. To fix this, adjust image styling. In most cases, ` +
|
|
6539
|
+
`adding "height: auto" or "width: auto" to the image styling will fix ` +
|
|
6540
|
+
`this issue.`));
|
|
6541
|
+
}
|
|
6542
|
+
else if (!dir.rawSrcset && nonZeroRenderedDimensions) {
|
|
6543
|
+
// If `rawSrcset` hasn't been set, sanity check the intrinsic size.
|
|
6544
|
+
const recommendedWidth = RECOMMENDED_SRCSET_DENSITY_CAP * renderedWidth;
|
|
6545
|
+
const recommendedHeight = RECOMMENDED_SRCSET_DENSITY_CAP * renderedHeight;
|
|
6546
|
+
const oversizedWidth = (intrinsicWidth - recommendedWidth) >= OVERSIZED_IMAGE_TOLERANCE;
|
|
6547
|
+
const oversizedHeight = (intrinsicHeight - recommendedHeight) >= OVERSIZED_IMAGE_TOLERANCE;
|
|
6548
|
+
if (oversizedWidth || oversizedHeight) {
|
|
6549
|
+
console.warn(ɵformatRuntimeError(2960 /* RuntimeErrorCode.OVERSIZED_IMAGE */, `${imgDirectiveDetails(dir.rawSrc)} the intrinsic image is significantly ` +
|
|
6550
|
+
`larger than necessary. ` +
|
|
6551
|
+
`\nRendered image size: ${renderedWidth}w x ${renderedHeight}h. ` +
|
|
6552
|
+
`\nIntrinsic image size: ${intrinsicWidth}w x ${intrinsicHeight}h. ` +
|
|
6553
|
+
`\nRecommended intrinsic image size: ${recommendedWidth}w x ${recommendedHeight}h. ` +
|
|
6554
|
+
`\nNote: Recommended intrinsic image size is calculated assuming a maximum DPR of ` +
|
|
6555
|
+
`${RECOMMENDED_SRCSET_DENSITY_CAP}. To improve loading time, resize the image ` +
|
|
6556
|
+
`or consider using the "rawSrcset" and "sizes" attributes.`));
|
|
6557
|
+
}
|
|
6558
|
+
}
|
|
6559
|
+
});
|
|
6560
|
+
}
|
|
6561
|
+
/**
|
|
6562
|
+
* Verifies that a specified input is set.
|
|
6563
|
+
*/
|
|
6564
|
+
function assertNonEmptyWidthAndHeight(dir) {
|
|
6565
|
+
let missingAttributes = [];
|
|
6566
|
+
if (dir.width === undefined)
|
|
6567
|
+
missingAttributes.push('width');
|
|
6568
|
+
if (dir.height === undefined)
|
|
6569
|
+
missingAttributes.push('height');
|
|
6570
|
+
if (missingAttributes.length > 0) {
|
|
6571
|
+
throw new ɵRuntimeError(2954 /* RuntimeErrorCode.REQUIRED_INPUT_MISSING */, `${imgDirectiveDetails(dir.rawSrc)} these required attributes ` +
|
|
6572
|
+
`are missing: ${missingAttributes.map(attr => `"${attr}"`).join(', ')}. ` +
|
|
6573
|
+
`Including "width" and "height" attributes will prevent image-related layout shifts. ` +
|
|
6574
|
+
`To fix this, include "width" and "height" attributes on the image tag.`);
|
|
6575
|
+
}
|
|
6576
|
+
}
|
|
6577
|
+
/**
|
|
6578
|
+
* Verifies that the `loading` attribute is set to a valid input &
|
|
6579
|
+
* is not used on priority images.
|
|
6580
|
+
*/
|
|
6581
|
+
function assertValidLoadingInput(dir) {
|
|
6582
|
+
if (dir.loading && dir.priority) {
|
|
6583
|
+
throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.rawSrc)} the \`loading\` attribute ` +
|
|
6584
|
+
`was used on an image that was marked "priority". ` +
|
|
6585
|
+
`Setting \`loading\` on priority images is not allowed ` +
|
|
6586
|
+
`because these images will always be eagerly loaded. ` +
|
|
6587
|
+
`To fix this, remove the “loading” attribute from the priority image.`);
|
|
6588
|
+
}
|
|
6589
|
+
const validInputs = ['auto', 'eager', 'lazy'];
|
|
6590
|
+
if (typeof dir.loading === 'string' && !validInputs.includes(dir.loading)) {
|
|
6591
|
+
throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.rawSrc)} the \`loading\` attribute ` +
|
|
6592
|
+
`has an invalid value (\`${dir.loading}\`). ` +
|
|
6593
|
+
`To fix this, provide a valid value ("lazy", "eager", or "auto").`);
|
|
6594
|
+
}
|
|
6595
|
+
}
|
|
6596
|
+
|
|
6597
|
+
/**
|
|
6598
|
+
* @license
|
|
6599
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6600
|
+
*
|
|
6601
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6602
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6603
|
+
*/
|
|
6604
|
+
|
|
5528
6605
|
/**
|
|
5529
6606
|
* @license
|
|
5530
6607
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -5554,5 +6631,5 @@ class XhrFactory {
|
|
|
5554
6631
|
* Generated bundle index. Do not edit.
|
|
5555
6632
|
*/
|
|
5556
6633
|
|
|
5557
|
-
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 };
|
|
6634
|
+
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 };
|
|
5558
6635
|
//# sourceMappingURL=common.mjs.map
|