valaxy-theme-yun 0.6.0 → 0.6.3

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.
@@ -0,0 +1,77 @@
1
+ <script lang="ts" setup>
2
+ import type { PageData, Post } from 'valaxy'
3
+ import { useConfig, usePostProperty, usePostTitle } from 'valaxy'
4
+ import { computed } from 'vue'
5
+
6
+ const props = defineProps<{
7
+ frontmatter: Post
8
+ data?: PageData
9
+ }>()
10
+ const config = useConfig()
11
+
12
+ const { styles, icon, color } = usePostProperty(props.frontmatter.type)
13
+ const title = usePostTitle(computed(() => props.frontmatter))
14
+ </script>
15
+
16
+ <template>
17
+ <main class="yun-main lt-md:ml-0" flex="~">
18
+ <div w="full" flex="~">
19
+ <slot name="main">
20
+ <div class="content" flex="~ col grow" w="full" p="l-4 lt-md:0">
21
+ <YunCard :cover="frontmatter.cover" m="0" class="relative" :style="styles">
22
+ <slot name="main-header">
23
+ <YunPageHeader :title="title" :icon="frontmatter.icon || icon" :color="frontmatter.color || color" :cover="frontmatter.cover" />
24
+ </slot>
25
+ <slot name="main-header-after" />
26
+
27
+ <div p="x-4 b-8" class="sm:px-6 lg:px-12 xl:px-16" w="full">
28
+ <slot name="main-content">
29
+ <ValaxyMd :frontmatter="frontmatter">
30
+ <slot name="main-content-md" />
31
+ <slot />
32
+ </ValaxyMd>
33
+ </slot>
34
+
35
+ <slot name="main-content-after" />
36
+ </div>
37
+ </YunCard>
38
+
39
+ <slot name="main-nav-before" />
40
+
41
+ <slot name="main-nav">
42
+ <YunPostNav v-if="frontmatter.nav !== false" />
43
+ </slot>
44
+
45
+ <slot name="main-nav-after" />
46
+
47
+ <slot v-if="frontmatter.comment !== false" name="comment">
48
+ <YunCard w="full" p="4" class="comment sm:p-6 lg:px-12 xl:px-16" :class="frontmatter.nav === false ? 'mt-4' : 0">
49
+ <YunWaline v-if="config.comment.waline.enable" />
50
+ <YunTwikoo v-if="config.comment.twikoo.enable" />
51
+ </YunCard>
52
+ </slot>
53
+
54
+ <ValaxyFooter>
55
+ <slot name="footer" />
56
+ </ValaxyFooter>
57
+ </div>
58
+ </slot>
59
+
60
+ <slot name="aside">
61
+ <YunAside :frontmatter="frontmatter" :data="data">
62
+ <slot name="aside-custom" />
63
+ </YunAside>
64
+ </slot>
65
+ </div>
66
+ </main>
67
+ </template>
68
+
69
+ <style lang="scss">
70
+ @use '~/styles/mixins' as *;
71
+ @include xl {
72
+ .content{
73
+ // 8px scrollbar width
74
+ max-width: calc(100vw - 2 * var(--va-sidebar-width-mobile) - 1rem - 8px);
75
+ }
76
+ }
77
+ </style>
@@ -142,6 +142,9 @@ function getRelativePath(absoluteUrl: string) {
142
142
  .dark .DocSearch {
143
143
  --docsearch-modal-shadow: none;
144
144
  --docsearch-footer-shadow: none;
145
+ --docsearch-logo-color: var(--va-c-text-2);
146
+ --docsearch-hit-background: var(--va-c-bg-mute);
147
+ --docsearch-hit-color: var(--va-c-text-2);
145
148
  --docsearch-hit-shadow: none;
146
149
  }
147
150
 
@@ -1,10 +1,10 @@
1
1
  <script lang="ts" setup>
2
2
  import { useI18n } from 'vue-i18n'
3
- import type { Post } from 'valaxy'
3
+ import type { PageData, Post } from 'valaxy'
4
4
  import { useAppStore } from 'valaxy/client/stores/app'
5
- defineProps<{ frontmatter: Post }>()
6
- const { t } = useI18n()
7
5
 
6
+ defineProps<{ frontmatter: Post; data: PageData }>()
7
+ const { t } = useI18n()
8
8
  const app = useAppStore()
9
9
  </script>
10
10
 
@@ -19,17 +19,19 @@ const app = useAppStore()
19
19
 
20
20
  <ValaxyOverlay :show="app.isRightSidebarOpen" @click="app.toggleRightSidebar()" />
21
21
 
22
- <aside class="right-sidebar fixed va-card" :class="app.isRightSidebarOpen && 'open'" m="l-4" text="center">
23
- <h2 v-if="frontmatter.toc !== false" m="t-6 b-2" font="serif black">
24
- {{ t('sidebar.toc') }}
25
- </h2>
22
+ <!-- -->
23
+ <aside class="va-card aside" :class="app.isRightSidebarOpen && 'open'" m="l-4" text="center">
24
+ <div class="aside-container" flex="~ col">
25
+ <h2 v-if="frontmatter.toc !== false" m="t-6 b-2" font="serif black">
26
+ {{ t('sidebar.toc') }}
27
+ </h2>
28
+
29
+ <YunToc v-if="frontmatter.toc !== false" :headers="data.headers || []" />
26
30
 
27
- <div class="right-sidebar-container">
28
- <!-- <ValaxyToc v-if="frontmatter.toc !== false" /> -->
29
- <YunToc v-if="frontmatter.toc !== false" />
31
+ <div class="flex-grow" />
30
32
 
31
- <div v-if="$slots.custom" class="custom-container">
32
- <slot name="custom" />
33
+ <div v-if="$slots.default" class="custom-container">
34
+ <slot />
33
35
  </div>
34
36
  </div>
35
37
  </aside>
@@ -38,19 +40,13 @@ const app = useAppStore()
38
40
  <style lang="scss">
39
41
  @use '~/styles/mixins' as *;
40
42
 
41
- @include xl {
42
- .right-sidebar {
43
- transform: translateX(0) !important;
44
- }
45
- }
46
-
47
- .right-sidebar {
48
- width: var(--va-sidebar-width-mobile);
49
-
43
+ .aside {
50
44
  position: fixed;
45
+ right: 0;
51
46
  top: 0;
52
47
  bottom: 0;
53
- right: 0;
48
+
49
+ min-width: var(--va-sidebar-width-mobile);
54
50
 
55
51
  transform: translateX(100%);
56
52
 
@@ -59,12 +55,23 @@ const app = useAppStore()
59
55
  transform var(--va-transition-duration) cubic-bezier(0.19, 1, 0.22, 1);
60
56
 
61
57
  &.open {
58
+ right: 0;
59
+ display: block;
62
60
  z-index: 10;
63
61
  transform: translateX(0);
64
62
  }
63
+
64
+ &-container {
65
+ position: sticky;
66
+ top: 0;
67
+ height: 100vh;
68
+ }
65
69
  }
66
- .right-sidebar-container {
67
- top: 1rem;
70
+
71
+ @include xl {
72
+ .aside {
73
+ transform: translateX(0);
74
+ }
68
75
  }
69
76
 
70
77
  .toc-btn {
@@ -4,7 +4,7 @@ defineProps<{ cover?: string }>()
4
4
 
5
5
  <template>
6
6
  <div class="yun-card">
7
- <img v-if="cover" class="object-cover" h="64 md:sm" w="full" :src="cover">
7
+ <img v-if="cover" class="object-cover select-none" h="64 md:sm" w="full" :src="cover">
8
8
 
9
9
  <div v-if="$slots.header" class="yun-card-header">
10
10
  <header>
@@ -1,13 +1,18 @@
1
1
  <script lang="ts" setup>
2
2
  import { useI18n } from 'vue-i18n'
3
+ import { computed } from 'vue'
3
4
  import { isDark, toggleDark } from '~/composables'
4
5
 
5
6
  const { t } = useI18n()
7
+
8
+ const themeTitle = computed(() => {
9
+ return isDark.value ? t('button.toggle_light') : t('button.toggle_dark')
10
+ })
6
11
  </script>
7
12
 
8
13
  <template>
9
14
  <div>
10
- <button class="yun-icon-btn" :title="t('button.toggle_dark')" :style="{ color: isDark ? '' : '#f1cb64' }" @click="toggleDark()">
15
+ <button class="yun-icon-btn" :title="themeTitle" :style="{ color: isDark ? '' : '#f1cb64' }" @click="toggleDark()">
11
16
  <div i="ri-sun-line dark:ri-moon-line" />
12
17
  </button>
13
18
 
@@ -1,21 +1,19 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, ref } from 'vue'
3
- import { useRoute } from 'vue-router'
4
3
  import { useI18n } from 'vue-i18n'
4
+ import type { Header } from 'valaxy'
5
+ import { useThemeConfig } from 'valaxy'
5
6
  import { useFrontmatter } from '~/composables'
6
7
  import {
7
8
  resolveHeaders,
8
9
  useActiveAnchor,
9
- useOutline,
10
10
  } from '~/composables/outline'
11
- import { useThemeConfig } from '~/config'
12
11
 
13
- const route = useRoute()
12
+ const props = defineProps<{ headers: Header[] }>()
13
+
14
14
  const frontmatter = useFrontmatter()
15
15
  const themeConfig = useThemeConfig()
16
16
 
17
- const { hasOutline } = useOutline()
18
-
19
17
  const { locale } = useI18n()
20
18
  const container = ref()
21
19
  const marker = ref()
@@ -23,7 +21,7 @@ const marker = ref()
23
21
  useActiveAnchor(container, marker)
24
22
 
25
23
  const resolvedHeaders = computed(() => {
26
- return resolveHeaders(route.meta.headers || [])
24
+ return resolveHeaders(props.headers || [])
27
25
  })
28
26
 
29
27
  function handleClick({ target: el }: Event) {
@@ -34,7 +32,7 @@ function handleClick({ target: el }: Event) {
34
32
  </script>
35
33
 
36
34
  <template>
37
- <div ref="container" class="VPDocAsideOutline" :class="{ 'has-outline': hasOutline }">
35
+ <div v-show="headers.length" ref="container">
38
36
  <div class="content">
39
37
  <div class="outline-title">
40
38
  {{ themeConfig.outlineTitle || 'On this page' }}
@@ -47,7 +45,7 @@ function handleClick({ target: el }: Event) {
47
45
  Table of Contents for current page
48
46
  </span>
49
47
 
50
- <ul class="root va-toc">
48
+ <ul class="va-toc relative z-1">
51
49
  <li
52
50
  v-for="{ text, link, children, hidden, lang } in resolvedHeaders"
53
51
  v-show="!hidden"
@@ -59,9 +57,9 @@ function handleClick({ target: el }: Event) {
59
57
  {{ text }}
60
58
  </a>
61
59
  <ul v-if="children && frontmatter.outline === 'deep'">
62
- <li v-for="{ text, link, hidden } in children" v-show="!hidden" :key="link" :lang="lang || locale">
63
- <a class="outline-link nested" :href="link" @click="handleClick">
64
- {{ text }}
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 }}
65
63
  </a>
66
64
  </li>
67
65
  </ul>
@@ -81,14 +79,6 @@ function handleClick({ target: el }: Event) {
81
79
  }
82
80
  }
83
81
 
84
- .VPDocAsideOutline {
85
- display: none;
86
- }
87
-
88
- .VPDocAsideOutline.has-outline {
89
- display: block;
90
- }
91
-
92
82
  .content {
93
83
  position: relative;
94
84
  padding-left: 16px;
@@ -120,7 +110,7 @@ function handleClick({ target: el }: Event) {
120
110
  .outline-link {
121
111
  display: block;
122
112
  line-height: 28px;
123
- color: var(--vp-c-text-2);
113
+ color: var(--va-c-text-2);
124
114
  white-space: nowrap;
125
115
  overflow: hidden;
126
116
  text-overflow: ellipsis;
@@ -133,15 +123,6 @@ function handleClick({ target: el }: Event) {
133
123
  transition: color 0.25s;
134
124
  }
135
125
 
136
- .outline-link.nested {
137
- padding-left: 13px;
138
- }
139
-
140
- .root {
141
- position: relative;
142
- z-index: 1;
143
- }
144
-
145
126
  .visually-hidden {
146
127
  position: absolute;
147
128
  width: 1px;
package/layouts/404.vue CHANGED
@@ -7,7 +7,7 @@ const { t } = useI18n()
7
7
  </script>
8
8
 
9
9
  <template>
10
- <YunBase>
10
+ <Base>
11
11
  <template #content>
12
12
  <div text="center">
13
13
  <div text-4xl>
@@ -21,5 +21,5 @@ const { t } = useI18n()
21
21
  </div>
22
22
  </div>
23
23
  </template>
24
- </YunBase>
24
+ </Base>
25
25
  </template>
@@ -11,13 +11,13 @@ const title = usePostTitle(frontmatter)
11
11
  </script>
12
12
 
13
13
  <template>
14
- <YunBase>
15
- <template #header>
14
+ <Base>
15
+ <template #main-header>
16
16
  <YunPageHeader :title="title || t('menu.archives')" :icon="frontmatter.icon || 'i-ri-archive-line'" :color="frontmatter.color" />
17
17
  </template>
18
- <template #content>
18
+ <template #main-content>
19
19
  <router-view />
20
20
  <YunPostCollapse :posts="postList" />
21
21
  </template>
22
- </YunBase>
22
+ </Base>
23
23
  </template>
package/layouts/base.vue CHANGED
@@ -1,14 +1,14 @@
1
1
  <script lang="ts" setup>
2
- import { useConfig, useFrontmatter, usePostProperty, usePostTitle } from 'valaxy'
3
- const frontmatter = useFrontmatter()
2
+ import { useConfig } from 'valaxy'
4
3
 
5
4
  const config = useConfig()
6
-
7
- const { styles, icon, color } = usePostProperty(frontmatter.value.type)
8
- const title = usePostTitle(frontmatter)
9
5
  </script>
10
6
 
11
7
  <template>
8
+ <slot name="bg">
9
+ <ValaxyBg v-if="config.themeConfig.bg_image.enable" />
10
+ </slot>
11
+
12
12
  <ValaxySidebar>
13
13
  <slot name="sidebar">
14
14
  <YunSidebar v-if="$slots['sidebar-child']">
@@ -18,61 +18,40 @@ const title = usePostTitle(frontmatter)
18
18
  </slot>
19
19
  </ValaxySidebar>
20
20
 
21
- <main class="yun-main flex lt-md:ml-0">
22
- <div flex="~ 1 col" w="full" p="l-4 lt-md:0" class="content">
23
- <YunCard :cover="frontmatter.cover" m="0" class="relative" :style="styles">
24
- <slot name="header">
25
- <YunPageHeader :title="title" :icon="frontmatter.icon || icon" :color="frontmatter.color || color" :cover="frontmatter.cover" />
26
- </slot>
27
-
28
- <template #content>
29
- <div p="x-4 b-8" class="sm:px-6 lg:px-12 xl:px-16">
30
- <slot name="content">
31
- <router-view />
32
- </slot>
33
- </div>
34
- </template>
35
- </YunCard>
36
-
37
- <slot :frontmatter="frontmatter" />
38
-
39
- <slot name="nav">
40
- <YunPostNav v-if="frontmatter.nav !== false" />
41
- </slot>
42
-
43
- <slot v-if="frontmatter.comment !== false" name="comment">
44
- <YunCard w="full" p="4" class="comment sm:p-6 lg:px-12 xl:px-16" :class="frontmatter.nav === false ? 'mt-4' : 0">
45
- <YunWaline v-if="config.comment.waline.enable" />
46
- <YunTwikoo v-if="config.comment.twikoo.enable" />
47
- </YunCard>
48
- </slot>
49
-
50
- <ValaxyFooter>
21
+ <router-view v-slot="{ Component }">
22
+ <component :is="Component">
23
+ <template #main-header>
24
+ <slot name="main-header" />
25
+ </template>
26
+
27
+ <template #main-header-after>
28
+ <slot name="main-header-after" />
29
+ </template>
30
+ <template #main>
31
+ <slot name="main" />
32
+ </template>
33
+ <template #main-content>
34
+ <slot name="main-content" />
35
+ </template>
36
+ <template #main-content-after>
37
+ <slot name="main-content-after" />
38
+ </template>
39
+ <template #main-nav-before>
40
+ <slot name="main-nav-before" />
41
+ </template>
42
+ <template #main-nav-after>
43
+ <slot name="main-nav-after" />
44
+ </template>
45
+ <template #aside-custom>
46
+ <slot name="aside-custom" />
47
+ </template>
48
+ <template #footer>
51
49
  <slot name="footer" />
52
- </ValaxyFooter>
53
- </div>
54
-
55
- <slot name="right-sidebar">
56
- <!-- <ValaxyRightSidebar > -->
57
- <YunAside :frontmatter="frontmatter">
58
- <template #custom>
59
- <slot name="right-custom" />
60
- </template>
61
- <!-- </ValaxyRightSidebar> -->
62
- </YunAside>
63
- </slot>
64
- </main>
50
+ </template>
51
+ </component>
52
+ </router-view>
65
53
 
66
54
  <YunSearch v-if="config.search.enable" />
67
55
  <YunBackToTop />
68
56
  </template>
69
57
 
70
- <style lang="scss">
71
- @use '~/styles/mixins' as *;
72
- @include xl {
73
- .content{
74
- // 8px scrollbar width
75
- max-width: calc(100vw - 2 * var(--va-sidebar-width-mobile) - 1rem - 8px);
76
- }
77
- }
78
- </style>
@@ -46,15 +46,15 @@ const title = usePostTitle(frontmatter)
46
46
  </script>
47
47
 
48
48
  <template>
49
- <YunBase>
50
- <template #header>
49
+ <Base>
50
+ <template #main-header>
51
51
  <YunPageHeader
52
52
  :title="title || t('menu.categories')"
53
53
  :icon="frontmatter.icon || 'i-ri-folder-2-line'"
54
54
  :color="frontmatter.color"
55
55
  />
56
56
  </template>
57
- <template #content>
57
+ <template #main-content>
58
58
  <div text="center" class="yun-text-light" p="2">
59
59
  {{ t('counter.categories', categories.children!.size) }}
60
60
  </div>
@@ -62,9 +62,11 @@ const title = usePostTitle(frontmatter)
62
62
  <router-view />
63
63
  </template>
64
64
 
65
- <YunCard v-if="curCategory" ref="collapse" m="t-4" w="full">
66
- <YunPageHeader :title="curCategory === 'Uncategorized' ? t('category.uncategorized') : curCategory" icon="i-ri-folder-open-line" />
67
- <YunPostCollapse w="full" m="b-4" p="x-20 lt-sm:x-5" :posts="posts" />
68
- </YunCard>
69
- </YunBase>
65
+ <template #main-nav-before>
66
+ <YunCard v-if="curCategory" ref="collapse" m="t-4" w="full">
67
+ <YunPageHeader :title="curCategory === 'Uncategorized' ? t('category.uncategorized') : curCategory" icon="i-ri-folder-open-line" />
68
+ <YunPostCollapse w="full" m="b-4" p="x-20 lt-sm:x-5" :posts="posts" />
69
+ </YunCard>
70
+ </template>
71
+ </Base>
70
72
  </template>
@@ -1,7 +1,7 @@
1
1
  <template>
2
- <YunBase>
2
+ <Base>
3
3
  <template #content>
4
4
  <router-view />
5
5
  </template>
6
- </YunBase>
6
+ </Base>
7
7
  </template>
package/layouts/post.vue CHANGED
@@ -15,20 +15,18 @@ const showSponsor = computed(() => {
15
15
  </script>
16
16
 
17
17
  <template>
18
- <YunBase>
19
- <template #content>
20
- <main text="left" m="auto" p="t-0 b-2">
21
- <slot name="header">
22
- <YunPostMeta :frontmatter="frontmatter" />
23
- </slot>
24
- <router-view v-slot="{ Component }">
25
- <Transition appear>
26
- <component :is="Component" />
27
- </Transition>
28
- </router-view>
29
- <YunSponsor v-if="showSponsor" />
30
- <ValaxyCopyright v-if="frontmatter.copyright || config.license.enabled" :url="url" m="y-4" />
31
- </main>
18
+ <Base>
19
+ <template #main-header-after>
20
+ <YunPostMeta :frontmatter="frontmatter" />
32
21
  </template>
33
- </YunBase>
22
+
23
+ <template #main-content-after>
24
+ <YunSponsor v-if="showSponsor" />
25
+ <ValaxyCopyright v-if="frontmatter.copyright || config.license.enabled" :url="url" m="y-4" />
26
+ </template>
27
+
28
+ <template #aside-custom>
29
+ <slot name="aside-custom" />
30
+ </template>
31
+ </Base>
34
32
  </template>
package/layouts/tags.vue CHANGED
@@ -48,15 +48,15 @@ const title = usePostTitle(frontmatter)
48
48
  </script>
49
49
 
50
50
  <template>
51
- <YunBase>
52
- <template #header>
51
+ <Base>
52
+ <template #main-header>
53
53
  <YunPageHeader
54
54
  :title="title || t('menu.tags')"
55
55
  :icon="frontmatter.icon || 'i-ri-tag-line'"
56
56
  :color="frontmatter.color"
57
57
  />
58
58
  </template>
59
- <template #content>
59
+ <template #main-content>
60
60
  <div class="yun-text-light" text="center" p="2">
61
61
  {{ t('counter.tags', Array.from(tags).length) }}
62
62
  </div>
@@ -70,11 +70,13 @@ const title = usePostTitle(frontmatter)
70
70
  <router-view />
71
71
  </template>
72
72
 
73
- <YunCard v-if="curTag" ref="collapse" m="t-4" w="full">
74
- <YunPageHeader :title="curTag" icon="i-ri-hashtag" />
75
- <YunPostCollapse w="full" m="b-4" p="x-20 lt-sm:x-5" :posts="posts" />
76
- </YunCard>
77
- </YunBase>
73
+ <template #main-nav-before>
74
+ <YunCard v-if="curTag" ref="collapse" m="t-4" w="full">
75
+ <YunPageHeader :title="curTag" icon="i-ri-hashtag" />
76
+ <YunPostCollapse w="full" m="b-4" p="x-20 lt-sm:x-5" :posts="posts" />
77
+ </YunCard>
78
+ </template>
79
+ </Base>
78
80
  </template>
79
81
 
80
82
  <style lang="scss">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valaxy-theme-yun",
3
- "version": "0.6.0",
3
+ "version": "0.6.3",
4
4
  "author": {
5
5
  "email": "me@yunyoujun.cn",
6
6
  "name": "YunYouJun",
@@ -18,7 +18,7 @@
18
18
  "@iconify-json/simple-icons": "^1.1.16"
19
19
  },
20
20
  "devDependencies": {
21
- "valaxy": "0.6.0"
21
+ "valaxy": "0.6.3"
22
22
  },
23
23
  "scripts": {
24
24
  "build": "tsup",
@@ -4,4 +4,5 @@
4
4
  .yun-main {
5
5
  padding-left: var(--va-sidebar-width-mobile);
6
6
  transition: padding-left var(--va-transition-duration);
7
+ box-sizing: border-box;
7
8
  }
@@ -11,6 +11,9 @@ html.dark {
11
11
  }
12
12
 
13
13
  .markdown-body {
14
+ word-wrap: break-word;
15
+ word-break: break-all;
16
+
14
17
  h1,
15
18
  h2,
16
19
  h3,
@@ -1,32 +0,0 @@
1
- <script setup lang="ts">
2
- // export layouts/base.vue as components
3
- import { useThemeConfig } from 'valaxy'
4
- import Base from '../layouts/base.vue'
5
-
6
- const themeConfig = useThemeConfig()
7
- </script>
8
-
9
- <template>
10
- <ValaxyBg v-if="themeConfig.bg_image.enable" />
11
-
12
- <Base>
13
- <template #sidebar>
14
- <slot name="sidebar" />
15
- </template>
16
- <template #content>
17
- <slot name="content" />
18
- </template>
19
- <template #nav>
20
- <slot name="nav" />
21
- </template>
22
- <template #comment>
23
- <slot name="comment" />
24
- </template>
25
- <template #footer>
26
- <slot name="footer" />
27
- </template>
28
- <template #right-sidebar>
29
- <slot name="right-sidebar" />
30
- </template>
31
- </Base>
32
- </template>