valaxy-theme-hairy 0.0.14 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- package/components/HairyBody.vue +1 -1
- package/components/HairyCodepen.vue +40 -0
- package/components/HairyFooter.vue +7 -2
- package/components/HairyLayout.vue +1 -1
- package/components/HairyWaline.vue +15 -0
- package/layouts/hairy.vue +11 -2
- package/layouts/post.vue +22 -0
- package/modules/loading.scss +7 -6
- package/modules/loading.ts +3 -0
- package/package.json +1 -1
- package/styles/index.scss +1 -0
- package/styles/markdown.scss +29 -0
package/components/HairyBody.vue
CHANGED
@@ -11,7 +11,7 @@ const showWaline = computed(() => route.path.includes('/posts/') || fr.value.wal
|
|
11
11
|
<template>
|
12
12
|
<div class="HairyBody min-h-49vh relative">
|
13
13
|
<div class="mx-auto breakpoint flex z-1 relative">
|
14
|
-
<div class="relative flex-1 pt-2">
|
14
|
+
<div class="relative flex-1 pt-2 w-0">
|
15
15
|
<slot />
|
16
16
|
<HairyWaline v-if="showWaline" />
|
17
17
|
</div>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<script lang="ts" setup>
|
2
|
+
import { useScriptTag } from '@vueuse/core'
|
3
|
+
import { defineProps, withDefaults } from 'vue'
|
4
|
+
|
5
|
+
withDefaults(
|
6
|
+
defineProps<{
|
7
|
+
height: number | string
|
8
|
+
defaultTab: string
|
9
|
+
slugHash: string
|
10
|
+
user?: string
|
11
|
+
prefill?: Record<string, any>
|
12
|
+
title?: string
|
13
|
+
placeholder?: string
|
14
|
+
theme?: string
|
15
|
+
}>(),
|
16
|
+
{
|
17
|
+
height: 300,
|
18
|
+
defaultTab: 'html',
|
19
|
+
},
|
20
|
+
)
|
21
|
+
|
22
|
+
useScriptTag('https://cpwebassets.codepen.io/assets/embed/ei.js')
|
23
|
+
</script>
|
24
|
+
|
25
|
+
<template>
|
26
|
+
<div
|
27
|
+
class="codepen"
|
28
|
+
:data-height="300"
|
29
|
+
:data-default-tab="defaultTab"
|
30
|
+
:data-slug-hash="slugHash"
|
31
|
+
:data-user="user"
|
32
|
+
:data-prefill="prefill"
|
33
|
+
:data-pen-title="title"
|
34
|
+
:data-placeholder="placeholder"
|
35
|
+
:data-theme-id="theme"
|
36
|
+
/>
|
37
|
+
</template>
|
38
|
+
|
39
|
+
<style lang="scss" scoped>
|
40
|
+
</style>
|
@@ -21,7 +21,7 @@ const footerIcon = computed(() => themeConfig.value.footer.icon)
|
|
21
21
|
</script>
|
22
22
|
|
23
23
|
<template>
|
24
|
-
<footer v-if="themeConfig.footer" class="va-footer p-4 pb-
|
24
|
+
<footer v-if="themeConfig.footer" class="va-footer p-4 pt-5 pb-14" text="center sm" style="color:var(--va-c-text-light)">
|
25
25
|
<div v-if="themeConfig.footer.beian?.enable && themeConfig.footer.beian.icp" class="beian" m="y-2">
|
26
26
|
<a href="https://beian.miit.gov.cn/" target="_blank" rel="noopener">
|
27
27
|
{{ themeConfig.footer.beian.icp }}
|
@@ -41,7 +41,12 @@ const footerIcon = computed(() => themeConfig.value.footer.icon)
|
|
41
41
|
<div :class="footerIcon.name" />
|
42
42
|
</a>
|
43
43
|
|
44
|
-
<span
|
44
|
+
<span>{{ config.author.name }}</span>
|
45
|
+
<span class="mx-2">|</span>
|
46
|
+
<span v-if="config.comment.waline" class="flex items-center">
|
47
|
+
<div class="i-ri-eye-fill mr-1" />
|
48
|
+
<span class="waline-pageview-count" data-path="/">1</span>
|
49
|
+
</span>
|
45
50
|
</div>
|
46
51
|
|
47
52
|
<div v-if="themeConfig.footer.powered" class="powered" m="2">
|
@@ -6,6 +6,10 @@ const config = useConfig()
|
|
6
6
|
// 挂载 Waline
|
7
7
|
useWaline({
|
8
8
|
el: '#waline',
|
9
|
+
emoji: [
|
10
|
+
'//unpkg.com/@waline/emojis@1.0.1/weibo',
|
11
|
+
'//unpkg.com/@waline/emojis@1.0.1/bilibili',
|
12
|
+
],
|
9
13
|
...config.value.comment.waline,
|
10
14
|
})
|
11
15
|
</script>
|
@@ -26,4 +30,15 @@ useWaline({
|
|
26
30
|
padding: 4px;
|
27
31
|
width: calc(100% - 1rem - 8px);
|
28
32
|
}
|
33
|
+
.wl-emoji-popup {
|
34
|
+
border-bottom: none !important;
|
35
|
+
z-index: 1000;
|
36
|
+
}
|
37
|
+
.wl-emoji-popup .wl-tabs {
|
38
|
+
height: auto !important;
|
39
|
+
overflow-x: auto !important;
|
40
|
+
padding: 0 !important;
|
41
|
+
margin-left: -1px;
|
42
|
+
margin-right: -1px;
|
43
|
+
}
|
29
44
|
</style>
|
package/layouts/hairy.vue
CHANGED
@@ -1,11 +1,20 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
import { computed } from 'vue'
|
2
|
+
import { computed, onMounted } from 'vue'
|
3
3
|
import { useRoute } from 'vue-router'
|
4
|
+
import { pageviewCount } from '@waline/client'
|
5
|
+
import { useConfig } from 'valaxy'
|
4
6
|
|
5
7
|
const route = useRoute()
|
6
8
|
const meta = computed(() => route.meta)
|
7
9
|
const type = computed(() => meta.value.type || '')
|
8
|
-
|
10
|
+
const config = useConfig()
|
11
|
+
|
12
|
+
onMounted(() => {
|
13
|
+
pageviewCount({
|
14
|
+
serverURL: config.value.comment.waline.serverURL,
|
15
|
+
path: window.location.pathname,
|
16
|
+
})
|
17
|
+
})
|
9
18
|
</script>
|
10
19
|
|
11
20
|
<template>
|
package/layouts/post.vue
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import { useFrontmatter } from 'valaxy'
|
3
|
+
import { ElTag } from 'element-plus/es/components/tag/index'
|
4
|
+
import 'element-plus/es/components/tag/style/index'
|
3
5
|
import dayjs from 'dayjs'
|
6
|
+
import { useRouter } from 'vue-router'
|
7
|
+
const router = useRouter()
|
4
8
|
|
5
9
|
const post = useFrontmatter()
|
10
|
+
|
11
|
+
const displayTag = (tag: string) => {
|
12
|
+
router.push(`/tags/${tag}`)
|
13
|
+
}
|
6
14
|
</script>
|
7
15
|
|
8
16
|
<template>
|
@@ -16,11 +24,25 @@ const post = useFrontmatter()
|
|
16
24
|
<span>本文字数 {{ (post.length / 1000).toFixed(1) }}k 字</span>
|
17
25
|
<span>阅读时长 {{ post.durations.minutes.toFixed(2) }} 分钟</span>
|
18
26
|
</div>
|
27
|
+
<div v-if="post.tags?.length" class="tags flex-center gap-2 mt-2">
|
28
|
+
<el-tag v-for="(tag) in post.tags" :key="tag" class="dark:bg-dark-50 cursor-pointer" @click="displayTag(tag)">
|
29
|
+
{{ tag }}
|
30
|
+
</el-tag>
|
31
|
+
</div>
|
19
32
|
</template>
|
20
33
|
<router-view />
|
34
|
+
<div class="mb-15">
|
35
|
+
<div class="border-t border-gray-200 dark:border-gray-600"></div>
|
36
|
+
<div class="flex items-center justify-end mt-2">
|
37
|
+
<div class="i-ri-eye-fill mr-2" />
|
38
|
+
阅读次数 <span class="waline-pageview-count mx-2">1</span> 次
|
39
|
+
</div>
|
40
|
+
</div>
|
21
41
|
<template #body-slide>
|
22
42
|
<HairyUserTab />
|
23
43
|
</template>
|
24
44
|
</HairyLayout>
|
25
45
|
</template>
|
26
46
|
|
47
|
+
<style lang="scss">
|
48
|
+
</style>
|
package/modules/loading.scss
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
.hy-loading {
|
2
|
-
position:
|
2
|
+
position: fixed;
|
3
3
|
top: 0;
|
4
4
|
left: 0;
|
5
|
+
bottom: 0;
|
6
|
+
right: 0;
|
5
7
|
z-index: 100;
|
6
|
-
|
7
|
-
height: 100%;
|
8
|
+
|
8
9
|
background: #eee;
|
9
10
|
|
10
11
|
transition: opacity 0.5s;
|
@@ -14,10 +15,10 @@
|
|
14
15
|
height: 50px;
|
15
16
|
position: fixed;
|
16
17
|
top: 50%;
|
17
|
-
|
18
|
-
margin-left: -50px;
|
18
|
+
margin: auto;
|
19
19
|
margin-top: -50px;
|
20
|
-
|
20
|
+
left: 0;
|
21
|
+
right: 0;
|
21
22
|
}
|
22
23
|
|
23
24
|
#preloader {
|
package/modules/loading.ts
CHANGED
@@ -30,6 +30,8 @@ function showFullLoading() {
|
|
30
30
|
el = createElement()
|
31
31
|
el.style.opacity = '0'
|
32
32
|
document.body.appendChild(el)
|
33
|
+
document.body.style.overflow = 'hidden'
|
34
|
+
|
33
35
|
setTimeout(() => el.style.opacity = '1')
|
34
36
|
isLoading.value = true
|
35
37
|
}
|
@@ -38,6 +40,7 @@ function hideFullLoading() {
|
|
38
40
|
if (!el)
|
39
41
|
return
|
40
42
|
el.style.opacity = '0'
|
43
|
+
document.body.style.overflow = ''
|
41
44
|
setTimeout(() => {
|
42
45
|
isLoading.value = true
|
43
46
|
el.remove()
|
package/package.json
CHANGED
package/styles/index.scss
CHANGED
package/styles/markdown.scss
CHANGED
@@ -48,6 +48,16 @@ html.dark {
|
|
48
48
|
max-width: calc(100vw - 56px);
|
49
49
|
}
|
50
50
|
|
51
|
+
.markdown-body div[class*=language-] {
|
52
|
+
width: 100%;
|
53
|
+
}
|
54
|
+
|
55
|
+
@media screen and (max-width: 640px) {
|
56
|
+
.markdown-body div[class*=language-] {
|
57
|
+
margin: auto;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
51
61
|
|
52
62
|
.prose :where(:not(pre) > code):not(:where(.not-prose, .not-prose *))::before,
|
53
63
|
.prose :where(:not(pre) > code):not(:where(.not-prose, .not-prose *))::after {
|
@@ -57,4 +67,23 @@ html.dark {
|
|
57
67
|
.custom-block.tip {
|
58
68
|
background-color: rgba(200, 200, 200, 0.1);
|
59
69
|
border-color: var(--hy-c-primary);
|
70
|
+
}
|
71
|
+
|
72
|
+
.markdown-body {
|
73
|
+
--un-prose-borders: var(--hy-c-primary);
|
74
|
+
}
|
75
|
+
|
76
|
+
.markdown-body div[class*=language-] pre {
|
77
|
+
max-width: none;
|
78
|
+
}
|
79
|
+
|
80
|
+
.prose :where(blockquote):not(:where(.not-prose, .not-prose *)) {
|
81
|
+
background: rgba(200, 200, 200, 0.1);
|
82
|
+
@apply py-1px;
|
83
|
+
|
84
|
+
font-size: 15px;
|
85
|
+
|
86
|
+
>p {
|
87
|
+
margin: 0.5rem 0;
|
88
|
+
}
|
60
89
|
}
|