@vuepress/theme-default 2.0.0-rc.2 → 2.0.0-rc.21

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.
Files changed (41) hide show
  1. package/lib/client/components/AutoLink.vue +26 -24
  2. package/lib/client/components/NavbarBrand.vue +13 -3
  3. package/lib/client/components/NavbarDropdown.vue +1 -1
  4. package/lib/client/components/NavbarItems.vue +39 -35
  5. package/lib/client/components/PageNav.vue +116 -14
  6. package/lib/client/components/SidebarItem.vue +1 -1
  7. package/lib/client/components/SidebarItems.vue +1 -1
  8. package/lib/client/composables/index.d.ts +1 -0
  9. package/lib/client/composables/index.js +1 -0
  10. package/lib/client/composables/useNavigate.d.ts +1 -0
  11. package/lib/client/composables/useNavigate.js +25 -0
  12. package/lib/client/composables/useSidebarItems.d.ts +3 -4
  13. package/lib/client/composables/useSidebarItems.js +12 -11
  14. package/lib/client/config.js +7 -3
  15. package/lib/client/index.d.ts +1 -1
  16. package/lib/client/index.js +0 -1
  17. package/lib/client/layouts/Layout.vue +1 -2
  18. package/lib/client/layouts/NotFound.vue +2 -2
  19. package/lib/client/styles/arrow.scss +18 -24
  20. package/lib/client/styles/layout.scss +4 -0
  21. package/lib/client/styles/navbar-dropdown.scss +2 -2
  22. package/lib/client/styles/navbar.scss +4 -4
  23. package/lib/client/styles/page.scss +0 -27
  24. package/lib/client/styles/sidebar.scss +1 -1
  25. package/lib/client/styles/vars-dark.scss +7 -0
  26. package/lib/client/styles/vars.scss +46 -9
  27. package/lib/client/utils/getNavLink.d.ts +1 -7
  28. package/lib/client/utils/getNavLink.js +9 -10
  29. package/lib/client/utils/index.d.ts +0 -1
  30. package/lib/client/utils/index.js +0 -1
  31. package/lib/client/utils/isActiveSidebarItem.d.ts +1 -1
  32. package/lib/node/defaultTheme.d.ts +5 -1
  33. package/lib/node/defaultTheme.js +39 -2
  34. package/lib/node/index.d.ts +2 -1
  35. package/lib/node/index.js +1 -1
  36. package/lib/shared/nav.d.ts +2 -1
  37. package/lib/shared/options.d.ts +45 -1
  38. package/package.json +25 -20
  39. package/templates/build.html +13 -10
  40. package/lib/client/utils/getResolveRouteWithRedirect.d.ts +0 -5
  41. package/lib/client/utils/getResolveRouteWithRedirect.js +0 -22
@@ -1,9 +1,9 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html lang="{{ lang }}">
3
3
  <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <meta name="generator" content="VuePress {{ version }}">
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
6
+ <meta name="generator" content="VuePress {{ version }}" />
7
7
  <style>
8
8
  :root {
9
9
  --c-bg: #fff;
@@ -11,16 +11,19 @@
11
11
  html.dark {
12
12
  --c-bg: #22272e;
13
13
  }
14
- html, body {
14
+ html,
15
+ body {
15
16
  background-color: var(--c-bg);
16
17
  }
17
18
  </style>
18
19
  <script>
19
- const userMode = localStorage.getItem('vuepress-color-scheme');
20
- const systemDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
21
- if (userMode === 'dark' || (userMode !== 'light' && systemDarkMode)) {
22
- document.documentElement.classList.toggle('dark', true);
23
- }
20
+ const userMode = localStorage.getItem('vuepress-color-scheme')
21
+ const systemDarkMode =
22
+ window.matchMedia &&
23
+ window.matchMedia('(prefers-color-scheme: dark)').matches
24
+ if (userMode === 'dark' || (userMode !== 'light' && systemDarkMode)) {
25
+ document.documentElement.classList.toggle('dark', true)
26
+ }
24
27
  </script>
25
28
  <!--vuepress-ssr-head-->
26
29
  <!--vuepress-ssr-styles-->
@@ -1,5 +0,0 @@
1
- import type { Router } from 'vue-router';
2
- /**
3
- * Resolve a route with redirection
4
- */
5
- export declare const getResolveRouteWithRedirect: (router: Router, to: import("vue-router").RouteLocationRaw, currentLocation?: import("vue-router").RouteLocationNormalizedLoaded | undefined) => ReturnType<Router['resolve']>;
@@ -1,22 +0,0 @@
1
- import { isFunction, isString } from 'vuepress/shared';
2
- /**
3
- * Resolve a route with redirection
4
- */
5
- export const getResolveRouteWithRedirect = (router, ...args) => {
6
- const route = router.resolve(...args);
7
- const lastMatched = route.matched[route.matched.length - 1];
8
- if (!lastMatched?.redirect) {
9
- return route;
10
- }
11
- const { redirect } = lastMatched;
12
- const resolvedRedirect = isFunction(redirect) ? redirect(route) : redirect;
13
- const resolvedRedirectObj = isString(resolvedRedirect)
14
- ? { path: resolvedRedirect }
15
- : resolvedRedirect;
16
- return getResolveRouteWithRedirect(router, {
17
- hash: route.hash,
18
- query: route.query,
19
- params: route.params,
20
- ...resolvedRedirectObj,
21
- });
22
- };