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.
Files changed (153) hide show
  1. package/client/index.ts +1 -0
  2. package/components/HairyBody.vue +15 -17
  3. package/components/HairyComment.vue +33 -0
  4. package/components/HairyContainer.vue +13 -0
  5. package/components/{HairyUserPopup.vue → HairyDrawer.vue} +14 -13
  6. package/components/HairyFooter.vue +12 -9
  7. package/components/HairyHeader.vue +10 -9
  8. package/components/HairyImage.vue +2 -1
  9. package/components/HairyImageGroup.vue +12 -16
  10. package/components/HairyNavbar.vue +56 -0
  11. package/components/{HairyPostList.vue → HairyPosts.vue} +3 -3
  12. package/components/{HairyNavSearch.vue → HairySearch.vue} +23 -87
  13. package/components/{HairyUserCard.vue → HairySidebar.vue} +4 -4
  14. package/components/{HairyUserTab.vue → HairyTabbar.vue} +27 -11
  15. package/components/PageTags.vue +48 -0
  16. package/components/ValaxyMain.vue +3 -3
  17. package/components/navbar/HairyNav.vue +16 -0
  18. package/components/navbar/HairyNavExpand.vue +12 -0
  19. package/components/navbar/HairyNavItem.vue +35 -0
  20. package/components/navbar/HairyNavbarBackground.vue +7 -0
  21. package/components/navbar/HairyNavbarSearch.vue +8 -0
  22. package/components/{HairyNavTitle.vue → navbar/HairyNavbarTitle.vue} +5 -3
  23. package/components/navbar/HairyNavbarToggleDark.vue +22 -0
  24. package/components/{HairyBreadcrumb.vue → parts/HairyBreadcrumb.vue} +1 -1
  25. package/components/{HairyBreadcrumbItem.vue → parts/HairyBreadcrumbItem.vue} +1 -4
  26. package/components/{lib/fish.js → parts/HairyFootFish.js} +5 -7
  27. package/components/parts/HairyFootFish.vue +38 -0
  28. package/components/{HairyPostTitle.vue → parts/HairyHeadHero.vue} +6 -5
  29. package/components/{HairyWaves.vue → parts/HairyHeadWaves.vue} +5 -5
  30. package/components/parts/HairyImageGlobal.vue +51 -0
  31. package/components/{HairyImageViewer.vue → parts/HairyImageViewer.vue} +4 -3
  32. package/components/parts/HairyLink.vue +21 -0
  33. package/components/{HairyMenu.vue → parts/HairyMenu.vue} +2 -1
  34. package/components/{HairyMenuItem.vue → parts/HairyMenuItem.vue} +11 -4
  35. package/components/parts/HairyOutline.vue +99 -0
  36. package/components/parts/HairyOutlineItem.vue +48 -0
  37. package/components/{HairySocialLinks.vue → parts/HairySocialLinks.vue} +2 -2
  38. package/components/{HairyTimelinePostItem.vue → parts/HairyTimelineContent.vue} +7 -8
  39. package/components/parts/HairyUserNav.vue +95 -0
  40. package/components/{article-layout → posts}/HairyArticleImage.vue +18 -19
  41. package/components/{article-layout → posts}/HairyArticleSeries.vue +8 -5
  42. package/components/{article-layout → posts}/HairyArticleText.vue +11 -4
  43. package/components/posts/HairyPostFooter.vue +15 -0
  44. package/components/{article-layout → posts}/HairyPostImageList.vue +4 -5
  45. package/components/{article-layout → posts}/HairyPostTextsList.vue +0 -1
  46. package/components/posts/HairyPostToggleLayout.vue +36 -0
  47. package/components/third/HairyAlgoliaSearch.vue +17 -0
  48. package/components/third/HairyFuseSearch.vue +10 -0
  49. package/components/third/HairyFuseSearchDialog.vue +32 -0
  50. package/components/third/HairyFuseSearchDropdown.vue +77 -0
  51. package/components/third/HairyFuseSearchFooter.vue +28 -0
  52. package/components/third/HairyFuseSearchHeader.vue +30 -0
  53. package/components/third/HairyFuseSearchHit.vue +52 -0
  54. package/components/third/HairySearchBtnDisplay.vue +29 -0
  55. package/components/third/HairySearchBtnInput.vue +20 -0
  56. package/components/third/HairySearchBtnKeys.vue +19 -0
  57. package/components/{HairyCarousel.vue → third/HairySwiperCarousel.vue} +6 -6
  58. package/{hooks/useYearArchives.ts → composables/archives.ts} +4 -3
  59. package/composables/category.ts +43 -0
  60. package/composables/config.ts +11 -0
  61. package/composables/dark.ts +13 -0
  62. package/composables/fuse.ts +60 -0
  63. package/composables/index.ts +8 -0
  64. package/composables/layout.ts +16 -0
  65. package/composables/outline.ts +49 -0
  66. package/composables/tags.ts +36 -0
  67. package/layouts/archive-month.vue +13 -0
  68. package/layouts/archive-year.vue +13 -0
  69. package/layouts/archive.vue +11 -0
  70. package/layouts/categories.vue +11 -4
  71. package/layouts/default.vue +8 -7
  72. package/layouts/home.vue +28 -18
  73. package/layouts/post.vue +41 -35
  74. package/layouts/tag.vue +8 -4
  75. package/layouts/tags.vue +11 -4
  76. package/{modules → library}/loading.ts +18 -6
  77. package/{modules → library}/scroll.ts +3 -2
  78. package/locales/zh-CN.yml +0 -2
  79. package/node/images/default.json +139 -0
  80. package/node/images/index.ts +46 -0
  81. package/node/index.ts +2 -0
  82. package/node/theme/index.ts +78 -0
  83. package/package.json +22 -28
  84. package/pages/archives/[year]/[month]/index.vue +15 -16
  85. package/pages/archives/[year]/index.vue +20 -18
  86. package/pages/archives/index.vue +10 -8
  87. package/pages/categories/{[...categories].vue → [...its].vue} +29 -34
  88. package/pages/index.vue +1 -1
  89. package/pages/page/[page].vue +2 -2
  90. package/pages/tags/{[tag].vue → [tag]/index.vue} +12 -12
  91. package/pages/tags/index.vue +12 -5
  92. package/setup/main.ts +1 -1
  93. package/store/index.ts +1 -0
  94. package/store/modules/global.ts +12 -0
  95. package/styles/components/index.scss +4 -0
  96. package/styles/{markdown.scss → components/markdown.scss} +2 -1
  97. package/styles/components/nprogress.scss +16 -0
  98. package/styles/css-vars.scss +11 -0
  99. package/styles/element-plus/tabs.scss +1 -1
  100. package/styles/element-plus/timeline.scss +1 -1
  101. package/styles/global.scss +39 -0
  102. package/styles/index.scss +4 -73
  103. package/tsconfig.json +27 -0
  104. package/types/index.d.ts +163 -0
  105. package/unocss.config.ts +5 -1
  106. package/utils/index.ts +21 -39
  107. package/valaxy.config.ts +21 -24
  108. package/@types/markdown-it.d.ts +0 -1
  109. package/@types/markdown-toc.d.ts +0 -1
  110. package/@types/types.d.ts +0 -1
  111. package/@types/valaxy.d.ts +0 -10
  112. package/components/HairyAlgoliaSearchBox.vue +0 -118
  113. package/components/HairyBackToTop.vue +0 -72
  114. package/components/HairyDivider.vue +0 -0
  115. package/components/HairyFooterFish.vue +0 -29
  116. package/components/HairyLayout.vue +0 -28
  117. package/components/HairyLink.vue +0 -10
  118. package/components/HairyLinks.vue +0 -69
  119. package/components/HairyMeting.vue +0 -19
  120. package/components/HairyNav.vue +0 -42
  121. package/components/HairyNavBackground.vue +0 -7
  122. package/components/HairyNavMenu.vue +0 -11
  123. package/components/HairyNavToggleDark.vue +0 -16
  124. package/components/HairyPostToggleLayout.vue +0 -33
  125. package/components/HairyToc.vue +0 -135
  126. package/components/HairyUserNav.vue +0 -64
  127. package/components/HairyWaline.vue +0 -44
  128. package/hooks/setupDefaultDark.ts +0 -11
  129. package/hooks/useCategory.ts +0 -18
  130. package/hooks/useCategoryPost.ts +0 -21
  131. package/hooks/useContext.ts +0 -13
  132. package/hooks/useHeaderHeight.ts +0 -9
  133. package/hooks/usePostLayout.ts +0 -16
  134. package/images.json +0 -140
  135. package/index.d.ts +0 -100
  136. package/layouts/archives.vue +0 -11
  137. package/layouts/hairy.vue +0 -36
  138. package/layouts/month.vue +0 -6
  139. package/layouts/year.vue +0 -6
  140. package/node/addon-hairy.ts +0 -36
  141. package/node/addon-images.ts +0 -61
  142. package/node/addon-meting.ts +0 -13
  143. package/node/addon-statistics.ts +0 -19
  144. package/node/addon-toc.ts +0 -20
  145. package/node/utils.ts +0 -20
  146. package/utils/createContext.ts +0 -40
  147. package/utils/fonts.ts +0 -15
  148. /package/components/{HairyUserStats.vue → parts/HairyUserStats.vue} +0 -0
  149. /package/components/{article-layout → posts}/HairyArticleTop.vue +0 -0
  150. /package/{modules → library}/loading.scss +0 -0
  151. /package/{shims.d.ts → node/images/shims.d.ts} +0 -0
  152. /package/styles/{aplayer.scss → components/aplayer.scss} +0 -0
  153. /package/styles/{scrollbar.scss → components/scrollbar.scss} +0 -0
