vitepress 2.0.0-alpha.2 → 2.0.0-alpha.3

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.
@@ -7,7 +7,7 @@ export const dataSymbol = Symbol();
7
7
  export const siteDataRef = shallowRef((import.meta.env.PROD ? siteData : readonly(siteData)));
8
8
  // hmr
9
9
  if (import.meta.hot) {
10
- import.meta.hot.accept('/@siteData', (m) => {
10
+ import.meta.hot.accept('@siteData', (m) => {
11
11
  if (m) {
12
12
  siteDataRef.value = m.default;
13
13
  }
@@ -224,11 +224,11 @@ function normalizeHref(href) {
224
224
  }
225
225
  async function changeRoute(href, { smoothScroll = false, initialLoad = false } = {}) {
226
226
  const loc = normalizeHref(location.href);
227
- const { pathname, hash } = new URL(href, fakeHost);
228
- const currentLoc = new URL(loc, fakeHost);
227
+ const nextUrl = new URL(href, location.origin);
228
+ const currentUrl = new URL(loc, location.origin);
229
229
  if (href === loc) {
230
230
  if (!initialLoad) {
231
- scrollTo(hash, smoothScroll);
231
+ scrollTo(nextUrl.hash, smoothScroll);
232
232
  return false;
233
233
  }
234
234
  }
@@ -236,14 +236,14 @@ async function changeRoute(href, { smoothScroll = false, initialLoad = false } =
236
236
  // save scroll position before changing URL
237
237
  history.replaceState({ scrollPosition: window.scrollY }, '');
238
238
  history.pushState({}, '', href);
239
- if (pathname === currentLoc.pathname) {
239
+ if (nextUrl.pathname === currentUrl.pathname) {
240
240
  // scroll between hash anchors on the same page, avoid duplicate entries
241
- if (hash !== currentLoc.hash) {
241
+ if (nextUrl.hash !== currentUrl.hash) {
242
242
  window.dispatchEvent(new HashChangeEvent('hashchange', {
243
- oldURL: currentLoc.href,
244
- newURL: href
243
+ oldURL: currentUrl.href,
244
+ newURL: nextUrl.href
245
245
  }));
246
- scrollTo(hash, smoothScroll);
246
+ scrollTo(nextUrl.hash, smoothScroll);
247
247
  }
248
248
  return false;
249
249
  }
@@ -1,5 +1,5 @@
1
1
  import * as vue from 'vue';
2
- import { Component, InjectionKey, Ref, App, AsyncComponentLoader } from 'vue';
2
+ import { Component, Ref, InjectionKey, App, AsyncComponentLoader } from 'vue';
3
3
  import { PageData, Awaitable, SiteData } from '../../types/shared.js';
4
4
  export { HeadConfig, Header, PageData, SiteData } from '../../types/shared.js';
5
5
 
@@ -154,6 +154,7 @@ const pageName = computed(() =>
154
154
  width: 224px;
155
155
  height: 32px;
156
156
  background: linear-gradient(transparent, var(--vp-c-bg) 70%);
157
+ pointer-events: none;
157
158
  }
158
159
 
159
160
  .aside-content {
@@ -46,7 +46,7 @@ const searchIndexData = shallowRef(localSearchIndex)
46
46
 
47
47
  // hmr
48
48
  if (import.meta.hot) {
49
- import.meta.hot.accept('/@localSearchIndex', (m) => {
49
+ import.meta.hot.accept('@localSearchIndex', (m) => {
50
50
  if (m) {
51
51
  searchIndexData.value = m.default
52
52
  }
@@ -8,8 +8,8 @@
8
8
  font-weight: 100 900;
9
9
  font-display: swap;
10
10
  src: url('../fonts/inter-roman-cyrillic-ext.woff2') format('woff2');
11
- unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F,
12
- U+FE2E-FE2F;
11
+ unicode-range:
12
+ U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
13
13
  }
14
14
 
15
15
  @font-face {
@@ -36,8 +36,8 @@
36
36
  font-weight: 100 900;
37
37
  font-display: swap;
38
38
  src: url('../fonts/inter-roman-greek.woff2') format('woff2');
39
- unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1,
40
- U+03A3-03FF;
39
+ unicode-range:
40
+ U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
41
41
  }
42
42
 
43
43
  @font-face {
@@ -46,9 +46,10 @@
46
46
  font-weight: 100 900;
47
47
  font-display: swap;
48
48
  src: url('../fonts/inter-roman-vietnamese.woff2') format('woff2');
49
- unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169,
50
- U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323,
51
- U+0329, U+1EA0-1EF9, U+20AB;
49
+ unicode-range:
50
+ U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1,
51
+ U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329,
52
+ U+1EA0-1EF9, U+20AB;
52
53
  }
53
54
 
54
55
  @font-face {
@@ -57,8 +58,9 @@
57
58
  font-weight: 100 900;
58
59
  font-display: swap;
59
60
  src: url('../fonts/inter-roman-latin-ext.woff2') format('woff2');
60
- unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF,
61
- U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
61
+ unicode-range:
62
+ U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
63
+ U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
62
64
  }
63
65
 
64
66
  @font-face {
@@ -67,9 +69,10 @@
67
69
  font-weight: 100 900;
68
70
  font-display: swap;
69
71
  src: url('../fonts/inter-roman-latin.woff2') format('woff2');
70
- unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
71
- U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191,
72
- U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
72
+ unicode-range:
73
+ U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
74
+ U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193,
75
+ U+2212, U+2215, U+FEFF, U+FFFD;
73
76
  }
74
77
 
75
78
  @font-face {
@@ -78,8 +81,8 @@
78
81
  font-weight: 100 900;
79
82
  font-display: swap;
80
83
  src: url('../fonts/inter-italic-cyrillic-ext.woff2') format('woff2');
81
- unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F,
82
- U+FE2E-FE2F;
84
+ unicode-range:
85
+ U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
83
86
  }
84
87
 
85
88
  @font-face {
@@ -106,8 +109,8 @@
106
109
  font-weight: 100 900;
107
110
  font-display: swap;
108
111
  src: url('../fonts/inter-italic-greek.woff2') format('woff2');
109
- unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1,
110
- U+03A3-03FF;
112
+ unicode-range:
113
+ U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
111
114
  }
112
115
 
113
116
  @font-face {
@@ -116,9 +119,10 @@
116
119
  font-weight: 100 900;
117
120
  font-display: swap;
118
121
  src: url('../fonts/inter-italic-vietnamese.woff2') format('woff2');
119
- unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169,
120
- U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323,
121
- U+0329, U+1EA0-1EF9, U+20AB;
122
+ unicode-range:
123
+ U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1,
124
+ U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329,
125
+ U+1EA0-1EF9, U+20AB;
122
126
  }
123
127
 
124
128
  @font-face {
@@ -127,8 +131,9 @@
127
131
  font-weight: 100 900;
128
132
  font-display: swap;
129
133
  src: url('../fonts/inter-italic-latin-ext.woff2') format('woff2');
130
- unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF,
131
- U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
134
+ unicode-range:
135
+ U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
136
+ U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
132
137
  }
133
138
 
134
139
  @font-face {
@@ -137,45 +142,54 @@
137
142
  font-weight: 100 900;
138
143
  font-display: swap;
139
144
  src: url('../fonts/inter-italic-latin.woff2') format('woff2');
140
- unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
141
- U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191,
142
- U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
145
+ unicode-range:
146
+ U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
147
+ U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193,
148
+ U+2212, U+2215, U+FEFF, U+FFFD;
143
149
  }
144
150
 
145
151
  @font-face {
146
152
  font-family: 'Punctuation SC';
147
153
  font-weight: 400;
148
- src: local('PingFang SC Regular'), local('Noto Sans CJK SC'),
154
+ src:
155
+ local('PingFang SC Regular'), local('Noto Sans CJK SC'),
149
156
  local('Microsoft YaHei');
150
- unicode-range: U+201C, U+201D, U+2018, U+2019, U+2E3A, U+2014, U+2013, U+2026,
151
- U+00B7, U+007E, U+002F;
157
+ unicode-range:
158
+ U+201C, U+201D, U+2018, U+2019, U+2E3A, U+2014, U+2013, U+2026, U+00B7,
159
+ U+007E, U+002F;
152
160
  }
153
161
 
154
162
  @font-face {
155
163
  font-family: 'Punctuation SC';
156
164
  font-weight: 500;
157
- src: local('PingFang SC Medium'), local('Noto Sans CJK SC'),
165
+ src:
166
+ local('PingFang SC Medium'), local('Noto Sans CJK SC'),
158
167
  local('Microsoft YaHei');
159
- unicode-range: U+201C, U+201D, U+2018, U+2019, U+2E3A, U+2014, U+2013, U+2026,
160
- U+00B7, U+007E, U+002F;
168
+ unicode-range:
169
+ U+201C, U+201D, U+2018, U+2019, U+2E3A, U+2014, U+2013, U+2026, U+00B7,
170
+ U+007E, U+002F;
161
171
  }
162
172
 
163
173
  @font-face {
164
174
  font-family: 'Punctuation SC';
165
175
  font-weight: 600;
166
- src: local('PingFang SC Semibold'), local('Noto Sans CJK SC Bold'),
176
+ src:
177
+ local('PingFang SC Semibold'), local('Noto Sans CJK SC Bold'),
167
178
  local('Microsoft YaHei Bold');
168
- unicode-range: U+201C, U+201D, U+2018, U+2019, U+2E3A, U+2014, U+2013, U+2026,
169
- U+00B7, U+007E, U+002F;
179
+ unicode-range:
180
+ U+201C, U+201D, U+2018, U+2019, U+2E3A, U+2014, U+2013, U+2026, U+00B7,
181
+ U+007E, U+002F;
170
182
  }
171
183
 
172
184
  @font-face {
173
185
  font-family: 'Punctuation SC';
174
186
  font-weight: 700;
175
- src: local('PingFang SC Semibold'), local('Noto Sans CJK SC Bold'),
187
+ src:
188
+ local('PingFang SC Semibold'), local('Noto Sans CJK SC Bold'),
176
189
  local('Microsoft YaHei Bold');
177
- unicode-range: U+201C, U+201D, U+2018, U+2019, U+2E3A, U+2014, U+2013, U+2026,
178
- U+00B7, U+007E, U+002F;
190
+ unicode-range:
191
+ U+201C, U+201D, U+2018, U+2019, U+2E3A, U+2014, U+2013, U+2026, U+00B7,
192
+ U+007E, U+002F;
179
193
  }
180
194
 
181
195
  /* Generate the subsetted fonts using: `pyftsubset <file>.woff2 --unicodes="<range>" --output-file="inter-<style>-<subset>.woff2" --flavor=woff2` */
@@ -261,17 +261,19 @@
261
261
  * -------------------------------------------------------------------------- */
262
262
 
263
263
  :root {
264
- --vp-font-family-base: 'Inter', ui-sans-serif, system-ui, sans-serif,
265
- 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
266
- --vp-font-family-mono: ui-monospace, 'Menlo', 'Monaco', 'Consolas',
267
- 'Liberation Mono', 'Courier New', monospace;
264
+ --vp-font-family-base:
265
+ 'Inter', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji',
266
+ 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
267
+ --vp-font-family-mono:
268
+ ui-monospace, 'Menlo', 'Monaco', 'Consolas', 'Liberation Mono',
269
+ 'Courier New', monospace;
268
270
  font-optical-sizing: auto;
269
271
  }
270
272
 
271
273
  :root:where(:lang(zh)) {
272
- --vp-font-family-base: 'Punctuation SC', 'Inter', ui-sans-serif, system-ui,
273
- sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
274
- 'Noto Color Emoji';
274
+ --vp-font-family-base:
275
+ 'Punctuation SC', 'Inter', ui-sans-serif, system-ui, sans-serif,
276
+ 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
275
277
  }
276
278
 
277
279
  /**
@@ -283,7 +285,8 @@
283
285
  --vp-shadow-2: 0 3px 12px rgba(0, 0, 0, 0.07), 0 1px 4px rgba(0, 0, 0, 0.07);
284
286
  --vp-shadow-3: 0 12px 32px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.08);
285
287
  --vp-shadow-4: 0 14px 44px rgba(0, 0, 0, 0.12), 0 3px 9px rgba(0, 0, 0, 0.12);
286
- --vp-shadow-5: 0 18px 56px rgba(0, 0, 0, 0.16), 0 4px 12px rgba(0, 0, 0, 0.16);
288
+ --vp-shadow-5:
289
+ 0 18px 56px rgba(0, 0, 0, 0.16), 0 4px 12px rgba(0, 0, 0, 0.16);
287
290
  }
288
291
 
289
292
  /**
@@ -337,10 +340,10 @@
337
340
  --vp-code-block-bg: var(--vp-c-bg-alt);
338
341
  --vp-code-block-divider-color: var(--vp-c-gutter);
339
342
 
340
- --vp-code-lang-color: var(--vp-c-text-3);
343
+ --vp-code-lang-color: var(--vp-c-text-2);
341
344
 
342
345
  --vp-code-line-highlight-color: var(--vp-c-default-soft);
343
- --vp-code-line-number-color: var(--vp-c-text-3);
346
+ --vp-code-line-number-color: var(--vp-c-text-2);
344
347
 
345
348
  --vp-code-line-diff-add-color: var(--vp-c-success-soft);
346
349
  --vp-code-line-diff-add-symbol-color: var(--vp-c-success-1);