@angular/common 15.0.0-next.5 → 15.0.0-rc.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.
Files changed (81) hide show
  1. package/esm2020/http/public_api.mjs +6 -3
  2. package/esm2020/http/src/backend.mjs +1 -1
  3. package/esm2020/http/src/client.mjs +3 -3
  4. package/esm2020/http/src/interceptor.mjs +65 -20
  5. package/esm2020/http/src/jsonp.mjs +38 -18
  6. package/esm2020/http/src/module.mjs +40 -116
  7. package/esm2020/http/src/provider.mjs +129 -0
  8. package/esm2020/http/src/xhr.mjs +3 -3
  9. package/esm2020/http/src/xsrf.mjs +42 -33
  10. package/esm2020/http/testing/public_api.mjs +2 -1
  11. package/esm2020/http/testing/src/backend.mjs +3 -3
  12. package/esm2020/http/testing/src/module.mjs +9 -14
  13. package/esm2020/http/testing/src/provider.mjs +18 -0
  14. package/esm2020/src/common.mjs +2 -2
  15. package/esm2020/src/common_module.mjs +4 -4
  16. package/esm2020/src/directives/ng_class.mjs +3 -3
  17. package/esm2020/src/directives/ng_component_outlet.mjs +3 -3
  18. package/esm2020/src/directives/ng_for_of.mjs +3 -3
  19. package/esm2020/src/directives/ng_if.mjs +3 -3
  20. package/esm2020/src/directives/ng_optimized_image/image_loaders/cloudflare_loader.mjs +1 -2
  21. package/esm2020/src/directives/ng_optimized_image/image_loaders/cloudinary_loader.mjs +15 -2
  22. package/esm2020/src/directives/ng_optimized_image/image_loaders/image_loader.mjs +2 -3
  23. package/esm2020/src/directives/ng_optimized_image/image_loaders/imagekit_loader.mjs +15 -2
  24. package/esm2020/src/directives/ng_optimized_image/image_loaders/imgix_loader.mjs +15 -2
  25. package/esm2020/src/directives/ng_optimized_image/lcp_image_observer.mjs +3 -3
  26. package/esm2020/src/directives/ng_optimized_image/ng_optimized_image.mjs +206 -39
  27. package/esm2020/src/directives/ng_optimized_image/preconnect_link_checker.mjs +4 -5
  28. package/esm2020/src/directives/ng_optimized_image/preload-link-creator.mjs +74 -0
  29. package/esm2020/src/directives/ng_optimized_image/tokens.mjs +24 -0
  30. package/esm2020/src/directives/ng_plural.mjs +6 -6
  31. package/esm2020/src/directives/ng_style.mjs +3 -3
  32. package/esm2020/src/directives/ng_switch.mjs +9 -9
  33. package/esm2020/src/directives/ng_template_outlet.mjs +3 -3
  34. package/esm2020/src/errors.mjs +1 -1
  35. package/esm2020/src/i18n/localization.mjs +6 -6
  36. package/esm2020/src/location/hash_location_strategy.mjs +3 -3
  37. package/esm2020/src/location/location.mjs +3 -3
  38. package/esm2020/src/location/location_strategy.mjs +6 -6
  39. package/esm2020/src/location/platform_location.mjs +6 -6
  40. package/esm2020/src/pipes/async_pipe.mjs +3 -3
  41. package/esm2020/src/pipes/case_conversion_pipes.mjs +9 -9
  42. package/esm2020/src/pipes/date_pipe.mjs +50 -7
  43. package/esm2020/src/pipes/date_pipe_config.mjs +13 -0
  44. package/esm2020/src/pipes/i18n_plural_pipe.mjs +3 -3
  45. package/esm2020/src/pipes/i18n_select_pipe.mjs +3 -3
  46. package/esm2020/src/pipes/index.mjs +3 -3
  47. package/esm2020/src/pipes/json_pipe.mjs +3 -3
  48. package/esm2020/src/pipes/keyvalue_pipe.mjs +3 -3
  49. package/esm2020/src/pipes/number_pipe.mjs +9 -9
  50. package/esm2020/src/pipes/slice_pipe.mjs +3 -3
  51. package/esm2020/src/version.mjs +1 -1
  52. package/esm2020/testing/src/location_mock.mjs +3 -3
  53. package/esm2020/testing/src/mock_location_strategy.mjs +3 -3
  54. package/esm2020/testing/src/mock_platform_location.mjs +3 -3
  55. package/esm2020/testing/src/provide_location_mocks.mjs +23 -0
  56. package/esm2020/testing/src/testing.mjs +2 -1
  57. package/esm2020/upgrade/src/location_upgrade_module.mjs +4 -4
  58. package/fesm2015/common.mjs +503 -156
  59. package/fesm2015/common.mjs.map +1 -1
  60. package/fesm2015/http/testing.mjs +27 -16
  61. package/fesm2015/http/testing.mjs.map +1 -1
  62. package/fesm2015/http.mjs +295 -174
  63. package/fesm2015/http.mjs.map +1 -1
  64. package/fesm2015/testing.mjs +32 -12
  65. package/fesm2015/testing.mjs.map +1 -1
  66. package/fesm2015/upgrade.mjs +5 -5
  67. package/fesm2020/common.mjs +501 -155
  68. package/fesm2020/common.mjs.map +1 -1
  69. package/fesm2020/http/testing.mjs +27 -16
  70. package/fesm2020/http/testing.mjs.map +1 -1
  71. package/fesm2020/http.mjs +294 -172
  72. package/fesm2020/http.mjs.map +1 -1
  73. package/fesm2020/testing.mjs +32 -12
  74. package/fesm2020/testing.mjs.map +1 -1
  75. package/fesm2020/upgrade.mjs +5 -5
  76. package/http/index.d.ts +88 -30
  77. package/http/testing/index.d.ts +4 -1
  78. package/index.d.ts +99 -29
  79. package/package.json +3 -3
  80. package/testing/index.d.ts +10 -1
  81. package/upgrade/index.d.ts +1 -1
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.0.0-next.5
2
+ * @license Angular v15.0.0-rc.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -168,9 +168,44 @@ export declare class CurrencyPipe implements PipeTransform {
168
168
  static ɵpipe: i0.ɵɵPipeDeclaration<CurrencyPipe, "currency", true>;
169
169
  }
