@angular/common 15.0.0-next.5 → 15.0.0-next.6

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 (76) 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/lcp_image_observer.mjs +3 -3
  21. package/esm2020/src/directives/ng_optimized_image/ng_optimized_image.mjs +156 -11
  22. package/esm2020/src/directives/ng_optimized_image/preconnect_link_checker.mjs +3 -3
  23. package/esm2020/src/directives/ng_optimized_image/preload-link-creator.mjs +74 -0
  24. package/esm2020/src/directives/ng_optimized_image/tokens.mjs +24 -0
  25. package/esm2020/src/directives/ng_plural.mjs +6 -6
  26. package/esm2020/src/directives/ng_style.mjs +3 -3
  27. package/esm2020/src/directives/ng_switch.mjs +9 -9
  28. package/esm2020/src/directives/ng_template_outlet.mjs +3 -3
  29. package/esm2020/src/errors.mjs +1 -1
  30. package/esm2020/src/i18n/localization.mjs +6 -6
  31. package/esm2020/src/location/hash_location_strategy.mjs +3 -3
  32. package/esm2020/src/location/location.mjs +3 -3
  33. package/esm2020/src/location/location_strategy.mjs +6 -6
  34. package/esm2020/src/location/platform_location.mjs +6 -6
  35. package/esm2020/src/pipes/async_pipe.mjs +3 -3
  36. package/esm2020/src/pipes/case_conversion_pipes.mjs +9 -9
  37. package/esm2020/src/pipes/date_pipe.mjs +50 -7
  38. package/esm2020/src/pipes/date_pipe_config.mjs +13 -0
  39. package/esm2020/src/pipes/i18n_plural_pipe.mjs +3 -3
  40. package/esm2020/src/pipes/i18n_select_pipe.mjs +3 -3
  41. package/esm2020/src/pipes/index.mjs +3 -3
  42. package/esm2020/src/pipes/json_pipe.mjs +3 -3
  43. package/esm2020/src/pipes/keyvalue_pipe.mjs +3 -3
  44. package/esm2020/src/pipes/number_pipe.mjs +9 -9
  45. package/esm2020/src/pipes/slice_pipe.mjs +3 -3
  46. package/esm2020/src/version.mjs +1 -1
  47. package/esm2020/testing/src/location_mock.mjs +3 -3
  48. package/esm2020/testing/src/mock_location_strategy.mjs +3 -3
  49. package/esm2020/testing/src/mock_platform_location.mjs +3 -3
  50. package/esm2020/testing/src/provide_location_mocks.mjs +24 -0
  51. package/esm2020/testing/src/testing.mjs +2 -1
  52. package/esm2020/upgrade/src/location_upgrade_module.mjs +4 -4
  53. package/fesm2015/common.mjs +415 -123
  54. package/fesm2015/common.mjs.map +1 -1
  55. package/fesm2015/http/testing.mjs +27 -16
  56. package/fesm2015/http/testing.mjs.map +1 -1
  57. package/fesm2015/http.mjs +295 -174
  58. package/fesm2015/http.mjs.map +1 -1
  59. package/fesm2015/testing.mjs +33 -12
  60. package/fesm2015/testing.mjs.map +1 -1
  61. package/fesm2015/upgrade.mjs +5 -5
  62. package/fesm2020/common.mjs +413 -122
  63. package/fesm2020/common.mjs.map +1 -1
  64. package/fesm2020/http/testing.mjs +27 -16
  65. package/fesm2020/http/testing.mjs.map +1 -1
  66. package/fesm2020/http.mjs +294 -172
  67. package/fesm2020/http.mjs.map +1 -1
  68. package/fesm2020/testing.mjs +33 -12
  69. package/fesm2020/testing.mjs.map +1 -1
  70. package/fesm2020/upgrade.mjs +5 -5
  71. package/http/index.d.ts +87 -30
  72. package/http/testing/index.d.ts +4 -1
  73. package/index.d.ts +89 -7
  74. package/package.json +3 -3
  75. package/testing/index.d.ts +11 -1
  76. 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-next.6
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
  }
