@vuepress/theme-default 2.0.0-beta.30 → 2.0.0-beta.34

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/clientAppEnhance.js +0 -4
  2. package/lib/client/components/{NavLink.vue → AutoLink.vue} +1 -2
  3. package/lib/client/components/Home.vue +4 -4
  4. package/lib/client/components/HomeHero.vue +2 -2
  5. package/lib/client/components/Navbar.vue +6 -6
  6. package/lib/client/components/{DropdownLink.vue → NavbarDropdown.vue} +17 -17
  7. package/lib/client/components/{NavbarLinks.vue → NavbarItems.vue} +8 -14
  8. package/lib/client/components/Page.vue +2 -2
  9. package/lib/client/components/PageMeta.vue +4 -5
  10. package/lib/client/components/PageNav.vue +8 -8
  11. package/lib/client/components/Sidebar.vue +4 -16
  12. package/lib/client/components/SidebarItem.vue +80 -0
  13. package/lib/client/components/SidebarItems.vue +16 -0
  14. package/lib/client/index.d.ts +2 -2
  15. package/lib/client/layouts/Layout.vue +4 -4
  16. package/lib/client/styles/{_wrapper.scss → _mixins.scss} +6 -1
  17. package/lib/client/styles/code.scss +2 -1
  18. package/lib/client/styles/index.scss +1 -2
  19. package/lib/client/styles/layout.scss +2 -2
  20. package/lib/client/styles/{dropdown.scss → navbar-dropdown.scss} +25 -33
  21. package/lib/client/styles/navbar.scss +12 -8
  22. package/lib/client/styles/normalize.scss +10 -2
  23. package/lib/client/styles/page.scss +3 -3
  24. package/lib/client/styles/sidebar.scss +70 -66
  25. package/lib/client/styles/transitions.scss +11 -2
  26. package/lib/client/utils/index.d.ts +1 -0
  27. package/lib/client/utils/index.js +1 -0
  28. package/lib/client/utils/isActiveSidebarItem.d.ts +3 -0
  29. package/lib/client/utils/isActiveSidebarItem.js +20 -0
  30. package/lib/node/defaultTheme.js +13 -1
  31. package/lib/node/utils/index.d.ts +1 -0
  32. package/lib/node/utils/index.js +1 -0
  33. package/lib/node/utils/resolveExternalLinkIconPluginOptions.d.ts +6 -0
  34. package/lib/node/utils/resolveExternalLinkIconPluginOptions.js +21 -0
  35. package/lib/shared/nav.d.ts +10 -4
  36. package/package.json +21 -20
  37. package/templates/index.build.html +33 -0
  38. package/lib/client/components/SidebarChild.d.ts +0 -6
  39. package/lib/client/components/SidebarChild.js +0 -76
  40. package/lib/client/components/global/ExternalLinkIcon.vue +0 -12
  41. package/lib/client/styles/sr-only.scss +0 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/theme-default",
3
- "version": "2.0.0-beta.30",
3
+ "version": "2.0.0-beta.34",
4
4
  "description": "Default theme of VuePress",
5
5
  "keywords": [
6
6
  "vuepress-theme",
@@ -21,7 +21,8 @@
21
21
  "main": "lib/node/index.js",
22
22
  "types": "lib/node/index.d.ts",
23
23
  "files": [
24
- "lib"
24
+ "lib",
25
+ "templates"
25
26
  ],
26
27
  "scripts": {
27
28
  "build": "tsc -b tsconfig.build.json",
@@ -29,28 +30,28 @@
29
30
  "copy": "cpx \"src/**/*.{d.ts,vue,scss}\" lib"
30
31
  },
31
32
  "dependencies": {
32
- "@vuepress/client": "2.0.0-beta.29",
33
- "@vuepress/core": "2.0.0-beta.29",
34
- "@vuepress/plugin-active-header-links": "2.0.0-beta.29",
35
- "@vuepress/plugin-back-to-top": "2.0.0-beta.30",
36
- "@vuepress/plugin-container": "2.0.0-beta.29",
37
- "@vuepress/plugin-external-link-icon": "2.0.0-beta.29",
38
- "@vuepress/plugin-git": "2.0.0-beta.29",
39
- "@vuepress/plugin-medium-zoom": "2.0.0-beta.29",
40
- "@vuepress/plugin-nprogress": "2.0.0-beta.29",
41
- "@vuepress/plugin-palette": "2.0.0-beta.29",
42
- "@vuepress/plugin-prismjs": "2.0.0-beta.29",
43
- "@vuepress/plugin-theme-data": "2.0.0-beta.29",
44
- "@vuepress/shared": "2.0.0-beta.28",
45
- "@vuepress/utils": "2.0.0-beta.28",
46
- "@vueuse/core": "^7.1.2",
47
- "sass": "^1.44.0",
33
+ "@vuepress/client": "2.0.0-beta.34",
34
+ "@vuepress/core": "2.0.0-beta.34",
35
+ "@vuepress/plugin-active-header-links": "2.0.0-beta.34",
36
+ "@vuepress/plugin-back-to-top": "2.0.0-beta.34",
37
+ "@vuepress/plugin-container": "2.0.0-beta.34",
38
+ "@vuepress/plugin-external-link-icon": "2.0.0-beta.34",
39
+ "@vuepress/plugin-git": "2.0.0-beta.34",
40
+ "@vuepress/plugin-medium-zoom": "2.0.0-beta.34",
41
+ "@vuepress/plugin-nprogress": "2.0.0-beta.34",
42
+ "@vuepress/plugin-palette": "2.0.0-beta.34",
43
+ "@vuepress/plugin-prismjs": "2.0.0-beta.34",
44
+ "@vuepress/plugin-theme-data": "2.0.0-beta.34",
45
+ "@vuepress/shared": "2.0.0-beta.33",
46
+ "@vuepress/utils": "2.0.0-beta.33",
47
+ "@vueuse/core": "^7.5.3",
48
+ "sass": "^1.47.0",
48
49
  "sass-loader": "^12.4.0",
49
- "vue": "^3.2.24",
50
+ "vue": "^3.2.26",
50
51
  "vue-router": "^4.0.12"
51
52
  },
52
53
  "publishConfig": {
53
54
  "access": "public"
54
55
  },
55
- "gitHead": "b39bb4b791c95d5c40c64198b3931f80005475ef"
56
+ "gitHead": "aba907994697f4d0a691f2e3668dad4bea388f20"
56
57
  }
@@ -0,0 +1,33 @@
1
+ <!DOCTYPE html>
2
+ <html lang="{{ lang }}">
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 }}">
7
+ <style>
8
+ :root {
9
+ --c-bg: #fff;
10
+ }
11
+ html.dark {
12
+ --c-bg: #22272e;
13
+ }
14
+ html, body {
15
+ background-color: var(--c-bg);
16
+ }
17
+ </style>
18
+ <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
+ }
24
+ </script>
25
+ <!--vuepress-ssr-head-->
26
+ <!--vuepress-ssr-resources-->
27
+ <!--vuepress-ssr-styles-->
28
+ </head>
29
+ <body>
30
+ <div id="app"><!--vuepress-ssr-app--></div>
31
+ <!--vuepress-ssr-scripts-->
32
+ </body>
33
+ </html>
@@ -1,6 +0,0 @@
1
- import type { FunctionalComponent } from 'vue';
2
- import type { ResolvedSidebarItem } from '../../shared';
3
- export declare const SidebarChild: FunctionalComponent<{
4
- item: ResolvedSidebarItem;
5
- depth?: number;
6
- }>;
@@ -1,76 +0,0 @@
1
- import { h } from 'vue';
2
- import { useRoute } from 'vue-router';
3
- import NavLink from './NavLink.vue';
4
- const normalizePath = (path) => decodeURI(path)
5
- .replace(/#.*$/, '')
6
- .replace(/(index)?\.(md|html)$/, '');
7
- const isActiveLink = (route, link) => {
8
- if (link === undefined) {
9
- return false;
10
- }
11
- if (route.hash === link) {
12
- return true;
13
- }
14
- const currentPath = normalizePath(route.path);
15
- const targetPath = normalizePath(link);
16
- return currentPath === targetPath;
17
- };
18
- const isActiveItem = (route, item) => {
19
- if (isActiveLink(route, item.link)) {
20
- return true;
21
- }
22
- if (item.children) {
23
- return item.children.some((child) => isActiveItem(route, child));
24
- }
25
- return false;
26
- };
27
- const renderItem = (item, props) => {
28
- // if the item has link, render it as `<NavLink>`
29
- if (item.link) {
30
- return h(NavLink, {
31
- ...props,
32
- item,
33
- });
34
- }
35
- // if the item only has text, render it as `<p>`
36
- return h('p', props, item.text);
37
- };
38
- const renderChildren = (item, depth) => {
39
- var _a;
40
- if (!((_a = item.children) === null || _a === void 0 ? void 0 : _a.length)) {
41
- return null;
42
- }
43
- return h('ul', {
44
- class: {
45
- 'sidebar-sub-items': depth > 0,
46
- },
47
- }, item.children.map((child) => h('li', h(SidebarChild, {
48
- item: child,
49
- depth: depth + 1,
50
- }))));
51
- };
52
- export const SidebarChild = ({ item, depth = 0 }) => {
53
- const route = useRoute();
54
- const active = isActiveItem(route, item);
55
- return [
56
- renderItem(item, {
57
- class: {
58
- 'sidebar-heading': depth === 0,
59
- 'sidebar-item': true,
60
- active,
61
- },
62
- }),
63
- renderChildren(item, depth),
64
- ];
65
- };
66
- SidebarChild.displayName = 'SidebarChild';
67
- SidebarChild.props = {
68
- item: {
69
- type: Object,
70
- required: true,
71
- },
72
- depth: {
73
- type: Number,
74
- required: false,
75
- },
76
- };
@@ -1,12 +0,0 @@
1
- <script setup lang="ts">
2
- import { ExternalLinkIcon as RawExternalLinkIcon } from '@vuepress/plugin-external-link-icon/lib/client'
3
- import { useThemeLocaleData } from '../../composables'
4
-
5
- const themeLocale = useThemeLocaleData()
6
- </script>
7
-
8
- <template>
9
- <RawExternalLinkIcon>
10
- <span class="sr-only">{{ themeLocale.openInNewWindow }}</span>
11
- </RawExternalLinkIcon>
12
- </template>
@@ -1,12 +0,0 @@
1
- .sr-only {
2
- position: absolute;
3
- width: 1px;
4
- height: 1px;
5
- padding: 0;
6
- margin: -1px;
7
- overflow: hidden;
8
- clip: rect(0, 0, 0, 0);
9
- white-space: nowrap;
10
- border-width: 0;
11
- user-select: none;
12
- }