valaxy-theme-yun 0.11.0 → 0.11.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.
- package/App.vue +22 -0
- package/components/ValaxyMain.vue +12 -4
- package/components/YunAside.vue +2 -3
- package/components/YunBanner.vue +2 -2
- package/components/{YunToc.vue → YunOutline.vue} +9 -42
- package/components/YunOutlineItem.vue +48 -0
- package/components/YunOverview.vue +5 -5
- package/components/YunPostCard.vue +2 -1
- package/components/YunPostCollapse.vue +2 -2
- package/components/YunSidebarLinks.vue +3 -3
- package/components/YunWaline.vue +3 -3
- package/{layouts → composables}/404.vue +0 -0
- package/composables/post.ts +13 -7
- package/layouts/home.vue +1 -8
- package/layouts/layout.vue +0 -11
- package/package.json +6 -6
- package/styles/common/markdown.scss +1 -0
- package/styles/css-vars.scss +3 -0
- package/styles/index.scss +3 -2
- package/styles/vars.scss +1 -0
- package/unocss.config.ts +13 -6
package/App.vue
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
<script lang="ts" setup>
|
2
|
+
import { useHead } from '@vueuse/head'
|
3
|
+
import { useConfig } from 'valaxy'
|
4
|
+
|
5
|
+
useHead({
|
6
|
+
link: [
|
7
|
+
{
|
8
|
+
rel: 'stylesheet',
|
9
|
+
href: 'https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@900&display=swap',
|
10
|
+
},
|
11
|
+
],
|
12
|
+
})
|
13
|
+
|
14
|
+
const config = useConfig()
|
15
|
+
</script>
|
16
|
+
|
17
|
+
<template>
|
18
|
+
<slot name="bg">
|
19
|
+
<YunBg v-if="config.themeConfig.bg_image.enable" />
|
20
|
+
</slot>
|
21
|
+
<YunSearch v-if="config.search.enable" />
|
22
|
+
</template>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import type { PageData, Post } from 'valaxy'
|
3
3
|
import { useConfig, usePostTitle } from 'valaxy'
|
4
|
-
import { computed, defineAsyncComponent } from 'vue'
|
4
|
+
import { StyleValue, computed, defineAsyncComponent } from 'vue'
|
5
5
|
import { usePostProperty } from '../composables'
|
6
6
|
|
7
7
|
const props = defineProps<{
|
@@ -15,11 +15,11 @@ const title = usePostTitle(computed(() => props.frontmatter))
|
|
15
15
|
|
16
16
|
const aside = computed(() => props.frontmatter.aside !== false)
|
17
17
|
|
18
|
-
const YunWaline = config.value.
|
18
|
+
const YunWaline = config.value.runtime.addons['valaxy-addon-waline'].enable
|
19
19
|
? defineAsyncComponent(() => import('./YunWaline.vue'))
|
20
20
|
: () => null
|
21
21
|
|
22
|
-
const YunTwikoo = config.value.
|
22
|
+
const YunTwikoo = config.value.runtime.addons['valaxy-addon-twikoo']?.enable
|
23
23
|
? defineAsyncComponent(() => import('./YunTwikoo.vue'))
|
24
24
|
: () => null
|
25
25
|
</script>
|
@@ -29,7 +29,7 @@ const YunTwikoo = config.value.comment.waline.enable
|
|
29
29
|
<div w="full" flex="~">
|
30
30
|
<slot name="main">
|
31
31
|
<div class="content" :class="!aside && 'no-aside'" flex="~ col grow" w="full" p="l-4 lt-md:0">
|
32
|
-
<YunCard :cover="frontmatter.cover" m="0" class="relative" :style="styles">
|
32
|
+
<YunCard :cover="frontmatter.cover" m="0" class="relative" :style="styles as StyleValue">
|
33
33
|
<slot name="main-header">
|
34
34
|
<YunPageHeader :title="title" :icon="frontmatter.icon || icon" :color="frontmatter.color || color" :cover="frontmatter.cover" />
|
35
35
|
</slot>
|
@@ -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
|
package/components/YunAside.vue
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import { useI18n } from 'vue-i18n'
|
3
|
-
import {
|
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
|
-
<
|
29
|
+
<YunOutline v-if="frontmatter.toc !== false" />
|
31
30
|
|
32
31
|
<div class="flex-grow" />
|
33
32
|
|
package/components/YunBanner.vue
CHANGED
@@ -56,7 +56,7 @@ const lintStyle = computed(() => (
|
|
56
56
|
// banner
|
57
57
|
--banner-line-color: black;
|
58
58
|
--banner-char-color: black;
|
59
|
-
--banner-char-bg-color: rgba(
|
59
|
+
--banner-char-bg-color: rgba(255, 255, 255, 0.5);
|
60
60
|
--banner-char-hover-color: white;
|
61
61
|
}
|
62
62
|
|
@@ -64,7 +64,7 @@ const lintStyle = computed(() => (
|
|
64
64
|
// banner
|
65
65
|
--banner-line-color: white;
|
66
66
|
--banner-char-color: white;
|
67
|
-
--banner-char-bg-color: rgba(
|
67
|
+
--banner-char-bg-color: rgba(0, 0, 0, 0.5);
|
68
68
|
--banner-char-hover-color: black;
|
69
69
|
}
|
70
70
|
</style>
|
@@ -1,34 +1,19 @@
|
|
1
1
|
<script setup lang="ts">
|
2
|
-
import {
|
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
|
-
|
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
|
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
|
-
<
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
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
|
-
<
|
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
|
-
</
|
15
|
+
</router-link>
|
16
16
|
<div class="site-author-name">
|
17
|
-
<
|
17
|
+
<router-link to="/about">
|
18
18
|
{{ config.author.name }}
|
19
|
-
</
|
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 }}
|
@@ -98,7 +98,7 @@ const router = useRouter()
|
|
98
98
|
.site-name {
|
99
99
|
color: var(--va-c-text);
|
100
100
|
font-family: get-css-var('font-serif');
|
101
|
-
font-weight:
|
101
|
+
font-weight: 900;
|
102
102
|
}
|
103
103
|
|
104
104
|
.site-subtitle {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import { useI18n } from 'vue-i18n'
|
3
3
|
import type { Post } from 'valaxy'
|
4
|
+
import { StyleValue } from 'vue'
|
4
5
|
import { usePostProperty } from '../composables'
|
5
6
|
|
6
7
|
const props = defineProps<{
|
@@ -13,7 +14,7 @@ const { icon, styles } = usePostProperty(props.post.type)
|
|
13
14
|
</script>
|
14
15
|
|
15
16
|
<template>
|
16
|
-
<YunCard m="y-4 auto" :class="post.cover ? 'post-card-image' : 'post-card'" :style="styles">
|
17
|
+
<YunCard m="y-4 auto" :class="post.cover ? 'post-card-image' : 'post-card'" :style="styles as StyleValue">
|
17
18
|
<div class="flex flex-1 of-hidden justify-start items-start post-card-info" w="full">
|
18
19
|
<img
|
19
20
|
v-if="post.cover"
|
@@ -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
|
-
<
|
65
|
+
<router-link :to="post.path || ''" class="post-title-link">
|
66
66
|
{{ post.title }}
|
67
|
-
</
|
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
|
-
<
|
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
|
-
</
|
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
|
-
|
24
|
+
.icon {
|
25
25
|
width: 2rem;
|
26
26
|
height: 2rem;
|
27
27
|
}
|
package/components/YunWaline.vue
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
import {
|
3
|
-
const
|
2
|
+
import { useWalineOptions } from 'valaxy-addon-waline'
|
3
|
+
const walineOptions = useWalineOptions()
|
4
4
|
</script>
|
5
5
|
|
6
6
|
<template>
|
7
|
-
<WalineClient w="full" :
|
7
|
+
<WalineClient w="full" :options="walineOptions" />
|
8
8
|
</template>
|
File without changes
|
package/composables/post.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { StyleValue } from 'vue'
|
1
|
+
import type { ComputedRef, StyleValue } from 'vue'
|
2
2
|
import { computed } from 'vue'
|
3
3
|
import { useThemeConfig } from './config'
|
4
4
|
|
@@ -6,12 +6,16 @@ import { useThemeConfig } from './config'
|
|
6
6
|
* get type card property
|
7
7
|
* todo: test reactive
|
8
8
|
*/
|
9
|
-
export function usePostProperty(type?: string) {
|
9
|
+
export function usePostProperty(type?: string): {
|
10
|
+
color: string
|
11
|
+
icon: string
|
12
|
+
styles: StyleValue | undefined | ComputedRef<StyleValue | undefined>
|
13
|
+
} {
|
10
14
|
if (!type) {
|
11
15
|
return {
|
12
16
|
color: '',
|
13
17
|
icon: '',
|
14
|
-
styles:
|
18
|
+
styles: undefined,
|
15
19
|
}
|
16
20
|
}
|
17
21
|
|
@@ -23,10 +27,12 @@ export function usePostProperty(type?: string) {
|
|
23
27
|
const color = themeConfig.value.types[type].color
|
24
28
|
const icon = themeConfig.value.types[type].icon
|
25
29
|
|
26
|
-
const styles = computed(() => {
|
27
|
-
return
|
28
|
-
|
29
|
-
|
30
|
+
const styles = computed<StyleValue | undefined>(() => {
|
31
|
+
return type
|
32
|
+
? ({
|
33
|
+
'--card-c-primary': color,
|
34
|
+
})
|
35
|
+
: undefined
|
30
36
|
})
|
31
37
|
|
32
38
|
return {
|
package/layouts/home.vue
CHANGED
@@ -1,16 +1,11 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
import { useAppStore,
|
3
|
-
import { useThemeConfig } from '../composables'
|
2
|
+
import { useAppStore, useLayout } from 'valaxy'
|
4
3
|
|
5
4
|
const app = useAppStore()
|
6
|
-
const config = useConfig()
|
7
|
-
const themeConfig = useThemeConfig()
|
8
5
|
const isHome = useLayout('home')
|
9
6
|
</script>
|
10
7
|
|
11
8
|
<template>
|
12
|
-
<YunBg v-if="themeConfig.bg_image.enable" />
|
13
|
-
|
14
9
|
<main class="yun-main justify-center items-center" :class="(isHome && !app.isSidebarOpen) && 'pl-0'" flex="~ col" w="full">
|
15
10
|
<ValaxySidebar>
|
16
11
|
<slot name="sidebar">
|
@@ -29,6 +24,4 @@ const isHome = useLayout('home')
|
|
29
24
|
|
30
25
|
<YunFooter />
|
31
26
|
</main>
|
32
|
-
|
33
|
-
<YunSearch v-if="config.search.enable" />
|
34
27
|
</template>
|
package/layouts/layout.vue
CHANGED
@@ -1,14 +1,4 @@
|
|
1
|
-
<script lang="ts" setup>
|
2
|
-
import { useConfig } from 'valaxy'
|
3
|
-
|
4
|
-
const config = useConfig()
|
5
|
-
</script>
|
6
|
-
|
7
1
|
<template>
|
8
|
-
<slot name="bg">
|
9
|
-
<YunBg v-if="config.themeConfig.bg_image.enable" />
|
10
|
-
</slot>
|
11
|
-
|
12
2
|
<ValaxySidebar>
|
13
3
|
<slot name="sidebar">
|
14
4
|
<YunSidebar v-if="$slots['sidebar-child']">
|
@@ -48,7 +38,6 @@ const config = useConfig()
|
|
48
38
|
</component>
|
49
39
|
</router-view>
|
50
40
|
|
51
|
-
<YunSearch v-if="config.search.enable" />
|
52
41
|
<YunBackToTop />
|
53
42
|
</template>
|
54
43
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "valaxy-theme-yun",
|
3
|
-
"version": "0.11.
|
3
|
+
"version": "0.11.2",
|
4
4
|
"author": {
|
5
5
|
"email": "me@yunyoujun.cn",
|
6
6
|
"name": "YunYouJun",
|
@@ -17,13 +17,13 @@
|
|
17
17
|
"main": "node/index.ts",
|
18
18
|
"types": "types/index.d.ts",
|
19
19
|
"dependencies": {
|
20
|
-
"@docsearch/css": "^3.
|
21
|
-
"@docsearch/js": "^3.
|
22
|
-
"@iconify-json/ant-design": "^1.1.
|
23
|
-
"@iconify-json/simple-icons": "^1.1.
|
20
|
+
"@docsearch/css": "^3.3.0",
|
21
|
+
"@docsearch/js": "^3.3.0",
|
22
|
+
"@iconify-json/ant-design": "^1.1.4",
|
23
|
+
"@iconify-json/simple-icons": "^1.1.36",
|
24
24
|
"valaxy-addon-waline": "0.0.2"
|
25
25
|
},
|
26
26
|
"devDependencies": {
|
27
|
-
"valaxy": "0.11.
|
27
|
+
"valaxy": "0.11.2"
|
28
28
|
}
|
29
29
|
}
|
package/styles/css-vars.scss
CHANGED
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 *;
|
package/styles/vars.scss
CHANGED
package/unocss.config.ts
CHANGED
@@ -6,11 +6,18 @@ export default defineConfig({
|
|
6
6
|
['yun-card', 'm-auto transition yun-transition shadow hover:shadow-lg'],
|
7
7
|
],
|
8
8
|
rules: [
|
9
|
-
[
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
[
|
10
|
+
'yun-text-light',
|
11
|
+
{
|
12
|
+
color: 'var(--va-c-text-light)',
|
13
|
+
},
|
14
|
+
],
|
15
|
+
[
|
16
|
+
'yun-transition',
|
17
|
+
{
|
18
|
+
'transition-duration': 'var(--va-transition-duration)',
|
19
|
+
},
|
20
|
+
],
|
15
21
|
],
|
22
|
+
// web fonts is so big, let the user decide
|
16
23
|
})
|