@angular/router 20.0.0-rc.0 → 20.0.0-rc.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.
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license Angular v20.0.0-rc.0
2
+ * @license Angular v20.0.0-rc.2
3
3
  * (c) 2010-2025 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
- export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, EventType, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationCancellationCode, NavigationEnd, NavigationError, NavigationSkipped, NavigationSkippedCode, NavigationStart, OutletContext, PRIMARY_OUTLET, ROUTER_CONFIGURATION, ROUTER_OUTLET_DATA, ROUTES, RedirectCommand, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterOutlet, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, ɵEmptyOutletComponent, afterNextNavigation as ɵafterNextNavigation, loadChildren as ɵloadChildren } from './router-DzCroPjt.mjs';
8
- export { NoPreloading, PreloadAllModules, PreloadingStrategy, ROUTER_INITIALIZER, RouterLink, RouterLinkActive, RouterLink as RouterLinkWithHref, RouterModule, RouterPreloader, provideRouter, provideRoutes, withComponentInputBinding, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withHashLocation, withInMemoryScrolling, withNavigationErrorHandler, withPreloading, withRouterConfig, withViewTransitions, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS } from './router_module-CrXLirsg.mjs';
7
+ export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, EventType, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationCancellationCode, NavigationEnd, NavigationError, NavigationSkipped, NavigationSkippedCode, NavigationStart, OutletContext, PRIMARY_OUTLET, ROUTER_CONFIGURATION, ROUTER_OUTLET_DATA, ROUTES, RedirectCommand, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterOutlet, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, ɵEmptyOutletComponent, afterNextNavigation as ɵafterNextNavigation, loadChildren as ɵloadChildren } from './router-BCAMvkKO.mjs';
8
+ export { NoPreloading, PreloadAllModules, PreloadingStrategy, ROUTER_INITIALIZER, RouterLink, RouterLinkActive, RouterLink as RouterLinkWithHref, RouterModule, RouterPreloader, provideRouter, provideRoutes, withComponentInputBinding, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withHashLocation, withInMemoryScrolling, withNavigationErrorHandler, withPreloading, withRouterConfig, withViewTransitions, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS } from './router_module-CmZ6FD0-.mjs';
9
9
  import { inject, Version } from '@angular/core';
10
10
  import '@angular/common';
11
11
  import 'rxjs';
