vitepress 1.0.0-draft.3 → 1.0.0-draft.6
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/README.md +3 -1
- package/bin/vitepress.js +1 -1
- package/dist/client/app/composables/head.js +2 -2
- package/dist/client/app/data.js +2 -4
- package/dist/client/app/index.js +1 -5
- package/dist/client/index.d.ts +123 -134
- package/dist/client/index.js +1 -2
- package/dist/client/shared.js +21 -0
- package/dist/client/theme-default/Layout.vue +7 -0
- package/dist/client/theme-default/NotFound.vue +74 -14
- package/dist/client/theme-default/components/VPBox.vue +2 -6
- package/dist/client/theme-default/components/VPButton.vue +0 -1
- package/dist/client/theme-default/components/VPCarbonAds.vue +90 -0
- package/dist/client/theme-default/components/VPContent.vue +14 -10
- package/dist/client/theme-default/components/VPDoc.vue +73 -58
- package/dist/client/theme-default/components/VPDocAside.vue +34 -0
- package/dist/client/theme-default/components/VPDocAsideCarbonAds.vue +13 -0
- package/dist/client/theme-default/components/{VPDocOutline.vue → VPDocAsideOutline.vue} +14 -3
- package/dist/client/theme-default/components/VPDocAsideSponsors.vue +32 -0
- package/dist/client/theme-default/components/VPDocFooter.vue +1 -1
- package/dist/client/theme-default/components/VPFlyout.vue +2 -3
- package/dist/client/theme-default/components/VPFooter.vue +1 -1
- package/dist/client/theme-default/components/VPHero.vue +170 -29
- package/dist/client/theme-default/components/VPHomeFeatures.vue +1 -0
- package/dist/client/theme-default/components/VPHomeHero.vue +1 -0
- package/dist/client/theme-default/components/VPHomeSponsors.vue +3 -3
- package/dist/client/theme-default/components/VPLink.vue +2 -1
- package/dist/client/theme-default/components/VPLocalNav.vue +1 -1
- package/dist/client/theme-default/components/VPMenu.vue +9 -14
- package/dist/client/theme-default/components/VPMenuLink.vue +10 -4
- package/dist/client/theme-default/components/VPNav.vue +18 -1
- package/dist/client/theme-default/components/VPNavBar.vue +20 -8
- package/dist/client/theme-default/components/VPNavBarExtra.vue +20 -45
- package/dist/client/theme-default/components/VPNavBarMenuGroup.vue +2 -8
- package/dist/client/theme-default/components/VPNavBarMenuLink.vue +3 -3
- package/dist/client/theme-default/components/VPNavBarSearch.vue +6 -6
- package/dist/client/theme-default/components/VPNavBarTitle.vue +4 -2
- package/dist/client/theme-default/components/VPNavBarTranslations.vue +10 -39
- package/dist/client/theme-default/components/VPNavScreenMenuGroup.vue +1 -2
- package/dist/client/theme-default/components/VPNavScreenMenuGroupSection.vue +1 -1
- package/dist/client/theme-default/components/VPSidebar.vue +12 -6
- package/dist/client/theme-default/components/VPSidebarGroup.vue +80 -17
- package/dist/client/theme-default/components/VPSidebarLink.vue +2 -9
- package/dist/client/theme-default/components/VPSocialLink.vue +2 -2
- package/dist/client/theme-default/components/VPSocialLinks.vue +1 -1
- package/dist/client/theme-default/components/VPSponsors.vue +15 -40
- package/dist/client/theme-default/components/VPSponsorsGrid.vue +2 -2
- package/dist/client/theme-default/components/icons/VPIconMinus.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconMinusSquare.vue +6 -0
- package/dist/client/theme-default/components/icons/VPIconPlusSquare.vue +6 -0
- package/dist/client/theme-default/composables/aside.js +17 -0
- package/dist/client/theme-default/composables/copy-code.js +33 -0
- package/dist/client/theme-default/composables/outline.js +14 -4
- package/dist/client/theme-default/composables/sponsor-grid.js +8 -6
- package/dist/client/theme-default/index.js +4 -2
- package/dist/client/theme-default/styles/base.css +13 -1
- package/dist/client/theme-default/styles/components/custom-block.css +90 -0
- package/dist/client/theme-default/styles/{vp-doc.css → components/vp-doc.css} +152 -115
- package/dist/client/theme-default/styles/{vp-sponsor.css → components/vp-sponsor.css} +51 -7
- package/dist/client/theme-default/styles/vars.css +109 -58
- package/dist/node/cli.js +32 -31
- package/dist/node/index.d.ts +371 -361
- package/dist/node/index.js +22 -37
- package/dist/node/serve-9c85885c.js +64795 -0
- package/dist/node-cjs/cli.cjs +304 -0
- package/dist/node-cjs/index.cjs +38 -0
- package/dist/{node/serve-b5dc02b2.js → node-cjs/serve-a73b4871.cjs} +27405 -28602
- package/package.json +47 -40
- package/theme.d.ts +7 -2
- package/types/default-theme.d.ts +15 -2
- package/types/shared.d.ts +3 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import '@docsearch/css'
|
|
3
|
-
import { useData } from 'vitepress'
|
|
4
3
|
import { defineAsyncComponent, ref, onMounted, onUnmounted } from 'vue'
|
|
4
|
+
import { useData } from 'vitepress'
|
|
5
5
|
|
|
6
|
-
const VPAlgoliaSearchBox =
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const VPAlgoliaSearchBox = __ALGOLIA__
|
|
7
|
+
? defineAsyncComponent(() => import('./VPAlgoliaSearchBox.vue'))
|
|
8
|
+
: () => null
|
|
9
9
|
|
|
10
10
|
const { theme } = useData()
|
|
11
11
|
|
|
@@ -161,12 +161,12 @@ function load() {
|
|
|
161
161
|
padding: 0 10px 0 12px;
|
|
162
162
|
width: 100%;
|
|
163
163
|
height: 40px;
|
|
164
|
-
background-color: var(--vp-c-bg-
|
|
164
|
+
background-color: var(--vp-c-bg-alt);
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
.DocSearch-Button:hover {
|
|
168
168
|
border-color: var(--vp-c-brand);
|
|
169
|
-
background: var(--vp-c-bg-
|
|
169
|
+
background: var(--vp-c-bg-alt);
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
|
|
@@ -18,14 +18,16 @@ const { hasSidebar } = useSidebar()
|
|
|
18
18
|
<style scoped>
|
|
19
19
|
.VPNavBarTitle {
|
|
20
20
|
flex-shrink: 0;
|
|
21
|
+
border-bottom: 1px solid transparent;
|
|
22
|
+
transition: background-color 0.5s;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
@media (min-width: 960px) {
|
|
24
26
|
.VPNavBarTitle.has-sidebar {
|
|
25
27
|
margin-right: 32px;
|
|
26
28
|
width: calc(var(--vp-sidebar-width) - 64px);
|
|
27
|
-
border-bottom:
|
|
28
|
-
background-color: var(--vp-c-bg-
|
|
29
|
+
border-bottom-color: var(--vp-c-divider-light);
|
|
30
|
+
background-color: var(--vp-c-bg-alt);
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
33
|
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { ref } from 'vue'
|
|
3
2
|
import { useData } from 'vitepress'
|
|
4
3
|
import VPIconLanguages from './icons/VPIconLanguages.vue'
|
|
5
4
|
import VPFlyout from './VPFlyout.vue'
|
|
5
|
+
import VPMenuLink from './VPMenuLink.vue'
|
|
6
6
|
|
|
7
7
|
const { theme } = useData()
|
|
8
|
-
|
|
9
|
-
const isOpen = ref(false)
|
|
10
|
-
|
|
11
|
-
function toggle() {
|
|
12
|
-
isOpen.value = !isOpen.value
|
|
13
|
-
}
|
|
14
8
|
</script>
|
|
15
9
|
|
|
16
10
|
<template>
|
|
@@ -19,16 +13,12 @@ function toggle() {
|
|
|
19
13
|
class="VPNavBarTranslations"
|
|
20
14
|
:icon="VPIconLanguages"
|
|
21
15
|
>
|
|
22
|
-
<div class="
|
|
23
|
-
<p class="title">
|
|
24
|
-
{{ theme.localeLinks.text }}
|
|
25
|
-
</p>
|
|
16
|
+
<div class="items">
|
|
17
|
+
<p class="title">{{ theme.localeLinks.text }}</p>
|
|
26
18
|
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
</li>
|
|
31
|
-
</ul>
|
|
19
|
+
<template v-for="locale in theme.localeLinks.items" :key="locale.link">
|
|
20
|
+
<VPMenuLink :item="locale" />
|
|
21
|
+
</template>
|
|
32
22
|
</div>
|
|
33
23
|
</VPFlyout>
|
|
34
24
|
</template>
|
|
@@ -45,30 +35,11 @@ function toggle() {
|
|
|
45
35
|
}
|
|
46
36
|
}
|
|
47
37
|
|
|
48
|
-
.container {
|
|
49
|
-
padding: 0 16px;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
38
|
.title {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
font-size:
|
|
56
|
-
font-weight:
|
|
57
|
-
color: var(--vp-c-text-1);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.lang {
|
|
61
|
-
padding: 4px 0 0 0;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.link {
|
|
65
|
-
line-height: 28px;
|
|
66
|
-
font-size: 13px;
|
|
39
|
+
padding: 0 24px 0 12px;
|
|
40
|
+
line-height: 32px;
|
|
41
|
+
font-size: 14px;
|
|
42
|
+
font-weight: 700;
|
|
67
43
|
color: var(--vp-c-text-1);
|
|
68
|
-
transition: color 0.25s;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.link:hover {
|
|
72
|
-
color: var(--vp-c-brand);
|
|
73
44
|
}
|
|
74
45
|
</style>
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { computed, ref } from 'vue'
|
|
3
|
-
import { DefaultTheme } from 'vitepress'
|
|
4
3
|
import VPIconPlus from './icons/VPIconPlus.vue'
|
|
5
4
|
import VPNavScreenMenuGroupLink from './VPNavScreenMenuGroupLink.vue'
|
|
6
5
|
import VPNavScreenMenuGroupSection from './VPNavScreenMenuGroupSection.vue'
|
|
7
6
|
|
|
8
7
|
const props = defineProps<{
|
|
9
8
|
text: string
|
|
10
|
-
items:
|
|
9
|
+
items: any[]
|
|
11
10
|
}>()
|
|
12
11
|
|
|
13
12
|
const isOpen = ref(false)
|
|
@@ -34,7 +34,12 @@ watchPostEffect(async () => {
|
|
|
34
34
|
</span>
|
|
35
35
|
|
|
36
36
|
<div v-for="group in sidebar" :key="group.text" class="group">
|
|
37
|
-
<VPSidebarGroup
|
|
37
|
+
<VPSidebarGroup
|
|
38
|
+
:text="group.text"
|
|
39
|
+
:items="group.items"
|
|
40
|
+
:collapsible="group.collapsible"
|
|
41
|
+
:collapsed="group.collapsed"
|
|
42
|
+
/>
|
|
38
43
|
</div>
|
|
39
44
|
</nav>
|
|
40
45
|
</aside>
|
|
@@ -80,7 +85,7 @@ watchPostEffect(async () => {
|
|
|
80
85
|
width: var(--vp-sidebar-width);
|
|
81
86
|
max-width: 100%;
|
|
82
87
|
width: var(--vp-sidebar-width);
|
|
83
|
-
background-color: var(--vp-c-bg-
|
|
88
|
+
background-color: var(--vp-c-bg-alt);
|
|
84
89
|
opacity: 1;
|
|
85
90
|
visibility: visible;
|
|
86
91
|
box-shadow: none;
|
|
@@ -91,8 +96,8 @@ watchPostEffect(async () => {
|
|
|
91
96
|
|
|
92
97
|
@media (min-width: 1440px) {
|
|
93
98
|
.VPSidebar {
|
|
94
|
-
padding-left: calc((100% - var(--vp-layout-max-width)) / 2);
|
|
95
|
-
width: calc((100% - var(--vp-layout-max-width)) / 2 + var(--vp-sidebar-width) - 32px);
|
|
99
|
+
padding-left: calc((100% - (var(--vp-layout-max-width) - 64px)) / 2);
|
|
100
|
+
width: calc((100% - (var(--vp-layout-max-width) - 64px)) / 2 + var(--vp-sidebar-width) - 32px);
|
|
96
101
|
}
|
|
97
102
|
}
|
|
98
103
|
|
|
@@ -103,12 +108,13 @@ watchPostEffect(async () => {
|
|
|
103
108
|
.group + .group {
|
|
104
109
|
margin-top: 32px;
|
|
105
110
|
border-top: 1px solid var(--vp-c-divider-light);
|
|
106
|
-
padding-top:
|
|
111
|
+
padding-top: 10px;
|
|
107
112
|
}
|
|
108
113
|
|
|
109
114
|
@media (min-width: 960px) {
|
|
110
115
|
.group {
|
|
111
|
-
padding-top:
|
|
116
|
+
padding-top: 10px;
|
|
117
|
+
width: calc(var(--vp-sidebar-width) - 64px);
|
|
112
118
|
}
|
|
113
119
|
|
|
114
120
|
.group + .group {
|
|
@@ -1,44 +1,107 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import {
|
|
2
|
+
import { ref } from 'vue'
|
|
3
3
|
import { DefaultTheme } from '../config'
|
|
4
|
+
import VPIconPlusSquare from './icons/VPIconPlusSquare.vue'
|
|
5
|
+
import VPIconMinusSquare from './icons/VPIconMinusSquare.vue'
|
|
4
6
|
import VPSidebarLink from './VPSidebarLink.vue'
|
|
5
7
|
|
|
6
8
|
const props = defineProps<{
|
|
7
9
|
text: string
|
|
8
10
|
items: DefaultTheme.SidebarItem[]
|
|
11
|
+
collapsible?: boolean
|
|
12
|
+
collapsed?: boolean
|
|
9
13
|
}>()
|
|
10
14
|
|
|
11
|
-
const
|
|
15
|
+
const collapsed = ref(props.collapsible && props.collapsed)
|
|
16
|
+
|
|
17
|
+
function toggle() {
|
|
18
|
+
if (props.collapsible) {
|
|
19
|
+
collapsed.value = !collapsed.value
|
|
20
|
+
}
|
|
21
|
+
}
|
|
12
22
|
</script>
|
|
13
23
|
|
|
14
24
|
<template>
|
|
15
|
-
<section class="VPSidebarGroup">
|
|
16
|
-
<div class="title">
|
|
25
|
+
<section class="VPSidebarGroup" :class="{ collapsible, collapsed }">
|
|
26
|
+
<div class="title" :role="collapsible ? 'button' : undefined" @click="toggle">
|
|
17
27
|
<h2 class="title-text">{{ text }}</h2>
|
|
28
|
+
<div class="action">
|
|
29
|
+
<VPIconMinusSquare class="icon minus" />
|
|
30
|
+
<VPIconPlusSquare class="icon plus" />
|
|
31
|
+
</div>
|
|
18
32
|
</div>
|
|
19
33
|
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
|
|
34
|
+
<div class="items">
|
|
35
|
+
<template v-for="item in items" :key="item.link">
|
|
36
|
+
<VPSidebarLink :item="item" />
|
|
37
|
+
</template>
|
|
38
|
+
</div>
|
|
23
39
|
</section>
|
|
24
40
|
</template>
|
|
25
41
|
|
|
26
42
|
<style scoped>
|
|
27
43
|
.title {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
.title {
|
|
33
|
-
padding: 4px 0;
|
|
34
|
-
}
|
|
44
|
+
display: flex;
|
|
45
|
+
justify-content: space-between;
|
|
46
|
+
align-items: flex-start;
|
|
47
|
+
z-index: 2;
|
|
35
48
|
}
|
|
36
49
|
|
|
37
50
|
.title-text {
|
|
51
|
+
padding-top: 6px;
|
|
52
|
+
padding-bottom: 6px;
|
|
38
53
|
line-height: 20px;
|
|
39
|
-
font-size:
|
|
40
|
-
font-weight:
|
|
54
|
+
font-size: 14px;
|
|
55
|
+
font-weight: 700;
|
|
41
56
|
color: var(--vp-c-text-1);
|
|
42
|
-
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.action {
|
|
60
|
+
display: none;
|
|
61
|
+
position: relative;
|
|
62
|
+
margin-right: -8px;
|
|
63
|
+
border-radius: 4px;
|
|
64
|
+
width: 32px;
|
|
65
|
+
height: 32px;
|
|
66
|
+
color: var(--vp-c-text-3);
|
|
67
|
+
transition: color 0.25s;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.VPSidebarGroup.collapsible .action {
|
|
71
|
+
display: block;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.title:hover .action {
|
|
75
|
+
color: var(--vp-c-text-2);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.icon {
|
|
79
|
+
position: absolute;
|
|
80
|
+
top: 8px;
|
|
81
|
+
left: 8px;
|
|
82
|
+
width: 16px;
|
|
83
|
+
height: 16px;
|
|
84
|
+
fill: currentColor;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.icon.minus { opacity: 1; }
|
|
88
|
+
.icon.plus { opacity: 0; }
|
|
89
|
+
|
|
90
|
+
.VPSidebarGroup.collapsed .icon.minus { opacity: 0; }
|
|
91
|
+
.VPSidebarGroup.collapsed .icon.plus { opacity: 1; }
|
|
92
|
+
|
|
93
|
+
.items {
|
|
94
|
+
overflow: hidden;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.VPSidebarGroup.collapsed .items {
|
|
98
|
+
margin-bottom: -22px;
|
|
99
|
+
max-height: 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@media (min-width: 960px) {
|
|
103
|
+
.VPSidebarGroup.collapsed .items {
|
|
104
|
+
margin-bottom: -14px;
|
|
105
|
+
}
|
|
43
106
|
}
|
|
44
107
|
</style>
|
|
@@ -31,25 +31,18 @@ const closeSideBar = inject('close-sidebar') as () => void
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
.link:hover .link-text {
|
|
34
|
-
color: var(--vp-c-
|
|
34
|
+
color: var(--vp-c-text-1);
|
|
35
35
|
transition: color 0.25s;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
.link.active .link-text {
|
|
39
|
-
font-weight: 600;
|
|
40
39
|
color: var(--vp-c-brand);
|
|
41
40
|
transition: color 0.25s;
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
@media (min-width: 960px) {
|
|
45
|
-
.link {
|
|
46
|
-
padding: 4px 0;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
43
|
.link-text {
|
|
51
44
|
line-height: 20px;
|
|
52
|
-
font-size:
|
|
45
|
+
font-size: 14px;
|
|
53
46
|
font-weight: 500;
|
|
54
47
|
color: var(--vp-c-text-2);
|
|
55
48
|
transition: color 0.5s;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { DefaultTheme } from '
|
|
2
|
+
import { DefaultTheme } from '../config'
|
|
3
3
|
import VPIconDiscord from './icons/VPIconDiscord.vue'
|
|
4
4
|
import VPIconFacebook from './icons/VPIconFacebook.vue'
|
|
5
5
|
import VPIconGitHub from './icons/VPIconGitHub.vue'
|
|
@@ -9,7 +9,7 @@ import VPIconSlack from './icons/VPIconSlack.vue'
|
|
|
9
9
|
import VPIconTwitter from './icons/VPIconTwitter.vue'
|
|
10
10
|
import VPIconYouTube from './icons/VPIconYouTube.vue'
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
defineProps<{
|
|
13
13
|
icon: DefaultTheme.SocialLinkIcon
|
|
14
14
|
link: string
|
|
15
15
|
}>()
|
|
@@ -2,26 +2,29 @@
|
|
|
2
2
|
import { computed } from 'vue'
|
|
3
3
|
import VPSponsorsGrid from './VPSponsorsGrid.vue'
|
|
4
4
|
|
|
5
|
-
interface Sponsors {
|
|
5
|
+
export interface Sponsors {
|
|
6
6
|
tier?: string
|
|
7
7
|
size?: 'small' | 'medium' | 'big'
|
|
8
8
|
items: Sponsor[]
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
interface Sponsor {
|
|
11
|
+
export interface Sponsor {
|
|
12
12
|
name: string
|
|
13
13
|
img: string
|
|
14
14
|
url: string
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
const props = defineProps<{
|
|
18
|
+
mode?: 'normal' | 'aside'
|
|
18
19
|
tier?: string
|
|
19
|
-
size?: 'small' | 'medium' | 'big'
|
|
20
|
-
data:
|
|
20
|
+
size?: 'xmini' | 'small' | 'medium' | 'big'
|
|
21
|
+
data: Sponsors[] | Sponsor[]
|
|
21
22
|
}>()
|
|
22
23
|
|
|
23
24
|
const sponsors = computed(() => {
|
|
24
|
-
const isSponsors = props.data.some((s
|
|
25
|
+
const isSponsors = props.data.some((s) => {
|
|
26
|
+
return !!(s as Sponsors).items
|
|
27
|
+
})
|
|
25
28
|
|
|
26
29
|
if (isSponsors) {
|
|
27
30
|
return props.data
|
|
@@ -36,42 +39,14 @@ const sponsors = computed(() => {
|
|
|
36
39
|
</script>
|
|
37
40
|
|
|
38
41
|
<template>
|
|
39
|
-
<div class="VPSponsors">
|
|
40
|
-
<section
|
|
41
|
-
|
|
42
|
+
<div class="VPSponsors vp-sponsor" :class="[mode ?? 'normal']">
|
|
43
|
+
<section
|
|
44
|
+
v-for="(sponsor, index) in sponsors"
|
|
45
|
+
:key="index"
|
|
46
|
+
class="vp-sponsor-section"
|
|
47
|
+
>
|
|
48
|
+
<h3 v-if="sponsor.tier" class="vp-sponsor-tier">{{ sponsor.tier }}</h3>
|
|
42
49
|
<VPSponsorsGrid :size="sponsor.size" :data="sponsor.items" />
|
|
43
50
|
</section>
|
|
44
51
|
</div>
|
|
45
52
|
</template>
|
|
46
|
-
|
|
47
|
-
<style scoped>
|
|
48
|
-
.VPSponsors {
|
|
49
|
-
border-radius: 16px;
|
|
50
|
-
overflow: hidden;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.section + .section {
|
|
54
|
-
margin-top: 4px;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.tier {
|
|
58
|
-
margin-bottom: 4px;
|
|
59
|
-
padding: 13px 0 11px;
|
|
60
|
-
text-align: center;
|
|
61
|
-
letter-spacing: 1px;
|
|
62
|
-
line-height: 24px;
|
|
63
|
-
width: 100%;
|
|
64
|
-
font-size: 14px;
|
|
65
|
-
font-weight: 600;
|
|
66
|
-
color: var(--vp-c-text-2);
|
|
67
|
-
background-color: var(--vp-c-white-soft);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.dark .tier {
|
|
71
|
-
background-color: var(--vp-c-black-mute);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.VPSponsorsGrid + .tier {
|
|
75
|
-
margin-top: 4px;
|
|
76
|
-
}
|
|
77
|
-
</style>
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import { ref } from 'vue'
|
|
3
3
|
import { useSponsorsGrid } from '../composables/sponsor-grid'
|
|
4
4
|
|
|
5
|
-
interface Sponsor {
|
|
5
|
+
export interface Sponsor {
|
|
6
6
|
name: string
|
|
7
7
|
img: string
|
|
8
8
|
url: string
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
const props = defineProps<{
|
|
12
|
-
size?: 'small' | 'medium' | 'big'
|
|
12
|
+
size?: 'xmini' | 'mini' | 'small' | 'medium' | 'big'
|
|
13
13
|
data: Sponsor[]
|
|
14
14
|
}>()
|
|
15
15
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24">
|
|
3
|
+
<path d="M19,2H5C3.3,2,2,3.3,2,5v14c0,1.7,1.3,3,3,3h14c1.7,0,3-1.3,3-3V5C22,3.3,20.7,2,19,2zM20,19c0,0.6-0.4,1-1,1H5c-0.6,0-1-0.4-1-1V5c0-0.6,0.4-1,1-1h14c0.6,0,1,0.4,1,1V19z" />
|
|
4
|
+
<path d="M16,11H8c-0.6,0-1,0.4-1,1s0.4,1,1,1h8c0.6,0,1-0.4,1-1S16.6,11,16,11z" />
|
|
5
|
+
</svg>
|
|
6
|
+
</template>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
3
|
+
<path d="M19,2H5C3.3,2,2,3.3,2,5v14c0,1.7,1.3,3,3,3h14c1.7,0,3-1.3,3-3V5C22,3.3,20.7,2,19,2z M20,19c0,0.6-0.4,1-1,1H5c-0.6,0-1-0.4-1-1V5c0-0.6,0.4-1,1-1h14c0.6,0,1,0.4,1,1V19z" />
|
|
4
|
+
<path d="M16,11h-3V8c0-0.6-0.4-1-1-1s-1,0.4-1,1v3H8c-0.6,0-1,0.4-1,1s0.4,1,1,1h3v3c0,0.6,0.4,1,1,1s1-0.4,1-1v-3h3c0.6,0,1-0.4,1-1S16.6,11,16,11z" />
|
|
5
|
+
</svg>
|
|
6
|
+
</template>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { computed } from 'vue';
|
|
2
|
+
import { useMediaQuery } from '@vueuse/core';
|
|
3
|
+
import { useSidebar } from './sidebar';
|
|
4
|
+
export function useAside() {
|
|
5
|
+
const { hasSidebar } = useSidebar();
|
|
6
|
+
const is960 = useMediaQuery('(min-width: 960px)');
|
|
7
|
+
const is1280 = useMediaQuery('(min-width: 1280px)');
|
|
8
|
+
const isAsideEnabled = computed(() => {
|
|
9
|
+
if (!is1280.value && !is960.value) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
return hasSidebar.value ? is1280.value : is960.value;
|
|
13
|
+
});
|
|
14
|
+
return {
|
|
15
|
+
isAsideEnabled
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { nextTick, watch } from 'vue';
|
|
2
|
+
import { inBrowser, useData } from 'vitepress';
|
|
3
|
+
export function useCopyCode() {
|
|
4
|
+
const { page } = useData();
|
|
5
|
+
if (inBrowser)
|
|
6
|
+
watch(() => page.value.relativePath, () => {
|
|
7
|
+
nextTick(() => {
|
|
8
|
+
document
|
|
9
|
+
.querySelectorAll('.vp-doc div[class*="language-"]>span.copy')
|
|
10
|
+
.forEach(handleElement);
|
|
11
|
+
});
|
|
12
|
+
}, { immediate: true, flush: 'post' });
|
|
13
|
+
}
|
|
14
|
+
function handleElement(el) {
|
|
15
|
+
el.onclick = () => {
|
|
16
|
+
const parent = el.parentElement;
|
|
17
|
+
if (!parent) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const isShell = parent.classList.contains('language-sh') ||
|
|
21
|
+
parent.classList.contains('language-bash');
|
|
22
|
+
let { innerText: text = '' } = parent;
|
|
23
|
+
if (isShell) {
|
|
24
|
+
text = text.replace(/^ *\$ /gm, '');
|
|
25
|
+
}
|
|
26
|
+
navigator.clipboard.writeText(text).then(() => {
|
|
27
|
+
el.classList.add('copied');
|
|
28
|
+
setTimeout(() => {
|
|
29
|
+
el.classList.remove('copied');
|
|
30
|
+
}, 3000);
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
import { onMounted, onUpdated, onUnmounted } from 'vue';
|
|
2
|
-
import {
|
|
1
|
+
import { computed, onMounted, onUpdated, onUnmounted } from 'vue';
|
|
2
|
+
import { useData } from 'vitepress';
|
|
3
|
+
import { useAside } from '../composables/aside';
|
|
3
4
|
import { throttleAndDebounce } from '../support/utils';
|
|
4
5
|
// magic number to avoid repeated retrieval
|
|
5
6
|
const PAGE_OFFSET = 56;
|
|
7
|
+
export function useOutline() {
|
|
8
|
+
const { page } = useData();
|
|
9
|
+
const hasOutline = computed(() => {
|
|
10
|
+
return page.value.headers.length > 0;
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
hasOutline
|
|
14
|
+
};
|
|
15
|
+
}
|
|
6
16
|
export function resolveHeaders(headers) {
|
|
7
17
|
return mapHeaders(groupHeaders(headers));
|
|
8
18
|
}
|
|
@@ -29,7 +39,7 @@ function mapHeaders(headers) {
|
|
|
29
39
|
}));
|
|
30
40
|
}
|
|
31
41
|
export function useActiveAnchor(container, marker) {
|
|
32
|
-
const
|
|
42
|
+
const { isAsideEnabled } = useAside();
|
|
33
43
|
const onScroll = throttleAndDebounce(setActiveLink, 100);
|
|
34
44
|
let prevActiveLink = null;
|
|
35
45
|
onMounted(() => {
|
|
@@ -44,7 +54,7 @@ export function useActiveAnchor(container, marker) {
|
|
|
44
54
|
window.removeEventListener('scroll', onScroll);
|
|
45
55
|
});
|
|
46
56
|
function setActiveLink() {
|
|
47
|
-
if (!
|
|
57
|
+
if (!isAsideEnabled.value) {
|
|
48
58
|
return;
|
|
49
59
|
}
|
|
50
60
|
const links = [].slice.call(container.value.querySelectorAll('.outline-link'));
|
|
@@ -5,14 +5,16 @@ import { throttleAndDebounce } from '../support/utils';
|
|
|
5
5
|
*
|
|
6
6
|
* [Screen widh, Column size]
|
|
7
7
|
*
|
|
8
|
-
* It sets grid size on matching screen size. For example, `[768, 5]` will
|
|
9
|
-
* 5 columns when screen size is bigger or equal to 768px.
|
|
8
|
+
* It sets grid size on matching screen size. For example, `[768, 5]` will
|
|
9
|
+
* set 5 columns when screen size is bigger or equal to 768px.
|
|
10
10
|
*
|
|
11
11
|
* Column will set only when item size is bigger than the column size. For
|
|
12
|
-
* example, even we
|
|
13
|
-
* like to show it in 1 column.
|
|
12
|
+
* example, even we define 5 columns, if we only have 1 sponsor yet, we would
|
|
13
|
+
* like to show it in 1 column to make it stand out.
|
|
14
14
|
*/
|
|
15
15
|
const GridSettings = {
|
|
16
|
+
xmini: [[0, 2]],
|
|
17
|
+
mini: [],
|
|
16
18
|
small: [
|
|
17
19
|
[920, 6],
|
|
18
20
|
[768, 5],
|
|
@@ -31,7 +33,7 @@ const GridSettings = {
|
|
|
31
33
|
[640, 2]
|
|
32
34
|
]
|
|
33
35
|
};
|
|
34
|
-
export function useSponsorsGrid(
|
|
36
|
+
export function useSponsorsGrid({ el, size = 'medium' }) {
|
|
35
37
|
const onResize = throttleAndDebounce(manage, 100);
|
|
36
38
|
onMounted(() => {
|
|
37
39
|
manage();
|
|
@@ -41,7 +43,7 @@ export function useSponsorsGrid(options) {
|
|
|
41
43
|
window.removeEventListener('resize', onResize);
|
|
42
44
|
});
|
|
43
45
|
function manage() {
|
|
44
|
-
adjustSlots(
|
|
46
|
+
adjustSlots(el.value, size);
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
function adjustSlots(el, size) {
|
|
@@ -2,13 +2,15 @@ import './styles/fonts.css';
|
|
|
2
2
|
import './styles/vars.css';
|
|
3
3
|
import './styles/base.css';
|
|
4
4
|
import './styles/utils.css';
|
|
5
|
-
import './styles/
|
|
6
|
-
import './styles/vp-
|
|
5
|
+
import './styles/components/custom-block.css';
|
|
6
|
+
import './styles/components/vp-doc.css';
|
|
7
|
+
import './styles/components/vp-sponsor.css';
|
|
7
8
|
import Layout from './Layout.vue';
|
|
8
9
|
import NotFound from './NotFound.vue';
|
|
9
10
|
export { default as VPHomeHero } from './components/VPHomeHero.vue';
|
|
10
11
|
export { default as VPHomeFeatures } from './components/VPHomeFeatures.vue';
|
|
11
12
|
export { default as VPHomeSponsors } from './components/VPHomeSponsors.vue';
|
|
13
|
+
export { default as VPDocAsideSponsors } from './components/VPDocAsideSponsors.vue';
|
|
12
14
|
const theme = {
|
|
13
15
|
Layout,
|
|
14
16
|
NotFound
|