valaxy-theme-yun 0.0.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.
Files changed (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +33 -0
  3. package/components/YunAlgoliaSearch.vue +228 -0
  4. package/components/YunBackToTop.vue +59 -0
  5. package/components/YunBanner.vue +70 -0
  6. package/components/YunBase.vue +24 -0
  7. package/components/YunCard.vue +29 -0
  8. package/components/YunCategories.vue +45 -0
  9. package/components/YunCategory.vue +39 -0
  10. package/components/YunCloud.vue +76 -0
  11. package/components/YunConfig.vue +24 -0
  12. package/components/YunGirls.vue +104 -0
  13. package/components/YunGoDown.vue +46 -0
  14. package/components/YunLinks.vue +109 -0
  15. package/components/YunPageHeader.vue +16 -0
  16. package/components/YunPostCollapse.vue +187 -0
  17. package/components/YunPostMeta.vue +29 -0
  18. package/components/YunPostNav.vue +89 -0
  19. package/components/YunSay.vue +83 -0
  20. package/components/YunSidebar.vue +111 -0
  21. package/components/YunSidebarLinks.vue +30 -0
  22. package/components/YunSidebarNav.vue +95 -0
  23. package/components/YunSocialLinks.vue +31 -0
  24. package/components/YunSponsor.vue +75 -0
  25. package/components/YunWaline.vue +26 -0
  26. package/composables/index.ts +25 -0
  27. package/config/index.ts +192 -0
  28. package/dist/index.d.ts +93 -0
  29. package/dist/index.js +1 -0
  30. package/dist/index.mjs +1 -0
  31. package/index.ts +1 -0
  32. package/layouts/404.vue +25 -0
  33. package/layouts/archives.vue +21 -0
  34. package/layouts/base.vue +64 -0
  35. package/layouts/categories.vue +66 -0
  36. package/layouts/default.vue +7 -0
  37. package/layouts/home.vue +27 -0
  38. package/layouts/post.vue +22 -0
  39. package/layouts/tags.vue +83 -0
  40. package/locales/en.yml +0 -0
  41. package/locales/zh-CN.yml +0 -0
  42. package/package.json +25 -0
  43. package/styles/index.scss +2 -0
  44. package/styles/layout/index.scss +7 -0
  45. package/styles/layout/post.scss +86 -0
  46. package/styles/markdown.scss +31 -0
  47. package/styles/vars.scss +7 -0
  48. package/tsup.config.ts +13 -0
  49. package/utils/index.ts +5 -0
@@ -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
+ <YunBase>
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
+ </YunBase>
25
+ </template>
@@ -0,0 +1,21 @@
1
+ <script lang="ts" setup>
2
+ import { useFrontmatter, usePostList } from 'valaxy'
3
+ import { useI18n } from 'vue-i18n'
4
+
5
+ const { t } = useI18n()
6
+
7
+ const frontmatter = useFrontmatter()
8
+ const postList = usePostList()
9
+ </script>
10
+
11
+ <template>
12
+ <YunBase>
13
+ <template #header>
14
+ <YunPageHeader :title="frontmatter.title || t('menu.archives')" :icon="frontmatter.icon || 'i-ri-archive-line'" :color="frontmatter.color" />
15
+ </template>
16
+ <template #content>
17
+ <router-view />
18
+ <YunPostCollapse :posts="postList" />
19
+ </template>
20
+ </YunBase>
21
+ </template>
@@ -0,0 +1,64 @@
1
+ <script lang="ts" setup>
2
+ import { useConfig, useFrontmatter, usePostProperty } from 'valaxy'
3
+ const frontmatter = useFrontmatter()
4
+
5
+ const config = useConfig()
6
+
7
+ const { styles, icon, color } = usePostProperty(frontmatter.value.type)
8
+ </script>
9
+
10
+ <template>
11
+ <ValaxySidebar />
12
+
13
+ <main class="yun-main flex lt-md:ml-0">
14
+ <div flex="~ 1 col" w="full" p="l-4 lt-md:0">
15
+ <YunCard m="0" p="4" class="page-card sm:p-6 lg:px-12 xl:px-16" :style="styles">
16
+ <slot name="header">
17
+ <YunPageHeader :title="frontmatter.title" :icon="frontmatter.icon || icon" :color="frontmatter.color || color" />
18
+ </slot>
19
+ <template #content>
20
+ <slot name="content">
21
+ <router-view />
22
+ </slot>
23
+ </template>
24
+ </YunCard>
25
+
26
+ <slot :frontmatter="frontmatter" />
27
+
28
+ <slot name="nav">
29
+ <YunPostNav v-if="frontmatter.nav !== false" />
30
+ </slot>
31
+
32
+ <slot v-if="frontmatter.comment !== false" name="comment">
33
+ <YunCard v-if="config.comment.waline.enable" w="full" p="4" class="comment sm:p-8 lg:px-12 xl:px-16" :class="frontmatter.nav === false ? 'mt-4' : 0">
34
+ <YunWaline />
35
+ </YunCard>
36
+ </slot>
37
+
38
+ <ValaxyFooter>
39
+ <slot name="footer" />
40
+ </ValaxyFooter>
41
+ </div>
42
+
43
+ <slot name="right-sidebar">
44
+ <ValaxyRightSidebar :frontmatter="frontmatter" class="lt-xl:hidden">
45
+ <template #custom>
46
+ <slot name="right-custom" />
47
+ </template>
48
+ </ValaxyRightSidebar>
49
+ </slot>
50
+ </main>
51
+
52
+ <YunAlgoliaSearch v-if="config.search.algolia.enable" />
53
+ <YunBackToTop />
54
+ </template>
55
+
56
+ <style lang="scss">
57
+ @use '~/styles/mixins' as *;
58
+ @include xl {
59
+ .page-card {
60
+ // 8px scrollbar width
61
+ max-width: calc(100vw - 2 * var(--yun-sidebar-width-mobile) - 2rem - 8px);
62
+ }
63
+ }
64
+ </style>
@@ -0,0 +1,66 @@
1
+ <script lang="ts" setup>
2
+ import { computed, ref } from 'vue'
3
+ import { useCategory, useFrontmatter, useInvisibleElement, usePostList } from 'valaxy'
4
+ import { useI18n } from 'vue-i18n'
5
+ import { useRoute, useRouter } from 'vue-router'
6
+
7
+ const { t } = useI18n()
8
+
9
+ const frontmatter = useFrontmatter()
10
+ const categories = useCategory()
11
+
12
+ const route = useRoute()
13
+ const curCategory = computed(() => (route.query.category as string || ''))
14
+
15
+ const postList = usePostList()
16
+ const posts = computed(() => {
17
+ const list = postList.value.filter((post) => {
18
+ if (post.categories) {
19
+ if (typeof post.categories === 'string')
20
+ return post.categories === curCategory.value
21
+ else
22
+ return post.categories.includes(curCategory.value)
23
+ }
24
+ return false
25
+ })
26
+ return list
27
+ })
28
+
29
+ const collapse = ref()
30
+ const { show } = useInvisibleElement(collapse)
31
+
32
+ const router = useRouter()
33
+ const displayCategory = (category: string) => {
34
+ router.push({
35
+ query: {
36
+ category,
37
+ },
38
+ })
39
+
40
+ show()
41
+ }
42
+ </script>
43
+
44
+ <template>
45
+ <YunBase>
46
+ <template #header>
47
+ <YunPageHeader
48
+ :title="frontmatter.title || t('menu.categories')"
49
+ :icon="frontmatter.icon || 'i-ri-folder-2-line'"
50
+ :color="frontmatter.color"
51
+ />
52
+ </template>
53
+ <template #content>
54
+ <div text="center" class="yun-text-light" p="2">
55
+ {{ t('counter.categories', categories.children!.size ) }}
56
+ </div>
57
+ <YunCategories :categories="categories.children!" :display-category="displayCategory" />
58
+ <router-view />
59
+ </template>
60
+
61
+ <YunCard v-if="curCategory" ref="collapse" m="t-4" w="full">
62
+ <YunPageHeader m="t-4" :title="curCategory" icon="i-ri-folder-open-line" />
63
+ <YunPostCollapse w="full" m="b-4" p="x-20 lt-sm:x-5" :posts="posts" />
64
+ </YunCard>
65
+ </YunBase>
66
+ </template>
@@ -0,0 +1,7 @@
1
+ <template>
2
+ <YunBase>
3
+ <template #content>
4
+ <router-view />
5
+ </template>
6
+ </YunBase>
7
+ </template>
@@ -0,0 +1,27 @@
1
+ <script lang="ts" setup>
2
+ import { useConfig } from 'valaxy'
3
+ import { useLayout } from '~/composables'
4
+
5
+ import { useAppStore } from '~/stores/app'
6
+ const app = useAppStore()
7
+
8
+ const config = useConfig()
9
+
10
+ const isHome = useLayout('home')
11
+ </script>
12
+
13
+ <template>
14
+ <main class="yun-main justify-center items-center" :class="(isHome && !app.isSidebarOpen) && 'pl-0'" flex="~ col" w="full">
15
+ <ValaxySidebar />
16
+ <YunBanner />
17
+ <YunSay w="full" />
18
+
19
+ <router-view />
20
+
21
+ <ValaxyFooter>
22
+ <slot name="footer" />
23
+ </ValaxyFooter>
24
+ </main>
25
+
26
+ <YunAlgoliaSearch v-if="config.search.algolia.enable" />
27
+ </template>
@@ -0,0 +1,22 @@
1
+ <script lang="ts" setup>
2
+ import { useConfig, useFrontmatter, useFullUrl } from 'valaxy'
3
+
4
+ const config = useConfig()
5
+ const frontmatter = useFrontmatter()
6
+ const url = useFullUrl()
7
+ </script>
8
+
9
+ <template>
10
+ <YunBase>
11
+ <template #content>
12
+ <main text="left" m="auto" p="t-0 b-2">
13
+ <slot name="header">
14
+ <YunPostMeta :frontmatter="frontmatter" />
15
+ </slot>
16
+ <router-view />
17
+ <YunSponsor v-if="frontmatter.sponsor || config.sponsor.enable" />
18
+ <ValaxyCopyright v-if="frontmatter.copyright || config.license.enabled" :url="url" m="y-4" />
19
+ </main>
20
+ </template>
21
+ </YunBase>
22
+ </template>
@@ -0,0 +1,83 @@
1
+ <script lang="ts" setup>
2
+ import { useFrontmatter, useInvisibleElement, usePostList, useTags } from 'valaxy'
3
+ import { useI18n } from 'vue-i18n'
4
+ import { computed, ref } from 'vue'
5
+ import { useRoute, useRouter } from 'vue-router'
6
+
7
+ const route = useRoute()
8
+ const router = useRouter()
9
+
10
+ const { t } = useI18n()
11
+ const frontmatter = useFrontmatter()
12
+ const { tags, getTagStyle } = useTags()
13
+
14
+ const postList = usePostList()
15
+ const curTag = computed(() => route.query.tag as string || '')
16
+
17
+ const posts = computed(() => {
18
+ const list = postList.value.filter((post) => {
19
+ if (post.tags) {
20
+ if (typeof post.tags === 'string')
21
+ return post.tags === curTag.value
22
+ else
23
+ return post.tags.includes(curTag.value)
24
+ }
25
+ return false
26
+ })
27
+ return list
28
+ })
29
+
30
+ const collapse = ref()
31
+ const { show } = useInvisibleElement(collapse)
32
+
33
+ const displayTag = (tag: string) => {
34
+ router.push({
35
+ query: {
36
+ tag,
37
+ },
38
+ })
39
+
40
+ show()
41
+ }
42
+
43
+ </script>
44
+
45
+ <template>
46
+ <YunBase>
47
+ <template #header>
48
+ <YunPageHeader
49
+ :title="frontmatter.title || t('menu.tags')"
50
+ :icon="frontmatter.icon || 'i-ri-tag-line'"
51
+ :color="frontmatter.color"
52
+ />
53
+ </template>
54
+ <template #content>
55
+ <div class="yun-text-light" text="center" p="2">
56
+ {{ t('counter.tags', Array.from(tags).length) }}
57
+ </div>
58
+
59
+ <div text="center">
60
+ <span v-for="[key, tag] in Array.from(tags).sort()" :key="key" class="post-tag cursor-pointer" :style="getTagStyle(tag.count)" p="1" @click="displayTag(key.toString())">
61
+ #{{ key }}<span text="xs">[{{ tag.count }}]</span>
62
+ </span>
63
+ </div>
64
+
65
+ <router-view />
66
+ </template>
67
+
68
+ <YunCard v-if="curTag" ref="collapse" m="t-4" w="full">
69
+ <YunPageHeader m="t-4" :title="curTag" icon="i-ri-hashtag" />
70
+ <YunPostCollapse w="full" m="b-4" p="x-20 lt-sm:x-5" :posts="posts" />
71
+ </YunCard>
72
+ </YunBase>
73
+ </template>
74
+
75
+ <style lang="scss">
76
+ .post-tag {
77
+ color: var(--yun-tag-color);
78
+
79
+ &:hover {
80
+ color: var(--yun-c-primary);
81
+ }
82
+ }
83
+ </style>
package/locales/en.yml ADDED
File without changes
File without changes
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "valaxy-theme-yun",
3
+ "version": "0.0.5",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/YunYouJun/valaxy/tree/main/packages/valaxy-theme-yun"
9
+ },
10
+ "homepage": "https://valaxy.yyj.moe/",
11
+ "dependencies": {
12
+ "@iconify-json/ant-design": "^1.1.1",
13
+ "@iconify-json/simple-icons": "^1.1.6"
14
+ },
15
+ "author": {
16
+ "email": "me@yunyoujun.cn",
17
+ "name": "YunYouJun",
18
+ "url": "https://www.yunyoujun.cn"
19
+ },
20
+ "scripts": {
21
+ "build": "tsup",
22
+ "dev": "tsup --watch"
23
+ },
24
+ "readme": "<p align='center'>\n <img width=\"200\" src=\"https://cdn.jsdelivr.net/gh/YunYouJun/yun/images/meme/yun-good-alpha-compressed.png\">\n</p>\n\n<p align='center'>\nTheme-Yun<sup><em>(vue)</em></sup>\n</p>\n\n## Usage\n\nTODO\n\n### Development\n\nJust run and visit <http://localhost:3333>\n\n```bash\npnpm dev\n```\n\n### Build\n\n```bash\npnpm build\n```\n\n## [Sponsors](https://sponsors.yunyoujun.cn)\n\n<p align=\"center\">\n <a href=\"https://cdn.jsdelivr.net/gh/YunYouJun/sponsors/public/sponsors.svg\">\n <img src='https://cdn.jsdelivr.net/gh/YunYouJun/sponsors/public/sponsors.svg'/>\n </a>\n</p>\n"
25
+ }
@@ -0,0 +1,2 @@
1
+ @use './layout' as *;
2
+ @use './markdown' as *;
@@ -0,0 +1,7 @@
1
+ @use "~/styles/mixins" as *;
2
+ @use "./post" as *;
3
+
4
+ .yun-main {
5
+ padding-left: var(--yun-sidebar-width-mobile);
6
+ transition: padding-left var(--yun-transition-duration);
7
+ }
@@ -0,0 +1,86 @@
1
+ @use 'sass:map';
2
+ @use '~/styles/mixins' as *;
3
+ @use '~/styles/palette.scss' as *;
4
+
5
+ .post-card {
6
+ position: relative;
7
+ max-width: 900px;
8
+ }
9
+
10
+
11
+ .post-title {
12
+ display: flex;
13
+ justify-content: center;
14
+ align-items: center;
15
+
16
+ .icon {
17
+ font-size: 1.4rem;
18
+ }
19
+ }
20
+
21
+ .post-title-link {
22
+ position: relative;
23
+ padding: 0.7rem 1.2rem;
24
+ color: var(--card-c-primary, var(--yun-c-link));
25
+
26
+ .icon {
27
+ width: 1.6rem;
28
+ height: 1.6rem;
29
+ margin-right: 0.4rem;
30
+ }
31
+
32
+ &::before, &::after {
33
+ content: '';
34
+ position: absolute;
35
+ width: 10px;
36
+ height: 10px;
37
+ opacity: 0;
38
+ border: 2px solid;
39
+ transition: 0.3s;
40
+ transition-timing-function: cubic-bezier(0.17, 0.67, 0.05, 1.29);
41
+ }
42
+
43
+ &::before {
44
+ top: 0;
45
+ left: 0;
46
+ border-width: 2px 0 0 2px;
47
+ transform: translate3d(10px, 10px, 0);
48
+ }
49
+
50
+ &::after {
51
+ right: 0;
52
+ bottom: 0;
53
+ border-width: 0 2px 2px 0;
54
+ transform: translate3d(-10px, -10px, 0);
55
+ }
56
+
57
+ &:hover::before, &:hover::after {
58
+ opacity: 1;
59
+ transform: translate3d(0, 0, 0);
60
+ }
61
+ }
62
+
63
+ .post-top-icon {
64
+ position: absolute;
65
+ top: 1rem;
66
+ right: 1rem;
67
+ color: var(--yun-c-warning);
68
+ font-size: 1.2rem;
69
+ }
70
+
71
+ .post-link-btn,
72
+ .markdown-body .post-link-btn {
73
+ background-color: var(--card-c-primary);
74
+ line-height: 1.2;
75
+ padding: 0.5rem 1rem;
76
+ color: white;
77
+ font-size: 14px;
78
+
79
+ margin-top: -0.2rem;
80
+
81
+ transition: box-shadow var(--yun-transition-duration);
82
+
83
+ &:before {
84
+ content: none;
85
+ }
86
+ }
@@ -0,0 +1,31 @@
1
+ @use "~/styles/mixins" as *;
2
+
3
+ .markdown-body {
4
+ --smc-font-family: var(--yun-font-sans);
5
+
6
+ --c-toc-link: var(--yun-c-text-light);
7
+ }
8
+
9
+ html.dark {
10
+ .markdown-body {
11
+ --smc-header-bottom-color: #333;
12
+
13
+ --c-toc-link: var(--yun-c-text-dark);
14
+ }
15
+ }
16
+
17
+ .markdown-body {
18
+ ul {
19
+ > li {
20
+ list-style-type: disc;
21
+
22
+ li {
23
+ list-style-type: circle;
24
+
25
+ li {
26
+ list-style-type: square;
27
+ }
28
+ }
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,7 @@
1
+ :root {
2
+ --yun-sidebar-bg-image: url("https://cdn.jsdelivr.net/gh/YunYouJun/cdn@master/img/bg/alpha-stars-timing-1.webp")
3
+ }
4
+
5
+ html.dark {
6
+ --yun-sidebar-bg-image: none;
7
+ }
package/tsup.config.ts ADDED
@@ -0,0 +1,13 @@
1
+ import { defineConfig } from 'tsup'
2
+
3
+ export default defineConfig((options) => {
4
+ return {
5
+ entry: ['index.ts'],
6
+ splitting: true,
7
+ // disable for dev watch before valaxy watch
8
+ clean: !options.watch,
9
+ dts: true,
10
+ format: ['cjs', 'esm'],
11
+ minify: !options.watch,
12
+ }
13
+ })
package/utils/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { anonymousImage } from '../config'
2
+
3
+ export const onImgError = (e: Event) => {
4
+ (e.target as HTMLImageElement).src = anonymousImage
5
+ }