@@ -2018,6 +2075,7 @@ export declare abstract class NgLocalization {
2018
2075
  *
2019
2076
  * In addition, the directive:
2020
2077
  * - Generates appropriate asset URLs if a corresponding `ImageLoader` function is provided
2078
+ * - Automatically generates a srcset
2021
2079
  * - Requires that `width` and `height` are set
2022
2080
  * - Warns if `width` or `height` have been set incorrectly
2023
2081
  * - Warns if the image will be visually distorted when rendered
@@ -2107,9 +2165,12 @@ export declare abstract class NgLocalization {
2107
2165
  */
2108
2166
  export declare class NgOptimizedImage implements OnInit, OnChanges, OnDestroy {
2109
2167
  private imageLoader;
2168
+ private config;
2110
2169
  private renderer;
2111
2170
  private imgElement;
2112
2171
  private injector;
2172
+ private readonly isServer;
2173
+ private readonly preloadLinkChecker;
2113
2174
  private lcpObserver;
2114
2175
  /**
2115
2176
  * Calculate the rewritten `src` once and store it.
@@ -2147,6 +2208,11 @@ export declare class NgOptimizedImage implements OnInit, OnChanges, OnDestroy {
2147
2208
  * ```
2148
2209
  */
2149
2210
  ngSrcset: string;
2211
+ /**
2212
+ * The base `sizes` attribute passed through to the `<img>` element.
2213
+ * Providing sizes causes the image to create an automatic responsive srcset.
2214
+ */
2215
+ sizes?: string;
2150
2216
  /**
2151
2217
  * The intrinsic width of the image in pixels.
2152
2218
  */
@@ -2172,6 +2238,19 @@ export declare class NgOptimizedImage implements OnInit, OnChanges, OnDestroy {
2172
2238
  set priority(value: string | boolean | undefined);
2173
2239
  get priority(): boolean;
2174
2240
  private _priority;
2241
+ /**
2242
+ * Disables automatic srcset generation for this image.
2243
+ */
2244
+ set disableOptimizedSrcset(value: string | boolean | undefined);
2245
+ get disableOptimizedSrcset(): boolean;
2246
+ private _disableOptimizedSrcset;
2247
+ /**
2248
+ * Sets the image to "fill mode," which eliminates the height/width requirement and adds
2249
+ * styles such that the image fills its containing element.
2250
+ */
2251
+ set fill(value: string | boolean | undefined);
2252
+ get fill(): boolean;
2253
+ private _fill;
2175
2254
  ngOnInit(): void;
2176
2255
  private setHostAttributes;
2177
2256
  ngOnChanges(changes: SimpleChanges): void;
@@ -2179,10 +2258,13 @@ export declare class NgOptimizedImage implements OnInit, OnChanges, OnDestroy {
2179
2258
  private getFetchPriority;
2180
2259
  private getRewrittenSrc;
2181
2260
  private getRewrittenSrcset;
2261
+ private getAutomaticSrcset;
2262
+ private getResponsiveSrcset;
2263
+ private getFixedSrcset;
2182
2264
  ngOnDestroy(): void;
2183
2265
  private setHostAttribute;
2184
2266
  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>;
2267
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgOptimizedImage, "img[ngSrc],img[rawSrc]", never, { "rawSrc": "rawSrc"; "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
2268
  }
2187
2269
 
2188
2270
  /**
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-next.6",
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-next.6",
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-next.6
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,15 @@ 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
+ * @developerPreview
101
+ * @publicApi
102
+ */
103
+ export declare function provideLocationMocks(): Provider[];
104
+
95
105
  /**
96
106
  * A spy for {@link Location} that allows tests to fire simulated location events.
97
107
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.0.0-next.5
2
+ * @license Angular v15.0.0-next.6
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */