@kitbag/router 0.20.5 → 0.20.7

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.
Files changed (203) hide show
  1. package/dist/components/echo.d.ts +6 -0
  2. package/dist/components/helloWorld.d.ts +2 -0
  3. package/dist/components/rejection.d.ts +2 -0
  4. package/dist/components/routerLink.browser.spec.d.ts +1 -0
  5. package/dist/components/routerLink.d.ts +36 -0
  6. package/dist/components/routerView.browser.spec.d.ts +1 -0
  7. package/dist/components/routerView.d.ts +20 -0
  8. package/dist/components/routerView.spec.d.ts +1 -0
  9. package/dist/compositions/useComponentsStore.d.ts +5 -0
  10. package/dist/compositions/useEventListener.d.ts +2 -0
  11. package/dist/compositions/useLink.d.ts +16 -0
  12. package/dist/compositions/usePrefetching.d.ts +14 -0
  13. package/dist/compositions/usePropStore.d.ts +7 -0
  14. package/dist/compositions/useQueryValue.browser.spec.d.ts +1 -0
  15. package/dist/compositions/useQueryValue.d.ts +15 -0
  16. package/dist/compositions/useRejection.d.ts +7 -0
  17. package/dist/compositions/useRoute.browser.spec.d.ts +1 -0
  18. package/dist/compositions/useRoute.d.ts +16 -0
  19. package/dist/compositions/useRouter.d.ts +3 -0
  20. package/dist/compositions/useRouterDepth.d.ts +8 -0
  21. package/dist/compositions/useRouterHooks.d.ts +4 -0
  22. package/dist/compositions/useVisibilityObserver.d.ts +8 -0
  23. package/dist/errors/callbackContextAbortError.d.ts +5 -0
  24. package/dist/errors/callbackContextPushError.d.ts +5 -0
  25. package/dist/errors/callbackContextRejectionError.d.ts +6 -0
  26. package/dist/errors/duplicateNamesError.d.ts +11 -0
  27. package/dist/errors/duplicateParamsError.d.ts +13 -0
  28. package/dist/errors/initialRouteMissingError.d.ts +3 -0
  29. package/dist/errors/invalidRouteParamValueError.d.ts +2 -0
  30. package/dist/errors/metaPropertyConflict.d.ts +8 -0
  31. package/dist/errors/routeNotFoundError.d.ts +6 -0
  32. package/dist/errors/routerNotInstalledError.d.ts +7 -0
  33. package/dist/errors/useRouteInvalidError.d.ts +13 -0
  34. package/dist/guards/routes.d.ts +46 -0
  35. package/dist/guards/routes.spec-d.d.ts +1 -0
  36. package/dist/keys.d.ts +3 -0
  37. package/dist/kitbag-router.d.ts +2 -1433
  38. package/dist/kitbag-router.js +1751 -1675
  39. package/dist/kitbag-router.umd.cjs +3 -3
  40. package/dist/main.d.ts +302 -0
  41. package/dist/models/RouteHooks.d.ts +9 -0
  42. package/dist/models/RouterRouteHooks.d.ts +10 -0
  43. package/dist/services/arrayOf.d.ts +7 -0
  44. package/dist/services/arrayOf.spec.d.ts +1 -0
  45. package/dist/services/combineHash.d.ts +4 -0
  46. package/dist/services/combineHash.spec.d.ts +1 -0
  47. package/dist/services/combineMeta.d.ts +2 -0
  48. package/dist/services/combineMeta.spec.d.ts +1 -0
  49. package/dist/services/combinePath.d.ts +12 -0
  50. package/dist/services/combinePath.spec-d.d.ts +1 -0
  51. package/dist/services/combinePath.spec.d.ts +1 -0
  52. package/dist/services/combineQuery.d.ts +13 -0
  53. package/dist/services/combineQuery.spec.d.ts +1 -0
  54. package/dist/services/combineState.d.ts +3 -0
  55. package/dist/services/combineState.spec.d.ts +1 -0
  56. package/dist/services/component.browser.spec.d.ts +1 -0
  57. package/dist/services/component.d.ts +12 -0
  58. package/dist/services/createCallbackContext.d.ts +38 -0
  59. package/dist/services/createComponentHooks.d.ts +11 -0
  60. package/dist/services/createComponentsStore.d.ts +7 -0
  61. package/dist/services/createCurrentRoute.d.ts +13 -0
  62. package/dist/services/createExternalRoute.d.ts +3 -0
  63. package/dist/services/createExternalRoute.spec.d.ts +1 -0
  64. package/dist/services/createIsExternal.d.ts +1 -0
  65. package/dist/services/createIsExternal.spec.d.ts +1 -0
  66. package/dist/services/createParam.d.ts +6 -0
  67. package/dist/services/createPropStore.d.ts +13 -0
  68. package/dist/services/createResolvedRoute.d.ts +4 -0
  69. package/dist/services/createResolvedRouteForUrl.browser.spec.d.ts +1 -0
  70. package/dist/services/createResolvedRouteForUrl.d.ts +3 -0
  71. package/dist/services/createResolvedRouteQuery.d.ts +5 -0
  72. package/dist/services/createRoute.d.ts +4 -0
  73. package/dist/services/createRoute.spec-d.d.ts +1 -0
  74. package/dist/services/createRoute.spec.d.ts +1 -0
  75. package/dist/services/createRouteId.d.ts +1 -0
  76. package/dist/services/createRouter.browser.spec.d.ts +1 -0
  77. package/dist/services/createRouter.d.ts +28 -0
  78. package/dist/services/createRouter.spec-d.d.ts +1 -0
  79. package/dist/services/createRouter.spec.d.ts +1 -0
  80. package/dist/services/createRouterAssets.d.ts +118 -0
  81. package/dist/services/createRouterHistory.browser.spec.d.ts +1 -0
  82. package/dist/services/createRouterHistory.d.ts +20 -0
  83. package/dist/services/createRouterHooks.d.ts +20 -0
  84. package/dist/services/createRouterKeyStore.d.ts +3 -0
  85. package/dist/services/createRouterPlugin.browser.spec.d.ts +1 -0
  86. package/dist/services/createRouterPlugin.d.ts +4 -0
  87. package/dist/services/createRouterReject.d.ts +16 -0
  88. package/dist/services/createRouterRoute.d.ts +7 -0
  89. package/dist/services/createRouterRoute.spec.d.ts +1 -0
  90. package/dist/services/createUniqueIdSequence.d.ts +2 -0
  91. package/dist/services/createVisibilityObserver.d.ts +7 -0
  92. package/dist/services/createVueAppStore.d.ts +8 -0
  93. package/dist/services/getGlobalHooksForRouter.d.ts +4 -0
  94. package/dist/services/getGlobalRouteHooks.d.ts +5 -0
  95. package/dist/services/getInitialUrl.browser.spec.d.ts +1 -0
  96. package/dist/services/getInitialUrl.d.ts +1 -0
  97. package/dist/services/getInitialUrl.spec.d.ts +1 -0
  98. package/dist/services/getMatchesForUrl.d.ts +2 -0
  99. package/dist/services/getMatchesForUrl.spec.d.ts +1 -0
  100. package/dist/services/getParamsForString.d.ts +2 -0
  101. package/dist/services/getRouteHooks.d.ts +4 -0
  102. package/dist/services/getRouteHooks.spec.d.ts +1 -0
  103. package/dist/services/getRoutesForRouter.d.ts +9 -0
  104. package/dist/services/getRoutesForRouter.spec.d.ts +1 -0
  105. package/dist/services/hooks.browser.spec.d.ts +1 -0
  106. package/dist/services/hooks.d.ts +8 -0
  107. package/dist/services/hooks.spec.d.ts +1 -0
  108. package/dist/services/insertBaseRoute.d.ts +2 -0
  109. package/dist/services/insertBaseRoute.spec.d.ts +1 -0
  110. package/dist/services/paramValidation.d.ts +4 -0
  111. package/dist/services/paramValidation.spec.d.ts +1 -0
  112. package/dist/services/params.d.ts +7 -0
  113. package/dist/services/params.spec.d.ts +1 -0
  114. package/dist/services/paramsFinder.d.ts +3 -0
  115. package/dist/services/paramsFinder.spec.d.ts +1 -0
  116. package/dist/services/routeMatchRules.d.ts +5 -0
  117. package/dist/services/routeMatchRules.spec.d.ts +1 -0
  118. package/dist/services/routeMatchScore.d.ts +7 -0
  119. package/dist/services/routeMatchScore.spec.d.ts +1 -0
  120. package/dist/services/routeRegex.d.ts +18 -0
  121. package/dist/services/routeRegex.spec.d.ts +1 -0
  122. package/dist/services/state.d.ts +9 -0
  123. package/dist/services/state.spec.d.ts +1 -0
  124. package/dist/services/tupleOf.d.ts +10 -0
  125. package/dist/services/tupleOf.spec.d.ts +1 -0
  126. package/dist/services/unionOf.d.ts +3 -0
  127. package/dist/services/unionOf.spec.d.ts +1 -0
  128. package/dist/services/urlAssembly.d.ts +10 -0
  129. package/dist/services/urlAssembly.spec.d.ts +1 -0
  130. package/dist/services/urlCombine.d.ts +2 -0
  131. package/dist/services/urlCombine.spec.d.ts +1 -0
  132. package/dist/services/urlCreator.d.ts +2 -0
  133. package/dist/services/urlCreator.spec.d.ts +1 -0
  134. package/dist/services/urlParser.d.ts +2 -0
  135. package/dist/services/urlParser.spec.d.ts +1 -0
  136. package/dist/services/valibot.d.ts +7 -0
  137. package/dist/services/valibot.spec-d.d.ts +1 -0
  138. package/dist/services/valibot.spec.d.ts +1 -0
  139. package/dist/services/withDefault.d.ts +5 -0
  140. package/dist/services/withParams.d.ts +15 -0
  141. package/dist/services/withParams.spec-d.d.ts +1 -0
  142. package/dist/services/withParams.spec.d.ts +1 -0
  143. package/dist/services/zod.d.ts +11 -0
  144. package/dist/services/zod.spec-d.d.ts +1 -0
  145. package/dist/services/zod.spec.d.ts +1 -0
  146. package/dist/tests/hooks.spec.d.ts +1 -0
  147. package/dist/tests/routeProps.browser.spec.d.ts +1 -0
  148. package/dist/tests/routeProps.spec.d.ts +1 -0
  149. package/dist/types/createRouteOptions.d.ts +120 -0
  150. package/dist/types/hooks.d.ts +111 -0
  151. package/dist/types/meta.d.ts +2 -0
  152. package/dist/types/name.d.ts +2 -0
  153. package/dist/types/paramTypes.d.ts +14 -0
  154. package/dist/types/params.d.ts +71 -0
  155. package/dist/types/prefetch.d.ts +27 -0
  156. package/dist/types/props.d.ts +23 -0
  157. package/dist/types/querySource.d.ts +1 -0
  158. package/dist/types/register.d.ts +57 -0
  159. package/dist/types/register.spec.d.ts +1 -0
  160. package/dist/types/resolved.d.ts +47 -0
  161. package/dist/types/resolved.spec-d.d.ts +1 -0
  162. package/dist/types/route.d.ts +76 -0
  163. package/dist/types/route.spec-d.d.ts +1 -0
  164. package/dist/types/routeMatchRule.d.ts +2 -0
  165. package/dist/types/routeUpdate.d.ts +9 -0
  166. package/dist/types/routeWithParams.d.ts +5 -0
  167. package/dist/types/routeWithParams.spec-d.d.ts +1 -0
  168. package/dist/types/router.d.ts +185 -0
  169. package/dist/types/routerLink.d.ts +16 -0
  170. package/dist/types/routerPlugin.d.ts +18 -0
  171. package/dist/types/routerPush.d.ts +33 -0
  172. package/dist/types/routerReject.d.ts +3 -0
  173. package/dist/types/routerReplace.d.ts +20 -0
  174. package/dist/types/routerResolve.d.ts +15 -0
  175. package/dist/types/routerRoute.d.ts +16 -0
  176. package/dist/types/routesMap.d.ts +9 -0
  177. package/dist/types/routesMap.spec-ts.d.ts +1 -0
  178. package/dist/types/state.d.ts +18 -0
  179. package/dist/types/url.d.ts +23 -0
  180. package/dist/types/useLink.d.ts +51 -0
  181. package/dist/types/utilities.d.ts +22 -0
  182. package/dist/utilities/array.d.ts +2 -0
  183. package/dist/utilities/checkDuplicateKeys.d.ts +1 -0
  184. package/dist/utilities/checkDuplicateKeys.spec.d.ts +1 -0
  185. package/dist/utilities/checkDuplicateNames.d.ts +2 -0
  186. package/dist/utilities/checkDuplicateNames.spec.d.ts +1 -0
  187. package/dist/utilities/components.d.ts +6 -0
  188. package/dist/utilities/components.spec.d.ts +1 -0
  189. package/dist/utilities/guards.d.ts +5 -0
  190. package/dist/utilities/guards.spec.d.ts +1 -0
  191. package/dist/utilities/index.d.ts +6 -0
  192. package/dist/utilities/isBrowser.browser.spec.d.ts +1 -0
  193. package/dist/utilities/isBrowser.d.ts +1 -0
  194. package/dist/utilities/isBrowser.spec.d.ts +1 -0
  195. package/dist/utilities/makeOptional.d.ts +9 -0
  196. package/dist/utilities/prefetch.d.ts +4 -0
  197. package/dist/utilities/prefetch.spec.d.ts +1 -0
  198. package/dist/utilities/promises.d.ts +1 -0
  199. package/dist/utilities/props.d.ts +6 -0
  200. package/dist/utilities/testHelpers.d.ts +144 -0
  201. package/dist/utilities/urlSearchParams.d.ts +2 -0
  202. package/dist/utilities/urlSearchParams.spec.d.ts +1 -0
  203. package/package.json +11 -11
