@histoire/vendors 1.0.0-alpha.5 → 1.0.0-beta.1
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/client/b-floating-vue.js +29 -20
- package/dist/client/b-vue-router.js +2615 -3624
- package/dist/client/b-vue-use.js +87 -77
- package/dist/client/b-vue.js +1 -1
- package/dist/client/node_modules/@floating-ui/core/dist/floating-ui.core.d.mts +528 -0
- package/dist/client/node_modules/@floating-ui/utils/dist/floating-ui.utils.d.mts +103 -0
- package/dist/client/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.d.mts +47 -0
- package/dist/client/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts +50 -0
- package/dist/client/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts +9 -0
- package/dist/client/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts +16 -0
- package/dist/client/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts +7 -0
- package/dist/client/node_modules/@types/web-bluetooth/index.d.ts +93 -21
- package/dist/client/node_modules/@types/web-bluetooth/package.json +9 -3
- package/dist/client/node_modules/@vue/compiler-core/dist/compiler-core.d.ts +20 -11
- package/dist/client/node_modules/@vue/compiler-core/package.json +6 -6
- package/dist/client/node_modules/@vue/compiler-dom/dist/compiler-dom.d.ts +12 -12
- package/dist/client/node_modules/@vue/compiler-dom/package.json +3 -3
- package/dist/client/node_modules/@vue/compiler-sfc/dist/compiler-sfc.d.ts +3 -2
- package/dist/client/node_modules/@vue/compiler-sfc/package.json +14 -14
- package/dist/client/node_modules/@vue/compiler-ssr/package.json +3 -3
- package/dist/client/node_modules/@vue/reactivity/dist/reactivity.d.ts +24 -25
- package/dist/client/node_modules/@vue/reactivity/package.json +2 -2
- package/dist/client/node_modules/@vue/runtime-core/dist/runtime-core.d.ts +48 -41
- package/dist/client/node_modules/@vue/runtime-core/package.json +3 -3
- package/dist/client/node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts +680 -645
- package/dist/client/node_modules/@vue/runtime-dom/package.json +5 -5
- package/dist/client/node_modules/@vue/server-renderer/package.json +4 -4
- package/dist/client/node_modules/@vue/shared/dist/shared.d.ts +7 -1
- package/dist/client/node_modules/@vue/shared/package.json +1 -1
- package/dist/client/node_modules/@vueuse/core/index.d.mts +6221 -0
- package/dist/client/node_modules/@vueuse/core/index.d.ts +131 -103
- package/dist/client/node_modules/@vueuse/core/metadata.d.mts +1 -0
- package/dist/client/node_modules/@vueuse/core/package.json +4 -4
- package/dist/client/node_modules/@vueuse/metadata/index.d.mts +78 -0
- package/dist/client/node_modules/@vueuse/metadata/package.json +1 -1
- package/dist/client/node_modules/@vueuse/shared/index.d.mts +1260 -0
- package/dist/client/node_modules/@vueuse/shared/index.d.ts +30 -13
- package/dist/client/node_modules/@vueuse/shared/package.json +1 -1
- package/dist/client/node_modules/entities/decode.d.ts +3 -0
- package/dist/client/node_modules/entities/{lib/esm/decode_codepoint.d.ts → dist/commonjs/decode-codepoint.d.ts} +2 -2
- package/dist/client/node_modules/entities/{lib → dist/commonjs}/decode.d.ts +18 -26
- package/dist/client/node_modules/entities/{lib/esm → dist/commonjs}/encode.d.ts +2 -2
- package/dist/client/node_modules/entities/{lib/esm → dist/commonjs}/escape.d.ts +9 -6
- package/dist/client/node_modules/entities/dist/commonjs/generated/decode-data-html.d.ts +2 -0
- package/dist/client/node_modules/entities/dist/commonjs/generated/decode-data-xml.d.ts +2 -0
- package/dist/client/node_modules/entities/dist/commonjs/generated/encode-html.d.ts +3 -0
- package/dist/client/node_modules/entities/{lib/esm → dist/commonjs}/index.d.ts +9 -9
- package/dist/client/node_modules/entities/dist/commonjs/internal/bin-trie-flags.d.ts +17 -0
- package/dist/client/node_modules/entities/dist/commonjs/internal/decode-shared.d.ts +2 -0
- package/dist/client/node_modules/entities/dist/commonjs/internal/encode-shared.d.ts +32 -0
- package/dist/client/node_modules/entities/dist/commonjs/package.json +3 -0
- package/dist/client/node_modules/entities/{lib/decode_codepoint.d.ts → dist/esm/decode-codepoint.d.ts} +2 -2
- package/dist/client/node_modules/entities/{lib → dist}/esm/decode.d.ts +18 -26
- package/dist/client/node_modules/entities/{lib → dist/esm}/encode.d.ts +2 -2
- package/dist/client/node_modules/entities/{lib → dist/esm}/escape.d.ts +9 -6
- package/dist/client/node_modules/entities/dist/esm/generated/decode-data-html.d.ts +2 -0
- package/dist/client/node_modules/entities/dist/esm/generated/decode-data-xml.d.ts +2 -0
- package/dist/client/node_modules/entities/dist/esm/generated/encode-html.d.ts +3 -0
- package/dist/client/node_modules/entities/{lib → dist/esm}/index.d.ts +9 -9
- package/dist/client/node_modules/entities/dist/esm/internal/bin-trie-flags.d.ts +17 -0
- package/dist/client/node_modules/entities/dist/esm/internal/decode-shared.d.ts +2 -0
- package/dist/client/node_modules/entities/dist/esm/internal/encode-shared.d.ts +32 -0
- package/dist/client/node_modules/entities/dist/esm/package.json +3 -0
- package/dist/client/node_modules/entities/escape.d.ts +3 -0
- package/dist/client/node_modules/entities/package.json +92 -69
- package/dist/client/node_modules/magic-string/dist/magic-string.es.d.mts +289 -0
- package/dist/client/node_modules/postcss/lib/postcss.d.mts +69 -0
- package/dist/client/node_modules/vue/compiler-sfc/index.d.mts +1 -0
- package/dist/client/node_modules/vue/dist/vue.d.mts +7 -0
- package/dist/client/node_modules/vue/jsx-runtime/index.d.ts +2 -2
- package/dist/client/node_modules/vue/jsx.d.ts +1 -1
- package/dist/client/node_modules/vue/package.json +6 -6
- package/dist/client/node_modules/vue/server-renderer/index.d.mts +1 -0
- package/dist/client/node_modules/vue-router/dist/experimental/index.d.mts +38 -0
- package/dist/client/node_modules/vue-router/dist/router-CWoNjPRp.d.mts +1973 -0
- package/dist/client/node_modules/vue-router/dist/vue-router.d.mts +361 -0
- package/dist/client/node_modules/vue-router/package.json +43 -39
- package/dist/client/node_modules/vue-router/vue-router-auto-resolver.d.mts +22 -0
- package/dist/client/node_modules/vue-router/vue-router-auto.d.ts +1 -4
- package/dist/client/vue.runtime.esm-bundler.js +2987 -2699
- package/package.json +2 -2
- package/rollup.config.mjs +1 -1
- package/dist/client/node_modules/entities/lib/esm/generated/decode-data-html.d.ts +0 -3
- package/dist/client/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts +0 -3
- package/dist/client/node_modules/entities/lib/esm/generated/encode-html.d.ts +0 -8
- package/dist/client/node_modules/entities/lib/esm/package.json +0 -1
- package/dist/client/node_modules/entities/lib/generated/decode-data-html.d.ts +0 -3
- package/dist/client/node_modules/entities/lib/generated/decode-data-xml.d.ts +0 -3
- package/dist/client/node_modules/entities/lib/generated/encode-html.d.ts +0 -8
- package/dist/client/node_modules/vue-router/dist/vue-router.d.ts +0 -1836
- /package/dist/client/node_modules/{pinia/node_modules/vue-demi → vue-demi}/lib/index.d.ts +0 -0
- /package/dist/client/node_modules/{pinia/node_modules/vue-demi → vue-demi}/lib/v2/index.d.ts +0 -0
- /package/dist/client/node_modules/{pinia/node_modules/vue-demi → vue-demi}/lib/v2.7/index.d.ts +0 -0
- /package/dist/client/node_modules/{pinia/node_modules/vue-demi → vue-demi}/lib/v3/index.d.ts +0 -0
- /package/dist/client/node_modules/{pinia/node_modules/vue-demi → vue-demi}/package.json +0 -0
|
@@ -1,1836 +0,0 @@
|
|
|
1
|
-
import { AllowedComponentProps } from 'vue';
|
|
2
|
-
import { App } from 'vue';
|
|
3
|
-
import type { Component } from 'vue';
|
|
4
|
-
import { ComponentCustomProps } from 'vue';
|
|
5
|
-
import { ComponentPublicInstance } from 'vue';
|
|
6
|
-
import { ComputedRef } from 'vue';
|
|
7
|
-
import type { DefineComponent } from 'vue';
|
|
8
|
-
import type { InjectionKey } from 'vue';
|
|
9
|
-
import { MaybeRef } from 'vue';
|
|
10
|
-
import { Ref } from 'vue';
|
|
11
|
-
import { UnwrapRef } from 'vue';
|
|
12
|
-
import { VNode } from 'vue';
|
|
13
|
-
import { VNodeProps } from 'vue';
|
|
14
|
-
|
|
15
|
-
declare type Awaitable<T> = T | Promise<T>;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Maybe a promise maybe not
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
|
-
export declare type _Awaitable<T> = T | PromiseLike<T>;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Creates an in-memory based history. The main purpose of this history is to handle SSR. It starts in a special location that is nowhere.
|
|
25
|
-
* It's up to the user to replace that location with the starter location by either calling `router.push` or `router.replace`.
|
|
26
|
-
*
|
|
27
|
-
* @param base - Base applied to all urls, defaults to '/'
|
|
28
|
-
* @returns a history object that can be passed to the router constructor
|
|
29
|
-
*/
|
|
30
|
-
export declare function createMemoryHistory(base?: string): RouterHistory;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Creates a Router instance that can be used by a Vue app.
|
|
34
|
-
*
|
|
35
|
-
* @param options - {@link RouterOptions}
|
|
36
|
-
*/
|
|
37
|
-
export declare function createRouter(options: RouterOptions): Router;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Creates a Router Matcher.
|
|
41
|
-
*
|
|
42
|
-
* @internal
|
|
43
|
-
* @param routes - array of initial routes
|
|
44
|
-
* @param globalOptions - global route options
|
|
45
|
-
*/
|
|
46
|
-
export declare function createRouterMatcher(routes: Readonly<RouteRecordRaw[]>, globalOptions: PathParserOptions): RouterMatcher;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Creates a hash history. Useful for web applications with no host (e.g. `file://`) or when configuring a server to
|
|
50
|
-
* handle any URL is not possible.
|
|
51
|
-
*
|
|
52
|
-
* @param base - optional base to provide. Defaults to `location.pathname + location.search` If there is a `<base>` tag
|
|
53
|
-
* in the `head`, its value will be ignored in favor of this parameter **but note it affects all the history.pushState()
|
|
54
|
-
* calls**, meaning that if you use a `<base>` tag, it's `href` value **has to match this parameter** (ignoring anything
|
|
55
|
-
* after the `#`).
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```js
|
|
59
|
-
* // at https://example.com/folder
|
|
60
|
-
* createWebHashHistory() // gives a url of `https://example.com/folder#`
|
|
61
|
-
* createWebHashHistory('/folder/') // gives a url of `https://example.com/folder/#`
|
|
62
|
-
* // if the `#` is provided in the base, it won't be added by `createWebHashHistory`
|
|
63
|
-
* createWebHashHistory('/folder/#/app/') // gives a url of `https://example.com/folder/#/app/`
|
|
64
|
-
* // you should avoid doing this because it changes the original url and breaks copying urls
|
|
65
|
-
* createWebHashHistory('/other-folder/') // gives a url of `https://example.com/other-folder/#`
|
|
66
|
-
*
|
|
67
|
-
* // at file:///usr/etc/folder/index.html
|
|
68
|
-
* // for locations with no `host`, the base is ignored
|
|
69
|
-
* createWebHashHistory('/iAmIgnored') // gives a url of `file:///usr/etc/folder/index.html#`
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
export declare function createWebHashHistory(base?: string): RouterHistory;
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Creates an HTML5 history. Most common history for single page applications.
|
|
76
|
-
*
|
|
77
|
-
* @param base -
|
|
78
|
-
*/
|
|
79
|
-
export declare function createWebHistory(base?: string): RouterHistory;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Internal type to define an ErrorHandler
|
|
83
|
-
*
|
|
84
|
-
* @param error - error thrown
|
|
85
|
-
* @param to - location we were navigating to when the error happened
|
|
86
|
-
* @param from - location we were navigating from when the error happened
|
|
87
|
-
* @internal
|
|
88
|
-
*/
|
|
89
|
-
declare interface _ErrorListener {
|
|
90
|
-
(error: any, to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded): any;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Flags so we can combine them when checking for multiple errors. This is the internal version of
|
|
95
|
-
* {@link NavigationFailureType}.
|
|
96
|
-
*
|
|
97
|
-
* @internal
|
|
98
|
-
*/
|
|
99
|
-
export declare const enum ErrorTypes {
|
|
100
|
-
MATCHER_NOT_FOUND = 1,
|
|
101
|
-
NAVIGATION_GUARD_REDIRECT = 2,
|
|
102
|
-
NAVIGATION_ABORTED = 4,
|
|
103
|
-
NAVIGATION_CANCELLED = 8,
|
|
104
|
-
NAVIGATION_DUPLICATED = 16
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
declare type HistoryLocation = string;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Allowed HTML history.state
|
|
111
|
-
*/
|
|
112
|
-
export declare interface HistoryState {
|
|
113
|
-
[x: number]: HistoryStateValue;
|
|
114
|
-
[x: string]: HistoryStateValue;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Allowed arrays for history.state.
|
|
119
|
-
*
|
|
120
|
-
* @internal
|
|
121
|
-
*/
|
|
122
|
-
declare interface HistoryStateArray extends Array<HistoryStateValue> {
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Allowed variables in HTML5 history state. Note that pushState clones the state
|
|
127
|
-
* passed and does not accept everything: e.g.: it doesn't accept symbols, nor
|
|
128
|
-
* functions as values. It also ignores Symbols as keys.
|
|
129
|
-
*
|
|
130
|
-
* @internal
|
|
131
|
-
*/
|
|
132
|
-
declare type HistoryStateValue = string | number | boolean | null | undefined | HistoryState | HistoryStateArray;
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Check if an object is a {@link NavigationFailure}.
|
|
136
|
-
*
|
|
137
|
-
* @param error - possible {@link NavigationFailure}
|
|
138
|
-
* @param type - optional types to check for
|
|
139
|
-
*
|
|
140
|
-
* @example
|
|
141
|
-
* ```js
|
|
142
|
-
* import { isNavigationFailure, NavigationFailureType } from 'vue-router'
|
|
143
|
-
*
|
|
144
|
-
* router.afterEach((to, from, failure) => {
|
|
145
|
-
* // Any kind of navigation failure
|
|
146
|
-
* if (isNavigationFailure(failure)) {
|
|
147
|
-
* // ...
|
|
148
|
-
* }
|
|
149
|
-
* // Only duplicated navigations
|
|
150
|
-
* if (isNavigationFailure(failure, NavigationFailureType.duplicated)) {
|
|
151
|
-
* // ...
|
|
152
|
-
* }
|
|
153
|
-
* // Aborted or canceled navigations
|
|
154
|
-
* if (isNavigationFailure(failure, NavigationFailureType.aborted | NavigationFailureType.canceled)) {
|
|
155
|
-
* // ...
|
|
156
|
-
* }
|
|
157
|
-
* })
|
|
158
|
-
* ```
|
|
159
|
-
*/
|
|
160
|
-
export declare function isNavigationFailure(error: any, type?: ErrorTypes.NAVIGATION_GUARD_REDIRECT): error is NavigationRedirectError;
|
|
161
|
-
|
|
162
|
-
export declare function isNavigationFailure(error: any, type?: ErrorTypes | NavigationFailureType): error is NavigationFailure;
|
|
163
|
-
|
|
164
|
-
declare type Lazy<T> = () => Promise<T>;
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Creates a union type that still allows autocompletion for strings.
|
|
168
|
-
* @internal
|
|
169
|
-
*/
|
|
170
|
-
declare type _LiteralUnion<LiteralType, BaseType extends string = string> = LiteralType | (BaseType & Record<never, never>);
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Ensures a route is loaded, so it can be passed as o prop to `<RouterView>`.
|
|
174
|
-
*
|
|
175
|
-
* @param route - resolved route to load
|
|
176
|
-
*/
|
|
177
|
-
export declare function loadRouteLocation(route: RouteLocation | RouteLocationNormalized): Promise<RouteLocationNormalizedLoaded>;
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* @internal
|
|
181
|
-
*/
|
|
182
|
-
export declare interface LocationAsRelativeRaw {
|
|
183
|
-
name?: RouteRecordNameGeneric;
|
|
184
|
-
/**
|
|
185
|
-
* Ignored path property since we are dealing with a relative location. Only `undefined` is allowed.
|
|
186
|
-
*/
|
|
187
|
-
path?: undefined;
|
|
188
|
-
params?: RouteParamsRawGeneric;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Normalized query object that appears in {@link RouteLocationNormalized}
|
|
193
|
-
*
|
|
194
|
-
* @public
|
|
195
|
-
*/
|
|
196
|
-
export declare type LocationQuery = Record<string, LocationQueryValue | LocationQueryValue[]>;
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Loose {@link LocationQuery} object that can be passed to functions like
|
|
200
|
-
* {@link Router.push} and {@link Router.replace} or anywhere when creating a
|
|
201
|
-
* {@link RouteLocationRaw}
|
|
202
|
-
*
|
|
203
|
-
* @public
|
|
204
|
-
*/
|
|
205
|
-
export declare type LocationQueryRaw = Record<string | number, LocationQueryValueRaw | LocationQueryValueRaw[]>;
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Possible values in normalized {@link LocationQuery}. `null` renders the query
|
|
209
|
-
* param but without an `=`.
|
|
210
|
-
*
|
|
211
|
-
* @example
|
|
212
|
-
* ```
|
|
213
|
-
* ?isNull&isEmpty=&other=other
|
|
214
|
-
* gives
|
|
215
|
-
* `{ isNull: null, isEmpty: '', other: 'other' }`.
|
|
216
|
-
* ```
|
|
217
|
-
*
|
|
218
|
-
* @internal
|
|
219
|
-
*/
|
|
220
|
-
export declare type LocationQueryValue = string | null;
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Possible values when defining a query.
|
|
224
|
-
*
|
|
225
|
-
* @internal
|
|
226
|
-
*/
|
|
227
|
-
export declare type LocationQueryValueRaw = LocationQueryValue | number | undefined;
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* RouteRecord being rendered by the closest ancestor Router View. Used for
|
|
231
|
-
* `onBeforeRouteUpdate` and `onBeforeRouteLeave`. rvlm stands for Router View
|
|
232
|
-
* Location Matched
|
|
233
|
-
*
|
|
234
|
-
* @internal
|
|
235
|
-
*/
|
|
236
|
-
export declare const matchedRouteKey: InjectionKey<ComputedRef<RouteRecordNormalized | undefined>>;
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* Normalized/resolved Route location that returned by the matcher.
|
|
240
|
-
*/
|
|
241
|
-
export declare interface MatcherLocation {
|
|
242
|
-
/**
|
|
243
|
-
* Name of the matched record
|
|
244
|
-
*/
|
|
245
|
-
name: RouteRecordNameGeneric | null | undefined;
|
|
246
|
-
/**
|
|
247
|
-
* Percentage encoded pathname section of the URL.
|
|
248
|
-
*/
|
|
249
|
-
path: string;
|
|
250
|
-
/**
|
|
251
|
-
* Object of decoded params extracted from the `path`.
|
|
252
|
-
*/
|
|
253
|
-
params: RouteParamsGeneric;
|
|
254
|
-
/**
|
|
255
|
-
* Merged `meta` properties from all the matched route records.
|
|
256
|
-
*/
|
|
257
|
-
meta: RouteMeta;
|
|
258
|
-
/**
|
|
259
|
-
* Array of {@link RouteRecord} containing components as they were
|
|
260
|
-
* passed when adding records. It can also contain redirect records. This
|
|
261
|
-
* can't be used directly
|
|
262
|
-
*/
|
|
263
|
-
matched: RouteRecord[];
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* @internal
|
|
268
|
-
*/
|
|
269
|
-
declare interface MatcherLocationAsName {
|
|
270
|
-
name: RouteRecordNameGeneric;
|
|
271
|
-
/**
|
|
272
|
-
* Ignored path property since we are dealing with a relative location. Only `undefined` is allowed.
|
|
273
|
-
*/
|
|
274
|
-
path?: undefined;
|
|
275
|
-
params?: RouteParamsGeneric;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* @internal
|
|
280
|
-
*/
|
|
281
|
-
export declare interface MatcherLocationAsPath {
|
|
282
|
-
path: string;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* @internal
|
|
287
|
-
*/
|
|
288
|
-
declare interface MatcherLocationAsRelative {
|
|
289
|
-
/**
|
|
290
|
-
* Ignored path property since we are dealing with a relative location. Only `undefined` is allowed.
|
|
291
|
-
*/
|
|
292
|
-
path?: undefined;
|
|
293
|
-
params?: RouteParamsGeneric;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Route location that can be passed to the matcher.
|
|
298
|
-
*/
|
|
299
|
-
declare type MatcherLocationRaw = MatcherLocationAsPath | MatcherLocationAsName | MatcherLocationAsRelative;
|
|
300
|
-
|
|
301
|
-
declare interface NavigationCallback {
|
|
302
|
-
(to: HistoryLocation, from: HistoryLocation, information: NavigationInformation): void;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
declare enum NavigationDirection {
|
|
306
|
-
back = "back",
|
|
307
|
-
forward = "forward",
|
|
308
|
-
unknown = ""
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* Extended Error that contains extra information regarding a failed navigation.
|
|
313
|
-
*/
|
|
314
|
-
export declare interface NavigationFailure extends Error {
|
|
315
|
-
/**
|
|
316
|
-
* Type of the navigation. One of {@link NavigationFailureType}
|
|
317
|
-
*/
|
|
318
|
-
type: ErrorTypes.NAVIGATION_CANCELLED | ErrorTypes.NAVIGATION_ABORTED | ErrorTypes.NAVIGATION_DUPLICATED;
|
|
319
|
-
/**
|
|
320
|
-
* Route location we were navigating from
|
|
321
|
-
*/
|
|
322
|
-
from: RouteLocationNormalized;
|
|
323
|
-
/**
|
|
324
|
-
* Route location we were navigating to
|
|
325
|
-
*/
|
|
326
|
-
to: RouteLocationNormalized;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* Enumeration with all possible types for navigation failures. Can be passed to
|
|
331
|
-
* {@link isNavigationFailure} to check for specific failures.
|
|
332
|
-
*/
|
|
333
|
-
export declare enum NavigationFailureType {
|
|
334
|
-
/**
|
|
335
|
-
* An aborted navigation is a navigation that failed because a navigation
|
|
336
|
-
* guard returned `false` or called `next(false)`
|
|
337
|
-
*/
|
|
338
|
-
aborted = 4,
|
|
339
|
-
/**
|
|
340
|
-
* A cancelled navigation is a navigation that failed because a more recent
|
|
341
|
-
* navigation finished started (not necessarily finished).
|
|
342
|
-
*/
|
|
343
|
-
cancelled = 8,
|
|
344
|
-
/**
|
|
345
|
-
* A duplicated navigation is a navigation that failed because it was
|
|
346
|
-
* initiated while already being at the exact same location.
|
|
347
|
-
*/
|
|
348
|
-
duplicated = 16
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* Navigation Guard.
|
|
353
|
-
*/
|
|
354
|
-
export declare interface NavigationGuard {
|
|
355
|
-
(to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, next: NavigationGuardNext): _Awaitable<NavigationGuardReturn>;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
* `next()` callback passed to navigation guards.
|
|
360
|
-
*/
|
|
361
|
-
export declare interface NavigationGuardNext {
|
|
362
|
-
(): void;
|
|
363
|
-
(error: Error): void;
|
|
364
|
-
(location: RouteLocationRaw): void;
|
|
365
|
-
(valid: boolean | undefined): void;
|
|
366
|
-
(cb: NavigationGuardNextCallback): void;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
/**
|
|
370
|
-
* Callback that can be passed to `next()` in `beforeRouteEnter()` guards.
|
|
371
|
-
*/
|
|
372
|
-
export declare type NavigationGuardNextCallback = (vm: ComponentPublicInstance) => unknown;
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
* Return types for a Navigation Guard. Based on `TypesConfig`
|
|
376
|
-
*
|
|
377
|
-
* @see {@link TypesConfig}
|
|
378
|
-
*/
|
|
379
|
-
export declare type NavigationGuardReturn = void | Error | boolean | RouteLocationRaw;
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* Navigation Guard with a type parameter for `this`.
|
|
383
|
-
* @see {@link TypesConfig}
|
|
384
|
-
*/
|
|
385
|
-
export declare interface NavigationGuardWithThis<T> {
|
|
386
|
-
(this: T, to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, next: NavigationGuardNext): _Awaitable<NavigationGuardReturn>;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
/**
|
|
390
|
-
* Navigation hook triggered after a navigation is settled.
|
|
391
|
-
*/
|
|
392
|
-
export declare interface NavigationHookAfter {
|
|
393
|
-
(to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, failure?: NavigationFailure | void): unknown;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
declare interface NavigationInformation {
|
|
397
|
-
type: NavigationType;
|
|
398
|
-
direction: NavigationDirection;
|
|
399
|
-
delta: number;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
/**
|
|
403
|
-
* Internal error used to detect a redirection.
|
|
404
|
-
*
|
|
405
|
-
* @internal
|
|
406
|
-
*/
|
|
407
|
-
export declare interface NavigationRedirectError extends Omit<NavigationFailure, 'to' | 'type'> {
|
|
408
|
-
type: ErrorTypes.NAVIGATION_GUARD_REDIRECT;
|
|
409
|
-
to: RouteLocationRaw;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
declare enum NavigationType {
|
|
413
|
-
pop = "pop",
|
|
414
|
-
push = "push"
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
* Add a navigation guard that triggers whenever the component for the current
|
|
419
|
-
* location is about to be left. Similar to {@link beforeRouteLeave} but can be
|
|
420
|
-
* used in any component. The guard is removed when the component is unmounted.
|
|
421
|
-
*
|
|
422
|
-
* @param leaveGuard - {@link NavigationGuard}
|
|
423
|
-
*/
|
|
424
|
-
export declare function onBeforeRouteLeave(leaveGuard: NavigationGuard): void;
|
|
425
|
-
|
|
426
|
-
/**
|
|
427
|
-
* Add a navigation guard that triggers whenever the current location is about
|
|
428
|
-
* to be updated. Similar to {@link beforeRouteUpdate} but can be used in any
|
|
429
|
-
* component. The guard is removed when the component is unmounted.
|
|
430
|
-
*
|
|
431
|
-
* @param updateGuard - {@link NavigationGuard}
|
|
432
|
-
*/
|
|
433
|
-
export declare function onBeforeRouteUpdate(updateGuard: NavigationGuard): void;
|
|
434
|
-
|
|
435
|
-
/**
|
|
436
|
-
* Utility type for raw and non raw params like :id
|
|
437
|
-
*
|
|
438
|
-
*/
|
|
439
|
-
export declare type ParamValue<isRaw extends boolean> = true extends isRaw ? string | number : string;
|
|
440
|
-
|
|
441
|
-
/**
|
|
442
|
-
* Utility type for raw and non raw params like :id+
|
|
443
|
-
*
|
|
444
|
-
*/
|
|
445
|
-
export declare type ParamValueOneOrMore<isRaw extends boolean> = [
|
|
446
|
-
ParamValue<isRaw>,
|
|
447
|
-
...ParamValue<isRaw>[]
|
|
448
|
-
];
|
|
449
|
-
|
|
450
|
-
/**
|
|
451
|
-
* Utility type for raw and non raw params like :id*
|
|
452
|
-
*
|
|
453
|
-
*/
|
|
454
|
-
export declare type ParamValueZeroOrMore<isRaw extends boolean> = true extends isRaw ? ParamValue<isRaw>[] | undefined | null : ParamValue<isRaw>[] | undefined;
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* Utility type for raw and non raw params like :id?
|
|
458
|
-
*
|
|
459
|
-
*/
|
|
460
|
-
export declare type ParamValueZeroOrOne<isRaw extends boolean> = true extends isRaw ? string | number | null | undefined : string;
|
|
461
|
-
|
|
462
|
-
/**
|
|
463
|
-
* Transforms a queryString into a {@link LocationQuery} object. Accept both, a
|
|
464
|
-
* version with the leading `?` and without Should work as URLSearchParams
|
|
465
|
-
|
|
466
|
-
* @internal
|
|
467
|
-
*
|
|
468
|
-
* @param search - search string to parse
|
|
469
|
-
* @returns a query object
|
|
470
|
-
*/
|
|
471
|
-
export declare function parseQuery(search: string): LocationQuery;
|
|
472
|
-
|
|
473
|
-
declare type PathParams = Record<string, string | string[]>;
|
|
474
|
-
|
|
475
|
-
declare interface PathParser {
|
|
476
|
-
/**
|
|
477
|
-
* The regexp used to match a url
|
|
478
|
-
*/
|
|
479
|
-
re: RegExp;
|
|
480
|
-
/**
|
|
481
|
-
* The score of the parser
|
|
482
|
-
*/
|
|
483
|
-
score: Array<number[]>;
|
|
484
|
-
/**
|
|
485
|
-
* Keys that appeared in the path
|
|
486
|
-
*/
|
|
487
|
-
keys: PathParserParamKey[];
|
|
488
|
-
/**
|
|
489
|
-
* Parses a url and returns the matched params or null if it doesn't match. An
|
|
490
|
-
* optional param that isn't preset will be an empty string. A repeatable
|
|
491
|
-
* param will be an array if there is at least one value.
|
|
492
|
-
*
|
|
493
|
-
* @param path - url to parse
|
|
494
|
-
* @returns a Params object, empty if there are no params. `null` if there is
|
|
495
|
-
* no match
|
|
496
|
-
*/
|
|
497
|
-
parse(path: string): PathParams | null;
|
|
498
|
-
/**
|
|
499
|
-
* Creates a string version of the url
|
|
500
|
-
*
|
|
501
|
-
* @param params - object of params
|
|
502
|
-
* @returns a url
|
|
503
|
-
*/
|
|
504
|
-
stringify(params: PathParams): string;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
export declare type PathParserOptions = Pick<_PathParserOptions, 'end' | 'sensitive' | 'strict'>;
|
|
508
|
-
|
|
509
|
-
/**
|
|
510
|
-
* @internal
|
|
511
|
-
*/
|
|
512
|
-
export declare interface _PathParserOptions {
|
|
513
|
-
/**
|
|
514
|
-
* Makes the RegExp case-sensitive.
|
|
515
|
-
*
|
|
516
|
-
* @defaultValue `false`
|
|
517
|
-
*/
|
|
518
|
-
sensitive?: boolean;
|
|
519
|
-
/**
|
|
520
|
-
* Whether to disallow a trailing slash or not.
|
|
521
|
-
*
|
|
522
|
-
* @defaultValue `false`
|
|
523
|
-
*/
|
|
524
|
-
strict?: boolean;
|
|
525
|
-
/**
|
|
526
|
-
* Should the RegExp match from the beginning by prepending a `^` to it.
|
|
527
|
-
* @internal
|
|
528
|
-
*
|
|
529
|
-
* @defaultValue `true`
|
|
530
|
-
*/
|
|
531
|
-
start?: boolean;
|
|
532
|
-
/**
|
|
533
|
-
* Should the RegExp match until the end by appending a `$` to it.
|
|
534
|
-
*
|
|
535
|
-
* @defaultValue `true`
|
|
536
|
-
*/
|
|
537
|
-
end?: boolean;
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
/**
|
|
541
|
-
* A param in a url like `/users/:id`
|
|
542
|
-
*/
|
|
543
|
-
declare interface PathParserParamKey {
|
|
544
|
-
name: string;
|
|
545
|
-
repeatable: boolean;
|
|
546
|
-
optional: boolean;
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
/**
|
|
550
|
-
* Allowed Component definitions in route records provided by the user
|
|
551
|
-
*/
|
|
552
|
-
declare type RawRouteComponent = RouteComponent | Lazy<RouteComponent>;
|
|
553
|
-
|
|
554
|
-
/**
|
|
555
|
-
* Allowed Component in {@link RouteLocationMatched}
|
|
556
|
-
*/
|
|
557
|
-
export declare type RouteComponent = Component | DefineComponent;
|
|
558
|
-
|
|
559
|
-
/**
|
|
560
|
-
* Type safe versions of types that are exposed by vue-router. We have to use a generic check to allow for names to be `undefined` when no `RouteMap` is provided.
|
|
561
|
-
*/
|
|
562
|
-
/**
|
|
563
|
-
* {@link RouteLocationRaw} resolved using the matcher
|
|
564
|
-
*/
|
|
565
|
-
export declare type RouteLocation<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationGeneric : RouteLocationTypedList<RouteMap>[Name];
|
|
566
|
-
|
|
567
|
-
/**
|
|
568
|
-
* Route location as an object with a `path` property.
|
|
569
|
-
*/
|
|
570
|
-
export declare type RouteLocationAsPath<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationAsPathGeneric : RouteLocationAsPathTypedList<RouteMap>[Name];
|
|
571
|
-
|
|
572
|
-
/**
|
|
573
|
-
* Generic version of {@link RouteLocationAsPath}. It is used when no {@link RouteMap} is provided.
|
|
574
|
-
*/
|
|
575
|
-
export declare interface RouteLocationAsPathGeneric extends RouteQueryAndHash, RouteLocationOptions {
|
|
576
|
-
/**
|
|
577
|
-
* Percentage encoded pathname section of the URL.
|
|
578
|
-
*/
|
|
579
|
-
path: string;
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
/**
|
|
583
|
-
* Helper to generate a type safe version of the {@link RouteLocationAsPath} type.
|
|
584
|
-
*/
|
|
585
|
-
export declare interface RouteLocationAsPathTyped<RouteMap extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap = keyof RouteMap> extends RouteLocationAsPathGeneric {
|
|
586
|
-
path: _LiteralUnion<RouteMap[Name]['path']>;
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
/**
|
|
590
|
-
* List of all possible {@link RouteLocationAsPath} indexed by the route name.
|
|
591
|
-
* @internal
|
|
592
|
-
*/
|
|
593
|
-
export declare type RouteLocationAsPathTypedList<RouteMap extends RouteMapGeneric = RouteMapGeneric> = {
|
|
594
|
-
[N in keyof RouteMap]: RouteLocationAsPathTyped<RouteMap, N>;
|
|
595
|
-
};
|
|
596
|
-
|
|
597
|
-
/**
|
|
598
|
-
* Route location relative to the current location. It accepts other properties than `path` like `params`, `query` and
|
|
599
|
-
* `hash` to conveniently change them.
|
|
600
|
-
*/
|
|
601
|
-
export declare type RouteLocationAsRelative<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationAsRelativeGeneric : RouteLocationAsRelativeTypedList<RouteMap>[Name];
|
|
602
|
-
|
|
603
|
-
/**
|
|
604
|
-
* Generic version of {@link RouteLocationAsRelative}. It is used when no {@link RouteMap} is provided.
|
|
605
|
-
*/
|
|
606
|
-
export declare interface RouteLocationAsRelativeGeneric extends RouteQueryAndHash, RouteLocationOptions {
|
|
607
|
-
name?: RouteRecordNameGeneric;
|
|
608
|
-
params?: RouteParamsRawGeneric;
|
|
609
|
-
/**
|
|
610
|
-
* A relative path to the current location. This property should be removed
|
|
611
|
-
*/
|
|
612
|
-
path?: undefined;
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
/**
|
|
616
|
-
* Helper to generate a type safe version of the {@link RouteLocationAsRelative} type.
|
|
617
|
-
*/
|
|
618
|
-
export declare interface RouteLocationAsRelativeTyped<RouteMap extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap = keyof RouteMap> extends RouteLocationAsRelativeGeneric {
|
|
619
|
-
name?: Extract<Name, string | symbol>;
|
|
620
|
-
params?: RouteMap[Name]['paramsRaw'];
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
/**
|
|
624
|
-
* List of all possible {@link RouteLocationAsRelative} indexed by the route name.
|
|
625
|
-
* @internal
|
|
626
|
-
*/
|
|
627
|
-
export declare type RouteLocationAsRelativeTypedList<RouteMap extends RouteMapGeneric = RouteMapGeneric> = {
|
|
628
|
-
[N in keyof RouteMap]: RouteLocationAsRelativeTyped<RouteMap, N>;
|
|
629
|
-
};
|
|
630
|
-
|
|
631
|
-
/**
|
|
632
|
-
* Same as {@link RouteLocationAsPath} but as a string literal.
|
|
633
|
-
*/
|
|
634
|
-
export declare type RouteLocationAsString<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? string : _LiteralUnion<RouteLocationAsStringTypedList<RouteMap>[Name], string>;
|
|
635
|
-
|
|
636
|
-
/**
|
|
637
|
-
* Helper to generate a type safe version of the {@link RouteLocationAsString} type.
|
|
638
|
-
*/
|
|
639
|
-
export declare type RouteLocationAsStringTyped<RouteMap extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap = keyof RouteMap> = RouteMap[Name]['path'];
|
|
640
|
-
|
|
641
|
-
/**
|
|
642
|
-
* List of all possible {@link RouteLocationAsString} indexed by the route name.
|
|
643
|
-
* @internal
|
|
644
|
-
*/
|
|
645
|
-
export declare type RouteLocationAsStringTypedList<RouteMap extends RouteMapGeneric = RouteMapGeneric> = {
|
|
646
|
-
[N in keyof RouteMap]: RouteLocationAsStringTyped<RouteMap, N>;
|
|
647
|
-
};
|
|
648
|
-
|
|
649
|
-
/**
|
|
650
|
-
* Base properties for a normalized route location.
|
|
651
|
-
*
|
|
652
|
-
* @internal
|
|
653
|
-
*/
|
|
654
|
-
export declare interface _RouteLocationBase extends Pick<MatcherLocation, 'name' | 'path' | 'params' | 'meta'> {
|
|
655
|
-
/**
|
|
656
|
-
* The whole location including the `search` and `hash`. This string is
|
|
657
|
-
* percentage encoded.
|
|
658
|
-
*/
|
|
659
|
-
fullPath: string;
|
|
660
|
-
/**
|
|
661
|
-
* Object representation of the `search` property of the current location.
|
|
662
|
-
*/
|
|
663
|
-
query: LocationQuery;
|
|
664
|
-
/**
|
|
665
|
-
* Hash of the current location. If present, starts with a `#`.
|
|
666
|
-
*/
|
|
667
|
-
hash: string;
|
|
668
|
-
/**
|
|
669
|
-
* Contains the location we were initially trying to access before ending up
|
|
670
|
-
* on the current location.
|
|
671
|
-
*/
|
|
672
|
-
redirectedFrom: RouteLocation | undefined;
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
/**
|
|
676
|
-
* Generic version of {@link RouteLocation}. It is used when no {@link RouteMap} is provided.
|
|
677
|
-
*/
|
|
678
|
-
export declare interface RouteLocationGeneric extends _RouteLocationBase {
|
|
679
|
-
/**
|
|
680
|
-
* Array of {@link RouteRecord} containing components as they were
|
|
681
|
-
* passed when adding records. It can also contain redirect records. This
|
|
682
|
-
* can't be used directly. **This property is non-enumerable**.
|
|
683
|
-
*/
|
|
684
|
-
matched: RouteRecord[];
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
/**
|
|
688
|
-
* Allows overriding the current route returned by `useRoute` in tests. rl
|
|
689
|
-
* stands for route location
|
|
690
|
-
*
|
|
691
|
-
* @internal
|
|
692
|
-
*/
|
|
693
|
-
export declare const routeLocationKey: InjectionKey<RouteLocationNormalizedLoaded>;
|
|
694
|
-
|
|
695
|
-
export declare interface RouteLocationMatched extends RouteRecordNormalized {
|
|
696
|
-
components: Record<string, RouteComponent> | null | undefined;
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
/**
|
|
700
|
-
* Route Location that can infer the necessary params based on the name.
|
|
701
|
-
*
|
|
702
|
-
* @internal
|
|
703
|
-
*/
|
|
704
|
-
export declare interface RouteLocationNamedRaw extends RouteQueryAndHash, LocationAsRelativeRaw, RouteLocationOptions {
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
/**
|
|
708
|
-
* Similar to {@link RouteLocation} but its
|
|
709
|
-
* {@link RouteLocationNormalizedTyped.matched | `matched` property} cannot contain redirect records
|
|
710
|
-
*/
|
|
711
|
-
export declare type RouteLocationNormalized<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationNormalizedGeneric : RouteLocationNormalizedTypedList<RouteMap>[Name];
|
|
712
|
-
|
|
713
|
-
/**
|
|
714
|
-
* Generic version of {@link RouteLocationNormalized} that is used when no {@link RouteMap} is provided.
|
|
715
|
-
*/
|
|
716
|
-
export declare interface RouteLocationNormalizedGeneric extends _RouteLocationBase {
|
|
717
|
-
name: RouteRecordNameGeneric;
|
|
718
|
-
params: RouteParamsGeneric;
|
|
719
|
-
/**
|
|
720
|
-
* Array of {@link RouteRecordNormalized}
|
|
721
|
-
*/
|
|
722
|
-
matched: RouteRecordNormalized[];
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
/**
|
|
726
|
-
* Similar to {@link RouteLocationNormalized} but its `components` do not contain any function to lazy load components.
|
|
727
|
-
* In other words, it's ready to be rendered by `<RouterView>`.
|
|
728
|
-
*/
|
|
729
|
-
export declare type RouteLocationNormalizedLoaded<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationNormalizedLoadedGeneric : RouteLocationNormalizedLoadedTypedList<RouteMap>[Name];
|
|
730
|
-
|
|
731
|
-
/**
|
|
732
|
-
* Generic version of {@link RouteLocationNormalizedLoaded} that is used when no {@link RouteMap} is provided.
|
|
733
|
-
*/
|
|
734
|
-
export declare interface RouteLocationNormalizedLoadedGeneric extends RouteLocationNormalizedGeneric {
|
|
735
|
-
/**
|
|
736
|
-
* Array of {@link RouteLocationMatched} containing only plain components (any
|
|
737
|
-
* lazy-loaded components have been loaded and were replaced inside the
|
|
738
|
-
* `components` object) so it can be directly used to display routes. It
|
|
739
|
-
* cannot contain redirect records either. **This property is non-enumerable**.
|
|
740
|
-
*/
|
|
741
|
-
matched: RouteLocationMatched[];
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
/**
|
|
745
|
-
* Helper to generate a type safe version of the {@link RouteLocationNormalizedLoaded} type.
|
|
746
|
-
*/
|
|
747
|
-
export declare interface RouteLocationNormalizedLoadedTyped<RouteMap extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap = keyof RouteMap> extends RouteLocationNormalizedLoadedGeneric {
|
|
748
|
-
name: Extract<Name, string | symbol>;
|
|
749
|
-
params: RouteMap[Name]['params'];
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
/**
|
|
753
|
-
* List of all possible {@link RouteLocationNormalizedLoaded} indexed by the route name.
|
|
754
|
-
* @internal
|
|
755
|
-
*/
|
|
756
|
-
export declare type RouteLocationNormalizedLoadedTypedList<RouteMap extends RouteMapGeneric = RouteMapGeneric> = {
|
|
757
|
-
[N in keyof RouteMap]: RouteLocationNormalizedLoadedTyped<RouteMap, N>;
|
|
758
|
-
};
|
|
759
|
-
|
|
760
|
-
/**
|
|
761
|
-
* Helper to generate a type safe version of the {@link RouteLocationNormalized} type.
|
|
762
|
-
*/
|
|
763
|
-
export declare interface RouteLocationNormalizedTyped<RouteMap extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap = keyof RouteMap> extends RouteLocationNormalizedGeneric {
|
|
764
|
-
name: Extract<Name, string | symbol>;
|
|
765
|
-
params: RouteMap[Name]['params'];
|
|
766
|
-
/**
|
|
767
|
-
* Array of {@link RouteRecordNormalized}
|
|
768
|
-
*/
|
|
769
|
-
matched: RouteRecordNormalized[];
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
/**
|
|
773
|
-
* List of all possible {@link RouteLocationNormalized} indexed by the route name.
|
|
774
|
-
* @internal
|
|
775
|
-
*/
|
|
776
|
-
export declare type RouteLocationNormalizedTypedList<RouteMap extends RouteMapGeneric = RouteMapGeneric> = {
|
|
777
|
-
[N in keyof RouteMap]: RouteLocationNormalizedTyped<RouteMap, N>;
|
|
778
|
-
};
|
|
779
|
-
|
|
780
|
-
/**
|
|
781
|
-
* Common options for all navigation methods.
|
|
782
|
-
*/
|
|
783
|
-
export declare interface RouteLocationOptions {
|
|
784
|
-
/**
|
|
785
|
-
* Replace the entry in the history instead of pushing a new entry
|
|
786
|
-
*/
|
|
787
|
-
replace?: boolean;
|
|
788
|
-
/**
|
|
789
|
-
* Triggers the navigation even if the location is the same as the current one.
|
|
790
|
-
* Note this will also add a new entry to the history unless `replace: true`
|
|
791
|
-
* is passed.
|
|
792
|
-
*/
|
|
793
|
-
force?: boolean;
|
|
794
|
-
/**
|
|
795
|
-
* State to save using the History API. This cannot contain any reactive
|
|
796
|
-
* values and some primitives like Symbols are forbidden. More info at
|
|
797
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/History/state
|
|
798
|
-
*/
|
|
799
|
-
state?: HistoryState;
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
/**
|
|
803
|
-
* Route Location that can infer the possible paths.
|
|
804
|
-
*
|
|
805
|
-
* @internal
|
|
806
|
-
*/
|
|
807
|
-
export declare interface RouteLocationPathRaw extends RouteQueryAndHash, MatcherLocationAsPath, RouteLocationOptions {
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
/**
|
|
811
|
-
* Route location that can be passed to `router.push()` and other user-facing APIs.
|
|
812
|
-
*/
|
|
813
|
-
export declare type RouteLocationRaw<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationAsString | RouteLocationAsRelativeGeneric | RouteLocationAsPathGeneric : _LiteralUnion<RouteLocationAsStringTypedList<RouteMap>[Name], string> | RouteLocationAsRelativeTypedList<RouteMap>[Name] | RouteLocationAsPathTypedList<RouteMap>[Name];
|
|
814
|
-
|
|
815
|
-
/**
|
|
816
|
-
* Route location resolved with {@link Router | `router.resolve()`}.
|
|
817
|
-
*/
|
|
818
|
-
export declare type RouteLocationResolved<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationResolvedGeneric : RouteLocationResolvedTypedList<RouteMap>[Name];
|
|
819
|
-
|
|
820
|
-
/**
|
|
821
|
-
* Generic version of {@link RouteLocationResolved}. It is used when no {@link RouteMap} is provided.
|
|
822
|
-
*/
|
|
823
|
-
export declare interface RouteLocationResolvedGeneric extends RouteLocationGeneric {
|
|
824
|
-
/**
|
|
825
|
-
* Resolved `href` for the route location that will be set on the `<a href="...">`.
|
|
826
|
-
*/
|
|
827
|
-
href: string;
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
/**
|
|
831
|
-
* Helper to generate a type safe version of the {@link RouteLocationResolved} type.
|
|
832
|
-
*/
|
|
833
|
-
export declare interface RouteLocationResolvedTyped<RouteMap extends RouteMapGeneric, Name extends keyof RouteMap> extends RouteLocationTyped<RouteMap, Name> {
|
|
834
|
-
/**
|
|
835
|
-
* Resolved `href` for the route location that will be set on the `<a href="...">`.
|
|
836
|
-
*/
|
|
837
|
-
href: string;
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
/**
|
|
841
|
-
* List of all possible {@link RouteLocationResolved} indexed by the route name.
|
|
842
|
-
* @internal
|
|
843
|
-
*/
|
|
844
|
-
export declare type RouteLocationResolvedTypedList<RouteMap extends RouteMapGeneric = RouteMapGeneric> = {
|
|
845
|
-
[N in keyof RouteMap]: RouteLocationResolvedTyped<RouteMap, N>;
|
|
846
|
-
};
|
|
847
|
-
|
|
848
|
-
/**
|
|
849
|
-
* Helper to generate a type safe version of the {@link RouteLocation} type.
|
|
850
|
-
*/
|
|
851
|
-
export declare interface RouteLocationTyped<RouteMap extends RouteMapGeneric, Name extends keyof RouteMap> extends RouteLocationGeneric {
|
|
852
|
-
name: Extract<Name, string | symbol>;
|
|
853
|
-
params: RouteMap[Name]['params'];
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
/**
|
|
857
|
-
* List of all possible {@link RouteLocation} indexed by the route name.
|
|
858
|
-
* @internal
|
|
859
|
-
*/
|
|
860
|
-
export declare type RouteLocationTypedList<RouteMap extends RouteMapGeneric = RouteMapGeneric> = {
|
|
861
|
-
[N in keyof RouteMap]: RouteLocationTyped<RouteMap, N>;
|
|
862
|
-
};
|
|
863
|
-
|
|
864
|
-
/**
|
|
865
|
-
* Convenience type to get the typed RouteMap or a generic one if not provided. It is extracted from the {@link TypesConfig} if it exists, it becomes {@link RouteMapGeneric} otherwise.
|
|
866
|
-
*/
|
|
867
|
-
export declare type RouteMap = TypesConfig extends Record<'RouteNamedMap', infer RouteNamedMap> ? RouteNamedMap : RouteMapGeneric;
|
|
868
|
-
|
|
869
|
-
/**
|
|
870
|
-
* Generic version of the `RouteMap`.
|
|
871
|
-
*/
|
|
872
|
-
export declare type RouteMapGeneric = Record<string | symbol, RouteRecordInfo>;
|
|
873
|
-
|
|
874
|
-
/**
|
|
875
|
-
* Interface to type `meta` fields in route records.
|
|
876
|
-
*
|
|
877
|
-
* @example
|
|
878
|
-
*
|
|
879
|
-
* ```ts
|
|
880
|
-
* // typings.d.ts or router.ts
|
|
881
|
-
* import 'vue-router';
|
|
882
|
-
*
|
|
883
|
-
* declare module 'vue-router' {
|
|
884
|
-
* interface RouteMeta {
|
|
885
|
-
* requiresAuth?: boolean
|
|
886
|
-
* }
|
|
887
|
-
* }
|
|
888
|
-
* ```
|
|
889
|
-
*/
|
|
890
|
-
export declare interface RouteMeta extends Record<string | number | symbol, unknown> {
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
/**
|
|
894
|
-
* Generate a type safe params for a route location. Requires the name of the route to be passed as a generic.
|
|
895
|
-
* @see {@link RouteParamsGeneric}
|
|
896
|
-
*/
|
|
897
|
-
export declare type RouteParams<Name extends keyof RouteMap = keyof RouteMap> = RouteMap[Name]['params'];
|
|
898
|
-
|
|
899
|
-
export declare type RouteParamsGeneric = Record<string, RouteParamValue | RouteParamValue[]>;
|
|
900
|
-
|
|
901
|
-
/**
|
|
902
|
-
* Generate a type safe raw params for a route location. Requires the name of the route to be passed as a generic.
|
|
903
|
-
* @see {@link RouteParamsRaw}
|
|
904
|
-
*/
|
|
905
|
-
export declare type RouteParamsRaw<Name extends keyof RouteMap = keyof RouteMap> = RouteMap[Name]['paramsRaw'];
|
|
906
|
-
|
|
907
|
-
export declare type RouteParamsRawGeneric = Record<string, RouteParamValueRaw | Exclude<RouteParamValueRaw, null | undefined>[]>;
|
|
908
|
-
|
|
909
|
-
/**
|
|
910
|
-
* @internal
|
|
911
|
-
*/
|
|
912
|
-
export declare type RouteParamValue = string;
|
|
913
|
-
|
|
914
|
-
/**
|
|
915
|
-
* @internal
|
|
916
|
-
*/
|
|
917
|
-
export declare type RouteParamValueRaw = RouteParamValue | number | null | undefined;
|
|
918
|
-
|
|
919
|
-
/**
|
|
920
|
-
* @internal
|
|
921
|
-
*/
|
|
922
|
-
export declare interface RouteQueryAndHash {
|
|
923
|
-
query?: LocationQueryRaw;
|
|
924
|
-
hash?: string;
|
|
925
|
-
}
|
|
926
|
-
|
|
927
|
-
/**
|
|
928
|
-
* Router instance.
|
|
929
|
-
*/
|
|
930
|
-
export declare interface Router {
|
|
931
|
-
/**
|
|
932
|
-
* @internal
|
|
933
|
-
*/
|
|
934
|
-
/**
|
|
935
|
-
* Current {@link RouteLocationNormalized}
|
|
936
|
-
*/
|
|
937
|
-
readonly currentRoute: Ref<RouteLocationNormalizedLoaded>;
|
|
938
|
-
/**
|
|
939
|
-
* Original options object passed to create the Router
|
|
940
|
-
*/
|
|
941
|
-
readonly options: RouterOptions;
|
|
942
|
-
/**
|
|
943
|
-
* Allows turning off the listening of history events. This is a low level api for micro-frontend.
|
|
944
|
-
*/
|
|
945
|
-
listening: boolean;
|
|
946
|
-
/**
|
|
947
|
-
* Add a new {@link RouteRecordRaw | route record} as the child of an existing route.
|
|
948
|
-
*
|
|
949
|
-
* @param parentName - Parent Route Record where `route` should be appended at
|
|
950
|
-
* @param route - Route Record to add
|
|
951
|
-
*/
|
|
952
|
-
addRoute(parentName: NonNullable<RouteRecordNameGeneric>, route: RouteRecordRaw): () => void;
|
|
953
|
-
/**
|
|
954
|
-
* Add a new {@link RouteRecordRaw | route record} to the router.
|
|
955
|
-
*
|
|
956
|
-
* @param route - Route Record to add
|
|
957
|
-
*/
|
|
958
|
-
addRoute(route: RouteRecordRaw): () => void;
|
|
959
|
-
/**
|
|
960
|
-
* Remove an existing route by its name.
|
|
961
|
-
*
|
|
962
|
-
* @param name - Name of the route to remove
|
|
963
|
-
*/
|
|
964
|
-
removeRoute(name: NonNullable<RouteRecordNameGeneric>): void;
|
|
965
|
-
/**
|
|
966
|
-
* Checks if a route with a given name exists
|
|
967
|
-
*
|
|
968
|
-
* @param name - Name of the route to check
|
|
969
|
-
*/
|
|
970
|
-
hasRoute(name: NonNullable<RouteRecordNameGeneric>): boolean;
|
|
971
|
-
/**
|
|
972
|
-
* Get a full list of all the {@link RouteRecord | route records}.
|
|
973
|
-
*/
|
|
974
|
-
getRoutes(): RouteRecord[];
|
|
975
|
-
/**
|
|
976
|
-
* Delete all routes from the router matcher.
|
|
977
|
-
*/
|
|
978
|
-
clearRoutes(): void;
|
|
979
|
-
/**
|
|
980
|
-
* Returns the {@link RouteLocation | normalized version} of a
|
|
981
|
-
* {@link RouteLocationRaw | route location}. Also includes an `href` property
|
|
982
|
-
* that includes any existing `base`. By default, the `currentLocation` used is
|
|
983
|
-
* `router.currentRoute` and should only be overridden in advanced use cases.
|
|
984
|
-
*
|
|
985
|
-
* @param to - Raw route location to resolve
|
|
986
|
-
* @param currentLocation - Optional current location to resolve against
|
|
987
|
-
*/
|
|
988
|
-
resolve<Name extends keyof RouteMap = keyof RouteMap>(to: RouteLocationAsRelativeTyped<RouteMap, Name>, currentLocation?: RouteLocationNormalizedLoaded): RouteLocationResolved<Name>;
|
|
989
|
-
resolve(to: RouteLocationAsString | RouteLocationAsRelative | RouteLocationAsPath, currentLocation?: RouteLocationNormalizedLoaded): RouteLocationResolved;
|
|
990
|
-
/**
|
|
991
|
-
* Programmatically navigate to a new URL by pushing an entry in the history
|
|
992
|
-
* stack.
|
|
993
|
-
*
|
|
994
|
-
* @param to - Route location to navigate to
|
|
995
|
-
*/
|
|
996
|
-
push(to: RouteLocationRaw): Promise<NavigationFailure | void | undefined>;
|
|
997
|
-
/**
|
|
998
|
-
* Programmatically navigate to a new URL by replacing the current entry in
|
|
999
|
-
* the history stack.
|
|
1000
|
-
*
|
|
1001
|
-
* @param to - Route location to navigate to
|
|
1002
|
-
*/
|
|
1003
|
-
replace(to: RouteLocationRaw): Promise<NavigationFailure | void | undefined>;
|
|
1004
|
-
/**
|
|
1005
|
-
* Go back in history if possible by calling `history.back()`. Equivalent to
|
|
1006
|
-
* `router.go(-1)`.
|
|
1007
|
-
*/
|
|
1008
|
-
back(): ReturnType<Router['go']>;
|
|
1009
|
-
/**
|
|
1010
|
-
* Go forward in history if possible by calling `history.forward()`.
|
|
1011
|
-
* Equivalent to `router.go(1)`.
|
|
1012
|
-
*/
|
|
1013
|
-
forward(): ReturnType<Router['go']>;
|
|
1014
|
-
/**
|
|
1015
|
-
* Allows you to move forward or backward through the history. Calls
|
|
1016
|
-
* `history.go()`.
|
|
1017
|
-
*
|
|
1018
|
-
* @param delta - The position in the history to which you want to move,
|
|
1019
|
-
* relative to the current page
|
|
1020
|
-
*/
|
|
1021
|
-
go(delta: number): void;
|
|
1022
|
-
/**
|
|
1023
|
-
* Add a navigation guard that executes before any navigation. Returns a
|
|
1024
|
-
* function that removes the registered guard.
|
|
1025
|
-
*
|
|
1026
|
-
* @param guard - navigation guard to add
|
|
1027
|
-
*/
|
|
1028
|
-
beforeEach(guard: NavigationGuardWithThis<undefined>): () => void;
|
|
1029
|
-
/**
|
|
1030
|
-
* Add a navigation guard that executes before navigation is about to be
|
|
1031
|
-
* resolved. At this state all component have been fetched and other
|
|
1032
|
-
* navigation guards have been successful. Returns a function that removes the
|
|
1033
|
-
* registered guard.
|
|
1034
|
-
*
|
|
1035
|
-
* @param guard - navigation guard to add
|
|
1036
|
-
* @returns a function that removes the registered guard
|
|
1037
|
-
*
|
|
1038
|
-
* @example
|
|
1039
|
-
* ```js
|
|
1040
|
-
* router.beforeResolve(to => {
|
|
1041
|
-
* if (to.meta.requiresAuth && !isAuthenticated) return false
|
|
1042
|
-
* })
|
|
1043
|
-
* ```
|
|
1044
|
-
*
|
|
1045
|
-
*/
|
|
1046
|
-
beforeResolve(guard: NavigationGuardWithThis<undefined>): () => void;
|
|
1047
|
-
/**
|
|
1048
|
-
* Add a navigation hook that is executed after every navigation. Returns a
|
|
1049
|
-
* function that removes the registered hook.
|
|
1050
|
-
*
|
|
1051
|
-
* @param guard - navigation hook to add
|
|
1052
|
-
* @returns a function that removes the registered hook
|
|
1053
|
-
*
|
|
1054
|
-
* @example
|
|
1055
|
-
* ```js
|
|
1056
|
-
* router.afterEach((to, from, failure) => {
|
|
1057
|
-
* if (isNavigationFailure(failure)) {
|
|
1058
|
-
* console.log('failed navigation', failure)
|
|
1059
|
-
* }
|
|
1060
|
-
* })
|
|
1061
|
-
* ```
|
|
1062
|
-
*/
|
|
1063
|
-
afterEach(guard: NavigationHookAfter): () => void;
|
|
1064
|
-
/**
|
|
1065
|
-
* Adds an error handler that is called every time a non caught error happens
|
|
1066
|
-
* during navigation. This includes errors thrown synchronously and
|
|
1067
|
-
* asynchronously, errors returned or passed to `next` in any navigation
|
|
1068
|
-
* guard, and errors occurred when trying to resolve an async component that
|
|
1069
|
-
* is required to render a route.
|
|
1070
|
-
*
|
|
1071
|
-
* @param handler - error handler to register
|
|
1072
|
-
*/
|
|
1073
|
-
onError(handler: _ErrorListener): () => void;
|
|
1074
|
-
/**
|
|
1075
|
-
* Returns a Promise that resolves when the router has completed the initial
|
|
1076
|
-
* navigation, which means it has resolved all async enter hooks and async
|
|
1077
|
-
* components that are associated with the initial route. If the initial
|
|
1078
|
-
* navigation already happened, the promise resolves immediately.
|
|
1079
|
-
*
|
|
1080
|
-
* This is useful in server-side rendering to ensure consistent output on both
|
|
1081
|
-
* the server and the client. Note that on server side, you need to manually
|
|
1082
|
-
* push the initial location while on client side, the router automatically
|
|
1083
|
-
* picks it up from the URL.
|
|
1084
|
-
*/
|
|
1085
|
-
isReady(): Promise<void>;
|
|
1086
|
-
/**
|
|
1087
|
-
* Called automatically by `app.use(router)`. Should not be called manually by
|
|
1088
|
-
* the user. This will trigger the initial navigation when on client side.
|
|
1089
|
-
*
|
|
1090
|
-
* @internal
|
|
1091
|
-
* @param app - Application that uses the router
|
|
1092
|
-
*/
|
|
1093
|
-
install(app: App): void;
|
|
1094
|
-
}
|
|
1095
|
-
|
|
1096
|
-
/**
|
|
1097
|
-
* {@inheritDoc RouteRecordNormalized}
|
|
1098
|
-
*/
|
|
1099
|
-
export declare type RouteRecord = RouteRecordNormalized;
|
|
1100
|
-
|
|
1101
|
-
/**
|
|
1102
|
-
* Internal type for common properties among all kind of {@link RouteRecordRaw}.
|
|
1103
|
-
*/
|
|
1104
|
-
export declare interface _RouteRecordBase extends PathParserOptions {
|
|
1105
|
-
/**
|
|
1106
|
-
* Path of the record. Should start with `/` unless the record is the child of
|
|
1107
|
-
* another record.
|
|
1108
|
-
*
|
|
1109
|
-
* @example `/users/:id` matches `/users/1` as well as `/users/posva`.
|
|
1110
|
-
*/
|
|
1111
|
-
path: string;
|
|
1112
|
-
/**
|
|
1113
|
-
* Where to redirect if the route is directly matched. The redirection happens
|
|
1114
|
-
* before any navigation guard and triggers a new navigation with the new
|
|
1115
|
-
* target location.
|
|
1116
|
-
*/
|
|
1117
|
-
redirect?: RouteRecordRedirectOption;
|
|
1118
|
-
/**
|
|
1119
|
-
* Aliases for the record. Allows defining extra paths that will behave like a
|
|
1120
|
-
* copy of the record. Allows having paths shorthands like `/users/:id` and
|
|
1121
|
-
* `/u/:id`. All `alias` and `path` values must share the same params.
|
|
1122
|
-
*/
|
|
1123
|
-
alias?: string | string[];
|
|
1124
|
-
/**
|
|
1125
|
-
* Name for the route record. Must be unique.
|
|
1126
|
-
*/
|
|
1127
|
-
name?: RouteRecordNameGeneric;
|
|
1128
|
-
/**
|
|
1129
|
-
* Before Enter guard specific to this record. Note `beforeEnter` has no
|
|
1130
|
-
* effect if the record has a `redirect` property.
|
|
1131
|
-
*/
|
|
1132
|
-
beforeEnter?: NavigationGuardWithThis<undefined> | NavigationGuardWithThis<undefined>[];
|
|
1133
|
-
/**
|
|
1134
|
-
* Arbitrary data attached to the record.
|
|
1135
|
-
*/
|
|
1136
|
-
meta?: RouteMeta;
|
|
1137
|
-
/**
|
|
1138
|
-
* Array of nested routes.
|
|
1139
|
-
*/
|
|
1140
|
-
children?: RouteRecordRaw[];
|
|
1141
|
-
/**
|
|
1142
|
-
* Allow passing down params as props to the component rendered by `router-view`.
|
|
1143
|
-
*/
|
|
1144
|
-
props?: _RouteRecordProps | Record<string, _RouteRecordProps>;
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
|
-
/**
|
|
1148
|
-
* Helper type to define a Typed `RouteRecord`
|
|
1149
|
-
* @see {@link RouteRecord}
|
|
1150
|
-
*/
|
|
1151
|
-
export declare interface RouteRecordInfo<Name extends string | symbol = string, Path extends string = string, ParamsRaw extends RouteParamsRawGeneric = RouteParamsRawGeneric, Params extends RouteParamsGeneric = RouteParamsGeneric, Meta extends RouteMeta = RouteMeta> {
|
|
1152
|
-
name: Name;
|
|
1153
|
-
path: Path;
|
|
1154
|
-
paramsRaw: ParamsRaw;
|
|
1155
|
-
params: Params;
|
|
1156
|
-
meta: Meta;
|
|
1157
|
-
}
|
|
1158
|
-
|
|
1159
|
-
declare interface RouteRecordMatcher extends PathParser {
|
|
1160
|
-
record: RouteRecord;
|
|
1161
|
-
parent: RouteRecordMatcher | undefined;
|
|
1162
|
-
children: RouteRecordMatcher[];
|
|
1163
|
-
alias: RouteRecordMatcher[];
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
/**
|
|
1167
|
-
* Route Record defining multiple named components with the `components` option.
|
|
1168
|
-
*/
|
|
1169
|
-
export declare interface RouteRecordMultipleViews extends _RouteRecordBase {
|
|
1170
|
-
/**
|
|
1171
|
-
* Components to display when the URL matches this route. Allow using named views.
|
|
1172
|
-
*/
|
|
1173
|
-
components: Record<string, RawRouteComponent>;
|
|
1174
|
-
component?: never;
|
|
1175
|
-
children?: never;
|
|
1176
|
-
redirect?: never;
|
|
1177
|
-
/**
|
|
1178
|
-
* Allow passing down params as props to the component rendered by
|
|
1179
|
-
* `router-view`. Should be an object with the same keys as `components` or a
|
|
1180
|
-
* boolean to be applied to every component.
|
|
1181
|
-
*/
|
|
1182
|
-
props?: Record<string, _RouteRecordProps> | boolean;
|
|
1183
|
-
}
|
|
1184
|
-
|
|
1185
|
-
/**
|
|
1186
|
-
* Route Record defining multiple named components with the `components` option and children.
|
|
1187
|
-
*/
|
|
1188
|
-
export declare interface RouteRecordMultipleViewsWithChildren extends _RouteRecordBase {
|
|
1189
|
-
/**
|
|
1190
|
-
* Components to display when the URL matches this route. Allow using named views.
|
|
1191
|
-
*/
|
|
1192
|
-
components?: Record<string, RawRouteComponent> | null | undefined;
|
|
1193
|
-
component?: never;
|
|
1194
|
-
children: RouteRecordRaw[];
|
|
1195
|
-
/**
|
|
1196
|
-
* Allow passing down params as props to the component rendered by
|
|
1197
|
-
* `router-view`. Should be an object with the same keys as `components` or a
|
|
1198
|
-
* boolean to be applied to every component.
|
|
1199
|
-
*/
|
|
1200
|
-
props?: Record<string, _RouteRecordProps> | boolean;
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
/**
|
|
1204
|
-
* Possible values for a route record **after normalization**
|
|
1205
|
-
*
|
|
1206
|
-
* NOTE: since `RouteRecordName` is a type, it evaluates too early and it's often the generic version {@link RouteRecordNameGeneric}. If you need a typed version of all of the names of routes, use {@link RouteMap | `keyof RouteMap`}
|
|
1207
|
-
*/
|
|
1208
|
-
export declare type RouteRecordName = RouteMapGeneric extends RouteMap ? RouteRecordNameGeneric : keyof RouteMap;
|
|
1209
|
-
|
|
1210
|
-
/**
|
|
1211
|
-
* Generic version of {@link RouteRecordName}.
|
|
1212
|
-
*/
|
|
1213
|
-
export declare type RouteRecordNameGeneric = string | symbol | undefined;
|
|
1214
|
-
|
|
1215
|
-
/**
|
|
1216
|
-
* Normalized version of a {@link RouteRecord | route record}.
|
|
1217
|
-
*/
|
|
1218
|
-
export declare interface RouteRecordNormalized {
|
|
1219
|
-
/**
|
|
1220
|
-
* {@inheritDoc _RouteRecordBase.path}
|
|
1221
|
-
*/
|
|
1222
|
-
path: _RouteRecordBase['path'];
|
|
1223
|
-
/**
|
|
1224
|
-
* {@inheritDoc _RouteRecordBase.redirect}
|
|
1225
|
-
*/
|
|
1226
|
-
redirect: _RouteRecordBase['redirect'] | undefined;
|
|
1227
|
-
/**
|
|
1228
|
-
* {@inheritDoc _RouteRecordBase.name}
|
|
1229
|
-
*/
|
|
1230
|
-
name: _RouteRecordBase['name'];
|
|
1231
|
-
/**
|
|
1232
|
-
* {@inheritDoc RouteRecordMultipleViews.components}
|
|
1233
|
-
*/
|
|
1234
|
-
components: RouteRecordMultipleViews['components'] | null | undefined;
|
|
1235
|
-
/**
|
|
1236
|
-
* Contains the original modules for lazy loaded components.
|
|
1237
|
-
* @internal
|
|
1238
|
-
*/
|
|
1239
|
-
mods: Record<string, unknown>;
|
|
1240
|
-
/**
|
|
1241
|
-
* Nested route records.
|
|
1242
|
-
*/
|
|
1243
|
-
children: RouteRecordRaw[];
|
|
1244
|
-
/**
|
|
1245
|
-
* {@inheritDoc _RouteRecordBase.meta}
|
|
1246
|
-
*/
|
|
1247
|
-
meta: Exclude<_RouteRecordBase['meta'], void>;
|
|
1248
|
-
/**
|
|
1249
|
-
* {@inheritDoc RouteRecordMultipleViews.props}
|
|
1250
|
-
*/
|
|
1251
|
-
props: Record<string, _RouteRecordProps>;
|
|
1252
|
-
/**
|
|
1253
|
-
* Registered beforeEnter guards
|
|
1254
|
-
*/
|
|
1255
|
-
beforeEnter: _RouteRecordBase['beforeEnter'];
|
|
1256
|
-
/**
|
|
1257
|
-
* Registered leave guards
|
|
1258
|
-
*
|
|
1259
|
-
* @internal
|
|
1260
|
-
*/
|
|
1261
|
-
leaveGuards: Set<NavigationGuard>;
|
|
1262
|
-
/**
|
|
1263
|
-
* Registered update guards
|
|
1264
|
-
*
|
|
1265
|
-
* @internal
|
|
1266
|
-
*/
|
|
1267
|
-
updateGuards: Set<NavigationGuard>;
|
|
1268
|
-
/**
|
|
1269
|
-
* Registered beforeRouteEnter callbacks passed to `next` or returned in guards
|
|
1270
|
-
*
|
|
1271
|
-
* @internal
|
|
1272
|
-
*/
|
|
1273
|
-
enterCallbacks: Record<string, NavigationGuardNextCallback[]>;
|
|
1274
|
-
/**
|
|
1275
|
-
* Mounted route component instances
|
|
1276
|
-
* Having the instances on the record mean beforeRouteUpdate and
|
|
1277
|
-
* beforeRouteLeave guards can only be invoked with the latest mounted app
|
|
1278
|
-
* instance if there are multiple application instances rendering the same
|
|
1279
|
-
* view, basically duplicating the content on the page, which shouldn't happen
|
|
1280
|
-
* in practice. It will work if multiple apps are rendering different named
|
|
1281
|
-
* views.
|
|
1282
|
-
*/
|
|
1283
|
-
instances: Record<string, ComponentPublicInstance | undefined | null>;
|
|
1284
|
-
/**
|
|
1285
|
-
* Defines if this record is the alias of another one. This property is
|
|
1286
|
-
* `undefined` if the record is the original one.
|
|
1287
|
-
*/
|
|
1288
|
-
aliasOf: RouteRecordNormalized | undefined;
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
/**
|
|
1292
|
-
* @internal
|
|
1293
|
-
*/
|
|
1294
|
-
export declare type _RouteRecordProps<Name extends keyof RouteMap = keyof RouteMap> = boolean | Record<string, any> | ((to: RouteLocationNormalized<Name>) => Record<string, any>);
|
|
1295
|
-
|
|
1296
|
-
export declare type RouteRecordRaw = RouteRecordSingleView | RouteRecordSingleViewWithChildren | RouteRecordMultipleViews | RouteRecordMultipleViewsWithChildren | RouteRecordRedirect;
|
|
1297
|
-
|
|
1298
|
-
/**
|
|
1299
|
-
* Route Record that defines a redirect. Cannot have `component` or `components`
|
|
1300
|
-
* as it is never rendered.
|
|
1301
|
-
*/
|
|
1302
|
-
export declare interface RouteRecordRedirect extends _RouteRecordBase {
|
|
1303
|
-
redirect: RouteRecordRedirectOption;
|
|
1304
|
-
component?: never;
|
|
1305
|
-
components?: never;
|
|
1306
|
-
props?: never;
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
/**
|
|
1310
|
-
* @internal
|
|
1311
|
-
*/
|
|
1312
|
-
export declare type RouteRecordRedirectOption = RouteLocationRaw | ((to: RouteLocation) => RouteLocationRaw);
|
|
1313
|
-
|
|
1314
|
-
/**
|
|
1315
|
-
* Route Record defining one single component with the `component` option.
|
|
1316
|
-
*/
|
|
1317
|
-
export declare interface RouteRecordSingleView extends _RouteRecordBase {
|
|
1318
|
-
/**
|
|
1319
|
-
* Component to display when the URL matches this route.
|
|
1320
|
-
*/
|
|
1321
|
-
component: RawRouteComponent;
|
|
1322
|
-
components?: never;
|
|
1323
|
-
children?: never;
|
|
1324
|
-
redirect?: never;
|
|
1325
|
-
/**
|
|
1326
|
-
* Allow passing down params as props to the component rendered by `router-view`.
|
|
1327
|
-
*/
|
|
1328
|
-
props?: _RouteRecordProps;
|
|
1329
|
-
}
|
|
1330
|
-
|
|
1331
|
-
/**
|
|
1332
|
-
* Route Record defining one single component with a nested view.
|
|
1333
|
-
*/
|
|
1334
|
-
export declare interface RouteRecordSingleViewWithChildren extends _RouteRecordBase {
|
|
1335
|
-
/**
|
|
1336
|
-
* Component to display when the URL matches this route.
|
|
1337
|
-
*/
|
|
1338
|
-
component?: RawRouteComponent | null | undefined;
|
|
1339
|
-
components?: never;
|
|
1340
|
-
children: RouteRecordRaw[];
|
|
1341
|
-
/**
|
|
1342
|
-
* Allow passing down params as props to the component rendered by `router-view`.
|
|
1343
|
-
*/
|
|
1344
|
-
props?: _RouteRecordProps;
|
|
1345
|
-
}
|
|
1346
|
-
|
|
1347
|
-
/**
|
|
1348
|
-
* Interface implemented by History implementations that can be passed to the
|
|
1349
|
-
* router as {@link Router.history}
|
|
1350
|
-
*
|
|
1351
|
-
* @alpha
|
|
1352
|
-
*/
|
|
1353
|
-
export declare interface RouterHistory {
|
|
1354
|
-
/**
|
|
1355
|
-
* Base path that is prepended to every url. This allows hosting an SPA at a
|
|
1356
|
-
* sub-folder of a domain like `example.com/sub-folder` by having a `base` of
|
|
1357
|
-
* `/sub-folder`
|
|
1358
|
-
*/
|
|
1359
|
-
readonly base: string;
|
|
1360
|
-
/**
|
|
1361
|
-
* Current History location
|
|
1362
|
-
*/
|
|
1363
|
-
readonly location: HistoryLocation;
|
|
1364
|
-
/**
|
|
1365
|
-
* Current History state
|
|
1366
|
-
*/
|
|
1367
|
-
readonly state: HistoryState;
|
|
1368
|
-
/**
|
|
1369
|
-
* Navigates to a location. In the case of an HTML5 History implementation,
|
|
1370
|
-
* this will call `history.pushState` to effectively change the URL.
|
|
1371
|
-
*
|
|
1372
|
-
* @param to - location to push
|
|
1373
|
-
* @param data - optional {@link HistoryState} to be associated with the
|
|
1374
|
-
* navigation entry
|
|
1375
|
-
*/
|
|
1376
|
-
push(to: HistoryLocation, data?: HistoryState): void;
|
|
1377
|
-
/**
|
|
1378
|
-
* Same as {@link RouterHistory.push} but performs a `history.replaceState`
|
|
1379
|
-
* instead of `history.pushState`
|
|
1380
|
-
*
|
|
1381
|
-
* @param to - location to set
|
|
1382
|
-
* @param data - optional {@link HistoryState} to be associated with the
|
|
1383
|
-
* navigation entry
|
|
1384
|
-
*/
|
|
1385
|
-
replace(to: HistoryLocation, data?: HistoryState): void;
|
|
1386
|
-
/**
|
|
1387
|
-
* Traverses history in a given direction.
|
|
1388
|
-
*
|
|
1389
|
-
* @example
|
|
1390
|
-
* ```js
|
|
1391
|
-
* myHistory.go(-1) // equivalent to window.history.back()
|
|
1392
|
-
* myHistory.go(1) // equivalent to window.history.forward()
|
|
1393
|
-
* ```
|
|
1394
|
-
*
|
|
1395
|
-
* @param delta - distance to travel. If delta is \< 0, it will go back,
|
|
1396
|
-
* if it's \> 0, it will go forward by that amount of entries.
|
|
1397
|
-
* @param triggerListeners - whether this should trigger listeners attached to
|
|
1398
|
-
* the history
|
|
1399
|
-
*/
|
|
1400
|
-
go(delta: number, triggerListeners?: boolean): void;
|
|
1401
|
-
/**
|
|
1402
|
-
* Attach a listener to the History implementation that is triggered when the
|
|
1403
|
-
* navigation is triggered from outside (like the Browser back and forward
|
|
1404
|
-
* buttons) or when passing `true` to {@link RouterHistory.back} and
|
|
1405
|
-
* {@link RouterHistory.forward}
|
|
1406
|
-
*
|
|
1407
|
-
* @param callback - listener to attach
|
|
1408
|
-
* @returns a callback to remove the listener
|
|
1409
|
-
*/
|
|
1410
|
-
listen(callback: NavigationCallback): () => void;
|
|
1411
|
-
/**
|
|
1412
|
-
* Generates the corresponding href to be used in an anchor tag.
|
|
1413
|
-
*
|
|
1414
|
-
* @param location - history location that should create an href
|
|
1415
|
-
*/
|
|
1416
|
-
createHref(location: HistoryLocation): string;
|
|
1417
|
-
/**
|
|
1418
|
-
* Clears any event listener attached by the history implementation.
|
|
1419
|
-
*/
|
|
1420
|
-
destroy(): void;
|
|
1421
|
-
}
|
|
1422
|
-
|
|
1423
|
-
/**
|
|
1424
|
-
* Allows overriding the router instance returned by `useRouter` in tests. r
|
|
1425
|
-
* stands for router
|
|
1426
|
-
*
|
|
1427
|
-
* @internal
|
|
1428
|
-
*/
|
|
1429
|
-
export declare const routerKey: InjectionKey<Router>;
|
|
1430
|
-
|
|
1431
|
-
/**
|
|
1432
|
-
* Component to render a link that triggers a navigation on click.
|
|
1433
|
-
*/
|
|
1434
|
-
export declare const RouterLink: _RouterLinkI;
|
|
1435
|
-
|
|
1436
|
-
/**
|
|
1437
|
-
* Typed version of the `RouterLink` component. Its generic defaults to the typed router, so it can be inferred
|
|
1438
|
-
* automatically for JSX.
|
|
1439
|
-
*
|
|
1440
|
-
* @internal
|
|
1441
|
-
*/
|
|
1442
|
-
export declare interface _RouterLinkI {
|
|
1443
|
-
new (): {
|
|
1444
|
-
$props: AllowedComponentProps & ComponentCustomProps & VNodeProps & RouterLinkProps;
|
|
1445
|
-
$slots: {
|
|
1446
|
-
default?: ({ route, href, isActive, isExactActive, navigate, }: UnwrapRef<UseLinkReturn>) => VNode[];
|
|
1447
|
-
};
|
|
1448
|
-
};
|
|
1449
|
-
/**
|
|
1450
|
-
* Access to `useLink()` without depending on using vue-router
|
|
1451
|
-
*
|
|
1452
|
-
* @internal
|
|
1453
|
-
*/
|
|
1454
|
-
useLink: typeof useLink;
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
|
-
declare interface RouterLinkOptions {
|
|
1458
|
-
/**
|
|
1459
|
-
* Route Location the link should navigate to when clicked on.
|
|
1460
|
-
*/
|
|
1461
|
-
to: RouteLocationRaw;
|
|
1462
|
-
/**
|
|
1463
|
-
* Calls `router.replace` instead of `router.push`.
|
|
1464
|
-
*/
|
|
1465
|
-
replace?: boolean;
|
|
1466
|
-
}
|
|
1467
|
-
|
|
1468
|
-
export declare interface RouterLinkProps extends RouterLinkOptions {
|
|
1469
|
-
/**
|
|
1470
|
-
* Whether RouterLink should not wrap its content in an `a` tag. Useful when
|
|
1471
|
-
* using `v-slot` to create a custom RouterLink
|
|
1472
|
-
*/
|
|
1473
|
-
custom?: boolean;
|
|
1474
|
-
/**
|
|
1475
|
-
* Class to apply when the link is active
|
|
1476
|
-
*/
|
|
1477
|
-
activeClass?: string;
|
|
1478
|
-
/**
|
|
1479
|
-
* Class to apply when the link is exact active
|
|
1480
|
-
*/
|
|
1481
|
-
exactActiveClass?: string;
|
|
1482
|
-
/**
|
|
1483
|
-
* Value passed to the attribute `aria-current` when the link is exact active.
|
|
1484
|
-
*
|
|
1485
|
-
* @defaultValue `'page'`
|
|
1486
|
-
*/
|
|
1487
|
-
ariaCurrentValue?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false';
|
|
1488
|
-
/**
|
|
1489
|
-
* Pass the returned promise of `router.push()` to `document.startViewTransition()` if supported.
|
|
1490
|
-
*/
|
|
1491
|
-
viewTransition?: boolean;
|
|
1492
|
-
}
|
|
1493
|
-
|
|
1494
|
-
/**
|
|
1495
|
-
* Internal RouterMatcher
|
|
1496
|
-
*
|
|
1497
|
-
* @internal
|
|
1498
|
-
*/
|
|
1499
|
-
export declare interface RouterMatcher {
|
|
1500
|
-
addRoute: (record: RouteRecordRaw, parent?: RouteRecordMatcher) => () => void;
|
|
1501
|
-
removeRoute(matcher: RouteRecordMatcher): void;
|
|
1502
|
-
removeRoute(name: NonNullable<RouteRecordNameGeneric>): void;
|
|
1503
|
-
clearRoutes: () => void;
|
|
1504
|
-
getRoutes: () => RouteRecordMatcher[];
|
|
1505
|
-
getRecordMatcher: (name: NonNullable<RouteRecordNameGeneric>) => RouteRecordMatcher | undefined;
|
|
1506
|
-
/**
|
|
1507
|
-
* Resolves a location. Gives access to the route record that corresponds to the actual path as well as filling the corresponding params objects
|
|
1508
|
-
*
|
|
1509
|
-
* @param location - MatcherLocationRaw to resolve to a url
|
|
1510
|
-
* @param currentLocation - MatcherLocation of the current location
|
|
1511
|
-
*/
|
|
1512
|
-
resolve: (location: MatcherLocationRaw, currentLocation: MatcherLocation) => MatcherLocation;
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
/**
|
|
1516
|
-
* Options to initialize a {@link Router} instance.
|
|
1517
|
-
*/
|
|
1518
|
-
export declare interface RouterOptions extends PathParserOptions {
|
|
1519
|
-
/**
|
|
1520
|
-
* History implementation used by the router. Most web applications should use
|
|
1521
|
-
* `createWebHistory` but it requires the server to be properly configured.
|
|
1522
|
-
* You can also use a _hash_ based history with `createWebHashHistory` that
|
|
1523
|
-
* does not require any configuration on the server but isn't handled at all
|
|
1524
|
-
* by search engines and does poorly on SEO.
|
|
1525
|
-
*
|
|
1526
|
-
* @example
|
|
1527
|
-
* ```js
|
|
1528
|
-
* createRouter({
|
|
1529
|
-
* history: createWebHistory(),
|
|
1530
|
-
* // other options...
|
|
1531
|
-
* })
|
|
1532
|
-
* ```
|
|
1533
|
-
*/
|
|
1534
|
-
history: RouterHistory;
|
|
1535
|
-
/**
|
|
1536
|
-
* Initial list of routes that should be added to the router.
|
|
1537
|
-
*/
|
|
1538
|
-
routes: Readonly<RouteRecordRaw[]>;
|
|
1539
|
-
/**
|
|
1540
|
-
* Function to control scrolling when navigating between pages. Can return a
|
|
1541
|
-
* Promise to delay scrolling. Check {@link ScrollBehavior}.
|
|
1542
|
-
*
|
|
1543
|
-
* @example
|
|
1544
|
-
* ```js
|
|
1545
|
-
* function scrollBehavior(to, from, savedPosition) {
|
|
1546
|
-
* // `to` and `from` are both route locations
|
|
1547
|
-
* // `savedPosition` can be null if there isn't one
|
|
1548
|
-
* }
|
|
1549
|
-
* ```
|
|
1550
|
-
*/
|
|
1551
|
-
scrollBehavior?: RouterScrollBehavior;
|
|
1552
|
-
/**
|
|
1553
|
-
* Custom implementation to parse a query. See its counterpart,
|
|
1554
|
-
* {@link RouterOptions.stringifyQuery}.
|
|
1555
|
-
*
|
|
1556
|
-
* @example
|
|
1557
|
-
* Let's say you want to use the [qs package](https://github.com/ljharb/qs)
|
|
1558
|
-
* to parse queries, you can provide both `parseQuery` and `stringifyQuery`:
|
|
1559
|
-
* ```js
|
|
1560
|
-
* import qs from 'qs'
|
|
1561
|
-
*
|
|
1562
|
-
* createRouter({
|
|
1563
|
-
* // other options...
|
|
1564
|
-
* parseQuery: qs.parse,
|
|
1565
|
-
* stringifyQuery: qs.stringify,
|
|
1566
|
-
* })
|
|
1567
|
-
* ```
|
|
1568
|
-
*/
|
|
1569
|
-
parseQuery?: typeof parseQuery;
|
|
1570
|
-
/**
|
|
1571
|
-
* Custom implementation to stringify a query object. Should not prepend a leading `?`.
|
|
1572
|
-
* {@link RouterOptions.parseQuery | parseQuery} counterpart to handle query parsing.
|
|
1573
|
-
*/
|
|
1574
|
-
stringifyQuery?: typeof stringifyQuery;
|
|
1575
|
-
/**
|
|
1576
|
-
* Default class applied to active {@link RouterLink}. If none is provided,
|
|
1577
|
-
* `router-link-active` will be applied.
|
|
1578
|
-
*/
|
|
1579
|
-
linkActiveClass?: string;
|
|
1580
|
-
/**
|
|
1581
|
-
* Default class applied to exact active {@link RouterLink}. If none is provided,
|
|
1582
|
-
* `router-link-exact-active` will be applied.
|
|
1583
|
-
*/
|
|
1584
|
-
linkExactActiveClass?: string;
|
|
1585
|
-
}
|
|
1586
|
-
|
|
1587
|
-
/**
|
|
1588
|
-
* Type of the `scrollBehavior` option that can be passed to `createRouter`.
|
|
1589
|
-
*/
|
|
1590
|
-
export declare interface RouterScrollBehavior {
|
|
1591
|
-
/**
|
|
1592
|
-
* @param to - Route location where we are navigating to
|
|
1593
|
-
* @param from - Route location where we are navigating from
|
|
1594
|
-
* @param savedPosition - saved position if it exists, `null` otherwise
|
|
1595
|
-
*/
|
|
1596
|
-
(to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, savedPosition: _ScrollPositionNormalized | null): Awaitable<ScrollPosition | false | void>;
|
|
1597
|
-
}
|
|
1598
|
-
|
|
1599
|
-
/**
|
|
1600
|
-
* Component to display the current route the user is at.
|
|
1601
|
-
*/
|
|
1602
|
-
export declare const RouterView: {
|
|
1603
|
-
new (): {
|
|
1604
|
-
$props: AllowedComponentProps & ComponentCustomProps & VNodeProps & RouterViewProps;
|
|
1605
|
-
$slots: {
|
|
1606
|
-
default?: ({ Component, route, }: {
|
|
1607
|
-
Component: VNode;
|
|
1608
|
-
route: RouteLocationNormalizedLoaded;
|
|
1609
|
-
}) => VNode[];
|
|
1610
|
-
};
|
|
1611
|
-
};
|
|
1612
|
-
};
|
|
1613
|
-
|
|
1614
|
-
/**
|
|
1615
|
-
* Allows overriding the current route used by router-view. Internally this is
|
|
1616
|
-
* used when the `route` prop is passed.
|
|
1617
|
-
*
|
|
1618
|
-
* @internal
|
|
1619
|
-
*/
|
|
1620
|
-
export declare const routerViewLocationKey: InjectionKey<Ref<RouteLocationNormalizedLoaded>>;
|
|
1621
|
-
|
|
1622
|
-
export declare interface RouterViewProps {
|
|
1623
|
-
name?: string;
|
|
1624
|
-
route?: RouteLocationNormalized;
|
|
1625
|
-
}
|
|
1626
|
-
|
|
1627
|
-
declare type ScrollPosition = ScrollPositionCoordinates | ScrollPositionElement;
|
|
1628
|
-
|
|
1629
|
-
/**
|
|
1630
|
-
* Scroll position similar to
|
|
1631
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/API/ScrollToOptions | `ScrollToOptions`}.
|
|
1632
|
-
* Note that not all browsers support `behavior`.
|
|
1633
|
-
*/
|
|
1634
|
-
declare type ScrollPositionCoordinates = {
|
|
1635
|
-
behavior?: ScrollOptions['behavior'];
|
|
1636
|
-
left?: number;
|
|
1637
|
-
top?: number;
|
|
1638
|
-
};
|
|
1639
|
-
|
|
1640
|
-
declare interface ScrollPositionElement extends ScrollToOptions {
|
|
1641
|
-
/**
|
|
1642
|
-
* A valid CSS selector. Note some characters must be escaped in id selectors (https://mathiasbynens.be/notes/css-escapes).
|
|
1643
|
-
* @example
|
|
1644
|
-
* Here are a few examples:
|
|
1645
|
-
*
|
|
1646
|
-
* - `.title`
|
|
1647
|
-
* - `.content:first-child`
|
|
1648
|
-
* - `#marker`
|
|
1649
|
-
* - `#marker\~with\~symbols`
|
|
1650
|
-
* - `#marker.with.dot`: selects `class="with dot" id="marker"`, not `id="marker.with.dot"`
|
|
1651
|
-
*
|
|
1652
|
-
*/
|
|
1653
|
-
el: string | Element;
|
|
1654
|
-
}
|
|
1655
|
-
|
|
1656
|
-
/**
|
|
1657
|
-
* Internal normalized version of {@link ScrollPositionCoordinates} that always
|
|
1658
|
-
* has `left` and `top` coordinates. Must be a type to be assignable to HistoryStateValue.
|
|
1659
|
-
*
|
|
1660
|
-
* @internal
|
|
1661
|
-
*/
|
|
1662
|
-
declare type _ScrollPositionNormalized = {
|
|
1663
|
-
behavior?: ScrollOptions['behavior'];
|
|
1664
|
-
left: number;
|
|
1665
|
-
top: number;
|
|
1666
|
-
};
|
|
1667
|
-
|
|
1668
|
-
/**
|
|
1669
|
-
* Initial route location where the router is. Can be used in navigation guards
|
|
1670
|
-
* to differentiate the initial navigation.
|
|
1671
|
-
*
|
|
1672
|
-
* @example
|
|
1673
|
-
* ```js
|
|
1674
|
-
* import { START_LOCATION } from 'vue-router'
|
|
1675
|
-
*
|
|
1676
|
-
* router.beforeEach((to, from) => {
|
|
1677
|
-
* if (from === START_LOCATION) {
|
|
1678
|
-
* // initial navigation
|
|
1679
|
-
* }
|
|
1680
|
-
* })
|
|
1681
|
-
* ```
|
|
1682
|
-
*/
|
|
1683
|
-
export declare const START_LOCATION: RouteLocationNormalizedLoaded;
|
|
1684
|
-
|
|
1685
|
-
/**
|
|
1686
|
-
* Stringifies a {@link LocationQueryRaw} object. Like `URLSearchParams`, it
|
|
1687
|
-
* doesn't prepend a `?`
|
|
1688
|
-
*
|
|
1689
|
-
* @internal
|
|
1690
|
-
*
|
|
1691
|
-
* @param query - query object to stringify
|
|
1692
|
-
* @returns string version of the query without the leading `?`
|
|
1693
|
-
*/
|
|
1694
|
-
export declare function stringifyQuery(query: LocationQueryRaw): string;
|
|
1695
|
-
|
|
1696
|
-
/**
|
|
1697
|
-
* Allows customizing existing types of the router that are used globally like `$router`, `<RouterLink>`, etc. **ONLY FOR INTERNAL USAGE**.
|
|
1698
|
-
*
|
|
1699
|
-
* - `$router` - the router instance
|
|
1700
|
-
* - `$route` - the current route location
|
|
1701
|
-
* - `beforeRouteEnter` - Page component option
|
|
1702
|
-
* - `beforeRouteUpdate` - Page component option
|
|
1703
|
-
* - `beforeRouteLeave` - Page component option
|
|
1704
|
-
* - `RouterLink` - RouterLink Component
|
|
1705
|
-
* - `RouterView` - RouterView Component
|
|
1706
|
-
*
|
|
1707
|
-
* @internal
|
|
1708
|
-
*/
|
|
1709
|
-
export declare interface TypesConfig {
|
|
1710
|
-
}
|
|
1711
|
-
|
|
1712
|
-
/**
|
|
1713
|
-
* Returns the internal behavior of a {@link RouterLink} without the rendering part.
|
|
1714
|
-
*
|
|
1715
|
-
* @param props - a `to` location and an optional `replace` flag
|
|
1716
|
-
*/
|
|
1717
|
-
export declare function useLink<Name extends keyof RouteMap = keyof RouteMap>(props: UseLinkOptions<Name>): UseLinkReturn<Name>;
|
|
1718
|
-
|
|
1719
|
-
/**
|
|
1720
|
-
* Options passed to {@link useLink}.
|
|
1721
|
-
*/
|
|
1722
|
-
export declare interface UseLinkOptions<Name extends keyof RouteMap = keyof RouteMap> {
|
|
1723
|
-
to: MaybeRef<RouteLocationAsString | RouteLocationAsRelativeTyped<RouteMap, Name> | RouteLocationAsPath | RouteLocationRaw>;
|
|
1724
|
-
replace?: MaybeRef<boolean | undefined>;
|
|
1725
|
-
/**
|
|
1726
|
-
* Pass the returned promise of `router.push()` to `document.startViewTransition()` if supported.
|
|
1727
|
-
*/
|
|
1728
|
-
viewTransition?: boolean;
|
|
1729
|
-
}
|
|
1730
|
-
|
|
1731
|
-
/**
|
|
1732
|
-
* Return type of {@link useLink}.
|
|
1733
|
-
* @internal
|
|
1734
|
-
*/
|
|
1735
|
-
export declare interface UseLinkReturn<Name extends keyof RouteMap = keyof RouteMap> {
|
|
1736
|
-
route: ComputedRef<RouteLocationResolved<Name>>;
|
|
1737
|
-
href: ComputedRef<string>;
|
|
1738
|
-
isActive: ComputedRef<boolean>;
|
|
1739
|
-
isExactActive: ComputedRef<boolean>;
|
|
1740
|
-
navigate(e?: MouseEvent): Promise<void | NavigationFailure>;
|
|
1741
|
-
}
|
|
1742
|
-
|
|
1743
|
-
/**
|
|
1744
|
-
* Returns the current route location. Equivalent to using `$route` inside
|
|
1745
|
-
* templates.
|
|
1746
|
-
*/
|
|
1747
|
-
export declare function useRoute<Name extends keyof RouteMap = keyof RouteMap>(_name?: Name): RouteLocationNormalizedLoaded<Name>;
|
|
1748
|
-
|
|
1749
|
-
/**
|
|
1750
|
-
* Returns the router instance. Equivalent to using `$router` inside
|
|
1751
|
-
* templates.
|
|
1752
|
-
*/
|
|
1753
|
-
export declare function useRouter(): Router;
|
|
1754
|
-
|
|
1755
|
-
/**
|
|
1756
|
-
* Allows overriding the router view depth to control which component in
|
|
1757
|
-
* `matched` is rendered. rvd stands for Router View Depth
|
|
1758
|
-
*
|
|
1759
|
-
* @internal
|
|
1760
|
-
*/
|
|
1761
|
-
export declare const viewDepthKey: InjectionKey<Ref<number> | number>;
|
|
1762
|
-
|
|
1763
|
-
export { }
|
|
1764
|
-
|
|
1765
|
-
/**
|
|
1766
|
-
* NOTE: this used to be `@vue/runtime-core` but it should have been `vue` for a long time. Using both declaration at
|
|
1767
|
-
* the same time breaks so using only one everywhere is the preferred way.
|
|
1768
|
-
*/
|
|
1769
|
-
declare module 'vue' {
|
|
1770
|
-
export interface ComponentCustomOptions {
|
|
1771
|
-
/**
|
|
1772
|
-
* Guard called when the router is navigating to the route that is rendering
|
|
1773
|
-
* this component from a different route. Differently from `beforeRouteUpdate`
|
|
1774
|
-
* and `beforeRouteLeave`, `beforeRouteEnter` does not have access to the
|
|
1775
|
-
* component instance through `this` because it triggers before the component
|
|
1776
|
-
* is even mounted.
|
|
1777
|
-
*
|
|
1778
|
-
* @param to - RouteLocationRaw we are navigating to
|
|
1779
|
-
* @param from - RouteLocationRaw we are navigating from
|
|
1780
|
-
* @param next - function to validate, cancel or modify (by redirecting) the
|
|
1781
|
-
* navigation
|
|
1782
|
-
*/
|
|
1783
|
-
beforeRouteEnter?: TypesConfig extends Record<'beforeRouteEnter', infer T>
|
|
1784
|
-
? T
|
|
1785
|
-
: NavigationGuardWithThis<undefined>
|
|
1786
|
-
|
|
1787
|
-
/**
|
|
1788
|
-
* Guard called whenever the route that renders this component has changed, but
|
|
1789
|
-
* it is reused for the new route. This allows you to guard for changes in
|
|
1790
|
-
* params, the query or the hash.
|
|
1791
|
-
*
|
|
1792
|
-
* @param to - RouteLocationRaw we are navigating to
|
|
1793
|
-
* @param from - RouteLocationRaw we are navigating from
|
|
1794
|
-
* @param next - function to validate, cancel or modify (by redirecting) the
|
|
1795
|
-
* navigation
|
|
1796
|
-
*/
|
|
1797
|
-
beforeRouteUpdate?: TypesConfig extends Record<'beforeRouteUpdate', infer T>
|
|
1798
|
-
? T
|
|
1799
|
-
: NavigationGuard
|
|
1800
|
-
|
|
1801
|
-
/**
|
|
1802
|
-
* Guard called when the router is navigating away from the current route that
|
|
1803
|
-
* is rendering this component.
|
|
1804
|
-
*
|
|
1805
|
-
* @param to - RouteLocationRaw we are navigating to
|
|
1806
|
-
* @param from - RouteLocationRaw we are navigating from
|
|
1807
|
-
* @param next - function to validate, cancel or modify (by redirecting) the
|
|
1808
|
-
* navigation
|
|
1809
|
-
*/
|
|
1810
|
-
beforeRouteLeave?: TypesConfig extends Record<'beforeRouteLeave', infer T>
|
|
1811
|
-
? T
|
|
1812
|
-
: NavigationGuard
|
|
1813
|
-
}
|
|
1814
|
-
|
|
1815
|
-
export interface ComponentCustomProperties {
|
|
1816
|
-
/**
|
|
1817
|
-
* Normalized current location. See {@link RouteLocationNormalizedLoaded}.
|
|
1818
|
-
*/
|
|
1819
|
-
$route: TypesConfig extends Record<'$route', infer T>
|
|
1820
|
-
? T
|
|
1821
|
-
: RouteLocationNormalizedLoaded
|
|
1822
|
-
/**
|
|
1823
|
-
* {@link Router} instance used by the application.
|
|
1824
|
-
*/
|
|
1825
|
-
$router: TypesConfig extends Record<'$router', infer T> ? T : Router
|
|
1826
|
-
}
|
|
1827
|
-
|
|
1828
|
-
export interface GlobalComponents {
|
|
1829
|
-
RouterView: TypesConfig extends Record<'RouterView', infer T>
|
|
1830
|
-
? T
|
|
1831
|
-
: typeof RouterView
|
|
1832
|
-
RouterLink: TypesConfig extends Record<'RouterLink', infer T>
|
|
1833
|
-
? T
|
|
1834
|
-
: typeof RouterLink
|
|
1835
|
-
}
|
|
1836
|
-
}
|