vitepress 1.0.0-draft.5 → 1.0.0-draft.6

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.
@@ -17,7 +17,7 @@ defineProps<{
17
17
  <style scoped>
18
18
  .VPBox {
19
19
  border: 1px solid var(--vp-c-divider-light);
20
- border-radius: 8px;
20
+ border-radius: 12px;
21
21
  padding: 24px;
22
22
  height: 100%;
23
23
  background-color: var(--vp-c-bg-soft);
@@ -42,7 +42,6 @@ const component = computed(() => {
42
42
  .VPButton {
43
43
  display: inline-block;
44
44
  border: 1px solid transparent;
45
-
46
45
  text-align: center;
47
46
  font-weight: 500;
48
47
  white-space: nowrap;
@@ -7,30 +7,45 @@ export interface HeroAction {
7
7
  link: string
8
8
  }
9
9
 
10
+ export interface Image {
11
+ light: string
12
+ dark: string
13
+ }
14
+
10
15
  defineProps<{
11
16
  name?: string
12
17
  text: string
13
18
  tagline?: string
19
+ image?: Image
14
20
  actions?: HeroAction[]
15
21
  }>()
16
22
  </script>
17
23
 
18
24
  <template>
19
- <div class="VPHero">
25
+ <div class="VPHero" :class="{ 'has-image': image }">
20
26
  <div class="container">
21
- <p v-if="name" class="name"><span class="clip">{{ name }}</span></p>
22
- <h1 v-if="text" class="text">{{ text }}</h1>
23
- <p v-if="tagline" class="tagline">{{ tagline }}</p>
24
-
25
- <div v-if="actions" class="actions">
26
- <div v-for="action in actions" :key="action.link" class="action">
27
- <VPButton
28
- tag="a"
29
- size="big"
30
- :theme="action.theme"
31
- :text="action.text"
32
- :href="action.link"
33
- />
27
+ <div class="main">
28
+ <p v-if="name" class="name"><span class="clip">{{ name }}</span></p>
29
+ <h1 v-if="text" class="text">{{ text }}</h1>
30
+ <p v-if="tagline" class="tagline">{{ tagline }}</p>
31
+
32
+ <div v-if="actions" class="actions">
33
+ <div v-for="action in actions" :key="action.link" class="action">
34
+ <VPButton
35
+ tag="a"
36
+ size="medium"
37
+ :theme="action.theme"
38
+ :text="action.text"
39
+ :href="action.link"
40
+ />
41
+ </div>
42
+ </div>
43
+ </div>
44
+
45
+ <div v-if="image" class="image">
46
+ <div class="image-container">
47
+ <img class="image-src light" :src="image.light">
48
+ <img class="image-src dark" :src="image.dark">
34
49
  </div>
35
50
  </div>
36
51
  </div>
@@ -41,6 +56,7 @@ defineProps<{
41
56
  .VPHero {
42
57
  margin-top: calc(var(--vp-nav-height) * -1);
43
58
  padding: calc(var(--vp-nav-height) + 48px) 24px 48px;
59
+ overflow: hidden;
44
60
  }
45
61
 
46
62
  @media (min-width: 640px) {
@@ -50,66 +66,113 @@ defineProps<{
50
66
  }
51
67
 
52
68
  .container {
69
+ display: flex;
70
+ flex-direction: column;
53
71
  margin: 0 auto;
54
72
  max-width: 960px;
55
73
  }
56
74
 
75
+ @media (min-width: 960px) {
76
+ .container {
77
+ flex-direction: row;
78
+ }
79
+ }
80
+
81
+ .main {
82
+ position: relative;
83
+ z-index: 10;
84
+ order: 2;
85
+ flex-grow: 1;
86
+ flex-shrink: 0;
87
+ }
88
+
89
+ .VPHero.has-image .container {
90
+ text-align: center;
91
+ }
92
+
93
+ @media (min-width: 960px) {
94
+ .VPHero.has-image .container {
95
+ text-align: left;
96
+ }
97
+ }
98
+
99
+ @media (min-width: 960px) {
100
+ .main {
101
+ order: 1;
102
+ }
103
+ }
104
+
105
+ @media (min-width: 960px) {
106
+ .main {
107
+ width: 100%;
108
+ max-width: calc((100% / 3) * 2);
109
+ }
110
+ }
111
+
57
112
  .name,
58
113
  .text {
59
- line-height: 48px;
60
- font-size: 40px;
114
+ max-width: 392px;
115
+ letter-spacing: -0.4px;
116
+ line-height: 40px;
117
+ font-size: 32px;
61
118
  font-weight: 700;
62
119
  }
63
120
 
121
+ .VPHero.has-image .name,
122
+ .VPHero.has-image .text {
123
+ margin: 0 auto;
124
+ }
125
+
64
126
  .name {
65
- padding-bottom: 4px;
66
127
  color: var(--vp-home-hero-name-color);
67
128
  }
68
129
 
69
130
  .clip {
70
131
  background: var(--vp-home-hero-name-background);
71
- -webkit-text-fill-color: var(--vp-home-hero-name-color);
72
132
  -webkit-background-clip: text;
133
+ background-clip: text;
134
+ -webkit-text-fill-color: var(--vp-home-hero-name-color);
73
135
  }
74
136
 
75
137
  @media (min-width: 640px) {
76
138
  .name,
77
139
  .text {
78
- max-width: 640px;
140
+ max-width: 576px;
79
141
  line-height: 56px;
80
142
  font-size: 48px;
81
143
  }
82
-
83
- .name {
84
- padding-bottom: 6px;
85
- }
86
144
  }
87
145
 
88
146
  @media (min-width: 960px) {
89
147
  .name,
90
148
  .text {
91
- max-width: 720px;
92
149
  line-height: 64px;
93
150
  font-size: 56px;
94
151
  }
95
152
 
96
- .name {
97
- padding-bottom: 6px;
153
+ .VPHero.has-image .name,
154
+ .VPHero.has-image .text {
155
+ margin: 0;
98
156
  }
99
157
  }
100
158
 
101
159
  .tagline {
102
160
  padding-top: 16px;
161
+ max-width: 392px;
103
162
  line-height: 28px;
104
163
  font-size: 18px;
105
164
  font-weight: 500;
106
165
  color: var(--vp-c-text-2);
107
166
  }
108
167
 
168
+ .VPHero.has-image .tagline {
169
+ margin: 0 auto;
170
+ }
171
+
109
172
  @media (min-width: 640px) {
110
173
  .tagline {
111
174
  padding-top: 24px;
112
- max-width: 540px;
175
+ max-width: 576px;
113
176
  line-height: 32px;
114
177
  font-size: 20px;
115
178
  }
@@ -118,27 +181,105 @@ defineProps<{
118
181
  @media (min-width: 960px) {
119
182
  .tagline {
120
183
  padding-top: 24px;
121
- max-width: 640px;
122
184
  line-height: 36px;
123
185
  font-size: 24px;
124
186
  }
187
+
188
+ .VPHero.has-image .tagline {
189
+ margin: 0;
190
+ }
125
191
  }
126
192
 
127
193
  .actions {
128
194
  display: flex;
129
195
  flex-wrap: wrap;
130
- margin: -8px;
196
+ margin: -6px;
131
197
  padding-top: 24px;
132
198
  }
133
199
 
200
+ .VPHero.has-image .actions {
201
+ justify-content: center;
202
+ }
203
+
134
204
  @media (min-width: 640px) {
135
205
  .actions {
136
206
  padding-top: 32px;
137
207
  }
138
208
  }
139
209
 
210
+ @media (min-width: 960px) {
211
+ .VPHero.has-image .actions {
212
+ justify-content: flex-start;
213
+ }
214
+ }
215
+
140
216
  .action {
141
217
  flex-shrink: 0;
142
- padding: 8px;
218
+ padding: 6px;
219
+ }
220
+
221
+ .image {
222
+ order: 1;
223
+ margin: -76px -24px -48px;
224
+ }
225
+
226
+ @media (min-width: 640px) {
227
+ .image {
228
+ margin: -108px -24px -48px;
229
+ }
230
+ }
231
+
232
+ .image-container {
233
+ position: relative;
234
+ margin: 0 auto;
235
+ width: 320px;
236
+ height: 320px;
237
+ }
238
+
239
+ @media (min-width: 640px) {
240
+ .image-container {
241
+ width: 392px;
242
+ height: 392px;
243
+ }
244
+ }
245
+
246
+ .image-src {
247
+ position: absolute;
248
+ top: 50%;
249
+ left: 50%;
250
+ max-width: 392px;
251
+ transform: translate(-50%, -50%);
252
+ }
253
+
254
+ .image-src.light { opacity: 1; }
255
+ .image-src.dark { opacity: 0; }
256
+
257
+ .dark .image-src.light { opacity: 0; }
258
+ .dark .image-src.dark { opacity: 1; }
259
+
260
+ @media (min-width: 640px) {
261
+ .image-src {
262
+ max-width: 512px;
263
+ transform: translate(-50%, -50%);
264
+ }
265
+ }
266
+
267
+ @media (min-width: 960px) {
268
+ .image {
269
+ order: 2;
270
+ margin: -8px 0;
271
+ width: calc(100% / 3);
272
+ min-height: 100%;
273
+ }
274
+
275
+ .image-container {
276
+ width: 100%;
277
+ height: 100%;
278
+ }
279
+
280
+ .image-src {
281
+ max-width: 640px;
282
+ transform: translate(calc(-50% - 32px), calc(-50% - 32px));
283
+ }
143
284
  }
144
285
  </style>
@@ -42,6 +42,7 @@ const grid = computed(() => {
42
42
 
43
43
  <style scoped>
44
44
  .VPHomeFeatures {
45
+ position: relative;
45
46
  padding: 0 24px;
46
47
  }
47
48
 
@@ -11,6 +11,7 @@ const { frontmatter: fm } = useData()
11
11
  :name="fm.hero.name"
12
12
  :text="fm.hero.text"
13
13
  :tagline="fm.hero.tagline"
14
+ :image="fm.hero.image"
14
15
  :actions="fm.hero.actions"
15
16
  />
16
17
  </div>
@@ -42,7 +42,7 @@ defineProps<{
42
42
 
43
43
  .VPMenu :deep(.group + .group) {
44
44
  border-top: 1px solid var(--vp-c-divider-light);
45
- padding: 11px 0 12px;
45
+ padding: 11px 12px 12px;
46
46
  }
47
47
 
48
48
  .VPMenu :deep(.group:last-child) {
@@ -53,10 +53,6 @@ const { site, theme } = useData()
53
53
  }
54
54
  }
55
55
 
56
- .trans {
57
- padding: 2px 16px 0;
58
- }
59
-
60
56
  .trans-title {
61
57
  padding: 0 24px 0 12px;
62
58
  line-height: 32px;
@@ -69,7 +65,7 @@ const { site, theme } = useData()
69
65
  .item.social-links {
70
66
  display: flex;
71
67
  align-items: center;
72
- padding: 0 24px;
68
+ padding: 0 12px;
73
69
  }
74
70
 
75
71
  .item.appearance {
@@ -119,6 +119,10 @@ object {
119
119
  vertical-align: middle;
120
120
  }
121
121
 
122
+ figure {
123
+ margin: 0;
124
+ }
125
+
122
126
  img,
123
127
  video {
124
128
  max-width: 100%;
package/dist/node/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- import { h as c, e as createServer, g as build, s as serve } from './serve-f7c10936.js';
1
+ import { h as c, e as createServer, g as build, s as serve } from './serve-9c85885c.js';
2
2
  import 'shiki';
3
3
  import 'fs';
4
4
  import 'path';
@@ -266,7 +266,7 @@ function isNumber (x) {
266
266
  return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
267
267
  }
268
268
 
269
- var version = "1.0.0-draft.4";
269
+ var version = "1.0.0-draft.6";
270
270
 
271
271
  const argv = minimist(process.argv.slice(2));
272
272
  console.log(c.cyan(`vitepress v${version}`));
@@ -1,4 +1,4 @@
1
- export { g as build, f as createMarkdownRenderer, e as createServer, d as defineConfig, a as defineConfigWithTheme, r as resolveConfig, b as resolveSiteData, c as resolveSiteDataByRoute, s as serve } from './serve-f7c10936.js';
1
+ export { g as build, f as createMarkdownRenderer, e as createServer, d as defineConfig, a as defineConfigWithTheme, r as resolveConfig, b as resolveSiteData, c as resolveSiteDataByRoute, s as serve } from './serve-9c85885c.js';
2
2
  import 'vite';
3
3
  import 'path';
4
4
  import 'readline';
@@ -10,11 +10,11 @@ import 'stream';
10
10
  import 'util';
11
11
  import 'buffer';
12
12
  import 'module';
13
+ import 'url';
13
14
  import 'fs';
14
15
  import 'child_process';
15
16
  import 'punycode';
16
17
  import 'shiki';
17
- import 'url';
18
18
  import 'querystring';
19
19
  import 'net';
20
20
  import 'zlib';
@@ -9,12 +9,12 @@ import require$$0$8 from 'stream';
9
9
  import require$$0$9 from 'util';
10
10
  import require$$0$d from 'buffer';
11
11
  import { createRequire } from 'module';
12
+ import { fileURLToPath, URL, pathToFileURL } from 'url';
12
13
  import * as require$$0$6 from 'fs';
13
14
  import require$$0__default, { readdirSync, statSync as statSync$1 } from 'fs';
14
15
  import require$$0$c from 'child_process';
15
16
  import require$$8 from 'punycode';
16
17
  import { getHighlighter } from 'shiki';
17
- import { fileURLToPath, URL } from 'url';
18
18
  import * as qs from 'querystring';
19
19
  import qs__default from 'querystring';
20
20
  import require$$4 from 'net';
@@ -39508,7 +39508,7 @@ var ora = ora$1.exports;
39508
39508
 
39509
39509
  const require = createRequire(import.meta.url);
39510
39510
  async function renderPage(config, page, result, appChunk, cssChunk, pageToHashMap, hashMapString) {
39511
- const { createApp } = await import(path$q.join(config.tempDir, `app.js`));
39511
+ const { createApp } = await import(pathToFileURL(path$q.join(config.tempDir, `app.js`)).toString());
39512
39512
  const { app, router } = createApp();
39513
39513
  const routePath = `/${page.replace(/\.md$/, "")}`;
39514
39514
  const siteData = resolveSiteDataByRoute(config.site, routePath);
@@ -39521,12 +39521,12 @@ async function renderPage(config, page, result, appChunk, cssChunk, pageToHashMa
39521
39521
  } catch (e) {
39522
39522
  rendererPath = require.resolve("vue/server-renderer");
39523
39523
  }
39524
- const content = await import(rendererPath).then((r) => r.renderToString(app));
39524
+ const content = await import(pathToFileURL(rendererPath).toString()).then((r) => r.renderToString(app));
39525
39525
  const pageName = page.replace(/\//g, "_");
39526
39526
  const pageServerJsFileName = pageName + ".js";
39527
39527
  const pageHash = pageToHashMap[pageName.toLowerCase()];
39528
39528
  const pageClientJsFileName = `assets/${pageName}.${pageHash}.lean.js`;
39529
- const { __pageData } = await import(path$q.join(config.tempDir, pageServerJsFileName));
39529
+ const { __pageData } = await import(pathToFileURL(path$q.join(config.tempDir, pageServerJsFileName)).toString());
39530
39530
  const pageData = JSON.parse(__pageData);
39531
39531
  let preloadLinks = config.mpa ? appChunk ? [appChunk.fileName] : [] : result && appChunk ? [
39532
39532
  .../* @__PURE__ */ new Set([
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var serve = require('./serve-c220f0a8.cjs');
3
+ var serve = require('./serve-a73b4871.cjs');
4
4
  require('shiki');
5
5
  require('fs');
6
6
  require('path');
@@ -268,7 +268,7 @@ function isNumber (x) {
268
268
  return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
269
269
  }
270
270
 
271
- var version = "1.0.0-draft.4";
271
+ var version = "1.0.0-draft.6";
272
272
 
273
273
  const argv = minimist(process.argv.slice(2));
274
274
  console.log(serve.c.cyan(`vitepress v${version}`));
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var serve = require('./serve-c220f0a8.cjs');
5
+ var serve = require('./serve-a73b4871.cjs');
6
6
  require('vite');
7
7
  require('path');
8
8
  require('readline');
@@ -14,11 +14,11 @@ require('stream');
14
14
  require('util');
15
15
  require('buffer');
16
16
  require('module');
17
+ require('url');
17
18
  require('fs');
18
19
  require('child_process');
19
20
  require('punycode');
20
21
  require('shiki');
21
- require('url');
22
22
  require('querystring');
23
23
  require('net');
24
24
  require('zlib');
@@ -11,11 +11,11 @@ var require$$0$7 = require('stream');
11
11
  var require$$0$9 = require('util');
12
12
  var require$$0$d = require('buffer');
13
13
  var module$1 = require('module');
14
+ var url$1 = require('url');
14
15
  var require$$0$8 = require('fs');
15
16
  var require$$0$c = require('child_process');
16
17
  var require$$8 = require('punycode');
17
18
  var shiki = require('shiki');
18
- var url$1 = require('url');
19
19
  var qs = require('querystring');
20
20
  var require$$4 = require('net');
21
21
  var require$$7 = require('zlib');
@@ -9414,8 +9414,8 @@ function cleanRoute(siteData, route) {
9414
9414
  return route.slice(baseWithoutSuffix.length);
9415
9415
  }
9416
9416
 
9417
- const require$2 = module$1.createRequire((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('serve-c220f0a8.cjs', document.baseURI).href)));
9418
- const PKG_ROOT = path$q.resolve(url$1.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('serve-c220f0a8.cjs', document.baseURI).href))), "../..");
9417
+ const require$2 = module$1.createRequire((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('serve-a73b4871.cjs', document.baseURI).href)));
9418
+ const PKG_ROOT = path$q.resolve(url$1.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('serve-a73b4871.cjs', document.baseURI).href))), "../..");
9419
9419
  const DIST_CLIENT_PATH = path$q.resolve(PKG_ROOT, "client");
9420
9420
  const APP_PATH = path$q.join(DIST_CLIENT_PATH, "app");
9421
9421
  path$q.join(DIST_CLIENT_PATH, "shared");
@@ -39546,9 +39546,9 @@ ora$1.exports.promise = (action, options) => {
39546
39546
 
39547
39547
  var ora = ora$1.exports;
39548
39548
 
39549
- const require$1 = module$1.createRequire((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('serve-c220f0a8.cjs', document.baseURI).href)));
39549
+ const require$1 = module$1.createRequire((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('serve-a73b4871.cjs', document.baseURI).href)));
39550
39550
  async function renderPage(config, page, result, appChunk, cssChunk, pageToHashMap, hashMapString) {
39551
- const { createApp } = await (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(path__default["default"].join(config.tempDir, `app.js`));
39551
+ const { createApp } = await (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(url$1.pathToFileURL(path__default["default"].join(config.tempDir, `app.js`)).toString());
39552
39552
  const { app, router } = createApp();
39553
39553
  const routePath = `/${page.replace(/\.md$/, "")}`;
39554
39554
  const siteData = resolveSiteDataByRoute(config.site, routePath);
@@ -39561,12 +39561,12 @@ async function renderPage(config, page, result, appChunk, cssChunk, pageToHashMa
39561
39561
  } catch (e) {
39562
39562
  rendererPath = require$1.resolve("vue/server-renderer");
39563
39563
  }
39564
- const content = await (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(rendererPath).then((r) => r.renderToString(app));
39564
+ const content = await (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(url$1.pathToFileURL(rendererPath).toString()).then((r) => r.renderToString(app));
39565
39565
  const pageName = page.replace(/\//g, "_");
39566
39566
  const pageServerJsFileName = pageName + ".js";
39567
39567
  const pageHash = pageToHashMap[pageName.toLowerCase()];
39568
39568
  const pageClientJsFileName = `assets/${pageName}.${pageHash}.lean.js`;
39569
- const { __pageData } = await (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(path__default["default"].join(config.tempDir, pageServerJsFileName));
39569
+ const { __pageData } = await (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(url$1.pathToFileURL(path__default["default"].join(config.tempDir, pageServerJsFileName)).toString());
39570
39570
  const pageData = JSON.parse(__pageData);
39571
39571
  let preloadLinks = config.mpa ? appChunk ? [appChunk.fileName] : [] : result && appChunk ? [
39572
39572
  .../* @__PURE__ */ new Set([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitepress",
3
- "version": "1.0.0-draft.5",
3
+ "version": "1.0.0-draft.6",
4
4
  "description": "Vite & Vue powered static site generator",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@7.0.1",
@@ -113,7 +113,7 @@
113
113
  "vitest": "^0.10.4"
114
114
  },
115
115
  "simple-git-hooks": {
116
- "pre-commit": "lint-staged"
116
+ "pre-commit": "pnpm lint-staged"
117
117
  },
118
118
  "lint-staged": {
119
119
  "*": [