valaxy-theme-yun 0.18.10 → 0.19.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.
- package/App.vue +13 -0
- package/components/YunBg.vue +3 -2
- package/components/YunConfig.vue +10 -3
- package/components/YunMdTimeWarning.vue +7 -8
- package/components/YunOverview.vue +1 -1
- package/components/YunPostMeta.vue +3 -2
- package/components/YunSidebar.vue +10 -8
- package/layouts/home.vue +5 -4
- package/node/config.ts +4 -0
- package/package.json +4 -4
- package/setup/main.ts +18 -2
- package/stores/app.ts +5 -2
- package/stores/index.ts +1 -0
- package/types/index.d.ts +3 -1
package/App.vue
CHANGED
@@ -4,6 +4,8 @@ import { useAppStore, useSiteConfig } from 'valaxy'
|
|
4
4
|
import { onMounted } from 'vue'
|
5
5
|
import { useThemeConfig } from './composables'
|
6
6
|
|
7
|
+
const appStore = useAppStore()
|
8
|
+
|
7
9
|
useHead({
|
8
10
|
link: [
|
9
11
|
{
|
@@ -11,6 +13,17 @@ useHead({
|
|
11
13
|
href: 'https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@900&display=swap',
|
12
14
|
},
|
13
15
|
],
|
16
|
+
|
17
|
+
meta: [
|
18
|
+
{
|
19
|
+
name: 'theme-color',
|
20
|
+
content: appStore.themeColor,
|
21
|
+
},
|
22
|
+
{
|
23
|
+
name: 'msapplication-TileColor',
|
24
|
+
content: appStore.themeColor,
|
25
|
+
},
|
26
|
+
],
|
14
27
|
})
|
15
28
|
|
16
29
|
const siteConfig = useSiteConfig()
|
package/components/YunBg.vue
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import { computed, watch } from 'vue'
|
3
3
|
import { useCssVar } from '@vueuse/core'
|
4
|
-
import {
|
4
|
+
import { useAppStore } from 'valaxy'
|
5
5
|
import { useThemeConfig } from '../composables'
|
6
6
|
|
7
|
+
const appStore = useAppStore()
|
7
8
|
const themeConfig = useThemeConfig()
|
8
9
|
|
9
10
|
if (typeof themeConfig.value.bg_image.url !== 'undefined') {
|
@@ -12,7 +13,7 @@ if (typeof themeConfig.value.bg_image.url !== 'undefined') {
|
|
12
13
|
bgImgOpacity.value = themeConfig.value.bg_image.opacity.toString() || '1'
|
13
14
|
|
14
15
|
const bgImgUrl = computed(() => {
|
15
|
-
return isDark
|
16
|
+
return appStore.isDark
|
16
17
|
? themeConfig.value.bg_image.dark
|
17
18
|
: themeConfig.value.bg_image.url
|
18
19
|
})
|
package/components/YunConfig.vue
CHANGED
@@ -1,18 +1,25 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import { useI18n } from 'vue-i18n'
|
3
3
|
import { computed } from 'vue'
|
4
|
-
import {
|
4
|
+
import { useAppStore } from 'valaxy'
|
5
5
|
|
6
|
+
const appStore = useAppStore()
|
6
7
|
const { t } = useI18n()
|
7
8
|
|
8
9
|
const themeTitle = computed(() => {
|
9
|
-
return isDark
|
10
|
+
return appStore.isDark ? t('button.toggle_light') : t('button.toggle_dark')
|
11
|
+
})
|
12
|
+
|
13
|
+
const styles = computed(() => {
|
14
|
+
return {
|
15
|
+
color: appStore.isDark ? '' : '#f1cb64',
|
16
|
+
}
|
10
17
|
})
|
11
18
|
</script>
|
12
19
|
|
13
20
|
<template>
|
14
21
|
<div>
|
15
|
-
<button class="yun-icon-btn" :title="themeTitle" :style="
|
22
|
+
<button class="yun-icon-btn" :title="themeTitle" :style="styles" @click="appStore.toggleDarkWithTransition">
|
16
23
|
<div i="ri-sun-line dark:ri-moon-line" />
|
17
24
|
</button>
|
18
25
|
|
@@ -1,21 +1,20 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
import { computed } from 'vue'
|
2
|
+
import { computed, ref, watch } from 'vue'
|
3
3
|
import { useFrontmatter } from 'valaxy'
|
4
4
|
import { useI18n } from 'vue-i18n'
|
5
5
|
|
6
6
|
import { differenceInMilliseconds, formatDistanceToNow } from 'date-fns'
|
7
7
|
|
8
8
|
const fm = useFrontmatter()
|
9
|
-
const { t } = useI18n()
|
9
|
+
const { t, locale } = useI18n()
|
10
10
|
|
11
11
|
const updated = computed(() => fm.value.updated || fm.value.date || new Date())
|
12
|
-
const ago =
|
12
|
+
const ago = ref('')
|
13
|
+
|
14
|
+
watch(locale, () => {
|
13
15
|
const fromNow = formatDistanceToNow(updated.value, { addSuffix: true })
|
14
|
-
|
15
|
-
|
16
|
-
else
|
17
|
-
return fromNow
|
18
|
-
})
|
16
|
+
ago.value = /^\d/.test(fromNow) ? ` ${fromNow}` : fromNow
|
17
|
+
}, { immediate: true })
|
19
18
|
|
20
19
|
/**
|
21
20
|
* when the post is updated more than 180 days ago, show a warning
|
@@ -11,7 +11,7 @@ const router = useRouter()
|
|
11
11
|
<div class="site-info" m="t-6">
|
12
12
|
<RouterLink class="site-author-avatar" to="/about">
|
13
13
|
<img class="rounded-full" :src="siteConfig.author.avatar" alt="avatar">
|
14
|
-
<span class="site-author-status" :title="siteConfig.author.status.message">{{ siteConfig.author.status.emoji }}</span>
|
14
|
+
<span v-if="siteConfig.author.status.emoji" class="site-author-status" :title="siteConfig.author.status.message || undefined">{{ siteConfig.author.status.emoji }}</span>
|
15
15
|
</RouterLink>
|
16
16
|
<div
|
17
17
|
class="site-author-name leading-6"
|
@@ -1,5 +1,6 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import type { Post } from 'valaxy'
|
3
|
+
import { formatISO } from 'date-fns'
|
3
4
|
import { formatDate, useSiteConfig } from 'valaxy'
|
4
5
|
import { useI18n } from 'vue-i18n'
|
5
6
|
|
@@ -30,14 +31,14 @@ const siteConfig = useSiteConfig()
|
|
30
31
|
flex="~ col" justify="center" items="center" text="sm" py="1"
|
31
32
|
>
|
32
33
|
<div v-if="frontmatter.date" class="post-time flex items-center">
|
33
|
-
<span class="posted-time inline-flex-center" :title="t('post.posted') + frontmatter.date">
|
34
|
+
<span class="posted-time inline-flex-center" :title="t('post.posted') + formatISO(frontmatter.date)">
|
34
35
|
<div class="inline-block" i-ri-calendar-line />
|
35
36
|
<time m="l-1">{{ formatDate(frontmatter.date) }}</time>
|
36
37
|
</span>
|
37
38
|
|
38
39
|
<span
|
39
40
|
v-if="frontmatter.updated && frontmatter.updated !== frontmatter.date"
|
40
|
-
class="edited-time inline-flex-center" :title="t('post.edited') + frontmatter.updated"
|
41
|
+
class="edited-time inline-flex-center" :title="t('post.edited') + formatISO(frontmatter.updated)"
|
41
42
|
>
|
42
43
|
<span m="x-2">-</span>
|
43
44
|
<div i-ri-calendar-2-line />
|
@@ -1,28 +1,32 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import { ref } from 'vue'
|
3
|
-
import {
|
3
|
+
import { useYunAppStore } from '../stores'
|
4
4
|
|
5
5
|
defineProps<{
|
6
6
|
showHamburger?: boolean
|
7
7
|
}>()
|
8
8
|
|
9
|
-
const
|
9
|
+
const yunStore = useYunAppStore()
|
10
10
|
const showOverview = ref(false)
|
11
11
|
</script>
|
12
12
|
|
13
13
|
<template>
|
14
|
-
<ValaxyOverlay class="md:hidden" :show="
|
14
|
+
<ValaxyOverlay class="md:hidden" :show="yunStore.leftSidebar.isOpen" @click="yunStore.leftSidebar.toggle()" />
|
15
15
|
|
16
16
|
<ValaxyHamburger
|
17
|
-
:active="
|
17
|
+
:active="yunStore.leftSidebar.isOpen"
|
18
18
|
class="menu-btn sidebar-toggle yun-icon-btn leading-4 fixed left-0.8rem top-0.6rem"
|
19
19
|
inline-flex cursor="pointer" z="$yun-z-menu-btn"
|
20
|
-
:class="showHamburger ? '' : 'md:hidden'"
|
20
|
+
:class="showHamburger ? '' : 'md:hidden'"
|
21
|
+
@click="yunStore.leftSidebar.toggle()"
|
21
22
|
/>
|
22
23
|
|
23
24
|
<aside
|
24
25
|
class="va-card transition sidebar fixed inset-y-0 left-0 overflow-y-auto"
|
25
|
-
:class="
|
26
|
+
:class="{
|
27
|
+
'open': yunStore.leftSidebar.isOpen,
|
28
|
+
'md:translate-x-0': !showHamburger,
|
29
|
+
}"
|
26
30
|
text="center" bg="$yun-sidebar-bg-color contain no-repeat" z="$yun-z-sidebar"
|
27
31
|
>
|
28
32
|
<div v-if="$slots.default" class="sidebar-nav" m="t-6">
|
@@ -51,8 +55,6 @@ const showOverview = ref(false)
|
|
51
55
|
</template>
|
52
56
|
|
53
57
|
<style lang="scss">
|
54
|
-
@use "sass:map";
|
55
|
-
|
56
58
|
.sidebar {
|
57
59
|
width: calc(100vw - 64px);
|
58
60
|
max-width: var(--va-sidebar-width);
|
package/layouts/home.vue
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
import {
|
2
|
+
import { useLayout } from 'valaxy'
|
3
3
|
import { computed } from 'vue'
|
4
4
|
import { useRoute } from 'vue-router'
|
5
|
+
import { useYunAppStore } from '../stores'
|
5
6
|
import { useThemeConfig } from '../composables'
|
6
7
|
|
7
|
-
const
|
8
|
+
const yunStore = useYunAppStore()
|
9
|
+
const route = useRoute()
|
8
10
|
const isHome = useLayout('home')
|
9
11
|
const themeConfig = useThemeConfig()
|
10
12
|
|
11
|
-
const route = useRoute()
|
12
13
|
const isPage = computed(() => route.path.startsWith('/page'))
|
13
14
|
|
14
15
|
const showNotice = computed(() => {
|
@@ -20,7 +21,7 @@ const showNotice = computed(() => {
|
|
20
21
|
<template>
|
21
22
|
<main
|
22
23
|
class="yun-main flex-center"
|
23
|
-
:class="(isHome && !
|
24
|
+
:class="(isHome && !yunStore.leftSidebar.isOpen) ? 'pl-0' : 'md:pl-$va-sidebar-width'" flex="~ col" w="full"
|
24
25
|
>
|
25
26
|
<YunSidebar :show-hamburger="true" />
|
26
27
|
|
package/node/config.ts
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "valaxy-theme-yun",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.19.1",
|
4
4
|
"author": {
|
5
5
|
"email": "me@yunyoujun.cn",
|
6
6
|
"name": "YunYouJun",
|
@@ -20,12 +20,12 @@
|
|
20
20
|
"dependencies": {
|
21
21
|
"@explosions/fireworks": "^0.0.2",
|
22
22
|
"@iconify-json/ant-design": "^1.1.16",
|
23
|
-
"@iconify-json/simple-icons": "^1.1.
|
23
|
+
"@iconify-json/simple-icons": "^1.1.108",
|
24
24
|
"animejs": "^3.2.2"
|
25
25
|
},
|
26
26
|
"devDependencies": {
|
27
27
|
"@types/animejs": "^3.1.12",
|
28
|
-
"valaxy
|
29
|
-
"valaxy": "0.
|
28
|
+
"valaxy": "0.19.1",
|
29
|
+
"valaxy-addon-waline": "0.1.4"
|
30
30
|
}
|
31
31
|
}
|
package/setup/main.ts
CHANGED
@@ -1,5 +1,21 @@
|
|
1
|
-
import { defineAppSetup } from 'valaxy'
|
1
|
+
import { defineAppSetup, useAppStore } from 'valaxy'
|
2
|
+
import { nextTick } from 'vue'
|
3
|
+
import { useYunAppStore } from '../stores'
|
2
4
|
|
3
|
-
export default defineAppSetup((
|
5
|
+
export default defineAppSetup((ctx) => {
|
4
6
|
// can do for setup
|
7
|
+
|
8
|
+
const { router } = ctx
|
9
|
+
router.afterEach(() => {
|
10
|
+
/**
|
11
|
+
* router import order
|
12
|
+
* @see https://pinia.vuejs.org/zh/core-concepts/outside-component-usage.html#single-page-applications
|
13
|
+
*/
|
14
|
+
const appStore = useAppStore()
|
15
|
+
const yunAppStore = useYunAppStore()
|
16
|
+
nextTick(() => {
|
17
|
+
if (appStore.isMobile)
|
18
|
+
yunAppStore.leftSidebar.close()
|
19
|
+
})
|
20
|
+
})
|
5
21
|
})
|
package/stores/app.ts
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
import { acceptHMRUpdate, defineStore } from 'pinia'
|
2
|
+
import { useDynamicLeftSidebar } from 'valaxy'
|
2
3
|
|
3
4
|
export const useYunAppStore = defineStore('yun-app', () => {
|
4
|
-
|
5
|
+
const leftSidebar = useDynamicLeftSidebar()
|
5
6
|
|
6
|
-
return {
|
7
|
+
return {
|
8
|
+
leftSidebar,
|
9
|
+
}
|
7
10
|
})
|
8
11
|
|
9
12
|
if (import.meta.hot)
|
package/stores/index.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './app'
|
package/types/index.d.ts
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
import type { DefaultTheme } from 'valaxy/types'
|
2
|
+
|
1
3
|
export * from '../composables'
|
2
4
|
|
3
5
|
export namespace YunTheme {
|
@@ -48,7 +50,7 @@ export interface Page {
|
|
48
50
|
/**
|
49
51
|
* Theme Config
|
50
52
|
*/
|
51
|
-
export interface ThemeConfig {
|
53
|
+
export interface ThemeConfig extends DefaultTheme.Config {
|
52
54
|
/**
|
53
55
|
* toc title
|
54
56
|
* @default 'On this page'
|