@kitbag/router 0.14.1 → 0.15.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,3 +1,4 @@
1
+ import { App } from 'vue';
1
2
  import { AsyncComponentLoader } from 'vue';
2
3
  import { Component } from 'vue';
3
4
  import { ComponentOptionsMixin } from 'vue';
@@ -6,7 +7,6 @@ import { ComputedRef } from 'vue';
6
7
  import { DefineComponent } from 'vue';
7
8
  import { FunctionalComponent } from 'vue';
8
9
  import { MaybeRefOrGetter } from 'vue';
9
- import { Plugin as Plugin_2 } from 'vue';
10
10
  import { PublicProps } from 'vue';
11
11
  import { Ref } from 'vue';
12
12
  import { UnwrapRef } from 'vue';
@@ -586,7 +586,7 @@ declare type PathParamsWithParamNameExtracted<TPath extends string> = {
586
586
  /**
587
587
  * Determines what assets are prefetched. A boolean enables or disables all prefetching.
588
588
  */
589
- declare type PrefetchConfig = boolean | PrefetchStrategy | PrefetchConfigOptions;
589
+ export declare type PrefetchConfig = boolean | PrefetchStrategy | PrefetchConfigOptions;
590
590
 
591
591
  declare type PrefetchConfigOptions = {
592
592
  /**
@@ -606,7 +606,7 @@ declare type PrefetchConfigOptions = {
606
606
  * eager: Fetched immediately
607
607
  * lazy: Fetched when visible
608
608
  */
609
- declare type PrefetchStrategy = 'eager' | 'lazy';
609
+ export declare type PrefetchStrategy = 'eager' | 'lazy' | 'intent';
610
610
 
611
611
  /**
612
612
  * Context provided to props callback functions
@@ -649,7 +649,7 @@ declare type QueryParamsWithParamNameExtracted<T extends string> = {
649
649
  [K in keyof ExtractQueryParamsFromQueryString<T> as ExtractParamName<K>]?: Param;
650
650
  };
651
651
 
652
- declare type QuerySource = ConstructorParameters<typeof URLSearchParams>[0];
652
+ export declare type QuerySource = ConstructorParameters<typeof URLSearchParams>[0];
653
653
 
654
654
  /**
655
655
  * Represents the state of currently registered router, and route meta. Used to provide correct type context for
@@ -671,7 +671,7 @@ export declare interface Register {
671
671
  /**
672
672
  * Represents the possible Rejections registered within {@link Register}
673
673
  */
674
- export declare type RegisteredRejectionType = Register extends {
674
+ export declare type RegisteredRejectionType<T = Register> = T extends {
675
675
  router: Router<Routes, infer TOptions extends RouterOptions>;
676
676
  } ? keyof TOptions['rejections'] | BuiltInRejectionType : BuiltInRejectionType;
677
677
 
@@ -683,7 +683,7 @@ export declare type RegisteredRouteMap = RoutesMap<RegisteredRoutes>;
683
683
  /**
684
684
  * Represents the Router property within {@link Register}
685
685
  */
686
- export declare type RegisteredRouter = Register extends {
686
+ export declare type RegisteredRouter<T = Register> = T extends {
687
687
  router: infer TRouter;
688
688
  } ? TRouter : Router;
689
689
 
@@ -710,7 +710,7 @@ export declare type RegisteredRouterRoute = RegisteredRouter['route'];
710
710
  /**
711
711
  * Represents the Router routes property within {@link Register}
712
712
  */
713
- export declare type RegisteredRoutes = Register extends {
713
+ export declare type RegisteredRoutes<T = Register> = T extends {
714
714
  router: Router<infer TRoutes extends Routes>;
715
715
  } ? TRoutes : Route[];
716
716
 
@@ -860,13 +860,18 @@ export declare type RouteHookResponse = BeforeRouteHookResponse | AfterRouteHook
860
860
  /**
861
861
  * Represents additional metadata associated with a route, customizable via declaration merging.
862
862
  */
863
- export declare type RouteMeta = Register extends {
863
+ export declare type RouteMeta<T = Register> = T extends {
864
864
  routeMeta: infer RouteMeta extends Record<string, unknown>;
865
865
  } ? RouteMeta : Record<string, unknown>;
866
866
 
867
867
  declare type RouteParamsByKey<TRoutes extends Routes, TKey extends string> = ExtractRouteParamTypesWithoutLosingOptional<RouteGetByKey<TRoutes, TKey>>;
868
868
 
869
- export declare type Router<TRoutes extends Routes = any, __TOptions extends RouterOptions = any> = Plugin_2 & {
869
+ export declare type Router<TRoutes extends Routes = any, __TOptions extends RouterOptions = any> = {
870
+ /**
871
+ * Installs the router into a Vue application instance.
872
+ * @param app The Vue application instance to install the router into
873
+ */
874
+ install: (app: App) => void;
870
875
  /**
871
876
  * Manages the current route state.
872
877
  */
@@ -968,9 +973,9 @@ to: Url | ResolvedRoute | ToCallback;
968
973
  * Determines what assets are prefetched when router-link is rendered for this route. Overrides route level prefetch.
969
974
  */
970
975
  prefetch?: PrefetchConfig;
971
- } & RouterPushOptions> & Readonly<{}>, {
976
+ } & RouterPushOptions & {}>, {
972
977
  prefetch: PrefetchConfig;
973
- }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>, Readonly<{
978
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}>, Readonly<{
974
979
  default?: (props: {
975
980
  route: ResolvedRoute | undefined;
976
981
  isMatch: boolean;
@@ -1027,8 +1032,8 @@ export declare type RouterOptions = {
1027
1032
 
1028
1033
  declare type RouterPush<TRoutes extends Routes = any> = {
1029
1034
  <TSource extends RoutesName<TRoutes>>(name: TSource, ...args: RouterPushArgs<TRoutes, TSource>): Promise<void>;
1030
- (url: Url, options?: RouterPushOptions): Promise<void>;
1031
1035
  (route: ResolvedRoute, options?: RouterPushOptions): Promise<void>;
1036
+ (url: Url, options?: RouterPushOptions): Promise<void>;
1032
1037
  };
1033
1038
 
1034
1039
  declare type RouterPushArgs<TRoutes extends Routes, TSource extends RoutesName<TRoutes>> = AllPropertiesAreOptional<RouteParamsByKey<TRoutes, TSource>> extends true ? [params?: RouteParamsByKey<TRoutes, TSource>, options?: RouterPushOptions<RouteStateByName<TRoutes, TSource>>] : [params: RouteParamsByKey<TRoutes, TSource>, options?: RouterPushOptions<RouteStateByName<TRoutes, TSource>>];
@@ -1049,8 +1054,8 @@ declare type RouterRejection = Ref<null | {
1049
1054
 
1050
1055
  declare type RouterReplace<TRoutes extends Routes> = {
1051
1056
  <TSource extends RoutesName<TRoutes>>(name: TSource, ...args: RouterReplaceArgs<TRoutes, TSource>): Promise<void>;
1052
- (url: Url, options?: RouterReplaceOptions): Promise<void>;
1053
1057
  (route: ResolvedRoute, options?: RouterReplaceOptions): Promise<void>;
1058
+ (url: Url, options?: RouterReplaceOptions): Promise<void>;
1054
1059
  };
1055
1060
 
1056
1061
  declare type RouterReplaceArgs<TRoutes extends Routes, TSource extends RoutesName<TRoutes>> = AllPropertiesAreOptional<RouteParamsByKey<TRoutes, TSource>> extends true ? [params?: RouteParamsByKey<TRoutes, TSource>, options?: RouterReplaceOptions<RouteStateByName<TRoutes, TSource>>] : [params: RouteParamsByKey<TRoutes, TSource>, options?: RouterReplaceOptions<RouteStateByName<TRoutes, TSource>>];
@@ -1071,7 +1076,7 @@ declare type RouterResolveOptions<TState = unknown> = {
1071
1076
  state?: Partial<TState>;
1072
1077
  };
1073
1078
 
1074
- declare type RouterRoute<TRoute extends ResolvedRoute = ResolvedRoute> = {
1079
+ export declare type RouterRoute<TRoute extends ResolvedRoute = ResolvedRoute> = {
1075
1080
  readonly id: TRoute['id'];
1076
1081
  readonly name: TRoute['name'];
1077
1082
  readonly matched: TRoute['matched'];
@@ -1099,7 +1104,7 @@ export declare const RouterView: __VLS_WithTemplateSlots<DefineComponent< {
1099
1104
  name?: string;
1100
1105
  }, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{
1101
1106
  name?: string;
1102
- }> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>, Readonly<{
1107
+ } & {}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}>, Readonly<{
1103
1108
  default?: (props: {
1104
1109
  route: RouterRoute;
1105
1110
  component: Component;
@@ -1138,7 +1143,7 @@ declare type RouteWithMatch<TRoute extends RouterRoute, TRouteName extends TRout
1138
1143
 
1139
1144
  declare type StringHasValue<T> = string extends T ? true : '' extends T ? false : T extends string ? true : false;
1140
1145
 
1141
- declare type ToCallback = (resolve: RegisteredRouter['resolve']) => ResolvedRoute | Url | undefined;
1146
+ export declare type ToCallback = (resolve: RegisteredRouter['resolve']) => ResolvedRoute | Url | undefined;
1142
1147
 
1143
1148
  declare type ToHash<T extends string | Hash | undefined> = T extends string ? Hash<T> : T extends undefined ? Hash<''> : unknown extends T ? Hash<''> : T;
1144
1149