valaxy-theme-hairy 0.2.2 → 1.0.0
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 +13 -0
- package/components/{HairyUserPopup.vue → HairyDrawer.vue} +14 -13
- package/components/HairyFooter.vue +12 -9
- package/components/HairyHeader.vue +10 -9
- package/components/HairyImage.vue +2 -1
- package/components/HairyImageGroup.vue +12 -16
- package/components/HairyNavbar.vue +56 -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/{HairyUserTab.vue → HairyTabbar.vue} +27 -11
- 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} +1 -1
- 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} +4 -3
- 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/archive.vue +11 -0
- package/layouts/categories.vue +11 -4
- package/layouts/default.vue +8 -7
- package/layouts/home.vue +28 -18
- package/layouts/post.vue +41 -35
- package/layouts/tag.vue +8 -4
- package/layouts/tags.vue +11 -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 -16
- package/pages/archives/[year]/index.vue +20 -18
- package/pages/archives/index.vue +10 -8
- package/pages/categories/{[...categories].vue → [...its].vue} +29 -34
- package/pages/index.vue +1 -1
- package/pages/page/[page].vue +2 -2
- package/pages/tags/{[tag].vue → [tag]/index.vue} +12 -12
- package/pages/tags/index.vue +12 -5
- 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/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/archives.vue +0 -11
- 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/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
package/node/addon-hairy.ts
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
import type { ResolvedValaxyOptions, ValaxyExtendConfig } from 'valaxy'
|
2
|
-
import type { HairyTheme } from 'valaxy-theme-hairy'
|
3
|
-
|
4
|
-
function addonHairy(options: ResolvedValaxyOptions<HairyTheme>): ValaxyExtendConfig {
|
5
|
-
const safelist = options.config.themeConfig?.nav?.filter(v => v.icon)?.map(v => v.icon || '') || []
|
6
|
-
return {
|
7
|
-
extendMd(ctx) {
|
8
|
-
if (ctx.route.meta.excerpt)
|
9
|
-
ctx.route.meta.frontmatter.text = removeTags(ctx.route.meta.excerpt)
|
10
|
-
},
|
11
|
-
pages: {
|
12
|
-
extendRoute(route) {
|
13
|
-
// 改用 type, 由 theme 决定使用布局
|
14
|
-
if (!route.meta.type && route.meta.layout)
|
15
|
-
route.meta.type = route.meta.layout
|
16
|
-
|
17
|
-
if (!route.meta.type)
|
18
|
-
route.meta.type = 'default'
|
19
|
-
|
20
|
-
// 清除所有 layout, 使用统一入口 hairy.vue
|
21
|
-
route.meta.layout = 'hairy'
|
22
|
-
},
|
23
|
-
},
|
24
|
-
unocss: {
|
25
|
-
safelist,
|
26
|
-
},
|
27
|
-
}
|
28
|
-
}
|
29
|
-
|
30
|
-
export default addonHairy
|
31
|
-
|
32
|
-
function removeTags(str = '') {
|
33
|
-
let content = str.replace(/<\/?[^>]*>/g, '')// 去除标签
|
34
|
-
content = content.replace(/[|]*\n/, '')// 去除行尾空格
|
35
|
-
return content
|
36
|
-
}
|
package/node/addon-images.ts
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */
|
2
|
-
import type { ResolvedValaxyOptions, ValaxyExtendConfig } from 'valaxy'
|
3
|
-
import type { HairyTheme } from '..'
|
4
|
-
import defaultImages from '../images.json'
|
5
|
-
|
6
|
-
let count = 0
|
7
|
-
|
8
|
-
function addonImages(options: ResolvedValaxyOptions<HairyTheme>): ValaxyExtendConfig {
|
9
|
-
const hairyPrefix = '@hairy'
|
10
|
-
const postConfig = options.config.themeConfig?.post
|
11
|
-
const homeConfig = options.config.themeConfig?.home
|
12
|
-
|
13
|
-
const isEnough = (postConfig?.images?.length || 0) > 6
|
14
|
-
|
15
|
-
const inImages = isEnough ? postConfig?.images! : defaultImages
|
16
|
-
|
17
|
-
const filterInImages = (type: 'large' | 'mw690') => {
|
18
|
-
const inType = type === 'large' ? 'mw690' : 'large'
|
19
|
-
return inImages.filter((image) => {
|
20
|
-
if (image.includes('sinaimg.cn/'))
|
21
|
-
return image.replace(inType, type)
|
22
|
-
return image
|
23
|
-
})
|
24
|
-
}
|
25
|
-
|
26
|
-
const postImages = isEnough ? postConfig?.images! : filterInImages('mw690')
|
27
|
-
const homeImages = homeConfig?.images?.length ? homeConfig?.images : filterInImages('large')
|
28
|
-
|
29
|
-
return {
|
30
|
-
vite: {
|
31
|
-
plugins: [
|
32
|
-
{
|
33
|
-
name: 'vite-plugin-hairy:image',
|
34
|
-
resolveId(id) {
|
35
|
-
if (id.startsWith(hairyPrefix))
|
36
|
-
return id
|
37
|
-
return null
|
38
|
-
},
|
39
|
-
load(id) {
|
40
|
-
if (id === '@hairy:images:post')
|
41
|
-
return `export default ${JSON.stringify(postImages)}`
|
42
|
-
if (id === '@hairy:images:home')
|
43
|
-
return `export default ${JSON.stringify(homeImages)}`
|
44
|
-
},
|
45
|
-
},
|
46
|
-
],
|
47
|
-
},
|
48
|
-
extendMd(ctx) {
|
49
|
-
if (postImages.length >= 6) {
|
50
|
-
if (!ctx.route.meta.frontmatter.image)
|
51
|
-
ctx.route.meta.frontmatter.image = postImages[count]
|
52
|
-
if (count <= postImages.length)
|
53
|
-
count++
|
54
|
-
if (count >= postImages.length)
|
55
|
-
count = 0
|
56
|
-
}
|
57
|
-
},
|
58
|
-
}
|
59
|
-
}
|
60
|
-
|
61
|
-
export default addonImages
|
package/node/addon-meting.ts
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
import type { ResolvedValaxyOptions, ValaxyExtendConfig } from 'valaxy'
|
2
|
-
import type { HairyTheme } from 'valaxy-theme-hairy'
|
3
|
-
|
4
|
-
function addonMeting(options: ResolvedValaxyOptions<HairyTheme>): ValaxyExtendConfig {
|
5
|
-
return {
|
6
|
-
extendMd(ctx) {
|
7
|
-
if (options.config.themeConfig?.meting)
|
8
|
-
ctx.route.meta.frontmatter.aplayer = true
|
9
|
-
},
|
10
|
-
}
|
11
|
-
}
|
12
|
-
|
13
|
-
export default addonMeting
|
package/node/addon-statistics.ts
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
2
|
-
import fs from 'fs'
|
3
|
-
import readingTime from 'reading-time'
|
4
|
-
import type { ValaxyExtendConfig } from 'valaxy'
|
5
|
-
|
6
|
-
function addonStatistics(): ValaxyExtendConfig {
|
7
|
-
return {
|
8
|
-
extendMd(ctx) {
|
9
|
-
const file = fs.readFileSync(ctx.path, 'utf-8')
|
10
|
-
const duration = readingTime(file)
|
11
|
-
// @ts-expect-error
|
12
|
-
delete duration.text
|
13
|
-
ctx.route.meta.frontmatter.durations = duration
|
14
|
-
ctx.route.meta.frontmatter.length = file.length
|
15
|
-
},
|
16
|
-
}
|
17
|
-
}
|
18
|
-
|
19
|
-
export default addonStatistics
|
package/node/addon-toc.ts
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
import fs from 'fs'
|
2
|
-
import type { ValaxyExtendConfig } from 'valaxy'
|
3
|
-
import toc from 'markdown-toc'
|
4
|
-
|
5
|
-
function addonToc(): ValaxyExtendConfig {
|
6
|
-
return {
|
7
|
-
extendMd(ctx) {
|
8
|
-
if (!ctx.route.path.startsWith('/posts/'))
|
9
|
-
return
|
10
|
-
const file = fs.readFileSync(ctx.path, 'utf-8')
|
11
|
-
ctx.route.meta.frontmatter['it-toc'] = toc(file).json.map((item: any) => ({
|
12
|
-
title: item.content,
|
13
|
-
level: item.lvl,
|
14
|
-
slug: item.slug,
|
15
|
-
}))
|
16
|
-
},
|
17
|
-
}
|
18
|
-
}
|
19
|
-
|
20
|
-
export default addonToc
|
package/node/utils.ts
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
import { createDefu } from 'defu'
|
2
|
-
import { isFunction } from 'lodash-es'
|
3
|
-
import { mergeConfig as mergeViteConfig } from 'vite'
|
4
|
-
/**
|
5
|
-
* merge valaxy.config
|
6
|
-
* (source, default)
|
7
|
-
*/
|
8
|
-
export const mergeValaxyConfig = createDefu((obj: any, key, value) => {
|
9
|
-
if (isFunction(obj[key]) || isFunction(value)) {
|
10
|
-
obj[key] = function (...args: any[]) {
|
11
|
-
obj[key]?.call(this, ...args)
|
12
|
-
value?.call(this, ...args)
|
13
|
-
}
|
14
|
-
}
|
15
|
-
if (key === 'vite') {
|
16
|
-
// a deep copy and needs to be taken over
|
17
|
-
obj[key] = mergeViteConfig(obj[key], value)
|
18
|
-
return true
|
19
|
-
}
|
20
|
-
})
|
package/utils/createContext.ts
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @Author: Mr'Mao https://github.com/TuiMao233
|
3
|
-
* @Date: 2022-02-09 10:56:30
|
4
|
-
* @LastEditors: Mr'Mao
|
5
|
-
* @LastEditTime: 2022-02-26 13:47:57
|
6
|
-
*/
|
7
|
-
|
8
|
-
import type { InjectionKey } from 'vue'
|
9
|
-
import { inject, provide } from 'vue'
|
10
|
-
|
11
|
-
/**
|
12
|
-
* 创建上下文
|
13
|
-
* @param key 控制器的 key
|
14
|
-
* @param callback 控制器注入的内容
|
15
|
-
* @returns
|
16
|
-
*/
|
17
|
-
export function createContext<T>(key: string, getter: () => T) {
|
18
|
-
const _key: InjectionKey<T> = Symbol(key)
|
19
|
-
|
20
|
-
const _provide = () => {
|
21
|
-
const controller = getter()
|
22
|
-
provide(_key, controller)
|
23
|
-
return controller
|
24
|
-
}
|
25
|
-
|
26
|
-
const _inject = () => {
|
27
|
-
const controller = inject(_key)
|
28
|
-
if (!controller)
|
29
|
-
throw new Error(`Please wrap the container in ${_key}`)
|
30
|
-
|
31
|
-
return controller
|
32
|
-
}
|
33
|
-
|
34
|
-
return {
|
35
|
-
key: _key,
|
36
|
-
provide: _provide,
|
37
|
-
inject: _inject,
|
38
|
-
getter,
|
39
|
-
}
|
40
|
-
}
|
package/utils/fonts.ts
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
import Seto from '../styles/fonts/Seto.ttf?url'
|
2
|
-
import { createPromise } from '.'
|
3
|
-
|
4
|
-
export const fontFacePromise = createPromise<void>()
|
5
|
-
|
6
|
-
async function loadFonts(fontFamily: string, url: string) {
|
7
|
-
const font = new FontFace(fontFamily, `url(${url})`)
|
8
|
-
await font.load()
|
9
|
-
;(document.fonts as any).add(font)
|
10
|
-
}
|
11
|
-
|
12
|
-
(async () => {
|
13
|
-
await loadFonts('Seto', Seto)
|
14
|
-
fontFacePromise.resolve()
|
15
|
-
})()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|