@kitbag/router 0.7.1 → 0.7.2

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 CHANGED
@@ -100,7 +100,7 @@ const settings = createRoute({
100
100
 
101
101
  const router = useRouter([user, profile, settings])
102
102
 
103
- router.push('user.settings')
103
+ router.push('settings')
104
104
  ```
105
105
 
106
106
  The push method also accepts a plain string if you know the URL you want to go to.
@@ -110,7 +110,7 @@ router.push('/user/settings')
110
110
  router.push('https://github.com/kitbagjs/router')
111
111
  ```
112
112
 
113
- This `source` argument is type safe, expecting either a Url or a valid route "key". Url is any string that starts with "http", "https", or a forward slash "/". Route key is a string of route names joined by a period `.`. Additionally if using the route key, push will require params be passed in if there are any.
113
+ This `source` argument is type safe, expecting either a [`Url`](/api/types/Url) or a valid route [`name`](/api/types/Route#name). URL is any string that starts with "http", "https", or a forward slash "/". Additionally if using the route name, push will require params be passed in if there are any.
114
114
 
115
115
  ## Update
116
116
 
@@ -121,8 +121,6 @@ declare const builtInRejections: ['NotFound'];
121
121
 
122
122
  declare type BuiltInRejectionType = typeof builtInRejections[number];
123
123
 
124
- declare type CombineKey<TParentKey extends string | undefined, TChildKey extends string | undefined> = StringHasValue<TParentKey> extends true ? StringHasValue<TChildKey> extends true ? `${TParentKey}.${TChildKey}` : TParentKey : StringHasValue<TChildKey> extends true ? TChildKey : '';
125
-
126
124
  declare type CombineMeta<TParent extends Record<string, unknown>, TChild extends Record<string, unknown>> = TParent & TChild;
127
125
 
128
126
  declare type CombinePath<TParent extends Path, TChild extends Path> = ToPath<TParent> extends {
@@ -171,9 +169,9 @@ declare type ComponentPropsGetter<TComponent extends Component> = () => MaybePro
171
169
 
172
170
  declare type Constructor = new (...args: any) => any;
173
171
 
174
- 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<ToKey<TName>, ToHost<THost>, ToPath<TPath>, ToQuery<TQuery>>;
172
+ 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>>;
175
173
 
176
- 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<CombineKey<TParent['key'], ToKey<TName>>, Host<'', {}>, CombinePath<TParent['path'], ToPath<TPath>>, CombineQuery<TParent['query'], ToQuery<TQuery>>>;
174
+ 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>>>;
177
175
 
178
176
  export declare function createParam<TParam extends ParamWithDefault>(param: TParam): TParam;
179
177
 
@@ -181,17 +179,17 @@ export declare function createParam<TParam extends Param>(param: TParam): ParamG
181
179
 
182
180
  export declare function createParam<TParam extends Param>(param: TParam, defaultValue: ExtractParamType<TParam>): ParamWithDefault<TParam>;
183
181
 
184
- 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<ToKey<TName>, Host<'', {}>, ToPath<TPath>, ToQuery<TQuery>, TMeta, TState>;
182
+ 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>;
185
183
 
186
- 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<CombineKey<TParent['key'], ToKey<TName>>, Host<'', {}>, CombinePath<TParent['path'], ToPath<TPath>>, CombineQuery<TParent['query'], ToQuery<TQuery>>, CombineMeta<TMeta, TParent['meta']>, CombineState<TState, TParent['state']>>;
184
+ 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']>>;
187
185
 
188
- 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<ToKey<TName>, Host<'', {}>, ToPath<TPath>, ToQuery<TQuery>, TMeta, TState>;
186
+ 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>;
189
187
 
190
- 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<CombineKey<TParent['key'], ToKey<TName>>, Host<'', {}>, CombinePath<TParent['path'], ToPath<TPath>>, CombineQuery<TParent['query'], ToQuery<TQuery>>, CombineMeta<TMeta, TParent['meta']>, CombineState<TState, TParent['state']>>;
188
+ 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']>>;
191
189
 
192
- 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<ToKey<TName>, Host<'', {}>, ToPath<TPath>, ToQuery<TQuery>, TMeta, TState>;
190
+ 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>;
193
191
 
194
- 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<CombineKey<TParent['key'], ToKey<TName>>, Host<'', {}>, CombinePath<TParent['path'], ToPath<TPath>>, CombineQuery<TParent['query'], ToQuery<TQuery>>, CombineMeta<TMeta, TParent['meta']>, CombineState<TState, TParent['state']>>;
192
+ 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']>>;
195
193
 
196
194
  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> = {
197
195
  /**
@@ -247,8 +245,8 @@ export declare function createRouter<const T extends Routes>(routes: T, options?
247
245
  export declare function createRouter<const T extends Routes>(arrayOfRoutes: T[], options?: RouterOptions): Router<T>;
248
246
 
249
247
  /**
250
- * An error thrown when duplicate parameters are detected in a route when creating a router.
251
- * When defining routes, param names must be unique. This includes params defined in a path
248
+ * An error thrown when duplicate parameters are detected in a route.
249
+ * Param names must be unique. This includes params defined in a path
252
250
  * parent and params defined in the query.
253
251
  */
254
252
  export declare class DuplicateParamsError extends Error {
@@ -367,33 +365,33 @@ export declare function isParamWithDefault(param: Param): param is ParamWithDefa
367
365
 
368
366
  export declare function isRoute(route: unknown): route is RouterRoute;
369
367
 
370
- export declare function isRoute<TRoute extends RouterRoute, TRouteKey extends TRoute['key']>(route: TRoute, routeKey: TRouteKey, options: IsRouteOptions & {
368
+ export declare function isRoute<TRoute extends RouterRoute, TRouteName extends TRoute['name']>(route: TRoute, routeName: TRouteName, options: IsRouteOptions & {
371
369
  exact: true;
372
370
  }): route is TRoute & {
373
- key: TRouteKey;
371
+ name: TRouteName;
374
372
  };
375
373
 
376
- export declare function isRoute<TRoute extends RouterRoute, TRouteKey extends TRoute['key']>(route: TRoute, routeKey: TRouteKey, options?: IsRouteOptions): route is TRoute & {
377
- key: `${TRouteKey}${string}`;
374
+ export declare function isRoute<TRoute extends RouterRoute, TRouteName extends TRoute['name']>(route: TRoute, routeName: TRouteName, options?: IsRouteOptions): route is TRoute & {
375
+ name: `${TRouteName}${string}`;
378
376
  };
379
377
 
380
- export declare function isRoute<TRouteKey extends RegisteredRoutesKey>(route: unknown, routeKey: TRouteKey, options: IsRouteOptions & {
378
+ export declare function isRoute<TRouteName extends RegisteredRoutesName>(route: unknown, routeName: TRouteName, options: IsRouteOptions & {
381
379
  exact: true;
382
380
  }): route is RegisteredRouterRoute & {
383
- key: TRouteKey;
381
+ name: TRouteName;
384
382
  };
385
383
 
386
- export declare function isRoute<TRouteKey extends RegisteredRoutesKey>(route: unknown, routeKey: TRouteKey, options?: IsRouteOptions): route is RegisteredRouterRoute & {
387
- key: `${TRouteKey}${string}`;
384
+ export declare function isRoute<TRouteName extends RegisteredRoutesName>(route: unknown, routeName: TRouteName, options?: IsRouteOptions): route is RegisteredRouterRoute & {
385
+ name: `${TRouteName}${string}`;
388
386
  };
389
387
 
390
- export declare function isRoute(route: unknown, routeKey?: string, options?: IsRouteOptions): boolean;
388
+ export declare function isRoute(route: unknown, routeName?: string, options?: IsRouteOptions): boolean;
391
389
 
392
390
  declare type IsRouteOptions = {
393
391
  exact?: boolean;
394
392
  };
395
393
 
396
- declare type IsRouteUnnamed<T extends Route> = StringHasValue<T['key']> extends true ? false : true;
394
+ declare type IsRouteUnnamed<T extends Route> = StringHasValue<T['name']> extends true ? false : true;
397
395
 
398
396
  declare type MakeOptional<T> = {
399
397
  [P in WithOptionalProperties<T>]?: T[P];
@@ -576,7 +574,7 @@ export declare type RegisteredRejectionType = Register extends {
576
574
  } ? TRejections[number] : never;
577
575
 
578
576
  /**
579
- * Represents the a map of all possible RouteKeys with corresponding Route registered within {@link Register}
577
+ * Represents the a map of all possible route names with corresponding Route registered within {@link Register}
580
578
  */
581
579
  export declare type RegisteredRouteMap = RoutesMap<RegisteredRoutes>;
582
580
 
@@ -610,9 +608,9 @@ export declare type RegisteredRoutes = Register extends {
610
608
  } ? TRoutes : Route[];
611
609
 
612
610
  /**
613
- * Represents the union of all possible RouteKeys registered within {@link Register}
611
+ * Represents the union of all possible route names registered within {@link Register}
614
612
  */
615
- export declare type RegisteredRoutesKey = RoutesKey<RegisteredRoutes>;
613
+ export declare type RegisteredRoutesName = RoutesName<RegisteredRoutes>;
616
614
 
617
615
  declare type RemoveLeadingQuestionMark<T extends PropertyKey> = T extends `?${infer TRest extends string}` ? TRest : T;
618
616
 
@@ -635,9 +633,9 @@ declare type ResolvedRoute<TRoute extends Route = Route> = Readonly<{
635
633
  */
636
634
  matches: TRoute['matches'];
637
635
  /**
638
- * Unique identifier for the route, generated by joining route `name` by period. Key is used for routing and for matching.
636
+ * Unique identifier for the route. Name is used for routing and for matching.
639
637
  */
640
- key: TRoute['key'];
638
+ name: TRoute['name'];
641
639
  /**
642
640
  * Accessor for query string values from user in the current browser location.
643
641
  */
@@ -659,11 +657,11 @@ declare type ResolvedRouteQuery = {
659
657
 
660
658
  /**
661
659
  * Represents the structure of a route within the application. Return value of `createRoute`
662
- * @template TKey - Represents the unique key identifying the route, typically a string.
660
+ * @template TName - Represents the unique name identifying the route, typically a string.
663
661
  * @template TPath - The type or structure of the route's path.
664
662
  * @template TQuery - The type or structure of the query parameters associated with the route.
665
663
  */
666
- export declare type Route<TKey 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>> = {
664
+ 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>> = {
667
665
  /**
668
666
  * The specific route properties that were matched in the current route.
669
667
  */
@@ -674,9 +672,9 @@ export declare type Route<TKey extends string = string, THost extends Host = Hos
674
672
  */
675
673
  matches: CreateRouteOptionsMatched[];
676
674
  /**
677
- * Unique identifier for the route, generated by joining route `name` by period. Key is used for routing and for matching.
675
+ * Unique identifier for the route. Name is used for routing and for matching.
678
676
  */
679
- key: TKey;
677
+ name: TName;
680
678
  /**
681
679
  * Represents the host for this route. Used for external routes.
682
680
  */
@@ -700,7 +698,7 @@ export declare type Route<TKey extends string = string, THost extends Host = Hos
700
698
  depth: number;
701
699
  };
702
700
 
703
- declare type RouteGetByKey<TRoutes extends Routes, TKey extends RoutesKey<TRoutes>> = RoutesMap<TRoutes>[TKey];
701
+ declare type RouteGetByKey<TRoutes extends Routes, TKey extends RoutesName<TRoutes>> = RoutesMap<TRoutes>[TKey];
704
702
 
705
703
  /**
706
704
  * Generic type representing a route hook, which can be either before or after a route change.
@@ -856,11 +854,11 @@ export declare type Router<TRoutes extends Routes = any> = Plugin_2 & {
856
854
  };
857
855
 
858
856
  declare type RouterFind<TRoutes extends Routes> = {
859
- <TSource extends RoutesKey<TRoutes>>(source: TSource, ...args: RouterFindArgs<TRoutes, TSource>): ResolvedRoute | undefined;
860
- (source: Url): ResolvedRoute | undefined;
857
+ <TSource extends RoutesName<TRoutes>>(name: TSource, ...args: RouterFindArgs<TRoutes, TSource>): ResolvedRoute | undefined;
858
+ (url: Url): ResolvedRoute | undefined;
861
859
  };
862
860
 
863
- declare type RouterFindArgs<TRoutes extends Routes, TSource extends RoutesKey<TRoutes>, TParams = RouteParamsByKey<TRoutes, TSource>> = AllPropertiesAreOptional<TParams> extends true ? [params?: TParams] : [params: TParams];
861
+ declare type RouterFindArgs<TRoutes extends Routes, TSource extends RoutesName<TRoutes>, TParams = RouteParamsByKey<TRoutes, TSource>> = AllPropertiesAreOptional<TParams> extends true ? [params?: TParams] : [params: TParams];
864
862
 
865
863
  declare type RouterHistoryMode = 'auto' | 'browser' | 'memory' | 'hash';
866
864
 
@@ -917,11 +915,11 @@ export declare type RouterOptions = {
917
915
  } & RouterRejectionComponents;
918
916
 
919
917
  declare type RouterPush<TRoutes extends Routes = any> = {
920
- <TSource extends RoutesKey<TRoutes>>(source: TSource, ...args: RouterPushArgs<TRoutes, TSource>): Promise<void>;
921
- (source: Url, options?: RouterPushOptions): Promise<void>;
918
+ <TSource extends RoutesName<TRoutes>>(name: TSource, ...args: RouterPushArgs<TRoutes, TSource>): Promise<void>;
919
+ (url: Url, options?: RouterPushOptions): Promise<void>;
922
920
  };
923
921
 
924
- declare type RouterPushArgs<TRoutes extends Routes, TSource extends RoutesKey<TRoutes>> = AllPropertiesAreOptional<RouteParamsByKey<TRoutes, TSource>> extends true ? [params?: RouteParamsByKey<TRoutes, TSource>, options?: RouterPushOptions<RouteStateByKey<TRoutes, TSource>>] : [params: RouteParamsByKey<TRoutes, TSource>, options?: RouterPushOptions<RouteStateByKey<TRoutes, TSource>>];
922
+ declare type RouterPushArgs<TRoutes extends Routes, TSource extends RoutesName<TRoutes>> = AllPropertiesAreOptional<RouteParamsByKey<TRoutes, TSource>> extends true ? [params?: RouteParamsByKey<TRoutes, TSource>, options?: RouterPushOptions<RouteStateByName<TRoutes, TSource>>] : [params: RouteParamsByKey<TRoutes, TSource>, options?: RouterPushOptions<RouteStateByName<TRoutes, TSource>>];
925
923
 
926
924
  declare type RouterPushOptions<TState = unknown> = {
927
925
  query?: Record<string, string>;
@@ -945,11 +943,11 @@ export declare const routerRejectionKey: InjectionKey<RouterRejection>;
945
943
  declare type RouterRejectionType = BuiltInRejectionType | RegisteredRejectionType;
946
944
 
947
945
  declare type RouterReplace<TRoutes extends Routes> = {
948
- <TSource extends RoutesKey<TRoutes>>(source: TSource, ...args: RouterReplaceArgs<TRoutes, TSource>): Promise<void>;
949
- (source: Url, options?: RouterReplaceOptions): Promise<void>;
946
+ <TSource extends RoutesName<TRoutes>>(name: TSource, ...args: RouterReplaceArgs<TRoutes, TSource>): Promise<void>;
947
+ (url: Url, options?: RouterReplaceOptions): Promise<void>;
950
948
  };
951
949
 
952
- declare type RouterReplaceArgs<TRoutes extends Routes, TSource extends RoutesKey<TRoutes>, TParams = RouteParamsByKey<TRoutes, TSource>> = AllPropertiesAreOptional<TParams> extends true ? [params?: TParams, options?: RouterReplaceOptions<RouteStateByKey<TRoutes, TSource>>] : [params: TParams, options?: RouterReplaceOptions<RouteStateByKey<TRoutes, TSource>>];
950
+ declare type RouterReplaceArgs<TRoutes extends Routes, TSource extends RoutesName<TRoutes>, TParams = RouteParamsByKey<TRoutes, TSource>> = AllPropertiesAreOptional<TParams> extends true ? [params?: TParams, options?: RouterReplaceOptions<RouteStateByName<TRoutes, TSource>>] : [params: TParams, options?: RouterReplaceOptions<RouteStateByName<TRoutes, TSource>>];
953
951
 
954
952
  declare type RouterReplaceOptions<TState = unknown> = {
955
953
  query?: Record<string, string>;
@@ -957,18 +955,18 @@ declare type RouterReplaceOptions<TState = unknown> = {
957
955
  };
958
956
 
959
957
  declare type RouterResolve<TRoutes extends Routes> = {
960
- <TSource extends RoutesKey<TRoutes>>(source: TSource, ...args: RouterResolveArgs<TRoutes, TSource>): string;
961
- (source: Url, options?: RouterResolveOptions): string;
958
+ <TSource extends RoutesName<TRoutes>>(name: TSource, ...args: RouterResolveArgs<TRoutes, TSource>): string;
959
+ (url: Url, options?: RouterResolveOptions): string;
962
960
  };
963
961
 
964
- declare type RouterResolveArgs<TRoutes extends Routes, TSource extends RoutesKey<TRoutes>, TParams = RouteParamsByKey<TRoutes, TSource>> = AllPropertiesAreOptional<TParams> extends true ? [params?: TParams, options?: RouterResolveOptions] : [params: TParams, options?: RouterResolveOptions];
962
+ declare type RouterResolveArgs<TRoutes extends Routes, TSource extends RoutesName<TRoutes>, TParams = RouteParamsByKey<TRoutes, TSource>> = AllPropertiesAreOptional<TParams> extends true ? [params?: TParams, options?: RouterResolveOptions] : [params: TParams, options?: RouterResolveOptions];
965
963
 
966
964
  declare type RouterResolveOptions = {
967
965
  query?: Record<string, string>;
968
966
  };
969
967
 
970
968
  declare type RouterRoute<TRoute extends ResolvedRoute = ResolvedRoute> = Readonly<{
971
- key: TRoute['key'];
969
+ name: TRoute['name'];
972
970
  matched: TRoute['matched'];
973
971
  matches: TRoute['matches'];
974
972
  state: TRoute['state'];
@@ -991,7 +989,7 @@ name?: string | undefined;
991
989
  }>>>, {}, {}>, Readonly<{
992
990
  default?: ((props: {
993
991
  route: Readonly<{
994
- key: string;
992
+ name: string;
995
993
  matched: CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithoutComponents | WithComponent | WithComponents) & (WithoutParent | WithParent) & (WithoutState | WithState) & {
996
994
  meta: Record<string, unknown>;
997
995
  };
@@ -1008,7 +1006,7 @@ name?: string | undefined;
1008
1006
  [x: number]: any;
1009
1007
  }>;
1010
1008
  update: {
1011
- (key: string, value: unknown, options?: RouterPushOptions | undefined): Promise<void>;
1009
+ (paramName: string, paramValue: unknown, options?: RouterPushOptions | undefined): Promise<void>;
1012
1010
  (params: Partial<{
1013
1011
  [x: string]: any;
1014
1012
  [x: number]: any;
@@ -1026,7 +1024,7 @@ name?: string | undefined;
1026
1024
  }> & {
1027
1025
  default?: ((props: {
1028
1026
  route: Readonly<{
1029
- key: string;
1027
+ name: string;
1030
1028
  matched: CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithoutComponents | WithComponent | WithComponents) & (WithoutParent | WithParent) & (WithoutState | WithState) & {
1031
1029
  meta: Record<string, unknown>;
1032
1030
  };
@@ -1043,7 +1041,7 @@ name?: string | undefined;
1043
1041
  [x: number]: any;
1044
1042
  }>;
1045
1043
  update: {
1046
- (key: string, value: unknown, options?: RouterPushOptions | undefined): Promise<void>;
1044
+ (paramName: string, paramValue: unknown, options?: RouterPushOptions | undefined): Promise<void>;
1047
1045
  (params: Partial<{
1048
1046
  [x: string]: any;
1049
1047
  [x: number]: any;
@@ -1065,19 +1063,19 @@ name?: string | undefined;
1065
1063
  */
1066
1064
  export declare type Routes = Readonly<Route[]>;
1067
1065
 
1068
- declare type RoutesKey<TRoutes extends Routes> = string & keyof RoutesMap<TRoutes>;
1069
-
1070
1066
  declare type RoutesMap<TRoutes extends Routes = []> = {
1071
- [K in TRoutes[number] as AsNamedRoute<K>['key']]: AsNamedRoute<K>;
1067
+ [K in TRoutes[number] as AsNamedRoute<K>['name']]: AsNamedRoute<K>;
1072
1068
  };
1073
1069
 
1074
- declare type RouteStateByKey<TRoutes extends Routes, TKey extends string> = ExtractStateParams<RouteGetByKey<TRoutes, TKey>>;
1070
+ declare type RoutesName<TRoutes extends Routes> = string & keyof RoutesMap<TRoutes>;
1071
+
1072
+ declare type RouteStateByName<TRoutes extends Routes, TName extends string> = ExtractStateParams<RouteGetByKey<TRoutes, TName>>;
1075
1073
 
1076
1074
  declare type RouteUpdate<TRoute extends ResolvedRoute = ResolvedRoute> = ResolvedRoute extends TRoute ? {
1077
- (key: string, value: unknown, options?: RouterPushOptions): Promise<void>;
1075
+ (paramName: string, paramValue: unknown, options?: RouterPushOptions): Promise<void>;
1078
1076
  (params: Partial<TRoute['params']>, options?: RouterPushOptions): Promise<void>;
1079
1077
  } : {
1080
- <TKey extends keyof TRoute['params']>(key: TKey, value: TRoute['params'][TKey], options?: RouterPushOptions): Promise<void>;
1078
+ <TParamName extends keyof TRoute['params']>(paramName: TParamName, paramValue: TRoute['params'][TParamName], options?: RouterPushOptions): Promise<void>;
1081
1079
  (params: Partial<TRoute['params']>, options?: RouterPushOptions): Promise<void>;
1082
1080
  };
1083
1081
 
@@ -1087,7 +1085,7 @@ declare type ToCallback = (resolve: RegisteredRouter['resolve']) => string;
1087
1085
 
1088
1086
  declare type ToHost<T extends string | Host | undefined> = T extends string ? Host<T, {}> : T extends undefined ? Host<'', {}> : unknown extends T ? Host<'', {}> : T;
1089
1087
 
1090
- declare type ToKey<T extends string | undefined> = T extends string ? T : '';
1088
+ declare type ToName<T extends string | undefined> = T extends string ? T : '';
1091
1089
 
1092
1090
  declare type ToPath<T extends string | Path | undefined> = T extends string ? Path<T, {}> : T extends undefined ? Path<'', {}> : unknown extends T ? Path<'', {}> : T;
1093
1091
 
@@ -1127,17 +1125,17 @@ export declare type UseLink = {
1127
1125
  * or resolved URL to discover route details. Also exports some useful context about routes relationship to current URL and convenience methods
1128
1126
  * for navigating.
1129
1127
  *
1130
- * @param source - The key of the route or the URL value.
1131
- * @param params - If providing route key, this argument will expect corresponding params.
1128
+ * @param source - The name of the route or the URL value.
1129
+ * @param params - If providing route name, this argument will expect corresponding params.
1132
1130
  * @param options - {@link RouterResolveOptions}Same options as router resolve.
1133
1131
  * @returns {UseLink} Reactive context values for as well as navigation methods.
1134
1132
  *
1135
1133
  */
1136
- export declare function useLink<TRouteKey extends RegisteredRoutesKey>(routeKey: MaybeRefOrGetter<TRouteKey>, ...args: UseLinkArgs<TRouteKey>): UseLink;
1134
+ export declare function useLink<TRouteKey extends RegisteredRoutesName>(name: MaybeRefOrGetter<TRouteKey>, ...args: UseLinkArgs<TRouteKey>): UseLink;
1137
1135
 
1138
1136
  export declare function useLink(url: MaybeRefOrGetter<Url>): UseLink;
1139
1137
 
1140
- declare type UseLinkArgs<TSource extends RegisteredRoutesKey, TParams = RouteParamsByKey<RegisteredRoutes, TSource>> = AllPropertiesAreOptional<TParams> extends true ? [params?: MaybeRefOrGetter<TParams>, options?: MaybeRefOrGetter<RouterResolveOptions>] : [params: MaybeRefOrGetter<TParams>, options?: MaybeRefOrGetter<RouterResolveOptions>];
1138
+ declare type UseLinkArgs<TSource extends RegisteredRoutesName, TParams = RouteParamsByKey<RegisteredRoutes, TSource>> = AllPropertiesAreOptional<TParams> extends true ? [params?: MaybeRefOrGetter<TParams>, options?: MaybeRefOrGetter<RouterResolveOptions>] : [params: MaybeRefOrGetter<TParams>, options?: MaybeRefOrGetter<RouterResolveOptions>];
1141
1139
 
1142
1140
  /**
1143
1141
  * A composition to access the router's rejection state.
@@ -1150,29 +1148,29 @@ declare type UseLinkArgs<TSource extends RegisteredRoutesKey, TParams = RoutePar
1150
1148
  export declare function useRejection(): RouterRejection;
1151
1149
 
1152
1150
  /**
1153
- * A composition to access the current route or verify a specific route key within a Vue component.
1151
+ * A composition to access the current route or verify a specific route name within a Vue component.
1154
1152
  * This function provides two overloads:
1155
1153
  * 1. When called without arguments, it returns the current route from the router without types.
1156
- * 2. When called with a route key, it checks if the current active route includes the specified route key.
1154
+ * 2. When called with a route name, it checks if the current active route includes the specified route name.
1157
1155
  *
1158
- * @template TRouteKey - A string type that should match route key of RegisteredRouteMap, ensuring the route key exists.
1159
- * @param routeKey - Optional. The key of the route to validate against the current active routes.
1160
- * @returns The current router route. If a route key is provided, it validates the route key first.
1161
- * @throws {UseRouteInvalidError} Throws an error if the provided route key is not valid or does not match the current route.
1156
+ * @template TRouteName - A string type that should match route name of RegisteredRouteMap, ensuring the route name exists.
1157
+ * @param routeName - Optional. The name of the route to validate against the current active routes.
1158
+ * @returns The current router route. If a route name is provided, it validates the route name first.
1159
+ * @throws {UseRouteInvalidError} Throws an error if the provided route name is not valid or does not match the current route.
1162
1160
  *
1163
- * The function also sets up a reactive watcher on the route object from the router to continually check the validity of the route key
1161
+ * The function also sets up a reactive watcher on the route object from the router to continually check the validity of the route name
1164
1162
  * if provided, throwing an error if the validation fails at any point during the component's lifecycle.
1165
1163
  */
1166
1164
  export declare function useRoute(): RegisteredRouterRoute;
1167
1165
 
1168
- export declare function useRoute<TRouteKey extends RegisteredRoutesKey>(routeKey: TRouteKey, options: IsRouteOptions & {
1166
+ export declare function useRoute<TRouteName extends RegisteredRoutesName>(routeName: TRouteName, options: IsRouteOptions & {
1169
1167
  exact: true;
1170
1168
  }): RegisteredRouterRoute & {
1171
- key: TRouteKey;
1169
+ name: TRouteName;
1172
1170
  };
1173
1171
 
1174
- export declare function useRoute<TRouteKey extends RegisteredRoutesKey>(routeKey: TRouteKey, options?: IsRouteOptions): RegisteredRouterRoute & {
1175
- key: `${TRouteKey}${string}`;
1172
+ export declare function useRoute<TRouteName extends RegisteredRoutesName>(routeName: TRouteName, options?: IsRouteOptions): RegisteredRouterRoute & {
1173
+ name: `${TRouteName}${string}`;
1176
1174
  };
1177
1175
 
1178
1176
  /**