valaxy-theme-press 0.0.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/LICENSE +21 -0
- package/components/PressArticle.vue +85 -0
- package/components/PressArticleCard.vue +28 -0
- package/components/PressAuthor.vue +55 -0
- package/components/PressDate.vue +21 -0
- package/components/PressHeader.vue +26 -0
- package/components/PressNav.vue +38 -0
- package/components/PressPostList.vue +26 -0
- package/components/PressToggleLocale.vue +13 -0
- package/components/ValaxyMain.vue +45 -0
- package/composables/config.ts +12 -0
- package/composables/index.ts +1 -0
- package/config/index.ts +29 -0
- package/layouts/404.vue +25 -0
- package/layouts/default.vue +5 -0
- package/layouts/home.vue +11 -0
- package/layouts/layout.vue +45 -0
- package/layouts/post.vue +5 -0
- package/node/index.ts +43 -0
- package/package.json +37 -0
- package/pages/index.vue +8 -0
- package/tsconfig.json +27 -0
- package/tsup.config.ts +16 -0
- package/types/index.ts +30 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 云游君 YunYouJun <me@yunyoujun.cn>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { useRoute } from 'vue-router'
|
|
4
|
+
|
|
5
|
+
import { useFrontmatter, usePostList } from 'valaxy'
|
|
6
|
+
const frontmatter = useFrontmatter()
|
|
7
|
+
|
|
8
|
+
const route = useRoute()
|
|
9
|
+
const posts = usePostList()
|
|
10
|
+
|
|
11
|
+
function findCurrentIndex() {
|
|
12
|
+
return posts.value.findIndex(p => p.href === route.path)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const nextPost = computed(() => posts.value[findCurrentIndex() - 1])
|
|
16
|
+
const prevPost = computed(() => posts.value[findCurrentIndex() + 1])
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<article class="xl:divide-y xl:divide-gray-200">
|
|
21
|
+
<header class="pt-6 xl:pb-10 space-y-1 text-center">
|
|
22
|
+
<PressDate :date="frontmatter.date" />
|
|
23
|
+
<h1
|
|
24
|
+
class="
|
|
25
|
+
text-3xl
|
|
26
|
+
leading-9
|
|
27
|
+
font-extrabold
|
|
28
|
+
text-gray-900
|
|
29
|
+
tracking-tight
|
|
30
|
+
sm:text-4xl sm:leading-10
|
|
31
|
+
md:text-5xl md:leading-14
|
|
32
|
+
"
|
|
33
|
+
>
|
|
34
|
+
{{ frontmatter.title }}
|
|
35
|
+
</h1>
|
|
36
|
+
</header>
|
|
37
|
+
|
|
38
|
+
<div
|
|
39
|
+
class="
|
|
40
|
+
divide-y
|
|
41
|
+
xl:divide-y-0
|
|
42
|
+
divide-gray-200
|
|
43
|
+
xl:grid xl:grid-cols-4 xl:gap-x-10
|
|
44
|
+
pb-16
|
|
45
|
+
xl:pb-20
|
|
46
|
+
"
|
|
47
|
+
style="grid-template-rows: auto 1fr"
|
|
48
|
+
>
|
|
49
|
+
<PressAuthor v-if="frontmatter.author" :frontmatter="frontmatter" />
|
|
50
|
+
<div class="divide-y divide-gray-200 xl:pb-0 xl:col-span-3 xl:row-span-2">
|
|
51
|
+
<router-view />
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<footer
|
|
55
|
+
class="
|
|
56
|
+
text-sm
|
|
57
|
+
font-medium
|
|
58
|
+
leading-5
|
|
59
|
+
divide-y divide-gray-200
|
|
60
|
+
xl:col-start-1 xl:row-start-2
|
|
61
|
+
"
|
|
62
|
+
>
|
|
63
|
+
<div v-if="nextPost" class="py-8">
|
|
64
|
+
<h2 class="text-xs tracking-wide uppercase text-gray-500">
|
|
65
|
+
Next Article
|
|
66
|
+
</h2>
|
|
67
|
+
<div class="link">
|
|
68
|
+
<a :href="nextPost.href">{{ nextPost.title }}</a>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
<div v-if="prevPost" class="py-8">
|
|
72
|
+
<h2 class="text-xs tracking-wide uppercase text-gray-500">
|
|
73
|
+
Previous Article
|
|
74
|
+
</h2>
|
|
75
|
+
<div class="link">
|
|
76
|
+
<a :href="prevPost.href">{{ prevPost.title }}</a>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
<div class="pt-8">
|
|
80
|
+
<a class="link" href="/">← Back to the blog</a>
|
|
81
|
+
</div>
|
|
82
|
+
</footer>
|
|
83
|
+
</div>
|
|
84
|
+
</article>
|
|
85
|
+
</template>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { Post } from 'valaxy'
|
|
3
|
+
|
|
4
|
+
defineProps<{
|
|
5
|
+
post: Post
|
|
6
|
+
}>()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<article class="space-y-2 xl:grid xl:grid-cols-4 xl:space-y-0 xl:items-baseline">
|
|
11
|
+
<PressDate :date="post.date" />
|
|
12
|
+
<div class="space-y-5 xl:col-span-3">
|
|
13
|
+
<div class="space-y-6">
|
|
14
|
+
<h2 class="text-2xl leading-8 font-bold tracking-tight">
|
|
15
|
+
<a class="text-gray-900" :href="post.path">{{ post.title }}</a>
|
|
16
|
+
</h2>
|
|
17
|
+
<div
|
|
18
|
+
v-if="post.excerpt"
|
|
19
|
+
class="prose max-w-none text-gray-500"
|
|
20
|
+
v-html="post.excerpt"
|
|
21
|
+
/>
|
|
22
|
+
</div>
|
|
23
|
+
<div class="text-base leading-6 font-medium">
|
|
24
|
+
<a class="link" aria-label="read more" :href="post.path">Read more →</a>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</article>
|
|
28
|
+
</template>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Post } from 'valaxy'
|
|
3
|
+
|
|
4
|
+
defineProps<{
|
|
5
|
+
frontmatter: Post
|
|
6
|
+
}>()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<dl class="pt-6 pb-10 xl:pt-11 xl:border-b xl:border-gray-200">
|
|
11
|
+
<dt class="sr-only">
|
|
12
|
+
Authors
|
|
13
|
+
</dt>
|
|
14
|
+
<dd>
|
|
15
|
+
<ul
|
|
16
|
+
class="
|
|
17
|
+
flex
|
|
18
|
+
justify-center
|
|
19
|
+
xl:block
|
|
20
|
+
space-x-8
|
|
21
|
+
sm:space-x-12
|
|
22
|
+
xl:space-x-0 xl:space-y-8
|
|
23
|
+
"
|
|
24
|
+
>
|
|
25
|
+
<li class="flex items-center space-x-2">
|
|
26
|
+
<img
|
|
27
|
+
v-if="frontmatter.gravatar"
|
|
28
|
+
:src="`https://gravatar.com/avatar/${frontmatter.gravatar}`"
|
|
29
|
+
alt="author image"
|
|
30
|
+
class="w-10 h-10 rounded-full"
|
|
31
|
+
>
|
|
32
|
+
<dl class="text-sm font-medium leading-5 whitespace-nowrap">
|
|
33
|
+
<dt class="sr-only">
|
|
34
|
+
Name
|
|
35
|
+
</dt>
|
|
36
|
+
<dd class="text-gray-900">
|
|
37
|
+
{{ frontmatter.author }}
|
|
38
|
+
</dd>
|
|
39
|
+
<dt v-if="frontmatter.twitter" class="sr-only">
|
|
40
|
+
Twitter
|
|
41
|
+
</dt>
|
|
42
|
+
<dd v-if="frontmatter.twitter">
|
|
43
|
+
<a
|
|
44
|
+
:href="`https://twitter.com/${frontmatter.twitter}`"
|
|
45
|
+
target="_blank"
|
|
46
|
+
rel="noopnener noreferrer"
|
|
47
|
+
class="link"
|
|
48
|
+
>{{ frontmatter.twitter }}</a>
|
|
49
|
+
</dd>
|
|
50
|
+
</dl>
|
|
51
|
+
</li>
|
|
52
|
+
</ul>
|
|
53
|
+
</dd>
|
|
54
|
+
</dl>
|
|
55
|
+
</template>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { formatDate } from 'valaxy'
|
|
3
|
+
import { computed } from 'vue'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
date?: Date | number | string
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const datetime = computed(() => formatDate(props.date || ''))
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<dl>
|
|
14
|
+
<dt class="sr-only">
|
|
15
|
+
Published on
|
|
16
|
+
</dt>
|
|
17
|
+
<dd class="text-base leading-6 font-medium text-gray-500">
|
|
18
|
+
<time :datetime="datetime">{{ datetime }}</time>
|
|
19
|
+
</dd>
|
|
20
|
+
</dl>
|
|
21
|
+
</template>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useConfig } from 'valaxy'
|
|
3
|
+
|
|
4
|
+
const config = useConfig()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<div class="pt-6 pb-8 space-y-2 md:space-y-5">
|
|
9
|
+
<h1
|
|
10
|
+
class="
|
|
11
|
+
text-3xl
|
|
12
|
+
leading-9
|
|
13
|
+
font-extrabold
|
|
14
|
+
text-gray-900
|
|
15
|
+
tracking-tight
|
|
16
|
+
sm:text-4xl sm:leading-10
|
|
17
|
+
md:text-6xl md:leading-14
|
|
18
|
+
"
|
|
19
|
+
>
|
|
20
|
+
{{ config.title }}
|
|
21
|
+
</h1>
|
|
22
|
+
<p class="text-lg leading-7 text-gray-500">
|
|
23
|
+
{{ config.subtitle }}
|
|
24
|
+
</p>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useConfig } from 'valaxy'
|
|
3
|
+
import { computed } from 'vue'
|
|
4
|
+
import { useRoute } from 'vue-router'
|
|
5
|
+
import { useThemeConfig } from '../composables'
|
|
6
|
+
|
|
7
|
+
const route = useRoute()
|
|
8
|
+
const isIndex = computed(() => route.path.replace(/index.html$/, '') === '/')
|
|
9
|
+
|
|
10
|
+
const config = useConfig()
|
|
11
|
+
const themeConfig = useThemeConfig()
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<nav w="full" class="flex justify-between items-center py-10 font-bold">
|
|
16
|
+
<a class="text-xl" href="/" :aria-label="config.title">
|
|
17
|
+
<img
|
|
18
|
+
class="inline-block mr-2"
|
|
19
|
+
style="width: 50px; height: 35px"
|
|
20
|
+
alt="logo"
|
|
21
|
+
:src="config.favicon"
|
|
22
|
+
>
|
|
23
|
+
<span v-if="!isIndex" class="hidden md:inline">{{ config.title }}</span>
|
|
24
|
+
</a>
|
|
25
|
+
<div class="text-sm text-gray-500 leading-5">
|
|
26
|
+
<template v-for="(item, i) in themeConfig.nav" :key="i">
|
|
27
|
+
<a
|
|
28
|
+
class="hover:text-gray-700"
|
|
29
|
+
:href="item.link"
|
|
30
|
+
target="_blank"
|
|
31
|
+
rel="noopener"
|
|
32
|
+
>{{ item.text }}</a>
|
|
33
|
+
|
|
34
|
+
<span v-if="i !== themeConfig.nav.length - 1" class="mr-2 ml-2">·</span>
|
|
35
|
+
</template>
|
|
36
|
+
</div>
|
|
37
|
+
</nav>
|
|
38
|
+
</template>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import type { Post } from 'valaxy'
|
|
4
|
+
import { usePostList } from 'valaxy'
|
|
5
|
+
|
|
6
|
+
const props = withDefaults(defineProps<{
|
|
7
|
+
type?: string
|
|
8
|
+
posts?: Post[]
|
|
9
|
+
curPage?: number
|
|
10
|
+
}>(), {
|
|
11
|
+
curPage: 1,
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
const routes = usePostList({ type: props.type || '' })
|
|
15
|
+
const posts = computed(() => props.posts || routes.value)
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<ul class="divide-y divide-gray-200">
|
|
20
|
+
<Transition v-for="post, i in posts" :key="i" name="fade">
|
|
21
|
+
<li class="py-12">
|
|
22
|
+
<PressArticleCard :post="post" />
|
|
23
|
+
</li>
|
|
24
|
+
</Transition>
|
|
25
|
+
</ul>
|
|
26
|
+
</template>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useI18n } from 'vue-i18n'
|
|
3
|
+
import { useLocale } from 'valaxy'
|
|
4
|
+
|
|
5
|
+
const { t, locale } = useI18n()
|
|
6
|
+
const { toggleLocales } = useLocale()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<button class="yun-icon-btn" :title="t('button.toggle_langs')" style="color:var(--va-c-text)" @click="toggleLocales">
|
|
11
|
+
<div i-ri-translate class="transition transform" :class="locale === 'en' ? 'rotate-y-180' : ''" />
|
|
12
|
+
</button>
|
|
13
|
+
</template>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { PageData, Post } from 'valaxy'
|
|
3
|
+
import { useConfig } from 'valaxy'
|
|
4
|
+
|
|
5
|
+
defineProps<{
|
|
6
|
+
frontmatter: Post
|
|
7
|
+
data?: PageData
|
|
8
|
+
}>()
|
|
9
|
+
const config = useConfig()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<main>
|
|
14
|
+
<div w="full" flex="~">
|
|
15
|
+
<slot name="main">
|
|
16
|
+
<div class="content" flex="~ col grow" w="full" p="l-4 lt-md:0">
|
|
17
|
+
<slot name="main-header" />
|
|
18
|
+
<slot name="main-header-after" />
|
|
19
|
+
|
|
20
|
+
<slot name="main-content">
|
|
21
|
+
<div class="markdown-body prose max-w-none pb-8">
|
|
22
|
+
<ValaxyMd :frontmatter="frontmatter">
|
|
23
|
+
<slot name="main-content-md" />
|
|
24
|
+
<slot />
|
|
25
|
+
</ValaxyMd>
|
|
26
|
+
</div>
|
|
27
|
+
<slot name="main-content-after" />
|
|
28
|
+
</slot>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<slot name="main-nav-before" />
|
|
32
|
+
|
|
33
|
+
<slot name="main-nav" />
|
|
34
|
+
|
|
35
|
+
<slot name="main-nav-after" />
|
|
36
|
+
|
|
37
|
+
<slot v-if="config.comment.enable && frontmatter.comment !== false" name="comment" />
|
|
38
|
+
|
|
39
|
+
<slot name="footer" />
|
|
40
|
+
</slot>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<slot name="aside" />
|
|
44
|
+
</main>
|
|
45
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { computed } from 'vue'
|
|
2
|
+
import { useConfig } from 'valaxy'
|
|
3
|
+
import type { ThemeConfig } from '../types'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* getThemeConfig
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export function useThemeConfig<T = ThemeConfig>() {
|
|
10
|
+
const config = useConfig<T>()
|
|
11
|
+
return computed(() => config!.value.themeConfig)
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './config'
|
package/config/index.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ThemeConfig, ThemeUserConfig } from '../types'
|
|
2
|
+
|
|
3
|
+
export const anonymousImage = 'https://cdn.yunyoujun.cn/img/avatar/none.jpg'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Default Config
|
|
7
|
+
*/
|
|
8
|
+
export const defaultThemeConfig: ThemeConfig = {
|
|
9
|
+
outlineTitle: 'On this page',
|
|
10
|
+
|
|
11
|
+
colors: {
|
|
12
|
+
primary: '#0078E7',
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
nav: [],
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default defaultThemeConfig
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* generateSafelist by config
|
|
22
|
+
* @param themeConfig
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
26
|
+
export function generateSafelist(themeConfig: ThemeUserConfig) {
|
|
27
|
+
const safelist: string[] = []
|
|
28
|
+
return safelist
|
|
29
|
+
}
|
package/layouts/404.vue
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useRouter } from 'vue-router'
|
|
3
|
+
import { useI18n } from 'vue-i18n'
|
|
4
|
+
|
|
5
|
+
const router = useRouter()
|
|
6
|
+
const { t } = useI18n()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<Layout>
|
|
11
|
+
<template #content>
|
|
12
|
+
<div text="center">
|
|
13
|
+
<div text-4xl>
|
|
14
|
+
<div i-ri-alarm-warning-line inline-block />
|
|
15
|
+
</div>
|
|
16
|
+
<router-view />
|
|
17
|
+
<div>
|
|
18
|
+
<button btn text-sm m="3 t8" @click="router.back()">
|
|
19
|
+
{{ t('button.back') }}
|
|
20
|
+
</button>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
</Layout>
|
|
25
|
+
</template>
|
package/layouts/home.vue
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="antialiased">
|
|
3
|
+
<div class="max-w-3xl mx-auto px-4 sm:px-6 xl:max-w-5xl xl:px-0">
|
|
4
|
+
<PressNav />
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<main class="max-w-3xl mx-auto px-4 sm:px-6 xl:max-w-5xl xl:px-0">
|
|
8
|
+
<slot>
|
|
9
|
+
<router-view v-slot="{ Component }">
|
|
10
|
+
<component :is="Component">
|
|
11
|
+
<template #main-header>
|
|
12
|
+
<slot name="main-header" />
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<template #main-header-after>
|
|
16
|
+
<slot name="main-header-after" />
|
|
17
|
+
</template>
|
|
18
|
+
<template #main>
|
|
19
|
+
<slot name="main" />
|
|
20
|
+
</template>
|
|
21
|
+
<template #main-content>
|
|
22
|
+
<slot name="main-content" />
|
|
23
|
+
</template>
|
|
24
|
+
<template #main-content-after>
|
|
25
|
+
<slot name="main-content-after" />
|
|
26
|
+
</template>
|
|
27
|
+
<template #main-nav-before>
|
|
28
|
+
<slot name="main-nav-before" />
|
|
29
|
+
</template>
|
|
30
|
+
<template #main-nav-after>
|
|
31
|
+
<slot name="main-nav-after" />
|
|
32
|
+
</template>
|
|
33
|
+
<template #aside-custom>
|
|
34
|
+
<slot name="aside-custom" />
|
|
35
|
+
</template>
|
|
36
|
+
<template #footer>
|
|
37
|
+
<slot name="footer" />
|
|
38
|
+
</template>
|
|
39
|
+
</component>
|
|
40
|
+
</router-view>
|
|
41
|
+
</slot>
|
|
42
|
+
</main>
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
45
|
+
|
package/layouts/post.vue
ADDED
package/node/index.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { defineThemePlugin } from 'valaxy'
|
|
2
|
+
import type { ResolvedValaxyOptions } from 'valaxy'
|
|
3
|
+
import type { Plugin } from 'vite'
|
|
4
|
+
|
|
5
|
+
export * from '../config'
|
|
6
|
+
export * from '../types'
|
|
7
|
+
|
|
8
|
+
export interface UserOptions {
|
|
9
|
+
colors: {
|
|
10
|
+
primary: string
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function ThemeYunVitePlugin(options: ResolvedValaxyOptions): Plugin {
|
|
15
|
+
const themeConfig = options.config.themeConfig
|
|
16
|
+
return {
|
|
17
|
+
name: 'valaxy-theme-yun',
|
|
18
|
+
enforce: 'pre',
|
|
19
|
+
config() {
|
|
20
|
+
return {
|
|
21
|
+
css: {
|
|
22
|
+
preprocessorOptions: {
|
|
23
|
+
scss: {
|
|
24
|
+
additionalData: `$c-primary: ${themeConfig.colors?.primary || '#0078E7'} !default;`,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
optimizeDeps: {
|
|
30
|
+
exclude: ['@docsearch/js'],
|
|
31
|
+
},
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default defineThemePlugin((options) => {
|
|
38
|
+
return {
|
|
39
|
+
vite: {
|
|
40
|
+
plugins: [ThemeYunVitePlugin(options)],
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
})
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "valaxy-theme-press",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Docs Theme for Valaxy",
|
|
5
|
+
"author": {
|
|
6
|
+
"email": "me@yunyoujun.cn",
|
|
7
|
+
"name": "YunYouJun",
|
|
8
|
+
"url": "https://www.yunyoujun.cn"
|
|
9
|
+
},
|
|
10
|
+
"maintainers": [],
|
|
11
|
+
"homepage": "https://press.valaxy.site",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/YunYouJun/valaxy/tree/main/packages/valaxy-theme-press"
|
|
15
|
+
},
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"require": "./dist/index.js",
|
|
19
|
+
"import": "./dist/index.mjs"
|
|
20
|
+
},
|
|
21
|
+
"./*": "./*"
|
|
22
|
+
},
|
|
23
|
+
"main": "dist/index.js",
|
|
24
|
+
"module": "dist/index.mjs",
|
|
25
|
+
"types": "dist/index.d.ts",
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@docsearch/css": "^3.1.1",
|
|
28
|
+
"@docsearch/js": "^3.1.1"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"valaxy": "0.9.0"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "rimraf dist && tsup",
|
|
35
|
+
"dev": "tsup --watch"
|
|
36
|
+
}
|
|
37
|
+
}
|
package/pages/index.vue
ADDED
package/tsconfig.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
// we need tsconfig.json to compile without
|
|
3
|
+
// error: This is likely not portable. A type annotation is necessary.
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"baseUrl": ".",
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"target": "ESNext",
|
|
9
|
+
"lib": ["DOM", "ESNext"],
|
|
10
|
+
"strict": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"jsx": "preserve",
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
"moduleResolution": "node",
|
|
15
|
+
"resolveJsonModule": true,
|
|
16
|
+
"noUnusedLocals": true,
|
|
17
|
+
"strictNullChecks": true,
|
|
18
|
+
"forceConsistentCasingInFileNames": true,
|
|
19
|
+
"types": [
|
|
20
|
+
"vite/client",
|
|
21
|
+
"vue/ref-macros",
|
|
22
|
+
"vite-plugin-pages/client",
|
|
23
|
+
"vite-plugin-vue-layouts/client"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"exclude": ["**/dist/**", "node_modules"]
|
|
27
|
+
}
|
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineConfig } from 'tsup'
|
|
2
|
+
|
|
3
|
+
export default defineConfig((options) => {
|
|
4
|
+
return {
|
|
5
|
+
entry: ['node/index.ts'],
|
|
6
|
+
// disable for dev watch before valaxy watch
|
|
7
|
+
clean: !options.watch,
|
|
8
|
+
dts: true,
|
|
9
|
+
format: ['cjs', 'esm'],
|
|
10
|
+
minify: !options.watch,
|
|
11
|
+
external: [
|
|
12
|
+
'valaxy',
|
|
13
|
+
'vite',
|
|
14
|
+
],
|
|
15
|
+
}
|
|
16
|
+
})
|
package/types/index.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export namespace DocsTheme {
|
|
2
|
+
export type Config = ThemeConfig
|
|
3
|
+
export type Sidebar = any
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Theme Config
|
|
8
|
+
*/
|
|
9
|
+
export interface ThemeConfig {
|
|
10
|
+
/**
|
|
11
|
+
* toc title
|
|
12
|
+
* @default 'On this page'
|
|
13
|
+
*/
|
|
14
|
+
outlineTitle: string
|
|
15
|
+
|
|
16
|
+
colors: {
|
|
17
|
+
/**
|
|
18
|
+
* primary color
|
|
19
|
+
* @default '#0078E7'
|
|
20
|
+
*/
|
|
21
|
+
primary: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
nav: {
|
|
25
|
+
link: string
|
|
26
|
+
text: string
|
|
27
|
+
}[]
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type ThemeUserConfig = Partial<ThemeConfig>
|