@real-router/angular 0.12.1 → 0.13.1

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/README.md CHANGED
@@ -103,17 +103,17 @@ export class UsersLayoutComponent {}
103
103
 
104
104
  All inject functions must be called within an injection context (constructor, field initializer, or `runInInjectionContext`). Route state functions return `RouteSignals` — an object with a `routeState` signal and a stable `navigator` reference.
105
105
 
106
- | Function | Returns | Reactive? |
107
- | ------------------------------------------- | ---------------------------------- | ------------------------------------ |
108
- | `injectRouter()` | `Router` | Never |
109
- | `injectNavigator()` | `Navigator` | Never |
110
- | `injectRoute()` | `RouteSignals` | `routeState` on every navigation |
111
- | `injectRouteNode(name)` | `RouteSignals` | When the node subtree is entered, left, or changes between descendants (uses `shouldUpdateNode` — sibling-leaf transitions within the same subtree still fire) |
112
- | `injectRouteUtils()` | `RouteUtils` | Never |
113
- | `injectRouterTransition()` | `Signal<RouterTransitionSnapshot>` | On transition start/end |
114
- | `injectIsActiveRoute(name, params?, opts?)` | `Signal<boolean>` | On active state change |
115
- | `injectRouteExit(handler, options?)` | `void` — wraps `subscribeLeave` with abort + same-route guards | Never (handler captured at injection time) |
116
- | `injectRouteEnter(handler, options?)` | `void` — fires once on nav-driven mount via `effect()` + `transition.from` | Never (handler captured at injection time) |
106
+ | Function | Returns | Reactive? |
107
+ | ------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
108
+ | `injectRouter()` | `Router` | Never |
109
+ | `injectNavigator()` | `Navigator` | Never |
110
+ | `injectRoute()` | `RouteSignals` | `routeState` on every navigation |
111
+ | `injectRouteNode(name)` | `RouteSignals` | When the node subtree is entered, left, or changes between descendants (uses `shouldUpdateNode` — sibling-leaf transitions within the same subtree still fire) |
112
+ | `injectRouteUtils()` | `RouteUtils` | Never |
113
+ | `injectRouterTransition()` | `Signal<RouterTransitionSnapshot>` | On transition start/end |
114
+ | `injectIsActiveRoute(name, params?, opts?)` | `Signal<boolean>` | On active state change |
115
+ | `injectRouteExit(handler, options?)` | `void` — wraps `subscribeLeave` with abort + same-route guards | Never (handler captured at injection time) |
116
+ | `injectRouteEnter(handler, options?)` | `void` — fires once on nav-driven mount via `effect()` + `transition.from` | Never (handler captured at injection time) |
117
117
 
118
118
  `RouteSignals` shape:
119
119
 
