@kitbag/router 0.24.3 → 0.26.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 +3 -3
- package/dist/compositions/useHasSuspenseBoundary.d.ts +4 -0
- package/dist/compositions/useIsServerRendering.d.ts +5 -0
- package/dist/compositions/useRouteValueStore.d.ts +7 -0
- package/dist/errors/contextRedirectError.d.ts +7 -0
- package/dist/errors/loaderDataAccessError.d.ts +8 -0
- package/dist/errors/loaderNameConflict.d.ts +9 -0
- package/dist/errors/navigationAbandonedError.d.ts +7 -0
- package/dist/errors/payloadValueError.d.ts +9 -0
- package/dist/errors/ssrOptionRequiredError.d.ts +7 -0
- package/dist/errors/unsupportedSchemaVendorError.d.ts +7 -0
- package/dist/errors/updateWithoutRouteError.d.ts +7 -0
- package/dist/kitbag-router.d.ts +1 -1
- package/dist/kitbag-router.js +2262 -1764
- package/dist/kitbag-router.umd.cjs +5 -4
- package/dist/{src/main.d.ts → main.d.ts} +10 -0
- package/dist/services/addLoader.d.ts +43 -0
- package/dist/services/addView.d.ts +40 -0
- package/dist/{src/services → services}/component.d.ts +2 -3
- package/dist/services/createActivityTracker.d.ts +6 -0
- package/dist/{src/services → services}/createComponentsStore.d.ts +2 -2
- package/dist/{src/services → services}/createCurrentRejection.d.ts +0 -3
- package/dist/services/createCurrentRoute.d.ts +25 -0
- package/dist/services/createDataStore.d.ts +48 -0
- package/dist/services/createNavigationIds.d.ts +6 -0
- package/dist/services/createNavigationStores.d.ts +36 -0
- package/dist/services/createRejection.d.ts +4 -0
- package/dist/{src/services → services}/createRoute.d.ts +3 -6
- package/dist/{src/services → services}/createRouteHooks.d.ts +1 -1
- package/dist/services/createRouteValueStore.d.ts +88 -0
- package/dist/services/createRouteViews.d.ts +16 -0
- package/dist/{src/services → services}/createRouterCallbackContext.d.ts +1 -1
- package/dist/{src/services → services}/createRouterRoute.d.ts +2 -2
- package/dist/services/createServerRedirect.d.ts +14 -0
- package/dist/services/getComputations.d.ts +40 -0
- package/dist/services/getGlobalRouteHooks.d.ts +4 -0
- package/dist/{src/services → services}/getRouteHooks.d.ts +2 -2
- package/dist/{src/services → services}/getRoutesForRouter.d.ts +3 -2
- package/dist/{src/services → services}/hooks.d.ts +1 -1
- package/dist/services/payload.d.ts +86 -0
- package/dist/services/standardSchema.d.ts +21 -0
- package/dist/{src/services → services}/urlParser.d.ts +5 -0
- package/dist/services/withRouteMethods.d.ts +7 -0
- package/dist/services/zod.spec.d.ts +1 -0
- package/dist/tests/hooks.spec.d.ts +1 -0
- package/dist/tests/hydration.browser.spec.d.ts +1 -0
- package/dist/tests/render.spec.d.ts +1 -0
- package/dist/tests/routeLoaders.browser.spec.d.ts +1 -0
- package/dist/tests/routeLoaders.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/addLoader.d.ts +70 -0
- package/dist/types/addView.d.ts +109 -0
- package/dist/{src/types → types}/callbackContext.d.ts +9 -0
- package/dist/{src/types → types}/createRouteOptions.d.ts +45 -24
- package/dist/{src/types → types}/hooks.d.ts +16 -17
- package/dist/{src/types → types}/paramTypes.d.ts +2 -3
- 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 +12 -4
- package/dist/{src/types → types}/redirects.d.ts +11 -3
- package/dist/types/redirects.spec-d.d.ts +1 -0
- package/dist/types/register.spec.d.ts +1 -0
- package/dist/{src/types → types}/rejection.d.ts +24 -4
- package/dist/{src/types → types}/resolved.d.ts +25 -4
- package/dist/types/resolved.spec-d.d.ts +1 -0
- package/dist/types/route.d.ts +121 -0
- package/dist/types/route.spec-d.d.ts +1 -0
- package/dist/types/routeCallbackContext.d.ts +30 -0
- package/dist/types/routeLoaders.d.ts +32 -0
- package/dist/types/routeTitle.browser.spec.d.ts +1 -0
- package/dist/{src/types → types}/routeTitle.d.ts +2 -1
- package/dist/types/routeViews.d.ts +46 -0
- package/dist/types/routeWithMethods.d.ts +16 -0
- package/dist/types/routeWithParams.spec-d.d.ts +1 -0
- package/dist/{src/types → types}/router.d.ts +95 -3
- package/dist/{src/types → types}/routerPlugin.d.ts +8 -4
- package/dist/types/routerReject.d.ts +15 -0
- package/dist/{src/types → types}/routerRoute.d.ts +7 -1
- package/dist/types/routesMap.spec-ts.d.ts +1 -0
- package/dist/types/serverRenderResponse.spec-d.d.ts +1 -0
- package/dist/{src/types → types}/utilities.d.ts +1 -0
- package/dist/utilities/checkDuplicateNames.spec.d.ts +1 -0
- package/dist/utilities/checkDuplicateParams.spec.d.ts +1 -0
- package/dist/utilities/components.d.ts +18 -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}/prefetch.d.ts +1 -1
- package/dist/utilities/prefetch.spec.d.ts +1 -0
- package/dist/utilities/props.d.ts +16 -0
- package/dist/utilities/setDocumentTitle.d.ts +1 -0
- package/dist/utilities/testHelpers.d.ts +242 -0
- package/dist/utilities/trailingSlashes.spec.d.ts +1 -0
- package/dist/utilities/urlSearchParams.spec.d.ts +1 -0
- package/package.json +17 -22
- 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/createRejection.d.ts +0 -8
- package/dist/src/services/getGlobalRouteHooks.d.ts +0 -4
- package/dist/src/services/valibot.d.ts +0 -7
- package/dist/src/services/zod.d.ts +0 -11
- package/dist/src/types/route.d.ts +0 -80
- package/dist/src/types/routerReject.d.ts +0 -2
- package/dist/src/utilities/components.d.ts +0 -6
- package/dist/src/utilities/props.d.ts +0 -6
- package/dist/src/utilities/setDocumentTitle.d.ts +0 -2
- 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.d.ts +0 -0
- /package/dist/{src/components → components}/routerView.spec.d.ts +0 -0
- /package/dist/{src/compositions → compositions}/useComponentsStore.d.ts +0 -0
- /package/dist/{src/compositions → compositions}/useEventListener.d.ts +0 -0
- /package/dist/{src/compositions/useQueryValue.browser.spec.d.ts → compositions/useHasSuspenseBoundary.browser.spec.d.ts} +0 -0
- /package/dist/{src/compositions/useQueryValue.spec-d.d.ts → compositions/useIsServerRendering.browser.spec.d.ts} +0 -0
- /package/dist/{src/compositions/useRoute.browser.spec.d.ts → compositions/useIsServerRendering.spec.d.ts} +0 -0
- /package/dist/{src/compositions → compositions}/useLink.d.ts +0 -0
- /package/dist/{src/compositions → compositions}/usePrefetching.d.ts +0 -0
- /package/dist/{src/compositions/useRoute.spec-d.d.ts → compositions/useQueryValue.browser.spec.d.ts} +0 -0
- /package/dist/{src/compositions → compositions}/useQueryValue.d.ts +0 -0
- /package/dist/{src/guards/routes.spec-d.d.ts → compositions/useQueryValue.spec-d.d.ts} +0 -0
- /package/dist/{src/compositions → compositions}/useRejection.d.ts +0 -0
- /package/dist/{src/services/arrayOf.spec.d.ts → compositions/useRoute.browser.spec.d.ts} +0 -0
- /package/dist/{src/compositions → compositions}/useRoute.d.ts +0 -0
- /package/dist/{src/services/combineHash.spec.d.ts → compositions/useRoute.spec-d.d.ts} +0 -0
- /package/dist/{src/compositions → compositions}/useRouter.d.ts +0 -0
- /package/dist/{src/compositions → compositions}/useRouterDepth.d.ts +0 -0
- /package/dist/{src/compositions → compositions}/useRouterHooks.d.ts +0 -0
- /package/dist/{src/compositions → compositions}/useVisibilityObserver.d.ts +0 -0
- /package/dist/{src/devtools → devtools}/createRouterDevtools.d.ts +0 -0
- /package/dist/{src/devtools → devtools}/filters.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}/contextAbortError.d.ts +0 -0
- /package/dist/{src/errors → errors}/contextError.d.ts +0 -0
- /package/dist/{src/errors → errors}/contextPushError.d.ts +0 -0
- /package/dist/{src/errors → errors}/contextRejectionError.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}/invalidRouteParamValueError.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.d.ts +0 -0
- /package/dist/{src/services/combineMeta.spec.d.ts → guards/routes.spec-d.d.ts} +0 -0
- /package/dist/{src/keys.d.ts → keys.d.ts} +0 -0
- /package/dist/{src/models → models}/hooks.d.ts +0 -0
- /package/dist/{src/services/combinePath.spec-d.d.ts → services/addLoader.spec-d.d.ts} +0 -0
- /package/dist/{src/services/combinePath.spec.d.ts → services/addLoader.spec.d.ts} +0 -0
- /package/dist/{src/services/combineQuery.spec.d.ts → services/addView.browser.spec.d.ts} +0 -0
- /package/dist/{src/services/combineState.spec.d.ts → services/addView.spec-d.d.ts} +0 -0
- /package/dist/{src/services/combineUrl.spec.d.ts → services/addView.spec.d.ts} +0 -0
- /package/dist/{src/services/component.browser.spec.d.ts → services/arktype.spec-d.d.ts} +0 -0
- /package/dist/{src/services/createExternalRoute.spec.d.ts → services/arktype.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/arrayOf.d.ts +0 -0
- /package/dist/{src/services/createIsExternal.spec.d.ts → services/arrayOf.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/combineHash.d.ts +0 -0
- /package/dist/{src/services/createResolvedRoute.spec.d.ts → services/combineHash.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/combineMeta.d.ts +0 -0
- /package/dist/{src/services/createRoute.spec-d.d.ts → services/combineMeta.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/combinePath.d.ts +0 -0
- /package/dist/{src/services/createRoute.spec.d.ts → services/combinePath.spec-d.d.ts} +0 -0
- /package/dist/{src/services/createRouteRedirects.spec.d.ts → services/combinePath.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/combineQuery.d.ts +0 -0
- /package/dist/{src/services/createRouter.browser.spec.d.ts → services/combineQuery.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/combineState.d.ts +0 -0
- /package/dist/{src/services/createRouter.spec-d.d.ts → services/combineState.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/combineUrl.d.ts +0 -0
- /package/dist/{src/services/createRouter.spec.d.ts → services/combineUrl.spec.d.ts} +0 -0
- /package/dist/{src/services/createRouterHistory.browser.spec.d.ts → services/component.browser.spec.d.ts} +0 -0
- /package/dist/{src/services/createRouterPlugin.browser.spec.d.ts → services/createActivityTracker.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/createComponentHooks.d.ts +0 -0
- /package/dist/{src/services/createRouterPlugin.spec-d.d.ts → services/createDataStore.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/createExternalRoute.d.ts +0 -0
- /package/dist/{src/services/createRouterRoute.spec.d.ts → services/createExternalRoute.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/createIsExternal.d.ts +0 -0
- /package/dist/{src/services/createUrl.spec.d.ts → services/createIsExternal.spec.d.ts} +0 -0
- /package/dist/{src/services/getInitialUrl.browser.spec.d.ts → services/createNavigationIds.spec.d.ts} +0 -0
- /package/dist/{src/services/getInitialUrl.spec.d.ts → services/createNavigationStores.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/createParam.d.ts +0 -0
- /package/dist/{src/services/getMatchesForUrl.spec.d.ts → services/createRejection.spec-d.d.ts} +0 -0
- /package/dist/{src/services/getRouteHooks.spec.d.ts → services/createRejection.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/createRejectionHooks.d.ts +0 -0
- /package/dist/{src/services → services}/createResolvedRoute.d.ts +0 -0
- /package/dist/{src/services/getRoutesForRouter.spec.d.ts → services/createResolvedRoute.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/createResolvedRouteQuery.d.ts +0 -0
- /package/dist/{src/services/history.browser.spec.d.ts → services/createRoute.spec-d.d.ts} +0 -0
- /package/dist/{src/services/hooks.browser.spec.d.ts → services/createRoute.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/createRouteId.d.ts +0 -0
- /package/dist/{src/services → services}/createRouteRedirects.d.ts +0 -0
- /package/dist/{src/services/hooks.spec.d.ts → services/createRouteRedirects.spec.d.ts} +0 -0
- /package/dist/{src/services/insertBaseRoute.spec.d.ts → services/createRouteValueStore.spec.d.ts} +0 -0
- /package/dist/{src/services/params.spec.d.ts → services/createRouter.browser.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/createRouter.d.ts +0 -0
- /package/dist/{src/services/paramsFinder.spec.d.ts → services/createRouter.spec-d.d.ts} +0 -0
- /package/dist/{src/services/queryParamFilter.spec.d.ts → services/createRouter.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/createRouterAssets.d.ts +0 -0
- /package/dist/{src/services/routeRegex.spec.d.ts → services/createRouterHistory.browser.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/createRouterHistory.d.ts +0 -0
- /package/dist/{src/services/state.spec.d.ts → services/createRouterHistory.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/createRouterHooks.d.ts +0 -0
- /package/dist/{src/services → services}/createRouterKeyStore.d.ts +0 -0
- /package/dist/{src/services/tupleOf.spec.d.ts → services/createRouterPlugin.browser.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/createRouterPlugin.d.ts +0 -0
- /package/dist/{src/services/unionOf.spec.d.ts → services/createRouterPlugin.spec-d.d.ts} +0 -0
- /package/dist/{src/services/urlParser.spec.d.ts → services/createRouterRoute.spec.d.ts} +0 -0
- /package/dist/{src/services/valibot.spec-d.d.ts → services/createServerRedirect.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/createUniqueIdSequence.d.ts +0 -0
- /package/dist/{src/services → services}/createUrl.d.ts +0 -0
- /package/dist/{src/services/valibot.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 → services}/getGlobalHooksForRouter.d.ts +0 -0
- /package/dist/{src/services/withParams.spec-d.d.ts → services/getInitialUrl.browser.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/getInitialUrl.d.ts +0 -0
- /package/dist/{src/services/withParams.spec.d.ts → services/getInitialUrl.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/getMatchesForUrl.d.ts +0 -0
- /package/dist/{src/services/zod.spec-d.d.ts → services/getMatchesForUrl.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/getParamsForString.d.ts +0 -0
- /package/dist/{src/services → services}/getRejectionHooks.d.ts +0 -0
- /package/dist/{src/services/zod.spec.d.ts → services/getRouteHooks.spec.d.ts} +0 -0
- /package/dist/{src/tests/hooks.spec.d.ts → services/getRoutesForRouter.spec.d.ts} +0 -0
- /package/dist/{src/tests/routeProps.browser.spec.d.ts → services/history.browser.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/history.d.ts +0 -0
- /package/dist/{src/tests/routeProps.spec.d.ts → services/hooks.browser.spec.d.ts} +0 -0
- /package/dist/{src/types/redirects.spec-d.d.ts → services/hooks.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/insertBaseRoute.d.ts +0 -0
- /package/dist/{src/types/register.spec.d.ts → services/insertBaseRoute.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/literal.d.ts +0 -0
- /package/dist/{src/services → services}/params.d.ts +0 -0
- /package/dist/{src/types/resolved.spec-d.d.ts → services/params.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/paramsFinder.d.ts +0 -0
- /package/dist/{src/types/route.spec-d.d.ts → services/paramsFinder.spec.d.ts} +0 -0
- /package/dist/{src/types/routeTitle.browser.spec.d.ts → services/payload.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/queryParamFilter.d.ts +0 -0
- /package/dist/{src/types/routeWithParams.spec-d.d.ts → services/queryParamFilter.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/routeRegex.d.ts +0 -0
- /package/dist/{src/types/routesMap.spec-ts.d.ts → services/routeRegex.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/state.d.ts +0 -0
- /package/dist/{src/utilities/checkDuplicateNames.spec.d.ts → services/state.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/tupleOf.d.ts +0 -0
- /package/dist/{src/utilities/checkDuplicateParams.spec.d.ts → services/tupleOf.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/unionOf.d.ts +0 -0
- /package/dist/{src/utilities/components.spec.d.ts → services/unionOf.spec.d.ts} +0 -0
- /package/dist/{src/utilities/guards.spec.d.ts → services/urlParser.spec.d.ts} +0 -0
- /package/dist/{src/utilities/isBrowser.browser.spec.d.ts → services/valibot.spec-d.d.ts} +0 -0
- /package/dist/{src/utilities/isBrowser.spec.d.ts → services/valibot.spec.d.ts} +0 -0
- /package/dist/{src/services → services}/withDefault.d.ts +0 -0
- /package/dist/{src/services → services}/withParams.d.ts +0 -0
- /package/dist/{src/utilities/prefetch.spec.d.ts → services/withParams.spec-d.d.ts} +0 -0
- /package/dist/{src/utilities/trailingSlashes.spec.d.ts → services/withParams.spec.d.ts} +0 -0
- /package/dist/{src/utilities/urlSearchParams.spec.d.ts → services/zod.spec-d.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}/register.d.ts +0 -0
- /package/dist/{src/types → types}/routeContext.d.ts +0 -0
- /package/dist/{src/types → types}/routeUpdate.d.ts +0 -0
- /package/dist/{src/types → types}/routeWithParams.d.ts +0 -0
- /package/dist/{src/types → types}/routerAbort.d.ts +0 -0
- /package/dist/{src/types → types}/routerLink.d.ts +0 -0
- /package/dist/{src/types → types}/routerPush.d.ts +0 -0
- /package/dist/{src/types → types}/routerReplace.d.ts +0 -0
- /package/dist/{src/types → types}/routerResolve.d.ts +0 -0
- /package/dist/{src/types → types}/routesMap.d.ts +0 -0
- /package/dist/{src/types → types}/state.d.ts +0 -0
- /package/dist/{src/types → types}/url.d.ts +0 -0
- /package/dist/{src/types → types}/urlString.d.ts +0 -0
- /package/dist/{src/types → types}/useLink.d.ts +0 -0
- /package/dist/{src/utilities → utilities}/array.d.ts +0 -0
- /package/dist/{src/utilities → utilities}/checkDuplicateNames.d.ts +0 -0
- /package/dist/{src/utilities → utilities}/checkDuplicateParams.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}/isNamedRoute.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
- /package/dist/{src/utilities → utilities}/urlSearchParams.d.ts +0 -0
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { RouterAssets } from './services/createRouterAssets';
|
|
2
2
|
import { RegisteredRouter } from './types/register';
|
|
3
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';
|
|
4
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';
|
|
@@ -26,9 +31,14 @@ 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';
|
|
38
|
+
export { PayloadValueError } from './errors/payloadValueError';
|
|
30
39
|
export { RouterNotInstalledError } from './errors/routerNotInstalledError';
|
|
31
40
|
export { UseRouteInvalidError } from './errors/useRouteInvalidError';
|
|
41
|
+
export { SsrOptionRequiredError } from './errors/ssrOptionRequiredError';
|
|
32
42
|
export { createRoute } from './services/createRoute';
|
|
33
43
|
export { createRejection } from './services/createRejection';
|
|
34
44
|
export { createExternalRoute } from './services/createExternalRoute';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { AnyPayloadTransformer } from './payload';
|
|
2
|
+
import { PrefetchConfig } from '../types/prefetch';
|
|
3
|
+
import { CreatedRouteOptions, Route } from '../types/route';
|
|
4
|
+
import { AnyFunction } from '../types/utilities';
|
|
5
|
+
export declare const DEFAULT_LOADER_NAME = "default";
|
|
6
|
+
/**
|
|
7
|
+
* The loose runtime shape of the `addLoader` options. Purposely wide: the name type each
|
|
8
|
+
* `RouteAddLoader` describes is refined per route.
|
|
9
|
+
*/
|
|
10
|
+
type LoaderOptions = {
|
|
11
|
+
name?: string;
|
|
12
|
+
prefetch?: PrefetchConfig;
|
|
13
|
+
transformer?: AnyPayloadTransformer;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The runtime arguments accepted by `addLoader`.
|
|
17
|
+
*/
|
|
18
|
+
type AddLoaderParameters = [load: AnyFunction, options?: LoaderOptions];
|
|
19
|
+
/**
|
|
20
|
+
* The loose runtime signature of the `addLoader` method. Purposely wide: it returns Route rather than the
|
|
21
|
+
* refined chainable route each `RouteAddLoader` overload describes.
|
|
22
|
+
*/
|
|
23
|
+
export type AddLoader = (...args: AddLoaderParameters) => Route;
|
|
24
|
+
type Loader = {
|
|
25
|
+
name: string;
|
|
26
|
+
load: AnyFunction;
|
|
27
|
+
prefetch: PrefetchConfig | undefined;
|
|
28
|
+
transformer: AnyPayloadTransformer | undefined;
|
|
29
|
+
};
|
|
30
|
+
export declare function toLoader(load: AnyFunction, options: LoaderOptions | undefined): Loader;
|
|
31
|
+
/**
|
|
32
|
+
* Returns a new match with the loader merged into its loaders under the loader's name.
|
|
33
|
+
*
|
|
34
|
+
* Matches are `markRaw` so that making a route reactive does not turn its loaders into reactive proxies.
|
|
35
|
+
* Spreading a match drops that, so the rebuilt one is marked again.
|
|
36
|
+
*/
|
|
37
|
+
export declare function addLoaderToMatch(match: CreatedRouteOptions, { name, load, prefetch, transformer }: Loader): CreatedRouteOptions;
|
|
38
|
+
/**
|
|
39
|
+
* A route's data combines the loaders of every match, so a name an ancestor already uses would be
|
|
40
|
+
* ambiguous. Adding a loader the route itself already has is an override, and allowed.
|
|
41
|
+
*/
|
|
42
|
+
export declare function checkForLoaderConflict(ancestors: CreatedRouteOptions[], name: string): void;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
import { AnyPayloadTransformer } from './payload';
|
|
3
|
+
import { PropsGetter } from '../types/createRouteOptions';
|
|
4
|
+
import { PrefetchConfig } from '../types/prefetch';
|
|
5
|
+
import { CreatedRouteOptions, Route } from '../types/route';
|
|
6
|
+
/**
|
|
7
|
+
* The loose runtime shape of the `addView` options. Purposely wide: the getter and name types each
|
|
8
|
+
* `RouteAddView` describes are refined per route and component.
|
|
9
|
+
*/
|
|
10
|
+
type ViewOptions = {
|
|
11
|
+
name?: string;
|
|
12
|
+
props?: PropsGetter;
|
|
13
|
+
prefetch?: PrefetchConfig;
|
|
14
|
+
transformer?: AnyPayloadTransformer;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The runtime arguments accepted by `addView`.
|
|
18
|
+
*/
|
|
19
|
+
type AddViewParameters = [component: Component, options?: ViewOptions];
|
|
20
|
+
/**
|
|
21
|
+
* The loose runtime signature of the `addView` method. Purposely wide: it returns Route rather than the
|
|
22
|
+
* refined chainable route each `RouteAddView` overload describes.
|
|
23
|
+
*/
|
|
24
|
+
export type AddView = (...args: AddViewParameters) => Route;
|
|
25
|
+
type View = {
|
|
26
|
+
name: string;
|
|
27
|
+
component: Component;
|
|
28
|
+
props: PropsGetter | undefined;
|
|
29
|
+
prefetch: PrefetchConfig | undefined;
|
|
30
|
+
transformer: AnyPayloadTransformer | undefined;
|
|
31
|
+
};
|
|
32
|
+
export declare function toView(component: Component, options: ViewOptions | undefined): View;
|
|
33
|
+
/**
|
|
34
|
+
* Returns a new match with the view merged into its views under the view's name.
|
|
35
|
+
*
|
|
36
|
+
* Matches are `markRaw` so that making a route reactive does not turn its components into reactive
|
|
37
|
+
* proxies. Spreading a match drops that, so the rebuilt one is marked again.
|
|
38
|
+
*/
|
|
39
|
+
export declare function addViewToMatch(match: CreatedRouteOptions, { name, component, props, prefetch, transformer }: View): CreatedRouteOptions;
|
|
40
|
+
export {};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { AsyncComponentLoader, Component, FunctionalComponent, InjectionKey } from 'vue';
|
|
2
|
-
import { CreatedRouteOptions } from '../types/route';
|
|
3
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 {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type ActivityTracker = {
|
|
2
|
+
add: (...work: Promise<unknown>[]) => void;
|
|
3
|
+
wrap: <TArgs extends unknown[], TResult>(fn: (...args: TArgs) => Promise<TResult>) => (...args: TArgs) => Promise<TResult>;
|
|
4
|
+
idle: () => Promise<void>;
|
|
5
|
+
};
|
|
6
|
+
export declare function createActivityTracker(): ActivityTracker;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Component, InjectionKey } from 'vue';
|
|
2
|
-
import {
|
|
2
|
+
import { RouteViews } from '../types/routeViews';
|
|
3
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,11 +1,8 @@
|
|
|
1
1
|
import { Rejection, RouterRejection } from '../types/rejection';
|
|
2
|
-
import { ComputedRef } from 'vue';
|
|
3
|
-
import { ResolvedRoute } from '../types/resolved';
|
|
4
2
|
type RejectionUpdate = (rejection: Rejection) => void;
|
|
5
3
|
type RejectionClear = () => void;
|
|
6
4
|
type CurrentRejectionContext = {
|
|
7
5
|
currentRejection: RouterRejection;
|
|
8
|
-
currentRejectionRoute: ComputedRef<ResolvedRoute | null>;
|
|
9
6
|
updateRejection: RejectionUpdate;
|
|
10
7
|
clearRejection: RejectionClear;
|
|
11
8
|
};
|
|
@@ -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;
|
|
@@ -0,0 +1,36 @@
|
|
|
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 store built ahead of
|
|
7
|
+
* a navigation is staged for it to pick up — staged rather than handed over directly because it is built
|
|
8
|
+
* 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 store for the next navigation. A store already parked is disposed, since staging a second
|
|
17
|
+
* store before a navigation arrives abandons the first.
|
|
18
|
+
*/
|
|
19
|
+
stage: (store: DataStore) => void;
|
|
20
|
+
/**
|
|
21
|
+
* The staged store, created when nothing was staged, so a navigation can compute into it ahead of
|
|
22
|
+
* adopting it.
|
|
23
|
+
*/
|
|
24
|
+
staged: () => DataStore;
|
|
25
|
+
/**
|
|
26
|
+
* Swaps in the staged store, or a fresh one, and hands back the store being replaced for disposal.
|
|
27
|
+
*/
|
|
28
|
+
promote: () => DataStore;
|
|
29
|
+
};
|
|
30
|
+
export declare function createNavigationStores(): NavigationStores;
|
|
31
|
+
/**
|
|
32
|
+
* What a stored value is: the props of a view, or the data of a loader. Part of the key so that a view
|
|
33
|
+
* and a loader sharing a name on the same route are still two values.
|
|
34
|
+
*/
|
|
35
|
+
export type DataKind = 'props' | 'loader';
|
|
36
|
+
export declare function getDataKey(kind: DataKind, id: string, name: string, route: ResolvedRoute): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RejectionHooks } from '../types/hooks';
|
|
2
|
+
import { Rejection, RejectionOptions } from '../types/rejection';
|
|
3
|
+
import { RouteSetTitle } from '../types/routeTitle';
|
|
4
|
+
export declare function createRejection<TType extends string>(options: RejectionOptions<TType>): Rejection<TType> & RejectionHooks<TType> & RouteSetTitle;
|
|
@@ -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 {};
|
|
@@ -11,7 +11,7 @@ type RouteHooks<TRoutes extends Routes = Routes, TRejections extends Rejection[]
|
|
|
11
11
|
onAfterRouteEnter: AddAfterEnterHook<TRoutes, TRejections>;
|
|
12
12
|
onAfterRouteUpdate: AddAfterUpdateHook<TRoutes, TRejections>;
|
|
13
13
|
onAfterRouteLeave: AddAfterLeaveHook<TRoutes, TRejections>;
|
|
14
|
-
onError: AddErrorHook<TRoutes
|
|
14
|
+
onError: AddErrorHook<TRoutes, TRejections>;
|
|
15
15
|
onRejection: AddRejectionHook<ExtractRejectionTypes<TRejections>, TRoutes>;
|
|
16
16
|
store: Hooks;
|
|
17
17
|
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { ResolvedRoute, WithData } from '../types/resolved';
|
|
2
|
+
import { HasVueAppStore } from './createVueAppStore';
|
|
3
|
+
import { CallbackContextPush, CallbackContextReject, CallbackContextSuccess } from '../types/callbackContext';
|
|
4
|
+
import { DataKind } from './createNavigationStores';
|
|
5
|
+
import { PropsResult } from '../utilities/props';
|
|
6
|
+
import { MaybePromise } from '../types/utilities';
|
|
7
|
+
import { ComputationFilter } from './getComputations';
|
|
8
|
+
/**
|
|
9
|
+
* A navigation that was superseded before its values settled. The navigation that replaced it owns the
|
|
10
|
+
* outcome, so this one reports that it went nowhere rather than a success it never had.
|
|
11
|
+
*/
|
|
12
|
+
type RouteValueAbandoned = {
|
|
13
|
+
status: 'ABANDONED';
|
|
14
|
+
};
|
|
15
|
+
export type RouteValueResponse = CallbackContextSuccess | CallbackContextPush | CallbackContextReject | RouteValueAbandoned;
|
|
16
|
+
/**
|
|
17
|
+
* How a navigation's props and loaders settled. Reported separately because props are what a view renders
|
|
18
|
+
* with while loaders hold nothing up, so a slow loader must not be what decides when props are known.
|
|
19
|
+
*/
|
|
20
|
+
export type RouteValueResponses = {
|
|
21
|
+
props: Promise<RouteValueResponse>;
|
|
22
|
+
loaders: Promise<RouteValueResponse>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* A store of a route's values, whichever store that is.
|
|
26
|
+
*/
|
|
27
|
+
export type ValueStore = {
|
|
28
|
+
/**
|
|
29
|
+
* Computes the route's values, or only those the filter keeps, and reports how they settle.
|
|
30
|
+
*/
|
|
31
|
+
compute: (route: ResolvedRoute, filter?: ComputationFilter) => RouteValueResponses;
|
|
32
|
+
/**
|
|
33
|
+
* Adopts values that already settled, in place of running their getters.
|
|
34
|
+
*/
|
|
35
|
+
fill: (route: ResolvedRoute, values: RouteValue[]) => void;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* A store kept apart from the navigation until it is staged, so values can be computed ahead of a
|
|
39
|
+
* navigation that may never come.
|
|
40
|
+
*/
|
|
41
|
+
export type DetachedStore = ValueStore & {
|
|
42
|
+
/**
|
|
43
|
+
* Becomes the staged store, replacing whatever was staged, and starts over empty.
|
|
44
|
+
*/
|
|
45
|
+
stage: () => void;
|
|
46
|
+
/**
|
|
47
|
+
* Abandons what was computed and starts over.
|
|
48
|
+
*/
|
|
49
|
+
reset: () => void;
|
|
50
|
+
/**
|
|
51
|
+
* Abandons what was computed.
|
|
52
|
+
*/
|
|
53
|
+
dispose: () => void;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* A value the store holds for a route: which computation it belongs to, and what it resolved to.
|
|
57
|
+
*/
|
|
58
|
+
export type RouteValue = {
|
|
59
|
+
kind: DataKind;
|
|
60
|
+
depth: number;
|
|
61
|
+
name: string;
|
|
62
|
+
value: unknown;
|
|
63
|
+
};
|
|
64
|
+
export type RouteValueStore = HasVueAppStore & {
|
|
65
|
+
createDetachedStore: () => DetachedStore;
|
|
66
|
+
/**
|
|
67
|
+
* The store the next navigation adopts, created when nothing is staged. Values computed into it ahead of
|
|
68
|
+
* the navigation are found under way when the navigation commits, while the rendered route keeps reading
|
|
69
|
+
* its own store meanwhile.
|
|
70
|
+
*/
|
|
71
|
+
staged: () => ValueStore;
|
|
72
|
+
/**
|
|
73
|
+
* Makes the staged store current and computes whatever the route still lacks.
|
|
74
|
+
*/
|
|
75
|
+
commit: (route: ResolvedRoute) => RouteValueResponses;
|
|
76
|
+
/**
|
|
77
|
+
* The values currently settled in the store.
|
|
78
|
+
*/
|
|
79
|
+
getValues: (route: ResolvedRoute) => RouteValue[];
|
|
80
|
+
getProps: (id: string, name: string, route: ResolvedRoute) => MaybePromise<PropsResult>;
|
|
81
|
+
/**
|
|
82
|
+
* What a route exposes as `data`. Resolved per read rather than captured, so it stays correct as
|
|
83
|
+
* navigations replace the store its values live in.
|
|
84
|
+
*/
|
|
85
|
+
getData: (route: ResolvedRoute) => WithData['data'];
|
|
86
|
+
};
|
|
87
|
+
export declare function createRouteValueStore(): RouteValueStore;
|
|
88
|
+
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[];
|
|
@@ -17,6 +17,6 @@ type RouterCallbackContext<TRoutes extends Routes = Routes, TRejections extends
|
|
|
17
17
|
abort: CallbackContextAbort;
|
|
18
18
|
};
|
|
19
19
|
export declare function createRouterCallbackContext<TRoutes extends Routes, TRejections extends Rejections>({ to }: {
|
|
20
|
-
to: ResolvedRoute;
|
|
20
|
+
to: ResolvedRoute | null;
|
|
21
21
|
}): RouterCallbackContext<TRoutes, TRejections>;
|
|
22
22
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InjectionKey } from 'vue';
|
|
2
|
-
import { ResolvedRoute } from '../types/resolved';
|
|
2
|
+
import { ResolvedRoute, WithData } from '../types/resolved';
|
|
3
3
|
import { RouterRoute } from '../types/routerRoute';
|
|
4
4
|
import { RouterPush } from '../types/routerPush';
|
|
5
5
|
import { Router } from '../types/router';
|
|
6
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>;
|
|
7
|
+
export declare function createRouterRoute<TRoute extends ResolvedRoute & WithData>(routerKey: InjectionKey<Router>, route: TRoute, push: RouterPush): RouterRoute<TRoute>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RedirectStatus, RenderRedirect } from '../types/router';
|
|
2
|
+
type ServerRedirect = {
|
|
3
|
+
/**
|
|
4
|
+
* Captures a redirect as the render's response. A server responds per redirect hop, so only the first
|
|
5
|
+
* is kept: the browser follows it, and the next request takes it from there.
|
|
6
|
+
*/
|
|
7
|
+
setServerRedirect: (status: RedirectStatus, location: string) => void;
|
|
8
|
+
/**
|
|
9
|
+
* The redirect the render captured, or undefined when it has not redirected.
|
|
10
|
+
*/
|
|
11
|
+
getServerRedirect: () => RenderRedirect | undefined;
|
|
12
|
+
};
|
|
13
|
+
export declare function createServerRedirect(): ServerRedirect;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { PrefetchConfig } from '../types/prefetch';
|
|
2
|
+
import { ResolvedRoute } from '../types/resolved';
|
|
3
|
+
import { CreatedRouteOptions } from '../types/route';
|
|
4
|
+
import { DataKind } from './createNavigationStores';
|
|
5
|
+
import { AnyPayloadTransformer } from './payload';
|
|
6
|
+
import { AnyFunction } from '../types/utilities';
|
|
7
|
+
/**
|
|
8
|
+
* Something a route computes: a view's props getter, or a loader. Both are a named callback belonging to
|
|
9
|
+
* one match, so both are stored the same way — what differs is only what waits on them.
|
|
10
|
+
*/
|
|
11
|
+
export type Computation = {
|
|
12
|
+
kind: DataKind;
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
depth: number;
|
|
16
|
+
key: string;
|
|
17
|
+
run: AnyFunction;
|
|
18
|
+
routePrefetch: PrefetchConfig | undefined;
|
|
19
|
+
prefetch: PrefetchConfig | undefined;
|
|
20
|
+
transformer: AnyPayloadTransformer | undefined;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Where a value lives, which is all that is needed to read it back out of a store.
|
|
24
|
+
*/
|
|
25
|
+
export type ValueLocation = {
|
|
26
|
+
kind: DataKind;
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Decides which of a route's computations to compute.
|
|
32
|
+
*/
|
|
33
|
+
export type ComputationFilter = (computation: Computation) => boolean;
|
|
34
|
+
export declare function getComputations(route: ResolvedRoute): Computation[];
|
|
35
|
+
/**
|
|
36
|
+
* Only views with a getter, since a view with none is never computed and waiting on it would never settle.
|
|
37
|
+
*/
|
|
38
|
+
export declare function propsLocations(match: CreatedRouteOptions): ValueLocation[];
|
|
39
|
+
export declare function loaderLocations(match: CreatedRouteOptions): ValueLocation[];
|
|
40
|
+
export declare function isKind(kind: DataKind): (computation: Computation) => boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ResolvedRoute } from '../types/resolved';
|
|
2
|
+
import { Hooks } from '../models/hooks';
|
|
3
|
+
export declare function getGlobalBeforeHooks(to: ResolvedRoute | null, from: ResolvedRoute | null, globalHooks: Hooks): Hooks;
|
|
4
|
+
export declare function getGlobalAfterHooks(to: ResolvedRoute | null, from: ResolvedRoute | null, globalHooks: Hooks): Hooks;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ResolvedRoute } from '../types/resolved';
|
|
2
2
|
import { Hooks } from '../models/hooks';
|
|
3
|
-
export declare function getBeforeHooksFromRoutes(to: ResolvedRoute, from: ResolvedRoute | null): Hooks;
|
|
4
|
-
export declare function getAfterHooksFromRoutes(to: ResolvedRoute, from: ResolvedRoute | null): Hooks;
|
|
3
|
+
export declare function getBeforeHooksFromRoutes(to: ResolvedRoute | null, from: ResolvedRoute | null): Hooks;
|
|
4
|
+
export declare function getAfterHooksFromRoutes(to: ResolvedRoute | null, from: ResolvedRoute | null): Hooks;
|
|
@@ -11,7 +11,6 @@ import { RouterOptions } from '../types/router';
|
|
|
11
11
|
export declare function getRoutesForRouter(routes: Routes | Routes[], plugins?: RouterPlugin[], options?: RouterOptions): {
|
|
12
12
|
routes: (import('../main').Url & {
|
|
13
13
|
id: string;
|
|
14
|
-
matched: import('../types/route').CreatedRouteOptions;
|
|
15
14
|
matches: import('../types/route').CreatedRouteOptions[];
|
|
16
15
|
name: string;
|
|
17
16
|
meta: Record<string, unknown>;
|
|
@@ -19,7 +18,9 @@ export declare function getRoutesForRouter(routes: Routes | Routes[], plugins?:
|
|
|
19
18
|
prefetch?: import('../main').PrefetchConfig;
|
|
20
19
|
context: import('../types/routeContext').RouteContext[];
|
|
21
20
|
} & RouteInternal)[];
|
|
22
|
-
rejections: (
|
|
21
|
+
rejections: (Pick<import('../types/rejection').RejectionOptions<string>, "type" | "status"> & {
|
|
22
|
+
getTitle: import('../types/routeTitle').GetTitleCallback;
|
|
23
|
+
} & RejectionInternal)[];
|
|
23
24
|
getRouteByName: (type: string) => Route | undefined;
|
|
24
25
|
getRejectionByType: {
|
|
25
26
|
(type: BuiltInRejectionType): (Rejection & RejectionInternal);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HookLifecycle } from '../types/hooks';
|
|
2
2
|
import { ResolvedRoute } from '../types/resolved';
|
|
3
|
-
type RouteHookCondition = (to: ResolvedRoute, from: ResolvedRoute | null, depth: number) => boolean;
|
|
3
|
+
type RouteHookCondition = (to: ResolvedRoute | null, from: ResolvedRoute | null, depth: number) => boolean;
|
|
4
4
|
export declare const isRouteEnter: RouteHookCondition;
|
|
5
5
|
export declare const isRouteLeave: RouteHookCondition;
|
|
6
6
|
export declare const isRouteUpdate: RouteHookCondition;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { DataKind } from './createNavigationStores';
|
|
2
|
+
import { RouteValue } from './createRouteValueStore';
|
|
3
|
+
import { PayloadValueError } from '../errors/payloadValueError';
|
|
4
|
+
import { ResolvedRoute } from '../types/resolved';
|
|
5
|
+
export declare const PAYLOAD_ELEMENT_ID = "kitbag-payload";
|
|
6
|
+
/**
|
|
7
|
+
* The payload as a script tag to embed in the document a server sends.
|
|
8
|
+
*
|
|
9
|
+
* `<` is escaped so nothing in the payload can close the tag early, and the two unicode line separators
|
|
10
|
+
* because they terminate a line in javascript source. All three are json unicode escapes, so `JSON.parse`
|
|
11
|
+
* gives back exactly what went in.
|
|
12
|
+
*/
|
|
13
|
+
export declare function payloadToScript(payload: RouterPayload): string;
|
|
14
|
+
export type TransformerOptions<TValue = unknown> = {
|
|
15
|
+
/**
|
|
16
|
+
* Transforms a value across the server render payload: `stringify` writes the value into the payload
|
|
17
|
+
* on the server, and `parse` reads it back on the client during hydration. Declare one for any value
|
|
18
|
+
* json cannot carry faithfully, such as a `Map`, `Set`, or `Date`, so the client adopts the same
|
|
19
|
+
* value the server rendered with. Defaults to json.
|
|
20
|
+
*/
|
|
21
|
+
transformer?: PayloadTransformer<TValue>;
|
|
22
|
+
};
|
|
23
|
+
export type PayloadTransformer<TValue = unknown> = {
|
|
24
|
+
/**
|
|
25
|
+
* Turns a value into a string for the payload.
|
|
26
|
+
*/
|
|
27
|
+
stringify: (value: TValue) => string;
|
|
28
|
+
/**
|
|
29
|
+
* Turns a string from the payload back into a value.
|
|
30
|
+
*/
|
|
31
|
+
parse: (encoded: string) => TValue;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* A transformer whose value type has been erased. Every loader's and view's transformer is stored in
|
|
35
|
+
* one record, so a stored one is typed for some value the record no longer names — `unknown` would
|
|
36
|
+
* claim it accepts anything, which a typed stringify does not.
|
|
37
|
+
*/
|
|
38
|
+
export type AnyPayloadTransformer = PayloadTransformer<any>;
|
|
39
|
+
export declare const jsonTransformer: PayloadTransformer;
|
|
40
|
+
export type PayloadValue = {
|
|
41
|
+
kind: DataKind;
|
|
42
|
+
depth: number;
|
|
43
|
+
name: string;
|
|
44
|
+
encoded: string;
|
|
45
|
+
};
|
|
46
|
+
export type RouterPayload = SuccessPayload | RejectPayload;
|
|
47
|
+
type SuccessPayload = {
|
|
48
|
+
kind: 'success';
|
|
49
|
+
/**
|
|
50
|
+
* The url the server rendered.
|
|
51
|
+
*/
|
|
52
|
+
url: string;
|
|
53
|
+
values: PayloadValue[];
|
|
54
|
+
};
|
|
55
|
+
type RejectPayload = {
|
|
56
|
+
kind: 'reject';
|
|
57
|
+
/**
|
|
58
|
+
* The url the server rendered.
|
|
59
|
+
*/
|
|
60
|
+
url: string;
|
|
61
|
+
/**
|
|
62
|
+
* The type of the rejection the server rendered.
|
|
63
|
+
*/
|
|
64
|
+
rejection: string;
|
|
65
|
+
};
|
|
66
|
+
export declare function isRouterPayload(value: unknown): value is RouterPayload;
|
|
67
|
+
/**
|
|
68
|
+
* The payload a server embedded in the document, or undefined when this is not a hydration.
|
|
69
|
+
*/
|
|
70
|
+
export declare function getHydratingPayload(): RouterPayload | undefined;
|
|
71
|
+
type EncodedPayloadValues = {
|
|
72
|
+
values: PayloadValue[];
|
|
73
|
+
failures: PayloadValueError[];
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Encodes settled values for the payload, each through its own stringifier or the fallback. A value that
|
|
77
|
+
* cannot be encoded is warned about, reported as a failure, and left out, so the client computes it again.
|
|
78
|
+
*/
|
|
79
|
+
export declare function encodePayloadValues(route: ResolvedRoute, values: RouteValue[], fallback?: PayloadTransformer): EncodedPayloadValues;
|
|
80
|
+
/**
|
|
81
|
+
* Decodes payload values for the store to adopt, each through its own stringifier or the fallback. A
|
|
82
|
+
* value that is missing from the payload or that cannot be read is warned about and left out, so its
|
|
83
|
+
* getter runs again.
|
|
84
|
+
*/
|
|
85
|
+
export declare function decodePayloadValues(route: ResolvedRoute, values: PayloadValue[], fallback?: PayloadTransformer): RouteValue[];
|
|
86
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ParamGetSet } from '../types/paramTypes';
|
|
2
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
|
+
export interface ZodSchemaLike extends StandardSchemaV1<any> {
|
|
4
|
+
parse: (input: any) => any;
|
|
5
|
+
def: {
|
|
6
|
+
type: string;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export interface ValibotSchemaLike extends StandardSchemaV1<any> {
|
|
10
|
+
type: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ArkTypeSchemaLike extends StandardSchemaV1<any> {
|
|
13
|
+
extends: (def: string) => boolean;
|
|
14
|
+
branches: readonly ArkTypeSchemaLike[];
|
|
15
|
+
}
|
|
16
|
+
export type StandardSchemaLike = ZodSchemaLike | ValibotSchemaLike | ArkTypeSchemaLike;
|
|
17
|
+
export declare function isZodSchema(value: unknown): value is ZodSchemaLike;
|
|
18
|
+
export declare function isValibotSchema(value: unknown): value is ValibotSchemaLike;
|
|
19
|
+
export declare function isArkTypeSchema(value: unknown): value is ArkTypeSchemaLike;
|
|
20
|
+
export declare function isStandardSchema(value: unknown): value is StandardSchemaLike;
|
|
21
|
+
export declare function createStandardSchemaParam<T>(schema: StandardSchemaLike): ParamGetSet<T>;
|