@vuepress/client 2.0.0-rc.26 → 2.0.0-rc.28
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/app.d.ts +4 -5
- package/dist/app.js +254 -322
- package/dist/chunk-pbuEa-1d.js +13 -0
- package/dist/constants-COBTj3zj.js +57 -0
- package/dist/index-CNztZIId.d.ts +117 -0
- package/dist/index.d.ts +198 -293
- package/dist/index.js +3 -83
- package/dist/setupDevtools-B3cgI7XH.js +64 -0
- package/dist/utils-_b2e7bpk.js +365 -0
- package/package.json +32 -36
- package/dist/chunk-MLKGABMK.js +0 -9
- package/dist/chunk-XZCIWC7J.js +0 -66
- package/dist/chunk-YWDQ52BP.js +0 -459
- package/dist/createVueAppFunction-onJTVJru.d.ts +0 -9
- package/dist/setupDevtools-QXEOFQJV.js +0 -91
package/dist/chunk-YWDQ52BP.js
DELETED
|
@@ -1,459 +0,0 @@
|
|
|
1
|
-
// src/composables/clientData.ts
|
|
2
|
-
import { inject } from "vue";
|
|
3
|
-
var clientDataSymbol = Symbol(
|
|
4
|
-
__VUEPRESS_DEV__ ? "clientData" : ""
|
|
5
|
-
);
|
|
6
|
-
var useClientData = () => {
|
|
7
|
-
const clientData = inject(clientDataSymbol);
|
|
8
|
-
if (!clientData) {
|
|
9
|
-
throw new Error("useClientData() is called without provider.");
|
|
10
|
-
}
|
|
11
|
-
return clientData;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// src/composables/clientDataUtils.ts
|
|
15
|
-
var useLayouts = () => useClientData().layouts;
|
|
16
|
-
var usePageComponent = () => useClientData().pageComponent;
|
|
17
|
-
var usePageData = () => useClientData().pageData;
|
|
18
|
-
var usePageFrontmatter = () => useClientData().pageFrontmatter;
|
|
19
|
-
var usePageHead = () => useClientData().pageHead;
|
|
20
|
-
var usePageLang = () => useClientData().pageLang;
|
|
21
|
-
var usePageLayout = () => useClientData().pageLayout;
|
|
22
|
-
var useRedirects = () => useClientData().redirects;
|
|
23
|
-
var useRouteLocale = () => useClientData().routeLocale;
|
|
24
|
-
var useRoutePath = () => useClientData().routePath;
|
|
25
|
-
var useRoutes = () => useClientData().routes;
|
|
26
|
-
var useSiteData = () => useClientData().siteData;
|
|
27
|
-
var useSiteLocaleData = () => useClientData().siteLocaleData;
|
|
28
|
-
var useData = useClientData;
|
|
29
|
-
var useFrontmatter = usePageFrontmatter;
|
|
30
|
-
var useHead = usePageHead;
|
|
31
|
-
var useLang = usePageLang;
|
|
32
|
-
var usePage = usePageData;
|
|
33
|
-
var useSite = useSiteData;
|
|
34
|
-
var useSiteLocale = useSiteLocaleData;
|
|
35
|
-
|
|
36
|
-
// src/composables/onContentUpdated.ts
|
|
37
|
-
import { onUnmounted } from "vue";
|
|
38
|
-
|
|
39
|
-
// src/internal/contentUpdatedCallbacks.ts
|
|
40
|
-
var contentUpdatedCallbacks = /* @__PURE__ */ new Set();
|
|
41
|
-
|
|
42
|
-
// src/composables/onContentUpdated.ts
|
|
43
|
-
var onContentUpdated = (fn) => {
|
|
44
|
-
contentUpdatedCallbacks.add(fn);
|
|
45
|
-
onUnmounted(() => {
|
|
46
|
-
contentUpdatedCallbacks.delete(fn);
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
// src/composables/updateHead.ts
|
|
51
|
-
import { inject as inject2 } from "vue";
|
|
52
|
-
var updateHeadSymbol = Symbol(
|
|
53
|
-
__VUEPRESS_DEV__ ? "updateHead" : ""
|
|
54
|
-
);
|
|
55
|
-
var useUpdateHead = () => {
|
|
56
|
-
const updateHead = inject2(updateHeadSymbol);
|
|
57
|
-
if (!updateHead) {
|
|
58
|
-
throw new Error("useUpdateHead() is called without provider.");
|
|
59
|
-
}
|
|
60
|
-
return updateHead;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
// src/router/resolveRoutePath.ts
|
|
64
|
-
import { normalizeRoutePath } from "@vuepress/shared";
|
|
65
|
-
|
|
66
|
-
// src/internal/routes.ts
|
|
67
|
-
import {
|
|
68
|
-
redirects as redirectsRaw,
|
|
69
|
-
routes as routesRaw
|
|
70
|
-
} from "@internal/routes";
|
|
71
|
-
import { shallowRef } from "vue";
|
|
72
|
-
var redirects = shallowRef(redirectsRaw);
|
|
73
|
-
var routes = shallowRef(routesRaw);
|
|
74
|
-
if (__VUEPRESS_DEV__ && (import.meta.webpackHot || import.meta.hot)) {
|
|
75
|
-
__VUE_HMR_RUNTIME__.updateRedirects = (data) => {
|
|
76
|
-
redirects.value = data;
|
|
77
|
-
};
|
|
78
|
-
__VUE_HMR_RUNTIME__.updateRoutes = (data) => {
|
|
79
|
-
routes.value = data;
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// src/router/resolveRoutePath.ts
|
|
84
|
-
var resolveRoutePath = (pathname, currentPath) => {
|
|
85
|
-
const normalizedRoutePath = normalizeRoutePath(pathname, currentPath);
|
|
86
|
-
if (routes.value[normalizedRoutePath]) return normalizedRoutePath;
|
|
87
|
-
const encodedRoutePath = encodeURI(normalizedRoutePath);
|
|
88
|
-
if (routes.value[encodedRoutePath]) {
|
|
89
|
-
return encodedRoutePath;
|
|
90
|
-
}
|
|
91
|
-
const redirectedRoutePath = redirects.value[normalizedRoutePath] || redirects.value[encodedRoutePath];
|
|
92
|
-
if (redirectedRoutePath) {
|
|
93
|
-
return redirectedRoutePath;
|
|
94
|
-
}
|
|
95
|
-
return normalizedRoutePath;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
// src/router/resolveRoute.ts
|
|
99
|
-
import { splitPath } from "@vuepress/shared";
|
|
100
|
-
var resolveRoute = (path, currentPath) => {
|
|
101
|
-
const { pathname, hashAndQueries } = splitPath(path);
|
|
102
|
-
const routePath = resolveRoutePath(pathname, currentPath);
|
|
103
|
-
const routeFullPath = routePath + hashAndQueries;
|
|
104
|
-
if (!routes.value[routePath]) {
|
|
105
|
-
return {
|
|
106
|
-
...routes.value["/404.html"],
|
|
107
|
-
path: routeFullPath,
|
|
108
|
-
notFound: true
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
return {
|
|
112
|
-
...routes.value[routePath],
|
|
113
|
-
path: routeFullPath,
|
|
114
|
-
notFound: false
|
|
115
|
-
};
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
// src/router/resolveRouteFullPath.ts
|
|
119
|
-
import { splitPath as splitPath2 } from "@vuepress/shared";
|
|
120
|
-
var resolveRouteFullPath = (path, currentPath) => {
|
|
121
|
-
const { pathname, hashAndQueries } = splitPath2(path);
|
|
122
|
-
return resolveRoutePath(pathname, currentPath) + hashAndQueries;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
// src/router/index.ts
|
|
126
|
-
import { useRoute, useRouter } from "vue-router";
|
|
127
|
-
|
|
128
|
-
// src/components/RouteLink.ts
|
|
129
|
-
import { computed, defineComponent, h } from "vue";
|
|
130
|
-
import { useRoute as useRoute2, useRouter as useRouter2 } from "vue-router";
|
|
131
|
-
var guardEvent = (event) => {
|
|
132
|
-
if (event.metaKey || event.altKey || event.ctrlKey || event.shiftKey) return;
|
|
133
|
-
if (event.defaultPrevented) return;
|
|
134
|
-
if (event.button !== void 0 && event.button !== 0) return;
|
|
135
|
-
if (event.currentTarget) {
|
|
136
|
-
const target = event.currentTarget.getAttribute("target");
|
|
137
|
-
if (target?.match(/\b_blank\b/i)) return;
|
|
138
|
-
}
|
|
139
|
-
event.preventDefault();
|
|
140
|
-
return true;
|
|
141
|
-
};
|
|
142
|
-
var RouteLink = defineComponent({
|
|
143
|
-
name: "RouteLink",
|
|
144
|
-
props: {
|
|
145
|
-
/**
|
|
146
|
-
* The route path to link to
|
|
147
|
-
*/
|
|
148
|
-
to: {
|
|
149
|
-
type: String,
|
|
150
|
-
required: true
|
|
151
|
-
},
|
|
152
|
-
/**
|
|
153
|
-
* Whether the link is active to have an active class
|
|
154
|
-
*
|
|
155
|
-
* Notice that the active status is not automatically determined according to the current route.
|
|
156
|
-
*/
|
|
157
|
-
active: Boolean,
|
|
158
|
-
/**
|
|
159
|
-
* The class to add when the link is active
|
|
160
|
-
*/
|
|
161
|
-
activeClass: {
|
|
162
|
-
type: String,
|
|
163
|
-
default: "route-link-active"
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
slots: Object,
|
|
167
|
-
setup(props, { slots }) {
|
|
168
|
-
const router = useRouter2();
|
|
169
|
-
const route = useRoute2();
|
|
170
|
-
const path = computed(
|
|
171
|
-
() => props.to.startsWith("#") || props.to.startsWith("?") ? props.to : `${__VUEPRESS_BASE__}${resolveRouteFullPath(props.to, route.path).substring(1)}`
|
|
172
|
-
);
|
|
173
|
-
return () => h(
|
|
174
|
-
"a",
|
|
175
|
-
{
|
|
176
|
-
class: ["route-link", { [props.activeClass]: props.active }],
|
|
177
|
-
href: path.value,
|
|
178
|
-
onClick: (event = {}) => {
|
|
179
|
-
if (guardEvent(event)) {
|
|
180
|
-
void router.push(props.to).catch();
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
|
-
slots.default()
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
// src/components/AutoLink.ts
|
|
190
|
-
import { isLinkWithProtocol } from "@vuepress/shared";
|
|
191
|
-
import { computed as computed2, defineComponent as defineComponent2, h as h2, toRef } from "vue";
|
|
192
|
-
import { useRoute as useRoute3 } from "vue-router";
|
|
193
|
-
var AutoLink = defineComponent2({
|
|
194
|
-
name: "AutoLink",
|
|
195
|
-
props: {
|
|
196
|
-
config: {
|
|
197
|
-
type: Object,
|
|
198
|
-
required: true
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
slots: Object,
|
|
202
|
-
setup(props, { slots }) {
|
|
203
|
-
const config = toRef(props, "config");
|
|
204
|
-
const route = useRoute3();
|
|
205
|
-
const siteData = useSiteData();
|
|
206
|
-
const withProtocol = computed2(() => isLinkWithProtocol(config.value.link));
|
|
207
|
-
const linkTarget = computed2(
|
|
208
|
-
() => config.value.target || (withProtocol.value ? "_blank" : void 0)
|
|
209
|
-
);
|
|
210
|
-
const isBlankTarget = computed2(() => linkTarget.value === "_blank");
|
|
211
|
-
const isInternal = computed2(
|
|
212
|
-
() => !withProtocol.value && !isBlankTarget.value
|
|
213
|
-
);
|
|
214
|
-
const linkRel = computed2(
|
|
215
|
-
() => config.value.rel || (isBlankTarget.value ? "noopener noreferrer" : null)
|
|
216
|
-
);
|
|
217
|
-
const linkAriaLabel = computed2(
|
|
218
|
-
() => config.value.ariaLabel ?? config.value.text
|
|
219
|
-
);
|
|
220
|
-
const shouldBeActiveInSubpath = computed2(() => {
|
|
221
|
-
if (config.value.exact) return false;
|
|
222
|
-
const localePaths = Object.keys(siteData.value.locales);
|
|
223
|
-
return localePaths.length ? (
|
|
224
|
-
// Check all the locales
|
|
225
|
-
localePaths.every((key) => key !== config.value.link)
|
|
226
|
-
) : (
|
|
227
|
-
// Check root
|
|
228
|
-
config.value.link !== "/"
|
|
229
|
-
);
|
|
230
|
-
});
|
|
231
|
-
const isActive = computed2(() => {
|
|
232
|
-
if (!isInternal.value) return false;
|
|
233
|
-
if (config.value.activeMatch) {
|
|
234
|
-
return (config.value.activeMatch instanceof RegExp ? config.value.activeMatch : new RegExp(config.value.activeMatch, "u")).test(route.path);
|
|
235
|
-
}
|
|
236
|
-
if (shouldBeActiveInSubpath.value) {
|
|
237
|
-
return route.path.startsWith(config.value.link);
|
|
238
|
-
}
|
|
239
|
-
return route.path === config.value.link;
|
|
240
|
-
});
|
|
241
|
-
return () => {
|
|
242
|
-
const { before, after, default: defaultSlot } = slots;
|
|
243
|
-
const content = defaultSlot?.(config.value) ?? [
|
|
244
|
-
before?.(config.value),
|
|
245
|
-
config.value.text,
|
|
246
|
-
after?.(config.value)
|
|
247
|
-
];
|
|
248
|
-
return isInternal.value ? h2(
|
|
249
|
-
RouteLink,
|
|
250
|
-
{
|
|
251
|
-
"class": "auto-link",
|
|
252
|
-
"to": config.value.link,
|
|
253
|
-
"active": isActive.value,
|
|
254
|
-
"aria-label": linkAriaLabel.value
|
|
255
|
-
},
|
|
256
|
-
() => content
|
|
257
|
-
) : h2(
|
|
258
|
-
"a",
|
|
259
|
-
{
|
|
260
|
-
"class": "auto-link external-link",
|
|
261
|
-
"href": config.value.link,
|
|
262
|
-
"aria-label": linkAriaLabel.value,
|
|
263
|
-
"rel": linkRel.value,
|
|
264
|
-
"target": linkTarget.value
|
|
265
|
-
},
|
|
266
|
-
content
|
|
267
|
-
);
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
// src/components/ClientOnly.ts
|
|
273
|
-
import { defineComponent as defineComponent3, onMounted, ref } from "vue";
|
|
274
|
-
var ClientOnly = defineComponent3({
|
|
275
|
-
name: "ClientOnly",
|
|
276
|
-
setup(_, ctx) {
|
|
277
|
-
const isMounted = ref(false);
|
|
278
|
-
onMounted(() => {
|
|
279
|
-
isMounted.value = true;
|
|
280
|
-
});
|
|
281
|
-
return () => isMounted.value ? ctx.slots.default?.() : null;
|
|
282
|
-
}
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
// src/components/Content.ts
|
|
286
|
-
import { computed as computed3, defineAsyncComponent, defineComponent as defineComponent4, h as h3, watch } from "vue";
|
|
287
|
-
var runContentUpdatedCallbacks = (reason) => {
|
|
288
|
-
contentUpdatedCallbacks.forEach((fn) => fn(reason));
|
|
289
|
-
};
|
|
290
|
-
var Content = defineComponent4({
|
|
291
|
-
name: "Content",
|
|
292
|
-
props: {
|
|
293
|
-
path: {
|
|
294
|
-
type: String,
|
|
295
|
-
required: false,
|
|
296
|
-
default: ""
|
|
297
|
-
}
|
|
298
|
-
},
|
|
299
|
-
setup(props) {
|
|
300
|
-
const pageComponent = usePageComponent();
|
|
301
|
-
const ContentComponent = computed3(() => {
|
|
302
|
-
if (!props.path) return pageComponent.value;
|
|
303
|
-
const route = resolveRoute(props.path);
|
|
304
|
-
return defineAsyncComponent(
|
|
305
|
-
async () => route.loader().then(({ comp }) => comp)
|
|
306
|
-
);
|
|
307
|
-
});
|
|
308
|
-
const frontmatter = usePageFrontmatter();
|
|
309
|
-
watch(
|
|
310
|
-
frontmatter,
|
|
311
|
-
() => {
|
|
312
|
-
runContentUpdatedCallbacks("updated");
|
|
313
|
-
},
|
|
314
|
-
{ deep: true, flush: "post" }
|
|
315
|
-
);
|
|
316
|
-
return () => h3(ContentComponent.value, {
|
|
317
|
-
onVnodeMounted: () => {
|
|
318
|
-
runContentUpdatedCallbacks("mounted");
|
|
319
|
-
},
|
|
320
|
-
onVnodeUpdated: () => {
|
|
321
|
-
runContentUpdatedCallbacks("updated");
|
|
322
|
-
},
|
|
323
|
-
onVnodeBeforeUnmount: () => {
|
|
324
|
-
runContentUpdatedCallbacks("beforeUnmount");
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
});
|
|
329
|
-
|
|
330
|
-
// src/resolvers.ts
|
|
331
|
-
import { dedupeHead, isString, resolveLocalePath } from "@vuepress/shared";
|
|
332
|
-
import { reactive } from "vue";
|
|
333
|
-
|
|
334
|
-
// src/constants.ts
|
|
335
|
-
var LAYOUT_NAME_DEFAULT = "Layout";
|
|
336
|
-
var LANG_DEFAULT = "en-US";
|
|
337
|
-
|
|
338
|
-
// src/resolvers.ts
|
|
339
|
-
var resolvers = reactive({
|
|
340
|
-
/**
|
|
341
|
-
* Resolve layouts component map
|
|
342
|
-
*/
|
|
343
|
-
resolveLayouts: (clientConfigs) => clientConfigs.reduce(
|
|
344
|
-
(prev, item) => ({
|
|
345
|
-
...prev,
|
|
346
|
-
...item.layouts
|
|
347
|
-
}),
|
|
348
|
-
{}
|
|
349
|
-
),
|
|
350
|
-
/**
|
|
351
|
-
* Merge the head config in frontmatter and site locale
|
|
352
|
-
*
|
|
353
|
-
* Frontmatter should take priority over site locale
|
|
354
|
-
*/
|
|
355
|
-
resolvePageHead: (pageHeadTitle, pageFrontmatter, siteLocaleDate) => {
|
|
356
|
-
const description = isString(pageFrontmatter.description) ? pageFrontmatter.description : siteLocaleDate.description;
|
|
357
|
-
const head = [
|
|
358
|
-
...Array.isArray(pageFrontmatter.head) ? pageFrontmatter.head : [],
|
|
359
|
-
...siteLocaleDate.head,
|
|
360
|
-
["title", {}, pageHeadTitle],
|
|
361
|
-
["meta", { name: "description", content: description }]
|
|
362
|
-
];
|
|
363
|
-
return dedupeHead(head);
|
|
364
|
-
},
|
|
365
|
-
/**
|
|
366
|
-
* Resolve the content of page head title
|
|
367
|
-
*
|
|
368
|
-
* It would be used as the content of the `<title>` tag
|
|
369
|
-
*/
|
|
370
|
-
resolvePageHeadTitle: (pageData, siteLocaleDate) => [pageData.title, siteLocaleDate.title].filter((item) => !!item).join(" | "),
|
|
371
|
-
/**
|
|
372
|
-
* Resolve page language from page data
|
|
373
|
-
*
|
|
374
|
-
* It would be used as the `lang` attribute of `<html>` tag
|
|
375
|
-
*/
|
|
376
|
-
resolvePageLang: (pageData, siteLocaleData) => pageData.lang || siteLocaleData.lang || LANG_DEFAULT,
|
|
377
|
-
/**
|
|
378
|
-
* Resolve layout component of current page
|
|
379
|
-
*/
|
|
380
|
-
resolvePageLayout: (pageData, layouts) => {
|
|
381
|
-
const layoutName = isString(pageData.frontmatter.layout) ? pageData.frontmatter.layout : LAYOUT_NAME_DEFAULT;
|
|
382
|
-
if (!layouts[layoutName]) {
|
|
383
|
-
throw new Error(`[vuepress] Cannot resolve layout: ${layoutName}`);
|
|
384
|
-
}
|
|
385
|
-
return layouts[layoutName];
|
|
386
|
-
},
|
|
387
|
-
/**
|
|
388
|
-
* Resolve locale path according to route path and locales config
|
|
389
|
-
*/
|
|
390
|
-
resolveRouteLocale: (locales, routePath) => resolveLocalePath(locales, decodeURI(routePath)),
|
|
391
|
-
/**
|
|
392
|
-
* Resolve site data for specific locale
|
|
393
|
-
*
|
|
394
|
-
* It would merge the locales fields to the root fields
|
|
395
|
-
*/
|
|
396
|
-
resolveSiteLocaleData: ({ base, locales, ...siteData }, routeLocale) => ({
|
|
397
|
-
...siteData,
|
|
398
|
-
...locales[routeLocale],
|
|
399
|
-
head: [
|
|
400
|
-
// when merging head, the locales head should be placed before root head
|
|
401
|
-
// to get higher priority
|
|
402
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- unsafe indexed access
|
|
403
|
-
...locales[routeLocale]?.head ?? [],
|
|
404
|
-
...siteData.head
|
|
405
|
-
]
|
|
406
|
-
})
|
|
407
|
-
});
|
|
408
|
-
|
|
409
|
-
// src/utils/defineClientConfig.ts
|
|
410
|
-
var defineClientConfig = (clientConfig = {}) => clientConfig;
|
|
411
|
-
|
|
412
|
-
// src/utils/withBase.ts
|
|
413
|
-
import { isLinkHttp, removeLeadingSlash } from "@vuepress/shared";
|
|
414
|
-
var withBase = (url) => {
|
|
415
|
-
if (isLinkHttp(url)) return url;
|
|
416
|
-
return `${__VUEPRESS_BASE__}${removeLeadingSlash(url)}`;
|
|
417
|
-
};
|
|
418
|
-
|
|
419
|
-
export {
|
|
420
|
-
clientDataSymbol,
|
|
421
|
-
useClientData,
|
|
422
|
-
useLayouts,
|
|
423
|
-
usePageComponent,
|
|
424
|
-
usePageData,
|
|
425
|
-
usePageFrontmatter,
|
|
426
|
-
usePageHead,
|
|
427
|
-
usePageLang,
|
|
428
|
-
usePageLayout,
|
|
429
|
-
useRedirects,
|
|
430
|
-
useRouteLocale,
|
|
431
|
-
useRoutePath,
|
|
432
|
-
useRoutes,
|
|
433
|
-
useSiteData,
|
|
434
|
-
useSiteLocaleData,
|
|
435
|
-
useData,
|
|
436
|
-
useFrontmatter,
|
|
437
|
-
useHead,
|
|
438
|
-
useLang,
|
|
439
|
-
usePage,
|
|
440
|
-
useSite,
|
|
441
|
-
useSiteLocale,
|
|
442
|
-
onContentUpdated,
|
|
443
|
-
updateHeadSymbol,
|
|
444
|
-
useUpdateHead,
|
|
445
|
-
redirects,
|
|
446
|
-
routes,
|
|
447
|
-
resolveRoutePath,
|
|
448
|
-
resolveRoute,
|
|
449
|
-
resolveRouteFullPath,
|
|
450
|
-
useRoute,
|
|
451
|
-
useRouter,
|
|
452
|
-
RouteLink,
|
|
453
|
-
AutoLink,
|
|
454
|
-
ClientOnly,
|
|
455
|
-
Content,
|
|
456
|
-
resolvers,
|
|
457
|
-
defineClientConfig,
|
|
458
|
-
withBase
|
|
459
|
-
};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
COMPONENT_STATE_TYPE,
|
|
3
|
-
INSPECTOR_ID,
|
|
4
|
-
INSPECTOR_LABEL,
|
|
5
|
-
INSPECTOR_NODES,
|
|
6
|
-
INSPECTOR_STATE_SECTION_NAME,
|
|
7
|
-
PLUGIN_ID,
|
|
8
|
-
PLUGIN_LABEL
|
|
9
|
-
} from "./chunk-XZCIWC7J.js";
|
|
10
|
-
import "./chunk-MLKGABMK.js";
|
|
11
|
-
|
|
12
|
-
// src/devtools/setupDevtools.ts
|
|
13
|
-
import { setupDevtoolsPlugin } from "@vue/devtools-api";
|
|
14
|
-
import { watch } from "vue";
|
|
15
|
-
var setupDevtools = (app, clientData) => {
|
|
16
|
-
setupDevtoolsPlugin(
|
|
17
|
-
{
|
|
18
|
-
// fix recursive reference
|
|
19
|
-
app,
|
|
20
|
-
id: PLUGIN_ID,
|
|
21
|
-
label: PLUGIN_LABEL,
|
|
22
|
-
packageName: "@vuepress/client",
|
|
23
|
-
homepage: "https://vuepress.vuejs.org",
|
|
24
|
-
logo: "https://vuepress.vuejs.org/images/hero.png",
|
|
25
|
-
componentStateTypes: [COMPONENT_STATE_TYPE]
|
|
26
|
-
},
|
|
27
|
-
(api) => {
|
|
28
|
-
const clientDataEntries = Object.entries(clientData);
|
|
29
|
-
const clientDataKeys = Object.keys(clientData);
|
|
30
|
-
const clientDataValues = Object.values(clientData);
|
|
31
|
-
api.on.inspectComponent((payload) => {
|
|
32
|
-
payload.instanceData.state.push(
|
|
33
|
-
...clientDataEntries.map(([name, item]) => ({
|
|
34
|
-
type: COMPONENT_STATE_TYPE,
|
|
35
|
-
editable: false,
|
|
36
|
-
key: name,
|
|
37
|
-
value: item.value
|
|
38
|
-
}))
|
|
39
|
-
);
|
|
40
|
-
});
|
|
41
|
-
api.addInspector({
|
|
42
|
-
id: INSPECTOR_ID,
|
|
43
|
-
label: INSPECTOR_LABEL,
|
|
44
|
-
icon: "article"
|
|
45
|
-
});
|
|
46
|
-
api.on.getInspectorTree((payload) => {
|
|
47
|
-
if (payload.inspectorId !== INSPECTOR_ID) return;
|
|
48
|
-
payload.rootNodes = Object.values(INSPECTOR_NODES).map(
|
|
49
|
-
(node) => ({
|
|
50
|
-
id: node.id,
|
|
51
|
-
label: node.label,
|
|
52
|
-
children: node.keys.map((key) => ({
|
|
53
|
-
id: key,
|
|
54
|
-
label: key
|
|
55
|
-
}))
|
|
56
|
-
})
|
|
57
|
-
);
|
|
58
|
-
});
|
|
59
|
-
api.on.getInspectorState((payload) => {
|
|
60
|
-
if (payload.inspectorId !== INSPECTOR_ID) return;
|
|
61
|
-
const inspectorNode = INSPECTOR_NODES[payload.nodeId];
|
|
62
|
-
if (inspectorNode) {
|
|
63
|
-
payload.state = {
|
|
64
|
-
[inspectorNode.label]: inspectorNode.keys.map((key) => ({
|
|
65
|
-
key,
|
|
66
|
-
value: clientData[key].value
|
|
67
|
-
}))
|
|
68
|
-
};
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
if (clientDataKeys.includes(payload.nodeId)) {
|
|
72
|
-
payload.state = {
|
|
73
|
-
[INSPECTOR_STATE_SECTION_NAME]: [
|
|
74
|
-
{
|
|
75
|
-
key: payload.nodeId,
|
|
76
|
-
value: clientData[payload.nodeId].value
|
|
77
|
-
}
|
|
78
|
-
]
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
watch(clientDataValues, () => {
|
|
83
|
-
api.notifyComponentUpdate();
|
|
84
|
-
api.sendInspectorState(INSPECTOR_ID);
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
);
|
|
88
|
-
};
|
|
89
|
-
export {
|
|
90
|
-
setupDevtools
|
|
91
|
-
};
|