valaxy-theme-hairy 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. package/LICENSE +21 -21
  2. package/client/index.ts +1 -1
  3. package/components/HairyBody.vue +49 -49
  4. package/components/HairyCodepen.vue +40 -40
  5. package/components/HairyComment.vue +33 -33
  6. package/components/HairyContainer.vue +17 -17
  7. package/components/HairyDrawer.vue +44 -44
  8. package/components/HairyFooter.vue +62 -62
  9. package/components/HairyHeader.vue +32 -32
  10. package/components/HairyImage.vue +15 -15
  11. package/components/HairyImageGroup.vue +65 -65
  12. package/components/HairyNavbar.vue +56 -56
  13. package/components/HairyPageArchives.vue +59 -59
  14. package/components/HairyPageTags.vue +48 -48
  15. package/components/HairyPosts.vue +54 -54
  16. package/components/HairySearch.vue +201 -201
  17. package/components/HairySidebar.vue +30 -30
  18. package/components/HairyTabbar.vue +56 -56
  19. package/components/PageTags.vue +48 -48
  20. package/components/ValaxyMain.vue +45 -45
  21. package/components/navbar/HairyNav.vue +16 -16
  22. package/components/navbar/HairyNavExpand.vue +12 -12
  23. package/components/navbar/HairyNavItem.vue +35 -35
  24. package/components/navbar/HairyNavbarBackground.vue +7 -7
  25. package/components/navbar/HairyNavbarSearch.vue +8 -8
  26. package/components/navbar/HairyNavbarTitle.vue +15 -15
  27. package/components/navbar/HairyNavbarToggleDark.vue +22 -22
  28. package/components/parts/HairyBreadcrumb.vue +51 -51
  29. package/components/parts/HairyBreadcrumbItem.vue +11 -11
  30. package/components/parts/HairyFootFish.js +352 -352
  31. package/components/parts/HairyFootFish.vue +38 -38
  32. package/components/parts/HairyHeadHero.vue +34 -34
  33. package/components/parts/HairyHeadWaves.vue +67 -67
  34. package/components/parts/HairyImageGlobal.vue +51 -51
  35. package/components/parts/HairyImageViewer.vue +23 -23
  36. package/components/parts/HairyLink.vue +21 -21
  37. package/components/parts/HairyMenu.vue +16 -16
  38. package/components/parts/HairyMenuItem.vue +47 -47
  39. package/components/parts/HairyOutline.vue +99 -99
  40. package/components/parts/HairyOutlineItem.vue +48 -48
  41. package/components/parts/HairySocialLinks.vue +27 -27
  42. package/components/parts/HairyTimelineContent.vue +39 -39
  43. package/components/parts/HairyUserNav.vue +95 -95
  44. package/components/parts/HairyUserStats.vue +18 -18
  45. package/components/posts/HairyArticleImage.vue +126 -126
  46. package/components/posts/HairyArticleSeries.vue +89 -89
  47. package/components/posts/HairyArticleText.vue +43 -43
  48. package/components/posts/HairyPostFooter.vue +15 -15
  49. package/components/posts/HairyPostImageList.vue +27 -27
  50. package/components/posts/HairyPostTextsList.vue +22 -22
  51. package/components/posts/HairyPostToggleLayout.vue +36 -36
  52. package/components/third/HairyAlgoliaSearch.vue +17 -17
  53. package/components/third/HairyFuseSearch.vue +10 -10
  54. package/components/third/HairyFuseSearchDialog.vue +32 -32
  55. package/components/third/HairyFuseSearchDropdown.vue +77 -77
  56. package/components/third/HairyFuseSearchFooter.vue +28 -28
  57. package/components/third/HairyFuseSearchHeader.vue +30 -30
  58. package/components/third/HairyFuseSearchHit.vue +52 -52
  59. package/components/third/HairySearchBtnDisplay.vue +29 -29
  60. package/components/third/HairySearchBtnInput.vue +20 -20
  61. package/components/third/HairySearchBtnKeys.vue +19 -19
  62. package/components/third/HairySwiperCarousel.vue +45 -45
  63. package/composables/archives.ts +48 -48
  64. package/composables/category.ts +43 -43
  65. package/composables/config.ts +11 -11
  66. package/composables/dark.ts +13 -13
  67. package/composables/fuse.ts +60 -60
  68. package/composables/index.ts +7 -7
  69. package/composables/layout.ts +16 -16
  70. package/composables/outline.ts +49 -49
  71. package/composables/tags.ts +36 -36
  72. package/layouts/archive-month.vue +13 -13
  73. package/layouts/archive-year.vue +13 -13
  74. package/layouts/archives.vue +11 -11
  75. package/layouts/categories.vue +13 -13
  76. package/layouts/default.vue +13 -15
  77. package/layouts/home.vue +33 -33
  78. package/layouts/post.vue +54 -54
  79. package/layouts/tag.vue +10 -10
  80. package/layouts/tags.vue +10 -14
  81. package/library/loading.scss +535 -535
  82. package/library/loading.ts +60 -60
  83. package/library/scroll.ts +22 -22
  84. package/locales/en.yml +1 -1
  85. package/locales/zh-CN.yml +1 -1
  86. package/node/images/default.json +139 -139
  87. package/node/images/index.ts +46 -46
  88. package/node/images/shims.d.ts +8 -8
  89. package/node/index.ts +2 -2
  90. package/node/theme/index.ts +78 -78
  91. package/package.json +1 -1
  92. package/pages/archives/[year]/[month]/index.vue +48 -48
  93. package/pages/archives/[year]/index.vue +73 -73
  94. package/pages/archives/index.md +6 -0
  95. package/pages/categories/[...its].vue +108 -108
  96. package/pages/index.vue +8 -8
  97. package/pages/page/[page].vue +12 -12
  98. package/pages/tags/[tag]/index.vue +38 -38
  99. package/pages/tags/index.md +7 -0
  100. package/setup/main.ts +9 -9
  101. package/store/index.ts +1 -1
  102. package/store/modules/global.ts +12 -12
  103. package/styles/components/aplayer.scss +75 -75
  104. package/styles/components/index.scss +3 -3
  105. package/styles/components/markdown.scss +89 -89
  106. package/styles/components/nprogress.scss +15 -15
  107. package/styles/components/scrollbar.scss +25 -25
  108. package/styles/css-vars.scss +171 -171
  109. package/styles/element-plus/index.scss +1 -1
  110. package/styles/element-plus/tabs.scss +25 -25
  111. package/styles/element-plus/timeline.scss +18 -18
  112. package/styles/font-face.scss +19 -19
  113. package/styles/global.scss +38 -38
  114. package/styles/index.scss +3 -3
  115. package/tsconfig.json +27 -27
  116. package/types/index.d.ts +163 -163
  117. package/unocss.config.ts +43 -43
  118. package/utils/index.ts +37 -37
  119. package/valaxy.config.ts +26 -26
  120. package/pages/archives/index.vue +0 -6
  121. package/pages/tags/index.vue +0 -6
