valaxy 0.0.2 → 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.
- package/LICENSE +21 -0
- package/README.md +1 -1
- package/bin/valaxy.js +11 -0
- package/dist/build-LSWX3GTV.mjs +1 -0
- package/dist/build-QCHURQKL.js +1 -0
- package/dist/chunk-7NQGUR4O.mjs +1 -0
- package/dist/chunk-DEKAH6ZE.js +1 -0
- package/dist/chunk-TIPISWPV.mjs +10 -0
- package/dist/chunk-ZX4FV7OA.js +10 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +2 -0
- package/dist/cli.mjs +2 -0
- package/dist/index.d.ts +203 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +75 -3
- package/src/client/App.vue +16 -0
- package/src/client/components/AppLink.vue +20 -0
- package/src/client/components/PostCard.vue +69 -0
- package/src/client/components/PostList.vue +50 -0
- package/src/client/components/README.md +7 -0
- package/src/client/components/ValaxyCopyright.vue +80 -0
- package/src/client/components/ValaxyFooter.vue +53 -0
- package/src/client/components/ValaxyHamburger.vue +21 -0
- package/src/client/components/ValaxyMd.vue +71 -0
- package/src/client/components/ValaxyOverlay.vue +44 -0
- package/src/client/components/ValaxyPagination.vue +122 -0
- package/src/client/components/ValaxyRightSidebar.vue +32 -0
- package/src/client/components/ValaxySidebar.vue +35 -0
- package/src/client/components/ValaxyToc.vue +70 -0
- package/src/client/composables/category.ts +101 -0
- package/src/client/composables/comments/index.ts +1 -0
- package/src/client/composables/comments/waline.ts +60 -0
- package/src/client/composables/common.ts +27 -0
- package/src/client/composables/dark.ts +4 -0
- package/src/client/composables/features/index.ts +1 -0
- package/src/client/composables/features/katex.ts +15 -0
- package/src/client/composables/helper.ts +26 -0
- package/src/client/composables/index.ts +17 -0
- package/src/client/composables/layout.ts +7 -0
- package/src/client/composables/post.ts +96 -0
- package/src/client/composables/search/algolia.ts +114 -0
- package/src/client/composables/search/index.ts +0 -0
- package/src/client/composables/sidebar.ts +128 -0
- package/src/client/composables/tag.ts +70 -0
- package/src/client/composables/widgets/aplayer.ts +23 -0
- package/src/client/composables/widgets/backToTop.ts +28 -0
- package/src/client/composables/widgets/codepen.ts +12 -0
- package/src/client/composables/widgets/index.ts +3 -0
- package/src/client/index.html +24 -0
- package/src/client/layouts/404.vue +25 -0
- package/src/client/layouts/README.md +14 -0
- package/src/client/locales/README.md +7 -0
- package/src/client/locales/en.yml +107 -0
- package/src/client/locales/zh-CN.yml +106 -0
- package/src/client/main.ts +30 -0
- package/src/client/modules/README.md +11 -0
- package/src/client/modules/nprogress.ts +14 -0
- package/src/client/modules/pinia.ts +17 -0
- package/src/client/modules/pwa.ts +12 -0
- package/src/client/modules/valaxy.ts +42 -0
- package/src/client/pages/README.md +20 -0
- package/src/client/pages/[...all].vue +15 -0
- package/src/client/pages/about/index.md +5 -0
- package/src/client/pages/hi/[name].vue +52 -0
- package/src/client/pages/index.vue +3 -0
- package/src/client/pages/page/[page].vue +12 -0
- package/src/client/pages/posts/index.md +5 -0
- package/src/client/public/_headers +3 -0
- package/src/client/public/favicon.svg +21 -0
- package/src/client/public/pwa-192x192.png +0 -0
- package/src/client/public/pwa-512x512.png +0 -0
- package/src/client/public/safari-pinned-tab.svg +41 -0
- package/src/client/shims.d.ts +36 -0
- package/src/client/stores/app.ts +14 -0
- package/src/client/stores/user.ts +35 -0
- package/src/client/styles/common/button.scss +29 -0
- package/src/client/styles/common/code.scss +35 -0
- package/src/client/styles/common/hamburger.scss +56 -0
- package/src/client/styles/common/markdown.scss +43 -0
- package/src/client/styles/common/scrollbar.scss +34 -0
- package/src/client/styles/common/sidebar.scss +30 -0
- package/src/client/styles/common/transition.scss +23 -0
- package/src/client/styles/css-vars/dark.scss +17 -0
- package/src/client/styles/css-vars/index.scss +18 -0
- package/src/client/styles/css-vars/light.scss +9 -0
- package/src/client/styles/global/helper.scss +3 -0
- package/src/client/styles/global/index.scss +38 -0
- package/src/client/styles/global/nprogress.scss +14 -0
- package/src/client/styles/global/reset.scss +20 -0
- package/src/client/styles/index.scss +18 -0
- package/src/client/styles/mixins/config.scss +1 -0
- package/src/client/styles/mixins/index.scss +2 -0
- package/src/client/styles/mixins/size.scss +49 -0
- package/src/client/styles/mixins/variable.scss +30 -0
- package/src/client/styles/palette.scss +61 -0
- package/src/client/styles/vars.scss +39 -0
- package/src/client/styles/widgets/banner.scss +116 -0
- package/src/client/types.ts +3 -0
- package/src/client/utils/helper.ts +30 -0
- package/src/client/utils/index.ts +2 -0
- package/src/client/utils/time.ts +23 -0
- package/src/core/config.ts +51 -0
- package/src/core/index.ts +5 -0
- package/src/core/utils.ts +1 -0
- package/src/index.ts +2 -0
- package/src/node/build.ts +12 -0
- package/src/node/cli.ts +177 -0
- package/src/node/config.ts +43 -0
- package/src/node/index.ts +1 -0
- package/src/node/markdown/headings.ts +24 -0
- package/src/node/markdown/index.ts +74 -0
- package/src/node/markdown/markdown-it-container.ts +53 -0
- package/src/node/markdown/markdown-it-katex.ts +200 -0
- package/src/node/markdown/parseHeader.ts +70 -0
- package/src/node/markdown/slugify.ts +24 -0
- package/src/node/options.ts +90 -0
- package/src/node/plugins/index.ts +91 -0
- package/src/node/plugins/markdown.ts +62 -0
- package/src/node/plugins/preset.ts +171 -0
- package/src/node/plugins/unocss.ts +106 -0
- package/src/node/plugins/valaxy.ts +1 -0
- package/src/node/server.ts +21 -0
- package/src/node/shims.d.ts +23 -0
- package/src/node/utils/cli.ts +105 -0
- package/src/node/utils/index.ts +26 -0
- package/src/node/vite.ts +83 -0
- package/src/types/config.ts +250 -0
- package/src/types/index.ts +2 -0
- package/src/types/posts.ts +107 -0
- package/tsup.config.ts +17 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
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
|
+
<ValaxySidebar />
|
|
11
|
+
|
|
12
|
+
<main class="yun-main" text="center">
|
|
13
|
+
<YunCard m="4" p="10" text="yellow-600">
|
|
14
|
+
<div text-4xl>
|
|
15
|
+
<div i-ri-alarm-warning-line inline-block />
|
|
16
|
+
</div>
|
|
17
|
+
<router-view />
|
|
18
|
+
<div>
|
|
19
|
+
<button btn text-sm m="3 t8" @click="router.back()">
|
|
20
|
+
{{ t('button.back') }}
|
|
21
|
+
</button>
|
|
22
|
+
</div>
|
|
23
|
+
</YunCard>
|
|
24
|
+
</main>
|
|
25
|
+
</template>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
## Layouts
|
|
2
|
+
|
|
3
|
+
Vue components in this dir are used as layouts.
|
|
4
|
+
|
|
5
|
+
By default, `default.vue` will be used unless an alternative is specified in the route meta.
|
|
6
|
+
|
|
7
|
+
With [`vite-plugin-pages`](https://github.com/hannoeru/vite-plugin-pages) and [`vite-plugin-vue-layouts`](https://github.com/JohnCampionJr/vite-plugin-vue-layouts), you can specify the layout in the page's SFCs like this:
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<route lang="yaml">
|
|
11
|
+
meta:
|
|
12
|
+
layout: home
|
|
13
|
+
</route>
|
|
14
|
+
```
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
## i18n
|
|
2
|
+
|
|
3
|
+
This directory is to serve your locale translation files. YAML under this folder would be loaded automatically and register with their filenames as locale code.
|
|
4
|
+
|
|
5
|
+
Check out [`vue-i18n`](https://github.com/intlify/vue-i18n-next) for more details.
|
|
6
|
+
|
|
7
|
+
If you are using VS Code, [`i18n Ally`](https://github.com/lokalise/i18n-ally) is recommended to make the i18n experience better.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
button:
|
|
2
|
+
about: About
|
|
3
|
+
back: Back
|
|
4
|
+
go: GO
|
|
5
|
+
home: Home
|
|
6
|
+
toggle_dark: Toggle dark mode
|
|
7
|
+
toggle_langs: Change languages
|
|
8
|
+
intro:
|
|
9
|
+
desc: Theme Yun | Valaxy
|
|
10
|
+
hi: Hi, {name}!
|
|
11
|
+
not-found: Oops! Space collapse!
|
|
12
|
+
|
|
13
|
+
title:
|
|
14
|
+
archive: Archive
|
|
15
|
+
category: Category
|
|
16
|
+
tag: Tag
|
|
17
|
+
album: Album
|
|
18
|
+
|
|
19
|
+
menu:
|
|
20
|
+
home: Home
|
|
21
|
+
archives: Archives
|
|
22
|
+
categories: Categories
|
|
23
|
+
tags: Tags
|
|
24
|
+
about: About
|
|
25
|
+
search: Search
|
|
26
|
+
|
|
27
|
+
sidebar:
|
|
28
|
+
overview: Overview
|
|
29
|
+
toc: Table of Contents
|
|
30
|
+
|
|
31
|
+
post:
|
|
32
|
+
decrypt: DECRYPT
|
|
33
|
+
posted: Posted on
|
|
34
|
+
edited: Edited on
|
|
35
|
+
created: Created
|
|
36
|
+
modified: Modified
|
|
37
|
+
edit: Edit this post
|
|
38
|
+
more: more
|
|
39
|
+
untitled: Untitled
|
|
40
|
+
toc_empty: This post does not have a Table of Contents
|
|
41
|
+
views: Views
|
|
42
|
+
comments_count: Comments
|
|
43
|
+
related_posts: Related Posts
|
|
44
|
+
view_link: View Link
|
|
45
|
+
read_more: READ MORE
|
|
46
|
+
copyright:
|
|
47
|
+
author: Post author
|
|
48
|
+
link: Post link
|
|
49
|
+
license_title: Copyright Notice
|
|
50
|
+
license_content: "All articles in this blog are licensed under {0} unless otherwise stated."
|
|
51
|
+
|
|
52
|
+
# page:
|
|
53
|
+
# totally: Totally
|
|
54
|
+
# tags: tags
|
|
55
|
+
|
|
56
|
+
footer:
|
|
57
|
+
powered: "Powered by {0}"
|
|
58
|
+
theme: Theme
|
|
59
|
+
total_views: Total Views
|
|
60
|
+
total_visitors: Total Visitors
|
|
61
|
+
|
|
62
|
+
counter:
|
|
63
|
+
archives: No post | 1 post in total | {count} posts in total
|
|
64
|
+
categories: No category | 1 category in total | {count} categories in total
|
|
65
|
+
tags: No tag | 1 tag in total | {count} tags in total
|
|
66
|
+
albums:
|
|
67
|
+
zero: No album
|
|
68
|
+
one: 1 album in total
|
|
69
|
+
other: "%d albums in total"
|
|
70
|
+
photos:
|
|
71
|
+
zero: No photo
|
|
72
|
+
one: 1 photo in total
|
|
73
|
+
other: "%d photos in total"
|
|
74
|
+
|
|
75
|
+
category:
|
|
76
|
+
uncategorized: Uncategorized
|
|
77
|
+
|
|
78
|
+
search:
|
|
79
|
+
placeholder: Searching...
|
|
80
|
+
empty: "We didn't find any results for the search: {query}."
|
|
81
|
+
hits_time: "{hits} results found in {time} ms"
|
|
82
|
+
|
|
83
|
+
symbol:
|
|
84
|
+
comma: ", "
|
|
85
|
+
period: ". "
|
|
86
|
+
colon: ": "
|
|
87
|
+
|
|
88
|
+
reward:
|
|
89
|
+
donate: Donate
|
|
90
|
+
|
|
91
|
+
accessibility:
|
|
92
|
+
back: Back
|
|
93
|
+
# nav_toggle: Toggle navigation bar
|
|
94
|
+
# prev_page: Previous page
|
|
95
|
+
# next_page: Next page
|
|
96
|
+
|
|
97
|
+
wordcount:
|
|
98
|
+
count: Word count in article
|
|
99
|
+
count_total: Word count total
|
|
100
|
+
time: Reading time
|
|
101
|
+
time_total: Total reading time
|
|
102
|
+
|
|
103
|
+
time:
|
|
104
|
+
day: Days
|
|
105
|
+
hour: Hours
|
|
106
|
+
minute: Minutes
|
|
107
|
+
second: Seconds
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
button:
|
|
2
|
+
about: 关于
|
|
3
|
+
back: 返回
|
|
4
|
+
go: 确定
|
|
5
|
+
home: 首页
|
|
6
|
+
toggle_dark: 切换深色模式
|
|
7
|
+
toggle_langs: 切换语言
|
|
8
|
+
intro:
|
|
9
|
+
desc: 主题 Yun
|
|
10
|
+
hi: 你好,{name}
|
|
11
|
+
not-found: 未找到页面
|
|
12
|
+
|
|
13
|
+
title:
|
|
14
|
+
archive: 归档
|
|
15
|
+
category: 分类
|
|
16
|
+
tag: 标签
|
|
17
|
+
album: 相册
|
|
18
|
+
|
|
19
|
+
menu:
|
|
20
|
+
home: 首页
|
|
21
|
+
archives: 归档
|
|
22
|
+
categories: 分类
|
|
23
|
+
tags: 标签
|
|
24
|
+
about: 关于
|
|
25
|
+
search: 搜索
|
|
26
|
+
|
|
27
|
+
sidebar:
|
|
28
|
+
overview: 站点概览
|
|
29
|
+
toc: 文章目录
|
|
30
|
+
|
|
31
|
+
post:
|
|
32
|
+
decrypt: 解密
|
|
33
|
+
posted: 发表于
|
|
34
|
+
edited: 更新于
|
|
35
|
+
created: 创建时间
|
|
36
|
+
modified: 修改时间
|
|
37
|
+
edit: 编辑
|
|
38
|
+
more: 更多
|
|
39
|
+
untitled: 未命名
|
|
40
|
+
toc_empty: 此文章未包含目录
|
|
41
|
+
views: 阅读次数
|
|
42
|
+
comments_count: 评论数
|
|
43
|
+
related_posts: 相关文章
|
|
44
|
+
view_link: 查看链接
|
|
45
|
+
read_more: 阅读更多
|
|
46
|
+
copyright:
|
|
47
|
+
author: 本文作者
|
|
48
|
+
link: 本文链接
|
|
49
|
+
license_title: 版权声明
|
|
50
|
+
license_content: "本博客所有文章除特别声明外,均默认采用 {0} 许可协议。"
|
|
51
|
+
|
|
52
|
+
# page:
|
|
53
|
+
# totally: 共有
|
|
54
|
+
# tags: 标签
|
|
55
|
+
footer:
|
|
56
|
+
powered: "由 {0} 驱动"
|
|
57
|
+
theme: 主题
|
|
58
|
+
total_views: 总访问量
|
|
59
|
+
total_visitors: 总访客量
|
|
60
|
+
|
|
61
|
+
counter:
|
|
62
|
+
archives: 暂无日志 | 共计 1 篇日志 | 共计 {count} 篇日志
|
|
63
|
+
categories: 暂无分类 | 共计 {count} 个分类
|
|
64
|
+
tags: 暂无标签 | 共计 {count} 个标签
|
|
65
|
+
albums:
|
|
66
|
+
zero: 暂无相册
|
|
67
|
+
one: 共计 1 个相册
|
|
68
|
+
other: "共计 %d 个相册"
|
|
69
|
+
photos:
|
|
70
|
+
zero: 暂无照片
|
|
71
|
+
one: 共计 1 张照片
|
|
72
|
+
other: "共计 %d 张照片"
|
|
73
|
+
|
|
74
|
+
category:
|
|
75
|
+
uncategorized: 未分类
|
|
76
|
+
|
|
77
|
+
search:
|
|
78
|
+
placeholder: 搜索...
|
|
79
|
+
empty: "找不到您查询的内容: {query}"
|
|
80
|
+
hits_time: "找到 {hits} 条结果(用时 {time} 毫秒)"
|
|
81
|
+
|
|
82
|
+
symbol:
|
|
83
|
+
comma: ","
|
|
84
|
+
period: "。"
|
|
85
|
+
colon: ":"
|
|
86
|
+
|
|
87
|
+
reward:
|
|
88
|
+
donate: 打赏
|
|
89
|
+
|
|
90
|
+
accessibility:
|
|
91
|
+
back: 返回
|
|
92
|
+
# nav_toggle: 切换导航栏
|
|
93
|
+
# prev_page: 上一页
|
|
94
|
+
# next_page: 下一页
|
|
95
|
+
|
|
96
|
+
wordcount:
|
|
97
|
+
count: 本文字数
|
|
98
|
+
count_total: 站点总字数
|
|
99
|
+
time: 阅读时长
|
|
100
|
+
time_total: 站点阅读时长
|
|
101
|
+
|
|
102
|
+
time:
|
|
103
|
+
day: 天
|
|
104
|
+
hour: 小时
|
|
105
|
+
minute: 分
|
|
106
|
+
second: 秒
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ViteSSG } from 'vite-ssg'
|
|
2
|
+
import generatedRoutes from 'virtual:generated-pages'
|
|
3
|
+
import { setupLayouts } from 'virtual:generated-layouts'
|
|
4
|
+
import App from './App.vue'
|
|
5
|
+
|
|
6
|
+
import '@unocss/reset/tailwind.css'
|
|
7
|
+
|
|
8
|
+
// markdown css
|
|
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
|
+
|
|
16
|
+
import '/@valaxyjs/styles'
|
|
17
|
+
|
|
18
|
+
import 'uno.css'
|
|
19
|
+
|
|
20
|
+
const routes = setupLayouts(generatedRoutes)
|
|
21
|
+
|
|
22
|
+
// https://github.com/antfu/vite-ssg
|
|
23
|
+
export const createApp = ViteSSG(
|
|
24
|
+
App,
|
|
25
|
+
{ routes, base: import.meta.env.BASE_URL },
|
|
26
|
+
(ctx) => {
|
|
27
|
+
// install all modules under `modules/`
|
|
28
|
+
Object.values(import.meta.globEager('./modules/*.ts')).forEach(i => i.install?.(ctx))
|
|
29
|
+
},
|
|
30
|
+
)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
## Modules
|
|
2
|
+
|
|
3
|
+
A custom user module system. Place a `.ts` file with the following template, it will be installed automatically.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import type { UserModule } from '~/types'
|
|
7
|
+
|
|
8
|
+
export const install: UserModule = ({ app, router, isClient }) => {
|
|
9
|
+
// do something
|
|
10
|
+
}
|
|
11
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import NProgress from 'nprogress'
|
|
2
|
+
import type { UserModule } from '~/types'
|
|
3
|
+
|
|
4
|
+
export const install: UserModule = ({ isClient, router }) => {
|
|
5
|
+
if (isClient) {
|
|
6
|
+
router.beforeEach((to, from) => {
|
|
7
|
+
if (to.path !== from.path)
|
|
8
|
+
NProgress.start()
|
|
9
|
+
})
|
|
10
|
+
router.afterEach(() => {
|
|
11
|
+
NProgress.done()
|
|
12
|
+
})
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createPinia } from 'pinia'
|
|
2
|
+
import type { UserModule } from '~/types'
|
|
3
|
+
|
|
4
|
+
// Setup Pinia
|
|
5
|
+
// https://pinia.esm.dev/
|
|
6
|
+
export const install: UserModule = ({ isClient, initialState, app }) => {
|
|
7
|
+
const pinia = createPinia()
|
|
8
|
+
app.use(pinia)
|
|
9
|
+
// Refer to
|
|
10
|
+
// https://github.com/antfu/vite-ssg/blob/main/README.md#state-serialization
|
|
11
|
+
// for other serialization strategies.
|
|
12
|
+
if (isClient)
|
|
13
|
+
pinia.state.value = (initialState.pinia) || {}
|
|
14
|
+
|
|
15
|
+
else
|
|
16
|
+
initialState.pinia = pinia.state.value
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { UserModule } from '~/types'
|
|
2
|
+
|
|
3
|
+
// https://github.com/antfu/vite-plugin-pwa#automatic-reload-when-new-content-available
|
|
4
|
+
export const install: UserModule = ({ isClient, router }) => {
|
|
5
|
+
if (!isClient)
|
|
6
|
+
return
|
|
7
|
+
|
|
8
|
+
router.isReady().then(async() => {
|
|
9
|
+
const { registerSW } = await import('virtual:pwa-register')
|
|
10
|
+
registerSW({ immediate: true })
|
|
11
|
+
})
|
|
12
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createI18n } from 'vue-i18n'
|
|
2
|
+
import { initConfig, valaxyConfigSymbol } from 'valaxy'
|
|
3
|
+
import type { UserModule } from '~/types'
|
|
4
|
+
|
|
5
|
+
// Import i18n resources
|
|
6
|
+
// https://vitejs.dev/guide/features.html#glob-import
|
|
7
|
+
//
|
|
8
|
+
// Don't need this? Try vitesse-lite: https://github.com/antfu/vitesse-lite
|
|
9
|
+
const messages = Object.fromEntries(
|
|
10
|
+
Object.entries(
|
|
11
|
+
import.meta.globEager('../locales/*.y(a)?ml'))
|
|
12
|
+
.map(([key, value]) => {
|
|
13
|
+
const yaml = key.endsWith('.yaml')
|
|
14
|
+
return [key.slice(11, yaml ? -5 : -4), value.default]
|
|
15
|
+
}),
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
function shouldHotReload(payload: any): boolean {
|
|
19
|
+
const payloadPath = payload.path.replace(/(\bindex)?\.md$/, '')
|
|
20
|
+
const locationPath = location.pathname.replace(/(\bindex)?\.html$/, '')
|
|
21
|
+
return payloadPath === locationPath
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// https://github.com/antfu/vite-plugin-pwa#automatic-reload-when-new-content-available
|
|
25
|
+
export const install: UserModule = ({ app, router }) => {
|
|
26
|
+
// inject valaxy config before modules
|
|
27
|
+
const valaxyConfigRef = initConfig()
|
|
28
|
+
app.provide(valaxyConfigSymbol, valaxyConfigRef)
|
|
29
|
+
|
|
30
|
+
// init i18n, by valaxy config
|
|
31
|
+
const i18n = createI18n({
|
|
32
|
+
legacy: false,
|
|
33
|
+
locale: valaxyConfigRef.value.lang || 'en',
|
|
34
|
+
messages,
|
|
35
|
+
})
|
|
36
|
+
app.use(i18n)
|
|
37
|
+
|
|
38
|
+
import.meta.hot!.on('valaxy:pageHeaders', (payload) => {
|
|
39
|
+
if (shouldHotReload(payload))
|
|
40
|
+
router.currentRoute.value.meta.headers = payload.pageHeaders
|
|
41
|
+
})
|
|
42
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# File-based Routing
|
|
2
|
+
|
|
3
|
+
Routes will be auto-generated for Vue files in this dir with the same file structure.
|
|
4
|
+
Check out [`vite-plugin-pages`](https://github.com/hannoeru/vite-plugin-pages) for more details.
|
|
5
|
+
|
|
6
|
+
## Path Aliasing
|
|
7
|
+
|
|
8
|
+
`~/` is aliased to `./src/` folder.
|
|
9
|
+
|
|
10
|
+
For example, instead of having
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { isDark } from '../../../../composables'
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
now, you can use
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { isDark } from '~/composables'
|
|
20
|
+
```
|
|
@@ -0,0 +1,52 @@
|
|
|
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>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="yun-logo" width="400" height="400" viewBox="40 40 320 320" stroke-width="16">
|
|
2
|
+
<style>
|
|
3
|
+
#yun-logo {
|
|
4
|
+
stroke: black;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
@media (prefers-color-scheme: dark) {
|
|
8
|
+
#yun-logo {
|
|
9
|
+
stroke: white;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
</style>
|
|
13
|
+
<defs>
|
|
14
|
+
<line id="eye" x1="0" y1="-35" x2="0" y2="35" stroke-linecap="round">
|
|
15
|
+
<animateTransform attributeName="transform" additive="sum" attributeType="XML" type="scale" from="1 1" to="1 0" dur="0.15s" repeatCount="2"/>
|
|
16
|
+
</line>
|
|
17
|
+
</defs>
|
|
18
|
+
<polygon stroke-linejoin="round" fill="none" points="50,250 50,150 100,150 100,100 300,100 300,150 350,150 350,250 300,250 300,300 100,300 100,250 50,250"/>
|
|
19
|
+
<use xlink:href="#eye" transform="translate(150,200)"/>
|
|
20
|
+
<use xlink:href="#eye" transform="translate(250,200)"/>
|
|
21
|
+
</svg>
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
|
3
|
+
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
|
4
|
+
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
|
5
|
+
width="700.000000pt" height="700.000000pt" viewBox="0 0 700.000000 700.000000"
|
|
6
|
+
preserveAspectRatio="xMidYMid meet">
|
|
7
|
+
<metadata>
|
|
8
|
+
Created by potrace 1.11, written by Peter Selinger 2001-2013
|
|
9
|
+
</metadata>
|
|
10
|
+
<g transform="translate(0.000000,700.000000) scale(0.100000,-0.100000)"
|
|
11
|
+
fill="#000000" stroke="none">
|
|
12
|
+
<path d="M2916 6015 c-93 -57 -173 -108 -178 -113 -6 -6 7 -36 33 -78 23 -38
|
|
13
|
+
86 -141 139 -229 54 -88 135 -221 180 -295 46 -74 94 -155 108 -180 14 -25 29
|
|
14
|
+
-52 35 -60 7 -12 -9 -45 -62 -130 -39 -63 -85 -140 -103 -170 -18 -30 -117
|
|
15
|
+
-194 -222 -365 -104 -170 -199 -326 -210 -346 -12 -19 -61 -102 -111 -183 -49
|
|
16
|
+
-81 -101 -166 -115 -189 -14 -23 -39 -64 -55 -90 -17 -27 -77 -126 -134 -220
|
|
17
|
+
-57 -95 -127 -210 -156 -257 -194 -315 -325 -533 -325 -541 0 -5 -4 -9 -10 -9
|
|
18
|
+
-5 0 -10 -4 -10 -9 0 -5 -55 -98 -121 -207 -247 -404 -403 -660 -416 -684 -8
|
|
19
|
+
-14 -58 -97 -112 -185 l-98 -160 -189 -2 c-104 -1 -225 -2 -269 -2 l-80 -1 1
|
|
20
|
+
-210 c0 -116 4 -213 8 -218 11 -11 6107 -9 6114 2 8 13 8 406 0 419 -4 7 -88
|
|
21
|
+
10 -265 9 l-259 -2 -50 77 c-27 43 -54 87 -60 98 -6 11 -62 103 -124 205 -62
|
|
22
|
+
102 -120 197 -129 212 -9 16 -85 142 -170 280 -85 139 -160 262 -165 273 -6
|
|
23
|
+
11 -13 22 -16 25 -3 3 -30 46 -59 95 -30 50 -102 169 -161 265 -59 96 -240
|
|
24
|
+
393 -402 660 -163 267 -371 609 -463 760 -92 151 -194 318 -225 370 -31 52
|
|
25
|
+
-101 167 -155 255 l-97 160 27 50 c16 27 32 55 36 61 5 5 38 59 74 120 36 60
|
|
26
|
+
69 116 74 124 5 8 75 122 155 253 81 131 144 242 141 247 -4 7 -114 76 -183
|
|
27
|
+
115 -10 6 -52 32 -95 58 -42 27 -81 46 -87 42 -8 -5 -94 -140 -140 -219 -19
|
|
28
|
+
-33 -221 -365 -246 -404 -15 -22 -18 -18 -111 135 -52 87 -123 203 -157 258
|
|
29
|
+
-67 108 -67 110 -111 184 -16 28 -34 51 -40 50 -5 0 -86 -47 -179 -104z m739
|
|
30
|
+
-1642 c319 -526 519 -854 637 -1046 43 -70 78 -130 78 -133 0 -2 5 -10 10 -17
|
|
31
|
+
6 -7 69 -109 140 -227 72 -118 134 -222 139 -230 5 -8 55 -89 111 -180 56 -91
|
|
32
|
+
105 -172 110 -180 9 -14 52 -84 270 -445 54 -88 135 -221 180 -295 46 -74 91
|
|
33
|
+
-148 100 -165 9 -16 31 -53 48 -81 18 -28 32 -54 32 -57 0 -3 -403 -6 -895 -5
|
|
34
|
+
l-895 0 0 81 c-1 45 -1 439 -1 875 l0 792 -37 1 c-57 1 -344 1 -374 0 l-27 -1
|
|
35
|
+
0 -832 c0 -458 0 -852 0 -875 l-1 -42 -895 1 c-492 0 -895 3 -895 5 0 9 115
|
|
36
|
+
198 122 201 5 2 8 7 8 12 0 5 23 46 51 92 28 46 78 128 112 183 33 55 70 116
|
|
37
|
+
82 135 12 19 132 215 265 435 133 220 266 438 295 485 65 105 206 338 220 362
|
|
38
|
+
6 10 172 284 370 608 198 325 387 635 420 690 33 55 62 100 65 100 3 0 73
|
|
39
|
+
-111 155 -247z"/>
|
|
40
|
+
</g>
|
|
41
|
+
</svg>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import 'vue-router'
|
|
2
|
+
|
|
3
|
+
import type { Post } from 'valaxy'
|
|
4
|
+
import type { Header } from '../node/markdown'
|
|
5
|
+
|
|
6
|
+
declare interface Window {
|
|
7
|
+
// extend the window
|
|
8
|
+
Waline: any
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// with vite-plugin-md, markdowns can be treat as Vue components
|
|
12
|
+
declare module '*.md' {
|
|
13
|
+
import type { DefineComponent } from 'vue'
|
|
14
|
+
const component: DefineComponent<{}, {}, any>
|
|
15
|
+
export default component
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare module '*.vue' {
|
|
19
|
+
import type { DefineComponent } from 'vue'
|
|
20
|
+
const component: DefineComponent<{}, {}, any>
|
|
21
|
+
export default component
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// vite hmr data
|
|
25
|
+
declare module '@valaxyjs/config' {
|
|
26
|
+
// import type { ValaxyConfig } from 'valaxy'
|
|
27
|
+
const config: string
|
|
28
|
+
export default config
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare module 'vue-router' {
|
|
32
|
+
interface RouteMeta {
|
|
33
|
+
headers: Header[]
|
|
34
|
+
frontmatter: Post
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { acceptHMRUpdate, defineStore } from 'pinia'
|
|
2
|
+
import { useToggle } from '@vueuse/core'
|
|
3
|
+
|
|
4
|
+
export const useAppStore = defineStore('app', () => {
|
|
5
|
+
const [isSidebarOpen, toggleSidebar] = useToggle(false)
|
|
6
|
+
|
|
7
|
+
return {
|
|
8
|
+
isSidebarOpen,
|
|
9
|
+
toggleSidebar,
|
|
10
|
+
}
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
if (import.meta.hot)
|
|
14
|
+
import.meta.hot.accept(acceptHMRUpdate(useAppStore, import.meta.hot))
|
|
@@ -0,0 +1,35 @@
|
|
|
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))
|