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