@vuepress/theme-default 2.0.0-rc.8 → 2.0.0-rc.80
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.
- package/lib/client/components/VPAutoLink.vue +32 -0
- package/lib/client/components/VPDarkIcon.vue +8 -0
- package/lib/client/components/VPDropdownTransition.vue +43 -0
- package/lib/client/components/VPEditIcon.vue +12 -0
- package/lib/client/components/VPFadeSlideYTransition.vue +43 -0
- package/lib/client/components/VPHome.vue +38 -0
- package/lib/client/components/VPHomeFeatures.vue +65 -0
- package/lib/client/components/{HomeFooter.vue → VPHomeFooter.vue} +16 -3
- package/lib/client/components/VPHomeHero.vue +185 -0
- package/lib/client/components/VPLightIcon.vue +28 -0
- package/lib/client/components/VPNavbar.vue +134 -0
- package/lib/client/components/{NavbarBrand.vue → VPNavbarBrand.vue} +41 -16
- package/lib/client/components/VPNavbarDropdown.vue +331 -0
- package/lib/client/components/VPNavbarItems.vue +111 -0
- package/lib/client/components/VPPage.vue +69 -0
- package/lib/client/components/VPPageMeta.vue +134 -0
- package/lib/client/components/VPPageNav.vue +125 -0
- package/lib/client/components/VPSidebar.vue +113 -0
- package/lib/client/components/VPSidebarItem.vue +186 -0
- package/lib/client/components/{SidebarItems.vue → VPSidebarItems.vue} +27 -7
- package/lib/client/components/VPToggleColorModeButton.vue +55 -0
- package/lib/client/components/VPToggleSidebarButton.vue +92 -0
- package/lib/client/components/global/Badge.vue +84 -18
- package/lib/client/components/global/index.d.ts +1 -3
- package/lib/client/components/global/index.js +1 -3
- package/lib/client/composables/index.d.ts +9 -1
- package/lib/client/composables/index.js +9 -1
- package/lib/client/composables/useContributors.d.ts +3 -0
- package/lib/client/composables/useContributors.js +11 -0
- package/lib/client/composables/useDarkMode.d.ts +0 -1
- package/lib/client/composables/useDarkMode.js +19 -16
- package/lib/client/composables/useData.d.ts +13 -0
- package/lib/client/composables/useData.js +15 -0
- package/lib/client/composables/useEditLink.d.ts +3 -0
- package/lib/client/composables/useEditLink.js +28 -0
- package/lib/client/composables/useHeaders.d.ts +9 -0
- package/lib/client/composables/useHeaders.js +38 -0
- package/lib/client/composables/useLastUpdated.d.ts +2 -0
- package/lib/client/composables/useLastUpdated.js +14 -0
- package/lib/client/composables/useNavbarConfig.d.ts +3 -0
- package/lib/client/composables/useNavbarConfig.js +29 -0
- package/lib/client/composables/useNavbarRepo.d.ts +6 -0
- package/lib/client/composables/useNavbarRepo.js +38 -0
- package/lib/client/composables/useNavbarSelectLanguage.d.ts +6 -0
- package/lib/client/composables/useNavbarSelectLanguage.js +55 -0
- package/lib/client/composables/useNavigate.d.ts +1 -0
- package/lib/client/composables/useNavigate.js +22 -0
- package/lib/client/composables/useRelatedLinks.d.ts +8 -0
- package/lib/client/composables/useRelatedLinks.js +90 -0
- package/lib/client/composables/useScrollPromise.js +3 -1
- package/lib/client/composables/useSidebarItems.d.ts +21 -21
- package/lib/client/composables/useSidebarItems.js +96 -86
- package/lib/client/composables/useUpdateDeviceStatus.d.ts +1 -1
- package/lib/client/composables/useUpdateDeviceStatus.js +10 -5
- package/lib/client/config.d.ts +3 -2
- package/lib/client/config.js +8 -23
- package/lib/client/index.d.ts +2 -1
- package/lib/client/index.js +0 -1
- package/lib/client/layouts/Layout.vue +127 -54
- package/lib/client/layouts/NotFound.vue +25 -11
- package/lib/client/shim.d.ts +6 -5
- package/lib/client/styles/_mixins.scss +4 -4
- package/lib/client/styles/_variables.module.scss +1 -1
- package/lib/client/styles/_variables.scss +2 -1
- package/lib/client/styles/arrow.scss +18 -24
- package/lib/client/styles/code-group.scss +35 -30
- package/lib/client/styles/content/code.scss +23 -0
- package/lib/client/styles/content/index.scss +3 -0
- package/lib/client/styles/content/normalize.scss +39 -0
- package/lib/client/styles/{toc.scss → content/toc.scss} +1 -1
- package/lib/client/styles/external-link-icon.scss +36 -0
- package/lib/client/styles/index.scss +3 -13
- package/lib/client/styles/layout.scss +5 -197
- package/lib/client/styles/normalize.scss +1 -194
- package/lib/client/styles/plugins.scss +28 -0
- package/lib/client/styles/vars-dark.scss +20 -58
- package/lib/client/styles/vars.scss +54 -129
- package/lib/client/typings.d.ts +13 -0
- package/lib/client/typings.js +1 -0
- package/lib/client/utils/index.d.ts +2 -2
- package/lib/client/utils/index.js +2 -2
- package/lib/client/utils/isActiveSidebarItem.d.ts +3 -3
- package/lib/client/utils/isActiveSidebarItem.js +1 -1
- package/lib/client/utils/resolveAutoLink.d.ts +9 -0
- package/lib/client/utils/resolveAutoLink.js +17 -0
- package/lib/client/utils/resolveEditLink.d.ts +3 -3
- package/lib/client/utils/resolveEditLink.js +3 -3
- package/lib/client/utils/resolvePrefix.d.ts +1 -0
- package/lib/client/utils/resolvePrefix.js +4 -0
- package/lib/client/utils/resolveRepoType.d.ts +1 -1
- package/lib/client/utils/resolveRepoType.js +4 -4
- package/lib/node/defaultTheme.d.ts +2 -1
- package/lib/node/defaultTheme.js +50 -56
- package/lib/node/index.d.ts +2 -3
- package/lib/node/index.js +0 -3
- package/lib/node/typings.d.ts +58 -0
- package/lib/node/typings.js +1 -0
- package/lib/node/utils/assignDefaultLocaleOptions.js +3 -7
- package/lib/node/utils/index.d.ts +1 -1
- package/lib/node/utils/index.js +1 -1
- package/lib/node/utils/resolveMarkdownHintLocales.d.ts +9 -0
- package/lib/node/utils/resolveMarkdownHintLocales.js +19 -0
- package/lib/shared/index.d.ts +5 -3
- package/lib/shared/index.js +1 -3
- package/lib/shared/nav.d.ts +19 -30
- package/lib/shared/navbar.d.ts +21 -0
- package/lib/shared/navbar.js +1 -0
- package/lib/shared/options.d.ts +36 -65
- package/lib/shared/page.d.ts +9 -6
- package/lib/shared/sidebar.d.ts +26 -0
- package/lib/shared/sidebar.js +1 -0
- package/package.json +29 -27
- package/templates/build.html +16 -10
- package/lib/client/components/AutoLink.vue +0 -113
- package/lib/client/components/DropdownTransition.vue +0 -25
- package/lib/client/components/Home.vue +0 -15
- package/lib/client/components/HomeContent.vue +0 -5
- package/lib/client/components/HomeFeatures.vue +0 -22
- package/lib/client/components/HomeHero.vue +0 -97
- package/lib/client/components/Navbar.vue +0 -79
- package/lib/client/components/NavbarDropdown.vue +0 -126
- package/lib/client/components/NavbarItems.vue +0 -199
- package/lib/client/components/Page.vue +0 -31
- package/lib/client/components/PageMeta.vue +0 -124
- package/lib/client/components/PageNav.vue +0 -122
- package/lib/client/components/Sidebar.vue +0 -18
- package/lib/client/components/SidebarItem.vue +0 -87
- package/lib/client/components/ToggleColorModeButton.vue +0 -57
- package/lib/client/components/ToggleSidebarButton.vue +0 -24
- package/lib/client/components/global/CodeGroup.d.ts +0 -6
- package/lib/client/components/global/CodeGroup.js +0 -120
- package/lib/client/components/global/CodeGroupItem.vue +0 -27
- package/lib/client/composables/useThemeData.d.ts +0 -4
- package/lib/client/composables/useThemeData.js +0 -3
- package/lib/client/styles/badge.scss +0 -36
- package/lib/client/styles/code.scss +0 -263
- package/lib/client/styles/custom-container.scss +0 -142
- package/lib/client/styles/home.scss +0 -168
- package/lib/client/styles/navbar-dropdown.scss +0 -183
- package/lib/client/styles/navbar.scss +0 -197
- package/lib/client/styles/page.scss +0 -87
- package/lib/client/styles/sidebar.scss +0 -134
- package/lib/client/styles/transitions.scss +0 -22
- package/lib/client/utils/getNavLink.d.ts +0 -15
- package/lib/client/utils/getNavLink.js +0 -18
- package/lib/client/utils/getResolveRouteWithRedirect.d.ts +0 -5
- package/lib/client/utils/getResolveRouteWithRedirect.js +0 -22
- package/lib/node/utils/resolveContainerPluginOptions.d.ts +0 -8
- package/lib/node/utils/resolveContainerPluginOptions.js +0 -17
|
@@ -1,87 +1,62 @@
|
|
|
1
|
+
// === colors ===
|
|
1
2
|
:root {
|
|
2
|
-
//
|
|
3
|
-
--c-
|
|
4
|
-
--c-
|
|
3
|
+
// accent colors
|
|
4
|
+
--vp-c-accent: #299764;
|
|
5
|
+
--vp-c-accent-bg: #3eaf7c;
|
|
6
|
+
--vp-c-accent-hover: #4abf8a;
|
|
7
|
+
--vp-c-accent-text: var(--vp-c-white);
|
|
8
|
+
--vp-c-accent-soft: rgb(16 185 129 / 14%);
|
|
5
9
|
|
|
6
10
|
// background colors
|
|
7
|
-
--c-bg: #
|
|
8
|
-
--c-bg-
|
|
9
|
-
--c-bg-
|
|
10
|
-
--c-bg-dark: #ebebec;
|
|
11
|
-
--c-bg-darker: #e6e6e6;
|
|
12
|
-
--c-bg-navbar: var(--c-bg);
|
|
13
|
-
--c-bg-sidebar: var(--c-bg);
|
|
14
|
-
--c-bg-arrow: #cccccc;
|
|
11
|
+
--vp-c-bg: #fff;
|
|
12
|
+
--vp-c-bg-alt: #f6f6f7;
|
|
13
|
+
--vp-c-bg-elv: #fff;
|
|
15
14
|
|
|
16
15
|
// text colors
|
|
17
|
-
--c-text:
|
|
18
|
-
--c-text-
|
|
19
|
-
--c-text-
|
|
20
|
-
--c-text-lighter: #4e6e8e;
|
|
21
|
-
--c-text-lightest: #6a8bad;
|
|
22
|
-
--c-text-quote: #999999;
|
|
16
|
+
--vp-c-text: rgb(60 60 67);
|
|
17
|
+
--vp-c-text-mute: rgb(60 60 67 / 78%);
|
|
18
|
+
--vp-c-text-subtle: rgb(60 60 67 / 56%);
|
|
23
19
|
|
|
24
20
|
// border colors
|
|
25
|
-
--c-
|
|
26
|
-
--c-border
|
|
21
|
+
--vp-c-gutter: #e2e2e3;
|
|
22
|
+
--vp-c-border: #c2c2c4;
|
|
23
|
+
--vp-c-border-hard: #b8b8ba;
|
|
27
24
|
|
|
28
|
-
//
|
|
29
|
-
--c-
|
|
30
|
-
--c-tip-bg: var(--c-bg-light);
|
|
31
|
-
--c-tip-title: var(--c-text);
|
|
32
|
-
--c-tip-text: var(--c-text);
|
|
33
|
-
--c-tip-text-accent: var(--c-text-accent);
|
|
34
|
-
--c-warning: #ffc310;
|
|
35
|
-
--c-warning-bg: #fffae3;
|
|
36
|
-
--c-warning-bg-light: #fff3ba;
|
|
37
|
-
--c-warning-bg-lighter: #fff0b0;
|
|
38
|
-
--c-warning-border-dark: #f7dc91;
|
|
39
|
-
--c-warning-details-bg: #fff5ca;
|
|
40
|
-
--c-warning-title: #f1b300;
|
|
41
|
-
--c-warning-text: #746000;
|
|
42
|
-
--c-warning-text-accent: #edb100;
|
|
43
|
-
--c-warning-text-light: #c1971c;
|
|
44
|
-
--c-warning-text-quote: #ccab49;
|
|
45
|
-
--c-danger: #f11e37;
|
|
46
|
-
--c-danger-bg: #ffe0e0;
|
|
47
|
-
--c-danger-bg-light: #ffcfde;
|
|
48
|
-
--c-danger-bg-lighter: #ffc9c9;
|
|
49
|
-
--c-danger-border-dark: #f1abab;
|
|
50
|
-
--c-danger-details-bg: #ffd4d4;
|
|
51
|
-
--c-danger-title: #ed1e2c;
|
|
52
|
-
--c-danger-text: #660000;
|
|
53
|
-
--c-danger-text-accent: #bd1a1a;
|
|
54
|
-
--c-danger-text-light: #b5474d;
|
|
55
|
-
--c-danger-text-quote: #c15b5b;
|
|
56
|
-
--c-details-bg: #eeeeee;
|
|
25
|
+
// shadow colors
|
|
26
|
+
--vp-c-shadow: rgb(0 0 0 / 15%);
|
|
57
27
|
|
|
58
|
-
//
|
|
59
|
-
--c-
|
|
60
|
-
--c-
|
|
61
|
-
--c-
|
|
62
|
-
--c-badge-danger: #dc2626;
|
|
63
|
-
--c-badge-danger-text: var(--c-bg);
|
|
28
|
+
// control colors
|
|
29
|
+
--vp-c-control: rgb(142 150 170 / 10%);
|
|
30
|
+
--vp-c-control-hover: rgb(142 150 170 / 16%);
|
|
31
|
+
--vp-c-control-disabled: #eaeaea;
|
|
64
32
|
|
|
65
|
-
//
|
|
66
|
-
--
|
|
67
|
-
--
|
|
68
|
-
--c-code-group-tab-outline: var(var(--c-code-group-tab-title));
|
|
69
|
-
--c-code-group-tab-active-border: var(--c-brand);
|
|
70
|
-
|
|
71
|
-
// transition vars
|
|
72
|
-
--t-color: 0.3s ease;
|
|
73
|
-
--t-transform: 0.3s ease;
|
|
33
|
+
// layout colors
|
|
34
|
+
--vp-navbar-c-bg: var(--vp-c-bg);
|
|
35
|
+
--vp-sidebar-c-bg: var(--vp-c-bg);
|
|
74
36
|
|
|
75
|
-
// code
|
|
76
|
-
--code-
|
|
77
|
-
--code-
|
|
78
|
-
--code-
|
|
79
|
-
|
|
37
|
+
// code group colors
|
|
38
|
+
--vp-c-code-tab-title: var(--code-c-text, rgb(255 255 255 / 90%));
|
|
39
|
+
--vp-c-code-tab-bg: var(--code-bg-color, var(--code-c-bg));
|
|
40
|
+
--vp-c-code-tab-active: var(--vp-c-accent);
|
|
41
|
+
|
|
42
|
+
// badge colors
|
|
43
|
+
--badge-c-tip-text: var(--vp-c-green-text);
|
|
44
|
+
--badge-c-tip-bg: var(--vp-c-green-soft);
|
|
45
|
+
--badge-c-warning-text: var(--vp-c-yellow-text);
|
|
46
|
+
--badge-c-warning-bg: var(--vp-c-yellow-soft);
|
|
47
|
+
--badge-c-danger-text: var(--vp-c-red-text);
|
|
48
|
+
--badge-c-danger-bg: var(--vp-c-red-soft);
|
|
49
|
+
--badge-c-important-text: var(--vp-c-purple-text);
|
|
50
|
+
--badge-c-important-bg: var(--vp-c-purple-soft);
|
|
51
|
+
--badge-c-info-text: var(--vp-c-indigo-text);
|
|
52
|
+
--badge-c-info-bg: var(--vp-c-indigo-soft);
|
|
53
|
+
--badge-c-note-text: var(--vp-c-grey-text);
|
|
54
|
+
--badge-c-note-bg: var(--vp-c-grey-soft);
|
|
80
55
|
|
|
81
56
|
// font vars
|
|
82
|
-
--font-family:
|
|
83
|
-
|
|
84
|
-
|
|
57
|
+
--font-family:
|
|
58
|
+
-apple-system, 'BlinkMacSystemFont', 'Segoe UI', roboto, oxygen, ubuntu,
|
|
59
|
+
cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
|
|
85
60
|
|
|
86
61
|
// layout vars
|
|
87
62
|
--navbar-height: 3.6rem;
|
|
@@ -91,65 +66,15 @@
|
|
|
91
66
|
--sidebar-width-mobile: calc(var(--sidebar-width) * 0.82);
|
|
92
67
|
--content-width: 740px;
|
|
93
68
|
--homepage-width: 960px;
|
|
94
|
-
}
|
|
95
69
|
|
|
96
|
-
//
|
|
97
|
-
|
|
98
|
-
--back-to-top-color: var(--c-brand);
|
|
99
|
-
--back-to-top-color-hover: var(--c-brand-light);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// plugin-docsearch
|
|
103
|
-
.DocSearch {
|
|
104
|
-
--docsearch-primary-color: var(--c-brand);
|
|
105
|
-
--docsearch-text-color: var(--c-text);
|
|
106
|
-
--docsearch-highlight-color: var(--c-brand);
|
|
107
|
-
--docsearch-muted-color: var(--c-text-quote);
|
|
108
|
-
--docsearch-container-background: rgba(9, 10, 17, 0.8);
|
|
109
|
-
--docsearch-modal-background: var(--c-bg-light);
|
|
110
|
-
--docsearch-searchbox-background: var(--c-bg-lighter);
|
|
111
|
-
--docsearch-searchbox-focus-background: var(--c-bg);
|
|
112
|
-
--docsearch-searchbox-shadow: inset 0 0 0 2px var(--c-brand);
|
|
113
|
-
--docsearch-hit-color: var(--c-text-light);
|
|
114
|
-
--docsearch-hit-active-color: var(--c-bg);
|
|
115
|
-
--docsearch-hit-background: var(--c-bg);
|
|
116
|
-
--docsearch-hit-shadow: 0 1px 3px 0 var(--c-border-dark);
|
|
117
|
-
--docsearch-footer-background: var(--c-bg);
|
|
118
|
-
}
|
|
70
|
+
// header offset
|
|
71
|
+
--header-offset: var(--navbar-height);
|
|
119
72
|
|
|
120
|
-
//
|
|
121
|
-
|
|
122
|
-
--
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// plugin-medium-zoom
|
|
126
|
-
.medium-zoom-overlay {
|
|
127
|
-
--medium-zoom-bg-color: var(--c-bg);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// plugin-nprogress
|
|
131
|
-
#nprogress {
|
|
132
|
-
--nprogress-color: var(--c-brand);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// plugin-pwa-popup
|
|
136
|
-
.pwa-popup {
|
|
137
|
-
--pwa-popup-text-color: var(--c-text);
|
|
138
|
-
--pwa-popup-bg-color: var(--c-bg);
|
|
139
|
-
--pwa-popup-border-color: var(--c-brand);
|
|
140
|
-
--pwa-popup-shadow: 0 4px 16px var(--c-brand);
|
|
141
|
-
--pwa-popup-btn-text-color: var(--c-bg);
|
|
142
|
-
--pwa-popup-btn-bg-color: var(--c-brand);
|
|
143
|
-
--pwa-popup-btn-hover-bg-color: var(--c-brand-light);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// plugin-search
|
|
147
|
-
.search-box {
|
|
148
|
-
--search-bg-color: var(--c-bg);
|
|
149
|
-
--search-accent-color: var(--c-brand);
|
|
150
|
-
--search-text-color: var(--c-text);
|
|
151
|
-
--search-border-color: var(--c-border);
|
|
73
|
+
// transition vars
|
|
74
|
+
--vp-t-color: 0.3s ease;
|
|
75
|
+
--vp-t-transform: 0.3s ease;
|
|
152
76
|
|
|
153
|
-
|
|
154
|
-
--
|
|
77
|
+
// external-link-icon
|
|
78
|
+
--external-link-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath d='M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5H9z'/%3E%3C/svg%3E");
|
|
79
|
+
--external-link-c-icon: var(--vp-c-text-mute);
|
|
155
80
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AutoLinkOptions, NavGroup, SidebarGroupOptions, SidebarLinkOptions } from '../shared/index.js';
|
|
2
|
+
export type NavbarItem = AutoLinkOptions | NavGroup<NavbarItem>;
|
|
3
|
+
export type SidebarLinkItem = SidebarLinkOptions;
|
|
4
|
+
export interface SidebarHeaderItem {
|
|
5
|
+
text: string;
|
|
6
|
+
link: string;
|
|
7
|
+
children?: SidebarHeaderItem[];
|
|
8
|
+
}
|
|
9
|
+
export interface SidebarGroupItem extends SidebarGroupOptions {
|
|
10
|
+
prefix?: string;
|
|
11
|
+
children: (SidebarHeaderItem | SidebarItem)[];
|
|
12
|
+
}
|
|
13
|
+
export type SidebarItem = SidebarGroupItem | SidebarLinkItem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './getNavLink.js';
|
|
2
|
-
export * from './getResolveRouteWithRedirect.js';
|
|
3
1
|
export * from './isActiveSidebarItem.js';
|
|
2
|
+
export * from './resolveAutoLink.js';
|
|
4
3
|
export * from './resolveEditLink.js';
|
|
4
|
+
export * from './resolvePrefix.js';
|
|
5
5
|
export * from './resolveRepoType.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './getNavLink.js';
|
|
2
|
-
export * from './getResolveRouteWithRedirect.js';
|
|
3
1
|
export * from './isActiveSidebarItem.js';
|
|
2
|
+
export * from './resolveAutoLink.js';
|
|
4
3
|
export * from './resolveEditLink.js';
|
|
4
|
+
export * from './resolvePrefix.js';
|
|
5
5
|
export * from './resolveRepoType.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { RouteLocationNormalizedLoaded } from '
|
|
2
|
-
import type {
|
|
3
|
-
export declare const isActiveSidebarItem: (item:
|
|
1
|
+
import type { RouteLocationNormalizedLoaded } from 'vuepress/client';
|
|
2
|
+
import type { SidebarItem } from '../typings.js';
|
|
3
|
+
export declare const isActiveSidebarItem: (item: SidebarItem, route: RouteLocationNormalizedLoaded) => boolean;
|
|
@@ -13,7 +13,7 @@ export const isActiveSidebarItem = (item, route) => {
|
|
|
13
13
|
if (item.link && isActiveLink(item.link, route)) {
|
|
14
14
|
return true;
|
|
15
15
|
}
|
|
16
|
-
if (item
|
|
16
|
+
if ('children' in item) {
|
|
17
17
|
return item.children.some((child) => isActiveSidebarItem(child, route));
|
|
18
18
|
}
|
|
19
19
|
return false;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AutoLinkOptions } from '../../shared/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve AutoLink props from string
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* - Input: '/README.md'
|
|
7
|
+
* - Output: { text: 'Home', link: '/' }
|
|
8
|
+
*/
|
|
9
|
+
export declare const resolveAutoLink: (config: string, currentPath?: string) => AutoLinkOptions;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { resolveRoute } from 'vuepress/client';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve AutoLink props from string
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* - Input: '/README.md'
|
|
7
|
+
* - Output: { text: 'Home', link: '/' }
|
|
8
|
+
*/
|
|
9
|
+
export const resolveAutoLink = (config, currentPath) => {
|
|
10
|
+
const { notFound, meta, path } = resolveRoute(config, currentPath);
|
|
11
|
+
return notFound
|
|
12
|
+
? { text: path, link: path }
|
|
13
|
+
: {
|
|
14
|
+
text: meta.title || path,
|
|
15
|
+
link: path,
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { RepoType } from '
|
|
2
|
-
export declare const
|
|
1
|
+
import type { RepoType } from '@theme/resolveRepoType';
|
|
2
|
+
export declare const EDIT_LINK_PATTERNS: Record<Exclude<RepoType, null>, string>;
|
|
3
3
|
export declare const resolveEditLink: ({ docsRepo, docsBranch, docsDir, filePathRelative, editLinkPattern, }: {
|
|
4
4
|
docsRepo: string;
|
|
5
5
|
docsBranch: string;
|
|
6
6
|
docsDir: string;
|
|
7
7
|
filePathRelative: string | null;
|
|
8
|
-
editLinkPattern?: string
|
|
8
|
+
editLinkPattern?: string;
|
|
9
9
|
}) => string | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { resolveRepoType } from '@theme/resolveRepoType';
|
|
1
2
|
import { isLinkHttp, removeEndingSlash, removeLeadingSlash, } from 'vuepress/shared';
|
|
2
|
-
|
|
3
|
-
export const editLinkPatterns = {
|
|
3
|
+
export const EDIT_LINK_PATTERNS = {
|
|
4
4
|
GitHub: ':repo/edit/:branch/:path',
|
|
5
5
|
GitLab: ':repo/-/edit/:branch/:path',
|
|
6
6
|
Gitee: ':repo/edit/:branch/:path',
|
|
@@ -12,7 +12,7 @@ const resolveEditLinkPatterns = ({ docsRepo, editLinkPattern, }) => {
|
|
|
12
12
|
}
|
|
13
13
|
const repoType = resolveRepoType(docsRepo);
|
|
14
14
|
if (repoType !== null) {
|
|
15
|
-
return
|
|
15
|
+
return EDIT_LINK_PATTERNS[repoType];
|
|
16
16
|
}
|
|
17
17
|
return null;
|
|
18
18
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const resolvePrefix: (prefix?: string, path?: string) => string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type RepoType = '
|
|
1
|
+
export type RepoType = 'Bitbucket' | 'Gitee' | 'GitHub' | 'GitLab' | null;
|
|
2
2
|
export declare const resolveRepoType: (repo: string) => RepoType;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { isLinkHttp } from 'vuepress/shared';
|
|
2
2
|
export const resolveRepoType = (repo) => {
|
|
3
|
-
if (!isLinkHttp(repo) ||
|
|
3
|
+
if (!isLinkHttp(repo) || repo.includes('github.com'))
|
|
4
4
|
return 'GitHub';
|
|
5
|
-
if (
|
|
5
|
+
if (repo.includes('bitbucket.org'))
|
|
6
6
|
return 'Bitbucket';
|
|
7
|
-
if (
|
|
7
|
+
if (repo.includes('gitlab.com'))
|
|
8
8
|
return 'GitLab';
|
|
9
|
-
if (
|
|
9
|
+
if (repo.includes('gitee.com'))
|
|
10
10
|
return 'Gitee';
|
|
11
11
|
return null;
|
|
12
12
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Theme } from 'vuepress/core';
|
|
2
|
-
import type { DefaultThemeLocaleOptions
|
|
2
|
+
import type { DefaultThemeLocaleOptions } from '../shared/index.js';
|
|
3
|
+
import type { DefaultThemePluginsOptions } from './typings.js';
|
|
3
4
|
export interface DefaultThemeOptions extends DefaultThemeLocaleOptions {
|
|
4
5
|
/**
|
|
5
6
|
* deployed hostname
|
package/lib/node/defaultTheme.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { addViteOptimizeDepsExclude } from '@vuepress/helper';
|
|
1
2
|
import { activeHeaderLinksPlugin } from '@vuepress/plugin-active-header-links';
|
|
2
3
|
import { backToTopPlugin } from '@vuepress/plugin-back-to-top';
|
|
3
|
-
import { containerPlugin } from '@vuepress/plugin-container';
|
|
4
4
|
import { copyCodePlugin } from '@vuepress/plugin-copy-code';
|
|
5
|
-
import { externalLinkIconPlugin } from '@vuepress/plugin-external-link-icon';
|
|
6
5
|
import { gitPlugin } from '@vuepress/plugin-git';
|
|
6
|
+
import { linksCheckPlugin } from '@vuepress/plugin-links-check';
|
|
7
|
+
import { markdownHintPlugin } from '@vuepress/plugin-markdown-hint';
|
|
8
|
+
import { markdownTabPlugin } from '@vuepress/plugin-markdown-tab';
|
|
7
9
|
import { mediumZoomPlugin } from '@vuepress/plugin-medium-zoom';
|
|
8
10
|
import { nprogressPlugin } from '@vuepress/plugin-nprogress';
|
|
9
11
|
import { palettePlugin } from '@vuepress/plugin-palette';
|
|
@@ -13,8 +15,8 @@ import { sitemapPlugin } from '@vuepress/plugin-sitemap';
|
|
|
13
15
|
import { themeDataPlugin } from '@vuepress/plugin-theme-data';
|
|
14
16
|
import { isPlainObject } from 'vuepress/shared';
|
|
15
17
|
import { fs, getDirname, path } from 'vuepress/utils';
|
|
16
|
-
import { assignDefaultLocaleOptions,
|
|
17
|
-
const __dirname = getDirname(import.meta.url);
|
|
18
|
+
import { assignDefaultLocaleOptions, resolveMarkdownHintLocales, } from './utils/index.js';
|
|
19
|
+
const __dirname = import.meta.dirname || getDirname(import.meta.url);
|
|
18
20
|
export const defaultTheme = ({ hostname, themePlugins = {}, ...localeOptions } = {}) => {
|
|
19
21
|
assignDefaultLocaleOptions(localeOptions);
|
|
20
22
|
return {
|
|
@@ -29,8 +31,28 @@ export const defaultTheme = ({ hostname, themePlugins = {}, ...localeOptions } =
|
|
|
29
31
|
`@theme/${file}`,
|
|
30
32
|
path.resolve(__dirname, '../client/components', file),
|
|
31
33
|
])),
|
|
34
|
+
// use alias to make all composables replaceable
|
|
35
|
+
...Object.fromEntries(fs
|
|
36
|
+
.readdirSync(path.resolve(__dirname, '../client/composables'))
|
|
37
|
+
.filter((file) => file.endsWith('.js'))
|
|
38
|
+
.map((file) => [
|
|
39
|
+
`@theme/${file.substring(0, file.length - 3)}`,
|
|
40
|
+
path.resolve(__dirname, '../client/composables', file),
|
|
41
|
+
])),
|
|
42
|
+
// use alias to make all utils replaceable
|
|
43
|
+
...Object.fromEntries(fs
|
|
44
|
+
.readdirSync(path.resolve(__dirname, '../client/utils'))
|
|
45
|
+
.filter((file) => file.endsWith('.js'))
|
|
46
|
+
.map((file) => [
|
|
47
|
+
`@theme/${file.substring(0, file.length - 3)}`,
|
|
48
|
+
path.resolve(__dirname, '../client/utils', file),
|
|
49
|
+
])),
|
|
32
50
|
},
|
|
33
51
|
clientConfigFile: path.resolve(__dirname, '../client/config.js'),
|
|
52
|
+
extendsBundlerOptions: (bundlerOptions, app) => {
|
|
53
|
+
// ensure theme alias is not optimized by Vite
|
|
54
|
+
addViteOptimizeDepsExclude(bundlerOptions, app, '@theme');
|
|
55
|
+
},
|
|
34
56
|
extendsPage: (page) => {
|
|
35
57
|
// save relative file path into page data to generate edit link
|
|
36
58
|
page.data.filePathRelative = page.filePathRelative;
|
|
@@ -41,14 +63,14 @@ export const defaultTheme = ({ hostname, themePlugins = {}, ...localeOptions } =
|
|
|
41
63
|
// @vuepress/plugin-active-header-link
|
|
42
64
|
themePlugins.activeHeaderLinks !== false
|
|
43
65
|
? activeHeaderLinksPlugin({
|
|
44
|
-
headerLinkSelector: 'a.sidebar-item',
|
|
45
|
-
headerAnchorSelector: '.header-anchor',
|
|
46
66
|
// should greater than page transition duration
|
|
47
67
|
delay: 300,
|
|
48
68
|
})
|
|
49
69
|
: [],
|
|
50
70
|
// @vuepress/plugin-back-to-top
|
|
51
|
-
themePlugins.backToTop !== false
|
|
71
|
+
themePlugins.backToTop !== false
|
|
72
|
+
? backToTopPlugin(isPlainObject(themePlugins.backToTop) ? themePlugins.backToTop : {})
|
|
73
|
+
: [],
|
|
52
74
|
// @vuepress/plugin-copy-code
|
|
53
75
|
themePlugins.copyCode !== false
|
|
54
76
|
? copyCodePlugin({
|
|
@@ -57,46 +79,11 @@ export const defaultTheme = ({ hostname, themePlugins = {}, ...localeOptions } =
|
|
|
57
79
|
: {}),
|
|
58
80
|
})
|
|
59
81
|
: [],
|
|
60
|
-
// @vuepress/plugin-container
|
|
61
|
-
themePlugins.
|
|
62
|
-
?
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
? containerPlugin(resolveContainerPluginOptions(localeOptions, 'warning'))
|
|
66
|
-
: [],
|
|
67
|
-
themePlugins.container?.danger !== false
|
|
68
|
-
? containerPlugin(resolveContainerPluginOptions(localeOptions, 'danger'))
|
|
69
|
-
: [],
|
|
70
|
-
themePlugins.container?.details !== false
|
|
71
|
-
? containerPlugin({
|
|
72
|
-
type: 'details',
|
|
73
|
-
before: (info) => `<details class="custom-container details">${info ? `<summary>${info}</summary>` : ''}\n`,
|
|
74
|
-
after: () => '</details>\n',
|
|
75
|
-
})
|
|
76
|
-
: [],
|
|
77
|
-
themePlugins.container?.codeGroup !== false
|
|
78
|
-
? containerPlugin({
|
|
79
|
-
type: 'code-group',
|
|
80
|
-
before: () => `<CodeGroup>\n`,
|
|
81
|
-
after: () => '</CodeGroup>\n',
|
|
82
|
-
})
|
|
83
|
-
: [],
|
|
84
|
-
themePlugins.container?.codeGroupItem !== false
|
|
85
|
-
? containerPlugin({
|
|
86
|
-
type: 'code-group-item',
|
|
87
|
-
before: (info) => `<CodeGroupItem title="${info}">\n`,
|
|
88
|
-
after: () => '</CodeGroupItem>\n',
|
|
89
|
-
})
|
|
90
|
-
: [],
|
|
91
|
-
// @vuepress/plugin-external-link-icon
|
|
92
|
-
themePlugins.externalLinkIcon !== false
|
|
93
|
-
? externalLinkIconPlugin({
|
|
94
|
-
locales: Object.entries(localeOptions.locales || {}).reduce((result, [key, value]) => {
|
|
95
|
-
result[key] = {
|
|
96
|
-
openInNewWindow: value.openInNewWindow ?? localeOptions.openInNewWindow,
|
|
97
|
-
};
|
|
98
|
-
return result;
|
|
99
|
-
}, {}),
|
|
82
|
+
// @vuepress/plugin-markdown-container
|
|
83
|
+
themePlugins.hint !== false
|
|
84
|
+
? markdownHintPlugin({
|
|
85
|
+
locales: resolveMarkdownHintLocales(localeOptions),
|
|
86
|
+
...(isPlainObject(themePlugins.hint) ? themePlugins.hint : {}),
|
|
100
87
|
})
|
|
101
88
|
: [],
|
|
102
89
|
// @vuepress/plugin-git
|
|
@@ -107,21 +94,22 @@ export const defaultTheme = ({ hostname, themePlugins = {}, ...localeOptions } =
|
|
|
107
94
|
contributors: localeOptions.contributors !== false,
|
|
108
95
|
})
|
|
109
96
|
: [],
|
|
110
|
-
// @vuepress/plugin-
|
|
111
|
-
themePlugins.
|
|
112
|
-
?
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
// should greater than page transition duration
|
|
116
|
-
delay: 300,
|
|
117
|
-
})
|
|
97
|
+
// @vuepress/plugin-links-check
|
|
98
|
+
themePlugins.linksCheck !== false
|
|
99
|
+
? linksCheckPlugin(isPlainObject(themePlugins.linksCheck)
|
|
100
|
+
? themePlugins.linksCheck
|
|
101
|
+
: {})
|
|
118
102
|
: [],
|
|
103
|
+
// @vuepress/plugin-medium-zoom
|
|
104
|
+
themePlugins.mediumZoom !== false ? mediumZoomPlugin() : [],
|
|
119
105
|
// @vuepress/plugin-nprogress
|
|
120
106
|
themePlugins.nprogress !== false ? nprogressPlugin() : [],
|
|
121
107
|
// @vuepress/plugin-palette
|
|
122
108
|
palettePlugin({ preset: 'sass' }),
|
|
123
109
|
// @vuepress/plugin-prismjs
|
|
124
|
-
themePlugins.prismjs !== false
|
|
110
|
+
themePlugins.prismjs !== false
|
|
111
|
+
? prismjsPlugin(isPlainObject(themePlugins.prismjs) ? themePlugins.prismjs : {})
|
|
112
|
+
: [],
|
|
125
113
|
// @vuepress/plugin-seo
|
|
126
114
|
hostname && themePlugins.seo !== false
|
|
127
115
|
? seoPlugin({
|
|
@@ -138,6 +126,12 @@ export const defaultTheme = ({ hostname, themePlugins = {}, ...localeOptions } =
|
|
|
138
126
|
: {}),
|
|
139
127
|
})
|
|
140
128
|
: [],
|
|
129
|
+
// @vuepress/plugin-markdown-tab
|
|
130
|
+
themePlugins.tab !== false
|
|
131
|
+
? markdownTabPlugin(isPlainObject(themePlugins.tab)
|
|
132
|
+
? themePlugins.tab
|
|
133
|
+
: { codeTabs: true, tabs: true })
|
|
134
|
+
: [],
|
|
141
135
|
// @vuepress/plugin-theme-data
|
|
142
136
|
themeDataPlugin({ themeData: localeOptions }),
|
|
143
137
|
],
|
package/lib/node/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { defaultTheme } from './defaultTheme.js';
|
|
2
|
-
export * from '../shared/index.js';
|
|
3
1
|
export * from './defaultTheme.js';
|
|
2
|
+
export type * from './typings.js';
|
|
4
3
|
export * from './utils/index.js';
|
|
5
|
-
export
|
|
4
|
+
export type * from '../shared/index.js';
|
package/lib/node/index.js
CHANGED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { BackToTopPluginOptions } from '@vuepress/plugin-back-to-top';
|
|
2
|
+
import type { CopyCodePluginOptions } from '@vuepress/plugin-copy-code';
|
|
3
|
+
import type { LinksCheckPluginOptions } from '@vuepress/plugin-links-check';
|
|
4
|
+
import type { MarkdownHintPluginOptions } from '@vuepress/plugin-markdown-hint';
|
|
5
|
+
import type { MarkdownTabPluginOptions } from '@vuepress/plugin-markdown-tab';
|
|
6
|
+
import type { PrismjsPluginOptions } from '@vuepress/plugin-prismjs';
|
|
7
|
+
import type { SeoPluginOptions } from '@vuepress/plugin-seo';
|
|
8
|
+
import type { SitemapPluginOptions } from '@vuepress/plugin-sitemap';
|
|
9
|
+
export interface DefaultThemePluginsOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Enable @vuepress/plugin-active-header-links or not
|
|
12
|
+
*/
|
|
13
|
+
activeHeaderLinks?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Enable @vuepress/plugin-back-to-top or not
|
|
16
|
+
*/
|
|
17
|
+
backToTop?: BackToTopPluginOptions | boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Enable @vuepress/plugin-copy-code or not
|
|
20
|
+
*/
|
|
21
|
+
copyCode?: CopyCodePluginOptions | boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Enable @vuepress/plugin-git or not
|
|
24
|
+
*/
|
|
25
|
+
git?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Enable @vuepress/plugin-markdown-hint or not
|
|
28
|
+
*/
|
|
29
|
+
hint?: MarkdownHintPluginOptions | boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Enable @vuepress/plugin-links-check or not
|
|
32
|
+
*/
|
|
33
|
+
linksCheck?: LinksCheckPluginOptions | boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Enable @vuepress/plugin-medium-zoom or not
|
|
36
|
+
*/
|
|
37
|
+
mediumZoom?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Enable @vuepress/plugin-nprogress or not
|
|
40
|
+
*/
|
|
41
|
+
nprogress?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Enable @vuepress/plugin-prismjs or not
|
|
44
|
+
*/
|
|
45
|
+
prismjs?: PrismjsPluginOptions | boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Enable @vuepress/plugin-seo or not
|
|
48
|
+
*/
|
|
49
|
+
seo?: Partial<SeoPluginOptions> | boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Enable @vuepress/plugin-sitemap or not
|
|
52
|
+
*/
|
|
53
|
+
sitemap?: Partial<SitemapPluginOptions> | boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Enable @vuepress/plugin-markdown-tab or not
|
|
56
|
+
*/
|
|
57
|
+
tab?: MarkdownTabPluginOptions | boolean;
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -9,7 +9,7 @@ export const DEFAULT_LOCALE_OPTIONS = {
|
|
|
9
9
|
selectLanguageText: 'Languages',
|
|
10
10
|
selectLanguageAriaLabel: 'Select language',
|
|
11
11
|
// sidebar
|
|
12
|
-
sidebar: '
|
|
12
|
+
sidebar: 'heading',
|
|
13
13
|
sidebarDepth: 2,
|
|
14
14
|
// page meta
|
|
15
15
|
editLink: true,
|
|
@@ -39,16 +39,12 @@ export const DEFAULT_LOCALE_DATA = {
|
|
|
39
39
|
* Assign default options
|
|
40
40
|
*/
|
|
41
41
|
export const assignDefaultLocaleOptions = (localeOptions) => {
|
|
42
|
-
|
|
43
|
-
localeOptions.locales = {};
|
|
44
|
-
}
|
|
45
|
-
if (!localeOptions.locales['/']) {
|
|
46
|
-
localeOptions.locales['/'] = {};
|
|
47
|
-
}
|
|
42
|
+
localeOptions.locales ??= {};
|
|
48
43
|
Object.assign(localeOptions, {
|
|
49
44
|
...DEFAULT_LOCALE_OPTIONS,
|
|
50
45
|
...localeOptions,
|
|
51
46
|
});
|
|
47
|
+
localeOptions.locales['/'] ??= {};
|
|
52
48
|
Object.assign(localeOptions.locales['/'], {
|
|
53
49
|
...DEFAULT_LOCALE_DATA,
|
|
54
50
|
...localeOptions.locales['/'],
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './assignDefaultLocaleOptions.js';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './resolveMarkdownHintLocales.js';
|
package/lib/node/utils/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './assignDefaultLocaleOptions.js';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './resolveMarkdownHintLocales.js';
|