valaxy 0.7.8 → 0.9.0
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/README.md +4 -0
- package/client/README.md +3 -0
- package/client/components/ValaxyCopyright.vue +1 -1
- package/client/components/ValaxyMd.vue +2 -4
- package/client/components/ValaxyOverlay.vue +2 -2
- package/client/components/ValaxySidebar.vue +1 -2
- package/client/composables/category.ts +1 -1
- package/client/composables/comments/index.ts +2 -1
- package/client/composables/comments/twikoo.ts +1 -1
- package/client/composables/comments/waline.ts +3 -2
- package/client/composables/common.ts +1 -1
- package/client/composables/{copy-code.ts → features/copy-code.ts} +0 -0
- package/client/composables/features/index.ts +1 -0
- package/client/composables/index.ts +2 -1
- package/client/composables/outline.ts +2 -2
- package/client/composables/post.ts +1 -1
- package/client/composables/tag.ts +1 -1
- package/client/composables/widgets/aplayer.ts +1 -1
- package/client/config.ts +14 -0
- package/client/index.ts +2 -0
- package/client/modules/nprogress.ts +1 -1
- package/client/modules/pinia.ts +1 -1
- package/client/modules/valaxy.ts +2 -2
- package/client/scaffolds/post.md +6 -0
- package/client/styles/common/code.scss +1 -1
- package/client/styles/common/scrollbar.scss +1 -1
- package/client/{types.ts → types/index.ts} +0 -0
- package/client/utils/time.ts +1 -1
- package/dist/{chunk-EYC2AAUG.js → chunk-6SOT7TNG.js} +207 -207
- package/dist/{chunk-EIYDDCHI.mjs → chunk-ORY7PPZG.mjs} +207 -207
- package/dist/config-60c840d8.d.ts +202 -0
- package/dist/node/cli.js +8 -8
- package/dist/node/cli.mjs +8 -8
- package/dist/node/index.d.ts +147 -14
- package/dist/node/index.js +1 -1
- package/dist/node/index.mjs +1 -1
- package/dist/types/index.d.ts +154 -9
- package/dist/types/index.js +1 -1
- package/dist/types/index.mjs +0 -1
- package/package.json +9 -5
- package/types/config.ts +218 -0
- package/types/data.ts +31 -0
- package/types/index.ts +3 -0
- package/types/posts.ts +133 -0
- package/client/app/data.ts +0 -0
- package/client/components/ValaxyRightSidebar.vue +0 -73
- package/client/components/ValaxyToc.vue +0 -140
- package/client/modules/README.md +0 -11
- package/client/pages/README.md +0 -20
- package/dist/chunk-2QVEQP3K.js +0 -1
- package/dist/chunk-4FKSRP5I.mjs +0 -0
- package/dist/chunk-IMWNMHRD.mjs +0 -0
- package/dist/chunk-KP3MIFG6.js +0 -1
- package/dist/client/index.d.ts +0 -227
- package/dist/client/index.js +0 -1
- package/dist/client/index.mjs +0 -1
- package/dist/index-328992a1.d.ts +0 -472
package/types/posts.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
export interface Post extends Record<string, any> {
|
|
2
|
+
/**
|
|
3
|
+
* Path of post
|
|
4
|
+
* route.path
|
|
5
|
+
* @description 路径
|
|
6
|
+
*/
|
|
7
|
+
path?: string
|
|
8
|
+
/**
|
|
9
|
+
* Title
|
|
10
|
+
* @description 文章标题
|
|
11
|
+
*/
|
|
12
|
+
title?: string
|
|
13
|
+
date?: string | number | Date
|
|
14
|
+
/**
|
|
15
|
+
* Updated Time
|
|
16
|
+
*/
|
|
17
|
+
updated?: string | number | Date
|
|
18
|
+
lang?: string
|
|
19
|
+
/**
|
|
20
|
+
* TODO
|
|
21
|
+
* Read Time
|
|
22
|
+
* @description 阅读时长
|
|
23
|
+
*/
|
|
24
|
+
duration?: string
|
|
25
|
+
/**
|
|
26
|
+
* post card type, can be bilibili/yuque/...
|
|
27
|
+
*/
|
|
28
|
+
type?: string
|
|
29
|
+
/**
|
|
30
|
+
* override url, and jump directly
|
|
31
|
+
*/
|
|
32
|
+
url?: string
|
|
33
|
+
/**
|
|
34
|
+
* @description 摘要
|
|
35
|
+
*/
|
|
36
|
+
excerpt?: string
|
|
37
|
+
/**
|
|
38
|
+
* @description Author
|
|
39
|
+
* @description:zh-CN 作者
|
|
40
|
+
*/
|
|
41
|
+
author?: string
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Display sponsor info
|
|
45
|
+
* @description 是否开启赞助
|
|
46
|
+
*/
|
|
47
|
+
sponsor?: boolean
|
|
48
|
+
/**
|
|
49
|
+
* Copyright
|
|
50
|
+
* @description 是否显示文章底部版权信息
|
|
51
|
+
*/
|
|
52
|
+
copyright?: boolean
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Category
|
|
56
|
+
* @description 分类,若为数组,则按顺序代表多层文件夹
|
|
57
|
+
*/
|
|
58
|
+
categories?: string | string[]
|
|
59
|
+
/**
|
|
60
|
+
* Tags
|
|
61
|
+
* @description 标签,可以有多个
|
|
62
|
+
*/
|
|
63
|
+
tags?: string[]
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* display prev next
|
|
67
|
+
* @description 是否显示前一篇、后一篇导航
|
|
68
|
+
*/
|
|
69
|
+
nav?: boolean
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* display right sidebar
|
|
73
|
+
* @description 是否显示右侧侧边栏
|
|
74
|
+
*/
|
|
75
|
+
aside?: boolean
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* icon before title
|
|
79
|
+
*/
|
|
80
|
+
icon?: string
|
|
81
|
+
/**
|
|
82
|
+
* title color
|
|
83
|
+
*/
|
|
84
|
+
color?: string
|
|
85
|
+
/**
|
|
86
|
+
* display comment
|
|
87
|
+
*/
|
|
88
|
+
comment?: boolean
|
|
89
|
+
/**
|
|
90
|
+
* post is end
|
|
91
|
+
* @description 是否完结,将在末尾添加衬线字体 Q.E.D.
|
|
92
|
+
*/
|
|
93
|
+
end?: boolean
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* use aplayer
|
|
97
|
+
*/
|
|
98
|
+
aplayer?: boolean
|
|
99
|
+
/**
|
|
100
|
+
* use katex
|
|
101
|
+
*/
|
|
102
|
+
katex?: boolean
|
|
103
|
+
/**
|
|
104
|
+
* use codepen
|
|
105
|
+
*/
|
|
106
|
+
codepen?: boolean
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* 置顶
|
|
110
|
+
*/
|
|
111
|
+
top?: number
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* display toc
|
|
115
|
+
* @description 是否显示目录
|
|
116
|
+
*/
|
|
117
|
+
toc?: boolean
|
|
118
|
+
/**
|
|
119
|
+
* is draft
|
|
120
|
+
* @description 是否为草稿
|
|
121
|
+
*/
|
|
122
|
+
draft?: boolean
|
|
123
|
+
/**
|
|
124
|
+
* cover
|
|
125
|
+
* @description 封面图片
|
|
126
|
+
*/
|
|
127
|
+
cover?: string
|
|
128
|
+
/**
|
|
129
|
+
* enable markdown-body class
|
|
130
|
+
* @description 是否启用默认的 markdown 样式
|
|
131
|
+
*/
|
|
132
|
+
markdown?: boolean
|
|
133
|
+
}
|
package/client/app/data.ts
DELETED
|
File without changes
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { useI18n } from 'vue-i18n'
|
|
3
|
-
import type { Post } from 'valaxy/types'
|
|
4
|
-
import { useAppStore } from '~/stores/app'
|
|
5
|
-
defineProps<{ frontmatter: Post }>()
|
|
6
|
-
const { t } = useI18n()
|
|
7
|
-
|
|
8
|
-
const app = useAppStore()
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<template>
|
|
12
|
-
<button
|
|
13
|
-
class="xl:hidden toc-btn shadow fixed yun-icon-btn z-350"
|
|
14
|
-
opacity="75" right="2" bottom="19"
|
|
15
|
-
@click="app.toggleRightSidebar()"
|
|
16
|
-
>
|
|
17
|
-
<div i-ri-file-list-line />
|
|
18
|
-
</button>
|
|
19
|
-
|
|
20
|
-
<ValaxyOverlay :show="app.isRightSidebarOpen" @click="app.toggleRightSidebar()" />
|
|
21
|
-
|
|
22
|
-
<aside class="right-sidebar fixed va-card" :class="app.isRightSidebarOpen && 'open'" m="l-4" text="center">
|
|
23
|
-
<h2 v-if="frontmatter.toc !== false" m="t-6 b-2" font="serif black">
|
|
24
|
-
{{ t('sidebar.toc') }}
|
|
25
|
-
</h2>
|
|
26
|
-
|
|
27
|
-
<div class="right-sidebar-container">
|
|
28
|
-
<ValaxyToc v-if="frontmatter.toc !== false" />
|
|
29
|
-
|
|
30
|
-
<div v-if="$slots.custom" class="custom-container">
|
|
31
|
-
<slot name="custom" />
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
</aside>
|
|
35
|
-
</template>
|
|
36
|
-
|
|
37
|
-
<style lang="scss">
|
|
38
|
-
@use '~/styles/mixins' as *;
|
|
39
|
-
|
|
40
|
-
@include xl {
|
|
41
|
-
.right-sidebar {
|
|
42
|
-
transform: translateX(0) !important;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.right-sidebar {
|
|
47
|
-
width: var(--va-sidebar-width-mobile);
|
|
48
|
-
|
|
49
|
-
position: fixed;
|
|
50
|
-
top: 0;
|
|
51
|
-
bottom: 0;
|
|
52
|
-
right: 0;
|
|
53
|
-
|
|
54
|
-
transform: translateX(100%);
|
|
55
|
-
|
|
56
|
-
transition: box-shadow var(--va-transition-duration),
|
|
57
|
-
background-color var(--va-transition-duration), opacity 0.25s,
|
|
58
|
-
transform var(--va-transition-duration) cubic-bezier(0.19, 1, 0.22, 1);
|
|
59
|
-
|
|
60
|
-
&.open {
|
|
61
|
-
z-index: 10;
|
|
62
|
-
transform: translateX(0);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
.right-sidebar-container {
|
|
66
|
-
top: 1rem;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.toc-btn {
|
|
70
|
-
color: var(--va-c-primary);
|
|
71
|
-
background-color: white;
|
|
72
|
-
}
|
|
73
|
-
</style>
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
// this is a runtime toc
|
|
3
|
-
// prebuild toc see composables/outline.ts
|
|
4
|
-
import { onMounted, ref, watch } from 'vue'
|
|
5
|
-
import { useI18n } from 'vue-i18n'
|
|
6
|
-
import { useRoute } from 'vue-router'
|
|
7
|
-
|
|
8
|
-
import type { Header } from 'valaxy/types'
|
|
9
|
-
import { useActiveSidebarLinks } from '~/composables'
|
|
10
|
-
import { useConfig } from '~/config'
|
|
11
|
-
|
|
12
|
-
const container = ref()
|
|
13
|
-
const marker = ref()
|
|
14
|
-
useActiveSidebarLinks(container, marker)
|
|
15
|
-
|
|
16
|
-
function getStylesByLevel(level: number) {
|
|
17
|
-
return {
|
|
18
|
-
// fontSize: `${(6 - level) * 0.1 + 0.7}rem`,
|
|
19
|
-
paddingLeft: `${level * 1 - 1}rem`,
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const { locale } = useI18n()
|
|
24
|
-
|
|
25
|
-
const config = useConfig()
|
|
26
|
-
|
|
27
|
-
function useHeaders() {
|
|
28
|
-
const headers = ref<Header[]>([])
|
|
29
|
-
const route = useRoute()
|
|
30
|
-
|
|
31
|
-
function generateHeaders() {
|
|
32
|
-
headers.value = []
|
|
33
|
-
|
|
34
|
-
const content = document.querySelector('.markdown-body')
|
|
35
|
-
const levels = config.value.markdownIt.toc!.includeLevel!.map(level => `h${level}`)
|
|
36
|
-
|
|
37
|
-
content?.querySelectorAll(levels as any).forEach((header) => {
|
|
38
|
-
headers.value.push({
|
|
39
|
-
level: header.tagName.toLowerCase().replace('h', ''),
|
|
40
|
-
title: header.textContent.replace('#', ''),
|
|
41
|
-
slug: header.id,
|
|
42
|
-
lang: header.lang || locale.value,
|
|
43
|
-
})
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
watch(() => route.path, () => {
|
|
48
|
-
generateHeaders()
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
onMounted(() => {
|
|
52
|
-
generateHeaders()
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
return {
|
|
56
|
-
headers,
|
|
57
|
-
generateHeaders,
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const { headers, generateHeaders } = useHeaders()
|
|
62
|
-
|
|
63
|
-
if (import.meta.hot) {
|
|
64
|
-
import.meta.hot.on('valaxy:md-update', () => {
|
|
65
|
-
setTimeout(() => {
|
|
66
|
-
generateHeaders()
|
|
67
|
-
// 400ms transition
|
|
68
|
-
}, 600)
|
|
69
|
-
})
|
|
70
|
-
}
|
|
71
|
-
</script>
|
|
72
|
-
|
|
73
|
-
<template>
|
|
74
|
-
<div v-if="headers" ref="container">
|
|
75
|
-
<div ref="marker" class="outline-marker" />
|
|
76
|
-
<ul class="va-toc" p="l-4">
|
|
77
|
-
<li v-for="header, i in headers" :key="i" :lang="header.lang || locale" class="va-toc-item" :style="getStylesByLevel(header.level)">
|
|
78
|
-
<a class="toc-link-item" :href="`#${header.slug}`">{{ header.title }}</a>
|
|
79
|
-
</li>
|
|
80
|
-
</ul>
|
|
81
|
-
</div>
|
|
82
|
-
</template>
|
|
83
|
-
|
|
84
|
-
<style lang="scss">
|
|
85
|
-
.outline-marker {
|
|
86
|
-
opacity: 0;
|
|
87
|
-
position: absolute;
|
|
88
|
-
background-color: var(--va-c-primary);
|
|
89
|
-
border-radius: 4px;
|
|
90
|
-
width: 4px;
|
|
91
|
-
height: 20px;
|
|
92
|
-
top: 32px;
|
|
93
|
-
left: 20px;
|
|
94
|
-
z-index: 0;
|
|
95
|
-
transition: top 0.25s cubic-bezier(0, 1, 0.5, 1), opacity 0.25s,
|
|
96
|
-
background-color 0.5s;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.va-toc {
|
|
100
|
-
top: 10px;
|
|
101
|
-
width: var(--yun-sidebar-width-mobile);
|
|
102
|
-
|
|
103
|
-
background-color: var(--va-c-bg-light);
|
|
104
|
-
|
|
105
|
-
font-size: 1rem;
|
|
106
|
-
font-family: var(--va-font-serif);
|
|
107
|
-
font-weight: 900;
|
|
108
|
-
line-height: 1.6;
|
|
109
|
-
|
|
110
|
-
text-align: left;
|
|
111
|
-
|
|
112
|
-
a {
|
|
113
|
-
display: block;
|
|
114
|
-
color: var(--c-toc-link);
|
|
115
|
-
transition: color var(--va-transition-duration);
|
|
116
|
-
|
|
117
|
-
overflow: hidden;
|
|
118
|
-
white-space: nowrap;
|
|
119
|
-
text-overflow: ellipsis;
|
|
120
|
-
|
|
121
|
-
font-weight: 900;
|
|
122
|
-
|
|
123
|
-
&:hover {
|
|
124
|
-
color: var(--va-c-text);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.toc-link-item {
|
|
129
|
-
color: var(--va-c-text-light);
|
|
130
|
-
|
|
131
|
-
&:hover {
|
|
132
|
-
color: var(--va-c-text);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
&.active {
|
|
136
|
-
color: var(--va-c-primary);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
</style>
|
package/client/modules/README.md
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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
|
-
```
|
package/client/pages/README.md
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
```
|
package/dist/chunk-2QVEQP3K.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/dist/chunk-4FKSRP5I.mjs
DELETED
|
File without changes
|
package/dist/chunk-IMWNMHRD.mjs
DELETED
|
File without changes
|
package/dist/chunk-KP3MIFG6.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/dist/client/index.d.ts
DELETED
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import * as vue from 'vue';
|
|
2
|
-
import { InjectionKey, ComputedRef, Ref } from 'vue';
|
|
3
|
-
import * as valaxy_types from 'valaxy/types';
|
|
4
|
-
import { ValaxyConfig, PageData, Post } from 'valaxy/types';
|
|
5
|
-
import * as _vueuse_shared from '@vueuse/shared';
|
|
6
|
-
import { WalineInstance } from '@waline/client';
|
|
7
|
-
import * as pinia from 'pinia';
|
|
8
|
-
import { ViteSSGContext } from 'vite-ssg';
|
|
9
|
-
import { Awaitable } from '@antfu/utils';
|
|
10
|
-
import { VitePluginConfig } from 'unocss/vite';
|
|
11
|
-
|
|
12
|
-
interface ValaxyContext {
|
|
13
|
-
userRoot: string;
|
|
14
|
-
}
|
|
15
|
-
declare const valaxyConfigSymbol: InjectionKey<ComputedRef<ValaxyConfig>>;
|
|
16
|
-
declare const valaxyConfigRef: vue.ShallowRef<ValaxyConfig<valaxy_types.ValaxyThemeConfig>>;
|
|
17
|
-
declare const valaxyContextRef: vue.ShallowRef<ValaxyContext>;
|
|
18
|
-
declare function initConfig(): ComputedRef<ValaxyConfig<valaxy_types.ValaxyThemeConfig>>;
|
|
19
|
-
declare function initContext(): ComputedRef<ValaxyContext>;
|
|
20
|
-
declare function useConfig<ThemeConfig = any>(): ComputedRef<ValaxyConfig<ThemeConfig>>;
|
|
21
|
-
interface ValaxyData<T = any> {
|
|
22
|
-
page: Ref<PageData>;
|
|
23
|
-
theme: Ref<T>;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
interface BaseCategory {
|
|
27
|
-
total: number;
|
|
28
|
-
}
|
|
29
|
-
interface ParentCategory extends BaseCategory {
|
|
30
|
-
children: Categories;
|
|
31
|
-
}
|
|
32
|
-
interface PostCategory extends BaseCategory {
|
|
33
|
-
posts: Post[];
|
|
34
|
-
}
|
|
35
|
-
declare type Category = ParentCategory | PostCategory;
|
|
36
|
-
declare type Categories = Map<string, Category>;
|
|
37
|
-
declare const isParentCategory: (category: any) => category is ParentCategory;
|
|
38
|
-
/**
|
|
39
|
-
* get categories from posts
|
|
40
|
-
* @returns
|
|
41
|
-
*/
|
|
42
|
-
declare function useCategory(category?: string, posts?: Post[]): ParentCategory;
|
|
43
|
-
|
|
44
|
-
declare const usePostTitle: (post: Ref<Post>) => vue.ComputedRef<any>;
|
|
45
|
-
/**
|
|
46
|
-
* get post list
|
|
47
|
-
* todo: use vue provide/inject to global
|
|
48
|
-
* @param params
|
|
49
|
-
* @returns
|
|
50
|
-
*/
|
|
51
|
-
declare function usePostList(params?: {
|
|
52
|
-
type?: string;
|
|
53
|
-
}): vue.ComputedRef<Post[]>;
|
|
54
|
-
/**
|
|
55
|
-
* get all page
|
|
56
|
-
* @returns
|
|
57
|
-
*/
|
|
58
|
-
declare function usePageList(): vue.ComputedRef<any[]>;
|
|
59
|
-
/**
|
|
60
|
-
* get prev and next post
|
|
61
|
-
* @param path
|
|
62
|
-
* @returns
|
|
63
|
-
*/
|
|
64
|
-
declare function usePrevNext(path?: string): vue.ComputedRef<Post | null>[];
|
|
65
|
-
|
|
66
|
-
declare type Tags = Map<string, {
|
|
67
|
-
count: number;
|
|
68
|
-
}>;
|
|
69
|
-
/**
|
|
70
|
-
* get utils about tags
|
|
71
|
-
*/
|
|
72
|
-
declare function useTags(options?: {
|
|
73
|
-
/**
|
|
74
|
-
* Primary Color
|
|
75
|
-
*/
|
|
76
|
-
primary: string;
|
|
77
|
-
}): {
|
|
78
|
-
tags: Tags;
|
|
79
|
-
getTagStyle: (count: number) => {
|
|
80
|
-
'--yun-tag-color': string;
|
|
81
|
-
fontSize: string;
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* get tag map
|
|
86
|
-
* @returns
|
|
87
|
-
*/
|
|
88
|
-
declare function useTag(): Tags;
|
|
89
|
-
|
|
90
|
-
declare function useFrontmatter(): vue.ComputedRef<Post>;
|
|
91
|
-
/**
|
|
92
|
-
* get full url
|
|
93
|
-
*/
|
|
94
|
-
declare function useFullUrl(): vue.ComputedRef<string>;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* trigger show invisible element
|
|
98
|
-
* @param target
|
|
99
|
-
* @returns
|
|
100
|
-
*/
|
|
101
|
-
declare function useInvisibleElement(target: Ref<HTMLElement>): {
|
|
102
|
-
show: () => void;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
declare const isDark: vue.WritableComputedRef<boolean>;
|
|
106
|
-
declare const toggleDark: (value?: boolean | undefined) => boolean;
|
|
107
|
-
|
|
108
|
-
declare function useLayout(layout: string): vue.ComputedRef<boolean>;
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* use MetingJS and Aplayer
|
|
112
|
-
* @see https://github.com/MoePlayer/APlayer
|
|
113
|
-
* @see https://github.com/metowolf/MetingJS
|
|
114
|
-
*/
|
|
115
|
-
declare function useAplayer(): void;
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* You can use href="#" to back to top
|
|
119
|
-
* @description 你可以使用它来编写自己的 backToTop
|
|
120
|
-
*/
|
|
121
|
-
declare function useBackToTop(options?: {
|
|
122
|
-
/**
|
|
123
|
-
* show backToTop button, when height > offset
|
|
124
|
-
*/
|
|
125
|
-
offset: number;
|
|
126
|
-
}): {
|
|
127
|
-
percentage: vue.Ref<number>;
|
|
128
|
-
show: vue.Ref<boolean>;
|
|
129
|
-
} | {
|
|
130
|
-
percentage: vue.ComputedRef<number>;
|
|
131
|
-
show: vue.ComputedRef<boolean>;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
declare function useCodePen(): void;
|
|
135
|
-
|
|
136
|
-
declare const useLocale: () => {
|
|
137
|
-
lang: _vueuse_shared.RemovableRef<string>;
|
|
138
|
-
toggleLocales: () => void;
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
declare function useActiveSidebarLinks(container: Ref<HTMLElement>, marker: Ref<HTMLElement>): void;
|
|
142
|
-
|
|
143
|
-
declare global {
|
|
144
|
-
interface Window {
|
|
145
|
-
twikoo: {
|
|
146
|
-
init: (options: {
|
|
147
|
-
envId: string;
|
|
148
|
-
el: string;
|
|
149
|
-
} | any) => any;
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* A simple, safe, free comment system.
|
|
155
|
-
* @public
|
|
156
|
-
* @see https://github.com/imaegoo/twikoo
|
|
157
|
-
* @see https://twikoo.js.org/
|
|
158
|
-
* @param options
|
|
159
|
-
*/
|
|
160
|
-
declare function useTwikoo(options?: {}): void;
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* A Simple, Safe Comment System.
|
|
164
|
-
* @public
|
|
165
|
-
* @see https://github.com/walinejs/waline
|
|
166
|
-
* @see https://waline.js.org/
|
|
167
|
-
* @param options
|
|
168
|
-
* @returns
|
|
169
|
-
*/
|
|
170
|
-
declare function useWaline(options?: {}, cdn?: string): WalineInstance | null | undefined;
|
|
171
|
-
|
|
172
|
-
declare const useAppStore: pinia.StoreDefinition<"app", pinia._UnwrapAll<Pick<{
|
|
173
|
-
isSidebarOpen: vue.Ref<boolean>;
|
|
174
|
-
toggleSidebar: (value?: boolean | undefined) => boolean;
|
|
175
|
-
isRightSidebarOpen: vue.Ref<boolean>;
|
|
176
|
-
toggleRightSidebar: (value?: boolean | undefined) => boolean;
|
|
177
|
-
}, "isSidebarOpen" | "isRightSidebarOpen">>, pinia._UnwrapAll<Pick<{
|
|
178
|
-
isSidebarOpen: vue.Ref<boolean>;
|
|
179
|
-
toggleSidebar: (value?: boolean | undefined) => boolean;
|
|
180
|
-
isRightSidebarOpen: vue.Ref<boolean>;
|
|
181
|
-
toggleRightSidebar: (value?: boolean | undefined) => boolean;
|
|
182
|
-
}, never>>, Pick<{
|
|
183
|
-
isSidebarOpen: vue.Ref<boolean>;
|
|
184
|
-
toggleSidebar: (value?: boolean | undefined) => boolean;
|
|
185
|
-
isRightSidebarOpen: vue.Ref<boolean>;
|
|
186
|
-
toggleRightSidebar: (value?: boolean | undefined) => boolean;
|
|
187
|
-
}, "toggleSidebar" | "toggleRightSidebar">>;
|
|
188
|
-
|
|
189
|
-
declare const cdnPrefix = "https://npm.elemecdn.com/";
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* 生成介于 min 与 max 之间的随机数
|
|
193
|
-
* @returns
|
|
194
|
-
*/
|
|
195
|
-
declare function random(min: number, max: number): number;
|
|
196
|
-
/**
|
|
197
|
-
* wrap node
|
|
198
|
-
* @param className
|
|
199
|
-
*/
|
|
200
|
-
declare function wrap(el: HTMLElement, className: string): void;
|
|
201
|
-
/**
|
|
202
|
-
* 包裹表格,添加 class 以控制 table 样式
|
|
203
|
-
*/
|
|
204
|
-
declare const wrapTable: (container?: HTMLElement | Document) => void;
|
|
205
|
-
declare function throttleAndDebounce(fn: () => void, delay: number): () => void;
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* use dayjs format date
|
|
209
|
-
* @param date
|
|
210
|
-
* @param template
|
|
211
|
-
* @returns
|
|
212
|
-
*/
|
|
213
|
-
declare function formatDate(date: string | number | Date, template?: string): string;
|
|
214
|
-
/**
|
|
215
|
-
* sort posts by date
|
|
216
|
-
* @param posts
|
|
217
|
-
* @param desc
|
|
218
|
-
*/
|
|
219
|
-
declare function sortByDate(posts: Post[], desc?: boolean): Post[];
|
|
220
|
-
|
|
221
|
-
declare type AppContext = ViteSSGContext;
|
|
222
|
-
declare type AppSetup = (ctx: AppContext) => Awaitable<void>;
|
|
223
|
-
declare type UnoSetup = () => Awaitable<Partial<VitePluginConfig> | undefined>;
|
|
224
|
-
declare function defineAppSetup(fn: AppSetup): AppSetup;
|
|
225
|
-
declare function defineUnoSetup(fn: UnoSetup): UnoSetup;
|
|
226
|
-
|
|
227
|
-
export { AppSetup, BaseCategory, Categories, Category, ParentCategory, PostCategory, Tags, UnoSetup, ValaxyData, cdnPrefix, defineAppSetup, defineUnoSetup, formatDate, initConfig, initContext, isDark, isParentCategory, random, sortByDate, throttleAndDebounce, toggleDark, useActiveSidebarLinks, useAplayer, useAppStore, useBackToTop, useCategory, useCodePen, useConfig, useFrontmatter, useFullUrl, useInvisibleElement, useLayout, useLocale, usePageList, usePostList, usePostTitle, usePrevNext, useTag, useTags, useTwikoo, useWaline, valaxyConfigRef, valaxyConfigSymbol, valaxyContextRef, wrap, wrapTable };
|
package/dist/client/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }require('../chunk-KP3MIFG6.js');require('../chunk-EYC2AAUG.js');require('../chunk-2QVEQP3K.js');var _config = require('/@valaxyjs/config'); var _config2 = _interopRequireDefault(_config);var _context = require('/@valaxyjs/context'); var _context2 = _interopRequireDefault(_context);var _vue = require('vue');function y(t){let e=JSON.parse(t);return __DEV__?_vue.readonly.call(void 0, e):e}var I=Symbol("valaxy:config"),w= exports.valaxyConfigRef =_vue.shallowRef.call(void 0, y(_config2.default)),T= exports.valaxyContextRef =_vue.shallowRef.call(void 0, y(_context2.default));import.meta.hot&&(import.meta.hot.accept("/@valaxyjs/config",t=>{w.value=y(t.default)}),import.meta.hot.accept("/@valaxyjs/context",t=>{T.value=y(t.default)}));function Mt(){return _vue.computed.call(void 0, ()=>w.value)}function Et(){return _vue.computed.call(void 0, ()=>T.value)}function g(){let t=_vue.inject.call(void 0, I);if(!t)throw new Error("[Valaxy] config not properly injected in app");return t}var _vuerouter = require('vue-router');var _vuei18n = require('vue-i18n');var b="https://npm.elemecdn.com/";function jt(t,e){return Math.random()*(e-t)+t}function $(t,e){let o=document.createElement("div");o.className=e,t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),o.appendChild(t)}var Ht=(t=document)=>{t.querySelectorAll("table").forEach(e=>{let o=document.createElement("div");o.className="table-container",$(e,"table-container")})};function kt(t,e){let o,n=!1;return()=>{o&&clearTimeout(o),n?o=setTimeout(t,e):(t(),n=!0,setTimeout(()=>{n=!1},e))}}var _dayjs = require('dayjs'); var _dayjs2 = _interopRequireDefault(_dayjs);function Ot(t,e="YYYY-MM-DD"){return _dayjs2.default.call(void 0, t).format(e)}function h(t,e=!0){return t.sort((o,n)=>{let i=+new Date(o.date||""),r=+new Date(n.date||"");return e?r-i:i-r})}var Ft=t=>{let{locale:e}=_vuei18n.useI18n.call(void 0, );return _vue.computed.call(void 0, ()=>{let o=e.value==="zh-CN"?"zh":e.value;return t.value[`title_${o}`]||t.value.title})};function x(t={}){let e=_vuerouter.useRouter.call(void 0, );return _vue.computed.call(void 0, ()=>{let o=e.getRoutes().filter(r=>r.path.startsWith("/posts")&&r.meta.frontmatter&&r.meta.frontmatter.date).filter(r=>!r.path.endsWith(".html")).filter(r=>!t.type||r.meta.frontmatter.type===t.type).map(r=>Object.assign({path:r.path,excerpt:r.meta.excerpt},r.meta.frontmatter)),n=h(o.filter(r=>r.top)).sort((r,l)=>l.top-r.top),i=h(o.filter(r=>!r.top));return n.concat(i)})}function Gt(){let t=_vuerouter.useRouter.call(void 0, );return _vue.computed.call(void 0, ()=>t.getRoutes().map(o=>Object.assign({path:o.path,excerpt:o.meta.excerpt},o.meta.frontmatter)))}function Kt(t){let e=_vuerouter.useRoute.call(void 0, ),o=_vue.computed.call(void 0, ()=>t||e.path),n=x(),i=_vue.computed.call(void 0, ()=>{let a=-1;return n.value.find((s,u)=>s.path===o.value?(a=u,!0):!1),a}),r=_vue.computed.call(void 0, ()=>i.value-1>=0?n.value[i.value-1]:null),l=_vue.computed.call(void 0, ()=>i.value+1<n.value.length?n.value[i.value+1]:null);return[r,l]}var Zt=t=>t.children;function te(t,e=[]){var i;e.length||(e=_vue.unref.call(void 0, x()));let o={total:e.length,children:new Map([["Uncategorized",{total:0,posts:[]}]])},n=o.children.get("Uncategorized");if(e.forEach(r=>{if(r.categories)if(Array.isArray(r.categories)){let l=r.categories.length,a=o;r.categories.forEach((s,u)=>{var p,d,f;if(u===l-1)if(a.children.has(s)){let c=a.children.get(s);c.posts&&(c.total+=1,c.posts.push(r))}else(p=a.children)==null||p.set(s,{total:1,posts:[r]});else if((d=a.children)!=null&&d.has(s)){let c=a.children.get(s);c.total+=1,a=c}else{let c={total:1,children:new Map};(f=a.children)==null||f.set(s,c),a=c}})}else{let l=r.categories;if(o.children.has(l)){let a=o.children.get(l);a.total+=1,a.posts.push(r)}else o.children.set(l,{total:1,posts:[r]})}else n.total+=1,n.posts.push(r)}),n.total===0&&((i=o.children)==null||i.delete("Uncategorized")),t){let r=o.children.get(t);return r?{total:r==null?void 0:r.total,children:new Map([[t,r]])}:(console.warn(`Do not have category: ${t}`),o)}else return o}var _tinycolor = require('@ctrl/tinycolor');function ne(t={primary:"#0078E7"}){let e=N(),o=new (0, _tinycolor.TinyColor)("#999999"),n=new (0, _tinycolor.TinyColor)(t.primary);return{tags:e,getTagStyle:r=>{let l=Array.from(e).map(([d,f])=>f.count),a=Math.max(...l),s=Math.min(...l),u=a-s,p=(r-s)/u;return{"--yun-tag-color":o.mix(n,p*100).toString(),fontSize:`${p*36+12}px`}}}}function N(){let t=x(),e=new Map;return t.value.forEach(o=>{if(o.tags){let n;typeof o.tags=="string"?n=[o.tags]:n=o.tags,n.forEach(i=>{if(e.has(i)){let r=e.get(i);e.set(i,{...r,count:r.count+1})}else e.set(i,{count:1})})}}),e}var _core = require('@vueuse/core');function ce(){let t=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>t.meta.frontmatter)}function pe(){let t=g(),e=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>((t.value.url.endsWith("/")?t.value.url.slice(0,-1):t.value.url)||_core.isClient&&window.location.origin)+e.path)}function de(t){let e=_vue.ref.call(void 0, !1),{top:o}=_core.useElementBounding.call(void 0, t);return _core.useIntersectionObserver.call(void 0, t,([{isIntersecting:i}])=>{e.value=i}),{show:()=>{e.value||window.scrollTo(0,o.value)}}}var Q=_core.useDark.call(void 0, ),he= exports.toggleDark =_core.useToggle.call(void 0, Q);function Te(t){let e=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>e.meta.layout===t)}var _head = require('@vueuse/head');function je(){let t=g(),e=_vue.computed.call(void 0, ()=>t.value.cdn.prefix);_head.useHead.call(void 0, {link:[{rel:"stylesheet",href:`${e.value}aplayer/dist/APlayer.min.css`}]}),_core.useScriptTag.call(void 0, `${e.value}aplayer/dist/APlayer.min.js`,()=>{_core.useScriptTag.call(void 0, `${e.value}meting@2/dist/Meting.min.js`)})}function Ue(t={offset:100}){if(!_core.isClient)return{percentage:_vue.ref.call(void 0, 0),show:_vue.ref.call(void 0, !1)};let{y:e}=_core.useWindowScroll.call(void 0, ),o=_vue.computed.call(void 0, ()=>e.value/(document.body.scrollHeight-window.innerHeight)),n=_vue.computed.call(void 0, ()=>e.value>t.offset);return{percentage:o,show:n}}function $e(){_head.useHead.call(void 0, {script:[{src:"https://static.codepen.io/assets/embed/ei.js",async:!0}]})}var Fe=()=>{let{availableLocales:t,locale:e}=_vuei18n.useI18n.call(void 0, ),o=_core.useStorage.call(void 0, "valaxy-locale",e.value);return{lang:o,toggleLocales:()=>{let i=t;e.value=i[(i.indexOf(e.value)+1)%i.length],o.value=e.value,_core.isClient&&document.documentElement.setAttribute("lang",e.value)}}};function Je(t,e){let o=pt(n,200);function n(){let a=[].slice.call(document.querySelectorAll(".va-toc a.toc-link-item")),s=[].slice.call(document.querySelectorAll("main .header-anchor")).filter(u=>a.some(p=>p.hash===u.hash));for(let u=0;u<s.length;u++){let p=s[u],d=s[u+1],[f,c]=ct(u,p,d);if(f){history.replaceState(null,document.title,c||" "),r(c);return}}}let i=null;function r(a){l(i);let s=i=a==null?null:t.value.querySelector(`.va-toc a[href="${a}"]`);e.value&&(s?(s.classList.add("active"),e.value.style.opacity="1",e.value.style.top=`${s.offsetTop+2}px`):(e.value.style.opacity="0",e.value.style.top="54px"))}function l(a){a&&a.classList.remove("active")}_vue.onMounted.call(void 0, ()=>{requestAnimationFrame(n),window.addEventListener("scroll",o)}),_vue.onUnmounted.call(void 0, ()=>{window.removeEventListener("scroll",o)})}function D(t){return t.parentElement.offsetTop-50}function ct(t,e,o){let n=window.scrollY;return t===0&&n===0?[!0,null]:n<D(e)?[!1,null]:!o||n<D(o)?[!0,decodeURIComponent(e.hash)]:[!1,null]}function pt(t,e){let o,n=!1;return()=>{o&&clearTimeout(o),n?o=setTimeout(t,e):(t(),n=!0,setTimeout(()=>{n=!1},e))}}function ro(t={}){let e=g(),o=_vue.computed.call(void 0, ()=>e.value.cdn.prefix),n=_vuerouter.useRoute.call(void 0, ),{locale:i}=_vuei18n.useI18n.call(void 0, );function r(l={}){if(!_core.isClient)return;let a={el:".comment #tcomment",lang:i.value,path:n.path},s=Object.assign(a,l);return window.twikoo.init(s)}_core.useScriptTag.call(void 0, `${o.value}twikoo@1.5.1/dist/twikoo.all.min.js`,()=>{r(t)})}require('@waline/client/dist/waline.css');function po(t={},e=b){if(!_core.isClient)return;let o=_vuerouter.useRoute.call(void 0, ),{locale:n}=_vuei18n.useI18n.call(void 0, ),i;_vue.onMounted.call(void 0, ()=>{r(t)});function r(l={}){let a={el:".comment #waline",serverURL:"",lang:n.value,dark:"html.dark",emoji:[`${e}@waline/emojis/bilibili/`,`${e}@waline/emojis/qq/`,`${e}@waline/emojis/weibo/`],path:o.path},s=Object.assign(a,l);Promise.resolve().then(() => require("@waline/client")).then(({init:u})=>{i=u(s)})}return _vue.watch.call(void 0, ()=>o.path,l=>{!i||i.update({path:l})}),_vue.watch.call(void 0, n,l=>{!i||i.update({lang:l})}),_vue.onUnmounted.call(void 0, ()=>{!i||i.destroy()}),i}var _pinia = require('pinia');var Pt=_pinia.defineStore.call(void 0, "app",()=>{let[t,e]=_core.useToggle.call(void 0, !1),[o,n]=_core.useToggle.call(void 0, !1);return{isSidebarOpen:t,toggleSidebar:e,isRightSidebarOpen:o,toggleRightSidebar:n}});import.meta.hot&&import.meta.hot.accept(_pinia.acceptHMRUpdate.call(void 0, Pt,import.meta.hot));function jo(t){return t}function Ho(t){return t}exports.cdnPrefix = b; exports.defineAppSetup = jo; exports.defineUnoSetup = Ho; exports.formatDate = Ot; exports.initConfig = Mt; exports.initContext = Et; exports.isDark = Q; exports.isParentCategory = Zt; exports.random = jt; exports.sortByDate = h; exports.throttleAndDebounce = kt; exports.toggleDark = he; exports.useActiveSidebarLinks = Je; exports.useAplayer = je; exports.useAppStore = Pt; exports.useBackToTop = Ue; exports.useCategory = te; exports.useCodePen = $e; exports.useConfig = g; exports.useFrontmatter = ce; exports.useFullUrl = pe; exports.useInvisibleElement = de; exports.useLayout = Te; exports.useLocale = Fe; exports.usePageList = Gt; exports.usePostList = x; exports.usePostTitle = Ft; exports.usePrevNext = Kt; exports.useTag = N; exports.useTags = ne; exports.useTwikoo = ro; exports.useWaline = po; exports.valaxyConfigRef = w; exports.valaxyConfigSymbol = I; exports.valaxyContextRef = T; exports.wrap = $; exports.wrapTable = Ht;
|
package/dist/client/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"../chunk-4FKSRP5I.mjs";import"../chunk-EIYDDCHI.mjs";import"../chunk-IMWNMHRD.mjs";import k from"/@valaxyjs/config";import V from"/@valaxyjs/context";import{computed as v,inject as U,readonly as O,shallowRef as C}from"vue";function y(t){let e=JSON.parse(t);return __DEV__?O(e):e}var I=Symbol("valaxy:config"),w=C(y(k)),T=C(y(V));import.meta.hot&&(import.meta.hot.accept("/@valaxyjs/config",t=>{w.value=y(t.default)}),import.meta.hot.accept("/@valaxyjs/context",t=>{T.value=y(t.default)}));function Mt(){return v(()=>w.value)}function Et(){return v(()=>T.value)}function g(){let t=U(I);if(!t)throw new Error("[Valaxy] config not properly injected in app");return t}import{unref as z}from"vue";import{computed as m}from"vue";import{useRoute as B,useRouter as P}from"vue-router";import{useI18n as q}from"vue-i18n";var b="https://npm.elemecdn.com/";function jt(t,e){return Math.random()*(e-t)+t}function $(t,e){let o=document.createElement("div");o.className=e,t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),o.appendChild(t)}var Ht=(t=document)=>{t.querySelectorAll("table").forEach(e=>{let o=document.createElement("div");o.className="table-container",$(e,"table-container")})};function kt(t,e){let o,n=!1;return()=>{o&&clearTimeout(o),n?o=setTimeout(t,e):(t(),n=!0,setTimeout(()=>{n=!1},e))}}import W from"dayjs";function Ot(t,e="YYYY-MM-DD"){return W(t).format(e)}function h(t,e=!0){return t.sort((o,n)=>{let i=+new Date(o.date||""),r=+new Date(n.date||"");return e?r-i:i-r})}var Ft=t=>{let{locale:e}=q();return m(()=>{let o=e.value==="zh-CN"?"zh":e.value;return t.value[`title_${o}`]||t.value.title})};function x(t={}){let e=P();return m(()=>{let o=e.getRoutes().filter(r=>r.path.startsWith("/posts")&&r.meta.frontmatter&&r.meta.frontmatter.date).filter(r=>!r.path.endsWith(".html")).filter(r=>!t.type||r.meta.frontmatter.type===t.type).map(r=>Object.assign({path:r.path,excerpt:r.meta.excerpt},r.meta.frontmatter)),n=h(o.filter(r=>r.top)).sort((r,l)=>l.top-r.top),i=h(o.filter(r=>!r.top));return n.concat(i)})}function Gt(){let t=P();return m(()=>t.getRoutes().map(o=>Object.assign({path:o.path,excerpt:o.meta.excerpt},o.meta.frontmatter)))}function Kt(t){let e=B(),o=m(()=>t||e.path),n=x(),i=m(()=>{let a=-1;return n.value.find((s,u)=>s.path===o.value?(a=u,!0):!1),a}),r=m(()=>i.value-1>=0?n.value[i.value-1]:null),l=m(()=>i.value+1<n.value.length?n.value[i.value+1]:null);return[r,l]}var Zt=t=>t.children;function te(t,e=[]){var i;e.length||(e=z(x()));let o={total:e.length,children:new Map([["Uncategorized",{total:0,posts:[]}]])},n=o.children.get("Uncategorized");if(e.forEach(r=>{if(r.categories)if(Array.isArray(r.categories)){let l=r.categories.length,a=o;r.categories.forEach((s,u)=>{var p,d,f;if(u===l-1)if(a.children.has(s)){let c=a.children.get(s);c.posts&&(c.total+=1,c.posts.push(r))}else(p=a.children)==null||p.set(s,{total:1,posts:[r]});else if((d=a.children)!=null&&d.has(s)){let c=a.children.get(s);c.total+=1,a=c}else{let c={total:1,children:new Map};(f=a.children)==null||f.set(s,c),a=c}})}else{let l=r.categories;if(o.children.has(l)){let a=o.children.get(l);a.total+=1,a.posts.push(r)}else o.children.set(l,{total:1,posts:[r]})}else n.total+=1,n.posts.push(r)}),n.total===0&&((i=o.children)==null||i.delete("Uncategorized")),t){let r=o.children.get(t);return r?{total:r==null?void 0:r.total,children:new Map([[t,r]])}:(console.warn(`Do not have category: ${t}`),o)}else return o}import{TinyColor as A}from"@ctrl/tinycolor";function ne(t={primary:"#0078E7"}){let e=N(),o=new A("#999999"),n=new A(t.primary);return{tags:e,getTagStyle:r=>{let l=Array.from(e).map(([d,f])=>f.count),a=Math.max(...l),s=Math.min(...l),u=a-s,p=(r-s)/u;return{"--yun-tag-color":o.mix(n,p*100).toString(),fontSize:`${p*36+12}px`}}}}function N(){let t=x(),e=new Map;return t.value.forEach(o=>{if(o.tags){let n;typeof o.tags=="string"?n=[o.tags]:n=o.tags,n.forEach(i=>{if(e.has(i)){let r=e.get(i);e.set(i,{...r,count:r.count+1})}else e.set(i,{count:1})})}}),e}import{useRoute as L}from"vue-router";import{computed as S}from"vue";import{isClient as _}from"@vueuse/core";function ce(){let t=L();return S(()=>t.meta.frontmatter)}function pe(){let t=g(),e=L();return S(()=>((t.value.url.endsWith("/")?t.value.url.slice(0,-1):t.value.url)||_&&window.location.origin)+e.path)}import{useElementBounding as Y,useIntersectionObserver as F}from"@vueuse/core";import{ref as G}from"vue";function de(t){let e=G(!1),{top:o}=Y(t);return F(t,([{isIntersecting:i}])=>{e.value=i}),{show:()=>{e.value||window.scrollTo(0,o.value)}}}import{useDark as K,useToggle as J}from"@vueuse/core";var Q=K(),he=J(Q);import{computed as X}from"vue";import{useRoute as Z}from"vue-router";function Te(t){let e=Z();return X(()=>e.meta.layout===t)}import{useScriptTag as M}from"@vueuse/core";import{useHead as tt}from"@vueuse/head";import{computed as et}from"vue";function je(){let t=g(),e=et(()=>t.value.cdn.prefix);tt({link:[{rel:"stylesheet",href:`${e.value}aplayer/dist/APlayer.min.css`}]}),M(`${e.value}aplayer/dist/APlayer.min.js`,()=>{M(`${e.value}meting@2/dist/Meting.min.js`)})}import{isClient as ot,useWindowScroll as rt}from"@vueuse/core";import{computed as E,ref as R}from"vue";function Ue(t={offset:100}){if(!ot)return{percentage:R(0),show:R(!1)};let{y:e}=rt(),o=E(()=>e.value/(document.body.scrollHeight-window.innerHeight)),n=E(()=>e.value>t.offset);return{percentage:o,show:n}}import{useHead as nt}from"@vueuse/head";function $e(){nt({script:[{src:"https://static.codepen.io/assets/embed/ei.js",async:!0}]})}import{isClient as it,useStorage as at}from"@vueuse/core";import{useI18n as st}from"vue-i18n";var Fe=()=>{let{availableLocales:t,locale:e}=st(),o=at("valaxy-locale",e.value);return{lang:o,toggleLocales:()=>{let i=t;e.value=i[(i.indexOf(e.value)+1)%i.length],o.value=e.value,it&&document.documentElement.setAttribute("lang",e.value)}}};import{onMounted as lt,onUnmounted as ut}from"vue";function Je(t,e){let o=pt(n,200);function n(){let a=[].slice.call(document.querySelectorAll(".va-toc a.toc-link-item")),s=[].slice.call(document.querySelectorAll("main .header-anchor")).filter(u=>a.some(p=>p.hash===u.hash));for(let u=0;u<s.length;u++){let p=s[u],d=s[u+1],[f,c]=ct(u,p,d);if(f){history.replaceState(null,document.title,c||" "),r(c);return}}}let i=null;function r(a){l(i);let s=i=a==null?null:t.value.querySelector(`.va-toc a[href="${a}"]`);e.value&&(s?(s.classList.add("active"),e.value.style.opacity="1",e.value.style.top=`${s.offsetTop+2}px`):(e.value.style.opacity="0",e.value.style.top="54px"))}function l(a){a&&a.classList.remove("active")}lt(()=>{requestAnimationFrame(n),window.addEventListener("scroll",o)}),ut(()=>{window.removeEventListener("scroll",o)})}function D(t){return t.parentElement.offsetTop-50}function ct(t,e,o){let n=window.scrollY;return t===0&&n===0?[!0,null]:n<D(e)?[!1,null]:!o||n<D(o)?[!0,decodeURIComponent(e.hash)]:[!1,null]}function pt(t,e){let o,n=!1;return()=>{o&&clearTimeout(o),n?o=setTimeout(t,e):(t(),n=!0,setTimeout(()=>{n=!1},e))}}import{isClient as mt,useScriptTag as ft}from"@vueuse/core";import{computed as gt}from"vue";import{useI18n as dt}from"vue-i18n";import{useRoute as xt}from"vue-router";function ro(t={}){let e=g(),o=gt(()=>e.value.cdn.prefix),n=xt(),{locale:i}=dt();function r(l={}){if(!mt)return;let a={el:".comment #tcomment",lang:i.value,path:n.path},s=Object.assign(a,l);return window.twikoo.init(s)}ft(`${o.value}twikoo@1.5.1/dist/twikoo.all.min.js`,()=>{r(t)})}import{isClient as yt}from"@vueuse/core";import{onMounted as ht,onUnmounted as vt,watch as j}from"vue";import{useI18n as Ct}from"vue-i18n";import{useRoute as wt}from"vue-router";import"@waline/client/dist/waline.css";function po(t={},e=b){if(!yt)return;let o=wt(),{locale:n}=Ct(),i;ht(()=>{r(t)});function r(l={}){let a={el:".comment #waline",serverURL:"",lang:n.value,dark:"html.dark",emoji:[`${e}@waline/emojis/bilibili/`,`${e}@waline/emojis/qq/`,`${e}@waline/emojis/weibo/`],path:o.path},s=Object.assign(a,l);import("@waline/client").then(({init:u})=>{i=u(s)})}return j(()=>o.path,l=>{!i||i.update({path:l})}),j(n,l=>{!i||i.update({lang:l})}),vt(()=>{!i||i.destroy()}),i}import{acceptHMRUpdate as Tt,defineStore as bt}from"pinia";import{useToggle as H}from"@vueuse/core";var Pt=bt("app",()=>{let[t,e]=H(!1),[o,n]=H(!1);return{isSidebarOpen:t,toggleSidebar:e,isRightSidebarOpen:o,toggleRightSidebar:n}});import.meta.hot&&import.meta.hot.accept(Tt(Pt,import.meta.hot));function jo(t){return t}function Ho(t){return t}export{b as cdnPrefix,jo as defineAppSetup,Ho as defineUnoSetup,Ot as formatDate,Mt as initConfig,Et as initContext,Q as isDark,Zt as isParentCategory,jt as random,h as sortByDate,kt as throttleAndDebounce,he as toggleDark,Je as useActiveSidebarLinks,je as useAplayer,Pt as useAppStore,Ue as useBackToTop,te as useCategory,$e as useCodePen,g as useConfig,ce as useFrontmatter,pe as useFullUrl,de as useInvisibleElement,Te as useLayout,Fe as useLocale,Gt as usePageList,x as usePostList,Ft as usePostTitle,Kt as usePrevNext,N as useTag,ne as useTags,ro as useTwikoo,po as useWaline,w as valaxyConfigRef,I as valaxyConfigSymbol,T as valaxyContextRef,$ as wrap,Ht as wrapTable};
|