valaxy-theme-yun 0.14.21 → 0.14.23
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 +8 -2
- package/components/YunAlbum.vue +25 -0
- package/components/YunAlbumList.vue +67 -0
- package/components/YunBanner.vue +2 -1
- package/components/YunCategory.vue +2 -2
- package/components/YunFooter.vue +6 -1
- package/components/YunFuseSearch.vue +1 -1
- package/components/YunGallery.vue +11 -0
- package/components/YunPageHeader.vue +6 -3
- package/components/YunPostCard.vue +1 -1
- package/components/YunSearchTrigger.vue +1 -1
- package/layouts/albums.vue +35 -0
- package/layouts/gallery.vue +53 -0
- package/layouts/tags.vue +1 -1
- package/package.json +2 -2
- package/styles/layout/post.scss +0 -10
- package/types/index.d.ts +2 -2
- package/utils/index.ts +1 -1
@@ -1,7 +1,8 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import type { PageData, Post } from 'valaxy'
|
3
3
|
import { usePostTitle, useSiteConfig } from 'valaxy'
|
4
|
-
import { StyleValue
|
4
|
+
import type { StyleValue } from 'vue'
|
5
|
+
import { computed } from 'vue'
|
5
6
|
import { usePostProperty } from '../composables'
|
6
7
|
|
7
8
|
const props = defineProps<{
|
@@ -24,7 +25,12 @@ const aside = computed(() => props.frontmatter.aside !== false)
|
|
24
25
|
<div class="content" :class="!aside && 'no-aside'" flex="~ col grow" w="full" p="l-4 lt-md:0">
|
25
26
|
<YunCard :cover="frontmatter.cover" m="0" class="relative" :style="styles as StyleValue">
|
26
27
|
<slot name="main-header">
|
27
|
-
<YunPageHeader
|
28
|
+
<YunPageHeader
|
29
|
+
class="mb-2"
|
30
|
+
:title="title"
|
31
|
+
:icon="frontmatter.icon || icon" :color="frontmatter.color || color"
|
32
|
+
:cover="frontmatter.cover"
|
33
|
+
/>
|
28
34
|
</slot>
|
29
35
|
<slot name="main-header-after" />
|
30
36
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<script lang="ts" setup>
|
2
|
+
import type { Album } from 'valaxy'
|
3
|
+
import { onImgError } from '../utils'
|
4
|
+
|
5
|
+
defineProps<{
|
6
|
+
album: Album
|
7
|
+
}>()
|
8
|
+
</script>
|
9
|
+
|
10
|
+
<template>
|
11
|
+
<AppLink class="yun-album-list-item" :to="album.url">
|
12
|
+
<figure :title="album.desc">
|
13
|
+
<img
|
14
|
+
loading="lazy"
|
15
|
+
class="yun-album-list-cover"
|
16
|
+
:src="album.cover"
|
17
|
+
:alt="album.caption"
|
18
|
+
:on-error="onImgError"
|
19
|
+
>
|
20
|
+
<figcaption>
|
21
|
+
「{{ album.caption }}」
|
22
|
+
</figcaption>
|
23
|
+
</figure>
|
24
|
+
</AppLink>
|
25
|
+
</template>
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<script lang="ts" setup>
|
2
|
+
import type { Album } from 'valaxy'
|
3
|
+
|
4
|
+
defineProps<{
|
5
|
+
albums: Album[]
|
6
|
+
}>()
|
7
|
+
</script>
|
8
|
+
|
9
|
+
<template>
|
10
|
+
<div class="yun-album-list">
|
11
|
+
<YunAlbum v-for="album in albums" :key="album.url" :album="album" />
|
12
|
+
</div>
|
13
|
+
</template>
|
14
|
+
|
15
|
+
<style lang="scss">
|
16
|
+
.yun {
|
17
|
+
&-album-list {
|
18
|
+
display: flex;
|
19
|
+
justify-content: center;
|
20
|
+
flex-wrap: wrap;
|
21
|
+
}
|
22
|
+
|
23
|
+
&-album-list-item {
|
24
|
+
display: inline-flex;
|
25
|
+
|
26
|
+
figure {
|
27
|
+
position: relative;
|
28
|
+
width: 15rem;
|
29
|
+
margin: 2rem;
|
30
|
+
|
31
|
+
&::before {
|
32
|
+
content: '';
|
33
|
+
position: absolute;
|
34
|
+
top: 1%;
|
35
|
+
left: 0.5%;
|
36
|
+
width: 100%;
|
37
|
+
height: 96%;
|
38
|
+
border: 0.25rem solid white;
|
39
|
+
background-color: #666;
|
40
|
+
box-shadow: 0 5px 10px rgba(#000000, 0.3);
|
41
|
+
transform: rotate(-3deg);
|
42
|
+
}
|
43
|
+
|
44
|
+
img {
|
45
|
+
vertical-align: bottom;
|
46
|
+
display: inline-flex;
|
47
|
+
border: 0.25rem solid white;
|
48
|
+
box-shadow: 0 8px 10px rgba(#000000, 0.3);
|
49
|
+
padding: 0;
|
50
|
+
transform: rotate(2deg);
|
51
|
+
width: 100%;
|
52
|
+
height: 10rem;
|
53
|
+
object-fit: cover;
|
54
|
+
background-color: #eee;
|
55
|
+
}
|
56
|
+
|
57
|
+
figcaption {
|
58
|
+
position: absolute;
|
59
|
+
bottom: -2.5rem;
|
60
|
+
display: block;
|
61
|
+
text-align: center;
|
62
|
+
width: 100%;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
67
|
+
</style>
|
package/components/YunBanner.vue
CHANGED
@@ -5,7 +5,8 @@
|
|
5
5
|
* @description https://github.com/YunYouJun/hexo-theme-yun
|
6
6
|
*/
|
7
7
|
|
8
|
-
import { CSSProperties
|
8
|
+
import type { CSSProperties } from 'vue'
|
9
|
+
import { computed, onBeforeMount, ref } from 'vue'
|
9
10
|
import { random } from 'valaxy'
|
10
11
|
import { useThemeConfig } from '../composables'
|
11
12
|
|
@@ -28,7 +28,7 @@ const { t } = useI18n()
|
|
28
28
|
* i18n
|
29
29
|
*/
|
30
30
|
const { locale } = useI18n()
|
31
|
-
|
31
|
+
function getTitle(post: Post | any) {
|
32
32
|
const lang = locale.value === 'zh-CN' ? 'zh' : locale.value
|
33
33
|
return post[`title_${lang}`] ? post[`title_${lang}`] : post.title
|
34
34
|
}
|
@@ -39,7 +39,7 @@ const { show } = useInvisibleElement(postCollapseElRef)
|
|
39
39
|
* scroll to post collapse by category
|
40
40
|
* @param category
|
41
41
|
*/
|
42
|
-
|
42
|
+
function jumpToDisplayCategory(category: string) {
|
43
43
|
router.push({
|
44
44
|
query: {
|
45
45
|
category,
|
package/components/YunFooter.vue
CHANGED
@@ -40,7 +40,12 @@ const footerIcon = computed(() => themeConfig.value.footer.icon || {
|
|
40
40
|
{{ year }}
|
41
41
|
</span>
|
42
42
|
|
43
|
-
<a
|
43
|
+
<a
|
44
|
+
v-if="themeConfig.footer.icon?.enable"
|
45
|
+
class="inline-flex"
|
46
|
+
:class="themeConfig.footer.icon.animated ? 'animate-pulse' : ''"
|
47
|
+
:href="footerIcon.url" target="_blank" :title="footerIcon.title"
|
48
|
+
>
|
44
49
|
<div :class="footerIcon.name" />
|
45
50
|
</a>
|
46
51
|
<span>{{ siteConfig.author.name }}</span>
|
@@ -8,9 +8,12 @@ defineProps<{
|
|
8
8
|
|
9
9
|
<template>
|
10
10
|
<header class="post-header" m="t-4">
|
11
|
-
<h1
|
12
|
-
|
13
|
-
|
11
|
+
<h1
|
12
|
+
class="post-title flex-center" p="2" text="2xl center"
|
13
|
+
font="serif black" :style="`color:${color}`"
|
14
|
+
>
|
15
|
+
<div v-if="icon" class="icon" m="r-1 t-1px" inline-flex :class="icon" />
|
16
|
+
<span inline-flex class="leading-none">{{ title }}</span>
|
14
17
|
</h1>
|
15
18
|
</header>
|
16
19
|
</template>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<script lang="ts" setup>
|
2
|
+
import { defineWebPage, useSchemaOrg } from '@vueuse/schema-org'
|
3
|
+
import { useFrontmatter, usePostTitle } from 'valaxy'
|
4
|
+
import { computed } from 'vue'
|
5
|
+
import { useI18n } from 'vue-i18n'
|
6
|
+
|
7
|
+
const { t } = useI18n()
|
8
|
+
|
9
|
+
const frontmatter = useFrontmatter()
|
10
|
+
|
11
|
+
const title = usePostTitle(frontmatter)
|
12
|
+
|
13
|
+
useSchemaOrg([
|
14
|
+
defineWebPage({
|
15
|
+
'@type': 'CollectionPage',
|
16
|
+
}),
|
17
|
+
])
|
18
|
+
|
19
|
+
const albums = computed(() => frontmatter.value.albums || [])
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<template>
|
23
|
+
<Layout>
|
24
|
+
<template #main-header>
|
25
|
+
<YunPageHeader :title="title || t('title.album')" :icon="frontmatter.icon || 'i-ri-gallery-line'" :color="frontmatter.color" />
|
26
|
+
</template>
|
27
|
+
<template #main-content>
|
28
|
+
<div text="center" class="yun-text-light" p="2">
|
29
|
+
{{ t('counter.albums', albums.length) }}
|
30
|
+
</div>
|
31
|
+
<YunAlbumList :albums="albums" />
|
32
|
+
<router-view />
|
33
|
+
</template>
|
34
|
+
</Layout>
|
35
|
+
</template>
|
@@ -0,0 +1,53 @@
|
|
1
|
+
<script lang="ts" setup>
|
2
|
+
import { defineWebPage, useSchemaOrg } from '@vueuse/schema-org'
|
3
|
+
import { useFrontmatter, usePostTitle, useRuntimeConfig } from 'valaxy'
|
4
|
+
import { computed, defineAsyncComponent } from 'vue'
|
5
|
+
import { useI18n } from 'vue-i18n'
|
6
|
+
import { useRouter } from 'vue-router'
|
7
|
+
|
8
|
+
const router = useRouter()
|
9
|
+
|
10
|
+
const { t } = useI18n()
|
11
|
+
|
12
|
+
const frontmatter = useFrontmatter()
|
13
|
+
|
14
|
+
const title = usePostTitle(frontmatter)
|
15
|
+
|
16
|
+
useSchemaOrg([
|
17
|
+
defineWebPage({
|
18
|
+
'@type': 'CollectionPage',
|
19
|
+
}),
|
20
|
+
])
|
21
|
+
|
22
|
+
const photos = computed(() => frontmatter.value.photos || [])
|
23
|
+
|
24
|
+
const runtimeConfig = useRuntimeConfig()
|
25
|
+
|
26
|
+
const YunGallery = runtimeConfig.value.addons['valaxy-addon-lightgallery']
|
27
|
+
? defineAsyncComponent(() => import('../components/YunGallery.vue'))
|
28
|
+
: () => null
|
29
|
+
</script>
|
30
|
+
|
31
|
+
<template>
|
32
|
+
<Layout>
|
33
|
+
<template #main-header>
|
34
|
+
<YunPageHeader
|
35
|
+
:title="title || t('title.gallery')"
|
36
|
+
:icon="frontmatter.icon || 'i-ri-gallery-line'"
|
37
|
+
:color="frontmatter.color"
|
38
|
+
/>
|
39
|
+
</template>
|
40
|
+
<template #main-content>
|
41
|
+
<div text="center" class="yun-text-light" p="2">
|
42
|
+
{{ t('counter.photos', photos.length) }}
|
43
|
+
</div>
|
44
|
+
<div class="page-action" text="center">
|
45
|
+
<a class="yun-icon-btn" :title="t('accessibility.back')" @click="() => router.back()">
|
46
|
+
<div i-ri-arrow-go-back-line />
|
47
|
+
</a>
|
48
|
+
</div>
|
49
|
+
<YunGallery :photos="photos" />
|
50
|
+
<router-view />
|
51
|
+
</template>
|
52
|
+
</Layout>
|
53
|
+
</template>
|
package/layouts/tags.vue
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "valaxy-theme-yun",
|
3
|
-
"version": "0.14.
|
3
|
+
"version": "0.14.23",
|
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.23"
|
28
28
|
}
|
29
29
|
}
|
package/styles/layout/post.scss
CHANGED
package/types/index.d.ts
CHANGED
@@ -143,7 +143,7 @@ export interface ThemeConfig {
|
|
143
143
|
/**
|
144
144
|
* Icon between year and copyright info.
|
145
145
|
*/
|
146
|
-
icon: {
|
146
|
+
icon: Partial<{
|
147
147
|
/**
|
148
148
|
* icon name, i-xxx
|
149
149
|
*/
|
@@ -153,7 +153,7 @@ export interface ThemeConfig {
|
|
153
153
|
color: string
|
154
154
|
url: string
|
155
155
|
title: string
|
156
|
-
}
|
156
|
+
}>
|
157
157
|
|
158
158
|
/**
|
159
159
|
* Powered by valaxy & valaxy-theme-${name}, default is yun
|
package/utils/index.ts
CHANGED
@@ -4,7 +4,7 @@ export const anonymousImage = 'https://cdn.yunyoujun.cn/img/avatar/none.jpg'
|
|
4
4
|
* set default img
|
5
5
|
* @param e
|
6
6
|
*/
|
7
|
-
export
|
7
|
+
export function onImgError(e: Event, defaultImg = anonymousImage) {
|
8
8
|
const targetEl = e.target as HTMLImageElement
|
9
9
|
targetEl.setAttribute('data-src', targetEl.src)
|
10
10
|
targetEl.src = defaultImg
|