valaxy-theme-yun 0.10.4 → 0.11.1

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.
@@ -62,9 +62,9 @@ const YunTwikoo = config.value.comment.waline.enable
62
62
  </YunCard>
63
63
  </slot>
64
64
 
65
- <YunFooter>
66
- <slot name="footer" />
67
- </YunFooter>
65
+ <slot name="main-footer-before" />
66
+ <YunFooter />
67
+ <slot name="main-footer-after" />
68
68
  </div>
69
69
  </slot>
70
70
 
@@ -80,6 +80,14 @@ const YunTwikoo = config.value.comment.waline.enable
80
80
  <style lang="scss">
81
81
  @use 'valaxy/client/styles/mixins' as *;
82
82
 
83
+ @include media('md') {
84
+ .yun-main {
85
+ &.has-sidebar {
86
+ padding-left: var(--va-sidebar-width);
87
+ }
88
+ }
89
+ }
90
+
83
91
  @include media('xl') {
84
92
  .content{
85
93
  // 8px scrollbar width
@@ -1,10 +1,9 @@
1
1
  <script lang="ts" setup>
2
2
  import { useI18n } from 'vue-i18n'
3
- import { useData, useFrontmatter } from 'valaxy'
3
+ import { useFrontmatter } from 'valaxy'
4
4
  import { useAppStore } from 'valaxy/client/stores/app'
5
5
 
6
6
  const frontmatter = useFrontmatter()
7
- const data = useData()
8
7
  const { t } = useI18n()
9
8
  const app = useAppStore()
10
9
  </script>
@@ -27,7 +26,7 @@ const app = useAppStore()
27
26
  {{ t('sidebar.toc') }}
28
27
  </h2>
29
28
 
30
- <YunToc v-if="frontmatter.toc !== false" :headers="data.headers || []" />
29
+ <YunOutline v-if="frontmatter.toc !== false" />
31
30
 
32
31
  <div class="flex-grow" />
33
32
 
@@ -2,15 +2,12 @@
2
2
  import { capitalize, computed } from 'vue'
3
3
  import { useConfig } from 'valaxy'
4
4
  import { useI18n } from 'vue-i18n'
5
-
6
5
  import pkg from 'valaxy/package.json'
7
6
  import { useThemeConfig } from '../composables'
8
7
 
9
8
  const { t } = useI18n()
10
-
11
9
  const config = useConfig()
12
10
  const themeConfig = useThemeConfig()
13
-
14
11
  const year = new Date().getFullYear()
15
12
 
16
13
  const isThisYear = computed(() => {
@@ -18,11 +15,15 @@ const isThisYear = computed(() => {
18
15
  })
19
16
 
20
17
  const poweredHtml = computed(() => t('footer.powered', [`<a href="${pkg.repository}" target="_blank" rel="noopener">Valaxy</a> v${pkg.version}`]))
21
- const footerIcon = computed(() => themeConfig.value.footer.icon!)
18
+ const footerIcon = computed(() => themeConfig.value.footer.icon || {
19
+ url: pkg.repository,
20
+ name: 'i-ri-cloud-line',
21
+ title: pkg.name,
22
+ })
22
23
  </script>
23
24
 
24
25
  <template>
25
- <footer class="va-footer p-4" text="center sm" style="color:var(--va-c-text-light)">
26
+ <footer class="va-footer p-4 text-$va-c-text-light" text="center sm">
26
27
  <div v-if="themeConfig.footer.beian?.enable && themeConfig.footer.beian.icp" class="beian" m="y-2">
27
28
  <a href="https://beian.miit.gov.cn/" target="_blank" rel="noopener">
28
29
  {{ themeConfig.footer.beian.icp }}
@@ -38,15 +39,14 @@ const footerIcon = computed(() => themeConfig.value.footer.icon!)
38
39
  {{ year }}
39
40
  </span>
40
41
 
41
- <a m="x-2" class="inline-flex animate-pulse" :href="footerIcon.url" target="_blank" :title="footerIcon.title">
42
+ <a v-if="themeConfig.footer.icon" m="x-2" class="inline-flex animate-pulse" :href="footerIcon.url" target="_blank" :title="footerIcon.title">
42
43
  <div :class="footerIcon.name" />
43
44
  </a>
44
-
45
45
  <span>{{ config.author.name }}</span>
46
46
  </div>
47
47
 
48
48
  <div v-if="themeConfig.footer.powered" class="powered" m="2">
49
- <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>
49
+ <span v-html="poweredHtml" /> | <span>{{ t('footer.theme') }} - <a :href="themeConfig.pkg.homepage" :title="themeConfig.pkg.name" target="_blank">{{ capitalize(config.theme) }}</a> v{{ themeConfig.pkg.version }}</span>
50
50
  </div>
51
51
 
52
52
  <slot />
@@ -1,34 +1,19 @@
1
1
  <script setup lang="ts">
2
- import { computed, ref } from 'vue'
3
- import { useI18n } from 'vue-i18n'
4
- import type { Header } from 'valaxy'
2
+ import { ref } from 'vue'
5
3
  import {
6
- resolveHeaders,
7
4
  useActiveAnchor,
8
- useFrontmatter,
5
+ useOutline,
9
6
  } from 'valaxy'
10
7
  import { useThemeConfig } from '../composables'
11
8
 
12
- const props = defineProps<{ headers: Header[] }>()
13
-
14
- const frontmatter = useFrontmatter()
15
9
  const themeConfig = useThemeConfig()
16
10
 
17
- const { locale } = useI18n()
18
11
  const container = ref()
19
12
  const marker = ref()
20
13
 
21
14
  useActiveAnchor(container, marker)
22
15
 
23
- const resolvedHeaders = computed(() => {
24
- return resolveHeaders(props.headers || [])
25
- })
26
-
27
- function handleClick({ target: el }: Event) {
28
- const id = `#${(el as HTMLAnchorElement).href!.split('#')[1]}`
29
- const heading = document.querySelector(decodeURIComponent(id)) as HTMLAnchorElement
30
- heading?.focus()
31
- }
16
+ const { headers, handleClick } = useOutline()
32
17
  </script>
33
18
 
34
19
  <template>
@@ -45,26 +30,12 @@ function handleClick({ target: el }: Event) {
45
30
  Table of Contents for current page
46
31
  </span>
47
32
 
48
- <ul class="va-toc relative z-1">
49
- <li
50
- v-for="{ text, link, children, hidden, lang } in resolvedHeaders"
51
- v-show="!hidden"
52
- :key="link"
53
- class="va-toc-item"
54
- :lang="lang || locale"
55
- >
56
- <a class="outline-link" :href="link" @click="handleClick">
57
- {{ text }}
58
- </a>
59
- <ul v-if="children && frontmatter.outline === 'deep'">
60
- <li v-for="item in children" v-show="!item.hidden" :key="item.link" :lang="lang || locale">
61
- <a class="outline-link" p="l-3" :href="link" @click="handleClick">
62
- {{ item.text }}
63
- </a>
64
- </li>
65
- </ul>
66
- </li>
67
- </ul>
33
+ <YunOutlineItem
34
+ class="va-toc relative z-1"
35
+ :headers="headers"
36
+ :on-click="handleClick"
37
+ root
38
+ />
68
39
  </nav>
69
40
  </div>
70
41
  </div>
@@ -73,10 +44,6 @@ function handleClick({ target: el }: Event) {
73
44
  <style lang="scss" scoped>
74
45
  .va-toc {
75
46
  text-align: left;
76
-
77
- .va-toc-item {
78
- color: var(--va-c-text-light);
79
- }
80
47
  }
81
48
 
82
49
  .content {
@@ -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
+ <YunOutlineItem :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-brand);
38
+ transition: color 0.25s;
39
+ }
40
+
41
+ }
42
+
43
+ .nested {
44
+ padding-left: 0.8rem;
45
+ }
46
+ }
47
+ }
48
+ </style>
@@ -9,14 +9,14 @@ const router = useRouter()
9
9
  <template>
10
10
  <div class="sidebar-panel">
11
11
  <div class="site-info" m="t-6">
12
- <a class="site-author-avatar" href="/about">
12
+ <router-link class="site-author-avatar" to="/about">
13
13
  <img class="rounded-full" :src="config.author.avatar" alt="avatar">
14
14
  <span class="site-author-status">{{ config.author.status.emoji }}</span>
15
- </a>
15
+ </router-link>
16
16
  <div class="site-author-name">
17
- <a href="/about">
17
+ <router-link to="/about">
18
18
  {{ config.author.name }}
19
- </a>
19
+ </router-link>
20
20
  </div>
21
21
  <router-link v-if="router.hasRoute('about-site')" to="/about/site" class="site-name">
22
22
  {{ config.title }}
@@ -62,9 +62,9 @@ const sortedYears = computed(() => {
62
62
  <time v-if="post.date" class="post-time" font="mono" opacity="80">{{ formatDate(post.date, 'MM-DD') }}</time>
63
63
  </div>
64
64
  <h2 class="post-title" font="serif black">
65
- <a :href="post.path" class="post-title-link">
65
+ <router-link :to="post.path || ''" class="post-title-link">
66
66
  {{ post.title }}
67
- </a>
67
+ </router-link>
68
68
  </h2>
69
69
  </header>
70
70
  </article>
@@ -5,9 +5,9 @@ const themeConfig = useThemeConfig()
5
5
 
6
6
  <template>
7
7
  <div class="links">
8
- <a v-for="item, i in themeConfig.pages" :key="i" class="link-item yun-icon-btn" :href="item.url" :title="item.name" :target="item.url.startsWith('http') ? '_blank' : ''" :style="`color:${item.color}`">
8
+ <AppLink v-for="item, i in themeConfig.pages" :key="i" class="link-item yun-icon-btn" :to="item.url" :title="item.name" :style="`color:${item.color}`">
9
9
  <div :class="item.icon" class="icon" />
10
- </a>
10
+ </AppLink>
11
11
  </div>
12
12
  </template>
13
13
 
@@ -21,7 +21,7 @@ const themeConfig = useThemeConfig()
21
21
  .link-item {
22
22
  display: inline-flex;
23
23
 
24
- .icon {
24
+ .icon {
25
25
  width: 2rem;
26
26
  height: 2rem;
27
27
  }
@@ -1,25 +1,8 @@
1
1
  <script lang="ts" setup>
2
2
  import { useConfig } from 'valaxy'
3
- import { useWaline } from 'valaxy-addon-waline'
4
-
5
3
  const config = useConfig()
6
- useWaline(config.value.comment.waline, config.value.cdn.prefix)
7
4
  </script>
8
5
 
9
6
  <template>
10
- <div id="waline" w="full" />
7
+ <WalineClient w="full" :server-u-r-l="config.comment.waline.serverURL" :cdn="config.cdn.prefix" />
11
8
  </template>
12
-
13
- <style lang="scss">
14
- #waline {
15
- --waline-theme-color: var(--va-c-primary);
16
- --waline-active-color: var(--va-c-primary-light);
17
-
18
- .v[data-class=v] {
19
- .veditor {
20
- width: calc(100% - 2em);
21
- padding: 0.5rem;
22
- }
23
- }
24
- }
25
- </style>
File without changes
package/layouts/home.vue CHANGED
@@ -27,9 +27,7 @@ const isHome = useLayout('home')
27
27
  <router-view />
28
28
  </slot>
29
29
 
30
- <YunFooter>
31
- <slot name="footer" />
32
- </YunFooter>
30
+ <YunFooter />
33
31
  </main>
34
32
 
35
33
  <YunSearch v-if="config.search.enable" />
@@ -45,9 +45,6 @@ const config = useConfig()
45
45
  <template #aside-custom>
46
46
  <slot name="aside-custom" />
47
47
  </template>
48
- <template #footer>
49
- <slot name="footer" />
50
- </template>
51
48
  </component>
52
49
  </router-view>
53
50
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valaxy-theme-yun",
3
- "version": "0.10.4",
3
+ "version": "0.11.1",
4
4
  "author": {
5
5
  "email": "me@yunyoujun.cn",
6
6
  "name": "YunYouJun",
@@ -20,10 +20,10 @@
20
20
  "@docsearch/css": "^3.2.1",
21
21
  "@docsearch/js": "^3.2.1",
22
22
  "@iconify-json/ant-design": "^1.1.3",
23
- "@iconify-json/simple-icons": "^1.1.26",
24
- "valaxy-addon-waline": "0.0.1"
23
+ "@iconify-json/simple-icons": "^1.1.28",
24
+ "valaxy-addon-waline": "0.0.2"
25
25
  },
26
26
  "devDependencies": {
27
- "valaxy": "0.10.4"
27
+ "valaxy": "0.11.1"
28
28
  }
29
29
  }
@@ -25,6 +25,7 @@ html.dark {
25
25
  }
26
26
 
27
27
  ul {
28
+ list-style: initial;
28
29
  li > p {
29
30
  margin-bottom: 0;
30
31
  }
package/styles/index.scss CHANGED
@@ -1,10 +1,11 @@
1
1
  @use "./layout" as *;
2
-
3
2
  @use "./common/button.scss" as *;
4
- @use "./common/markdown.scss" as *;
5
3
 
6
4
  @forward "star-markdown-css/src/scss/theme/yun.scss" with (
7
5
  $colors: (
8
6
  "primary": $c-primary,
9
7
  )
10
8
  );
9
+
10
+ // override the default style of star-markdown-css
11
+ @use "./common/markdown.scss" as *;