@kitbag/router 0.10.1 → 0.11.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 +30 -8
- package/dist/kitbag-router.js +939 -875
- package/dist/kitbag-router.umd.cjs +1 -1
- package/package.json +2 -2
package/dist/kitbag-router.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AsyncComponentLoader } from 'vue';
|
|
2
2
|
import { Component } from 'vue';
|
|
3
3
|
import { ComponentOptionsMixin } from 'vue';
|
|
4
|
+
import { ComputedRef } from 'vue';
|
|
4
5
|
import { DefineComponent } from 'vue';
|
|
5
6
|
import { ExtractPropTypes } from 'vue';
|
|
6
7
|
import { FunctionalComponent } from 'vue';
|
|
@@ -238,6 +239,7 @@ export declare type CreateRouteOptions<TName extends string | undefined = string
|
|
|
238
239
|
* The Route properties originally provided to `createRoute`. The only change is normalizing meta to always default to an empty object.
|
|
239
240
|
*/
|
|
240
241
|
declare type CreateRouteOptionsMatched = CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithComponent | WithComponents | WithoutComponents) & (WithParent | WithoutParent) & (WithState | WithoutState) & {
|
|
242
|
+
id: string;
|
|
241
243
|
meta: RouteMeta;
|
|
242
244
|
};
|
|
243
245
|
|
|
@@ -556,6 +558,11 @@ declare type PrefetchConfigOptions = {
|
|
|
556
558
|
* @default true
|
|
557
559
|
*/
|
|
558
560
|
components?: boolean;
|
|
561
|
+
/**
|
|
562
|
+
* When true any props for routes will be prefetched
|
|
563
|
+
* @default false
|
|
564
|
+
*/
|
|
565
|
+
props?: boolean;
|
|
559
566
|
};
|
|
560
567
|
|
|
561
568
|
declare type Query<TQuery extends string = string, TQueryParams extends QueryParamsWithParamNameExtracted<TQuery> = Record<string, Param | undefined>> = {
|
|
@@ -665,6 +672,10 @@ declare type RemoveLeadingQuestionMarkFromKeys<T extends Record<string, unknown>
|
|
|
665
672
|
* @template TRoute - Underlying Route that has been resolved.
|
|
666
673
|
*/
|
|
667
674
|
declare type ResolvedRoute<TRoute extends Route = Route> = Readonly<{
|
|
675
|
+
/**
|
|
676
|
+
* Unique identifier for the route, generated by router.
|
|
677
|
+
*/
|
|
678
|
+
id: TRoute['id'];
|
|
668
679
|
/**
|
|
669
680
|
* The specific route properties that were matched in the current route.
|
|
670
681
|
*/
|
|
@@ -901,10 +912,6 @@ export declare type Router<TRoutes extends Routes = any, __TOptions extends Rout
|
|
|
901
912
|
* Registers a hook to be called after a route is updated.
|
|
902
913
|
*/
|
|
903
914
|
onAfterRouteUpdate: AddAfterRouteHook;
|
|
904
|
-
/**
|
|
905
|
-
* A promise that resolves when the router is fully initialized.
|
|
906
|
-
*/
|
|
907
|
-
initialized: Promise<void>;
|
|
908
915
|
/**
|
|
909
916
|
* Given a URL, returns true if host does not match host stored on router instance
|
|
910
917
|
*/
|
|
@@ -913,6 +920,10 @@ export declare type Router<TRoutes extends Routes = any, __TOptions extends Rout
|
|
|
913
920
|
* Determines what assets are prefetched.
|
|
914
921
|
*/
|
|
915
922
|
prefetch?: PrefetchConfig;
|
|
923
|
+
/**
|
|
924
|
+
* Initializes the router based on the initial route. Automatically called when the router is installed. Calling this more than once has no effect.
|
|
925
|
+
*/
|
|
926
|
+
start: () => Promise<void>;
|
|
916
927
|
};
|
|
917
928
|
|
|
918
929
|
declare type RouterFind<TRoutes extends Routes> = {
|
|
@@ -1046,6 +1057,7 @@ declare type RouterResolveOptions = {
|
|
|
1046
1057
|
};
|
|
1047
1058
|
|
|
1048
1059
|
declare type RouterRoute<TRoute extends ResolvedRoute = ResolvedRoute> = Readonly<{
|
|
1060
|
+
id: TRoute['id'];
|
|
1049
1061
|
name: TRoute['name'];
|
|
1050
1062
|
matched: TRoute['matched'];
|
|
1051
1063
|
matches: TRoute['matches'];
|
|
@@ -1070,11 +1082,14 @@ name?: string | undefined;
|
|
|
1070
1082
|
}>>>, {}, {}>, Readonly<{
|
|
1071
1083
|
default?: ((props: {
|
|
1072
1084
|
route: Readonly<{
|
|
1085
|
+
id: string;
|
|
1073
1086
|
name: string;
|
|
1074
1087
|
matched: CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithoutComponents | WithComponent | WithComponents) & (WithoutParent | WithParent) & (WithoutState | WithState) & {
|
|
1088
|
+
id: string;
|
|
1075
1089
|
meta: Record<string, unknown>;
|
|
1076
1090
|
};
|
|
1077
1091
|
matches: (CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithoutComponents | WithComponent | WithComponents) & (WithoutParent | WithParent) & (WithoutState | WithState) & {
|
|
1092
|
+
id: string;
|
|
1078
1093
|
meta: Record<string, unknown>;
|
|
1079
1094
|
})[];
|
|
1080
1095
|
state: {
|
|
@@ -1106,11 +1121,14 @@ name?: string | undefined;
|
|
|
1106
1121
|
}> & {
|
|
1107
1122
|
default?: ((props: {
|
|
1108
1123
|
route: Readonly<{
|
|
1124
|
+
id: string;
|
|
1109
1125
|
name: string;
|
|
1110
1126
|
matched: CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithoutComponents | WithComponent | WithComponents) & (WithoutParent | WithParent) & (WithoutState | WithState) & {
|
|
1127
|
+
id: string;
|
|
1111
1128
|
meta: Record<string, unknown>;
|
|
1112
1129
|
};
|
|
1113
1130
|
matches: (CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithoutComponents | WithComponent | WithComponents) & (WithoutParent | WithParent) & (WithoutState | WithState) & {
|
|
1131
|
+
id: string;
|
|
1114
1132
|
meta: Record<string, unknown>;
|
|
1115
1133
|
})[];
|
|
1116
1134
|
state: {
|
|
@@ -1182,19 +1200,23 @@ export declare type UseLink = {
|
|
|
1182
1200
|
/**
|
|
1183
1201
|
* ResolvedRoute if matched. Same value as `router.find`
|
|
1184
1202
|
*/
|
|
1185
|
-
route:
|
|
1203
|
+
route: ComputedRef<ResolvedRoute | undefined>;
|
|
1186
1204
|
/**
|
|
1187
1205
|
* Resolved URL with params interpolated and query applied. Same value as `router.resolve`.
|
|
1188
1206
|
*/
|
|
1189
|
-
href:
|
|
1207
|
+
href: ComputedRef<string>;
|
|
1190
1208
|
/**
|
|
1191
1209
|
* True if route matches current URL or is ancestor of route that matches current URL
|
|
1192
1210
|
*/
|
|
1193
|
-
isMatch:
|
|
1211
|
+
isMatch: ComputedRef<boolean>;
|
|
1194
1212
|
/**
|
|
1195
1213
|
* True if route matches current URL. Route is the same as what's currently stored at `router.route`.
|
|
1196
1214
|
*/
|
|
1197
|
-
isExactMatch:
|
|
1215
|
+
isExactMatch: ComputedRef<boolean>;
|
|
1216
|
+
/**
|
|
1217
|
+
*
|
|
1218
|
+
*/
|
|
1219
|
+
isExternal: ComputedRef<boolean>;
|
|
1198
1220
|
/**
|
|
1199
1221
|
* Convenience method for executing `router.push` with route context passed in.
|
|
1200
1222
|
*/
|