@angular/common 15.0.0-next.4 → 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 (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 -5
  21. package/esm2020/src/directives/ng_optimized_image/image_loaders/cloudinary_loader.mjs +1 -5
  22. package/esm2020/src/directives/ng_optimized_image/image_loaders/image_loader.mjs +2 -6
  23. package/esm2020/src/directives/ng_optimized_image/image_loaders/imagekit_loader.mjs +1 -5
  24. package/esm2020/src/directives/ng_optimized_image/image_loaders/imgix_loader.mjs +1 -5
  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 +156 -11
  27. package/esm2020/src/directives/ng_optimized_image/preconnect_link_checker.mjs +9 -10
  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 +5 -5
  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 +24 -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 +578 -306
  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 +33 -12
  65. package/fesm2015/testing.mjs.map +1 -1
  66. package/fesm2015/upgrade.mjs +5 -5
  67. package/fesm2020/common.mjs +575 -304
  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 +33 -12
  74. package/fesm2020/testing.mjs.map +1 -1
  75. package/fesm2020/upgrade.mjs +5 -5
  76. package/http/index.d.ts +87 -30
  77. package/http/testing/index.d.ts +4 -1
  78. package/index.d.ts +97 -39
  79. package/package.json +3 -3
  80. package/testing/index.d.ts +11 -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.4
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
  }
@@ -999,7 +1056,7 @@ export declare class I18nPluralPipe implements PipeTransform {
999
1056
  /**
1000
1057
  * @param value the number to be formatted
1001
1058
  * @param pluralMap an object that mimics the ICU format, see
1002
- * http://userguide.icu-project.org/formatparse/messages.
1059
+ * https://unicode-org.github.io/icu/userguide/format_parse/messages/.
1003
1060
  * @param locale a `string` defining the locale to use (uses the current {@link LOCALE_ID} by
1004
1061
  * default).
1005
1062
  */
@@ -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
  /**
@@ -2765,18 +2847,18 @@ declare interface PopStateEvent_2 {
2765
2847
  export { PopStateEvent_2 as PopStateEvent }
2766
2848
 
2767
2849
  /**
2768
- * Multi-provider injection token to configure which origins should be excluded
2850
+ * Injection token to configure which origins should be excluded
2769
2851
  * from the preconnect checks. It can either be a single string or an array of strings
2770
2852
  * to represent a group of origins, for example:
2771
2853
  *
2772
2854
  * ```typescript
2773
- * {provide: PRECONNECT_CHECK_BLOCKLIST, multi: true, useValue: 'https://your-domain.com'}
2855
+ * {provide: PRECONNECT_CHECK_BLOCKLIST, useValue: 'https://your-domain.com'}
2774
2856
  * ```
2775
2857
  *
2776
2858
  * or:
2777
2859
  *
2778
2860
  * ```typescript
2779
- * {provide: PRECONNECT_CHECK_BLOCKLIST, multi: true,
2861
+ * {provide: PRECONNECT_CHECK_BLOCKLIST,
2780
2862
  * useValue: ['https://your-domain-1.com', 'https://your-domain-2.com']}
2781
2863
  * ```
2782
2864
  *
@@ -2792,18 +2874,12 @@ export declare const PRECONNECT_CHECK_BLOCKLIST: InjectionToken<(string | string
2792
2874
  * Cloudflare Image Resizing; it will not work with Cloudflare Images or Cloudflare Polish.
2793
2875
  *
2794
2876
  * @param path Your domain name, e.g. https://mysite.com
2795
- * @param options An object with extra configuration:
2796
- * - `ensurePreconnect`: boolean flag indicating whether the NgOptimizedImage directive
2797
- * should verify that there is a corresponding `<link rel="preconnect">`
2798
- * present in the document's `<head>`.
2799
2877
  * @returns Provider that provides an ImageLoader function
2800
2878
  *
2801
2879
  * @publicApi
2802
2880
  * @developerPreview
2803
2881
  */
2804
- export declare const provideCloudflareLoader: (path: string, options?: {
2805
- ensurePreconnect?: boolean | undefined;
2806
- }) => Provider[];
2882
+ export declare const provideCloudflareLoader: (path: string) => Provider[];
2807
2883
 
2808
2884
  /**
2809
2885
  * Function that generates an ImageLoader for Cloudinary and turns it into an Angular provider.
@@ -2813,18 +2889,12 @@ export declare const provideCloudflareLoader: (path: string, options?: {
2813
2889
  * https://res.cloudinary.com/mysite
2814
2890
  * https://mysite.cloudinary.com
2815
2891
  * https://subdomain.mysite.com
2816
- * @param options An object with extra configuration:
2817
- * - `ensurePreconnect`: boolean flag indicating whether the NgOptimizedImage directive
2818
- * should verify that there is a corresponding `<link rel="preconnect">`
2819
- * present in the document's `<head>`.
2820
2892
  * @returns Set of providers to configure the Cloudinary loader.
2821
2893
  *
2822
2894
  * @publicApi
2823
2895
  * @developerPreview
2824
2896
  */
2825
- export declare const provideCloudinaryLoader: (path: string, options?: {
2826
- ensurePreconnect?: boolean | undefined;
2827
- }) => Provider[];
2897
+ export declare const provideCloudinaryLoader: (path: string) => Provider[];
2828
2898
 
2829
2899
  /**
2830
2900
  * Function that generates an ImageLoader for ImageKit and turns it into an Angular provider.
@@ -2833,36 +2903,24 @@ export declare const provideCloudinaryLoader: (path: string, options?: {
2833
2903
  * This URL should match one of the following formats:
2834
2904
  * https://ik.imagekit.io/myaccount
2835
2905
  * https://subdomain.mysite.com
2836
- * @param options An object with extra configuration:
2837
- * - `ensurePreconnect`: boolean flag indicating whether the NgOptimizedImage directive
2838
- * should verify that there is a corresponding `<link rel="preconnect">`
2839
- * present in the document's `<head>`.
2840
2906
  * @returns Set of providers to configure the ImageKit loader.
2841
2907
  *
2842
2908
  * @publicApi
2843
2909
  * @developerPreview
2844
2910
  */
2845
- export declare const provideImageKitLoader: (path: string, options?: {
2846
- ensurePreconnect?: boolean | undefined;
2847
- }) => Provider[];
2911
+ export declare const provideImageKitLoader: (path: string) => Provider[];
2848
2912
 
2849
2913
  /**
2850
2914
  * Function that generates an ImageLoader for Imgix and turns it into an Angular provider.
2851
2915
  *
2852
2916
  * @param path path to the desired Imgix origin,
2853
2917
  * e.g. https://somepath.imgix.net or https://images.mysite.com
2854
- * @param options An object with extra configuration:
2855
- * - `ensurePreconnect`: boolean flag indicating whether the NgOptimizedImage directive
2856
- * should verify that there is a corresponding `<link rel="preconnect">`
2857
- * present in the document's `<head>`.
2858
2918
  * @returns Set of providers to configure the Imgix loader.
2859
2919
  *
2860
2920
  * @publicApi
2861
2921
  * @developerPreview
2862
2922
  */
2863
- export declare const provideImgixLoader: (path: string, options?: {
2864
- ensurePreconnect?: boolean | undefined;
2865
- }) => Provider[];
2923
+ export declare const provideImgixLoader: (path: string) => Provider[];
2866
2924
 
2867
2925
 
2868
2926
  /**
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@angular/common",
3
- "version": "15.0.0-next.4",
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.4",
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.4
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.4
2
+ * @license Angular v15.0.0-next.6
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */