@kitbag/router 0.11.4 → 0.13.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.
@@ -1,51 +1,71 @@
1
1
  import { AsyncComponentLoader } from 'vue';
2
2
  import { Component } from 'vue';
3
3
  import { ComponentOptionsMixin } from 'vue';
4
+ import { ComponentProvideOptions } from 'vue';
4
5
  import { ComputedRef } from 'vue';
5
6
  import { DefineComponent } from 'vue';
6
- import { ExtractPropTypes } from 'vue';
7
7
  import { FunctionalComponent } from 'vue';
8
8
  import { InjectionKey } from 'vue';
9
9
  import { MaybeRefOrGetter } from 'vue';
10
10
  import { Plugin as Plugin_2 } from 'vue';
11
- import { PropType } from 'vue';
12
11
  import { PublicProps } from 'vue';
13
12
  import { Ref } from 'vue';
14
- import { RendererElement } from 'vue';
15
- import { RendererNode } from 'vue';
13
+ import { UnwrapRef } from 'vue';
16
14
  import { VNode } from 'vue';
17
15
 
18
- declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
16
+ declare const __VLS_component: DefineComponent< {
17
+ name?: string;
18
+ }, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{
19
+ name?: string;
20
+ } & {}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}>;
19
21
 
20
- declare type __VLS_NonUndefinedable_2<T> = T extends undefined ? never : T;
21
-
22
- declare type __VLS_Prettify<T> = {
23
- [K in keyof T]: T[K];
24
- } & {};
22
+ declare const __VLS_component_2: DefineComponent<RouterLinkProps & RouterPushOptions, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<RouterLinkProps & RouterPushOptions & {}>, {
23
+ prefetch: PrefetchConfig;
24
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}>;
25
25
 
26
- declare type __VLS_TypePropsToRuntimeProps<T> = {
27
- [K in keyof T]-?: {} extends Pick<T, K> ? {
28
- type: PropType<__VLS_NonUndefinedable<T[K]>>;
29
- } : {
30
- type: PropType<T[K]>;
31
- required: true;
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;
32
39
  };
40
+ refs: {};
41
+ attrs: Partial<{}>;
33
42
  };
34
43
 
35
- declare type __VLS_TypePropsToRuntimeProps_2<T> = {
36
- [K in keyof T]-?: {} extends Pick<T, K> ? {
37
- type: PropType<__VLS_NonUndefinedable_2<T[K]>>;
38
- } : {
39
- type: PropType<T[K]>;
40
- required: true;
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;
41
62
  };
63
+ attrs: Partial<{}>;
42
64
  };
43
65
 
44
- declare type __VLS_WithDefaults<P, D> = {
45
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
46
- default: D[K];
47
- }> : P[K];
48
- };
66
+ declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
67
+
68
+ declare type __VLS_TemplateResult_2 = ReturnType<typeof __VLS_template_2>;
49
69
 