@@ -1,49 +1,49 @@
1
- import { defineStore } from 'pinia'
2
- import type { MenuItem } from 'valaxy'
3
- import { getHeaders, onContentUpdated, useFrontmatter, useThemeConfig } from 'valaxy'
4
- import type { DefaultTheme } from 'valaxy/types'
5
- import { computed } from 'vue'
6
- import { useRoute } from 'vue-router'
7
-
8
- const useOutlineStore = defineStore('OutlineStore', {
9
- state: () => ({} as Record<string, MenuItem[]>),
10
- })
11
-
12
- /**
13
- * export headers & handleClick to generate outline
14
- */
15
- export function useOutline() {
16
- const frontmatter = useFrontmatter()
17
- const themeConfig = useThemeConfig()
18
- const route = useRoute()
19
- const store = useOutlineStore()
20
-
21
- const pageOutline = computed<DefaultTheme.Config['outline']>(
22
- () => frontmatter.value.outline ?? themeConfig.value.outline,
23
- )
24
-
25
- const headers = computed(() => store.$state[route.path] || [])
26
-
27
- onContentUpdated(() => {
28
- if (pageOutline.value === false)
29
- return
30
- store.$state[route.path] = getHeaders(pageOutline.value)
31
- })
32
-
33
- const handleClick = ({ target: el }: Event) => {
34
- const id = (el as HTMLAnchorElement).href!.split('#')[1]
35
- const heading = document.getElementById(decodeURIComponent(id)) as HTMLAnchorElement
36
- heading?.focus({ preventScroll: true })
37
- }
38
-
39
- return {
40
- /**
41
- * headers for toc
42
- */
43
- headers,
44
- /**
45
- * click hash heading
46
- */
47
- handleClick,
48
- }
49
- }
1
+ import { defineStore } from 'pinia'
2
+ import type { MenuItem } from 'valaxy'
3
+ import { getHeaders, onContentUpdated, useFrontmatter, useThemeConfig } from 'valaxy'
4
+ import type { DefaultTheme } from 'valaxy/types'
5
+ import { computed } from 'vue'
6
+ import { useRoute } from 'vue-router'
7
+
8
+ const useOutlineStore = defineStore('OutlineStore', {
9
+ state: () => ({} as Record<string, MenuItem[]>),
10
+ })
11
+
12
+ /**
13
+ * export headers & handleClick to generate outline
14
+ */
15
+ export function useOutline() {
16
+ const frontmatter = useFrontmatter()
17
+ const themeConfig = useThemeConfig()
18
+ const route = useRoute()
19
+ const store = useOutlineStore()
20
+
21
+ const pageOutline = computed<DefaultTheme.Config['outline']>(
22
+ () => frontmatter.value.outline ?? themeConfig.value.outline,
23
+ )
24
+
25
+ const headers = computed(() => store.$state[route.path] || [])
26
+
27
+ onContentUpdated(() => {
28
+ if (pageOutline.value === false)
29
+ return
30
+ store.$state[route.path] = getHeaders(pageOutline.value)
31
+ })
32
+
33
+ const handleClick = ({ target: el }: Event) => {
34
+ const id = (el as HTMLAnchorElement).href!.split('#')[1]
35
+ const heading = document.getElementById(decodeURIComponent(id)) as HTMLAnchorElement
36
+ heading?.focus({ preventScroll: true })
37
+ }
38
+
39
+ return {
40
+ /**
41
+ * headers for toc
42
+ */
43
+ headers,
44
+ /**
45
+ * click hash heading
46
+ */
47
+ handleClick,
48
+ }
49
+ }
@@ -1,36 +1,36 @@
1
- import { TinyColor } from '@ctrl/tinycolor'
2
- import { useTags } from 'valaxy'
3
-
4
- /**
5
- * get utils about tags
6
- */
7
- export function useHairyTags(options: {
8
- /**
9
- * Primary Color
10
- */
11
- primary: string
12
- } = {
13
- primary: '#0078E7',
14
- }) {
15
- const tags = useTags()
16
-
17
- const gray = new TinyColor('#999999')
18
- const primaryColor = new TinyColor(options.primary)
19
-
20
- const getTagStyle = (count: number) => {
21
- const counts = Array.from(tags.value).map(([_, value]) => value.count)
22
- const max = Math.max(...counts)
23
- const min = Math.min(...counts)
24
- const range = max - min
25
- const percent = (count - min) / range
26
- return {
27
- '--yun-tag-color': gray.mix(primaryColor, percent * 100).toString(),
28
- 'fontSize': `${percent * 36 + 12}px`,
29
- }
30
- }
31
-
32
- return {
33
- tags,
34
- getTagStyle,
35
- }
36
- }
1
+ import { TinyColor } from '@ctrl/tinycolor'
2
+ import { useTags } from 'valaxy'
3
+
4
+ /**
5
+ * get utils about tags
6
+ */
7
+ export function useHairyTags(options: {
8
+ /**
9
+ * Primary Color
10
+ */
11
+ primary: string
12
+ } = {
13
+ primary: '#0078E7',
14
+ }) {
15
+ const tags = useTags()
16
+
17
+ const gray = new TinyColor('#999999')
18
+ const primaryColor = new TinyColor(options.primary)
19
+
20
+ const getTagStyle = (count: number) => {
21
+ const counts = Array.from(tags.value).map(([_, value]) => value.count)
22
+ const max = Math.max(...counts)
23
+ const min = Math.min(...counts)
24
+ const range = max - min
25
+ const percent = (count - min) / range
26
+ return {
27
+ '--yun-tag-color': gray.mix(primaryColor, percent * 100).toString(),
28
+ 'fontSize': `${percent * 36 + 12}px`,
29
+ }
30
+ }
31
+
32
+ return {
33
+ tags,
34
+ getTagStyle,
35
+ }
36
+ }
@@ -1,13 +1,13 @@
1
- <script lang="ts" setup>
2
- </script>
3
-
4
- <template>
5
- <HairyContainer>
6
- <HairyNavbar />
7
- <HairyHeader :title="`发表于'${$route.params.year}年${$route.params.month}月'的文章`" />
8
- <HairyBody>
9
- <router-view />
10
- </HairyBody>
11
- <HairyFooter />
12
- </HairyContainer>
13
- </template>
1
+ <script lang="ts" setup>
2
+ </script>
3
+
4
+ <template>
5
+ <HairyContainer>
6
+ <HairyNavbar />
7
+ <HairyHeader :title="`发表于'${$route.params.year}年${$route.params.month}月'的文章`" />
8
+ <HairyBody>
9
+ <router-view />
10
+ </HairyBody>
11
+ <HairyFooter />
12
+ </HairyContainer>
13
+ </template>
@@ -1,13 +1,13 @@
1
- <script lang="ts" setup>
2
- </script>
3
-
4
- <template>
5
- <HairyContainer>
6
- <HairyNavbar />
7
- <HairyHeader :title="`发表于'${$route.params.year}年'的文章`" />
8
- <HairyBody>
9
- <router-view />
10
- </HairyBody>
11
- <HairyFooter />
12
- </HairyContainer>
13
- </template>
1
+ <script lang="ts" setup>
2
+ </script>
3
+
4
+ <template>
5
+ <HairyContainer>
6
+ <HairyNavbar />
7
+ <HairyHeader :title="`发表于'${$route.params.year}年'的文章`" />
8
+ <HairyBody>
9
+ <router-view />
10
+ </HairyBody>
11
+ <HairyFooter />
12
+ </HairyContainer>
13
+ </template>
@@ -1,11 +1,11 @@
1
- <template>
2
- <HairyContainer>
3
- <HairyNavbar />
4
- <HairyHeader />
5
- <HairyBody>
6
- <HairyPageArchives />
7
- </HairyBody>
8
- <HairyFooter />
9
- <HairyDrawer />
10
- </HairyContainer>
11
- </template>
1
+ <template>
2
+ <HairyContainer>
3
+ <HairyNavbar />
4
+ <HairyHeader />
5
+ <HairyBody>
6
+ <HairyPageArchives />
7
+ </HairyBody>
8
+ <HairyFooter />
9
+ <HairyDrawer />
10
+ </HairyContainer>
11
+ </template>
@@ -1,13 +1,13 @@
1
- <script lang="ts" setup>
2
- </script>
3
-
4
- <template>
5
- <HairyContainer>
6
- <HairyNavbar />
7
- <HairyHeader title="分类" />
8
- <HairyBody>
9
- <router-view />
10
- </HairyBody>
11
- <HairyFooter />
12
- </HairyContainer>
13
- </template>
1
+ <script lang="ts" setup>
2
+ </script>
3
+
4
+ <template>
5
+ <HairyContainer>
6
+ <HairyNavbar />
7
+ <HairyHeader title="分类" />
8
+ <HairyBody>
9
+ <router-view />
10
+ </HairyBody>
11
+ <HairyFooter />
12
+ </HairyContainer>
13
+ </template>
@@ -1,15 +1,13 @@
1
- <script lang="ts" setup>
2
- </script>
3
-
4
- <template>
5
- <HairyContainer>
6
- <HairyNavbar />
7
- <HairyHeader />
8
- <HairyBody>
9
- <router-view />
10
- </HairyBody>
11
- <HairyFooter />
12
- </HairyContainer>
13
- </template>
14
-
15
-
1
+ <script lang="ts" setup>
2
+ </script>
3
+
4
+ <template>
5
+ <HairyContainer>
6
+ <HairyNavbar />
7
+ <HairyHeader />
8
+ <HairyBody>
9
+ <router-view />
10
+ </HairyBody>
11
+ <HairyFooter />
12
+ </HairyContainer>
13
+ </template>
package/layouts/home.vue CHANGED
@@ -1,33 +1,33 @@
1
- <script lang="ts" setup>
2
- import { useSiteConfig } from 'valaxy'
3
- import dayjs from 'dayjs'
4
- import { riposte } from '../utils'
5
-
6
- const config = useSiteConfig()
7
-
8
- const hour = dayjs().hour()
9
- const hello = riposte(
10
- [hour >= 5 && hour < 12, 'Good morning'],
11
- [hour >= 12 && hour < 18, 'Good afternoon'],
12
- [true, 'Good evening'],
13
- )
14
- </script>
15
-
16
- <template>
17
- <HairyContainer>
18
- <HairyNavbar>
19
- <template #nav>
20
- <slot name="header-nav" />
21
- </template>
22
- </HairyNavbar>
23
- <HairyHeader
24
- :headline="config.title"
25
- :title="config.author.name"
26
- :description="`${hello}, how are you doing?`"
27
- />
28
- <HairyBody>
29
- <router-view />
30
- </HairyBody>
31
- <HairyFooter />
32
- </HairyContainer>
33
- </template>
1
+ <script lang="ts" setup>
2
+ import { useSiteConfig } from 'valaxy'
3
+ import dayjs from 'dayjs'
4
+ import { riposte } from '../utils'
5
+
6
+ const config = useSiteConfig()
7
+
8
+ const hour = dayjs().hour()
9
+ const hello = riposte(
10
+ [hour >= 5 && hour < 12, 'Good morning'],
11
+ [hour >= 12 && hour < 18, 'Good afternoon'],
12
+ [true, 'Good evening'],
13
+ )
14
+ </script>
15
+
16
+ <template>
17
+ <HairyContainer>
18
+ <HairyNavbar>
19
+ <template #nav>
20
+ <slot name="header-nav" />
21
+ </template>
22
+ </HairyNavbar>
23
+ <HairyHeader
24
+ :headline="config.title"
25
+ :title="config.author.name"
26
+ :description="`${hello}, how are you doing?`"
27
+ />
28
+ <HairyBody>
29
+ <router-view />
30
+ </HairyBody>
31
+ <HairyFooter />
32
+ </HairyContainer>
33
+ </template>
package/layouts/post.vue CHANGED
@@ -1,54 +1,54 @@
1
- <script lang="ts" setup>
2
- import { dayjs } from 'element-plus'
3
- import { useFrontmatter } from 'valaxy'
4
- import { useRouter } from 'vue-router'
5
- import { ElTag } from 'element-plus/es/components/tag/index'
6
- import 'element-plus/theme-chalk/el-tag.css'
7
-
8
- defineProps<{
9
- header?: {
10
- title?: string
11
- headline?: string
12
- description?: string
13
- }
14
- }>()
15
-
16
- const router = useRouter()
17
- const post = useFrontmatter()
18
-
19
- function displayTag(tag: string) {
20
- router.push(`/tags/${tag}`)
21
- }
22
- </script>
23
-
24
- <template>
25
- <HairyContainer>
26
- <HairyNavbar />
27
- <HairyHeader :title="post.title">
28
- <template #description>
29
- <div class="flex gap-2">
30
- <span>发表于 {{ dayjs(post.date).format('YYYY-MM-DD') }}</span>
31
- <span>本文字数 {{ post.wordCount }} 字</span>
32
- <span>阅读时长 {{ post.readingTime }} 分钟</span>
33
- </div>
34
- <div v-if="post.tags?.length" class="tags flex-center gap-2 mt-2">
35
- <ElTag v-for="(tag) in post.tags" :key="tag" class="dark:bg-dark-50 cursor-pointer" @click="displayTag(tag)">
36
- {{ tag }}
37
- </ElTag>
38
- </div>
39
- </template>
40
- </HairyHeader>
41
- <HairyBody>
42
- <template #default>
43
- <HairyImageGlobal>
44
- <router-view />
45
- </HairyImageGlobal>
46
- <HairyPostFooter />
47
- </template>
48
- <template #slide>
49
- <HairyTabbar />
50
- </template>
51
- </HairyBody>
52
- <HairyFooter />
53
- </HairyContainer>
54
- </template>
1
+ <script lang="ts" setup>
2
+ import { ElTag, dayjs } from 'element-plus'
3
+ import { useFrontmatter } from 'valaxy'
4
+ import { useRouter } from 'vue-router'
5
+
6
+ import 'element-plus/theme-chalk/el-tag.css'
7
+
8
+ defineProps<{
9
+ header?: {
10
+ title?: string
11
+ headline?: string
12
+ description?: string
13
+ }
14
+ }>()
15
+
16
+ const router = useRouter()
17
+ const post = useFrontmatter()
18
+
19
+ function displayTag(tag: string) {
20
+ router.push(`/tags/${tag}`)
21
+ }
22
+ </script>
23
+
24
+ <template>
25
+ <HairyContainer>
26
+ <HairyNavbar />
27
+ <HairyHeader :title="post.title">
28
+ <template #description>
29
+ <div class="flex gap-2">
30
+ <span>发表于 {{ dayjs(post.date).format('YYYY-MM-DD') }}</span>
31
+ <span>本文字数 {{ post.wordCount }} 字</span>
32
+ <span>阅读时长 {{ post.readingTime }} 分钟</span>
33
+ </div>
34
+ <div v-if="post.tags?.length" class="tags flex-center gap-2 mt-2">
35
+ <ElTag v-for="(tag) in post.tags" :key="tag" class="dark:bg-dark-50 cursor-pointer" @click="displayTag(tag)">
36
+ {{ tag }}
37
+ </ElTag>
38
+ </div>
39
+ </template>
40
+ </HairyHeader>
41
+ <HairyBody>
42
+ <template #default>
43
+ <HairyImageGlobal>
44
+ <router-view />
45
+ </HairyImageGlobal>
46
+ <HairyPostFooter />
47
+ </template>
48
+ <template #slide>
49
+ <HairyTabbar />
50
+ </template>
51
+ </HairyBody>
52
+ <HairyFooter />
53
+ </HairyContainer>
54
+ </template>
package/layouts/tag.vue CHANGED
@@ -1,10 +1,10 @@
1
- <template>
2
- <HairyContainer>
3
- <HairyNavbar />
4
- <HairyHeader :title="`包含标签'${$route.params.tag}'的标签`" />
5
- <HairyBody>
6
- <router-view />
7
- </HairyBody>
8
- <HairyFooter />
9
- </HairyContainer>
10
- </template>
1
+ <template>
2
+ <HairyContainer>
3
+ <HairyNavbar />
4
+ <HairyHeader :title="`包含标签'${$route.params.tag}'的标签`" />
5
+ <HairyBody>
6
+ <router-view />
7
+ </HairyBody>
8
+ <HairyFooter />
9
+ </HairyContainer>
10
+ </template>
package/layouts/tags.vue CHANGED
@@ -1,14 +1,10 @@
1
- <script lang="ts" setup>
2
- console.log('---')
3
- </script>
4
-
5
- <template>
6
- <HairyContainer>
7
- <HairyNavbar />
8
- <HairyHeader title="所有标签" />
9
- <HairyBody>
10
- <HairyPageTags />
11
- </HairyBody>
12
- <HairyFooter />
13
- </HairyContainer>
14
- </template>
1
+ <template>
2
+ <HairyContainer>
3
+ <HairyNavbar />
4
+ <HairyHeader title="所有标签" />
5
+ <HairyBody>
6
+ <HairyPageTags />
7
+ </HairyBody>
8
+ <HairyFooter />
9
+ </HairyContainer>
10
+ </template>