@angular/common 20.0.0-next.0 → 20.0.0-next.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/common",
3
- "version": "20.0.0-next.0",
3
+ "version": "20.0.0-next.2",
4
4
  "description": "Angular - commonly needed directives and services",
5
5
  "author": "angular",
6
6
  "license": "MIT",
@@ -44,7 +44,7 @@
44
44
  }
45
45
  },
46
46
  "peerDependencies": {
47
- "@angular/core": "20.0.0-next.0",
47
+ "@angular/core": "20.0.0-next.2",
48
48
  "rxjs": "^6.5.3 || ^7.4.0"
49
49
  },
50
50
  "repository": {
@@ -1,26 +1,51 @@
1
1
  /**
2
- * @license Angular v20.0.0-next.0
3
- * (c) 2010-2024 Google LLC. https://angular.io/
2
+ * @license Angular v20.0.0-next.2
3
+ * (c) 2010-2025 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
-
8
7
  import * as i0 from '@angular/core';
9
- import { InjectionToken } from '@angular/core';
10
- import { Location as Location_2 } from '@angular/common';
11
- import { LocationChangeListener } from '@angular/common';
12
- import { LocationStrategy } from '@angular/common';
13
- import { PlatformLocation } from '@angular/common';
14
- import { Provider } from '@angular/core';
8
+ import { Provider, InjectionToken } from '@angular/core';
9
+ export { ɵFakeNavigation } from '@angular/core/testing';
10
+ import { Location, LocationStrategy, PlatformLocation, LocationChangeListener } from '@angular/common';
15
11
  import { SubscriptionLike } from 'rxjs';
16
- import { ɵFakeNavigation } from '@angular/core/testing';
17
12
 
18
13
  /**
19
- * Provider for mock platform location config
14
+ * Return a provider for the `FakeNavigation` in place of the real Navigation API.
15
+ */
16
+ declare function provideFakePlatformNavigation(): Provider[];
17
+
18
+ /**
19
+ * A spy for {@link Location} that allows tests to fire simulated location events.
20
20
  *
21
21
  * @publicApi
22
22
  */
23
- export declare const MOCK_PLATFORM_LOCATION_CONFIG: InjectionToken<MockPlatformLocationConfig>;
23
+ declare class SpyLocation implements Location {
24
+ urlChanges: string[];
25
+ private _history;
26
+ private _historyIndex;
27
+ /** @nodoc */
28
+ ngOnDestroy(): void;
29
+ setInitialPath(url: string): void;
30
+ setBaseHref(url: string): void;
31
+ path(): string;
32
+ getState(): unknown;
33
+ isCurrentPathEqualTo(path: string, query?: string): boolean;
34
+ simulateUrlPop(pathname: string): void;
35
+ simulateHashChange(pathname: string): void;
36
+ prepareExternalUrl(url: string): string;
37
+ go(path: string, query?: string, state?: any): void;
38
+ replaceState(path: string, query?: string, state?: any): void;
39
+ forward(): void;
40
+ back(): void;
41
+ historyGo(relativePosition?: number): void;
42
+ onUrlChange(fn: (url: string, state: unknown) => void): VoidFunction;
43
+ subscribe(onNext: (value: any) => void, onThrow?: ((error: any) => void) | null, onReturn?: (() => void) | null): SubscriptionLike;
44
+ normalize(url: string): string;
45
+ private pushHistory;
46
+ static ɵfac: i0.ɵɵFactoryDeclaration<SpyLocation, never>;
47
+ static ɵprov: i0.ɵɵInjectableDeclaration<SpyLocation>;
48
+ }
24
49
 
25
50
  /**
26
51
  * A mock implementation of {@link LocationStrategy} that allows tests to fire simulated
@@ -28,7 +53,7 @@ export declare const MOCK_PLATFORM_LOCATION_CONFIG: InjectionToken<MockPlatformL
28
53
  *
29
54
  * @publicApi
30
55
  */
31
- export declare class MockLocationStrategy extends LocationStrategy {
56
+ declare class MockLocationStrategy extends LocationStrategy {
32
57
  internalBaseHref: string;
33
58
  internalPath: string;
34
59
  internalTitle: string;
@@ -49,12 +74,27 @@ export declare class MockLocationStrategy extends LocationStrategy {
49
74
  static ɵprov: i0.ɵɵInjectableDeclaration<MockLocationStrategy>;
50
75
  }
51
76
 
77
+ /**
78
+ * Mock platform location config
79
+ *
80
+ * @publicApi
81
+ */
82
+ interface MockPlatformLocationConfig {
83
+ startUrl?: string;
84
+ appBaseHref?: string;
85
+ }
86
+ /**
87
+ * Provider for mock platform location config
88
+ *
89
+ * @publicApi
90
+ */
91
+ declare const MOCK_PLATFORM_LOCATION_CONFIG: InjectionToken<MockPlatformLocationConfig>;
52
92
  /**
53
93
  * Mock implementation of URL state.
54
94
  *
55
95
  * @publicApi
56
96
  */
57
- export declare class MockPlatformLocation implements PlatformLocation {
97
+ declare class MockPlatformLocation implements PlatformLocation {
58
98
  private baseHref;
59
99
  private hashUpdate;
60
100
  private popStateSubject;
@@ -95,61 +135,12 @@ export declare class MockPlatformLocation implements PlatformLocation {
95
135
  static ɵprov: i0.ɵɵInjectableDeclaration<MockPlatformLocation>;
96
136
  }
97
137
 
98
- /**
99
- * Mock platform location config
100
- *
101
- * @publicApi
102
- */
103
- export declare interface MockPlatformLocationConfig {
104
- startUrl?: string;
105
- appBaseHref?: string;
106
- }
107
-
108
138
  /**
109
139
  * Returns mock providers for the `Location` and `LocationStrategy` classes.
110
140
  * The mocks are helpful in tests to fire simulated location events.
111
141
  *
112
142
  * @publicApi
113
143
  */
114
- export declare function provideLocationMocks(): Provider[];
115
-
116
- /**
117
- * A spy for {@link Location} that allows tests to fire simulated location events.
118
- *
119
- * @publicApi
120
- */
121
- export declare class SpyLocation implements Location_2 {
122
- urlChanges: string[];
123
- private _history;
124
- private _historyIndex;
125
- /** @nodoc */
126
- ngOnDestroy(): void;
127
- setInitialPath(url: string): void;
128
- setBaseHref(url: string): void;
129
- path(): string;
130
- getState(): unknown;
131
- isCurrentPathEqualTo(path: string, query?: string): boolean;
132
- simulateUrlPop(pathname: string): void;
133
- simulateHashChange(pathname: string): void;
134
- prepareExternalUrl(url: string): string;
135
- go(path: string, query?: string, state?: any): void;
136
- replaceState(path: string, query?: string, state?: any): void;
137
- forward(): void;
138
- back(): void;
139
- historyGo(relativePosition?: number): void;
140
- onUrlChange(fn: (url: string, state: unknown) => void): VoidFunction;
141
- subscribe(onNext: (value: any) => void, onThrow?: ((error: any) => void) | null, onReturn?: (() => void) | null): SubscriptionLike;
142
- normalize(url: string): string;
143
- private pushHistory;
144
- static ɵfac: i0.ɵɵFactoryDeclaration<SpyLocation, never>;
145
- static ɵprov: i0.ɵɵInjectableDeclaration<SpyLocation>;
146
- }
147
-
148
- export { ɵFakeNavigation }
149
-
150
- /**
151
- * Return a provider for the `FakeNavigation` in place of the real Navigation API.
152
- */
153
- export declare function ɵprovideFakePlatformNavigation(): Provider[];
144
+ declare function provideLocationMocks(): Provider[];
154
145
 
155
- export { }
146
+ export { MOCK_PLATFORM_LOCATION_CONFIG, MockLocationStrategy, MockPlatformLocation, type MockPlatformLocationConfig, SpyLocation, provideLocationMocks, provideFakePlatformNavigation as ɵprovideFakePlatformNavigation };
@@ -1,18 +1,134 @@
1
1
  /**
2
- * @license Angular v20.0.0-next.0
3
- * (c) 2010-2024 Google LLC. https://angular.io/
2
+ * @license Angular v20.0.0-next.2
3
+ * (c) 2010-2025 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
-
8
- import * as i0 from '@angular/core';
9
7
  import * as i1 from '@angular/common';
10
- import { InjectionToken } from '@angular/core';
11
- import { Location as Location_2 } from '@angular/common';
12
- import { LocationStrategy } from '@angular/common';
13
- import { ModuleWithProviders } from '@angular/core';
14
- import { PlatformLocation } from '@angular/common';
8
+ import { Location, PlatformLocation, LocationStrategy } from '@angular/common';
15
9
  import { UpgradeModule } from '@angular/upgrade/static';
10
+ import * as i0 from '@angular/core';
11
+ import { InjectionToken, ModuleWithProviders } from '@angular/core';
12
+
13
+ /**
14
+ * A codec for encoding and decoding URL parts.
15
+ *
16
+ * @publicApi
17
+ **/
18
+ declare abstract class UrlCodec {
19
+ /**
20
+ * Encodes the path from the provided string
21
+ *
22
+ * @param path The path string
23
+ */
24
+ abstract encodePath(path: string): string;
25
+ /**
26
+ * Decodes the path from the provided string
27
+ *
28
+ * @param path The path string
29
+ */
30
+ abstract decodePath(path: string): string;
31
+ /**
32
+ * Encodes the search string from the provided string or object
33
+ *
34
+ * @param path The path string or object
35
+ */
36
+ abstract encodeSearch(search: string | {
37
+ [k: string]: unknown;
38
+ }): string;
39
+ /**
40
+ * Decodes the search objects from the provided string
41
+ *
42
+ * @param path The path string
43
+ */
44
+ abstract decodeSearch(search: string): {
45
+ [k: string]: unknown;
46
+ };
47
+ /**
48
+ * Encodes the hash from the provided string
49
+ *
50
+ * @param path The hash string
51
+ */
52
+ abstract encodeHash(hash: string): string;
53
+ /**
54
+ * Decodes the hash from the provided string
55
+ *
56
+ * @param path The hash string
57
+ */
58
+ abstract decodeHash(hash: string): string;
59
+ /**
60
+ * Normalizes the URL from the provided string
61
+ *
62
+ * @param path The URL string
63
+ */
64
+ abstract normalize(href: string): string;
65
+ /**
66
+ * Normalizes the URL from the provided string, search, hash, and base URL parameters
67
+ *
68
+ * @param path The URL path
69
+ * @param search The search object
70
+ * @param hash The has string
71
+ * @param baseUrl The base URL for the URL
72
+ */
73
+ abstract normalize(path: string, search: {
74
+ [k: string]: unknown;
75
+ }, hash: string, baseUrl?: string): string;
76
+ /**
77
+ * Checks whether the two strings are equal
78
+ * @param valA First string for comparison
79
+ * @param valB Second string for comparison
80
+ */
81
+ abstract areEqual(valA: string, valB: string): boolean;
82
+ /**
83
+ * Parses the URL string based on the base URL
84
+ *
85
+ * @param url The full URL string
86
+ * @param base The base for the URL
87
+ */
88
+ abstract parse(url: string, base?: string): {
89
+ href: string;
90
+ protocol: string;
91
+ host: string;
92
+ search: string;
93
+ hash: string;
94
+ hostname: string;
95
+ port: string;
96
+ pathname: string;
97
+ };
98
+ }
99
+ /**
100
+ * A `UrlCodec` that uses logic from AngularJS to serialize and parse URLs
101
+ * and URL parameters.
102
+ *
103
+ * @publicApi
104
+ */
105
+ declare class AngularJSUrlCodec implements UrlCodec {
106
+ encodePath(path: string): string;
107
+ encodeSearch(search: string | {
108
+ [k: string]: unknown;
109
+ }): string;
110
+ encodeHash(hash: string): string;
111
+ decodePath(path: string, html5Mode?: boolean): string;
112
+ decodeSearch(search: string): {
113
+ [k: string]: unknown;
114
+ };
115
+ decodeHash(hash: string): string;
116
+ normalize(href: string): string;
117
+ normalize(path: string, search: {
118
+ [k: string]: unknown;
119
+ }, hash: string, baseUrl?: string): string;
120
+ areEqual(valA: string, valB: string): boolean;
121
+ parse(url: string, base?: string): {
122
+ href: string;
123
+ protocol: string;
124
+ host: string;
125
+ search: string;
126
+ hash: string;
127
+ hostname: string;
128
+ port: string;
129
+ pathname: string;
130
+ };
131
+ }
16
132
 
17
133
  /**
18
134
  * Location service that provides a drop-in replacement for the $location service
@@ -22,7 +138,7 @@ import { UpgradeModule } from '@angular/upgrade/static';
22
138
  *
23
139
  * @publicApi
24
140
  */
25
- export declare class $locationShim {
141
+ declare class $locationShim {
26
142
  private location;
27
143
  private platformLocation;
28
144
  private urlCodec;
@@ -42,7 +158,8 @@ export declare class $locationShim {
42
158
  private $$changeListeners;
43
159
  private cachedState;
44
160
  private urlChanges;
45
- constructor($injector: any, location: Location_2, platformLocation: PlatformLocation, urlCodec: UrlCodec, locationStrategy: LocationStrategy);
161
+ private readonly removeOnUrlChangeFn;
162
+ constructor($injector: any, location: Location, platformLocation: PlatformLocation, urlCodec: UrlCodec, locationStrategy: LocationStrategy);
46
163
  private initialize;
47
164
  private resetBrowserUpdate;
48
165
  private lastHistoryState;
@@ -245,20 +362,19 @@ export declare class $locationShim {
245
362
  state(): unknown;
246
363
  state(state: unknown): this;
247
364
  }
248
-
249
365
  /**
250
366
  * The factory function used to create an instance of the `$locationShim` in Angular,
251
367
  * and provides an API-compatible `$locationProvider` for AngularJS.
252
368
  *
253
369
  * @publicApi
254
370
  */
255
- export declare class $locationShimProvider {
371
+ declare class $locationShimProvider {
256
372
  private ngUpgrade;
257
373
  private location;
258
374
  private platformLocation;
259
375
  private urlCodec;
260
376
  private locationStrategy;
261
- constructor(ngUpgrade: UpgradeModule, location: Location_2, platformLocation: PlatformLocation, urlCodec: UrlCodec, locationStrategy: LocationStrategy);
377
+ constructor(ngUpgrade: UpgradeModule, location: Location, platformLocation: PlatformLocation, urlCodec: UrlCodec, locationStrategy: LocationStrategy);
262
378
  /**
263
379
  * Factory method that returns an instance of the $locationShim
264
380
  */
@@ -275,53 +391,12 @@ export declare class $locationShimProvider {
275
391
  html5Mode(mode?: any): void;
276
392
  }
277
393
 
278
- /**
279
- * A `UrlCodec` that uses logic from AngularJS to serialize and parse URLs
280
- * and URL parameters.
281
- *
282
- * @publicApi
283
- */
284
- export declare class AngularJSUrlCodec implements UrlCodec {
285
- encodePath(path: string): string;
286
- encodeSearch(search: string | {
287
- [k: string]: unknown;
288
- }): string;
289
- encodeHash(hash: string): string;
290
- decodePath(path: string, html5Mode?: boolean): string;
291
- decodeSearch(search: string): {
292
- [k: string]: unknown;
293
- };
294
- decodeHash(hash: string): string;
295
- normalize(href: string): string;
296
- normalize(path: string, search: {
297
- [k: string]: unknown;
298
- }, hash: string, baseUrl?: string): string;
299
- areEqual(valA: string, valB: string): boolean;
300
- parse(url: string, base?: string): {
301
- href: string;
302
- protocol: string;
303
- host: string;
304
- search: string;
305
- hash: string;
306
- hostname: string;
307
- port: string;
308
- pathname: string;
309
- };
310
- }
311
-
312
- /**
313
- * A provider token used to configure the location upgrade module.
314
- *
315
- * @publicApi
316
- */
317
- export declare const LOCATION_UPGRADE_CONFIGURATION: InjectionToken<LocationUpgradeConfig>;
318
-
319
394
  /**
320
395
  * Configuration options for LocationUpgrade.
321
396
  *
322
397
  * @publicApi
323
398
  */
324
- export declare interface LocationUpgradeConfig {
399
+ interface LocationUpgradeConfig {
325
400
  /**
326
401
  * Configures whether the location upgrade module should use the `HashLocationStrategy`
327
402
  * or the `PathLocationStrategy`
@@ -344,7 +419,12 @@ export declare interface LocationUpgradeConfig {
344
419
  */
345
420
  appBaseHref?: string;
346
421
  }
347
-
422
+ /**
423
+ * A provider token used to configure the location upgrade module.
424
+ *
425
+ * @publicApi
426
+ */
427
+ declare const LOCATION_UPGRADE_CONFIGURATION: InjectionToken<LocationUpgradeConfig>;
348
428
  /**
349
429
  * `NgModule` used for providing and configuring Angular's Unified Location Service for upgrading.
350
430
  *
@@ -352,99 +432,11 @@ export declare interface LocationUpgradeConfig {
352
432
  *
353
433
  * @publicApi
354
434
  */
355
- export declare class LocationUpgradeModule {
435
+ declare class LocationUpgradeModule {
356
436
  static config(config?: LocationUpgradeConfig): ModuleWithProviders<LocationUpgradeModule>;
357
437
  static ɵfac: i0.ɵɵFactoryDeclaration<LocationUpgradeModule, never>;
358
438
  static ɵmod: i0.ɵɵNgModuleDeclaration<LocationUpgradeModule, never, [typeof i1.CommonModule], never>;
359
439
  static ɵinj: i0.ɵɵInjectorDeclaration<LocationUpgradeModule>;
360
440
  }
361
441
 
362
-
363
- /**
364
- * A codec for encoding and decoding URL parts.
365
- *
366
- * @publicApi
367
- **/
368
- export declare abstract class UrlCodec {
369
- /**
370
- * Encodes the path from the provided string
371
- *
372
- * @param path The path string
373
- */
374
- abstract encodePath(path: string): string;
375
- /**
376
- * Decodes the path from the provided string
377
- *
378
- * @param path The path string
379
- */
380
- abstract decodePath(path: string): string;
381
- /**
382
- * Encodes the search string from the provided string or object
383
- *
384
- * @param path The path string or object
385
- */
386
- abstract encodeSearch(search: string | {
387
- [k: string]: unknown;
388
- }): string;
389
- /**
390
- * Decodes the search objects from the provided string
391
- *
392
- * @param path The path string
393
- */
394
- abstract decodeSearch(search: string): {
395
- [k: string]: unknown;
396
- };
397
- /**
398
- * Encodes the hash from the provided string
399
- *
400
- * @param path The hash string
401
- */
402
- abstract encodeHash(hash: string): string;
403
- /**
404
- * Decodes the hash from the provided string
405
- *
406
- * @param path The hash string
407
- */
408
- abstract decodeHash(hash: string): string;
409
- /**
410
- * Normalizes the URL from the provided string
411
- *
412
- * @param path The URL string
413
- */
414
- abstract normalize(href: string): string;
415
- /**
416
- * Normalizes the URL from the provided string, search, hash, and base URL parameters
417
- *
418
- * @param path The URL path
419
- * @param search The search object
420
- * @param hash The has string
421
- * @param baseUrl The base URL for the URL
422
- */
423
- abstract normalize(path: string, search: {
424
- [k: string]: unknown;
425
- }, hash: string, baseUrl?: string): string;
426
- /**
427
- * Checks whether the two strings are equal
428
- * @param valA First string for comparison
429
- * @param valB Second string for comparison
430
- */
431
- abstract areEqual(valA: string, valB: string): boolean;
432
- /**
433
- * Parses the URL string based on the base URL
434
- *
435
- * @param url The full URL string
436
- * @param base The base for the URL
437
- */
438
- abstract parse(url: string, base?: string): {
439
- href: string;
440
- protocol: string;
441
- host: string;
442
- search: string;
443
- hash: string;
444
- hostname: string;
445
- port: string;
446
- pathname: string;
447
- };
448
- }
449
-
450
- export { }
442
+ export { $locationShim, $locationShimProvider, AngularJSUrlCodec, LOCATION_UPGRADE_CONFIGURATION, type LocationUpgradeConfig, LocationUpgradeModule, UrlCodec };