@@ -81,7 +81,7 @@ function mapToResolve(provider) {
81
81
  /**
82
82
  * @publicApi
83
83
  */
84
- const VERSION = new Version('20.0.0-rc.0');
84
+ const VERSION = new Version('20.0.0-rc.2');
85
85
 
86
86
  export { VERSION, mapToCanActivate, mapToCanActivateChild, mapToCanDeactivate, mapToCanMatch, mapToResolve };
87
87
  //# sourceMappingURL=router.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"router.mjs","sources":["../../../../../../packages/router/src/utils/functional_guards.ts","../../../../../../packages/router/src/version.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {inject, Type} from '@angular/core';\n\nimport {\n CanActivate,\n CanActivateChild,\n CanActivateChildFn,\n CanActivateFn,\n CanDeactivate,\n CanDeactivateFn,\n CanMatch,\n CanMatchFn,\n Resolve,\n ResolveFn,\n} from '../models';\n\n/**\n * Maps an array of injectable classes with canMatch functions to an array of equivalent\n * `CanMatchFn` for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='CanActivate'}\n *\n * @publicApi\n * @see {@link Route}\n */\nexport function mapToCanMatch(providers: Array<Type<CanMatch>>): CanMatchFn[] {\n return providers.map(\n (provider) =>\n (...params) =>\n inject(provider).canMatch(...params),\n );\n}\n\n/**\n * Maps an array of injectable classes with canActivate functions to an array of equivalent\n * `CanActivateFn` for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='CanActivate'}\n *\n * @publicApi\n * @see {@link Route}\n */\nexport function mapToCanActivate(providers: Array<Type<CanActivate>>): CanActivateFn[] {\n return providers.map(\n (provider) =>\n (...params) =>\n inject(provider).canActivate(...params),\n );\n}\n/**\n * Maps an array of injectable classes with canActivateChild functions to an array of equivalent\n * `CanActivateChildFn` for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='CanActivate'}\n *\n * @publicApi\n * @see {@link Route}\n */\nexport function mapToCanActivateChild(\n providers: Array<Type<CanActivateChild>>,\n): CanActivateChildFn[] {\n return providers.map(\n (provider) =>\n (...params) =>\n inject(provider).canActivateChild(...params),\n );\n}\n/**\n * Maps an array of injectable classes with canDeactivate functions to an array of equivalent\n * `CanDeactivateFn` for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='CanActivate'}\n *\n * @publicApi\n * @see {@link Route}\n */\nexport function mapToCanDeactivate<T = unknown>(\n providers: Array<Type<CanDeactivate<T>>>,\n): CanDeactivateFn<T>[] {\n return providers.map(\n (provider) =>\n (...params) =>\n inject(provider).canDeactivate(...params),\n );\n}\n/**\n * Maps an injectable class with a resolve function to an equivalent `ResolveFn`\n * for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='Resolve'}\n *\n * @publicApi\n * @see {@link Route}\n */\nexport function mapToResolve<T>(provider: Type<Resolve<T>>): ResolveFn<T> {\n return (...params) => inject(provider).resolve(...params);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of the router package.\n */\n\nimport {Version} from '@angular/core';\n\n/**\n * @publicApi\n */\nexport const VERSION = new Version('20.0.0-rc.0');\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAuBA;;;;;;;;AAQG;AACG,SAAU,aAAa,CAAC,SAAgC,EAAA;IAC5D,OAAO,SAAS,CAAC,GAAG,CAClB,CAAC,QAAQ,KACP,CAAC,GAAG,MAAM,KACR,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,CACzC;AACH;AAEA;;;;;;;;AAQG;AACG,SAAU,gBAAgB,CAAC,SAAmC,EAAA;IAClE,OAAO,SAAS,CAAC,GAAG,CAClB,CAAC,QAAQ,KACP,CAAC,GAAG,MAAM,KACR,MAAM,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,CAC5C;AACH;AACA;;;;;;;;AAQG;AACG,SAAU,qBAAqB,CACnC,SAAwC,EAAA;IAExC,OAAO,SAAS,CAAC,GAAG,CAClB,CAAC,QAAQ,KACP,CAAC,GAAG,MAAM,KACR,MAAM,CAAC,QAAQ,CAAC,CAAC,gBAAgB,CAAC,GAAG,MAAM,CAAC,CACjD;AACH;AACA;;;;;;;;AAQG;AACG,SAAU,kBAAkB,CAChC,SAAwC,EAAA;IAExC,OAAO,SAAS,CAAC,GAAG,CAClB,CAAC,QAAQ,KACP,CAAC,GAAG,MAAM,KACR,MAAM,CAAC,QAAQ,CAAC,CAAC,aAAa,CAAC,GAAG,MAAM,CAAC,CAC9C;AACH;AACA;;;;;;;;AAQG;AACG,SAAU,YAAY,CAAI,QAA0B,EAAA;AACxD,IAAA,OAAO,CAAC,GAAG,MAAM,KAAK,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC;AAC3D;;AC/FA;;;;AAIG;AAIH;;AAEG;MACU,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB;;;;"}
1
+ {"version":3,"file":"router.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/router/src/utils/functional_guards.ts","../../../../../darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/router/src/version.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {inject, Type} from '@angular/core';\n\nimport {\n CanActivate,\n CanActivateChild,\n CanActivateChildFn,\n CanActivateFn,\n CanDeactivate,\n CanDeactivateFn,\n CanMatch,\n CanMatchFn,\n Resolve,\n ResolveFn,\n} from '../models';\n\n/**\n * Maps an array of injectable classes with canMatch functions to an array of equivalent\n * `CanMatchFn` for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='CanActivate'}\n *\n * @publicApi\n * @see {@link Route}\n */\nexport function mapToCanMatch(providers: Array<Type<CanMatch>>): CanMatchFn[] {\n return providers.map(\n (provider) =>\n (...params) =>\n inject(provider).canMatch(...params),\n );\n}\n\n/**\n * Maps an array of injectable classes with canActivate functions to an array of equivalent\n * `CanActivateFn` for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='CanActivate'}\n *\n * @publicApi\n * @see {@link Route}\n */\nexport function mapToCanActivate(providers: Array<Type<CanActivate>>): CanActivateFn[] {\n return providers.map(\n (provider) =>\n (...params) =>\n inject(provider).canActivate(...params),\n );\n}\n/**\n * Maps an array of injectable classes with canActivateChild functions to an array of equivalent\n * `CanActivateChildFn` for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='CanActivate'}\n *\n * @publicApi\n * @see {@link Route}\n */\nexport function mapToCanActivateChild(\n providers: Array<Type<CanActivateChild>>,\n): CanActivateChildFn[] {\n return providers.map(\n (provider) =>\n (...params) =>\n inject(provider).canActivateChild(...params),\n );\n}\n/**\n * Maps an array of injectable classes with canDeactivate functions to an array of equivalent\n * `CanDeactivateFn` for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='CanActivate'}\n *\n * @publicApi\n * @see {@link Route}\n */\nexport function mapToCanDeactivate<T = unknown>(\n providers: Array<Type<CanDeactivate<T>>>,\n): CanDeactivateFn<T>[] {\n return providers.map(\n (provider) =>\n (...params) =>\n inject(provider).canDeactivate(...params),\n );\n}\n/**\n * Maps an injectable class with a resolve function to an equivalent `ResolveFn`\n * for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='Resolve'}\n *\n * @publicApi\n * @see {@link Route}\n */\nexport function mapToResolve<T>(provider: Type<Resolve<T>>): ResolveFn<T> {\n return (...params) => inject(provider).resolve(...params);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of the router package.\n */\n\nimport {Version} from '@angular/core';\n\n/**\n * @publicApi\n */\nexport const VERSION = new Version('20.0.0-rc.2');\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAuBA;;;;;;;;AAQG;AACG,SAAU,aAAa,CAAC,SAAgC,EAAA;IAC5D,OAAO,SAAS,CAAC,GAAG,CAClB,CAAC,QAAQ,KACP,CAAC,GAAG,MAAM,KACR,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,CACzC;AACH;AAEA;;;;;;;;AAQG;AACG,SAAU,gBAAgB,CAAC,SAAmC,EAAA;IAClE,OAAO,SAAS,CAAC,GAAG,CAClB,CAAC,QAAQ,KACP,CAAC,GAAG,MAAM,KACR,MAAM,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,CAC5C;AACH;AACA;;;;;;;;AAQG;AACG,SAAU,qBAAqB,CACnC,SAAwC,EAAA;IAExC,OAAO,SAAS,CAAC,GAAG,CAClB,CAAC,QAAQ,KACP,CAAC,GAAG,MAAM,KACR,MAAM,CAAC,QAAQ,CAAC,CAAC,gBAAgB,CAAC,GAAG,MAAM,CAAC,CACjD;AACH;AACA;;;;;;;;AAQG;AACG,SAAU,kBAAkB,CAChC,SAAwC,EAAA;IAExC,OAAO,SAAS,CAAC,GAAG,CAClB,CAAC,QAAQ,KACP,CAAC,GAAG,MAAM,KACR,MAAM,CAAC,QAAQ,CAAC,CAAC,aAAa,CAAC,GAAG,MAAM,CAAC,CAC9C;AACH;AACA;;;;;;;;AAQG;AACG,SAAU,YAAY,CAAI,QAA0B,EAAA;AACxD,IAAA,OAAO,CAAC,GAAG,MAAM,KAAK,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC;AAC3D;;AC/FA;;;;AAIG;AAIH;;AAEG;MACU,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB;;;;"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v20.0.0-rc.0
2
+ * @license Angular v20.0.0-rc.2
3
3
  * (c) 2010-2025 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -7,8 +7,8 @@
7
7
  import * as i3 from '@angular/common';
8
8
  import { LOCATION_INITIALIZED, HashLocationStrategy, LocationStrategy, ViewportScroller, Location, PathLocationStrategy } from '@angular/common';
9
9
  import * as i0 from '@angular/core';
10
- import { inject, ɵINTERNAL_APPLICATION_ERROR_HANDLER as _INTERNAL_APPLICATION_ERROR_HANDLER, ɵRuntimeError as _RuntimeError, ɵɵsanitizeUrlOrResourceUrl as __sanitizeUrlOrResourceUrl, booleanAttribute, HostListener, Input, HostBinding, Attribute, Directive, EventEmitter, Output, ContentChildren, Optional, createEnvironmentInjector, Injectable, InjectionToken, ɵperformanceMarkFeature as _performanceMarkFeature, makeEnvironmentProviders, APP_BOOTSTRAP_LISTENER, ENVIRONMENT_INITIALIZER, provideAppInitializer, Injector, ApplicationRef, NgZone, SkipSelf, NgModule } from '@angular/core';
11
- import { NavigationEnd, isUrlTree, Router, ActivatedRoute, RouterConfigLoader, IMPERATIVE_NAVIGATION, NavigationStart, NavigationSkipped, NavigationSkippedCode, Scroll, UrlSerializer, NavigationTransitions, ROUTES, afterNextNavigation, ROUTER_CONFIGURATION, NAVIGATION_ERROR_HANDLER, RoutedComponentInputBinder, INPUT_BINDER, createViewTransition, CREATE_VIEW_TRANSITION, VIEW_TRANSITION_OPTIONS, stringifyEvent, DefaultUrlSerializer, ChildrenOutletContexts, RouterOutlet, ɵEmptyOutletComponent as _EmptyOutletComponent } from './router-DzCroPjt.mjs';
10
+ import { signal, untracked, inject, ɵINTERNAL_APPLICATION_ERROR_HANDLER as _INTERNAL_APPLICATION_ERROR_HANDLER, HostAttributeToken, ɵRuntimeError as _RuntimeError, booleanAttribute, HostListener, Input, HostBinding, Attribute, Directive, EventEmitter, Output, ContentChildren, Optional, createEnvironmentInjector, Injectable, InjectionToken, ɵperformanceMarkFeature as _performanceMarkFeature, makeEnvironmentProviders, APP_BOOTSTRAP_LISTENER, ENVIRONMENT_INITIALIZER, provideAppInitializer, Injector, ApplicationRef, NgZone, SkipSelf, NgModule } from '@angular/core';
11
+ import { ROUTER_CONFIGURATION, NavigationEnd, isUrlTree, Router, ActivatedRoute, RouterConfigLoader, IMPERATIVE_NAVIGATION, NavigationStart, NavigationSkipped, NavigationSkippedCode, Scroll, UrlSerializer, NavigationTransitions, ROUTES, afterNextNavigation, NAVIGATION_ERROR_HANDLER, RoutedComponentInputBinder, INPUT_BINDER, createViewTransition, CREATE_VIEW_TRANSITION, VIEW_TRANSITION_OPTIONS, stringifyEvent, DefaultUrlSerializer, ChildrenOutletContexts, RouterOutlet, ɵEmptyOutletComponent as _EmptyOutletComponent } from './router-BCAMvkKO.mjs';
12
12
  import { Subject, of, from } from 'rxjs';
13
13
  import { mergeAll, catchError, filter, concatMap, mergeMap } from 'rxjs/operators';
14
14
 
@@ -125,12 +125,20 @@ class RouterLink {
125
125
  renderer;
126
126
  el;
127
127
  locationStrategy;
128
+ /** @nodoc */
129
+ reactiveHref = signal(null);
128
130
  /**
129
131
  * Represents an `href` attribute value applied to a host element,
130
132
  * when a host element is an `<a>`/`<area>` tag or a compatible custom element.
131
133
  * For other tags, the value is `null`.
132
134
  */
133
- href = null;
135
+ get href() {
136
+ return untracked(this.reactiveHref);
137
+ }
138
+ /** @deprecated */
139
+ set href(value) {
140
+ this.reactiveHref.set(value);
141
+ }
134
142
  /**
135
143
  * Represents the `target` attribute on a host element.
136
144
  * This is only used when the host element is
@@ -188,6 +196,7 @@ class RouterLink {
188
196
  /** @internal */
189
197
  onChanges = new Subject();
190
198
  applicationErrorHandler = inject(_INTERNAL_APPLICATION_ERROR_HANDLER);
199
+ options = inject(ROUTER_CONFIGURATION, { optional: true });
191
200
  constructor(router, route, tabIndexAttribute, renderer, el, locationStrategy) {
192
201
  this.router = router;
193
202
  this.route = route;
@@ -195,6 +204,8 @@ class RouterLink {
195
204
  this.renderer = renderer;
196
205
  this.el = el;
197
206
  this.locationStrategy = locationStrategy;
207
+ // Set the initial href value to whatever exists on the host element already
208
+ this.reactiveHref.set(inject(new HostAttributeToken('href'), { optional: true }));
198
209
  const tagName = el.nativeElement.tagName?.toLowerCase();
199
210
  this.isAnchorElement =
200
211
  tagName === 'a' ||
@@ -205,17 +216,33 @@ class RouterLink {
205
216
  // observedAttributes is an optional static property/getter on a custom element.
206
217
  // The spec states that this must be an array of strings.
207
218
  customElements.get(tagName)?.observedAttributes?.includes?.('href')));
208
- if (this.isAnchorElement) {
209
- this.subscription = router.events.subscribe((s) => {
210
- if (s instanceof NavigationEnd) {
211
- this.updateHref();
212
- }
213
- });
219
+ if (!this.isAnchorElement) {
220
+ this.subscribeToNavigationEventsIfNecessary();
214
221
  }
215
222
  else {
216
223
  this.setTabIndexIfNotOnNativeEl('0');
217
224
  }
218
225
  }
226
+ subscribeToNavigationEventsIfNecessary() {
227
+ if (this.subscription !== undefined || !this.isAnchorElement) {
228
+ return;
229
+ }
230
+ // preserving fragment in router state
231
+ let createSubcription = this.preserveFragment;
232
+ // preserving or merging with query params in router state
233
+ const dependsOnRouterState = (handling) => handling === 'merge' || handling === 'preserve';
234
+ createSubcription ||= dependsOnRouterState(this.queryParamsHandling);
235
+ createSubcription ||=
236
+ !this.queryParamsHandling && !dependsOnRouterState(this.options?.defaultQueryParamsHandling);
237
+ if (!createSubcription) {
238
+ return;
239
+ }
240
+ this.subscription = this.router.events.subscribe((s) => {
241
+ if (s instanceof NavigationEnd) {
242
+ this.updateHref();
243
+ }
244
+ });
245
+ }
219
246
  /**
220
247
  * Passed to {@link Router#createUrlTree} as part of the
221
248
  * `UrlCreationOptions`.
@@ -247,7 +274,7 @@ class RouterLink {
247
274
  }
248
275
  this.applyAttributeValue('tabindex', newTabIndex);
249
276
  }
250
- /** @nodoc */
277
+ /** @docs-private */
251
278
  // TODO(atscott): Remove changes parameter in major version as a breaking change.
252
279
  ngOnChanges(changes) {
253
280
  if (ngDevMode &&
@@ -261,6 +288,7 @@ class RouterLink {
261
288
  }
262
289
  if (this.isAnchorElement) {
263
290
  this.updateHref();
291
+ this.subscribeToNavigationEventsIfNecessary();
264
292
  }
265
293
  // This is subscribed to by `RouterLinkActive` so that it knows to update when there are changes
266
294
  // to the RouterLinks it's tracking.
@@ -293,7 +321,7 @@ class RouterLink {
293
321
  this.setTabIndexIfNotOnNativeEl('0');
294
322
  }
295
323
  }
296
- /** @nodoc */
324
+ /** @docs-private */
297
325
  onClick(button, ctrlKey, shiftKey, altKey, metaKey) {
298
326
  const urlTree = this.urlTree;
299
327
  if (urlTree === null) {
@@ -322,30 +350,15 @@ class RouterLink {
322
350
  // by the Router.
323
351
  return !this.isAnchorElement;
324
352
  }
325
- /** @nodoc */
353
+ /** @docs-private */
326
354
  ngOnDestroy() {
327
355
  this.subscription?.unsubscribe();
328
356
  }
329
357
  updateHref() {
330
358
  const urlTree = this.urlTree;
331
- this.href =
332
- urlTree !== null && this.locationStrategy
333
- ? this.locationStrategy?.prepareExternalUrl(this.router.serializeUrl(urlTree))
334
- : null;
335
- const sanitizedValue = this.href === null
336
- ? null
337
- : // This class represents a directive that can be added to both `<a>` elements,
338
- // as well as other elements. As a result, we can't define security context at
339
- // compile time. So the security context is deferred to runtime.
340
- // The `ɵɵsanitizeUrlOrResourceUrl` selects the necessary sanitizer function
341
- // based on the tag and property names. The logic mimics the one from
342
- // `packages/compiler/src/schema/dom_security_schema.ts`, which is used at compile time.
343
- //
344
- // Note: we should investigate whether we can switch to using `@HostBinding('attr.href')`
345
- // instead of applying a value via a renderer, after a final merge of the
346
- // `RouterLinkWithHref` directive.
347
- __sanitizeUrlOrResourceUrl(this.href, this.el.nativeElement.tagName.toLowerCase(), 'href');
348
- this.applyAttributeValue('href', sanitizedValue);
359
+ this.reactiveHref.set(urlTree !== null && this.locationStrategy
360
+ ? (this.locationStrategy?.prepareExternalUrl(this.router.serializeUrl(urlTree)) ?? '')
361
+ : null);
349
362
  }
350
363
  applyAttributeValue(attrName, attrValue) {
351
364
  const renderer = this.renderer;
@@ -374,13 +387,16 @@ class RouterLink {
374
387
  preserveFragment: this.preserveFragment,
375
388
  });
376
389
  }
377
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-rc.0", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
378
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "20.0.0-rc.0", type: RouterLink, isStandalone: true, selector: "[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", state: "state", info: "info", relativeTo: "relativeTo", preserveFragment: ["preserveFragment", "preserveFragment", booleanAttribute], skipLocationChange: ["skipLocationChange", "skipLocationChange", booleanAttribute], replaceUrl: ["replaceUrl", "replaceUrl", booleanAttribute], routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target" } }, usesOnChanges: true, ngImport: i0 });
390
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-rc.2", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
391
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "20.0.0-rc.2", type: RouterLink, isStandalone: true, selector: "[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", state: "state", info: "info", relativeTo: "relativeTo", preserveFragment: ["preserveFragment", "preserveFragment", booleanAttribute], skipLocationChange: ["skipLocationChange", "skipLocationChange", booleanAttribute], replaceUrl: ["replaceUrl", "replaceUrl", booleanAttribute], routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.href": "reactiveHref()", "attr.target": "this.target" } }, usesOnChanges: true, ngImport: i0 });
379
392
  }
380
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-rc.0", ngImport: i0, type: RouterLink, decorators: [{
393
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-rc.2", ngImport: i0, type: RouterLink, decorators: [{
381
394
  type: Directive,
382
395
  args: [{
383
396
  selector: '[routerLink]',
397
+ host: {
398
+ '[attr.href]': 'reactiveHref()',
399
+ },
384
400
  }]
385
401
  }], ctorParameters: () => [{ type: Router }, { type: ActivatedRoute }, { type: undefined, decorators: [{
386
402
  type: Attribute,
@@ -552,7 +568,7 @@ class RouterLinkActive {
552
568
  }
553
569
  });
554
570
  }
555
- /** @nodoc */
571
+ /** @docs-private */
556
572
  ngAfterContentInit() {
557
573
  // `of(null)` is used to force subscribe body to execute once immediately (like `startWith`).
558
574
  of(this.links.changes, of(null))
@@ -579,11 +595,11 @@ class RouterLinkActive {
579
595
  const classes = Array.isArray(data) ? data : data.split(' ');
580
596
  this.classes = classes.filter((c) => !!c);
581
597
  }
582
- /** @nodoc */
598
+ /** @docs-private */
583
599
  ngOnChanges(changes) {
584
600
  this.update();
585
601
  }
586
- /** @nodoc */
602
+ /** @docs-private */
587
603
  ngOnDestroy() {
588
604
  this.routerEventsSubscription.unsubscribe();
589
605
  this.linkInputChangesSubscription?.unsubscribe();
@@ -630,10 +646,10 @@ class RouterLinkActive {
630
646
  const isActiveCheckFn = this.isLinkActive(this.router);
631
647
  return (this.link && isActiveCheckFn(this.link)) || this.links.some(isActiveCheckFn);
632
648
  }
633
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-rc.0", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
634
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0-rc.0", type: RouterLinkActive, isStandalone: true, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
649
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-rc.2", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
650
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0-rc.2", type: RouterLinkActive, isStandalone: true, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
635
651
  }
636
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-rc.0", ngImport: i0, type: RouterLinkActive, decorators: [{
652
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-rc.2", ngImport: i0, type: RouterLinkActive, decorators: [{
637
653
  type: Directive,
638
654
  args: [{
639
655
  selector: '[routerLinkActive]',
@@ -684,10 +700,10 @@ class PreloadAllModules {
684
700
  preload(route, fn) {
685
701
  return fn().pipe(catchError(() => of(null)));
686
702
  }
687
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-rc.0", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
688
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0-rc.0", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
703
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-rc.2", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
704
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0-rc.2", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
689
705
  }
690
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-rc.0", ngImport: i0, type: PreloadAllModules, decorators: [{
706
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-rc.2", ngImport: i0, type: PreloadAllModules, decorators: [{
691
707
  type: Injectable,
692
708
  args: [{ providedIn: 'root' }]
693
709
  }] });
@@ -704,10 +720,10 @@ class NoPreloading {
704
720
  preload(route, fn) {
705
721
  return of(null);
706
722
  }
707
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-rc.0", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
708
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0-rc.0", ngImport: i0, type: NoPreloading, providedIn: 'root' });
723
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-rc.2", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
724
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0-rc.2", ngImport: i0, type: NoPreloading, providedIn: 'root' });
709
725
  }
710
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-rc.0", ngImport: i0, type: NoPreloading, decorators: [{
726
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-rc.2", ngImport: i0, type: NoPreloading, decorators: [{
711
727
  type: Injectable,
712
728
  args: [{ providedIn: 'root' }]
713
729
  }] });
