vitepress 2.0.0-alpha.1 → 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
  }
@@ -128,16 +128,13 @@ function newRouter() {
128
128
  if (inBrowser) {
129
129
  createApp().then(({ app, router, data }) => {
130
130
  // wait until page component is fetched before mounting
131
- router.go().then(() => {
131
+ router.go(location.href, { initialLoad: true }).then(() => {
132
132
  // dynamically update head tags
133
133
  useUpdateHead(router.route, data.site);
134
134
  app.mount('#app');
135
135
  // scroll to hash on new tab during dev
136
136
  if (import.meta.env.DEV && location.hash) {
137
- const target = document.getElementById(decodeURIComponent(location.hash).slice(1));
138
- if (target) {
139
- scrollTo(target, location.hash);
140
- }
137
+ scrollTo(location.hash);
141
138
  }
142
139
  });
143
140
  });
@@ -8,6 +8,8 @@ export const RouterSymbol = Symbol();
8
8
  const fakeHost = 'http://a.com';
9
9
  const getDefaultRoute = () => ({
10
10
  path: '/',
11
+ hash: '',
12
+ query: '',
11
13
  component: null,
12
14
  data: notFoundPageData
13
15
  });
@@ -15,20 +17,16 @@ export function createRouter(loadPageModule, fallbackComponent) {
15
17
  const route = reactive(getDefaultRoute());
16
18
  const router = {
17
19
  route,
18
- go
19
- };
20
- async function go(href = inBrowser ? location.href : '/') {
21
- href = normalizeHref(href);
22
- if ((await router.onBeforeRouteChange?.(href)) === false)
23
- return;
24
- if (inBrowser && href !== normalizeHref(location.href)) {
25
- // save scroll position before changing url
26
- history.replaceState({ scrollPosition: window.scrollY }, '');
27
- history.pushState({}, '', href);
20
+ async go(href, options) {
21
+ href = normalizeHref(href);
22
+ if ((await router.onBeforeRouteChange?.(href)) === false)
23
+ return;
24
+ if (!inBrowser || (await changeRoute(href, options)))
25
+ await loadPage(href);
26
+ syncRouteQueryAndHash();
27
+ await router.onAfterRouteChange?.(href);
28
28
  }
29
- await loadPage(href);
30
- await (router.onAfterRouteChange ?? router.onAfterRouteChanged)?.(href);
31
- }
29
+ };
32
30
  let latestPendingPath = null;
33
31
  async function loadPage(href, scrollPosition = 0, isRetry = false) {
34
32
  if ((await router.onBeforePageLoad?.(href)) === false)
@@ -37,21 +35,20 @@ export function createRouter(loadPageModule, fallbackComponent) {
37
35
  const pendingPath = (latestPendingPath = targetLoc.pathname);
38
36
  try {
39
37
  let page = await loadPageModule(pendingPath);
40
- if (!page) {
38
+ if (!page)
41
39
  throw new Error(`Page not found: ${pendingPath}`);
42
- }
43
40
  if (latestPendingPath === pendingPath) {
44
41
  latestPendingPath = null;
45
42
  const { default: comp, __pageData } = page;
46
- if (!comp) {
43
+ if (!comp)
47
44
  throw new Error(`Invalid route component: ${comp}`);
48
- }
49
45
  await router.onAfterPageLoad?.(href);
50
46
  route.path = inBrowser ? pendingPath : withBase(pendingPath);
51
47
  route.component = markRaw(comp);
52
48
  route.data = import.meta.env.PROD
53
49
  ? markRaw(__pageData)
54
50
  : readonly(__pageData);
51
+ syncRouteQueryAndHash(targetLoc);
55
52
  if (inBrowser) {
56
53
  nextTick(() => {
57
54
  let actualPathname = siteDataRef.value.base +
@@ -64,20 +61,7 @@ export function createRouter(loadPageModule, fallbackComponent) {
64
61
  href = actualPathname + targetLoc.search + targetLoc.hash;
65
62
  history.replaceState({}, '', href);
66
63
  }
67
- if (targetLoc.hash && !scrollPosition) {
68
- let target = null;
69
- try {
70
- target = document.getElementById(decodeURIComponent(targetLoc.hash).slice(1));
71
- }
72
- catch (e) {
73
- console.warn(e);
74
- }
75
- if (target) {
76
- scrollTo(target, targetLoc.hash);
77
- return;
78
- }
79
- }
80
- window.scrollTo(0, scrollPosition);
64
+ return scrollTo(targetLoc.hash, false, scrollPosition);
81
65
  });
82
66
  }
83
67
  }
@@ -110,13 +94,19 @@ export function createRouter(loadPageModule, fallbackComponent) {
110
94
  .replace(/^\//, '')
111
95
  : '404.md';
112
96
  route.data = { ...notFoundPageData, relativePath };
97
+ syncRouteQueryAndHash(targetLoc);
113
98
  }
114
99
  }
115
100
  }
101
+ function syncRouteQueryAndHash(loc = inBrowser
102
+ ? location
103
+ : { search: '', hash: '' }) {
104
+ route.query = loc.search;
105
+ route.hash = decodeURIComponent(loc.hash);
106
+ }
116
107
  if (inBrowser) {
117
- if (history.state === null) {
108
+ if (history.state === null)
118
109
  history.replaceState({}, '');
119
- }
120
110
  window.addEventListener('click', (e) => {
121
111
  if (e.defaultPrevented ||
122
112
  !(e.target instanceof Element) ||
@@ -125,46 +115,29 @@ export function createRouter(loadPageModule, fallbackComponent) {
125
115
  e.ctrlKey ||
126
116
  e.shiftKey ||
127
117
  e.altKey ||
128
- e.metaKey)
118
+ e.metaKey) {
129
119
  return;
120
+ }
130
121
  const link = e.target.closest('a');
131
122
  if (!link ||
132
123
  link.closest('.vp-raw') ||
133
124
  link.hasAttribute('download') ||
134
- link.hasAttribute('target'))
125
+ link.hasAttribute('target')) {
135
126
  return;
127
+ }
136
128
  const linkHref = link.getAttribute('href') ??
137
129
  (link instanceof SVGAElement ? link.getAttribute('xlink:href') : null);
138
130
  if (linkHref == null)
139
131
  return;
140
- const { href, origin, pathname, hash, search } = new URL(linkHref, link.baseURI);
141
- const currentUrl = new URL(location.href); // copy to keep old data
132
+ const { href, origin, pathname } = new URL(linkHref, link.baseURI);
133
+ const currentLoc = new URL(location.href); // copy to keep old data
142
134
  // only intercept inbound html links
143
- if (origin === currentUrl.origin && treatAsHtml(pathname)) {
135
+ if (origin === currentLoc.origin && treatAsHtml(pathname)) {
144
136
  e.preventDefault();
145
- if (pathname === currentUrl.pathname &&
146
- search === currentUrl.search) {
147
- // scroll between hash anchors in the same page
148
- // avoid duplicate history entries when the hash is same
149
- if (hash !== currentUrl.hash) {
150
- history.pushState({}, '', href);
151
- // still emit the event so we can listen to it in themes
152
- window.dispatchEvent(new HashChangeEvent('hashchange', {
153
- oldURL: currentUrl.href,
154
- newURL: href
155
- }));
156
- }
157
- if (hash) {
158
- // use smooth scroll when clicking on header anchor links
159
- scrollTo(link, hash, link.classList.contains('header-anchor'));
160
- }
161
- else {
162
- window.scrollTo(0, 0);
163
- }
164
- }
165
- else {
166
- go(href);
167
- }
137
+ router.go(href, {
138
+ // use smooth scroll when clicking on header anchor links
139
+ smoothScroll: link.classList.contains('header-anchor')
140
+ });
168
141
  }
169
142
  }, { capture: true });
170
143
  window.addEventListener('popstate', async (e) => {
@@ -172,10 +145,12 @@ export function createRouter(loadPageModule, fallbackComponent) {
172
145
  return;
173
146
  const href = normalizeHref(location.href);
174
147
  await loadPage(href, (e.state && e.state.scrollPosition) || 0);
175
- await (router.onAfterRouteChange ?? router.onAfterRouteChanged)?.(href);
148
+ syncRouteQueryAndHash();
149
+ await router.onAfterRouteChange?.(href);
176
150
  });
177
151
  window.addEventListener('hashchange', (e) => {
178
152
  e.preventDefault();
153
+ syncRouteQueryAndHash();
179
154
  });
180
155
  }
181
156
  handleHMR(route);
@@ -183,20 +158,21 @@ export function createRouter(loadPageModule, fallbackComponent) {
183
158
  }
184
159
  export function useRouter() {
185
160
  const router = inject(RouterSymbol);
186
- if (!router) {
161
+ if (!router)
187
162
  throw new Error('useRouter() is called without provider.');
188
- }
189
163
  return router;
190
164
  }
191
165
  export function useRoute() {
192
166
  return useRouter().route;
193
167
  }
194
- export function scrollTo(el, hash, smooth = false) {
168
+ export function scrollTo(hash, smooth = false, scrollPosition = 0) {
169
+ if (!hash || scrollPosition) {
170
+ window.scrollTo(0, scrollPosition);
171
+ return;
172
+ }
195
173
  let target = null;
196
174
  try {
197
- target = el.classList.contains('header-anchor')
198
- ? el
199
- : document.getElementById(decodeURIComponent(hash).slice(1));
175
+ target = document.getElementById(decodeURIComponent(hash).slice(1));
200
176
  }
201
177
  catch (e) {
202
178
  console.warn(e);
@@ -222,9 +198,8 @@ function handleHMR(route) {
222
198
  if (import.meta.hot) {
223
199
  // hot reload pageData
224
200
  import.meta.hot.on('vitepress:pageData', (payload) => {
225
- if (shouldHotReload(payload)) {
201
+ if (shouldHotReload(payload))
226
202
  route.data = payload.pageData;
227
- }
228
203
  });
229
204
  }
230
205
  }
@@ -239,9 +214,39 @@ function normalizeHref(href) {
239
214
  const url = new URL(href, fakeHost);
240
215
  url.pathname = url.pathname.replace(/(^|\/)index(\.html)?$/, '$1');
241
216
  // ensure correct deep link so page refresh lands on correct files.
242
- if (siteDataRef.value.cleanUrls)
217
+ if (siteDataRef.value.cleanUrls) {
243
218
  url.pathname = url.pathname.replace(/\.html$/, '');
244
- else if (!url.pathname.endsWith('/') && !url.pathname.endsWith('.html'))
219
+ }
220
+ else if (!url.pathname.endsWith('/') && !url.pathname.endsWith('.html')) {
245
221
  url.pathname += '.html';
222
+ }
246
223
  return url.pathname + url.search + url.hash;
247
224
  }
225
+ async function changeRoute(href, { smoothScroll = false, initialLoad = false } = {}) {
226
+ const loc = normalizeHref(location.href);
227
+ const nextUrl = new URL(href, location.origin);
228
+ const currentUrl = new URL(loc, location.origin);
229
+ if (href === loc) {
230
+ if (!initialLoad) {
231
+ scrollTo(nextUrl.hash, smoothScroll);
232
+ return false;
233
+ }
234
+ }
235
+ else {
236
+ // save scroll position before changing URL
237
+ history.replaceState({ scrollPosition: window.scrollY }, '');
238
+ history.pushState({}, '', href);
239
+ if (nextUrl.pathname === currentUrl.pathname) {
240
+ // scroll between hash anchors on the same page, avoid duplicate entries
241
+ if (nextUrl.hash !== currentUrl.hash) {
242
+ window.dispatchEvent(new HashChangeEvent('hashchange', {
243
+ oldURL: currentUrl.href,
244
+ newURL: nextUrl.href
245
+ }));
246
+ scrollTo(nextUrl.hash, smoothScroll);
247
+ }
248
+ return false;
249
+ }
250
+ }
251
+ return true;
252
+ }
@@ -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
 
@@ -11,6 +11,8 @@ declare function escapeHtml(str: string): string;
11
11
 
12
12
  interface Route {
13
13
  path: string;
14
+ hash: string;
15
+ query: string;
14
16
  data: PageData;
15
17
  component: Component | null;
16
18
  }
@@ -22,7 +24,10 @@ interface Router {
22
24
  /**
23
25
  * Navigate to a new URL.
24
26
  */
25
- go: (to?: string) => Promise<void>;
27
+ go: (to: string, options?: {
28
+ initialLoad?: boolean;
29
+ smoothScroll?: boolean;
30
+ }) => Promise<void>;
26
31
  /**
27
32
  * Called before the route changes. Return `false` to cancel the navigation.
28
33
  */
@@ -40,10 +45,6 @@ interface Router {
40
45
  * Called after the route changes.
41
46
  */
42
47
  onAfterRouteChange?: (to: string) => Awaitable<void>;
43
- /**
44
- * @deprecated use `onAfterRouteChange` instead
45
- */
46
- onAfterRouteChanged?: (to: string) => Awaitable<void>;
47
48
  }
48
49
  declare function useRouter(): Router;
49
50
  declare function useRoute(): Route;
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import docsearch from '@docsearch/js'
3
- import { useRoute, useRouter } from 'vitepress'
3
+ import { useRouter } from 'vitepress'
4
4
  import type { DefaultTheme } from 'vitepress/theme'
5
5
  import { nextTick, onMounted, watch } from 'vue'
6
6
  import { useData } from '../composables/data'
@@ -10,7 +10,6 @@ const props = defineProps<{
10
10
  }>()
11
11
 
12
12
  const router = useRouter()
13
- const route = useRoute()
14
13
  const { site, localeIndex, lang } = useData()
15
14
 
16
15
  type DocSearchProps = Parameters<typeof docsearch>[0]
@@ -51,17 +50,7 @@ function initialize(userOptions: DefaultTheme.AlgoliaSearchOptions) {
51
50
 
52
51
  navigator: {
53
52
  navigate({ itemUrl }) {
54
- const { pathname: hitPathname } = new URL(
55
- window.location.origin + itemUrl
56
- )
57
-
58
- // router doesn't handle same-page navigation so we use the native
59
- // browser location API for anchor navigation
60
- if (route.path === hitPathname) {
61
- window.location.assign(window.location.origin + itemUrl)
62
- } else {
63
- router.go(itemUrl)
64
- }
53
+ router.go(itemUrl)
65
54
  }
66
55
  },
67
56
 
@@ -71,17 +60,6 @@ function initialize(userOptions: DefaultTheme.AlgoliaSearchOptions) {
71
60
  url: getRelativePath(item.url)
72
61
  })
73
62
  })
74
- },
75
-
76
- hitComponent({ hit, children }) {
77
- return {
78
- __v: null,
79
- type: 'a',
80
- ref: undefined,
81
- constructor: undefined,
82
- key: undefined,
83
- props: { href: hit.url, children }
84
- }
85
63
  }
86
64
  }) as DocSearchProps
87
65
 
@@ -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);