From: Eduardo San Martin Morote Date: Fri, 20 Nov 2020 17:47:39 +0000 (+0100) Subject: feat: expose symbols as internals X-Git-Tag: v4.0.0-rc.4~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef62d9645c456f069699480ae3f2c3dd97b9d30d;p=thirdparty%2Fvuejs%2Frouter.git feat: expose symbols as internals Allow integration for testing utils and other library-level integrations with vue router. These are marked as internal and should not be used by unofficial integrations as they could change at any time. --- diff --git a/src/index.ts b/src/index.ts index caca8b13..bd3036a3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,7 +20,12 @@ export { _PathParserOptions, } from './matcher/pathParserRanker' -export { routeLocationKey, routerKey } from './injectionSymbols' +export { + routeLocationKey, + routerKey, + matchedRouteKey, + viewDepthKey, +} from './injectionSymbols' export { RouteMeta, diff --git a/src/injectionSymbols.ts b/src/injectionSymbols.ts index 457f1ea1..b23ea5e3 100644 --- a/src/injectionSymbols.ts +++ b/src/injectionSymbols.ts @@ -13,10 +13,23 @@ export const PolySymbol = (name: string) => : (__DEV__ ? '[vue-router]: ' : '_vr_') + name // rvlm = Router View Location Matched +/** + * RouteRecord being rendered by the closest ancestor Router View. Used for + * `onBeforeRouteUpdate` and `onBeforeRouteLeave`. rvlm stands for Router View + * Location Matched + * + * @internal + */ export const matchedRouteKey = /*#__PURE__*/ PolySymbol( __DEV__ ? 'router view location matched' : 'rvlm' ) as InjectionKey> -// rvd = Router View Depth + +/** + * Allows overriding the router view depth to control which component in + * `matched` is rendered. rvd stands for Router View Depth + * + * @internal + */ export const viewDepthKey = /*#__PURE__*/ PolySymbol( __DEV__ ? 'router view depth' : 'rvd' ) as InjectionKey