valaxy-theme-yun 0.11.0 → 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.
@@ -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
 
@@ -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
  }
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valaxy-theme-yun",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "author": {
5
5
  "email": "me@yunyoujun.cn",
6
6
  "name": "YunYouJun",
@@ -24,6 +24,6 @@
24
24
  "valaxy-addon-waline": "0.0.2"
25
25
  },
26
26
  "devDependencies": {
27
- "valaxy": "0.11.0"
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 *;