valaxy 0.2.4 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/chunk-3ZSQT2FN.mjs +88 -0
  2. package/dist/{chunk-JARRR63D.mjs → chunk-IJLE4GPY.mjs} +1 -1
  3. package/dist/{chunk-RUZ4KMBM.js → chunk-PFDRHZPF.js} +1 -1
  4. package/dist/chunk-QG3CCWZM.js +88 -0
  5. package/dist/config-408070e9.d.ts +195 -0
  6. package/dist/index.d.ts +404 -0
  7. package/dist/index.js +1 -1
  8. package/dist/index.mjs +1 -1
  9. package/dist/node/cli.d.ts +3 -0
  10. package/dist/node/cli.js +8 -8
  11. package/dist/node/cli.mjs +8 -8
  12. package/dist/node/index.d.ts +46 -0
  13. package/dist/node/index.js +1 -1
  14. package/dist/node/index.mjs +1 -1
  15. package/package.json +28 -29
  16. package/src/client/components/AppLink.vue +1 -1
  17. package/src/client/components/PostCard.vue +2 -2
  18. package/src/client/components/ValaxyCopyright.vue +2 -2
  19. package/src/client/components/ValaxyFooter.vue +1 -2
  20. package/src/client/components/ValaxyMd.vue +1 -1
  21. package/src/client/components/ValaxyOverlay.vue +1 -1
  22. package/src/client/components/ValaxyPagination.vue +2 -2
  23. package/src/client/components/ValaxyRightSidebar.vue +44 -3
  24. package/src/client/components/ValaxySidebar.vue +1 -1
  25. package/src/client/components/ValaxyToc.vue +30 -8
  26. package/src/client/composables/category.ts +7 -3
  27. package/src/client/composables/comments/twikoo.ts +1 -4
  28. package/src/client/composables/comments/waline.ts +11 -2
  29. package/src/client/composables/sidebar.ts +29 -44
  30. package/src/client/locales/zh-CN.yml +1 -1
  31. package/src/client/modules/pwa.ts +1 -1
  32. package/src/client/pages/[...all].vue +0 -0
  33. package/src/client/stores/app.ts +5 -0
  34. package/src/client/styles/common/sidebar.scss +3 -1
  35. package/src/client/styles/global/i18n.scss +29 -1
  36. package/src/client/styles/global/reset.scss +1 -1
  37. package/src/node/cli.ts +3 -3
  38. package/src/node/config.ts +9 -0
  39. package/src/node/markdown/headings.ts +7 -1
  40. package/src/node/markdown/index.ts +6 -1
  41. package/src/node/markdown/markdown-it-katex.ts +4 -4
  42. package/src/node/plugins/markdown.ts +1 -0
  43. package/src/node/plugins/preset.ts +1 -1
  44. package/src/node/plugins/unocss.ts +8 -7
  45. package/src/node/utils/cli.ts +1 -1
  46. package/src/node/vite.ts +2 -0
  47. package/src/types/config.ts +15 -3
  48. package/src/types/posts.ts +5 -0
  49. package/dist/chunk-HSIBOGUA.mjs +0 -88
  50. package/dist/chunk-XMNH5QY2.js +0 -88
  51. package/src/client/public/_headers +0 -3
  52. package/src/client/public/favicon.svg +0 -21
  53. package/src/client/public/pwa-192x192.png +0 -0
  54. package/src/client/public/pwa-512x512.png +0 -0
  55. package/src/client/public/safari-pinned-tab.svg +0 -41
