@kitbag/router 0.7.2 → 0.8.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 +64 -8
- package/dist/kitbag-router.js +923 -859
- package/dist/kitbag-router.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/kitbag-router.d.ts
CHANGED
|
@@ -18,6 +18,10 @@ declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
|
18
18
|
|
|
19
19
|
declare type __VLS_NonUndefinedable_2<T> = T extends undefined ? never : T;
|
|
20
20
|
|
|
21
|
+
declare type __VLS_Prettify<T> = {
|
|
22
|
+
[K in keyof T]: T[K];
|
|
23
|
+
} & {};
|
|
24
|
+
|
|
21
25
|
declare type __VLS_TypePropsToRuntimeProps<T> = {
|
|
22
26
|
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
23
27
|
type: PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
@@ -36,6 +40,12 @@ declare type __VLS_TypePropsToRuntimeProps_2<T> = {
|
|
|
36
40
|
};
|
|
37
41
|
};
|
|
38
42
|
|
|
43
|
+
declare type __VLS_WithDefaults<P, D> = {
|
|
44
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
45
|
+
default: D[K];
|
|
46
|
+
}> : P[K];
|
|
47
|
+
};
|
|
48
|
+
|
|
39
49
|
declare type __VLS_WithTemplateSlots<T, S> = T & {
|
|
40
50
|
new (): {
|
|
41
51
|
$slots: S;
|
|
@@ -208,6 +218,10 @@ export declare type CreateRouteOptions<TName extends string | undefined = string
|
|
|
208
218
|
* Represents additional metadata associated with a route, customizable via declaration merging.
|
|
209
219
|
*/
|
|
210
220
|
meta?: TMeta;
|
|
221
|
+
/**
|
|
222
|
+
* Determines what assets are prefetched when router-link is rendered for this route. Overrides router level prefetch.
|
|
223
|
+
*/
|
|
224
|
+
prefetch?: PrefetchConfig;
|
|
211
225
|
};
|
|
212
226
|
|
|
213
227
|
/**
|
|
@@ -515,6 +529,19 @@ declare type PathParamsWithParamNameExtracted<TPath extends string> = {
|
|
|
515
529
|
[K in keyof ExtractParamsFromPathString<TPath> as ExtractParamName<K>]?: Param;
|
|
516
530
|
};
|
|
517
531
|
|
|
532
|
+
/**
|
|
533
|
+
* Determines what assets are prefetched. A boolean enables or disables all prefetching.
|
|
534
|
+
*/
|
|
535
|
+
declare type PrefetchConfig = boolean | PrefetchConfigOptions;
|
|
536
|
+
|
|
537
|
+
declare type PrefetchConfigOptions = {
|
|
538
|
+
/**
|
|
539
|
+
* When true any component that is wrapped in vue's defineAsyncComponent will be prefetched
|
|
540
|
+
* @default true
|
|
541
|
+
*/
|
|
542
|
+
components?: boolean;
|
|
543
|
+
};
|
|
544
|
+
|
|
518
545
|
declare type Query<TQuery extends string = string, TQueryParams extends QueryParamsWithParamNameExtracted<TQuery> = Record<string, Param | undefined>> = {
|
|
519
546
|
query: TQuery;
|
|
520
547
|
params: string extends TQuery ? Record<string, Param> : Identity<ExtractQueryParamsFromQueryString<TQuery, TQueryParams>>;
|
|
@@ -695,7 +722,11 @@ export declare type Route<TName extends string = string, THost extends Host = Ho
|
|
|
695
722
|
* Represents the schema of the route state, combined with any parents.
|
|
696
723
|
*/
|
|
697
724
|
state: TState;
|
|
698
|
-
|
|
725
|
+
/**
|
|
726
|
+
* Determines what assets are prefetched when router-link is rendered for this route. Overrides router level prefetch.
|
|
727
|
+
*/
|
|
728
|
+
prefetch?: PrefetchConfig;
|
|
729
|
+
/* Excluded from this release type: depth */
|
|
699
730
|
};
|
|
700
731
|
|
|
701
732
|
declare type RouteGetByKey<TRoutes extends Routes, TKey extends RoutesName<TRoutes>> = RoutesMap<TRoutes>[TKey];
|
|
@@ -851,6 +882,10 @@ export declare type Router<TRoutes extends Routes = any> = Plugin_2 & {
|
|
|
851
882
|
* Given a URL, returns true if host does not match host stored on router instance
|
|
852
883
|
*/
|
|
853
884
|
isExternal: (url: string) => boolean;
|
|
885
|
+
/**
|
|
886
|
+
* Determines what assets are prefetched.
|
|
887
|
+
*/
|
|
888
|
+
prefetch?: PrefetchConfig;
|
|
854
889
|
};
|
|
855
890
|
|
|
856
891
|
declare type RouterFind<TRoutes extends Routes> = {
|
|
@@ -864,11 +899,13 @@ declare type RouterHistoryMode = 'auto' | 'browser' | 'memory' | 'hash';
|
|
|
864
899
|
|
|
865
900
|
export declare const routerInjectionKey: InjectionKey<RegisteredRouter>;
|
|
866
901
|
|
|
867
|
-
export declare const RouterLink: __VLS_WithTemplateSlots_2<DefineComponent<__VLS_TypePropsToRuntimeProps_2<{
|
|
868
|
-
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
}
|
|
902
|
+
export declare const RouterLink: __VLS_WithTemplateSlots_2<DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps_2<RouterLinkProps & RouterPushOptions>, {
|
|
903
|
+
prefetch: undefined;
|
|
904
|
+
}>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps_2<RouterLinkProps & RouterPushOptions>, {
|
|
905
|
+
prefetch: undefined;
|
|
906
|
+
}>>>, {
|
|
907
|
+
prefetch: PrefetchConfig;
|
|
908
|
+
}, {}>, Readonly<{
|
|
872
909
|
default?: ((props: {
|
|
873
910
|
resolved: string;
|
|
874
911
|
isMatch: boolean;
|
|
@@ -884,6 +921,17 @@ to: Url | ToCallback;
|
|
|
884
921
|
}) => unknown) | undefined;
|
|
885
922
|
}>;
|
|
886
923
|
|
|
924
|
+
declare type RouterLinkProps = {
|
|
925
|
+
/**
|
|
926
|
+
* The url string to navigate to or a callback that returns a url string
|
|
927
|
+
*/
|
|
928
|
+
to: Url | ToCallback;
|
|
929
|
+
/**
|
|
930
|
+
* Determines what assets are prefetched when router-link is rendered for this route. Overrides route level prefetch.
|
|
931
|
+
*/
|
|
932
|
+
prefetch?: PrefetchConfig;
|
|
933
|
+
};
|
|
934
|
+
|
|
887
935
|
/**
|
|
888
936
|
* An error thrown when an attempt is made to use routing functionality before the router has been installed.
|
|
889
937
|
*/
|
|
@@ -912,6 +960,10 @@ export declare type RouterOptions = {
|
|
|
912
960
|
* For example having `base` of `/foo` would assume all routes should start with `your.domain.com/foo`.
|
|
913
961
|
*/
|
|
914
962
|
base?: string;
|
|
963
|
+
/**
|
|
964
|
+
* Determines what assets are prefetched when router-link is rendered for a specific route
|
|
965
|
+
*/
|
|
966
|
+
prefetch?: PrefetchConfig;
|
|
915
967
|
} & RouterRejectionComponents;
|
|
916
968
|
|
|
917
969
|
declare type RouterPush<TRoutes extends Routes = any> = {
|
|
@@ -1133,9 +1185,13 @@ export declare type UseLink = {
|
|
|
1133
1185
|
*/
|
|
1134
1186
|
export declare function useLink<TRouteKey extends RegisteredRoutesName>(name: MaybeRefOrGetter<TRouteKey>, ...args: UseLinkArgs<TRouteKey>): UseLink;
|
|
1135
1187
|
|
|
1136
|
-
export declare function useLink(url: MaybeRefOrGetter<Url>): UseLink;
|
|
1188
|
+
export declare function useLink(url: MaybeRefOrGetter<Url>, options?: MaybeRefOrGetter<UseLinkOptions>): UseLink;
|
|
1189
|
+
|
|
1190
|
+
declare type UseLinkArgs<TSource extends RegisteredRoutesName, TParams = RouteParamsByKey<RegisteredRoutes, TSource>> = AllPropertiesAreOptional<TParams> extends true ? [params?: MaybeRefOrGetter<TParams>, options?: MaybeRefOrGetter<UseLinkOptions>] : [params: MaybeRefOrGetter<TParams>, options?: MaybeRefOrGetter<UseLinkOptions>];
|
|
1137
1191
|
|
|
1138
|
-
declare type
|
|
1192
|
+
export declare type UseLinkOptions = RouterResolveOptions & {
|
|
1193
|
+
prefetch?: PrefetchConfig;
|
|
1194
|
+
};
|
|
1139
1195
|
|
|
1140
1196
|
/**
|
|
1141
1197
|
* A composition to access the router's rejection state.
|