valaxy 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/valaxy.js +1 -1
- package/dist/chunk-B2JVVNA4.js +88 -0
- package/dist/chunk-FH6NMGNX.mjs +88 -0
- package/dist/chunk-TSLYS2VY.js +1 -0
- package/dist/chunk-U4ZDCBEC.mjs +1 -0
- package/dist/config-24b4f209.d.ts +188 -0
- package/dist/index.d.ts +337 -150
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{cli.d.ts → node/cli.d.ts} +0 -0
- package/dist/node/cli.js +45 -0
- package/dist/node/cli.mjs +45 -0
- package/dist/node/index.d.ts +46 -0
- package/dist/node/index.js +1 -0
- package/dist/node/index.mjs +1 -0
- package/package.json +23 -20
- package/src/client/components/PostCard.vue +16 -17
- package/src/client/components/PostList.vue +3 -3
- package/src/client/components/ValaxyCopyright.vue +1 -1
- package/src/client/components/ValaxyFooter.vue +1 -1
- package/src/client/components/ValaxyMd.vue +1 -1
- package/src/client/components/ValaxyOverlay.vue +4 -4
- package/src/client/components/ValaxyPagination.vue +14 -11
- package/src/client/components/ValaxyRightSidebar.vue +2 -2
- package/src/client/components/ValaxySidebar.vue +4 -10
- package/src/client/components/ValaxyToc.vue +12 -10
- package/src/client/composables/category.ts +24 -5
- package/src/client/composables/comments/index.ts +1 -0
- package/src/client/composables/comments/twikoo.ts +37 -0
- package/src/client/composables/comments/waline.ts +8 -5
- package/src/client/composables/common.ts +3 -4
- package/src/client/composables/post.ts +26 -1
- package/src/client/composables/search/algolia.ts +2 -1
- package/src/client/composables/sidebar.ts +2 -2
- package/src/client/composables/tag.ts +9 -2
- package/src/client/composables/widgets/backToTop.ts +10 -4
- package/src/client/index.html +5 -0
- package/src/client/layouts/404.vue +5 -1
- package/src/client/main.ts +2 -9
- package/src/client/modules/valaxy.ts +31 -13
- package/src/client/shims.d.ts +5 -5
- package/src/client/styles/common/button.scss +3 -5
- package/src/client/styles/common/code.scss +181 -9
- package/src/client/styles/common/custom-blocks.scss +84 -0
- package/src/client/styles/common/hamburger.scss +2 -2
- package/src/client/styles/common/markdown.scss +4 -6
- package/src/client/styles/common/sidebar.scss +3 -3
- package/src/client/styles/common/transition.scss +2 -2
- package/src/client/styles/css-vars.scss +39 -0
- package/src/client/styles/global/helper.scss +2 -2
- package/src/client/styles/global/i18n.scss +20 -0
- 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 +1 -1
- package/src/client/styles/index.scss +21 -8
- package/src/client/styles/mixins/config.scss +1 -1
- package/src/client/styles/mixins/index.scss +1 -0
- package/src/client/styles/palette.scss +58 -44
- 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 +32 -19
- package/src/node/markdown/headings.ts +3 -2
- package/src/node/markdown/highlight.ts +50 -0
- package/src/node/markdown/highlightLines.ts +96 -0
- package/src/node/markdown/index.ts +23 -12
- package/src/node/markdown/markdown-it-container.ts +9 -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 +46 -10
- package/src/node/plugins/unocss.ts +21 -19
- package/src/node/rss.ts +127 -0
- package/src/node/server.ts +1 -1
- package/src/node/shims.d.ts +15 -0
- package/src/node/utils/cli.ts +0 -1
- package/src/node/vite.ts +7 -15
- package/src/types/config.ts +28 -2
- package/src/types/posts.ts +6 -1
- package/tsup.config.ts +1 -0
- package/dist/build-VGAF4K5S.js +0 -1
- package/dist/build-Y5F7AZ2V.mjs +0 -1
- package/dist/chunk-5KQ3UFYI.js +0 -1
- package/dist/chunk-ESCOXVP6.mjs +0 -83
- package/dist/chunk-JWA76JND.mjs +0 -1
- package/dist/chunk-WYCH73X6.js +0 -83
- package/dist/cli.js +0 -6
- package/dist/cli.mjs +0 -6
- package/src/client/pages/about/index.md +0 -5
- package/src/client/pages/posts/index.md +0 -5
- package/src/client/styles/css-vars/dark.scss +0 -17
- package/src/client/styles/css-vars/index.scss +0 -18
- package/src/client/styles/css-vars/light.scss +0 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,203 +1,390 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
anchor?: {
|
|
12
|
-
permalink?: Anchor.AnchorOptions['permalink'];
|
|
13
|
-
};
|
|
14
|
-
toc?: any;
|
|
15
|
-
katex?: KatexOptions;
|
|
16
|
-
}
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { InjectionKey, ComputedRef, Ref, StyleValue } from 'vue';
|
|
3
|
+
import { V as ValaxyConfig, a as ValaxyThemeConfig } from './config-24b4f209.js';
|
|
4
|
+
export { S as SocialLink, U as UserConfig, V as ValaxyConfig, a as ValaxyThemeConfig, d as defaultValaxyConfig } from './config-24b4f209.js';
|
|
5
|
+
import 'type-fest';
|
|
6
|
+
import 'unocss/vite';
|
|
7
|
+
import 'markdown-it';
|
|
8
|
+
import 'markdown-it-anchor';
|
|
9
|
+
import 'katex';
|
|
10
|
+
import 'vite-plugin-md';
|
|
17
11
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
declare type ValaxyThemeConfig = Record<string, any>;
|
|
21
|
-
interface SocialLink {
|
|
12
|
+
interface Post extends Record<string, any> {
|
|
22
13
|
/**
|
|
23
|
-
*
|
|
14
|
+
* Path of post
|
|
15
|
+
* route.path
|
|
16
|
+
* @description 路径
|
|
24
17
|
*/
|
|
25
|
-
|
|
26
|
-
link: string;
|
|
18
|
+
path?: string;
|
|
27
19
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
20
|
+
* Title
|
|
21
|
+
* @description 文章标题
|
|
30
22
|
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
interface ValaxyConfig<T = ValaxyThemeConfig> {
|
|
23
|
+
title?: string;
|
|
24
|
+
date?: string | number | Date;
|
|
35
25
|
/**
|
|
36
|
-
*
|
|
37
|
-
* @description 默认语言
|
|
38
|
-
* @default 'en'
|
|
26
|
+
* Updated Time
|
|
39
27
|
*/
|
|
40
|
-
|
|
28
|
+
updated?: string | number | Date;
|
|
29
|
+
lang?: string;
|
|
41
30
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
31
|
+
* TODO
|
|
32
|
+
* Read Time
|
|
33
|
+
* @description 阅读时长
|
|
44
34
|
*/
|
|
45
|
-
|
|
35
|
+
duration?: string;
|
|
46
36
|
/**
|
|
47
|
-
*
|
|
48
|
-
* @description 站点标题
|
|
37
|
+
* post card type, can be bilibili/yuque/...
|
|
49
38
|
*/
|
|
50
|
-
|
|
39
|
+
type?: string;
|
|
51
40
|
/**
|
|
52
|
-
*
|
|
41
|
+
* override url, and jump directly
|
|
53
42
|
*/
|
|
54
|
-
|
|
43
|
+
url?: string;
|
|
55
44
|
/**
|
|
56
|
-
*
|
|
45
|
+
* @description 摘要
|
|
57
46
|
*/
|
|
58
|
-
|
|
47
|
+
excerpt?: string;
|
|
59
48
|
/**
|
|
60
|
-
*
|
|
61
|
-
* @description
|
|
49
|
+
* Display sponsor info
|
|
50
|
+
* @description 是否开启赞助
|
|
62
51
|
*/
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Your name
|
|
66
|
-
* @description 你的名字
|
|
67
|
-
*/
|
|
68
|
-
name: string;
|
|
69
|
-
avatar: string;
|
|
70
|
-
/**
|
|
71
|
-
* The status of you
|
|
72
|
-
* @description 状态
|
|
73
|
-
*/
|
|
74
|
-
status: {
|
|
75
|
-
emoji: string;
|
|
76
|
-
/**
|
|
77
|
-
* show when hover emoji
|
|
78
|
-
* @description 当鼠标悬浮在图标上时显示
|
|
79
|
-
*/
|
|
80
|
-
message: string;
|
|
81
|
-
};
|
|
82
|
-
};
|
|
52
|
+
sponsor?: boolean;
|
|
83
53
|
/**
|
|
84
|
-
*
|
|
54
|
+
* Copyright
|
|
55
|
+
* @description 是否显示文章底部版权信息
|
|
85
56
|
*/
|
|
86
|
-
|
|
57
|
+
copyright?: boolean;
|
|
87
58
|
/**
|
|
88
|
-
*
|
|
59
|
+
* Category
|
|
60
|
+
* @description 分类,若为数组,则按顺序代表多层文件夹
|
|
89
61
|
*/
|
|
90
|
-
|
|
91
|
-
algolia: {
|
|
92
|
-
enable: boolean;
|
|
93
|
-
appId: string;
|
|
94
|
-
apiKey: string;
|
|
95
|
-
indexName: string;
|
|
96
|
-
chunkSize: number;
|
|
97
|
-
};
|
|
98
|
-
};
|
|
62
|
+
categories?: string | string[];
|
|
99
63
|
/**
|
|
100
|
-
*
|
|
64
|
+
* Tags
|
|
65
|
+
* @description 标签,可以有多个
|
|
101
66
|
*/
|
|
102
|
-
|
|
103
|
-
waline: {
|
|
104
|
-
enable: boolean;
|
|
105
|
-
serverURL: string;
|
|
106
|
-
};
|
|
107
|
-
};
|
|
67
|
+
tags?: string[];
|
|
108
68
|
/**
|
|
109
|
-
*
|
|
110
|
-
* @description
|
|
69
|
+
* display prev next
|
|
70
|
+
* @description 是否显示前一篇、后一篇导航
|
|
111
71
|
*/
|
|
112
|
-
|
|
72
|
+
nav?: boolean;
|
|
113
73
|
/**
|
|
114
|
-
*
|
|
115
|
-
* @description 主题配置
|
|
74
|
+
* icon before title
|
|
116
75
|
*/
|
|
117
|
-
|
|
76
|
+
icon?: string;
|
|
118
77
|
/**
|
|
119
|
-
*
|
|
78
|
+
* title color
|
|
120
79
|
*/
|
|
121
|
-
|
|
80
|
+
color?: string;
|
|
122
81
|
/**
|
|
123
|
-
*
|
|
124
|
-
* @description 文章所使用的协议,默认使用 Creative Commons
|
|
125
|
-
* @default https://creativecommons.org/licenses/
|
|
82
|
+
* display comment
|
|
126
83
|
*/
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
84
|
+
comment?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* post is end
|
|
87
|
+
* @description 是否完结,将在末尾添加衬线字体 Q.E.D.
|
|
88
|
+
*/
|
|
89
|
+
end?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* use aplayer
|
|
92
|
+
*/
|
|
93
|
+
aplayer?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* use katex
|
|
96
|
+
*/
|
|
97
|
+
katex?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* use codepen
|
|
100
|
+
*/
|
|
101
|
+
codepen?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* 置顶
|
|
104
|
+
*/
|
|
105
|
+
top?: number;
|
|
106
|
+
/**
|
|
107
|
+
* display toc
|
|
108
|
+
* @description 是否显示目录
|
|
109
|
+
*/
|
|
110
|
+
toc?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* is draft
|
|
113
|
+
* @description 是否为草稿
|
|
114
|
+
*/
|
|
115
|
+
draft?: boolean;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Theme Config
|
|
120
|
+
*/
|
|
121
|
+
interface ThemeConfig {
|
|
122
|
+
safelist: string[];
|
|
123
|
+
colors: {
|
|
141
124
|
/**
|
|
142
|
-
*
|
|
143
|
-
* @
|
|
144
|
-
* @default 'by-nc-sa'
|
|
125
|
+
* primary color
|
|
126
|
+
* @default '#0078E7'
|
|
145
127
|
*/
|
|
146
|
-
|
|
128
|
+
primary: string;
|
|
147
129
|
};
|
|
148
130
|
/**
|
|
149
|
-
*
|
|
150
|
-
* @description 打赏/赞助
|
|
131
|
+
* 首页标语
|
|
151
132
|
*/
|
|
152
|
-
|
|
133
|
+
banner: {
|
|
153
134
|
enable: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* 标题
|
|
137
|
+
*/
|
|
154
138
|
title: string;
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
139
|
+
};
|
|
140
|
+
bg_image: {
|
|
141
|
+
enable: boolean;
|
|
142
|
+
url: string;
|
|
143
|
+
dark?: string;
|
|
144
|
+
opacity: number;
|
|
161
145
|
};
|
|
162
146
|
/**
|
|
163
|
-
*
|
|
164
|
-
|
|
165
|
-
markdown: ViteMdOptions;
|
|
166
|
-
markdownIt: MarkdownOptions;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
interface ResolvedValaxyOptions {
|
|
170
|
-
/**
|
|
171
|
-
* Client root path
|
|
172
|
-
* @default 'valaxy/src/client'
|
|
147
|
+
* say something
|
|
148
|
+
* https://say.elpsy.cn
|
|
173
149
|
*/
|
|
174
|
-
|
|
150
|
+
say: {
|
|
151
|
+
enable: boolean;
|
|
152
|
+
api: string;
|
|
153
|
+
hitokoto: {
|
|
154
|
+
enable: boolean;
|
|
155
|
+
api: string;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
pages: {
|
|
159
|
+
name: string;
|
|
160
|
+
url: string;
|
|
161
|
+
icon: string;
|
|
162
|
+
color: string;
|
|
163
|
+
}[];
|
|
175
164
|
/**
|
|
176
|
-
*
|
|
177
|
-
* @default process.cwd()
|
|
165
|
+
* footer
|
|
178
166
|
*/
|
|
179
|
-
|
|
167
|
+
footer: {
|
|
168
|
+
/**
|
|
169
|
+
* 建站于
|
|
170
|
+
*/
|
|
171
|
+
since: number;
|
|
172
|
+
/**
|
|
173
|
+
* Icon between year and copyright info.
|
|
174
|
+
*/
|
|
175
|
+
icon: {
|
|
176
|
+
/**
|
|
177
|
+
* icon name, i-xxx
|
|
178
|
+
*/
|
|
179
|
+
name: string;
|
|
180
|
+
animated: boolean;
|
|
181
|
+
color: string;
|
|
182
|
+
url: string;
|
|
183
|
+
title: string;
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Powered by valaxy & valaxy-theme-${name}, default is yun
|
|
187
|
+
*/
|
|
188
|
+
powered: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Chinese Users | 中国用户
|
|
191
|
+
* 备案 ICP
|
|
192
|
+
* 国内用户需要在网站页脚展示备案 ICP 号
|
|
193
|
+
* https://beian.miit.gov.cn/
|
|
194
|
+
*/
|
|
195
|
+
beian: {
|
|
196
|
+
enable: boolean;
|
|
197
|
+
/**
|
|
198
|
+
* 苏ICP备xxxxxxxx号
|
|
199
|
+
*/
|
|
200
|
+
icp: string;
|
|
201
|
+
};
|
|
202
|
+
};
|
|
180
203
|
/**
|
|
181
|
-
*
|
|
204
|
+
* post card types
|
|
182
205
|
*/
|
|
183
|
-
|
|
206
|
+
types: Record<string, {
|
|
207
|
+
color: string;
|
|
208
|
+
icon: string;
|
|
209
|
+
}>;
|
|
184
210
|
/**
|
|
185
|
-
*
|
|
211
|
+
* 菜单栏
|
|
186
212
|
*/
|
|
187
|
-
|
|
213
|
+
menu: {
|
|
214
|
+
custom: {
|
|
215
|
+
title: string;
|
|
216
|
+
url: string;
|
|
217
|
+
icon: string;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
declare const valaxyConfigSymbol: InjectionKey<ComputedRef<ValaxyConfig<ThemeConfig>>>;
|
|
223
|
+
declare const valaxyConfigRef: vue.ShallowRef<ValaxyConfig<ValaxyThemeConfig>>;
|
|
224
|
+
declare function initConfig(): ComputedRef<ValaxyConfig<ValaxyThemeConfig>>;
|
|
225
|
+
declare function useConfig(): ComputedRef<ValaxyConfig<ThemeConfig>>;
|
|
226
|
+
/**
|
|
227
|
+
* getThemeConfig
|
|
228
|
+
* @returns
|
|
229
|
+
*/
|
|
230
|
+
declare function useThemeConfig(): ComputedRef<ThemeConfig>;
|
|
231
|
+
|
|
232
|
+
interface ParentCategory {
|
|
233
|
+
total: number;
|
|
234
|
+
children: Categories;
|
|
235
|
+
}
|
|
236
|
+
interface PostCategory {
|
|
237
|
+
total: number;
|
|
238
|
+
posts: Post[];
|
|
239
|
+
}
|
|
240
|
+
declare type Category = ParentCategory | PostCategory;
|
|
241
|
+
declare type Categories = Map<string, Category>;
|
|
242
|
+
/**
|
|
243
|
+
* get categories from posts
|
|
244
|
+
* @returns
|
|
245
|
+
*/
|
|
246
|
+
declare function useCategory(category?: string, posts?: Post[]): ParentCategory;
|
|
247
|
+
|
|
248
|
+
declare const usePostTitle: (post: Ref<Post>) => vue.ComputedRef<any>;
|
|
249
|
+
/**
|
|
250
|
+
* get post list
|
|
251
|
+
* todo: use vue provide/inject to global
|
|
252
|
+
* @param params
|
|
253
|
+
* @returns
|
|
254
|
+
*/
|
|
255
|
+
declare function usePostList(params?: {
|
|
256
|
+
type?: string;
|
|
257
|
+
}): vue.ComputedRef<Post[]>;
|
|
258
|
+
/**
|
|
259
|
+
* get all page
|
|
260
|
+
* @returns
|
|
261
|
+
*/
|
|
262
|
+
declare function usePageList(): vue.ComputedRef<any[]>;
|
|
263
|
+
/**
|
|
264
|
+
* get prev and next post
|
|
265
|
+
* @param path
|
|
266
|
+
* @returns
|
|
267
|
+
*/
|
|
268
|
+
declare function usePrevNext(path?: string): vue.ComputedRef<Post | null>[];
|
|
269
|
+
/**
|
|
270
|
+
* get type card property
|
|
271
|
+
* todo: test reactive
|
|
272
|
+
*/
|
|
273
|
+
declare function usePostProperty(type?: string): {
|
|
274
|
+
color: string;
|
|
275
|
+
icon: string;
|
|
276
|
+
styles: {};
|
|
277
|
+
} | {
|
|
278
|
+
color: string;
|
|
279
|
+
icon: string;
|
|
280
|
+
styles: vue.ComputedRef<StyleValue>;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
declare type Tags = Map<string, {
|
|
284
|
+
count: number;
|
|
285
|
+
}>;
|
|
286
|
+
/**
|
|
287
|
+
* get utils about tags
|
|
288
|
+
*/
|
|
289
|
+
declare function useTags(options?: {
|
|
188
290
|
/**
|
|
189
|
-
*
|
|
291
|
+
* Primary Color
|
|
190
292
|
*/
|
|
191
|
-
|
|
293
|
+
primary: string;
|
|
294
|
+
}): {
|
|
295
|
+
tags: Tags;
|
|
296
|
+
getTagStyle: (count: number) => {
|
|
297
|
+
'--yun-tag-color': string;
|
|
298
|
+
fontSize: string;
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
/**
|
|
302
|
+
* get tag map
|
|
303
|
+
* @returns
|
|
304
|
+
*/
|
|
305
|
+
declare function useTag(): Tags;
|
|
306
|
+
|
|
307
|
+
declare function useFrontmatter(): vue.ComputedRef<Post>;
|
|
308
|
+
/**
|
|
309
|
+
* get full url
|
|
310
|
+
*/
|
|
311
|
+
declare function useFullUrl(): vue.ComputedRef<string>;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* use katex css cdn
|
|
315
|
+
*/
|
|
316
|
+
declare function useKatex(): void;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* trigger show invisible element
|
|
320
|
+
* @param target
|
|
321
|
+
* @returns
|
|
322
|
+
*/
|
|
323
|
+
declare function useInvisibleElement(target: Ref<HTMLElement>): {
|
|
324
|
+
show: () => void;
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
declare const isDark: vue.WritableComputedRef<boolean>;
|
|
328
|
+
declare const toggleDark: (value?: boolean | undefined) => boolean;
|
|
329
|
+
|
|
330
|
+
declare function useLayout(layout: string): vue.ComputedRef<boolean>;
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* use MetingJS and Aplayer
|
|
334
|
+
* https://github.com/MoePlayer/APlayer
|
|
335
|
+
* https://github.com/metowolf/MetingJS
|
|
336
|
+
*/
|
|
337
|
+
declare function useAplayer(): void;
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* You can use href="#" to back to top
|
|
341
|
+
* @description 你可以使用它来编写自己的 backToTop
|
|
342
|
+
*/
|
|
343
|
+
declare function useBackToTop(options?: {
|
|
192
344
|
/**
|
|
193
|
-
*
|
|
345
|
+
* show backToTop button, when height > offset
|
|
194
346
|
*/
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
347
|
+
offset: number;
|
|
348
|
+
}): {
|
|
349
|
+
percentage: vue.Ref<number>;
|
|
350
|
+
show: vue.Ref<boolean>;
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
declare function useCodePen(): void;
|
|
354
|
+
|
|
355
|
+
declare function useActiveSidebarLinks(): void;
|
|
356
|
+
|
|
357
|
+
declare function useTwikoo(options?: {}): void;
|
|
358
|
+
|
|
359
|
+
declare function useWaline(options?: {}): void;
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* 生成介于 min 与 max 之间的随机数
|
|
363
|
+
* @returns
|
|
364
|
+
*/
|
|
365
|
+
declare function random(min: number, max: number): number;
|
|
366
|
+
/**
|
|
367
|
+
* wrap node
|
|
368
|
+
* @param className
|
|
369
|
+
*/
|
|
370
|
+
declare function wrap(el: HTMLElement, className: string): void;
|
|
371
|
+
/**
|
|
372
|
+
* 包裹表格,添加 class 以控制 table 样式
|
|
373
|
+
*/
|
|
374
|
+
declare const wrapTable: (container?: HTMLElement | Document) => void;
|
|
200
375
|
|
|
201
|
-
|
|
376
|
+
/**
|
|
377
|
+
* use dayjs format date
|
|
378
|
+
* @param date
|
|
379
|
+
* @param template
|
|
380
|
+
* @returns
|
|
381
|
+
*/
|
|
382
|
+
declare function formatDate(date: string | number | Date, template?: string): string;
|
|
383
|
+
/**
|
|
384
|
+
* sort posts by date
|
|
385
|
+
* @param posts
|
|
386
|
+
* @param desc
|
|
387
|
+
*/
|
|
388
|
+
declare function sortByDate(posts: Post[], desc?: boolean): Post[];
|
|
202
389
|
|
|
203
|
-
export {
|
|
390
|
+
export { Categories, Category, ParentCategory, Post, PostCategory, Tags, formatDate, initConfig, isDark, random, sortByDate, toggleDark, useActiveSidebarLinks, useAplayer, useBackToTop, useCategory, useCodePen, useConfig, useFrontmatter, useFullUrl, useInvisibleElement, useKatex, useLayout, usePageList, usePostList, usePostProperty, usePostTitle, usePrevNext, useTag, useTags, useThemeConfig, useTwikoo, useWaline, valaxyConfigRef, valaxyConfigSymbol, wrap, wrapTable };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5KQ3UFYIjs = require('./chunk-5KQ3UFYI.js');var _chunkWYCH73X6js = require('./chunk-WYCH73X6.js');_chunkWYCH73X6js.d.call(void 0, );exports.createServer = _chunk5KQ3UFYIjs.a;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkTSLYS2VYjs = require('./chunk-TSLYS2VY.js');_chunkTSLYS2VYjs.f.call(void 0, );_chunkTSLYS2VYjs.f.call(void 0, );_chunkTSLYS2VYjs.f.call(void 0, );var _config = require('@valaxyjs/config'); var _config2 = _interopRequireDefault(_config);var _vue = require('vue');function T(t){let e=JSON.parse(t);return import.meta.env.DEV?_vue.readonly.call(void 0, e):e}var q=Symbol("valaxy:config"),b= exports.valaxyConfigRef =_vue.shallowRef.call(void 0, T(_config2.default));import.meta.hot&&import.meta.hot.accept("/@valaxyjs/config",t=>{b.value=T(t.default)});function Pt(){return _vue.computed.call(void 0, ()=>b.value)}function y(){let t=_vue.inject.call(void 0, q);if(!t)throw new Error("[Valaxy] config not properly injected in qpp");return t}function P(){let t=y();return _vue.computed.call(void 0, ()=>t.value.themeConfig)}_chunkTSLYS2VYjs.f.call(void 0, );_chunkTSLYS2VYjs.f.call(void 0, );_chunkTSLYS2VYjs.f.call(void 0, );var _vuerouter = require('vue-router');var _vuei18n = require('vue-i18n');_chunkTSLYS2VYjs.f.call(void 0, );_chunkTSLYS2VYjs.f.call(void 0, );function jt(t,e){return Math.random()*(e-t)+t}function I(t,e){let o=document.createElement("div");o.className=e,t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),o.appendChild(t)}var Et=(t=document)=>{t.querySelectorAll("table").forEach(e=>{let o=document.createElement("div");o.className="table-container",I(e,"table-container")})};_chunkTSLYS2VYjs.f.call(void 0, );var _dayjs = require('dayjs'); var _dayjs2 = _interopRequireDefault(_dayjs);function kt(t,e="YYYY-MM-DD"){return _dayjs2.default.call(void 0, t).format(e)}function x(t,e=!0){return t.sort((o,s)=>{let i=+new Date(o.date||""),r=+new Date(s.date||"");return e?r-i:i-r})}var zt=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 g(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)),s=x(o.filter(r=>r.top)).sort((r,l)=>l.top-r.top),i=x(o.filter(r=>!r.top));return s.concat(i)})}function Nt(){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 Wt(t){let e=_vuerouter.useRoute.call(void 0, ),o=_vue.computed.call(void 0, ()=>t||e.path),s=g(),i=_vue.computed.call(void 0, ()=>{let a=-1;return s.value.find((c,p)=>c.path===o.value?(a=p,!0):!1),a}),r=_vue.computed.call(void 0, ()=>i.value-1>=0?s.value[i.value-1]:null),l=_vue.computed.call(void 0, ()=>i.value+1<s.value.length?s.value[i.value+1]:null);return[r,l]}function Bt(t){if(!t)return{color:"",icon:"",styles:{}};let e=P();t in e.value.types||(t="link");let o=e.value.types[t].color,s=e.value.types[t].icon,i=_vue.computed.call(void 0, ()=>({"--card-c-primary":t&&o}));return{color:o,icon:s,styles:i}}function Ft(t,e=[]){var i;e.length||(e=_vue.unref.call(void 0, g()));let o={total:e.length,children:new Map([["Uncategorized",{total:0,posts:[]}]])},s=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((c,p)=>{var f,h,d;if(p===l-1)if(a.children.has(c)){let u=a.children.get(c);u.posts&&(u.total+=1,u.posts.push(r))}else(f=a.children)==null||f.set(c,{total:1,posts:[r]});else if((h=a.children)!=null&&h.has(c)){let u=a.children.get(c);u.total+=1,a=u}else{let u={total:1,children:new Map};(d=a.children)==null||d.set(c,u),a=u}})}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 s.total+=1,s.posts.push(r)}),s.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}_chunkTSLYS2VYjs.f.call(void 0, );var _tinycolor = require('@ctrl/tinycolor');function Qt(t={primary:"#0078E7"}){let e=Y(),o=new (0, _tinycolor.TinyColor)("#999999"),s=new (0, _tinycolor.TinyColor)(t.primary);return{tags:e,getTagStyle:r=>{let l=Array.from(e).map(([h,d])=>d.count),a=Math.max(...l),c=Math.min(...l),p=a-c,f=(r-c)/p;return{"--yun-tag-color":o.mix(s,f*100).toString(),fontSize:`${f*36+12}px`}}}}function Y(){let t=g(),e=new Map;return t.value.forEach(o=>{if(o.tags){let s;typeof o.tags=="string"?s=[o.tags]:s=o.tags,s.forEach(i=>{if(e.has(i)){let r=e.get(i);e.set(i,_chunkTSLYS2VYjs.b.call(void 0, _chunkTSLYS2VYjs.a.call(void 0, {},r),{count:r.count+1}))}else e.set(i,{count:1})})}}),e}_chunkTSLYS2VYjs.f.call(void 0, );var _core = require('@vueuse/core');function re(){let t=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>t.meta.frontmatter)}function ne(){let t=y(),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)}_chunkTSLYS2VYjs.f.call(void 0, );_chunkTSLYS2VYjs.f.call(void 0, );var _head = require('@vueuse/head');function ae(){_head.useHead.call(void 0, {link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css"}]})}_chunkTSLYS2VYjs.f.call(void 0, );function fe(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)}}}_chunkTSLYS2VYjs.f.call(void 0, );var X=_core.useDark.call(void 0, ),ge= exports.toggleDark =_core.useToggle.call(void 0, X);_chunkTSLYS2VYjs.f.call(void 0, );function we(t){let e=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>e.meta.layout===t)}_chunkTSLYS2VYjs.f.call(void 0, );_chunkTSLYS2VYjs.f.call(void 0, );function Pe(){_head.useHead.call(void 0, {link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css"}]}),_core.useScriptTag.call(void 0, "https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js",()=>{_core.useScriptTag.call(void 0, "https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js")})}_chunkTSLYS2VYjs.f.call(void 0, );function Ae(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)),s=_vue.computed.call(void 0, ()=>e.value>t.offset);return{percentage:o,show:s}}_chunkTSLYS2VYjs.f.call(void 0, );function Se(){_head.useHead.call(void 0, {script:[{src:"https://static.codepen.io/assets/embed/ei.js",async:!0}]})}_chunkTSLYS2VYjs.f.call(void 0, );function qe(){let t=null,e=null,o=mt(s,200);function s(){let l=lt(),a=ct(l);for(let c=0;c<a.length;c++){let p=a[c],f=a[c+1],[h,d]=ut(c,p,f);if(h){history.replaceState(null,document.title,d||" "),i(d);return}}}function i(l){if(r(e),r(t),e=document.querySelector(`.va-toc a[href="${l}"]`),!e)return;e.classList.add("active");let a=e.closest(".right-sidebar-container > ul > li");a&&a!==e.parentElement?(t=a.querySelector("a"),t&&t.classList.add("active")):t=null}function r(l){l&&l.classList.remove("active")}_vue.onMounted.call(void 0, ()=>{s(),window.addEventListener("scroll",o)}),_vue.onUpdated.call(void 0, ()=>{i(decodeURIComponent(location.hash))}),_vue.onUnmounted.call(void 0, ()=>{window.removeEventListener("scroll",o)})}function lt(){return[].slice.call(document.querySelectorAll(".va-toc a.toc-link-item"))}function ct(t){return[].slice.call(document.querySelectorAll(".header-anchor")).filter(e=>t.some(o=>o.hash===e.hash))}function H(t){return t.parentElement.offsetTop-50}function ut(t,e,o){let s=window.scrollY;return t===0&&s===0?[!0,null]:s<H(e)?[!1,null]:!o||s<H(o)?[!0,decodeURIComponent(e.hash)]:[!1,null]}function mt(t,e){let o,s=!1;return()=>{o&&clearTimeout(o),s?o=setTimeout(t,e):(t(),s=!0,setTimeout(()=>{s=!1},e))}}_chunkTSLYS2VYjs.f.call(void 0, );_chunkTSLYS2VYjs.f.call(void 0, );function Be(t={}){let e=_vuerouter.useRoute.call(void 0, ),{locale:o}=_vuei18n.useI18n.call(void 0, ),s;function i(r={}){if(!_core.isClient)return;let l={el:".comment #tcomment",lang:o.value,path:e.path},a=Object.assign(l,r);return window.twikoo.init(a)}_core.useScriptTag.call(void 0, "//cdn.jsdelivr.net/npm/twikoo@1.5.1/dist/twikoo.all.min.js",()=>{s=i(t)}),console.log(s)}_chunkTSLYS2VYjs.f.call(void 0, );function Je(t={}){let e=_vuerouter.useRoute.call(void 0, ),{locale:o}=_vuei18n.useI18n.call(void 0, ),s;function i(r={}){if(!_core.isClient)return;let l={el:".comment #waline",lang:o.value,dark:"html.dark",emoji:["https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/bilibili","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/qq","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/weibo"],path:e.path},a=Object.assign(l,r);return window.Waline(a)}_core.useScriptTag.call(void 0, "//cdn.jsdelivr.net/npm/@waline/client",()=>{s=i(t)}),_vue.watch.call(void 0, ()=>e.path,r=>{!s||s.update({path:r})}),_vue.watch.call(void 0, o,r=>{!s||s.update({lang:r})}),_vue.onUnmounted.call(void 0, ()=>{!s||s.destroy()})}exports.defaultValaxyConfig = _chunkTSLYS2VYjs.g; exports.formatDate = kt; exports.initConfig = Pt; exports.isDark = X; exports.random = jt; exports.sortByDate = x; exports.toggleDark = ge; exports.useActiveSidebarLinks = qe; exports.useAplayer = Pe; exports.useBackToTop = Ae; exports.useCategory = Ft; exports.useCodePen = Se; exports.useConfig = y; exports.useFrontmatter = re; exports.useFullUrl = ne; exports.useInvisibleElement = fe; exports.useKatex = ae; exports.useLayout = we; exports.usePageList = Nt; exports.usePostList = g; exports.usePostProperty = Bt; exports.usePostTitle = zt; exports.usePrevNext = Wt; exports.useTag = Y; exports.useTags = Qt; exports.useThemeConfig = P; exports.useTwikoo = Be; exports.useWaline = Je; exports.valaxyConfigRef = b; exports.valaxyConfigSymbol = q; exports.wrap = I; exports.wrapTable = Et;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as v,b as w,f as n,g as Ct}from"./chunk-U4ZDCBEC.mjs";n();n();n();import D from"@valaxyjs/config";import{computed as C,inject as U,readonly as O,shallowRef as V}from"vue";function T(t){let e=JSON.parse(t);return import.meta.env.DEV?O(e):e}var q=Symbol("valaxy:config"),b=V(T(D));import.meta.hot&&import.meta.hot.accept("/@valaxyjs/config",t=>{b.value=T(t.default)});function Pt(){return C(()=>b.value)}function y(){let t=U(q);if(!t)throw new Error("[Valaxy] config not properly injected in qpp");return t}function P(){let t=y();return C(()=>t.value.themeConfig)}n();n();import{unref as B}from"vue";n();import{computed as m}from"vue";import{useRoute as N,useRouter as L}from"vue-router";import{useI18n as W}from"vue-i18n";n();n();function jt(t,e){return Math.random()*(e-t)+t}function I(t,e){let o=document.createElement("div");o.className=e,t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),o.appendChild(t)}var Et=(t=document)=>{t.querySelectorAll("table").forEach(e=>{let o=document.createElement("div");o.className="table-container",I(e,"table-container")})};n();import z from"dayjs";function kt(t,e="YYYY-MM-DD"){return z(t).format(e)}function x(t,e=!0){return t.sort((o,s)=>{let i=+new Date(o.date||""),r=+new Date(s.date||"");return e?r-i:i-r})}var zt=t=>{let{locale:e}=W();return m(()=>{let o=e.value==="zh-CN"?"zh":e.value;return t.value[`title_${o}`]||t.value.title})};function g(t={}){let e=L();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)),s=x(o.filter(r=>r.top)).sort((r,l)=>l.top-r.top),i=x(o.filter(r=>!r.top));return s.concat(i)})}function Nt(){let t=L();return m(()=>t.getRoutes().map(o=>Object.assign({path:o.path,excerpt:o.meta.excerpt},o.meta.frontmatter)))}function Wt(t){let e=N(),o=m(()=>t||e.path),s=g(),i=m(()=>{let a=-1;return s.value.find((c,p)=>c.path===o.value?(a=p,!0):!1),a}),r=m(()=>i.value-1>=0?s.value[i.value-1]:null),l=m(()=>i.value+1<s.value.length?s.value[i.value+1]:null);return[r,l]}function Bt(t){if(!t)return{color:"",icon:"",styles:{}};let e=P();t in e.value.types||(t="link");let o=e.value.types[t].color,s=e.value.types[t].icon,i=m(()=>({"--card-c-primary":t&&o}));return{color:o,icon:s,styles:i}}function Ft(t,e=[]){var i;e.length||(e=B(g()));let o={total:e.length,children:new Map([["Uncategorized",{total:0,posts:[]}]])},s=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((c,p)=>{var f,h,d;if(p===l-1)if(a.children.has(c)){let u=a.children.get(c);u.posts&&(u.total+=1,u.posts.push(r))}else(f=a.children)==null||f.set(c,{total:1,posts:[r]});else if((h=a.children)!=null&&h.has(c)){let u=a.children.get(c);u.total+=1,a=u}else{let u={total:1,children:new Map};(d=a.children)==null||d.set(c,u),a=u}})}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 s.total+=1,s.posts.push(r)}),s.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}n();import{TinyColor as j}from"@ctrl/tinycolor";function Qt(t={primary:"#0078E7"}){let e=Y(),o=new j("#999999"),s=new j(t.primary);return{tags:e,getTagStyle:r=>{let l=Array.from(e).map(([h,d])=>d.count),a=Math.max(...l),c=Math.min(...l),p=a-c,f=(r-c)/p;return{"--yun-tag-color":o.mix(s,f*100).toString(),fontSize:`${f*36+12}px`}}}}function Y(){let t=g(),e=new Map;return t.value.forEach(o=>{if(o.tags){let s;typeof o.tags=="string"?s=[o.tags]:s=o.tags,s.forEach(i=>{if(e.has(i)){let r=e.get(i);e.set(i,w(v({},r),{count:r.count+1}))}else e.set(i,{count:1})})}}),e}n();import{useRoute as E}from"vue-router";import{computed as A}from"vue";import{isClient as $}from"@vueuse/core";function re(){let t=E();return A(()=>t.meta.frontmatter)}function ne(){let t=y(),e=E();return A(()=>((t.value.url.endsWith("/")?t.value.url.slice(0,-1):t.value.url)||$&&window.location.origin)+e.path)}n();n();import{useHead as K}from"@vueuse/head";function ae(){K({link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css"}]})}n();import{useElementBounding as F,useIntersectionObserver as _}from"@vueuse/core";import{ref as J}from"vue";function fe(t){let e=J(!1),{top:o}=F(t);return _(t,([{isIntersecting:i}])=>{e.value=i}),{show:()=>{e.value||window.scrollTo(0,o.value)}}}n();import{useDark as G,useToggle as Q}from"@vueuse/core";var X=G(),ge=Q(X);n();import{computed as Z}from"vue";import{useRoute as tt}from"vue-router";function we(t){let e=tt();return Z(()=>e.meta.layout===t)}n();n();import{useScriptTag as M}from"@vueuse/core";import{useHead as et}from"@vueuse/head";function Pe(){et({link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css"}]}),M("https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js",()=>{M("https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js")})}n();import{isClient as ot,useWindowScroll as rt}from"@vueuse/core";import{computed as k,ref as S}from"vue";function Ae(t={offset:100}){if(!ot)return{percentage:S(0),show:S(!1)};let{y:e}=rt(),o=k(()=>e.value/(document.body.scrollHeight-window.innerHeight)),s=k(()=>e.value>t.offset);return{percentage:o,show:s}}n();import{useHead as nt}from"@vueuse/head";function Se(){nt({script:[{src:"https://static.codepen.io/assets/embed/ei.js",async:!0}]})}n();import{onMounted as st,onUnmounted as it,onUpdated as at}from"vue";function qe(){let t=null,e=null,o=mt(s,200);function s(){let l=lt(),a=ct(l);for(let c=0;c<a.length;c++){let p=a[c],f=a[c+1],[h,d]=ut(c,p,f);if(h){history.replaceState(null,document.title,d||" "),i(d);return}}}function i(l){if(r(e),r(t),e=document.querySelector(`.va-toc a[href="${l}"]`),!e)return;e.classList.add("active");let a=e.closest(".right-sidebar-container > ul > li");a&&a!==e.parentElement?(t=a.querySelector("a"),t&&t.classList.add("active")):t=null}function r(l){l&&l.classList.remove("active")}st(()=>{s(),window.addEventListener("scroll",o)}),at(()=>{i(decodeURIComponent(location.hash))}),it(()=>{window.removeEventListener("scroll",o)})}function lt(){return[].slice.call(document.querySelectorAll(".va-toc a.toc-link-item"))}function ct(t){return[].slice.call(document.querySelectorAll(".header-anchor")).filter(e=>t.some(o=>o.hash===e.hash))}function H(t){return t.parentElement.offsetTop-50}function ut(t,e,o){let s=window.scrollY;return t===0&&s===0?[!0,null]:s<H(e)?[!1,null]:!o||s<H(o)?[!0,decodeURIComponent(e.hash)]:[!1,null]}function mt(t,e){let o,s=!1;return()=>{o&&clearTimeout(o),s?o=setTimeout(t,e):(t(),s=!0,setTimeout(()=>{s=!1},e))}}n();n();import{isClient as pt,useScriptTag as ft}from"@vueuse/core";import{useI18n as dt}from"vue-i18n";import{useRoute as ht}from"vue-router";function Be(t={}){let e=ht(),{locale:o}=dt(),s;function i(r={}){if(!pt)return;let l={el:".comment #tcomment",lang:o.value,path:e.path},a=Object.assign(l,r);return window.twikoo.init(a)}ft("//cdn.jsdelivr.net/npm/twikoo@1.5.1/dist/twikoo.all.min.js",()=>{s=i(t)}),console.log(s)}n();import{isClient as gt,useScriptTag as yt}from"@vueuse/core";import{onUnmounted as xt,watch as R}from"vue";import{useI18n as vt}from"vue-i18n";import{useRoute as wt}from"vue-router";function Je(t={}){let e=wt(),{locale:o}=vt(),s;function i(r={}){if(!gt)return;let l={el:".comment #waline",lang:o.value,dark:"html.dark",emoji:["https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/bilibili","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/qq","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/weibo"],path:e.path},a=Object.assign(l,r);return window.Waline(a)}yt("//cdn.jsdelivr.net/npm/@waline/client",()=>{s=i(t)}),R(()=>e.path,r=>{!s||s.update({path:r})}),R(o,r=>{!s||s.update({lang:r})}),xt(()=>{!s||s.destroy()})}export{Ct as defaultValaxyConfig,kt as formatDate,Pt as initConfig,X as isDark,jt as random,x as sortByDate,ge as toggleDark,qe as useActiveSidebarLinks,Pe as useAplayer,Ae as useBackToTop,Ft as useCategory,Se as useCodePen,y as useConfig,re as useFrontmatter,ne as useFullUrl,fe as useInvisibleElement,ae as useKatex,we as useLayout,Nt as usePageList,g as usePostList,Bt as usePostProperty,zt as usePostTitle,Wt as usePrevNext,Y as useTag,Qt as useTags,P as useThemeConfig,Be as useTwikoo,Je as useWaline,b as valaxyConfigRef,q as valaxyConfigSymbol,I as wrap,Et as wrapTable};
|
|
File without changes
|