@@ -0,0 +1,6 @@
1
+ declare const _default: import('vue').DefineSetupFnComponent<{
2
+ value: string;
3
+ }, {}, {}, {
4
+ value: string;
5
+ } & {}, import('vue').PublicProps>;
6
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, never, import('vue').ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import { Component } from 'vue';
2
+ export declare function genericRejection(type: string): Component;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,36 @@
1
+ import { Url } from '../types/url';
2
+ import { ResolvedRoute } from '../types/resolved';
3
+ import { EmitsOptions, InjectionKey, SlotsType, VNode } from 'vue';
4
+ import { Router } from '../types/router';
5
+ import { RouterLinkProps, ToCallback } from '../types/routerLink';
6
+ type RouterLinkSlots = {
7
+ default?: (props: {
8
+ route: ResolvedRoute | undefined;
9
+ isMatch: boolean;
10
+ isExactMatch: boolean;
11
+ isActive: boolean;
12
+ isExactActive: boolean;
13
+ isExternal: boolean;
14
+ }) => VNode[];
15
+ };
16
+ export declare function createRouterLink<TRouter extends Router>(routerKey: InjectionKey<TRouter>): import('vue').DefineSetupFnComponent<RouterLinkProps<TRouter>, EmitsOptions, SlotsType<RouterLinkSlots>, import('../main').RouterPushOptions & {
17
+ to: Url | Readonly<{
18
+ id: string;
19
+ matched: import('../main').CreatedRouteOptions;
20
+ matches: import('../main').CreatedRouteOptions[];
21
+ name: string;
22
+ query: URLSearchParams;
23
+ hash: string;
24
+ params: {
25
+ [x: string]: unknown;
26
+ };
27
+ state: import('../types/state').ExtractRouteStateParamsAsOptional<Record<string, import('../main').Param>>;
28
+ href: Url;
29
+ }> | ToCallback<TRouter>;
30
+ prefetch?: import('../main').PrefetchConfig;
31
+ } & ({
32
+ [x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
33
+ } | {
34
+ [x: `on${Capitalize<string>}`]: ((...args: never) => any) | undefined;
35
+ }), import('vue').PublicProps>;
36
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ import { RouterRejection } from '../services/createRouterReject';
2
+ import { RouterRoute } from '../types/routerRoute';
3
+ import { Router } from '../types/router';
4
+ import { Component, EmitsOptions, InjectionKey, SlotsType, UnwrapRef, VNode } from 'vue';
5
+ export type RouterViewProps = {
6
+ name?: string;
7
+ };
8
+ type RouterViewSlots = {
9
+ default?: (props: {
10
+ route: RouterRoute;
11
+ component: Component;
12
+ rejection: UnwrapRef<RouterRejection>;
13
+ }) => VNode;
14
+ };
15
+ export declare function createRouterView<TRouter extends Router>(routerKey: InjectionKey<TRouter>): import('vue').DefineSetupFnComponent<RouterViewProps, EmitsOptions, SlotsType<RouterViewSlots>, RouterViewProps & ({
16
+ [x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
17
+ } | {
18
+ [x: `on${Capitalize<string>}`]: ((...args: never) => any) | undefined;
19
+ }), import('vue').PublicProps>;
20
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { InjectionKey } from 'vue';
2
+ import { ComponentsStore } from '../services/createComponentsStore';
3
+ import { Router } from '../types/router';
4
+ export declare const getComponentsStoreKey: (routerKey: InjectionKey<Router>) => InjectionKey<ComponentsStore>;
5
+ export declare function createUseComponentsStore<TRouter extends Router>(routerKey: InjectionKey<TRouter>): () => ComponentsStore;
@@ -0,0 +1,2 @@
1
+ import { Ref } from 'vue';
2
+ export declare function useEventListener<K extends keyof HTMLElementEventMap>(element: Ref<HTMLElement | undefined>, event: K, handler: (event: HTMLElementEventMap[K]) => void): void;
@@ -0,0 +1,16 @@
1
+ import { InjectionKey, MaybeRefOrGetter } from 'vue';
2
+ import { ResolvedRoute } from '../types/resolved';
3
+ import { RouteParamsByKey } from '../types/routeWithParams';
4
+ import { Url } from '../types/url';
5
+ import { AllPropertiesAreOptional } from '../types/utilities';
6
+ import { Router, RouterRouteName, RouterRoutes } from '../types/router';
7
+ import { UseLink, UseLinkOptions } from '../types/useLink';
8
+ type UseLinkArgs<TRouter extends Router, TSource extends RouterRouteName<TRouter>, TParams = RouteParamsByKey<RouterRoutes<TRouter>, TSource>> = AllPropertiesAreOptional<TParams> extends true ? [params?: MaybeRefOrGetter<TParams>, options?: MaybeRefOrGetter<UseLinkOptions>] : [params: MaybeRefOrGetter<TParams>, options?: MaybeRefOrGetter<UseLinkOptions>];
9
+ type UseLinkFunction<TRouter extends Router> = {
10
+ <TRouteKey extends RouterRouteName<TRouter>>(name: MaybeRefOrGetter<TRouteKey>, ...args: UseLinkArgs<TRouter, TRouteKey>): UseLink;
11
+ (url: MaybeRefOrGetter<Url>, options?: MaybeRefOrGetter<UseLinkOptions>): UseLink;
12
+ (resolvedRoute: MaybeRefOrGetter<ResolvedRoute | undefined>, options?: MaybeRefOrGetter<UseLinkOptions>): UseLink;
13
+ (source: MaybeRefOrGetter<string | ResolvedRoute | undefined>, paramsOrOptions?: MaybeRefOrGetter<Record<PropertyKey, unknown> | UseLinkOptions>, maybeOptions?: MaybeRefOrGetter<UseLinkOptions>): UseLink;
14
+ };
15
+ export declare function createUseLink<TRouter extends Router>(routerKey: InjectionKey<TRouter>): UseLinkFunction<TRouter>;
16
+ export {};
@@ -0,0 +1,14 @@
1
+ import { InjectionKey, MaybeRefOrGetter, Ref } from 'vue';
2
+ import { PrefetchConfigs } from '../types/prefetch';
3
+ import { ResolvedRoute } from '../types/resolved';
4
+ import { Router } from '../types/router';
5
+ type UsePrefetchingConfig = PrefetchConfigs & {
6
+ route: ResolvedRoute | undefined;
7
+ };
8
+ type UsePrefetching = {
9
+ element: Ref<HTMLElement | undefined>;
10
+ commit: () => void;
11
+ };
12
+ type UsePrefetchingFunction = (config: MaybeRefOrGetter<UsePrefetchingConfig>) => UsePrefetching;
13
+ export declare function createUsePrefetching<TRouter extends Router>(routerKey: InjectionKey<TRouter>): UsePrefetchingFunction;
14
+ export {};
@@ -0,0 +1,7 @@
1
+ import { InjectionKey } from 'vue';
2
+ import { PropStore } from '../services/createPropStore';
3
+ import { Router } from '../types/router';
4
+ export declare const getPropStoreInjectionKey: (routerKey: InjectionKey<Router>) => InjectionKey<PropStore>;
5
+ type UsePropStore = () => PropStore;
6
+ export declare function createUsePropStore<TRouter extends Router>(routerKey: InjectionKey<TRouter>): UsePropStore;
7
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ import { Ref, MaybeRefOrGetter, InjectionKey } from 'vue';
2
+ import { Router } from '../types/router';
3
+ import { Param } from '../types/paramTypes';
4
+ import { ExtractParamType } from '../types/params';
5
+ export type UseQueryValue<T> = {
6
+ value: Ref<T | null>;
7
+ values: Ref<T[]>;
8
+ remove: () => void;
9
+ };
10
+ type UseQueryValueFunction = {
11
+ (key: MaybeRefOrGetter<string>): UseQueryValue<string>;
12
+ <TParam extends Param>(key: MaybeRefOrGetter<string>, param: TParam): UseQueryValue<ExtractParamType<TParam>>;
13
+ };
14
+ export declare function createUseQueryValue<TRouter extends Router>(key: InjectionKey<TRouter>): UseQueryValueFunction;
15
+ export {};
@@ -0,0 +1,7 @@
1
+ import { InjectionKey } from 'vue';
2
+ import { RouterRejection } from '../services/createRouterReject';
3
+ import { Router } from '../types/router';
4
+ export declare const getRouterRejectionInjectionKey: (routerKey: InjectionKey<Router>) => InjectionKey<RouterRejection>;
5
+ type UseRejectionFunction = () => RouterRejection;
6
+ export declare function createUseRejection(routerKey: InjectionKey<Router>): UseRejectionFunction;
7
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ import { InjectionKey } from 'vue';
2
+ import { IsRouteOptions } from '../guards/routes';
3
+ import { Router, RouterRouteName } from '../types/router';
4
+ type UseRouteFunction<TRouter extends Router> = {
5
+ (): TRouter['route'];
6
+ <TRouteName extends RouterRouteName<TRouter>>(routeName: TRouteName, options: IsRouteOptions & {
7
+ exact: true;
8
+ }): TRouter['route'] & {
9
+ name: TRouteName;
10
+ };
11
+ <TRouteName extends RouterRouteName<TRouter>>(routeName: TRouteName, options?: IsRouteOptions): TRouter['route'] & {
12
+ name: `${TRouteName}${string}`;
13
+ };
14
+ };
15
+ export declare function createUseRoute<TRouter extends Router>(routerKey: InjectionKey<TRouter>): UseRouteFunction<TRouter>;
16
+ export {};
@@ -0,0 +1,3 @@
1
+ import { InjectionKey } from 'vue';
2
+ import { Router } from '../types/router';
3
+ export declare function createUseRouter<TRouter extends Router>(routerKey: InjectionKey<TRouter>): () => TRouter;
@@ -0,0 +1,8 @@
1
+ import { InjectionKey } from 'vue';
2
+ import { Router } from '../types/router';
3
+ type UseRouterDepthProps = {
4
+ increment?: boolean;
5
+ };
6
+ type UseRouterDepthFunction = (props?: UseRouterDepthProps) => number;
7
+ export declare function createUseRouterDepth<TRouter extends Router>(routerKey: InjectionKey<TRouter>): UseRouterDepthFunction;
8
+ export {};
@@ -0,0 +1,4 @@
1
+ import { RouterHooks } from '../services/createRouterHooks';
2
+ import { Router, RouterRoutes } from '../types/router';
3
+ import { InjectionKey } from 'vue';
4
+ export declare function createUseRouterHooks<TRouter extends Router>(routerKey: InjectionKey<TRouter>): () => RouterHooks<RouterRoutes<TRouter>>;
@@ -0,0 +1,8 @@
1
+ import { VisibilityObserver } from '../services/createVisibilityObserver';
2
+ import { InjectionKey, Ref } from 'vue';
3
+ type UseVisibilityObserver = {
4
+ isElementVisible: Ref<boolean>;
5
+ };
6
+ export declare const visibilityObserverKey: InjectionKey<VisibilityObserver>;
7
+ export declare function useVisibilityObserver(element: Ref<Element | undefined>): UseVisibilityObserver;
8
+ export {};
@@ -0,0 +1,5 @@
1
+ import { CallbackAbortResponse } from '../services/createCallbackContext';
2
+ export declare class CallbackContextAbortError extends Error {
3
+ response: CallbackAbortResponse;
4
+ constructor();
5
+ }
@@ -0,0 +1,5 @@
1
+ import { CallbackPushResponse } from '../services/createCallbackContext';
2
+ export declare class CallbackContextPushError extends Error {
3
+ response: CallbackPushResponse;
4
+ constructor(to: unknown[]);
5
+ }
@@ -0,0 +1,6 @@
1
+ import { RegisteredRejectionType } from '../types/register';
2
+ import { CallbackRejectResponse } from '../services/createCallbackContext';
3
+ export declare class CallbackContextRejectionError extends Error {
4
+ response: CallbackRejectResponse;
5
+ constructor(type: RegisteredRejectionType);
6
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * An error thrown when duplicate names are detected in a route.
3
+ * Names must be unique.
4
+ */
5
+ export declare class DuplicateNamesError extends Error {
6
+ /**
7
+ * Constructs a new DuplicateNamesError instance with a message indicating the problematic name.
8
+ * @param name - The name of the name that was duplicated.
9
+ */
10
+ constructor(name: string);
11
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * An error thrown when duplicate parameters are detected in a route.
3
+ * Param names must be unique. This includes params defined in a path
4
+ * parent and params defined in the query.
5
+ * @group Errors
6
+ */
7
+ export declare class DuplicateParamsError extends Error {
8
+ /**
9
+ * Constructs a new DuplicateParamsError instance with a message indicating the problematic parameter.
10
+ * @param paramName - The name of the parameter that was duplicated.
11
+ */
12
+ constructor(paramName: string);
13
+ }
@@ -0,0 +1,3 @@
1
+ export declare class InitialRouteMissingError extends Error {
2
+ constructor();
3
+ }
@@ -0,0 +1,2 @@
1
+ export declare class InvalidRouteParamValueError extends Error {
2
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * An error thrown when a parent's meta has the same key as a child and the types are not compatible.
3
+ * A child's meta can override properties of the parent, however the types must match!
4
+ * @group Errors
5
+ */
6
+ export declare class MetaPropertyConflict extends Error {
7
+ constructor(property?: string);
8
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * An error thrown when attempting to resolve a route that does not exist
3
+ */
4
+ export declare class RouteNotFoundError extends Error {
5
+ constructor(source: string);
6
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * An error thrown when an attempt is made to use routing functionality before the router has been installed.
3
+ * @group Errors
4
+ */
5
+ export declare class RouterNotInstalledError extends Error {
6
+ constructor();
7
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * An error thrown when there is a mismatch between an expected route and the one actually used.
3
+ * @group Errors
4
+ */
5
+ export declare class UseRouteInvalidError extends Error {
6
+ /**
7
+ * Constructs a new UseRouteInvalidError instance with a message that specifies both the given and expected route names.
8
+ * This detailed error message aids in quickly identifying and resolving mismatches in route usage.
9
+ * @param routeName - The route name that was incorrectly used.
10
+ * @param actualRouteName - The expected route name that should have been used.
11
+ */
12
+ constructor(routeName: string, actualRouteName: string);
13
+ }
@@ -0,0 +1,46 @@
1
+ import { RouterRoute } from '../types/routerRoute';
2
+ import { Router, RouterRouteName } from '../types/router';
3
+ import { InjectionKey } from 'vue';
4
+ export type IsRouteOptions = {
5
+ exact?: boolean;
6
+ };
7
+ type RouteWithMatch<TRoute extends RouterRoute, TRouteName extends TRoute['name']> = TRoute extends RouterRoute ? TRouteName extends TRoute['matches'][number]['name'] ? TRoute : never : never;
8
+ type IsRouteFunction<TRouter extends Router> = {
9
+ /**
10
+ * A type guard for determining if a value is a valid RouterRoute.
11
+ * @param route - The value to check.
12
+ * @returns `true` if the value is a valid RouterRoute, otherwise `false`.
13
+ * @group Type Guards
14
+ */
15
+ (route: unknown): route is RouterRoute;
16
+ /**
17
+ * A type guard for determining if a value is a valid RouterRoute with an exact match.
18
+ * @param route - The value to check.
19
+ * @param routeName - The expected route name.
20
+ * @returns `true` if the value is a valid RouterRoute with an exact match, otherwise `false`.
21
+ * @group Type Guards
22
+ */
23
+ <TRoute extends TRouter['route'], TRouteName extends RouterRouteName<TRouter>>(route: TRoute, routeName: TRouteName, options: IsRouteOptions & {
24
+ exact: true;
25
+ }): route is TRoute & {
26
+ name: TRouteName;
27
+ };
28
+ /**
29
+ * A type guard for determining if a value is a valid RouterRoute with a partial match.
30
+ * @param route - The value to check.
31
+ * @param routeName - The expected route name.
32
+ * @returns `true` if the value is a valid RouterRoute with a partial match, otherwise `false`.
33
+ * @group Type Guards
34
+ */
35
+ <TRoute extends TRouter['route'], TRouteName extends TRoute['name']>(route: TRoute, routeName: TRouteName, options?: IsRouteOptions): route is RouteWithMatch<TRoute, TRouteName>;
36
+ /**
37
+ * A type guard for determining if a value is a valid RouterRoute.
38
+ * @param route - The value to check.
39
+ * @param routeName - The expected route name.
40
+ * @returns `true` if the value is a valid RouterRoute, otherwise `false`.
41
+ * @group Type Guards
42
+ */
43
+ (route: unknown, routeName?: string, options?: IsRouteOptions): boolean;
44
+ };
45
+ export declare function createIsRoute<TRouter extends Router>(routerKey: InjectionKey<TRouter>): IsRouteFunction<TRouter>;
46
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/dist/keys.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { InjectionKey } from 'vue';
2
+ import { RegisteredRouter } from './types/register';
3
+ export declare const routerInjectionKey: InjectionKey<RegisteredRouter>;