valaxy 0.0.9 → 0.1.2
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/dist/chunk-5D7M5SQP.js +1 -0
- package/dist/chunk-CF6MGLH2.mjs +84 -0
- package/dist/chunk-L22LX2G6.mjs +1 -0
- package/dist/chunk-W5MJCUNY.js +84 -0
- package/dist/index.d.ts +9 -5
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/node/cli.js +5 -87
- package/dist/node/cli.mjs +5 -87
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.js +1 -83
- package/dist/node/index.mjs +1 -83
- package/package.json +20 -19
- package/src/client/components/PostCard.vue +1 -1
- package/src/client/components/PostList.vue +5 -5
- package/src/client/components/ValaxyCopyright.vue +1 -1
- package/src/client/components/ValaxyFooter.vue +1 -1
- package/src/client/components/ValaxyOverlay.vue +4 -4
- package/src/client/components/ValaxyPagination.vue +16 -14
- package/src/client/components/ValaxyRightSidebar.vue +4 -4
- package/src/client/components/ValaxySidebar.vue +4 -8
- package/src/client/components/ValaxyToc.vue +11 -9
- package/src/client/composables/comments/waline.ts +8 -4
- package/src/client/composables/common.ts +2 -4
- package/src/client/composables/search/algolia.ts +2 -1
- package/src/client/composables/sidebar.ts +2 -2
- package/src/client/composables/tag.ts +1 -1
- package/src/client/composables/widgets/backToTop.ts +10 -4
- package/src/client/main.ts +1 -6
- package/src/client/modules/valaxy.ts +36 -15
- package/src/client/shims.d.ts +5 -0
- package/src/client/styles/common/button.scss +3 -5
- package/src/client/styles/common/hamburger.scss +2 -2
- package/src/client/styles/common/markdown.scss +6 -2
- package/src/client/styles/common/sidebar.scss +3 -3
- package/src/client/styles/common/transition.scss +2 -2
- package/src/client/styles/{css-vars/index.scss → css-vars.scss} +22 -8
- package/src/client/styles/global/helper.scss +2 -2
- package/src/client/styles/global/index.scss +1 -1
- package/src/client/styles/global/nprogress.scss +1 -1
- package/src/client/styles/global/reset.scss +2 -1
- package/src/client/styles/mixins/config.scss +1 -1
- package/src/client/styles/mixins/index.scss +1 -0
- package/src/client/styles/palette.scss +14 -8
- package/src/client/styles/vars.scss +1 -13
- package/src/client/styles/widgets/banner.scss +2 -2
- package/src/client/utils/index.ts +0 -2
- package/src/node/build.ts +20 -1
- package/src/node/cli.ts +17 -19
- package/src/node/markdown/index.ts +3 -1
- package/src/node/markdown/markdown-it-katex.ts +20 -10
- package/src/node/markdown/parseHeader.ts +4 -2
- package/src/node/options.ts +3 -1
- package/src/node/plugins/index.ts +53 -24
- package/src/node/plugins/markdown.ts +1 -1
- package/src/node/plugins/preset.ts +47 -10
- package/src/node/plugins/unocss.ts +12 -7
- package/src/node/server.ts +1 -1
- package/src/node/shims.d.ts +5 -0
- package/src/node/utils/cli.ts +0 -1
- package/src/node/vite.ts +10 -17
- package/tsup.config.ts +3 -2
- package/src/client/pages/about/index.md +0 -5
- package/src/client/styles/css-vars/dark.scss +0 -17
- package/src/client/styles/css-vars/light.scss +0 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "valaxy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "📄 Vite & Vue powered static blog generator.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -40,50 +40,51 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@ctrl/tinycolor": "^3.4.0",
|
|
43
|
-
"@iconify-json/carbon": "^1.1.
|
|
43
|
+
"@iconify-json/carbon": "^1.1.3",
|
|
44
44
|
"@iconify-json/ri": "^1.1.1",
|
|
45
|
-
"@intlify/vite-plugin-vue-i18n": "^3.
|
|
46
|
-
"@unocss/reset": "^0.30.
|
|
45
|
+
"@intlify/vite-plugin-vue-i18n": "^3.4.0",
|
|
46
|
+
"@unocss/reset": "^0.30.11",
|
|
47
47
|
"@vitejs/plugin-vue": "^2.3.1",
|
|
48
|
-
"@vueuse/core": "^8.2.
|
|
48
|
+
"@vueuse/core": "^8.2.4",
|
|
49
49
|
"@vueuse/head": "^0.7.5",
|
|
50
50
|
"consola": "^2.15.3",
|
|
51
51
|
"critters": "^0.0.16",
|
|
52
52
|
"dayjs": "^1.11.0",
|
|
53
53
|
"fast-deep-equal": "^3.1.3",
|
|
54
54
|
"katex": "^0.15.3",
|
|
55
|
-
"markdown-it-anchor": "^8.
|
|
55
|
+
"markdown-it-anchor": "^8.5.0",
|
|
56
56
|
"markdown-it-container": "^3.0.0",
|
|
57
57
|
"markdown-it-emoji": "^2.0.0",
|
|
58
58
|
"markdown-it-link-attributes": "^4.0.0",
|
|
59
59
|
"markdown-it-prism": "^2.2.3",
|
|
60
60
|
"markdown-it-table-of-contents": "^0.6.0",
|
|
61
|
+
"markdown-it-task-lists": "^2.1.1",
|
|
61
62
|
"nprogress": "^0.2.0",
|
|
62
63
|
"open": "^8.4.0",
|
|
63
64
|
"pinia": "^2.0.13",
|
|
64
65
|
"prism-theme-vars": "^0.2.2",
|
|
65
|
-
"sass": "^1.49.
|
|
66
|
-
"star-markdown-css": "^0.3.
|
|
66
|
+
"sass": "^1.49.11",
|
|
67
|
+
"star-markdown-css": "^0.3.1",
|
|
67
68
|
"unconfig": "^0.3.2",
|
|
68
|
-
"
|
|
69
|
-
"vue-demi": "^0.12.5",
|
|
70
|
-
"vue-i18n": "^9.1.9",
|
|
71
|
-
"vue-router": "^4.0.14",
|
|
72
|
-
"yargs": "^17.4.0",
|
|
73
|
-
"unocss": "^0.30.8",
|
|
69
|
+
"unocss": "^0.30.11",
|
|
74
70
|
"unplugin-vue-components": "^0.18.5",
|
|
75
71
|
"vite": "^2.9.1",
|
|
76
|
-
"vite-
|
|
72
|
+
"vite-plugin-inspect": "^0.4.3",
|
|
77
73
|
"vite-plugin-md": "^0.12.4",
|
|
78
74
|
"vite-plugin-pages": "^0.22.0",
|
|
79
|
-
"vite-plugin-inspect": "^0.4.3",
|
|
80
75
|
"vite-plugin-pwa": "^0.11.13",
|
|
81
76
|
"vite-plugin-vue-layouts": "^0.6.0",
|
|
82
|
-
"vite-ssg
|
|
77
|
+
"vite-ssg": "^0.19.1",
|
|
78
|
+
"vite-ssg-sitemap": "^0.2.0",
|
|
79
|
+
"vue": "^3.2.31",
|
|
80
|
+
"vue-demi": "^0.12.5",
|
|
81
|
+
"vue-i18n": "^9.1.9",
|
|
82
|
+
"vue-router": "^4.0.14",
|
|
83
|
+
"yargs": "^17.4.0"
|
|
83
84
|
},
|
|
84
85
|
"scripts": {
|
|
85
|
-
"build": "tsup",
|
|
86
|
-
"dev": "tsup --watch",
|
|
86
|
+
"build": "tsup --splitting",
|
|
87
|
+
"dev": "tsup --watch --splitting",
|
|
87
88
|
"lint": "eslint \"**/*.{vue,ts,js}\"",
|
|
88
89
|
"preview": "vite preview",
|
|
89
90
|
"preview-https": "serve dist",
|
|
@@ -13,7 +13,7 @@ const { icon, styles } = usePostProperty(props.post.type)
|
|
|
13
13
|
</script>
|
|
14
14
|
|
|
15
15
|
<template>
|
|
16
|
-
<YunCard m="
|
|
16
|
+
<YunCard m="b-4 auto" class="post-card" :style="styles">
|
|
17
17
|
<div v-if="post.top" class="post-top-icon">
|
|
18
18
|
<div i-ri-pushpin-line />
|
|
19
19
|
</div>
|
|
@@ -19,7 +19,7 @@ const displayedPosts = computed(() => posts.value.slice((props.curPage - 1) * pa
|
|
|
19
19
|
</script>
|
|
20
20
|
|
|
21
21
|
<template>
|
|
22
|
-
<
|
|
22
|
+
<div w="full" p="x-4 lt-sm:0">
|
|
23
23
|
<template v-if="!displayedPosts.length">
|
|
24
24
|
<div py2 op50>
|
|
25
25
|
博主还什么都没写哦~
|
|
@@ -29,22 +29,22 @@ const displayedPosts = computed(() => posts.value.slice((props.curPage - 1) * pa
|
|
|
29
29
|
<Transition v-for="route, i in displayedPosts" :key="i" name="fade">
|
|
30
30
|
<PostCard :post="route" />
|
|
31
31
|
</Transition>
|
|
32
|
-
</
|
|
32
|
+
</div>
|
|
33
33
|
|
|
34
34
|
<ValaxyPagination :cur-page="curPage" :page-size="pageSize" :total="posts.length" />
|
|
35
35
|
</template>
|
|
36
36
|
|
|
37
|
-
<style
|
|
37
|
+
<style>
|
|
38
38
|
.yun-card-actions {
|
|
39
39
|
border-top: 1px solid rgba(122, 122, 122, 0.15);
|
|
40
40
|
min-height: 2.5rem;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
.post-categories {
|
|
44
|
-
color: var(--
|
|
44
|
+
color: var(--va-c-text);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
.post-tag {
|
|
48
|
-
color: var(--
|
|
48
|
+
color: var(--va-c-text);
|
|
49
49
|
}
|
|
50
50
|
</style>
|
|
@@ -57,7 +57,7 @@ const licenseHtml = computed(() => {
|
|
|
57
57
|
font-size: 0.9rem;
|
|
58
58
|
padding: 0.5rem 1rem;
|
|
59
59
|
border-left: 4px solid #ff5252;
|
|
60
|
-
background-color: var(--
|
|
60
|
+
background-color: var(--va-c-bg-dark);
|
|
61
61
|
list-style: none;
|
|
62
62
|
word-break: break-all;
|
|
63
63
|
position: relative;
|
|
@@ -21,7 +21,7 @@ const poweredHtml = computed(() => t('footer.powered', [`<a href="${pkg.reposito
|
|
|
21
21
|
</script>
|
|
22
22
|
|
|
23
23
|
<template>
|
|
24
|
-
<footer class="
|
|
24
|
+
<footer class="va-footer p-4" text="center sm" style="color:var(--va-c-text-light)">
|
|
25
25
|
<div v-if="themeConfig.footer.beian.enable && themeConfig.footer.beian.icp" class="beian" m="y-2">
|
|
26
26
|
<a href="https://beian.miit.gov.cn/" target="_blank" rel="noopener">
|
|
27
27
|
{{ themeConfig.footer.beian.icp }}
|
|
@@ -8,7 +8,7 @@ withDefaults(defineProps<{
|
|
|
8
8
|
|
|
9
9
|
<template>
|
|
10
10
|
<transition name="fade">
|
|
11
|
-
<div v-if="show" class="
|
|
11
|
+
<div v-if="show" class="va-overlay backdrop-filter backdrop-blur" />
|
|
12
12
|
</transition>
|
|
13
13
|
</template>
|
|
14
14
|
|
|
@@ -18,14 +18,14 @@ withDefaults(defineProps<{
|
|
|
18
18
|
@use "~/styles/vars" as *;
|
|
19
19
|
@use "~/styles/mixins" as *;
|
|
20
20
|
|
|
21
|
-
.
|
|
21
|
+
.va-overlay {
|
|
22
22
|
background-color: rgba(0, 0, 0, 0.3);
|
|
23
23
|
position: fixed;
|
|
24
24
|
top: 0;
|
|
25
25
|
right: 0;
|
|
26
26
|
bottom: 0;
|
|
27
27
|
left: 0;
|
|
28
|
-
z-index:
|
|
28
|
+
z-index: calc(var(--yun-z-sidebar) - 1);
|
|
29
29
|
transition: opacity 0.4s;
|
|
30
30
|
|
|
31
31
|
display: none;
|
|
@@ -37,7 +37,7 @@ withDefaults(defineProps<{
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
@include mobile {
|
|
40
|
-
.
|
|
40
|
+
.va-overlay {
|
|
41
41
|
display: block;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -30,21 +30,24 @@ const surLen = computed(() => {
|
|
|
30
30
|
})
|
|
31
31
|
|
|
32
32
|
const showPage = (i: number) => {
|
|
33
|
-
if (i === 1)
|
|
34
|
-
|
|
33
|
+
if (i === 1)
|
|
34
|
+
return true
|
|
35
|
+
else if (i === totalPages.value)
|
|
36
|
+
return true
|
|
35
37
|
return i > props.curPage - surLen.value && i < props.curPage + surLen.value
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
const jumpTo = (page: number) => {
|
|
39
41
|
emit('page-change', page)
|
|
40
|
-
if (page === 1)
|
|
42
|
+
if (page === 1)
|
|
43
|
+
return '/'
|
|
41
44
|
else return `/page/${page}`
|
|
42
45
|
}
|
|
43
46
|
</script>
|
|
44
47
|
|
|
45
48
|
<template>
|
|
46
49
|
<nav class="pagination">
|
|
47
|
-
<router-link v-if="curPage !== 1" class="page-number" :to="jumpTo(curPage - 1)">
|
|
50
|
+
<router-link v-if="curPage !== 1" class="page-number" :to="jumpTo(curPage - 1)" aria-label="prev">
|
|
48
51
|
<div i-ri-arrow-left-s-line />
|
|
49
52
|
</router-link>
|
|
50
53
|
|
|
@@ -60,7 +63,7 @@ const jumpTo = (page: number) => {
|
|
|
60
63
|
</span>
|
|
61
64
|
</template>
|
|
62
65
|
|
|
63
|
-
<router-link v-if="curPage !== totalPages" class="page-number" :to="jumpTo(curPage + 1)">
|
|
66
|
+
<router-link v-if="curPage !== totalPages" class="page-number" :to="jumpTo(curPage + 1)" aria-label="next">
|
|
64
67
|
<div i-ri-arrow-right-s-line />
|
|
65
68
|
</router-link>
|
|
66
69
|
</nav>
|
|
@@ -69,12 +72,12 @@ const jumpTo = (page: number) => {
|
|
|
69
72
|
<style lang="scss">
|
|
70
73
|
:root {
|
|
71
74
|
--page-btn-bg-color: rgba(255, 255, 255, 0.5);
|
|
72
|
-
--page-btn-hover-bg-color: var(--
|
|
73
|
-
--page-btn-active-bg-color: var(--
|
|
75
|
+
--page-btn-hover-bg-color: var(--va-c-primary-lighter);
|
|
76
|
+
--page-btn-active-bg-color: var(--va-c-primary-light);
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
.dark {
|
|
77
|
-
--page-btn-bg-color: var(--
|
|
80
|
+
--page-btn-bg-color: var(--va-c-bg-light);
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
.pagination {
|
|
@@ -90,33 +93,32 @@ const jumpTo = (page: number) => {
|
|
|
90
93
|
width: 2rem;
|
|
91
94
|
height: 2rem;
|
|
92
95
|
margin: 0;
|
|
93
|
-
transition: background-color var(--
|
|
96
|
+
transition: background-color var(--va-transition-duration) ease;
|
|
94
97
|
}
|
|
95
98
|
|
|
96
99
|
.prev, .next, .page-number {
|
|
97
100
|
cursor: pointer;
|
|
98
101
|
|
|
99
|
-
color: var(--
|
|
102
|
+
color: var(--va-c-text);
|
|
100
103
|
text-decoration: none;
|
|
101
104
|
background-color: var(--page-btn-bg-color);
|
|
102
105
|
|
|
103
106
|
&:hover {
|
|
104
|
-
color: var(--
|
|
107
|
+
color: var(--va-c-bg);
|
|
105
108
|
background: var(--page-btn-hover-bg-color);
|
|
106
109
|
}
|
|
107
110
|
|
|
108
111
|
&:active {
|
|
109
|
-
color: var(--
|
|
112
|
+
color: var(--va-c-bg);
|
|
110
113
|
background: var(--page-btn-active-bg-color);
|
|
111
114
|
}
|
|
112
115
|
|
|
113
116
|
&.active {
|
|
114
117
|
font-weight: normal;
|
|
115
118
|
background: var(--page-btn-active-bg-color);
|
|
116
|
-
color: var(--
|
|
119
|
+
color: var(--va-c-bg);
|
|
117
120
|
cursor: default;
|
|
118
121
|
}
|
|
119
122
|
}
|
|
120
123
|
}
|
|
121
|
-
|
|
122
124
|
</style>
|
|
@@ -7,13 +7,13 @@ defineProps<{ frontmatter: Post }>()
|
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
9
|
<template>
|
|
10
|
-
<aside class="right-sidebar
|
|
11
|
-
<h2 v-if="frontmatter.toc" m="t-6 b-2" font="serif black">
|
|
10
|
+
<aside class="right-sidebar va-card relative" m="l-4" text="center">
|
|
11
|
+
<h2 v-if="frontmatter.toc !== false" m="t-6 b-2" font="serif black">
|
|
12
12
|
{{ t('sidebar.toc') }}
|
|
13
13
|
</h2>
|
|
14
14
|
|
|
15
15
|
<div class="right-sidebar-container sticky">
|
|
16
|
-
<ValaxyToc v-if="frontmatter.toc" />
|
|
16
|
+
<ValaxyToc v-if="frontmatter.toc !== false" />
|
|
17
17
|
|
|
18
18
|
<div v-if="$slots.custom" class="custom-container">
|
|
19
19
|
<slot name="custom" />
|
|
@@ -24,7 +24,7 @@ defineProps<{ frontmatter: Post }>()
|
|
|
24
24
|
|
|
25
25
|
<style lang="scss">
|
|
26
26
|
.right-sidebar {
|
|
27
|
-
width: var(--
|
|
27
|
+
width: var(--va-sidebar-width-mobile);
|
|
28
28
|
}
|
|
29
29
|
.right-sidebar-container {
|
|
30
30
|
top: 1rem;
|
|
@@ -11,25 +11,21 @@ const isHome = useLayout('home')
|
|
|
11
11
|
|
|
12
12
|
<ValaxyHamburger :active="app.isSidebarOpen" class="menu-btn sidebar-toggle yun-icon-btn" :class="isHome ? '' : 'md:hidden'" @click="app.toggleSidebar()" />
|
|
13
13
|
|
|
14
|
-
<aside class="
|
|
14
|
+
<aside class="va-card" :class="['sidebar', app.isSidebarOpen && 'open', !isHome && 'md:translate-x-0']">
|
|
15
15
|
<YunSidebar />
|
|
16
|
-
|
|
17
16
|
<YunConfig />
|
|
17
|
+
<slot />
|
|
18
18
|
</aside>
|
|
19
19
|
</template>
|
|
20
20
|
|
|
21
|
-
<style
|
|
22
|
-
@use "sass:map";
|
|
23
|
-
|
|
24
|
-
@use "~/styles/vars" as *;
|
|
25
|
-
|
|
21
|
+
<style>
|
|
26
22
|
.menu-btn {
|
|
27
23
|
display: inline-flex;
|
|
28
24
|
position: fixed;
|
|
29
25
|
left: 0.8rem;
|
|
30
26
|
top: 0.6rem;
|
|
31
27
|
line-height: 1;
|
|
32
|
-
z-index:
|
|
28
|
+
z-index: var(--yun-z-menu-btn);
|
|
33
29
|
cursor: pointer;
|
|
34
30
|
}
|
|
35
31
|
</style>
|
|
@@ -20,7 +20,7 @@ function getStylesByLevel(level: number) {
|
|
|
20
20
|
</script>
|
|
21
21
|
|
|
22
22
|
<template>
|
|
23
|
-
<ul class="
|
|
23
|
+
<ul class="va-toc" p="l-4">
|
|
24
24
|
<li v-for="header, i in headers" :key="i" :style="getStylesByLevel(header.level)">
|
|
25
25
|
<a class="toc-link-item" :href="`#${header.slug}`">{{ header.title }}</a>
|
|
26
26
|
</li>
|
|
@@ -28,14 +28,14 @@ function getStylesByLevel(level: number) {
|
|
|
28
28
|
</template>
|
|
29
29
|
|
|
30
30
|
<style lang="scss">
|
|
31
|
-
.
|
|
31
|
+
.va-toc {
|
|
32
32
|
top: 10px;
|
|
33
33
|
width: var(--yun-sidebar-width-mobile);
|
|
34
34
|
|
|
35
|
-
background-color: var(--
|
|
35
|
+
background-color: var(--va-c-bg-light);
|
|
36
36
|
|
|
37
37
|
font-size: 1rem;
|
|
38
|
-
font-family: var(--
|
|
38
|
+
font-family: var(--va-font-serif);
|
|
39
39
|
font-weight: 900;
|
|
40
40
|
line-height: 1.6;
|
|
41
41
|
|
|
@@ -44,26 +44,28 @@ function getStylesByLevel(level: number) {
|
|
|
44
44
|
a {
|
|
45
45
|
display: block;
|
|
46
46
|
color: var(--c-toc-link);
|
|
47
|
-
transition: color var(--
|
|
47
|
+
transition: color var(--va-transition-duration);
|
|
48
48
|
|
|
49
49
|
overflow: hidden;
|
|
50
50
|
white-space: nowrap;
|
|
51
51
|
text-overflow: ellipsis;
|
|
52
52
|
|
|
53
|
+
font-weight: 900;
|
|
54
|
+
|
|
53
55
|
&:hover {
|
|
54
|
-
color: var(--
|
|
56
|
+
color: var(--va-c-text);
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
.toc-link-item {
|
|
59
|
-
color: var(--
|
|
61
|
+
color: var(--va-c-text-light);
|
|
60
62
|
|
|
61
63
|
&:hover {
|
|
62
|
-
color: var(--
|
|
64
|
+
color: var(--va-c-text);
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
&.active {
|
|
66
|
-
color: var(--
|
|
68
|
+
color: var(--va-c-primary);
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
}
|
|
@@ -16,7 +16,8 @@ export function useWaline(options: {} = {}) {
|
|
|
16
16
|
* @returns
|
|
17
17
|
*/
|
|
18
18
|
function initWaline(options: {} = {}) {
|
|
19
|
-
if (!isClient)
|
|
19
|
+
if (!isClient)
|
|
20
|
+
return
|
|
20
21
|
|
|
21
22
|
const defaultOptions = {
|
|
22
23
|
el: '.comment #waline',
|
|
@@ -40,21 +41,24 @@ export function useWaline(options: {} = {}) {
|
|
|
40
41
|
})
|
|
41
42
|
|
|
42
43
|
watch(() => route.path, (path) => {
|
|
43
|
-
if (!waline)
|
|
44
|
+
if (!waline)
|
|
45
|
+
return
|
|
44
46
|
waline.update({
|
|
45
47
|
path,
|
|
46
48
|
})
|
|
47
49
|
})
|
|
48
50
|
|
|
49
51
|
watch(locale, (lang) => {
|
|
50
|
-
if (!waline)
|
|
52
|
+
if (!waline)
|
|
53
|
+
return
|
|
51
54
|
waline.update({
|
|
52
55
|
lang,
|
|
53
56
|
})
|
|
54
57
|
})
|
|
55
58
|
|
|
56
59
|
onUnmounted(() => {
|
|
57
|
-
if (!waline)
|
|
60
|
+
if (!waline)
|
|
61
|
+
return
|
|
58
62
|
waline.destroy()
|
|
59
63
|
})
|
|
60
64
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useRoute } from 'vue-router'
|
|
2
2
|
import { computed } from 'vue'
|
|
3
|
+
import { isClient } from '@vueuse/core'
|
|
3
4
|
|
|
4
|
-
import { isDev } from '../..'
|
|
5
5
|
import type { Post } from '../../types'
|
|
6
6
|
import { useConfig } from '../config'
|
|
7
7
|
|
|
@@ -9,8 +9,6 @@ export function useFrontmatter() {
|
|
|
9
9
|
const route = useRoute()
|
|
10
10
|
const frontmatter = computed<Post>(() => route.meta.frontmatter)
|
|
11
11
|
|
|
12
|
-
// eslint-disable-next-line no-console
|
|
13
|
-
if (isDev) console.log(frontmatter.value)
|
|
14
12
|
return frontmatter
|
|
15
13
|
}
|
|
16
14
|
|
|
@@ -21,7 +19,7 @@ export function useFullUrl() {
|
|
|
21
19
|
const config = useConfig()
|
|
22
20
|
const route = useRoute()
|
|
23
21
|
const url = computed(() => {
|
|
24
|
-
const origin = config.value.url || window
|
|
22
|
+
const origin = config.value.url || (isClient && window.location.origin)
|
|
25
23
|
return origin + route.path
|
|
26
24
|
})
|
|
27
25
|
return url
|
|
@@ -30,7 +30,7 @@ export function useActiveSidebarLinks() {
|
|
|
30
30
|
deactiveLink(activeLink)
|
|
31
31
|
deactiveLink(rootActiveLink)
|
|
32
32
|
|
|
33
|
-
activeLink = document.querySelector(`.
|
|
33
|
+
activeLink = document.querySelector(`.va-toc a[href="${hash}"]`)
|
|
34
34
|
|
|
35
35
|
if (!activeLink)
|
|
36
36
|
return
|
|
@@ -70,7 +70,7 @@ export function useActiveSidebarLinks() {
|
|
|
70
70
|
|
|
71
71
|
function getSidebarLinks(): HTMLAnchorElement[] {
|
|
72
72
|
return [].slice.call(
|
|
73
|
-
document.querySelectorAll('.
|
|
73
|
+
document.querySelectorAll('.va-toc a.toc-link-item'),
|
|
74
74
|
)
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -13,7 +13,7 @@ export function useTags() {
|
|
|
13
13
|
const tags = useTag()
|
|
14
14
|
|
|
15
15
|
const gray = new TinyColor('#999999')
|
|
16
|
-
const primaryColor = new TinyColor(getComputedStyle(document.documentElement).getPropertyValue('--
|
|
16
|
+
const primaryColor = new TinyColor(getComputedStyle(document.documentElement).getPropertyValue('--va-c-primary'))
|
|
17
17
|
|
|
18
18
|
const getTagStyle = (count: number) => {
|
|
19
19
|
const counts = Array.from(tags).map(([_, value]) => value.count)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useWindowScroll } from '@vueuse/core'
|
|
2
|
-
import { computed } from 'vue'
|
|
1
|
+
import { isClient, useWindowScroll } from '@vueuse/core'
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* You can use href="#" to back to top
|
|
@@ -13,10 +13,16 @@ export function useBackToTop(options: {
|
|
|
13
13
|
} = {
|
|
14
14
|
offset: 100,
|
|
15
15
|
}) {
|
|
16
|
-
|
|
16
|
+
if (!isClient) {
|
|
17
|
+
return {
|
|
18
|
+
percentage: ref(0),
|
|
19
|
+
show: ref(false),
|
|
20
|
+
}
|
|
21
|
+
}
|
|
17
22
|
|
|
23
|
+
const { y } = useWindowScroll()
|
|
18
24
|
const percentage = computed(() => {
|
|
19
|
-
return y.value / document.body.
|
|
25
|
+
return y.value / (document.body.scrollHeight - window.innerHeight)
|
|
20
26
|
})
|
|
21
27
|
|
|
22
28
|
const show = computed(() => y.value > options.offset)
|
package/src/client/main.ts
CHANGED
|
@@ -7,12 +7,7 @@ import '@unocss/reset/tailwind.css'
|
|
|
7
7
|
|
|
8
8
|
// markdown css
|
|
9
9
|
import 'star-markdown-css/src/scss/theme/yun.scss'
|
|
10
|
-
|
|
11
|
-
import './styles/css-vars/index.scss'
|
|
12
|
-
import './styles/css-vars/light.scss'
|
|
13
|
-
import './styles/css-vars/dark.scss'
|
|
14
|
-
import './styles/index.scss'
|
|
15
|
-
|
|
10
|
+
// generate user styles
|
|
16
11
|
import '/@valaxyjs/styles'
|
|
17
12
|
|
|
18
13
|
import 'uno.css'
|
|
@@ -1,19 +1,35 @@
|
|
|
1
1
|
import { createI18n } from 'vue-i18n'
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* All i18n resources specified in the plugin `include` option can be loaded
|
|
5
|
+
* at once using the import syntax
|
|
6
|
+
*
|
|
7
|
+
* Not support ssr https://github.com/intlify/bundle-tools/issues/78
|
|
8
|
+
*/
|
|
9
|
+
// import messages from '@intlify/vite-plugin-vue-i18n/messages'
|
|
10
|
+
|
|
2
11
|
import { initConfig, valaxyConfigSymbol } from '../config'
|
|
12
|
+
|
|
3
13
|
import type { UserModule } from '~/types'
|
|
4
14
|
|
|
15
|
+
// @ts-expect-error virtual
|
|
16
|
+
import messages from '/@valaxyjs/locales'
|
|
17
|
+
|
|
5
18
|
// Import i18n resources
|
|
6
19
|
// https://vitejs.dev/guide/features.html#glob-import
|
|
7
20
|
//
|
|
8
21
|
// Don't need this? Try vitesse-lite: https://github.com/antfu/vitesse-lite
|
|
9
|
-
const messages = Object.fromEntries(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
)
|
|
22
|
+
// const messages = Object.fromEntries(
|
|
23
|
+
// Object.entries(
|
|
24
|
+
// import.meta.globEager('../locales/*.y(a)?ml'))
|
|
25
|
+
// .map(([key, value]) => {
|
|
26
|
+
// const yaml = key.endsWith('.yaml')
|
|
27
|
+
// return [key.slice(11, yaml ? -5 : -4), value.default]
|
|
28
|
+
// }),
|
|
29
|
+
// )
|
|
30
|
+
|
|
31
|
+
// import zh from '../../../../../demo/yun/locales/zh-CN.yml'
|
|
32
|
+
// import en from '../../../../../demo/yun/locales/en.yml'
|
|
17
33
|
|
|
18
34
|
function shouldHotReload(payload: any): boolean {
|
|
19
35
|
const payloadPath = payload.path.replace(/(\bindex)?\.md$/, '')
|
|
@@ -24,19 +40,24 @@ function shouldHotReload(payload: any): boolean {
|
|
|
24
40
|
// https://github.com/antfu/vite-plugin-pwa#automatic-reload-when-new-content-available
|
|
25
41
|
export const install: UserModule = ({ app, router }) => {
|
|
26
42
|
// inject valaxy config before modules
|
|
27
|
-
const
|
|
28
|
-
app.provide(valaxyConfigSymbol,
|
|
43
|
+
const config = initConfig()
|
|
44
|
+
app.provide(valaxyConfigSymbol, config)
|
|
45
|
+
|
|
46
|
+
// const {} = await import()
|
|
29
47
|
|
|
30
48
|
// init i18n, by valaxy config
|
|
31
49
|
const i18n = createI18n({
|
|
32
50
|
legacy: false,
|
|
33
|
-
locale:
|
|
51
|
+
locale: config.value.lang || 'en',
|
|
34
52
|
messages,
|
|
35
53
|
})
|
|
36
54
|
app.use(i18n)
|
|
37
55
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
56
|
+
// for dev
|
|
57
|
+
if (__DEV__) {
|
|
58
|
+
import.meta.hot!.on('valaxy:pageHeaders', (payload) => {
|
|
59
|
+
if (shouldHotReload(payload))
|
|
60
|
+
router.currentRoute.value.meta.headers = payload.pageHeaders
|
|
61
|
+
})
|
|
62
|
+
}
|
|
42
63
|
}
|
package/src/client/shims.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
@use "../palette.scss" as * ;
|
|
2
|
-
|
|
3
1
|
.yun-icon-btn {
|
|
4
2
|
cursor: pointer;
|
|
5
3
|
|
|
@@ -13,17 +11,17 @@
|
|
|
13
11
|
|
|
14
12
|
border-radius: 50%;
|
|
15
13
|
|
|
16
|
-
transition: var(--
|
|
14
|
+
transition: background-color var(--va-transition-duration);
|
|
17
15
|
|
|
18
16
|
div {
|
|
19
17
|
font-size: 1.2rem;
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
&:hover {
|
|
23
|
-
background-color: rgba(var(--
|
|
21
|
+
background-color: rgba(var(--va-c-primary-rgb), 0.08);
|
|
24
22
|
}
|
|
25
23
|
|
|
26
24
|
&:active {
|
|
27
|
-
background-color: rgba(var(--
|
|
25
|
+
background-color: rgba(var(--va-c-primary-rgb), 0.16);
|
|
28
26
|
}
|
|
29
27
|
}
|