@kitbag/router 0.8.1 → 0.10.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/kitbag-router.d.ts +53 -21
- package/dist/kitbag-router.js +752 -709
- package/dist/kitbag-router.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/kitbag-router.d.ts
CHANGED
|
@@ -131,21 +131,27 @@ declare const builtInRejections: ['NotFound'];
|
|
|
131
131
|
|
|
132
132
|
declare type BuiltInRejectionType = typeof builtInRejections[number];
|
|
133
133
|
|
|
134
|
+
declare type CombineHash<TParent extends Hash, TChild extends Hash> = ToHash<TParent> extends {
|
|
135
|
+
value: infer TParentHash extends string;
|
|
136
|
+
} ? ToHash<TChild> extends {
|
|
137
|
+
value: infer ChildHash extends string;
|
|
138
|
+
} ? Hash<`${TParentHash}${ChildHash}`> : TParent : Hash;
|
|
139
|
+
|
|
134
140
|
declare type CombineMeta<TParent extends Record<string, unknown>, TChild extends Record<string, unknown>> = TParent & TChild;
|
|
135
141
|
|
|
136
142
|
declare type CombinePath<TParent extends Path, TChild extends Path> = ToPath<TParent> extends {
|
|
137
|
-
|
|
143
|
+
value: infer TParentPath extends string;
|
|
138
144
|
params: infer TParentParams extends Record<string, unknown>;
|
|
139
145
|
} ? ToPath<TChild> extends {
|
|
140
|
-
|
|
146
|
+
value: infer TChildPath extends string;
|
|
141
147
|
params: infer TChildParams extends Record<string, unknown>;
|
|
142
148
|
} ? RemoveLeadingQuestionMarkFromKeys<TParentParams> & RemoveLeadingQuestionMarkFromKeys<TChildParams> extends PathParamsWithParamNameExtracted<`${TParentPath}${TChildPath}`> ? Path<`${TParentPath}${TChildPath}`, RemoveLeadingQuestionMarkFromKeys<TParentParams> & RemoveLeadingQuestionMarkFromKeys<TChildParams>> : Path<'', {}> : Path<'', {}> : Path<'', {}>;
|
|
143
149
|
|
|
144
150
|
declare type CombineQuery<TParent extends Query, TChild extends Query> = ToQuery<TParent> extends {
|
|
145
|
-
|
|
151
|
+
value: infer TParentQuery extends string;
|
|
146
152
|
params: infer TParentParams extends Record<string, unknown>;
|
|
147
153
|
} ? ToQuery<TChild> extends {
|
|
148
|
-
|
|
154
|
+
value: infer TChildQuery extends string;
|
|
149
155
|
params: infer TChildParams extends Record<string, unknown>;
|
|
150
156
|
} ? RemoveLeadingQuestionMarkFromKeys<TParentParams> & RemoveLeadingQuestionMarkFromKeys<TChildParams> extends QueryParamsWithParamNameExtracted<CombineQueryString<TParentQuery, TChildQuery>> ? Query<CombineQueryString<TParentQuery, TChildQuery>, RemoveLeadingQuestionMarkFromKeys<TParentParams> & RemoveLeadingQuestionMarkFromKeys<TChildParams>> : Query<'', {}> : Query<'', {}> : Query<'', {}>;
|
|
151
157
|
|
|
@@ -179,9 +185,9 @@ declare type ComponentPropsGetter<TComponent extends Component> = () => MaybePro
|
|
|
179
185
|
|
|
180
186
|
declare type Constructor = new (...args: any) => any;
|
|
181
187
|
|
|
182
|
-
export declare function createExternalRoute<const THost extends string | Host, const TName extends string | undefined = undefined, const TPath extends string | Path | undefined = undefined, const TQuery extends string | Query | undefined = undefined>(options: CreateRouteOptions<TName, TPath, TQuery> & WithHost<THost> & WithoutParent): Route<ToName<TName>, ToHost<THost>, ToPath<TPath>, ToQuery<TQuery
|
|
188
|
+
export declare function createExternalRoute<const THost extends string | Host, const TName extends string | undefined = undefined, const TPath extends string | Path | undefined = undefined, const TQuery extends string | Query | undefined = undefined, const THash extends string | Hash | undefined = undefined, const TMeta extends RouteMeta = RouteMeta>(options: CreateRouteOptions<TName, TPath, TQuery> & WithHost<THost> & WithoutParent): Route<ToName<TName>, ToHost<THost>, ToPath<TPath>, ToQuery<TQuery>, ToHash<THash>, TMeta>;
|
|
183
189
|
|
|
184
|
-
export declare function createExternalRoute<const TParent extends Route, const TName extends string | undefined = undefined, const TPath extends string | Path | undefined = undefined, const TQuery extends string | Query | undefined = undefined>(options: CreateRouteOptions<TName, TPath, TQuery> & WithoutHost & WithParent<TParent>): Route<ToName<TName>, Host<'', {}>, CombinePath<TParent['path'], ToPath<TPath>>, CombineQuery<TParent['query'], ToQuery<TQuery
|
|
190
|
+
export declare function createExternalRoute<const TParent extends Route, const TName extends string | undefined = undefined, const TPath extends string | Path | undefined = undefined, const TQuery extends string | Query | undefined = undefined, const THash extends string | Hash | undefined = undefined, const TMeta extends RouteMeta = RouteMeta>(options: CreateRouteOptions<TName, TPath, TQuery> & WithoutHost & WithParent<TParent>): Route<ToName<TName>, Host<'', {}>, CombinePath<TParent['path'], ToPath<TPath>>, CombineQuery<TParent['query'], ToQuery<TQuery>>, CombineHash<TParent['hash'], ToHash<THash>>, CombineMeta<TMeta, TParent['meta']>>;
|
|
185
191
|
|
|
186
192
|
export declare function createParam<TParam extends ParamWithDefault>(param: TParam): TParam;
|
|
187
193
|
|
|
@@ -189,19 +195,19 @@ export declare function createParam<TParam extends Param>(param: TParam): ParamG
|
|
|
189
195
|
|
|
190
196
|
export declare function createParam<TParam extends Param>(param: TParam, defaultValue: ExtractParamType<TParam>): ParamWithDefault<TParam>;
|
|
191
197
|
|
|
192
|
-
export declare function createRoute<const TName extends string | undefined = undefined, const TPath extends string | Path | undefined = undefined, const TQuery extends string | Query | undefined = undefined, const TMeta extends RouteMeta = RouteMeta, const TState extends Record<string, Param> = Record<string, Param>>(options: CreateRouteOptions<TName, TPath, TQuery, TMeta> & WithHooks & WithoutComponents & WithoutParent & (WithState<TState> | WithoutState)): Route<ToName<TName>, Host<'', {}>, ToPath<TPath>, ToQuery<TQuery>, TMeta, TState>;
|
|
198
|
+
export declare function createRoute<const TName extends string | undefined = undefined, const TPath extends string | Path | undefined = undefined, const TQuery extends string | Query | undefined = undefined, const THash extends string | Hash | undefined = undefined, const TMeta extends RouteMeta = RouteMeta, const TState extends Record<string, Param> = Record<string, Param>>(options: CreateRouteOptions<TName, TPath, TQuery, THash, TMeta> & WithHooks & WithoutComponents & WithoutParent & (WithState<TState> | WithoutState)): Route<ToName<TName>, Host<'', {}>, ToPath<TPath>, ToQuery<TQuery>, ToHash<THash>, TMeta, TState>;
|
|
193
199
|
|
|
194
|
-
export declare function createRoute<const TParent extends Route, const TName extends string | undefined = undefined, const TPath extends string | Path | undefined = undefined, const TQuery extends string | Query | undefined = undefined, const TMeta extends RouteMeta = RouteMeta, const TState extends Record<string, Param> = Record<string, Param>>(options: CreateRouteOptions<TName, TPath, TQuery, TMeta> & WithHooks & WithoutComponents & WithParent<TParent> & (WithState<TState> | WithoutState)): Route<ToName<TName>, Host<'', {}>, CombinePath<TParent['path'], ToPath<TPath>>, CombineQuery<TParent['query'], ToQuery<TQuery>>, CombineMeta<TMeta, TParent['meta']>, CombineState<TState, TParent['state']>>;
|
|
200
|
+
export declare function createRoute<const TParent extends Route, const TName extends string | undefined = undefined, const TPath extends string | Path | undefined = undefined, const TQuery extends string | Query | undefined = undefined, const THash extends string | Hash | undefined = undefined, const TMeta extends RouteMeta = RouteMeta, const TState extends Record<string, Param> = Record<string, Param>>(options: CreateRouteOptions<TName, TPath, TQuery, THash, TMeta> & WithHooks & WithoutComponents & WithParent<TParent> & (WithState<TState> | WithoutState)): Route<ToName<TName>, Host<'', {}>, CombinePath<TParent['path'], ToPath<TPath>>, CombineQuery<TParent['query'], ToQuery<TQuery>>, CombineHash<TParent['hash'], ToHash<THash>>, CombineMeta<TMeta, TParent['meta']>, CombineState<TState, TParent['state']>>;
|
|
195
201
|
|
|
196
|
-
export declare function createRoute<TComponent extends Component, const TName extends string | undefined = undefined, const TPath extends string | Path | undefined = undefined, const TQuery extends string | Query | undefined = undefined, const TMeta extends RouteMeta = RouteMeta, const TState extends Record<string, Param> = Record<string, Param>>(options: CreateRouteOptions<TName, TPath, TQuery, TMeta> & WithHooks & WithComponent<TComponent, RouteParams<TPath, TQuery>> & WithoutParent & (WithState<TState> | WithoutState)): Route<ToName<TName>, Host<'', {}>, ToPath<TPath>, ToQuery<TQuery>, TMeta, TState>;
|
|
202
|
+
export declare function createRoute<TComponent extends Component, const TName extends string | undefined = undefined, const TPath extends string | Path | undefined = undefined, const TQuery extends string | Query | undefined = undefined, const THash extends string | Hash | undefined = undefined, const TMeta extends RouteMeta = RouteMeta, const TState extends Record<string, Param> = Record<string, Param>>(options: CreateRouteOptions<TName, TPath, TQuery, THash, TMeta> & WithHooks & WithComponent<TComponent, RouteParams<TPath, TQuery>> & WithoutParent & (WithState<TState> | WithoutState)): Route<ToName<TName>, Host<'', {}>, ToPath<TPath>, ToQuery<TQuery>, ToHash<THash>, TMeta, TState>;
|
|
197
203
|
|
|
198
|
-
export declare function createRoute<TComponent extends Component, const TParent extends Route, const TName extends string | undefined = undefined, const TPath extends string | Path | undefined = undefined, const TQuery extends string | Query | undefined = undefined, const TMeta extends RouteMeta = RouteMeta, const TState extends Record<string, Param> = Record<string, Param>>(options: CreateRouteOptions<TName, TPath, TQuery, TMeta> & WithHooks & WithComponent<TComponent, RouteParams<TPath, TQuery, TParent>> & WithParent<TParent> & (WithState<TState> | WithoutState)): Route<ToName<TName>, Host<'', {}>, CombinePath<TParent['path'], ToPath<TPath>>, CombineQuery<TParent['query'], ToQuery<TQuery>>, CombineMeta<TMeta, TParent['meta']>, CombineState<TState, TParent['state']>>;
|
|
204
|
+
export declare function createRoute<TComponent extends Component, const TParent extends Route, const TName extends string | undefined = undefined, const TPath extends string | Path | undefined = undefined, const TQuery extends string | Query | undefined = undefined, const THash extends string | Hash | undefined = undefined, const TMeta extends RouteMeta = RouteMeta, const TState extends Record<string, Param> = Record<string, Param>>(options: CreateRouteOptions<TName, TPath, TQuery, THash, TMeta> & WithHooks & WithComponent<TComponent, RouteParams<TPath, TQuery, TParent>> & WithParent<TParent> & (WithState<TState> | WithoutState)): Route<ToName<TName>, Host<'', {}>, CombinePath<TParent['path'], ToPath<TPath>>, CombineQuery<TParent['query'], ToQuery<TQuery>>, CombineHash<TParent['hash'], ToHash<THash>>, CombineMeta<TMeta, TParent['meta']>, CombineState<TState, TParent['state']>>;
|
|
199
205
|
|
|
200
|
-
export declare function createRoute<TComponents extends Record<string, Component>, const TName extends string | undefined = undefined, const TPath extends string | Path | undefined = undefined, const TQuery extends string | Query | undefined = undefined, const TMeta extends RouteMeta = RouteMeta, const TState extends Record<string, Param> = Record<string, Param>>(options: CreateRouteOptions<TName, TPath, TQuery, TMeta> & WithHooks & WithComponents<TComponents, RouteParams<TPath, TQuery>> & WithoutParent & (WithState<TState> | WithoutState)): Route<ToName<TName>, Host<'', {}>, ToPath<TPath>, ToQuery<TQuery>, TMeta, TState>;
|
|
206
|
+
export declare function createRoute<TComponents extends Record<string, Component>, const TName extends string | undefined = undefined, const TPath extends string | Path | undefined = undefined, const TQuery extends string | Query | undefined = undefined, const THash extends string | Hash | undefined = undefined, const TMeta extends RouteMeta = RouteMeta, const TState extends Record<string, Param> = Record<string, Param>>(options: CreateRouteOptions<TName, TPath, TQuery, THash, TMeta> & WithHooks & WithComponents<TComponents, RouteParams<TPath, TQuery>> & WithoutParent & (WithState<TState> | WithoutState)): Route<ToName<TName>, Host<'', {}>, ToPath<TPath>, ToQuery<TQuery>, ToHash<THash>, TMeta, TState>;
|
|
201
207
|
|
|
202
|
-
export declare function createRoute<TComponents extends Record<string, Component>, const TParent extends Route, const TName extends string | undefined = undefined, const TPath extends string | Path | undefined = undefined, const TQuery extends string | Query | undefined = undefined, const TMeta extends RouteMeta = RouteMeta, const TState extends Record<string, Param> = Record<string, Param>>(options: CreateRouteOptions<TName, TPath, TQuery, TMeta> & WithHooks & WithComponents<TComponents, RouteParams<TPath, TQuery, TParent>> & WithParent<TParent> & (WithState<TState> | WithoutState)): Route<ToName<TName>, Host<'', {}>, CombinePath<TParent['path'], ToPath<TPath>>, CombineQuery<TParent['query'], ToQuery<TQuery>>, CombineMeta<TMeta, TParent['meta']>, CombineState<TState, TParent['state']>>;
|
|
208
|
+
export declare function createRoute<TComponents extends Record<string, Component>, const TParent extends Route, const TName extends string | undefined = undefined, const TPath extends string | Path | undefined = undefined, const TQuery extends string | Query | undefined = undefined, const THash extends string | Hash | undefined = undefined, const TMeta extends RouteMeta = RouteMeta, const TState extends Record<string, Param> = Record<string, Param>>(options: CreateRouteOptions<TName, TPath, TQuery, THash, TMeta> & WithHooks & WithComponents<TComponents, RouteParams<TPath, TQuery, TParent>> & WithParent<TParent> & (WithState<TState> | WithoutState)): Route<ToName<TName>, Host<'', {}>, CombinePath<TParent['path'], ToPath<TPath>>, CombineQuery<TParent['query'], ToQuery<TQuery>>, CombineHash<TParent['hash'], ToHash<THash>>, CombineMeta<TMeta, TParent['meta']>, CombineState<TState, TParent['state']>>;
|
|
203
209
|
|
|
204
|
-
export declare type CreateRouteOptions<TName extends string | undefined = string | undefined, TPath extends string | Path | undefined = string | Path | undefined, TQuery extends string | Query | undefined = string | Query | undefined, TMeta extends RouteMeta = RouteMeta> = {
|
|
210
|
+
export declare type CreateRouteOptions<TName extends string | undefined = string | undefined, TPath extends string | Path | undefined = string | Path | undefined, TQuery extends string | Query | undefined = string | Query | undefined, THash extends string | Hash | undefined = string | Hash | undefined, TMeta extends RouteMeta = RouteMeta> = {
|
|
205
211
|
/**
|
|
206
212
|
* Name for route, used to create route keys and in navigation.
|
|
207
213
|
*/
|
|
@@ -214,6 +220,10 @@ export declare type CreateRouteOptions<TName extends string | undefined = string
|
|
|
214
220
|
* Query (aka search) part of URL.
|
|
215
221
|
*/
|
|
216
222
|
query?: TQuery;
|
|
223
|
+
/**
|
|
224
|
+
* Hash part of URL.
|
|
225
|
+
*/
|
|
226
|
+
hash?: THash;
|
|
217
227
|
/**
|
|
218
228
|
* Represents additional metadata associated with a route, customizable via declaration merging.
|
|
219
229
|
*/
|
|
@@ -359,8 +369,14 @@ declare type ExtractStateParams<TRoute> = TRoute extends {
|
|
|
359
369
|
state: infer TState extends Record<string, Param>;
|
|
360
370
|
} ? ExtractParamTypes<TState> : Record<string, unknown>;
|
|
361
371
|
|
|
372
|
+
declare type Hash<THash extends string | undefined = string | undefined> = {
|
|
373
|
+
value: THash;
|
|
374
|
+
hasValue: () => boolean;
|
|
375
|
+
toString: () => string;
|
|
376
|
+
};
|
|
377
|
+
|
|
362
378
|
declare type Host<THost extends string = string, TParams extends HostParamsWithParamNameExtracted<THost> = Record<string, Param | undefined>> = {
|
|
363
|
-
|
|
379
|
+
value: THost;
|
|
364
380
|
params: string extends THost ? Record<string, Param> : Identity<ExtractParamsFromHostString<THost, TParams>>;
|
|
365
381
|
toString: () => string;
|
|
366
382
|
};
|
|
@@ -497,7 +513,7 @@ declare type ParentPath<TParent extends Route | undefined> = TParent extends Rou
|
|
|
497
513
|
declare type ParentQuery<TParent extends Route | undefined> = TParent extends Route ? TParent['query'] : Query<'', {}>;
|
|
498
514
|
|
|
499
515
|
declare type Path<TPath extends string = string, TParams extends PathParamsWithParamNameExtracted<TPath> = Record<string, Param | undefined>> = {
|
|
500
|
-
|
|
516
|
+
value: TPath;
|
|
501
517
|
params: string extends TPath ? Record<string, Param> : Identity<ExtractParamsFromPathString<TPath, TParams>>;
|
|
502
518
|
toString: () => string;
|
|
503
519
|
};
|
|
@@ -507,7 +523,7 @@ declare type Path<TPath extends string = string, TParams extends PathParamsWithP
|
|
|
507
523
|
*
|
|
508
524
|
* @template TPath - The string literal type that represents the path.
|
|
509
525
|
* @template TParams - The type of the path parameters associated with the path.
|
|
510
|
-
* @param
|
|
526
|
+
* @param value - The path string.
|
|
511
527
|
* @param params - The parameters associated with the path, typically as key-value pairs.
|
|
512
528
|
* @returns An object representing the path which includes the path string, its parameters,
|
|
513
529
|
* and a toString method for getting the path as a string.
|
|
@@ -523,7 +539,7 @@ declare type Path<TPath extends string = string, TParams extends PathParamsWithP
|
|
|
523
539
|
* })
|
|
524
540
|
* ```
|
|
525
541
|
*/
|
|
526
|
-
export declare function path<TPath extends string, TParams extends PathParamsWithParamNameExtracted<TPath>>(
|
|
542
|
+
export declare function path<TPath extends string, TParams extends PathParamsWithParamNameExtracted<TPath>>(value: TPath, params: Identity<TParams>): Path<TPath, TParams>;
|
|
527
543
|
|
|
528
544
|
declare type PathParamsWithParamNameExtracted<TPath extends string> = {
|
|
529
545
|
[K in keyof ExtractParamsFromPathString<TPath> as ExtractParamName<K>]?: Param;
|
|
@@ -543,7 +559,7 @@ declare type PrefetchConfigOptions = {
|
|
|
543
559
|
};
|
|
544
560
|
|
|
545
561
|
declare type Query<TQuery extends string = string, TQueryParams extends QueryParamsWithParamNameExtracted<TQuery> = Record<string, Param | undefined>> = {
|
|
546
|
-
|
|
562
|
+
value: TQuery;
|
|
547
563
|
params: string extends TQuery ? Record<string, Param> : Identity<ExtractQueryParamsFromQueryString<TQuery, TQueryParams>>;
|
|
548
564
|
toString: () => string;
|
|
549
565
|
};
|
|
@@ -553,7 +569,7 @@ declare type Query<TQuery extends string = string, TQueryParams extends QueryPar
|
|
|
553
569
|
*
|
|
554
570
|
* @template TQuery - The string literal type that represents the query.
|
|
555
571
|
* @template TParams - The type of the query parameters associated with the query.
|
|
556
|
-
* @param
|
|
572
|
+
* @param value - The query string.
|
|
557
573
|
* @param params - The parameters associated with the query, typically as key-value pairs.
|
|
558
574
|
* @returns An object representing the query which includes the query string, its parameters,
|
|
559
575
|
* and a toString method for getting the query as a string.
|
|
@@ -569,7 +585,7 @@ declare type Query<TQuery extends string = string, TQueryParams extends QueryPar
|
|
|
569
585
|
* })
|
|
570
586
|
* ```
|
|
571
587
|
*/
|
|
572
|
-
export declare function query<TQuery extends string, TParams extends QueryParamsWithParamNameExtracted<TQuery>>(
|
|
588
|
+
export declare function query<TQuery extends string, TParams extends QueryParamsWithParamNameExtracted<TQuery>>(value: TQuery, params: Identity<TParams>): Query<TQuery, TParams>;
|
|
573
589
|
|
|
574
590
|
declare type QueryParamsWithParamNameExtracted<T extends string> = {
|
|
575
591
|
[K in keyof ExtractQueryParamsFromQueryString<T> as ExtractParamName<K>]?: Param;
|
|
@@ -666,6 +682,10 @@ declare type ResolvedRoute<TRoute extends Route = Route> = Readonly<{
|
|
|
666
682
|
* Accessor for query string values from user in the current browser location.
|
|
667
683
|
*/
|
|
668
684
|
query: ResolvedRouteQuery;
|
|
685
|
+
/**
|
|
686
|
+
* Hash value of the route.
|
|
687
|
+
*/
|
|
688
|
+
hash?: string;
|
|
669
689
|
/**
|
|
670
690
|
* Key value pair for route params, values will be the user provided value from current browser location.
|
|
671
691
|
*/
|
|
@@ -687,7 +707,7 @@ declare type ResolvedRouteQuery = {
|
|
|
687
707
|
* @template TPath - The type or structure of the route's path.
|
|
688
708
|
* @template TQuery - The type or structure of the query parameters associated with the route.
|
|
689
709
|
*/
|
|
690
|
-
export declare type Route<TName extends string = string, THost extends Host = Host, TPath extends Path = Path, TQuery extends Query = Query, TMeta extends RouteMeta = RouteMeta, TState extends Record<string, Param> = Record<string, Param>> = {
|
|
710
|
+
export declare type Route<TName extends string = string, THost extends Host = Host, TPath extends Path = Path, TQuery extends Query = Query, THash extends Hash = Hash, TMeta extends RouteMeta = RouteMeta, TState extends Record<string, Param> = Record<string, Param>> = {
|
|
691
711
|
/**
|
|
692
712
|
* The specific route properties that were matched in the current route.
|
|
693
713
|
*/
|
|
@@ -713,6 +733,10 @@ export declare type Route<TName extends string = string, THost extends Host = Ho
|
|
|
713
733
|
* Represents the structured query of the route, including query params.
|
|
714
734
|
*/
|
|
715
735
|
query: TQuery;
|
|
736
|
+
/**
|
|
737
|
+
* Represents the hash of the route.
|
|
738
|
+
*/
|
|
739
|
+
hash: THash;
|
|
716
740
|
/**
|
|
717
741
|
* Represents additional metadata associated with a route, combined with any parents.
|
|
718
742
|
*/
|
|
@@ -978,6 +1002,7 @@ declare type RouterPushArgs<TRoutes extends Routes, TSource extends RoutesName<T
|
|
|
978
1002
|
|
|
979
1003
|
declare type RouterPushOptions<TState = unknown> = {
|
|
980
1004
|
query?: Record<string, string>;
|
|
1005
|
+
hash?: string;
|
|
981
1006
|
replace?: boolean;
|
|
982
1007
|
state?: Partial<TState>;
|
|
983
1008
|
};
|
|
@@ -1000,6 +1025,7 @@ declare type RouterReplaceArgs<TRoutes extends Routes, TSource extends RoutesNam
|
|
|
1000
1025
|
|
|
1001
1026
|
declare type RouterReplaceOptions<TState = unknown> = {
|
|
1002
1027
|
query?: Record<string, string>;
|
|
1028
|
+
hash?: string;
|
|
1003
1029
|
state?: Partial<TState>;
|
|
1004
1030
|
};
|
|
1005
1031
|
|
|
@@ -1012,6 +1038,7 @@ declare type RouterResolveArgs<TRoutes extends Routes, TSource extends RoutesNam
|
|
|
1012
1038
|
|
|
1013
1039
|
declare type RouterResolveOptions = {
|
|
1014
1040
|
query?: Record<string, string>;
|
|
1041
|
+
hash?: string;
|
|
1015
1042
|
};
|
|
1016
1043
|
|
|
1017
1044
|
declare type RouterRoute<TRoute extends ResolvedRoute = ResolvedRoute> = Readonly<{
|
|
@@ -1020,6 +1047,7 @@ declare type RouterRoute<TRoute extends ResolvedRoute = ResolvedRoute> = Readonl
|
|
|
1020
1047
|
matches: TRoute['matches'];
|
|
1021
1048
|
state: TRoute['state'];
|
|
1022
1049
|
query: ResolvedRouteQuery;
|
|
1050
|
+
hash: TRoute['hash'];
|
|
1023
1051
|
params: Writable<TRoute['params']>;
|
|
1024
1052
|
update: RouteUpdate<TRoute>;
|
|
1025
1053
|
}>;
|
|
@@ -1050,6 +1078,7 @@ name?: string | undefined;
|
|
|
1050
1078
|
[x: number]: any;
|
|
1051
1079
|
};
|
|
1052
1080
|
query: ResolvedRouteQuery;
|
|
1081
|
+
hash: string | undefined;
|
|
1053
1082
|
params: Writable< {
|
|
1054
1083
|
[x: string]: any;
|
|
1055
1084
|
[x: number]: any;
|
|
@@ -1085,6 +1114,7 @@ name?: string | undefined;
|
|
|
1085
1114
|
[x: number]: any;
|
|
1086
1115
|
};
|
|
1087
1116
|
query: ResolvedRouteQuery;
|
|
1117
|
+
hash: string | undefined;
|
|
1088
1118
|
params: Writable< {
|
|
1089
1119
|
[x: string]: any;
|
|
1090
1120
|
[x: number]: any;
|
|
@@ -1132,6 +1162,8 @@ declare type StringHasValue<T> = string extends T ? true : '' extends T ? false
|
|
|
1132
1162
|
|
|
1133
1163
|
declare type ToCallback = (resolve: RegisteredRouter['resolve']) => string;
|
|
1134
1164
|
|
|
1165
|
+
declare type ToHash<T extends string | Hash | undefined> = T extends string ? Hash<T> : T extends undefined ? Hash<''> : unknown extends T ? Hash<''> : T;
|
|
1166
|
+
|
|
1135
1167
|
declare type ToHost<T extends string | Host | undefined> = T extends string ? Host<T, {}> : T extends undefined ? Host<'', {}> : unknown extends T ? Host<'', {}> : T;
|
|
1136
1168
|
|
|
1137
1169
|
declare type ToName<T extends string | undefined> = T extends string ? T : '';
|