valaxy 0.7.2 → 0.7.5
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/client/composables/post.ts +1 -36
- package/client/composables/sidebar.ts +1 -48
- package/client/config.ts +7 -16
- package/client/index.ts +0 -3
- package/client/main.ts +0 -3
- package/client/setup/main.ts +7 -1
- package/client/shims.d.ts +2 -2
- package/dist/chunk-B2L4QLCB.mjs +1 -0
- package/dist/chunk-KRHFRLOW.js +1 -0
- package/dist/chunk-XWW4YHHO.mjs +2312 -0
- package/dist/chunk-YE3TWJS7.js +2312 -0
- package/dist/client/index.d.ts +5 -41
- package/dist/client/index.js +1 -1
- package/dist/client/index.mjs +1 -1
- package/dist/{index-afca77df.d.ts → index-cfcea95c.d.ts} +17 -2
- package/dist/node/cli.js +9 -42
- package/dist/node/cli.mjs +9 -42
- package/dist/node/index.d.ts +12 -5
- package/dist/node/index.js +1 -1
- package/dist/node/index.mjs +1 -1
- package/dist/types/index.d.ts +1 -1
- package/index.d.ts +3 -0
- package/package.json +10 -7
- package/client/components/PostCard.vue +0 -81
- package/client/components/PostList.vue +0 -50
- package/client/components/ValaxyBg.vue +0 -51
- package/client/components/ValaxyFooter.vue +0 -52
- package/client/pages/hi/[name].vue +0 -52
- package/client/pages/index.vue +0 -8
- package/client/pages/page/[page].vue +0 -12
- package/client/stores/user.ts +0 -35
- package/client/utils/sidebar.ts +0 -26
- package/dist/chunk-35O5DRGK.mjs +0 -2270
- package/dist/chunk-4VSND5ZW.mjs +0 -1
- package/dist/chunk-CDIW2WTI.js +0 -1
- package/dist/chunk-RGBLPQZ2.js +0 -2270
- package/dist/index-a6b0a69b.d.ts +0 -16
- package/shared/index.ts +0 -20
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { useI18n } from 'vue-i18n'
|
|
3
|
-
import type { Post } from '../../types'
|
|
4
|
-
import { usePostProperty } from '~/composables'
|
|
5
|
-
|
|
6
|
-
const props = defineProps<{
|
|
7
|
-
post: Post
|
|
8
|
-
}>()
|
|
9
|
-
|
|
10
|
-
const { t } = useI18n()
|
|
11
|
-
|
|
12
|
-
const { icon, styles } = usePostProperty(props.post.type)
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<template>
|
|
16
|
-
<YunCard m="y-4 auto" :class="post.cover ? 'post-card-image' : 'post-card'" :style="styles">
|
|
17
|
-
<div class="flex flex-1 of-hidden justify-start items-start post-card-info" w="full">
|
|
18
|
-
<img
|
|
19
|
-
v-if="post.cover"
|
|
20
|
-
:src="post.cover"
|
|
21
|
-
:alt="t('post.cover')"
|
|
22
|
-
width="320" height="180"
|
|
23
|
-
w="40%" h="54"
|
|
24
|
-
class="cover object-cover object-center md:shadow"
|
|
25
|
-
>
|
|
26
|
-
|
|
27
|
-
<div class="flex flex-col flex-1 items-center" :class="post.cover && 'max-h-54'" w="full">
|
|
28
|
-
<AppLink
|
|
29
|
-
class="post-title-link"
|
|
30
|
-
:to="post.path || ''"
|
|
31
|
-
m="t-3"
|
|
32
|
-
>
|
|
33
|
-
<div class="flex justify-center items-center title text-2xl" font="serif black">
|
|
34
|
-
<div v-if="post.type" class="inline-flex" m="r-1" :class="icon" />{{ post.title }}
|
|
35
|
-
</div>
|
|
36
|
-
</AppLink>
|
|
37
|
-
|
|
38
|
-
<YunPostMeta :frontmatter="post" />
|
|
39
|
-
|
|
40
|
-
<div v-if="post.excerpt" class="markdown-body" text="left" w="full" p="x-6 lt-sm:4" v-html="post.excerpt" />
|
|
41
|
-
<div m="b-5" />
|
|
42
|
-
|
|
43
|
-
<a
|
|
44
|
-
v-if="post.url"
|
|
45
|
-
:href="post.url"
|
|
46
|
-
class="post-link-btn shadow hover:shadow-md"
|
|
47
|
-
rounded
|
|
48
|
-
target="_blank"
|
|
49
|
-
m="b-4"
|
|
50
|
-
>
|
|
51
|
-
{{ t('post.view_link') }}
|
|
52
|
-
</a>
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
|
|
56
|
-
<!-- always show -->
|
|
57
|
-
<div w="full" class="yun-card-actions flex justify-between" border="t" text="sm">
|
|
58
|
-
<div class="inline-flex">
|
|
59
|
-
<router-link
|
|
60
|
-
:to="{
|
|
61
|
-
path: '/categories/',
|
|
62
|
-
query: { category: Array.isArray(post.categories) ? post.categories[post.categories.length - 1] : post.categories },
|
|
63
|
-
}"
|
|
64
|
-
class="post-categories inline-flex justify-center items-center" m="l-2"
|
|
65
|
-
>
|
|
66
|
-
<div m="x-1" i-ri-folder-2-line />
|
|
67
|
-
{{ Array.isArray(post.categories) ? post.categories.join(' > ') : post.categories }}
|
|
68
|
-
</router-link>
|
|
69
|
-
</div>
|
|
70
|
-
|
|
71
|
-
<div class="post-tags inline-flex" m="r-2">
|
|
72
|
-
<template v-if="post.tags">
|
|
73
|
-
<router-link v-for="tag, i in post.tags" :key="i" :to="{ path: '/tags/', query: { tag } }" m="x-1" class="post-tag inline-flex justify-center items-center">
|
|
74
|
-
<div m="r-1" i-ri-price-tag-3-line />
|
|
75
|
-
{{ tag }}
|
|
76
|
-
</router-link>
|
|
77
|
-
</template>
|
|
78
|
-
</div>
|
|
79
|
-
</div>
|
|
80
|
-
</YunCard>
|
|
81
|
-
</template>
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed, ref } from 'vue'
|
|
3
|
-
import type { Post } from 'valaxy'
|
|
4
|
-
import { usePostList } from '~/composables'
|
|
5
|
-
|
|
6
|
-
const props = withDefaults(defineProps<{
|
|
7
|
-
type?: string
|
|
8
|
-
posts?: Post[]
|
|
9
|
-
curPage?: number
|
|
10
|
-
}>(), {
|
|
11
|
-
curPage: 1,
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
const pageSize = ref(7)
|
|
15
|
-
|
|
16
|
-
const routes = usePostList({ type: props.type || '' })
|
|
17
|
-
const posts = computed(() => props.posts || routes.value)
|
|
18
|
-
const displayedPosts = computed(() => posts.value.slice((props.curPage - 1) * pageSize.value, props.curPage * pageSize.value))
|
|
19
|
-
</script>
|
|
20
|
-
|
|
21
|
-
<template>
|
|
22
|
-
<div w="full" p="x-4 lt-sm:0">
|
|
23
|
-
<template v-if="!displayedPosts.length">
|
|
24
|
-
<div py2 op50>
|
|
25
|
-
博主还什么都没写哦~
|
|
26
|
-
</div>
|
|
27
|
-
</template>
|
|
28
|
-
|
|
29
|
-
<Transition v-for="route, i in displayedPosts" :key="i" name="fade">
|
|
30
|
-
<PostCard :post="route" />
|
|
31
|
-
</Transition>
|
|
32
|
-
</div>
|
|
33
|
-
|
|
34
|
-
<ValaxyPagination :cur-page="curPage" :page-size="pageSize" :total="posts.length" />
|
|
35
|
-
</template>
|
|
36
|
-
|
|
37
|
-
<style>
|
|
38
|
-
.yun-card-actions {
|
|
39
|
-
border-top: 1px solid rgba(122, 122, 122, 0.15);
|
|
40
|
-
min-height: 2.5rem;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.post-categories {
|
|
44
|
-
color: var(--va-c-text);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.post-tag {
|
|
48
|
-
color: var(--va-c-text);
|
|
49
|
-
}
|
|
50
|
-
</style>
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { computed } from 'vue'
|
|
3
|
-
import { useThemeConfig } from 'valaxy'
|
|
4
|
-
import { useCssVar } from '@vueuse/core'
|
|
5
|
-
import { isDark } from '~/composables'
|
|
6
|
-
|
|
7
|
-
const themeConfig = useThemeConfig()
|
|
8
|
-
|
|
9
|
-
const bgImgOpacity = useCssVar('--va-bg-img-opacity')
|
|
10
|
-
if (themeConfig.value.bg_image.opacity)
|
|
11
|
-
bgImgOpacity.value = themeConfig.value.bg_image.opacity.toString() || '1'
|
|
12
|
-
|
|
13
|
-
const styles = computed(() => {
|
|
14
|
-
return {
|
|
15
|
-
backgroundImage: `url('${isDark.value
|
|
16
|
-
? themeConfig.value.bg_image.dark
|
|
17
|
-
: themeConfig.value.bg_image.url
|
|
18
|
-
}')`,
|
|
19
|
-
}
|
|
20
|
-
})
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<template>
|
|
24
|
-
<div class="va-bg" :style="styles" />
|
|
25
|
-
</template>
|
|
26
|
-
|
|
27
|
-
<style lang="scss">
|
|
28
|
-
.va-bg {
|
|
29
|
-
position: fixed;
|
|
30
|
-
width: 100%;
|
|
31
|
-
height: 100%;
|
|
32
|
-
z-index: -1;
|
|
33
|
-
background-image: var(--va-bg-image);
|
|
34
|
-
background-size: cover;
|
|
35
|
-
background-position: center;
|
|
36
|
-
background-repeat: no-repeat;
|
|
37
|
-
animation-name: bgFadeIn;
|
|
38
|
-
animation-duration: 2s;
|
|
39
|
-
opacity: var(--va-bg-img-opacity, 1);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@keyframes bgFadeIn {
|
|
43
|
-
from {
|
|
44
|
-
opacity: 0;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
to {
|
|
48
|
-
opacity: var(--va-bg-img-opacity, 1);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
</style>
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { capitalize, computed } from 'vue'
|
|
3
|
-
import { useConfig, useThemeConfig } from 'valaxy'
|
|
4
|
-
import { useI18n } from 'vue-i18n'
|
|
5
|
-
|
|
6
|
-
import pkg from '../../package.json'
|
|
7
|
-
|
|
8
|
-
const { t } = useI18n()
|
|
9
|
-
|
|
10
|
-
const config = useConfig()
|
|
11
|
-
const themeConfig = useThemeConfig()
|
|
12
|
-
|
|
13
|
-
const year = new Date().getFullYear()
|
|
14
|
-
|
|
15
|
-
const isThisYear = computed(() => {
|
|
16
|
-
return year === themeConfig.value.footer.since
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
const poweredHtml = computed(() => t('footer.powered', [`<a href="${pkg.repository}" target="_blank" rel="noopener">Valaxy</a> v${pkg.version}`]))
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<template>
|
|
23
|
-
<footer class="va-footer p-4" text="center sm" style="color:var(--va-c-text-light)">
|
|
24
|
-
<div v-if="themeConfig.footer.beian.enable && themeConfig.footer.beian.icp" class="beian" m="y-2">
|
|
25
|
-
<a href="https://beian.miit.gov.cn/" target="_blank" rel="noopener">
|
|
26
|
-
{{ themeConfig.footer.beian.icp }}
|
|
27
|
-
</a>
|
|
28
|
-
</div>
|
|
29
|
-
|
|
30
|
-
<div class="copyright flex justify-center items-center" p="1">
|
|
31
|
-
<span>
|
|
32
|
-
©
|
|
33
|
-
<template v-if="!isThisYear">
|
|
34
|
-
{{ themeConfig.footer.since }} -
|
|
35
|
-
</template>
|
|
36
|
-
{{ year }}
|
|
37
|
-
</span>
|
|
38
|
-
|
|
39
|
-
<a m="x-2" class="inline-flex animate-pulse" :href="themeConfig.footer.icon.url" target="_blank" :title="themeConfig.footer.icon.title">
|
|
40
|
-
<div :class="themeConfig.footer.icon.name" />
|
|
41
|
-
</a>
|
|
42
|
-
|
|
43
|
-
<span>{{ config.author.name }}</span>
|
|
44
|
-
</div>
|
|
45
|
-
|
|
46
|
-
<div v-if="themeConfig.footer.powered" class="powered" m="2">
|
|
47
|
-
<span v-html="poweredHtml" /> | <span>{{ t('footer.theme') }} - <a :href="themeConfig.pkg.homepage" :title="`valaxy-theme-${config.theme}`" target="_blank">{{ capitalize(config.theme) }}</a> v{{ themeConfig.pkg.version }}</span>
|
|
48
|
-
</div>
|
|
49
|
-
|
|
50
|
-
<slot />
|
|
51
|
-
</footer>
|
|
52
|
-
</template>
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { watchEffect } from 'vue'
|
|
3
|
-
import { useI18n } from 'vue-i18n'
|
|
4
|
-
import { useRouter } from 'vue-router'
|
|
5
|
-
import { useUserStore } from '~/stores/user'
|
|
6
|
-
|
|
7
|
-
const props = defineProps<{ name: string }>()
|
|
8
|
-
const router = useRouter()
|
|
9
|
-
const user = useUserStore()
|
|
10
|
-
const { t } = useI18n()
|
|
11
|
-
|
|
12
|
-
watchEffect(() => {
|
|
13
|
-
user.setNewName(props.name)
|
|
14
|
-
})
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<template>
|
|
18
|
-
<div>
|
|
19
|
-
<div text-4xl>
|
|
20
|
-
<div i-carbon-pedestrian inline-block />
|
|
21
|
-
</div>
|
|
22
|
-
<p>
|
|
23
|
-
{{ t('intro.hi', { name: props.name }) }}
|
|
24
|
-
</p>
|
|
25
|
-
|
|
26
|
-
<p text-sm opacity-50>
|
|
27
|
-
<em>{{ t('intro.dynamic-route') }}</em>
|
|
28
|
-
</p>
|
|
29
|
-
|
|
30
|
-
<template v-if="user.otherNames.length">
|
|
31
|
-
<p text-sm mt-4>
|
|
32
|
-
<span opacity-75>{{ t('intro.aka') }}:</span>
|
|
33
|
-
<ul>
|
|
34
|
-
<li v-for="otherName in user.otherNames" :key="otherName">
|
|
35
|
-
<router-link :to="`/hi/${otherName}`" replace>
|
|
36
|
-
{{ otherName }}
|
|
37
|
-
</router-link>
|
|
38
|
-
</li>
|
|
39
|
-
</ul>
|
|
40
|
-
</p>
|
|
41
|
-
</template>
|
|
42
|
-
|
|
43
|
-
<div>
|
|
44
|
-
<button
|
|
45
|
-
btn m="3 t6" text-sm
|
|
46
|
-
@click="router.back()"
|
|
47
|
-
>
|
|
48
|
-
{{ t('button.back') }}
|
|
49
|
-
</button>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
</template>
|
package/client/pages/index.vue
DELETED
package/client/stores/user.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { computed, ref } from 'vue'
|
|
2
|
-
import { acceptHMRUpdate, defineStore } from 'pinia'
|
|
3
|
-
|
|
4
|
-
export const useUserStore = defineStore('user', () => {
|
|
5
|
-
/**
|
|
6
|
-
* Current name of the user.
|
|
7
|
-
*/
|
|
8
|
-
const savedName = ref('')
|
|
9
|
-
const previousNames = ref(new Set<string>())
|
|
10
|
-
|
|
11
|
-
const usedNames = computed(() => Array.from(previousNames.value))
|
|
12
|
-
const otherNames = computed(() => usedNames.value.filter(name => name !== savedName.value))
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Changes the current name of the user and saves the one that was used
|
|
16
|
-
* before.
|
|
17
|
-
*
|
|
18
|
-
* @param name - new name to set
|
|
19
|
-
*/
|
|
20
|
-
function setNewName(name: string) {
|
|
21
|
-
if (savedName.value)
|
|
22
|
-
previousNames.value.add(savedName.value)
|
|
23
|
-
|
|
24
|
-
savedName.value = name
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
setNewName,
|
|
29
|
-
otherNames,
|
|
30
|
-
savedName,
|
|
31
|
-
}
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
if (import.meta.hot)
|
|
35
|
-
import.meta.hot.accept(acceptHMRUpdate(useUserStore, import.meta.hot))
|
package/client/utils/sidebar.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { YunTheme } from 'valaxy-theme-yun'
|
|
2
|
-
import { ensurePrefix } from '@antfu/utils'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Get the `Sidebar` from sidebar option. This method will ensure to get correct
|
|
6
|
-
* sidebar config from `MultiSideBarConfig` with various path combinations such
|
|
7
|
-
* as matching `guide/` and `/guide/`. If no matching config was found, it will
|
|
8
|
-
* return empty array.
|
|
9
|
-
*/
|
|
10
|
-
export function getSidebar(
|
|
11
|
-
sidebar: YunTheme.Sidebar,
|
|
12
|
-
path: string,
|
|
13
|
-
) {
|
|
14
|
-
if (Array.isArray(sidebar))
|
|
15
|
-
return sidebar
|
|
16
|
-
|
|
17
|
-
path = ensurePrefix('/', path)
|
|
18
|
-
|
|
19
|
-
for (const dir in sidebar) {
|
|
20
|
-
// make sure the multi sidebar key starts with slash too
|
|
21
|
-
if (path.startsWith(ensurePrefix('/', dir)))
|
|
22
|
-
return sidebar[dir]
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return []
|
|
26
|
-
}
|