valaxy-theme-yun 0.1.1 → 0.2.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.
Files changed (41) hide show
  1. package/components/YunAlgoliaSearch.vue +10 -10
  2. package/components/YunBackToTop.vue +2 -3
  3. package/components/YunBase.vue +3 -0
  4. package/components/YunBoard.vue +23 -0
  5. package/components/YunCard.vue +1 -1
  6. package/components/YunCategories.vue +12 -7
  7. package/components/YunCategory.vue +25 -13
  8. package/components/YunConfig.vue +2 -10
  9. package/components/YunGirls.vue +2 -3
  10. package/components/YunGoDown.vue +3 -3
  11. package/components/YunOverview.vue +113 -0
  12. package/components/YunPostCollapse.vue +10 -10
  13. package/components/YunPostMeta.vue +23 -1
  14. package/components/YunPostNav.vue +2 -2
  15. package/components/YunSay.vue +6 -5
  16. package/components/YunSidebar.vue +24 -96
  17. package/components/YunSidebarNav.vue +8 -7
  18. package/components/YunSponsor.vue +3 -6
  19. package/components/YunToggleLocale.vue +25 -0
  20. package/components/YunTwikoo.vue +14 -0
  21. package/components/YunWaline.vue +3 -5
  22. package/composables/index.ts +6 -3
  23. package/config/index.ts +62 -4
  24. package/dist/index.d.ts +35 -1
  25. package/dist/index.js +1 -1
  26. package/dist/index.mjs +1 -1
  27. package/index.ts +31 -0
  28. package/layouts/archives.vue +4 -2
  29. package/layouts/base.vue +16 -7
  30. package/layouts/categories.vue +4 -2
  31. package/layouts/home.vue +11 -2
  32. package/layouts/post.vue +5 -1
  33. package/layouts/tags.vue +9 -4
  34. package/locales/en.yml +1 -0
  35. package/locales/zh-CN.yml +1 -0
  36. package/package.json +3 -3
  37. package/styles/css-vars.scss +17 -0
  38. package/styles/layout/index.scss +2 -2
  39. package/styles/layout/post.scss +10 -18
  40. package/styles/markdown.scss +14 -16
  41. package/styles/vars.scss +32 -6
