@angular/router
Advanced tools
| /** | ||
| * @license Angular v21.1.1 | ||
| * @license Angular v21.2.0-next.0 | ||
| * (c) 2010-2026 Google LLC. https://angular.dev/ | ||
@@ -10,7 +10,67 @@ * License: MIT | ||
| import * as i0 from '@angular/core'; | ||
| import { signal, untracked, inject, ɵINTERNAL_APPLICATION_ERROR_HANDLER as _INTERNAL_APPLICATION_ERROR_HANDLER, HostAttributeToken, ɵRuntimeError as _RuntimeError, booleanAttribute, Directive, Attribute, HostBinding, Input, HostListener, EventEmitter, ContentChildren, Output, Injectable, createEnvironmentInjector, InjectionToken, NgZone, EnvironmentInjector, DestroyRef, afterNextRender, ɵpromiseWithResolvers as _promiseWithResolvers, ɵpublishExternalGlobalUtil as _publishExternalGlobalUtil, makeEnvironmentProviders, APP_BOOTSTRAP_LISTENER, provideEnvironmentInitializer, Injector, ApplicationRef, ɵIS_ENABLED_BLOCKING_INITIAL_NAVIGATION as _IS_ENABLED_BLOCKING_INITIAL_NAVIGATION, provideAppInitializer, ɵperformanceMarkFeature as _performanceMarkFeature, ENVIRONMENT_INITIALIZER, NgModule } from '@angular/core'; | ||
| import { ROUTER_CONFIGURATION, NavigationEnd, isUrlTree, Router, ActivatedRoute, isActive, exactMatchOptions, subsetMatchOptions, RouterConfigLoader, IMPERATIVE_NAVIGATION, UrlSerializer, NavigationTransitions, NavigationStart, NavigationSkipped, NavigationSkippedCode, Scroll, StateManager, RoutesRecognized, BeforeActivateRoutes, NavigationCancel, NavigationError, isRedirectingEvent, NavigationCancellationCode, ROUTES, afterNextNavigation, ROUTE_INJECTOR_CLEANUP, routeInjectorCleanup, stringifyEvent, NAVIGATION_ERROR_HANDLER, RoutedComponentInputBinder, INPUT_BINDER, CREATE_VIEW_TRANSITION, createViewTransition, VIEW_TRANSITION_OPTIONS, DefaultUrlSerializer, ChildrenOutletContexts, RouterOutlet, ɵEmptyOutletComponent as _EmptyOutletComponent } from './_router-chunk.mjs'; | ||
| import { inject, signal, Injectable, HostAttributeToken, linkedSignal, untracked, ɵINTERNAL_APPLICATION_ERROR_HANDLER as _INTERNAL_APPLICATION_ERROR_HANDLER, effect, ɵRuntimeError as _RuntimeError, computed, booleanAttribute, Directive, Attribute, Input, HostListener, EventEmitter, ContentChildren, Output, createEnvironmentInjector, InjectionToken, NgZone, EnvironmentInjector, DestroyRef, afterNextRender, ɵpromiseWithResolvers as _promiseWithResolvers, ɵpublishExternalGlobalUtil as _publishExternalGlobalUtil, makeEnvironmentProviders, APP_BOOTSTRAP_LISTENER, provideEnvironmentInitializer, Injector, ApplicationRef, ɵIS_ENABLED_BLOCKING_INITIAL_NAVIGATION as _IS_ENABLED_BLOCKING_INITIAL_NAVIGATION, provideAppInitializer, ɵperformanceMarkFeature as _performanceMarkFeature, ENVIRONMENT_INITIALIZER, NgModule } from '@angular/core'; | ||
| import { Router, StateManager, UrlSerializer, NavigationEnd, UrlTree, ROUTER_CONFIGURATION, isUrlTree, ActivatedRoute, isActive, exactMatchOptions, subsetMatchOptions, RouterConfigLoader, IMPERATIVE_NAVIGATION, NavigationTransitions, NavigationStart, NavigationSkipped, NavigationSkippedCode, Scroll, BeforeRoutesRecognized, BeforeActivateRoutes, NavigationCancel, NavigationError, isRedirectingEvent, NavigationCancellationCode, ROUTES, afterNextNavigation, ROUTE_INJECTOR_CLEANUP, routeInjectorCleanup, stringifyEvent, NAVIGATION_ERROR_HANDLER, RoutedComponentInputBinder, INPUT_BINDER, CREATE_VIEW_TRANSITION, createViewTransition, VIEW_TRANSITION_OPTIONS, DefaultUrlSerializer, ChildrenOutletContexts, RouterOutlet, ɵEmptyOutletComponent as _EmptyOutletComponent } from './_router-chunk.mjs'; | ||
| import { Subject, of, from } from 'rxjs'; | ||
| import { mergeAll, catchError, filter, concatMap, mergeMap } from 'rxjs/operators'; | ||
| class ReactiveRouterState { | ||
| router = inject(Router); | ||
| stateManager = inject(StateManager); | ||
| fragment = signal('', ...(ngDevMode ? [{ | ||
| debugName: "fragment" | ||
| }] : [])); | ||
| queryParams = signal({}, ...(ngDevMode ? [{ | ||
| debugName: "queryParams" | ||
| }] : [])); | ||
| path = signal('', ...(ngDevMode ? [{ | ||
| debugName: "path" | ||
| }] : [])); | ||
| serializer = inject(UrlSerializer); | ||
| constructor() { | ||
| this.updateState(); | ||
| this.router.events?.subscribe(e => { | ||
| if (e instanceof NavigationEnd) { | ||
| this.updateState(); | ||
| } | ||
| }); | ||
| } | ||
| updateState() { | ||
| const { | ||
| fragment, | ||
| root, | ||
| queryParams | ||
| } = this.stateManager.getCurrentUrlTree(); | ||
| this.fragment.set(fragment); | ||
| this.queryParams.set(queryParams); | ||
| this.path.set(this.serializer.serialize(new UrlTree(root))); | ||
| } | ||
| static ɵfac = i0.ɵɵngDeclareFactory({ | ||
| minVersion: "12.0.0", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
| type: ReactiveRouterState, | ||
| deps: [], | ||
| target: i0.ɵɵFactoryTarget.Injectable | ||
| }); | ||
| static ɵprov = i0.ɵɵngDeclareInjectable({ | ||
| minVersion: "12.0.0", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
| type: ReactiveRouterState, | ||
| providedIn: 'root' | ||
| }); | ||
| } | ||
| i0.ɵɵngDeclareClassMetadata({ | ||
| minVersion: "12.0.0", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
| type: ReactiveRouterState, | ||
| decorators: [{ | ||
| type: Injectable, | ||
| args: [{ | ||
| providedIn: 'root' | ||
| }] | ||
| }], | ||
| ctorParameters: () => [] | ||
| }); | ||
| class RouterLink { | ||
@@ -23,3 +83,11 @@ router; | ||
| locationStrategy; | ||
| reactiveHref = signal(null, ...(ngDevMode ? [{ | ||
| hrefAttributeValue = inject(new HostAttributeToken('href'), { | ||
| optional: true | ||
| }); | ||
| reactiveHref = linkedSignal(() => { | ||
| if (!this.isAnchorElement) { | ||
| return this.hrefAttributeValue; | ||
| } | ||
| return this.computeHref(this._urlTree()); | ||
| }, ...(ngDevMode ? [{ | ||
| debugName: "reactiveHref" | ||
@@ -33,11 +101,102 @@ }] : [])); | ||
| } | ||
| target; | ||
| queryParams; | ||
| fragment; | ||
| queryParamsHandling; | ||
| state; | ||
| info; | ||
| relativeTo; | ||
| set target(value) { | ||
| this._target.set(value); | ||
| } | ||
| get target() { | ||
| return untracked(this._target); | ||
| } | ||
| _target = signal(undefined, ...(ngDevMode ? [{ | ||
| debugName: "_target" | ||
| }] : [])); | ||
| set queryParams(value) { | ||
| this._queryParams.set(value); | ||
| } | ||
| get queryParams() { | ||
| return untracked(this._queryParams); | ||
| } | ||
| _queryParams = signal(undefined, { | ||
| ...(ngDevMode ? { | ||
| debugName: "_queryParams" | ||
| } : {}), | ||
| equal: () => false | ||
| }); | ||
| set fragment(value) { | ||
| this._fragment.set(value); | ||
| } | ||
| get fragment() { | ||
| return untracked(this._fragment); | ||
| } | ||
| _fragment = signal(undefined, ...(ngDevMode ? [{ | ||
| debugName: "_fragment" | ||
| }] : [])); | ||
| set queryParamsHandling(value) { | ||
| this._queryParamsHandling.set(value); | ||
| } | ||
| get queryParamsHandling() { | ||
| return untracked(this._queryParamsHandling); | ||
| } | ||
| _queryParamsHandling = signal(undefined, ...(ngDevMode ? [{ | ||
| debugName: "_queryParamsHandling" | ||
| }] : [])); | ||
| set state(value) { | ||
| this._state.set(value); | ||
| } | ||
| get state() { | ||
| return untracked(this._state); | ||
| } | ||
| _state = signal(undefined, { | ||
| ...(ngDevMode ? { | ||
| debugName: "_state" | ||
| } : {}), | ||
| equal: () => false | ||
| }); | ||
| set info(value) { | ||
| this._info.set(value); | ||
| } | ||
| get info() { | ||
| return untracked(this._info); | ||
| } | ||
| _info = signal(undefined, { | ||
| ...(ngDevMode ? { | ||
| debugName: "_info" | ||
| } : {}), | ||
| equal: () => false | ||
| }); | ||
| set relativeTo(value) { | ||
| this._relativeTo.set(value); | ||
| } | ||
| get relativeTo() { | ||
| return untracked(this._relativeTo); | ||
| } | ||
| _relativeTo = signal(undefined, ...(ngDevMode ? [{ | ||
| debugName: "_relativeTo" | ||
| }] : [])); | ||
| set preserveFragment(value) { | ||
| this._preserveFragment.set(value); | ||
| } | ||
| get preserveFragment() { | ||
| return untracked(this._preserveFragment); | ||
| } | ||
| _preserveFragment = signal(false, ...(ngDevMode ? [{ | ||
| debugName: "_preserveFragment" | ||
| }] : [])); | ||
| set skipLocationChange(value) { | ||
| this._skipLocationChange.set(value); | ||
| } | ||
| get skipLocationChange() { | ||
| return untracked(this._skipLocationChange); | ||
| } | ||
| _skipLocationChange = signal(false, ...(ngDevMode ? [{ | ||
| debugName: "_skipLocationChange" | ||
| }] : [])); | ||
| set replaceUrl(value) { | ||
| this._replaceUrl.set(value); | ||
| } | ||
| get replaceUrl() { | ||
| return untracked(this._replaceUrl); | ||
| } | ||
| _replaceUrl = signal(false, ...(ngDevMode ? [{ | ||
| debugName: "_replaceUrl" | ||
| }] : [])); | ||
| isAnchorElement; | ||
| subscription; | ||
| onChanges = new Subject(); | ||
@@ -48,2 +207,3 @@ applicationErrorHandler = inject(_INTERNAL_APPLICATION_ERROR_HANDLER); | ||
| }); | ||
| reactiveRouterState = inject(ReactiveRouterState); | ||
| constructor(router, route, tabIndexAttribute, renderer, el, locationStrategy) { | ||
@@ -56,25 +216,12 @@ this.router = router; | ||
| this.locationStrategy = locationStrategy; | ||
| this.reactiveHref.set(inject(new HostAttributeToken('href'), { | ||
| optional: true | ||
| })); | ||
| const tagName = el.nativeElement.tagName?.toLowerCase(); | ||
| this.isAnchorElement = tagName === 'a' || tagName === 'area' || !!(typeof customElements === 'object' && customElements.get(tagName)?.observedAttributes?.includes?.('href')); | ||
| if (this.isAnchorElement) { | ||
| this.setTabIndexIfNotOnNativeEl('0'); | ||
| this.subscribeToNavigationEventsIfNecessary(); | ||
| if (typeof ngDevMode !== 'undefined' && ngDevMode) { | ||
| effect(() => { | ||
| if (isUrlTree(this.routerLinkInput()) && (this._fragment() !== undefined || this._queryParams() || this._queryParamsHandling() || this._preserveFragment() || this._relativeTo())) { | ||
| throw new _RuntimeError(4017, 'Cannot configure queryParams or fragment when using a UrlTree as the routerLink input value.'); | ||
| } | ||
| }); | ||
| } | ||
| } | ||
| subscribeToNavigationEventsIfNecessary() { | ||
| if (this.subscription !== undefined) { | ||
| return; | ||
| } | ||
| this.subscription = this.router.events.subscribe(s => { | ||
| if (s instanceof NavigationEnd) { | ||
| this.updateHref(); | ||
| } | ||
| }); | ||
| } | ||
| preserveFragment = false; | ||
| skipLocationChange = false; | ||
| replaceUrl = false; | ||
| setTabIndexIfNotOnNativeEl(newTabIndex) { | ||
@@ -87,20 +234,16 @@ if (this.tabIndexAttribute != null || this.isAnchorElement) { | ||
| ngOnChanges(changes) { | ||
| if (ngDevMode && isUrlTree(this.routerLinkInput) && (this.fragment !== undefined || this.queryParams || this.queryParamsHandling || this.preserveFragment || this.relativeTo)) { | ||
| throw new _RuntimeError(4017, 'Cannot configure queryParams or fragment when using a UrlTree as the routerLink input value.'); | ||
| } | ||
| if (this.isAnchorElement) { | ||
| this.updateHref(); | ||
| } | ||
| this.onChanges.next(this); | ||
| } | ||
| routerLinkInput = null; | ||
| routerLinkInput = signal(null, ...(ngDevMode ? [{ | ||
| debugName: "routerLinkInput" | ||
| }] : [])); | ||
| set routerLink(commandsOrUrlTree) { | ||
| if (commandsOrUrlTree == null) { | ||
| this.routerLinkInput = null; | ||
| this.routerLinkInput.set(null); | ||
| this.setTabIndexIfNotOnNativeEl(null); | ||
| } else { | ||
| if (isUrlTree(commandsOrUrlTree)) { | ||
| this.routerLinkInput = commandsOrUrlTree; | ||
| this.routerLinkInput.set(commandsOrUrlTree); | ||
| } else { | ||
| this.routerLinkInput = Array.isArray(commandsOrUrlTree) ? commandsOrUrlTree : [commandsOrUrlTree]; | ||
| this.routerLinkInput.set(Array.isArray(commandsOrUrlTree) ? commandsOrUrlTree : [commandsOrUrlTree]); | ||
| } | ||
@@ -111,3 +254,3 @@ this.setTabIndexIfNotOnNativeEl('0'); | ||
| onClick(button, ctrlKey, shiftKey, altKey, metaKey) { | ||
| const urlTree = this.urlTree; | ||
| const urlTree = this._urlTree(); | ||
| if (urlTree === null) { | ||
@@ -135,9 +278,3 @@ return true; | ||
| } | ||
| ngOnDestroy() { | ||
| this.subscription?.unsubscribe(); | ||
| } | ||
| updateHref() { | ||
| const urlTree = this.urlTree; | ||
| this.reactiveHref.set(urlTree !== null && this.locationStrategy ? this.locationStrategy?.prepareExternalUrl(this.router.serializeUrl(urlTree)) ?? '' : null); | ||
| } | ||
| ngOnDestroy() {} | ||
| applyAttributeValue(attrName, attrValue) { | ||
@@ -152,19 +289,39 @@ const renderer = this.renderer; | ||
| } | ||
| get urlTree() { | ||
| if (this.routerLinkInput === null) { | ||
| _urlTree = computed(() => { | ||
| this.reactiveRouterState.path(); | ||
| if (this._preserveFragment()) { | ||
| this.reactiveRouterState.fragment(); | ||
| } | ||
| const shouldTrackParams = handling => handling === 'preserve' || handling === 'merge'; | ||
| if (shouldTrackParams(this._queryParamsHandling()) || shouldTrackParams(this.options?.defaultQueryParamsHandling)) { | ||
| this.reactiveRouterState.queryParams(); | ||
| } | ||
| const routerLinkInput = this.routerLinkInput(); | ||
| if (routerLinkInput === null || !this.router.createUrlTree) { | ||
| return null; | ||
| } else if (isUrlTree(this.routerLinkInput)) { | ||
| return this.routerLinkInput; | ||
| } else if (isUrlTree(routerLinkInput)) { | ||
| return routerLinkInput; | ||
| } | ||
| return this.router.createUrlTree(this.routerLinkInput, { | ||
| relativeTo: this.relativeTo !== undefined ? this.relativeTo : this.route, | ||
| queryParams: this.queryParams, | ||
| fragment: this.fragment, | ||
| queryParamsHandling: this.queryParamsHandling, | ||
| preserveFragment: this.preserveFragment | ||
| return this.router.createUrlTree(routerLinkInput, { | ||
| relativeTo: this._relativeTo() !== undefined ? this._relativeTo() : this.route, | ||
| queryParams: this._queryParams(), | ||
| fragment: this._fragment(), | ||
| queryParamsHandling: this._queryParamsHandling(), | ||
| preserveFragment: this._preserveFragment() | ||
| }); | ||
| }, { | ||
| ...(ngDevMode ? { | ||
| debugName: "_urlTree" | ||
| } : {}), | ||
| equal: (a, b) => this.computeHref(a) === this.computeHref(b) | ||
| }); | ||
| get urlTree() { | ||
| return untracked(this._urlTree); | ||
| } | ||
| computeHref(urlTree) { | ||
| return urlTree !== null && this.locationStrategy ? this.locationStrategy?.prepareExternalUrl(this.router.serializeUrl(urlTree)) ?? '' : null; | ||
| } | ||
| static ɵfac = i0.ɵɵngDeclareFactory({ | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -190,3 +347,3 @@ type: RouterLink, | ||
| minVersion: "16.1.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| type: RouterLink, | ||
@@ -214,3 +371,3 @@ isStandalone: true, | ||
| "attr.href": "reactiveHref()", | ||
| "attr.target": "this.target" | ||
| "attr.target": "_target()" | ||
| } | ||
@@ -224,3 +381,3 @@ }, | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -233,3 +390,4 @@ type: RouterLink, | ||
| host: { | ||
| '[attr.href]': 'reactiveHref()' | ||
| '[attr.href]': 'reactiveHref()', | ||
| '[attr.target]': '_target()' | ||
| } | ||
@@ -257,5 +415,2 @@ }] | ||
| target: [{ | ||
| type: HostBinding, | ||
| args: ['attr.target'] | ||
| }, { | ||
| type: Input | ||
@@ -407,3 +562,3 @@ }], | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -424,3 +579,3 @@ type: RouterLinkActive, | ||
| minVersion: "14.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| type: RouterLinkActive, | ||
@@ -449,3 +604,3 @@ isStandalone: true, | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -501,3 +656,3 @@ type: RouterLinkActive, | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -510,3 +665,3 @@ type: PreloadAllModules, | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -519,3 +674,3 @@ type: PreloadAllModules, | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -536,3 +691,3 @@ type: PreloadAllModules, | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -545,3 +700,3 @@ type: NoPreloading, | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -554,3 +709,3 @@ type: NoPreloading, | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -636,3 +791,3 @@ type: NoPreloading, | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -653,3 +808,3 @@ type: RouterPreloader, | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -662,3 +817,3 @@ type: RouterPreloader, | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -765,3 +920,3 @@ type: RouterPreloader, | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -774,3 +929,3 @@ type: RouterScroller, | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -782,3 +937,3 @@ type: RouterScroller | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -839,3 +994,5 @@ type: RouterScroller, | ||
| }) => { | ||
| listener(path, state, 'popstate'); | ||
| listener(path, state, 'popstate', !this.precommitHandlerSupported ? { | ||
| replaceUrl: true | ||
| } : {}); | ||
| }); | ||
@@ -851,15 +1008,38 @@ return this.nonRouterEntryChangeListener; | ||
| this.updateStateMemento(); | ||
| if (this.precommitHandlerSupported) { | ||
| this.maybeCreateNavigationForTransition(transition); | ||
| } | ||
| } else if (e instanceof NavigationSkipped) { | ||
| this.finishNavigation(); | ||
| this.commitTransition(transition); | ||
| } else if (e instanceof RoutesRecognized) { | ||
| if (this.urlUpdateStrategy === 'eager' && !transition.extras.skipLocationChange) { | ||
| this.createNavigationForTransition(transition); | ||
| } | ||
| } else if (e instanceof BeforeRoutesRecognized) { | ||
| transition.routesRecognizeHandler.deferredHandle = new Promise(async resolve => { | ||
| if (this.urlUpdateStrategy === 'eager') { | ||
| try { | ||
| this.maybeCreateNavigationForTransition(transition); | ||
| await this.currentNavigation.commitUrl?.(); | ||
| } catch { | ||
| return; | ||
| } | ||
| } | ||
| resolve(); | ||
| }); | ||
| } else if (e instanceof BeforeActivateRoutes) { | ||
| this.commitTransition(transition); | ||
| if (this.urlUpdateStrategy === 'deferred' && !transition.extras.skipLocationChange) { | ||
| this.createNavigationForTransition(transition); | ||
| transition.beforeActivateHandler.deferredHandle = new Promise(async resolve => { | ||
| if (this.urlUpdateStrategy === 'deferred') { | ||
| try { | ||
| this.maybeCreateNavigationForTransition(transition); | ||
| await this.currentNavigation.commitUrl?.(); | ||
| } catch { | ||
| return; | ||
| } | ||
| } | ||
| this.commitTransition(transition); | ||
| resolve(); | ||
| }); | ||
| } else if (e instanceof NavigationCancel || e instanceof NavigationError) { | ||
| const redirectingBeforeUrlCommit = e instanceof NavigationCancel && e.code === NavigationCancellationCode.Redirect && !!this.currentNavigation.commitUrl; | ||
| if (redirectingBeforeUrlCommit) { | ||
| return; | ||
| } | ||
| } else if (e instanceof NavigationCancel || e instanceof NavigationError) { | ||
| void this.cancel(transition, e); | ||
@@ -881,7 +1061,8 @@ } else if (e instanceof NavigationEnd) { | ||
| } | ||
| createNavigationForTransition(transition) { | ||
| maybeCreateNavigationForTransition(transition) { | ||
| const { | ||
| navigationEvent | ||
| navigationEvent, | ||
| commitUrl | ||
| } = this.currentNavigation; | ||
| if (navigationEvent && (navigationEvent.navigationType === 'traverse' || navigationEvent.navigationType === 'reload') && this.eventAndRouterDestinationsMatch(navigationEvent, transition)) { | ||
| if (commitUrl || navigationEvent && (navigationEvent.navigationType === 'traverse' || navigationEvent.navigationType === 'reload') && this.eventAndRouterDestinationsMatch(navigationEvent, transition)) { | ||
| return; | ||
@@ -915,2 +1096,3 @@ } | ||
| finishNavigation() { | ||
| this.currentNavigation.commitUrl?.(); | ||
| this.currentNavigation?.resolveHandler?.(); | ||
@@ -998,2 +1180,12 @@ this.currentNavigation = {}; | ||
| } = _promiseWithResolvers(); | ||
| const { | ||
| promise: precommitHandlerPromise, | ||
| resolve: resolvePrecommitHandler, | ||
| reject: rejectPrecommitHandler | ||
| } = _promiseWithResolvers(); | ||
| this.currentNavigation.rejectNavigateEvent = () => { | ||
| event.signal.removeEventListener('abort', abortHandler); | ||
| rejectPrecommitHandler(); | ||
| rejectHandler(); | ||
| }; | ||
| this.currentNavigation.resolveHandler = () => { | ||
@@ -1003,8 +1195,32 @@ this.currentNavigation.removeAbortListener?.(); | ||
| }; | ||
| this.currentNavigation.rejectNavigateEvent = () => { | ||
| this.currentNavigation.removeAbortListener?.(); | ||
| rejectHandler(); | ||
| }; | ||
| handlerPromise.catch(() => {}); | ||
| precommitHandlerPromise.catch(() => {}); | ||
| interceptOptions.handler = () => handlerPromise; | ||
| if (this.deferredCommitSupported(event)) { | ||
| const redirect = new Promise(resolve => { | ||
| interceptOptions.precommitHandler = controller => { | ||
| resolve(controller.redirect.bind(controller)); | ||
| return precommitHandlerPromise; | ||
| }; | ||
| }); | ||
| this.currentNavigation.commitUrl = async () => { | ||
| this.currentNavigation.commitUrl = undefined; | ||
| const transition = this.currentNavigation.routerTransition; | ||
| if (transition && !transition.extras.skipLocationChange) { | ||
| const internalPath = this.createBrowserPath(transition); | ||
| const history = this.location.isCurrentPathEqualTo(internalPath) || !!transition.extras.replaceUrl ? 'replace' : 'push'; | ||
| const state = { | ||
| ...transition.extras.state, | ||
| navigationId: transition.id | ||
| }; | ||
| const pathOrUrl = this.location.prepareExternalUrl(internalPath); | ||
| (await redirect)(pathOrUrl, { | ||
| state, | ||
| history | ||
| }); | ||
| } | ||
| resolvePrecommitHandler(); | ||
| return await this.navigation.transition?.committed; | ||
| }; | ||
| } | ||
| event.intercept(interceptOptions); | ||
@@ -1029,5 +1245,8 @@ if (!isTriggeredByRouterTransition) { | ||
| } | ||
| deferredCommitSupported(event) { | ||
| return this.precommitHandlerSupported && event.cancelable && event.navigationType !== 'traverse'; | ||
| } | ||
| static ɵfac = i0.ɵɵngDeclareFactory({ | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -1040,3 +1259,3 @@ type: NavigationStateManager, | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -1049,3 +1268,3 @@ type: NavigationStateManager, | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -1349,3 +1568,3 @@ type: NavigationStateManager, | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -1358,3 +1577,3 @@ type: RouterModule, | ||
| minVersion: "14.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -1367,3 +1586,3 @@ type: RouterModule, | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -1375,3 +1594,3 @@ type: RouterModule | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -1378,0 +1597,0 @@ type: RouterModule, |
| /** | ||
| * @license Angular v21.1.1 | ||
| * @license Angular v21.2.0-next.0 | ||
| * (c) 2010-2026 Google LLC. https://angular.dev/ | ||
@@ -31,5 +31,5 @@ * License: MIT | ||
| const VERSION = /* @__PURE__ */new Version('21.1.1'); | ||
| const VERSION = /* @__PURE__ */new Version('21.2.0-next.0'); | ||
| export { VERSION, mapToCanActivate, mapToCanActivateChild, mapToCanDeactivate, mapToCanMatch, mapToResolve }; | ||
| //# sourceMappingURL=router.mjs.map |
+11
-11
| /** | ||
| * @license Angular v21.1.1 | ||
| * @license Angular v21.2.0-next.0 | ||
| * (c) 2010-2026 Google LLC. https://angular.dev/ | ||
@@ -36,3 +36,3 @@ * License: MIT | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -45,3 +45,3 @@ type: RouterTestingModule, | ||
| minVersion: "14.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -53,3 +53,3 @@ type: RouterTestingModule, | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -67,3 +67,3 @@ type: RouterTestingModule, | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -104,3 +104,3 @@ type: RouterTestingModule, | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -113,3 +113,3 @@ type: RootFixtureService, | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -122,3 +122,3 @@ type: RootFixtureService, | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -140,3 +140,3 @@ type: RootFixtureService, | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -149,3 +149,3 @@ type: RootCmp, | ||
| minVersion: "14.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| type: RootCmp, | ||
@@ -175,3 +175,3 @@ isStandalone: true, | ||
| minVersion: "12.0.0", | ||
| version: "21.1.1", | ||
| version: "21.2.0-next.0", | ||
| ngImport: i0, | ||
@@ -178,0 +178,0 @@ type: RootCmp, |
| /** | ||
| * @license Angular v21.1.1 | ||
| * @license Angular v21.2.0-next.0 | ||
| * (c) 2010-2026 Google LLC. https://angular.dev/ | ||
@@ -4,0 +4,0 @@ * License: MIT |
+4
-4
| { | ||
| "name": "@angular/router", | ||
| "version": "21.1.1", | ||
| "version": "21.2.0-next.0", | ||
| "description": "Angular - the routing library", | ||
@@ -30,5 +30,5 @@ "keywords": [ | ||
| "peerDependencies": { | ||
| "@angular/core": "21.1.1", | ||
| "@angular/common": "21.1.1", | ||
| "@angular/platform-browser": "21.1.1", | ||
| "@angular/core": "21.2.0-next.0", | ||
| "@angular/common": "21.2.0-next.0", | ||
| "@angular/platform-browser": "21.2.0-next.0", | ||
| "rxjs": "^6.5.3 || ^7.4.0" | ||
@@ -35,0 +35,0 @@ }, |
| /** | ||
| * @license Angular v21.1.1 | ||
| * @license Angular v21.2.0-next.0 | ||
| * (c) 2010-2026 Google LLC. https://angular.dev/ | ||
@@ -4,0 +4,0 @@ * License: MIT |
| /** | ||
| * @license Angular v21.1.1 | ||
| * @license Angular v21.2.0-next.0 | ||
| * (c) 2010-2026 Google LLC. https://angular.dev/ | ||
@@ -4,0 +4,0 @@ * License: MIT |
| /** | ||
| * @license Angular v21.1.1 | ||
| * @license Angular v21.2.0-next.0 | ||
| * (c) 2010-2026 Google LLC. https://angular.dev/ | ||
@@ -4,0 +4,0 @@ * License: MIT |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
1200033
2.27%11862
2.21%1
Infinity%