@waline/client 1.6.0 → 2.0.0-alpha.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.
- package/dist/component.js +2 -0
- package/dist/component.js.map +1 -0
- package/dist/pageview.cjs.js +2 -0
- package/dist/pageview.cjs.js.map +1 -0
- package/dist/pageview.d.ts +33 -0
- package/dist/pageview.esm.js +2 -0
- package/dist/pageview.esm.js.map +1 -0
- package/dist/pageview.js +2 -0
- package/dist/pageview.js.map +1 -0
- package/dist/{Waline.min.d.ts → shim.d.ts} +192 -261
- package/dist/{Waline.noStyle.d.ts → shim.esm.d.ts} +192 -261
- package/dist/shim.esm.js +2 -0
- package/dist/shim.esm.js.map +1 -0
- package/dist/shim.js +2 -0
- package/dist/shim.js.map +1 -0
- package/dist/waline.cjs.d.ts +388 -0
- package/dist/waline.cjs.js +2 -0
- package/dist/waline.cjs.js.map +1 -0
- package/dist/waline.css +1 -0
- package/dist/waline.css.map +1 -0
- package/dist/waline.d.ts +388 -0
- package/dist/waline.esm.d.ts +388 -0
- package/dist/waline.esm.js +2 -0
- package/dist/waline.esm.js.map +1 -0
- package/dist/waline.js +2 -0
- package/dist/waline.js.map +1 -0
- package/package.json +33 -18
- package/src/comment.ts +39 -0
- package/src/components/CommentBox.vue +667 -0
- package/src/components/CommentCard.vue +125 -0
- package/src/components/Icons.ts +124 -0
- package/src/components/Waline.vue +359 -0
- package/src/composables/index.ts +3 -0
- package/src/composables/inputs.ts +29 -0
- package/src/composables/store.ts +38 -0
- package/src/composables/userInfo.ts +27 -0
- package/src/config/default.ts +21 -0
- package/src/config/i18n/en.ts +34 -0
- package/src/config/i18n/generate.ts +39 -0
- package/src/config/i18n/index.ts +30 -0
- package/src/config/i18n/jp.ts +34 -0
- package/src/config/i18n/pt-BR.ts +34 -0
- package/src/config/i18n/ru.ts +34 -0
- package/src/config/i18n/vi-VN.ts +34 -0
- package/src/config/i18n/zh-CN.ts +34 -0
- package/src/config/i18n/zh-TW.ts +34 -0
- package/src/config/index.ts +2 -0
- package/src/entrys/components.ts +2 -0
- package/src/entrys/full.ts +7 -0
- package/src/entrys/init.ts +4 -0
- package/src/entrys/pageview.ts +2 -0
- package/src/init.ts +92 -0
- package/src/pageview.ts +100 -0
- package/src/shims-hanabi.d.ts +9 -0
- package/src/shims-vue.d.ts +5 -0
- package/src/styles/base.scss +67 -0
- package/src/styles/card.scss +223 -0
- package/src/styles/config.scss +52 -0
- package/src/styles/emoji.scss +118 -0
- package/src/styles/highlight.scss +135 -0
- package/src/styles/index.scss +12 -0
- package/src/styles/layout.scss +78 -0
- package/src/styles/nomalize.scss +112 -0
- package/src/styles/panel.scss +293 -0
- package/src/styles/recent.scss +3 -0
- package/src/typings/base.ts +54 -0
- package/src/typings/comment.ts +25 -0
- package/src/typings/index.ts +5 -0
- package/src/typings/locale.ts +32 -0
- package/src/typings/options.ts +41 -0
- package/src/typings/waline.ts +208 -0
- package/src/utils/config.ts +99 -0
- package/src/utils/darkmode.ts +11 -0
- package/src/utils/data.ts +10 -0
- package/src/utils/emoji.ts +75 -0
- package/src/utils/error.ts +3 -0
- package/src/utils/fetch.ts +177 -0
- package/src/utils/getRoot.ts +8 -0
- package/src/utils/index.ts +13 -0
- package/src/utils/markdown.ts +41 -0
- package/src/utils/markedMathExtension.ts +52 -0
- package/src/utils/path.ts +15 -0
- package/src/utils/query.ts +2 -0
- package/src/utils/timeAgo.ts +75 -0
- package/src/utils/userInfo.ts +26 -0
- package/src/utils/wordCount.ts +20 -0
- package/src/version.ts +3 -0
- package/src/widgets/index.ts +1 -0
- package/src/widgets/recentComments.ts +52 -0
- package/dist/Waline.min.js +0 -2
- package/dist/Waline.min.js.map +0 -1
- package/dist/Waline.noStyle.js +0 -2
- package/dist/Waline.noStyle.js.map +0 -1
- package/dist/index.html +0 -11
|
@@ -1,4 +1,48 @@
|
|
|
1
|
-
interface
|
|
1
|
+
interface WalineEmojiInfo {
|
|
2
|
+
/**
|
|
3
|
+
* 选项卡上的 Emoji 名称
|
|
4
|
+
*
|
|
5
|
+
* Emoji name show on tab
|
|
6
|
+
*/
|
|
7
|
+
name: string;
|
|
8
|
+
/**
|
|
9
|
+
* 所在文件夹链接
|
|
10
|
+
*
|
|
11
|
+
* Current folder link
|
|
12
|
+
*/
|
|
13
|
+
folder: string;
|
|
14
|
+
/**
|
|
15
|
+
* Emoji 通用路径前缀
|
|
16
|
+
*
|
|
17
|
+
* Common prefix of Emoji icons
|
|
18
|
+
*/
|
|
19
|
+
prefix?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Emoji 图片的类型,会作为文件扩展名使用
|
|
22
|
+
*
|
|
23
|
+
* Type of Emoji icons, will be regarded as file extension
|
|
24
|
+
*/
|
|
25
|
+
type?: string;
|
|
26
|
+
/**
|
|
27
|
+
* 选项卡显示的 Emoji 图标
|
|
28
|
+
*
|
|
29
|
+
* Emoji icon show on tab
|
|
30
|
+
*/
|
|
31
|
+
icon: string;
|
|
32
|
+
/**
|
|
33
|
+
* Emoji 图片列表
|
|
34
|
+
*
|
|
35
|
+
* Emoji image list
|
|
36
|
+
*/
|
|
37
|
+
items: string[];
|
|
38
|
+
}
|
|
39
|
+
declare type WalineEmojiMaps = Record<string, string>;
|
|
40
|
+
declare type WalineMeta = 'nick' | 'mail' | 'link';
|
|
41
|
+
declare type WalineImageUploader = (image: File) => Promise<string>;
|
|
42
|
+
declare type WalineHighlighter = ((code: string, lang: string) => string) | ((code: string, lang: string, callback?: (error: unknown | undefined, code?: string) => void) => void);
|
|
43
|
+
declare type WalineTexRenderer = (blockMode: boolean, tex: string) => string;
|
|
44
|
+
|
|
45
|
+
interface WalineCommentData {
|
|
2
46
|
nick: string;
|
|
3
47
|
mail: string;
|
|
4
48
|
link?: string;
|
|
@@ -9,29 +53,20 @@ interface CommentData {
|
|
|
9
53
|
at?: string;
|
|
10
54
|
url: string;
|
|
11
55
|
}
|
|
12
|
-
interface
|
|
13
|
-
avatar
|
|
56
|
+
interface WalineComment extends Exclude<WalineCommentData, 'ua'> {
|
|
57
|
+
avatar: string;
|
|
58
|
+
type?: string;
|
|
14
59
|
objectId: string;
|
|
15
60
|
createdAt: string;
|
|
16
61
|
insertedAt: string;
|
|
17
62
|
updatedAt: string;
|
|
18
|
-
children:
|
|
63
|
+
children: WalineComment[];
|
|
19
64
|
sticky?: boolean;
|
|
20
65
|
browser?: string;
|
|
21
66
|
os?: string;
|
|
22
67
|
}
|
|
23
68
|
|
|
24
|
-
interface
|
|
25
|
-
serverURL: string;
|
|
26
|
-
count: number;
|
|
27
|
-
el?: string | HTMLElement;
|
|
28
|
-
}
|
|
29
|
-
interface RecentCommentsResult {
|
|
30
|
-
comments: Comment[];
|
|
31
|
-
destroy: () => void;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
interface Locale {
|
|
69
|
+
interface WalineLocale {
|
|
35
70
|
nick: string;
|
|
36
71
|
nickError: string;
|
|
37
72
|
mail: string;
|
|
@@ -64,233 +99,23 @@ interface Locale {
|
|
|
64
99
|
anonymous: string;
|
|
65
100
|
}
|
|
66
101
|
|
|
67
|
-
|
|
68
|
-
interface EmojiInfo {
|
|
69
|
-
/**
|
|
70
|
-
* 选项卡上的 Emoji 名称
|
|
71
|
-
*
|
|
72
|
-
* Emoji name show on tab
|
|
73
|
-
*/
|
|
74
|
-
name: string;
|
|
75
|
-
/**
|
|
76
|
-
* 所在文件夹链接
|
|
77
|
-
*
|
|
78
|
-
* Current folder link
|
|
79
|
-
*/
|
|
80
|
-
folder: string;
|
|
81
|
-
/**
|
|
82
|
-
* Emoji 通用路径前缀
|
|
83
|
-
*
|
|
84
|
-
* Common prefix of Emoji icons
|
|
85
|
-
*/
|
|
86
|
-
prefix?: string;
|
|
87
|
-
/**
|
|
88
|
-
* Emoji 图片的类型,会作为文件扩展名使用
|
|
89
|
-
*
|
|
90
|
-
* Type of Emoji icons, will be regarded as file extension
|
|
91
|
-
*/
|
|
92
|
-
type?: string;
|
|
93
|
-
/**
|
|
94
|
-
* 选项卡显示的 Emoji 图标
|
|
95
|
-
*
|
|
96
|
-
* Emoji icon show on tab
|
|
97
|
-
*/
|
|
98
|
-
icon: string;
|
|
99
|
-
/**
|
|
100
|
-
* Emoji 图片列表
|
|
101
|
-
*
|
|
102
|
-
* Emoji image list
|
|
103
|
-
*/
|
|
104
|
-
items: string[];
|
|
105
|
-
}
|
|
106
|
-
declare type EmojiMaps = Record<string, string>;
|
|
107
|
-
declare type Meta = 'nick' | 'mail' | 'link';
|
|
108
|
-
declare type UploadImage = (image: File) => Promise<string>;
|
|
109
|
-
declare type Highlighter = ((code: string, lang: string) => string) | ((code: string, lang: string, callback?: (error: unknown | undefined, code?: string) => void) => void);
|
|
110
|
-
declare type TexRenderer = (blockMode: boolean, tex: string) => string;
|
|
111
|
-
interface DeprecatedValineOptions {
|
|
112
|
-
/**
|
|
113
|
-
* @deprecated Use `locale.placeholder` instead, will be dropped in V2
|
|
114
|
-
*/
|
|
115
|
-
placeholder?: string;
|
|
116
|
-
/**
|
|
117
|
-
* @deprecated Use `locale` instead, will be dropped in V2
|
|
118
|
-
*/
|
|
119
|
-
langMode?: Locale;
|
|
120
|
-
/**
|
|
121
|
-
* @deprecated Use `requiredMeta` instead, will be dropped in V2
|
|
122
|
-
*/
|
|
123
|
-
requiredFields?: Meta[];
|
|
124
|
-
/**
|
|
125
|
-
* @deprecated Please use `AVATAR_PROXY` in server, will be dropped in V2
|
|
126
|
-
*
|
|
127
|
-
* [Gravatar](http://cn.gravatar.com/) 头像展示方式
|
|
128
|
-
*
|
|
129
|
-
* 可选值:
|
|
130
|
-
*
|
|
131
|
-
* - `''`
|
|
132
|
-
* - `'mp'`
|
|
133
|
-
* - `'identicon'`
|
|
134
|
-
* - `'monsterid'`
|
|
135
|
-
* - `'wavatar'`
|
|
136
|
-
* - `'retro'`
|
|
137
|
-
* - `'robohash'`
|
|
138
|
-
* - `'hide'`
|
|
139
|
-
*
|
|
140
|
-
* @see https://waline.js.org/client/avatar.html
|
|
141
|
-
*
|
|
142
|
-
* [Gravatar](http://gravatar.com/) type
|
|
143
|
-
*
|
|
144
|
-
* Optional value:
|
|
145
|
-
*
|
|
146
|
-
* - `''`
|
|
147
|
-
* - `'mp'`
|
|
148
|
-
* - `'identicon'`
|
|
149
|
-
* - `'monsterid'`
|
|
150
|
-
* - `'wavatar'`
|
|
151
|
-
* - `'retro'`
|
|
152
|
-
* - `'robohash'`
|
|
153
|
-
* - `'hide'`
|
|
154
|
-
*
|
|
155
|
-
* @see https://waline.js.org/en/client/avatar.html
|
|
156
|
-
*
|
|
157
|
-
* @default 'mp'
|
|
158
|
-
*/
|
|
159
|
-
avatar?: Avatar;
|
|
160
|
-
/**
|
|
161
|
-
* @deprecated Please use `AVATAR_PROXY` in server, will be dropped in V2
|
|
162
|
-
*
|
|
163
|
-
* 设置 Gravatar 头像 CDN 地址
|
|
164
|
-
*
|
|
165
|
-
* Gravatar CDN baseURL
|
|
166
|
-
*
|
|
167
|
-
* @default 'https://seccdn.libavatar.org/avatar/'
|
|
168
|
-
*/
|
|
169
|
-
avatarCDN?: string;
|
|
170
|
-
/**
|
|
171
|
-
* @deprecated This option is no longer needed with latest server, will be dropped in V2
|
|
172
|
-
*
|
|
173
|
-
* 每次访问是否**强制**拉取最新的*评论列表头像*
|
|
174
|
-
*
|
|
175
|
-
* Whether **force** pulling the latest avatar each time
|
|
176
|
-
*
|
|
177
|
-
* @default false
|
|
178
|
-
*/
|
|
179
|
-
avatarForce?: boolean;
|
|
180
|
-
/**
|
|
181
|
-
* @deprecated Please use mathjax in server, will be dropped in V2
|
|
182
|
-
*
|
|
183
|
-
* 是否注入额外的样式添加对 `<math>` 块的兼容
|
|
184
|
-
*
|
|
185
|
-
* Whether injecting additional styles to support math block
|
|
186
|
-
*
|
|
187
|
-
* @default false
|
|
188
|
-
*/
|
|
189
|
-
mathTagSupport?: boolean;
|
|
190
|
-
/**
|
|
191
|
-
* @deprecated Use `emojis` instead, will be dropped in V2
|
|
192
|
-
*
|
|
193
|
-
* 设置**表情包 CDN**
|
|
194
|
-
*
|
|
195
|
-
* @see [自定义表情包](https://waline.js.org/client/emoji.html)
|
|
196
|
-
*
|
|
197
|
-
* Set **Emoji Pack CDN**
|
|
198
|
-
*
|
|
199
|
-
* @see [Custom Emoji](https://waline.js.org/en/client/emoji.html)
|
|
200
|
-
*
|
|
201
|
-
* @default 'https://img.t.sinajs.cn/t4/appstyle/expression/ext/normal/'
|
|
202
|
-
*/
|
|
203
|
-
emojiCDN?: string;
|
|
204
|
-
/**
|
|
205
|
-
* @deprecated Use `emojis` instead, will be dropped in V2
|
|
206
|
-
*
|
|
207
|
-
* 设置**表情包映射**
|
|
208
|
-
*
|
|
209
|
-
* @see [自定义表情](https://waline.js.org/client/emoji.html)
|
|
210
|
-
*
|
|
211
|
-
* Set **emoji maps**
|
|
212
|
-
*
|
|
213
|
-
* @see [Custom Emoji](https://waline.js.org/en/client/emoji.html)
|
|
214
|
-
*
|
|
215
|
-
* @default 微博表情包
|
|
216
|
-
*/
|
|
217
|
-
emojiMaps?: EmojiMaps;
|
|
218
|
-
/**
|
|
219
|
-
* @deprecated Use `tex` instead
|
|
220
|
-
*
|
|
221
|
-
* 自定义 Tex 处理方法,用于预览。
|
|
222
|
-
*
|
|
223
|
-
* Custom math formula parse callback for preview.
|
|
224
|
-
*/
|
|
225
|
-
previewMath?: TexRenderer | false;
|
|
226
|
-
/**
|
|
227
|
-
* @deprecated Use `login` instead, will be dropped in V2
|
|
228
|
-
*
|
|
229
|
-
* 是否允许登录评论
|
|
230
|
-
*
|
|
231
|
-
* 默认情况是两者都支持,设置为 `true` 表示仅支持匿名评论,`false` 表示仅支持登录评论。
|
|
232
|
-
*
|
|
233
|
-
* Whether to allow login comments.
|
|
234
|
-
*
|
|
235
|
-
* Both supported by default, set to `true` means only support anonymous comments, `false` means only support login comments.
|
|
236
|
-
*
|
|
237
|
-
* @default undefined
|
|
238
|
-
*/
|
|
239
|
-
anonymous?: boolean;
|
|
240
|
-
}
|
|
241
|
-
interface WalineOptions extends DeprecatedValineOptions {
|
|
242
|
-
/**
|
|
243
|
-
* Waline 的初始化挂载器。必须是一个有效的 **CSS 选择器**
|
|
244
|
-
*
|
|
245
|
-
* The DOM element to be mounted on initialization. It must be a valid **CSS selector string**.
|
|
246
|
-
*/
|
|
247
|
-
el?: string | HTMLElement;
|
|
102
|
+
interface WalineProps {
|
|
248
103
|
/**
|
|
249
104
|
* Waline 的服务端地址
|
|
250
105
|
*
|
|
251
106
|
* Waline server address url
|
|
252
107
|
*/
|
|
253
108
|
serverURL: string;
|
|
254
|
-
/**
|
|
255
|
-
* 评论字数限制。填入单个数字时为最大字数限制
|
|
256
|
-
*
|
|
257
|
-
* @more 设置为 `0` 时无限制
|
|
258
|
-
*
|
|
259
|
-
* Comment word s limit. When a single number is filled in, it 's the maximum number of comment words.
|
|
260
|
-
*
|
|
261
|
-
* @more No limit when set to `0`.
|
|
262
|
-
*
|
|
263
|
-
* @default 0
|
|
264
|
-
*/
|
|
265
|
-
wordLimit?: number | [number, number];
|
|
266
109
|
/**
|
|
267
110
|
* 当前 _文章页_ 路径,用于区分不同的 _文章页_ ,以保证正确读取该 _文章页_ 下的评论列表
|
|
268
111
|
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
* - `window.location.pathname` (默认值,推荐)
|
|
272
|
-
* - `window.location.href`
|
|
273
|
-
* - 自定义
|
|
274
|
-
*
|
|
275
|
-
* > I. 请保证每个 _文章页_ 路径的唯一性,否则可能会出现不同 _文章页_ 下加载相同评论列表的情况。
|
|
276
|
-
* >
|
|
277
|
-
* > II. 如果值为 `window.location.href`,可能会出现随便加 _不同参数_ 进入该页面,而被判断成新页面的情况。
|
|
112
|
+
* 你可以将其设置为 `window.location.pathname`
|
|
278
113
|
*
|
|
279
114
|
* Article path id. Used to distinguish different _article pages_ to ensure loading the correct comment list under the _article page_.
|
|
280
115
|
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
* - `window.location.pathname` (default, recommended)
|
|
284
|
-
* - `window.location.href`
|
|
285
|
-
* - customize
|
|
286
|
-
*
|
|
287
|
-
* > I. Please ensure the uniqueness of each _article page_ path, otherwise the same comment list may be loaded under different _article pages_.
|
|
288
|
-
* >
|
|
289
|
-
* > II. If the value is `window.location.href`, it may appear that adding _different parameters_ to enter the page, and it will be judged as a new page.
|
|
290
|
-
*
|
|
291
|
-
* @default window.location.pathname
|
|
116
|
+
* You can set it to `window.location.pathname`
|
|
292
117
|
*/
|
|
293
|
-
path
|
|
118
|
+
path: string;
|
|
294
119
|
/**
|
|
295
120
|
* 评论者相关属性
|
|
296
121
|
*
|
|
@@ -302,7 +127,7 @@ interface WalineOptions extends DeprecatedValineOptions {
|
|
|
302
127
|
*
|
|
303
128
|
* @default ['nick', 'mail', 'link']
|
|
304
129
|
*/
|
|
305
|
-
meta?:
|
|
130
|
+
meta?: WalineMeta[];
|
|
306
131
|
/**
|
|
307
132
|
* 设置**必填项**,默认昵称为匿名
|
|
308
133
|
*
|
|
@@ -310,7 +135,19 @@ interface WalineOptions extends DeprecatedValineOptions {
|
|
|
310
135
|
*
|
|
311
136
|
* @default []
|
|
312
137
|
*/
|
|
313
|
-
requiredMeta?:
|
|
138
|
+
requiredMeta?: WalineMeta[];
|
|
139
|
+
/**
|
|
140
|
+
* 评论字数限制。填入单个数字时为最大字数限制
|
|
141
|
+
*
|
|
142
|
+
* @more 设置为 `0` 时无限制
|
|
143
|
+
*
|
|
144
|
+
* Comment word s limit. When a single number is filled in, it 's the maximum number of comment words.
|
|
145
|
+
*
|
|
146
|
+
* @more No limit when set to `0`.
|
|
147
|
+
*
|
|
148
|
+
* @default 0
|
|
149
|
+
*/
|
|
150
|
+
wordLimit?: number | [number, number];
|
|
314
151
|
/**
|
|
315
152
|
* 评论列表分页,每页条数
|
|
316
153
|
*
|
|
@@ -325,24 +162,42 @@ interface WalineOptions extends DeprecatedValineOptions {
|
|
|
325
162
|
* 可选值:
|
|
326
163
|
*
|
|
327
164
|
* - `'zh'`
|
|
165
|
+
* - `'zh-cn'`
|
|
328
166
|
* - `'zh-CN'`
|
|
167
|
+
* - `'zh-tw'`
|
|
329
168
|
* - `'zh-TW'`
|
|
330
169
|
* - `'en'`
|
|
331
170
|
* - `'en-US'`
|
|
171
|
+
* - `'en-us'`
|
|
332
172
|
* - `'jp'`
|
|
173
|
+
* - `'jp-jp'`
|
|
333
174
|
* - `'jp-JP'`
|
|
175
|
+
* - `'pt-br'`
|
|
176
|
+
* - `'pt-BR'`
|
|
177
|
+
* - `'ru'`
|
|
178
|
+
* - `'ru-ru'`
|
|
179
|
+
* - `'ru-RU'`
|
|
334
180
|
*
|
|
335
181
|
* Display language for waline
|
|
336
182
|
*
|
|
337
183
|
* Optional value:
|
|
338
184
|
*
|
|
339
185
|
* - `'zh'`
|
|
186
|
+
* - `'zh-cn'`
|
|
340
187
|
* - `'zh-CN'`
|
|
188
|
+
* - `'zh-tw'`
|
|
341
189
|
* - `'zh-TW'`
|
|
342
190
|
* - `'en'`
|
|
343
191
|
* - `'en-US'`
|
|
192
|
+
* - `'en-us'`
|
|
344
193
|
* - `'jp'`
|
|
194
|
+
* - `'jp-jp'`
|
|
345
195
|
* - `'jp-JP'`
|
|
196
|
+
* - `'pt-br'`
|
|
197
|
+
* - `'pt-BR'`
|
|
198
|
+
* - `'ru'`
|
|
199
|
+
* - `'ru-ru'`
|
|
200
|
+
* - `'ru-RU'`
|
|
346
201
|
*
|
|
347
202
|
* @default 'zh-CN'
|
|
348
203
|
*/
|
|
@@ -356,15 +211,7 @@ interface WalineOptions extends DeprecatedValineOptions {
|
|
|
356
211
|
*
|
|
357
212
|
* @see [I18n](https://waline.js.org/en/client/i18n.html)
|
|
358
213
|
*/
|
|
359
|
-
locale?: Partial<
|
|
360
|
-
/**
|
|
361
|
-
* 文章访问量统计
|
|
362
|
-
*
|
|
363
|
-
* Article reading statistics
|
|
364
|
-
*
|
|
365
|
-
* @default false
|
|
366
|
-
*/
|
|
367
|
-
visitor?: boolean;
|
|
214
|
+
locale?: Partial<WalineLocale>;
|
|
368
215
|
/**
|
|
369
216
|
* 是否启用暗黑模式适配
|
|
370
217
|
*
|
|
@@ -374,13 +221,7 @@ interface WalineOptions extends DeprecatedValineOptions {
|
|
|
374
221
|
*
|
|
375
222
|
* @more Setting `'auto'` will display darkmode due to device settings. Filling in CSS selector will enable darkmode only when the selector match waline ancestor nodes.
|
|
376
223
|
*/
|
|
377
|
-
dark?: string;
|
|
378
|
-
/**
|
|
379
|
-
* 代码高亮
|
|
380
|
-
*
|
|
381
|
-
* Code highlighting
|
|
382
|
-
*/
|
|
383
|
-
highlight?: Highlighter | false;
|
|
224
|
+
dark?: string | boolean;
|
|
384
225
|
/**
|
|
385
226
|
* 设置表情包
|
|
386
227
|
*
|
|
@@ -388,7 +229,13 @@ interface WalineOptions extends DeprecatedValineOptions {
|
|
|
388
229
|
*
|
|
389
230
|
* @default ['https://cdn.jsdelivr.net/gh/walinejs/emojis/weibo']
|
|
390
231
|
*/
|
|
391
|
-
emoji?: (string |
|
|
232
|
+
emoji?: (string | WalineEmojiInfo)[];
|
|
233
|
+
/**
|
|
234
|
+
* 代码高亮
|
|
235
|
+
*
|
|
236
|
+
* Code highlighting
|
|
237
|
+
*/
|
|
238
|
+
highlighter?: WalineHighlighter | false;
|
|
392
239
|
/**
|
|
393
240
|
* 自定义图片上传方法,方便更好的存储图片
|
|
394
241
|
*
|
|
@@ -398,13 +245,13 @@ interface WalineOptions extends DeprecatedValineOptions {
|
|
|
398
245
|
*
|
|
399
246
|
* We will pass a picture file object when execute it.
|
|
400
247
|
*/
|
|
401
|
-
|
|
248
|
+
imageUploader?: WalineImageUploader | false;
|
|
402
249
|
/**
|
|
403
250
|
* 自定义数学公式处理方法,用于预览。
|
|
404
251
|
*
|
|
405
252
|
* Custom math formula parse callback for preview.
|
|
406
253
|
*/
|
|
407
|
-
|
|
254
|
+
texRenderer?: WalineTexRenderer | false;
|
|
408
255
|
/**
|
|
409
256
|
*
|
|
410
257
|
* 登录模式状态,可选值:
|
|
@@ -436,22 +283,106 @@ interface WalineOptions extends DeprecatedValineOptions {
|
|
|
436
283
|
copyright?: boolean;
|
|
437
284
|
}
|
|
438
285
|
|
|
439
|
-
|
|
286
|
+
interface WalineInitOptions extends Omit<WalineProps, 'path'> {
|
|
287
|
+
/**
|
|
288
|
+
* Waline 的初始化挂载器。必须是一个**有效的** CSS 选择器 或 HTML 元素
|
|
289
|
+
*
|
|
290
|
+
* The DOM element to be mounted on initialization. It must be a **valid** CSS selector string or HTML Element.
|
|
291
|
+
*/
|
|
292
|
+
el?: string | HTMLElement | null;
|
|
293
|
+
/**
|
|
294
|
+
* 评论数统计
|
|
295
|
+
*
|
|
296
|
+
* Comment number support
|
|
297
|
+
*
|
|
298
|
+
* @default false
|
|
299
|
+
*/
|
|
300
|
+
comment?: string | boolean;
|
|
301
|
+
/**
|
|
302
|
+
* 页面访问量统计
|
|
303
|
+
*
|
|
304
|
+
* Pageview number support
|
|
305
|
+
*
|
|
306
|
+
* @default false
|
|
307
|
+
*/
|
|
308
|
+
pageview?: string | boolean;
|
|
309
|
+
/**
|
|
310
|
+
* 当前 _文章页_ 路径,用于区分不同的 _文章页_ ,以保证正确读取该 _文章页_ 下的评论列表
|
|
311
|
+
*
|
|
312
|
+
* 你可以将其设置为 `window.location.pathname`
|
|
313
|
+
*
|
|
314
|
+
* Article path id. Used to distinguish different _article pages_ to ensure loading the correct comment list under the _article page_.
|
|
315
|
+
*
|
|
316
|
+
* You can set it to `window.location.pathname`
|
|
317
|
+
*
|
|
318
|
+
* @default window.location.pathname
|
|
319
|
+
*/
|
|
320
|
+
path?: string;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
declare const getMeta: (meta: WalineMeta[]) => WalineMeta[];
|
|
324
|
+
declare const defaultLang = "zh-CN";
|
|
325
|
+
declare const defaultUploadImage: (file: File) => Promise<string>;
|
|
326
|
+
declare const defaultTexRenderer: (blockMode: boolean) => string;
|
|
440
327
|
|
|
441
|
-
|
|
442
|
-
|
|
328
|
+
declare type Locales = Record<string, WalineLocale>;
|
|
329
|
+
declare const locales: Locales;
|
|
330
|
+
|
|
331
|
+
interface CommentCountOptions {
|
|
332
|
+
serverURL: string;
|
|
333
|
+
selector?: string;
|
|
334
|
+
path?: string;
|
|
443
335
|
}
|
|
336
|
+
declare const commentCount: ({ serverURL, path, selector, }: CommentCountOptions) => (reason?: unknown) => void;
|
|
337
|
+
|
|
444
338
|
interface WalineInstance {
|
|
445
339
|
el: HTMLElement | null;
|
|
446
|
-
update:
|
|
340
|
+
update: (newOptions: Partial<WalineProps>) => void;
|
|
447
341
|
destroy: () => void;
|
|
448
342
|
}
|
|
449
|
-
declare
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
343
|
+
declare const init: ({ el, path, comment, pageview, ...initProps }: WalineInitOptions) => WalineInstance | null;
|
|
344
|
+
|
|
345
|
+
interface VisitorCountOptions {
|
|
346
|
+
/**
|
|
347
|
+
* Waline server url
|
|
348
|
+
*
|
|
349
|
+
* Waline 服务端地址
|
|
350
|
+
*/
|
|
351
|
+
serverURL: string;
|
|
352
|
+
/**
|
|
353
|
+
* Path to be fetched and updated
|
|
354
|
+
*
|
|
355
|
+
* 需要更新和获取的路径
|
|
356
|
+
*
|
|
357
|
+
* @default window.location.pathname
|
|
358
|
+
*/
|
|
359
|
+
path?: string;
|
|
360
|
+
/**
|
|
361
|
+
* @default '.waline-pageview-count'
|
|
362
|
+
*/
|
|
363
|
+
selector?: string;
|
|
364
|
+
/**
|
|
365
|
+
* Whether update pageviews when fetching path result
|
|
366
|
+
*
|
|
367
|
+
* 是否在查询时更新 path 的浏览量
|
|
368
|
+
*
|
|
369
|
+
* @default true
|
|
370
|
+
*/
|
|
371
|
+
update?: boolean;
|
|
372
|
+
}
|
|
373
|
+
declare const pageviewCount: ({ serverURL, path, selector, update, }: VisitorCountOptions) => (reason?: unknown) => void;
|
|
374
|
+
|
|
375
|
+
declare const version: string;
|
|
376
|
+
|
|
377
|
+
interface RecentCommentsOptions {
|
|
378
|
+
serverURL: string;
|
|
379
|
+
count: number;
|
|
380
|
+
el?: string | HTMLElement;
|
|
381
|
+
}
|
|
382
|
+
interface RecentCommentsResult {
|
|
383
|
+
comments: WalineComment[];
|
|
384
|
+
destroy: () => void;
|
|
455
385
|
}
|
|
386
|
+
declare const RecentComments: ({ el, serverURL, count, }: RecentCommentsOptions) => Promise<RecentCommentsResult>;
|
|
456
387
|
|
|
457
|
-
export {
|
|
388
|
+
export { CommentCountOptions, Locales, RecentComments, RecentCommentsOptions, RecentCommentsResult, VisitorCountOptions, WalineComment, WalineCommentData, WalineEmojiInfo, WalineEmojiMaps, WalineHighlighter, WalineImageUploader, WalineInitOptions, WalineInstance, WalineLocale, WalineMeta, WalineProps, WalineTexRenderer, commentCount, defaultLang, defaultTexRenderer, defaultUploadImage, getMeta, init, locales, pageviewCount, version };
|