170
170
 
171
+ /**
172
+ * DI token that allows to provide default configuration for the `DatePipe` instances in an
173
+ * application. The value is an object which can include the following fields:
174
+ * - `dateFormat`: configures the default date format. If not provided, the `DatePipe`
175
+ * will use the 'mediumDate' as a value.
176
+ * - `timezone`: configures the default timezone. If not provided, the `DatePipe` will
177
+ * use the end-user's local system timezone.
178
+ *
179
+ * @see `DatePipeConfig`
180
+ *
181
+ * @usageNotes
182
+ *
183
+ * Various date pipe default values can be overwritten by providing this token with
184
+ * the value that has this interface.
185
+ *
186
+ * For example:
187
+ *
188
+ * Override the default date format by providing a value using the token:
189
+ * ```typescript
190
+ * providers: [
191
+ * {provide: DATE_PIPE_DEFAULT_OPTIONS, useValue: {dateFormat: 'shortDate'}}
192
+ * ]
193
+ * ```
194
+ *
195
+ * Override the default timezone by providing a value using the token:
196
+ * ```typescript
197
+ * providers: [
198
+ * {provide: DATE_PIPE_DEFAULT_OPTIONS, useValue: {timezone: '-1200'}}
199
+ * ]
200
+ * ```
201
+ */
202
+ export declare const DATE_PIPE_DEFAULT_OPTIONS: InjectionToken<DatePipeConfig>;
203
+
171
204
  /**
172
205
  * Optionally-provided default timezone to use for all instances of `DatePipe` (such as `'+0430'`).
173
206
  * If the value isn't provided, the `DatePipe` will use the end-user's local system timezone.
207
+ *
208
+ * @deprecated use DATE_PIPE_DEFAULT_OPTIONS token to configure DatePipe
174
209
  */
175
210
  export declare const DATE_PIPE_DEFAULT_TIMEZONE: InjectionToken<string>;
176
211
 
