valaxy-theme-yun 0.14.26 → 0.14.28
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/components/ValaxyMain.vue +3 -1
- package/components/YunAside.vue +5 -6
- package/components/YunBg.vue +2 -2
- package/components/YunCloud.vue +1 -1
- package/components/YunFireworks.vue +1 -1
- package/components/YunMdTimeWarning.vue +35 -0
- package/components/YunOverview.vue +1 -1
- package/components/YunPostNav.vue +1 -1
- package/components/YunSearchTrigger.vue +1 -1
- package/components/YunSidebarNav.vue +4 -4
- package/components/YunSponsor.vue +1 -1
- package/composables/index.ts +1 -0
- package/composables/tags.ts +36 -0
- package/layouts/categories.vue +2 -2
- package/layouts/tags.vue +3 -3
- package/package.json +2 -2
- package/styles/common/markdown.scss +1 -1
- package/styles/css-vars.scss +1 -1
- package/styles/layout/index.scss +5 -1
- package/styles/layout/post.scss +1 -1
@@ -38,6 +38,8 @@ const aside = computed(() => props.frontmatter.aside !== false)
|
|
38
38
|
<slot name="main-content">
|
39
39
|
<Transition appear>
|
40
40
|
<ValaxyMd :frontmatter="frontmatter">
|
41
|
+
<YunMdTimeWarning :frontmatter="frontmatter" />
|
42
|
+
|
41
43
|
<slot name="main-content-md" />
|
42
44
|
<slot />
|
43
45
|
</ValaxyMd>
|
@@ -76,7 +78,7 @@ const aside = computed(() => props.frontmatter.aside !== false)
|
|
76
78
|
</template>
|
77
79
|
|
78
80
|
<style lang="scss">
|
79
|
-
@use 'valaxy/client/styles/mixins' as *;
|
81
|
+
@use 'valaxy/client/styles/mixins/index.scss' as *;
|
80
82
|
|
81
83
|
@include screen('md') {
|
82
84
|
.yun-main {
|
package/components/YunAside.vue
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import { useI18n } from 'vue-i18n'
|
3
|
-
import { useFrontmatter } from 'valaxy'
|
4
|
-
import { useAppStore } from 'valaxy/client/stores/app'
|
3
|
+
import { useAppStore, useFrontmatter } from 'valaxy'
|
5
4
|
|
6
5
|
const frontmatter = useFrontmatter()
|
7
6
|
const { t } = useI18n()
|
@@ -20,7 +19,7 @@ const app = useAppStore()
|
|
20
19
|
<ValaxyOverlay :show="app.isRightSidebarOpen" @click="app.toggleRightSidebar()" />
|
21
20
|
|
22
21
|
<!-- -->
|
23
|
-
<aside class="va-card aside" :class="app.isRightSidebarOpen && 'open'" m="l-4" text="center">
|
22
|
+
<aside class="va-card yun-aside" :class="app.isRightSidebarOpen && 'open'" m="l-4" text="center">
|
24
23
|
<div class="aside-container" flex="~ col" overflow="auto">
|
25
24
|
<h2 v-if="frontmatter.toc !== false" m="t-6 b-2" font="serif black">
|
26
25
|
{{ t('sidebar.toc') }}
|
@@ -38,9 +37,9 @@ const app = useAppStore()
|
|
38
37
|
</template>
|
39
38
|
|
40
39
|
<style lang="scss">
|
41
|
-
@use 'valaxy/client/styles/mixins' as *;
|
40
|
+
@use 'valaxy/client/styles/mixins/index.scss' as *;
|
42
41
|
|
43
|
-
.aside {
|
42
|
+
.yun-aside {
|
44
43
|
position: fixed;
|
45
44
|
right: 0;
|
46
45
|
top: 0;
|
@@ -70,7 +69,7 @@ const app = useAppStore()
|
|
70
69
|
}
|
71
70
|
|
72
71
|
@include screen('xl') {
|
73
|
-
.aside {
|
72
|
+
.yun-aside {
|
74
73
|
transform: translateX(0);
|
75
74
|
}
|
76
75
|
}
|
package/components/YunBg.vue
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import { computed, watch } from 'vue'
|
3
|
-
import { useThemeConfig } from 'valaxy-theme-yun/composables'
|
4
3
|
import { useCssVar } from '@vueuse/core'
|
5
4
|
import { isDark } from 'valaxy'
|
5
|
+
import { useThemeConfig } from '../composables'
|
6
6
|
|
7
7
|
const themeConfig = useThemeConfig()
|
8
8
|
|
@@ -28,7 +28,7 @@ watch(() => bgImgUrl.value, () => {
|
|
28
28
|
</template>
|
29
29
|
|
30
30
|
<style lang="scss">
|
31
|
-
@use 'valaxy/client/styles/mixins' as *;
|
31
|
+
@use 'valaxy/client/styles/mixins/index.scss' as *;
|
32
32
|
|
33
33
|
.va-bg {
|
34
34
|
position: fixed;
|
package/components/YunCloud.vue
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
<script lang="ts" setup>
|
2
|
+
import { computed } from 'vue'
|
3
|
+
import type { Post } from 'valaxy'
|
4
|
+
|
5
|
+
import dayjs from 'dayjs'
|
6
|
+
import relativeTime from 'dayjs/plugin/relativeTime'
|
7
|
+
|
8
|
+
import { useI18n } from 'vue-i18n'
|
9
|
+
|
10
|
+
const props = defineProps<{
|
11
|
+
frontmatter: Post
|
12
|
+
}>()
|
13
|
+
|
14
|
+
dayjs.extend(relativeTime)
|
15
|
+
|
16
|
+
const { t } = useI18n()
|
17
|
+
|
18
|
+
/**
|
19
|
+
* when the post is updated more than 30 days ago, show a warning
|
20
|
+
* default 30 days, you can set `time_warning` in frontmatter to change it
|
21
|
+
*/
|
22
|
+
const time_warning = computed(() => {
|
23
|
+
const diff = dayjs().valueOf() - dayjs(props.frontmatter.updated).valueOf()
|
24
|
+
if (typeof props.frontmatter.time_warning === 'number')
|
25
|
+
return diff > props.frontmatter.time_warning
|
26
|
+
else
|
27
|
+
return props.frontmatter.time_warning || diff > 30 * 24 * 60 * 60 * 1000
|
28
|
+
})
|
29
|
+
</script>
|
30
|
+
|
31
|
+
<template>
|
32
|
+
<blockquote v-if="time_warning" op="80">
|
33
|
+
{{ t('post.time_warning', { ago: dayjs(frontmatter.updated).fromNow() }) }}
|
34
|
+
</blockquote>
|
35
|
+
</template>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
import {
|
2
|
+
import { useCategories, useSiteStore, useTags } from 'valaxy'
|
3
3
|
import { useI18n } from 'vue-i18n'
|
4
4
|
import { useThemeConfig } from '../composables'
|
5
5
|
|
@@ -8,8 +8,8 @@ const { t } = useI18n()
|
|
8
8
|
const site = useSiteStore()
|
9
9
|
|
10
10
|
const themeConfig = useThemeConfig()
|
11
|
-
const categories =
|
12
|
-
const tags =
|
11
|
+
const categories = useCategories()
|
12
|
+
const tags = useTags()
|
13
13
|
</script>
|
14
14
|
|
15
15
|
<template>
|
@@ -38,7 +38,7 @@ const tags = useTag()
|
|
38
38
|
</template>
|
39
39
|
|
40
40
|
<style lang="scss">
|
41
|
-
@use "valaxy/client/styles/mixins" as *;
|
41
|
+
@use "valaxy/client/styles/mixins/index.scss" as *;
|
42
42
|
|
43
43
|
.site-nav {
|
44
44
|
display: flex;
|
package/composables/index.ts
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
import { TinyColor } from '@ctrl/tinycolor'
|
2
|
+
import { useTags } from 'valaxy'
|
3
|
+
|
4
|
+
/**
|
5
|
+
* get utils about tags
|
6
|
+
*/
|
7
|
+
export function useYunTags(options: {
|
8
|
+
/**
|
9
|
+
* Primary Color
|
10
|
+
*/
|
11
|
+
primary: string
|
12
|
+
} = {
|
13
|
+
primary: '#0078E7',
|
14
|
+
}) {
|
15
|
+
const tags = useTags()
|
16
|
+
|
17
|
+
const gray = new TinyColor('#999999')
|
18
|
+
const primaryColor = new TinyColor(options.primary)
|
19
|
+
|
20
|
+
const getTagStyle = (count: number) => {
|
21
|
+
const counts = Array.from(tags.value).map(([_, value]) => value.count)
|
22
|
+
const max = Math.max(...counts)
|
23
|
+
const min = Math.min(...counts)
|
24
|
+
const range = max - min
|
25
|
+
const percent = (count - min) / range
|
26
|
+
return {
|
27
|
+
'--yun-tag-color': gray.mix(primaryColor, percent * 100).toString(),
|
28
|
+
'fontSize': `${percent * 36 + 12}px`,
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
return {
|
33
|
+
tags,
|
34
|
+
getTagStyle,
|
35
|
+
}
|
36
|
+
}
|
package/layouts/categories.vue
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import { computed } from 'vue'
|
3
|
-
import {
|
3
|
+
import { useCategories, useFrontmatter, usePostTitle, useSiteStore } from 'valaxy'
|
4
4
|
import { useI18n } from 'vue-i18n'
|
5
5
|
import { useRoute } from 'vue-router'
|
6
6
|
import { defineWebPage, useSchemaOrg } from '@vueuse/schema-org'
|
@@ -12,7 +12,7 @@ const frontmatter = useFrontmatter()
|
|
12
12
|
|
13
13
|
const route = useRoute()
|
14
14
|
const curCategory = computed(() => (route.query.category as string || ''))
|
15
|
-
const categories =
|
15
|
+
const categories = useCategories()
|
16
16
|
|
17
17
|
const posts = computed(() => {
|
18
18
|
const list = site.postList.filter((post) => {
|
package/layouts/tags.vue
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
import { useFrontmatter, useInvisibleElement, usePostTitle, useSiteStore
|
2
|
+
import { useFrontmatter, useInvisibleElement, usePostTitle, useSiteStore } from 'valaxy'
|
3
3
|
import { useI18n } from 'vue-i18n'
|
4
4
|
import { computed, ref } from 'vue'
|
5
5
|
import { useRoute, useRouter } from 'vue-router'
|
6
6
|
import { defineWebPage, useSchemaOrg } from '@vueuse/schema-org'
|
7
|
-
import { useThemeConfig } from '../composables'
|
7
|
+
import { useThemeConfig, useYunTags } from '../composables'
|
8
8
|
|
9
9
|
useSchemaOrg([
|
10
10
|
defineWebPage({
|
@@ -19,7 +19,7 @@ const themeConfig = useThemeConfig()
|
|
19
19
|
|
20
20
|
const { t } = useI18n()
|
21
21
|
const frontmatter = useFrontmatter()
|
22
|
-
const { tags, getTagStyle } =
|
22
|
+
const { tags, getTagStyle } = useYunTags({
|
23
23
|
primary: themeConfig.value.colors.primary,
|
24
24
|
})
|
25
25
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "valaxy-theme-yun",
|
3
|
-
"version": "0.14.
|
3
|
+
"version": "0.14.28",
|
4
4
|
"author": {
|
5
5
|
"email": "me@yunyoujun.cn",
|
6
6
|
"name": "YunYouJun",
|
@@ -24,6 +24,6 @@
|
|
24
24
|
},
|
25
25
|
"devDependencies": {
|
26
26
|
"@types/animejs": "^3.1.7",
|
27
|
-
"valaxy": "0.14.
|
27
|
+
"valaxy": "0.14.28"
|
28
28
|
}
|
29
29
|
}
|
package/styles/css-vars.scss
CHANGED
package/styles/layout/index.scss
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
-
@use "valaxy/client/styles/mixins" as *;
|
1
|
+
@use "valaxy/client/styles/mixins/index.scss" as *;
|
2
2
|
@use "./post" as *;
|
3
3
|
|
4
|
+
html {
|
5
|
+
overflow-y: scroll;
|
6
|
+
}
|
7
|
+
|
4
8
|
.yun-main {
|
5
9
|
padding-left: var(--va-sidebar-width);
|
6
10
|
transition: padding-left var(--va-transition-duration);
|
package/styles/layout/post.scss
CHANGED