valaxy-theme-hairy 0.2.2 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/client/index.ts +1 -0
- package/components/HairyBody.vue +15 -17
- package/components/HairyComment.vue +33 -0
- package/components/HairyContainer.vue +17 -0
- package/components/{HairyUserPopup.vue → HairyDrawer.vue} +16 -16
- package/components/HairyFooter.vue +12 -9
- package/components/HairyHeader.vue +10 -9
- package/components/HairyImage.vue +3 -2
- package/components/HairyImageGroup.vue +12 -16
- package/components/HairyNavbar.vue +56 -0
- package/components/HairyPageArchives.vue +59 -0
- package/components/HairyPageTags.vue +48 -0
- package/components/{HairyPostList.vue → HairyPosts.vue} +3 -3
- package/components/{HairyNavSearch.vue → HairySearch.vue} +23 -87
- package/components/{HairyUserCard.vue → HairySidebar.vue} +4 -4
- package/components/HairyTabbar.vue +56 -0
- package/components/PageTags.vue +48 -0
- package/components/ValaxyMain.vue +3 -3
- package/components/navbar/HairyNav.vue +16 -0
- package/components/navbar/HairyNavExpand.vue +12 -0
- package/components/navbar/HairyNavItem.vue +35 -0
- package/components/navbar/HairyNavbarBackground.vue +7 -0
- package/components/navbar/HairyNavbarSearch.vue +8 -0
- package/components/{HairyNavTitle.vue → navbar/HairyNavbarTitle.vue} +5 -3
- package/components/navbar/HairyNavbarToggleDark.vue +22 -0
- package/components/{HairyBreadcrumb.vue → parts/HairyBreadcrumb.vue} +2 -2
- package/components/{HairyBreadcrumbItem.vue → parts/HairyBreadcrumbItem.vue} +1 -4
- package/components/{lib/fish.js → parts/HairyFootFish.js} +5 -7
- package/components/parts/HairyFootFish.vue +38 -0
- package/components/{HairyPostTitle.vue → parts/HairyHeadHero.vue} +6 -5
- package/components/{HairyWaves.vue → parts/HairyHeadWaves.vue} +5 -5
- package/components/parts/HairyImageGlobal.vue +51 -0
- package/components/{HairyImageViewer.vue → parts/HairyImageViewer.vue} +5 -4
- package/components/parts/HairyLink.vue +21 -0
- package/components/{HairyMenu.vue → parts/HairyMenu.vue} +2 -1
- package/components/{HairyMenuItem.vue → parts/HairyMenuItem.vue} +11 -4
- package/components/parts/HairyOutline.vue +99 -0
- package/components/parts/HairyOutlineItem.vue +48 -0
- package/components/{HairySocialLinks.vue → parts/HairySocialLinks.vue} +2 -2
- package/components/{HairyTimelinePostItem.vue → parts/HairyTimelineContent.vue} +7 -8
- package/components/parts/HairyUserNav.vue +95 -0
- package/components/{article-layout → posts}/HairyArticleImage.vue +18 -19
- package/components/{article-layout → posts}/HairyArticleSeries.vue +8 -5
- package/components/{article-layout → posts}/HairyArticleText.vue +11 -4
- package/components/posts/HairyPostFooter.vue +15 -0
- package/components/{article-layout → posts}/HairyPostImageList.vue +4 -5
- package/components/{article-layout → posts}/HairyPostTextsList.vue +0 -1
- package/components/posts/HairyPostToggleLayout.vue +36 -0
- package/components/third/HairyAlgoliaSearch.vue +17 -0
- package/components/third/HairyFuseSearch.vue +10 -0
- package/components/third/HairyFuseSearchDialog.vue +32 -0
- package/components/third/HairyFuseSearchDropdown.vue +77 -0
- package/components/third/HairyFuseSearchFooter.vue +28 -0
- package/components/third/HairyFuseSearchHeader.vue +30 -0
- package/components/third/HairyFuseSearchHit.vue +52 -0
- package/components/third/HairySearchBtnDisplay.vue +29 -0
- package/components/third/HairySearchBtnInput.vue +20 -0
- package/components/third/HairySearchBtnKeys.vue +19 -0
- package/components/{HairyCarousel.vue → third/HairySwiperCarousel.vue} +6 -6
- package/{hooks/useYearArchives.ts → composables/archives.ts} +4 -3
- package/composables/category.ts +43 -0
- package/composables/config.ts +11 -0
- package/composables/dark.ts +13 -0
- package/composables/fuse.ts +60 -0
- package/composables/index.ts +8 -0
- package/composables/layout.ts +16 -0
- package/composables/outline.ts +49 -0
- package/composables/tags.ts +36 -0
- package/layouts/archive-month.vue +13 -0
- package/layouts/archive-year.vue +13 -0
- package/layouts/archives.vue +9 -9
- package/layouts/categories.vue +11 -4
- package/layouts/default.vue +9 -3
- package/layouts/home.vue +28 -18
- package/layouts/post.vue +42 -36
- package/layouts/tag.vue +8 -4
- package/layouts/tags.vue +12 -4
- package/{modules → library}/loading.ts +18 -6
- package/{modules → library}/scroll.ts +3 -2
- package/locales/zh-CN.yml +0 -2
- package/node/images/default.json +139 -0
- package/node/images/index.ts +46 -0
- package/node/index.ts +2 -0
- package/node/theme/index.ts +78 -0
- package/package.json +22 -28
- package/pages/archives/[year]/[month]/index.vue +15 -18
- package/pages/archives/[year]/index.vue +20 -20
- package/pages/archives/index.vue +1 -54
- package/pages/categories/{[...categories].vue → [...its].vue} +29 -36
- package/pages/index.vue +1 -1
- package/pages/page/[page].vue +2 -2
- package/pages/tags/[tag]/index.vue +38 -0
- package/pages/tags/index.vue +1 -36
- package/setup/main.ts +1 -1
- package/store/index.ts +1 -0
- package/store/modules/global.ts +12 -0
- package/styles/components/index.scss +4 -0
- package/styles/{markdown.scss → components/markdown.scss} +2 -1
- package/styles/components/nprogress.scss +16 -0
- package/styles/css-vars.scss +11 -0
- package/styles/element-plus/tabs.scss +1 -1
- package/styles/element-plus/timeline.scss +1 -1
- package/styles/global.scss +39 -0
- package/styles/index.scss +4 -73
- package/tsconfig.json +27 -0
- package/types/index.d.ts +163 -0
- package/unocss.config.ts +5 -1
- package/utils/index.ts +21 -39
- package/valaxy.config.ts +21 -24
- package/@types/markdown-it.d.ts +0 -1
- package/@types/markdown-toc.d.ts +0 -1
- package/@types/types.d.ts +0 -1
- package/@types/valaxy.d.ts +0 -10
- package/components/HairyAlgoliaSearchBox.vue +0 -118
- package/components/HairyBackToTop.vue +0 -72
- package/components/HairyDivider.vue +0 -0
- package/components/HairyFooterFish.vue +0 -29
- package/components/HairyLayout.vue +0 -28
- package/components/HairyLink.vue +0 -10
- package/components/HairyLinks.vue +0 -69
- package/components/HairyMeting.vue +0 -19
- package/components/HairyNav.vue +0 -42
- package/components/HairyNavBackground.vue +0 -7
- package/components/HairyNavMenu.vue +0 -11
- package/components/HairyNavToggleDark.vue +0 -16
- package/components/HairyPostToggleLayout.vue +0 -33
- package/components/HairyToc.vue +0 -135
- package/components/HairyUserNav.vue +0 -64
- package/components/HairyUserTab.vue +0 -40
- package/components/HairyWaline.vue +0 -44
- package/hooks/setupDefaultDark.ts +0 -11
- package/hooks/useCategory.ts +0 -18
- package/hooks/useCategoryPost.ts +0 -21
- package/hooks/useContext.ts +0 -13
- package/hooks/useHeaderHeight.ts +0 -9
- package/hooks/usePostLayout.ts +0 -16
- package/images.json +0 -140
- package/index.d.ts +0 -100
- package/layouts/hairy.vue +0 -36
- package/layouts/month.vue +0 -6
- package/layouts/year.vue +0 -6
- package/node/addon-hairy.ts +0 -36
- package/node/addon-images.ts +0 -61
- package/node/addon-meting.ts +0 -13
- package/node/addon-statistics.ts +0 -19
- package/node/addon-toc.ts +0 -20
- package/node/utils.ts +0 -20
- package/pages/tags/[tag].vue +0 -40
- package/utils/createContext.ts +0 -40
- package/utils/fonts.ts +0 -15
- /package/components/{HairyUserStats.vue → parts/HairyUserStats.vue} +0 -0
- /package/components/{article-layout → posts}/HairyArticleTop.vue +0 -0
- /package/{modules → library}/loading.scss +0 -0
- /package/{shims.d.ts → node/images/shims.d.ts} +0 -0
- /package/styles/{aplayer.scss → components/aplayer.scss} +0 -0
- /package/styles/{scrollbar.scss → components/scrollbar.scss} +0 -0
@@ -1,19 +0,0 @@
|
|
1
|
-
<script lang="ts" setup>
|
2
|
-
import { useAplayer, useThemeConfig } from 'valaxy'
|
3
|
-
|
4
|
-
import type { HairyTheme } from 'valaxy-theme-hairy'
|
5
|
-
|
6
|
-
const config = useThemeConfig<HairyTheme>()
|
7
|
-
|
8
|
-
if (config.value.meting)
|
9
|
-
useAplayer()
|
10
|
-
</script>
|
11
|
-
|
12
|
-
<template>
|
13
|
-
<meting-js
|
14
|
-
v-if="config.meting && config.meting.fixed !== false"
|
15
|
-
v-bind="config.meting"
|
16
|
-
:fixed="true"
|
17
|
-
>
|
18
|
-
</meting-js>
|
19
|
-
</template>
|
package/components/HairyNav.vue
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
<script lang="ts" setup>
|
2
|
-
import { useScroll, whenever } from '@vueuse/core'
|
3
|
-
import { computed, ref } from 'vue'
|
4
|
-
import { useHeaderHeight } from '../hooks/useHeaderHeight'
|
5
|
-
|
6
|
-
const headerHeight = useHeaderHeight()
|
7
|
-
const cache = ref<'top' | 'bottom'>('top')
|
8
|
-
const scroll = useScroll(document)
|
9
|
-
|
10
|
-
whenever(() => scroll.directions.top, () => {
|
11
|
-
cache.value = 'top'
|
12
|
-
})
|
13
|
-
whenever(() => scroll.directions.bottom, () => {
|
14
|
-
cache.value = 'bottom'
|
15
|
-
})
|
16
|
-
|
17
|
-
const show = computed(() => {
|
18
|
-
return scroll.y.value < (headerHeight.value / 2) || cache.value === 'top'
|
19
|
-
})
|
20
|
-
</script>
|
21
|
-
|
22
|
-
<template>
|
23
|
-
<div class="HairyNav fixed w-full h-3.125rem lt-sm:h-3.5rem top-0 z-20 opacity-0 transition-opacity duration-200" :class="[show && 'opacity-100']">
|
24
|
-
<div class="mx-auto breakpoint flex relative z-1 h-full">
|
25
|
-
<div class="flex items-center lt-sm:order-1 lt-sm:flex-1 justify-center">
|
26
|
-
<HairyNavTitle />
|
27
|
-
</div>
|
28
|
-
<div class="flex items-center sm:flex-1">
|
29
|
-
<HairyNavMenu class="sm:hidden pl-2 pr-13" />
|
30
|
-
<HairyMenu class="lt-sm:hidden" />
|
31
|
-
</div>
|
32
|
-
<div class="flex-center order-1">
|
33
|
-
<HairyNavToggleDark />
|
34
|
-
<HairyNavSearch />
|
35
|
-
</div>
|
36
|
-
</div>
|
37
|
-
<HairyNavBackground />
|
38
|
-
</div>
|
39
|
-
</template>
|
40
|
-
|
41
|
-
<style>
|
42
|
-
</style>
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<script lang="ts" setup>
|
2
|
-
import { useContext } from '../hooks/useContext'
|
3
|
-
|
4
|
-
const { drawerShow } = useContext()
|
5
|
-
</script>
|
6
|
-
|
7
|
-
<template>
|
8
|
-
<button class="yun-icon-btn lt-sm:text-size-xl" @click="drawerShow = true">
|
9
|
-
<div i="ri-menu-fill" />
|
10
|
-
</button>
|
11
|
-
</template>
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<script lang="ts" setup>
|
2
|
-
import { useI18n } from 'vue-i18n'
|
3
|
-
import { computed } from 'vue'
|
4
|
-
import { isDark, toggleDark } from 'valaxy'
|
5
|
-
|
6
|
-
const { t } = useI18n()
|
7
|
-
const themeTitle = computed(() => {
|
8
|
-
return isDark.value ? t('button.toggle_light') : t('button.toggle_dark')
|
9
|
-
})
|
10
|
-
</script>
|
11
|
-
|
12
|
-
<template>
|
13
|
-
<button class="yun-icon-btn bg-light-1 p-1 dark:bg-transparent rounded-5 lt-sm:text-size-xl" :title="themeTitle" :style="{ color: isDark ? '' : '#f1cb64' }" @click="toggleDark()">
|
14
|
-
<div i="ri-sun-line dark:ri-moon-line" />
|
15
|
-
</button>
|
16
|
-
</template>
|
@@ -1,33 +0,0 @@
|
|
1
|
-
<script lang="ts" setup>
|
2
|
-
import { useScroll } from '@vueuse/core'
|
3
|
-
import { computed } from 'vue'
|
4
|
-
import { usePostLayout } from '../hooks/usePostLayout'
|
5
|
-
import { useHeaderHeight } from '../hooks/useHeaderHeight'
|
6
|
-
import type { HairyPostLayout } from '..'
|
7
|
-
|
8
|
-
const layout = usePostLayout()
|
9
|
-
const layouts = [
|
10
|
-
{ layout: 'image:slice:reverse' as HairyPostLayout, icon: 'i-fluent-text-align-distributed-24-filled' },
|
11
|
-
{ layout: 'image:slice' as HairyPostLayout, icon: 'i-fluent-text-align-left-16-filled' },
|
12
|
-
{ layout: 'image' as HairyPostLayout, icon: 'i-fluent-text-align-justify-20-filled' },
|
13
|
-
{ layout: 'markdown' as HairyPostLayout, icon: 'i-fluent-markdown-20-filled' },
|
14
|
-
{ layout: 'text' as HairyPostLayout, icon: 'i-fluent-code-text-16-filled' },
|
15
|
-
]
|
16
|
-
|
17
|
-
const headerHeight = useHeaderHeight()
|
18
|
-
const scroll = useScroll(document)
|
19
|
-
|
20
|
-
const show = computed(() => {
|
21
|
-
return scroll.y.value > headerHeight.value
|
22
|
-
})
|
23
|
-
</script>
|
24
|
-
|
25
|
-
<template>
|
26
|
-
<div class="inline-flex gap-2 sticky top-15 inset-0 rounded-2" :class="[show && 'bg-white bg-opacity-85 dark:bg-black dark:bg-opacity-80 z-100']">
|
27
|
-
<div v-for="(item) in layouts" :key="item.layout" class="p-2 rounded-full cursor-pointer" :class="[layout === item.layout && 'text-primary']" @click="layout = item.layout">
|
28
|
-
<div class="text-size-xl" :class="item.icon" />
|
29
|
-
</div>
|
30
|
-
</div>
|
31
|
-
</template>
|
32
|
-
|
33
|
-
<style lang="scss" scoped></style>
|
package/components/HairyToc.vue
DELETED
@@ -1,135 +0,0 @@
|
|
1
|
-
<script setup lang="ts">
|
2
|
-
import { computed, ref } from 'vue'
|
3
|
-
import { useI18n } from 'vue-i18n'
|
4
|
-
import type { Header } from 'valaxy'
|
5
|
-
import {
|
6
|
-
resolveHeaders,
|
7
|
-
useActiveAnchor,
|
8
|
-
useFrontmatter,
|
9
|
-
useThemeConfig,
|
10
|
-
} from 'valaxy'
|
11
|
-
|
12
|
-
const props = defineProps<{ headers?: Header[] }>()
|
13
|
-
|
14
|
-
const frontmatter = useFrontmatter()
|
15
|
-
const themeConfig = useThemeConfig()
|
16
|
-
|
17
|
-
const { locale } = useI18n()
|
18
|
-
const container = ref()
|
19
|
-
const marker = ref()
|
20
|
-
|
21
|
-
useActiveAnchor(container, marker)
|
22
|
-
|
23
|
-
const resolvedHeaders = computed(() => {
|
24
|
-
return resolveHeaders(props.headers || frontmatter.value['it-toc'])
|
25
|
-
})
|
26
|
-
|
27
|
-
function handleClick({ target: el }: Event) {
|
28
|
-
const id = `#${(el as HTMLAnchorElement).href!.split('#')[1]}`
|
29
|
-
const heading = document.querySelector(decodeURIComponent(id)) as HTMLAnchorElement
|
30
|
-
heading?.focus()
|
31
|
-
}
|
32
|
-
</script>
|
33
|
-
|
34
|
-
<template>
|
35
|
-
<div v-show="resolvedHeaders.length" ref="container" class="animate__animated animate__fadeIn">
|
36
|
-
<div class="content">
|
37
|
-
<div class="outline-title">
|
38
|
-
{{ themeConfig.outlineTitle || 'On this page' }}
|
39
|
-
</div>
|
40
|
-
|
41
|
-
<div ref="marker" class="outline-marker" />
|
42
|
-
|
43
|
-
<nav aria-labelledby="doc-outline-aria-label">
|
44
|
-
<span id="doc-outline-aria-label" class="visually-hidden">
|
45
|
-
Table of Contents for current page
|
46
|
-
</span>
|
47
|
-
|
48
|
-
<ul class="va-toc relative z-1">
|
49
|
-
<li
|
50
|
-
v-for="{ text, link, children, hidden, lang } in resolvedHeaders"
|
51
|
-
v-show="!hidden"
|
52
|
-
:key="link"
|
53
|
-
class="va-toc-item"
|
54
|
-
:lang="lang || locale"
|
55
|
-
>
|
56
|
-
<a class="outline-link" :href="link" @click="handleClick">
|
57
|
-
{{ text }}
|
58
|
-
</a>
|
59
|
-
<ul v-if="children && frontmatter.outline === 'deep'">
|
60
|
-
<li v-for="item in children" v-show="!item.hidden" :key="item.link" :lang="lang || locale">
|
61
|
-
<a class="outline-link" p="l-3" :href="link" @click="handleClick">
|
62
|
-
{{ item.text }}
|
63
|
-
</a>
|
64
|
-
</li>
|
65
|
-
</ul>
|
66
|
-
</li>
|
67
|
-
</ul>
|
68
|
-
</nav>
|
69
|
-
</div>
|
70
|
-
</div>
|
71
|
-
</template>
|
72
|
-
|
73
|
-
<style lang="scss" scoped>
|
74
|
-
.va-toc {
|
75
|
-
text-align: left;
|
76
|
-
|
77
|
-
.va-toc-item {
|
78
|
-
color: var(--va-c-text-light);
|
79
|
-
}
|
80
|
-
}
|
81
|
-
|
82
|
-
.content {
|
83
|
-
position: relative;
|
84
|
-
padding-left: 16px;
|
85
|
-
font-size: 14px;
|
86
|
-
text-align: left;
|
87
|
-
}
|
88
|
-
|
89
|
-
.outline-marker {
|
90
|
-
position: absolute;
|
91
|
-
top: 32px;
|
92
|
-
left: -2px;
|
93
|
-
z-index: 0;
|
94
|
-
opacity: 0;
|
95
|
-
width: 4px;
|
96
|
-
height: 18px;
|
97
|
-
background-color: var(--va-c-brand);
|
98
|
-
transition: top 0.25s cubic-bezier(0, 1, 0.5, 1), background-color 0.5s, opacity 0.25s;
|
99
|
-
border-top-right-radius: 2px;
|
100
|
-
border-bottom-right-radius: 2px;
|
101
|
-
}
|
102
|
-
|
103
|
-
.outline-title {
|
104
|
-
letter-spacing: 0.4px;
|
105
|
-
line-height: 28px;
|
106
|
-
font-size: 14px;
|
107
|
-
font-weight: 600;
|
108
|
-
}
|
109
|
-
|
110
|
-
.outline-link {
|
111
|
-
display: block;
|
112
|
-
line-height: 28px;
|
113
|
-
color: var(--va-c-text-light);
|
114
|
-
white-space: nowrap;
|
115
|
-
overflow: hidden;
|
116
|
-
text-overflow: ellipsis;
|
117
|
-
transition: color 0.5s;
|
118
|
-
}
|
119
|
-
|
120
|
-
.outline-link:hover,
|
121
|
-
.outline-link.active {
|
122
|
-
color: var(--va-c-brand);
|
123
|
-
transition: color 0.25s;
|
124
|
-
}
|
125
|
-
|
126
|
-
.visually-hidden {
|
127
|
-
position: absolute;
|
128
|
-
width: 1px;
|
129
|
-
height: 1px;
|
130
|
-
white-space: nowrap;
|
131
|
-
clip: rect(0 0 0 0);
|
132
|
-
clip-path: inset(50%);
|
133
|
-
overflow: hidden;
|
134
|
-
}
|
135
|
-
</style>
|
@@ -1,64 +0,0 @@
|
|
1
|
-
<script lang="ts" setup>
|
2
|
-
import { usePostList, useTag } from 'valaxy'
|
3
|
-
import { computed } from 'vue'
|
4
|
-
import { toArr } from '../utils'
|
5
|
-
const posts = usePostList()
|
6
|
-
const tags = useTag()
|
7
|
-
|
8
|
-
const total = computed(() => {
|
9
|
-
const categories = posts.value.map(v => toArr(v.categories || [])).filter(v => v.length)
|
10
|
-
const maps: string[] = []
|
11
|
-
for (const category of categories) {
|
12
|
-
let caches: string[] = []
|
13
|
-
for (const iterator of category) {
|
14
|
-
caches.push(iterator)
|
15
|
-
maps.push(caches.join('-'))
|
16
|
-
}
|
17
|
-
caches = []
|
18
|
-
}
|
19
|
-
return new Set(maps).size
|
20
|
-
})
|
21
|
-
</script>
|
22
|
-
|
23
|
-
<template>
|
24
|
-
<div class="flex justify-center mt-2">
|
25
|
-
<HairyUserStats :count="posts.length" @click="$router.push('/archives/')">
|
26
|
-
文章
|
27
|
-
</HairyUserStats>
|
28
|
-
<div class="w-1px bg-gray bg-opacity-50" />
|
29
|
-
<HairyUserStats :count="total" @click="$router.push('/categories/')">
|
30
|
-
分类
|
31
|
-
</HairyUserStats>
|
32
|
-
<div class="w-1px bg-gray bg-opacity-50" />
|
33
|
-
<HairyUserStats :count="tags.size" @click="$router.push('/tags/')">
|
34
|
-
标签
|
35
|
-
</HairyUserStats>
|
36
|
-
</div>
|
37
|
-
<HairySocialLinks class="mt-5" />
|
38
|
-
<HairyMenu class="HairyUserMenu mt-5 flex-col h-auto" />
|
39
|
-
</template>
|
40
|
-
|
41
|
-
<style lang="scss">
|
42
|
-
.HairyUserMenu {
|
43
|
-
.HairyMenuItem {
|
44
|
-
padding: 2px;
|
45
|
-
width: 100%;
|
46
|
-
border: 1px solid transparent;
|
47
|
-
> div {
|
48
|
-
justify-content: center;
|
49
|
-
}
|
50
|
-
}
|
51
|
-
|
52
|
-
.HairyMenuItem:hover,
|
53
|
-
.HairyMenuItem.active {
|
54
|
-
border-top: 1px solid var(--hy-c-primary);
|
55
|
-
border-bottom: 1px solid var(--hy-c-primary);
|
56
|
-
}
|
57
|
-
.HairyMenuItem.active + .HairyMenuItem {
|
58
|
-
border-top-color: transparent;
|
59
|
-
}
|
60
|
-
.HairyMenuItem:hover + .HairyMenuItem {
|
61
|
-
border-top-color: transparent;
|
62
|
-
}
|
63
|
-
}
|
64
|
-
</style>
|
@@ -1,40 +0,0 @@
|
|
1
|
-
<script lang="ts" setup>
|
2
|
-
import { ElTabPane, ElTabs } from 'element-plus/es/components/tabs/index'
|
3
|
-
import 'element-plus/es/components/tabs/style/index'
|
4
|
-
import 'element-plus/es/components/tab-pane/style/index'
|
5
|
-
import { provide, ref } from 'vue'
|
6
|
-
const active = ref('aside')
|
7
|
-
provide('HairyUserTab:active', active)
|
8
|
-
</script>
|
9
|
-
|
10
|
-
<template>
|
11
|
-
<el-tabs v-model="active" class="pt-3">
|
12
|
-
<el-tab-pane name="aside">
|
13
|
-
<template #label>
|
14
|
-
<div class="flex items-center">
|
15
|
-
<div class="i-ri-list-check-2" />
|
16
|
-
<span class="ml-1">Aside</span>
|
17
|
-
</div>
|
18
|
-
</template>
|
19
|
-
<HairyToc />
|
20
|
-
</el-tab-pane>
|
21
|
-
<el-tab-pane label="Series" name="series">
|
22
|
-
<template #label>
|
23
|
-
<div class="flex items-center gap-1">
|
24
|
-
<div class="i-ri-flow-chart" />
|
25
|
-
<span class="ml-1">Series</span>
|
26
|
-
</div>
|
27
|
-
</template>
|
28
|
-
<HairyArticleSeries />
|
29
|
-
</el-tab-pane>
|
30
|
-
<el-tab-pane label="User" name="user">
|
31
|
-
<template #label>
|
32
|
-
<div class="flex items-center gap-1">
|
33
|
-
<div class="i-ri-user-line" />
|
34
|
-
<span class="ml-1">User</span>
|
35
|
-
</div>
|
36
|
-
</template>
|
37
|
-
<HairyUserCard />
|
38
|
-
</el-tab-pane>
|
39
|
-
</el-tabs>
|
40
|
-
</template>
|
@@ -1,44 +0,0 @@
|
|
1
|
-
<script lang="ts" setup>
|
2
|
-
import { useConfig } from 'valaxy'
|
3
|
-
import { useWaline } from 'valaxy/client/composables/comments/waline'
|
4
|
-
// 读取用户配置
|
5
|
-
const config = useConfig()
|
6
|
-
// 挂载 Waline
|
7
|
-
useWaline({
|
8
|
-
el: '#waline',
|
9
|
-
emoji: [
|
10
|
-
'//unpkg.com/@waline/emojis@1.0.1/weibo',
|
11
|
-
'//unpkg.com/@waline/emojis@1.0.1/bilibili',
|
12
|
-
],
|
13
|
-
...config.value.comment.waline,
|
14
|
-
})
|
15
|
-
</script>
|
16
|
-
|
17
|
-
<!-- Also, the documentation doesn't state that we need to install @waline/client, which I think is also an issue -->
|
18
|
-
<template>
|
19
|
-
<!-- waline html 挂载点,将其写入布局中 -->
|
20
|
-
<div id="waline" w="full" />
|
21
|
-
</template>
|
22
|
-
|
23
|
-
<style lang="scss">
|
24
|
-
// 可以在此处覆盖 waline 样式
|
25
|
-
#waline {
|
26
|
-
--waline-theme-color: var(--hy-c-primary);
|
27
|
-
--waline-active-color: var(--hy-c-primary-dark)
|
28
|
-
}
|
29
|
-
.wl-editor {
|
30
|
-
padding: 4px;
|
31
|
-
width: calc(100% - 1rem - 8px);
|
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
|
-
}
|
44
|
-
</style>
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { toggleDark, useThemeConfig } from 'valaxy'
|
2
|
-
import { useLocalStorage } from '@vueuse/core'
|
3
|
-
|
4
|
-
export function setupDefaultDark() {
|
5
|
-
const theme = useThemeConfig()
|
6
|
-
const local = useLocalStorage('--hairy-mode', '')
|
7
|
-
if (theme.value.mode && !local.value) {
|
8
|
-
local.value = theme.value.mode
|
9
|
-
toggleDark()
|
10
|
-
}
|
11
|
-
}
|
package/hooks/useCategory.ts
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
import type { ParentCategory, PostCategory } from 'valaxy'
|
2
|
-
import { useCategory } from 'valaxy'
|
3
|
-
import type { MaybeRef } from '@vueuse/core'
|
4
|
-
import { computed, unref } from 'vue'
|
5
|
-
|
6
|
-
export function useCurrentCategory(categories: MaybeRef<string[]>) {
|
7
|
-
const all = useCategory()
|
8
|
-
return computed(() => {
|
9
|
-
let parent: ParentCategory & Partial<PostCategory> = all
|
10
|
-
for (const category of unref(categories)) {
|
11
|
-
for (const [key, value] of parent.children) {
|
12
|
-
if (key === category)
|
13
|
-
parent = (value as ParentCategory)
|
14
|
-
}
|
15
|
-
}
|
16
|
-
return parent
|
17
|
-
})
|
18
|
-
}
|
package/hooks/useCategoryPost.ts
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
import type { MaybeRef } from '@vueuse/shared'
|
2
|
-
import { usePostList } from 'valaxy'
|
3
|
-
import { isEqual } from 'lodash-es'
|
4
|
-
import { computed, unref } from 'vue'
|
5
|
-
|
6
|
-
export function useCategoryPost(categories: MaybeRef<string[]>) {
|
7
|
-
const postList = usePostList()
|
8
|
-
return computed(() => {
|
9
|
-
if (!unref(categories).length)
|
10
|
-
return postList.value
|
11
|
-
return postList.value.filter((item) => {
|
12
|
-
let target = Array.isArray(item.categories)
|
13
|
-
? item.categories
|
14
|
-
: [item.categories || '']
|
15
|
-
target = target.filter(Boolean)
|
16
|
-
if (unref(categories)[0] === 'Uncategorized')
|
17
|
-
return !target.length
|
18
|
-
return isEqual(target.sort(), unref(categories).sort())
|
19
|
-
}) as any
|
20
|
-
})
|
21
|
-
}
|
package/hooks/useContext.ts
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
import { ref } from 'vue'
|
2
|
-
import { createSharedComposable } from '@vueuse/core'
|
3
|
-
|
4
|
-
const _useContext = () => {
|
5
|
-
const headerRef = ref<HTMLDivElement>()
|
6
|
-
const drawerShow = ref(false)
|
7
|
-
return {
|
8
|
-
headerRef,
|
9
|
-
drawerShow,
|
10
|
-
}
|
11
|
-
}
|
12
|
-
|
13
|
-
export const useContext = createSharedComposable(_useContext)
|
package/hooks/useHeaderHeight.ts
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
import { useElementSize } from '@vueuse/core'
|
2
|
-
import { computed } from 'vue'
|
3
|
-
import { useContext } from './useContext'
|
4
|
-
|
5
|
-
export function useHeaderHeight() {
|
6
|
-
const { headerRef } = useContext()
|
7
|
-
const size = useElementSize(headerRef)
|
8
|
-
return computed(() => size.height.value)
|
9
|
-
}
|
package/hooks/usePostLayout.ts
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
import { useThemeConfig } from 'valaxy'
|
2
|
-
import { createSharedComposable, useStorage } from '@vueuse/core'
|
3
|
-
import { computed } from 'vue'
|
4
|
-
import type { HairyPostLayout, HairyTheme } from '..'
|
5
|
-
|
6
|
-
const useSharedStorage = createSharedComposable(useStorage)
|
7
|
-
|
8
|
-
export function usePostLayout() {
|
9
|
-
const themeConfig = useThemeConfig<HairyTheme>()
|
10
|
-
const cache = useSharedStorage<HairyPostLayout>('--hairy-theme:post-layout', null)
|
11
|
-
const layout = computed({
|
12
|
-
get: () => cache.value || themeConfig.value.post?.layout || 'image',
|
13
|
-
set: value => cache.value = value,
|
14
|
-
})
|
15
|
-
return layout
|
16
|
-
}
|