@@ -0,0 +1,195 @@
1
+ import { PartialDeep } from 'type-fest';
2
+ import { VitePluginConfig } from 'unocss/vite';
3
+ import MarkdownIt from 'markdown-it';
4
+ import Anchor from 'markdown-it-anchor';
5
+ import { KatexOptions } from 'katex';
6
+ import Markdown from 'vite-plugin-md';
7
+
8
+ interface MarkdownOptions extends MarkdownIt.Options {
9
+ config?: (md: MarkdownIt) => void;
10
+ anchor?: {
11
+ permalink?: Anchor.AnchorOptions['permalink'];
12
+ };
13
+ toc?: any;
14
+ katex?: KatexOptions;
15
+ }
16
+
17
+ declare type ViteMdOptions = Parameters<typeof Markdown>[0];
18
+
19
+ declare type ValaxyThemeConfig = Record<string, any>;
20
+ interface SocialLink {
21
+ /**
22
+ * The title of your link
23
+ */
24
+ name: string;
25
+ link: string;
26
+ /**
27
+ * 图标名称
28
+ * https://icones.js.org/
29
+ */
30
+ icon: string;
31
+ color: string;
32
+ }
33
+ interface ValaxyConfig<T = ValaxyThemeConfig> {
34
+ /**
35
+ * Default language
36
+ * @description 默认语言
37
+ * @default 'en'
38
+ */
39
+ lang: string;
40
+ /**
41
+ * You site url in web, required for ssg & rss
42
+ * @description 站点的 URL,SSG & RSS 需要(譬如生成版权处文章永久链接)
43
+ */
44
+ url: string;
45
+ /**
46
+ * Site title
47
+ * @description 站点标题
48
+ */
49
+ title: string;
50
+ /**
51
+ * 副标题
52
+ */
53
+ subtitle: string;
54
+ /**
55
+ * 站点描述
56
+ */
57
+ description: string;
58
+ /**
59
+ * The owner of this blog
60
+ * @description 博客作者
61
+ */
62
+ author: {
63
+ /**
64
+ * Your name
65
+ * @description 你的名字
66
+ */
67
+ name: string;
68
+ email: string;
69
+ link: string;
70
+ avatar: string;
71
+ /**
72
+ * The status of you
73
+ * @description 状态
74
+ */
75
+ status: {
76
+ emoji: string;
77
+ /**
78
+ * show when hover emoji
79
+ * @description 当鼠标悬浮在图标上时显示
80
+ */
81
+ message: string;
82
+ };
83
+ };
84
+ feed: {
85
+ /**
86
+ * name: feed -> feed.xml / feed.atom / feed.json
87
+ * @default '' -> feed.xml / atom.xml / feed.json
88
+ */
89
+ name: string;
90
+ favicon: string;
91
+ };
92
+ /**
93
+ * 社交链接
94
+ */
95
+ social: SocialLink[];
96
+ /**
97
+ * search
98
+ */
99
+ search: {
100
+ algolia: {
101
+ enable: boolean;
102
+ appId: string;
103
+ apiKey: string;
104
+ indexName: string;
105
+ chunkSize: number;
106
+ };
107
+ };
108
+ /**
109
+ * comment: waline/...
110
+ */
111
+ comment: {
112
+ waline: {
113
+ enable: boolean;
114
+ serverURL: string;
115
+ };
116
+ twikoo: {
117
+ enable: boolean;
118
+ envId: string;
119
+ };
120
+ };
121
+ /**
122
+ * The name of theme
123
+ * @description 主题名称
124
+ */
125
+ theme: string;
126
+ /**
127
+ * The config of theme
128
+ * @description 主题配置
129
+ */
130
+ themeConfig: T & {
131
+ pkg: {
132
+ name: string;
133
+ version: string;
134
+ homepage?: string;
135
+ [key: string]: any;
136
+ };
137
+ };
138
+ /**
139
+ * Unocss Config
140
+ */
141
+ unocss: VitePluginConfig;
142
+ /**
143
+ * The license of your posts
144
+ * @description 文章所使用的协议,默认使用 Creative Commons
145
+ * @default https://creativecommons.org/licenses/
146
+ */
147
+ license: {
148
+ /**
149
+ * Whether to show at the bottom of the article
150
+ * @description 是否显示在文章底部
151
+ * @default true
152
+ */
153
+ enabled: boolean;
154
+ /**
155
+ * Creative License Language, same with your config.lang
156
+ * when lang === 'zh-CN', use 'zh'
157
+ * @description 默认与站点语言相同
158
+ * @default 'en'
159
+ */
160
+ language: string;
161
+ /**
162
+ * Type of license
163
+ * @description 证书类型
164
+ * @default 'by-nc-sa'
165
+ */
166
+ type: 'zero' | 'by-sa' | 'by-nd' | 'by-nc' | 'by-nc-sa' | 'by-nc-nd';
167
+ };
168
+ /**
169
+ * donate for author
170
+ * @description 打赏/赞助
171
+ */
172
+ sponsor: {
173
+ enable: boolean;
174
+ title: string;
175
+ methods: {
176
+ name: string;
177
+ url: string;
178
+ color: string;
179
+ icon: string;
180
+ }[];
181
+ };
182
+ /**
183
+ * for markdown
184
+ */
185
+ markdown: ViteMdOptions;
186
+ markdownIt: MarkdownOptions;
187
+ }
188
+ /**
189
+ * Valaxy User Config
190
+ * @description Valaxy 用户配置
191
+ */
192
+ declare type UserConfig<T = ValaxyThemeConfig> = PartialDeep<ValaxyConfig<T>>;
193
+ declare const defaultValaxyConfig: ValaxyConfig;
194
+
195
+ export { SocialLink as S, UserConfig as U, ValaxyConfig as V, ValaxyThemeConfig as a, defaultValaxyConfig as d };
@@ -0,0 +1,404 @@
1
+ import * as vue from 'vue';
2
+ import { InjectionKey, ComputedRef, Ref, StyleValue } from 'vue';
3
+ import { V as ValaxyConfig, a as ValaxyThemeConfig } from './config-408070e9.js';
4
+ export { S as SocialLink, U as UserConfig, V as ValaxyConfig, a as ValaxyThemeConfig, d as defaultValaxyConfig } from './config-408070e9.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';
11
+
12
+ interface Post extends Record<string, any> {
13
+ /**
14
+ * Path of post
15
+ * route.path
16
+ * @description 路径
17
+ */
18
+ path?: string;
19
+ /**
20
+ * Title
21
+ * @description 文章标题
22
+ */
23
+ title?: string;
24
+ date?: string | number | Date;
25
+ /**
26
+ * Updated Time
27
+ */
28
+ updated?: string | number | Date;
29
+ lang?: string;
30
+ /**
31
+ * TODO
32
+ * Read Time
33
+ * @description 阅读时长
34
+ */
35
+ duration?: string;
36
+ /**
37
+ * post card type, can be bilibili/yuque/...
38
+ */
39
+ type?: string;
40
+ /**
41
+ * override url, and jump directly
42
+ */
43
+ url?: string;
44
+ /**
45
+ * @description 摘要
46
+ */
47
+ excerpt?: string;
48
+ /**
49
+ * Display sponsor info
50
+ * @description 是否开启赞助
51
+ */
52
+ sponsor?: boolean;
53
+ /**
54
+ * Copyright
55
+ * @description 是否显示文章底部版权信息
56
+ */
57
+ copyright?: boolean;
58
+ /**
59
+ * Category
60
+ * @description 分类,若为数组,则按顺序代表多层文件夹
61
+ */
62
+ categories?: string | string[];
63
+ /**
64
+ * Tags
65
+ * @description 标签,可以有多个
66
+ */
67
+ tags?: string[];
68
+ /**
69
+ * display prev next
70
+ * @description 是否显示前一篇、后一篇导航
71
+ */
72
+ nav?: boolean;
73
+ /**
74
+ * icon before title
75
+ */
76
+ icon?: string;
77
+ /**
78
+ * title color
79
+ */
80
+ color?: string;
81
+ /**
82
+ * display comment
83
+ */
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
+ * enable markdown-body class
118
+ * @description 是否启用默认的 markdown 样式
119
+ */
120
+ markdown: boolean;
121
+ }
122
+
123
+ /**
124
+ * Theme Config
125
+ */
126
+ interface ThemeConfig {
127
+ safelist: string[];
128
+ colors: {
129
+ /**
130
+ * primary color
131
+ * @default '#0078E7'
132
+ */
133
+ primary: string;
134
+ };
135
+ /**
136
+ * 首页标语
137
+ */
138
+ banner: {
139
+ enable: boolean;
140
+ /**
141
+ * 标题
142
+ */
143
+ title: string;
144
+ };
145
+ bg_image: {
146
+ enable: boolean;
147
+ url: string;
148
+ dark?: string;
149
+ opacity: number;
150
+ };
151
+ /**
152
+ * say something
153
+ * https://say.elpsy.cn
154
+ */
155
+ say: {
156
+ enable: boolean;
157
+ api: string;
158
+ hitokoto: {
159
+ enable: boolean;
160
+ api: string;
161
+ };
162
+ };
163
+ pages: {
164
+ name: string;
165
+ url: string;
166
+ icon: string;
167
+ color: string;
168
+ }[];
169
+ /**
170
+ * footer
171
+ */
172
+ footer: {
173
+ /**
174
+ * 建站于
175
+ */
176
+ since: number;
177
+ /**
178
+ * Icon between year and copyright info.
179
+ */
180
+ icon: {
181
+ /**
182
+ * icon name, i-xxx
183
+ */
184
+ name: string;
185
+ animated: boolean;
186
+ color: string;
187
+ url: string;
188
+ title: string;
189
+ };
190
+ /**
191
+ * Powered by valaxy & valaxy-theme-${name}, default is yun
192
+ */
193
+ powered: boolean;
194
+ /**
195
+ * Chinese Users | 中国用户
196
+ * 备案 ICP
197
+ * 国内用户需要在网站页脚展示备案 ICP 号
198
+ * https://beian.miit.gov.cn/
199
+ */
200
+ beian: {
201
+ enable: boolean;
202
+ /**
203
+ * 苏ICP备xxxxxxxx号
204
+ */
205
+ icp: string;
206
+ };
207
+ };
208
+ /**
209
+ * post card types
210
+ */
211
+ types: Record<string, {
212
+ color: string;
213
+ icon: string;
214
+ }>;
215
+ /**
216
+ * 菜单栏
217
+ */
218
+ menu: {
219
+ custom: {
220
+ title: string;
221
+ url: string;
222
+ icon: string;
223
+ };
224
+ };
225
+ }
226
+
227
+ declare const valaxyConfigSymbol: InjectionKey<ComputedRef<ValaxyConfig<ThemeConfig>>>;
228
+ declare const valaxyConfigRef: vue.ShallowRef<ValaxyConfig<ValaxyThemeConfig>>;
229
+ declare function initConfig(): ComputedRef<ValaxyConfig<ValaxyThemeConfig>>;
230
+ declare function useConfig(): ComputedRef<ValaxyConfig<ThemeConfig>>;
231
+ /**
232
+ * getThemeConfig
233
+ * @returns
234
+ */
235
+ declare function useThemeConfig(): ComputedRef<ThemeConfig & {
236
+ pkg: {
237
+ [key: string]: any;
238
+ name: string;
239
+ version: string;
240
+ homepage?: string | undefined;
241
+ };
242
+ }>;
243
+
244
+ interface BaseCategory {
245
+ total: number;
246
+ }
247
+ interface ParentCategory extends BaseCategory {
248
+ children: Categories;
249
+ }
250
+ interface PostCategory extends BaseCategory {
251
+ posts: Post[];
252
+ }
253
+ declare type Category = ParentCategory | PostCategory;
254
+ declare type Categories = Map<string, Category>;
255
+ declare const isParentCategory: (category: any) => category is ParentCategory;
256
+ /**
257
+ * get categories from posts
258
+ * @returns
259
+ */
260
+ declare function useCategory(category?: string, posts?: Post[]): ParentCategory;
261
+
262
+ declare const usePostTitle: (post: Ref<Post>) => vue.ComputedRef<any>;
263
+ /**
264
+ * get post list
265
+ * todo: use vue provide/inject to global
266
+ * @param params
267
+ * @returns
268
+ */
269
+ declare function usePostList(params?: {
270
+ type?: string;
271
+ }): vue.ComputedRef<Post[]>;
272
+ /**
273
+ * get all page
274
+ * @returns
275
+ */
276
+ declare function usePageList(): vue.ComputedRef<any[]>;
277
+ /**
278
+ * get prev and next post
279
+ * @param path
280
+ * @returns
281
+ */
282
+ declare function usePrevNext(path?: string): vue.ComputedRef<Post | null>[];
283
+ /**
284
+ * get type card property
285
+ * todo: test reactive
286
+ */
287
+ declare function usePostProperty(type?: string): {
288
+ color: string;
289
+ icon: string;
290
+ styles: {};
291
+ } | {
292
+ color: string;
293
+ icon: string;
294
+ styles: vue.ComputedRef<StyleValue>;
295
+ };
296
+
297
+ declare type Tags = Map<string, {
298
+ count: number;
299
+ }>;
300
+ /**
301
+ * get utils about tags
302
+ */
303
+ declare function useTags(options?: {
304
+ /**
305
+ * Primary Color
306
+ */
307
+ primary: string;
308
+ }): {
309
+ tags: Tags;
310
+ getTagStyle: (count: number) => {
311
+ '--yun-tag-color': string;
312
+ fontSize: string;
313
+ };
314
+ };
315
+ /**
316
+ * get tag map
317
+ * @returns
318
+ */
319
+ declare function useTag(): Tags;
320
+
321
+ declare function useFrontmatter(): vue.ComputedRef<Post>;
322
+ /**
323
+ * get full url
324
+ */
325
+ declare function useFullUrl(): vue.ComputedRef<string>;
326
+
327
+ /**
328
+ * use katex css cdn
329
+ */
330
+ declare function useKatex(): void;
331
+
332
+ /**
333
+ * trigger show invisible element
334
+ * @param target
335
+ * @returns
336
+ */
337
+ declare function useInvisibleElement(target: Ref<HTMLElement>): {
338
+ show: () => void;
339
+ };
340
+
341
+ declare const isDark: vue.WritableComputedRef<boolean>;
342
+ declare const toggleDark: (value?: boolean | undefined) => boolean;
343
+
344
+ declare function useLayout(layout: string): vue.ComputedRef<boolean>;
345
+
346
+ /**
347
+ * use MetingJS and Aplayer
348
+ * https://github.com/MoePlayer/APlayer
349
+ * https://github.com/metowolf/MetingJS
350
+ */
351
+ declare function useAplayer(): void;
352
+
353
+ /**
354
+ * You can use href="#" to back to top
355
+ * @description 你可以使用它来编写自己的 backToTop
356
+ */
357
+ declare function useBackToTop(options?: {
358
+ /**
359
+ * show backToTop button, when height > offset
360
+ */
361
+ offset: number;
362
+ }): {
363
+ percentage: vue.Ref<number>;
364
+ show: vue.Ref<boolean>;
365
+ };
366
+
367
+ declare function useCodePen(): void;
368
+
369
+ declare function useActiveSidebarLinks(container: Ref<HTMLElement>, marker: Ref<HTMLElement>): void;
370
+
371
+ declare function useTwikoo(options?: {}): void;
372
+
373
+ declare function useWaline(options?: {}): any;
374
+
375
+ /**
376
+ * 生成介于 min 与 max 之间的随机数
377
+ * @returns
378
+ */
379
+ declare function random(min: number, max: number): number;
380
+ /**
381
+ * wrap node
382
+ * @param className
383
+ */
384
+ declare function wrap(el: HTMLElement, className: string): void;
385
+ /**
386
+ * 包裹表格,添加 class 以控制 table 样式
387
+ */
388
+ declare const wrapTable: (container?: HTMLElement | Document) => void;
389
+
390
+ /**
391
+ * use dayjs format date
392
+ * @param date
393
+ * @param template
394
+ * @returns
395
+ */
396
+ declare function formatDate(date: string | number | Date, template?: string): string;
397
+ /**
398
+ * sort posts by date
399
+ * @param posts
400
+ * @param desc
401
+ */
402
+ declare function sortByDate(posts: Post[], desc?: boolean): Post[];
403
+
404
+ export { BaseCategory, Categories, Category, ParentCategory, Post, PostCategory, Tags, formatDate, initConfig, isDark, isParentCategory, 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}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkRUZ4KMBMjs = require('./chunk-RUZ4KMBM.js');_chunkRUZ4KMBMjs.f.call(void 0, );_chunkRUZ4KMBMjs.f.call(void 0, );_chunkRUZ4KMBMjs.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)}_chunkRUZ4KMBMjs.f.call(void 0, );_chunkRUZ4KMBMjs.f.call(void 0, );_chunkRUZ4KMBMjs.f.call(void 0, );var _vuerouter = require('vue-router');var _vuei18n = require('vue-i18n');_chunkRUZ4KMBMjs.f.call(void 0, );_chunkRUZ4KMBMjs.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")})};_chunkRUZ4KMBMjs.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}_chunkRUZ4KMBMjs.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,_chunkRUZ4KMBMjs.b.call(void 0, _chunkRUZ4KMBMjs.a.call(void 0, {},r),{count:r.count+1}))}else e.set(i,{count:1})})}}),e}_chunkRUZ4KMBMjs.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)}_chunkRUZ4KMBMjs.f.call(void 0, );_chunkRUZ4KMBMjs.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"}]})}_chunkRUZ4KMBMjs.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)}}}_chunkRUZ4KMBMjs.f.call(void 0, );var X=_core.useDark.call(void 0, ),ge= exports.toggleDark =_core.useToggle.call(void 0, X);_chunkRUZ4KMBMjs.f.call(void 0, );function we(t){let e=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>e.meta.layout===t)}_chunkRUZ4KMBMjs.f.call(void 0, );_chunkRUZ4KMBMjs.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")})}_chunkRUZ4KMBMjs.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}}_chunkRUZ4KMBMjs.f.call(void 0, );function Se(){_head.useHead.call(void 0, {script:[{src:"https://static.codepen.io/assets/embed/ei.js",async:!0}]})}_chunkRUZ4KMBMjs.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))}}_chunkRUZ4KMBMjs.f.call(void 0, );_chunkRUZ4KMBMjs.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)})}_chunkRUZ4KMBMjs.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 = _chunkRUZ4KMBMjs.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;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkPFDRHZPFjs = require('./chunk-PFDRHZPF.js');_chunkPFDRHZPFjs.f.call(void 0, );_chunkPFDRHZPFjs.f.call(void 0, );_chunkPFDRHZPFjs.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"),P= exports.valaxyConfigRef =_vue.shallowRef.call(void 0, T(_config2.default));import.meta.hot&&import.meta.hot.accept("/@valaxyjs/config",t=>{P.value=T(t.default)});function Tt(){return _vue.computed.call(void 0, ()=>P.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 b(){let t=y();return _vue.computed.call(void 0, ()=>t.value.themeConfig)}_chunkPFDRHZPFjs.f.call(void 0, );_chunkPFDRHZPFjs.f.call(void 0, );_chunkPFDRHZPFjs.f.call(void 0, );var _vuerouter = require('vue-router');var _vuei18n = require('vue-i18n');_chunkPFDRHZPFjs.f.call(void 0, );_chunkPFDRHZPFjs.f.call(void 0, );function bt(t,e){return Math.random()*(e-t)+t}function B(t,e){let o=document.createElement("div");o.className=e,t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),o.appendChild(t)}var jt=(t=document)=>{t.querySelectorAll("table").forEach(e=>{let o=document.createElement("div");o.className="table-container",B(e,"table-container")})};_chunkPFDRHZPFjs.f.call(void 0, );var _dayjs = require('dayjs'); var _dayjs2 = _interopRequireDefault(_dayjs);function Mt(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 qt=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,c)=>c.top-r.top),i=x(o.filter(r=>!r.top));return s.concat(i)})}function Bt(){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 zt(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((l,u)=>l.path===o.value?(a=u,!0):!1),a}),r=_vue.computed.call(void 0, ()=>i.value-1>=0?s.value[i.value-1]:null),c=_vue.computed.call(void 0, ()=>i.value+1<s.value.length?s.value[i.value+1]:null);return[r,c]}function It(t){if(!t)return{color:"",icon:"",styles:{}};let e=b();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}}var $t=t=>t.children;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 c=r.categories.length,a=o;r.categories.forEach((l,u)=>{var p,h,d;if(u===c-1)if(a.children.has(l)){let m=a.children.get(l);m.posts&&(m.total+=1,m.posts.push(r))}else(p=a.children)==null||p.set(l,{total:1,posts:[r]});else if((h=a.children)!=null&&h.has(l)){let m=a.children.get(l);m.total+=1,a=m}else{let m={total:1,children:new Map};(d=a.children)==null||d.set(l,m),a=m}})}else{let c=r.categories;if(o.children.has(c)){let a=o.children.get(c);a.total+=1,a.posts.push(r)}else o.children.set(c,{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}_chunkPFDRHZPFjs.f.call(void 0, );var _tinycolor = require('@ctrl/tinycolor');function Gt(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 c=Array.from(e).map(([h,d])=>d.count),a=Math.max(...c),l=Math.min(...c),u=a-l,p=(r-l)/u;return{"--yun-tag-color":o.mix(s,p*100).toString(),fontSize:`${p*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,_chunkPFDRHZPFjs.b.call(void 0, _chunkPFDRHZPFjs.a.call(void 0, {},r),{count:r.count+1}))}else e.set(i,{count:1})})}}),e}_chunkPFDRHZPFjs.f.call(void 0, );var _core = require('@vueuse/core');function oe(){let t=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>t.meta.frontmatter)}function re(){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)}_chunkPFDRHZPFjs.f.call(void 0, );_chunkPFDRHZPFjs.f.call(void 0, );var _head = require('@vueuse/head');function ie(){_head.useHead.call(void 0, {link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css"}]})}_chunkPFDRHZPFjs.f.call(void 0, );function pe(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)}}}_chunkPFDRHZPFjs.f.call(void 0, );var X=_core.useDark.call(void 0, ),he= exports.toggleDark =_core.useToggle.call(void 0, X);_chunkPFDRHZPFjs.f.call(void 0, );function ve(t){let e=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>e.meta.layout===t)}_chunkPFDRHZPFjs.f.call(void 0, );_chunkPFDRHZPFjs.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")})}_chunkPFDRHZPFjs.f.call(void 0, );function Ee(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}}_chunkPFDRHZPFjs.f.call(void 0, );function ke(){_head.useHead.call(void 0, {script:[{src:"https://static.codepen.io/assets/embed/ei.js",async:!0}]})}_chunkPFDRHZPFjs.f.call(void 0, );function Ue(t,e){let o=lt(s,200);function s(){let a=[].slice.call(document.querySelectorAll(".va-toc a.toc-link-item")),l=[].slice.call(document.querySelectorAll("main .header-anchor")).filter(u=>a.some(p=>p.hash===u.hash));for(let u=0;u<l.length;u++){let p=l[u],h=l[u+1],[d,m]=at(u,p,h);if(d){history.replaceState(null,document.title,m||" "),r(m);return}}}let i=null;function r(a){c(i);let l=i=a==null?null:t.value.querySelector(`.va-toc a[href="${a}"]`);l?(l.classList.add("active"),e.value.style.opacity="1",e.value.style.top=`${l.offsetTop+2}px`):(e.value.style.opacity="0",e.value.style.top="54px")}function c(a){a&&a.classList.remove("active")}_vue.onMounted.call(void 0, ()=>{requestAnimationFrame(s),window.addEventListener("scroll",o)}),_vue.onUnmounted.call(void 0, ()=>{window.removeEventListener("scroll",o)})}function R(t){return t.parentElement.offsetTop-50}function at(t,e,o){let s=window.scrollY;return t===0&&s===0?[!0,null]:s<R(e)?[!1,null]:!o||s<R(o)?[!0,decodeURIComponent(e.hash)]:[!1,null]}function lt(t,e){let o,s=!1;return()=>{o&&clearTimeout(o),s?o=setTimeout(t,e):(t(),s=!0,setTimeout(()=>{s=!1},e))}}_chunkPFDRHZPFjs.f.call(void 0, );_chunkPFDRHZPFjs.f.call(void 0, );function Ne(t={}){let e=_vuerouter.useRoute.call(void 0, ),{locale:o}=_vuei18n.useI18n.call(void 0, );function s(i={}){if(!_core.isClient)return;let r={el:".comment #tcomment",lang:o.value,path:e.path},c=Object.assign(r,i);return window.twikoo.init(c)}_core.useScriptTag.call(void 0, "//cdn.jsdelivr.net/npm/twikoo@1.5.1/dist/twikoo.all.min.js",()=>{s(t)})}_chunkPFDRHZPFjs.f.call(void 0, );function Je(t={}){_head.useHead.call(void 0, {link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/@waline/client/dist/waline.css"}]});let e=_vuerouter.useRoute.call(void 0, ),{locale:o}=_vuei18n.useI18n.call(void 0, ),s;function i(r={}){if(!_core.isClient)return;let c={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(c,r);return window.Waline.init(a)}return _core.useScriptTag.call(void 0, "//cdn.jsdelivr.net/npm/@waline/client/dist/waline.js",()=>{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()}),s}exports.defaultValaxyConfig = _chunkPFDRHZPFjs.g; exports.formatDate = Mt; exports.initConfig = Tt; exports.isDark = X; exports.isParentCategory = $t; exports.random = bt; exports.sortByDate = x; exports.toggleDark = he; exports.useActiveSidebarLinks = Ue; exports.useAplayer = Pe; exports.useBackToTop = Ee; exports.useCategory = Ft; exports.useCodePen = ke; exports.useConfig = y; exports.useFrontmatter = oe; exports.useFullUrl = re; exports.useInvisibleElement = pe; exports.useKatex = ie; exports.useLayout = ve; exports.usePageList = Bt; exports.usePostList = g; exports.usePostProperty = It; exports.usePostTitle = qt; exports.usePrevNext = zt; exports.useTag = Y; exports.useTags = Gt; exports.useThemeConfig = b; exports.useTwikoo = Ne; exports.useWaline = Je; exports.valaxyConfigRef = P; exports.valaxyConfigSymbol = q; exports.wrap = B; exports.wrapTable = jt;