@angular/router 21.1.0-next.4 → 21.1.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/LICENSE +1 -1
- package/fesm2022/_router-chunk.mjs +190 -532
- package/fesm2022/_router-chunk.mjs.map +1 -1
- package/fesm2022/_router_module-chunk.mjs +59 -52
- package/fesm2022/_router_module-chunk.mjs.map +1 -1
- package/fesm2022/router.mjs +5 -5
- package/fesm2022/router.mjs.map +1 -1
- package/fesm2022/testing.mjs +12 -12
- package/fesm2022/upgrade.mjs +2 -2
- package/package.json +4 -4
- package/types/_router_module-chunk.d.ts +2729 -2693
- package/types/router.d.ts +110 -63
- package/types/testing.d.ts +2 -2
- package/types/upgrade.d.ts +2 -2
package/types/router.d.ts
CHANGED
|
@@ -1,17 +1,61 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v21.1.0
|
|
3
|
-
* (c) 2010-
|
|
2
|
+
* @license Angular v21.1.0
|
|
3
|
+
* (c) 2010-2026 Google LLC. https://angular.dev/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { ActivatedRouteSnapshot, Params, DefaultUrlSerializer, UrlTree,
|
|
8
|
-
export { ActivationEnd, ActivationStart, BaseRouteReuseStrategy, CanLoad, CanLoadFn, ChildActivationEnd, ChildActivationStart, Data, DefaultExport, DeprecatedGuard, DeprecatedResolve, DetachedRouteHandle, EventType, ExtraOptions, GuardResult, GuardsCheckEnd, GuardsCheckStart, InitialNavigation, IsActiveMatchOptions, LoadChildren, LoadChildrenCallback, MaybeAsync, Navigation, NavigationBehaviorOptions, NavigationCancel, NavigationCancellationCode, NavigationEnd, NavigationExtras, NavigationSkipped, NavigationSkippedCode, NavigationStart, OnSameUrlNavigation, PRIMARY_OUTLET, ParamMap, QueryParamsHandling, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTER_OUTLET_DATA, RedirectFunction, ResolveData, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, RouterEvent, RouterLink, RouterLinkActive, RouterLink as RouterLinkWithHref, RouterModule, RouterOutlet, RouterState, RoutesRecognized, RunGuardsAndResolvers, Scroll, UrlCreationOptions, UrlMatchResult, UrlMatcher, UrlSegment, UrlSegmentGroup, UrlSerializer, convertToParamMap, defaultUrlMatcher, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, RestoredState as ɵRestoredState } from './_router_module-chunk.js';
|
|
7
|
+
import { RouterOutletContract, ActivatedRoute, ActivatedRouteSnapshot, Params, DefaultUrlSerializer, UrlTree, RouterStateSnapshot, Route, LoadedRouterConfig, Router, Routes, InMemoryScrollingOptions, RouterConfigOptions, NavigationError, RedirectCommand, CanMatch, CanMatchFn, CanActivate, CanActivateFn, CanActivateChild, CanActivateChildFn, CanDeactivate, CanDeactivateFn, Resolve, ResolveFn, Event } from './_router_module-chunk.js';
|
|
8
|
+
export { ActivationEnd, ActivationStart, BaseRouteReuseStrategy, CanLoad, CanLoadFn, ChildActivationEnd, ChildActivationStart, Data, DefaultExport, DeprecatedGuard, DeprecatedResolve, DetachedRouteHandle, EventType, ExtraOptions, GuardResult, GuardsCheckEnd, GuardsCheckStart, InitialNavigation, IsActiveMatchOptions, LoadChildren, LoadChildrenCallback, MaybeAsync, Navigation, NavigationBehaviorOptions, NavigationCancel, NavigationCancellationCode, NavigationEnd, NavigationExtras, NavigationSkipped, NavigationSkippedCode, NavigationStart, OnSameUrlNavigation, PRIMARY_OUTLET, ParamMap, QueryParamsHandling, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTER_OUTLET_DATA, RedirectFunction, ResolveData, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, RouterEvent, RouterLink, RouterLinkActive, RouterLink as RouterLinkWithHref, RouterModule, RouterOutlet, RouterState, RoutesRecognized, RunGuardsAndResolvers, Scroll, UrlCreationOptions, UrlMatchResult, UrlMatcher, UrlSegment, UrlSegmentGroup, UrlSerializer, convertToParamMap, defaultUrlMatcher, destroyDetachedRouteHandle, isActive, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, RestoredState as ɵRestoredState } from './_router_module-chunk.js';
|
|
9
9
|
import { Title } from '@angular/platform-browser';
|
|
10
10
|
import * as i0 from '@angular/core';
|
|
11
11
|
import { ComponentRef, EnvironmentInjector, InjectionToken, Compiler, Injector, Type, OnDestroy, EnvironmentProviders, Provider, Version } from '@angular/core';
|
|
12
12
|
import { Observable } from 'rxjs';
|
|
13
13
|
import '@angular/common';
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Store contextual information about a `RouterOutlet`
|
|
17
|
+
*
|
|
18
|
+
* @publicApi
|
|
19
|
+
*/
|
|
20
|
+
declare class OutletContext {
|
|
21
|
+
private readonly rootInjector;
|
|
22
|
+
outlet: RouterOutletContract | null;
|
|
23
|
+
route: ActivatedRoute | null;
|
|
24
|
+
children: ChildrenOutletContexts;
|
|
25
|
+
attachRef: ComponentRef<any> | null;
|
|
26
|
+
get injector(): EnvironmentInjector;
|
|
27
|
+
constructor(rootInjector: EnvironmentInjector);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Store contextual information about the children (= nested) `RouterOutlet`
|
|
31
|
+
*
|
|
32
|
+
* @publicApi
|
|
33
|
+
*/
|
|
34
|
+
declare class ChildrenOutletContexts {
|
|
35
|
+
private rootInjector;
|
|
36
|
+
private contexts;
|
|
37
|
+
/** @docs-private */
|
|
38
|
+
constructor(rootInjector: EnvironmentInjector);
|
|
39
|
+
/** Called when a `RouterOutlet` directive is instantiated */
|
|
40
|
+
onChildOutletCreated(childName: string, outlet: RouterOutletContract): void;
|
|
41
|
+
/**
|
|
42
|
+
* Called when a `RouterOutlet` directive is destroyed.
|
|
43
|
+
* We need to keep the context as the outlet could be destroyed inside a NgIf and might be
|
|
44
|
+
* re-created later.
|
|
45
|
+
*/
|
|
46
|
+
onChildOutletDestroyed(childName: string): void;
|
|
47
|
+
/**
|
|
48
|
+
* Called when the corresponding route is deactivated during navigation.
|
|
49
|
+
* Because the component get destroyed, all children outlet are destroyed.
|
|
50
|
+
*/
|
|
51
|
+
onOutletDeactivated(): Map<string, OutletContext>;
|
|
52
|
+
onOutletReAttached(contexts: Map<string, OutletContext>): void;
|
|
53
|
+
getOrCreateContext(childName: string): OutletContext;
|
|
54
|
+
getContext(childName: string): OutletContext | null;
|
|
55
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ChildrenOutletContexts, never>;
|
|
56
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ChildrenOutletContexts>;
|
|
57
|
+
}
|
|
58
|
+
|
|
15
59
|
/**
|
|
16
60
|
* Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.
|
|
17
61
|
*
|
|
@@ -68,50 +112,6 @@ import '@angular/common';
|
|
|
68
112
|
*/
|
|
69
113
|
declare function createUrlTreeFromSnapshot(relativeTo: ActivatedRouteSnapshot, commands: readonly any[], queryParams?: Params | null, fragment?: string | null, urlSerializer?: DefaultUrlSerializer): UrlTree;
|
|
70
114
|
|
|
71
|
-
/**
|
|
72
|
-
* Store contextual information about a `RouterOutlet`
|
|
73
|
-
*
|
|
74
|
-
* @publicApi
|
|
75
|
-
*/
|
|
76
|
-
declare class OutletContext {
|
|
77
|
-
private readonly rootInjector;
|
|
78
|
-
outlet: RouterOutletContract | null;
|
|
79
|
-
route: ActivatedRoute | null;
|
|
80
|
-
children: ChildrenOutletContexts;
|
|
81
|
-
attachRef: ComponentRef<any> | null;
|
|
82
|
-
get injector(): EnvironmentInjector;
|
|
83
|
-
constructor(rootInjector: EnvironmentInjector);
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Store contextual information about the children (= nested) `RouterOutlet`
|
|
87
|
-
*
|
|
88
|
-
* @publicApi
|
|
89
|
-
*/
|
|
90
|
-
declare class ChildrenOutletContexts {
|
|
91
|
-
private rootInjector;
|
|
92
|
-
private contexts;
|
|
93
|
-
/** @docs-private */
|
|
94
|
-
constructor(rootInjector: EnvironmentInjector);
|
|
95
|
-
/** Called when a `RouterOutlet` directive is instantiated */
|
|
96
|
-
onChildOutletCreated(childName: string, outlet: RouterOutletContract): void;
|
|
97
|
-
/**
|
|
98
|
-
* Called when a `RouterOutlet` directive is destroyed.
|
|
99
|
-
* We need to keep the context as the outlet could be destroyed inside a NgIf and might be
|
|
100
|
-
* re-created later.
|
|
101
|
-
*/
|
|
102
|
-
onChildOutletDestroyed(childName: string): void;
|
|
103
|
-
/**
|
|
104
|
-
* Called when the corresponding route is deactivated during navigation.
|
|
105
|
-
* Because the component get destroyed, all children outlet are destroyed.
|
|
106
|
-
*/
|
|
107
|
-
onOutletDeactivated(): Map<string, OutletContext>;
|
|
108
|
-
onOutletReAttached(contexts: Map<string, OutletContext>): void;
|
|
109
|
-
getOrCreateContext(childName: string): OutletContext;
|
|
110
|
-
getContext(childName: string): OutletContext | null;
|
|
111
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ChildrenOutletContexts, never>;
|
|
112
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<ChildrenOutletContexts>;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
115
|
/**
|
|
116
116
|
* Options to configure the View Transitions integration in the Router.
|
|
117
117
|
*
|
|
@@ -426,13 +426,34 @@ type InMemoryScrollingFeature = RouterFeature<RouterFeatureKind.InMemoryScrollin
|
|
|
426
426
|
*/
|
|
427
427
|
declare function withInMemoryScrolling(options?: InMemoryScrollingOptions): InMemoryScrollingFeature;
|
|
428
428
|
/**
|
|
429
|
-
*
|
|
429
|
+
* A type alias for providers returned by `withExperimentalPlatformNavigation` for use with `provideRouter`.
|
|
430
|
+
*
|
|
431
|
+
* @see {@link withExperimentalPlatformNavigation}
|
|
432
|
+
* @see {@link provideRouter}
|
|
433
|
+
*
|
|
434
|
+
* @experimental 21.1
|
|
435
|
+
*/
|
|
436
|
+
type ExperimentalPlatformNavigationFeature = RouterFeature<RouterFeatureKind.ExperimentalPlatformNavigationFeature>;
|
|
437
|
+
/**
|
|
438
|
+
* Enables interop with the browser's `Navigation` API for router navigations.
|
|
430
439
|
*
|
|
431
440
|
* @description
|
|
432
|
-
*
|
|
433
|
-
*
|
|
434
|
-
*
|
|
435
|
-
*
|
|
441
|
+
*
|
|
442
|
+
* CRITICAL: This feature is _highly_ experimental and should not be used in production. Browser support
|
|
443
|
+
* is limited and in active development. Use only for experimentation and feedback purposes.
|
|
444
|
+
*
|
|
445
|
+
* This function provides a `Location` strategy that uses the browser's `Navigation` API.
|
|
446
|
+
* By using the platform's Navigation APIs, the Router is able to provide native
|
|
447
|
+
* browser navigation capabilities. Some advantages include:
|
|
448
|
+
*
|
|
449
|
+
* - The ability to intercept navigations triggered outside the Router. This allows plain anchor
|
|
450
|
+
* elements _without_ `RouterLink` directives to be intercepted by the Router and converted to SPA navigations.
|
|
451
|
+
* - Native scroll and focus restoration support by the browser, without the need for custom implementations.
|
|
452
|
+
* - Communication of ongoing navigations to the browser, enabling built-in features like
|
|
453
|
+
* accessibility announcements, loading indicators, stop buttons, and performance measurement APIs.
|
|
454
|
+
|
|
455
|
+
* NOTE: Deferred entry updates are not part of the interop 2025 Navigation API commitments so the "ongoing navigation"
|
|
456
|
+
* communication support is limited.
|
|
436
457
|
*
|
|
437
458
|
* @usageNotes
|
|
438
459
|
*
|
|
@@ -443,14 +464,19 @@ declare function withInMemoryScrolling(options?: InMemoryScrollingOptions): InMe
|
|
|
443
464
|
*
|
|
444
465
|
* bootstrapApplication(AppComponent, {
|
|
445
466
|
* providers: [
|
|
446
|
-
* provideRouter(appRoutes,
|
|
467
|
+
* provideRouter(appRoutes, withExperimentalPlatformNavigation())
|
|
447
468
|
* ]
|
|
448
469
|
* });
|
|
449
470
|
* ```
|
|
450
471
|
*
|
|
472
|
+
* @see https://github.com/WICG/navigation-api?tab=readme-ov-file#problem-statement
|
|
473
|
+
* @see https://developer.chrome.com/docs/web-platform/navigation-api/
|
|
474
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Navigation_API
|
|
475
|
+
*
|
|
476
|
+
* @experimental 21.1
|
|
451
477
|
* @returns A `RouterFeature` that enables the platform navigation.
|
|
452
478
|
*/
|
|
453
|
-
declare function
|
|
479
|
+
declare function withExperimentalPlatformNavigation(): ExperimentalPlatformNavigationFeature;
|
|
454
480
|
/**
|
|
455
481
|
* A type alias for providers returned by `withEnabledBlockingInitialNavigation` for use with
|
|
456
482
|
* `provideRouter`.
|
|
@@ -728,6 +754,30 @@ type NavigationErrorHandlerFeature = RouterFeature<RouterFeatureKind.NavigationE
|
|
|
728
754
|
* @publicApi
|
|
729
755
|
*/
|
|
730
756
|
declare function withNavigationErrorHandler(handler: (error: NavigationError) => unknown | RedirectCommand): NavigationErrorHandlerFeature;
|
|
757
|
+
/**
|
|
758
|
+
* A type alias for providers returned by `withExperimentalAutoCleanupInjectors` for use with `provideRouter`.
|
|
759
|
+
*
|
|
760
|
+
* @see {@link withExperimentalAutoCleanupInjectors}
|
|
761
|
+
* @see {@link provideRouter}
|
|
762
|
+
*
|
|
763
|
+
* @experimental 21.1
|
|
764
|
+
*/
|
|
765
|
+
type ExperimentalAutoCleanupInjectorsFeature = RouterFeature<RouterFeatureKind.ExperimentalAutoCleanupInjectorsFeature>;
|
|
766
|
+
/**
|
|
767
|
+
* Enables automatic destruction of unused route injectors.
|
|
768
|
+
*
|
|
769
|
+
* @description
|
|
770
|
+
*
|
|
771
|
+
* When enabled, the router will automatically destroy `EnvironmentInjector`s associated with `Route`s
|
|
772
|
+
* that are no longer active or stored by the `RouteReuseStrategy`.
|
|
773
|
+
*
|
|
774
|
+
* This feature is opt-in and requires `RouteReuseStrategy.shouldDestroyInjector` to return `true`
|
|
775
|
+
* for the routes that should be destroyed. If the `RouteReuseStrategy` uses stored handles, it
|
|
776
|
+
* should also implement `retrieveStoredHandle` to ensure we don't destroy injectors for handles that will be reattached.
|
|
777
|
+
*
|
|
778
|
+
* @experimental 21.1
|
|
779
|
+
*/
|
|
780
|
+
declare function withExperimentalAutoCleanupInjectors(): ExperimentalAutoCleanupInjectorsFeature;
|
|
731
781
|
/**
|
|
732
782
|
* A type alias for providers returned by `withComponentInputBinding` for use with `provideRouter`.
|
|
733
783
|
*
|
|
@@ -824,7 +874,7 @@ declare function withViewTransitions(options?: ViewTransitionsFeatureOptions): V
|
|
|
824
874
|
*
|
|
825
875
|
* @publicApi
|
|
826
876
|
*/
|
|
827
|
-
type RouterFeatures = PreloadingFeature | DebugTracingFeature | InitialNavigationFeature | InMemoryScrollingFeature | RouterConfigurationFeature | NavigationErrorHandlerFeature | ComponentInputBindingFeature | ViewTransitionsFeature | RouterHashLocationFeature;
|
|
877
|
+
type RouterFeatures = PreloadingFeature | DebugTracingFeature | InitialNavigationFeature | InMemoryScrollingFeature | RouterConfigurationFeature | NavigationErrorHandlerFeature | ComponentInputBindingFeature | ViewTransitionsFeature | ExperimentalAutoCleanupInjectorsFeature | RouterHashLocationFeature | ExperimentalPlatformNavigationFeature;
|
|
828
878
|
/**
|
|
829
879
|
* The list of features as an enum to uniquely type each feature.
|
|
830
880
|
*/
|
|
@@ -838,7 +888,9 @@ declare const enum RouterFeatureKind {
|
|
|
838
888
|
RouterHashLocationFeature = 6,
|
|
839
889
|
NavigationErrorHandlerFeature = 7,
|
|
840
890
|
ComponentInputBindingFeature = 8,
|
|
841
|
-
ViewTransitionsFeature = 9
|
|
891
|
+
ViewTransitionsFeature = 9,
|
|
892
|
+
ExperimentalAutoCleanupInjectorsFeature = 10,
|
|
893
|
+
ExperimentalPlatformNavigationFeature = 11
|
|
842
894
|
}
|
|
843
895
|
|
|
844
896
|
/**
|
|
@@ -948,10 +1000,5 @@ declare function afterNextNavigation(router: {
|
|
|
948
1000
|
events: Observable<Event>;
|
|
949
1001
|
}, action: () => void): void;
|
|
950
1002
|
|
|
951
|
-
|
|
952
|
-
* Provides a way to use the synchronous version of the recognize function using rxjs.
|
|
953
|
-
*/
|
|
954
|
-
declare function provideSometimesSyncRecognize(): EnvironmentProviders;
|
|
955
|
-
|
|
956
|
-
export { ActivatedRoute, ActivatedRouteSnapshot, CanActivate, CanActivateChild, CanActivateChildFn, CanActivateFn, CanDeactivate, CanDeactivateFn, CanMatch, CanMatchFn, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, Event, InMemoryScrollingOptions, NavigationError, NoPreloading, OutletContext, Params, PreloadAllModules, PreloadingStrategy, ROUTES, RedirectCommand, Resolve, ResolveFn, Route, Router, RouterConfigOptions, RouterOutletContract, RouterPreloader, RouterStateSnapshot, Routes, TitleStrategy, UrlHandlingStrategy, UrlTree, VERSION, createUrlTreeFromSnapshot, mapToCanActivate, mapToCanActivateChild, mapToCanDeactivate, mapToCanMatch, mapToResolve, provideRouter, provideRoutes, withComponentInputBinding, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withHashLocation, withInMemoryScrolling, withNavigationErrorHandler, withPreloading, withRouterConfig, withViewTransitions, afterNextNavigation as ɵafterNextNavigation, loadChildren as ɵloadChildren, provideSometimesSyncRecognize as ɵprovideSometimesSyncRecognize, withPlatformNavigation as ɵwithPlatformNavigation };
|
|
1003
|
+
export { ActivatedRoute, ActivatedRouteSnapshot, CanActivate, CanActivateChild, CanActivateChildFn, CanActivateFn, CanDeactivate, CanDeactivateFn, CanMatch, CanMatchFn, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, Event, InMemoryScrollingOptions, NavigationError, NoPreloading, OutletContext, Params, PreloadAllModules, PreloadingStrategy, ROUTES, RedirectCommand, Resolve, ResolveFn, Route, Router, RouterConfigOptions, RouterOutletContract, RouterPreloader, RouterStateSnapshot, Routes, TitleStrategy, UrlHandlingStrategy, UrlTree, VERSION, createUrlTreeFromSnapshot, mapToCanActivate, mapToCanActivateChild, mapToCanDeactivate, mapToCanMatch, mapToResolve, provideRouter, provideRoutes, withComponentInputBinding, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withExperimentalAutoCleanupInjectors, withExperimentalPlatformNavigation, withHashLocation, withInMemoryScrolling, withNavigationErrorHandler, withPreloading, withRouterConfig, withViewTransitions, afterNextNavigation as ɵafterNextNavigation, loadChildren as ɵloadChildren };
|
|
957
1004
|
export type { ComponentInputBindingFeature, DebugTracingFeature, DisabledInitialNavigationFeature, EnabledBlockingInitialNavigationFeature, InMemoryScrollingFeature, InitialNavigationFeature, NavigationErrorHandlerFeature, PreloadingFeature, RouterConfigurationFeature, RouterFeature, RouterFeatures, RouterHashLocationFeature, ViewTransitionInfo, ViewTransitionsFeature, ViewTransitionsFeatureOptions };
|
package/types/testing.d.ts
CHANGED
package/types/upgrade.d.ts
CHANGED