@real-router/angular 0.11.12 → 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 +180 -66
- package/dist/fesm2022/real-router-angular.mjs.map +1 -1
- package/dist/package.json +57 -0
- package/dist/types/real-router-angular.d.ts +7 -3
- package/dist/types/real-router-angular.d.ts.map +1 -1
- package/package.json +12 -12
|
@@ -75,6 +75,14 @@ const NOOP_INSTANCE$3 = Object.freeze({
|
|
|
75
75
|
/* no-op */
|
|
76
76
|
},
|
|
77
77
|
});
|
|
78
|
+
// Live (non-NOOP) instances sharing the single `[data-real-router-announcer]`
|
|
79
|
+
// aria-live element. The element is created once by the first instance
|
|
80
|
+
// (`getOrCreateAnnouncer`) and reused by the rest; it must be removed only when
|
|
81
|
+
// the LAST holder is destroyed. Without this count the first provider's
|
|
82
|
+
// destroy() would detach the shared node while sibling providers (micro-
|
|
83
|
+
// frontends — the same multi-provider scenario `scroll-restore`'s `storageKey`
|
|
84
|
+
// exists for) keep writing to the now-orphaned node → silent screen reader (#783).
|
|
85
|
+
let announcerRefCount = 0;
|
|
78
86
|
function createRouteAnnouncer(router, options) {
|
|
79
87
|
// Defensive SSR / non-browser guard: in SSR (Node.js) or non-DOM
|
|
80
88
|
// environments, `document` is undefined and the announcer cannot
|
|
@@ -97,6 +105,7 @@ function createRouteAnnouncer(router, options) {
|
|
|
97
105
|
let pendingText = null;
|
|
98
106
|
let clearTimeoutId;
|
|
99
107
|
const announcer = getOrCreateAnnouncer();
|
|
108
|
+
announcerRefCount += 1;
|
|
100
109
|
const doAnnounce = (text, h1) => {
|
|
101
110
|
lastAnnouncedText = text;
|
|
102
111
|
clearTimeout(clearTimeoutId);
|
|
@@ -150,11 +159,22 @@ function createRouteAnnouncer(router, options) {
|
|
|
150
159
|
});
|
|
151
160
|
return {
|
|
152
161
|
destroy() {
|
|
162
|
+
// Idempotency guard — required so the ref-count is decremented EXACTLY
|
|
163
|
+
// once per instance. A double destroy() must not drop the count below the
|
|
164
|
+
// number of live holders (which would detach a sibling's element, or
|
|
165
|
+
// leave it attached forever).
|
|
166
|
+
if (isDestroyed) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
153
169
|
isDestroyed = true;
|
|
154
170
|
unsubscribe();
|
|
155
171
|
clearTimeout(clearTimeoutId);
|
|
156
172
|
clearTimeout(safariTimeoutId);
|
|
157
|
-
|
|
173
|
+
announcerRefCount -= 1;
|
|
174
|
+
// Only the last holder tears down the shared element.
|
|
175
|
+
if (announcerRefCount === 0) {
|
|
176
|
+
removeAnnouncer();
|
|
177
|
+
}
|
|
158
178
|
},
|
|
159
179
|
};
|
|
160
180
|
}
|
|
@@ -163,6 +183,13 @@ function getOrCreateAnnouncer() {
|
|
|
163
183
|
if (existing) {
|
|
164
184
|
return existing;
|
|
165
185
|
}
|
|
186
|
+
// Creating a FRESH element means no live instance is validly sharing one, so
|
|
187
|
+
// the ref-count restarts from zero (the caller increments immediately after).
|
|
188
|
+
// Without this, an element removed out from under live instances — a host
|
|
189
|
+
// wiping the subtree, or a consumer test whose teardown clears the DOM
|
|
190
|
+
// without calling every instance's destroy() — would leave a stale positive
|
|
191
|
+
// count that prevents the new element from ever being torn down (#783).
|
|
192
|
+
announcerRefCount = 0;
|
|
166
193
|
const element = document.createElement("div");
|
|
167
194
|
element.setAttribute("style", VISUALLY_HIDDEN);
|
|
168
195
|
element.setAttribute("aria-live", "assertive");
|
|
@@ -418,6 +445,15 @@ function createScrollRestoration(router, options) {
|
|
|
418
445
|
};
|
|
419
446
|
let destroyed = false;
|
|
420
447
|
let unserializableWarned = false;
|
|
448
|
+
// Capture/effect seam guard (#782). previousRoute's position is captured
|
|
449
|
+
// synchronously in `subscribe`, but the snap/restore effect runs a frame
|
|
450
|
+
// later in rAF. Across that window the viewport still shows the route BEFORE
|
|
451
|
+
// previousRoute, so a second navigation landing in the same frame would
|
|
452
|
+
// capture that foreign position under previousRoute's key. `scrollSettled` is
|
|
453
|
+
// false across the window — capture is skipped (previousRoute's own stored
|
|
454
|
+
// value survives the transit). A real user scroll in this <16ms window is
|
|
455
|
+
// physically impossible.
|
|
456
|
+
let scrollSettled = true;
|
|
421
457
|
// `keyOf` defers to `canonicalJson` which calls `JSON.stringify`. Two
|
|
422
458
|
// realistic inputs blow up the serializer and would otherwise crash the
|
|
423
459
|
// subscribe callback (taking scroll-restore offline for the whole session):
|
|
@@ -443,17 +479,25 @@ function createScrollRestoration(router, options) {
|
|
|
443
479
|
.navigation;
|
|
444
480
|
// Browsers dispatch reload as the initial navigation after refresh, so
|
|
445
481
|
// previousRoute is undefined and capture is naturally skipped. The
|
|
446
|
-
// pre-refresh position was already persisted via pagehide.
|
|
447
|
-
|
|
482
|
+
// pre-refresh position was already persisted via pagehide. Capture is also
|
|
483
|
+
// skipped while the scroll is unsettled — a second navigation in the same
|
|
484
|
+
// frame, before the prior nav's rAF snap (see `scrollSettled`, #782).
|
|
485
|
+
if (previousRoute && scrollSettled) {
|
|
448
486
|
const prevKey = safeKeyOf(previousRoute);
|
|
449
487
|
if (prevKey !== null) {
|
|
450
488
|
putPos(prevKey, readPos());
|
|
451
489
|
}
|
|
452
490
|
}
|
|
491
|
+
// This navigation's scroll effect is now pending: the viewport position no
|
|
492
|
+
// longer belongs to `route` until the rAF below runs and settles it.
|
|
493
|
+
scrollSettled = false;
|
|
453
494
|
requestAnimationFrame(() => {
|
|
454
495
|
if (destroyed) {
|
|
455
496
|
return;
|
|
456
497
|
}
|
|
498
|
+
// Effect running — the position now belongs to `route`, so the next
|
|
499
|
+
// capture is honest again.
|
|
500
|
+
scrollSettled = true;
|
|
457
501
|
if (mode === "top") {
|
|
458
502
|
scrollToHashOrTop(route);
|
|
459
503
|
return;
|
|
@@ -806,11 +850,24 @@ const createObserverPair = (selector, rootMargin, getContainer, onIntersection,
|
|
|
806
850
|
}
|
|
807
851
|
onIntersection();
|
|
808
852
|
};
|
|
809
|
-
|
|
810
|
-
|
|
853
|
+
// Build (and rebuild) the IntersectionObserver for a given root. A root is
|
|
854
|
+
// immutable once its IO is constructed, so `reconcile` recreates the IO via
|
|
855
|
+
// this same factory when the resolved container changes (#780) — one
|
|
856
|
+
// definition, two call sites.
|
|
857
|
+
const makeIo = (container) => new IntersectionObserver(handleIntersection, {
|
|
858
|
+
root: container,
|
|
811
859
|
rootMargin,
|
|
812
860
|
threshold: 0,
|
|
813
861
|
});
|
|
862
|
+
// Container the IntersectionObserver root + MutationObserver target are
|
|
863
|
+
// built with. Both are immutable once the observer is constructed (W3C), so
|
|
864
|
+
// a `scrollContainer` that resolves to a different element after creation —
|
|
865
|
+
// most importantly one that MOUNTS after the spy starts (Angular wires the
|
|
866
|
+
// spy at bootstrap, before any component renders; a docs route's container
|
|
867
|
+
// mounts on navigation) — is only honoured by rebuilding the pair in
|
|
868
|
+
// `reconcile`. Tracked here so `reconcile` can compare on every run (#780).
|
|
869
|
+
let observerContainer = getContainer();
|
|
870
|
+
let io = makeIo(observerContainer);
|
|
814
871
|
const observeMatches = () => {
|
|
815
872
|
const scope = getContainer() ?? document;
|
|
816
873
|
let candidates;
|
|
@@ -842,6 +899,22 @@ const createObserverPair = (selector, rootMargin, getContainer, onIntersection,
|
|
|
842
899
|
observed.add(element);
|
|
843
900
|
}
|
|
844
901
|
};
|
|
902
|
+
// MutationObserver init — reused when the observer is re-pointed at a new
|
|
903
|
+
// container in `reconcile`. `childList: true, subtree: true` catches
|
|
904
|
+
// structural changes; `attributes: true, attributeFilter: ["id"]` catches
|
|
905
|
+
// anchor id renames (typical for client-rendered docs). The MO targets the
|
|
906
|
+
// scroll container (or document.body for the window viewport).
|
|
907
|
+
const MUTATION_OBSERVE_INIT = {
|
|
908
|
+
childList: true,
|
|
909
|
+
subtree: true,
|
|
910
|
+
attributes: true,
|
|
911
|
+
attributeFilter: ["id"],
|
|
912
|
+
};
|
|
913
|
+
// Null-then-assigned — the same forward-reference idiom as `flush` in the
|
|
914
|
+
// main scope. `reconcile` re-points it on a container change, so it must be
|
|
915
|
+
// in scope above its assignment; it is non-null by the time any async
|
|
916
|
+
// mutation callback (or `reconcile`) runs.
|
|
917
|
+
let mo = null;
|
|
845
918
|
const reconcile = () => {
|
|
846
919
|
// Drop observed elements that left the DOM. Avoids observer holding
|
|
847
920
|
// strong refs to detached nodes. Also drop their accumulated entry so
|
|
@@ -855,15 +928,28 @@ const createObserverPair = (selector, rootMargin, getContainer, onIntersection,
|
|
|
855
928
|
observed.delete(element);
|
|
856
929
|
pending.delete(element);
|
|
857
930
|
}
|
|
931
|
+
// Honour a container that mounted (or changed) after construction (#780).
|
|
932
|
+
// The IntersectionObserver root and MutationObserver target cannot be
|
|
933
|
+
// mutated in place, so rebuild the pair under the new container. Clearing
|
|
934
|
+
// `observed` + `pending` makes the rebuild equivalent to constructing the
|
|
935
|
+
// spy with this container from the start: `observeMatches` below
|
|
936
|
+
// re-populates the tracked set from the new container's scope, and the
|
|
937
|
+
// stale merged snapshot (computed against the old root's geometry) is
|
|
938
|
+
// dropped — one empty debounce window, acceptable for a rare event.
|
|
939
|
+
const nextContainer = getContainer();
|
|
940
|
+
if (nextContainer !== observerContainer) {
|
|
941
|
+
observerContainer = nextContainer;
|
|
942
|
+
io.disconnect();
|
|
943
|
+
io = makeIo(nextContainer);
|
|
944
|
+
observed.clear();
|
|
945
|
+
pending.clear();
|
|
946
|
+
mo?.disconnect();
|
|
947
|
+
mo?.observe(nextContainer ?? document.body, MUTATION_OBSERVE_INIT);
|
|
948
|
+
}
|
|
858
949
|
observeMatches();
|
|
859
950
|
};
|
|
860
951
|
observeMatches();
|
|
861
|
-
|
|
862
|
-
// window viewport). `childList: true, subtree: true` catches structural
|
|
863
|
-
// changes; `attributes: true, attributeFilter: ["id"]` catches anchor
|
|
864
|
-
// id renames (typical for client-rendered docs).
|
|
865
|
-
const mutationTarget = getContainer() ?? document.body;
|
|
866
|
-
const mo = new MutationObserver(() => {
|
|
952
|
+
mo = new MutationObserver(() => {
|
|
867
953
|
if (mutationTimer !== null) {
|
|
868
954
|
clearTimeout(mutationTimer);
|
|
869
955
|
}
|
|
@@ -872,12 +958,7 @@ const createObserverPair = (selector, rootMargin, getContainer, onIntersection,
|
|
|
872
958
|
reconcile();
|
|
873
959
|
}, MUTATION_DEBOUNCE_MS);
|
|
874
960
|
});
|
|
875
|
-
mo.observe(
|
|
876
|
-
childList: true,
|
|
877
|
-
subtree: true,
|
|
878
|
-
attributes: true,
|
|
879
|
-
attributeFilter: ["id"],
|
|
880
|
-
});
|
|
961
|
+
mo.observe(observerContainer ?? document.body, MUTATION_OBSERVE_INIT);
|
|
881
962
|
return {
|
|
882
963
|
pending,
|
|
883
964
|
destroy() {
|
|
@@ -1136,6 +1217,13 @@ function createViewTransitions(router) {
|
|
|
1136
1217
|
currentVT = null;
|
|
1137
1218
|
}
|
|
1138
1219
|
else {
|
|
1220
|
+
// The VT this resolver belongs to. If the next navigation opens a new VT
|
|
1221
|
+
// in the task-queue window before this setTimeout runs, the stale
|
|
1222
|
+
// resolver must NOT null the new `currentVT` — otherwise a later
|
|
1223
|
+
// cancellation reads `null` and skips nothing, leaking a stale animation
|
|
1224
|
+
// (#781). Same identity-guard technique the navigation-plugin uses to
|
|
1225
|
+
// heal its seams.
|
|
1226
|
+
const scheduledVT = currentVT;
|
|
1139
1227
|
// CRITICAL: CANNOT use requestAnimationFrame here. When the router
|
|
1140
1228
|
// takes the async path (leave returned a Promise), subscribe fires
|
|
1141
1229
|
// AFTER the browser has already transitioned VT into the
|
|
@@ -1150,7 +1238,9 @@ function createViewTransitions(router) {
|
|
|
1150
1238
|
// so the new DOM is committed by the time our callback runs.
|
|
1151
1239
|
setTimeout(() => {
|
|
1152
1240
|
resolver();
|
|
1153
|
-
currentVT
|
|
1241
|
+
if (currentVT === scheduledVT) {
|
|
1242
|
+
currentVT = null;
|
|
1243
|
+
}
|
|
1154
1244
|
}, 0);
|
|
1155
1245
|
}
|
|
1156
1246
|
});
|
|
@@ -1465,7 +1555,8 @@ function installViewTransitions() {
|
|
|
1465
1555
|
|
|
1466
1556
|
/** Must be called within an injection context (constructor, field initializer, runInInjectionContext). */
|
|
1467
1557
|
function sourceToSignal(source) {
|
|
1468
|
-
const sig = signal(source.getSnapshot(),
|
|
1558
|
+
const sig = signal(source.getSnapshot(), /* @ts-ignore */
|
|
1559
|
+
...(ngDevMode ? [{ debugName: "sig" }] : /* istanbul ignore next */ []));
|
|
1469
1560
|
const destroyRef = inject(DestroyRef);
|
|
1470
1561
|
const unsubscribe = source.subscribe(() => {
|
|
1471
1562
|
sig.set(source.getSnapshot());
|
|
@@ -1944,32 +2035,33 @@ function injectRouteEnter(handler, options) {
|
|
|
1944
2035
|
}
|
|
1945
2036
|
|
|
1946
2037
|
class RouteMatch {
|
|
1947
|
-
routeMatch = input.required(
|
|
2038
|
+
routeMatch = input.required(/* @ts-ignore */
|
|
2039
|
+
...(ngDevMode ? [{ debugName: "routeMatch" }] : /* istanbul ignore next */ []));
|
|
1948
2040
|
templateRef = inject(TemplateRef);
|
|
1949
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1950
|
-
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 });
|
|
1951
2043
|
}
|
|
1952
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2044
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RouteMatch, decorators: [{
|
|
1953
2045
|
type: Directive,
|
|
1954
2046
|
args: [{ selector: "ng-template[routeMatch]" }]
|
|
1955
2047
|
}], propDecorators: { routeMatch: [{ type: i0.Input, args: [{ isSignal: true, alias: "routeMatch", required: true }] }] } });
|
|
1956
2048
|
|
|
1957
2049
|
class RouteNotFound {
|
|
1958
2050
|
templateRef = inject(TemplateRef);
|
|
1959
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1960
|
-
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 });
|
|
1961
2053
|
}
|
|
1962
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2054
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RouteNotFound, decorators: [{
|
|
1963
2055
|
type: Directive,
|
|
1964
2056
|
args: [{ selector: "ng-template[routeNotFound]" }]
|
|
1965
2057
|
}] });
|
|
1966
2058
|
|
|
1967
2059
|
class RouteSelf {
|
|
1968
2060
|
templateRef = inject(TemplateRef);
|
|
1969
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1970
|
-
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 });
|
|
1971
2063
|
}
|
|
1972
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2064
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RouteSelf, decorators: [{
|
|
1973
2065
|
type: Directive,
|
|
1974
2066
|
args: [{ selector: "ng-template[routeSelf]" }]
|
|
1975
2067
|
}] });
|
|
@@ -2025,9 +2117,11 @@ class RouteView {
|
|
|
2025
2117
|
matches = contentChildren(RouteMatch, { ...(ngDevMode ? { debugName: "matches" } : /* istanbul ignore next */ {}), descendants: true });
|
|
2026
2118
|
selfs = contentChildren(RouteSelf, { ...(ngDevMode ? { debugName: "selfs" } : /* istanbul ignore next */ {}), descendants: true });
|
|
2027
2119
|
notFounds = contentChildren(RouteNotFound, { ...(ngDevMode ? { debugName: "notFounds" } : /* istanbul ignore next */ {}), descendants: true });
|
|
2028
|
-
activeTemplate = computed(() => this.matchedTemplate() ?? this.fallbackTemplate(),
|
|
2120
|
+
activeTemplate = computed(() => this.matchedTemplate() ?? this.fallbackTemplate(), /* @ts-ignore */
|
|
2121
|
+
...(ngDevMode ? [{ debugName: "activeTemplate" }] : /* istanbul ignore next */ []));
|
|
2029
2122
|
router = injectRouter();
|
|
2030
|
-
routeState = signal(EMPTY_SNAPSHOT,
|
|
2123
|
+
routeState = signal(EMPTY_SNAPSHOT, /* @ts-ignore */
|
|
2124
|
+
...(ngDevMode ? [{ debugName: "routeState" }] : /* istanbul ignore next */ []));
|
|
2031
2125
|
matchEntries = computed(() => {
|
|
2032
2126
|
const nodeName = this.nodeName();
|
|
2033
2127
|
return this.matches().map((match) => {
|
|
@@ -2037,7 +2131,8 @@ class RouteView {
|
|
|
2037
2131
|
fullSegmentName: nodeName ? `${nodeName}.${segment}` : segment,
|
|
2038
2132
|
};
|
|
2039
2133
|
});
|
|
2040
|
-
},
|
|
2134
|
+
}, /* @ts-ignore */
|
|
2135
|
+
...(ngDevMode ? [{ debugName: "matchEntries" }] : /* istanbul ignore next */ []));
|
|
2041
2136
|
// The matched template (Match priority) is independent of the Self /
|
|
2042
2137
|
// NotFound fallback chain. Splitting the two paths into separate computeds
|
|
2043
2138
|
// localises re-runs: a change to `selfs()` / `notFounds()` no longer
|
|
@@ -2055,7 +2150,8 @@ class RouteView {
|
|
|
2055
2150
|
}
|
|
2056
2151
|
}
|
|
2057
2152
|
return null;
|
|
2058
|
-
},
|
|
2153
|
+
}, /* @ts-ignore */
|
|
2154
|
+
...(ngDevMode ? [{ debugName: "matchedTemplate" }] : /* istanbul ignore next */ []));
|
|
2059
2155
|
// Fallback chain — only consulted when `matchedTemplate()` returned `null`.
|
|
2060
2156
|
// Template priority: Self → NotFound. Selection rules differ on purpose:
|
|
2061
2157
|
// - **Self uses first-wins** (`.at(0)`) for parity with React / Preact /
|
|
@@ -2084,7 +2180,8 @@ class RouteView {
|
|
|
2084
2180
|
}
|
|
2085
2181
|
}
|
|
2086
2182
|
return null;
|
|
2087
|
-
},
|
|
2183
|
+
}, /* @ts-ignore */
|
|
2184
|
+
...(ngDevMode ? [{ debugName: "fallbackTemplate" }] : /* istanbul ignore next */ []));
|
|
2088
2185
|
constructor() {
|
|
2089
2186
|
// Reactive source-creation effect (#630 fix) — see
|
|
2090
2187
|
// `packages/angular/CLAUDE.md` → "Directives use constructor + effect()".
|
|
@@ -2095,14 +2192,14 @@ class RouteView {
|
|
|
2095
2192
|
}));
|
|
2096
2193
|
});
|
|
2097
2194
|
}
|
|
2098
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2099
|
-
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: `
|
|
2100
2197
|
@if (activeTemplate()) {
|
|
2101
2198
|
<ng-container [ngTemplateOutlet]="activeTemplate()!" />
|
|
2102
2199
|
}
|
|
2103
2200
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
2104
2201
|
}
|
|
2105
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2202
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RouteView, decorators: [{
|
|
2106
2203
|
type: Component,
|
|
2107
2204
|
args: [{
|
|
2108
2205
|
selector: "route-view",
|
|
@@ -2116,7 +2213,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
2116
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 }] }] } });
|
|
2117
2214
|
|
|
2118
2215
|
class RouterErrorBoundary {
|
|
2119
|
-
errorTemplate = input(
|
|
2216
|
+
errorTemplate = input(/* @ts-ignore */
|
|
2217
|
+
...(ngDevMode ? [undefined, { debugName: "errorTemplate" }] : /* istanbul ignore next */ []));
|
|
2120
2218
|
onError = output();
|
|
2121
2219
|
errorContext = computed(() => {
|
|
2122
2220
|
const snap = this.snapshot();
|
|
@@ -2127,7 +2225,8 @@ class RouterErrorBoundary {
|
|
|
2127
2225
|
$implicit: snap.error,
|
|
2128
2226
|
resetError: snap.resetError,
|
|
2129
2227
|
};
|
|
2130
|
-
},
|
|
2228
|
+
}, /* @ts-ignore */
|
|
2229
|
+
...(ngDevMode ? [{ debugName: "errorContext" }] : /* istanbul ignore next */ []));
|
|
2131
2230
|
router = injectRouter();
|
|
2132
2231
|
snapshot = sourceToSignal(createDismissableError(this.router));
|
|
2133
2232
|
constructor() {
|
|
@@ -2148,8 +2247,8 @@ class RouterErrorBoundary {
|
|
|
2148
2247
|
}
|
|
2149
2248
|
});
|
|
2150
2249
|
}
|
|
2151
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2152
|
-
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: `
|
|
2153
2252
|
<ng-content />
|
|
2154
2253
|
@if (errorContext() && errorTemplate()) {
|
|
2155
2254
|
<ng-container
|
|
@@ -2159,7 +2258,7 @@ class RouterErrorBoundary {
|
|
|
2159
2258
|
}
|
|
2160
2259
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
2161
2260
|
}
|
|
2162
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2261
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RouterErrorBoundary, decorators: [{
|
|
2163
2262
|
type: Component,
|
|
2164
2263
|
args: [{
|
|
2165
2264
|
selector: "router-error-boundary",
|
|
@@ -2183,10 +2282,10 @@ class NavigationAnnouncer {
|
|
|
2183
2282
|
this.announcer.destroy();
|
|
2184
2283
|
});
|
|
2185
2284
|
}
|
|
2186
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2187
|
-
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 });
|
|
2188
2287
|
}
|
|
2189
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2288
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: NavigationAnnouncer, decorators: [{
|
|
2190
2289
|
type: Component,
|
|
2191
2290
|
args: [{
|
|
2192
2291
|
selector: "navigation-announcer",
|
|
@@ -2248,28 +2347,36 @@ const NOOP_CATCH = () => { };
|
|
|
2248
2347
|
// `injectIsActiveRoute(name)` instead of keying "{}" (#776).
|
|
2249
2348
|
const EMPTY_PARAMS = Object.freeze({});
|
|
2250
2349
|
class RealLink {
|
|
2251
|
-
routeName = input("",
|
|
2350
|
+
routeName = input("", /* @ts-ignore */
|
|
2351
|
+
...(ngDevMode ? [{ debugName: "routeName" }] : /* istanbul ignore next */ []));
|
|
2252
2352
|
// Default `undefined` (NOT {}): an omitted `routeParams` must reach
|
|
2253
2353
|
// `createActiveRouteSource` (via `stableParams`) as `undefined` so the active
|
|
2254
2354
|
// source keys "" and shares ONE cached source / router subscription with a
|
|
2255
2355
|
// manual `injectIsActiveRoute(name)`. Defaulting to {} keys "{}" and splits
|
|
2256
2356
|
// the same logical question into a second eager subscription (#776).
|
|
2257
|
-
routeParams = input(undefined,
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
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 */ []));
|
|
2262
2367
|
/**
|
|
2263
2368
|
* URL fragment (decoded form, no leading "#") (#532).
|
|
2264
2369
|
* - omitted/`undefined` → preserve current fragment on same-route navigation
|
|
2265
2370
|
* - `""` → clear fragment
|
|
2266
2371
|
* - non-empty → set fragment
|
|
2267
2372
|
*/
|
|
2268
|
-
hash = input(undefined,
|
|
2373
|
+
hash = input(undefined, /* @ts-ignore */
|
|
2374
|
+
...(ngDevMode ? [{ debugName: "hash" }] : /* istanbul ignore next */ []));
|
|
2269
2375
|
router = injectRouter();
|
|
2270
2376
|
anchor = inject(ElementRef)
|
|
2271
2377
|
.nativeElement;
|
|
2272
|
-
isActive = signal(false,
|
|
2378
|
+
isActive = signal(false, /* @ts-ignore */
|
|
2379
|
+
...(ngDevMode ? [{ debugName: "isActive" }] : /* istanbul ignore next */ []));
|
|
2273
2380
|
// Content-stable `routeParams` (#988). Angular re-allocates an inline
|
|
2274
2381
|
// `[routeParams]="{ id: 1 }"` literal on every change detection, so the raw
|
|
2275
2382
|
// signal input changes identity each navigation even when the param content
|
|
@@ -2284,7 +2391,8 @@ class RealLink {
|
|
|
2284
2391
|
href = computed(() => {
|
|
2285
2392
|
const hashValue = this.hash();
|
|
2286
2393
|
return buildHref(this.router, this.routeName(), this.stableParams() ?? EMPTY_PARAMS, hashValue === undefined ? undefined : { hash: hashValue });
|
|
2287
|
-
},
|
|
2394
|
+
}, /* @ts-ignore */
|
|
2395
|
+
...(ngDevMode ? [{ debugName: "href" }] : /* istanbul ignore next */ []));
|
|
2288
2396
|
prevActiveClass = "";
|
|
2289
2397
|
prevHref = undefined;
|
|
2290
2398
|
// Skip-same-value: only re-touch the DOM `class` list when the active state
|
|
@@ -2339,10 +2447,10 @@ class RealLink {
|
|
|
2339
2447
|
}
|
|
2340
2448
|
this.prevActiveClass = activeClass;
|
|
2341
2449
|
}
|
|
2342
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2343
|
-
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 });
|
|
2344
2452
|
}
|
|
2345
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2453
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RealLink, decorators: [{
|
|
2346
2454
|
type: Directive,
|
|
2347
2455
|
args: [{
|
|
2348
2456
|
selector: "a[realLink]",
|
|
@@ -2353,19 +2461,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
2353
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 }] }] } });
|
|
2354
2462
|
|
|
2355
2463
|
class RealLinkActive {
|
|
2356
|
-
realLinkActive = input("",
|
|
2357
|
-
|
|
2464
|
+
realLinkActive = input("", /* @ts-ignore */
|
|
2465
|
+
...(ngDevMode ? [{ debugName: "realLinkActive" }] : /* istanbul ignore next */ []));
|
|
2466
|
+
routeName = input("", /* @ts-ignore */
|
|
2467
|
+
...(ngDevMode ? [{ debugName: "routeName" }] : /* istanbul ignore next */ []));
|
|
2358
2468
|
// Default `undefined` (NOT {}): an omitted `routeParams` must reach
|
|
2359
2469
|
// `createActiveRouteSource` (via `stableParams`) as `undefined` so the active
|
|
2360
2470
|
// source keys "" and shares ONE cached source with a manual
|
|
2361
2471
|
// `injectIsActiveRoute(name)`, instead of keying "{}" and opening a second
|
|
2362
2472
|
// eager subscription for the same question (#776). Mirrors `RealLink`.
|
|
2363
|
-
routeParams = input(undefined,
|
|
2364
|
-
|
|
2365
|
-
|
|
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 */ []));
|
|
2366
2479
|
router = injectRouter();
|
|
2367
2480
|
element = inject(ElementRef).nativeElement;
|
|
2368
|
-
isActive = signal(false,
|
|
2481
|
+
isActive = signal(false, /* @ts-ignore */
|
|
2482
|
+
...(ngDevMode ? [{ debugName: "isActive" }] : /* istanbul ignore next */ []));
|
|
2369
2483
|
// Content-stable `routeParams` (#988) — see the matching field in `RealLink`.
|
|
2370
2484
|
// Lets the source-creation effect bail until param content actually changes
|
|
2371
2485
|
// instead of churning on every fresh inline-literal binding.
|
|
@@ -2400,10 +2514,10 @@ class RealLinkActive {
|
|
|
2400
2514
|
}
|
|
2401
2515
|
this.element.classList.toggle(className, this.isActive());
|
|
2402
2516
|
}
|
|
2403
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2404
|
-
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 });
|
|
2405
2519
|
}
|
|
2406
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2520
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RealLinkActive, decorators: [{
|
|
2407
2521
|
type: Directive,
|
|
2408
2522
|
args: [{ selector: "[realLinkActive]" }]
|
|
2409
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 }] }] } });
|