valaxy-theme-yun 0.25.1 → 0.25.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,7 +17,7 @@ const themeConfig = useThemeConfig()
17
17
 
18
18
  // height of top/bottom line
19
19
 
20
- const { totalCharHeight, chars } = useYunBanner(themeConfig.value.banner)
20
+ const { totalCharHeight, chars, bannerTitle } = useYunBanner(themeConfig.value.banner)
21
21
 
22
22
  const bannerStyles = computed<CSSProperties>(() => {
23
23
  const styles: CSSProperties = {
@@ -64,13 +64,13 @@ onMounted(async () => {
64
64
  <template v-if="yun.isNimbo">
65
65
  <YunBannerCharContainer
66
66
  v-if="animationStatus === 'banner'"
67
- :title="themeConfig.banner.title"
67
+ :title="bannerTitle"
68
68
  :chars="chars"
69
69
  />
70
70
  </template>
71
71
  <template v-if="yun.isStrato">
72
72
  <YunBannerCharContainer
73
- :title="themeConfig.banner.title"
73
+ :title="bannerTitle"
74
74
  :chars="chars"
75
75
  />
76
76
  </template>
@@ -1,11 +1,19 @@
1
1
  import type { YunTheme } from '../types'
2
- import { random } from 'valaxy'
2
+ import { random, useValaxyI18n } from 'valaxy'
3
3
  import { computed } from 'vue'
4
4
 
5
5
  export function useYunBanner(options: YunTheme.Banner) {
6
+ const { $tO } = useValaxyI18n()
7
+
8
+ const bannerTitle = computed(() => {
9
+ if (Array.isArray(options.title)) {
10
+ return options.title
11
+ }
12
+ return $tO<string | string[]>(options.title)
13
+ })
6
14
  const chars = computed(() => {
7
15
  const arr = []
8
- for (let i = 0; i < options.title.length; i++) {
16
+ for (let i = 0; i < bannerTitle.value.length; i++) {
9
17
  const rn = random(1.5, 3.5)
10
18
  arr.push(rn)
11
19
  }
@@ -15,6 +23,7 @@ export function useYunBanner(options: YunTheme.Banner) {
15
23
  const totalCharHeight = computed(() => chars.value.reduce((a, b) => a + b, 0))
16
24
 
17
25
  return {
26
+ bannerTitle,
18
27
  chars,
19
28
  totalCharHeight,
20
29
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "valaxy-theme-yun",
3
3
  "type": "module",
4
- "version": "0.25.1",
4
+ "version": "0.25.2",
5
5
  "author": {
6
6
  "email": "me@yunyoujun.cn",
7
7
  "name": "YunYouJun",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/animejs": "^3.1.13",
35
- "valaxy": "0.25.1",
35
+ "valaxy": "0.25.2",
36
36
  "valaxy-addon-waline": "0.2.1"
37
37
  },
38
38
  "scripts": {
package/types/index.d.ts CHANGED
@@ -12,8 +12,11 @@ export namespace YunTheme {
12
12
  /**
13
13
  * @en Banner title
14
14
  * @zh 标题,默认每个字分割,你也可以通过数组的方式来自定义分割,如 ['Hello', 'World']
15
+ *
16
+ * i18n: { 'en': 'Title', 'zh-CN': '标题' }
17
+ * { en: ['Hello', 'World'], 'zh-CN': ['你好', '世界'] }
15
18
  */
16
- title: string | string[]
19
+ title: string | string[] | Record<string, string | string[]>
17
20
 
18
21
  /**
19
22
  * 首页下方的动态云