@vuepress/client 2.0.0-rc.0 → 2.0.0-rc.10
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/LICENSE +1 -1
- package/README.md +12 -0
- package/dist/app.d.ts +7 -0
- package/dist/app.js +139 -154
- package/dist/chunk-GA5RAHE7.js +432 -0
- package/dist/createVueAppFunction-onJTVJru.d.ts +9 -0
- package/dist/index.d.ts +344 -204
- package/dist/index.js +25 -29
- package/dist/{setupDevtools-X4YFRK4B.js → setupDevtools-H6KAGBNI.js} +16 -16
- package/package.json +12 -13
- package/dist/chunk-DHNSDB55.js +0 -338
package/dist/index.d.ts
CHANGED
|
@@ -1,35 +1,74 @@
|
|
|
1
|
-
import { PageData, PageFrontmatter, HeadConfig, SiteData } from '@vuepress/shared';
|
|
2
|
-
export { PageData, PageFrontmatter, PageHeader, SiteData } from '@vuepress/shared';
|
|
3
1
|
import * as vue from 'vue';
|
|
4
|
-
import { Component, App,
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { Component, ComputedRef, Ref, App, VNode, SlotsType, InjectionKey } from 'vue';
|
|
3
|
+
import { PageData, HeadConfig, PageFrontmatter, SiteData, SiteLocaleData } from '@vuepress/shared';
|
|
4
|
+
export { HeadConfig, PageData, PageFrontmatter, PageHeader, SiteData, SiteLocaleData } from '@vuepress/shared';
|
|
5
|
+
import { Router } from 'vue-router';
|
|
6
|
+
export { RouteLocationNormalizedLoaded, Router, useRoute, useRouter } from 'vue-router';
|
|
7
|
+
export { C as CreateVueAppFunction } from './createVueAppFunction-onJTVJru.js';
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
|
-
*
|
|
10
|
+
* Name of the default layout
|
|
13
11
|
*/
|
|
14
|
-
declare const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
12
|
+
declare const LAYOUT_NAME_DEFAULT = "Layout";
|
|
13
|
+
/**
|
|
14
|
+
* Name of the 404 page layout
|
|
15
|
+
*/
|
|
16
|
+
declare const LAYOUT_NAME_NOT_FOUND = "NotFound";
|
|
17
|
+
|
|
18
|
+
interface PageChunk {
|
|
19
|
+
comp: Component;
|
|
20
|
+
data: PageData;
|
|
21
|
+
}
|
|
22
|
+
type RouteMeta = Record<string, unknown>;
|
|
23
|
+
interface Route<T extends RouteMeta = RouteMeta> {
|
|
24
|
+
loader: () => Promise<PageChunk>;
|
|
25
|
+
meta: T;
|
|
26
|
+
}
|
|
27
|
+
type Redirects = Record<string, string>;
|
|
28
|
+
type Routes = Record<string, Route>;
|
|
31
29
|
|
|
32
|
-
|
|
30
|
+
interface Layouts {
|
|
31
|
+
[LAYOUT_NAME_DEFAULT]: Component;
|
|
32
|
+
[LAYOUT_NAME_NOT_FOUND]: Component;
|
|
33
|
+
[key: string]: Component;
|
|
34
|
+
}
|
|
35
|
+
type PageComponent = Component;
|
|
36
|
+
type PageHead = HeadConfig[];
|
|
37
|
+
type PageHeadTitle = string;
|
|
38
|
+
type PageLang = string;
|
|
39
|
+
type PageLayout = Component;
|
|
40
|
+
type RoutePath = string;
|
|
41
|
+
type RouteLocale = string;
|
|
42
|
+
type LayoutsRef = ComputedRef<Layouts>;
|
|
43
|
+
type PageComponentRef = ComputedRef<PageComponent>;
|
|
44
|
+
type PageDataRef<T extends Record<any, any> = Record<never, never>> = ComputedRef<PageData<T>>;
|
|
45
|
+
type PageFrontmatterRef<T extends Record<any, any> = Record<never, never>> = ComputedRef<PageFrontmatter<T>>;
|
|
46
|
+
type PageHeadRef = ComputedRef<PageHead>;
|
|
47
|
+
type PageHeadTitleRef = ComputedRef<PageHeadTitle>;
|
|
48
|
+
type PageLangRef = ComputedRef<PageLang>;
|
|
49
|
+
type PageLayoutRef = ComputedRef<PageLayout>;
|
|
50
|
+
type RedirectsRef = Ref<Redirects>;
|
|
51
|
+
type RoutePathRef = ComputedRef<RoutePath>;
|
|
52
|
+
type RouteLocaleRef = ComputedRef<RouteLocale>;
|
|
53
|
+
type RoutesRef = Ref<Routes>;
|
|
54
|
+
type SiteDataRef = Ref<SiteData>;
|
|
55
|
+
type SiteLocaleDataRef = ComputedRef<SiteLocaleData>;
|
|
56
|
+
interface ClientData {
|
|
57
|
+
layouts: LayoutsRef;
|
|
58
|
+
pageComponent: PageComponentRef;
|
|
59
|
+
pageData: PageDataRef;
|
|
60
|
+
pageFrontmatter: PageFrontmatterRef;
|
|
61
|
+
pageHead: PageHeadRef;
|
|
62
|
+
pageHeadTitle: PageHeadTitleRef;
|
|
63
|
+
pageLang: PageLangRef;
|
|
64
|
+
pageLayout: PageLayoutRef;
|
|
65
|
+
redirects: RedirectsRef;
|
|
66
|
+
routePath: RoutePathRef;
|
|
67
|
+
routeLocale: RouteLocaleRef;
|
|
68
|
+
routes: RoutesRef;
|
|
69
|
+
siteData: SiteDataRef;
|
|
70
|
+
siteLocaleData: SiteLocaleDataRef;
|
|
71
|
+
}
|
|
33
72
|
|
|
34
73
|
/**
|
|
35
74
|
* Configure vuepress client
|
|
@@ -51,197 +90,284 @@ interface ClientConfig {
|
|
|
51
90
|
/**
|
|
52
91
|
* Layout components
|
|
53
92
|
*/
|
|
54
|
-
layouts?: Layouts
|
|
93
|
+
layouts?: Partial<Layouts>;
|
|
55
94
|
/**
|
|
56
95
|
* Components to be placed directly into the root node of vue app
|
|
57
96
|
*/
|
|
58
97
|
rootComponents?: Component[];
|
|
59
98
|
}
|
|
60
99
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
100
|
+
interface AutoLinkProps {
|
|
101
|
+
/**
|
|
102
|
+
* Pattern to determine if the link should be active, which has higher priority than `exact`
|
|
103
|
+
*/
|
|
104
|
+
activeMatch?: string | RegExp;
|
|
105
|
+
/**
|
|
106
|
+
* The `aria-label` attribute
|
|
107
|
+
*/
|
|
108
|
+
ariaLabel?: string;
|
|
109
|
+
/**
|
|
110
|
+
* Whether the link should be active only if the url is an exact match
|
|
111
|
+
*/
|
|
112
|
+
exact?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* URL of the auto link
|
|
115
|
+
*/
|
|
116
|
+
link: string;
|
|
117
|
+
/**
|
|
118
|
+
* The `rel` attribute
|
|
119
|
+
*/
|
|
120
|
+
rel?: string;
|
|
121
|
+
/**
|
|
122
|
+
* The `target` attribute
|
|
123
|
+
*/
|
|
124
|
+
target?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Text of the auto link
|
|
127
|
+
*/
|
|
128
|
+
text: string;
|
|
129
|
+
}
|
|
81
130
|
/**
|
|
82
|
-
*
|
|
131
|
+
* Component to render a link automatically according to the link type
|
|
132
|
+
*
|
|
133
|
+
* - If the link is internal, it will be rendered as a `<RouteLink>`
|
|
134
|
+
* - If the link is external, it will be rendered as a normal `<a>` tag
|
|
83
135
|
*/
|
|
84
|
-
declare const
|
|
136
|
+
declare const AutoLink: vue.DefineComponent<{
|
|
137
|
+
/**
|
|
138
|
+
* Pattern to determine if the link should be active, which has higher priority than `exact`
|
|
139
|
+
*/
|
|
140
|
+
activeMatch: {
|
|
141
|
+
type: (StringConstructor | RegExpConstructor)[];
|
|
142
|
+
default: string;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* The `aria-label` attribute
|
|
146
|
+
*/
|
|
147
|
+
ariaLabel: {
|
|
148
|
+
type: StringConstructor;
|
|
149
|
+
default: string;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Whether the link should be active only if the url is an exact match
|
|
153
|
+
*/
|
|
154
|
+
exact: BooleanConstructor;
|
|
155
|
+
/**
|
|
156
|
+
* URL of the auto link
|
|
157
|
+
*/
|
|
158
|
+
link: {
|
|
159
|
+
type: StringConstructor;
|
|
160
|
+
required: true;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* The `rel` attribute
|
|
164
|
+
*/
|
|
165
|
+
rel: {
|
|
166
|
+
type: StringConstructor;
|
|
167
|
+
default: string;
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* The `target` attribute
|
|
171
|
+
*/
|
|
172
|
+
target: {
|
|
173
|
+
type: StringConstructor;
|
|
174
|
+
default: string;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Text of the auto link
|
|
178
|
+
*/
|
|
179
|
+
text: {
|
|
180
|
+
type: StringConstructor;
|
|
181
|
+
required: true;
|
|
182
|
+
};
|
|
183
|
+
}, () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
184
|
+
[key: string]: any;
|
|
185
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
186
|
+
/**
|
|
187
|
+
* Pattern to determine if the link should be active, which has higher priority than `exact`
|
|
188
|
+
*/
|
|
189
|
+
activeMatch: {
|
|
190
|
+
type: (StringConstructor | RegExpConstructor)[];
|
|
191
|
+
default: string;
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* The `aria-label` attribute
|
|
195
|
+
*/
|
|
196
|
+
ariaLabel: {
|
|
197
|
+
type: StringConstructor;
|
|
198
|
+
default: string;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Whether the link should be active only if the url is an exact match
|
|
202
|
+
*/
|
|
203
|
+
exact: BooleanConstructor;
|
|
204
|
+
/**
|
|
205
|
+
* URL of the auto link
|
|
206
|
+
*/
|
|
207
|
+
link: {
|
|
208
|
+
type: StringConstructor;
|
|
209
|
+
required: true;
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* The `rel` attribute
|
|
213
|
+
*/
|
|
214
|
+
rel: {
|
|
215
|
+
type: StringConstructor;
|
|
216
|
+
default: string;
|
|
217
|
+
};
|
|
218
|
+
/**
|
|
219
|
+
* The `target` attribute
|
|
220
|
+
*/
|
|
221
|
+
target: {
|
|
222
|
+
type: StringConstructor;
|
|
223
|
+
default: string;
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Text of the auto link
|
|
227
|
+
*/
|
|
228
|
+
text: {
|
|
229
|
+
type: StringConstructor;
|
|
230
|
+
required: true;
|
|
231
|
+
};
|
|
232
|
+
}>>, {
|
|
233
|
+
target: string;
|
|
234
|
+
activeMatch: string | RegExp;
|
|
235
|
+
ariaLabel: string;
|
|
236
|
+
exact: boolean;
|
|
237
|
+
rel: string;
|
|
238
|
+
}, SlotsType<{
|
|
239
|
+
default?: (() => VNode[] | VNode) | undefined;
|
|
240
|
+
before?: (() => VNode[] | VNode | null) | undefined;
|
|
241
|
+
after?: (() => VNode[] | VNode | null) | undefined;
|
|
242
|
+
}>>;
|
|
85
243
|
|
|
86
244
|
/**
|
|
87
|
-
*
|
|
245
|
+
* Wrapper component that only renders its content on the client side and skips server side rendering
|
|
88
246
|
*/
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
*/
|
|
93
|
-
declare const pageDataSymbol: InjectionKey<PageDataRef>;
|
|
94
|
-
/**
|
|
95
|
-
* Empty page data to be used as the fallback value
|
|
96
|
-
*/
|
|
97
|
-
declare const pageDataEmpty: PageData;
|
|
98
|
-
/**
|
|
99
|
-
* Returns the ref of the data of current page
|
|
100
|
-
*/
|
|
101
|
-
declare const usePageData: <T extends Record<any, any> = Record<never, never>>() => PageDataRef<T>;
|
|
247
|
+
declare const ClientOnly: vue.DefineComponent<{}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
248
|
+
[key: string]: any;
|
|
249
|
+
}>[] | null | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
102
250
|
|
|
103
251
|
/**
|
|
104
|
-
*
|
|
105
|
-
*/
|
|
106
|
-
type PageFrontmatterRef<T extends Record<any, any> = Record<string, unknown>> = ComputedRef<PageFrontmatter<T>>;
|
|
107
|
-
/**
|
|
108
|
-
* Injection key for page frontmatter
|
|
109
|
-
*/
|
|
110
|
-
declare const pageFrontmatterSymbol: InjectionKey<PageFrontmatterRef>;
|
|
111
|
-
/**
|
|
112
|
-
* Returns the ref of the frontmatter of current page
|
|
252
|
+
* Markdown rendered content
|
|
113
253
|
*/
|
|
114
|
-
declare const
|
|
254
|
+
declare const Content: vue.DefineComponent<{
|
|
255
|
+
path: {
|
|
256
|
+
type: StringConstructor;
|
|
257
|
+
required: false;
|
|
258
|
+
default: string;
|
|
259
|
+
};
|
|
260
|
+
}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
261
|
+
[key: string]: any;
|
|
262
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
263
|
+
path: {
|
|
264
|
+
type: StringConstructor;
|
|
265
|
+
required: false;
|
|
266
|
+
default: string;
|
|
267
|
+
};
|
|
268
|
+
}>>, {
|
|
269
|
+
path: string;
|
|
270
|
+
}, {}>;
|
|
115
271
|
|
|
272
|
+
interface RouteLinkProps {
|
|
273
|
+
/**
|
|
274
|
+
* Whether the link is active to have an active class
|
|
275
|
+
*
|
|
276
|
+
* Notice that the active status is not automatically determined according to the current route.
|
|
277
|
+
*
|
|
278
|
+
* @default false
|
|
279
|
+
*/
|
|
280
|
+
active?: boolean;
|
|
281
|
+
/**
|
|
282
|
+
* The class to add when the link is active
|
|
283
|
+
*
|
|
284
|
+
* @default 'route-link-active'
|
|
285
|
+
*/
|
|
286
|
+
activeClass?: string;
|
|
287
|
+
/**
|
|
288
|
+
* The route path to link to
|
|
289
|
+
*/
|
|
290
|
+
to: string;
|
|
291
|
+
}
|
|
116
292
|
/**
|
|
117
|
-
*
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
*
|
|
122
|
-
*/
|
|
123
|
-
type PageHeadRef = ComputedRef<PageHead>;
|
|
124
|
-
/**
|
|
125
|
-
* Injection key for page head
|
|
126
|
-
*/
|
|
127
|
-
declare const pageHeadSymbol: InjectionKey<PageHeadRef>;
|
|
128
|
-
/**
|
|
129
|
-
* Returns the ref of the head config of current page
|
|
293
|
+
* Component to render a link to another route.
|
|
294
|
+
*
|
|
295
|
+
* It's similar to `RouterLink` in `vue-router`, but more lightweight.
|
|
296
|
+
*
|
|
297
|
+
* It's recommended to use `RouteLink` in VuePress.
|
|
130
298
|
*/
|
|
131
|
-
declare const
|
|
299
|
+
declare const RouteLink: vue.DefineComponent<{
|
|
300
|
+
/**
|
|
301
|
+
* The route path to link to
|
|
302
|
+
*/
|
|
303
|
+
to: {
|
|
304
|
+
type: StringConstructor;
|
|
305
|
+
required: true;
|
|
306
|
+
};
|
|
307
|
+
/**
|
|
308
|
+
* Whether the link is active to have an active class
|
|
309
|
+
*
|
|
310
|
+
* Notice that the active status is not automatically determined according to the current route.
|
|
311
|
+
*/
|
|
312
|
+
active: BooleanConstructor;
|
|
313
|
+
/**
|
|
314
|
+
* The class to add when the link is active
|
|
315
|
+
*/
|
|
316
|
+
activeClass: {
|
|
317
|
+
type: StringConstructor;
|
|
318
|
+
default: string;
|
|
319
|
+
};
|
|
320
|
+
}, () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
321
|
+
[key: string]: any;
|
|
322
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
323
|
+
/**
|
|
324
|
+
* The route path to link to
|
|
325
|
+
*/
|
|
326
|
+
to: {
|
|
327
|
+
type: StringConstructor;
|
|
328
|
+
required: true;
|
|
329
|
+
};
|
|
330
|
+
/**
|
|
331
|
+
* Whether the link is active to have an active class
|
|
332
|
+
*
|
|
333
|
+
* Notice that the active status is not automatically determined according to the current route.
|
|
334
|
+
*/
|
|
335
|
+
active: BooleanConstructor;
|
|
336
|
+
/**
|
|
337
|
+
* The class to add when the link is active
|
|
338
|
+
*/
|
|
339
|
+
activeClass: {
|
|
340
|
+
type: StringConstructor;
|
|
341
|
+
default: string;
|
|
342
|
+
};
|
|
343
|
+
}>>, {
|
|
344
|
+
active: boolean;
|
|
345
|
+
activeClass: string;
|
|
346
|
+
}, SlotsType<{
|
|
347
|
+
default: () => string | VNode | (string | VNode)[];
|
|
348
|
+
}>>;
|
|
132
349
|
|
|
133
350
|
/**
|
|
134
|
-
*
|
|
135
|
-
*/
|
|
136
|
-
type PageHeadTitle = string;
|
|
137
|
-
/**
|
|
138
|
-
* Ref wrapper of `PageHeadTitle`
|
|
139
|
-
*/
|
|
140
|
-
type PageHeadTitleRef = ComputedRef<PageHeadTitle>;
|
|
141
|
-
/**
|
|
142
|
-
* Injection key for page head title
|
|
351
|
+
* Injection key for client data
|
|
143
352
|
*/
|
|
144
|
-
declare const
|
|
353
|
+
declare const clientDataSymbol: InjectionKey<ClientData>;
|
|
145
354
|
/**
|
|
146
|
-
* Returns
|
|
355
|
+
* Returns client data
|
|
147
356
|
*/
|
|
148
|
-
declare const
|
|
357
|
+
declare const useClientData: () => ClientData;
|
|
149
358
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
* Ref wrapper of `PageLang`
|
|
156
|
-
*/
|
|
157
|
-
type PageLangRef = ComputedRef<PageLang>;
|
|
158
|
-
/**
|
|
159
|
-
* Injection key for page language
|
|
160
|
-
*/
|
|
161
|
-
declare const pageLangSymbol: InjectionKey<PageLangRef>;
|
|
162
|
-
/**
|
|
163
|
-
* Returns the ref of the language of current page
|
|
164
|
-
*/
|
|
359
|
+
declare const useLayouts: () => LayoutsRef;
|
|
360
|
+
declare const usePageComponent: () => PageComponentRef;
|
|
361
|
+
declare const usePageData: <T extends Record<any, any> = Record<never, never>>() => PageDataRef<T>;
|
|
362
|
+
declare const usePageFrontmatter: <T extends Record<any, any> = Record<string, unknown>>() => PageFrontmatterRef<T>;
|
|
363
|
+
declare const usePageHead: () => PageHeadRef;
|
|
165
364
|
declare const usePageLang: () => PageLangRef;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
* Ref wrapper of `PageLayout`
|
|
169
|
-
*/
|
|
170
|
-
type PageLayoutRef = ComputedRef<Component>;
|
|
171
|
-
/**
|
|
172
|
-
* Injection key for page layout
|
|
173
|
-
*/
|
|
174
|
-
declare const pageLayoutSymbol: InjectionKey<PageLayoutRef>;
|
|
175
|
-
/**
|
|
176
|
-
* Returns layout component of current page
|
|
177
|
-
*/
|
|
178
|
-
declare const usePageLayout: () => ComputedRef<Component>;
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Data resolvers of all pages
|
|
182
|
-
*
|
|
183
|
-
* The key is page key, and the value is an async function that
|
|
184
|
-
* returns the page data
|
|
185
|
-
*/
|
|
186
|
-
type PagesData = Record<string, (() => Promise<PageData>) | undefined>;
|
|
187
|
-
/**
|
|
188
|
-
* Ref wrapper of `PagesData`
|
|
189
|
-
*/
|
|
190
|
-
type PagesDataRef = Ref<PagesData>;
|
|
191
|
-
/**
|
|
192
|
-
* Global pages data ref
|
|
193
|
-
*/
|
|
194
|
-
declare const pagesData: PagesDataRef;
|
|
195
|
-
/**
|
|
196
|
-
* Returns the ref of data resolvers of all pages
|
|
197
|
-
*/
|
|
198
|
-
declare const usePagesData: () => PagesDataRef;
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Route locale path
|
|
202
|
-
*/
|
|
203
|
-
type RouteLocale = string;
|
|
204
|
-
/**
|
|
205
|
-
* Ref wrapper of `RouteLocale`
|
|
206
|
-
*/
|
|
207
|
-
type RouteLocaleRef = Readonly<Ref<RouteLocale>>;
|
|
208
|
-
/**
|
|
209
|
-
* Injection key for page route locale path
|
|
210
|
-
*/
|
|
211
|
-
declare const routeLocaleSymbol: InjectionKey<RouteLocaleRef>;
|
|
212
|
-
/**
|
|
213
|
-
* Returns the ref of the route locale path of current page
|
|
214
|
-
*/
|
|
365
|
+
declare const usePageLayout: () => PageLayoutRef;
|
|
366
|
+
declare const useRedirects: () => RedirectsRef;
|
|
215
367
|
declare const useRouteLocale: () => RouteLocaleRef;
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
* Ref wrapper of `SiteData`
|
|
219
|
-
*/
|
|
220
|
-
type SiteDataRef = Ref<SiteData>;
|
|
221
|
-
/**
|
|
222
|
-
* Global site data ref
|
|
223
|
-
*/
|
|
224
|
-
declare const siteData: SiteDataRef;
|
|
225
|
-
/**
|
|
226
|
-
* Returns the ref of the site data
|
|
227
|
-
*/
|
|
368
|
+
declare const useRoutePath: () => RoutePathRef;
|
|
369
|
+
declare const useRoutes: () => RoutesRef;
|
|
228
370
|
declare const useSiteData: () => SiteDataRef;
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Site data of current locale
|
|
232
|
-
*/
|
|
233
|
-
type SiteLocaleData = SiteData;
|
|
234
|
-
/**
|
|
235
|
-
* Ref wrapper of `SiteLocaleData`
|
|
236
|
-
*/
|
|
237
|
-
type SiteLocaleDataRef = ComputedRef<SiteLocaleData>;
|
|
238
|
-
/**
|
|
239
|
-
* Injection key for site locale data
|
|
240
|
-
*/
|
|
241
|
-
declare const siteLocaleDataSymbol: InjectionKey<SiteLocaleDataRef>;
|
|
242
|
-
/**
|
|
243
|
-
* Returns the ref of the site data of current locale
|
|
244
|
-
*/
|
|
245
371
|
declare const useSiteLocaleData: () => SiteLocaleDataRef;
|
|
246
372
|
|
|
247
373
|
/**
|
|
@@ -257,31 +383,45 @@ declare const updateHeadSymbol: InjectionKey<UpdateHead>;
|
|
|
257
383
|
*/
|
|
258
384
|
declare const useUpdateHead: () => UpdateHead;
|
|
259
385
|
|
|
386
|
+
interface ResolvedRoute<T extends RouteMeta = RouteMeta> extends Route<T> {
|
|
387
|
+
path: string;
|
|
388
|
+
notFound: boolean;
|
|
389
|
+
}
|
|
260
390
|
/**
|
|
261
|
-
*
|
|
391
|
+
* Resolve route with given path
|
|
262
392
|
*/
|
|
263
|
-
declare const
|
|
393
|
+
declare const resolveRoute: <T extends RouteMeta = RouteMeta>(path: string, currentPath?: string) => ResolvedRoute<T>;
|
|
264
394
|
|
|
265
395
|
/**
|
|
266
|
-
*
|
|
396
|
+
* Resolve route path with given raw path
|
|
267
397
|
*/
|
|
268
|
-
declare const
|
|
398
|
+
declare const resolveRoutePath: (path: string, currentPath?: string) => string;
|
|
269
399
|
|
|
270
400
|
/**
|
|
271
401
|
* Resolver methods to get global computed
|
|
272
402
|
*
|
|
273
403
|
* Users can override corresponding method for advanced customization
|
|
404
|
+
*
|
|
405
|
+
* @experimental - This is an experimental API and may be changed in minor versions
|
|
274
406
|
*/
|
|
275
407
|
declare const resolvers: {
|
|
276
408
|
resolveLayouts: (clientConfigs: ClientConfig[]) => Layouts;
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
resolvePageLang: (page: PageData, siteLocale: SiteLocaleData) => PageLang;
|
|
282
|
-
resolvePageLayout: (page: PageData, layouts: Layouts) => Component;
|
|
409
|
+
resolvePageHead: (pageHeadTitle: PageHeadTitle, pageFrontmatter: PageFrontmatter, siteLocaleDate: SiteLocaleData) => PageHead;
|
|
410
|
+
resolvePageHeadTitle: (pageData: PageData, siteLocaleDate: SiteLocaleData) => PageHeadTitle;
|
|
411
|
+
resolvePageLang: (pageData: PageData, siteLocaleData: SiteLocaleData) => PageLang;
|
|
412
|
+
resolvePageLayout: (pageData: PageData, layouts: Layouts) => PageLayout;
|
|
283
413
|
resolveRouteLocale: (locales: SiteData['locales'], routePath: string) => RouteLocale;
|
|
284
|
-
resolveSiteLocaleData: (
|
|
414
|
+
resolveSiteLocaleData: ({ base, locales, ...siteData }: SiteData, routeLocale: RouteLocale) => SiteLocaleData;
|
|
285
415
|
};
|
|
286
416
|
|
|
287
|
-
|
|
417
|
+
/**
|
|
418
|
+
* A helper function to help you define vuepress client config file
|
|
419
|
+
*/
|
|
420
|
+
declare const defineClientConfig: (clientConfig?: ClientConfig) => ClientConfig;
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Prefix url with site base
|
|
424
|
+
*/
|
|
425
|
+
declare const withBase: (url: string) => string;
|
|
426
|
+
|
|
427
|
+
export { AutoLink, type AutoLinkProps, type ClientConfig, type ClientData, ClientOnly, Content, type Layouts, type LayoutsRef, type PageChunk, type PageComponent, type PageComponentRef, type PageDataRef, type PageFrontmatterRef, type PageHead, type PageHeadRef, type PageHeadTitle, type PageHeadTitleRef, type PageLang, type PageLangRef, type PageLayout, type PageLayoutRef, type Redirects, type RedirectsRef, type ResolvedRoute, type Route, RouteLink, type RouteLinkProps, type RouteLocale, type RouteLocaleRef, type RouteMeta, type RoutePath, type RoutePathRef, type Routes, type RoutesRef, type SiteDataRef, type SiteLocaleDataRef, type UpdateHead, clientDataSymbol, defineClientConfig, resolveRoute, resolveRoutePath, resolvers, updateHeadSymbol, useClientData, useLayouts, usePageComponent, usePageData, usePageFrontmatter, usePageHead, usePageLang, usePageLayout, useRedirects, useRouteLocale, useRoutePath, useRoutes, useSiteData, useSiteLocaleData, useUpdateHead, withBase };
|
package/dist/index.js
CHANGED
|
@@ -1,62 +1,58 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AutoLink,
|
|
2
3
|
ClientOnly,
|
|
3
4
|
Content,
|
|
5
|
+
RouteLink,
|
|
6
|
+
clientDataSymbol,
|
|
4
7
|
defineClientConfig,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
pageDataSymbol,
|
|
8
|
-
pageFrontmatterSymbol,
|
|
9
|
-
pageHeadSymbol,
|
|
10
|
-
pageHeadTitleSymbol,
|
|
11
|
-
pageLangSymbol,
|
|
12
|
-
pageLayoutSymbol,
|
|
13
|
-
pagesData,
|
|
8
|
+
resolveRoute,
|
|
9
|
+
resolveRoutePath,
|
|
14
10
|
resolvers,
|
|
15
|
-
routeLocaleSymbol,
|
|
16
|
-
siteData,
|
|
17
|
-
siteLocaleDataSymbol,
|
|
18
11
|
updateHeadSymbol,
|
|
12
|
+
useClientData,
|
|
19
13
|
useLayouts,
|
|
14
|
+
usePageComponent,
|
|
20
15
|
usePageData,
|
|
21
16
|
usePageFrontmatter,
|
|
22
17
|
usePageHead,
|
|
23
|
-
usePageHeadTitle,
|
|
24
18
|
usePageLang,
|
|
25
19
|
usePageLayout,
|
|
26
|
-
|
|
20
|
+
useRedirects,
|
|
21
|
+
useRoute,
|
|
27
22
|
useRouteLocale,
|
|
23
|
+
useRoutePath,
|
|
24
|
+
useRouter,
|
|
25
|
+
useRoutes,
|
|
28
26
|
useSiteData,
|
|
29
27
|
useSiteLocaleData,
|
|
30
28
|
useUpdateHead,
|
|
31
29
|
withBase
|
|
32
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-GA5RAHE7.js";
|
|
33
31
|
export {
|
|
32
|
+
AutoLink,
|
|
34
33
|
ClientOnly,
|
|
35
34
|
Content,
|
|
35
|
+
RouteLink,
|
|
36
|
+
clientDataSymbol,
|
|
36
37
|
defineClientConfig,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
pageDataSymbol,
|
|
40
|
-
pageFrontmatterSymbol,
|
|
41
|
-
pageHeadSymbol,
|
|
42
|
-
pageHeadTitleSymbol,
|
|
43
|
-
pageLangSymbol,
|
|
44
|
-
pageLayoutSymbol,
|
|
45
|
-
pagesData,
|
|
38
|
+
resolveRoute,
|
|
39
|
+
resolveRoutePath,
|
|
46
40
|
resolvers,
|
|
47
|
-
routeLocaleSymbol,
|
|
48
|
-
siteData,
|
|
49
|
-
siteLocaleDataSymbol,
|
|
50
41
|
updateHeadSymbol,
|
|
42
|
+
useClientData,
|
|
51
43
|
useLayouts,
|
|
44
|
+
usePageComponent,
|
|
52
45
|
usePageData,
|
|
53
46
|
usePageFrontmatter,
|
|
54
47
|
usePageHead,
|
|
55
|
-
usePageHeadTitle,
|
|
56
48
|
usePageLang,
|
|
57
49
|
usePageLayout,
|
|
58
|
-
|
|
50
|
+
useRedirects,
|
|
51
|
+
useRoute,
|
|
59
52
|
useRouteLocale,
|
|
53
|
+
useRoutePath,
|
|
54
|
+
useRouter,
|
|
55
|
+
useRoutes,
|
|
60
56
|
useSiteData,
|
|
61
57
|
useSiteLocaleData,
|
|
62
58
|
useUpdateHead,
|