@real-router/angular 0.11.13 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/README.md +2 -2
- package/dist/fesm2022/real-router-angular-ssr.mjs +23 -16
- package/dist/fesm2022/real-router-angular-ssr.mjs.map +1 -1
- package/dist/fesm2022/real-router-angular.mjs +72 -48
- package/dist/fesm2022/real-router-angular.mjs.map +1 -1
- package/dist/package.json +57 -0
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](../../LICENSE)
|
|
4
4
|
|
|
5
|
-
> Angular
|
|
5
|
+
> Angular 22 integration for [Real-Router](https://github.com/greydragon888/real-router) — inject functions, components, and directives.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
npm install @real-router/angular @real-router/core @real-router/browser-plugin
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
**Peer dependencies:** `@angular/core` >=
|
|
13
|
+
**Peer dependencies:** `@angular/core` >= 22.0.0, `@angular/common` >= 22.0.0
|
|
14
14
|
|
|
15
15
|
## Quick Start
|
|
16
16
|
|
package/dist/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](../../LICENSE)
|
|
4
4
|
|
|
5
|
-
> Angular
|
|
5
|
+
> Angular 22 integration for [Real-Router](https://github.com/greydragon888/real-router) — inject functions, components, and directives.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
npm install @real-router/angular @real-router/core @real-router/browser-plugin
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
**Peer dependencies:** `@angular/core` >=
|
|
13
|
+
**Peer dependencies:** `@angular/core` >= 22.0.0, `@angular/common` >= 22.0.0
|
|
14
14
|
|
|
15
15
|
## Quick Start
|
|
16
16
|
|
|
@@ -4,15 +4,17 @@ import { input, signal, afterNextRender, Component, InjectionToken, inject, comp
|
|
|
4
4
|
import { injectRoute } from '@real-router/angular';
|
|
5
5
|
|
|
6
6
|
class ClientOnly {
|
|
7
|
-
fallback = input(
|
|
8
|
-
|
|
7
|
+
fallback = input(/* @ts-ignore */
|
|
8
|
+
...(ngDevMode ? [undefined, { debugName: "fallback" }] : /* istanbul ignore next */ []));
|
|
9
|
+
mounted = signal(false, /* @ts-ignore */
|
|
10
|
+
...(ngDevMode ? [{ debugName: "mounted" }] : /* istanbul ignore next */ []));
|
|
9
11
|
constructor() {
|
|
10
12
|
afterNextRender(() => {
|
|
11
13
|
this.mounted.set(true);
|
|
12
14
|
});
|
|
13
15
|
}
|
|
14
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
15
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
16
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ClientOnly, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
17
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: ClientOnly, isStandalone: true, selector: "client-only", inputs: { fallback: { classPropertyName: "fallback", publicName: "fallback", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
16
18
|
@if (mounted()) {
|
|
17
19
|
<ng-content />
|
|
18
20
|
} @else if (fallback()) {
|
|
@@ -20,7 +22,7 @@ class ClientOnly {
|
|
|
20
22
|
}
|
|
21
23
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
22
24
|
}
|
|
23
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
25
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ClientOnly, decorators: [{
|
|
24
26
|
type: Component,
|
|
25
27
|
args: [{
|
|
26
28
|
selector: "client-only",
|
|
@@ -36,15 +38,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
36
38
|
}], ctorParameters: () => [], propDecorators: { fallback: [{ type: i0.Input, args: [{ isSignal: true, alias: "fallback", required: false }] }] } });
|
|
37
39
|
|
|
38
40
|
class ServerOnly {
|
|
39
|
-
fallback = input(
|
|
40
|
-
|
|
41
|
+
fallback = input(/* @ts-ignore */
|
|
42
|
+
...(ngDevMode ? [undefined, { debugName: "fallback" }] : /* istanbul ignore next */ []));
|
|
43
|
+
mounted = signal(false, /* @ts-ignore */
|
|
44
|
+
...(ngDevMode ? [{ debugName: "mounted" }] : /* istanbul ignore next */ []));
|
|
41
45
|
constructor() {
|
|
42
46
|
afterNextRender(() => {
|
|
43
47
|
this.mounted.set(true);
|
|
44
48
|
});
|
|
45
49
|
}
|
|
46
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
47
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
50
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ServerOnly, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
51
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: ServerOnly, isStandalone: true, selector: "server-only", inputs: { fallback: { classPropertyName: "fallback", publicName: "fallback", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
48
52
|
@if (!mounted()) {
|
|
49
53
|
<ng-content />
|
|
50
54
|
} @else if (fallback()) {
|
|
@@ -52,7 +56,7 @@ class ServerOnly {
|
|
|
52
56
|
}
|
|
53
57
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
54
58
|
}
|
|
55
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
59
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ServerOnly, decorators: [{
|
|
56
60
|
type: Component,
|
|
57
61
|
args: [{
|
|
58
62
|
selector: "server-only",
|
|
@@ -169,7 +173,8 @@ class HttpStatusCode {
|
|
|
169
173
|
* value. Consumers should always pass a value — `undefined` makes
|
|
170
174
|
* `ngOnInit` skip the sink write rather than throw.
|
|
171
175
|
*/
|
|
172
|
-
code = input(
|
|
176
|
+
code = input(/* @ts-ignore */
|
|
177
|
+
...(ngDevMode ? [undefined, { debugName: "code" }] : /* istanbul ignore next */ []));
|
|
173
178
|
// Optional injection — when no `provideHttpStatusSink(...)` is registered
|
|
174
179
|
// (client side) the field is null and `ngOnInit` skips the write.
|
|
175
180
|
sink = inject(HTTP_STATUS_SINK, { optional: true });
|
|
@@ -182,10 +187,10 @@ class HttpStatusCode {
|
|
|
182
187
|
this.sink.code = value;
|
|
183
188
|
}
|
|
184
189
|
}
|
|
185
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
186
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
190
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: HttpStatusCode, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
191
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.5", type: HttpStatusCode, isStandalone: true, selector: "http-status-code", inputs: { code: { classPropertyName: "code", publicName: "code", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "", isInline: true });
|
|
187
192
|
}
|
|
188
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
193
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: HttpStatusCode, decorators: [{
|
|
189
194
|
type: Component,
|
|
190
195
|
args: [{
|
|
191
196
|
selector: "http-status-code",
|
|
@@ -240,8 +245,10 @@ function injectDeferred(key) {
|
|
|
240
245
|
const context = routeState().route.context;
|
|
241
246
|
const deferred = context.ssrDataDeferred;
|
|
242
247
|
return (deferred?.[key] ?? NEVER_PROMISE);
|
|
243
|
-
},
|
|
244
|
-
|
|
248
|
+
}, /* @ts-ignore */
|
|
249
|
+
...(ngDevMode ? [{ debugName: "promiseSignal" }] : /* istanbul ignore next */ []));
|
|
250
|
+
const value = signal(undefined, /* @ts-ignore */
|
|
251
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
245
252
|
effect((onCleanup) => {
|
|
246
253
|
const promise = promiseSignal();
|
|
247
254
|
let cancelled = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"real-router-angular-ssr.mjs","sources":["../../ssr/components/ClientOnly.ts","../../ssr/components/ServerOnly.ts","../../ssr/utils/createHttpStatusSink.ts","../../ssr/components/HttpStatusCode.ts","../../ssr/functions/injectDeferred.ts","../../ssr/functions/provideHttpStatusSink.ts","../../ssr/public_api.ts","../../ssr/real-router-angular-ssr.ts"],"sourcesContent":["import { NgTemplateOutlet } from \"@angular/common\";\nimport { afterNextRender, Component, input, signal } from \"@angular/core\";\n\nimport type { TemplateRef } from \"@angular/core\";\n\n@Component({\n selector: \"client-only\",\n template: `\n @if (mounted()) {\n <ng-content />\n } @else if (fallback()) {\n <ng-container [ngTemplateOutlet]=\"fallback() ?? null\" />\n }\n `,\n imports: [NgTemplateOutlet],\n})\nexport class ClientOnly {\n readonly fallback = input<TemplateRef<unknown>>();\n\n readonly mounted = signal(false);\n\n constructor() {\n afterNextRender(() => {\n this.mounted.set(true);\n });\n }\n}\n","import { NgTemplateOutlet } from \"@angular/common\";\nimport { afterNextRender, Component, input, signal } from \"@angular/core\";\n\nimport type { TemplateRef } from \"@angular/core\";\n\n@Component({\n selector: \"server-only\",\n template: `\n @if (!mounted()) {\n <ng-content />\n } @else if (fallback()) {\n <ng-container [ngTemplateOutlet]=\"fallback() ?? null\" />\n }\n `,\n imports: [NgTemplateOutlet],\n})\nexport class ServerOnly {\n readonly fallback = input<TemplateRef<unknown>>();\n\n readonly mounted = signal(false);\n\n constructor() {\n afterNextRender(() => {\n this.mounted.set(true);\n });\n }\n}\n","import { InjectionToken } from \"@angular/core\";\n\n/**\n * Render-scoped HTTP status sink. Created per request on the server and\n * provided via `provideHttpStatusSink(sink)` (or directly through\n * `{ provide: HTTP_STATUS_SINK, useValue: sink }`). Read after the SSR pass\n * (`renderApplication` / `AngularNodeAppEngine` rendering) to apply the value\n * to the HTTP response.\n *\n * Last write wins: if the rendered tree mounts more than one\n * `<http-status-code [code]=\"N\" />`, the value reflects the last component\n * that ran during the render pass.\n *\n * No-op on the client — `<http-status-code />` injects `HTTP_STATUS_SINK`\n * with `{ optional: true }` and skips the write when no provider is\n * registered, so the same component tree can be hydrated without changing\n * behaviour.\n *\n * Constraints:\n * - **Per-request only.** Don't share a sink across requests; the rendered\n * tree mutates `code` in place. Module-level singletons leak status\n * between concurrent requests.\n * - **Don't `Object.freeze` the sink.** The component writes to `.code`;\n * freezing makes the assignment throw under ESM strict mode.\n * - **Pass through `REQUEST_CONTEXT`, not via `req` properties.** Wire the\n * sink with `angularApp.handle(req, { httpStatusSink })` and read it back\n * in the `HTTP_STATUS_SINK` factory via `inject(REQUEST_CONTEXT)`.\n * `AngularNodeAppEngine` builds a fresh Web `Request` from the\n * `IncomingMessage` and discards every custom property, so attaching to\n * `req` directly silently no-ops.\n */\nexport interface HttpStatusSink {\n code: number | undefined;\n}\n\nexport function createHttpStatusSink(): HttpStatusSink {\n return { code: undefined };\n}\n\n/**\n * DI token for the request-scoped HTTP status sink. Application-side wiring:\n *\n * ```ts\n * import { bootstrapApplication } from \"@angular/platform-browser\";\n * import { provideHttpStatusSink, createHttpStatusSink } from \"@real-router/angular/ssr\";\n *\n * const sink = createHttpStatusSink();\n *\n * await bootstrapApplication(AppRoot, {\n * providers: [\n * provideRealRouterFactory({ ... }),\n * provideHttpStatusSink(sink),\n * ],\n * });\n *\n * response.status(sink.code ?? 200).send(html);\n * ```\n */\nexport const HTTP_STATUS_SINK = new InjectionToken<HttpStatusSink>(\n \"HTTP_STATUS_SINK\",\n);\n","import { Component, inject, input } from \"@angular/core\";\n\nimport { HTTP_STATUS_SINK } from \"../utils/createHttpStatusSink\";\n\nimport type { OnInit } from \"@angular/core\";\n\n/**\n * Render-time HTTP status declaration. Mount inside a route component\n * (typical use case: a glob `*` route's NotFound page) when the status is\n * decided by the rendered tree rather than a loader.\n *\n * Writes `code` to the optionally injected `HTTP_STATUS_SINK` in `ngOnInit`\n * (after the input binding has fired) and renders nothing. Without a provider\n * registered (the standard client-side case) the component is a silent no-op\n * — same component tree hydrates without touching the DOM or warning about\n * mismatches.\n *\n * Loader-driven errors (`LoaderNotFound` → 404, `LoaderRedirect` → 30x) keep\n * working as before; this component covers render-time decisions only.\n *\n * Last write wins when several `<http-status-code />` instances mount in the\n * same render pass — sink reflects the last component whose `ngOnInit` ran.\n *\n * ```ts\n * // entry-server.ts\n * import { bootstrapApplication } from \"@angular/platform-browser\";\n * import {\n * createHttpStatusSink,\n * provideHttpStatusSink,\n * } from \"@real-router/angular/ssr\";\n *\n * const sink = createHttpStatusSink();\n * await bootstrapApplication(AppRoot, {\n * providers: [\n * provideRealRouterFactory({ ... }),\n * provideHttpStatusSink(sink),\n * ],\n * });\n * response.status(sink.code ?? 200).send(html);\n * ```\n *\n * ```html\n * <!-- inside not-found.component.ts template -->\n * <http-status-code [code]=\"404\" />\n * ```\n *\n * **Per-request wiring with `AngularNodeAppEngine`:** the sink must be\n * passed via the second arg of `handle(req, requestContext)` — Angular\n * surfaces it through the `REQUEST_CONTEXT` token. Attaching to `req`\n * directly does NOT work: `AngularNodeAppEngine.handle` constructs a fresh\n * Web `Request` from the Express `IncomingMessage` and discards every\n * custom property. See the `ssr/` example's `app.config.ts` factory for\n * the canonical pattern (`inject(REQUEST_CONTEXT, { optional: true })`\n * → `(ctx as { httpStatusSink? } | null)?.httpStatusSink`).\n *\n * **`@angular/ssr` streaming + `@defer` blocks:** `@defer` blocks hydrate\n * lazily on the client; their server-side rendering is fully synchronous,\n * so `<http-status-code />` inside or outside a `@defer` writes to the\n * sink before `AngularNodeAppEngine.handle` resolves. No streaming\n * ordering concern in Angular's current SSR model.\n *\n * **JIT vs AOT:** the `code` input is declared as `input<number>()` (not\n * `input.required<number>()`) because `input.required` trips `NG0950` in\n * JIT/TestBed even after `componentRef.setInput(...)`. `ngOnInit` skips\n * the write when `code()` is `undefined`. AOT (production build) binds\n * the value normally and the skip never fires.\n *\n * **Valid `code` range:** Node's `res.end()` throws `Invalid status code`\n * on `NaN`, `0`, negative values, or values `> 999` — this surfaces as a\n * 5xx / dropped connection, not silent corruption. Pass a real HTTP status\n * integer (commonly 4xx/5xx; 100-999 is what Node accepts).\n */\n@Component({\n selector: \"http-status-code\",\n template: \"\",\n})\nexport class HttpStatusCode implements OnInit {\n /**\n * HTTP status to apply to the response. Common values: 404, 410, 451, 503.\n *\n * Declared as optional so the signal is safe to read in `ngOnInit` under\n * both AOT (template binding fires before init hooks) and JIT/TestBed\n * (`componentRef.setInput(\"code\", N)` writes the value before the first\n * change detection). `input.required` would trip `NG0950` in the JIT path\n * because the required-flag is asserted independently of the runtime\n * value. Consumers should always pass a value — `undefined` makes\n * `ngOnInit` skip the sink write rather than throw.\n */\n readonly code = input<number>();\n\n // Optional injection — when no `provideHttpStatusSink(...)` is registered\n // (client side) the field is null and `ngOnInit` skips the write.\n private readonly sink = inject(HTTP_STATUS_SINK, { optional: true });\n\n ngOnInit(): void {\n if (!this.sink) {\n return;\n }\n\n const value = this.code();\n\n if (value !== undefined) {\n this.sink.code = value;\n }\n }\n}\n","import { computed, effect, signal } from \"@angular/core\";\n\nimport { injectRoute } from \"@real-router/angular\";\n\nimport type { Signal } from \"@angular/core\";\n\ninterface DeferredContext {\n ssrDataDeferred?: Record<string, Promise<unknown>>;\n}\n\nconst NEVER_PROMISE = new Promise<never>(() => {\n // Intentionally never resolves — settles as `undefined` indefinitely when\n // a key is requested that the loader never declared. Surfaces consumer/\n // loader key drift as a visible \"loading\" state in the UI.\n});\n\n/**\n * Read a deferred promise published by `defer({ deferred: { <key>: Promise } })`\n * inside an SSR data loader. Returns an Angular `Signal<T | undefined>` that\n * tracks the active route — re-keying picks up the new state's deferred map.\n *\n * The signal starts `undefined` and updates to the resolved value once the\n * promise settles. Use with native Angular control flow:\n *\n * ```ts\n * @Component({\n * template: `\n * @if (reviews()) {\n * <ul>\n * @for (r of reviews(); track r.id) {\n * <li>{{ r.author }}</li>\n * }\n * </ul>\n * } @else {\n * <p>Loading reviews…</p>\n * }\n * `,\n * })\n * export class Reviews {\n * readonly reviews = injectDeferred<Review[]>(\"reviews\");\n * }\n * ```\n *\n * **Asymmetric Angular** (see `.claude/SSR_FEATURE_GAPS_RU.md` §8): Angular\n * does not ship `<Await>` / `<Streamed>` adapter components — Angular has no\n * direct analogue to React's `use(promise)` or Svelte's `{#await}`. Use\n * `@if (signal()) { … } @else { … }` or the `async` pipe with\n * `from(deferredPromise)` instead.\n */\nexport function injectDeferred<T = unknown>(\n key: string,\n): Signal<T | undefined> {\n const { routeState } = injectRoute();\n\n // Re-derive the promise reference whenever the route changes — invalidate()\n // + reload, navigation to a new route, etc. all refresh the underlying\n // deferred map, and we want the signal to track the *latest* promise.\n const promiseSignal = computed<Promise<T>>(() => {\n const context = routeState().route.context as DeferredContext;\n const deferred = context.ssrDataDeferred;\n\n return (deferred?.[key] ?? NEVER_PROMISE) as Promise<T>;\n });\n\n const value = signal<T | undefined>(undefined);\n\n effect((onCleanup) => {\n const promise = promiseSignal();\n let cancelled = false;\n\n onCleanup(() => {\n cancelled = true;\n });\n\n promise.then(\n (resolved) => {\n if (!cancelled) {\n value.set(resolved);\n }\n },\n /* v8 ignore next 4 -- @preserve: rejection branch — `effect` swallows\n async errors silently, so leaving the signal as `undefined` is the\n only observable behaviour. Real error surfacing is the loader's\n responsibility (throw → navigation rejects → app error boundary). */\n () => {\n // Intentional swallow — see v8 ignore note above.\n },\n );\n });\n\n return value.asReadonly();\n}\n","import { makeEnvironmentProviders } from \"@angular/core\";\n\nimport { HTTP_STATUS_SINK } from \"../utils/createHttpStatusSink\";\n\nimport type { HttpStatusSink } from \"../utils/createHttpStatusSink\";\nimport type { EnvironmentProviders } from \"@angular/core\";\n\n/**\n * Environment providers for a request-scoped `HttpStatusSink`. Pair with\n * `createHttpStatusSink()` and read `sink.code` after the SSR render pass\n * completes.\n *\n * Application bootstrap:\n *\n * ```ts\n * const sink = createHttpStatusSink();\n *\n * await bootstrapApplication(AppRoot, {\n * providers: [\n * provideRealRouterFactory({ ... }),\n * provideHttpStatusSink(sink),\n * ],\n * });\n *\n * response.status(sink.code ?? 200).send(html);\n * ```\n *\n * Equivalent to:\n *\n * ```ts\n * { provide: HTTP_STATUS_SINK, useValue: sink }\n * ```\n *\n * Use the explicit `useValue` form when you need to compose with other\n * application providers in a single `providers: [...]` block.\n */\nexport function provideHttpStatusSink(\n sink: HttpStatusSink,\n): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: HTTP_STATUS_SINK, useValue: sink },\n ]);\n}\n","// SSR-feature entry — Angular 21+\n//\n// Server-side and SSR-aware components/functions. Mirrors the\n// `/ssr` subpath split shipped by every other adapter (#604 + #610).\n// Trigger reached: `<ClientOnly>`, `<ServerOnly>`, `injectDeferred()`\n// — three SSR-feature exports, ≥3 threshold per\n// `.claude/SSR_FEATURE_GAPS_RU.md` §8.\n//\n// Asymmetric Angular note: Angular has no native `<Suspense>` /\n// `use(promise)` analogue, so this entry exposes the signal-based\n// `injectDeferred()` instead of `<Await>` / `<Streamed>` adapter\n// components. Consumers compose with `@if (signal()) { … } @else { … }`,\n// the `async` pipe (`from(deferredPromise)`), or native `@defer`\n// blocks for chunk-level lazy hydration.\n\n// Components\nexport { ClientOnly } from \"./components/ClientOnly\";\n\nexport { ServerOnly } from \"./components/ServerOnly\";\n\nexport { HttpStatusCode } from \"./components/HttpStatusCode\";\n\n// Functions\nexport { injectDeferred } from \"./functions/injectDeferred\";\n\nexport { provideHttpStatusSink } from \"./functions/provideHttpStatusSink\";\n\n// Utilities\nexport {\n HTTP_STATUS_SINK,\n createHttpStatusSink,\n} from \"./utils/createHttpStatusSink\";\n\n// Types\nexport type { HttpStatusSink } from \"./utils/createHttpStatusSink\";\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;MAgBa,UAAU,CAAA;IACZ,QAAQ,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,UAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAwB;AAExC,IAAA,OAAO,GAAG,MAAM,CAAC,KAAK,8EAAC;AAEhC,IAAA,WAAA,GAAA;QACE,eAAe,CAAC,MAAK;AACnB,YAAA,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;AACxB,QAAA,CAAC,CAAC;IACJ;wGATW,UAAU,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAV,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,UAAU,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,aAAA,EAAA,MAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,UAAA,EAA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,GAAG,IAAI;AAClB,QAAA,CAAC,CAAC;AAEF,QAAA,OAAO,CAAC,IAAI,CACV,CAAC,QAAQ,KAAI;YACX,IAAI,CAAC,SAAS,EAAE;AACd,gBAAA,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC;YACrB;QACF,CAAC;AACD;;;AAGuE;AACvE,QAAA,MAAK;;AAEL,QAAA,CAAC,CACF;AACH,IAAA,CAAC,CAAC;AAEF,IAAA,OAAO,KAAK,CAAC,UAAU,EAAE;AAC3B;;ACpFA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;AACG,SAAU,qBAAqB,CACnC,IAAoB,EAAA;AAEpB,IAAA,OAAO,wBAAwB,CAAC;AAC9B,QAAA,EAAE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,IAAI,EAAE;AAC9C,KAAA,CAAC;AACJ;;AC1CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;ACfA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"real-router-angular-ssr.mjs","sources":["../../ssr/components/ClientOnly.ts","../../ssr/components/ServerOnly.ts","../../ssr/utils/createHttpStatusSink.ts","../../ssr/components/HttpStatusCode.ts","../../ssr/functions/injectDeferred.ts","../../ssr/functions/provideHttpStatusSink.ts","../../ssr/public_api.ts","../../ssr/real-router-angular-ssr.ts"],"sourcesContent":["import { NgTemplateOutlet } from \"@angular/common\";\nimport { afterNextRender, Component, input, signal } from \"@angular/core\";\n\nimport type { TemplateRef } from \"@angular/core\";\n\n@Component({\n selector: \"client-only\",\n template: `\n @if (mounted()) {\n <ng-content />\n } @else if (fallback()) {\n <ng-container [ngTemplateOutlet]=\"fallback() ?? null\" />\n }\n `,\n imports: [NgTemplateOutlet],\n})\nexport class ClientOnly {\n readonly fallback = input<TemplateRef<unknown>>();\n\n readonly mounted = signal(false);\n\n constructor() {\n afterNextRender(() => {\n this.mounted.set(true);\n });\n }\n}\n","import { NgTemplateOutlet } from \"@angular/common\";\nimport { afterNextRender, Component, input, signal } from \"@angular/core\";\n\nimport type { TemplateRef } from \"@angular/core\";\n\n@Component({\n selector: \"server-only\",\n template: `\n @if (!mounted()) {\n <ng-content />\n } @else if (fallback()) {\n <ng-container [ngTemplateOutlet]=\"fallback() ?? null\" />\n }\n `,\n imports: [NgTemplateOutlet],\n})\nexport class ServerOnly {\n readonly fallback = input<TemplateRef<unknown>>();\n\n readonly mounted = signal(false);\n\n constructor() {\n afterNextRender(() => {\n this.mounted.set(true);\n });\n }\n}\n","import { InjectionToken } from \"@angular/core\";\n\n/**\n * Render-scoped HTTP status sink. Created per request on the server and\n * provided via `provideHttpStatusSink(sink)` (or directly through\n * `{ provide: HTTP_STATUS_SINK, useValue: sink }`). Read after the SSR pass\n * (`renderApplication` / `AngularNodeAppEngine` rendering) to apply the value\n * to the HTTP response.\n *\n * Last write wins: if the rendered tree mounts more than one\n * `<http-status-code [code]=\"N\" />`, the value reflects the last component\n * that ran during the render pass.\n *\n * No-op on the client — `<http-status-code />` injects `HTTP_STATUS_SINK`\n * with `{ optional: true }` and skips the write when no provider is\n * registered, so the same component tree can be hydrated without changing\n * behaviour.\n *\n * Constraints:\n * - **Per-request only.** Don't share a sink across requests; the rendered\n * tree mutates `code` in place. Module-level singletons leak status\n * between concurrent requests.\n * - **Don't `Object.freeze` the sink.** The component writes to `.code`;\n * freezing makes the assignment throw under ESM strict mode.\n * - **Pass through `REQUEST_CONTEXT`, not via `req` properties.** Wire the\n * sink with `angularApp.handle(req, { httpStatusSink })` and read it back\n * in the `HTTP_STATUS_SINK` factory via `inject(REQUEST_CONTEXT)`.\n * `AngularNodeAppEngine` builds a fresh Web `Request` from the\n * `IncomingMessage` and discards every custom property, so attaching to\n * `req` directly silently no-ops.\n */\nexport interface HttpStatusSink {\n code: number | undefined;\n}\n\nexport function createHttpStatusSink(): HttpStatusSink {\n return { code: undefined };\n}\n\n/**\n * DI token for the request-scoped HTTP status sink. Application-side wiring:\n *\n * ```ts\n * import { bootstrapApplication } from \"@angular/platform-browser\";\n * import { provideHttpStatusSink, createHttpStatusSink } from \"@real-router/angular/ssr\";\n *\n * const sink = createHttpStatusSink();\n *\n * await bootstrapApplication(AppRoot, {\n * providers: [\n * provideRealRouterFactory({ ... }),\n * provideHttpStatusSink(sink),\n * ],\n * });\n *\n * response.status(sink.code ?? 200).send(html);\n * ```\n */\nexport const HTTP_STATUS_SINK = new InjectionToken<HttpStatusSink>(\n \"HTTP_STATUS_SINK\",\n);\n","import { Component, inject, input } from \"@angular/core\";\n\nimport { HTTP_STATUS_SINK } from \"../utils/createHttpStatusSink\";\n\nimport type { OnInit } from \"@angular/core\";\n\n/**\n * Render-time HTTP status declaration. Mount inside a route component\n * (typical use case: a glob `*` route's NotFound page) when the status is\n * decided by the rendered tree rather than a loader.\n *\n * Writes `code` to the optionally injected `HTTP_STATUS_SINK` in `ngOnInit`\n * (after the input binding has fired) and renders nothing. Without a provider\n * registered (the standard client-side case) the component is a silent no-op\n * — same component tree hydrates without touching the DOM or warning about\n * mismatches.\n *\n * Loader-driven errors (`LoaderNotFound` → 404, `LoaderRedirect` → 30x) keep\n * working as before; this component covers render-time decisions only.\n *\n * Last write wins when several `<http-status-code />` instances mount in the\n * same render pass — sink reflects the last component whose `ngOnInit` ran.\n *\n * ```ts\n * // entry-server.ts\n * import { bootstrapApplication } from \"@angular/platform-browser\";\n * import {\n * createHttpStatusSink,\n * provideHttpStatusSink,\n * } from \"@real-router/angular/ssr\";\n *\n * const sink = createHttpStatusSink();\n * await bootstrapApplication(AppRoot, {\n * providers: [\n * provideRealRouterFactory({ ... }),\n * provideHttpStatusSink(sink),\n * ],\n * });\n * response.status(sink.code ?? 200).send(html);\n * ```\n *\n * ```html\n * <!-- inside not-found.component.ts template -->\n * <http-status-code [code]=\"404\" />\n * ```\n *\n * **Per-request wiring with `AngularNodeAppEngine`:** the sink must be\n * passed via the second arg of `handle(req, requestContext)` — Angular\n * surfaces it through the `REQUEST_CONTEXT` token. Attaching to `req`\n * directly does NOT work: `AngularNodeAppEngine.handle` constructs a fresh\n * Web `Request` from the Express `IncomingMessage` and discards every\n * custom property. See the `ssr/` example's `app.config.ts` factory for\n * the canonical pattern (`inject(REQUEST_CONTEXT, { optional: true })`\n * → `(ctx as { httpStatusSink? } | null)?.httpStatusSink`).\n *\n * **`@angular/ssr` streaming + `@defer` blocks:** `@defer` blocks hydrate\n * lazily on the client; their server-side rendering is fully synchronous,\n * so `<http-status-code />` inside or outside a `@defer` writes to the\n * sink before `AngularNodeAppEngine.handle` resolves. No streaming\n * ordering concern in Angular's current SSR model.\n *\n * **JIT vs AOT:** the `code` input is declared as `input<number>()` (not\n * `input.required<number>()`) because `input.required` trips `NG0950` in\n * JIT/TestBed even after `componentRef.setInput(...)`. `ngOnInit` skips\n * the write when `code()` is `undefined`. AOT (production build) binds\n * the value normally and the skip never fires.\n *\n * **Valid `code` range:** Node's `res.end()` throws `Invalid status code`\n * on `NaN`, `0`, negative values, or values `> 999` — this surfaces as a\n * 5xx / dropped connection, not silent corruption. Pass a real HTTP status\n * integer (commonly 4xx/5xx; 100-999 is what Node accepts).\n */\n@Component({\n selector: \"http-status-code\",\n template: \"\",\n})\nexport class HttpStatusCode implements OnInit {\n /**\n * HTTP status to apply to the response. Common values: 404, 410, 451, 503.\n *\n * Declared as optional so the signal is safe to read in `ngOnInit` under\n * both AOT (template binding fires before init hooks) and JIT/TestBed\n * (`componentRef.setInput(\"code\", N)` writes the value before the first\n * change detection). `input.required` would trip `NG0950` in the JIT path\n * because the required-flag is asserted independently of the runtime\n * value. Consumers should always pass a value — `undefined` makes\n * `ngOnInit` skip the sink write rather than throw.\n */\n readonly code = input<number>();\n\n // Optional injection — when no `provideHttpStatusSink(...)` is registered\n // (client side) the field is null and `ngOnInit` skips the write.\n private readonly sink = inject(HTTP_STATUS_SINK, { optional: true });\n\n ngOnInit(): void {\n if (!this.sink) {\n return;\n }\n\n const value = this.code();\n\n if (value !== undefined) {\n this.sink.code = value;\n }\n }\n}\n","import { computed, effect, signal } from \"@angular/core\";\n\nimport { injectRoute } from \"@real-router/angular\";\n\nimport type { Signal } from \"@angular/core\";\n\ninterface DeferredContext {\n ssrDataDeferred?: Record<string, Promise<unknown>>;\n}\n\nconst NEVER_PROMISE = new Promise<never>(() => {\n // Intentionally never resolves — settles as `undefined` indefinitely when\n // a key is requested that the loader never declared. Surfaces consumer/\n // loader key drift as a visible \"loading\" state in the UI.\n});\n\n/**\n * Read a deferred promise published by `defer({ deferred: { <key>: Promise } })`\n * inside an SSR data loader. Returns an Angular `Signal<T | undefined>` that\n * tracks the active route — re-keying picks up the new state's deferred map.\n *\n * The signal starts `undefined` and updates to the resolved value once the\n * promise settles. Use with native Angular control flow:\n *\n * ```ts\n * @Component({\n * template: `\n * @if (reviews()) {\n * <ul>\n * @for (r of reviews(); track r.id) {\n * <li>{{ r.author }}</li>\n * }\n * </ul>\n * } @else {\n * <p>Loading reviews…</p>\n * }\n * `,\n * })\n * export class Reviews {\n * readonly reviews = injectDeferred<Review[]>(\"reviews\");\n * }\n * ```\n *\n * **Asymmetric Angular** (see `.claude/SSR_FEATURE_GAPS_RU.md` §8): Angular\n * does not ship `<Await>` / `<Streamed>` adapter components — Angular has no\n * direct analogue to React's `use(promise)` or Svelte's `{#await}`. Use\n * `@if (signal()) { … } @else { … }` or the `async` pipe with\n * `from(deferredPromise)` instead.\n */\nexport function injectDeferred<T = unknown>(\n key: string,\n): Signal<T | undefined> {\n const { routeState } = injectRoute();\n\n // Re-derive the promise reference whenever the route changes — invalidate()\n // + reload, navigation to a new route, etc. all refresh the underlying\n // deferred map, and we want the signal to track the *latest* promise.\n const promiseSignal = computed<Promise<T>>(() => {\n const context = routeState().route.context as DeferredContext;\n const deferred = context.ssrDataDeferred;\n\n return (deferred?.[key] ?? NEVER_PROMISE) as Promise<T>;\n });\n\n const value = signal<T | undefined>(undefined);\n\n effect((onCleanup) => {\n const promise = promiseSignal();\n let cancelled = false;\n\n onCleanup(() => {\n cancelled = true;\n });\n\n promise.then(\n (resolved) => {\n if (!cancelled) {\n value.set(resolved);\n }\n },\n /* v8 ignore next 4 -- @preserve: rejection branch — `effect` swallows\n async errors silently, so leaving the signal as `undefined` is the\n only observable behaviour. Real error surfacing is the loader's\n responsibility (throw → navigation rejects → app error boundary). */\n () => {\n // Intentional swallow — see v8 ignore note above.\n },\n );\n });\n\n return value.asReadonly();\n}\n","import { makeEnvironmentProviders } from \"@angular/core\";\n\nimport { HTTP_STATUS_SINK } from \"../utils/createHttpStatusSink\";\n\nimport type { HttpStatusSink } from \"../utils/createHttpStatusSink\";\nimport type { EnvironmentProviders } from \"@angular/core\";\n\n/**\n * Environment providers for a request-scoped `HttpStatusSink`. Pair with\n * `createHttpStatusSink()` and read `sink.code` after the SSR render pass\n * completes.\n *\n * Application bootstrap:\n *\n * ```ts\n * const sink = createHttpStatusSink();\n *\n * await bootstrapApplication(AppRoot, {\n * providers: [\n * provideRealRouterFactory({ ... }),\n * provideHttpStatusSink(sink),\n * ],\n * });\n *\n * response.status(sink.code ?? 200).send(html);\n * ```\n *\n * Equivalent to:\n *\n * ```ts\n * { provide: HTTP_STATUS_SINK, useValue: sink }\n * ```\n *\n * Use the explicit `useValue` form when you need to compose with other\n * application providers in a single `providers: [...]` block.\n */\nexport function provideHttpStatusSink(\n sink: HttpStatusSink,\n): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: HTTP_STATUS_SINK, useValue: sink },\n ]);\n}\n","// SSR-feature entry — Angular 21+\n//\n// Server-side and SSR-aware components/functions. Mirrors the\n// `/ssr` subpath split shipped by every other adapter (#604 + #610).\n// Trigger reached: `<ClientOnly>`, `<ServerOnly>`, `injectDeferred()`\n// — three SSR-feature exports, ≥3 threshold per\n// `.claude/SSR_FEATURE_GAPS_RU.md` §8.\n//\n// Asymmetric Angular note: Angular has no native `<Suspense>` /\n// `use(promise)` analogue, so this entry exposes the signal-based\n// `injectDeferred()` instead of `<Await>` / `<Streamed>` adapter\n// components. Consumers compose with `@if (signal()) { … } @else { … }`,\n// the `async` pipe (`from(deferredPromise)`), or native `@defer`\n// blocks for chunk-level lazy hydration.\n\n// Components\nexport { ClientOnly } from \"./components/ClientOnly\";\n\nexport { ServerOnly } from \"./components/ServerOnly\";\n\nexport { HttpStatusCode } from \"./components/HttpStatusCode\";\n\n// Functions\nexport { injectDeferred } from \"./functions/injectDeferred\";\n\nexport { provideHttpStatusSink } from \"./functions/provideHttpStatusSink\";\n\n// Utilities\nexport {\n HTTP_STATUS_SINK,\n createHttpStatusSink,\n} from \"./utils/createHttpStatusSink\";\n\n// Types\nexport type { HttpStatusSink } from \"./utils/createHttpStatusSink\";\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;MAgBa,UAAU,CAAA;AACZ,IAAA,QAAQ,GAAG,KAAK;4FAAwB;IAExC,OAAO,GAAG,MAAM,CAAC,KAAK;gFAAC;AAEhC,IAAA,WAAA,GAAA;QACE,eAAe,CAAC,MAAK;AACnB,YAAA,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;AACxB,QAAA,CAAC,CAAC;IACJ;uGATW,UAAU,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAV,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAU,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,aAAA,EAAA,MAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EATX;;;;;;AAMT,EAAA,CAAA,EAAA,QAAA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;;;;;AA4BG;AACG,SAAU,qBAAqB,CACnC,IAAoB,EAAA;AAEpB,IAAA,OAAO,wBAAwB,CAAC;AAC9B,QAAA,EAAE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,IAAI,EAAE;AAC9C,KAAA,CAAC;AACJ;;AC1CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;ACfA;;AAEG;;;;"}
|
|
@@ -1555,7 +1555,8 @@ function installViewTransitions() {
|
|
|
1555
1555
|
|
|
1556
1556
|
/** Must be called within an injection context (constructor, field initializer, runInInjectionContext). */
|
|
1557
1557
|
function sourceToSignal(source) {
|
|
1558
|
-
const sig = signal(source.getSnapshot(),
|
|
1558
|
+
const sig = signal(source.getSnapshot(), /* @ts-ignore */
|
|
1559
|
+
...(ngDevMode ? [{ debugName: "sig" }] : /* istanbul ignore next */ []));
|
|
1559
1560
|
const destroyRef = inject(DestroyRef);
|
|
1560
1561
|
const unsubscribe = source.subscribe(() => {
|
|
1561
1562
|
sig.set(source.getSnapshot());
|
|
@@ -2034,32 +2035,33 @@ function injectRouteEnter(handler, options) {
|
|
|
2034
2035
|
}
|
|
2035
2036
|
|
|
2036
2037
|
class RouteMatch {
|
|
2037
|
-
routeMatch = input.required(
|
|
2038
|
+
routeMatch = input.required(/* @ts-ignore */
|
|
2039
|
+
...(ngDevMode ? [{ debugName: "routeMatch" }] : /* istanbul ignore next */ []));
|
|
2038
2040
|
templateRef = inject(TemplateRef);
|
|
2039
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2040
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
2041
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RouteMatch, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2042
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: RouteMatch, isStandalone: true, selector: "ng-template[routeMatch]", inputs: { routeMatch: { classPropertyName: "routeMatch", publicName: "routeMatch", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
|
|
2041
2043
|
}
|
|
2042
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2044
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RouteMatch, decorators: [{
|
|
2043
2045
|
type: Directive,
|
|
2044
2046
|
args: [{ selector: "ng-template[routeMatch]" }]
|
|
2045
2047
|
}], propDecorators: { routeMatch: [{ type: i0.Input, args: [{ isSignal: true, alias: "routeMatch", required: true }] }] } });
|
|
2046
2048
|
|
|
2047
2049
|
class RouteNotFound {
|
|
2048
2050
|
templateRef = inject(TemplateRef);
|
|
2049
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2050
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
2051
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RouteNotFound, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2052
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.5", type: RouteNotFound, isStandalone: true, selector: "ng-template[routeNotFound]", ngImport: i0 });
|
|
2051
2053
|
}
|
|
2052
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2054
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RouteNotFound, decorators: [{
|
|
2053
2055
|
type: Directive,
|
|
2054
2056
|
args: [{ selector: "ng-template[routeNotFound]" }]
|
|
2055
2057
|
}] });
|
|
2056
2058
|
|
|
2057
2059
|
class RouteSelf {
|
|
2058
2060
|
templateRef = inject(TemplateRef);
|
|
2059
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2060
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
2061
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RouteSelf, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2062
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.5", type: RouteSelf, isStandalone: true, selector: "ng-template[routeSelf]", ngImport: i0 });
|
|
2061
2063
|
}
|
|
2062
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2064
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RouteSelf, decorators: [{
|
|
2063
2065
|
type: Directive,
|
|
2064
2066
|
args: [{ selector: "ng-template[routeSelf]" }]
|
|
2065
2067
|
}] });
|
|
@@ -2115,9 +2117,11 @@ class RouteView {
|
|
|
2115
2117
|
matches = contentChildren(RouteMatch, { ...(ngDevMode ? { debugName: "matches" } : /* istanbul ignore next */ {}), descendants: true });
|
|
2116
2118
|
selfs = contentChildren(RouteSelf, { ...(ngDevMode ? { debugName: "selfs" } : /* istanbul ignore next */ {}), descendants: true });
|
|
2117
2119
|
notFounds = contentChildren(RouteNotFound, { ...(ngDevMode ? { debugName: "notFounds" } : /* istanbul ignore next */ {}), descendants: true });
|
|
2118
|
-
activeTemplate = computed(() => this.matchedTemplate() ?? this.fallbackTemplate(),
|
|
2120
|
+
activeTemplate = computed(() => this.matchedTemplate() ?? this.fallbackTemplate(), /* @ts-ignore */
|
|
2121
|
+
...(ngDevMode ? [{ debugName: "activeTemplate" }] : /* istanbul ignore next */ []));
|
|
2119
2122
|
router = injectRouter();
|
|
2120
|
-
routeState = signal(EMPTY_SNAPSHOT,
|
|
2123
|
+
routeState = signal(EMPTY_SNAPSHOT, /* @ts-ignore */
|
|
2124
|
+
...(ngDevMode ? [{ debugName: "routeState" }] : /* istanbul ignore next */ []));
|
|
2121
2125
|
matchEntries = computed(() => {
|
|
2122
2126
|
const nodeName = this.nodeName();
|
|
2123
2127
|
return this.matches().map((match) => {
|
|
@@ -2127,7 +2131,8 @@ class RouteView {
|
|
|
2127
2131
|
fullSegmentName: nodeName ? `${nodeName}.${segment}` : segment,
|
|
2128
2132
|
};
|
|
2129
2133
|
});
|
|
2130
|
-
},
|
|
2134
|
+
}, /* @ts-ignore */
|
|
2135
|
+
...(ngDevMode ? [{ debugName: "matchEntries" }] : /* istanbul ignore next */ []));
|
|
2131
2136
|
// The matched template (Match priority) is independent of the Self /
|
|
2132
2137
|
// NotFound fallback chain. Splitting the two paths into separate computeds
|
|
2133
2138
|
// localises re-runs: a change to `selfs()` / `notFounds()` no longer
|
|
@@ -2145,7 +2150,8 @@ class RouteView {
|
|
|
2145
2150
|
}
|
|
2146
2151
|
}
|
|
2147
2152
|
return null;
|
|
2148
|
-
},
|
|
2153
|
+
}, /* @ts-ignore */
|
|
2154
|
+
...(ngDevMode ? [{ debugName: "matchedTemplate" }] : /* istanbul ignore next */ []));
|
|
2149
2155
|
// Fallback chain — only consulted when `matchedTemplate()` returned `null`.
|
|
2150
2156
|
// Template priority: Self → NotFound. Selection rules differ on purpose:
|
|
2151
2157
|
// - **Self uses first-wins** (`.at(0)`) for parity with React / Preact /
|
|
@@ -2174,7 +2180,8 @@ class RouteView {
|
|
|
2174
2180
|
}
|
|
2175
2181
|
}
|
|
2176
2182
|
return null;
|
|
2177
|
-
},
|
|
2183
|
+
}, /* @ts-ignore */
|
|
2184
|
+
...(ngDevMode ? [{ debugName: "fallbackTemplate" }] : /* istanbul ignore next */ []));
|
|
2178
2185
|
constructor() {
|
|
2179
2186
|
// Reactive source-creation effect (#630 fix) — see
|
|
2180
2187
|
// `packages/angular/CLAUDE.md` → "Directives use constructor + effect()".
|
|
@@ -2185,14 +2192,14 @@ class RouteView {
|
|
|
2185
2192
|
}));
|
|
2186
2193
|
});
|
|
2187
2194
|
}
|
|
2188
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2189
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
2195
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RouteView, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2196
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: RouteView, isStandalone: true, selector: "route-view", inputs: { nodeName: { classPropertyName: "nodeName", publicName: "routeNode", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "matches", predicate: RouteMatch, descendants: true, isSignal: true }, { propertyName: "selfs", predicate: RouteSelf, descendants: true, isSignal: true }, { propertyName: "notFounds", predicate: RouteNotFound, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
2190
2197
|
@if (activeTemplate()) {
|
|
2191
2198
|
<ng-container [ngTemplateOutlet]="activeTemplate()!" />
|
|
2192
2199
|
}
|
|
2193
2200
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
2194
2201
|
}
|
|
2195
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2202
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RouteView, decorators: [{
|
|
2196
2203
|
type: Component,
|
|
2197
2204
|
args: [{
|
|
2198
2205
|
selector: "route-view",
|
|
@@ -2206,7 +2213,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
2206
2213
|
}], ctorParameters: () => [], propDecorators: { nodeName: [{ type: i0.Input, args: [{ isSignal: true, alias: "routeNode", required: false }] }], matches: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => RouteMatch), { ...{ descendants: true }, isSignal: true }] }], selfs: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => RouteSelf), { ...{ descendants: true }, isSignal: true }] }], notFounds: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => RouteNotFound), { ...{ descendants: true }, isSignal: true }] }] } });
|
|
2207
2214
|
|
|
2208
2215
|
class RouterErrorBoundary {
|
|
2209
|
-
errorTemplate = input(
|
|
2216
|
+
errorTemplate = input(/* @ts-ignore */
|
|
2217
|
+
...(ngDevMode ? [undefined, { debugName: "errorTemplate" }] : /* istanbul ignore next */ []));
|
|
2210
2218
|
onError = output();
|
|
2211
2219
|
errorContext = computed(() => {
|
|
2212
2220
|
const snap = this.snapshot();
|
|
@@ -2217,7 +2225,8 @@ class RouterErrorBoundary {
|
|
|
2217
2225
|
$implicit: snap.error,
|
|
2218
2226
|
resetError: snap.resetError,
|
|
2219
2227
|
};
|
|
2220
|
-
},
|
|
2228
|
+
}, /* @ts-ignore */
|
|
2229
|
+
...(ngDevMode ? [{ debugName: "errorContext" }] : /* istanbul ignore next */ []));
|
|
2221
2230
|
router = injectRouter();
|
|
2222
2231
|
snapshot = sourceToSignal(createDismissableError(this.router));
|
|
2223
2232
|
constructor() {
|
|
@@ -2238,8 +2247,8 @@ class RouterErrorBoundary {
|
|
|
2238
2247
|
}
|
|
2239
2248
|
});
|
|
2240
2249
|
}
|
|
2241
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2242
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
2250
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RouterErrorBoundary, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2251
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: RouterErrorBoundary, isStandalone: true, selector: "router-error-boundary", inputs: { errorTemplate: { classPropertyName: "errorTemplate", publicName: "errorTemplate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onError: "onError" }, ngImport: i0, template: `
|
|
2243
2252
|
<ng-content />
|
|
2244
2253
|
@if (errorContext() && errorTemplate()) {
|
|
2245
2254
|
<ng-container
|
|
@@ -2249,7 +2258,7 @@ class RouterErrorBoundary {
|
|
|
2249
2258
|
}
|
|
2250
2259
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
2251
2260
|
}
|
|
2252
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2261
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RouterErrorBoundary, decorators: [{
|
|
2253
2262
|
type: Component,
|
|
2254
2263
|
args: [{
|
|
2255
2264
|
selector: "router-error-boundary",
|
|
@@ -2273,10 +2282,10 @@ class NavigationAnnouncer {
|
|
|
2273
2282
|
this.announcer.destroy();
|
|
2274
2283
|
});
|
|
2275
2284
|
}
|
|
2276
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2277
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
2285
|
+
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 });
|
|
2278
2287
|
}
|
|
2279
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2288
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: NavigationAnnouncer, decorators: [{
|
|
2280
2289
|
type: Component,
|
|
2281
2290
|
args: [{
|
|
2282
2291
|
selector: "navigation-announcer",
|
|
@@ -2338,28 +2347,36 @@ const NOOP_CATCH = () => { };
|
|
|
2338
2347
|
// `injectIsActiveRoute(name)` instead of keying "{}" (#776).
|
|
2339
2348
|
const EMPTY_PARAMS = Object.freeze({});
|
|
2340
2349
|
class RealLink {
|
|
2341
|
-
routeName = input("",
|
|
2350
|
+
routeName = input("", /* @ts-ignore */
|
|
2351
|
+
...(ngDevMode ? [{ debugName: "routeName" }] : /* istanbul ignore next */ []));
|
|
2342
2352
|
// Default `undefined` (NOT {}): an omitted `routeParams` must reach
|
|
2343
2353
|
// `createActiveRouteSource` (via `stableParams`) as `undefined` so the active
|
|
2344
2354
|
// source keys "" and shares ONE cached source / router subscription with a
|
|
2345
2355
|
// manual `injectIsActiveRoute(name)`. Defaulting to {} keys "{}" and splits
|
|
2346
2356
|
// the same logical question into a second eager subscription (#776).
|
|
2347
|
-
routeParams = input(undefined,
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2357
|
+
routeParams = input(undefined, /* @ts-ignore */
|
|
2358
|
+
...(ngDevMode ? [{ debugName: "routeParams" }] : /* istanbul ignore next */ []));
|
|
2359
|
+
routeOptions = input({}, /* @ts-ignore */
|
|
2360
|
+
...(ngDevMode ? [{ debugName: "routeOptions" }] : /* istanbul ignore next */ []));
|
|
2361
|
+
activeClassName = input("active", /* @ts-ignore */
|
|
2362
|
+
...(ngDevMode ? [{ debugName: "activeClassName" }] : /* istanbul ignore next */ []));
|
|
2363
|
+
activeStrict = input(false, /* @ts-ignore */
|
|
2364
|
+
...(ngDevMode ? [{ debugName: "activeStrict" }] : /* istanbul ignore next */ []));
|
|
2365
|
+
ignoreQueryParams = input(true, /* @ts-ignore */
|
|
2366
|
+
...(ngDevMode ? [{ debugName: "ignoreQueryParams" }] : /* istanbul ignore next */ []));
|
|
2352
2367
|
/**
|
|
2353
2368
|
* URL fragment (decoded form, no leading "#") (#532).
|
|
2354
2369
|
* - omitted/`undefined` → preserve current fragment on same-route navigation
|
|
2355
2370
|
* - `""` → clear fragment
|
|
2356
2371
|
* - non-empty → set fragment
|
|
2357
2372
|
*/
|
|
2358
|
-
hash = input(undefined,
|
|
2373
|
+
hash = input(undefined, /* @ts-ignore */
|
|
2374
|
+
...(ngDevMode ? [{ debugName: "hash" }] : /* istanbul ignore next */ []));
|
|
2359
2375
|
router = injectRouter();
|
|
2360
2376
|
anchor = inject(ElementRef)
|
|
2361
2377
|
.nativeElement;
|
|
2362
|
-
isActive = signal(false,
|
|
2378
|
+
isActive = signal(false, /* @ts-ignore */
|
|
2379
|
+
...(ngDevMode ? [{ debugName: "isActive" }] : /* istanbul ignore next */ []));
|
|
2363
2380
|
// Content-stable `routeParams` (#988). Angular re-allocates an inline
|
|
2364
2381
|
// `[routeParams]="{ id: 1 }"` literal on every change detection, so the raw
|
|
2365
2382
|
// signal input changes identity each navigation even when the param content
|
|
@@ -2374,7 +2391,8 @@ class RealLink {
|
|
|
2374
2391
|
href = computed(() => {
|
|
2375
2392
|
const hashValue = this.hash();
|
|
2376
2393
|
return buildHref(this.router, this.routeName(), this.stableParams() ?? EMPTY_PARAMS, hashValue === undefined ? undefined : { hash: hashValue });
|
|
2377
|
-
},
|
|
2394
|
+
}, /* @ts-ignore */
|
|
2395
|
+
...(ngDevMode ? [{ debugName: "href" }] : /* istanbul ignore next */ []));
|
|
2378
2396
|
prevActiveClass = "";
|
|
2379
2397
|
prevHref = undefined;
|
|
2380
2398
|
// Skip-same-value: only re-touch the DOM `class` list when the active state
|
|
@@ -2429,10 +2447,10 @@ class RealLink {
|
|
|
2429
2447
|
}
|
|
2430
2448
|
this.prevActiveClass = activeClass;
|
|
2431
2449
|
}
|
|
2432
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2433
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
2450
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RealLink, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2451
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: RealLink, isStandalone: true, selector: "a[realLink]", inputs: { routeName: { classPropertyName: "routeName", publicName: "routeName", isSignal: true, isRequired: false, transformFunction: null }, routeParams: { classPropertyName: "routeParams", publicName: "routeParams", isSignal: true, isRequired: false, transformFunction: null }, routeOptions: { classPropertyName: "routeOptions", publicName: "routeOptions", isSignal: true, isRequired: false, transformFunction: null }, activeClassName: { classPropertyName: "activeClassName", publicName: "activeClassName", isSignal: true, isRequired: false, transformFunction: null }, activeStrict: { classPropertyName: "activeStrict", publicName: "activeStrict", isSignal: true, isRequired: false, transformFunction: null }, ignoreQueryParams: { classPropertyName: "ignoreQueryParams", publicName: "ignoreQueryParams", isSignal: true, isRequired: false, transformFunction: null }, hash: { classPropertyName: "hash", publicName: "hash", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick($event)" } }, ngImport: i0 });
|
|
2434
2452
|
}
|
|
2435
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2453
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RealLink, decorators: [{
|
|
2436
2454
|
type: Directive,
|
|
2437
2455
|
args: [{
|
|
2438
2456
|
selector: "a[realLink]",
|
|
@@ -2443,19 +2461,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
2443
2461
|
}], ctorParameters: () => [], propDecorators: { routeName: [{ type: i0.Input, args: [{ isSignal: true, alias: "routeName", required: false }] }], routeParams: [{ type: i0.Input, args: [{ isSignal: true, alias: "routeParams", required: false }] }], routeOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "routeOptions", required: false }] }], activeClassName: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeClassName", required: false }] }], activeStrict: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeStrict", required: false }] }], ignoreQueryParams: [{ type: i0.Input, args: [{ isSignal: true, alias: "ignoreQueryParams", required: false }] }], hash: [{ type: i0.Input, args: [{ isSignal: true, alias: "hash", required: false }] }] } });
|
|
2444
2462
|
|
|
2445
2463
|
class RealLinkActive {
|
|
2446
|
-
realLinkActive = input("",
|
|
2447
|
-
|
|
2464
|
+
realLinkActive = input("", /* @ts-ignore */
|
|
2465
|
+
...(ngDevMode ? [{ debugName: "realLinkActive" }] : /* istanbul ignore next */ []));
|
|
2466
|
+
routeName = input("", /* @ts-ignore */
|
|
2467
|
+
...(ngDevMode ? [{ debugName: "routeName" }] : /* istanbul ignore next */ []));
|
|
2448
2468
|
// Default `undefined` (NOT {}): an omitted `routeParams` must reach
|
|
2449
2469
|
// `createActiveRouteSource` (via `stableParams`) as `undefined` so the active
|
|
2450
2470
|
// source keys "" and shares ONE cached source with a manual
|
|
2451
2471
|
// `injectIsActiveRoute(name)`, instead of keying "{}" and opening a second
|
|
2452
2472
|
// eager subscription for the same question (#776). Mirrors `RealLink`.
|
|
2453
|
-
routeParams = input(undefined,
|
|
2454
|
-
|
|
2455
|
-
|
|
2473
|
+
routeParams = input(undefined, /* @ts-ignore */
|
|
2474
|
+
...(ngDevMode ? [{ debugName: "routeParams" }] : /* istanbul ignore next */ []));
|
|
2475
|
+
activeStrict = input(false, /* @ts-ignore */
|
|
2476
|
+
...(ngDevMode ? [{ debugName: "activeStrict" }] : /* istanbul ignore next */ []));
|
|
2477
|
+
ignoreQueryParams = input(true, /* @ts-ignore */
|
|
2478
|
+
...(ngDevMode ? [{ debugName: "ignoreQueryParams" }] : /* istanbul ignore next */ []));
|
|
2456
2479
|
router = injectRouter();
|
|
2457
2480
|
element = inject(ElementRef).nativeElement;
|
|
2458
|
-
isActive = signal(false,
|
|
2481
|
+
isActive = signal(false, /* @ts-ignore */
|
|
2482
|
+
...(ngDevMode ? [{ debugName: "isActive" }] : /* istanbul ignore next */ []));
|
|
2459
2483
|
// Content-stable `routeParams` (#988) — see the matching field in `RealLink`.
|
|
2460
2484
|
// Lets the source-creation effect bail until param content actually changes
|
|
2461
2485
|
// instead of churning on every fresh inline-literal binding.
|
|
@@ -2490,10 +2514,10 @@ class RealLinkActive {
|
|
|
2490
2514
|
}
|
|
2491
2515
|
this.element.classList.toggle(className, this.isActive());
|
|
2492
2516
|
}
|
|
2493
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2494
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
2517
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RealLinkActive, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2518
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: RealLinkActive, isStandalone: true, selector: "[realLinkActive]", inputs: { realLinkActive: { classPropertyName: "realLinkActive", publicName: "realLinkActive", isSignal: true, isRequired: false, transformFunction: null }, routeName: { classPropertyName: "routeName", publicName: "routeName", isSignal: true, isRequired: false, transformFunction: null }, routeParams: { classPropertyName: "routeParams", publicName: "routeParams", isSignal: true, isRequired: false, transformFunction: null }, activeStrict: { classPropertyName: "activeStrict", publicName: "activeStrict", isSignal: true, isRequired: false, transformFunction: null }, ignoreQueryParams: { classPropertyName: "ignoreQueryParams", publicName: "ignoreQueryParams", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
2495
2519
|
}
|
|
2496
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2520
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RealLinkActive, decorators: [{
|
|
2497
2521
|
type: Directive,
|
|
2498
2522
|
args: [{ selector: "[realLinkActive]" }]
|
|
2499
2523
|
}], ctorParameters: () => [], propDecorators: { realLinkActive: [{ type: i0.Input, args: [{ isSignal: true, alias: "realLinkActive", required: false }] }], routeName: [{ type: i0.Input, args: [{ isSignal: true, alias: "routeName", required: false }] }], routeParams: [{ type: i0.Input, args: [{ isSignal: true, alias: "routeParams", required: false }] }], activeStrict: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeStrict", required: false }] }], ignoreQueryParams: [{ type: i0.Input, args: [{ isSignal: true, alias: "ignoreQueryParams", required: false }] }] } });
|