@angular/common 13.3.12 → 13.4.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/common.d.ts +385 -1
- package/esm2020/http/src/client.mjs +3 -3
- package/esm2020/http/src/interceptor.mjs +3 -3
- package/esm2020/http/src/jsonp.mjs +6 -6
- package/esm2020/http/src/module.mjs +15 -15
- package/esm2020/http/src/xhr.mjs +3 -3
- package/esm2020/http/src/xsrf.mjs +6 -6
- 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/index.mjs +3 -2
- 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 +31 -0
- package/esm2020/src/directives/ng_optimized_image/image_loaders/cloudinary_loader.mjs +53 -0
- package/esm2020/src/directives/ng_optimized_image/image_loaders/image_loader.mjs +74 -0
- package/esm2020/src/directives/ng_optimized_image/image_loaders/imagekit_loader.mjs +44 -0
- package/esm2020/src/directives/ng_optimized_image/image_loaders/imgix_loader.mjs +43 -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 +864 -0
- package/esm2020/src/directives/ng_optimized_image/preconnect_link_checker.mjs +136 -0
- package/esm2020/src/directives/ng_optimized_image/preload-link-creator.mjs +75 -0
- package/esm2020/src/directives/ng_optimized_image/tokens.mjs +24 -0
- package/esm2020/src/directives/ng_optimized_image/url.mjs +42 -0
- package/esm2020/src/directives/ng_plural.mjs +6 -6
- package/esm2020/src/directives/ng_style.mjs +3 -3
- package/esm2020/src/directives/ng_switch.mjs +9 -9
- 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 +3 -3
- 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 +1639 -144
- package/fesm2015/common.mjs.map +1 -1
- package/fesm2015/http/testing.mjs +8 -8
- package/fesm2015/http.mjs +37 -37
- package/fesm2015/testing.mjs +10 -10
- package/fesm2015/upgrade.mjs +5 -5
- package/fesm2020/common.mjs +1634 -144
- package/fesm2020/common.mjs.map +1 -1
- package/fesm2020/http/testing.mjs +8 -8
- package/fesm2020/http.mjs +37 -37
- package/fesm2020/testing.mjs +10 -10
- package/fesm2020/upgrade.mjs +5 -5
- package/http/http.d.ts +1 -1
- package/http/testing/testing.d.ts +1 -1
- package/package.json +2 -2
- package/testing/testing.d.ts +1 -1
- package/upgrade/upgrade.d.ts +1 -1
package/common.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v13.
|
|
2
|
+
* @license Angular v13.4.0
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -17,7 +17,9 @@ import { NgModuleFactory } from '@angular/core';
|
|
|
17
17
|
import { Observable } from 'rxjs';
|
|
18
18
|
import { OnChanges } from '@angular/core';
|
|
19
19
|
import { OnDestroy } from '@angular/core';
|
|
20
|
+
import { OnInit } from '@angular/core';
|
|
20
21
|
import { PipeTransform } from '@angular/core';
|
|
22
|
+
import { Provider } from '@angular/core';
|
|
21
23
|
import { Renderer2 } from '@angular/core';
|
|
22
24
|
import { SimpleChanges } from '@angular/core';
|
|
23
25
|
import { Subscribable } from 'rxjs';
|
|
@@ -1095,6 +1097,68 @@ declare namespace i9 {
|
|
|
1095
1097
|
}
|
|
1096
1098
|
}
|
|
1097
1099
|
|
|
1100
|
+
/**
|
|
1101
|
+
* Injection token that configures the image optimized image functionality.
|
|
1102
|
+
*
|
|
1103
|
+
* @see `NgOptimizedImage`
|
|
1104
|
+
* @publicApi
|
|
1105
|
+
*/
|
|
1106
|
+
export declare const IMAGE_CONFIG: InjectionToken<ImageConfig>;
|
|
1107
|
+
|
|
1108
|
+
/**
|
|
1109
|
+
* Injection token that configures the image loader function.
|
|
1110
|
+
*
|
|
1111
|
+
* @see `ImageLoader`
|
|
1112
|
+
* @see `NgOptimizedImage`
|
|
1113
|
+
* @publicApi
|
|
1114
|
+
*/
|
|
1115
|
+
export declare const IMAGE_LOADER: InjectionToken<ImageLoader>;
|
|
1116
|
+
|
|
1117
|
+
/**
|
|
1118
|
+
* A configuration object for the NgOptimizedImage directive. Contains:
|
|
1119
|
+
* - breakpoints: An array of integer breakpoints used to generate
|
|
1120
|
+
* srcsets for responsive images.
|
|
1121
|
+
*
|
|
1122
|
+
* Learn more about the responsive image configuration in [the NgOptimizedImage
|
|
1123
|
+
* guide](guide/image-directive).
|
|
1124
|
+
* @publicApi
|
|
1125
|
+
*/
|
|
1126
|
+
export declare type ImageConfig = {
|
|
1127
|
+
breakpoints?: number[];
|
|
1128
|
+
};
|
|
1129
|
+
|
|
1130
|
+
/**
|
|
1131
|
+
* Represents an image loader function. Image loader functions are used by the
|
|
1132
|
+
* NgOptimizedImage directive to produce full image URL based on the image name and its width.
|
|
1133
|
+
*
|
|
1134
|
+
* @publicApi
|
|
1135
|
+
*/
|
|
1136
|
+
export declare type ImageLoader = (config: ImageLoaderConfig) => string;
|
|
1137
|
+
|
|
1138
|
+
/**
|
|
1139
|
+
* Config options recognized by the image loader function.
|
|
1140
|
+
*
|
|
1141
|
+
* @see `ImageLoader`
|
|
1142
|
+
* @see `NgOptimizedImage`
|
|
1143
|
+
* @publicApi
|
|
1144
|
+
*/
|
|
1145
|
+
export declare interface ImageLoaderConfig {
|
|
1146
|
+
/**
|
|
1147
|
+
* Image file name to be added to the image request URL.
|
|
1148
|
+
*/
|
|
1149
|
+
src: string;
|
|
1150
|
+
/**
|
|
1151
|
+
* Width of the requested image (to be used when generating srcset).
|
|
1152
|
+
*/
|
|
1153
|
+
width?: number;
|
|
1154
|
+
/**
|
|
1155
|
+
* Additional user-provided parameters for use by the ImageLoader.
|
|
1156
|
+
*/
|
|
1157
|
+
loaderParams?: {
|
|
1158
|
+
[key: string]: any;
|
|
1159
|
+
};
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1098
1162
|
/**
|
|
1099
1163
|
* Returns whether a platform id represents a browser platform.
|
|
1100
1164
|
* @publicApi
|
|
@@ -1955,6 +2019,222 @@ export declare abstract class NgLocalization {
|
|
|
1955
2019
|
static ɵprov: i0.ɵɵInjectableDeclaration<NgLocalization>;
|
|
1956
2020
|
}
|
|
1957
2021
|
|
|
2022
|
+
/**
|
|
2023
|
+
* @ngModule NgOptimizedImageModule
|
|
2024
|
+
*
|
|
2025
|
+
* @description
|
|
2026
|
+
*
|
|
2027
|
+
* Directive that improves image loading performance by enforcing best practices.
|
|
2028
|
+
*
|
|
2029
|
+
* `NgOptimizedImage` ensures that the loading of the Largest Contentful Paint (LCP) image is
|
|
2030
|
+
* prioritized by:
|
|
2031
|
+
* - Automatically setting the `fetchpriority` attribute on the `<img>` tag
|
|
2032
|
+
* - Lazy loading non-priority images by default
|
|
2033
|
+
* - Asserting that there is a corresponding preconnect link tag in the document head
|
|
2034
|
+
*
|
|
2035
|
+
* In addition, the directive:
|
|
2036
|
+
* - Generates appropriate asset URLs if a corresponding `ImageLoader` function is provided
|
|
2037
|
+
* - Automatically generates a srcset
|
|
2038
|
+
* - Requires that `width` and `height` are set
|
|
2039
|
+
* - Warns if `width` or `height` have been set incorrectly
|
|
2040
|
+
* - Warns if the image will be visually distorted when rendered
|
|
2041
|
+
*
|
|
2042
|
+
* @usageNotes
|
|
2043
|
+
*
|
|
2044
|
+
* Follow the steps below to enable and use the directive:
|
|
2045
|
+
* 1. Import it into the necessary NgModule Component.
|
|
2046
|
+
* 2. Optionally provide an `ImageLoader` if you use an image hosting service.
|
|
2047
|
+
* 3. Update the necessary `<img>` tags in templates and replace `src` attributes with `ngSrc`.
|
|
2048
|
+
* Using a `ngSrc` allows the directive to control when the `src` gets set, which triggers an image
|
|
2049
|
+
* download.
|
|
2050
|
+
*
|
|
2051
|
+
* Step 1: import the `NgOptimizedImage` directive.
|
|
2052
|
+
*
|
|
2053
|
+
* ```typescript
|
|
2054
|
+
* import { NgOptimizedImageModule } from '@angular/common';
|
|
2055
|
+
*
|
|
2056
|
+
* // Include it into the necessary NgModule
|
|
2057
|
+
* @NgModule({
|
|
2058
|
+
* imports: [NgOptimizedImageModule],
|
|
2059
|
+
* })
|
|
2060
|
+
* class AppModule {}
|
|
2061
|
+
*
|
|
2062
|
+
*
|
|
2063
|
+
* Step 2: configure a loader.
|
|
2064
|
+
*
|
|
2065
|
+
* To use the **default loader**: no additional code changes are necessary. The URL returned by the
|
|
2066
|
+
* generic loader will always match the value of "src". In other words, this loader applies no
|
|
2067
|
+
* transformations to the resource URL and the value of the `ngSrc` attribute will be used as is.
|
|
2068
|
+
*
|
|
2069
|
+
* To use an existing loader for a **third-party image service**: add the provider factory for your
|
|
2070
|
+
* chosen service to the `providers` array. In the example below, the Imgix loader is used:
|
|
2071
|
+
*
|
|
2072
|
+
* ```typescript
|
|
2073
|
+
* import {provideImgixLoader} from '@angular/common';
|
|
2074
|
+
*
|
|
2075
|
+
* // Call the function and add the result to the `providers` array:
|
|
2076
|
+
* providers: [
|
|
2077
|
+
* provideImgixLoader("https://my.base.url/"),
|
|
2078
|
+
* ],
|
|
2079
|
+
* ```
|
|
2080
|
+
*
|
|
2081
|
+
* The `NgOptimizedImage` directive provides the following functions:
|
|
2082
|
+
* - `provideCloudflareLoader`
|
|
2083
|
+
* - `provideCloudinaryLoader`
|
|
2084
|
+
* - `provideImageKitLoader`
|
|
2085
|
+
* - `provideImgixLoader`
|
|
2086
|
+
*
|
|
2087
|
+
* If you use a different image provider, you can create a custom loader function as described
|
|
2088
|
+
* below.
|
|
2089
|
+
*
|
|
2090
|
+
* To use a **custom loader**: provide your loader function as a value for the `IMAGE_LOADER` DI
|
|
2091
|
+
* token.
|
|
2092
|
+
*
|
|
2093
|
+
* ```typescript
|
|
2094
|
+
* import {IMAGE_LOADER, ImageLoaderConfig} from '@angular/common';
|
|
2095
|
+
*
|
|
2096
|
+
* // Configure the loader using the `IMAGE_LOADER` token.
|
|
2097
|
+
* providers: [
|
|
2098
|
+
* {
|
|
2099
|
+
* provide: IMAGE_LOADER,
|
|
2100
|
+
* useValue: (config: ImageLoaderConfig) => {
|
|
2101
|
+
* return `https://example.com/${config.src}-${config.width}.jpg}`;
|
|
2102
|
+
* }
|
|
2103
|
+
* },
|
|
2104
|
+
* ],
|
|
2105
|
+
* ```
|
|
2106
|
+
*
|
|
2107
|
+
* Step 3: update `<img>` tags in templates to use `ngSrc` instead of `src`.
|
|
2108
|
+
*
|
|
2109
|
+
* ```
|
|
2110
|
+
* <img ngSrc="logo.png" width="200" height="100">
|
|
2111
|
+
* ```
|
|
2112
|
+
*
|
|
2113
|
+
* @publicApi
|
|
2114
|
+
*/
|
|
2115
|
+
export declare class NgOptimizedImage implements OnInit, OnChanges, OnDestroy {
|
|
2116
|
+
private imageLoader;
|
|
2117
|
+
private config;
|
|
2118
|
+
private renderer;
|
|
2119
|
+
private elementRef;
|
|
2120
|
+
private injector;
|
|
2121
|
+
private platformId;
|
|
2122
|
+
private preloadLinkChecker;
|
|
2123
|
+
/**
|
|
2124
|
+
* Calculate the rewritten `src` once and store it.
|
|
2125
|
+
* This is needed to avoid repetitive calculations and make sure the directive cleanup in the
|
|
2126
|
+
* `ngOnDestroy` does not rely on the `IMAGE_LOADER` logic (which in turn can rely on some other
|
|
2127
|
+
* instance that might be already destroyed).
|
|
2128
|
+
*/
|
|
2129
|
+
private _renderedSrc;
|
|
2130
|
+
/**
|
|
2131
|
+
* Name of the source image.
|
|
2132
|
+
* Image name will be processed by the image loader and the final URL will be applied as the `src`
|
|
2133
|
+
* property of the image.
|
|
2134
|
+
*/
|
|
2135
|
+
ngSrc: string;
|
|
2136
|
+
/**
|
|
2137
|
+
* A comma separated list of width or density descriptors.
|
|
2138
|
+
* The image name will be taken from `ngSrc` and combined with the list of width or density
|
|
2139
|
+
* descriptors to generate the final `srcset` property of the image.
|
|
2140
|
+
*
|
|
2141
|
+
* Example:
|
|
2142
|
+
* ```
|
|
2143
|
+
* <img ngSrc="hello.jpg" ngSrcset="100w, 200w" /> =>
|
|
2144
|
+
* <img src="path/hello.jpg" srcset="path/hello.jpg?w=100 100w, path/hello.jpg?w=200 200w" />
|
|
2145
|
+
* ```
|
|
2146
|
+
*/
|
|
2147
|
+
ngSrcset: string;
|
|
2148
|
+
/**
|
|
2149
|
+
* The base `sizes` attribute passed through to the `<img>` element.
|
|
2150
|
+
* Providing sizes causes the image to create an automatic responsive srcset.
|
|
2151
|
+
*/
|
|
2152
|
+
sizes?: string;
|
|
2153
|
+
/**
|
|
2154
|
+
* For responsive images: the intrinsic width of the image in pixels.
|
|
2155
|
+
* For fixed size images: the desired rendered width of the image in pixels.
|
|
2156
|
+
*/
|
|
2157
|
+
set width(value: string | number | undefined);
|
|
2158
|
+
get width(): number | undefined;
|
|
2159
|
+
private _width?;
|
|
2160
|
+
/**
|
|
2161
|
+
* For responsive images: the intrinsic height of the image in pixels.
|
|
2162
|
+
* For fixed size images: the desired rendered height of the image in pixels.* The intrinsic
|
|
2163
|
+
* height of the image in pixels.
|
|
2164
|
+
*/
|
|
2165
|
+
set height(value: string | number | undefined);
|
|
2166
|
+
get height(): number | undefined;
|
|
2167
|
+
private _height?;
|
|
2168
|
+
/**
|
|
2169
|
+
* The desired loading behavior (lazy, eager, or auto).
|
|
2170
|
+
*
|
|
2171
|
+
* Setting images as loading='eager' or loading='auto' marks them
|
|
2172
|
+
* as non-priority images. Avoid changing this input for priority images.
|
|
2173
|
+
*/
|
|
2174
|
+
loading?: 'lazy' | 'eager' | 'auto';
|
|
2175
|
+
/**
|
|
2176
|
+
* Indicates whether this image should have a high priority.
|
|
2177
|
+
*/
|
|
2178
|
+
set priority(value: string | boolean | undefined);
|
|
2179
|
+
get priority(): boolean;
|
|
2180
|
+
private _priority;
|
|
2181
|
+
/**
|
|
2182
|
+
* Data to pass through to custom loaders.
|
|
2183
|
+
*/
|
|
2184
|
+
loaderParams?: {
|
|
2185
|
+
[key: string]: any;
|
|
2186
|
+
};
|
|
2187
|
+
/**
|
|
2188
|
+
* Disables automatic srcset generation for this image.
|
|
2189
|
+
*/
|
|
2190
|
+
set disableOptimizedSrcset(value: string | boolean | undefined);
|
|
2191
|
+
get disableOptimizedSrcset(): boolean;
|
|
2192
|
+
private _disableOptimizedSrcset;
|
|
2193
|
+
/**
|
|
2194
|
+
* Sets the image to "fill mode", which eliminates the height/width requirement and adds
|
|
2195
|
+
* styles such that the image fills its containing element.
|
|
2196
|
+
*/
|
|
2197
|
+
set fill(value: string | boolean | undefined);
|
|
2198
|
+
get fill(): boolean;
|
|
2199
|
+
private _fill;
|
|
2200
|
+
private lcpObserver;
|
|
2201
|
+
private imgElement;
|
|
2202
|
+
constructor(imageLoader: ImageLoader, config: ImageConfig, renderer: Renderer2, elementRef: ElementRef, injector: Injector, platformId: string, preloadLinkChecker: PreloadLinkCreator);
|
|
2203
|
+
/** @nodoc */
|
|
2204
|
+
ngOnInit(): void;
|
|
2205
|
+
private setHostAttributes;
|
|
2206
|
+
/** @nodoc */
|
|
2207
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
2208
|
+
private callImageLoader;
|
|
2209
|
+
private getLoadingBehavior;
|
|
2210
|
+
private getFetchPriority;
|
|
2211
|
+
private getRewrittenSrc;
|
|
2212
|
+
private getRewrittenSrcset;
|
|
2213
|
+
private getAutomaticSrcset;
|
|
2214
|
+
private getResponsiveSrcset;
|
|
2215
|
+
private getFixedSrcset;
|
|
2216
|
+
private shouldGenerateAutomaticSrcset;
|
|
2217
|
+
/** @nodoc */
|
|
2218
|
+
ngOnDestroy(): void;
|
|
2219
|
+
private setHostAttribute;
|
|
2220
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgOptimizedImage, never>;
|
|
2221
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgOptimizedImage, "img[ngSrc]", never, { "ngSrc": "ngSrc"; "ngSrcset": "ngSrcset"; "sizes": "sizes"; "width": "width"; "height": "height"; "loading": "loading"; "priority": "priority"; "loaderParams": "loaderParams"; "disableOptimizedSrcset": "disableOptimizedSrcset"; "fill": "fill"; "src": "src"; "srcset": "srcset"; }, {}, never>;
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
/**
|
|
2225
|
+
* This NgModule exports the `NgOptimizedImage` directive.
|
|
2226
|
+
* Import this module to enable the optimized image directive in your application.
|
|
2227
|
+
*
|
|
2228
|
+
* @publicApi
|
|
2229
|
+
* @deprecated In Angular v15, this NgModule is removed in favor of the NgOptimizedImage directive,
|
|
2230
|
+
* which is annotated as standalone.
|
|
2231
|
+
*/
|
|
2232
|
+
export declare class NgOptimizedImageModule {
|
|
2233
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgOptimizedImageModule, never>;
|
|
2234
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<NgOptimizedImageModule, [typeof NgOptimizedImage], never, [typeof NgOptimizedImage]>;
|
|
2235
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<NgOptimizedImageModule>;
|
|
2236
|
+
}
|
|
2237
|
+
|
|
1958
2238
|
/**
|
|
1959
2239
|
* @ngModule CommonModule
|
|
1960
2240
|
*
|
|
@@ -2531,6 +2811,110 @@ declare interface PopStateEvent_2 {
|
|
|
2531
2811
|
}
|
|
2532
2812
|
export { PopStateEvent_2 as PopStateEvent }
|
|
2533
2813
|
|
|
2814
|
+
/**
|
|
2815
|
+
* Injection token to configure which origins should be excluded
|
|
2816
|
+
* from the preconnect checks. It can either be a single string or an array of strings
|
|
2817
|
+
* to represent a group of origins, for example:
|
|
2818
|
+
*
|
|
2819
|
+
* ```typescript
|
|
2820
|
+
* {provide: PRECONNECT_CHECK_BLOCKLIST, useValue: 'https://your-domain.com'}
|
|
2821
|
+
* ```
|
|
2822
|
+
*
|
|
2823
|
+
* or:
|
|
2824
|
+
*
|
|
2825
|
+
* ```typescript
|
|
2826
|
+
* {provide: PRECONNECT_CHECK_BLOCKLIST,
|
|
2827
|
+
* useValue: ['https://your-domain-1.com', 'https://your-domain-2.com']}
|
|
2828
|
+
* ```
|
|
2829
|
+
*
|
|
2830
|
+
* @publicApi
|
|
2831
|
+
*/
|
|
2832
|
+
export declare const PRECONNECT_CHECK_BLOCKLIST: InjectionToken<(string | string[])[]>;
|
|
2833
|
+
|
|
2834
|
+
/**
|
|
2835
|
+
* @description Contains the logic needed to track and add preload link tags to the `<head>` tag. It
|
|
2836
|
+
* will also track what images have already had preload link tags added so as to not duplicate link
|
|
2837
|
+
* tags.
|
|
2838
|
+
*
|
|
2839
|
+
* In dev mode this service will validate that the number of preloaded images does not exceed the
|
|
2840
|
+
* configured default preloaded images limit: {@link DEFAULT_PRELOADED_IMAGES_LIMIT}.
|
|
2841
|
+
*/
|
|
2842
|
+
declare class PreloadLinkCreator {
|
|
2843
|
+
private readonly preloadedImages;
|
|
2844
|
+
private readonly document;
|
|
2845
|
+
constructor();
|
|
2846
|
+
/**
|
|
2847
|
+
* @description Add a preload `<link>` to the `<head>` of the `index.html` that is served from the
|
|
2848
|
+
* server while using Angular Universal and SSR to kick off image loads for high priority images.
|
|
2849
|
+
*
|
|
2850
|
+
* The `sizes` (passed in from the user) and `srcset` (parsed and formatted from `ngSrcset`)
|
|
2851
|
+
* properties used to set the corresponding attributes, `imagesizes` and `imagesrcset`
|
|
2852
|
+
* respectively, on the preload `<link>` tag so that the correctly sized image is preloaded from
|
|
2853
|
+
* the CDN.
|
|
2854
|
+
*
|
|
2855
|
+
* {@link https://web.dev/preload-responsive-images/#imagesrcset-and-imagesizes}
|
|
2856
|
+
*
|
|
2857
|
+
* @param renderer The `Renderer2` passed in from the directive
|
|
2858
|
+
* @param src The original src of the image that is set on the `ngSrc` input.
|
|
2859
|
+
* @param srcset The parsed and formatted srcset created from the `ngSrcset` input
|
|
2860
|
+
* @param sizes The value of the `sizes` attribute passed in to the `<img>` tag
|
|
2861
|
+
*/
|
|
2862
|
+
createPreloadLinkTag(renderer: Renderer2, src: string, srcset?: string, sizes?: string): void;
|
|
2863
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PreloadLinkCreator, never>;
|
|
2864
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<PreloadLinkCreator>;
|
|
2865
|
+
}
|
|
2866
|
+
|
|
2867
|
+
/**
|
|
2868
|
+
* Function that generates an ImageLoader for [Cloudflare Image
|
|
2869
|
+
* Resizing](https://developers.cloudflare.com/images/image-resizing/) and turns it into an Angular
|
|
2870
|
+
* provider. Note: Cloudflare has multiple image products - this provider is specifically for
|
|
2871
|
+
* Cloudflare Image Resizing; it will not work with Cloudflare Images or Cloudflare Polish.
|
|
2872
|
+
*
|
|
2873
|
+
* @param path Your domain name, e.g. https://mysite.com
|
|
2874
|
+
* @returns Provider that provides an ImageLoader function
|
|
2875
|
+
*
|
|
2876
|
+
* @publicApi
|
|
2877
|
+
*/
|
|
2878
|
+
export declare const provideCloudflareLoader: (path: string) => Provider[];
|
|
2879
|
+
|
|
2880
|
+
/**
|
|
2881
|
+
* Function that generates an ImageLoader for Cloudinary and turns it into an Angular provider.
|
|
2882
|
+
*
|
|
2883
|
+
* @param path Base URL of your Cloudinary images
|
|
2884
|
+
* This URL should match one of the following formats:
|
|
2885
|
+
* https://res.cloudinary.com/mysite
|
|
2886
|
+
* https://mysite.cloudinary.com
|
|
2887
|
+
* https://subdomain.mysite.com
|
|
2888
|
+
* @returns Set of providers to configure the Cloudinary loader.
|
|
2889
|
+
*
|
|
2890
|
+
* @publicApi
|
|
2891
|
+
*/
|
|
2892
|
+
export declare const provideCloudinaryLoader: (path: string) => Provider[];
|
|
2893
|
+
|
|
2894
|
+
/**
|
|
2895
|
+
* Function that generates an ImageLoader for ImageKit and turns it into an Angular provider.
|
|
2896
|
+
*
|
|
2897
|
+
* @param path Base URL of your ImageKit images
|
|
2898
|
+
* This URL should match one of the following formats:
|
|
2899
|
+
* https://ik.imagekit.io/myaccount
|
|
2900
|
+
* https://subdomain.mysite.com
|
|
2901
|
+
* @returns Set of providers to configure the ImageKit loader.
|
|
2902
|
+
*
|
|
2903
|
+
* @publicApi
|
|
2904
|
+
*/
|
|
2905
|
+
export declare const provideImageKitLoader: (path: string) => Provider[];
|
|
2906
|
+
|
|
2907
|
+
/**
|
|
2908
|
+
* Function that generates an ImageLoader for Imgix and turns it into an Angular provider.
|
|
2909
|
+
*
|
|
2910
|
+
* @param path path to the desired Imgix origin,
|
|
2911
|
+
* e.g. https://somepath.imgix.net or https://images.mysite.com
|
|
2912
|
+
* @returns Set of providers to configure the Imgix loader.
|
|
2913
|
+
*
|
|
2914
|
+
* @publicApi
|
|
2915
|
+
*/
|
|
2916
|
+
export declare const provideImgixLoader: (path: string) => Provider[];
|
|
2917
|
+
|
|
2534
2918
|
|
|
2535
2919
|
/**
|
|
2536
2920
|
* Register global data to be used internally by Angular. See the
|