@@ -60,8 +60,8 @@ watch(showPopup, () => {
60
60
  top: 0.6rem;
61
61
  right: 0.8rem;
62
62
 
63
- color: var(--yun-c-primary);
64
- z-index: map.get($z-index, 'search-btn');
63
+ color: var(--va-c-primary);
64
+ z-index: var(--yun-z-search-btn);
65
65
  }
66
66
 
67
67
  .search-popup {
@@ -77,7 +77,7 @@ watch(showPopup, () => {
77
77
  text-align: center;
78
78
  padding-top: 3.5rem;
79
79
  margin: 0;
80
- z-index: map.get($z-index, 'search-popup');
80
+ z-index: var(--yun-z-search-popup);
81
81
  transition: 0.6s;
82
82
  }
83
83
 
@@ -91,15 +91,15 @@ watch(showPopup, () => {
91
91
 
92
92
  .search-input {
93
93
  background: transparent;
94
- color: var(--yun-c-text);
94
+ color: var(--va-c-text);
95
95
  font-size: 1.5rem;
96
96
  border-radius: 3rem;
97
97
  padding: 1rem 1.5rem;
98
- border: 1px solid var(--yun-c-gray);
98
+ border: 1px solid var(--va-c-gray);
99
99
  box-sizing: border-box;
100
100
  width: 90%;
101
101
  max-width: 800px;
102
- font-family: var(--yun-font-serif);
102
+ font-family: var(--va-font-serif);
103
103
  font-weight: 900;
104
104
  text-align: center;
105
105
  }
@@ -169,13 +169,13 @@ watch(showPopup, () => {
169
169
  width: 100%;
170
170
  padding: 0.5rem;
171
171
  border-bottom: 1px dashed #ccc;
172
- font-family: var(--yun-font-serif);
172
+ font-family: var(--va-font-serif);
173
173
  font-weight: 900;
174
174
  font-size: 1.2rem;
175
175
  max-width: 800px;
176
176
 
177
177
  mark {
178
- color: var(--yun-c-danger);
178
+ color: var(--va-c-danger);
179
179
  font-family: 900;
180
180
  background-color: transparent;
181
181
  text-decoration: underline;
@@ -185,7 +185,7 @@ watch(showPopup, () => {
185
185
  display: flex;
186
186
  font-size: 12px;
187
187
  justify-content: center;
188
- font-family: var(--yun-font-sans);
188
+ font-family: var(--va-font-sans);
189
189
  font-weight: normal;
190
190
  line-height: 1;
191
191
  margin-top: -0.2rem;
@@ -215,7 +215,7 @@ watch(showPopup, () => {
215
215
  .active {
216
216
  .page-number {
217
217
  background: var(--page-btn-active-bg-color);
218
- color: var(--yun-c-bg);
218
+ color: var(--va-c-bg);
219
219
  }
220
220
  }
221
221
  }
@@ -25,16 +25,15 @@ const strokeOffset = computed(() => {
25
25
 
26
26
  <style lang="scss">
27
27
  @use "sass:map";
28
- @use "~/styles/vars" as *;
29
28
 
30
29
  .back-to-top {
31
30
  position: relative;
32
31
  position: fixed;
33
32
  right: -0.9rem;
34
33
  bottom: 1.1rem;
35
- z-index: map.get($z-index, 'go-up-btn');
34
+ z-index: var(--yun-z-go-up-btn);
36
35
  opacity: 0;
37
- color: var(--yun-c-primary);
36
+ color: var(--va-c-primary);
38
37
 
39
38
  &.show {
40
39
  transform: translateX(-30px) rotate(360deg);
@@ -5,6 +5,9 @@ import Base from '../layouts/base.vue'
5
5
 
6
6
  <template>
7
7
  <Base>
8
+ <template #sidebar>
9
+ <slot name="sidebar" />
10
+ </template>
8
11
  <template #content>
9
12
  <slot name="content" />
10
13
  </template>
@@ -0,0 +1,23 @@
1
+ <template>
2
+ <div class="yun-board">
3
+ <slot />
4
+ </div>
5
+ </template>
6
+
7
+ <style>
8
+ .yun-board {
9
+ border: 1px solid var(--va-c-text);
10
+ width: calc(100% - 2rem);
11
+
12
+ display: flex;
13
+ flex-direction: column;
14
+ justify-content: center;
15
+ align-items: center;
16
+ font-family: var(--va-font-serif);
17
+ font-weight: bold;
18
+ padding: 1rem;
19
+ margin: 1rem auto;
20
+ max-width: var(--yun-post-card-max-width);
21
+ background-color: rgba(200, 200, 200, 0.1);
22
+ }
23
+ </style>
@@ -24,6 +24,6 @@
24
24
  margin: auto;
25
25
 
26
26
  // todo
27
- background-color: var(--yun-c-bg-light);
27
+ background-color: var(--va-c-bg-light);
28
28
  }
29
29
  </style>
@@ -1,31 +1,36 @@
1
1
  <script lang="ts" setup>
2
2
  import type { Categories } from 'valaxy'
3
+ import { ref } from 'vue'
3
4
 
4
- withDefaults(defineProps<{
5
+ const props = withDefaults(defineProps<{
5
6
  categories: Categories
6
7
  /**
7
8
  * 当前层级
8
9
  */
9
10
  level?: number
10
- displayCategory: (category: string) => void
11
+ displayCategory?: (category: string) => void
12
+ collapsable?: boolean
11
13
  }>(), {
12
14
  level: 0,
15
+ collapsable: true,
13
16
  })
17
+
18
+ const collapsable = ref(props.collapsable)
14
19
  </script>
15
20
 
16
21
  <template>
17
22
  <ul v-for="category, key in Object.fromEntries(categories)" :key="key" class="category-list" m="l-4">
18
- <YunCategory :name="key.toString()" :category="category" :level="level + 1" :display-category="displayCategory" />
23
+ <YunCategory :name="key.toString()" :category="category" :level="level + 1" :display-category="displayCategory" :collapsable="collapsable" />
19
24
  </ul>
20
25
  </template>
21
26
 
22
27
  <style lang="scss">
23
28
  .post-list-item {
24
29
  a {
25
- color: var(--yun-c-text);
30
+ color: var(--va-c-text);
26
31
 
27
32
  &:hover {
28
- color: var(--yun-c-primary);
33
+ color: var(--va-c-primary);
29
34
  }
30
35
  }
31
36
  }
@@ -33,12 +38,12 @@ withDefaults(defineProps<{
33
38
  .category-list-item {
34
39
  .folder-action {
35
40
  &:hover {
36
- color: var(--yun-c-primary);
41
+ color: var(--va-c-primary);
37
42
  }
38
43
  }
39
44
  .category-name {
40
45
  &:hover {
41
- color: var(--yun-c-primary);
46
+ color: var(--va-c-primary);
42
47
  }
43
48
  }
44
49
  }
@@ -1,39 +1,51 @@
1
1
  <script lang="ts" setup>
2
2
  import { ref } from 'vue'
3
- import type { Category, ParentCategory, PostCategory } from 'valaxy'
3
+ import type { Category, ParentCategory, Post, PostCategory } from 'valaxy'
4
4
  import { useI18n } from 'vue-i18n'
5
5
 
6
- defineProps<{
6
+ const props = withDefaults(defineProps<{
7
7
  name: string
8
8
  // to eliminate the warning
9
9
  category: Category
10
10
  level?: number
11
- displayCategory: (category: string) => void
12
- }>()
11
+ displayCategory?: (category: string) => void
13
12
 
14
- const showChild = ref(false)
15
- const { t } = useI18n()
13
+ /**
14
+ * collapse children
15
+ */
16
+ collapsable?: boolean
17
+ }>(), {
18
+ collapsable: true,
19
+ })
20
+
21
+ const collapsable = ref(props.collapsable)
22
+ const { t, locale } = useI18n()
23
+ const lang = locale.value === 'zh-CN' ? 'zh' : locale.value
24
+
25
+ const getTitle = (post: Post | any) => {
26
+ return post[`title_${lang}`] ? post[`title_${lang}`] : post.title
27
+ }
16
28
  </script>
17
29
 
18
30
  <template>
19
31
  <li v-if="category.total" class="category-list-item inline-flex items-center cursor-pointer">
20
- <span class="folder-action inline-flex" @click="showChild = !showChild">
21
- <div v-if="!showChild" i-ri-folder-add-line />
22
- <div v-else style="color:var(--yun-c-primary)" i-ri-folder-reduce-line /></span>
23
- <span class="category-name" m="l-1" @click="displayCategory(name)">
32
+ <span class="folder-action inline-flex" @click="collapsable = !collapsable">
33
+ <div v-if="collapsable" i-ri-folder-add-line />
34
+ <div v-else style="color:var(--va-c-primary)" i-ri-folder-reduce-line /></span>
35
+ <span class="category-name" m="l-1" @click="displayCategory ? displayCategory(name) : null">
24
36
  {{ name === 'Uncategorized' ? t('category.uncategorized') : name }} [{{ category.total }}]
25
37
  </span>
26
38
  </li>
27
39
 
28
- <template v-if="showChild">
40
+ <template v-if="!collapsable">
29
41
  <ul v-if="(category as PostCategory).posts">
30
42
  <li v-for="post, i in (category as PostCategory).posts" :key="i" class="post-list-item" m="l-4">
31
43
  <router-link v-if="post.title" :to="post.path" class="inline-flex items-center">
32
44
  <div i-ri-file-text-line />
33
- <span m="l-1" font="serif black">{{ post.title }}</span>
45
+ <span m="l-1" font="serif black">{{ getTitle(post) }}</span>
34
46
  </router-link>
35
47
  </li>
36
48
  </ul>
37
- <YunCategories v-else :categories="(category as ParentCategory).children" :display-category="displayCategory" />
49
+ <YunCategories v-else :categories="(category as ParentCategory).children" :display-category="displayCategory" :collapsable="collapsable" />
38
50
  </template>
39
51
  </template>
@@ -2,13 +2,7 @@
2
2
  import { useI18n } from 'vue-i18n'
3
3
  import { isDark, toggleDark } from '~/composables'
4
4
 
5
- const { t, availableLocales, locale } = useI18n()
6
-
7
- const toggleLocales = () => {
8
- // change to some real logic
9
- const locales = availableLocales
10
- locale.value = locales[(locales.indexOf(locale.value) + 1) % locales.length]
11
- }
5
+ const { t } = useI18n()
12
6
  </script>
13
7
 
14
8
  <template>
@@ -17,8 +11,6 @@ const toggleLocales = () => {
17
11
  <div i="ri-sun-line dark:ri-moon-line" />
18
12
  </button>
19
13
 
20
- <button class="yun-icon-btn" :title="t('button.toggle_langs')" style="color:var(--yun-c-text)" @click="toggleLocales">
21
- <div i-ri-translate class="transition transform" :class="locale === 'en' ? 'rotate-y-180' : ''" />
22
- </button>
14
+ <YunToggleLocale />
23
15
  </div>
24
16
  </template>
@@ -1,4 +1,3 @@
1
-
2
1
  <script lang="ts" setup>
3
2
  import { useRandomData } from 'valaxy-theme-yun/composables'
4
3
  import { onImgError } from '../utils'
@@ -87,9 +86,9 @@ const { data } = useRandomData(props.girls, props.random)
87
86
 
88
87
  &-from {
89
88
  font-size: 12px;
90
- font-family: var(--yun-font-serif);
89
+ font-family: var(--va-font-serif);
91
90
  font-weight: bold;
92
- color: var(--yun-c-text-light);
91
+ color: var(--va-c-text-light);
93
92
 
94
93
  &::before {
95
94
  content: '「';
@@ -18,12 +18,12 @@
18
18
  animation: float 2s ease-in-out infinite;
19
19
 
20
20
  font-size: 2.5rem;
21
- color: var(--yun-c-primary);
21
+ color: var(--va-c-primary);
22
22
 
23
- transition: color var(--yun-transition-duration);
23
+ transition: color var(--va-transition-duration);
24
24
 
25
25
  &:hover {
26
- color: rgba(var(--yun-c-primary-rgb), 0.6);
26
+ color: rgba(var(--va-c-primary-rgb), 0.6);
27
27
  }
28
28
  }
29
29
 
@@ -0,0 +1,113 @@
1
+ <script lang="ts" setup>
2
+ import { useConfig } from 'valaxy'
3
+ import { useRouter } from 'vue-router'
4
+
5
+ const config = useConfig()
6
+ const router = useRouter()
7
+ </script>
8
+
9
+ <template>
10
+ <div class="sidebar-panel">
11
+ <div class="site-info" m="t-6">
12
+ <a class="site-author-avatar" href="/about">
13
+ <img class="rounded-full" :src="config.author.avatar" alt="avatar">
14
+ <span class="site-author-status">{{ config.author.status.emoji }}</span>
15
+ </a>
16
+ <div class="site-author-name">
17
+ <a href="/about">
18
+ {{ config.author.name }}
19
+ </a>
20
+ </div>
21
+ <router-link v-if="router.hasRoute('about-site')" to="/about/site" class="site-name">
22
+ {{ config.title }}
23
+ </router-link>
24
+ <span v-else class="site-name">{{ config.title }}</span>
25
+ <h4 v-if="config.subtitle" class="site-subtitle block" text="xs">
26
+ {{ config.subtitle }}
27
+ </h4>
28
+ <div v-if="config.description" class="site-description my-1">
29
+ {{ config.description }}
30
+ </div>
31
+ </div>
32
+
33
+ <YunSidebarNav />
34
+ <hr m="t-4 b-2">
35
+ <YunSocialLinks />
36
+ <hr m="y-2">
37
+ <YunSidebarLinks />
38
+ <br>
39
+ </div>
40
+
41
+ <YunConfig />
42
+ </template>
43
+
44
+ <style lang="scss">
45
+ @use "~/styles/mixins" as *;
46
+
47
+ .sidebar-panel {
48
+ padding: 0.5rem;
49
+ }
50
+
51
+ .site-info {
52
+ &.fix-top {
53
+ margin-top: -1.5rem;
54
+ }
55
+ }
56
+
57
+ .site-author-avatar {
58
+ display: inline-block;
59
+ line-height: 0;
60
+ position: relative;
61
+
62
+ img {
63
+ height: 96px;
64
+ width: 96px;
65
+ max-width: 100%;
66
+ margin: 0px;
67
+ padding: 4px;
68
+ background-color: white;
69
+ box-shadow: 0 0 10px rgba(black, 0.2);
70
+ transition: 0.4s;
71
+
72
+ &:hover {
73
+ box-shadow: 0 0 30px rgba(var(--va-c-primary-rgb), 0.2);
74
+ }
75
+ }
76
+ }
77
+
78
+ .site-author-name {
79
+ margin-top: 0;
80
+ margin-bottom: 1rem;
81
+ line-height: 1.5;
82
+ }
83
+
84
+ .site-author-status {
85
+ position: absolute;
86
+ height: 1.8rem;
87
+ width: 1.8rem;
88
+ bottom: 0;
89
+ right: 0;
90
+ line-height: 1.8rem;
91
+ border-radius: 50%;
92
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
93
+ background-color: var(--va-c-bg-light);
94
+
95
+ border: 1px solid rgba(255, 255, 255, 0.1);
96
+ }
97
+
98
+ .site-name {
99
+ color: var(--va-c-text);
100
+ font-family: get-css-var('font-serif');
101
+ font-weight: get-css-var('font-serif-weight');
102
+ }
103
+
104
+ .site-subtitle {
105
+ color: get-css-var('c-gray');
106
+ display: block;
107
+ }
108
+
109
+ .site-description {
110
+ color: var(--va-c-text);
111
+ font-size: 0.8rem;
112
+ }
113
+ </style>
@@ -85,7 +85,7 @@ const sortedYears = computed(() => {
85
85
  .collection-title {
86
86
  position: relative;
87
87
  margin: 0;
88
- border-bottom: 2px solid rgba(var(--yun-c-primary-rgb), 0.6);
88
+ border-bottom: 2px solid rgba(var(--va-c-primary-rgb), 0.6);
89
89
 
90
90
  &::before {
91
91
  content: '';
@@ -93,11 +93,11 @@ const sortedYears = computed(() => {
93
93
  top: 50%;
94
94
  width: 2px;
95
95
  height: 50%;
96
- background: rgba(var(--yun-c-primary-rgb), 0.3);
96
+ background: rgba(var(--va-c-primary-rgb), 0.3);
97
97
  }
98
98
 
99
99
  .archive-year {
100
- color: var(--yun-c-primary);
100
+ color: var(--va-c-primary);
101
101
  margin: 0 1.5rem;
102
102
 
103
103
  &::before {
@@ -109,7 +109,7 @@ const sortedYears = computed(() => {
109
109
  margin-top: -4px;
110
110
  width: 1.5rem;
111
111
  height: 1.5rem;
112
- background: var(--yun-c-primary);
112
+ background: var(--va-c-primary);
113
113
  border-radius: 50%;
114
114
  }
115
115
  }
@@ -123,7 +123,7 @@ const sortedYears = computed(() => {
123
123
  position: absolute;
124
124
  width: 2px;
125
125
  height: 100%;
126
- background: rgba(var(--yun-c-primary-rgb), 0.3);
126
+ background: rgba(var(--va-c-primary-rgb), 0.3);
127
127
  }
128
128
  }
129
129
 
@@ -132,7 +132,7 @@ const sortedYears = computed(() => {
132
132
  align-items: center;
133
133
 
134
134
  position: relative;
135
- border-bottom: 1px solid rgba(var(--yun-c-primary-rgb), 0.3);
135
+ border-bottom: 1px solid rgba(var(--va-c-primary-rgb), 0.3);
136
136
  display: flex;
137
137
 
138
138
  &::before {
@@ -143,15 +143,15 @@ const sortedYears = computed(() => {
143
143
  height: 10px;
144
144
  margin-left: -4px;
145
145
  border-radius: 50%;
146
- border: 1px solid var(--yun-c-primary);
147
- background-color: var(--yun-c-bg-light);
146
+ border: 1px solid var(--va-c-primary);
147
+ background-color: var(--va-c-bg-light);
148
148
  z-index: 1;
149
- transition: background var(--yun-transition-duration);
149
+ transition: background var(--va-transition-duration);
150
150
  }
151
151
 
152
152
  &:hover {
153
153
  &::before {
154
- background: var(--yun-c-primary);
154
+ background: var(--va-c-primary);
155
155
  }
156
156
  }
157
157
 
@@ -11,6 +11,13 @@ defineProps<{
11
11
  </script>
12
12
 
13
13
  <template>
14
+ <div v-if="frontmatter.draft" class="post-draft-icon" title="draft">
15
+ <div i-ri-draft-line />
16
+ </div>
17
+ <div v-if="frontmatter.top" class="post-top-icon">
18
+ <div i-ri-pushpin-line />
19
+ </div>
20
+
14
21
  <div v-if="frontmatter" class="post-meta justify-center" flex="~" text="sm">
15
22
  <div v-if="frontmatter.date" class="post-time flex items-center">
16
23
  <div class="inline-block" i-ri-calendar-line />
@@ -25,5 +32,20 @@ defineProps<{
25
32
  </div>
26
33
  </template>
27
34
 
28
- <style lang="scss">
35
+ <style>
36
+ .post-draft-icon {
37
+ position: absolute;
38
+ top: 1rem;
39
+ left: 1rem;
40
+ color: var(--va-c-gray);
41
+ font-size: 1.2rem;
42
+ }
43
+
44
+ .post-top-icon {
45
+ position: absolute;
46
+ top: 1rem;
47
+ right: 1rem;
48
+ color: var(--va-c-warning);
49
+ font-size: 1.2rem;
50
+ }
29
51
  </style>
@@ -33,7 +33,7 @@ const [prev, next] = usePrevNext()
33
33
  justify-content: center;
34
34
  align-items: center;
35
35
 
36
- color: var(--yun-c-primary);
36
+ color: var(--va-c-primary);
37
37
 
38
38
  outline: none;
39
39
  font-size: 1.5rem;
@@ -44,7 +44,7 @@ const [prev, next] = usePrevNext()
44
44
  transition: 0.4s;
45
45
 
46
46
  &:hover {
47
- background-color: rgba(var(--yun-c-primary-rgb), 0.1);
47
+ background-color: rgba(var(--va-c-primary-rgb), 0.1);
48
48
  box-shadow: 0 0 15px rgba(black, 0.1);
49
49
  }
50
50
  }
@@ -13,7 +13,8 @@ const sayFrom = ref('')
13
13
  */
14
14
  function fetchApiToSay() {
15
15
  const api = themeConfig.value.say.hitokoto.enable ? themeConfig.value.say.hitokoto.api : themeConfig.value.say.api
16
- if (!api) return
16
+ if (!api)
17
+ return
17
18
 
18
19
  fetch(api)
19
20
  .then((res) => {
@@ -63,14 +64,14 @@ onMounted(() => {
63
64
 
64
65
  <style lang="scss">
65
66
  .say {
66
- color: var(--yun-c-text);
67
+ color: var(--va-c-text);
67
68
  display: block;
68
69
  text-align: center;
69
- font-family: var(--yun-font-serif);
70
+ font-family: var(--va-font-serif);
70
71
  font-weight: bold;
71
72
  padding: 0.5rem;
72
- border-top: var(--yun-border-width) solid var(--yun-c-text-light);
73
- border-bottom: var(--yun-border-width) solid var(--yun-c-text-light);
73
+ border-top: var(--va-border-width) solid var(--va-c-text-light);
74
+ border-bottom: var(--va-border-width) solid var(--va-c-text-light);
74
75
 
75
76
  .say-content {
76
77
  display: block;