valaxy 0.20.1 → 0.20.3
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/client/components/ValaxyFootnoteTooltip.vue +12 -15
- package/client/composables/index.ts +1 -0
- package/client/composables/search/fuse.ts +57 -0
- package/client/composables/search/index.ts +1 -0
- package/client/modules/floating-vue.ts +3 -9
- package/client/stores/app.ts +11 -2
- package/dist/chunk-3BOTWUWT.cjs +161 -0
- package/dist/chunk-YHBMYDF7.mjs +162 -0
- package/dist/{config-DRImYfNf.d.cts → config-DfXD9Gt_.d.cts} +32 -4
- package/dist/{config-DRImYfNf.d.ts → config-DfXD9Gt_.d.ts} +32 -4
- package/dist/node/cli/index.cjs +1 -1
- package/dist/node/cli/index.mjs +1 -1
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.d.cts +73 -11
- package/dist/node/index.d.ts +73 -11
- package/dist/node/index.mjs +1 -1
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.mjs +1 -1
- package/package.json +23 -21
- package/types/config.ts +31 -3
- package/types/node.ts +1 -1
- package/dist/chunk-G54Q6VIZ.mjs +0 -157
- package/dist/chunk-SHLDAAJY.cjs +0 -156
- /package/dist/{chunk-SWO32WYT.cjs → chunk-7EKNBB3E.cjs} +0 -0
- /package/dist/{chunk-FRSA4VPQ.mjs → chunk-AUDFAOQV.mjs} +0 -0
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
const Component = ({
|
|
5
|
-
...PopperWrapper,
|
|
6
|
-
name: 'ValaxyFootnoteTooltip',
|
|
7
|
-
vPopperTheme: 'tooltip',
|
|
8
|
-
}) as unknown as typeof PopperWrapper
|
|
9
|
-
|
|
10
|
-
export default Component
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { Tooltip } from 'floating-vue'
|
|
3
|
+
// distance offset for sup
|
|
11
4
|
</script>
|
|
12
5
|
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
<template>
|
|
7
|
+
<Tooltip class="inline-block" :distance="8">
|
|
8
|
+
<slot />
|
|
9
|
+
|
|
10
|
+
<template #popper>
|
|
11
|
+
<slot name="popper" />
|
|
12
|
+
</template>
|
|
13
|
+
</Tooltip>
|
|
14
|
+
</template>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { computed, onMounted, shallowRef } from 'vue'
|
|
2
|
+
import { useSiteConfig } from 'valaxy'
|
|
3
|
+
import type { MaybeRefOrGetter } from '@vueuse/shared'
|
|
4
|
+
import type { UseFuseOptions } from '@vueuse/integrations/useFuse'
|
|
5
|
+
import { useFuse } from '@vueuse/integrations/useFuse'
|
|
6
|
+
import type { FuseListItem } from 'valaxy/types'
|
|
7
|
+
|
|
8
|
+
export function useFuseSearch<T extends FuseListItem = FuseListItem>(
|
|
9
|
+
search: MaybeRefOrGetter<string>,
|
|
10
|
+
options?: MaybeRefOrGetter<UseFuseOptions<T>>,
|
|
11
|
+
) {
|
|
12
|
+
const siteConfig = useSiteConfig()
|
|
13
|
+
|
|
14
|
+
const fuseListData = shallowRef<T[]>([])
|
|
15
|
+
|
|
16
|
+
const keys = computed(() => {
|
|
17
|
+
const ks = siteConfig.value.fuse.options.keys || []
|
|
18
|
+
return ks.length === 0 ? ['title', 'tags', 'categories', 'excerpt'] : ks
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const defaultOptions: UseFuseOptions<T> = {
|
|
22
|
+
fuseOptions: {
|
|
23
|
+
includeMatches: true,
|
|
24
|
+
findAllMatches: true,
|
|
25
|
+
// threshold: 0.99,
|
|
26
|
+
// ignoreLocation: true,
|
|
27
|
+
|
|
28
|
+
...siteConfig.value.fuse.options,
|
|
29
|
+
keys: keys.value,
|
|
30
|
+
},
|
|
31
|
+
// resultLimit: resultLimit.value,
|
|
32
|
+
// matchAllWhenSearchEmpty: matchAllWhenSearchEmpty.value,
|
|
33
|
+
}
|
|
34
|
+
const useFuseOptions = computed<UseFuseOptions<T>>(() => ({
|
|
35
|
+
...defaultOptions,
|
|
36
|
+
...options,
|
|
37
|
+
}))
|
|
38
|
+
|
|
39
|
+
const ruse = useFuse<T>(search, fuseListData, useFuseOptions)
|
|
40
|
+
|
|
41
|
+
async function fetchFuseListData(path?: string) {
|
|
42
|
+
const fuseListDataPath = path
|
|
43
|
+
|| (siteConfig.value.fuse.dataPath.startsWith('http')
|
|
44
|
+
? siteConfig.value.fuse.dataPath
|
|
45
|
+
: `${import.meta.env.BASE_URL}${siteConfig.value.fuse.dataPath}`)
|
|
46
|
+
|
|
47
|
+
const res = await fetch(fuseListDataPath)
|
|
48
|
+
const data = await res.json()
|
|
49
|
+
|
|
50
|
+
if (Array.isArray(data))
|
|
51
|
+
fuseListData.value = data
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
onMounted(fetchFuseListData)
|
|
55
|
+
|
|
56
|
+
return ruse
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './fuse'
|
|
@@ -6,13 +6,7 @@ import type { DefaultTheme, ValaxyConfig } from 'valaxy/types'
|
|
|
6
6
|
import type { ComputedRef } from 'vue'
|
|
7
7
|
|
|
8
8
|
export async function install({ app }: ViteSSGContext, config: ComputedRef<ValaxyConfig<DefaultTheme.Config>>) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
delay: {
|
|
13
|
-
show: 0,
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
}, config.value.siteConfig.floatingVue || {}))
|
|
9
|
+
// @see https://floating-vue.starpad.dev/guide/config#default-values
|
|
10
|
+
const defaultFloatingVueConfig = {}
|
|
11
|
+
app.use(FloatingVue, Object.assign(defaultFloatingVueConfig, config.value.siteConfig.floatingVue || {}))
|
|
18
12
|
}
|
package/client/stores/app.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { acceptHMRUpdate, defineStore } from 'pinia'
|
|
2
|
-
import { ref } from 'vue'
|
|
3
|
-
import { useMobile, useThemeConfig, useValaxyDark } from 'valaxy'
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
|
+
import { useMobile, useSiteConfig, useThemeConfig, useValaxyDark } from 'valaxy'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Global store for users
|
|
@@ -11,16 +11,25 @@ import { useMobile, useThemeConfig, useValaxyDark } from 'valaxy'
|
|
|
11
11
|
* ```
|
|
12
12
|
*/
|
|
13
13
|
export const useAppStore = defineStore('app', () => {
|
|
14
|
+
const siteConfig = useSiteConfig()
|
|
15
|
+
|
|
14
16
|
const themeConfig = useThemeConfig()
|
|
15
17
|
const { isDark, toggleDark, toggleDarkWithTransition, themeColor } = useValaxyDark(themeConfig.value.valaxyDarkOptions)
|
|
16
18
|
|
|
17
19
|
const isMobile = useMobile()
|
|
18
20
|
const showLoading = ref(true)
|
|
19
21
|
|
|
22
|
+
const showToggleLocale = computed(() => siteConfig.value.languages.length > 1)
|
|
23
|
+
|
|
20
24
|
return {
|
|
21
25
|
isMobile,
|
|
22
26
|
// for dark
|
|
23
27
|
isDark,
|
|
28
|
+
/**
|
|
29
|
+
* show toggle locale btn
|
|
30
|
+
* only show toggle when `siteConfig.languages.length > 1`
|
|
31
|
+
*/
|
|
32
|
+
showToggleLocale,
|
|
24
33
|
themeColor,
|
|
25
34
|
toggleDark,
|
|
26
35
|
toggleDarkWithTransition,
|