@@ -334,27 +369,48 @@ export declare const DATE_PIPE_DEFAULT_TIMEZONE: InjectionToken<string>;
334
369
  export declare class DatePipe implements PipeTransform {
335
370
  private locale;
336
371
  private defaultTimezone?;
337
- constructor(locale: string, defaultTimezone?: string | null | undefined);
372
+ private defaultOptions?;
373
+ constructor(locale: string, defaultTimezone?: string | null | undefined, defaultOptions?: DatePipeConfig | null | undefined);
338
374
  /**
339
375
  * @param value The date expression: a `Date` object, a number
340
376
  * (milliseconds since UTC epoch), or an ISO string (https://www.w3.org/TR/NOTE-datetime).
341
377
  * @param format The date/time components to include, using predefined options or a
342
- * custom format string.
378
+ * custom format string. When not provided, the `DatePipe` looks for the value using the
379
+ * `DATE_PIPE_DEFAULT_OPTIONS` injection token (and reads the `dateFormat` property).
380
+ * If the token is not configured, the `mediumDate` is used as a value.
343
381
  * @param timezone A timezone offset (such as `'+0430'`), or a standard UTC/GMT, or continental US
344
- * timezone abbreviation. When not supplied, either the value of the `DATE_PIPE_DEFAULT_TIMEZONE`
345
- * injection token is used or the end-user's local system timezone.
382
+ * timezone abbreviation. When not provided, the `DatePipe` looks for the value using the
383
+ * `DATE_PIPE_DEFAULT_OPTIONS` injection token (and reads the `timezone` property). If the token
384
+ * is not configured, the end-user's local system timezone is used as a value.
346
385
  * @param locale A locale code for the locale format rules to use.
347
386
  * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
348
387
  * See [Setting your app locale](guide/i18n-common-locale-id).
388
+ *
389
+ * @see `DATE_PIPE_DEFAULT_OPTIONS`
390
+ *
349
391
  * @returns A date string in the desired format.
350
392
  */
351
393
  transform(value: Date | string | number, format?: string, timezone?: string, locale?: string): string | null;
352
394
  transform(value: null | undefined, format?: string, timezone?: string, locale?: string): null;
353
395
  transform(value: Date | string | number | null | undefined, format?: string, timezone?: string, locale?: string): string | null;
354
- static ɵfac: i0.ɵɵFactoryDeclaration<DatePipe, [null, { optional: true; }]>;
396
+ static ɵfac: i0.ɵɵFactoryDeclaration<DatePipe, [null, { optional: true; }, { optional: true; }]>;
355
397
  static ɵpipe: i0.ɵɵPipeDeclaration<DatePipe, "date", true>;
356
398
  }
357
399
 
400
+
401
+ /**
402
+ * An interface that describes the date pipe configuration, which can be provided using the
403
+ * `DATE_PIPE_DEFAULT_OPTIONS` token.
404
+ *
405
+ * @see `DATE_PIPE_DEFAULT_OPTIONS`
406
+ *
407
+ * @publicApi
408
+ */
409
+ export declare interface DatePipeConfig {
410
+ dateFormat: string;
411
+ timezone: string;
412
+ }
413
+
358
414
  /**
359
415
  * @ngModule CommonModule
360
416
  * @description
@@ -955,6 +1011,7 @@ declare namespace i13 {
955
1011
  declare namespace i14 {
956
1012
  export {
957
1013
  DATE_PIPE_DEFAULT_TIMEZONE,
1014
+ DATE_PIPE_DEFAULT_OPTIONS,
958
1015
  DatePipe
959
1016
  }
960
1017
  }
@@ -1101,7 +1158,6 @@ declare namespace i9 {
1101
1158
  * @see `ImageLoader`
1102
1159
  * @see `NgOptimizedImage`
1103
1160
  * @publicApi
1104
- * @developerPreview
1105
1161
  */
1106
1162
  export declare const IMAGE_LOADER: InjectionToken<ImageLoader>;
1107
1163
 
@@ -1110,7 +1166,6 @@ export declare const IMAGE_LOADER: InjectionToken<ImageLoader>;
1110
1166
  * NgOptimizedImage directive to produce full image URL based on the image name and its width.
1111
1167
  *
1112
1168
  * @publicApi
1113
- * @developerPreview
1114
1169
  */
1115
1170
  export declare type ImageLoader = (config: ImageLoaderConfig) => string;
1116
1171
 
@@ -1120,7 +1175,6 @@ export declare type ImageLoader = (config: ImageLoaderConfig) => string;
1120
1175
  * @see `ImageLoader`
1121
1176
  * @see `NgOptimizedImage`
1122
1177
  * @publicApi
1123
- * @developerPreview
1124
1178
  */