50
70
  declare type __VLS_WithTemplateSlots<T, S> = T & {
51
71
  new (): {
@@ -95,7 +115,7 @@ export declare type AfterRouteHookLifecycle = 'onAfterRouteEnter' | 'onAfterRout
95
115
  * Type for responses from an after route hook, which may indicate different outcomes such as success, push, or reject.
96
116
  * @template TRoutes - The type of the routes configuration.
97
117
  */
98
- export declare type AfterRouteHookResponse<TRoutes extends Routes> = RouteHookSuccessResponse | RouteHookPushResponse<TRoutes> | RouteHookRejectResponse;
118
+ export declare type AfterRouteHookResponse = CallbackSuccessResponse | CallbackPushResponse | CallbackRejectResponse;
99
119
 
100
120
  declare type AllPropertiesAreOptional<T> = Record<string, unknown> extends T ? true : IsEmptyObject<OnlyRequiredProperties<T>>;
101
121
 
@@ -116,7 +136,7 @@ export declare type BeforeRouteHook = (to: ResolvedRoute, context: BeforeRouteHo
116
136
  * as well as aborting current route change.
117
137
  */
118
138
  declare type BeforeRouteHookContext = RouteHookContext & {
119
- abort: RouteHookAbort;
139
+ abort: CallbackContextAbort;
120
140
  };
121
141
 
122
142
  /**
@@ -128,12 +148,54 @@ export declare type BeforeRouteHookLifecycle = 'onBeforeRouteEnter' | 'onBeforeR
128
148
  * Type for responses from a before route hook, which may indicate different outcomes such as success, push, reject, or abort.
129
149
  * @template TRoutes - The type of the routes configuration.
130
150
  */
131
- export declare type BeforeRouteHookResponse<TRoutes extends Routes> = RouteHookSuccessResponse | RouteHookPushResponse<TRoutes> | RouteHookRejectResponse | RouteHookAbortResponse;
151
+ export declare type BeforeRouteHookResponse = CallbackSuccessResponse | CallbackPushResponse | CallbackRejectResponse | CallbackAbortResponse;
132
152
 
133
153
  declare const builtInRejections: ['NotFound'];
134
154
 
135
155
  declare type BuiltInRejectionType = typeof builtInRejections[number];
136
156
 
157
+ /**
158
+ * Defines the structure of an aborted callback response.
159
+ */
160
+ declare type CallbackAbortResponse = {
161
+ status: 'ABORT';
162
+ };
163
+
164
+ declare type CallbackContext = {
165
+ reject: RegisteredRouterReject;
166
+ push: RegisteredRouterPush;
167
+ replace: RegisteredRouterReplace;
168
+ abort: CallbackContextAbort;
169
+ };
170
+
171
+ /**
172
+ * A function that can be called to abort a routing operation.
173
+ */
174
+ declare type CallbackContextAbort = () => void;
175
+
176
+ /**
177
+ * Defines the structure of a callback response that results in a push to a new route.
178
+ */
179
+ declare type CallbackPushResponse = {
180
+ status: 'PUSH';
181
+ to: Parameters<RegisteredRouterPush>;
182
+ };
183
+
184
+ /**
185
+ * Defines the structure of a callback response that results in the rejection of a route transition.
186
+ */
187
+ declare type CallbackRejectResponse = {
188
+ status: 'REJECT';
189
+ type: RegisteredRejectionType;
190
+ };
191
+
192
+ /**
193
+ * Defines the structure of a successful callback response.
194
+ */
195
+ declare type CallbackSuccessResponse = {
196
+ status: 'SUCCESS';
197
+ };
198
+
137
199
  declare type CombineHash<TParent extends Hash, TChild extends Hash> = ToHash<TParent> extends {
138
200
  value: infer TParentHash extends string;
139
201
  } ? ToHash<TChild> extends {
@@ -198,17 +260,17 @@ export declare function createParam<TParam extends Param>(param: TParam): ParamG
198
260
 
199
261
  export declare function createParam<TParam extends Param>(param: TParam, defaultValue: ExtractParamType<TParam>): ParamWithDefault<TParam>;
200
262
 
201
- 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>;
263
+ 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, TName>;
202
264
 
203
- 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']>>;
265
+ 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']>, TName | TParent['matches'][number]['name']>;
204
266
 
205
- 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>;
267
+ 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, Route<ToName<TName>, Host<'', {}>, ToPath<TPath>, ToQuery<TQuery>, ToHash<THash>, TMeta, TState, TName>> & WithoutParent & (WithState<TState> | WithoutState)): Route<ToName<TName>, Host<'', {}>, ToPath<TPath>, ToQuery<TQuery>, ToHash<THash>, TMeta, TState, TName>;
206
268
 
207
- 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']>>;
269
+ 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, 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']>, TName | TParent['matches'][number]['name']>> & 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']>, TName | TParent['matches'][number]['name']>;
208
270
 
209
- 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>;
271
+ 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, Route<ToName<TName>, Host<'', {}>, ToPath<TPath>, ToQuery<TQuery>, ToHash<THash>, TMeta, TState, TName>> & WithoutParent & (WithState<TState> | WithoutState)): Route<ToName<TName>, Host<'', {}>, ToPath<TPath>, ToQuery<TQuery>, ToHash<THash>, TMeta, TState, TName>;
210
272
 
211
- 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']>>;
273
+ 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, 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']>, TName | TParent['matches'][number]['name']>> & 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']>, TName | TParent['matches'][number]['name']>;
212
274
 
213
275
  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> = {
214
276
  /**
@@ -240,7 +302,7 @@ export declare type CreateRouteOptions<TName extends string | undefined = string
240
302
  /**
241
303
  * The Route properties originally provided to `createRoute`. The only change is normalizing meta to always default to an empty object.
242
304
  */
243
- declare type CreateRouteOptionsMatched = CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithComponent | WithComponents | WithoutComponents) & (WithParent | WithoutParent) & (WithState | WithoutState) & {
305
+ declare type CreateRouteOptionsMatched<TName extends string | undefined = string | undefined> = CreateRouteOptions<TName> & WithHooks & (WithHost | WithoutHost) & (WithComponent | WithComponents | WithoutComponents) & (WithParent | WithoutParent) & (WithState | WithoutState) & {
244
306
  id: string;
245
307
  meta: RouteMeta;
246
308
  };
@@ -505,10 +567,6 @@ declare const paramStart = "[";
505
567
 
506
568
  export declare type ParamWithDefault<TParam extends Param = Param> = Required<ParamGetSet<ExtractParamType<TParam>>>;
507
569
 
508
- declare type ParentPath<TParent extends Route | undefined> = TParent extends Route ? TParent['path'] : Path<'', {}>;
509
-
510
- declare type ParentQuery<TParent extends Route | undefined> = TParent extends Route ? TParent['query'] : Query<'', {}>;
511
-
512
570
  declare type Path<TPath extends string = string, TParams extends PathParamsWithParamNameExtracted<TPath> = Record<string, Param | undefined>> = {
513
571
  value: TPath;
514
572
  params: string extends TPath ? Record<string, Param> : Identity<ExtractParamsFromPathString<TPath, TParams>>;
@@ -544,21 +602,28 @@ declare type PathParamsWithParamNameExtracted<TPath extends string> = {
544
602
  /**
545
603
  * Determines what assets are prefetched. A boolean enables or disables all prefetching.
546
604
  */
547
- declare type PrefetchConfig = boolean | PrefetchConfigOptions;
605
+ declare type PrefetchConfig = boolean | PrefetchStrategy | PrefetchConfigOptions;
548
606
 
549
607
  declare type PrefetchConfigOptions = {
550
608
  /**
551
609
  * When true any component that is wrapped in vue's defineAsyncComponent will be prefetched
552
- * @default true
610
+ * @default 'eager'
553
611
  */
554
- components?: boolean;
612
+ components?: boolean | PrefetchStrategy;
555
613
  /**
556
614
  * When true any props for routes will be prefetched
557
615
  * @default false
558
616
  */
559
- props?: boolean;
617
+ props?: boolean | PrefetchStrategy;
560
618
  };
561
619
 
620
+ /**
621
+ * Determines when assets are prefetched.
622
+ * eager: Fetched immediately
623
+ * lazy: Fetched when visible
624
+ */
625
+ declare type PrefetchStrategy = 'eager' | 'lazy';
626
+
562
627
  declare type Query<TQuery extends string = string, TQueryParams extends QueryParamsWithParamNameExtracted<TQuery> = Record<string, Param | undefined>> = {
563
628
  value: TQuery;
564
629
  params: string extends TQuery ? Record<string, Param> : Identity<ExtractQueryParamsFromQueryString<TQuery, TQueryParams>>;
@@ -634,6 +699,11 @@ export declare type RegisteredRouter = Register extends {
634
699
  */
635
700
  export declare type RegisteredRouterPush = RouterPush<RegisteredRoutes>;
636
701
 
702
+ /**
703
+ * Type for Router Reject method. Triggers rejections registered within {@link Register}
704
+ */
705
+ export declare type RegisteredRouterReject = (type: RegisteredRejectionType) => void;
706
+
637
707
  /**
638
708
  * Represents the type for router `replace`, with types for routes registered within {@link Register}
639
709
  */
@@ -722,7 +792,7 @@ declare type ResolvedRouteQuery = {
722
792
  * @template TPath - The type or structure of the route's path.
723
793
  * @template TQuery - The type or structure of the query parameters associated with the route.
724
794
  */
725
- 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>> = {
795
+ 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>, TMatchNames extends string | undefined = string | undefined> = {
726
796
  /**
727
797
  * Unique identifier for the route, generated by router.
728
798
  */
@@ -730,12 +800,12 @@ export declare type Route<TName extends string = string, THost extends Host = Ho
730
800
  /**
731
801
  * The specific route properties that were matched in the current route.
732
802
  */
733
- matched: CreateRouteOptionsMatched;
803
+ matched: CreateRouteOptionsMatched<TName>;
734
804
  /**
735
805
  * The specific route properties that were matched in the current route, including any ancestors.
736
806
  * Order of routes will be from greatest ancestor to narrowest matched.
737
807
  */
738
- matches: CreateRouteOptionsMatched[];
808
+ matches: CreateRouteOptionsMatched<TMatchNames>[];
739
809
  /**
740
810
  * Identifier for the route as defined by user. Name must be unique among named routes. Name is used for routing and for matching.
741
811
  */
@@ -778,18 +848,6 @@ declare type RouteGetByKey<TRoutes extends Routes, TKey extends RoutesName<TRout
778
848
  */
779
849
  export declare type RouteHook = BeforeRouteHook | AfterRouteHook;
780
850
 
781
- /**
782
- * A function that can be called to abort a routing operation.
783
- */
784
- export declare type RouteHookAbort = () => void;
785
-
786
- /**
787
- * Defines the structure of an aborted route hook response.
788
- */
789
- declare type RouteHookAbortResponse = {
790
- status: 'ABORT';
791
- };
792
-
793
851
  /**
794
852
  * Context provided to route hooks, containing context of previous route and functions for triggering rejections and push/replace to another route.
795
853
  */
@@ -805,23 +863,6 @@ declare type RouteHookContext = {
805
863
  */
806
864
  export declare type RouteHookLifecycle = BeforeRouteHookLifecycle | AfterRouteHookLifecycle;
807
865
 
808
- /**
809
- * Defines the structure of a route hook response that results in a push to a new route.
810
- * @template T - The type of the routes configuration.
811
- */
812
- declare type RouteHookPushResponse<T extends Routes> = {
813
- status: 'PUSH';
814
- to: Parameters<RouterPush<T>>;
815
- };
816
-
817
- /**
818
- * Defines the structure of a route hook response that results in the rejection of a route transition.
819
- */
820
- declare type RouteHookRejectResponse = {
821
- status: 'REJECT';
822
- type: RegisteredRejectionType;
823
- };
824
-
825
866
  /**
826
867
  * A function to remove a previously registered route hook.
827
868
  */
@@ -831,14 +872,7 @@ export declare type RouteHookRemove = () => void;
831
872
  * Union type for all possible route hook responses, covering both before and after scenarios.
832
873
  * @template TRoutes - The type of the routes configuration.
833
874
  */
834
- export declare type RouteHookResponse<TRoutes extends Routes> = BeforeRouteHookResponse<TRoutes> | AfterRouteHookResponse<TRoutes>;
835
-
836
- /**
837
- * Defines the structure of a successful route hook response.
838
- */
839
- declare type RouteHookSuccessResponse = {
840
- status: 'SUCCESS';
841
- };
875
+ export declare type RouteHookResponse = BeforeRouteHookResponse | AfterRouteHookResponse;
842
876
 
843
877
  /**
844
878
  * Represents additional metadata associated with a route, customizable via declaration merging.
@@ -847,8 +881,6 @@ export declare type RouteMeta = Register extends {
847
881
  routeMeta: infer RouteMeta extends Record<string, unknown>;
848
882
  } ? RouteMeta : Record<string, unknown>;
849
883
 
850
- declare type RouteParams<TPath extends string | Path | undefined, TQuery extends string | Query | undefined, TParent extends Route | undefined = undefined> = ExtractParamTypes<Identity<CombinePath<ParentPath<TParent>, ToPath<TPath>>['params'] & CombineQuery<ParentQuery<TParent>, ToQuery<TQuery>>['params']>>;
851
-
852
884
  declare type RouteParamsByKey<TRoutes extends Routes, TKey extends string> = ExtractRouteParamTypesWithoutLosingOptional<RouteGetByKey<TRoutes, TKey>>;
853
885
 
854
886
  export declare type Router<TRoutes extends Routes = any, __TOptions extends RouterOptions = any> = Plugin_2 & {
@@ -941,27 +973,7 @@ declare type RouterHistoryMode = 'auto' | 'browser' | 'memory' | 'hash';
941
973
 
942
974
  export declare const routerInjectionKey: InjectionKey<RegisteredRouter>;
943
975
 
944
- export declare const RouterLink: __VLS_WithTemplateSlots_2<DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps_2<RouterLinkProps & RouterPushOptions>, {
945
- prefetch: undefined;
946
- }>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps_2<RouterLinkProps & RouterPushOptions>, {
947
- prefetch: undefined;
948
- }>>>, {
949
- prefetch: PrefetchConfig;
950
- }, {}>, Readonly<{
951
- default?: ((props: {
952
- resolved: string;
953
- isMatch: boolean;
954
- isExactMatch: boolean;
955
- isExternal: boolean;
956
- }) => unknown) | undefined;
957
- }> & {
958
- default?: ((props: {
959
- resolved: string;
960
- isMatch: boolean;
961
- isExactMatch: boolean;
962
- isExternal: boolean;
963
- }) => unknown) | undefined;
964
- }>;
976
+ export declare const RouterLink: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, __VLS_TemplateResult_2["slots"]>;
965
977
 
966
978
  declare type RouterLinkProps = {
967
979
  /**
@@ -1065,10 +1077,10 @@ declare type RouterRoute<TRoute extends ResolvedRoute = ResolvedRoute> = {
1065
1077
  readonly name: TRoute['name'];
1066
1078
  readonly matched: TRoute['matched'];
1067
1079
  readonly matches: TRoute['matches'];
1068
- readonly state: TRoute['state'];
1069
1080
  readonly hash: TRoute['hash'];
1070
- readonly params: Writable<TRoute['params']>;
1071
1081
  readonly update: RouteUpdate<TRoute>;
1082
+ params: TRoute['params'];
1083
+ state: TRoute['state'];
1072
1084
  get query(): ResolvedRouteQuery;
1073
1085
  set query(value: QuerySource);
1074
1086
  };
@@ -1080,33 +1092,7 @@ export declare type RouterRoutes<TRoutes extends Routes> = {
1080
1092
  [K in keyof TRoutes]: RouterRoute<ResolvedRoute<TRoutes[K]>>;
1081
1093
  }[number];
1082
1094
 
1083
- export declare const RouterView: __VLS_WithTemplateSlots<DefineComponent<__VLS_TypePropsToRuntimeProps<{
1084
- name?: string | undefined;
1085
- }>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
1086
- name?: string | undefined;
1087
- }>>>, {}, {}>, Readonly<{
1088
- default?: ((props: {
1089
- route: RouterRoute;
1090
- component: Component;
1091
- rejection: {
1092
- type: "NotFound";
1093
- component: Component;
1094
- } | null;
1095
- }) => VNode<RendererNode, RendererElement, {
1096
- [key: string]: any;
1097
- }>) | undefined;
1098
- }> & {
1099
- default?: ((props: {
1100
- route: RouterRoute;
1101
- component: Component;
1102
- rejection: {
1103
- type: "NotFound";
1104
- component: Component;
1105
- } | null;
1106
- }) => VNode<RendererNode, RendererElement, {
1107
- [key: string]: any;
1108
- }>) | undefined;
1109
- }>;
1095
+ export declare const RouterView: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
1110
1096
 
1111
1097
  /**
1112
1098
  * Represents an immutable array of Route instances. Return value of `createRoute`, expected param for `createRouter`.
@@ -1155,6 +1141,10 @@ export declare type UrlParts = {
1155
1141
  };
1156
1142
 
1157
1143
  export declare type UseLink = {
1144
+ /**
1145
+ * A template ref to bind to the dom for automatic prefetching
1146
+ */
1147
+ element: Ref<HTMLElement | undefined>;
1158
1148
  /**
1159
1149
  * ResolvedRoute if matched. Same value as `router.find`
1160
1150
  */
@@ -1264,21 +1254,21 @@ export declare class UseRouteInvalidError extends Error {
1264
1254
  */
1265
1255
  export declare function useRouter(): RegisteredRouter;
1266
1256
 
1267
- declare type WithComponent<TComponent extends Component = Component, TParams extends Record<string, unknown> = Record<string, unknown>> = {
1257
+ declare type WithComponent<TComponent extends Component = Component, TRoute extends Route = Route> = {
1268
1258
  /**
1269
1259
  * A Vue component, which can be either synchronous or asynchronous components.
1270
1260
  */
1271
1261
  component: TComponent;
1272
- props?: (params: TParams) => TComponent extends Component ? MaybePromise<ComponentProps<TComponent>> : {};
1262
+ props?: (route: ResolvedRoute<TRoute>, context: CallbackContext) => TComponent extends Component ? MaybePromise<ComponentProps<TComponent>> : {};
1273
1263
  };
1274
1264
 
1275
- declare type WithComponents<TComponents extends Record<string, Component> = Record<string, Component>, TParams extends Record<string, unknown> = Record<string, unknown>> = {
1265
+ declare type WithComponents<TComponents extends Record<string, Component> = Record<string, Component>, TRoute extends Route = Route> = {
1276
1266
  /**
1277
1267
  * Multiple components for named views, which can be either synchronous or asynchronous components.
1278
1268
  */
1279
1269
  components: TComponents;
1280
1270
  props?: {
1281
- [TKey in keyof TComponents]?: (params: TParams) => TComponents[TKey] extends Component ? MaybePromise<ComponentProps<TComponents[TKey]>> : {};
1271
+ [TKey in keyof TComponents]?: (route: ResolvedRoute<TRoute>, context: CallbackContext) => TComponents[TKey] extends Component ? MaybePromise<ComponentProps<TComponents[TKey]>> : {};
1282
1272
  };
1283
1273
  };
1284
1274
 
@@ -1336,10 +1326,6 @@ declare type WithState<TState extends Record<string, Param> = Record<string, Par
1336
1326
  state: TState;
1337
1327
  };
1338
1328
 
1339
- declare type Writable<T> = {
1340
- -readonly [P in keyof T]: T[P];
1341
- };
1342
-
1343
1329
  export { }
1344
1330
 
1345
1331
 
@@ -1349,4 +1335,3 @@ declare module 'vue' {
1349
1335
  RouterLink: typeof RouterLink;
1350
1336
  }
1351
1337
  }
1352
-