@@ -374,7 +374,9 @@ import { injectDeferred } from "@real-router/angular/ssr";
374
374
  @Component({
375
375
  template: `
376
376
  @if (reviews(); as r) {
377
- @for (review of r; track review.id) { <li>{{ review.author }}</li> }
377
+ @for (review of r; track review.id) {
378
+ <li>{{ review.author }}</li>
379
+ }
378
380
  } @else {
379
381
  <p>Loading reviews…</p>
380
382
  }
@@ -411,15 +413,15 @@ Navigation directive for `<a>` elements. Handles click events, sets `href`, and
411
413
  </a>
412
414
  ```
413
415
 
414
- | Input | Type | Default | Description |
415
- | ------------------- | ------------------- | ---------- | -------------------------------------- |
416
- | `routeName` | `string` | `""` | Target route name |
417
- | `routeParams` | `Params` | `undefined`| Route parameters (omitted → `undefined`, shares one active-route source with `injectIsActiveRoute(name)`, #776) |
418
- | `routeOptions` | `NavigationOptions` | `{}` | Navigation options (replace, etc.) |
419
- | `activeClassName` | `string` | `"active"` | CSS class applied when route is active |
420
- | `activeStrict` | `boolean` | `false` | Exact match only (no ancestor match) |
421
- | `ignoreQueryParams` | `boolean` | `true` | Query params don't affect active state |
422
- | `hash` | `string` | `undefined`| URL fragment (decoded). Tri-state: undefined preserves, `""` clears, value sets. (#532) |
416
+ | Input | Type | Default | Description |
417
+ | ------------------- | ------------------- | ----------- | --------------------------------------------------------------------------------------------------------------- |
418
+ | `routeName` | `string` | `""` | Target route name |
419
+ | `routeParams` | `Params` | `undefined` | Route parameters (omitted → `undefined`, shares one active-route source with `injectIsActiveRoute(name)`, #776) |
420
+ | `routeOptions` | `NavigationOptions` | `{}` | Navigation options (replace, etc.) |
421
+ | `activeClassName` | `string` | `"active"` | CSS class applied when route is active |
422
+ | `activeStrict` | `boolean` | `false` | Exact match only (no ancestor match) |
423
+ | `ignoreQueryParams` | `boolean` | `true` | Query params don't affect active state |
424
+ | `hash` | `string` | `undefined` | URL fragment (decoded). Tri-state: undefined preserves, `""` clears, value sets. (#532) |
423
425
 
424
426
  #### `hash` input — URL fragment / tab-style UIs
425
427
 
@@ -454,13 +456,13 @@ Applies an active CSS class to any element when a route is active. Use this when
454
456
  </li>
455
457
  ```
456
458
 
457
- | Input | Type | Default | Description |
458
- | ------------------- | --------- | ------- | -------------------------------------- |
459
- | `realLinkActive` | `string` | `""` | CSS class to apply when active |
460
- | `routeName` | `string` | `""` | Route to watch |
459
+ | Input | Type | Default | Description |
460
+ | ------------------- | --------- | ----------- | ---------------------------------------------- |
461
+ | `realLinkActive` | `string` | `""` | CSS class to apply when active |
462
+ | `routeName` | `string` | `""` | Route to watch |
461
463
  | `routeParams` | `Params` | `undefined` | Route parameters (omitted → `undefined`, #776) |
462
- | `activeStrict` | `boolean` | `false` | Exact match only |
463
- | `ignoreQueryParams` | `boolean` | `true` | Query params don't affect active state |
464
+ | `activeStrict` | `boolean` | `false` | Exact match only |
465
+ | `ignoreQueryParams` | `boolean` | `true` | Query params don't affect active state |
464
466
 
465
467
  ### `routeMatch`
466
468
 
@@ -521,6 +523,23 @@ export class AppComponent {}
521
523
 
522
524
  The announcer creates a visually hidden `aria-live` region and announces each navigation to screen readers. See the [Accessibility guide](https://github.com/greydragon888/real-router/wiki/Accessibility) for details.
523
525
 
526
+ `<navigation-announcer>` accepts optional `[prefix]` and `[getAnnouncementText]` signal inputs to customize the announced text:
527
+
528
+ | Input | Type | Description |
529
+ | ----------------------- | -------------------------- | --------------------------------------------------------------------------------------------------- |
530
+ | `[prefix]` | `string` | Prefix prepended to the resolved text (default `"Navigated to "`) |
531
+ | `[getAnnouncementText]` | `(route: State) => string` | Full custom text; overrides the default `h1 → title → route-name` chain (falls back on empty/throw) |
532
+
533
+ ```typescript
534
+ @Component({
535
+ imports: [NavigationAnnouncer],
536
+ template: `<navigation-announcer [getAnnouncementText]="announce" />`,
537
+ })
538
+ export class AppComponent {
539
+ announce = (route: State): string => `Now on ${route.name}`;
540
+ }
541
+ ```
542
+
524
543
  ## Scroll Restoration
525
544
 
526
545
  Opt-in via the `provideRealRouter` options bag:
@@ -604,25 +623,25 @@ Existing `provideRealRouter(router)` is unchanged — keep using it for SPA / po
604
623
 
605
624
  **SPA examples** — `provideRealRouter(router)` after `await router.start()`:
606
625
 
607
- | Example | Demonstrates |
608
- |---------|--------------|
609
- | [`examples/web/angular/basic/`](../../examples/web/angular/basic) | Minimal setup with `RouteView` + `RealLink` + `injectRoute` |
610
- | [`examples/web/angular/combined/`](../../examples/web/angular/combined) | All features combined: nested routes, dynamic params, lazy loading, persistent params |
611
- | [`examples/web/angular/dynamic-routes/`](../../examples/web/angular/dynamic-routes) | `:id` params, programmatic navigation |
612
- | [`examples/web/angular/hash-routing/`](../../examples/web/angular/hash-routing) | `hash-plugin` with `<a realLink hash="…">` tab-style UIs (#532) |
613
- | [`examples/web/angular/lazy-loading/`](../../examples/web/angular/lazy-loading) | Route-level code-splitting via `import()` |
614
- | [`examples/web/angular/nested-routes/`](../../examples/web/angular/nested-routes) | Multi-level `<route-view>` composition |
615
- | [`examples/web/angular/persistent-params/`](../../examples/web/angular/persistent-params) | `persistent-params-plugin` integration |
616
- | [`examples/web/angular/animation-examples/`](../../examples/web/angular/animation-examples) | View Transitions API + scroll restoration + direction-tracker patterns |
626
+ | Example | Demonstrates |
627
+ | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
628
+ | [`examples/web/angular/basic/`](../../examples/web/angular/basic) | Minimal setup with `RouteView` + `RealLink` + `injectRoute` |
629
+ | [`examples/web/angular/combined/`](../../examples/web/angular/combined) | All features combined: nested routes, dynamic params, lazy loading, persistent params |
630
+ | [`examples/web/angular/dynamic-routes/`](../../examples/web/angular/dynamic-routes) | `:id` params, programmatic navigation |
631
+ | [`examples/web/angular/hash-routing/`](../../examples/web/angular/hash-routing) | `hash-plugin` with `<a realLink hash="…">` tab-style UIs (#532) |
632
+ | [`examples/web/angular/lazy-loading/`](../../examples/web/angular/lazy-loading) | Route-level code-splitting via `import()` |
633
+ | [`examples/web/angular/nested-routes/`](../../examples/web/angular/nested-routes) | Multi-level `<route-view>` composition |
634
+ | [`examples/web/angular/persistent-params/`](../../examples/web/angular/persistent-params) | `persistent-params-plugin` integration |
635
+ | [`examples/web/angular/animation-examples/`](../../examples/web/angular/animation-examples) | View Transitions API + scroll restoration + direction-tracker patterns |
617
636
 
618
637
  **SSR / SSG examples** — `provideRealRouterFactory({ baseRouter, plugins, deps })`:
619
638
 
620
- | Example | Demonstrates |
621
- |---------|--------------|
622
- | [`examples/web/angular/ssr-examples/ssr/`](../../examples/web/angular/ssr-examples/ssr) | Classical SSR with cookie-based DI, auth guards, nested loaders |
623
- | [`examples/web/angular/ssr-examples/ssr-mixed/`](../../examples/web/angular/ssr-examples/ssr-mixed) | Mixed SSR/CSR routes — some routes server-rendered, others CSR-only |
639
+ | Example | Demonstrates |
640
+ | ----------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
641
+ | [`examples/web/angular/ssr-examples/ssr/`](../../examples/web/angular/ssr-examples/ssr) | Classical SSR with cookie-based DI, auth guards, nested loaders |
642
+ | [`examples/web/angular/ssr-examples/ssr-mixed/`](../../examples/web/angular/ssr-examples/ssr-mixed) | Mixed SSR/CSR routes — some routes server-rendered, others CSR-only |
624
643
  | [`examples/web/angular/ssr-examples/ssr-streaming/`](../../examples/web/angular/ssr-examples/ssr-streaming) | Streaming SSR with `@defer (on viewport)` + `@defer (on hover)` + `withIncrementalHydration()` |
625
- | [`examples/web/angular/ssr-examples/ssg/`](../../examples/web/angular/ssr-examples/ssg) | Static site generation via in-process AngularNodeAppEngine + `getStaticPaths()` |
644
+ | [`examples/web/angular/ssr-examples/ssg/`](../../examples/web/angular/ssr-examples/ssg) | Static site generation via in-process AngularNodeAppEngine + `getStaticPaths()` |
626
645
 
627
646
  **Post-hydration loader skip (#599)** — `provideRealRouterFactory` automatically bridges Angular's `TransferState` to the cross-adapter hydration scratchpad. On the server pass, the resolved router state is written to `TransferState`; on the client, the bootstrap consumes the seed via `hydrateRouter(...)` and `ssr-data-plugin` reuses the server-resolved `state.context.data` without re-invoking the loader on first paint. Requires `provideServerRendering()` (server) + `provideClientHydration()` (client) — both standard for Angular SSR apps. Verified end-to-end in `ssr/` and `ssr-streaming/` examples via `window.__LOADER_CALLS__` counter assertion.
628
647
 
@@ -636,9 +655,7 @@ Opt-in animated route transitions via the browser's [View Transitions API](https
636
655
  import { provideRealRouter } from "@real-router/angular";
637
656
 
638
657
  bootstrapApplication(AppComponent, {
639
- providers: [
640
- provideRealRouter(router, { viewTransitions: true }),
641
- ],
658
+ providers: [provideRealRouter(router, { viewTransitions: true })],
642
659
  });
643
660
  ```
644
661
 
package/dist/README.md CHANGED
@@ -103,17 +103,17 @@ export class UsersLayoutComponent {}
103
103
 
104
104
  All inject functions must be called within an injection context (constructor, field initializer, or `runInInjectionContext`). Route state functions return `RouteSignals` — an object with a `routeState` signal and a stable `navigator` reference.
105
105
 
106
- | Function | Returns | Reactive? |
107
- | ------------------------------------------- | ---------------------------------- | ------------------------------------ |
108
- | `injectRouter()` | `Router` | Never |
109
- | `injectNavigator()` | `Navigator` | Never |
110
- | `injectRoute()` | `RouteSignals` | `routeState` on every navigation |
111
- | `injectRouteNode(name)` | `RouteSignals` | When the node subtree is entered, left, or changes between descendants (uses `shouldUpdateNode` — sibling-leaf transitions within the same subtree still fire) |
112
- | `injectRouteUtils()` | `RouteUtils` | Never |
113
- | `injectRouterTransition()` | `Signal<RouterTransitionSnapshot>` | On transition start/end |
114
- | `injectIsActiveRoute(name, params?, opts?)` | `Signal<boolean>` | On active state change |
115
- | `injectRouteExit(handler, options?)` | `void` — wraps `subscribeLeave` with abort + same-route guards | Never (handler captured at injection time) |
116
- | `injectRouteEnter(handler, options?)` | `void` — fires once on nav-driven mount via `effect()` + `transition.from` | Never (handler captured at injection time) |
106
+ | Function | Returns | Reactive? |
107
+ | ------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
108
+ | `injectRouter()` | `Router` | Never |
109
+ | `injectNavigator()` | `Navigator` | Never |
110
+ | `injectRoute()` | `RouteSignals` | `routeState` on every navigation |
111
+ | `injectRouteNode(name)` | `RouteSignals` | When the node subtree is entered, left, or changes between descendants (uses `shouldUpdateNode` — sibling-leaf transitions within the same subtree still fire) |
112
+ | `injectRouteUtils()` | `RouteUtils` | Never |
113
+ | `injectRouterTransition()` | `Signal<RouterTransitionSnapshot>` | On transition start/end |
114
+ | `injectIsActiveRoute(name, params?, opts?)` | `Signal<boolean>` | On active state change |
115
+ | `injectRouteExit(handler, options?)` | `void` — wraps `subscribeLeave` with abort + same-route guards | Never (handler captured at injection time) |
116
+ | `injectRouteEnter(handler, options?)` | `void` — fires once on nav-driven mount via `effect()` + `transition.from` | Never (handler captured at injection time) |
117
117
 
118
118
  `RouteSignals` shape:
119
119
 
@@ -374,7 +374,9 @@ import { injectDeferred } from "@real-router/angular/ssr";
374
374
  @Component({
375
375
  template: `
376
376
  @if (reviews(); as r) {
377
- @for (review of r; track review.id) { <li>{{ review.author }}</li> }
377
+ @for (review of r; track review.id) {
378
+ <li>{{ review.author }}</li>
379
+ }
378
380
  } @else {
379
381
  <p>Loading reviews…</p>
380
382
  }
@@ -411,15 +413,15 @@ Navigation directive for `<a>` elements. Handles click events, sets `href`, and
411
413
  </a>
412
414
  ```
413
415
 
414
- | Input | Type | Default | Description |
415
- | ------------------- | ------------------- | ---------- | -------------------------------------- |
416
- | `routeName` | `string` | `""` | Target route name |
417
- | `routeParams` | `Params` | `undefined`| Route parameters (omitted → `undefined`, shares one active-route source with `injectIsActiveRoute(name)`, #776) |
418
- | `routeOptions` | `NavigationOptions` | `{}` | Navigation options (replace, etc.) |
419
- | `activeClassName` | `string` | `"active"` | CSS class applied when route is active |
420
- | `activeStrict` | `boolean` | `false` | Exact match only (no ancestor match) |
421
- | `ignoreQueryParams` | `boolean` | `true` | Query params don't affect active state |
422
- | `hash` | `string` | `undefined`| URL fragment (decoded). Tri-state: undefined preserves, `""` clears, value sets. (#532) |
416
+ | Input | Type | Default | Description |
417
+ | ------------------- | ------------------- | ----------- | --------------------------------------------------------------------------------------------------------------- |
418
+ | `routeName` | `string` | `""` | Target route name |
419
+ | `routeParams` | `Params` | `undefined` | Route parameters (omitted → `undefined`, shares one active-route source with `injectIsActiveRoute(name)`, #776) |
420
+ | `routeOptions` | `NavigationOptions` | `{}` | Navigation options (replace, etc.) |
421
+ | `activeClassName` | `string` | `"active"` | CSS class applied when route is active |
422
+ | `activeStrict` | `boolean` | `false` | Exact match only (no ancestor match) |
423
+ | `ignoreQueryParams` | `boolean` | `true` | Query params don't affect active state |
424
+ | `hash` | `string` | `undefined` | URL fragment (decoded). Tri-state: undefined preserves, `""` clears, value sets. (#532) |
423
425
 
424
426
  #### `hash` input — URL fragment / tab-style UIs
425
427
 
@@ -454,13 +456,13 @@ Applies an active CSS class to any element when a route is active. Use this when
454
456
  </li>
455
457
  ```
456
458
 
457
- | Input | Type | Default | Description |
458
- | ------------------- | --------- | ------- | -------------------------------------- |
459
- | `realLinkActive` | `string` | `""` | CSS class to apply when active |
460
- | `routeName` | `string` | `""` | Route to watch |
459
+ | Input | Type | Default | Description |
460
+ | ------------------- | --------- | ----------- | ---------------------------------------------- |
461
+ | `realLinkActive` | `string` | `""` | CSS class to apply when active |
462
+ | `routeName` | `string` | `""` | Route to watch |
461
463
  | `routeParams` | `Params` | `undefined` | Route parameters (omitted → `undefined`, #776) |
462
- | `activeStrict` | `boolean` | `false` | Exact match only |
463
- | `ignoreQueryParams` | `boolean` | `true` | Query params don't affect active state |
464
+ | `activeStrict` | `boolean` | `false` | Exact match only |
465
+ | `ignoreQueryParams` | `boolean` | `true` | Query params don't affect active state |
464
466
 
465
467
  ### `routeMatch`
466
468
 
@@ -521,6 +523,23 @@ export class AppComponent {}
521
523
 
522
524
  The announcer creates a visually hidden `aria-live` region and announces each navigation to screen readers. See the [Accessibility guide](https://github.com/greydragon888/real-router/wiki/Accessibility) for details.
523
525
 
526
+ `<navigation-announcer>` accepts optional `[prefix]` and `[getAnnouncementText]` signal inputs to customize the announced text:
527
+
528
+ | Input | Type | Description |
529
+ | ----------------------- | -------------------------- | --------------------------------------------------------------------------------------------------- |
530
+ | `[prefix]` | `string` | Prefix prepended to the resolved text (default `"Navigated to "`) |
531
+ | `[getAnnouncementText]` | `(route: State) => string` | Full custom text; overrides the default `h1 → title → route-name` chain (falls back on empty/throw) |
532
+
533
+ ```typescript
534
+ @Component({
535
+ imports: [NavigationAnnouncer],
536
+ template: `<navigation-announcer [getAnnouncementText]="announce" />`,
537
+ })
538
+ export class AppComponent {
539
+ announce = (route: State): string => `Now on ${route.name}`;
540
+ }
541
+ ```
542
+
524
543
  ## Scroll Restoration
525
544
 
526
545
  Opt-in via the `provideRealRouter` options bag:
@@ -604,25 +623,25 @@ Existing `provideRealRouter(router)` is unchanged — keep using it for SPA / po
604
623
 
605
624
  **SPA examples** — `provideRealRouter(router)` after `await router.start()`:
606
625
 
607
- | Example | Demonstrates |
608
- |---------|--------------|
609
- | [`examples/web/angular/basic/`](../../examples/web/angular/basic) | Minimal setup with `RouteView` + `RealLink` + `injectRoute` |
610
- | [`examples/web/angular/combined/`](../../examples/web/angular/combined) | All features combined: nested routes, dynamic params, lazy loading, persistent params |
611
- | [`examples/web/angular/dynamic-routes/`](../../examples/web/angular/dynamic-routes) | `:id` params, programmatic navigation |
612
- | [`examples/web/angular/hash-routing/`](../../examples/web/angular/hash-routing) | `hash-plugin` with `<a realLink hash="…">` tab-style UIs (#532) |
613
- | [`examples/web/angular/lazy-loading/`](../../examples/web/angular/lazy-loading) | Route-level code-splitting via `import()` |
614
- | [`examples/web/angular/nested-routes/`](../../examples/web/angular/nested-routes) | Multi-level `<route-view>` composition |
615
- | [`examples/web/angular/persistent-params/`](../../examples/web/angular/persistent-params) | `persistent-params-plugin` integration |
616
- | [`examples/web/angular/animation-examples/`](../../examples/web/angular/animation-examples) | View Transitions API + scroll restoration + direction-tracker patterns |
626
+ | Example | Demonstrates |
627
+ | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
628
+ | [`examples/web/angular/basic/`](../../examples/web/angular/basic) | Minimal setup with `RouteView` + `RealLink` + `injectRoute` |
629
+ | [`examples/web/angular/combined/`](../../examples/web/angular/combined) | All features combined: nested routes, dynamic params, lazy loading, persistent params |
630
+ | [`examples/web/angular/dynamic-routes/`](../../examples/web/angular/dynamic-routes) | `:id` params, programmatic navigation |
631
+ | [`examples/web/angular/hash-routing/`](../../examples/web/angular/hash-routing) | `hash-plugin` with `<a realLink hash="…">` tab-style UIs (#532) |
632
+ | [`examples/web/angular/lazy-loading/`](../../examples/web/angular/lazy-loading) | Route-level code-splitting via `import()` |
633
+ | [`examples/web/angular/nested-routes/`](../../examples/web/angular/nested-routes) | Multi-level `<route-view>` composition |
634
+ | [`examples/web/angular/persistent-params/`](../../examples/web/angular/persistent-params) | `persistent-params-plugin` integration |
635
+ | [`examples/web/angular/animation-examples/`](../../examples/web/angular/animation-examples) | View Transitions API + scroll restoration + direction-tracker patterns |
617
636
 
618
637
  **SSR / SSG examples** — `provideRealRouterFactory({ baseRouter, plugins, deps })`:
619
638
 
620
- | Example | Demonstrates |
621
- |---------|--------------|
622
- | [`examples/web/angular/ssr-examples/ssr/`](../../examples/web/angular/ssr-examples/ssr) | Classical SSR with cookie-based DI, auth guards, nested loaders |
623
- | [`examples/web/angular/ssr-examples/ssr-mixed/`](../../examples/web/angular/ssr-examples/ssr-mixed) | Mixed SSR/CSR routes — some routes server-rendered, others CSR-only |
639
+ | Example | Demonstrates |
640
+ | ----------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
641
+ | [`examples/web/angular/ssr-examples/ssr/`](../../examples/web/angular/ssr-examples/ssr) | Classical SSR with cookie-based DI, auth guards, nested loaders |
642
+ | [`examples/web/angular/ssr-examples/ssr-mixed/`](../../examples/web/angular/ssr-examples/ssr-mixed) | Mixed SSR/CSR routes — some routes server-rendered, others CSR-only |
624
643
  | [`examples/web/angular/ssr-examples/ssr-streaming/`](../../examples/web/angular/ssr-examples/ssr-streaming) | Streaming SSR with `@defer (on viewport)` + `@defer (on hover)` + `withIncrementalHydration()` |
625
- | [`examples/web/angular/ssr-examples/ssg/`](../../examples/web/angular/ssr-examples/ssg) | Static site generation via in-process AngularNodeAppEngine + `getStaticPaths()` |
644
+ | [`examples/web/angular/ssr-examples/ssg/`](../../examples/web/angular/ssr-examples/ssg) | Static site generation via in-process AngularNodeAppEngine + `getStaticPaths()` |
626
645
 
627
646
  **Post-hydration loader skip (#599)** — `provideRealRouterFactory` automatically bridges Angular's `TransferState` to the cross-adapter hydration scratchpad. On the server pass, the resolved router state is written to `TransferState`; on the client, the bootstrap consumes the seed via `hydrateRouter(...)` and `ssr-data-plugin` reuses the server-resolved `state.context.data` without re-invoking the loader on first paint. Requires `provideServerRendering()` (server) + `provideClientHydration()` (client) — both standard for Angular SSR apps. Verified end-to-end in `ssr/` and `ssr-streaming/` examples via `window.__LOADER_CALLS__` counter assertion.
628
647
 
@@ -636,9 +655,7 @@ Opt-in animated route transitions via the browser's [View Transitions API](https
636
655
  import { provideRealRouter } from "@real-router/angular";
637
656
 
638
657
  bootstrapApplication(AppComponent, {
639
- providers: [
640
- provideRealRouter(router, { viewTransitions: true }),
641
- ],
658
+ providers: [provideRealRouter(router, { viewTransitions: true })],
642
659
  });
643
660
  ```
644
661
 
@@ -547,9 +547,12 @@ function createScrollRestoration(router, options) {
547
547
  globalThis.addEventListener("pagehide", onPageHide);
548
548
  return {
549
549
  destroy: () => {
550
- if (destroyed) {
551
- return;
552
- }
550
+ // No `if (destroyed) return` guard: every teardown below is idempotent —
551
+ // `unsubscribe()` is a `set.delete` in the core EventEmitter, DOM
552
+ // `removeEventListener` is spec-idempotent, and the history assignment is
553
+ // a plain re-set. There is no ref-count to protect (unlike
554
+ // route-announcer's shared announcer element), so a double `destroy()` is
555
+ // harmless. `destroyed = true` still gates any pending restore rAF / retry.
553
556
  destroyed = true;
554
557
  unsubscribe();
555
558
  globalThis.removeEventListener("pagehide", onPageHide);
@@ -1040,9 +1043,14 @@ function createScrollSpy(router, options) {
1040
1043
  if (cooldown.active) {
1041
1044
  return;
1042
1045
  }
1043
- if (observers.pending.size === 0) {
1044
- return;
1045
- }
1046
+ // No `if (pending.size === 0) return` fast-path: `pending` is never empty
1047
+ // here via any real path (a real IntersectionObserver always delivers ≥1
1048
+ // entry, so `handleIntersection` populates `pending` before scheduling; the
1049
+ // mutation reconcile that could drop entries runs at MUTATION_DEBOUNCE_MS
1050
+ // 250 > RAF_DEBOUNCE_MS 150, i.e. always AFTER the flush). And an empty map
1051
+ // is already handled identically below — `pickTopmost(∅)` is `null` → the
1052
+ // `if (!picked) return` guard — so the fast-path was both unreachable and
1053
+ // redundant.
1046
1054
  // Successful flush consumes the merged snapshot. We clear so that the
1047
1055
  // next debounce window starts fresh; an anchor that is still
1048
1056
  // intersecting will only stay observable if IO emits another event for
@@ -1063,7 +1071,11 @@ function createScrollSpy(router, options) {
1063
1071
  if (!state) {
1064
1072
  return;
1065
1073
  }
1066
- const currentHash = getUrlContext(state)?.hash ?? "";
1074
+ // `getUrlContext` is guaranteed present here (the URL-plugin detector
1075
+ // silences the spy otherwise), so `?.` only satisfies the `| undefined`
1076
+ // slice type. `newHash` is a non-empty id (guarded above), so it can never
1077
+ // equal an absent hash — no `?? ""` normalization needed for the compare.
1078
+ const currentHash = getUrlContext(state)?.hash;
1067
1079
  if (newHash === currentHash) {
1068
1080
  return;
1069
1081
  }
@@ -1107,9 +1119,12 @@ function createScrollSpy(router, options) {
1107
1119
  });
1108
1120
  return {
1109
1121
  destroy() {
1110
- if (destroyed) {
1111
- return;
1112
- }
1122
+ // No `if (destroyed) return` idempotency guard: every subsystem teardown
1123
+ // below is itself idempotent (null-guarded timers, `set.delete` on the
1124
+ // router unsubscribe, spec-idempotent `IntersectionObserver.disconnect`),
1125
+ // and `destroy()` is not a hot path — so a redundant guard would only add
1126
+ // an unreachable branch. `destroyed = true` is still set to gate any
1127
+ // late-arriving IO/router callback via `isStopped()`.
1113
1128
  destroyed = true;
1114
1129
  // Unsubscribe FIRST to prevent late-arriving router transition
1115
1130
  // callback from calling `cooldown.start()` on a half-destroyed
@@ -2276,14 +2291,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
2276
2291
  }], ctorParameters: () => [], propDecorators: { errorTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorTemplate", required: false }] }], onError: [{ type: i0.Output, args: ["onError"] }] } });
2277
2292
 
2278
2293
  class NavigationAnnouncer {
2279
- announcer = createRouteAnnouncer(injectRouter());
2294
+ /**
2295
+ * Optional announcer customization — mirrors the `announceNavigation`
2296
+ * options exposed by the react/preact/vue/solid/svelte adapters.
2297
+ * `prefix` overrides the default `"Navigated to "`; `getAnnouncementText`
2298
+ * computes the full announcement from the resolved route (falling back to
2299
+ * the default `h1 → title → route-name` chain on empty/throw). Read once in
2300
+ * `ngOnInit` — after the input bindings have fired — because signal inputs
2301
+ * are not yet bound at field-initialization time (same pattern as the SSR
2302
+ * `<http-status-code>` component).
2303
+ */
2304
+ prefix = input(/* @ts-ignore */
2305
+ ...(ngDevMode ? [undefined, { debugName: "prefix" }] : /* istanbul ignore next */ []));
2306
+ getAnnouncementText = input(/* @ts-ignore */
2307
+ ...(ngDevMode ? [undefined, { debugName: "getAnnouncementText" }] : /* istanbul ignore next */ []));
2308
+ router = injectRouter();
2309
+ announcer;
2280
2310
  constructor() {
2281
2311
  inject(DestroyRef).onDestroy(() => {
2282
- this.announcer.destroy();
2312
+ this.announcer?.destroy();
2283
2313
  });
2284
2314
  }
2315
+ ngOnInit() {
2316
+ const prefix = this.prefix();
2317
+ const getAnnouncementText = this.getAnnouncementText();
2318
+ // Build the options object omitting unset fields so it stays assignable to
2319
+ // `RouteAnnouncerOptions` under exactOptionalPropertyTypes (`{ prefix:
2320
+ // undefined }` is rejected). An empty object is equivalent to no options.
2321
+ const options = {
2322
+ ...(prefix !== undefined && { prefix }),
2323
+ ...(getAnnouncementText !== undefined && { getAnnouncementText }),
2324
+ };
2325
+ this.announcer = createRouteAnnouncer(this.router, options);
2326
+ }
2285
2327
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: NavigationAnnouncer, deps: [], target: i0.ɵɵFactoryTarget.Component });
2286
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.5", type: NavigationAnnouncer, isStandalone: true, selector: "navigation-announcer", ngImport: i0, template: "", isInline: true });
2328
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.5", type: NavigationAnnouncer, isStandalone: true, selector: "navigation-announcer", inputs: { prefix: { classPropertyName: "prefix", publicName: "prefix", isSignal: true, isRequired: false, transformFunction: null }, getAnnouncementText: { classPropertyName: "getAnnouncementText", publicName: "getAnnouncementText", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "", isInline: true });
2287
2329
  }
2288
2330
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: NavigationAnnouncer, decorators: [{
2289
2331
  type: Component,
@@ -2291,7 +2333,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
2291
2333
  selector: "navigation-announcer",
2292
2334
  template: "",
2293
2335
  }]
2294
- }], ctorParameters: () => [] });
2336
+ }], ctorParameters: () => [], propDecorators: { prefix: [{ type: i0.Input, args: [{ isSignal: true, alias: "prefix", required: false }] }], getAnnouncementText: [{ type: i0.Input, args: [{ isSignal: true, alias: "getAnnouncementText", required: false }] }] } });
2295
2337
 
2296
2338
  const NOOP = () => { };
2297
2339
  /**