@@ -743,7 +759,7 @@ class RouterPreloader {
743
759
  preload() {
744
760
  return this.processRoutes(this.injector, this.router.config);
745
761
  }
746
- /** @nodoc */
762
+ /** @docs-private */
747
763
  ngOnDestroy() {
748
764
  if (this.subscription) {
749
765
  this.subscription.unsubscribe();
@@ -803,10 +819,10 @@ class RouterPreloader {
803
819
  }
804
820
  });
805
821
  }
806
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-rc.0", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
807
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0-rc.0", ngImport: i0, type: RouterPreloader, providedIn: 'root' });
822
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-rc.2", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
823
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0-rc.2", ngImport: i0, type: RouterPreloader, providedIn: 'root' });
808
824
  }
809
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-rc.0", ngImport: i0, type: RouterPreloader, decorators: [{
825
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-rc.2", ngImport: i0, type: RouterPreloader, decorators: [{
810
826
  type: Injectable,
811
827
  args: [{ providedIn: 'root' }]
812
828
  }], ctorParameters: () => [{ type: Router }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }] });
@@ -824,7 +840,7 @@ class RouterScroller {
824
840
  lastSource = IMPERATIVE_NAVIGATION;
825
841
  restoredId = 0;
826
842
  store = {};
827
- /** @nodoc */
843
+ /** @docs-private */
828
844
  constructor(urlSerializer, transitions, viewportScroller, zone, options = {}) {
829
845
  this.urlSerializer = urlSerializer;
830
846
  this.transitions = transitions;
@@ -910,15 +926,15 @@ class RouterScroller {
910
926
  });
911
927
  });