1125
1179
  export declare interface ImageLoaderConfig {
1126
1180
  /**
@@ -2018,6 +2072,7 @@ export declare abstract class NgLocalization {
2018
2072
  *
2019
2073
  * In addition, the directive:
2020
2074
  * - Generates appropriate asset URLs if a corresponding `ImageLoader` function is provided
2075
+ * - Automatically generates a srcset
2021
2076
  * - Requires that `width` and `height` are set
2022
2077
  * - Warns if `width` or `height` have been set incorrectly
2023
2078
  * - Warns if the image will be visually distorted when rendered
@@ -2103,13 +2158,15 @@ export declare abstract class NgLocalization {
2103
2158
  * ```
2104
2159
  *
2105
2160
  * @publicApi
2106
- * @developerPreview
2107
2161
  */
2108
2162
  export declare class NgOptimizedImage implements OnInit, OnChanges, OnDestroy {
2109
2163
  private imageLoader;
2164
+ private config;
2110
2165
  private renderer;
2111
2166
  private imgElement;
2112
2167
  private injector;
2168
+ private readonly isServer;
2169
+ private readonly preloadLinkChecker;
2113
2170
  private lcpObserver;
2114
2171
  /**
2115
2172
  * Calculate the rewritten `src` once and store it.
@@ -2118,17 +2175,6 @@ export declare class NgOptimizedImage implements OnInit, OnChanges, OnDestroy {
2118
2175
  * instance that might be already destroyed).
2119
2176
  */
2120
2177
  private _renderedSrc;
2121
- /**
2122
- * Previously, the `rawSrc` attribute was used to activate the directive.
2123
- * The attribute was renamed to `ngSrc` and this input just produces an error,
2124
- * suggesting to switch to `ngSrc` instead.
2125
- *
2126
- * This error should be removed in v15.
2127
- *
2128
- * @nodoc
2129
- * @deprecated Use `ngSrc` instead.
2130
- */
2131
- set rawSrc(value: string);
2132
2178
  /**
2133
2179
  * Name of the source image.
2134
2180
  * Image name will be processed by the image loader and the final URL will be applied as the `src`
@@ -2148,13 +2194,21 @@ export declare class NgOptimizedImage implements OnInit, OnChanges, OnDestroy {
2148
2194
  */
2149
2195
  ngSrcset: string;
2150
2196
  /**
2151
- * The intrinsic width of the image in pixels.
2197
+ * The base `sizes` attribute passed through to the `<img>` element.
2198
+ * Providing sizes causes the image to create an automatic responsive srcset.
2199
+ */
2200
+ sizes?: string;
2201
+ /**
2202
+ * For responsive images: the intrinsic width of the image in pixels.
2203
+ * For fixed size images: the desired rendered width of the image in pixels.
2152
2204
  */
2153
2205
  set width(value: string | number | undefined);
2154
2206
  get width(): number | undefined;
2155
2207
  private _width?;
2156
2208
  /**
2157
- * The intrinsic height of the image in pixels.
2209
+ * For responsive images: the intrinsic height of the image in pixels.
2210
+ * For fixed size images: the desired rendered height of the image in pixels.* The intrinsic
2211
+ * height of the image in pixels.
2158
2212
  */
2159
2213
  set height(value: string | number | undefined);
2160
2214
  get height(): number | undefined;
@@ -2172,17 +2226,38 @@ export declare class NgOptimizedImage implements OnInit, OnChanges, OnDestroy {
2172
2226
  set priority(value: string | boolean | undefined);
2173
2227
  get priority(): boolean;
2174
2228
  private _priority;
2229
+ /**
2230
+ * Disables automatic srcset generation for this image.
2231
+ */
2232
+ set disableOptimizedSrcset(value: string | boolean | undefined);
2233
+ get disableOptimizedSrcset(): boolean;
2234
+ private _disableOptimizedSrcset;
2235
+ /**
2236
+ * Sets the image to "fill mode", which eliminates the height/width requirement and adds
2237
+ * styles such that the image fills its containing element.
2238
+ *
2239
+ * @developerPreview
2240
+ */
2241
+ set fill(value: string | boolean | undefined);
2242
+ get fill(): boolean;
2243
+ private _fill;
2244
+ /** @nodoc */
2175
2245
  ngOnInit(): void;
2176
2246
  private setHostAttributes;
2247
+ /** @nodoc */
2177
2248
  ngOnChanges(changes: SimpleChanges): void;
2178
2249
  private getLoadingBehavior;
2179
2250
  private getFetchPriority;
2180
2251
  private getRewrittenSrc;
2181
2252
  private getRewrittenSrcset;
2253
+ private getAutomaticSrcset;
2254
+ private getResponsiveSrcset;
2255
+ private getFixedSrcset;
2256
+ /** @nodoc */
2182
2257
  ngOnDestroy(): void;
2183
2258
  private setHostAttribute;
2184
2259
  static ɵfac: i0.ɵɵFactoryDeclaration<NgOptimizedImage, never>;
2185
- static ɵdir: i0.ɵɵDirectiveDeclaration<NgOptimizedImage, "img[ngSrc],img[rawSrc]", never, { "rawSrc": "rawSrc"; "ngSrc": "ngSrc"; "ngSrcset": "ngSrcset"; "width": "width"; "height": "height"; "loading": "loading"; "priority": "priority"; "src": "src"; "srcset": "srcset"; }, {}, never, never, true, never>;
2260
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgOptimizedImage, "img[ngSrc]", never, { "ngSrc": "ngSrc"; "ngSrcset": "ngSrcset"; "sizes": "sizes"; "width": "width"; "height": "height"; "loading": "loading"; "priority": "priority"; "disableOptimizedSrcset": "disableOptimizedSrcset"; "fill": "fill"; "src": "src"; "srcset": "srcset"; }, {}, never, never, true, never>;
2186
2261
  }
2187
2262
 
2188
2263
  /**
@@ -2781,7 +2856,6 @@ export { PopStateEvent_2 as PopStateEvent }
2781
2856
  * ```
2782
2857
  *
2783
2858
  * @publicApi
2784
- * @developerPreview
2785
2859
  */
2786
2860
  export declare const PRECONNECT_CHECK_BLOCKLIST: InjectionToken<(string | string[])[]>;
2787
2861
 
@@ -2795,7 +2869,6 @@ export declare const PRECONNECT_CHECK_BLOCKLIST: InjectionToken<(string | string
2795
2869
  * @returns Provider that provides an ImageLoader function
2796
2870
  *
2797
2871
  * @publicApi
2798
- * @developerPreview
2799
2872
  */
2800
2873
  export declare const provideCloudflareLoader: (path: string) => Provider[];
2801
2874
 
@@ -2810,7 +2883,6 @@ export declare const provideCloudflareLoader: (path: string) => Provider[];
2810
2883
  * @returns Set of providers to configure the Cloudinary loader.
2811
2884
  *
2812
2885
  * @publicApi
2813
- * @developerPreview
2814
2886
  */
2815
2887
  export declare const provideCloudinaryLoader: (path: string) => Provider[];
2816
2888
 
@@ -2824,7 +2896,6 @@ export declare const provideCloudinaryLoader: (path: string) => Provider[];
2824
2896
  * @returns Set of providers to configure the ImageKit loader.
2825
2897
  *
2826
2898
  * @publicApi
2827
- * @developerPreview
2828
2899
  */
2829
2900
  export declare const provideImageKitLoader: (path: string) => Provider[];
2830
2901
 
@@ -2836,7 +2907,6 @@ export declare const provideImageKitLoader: (path: string) => Provider[];
2836
2907
  * @returns Set of providers to configure the Imgix loader.
2837
2908
  *
2838
2909
  * @publicApi
2839
- * @developerPreview
2840
2910
  */
2841
2911
  export declare const provideImgixLoader: (path: string) => Provider[];
2842
2912
 
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@angular/common",
3
- "version": "15.0.0-next.5",
3
+ "version": "15.0.0-rc.0",
4
4
  "description": "Angular - commonly needed directives and services",
5
5
  "author": "angular",
6
6
  "license": "MIT",
7
7
  "engines": {
8
- "node": "^14.15.0 || >=16.10.0"
8
+ "node": "^14.20.0 || ^16.13.0 || >=18.10.0"
9
9
  },
10
10
  "locales": "locales",
11
11
  "dependencies": {
@@ -63,7 +63,7 @@
63
63
  }
64
64
  },
65
65
  "peerDependencies": {
66
- "@angular/core": "15.0.0-next.5",
66
+ "@angular/core": "15.0.0-rc.0",
67
67
  "rxjs": "^6.5.3 || ^7.4.0"
68
68
  },
69
69
  "repository": {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.0.0-next.5
2
+ * @license Angular v15.0.0-rc.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -11,6 +11,7 @@ import { Location as Location_2 } from '@angular/common';
11
11
  import { LocationChangeListener } from '@angular/common';
12
12
  import { LocationStrategy } from '@angular/common';
13
13
  import { PlatformLocation } from '@angular/common';
14
+ import { Provider } from '@angular/core';
14
15
  import { SubscriptionLike } from 'rxjs';
15
16
 
16
17
  /**
@@ -92,6 +93,14 @@ export declare interface MockPlatformLocationConfig {
92
93
  appBaseHref?: string;
93
94
  }
94
95
 
96
+ /**
97
+ * Returns mock providers for the `Location` and `LocationStrategy` classes.
98
+ * The mocks are helpful in tests to fire simulated location events.
99
+ *
100
+ * @publicApi
101
+ */
102
+ export declare function provideLocationMocks(): Provider[];
103
+
95
104
  /**
96
105
  * A spy for {@link Location} that allows tests to fire simulated location events.
97
106
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.0.0-next.5
2
+ * @license Angular v15.0.0-rc.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */