@kitbag/router 0.11.3 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/kitbag-router.d.ts +121 -198
- package/dist/kitbag-router.js +954 -893
- package/dist/kitbag-router.umd.cjs +1 -1
- package/package.json +17 -17
package/dist/kitbag-router.d.ts
CHANGED
|
@@ -1,51 +1,69 @@
|
|
|
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 {
|
|
15
|
-
import { RendererNode } from 'vue';
|
|
13
|
+
import { UnwrapRef } from 'vue';
|
|
16
14
|
import { VNode } from 'vue';
|
|
17
15
|
|
|
18
|
-
declare
|
|
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
|
|
21
|
-
|
|
22
|
-
|
|
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
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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;
|
|
41
59
|
};
|
|
60
|
+
refs: {};
|
|
61
|
+
attrs: Partial<{}>;
|
|
42
62
|
};
|
|
43
63
|
|
|
44
|
-
declare type
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}> : P[K];
|
|
48
|
-
};
|
|
64
|
+
declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
65
|
+
|
|
66
|
+
declare type __VLS_TemplateResult_2 = ReturnType<typeof __VLS_template_2>;
|
|
49
67
|
|
|
50
68
|
declare type __VLS_WithTemplateSlots<T, S> = T & {
|
|
51
69
|
new (): {
|
|
@@ -95,7 +113,7 @@ export declare type AfterRouteHookLifecycle = 'onAfterRouteEnter' | 'onAfterRout
|
|
|
95
113
|
* Type for responses from an after route hook, which may indicate different outcomes such as success, push, or reject.
|
|
96
114
|
* @template TRoutes - The type of the routes configuration.
|
|
97
115
|
*/
|
|
98
|
-
export declare type AfterRouteHookResponse
|
|
116
|
+
export declare type AfterRouteHookResponse = CallbackSuccessResponse | CallbackPushResponse | CallbackRejectResponse;
|
|
99
117
|
|
|
100
118
|
declare type AllPropertiesAreOptional<T> = Record<string, unknown> extends T ? true : IsEmptyObject<OnlyRequiredProperties<T>>;
|
|
101
119
|
|
|
@@ -116,7 +134,7 @@ export declare type BeforeRouteHook = (to: ResolvedRoute, context: BeforeRouteHo
|
|
|
116
134
|
* as well as aborting current route change.
|
|
117
135
|
*/
|
|
118
136
|
declare type BeforeRouteHookContext = RouteHookContext & {
|
|
119
|
-
abort:
|
|
137
|
+
abort: CallbackContextAbort;
|
|
120
138
|
};
|
|
121
139
|
|
|
122
140
|
/**
|
|
@@ -128,12 +146,54 @@ export declare type BeforeRouteHookLifecycle = 'onBeforeRouteEnter' | 'onBeforeR
|
|
|
128
146
|
* Type for responses from a before route hook, which may indicate different outcomes such as success, push, reject, or abort.
|
|
129
147
|
* @template TRoutes - The type of the routes configuration.
|
|
130
148
|
*/
|
|
131
|
-
export declare type BeforeRouteHookResponse
|
|
149
|
+
export declare type BeforeRouteHookResponse = CallbackSuccessResponse | CallbackPushResponse | CallbackRejectResponse | CallbackAbortResponse;
|
|
132
150
|
|
|
133
151
|
declare const builtInRejections: ['NotFound'];
|
|
134
152
|
|
|
135
153
|
declare type BuiltInRejectionType = typeof builtInRejections[number];
|
|
136
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Defines the structure of an aborted callback response.
|
|
157
|
+
*/
|
|
158
|
+
declare type CallbackAbortResponse = {
|
|
159
|
+
status: 'ABORT';
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
declare type CallbackContext = {
|
|
163
|
+
reject: RegisteredRouterReject;
|
|
164
|
+
push: RegisteredRouterPush;
|
|
165
|
+
replace: RegisteredRouterReplace;
|
|
166
|
+
abort: CallbackContextAbort;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* A function that can be called to abort a routing operation.
|
|
171
|
+
*/
|
|
172
|
+
declare type CallbackContextAbort = () => void;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Defines the structure of a callback response that results in a push to a new route.
|
|
176
|
+
*/
|
|
177
|
+
declare type CallbackPushResponse = {
|
|
178
|
+
status: 'PUSH';
|
|
179
|
+
to: Parameters<RegisteredRouterPush>;
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Defines the structure of a callback response that results in the rejection of a route transition.
|
|
184
|
+
*/
|
|
185
|
+
declare type CallbackRejectResponse = {
|
|
186
|
+
status: 'REJECT';
|
|
187
|
+
type: RegisteredRejectionType;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Defines the structure of a successful callback response.
|
|
192
|
+
*/
|
|
193
|
+
declare type CallbackSuccessResponse = {
|
|
194
|
+
status: 'SUCCESS';
|
|
195
|
+
};
|
|
196
|
+
|
|
137
197
|
declare type CombineHash<TParent extends Hash, TChild extends Hash> = ToHash<TParent> extends {
|
|
138
198
|
value: infer TParentHash extends string;
|
|
139
199
|
} ? ToHash<TChild> extends {
|
|
@@ -198,17 +258,17 @@ export declare function createParam<TParam extends Param>(param: TParam): ParamG
|
|
|
198
258
|
|
|
199
259
|
export declare function createParam<TParam extends Param>(param: TParam, defaultValue: ExtractParamType<TParam>): ParamWithDefault<TParam>;
|
|
200
260
|
|
|
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>;
|
|
261
|
+
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
262
|
|
|
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']
|
|
263
|
+
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
264
|
|
|
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>;
|
|
265
|
+
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, TName>;
|
|
206
266
|
|
|
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']
|
|
267
|
+
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']>, TName | TParent['matches'][number]['name']>;
|
|
208
268
|
|
|
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>;
|
|
269
|
+
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, TName>;
|
|
210
270
|
|
|
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']
|
|
271
|
+
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']>, TName | TParent['matches'][number]['name']>;
|
|
212
272
|
|
|
213
273
|
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
274
|
/**
|
|
@@ -240,7 +300,7 @@ export declare type CreateRouteOptions<TName extends string | undefined = string
|
|
|
240
300
|
/**
|
|
241
301
|
* The Route properties originally provided to `createRoute`. The only change is normalizing meta to always default to an empty object.
|
|
242
302
|
*/
|
|
243
|
-
declare type CreateRouteOptionsMatched = CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithComponent | WithComponents | WithoutComponents) & (WithParent | WithoutParent) & (WithState | WithoutState) & {
|
|
303
|
+
declare type CreateRouteOptionsMatched<TName extends string | undefined = string | undefined> = CreateRouteOptions<TName> & WithHooks & (WithHost | WithoutHost) & (WithComponent | WithComponents | WithoutComponents) & (WithParent | WithoutParent) & (WithState | WithoutState) & {
|
|
244
304
|
id: string;
|
|
245
305
|
meta: RouteMeta;
|
|
246
306
|
};
|
|
@@ -634,6 +694,11 @@ export declare type RegisteredRouter = Register extends {
|
|
|
634
694
|
*/
|
|
635
695
|
export declare type RegisteredRouterPush = RouterPush<RegisteredRoutes>;
|
|
636
696
|
|
|
697
|
+
/**
|
|
698
|
+
* Type for Router Reject method. Triggers rejections registered within {@link Register}
|
|
699
|
+
*/
|
|
700
|
+
export declare type RegisteredRouterReject = (type: RegisteredRejectionType) => void;
|
|
701
|
+
|
|
637
702
|
/**
|
|
638
703
|
* Represents the type for router `replace`, with types for routes registered within {@link Register}
|
|
639
704
|
*/
|
|
@@ -722,7 +787,7 @@ declare type ResolvedRouteQuery = {
|
|
|
722
787
|
* @template TPath - The type or structure of the route's path.
|
|
723
788
|
* @template TQuery - The type or structure of the query parameters associated with the route.
|
|
724
789
|
*/
|
|
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
|
|
790
|
+
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
791
|
/**
|
|
727
792
|
* Unique identifier for the route, generated by router.
|
|
728
793
|
*/
|
|
@@ -730,12 +795,12 @@ export declare type Route<TName extends string = string, THost extends Host = Ho
|
|
|
730
795
|
/**
|
|
731
796
|
* The specific route properties that were matched in the current route.
|
|
732
797
|
*/
|
|
733
|
-
matched: CreateRouteOptionsMatched
|
|
798
|
+
matched: CreateRouteOptionsMatched<TName>;
|
|
734
799
|
/**
|
|
735
800
|
* The specific route properties that were matched in the current route, including any ancestors.
|
|
736
801
|
* Order of routes will be from greatest ancestor to narrowest matched.
|
|
737
802
|
*/
|
|
738
|
-
matches: CreateRouteOptionsMatched[];
|
|
803
|
+
matches: CreateRouteOptionsMatched<TMatchNames>[];
|
|
739
804
|
/**
|
|
740
805
|
* Identifier for the route as defined by user. Name must be unique among named routes. Name is used for routing and for matching.
|
|
741
806
|
*/
|
|
@@ -778,18 +843,6 @@ declare type RouteGetByKey<TRoutes extends Routes, TKey extends RoutesName<TRout
|
|
|
778
843
|
*/
|
|
779
844
|
export declare type RouteHook = BeforeRouteHook | AfterRouteHook;
|
|
780
845
|
|
|
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
846
|
/**
|
|
794
847
|
* Context provided to route hooks, containing context of previous route and functions for triggering rejections and push/replace to another route.
|
|
795
848
|
*/
|
|
@@ -805,23 +858,6 @@ declare type RouteHookContext = {
|
|
|
805
858
|
*/
|
|
806
859
|
export declare type RouteHookLifecycle = BeforeRouteHookLifecycle | AfterRouteHookLifecycle;
|
|
807
860
|
|
|
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
861
|
/**
|
|
826
862
|
* A function to remove a previously registered route hook.
|
|
827
863
|
*/
|
|
@@ -831,14 +867,7 @@ export declare type RouteHookRemove = () => void;
|
|
|
831
867
|
* Union type for all possible route hook responses, covering both before and after scenarios.
|
|
832
868
|
* @template TRoutes - The type of the routes configuration.
|
|
833
869
|
*/
|
|
834
|
-
export declare type RouteHookResponse
|
|
835
|
-
|
|
836
|
-
/**
|
|
837
|
-
* Defines the structure of a successful route hook response.
|
|
838
|
-
*/
|
|
839
|
-
declare type RouteHookSuccessResponse = {
|
|
840
|
-
status: 'SUCCESS';
|
|
841
|
-
};
|
|
870
|
+
export declare type RouteHookResponse = BeforeRouteHookResponse | AfterRouteHookResponse;
|
|
842
871
|
|
|
843
872
|
/**
|
|
844
873
|
* Represents additional metadata associated with a route, customizable via declaration merging.
|
|
@@ -941,27 +970,7 @@ declare type RouterHistoryMode = 'auto' | 'browser' | 'memory' | 'hash';
|
|
|
941
970
|
|
|
942
971
|
export declare const routerInjectionKey: InjectionKey<RegisteredRouter>;
|
|
943
972
|
|
|
944
|
-
export declare const RouterLink: __VLS_WithTemplateSlots_2<
|
|
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
|
-
}>;
|
|
973
|
+
export declare const RouterLink: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, __VLS_TemplateResult_2["slots"]>;
|
|
965
974
|
|
|
966
975
|
declare type RouterLinkProps = {
|
|
967
976
|
/**
|
|
@@ -1060,17 +1069,18 @@ declare type RouterResolveOptions = {
|
|
|
1060
1069
|
hash?: string;
|
|
1061
1070
|
};
|
|
1062
1071
|
|
|
1063
|
-
declare type RouterRoute<TRoute extends ResolvedRoute = ResolvedRoute> =
|
|
1064
|
-
id: TRoute['id'];
|
|
1065
|
-
name: TRoute['name'];
|
|
1066
|
-
matched: TRoute['matched'];
|
|
1067
|
-
matches: TRoute['matches'];
|
|
1072
|
+
declare type RouterRoute<TRoute extends ResolvedRoute = ResolvedRoute> = {
|
|
1073
|
+
readonly id: TRoute['id'];
|
|
1074
|
+
readonly name: TRoute['name'];
|
|
1075
|
+
readonly matched: TRoute['matched'];
|
|
1076
|
+
readonly matches: TRoute['matches'];
|
|
1077
|
+
readonly hash: TRoute['hash'];
|
|
1078
|
+
readonly update: RouteUpdate<TRoute>;
|
|
1079
|
+
params: TRoute['params'];
|
|
1068
1080
|
state: TRoute['state'];
|
|
1069
|
-
query: ResolvedRouteQuery;
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
update: RouteUpdate<TRoute>;
|
|
1073
|
-
}>;
|
|
1081
|
+
get query(): ResolvedRouteQuery;
|
|
1082
|
+
set query(value: QuerySource);
|
|
1083
|
+
};
|
|
1074
1084
|
|
|
1075
1085
|
/**
|
|
1076
1086
|
* This type is the same as `RouterRoute<ResolvedRoute<TRoutes[number]>>` while remaining distributive
|
|
@@ -1079,89 +1089,7 @@ export declare type RouterRoutes<TRoutes extends Routes> = {
|
|
|
1079
1089
|
[K in keyof TRoutes]: RouterRoute<ResolvedRoute<TRoutes[K]>>;
|
|
1080
1090
|
}[number];
|
|
1081
1091
|
|
|
1082
|
-
export declare const RouterView: __VLS_WithTemplateSlots<
|
|
1083
|
-
name?: string | undefined;
|
|
1084
|
-
}>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
1085
|
-
name?: string | undefined;
|
|
1086
|
-
}>>>, {}, {}>, Readonly<{
|
|
1087
|
-
default?: ((props: {
|
|
1088
|
-
route: Readonly<{
|
|
1089
|
-
id: string;
|
|
1090
|
-
name: string;
|
|
1091
|
-
matched: CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithComponent | WithComponents | WithoutComponents) & (WithParent | WithoutParent) & (WithState | WithoutState) & {
|
|
1092
|
-
id: string;
|
|
1093
|
-
meta: Record<string, unknown>;
|
|
1094
|
-
};
|
|
1095
|
-
matches: (CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithComponent | WithComponents | WithoutComponents) & (WithParent | WithoutParent) & (WithState | WithoutState) & {
|
|
1096
|
-
id: string;
|
|
1097
|
-
meta: Record<string, unknown>;
|
|
1098
|
-
})[];
|
|
1099
|
-
state: {
|
|
1100
|
-
[x: string]: any;
|
|
1101
|
-
[x: number]: any;
|
|
1102
|
-
};
|
|
1103
|
-
query: ResolvedRouteQuery;
|
|
1104
|
-
hash: string | undefined;
|
|
1105
|
-
params: Writable< {
|
|
1106
|
-
[x: string]: any;
|
|
1107
|
-
[x: number]: any;
|
|
1108
|
-
}>;
|
|
1109
|
-
update: {
|
|
1110
|
-
(paramName: string, paramValue: unknown, options?: RouterPushOptions | undefined): Promise<void>;
|
|
1111
|
-
(params: Partial<{
|
|
1112
|
-
[x: string]: any;
|
|
1113
|
-
[x: number]: any;
|
|
1114
|
-
}>, options?: RouterPushOptions | undefined): Promise<void>;
|
|
1115
|
-
};
|
|
1116
|
-
}>;
|
|
1117
|
-
component: Component;
|
|
1118
|
-
rejection: {
|
|
1119
|
-
type: "NotFound";
|
|
1120
|
-
component: Component;
|
|
1121
|
-
} | null;
|
|
1122
|
-
}) => VNode<RendererNode, RendererElement, {
|
|
1123
|
-
[key: string]: any;
|
|
1124
|
-
}>) | undefined;
|
|
1125
|
-
}> & {
|
|
1126
|
-
default?: ((props: {
|
|
1127
|
-
route: Readonly<{
|
|
1128
|
-
id: string;
|
|
1129
|
-
name: string;
|
|
1130
|
-
matched: CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithComponent | WithComponents | WithoutComponents) & (WithParent | WithoutParent) & (WithState | WithoutState) & {
|
|
1131
|
-
id: string;
|
|
1132
|
-
meta: Record<string, unknown>;
|
|
1133
|
-
};
|
|
1134
|
-
matches: (CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithComponent | WithComponents | WithoutComponents) & (WithParent | WithoutParent) & (WithState | WithoutState) & {
|
|
1135
|
-
id: string;
|
|
1136
|
-
meta: Record<string, unknown>;
|
|
1137
|
-
})[];
|
|
1138
|
-
state: {
|
|
1139
|
-
[x: string]: any;
|
|
1140
|
-
[x: number]: any;
|
|
1141
|
-
};
|
|
1142
|
-
query: ResolvedRouteQuery;
|
|
1143
|
-
hash: string | undefined;
|
|
1144
|
-
params: Writable< {
|
|
1145
|
-
[x: string]: any;
|
|
1146
|
-
[x: number]: any;
|
|
1147
|
-
}>;
|
|
1148
|
-
update: {
|
|
1149
|
-
(paramName: string, paramValue: unknown, options?: RouterPushOptions | undefined): Promise<void>;
|
|
1150
|
-
(params: Partial<{
|
|
1151
|
-
[x: string]: any;
|
|
1152
|
-
[x: number]: any;
|
|
1153
|
-
}>, options?: RouterPushOptions | undefined): Promise<void>;
|
|
1154
|
-
};
|
|
1155
|
-
}>;
|
|
1156
|
-
component: Component;
|
|
1157
|
-
rejection: {
|
|
1158
|
-
type: "NotFound";
|
|
1159
|
-
component: Component;
|
|
1160
|
-
} | null;
|
|
1161
|
-
}) => VNode<RendererNode, RendererElement, {
|
|
1162
|
-
[key: string]: any;
|
|
1163
|
-
}>) | undefined;
|
|
1164
|
-
}>;
|
|
1092
|
+
export declare const RouterView: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
1165
1093
|
|
|
1166
1094
|
/**
|
|
1167
1095
|
* Represents an immutable array of Route instances. Return value of `createRoute`, expected param for `createRouter`.
|
|
@@ -1324,7 +1252,7 @@ declare type WithComponent<TComponent extends Component = Component, TParams ext
|
|
|
1324
1252
|
* A Vue component, which can be either synchronous or asynchronous components.
|
|
1325
1253
|
*/
|
|
1326
1254
|
component: TComponent;
|
|
1327
|
-
props?: (params: TParams) => TComponent extends Component ? MaybePromise<ComponentProps<TComponent>> : {};
|
|
1255
|
+
props?: (params: TParams, context: CallbackContext) => TComponent extends Component ? MaybePromise<ComponentProps<TComponent>> : {};
|
|
1328
1256
|
};
|
|
1329
1257
|
|
|
1330
1258
|
declare type WithComponents<TComponents extends Record<string, Component> = Record<string, Component>, TParams extends Record<string, unknown> = Record<string, unknown>> = {
|
|
@@ -1333,7 +1261,7 @@ declare type WithComponents<TComponents extends Record<string, Component> = Reco
|
|
|
1333
1261
|
*/
|
|
1334
1262
|
components: TComponents;
|
|
1335
1263
|
props?: {
|
|
1336
|
-
[TKey in keyof TComponents]?: (params: TParams) => TComponents[TKey] extends Component ? MaybePromise<ComponentProps<TComponents[TKey]>> : {};
|
|
1264
|
+
[TKey in keyof TComponents]?: (params: TParams, context: CallbackContext) => TComponents[TKey] extends Component ? MaybePromise<ComponentProps<TComponents[TKey]>> : {};
|
|
1337
1265
|
};
|
|
1338
1266
|
};
|
|
1339
1267
|
|
|
@@ -1391,10 +1319,6 @@ declare type WithState<TState extends Record<string, Param> = Record<string, Par
|
|
|
1391
1319
|
state: TState;
|
|
1392
1320
|
};
|
|
1393
1321
|
|
|
1394
|
-
declare type Writable<T> = {
|
|
1395
|
-
-readonly [P in keyof T]: T[P];
|
|
1396
|
-
};
|
|
1397
|
-
|
|
1398
1322
|
export { }
|
|
1399
1323
|
|
|
1400
1324
|
|
|
@@ -1404,4 +1328,3 @@ declare module 'vue' {
|
|
|
1404
1328
|
RouterLink: typeof RouterLink;
|
|
1405
1329
|
}
|
|
1406
1330
|
}
|
|
1407
|
-
|