@@ -0,0 +1,48 @@
1
+ <script lang="ts" setup>
2
+ import { useRouter } from 'vue-router'
3
+ import { useHairyTags } from '../../composables'
4
+
5
+ const router = useRouter()
6
+
7
+ const { getTagStyle, tags } = useHairyTags({
8
+ primary: '#1bc9a6',
9
+ })
10
+
11
+ function displayTag(tag: string) {
12
+ router.push(`/tags/${tag}`)
13
+ }
14
+ </script>
15
+
16
+ <template>
17
+ <div class="min-h-59vh flex-center flex-col">
18
+ <div text="center" class="text-size-2.5em pt-10 mb-5">
19
+ 目前共计 {{ Array.from(tags).length }} 个标签
20
+ </div>
21
+ <div text="center" class="max-w-7xl flex flex-wrap justify-center items-center gap-2">
22
+ <a
23
+ v-for="[key, tag] in Array.from(tags).sort()"
24
+ :key="key" class="post-tag cursor-pointer"
25
+ :style="getTagStyle(tag.count)"
26
+ p="1"
27
+ @click="displayTag(key.toString())"
28
+ >
29
+ {{ key }}
30
+ </a>
31
+ </div>
32
+ </div>
33
+ </template>
34
+
35
+ <route lang="yaml">
36
+ meta:
37
+ layout: tags
38
+ </route>
39
+
40
+ <style lang="scss" scoped>
41
+ a {
42
+ color: var(--yun-tag-color);
43
+ &:hover {
44
+ --un-text-opacity: 1;
45
+ color: var(--hy-c-primary-dark);
46
+ }
47
+ }
48
+ </style>
@@ -1,12 +1,12 @@
1
1
  <script lang="ts" setup>
