@real-router/core 0.172.0 → 0.173.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/dist/cjs/Router-DP-Axjj2.js +2 -0
- package/dist/cjs/Router-DP-Axjj2.js.map +1 -0
- package/dist/cjs/Router.d.ts.map +1 -1
- package/dist/cjs/api.js +1 -1
- package/dist/cjs/api.js.map +1 -1
- package/dist/cjs/engine/createMatcher.d.ts +0 -17
- package/dist/cjs/engine/createMatcher.d.ts.map +1 -1
- package/dist/cjs/engine/index.d.ts +2 -2
- package/dist/cjs/engine/search-params/index.d.ts +1 -1
- package/dist/cjs/helpers-BCSkINAR.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/route-batch-ByWFZwIP.js +2 -0
- package/dist/cjs/route-batch-ByWFZwIP.js.map +1 -0
- package/dist/cjs/types/api.d.ts +3 -6
- package/dist/cjs/types/api.d.ts.map +1 -1
- package/dist/cjs/types/base.d.ts +3 -6
- package/dist/cjs/types/base.d.ts.map +1 -1
- package/dist/cjs/types.d.ts +1 -7
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/cjs/validation.d.ts +9 -11
- package/dist/cjs/validation.js +1 -1
- package/dist/esm/Router-BuBcRFcb.mjs +2 -0
- package/dist/esm/Router-BuBcRFcb.mjs.map +1 -0
- package/dist/esm/Router.d.mts.map +1 -1
- package/dist/esm/api.mjs +1 -1
- package/dist/esm/api.mjs.map +1 -1
- package/dist/esm/engine/createMatcher.d.mts +0 -17
- package/dist/esm/engine/createMatcher.d.mts.map +1 -1
- package/dist/esm/engine/index.d.mts +2 -2
- package/dist/esm/engine/search-params/index.d.mts +1 -1
- package/dist/esm/helpers-LeSZEDaV.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/route-batch-BHxxucx6.mjs +2 -0
- package/dist/esm/route-batch-BHxxucx6.mjs.map +1 -0
- package/dist/esm/types/api.d.mts +3 -6
- package/dist/esm/types/api.d.mts.map +1 -1
- package/dist/esm/types/base.d.mts +3 -6
- package/dist/esm/types/base.d.mts.map +1 -1
- package/dist/esm/types.d.mts +1 -7
- package/dist/esm/types.d.mts.map +1 -1
- package/dist/esm/validation.d.mts +9 -11
- package/dist/esm/validation.mjs +1 -1
- package/package.json +1 -1
- package/dist/cjs/Router-CbpheBEo.js +0 -2
- package/dist/cjs/Router-CbpheBEo.js.map +0 -1
- package/dist/cjs/dependenciesStore.d.ts +0 -36
- package/dist/cjs/dependenciesStore.d.ts.map +0 -1
- package/dist/cjs/internals-C0q224rS.js +0 -2
- package/dist/cjs/internals-C0q224rS.js.map +0 -1
- package/dist/cjs/internals.d.ts +0 -158
- package/dist/cjs/internals.d.ts.map +0 -1
- package/dist/cjs/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.d.ts +0 -191
- package/dist/cjs/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.d.ts.map +0 -1
- package/dist/cjs/namespaces/RouteLifecycleNamespace/index.d.ts +0 -3
- package/dist/cjs/namespaces/RouteLifecycleNamespace/types.d.ts +0 -17
- package/dist/cjs/namespaces/RouteLifecycleNamespace/types.d.ts.map +0 -1
- package/dist/cjs/namespaces/RoutesNamespace/RoutesNamespace.d.ts +0 -7
- package/dist/cjs/namespaces/RoutesNamespace/index.d.ts +0 -4
- package/dist/cjs/namespaces/RoutesNamespace/routesStore.d.ts +0 -105
- package/dist/cjs/namespaces/RoutesNamespace/routesStore.d.ts.map +0 -1
- package/dist/cjs/namespaces/RoutesNamespace/types.d.ts +0 -71
- package/dist/cjs/namespaces/RoutesNamespace/types.d.ts.map +0 -1
- package/dist/cjs/pipeline/buildURL.d.ts +0 -2
- package/dist/cjs/pipeline/canonicalize.d.ts +0 -3
- package/dist/cjs/pipeline/index.d.ts +0 -22
- package/dist/cjs/pipeline/materialize.d.ts +0 -2
- package/dist/cjs/pipeline/port.d.ts +0 -193
- package/dist/cjs/pipeline/port.d.ts.map +0 -1
- package/dist/cjs/pipeline/types.d.ts +0 -1
- package/dist/cjs/transitionPath.d.ts +0 -1
- package/dist/cjs/types/internal.d.ts +0 -23
- package/dist/cjs/types/internal.d.ts.map +0 -1
- package/dist/esm/Router-DYuv6lN0.mjs +0 -2
- package/dist/esm/Router-DYuv6lN0.mjs.map +0 -1
- package/dist/esm/dependenciesStore.d.mts +0 -36
- package/dist/esm/dependenciesStore.d.mts.map +0 -1
- package/dist/esm/internals-JRDAPvLO.mjs +0 -2
- package/dist/esm/internals-JRDAPvLO.mjs.map +0 -1
- package/dist/esm/internals.d.mts +0 -158
- package/dist/esm/internals.d.mts.map +0 -1
- package/dist/esm/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.d.mts +0 -191
- package/dist/esm/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.d.mts.map +0 -1
- package/dist/esm/namespaces/RouteLifecycleNamespace/index.d.mts +0 -3
- package/dist/esm/namespaces/RouteLifecycleNamespace/types.d.mts +0 -17
- package/dist/esm/namespaces/RouteLifecycleNamespace/types.d.mts.map +0 -1
- package/dist/esm/namespaces/RoutesNamespace/RoutesNamespace.d.mts +0 -7
- package/dist/esm/namespaces/RoutesNamespace/index.d.mts +0 -4
- package/dist/esm/namespaces/RoutesNamespace/routesStore.d.mts +0 -105
- package/dist/esm/namespaces/RoutesNamespace/routesStore.d.mts.map +0 -1
- package/dist/esm/namespaces/RoutesNamespace/types.d.mts +0 -71
- package/dist/esm/namespaces/RoutesNamespace/types.d.mts.map +0 -1
- package/dist/esm/pipeline/buildURL.d.mts +0 -2
- package/dist/esm/pipeline/canonicalize.d.mts +0 -3
- package/dist/esm/pipeline/index.d.mts +0 -22
- package/dist/esm/pipeline/materialize.d.mts +0 -2
- package/dist/esm/pipeline/port.d.mts +0 -193
- package/dist/esm/pipeline/port.d.mts.map +0 -1
- package/dist/esm/pipeline/types.d.mts +0 -1
- package/dist/esm/transitionPath.d.mts +0 -1
- package/dist/esm/types/internal.d.mts +0 -23
- package/dist/esm/types/internal.d.mts.map +0 -1
package/dist/cjs/internals.d.ts
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { RouteTreeState } from "./types/route-node-types.js";
|
|
2
|
-
import { Params, SearchParams, SimpleState, State, Unsubscribe } from "./types/base.js";
|
|
3
|
-
import { AdoptedOrigins, AnyOptions, DefaultDependencies, LoggerConfig, Options, Plugin, PluginFactory, Router, RouterLogger } from "./types/router.js";
|
|
4
|
-
import { EventMethodMap, EventName } from "./types/constants.js";
|
|
5
|
-
import { ContextNamespaceClaim, DiagnosticEventMap } from "./types/api.js";
|
|
6
|
-
import { DependenciesStore } from "./dependenciesStore.js";
|
|
7
|
-
import "./engine/index.js";
|
|
8
|
-
import { RouteTree } from "./engine/builder/types.js";
|
|
9
|
-
import "./namespaces/RoutesNamespace/index.js";
|
|
10
|
-
import "./pipeline/index.js";
|
|
11
|
-
import "./Router.js";
|
|
12
|
-
import { RouteResolver } from "./pipeline/port.js";
|
|
13
|
-
import { NavigationOptions } from "./types.js";
|
|
14
|
-
import { RoutesStore } from "./namespaces/RoutesNamespace/routesStore.js";
|
|
15
|
-
import { Limits } from "./types/internal.js";
|
|
16
|
-
export interface RouterInternals<D extends DefaultDependencies = DefaultDependencies> {
|
|
17
|
-
readonly makeState: <P extends Params = Params, S extends SearchParams = SearchParams>(name: string, params?: P, search?: S, path?: string) => State<P, S>;
|
|
18
|
-
/**
|
|
19
|
-
* Per-segment param-source map for a route name (`{ segment: { param: "url" |
|
|
20
|
-
* "query" } }`), read from the live matcher — the ownership channel for
|
|
21
|
-
* `getTransitionPath` (RFC-4 M2 / #1548, replaced the removed per-State
|
|
22
|
-
* `stateMetaStore` WeakMap). `undefined` when the name is not in the tree.
|
|
23
|
-
*/
|
|
24
|
-
readonly getMetaForState: (name: string) => Record<string, Record<string, "url" | "query">> | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* The route's DECLARED query-param names — the same registry the URL build
|
|
27
|
-
* prints from (#1556), minus path slots. Feeds the always-on channel guard
|
|
28
|
-
* (#1572); read here rather than re-derived, so classification cannot drift.
|
|
29
|
-
*/
|
|
30
|
-
readonly getDeclaredQueryNames: (name: string) => readonly string[];
|
|
31
|
-
readonly forwardState: <P extends Params = Params, S extends SearchParams = SearchParams>(routeName: string, routeParams: P, routeSearch?: S) => SimpleState<P, S>;
|
|
32
|
-
readonly buildStateResolved: (resolvedName: string, resolvedParams: Params) => RouteTreeState | undefined;
|
|
33
|
-
/**
|
|
34
|
-
* Print a path for an intent the caller has ALREADY resolved — the facade's
|
|
35
|
-
* printer without the `forwardState` chain the facade runs above it (#2260).
|
|
36
|
-
*
|
|
37
|
-
* ⚑ **For a caller that ran the chain itself**, which is the href door:
|
|
38
|
-
* `buildHref` resolves through `forwardState` (so the href is where the click
|
|
39
|
-
* lands, #2250) and then prints, and until this member existed the printer it
|
|
40
|
-
* reached ran the whole chain a second time (#2087). One href is one
|
|
41
|
-
* operation, so a plugin's interceptor sees one pass.
|
|
42
|
-
*
|
|
43
|
-
* ⚠ **Not `port.buildPath`, which is also seam-free and is NOT the same
|
|
44
|
-
* printer.** That one prints below the default merge; this terminal is
|
|
45
|
-
* `canonicalize(…, { resolveForward: false })` + `buildURL`, the same form
|
|
46
|
-
* `makeState` takes. Substituting it drops a route's `defaultParams` /
|
|
47
|
-
* `defaultSearch` from every href, silently.
|
|
48
|
-
*/
|
|
49
|
-
readonly buildPathResolved: (resolvedName: string, resolvedParams?: Params, resolvedSearch?: SearchParams) => string;
|
|
50
|
-
readonly matchPath: <P extends Params = Params>(path: string, options?: AnyOptions) => State<P> | undefined;
|
|
51
|
-
readonly getOptions: () => Options<D>;
|
|
52
|
-
/**
|
|
53
|
-
* Where the adopted option bags came from, weakly (#2148).
|
|
54
|
-
*
|
|
55
|
-
* ⚑ For the VALIDATION layer, and it is the only reason this door exists.
|
|
56
|
-
* `@real-router/validation-plugin` derefs these at install, takes its own
|
|
57
|
-
* snapshot, and reports once if the application mutates a bag afterwards —
|
|
58
|
-
* because since #2171 such a mutation reaches nothing and says nothing.
|
|
59
|
-
*
|
|
60
|
-
* ⚠ An entry may deref to `undefined`, and that is the correct answer rather
|
|
61
|
-
* than a failure: the application dropped its bag, so there is no mutation left
|
|
62
|
-
* to make and nothing to report.
|
|
63
|
-
*/
|
|
64
|
-
readonly getAdoptedOrigins: () => AdoptedOrigins;
|
|
65
|
-
readonly addEventListener: <E extends EventName>(eventName: E, cb: Plugin[EventMethodMap[E]]) => Unsubscribe;
|
|
66
|
-
/**
|
|
67
|
-
* Subscribes to one internal DIAGNOSTIC kind (#2388). The wiring path for
|
|
68
|
-
* `PluginApi.subscribeDiagnostic`; core itself never listens.
|
|
69
|
-
*/
|
|
70
|
-
readonly subscribeDiagnostic: <K extends keyof DiagnosticEventMap>(key: K, handler: (...args: DiagnosticEventMap[K]) => void) => Unsubscribe;
|
|
71
|
-
/**
|
|
72
|
-
* The navigation pipeline's read-model, for entry points that live on this
|
|
73
|
-
* plugin-facing surface rather than in a namespace. Resolved LAZILY: the port
|
|
74
|
-
* is created during wiring, and `registerInternals` runs before that, so the
|
|
75
|
-
* accessor is a closure rather than a value — the same shape the interceptable
|
|
76
|
-
* methods above already use.
|
|
77
|
-
*/
|
|
78
|
-
readonly port: () => RouteResolver;
|
|
79
|
-
readonly emitTransitionError: (error: Error) => void;
|
|
80
|
-
/**
|
|
81
|
-
* Commits the not-found (`UNKNOWN_ROUTE`) state for `path` and emits
|
|
82
|
-
* `TRANSITION_SUCCESS` — the `NavigationNamespace.navigateToNotFound`
|
|
83
|
-
* primitive, behind the facade's ban: it refuses from every window
|
|
84
|
-
* `router.navigateToNotFound()` refuses from (#2786).
|
|
85
|
-
*/
|
|
86
|
-
readonly navigateToNotFound: (path: string) => State;
|
|
87
|
-
/**
|
|
88
|
-
* The `replace()` revalidation's twin of the above: commits `UNKNOWN_ROUTE`
|
|
89
|
-
* WITHOUT consulting the departing route's `canDeactivate` (#1652, #1981).
|
|
90
|
-
* A tree swap is not a departure the user chose. `replace()` calls it when a
|
|
91
|
-
* structural replace drops the active route, so subscribers are notified
|
|
92
|
-
* instead of the state silently clearing (#950).
|
|
93
|
-
*
|
|
94
|
-
* Outside that revalidation it refuses from every window of the reentrancy
|
|
95
|
-
* ban, as `navigate()` does; inside it asks nothing (#2786).
|
|
96
|
-
*/
|
|
97
|
-
readonly revalidateToNotFound: (path: string) => State;
|
|
98
|
-
/** The facade's `start()`: its checks, then the `start` interceptor chain (#2786). */
|
|
99
|
-
readonly start: (path: string) => Promise<State>;
|
|
100
|
-
/**
|
|
101
|
-
* Plugin-only navigation entry point — delegates to
|
|
102
|
-
* `NavigationNamespace.navigateToState` (`getPluginApi(router).navigateToState`).
|
|
103
|
-
* Hidden from `Router`/`Navigator` to keep the userland surface minimal;
|
|
104
|
-
* see `types/api.ts` for usage docs.
|
|
105
|
-
*/
|
|
106
|
-
readonly navigateToState: (state: State, options?: NavigationOptions) => Promise<State>;
|
|
107
|
-
readonly interceptors: Map<string, ((next: (...args: any[]) => any, ...args: any[]) => any)[]>;
|
|
108
|
-
/**
|
|
109
|
-
* Checks registered per position (#2388) — the channel's whole state.
|
|
110
|
-
* `PluginApi.addCheck` adds to the map in place, and the remover it hands
|
|
111
|
-
* back splices its check out.
|
|
112
|
-
*/
|
|
113
|
-
readonly checks: Map<string, ((...args: any[]) => void)[]>;
|
|
114
|
-
readonly setRootPath: (rootPath: string) => void;
|
|
115
|
-
readonly getRootPath: () => string;
|
|
116
|
-
readonly getTree: () => RouteTree;
|
|
117
|
-
readonly isDisposed: () => boolean;
|
|
118
|
-
readonly logger: RouterLogger;
|
|
119
|
-
readonly dependenciesGetStore: () => DependenciesStore<D>;
|
|
120
|
-
readonly getCloneState: () => {
|
|
121
|
-
options: Options<D>;
|
|
122
|
-
dependencies: Record<string, unknown>;
|
|
123
|
-
pluginFactories: PluginFactory<D>[];
|
|
124
|
-
loggerConfig: LoggerConfig;
|
|
125
|
-
limits: Limits;
|
|
126
|
-
limitKeys: readonly string[] | undefined;
|
|
127
|
-
};
|
|
128
|
-
readonly routeGetStore: () => RoutesStore<D>;
|
|
129
|
-
readonly getStateName: () => string | undefined;
|
|
130
|
-
readonly isTransitioning: () => boolean;
|
|
131
|
-
/**
|
|
132
|
-
* Commit a state that is NOT the product of a navigation — the 404 bypass and
|
|
133
|
-
* `replace()`'s revalidation. Writes AND announces through the FSM
|
|
134
|
-
* `SYSTEM_COMMIT` action, so neither half happens outside the table.
|
|
135
|
-
*
|
|
136
|
-
* THROWS when the machine has no edge to take. The throw is NOT redundant
|
|
137
|
-
* with the table: a refusal there is silent (a `send` from a state without an
|
|
138
|
-
* edge is a no-op), and the contract these callers already had promises an
|
|
139
|
-
* error, not a quietly skipped commit (#1186).
|
|
140
|
-
*
|
|
141
|
-
* Two codes, and the split is #1644's: `ROUTER_DISPOSED` only for a router
|
|
142
|
-
* that IS disposed, `ROUTER_NOT_STARTED` for every other refusal — stopped,
|
|
143
|
-
* never started, still STARTING, or mid-transition — because `SYSTEM_COMMIT`
|
|
144
|
-
* is declared on `READY` alone and therefore also refuses routers that are
|
|
145
|
-
* very much alive. The phase rides the message rather than the code.
|
|
146
|
-
*
|
|
147
|
-
* Outside `replace()`'s revalidation it refuses from every window of the
|
|
148
|
-
* reentrancy ban, as `navigate()` does; inside it asks nothing, because that
|
|
149
|
-
* revalidation calls it (#2786).
|
|
150
|
-
*/
|
|
151
|
-
readonly systemCommit: (toState: State, fromState: State | undefined, opts: NavigationOptions) => State;
|
|
152
|
-
readonly routerExtensions: {
|
|
153
|
-
keys: string[];
|
|
154
|
-
}[];
|
|
155
|
-
readonly contextClaimRecords: Map<string, ContextNamespaceClaim>;
|
|
156
|
-
}
|
|
157
|
-
export declare function getInternals<D extends DefaultDependencies>(router: Router<D>): RouterInternals<D>;
|
|
158
|
-
//# sourceMappingURL=internals.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"internals.d.ts","names":["RouterInterface"],"sources":["../../src/internals.ts"],"mappings":";;;;;;;;;;;;;;;iBAoCiB,gBACf,UAAU,sBAAsB;WAEvB,YACP,UAAU,SAAS,QACnB,UAAU,eAAe,cAEzB,cACA,SAAS,GACT,SAAS,GACT,kBACG,MAAM,GAAG;;;;;;;WAQL,kBACP,iBACG,eAAe;;;;;;WAOX,wBAAwB;WAExB,eACP,UAAU,SAAS,QACnB,UAAU,eAAe,cAEzB,mBACA,aAAa,GACb,cAAc,MACX,YAAY,GAAG;WAEX,qBACP,sBACA,gBAAgB,WACb;;;;;;;;;;;;;;;;;WAkBI,oBACP,sBACA,iBAAiB,QACjB,iBAAiB;WAGV,YAAY,UAAU,SAAS,QACtC,cACA,UAAU,eACP,MAAM;WAEF,kBAAkB,QAAQ;;;;;;;;;;;;;WAc1B,yBAAyB;WAEzB,mBAAmB,UAAU,WACpC,WAAW,GACX,IAAI,OAAO,eAAe,QACvB;;;;;WAMI,sBAAsB,gBAAgB,oBAC7C,KAAK,GACL,aAAa,MAAM,mBAAmB,gBACnC;;;;;;;;WASI,YAAY;WAEZ,sBAAsB,OAAO;;;;;;;WAQ7B,qBAAqB,iBAAiB;;;;;;;;;;;WAYtC,uBAAuB,iBAAiB;;WAGxC,QAAQ,iBAAiB,QAAQ;;;;;;;WAQjC,kBACP,OAAO,OACP,UAAU,sBACP,QAAQ;WAGJ,cAAc,cAEnB,UAAU,wBAAwB;;;;;;WAU7B,QAAQ,iBAAiB;WAGzB,cAAc;WACd;WAEA,eAAe;WAEf;WAaA,QAAQ;WAGR,4BAA4B,kBAAkB;WAM9C;IACP,SAAS,QAAQ;IACjB,cAAc;IACd,iBAAiB,cAAc;IAK/B,cAAc;IAMd,QAAQ;IAoBR;;WAIO,qBAAqB,YAAY;WAGjC;WACA;;;;;;;;;;;;;;;;;;;;;WAqBA,eACP,SAAS,OACT,WAAW,mBACX,MAAM,sBACH;WACI;IAAoB;;WACpB,qBAAqB,YAAY;;wBAkD5B,aAAa,UAAU,qBACrC,QAAQA,OAAgB,KACvB,gBAAgB"}
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import { State } from "../../types/base.js";
|
|
2
|
-
import { DefaultDependencies, GuardFn, GuardFnFactory } from "../../types/router.js";
|
|
3
|
-
import { RouteLifecycleDependencies } from "./types.js";
|
|
4
|
-
import "../../types.js";
|
|
5
|
-
/**
|
|
6
|
-
* Origin lane for a guard clear. Every `clearCanActivate` / `clearCanDeactivate`
|
|
7
|
-
* caller names its lane — there is no origin-blind default — so a new call site
|
|
8
|
-
* cannot silently wipe both the route-config and the external guard (#1171):
|
|
9
|
-
*
|
|
10
|
-
* - `"definition"` — clear only the route-config guard (`update(name, {…: null})`, #952).
|
|
11
|
-
* - `"external"` — clear only the external, component-managed guard
|
|
12
|
-
* (`removeXGuard()` and post-leave auto-cleanup — the inverse of `addXGuard()`).
|
|
13
|
-
* - `"both"` — clear both (route removal / router teardown; the route is gone).
|
|
14
|
-
*/
|
|
15
|
-
export type GuardClearScope = "definition" | "external" | "both";
|
|
16
|
-
/**
|
|
17
|
-
* Source of truth for `canActivate` / `canDeactivate` guards.
|
|
18
|
-
*
|
|
19
|
-
* Storage is split by origin into four factory Maps (definition vs external,
|
|
20
|
-
* each ×activate/deactivate); a single compiled-function Map per kind backs
|
|
21
|
-
* navigation ("external wins" — when a route holds both a definition and an
|
|
22
|
-
* external guard, the compiled guard is the external one, regardless of
|
|
23
|
-
* registration order; #1174). `getFunctions()` returns a cached
|
|
24
|
-
* `[deactivate, activate]` tuple for the hot path (stable reference, no
|
|
25
|
-
* per-navigate allocation).
|
|
26
|
-
*
|
|
27
|
-
* All input validation is handled upstream by `getLifecycleApi` and
|
|
28
|
-
* `getRoutesApi` — this class has no static methods.
|
|
29
|
-
*
|
|
30
|
-
* **Ordering convention.** Every paired surface lists **deactivate before
|
|
31
|
-
* activate**: `getFunctions()` / `getFactories()` return `[deactivate,
|
|
32
|
-
* activate]`, `getFactoriesByOrigin()` returns that tuple per origin, and
|
|
33
|
-
* `canNavigateTo(toDeactivate, toActivate, …)` takes deactivate first. Keep
|
|
34
|
-
* any new paired surface consistent with this order.
|
|
35
|
-
*/
|
|
36
|
-
export declare class RouteLifecycleNamespace<Dependencies extends DefaultDependencies = DefaultDependencies> {
|
|
37
|
-
#private;
|
|
38
|
-
setDependencies(deps: RouteLifecycleDependencies<Dependencies>): void;
|
|
39
|
-
getHandlerCount(type: "activate" | "deactivate"): number;
|
|
40
|
-
/**
|
|
41
|
-
* Pre-flights the #961 handler-limit `RangeError` into the route-CRUD PREPARE
|
|
42
|
-
* phase (#1046). `#registerHandler`'s per-slot limit check throws AFTER the
|
|
43
|
-
* tree/config swap, so `add`/`replace`/`update` would tear post-commit when a
|
|
44
|
-
* check stands at the type's count position and the count is at its limit.
|
|
45
|
-
* Asking the same position here — before any store mutation — keeps them
|
|
46
|
-
* atomic (#951/#956/#698): a batch that would exceed the limit aborts before a
|
|
47
|
-
* single write.
|
|
48
|
-
*
|
|
49
|
-
* Only NEW slots count (an overwrite leaves the union count unchanged, mirroring
|
|
50
|
-
* `#registerHandler`). For `replace` (`clearsDefinition = true`) the definition
|
|
51
|
-
* guards are about to be cleared, so the projection runs against the surviving
|
|
52
|
-
* EXTERNAL guards only — exactly the post-clear state the install loop sees.
|
|
53
|
-
* A no-op for a type with no check at its count position (the limit is
|
|
54
|
-
* opt-in), so bare core walks no name.
|
|
55
|
-
*
|
|
56
|
-
* @param activateNames - route names a `canActivate` would be registered for
|
|
57
|
-
* @param deactivateNames - route names a `canDeactivate` would be registered for
|
|
58
|
-
* @param clearsDefinition - true for `replace` (definition guards cleared first)
|
|
59
|
-
*/
|
|
60
|
-
preflightHandlerLimit(activateNames: Iterable<string>, deactivateNames: Iterable<string>, clearsDefinition: boolean): void;
|
|
61
|
-
/**
|
|
62
|
-
* Adds a canActivate guard for a route.
|
|
63
|
-
*
|
|
64
|
-
* @param name - Route name (input-validated by facade)
|
|
65
|
-
* @param handler - Guard function or boolean (input-validated by facade)
|
|
66
|
-
* @param isFromDefinition - True when guard comes from route definition
|
|
67
|
-
* (lands in the definition Map; subject to `clearDefinitionGuards()`).
|
|
68
|
-
* False when added via `getLifecycleApi().addActivateGuard(...)` (lands in
|
|
69
|
-
* the external Map; survives `replace()`).
|
|
70
|
-
*
|
|
71
|
-
* ⚑ REQUIRED, with no default (#1977). The clear side states the rule for
|
|
72
|
-
* itself — "there is no origin-blind default, so every caller commits to a
|
|
73
|
-
* lane and a new call site cannot silently clear both" — and a default here
|
|
74
|
-
* contradicts it, landing on the MINORITY polarity: three of the four
|
|
75
|
-
* in-repo callers are the definition lane and would have to remember `true`.
|
|
76
|
-
* A forgotten argument files a definition guard as EXTERNAL, where
|
|
77
|
-
* `clearDefinitionGuards()` does not reach it, so `replace()` keeps a guard
|
|
78
|
-
* belonging to a tree that no longer exists (measured: 1 surviving guard
|
|
79
|
-
* against 0 for the same call with the argument). An optional parameter
|
|
80
|
-
* gives the type nothing to catch.
|
|
81
|
-
*
|
|
82
|
-
* External wins at runtime (#1174): when a route holds both a definition and
|
|
83
|
-
* an external guard, the compiled function is the external one, regardless of
|
|
84
|
-
* registration order. Within one origin the most recent add overwrites. Origin
|
|
85
|
-
* determines which Map the factory is filed under (relevant for
|
|
86
|
-
* `clearDefinitionGuards()` and `cloneRouter` re-registration).
|
|
87
|
-
*/
|
|
88
|
-
addCanActivate(name: string, handler: GuardFnFactory<Dependencies> | boolean, isFromDefinition: boolean, precompiledFn?: GuardFn): void;
|
|
89
|
-
/**
|
|
90
|
-
* Adds a canDeactivate guard for a route.
|
|
91
|
-
*
|
|
92
|
-
* Symmetric counterpart to {@link addCanActivate}.
|
|
93
|
-
*/
|
|
94
|
-
addCanDeactivate(name: string, handler: GuardFnFactory<Dependencies> | boolean, isFromDefinition: boolean, precompiledFn?: GuardFn): void;
|
|
95
|
-
/**
|
|
96
|
-
* Removes a canActivate guard for a route. `scope` names the origin lane
|
|
97
|
-
* (see {@link GuardClearScope}) — there is no origin-blind default, so every
|
|
98
|
-
* caller commits to a lane and a new call site cannot silently clear both.
|
|
99
|
-
* Delegates to {@link #clearGuard} (mirrors the add side's `#registerHandler`).
|
|
100
|
-
*
|
|
101
|
-
* @param name - Route name (already validated by facade)
|
|
102
|
-
* @param scope - Which origin(s) to clear: `"definition"` / `"external"` / `"both"`
|
|
103
|
-
*/
|
|
104
|
-
clearCanActivate(name: string, scope: GuardClearScope): void;
|
|
105
|
-
/**
|
|
106
|
-
* Removes a canDeactivate guard for a route. Symmetric counterpart to
|
|
107
|
-
* {@link clearCanActivate}.
|
|
108
|
-
*
|
|
109
|
-
* The `"external"` lane is what makes a route-config `canDeactivate` durable:
|
|
110
|
-
* post-leave auto-cleanup (`completeTransition`) and `removeDeactivateGuard()`
|
|
111
|
-
* unregister only the external, component-managed guard (router5 mount/unmount
|
|
112
|
-
* heritage), while a definition guard survives for re-entry — symmetric with
|
|
113
|
-
* definition `canActivate`, which lives as long as the route is in the tree
|
|
114
|
-
* (#1171). Clearing both by default made a config guard one-shot: the first
|
|
115
|
-
* permitted leave erased it, so re-entry was unguarded, `getRoutesApi().get()`
|
|
116
|
-
* lost the field, and a clone taken after the leave never received it
|
|
117
|
-
* (clone invariant #6).
|
|
118
|
-
*
|
|
119
|
-
* @param name - Route name (already validated by facade)
|
|
120
|
-
* @param scope - Which origin(s) to clear: `"definition"` / `"external"` / `"both"`
|
|
121
|
-
*/
|
|
122
|
-
clearCanDeactivate(name: string, scope: GuardClearScope): void;
|
|
123
|
-
/**
|
|
124
|
-
* Clears all lifecycle handlers (canActivate and canDeactivate).
|
|
125
|
-
* Used by clearRoutes to reset all lifecycle state.
|
|
126
|
-
*/
|
|
127
|
-
clearAll(): void;
|
|
128
|
-
/**
|
|
129
|
-
* Clears only lifecycle handlers that were registered from route definitions.
|
|
130
|
-
* Used by HMR `replace()` to remove definition-sourced guards without
|
|
131
|
-
* touching externally-added guards.
|
|
132
|
-
*
|
|
133
|
-
* For a slot where BOTH a definition and an external guard exist, the external
|
|
134
|
-
* factory survives — and the compiled function is RE-DERIVED from it (#1192).
|
|
135
|
-
* Under external-wins (#1174) the compiled slot is already the external guard,
|
|
136
|
-
* so this re-derivation is idempotent — it goes through the same choke point
|
|
137
|
-
* that keeps clearing correct (and stays robust if the compiled slot were ever
|
|
138
|
-
* out of sync). For a definition-only slot, the compiled function is dropped.
|
|
139
|
-
*
|
|
140
|
-
* ⚑ Since #1649 the re-derivation READS the surviving external guard's stored
|
|
141
|
-
* compiled form instead of invoking its factory, which is what stopped this
|
|
142
|
-
* method from running application code mid-`replace()` (the #1627 site).
|
|
143
|
-
*/
|
|
144
|
-
clearDefinitionGuards(): void;
|
|
145
|
-
/**
|
|
146
|
-
* Returns lifecycle factories as a flat `[deactivate, activate]` tuple of
|
|
147
|
-
* `Record<name, factory>` — the effective view where external wins over
|
|
148
|
-
* definition for the same slot. Used by `getRoutesApi` to enrich route
|
|
149
|
-
* objects with their current canActivate / canDeactivate factories and by
|
|
150
|
-
* the route-removal cleanup path.
|
|
151
|
-
*
|
|
152
|
-
* For cloneRouter (which needs to preserve origin on re-registration), use
|
|
153
|
-
* {@link getFactoriesByOrigin} instead.
|
|
154
|
-
*/
|
|
155
|
-
getFactories(): [Record<string, GuardFnFactory<Dependencies>>, Record<string, GuardFnFactory<Dependencies>>];
|
|
156
|
-
/**
|
|
157
|
-
* Returns factories tagged by origin — definition and external as separate
|
|
158
|
-
* `[deactivate, activate]` tuples. Used by `cloneRouter` to re-register
|
|
159
|
-
* guards on the clone with their original origin flag preserved.
|
|
160
|
-
*/
|
|
161
|
-
getFactoriesByOrigin(): {
|
|
162
|
-
definition: [Record<string, GuardFnFactory<Dependencies>>, Record<string, GuardFnFactory<Dependencies>>];
|
|
163
|
-
external: [Record<string, GuardFnFactory<Dependencies>>, Record<string, GuardFnFactory<Dependencies>>];
|
|
164
|
-
};
|
|
165
|
-
/**
|
|
166
|
-
* Returns compiled lifecycle functions for transition execution.
|
|
167
|
-
*
|
|
168
|
-
* @returns Tuple of [canDeactivateFunctions, canActivateFunctions] as Maps
|
|
169
|
-
*/
|
|
170
|
-
getFunctions(): [Map<string, GuardFn>, Map<string, GuardFn>];
|
|
171
|
-
/**
|
|
172
|
-
* `methodName` is the door the caller typed; it names a throwing guard's log
|
|
173
|
-
* and travels with the synchronous ask's diagnostics (#2821).
|
|
174
|
-
*/
|
|
175
|
-
canNavigateTo(toDeactivate: string[], toActivate: string[], toState: State, fromState: State | undefined, methodName: string): boolean;
|
|
176
|
-
/**
|
|
177
|
-
* Compiles a guard factory to its `GuardFn` WITHOUT registering it — surfaces
|
|
178
|
-
* a throwing / non-function factory eagerly. The prepare-then-commit
|
|
179
|
-
* add/replace path (`adoptRouteArtifacts`) calls this for every pending guard
|
|
180
|
-
* BEFORE the store swap (#956), so a malformed factory aborts the mutation
|
|
181
|
-
* with the store untouched. The returned function is then installed via the
|
|
182
|
-
* `precompiledFn` argument of {@link addCanActivate} / {@link addCanDeactivate}
|
|
183
|
-
* — no re-compile, so a factory with compile-time side effects runs exactly
|
|
184
|
-
* once. Same boolean-shorthand handling + compile + non-function check as the
|
|
185
|
-
* inline `#registerHandler` path, so a route-config `canActivate: true`
|
|
186
|
-
* (boolean shorthand, runtime-reachable via the public route type) compiles to
|
|
187
|
-
* the cached `TRUE_GUARD`/`FALSE_GUARD` instead of throwing on a non-callable.
|
|
188
|
-
*/
|
|
189
|
-
compileGuardFactory(handler: GuardFnFactory<Dependencies> | boolean, methodName: string): GuardFn;
|
|
190
|
-
}
|
|
191
|
-
//# sourceMappingURL=RouteLifecycleNamespace.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RouteLifecycleNamespace.d.ts","names":[],"sources":["../../../../src/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.ts"],"mappings":";;;;;;;;;;;;;;YAiFY;;;;;;;;;;;;;;;;;;;;;qBAsBC,wBACX,qBAAqB,sBAAsB;;EAwD3C,gBAAgB,MAAM,2BAA2B;EAIjD,gBAAgB;;;;;;;;;;;;;;;;;;;;;EA+ChB,sBACE,eAAe,kBACf,iBAAiB,kBACjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCF,eACE,cACA,SAAS,eAAe,yBACxB,2BACA,gBAAgB;;;;;;EAiBlB,iBACE,cACA,SAAS,eAAe,yBACxB,2BACA,gBAAgB;;;;;;;;;;EAqBlB,iBAAiB,cAAc,OAAO;;;;;;;;;;;;;;;;;;EAqBtC,mBAAmB,cAAc,OAAO;;;;;EAQxC;;;;;;;;;;;;;;;;;EA6BA;;;;;;;;;;;EAmCA,iBACE,eAAe,eAAe,gBAC9B,eAAe,eAAe;;;;;;EA4ChC;IACE,aACE,eAAe,eAAe,gBAC9B,eAAe,eAAe;IAEhC,WACE,eAAe,eAAe,gBAC9B,eAAe,eAAe;;;;;;;EA+ClC,iBAAiB,YAAY,UAAU,YAAY;;;;;EAQnD,cACE,wBACA,sBACA,SAAS,OACT,WAAW,mBACX;;;;;;;;;;;;;;EA8CF,oBACE,SAAS,eAAe,yBACxB,qBACC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { DefaultDependencies, GuardFn, GuardFnFactory, RouterLogger } from "../../types/router.js";
|
|
2
|
-
import { CheckPositionMap, DiagnosticEventMap } from "../../types/api.js";
|
|
3
|
-
import "../../types.js";
|
|
4
|
-
export interface RouteLifecycleDependencies<Dependencies extends DefaultDependencies = DefaultDependencies> {
|
|
5
|
-
/** Per-router logger instance (from `getInternals(router).logger`) */
|
|
6
|
-
logger: RouterLogger;
|
|
7
|
-
compileFactory: (factory: GuardFnFactory<Dependencies>) => GuardFn;
|
|
8
|
-
/** Runs the checks registered at a position (#2388); a check may only throw. */
|
|
9
|
-
runChecks: <P extends keyof CheckPositionMap>(position: P, ...args: CheckPositionMap[P]) => void;
|
|
10
|
-
/** Whether any check stands at a position — asked before computing its arguments. */
|
|
11
|
-
hasChecks: (position: keyof CheckPositionMap) => boolean;
|
|
12
|
-
/** Reports an internal DIAGNOSTIC (#2388). Core states what happened. */
|
|
13
|
-
emitDiagnostic: <K extends keyof DiagnosticEventMap>(key: K, ...args: DiagnosticEventMap[K]) => void;
|
|
14
|
-
/** How many handlers listen to a kind — asked before computing its arguments. */
|
|
15
|
-
diagnosticListenerCount: (key: keyof DiagnosticEventMap) => number;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/namespaces/RouteLifecycleNamespace/types.ts"],"mappings":";;;iBAWiB,2BACf,qBAAqB,sBAAsB;;EAG3C,QAAQ;EAER,iBAAiB,SAAS,eAAe,kBAAkB;;EAG3D,YAAY,gBAAgB,kBAC1B,UAAU,MACP,MAAM,iBAAiB;;EAI5B,YAAY,gBAAgB;;EAG5B,iBAAiB,gBAAgB,oBAC/B,KAAK,MACF,MAAM,mBAAmB;;EAI9B,0BAA0B,WAAW"}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { Unsubscribe } from "../../types/base.js";
|
|
2
|
-
import { DefaultDependencies, GuardFnFactory } from "../../types/router.js";
|
|
3
|
-
import { TreeChangedEvent } from "../../types/tree-changed.js";
|
|
4
|
-
import { RouteConfig, RoutesDependencies } from "./types.js";
|
|
5
|
-
import { RouteDefinition, RouteTree } from "../../engine/builder/types.js";
|
|
6
|
-
import { CreateMatcherOptions, Matcher } from "../../engine/createMatcher.js";
|
|
7
|
-
import "../../engine/index.js";
|
|
8
|
-
import "../../types.js";
|
|
9
|
-
import { RouteLifecycleNamespace } from "../RouteLifecycleNamespace/RouteLifecycleNamespace.js";
|
|
10
|
-
import "../RouteLifecycleNamespace/index.js";
|
|
11
|
-
/**
|
|
12
|
-
* The tree-change channel the routes doors raise and subscribe through.
|
|
13
|
-
* `Router` builds it over its event bus and hands it in with the store.
|
|
14
|
-
*
|
|
15
|
-
* A bridge of its own, because the public `addEventListener` cannot carry it:
|
|
16
|
-
* `"TREE_CHANGED"` is not in the `EventName` union, a duplicate listener throws
|
|
17
|
-
* there, and it exposes neither `emit` nor `listenerCount`.
|
|
18
|
-
*/
|
|
19
|
-
export interface TreeChangedChannel {
|
|
20
|
-
readonly emit: (event: TreeChangedEvent) => void;
|
|
21
|
-
readonly subscribe: (handler: (event: TreeChangedEvent) => void) => Unsubscribe;
|
|
22
|
-
readonly listenerCount: () => number;
|
|
23
|
-
/**
|
|
24
|
-
* True while a `TREE_CHANGED` emit is on the stack — the routes doors read it
|
|
25
|
-
* to reject reentrant route-CRUD from a `subscribeChanges` handler (#1032).
|
|
26
|
-
*/
|
|
27
|
-
readonly isEmitting: () => boolean;
|
|
28
|
-
}
|
|
29
|
-
export interface RoutesStore<Dependencies extends DefaultDependencies = DefaultDependencies> {
|
|
30
|
-
/**
|
|
31
|
-
* DERIVED VIEW, not stored state: reconstructed from `tree` on every access
|
|
32
|
-
* via `routeTreeToDefinitions` (the lossless inverse cloneRouter already
|
|
33
|
-
* relies on — the `~` absolute marker is restored, child order is the
|
|
34
|
-
* definition order). The tree is the single source of truth, so a third
|
|
35
|
-
* retained copy of the route table (~30 B/route) is not kept. Every reader
|
|
36
|
-
* is a cold CRUD/plugin-registration path; the derive is O(N).
|
|
37
|
-
*
|
|
38
|
-
* The returned array is a FRESH snapshot each time — mutating it never
|
|
39
|
-
* affects the store (pass an explicitly-mutated snapshot to
|
|
40
|
-
* `commitTreeChanges` instead, as `remove` does).
|
|
41
|
-
*/
|
|
42
|
-
readonly definitions: RouteDefinition[];
|
|
43
|
-
readonly config: RouteConfig;
|
|
44
|
-
tree: RouteTree;
|
|
45
|
-
matcher: Matcher;
|
|
46
|
-
/**
|
|
47
|
-
* Per-route-name cache of URL (path) param names, derived from `matcher` and
|
|
48
|
-
* read by `RoutesNamespace.getUrlParams` (powers `areStatesEqual` /
|
|
49
|
-
* `isActiveRoute`). Cleared on every `matcher` rebuild so comparisons never
|
|
50
|
-
* stay frozen to a route's pre-mutation param shape (#723).
|
|
51
|
-
*/
|
|
52
|
-
readonly urlParamsCache: Map<string, readonly string[]>;
|
|
53
|
-
/**
|
|
54
|
-
* Per-route-name cache of declared query param names (`?a&b` across the
|
|
55
|
-
* route's segments) MINUS its path slots — read by
|
|
56
|
-
* `RoutesNamespace.getQueryParams`, the registry every channel mechanism
|
|
57
|
-
* classifies through (#1556). The printing view is not cached here: it is the
|
|
58
|
-
* matcher's own array, handed over unchanged (#1932). Same lifecycle as
|
|
59
|
-
* `urlParamsCache`: cleared on every `matcher` rebuild.
|
|
60
|
-
*/
|
|
61
|
-
readonly queryParamsCache: Map<string, readonly string[]>;
|
|
62
|
-
resolvedForwardMap: Record<string, string>;
|
|
63
|
-
/**
|
|
64
|
-
* Is `replace()`'s revalidation window open (#1758 / #1759)?
|
|
65
|
-
*
|
|
66
|
-
* ⚑ Application code runs inside it — the route's `decodeParams`, invoked by
|
|
67
|
-
* the revalidating `matchPath`, and the new route's activation guards — while
|
|
68
|
-
* the router holds a state it has not yet revalidated. Reached from there,
|
|
69
|
-
* route-CRUD committed a bag the route could no longer build and a navigation
|
|
70
|
-
* left the committed state on a route the batch had dropped. Both doors
|
|
71
|
-
* consult this; `revalidation-window-ban-1758-1759.test.ts` owns the cells.
|
|
72
|
-
*/
|
|
73
|
-
revalidating: boolean;
|
|
74
|
-
/**
|
|
75
|
-
* Does ANY route in the tree forward? Read by `isActiveRoute` before its
|
|
76
|
-
* `forwardTo` arm's per-route gate, and worth its own field for a reason that
|
|
77
|
-
* is measurable rather than aesthetic (#1595): the two maps behind that gate
|
|
78
|
-
* are `Object.create(null)` dictionaries, which V8 keeps in dictionary mode,
|
|
79
|
-
* and two lookups on them cost ~14 ns — paid by every route in the tree for a
|
|
80
|
-
* feature only forwarding routes use, on every `<Link>` render across six
|
|
81
|
-
* adapters. A tree with no `forwardTo` at all — the common case — answers with
|
|
82
|
-
* one boolean load instead.
|
|
83
|
-
*
|
|
84
|
-
* ⚠ Maintained ONLY through {@link adoptForwardState}, together with
|
|
85
|
-
* `resolvedForwardMap`. The two are views of the same config and a stale
|
|
86
|
-
* `false` here silently switches the arm OFF, which is a correctness bug
|
|
87
|
-
* wearing a performance change's clothes: a `<Link>` to a forwarding route
|
|
88
|
-
* would render inactive again (the defect #1573 shipped the arm to fix).
|
|
89
|
-
* Pinned in `tests/functional/routes/isActiveRoute.test.ts`, describe
|
|
90
|
-
* `"forwardTo arm survives route-CRUD (#1595)"` — and the generative pin in
|
|
91
|
-
* `tests/property/cloneRouter.properties.ts`. ⚠ That describe name is
|
|
92
|
-
* narrower than its contents: `cloneRouter` writes forward config without
|
|
93
|
-
* being route-CRUD (#1800), so a clone case lives there too.
|
|
94
|
-
*/
|
|
95
|
-
hasAnyForward: boolean;
|
|
96
|
-
routeCustomFields: Record<string, Record<string, unknown>>;
|
|
97
|
-
rootPath: string;
|
|
98
|
-
readonly matcherOptions: CreateMatcherOptions | undefined;
|
|
99
|
-
readonly depsStore: RoutesDependencies<Dependencies> | undefined;
|
|
100
|
-
readonly lifecycleNamespace: RouteLifecycleNamespace<Dependencies> | undefined;
|
|
101
|
-
readonly treeChanged: TreeChangedChannel;
|
|
102
|
-
readonly pendingCanActivate: Map<string, GuardFnFactory<Dependencies>>;
|
|
103
|
-
readonly pendingCanDeactivate: Map<string, GuardFnFactory<Dependencies>>;
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=routesStore.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routesStore.d.ts","names":[],"sources":["../../../../src/namespaces/RoutesNamespace/routesStore.ts"],"mappings":";;;;;;;;;;;;;;;;;;iBAqGiB;WACN,OAAO,OAAO;WACd,YACP,UAAU,OAAO,8BACd;WACI;;;;;WAKA;;iBAGM,YACf,qBAAqB,sBAAsB;;;;;;;;;;;;;WAclC,aAAa;WACb,QAAQ;EACjB,MAAM;EACN,SAAS;;;;;;;WAOA,gBAAgB;;;;;;;;;WAShB,kBAAkB;EAC3B,oBAAoB;;;;;;;;;;;EAYpB;;;;;;;;;;;;;;;;;;;;;;EAuBA;EACA,mBAAmB,eAAe;EAClC;WACS,gBAAgB;WAKhB,WAAW,mBAAmB;WAC9B,oBACP,wBAAwB;WACjB,aAAa;WACb,oBAAoB,YAAY,eAAe;WAC/C,sBAAsB,YAAY,eAAe"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { Params, ParamsSearch, SearchParams, State, UrlChannels } from "../../types/base.js";
|
|
2
|
-
import { DefaultDependencies, ForwardToCallback, GuardFn, GuardFnFactory, RouterLogger } from "../../types/router.js";
|
|
3
|
-
import { RouterInternals } from "../../internals.js";
|
|
4
|
-
import { RouteResolver } from "../../pipeline/port.js";
|
|
5
|
-
import "../../pipeline/index.js";
|
|
6
|
-
import "../../types.js";
|
|
7
|
-
/**
|
|
8
|
-
* Dependencies injected into RoutesNamespace.
|
|
9
|
-
*
|
|
10
|
-
* These are function references from the Router facade,
|
|
11
|
-
* avoiding the need to pass the entire Router object.
|
|
12
|
-
*/
|
|
13
|
-
export interface RoutesDependencies<Dependencies extends DefaultDependencies = DefaultDependencies> {
|
|
14
|
-
/** Per-router logger instance (from `getInternals(router).logger`) */
|
|
15
|
-
logger: RouterLogger;
|
|
16
|
-
/**
|
|
17
|
-
* The router's checks (#2388). This namespace asks one position,
|
|
18
|
-
* `matchPath:decoded`, at the one boundary on it where USER code hands back
|
|
19
|
-
* a value core then builds a state from (a route's `decodeParams`).
|
|
20
|
-
*/
|
|
21
|
-
checks: RouterInternals["checks"];
|
|
22
|
-
/**
|
|
23
|
-
* The pipeline's read-model (`RouteResolver`), shared with NavigationNamespace
|
|
24
|
-
* — one instance per router, created in `wireNamespaces`. Entry points on this
|
|
25
|
-
* namespace compose their target state through `canonicalize` / `buildURL` /
|
|
26
|
-
* `materialize` and reach the router's stage ① seam and route config through
|
|
27
|
-
* this port rather than through the namespace's own dependency closures, so
|
|
28
|
-
* every producer reads ONE read-model (nav-pipeline Phase 2).
|
|
29
|
-
*/
|
|
30
|
-
port: RouteResolver;
|
|
31
|
-
/**
|
|
32
|
-
* Register a canActivate handler for a route. `precompiledFn` installs an
|
|
33
|
-
* already-compiled `GuardFn` (from {@link compileGuard}) without re-invoking
|
|
34
|
-
* the factory — used by the #956 prepare-then-commit path so guards compile
|
|
35
|
-
* once, before the store swap.
|
|
36
|
-
*/
|
|
37
|
-
addActivateGuard: (name: string, handler: GuardFnFactory<Dependencies>, precompiledFn?: GuardFn) => void;
|
|
38
|
-
/** Register a canDeactivate handler for a route (see {@link addActivateGuard}). */
|
|
39
|
-
addDeactivateGuard: (name: string, handler: GuardFnFactory<Dependencies>, precompiledFn?: GuardFn) => void;
|
|
40
|
-
/**
|
|
41
|
-
* Compile a guard factory to its `GuardFn` WITHOUT registering it — surfaces a
|
|
42
|
-
* throwing / non-function factory eagerly so the add/replace commit can
|
|
43
|
-
* validate every guard before swapping the store (#956).
|
|
44
|
-
*/
|
|
45
|
-
compileGuard: (handler: GuardFnFactory<Dependencies>, methodName: string) => GuardFn;
|
|
46
|
-
/** Get current router state */
|
|
47
|
-
getState: () => State | undefined;
|
|
48
|
-
/** Compare two states for equality */
|
|
49
|
-
areStatesEqual: (state1: State | undefined, state2: State | undefined, ignoreQueryParams?: boolean) => boolean;
|
|
50
|
-
/** Get a dependency by name */
|
|
51
|
-
getDependency: <K extends keyof Dependencies>(name: K) => Dependencies[K];
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Configuration storage for routes.
|
|
55
|
-
* Stores decoders, encoders, default params, and forward mappings.
|
|
56
|
-
*/
|
|
57
|
-
export interface RouteConfig {
|
|
58
|
-
/** Custom param decoders per route */
|
|
59
|
-
decoders: Record<string, (channels: UrlChannels) => ParamsSearch>;
|
|
60
|
-
/** Custom param encoders per route */
|
|
61
|
-
encoders: Record<string, (channels: ParamsSearch) => ParamsSearch>;
|
|
62
|
-
/** Default params per route */
|
|
63
|
-
defaultParams: Record<string, Params>;
|
|
64
|
-
/** Default search (query) params per route (RFC-4 M2 / #1548) */
|
|
65
|
-
defaultSearch: Record<string, SearchParams>;
|
|
66
|
-
/** Forward mappings (source -> target) */
|
|
67
|
-
forwardMap: Record<string, string>;
|
|
68
|
-
/** Dynamic forward callbacks (source -> callback) */
|
|
69
|
-
forwardFnMap: Record<string, ForwardToCallback<any>>;
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/namespaces/RoutesNamespace/types.ts"],"mappings":";;;;;;;;;;;;iBAuBiB,mBACf,qBAAqB,sBAAsB;;EAG3C,QAAQ;;;;;;EAOR,QAAQ;;;;;;;;;EAUR,MAAM;;;;;;;EAQN,mBACE,cACA,SAAS,eAAe,eACxB,gBAAgB;;EAIlB,qBACE,cACA,SAAS,eAAe,eACxB,gBAAgB;;;;;;EAQlB,eACE,SAAS,eAAe,eACxB,uBACG;;EAML,gBAAgB;;EAGhB,iBACE,QAAQ,mBACR,QAAQ,mBACR;;EAIF,gBAAgB,gBAAgB,cAAc,MAAM,MAAM,aAAa;;;;;;iBAexD;;EAEf,UAAU,gBAAgB,UAAU,gBAAgB;;EAGpD,UAAU,gBAAgB,UAAU,iBAAiB;;EAGrD,eAAe,eAAe;;EAG9B,eAAe,eAAe;;EAG9B,YAAY;;EAIZ,cAAc,eAAe"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The navigation delivery pipeline: three primitives over one opaque type.
|
|
3
|
-
*
|
|
4
|
-
* `canonicalize` (the sole producer of `Canonical`) → `buildURL` (⑤a) /
|
|
5
|
-
* `materialize` (⑤b). The brand symbol is NOT exported, so nothing can reach
|
|
6
|
-
* these two primitives around `canonicalize` — and since Phase 4 that is a
|
|
7
|
-
* guarantee about the ROUTER, not only about this module: every producer of a
|
|
8
|
-
* URL or a State reaches it, in one of two compositional forms.
|
|
9
|
-
*
|
|
10
|
-
* Core-internal: not part of any published subpath. Its consumers are the
|
|
11
|
-
* router's own facade, namespaces and wiring.
|
|
12
|
-
*
|
|
13
|
-
* The two forms and who takes them, the port's wiring facts, the perf notes and
|
|
14
|
-
* the one deliberate exception (`navigateToNotFound`): ./CLAUDE.md
|
|
15
|
-
*
|
|
16
|
-
* @module pipeline
|
|
17
|
-
*/
|
|
18
|
-
import "./canonicalize.js";
|
|
19
|
-
import "./buildURL.js";
|
|
20
|
-
import "./materialize.js";
|
|
21
|
-
import { RouteResolver } from "./port.js";
|
|
22
|
-
export type { RouteResolver };
|