|
|
@ -2,7 +2,6 @@
|
|
|
|
import '@docsearch/css'
|
|
|
|
import '@docsearch/css'
|
|
|
|
import { onKeyStroke } from '@vueuse/core'
|
|
|
|
import { onKeyStroke } from '@vueuse/core'
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
computed,
|
|
|
|
|
|
|
|
defineAsyncComponent,
|
|
|
|
defineAsyncComponent,
|
|
|
|
onMounted,
|
|
|
|
onMounted,
|
|
|
|
onUnmounted,
|
|
|
|
onUnmounted,
|
|
|
@ -20,7 +19,7 @@ const VPAlgoliaSearchBox = __ALGOLIA__
|
|
|
|
? defineAsyncComponent(() => import('./VPAlgoliaSearchBox.vue'))
|
|
|
|
? defineAsyncComponent(() => import('./VPAlgoliaSearchBox.vue'))
|
|
|
|
: () => null
|
|
|
|
: () => null
|
|
|
|
|
|
|
|
|
|
|
|
const { theme, localeIndex } = useData()
|
|
|
|
const { theme } = useData()
|
|
|
|
|
|
|
|
|
|
|
|
// to avoid loading the docsearch js upfront (which is more than 1/3 of the
|
|
|
|
// to avoid loading the docsearch js upfront (which is more than 1/3 of the
|
|
|
|
// payload), we delay initializing it until the user has actually clicked or
|
|
|
|
// payload), we delay initializing it until the user has actually clicked or
|
|
|
@ -28,16 +27,6 @@ const { theme, localeIndex } = useData()
|
|
|
|
const loaded = ref(false)
|
|
|
|
const loaded = ref(false)
|
|
|
|
const actuallyLoaded = ref(false)
|
|
|
|
const actuallyLoaded = ref(false)
|
|
|
|
|
|
|
|
|
|
|
|
const buttonText = computed(() => {
|
|
|
|
|
|
|
|
const options = theme.value.search?.options ?? theme.value.algolia
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
options?.locales?.[localeIndex.value]?.translations?.button?.buttonText ||
|
|
|
|
|
|
|
|
options?.translations?.button?.buttonText ||
|
|
|
|
|
|
|
|
'Search'
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const preconnect = () => {
|
|
|
|
const preconnect = () => {
|
|
|
|
const id = 'VPAlgoliaPreconnect'
|
|
|
|
const id = 'VPAlgoliaPreconnect'
|
|
|
|
|
|
|
|
|
|
|
@ -145,15 +134,11 @@ const provider = __ALGOLIA__ ? 'algolia' : __VP_LOCAL_SEARCH__ ? 'local' : ''
|
|
|
|
<template v-if="provider === 'local'">
|
|
|
|
<template v-if="provider === 'local'">
|
|
|
|
<VPLocalSearchBox
|
|
|
|
<VPLocalSearchBox
|
|
|
|
v-if="showSearch"
|
|
|
|
v-if="showSearch"
|
|
|
|
:placeholder="buttonText"
|
|
|
|
|
|
|
|
@close="showSearch = false"
|
|
|
|
@close="showSearch = false"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
|
|
<div id="local-search">
|
|
|
|
<div id="local-search">
|
|
|
|
<VPNavBarSearchButton
|
|
|
|
<VPNavBarSearchButton @click="showSearch = true" />
|
|
|
|
:placeholder="buttonText"
|
|
|
|
|
|
|
|
@click="showSearch = true"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
@ -165,7 +150,7 @@ const provider = __ALGOLIA__ ? 'algolia' : __VP_LOCAL_SEARCH__ ? 'local' : ''
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
|
|
<div v-if="!actuallyLoaded" id="docsearch">
|
|
|
|
<div v-if="!actuallyLoaded" id="docsearch">
|
|
|
|
<VPNavBarSearchButton :placeholder="buttonText" @click="load" />
|
|
|
|
<VPNavBarSearchButton @click="load" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|