2
2
  import type { PageData, Post } from 'valaxy'
3
- import { useConfig } from 'valaxy'
3
+ import { useSiteConfig } from 'valaxy'
4
4
 
5
5
  defineProps<{
6
6
  frontmatter: Post
7
7
  data?: PageData
8
8
  }>()
9
- const config = useConfig()
9
+ const siteConfig = useSiteConfig()
10
10
  </script>
11
11
 
12
12
  <template>
@@ -34,7 +34,7 @@ const config = useConfig()
34
34
 
35
35
  <slot name="main-nav-after" />
36
36
 
37
- <slot v-if="config.comment.enable && frontmatter.comment !== false" name="comment" />
37
+ <slot v-if="siteConfig.comment.enable && frontmatter.comment !== false" name="comment" />
38
38
 
39
39
  <slot name="footer" />
40
40
  </slot>
@@ -0,0 +1,16 @@
1
+ <script lang="ts" setup>
2
+ import type { HairyTheme } from 'valaxy-theme-hairy'
3
+ import { useThemeConfig } from 'valaxy'
4
+ import { computed } from 'vue'
5
+
6
+ const themeConfig = useThemeConfig<HairyTheme.Config>()
7
+ const nav = computed(() => themeConfig.value.nav || [])
8
+ </script>
9
+
10
+ <template>
11
+ <div class="flex items-center h-12.5">
12
+ <HairyNavItem v-for="(item, index) in nav" :key="index" :item="item" />
13
+ </div>
14
+ </template>
15
+
16
+ <style lang="scss" scoped></style>
@@ -0,0 +1,12 @@
1
+ <script lang="ts" setup>
2
+ import { storeToRefs } from 'pinia'
3
+ import { useGlobalStore } from '../../store'
4
+
5
+ const { showDrawer } = storeToRefs(useGlobalStore())
6
+ </script>
7
+
8
+ <template>
9
+ <button class="yun-icon-btn lt-sm:text-size-xl" @click="showDrawer = !showDrawer">
10
+ <div i="ri-menu-fill" />
11
+ </button>
12
+ </template>
@@ -0,0 +1,35 @@
1
+ <script lang="ts" setup>
2
+ import type { NavItem } from 'valaxy-theme-hairy'
3
+ import { computed } from 'vue'
4
+ import { useRoute } from 'vue-router'
5
+
6
+ const props = defineProps<{
7
+ item: NavItem
8
+ }>()
9
+ const urlReg = /^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/
10
+ const isLink = computed(() => urlReg.test(props.item?.link || ''))
11
+ const isPointer = computed(() => Boolean(props.item.link) || isLink.value)
12
+
13
+ const route = useRoute()
14
+
15
+ const active = computed(() => {
16
+ return !isLink.value && (
17
+ props.item.link === '/'
18
+ ? route.path === props.item.link
19
+ : route.path.includes(props.item.link!)
20
+ )
21
+ })
22
+ </script>
23
+
24
+ <template>
25
+ <a href="" class="px-2.5 HairyMenuItem" :class="[isPointer ? 'cursor-pointer' : 'select-none', active && 'text-primary active']">
26
+ <HairyLink class="flex items-center" type="white" :href="item.link" :target="isLink ? '__blank' : ''">
27
+ <div v-if="item.icon" class="mr-1 icon" :class="item.icon" />
28
+ <div class="question">
29
+ {{ item.text }}
30
+ </div>
31
+ </HairyLink>
32
+ </a>
33
+ </template>
34
+
35
+ <style lang="scss" scoped></style>
@@ -0,0 +1,7 @@
1
+ <template>
2
+ <div class="HairyNavBackground absolute inset-0 bg-white bg-opacity-85 dark:bg-black dark:bg-opacity-80 blur-4" />
3
+ </template>
4
+
5
+ <style>
6
+
7
+ </style>
@@ -0,0 +1,8 @@
1
+ <script lang="ts" setup>
2
+ </script>
3
+
4
+ <template>
5
+ <div />
6
+ </template>
7
+
8
+ <style lang="scss" scoped></style>
@@ -1,7 +1,9 @@
1
1
  <script lang="ts" setup>
