valaxy-theme-hairy 1.0.3 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" setup>
2
2
  import { capitalize, computed } from 'vue'
3
- import { useConfig, useSiteConfig, useThemeConfig } from 'valaxy'
3
+ import { useConfig, useRuntimeConfig, useSiteConfig, useThemeConfig } from 'valaxy'
4
4
  import { useI18n } from 'vue-i18n'
5
5
  import pkg from 'valaxy/package.json'
6
6
  import type { HairyTheme } from 'valaxy-theme-hairy'
@@ -19,8 +19,8 @@ const isThisYear = computed(() => {
19
19
 
20
20
  const poweredHtml = computed(() => t('footer.powered', [`<a href="${pkg.repository}" target="_blank" rel="noopener">Valaxy</a> v${pkg.version}`]))
21
21
  const footerIcon = computed(() => themeConfig.value.footer?.icon)
22
-
23
- // const frontmatter = useFrontmatter()
22
+ const runtimeConfig = useRuntimeConfig()
23
+ const addonWaline = computed(() => runtimeConfig.value.addons['valaxy-addon-waline'])
24
24
  </script>
25
25
 
26
26
  <template>
@@ -45,11 +45,13 @@ const footerIcon = computed(() => themeConfig.value.footer?.icon)
45
45
  </a>
46
46
 
47
47
  <span>{{ sideConfig.author.name }}</span>
48
- <span class="mx-2">|</span>
49
- <span class="flex items-center">
50
- <div class="i-ri-eye-fill mr-1" />
51
- <span class="waline-pageview-count" data-path="/">-</span>
52
- </span>
48
+ <template v-if="addonWaline.options?.pageview">
49
+ <span class="mx-2">|</span>
50
+ <span class="flex items-center">
51
+ <div class="i-ri-eye-fill mr-1" />
52
+ <span class="waline-pageview-count" data-path="/" />
53
+ </span>
54
+ </template>
53
55
  </div>
54
56
  <div v-if="themeConfig.footer.powered" class="powered" m="2">
55
57
  <span v-html="poweredHtml" /> | <span>{{ t('footer.theme') }} - <a :href="themeConfig.pkg.homepage" :title="`valaxy-theme-${config.theme}`" target="_blank">{{ capitalize(config.theme) }}</a> v{{ themeConfig.pkg.version }}</span>
@@ -2,8 +2,8 @@
2
2
  import { computed, provide, useCssVars, useSlots } from 'vue'
3
3
  import { renderOverlay } from '@overlastic/vue'
4
4
  import type { ImageViewerProps } from 'element-plus'
5
+ import { atWillToUnit } from '../utils'
5
6
  import HairyImageViewer from './parts/HairyImageViewer.vue'
6
- import { atWillToUnit } from '../utils';
7
7
 
8
8
  const props = withDefaults(defineProps<{
9
9
  row?: string | number
@@ -2,8 +2,8 @@
2
2
  import { provide, useCssVars } from 'vue'
3
3
  import { renderOverlay } from '@overlastic/vue'
4
4
  import type { ImageViewerProps } from 'element-plus'
5
+ import { atWillToUnit } from '../../utils'
5
6
  import HairyImageViewer from './HairyImageViewer.vue'
6
- import { atWillToUnit } from '../../utils';
7
7
 
8
8
  const props = withDefaults(defineProps<{
9
9
  row?: string | number
@@ -7,7 +7,7 @@ defineProps<{
7
7
 
8
8
  <template>
9
9
  <a
10
- class="cursor-pointer" :class="[
10
+ class="cursor-pointer transition-colors" :class="[
11
11
  type === 'white'
12
12
  ? 'text-black hover:text-primary dark:text-white'
13
13
  : 'text:text-primary-light hover:text-primary-dark',
@@ -59,7 +59,7 @@ function displayCategory(keys: string | string[] = []) {
59
59
  </span>
60
60
  </a>
61
61
  <div class="text-base leading-6 font-medium">
62
- <a class="link cursor-pointer" aria-label="read more" @click="onReadMore">
62
+ <a class="link flex gap-2 cursor-pointer" aria-label="read more" @click="onReadMore">
63
63
  <span v-if="reverse">←</span>
64
64
  <span class="hidden md:block">Read more</span>
65
65
  <span v-if="!reverse">→</span>
@@ -85,7 +85,7 @@ function displayCategory(keys: string | string[] = []) {
85
85
 
86
86
  .dark {
87
87
  .post-image {
88
- @apply opacity-75 hover:opacity-90 ;
88
+ @apply opacity-75 hover:opacity-90 duration-200;
89
89
  }
90
90
  }
91
91
 
@@ -9,7 +9,7 @@ const route = useRoute()
9
9
  <div class="border-t border-gray-200 dark:border-gray-600" />
10
10
  <div class="flex items-center justify-end mt-2">
11
11
  <div class="i-ri-eye-fill mr-2" />
12
- 阅读次数 <span class="waline-pageview-count mx-2" :data-path="route.path"> - </span>
12
+ 阅读次数 <span class="waline-pageview-count mx-2" :data-path="route.path" />
13
13
  </div>
14
14
  </div>
15
15
  </template>
@@ -24,7 +24,7 @@ export function useHairyTags(options: {
24
24
  const range = max - min
25
25
  const percent = (count - min) / range
26
26
  return {
27
- '--yun-tag-color': gray.mix(primaryColor, percent * 100).toString(),
27
+ '--yun-tag-color': gray.mix(primaryColor, (percent || 0) * 100).toString(),
28
28
  'fontSize': `${percent * 36 + 12}px`,
29
29
  }
30
30
  }
package/layouts/post.vue CHANGED
@@ -1,7 +1,8 @@
1
1
  <script lang="ts" setup>
2
2
  import { ElTag, dayjs } from 'element-plus'
3
- import { useFrontmatter } from 'valaxy'
3
+ import { useFrontmatter, useRuntimeConfig } from 'valaxy'
4
4
  import { useRouter } from 'vue-router'
5
+ import { computed } from 'vue'
5
6
 
6
7
  import 'element-plus/theme-chalk/el-tag.css'
7
8
 
@@ -13,6 +14,8 @@ defineProps<{
13
14
  }
14
15
  }>()
15
16
 
17
+ const runtimeConfig = useRuntimeConfig()
18
+ const addonWaline = computed(() => runtimeConfig.value.addons['valaxy-addon-waline'])
16
19
  const router = useRouter()
17
20
  const post = useFrontmatter()
18
21
 
@@ -43,7 +46,7 @@ function displayTag(tag: string) {
43
46
  <HairyImageGlobal>
44
47
  <router-view />
45
48
  </HairyImageGlobal>
46
- <HairyPostFooter />
49
+ <HairyPostFooter v-if="addonWaline.options?.pageview" />
47
50
  </template>
48
51
  <template #slide>
49
52
  <HairyTabbar />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valaxy-theme-hairy",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "packageManager": "pnpm@8.10.5",
5
5
  "author": {
6
6
  "email": "wwu710632@gmail.com",
@@ -21,16 +21,16 @@
21
21
  "main": "client/index.ts",
22
22
  "types": "types/index.d.ts",
23
23
  "dependencies": {
24
+ "@iconify-json/ant-design": "^1.1.3",
25
+ "@iconify-json/fluent": "^1.1.18",
26
+ "@iconify-json/material-symbols": "^1.1.83",
27
+ "@iconify-json/simple-icons": "^1.1.19",
24
28
  "@overlastic/vue": "^0.4.7",
25
29
  "element-plus": "^2.7.6",
26
30
  "pinia": "^2.1.7",
27
31
  "swiper": "^11.0.5"
28
32
  },
29
33
  "devDependencies": {
30
- "@iconify-json/ant-design": "^1.1.3",
31
- "@iconify-json/fluent": "^1.1.18",
32
- "@iconify-json/material-symbols": "^1.1.83",
33
- "@iconify-json/simple-icons": "^1.1.19",
34
34
  "valaxy": "^0.19.1",
35
35
  "valaxy-addon-algolia": "^0.0.3",
36
36
  "valaxy-addon-meting": "^0.1.3",
package/utils/index.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export * from './size'
2
- export * from './util'
2
+ export * from './util'
package/utils/size.ts CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  function isString(val: any) {
3
2
  return typeof val === 'string'
4
3
  }
@@ -14,8 +13,8 @@ export function atWillToUnit(value: any, unit = 'px') {
14
13
  }
15
14
 
16
15
  /** size 转换配置 */
17
- export type AtWillSize = any | [any, any] | { width: any; height: any }
18
- export interface Size { width: string; height: string }
16
+ export type AtWillSize = any | [any, any] | { width: any, height: any }
17
+ export interface Size { width: string, height: string }
19
18
 
20
19
  /**
21
20
  * 将 size 转换为宽高,用于元素宽高
package/valaxy.config.ts CHANGED
@@ -16,6 +16,9 @@ export default defineTheme<ThemeConfig>((options) => {
16
16
  },
17
17
  outline: 2,
18
18
  theme: 'dark',
19
+ layout: {
20
+ post: 'image:slice:reverse',
21
+ },
19
22
  },
20
23
  }
21
24