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,29 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useData } from '../composables/data'
|
|
3
|
+
import VPNavBarMenuLink from './VPNavBarMenuLink.vue'
|
|
4
|
+
import VPNavBarMenuGroup from './VPNavBarMenuGroup.vue'
|
|
5
|
+
|
|
6
|
+
const { theme } = useData()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<nav v-if="theme.nav" aria-labelledby="main-nav-aria-label" class="VPNavBarMenu">
|
|
11
|
+
<span id="main-nav-aria-label" class="visually-hidden">Main Navigation</span>
|
|
12
|
+
<template v-for="item in theme.nav" :key="item.text">
|
|
13
|
+
<VPNavBarMenuLink v-if="'link' in item" :item="item" />
|
|
14
|
+
<VPNavBarMenuGroup v-else :item="item" />
|
|
15
|
+
</template>
|
|
16
|
+
</nav>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<style scoped>
|
|
20
|
+
.VPNavBarMenu {
|
|
21
|
+
display: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@media (min-width: 768px) {
|
|
25
|
+
.VPNavBarMenu {
|
|
26
|
+
display: flex;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
</style>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { DefaultTheme } from 'vitepress/theme'
|
|
3
|
+
import { computed } from 'vue'
|
|
4
|
+
import { useData } from '../composables/data'
|
|
5
|
+
import { isActive } from '../../shared'
|
|
6
|
+
import VPFlyout from './VPFlyout.vue'
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{
|
|
9
|
+
item: DefaultTheme.NavItemWithChildren
|
|
10
|
+
}>()
|
|
11
|
+
|
|
12
|
+
const { page } = useData()
|
|
13
|
+
|
|
14
|
+
const isChildActive = (navItem: DefaultTheme.NavItem) => {
|
|
15
|
+
if ('link' in navItem) {
|
|
16
|
+
return isActive(
|
|
17
|
+
page.value.relativePath,
|
|
18
|
+
navItem.link,
|
|
19
|
+
!!props.item.activeMatch
|
|
20
|
+
)
|
|
21
|
+
} else {
|
|
22
|
+
return navItem.items.some(isChildActive)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const childrenActive = computed(() => isChildActive(props.item))
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<VPFlyout
|
|
31
|
+
:class="{
|
|
32
|
+
VPNavBarMenuGroup: true,
|
|
33
|
+
active: isActive(
|
|
34
|
+
page.relativePath,
|
|
35
|
+
item.activeMatch,
|
|
36
|
+
!!item.activeMatch
|
|
37
|
+
) || childrenActive
|
|
38
|
+
}"
|
|
39
|
+
:button="item.text"
|
|
40
|
+
:items="item.items"
|
|
41
|
+
/>
|
|
42
|
+
</template>
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
<VPLink
|
|
16
|
+
:class="{
|
|
17
|
+
VPNavBarMenuLink: true,
|
|
18
|
+
active: isActive(
|
|
19
|
+
page.relativePath,
|
|
20
|
+
item.activeMatch || item.link,
|
|
21
|
+
!!item.activeMatch
|
|
22
|
+
)
|
|
23
|
+
}"
|
|
24
|
+
:href="item.link"
|
|
25
|
+
:noIcon="item.noIcon"
|
|
26
|
+
:target="item.target"
|
|
27
|
+
:rel="item.rel"
|
|
28
|
+
tabindex="0"
|
|
29
|
+
>
|
|
30
|
+
<span v-html="item.text"></span>
|
|
31
|
+
</VPLink>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<style scoped>
|
|
35
|
+
.VPNavBarMenuLink {
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
padding: 0 12px;
|
|
39
|
+
line-height: var(--vp-nav-height);
|
|
40
|
+
font-size: 14px;
|
|
41
|
+
font-weight: 500;
|
|
42
|
+
color: var(--vp-c-text-1);
|
|
43
|
+
transition: color 0.25s;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.VPNavBarMenuLink.active {
|
|
47
|
+
color: var(--vp-c-brand-1);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.VPNavBarMenuLink:hover {
|
|
51
|
+
color: var(--vp-c-brand-1);
|
|
52
|
+
}
|
|
53
|
+
</style>
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import '@docsearch/css'
|
|
3
|
+
import { onKeyStroke } from '@vueuse/core'
|
|
4
|
+
import {
|
|
5
|
+
defineAsyncComponent,
|
|
6
|
+
onMounted,
|
|
7
|
+
onUnmounted,
|
|
8
|
+
ref
|
|
9
|
+
} from 'vue'
|
|
10
|
+
import type { DefaultTheme } from '../../shared'
|
|
11
|
+
import { useData } from '../composables/data'
|
|
12
|
+
import VPNavBarSearchButton from './VPNavBarSearchButton.vue'
|
|
13
|
+
|
|
14
|
+
const VPLocalSearchBox = __VP_LOCAL_SEARCH__
|
|
15
|
+
? defineAsyncComponent(() => import('./VPLocalSearchBox.vue'))
|
|
16
|
+
: () => null
|
|
17
|
+
|
|
18
|
+
const VPAlgoliaSearchBox = __ALGOLIA__
|
|
19
|
+
? defineAsyncComponent(() => import('./VPAlgoliaSearchBox.vue'))
|
|
20
|
+
: () => null
|
|
21
|
+
|
|
22
|
+
const { theme } = useData()
|
|
23
|
+
|
|
24
|
+
// to avoid loading the docsearch js upfront (which is more than 1/3 of the
|
|
25
|
+
// payload), we delay initializing it until the user has actually clicked or
|
|
26
|
+
// hit the hotkey to invoke it.
|
|
27
|
+
const loaded = ref(false)
|
|
28
|
+
const actuallyLoaded = ref(false)
|
|
29
|
+
|
|
30
|
+
const preconnect = () => {
|
|
31
|
+
const id = 'VPAlgoliaPreconnect'
|
|
32
|
+
|
|
33
|
+
const rIC = window.requestIdleCallback || setTimeout
|
|
34
|
+
rIC(() => {
|
|
35
|
+
const preconnect = document.createElement('link')
|
|
36
|
+
preconnect.id = id
|
|
37
|
+
preconnect.rel = 'preconnect'
|
|
38
|
+
preconnect.href = `https://${
|
|
39
|
+
((theme.value.search?.options as DefaultTheme.AlgoliaSearchOptions) ??
|
|
40
|
+
theme.value.algolia)!.appId
|
|
41
|
+
}-dsn.algolia.net`
|
|
42
|
+
preconnect.crossOrigin = ''
|
|
43
|
+
document.head.appendChild(preconnect)
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
onMounted(() => {
|
|
48
|
+
if (!__ALGOLIA__) {
|
|
49
|
+
return
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
preconnect()
|
|
53
|
+
|
|
54
|
+
const handleSearchHotKey = (event: KeyboardEvent) => {
|
|
55
|
+
if (
|
|
56
|
+
(event.key.toLowerCase() === 'k' && (event.metaKey || event.ctrlKey)) ||
|
|
57
|
+
(!isEditingContent(event) && event.key === '/')
|
|
58
|
+
) {
|
|
59
|
+
event.preventDefault()
|
|
60
|
+
load()
|
|
61
|
+
remove()
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const remove = () => {
|
|
66
|
+
window.removeEventListener('keydown', handleSearchHotKey)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
window.addEventListener('keydown', handleSearchHotKey)
|
|
70
|
+
|
|
71
|
+
onUnmounted(remove)
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
function load() {
|
|
75
|
+
if (!loaded.value) {
|
|
76
|
+
loaded.value = true
|
|
77
|
+
setTimeout(poll, 16)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function poll() {
|
|
82
|
+
// programmatically open the search box after initialize
|
|
83
|
+
const e = new Event('keydown') as any
|
|
84
|
+
|
|
85
|
+
e.key = 'k'
|
|
86
|
+
e.metaKey = true
|
|
87
|
+
|
|
88
|
+
window.dispatchEvent(e)
|
|
89
|
+
|
|
90
|
+
setTimeout(() => {
|
|
91
|
+
if (!document.querySelector('.DocSearch-Modal')) {
|
|
92
|
+
poll()
|
|
93
|
+
}
|
|
94
|
+
}, 16)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function isEditingContent(event: KeyboardEvent): boolean {
|
|
98
|
+
const element = event.target as HTMLElement
|
|
99
|
+
const tagName = element.tagName
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
element.isContentEditable ||
|
|
103
|
+
tagName === 'INPUT' ||
|
|
104
|
+
tagName === 'SELECT' ||
|
|
105
|
+
tagName === 'TEXTAREA'
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Local search
|
|
110
|
+
|
|
111
|
+
const showSearch = ref(false)
|
|
112
|
+
|
|
113
|
+
if (__VP_LOCAL_SEARCH__) {
|
|
114
|
+
onKeyStroke('k', (event) => {
|
|
115
|
+
if (event.ctrlKey || event.metaKey) {
|
|
116
|
+
event.preventDefault()
|
|
117
|
+
showSearch.value = true
|
|
118
|
+
}
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
onKeyStroke('/', (event) => {
|
|
122
|
+
if (!isEditingContent(event)) {
|
|
123
|
+
event.preventDefault()
|
|
124
|
+
showSearch.value = true
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const provider = __ALGOLIA__ ? 'algolia' : __VP_LOCAL_SEARCH__ ? 'local' : ''
|
|
130
|
+
</script>
|
|
131
|
+
|
|
132
|
+
<template>
|
|
133
|
+
<div class="VPNavBarSearch">
|
|
134
|
+
<template v-if="provider === 'local'">
|
|
135
|
+
<VPLocalSearchBox
|
|
136
|
+
v-if="showSearch"
|
|
137
|
+
@close="showSearch = false"
|
|
138
|
+
/>
|
|
139
|
+
|
|
140
|
+
<div id="local-search">
|
|
141
|
+
<VPNavBarSearchButton @click="showSearch = true" />
|
|
142
|
+
</div>
|
|
143
|
+
</template>
|
|
144
|
+
|
|
145
|
+
<template v-else-if="provider === 'algolia'">
|
|
146
|
+
<VPAlgoliaSearchBox
|
|
147
|
+
v-if="loaded"
|
|
148
|
+
:algolia="theme.search?.options ?? theme.algolia"
|
|
149
|
+
@vue:beforeMount="actuallyLoaded = true"
|
|
150
|
+
/>
|
|
151
|
+
|
|
152
|
+
<div v-if="!actuallyLoaded" id="docsearch">
|
|
153
|
+
<VPNavBarSearchButton @click="load" />
|
|
154
|
+
</div>
|
|
155
|
+
</template>
|
|
156
|
+
</div>
|
|
157
|
+
</template>
|
|
158
|
+
|
|
159
|
+
<style>
|
|
160
|
+
.VPNavBarSearch {
|
|
161
|
+
display: flex;
|
|
162
|
+
align-items: center;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
@media (min-width: 768px) {
|
|
166
|
+
.VPNavBarSearch {
|
|
167
|
+
flex-grow: 1;
|
|
168
|
+
padding-left: 24px;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
@media (min-width: 960px) {
|
|
173
|
+
.VPNavBarSearch {
|
|
174
|
+
padding-left: 32px;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.dark .DocSearch-Footer {
|
|
179
|
+
border-top: 1px solid var(--vp-c-divider);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.DocSearch-Form {
|
|
183
|
+
border: 1px solid var(--vp-c-brand-1);
|
|
184
|
+
background-color: var(--vp-c-white);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.dark .DocSearch-Form {
|
|
188
|
+
background-color: var(--vp-c-default-soft);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.DocSearch-Screen-Icon > svg {
|
|
192
|
+
margin: auto;
|
|
193
|
+
}
|
|
194
|
+
</style>
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { ButtonTranslations } from '../../../../types/local-search'
|
|
3
|
+
import { createSearchTranslate } from '../support/translation'
|
|
4
|
+
|
|
5
|
+
// Button-Translations
|
|
6
|
+
const defaultTranslations: { button: ButtonTranslations } = {
|
|
7
|
+
button: {
|
|
8
|
+
buttonText: 'Search',
|
|
9
|
+
buttonAriaLabel: 'Search'
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const translate = createSearchTranslate(defaultTranslations)
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<button type="button" class="DocSearch DocSearch-Button" :aria-label="translate('button.buttonAriaLabel')">
|
|
18
|
+
<span class="DocSearch-Button-Container">
|
|
19
|
+
<span class="vp-icon DocSearch-Search-Icon"></span>
|
|
20
|
+
<span class="DocSearch-Button-Placeholder">{{ translate('button.buttonText') }}</span>
|
|
21
|
+
</span>
|
|
22
|
+
<span class="DocSearch-Button-Keys">
|
|
23
|
+
<kbd class="DocSearch-Button-Key"></kbd>
|
|
24
|
+
<kbd class="DocSearch-Button-Key">K</kbd>
|
|
25
|
+
</span>
|
|
26
|
+
</button>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<style>
|
|
30
|
+
[class*='DocSearch'] {
|
|
31
|
+
--docsearch-primary-color: var(--vp-c-brand-1);
|
|
32
|
+
--docsearch-highlight-color: var(--docsearch-primary-color);
|
|
33
|
+
--docsearch-text-color: var(--vp-c-text-1);
|
|
34
|
+
--docsearch-muted-color: var(--vp-c-text-2);
|
|
35
|
+
--docsearch-searchbox-shadow: none;
|
|
36
|
+
--docsearch-searchbox-background: transparent;
|
|
37
|
+
--docsearch-searchbox-focus-background: transparent;
|
|
38
|
+
--docsearch-key-gradient: transparent;
|
|
39
|
+
--docsearch-key-shadow: none;
|
|
40
|
+
--docsearch-modal-background: var(--vp-c-bg-soft);
|
|
41
|
+
--docsearch-footer-background: var(--vp-c-bg);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.dark [class*='DocSearch'] {
|
|
45
|
+
--docsearch-modal-shadow: none;
|
|
46
|
+
--docsearch-footer-shadow: none;
|
|
47
|
+
--docsearch-logo-color: var(--vp-c-text-2);
|
|
48
|
+
--docsearch-hit-background: var(--vp-c-default-soft);
|
|
49
|
+
--docsearch-hit-color: var(--vp-c-text-2);
|
|
50
|
+
--docsearch-hit-shadow: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.DocSearch-Button {
|
|
54
|
+
display: flex;
|
|
55
|
+
justify-content: center;
|
|
56
|
+
align-items: center;
|
|
57
|
+
margin: 0;
|
|
58
|
+
padding: 0;
|
|
59
|
+
width: 48px;
|
|
60
|
+
height: 55px;
|
|
61
|
+
background: transparent;
|
|
62
|
+
transition: border-color 0.25s;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.DocSearch-Button:hover {
|
|
66
|
+
background: transparent;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.DocSearch-Button:focus {
|
|
70
|
+
outline: 1px dotted;
|
|
71
|
+
outline: 5px auto -webkit-focus-ring-color;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.DocSearch-Button:focus:not(:focus-visible) {
|
|
75
|
+
outline: none !important;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@media (min-width: 768px) {
|
|
79
|
+
.DocSearch-Button {
|
|
80
|
+
justify-content: flex-start;
|
|
81
|
+
border: 1px solid transparent;
|
|
82
|
+
border-radius: 8px;
|
|
83
|
+
padding: 0 10px 0 12px;
|
|
84
|
+
width: 100%;
|
|
85
|
+
height: 40px;
|
|
86
|
+
background-color: var(--vp-c-bg-alt);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.DocSearch-Button:hover {
|
|
90
|
+
border-color: var(--vp-c-brand-1);
|
|
91
|
+
background: var(--vp-c-bg-alt);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.DocSearch-Button .DocSearch-Button-Container {
|
|
96
|
+
display: flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.DocSearch-Button .DocSearch-Search-Icon {
|
|
101
|
+
position: relative;
|
|
102
|
+
width: 16px;
|
|
103
|
+
height: 16px;
|
|
104
|
+
color: var(--vp-c-text-1);
|
|
105
|
+
fill: currentColor;
|
|
106
|
+
transition: color 0.5s;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.DocSearch-Button:hover .DocSearch-Search-Icon {
|
|
110
|
+
color: var(--vp-c-text-1);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@media (min-width: 768px) {
|
|
114
|
+
.DocSearch-Button .DocSearch-Search-Icon {
|
|
115
|
+
top: 1px;
|
|
116
|
+
margin-right: 8px;
|
|
117
|
+
width: 14px;
|
|
118
|
+
height: 14px;
|
|
119
|
+
color: var(--vp-c-text-2);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.DocSearch-Button .DocSearch-Button-Placeholder {
|
|
124
|
+
display: none;
|
|
125
|
+
margin-top: 2px;
|
|
126
|
+
padding: 0 16px 0 0;
|
|
127
|
+
font-size: 13px;
|
|
128
|
+
font-weight: 500;
|
|
129
|
+
color: var(--vp-c-text-2);
|
|
130
|
+
transition: color 0.5s;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.DocSearch-Button:hover .DocSearch-Button-Placeholder {
|
|
134
|
+
color: var(--vp-c-text-1);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@media (min-width: 768px) {
|
|
138
|
+
.DocSearch-Button .DocSearch-Button-Placeholder {
|
|
139
|
+
display: inline-block;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.DocSearch-Button .DocSearch-Button-Keys {
|
|
144
|
+
/*rtl:ignore*/
|
|
145
|
+
direction: ltr;
|
|
146
|
+
display: none;
|
|
147
|
+
min-width: auto;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@media (min-width: 768px) {
|
|
151
|
+
.DocSearch-Button .DocSearch-Button-Keys {
|
|
152
|
+
display: flex;
|
|
153
|
+
align-items: center;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.DocSearch-Button .DocSearch-Button-Key {
|
|
158
|
+
display: block;
|
|
159
|
+
margin: 2px 0 0 0;
|
|
160
|
+
border: 1px solid var(--vp-c-divider);
|
|
161
|
+
/*rtl:begin:ignore*/
|
|
162
|
+
border-right: none;
|
|
163
|
+
border-radius: 4px 0 0 4px;
|
|
164
|
+
padding-left: 6px;
|
|
165
|
+
/*rtl:end:ignore*/
|
|
166
|
+
min-width: 0;
|
|
167
|
+
width: auto;
|
|
168
|
+
height: 22px;
|
|
169
|
+
line-height: 22px;
|
|
170
|
+
font-family: var(--vp-font-family-base);
|
|
171
|
+
font-size: 12px;
|
|
172
|
+
font-weight: 500;
|
|
173
|
+
transition: color 0.5s, border-color 0.5s;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.DocSearch-Button .DocSearch-Button-Key + .DocSearch-Button-Key {
|
|
177
|
+
/*rtl:begin:ignore*/
|
|
178
|
+
border-right: 1px solid var(--vp-c-divider);
|
|
179
|
+
border-left: none;
|
|
180
|
+
border-radius: 0 4px 4px 0;
|
|
181
|
+
padding-left: 2px;
|
|
182
|
+
padding-right: 6px;
|
|
183
|
+
/*rtl:end:ignore*/
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.DocSearch-Button .DocSearch-Button-Key:first-child {
|
|
187
|
+
font-size: 0 !important;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.DocSearch-Button .DocSearch-Button-Key:first-child:after {
|
|
191
|
+
content: 'Ctrl';
|
|
192
|
+
font-size: 12px;
|
|
193
|
+
letter-spacing: normal;
|
|
194
|
+
color: var(--docsearch-muted-color);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.mac .DocSearch-Button .DocSearch-Button-Key:first-child:after {
|
|
198
|
+
content: '\2318';
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.DocSearch-Button .DocSearch-Button-Key:first-child > * {
|
|
202
|
+
display: none;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.DocSearch-Search-Icon {
|
|
206
|
+
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' stroke-width='1.6' viewBox='0 0 20 20'%3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' d='m14.386 14.386 4.088 4.088-4.088-4.088A7.533 7.533 0 1 1 3.733 3.733a7.533 7.533 0 0 1 10.653 10.653z'/%3E%3C/svg%3E");
|
|
207
|
+
}
|
|
208
|
+
</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useData } from '../composables/data'
|
|
3
|
+
import VPSocialLinks from './VPSocialLinks.vue'
|
|
4
|
+
|
|
5
|
+
const { theme } = useData()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<VPSocialLinks
|
|
10
|
+
v-if="theme.socialLinks"
|
|
11
|
+
class="VPNavBarSocialLinks"
|
|
12
|
+
:links="theme.socialLinks"
|
|
13
|
+
/>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<style scoped>
|
|
17
|
+
.VPNavBarSocialLinks {
|
|
18
|
+
display: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@media (min-width: 1280px) {
|
|
22
|
+
.VPNavBarSocialLinks {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
</style>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { useData } from '../composables/data'
|
|
4
|
+
import { useLangs } from '../composables/langs'
|
|
5
|
+
import { useSidebar } from '../composables/sidebar'
|
|
6
|
+
import { normalizeLink } from '../support/utils'
|
|
7
|
+
import VPImage from './VPImage.vue'
|
|
8
|
+
|
|
9
|
+
const { site, theme } = useData()
|
|
10
|
+
const { hasSidebar } = useSidebar()
|
|
11
|
+
const { currentLang } = useLangs()
|
|
12
|
+
|
|
13
|
+
const link = computed(() =>
|
|
14
|
+
typeof theme.value.logoLink === 'string'
|
|
15
|
+
? theme.value.logoLink
|
|
16
|
+
: theme.value.logoLink?.link
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
const rel = computed(() =>
|
|
20
|
+
typeof theme.value.logoLink === 'string'
|
|
21
|
+
? undefined
|
|
22
|
+
: theme.value.logoLink?.rel
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
const target = computed(() =>
|
|
26
|
+
typeof theme.value.logoLink === 'string'
|
|
27
|
+
? undefined
|
|
28
|
+
: theme.value.logoLink?.target
|
|
29
|
+
)
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<div class="VPNavBarTitle" :class="{ 'has-sidebar': hasSidebar }">
|
|
34
|
+
<a
|
|
35
|
+
class="title"
|
|
36
|
+
:href="link ?? normalizeLink(currentLang.link)"
|
|
37
|
+
:rel="rel"
|
|
38
|
+
:target="target"
|
|
39
|
+
>
|
|
40
|
+
<slot name="nav-bar-title-before" />
|
|
41
|
+
<VPImage v-if="theme.logo" class="logo" :image="theme.logo" />
|
|
42
|
+
<template v-if="theme.siteTitle"><span>{{ theme.siteTitle }}</span></template>
|
|
43
|
+
<template v-else-if="theme.siteTitle === undefined"><span>{{ site.title }}</span></template>
|
|
44
|
+
<slot name="nav-bar-title-after" />
|
|
45
|
+
</a>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<style scoped>
|
|
50
|
+
.title {
|
|
51
|
+
display: flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
border-bottom: 1px solid transparent;
|
|
54
|
+
width: 100%;
|
|
55
|
+
height: var(--vp-nav-height);
|
|
56
|
+
font-size: 16px;
|
|
57
|
+
font-weight: 600;
|
|
58
|
+
color: var(--vp-c-text-1);
|
|
59
|
+
transition: opacity 0.25s;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@media (min-width: 960px) {
|
|
63
|
+
.title {
|
|
64
|
+
flex-shrink: 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.VPNavBarTitle.has-sidebar .title {
|
|
68
|
+
border-bottom-color: var(--vp-c-divider);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:deep(.logo) {
|
|
73
|
+
margin-right: 8px;
|
|
74
|
+
height: var(--vp-nav-logo-height);
|
|
75
|
+
}
|
|
76
|
+
</style>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import VPFlyout from './VPFlyout.vue'
|
|
3
|
+
import VPMenuLink from './VPMenuLink.vue'
|
|
4
|
+
import { useData } from '../composables/data'
|
|
5
|
+
import { useLangs } from '../composables/langs'
|
|
6
|
+
|
|
7
|
+
const { theme } = useData()
|
|
8
|
+
const { localeLinks, currentLang } = useLangs({ correspondingLink: true })
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<VPFlyout
|
|
13
|
+
v-if="localeLinks.length && currentLang.label"
|
|
14
|
+
class="VPNavBarTranslations"
|
|
15
|
+
icon="vpi-languages"
|
|
16
|
+
:label="theme.langMenuLabel || 'Change language'"
|
|
17
|
+
>
|
|
18
|
+
<div class="items">
|
|
19
|
+
<p class="title">{{ currentLang.label }}</p>
|
|
20
|
+
|
|
21
|
+
<template v-for="locale in localeLinks" :key="locale.link">
|
|
22
|
+
<VPMenuLink :item="locale" />
|
|
23
|
+
</template>
|
|
24
|
+
</div>
|
|
25
|
+
</VPFlyout>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<style scoped>
|
|
29
|
+
.VPNavBarTranslations {
|
|
30
|
+
display: none;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@media (min-width: 1280px) {
|
|
34
|
+
.VPNavBarTranslations {
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.title {
|
|
41
|
+
padding: 0 24px 0 12px;
|
|
42
|
+
line-height: 32px;
|
|
43
|
+
font-size: 14px;
|
|
44
|
+
font-weight: 700;
|
|
45
|
+
color: var(--vp-c-text-1);
|
|
46
|
+
}
|
|
47
|
+
</style>
|