@kitbag/router 0.24.2 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{src/components → components}/routerLink.d.ts +4 -4
- package/dist/{src/components → components}/routerView.d.ts +3 -3
- package/dist/{src/compositions → compositions}/useComponentsStore.d.ts +2 -2
- package/dist/{src/compositions → compositions}/useLink.d.ts +6 -6
- package/dist/{src/compositions → compositions}/usePrefetching.d.ts +3 -3
- package/dist/{src/compositions → compositions}/useQueryValue.d.ts +3 -3
- package/dist/{src/compositions → compositions}/useRejection.d.ts +2 -2
- package/dist/{src/compositions → compositions}/useRoute.d.ts +2 -2
- package/dist/compositions/useRouteValueStore.d.ts +7 -0
- package/dist/{src/compositions → compositions}/useRouter.d.ts +1 -1
- package/dist/{src/compositions → compositions}/useRouterDepth.d.ts +1 -1
- package/dist/{src/compositions → compositions}/useRouterHooks.d.ts +2 -2
- package/dist/{src/compositions → compositions}/useVisibilityObserver.d.ts +1 -1
- package/dist/{src/devtools → devtools}/createRouterDevtools.d.ts +2 -2
- package/dist/{src/devtools → devtools}/filters.d.ts +1 -1
- package/dist/{src/errors → errors}/contextAbortError.d.ts +1 -1
- package/dist/{src/errors → errors}/contextPushError.d.ts +1 -1
- package/dist/{src/errors → errors}/contextRejectionError.d.ts +1 -1
- package/dist/{src/errors → errors}/invalidRouteParamValueError.d.ts +1 -1
- package/dist/errors/loaderDataAccessError.d.ts +8 -0
- package/dist/errors/loaderNameConflict.d.ts +9 -0
- package/dist/errors/navigationAbandonedError.d.ts +6 -0
- package/dist/{src/guards → guards}/routes.d.ts +2 -2
- package/dist/kitbag-router.d.ts +1 -0
- package/dist/kitbag-router.js +6452 -6172
- package/dist/kitbag-router.umd.cjs +5 -4
- package/dist/{src/main.d.ts → main.d.ts} +10 -2
- package/dist/{src/models → models}/hooks.d.ts +2 -2
- package/dist/services/addLoader.d.ts +40 -0
- package/dist/services/addView.d.ts +37 -0
- package/dist/{src/services → services}/arrayOf.d.ts +2 -2
- package/dist/{src/services → services}/combineHash.d.ts +2 -2
- package/dist/{src/services → services}/combinePath.d.ts +2 -2
- package/dist/{src/services → services}/combineQuery.d.ts +2 -2
- package/dist/{src/services → services}/combineState.d.ts +1 -1
- package/dist/{src/services → services}/combineUrl.d.ts +2 -2
- package/dist/{src/services → services}/component.d.ts +3 -4
- package/dist/{src/services → services}/createComponentHooks.d.ts +4 -4
- package/dist/{src/services → services}/createComponentsStore.d.ts +3 -3
- package/dist/{src/services → services}/createCurrentRejection.d.ts +2 -2
- package/dist/services/createCurrentRoute.d.ts +25 -0
- package/dist/services/createDataStore.d.ts +48 -0
- package/dist/{src/services → services}/createExternalRoute.d.ts +4 -4
- package/dist/services/createNavigationStores.d.ts +31 -0
- package/dist/{src/services → services}/createParam.d.ts +3 -3
- package/dist/{src/services → services}/createRejection.d.ts +3 -3
- package/dist/{src/services → services}/createRejectionHooks.d.ts +3 -3
- package/dist/services/createResolvedRoute.d.ts +4 -0
- package/dist/{src/services → services}/createResolvedRouteQuery.d.ts +1 -1
- package/dist/{src/services → services}/createRoute.d.ts +3 -6
- package/dist/{src/services → services}/createRouteHooks.d.ts +5 -5
- package/dist/{src/services → services}/createRouteRedirects.d.ts +2 -2
- package/dist/services/createRouteValueStore.d.ts +56 -0
- package/dist/services/createRouteViews.d.ts +16 -0
- package/dist/{src/services → services}/createRouter.d.ts +3 -3
- package/dist/{src/services → services}/createRouterAssets.d.ts +10 -10
- package/dist/{src/services → services}/createRouterCallbackContext.d.ts +7 -7
- package/dist/{src/services → services}/createRouterHistory.d.ts +1 -1
- package/dist/{src/services → services}/createRouterHooks.d.ts +2 -2
- package/dist/{src/services → services}/createRouterKeyStore.d.ts +1 -1
- package/dist/{src/services → services}/createRouterPlugin.d.ts +3 -3
- package/dist/services/createRouterRoute.d.ts +7 -0
- package/dist/{src/services → services}/createUrl.d.ts +1 -1
- package/dist/services/getGlobalHooksForRouter.d.ts +3 -0
- package/dist/{src/services → services}/getGlobalRouteHooks.d.ts +2 -2
- package/dist/{src/services → services}/getMatchesForUrl.d.ts +3 -3
- package/dist/{src/services → services}/getParamsForString.d.ts +2 -2
- package/dist/services/getRejectionHooks.d.ts +3 -0
- package/dist/{src/services → services}/getRouteHooks.d.ts +2 -2
- package/dist/{src/services → services}/getRoutesForRouter.d.ts +5 -6
- package/dist/{src/services → services}/hooks.d.ts +2 -2
- package/dist/{src/services → services}/insertBaseRoute.d.ts +1 -1
- package/dist/{src/services → services}/literal.d.ts +1 -1
- package/dist/{src/services → services}/params.d.ts +3 -3
- package/dist/{src/services → services}/queryParamFilter.d.ts +1 -1
- package/dist/{src/services → services}/routeRegex.d.ts +1 -1
- package/dist/{src/services → services}/state.d.ts +1 -1
- package/dist/{src/services → services}/tupleOf.d.ts +2 -2
- package/dist/services/unionOf.d.ts +3 -0
- package/dist/{src/services → services}/urlParser.d.ts +2 -2
- package/dist/{src/services → services}/valibot.d.ts +1 -1
- package/dist/{src/services → services}/withDefault.d.ts +2 -2
- package/dist/{src/services → services}/withParams.d.ts +4 -4
- package/dist/services/withRouteMethods.d.ts +7 -0
- package/dist/{src/services → services}/zod.d.ts +2 -2
- package/dist/types/addLoader.d.ts +69 -0
- package/dist/types/addView.d.ts +104 -0
- package/dist/{src/types → types}/createRouteOptions.d.ts +57 -36
- package/dist/{src/types → types}/hooks.d.ts +14 -14
- package/dist/{src/types → types}/paramTypes.d.ts +2 -2
- package/dist/{src/types → types}/params.d.ts +1 -1
- package/dist/{src/types → types}/prefetch.d.ts +1 -0
- package/dist/{src/types → types}/props.d.ts +13 -5
- package/dist/{src/types → types}/register.d.ts +1 -1
- package/dist/{src/types → types}/rejection.d.ts +4 -4
- package/dist/{src/types → types}/resolved.d.ts +24 -5
- package/dist/types/route.d.ts +121 -0
- package/dist/types/routeCallbackContext.d.ts +30 -0
- package/dist/types/routeLoaders.d.ts +30 -0
- package/dist/{src/types → types}/routeTitle.d.ts +1 -1
- package/dist/{src/types → types}/routeUpdate.d.ts +2 -2
- package/dist/types/routeViews.d.ts +44 -0
- package/dist/types/routeWithMethods.d.ts +16 -0
- package/dist/{src/types → types}/routeWithParams.d.ts +3 -3
- package/dist/{src/types → types}/router.d.ts +13 -13
- package/dist/{src/types → types}/routerLink.d.ts +5 -5
- package/dist/{src/types → types}/routerPlugin.d.ts +3 -3
- package/dist/{src/types → types}/routerPush.d.ts +8 -8
- package/dist/{src/types → types}/routerReject.d.ts +1 -1
- package/dist/{src/types → types}/routerReplace.d.ts +8 -8
- package/dist/{src/types → types}/routerResolve.d.ts +7 -7
- package/dist/{src/types → types}/routerRoute.d.ts +9 -3
- package/dist/{src/types → types}/routesMap.d.ts +2 -2
- package/dist/{src/types → types}/state.d.ts +6 -6
- package/dist/{src/types → types}/url.d.ts +6 -6
- package/dist/{src/types → types}/useLink.d.ts +5 -5
- package/dist/{src/types → types}/utilities.d.ts +1 -0
- package/dist/{src/utilities → utilities}/checkDuplicateNames.d.ts +1 -1
- package/dist/utilities/checkDuplicateNames.spec.d.ts +1 -0
- package/dist/utilities/checkDuplicateParams.spec.d.ts +1 -0
- package/dist/utilities/components.spec.d.ts +1 -0
- package/dist/utilities/guards.spec.d.ts +1 -0
- package/dist/utilities/isBrowser.browser.spec.d.ts +1 -0
- package/dist/utilities/isBrowser.spec.d.ts +1 -0
- package/dist/{src/utilities → utilities}/isNamedRoute.d.ts +1 -1
- package/dist/{src/utilities → utilities}/prefetch.d.ts +2 -2
- package/dist/utilities/prefetch.spec.d.ts +1 -0
- package/dist/utilities/props.d.ts +16 -0
- package/dist/{src/utilities → utilities}/setDocumentTitle.d.ts +1 -1
- package/dist/utilities/testHelpers.d.ts +242 -0
- package/dist/utilities/trailingSlashes.spec.d.ts +1 -0
- package/dist/{src/utilities → utilities}/urlSearchParams.d.ts +1 -1
- package/dist/utilities/urlSearchParams.spec.d.ts +1 -0
- package/package.json +18 -16
- package/dist/src/compositions/usePropStore.d.ts +0 -7
- package/dist/src/services/createCurrentRoute.d.ts +0 -13
- package/dist/src/services/createPropStore.d.ts +0 -13
- package/dist/src/services/createResolvedRoute.d.ts +0 -4
- package/dist/src/services/createRouterRoute.d.ts +0 -7
- package/dist/src/services/getGlobalHooksForRouter.d.ts +0 -3
- package/dist/src/services/getRejectionHooks.d.ts +0 -3
- package/dist/src/services/unionOf.d.ts +0 -3
- package/dist/src/types/route.d.ts +0 -80
- package/dist/src/utilities/props.d.ts +0 -6
- package/dist/src/utilities/testHelpers.d.ts +0 -3699
- /package/dist/{src/components → components}/echo.d.ts +0 -0
- /package/dist/{src/components → components}/helloWorld.d.ts +0 -0
- /package/dist/{src/components → components}/rejection.d.ts +0 -0
- /package/dist/{src/components → components}/routerLink.browser.spec.d.ts +0 -0
- /package/dist/{src/components → components}/routerView.browser.spec.d.ts +0 -0
- /package/dist/{src/components → components}/routerView.spec.d.ts +0 -0
- /package/dist/{src/compositions → compositions}/useEventListener.d.ts +0 -0
- /package/dist/{src/compositions → compositions}/useQueryValue.browser.spec.d.ts +0 -0
- /package/dist/{src/compositions → compositions}/useQueryValue.spec-d.d.ts +0 -0
- /package/dist/{src/compositions → compositions}/useRoute.browser.spec.d.ts +0 -0
- /package/dist/{src/compositions → compositions}/useRoute.spec-d.d.ts +0 -0
- /package/dist/{src/devtools → devtools}/getDevtoolsLabel.d.ts +0 -0
- /package/dist/{src/devtools → devtools}/types.d.ts +0 -0
- /package/dist/{src/errors → errors}/contextError.d.ts +0 -0
- /package/dist/{src/errors → errors}/duplicateNamesError.d.ts +0 -0
- /package/dist/{src/errors → errors}/duplicateParamsError.d.ts +0 -0
- /package/dist/{src/errors → errors}/initialRouteMissingError.d.ts +0 -0
- /package/dist/{src/errors → errors}/invalidRouteRedirectError.d.ts +0 -0
- /package/dist/{src/errors → errors}/metaPropertyConflict.d.ts +0 -0
- /package/dist/{src/errors → errors}/multipleRouteRedirectsError.d.ts +0 -0
- /package/dist/{src/errors → errors}/routeNotFoundError.d.ts +0 -0
- /package/dist/{src/errors → errors}/routerNotInstalledError.d.ts +0 -0
- /package/dist/{src/errors → errors}/useRouteInvalidError.d.ts +0 -0
- /package/dist/{src/guards → guards}/routes.spec-d.d.ts +0 -0
- /package/dist/{src/keys.d.ts → keys.d.ts} +0 -0
- /package/dist/{src/services/arrayOf.spec.d.ts → services/addLoader.spec-d.d.ts} +0 -0
- /package/dist/{src/services/combineHash.spec.d.ts → services/addLoader.spec.d.ts} +0 -0
- /package/dist/{src/services/combineMeta.spec.d.ts → services/addView.browser.spec.d.ts} +0 -0
- /package/dist/{src/services/combinePath.spec-d.d.ts → services/addView.spec-d.d.ts} +0 -0
- /package/dist/{src/services/combinePath.spec.d.ts → services/addView.spec.d.ts} +0 -0
- /package/dist/{src/services/combineQuery.spec.d.ts → services/arrayOf.spec.d.ts} +0 -0
- /package/dist/{src/services/combineState.spec.d.ts → services/combineHash.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/combineMeta.d.ts +0 -0
- /package/dist/{src/services/combineUrl.spec.d.ts → services/combineMeta.spec.d.ts} +0 -0
- /package/dist/{src/services/component.browser.spec.d.ts → services/combinePath.spec-d.d.ts} +0 -0
- /package/dist/{src/services/createExternalRoute.spec.d.ts → services/combinePath.spec.d.ts} +0 -0
- /package/dist/{src/services/createIsExternal.spec.d.ts → services/combineQuery.spec.d.ts} +0 -0
- /package/dist/{src/services/createResolvedRoute.spec.d.ts → services/combineState.spec.d.ts} +0 -0
- /package/dist/{src/services/createRoute.spec-d.d.ts → services/combineUrl.spec.d.ts} +0 -0
- /package/dist/{src/services/createRoute.spec.d.ts → services/component.browser.spec.d.ts} +0 -0
- /package/dist/{src/services/createRouteRedirects.spec.d.ts → services/createDataStore.spec.d.ts} +0 -0
- /package/dist/{src/services/createRouter.browser.spec.d.ts → services/createExternalRoute.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/createIsExternal.d.ts +0 -0
- /package/dist/{src/services/createRouter.spec-d.d.ts → services/createIsExternal.spec.d.ts} +0 -0
- /package/dist/{src/services/createRouter.spec.d.ts → services/createNavigationStores.spec.d.ts} +0 -0
- /package/dist/{src/services/createRouterHistory.browser.spec.d.ts → services/createResolvedRoute.spec.d.ts} +0 -0
- /package/dist/{src/services/createRouterPlugin.browser.spec.d.ts → services/createRoute.spec-d.d.ts} +0 -0
- /package/dist/{src/services/createRouterPlugin.spec-d.d.ts → services/createRoute.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/createRouteId.d.ts +0 -0
- /package/dist/{src/services/createRouterRoute.spec.d.ts → services/createRouteRedirects.spec.d.ts} +0 -0
- /package/dist/{src/services/createUrl.spec.d.ts → services/createRouter.browser.spec.d.ts} +0 -0
- /package/dist/{src/services/getInitialUrl.browser.spec.d.ts → services/createRouter.spec-d.d.ts} +0 -0
- /package/dist/{src/services/getInitialUrl.spec.d.ts → services/createRouter.spec.d.ts} +0 -0
- /package/dist/{src/services/getMatchesForUrl.spec.d.ts → services/createRouterHistory.browser.spec.d.ts} +0 -0
- /package/dist/{src/services/getRouteHooks.spec.d.ts → services/createRouterPlugin.browser.spec.d.ts} +0 -0
- /package/dist/{src/services/getRoutesForRouter.spec.d.ts → services/createRouterPlugin.spec-d.d.ts} +0 -0
- /package/dist/{src/services/history.browser.spec.d.ts → services/createRouterRoute.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/createUniqueIdSequence.d.ts +0 -0
- /package/dist/{src/services/hooks.browser.spec.d.ts → services/createUrl.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/createVisibilityObserver.d.ts +0 -0
- /package/dist/{src/services → services}/createVueAppStore.d.ts +0 -0
- /package/dist/{src/services/hooks.spec.d.ts → services/getInitialUrl.browser.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/getInitialUrl.d.ts +0 -0
- /package/dist/{src/services/insertBaseRoute.spec.d.ts → services/getInitialUrl.spec.d.ts} +0 -0
- /package/dist/{src/services/params.spec.d.ts → services/getMatchesForUrl.spec.d.ts} +0 -0
- /package/dist/{src/services/paramsFinder.spec.d.ts → services/getRouteHooks.spec.d.ts} +0 -0
- /package/dist/{src/services/queryParamFilter.spec.d.ts → services/getRoutesForRouter.spec.d.ts} +0 -0
- /package/dist/{src/services/routeRegex.spec.d.ts → services/history.browser.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/history.d.ts +0 -0
- /package/dist/{src/services/state.spec.d.ts → services/hooks.browser.spec.d.ts} +0 -0
- /package/dist/{src/tests → services}/hooks.spec.d.ts +0 -0
- /package/dist/{src/services/tupleOf.spec.d.ts → services/insertBaseRoute.spec.d.ts} +0 -0
- /package/dist/{src/services/unionOf.spec.d.ts → services/params.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/paramsFinder.d.ts +0 -0
- /package/dist/{src/services/urlParser.spec.d.ts → services/paramsFinder.spec.d.ts} +0 -0
- /package/dist/{src/services/valibot.spec-d.d.ts → services/queryParamFilter.spec.d.ts} +0 -0
- /package/dist/{src/services/valibot.spec.d.ts → services/routeRegex.spec.d.ts} +0 -0
- /package/dist/{src/services/withParams.spec-d.d.ts → services/state.spec.d.ts} +0 -0
- /package/dist/{src/services/withParams.spec.d.ts → services/tupleOf.spec.d.ts} +0 -0
- /package/dist/{src/services/zod.spec-d.d.ts → services/unionOf.spec.d.ts} +0 -0
- /package/dist/{src/services/zod.spec.d.ts → services/urlParser.spec.d.ts} +0 -0
- /package/dist/{src/tests/routeProps.browser.spec.d.ts → services/valibot.spec-d.d.ts} +0 -0
- /package/dist/{src/tests/routeProps.spec.d.ts → services/valibot.spec.d.ts} +0 -0
- /package/dist/{src/types/redirects.spec-d.d.ts → services/withParams.spec-d.d.ts} +0 -0
- /package/dist/{src/types/register.spec.d.ts → services/withParams.spec.d.ts} +0 -0
- /package/dist/{src/types/resolved.spec-d.d.ts → services/zod.spec-d.d.ts} +0 -0
- /package/dist/{src/types/route.spec-d.d.ts → services/zod.spec.d.ts} +0 -0
- /package/dist/{src/types/routeTitle.browser.spec.d.ts → tests/hooks.spec.d.ts} +0 -0
- /package/dist/{src/types/routeWithParams.spec-d.d.ts → tests/routeLoaders.browser.spec.d.ts} +0 -0
- /package/dist/{src/types/routesMap.spec-ts.d.ts → tests/routeLoaders.spec.d.ts} +0 -0
- /package/dist/{src/utilities/checkDuplicateNames.spec.d.ts → tests/routeProps.browser.spec.d.ts} +0 -0
- /package/dist/{src/utilities/checkDuplicateParams.spec.d.ts → tests/routeProps.spec.d.ts} +0 -0
- /package/dist/{src/types → types}/callbackContext.d.ts +0 -0
- /package/dist/{src/types → types}/meta.d.ts +0 -0
- /package/dist/{src/types → types}/name.d.ts +0 -0
- /package/dist/{src/types → types}/querySource.d.ts +0 -0
- /package/dist/{src/types → types}/redirects.d.ts +0 -0
- /package/dist/{src/utilities/components.spec.d.ts → types/redirects.spec-d.d.ts} +0 -0
- /package/dist/{src/utilities/guards.spec.d.ts → types/register.spec.d.ts} +0 -0
- /package/dist/{src/utilities/isBrowser.browser.spec.d.ts → types/resolved.spec-d.d.ts} +0 -0
- /package/dist/{src/utilities/isBrowser.spec.d.ts → types/route.spec-d.d.ts} +0 -0
- /package/dist/{src/types → types}/routeContext.d.ts +0 -0
- /package/dist/{src/utilities/prefetch.spec.d.ts → types/routeTitle.browser.spec.d.ts} +0 -0
- /package/dist/{src/utilities/trailingSlashes.spec.d.ts → types/routeWithParams.spec-d.d.ts} +0 -0
- /package/dist/{src/types → types}/routerAbort.d.ts +0 -0
- /package/dist/{src/utilities/urlSearchParams.spec.d.ts → types/routesMap.spec-ts.d.ts} +0 -0
- /package/dist/{src/types → types}/urlString.d.ts +0 -0
- /package/dist/{src/utilities → utilities}/array.d.ts +0 -0
- /package/dist/{src/utilities → utilities}/checkDuplicateParams.d.ts +0 -0
- /package/dist/{src/utilities → utilities}/components.d.ts +0 -0
- /package/dist/{src/utilities → utilities}/guards.d.ts +0 -0
- /package/dist/{src/utilities → utilities}/index.d.ts +0 -0
- /package/dist/{src/utilities → utilities}/isBrowser.d.ts +0 -0
- /package/dist/{src/utilities → utilities}/makeOptional.d.ts +0 -0
- /package/dist/{src/utilities → utilities}/promises.d.ts +0 -0
- /package/dist/{src/utilities → utilities}/trailingSlashes.d.ts +0 -0
|
@@ -1,7 +1,12 @@
|
|
|
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 {
|
|
3
|
+
export type { WithHost, WithoutHost, WithParent, WithoutParent, CreateRouteOptions, PropsGetter, RouterViewPropsGetter, CreateRouteProps, ToRoute } from './types/createRouteOptions';
|
|
4
|
+
export type { RouteAddView, AddViewOptions, AddViewPropsGetter, AddViewPropsCallbackContext } from './types/addView';
|
|
5
|
+
export type { RouteAddLoader, AddLoaderOptions, LoaderGetter } from './types/addLoader';
|
|
6
|
+
export type { RouteCallbackContext } from './types/routeCallbackContext';
|
|
7
|
+
export type { RouteViews } from './types/routeViews';
|
|
8
|
+
export type { RouteLoader, RouteLoaders } from './types/routeLoaders';
|
|
9
|
+
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
10
|
export * from './types/paramTypes';
|
|
6
11
|
export * from './types/prefetch';
|
|
7
12
|
export * from './types/props';
|
|
@@ -26,7 +31,10 @@ export * from './types/urlString';
|
|
|
26
31
|
export type { Url, CreateUrlOptions, ParseUrlOptions } from './types/url';
|
|
27
32
|
export * from './types/useLink';
|
|
28
33
|
export { DuplicateParamsError } from './errors/duplicateParamsError';
|
|
34
|
+
export { LoaderDataAccessError } from './errors/loaderDataAccessError';
|
|
35
|
+
export { LoaderNameConflict } from './errors/loaderNameConflict';
|
|
29
36
|
export { MetaPropertyConflict } from './errors/metaPropertyConflict';
|
|
37
|
+
export { NavigationAbandonedError } from './errors/navigationAbandonedError';
|
|
30
38
|
export { RouterNotInstalledError } from './errors/routerNotInstalledError';
|
|
31
39
|
export { UseRouteInvalidError } from './errors/useRouteInvalidError';
|
|
32
40
|
export { createRoute } from './services/createRoute';
|
|
@@ -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>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { PrefetchConfig } from '../types/prefetch';
|
|
2
|
+
import { CreatedRouteOptions, Route } from '../types/route';
|
|
3
|
+
import { AnyFunction } from '../types/utilities';
|
|
4
|
+
export declare const DEFAULT_LOADER_NAME = "default";
|
|
5
|
+
/**
|
|
6
|
+
* The loose runtime shape of the `addLoader` options. Purposely wide: the name type each
|
|
7
|
+
* `RouteAddLoader` describes is refined per route.
|
|
8
|
+
*/
|
|
9
|
+
type LoaderOptions = {
|
|
10
|
+
name?: string;
|
|
11
|
+
prefetch?: PrefetchConfig;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The runtime arguments accepted by `addLoader`.
|
|
15
|
+
*/
|
|
16
|
+
type AddLoaderParameters = [load: AnyFunction, options?: LoaderOptions];
|
|
17
|
+
/**
|
|
18
|
+
* The loose runtime signature of the `addLoader` method. Purposely wide: it returns Route rather than the
|
|
19
|
+
* refined chainable route each `RouteAddLoader` overload describes.
|
|
20
|
+
*/
|
|
21
|
+
export type AddLoader = (...args: AddLoaderParameters) => Route;
|
|
22
|
+
type Loader = {
|
|
23
|
+
name: string;
|
|
24
|
+
load: AnyFunction;
|
|
25
|
+
prefetch: PrefetchConfig | undefined;
|
|
26
|
+
};
|
|
27
|
+
export declare function toLoader(load: AnyFunction, options: LoaderOptions | undefined): Loader;
|
|
28
|
+
/**
|
|
29
|
+
* Returns a new match with the loader merged into its loaders under the loader's name.
|
|
30
|
+
*
|
|
31
|
+
* Matches are `markRaw` so that making a route reactive does not turn its loaders into reactive proxies.
|
|
32
|
+
* Spreading a match drops that, so the rebuilt one is marked again.
|
|
33
|
+
*/
|
|
34
|
+
export declare function addLoaderToMatch(match: CreatedRouteOptions, { name, load, prefetch }: Loader): CreatedRouteOptions;
|
|
35
|
+
/**
|
|
36
|
+
* A route's data combines the loaders of every match, so a name an ancestor already uses would be
|
|
37
|
+
* ambiguous. Adding a loader the route itself already has is an override, and allowed.
|
|
38
|
+
*/
|
|
39
|
+
export declare function checkForLoaderConflict(ancestors: CreatedRouteOptions[], name: string): void;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
import { PropsGetter } from '../types/createRouteOptions';
|
|
3
|
+
import { PrefetchConfig } from '../types/prefetch';
|
|
4
|
+
import { CreatedRouteOptions, Route } from '../types/route';
|
|
5
|
+
/**
|
|
6
|
+
* The loose runtime shape of the `addView` options. Purposely wide: the getter and name types each
|
|
7
|
+
* `RouteAddView` describes are refined per route and component.
|
|
8
|
+
*/
|
|
9
|
+
type ViewOptions = {
|
|
10
|
+
name?: string;
|
|
11
|
+
props?: PropsGetter;
|
|
12
|
+
prefetch?: PrefetchConfig;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The runtime arguments accepted by `addView`.
|
|
16
|
+
*/
|
|
17
|
+
type AddViewParameters = [component: Component, options?: ViewOptions];
|
|
18
|
+
/**
|
|
19
|
+
* The loose runtime signature of the `addView` method. Purposely wide: it returns Route rather than the
|
|
20
|
+
* refined chainable route each `RouteAddView` overload describes.
|
|
21
|
+
*/
|
|
22
|
+
export type AddView = (...args: AddViewParameters) => Route;
|
|
23
|
+
type View = {
|
|
24
|
+
name: string;
|
|
25
|
+
component: Component;
|
|
26
|
+
props: PropsGetter | undefined;
|
|
27
|
+
prefetch: PrefetchConfig | undefined;
|
|
28
|
+
};
|
|
29
|
+
export declare function toView(component: Component, options: ViewOptions | undefined): View;
|
|
30
|
+
/**
|
|
31
|
+
* Returns a new match with the view merged into its views under the view's name.
|
|
32
|
+
*
|
|
33
|
+
* Matches are `markRaw` so that making a route reactive does not turn its components into reactive
|
|
34
|
+
* proxies. Spreading a match drops that, so the rebuilt one is marked again.
|
|
35
|
+
*/
|
|
36
|
+
export declare function addViewToMatch(match: CreatedRouteOptions, { name, component, props, prefetch }: View): CreatedRouteOptions;
|
|
37
|
+
export {};
|
|
@@ -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,12 +1,11 @@
|
|
|
1
1
|
import { AsyncComponentLoader, Component, FunctionalComponent, InjectionKey } from 'vue';
|
|
2
|
-
import {
|
|
3
|
-
import { Router } from '../../types/router';
|
|
2
|
+
import { Router } from '../types/router';
|
|
4
3
|
type Constructor = new (...args: any) => any;
|
|
5
4
|
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
5
|
type CreateComponentWrapperConfig = {
|
|
7
|
-
|
|
6
|
+
id: string;
|
|
8
7
|
name: string;
|
|
9
8
|
component: Component;
|
|
10
9
|
};
|
|
11
|
-
export declare function createComponentPropsWrapper(routerKey: InjectionKey<Router>, {
|
|
10
|
+
export declare function createComponentPropsWrapper(routerKey: InjectionKey<Router>, { id, name, component }: CreateComponentWrapperConfig): Component;
|
|
12
11
|
export {};
|
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
import { Component, InjectionKey } from 'vue';
|
|
2
|
-
import {
|
|
3
|
-
import { Router } from '
|
|
2
|
+
import { RouteViews } from '../types/routeViews';
|
|
3
|
+
import { Router } from '../types/router';
|
|
4
4
|
export type ComponentsStore = {
|
|
5
|
-
getRouteComponents: (
|
|
5
|
+
getRouteComponents: (id: string, views: RouteViews) => Record<string, Component>;
|
|
6
6
|
};
|
|
7
7
|
export declare function createComponentsStore<TRouter extends Router>(routerKey: InjectionKey<TRouter>): ComponentsStore;
|
|
@@ -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 = {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { InjectionKey } from 'vue';
|
|
2
|
+
import { RouteValueStore } from './createRouteValueStore';
|
|
3
|
+
import { Router, RouterRouteUnion } from '../types/router';
|
|
4
|
+
import { ResolvedRoute, WithData } from '../types/resolved';
|
|
5
|
+
import { Routes } from '../types/route';
|
|
6
|
+
import { RouterPush } from '../types/routerPush';
|
|
7
|
+
type ResolvedRouteUpdate = (route: ResolvedRoute) => void;
|
|
8
|
+
type CurrentRouteContext<TRoutes extends Routes = Routes> = {
|
|
9
|
+
currentRoute: ResolvedRoute & WithData;
|
|
10
|
+
routerRoute: RouterRouteUnion<TRoutes>;
|
|
11
|
+
updateRoute: ResolvedRouteUpdate;
|
|
12
|
+
};
|
|
13
|
+
type CurrentRouteOptions = {
|
|
14
|
+
routerKey: InjectionKey<Router>;
|
|
15
|
+
fallbackRoute: ResolvedRoute;
|
|
16
|
+
push: RouterPush;
|
|
17
|
+
getData: RouteValueStore['getData'];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The route the router is on. Data is read from the store as a route becomes current, which is the only
|
|
21
|
+
* route whose data anything computes — so a caller hands over whatever it resolved and does not have to
|
|
22
|
+
* know that data is attached at all.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createCurrentRoute<TRoutes extends Routes>(options: CurrentRouteOptions): CurrentRouteContext<TRoutes>;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export type DataResultValue = {
|
|
2
|
+
kind: 'value';
|
|
3
|
+
value: unknown;
|
|
4
|
+
};
|
|
5
|
+
export type DataResultError = {
|
|
6
|
+
kind: 'error';
|
|
7
|
+
error: unknown;
|
|
8
|
+
};
|
|
9
|
+
export type DataResultPending = {
|
|
10
|
+
kind: 'pending';
|
|
11
|
+
};
|
|
12
|
+
export type DataResultRunning = {
|
|
13
|
+
kind: 'running';
|
|
14
|
+
};
|
|
15
|
+
export type DataResultMissing = {
|
|
16
|
+
kind: 'missing';
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Where a key has got to: nothing has asked for it, something is waiting on it, its getter is in flight,
|
|
20
|
+
* or how that getter settled. Tagged so that a getter returning `undefined` or an `Error` stays a value.
|
|
21
|
+
*/
|
|
22
|
+
export type DataResult = DataResultValue | DataResultError | DataResultPending | DataResultRunning | DataResultMissing;
|
|
23
|
+
/**
|
|
24
|
+
* A set of values that live and die together. A link owns one for whatever it points at, and the current
|
|
25
|
+
* navigation owns one.
|
|
26
|
+
*/
|
|
27
|
+
export type DataStore = {
|
|
28
|
+
/**
|
|
29
|
+
* The value for a key, whether or not anything has computed it yet. Subscribing to a key nobody has set
|
|
30
|
+
* leaves a promise waiting for whoever does.
|
|
31
|
+
*/
|
|
32
|
+
subscribe: (key: string) => Promise<unknown>;
|
|
33
|
+
/**
|
|
34
|
+
* Computes a key, unless something already has. A key promoted from another store while its getter is
|
|
35
|
+
* still running is left alone, so navigation adopts it rather than computing it a second time.
|
|
36
|
+
*/
|
|
37
|
+
set: (key: string, getter: () => unknown) => void;
|
|
38
|
+
/**
|
|
39
|
+
* What is known about a key, without waiting for it. Reactive, and readable during render.
|
|
40
|
+
*/
|
|
41
|
+
get: (key: string) => DataResult;
|
|
42
|
+
/**
|
|
43
|
+
* Ends the store. Every value is rejected so that anything waiting on one resumes rather than staying
|
|
44
|
+
* suspended, then discarded.
|
|
45
|
+
*/
|
|
46
|
+
dispose: (reason: Error) => void;
|
|
47
|
+
};
|
|
48
|
+
export declare function createDataStore(): DataStore;
|
|
@@ -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>>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { DataStore } from './createDataStore';
|
|
2
|
+
import { ResolvedRoute } from '../types/resolved';
|
|
3
|
+
/**
|
|
4
|
+
* Which store the rendered route reads from, and which one the next navigation will adopt.
|
|
5
|
+
*
|
|
6
|
+
* A navigation gets its own store so the one it replaces can be disposed outright. A followed link stages
|
|
7
|
+
* the store it prefetched into, which the navigation it triggers picks up — staged rather than handed over
|
|
8
|
+
* directly because a link is followed before that navigation starts.
|
|
9
|
+
*/
|
|
10
|
+
export type NavigationStores = {
|
|
11
|
+
/**
|
|
12
|
+
* The store the rendered route reads props from.
|
|
13
|
+
*/
|
|
14
|
+
current: () => DataStore;
|
|
15
|
+
/**
|
|
16
|
+
* Parks a followed link's store for the navigation it triggered. A store already parked is disposed,
|
|
17
|
+
* since following a second link before the first navigation arrives abandons the first.
|
|
18
|
+
*/
|
|
19
|
+
stage: (store: DataStore) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Swaps in the staged store, or a fresh one, and hands back the store being replaced for disposal.
|
|
22
|
+
*/
|
|
23
|
+
promote: () => DataStore;
|
|
24
|
+
};
|
|
25
|
+
export declare function createNavigationStores(): NavigationStores;
|
|
26
|
+
/**
|
|
27
|
+
* What a stored value is: the props of a view, or the data of a loader. Part of the key so that a view
|
|
28
|
+
* and a loader sharing a name on the same route are still two values.
|
|
29
|
+
*/
|
|
30
|
+
export type DataKind = 'props' | 'loader';
|
|
31
|
+
export declare function getDataKey(kind: DataKind, id: string, name: string, route: ResolvedRoute): string;
|
|
@@ -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 { 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;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RouterResolveOptions } from '../types/routerResolve';
|
|
2
|
+
import { ResolvedRoute } from '../types/resolved';
|
|
3
|
+
import { Route } from '../types/route';
|
|
4
|
+
export declare function createResolvedRoute(route: Route, params?: Record<string, unknown>, options?: RouterResolveOptions): ResolvedRoute;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { CreateRouteOptions, PropsGetter, CreateRouteProps,
|
|
2
|
-
import {
|
|
3
|
-
import { ExtractRouteContext } from '../../types/routeContext';
|
|
4
|
-
import { RouteRedirects } from '../../types/redirects';
|
|
5
|
-
import { RouteSetTitle } from '../../types/routeTitle';
|
|
1
|
+
import { CreateRouteOptions, PropsGetter, CreateRouteProps, ToRouteMatches, ToRouteUrl, RouterViewPropsGetter } from '../types/createRouteOptions';
|
|
2
|
+
import { RouteWithMethods } from '../types/routeWithMethods';
|
|
6
3
|
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
|
-
export declare function createRoute<const TOptions extends CreateRouteOptions, const TProps extends CreateRouteProps<TOptions>>(options: TOptions, ...args: CreateRouteWithProps<TOptions, TProps>):
|
|
4
|
+
export declare function createRoute<const TOptions extends CreateRouteOptions, const TProps extends CreateRouteProps<TOptions>>(options: TOptions, ...args: CreateRouteWithProps<TOptions, TProps>): RouteWithMethods<ToRouteUrl<TOptions>, ToRouteMatches<TOptions, TProps>>;
|
|
8
5
|
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.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { PrefetchConfigs, PrefetchStrategy } from '../types/prefetch';
|
|
2
|
+
import { ResolvedRoute, WithData } from '../types/resolved';
|
|
3
|
+
import { HasVueAppStore } from './createVueAppStore';
|
|
4
|
+
import { CallbackContextPush, CallbackContextReject, CallbackContextSuccess } from '../types/callbackContext';
|
|
5
|
+
import { PropsResult } from '../utilities/props';
|
|
6
|
+
import { MaybePromise } from '../types/utilities';
|
|
7
|
+
/**
|
|
8
|
+
* A navigation that was superseded before its values settled. The navigation that replaced it owns the
|
|
9
|
+
* outcome, so this one reports that it went nowhere rather than a success it never had.
|
|
10
|
+
*/
|
|
11
|
+
type RouteValueAbandoned = {
|
|
12
|
+
status: 'ABANDONED';
|
|
13
|
+
};
|
|
14
|
+
export type RouteValueResponse = CallbackContextSuccess | CallbackContextPush | CallbackContextReject | RouteValueAbandoned;
|
|
15
|
+
/**
|
|
16
|
+
* How a navigation's props and loaders settled. Reported separately because props are what a view renders
|
|
17
|
+
* with while loaders hold nothing up, so a slow loader must not be what decides when props are known.
|
|
18
|
+
*/
|
|
19
|
+
export type RouteValueResponses = {
|
|
20
|
+
props: Promise<RouteValueResponse>;
|
|
21
|
+
loaders: Promise<RouteValueResponse>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* A link's own bucket of prefetched values, handed to the current navigation when the link is followed and
|
|
25
|
+
* discarded otherwise.
|
|
26
|
+
*/
|
|
27
|
+
export type PrefetchStore = {
|
|
28
|
+
/**
|
|
29
|
+
* Computes props for views whose prefetch option matches the given strategy.
|
|
30
|
+
*/
|
|
31
|
+
prefetch: (strategy: PrefetchStrategy, route: ResolvedRoute, configs: PrefetchConfigs) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Stages the prefetched store for the next navigation to adopt.
|
|
34
|
+
*/
|
|
35
|
+
commit: () => void;
|
|
36
|
+
/**
|
|
37
|
+
* Abandons what was prefetched and starts over, for a link that now points somewhere else.
|
|
38
|
+
*/
|
|
39
|
+
reset: () => void;
|
|
40
|
+
/**
|
|
41
|
+
* Abandons what was prefetched, for a link that is gone.
|
|
42
|
+
*/
|
|
43
|
+
dispose: () => void;
|
|
44
|
+
};
|
|
45
|
+
export type RouteValueStore = HasVueAppStore & {
|
|
46
|
+
createPrefetchStore: () => PrefetchStore;
|
|
47
|
+
setRouteValues: (route: ResolvedRoute) => RouteValueResponses;
|
|
48
|
+
getProps: (id: string, name: string, route: ResolvedRoute) => MaybePromise<PropsResult>;
|
|
49
|
+
/**
|
|
50
|
+
* What a route exposes as `data`. Resolved per read rather than captured, so it stays correct as
|
|
51
|
+
* navigations replace the store its values live in.
|
|
52
|
+
*/
|
|
53
|
+
getData: (route: ResolvedRoute) => WithData['data'];
|
|
54
|
+
};
|
|
55
|
+
export declare function createRouteValueStore(): RouteValueStore;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CreateRouteOptions, CreateRouteProps } from '../types/createRouteOptions';
|
|
2
|
+
import { RouteViews } from '../types/routeViews';
|
|
3
|
+
export declare const DEFAULT_VIEW_NAME = "default";
|
|
4
|
+
/**
|
|
5
|
+
* Builds the initial views for a route, seeding components from the (deprecated) `component`/`components`
|
|
6
|
+
* options and prop getters from the props argument. Subsequent views are added via the route's `addView`.
|
|
7
|
+
*
|
|
8
|
+
* This is where the props argument's two shapes — a single getter for the unnamed view, or a record keyed
|
|
9
|
+
* by view name — are normalized, so the rest of the router only deals with views keyed by name.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createRouteViews(options: CreateRouteOptions, props?: CreateRouteProps): RouteViews;
|
|
12
|
+
/**
|
|
13
|
+
* The names of the views that have a props getter. A view without one is never computed, so waiting on it
|
|
14
|
+
* would never settle.
|
|
15
|
+
*/
|
|
16
|
+
export declare function viewNamesWithProps(views: RouteViews): string[];
|
|
@@ -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>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { InjectionKey } from 'vue';
|
|
2
|
+
import { ResolvedRoute, WithData } 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 & WithData>(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>;
|