@kitbag/router 0.20.6 → 0.20.8
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/components/echo.d.ts +6 -0
- package/dist/components/helloWorld.d.ts +2 -0
- package/dist/components/rejection.d.ts +2 -0
- package/dist/components/routerLink.browser.spec.d.ts +1 -0
- package/dist/components/routerLink.d.ts +36 -0
- package/dist/components/routerView.browser.spec.d.ts +1 -0
- package/dist/components/routerView.d.ts +20 -0
- package/dist/components/routerView.spec.d.ts +1 -0
- package/dist/compositions/useComponentsStore.d.ts +5 -0
- package/dist/compositions/useEventListener.d.ts +2 -0
- package/dist/compositions/useLink.d.ts +16 -0
- package/dist/compositions/usePrefetching.d.ts +14 -0
- package/dist/compositions/usePropStore.d.ts +7 -0
- package/dist/compositions/useQueryValue.browser.spec.d.ts +1 -0
- package/dist/compositions/useQueryValue.d.ts +15 -0
- package/dist/compositions/useRejection.d.ts +7 -0
- package/dist/compositions/useRoute.browser.spec.d.ts +1 -0
- package/dist/compositions/useRoute.d.ts +16 -0
- package/dist/compositions/useRouter.d.ts +3 -0
- package/dist/compositions/useRouterDepth.d.ts +8 -0
- package/dist/compositions/useRouterHooks.d.ts +4 -0
- package/dist/compositions/useVisibilityObserver.d.ts +8 -0
- package/dist/errors/callbackContextAbortError.d.ts +5 -0
- package/dist/errors/callbackContextPushError.d.ts +5 -0
- package/dist/errors/callbackContextRejectionError.d.ts +6 -0
- package/dist/errors/duplicateNamesError.d.ts +11 -0
- package/dist/errors/duplicateParamsError.d.ts +13 -0
- package/dist/errors/initialRouteMissingError.d.ts +3 -0
- package/dist/errors/invalidRouteParamValueError.d.ts +2 -0
- package/dist/errors/metaPropertyConflict.d.ts +8 -0
- package/dist/errors/routeNotFoundError.d.ts +6 -0
- package/dist/errors/routerNotInstalledError.d.ts +7 -0
- package/dist/errors/useRouteInvalidError.d.ts +13 -0
- package/dist/guards/routes.d.ts +46 -0
- package/dist/guards/routes.spec-d.d.ts +1 -0
- package/dist/keys.d.ts +3 -0
- package/dist/kitbag-router.d.ts +2 -1433
- package/dist/kitbag-router.js +2067 -1959
- package/dist/kitbag-router.umd.cjs +3 -3
- package/dist/main.d.ts +302 -0
- package/dist/models/RouteHooks.d.ts +9 -0
- package/dist/models/RouterRouteHooks.d.ts +10 -0
- package/dist/services/arrayOf.d.ts +7 -0
- package/dist/services/arrayOf.spec.d.ts +1 -0
- package/dist/services/combineHash.d.ts +4 -0
- package/dist/services/combineHash.spec.d.ts +1 -0
- package/dist/services/combineMeta.d.ts +2 -0
- package/dist/services/combineMeta.spec.d.ts +1 -0
- package/dist/services/combinePath.d.ts +12 -0
- package/dist/services/combinePath.spec-d.d.ts +1 -0
- package/dist/services/combinePath.spec.d.ts +1 -0
- package/dist/services/combineQuery.d.ts +13 -0
- package/dist/services/combineQuery.spec.d.ts +1 -0
- package/dist/services/combineState.d.ts +3 -0
- package/dist/services/combineState.spec.d.ts +1 -0
- package/dist/services/component.browser.spec.d.ts +1 -0
- package/dist/services/component.d.ts +12 -0
- package/dist/services/createCallbackContext.d.ts +44 -0
- package/dist/services/createComponentHooks.d.ts +11 -0
- package/dist/services/createComponentsStore.d.ts +7 -0
- package/dist/services/createCurrentRoute.d.ts +13 -0
- package/dist/services/createExternalRoute.d.ts +3 -0
- package/dist/services/createExternalRoute.spec.d.ts +1 -0
- package/dist/services/createIsExternal.d.ts +1 -0
- package/dist/services/createIsExternal.spec.d.ts +1 -0
- package/dist/services/createParam.d.ts +6 -0
- package/dist/services/createPropStore.d.ts +13 -0
- package/dist/services/createResolvedRoute.d.ts +4 -0
- package/dist/services/createResolvedRouteForUrl.browser.spec.d.ts +1 -0
- package/dist/services/createResolvedRouteForUrl.d.ts +3 -0
- package/dist/services/createResolvedRouteQuery.d.ts +5 -0
- package/dist/services/createRoute.d.ts +4 -0
- package/dist/services/createRoute.spec-d.d.ts +1 -0
- package/dist/services/createRoute.spec.d.ts +1 -0
- package/dist/services/createRouteId.d.ts +1 -0
- package/dist/services/createRouter.browser.spec.d.ts +1 -0
- package/dist/services/createRouter.d.ts +28 -0
- package/dist/services/createRouter.spec-d.d.ts +1 -0
- package/dist/services/createRouter.spec.d.ts +1 -0
- package/dist/services/createRouterAssets.d.ts +118 -0
- package/dist/services/createRouterCallbackContext.d.ts +45 -0
- package/dist/services/createRouterHistory.browser.spec.d.ts +1 -0
- package/dist/services/createRouterHistory.d.ts +20 -0
- package/dist/services/createRouterHooks.d.ts +20 -0
- package/dist/services/createRouterKeyStore.d.ts +3 -0
- package/dist/services/createRouterPlugin.browser.spec.d.ts +1 -0
- package/dist/services/createRouterPlugin.d.ts +4 -0
- package/dist/services/createRouterReject.d.ts +16 -0
- package/dist/services/createRouterRoute.d.ts +7 -0
- package/dist/services/createRouterRoute.spec.d.ts +1 -0
- package/dist/services/createUniqueIdSequence.d.ts +2 -0
- package/dist/services/createVisibilityObserver.d.ts +7 -0
- package/dist/services/createVueAppStore.d.ts +8 -0
- package/dist/services/getGlobalHooksForRouter.d.ts +4 -0
- package/dist/services/getGlobalRouteHooks.d.ts +5 -0
- package/dist/services/getInitialUrl.browser.spec.d.ts +1 -0
- package/dist/services/getInitialUrl.d.ts +1 -0
- package/dist/services/getInitialUrl.spec.d.ts +1 -0
- package/dist/services/getMatchesForUrl.d.ts +2 -0
- package/dist/services/getMatchesForUrl.spec.d.ts +1 -0
- package/dist/services/getParamsForString.d.ts +2 -0
- package/dist/services/getRouteHooks.d.ts +10 -0
- package/dist/services/getRouteHooks.spec.d.ts +1 -0
- package/dist/services/getRoutesForRouter.d.ts +9 -0
- package/dist/services/getRoutesForRouter.spec.d.ts +1 -0
- package/dist/services/hooks.browser.spec.d.ts +1 -0
- package/dist/services/hooks.d.ts +8 -0
- package/dist/services/hooks.spec.d.ts +1 -0
- package/dist/services/insertBaseRoute.d.ts +2 -0
- package/dist/services/insertBaseRoute.spec.d.ts +1 -0
- package/dist/services/paramValidation.d.ts +4 -0
- package/dist/services/paramValidation.spec.d.ts +1 -0
- package/dist/services/params.d.ts +7 -0
- package/dist/services/params.spec.d.ts +1 -0
- package/dist/services/paramsFinder.d.ts +3 -0
- package/dist/services/paramsFinder.spec.d.ts +1 -0
- package/dist/services/routeMatchRules.d.ts +5 -0
- package/dist/services/routeMatchRules.spec.d.ts +1 -0
- package/dist/services/routeMatchScore.d.ts +7 -0
- package/dist/services/routeMatchScore.spec.d.ts +1 -0
- package/dist/services/routeRegex.d.ts +18 -0
- package/dist/services/routeRegex.spec.d.ts +1 -0
- package/dist/services/state.d.ts +9 -0
- package/dist/services/state.spec.d.ts +1 -0
- package/dist/services/tupleOf.d.ts +10 -0
- package/dist/services/tupleOf.spec.d.ts +1 -0
- package/dist/services/unionOf.d.ts +3 -0
- package/dist/services/unionOf.spec.d.ts +1 -0
- package/dist/services/urlAssembly.d.ts +10 -0
- package/dist/services/urlAssembly.spec.d.ts +1 -0
- package/dist/services/urlCombine.d.ts +2 -0
- package/dist/services/urlCombine.spec.d.ts +1 -0
- package/dist/services/urlCreator.d.ts +2 -0
- package/dist/services/urlCreator.spec.d.ts +1 -0
- package/dist/services/urlParser.d.ts +2 -0
- package/dist/services/urlParser.spec.d.ts +1 -0
- package/dist/services/valibot.d.ts +7 -0
- package/dist/services/valibot.spec-d.d.ts +1 -0
- package/dist/services/valibot.spec.d.ts +1 -0
- package/dist/services/withDefault.d.ts +5 -0
- package/dist/services/withParams.d.ts +15 -0
- package/dist/services/withParams.spec-d.d.ts +1 -0
- package/dist/services/withParams.spec.d.ts +1 -0
- package/dist/services/zod.d.ts +11 -0
- package/dist/services/zod.spec-d.d.ts +1 -0
- package/dist/services/zod.spec.d.ts +1 -0
- package/dist/tests/hooks.spec.d.ts +1 -0
- package/dist/tests/routeProps.browser.spec.d.ts +1 -0
- package/dist/tests/routeProps.spec.d.ts +1 -0
- package/dist/types/createRouteOptions.d.ts +120 -0
- package/dist/types/hooks.d.ts +129 -0
- package/dist/types/meta.d.ts +2 -0
- package/dist/types/name.d.ts +2 -0
- package/dist/types/paramTypes.d.ts +14 -0
- package/dist/types/params.d.ts +71 -0
- package/dist/types/prefetch.d.ts +27 -0
- package/dist/types/props.d.ts +23 -0
- package/dist/types/querySource.d.ts +1 -0
- package/dist/types/register.d.ts +68 -0
- package/dist/types/register.spec.d.ts +1 -0
- package/dist/types/resolved.d.ts +47 -0
- package/dist/types/resolved.spec-d.d.ts +1 -0
- package/dist/types/route.d.ts +76 -0
- package/dist/types/route.spec-d.d.ts +1 -0
- package/dist/types/routeMatchRule.d.ts +2 -0
- package/dist/types/routeUpdate.d.ts +9 -0
- package/dist/types/routeWithParams.d.ts +5 -0
- package/dist/types/routeWithParams.spec-d.d.ts +1 -0
- package/dist/types/router.d.ts +186 -0
- package/dist/types/routerLink.d.ts +16 -0
- package/dist/types/routerPlugin.d.ts +18 -0
- package/dist/types/routerPush.d.ts +33 -0
- package/dist/types/routerReject.d.ts +3 -0
- package/dist/types/routerReplace.d.ts +20 -0
- package/dist/types/routerResolve.d.ts +15 -0
- package/dist/types/routerRoute.d.ts +16 -0
- package/dist/types/routesMap.d.ts +9 -0
- package/dist/types/routesMap.spec-ts.d.ts +1 -0
- package/dist/types/state.d.ts +18 -0
- package/dist/types/url.d.ts +23 -0
- package/dist/types/useLink.d.ts +51 -0
- package/dist/types/utilities.d.ts +22 -0
- package/dist/utilities/array.d.ts +2 -0
- package/dist/utilities/checkDuplicateKeys.d.ts +1 -0
- package/dist/utilities/checkDuplicateKeys.spec.d.ts +1 -0
- package/dist/utilities/checkDuplicateNames.d.ts +2 -0
- package/dist/utilities/checkDuplicateNames.spec.d.ts +1 -0
- package/dist/utilities/components.d.ts +6 -0
- package/dist/utilities/components.spec.d.ts +1 -0
- package/dist/utilities/guards.d.ts +5 -0
- package/dist/utilities/guards.spec.d.ts +1 -0
- package/dist/utilities/index.d.ts +6 -0
- package/dist/utilities/isBrowser.browser.spec.d.ts +1 -0
- package/dist/utilities/isBrowser.d.ts +1 -0
- package/dist/utilities/isBrowser.spec.d.ts +1 -0
- package/dist/utilities/makeOptional.d.ts +9 -0
- package/dist/utilities/prefetch.d.ts +4 -0
- package/dist/utilities/prefetch.spec.d.ts +1 -0
- package/dist/utilities/promises.d.ts +1 -0
- package/dist/utilities/props.d.ts +6 -0
- package/dist/utilities/testHelpers.d.ts +144 -0
- package/dist/utilities/urlSearchParams.d.ts +2 -0
- package/dist/utilities/urlSearchParams.spec.d.ts +1 -0
- package/package.json +12 -12
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ToWithParams, WithParams } from './withParams';
|
|
2
|
+
import { Param } from '../types/paramTypes';
|
|
3
|
+
type CombinePathString<TParent extends string, TChild extends string> = `${TParent}${TChild}`;
|
|
4
|
+
export type CombinePath<TParent extends WithParams, TChild extends WithParams> = ToWithParams<TParent> extends {
|
|
5
|
+
value: infer TParentPath extends string;
|
|
6
|
+
params: infer TParentParams extends Record<string, unknown>;
|
|
7
|
+
} ? ToWithParams<TChild> extends {
|
|
8
|
+
value: infer TChildPath extends string;
|
|
9
|
+
params: infer TChildParams extends Record<string, unknown>;
|
|
10
|
+
} ? TParentParams & TChildParams extends Record<string, Param | undefined> ? WithParams<CombinePathString<TParentPath, TChildPath>, TParentParams & TChildParams> : WithParams<CombinePathString<TParentPath, TChildPath>, {}> : WithParams<'', {}> : WithParams<'', {}>;
|
|
11
|
+
export declare function combinePath<TParentPath extends WithParams, TChildPath extends WithParams>(parentPath: TParentPath, childPath: TChildPath): CombinePath<TParentPath, TChildPath>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StringHasValue } from '../utilities/guards';
|
|
2
|
+
import { ToWithParams, WithParams } from './withParams';
|
|
3
|
+
import { Param } from '../types/paramTypes';
|
|
4
|
+
type CombineQueryString<TParent extends string | undefined, TChild extends string | undefined> = StringHasValue<TParent> extends true ? StringHasValue<TChild> extends true ? `${TParent}&${TChild}` : TParent : TChild;
|
|
5
|
+
export type CombineQuery<TParent extends WithParams, TChild extends WithParams> = ToWithParams<TParent> extends {
|
|
6
|
+
value: infer TParentQuery extends string;
|
|
7
|
+
params: infer TParentParams extends Record<string, unknown>;
|
|
8
|
+
} ? ToWithParams<TChild> extends {
|
|
9
|
+
value: infer TChildQuery extends string;
|
|
10
|
+
params: infer TChildParams extends Record<string, unknown>;
|
|
11
|
+
} ? TParentParams & TChildParams extends Record<string, Param | undefined> ? WithParams<CombineQueryString<TParentQuery, TChildQuery>, TParentParams & TChildParams> : WithParams<CombineQueryString<TParentQuery, TChildQuery>, {}> : WithParams<'', {}> : WithParams<'', {}>;
|
|
12
|
+
export declare function combineQuery<TParentQuery extends WithParams, TChildQuery extends WithParams>(parentQuery: TParentQuery, childQuery: TChildQuery): CombineQuery<TParentQuery, TChildQuery>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Param } from '../types/paramTypes';
|
|
2
|
+
export type CombineState<TParent extends Record<string, Param>, TChild extends Record<string, Param>> = TParent & TChild;
|
|
3
|
+
export declare function combineState<TParentState extends Record<string, Param>, TChildState extends Record<string, Param>>(parentState: TParentState, childState: TChildState): CombineState<TParentState, TChildState>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AsyncComponentLoader, Component, FunctionalComponent, InjectionKey } from 'vue';
|
|
2
|
+
import { CreatedRouteOptions } from '../types/route';
|
|
3
|
+
import { Router } from '../types/router';
|
|
4
|
+
type Constructor = new (...args: any) => any;
|
|
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
|
+
type CreateComponentWrapperConfig = {
|
|
7
|
+
match: CreatedRouteOptions;
|
|
8
|
+
name: string;
|
|
9
|
+
component: Component;
|
|
10
|
+
};
|
|
11
|
+
export declare function createComponentPropsWrapper(routerKey: InjectionKey<Router>, { match, name, component }: CreateComponentWrapperConfig): Component;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { RegisteredRejectionType, RegisteredRouterPush, RegisteredRouterReject, RegisteredRouterReplace } from '../types/register';
|
|
2
|
+
/**
|
|
3
|
+
* Defines the structure of a successful callback response.
|
|
4
|
+
*/
|
|
5
|
+
export type CallbackSuccessResponse = {
|
|
6
|
+
status: 'SUCCESS';
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Defines the structure of an aborted callback response.
|
|
10
|
+
*/
|
|
11
|
+
export type CallbackAbortResponse = {
|
|
12
|
+
status: 'ABORT';
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Defines the structure of a callback response that results in a push to a new route.
|
|
16
|
+
*/
|
|
17
|
+
export type CallbackPushResponse = {
|
|
18
|
+
status: 'PUSH';
|
|
19
|
+
to: Parameters<RegisteredRouterPush>;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Defines the structure of a callback response that results in the rejection of a route transition.
|
|
23
|
+
*/
|
|
24
|
+
export type CallbackRejectResponse = {
|
|
25
|
+
status: 'REJECT';
|
|
26
|
+
type: RegisteredRejectionType;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* A function that can be called to abort a routing operation.
|
|
30
|
+
*/
|
|
31
|
+
export type CallbackContextAbort = () => void;
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Use `RouterCallbackContext` instead.
|
|
34
|
+
*/
|
|
35
|
+
export type CallbackContext = {
|
|
36
|
+
reject: RegisteredRouterReject;
|
|
37
|
+
push: RegisteredRouterPush;
|
|
38
|
+
replace: RegisteredRouterReplace;
|
|
39
|
+
abort: CallbackContextAbort;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Use `createRouterCallbackContext` instead.
|
|
43
|
+
*/
|
|
44
|
+
export declare function createCallbackContext(): CallbackContext;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { InjectionKey } from 'vue';
|
|
2
|
+
import { AddRouterAfterRouteHook, AddRouterBeforeRouteHook, Router, RouterRejections, RouterRoutes } from '../types/router';
|
|
3
|
+
import { Routes } from '../types/route';
|
|
4
|
+
type ComponentHooks<TRoutes extends Routes, TRejections extends PropertyKey> = {
|
|
5
|
+
onBeforeRouteLeave: AddRouterBeforeRouteHook<TRoutes, TRejections>;
|
|
6
|
+
onBeforeRouteUpdate: AddRouterBeforeRouteHook<TRoutes, TRejections>;
|
|
7
|
+
onAfterRouteLeave: AddRouterAfterRouteHook<TRoutes, TRejections>;
|
|
8
|
+
onAfterRouteUpdate: AddRouterAfterRouteHook<TRoutes, TRejections>;
|
|
9
|
+
};
|
|
10
|
+
export declare function createComponentHooks<TRouter extends Router>(routerKey: InjectionKey<TRouter>): ComponentHooks<RouterRoutes<TRouter>, RouterRejections<TRouter>>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Component, InjectionKey } from 'vue';
|
|
2
|
+
import { CreatedRouteOptions } from '../types/route';
|
|
3
|
+
import { Router } from '../types/router';
|
|
4
|
+
export type ComponentsStore = {
|
|
5
|
+
getRouteComponents: (match: CreatedRouteOptions) => Record<string, Component>;
|
|
6
|
+
};
|
|
7
|
+
export declare function createComponentsStore<TRouter extends Router>(routerKey: InjectionKey<TRouter>): ComponentsStore;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { InjectionKey } from 'vue';
|
|
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
|
+
type ResolvedRouteUpdate = (route: ResolvedRoute) => void;
|
|
7
|
+
type CurrentRouteContext<TRoutes extends Routes = Routes> = {
|
|
8
|
+
currentRoute: ResolvedRoute;
|
|
9
|
+
routerRoute: RouterRouteUnion<TRoutes>;
|
|
10
|
+
updateRoute: ResolvedRouteUpdate;
|
|
11
|
+
};
|
|
12
|
+
export declare function createCurrentRoute<TRoutes extends Routes>(routerKey: InjectionKey<Router>, fallbackRoute: ResolvedRoute, push: RouterPush): CurrentRouteContext<TRoutes>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CreateRouteOptions, ToRoute, WithHost, WithoutHost, WithoutParent, WithParent } from '../types/createRouteOptions';
|
|
2
|
+
export declare function createExternalRoute<const TOptions extends CreateRouteOptions & WithHost & WithoutParent>(options: TOptions): ToRoute<TOptions, undefined>;
|
|
3
|
+
export declare function createExternalRoute<const TOptions extends CreateRouteOptions & WithoutHost & WithParent>(options: TOptions): ToRoute<TOptions, undefined>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createIsExternal(host: string | undefined): (url: string) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ParamWithDefault } from './withDefault';
|
|
2
|
+
import { ExtractParamType } from '../types/params';
|
|
3
|
+
import { Param, ParamGetSet } from '../types/paramTypes';
|
|
4
|
+
export declare function createParam<TParam extends ParamWithDefault>(param: TParam): TParam;
|
|
5
|
+
export declare function createParam<TParam extends Param>(param: TParam): ParamGetSet<ExtractParamType<TParam>>;
|
|
6
|
+
export declare function createParam<TParam extends Param>(param: TParam, defaultValue: NoInfer<ExtractParamType<TParam>>): ParamWithDefault<TParam>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PrefetchConfigs, PrefetchStrategy } from '../types/prefetch';
|
|
2
|
+
import { ResolvedRoute } from '../types/resolved';
|
|
3
|
+
import { CallbackPushResponse, CallbackRejectResponse, CallbackSuccessResponse } from './createCallbackContext';
|
|
4
|
+
import { HasVueAppStore } from './createVueAppStore';
|
|
5
|
+
type SetPropsResponse = CallbackSuccessResponse | CallbackPushResponse | CallbackRejectResponse;
|
|
6
|
+
export type PropStore = HasVueAppStore & {
|
|
7
|
+
getPrefetchProps: (strategy: PrefetchStrategy, route: ResolvedRoute, configs: PrefetchConfigs) => Record<string, unknown>;
|
|
8
|
+
setPrefetchProps: (props: Record<string, unknown>) => void;
|
|
9
|
+
setProps: (route: ResolvedRoute) => Promise<SetPropsResponse>;
|
|
10
|
+
getProps: (id: string, name: string, route: ResolvedRoute) => unknown;
|
|
11
|
+
};
|
|
12
|
+
export declare function createPropStore(): PropStore;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ResolvedRoute } from '../types/resolved';
|
|
2
|
+
import { Route } from '../types/route';
|
|
3
|
+
import { RouterResolveOptions } from '../types/routerResolve';
|
|
4
|
+
export declare function createResolvedRoute(route: Route, params?: Record<string, unknown>, options?: RouterResolveOptions): ResolvedRoute;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { QuerySource } from '../types/querySource';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a dumb wrapper around URLSearchParams because URLSearchParams cannot be correctly be proxied to support writing params to the RouterRoute
|
|
4
|
+
*/
|
|
5
|
+
export declare function createResolvedRouteQuery(query?: QuerySource): URLSearchParams;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CreateRouteOptions, PropsGetter, CreateRouteProps, ToRoute } from '../types/createRouteOptions';
|
|
2
|
+
type CreateRouteWithProps<TOptions extends CreateRouteOptions, TProps extends CreateRouteProps<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];
|
|
3
|
+
export declare function createRoute<const TOptions extends CreateRouteOptions, const TProps extends CreateRouteProps<TOptions>>(options: TOptions, ...args: CreateRouteWithProps<TOptions, TProps>): ToRoute<TOptions, CreateRouteProps<TOptions> extends TProps ? undefined : TProps>;
|
|
4
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createRouteId: () => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Routes } from '../types/route';
|
|
2
|
+
import { Router, RouterOptions } from '../types/router';
|
|
3
|
+
import { EmptyRouterPlugin, RouterPlugin } from '../types/routerPlugin';
|
|
4
|
+
/**
|
|
5
|
+
* Creates a router instance for a Vue application, equipped with methods for route handling, lifecycle hooks, and state management.
|
|
6
|
+
*
|
|
7
|
+
* @param routes - {@link Routes} An array of route definitions specifying the configuration of routes in the application.
|
|
8
|
+
* Use createRoute method to create the route definitions.
|
|
9
|
+
* @param options - {@link RouterOptions} for the router, including history mode and initial URL settings.
|
|
10
|
+
* @returns Router instance
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { createRoute, createRouter } from '@kitbag/router'
|
|
15
|
+
*
|
|
16
|
+
* const Home = { template: '<div>Home</div>' }
|
|
17
|
+
* const About = { template: '<div>About</div>' }
|
|
18
|
+
*
|
|
19
|
+
* export const routes = [
|
|
20
|
+
* createRoute({ name: 'home', path: '/', component: Home }),
|
|
21
|
+
* createRoute({ name: 'path', path: '/about', component: About }),
|
|
22
|
+
* ] as const
|
|
23
|
+
*
|
|
24
|
+
* const router = createRouter(routes)
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function createRouter<const TRoutes extends Routes, const TOptions extends RouterOptions, const TPlugin extends RouterPlugin = EmptyRouterPlugin>(routes: TRoutes, options?: TOptions, plugins?: TPlugin[]): Router<TRoutes, TOptions, TPlugin>;
|
|
28
|
+
export declare function createRouter<const TRoutes extends Routes, const TOptions extends RouterOptions, const TPlugin extends RouterPlugin = EmptyRouterPlugin>(routes: TRoutes[], options?: TOptions, plugins?: TPlugin[]): Router<TRoutes, TOptions, TPlugin>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Router, RouterRoutes, AddRouterBeforeRouteHook, AddRouterAfterRouteHook, RouterRejections } from '../types/router';
|
|
2
|
+
import { InjectionKey } from 'vue';
|
|
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
|
+
type RouterAssets<TRouter extends Router> = {
|
|
11
|
+
/**
|
|
12
|
+
* Registers a hook that is called before a route is left. Must be called from setup.
|
|
13
|
+
* This is useful for performing actions or cleanups before navigating away from a route component.
|
|
14
|
+
*
|
|
15
|
+
* @param BeforeRouteHook - The hook callback function
|
|
16
|
+
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
17
|
+
* @group Hooks
|
|
18
|
+
*/
|
|
19
|
+
onBeforeRouteLeave: AddRouterBeforeRouteHook<RouterRoutes<TRouter>, RouterRejections<TRouter>>;
|
|
20
|
+
/**
|
|
21
|
+
* Registers a hook that is called before a route is updated. Must be called from setup.
|
|
22
|
+
* This is particularly useful for handling changes in route parameters or query while staying within the same component.
|
|
23
|
+
*
|
|
24
|
+
* @param BeforeRouteHook - The hook callback function
|
|
25
|
+
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
26
|
+
* @group Hooks
|
|
27
|
+
*/
|
|
28
|
+
onBeforeRouteUpdate: AddRouterBeforeRouteHook<RouterRoutes<TRouter>, RouterRejections<TRouter>>;
|
|
29
|
+
/**
|
|
30
|
+
* Registers a hook that is called after a route has been left. Must be called during setup.
|
|
31
|
+
* This can be used for cleanup actions after the component is no longer active, ensuring proper resource management.
|
|
32
|
+
*
|
|
33
|
+
* @param AfterRouteHook - The hook callback function
|
|
34
|
+
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
35
|
+
* @group Hooks
|
|
36
|
+
*/
|
|
37
|
+
onAfterRouteLeave: AddRouterAfterRouteHook<RouterRoutes<TRouter>, RouterRejections<TRouter>>;
|
|
38
|
+
/**
|
|
39
|
+
* Registers a hook that is called after a route has been updated. Must be called during setup.
|
|
40
|
+
* This is ideal for responding to updates within the same route, such as parameter changes, without full component reloads.
|
|
41
|
+
*
|
|
42
|
+
* @param AfterRouteHook - The hook callback function
|
|
43
|
+
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
44
|
+
* @group Hooks
|
|
45
|
+
*/
|
|
46
|
+
onAfterRouteUpdate: AddRouterAfterRouteHook<RouterRoutes<TRouter>, RouterRejections<TRouter>>;
|
|
47
|
+
/**
|
|
48
|
+
* A guard to verify if a route or unknown value matches a given route name.
|
|
49
|
+
*
|
|
50
|
+
* @param routeName - The name of the route to check against the current route.
|
|
51
|
+
* @returns True if the current route matches the given route name, false otherwise.
|
|
52
|
+
* @group Guards
|
|
53
|
+
*/
|
|
54
|
+
isRoute: ReturnType<typeof createIsRoute<TRouter>>;
|
|
55
|
+
/**
|
|
56
|
+
* A component to render the current route's component.
|
|
57
|
+
*
|
|
58
|
+
* @param props - The props to pass to the router view component.
|
|
59
|
+
* @returns The router view component.
|
|
60
|
+
* @group Components
|
|
61
|
+
*/
|
|
62
|
+
RouterView: ReturnType<typeof createRouterView<TRouter>>;
|
|
63
|
+
/**
|
|
64
|
+
* A component to render a link to a route or any url.
|
|
65
|
+
*
|
|
66
|
+
* @param props - The props to pass to the router link component.
|
|
67
|
+
* @returns The router link component.
|
|
68
|
+
* @group Components
|
|
69
|
+
*/
|
|
70
|
+
RouterLink: ReturnType<typeof createRouterLink<TRouter>>;
|
|
71
|
+
/**
|
|
72
|
+
* A composition to access the current route or verify a specific route name within a Vue component.
|
|
73
|
+
* This function provides two overloads:
|
|
74
|
+
* 1. When called without arguments, it returns the current route from the router without types.
|
|
75
|
+
* 2. When called with a route name, it checks if the current active route includes the specified route name.
|
|
76
|
+
*
|
|
77
|
+
* The function also sets up a reactive watcher on the route object from the router to continually check the validity of the route name
|
|
78
|
+
* if provided, throwing an error if the validation fails at any point during the component's lifecycle.
|
|
79
|
+
*
|
|
80
|
+
* @template TRouteName - A string type that should match route name of RouterRouteName<TRouter>, ensuring the route name exists.
|
|
81
|
+
* @param routeName - Optional. The name of the route to validate against the current active routes.
|
|
82
|
+
* @returns The current router route. If a route name is provided, it validates the route name first.
|
|
83
|
+
* @throws {UseRouteInvalidError} Throws an error if the provided route name is not valid or does not match the current route.
|
|
84
|
+
* @group Compositions
|
|
85
|
+
*/
|
|
86
|
+
useRoute: ReturnType<typeof createUseRoute<TRouter>>;
|
|
87
|
+
/**
|
|
88
|
+
* A composition to access the installed router instance within a Vue component.
|
|
89
|
+
*
|
|
90
|
+
* @returns The installed router instance.
|
|
91
|
+
* @throws {RouterNotInstalledError} Throws an error if the router has not been installed,
|
|
92
|
+
* ensuring the component does not operate without routing functionality.
|
|
93
|
+
* @group Compositions
|
|
94
|
+
*/
|
|
95
|
+
useRouter: ReturnType<typeof createUseRouter<TRouter>>;
|
|
96
|
+
/**
|
|
97
|
+
* A composition to access a specific query value from the current route.
|
|
98
|
+
*
|
|
99
|
+
* @returns The query value from the router.
|
|
100
|
+
* @group Compositions
|
|
101
|
+
*/
|
|
102
|
+
useQueryValue: ReturnType<typeof createUseQueryValue<TRouter>>;
|
|
103
|
+
/**
|
|
104
|
+
* A composition to export much of the functionality that drives RouterLink component.
|
|
105
|
+
* Also exports some useful context about routes relationship to current URL and convenience methods
|
|
106
|
+
* for navigating.
|
|
107
|
+
*
|
|
108
|
+
* @param source - The name of the route or a valid URL.
|
|
109
|
+
* @param params - If providing route name, this argument will expect corresponding params.
|
|
110
|
+
* @param options - {@link RouterResolveOptions} Same options as router resolve.
|
|
111
|
+
* @returns {UseLink} Reactive context values for as well as navigation methods.
|
|
112
|
+
* @group Compositions
|
|
113
|
+
*/
|
|
114
|
+
useLink: ReturnType<typeof createUseLink<TRouter>>;
|
|
115
|
+
};
|
|
116
|
+
export declare function createRouterAssets<TRouter extends Router>(router: TRouter): RouterAssets<TRouter>;
|
|
117
|
+
export declare function createRouterAssets<TRouter extends Router>(routerKey: InjectionKey<TRouter>): RouterAssets<TRouter>;
|
|
118
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Router, RouterRejections, RouterRoutes } from '../types/router';
|
|
2
|
+
import { RouterPush } from '../types/routerPush';
|
|
3
|
+
import { RouterReject } from '../types/routerReject';
|
|
4
|
+
import { RouterReplace } from '../types/routerReplace';
|
|
5
|
+
import { InjectionKey } from 'vue';
|
|
6
|
+
import { BuiltInRejectionType } from './createRouterReject';
|
|
7
|
+
import { AsString } from '../types/utilities';
|
|
8
|
+
import { Routes } from '../types/route';
|
|
9
|
+
/**
|
|
10
|
+
* Defines the structure of a successful callback response.
|
|
11
|
+
*/
|
|
12
|
+
export type RouterCallbackSuccessResponse = {
|
|
13
|
+
status: 'SUCCESS';
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Defines the structure of an aborted callback response.
|
|
17
|
+
*/
|
|
18
|
+
export type RouterCallbackAbortResponse = {
|
|
19
|
+
status: 'ABORT';
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Defines the structure of a callback response that results in a push to a new route.
|
|
23
|
+
*/
|
|
24
|
+
export type RouterCallbackPushResponse<TRoutes extends Routes> = {
|
|
25
|
+
status: 'PUSH';
|
|
26
|
+
to: Parameters<RouterPush<TRoutes>>;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Defines the structure of a callback response that results in the rejection of a route transition.
|
|
30
|
+
*/
|
|
31
|
+
export type RouterCallbackRejectResponse<TRejections extends PropertyKey> = {
|
|
32
|
+
status: 'REJECT';
|
|
33
|
+
type: AsString<TRejections> | BuiltInRejectionType;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* A function that can be called to abort a routing operation.
|
|
37
|
+
*/
|
|
38
|
+
export type CallbackContextAbort = () => void;
|
|
39
|
+
export type RouterCallbackContext<TRouter extends Router> = {
|
|
40
|
+
reject: RouterReject<RouterRejections<TRouter>>;
|
|
41
|
+
push: RouterPush<RouterRoutes<TRouter>>;
|
|
42
|
+
replace: RouterReplace<RouterRoutes<TRouter>>;
|
|
43
|
+
abort: CallbackContextAbort;
|
|
44
|
+
};
|
|
45
|
+
export declare function createRouterCallbackContext<TRouter extends Router>(_routerKey: InjectionKey<TRouter>): RouterCallbackContext<TRouter>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { History, Listener } from 'history';
|
|
2
|
+
type NavigationPushOptions = {
|
|
3
|
+
replace?: boolean;
|
|
4
|
+
state?: unknown;
|
|
5
|
+
};
|
|
6
|
+
type NavigationUpdate = (url: string, options?: NavigationPushOptions) => void;
|
|
7
|
+
type NavigationRefresh = () => void;
|
|
8
|
+
export type RouterHistory = History & {
|
|
9
|
+
update: NavigationUpdate;
|
|
10
|
+
refresh: NavigationRefresh;
|
|
11
|
+
startListening: () => void;
|
|
12
|
+
stopListening: () => void;
|
|
13
|
+
};
|
|
14
|
+
export type RouterHistoryMode = 'auto' | 'browser' | 'memory' | 'hash';
|
|
15
|
+
type RouterHistoryOptions = {
|
|
16
|
+
listener: Listener;
|
|
17
|
+
mode?: RouterHistoryMode;
|
|
18
|
+
};
|
|
19
|
+
export declare function createRouterHistory({ mode, listener }: RouterHistoryOptions): RouterHistory;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AddGlobalRouteHooks, AddComponentAfterRouteHook, AddComponentBeforeRouteHook } from '../types/hooks';
|
|
2
|
+
import { HasVueAppStore } from './createVueAppStore';
|
|
3
|
+
import { AddRouterAfterRouteHook, AddRouterBeforeRouteHook, Router, RouterRoutes, RouterRouteHookBeforeRunner, RouterRouteHookAfterRunner, RouterRejections } from '../types/router';
|
|
4
|
+
import { Routes } from '../types/route';
|
|
5
|
+
import { InjectionKey } from 'vue';
|
|
6
|
+
export declare const getRouterHooksKey: (routerKey: InjectionKey<Router>) => InjectionKey<RouterHooks<any, any>>;
|
|
7
|
+
export type RouterHooks<TRoutes extends Routes, TRejections extends PropertyKey> = HasVueAppStore & {
|
|
8
|
+
runBeforeRouteHooks: RouterRouteHookBeforeRunner<TRoutes>;
|
|
9
|
+
runAfterRouteHooks: RouterRouteHookAfterRunner<TRoutes>;
|
|
10
|
+
addComponentBeforeRouteHook: AddComponentBeforeRouteHook<TRoutes, TRejections>;
|
|
11
|
+
addComponentAfterRouteHook: AddComponentAfterRouteHook<TRoutes, TRejections>;
|
|
12
|
+
addGlobalRouteHooks: AddGlobalRouteHooks<TRoutes, TRejections>;
|
|
13
|
+
onBeforeRouteEnter: AddRouterBeforeRouteHook<TRoutes, TRejections>;
|
|
14
|
+
onBeforeRouteUpdate: AddRouterBeforeRouteHook<TRoutes, TRejections>;
|
|
15
|
+
onBeforeRouteLeave: AddRouterBeforeRouteHook<TRoutes, TRejections>;
|
|
16
|
+
onAfterRouteEnter: AddRouterAfterRouteHook<TRoutes, TRejections>;
|
|
17
|
+
onAfterRouteUpdate: AddRouterAfterRouteHook<TRoutes, TRejections>;
|
|
18
|
+
onAfterRouteLeave: AddRouterAfterRouteHook<TRoutes, TRejections>;
|
|
19
|
+
};
|
|
20
|
+
export declare function createRouterHooks<TRouter extends Router>(_routerKey: InjectionKey<TRouter>): RouterHooks<RouterRoutes<TRouter>, RouterRejections<TRouter>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Routes } from '../types/route';
|
|
2
|
+
import { RouterPlugin } from '../types/routerPlugin';
|
|
3
|
+
import { Component } from 'vue';
|
|
4
|
+
export declare function createRouterPlugin<TRoutes extends Routes = [], TRejections extends Record<string, Component> = {}>(plugin: Partial<RouterPlugin<TRoutes, TRejections>>): RouterPlugin<TRoutes, TRejections>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Ref, Component } from 'vue';
|
|
2
|
+
import { ResolvedRoute } from '../types/resolved';
|
|
3
|
+
export type BuiltInRejectionType = 'NotFound';
|
|
4
|
+
export type RouterSetReject = (type: string | null) => void;
|
|
5
|
+
type GetRejectionRoute = (type: string) => ResolvedRoute;
|
|
6
|
+
export type RouterRejection = Ref<null | {
|
|
7
|
+
type: string;
|
|
8
|
+
component: Component;
|
|
9
|
+
}>;
|
|
10
|
+
export type CreateRouterReject = {
|
|
11
|
+
setRejection: RouterSetReject;
|
|
12
|
+
rejection: RouterRejection;
|
|
13
|
+
getRejectionRoute: GetRejectionRoute;
|
|
14
|
+
};
|
|
15
|
+
export declare function createRouterReject(rejections: Partial<Record<string, Component>>): CreateRouterReject;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { InjectionKey } from 'vue';
|
|
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
|
+
export declare function isRouterRoute(routerKey: InjectionKey<Router>, value: unknown): value is RouterRoute;
|
|
7
|
+
export declare function createRouterRoute<TRoute extends ResolvedRoute>(routerKey: InjectionKey<Router>, route: TRoute, push: RouterPush): RouterRoute<TRoute>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type VisibilityObserver = {
|
|
2
|
+
observe: (element: Element) => void;
|
|
3
|
+
unobserve: (element: Element) => void;
|
|
4
|
+
disconnect: () => void;
|
|
5
|
+
isElementVisible: (element: Element) => boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare function createVisibilityObserver(): VisibilityObserver;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RouterRouteHooks } from '../models/RouterRouteHooks';
|
|
2
|
+
import { RouterOptions } from '../types/router';
|
|
3
|
+
import { RouterPlugin } from '../types/routerPlugin';
|
|
4
|
+
export declare function getGlobalHooksForRouter(options?: RouterOptions, plugins?: RouterPlugin[]): RouterRouteHooks;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ResolvedRoute } from '../types/resolved';
|
|
2
|
+
import { RouterRouteHooks } from '../models/RouterRouteHooks';
|
|
3
|
+
import { Routes } from '../main';
|
|
4
|
+
export declare function getGlobalBeforeRouteHooks<TRoutes extends Routes, TRejections extends PropertyKey>(to: ResolvedRoute, from: ResolvedRoute | null, globalHooks: RouterRouteHooks<TRoutes, TRejections>): RouterRouteHooks<TRoutes, TRejections>;
|
|
5
|
+
export declare function getGlobalAfterRouteHooks<TRoutes extends Routes, TRejections extends PropertyKey>(to: ResolvedRoute, from: ResolvedRoute | null, globalHooks: RouterRouteHooks<TRoutes, TRejections>): RouterRouteHooks<TRoutes, TRejections>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getInitialUrl(initialUrl?: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RouteHooks } from '../models/RouteHooks';
|
|
2
|
+
import { ResolvedRoute } from '../types/resolved';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated will be removed in a future version
|
|
5
|
+
*/
|
|
6
|
+
export declare function getBeforeRouteHooksFromRoutes(to: ResolvedRoute, from: ResolvedRoute | null): RouteHooks;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated will be removed in a future version
|
|
9
|
+
*/
|
|
10
|
+
export declare function getAfterRouteHooksFromRoutes(to: ResolvedRoute, from: ResolvedRoute | null): RouteHooks;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Routes } from '../types/route';
|
|
2
|
+
import { RouterPlugin } from '../types/routerPlugin';
|
|
3
|
+
/**
|
|
4
|
+
* Takes in routes and plugins and returns a list of routes with the base route inserted if provided.
|
|
5
|
+
* Also checks for duplicate names in the routes.
|
|
6
|
+
*
|
|
7
|
+
* @throws {DuplicateNamesError} If there are duplicate names in the routes.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getRoutesForRouter(routes: Routes | Routes[], plugins?: RouterPlugin[], base?: string): Routes;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RouteHookLifecycle } from '../types/hooks';
|
|
2
|
+
import { ResolvedRoute } from '../types/resolved';
|
|
3
|
+
type RouteHookCondition = (to: ResolvedRoute, from: ResolvedRoute | null, depth: number) => boolean;
|
|
4
|
+
export declare const isRouteEnter: RouteHookCondition;
|
|
5
|
+
export declare const isRouteLeave: RouteHookCondition;
|
|
6
|
+
export declare const isRouteUpdate: RouteHookCondition;
|
|
7
|
+
export declare function getRouteHookCondition(lifecycle: RouteHookLifecycle): RouteHookCondition;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|