912
928
  }
913
- /** @nodoc */
929
+ /** @docs-private */
914
930
  ngOnDestroy() {
915
931
  this.routerEventsSubscription?.unsubscribe();
916
932
  this.scrollEventsSubscription?.unsubscribe();
917
933
  }
918
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-rc.0", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
919
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0-rc.0", ngImport: i0, type: RouterScroller });
934
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-rc.2", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
935
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0-rc.2", ngImport: i0, type: RouterScroller });
920
936
  }
921
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-rc.0", ngImport: i0, type: RouterScroller, decorators: [{
937
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-rc.2", ngImport: i0, type: RouterScroller, decorators: [{
922
938
  type: Injectable
923
939
  }], ctorParameters: () => [{ type: UrlSerializer }, { type: NavigationTransitions }, { type: i3.ViewportScroller }, { type: i0.NgZone }, { type: undefined }] });
924
940
 
@@ -1582,11 +1598,11 @@ class RouterModule {
1582
1598
  providers: [{ provide: ROUTES, multi: true, useValue: routes }],
1583
1599
  };
1584
1600
  }
1585
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-rc.0", ngImport: i0, type: RouterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1586
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.0-rc.0", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkActive, _EmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkActive, _EmptyOutletComponent] });
1587
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.0-rc.0", ngImport: i0, type: RouterModule });
1601
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-rc.2", ngImport: i0, type: RouterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1602
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.0-rc.2", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkActive, _EmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkActive, _EmptyOutletComponent] });
1603
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.0-rc.2", ngImport: i0, type: RouterModule });
1588
1604
  }
1589
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-rc.0", ngImport: i0, type: RouterModule, decorators: [{
1605
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-rc.2", ngImport: i0, type: RouterModule, decorators: [{
1590
1606
  type: NgModule,
1591
1607
  args: [{
1592
1608
  imports: ROUTER_DIRECTIVES,
@@ -1658,4 +1674,4 @@ function provideRouterInitializer() {
1658
1674
  }
1659
1675
 
1660
1676
  export { NoPreloading, PreloadAllModules, PreloadingStrategy, ROUTER_INITIALIZER, ROUTER_PROVIDERS, RouterLink, RouterLinkActive, RouterModule, RouterPreloader, provideRouter, provideRoutes, withComponentInputBinding, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withHashLocation, withInMemoryScrolling, withNavigationErrorHandler, withPreloading, withRouterConfig, withViewTransitions };
1661
- //# sourceMappingURL=router_module-CrXLirsg.mjs.map
1677
+ //# sourceMappingURL=router_module-CmZ6FD0-.mjs.map