2
- import { useConfig } from 'valaxy'
3
- const config = useConfig()
4
- const hrefToUrl = () => {
2
+ import { useSiteConfig } from 'valaxy'
3
+
4
+ const config = useSiteConfig()
5
+
6
+ function hrefToUrl() {
5
7
  location.href = config.value.url
6
8
  }
7
9
  </script>
@@ -0,0 +1,22 @@
1
+ <script lang="ts" setup>
2
+ import { useI18n } from 'vue-i18n'
3
+ import { computed } from 'vue'
4
+ import { useAppStore } from 'valaxy'
5
+
6
+ const { t } = useI18n()
7
+ const appStore = useAppStore()
8
+ const dark = computed(() => appStore.isDark)
9
+
10
+ const themeTitle = computed(() => {
11
+ return dark.value ? t('button.toggle_light') : t('button.toggle_dark')
12
+ })
13
+ </script>
14
+
15
+ <template>
16
+ <button
17
+ class="yun-icon-btn bg-light-1 p-1 dark:bg-transparent rounded-5 lt-sm:text-size-xl"
18
+ :title="themeTitle" :style="{ color: dark ? '' : '#f1cb64' }" @click="($event) => appStore.toggleDarkWithTransition($event, { duration: 600, easing: 'ease-in-out' })"
19
+ >
20
+ <div i="ri-sun-line dark:ri-moon-line" />
21
+ </button>
22
+ </template>
@@ -26,7 +26,7 @@ const text = computed(() => `"${props.after || ''}"`)
26
26
  }
27
27
  .el-breadcrumb .el-breadcrumb__inner,
28
28
  .el-breadcrumb .el-breadcrumb__item:last-child .el-breadcrumb__inner {
29
- color: initial;
29
+ color: var(--va-c-text);
30
30
  }
