valaxy-theme-yun 0.13.0 → 0.13.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.
@@ -1,7 +1,7 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import type { PageData, Post } from 'valaxy'
|
3
|
-
import { usePostTitle,
|
4
|
-
import { StyleValue, computed
|
3
|
+
import { usePostTitle, useSiteConfig } from 'valaxy'
|
4
|
+
import { StyleValue, computed } from 'vue'
|
5
5
|
import { usePostProperty } from '../composables'
|
6
6
|
|
7
7
|
const props = defineProps<{
|
@@ -9,23 +9,12 @@ const props = defineProps<{
|
|
9
9
|
data?: PageData
|
10
10
|
}>()
|
11
11
|
|
12
|
-
const runtimeConfig = useRuntimeConfig()
|
13
12
|
const siteConfig = useSiteConfig()
|
14
13
|
|
15
14
|
const { styles, icon, color } = usePostProperty(props.frontmatter.type)
|
16
15
|
const title = usePostTitle(computed(() => props.frontmatter))
|
17
16
|
|
18
17
|
const aside = computed(() => props.frontmatter.aside !== false)
|
19
|
-
|
20
|
-
// not import from 'valaxy-addon-waline' to judge
|
21
|
-
const YunWaline = runtimeConfig.value.addons['valaxy-addon-waline']
|
22
|
-
? defineAsyncComponent(() => import('./YunWaline.vue'))
|
23
|
-
: () => null
|
24
|
-
|
25
|
-
// todo: refactor
|
26
|
-
const YunTwikoo = runtimeConfig.value.addons['valaxy-addon-twikoo']
|
27
|
-
? defineAsyncComponent(() => import('./YunTwikoo.vue'))
|
28
|
-
: () => null
|
29
18
|
</script>
|
30
19
|
|
31
20
|
<template>
|
@@ -60,10 +49,7 @@ const YunTwikoo = runtimeConfig.value.addons['valaxy-addon-twikoo']
|
|
60
49
|
<slot name="main-nav-after" />
|
61
50
|
|
62
51
|
<slot v-if="siteConfig.comment.enable && frontmatter.comment !== false" name="comment">
|
63
|
-
<
|
64
|
-
<YunWaline />
|
65
|
-
<YunTwikoo />
|
66
|
-
</YunCard>
|
52
|
+
<YunComment :class="frontmatter.nav === false ? 'mt-4' : 0" />
|
67
53
|
</slot>
|
68
54
|
|
69
55
|
<slot name="main-footer-before" />
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<script lang="ts" setup>
|
2
|
+
import { useRuntimeConfig } from 'valaxy'
|
3
|
+
import { defineAsyncComponent } from 'vue'
|
4
|
+
|
5
|
+
const runtimeConfig = useRuntimeConfig()
|
6
|
+
|
7
|
+
// not import from 'valaxy-addon-waline' to judge
|
8
|
+
const YunWaline = runtimeConfig.value.addons['valaxy-addon-waline']
|
9
|
+
? defineAsyncComponent(() => import('./YunWaline.vue'))
|
10
|
+
: () => null
|
11
|
+
|
12
|
+
// todo: refactor
|
13
|
+
const YunTwikoo = runtimeConfig.value.addons['valaxy-addon-twikoo']
|
14
|
+
? defineAsyncComponent(() => import('./YunTwikoo.vue'))
|
15
|
+
: () => null
|
16
|
+
</script>
|
17
|
+
|
18
|
+
<template>
|
19
|
+
<YunCard w="full" p="4" class="comment sm:p-6 lg:px-12 xl:px-16">
|
20
|
+
<ClientOnly>
|
21
|
+
<YunWaline />
|
22
|
+
<YunTwikoo />
|
23
|
+
</ClientOnly>
|
24
|
+
</YunCard>
|
25
|
+
</template>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import { computed } from '@vue/reactivity'
|
3
3
|
import { useSiteConfig } from 'valaxy'
|
4
|
-
import {
|
4
|
+
import { ref, watch } from 'vue'
|
5
5
|
import { useI18n } from 'vue-i18n'
|
6
6
|
import { useMagicKeys } from '@vueuse/core'
|
7
7
|
|
@@ -20,49 +20,19 @@ function load() {
|
|
20
20
|
|
21
21
|
const isAlgolia = computed(() => siteConfig.value.search.type === 'algolia')
|
22
22
|
|
23
|
-
onMounted(() => {
|
24
|
-
if (!isAlgolia.value)
|
25
|
-
return
|
26
|
-
|
27
|
-
const handleSearchHotKey = (e: KeyboardEvent) => {
|
28
|
-
if (e.key === 'k' && (e.ctrlKey || e.metaKey)) {
|
29
|
-
e.preventDefault()
|
30
|
-
load()
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
32
|
-
remove()
|
33
|
-
}
|
34
|
-
}
|
35
|
-
|
36
|
-
const remove = () => {
|
37
|
-
window.removeEventListener('keydown', handleSearchHotKey)
|
38
|
-
}
|
39
|
-
|
40
|
-
window.addEventListener('keydown', handleSearchHotKey)
|
41
|
-
|
42
|
-
onUnmounted(remove)
|
43
|
-
})
|
44
|
-
|
45
23
|
const open = ref(false)
|
46
24
|
|
47
|
-
const trigger = () => {
|
48
|
-
// todo, refactor shortcut
|
49
|
-
const e = new Event('keydown') as any
|
50
|
-
|
51
|
-
e.key = 'k'
|
52
|
-
e.metaKey = true
|
53
|
-
}
|
54
|
-
|
55
25
|
const togglePopup = () => {
|
56
26
|
open.value = !open.value
|
57
|
-
|
58
|
-
trigger()
|
59
27
|
}
|
60
28
|
|
61
29
|
const { Meta_K } = useMagicKeys()
|
62
30
|
|
63
31
|
watch(Meta_K, (val) => {
|
64
|
-
if (val)
|
32
|
+
if (val) {
|
65
33
|
togglePopup()
|
34
|
+
load()
|
35
|
+
}
|
66
36
|
})
|
67
37
|
</script>
|
68
38
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "valaxy-theme-yun",
|
3
|
-
"version": "0.13.
|
3
|
+
"version": "0.13.2",
|
4
4
|
"author": {
|
5
5
|
"email": "me@yunyoujun.cn",
|
6
6
|
"name": "YunYouJun",
|
@@ -22,6 +22,6 @@
|
|
22
22
|
"valaxy-addon-waline": "0.0.9"
|
23
23
|
},
|
24
24
|
"devDependencies": {
|
25
|
-
"valaxy": "0.13.
|
25
|
+
"valaxy": "0.13.2"
|
26
26
|
}
|
27
27
|
}
|