@vuepress/client 2.0.0-rc.19 → 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/dist/app.js +3 -2
- package/dist/chunk-MLKGABMK.js +9 -0
- package/dist/{chunk-LVRERRCW.js → chunk-TET3OVHF.js} +44 -5
- package/dist/chunk-XZCIWC7J.js +66 -0
- package/dist/index.d.ts +55 -6
- package/dist/index.js +8 -1
- package/dist/{setupDevtools-7MC2TMWH.js → setupDevtools-QXEOFQJV.js} +31 -27
- package/package.json +4 -3
package/dist/app.js
CHANGED
|
@@ -12,7 +12,8 @@ import {
|
|
|
12
12
|
usePageLang,
|
|
13
13
|
usePageLayout,
|
|
14
14
|
withBase
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-TET3OVHF.js";
|
|
16
|
+
import "./chunk-MLKGABMK.js";
|
|
16
17
|
|
|
17
18
|
// src/app.ts
|
|
18
19
|
import { clientConfigs } from "@internal/clientConfigs";
|
|
@@ -292,7 +293,7 @@ var createVueApp = async () => {
|
|
|
292
293
|
setupGlobalComponents(app);
|
|
293
294
|
const globalComputed = setupGlobalComputed(app, router, clientConfigs);
|
|
294
295
|
if (__VUEPRESS_DEV__ || __VUE_PROD_DEVTOOLS__) {
|
|
295
|
-
const { setupDevtools } = await import("./setupDevtools-
|
|
296
|
+
const { setupDevtools } = await import("./setupDevtools-QXEOFQJV.js");
|
|
296
297
|
setupDevtools(app, globalComputed);
|
|
297
298
|
}
|
|
298
299
|
for (const clientConfig of clientConfigs) {
|
|
@@ -26,6 +26,23 @@ var useRoutes = () => useClientData().routes;
|
|
|
26
26
|
var useSiteData = () => useClientData().siteData;
|
|
27
27
|
var useSiteLocaleData = () => useClientData().siteLocaleData;
|
|
28
28
|
|
|
29
|
+
// src/composables/onContentUpdated.ts
|
|
30
|
+
import { onUnmounted } from "vue";
|
|
31
|
+
|
|
32
|
+
// src/internal/contentUpdatedCallbacks.ts
|
|
33
|
+
import { shallowRef } from "vue";
|
|
34
|
+
var contentUpdatedCallbacks = shallowRef([]);
|
|
35
|
+
|
|
36
|
+
// src/composables/onContentUpdated.ts
|
|
37
|
+
var onContentUpdated = (fn) => {
|
|
38
|
+
contentUpdatedCallbacks.value.push(fn);
|
|
39
|
+
onUnmounted(() => {
|
|
40
|
+
contentUpdatedCallbacks.value = contentUpdatedCallbacks.value.filter(
|
|
41
|
+
(f) => f !== fn
|
|
42
|
+
);
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
29
46
|
// src/composables/updateHead.ts
|
|
30
47
|
import { inject as inject2 } from "vue";
|
|
31
48
|
var updateHeadSymbol = Symbol(
|
|
@@ -47,9 +64,9 @@ import {
|
|
|
47
64
|
redirects as redirectsRaw,
|
|
48
65
|
routes as routesRaw
|
|
49
66
|
} from "@internal/routes";
|
|
50
|
-
import { shallowRef } from "vue";
|
|
51
|
-
var redirects =
|
|
52
|
-
var routes =
|
|
67
|
+
import { shallowRef as shallowRef2 } from "vue";
|
|
68
|
+
var redirects = shallowRef2(redirectsRaw);
|
|
69
|
+
var routes = shallowRef2(routesRaw);
|
|
53
70
|
if (__VUEPRESS_DEV__ && (import.meta.webpackHot || import.meta.hot)) {
|
|
54
71
|
__VUE_HMR_RUNTIME__.updateRedirects = (data) => {
|
|
55
72
|
redirects.value = data;
|
|
@@ -262,7 +279,10 @@ var ClientOnly = defineComponent3({
|
|
|
262
279
|
});
|
|
263
280
|
|
|
264
281
|
// src/components/Content.ts
|
|
265
|
-
import { computed as computed3, defineAsyncComponent, defineComponent as defineComponent4, h as h3 } from "vue";
|
|
282
|
+
import { computed as computed3, defineAsyncComponent, defineComponent as defineComponent4, h as h3, watch } from "vue";
|
|
283
|
+
var runContentUpdatedCallbacks = (reason) => {
|
|
284
|
+
contentUpdatedCallbacks.value.forEach((fn) => fn(reason));
|
|
285
|
+
};
|
|
266
286
|
var Content = defineComponent4({
|
|
267
287
|
name: "Content",
|
|
268
288
|
props: {
|
|
@@ -281,7 +301,25 @@ var Content = defineComponent4({
|
|
|
281
301
|
async () => route.loader().then(({ comp }) => comp)
|
|
282
302
|
);
|
|
283
303
|
});
|
|
284
|
-
|
|
304
|
+
const frontmatter = usePageFrontmatter();
|
|
305
|
+
watch(
|
|
306
|
+
frontmatter,
|
|
307
|
+
() => {
|
|
308
|
+
runContentUpdatedCallbacks("updated");
|
|
309
|
+
},
|
|
310
|
+
{ deep: true, flush: "post" }
|
|
311
|
+
);
|
|
312
|
+
return () => h3(ContentComponent.value, {
|
|
313
|
+
onVnodeMounted: () => {
|
|
314
|
+
runContentUpdatedCallbacks("mounted");
|
|
315
|
+
},
|
|
316
|
+
onVnodeUpdated: () => {
|
|
317
|
+
runContentUpdatedCallbacks("updated");
|
|
318
|
+
},
|
|
319
|
+
onVnodeBeforeUnmount: () => {
|
|
320
|
+
runContentUpdatedCallbacks("beforeUnmount");
|
|
321
|
+
}
|
|
322
|
+
});
|
|
285
323
|
}
|
|
286
324
|
});
|
|
287
325
|
|
|
@@ -390,6 +428,7 @@ export {
|
|
|
390
428
|
useRoutes,
|
|
391
429
|
useSiteData,
|
|
392
430
|
useSiteLocaleData,
|
|
431
|
+
onContentUpdated,
|
|
393
432
|
updateHeadSymbol,
|
|
394
433
|
useUpdateHead,
|
|
395
434
|
redirects,
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__export
|
|
3
|
+
} from "./chunk-MLKGABMK.js";
|
|
4
|
+
|
|
5
|
+
// src/devtools/constants.ts
|
|
6
|
+
var constants_exports = {};
|
|
7
|
+
__export(constants_exports, {
|
|
8
|
+
COMPONENT_STATE_TYPE: () => COMPONENT_STATE_TYPE,
|
|
9
|
+
INSPECTOR_ID: () => INSPECTOR_ID,
|
|
10
|
+
INSPECTOR_LABEL: () => INSPECTOR_LABEL,
|
|
11
|
+
INSPECTOR_NODES: () => INSPECTOR_NODES,
|
|
12
|
+
INSPECTOR_STATE_SECTION_NAME: () => INSPECTOR_STATE_SECTION_NAME,
|
|
13
|
+
PLUGIN_ID: () => PLUGIN_ID,
|
|
14
|
+
PLUGIN_LABEL: () => PLUGIN_LABEL
|
|
15
|
+
});
|
|
16
|
+
var PLUGIN_ID = "org.vuejs.vuepress";
|
|
17
|
+
var PLUGIN_LABEL = "VuePress";
|
|
18
|
+
var COMPONENT_STATE_TYPE = PLUGIN_LABEL;
|
|
19
|
+
var INSPECTOR_ID = PLUGIN_ID;
|
|
20
|
+
var INSPECTOR_LABEL = PLUGIN_LABEL;
|
|
21
|
+
var INSPECTOR_NODE_INTERNAL = {
|
|
22
|
+
id: "INTERNAL",
|
|
23
|
+
label: "Internal",
|
|
24
|
+
keys: ["layouts", "routes", "redirects"]
|
|
25
|
+
};
|
|
26
|
+
var INSPECTOR_NODE_SITE = {
|
|
27
|
+
id: "SITE",
|
|
28
|
+
label: "Site",
|
|
29
|
+
keys: ["siteData", "siteLocaleData"]
|
|
30
|
+
};
|
|
31
|
+
var INSPECTOR_NODE_ROUTE = {
|
|
32
|
+
id: "ROUTE",
|
|
33
|
+
label: "Route",
|
|
34
|
+
keys: ["routePath", "routeLocale"]
|
|
35
|
+
};
|
|
36
|
+
var INSPECTOR_NODE_PAGE = {
|
|
37
|
+
id: "PAGE",
|
|
38
|
+
label: "Page",
|
|
39
|
+
keys: [
|
|
40
|
+
"pageData",
|
|
41
|
+
"pageFrontmatter",
|
|
42
|
+
"pageLang",
|
|
43
|
+
"pageHead",
|
|
44
|
+
"pageHeadTitle",
|
|
45
|
+
"pageLayout",
|
|
46
|
+
"pageComponent"
|
|
47
|
+
]
|
|
48
|
+
};
|
|
49
|
+
var INSPECTOR_NODES = {
|
|
50
|
+
[INSPECTOR_NODE_INTERNAL.id]: INSPECTOR_NODE_INTERNAL,
|
|
51
|
+
[INSPECTOR_NODE_SITE.id]: INSPECTOR_NODE_SITE,
|
|
52
|
+
[INSPECTOR_NODE_ROUTE.id]: INSPECTOR_NODE_ROUTE,
|
|
53
|
+
[INSPECTOR_NODE_PAGE.id]: INSPECTOR_NODE_PAGE
|
|
54
|
+
};
|
|
55
|
+
var INSPECTOR_STATE_SECTION_NAME = "State";
|
|
56
|
+
|
|
57
|
+
export {
|
|
58
|
+
PLUGIN_ID,
|
|
59
|
+
PLUGIN_LABEL,
|
|
60
|
+
COMPONENT_STATE_TYPE,
|
|
61
|
+
INSPECTOR_ID,
|
|
62
|
+
INSPECTOR_LABEL,
|
|
63
|
+
INSPECTOR_NODES,
|
|
64
|
+
INSPECTOR_STATE_SECTION_NAME,
|
|
65
|
+
constants_exports
|
|
66
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { Component, ComputedRef, Ref, App, PropType, VNode, SlotsType, InjectionKey } from 'vue';
|
|
3
|
-
import { PageData,
|
|
3
|
+
import { PageData, PageFrontmatter, HeadConfig, SiteData, SiteLocaleData } from '@vuepress/shared';
|
|
4
4
|
export { HeadConfig, PageData, PageFrontmatter, PageHeader, SiteData, SiteLocaleData } from '@vuepress/shared';
|
|
5
5
|
import { Router } from 'vue-router';
|
|
6
6
|
export { RouteLocationNormalizedLoaded, Router, useRoute, useRouter } from 'vue-router';
|
|
@@ -53,11 +53,11 @@ type RouteLocaleRef = ComputedRef<RouteLocale>;
|
|
|
53
53
|
type RoutesRef = Ref<Routes>;
|
|
54
54
|
type SiteDataRef = Ref<SiteData>;
|
|
55
55
|
type SiteLocaleDataRef = ComputedRef<SiteLocaleData>;
|
|
56
|
-
interface ClientData {
|
|
56
|
+
interface ClientData<Frontmatter extends Record<string, unknown> = Record<string, unknown>, Data extends Record<string, unknown> = Record<string, unknown>> {
|
|
57
57
|
layouts: LayoutsRef;
|
|
58
58
|
pageComponent: PageComponentRef;
|
|
59
|
-
pageData: PageDataRef
|
|
60
|
-
pageFrontmatter: PageFrontmatterRef
|
|
59
|
+
pageData: PageDataRef<Data>;
|
|
60
|
+
pageFrontmatter: PageFrontmatterRef<Frontmatter>;
|
|
61
61
|
pageHead: PageHeadRef;
|
|
62
62
|
pageHeadTitle: PageHeadTitleRef;
|
|
63
63
|
pageLang: PageLangRef;
|
|
@@ -97,6 +97,9 @@ interface ClientConfig {
|
|
|
97
97
|
rootComponents?: Component[];
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
type ContentUpdatedReason = 'beforeUnmount' | 'mounted' | 'updated';
|
|
101
|
+
type ContentUpdatedCallback = (reason: ContentUpdatedReason) => unknown;
|
|
102
|
+
|
|
100
103
|
interface AutoLinkConfig {
|
|
101
104
|
/**
|
|
102
105
|
* Pattern to determine if the link should be active, which has higher priority than `exact`
|
|
@@ -268,7 +271,7 @@ declare const clientDataSymbol: InjectionKey<ClientData>;
|
|
|
268
271
|
/**
|
|
269
272
|
* Returns client data
|
|
270
273
|
*/
|
|
271
|
-
declare const useClientData: () => ClientData
|
|
274
|
+
declare const useClientData: <Frontmatter extends Record<string, unknown> = Record<string, unknown>, Data extends Record<string, unknown> = Record<string, unknown>>() => ClientData<Frontmatter, Data>;
|
|
272
275
|
|
|
273
276
|
declare const useLayouts: () => LayoutsRef;
|
|
274
277
|
declare const usePageComponent: () => PageComponentRef;
|
|
@@ -284,6 +287,12 @@ declare const useRoutes: () => RoutesRef;
|
|
|
284
287
|
declare const useSiteData: () => SiteDataRef;
|
|
285
288
|
declare const useSiteLocaleData: () => SiteLocaleDataRef;
|
|
286
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
|
+
|
|
287
296
|
/**
|
|
288
297
|
* A util function to force update `<head>` of current page
|
|
289
298
|
*/
|
|
@@ -297,6 +306,46 @@ declare const updateHeadSymbol: InjectionKey<UpdateHead>;
|
|
|
297
306
|
*/
|
|
298
307
|
declare const useUpdateHead: () => UpdateHead;
|
|
299
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
|
+
|
|
300
349
|
interface ResolvedRoute<T extends RouteMeta = RouteMeta> extends Route<T> {
|
|
301
350
|
path: string;
|
|
302
351
|
notFound: boolean;
|
|
@@ -343,4 +392,4 @@ declare const defineClientConfig: (clientConfig?: ClientConfig) => ClientConfig;
|
|
|
343
392
|
*/
|
|
344
393
|
declare const withBase: (url: string) => string;
|
|
345
394
|
|
|
346
|
-
export { AutoLink, type AutoLinkConfig, 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, resolveRouteFullPath, resolveRoutePath, resolvers, updateHeadSymbol, useClientData, useLayouts, usePageComponent, usePageData, usePageFrontmatter, usePageHead, usePageLang, usePageLayout, useRedirects, useRouteLocale, useRoutePath, useRoutes, useSiteData, useSiteLocaleData, useUpdateHead, withBase };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
RouteLink,
|
|
6
6
|
clientDataSymbol,
|
|
7
7
|
defineClientConfig,
|
|
8
|
+
onContentUpdated,
|
|
8
9
|
resolveRoute,
|
|
9
10
|
resolveRouteFullPath,
|
|
10
11
|
resolveRoutePath,
|
|
@@ -28,14 +29,20 @@ import {
|
|
|
28
29
|
useSiteLocaleData,
|
|
29
30
|
useUpdateHead,
|
|
30
31
|
withBase
|
|
31
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-TET3OVHF.js";
|
|
33
|
+
import {
|
|
34
|
+
constants_exports
|
|
35
|
+
} from "./chunk-XZCIWC7J.js";
|
|
36
|
+
import "./chunk-MLKGABMK.js";
|
|
32
37
|
export {
|
|
33
38
|
AutoLink,
|
|
34
39
|
ClientOnly,
|
|
35
40
|
Content,
|
|
41
|
+
constants_exports as DEVTOOLS,
|
|
36
42
|
RouteLink,
|
|
37
43
|
clientDataSymbol,
|
|
38
44
|
defineClientConfig,
|
|
45
|
+
onContentUpdated,
|
|
39
46
|
resolveRoute,
|
|
40
47
|
resolveRouteFullPath,
|
|
41
48
|
resolveRoutePath,
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
|
|
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
|
|
2
13
|
import { setupDevtoolsPlugin } from "@vue/devtools-api";
|
|
3
14
|
import { watch } from "vue";
|
|
4
|
-
var PLUGIN_ID = "org.vuejs.vuepress";
|
|
5
|
-
var PLUGIN_LABEL = "VuePress";
|
|
6
|
-
var PLUGIN_COMPONENT_STATE_TYPE = PLUGIN_LABEL;
|
|
7
|
-
var INSPECTOR_ID = PLUGIN_ID;
|
|
8
|
-
var INSPECTOR_LABEL = PLUGIN_LABEL;
|
|
9
|
-
var INSPECTOR_CLIENT_DATA_ID = "client-data";
|
|
10
|
-
var INSPECTOR_CLIENT_DATA_LABEL = "Client Data";
|
|
11
15
|
var setupDevtools = (app, clientData) => {
|
|
12
16
|
setupDevtoolsPlugin(
|
|
13
17
|
{
|
|
@@ -18,7 +22,7 @@ var setupDevtools = (app, clientData) => {
|
|
|
18
22
|
packageName: "@vuepress/client",
|
|
19
23
|
homepage: "https://vuepress.vuejs.org",
|
|
20
24
|
logo: "https://vuepress.vuejs.org/images/hero.png",
|
|
21
|
-
componentStateTypes: [
|
|
25
|
+
componentStateTypes: [COMPONENT_STATE_TYPE]
|
|
22
26
|
},
|
|
23
27
|
(api) => {
|
|
24
28
|
const clientDataEntries = Object.entries(clientData);
|
|
@@ -27,7 +31,7 @@ var setupDevtools = (app, clientData) => {
|
|
|
27
31
|
api.on.inspectComponent((payload) => {
|
|
28
32
|
payload.instanceData.state.push(
|
|
29
33
|
...clientDataEntries.map(([name, item]) => ({
|
|
30
|
-
type:
|
|
34
|
+
type: COMPONENT_STATE_TYPE,
|
|
31
35
|
editable: false,
|
|
32
36
|
key: name,
|
|
33
37
|
value: item.value
|
|
@@ -41,32 +45,32 @@ var setupDevtools = (app, clientData) => {
|
|
|
41
45
|
});
|
|
42
46
|
api.on.getInspectorTree((payload) => {
|
|
43
47
|
if (payload.inspectorId !== INSPECTOR_ID) return;
|
|
44
|
-
payload.rootNodes =
|
|
45
|
-
{
|
|
46
|
-
id:
|
|
47
|
-
label:
|
|
48
|
-
children:
|
|
49
|
-
id:
|
|
50
|
-
label:
|
|
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
|
|
51
55
|
}))
|
|
52
|
-
}
|
|
53
|
-
|
|
56
|
+
})
|
|
57
|
+
);
|
|
54
58
|
});
|
|
55
59
|
api.on.getInspectorState((payload) => {
|
|
56
60
|
if (payload.inspectorId !== INSPECTOR_ID) return;
|
|
57
|
-
|
|
61
|
+
const inspectorNode = INSPECTOR_NODES[payload.nodeId];
|
|
62
|
+
if (inspectorNode) {
|
|
58
63
|
payload.state = {
|
|
59
|
-
[
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
})
|
|
64
|
-
)
|
|
64
|
+
[inspectorNode.label]: inspectorNode.keys.map((key) => ({
|
|
65
|
+
key,
|
|
66
|
+
value: clientData[key].value
|
|
67
|
+
}))
|
|
65
68
|
};
|
|
69
|
+
return;
|
|
66
70
|
}
|
|
67
71
|
if (clientDataKeys.includes(payload.nodeId)) {
|
|
68
72
|
payload.state = {
|
|
69
|
-
[
|
|
73
|
+
[INSPECTOR_STATE_SECTION_NAME]: [
|
|
70
74
|
{
|
|
71
75
|
key: payload.nodeId,
|
|
72
76
|
value: clientData[payload.nodeId].value
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/client",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.20",
|
|
4
4
|
"description": "Client package of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress",
|
|
@@ -33,10 +33,11 @@
|
|
|
33
33
|
"types.d.ts"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@vue/devtools-api": "^7.
|
|
36
|
+
"@vue/devtools-api": "^7.7.2",
|
|
37
|
+
"@vue/devtools-kit": "^7.7.2",
|
|
37
38
|
"vue": "^3.5.13",
|
|
38
39
|
"vue-router": "^4.5.0",
|
|
39
|
-
"@vuepress/shared": "2.0.0-rc.
|
|
40
|
+
"@vuepress/shared": "2.0.0-rc.20"
|
|
40
41
|
},
|
|
41
42
|
"publishConfig": {
|
|
42
43
|
"access": "public"
|