31
31
  .el-breadcrumb .el-breadcrumb__inner.is-link {
32
32
  @apply border-b border-dashed hover:border-primary hover:text-primary transition-all cursor-pointer;
@@ -1,5 +1,6 @@
1
1
  <script lang="ts" setup>
2
2
  import { ElBreadcrumbItem, breadcrumbItemProps } from 'element-plus/es/components/breadcrumb/index'
3
+
3
4
  defineProps(breadcrumbItemProps)
4
5
  </script>
5
6
 
@@ -8,7 +9,3 @@ defineProps(breadcrumbItemProps)
8
9
  <slot />
9
10
  </ElBreadcrumbItem>
10
11
  </template>
11
-
12
- <style lang="scss" scoped>
13
-
14
- </style>
@@ -1,8 +1,5 @@
1
+ /* eslint-disable ts/no-use-before-define */
1
2
  /* eslint-disable eqeqeq */
2
- /* eslint-disable no-var */
3
- /* eslint-disable vars-on-top */
4
- /* eslint-disable @typescript-eslint/no-use-before-define */
5
- /* eslint-disable no-undef */
6
3
 
7
4
  class RENDERER {
8
5
  ENABLE = false
@@ -185,7 +182,7 @@ class RENDERER {
185
182
  }
186
183
  }
187
184
 
188
- var SURFACE_POINT = function (renderer, x) {
185
+ const SURFACE_POINT = function (renderer, x) {
189
186
  this.renderer = renderer
190
187
  this.x = x
191
188
  this.init()
@@ -236,7 +233,7 @@ SURFACE_POINT.prototype = {
236
233
  },
237
234
  }
238
235
 
239
- var FISH = function (renderer) {
236
+ const FISH = function (renderer) {
240
237
  this.renderer = renderer
241
238
  this.init()
242
239
  }
@@ -247,7 +244,8 @@ FISH.prototype = {
247
244
  this.direction = Math.random() < 0.5
248
245
  this.x = this.direction ? this.renderer.width + this.renderer.THRESHOLD : -this.renderer.THRESHOLD
249
246
  this.previousY = this.y
250
- this.vx = this.getRandomValue(4, 10) * (this.direction ? -1 : 1)
247
+ this.vx = this.getRandomValue(4, 7) * (this.direction ? -1 : 1)
248
+
251
249
  if (this.renderer.reverse) {
252
250
  this.y = this.getRandomValue((this.renderer.height * 1) / 10, (this.renderer.height * 4) / 10)
253
251
  this.vy = this.getRandomValue(2, 5)
@@ -0,0 +1,38 @@
1
+ <!-- eslint-disable no-new -->
2
+ <script lang="ts" setup>
3
+ import { computed, onMounted, ref, watch } from 'vue'
4
+ import { useScriptTag } from '@vueuse/core'
5
+ import { useAppStore } from 'valaxy'
6
+ import { RENDERER } from './HairyFootFish'
7
+
8
+ const fishContainer = ref()
9
+
10
+ const tag = useScriptTag('https://cdn.bootcdn.net/ajax/libs/zepto/1.2.0/zepto.min.js')
11
+ const appStore = useAppStore()
12
+ const dark = computed(() => appStore.isDark)
13
+
14
+ let renderer: RENDERER
15
+
16
+ function reset() {
17
+ const color = dark.value ? 'hsl(0, 0%, 95%)' : 'hsl(0, 0%, 80%)'
18
+ if (!renderer)
19
+ renderer = new RENDERER(color)
20
+ else
21
+ renderer.setColor(color)
22
+ }
23
+
24
+ onMounted(() => {
25
+ tag.load()
26
+ .then(reset)
27
+ })
28
+ watch(dark, reset)
29
+ </script>
30
+
31
+ <template>
32
+ <div
33
+ id="jsi-flying-fish-container"
34
+ ref="fishContainer"
35
+ class="z-1 relative"
36
+ style="margin-top: -60px;"
37
+ />
38
+ </template>
@@ -1,20 +1,21 @@
1
1
  <script lang="ts" setup>
2
2
  import { useFrontmatter } from 'valaxy'
3
3
  import { computed } from 'vue'
4
+
4
5
  const props = defineProps<{
5
- headline?: String
6
- title: String
6
+ headline?: string
7
+ title: string
7
8
  description?: string
8
9
  }>()
9
10
 
10
11
  const post = useFrontmatter()
11
12
 
12
- const headline = computed(() => post.value.headline || props.headline)
13
- const title = computed(() => post.value.title || props.title)
13
+ const headline = computed(() => props.headline || post.value.headline)
14
+ const title = computed(() => props.title || post.value.title)
14
15
  </script>
15
16
 
16
17
  <template>
17
- <div class="flex-center flex-col text-shadow-lg text-white">
18
+ <div class="flex-center flex-col text-shadow-lg text-white mx-12px text-center">
18
19
  <div v-if="headline" class="font-frederick text-size-3.35em lt-sm:text-size-3rem leading-snug">
19
20
  {{ headline }}
20
21
  </div>
@@ -3,14 +3,14 @@
3
3
  class="waves w-full min-h-100px max-h-150px"
4
4
  viewBox="0 24 150 28" preserveAspectRatio="none" shape-rendering="auto"
5
5
  >
6
- <defs>
6
+ <defs>rgba(250,250,250,var(--un-bg-opacity))
7
7
  <path id="gentle-wave" d="M-160 44c30 0 58-18 88-18s 58 18 88 18 58-18 88-18 58 18 88 18 v44h-352z" />
8
8
  </defs>
9
9
  <g class="parallax">
10
- <use class="transition-all duration-200" xlink:href="#gentle-wave" x="48" y="0" fill="var(--hy-c-waves-dimm-1)" />
11
- <use class="transition-all duration-200" xlink:href="#gentle-wave" x="48" y="3" fill="var(--hy-c-waves-dimm-2)" />
12
- <use class="transition-all duration-200" xlink:href="#gentle-wave" x="48" y="5" fill="var(--hy-c-waves-dimm-3)" />
13
- <use class="transition-all duration-200" xlink:href="#gentle-wave" x="48" y="7" fill="var(--hy-c-waves-dimm)" />
10
+ <use class="" xlink:href="#gentle-wave" x="48" y="0" fill="var(--hy-c-waves-dimm-1)" />
11
+ <use class="" xlink:href="#gentle-wave" x="48" y="3" fill="var(--hy-c-waves-dimm-2)" />
12
+ <use class="" xlink:href="#gentle-wave" x="48" y="5" fill="var(--hy-c-waves-dimm-3)" />
13
+ <use class="" xlink:href="#gentle-wave" x="48" y="7" fill="var(--hy-c-waves-dimm)" />
14
14
  </g>
15
15
  </svg>
16
16
  </template>
@@ -0,0 +1,51 @@
1
+ <script lang="ts" setup>
2
+ import { provide, useCssVars } from 'vue'
3
+ import { renderOverlay } from '@overlastic/vue'
4
+ import type { ImageViewerProps } from 'element-plus/es/components/image-viewer/index'
5
+ import { atWillToUnit } from '@hairy/utils'
6
+ import HairyImageViewer from './HairyImageViewer.vue'
7
+
8
+ const props = withDefaults(defineProps<{
9
+ row?: string | number
10
+ col?: string | number
11
+ gap?: string | number
12
+ justify?: string
13
+ align?: string
14
+ }>(), {
15
+ row: 'auto',
16
+ col: 'auto',
17
+ gap: 10,
18
+ justify: 'space-evenly',
19
+ align: 'initial',
20
+ })
21
+
22
+ useCssVars(() => ({
23
+ width: atWillToUnit(props.row),
24
+ height: atWillToUnit(props.col),
25
+ gap: atWillToUnit(props.gap),
26
+ justify: props.justify,
27
+ align: props.align,
28
+ }))
29
+
30
+ // TODO global find images
31
+ // const slots = useSlots()
32
+ // const paths = computed(() => slots
33
+ // .default?.()
34
+ // .map(v => v.props?.src)
35
+ // .filter(Boolean) as string[],
36
+ // )
37
+
38
+ function preview(url: string) {
39
+ // const initialIndex = paths.value.findIndex(v => v === url) || 0
40
+ renderOverlay<Partial<ImageViewerProps>>(HairyImageViewer, {
41
+ urlList: [url],
42
+ initialIndex: 0,
43
+ })
44
+ }
45
+
46
+ provide('HairyImageGroup:preview', preview)
47
+ </script>
48
+
49
+ <template>
50
+ <slot />
51
+ </template>
@@ -1,11 +1,12 @@
1
1
  <script lang="ts" setup>
2
- import { useOverlayMeta } from 'unoverlay-vue'
2
+ import { usePrograms } from '@overlastic/vue'
3
3
  import { ElImageViewer, imageViewerProps } from 'element-plus/es/components/image-viewer/index'
4
4
  import 'element-plus/es/components/image-viewer/style/index'
5
5
  import { onMounted, onUnmounted } from 'vue'
6
+
6
7
  const props = defineProps(imageViewerProps)
7
8
 
8
- const { visible, confirm } = useOverlayMeta()
9
+ const { visible, resolve } = usePrograms()
9
10
 
10
11
  onMounted(() => {
11
12
  document.body.style.overflow = 'hidden'
@@ -17,6 +18,6 @@ onUnmounted(() => {
17
18
 
18
19
  <template>
19
20
  <div class="HairyImageViewer fixed inset-0 z-2000">
20
- <ElImageViewer v-if="visible" v-bind="props" @close="confirm()"></ElImageViewer>
21
+ <ElImageViewer v-if="visible" v-bind="props" @close="resolve()" />
21
22
  </div>
22
23
  </template>
@@ -0,0 +1,21 @@
1
+ <script lang="ts" setup>
2
+ defineProps<{
3
+ type?: 'white' | 'normal'
4
+ bordered?: boolean
5
+ }>()
6
+ </script>
7
+
8
+ <template>
9
+ <a
10
+ class="cursor-pointer" :class="[
11
+ type === 'white'
12
+ ? 'text-black hover:text-primary dark:text-white'
13
+ : 'text:text-primary-light hover:text-primary-dark',
14
+ bordered && 'border-b border-dashed hover:border-primary',
15
+ ]"
16
+ >
17
+ <slot />
18
+ </a>
19
+ </template>
20
+
21
+ <style lang="scss" scoped></style>
@@ -2,7 +2,8 @@
2
2
  import type { HairyTheme } from 'valaxy-theme-hairy'
3
3
  import { useThemeConfig } from 'valaxy'
4
4
  import { computed } from 'vue'
5
- const themeConfig = useThemeConfig<HairyTheme>()
5
+
6
+ const themeConfig = useThemeConfig<HairyTheme.Config>()
6
7
  const nav = computed(() => themeConfig.value.nav || [])
7
8
  </script>
8
9
 
@@ -2,21 +2,28 @@
2
2
  import type { NavItem } from 'valaxy-theme-hairy'
3
3
  import { computed } from 'vue'
4
4
  import { useRoute, useRouter } from 'vue-router'
5
- import { ejectWindow } from '../utils'
5
+ import { storeToRefs } from 'pinia'
6
+ import { ejectWindow } from '../../utils'
7
+ import { useGlobalStore } from '../../store'
8
+
6
9
  const props = defineProps<{
7
10
  item: NavItem
8
11
  }>()
12
+ const { showDrawer } = storeToRefs(useGlobalStore())
9
13
  const urlReg = /^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/
10
14
  const isLink = computed(() => urlReg.test(props.item?.link || ''))
11
15
  const isPointer = computed(() => Boolean(props.item.link) || isLink.value)
12
16
  const router = useRouter()
13
17
  const route = useRoute()
14
- const toLink = () => {
18
+
19
+ function toLink() {
15
20
  if (isLink.value)
16
21
  return ejectWindow(props.item.link!)
17
22
  if (props.item.link)
18
23
  router.push(props.item.link)
24
+ showDrawer.value = false
19
25
  }
26
+
20
27
  const isActive = computed(() => {
21
28
  if (isLink.value)
22
29
  return false
@@ -27,14 +34,14 @@ const isActive = computed(() => {
27
34
  </script>
28
35
 
29
36
  <template>
30
- <div class="px-2.5 HairyMenuItem" :class="[isPointer ? 'cursor-pointer' : 'select-none', isActive && 'text-primary active']">
37
+ <button class="px-2.5 HairyMenuItem" :class="[isPointer ? 'cursor-pointer' : 'select-none', isActive && 'text-primary active']">
31
38
  <div class="flex items-center hover:text-primary" @click="toLink">
32
39
  <div v-if="item.icon" class="mr-1 icon" :class="item.icon" />
33
40
  <div class="question">
34
41
  {{ item.text }}
35
42
  </div>
36
43
  </div>
37
- </div>
44
+ </button>
38
45
  </template>
39
46
 
40
47
  <style lang="scss" scoped></style>
@@ -0,0 +1,99 @@
1
+ <script setup lang="ts">
2
+ import { ref } from 'vue'
3
+ import {
4
+ useActiveAnchor,
5
+ } from 'valaxy'
6
+ import { useOutline } from '../../composables'
7
+
8
+ const container = ref()
9
+ const marker = ref()
10
+
11
+ useActiveAnchor(container, marker)
12
+
13
+ const { headers, handleClick } = useOutline()
14
+ </script>
15
+
16
+ <template>
17
+ <div v-show="headers.length" ref="container">
18
+ <div class="content">
19
+ <div class="outline-title">
20
+ {{ 'On this page' }}
21
+ </div>
22
+
23
+ <div ref="marker" class="outline-marker" />
24
+
25
+ <nav aria-labelledby="doc-outline-aria-label">
26
+ <span id="doc-outline-aria-label" class="visually-hidden">
27
+ Table of Contents for current page
28
+ </span>
29
+
30
+ <HairyOutlineItem
31
+ class="va-toc relative z-1 css-i18n-toc"
32
+ :headers="headers"
33
+ :on-click="handleClick"
34
+ root
35
+ />
36
+ </nav>
37
+ </div>
38
+ </div>
39
+ </template>
40
+
41
+ <style lang="scss" scoped>
42
+ .va-toc {
43
+ text-align: left;
44
+ }
45
+
46
+ .content {
47
+ position: relative;
48
+ padding-left: 16px;
49
+ font-size: 14px;
50
+ text-align: left;
51
+ }
52
+
53
+ .outline-marker {
54
+ position: absolute;
55
+ top: 32px;
56
+ left: -2px;
57
+ z-index: 0;
58
+ opacity: 0;
59
+ width: 4px;
60
+ height: 18px;
61
+ background-color: var(--va-c-brand);
62
+ transition: top 0.25s cubic-bezier(0, 1, 0.5, 1), background-color 0.5s, opacity 0.25s;
63
+ border-top-right-radius: 2px;
64
+ border-bottom-right-radius: 2px;
65
+ }
66
+
67
+ .outline-title {
68
+ letter-spacing: 0.4px;
69
+ line-height: 28px;
70
+ font-size: 14px;
71
+ font-weight: 600;
72
+ }
73
+
74
+ .outline-link {
75
+ display: block;
76
+ line-height: 28px;
77
+ color: var(--va-c-text-light);
78
+ white-space: nowrap;
79
+ overflow: hidden;
80
+ text-overflow: ellipsis;
81
+ transition: color 0.5s;
82
+ }
83
+
84
+ .outline-link:hover,
85
+ .outline-link.active {
86
+ color: var(--va-c-brand);
87
+ transition: color 0.25s;
88
+ }
89
+
90
+ .visually-hidden {
91
+ position: absolute;
92
+ width: 1px;
93
+ height: 1px;
94
+ white-space: nowrap;
95
+ clip: rect(0 0 0 0);
96
+ clip-path: inset(50%);
97
+ overflow: hidden;
98
+ }
99
+ </style>
@@ -0,0 +1,48 @@
1
+ <script setup lang="ts">
2
+ import type { MenuItem } from 'valaxy'
3
+ import { useI18n } from 'vue-i18n'
4
+
5
+ defineProps<{
6
+ headers: MenuItem[]
7
+ onClick: (e: MouseEvent) => void
8
+ root?: boolean
9
+ }>()
10
+
11
+ const { locale } = useI18n()
12
+ </script>
13
+
14
+ <template>
15
+ <ul :class="root ? 'root' : 'nested'">
16
+ <li v-for="{ children, link, title, lang } in headers" :key="link" class="va-toc-item" :lang="lang || locale">
17
+ <a class="outline-link" :href="link" @click="onClick">{{ title }}</a>
18
+ <template v-if="children?.length">
19
+ <HairyOutlineItem :headers="children" :on-click="onClick" />
20
+ </template>
21
+ </li>
22
+ </ul>
23
+ </template>
24
+
25
+ <style lang="scss" scoped>
26
+ .va-toc {
27
+ .va-toc-item {
28
+ .outline-link {
29
+ color: var(--va-c-text-light);
30
+ white-space: nowrap;
31
+ overflow: hidden;
32
+ text-overflow: ellipsis;
33
+ transition: color 0.5s;
34
+
35
+ &:hover,
36
+ &.active {
37
+ color: var(--va-c-primary-lighter);
38
+ transition: color 0.25s;
39
+ }
40
+
41
+ }
42
+
43
+ .nested {
44
+ padding-left: 0.8rem;
45
+ }
46
+ }
47
+ }
48
+ </style>
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" setup>
2
- import { useConfig } from 'valaxy'
2
+ import { useSiteConfig } from 'valaxy'
3
3
 
4
- const config = useConfig()
4
+ const config = useSiteConfig()
5
5
  </script>
6
6
 
7
7
  <template>