@vuepress/client 2.0.0-rc.4 → 2.0.0-rc.5
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 +11 -25
- package/dist/{chunk-6BD5VZ74.js → chunk-VSQZBVKH.js} +11 -5
- package/dist/index.d.ts +31 -4
- package/dist/index.js +3 -3
- package/package.json +2 -2
package/dist/app.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ClientOnly,
|
|
3
3
|
Content,
|
|
4
|
-
|
|
4
|
+
RouteLink,
|
|
5
5
|
layoutsSymbol,
|
|
6
6
|
pageDataSymbol,
|
|
7
7
|
pageFrontmatterSymbol,
|
|
@@ -20,12 +20,11 @@ import {
|
|
|
20
20
|
usePageLang,
|
|
21
21
|
usePageLayout,
|
|
22
22
|
withBase
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-VSQZBVKH.js";
|
|
24
24
|
|
|
25
25
|
// src/app.ts
|
|
26
26
|
import { clientConfigs } from "@internal/clientConfigs";
|
|
27
|
-
import { createApp, createSSRApp, h
|
|
28
|
-
import { RouterView } from "vue-router";
|
|
27
|
+
import { createApp, createSSRApp, h } from "vue";
|
|
29
28
|
|
|
30
29
|
// src/createVueRouter.ts
|
|
31
30
|
import { removeEndingSlash } from "@vuepress/shared";
|
|
@@ -35,18 +34,6 @@ import {
|
|
|
35
34
|
createWebHistory,
|
|
36
35
|
START_LOCATION
|
|
37
36
|
} from "vue-router";
|
|
38
|
-
|
|
39
|
-
// src/components/Vuepress.ts
|
|
40
|
-
import { defineComponent, h } from "vue";
|
|
41
|
-
var Vuepress = defineComponent({
|
|
42
|
-
name: "Vuepress",
|
|
43
|
-
setup() {
|
|
44
|
-
const layout = usePageLayout();
|
|
45
|
-
return () => h(layout.value);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
// src/createVueRouter.ts
|
|
50
37
|
var historyCreator = __VUEPRESS_SSR__ ? createMemoryHistory : createWebHistory;
|
|
51
38
|
var createVueRouter = () => {
|
|
52
39
|
const router = createRouter({
|
|
@@ -56,7 +43,7 @@ var createVueRouter = () => {
|
|
|
56
43
|
{
|
|
57
44
|
name: "vuepress-route",
|
|
58
45
|
path: "/:catchAll(.*)",
|
|
59
|
-
|
|
46
|
+
components: {}
|
|
60
47
|
}
|
|
61
48
|
],
|
|
62
49
|
scrollBehavior: (to, _from, savedPosition) => {
|
|
@@ -89,7 +76,7 @@ var createVueRouter = () => {
|
|
|
89
76
|
var setupGlobalComponents = (app) => {
|
|
90
77
|
app.component("ClientOnly", ClientOnly);
|
|
91
78
|
app.component("Content", Content);
|
|
92
|
-
app.component("
|
|
79
|
+
app.component("RouteLink", RouteLink);
|
|
93
80
|
};
|
|
94
81
|
|
|
95
82
|
// src/setupGlobalComputed.ts
|
|
@@ -284,18 +271,17 @@ var createHeadElement = ([
|
|
|
284
271
|
var appCreator = __VUEPRESS_DEV__ ? createApp : createSSRApp;
|
|
285
272
|
var createVueApp = async () => {
|
|
286
273
|
const app = appCreator({
|
|
287
|
-
name: "
|
|
274
|
+
name: "Vuepress",
|
|
288
275
|
setup() {
|
|
289
276
|
setupUpdateHead();
|
|
290
277
|
for (const clientConfig of clientConfigs) {
|
|
291
278
|
clientConfig.setup?.();
|
|
292
279
|
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
];
|
|
280
|
+
const rootComponents = clientConfigs.flatMap(
|
|
281
|
+
({ rootComponents: rootComponents2 = [] }) => rootComponents2.map((component) => h(component))
|
|
282
|
+
);
|
|
283
|
+
const layout = usePageLayout();
|
|
284
|
+
return () => [h(layout.value), rootComponents];
|
|
299
285
|
}
|
|
300
286
|
});
|
|
301
287
|
const router = createVueRouter();
|
|
@@ -232,7 +232,7 @@ var withBase = (url) => {
|
|
|
232
232
|
return `${__VUEPRESS_BASE__}${removeLeadingSlash(url)}`;
|
|
233
233
|
};
|
|
234
234
|
|
|
235
|
-
// src/components/
|
|
235
|
+
// src/components/RouteLink.ts
|
|
236
236
|
import { h as h2 } from "vue";
|
|
237
237
|
import { useRouter } from "vue-router";
|
|
238
238
|
var guardEvent = (event) => {
|
|
@@ -250,13 +250,14 @@ var guardEvent = (event) => {
|
|
|
250
250
|
event.preventDefault();
|
|
251
251
|
return true;
|
|
252
252
|
};
|
|
253
|
-
var
|
|
253
|
+
var RouteLink = ({ active = false, activeClass = "route-link-active", to, ...attrs }, { slots }) => {
|
|
254
254
|
const router = useRouter();
|
|
255
255
|
const path = withBase(resolveRoutePath(to));
|
|
256
256
|
return h2(
|
|
257
257
|
"a",
|
|
258
258
|
{
|
|
259
|
-
|
|
259
|
+
...attrs,
|
|
260
|
+
class: ["route-link", { [activeClass]: active }],
|
|
260
261
|
href: path,
|
|
261
262
|
onClick: (event = {}) => {
|
|
262
263
|
guardEvent(event) ? router.push(to).catch() : Promise.resolve();
|
|
@@ -265,7 +266,12 @@ var VPLink = ({ to = "" }, { slots }) => {
|
|
|
265
266
|
slots.default?.()
|
|
266
267
|
);
|
|
267
268
|
};
|
|
268
|
-
|
|
269
|
+
RouteLink.displayName = "RouteLink";
|
|
270
|
+
RouteLink.props = {
|
|
271
|
+
active: Boolean,
|
|
272
|
+
activeClass: String,
|
|
273
|
+
to: String
|
|
274
|
+
};
|
|
269
275
|
|
|
270
276
|
// src/resolvers.ts
|
|
271
277
|
import { dedupeHead, isString, resolveLocalePath } from "@vuepress/shared";
|
|
@@ -389,6 +395,6 @@ export {
|
|
|
389
395
|
Content,
|
|
390
396
|
defineClientConfig,
|
|
391
397
|
withBase,
|
|
392
|
-
|
|
398
|
+
RouteLink,
|
|
393
399
|
resolvers
|
|
394
400
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PageData, PageFrontmatter, HeadConfig, SiteData } from '@vuepress/shared';
|
|
2
2
|
export { PageData, PageFrontmatter, PageHeader, SiteData } from '@vuepress/shared';
|
|
3
3
|
import * as vue from 'vue';
|
|
4
|
-
import { ComputedRef, InjectionKey, Ref, Component, App, ComponentOptions, FunctionalComponent, VNode } from 'vue';
|
|
4
|
+
import { ComputedRef, InjectionKey, Ref, Component, App, ComponentOptions, HTMLAttributes, FunctionalComponent, VNode } from 'vue';
|
|
5
5
|
import { Router } from 'vue-router';
|
|
6
6
|
export { C as CreateVueAppFunction } from './createVueAppFunction-YNGNKfE3.js';
|
|
7
7
|
|
|
@@ -241,6 +241,9 @@ interface Route<T extends RouteMeta = RouteMeta> {
|
|
|
241
241
|
type Redirects = Record<string, string>;
|
|
242
242
|
type Routes = Record<string, Route>;
|
|
243
243
|
|
|
244
|
+
/**
|
|
245
|
+
* Wrapper component that only renders its content on the client side and skips server side rendering
|
|
246
|
+
*/
|
|
244
247
|
declare const ClientOnly: vue.DefineComponent<{}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
245
248
|
[key: string]: any;
|
|
246
249
|
}>[] | null | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
@@ -266,10 +269,34 @@ declare const Content: vue.DefineComponent<{
|
|
|
266
269
|
path: string;
|
|
267
270
|
}, {}>;
|
|
268
271
|
|
|
269
|
-
interface
|
|
272
|
+
interface RouteLinkProps extends HTMLAttributes {
|
|
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
|
+
*/
|
|
270
290
|
to: string;
|
|
271
291
|
}
|
|
272
|
-
|
|
292
|
+
/**
|
|
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.
|
|
298
|
+
*/
|
|
299
|
+
declare const RouteLink: FunctionalComponent<RouteLinkProps, Record<never, never>, {
|
|
273
300
|
default: () => string | VNode | (string | VNode)[];
|
|
274
301
|
}>;
|
|
275
302
|
|
|
@@ -301,4 +328,4 @@ declare const resolvers: {
|
|
|
301
328
|
resolveSiteLocaleData: (site: SiteData, routeLocale: RouteLocale) => SiteLocaleData;
|
|
302
329
|
};
|
|
303
330
|
|
|
304
|
-
export { type ClientConfig, ClientOnly, Content, type Layouts, type LayoutsRef, type PageChunk, type PageDataRef, type PageFrontmatterRef, type PageHead, type PageHeadRef, type PageHeadTitle, type PageHeadTitleRef, type PageLang, type PageLangRef, type PageLayoutRef, type Redirects, type Route, type RouteLocale, type RouteLocaleRef, type RouteMeta, type Routes, type SiteDataRef, type SiteLocaleData, type SiteLocaleDataRef, type UpdateHead,
|
|
331
|
+
export { type ClientConfig, ClientOnly, Content, type Layouts, type LayoutsRef, type PageChunk, type PageDataRef, type PageFrontmatterRef, type PageHead, type PageHeadRef, type PageHeadTitle, type PageHeadTitleRef, type PageLang, type PageLangRef, type PageLayoutRef, type Redirects, type Route, RouteLink, type RouteLinkProps, type RouteLocale, type RouteLocaleRef, type RouteMeta, type Routes, type SiteDataRef, type SiteLocaleData, type SiteLocaleDataRef, type UpdateHead, defineClientConfig, layoutsSymbol, pageDataSymbol, pageFrontmatterSymbol, pageHeadSymbol, pageHeadTitleSymbol, pageLangSymbol, pageLayoutSymbol, redirects, resolveRoute, resolveRoutePath, resolvers, routeLocaleSymbol, routes, siteData, siteLocaleDataSymbol, updateHeadSymbol, useLayouts, usePageData, usePageFrontmatter, usePageHead, usePageHeadTitle, usePageLang, usePageLayout, useRedirects, useRouteLocale, useRoutes, useSiteData, useSiteLocaleData, useUpdateHead, withBase };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ClientOnly,
|
|
3
3
|
Content,
|
|
4
|
-
|
|
4
|
+
RouteLink,
|
|
5
5
|
defineClientConfig,
|
|
6
6
|
layoutsSymbol,
|
|
7
7
|
pageDataSymbol,
|
|
@@ -33,11 +33,11 @@ import {
|
|
|
33
33
|
useSiteLocaleData,
|
|
34
34
|
useUpdateHead,
|
|
35
35
|
withBase
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-VSQZBVKH.js";
|
|
37
37
|
export {
|
|
38
38
|
ClientOnly,
|
|
39
39
|
Content,
|
|
40
|
-
|
|
40
|
+
RouteLink,
|
|
41
41
|
defineClientConfig,
|
|
42
42
|
layoutsSymbol,
|
|
43
43
|
pageDataSymbol,
|
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.5",
|
|
4
4
|
"description": "Client package of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@vueuse/core": "^10.7.2",
|
|
38
38
|
"vue": "^3.4.15",
|
|
39
39
|
"vue-router": "^4.2.5",
|
|
40
|
-
"@vuepress/shared": "2.0.0-rc.
|
|
40
|
+
"@vuepress/shared": "2.0.0-rc.5"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|