valaxy-theme-press 0.28.0 → 0.28.1
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.
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { DocSearchInstance, DocSearchProps } from '@docsearch/js'
|
|
3
3
|
import type { SidepanelInstance, SidepanelProps } from '@docsearch/sidepanel-js'
|
|
4
|
-
import type { AlgoliaSearchOptions } from '
|
|
5
|
-
import {
|
|
6
|
-
import { nextTick, onUnmounted, watch } from 'vue'
|
|
4
|
+
import type { AlgoliaSearchOptions } from '../types/algolia'
|
|
5
|
+
import { nextTick, onUnmounted, ref, watch } from 'vue'
|
|
7
6
|
import { useRouter } from 'vue-router'
|
|
8
7
|
|
|
9
8
|
import '../styles/docsearch.css'
|
|
@@ -16,7 +15,15 @@ const props = defineProps<{
|
|
|
16
15
|
}>()
|
|
17
16
|
|
|
18
17
|
const router = useRouter()
|
|
19
|
-
|
|
18
|
+
|
|
19
|
+
// Dynamically import addon to avoid hard dependency
|
|
20
|
+
const algoliaConfig = ref<{ options?: AlgoliaSearchOptions }>()
|
|
21
|
+
import('valaxy-addon-algolia').then(({ useAddonAlgoliaConfig }) => {
|
|
22
|
+
// Direct assignment — the synchronous watcher below will react to this change
|
|
23
|
+
algoliaConfig.value = useAddonAlgoliaConfig().value
|
|
24
|
+
}).catch(() => {
|
|
25
|
+
console.warn('[valaxy-theme-press] valaxy-addon-algolia is not installed. Algolia search will not work.')
|
|
26
|
+
})
|
|
20
27
|
|
|
21
28
|
let cleanup = () => {}
|
|
22
29
|
let docsearchInstance: DocSearchInstance | undefined
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { useFrontmatter } from 'valaxy'
|
|
3
3
|
import { computed } from 'vue'
|
|
4
|
-
import { useI18n } from 'vue-i18n'
|
|
5
4
|
import { useLocaleConfig } from '../composables'
|
|
6
5
|
import PressButton from './PressButton.vue'
|
|
7
6
|
|
|
8
7
|
const fm = useFrontmatter()
|
|
9
8
|
|
|
10
|
-
const { t } = useI18n()
|
|
11
|
-
|
|
12
9
|
const { currentLocale, currentLocaleKey, hasLocales } = useLocaleConfig()
|
|
13
10
|
|
|
14
11
|
/**
|
|
@@ -31,36 +28,39 @@ const actions = computed(() => {
|
|
|
31
28
|
</script>
|
|
32
29
|
|
|
33
30
|
<template>
|
|
34
|
-
<
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
<template v-if="fm.hero">
|
|
32
|
+
<div text="center" m="md:t-24 t-10 md:t-20" flex="~ col" justify="center" items="center">
|
|
33
|
+
<ValaxyLogo mb="2" />
|
|
34
|
+
<h1 my="10" text="4xl md:8xl" font="black" class="gradient-text from-purple-800 to-blue-500 bg-gradient-to-r">
|
|
35
|
+
{{ fm.hero.name }}
|
|
36
|
+
</h1>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<h2 v-if="fm.hero?.text" flex="~ wrap justify-center" px="2" m="b-10" text="center 6xl" font="black" leading="tight">
|
|
40
|
+
{{ fm.hero.text }}
|
|
41
|
+
</h2>
|
|
40
42
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<span mx-1 class="gradient-text from-blue-500 to-purple-700 bg-gradient-to-r">{{ t('banner.blog') }}</span>
|
|
45
|
-
<span mx-1 class="break-keep">{{ t('banner.framework') }}</span>
|
|
46
|
-
</h2>
|
|
43
|
+
<p v-if="fm.hero?.tagline" m="b-10" text="center xl" op="80">
|
|
44
|
+
{{ fm.hero.tagline }}
|
|
45
|
+
</p>
|
|
47
46
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
47
|
+
<div v-if="actions.length" p="2" text="center" class="flex justify-center items-center">
|
|
48
|
+
<template v-for="action in actions" :key="action.link">
|
|
49
|
+
<PressGetStarted
|
|
50
|
+
v-if="action.type === 'fly'"
|
|
51
|
+
:theme="action.theme"
|
|
52
|
+
:link="action.link"
|
|
53
|
+
:text="action.text"
|
|
54
|
+
/>
|
|
55
|
+
<PressButton
|
|
56
|
+
v-else
|
|
57
|
+
:theme="action.theme"
|
|
58
|
+
:link="action.link"
|
|
59
|
+
:text="action.text"
|
|
60
|
+
/>
|
|
61
|
+
</template>
|
|
62
|
+
</div>
|
|
64
63
|
|
|
65
|
-
|
|
64
|
+
<br>
|
|
65
|
+
</template>
|
|
66
66
|
</template>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
+
import type { AlgoliaSearchOptions } from '../types/algolia'
|
|
2
3
|
import { onKeyStroke } from '@vueuse/core'
|
|
3
4
|
import { useSiteConfig } from 'valaxy'
|
|
4
5
|
import { computed, defineAsyncComponent, onMounted, ref } from 'vue'
|
|
@@ -16,7 +17,7 @@ const showAskAi = ref(false)
|
|
|
16
17
|
if (isAlgolia.value) {
|
|
17
18
|
import('valaxy-addon-algolia').then(({ useAddonAlgoliaConfig }) => {
|
|
18
19
|
const algoliaConfig = useAddonAlgoliaConfig()
|
|
19
|
-
const askAi = algoliaConfig.value?.options?.askAi
|
|
20
|
+
const askAi = (algoliaConfig.value?.options as AlgoliaSearchOptions | undefined)?.askAi
|
|
20
21
|
showAskAi.value = !!askAi
|
|
21
22
|
}).catch(() => {})
|
|
22
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "valaxy-theme-press",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.1",
|
|
4
4
|
"description": "Docs Theme for Valaxy",
|
|
5
5
|
"author": {
|
|
6
6
|
"email": "me@yunyoujun.cn",
|
|
@@ -25,9 +25,10 @@
|
|
|
25
25
|
"@docsearch/css": "^4.6.1",
|
|
26
26
|
"@docsearch/js": "^4.6.1",
|
|
27
27
|
"@docsearch/sidepanel-js": "^4.6.1",
|
|
28
|
-
"reka-ui": "^2.9.2"
|
|
28
|
+
"reka-ui": "^2.9.2",
|
|
29
|
+
"vitepress": "^2.0.0-alpha.17"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
|
-
"valaxy": "0.28.
|
|
32
|
+
"valaxy": "0.28.1"
|
|
32
33
|
}
|
|
33
34
|
}
|
package/types/algolia.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Algolia search types for valaxy-theme-press.
|
|
3
|
+
*
|
|
4
|
+
* These are defined locally to avoid depending on unpublished types
|
|
5
|
+
* from valaxy-addon-algolia. When the addon publishes updated types,
|
|
6
|
+
* these can be replaced with re-exports.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export interface AlgoliaSearchOptions extends DocSearchProps {
|
|
10
|
+
locales?: Record<string, Partial<DocSearchProps>>
|
|
11
|
+
/**
|
|
12
|
+
* Configuration or assistant id to enable Ask AI mode.
|
|
13
|
+
* Pass a string (assistant id) or a full config object.
|
|
14
|
+
* Omit to disable the Ask AI button entirely.
|
|
15
|
+
*/
|
|
16
|
+
askAi?: AlgoliaAskAiOptions | string
|
|
17
|
+
/**
|
|
18
|
+
* Ask AI side panel integration mode.
|
|
19
|
+
*
|
|
20
|
+
* @default 'auto'
|
|
21
|
+
*/
|
|
22
|
+
mode?: 'auto' | 'sidePanel' | 'hybrid' | 'modal'
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface AlgoliaAskAiOptions {
|
|
26
|
+
assistantId: string
|
|
27
|
+
appId?: string
|
|
28
|
+
apiKey?: string
|
|
29
|
+
indexName?: string
|
|
30
|
+
suggestedQuestions?: boolean
|
|
31
|
+
sidePanel?: boolean | AlgoliaSidepanelOptions
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface AlgoliaSidepanelOptions {
|
|
35
|
+
button?: Record<string, any>
|
|
36
|
+
keyboardShortcuts?: Record<string, boolean>
|
|
37
|
+
panel?: {
|
|
38
|
+
variant?: 'floating' | 'inline'
|
|
39
|
+
side?: 'left' | 'right'
|
|
40
|
+
width?: string
|
|
41
|
+
expandedWidth?: string
|
|
42
|
+
suggestedQuestions?: boolean
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface DocSearchProps {
|
|
47
|
+
appId: string
|
|
48
|
+
apiKey: string
|
|
49
|
+
indexName: string
|
|
50
|
+
placeholder?: string
|
|
51
|
+
searchParameters?: Record<string, any>
|
|
52
|
+
disableUserPersonalization?: boolean
|
|
53
|
+
initialQuery?: string
|
|
54
|
+
insights?: boolean
|
|
55
|
+
translations?: Record<string, any>
|
|
56
|
+
}
|