@kitbag/router 0.13.1 → 0.13.3

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.
@@ -5,7 +5,6 @@ import { ComponentProvideOptions } from 'vue';
5
5
  import { ComputedRef } from 'vue';
6
6
  import { DefineComponent } from 'vue';
7
7
  import { FunctionalComponent } from 'vue';
8
- import { InjectionKey } from 'vue';
9
8
  import { MaybeRefOrGetter } from 'vue';
10
9
  import { Plugin as Plugin_2 } from 'vue';
11
10
  import { PublicProps } from 'vue';
@@ -13,60 +12,6 @@ import { Ref } from 'vue';
13
12
  import { UnwrapRef } from 'vue';
14
13
  import { VNode } from 'vue';
15
14
 
16
- declare const __VLS_component: DefineComponent< {
17
- name?: string;
18
- }, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{
19
- name?: string;
20
- } & {}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}>;
21
-
22
- declare const __VLS_component_2: DefineComponent<RouterLinkProps & RouterPushOptions, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<RouterLinkProps & RouterPushOptions & {}>, {
23
- prefetch: PrefetchConfig;
24
- }, {}, {}, {}, string, ComponentProvideOptions, false, {}>;
25
-
26
- declare function __VLS_template(): {
27
- slots: Readonly<{
28
- default?: (props: {
29
- route: RouterRoute;
30
- component: Component;
31
- rejection: UnwrapRef<RouterRejection>;
32
- }) => VNode;
33
- }> & {
34
- default?: (props: {
35
- route: RouterRoute;
36
- component: Component;
37
- rejection: UnwrapRef<RouterRejection>;
38
- }) => VNode;
39
- };
40
- refs: {};
41
- attrs: Partial<{}>;
42
- };
43
-
44
- declare function __VLS_template_2(): {
45
- slots: Readonly<{
46
- default?: (props: {
47
- resolved: string;
48
- isMatch: boolean;
49
- isExactMatch: boolean;
50
- isExternal: boolean;
51
- }) => unknown;
52
- }> & {
53
- default?: (props: {
54
- resolved: string;
55
- isMatch: boolean;
56
- isExactMatch: boolean;
57
- isExternal: boolean;
58
- }) => unknown;
59
- };
60
- refs: {
61
- element: HTMLAnchorElement;
62
- };
63
- attrs: Partial<{}>;
64
- };
65
-
66
- declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
67
-
68
- declare type __VLS_TemplateResult_2 = ReturnType<typeof __VLS_template_2>;
69
-
70
15
  declare type __VLS_WithTemplateSlots<T, S> = T & {
71
16
  new (): {
72
17
  $slots: S;
@@ -104,7 +49,7 @@ export declare type AfterRouteHook = (to: ResolvedRoute, context: AfterRouteHook
104
49
  /**
105
50
  * Context provided to route hooks, containing context of previous route and functions for triggering rejections and push/replace to another route.
106
51
  */
107
- declare type AfterRouteHookContext = RouteHookContext;
52
+ export declare type AfterRouteHookContext = RouteHookContext;
108
53
 
109
54
  /**
110
55
  * Enumerates the lifecycle events for after route hooks.
@@ -121,6 +66,11 @@ declare type AllPropertiesAreOptional<T> = Record<string, unknown> extends T ? t
121
66
 
122
67
  declare type AsNamedRoute<T extends Route> = IsRouteUnnamed<T> extends true ? never : T;
123
68
 
69
+ /**
70
+ * Converts a string to a valid URL.
71
+ * @param value - The string to convert.
72
+ * @returns The valid URL.
73
+ */
124
74
  export declare function asUrl(value: string): Url;
125
75
 
126
76
  /**
@@ -135,7 +85,7 @@ export declare type BeforeRouteHook = (to: ResolvedRoute, context: BeforeRouteHo
135
85
  * Context provided to route hooks, containing context of previous route and functions for triggering rejections, push/replace to another route,
136
86
  * as well as aborting current route change.
137
87
  */
138
- declare type BeforeRouteHookContext = RouteHookContext & {
88
+ export declare type BeforeRouteHookContext = RouteHookContext & {
139
89
  abort: CallbackContextAbort;
140
90
  };
141
91
 
@@ -224,29 +174,7 @@ declare type CombineQueryString<TParent extends string | undefined, TChild exten
224
174
 
225
175
  declare type CombineState<TParent extends Record<string, Param>, TChild extends Record<string, Param>> = TParent & TChild;
226
176
 
227
- /**
228
- * Creates a component wrapper which has no props itself but mounts another component within while binding its props
229
- *
230
- * @param component The component to mount
231
- * @param props A callback that returns the props or attributes to bind to the component
232
- * @returns A component
233
- *
234
- * @example
235
- * ```ts
236
- * import { createRoute, component } from '@kitbag/router'
237
- *
238
- * export const routes = createRoute({
239
- * name: 'User',
240
- * path: '/',
241
- * component: component(User, () => ({ userId: 1 }))
242
- * })
243
- * ```
244
- */
245
- export declare function component<TComponent extends Component>(component: TComponent, props: ComponentPropsGetter<TComponent>): Component;
246
-
247
- export declare type ComponentProps<TComponent extends Component> = TComponent extends Constructor ? InstanceType<TComponent>['$props'] : TComponent extends AsyncComponentLoader<infer T extends Component> ? ComponentProps<T> : TComponent extends FunctionalComponent<infer T> ? T : never;
248
-
249
- declare type ComponentPropsGetter<TComponent extends Component> = () => MaybePromise<ComponentProps<TComponent>>;
177
+ declare type ComponentProps<TComponent extends Component> = TComponent extends Constructor ? InstanceType<TComponent>['$props'] : TComponent extends AsyncComponentLoader<infer T extends Component> ? ComponentProps<T> : TComponent extends FunctionalComponent<infer T> ? T : never;
250
178
 
251
179
  declare type Constructor = new (...args: any) => any;
252
180
 
@@ -338,6 +266,7 @@ export declare function createRouter<const TRoutes extends Routes, const TOption
338
266
  * An error thrown when duplicate parameters are detected in a route.
339
267
  * Param names must be unique. This includes params defined in a path
340
268
  * parent and params defined in the query.
269
+ * @group Errors
341
270
  */
342
271
  export declare class DuplicateParamsError extends Error {
343
272
  /**
@@ -448,30 +377,65 @@ declare type Identity<T> = T extends object ? {} & {
448
377
 
449
378
  declare type IsEmptyObject<T> = T extends Record<string, never> ? (keyof T extends never ? true : false) : false;
450
379
 
451
- export declare function isParamWithDefault(param: Param): param is ParamWithDefault;
452
-
380
+ /**
381
+ * A type guard for determining if a value is a valid RouterRoute.
382
+ * @param route - The value to check.
383
+ * @returns `true` if the value is a valid RouterRoute, otherwise `false`.
384
+ * @group Type Guards
385
+ */
453
386
  export declare function isRoute(route: unknown): route is RouterRoute;
454
387
 
388
+ /**
389
+ * A type guard for determining if a value is a valid RouterRoute with an exact match.
390
+ * @param route - The value to check.
391
+ * @param routeName - The expected route name.
392
+ * @returns `true` if the value is a valid RouterRoute with an exact match, otherwise `false`.
393
+ * @group Type Guards
394
+ */
455
395
  export declare function isRoute<TRoute extends RouterRoute, TRouteName extends TRoute['name']>(route: TRoute, routeName: TRouteName, options: IsRouteOptions & {
456
396
  exact: true;
457
397
  }): route is TRoute & {
458
398
  name: TRouteName;
459
399
  };
460
400
 
461
- export declare function isRoute<TRoute extends RouterRoute, TRouteName extends TRoute['name']>(route: TRoute, routeName: TRouteName, options?: IsRouteOptions): route is TRoute & {
462
- name: `${TRouteName}${string}`;
463
- };
401
+ /**
402
+ * A type guard for determining if a value is a valid RouterRoute with a partial match.
403
+ * @param route - The value to check.
404
+ * @param routeName - The expected route name.
405
+ * @returns `true` if the value is a valid RouterRoute with a partial match, otherwise `false`.
406
+ * @group Type Guards
407
+ */
408
+ export declare function isRoute<TRoute extends RouterRoute, TRouteName extends TRoute['name']>(route: TRoute, routeName: TRouteName, options?: IsRouteOptions): route is RouteWithMatch<TRoute, TRouteName>;
464
409
 
410
+ /**
411
+ * A type guard for determining if a value is a valid RegisteredRouterRoute with an exact match.
412
+ * @param route - The value to check.
413
+ * @param routeName - The expected route name.
414
+ * @returns `true` if the value is a valid RegisteredRouterRoute with an exact match, otherwise `false`.
415
+ * @group Type Guards
416
+ */
465
417
  export declare function isRoute<TRouteName extends RegisteredRoutesName>(route: unknown, routeName: TRouteName, options: IsRouteOptions & {
466
418
  exact: true;
467
419
  }): route is RegisteredRouterRoute & {
468
420
  name: TRouteName;
469
421
  };
470
422
 
471
- export declare function isRoute<TRouteName extends RegisteredRoutesName>(route: unknown, routeName: TRouteName, options?: IsRouteOptions): route is RegisteredRouterRoute & {
472
- name: `${TRouteName}${string}`;
473
- };
423
+ /**
424
+ * A type guard for determining if a value is a valid RegisteredRouterRoute with a partial match.
425
+ * @param route - The value to check.
426
+ * @param routeName - The expected route name.
427
+ * @returns `true` if the value is a valid RegisteredRouterRoute with a partial match, otherwise `false`.
428
+ * @group Type Guards
429
+ */
430
+ export declare function isRoute<TRouteName extends RegisteredRoutesName>(route: unknown, routeName: TRouteName, options?: IsRouteOptions): route is RouteWithMatch<RegisteredRouterRoute, TRouteName>;
474
431
 
432
+ /**
433
+ * A type guard for determining if a value is a valid RouterRoute.
434
+ * @param route - The value to check.
435
+ * @param routeName - The expected route name.
436
+ * @returns `true` if the value is a valid RouterRoute, otherwise `false`.
437
+ * @group Type Guards
438
+ */
475
439
  export declare function isRoute(route: unknown, routeName?: string, options?: IsRouteOptions): boolean;
476
440
 
477
441
  declare type IsRouteOptions = {
@@ -480,6 +444,12 @@ declare type IsRouteOptions = {
480
444
 
481
445
  declare type IsRouteUnnamed<T extends Route> = StringHasValue<T['name']> extends true ? false : true;
482
446
 
447
+ /**
448
+ * A type guard for determining if a value is a valid URL.
449
+ * @param value - The value to check.
450
+ * @returns `true` if the value is a valid URL, otherwise `false`.
451
+ * @group Type Guards
452
+ */
483
453
  export declare function isUrl(value: unknown): value is Url;
484
454
 
485
455
  declare type MakeOptional<T> = {
@@ -492,12 +462,22 @@ declare type MaybeArray<T> = T | T[];
492
462
 
493
463
  declare type MaybePromise<T> = T | Promise<T>;
494
464
 
465
+ /**
466
+ * An error thrown when a parent's meta has the same key as a child and the types are not compatible.
467
+ * A child's meta can override properties of the parent, however the types must match!
468
+ * @group Errors
469
+ */
470
+ export declare class MetaPropertyConflict extends Error {
471
+ constructor(property?: string);
472
+ }
473
+
495
474
  /**
496
475
  * Registers a hook that is called after a route has been entered. Must be called during setup.
497
476
  * This allows performing actions right after the component becomes active, such as fetching data or setting up event listeners.
498
477
  *
499
478
  * @param AfterRouteHook - The hook callback function
500
479
  * @returns {RouteHookRemove} A function that removes the added hook.
480
+ * @group Hooks
501
481
  */
502
482
  export declare const onAfterRouteEnter: AddAfterRouteHook;
503
483
 
@@ -507,6 +487,7 @@ export declare const onAfterRouteEnter: AddAfterRouteHook;
507
487
  *
508
488
  * @param AfterRouteHook - The hook callback function
509
489
  * @returns {RouteHookRemove} A function that removes the added hook.
490
+ * @group Hooks
510
491
  */
511
492
  export declare const onAfterRouteLeave: AddAfterRouteHook;
512
493
 
@@ -516,6 +497,7 @@ export declare const onAfterRouteLeave: AddAfterRouteHook;
516
497
  *
517
498
  * @param AfterRouteHook - The hook callback function
518
499
  * @returns {RouteHookRemove} A function that removes the added hook.
500
+ * @group Hooks
519
501
  */
520
502
  export declare const onAfterRouteUpdate: AddAfterRouteHook;
521
503
 
@@ -525,6 +507,7 @@ export declare const onAfterRouteUpdate: AddAfterRouteHook;
525
507
  *
526
508
  * @param BeforeRouteHook - The hook callback function
527
509
  * @returns {RouteHookRemove} A function that removes the added hook.
510
+ * @group Hooks
528
511
  */
529
512
  export declare const onBeforeRouteLeave: AddBeforeRouteHook;
530
513
 
@@ -534,6 +517,7 @@ export declare const onBeforeRouteLeave: AddBeforeRouteHook;
534
517
  *
535
518
  * @param BeforeRouteHook - The hook callback function
536
519
  * @returns {RouteHookRemove} A function that removes the added hook.
520
+ * @group Hooks
537
521
  */
538
522
  export declare const onBeforeRouteUpdate: AddBeforeRouteHook;
539
523
 
@@ -565,7 +549,7 @@ declare type ParamStart = typeof paramStart;
565
549
 
566
550
  declare const paramStart = "[";
567
551
 
568
- export declare type ParamWithDefault<TParam extends Param = Param> = Required<ParamGetSet<ExtractParamType<TParam>>>;
552
+ declare type ParamWithDefault<TParam extends Param = Param> = Required<ParamGetSet<ExtractParamType<TParam>>>;
569
553
 
570
554
  declare type Path<TPath extends string = string, TParams extends PathParamsWithParamNameExtracted<TPath> = Record<string, Param | undefined>> = {
571
555
  value: TPath;
@@ -624,6 +608,15 @@ declare type PrefetchConfigOptions = {
624
608
  */
625
609
  declare type PrefetchStrategy = 'eager' | 'lazy';
626
610
 
611
+ /**
612
+ * Context provided to props callback functions
613
+ */
614
+ declare type PropsCallbackContext = {
615
+ push: CallbackContext['push'];
616
+ replace: CallbackContext['replace'];
617
+ reject: CallbackContext['reject'];
618
+ };
619
+
627
620
  declare type Query<TQuery extends string = string, TQueryParams extends QueryParamsWithParamNameExtracted<TQuery> = Record<string, Param | undefined>> = {
628
621
  value: TQuery;
629
622
  params: string extends TQuery ? Record<string, Param> : Identity<ExtractQueryParamsFromQueryString<TQuery, TQueryParams>>;
@@ -736,7 +729,7 @@ declare type RemoveLeadingQuestionMarkFromKeys<T extends Record<string, unknown>
736
729
  * Represents a route that the router has matched to current browser location.
737
730
  * @template TRoute - Underlying Route that has been resolved.
738
731
  */
739
- declare type ResolvedRoute<TRoute extends Route = Route> = Readonly<{
732
+ export declare type ResolvedRoute<TRoute extends Route = Route> = Readonly<{
740
733
  /**
741
734
  * Unique identifier for the route, generated by router.
742
735
  */
@@ -853,9 +846,9 @@ export declare type RouteHook = BeforeRouteHook | AfterRouteHook;
853
846
  */
854
847
  declare type RouteHookContext = {
855
848
  from: ResolvedRoute | null;
856
- reject: RouterReject;
857
- push: RegisteredRouterPush;
858
- replace: RegisteredRouterReplace;
849
+ reject: CallbackContext['reject'];
850
+ push: CallbackContext['push'];
851
+ replace: CallbackContext['replace'];
859
852
  };
860
853
 
861
854
  /**
@@ -971,23 +964,48 @@ declare type RouterFindArgs<TRoutes extends Routes, TSource extends RoutesName<T
971
964
 
972
965
  declare type RouterHistoryMode = 'auto' | 'browser' | 'memory' | 'hash';
973
966
 
974
- export declare const routerInjectionKey: InjectionKey<RegisteredRouter>;
975
-
976
- export declare const RouterLink: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, __VLS_TemplateResult_2["slots"]>;
977
-
978
- declare type RouterLinkProps = {
979
- /**
980
- * The url string to navigate to or a callback that returns a url string
981
- */
982
- to: Url | ToCallback;
983
- /**
984
- * Determines what assets are prefetched when router-link is rendered for this route. Overrides route level prefetch.
985
- */
986
- prefetch?: PrefetchConfig;
987
- };
967
+ /**
968
+ * @ignore
969
+ */
970
+ export declare const RouterLink: __VLS_WithTemplateSlots_2<DefineComponent< {
971
+ /**
972
+ * The url string to navigate to or a callback that returns a url string
973
+ */
974
+ to: Url | ((resolve: RegisteredRouter["resolve"]) => Url);
975
+ /**
976
+ * Determines what assets are prefetched when router-link is rendered for this route. Overrides route level prefetch.
977
+ */
978
+ prefetch?: PrefetchConfig;
979
+ } & RouterPushOptions, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{
980
+ /**
981
+ * The url string to navigate to or a callback that returns a url string
982
+ */
983
+ to: Url | ((resolve: RegisteredRouter["resolve"]) => Url);
984
+ /**
985
+ * Determines what assets are prefetched when router-link is rendered for this route. Overrides route level prefetch.
986
+ */
987
+ prefetch?: PrefetchConfig;
988
+ } & RouterPushOptions & {}>, {
989
+ prefetch: PrefetchConfig;
990
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}>, Readonly<{
991
+ default?: (props: {
992
+ resolved: string;
993
+ isMatch: boolean;
994
+ isExactMatch: boolean;
995
+ isExternal: boolean;
996
+ }) => unknown;
997
+ }> & {
998
+ default?: (props: {
999
+ resolved: string;
1000
+ isMatch: boolean;
1001
+ isExactMatch: boolean;
1002
+ isExternal: boolean;
1003
+ }) => unknown;
1004
+ }>;
988
1005
 
989
1006
  /**
990
1007
  * An error thrown when an attempt is made to use routing functionality before the router has been installed.
1008
+ * @group Errors
991
1009
  */
992
1010
  export declare class RouterNotInstalledError extends Error {
993
1011
  constructor();
@@ -1045,8 +1063,6 @@ declare type RouterRejection = Ref<null | {
1045
1063
  component: Component;
1046
1064
  }>;
1047
1065
 
1048
- export declare const routerRejectionKey: InjectionKey<RouterRejection>;
1049
-
1050
1066
  declare type RouterReplace<TRoutes extends Routes> = {
1051
1067
  <TSource extends RoutesName<TRoutes>>(name: TSource, ...args: RouterReplaceArgs<TRoutes, TSource>): Promise<void>;
1052
1068
  (url: Url, options?: RouterReplaceOptions): Promise<void>;
@@ -1092,7 +1108,26 @@ export declare type RouterRoutes<TRoutes extends Routes> = {
1092
1108
  [K in keyof TRoutes]: RouterRoute<ResolvedRoute<TRoutes[K]>>;
1093
1109
  }[number];
1094
1110
 
1095
- export declare const RouterView: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
1111
+ /**
1112
+ * @ignore
1113
+ */
1114
+ export declare const RouterView: __VLS_WithTemplateSlots<DefineComponent< {
1115
+ name?: string;
1116
+ }, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{
1117
+ name?: string;
1118
+ } & {}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}>, Readonly<{
1119
+ default?: (props: {
1120
+ route: RouterRoute;
1121
+ component: Component;
1122
+ rejection: UnwrapRef<RouterRejection>;
1123
+ }) => VNode;
1124
+ }> & {
1125
+ default?: (props: {
1126
+ route: RouterRoute;
1127
+ component: Component;
1128
+ rejection: UnwrapRef<RouterRejection>;
1129
+ }) => VNode;
1130
+ }>;
1096
1131
 
1097
1132
  /**
1098
1133
  * Represents an immutable array of Route instances. Return value of `createRoute`, expected param for `createRouter`.
@@ -1115,9 +1150,9 @@ declare type RouteUpdate<TRoute extends ResolvedRoute = ResolvedRoute> = Resolve
1115
1150
  (params: Partial<TRoute['params']>, options?: RouterPushOptions): Promise<void>;
1116
1151
  };
1117
1152
 
1118
- declare type StringHasValue<T> = string extends T ? true : '' extends T ? false : T extends string ? true : false;
1153
+ declare type RouteWithMatch<TRoute extends RouterRoute, TRouteName extends TRoute['name']> = TRoute extends RouterRoute ? TRouteName extends TRoute['matches'][number]['name'] ? TRoute : never : never;
1119
1154
 
1120
- declare type ToCallback = (resolve: RegisteredRouter['resolve']) => Url;
1155
+ declare type StringHasValue<T> = string extends T ? true : '' extends T ? false : T extends string ? true : false;
1121
1156
 
1122
1157
  declare type ToHash<T extends string | Hash | undefined> = T extends string ? Hash<T> : T extends undefined ? Hash<''> : unknown extends T ? Hash<''> : T;
1123
1158
 
@@ -1180,11 +1215,11 @@ export declare type UseLink = {
1180
1215
  * or resolved URL to discover route details. Also exports some useful context about routes relationship to current URL and convenience methods
1181
1216
  * for navigating.
1182
1217
  *
1183
- * @param source - The name of the route or the URL value.
1218
+ * @param source - The name of the route or a valid URL.
1184
1219
  * @param params - If providing route name, this argument will expect corresponding params.
1185
- * @param options - {@link RouterResolveOptions}Same options as router resolve.
1220
+ * @param options - {@link RouterResolveOptions} Same options as router resolve.
1186
1221
  * @returns {UseLink} Reactive context values for as well as navigation methods.
1187
- *
1222
+ * @group Compositions
1188
1223
  */
1189
1224
  export declare function useLink<TRouteKey extends RegisteredRoutesName>(name: MaybeRefOrGetter<TRouteKey>, ...args: UseLinkArgs<TRouteKey>): UseLink;
1190
1225
 
@@ -1196,29 +1231,20 @@ export declare type UseLinkOptions = RouterResolveOptions & {
1196
1231
  prefetch?: PrefetchConfig;
1197
1232
  };
1198
1233
 
1199
- /**
1200
- * A composition to access the router's rejection state.
1201
- *
1202
- * @returns {RouterRejection} The rejection state object from the router, which can be used to handle route rejections
1203
- * such as authentication failures or permission denials.
1204
- * @throws {Error} Throws an error if the router's rejection state is not available, typically indicating
1205
- * that createRouter was never called.
1206
- */
1207
- export declare function useRejection(): RouterRejection;
1208
-
1209
1234
  /**
1210
1235
  * A composition to access the current route or verify a specific route name within a Vue component.
1211
1236
  * This function provides two overloads:
1212
1237
  * 1. When called without arguments, it returns the current route from the router without types.
1213
1238
  * 2. When called with a route name, it checks if the current active route includes the specified route name.
1214
1239
  *
1240
+ * The function also sets up a reactive watcher on the route object from the router to continually check the validity of the route name
1241
+ * if provided, throwing an error if the validation fails at any point during the component's lifecycle.
1242
+ *
1215
1243
  * @template TRouteName - A string type that should match route name of RegisteredRouteMap, ensuring the route name exists.
1216
1244
  * @param routeName - Optional. The name of the route to validate against the current active routes.
1217
1245
  * @returns The current router route. If a route name is provided, it validates the route name first.
1218
1246
  * @throws {UseRouteInvalidError} Throws an error if the provided route name is not valid or does not match the current route.
1219
- *
1220
- * The function also sets up a reactive watcher on the route object from the router to continually check the validity of the route name
1221
- * if provided, throwing an error if the validation fails at any point during the component's lifecycle.
1247
+ * @group Compositions
1222
1248
  */
1223
1249
  export declare function useRoute(): RegisteredRouterRoute;
1224
1250
 
@@ -1234,6 +1260,7 @@ export declare function useRoute<TRouteName extends RegisteredRoutesName>(routeN
1234
1260
 
1235
1261
  /**
1236
1262
  * An error thrown when there is a mismatch between an expected route and the one actually used.
1263
+ * @group Errors
1237
1264
  */
1238
1265
  export declare class UseRouteInvalidError extends Error {
1239
1266
  /**
@@ -1251,6 +1278,7 @@ export declare class UseRouteInvalidError extends Error {
1251
1278
  * @returns The registered router instance.
1252
1279
  * @throws {RouterNotInstalledError} Throws an error if the router has not been installed,
1253
1280
  * ensuring the component does not operate without routing functionality.
1281
+ * @group Compositions
1254
1282
  */
1255
1283
  export declare function useRouter(): RegisteredRouter;
1256
1284
 
@@ -1259,7 +1287,7 @@ declare type WithComponent<TComponent extends Component = Component, TRoute exte
1259
1287
  * A Vue component, which can be either synchronous or asynchronous components.
1260
1288
  */
1261
1289
  component: TComponent;
1262
- props?: (route: ResolvedRoute<TRoute>, context: CallbackContext) => TComponent extends Component ? MaybePromise<ComponentProps<TComponent>> : {};
1290
+ props?: (route: ResolvedRoute<TRoute>, context: PropsCallbackContext) => TComponent extends Component ? MaybePromise<ComponentProps<TComponent>> : {};
1263
1291
  };
1264
1292
 
1265
1293
  declare type WithComponents<TComponents extends Record<string, Component> = Record<string, Component>, TRoute extends Route = Route> = {
@@ -1268,7 +1296,7 @@ declare type WithComponents<TComponents extends Record<string, Component> = Reco
1268
1296
  */
1269
1297
  components: TComponents;
1270
1298
  props?: {
1271
- [TKey in keyof TComponents]?: (route: ResolvedRoute<TRoute>, context: CallbackContext) => TComponents[TKey] extends Component ? MaybePromise<ComponentProps<TComponents[TKey]>> : {};
1299
+ [TKey in keyof TComponents]?: (route: ResolvedRoute<TRoute>, context: PropsCallbackContext) => TComponents[TKey] extends Component ? MaybePromise<ComponentProps<TComponents[TKey]>> : {};
1272
1300
  };
1273
1301
  };
1274
1302