@real-router/core 0.158.0 → 0.159.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 +3 -0
- package/dist/cjs/Router-CjpauUGY.js.map +1 -1
- package/dist/cjs/api/getRoutesApi.d.ts.map +1 -1
- package/dist/cjs/api.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/namespaces/RoutesNamespace/routesStore.d.ts.map +1 -1
- package/dist/cjs/namespaces/RoutesNamespace/types.d.ts +2 -2
- package/dist/cjs/namespaces/RoutesNamespace/types.d.ts.map +1 -1
- package/dist/cjs/types/RouterValidator.d.ts +2 -2
- package/dist/cjs/types/RouterValidator.d.ts.map +1 -1
- package/dist/cjs/types/base.d.ts +56 -23
- package/dist/cjs/types/base.d.ts.map +1 -1
- package/dist/cjs/types/router.d.ts +12 -10
- package/dist/cjs/types/router.d.ts.map +1 -1
- package/dist/cjs/types.d.ts +2 -2
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/esm/Router-Dt2la4K2.mjs.map +1 -1
- package/dist/esm/api/getRoutesApi.d.mts.map +1 -1
- package/dist/esm/api.mjs.map +1 -1
- package/dist/esm/index.d.mts +2 -2
- package/dist/esm/namespaces/RoutesNamespace/routesStore.d.mts.map +1 -1
- package/dist/esm/namespaces/RoutesNamespace/types.d.mts +2 -2
- package/dist/esm/namespaces/RoutesNamespace/types.d.mts.map +1 -1
- package/dist/esm/types/RouterValidator.d.mts +2 -2
- package/dist/esm/types/RouterValidator.d.mts.map +1 -1
- package/dist/esm/types/base.d.mts +56 -23
- package/dist/esm/types/base.d.mts.map +1 -1
- package/dist/esm/types/router.d.mts +12 -10
- package/dist/esm/types/router.d.mts.map +1 -1
- package/dist/esm/types.d.mts +2 -2
- package/dist/esm/types.d.mts.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RouteTree } from "./engine/builder/types.mjs";
|
|
2
2
|
import { QueryParamsMode, QueryParamsOptions, RouteParams, RouteTreeState } from "./types/route-node-types.mjs";
|
|
3
|
-
import { NavigationTarget, Params, ParamsSearch, SearchParamPrimitive, SearchParamValue, SearchParams, SerializedRouterState, SimpleState, State, TransitionMeta, TransitionPhase, TransitionReason, Unsubscribe } from "./types/base.mjs";
|
|
3
|
+
import { NavigationTarget, ParamValue, Params, ParamsSearch, SearchParamPrimitive, SearchParamValue, SearchParams, SerializedRouterState, SimpleState, State, TransitionMeta, TransitionPhase, TransitionReason, Unsubscribe, UrlChannels } from "./types/base.mjs";
|
|
4
4
|
import { LimitsConfig } from "./types/limits.mjs";
|
|
5
5
|
import { AdoptedOrigins, AnyOptions, DefaultDependencies, DefaultParamsCallback, DefaultRouteCallback, DefaultSearchCallback, ForwardToCallback, GuardFn, GuardFnFactory, LeaveFn, LeaveState, Listener, LogCallback, LogLevel, LogLevelConfig, LoggerConfig, Navigator, Options, Plugin, PluginFactory, ReadonlyRoute, Route, RouteConfigUpdate, RouterLogger, SubscribeFn, SubscribeState, Subscription } from "./types/router.mjs";
|
|
6
6
|
import { ErrorCodeKeys, ErrorCodeToValueMap, ErrorCodeValues, EventMethodMap, EventName, EventToNameMap, EventToPluginMap, EventsKeys, PluginMethod } from "./types/constants.mjs";
|
|
@@ -14,4 +14,4 @@ import { RouterError } from "./RouterError.mjs";
|
|
|
14
14
|
import { createRouter } from "./createRouter.mjs";
|
|
15
15
|
import { getNavigator } from "./getNavigator.mjs";
|
|
16
16
|
import { resolveForwardChain } from "./namespaces/RoutesNamespace/forwardChain.mjs";
|
|
17
|
-
export { type AdoptedOrigins, type AnyOptions, type CheckFn, type CheckPositionMap, type Constants, type ContextNamespaceClaim, type DefaultDependencies, type DefaultParamsCallback, type DefaultRouteCallback, type DefaultSearchCallback, type DependenciesApi, type DiagnosticEventMap, type ErrorCodeKeys, type ErrorCodeToValueMap, type ErrorCodeValues, type ErrorCodes, type EventMethodMap, type EventName, type EventToNameMap, type EventToPluginMap, type EventsKeys, type ForwardToCallback, type GuardFn, type GuardFnFactory, type InterceptableMethodMap, type InterceptorFn, type LeaveFn, type LeaveState, type LifecycleApi, type LimitsConfig, type Listener, type LogCallback, type LogLevel, type LogLevelConfig, type LoggerConfig, type NavigationOptions, type NavigationTarget, type Navigator, type Options, type Params, type ParamsSearch, type Plugin, type PluginApi, type PluginFactory, type PluginMethod, type QueryParamsMode, type QueryParamsOptions, type ReadonlyRoute, type Route, type RouteConfigUpdate, type RouteParams, type RouteTree, type RouteTreeState, Router, RouterError, type RouterLogger, type RouterValidator, type RoutesApi, type SearchParamPrimitive, type SearchParamValue, type SearchParams, type SerializedRouterState, type SimpleState, type State, type StateContext, type SubscribeFn, type SubscribeState, type Subscription, type TransitionMeta, type TransitionPhase, type TransitionReason, type TreeChangedAdd, type TreeChangedClear, type TreeChangedEvent, type TreeChangedRemove, type TreeChangedReplace, type TreeChangedUpdate, type TreeStructuralPatch, UNKNOWN_ROUTE, type Unsubscribe, constants, createRouter, errorCodes, events, getNavigator, resolveForwardChain };
|
|
17
|
+
export { type AdoptedOrigins, type AnyOptions, type CheckFn, type CheckPositionMap, type Constants, type ContextNamespaceClaim, type DefaultDependencies, type DefaultParamsCallback, type DefaultRouteCallback, type DefaultSearchCallback, type DependenciesApi, type DiagnosticEventMap, type ErrorCodeKeys, type ErrorCodeToValueMap, type ErrorCodeValues, type ErrorCodes, type EventMethodMap, type EventName, type EventToNameMap, type EventToPluginMap, type EventsKeys, type ForwardToCallback, type GuardFn, type GuardFnFactory, type InterceptableMethodMap, type InterceptorFn, type LeaveFn, type LeaveState, type LifecycleApi, type LimitsConfig, type Listener, type LogCallback, type LogLevel, type LogLevelConfig, type LoggerConfig, type NavigationOptions, type NavigationTarget, type Navigator, type Options, type ParamValue, type Params, type ParamsSearch, type Plugin, type PluginApi, type PluginFactory, type PluginMethod, type QueryParamsMode, type QueryParamsOptions, type ReadonlyRoute, type Route, type RouteConfigUpdate, type RouteParams, type RouteTree, type RouteTreeState, Router, RouterError, type RouterLogger, type RouterValidator, type RoutesApi, type SearchParamPrimitive, type SearchParamValue, type SearchParams, type SerializedRouterState, type SimpleState, type State, type StateContext, type SubscribeFn, type SubscribeState, type Subscription, type TransitionMeta, type TransitionPhase, type TransitionReason, type TreeChangedAdd, type TreeChangedClear, type TreeChangedEvent, type TreeChangedRemove, type TreeChangedReplace, type TreeChangedUpdate, type TreeStructuralPatch, UNKNOWN_ROUTE, type Unsubscribe, type UrlChannels, constants, createRouter, errorCodes, events, getNavigator, resolveForwardChain };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routesStore.d.mts","names":[],"sources":["../../../../src/namespaces/RoutesNamespace/routesStore.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"routesStore.d.mts","names":[],"sources":["../../../../src/namespaces/RoutesNamespace/routesStore.ts"],"mappings":";;;;;iBA2FiB,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;EACzB,WAAW,mBAAmB;EAC9B,oBAAoB,wBAAwB;WACnC,oBAAoB,YAAY,eAAe;WAC/C,sBAAsB,YAAY,eAAe"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Params, ParamsSearch, SearchParams, State } from "../../types/base.mjs";
|
|
1
|
+
import { Params, ParamsSearch, SearchParams, State, UrlChannels } from "../../types/base.mjs";
|
|
2
2
|
import { DefaultDependencies, ForwardToCallback, GuardFn, GuardFnFactory, RouterLogger } from "../../types/router.mjs";
|
|
3
3
|
import { RouterValidator } from "../../types/RouterValidator.mjs";
|
|
4
4
|
import { RouteResolver } from "../../pipeline/port.mjs";
|
|
@@ -56,7 +56,7 @@ export interface RoutesDependencies<Dependencies extends DefaultDependencies = D
|
|
|
56
56
|
*/
|
|
57
57
|
export interface RouteConfig {
|
|
58
58
|
/** Custom param decoders per route */
|
|
59
|
-
decoders: Record<string, (channels:
|
|
59
|
+
decoders: Record<string, (channels: UrlChannels) => ParamsSearch>;
|
|
60
60
|
/** Custom param encoders per route */
|
|
61
61
|
encoders: Record<string, (channels: ParamsSearch) => ParamsSearch>;
|
|
62
62
|
/** Default params per route */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../../src/namespaces/RoutesNamespace/types.ts"],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../../src/namespaces/RoutesNamespace/types.ts"],"mappings":";;;;;;;;;;iBAuBiB,mBACf,qBAAqB,sBAAsB;;EAG3C,QAAQ;;;;;;;;EASR,oBAAoB;;;;;;;;;EAUpB,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;;;;;;iBAiBxD;;EAEf,UAAU,gBAAgB,UAAU,gBAAgB;;EAGpD,UAAU,gBAAgB,UAAU,iBAAiB;;EAGrD,eAAe,eAAe;;EAG9B,eAAe,eAAe;;EAG9B,YAAY;;EAIZ,cAAc,eAAe"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParamsSearch, State } from "./base.mjs";
|
|
1
|
+
import { ParamsSearch, State, UrlChannels } from "./base.mjs";
|
|
2
2
|
export interface RouterValidator {
|
|
3
3
|
/**
|
|
4
4
|
* Route validation methods
|
|
@@ -152,7 +152,7 @@ export interface RouterValidator {
|
|
|
152
152
|
*/
|
|
153
153
|
reportCodecRoundTrip: (state: State, codec: {
|
|
154
154
|
readonly encode: ((channels: ParamsSearch) => ParamsSearch) | undefined;
|
|
155
|
-
readonly decode: ((channels:
|
|
155
|
+
readonly decode: ((channels: UrlChannels) => ParamsSearch) | undefined;
|
|
156
156
|
}, pathSlots: readonly string[]) => void;
|
|
157
157
|
};
|
|
158
158
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouterValidator.d.mts","names":[],"sources":["../../../src/types/RouterValidator.ts"],"mappings":";iBAeiB;;;;EAIf;IACE,wBAAwB,gBAAgB;IACxC,wBAAwB;IACxB,4BACE,eACA,iBACA,iBACA;IAEF,+BAA+B;IAC/B,2BACE,eACA,iBACA;;;;;;;;;;;;;IAcF,oBAAoB,eAAe;IACnC,0BAA0B;;;;;EAM5B;IACE,kBAAkB,kBAAkB;;IAEpC,+BAA+B;;;;;EAMjC;IACE,yBAAyB,eAAe;IACxC,4BACE,eACA,gBACA;IAEF,6BAA6B,eAAe;;;;;;IAM5C,2BAA2B,cAAc;;;;;;;;;;IAUzC,0BACE,sBACA,yBACA;IAEF,oBAAoB;IACpB,gBAAgB,cAAc;IAC9B,qBAAqB,gBAAgB;IACrC,wBAAwB;;;;;EAM1B;IACE,sBAAsB,eAAe;IACrC,6BACE,kBACA;IAEF,qBAAqB;IACrB,0BAA0B;IAC1B,sBAAsB;IACtB,uBAAuB;;;;;EAMzB;IACE,uBAAuB,eAAe;IACtC,0BAA0B,eAAe;IACzC,gBAAgB,cAAc,cAAc;IAC5C,qBAAqB,cAAc;;;;;;IAMnC,0BACE,cACA,iBACA;;;;;;IAOF,sBAAsB,cAAc;;;;;EAMtC;IACE,gCAAgC;IAChC,8BAA8B;IAC9B,4BAA4B,kBAAkB;;;;;;;;IAQ9C,sBAAsB,iBAAiB;;;;;;;;IAQvC,iBAAiB,iBAAiB;IAClC,oBAAoB;;;;;EAMtB;IACE,wBACE,eACA,iBACA;IAEF,6BACE,aACA,aACA;;;;;;;;;;;;IAaF,wBAAwB,mBAAmB;;IAG3C,2BAA2B,mBAAmB;;;;;;;;;;;;;;IAe9C,uBACE,OAAO,OACP;eACW,UAAU,UAAU,iBAAiB;eACrC,UAAU,UAAU,
|
|
1
|
+
{"version":3,"file":"RouterValidator.d.mts","names":[],"sources":["../../../src/types/RouterValidator.ts"],"mappings":";iBAeiB;;;;EAIf;IACE,wBAAwB,gBAAgB;IACxC,wBAAwB;IACxB,4BACE,eACA,iBACA,iBACA;IAEF,+BAA+B;IAC/B,2BACE,eACA,iBACA;;;;;;;;;;;;;IAcF,oBAAoB,eAAe;IACnC,0BAA0B;;;;;EAM5B;IACE,kBAAkB,kBAAkB;;IAEpC,+BAA+B;;;;;EAMjC;IACE,yBAAyB,eAAe;IACxC,4BACE,eACA,gBACA;IAEF,6BAA6B,eAAe;;;;;;IAM5C,2BAA2B,cAAc;;;;;;;;;;IAUzC,0BACE,sBACA,yBACA;IAEF,oBAAoB;IACpB,gBAAgB,cAAc;IAC9B,qBAAqB,gBAAgB;IACrC,wBAAwB;;;;;EAM1B;IACE,sBAAsB,eAAe;IACrC,6BACE,kBACA;IAEF,qBAAqB;IACrB,0BAA0B;IAC1B,sBAAsB;IACtB,uBAAuB;;;;;EAMzB;IACE,uBAAuB,eAAe;IACtC,0BAA0B,eAAe;IACzC,gBAAgB,cAAc,cAAc;IAC5C,qBAAqB,cAAc;;;;;;IAMnC,0BACE,cACA,iBACA;;;;;;IAOF,sBAAsB,cAAc;;;;;EAMtC;IACE,gCAAgC;IAChC,8BAA8B;IAC9B,4BAA4B,kBAAkB;;;;;;;;IAQ9C,sBAAsB,iBAAiB;;;;;;;;IAQvC,iBAAiB,iBAAiB;IAClC,oBAAoB;;;;;EAMtB;IACE,wBACE,eACA,iBACA;IAEF,6BACE,aACA,aACA;;;;;;;;;;;;IAaF,wBAAwB,mBAAmB;;IAG3C,2BAA2B,mBAAmB;;;;;;;;;;;;;;IAe9C,uBACE,OAAO,OACP;eACW,UAAU,UAAU,iBAAiB;eACrC,UAAU,UAAU,gBAAgB;OAE/C;;;;;EAOJ;IACE,uBAAuB,eAAe;IACtC,0BACE,eACA,mBACA"}
|
|
@@ -103,29 +103,39 @@ export interface NavigationTarget<P extends Params = Params, S extends SearchPar
|
|
|
103
103
|
search?: S;
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
106
|
-
* The two navigation channels
|
|
107
|
-
* `
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
106
|
+
* The two navigation channels (RFC-4 M2 / #1548): `params` is the path channel,
|
|
107
|
+
* `search` the query channel. With the default arguments it is the STATE side
|
|
108
|
+
* of a per-route codec (#2834): what {@link Route.decodeParams} returns and what
|
|
109
|
+
* {@link Route.encodeParams} receives and returns. A codec transforms the
|
|
110
|
+
* channel(s) it owns and passes the other through.
|
|
111
111
|
*
|
|
112
|
-
* @
|
|
113
|
-
* v1 ran the whole (path + query) bag through both callbacks, so a query value
|
|
114
|
-
* reached `decodeParams`. This two-channel shape preserves that reach: the query
|
|
115
|
-
* arrives in `search` rather than merged into `params`. Value semantics are
|
|
116
|
-
* unchanged — only the storage location differs (M2 keeps query parsing/printing
|
|
117
|
-
* exactly as v1).
|
|
112
|
+
* The URL side is {@link UrlChannels}, what `decodeParams` receives.
|
|
118
113
|
*/
|
|
119
114
|
export interface ParamsSearch<P extends Params = Params, S extends SearchParams = SearchParams> {
|
|
120
115
|
params: P;
|
|
121
116
|
search: S;
|
|
122
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* The URL side of a per-route codec (#2834): what {@link Route.decodeParams}
|
|
120
|
+
* receives. Path slots are the strings the matcher captured; query values are
|
|
121
|
+
* typed by the parser.
|
|
122
|
+
*
|
|
123
|
+
* `encodeParams` returns into the URL and is still typed {@link ParamsSearch}:
|
|
124
|
+
* an encoder hands on a channel it does not own — `search` as it came, or
|
|
125
|
+
* `{ ...search }` with nothing after it — and that channel holds state values,
|
|
126
|
+
* so a URL-typed return would refuse the encoder. The wiki's Dates recipe,
|
|
127
|
+
* which `codec-state-values-2834.test.ts` type-checks, hands on `params`.
|
|
128
|
+
*/
|
|
129
|
+
export type UrlChannels = ParamsSearch<Record<string, string>, Record<string, SearchParamValue | undefined>>;
|
|
123
130
|
/**
|
|
124
131
|
* Parsed shape produced by `serializeRouterState()` (`@real-router/ssr-utils`,
|
|
125
132
|
* after `JSON.parse`). Identical to {@link State} minus `transition`
|
|
126
133
|
* (per-navigation `TransitionMeta` is meaningless after hydration; the client
|
|
127
134
|
* builds its own on commit). Defined here, not in `ssr-utils`, because the
|
|
128
135
|
* shape is core's own `State`; `ssr-utils` re-exports it.
|
|
136
|
+
*
|
|
137
|
+
* ⚠ Under the default `JSON.parse`, a `Date` in a channel comes back as its ISO
|
|
138
|
+
* string, and an Invalid Date as `null`.
|
|
129
139
|
*/
|
|
130
140
|
export type SerializedRouterState<P extends Params = Params> = Omit<State<P>, "transition">;
|
|
131
141
|
/**
|
|
@@ -145,26 +155,49 @@ export interface RouterError extends Error {
|
|
|
145
155
|
getField: (key: string) => unknown;
|
|
146
156
|
toJSON: () => Record<string, unknown>;
|
|
147
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* A value a state channel carries (#2834): a JSON primitive, a `Date`, a plain
|
|
160
|
+
* object of state values, an array of any of those, or `undefined`. An array
|
|
161
|
+
* holds no `undefined`, which JSON would print as `null`. It is what
|
|
162
|
+
* {@link State.params} and {@link State.search} hold, what `navigate` and route
|
|
163
|
+
* defaults take, and what a route's `decodeParams` may return.
|
|
164
|
+
*
|
|
165
|
+
* Core compares these by value — a `Date` by its time, a plain object by its
|
|
166
|
+
* JSON (`areParamValuesEqual`) — and `@real-router/sources`' `canonicalJson`
|
|
167
|
+
* builds a cache key from them and refuses any other object.
|
|
168
|
+
*
|
|
169
|
+
* A URL holds less: a path slot is a string and a query value a
|
|
170
|
+
* {@link SearchParamValue}. A route codec converts between the two; without
|
|
171
|
+
* one, a `Date` or an object does not survive the trip through the URL.
|
|
172
|
+
*/
|
|
173
|
+
export type ParamValue = ParamLeaf | ParamLeaf[] | undefined;
|
|
174
|
+
/**
|
|
175
|
+
* A {@link ParamValue} that is neither an array nor `undefined`.
|
|
176
|
+
*
|
|
177
|
+
* ⚠ One array level, not a recursive `ParamValue[]`: the recursive form fails
|
|
178
|
+
* core's type-check with TS2589.
|
|
179
|
+
*/
|
|
180
|
+
type ParamLeaf = string | number | boolean | null | Date | Params;
|
|
181
|
+
/** The path channel, {@link State.params}: path slots and app-level data. */
|
|
148
182
|
export interface Params {
|
|
149
|
-
[key: string]:
|
|
183
|
+
[key: string]: ParamValue;
|
|
150
184
|
}
|
|
151
185
|
/**
|
|
152
|
-
*
|
|
153
|
-
* (`engine/search-params/types.ts`)
|
|
154
|
-
* half (the union produced across `queryParamsMode` formats).
|
|
186
|
+
* A primitive query value as the URL parser types it. Mirrors the engine's
|
|
187
|
+
* `QueryParamPrimitive` (`engine/search-params/types.ts`).
|
|
155
188
|
*/
|
|
156
189
|
export type SearchParamPrimitive = string | number | boolean | null;
|
|
157
190
|
/**
|
|
158
|
-
* A single query
|
|
191
|
+
* A single query value as the URL parser types it — a primitive or an array of
|
|
192
|
+
* primitives. It is what `decodeParams` receives ({@link UrlChannels}); the
|
|
193
|
+
* state side carries a {@link ParamValue}.
|
|
159
194
|
*/
|
|
160
195
|
export type SearchParamValue = SearchParamPrimitive | SearchParamPrimitive[];
|
|
161
196
|
/**
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
* ternary arrays) are unchanged. Structurally matches the engine's internal
|
|
166
|
-
* `SearchParams` (`engine/search-params/types.ts`), so match results flow into
|
|
167
|
-
* `State.search` without conversion.
|
|
197
|
+
* The query channel, {@link State.search} (RFC-4 M2 / #1548). Its values are
|
|
198
|
+
* state values (#2834); what the URL parser produces for it is a
|
|
199
|
+
* {@link SearchParamValue}, which is one.
|
|
168
200
|
*/
|
|
169
|
-
export type SearchParams = Record<string,
|
|
201
|
+
export type SearchParams = Record<string, ParamValue>;
|
|
202
|
+
export {};
|
|
170
203
|
//# sourceMappingURL=base.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.mts","names":[],"sources":["../../../src/types/base.ts"],"mappings":";;;;;;;;;;YAmBY;iBAEK,YACf,UAAU,SAAS,QACnB,UAAU,eAAe;EAEzB;EACA,QAAQ;;;;;;EAMR,QAAQ;;YAGE;YAEA;iBAEK;EACf,OAAO;EACP,QAAQ;EACR;EACA;EACA;EACA;EACA;EACA;IACE;IACA;IACA;;;iBAIa,MACf,UAAU,SAAS,QACnB,UAAU,eAAe;EAEzB;EACA,QAAQ;;;;;;EAMR,QAAQ;EACR;;;;;;;;;;;;;;;;;;;;;;EAsBA,YAAY;;;;;;;;;;;;;;;;;;;;;EAqBZ,SAAS,eAAe;;;;;;;;;;iBAWT,iBACf,UAAU,SAAS,QACnB,UAAU,eAAe;EAEzB;EACA,SAAS;EACT,SAAS
|
|
1
|
+
{"version":3,"file":"base.d.mts","names":[],"sources":["../../../src/types/base.ts"],"mappings":";;;;;;;;;;YAmBY;iBAEK,YACf,UAAU,SAAS,QACnB,UAAU,eAAe;EAEzB;EACA,QAAQ;;;;;;EAMR,QAAQ;;YAGE;YAEA;iBAEK;EACf,OAAO;EACP,QAAQ;EACR;EACA;EACA;EACA;EACA;EACA;IACE;IACA;IACA;;;iBAIa,MACf,UAAU,SAAS,QACnB,UAAU,eAAe;EAEzB;EACA,QAAQ;;;;;;EAMR,QAAQ;EACR;;;;;;;;;;;;;;;;;;;;;;EAsBA,YAAY;;;;;;;;;;;;;;;;;;;;;EAqBZ,SAAS,eAAe;;;;;;;;;;iBAWT,iBACf,UAAU,SAAS,QACnB,UAAU,eAAe;EAEzB;EACA,SAAS;EACT,SAAS;;;;;;;;;;;iBAYM,aACf,UAAU,SAAS,QACnB,UAAU,eAAe;EAEzB,QAAQ;EACR,QAAQ;;;;;;;;;;;;;YAcE,cAAc,aACxB,wBACA,eAAe;;;;;;;;;;;YAaL,sBAAsB,UAAU,SAAS,UAAU,KAC7D,MAAM;;;;;;iBASS,oBAAoB;GAClC;WACQ;WACA;WACA;EACT,UAAU;EACV,mBAAmB,KAAK;EACxB,sBAAsB,QAAQ;EAC9B,WAAW;EACX,WAAW;EACX,cAAc;;;;;;;;;;;;;;;;;YAkBJ,aAAa,YAAY;;;;;;;KAQhC,+CAA+C,OAAO;;iBAG1C;GACd,cAAc;;;;;;YAOL;;;;;;YAOA,mBAAmB,uBAAuB;;;;;;YAO1C,eAAe,eAAe"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { QueryParamsMode, QueryParamsOptions } from "./route-node-types.mjs";
|
|
2
|
-
import { NavigationTarget, Params, ParamsSearch, RouterError, SearchParams, State, Unsubscribe } from "./base.mjs";
|
|
2
|
+
import { NavigationTarget, Params, ParamsSearch, RouterError, SearchParams, State, Unsubscribe, UrlChannels } from "./base.mjs";
|
|
3
3
|
import { LimitsConfig } from "./limits.mjs";
|
|
4
4
|
import { NavigationOptions } from "../types.mjs";
|
|
5
5
|
export type LogLevel = "log" | "warn" | "error";
|
|
@@ -338,17 +338,19 @@ export interface Route<Dependencies extends DefaultDependencies = DefaultDepende
|
|
|
338
338
|
children?: Route<Dependencies>[];
|
|
339
339
|
/**
|
|
340
340
|
* Encodes the state channels to URL channels before path building (RFC-4 M2 /
|
|
341
|
-
* #1548). Receives `{ params, search }`
|
|
342
|
-
* transform whichever channel you own and pass the
|
|
343
|
-
* slots are built from the returned `params`, the
|
|
344
|
-
* returned `search`.
|
|
341
|
+
* #1548). Receives `{ params, search }` holding state values and returns
|
|
342
|
+
* `{ params, search }` — transform whichever channel you own and pass the
|
|
343
|
+
* other through. The path slots are built from the returned `params`, the
|
|
344
|
+
* query string from the returned `search`.
|
|
345
345
|
*/
|
|
346
346
|
encodeParams?: (channels: ParamsSearch) => ParamsSearch;
|
|
347
347
|
/**
|
|
348
348
|
* Decodes the matched URL channels to state channels (RFC-4 M2 / #1548).
|
|
349
|
-
* Receives
|
|
350
|
-
* `{ params, search }
|
|
351
|
-
*
|
|
349
|
+
* Receives {@link UrlChannels} — path slots as strings, query values as the
|
|
350
|
+
* parser typed them — and returns `{ params, search }` holding state values,
|
|
351
|
+
* such as a `Date` (#2834). Runs inside `matchPath`, **before** any
|
|
352
|
+
* search-schema plugin validation — the v1 transformation order (engine
|
|
353
|
+
* codec → plugin).
|
|
352
354
|
*
|
|
353
355
|
* Only the URL side runs it: `navigate`, `buildPath` and `makeState` take
|
|
354
356
|
* params in the form it returns. So it must undo `encodeParams` and add no
|
|
@@ -358,7 +360,7 @@ export interface Route<Dependencies extends DefaultDependencies = DefaultDepende
|
|
|
358
360
|
* `@real-router/validation-plugin` runs the pair on each state a navigation
|
|
359
361
|
* commits and warns about a key that does not come back.
|
|
360
362
|
*/
|
|
361
|
-
decodeParams?: (channels:
|
|
363
|
+
decodeParams?: (channels: UrlChannels) => ParamsSearch;
|
|
362
364
|
/**
|
|
363
365
|
* Default **path** parameters for this route (and arbitrary app-level
|
|
364
366
|
* defaults). Merged into `state.params`; missing path params are filled from
|
|
@@ -442,7 +444,7 @@ export interface RouteConfigUpdate<Dependencies extends DefaultDependencies = De
|
|
|
442
444
|
/** Set to null to remove defaultSearch (RFC-4 M2 / #1548) */
|
|
443
445
|
defaultSearch?: SearchParams | null;
|
|
444
446
|
/** Set to null to remove decoder */
|
|
445
|
-
decodeParams?: ((channels:
|
|
447
|
+
decodeParams?: ((channels: UrlChannels) => ParamsSearch) | null;
|
|
446
448
|
/** Set to null to remove encoder */
|
|
447
449
|
encodeParams?: ((channels: ParamsSearch) => ParamsSearch) | null;
|
|
448
450
|
/** Set to null to remove canActivate */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.mts","names":[],"sources":["../../../src/types/router.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"router.d.mts","names":[],"sources":["../../../src/types/router.ts"],"mappings":";;;;YA6BY;YAEA;YAEA,eACV,OAAO,UACP,i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AEA,cAAc,eAAe;;EAE7B,gBAAgB,eAAe;;;;;;;;;;EAU/B,qBAAqB,kBAAkB;;EAEvC,WAAW,MAAM;;;;;;;;EAQjB,gBAAgB,UAAU,iBAAiB;;;;;;;;;;;;;;;;;EAiB3C,gBAAgB,UAAU,gBAAgB;;;;;;;;;;;;;;;;;;EAkB1C,gBAAgB;;;;;;;;;EAShB,gBAAgB;;;;;;;;;KAUb,aAAa,KAAK,eAAc,6BACjC,IACA,+BACc,aAAa,IAAI,aAAa,EAAE,WAC5C;;;;;;;;;;;;;;YAeM,cACV,qBAAqB,sBAAsB,uBACzC,aAAa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2BN,kBACf,qBAAqB,sBAAsB;;EAG3C,qBAAqB,kBAAkB;;EAEvC,gBAAgB;;EAEhB,gBAAgB;;EAEhB,iBAAiB,UAAU,gBAAgB;;EAE3C,iBAAiB,UAAU,iBAAiB;;EAE5C,cAAc,eAAe;;EAE7B,gBAAgB,eAAe"}
|
package/dist/esm/types.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { QueryParamsMode, QueryParamsOptions, RouteParams, RouteTreeState } from "./types/route-node-types.mjs";
|
|
2
|
-
import { NavigationTarget, Params, ParamsSearch, RouterError, SearchParamPrimitive, SearchParamValue, SearchParams, SerializedRouterState, SimpleState, State, TransitionMeta, TransitionPhase, TransitionReason, Unsubscribe } from "./types/base.mjs";
|
|
2
|
+
import { NavigationTarget, ParamValue, Params, ParamsSearch, RouterError, SearchParamPrimitive, SearchParamValue, SearchParams, SerializedRouterState, SimpleState, State, TransitionMeta, TransitionPhase, TransitionReason, Unsubscribe, UrlChannels } from "./types/base.mjs";
|
|
3
3
|
import { LimitsConfig } from "./types/limits.mjs";
|
|
4
4
|
import { AdoptedOrigins, AnyOptions, DefaultDependencies, DefaultParamsCallback, DefaultRouteCallback, DefaultSearchCallback, ForwardToCallback, GuardFn, GuardFnFactory, LeaveFn, LeaveState, Listener, LogCallback, LogLevel, LogLevelConfig, LoggerConfig, Navigator, Options, Plugin, PluginFactory, ReadonlyRoute, Route, RouteConfigUpdate, Router, RouterLogger, SubscribeFn, SubscribeState, Subscription } from "./types/router.mjs";
|
|
5
5
|
import { ErrorCodeKeys, ErrorCodeToValueMap, ErrorCodeValues, EventMethodMap, EventName, EventToNameMap, EventToPluginMap, EventsKeys, PluginMethod } from "./types/constants.mjs";
|
|
@@ -239,5 +239,5 @@ export interface NavigationOptions {
|
|
|
239
239
|
*/
|
|
240
240
|
signal?: AbortSignal | undefined;
|
|
241
241
|
}
|
|
242
|
-
export type { AdoptedOrigins, AnyOptions, CheckFn, CheckPositionMap, ContextNamespaceClaim, DefaultDependencies, DefaultParamsCallback, DefaultRouteCallback, DefaultSearchCallback, DependenciesApi, DiagnosticEventMap, ErrorCodeKeys, ErrorCodeToValueMap, ErrorCodeValues, EventMethodMap, EventName, EventToNameMap, EventToPluginMap, EventsKeys, ForwardToCallback, GuardFn, GuardFnFactory, InterceptableMethodMap, InterceptorFn, LeaveFn, LeaveState, LifecycleApi, LimitsConfig, Listener, LogCallback, LogLevel, LogLevelConfig, LoggerConfig, NavigationTarget, Navigator, Options, Params, ParamsSearch, Plugin, PluginApi, PluginFactory, PluginMethod, QueryParamsMode, QueryParamsOptions, ReadonlyRoute, Route, RouteConfigUpdate, RouteParams, RouteTreeState, Router, RouterError, RouterLogger, RoutesApi, SearchParamPrimitive, SearchParamValue, SearchParams, SerializedRouterState, SimpleState, State, SubscribeFn, SubscribeState, Subscription, TransitionMeta, TransitionPhase, TransitionReason, TreeChangedAdd, TreeChangedClear, TreeChangedEvent, TreeChangedRemove, TreeChangedReplace, TreeChangedUpdate, TreeStructuralPatch, Unsubscribe };
|
|
242
|
+
export type { AdoptedOrigins, AnyOptions, CheckFn, CheckPositionMap, ContextNamespaceClaim, DefaultDependencies, DefaultParamsCallback, DefaultRouteCallback, DefaultSearchCallback, DependenciesApi, DiagnosticEventMap, ErrorCodeKeys, ErrorCodeToValueMap, ErrorCodeValues, EventMethodMap, EventName, EventToNameMap, EventToPluginMap, EventsKeys, ForwardToCallback, GuardFn, GuardFnFactory, InterceptableMethodMap, InterceptorFn, LeaveFn, LeaveState, LifecycleApi, LimitsConfig, Listener, LogCallback, LogLevel, LogLevelConfig, LoggerConfig, NavigationTarget, Navigator, Options, ParamValue, Params, ParamsSearch, Plugin, PluginApi, PluginFactory, PluginMethod, QueryParamsMode, QueryParamsOptions, ReadonlyRoute, Route, RouteConfigUpdate, RouteParams, RouteTreeState, Router, RouterError, RouterLogger, RoutesApi, SearchParamPrimitive, SearchParamValue, SearchParams, SerializedRouterState, SimpleState, State, SubscribeFn, SubscribeState, Subscription, TransitionMeta, TransitionPhase, TransitionReason, TreeChangedAdd, TreeChangedClear, TreeChangedEvent, TreeChangedRemove, TreeChangedReplace, TreeChangedUpdate, TreeStructuralPatch, Unsubscribe, UrlChannels };
|
|
243
243
|
//# sourceMappingURL=types.d.mts.map
|
package/dist/esm/types.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../../src/types/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../src/types/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiEiB;;;;;;;;;;;;;;iBAeA;;;;;;;;;;;;;;;;;EAiBf;;;;;;;;;;;;;;;EAgBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCA;;;;;;;;;;;EAYA,SAAS"}
|