themekit-js 1.1.0
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/LICENSE +21 -0
- package/README.md +27 -0
- package/bin/themekit.js +2 -0
- package/client.d.ts +5 -0
- package/dist/client/app/components/ClientOnly.js +10 -0
- package/dist/client/app/components/Content.js +23 -0
- package/dist/client/app/composables/codeGroups.js +40 -0
- package/dist/client/app/composables/copyCode.js +73 -0
- package/dist/client/app/composables/head.js +81 -0
- package/dist/client/app/composables/preFetch.js +99 -0
- package/dist/client/app/data.js +59 -0
- package/dist/client/app/devtools.js +29 -0
- package/dist/client/app/index.js +140 -0
- package/dist/client/app/router.js +233 -0
- package/dist/client/app/ssr.js +10 -0
- package/dist/client/app/theme.js +1 -0
- package/dist/client/app/utils.js +119 -0
- package/dist/client/index.d.ts +1446 -0
- package/dist/client/index.js +9 -0
- package/dist/client/shared.js +139 -0
- package/dist/client/theme-default/Layout.vue +94 -0
- package/dist/client/theme-default/NotFound.vue +109 -0
- package/dist/client/theme-default/components/VPAlgoliaSearchBox.vue +99 -0
- package/dist/client/theme-default/components/VPBackdrop.vue +41 -0
- package/dist/client/theme-default/components/VPBadge.vue +86 -0
- package/dist/client/theme-default/components/VPButton.vue +123 -0
- package/dist/client/theme-default/components/VPCarbonAds.vue +109 -0
- package/dist/client/theme-default/components/VPContent.vue +98 -0
- package/dist/client/theme-default/components/VPDoc.vue +193 -0
- package/dist/client/theme-default/components/VPDocAside.vue +46 -0
- package/dist/client/theme-default/components/VPDocAsideCarbonAds.vue +18 -0
- package/dist/client/theme-default/components/VPDocAsideOutline.vue +87 -0
- package/dist/client/theme-default/components/VPDocAsideSponsors.vue +17 -0
- package/dist/client/theme-default/components/VPDocFooter.vue +145 -0
- package/dist/client/theme-default/components/VPDocFooterLastUpdated.vue +50 -0
- package/dist/client/theme-default/components/VPDocOutlineItem.vue +59 -0
- package/dist/client/theme-default/components/VPFeature.vue +123 -0
- package/dist/client/theme-default/components/VPFeatures.vue +121 -0
- package/dist/client/theme-default/components/VPFlyout.vue +136 -0
- package/dist/client/theme-default/components/VPFooter.vue +60 -0
- package/dist/client/theme-default/components/VPHero.vue +336 -0
- package/dist/client/theme-default/components/VPHome.vue +43 -0
- package/dist/client/theme-default/components/VPHomeContent.vue +52 -0
- package/dist/client/theme-default/components/VPHomeFeatures.vue +14 -0
- package/dist/client/theme-default/components/VPHomeHero.vue +24 -0
- package/dist/client/theme-default/components/VPHomeSponsors.vue +116 -0
- package/dist/client/theme-default/components/VPImage.vue +46 -0
- package/dist/client/theme-default/components/VPLink.vue +33 -0
- package/dist/client/theme-default/components/VPLocalNav.vue +171 -0
- package/dist/client/theme-default/components/VPLocalNavOutlineDropdown.vue +190 -0
- package/dist/client/theme-default/components/VPLocalSearchBox.vue +856 -0
- package/dist/client/theme-default/components/VPMenu.vue +72 -0
- package/dist/client/theme-default/components/VPMenuGroup.vue +47 -0
- package/dist/client/theme-default/components/VPMenuLink.vue +54 -0
- package/dist/client/theme-default/components/VPNav.vue +57 -0
- package/dist/client/theme-default/components/VPNavBar.vue +267 -0
- package/dist/client/theme-default/components/VPNavBarAppearance.vue +25 -0
- package/dist/client/theme-default/components/VPNavBarExtra.vue +94 -0
- package/dist/client/theme-default/components/VPNavBarHamburger.vue +79 -0
- package/dist/client/theme-default/components/VPNavBarMenu.vue +29 -0
- package/dist/client/theme-default/components/VPNavBarMenuGroup.vue +42 -0
- package/dist/client/theme-default/components/VPNavBarMenuLink.vue +53 -0
- package/dist/client/theme-default/components/VPNavBarSearch.vue +194 -0
- package/dist/client/theme-default/components/VPNavBarSearchButton.vue +208 -0
- package/dist/client/theme-default/components/VPNavBarSocialLinks.vue +27 -0
- package/dist/client/theme-default/components/VPNavBarTitle.vue +76 -0
- package/dist/client/theme-default/components/VPNavBarTranslations.vue +47 -0
- package/dist/client/theme-default/components/VPNavScreen.vue +99 -0
- package/dist/client/theme-default/components/VPNavScreenAppearance.vue +33 -0
- package/dist/client/theme-default/components/VPNavScreenMenu.vue +23 -0
- package/dist/client/theme-default/components/VPNavScreenMenuGroup.vue +111 -0
- package/dist/client/theme-default/components/VPNavScreenMenuGroupLink.vue +39 -0
- package/dist/client/theme-default/components/VPNavScreenMenuGroupSection.vue +34 -0
- package/dist/client/theme-default/components/VPNavScreenMenuLink.vue +39 -0
- package/dist/client/theme-default/components/VPNavScreenSocialLinks.vue +14 -0
- package/dist/client/theme-default/components/VPNavScreenTranslations.vue +73 -0
- package/dist/client/theme-default/components/VPPage.vue +7 -0
- package/dist/client/theme-default/components/VPSidebar.vue +137 -0
- package/dist/client/theme-default/components/VPSidebarItem.vue +250 -0
- package/dist/client/theme-default/components/VPSkipLink.vue +68 -0
- package/dist/client/theme-default/components/VPSocialLink.vue +50 -0
- package/dist/client/theme-default/components/VPSocialLinks.vue +27 -0
- package/dist/client/theme-default/components/VPSponsors.vue +48 -0
- package/dist/client/theme-default/components/VPSponsorsGrid.vue +48 -0
- package/dist/client/theme-default/components/VPSwitch.vue +63 -0
- package/dist/client/theme-default/components/VPSwitchAppearance.vue +52 -0
- package/dist/client/theme-default/components/VPTeamMembers.vue +66 -0
- package/dist/client/theme-default/components/VPTeamMembersItem.vue +225 -0
- package/dist/client/theme-default/components/VPTeamPage.vue +58 -0
- package/dist/client/theme-default/components/VPTeamPageSection.vue +77 -0
- package/dist/client/theme-default/components/VPTeamPageTitle.vue +63 -0
- package/dist/client/theme-default/components/icons/VPIconAlignJustify.vue +8 -0
- package/dist/client/theme-default/components/icons/VPIconAlignLeft.vue +8 -0
- package/dist/client/theme-default/components/icons/VPIconAlignRight.vue +8 -0
- package/dist/client/theme-default/components/icons/VPIconArrowLeft.vue +7 -0
- package/dist/client/theme-default/components/icons/VPIconArrowRight.vue +7 -0
- package/dist/client/theme-default/components/icons/VPIconChevronDown.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconChevronLeft.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconChevronRight.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconChevronUp.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconEdit.vue +6 -0
- package/dist/client/theme-default/components/icons/VPIconHeart.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconLanguages.vue +9 -0
- 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/VPIconMoon.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconMoreHorizontal.vue +7 -0
- package/dist/client/theme-default/components/icons/VPIconPlus.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconPlusSquare.vue +6 -0
- package/dist/client/theme-default/components/icons/VPIconSun.vue +13 -0
- package/dist/client/theme-default/composables/aside.js +17 -0
- package/dist/client/theme-default/composables/data.js +2 -0
- package/dist/client/theme-default/composables/edit-link.js +16 -0
- package/dist/client/theme-default/composables/flyout.js +41 -0
- package/dist/client/theme-default/composables/langs.js +26 -0
- package/dist/client/theme-default/composables/local-nav.js +18 -0
- package/dist/client/theme-default/composables/nav.js +30 -0
- package/dist/client/theme-default/composables/outline.js +178 -0
- package/dist/client/theme-default/composables/prev-next.js +57 -0
- package/dist/client/theme-default/composables/sidebar.js +136 -0
- package/dist/client/theme-default/composables/sponsor-grid.js +94 -0
- package/dist/client/theme-default/fonts/inter-italic-cyrillic-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-italic-cyrillic.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-italic-greek-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-italic-greek.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-italic-latin-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-italic-latin.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-italic-vietnamese.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-roman-cyrillic-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-roman-cyrillic.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-roman-greek-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-roman-greek.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-roman-latin-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-roman-latin.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-roman-vietnamese.woff2 +0 -0
- package/dist/client/theme-default/index.js +3 -0
- package/dist/client/theme-default/styles/base.css +252 -0
- package/dist/client/theme-default/styles/components/custom-block.css +208 -0
- package/dist/client/theme-default/styles/components/vp-code-group.css +85 -0
- package/dist/client/theme-default/styles/components/vp-code.css +7 -0
- package/dist/client/theme-default/styles/components/vp-doc.css +570 -0
- package/dist/client/theme-default/styles/components/vp-sponsor.css +155 -0
- package/dist/client/theme-default/styles/fonts.css +157 -0
- package/dist/client/theme-default/styles/icons.css +123 -0
- package/dist/client/theme-default/styles/utils.css +9 -0
- package/dist/client/theme-default/styles/vars.css +563 -0
- package/dist/client/theme-default/support/lru.js +33 -0
- package/dist/client/theme-default/support/sidebar.js +89 -0
- package/dist/client/theme-default/support/translation.js +49 -0
- package/dist/client/theme-default/support/utils.js +33 -0
- package/dist/client/theme-default/without-fonts.js +32 -0
- package/dist/node/cli.js +444 -0
- package/dist/node/index.d.ts +4588 -0
- package/dist/node/index.js +198 -0
- package/dist/node/serve-BjvG349_.js +50301 -0
- package/lib/vue-demi.mjs +34 -0
- package/package.json +223 -0
- package/template/.vitepress/config.js +28 -0
- package/template/.vitepress/theme/Layout.vue +21 -0
- package/template/.vitepress/theme/index.js +29 -0
- package/template/.vitepress/theme/style.css +143 -0
- package/template/api-examples.md +49 -0
- package/template/index.md +28 -0
- package/template/markdown-examples.md +85 -0
- package/theme-without-fonts.d.ts +2 -0
- package/theme.d.ts +30 -0
- package/types/default-theme.d.ts +533 -0
- package/types/docsearch.d.ts +144 -0
- package/types/index.d.ts +3 -0
- package/types/local-search.d.ts +33 -0
- package/types/shared.d.ts +199 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import VPMenuLink from './VPMenuLink.vue'
|
|
3
|
+
import VPMenuGroup from './VPMenuGroup.vue'
|
|
4
|
+
|
|
5
|
+
defineProps<{
|
|
6
|
+
items?: any[]
|
|
7
|
+
}>()
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<div class="VPMenu">
|
|
12
|
+
<div v-if="items" class="items">
|
|
13
|
+
<template v-for="item in items" :key="item.text">
|
|
14
|
+
<VPMenuLink v-if="'link' in item" :item="item" />
|
|
15
|
+
<VPMenuGroup v-else :text="item.text" :items="item.items" />
|
|
16
|
+
</template>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<slot />
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<style scoped>
|
|
24
|
+
.VPMenu {
|
|
25
|
+
border-radius: 12px;
|
|
26
|
+
padding: 12px;
|
|
27
|
+
min-width: 128px;
|
|
28
|
+
border: 1px solid var(--vp-c-divider);
|
|
29
|
+
background-color: var(--vp-c-bg-elv);
|
|
30
|
+
box-shadow: var(--vp-shadow-3);
|
|
31
|
+
transition: background-color 0.5s;
|
|
32
|
+
max-height: calc(100vh - var(--vp-nav-height));
|
|
33
|
+
overflow-y: auto;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.VPMenu :deep(.group) {
|
|
37
|
+
margin: 0 -12px;
|
|
38
|
+
padding: 0 12px 12px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.VPMenu :deep(.group + .group) {
|
|
42
|
+
border-top: 1px solid var(--vp-c-divider);
|
|
43
|
+
padding: 11px 12px 12px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.VPMenu :deep(.group:last-child) {
|
|
47
|
+
padding-bottom: 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.VPMenu :deep(.group + .item) {
|
|
51
|
+
border-top: 1px solid var(--vp-c-divider);
|
|
52
|
+
padding: 11px 16px 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.VPMenu :deep(.item) {
|
|
56
|
+
padding: 0 16px;
|
|
57
|
+
white-space: nowrap;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.VPMenu :deep(.label) {
|
|
61
|
+
flex-grow: 1;
|
|
62
|
+
line-height: 28px;
|
|
63
|
+
font-size: 12px;
|
|
64
|
+
font-weight: 500;
|
|
65
|
+
color: var(--vp-c-text-2);
|
|
66
|
+
transition: color .5s;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.VPMenu :deep(.action) {
|
|
70
|
+
padding-left: 24px;
|
|
71
|
+
}
|
|
72
|
+
</style>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import VPMenuLink from './VPMenuLink.vue'
|
|
3
|
+
|
|
4
|
+
defineProps<{
|
|
5
|
+
text?: string
|
|
6
|
+
items: any[]
|
|
7
|
+
}>()
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<div class="VPMenuGroup">
|
|
12
|
+
<p v-if="text" class="title">{{ text }}</p>
|
|
13
|
+
|
|
14
|
+
<template v-for="item in items">
|
|
15
|
+
<VPMenuLink v-if="'link' in item" :item="item" />
|
|
16
|
+
</template>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<style scoped>
|
|
21
|
+
.VPMenuGroup {
|
|
22
|
+
margin: 12px -12px 0;
|
|
23
|
+
border-top: 1px solid var(--vp-c-divider);
|
|
24
|
+
padding: 12px 12px 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.VPMenuGroup:first-child {
|
|
28
|
+
margin-top: 0;
|
|
29
|
+
border-top: 0;
|
|
30
|
+
padding-top: 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.VPMenuGroup + .VPMenuGroup {
|
|
34
|
+
margin-top: 12px;
|
|
35
|
+
border-top: 1px solid var(--vp-c-divider);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.title {
|
|
39
|
+
padding: 0 12px;
|
|
40
|
+
line-height: 32px;
|
|
41
|
+
font-size: 14px;
|
|
42
|
+
font-weight: 600;
|
|
43
|
+
color: var(--vp-c-text-2);
|
|
44
|
+
white-space: nowrap;
|
|
45
|
+
transition: color 0.25s;
|
|
46
|
+
}
|
|
47
|
+
</style>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { DefaultTheme } from 'vitepress/theme'
|
|
3
|
+
import { useData } from '../composables/data'
|
|
4
|
+
import { isActive } from '../../shared'
|
|
5
|
+
import VPLink from './VPLink.vue'
|
|
6
|
+
|
|
7
|
+
defineProps<{
|
|
8
|
+
item: DefaultTheme.NavItemWithLink
|
|
9
|
+
}>()
|
|
10
|
+
|
|
11
|
+
const { page } = useData()
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div class="VPMenuLink">
|
|
16
|
+
<VPLink
|
|
17
|
+
:class="{ active: isActive(page.relativePath, item.activeMatch || item.link, !!item.activeMatch) }"
|
|
18
|
+
:href="item.link"
|
|
19
|
+
:target="item.target"
|
|
20
|
+
:rel="item.rel"
|
|
21
|
+
>
|
|
22
|
+
{{ item.text }}
|
|
23
|
+
</VPLink>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<style scoped>
|
|
28
|
+
.VPMenuGroup + .VPMenuLink {
|
|
29
|
+
margin: 12px -12px 0;
|
|
30
|
+
border-top: 1px solid var(--vp-c-divider);
|
|
31
|
+
padding: 12px 12px 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.link {
|
|
35
|
+
display: block;
|
|
36
|
+
border-radius: 6px;
|
|
37
|
+
padding: 0 12px;
|
|
38
|
+
line-height: 32px;
|
|
39
|
+
font-size: 14px;
|
|
40
|
+
font-weight: 500;
|
|
41
|
+
color: var(--vp-c-text-1);
|
|
42
|
+
white-space: nowrap;
|
|
43
|
+
transition: background-color 0.25s, color 0.25s;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.link:hover {
|
|
47
|
+
color: var(--vp-c-brand-1);
|
|
48
|
+
background-color: var(--vp-c-default-soft);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.link.active {
|
|
52
|
+
color: var(--vp-c-brand-1);
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { inBrowser } from 'vitepress'
|
|
3
|
+
import { computed, provide, watchEffect } from 'vue'
|
|
4
|
+
import { useData } from '../composables/data'
|
|
5
|
+
import { useNav } from '../composables/nav'
|
|
6
|
+
import VPNavBar from './VPNavBar.vue'
|
|
7
|
+
import VPNavScreen from './VPNavScreen.vue'
|
|
8
|
+
|
|
9
|
+
const { isScreenOpen, closeScreen, toggleScreen } = useNav()
|
|
10
|
+
const { frontmatter } = useData()
|
|
11
|
+
|
|
12
|
+
const hasNavbar = computed(() => {
|
|
13
|
+
return frontmatter.value.navbar !== false
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
provide('close-screen', closeScreen)
|
|
17
|
+
|
|
18
|
+
watchEffect(() => {
|
|
19
|
+
if (inBrowser) {
|
|
20
|
+
document.documentElement.classList.toggle('hide-nav', !hasNavbar.value)
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<header v-if="hasNavbar" class="VPNav">
|
|
27
|
+
<VPNavBar :is-screen-open="isScreenOpen" @toggle-screen="toggleScreen">
|
|
28
|
+
<template #nav-bar-title-before><slot name="nav-bar-title-before" /></template>
|
|
29
|
+
<template #nav-bar-title-after><slot name="nav-bar-title-after" /></template>
|
|
30
|
+
<template #nav-bar-content-before><slot name="nav-bar-content-before" /></template>
|
|
31
|
+
<template #nav-bar-content-after><slot name="nav-bar-content-after" /></template>
|
|
32
|
+
</VPNavBar>
|
|
33
|
+
<VPNavScreen :open="isScreenOpen">
|
|
34
|
+
<template #nav-screen-content-before><slot name="nav-screen-content-before" /></template>
|
|
35
|
+
<template #nav-screen-content-after><slot name="nav-screen-content-after" /></template>
|
|
36
|
+
</VPNavScreen>
|
|
37
|
+
</header>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<style scoped>
|
|
41
|
+
.VPNav {
|
|
42
|
+
position: relative;
|
|
43
|
+
top: var(--vp-layout-top-height, 0px);
|
|
44
|
+
/*rtl:ignore*/
|
|
45
|
+
left: 0;
|
|
46
|
+
z-index: var(--vp-z-index-nav);
|
|
47
|
+
width: 100%;
|
|
48
|
+
pointer-events: none;
|
|
49
|
+
transition: background-color 0.5s;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@media (min-width: 960px) {
|
|
53
|
+
.VPNav {
|
|
54
|
+
position: fixed;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
</style>
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useWindowScroll } from '@vueuse/core'
|
|
3
|
+
import { ref, watchPostEffect } from 'vue'
|
|
4
|
+
import { useData } from '../composables/data'
|
|
5
|
+
import { useSidebar } from '../composables/sidebar'
|
|
6
|
+
import VPNavBarAppearance from './VPNavBarAppearance.vue'
|
|
7
|
+
import VPNavBarExtra from './VPNavBarExtra.vue'
|
|
8
|
+
import VPNavBarHamburger from './VPNavBarHamburger.vue'
|
|
9
|
+
import VPNavBarMenu from './VPNavBarMenu.vue'
|
|
10
|
+
import VPNavBarSearch from './VPNavBarSearch.vue'
|
|
11
|
+
import VPNavBarSocialLinks from './VPNavBarSocialLinks.vue'
|
|
12
|
+
import VPNavBarTitle from './VPNavBarTitle.vue'
|
|
13
|
+
import VPNavBarTranslations from './VPNavBarTranslations.vue'
|
|
14
|
+
|
|
15
|
+
defineProps<{
|
|
16
|
+
isScreenOpen: boolean
|
|
17
|
+
}>()
|
|
18
|
+
|
|
19
|
+
defineEmits<{
|
|
20
|
+
(e: 'toggle-screen'): void
|
|
21
|
+
}>()
|
|
22
|
+
|
|
23
|
+
const { y } = useWindowScroll()
|
|
24
|
+
const { hasSidebar } = useSidebar()
|
|
25
|
+
const { frontmatter } = useData()
|
|
26
|
+
|
|
27
|
+
const classes = ref<Record<string, boolean>>({})
|
|
28
|
+
|
|
29
|
+
watchPostEffect(() => {
|
|
30
|
+
classes.value = {
|
|
31
|
+
'has-sidebar': hasSidebar.value,
|
|
32
|
+
'home': frontmatter.value.layout === 'home',
|
|
33
|
+
'top': y.value === 0,
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<template>
|
|
39
|
+
<div class="VPNavBar" :class="classes">
|
|
40
|
+
<div class="wrapper">
|
|
41
|
+
<div class="container">
|
|
42
|
+
<div class="title">
|
|
43
|
+
<VPNavBarTitle>
|
|
44
|
+
<template #nav-bar-title-before><slot name="nav-bar-title-before" /></template>
|
|
45
|
+
<template #nav-bar-title-after><slot name="nav-bar-title-after" /></template>
|
|
46
|
+
</VPNavBarTitle>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<div class="content">
|
|
50
|
+
<div class="content-body">
|
|
51
|
+
<slot name="nav-bar-content-before" />
|
|
52
|
+
<VPNavBarSearch class="search" />
|
|
53
|
+
<VPNavBarMenu class="menu" />
|
|
54
|
+
<VPNavBarTranslations class="translations" />
|
|
55
|
+
<VPNavBarAppearance class="appearance" />
|
|
56
|
+
<VPNavBarSocialLinks class="social-links" />
|
|
57
|
+
<VPNavBarExtra class="extra" />
|
|
58
|
+
<slot name="nav-bar-content-after" />
|
|
59
|
+
<VPNavBarHamburger class="hamburger" :active="isScreenOpen" @click="$emit('toggle-screen')" />
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<div class="divider">
|
|
66
|
+
<div class="divider-line" />
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</template>
|
|
70
|
+
|
|
71
|
+
<style scoped>
|
|
72
|
+
.VPNavBar {
|
|
73
|
+
position: relative;
|
|
74
|
+
height: var(--vp-nav-height);
|
|
75
|
+
pointer-events: none;
|
|
76
|
+
white-space: nowrap;
|
|
77
|
+
transition: background-color 0.5s;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.VPNavBar:not(.home) {
|
|
81
|
+
background-color: var(--vp-nav-bg-color);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@media (min-width: 960px) {
|
|
85
|
+
.VPNavBar:not(.home) {
|
|
86
|
+
background-color: transparent;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.VPNavBar:not(.has-sidebar):not(.home.top) {
|
|
90
|
+
background-color: var(--vp-nav-bg-color);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.wrapper {
|
|
95
|
+
padding: 0 8px 0 24px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@media (min-width: 768px) {
|
|
99
|
+
.wrapper {
|
|
100
|
+
padding: 0 32px;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@media (min-width: 960px) {
|
|
105
|
+
.VPNavBar.has-sidebar .wrapper {
|
|
106
|
+
padding: 0;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.container {
|
|
111
|
+
display: flex;
|
|
112
|
+
justify-content: space-between;
|
|
113
|
+
margin: 0 auto;
|
|
114
|
+
max-width: calc(var(--vp-layout-max-width) - 64px);
|
|
115
|
+
height: var(--vp-nav-height);
|
|
116
|
+
pointer-events: none;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.container > .title,
|
|
120
|
+
.container > .content {
|
|
121
|
+
pointer-events: none;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.container :deep(*) {
|
|
125
|
+
pointer-events: auto;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@media (min-width: 960px) {
|
|
129
|
+
.VPNavBar.has-sidebar .container {
|
|
130
|
+
max-width: 100%;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.title {
|
|
135
|
+
flex-shrink: 0;
|
|
136
|
+
height: calc(var(--vp-nav-height) - 1px);
|
|
137
|
+
transition: background-color 0.5s;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@media (min-width: 960px) {
|
|
141
|
+
.VPNavBar.has-sidebar .title {
|
|
142
|
+
position: absolute;
|
|
143
|
+
top: 0;
|
|
144
|
+
left: 0;
|
|
145
|
+
z-index: 2;
|
|
146
|
+
padding: 0 32px;
|
|
147
|
+
width: var(--vp-sidebar-width);
|
|
148
|
+
height: var(--vp-nav-height);
|
|
149
|
+
background-color: transparent;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
@media (min-width: 1440px) {
|
|
154
|
+
.VPNavBar.has-sidebar .title {
|
|
155
|
+
padding-left: max(32px, calc((100% - (var(--vp-layout-max-width) - 64px)) / 2));
|
|
156
|
+
width: calc((100% - (var(--vp-layout-max-width) - 64px)) / 2 + var(--vp-sidebar-width) - 32px);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.content {
|
|
161
|
+
flex-grow: 1;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
@media (min-width: 960px) {
|
|
165
|
+
.VPNavBar.has-sidebar .content {
|
|
166
|
+
position: relative;
|
|
167
|
+
z-index: 1;
|
|
168
|
+
padding-right: 32px;
|
|
169
|
+
padding-left: var(--vp-sidebar-width);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
@media (min-width: 1440px) {
|
|
174
|
+
.VPNavBar.has-sidebar .content {
|
|
175
|
+
padding-right: calc((100vw - var(--vp-layout-max-width)) / 2 + 32px);
|
|
176
|
+
padding-left: calc((100vw - var(--vp-layout-max-width)) / 2 + var(--vp-sidebar-width));
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.content-body {
|
|
181
|
+
display: flex;
|
|
182
|
+
justify-content: flex-end;
|
|
183
|
+
align-items: center;
|
|
184
|
+
height: var(--vp-nav-height);
|
|
185
|
+
transition: background-color 0.5s;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
@media (min-width: 960px) {
|
|
189
|
+
.VPNavBar:not(.home.top) .content-body {
|
|
190
|
+
position: relative;
|
|
191
|
+
background-color: var(--vp-nav-bg-color);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.VPNavBar:not(.has-sidebar):not(.home.top) .content-body {
|
|
195
|
+
background-color: transparent;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
@media (max-width: 767px) {
|
|
200
|
+
.content-body {
|
|
201
|
+
column-gap: 0.5rem;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.menu + .translations::before,
|
|
206
|
+
.menu + .appearance::before,
|
|
207
|
+
.menu + .social-links::before,
|
|
208
|
+
.translations + .appearance::before,
|
|
209
|
+
.appearance + .social-links::before {
|
|
210
|
+
margin-right: 8px;
|
|
211
|
+
margin-left: 8px;
|
|
212
|
+
width: 1px;
|
|
213
|
+
height: 24px;
|
|
214
|
+
background-color: var(--vp-c-divider);
|
|
215
|
+
content: "";
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.menu + .appearance::before,
|
|
219
|
+
.translations + .appearance::before {
|
|
220
|
+
margin-right: 16px;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.appearance + .social-links::before {
|
|
224
|
+
margin-left: 16px;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.social-links {
|
|
228
|
+
margin-right: -8px;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.divider {
|
|
232
|
+
width: 100%;
|
|
233
|
+
height: 1px;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
@media (min-width: 960px) {
|
|
237
|
+
.VPNavBar.has-sidebar .divider {
|
|
238
|
+
padding-left: var(--vp-sidebar-width);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
@media (min-width: 1440px) {
|
|
243
|
+
.VPNavBar.has-sidebar .divider {
|
|
244
|
+
padding-left: calc((100vw - var(--vp-layout-max-width)) / 2 + var(--vp-sidebar-width));
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.divider-line {
|
|
249
|
+
width: 100%;
|
|
250
|
+
height: 1px;
|
|
251
|
+
transition: background-color 0.5s;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.VPNavBar:not(.home) .divider-line {
|
|
255
|
+
background-color: var(--vp-c-gutter);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
@media (min-width: 960px) {
|
|
259
|
+
.VPNavBar:not(.home.top) .divider-line {
|
|
260
|
+
background-color: var(--vp-c-gutter);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.VPNavBar:not(.has-sidebar):not(.home.top) .divider {
|
|
264
|
+
background-color: var(--vp-c-gutter);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
</style>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useData } from '../composables/data'
|
|
3
|
+
import VPSwitchAppearance from './VPSwitchAppearance.vue'
|
|
4
|
+
|
|
5
|
+
const { site } = useData()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<div v-if="site.appearance && site.appearance !== 'force-dark'" class="VPNavBarAppearance">
|
|
10
|
+
<VPSwitchAppearance />
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<style scoped>
|
|
15
|
+
.VPNavBarAppearance {
|
|
16
|
+
display: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@media (min-width: 1280px) {
|
|
20
|
+
.VPNavBarAppearance {
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
</style>
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import VPFlyout from './VPFlyout.vue'
|
|
4
|
+
import VPMenuLink from './VPMenuLink.vue'
|
|
5
|
+
import VPSwitchAppearance from './VPSwitchAppearance.vue'
|
|
6
|
+
import VPSocialLinks from './VPSocialLinks.vue'
|
|
7
|
+
import { useData } from '../composables/data'
|
|
8
|
+
import { useLangs } from '../composables/langs'
|
|
9
|
+
|
|
10
|
+
const { site, theme } = useData()
|
|
11
|
+
const { localeLinks, currentLang } = useLangs({ correspondingLink: true })
|
|
12
|
+
|
|
13
|
+
const hasExtraContent = computed(
|
|
14
|
+
() =>
|
|
15
|
+
(localeLinks.value.length && currentLang.value.label) ||
|
|
16
|
+
site.value.appearance ||
|
|
17
|
+
theme.value.socialLinks
|
|
18
|
+
)
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<VPFlyout v-if="hasExtraContent" class="VPNavBarExtra" label="extra navigation">
|
|
23
|
+
<div v-if="localeLinks.length && currentLang.label" class="group translations">
|
|
24
|
+
<p class="trans-title">{{ currentLang.label }}</p>
|
|
25
|
+
|
|
26
|
+
<template v-for="locale in localeLinks" :key="locale.link">
|
|
27
|
+
<VPMenuLink :item="locale" />
|
|
28
|
+
</template>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<div v-if="site.appearance && site.appearance !== 'force-dark'" class="group">
|
|
32
|
+
<div class="item appearance">
|
|
33
|
+
<p class="label">
|
|
34
|
+
{{ theme.darkModeSwitchLabel || 'Appearance' }}
|
|
35
|
+
</p>
|
|
36
|
+
<div class="appearance-action">
|
|
37
|
+
<VPSwitchAppearance />
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div v-if="theme.socialLinks" class="group">
|
|
43
|
+
<div class="item social-links">
|
|
44
|
+
<VPSocialLinks class="social-links-list" :links="theme.socialLinks" />
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</VPFlyout>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<style scoped>
|
|
51
|
+
.VPNavBarExtra {
|
|
52
|
+
display: none;
|
|
53
|
+
margin-right: -12px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@media (min-width: 768px) {
|
|
57
|
+
.VPNavBarExtra {
|
|
58
|
+
display: block;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@media (min-width: 1280px) {
|
|
63
|
+
.VPNavBarExtra {
|
|
64
|
+
display: none;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.trans-title {
|
|
69
|
+
padding: 0 24px 0 12px;
|
|
70
|
+
line-height: 32px;
|
|
71
|
+
font-size: 14px;
|
|
72
|
+
font-weight: 700;
|
|
73
|
+
color: var(--vp-c-text-1);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.item.appearance,
|
|
77
|
+
.item.social-links {
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
padding: 0 12px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.item.appearance {
|
|
84
|
+
min-width: 176px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.appearance-action {
|
|
88
|
+
margin-right: -2px;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.social-links-list {
|
|
92
|
+
margin: -4px -8px;
|
|
93
|
+
}
|
|
94
|
+
</style>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
defineProps<{
|
|
3
|
+
active: boolean
|
|
4
|
+
}>()
|
|
5
|
+
|
|
6
|
+
defineEmits<{
|
|
7
|
+
(e: 'click'): void
|
|
8
|
+
}>()
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<button
|
|
13
|
+
type="button"
|
|
14
|
+
class="VPNavBarHamburger"
|
|
15
|
+
:class="{ active }"
|
|
16
|
+
aria-label="mobile navigation"
|
|
17
|
+
:aria-expanded="active"
|
|
18
|
+
aria-controls="VPNavScreen"
|
|
19
|
+
@click="$emit('click')"
|
|
20
|
+
>
|
|
21
|
+
<span class="container">
|
|
22
|
+
<span class="top" />
|
|
23
|
+
<span class="middle" />
|
|
24
|
+
<span class="bottom" />
|
|
25
|
+
</span>
|
|
26
|
+
</button>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<style scoped>
|
|
30
|
+
.VPNavBarHamburger {
|
|
31
|
+
display: flex;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
align-items: center;
|
|
34
|
+
width: 48px;
|
|
35
|
+
height: var(--vp-nav-height);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@media (min-width: 768px) {
|
|
39
|
+
.VPNavBarHamburger {
|
|
40
|
+
display: none;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.container {
|
|
45
|
+
position: relative;
|
|
46
|
+
width: 16px;
|
|
47
|
+
height: 14px;
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.VPNavBarHamburger:hover .top { top: 0; left: 0; transform: translateX(4px); }
|
|
52
|
+
.VPNavBarHamburger:hover .middle { top: 6px; left: 0; transform: translateX(0); }
|
|
53
|
+
.VPNavBarHamburger:hover .bottom { top: 12px; left: 0; transform: translateX(8px); }
|
|
54
|
+
|
|
55
|
+
.VPNavBarHamburger.active .top { top: 6px; transform: translateX(0) rotate(225deg); }
|
|
56
|
+
.VPNavBarHamburger.active .middle { top: 6px; transform: translateX(16px); }
|
|
57
|
+
.VPNavBarHamburger.active .bottom { top: 6px; transform: translateX(0) rotate(135deg); }
|
|
58
|
+
|
|
59
|
+
.VPNavBarHamburger.active:hover .top,
|
|
60
|
+
.VPNavBarHamburger.active:hover .middle,
|
|
61
|
+
.VPNavBarHamburger.active:hover .bottom {
|
|
62
|
+
background-color: var(--vp-c-text-2);
|
|
63
|
+
transition: top .25s, background-color .25s, transform .25s;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.top,
|
|
67
|
+
.middle,
|
|
68
|
+
.bottom {
|
|
69
|
+
position: absolute;
|
|
70
|
+
width: 16px;
|
|
71
|
+
height: 2px;
|
|
72
|
+
background-color: var(--vp-c-text-1);
|
|
73
|
+
transition: top .25s, background-color .5s, transform .25s;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.top { top: 0; left: 0; transform: translateX(0); }
|
|
77
|
+
.middle { top: 6px; left: 0; transform: translateX(8px); }
|
|
78
|
+
.bottom { top: 12px; left: 0; transform: translateX(4px); }
|
|
79
|
+
</style>
|