valaxy 0.20.0 → 0.20.2
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/ValaxyApp.vue +5 -35
- package/client/components/ValaxyFootnoteTooltip.vue +12 -15
- package/client/composables/app/index.ts +1 -0
- package/client/composables/app/useValaxyHead.ts +47 -0
- package/client/composables/index.ts +3 -0
- package/client/modules/floating-vue.ts +3 -9
- package/client/stores/app.ts +11 -2
- package/dist/chunk-LFH2U2WQ.cjs +154 -0
- package/dist/chunk-N5526RM3.mjs +155 -0
- package/dist/{config-DRImYfNf.d.cts → config-BXn7sQx8.d.cts} +6 -1
- package/dist/{config-DRImYfNf.d.ts → config-BXn7sQx8.d.ts} +6 -1
- 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 -13
- package/dist/node/index.d.ts +73 -13
- 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 +28 -27
- package/types/config.ts +6 -1
- package/dist/chunk-J3KURXZZ.cjs +0 -156
- package/dist/chunk-WLSTHI6Y.mjs +0 -157
- /package/dist/{chunk-D6FLLKWU.cjs → chunk-7EKNBB3E.cjs} +0 -0
- /package/dist/{chunk-KCYZWGKZ.mjs → chunk-AUDFAOQV.mjs} +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
// TODO: add docs to override ValaxyApp
|
|
3
3
|
import { computed } from 'vue'
|
|
4
|
-
import { useHead, useSeoMeta } from '@unhead/vue'
|
|
4
|
+
// import { useHead, useSeoMeta } from '@unhead/vue'
|
|
5
|
+
import { useSeoMeta } from '@unhead/vue'
|
|
5
6
|
|
|
6
7
|
// @ts-expect-error virtual module
|
|
7
8
|
import ValaxyUserApp from '/@valaxyjs/UserAppVue'
|
|
8
9
|
// @ts-expect-error virtual module
|
|
9
10
|
import ValaxyThemeApp from '/@valaxyjs/ThemeAppVue'
|
|
10
11
|
|
|
11
|
-
import pkg from 'valaxy/package.json'
|
|
12
12
|
import { useI18n } from 'vue-i18n'
|
|
13
13
|
import { definePerson, defineWebPage, defineWebSite, useSchemaOrg } from '@unhead/schema-org'
|
|
14
14
|
|
|
@@ -16,7 +16,7 @@ import { definePerson, defineWebPage, defineWebSite, useSchemaOrg } from '@unhea
|
|
|
16
16
|
// you can use this to manipulate the document head in any components,
|
|
17
17
|
// they will be rendered correctly in the html results with vite-ssg
|
|
18
18
|
import { useSiteConfig } from '../config'
|
|
19
|
-
import { useFrontmatter } from '../composables'
|
|
19
|
+
import { useFrontmatter, useValaxyHead } from '../composables'
|
|
20
20
|
import { useTimezone } from '../composables/global'
|
|
21
21
|
import ValaxyAddons from './ValaxyAddons.vue'
|
|
22
22
|
|
|
@@ -30,38 +30,6 @@ const fm = useFrontmatter()
|
|
|
30
30
|
const { locale } = useI18n()
|
|
31
31
|
|
|
32
32
|
const title = computed(() => fm.value[`title_${locale.value}`] || fm.value.title)
|
|
33
|
-
useHead({
|
|
34
|
-
title,
|
|
35
|
-
titleTemplate: computed(() => fm.value.titleTemplate || ((title: string) => title ? `${title} - ${siteConfig.value.title}` : siteConfig.value.title)),
|
|
36
|
-
link: [
|
|
37
|
-
{
|
|
38
|
-
rel: 'icon',
|
|
39
|
-
href: siteConfig.value.favicon,
|
|
40
|
-
type: siteConfig.value.favicon?.endsWith('svg') ? 'image/svg+xml' : 'image/png',
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
meta: [
|
|
44
|
-
{ name: 'description', content: computed(() => siteConfig.value.description) },
|
|
45
|
-
{
|
|
46
|
-
name: 'generator',
|
|
47
|
-
content: `Valaxy ${pkg.version}`,
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
|
|
51
|
-
templateParams: {
|
|
52
|
-
schemaOrg: {
|
|
53
|
-
host: siteConfig.value.url,
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
script: [
|
|
58
|
-
{
|
|
59
|
-
id: 'check-mac-os',
|
|
60
|
-
innerHTML: `document.documentElement.classList.toggle('mac', /Mac|iPhone|iPod|iPad/i.test(navigator.platform))`,
|
|
61
|
-
async: true,
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
})
|
|
65
33
|
|
|
66
34
|
// seo
|
|
67
35
|
// todo: get first image url from markdown
|
|
@@ -99,6 +67,8 @@ useSchemaOrg([
|
|
|
99
67
|
])
|
|
100
68
|
|
|
101
69
|
useTimezone()
|
|
70
|
+
|
|
71
|
+
useValaxyHead()
|
|
102
72
|
</script>
|
|
103
73
|
|
|
104
74
|
<template>
|
|
@@ -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 @@
|
|
|
1
|
+
export * from './useValaxyHead'
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { computed } from 'vue'
|
|
2
|
+
import pkg from 'valaxy/package.json'
|
|
3
|
+
import { useHead } from '@unhead/vue'
|
|
4
|
+
import { useI18n } from 'vue-i18n'
|
|
5
|
+
|
|
6
|
+
import { useSiteConfig } from '../../config'
|
|
7
|
+
import { useFrontmatter } from '../../composables'
|
|
8
|
+
|
|
9
|
+
export function useValaxyHead() {
|
|
10
|
+
const { locale } = useI18n()
|
|
11
|
+
|
|
12
|
+
const fm = useFrontmatter()
|
|
13
|
+
const siteConfig = useSiteConfig()
|
|
14
|
+
const title = computed(() => fm.value[`title_${locale.value}`] || fm.value.title)
|
|
15
|
+
useHead({
|
|
16
|
+
title,
|
|
17
|
+
titleTemplate: computed(() => fm.value.titleTemplate || ((title: string) => title ? `${title} - ${siteConfig.value.title}` : siteConfig.value.title)),
|
|
18
|
+
link: [
|
|
19
|
+
{
|
|
20
|
+
rel: 'icon',
|
|
21
|
+
href: siteConfig.value.favicon,
|
|
22
|
+
type: siteConfig.value.favicon?.endsWith('svg') ? 'image/svg+xml' : 'image/png',
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
meta: [
|
|
26
|
+
{ name: 'description', content: computed(() => siteConfig.value.description) },
|
|
27
|
+
{
|
|
28
|
+
name: 'generator',
|
|
29
|
+
content: `Valaxy ${pkg.version}`,
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
|
|
33
|
+
templateParams: {
|
|
34
|
+
schemaOrg: {
|
|
35
|
+
host: siteConfig.value.url,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
script: [
|
|
40
|
+
{
|
|
41
|
+
id: 'check-mac-os',
|
|
42
|
+
innerHTML: `document.documentElement.classList.toggle('mac', /Mac|iPhone|iPod|iPad/i.test(navigator.platform))`,
|
|
43
|
+
async: true,
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
})
|
|
47
|
+
}
|
|
@@ -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,
|