valaxy 0.0.6 → 0.0.9
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/config-d6527c8c.d.ts +174 -0
- package/dist/index.d.ts +305 -152
- 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 +88 -0
- package/dist/node/cli.mjs +88 -0
- package/dist/node/index.d.ts +45 -0
- package/dist/node/index.js +83 -0
- package/dist/node/index.mjs +83 -0
- package/package.json +9 -5
- package/src/client/components/ValaxyCopyright.vue +1 -1
- package/src/client/composables/category.ts +2 -2
- package/src/client/composables/common.ts +3 -2
- package/src/client/composables/post.ts +2 -2
- package/src/client/composables/tag.ts +2 -1
- package/src/{core → client}/config.ts +1 -1
- package/src/client/index.ts +4 -0
- package/src/client/modules/valaxy.ts +1 -1
- package/src/client/utils/index.ts +2 -0
- package/src/client/utils/time.ts +7 -1
- package/src/index.ts +1 -1
- package/src/node/plugins/extendConfig.ts +45 -0
- package/src/node/plugins/preset.ts +12 -1
- package/src/node/vite.ts +1 -32
- package/tsup.config.ts +9 -5
- package/dist/build-ONY2EY5P.js +0 -1
- package/dist/build-WOTUPDVZ.mjs +0 -1
- package/dist/chunk-KVMOYEI7.mjs +0 -78
- package/dist/chunk-L2JFIGW6.js +0 -1
- package/dist/chunk-LYQNUAIB.mjs +0 -1
- package/dist/chunk-Y7N6QN4A.js +0 -78
- package/dist/cli.js +0 -6
- package/dist/cli.mjs +0 -6
- package/src/core/index.ts +0 -5
- package/src/core/utils.ts +0 -1
package/bin/valaxy.js
CHANGED
|
@@ -0,0 +1,174 @@
|
|
|
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, do not add / in end
|
|
42
|
+
* @description 站点的 URL,SSG 需要(譬如生成版权处文章永久链接),不要在末尾添加 /
|
|
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
|
+
avatar: string;
|
|
69
|
+
/**
|
|
70
|
+
* The status of you
|
|
71
|
+
* @description 状态
|
|
72
|
+
*/
|
|
73
|
+
status: {
|
|
74
|
+
emoji: string;
|
|
75
|
+
/**
|
|
76
|
+
* show when hover emoji
|
|
77
|
+
* @description 当鼠标悬浮在图标上时显示
|
|
78
|
+
*/
|
|
79
|
+
message: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* 社交链接
|
|
84
|
+
*/
|
|
85
|
+
social: SocialLink[];
|
|
86
|
+
/**
|
|
87
|
+
* search
|
|
88
|
+
*/
|
|
89
|
+
search: {
|
|
90
|
+
algolia: {
|
|
91
|
+
enable: boolean;
|
|
92
|
+
appId: string;
|
|
93
|
+
apiKey: string;
|
|
94
|
+
indexName: string;
|
|
95
|
+
chunkSize: number;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* comment: waline/...
|
|
100
|
+
*/
|
|
101
|
+
comment: {
|
|
102
|
+
waline: {
|
|
103
|
+
enable: boolean;
|
|
104
|
+
serverURL: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* The name of theme
|
|
109
|
+
* @description 主题名称
|
|
110
|
+
*/
|
|
111
|
+
theme: string;
|
|
112
|
+
/**
|
|
113
|
+
* The config of theme
|
|
114
|
+
* @description 主题配置
|
|
115
|
+
*/
|
|
116
|
+
themeConfig: T;
|
|
117
|
+
/**
|
|
118
|
+
* Unocss Config
|
|
119
|
+
*/
|
|
120
|
+
unocss: VitePluginConfig;
|
|
121
|
+
/**
|
|
122
|
+
* The license of your posts
|
|
123
|
+
* @description 文章所使用的协议,默认使用 Creative Commons
|
|
124
|
+
* @default https://creativecommons.org/licenses/
|
|
125
|
+
*/
|
|
126
|
+
license: {
|
|
127
|
+
/**
|
|
128
|
+
* Whether to show at the bottom of the article
|
|
129
|
+
* @description 是否显示在文章底部
|
|
130
|
+
* @default true
|
|
131
|
+
*/
|
|
132
|
+
enabled: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Creative License Language, same with your config.lang
|
|
135
|
+
* when lang === 'zh-CN', use 'zh'
|
|
136
|
+
* @description 默认与站点语言相同
|
|
137
|
+
* @default 'en'
|
|
138
|
+
*/
|
|
139
|
+
language: string;
|
|
140
|
+
/**
|
|
141
|
+
* Type of license
|
|
142
|
+
* @description 证书类型
|
|
143
|
+
* @default 'by-nc-sa'
|
|
144
|
+
*/
|
|
145
|
+
type: 'zero' | 'by-sa' | 'by-nd' | 'by-nc' | 'by-nc-sa' | 'by-nc-nd';
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* donate for author
|
|
149
|
+
* @description 打赏/赞助
|
|
150
|
+
*/
|
|
151
|
+
sponsor: {
|
|
152
|
+
enable: boolean;
|
|
153
|
+
title: string;
|
|
154
|
+
methods: {
|
|
155
|
+
name: string;
|
|
156
|
+
url: string;
|
|
157
|
+
color: string;
|
|
158
|
+
icon: string;
|
|
159
|
+
}[];
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* for markdown
|
|
163
|
+
*/
|
|
164
|
+
markdown: ViteMdOptions;
|
|
165
|
+
markdownIt: MarkdownOptions;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Valaxy User Config
|
|
169
|
+
* @description Valaxy 用户配置
|
|
170
|
+
*/
|
|
171
|
+
declare type UserConfig<T = ValaxyThemeConfig> = PartialDeep<ValaxyConfig<T>>;
|
|
172
|
+
declare const defaultValaxyConfig: ValaxyConfig;
|
|
173
|
+
|
|
174
|
+
export { SocialLink as S, UserConfig as U, ValaxyConfig as V, ValaxyThemeConfig as a, defaultValaxyConfig as d };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,203 +1,356 @@
|
|
|
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, StyleValue, Ref } from 'vue';
|
|
3
|
+
import { V as ValaxyConfig, a as ValaxyThemeConfig } from './config-d6527c8c.js';
|
|
4
|
+
export { S as SocialLink, U as UserConfig, V as ValaxyConfig, a as ValaxyThemeConfig, d as defaultValaxyConfig } from './config-d6527c8c.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 {
|
|
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
|
-
* Whether to show at the bottom of the article
|
|
130
|
-
* @description 是否显示在文章底部
|
|
131
|
-
* @default true
|
|
132
|
-
*/
|
|
133
|
-
enabled: boolean;
|
|
134
|
-
/**
|
|
135
|
-
* Creative License Language, same with your config.lang
|
|
136
|
-
* when lang === 'zh-CN', use 'zh'
|
|
137
|
-
* @description 默认与站点语言相同
|
|
138
|
-
* @default 'en'
|
|
139
|
-
*/
|
|
140
|
-
language: string;
|
|
141
|
-
/**
|
|
142
|
-
* Type of license
|
|
143
|
-
* @description 证书类型
|
|
144
|
-
* @default 'by-nc-sa'
|
|
145
|
-
*/
|
|
146
|
-
type: 'zero' | 'by-sa' | 'by-nd' | 'by-nc' | 'by-nc-sa' | 'by-nc-nd';
|
|
147
|
-
};
|
|
84
|
+
comment?: boolean;
|
|
148
85
|
/**
|
|
149
|
-
*
|
|
150
|
-
* @description
|
|
86
|
+
* post is end
|
|
87
|
+
* @description 是否完结,将在末尾添加衬线字体 Q.E.D.
|
|
151
88
|
*/
|
|
152
|
-
|
|
153
|
-
enable: boolean;
|
|
154
|
-
title: string;
|
|
155
|
-
methods: {
|
|
156
|
-
name: string;
|
|
157
|
-
url: string;
|
|
158
|
-
color: string;
|
|
159
|
-
icon: string;
|
|
160
|
-
}[];
|
|
161
|
-
};
|
|
89
|
+
end?: boolean;
|
|
162
90
|
/**
|
|
163
|
-
*
|
|
91
|
+
* use aplayer
|
|
164
92
|
*/
|
|
165
|
-
|
|
166
|
-
markdownIt: MarkdownOptions;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
interface ResolvedValaxyOptions {
|
|
93
|
+
aplayer?: boolean;
|
|
170
94
|
/**
|
|
171
|
-
*
|
|
172
|
-
* @default 'valaxy/src/client'
|
|
95
|
+
* use katex
|
|
173
96
|
*/
|
|
174
|
-
|
|
97
|
+
katex?: boolean;
|
|
175
98
|
/**
|
|
176
|
-
*
|
|
177
|
-
* @default process.cwd()
|
|
99
|
+
* use codepen
|
|
178
100
|
*/
|
|
179
|
-
|
|
101
|
+
codepen?: boolean;
|
|
180
102
|
/**
|
|
181
|
-
*
|
|
103
|
+
* 置顶
|
|
182
104
|
*/
|
|
183
|
-
|
|
105
|
+
top?: number;
|
|
184
106
|
/**
|
|
185
|
-
*
|
|
107
|
+
* display toc
|
|
108
|
+
* @description 是否显示目录
|
|
186
109
|
*/
|
|
187
|
-
|
|
110
|
+
toc?: boolean;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Theme Config
|
|
115
|
+
*/
|
|
116
|
+
interface ThemeConfig {
|
|
188
117
|
/**
|
|
189
|
-
*
|
|
118
|
+
* 首页标语
|
|
190
119
|
*/
|
|
191
|
-
|
|
120
|
+
banner: {
|
|
121
|
+
enable: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* 标题
|
|
124
|
+
*/
|
|
125
|
+
title: string;
|
|
126
|
+
};
|
|
127
|
+
bg_image: {
|
|
128
|
+
enable: boolean;
|
|
129
|
+
url: string;
|
|
130
|
+
dark?: string;
|
|
131
|
+
opacity: number;
|
|
132
|
+
};
|
|
192
133
|
/**
|
|
193
|
-
*
|
|
134
|
+
* say something
|
|
135
|
+
* https://say.elpsy.cn
|
|
194
136
|
*/
|
|
195
|
-
|
|
137
|
+
say: {
|
|
138
|
+
enable: boolean;
|
|
139
|
+
api: string;
|
|
140
|
+
hitokoto: {
|
|
141
|
+
enable: boolean;
|
|
142
|
+
api: string;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
pages: {
|
|
146
|
+
name: string;
|
|
147
|
+
url: string;
|
|
148
|
+
icon: string;
|
|
149
|
+
color: string;
|
|
150
|
+
}[];
|
|
151
|
+
/**
|
|
152
|
+
* footer
|
|
153
|
+
*/
|
|
154
|
+
footer: {
|
|
155
|
+
/**
|
|
156
|
+
* 建站于
|
|
157
|
+
*/
|
|
158
|
+
since: number;
|
|
159
|
+
/**
|
|
160
|
+
* Icon between year and copyright info.
|
|
161
|
+
*/
|
|
162
|
+
icon: {
|
|
163
|
+
/**
|
|
164
|
+
* icon name, i-xxx
|
|
165
|
+
*/
|
|
166
|
+
name: string;
|
|
167
|
+
animated: boolean;
|
|
168
|
+
color: string;
|
|
169
|
+
url: string;
|
|
170
|
+
title: string;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Powered by valaxy & valaxy-theme-${name}, default is yun
|
|
174
|
+
*/
|
|
175
|
+
powered: boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Chinese Users | 中国用户
|
|
178
|
+
* 备案 ICP
|
|
179
|
+
* 国内用户需要在网站页脚展示备案 ICP 号
|
|
180
|
+
* https://beian.miit.gov.cn/
|
|
181
|
+
*/
|
|
182
|
+
beian: {
|
|
183
|
+
enable: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* 苏ICP备xxxxxxxx号
|
|
186
|
+
*/
|
|
187
|
+
icp: string;
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
* post card types
|
|
192
|
+
*/
|
|
193
|
+
types: Record<string, {
|
|
194
|
+
color: string;
|
|
195
|
+
icon: string;
|
|
196
|
+
}>;
|
|
196
197
|
}
|
|
197
|
-
|
|
198
|
-
|
|
198
|
+
|
|
199
|
+
declare const valaxyConfigSymbol: InjectionKey<ComputedRef<ValaxyConfig<ThemeConfig>>>;
|
|
200
|
+
declare const valaxyConfigRef: vue.ShallowRef<ValaxyConfig<ValaxyThemeConfig>>;
|
|
201
|
+
declare function initConfig(): ComputedRef<ValaxyConfig<ValaxyThemeConfig>>;
|
|
202
|
+
declare function useConfig(): ComputedRef<ValaxyConfig<ThemeConfig>>;
|
|
203
|
+
/**
|
|
204
|
+
* getThemeConfig
|
|
205
|
+
* @returns
|
|
206
|
+
*/
|
|
207
|
+
declare function useThemeConfig(): ComputedRef<ThemeConfig>;
|
|
208
|
+
|
|
209
|
+
interface ParentCategory {
|
|
210
|
+
total: number;
|
|
211
|
+
children: Categories;
|
|
212
|
+
}
|
|
213
|
+
interface PostCategory {
|
|
214
|
+
total: number;
|
|
215
|
+
posts: Post[];
|
|
199
216
|
}
|
|
217
|
+
declare type Category = ParentCategory | PostCategory;
|
|
218
|
+
declare type Categories = Map<string, Category>;
|
|
219
|
+
/**
|
|
220
|
+
* get categories from posts
|
|
221
|
+
* @returns
|
|
222
|
+
*/
|
|
223
|
+
declare function useCategory(): ParentCategory;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* get post list
|
|
227
|
+
* todo: use vue provide/inject to global
|
|
228
|
+
* @param params
|
|
229
|
+
* @returns
|
|
230
|
+
*/
|
|
231
|
+
declare function usePostList(params?: {
|
|
232
|
+
type?: string;
|
|
233
|
+
}): vue.ComputedRef<Post[]>;
|
|
234
|
+
/**
|
|
235
|
+
* get prev and next post
|
|
236
|
+
* @param path
|
|
237
|
+
* @returns
|
|
238
|
+
*/
|
|
239
|
+
declare function usePrevNext(path?: string): vue.ComputedRef<Post | null>[];
|
|
240
|
+
/**
|
|
241
|
+
* get type card property
|
|
242
|
+
* todo: test reactive
|
|
243
|
+
*/
|
|
244
|
+
declare function usePostProperty(type?: string): {
|
|
245
|
+
color: string;
|
|
246
|
+
icon: string;
|
|
247
|
+
styles: {};
|
|
248
|
+
} | {
|
|
249
|
+
color: string;
|
|
250
|
+
icon: string;
|
|
251
|
+
styles: vue.ComputedRef<StyleValue>;
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
declare type Tags = Map<string, {
|
|
255
|
+
count: number;
|
|
256
|
+
}>;
|
|
257
|
+
/**
|
|
258
|
+
* get utils about tags
|
|
259
|
+
*/
|
|
260
|
+
declare function useTags(): {
|
|
261
|
+
tags: Tags;
|
|
262
|
+
getTagStyle: (count: number) => {
|
|
263
|
+
'--yun-tag-color': string;
|
|
264
|
+
fontSize: string;
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* get tag map
|
|
269
|
+
* @returns
|
|
270
|
+
*/
|
|
271
|
+
declare function useTag(): Tags;
|
|
272
|
+
|
|
273
|
+
declare function useFrontmatter(): vue.ComputedRef<Post>;
|
|
274
|
+
/**
|
|
275
|
+
* get full url
|
|
276
|
+
*/
|
|
277
|
+
declare function useFullUrl(): vue.ComputedRef<string>;
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* use katex css cdn
|
|
281
|
+
*/
|
|
282
|
+
declare function useKatex(): void;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* trigger show invisible element
|
|
286
|
+
* @param target
|
|
287
|
+
* @returns
|
|
288
|
+
*/
|
|
289
|
+
declare function useInvisibleElement(target: Ref<HTMLElement>): {
|
|
290
|
+
show: () => void;
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
declare const isDark: vue.WritableComputedRef<boolean>;
|
|
294
|
+
declare const toggleDark: (value?: boolean | undefined) => boolean;
|
|
295
|
+
|
|
296
|
+
declare function useLayout(layout: string): vue.ComputedRef<boolean>;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* use MetingJS and Aplayer
|
|
300
|
+
* https://github.com/MoePlayer/APlayer
|
|
301
|
+
* https://github.com/metowolf/MetingJS
|
|
302
|
+
*/
|
|
303
|
+
declare function useAplayer(): void;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* You can use href="#" to back to top
|
|
307
|
+
* @description 你可以使用它来编写自己的 backToTop
|
|
308
|
+
*/
|
|
309
|
+
declare function useBackToTop(options?: {
|
|
310
|
+
/**
|
|
311
|
+
* show backToTop button, when height > offset
|
|
312
|
+
*/
|
|
313
|
+
offset: number;
|
|
314
|
+
}): {
|
|
315
|
+
percentage: vue.ComputedRef<number>;
|
|
316
|
+
show: vue.ComputedRef<boolean>;
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
declare function useCodePen(): void;
|
|
320
|
+
|
|
321
|
+
declare function useActiveSidebarLinks(): void;
|
|
322
|
+
|
|
323
|
+
declare function useWaline(options?: {}): void;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* 生成介于 min 与 max 之间的随机数
|
|
327
|
+
* @returns
|
|
328
|
+
*/
|
|
329
|
+
declare function random(min: number, max: number): number;
|
|
330
|
+
/**
|
|
331
|
+
* wrap node
|
|
332
|
+
* @param className
|
|
333
|
+
*/
|
|
334
|
+
declare function wrap(el: HTMLElement, className: string): void;
|
|
335
|
+
/**
|
|
336
|
+
* 包裹表格,添加 class 以控制 table 样式
|
|
337
|
+
*/
|
|
338
|
+
declare const wrapTable: (container?: HTMLElement | Document) => void;
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* use dayjs format date
|
|
342
|
+
* @param date
|
|
343
|
+
* @param template
|
|
344
|
+
* @returns
|
|
345
|
+
*/
|
|
346
|
+
declare function formatDate(date: string | number | Date, template?: string): string;
|
|
347
|
+
/**
|
|
348
|
+
* sort posts by date
|
|
349
|
+
* @param posts
|
|
350
|
+
* @param desc
|
|
351
|
+
*/
|
|
352
|
+
declare function sortByDate(posts: Post[], desc?: boolean): Post[];
|
|
200
353
|
|
|
201
|
-
declare
|
|
354
|
+
declare const isDev: boolean;
|
|
202
355
|
|
|
203
|
-
export {
|
|
356
|
+
export { Categories, Category, ParentCategory, Post, PostCategory, Tags, formatDate, initConfig, isDark, isDev, random, sortByDate, toggleDark, useActiveSidebarLinks, useAplayer, useBackToTop, useCategory, useCodePen, useConfig, useFrontmatter, useFullUrl, useInvisibleElement, useKatex, useLayout, usePostList, usePostProperty, usePrevNext, useTag, useTags, useThemeConfig, useWaline, valaxyConfigRef, valaxyConfigSymbol, wrap, wrapTable };
|