diff --git a/goldens/public-api/router/index.api.md b/goldens/public-api/router/index.api.md index 35bcb692691b..41993801e01d 100644 --- a/goldens/public-api/router/index.api.md +++ b/goldens/public-api/router/index.api.md @@ -84,7 +84,6 @@ export class ActivationEnd { snapshot: ActivatedRouteSnapshot); // (undocumented) snapshot: ActivatedRouteSnapshot; - // (undocumented) toString(): string; // (undocumented) readonly type = EventType.ActivationEnd; @@ -96,7 +95,6 @@ export class ActivationStart { snapshot: ActivatedRouteSnapshot); // (undocumented) snapshot: ActivatedRouteSnapshot; - // (undocumented) toString(): string; // (undocumented) readonly type = EventType.ActivationStart; @@ -163,7 +161,6 @@ export class ChildActivationEnd { snapshot: ActivatedRouteSnapshot); // (undocumented) snapshot: ActivatedRouteSnapshot; - // (undocumented) toString(): string; // (undocumented) readonly type = EventType.ChildActivationEnd; @@ -175,7 +172,6 @@ export class ChildActivationStart { snapshot: ActivatedRouteSnapshot); // (undocumented) snapshot: ActivatedRouteSnapshot; - // (undocumented) toString(): string; // (undocumented) readonly type = EventType.ChildActivationStart; @@ -329,7 +325,6 @@ export class GuardsCheckEnd extends RouterEvent { shouldActivate: boolean; // (undocumented) state: RouterStateSnapshot; - // (undocumented) toString(): string; // (undocumented) readonly type = EventType.GuardsCheckEnd; @@ -346,7 +341,6 @@ export class GuardsCheckStart extends RouterEvent { state: RouterStateSnapshot); // (undocumented) state: RouterStateSnapshot; - // (undocumented) toString(): string; // (undocumented) readonly type = EventType.GuardsCheckStart; @@ -438,7 +432,6 @@ export class NavigationCancel extends RouterEvent { code?: NavigationCancellationCode | undefined); readonly code?: NavigationCancellationCode | undefined; reason: string; - // (undocumented) toString(): string; // (undocumented) readonly type = EventType.NavigationCancel; @@ -459,7 +452,6 @@ export class NavigationEnd extends RouterEvent { id: number, url: string, urlAfterRedirects: string); - // (undocumented) toString(): string; // (undocumented) readonly type = EventType.NavigationEnd; @@ -477,7 +469,6 @@ export class NavigationError extends RouterEvent { // (undocumented) error: any; readonly target?: RouterStateSnapshot | undefined; - // (undocumented) toString(): string; // (undocumented) readonly type = EventType.NavigationError; @@ -524,7 +515,6 @@ export class NavigationStart extends RouterEvent { [k: string]: any; navigationId: number; } | null; - // (undocumented) toString(): string; // (undocumented) readonly type = EventType.NavigationStart; @@ -637,7 +627,6 @@ export class ResolveEnd extends RouterEvent { state: RouterStateSnapshot); // (undocumented) state: RouterStateSnapshot; - // (undocumented) toString(): string; // (undocumented) readonly type = EventType.ResolveEnd; @@ -657,7 +646,6 @@ export class ResolveStart extends RouterEvent { state: RouterStateSnapshot); // (undocumented) state: RouterStateSnapshot; - // (undocumented) toString(): string; // (undocumented) readonly type = EventType.ResolveStart; @@ -695,7 +683,6 @@ export class RouteConfigLoadEnd { route: Route); // (undocumented) route: Route; - // (undocumented) toString(): string; // (undocumented) readonly type = EventType.RouteConfigLoadEnd; @@ -707,7 +694,6 @@ export class RouteConfigLoadStart { route: Route); // (undocumented) route: Route; - // (undocumented) toString(): string; // (undocumented) readonly type = EventType.RouteConfigLoadStart; @@ -999,7 +985,6 @@ export class RoutesRecognized extends RouterEvent { state: RouterStateSnapshot); // (undocumented) state: RouterStateSnapshot; - // (undocumented) toString(): string; // (undocumented) readonly type = EventType.RoutesRecognized; @@ -1025,7 +1010,6 @@ export class Scroll { readonly routerEvent: NavigationEnd | NavigationSkipped; // (undocumented) readonly scrollBehavior?: "manual" | "after-transition" | undefined; - // (undocumented) toString(): string; // (undocumented) readonly type = EventType.Scroll; @@ -1087,7 +1071,6 @@ export class UrlSegment { [name: string]: string; }; path: string; - // (undocumented) toString(): string; } @@ -1105,7 +1088,6 @@ export class UrlSegmentGroup { get numberOfChildren(): number; parent: UrlSegmentGroup | null; segments: UrlSegment[]; - // (undocumented) toString(): string; } @@ -1130,7 +1112,6 @@ export class UrlTree { get queryParamMap(): ParamMap; queryParams: Params; root: UrlSegmentGroup; - // (undocumented) toString(): string; } diff --git a/packages/router/src/events.ts b/packages/router/src/events.ts index 8a3e6f8144ca..12e9c3988698 100644 --- a/packages/router/src/events.ts +++ b/packages/router/src/events.ts @@ -7,9 +7,9 @@ */ import {NavigationBehaviorOptions, Route} from './models'; +import type {Navigation} from './navigation_transition'; import {ActivatedRouteSnapshot, RouterStateSnapshot} from './router_state'; import {UrlTree} from './url_tree'; -import type {Navigation} from './navigation_transition'; /** * Identifies the call or event that triggered a navigation. @@ -135,7 +135,7 @@ export class NavigationStart extends RouterEvent { this.restoredState = restoredState; } - /** @docsNotRequired */ + /** @docs-private */ override toString(): string { return `NavigationStart(id: ${this.id}, url: '${this.url}')`; } @@ -164,7 +164,7 @@ export class NavigationEnd extends RouterEvent { super(id, url); } - /** @docsNotRequired */ + /** @docs-private */ override toString(): string { return `NavigationEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}')`; } @@ -255,7 +255,7 @@ export class NavigationCancel extends RouterEvent { super(id, url); } - /** @docsNotRequired */ + /** @docs-private */ override toString(): string { return `NavigationCancel(id: ${this.id}, url: '${this.url}')`; } @@ -331,7 +331,7 @@ export class NavigationError extends RouterEvent { super(id, url); } - /** @docsNotRequired */ + /** @docs-private */ override toString(): string { return `NavigationError(id: ${this.id}, url: '${this.url}', error: ${this.error})`; } @@ -358,7 +358,7 @@ export class RoutesRecognized extends RouterEvent { super(id, url); } - /** @docsNotRequired */ + /** @docs-private */ override toString(): string { return `RoutesRecognized(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`; } @@ -387,6 +387,7 @@ export class GuardsCheckStart extends RouterEvent { super(id, url); } + /** @docs-private */ override toString(): string { return `GuardsCheckStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`; } @@ -417,6 +418,7 @@ export class GuardsCheckEnd extends RouterEvent { super(id, url); } + /** @docs-private */ override toString(): string { return `GuardsCheckEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state}, shouldActivate: ${this.shouldActivate})`; } @@ -448,6 +450,7 @@ export class ResolveStart extends RouterEvent { super(id, url); } + /** @docs-private */ override toString(): string { return `ResolveStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`; } @@ -475,6 +478,7 @@ export class ResolveEnd extends RouterEvent { super(id, url); } + /** @docs-private */ override toString(): string { return `ResolveEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`; } @@ -494,6 +498,8 @@ export class RouteConfigLoadStart { /** @docsNotRequired */ public route: Route, ) {} + + /** @docs-private */ toString(): string { return `RouteConfigLoadStart(path: ${this.route.path})`; } @@ -513,6 +519,8 @@ export class RouteConfigLoadEnd { /** @docsNotRequired */ public route: Route, ) {} + + /** @docs-private */ toString(): string { return `RouteConfigLoadEnd(path: ${this.route.path})`; } @@ -533,6 +541,8 @@ export class ChildActivationStart { /** @docsNotRequired */ public snapshot: ActivatedRouteSnapshot, ) {} + + /** @docs-private */ toString(): string { const path = (this.snapshot.routeConfig && this.snapshot.routeConfig.path) || ''; return `ChildActivationStart(path: '${path}')`; @@ -553,6 +563,8 @@ export class ChildActivationEnd { /** @docsNotRequired */ public snapshot: ActivatedRouteSnapshot, ) {} + + /** @docs-private */ toString(): string { const path = (this.snapshot.routeConfig && this.snapshot.routeConfig.path) || ''; return `ChildActivationEnd(path: '${path}')`; @@ -574,6 +586,8 @@ export class ActivationStart { /** @docsNotRequired */ public snapshot: ActivatedRouteSnapshot, ) {} + + /** @docs-private */ toString(): string { const path = (this.snapshot.routeConfig && this.snapshot.routeConfig.path) || ''; return `ActivationStart(path: '${path}')`; @@ -595,6 +609,8 @@ export class ActivationEnd { /** @docsNotRequired */ public snapshot: ActivatedRouteSnapshot, ) {} + + /** @docs-private */ toString(): string { const path = (this.snapshot.routeConfig && this.snapshot.routeConfig.path) || ''; return `ActivationEnd(path: '${path}')`; @@ -623,6 +639,7 @@ export class Scroll { readonly scrollBehavior?: 'manual' | 'after-transition', ) {} + /** @docs-private */ toString(): string { const pos = this.position ? `${this.position[0]}, ${this.position[1]}` : null; return `Scroll(anchor: '${this.anchor}', position: '${pos}')`; diff --git a/packages/router/src/url_tree.ts b/packages/router/src/url_tree.ts index bb794f20ce5c..3406e8030c28 100644 --- a/packages/router/src/url_tree.ts +++ b/packages/router/src/url_tree.ts @@ -9,9 +9,9 @@ import {computed, Injectable, ɵRuntimeError as RuntimeError, Signal} from '@angular/core'; import {RuntimeErrorCode} from './errors'; +import type {Router} from './router'; import {convertToParamMap, ParamMap, Params, PRIMARY_OUTLET} from './shared'; import {equalArraysOrString, shallowEqual} from './utils/collection'; -import type {Router} from './router'; /** * A set of options which specify how to determine if a `UrlTree` is active, given the `UrlTree` @@ -285,7 +285,7 @@ export class UrlTree { return this._queryParamMap; } - /** @docsNotRequired */ + /** @docs-private */ toString(): string { return DEFAULT_SERIALIZER.serialize(this); } @@ -323,7 +323,7 @@ export class UrlSegmentGroup { return Object.keys(this.children).length; } - /** @docsNotRequired */ + /** @docs-private */ toString(): string { return serializePaths(this); } @@ -372,7 +372,7 @@ export class UrlSegment { return this._parameterMap; } - /** @docsNotRequired */ + /** @docs-private */ toString(): string { return serializePath(this); }