@kitbag/router 0.24.2 → 0.24.3
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 +1 -0
- package/dist/kitbag-router.js +6 -6
- package/dist/kitbag-router.umd.cjs +2 -2
- package/dist/src/components/routerLink.d.ts +4 -4
- package/dist/src/components/routerView.d.ts +3 -3
- package/dist/src/compositions/useComponentsStore.d.ts +2 -2
- package/dist/src/compositions/useLink.d.ts +6 -6
- package/dist/src/compositions/usePrefetching.d.ts +3 -3
- package/dist/src/compositions/usePropStore.d.ts +2 -2
- package/dist/src/compositions/useQueryValue.d.ts +3 -3
- package/dist/src/compositions/useRejection.d.ts +2 -2
- package/dist/src/compositions/useRoute.d.ts +2 -2
- package/dist/src/compositions/useRouter.d.ts +1 -1
- package/dist/src/compositions/useRouterDepth.d.ts +1 -1
- package/dist/src/compositions/useRouterHooks.d.ts +2 -2
- package/dist/src/compositions/useVisibilityObserver.d.ts +1 -1
- package/dist/src/devtools/createRouterDevtools.d.ts +2 -2
- package/dist/src/devtools/filters.d.ts +1 -1
- package/dist/src/errors/contextAbortError.d.ts +1 -1
- package/dist/src/errors/contextPushError.d.ts +1 -1
- package/dist/src/errors/contextRejectionError.d.ts +1 -1
- package/dist/src/errors/invalidRouteParamValueError.d.ts +1 -1
- package/dist/src/guards/routes.d.ts +2 -2
- package/dist/src/main.d.ts +2 -2
- package/dist/src/models/hooks.d.ts +2 -2
- package/dist/src/services/arrayOf.d.ts +2 -2
- package/dist/src/services/combineHash.d.ts +2 -2
- package/dist/src/services/combinePath.d.ts +2 -2
- package/dist/src/services/combineQuery.d.ts +2 -2
- package/dist/src/services/combineState.d.ts +1 -1
- package/dist/src/services/combineUrl.d.ts +2 -2
- package/dist/src/services/component.d.ts +2 -2
- package/dist/src/services/createComponentHooks.d.ts +4 -4
- package/dist/src/services/createComponentsStore.d.ts +2 -2
- package/dist/src/services/createCurrentRejection.d.ts +2 -2
- package/dist/src/services/createCurrentRoute.d.ts +4 -4
- package/dist/src/services/createExternalRoute.d.ts +4 -4
- package/dist/src/services/createParam.d.ts +3 -3
- package/dist/src/services/createPropStore.d.ts +3 -3
- package/dist/src/services/createRejection.d.ts +3 -3
- package/dist/src/services/createRejectionHooks.d.ts +3 -3
- package/dist/src/services/createResolvedRoute.d.ts +3 -3
- package/dist/src/services/createResolvedRouteQuery.d.ts +1 -1
- package/dist/src/services/createRoute.d.ts +5 -5
- package/dist/src/services/createRouteHooks.d.ts +5 -5
- package/dist/src/services/createRouteRedirects.d.ts +2 -2
- package/dist/src/services/createRouter.d.ts +3 -3
- package/dist/src/services/createRouterAssets.d.ts +10 -10
- package/dist/src/services/createRouterCallbackContext.d.ts +7 -7
- package/dist/src/services/createRouterHistory.d.ts +1 -1
- package/dist/src/services/createRouterHooks.d.ts +2 -2
- package/dist/src/services/createRouterKeyStore.d.ts +1 -1
- package/dist/src/services/createRouterPlugin.d.ts +3 -3
- package/dist/src/services/createRouterRoute.d.ts +4 -4
- package/dist/src/services/createUrl.d.ts +1 -1
- package/dist/src/services/getGlobalHooksForRouter.d.ts +2 -2
- package/dist/src/services/getGlobalRouteHooks.d.ts +2 -2
- package/dist/src/services/getMatchesForUrl.d.ts +3 -3
- package/dist/src/services/getParamsForString.d.ts +2 -2
- package/dist/src/services/getRejectionHooks.d.ts +2 -2
- package/dist/src/services/getRouteHooks.d.ts +2 -2
- package/dist/src/services/getRoutesForRouter.d.ts +6 -6
- package/dist/src/services/hooks.d.ts +2 -2
- package/dist/src/services/insertBaseRoute.d.ts +1 -1
- package/dist/src/services/literal.d.ts +1 -1
- package/dist/src/services/params.d.ts +3 -3
- package/dist/src/services/queryParamFilter.d.ts +1 -1
- package/dist/src/services/routeRegex.d.ts +1 -1
- package/dist/src/services/state.d.ts +1 -1
- package/dist/src/services/tupleOf.d.ts +2 -2
- package/dist/src/services/unionOf.d.ts +2 -2
- package/dist/src/services/urlParser.d.ts +2 -2
- package/dist/src/services/valibot.d.ts +1 -1
- package/dist/src/services/withDefault.d.ts +2 -2
- package/dist/src/services/withParams.d.ts +4 -4
- package/dist/src/services/zod.d.ts +2 -2
- package/dist/src/types/createRouteOptions.d.ts +17 -17
- package/dist/src/types/hooks.d.ts +12 -12
- package/dist/src/types/paramTypes.d.ts +2 -2
- package/dist/src/types/params.d.ts +1 -1
- package/dist/src/types/props.d.ts +2 -2
- package/dist/src/types/register.d.ts +1 -1
- package/dist/src/types/rejection.d.ts +4 -4
- package/dist/src/types/resolved.d.ts +4 -4
- package/dist/src/types/route.d.ts +9 -9
- package/dist/src/types/routeTitle.d.ts +1 -1
- package/dist/src/types/routeUpdate.d.ts +2 -2
- package/dist/src/types/routeWithParams.d.ts +3 -3
- package/dist/src/types/router.d.ts +13 -13
- package/dist/src/types/routerLink.d.ts +5 -5
- package/dist/src/types/routerPlugin.d.ts +2 -2
- package/dist/src/types/routerPush.d.ts +8 -8
- package/dist/src/types/routerReject.d.ts +1 -1
- package/dist/src/types/routerReplace.d.ts +8 -8
- package/dist/src/types/routerResolve.d.ts +7 -7
- package/dist/src/types/routerRoute.d.ts +3 -3
- package/dist/src/types/routesMap.d.ts +2 -2
- package/dist/src/types/state.d.ts +6 -6
- package/dist/src/types/url.d.ts +6 -6
- package/dist/src/types/useLink.d.ts +5 -5
- package/dist/src/utilities/checkDuplicateNames.d.ts +1 -1
- package/dist/src/utilities/isNamedRoute.d.ts +1 -1
- package/dist/src/utilities/prefetch.d.ts +1 -1
- package/dist/src/utilities/setDocumentTitle.d.ts +1 -1
- package/dist/src/utilities/urlSearchParams.d.ts +1 -1
- package/package.json +10 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InjectionKey } from 'vue';
|
|
2
|
-
import { ComponentsStore } from '
|
|
3
|
-
import { Router } from '
|
|
2
|
+
import { ComponentsStore } from '../services/createComponentsStore';
|
|
3
|
+
import { Router } from '../types/router';
|
|
4
4
|
export declare const getComponentsStoreKey: (routerKey: InjectionKey<Router>) => InjectionKey<ComponentsStore>;
|
|
5
5
|
export declare function createUseComponentsStore<TRouter extends Router>(routerKey: InjectionKey<TRouter>): () => ComponentsStore;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { InjectionKey, MaybeRefOrGetter } from 'vue';
|
|
2
|
-
import { ResolvedRoute } from '
|
|
3
|
-
import { RouteParamsByKey } from '
|
|
4
|
-
import { UrlString } from '
|
|
5
|
-
import { AllPropertiesAreOptional } from '
|
|
6
|
-
import { Router, RouterRouteName, RouterRoutes } from '
|
|
7
|
-
import { UseLink, UseLinkOptions } from '
|
|
2
|
+
import { ResolvedRoute } from '../types/resolved';
|
|
3
|
+
import { RouteParamsByKey } from '../types/routeWithParams';
|
|
4
|
+
import { UrlString } from '../types/urlString';
|
|
5
|
+
import { AllPropertiesAreOptional } from '../types/utilities';
|
|
6
|
+
import { Router, RouterRouteName, RouterRoutes } from '../types/router';
|
|
7
|
+
import { UseLink, UseLinkOptions } from '../types/useLink';
|
|
8
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
9
|
type UseLinkFunction<TRouter extends Router> = {
|
|
10
10
|
<TRouteKey extends RouterRouteName<TRouter>>(name: MaybeRefOrGetter<TRouteKey>, ...args: UseLinkArgs<TRouter, TRouteKey>): UseLink;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InjectionKey, MaybeRefOrGetter, Ref } from 'vue';
|
|
2
|
-
import { PrefetchConfigs } from '
|
|
3
|
-
import { ResolvedRoute } from '
|
|
4
|
-
import { Router } from '
|
|
2
|
+
import { PrefetchConfigs } from '../types/prefetch';
|
|
3
|
+
import { ResolvedRoute } from '../types/resolved';
|
|
4
|
+
import { Router } from '../types/router';
|
|
5
5
|
type UsePrefetchingConfig = PrefetchConfigs & {
|
|
6
6
|
route: ResolvedRoute | undefined;
|
|
7
7
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InjectionKey } from 'vue';
|
|
2
|
-
import { PropStore } from '
|
|
3
|
-
import { Router } from '
|
|
2
|
+
import { PropStore } from '../services/createPropStore';
|
|
3
|
+
import { Router } from '../types/router';
|
|
4
4
|
export declare const getPropStoreInjectionKey: (routerKey: InjectionKey<Router>) => InjectionKey<PropStore>;
|
|
5
5
|
type UsePropStore = () => PropStore;
|
|
6
6
|
export declare function createUsePropStore<TRouter extends Router>(routerKey: InjectionKey<TRouter>): UsePropStore;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Ref, MaybeRefOrGetter, InjectionKey } from 'vue';
|
|
2
|
-
import { Router } from '
|
|
3
|
-
import { Param, ParamGetSet } from '
|
|
4
|
-
import { ExtractParamType } from '
|
|
2
|
+
import { Router } from '../types/router';
|
|
3
|
+
import { Param, ParamGetSet } from '../types/paramTypes';
|
|
4
|
+
import { ExtractParamType } from '../types/params';
|
|
5
5
|
type UseQueryValue<T> = {
|
|
6
6
|
value: Ref<T>;
|
|
7
7
|
values: Ref<NonNullable<T>[]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InjectionKey } from 'vue';
|
|
2
|
-
import { RouterRejection, RouterRejections } from '
|
|
3
|
-
import { Router } from '
|
|
2
|
+
import { RouterRejection, RouterRejections } from '../types/rejection';
|
|
3
|
+
import { Router } from '../types/router';
|
|
4
4
|
export declare const getRouterRejectionInjectionKey: (routerKey: InjectionKey<Router>) => InjectionKey<RouterRejection>;
|
|
5
5
|
export declare function createUseRejection<TRouter extends Router>(routerKey: InjectionKey<TRouter>): () => RouterRejection<RouterRejections<TRouter>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InjectionKey } from 'vue';
|
|
2
|
-
import { IsRouteOptions, RouteWithMatch } from '
|
|
3
|
-
import { Router, RouterRouteName } from '
|
|
2
|
+
import { IsRouteOptions, RouteWithMatch } from '../guards/routes';
|
|
3
|
+
import { Router, RouterRouteName } from '../types/router';
|
|
4
4
|
type UseRouteFunction<TRouter extends Router> = {
|
|
5
5
|
(): TRouter['route'];
|
|
6
6
|
<const TRouteName extends RouterRouteName<TRouter>>(routeName: TRouteName, options: IsRouteOptions & {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RouterHooks } from '
|
|
2
|
-
import { Router } from '
|
|
1
|
+
import { RouterHooks } from '../services/createRouterHooks';
|
|
2
|
+
import { Router } from '../types/router';
|
|
3
3
|
import { InjectionKey } from 'vue';
|
|
4
4
|
export declare function createUseRouterHooks<TRouter extends Router>(routerKey: InjectionKey<TRouter>): () => RouterHooks;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { App } from 'vue';
|
|
2
|
-
import { Router } from '
|
|
3
|
-
import { Routes } from '
|
|
2
|
+
import { Router } from '../types/router';
|
|
3
|
+
import { Routes } from '../types/route';
|
|
4
4
|
type RouterDevtoolsProps = {
|
|
5
5
|
router: Router;
|
|
6
6
|
app: App;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallbackContextAbort } from '
|
|
1
|
+
import { CallbackContextAbort } from '../types/callbackContext';
|
|
2
2
|
import { ContextError } from './contextError';
|
|
3
3
|
export declare class ContextAbortError extends ContextError {
|
|
4
4
|
response: CallbackContextAbort;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallbackContextPush } from '
|
|
1
|
+
import { CallbackContextPush } from '../types/callbackContext';
|
|
2
2
|
import { ContextError } from './contextError';
|
|
3
3
|
export declare class ContextPushError extends ContextError {
|
|
4
4
|
response: CallbackContextPush;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallbackContextReject } from '
|
|
1
|
+
import { CallbackContextReject } from '../types/callbackContext';
|
|
2
2
|
import { ContextError } from './contextError';
|
|
3
3
|
export declare class ContextRejectionError extends ContextError {
|
|
4
4
|
response: CallbackContextReject;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RouterRoute } from '
|
|
2
|
-
import { Router, RouterRouteName } from '
|
|
1
|
+
import { RouterRoute } from '../types/routerRoute';
|
|
2
|
+
import { Router, RouterRouteName } from '../types/router';
|
|
3
3
|
import { InjectionKey } from 'vue';
|
|
4
4
|
export type IsRouteOptions = {
|
|
5
5
|
exact?: boolean;
|
package/dist/src/main.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RouterAssets } from './services/createRouterAssets';
|
|
2
2
|
import { RegisteredRouter } from './types/register';
|
|
3
|
-
export type { WithHost, WithoutHost, WithParent, WithoutParent, CreateRouteOptions, PropsGetter, RouterViewPropsGetter, CreateRouteProps, ToRoute
|
|
4
|
-
export type { RejectionHooks, HookRemove, BeforeHookLifecycle, AfterHookLifecycle, HookLifecycle, BeforeEnterHookContext, BeforeEnterHook, AddBeforeEnterHook, BeforeUpdateHookContext, BeforeUpdateHook, AddBeforeUpdateHook, BeforeLeaveHookContext, BeforeLeaveHook, AddBeforeLeaveHook, AfterEnterHookContext, AfterEnterHook, AddAfterEnterHook, AfterUpdateHookContext, AfterUpdateHook, AddAfterUpdateHook, AfterLeaveHookContext, AfterLeaveHook, AddAfterLeaveHook, RejectionHookContext, RejectionHook, AddRejectionHook, ErrorHookContext, ErrorHook, AddErrorHook
|
|
3
|
+
export type { WithHost, WithoutHost, WithParent, WithoutParent, CreateRouteOptions, PropsGetter, RouterViewPropsGetter, CreateRouteProps, ToRoute } from './types/createRouteOptions';
|
|
4
|
+
export type { RejectionHooks, HookRemove, BeforeHookLifecycle, AfterHookLifecycle, HookLifecycle, BeforeEnterHookContext, BeforeEnterHook, AddBeforeEnterHook, BeforeUpdateHookContext, BeforeUpdateHook, AddBeforeUpdateHook, BeforeLeaveHookContext, BeforeLeaveHook, AddBeforeLeaveHook, AfterEnterHookContext, AfterEnterHook, AddAfterEnterHook, AfterUpdateHookContext, AfterUpdateHook, AddAfterUpdateHook, AfterLeaveHookContext, AfterLeaveHook, AddAfterLeaveHook, RejectionHookContext, RejectionHook, AddRejectionHook, ErrorHookContext, ErrorHook, AddErrorHook } from './types/hooks';
|
|
5
5
|
export * from './types/paramTypes';
|
|
6
6
|
export * from './types/prefetch';
|
|
7
7
|
export * from './types/props';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AfterEnterHook, AfterLeaveHook, AfterUpdateHook, BeforeEnterHook, BeforeLeaveHook, BeforeUpdateHook, ErrorHook, RejectionHook } from '
|
|
2
|
-
import { RedirectHook } from '
|
|
1
|
+
import { AfterEnterHook, AfterLeaveHook, AfterUpdateHook, BeforeEnterHook, BeforeLeaveHook, BeforeUpdateHook, ErrorHook, RejectionHook } from '../types/hooks';
|
|
2
|
+
import { RedirectHook } from '../types/redirects';
|
|
3
3
|
export declare class Hooks {
|
|
4
4
|
redirects: Set<RedirectHook>;
|
|
5
5
|
onBeforeRouteEnter: Set<BeforeEnterHook>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Param, ParamGetSet } from '
|
|
2
|
-
import { ExtractParamType } from '
|
|
1
|
+
import { Param, ParamGetSet } from '../types/paramTypes';
|
|
2
|
+
import { ExtractParamType } from '../types/params';
|
|
3
3
|
type ArrayOfOptions = {
|
|
4
4
|
separator?: string;
|
|
5
5
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UrlPart } from '
|
|
2
|
-
import { CombinePath } from '
|
|
1
|
+
import { UrlPart } from './withParams';
|
|
2
|
+
import { CombinePath } from './combinePath';
|
|
3
3
|
type CombineHash<TParent extends UrlPart, TChild extends UrlPart> = CombinePath<TParent, TChild>;
|
|
4
4
|
export declare function combineHash<TParentHash extends UrlPart, TChildHash extends UrlPart>(parentHash: TParentHash, childHash: TChildHash): CombineHash<TParentHash, TChildHash>;
|
|
5
5
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ToUrlPart, UrlPart, UrlParams } from '
|
|
2
|
-
import { Identity } from '
|
|
1
|
+
import { ToUrlPart, UrlPart, UrlParams } from './withParams';
|
|
2
|
+
import { Identity } from '../types/utilities';
|
|
3
3
|
export type CombinePath<TParent extends UrlPart, TChild extends UrlPart> = ToUrlPart<TParent> extends {
|
|
4
4
|
params: infer TParentParams extends UrlParams;
|
|
5
5
|
} ? ToUrlPart<TChild> extends {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ToUrlPart, UrlPart, UrlParams } from '
|
|
2
|
-
import { Identity } from '
|
|
1
|
+
import { ToUrlPart, UrlPart, UrlParams } from './withParams';
|
|
2
|
+
import { Identity } from '../types/utilities';
|
|
3
3
|
type CombineQuery<TParent extends UrlPart, TChild extends UrlPart> = ToUrlPart<TParent> extends {
|
|
4
4
|
params: infer TParentParams extends UrlParams;
|
|
5
5
|
} ? ToUrlPart<TChild> extends {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Param } from '
|
|
1
|
+
import { Param } from '../types/paramTypes';
|
|
2
2
|
export type CombineState<TParent extends Record<string, Param>, TChild extends Record<string, Param>> = TParent & TChild;
|
|
3
3
|
export declare function combineState<TParentState extends Record<string, Param>, TChildState extends Record<string, Param>>(parentState: TParentState, childState: TChildState): CombineState<TParentState, TChildState>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CreateUrlOptions, ToUrl, Url } from '
|
|
2
|
-
import { Identity } from '
|
|
1
|
+
import { CreateUrlOptions, ToUrl, Url } from '../types/url';
|
|
2
|
+
import { Identity } from '../types/utilities';
|
|
3
3
|
export type CombineUrl<TParent extends Url, TChild extends Url> = TParent extends Url<infer TParentParams> ? TChild extends Url<infer TChildParams> ? Url<Identity<TParentParams & TChildParams>> : never : never;
|
|
4
4
|
export declare function combineUrl<const TParent extends Url, const TChild extends Url>(parent: TParent, child: TChild): CombineUrl<TParent, TChild>;
|
|
5
5
|
export declare function combineUrl<const TParent extends Url, const TChild extends CreateUrlOptions>(parent: TParent, child: TChild): CombineUrl<TParent, ToUrl<TChild>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AsyncComponentLoader, Component, FunctionalComponent, InjectionKey } from 'vue';
|
|
2
|
-
import { CreatedRouteOptions } from '
|
|
3
|
-
import { Router } from '
|
|
2
|
+
import { CreatedRouteOptions } from '../types/route';
|
|
3
|
+
import { Router } from '../types/router';
|
|
4
4
|
type Constructor = new (...args: any) => any;
|
|
5
5
|
export type ComponentProps<TComponent extends Component> = TComponent extends Constructor ? InstanceType<TComponent>['$props'] : TComponent extends AsyncComponentLoader<infer T extends Component> ? ComponentProps<T> : TComponent extends FunctionalComponent<infer T> ? T : {};
|
|
6
6
|
type CreateComponentWrapperConfig = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { InjectionKey } from 'vue';
|
|
2
|
-
import { AddBeforeUpdateHook, AddBeforeLeaveHook, AddAfterUpdateHook, AddAfterLeaveHook } from '
|
|
3
|
-
import { Routes } from '
|
|
4
|
-
import { Router, RouterRejections, RouterRoutes } from '
|
|
5
|
-
import { Rejections } from '
|
|
2
|
+
import { AddBeforeUpdateHook, AddBeforeLeaveHook, AddAfterUpdateHook, AddAfterLeaveHook } from '../types/hooks';
|
|
3
|
+
import { Routes } from '../types/route';
|
|
4
|
+
import { Router, RouterRejections, RouterRoutes } from '../types/router';
|
|
5
|
+
import { Rejections } from '../types/rejection';
|
|
6
6
|
type ComponentHooks<TRoutes extends Routes, TRejections extends Rejections> = {
|
|
7
7
|
onBeforeRouteLeave: AddBeforeLeaveHook<TRoutes, TRejections>;
|
|
8
8
|
onBeforeRouteUpdate: AddBeforeUpdateHook<TRoutes, TRejections>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component, InjectionKey } from 'vue';
|
|
2
|
-
import { CreatedRouteOptions } from '
|
|
3
|
-
import { Router } from '
|
|
2
|
+
import { CreatedRouteOptions } from '../types/route';
|
|
3
|
+
import { Router } from '../types/router';
|
|
4
4
|
export type ComponentsStore = {
|
|
5
5
|
getRouteComponents: (match: CreatedRouteOptions) => Record<string, Component>;
|
|
6
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Rejection, RouterRejection } from '
|
|
1
|
+
import { Rejection, RouterRejection } from '../types/rejection';
|
|
2
2
|
import { ComputedRef } from 'vue';
|
|
3
|
-
import { ResolvedRoute } from '
|
|
3
|
+
import { ResolvedRoute } from '../types/resolved';
|
|
4
4
|
type RejectionUpdate = (rejection: Rejection) => void;
|
|
5
5
|
type RejectionClear = () => void;
|
|
6
6
|
type CurrentRejectionContext = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { InjectionKey } from 'vue';
|
|
2
|
-
import { Router, RouterRouteUnion } from '
|
|
3
|
-
import { ResolvedRoute } from '
|
|
4
|
-
import { Routes } from '
|
|
5
|
-
import { RouterPush } from '
|
|
2
|
+
import { Router, RouterRouteUnion } from '../types/router';
|
|
3
|
+
import { ResolvedRoute } from '../types/resolved';
|
|
4
|
+
import { Routes } from '../types/route';
|
|
5
|
+
import { RouterPush } from '../types/routerPush';
|
|
6
6
|
type ResolvedRouteUpdate = (route: ResolvedRoute) => void;
|
|
7
7
|
type CurrentRouteContext<TRoutes extends Routes = Routes> = {
|
|
8
8
|
currentRoute: ResolvedRoute;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CreateRouteOptions, ToRoute, WithHost, WithoutHost, WithoutParent, WithParent } from '
|
|
2
|
-
import { ExternalRouteHooks } from '
|
|
3
|
-
import { ExtractRouteContext } from '
|
|
4
|
-
import { RouteRedirects } from '
|
|
1
|
+
import { CreateRouteOptions, ToRoute, WithHost, WithoutHost, WithoutParent, WithParent } from '../types/createRouteOptions';
|
|
2
|
+
import { ExternalRouteHooks } from '../types/hooks';
|
|
3
|
+
import { ExtractRouteContext } from '../types/routeContext';
|
|
4
|
+
import { RouteRedirects } from '../types/redirects';
|
|
5
5
|
export declare function createExternalRoute<const TOptions extends CreateRouteOptions & WithHost & WithoutParent>(options: TOptions): ToRoute<TOptions> & ExternalRouteHooks<ToRoute<TOptions>, TOptions['context']> & RouteRedirects<ToRoute<TOptions>>;
|
|
6
6
|
export declare function createExternalRoute<const TOptions extends CreateRouteOptions & WithoutHost & WithParent>(options: TOptions): ToRoute<TOptions> & ExternalRouteHooks<ToRoute<TOptions>, ExtractRouteContext<TOptions>> & RouteRedirects<ToRoute<TOptions>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ParamWithDefault } from '
|
|
2
|
-
import { ExtractParamType } from '
|
|
3
|
-
import { Param, ParamGetSet } from '
|
|
1
|
+
import { ParamWithDefault } from './withDefault';
|
|
2
|
+
import { ExtractParamType } from '../types/params';
|
|
3
|
+
import { Param, ParamGetSet } from '../types/paramTypes';
|
|
4
4
|
export declare function createParam<TParam extends ParamWithDefault>(param: TParam): TParam;
|
|
5
5
|
export declare function createParam<TParam extends Param>(param: TParam): ParamGetSet<ExtractParamType<TParam>>;
|
|
6
6
|
export declare function createParam<TParam extends Param>(param: TParam, defaultValue: NoInfer<ExtractParamType<TParam>>): ParamWithDefault<TParam>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PrefetchConfigs, PrefetchStrategy } from '
|
|
2
|
-
import { ResolvedRoute } from '
|
|
1
|
+
import { PrefetchConfigs, PrefetchStrategy } from '../types/prefetch';
|
|
2
|
+
import { ResolvedRoute } from '../types/resolved';
|
|
3
3
|
import { HasVueAppStore } from './createVueAppStore';
|
|
4
|
-
import { CallbackContextPush, CallbackContextReject, CallbackContextSuccess } from '
|
|
4
|
+
import { CallbackContextPush, CallbackContextReject, CallbackContextSuccess } from '../types/callbackContext';
|
|
5
5
|
type SetPropsResponse = CallbackContextSuccess | CallbackContextPush | CallbackContextReject;
|
|
6
6
|
export type PropStore = HasVueAppStore & {
|
|
7
7
|
getPrefetchProps: (strategy: PrefetchStrategy, route: ResolvedRoute, configs: PrefetchConfigs) => Record<string, unknown>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { RejectionHooks } from '
|
|
2
|
-
import { Rejection } from '
|
|
1
|
+
import { RejectionHooks } from '../types/hooks';
|
|
2
|
+
import { Rejection } from '../types/rejection';
|
|
3
3
|
import { Component } from 'vue';
|
|
4
|
-
import { RouteSetTitle } from '
|
|
4
|
+
import { RouteSetTitle } from '../types/routeTitle';
|
|
5
5
|
export declare function createRejection<TType extends string>(options: {
|
|
6
6
|
type: TType;
|
|
7
7
|
component?: Component;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AddRejectionHook } from '
|
|
2
|
-
import { Routes } from '
|
|
3
|
-
import { Hooks } from '
|
|
1
|
+
import { AddRejectionHook } from '../types/hooks';
|
|
2
|
+
import { Routes } from '../types/route';
|
|
3
|
+
import { Hooks } from '../models/hooks';
|
|
4
4
|
type RejectionHooks<TRoutes extends Routes = Routes, TRejections extends string = string> = {
|
|
5
5
|
onRejection: AddRejectionHook<TRejections, TRoutes>;
|
|
6
6
|
store: Hooks;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RouterResolveOptions } from '
|
|
2
|
-
import { ResolvedRoute } from '
|
|
3
|
-
import { Route } from '
|
|
1
|
+
import { RouterResolveOptions } from '../types/routerResolve';
|
|
2
|
+
import { ResolvedRoute } from '../types/resolved';
|
|
3
|
+
import { Route } from '../types/route';
|
|
4
4
|
export declare function createResolvedRoute(route: Route, params?: Record<string, unknown>, options?: RouterResolveOptions): ResolvedRoute;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CreateRouteOptions, PropsGetter, CreateRouteProps, ToRoute, RouterViewPropsGetter } from '
|
|
2
|
-
import { InternalRouteHooks } from '
|
|
3
|
-
import { ExtractRouteContext } from '
|
|
4
|
-
import { RouteRedirects } from '
|
|
5
|
-
import { RouteSetTitle } from '
|
|
1
|
+
import { CreateRouteOptions, PropsGetter, CreateRouteProps, ToRoute, RouterViewPropsGetter } from '../types/createRouteOptions';
|
|
2
|
+
import { InternalRouteHooks } from '../types/hooks';
|
|
3
|
+
import { ExtractRouteContext } from '../types/routeContext';
|
|
4
|
+
import { RouteRedirects } from '../types/redirects';
|
|
5
|
+
import { RouteSetTitle } from '../types/routeTitle';
|
|
6
6
|
type CreateRouteWithProps<TOptions extends CreateRouteOptions, TProps extends CreateRouteProps<TOptions>> = CreateRouteProps<TOptions> extends RouterViewPropsGetter<TOptions> ? [props?: RouterViewPropsGetter<TOptions>] : CreateRouteProps<TOptions> extends PropsGetter<TOptions> ? Partial<ReturnType<CreateRouteProps<TOptions>>> extends ReturnType<CreateRouteProps<TOptions>> ? [props?: TProps] : [props: TProps] : Partial<CreateRouteProps<TOptions>> extends CreateRouteProps<TOptions> ? [props?: TProps] : [props: TProps];
|
|
7
7
|
export declare function createRoute<const TOptions extends CreateRouteOptions, const TProps extends CreateRouteProps<TOptions>>(options: TOptions, ...args: CreateRouteWithProps<TOptions, TProps>): ToRoute<TOptions, TProps> & InternalRouteHooks<ToRoute<TOptions>, ExtractRouteContext<TOptions>> & RouteRedirects<ToRoute<TOptions>> & RouteSetTitle<ToRoute<TOptions>>;
|
|
8
8
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AddBeforeEnterHook, AddBeforeUpdateHook, AddBeforeLeaveHook, AddAfterEnterHook, AddAfterUpdateHook, AddAfterLeaveHook, AddErrorHook, AddRejectionHook } from '
|
|
2
|
-
import { Routes } from '
|
|
3
|
-
import { Hooks } from '
|
|
4
|
-
import { ExtractRejectionTypes, Rejection } from '
|
|
5
|
-
import { RouteRedirect } from '
|
|
1
|
+
import { AddBeforeEnterHook, AddBeforeUpdateHook, AddBeforeLeaveHook, AddAfterEnterHook, AddAfterUpdateHook, AddAfterLeaveHook, AddErrorHook, AddRejectionHook } from '../types/hooks';
|
|
2
|
+
import { Routes } from '../types/route';
|
|
3
|
+
import { Hooks } from '../models/hooks';
|
|
4
|
+
import { ExtractRejectionTypes, Rejection } from '../types/rejection';
|
|
5
|
+
import { RouteRedirect } from '../types/redirects';
|
|
6
6
|
type RouteHooks<TRoutes extends Routes = Routes, TRejections extends Rejection[] = Rejection[]> = {
|
|
7
7
|
redirect: RouteRedirect;
|
|
8
8
|
onBeforeRouteEnter: AddBeforeEnterHook<TRoutes, TRejections>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RouteRedirects } from '
|
|
2
|
-
import { Route } from '
|
|
1
|
+
import { RouteRedirects } from '../types/redirects';
|
|
2
|
+
import { Route } from '../types/route';
|
|
3
3
|
type CreateRouteRedirectsContext = {
|
|
4
4
|
/**
|
|
5
5
|
* The to route for the redirectFrom callback and the from route for the redirectTo callback.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Routes } from '
|
|
2
|
-
import { Router, RouterOptions } from '
|
|
3
|
-
import { EmptyRouterPlugin, RouterPlugin } from '
|
|
1
|
+
import { Routes } from '../types/route';
|
|
2
|
+
import { Router, RouterOptions } from '../types/router';
|
|
3
|
+
import { EmptyRouterPlugin, RouterPlugin } from '../types/routerPlugin';
|
|
4
4
|
/**
|
|
5
5
|
* Creates a router instance for a Vue application, equipped with methods for route handling, lifecycle hooks, and state management.
|
|
6
6
|
*
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Router, RouterRoutes, RouterRejections } from '
|
|
1
|
+
import { Router, RouterRoutes, RouterRejections } from '../types/router';
|
|
2
2
|
import { InjectionKey } from 'vue';
|
|
3
|
-
import { createRouterView } from '
|
|
4
|
-
import { createRouterLink } from '
|
|
5
|
-
import { createUseRoute } from '
|
|
6
|
-
import { createUseRouter } from '
|
|
7
|
-
import { createUseQueryValue } from '
|
|
8
|
-
import { createUseLink } from '
|
|
9
|
-
import { createIsRoute } from '
|
|
10
|
-
import { AddBeforeLeaveHook, AddBeforeUpdateHook, AddAfterLeaveHook, AddAfterUpdateHook } from '
|
|
11
|
-
import { createUseRejection } from '
|
|
3
|
+
import { createRouterView } from '../components/routerView';
|
|
4
|
+
import { createRouterLink } from '../components/routerLink';
|
|
5
|
+
import { createUseRoute } from '../compositions/useRoute';
|
|
6
|
+
import { createUseRouter } from '../compositions/useRouter';
|
|
7
|
+
import { createUseQueryValue } from '../compositions/useQueryValue';
|
|
8
|
+
import { createUseLink } from '../compositions/useLink';
|
|
9
|
+
import { createIsRoute } from '../guards/routes';
|
|
10
|
+
import { AddBeforeLeaveHook, AddBeforeUpdateHook, AddAfterLeaveHook, AddAfterUpdateHook } from '../types/hooks';
|
|
11
|
+
import { createUseRejection } from '../compositions/useRejection';
|
|
12
12
|
export type RouterAssets<TRouter extends Router> = {
|
|
13
13
|
/**
|
|
14
14
|
* Registers a hook that is called before a route is left. Must be called from setup.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { RouterPush } from '
|
|
2
|
-
import { RouterReject } from '
|
|
3
|
-
import { RouterReplace } from '
|
|
4
|
-
import { Routes } from '
|
|
5
|
-
import { Rejections } from '
|
|
6
|
-
import { RouteUpdate } from '
|
|
7
|
-
import { ResolvedRoute } from '
|
|
1
|
+
import { RouterPush } from '../types/routerPush';
|
|
2
|
+
import { RouterReject } from '../types/routerReject';
|
|
3
|
+
import { RouterReplace } from '../types/routerReplace';
|
|
4
|
+
import { Routes } from '../types/route';
|
|
5
|
+
import { Rejections } from '../types/rejection';
|
|
6
|
+
import { RouteUpdate } from '../types/routeUpdate';
|
|
7
|
+
import { ResolvedRoute } from '../types/resolved';
|
|
8
8
|
/**
|
|
9
9
|
* A function that can be called to abort a routing operation.
|
|
10
10
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AddGlobalHooks, AddComponentHook, AfterHookRunner, BeforeHookRunner, AddBeforeEnterHook, AddBeforeUpdateHook, AddBeforeLeaveHook, AddAfterEnterHook, AddAfterUpdateHook, AddAfterLeaveHook, ErrorHookRunner, AddErrorHook, RejectionHookRunner, AddRejectionHook } from '
|
|
2
|
-
import { HasVueAppStore } from '
|
|
1
|
+
import { AddGlobalHooks, AddComponentHook, AfterHookRunner, BeforeHookRunner, AddBeforeEnterHook, AddBeforeUpdateHook, AddBeforeLeaveHook, AddAfterEnterHook, AddAfterUpdateHook, AddAfterLeaveHook, ErrorHookRunner, AddErrorHook, RejectionHookRunner, AddRejectionHook } from '../types/hooks';
|
|
2
|
+
import { HasVueAppStore } from './createVueAppStore';
|
|
3
3
|
export declare const getRouterHooksKey: (routerKey: import('vue').InjectionKey<import('../main').Router>) => import('vue').InjectionKey<RouterHooks>;
|
|
4
4
|
export type RouterHooks = HasVueAppStore & {
|
|
5
5
|
runBeforeRouteHooks: BeforeHookRunner;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateRouterPluginOptions, RouterPlugin, PluginRouteHooks } from '
|
|
2
|
-
import { Rejections } from '
|
|
3
|
-
import { Routes } from '
|
|
1
|
+
import { CreateRouterPluginOptions, RouterPlugin, PluginRouteHooks } from '../types/routerPlugin';
|
|
2
|
+
import { Rejections } from '../types/rejection';
|
|
3
|
+
import { Routes } from '../types/route';
|
|
4
4
|
export declare function createRouterPlugin<TRoutes extends Routes = [], TRejections extends Rejections = []>(plugin: CreateRouterPluginOptions<TRoutes, TRejections>): RouterPlugin<TRoutes, TRejections> & PluginRouteHooks<TRoutes, TRejections>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InjectionKey } from 'vue';
|
|
2
|
-
import { ResolvedRoute } from '
|
|
3
|
-
import { RouterRoute } from '
|
|
4
|
-
import { RouterPush } from '
|
|
5
|
-
import { Router } from '
|
|
2
|
+
import { ResolvedRoute } from '../types/resolved';
|
|
3
|
+
import { RouterRoute } from '../types/routerRoute';
|
|
4
|
+
import { RouterPush } from '../types/routerPush';
|
|
5
|
+
import { Router } from '../types/router';
|
|
6
6
|
export declare function isRouterRoute(routerKey: InjectionKey<Router>, value: unknown): value is RouterRoute;
|
|
7
7
|
export declare function createRouterRoute<TRoute extends ResolvedRoute>(routerKey: InjectionKey<Router>, route: TRoute, push: RouterPush): RouterRoute<TRoute>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CreateUrlOptions, ToUrl } from '
|
|
1
|
+
import { CreateUrlOptions, ToUrl } from '../types/url';
|
|
2
2
|
export declare function createUrl<const T extends CreateUrlOptions>(options: T): ToUrl<T>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Hooks } from '
|
|
2
|
-
import { RouterPlugin } from '
|
|
1
|
+
import { Hooks } from '../models/hooks';
|
|
2
|
+
import { RouterPlugin } from '../types/routerPlugin';
|
|
3
3
|
export declare function getGlobalHooksForRouter(plugins?: RouterPlugin[]): Hooks;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ResolvedRoute } from '
|
|
2
|
-
import { Hooks } from '
|
|
1
|
+
import { ResolvedRoute } from '../types/resolved';
|
|
2
|
+
import { Hooks } from '../models/hooks';
|
|
3
3
|
export declare function getGlobalBeforeHooks(to: ResolvedRoute, from: ResolvedRoute | null, globalHooks: Hooks): Hooks;
|
|
4
4
|
export declare function getGlobalAfterHooks(to: ResolvedRoute, from: ResolvedRoute | null, globalHooks: Hooks): Hooks;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ResolvedRoute } from '
|
|
2
|
-
import { Routes } from '
|
|
3
|
-
import { ParseUrlOptions } from '
|
|
1
|
+
import { ResolvedRoute } from '../types/resolved';
|
|
2
|
+
import { Routes } from '../types/route';
|
|
3
|
+
import { ParseUrlOptions } from '../types/url';
|
|
4
4
|
type MatchOptions = {
|
|
5
5
|
state?: Partial<unknown>;
|
|
6
6
|
} & ParseUrlOptions;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { UrlParams } from '
|
|
2
|
-
import { Param } from '
|
|
1
|
+
import { UrlParams } from './withParams';
|
|
2
|
+
import { Param } from '../types/paramTypes';
|
|
3
3
|
export declare function getParamsForString(string?: string, params?: Record<string, Param | undefined>): UrlParams;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Hooks } from '
|
|
2
|
-
import { Rejection } from '
|
|
1
|
+
import { Hooks } from '../models/hooks';
|
|
2
|
+
import { Rejection } from '../types/rejection';
|
|
3
3
|
export declare function getRejectionHooksFromRejection(rejection: Rejection): Hooks;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ResolvedRoute } from '
|
|
2
|
-
import { Hooks } from '
|
|
1
|
+
import { ResolvedRoute } from '../types/resolved';
|
|
2
|
+
import { Hooks } from '../models/hooks';
|
|
3
3
|
export declare function getBeforeHooksFromRoutes(to: ResolvedRoute, from: ResolvedRoute | null): Hooks;
|
|
4
4
|
export declare function getAfterHooksFromRoutes(to: ResolvedRoute, from: ResolvedRoute | null): Hooks;
|