@waline/client 3.13.0 → 3.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/waline.d.ts CHANGED
@@ -1,741 +1,1390 @@
1
- import { RecentCommentData, WalineUser } from '@waline/api';
2
- export * from '@waline/api';
3
-
1
+ //#region ../api/src/utils.d.ts
2
+ interface BaseAPIOptions {
3
+ /**
4
+ * Waline 服务端地址
5
+ *
6
+ * Waline serverURL
7
+ */
8
+ serverURL: string;
9
+ /**
10
+ * 错误信息所使用的语言
11
+ *
12
+ * Language used in error text
13
+ */
14
+ lang: string;
15
+ }
16
+ interface ErrorStatusResponse {
17
+ /**
18
+ * 错误代码
19
+ *
20
+ * Error number
21
+ */
22
+ errno: number;
23
+ /**
24
+ * 错误消息
25
+ *
26
+ * Error msg
27
+ */
28
+ errmsg: string;
29
+ }
30
+ //#endregion
31
+ //#region ../api/src/articleCounter.d.ts
32
+ interface GetArticleCounterOptions extends BaseAPIOptions {
33
+ /**
34
+ * 待获取计数器的 path
35
+ *
36
+ * Path of counters
37
+ */
38
+ paths: string[];
39
+ /**
40
+ * 待获取计数器的类型
41
+ *
42
+ * Counter type to be fetched
43
+ */
44
+ type: string[];
45
+ /**
46
+ * 取消请求的信号
47
+ *
48
+ * AbortSignal to cancel request
49
+ */
50
+ signal?: AbortSignal;
51
+ }
52
+ interface CounterFields {
53
+ time?: number;
54
+ reaction0?: number;
55
+ reaction1?: number;
56
+ reaction2?: number;
57
+ reaction3?: number;
58
+ reaction4?: number;
59
+ reaction5?: number;
60
+ reaction6?: number;
61
+ reaction7?: number;
62
+ reaction8?: number;
63
+ }
64
+ type GetArticleCounterResponseItem = Record<string, number> & CounterFields;
65
+ type GetArticleCounterResponse = GetArticleCounterResponseItem[];
66
+ declare const getArticleCounter: ({
67
+ serverURL,
68
+ lang,
69
+ paths,
70
+ type,
71
+ signal
72
+ }: GetArticleCounterOptions) => Promise<GetArticleCounterResponse>;
73
+ interface UpdateArticleCounterOptions extends BaseAPIOptions {
74
+ /**
75
+ * 待更新计数器的 path
76
+ *
77
+ * Path of counter to be updated
78
+ */
79
+ path: string;
80
+ /**
81
+ * 待更新计数器的类型
82
+ *
83
+ * Counter type to be updated
84
+ */
85
+ type: string;
86
+ /**
87
+ * 更新操作
88
+ *
89
+ * Update operation
90
+ *
91
+ * @default 'inc'
92
+ */
93
+ action?: 'inc' | 'desc';
94
+ }
95
+ declare const updateArticleCounter: ({
96
+ serverURL,
97
+ lang,
98
+ path,
99
+ type,
100
+ action
101
+ }: UpdateArticleCounterOptions) => Promise<GetArticleCounterResponse>;
102
+ //#endregion
103
+ //#region ../api/src/typings.d.ts
104
+ type WalineCommentStatus = 'approved' | 'waiting' | 'spam';
105
+ type WalineUserType = 'administrator' | 'guest';
106
+ interface WalineCommentData {
107
+ /** User Nickname */
108
+ nick: string;
109
+ /** User email */
110
+ mail?: string;
111
+ /** User link */
112
+ link?: string;
113
+ /** Content of comment */
114
+ comment: string;
115
+ /** User Agent */
116
+ ua: string;
117
+ /** Comment page path */
118
+ url: string;
119
+ /**
120
+ * Parent comment id
121
+ *
122
+ * Only available when replying comment
123
+ */
124
+ pid?: number;
125
+ /**
126
+ * Root comment id
127
+ *
128
+ * Only available when replying comment
129
+ */
130
+ rid?: number;
131
+ /**
132
+ * User id being at
133
+ *
134
+ * Only available when replying comment
135
+ */
136
+ at?: string;
137
+ /** Recaptcha Token */
138
+ recaptchaV3?: string;
139
+ /** Turnstile Token */
140
+ turnstile?: string;
141
+ }
142
+ interface BaseWalineResponseComment {
143
+ /** Comment object ID */
144
+ objectId: number;
145
+ /** Timestamp of the comment */
146
+ time: number;
147
+ /** Content of comment */
148
+ comment: string;
149
+ /**
150
+ * Original comment content
151
+ *
152
+ * 原始评论内容
153
+ */
154
+ orig: string;
155
+ /**
156
+ * Comment like number
157
+ *
158
+ * 评论喜欢数
159
+ */
160
+ like: number;
161
+ /** User Nickname */
162
+ nick: string;
163
+ /** User link */
164
+ link: string;
165
+ /** User avatar */
166
+ avatar: string;
167
+ /**
168
+ * User type
169
+ *
170
+ * Only available with logged in user 用户类型
171
+ *
172
+ * 仅在登录用户时可用
173
+ */
174
+ type?: WalineUserType;
175
+ /**
176
+ * User ID
177
+ *
178
+ * Only available with logged in user 用户 ID
179
+ *
180
+ * 仅在登录用户时可用
181
+ */
182
+ user_id?: number;
183
+ /**
184
+ * User location
185
+ *
186
+ * Not available with `DISABLE_REGION=true` 用户位置
187
+ *
188
+ * `DISABLE_REGION=true` 时不可用
189
+ */
190
+ addr?: string;
191
+ /**
192
+ * User browser
193
+ *
194
+ * Not available with `DISABLE_USERAGENT=true` 用户浏览器
195
+ *
196
+ * `DISABLE_USERAGENT=true` 时不可用
197
+ */
198
+ browser?: string;
199
+ /**
200
+ * User location
201
+ *
202
+ * Not available with `DISABLE_USERAGENT=true` 用户位置
203
+ *
204
+ * `DISABLE_USERAGENT=true` 时不可用
205
+ */
206
+ os?: string;
207
+ /**
208
+ * User level
209
+ *
210
+ * Only available when `LEVELS` is set 用户等级
211
+ *
212
+ * 仅在 `LEVELS` 设置时可用
213
+ */
214
+ level?: number;
215
+ /**
216
+ * User label
217
+ *
218
+ * 用户标签
219
+ */
220
+ label?: string;
221
+ /**
222
+ * Comment status
223
+ *
224
+ * For administrators, `approved` `spam` `waiting` can be get, for others, the only value is
225
+ * `approved` 评论状态
226
+ *
227
+ * 管理员可获得 `approved`、`spam` 和 `waiting`,其他用户只能获得 `approved`
228
+ */
229
+ status?: WalineCommentStatus;
230
+ }
231
+ interface WalineChildComment extends BaseWalineResponseComment {
232
+ /** Parent comment id */
233
+ pid: number;
234
+ /** Root comment id */
235
+ rid: number;
236
+ /** User id being at */
237
+ at?: string;
238
+ /** Reply user information */
239
+ reply_user?: {
240
+ nick: string;
241
+ link: string;
242
+ avatar: string;
243
+ };
244
+ }
245
+ interface WalineRootComment extends BaseWalineResponseComment {
246
+ /**
247
+ * Whether the comment is sticky
248
+ *
249
+ * 是否置顶
250
+ */
251
+ sticky: boolean;
252
+ /**
253
+ * Child comments
254
+ *
255
+ * 子评论
256
+ */
257
+ children: WalineChildComment[];
258
+ }
259
+ type WalineComment = WalineRootComment | WalineChildComment;
260
+ //#endregion
261
+ //#region ../api/src/comment.d.ts
262
+ interface GetCommentOptions extends BaseAPIOptions {
263
+ /**
264
+ * 待获取评论列表的 path
265
+ *
266
+ * Path of comment list
267
+ */
268
+ path: string;
269
+ /**
270
+ * 评论分页数
271
+ *
272
+ * Comment pagination number
273
+ */
274
+ page: number;
275
+ /**
276
+ * 每页评论个数
277
+ *
278
+ * Comment number per page
279
+ */
280
+ pageSize: number;
281
+ /**
282
+ * 排序方式
283
+ *
284
+ * Sort method
285
+ */
286
+ sortBy: string;
287
+ /**
288
+ * 用户令牌
289
+ *
290
+ * User token
291
+ */
292
+ token?: string;
293
+ /**
294
+ * 取消请求的信号
295
+ *
296
+ * AbortSignal to cancel request
297
+ */
298
+ signal?: AbortSignal;
299
+ }
300
+ interface GetCommentResponse {
301
+ /**
302
+ * 评论数量
303
+ *
304
+ * Comment number
305
+ */
306
+ count: number;
307
+ /**
308
+ * 评论分页数
309
+ *
310
+ * Comment pagination number
311
+ */
312
+ page: number;
313
+ /**
314
+ * 每页评论个数
315
+ *
316
+ * Comment number per page
317
+ */
318
+ pageSize: number;
319
+ /**
320
+ * 评论数据
321
+ *
322
+ * Comment Data
323
+ */
324
+ data: WalineRootComment[];
325
+ /**
326
+ * 页面总数
327
+ *
328
+ * Page number
329
+ */
330
+ totalPages: number;
331
+ }
332
+ declare const getComment: ({
333
+ serverURL,
334
+ lang,
335
+ path,
336
+ page,
337
+ pageSize,
338
+ sortBy,
339
+ signal,
340
+ token
341
+ }: GetCommentOptions) => Promise<GetCommentResponse>;
342
+ interface AddCommentOptions extends BaseAPIOptions {
343
+ /**
344
+ * 用户令牌
345
+ *
346
+ * User token
347
+ */
348
+ token?: string;
349
+ /**
350
+ * 用户待提交的评论数据
351
+ *
352
+ * Comment data being submitted by user
353
+ */
354
+ comment: WalineCommentData;
355
+ }
356
+ interface AddCommentResponse extends ErrorStatusResponse {
357
+ /**
358
+ * 渲染好的评论数据
359
+ *
360
+ * Comment data rendered
361
+ */
362
+ data?: WalineComment;
363
+ }
364
+ declare const addComment: ({
365
+ serverURL,
366
+ lang,
367
+ token,
368
+ comment
369
+ }: AddCommentOptions) => Promise<AddCommentResponse>;
370
+ interface DeleteCommentOptions extends BaseAPIOptions {
371
+ /**
372
+ * Auth token
373
+ *
374
+ * 认证令牌
375
+ */
376
+ token: string;
377
+ /**
378
+ * Comment objectId to be deleted
379
+ *
380
+ * 待删除的评论对象 ID
381
+ */
382
+ objectId: number;
383
+ }
384
+ interface DeleteCommentResponse extends ErrorStatusResponse {
385
+ data: '';
386
+ }
387
+ declare const deleteComment: ({
388
+ serverURL,
389
+ lang,
390
+ token,
391
+ objectId
392
+ }: DeleteCommentOptions) => Promise<DeleteCommentResponse>;
393
+ interface UpdateWalineCommentData extends Partial<WalineCommentData> {
394
+ /**
395
+ * 点赞还是取消点赞
396
+ *
397
+ * Like or dislike
398
+ */
399
+ like?: boolean;
400
+ /**
401
+ * 评论的状态
402
+ *
403
+ * Comment status
404
+ */
405
+ status?: 'approved' | 'waiting' | 'spam';
406
+ /**
407
+ * 评论指定状态
408
+ *
409
+ * Comment sticky status
410
+ *
411
+ * 0 means not sticky and 1 means sticky
412
+ */
413
+ sticky?: 0 | 1;
414
+ }
415
+ interface UpdateCommentOptions extends BaseAPIOptions {
416
+ /**
417
+ * 用户令牌
418
+ *
419
+ * User token
420
+ */
421
+ token: string;
422
+ /**
423
+ * 评论的 ID
424
+ *
425
+ * Comment ID
426
+ */
427
+ objectId: number;
428
+ /**
429
+ * 评论数据
430
+ *
431
+ * Comment data
432
+ */
433
+ comment?: UpdateWalineCommentData;
434
+ }
435
+ interface UpdateCommentResponse extends ErrorStatusResponse {
436
+ /**
437
+ * 更新后的评论数据
438
+ *
439
+ * Comment data rendered
440
+ */
441
+ data: WalineComment;
442
+ }
443
+ declare const updateComment: ({
444
+ serverURL,
445
+ lang,
446
+ token,
447
+ objectId,
448
+ comment
449
+ }: UpdateCommentOptions) => Promise<UpdateCommentResponse>;
450
+ //#endregion
451
+ //#region ../api/src/commentCount.d.ts
452
+ interface GetCommentCountOptions extends BaseAPIOptions {
453
+ /**
454
+ * 待获取评论数的 path
455
+ *
456
+ * Path of pages to be fetched
457
+ */
458
+ paths: string[];
459
+ /**
460
+ * 取消请求的信号
461
+ *
462
+ * AbortSignal to cancel request
463
+ */
464
+ signal?: AbortSignal;
465
+ }
466
+ declare const fetchCommentCount: ({
467
+ serverURL,
468
+ lang,
469
+ paths,
470
+ signal
471
+ }: GetCommentCountOptions) => Promise<number[]>;
472
+ //#endregion
473
+ //#region ../api/src/login.d.ts
474
+ interface UserInfo {
475
+ /**
476
+ * 显示姓名
477
+ *
478
+ * User name displayed
479
+ */
480
+ display_name: string;
481
+ /**
482
+ * 用户电子邮件地址
483
+ *
484
+ * User email
485
+ */
486
+ email: string;
487
+ /**
488
+ * 用户网站地址
489
+ *
490
+ * User website
491
+ */
492
+ url: string;
493
+ /**
494
+ * 用户令牌
495
+ *
496
+ * User token
497
+ */
498
+ token: string;
499
+ /**
500
+ * 用户头像
501
+ *
502
+ * User avatar
503
+ */
504
+ avatar: string;
505
+ /**
506
+ * 用户对象 ID
507
+ *
508
+ * User object ID
509
+ */
510
+ objectId: number;
511
+ /**
512
+ * 用户身份
513
+ *
514
+ * User role
515
+ */
516
+ type: 'administrator' | 'guest';
517
+ }
518
+ declare const login: ({
519
+ lang,
520
+ serverURL
521
+ }: BaseAPIOptions) => Promise<UserInfo & {
522
+ remember: boolean;
523
+ }>;
524
+ //#endregion
525
+ //#region ../api/src/pageview.d.ts
526
+ interface GetPageviewOptions extends BaseAPIOptions {
527
+ /**
528
+ * 待获取页面的 path
529
+ *
530
+ * Path of pages
531
+ */
532
+ paths: string[];
533
+ /**
534
+ * 取消请求的信号
535
+ *
536
+ * AbortSignal to cancel request
537
+ */
538
+ signal?: AbortSignal;
539
+ }
540
+ declare const getPageview: ({
541
+ serverURL,
542
+ lang,
543
+ paths,
544
+ signal
545
+ }: GetPageviewOptions) => Promise<GetArticleCounterResponse>;
546
+ interface UpdatePageviewOptions extends BaseAPIOptions {
547
+ /**
548
+ * 待更新页面的 path
549
+ *
550
+ * Path of pages
551
+ */
552
+ path: string;
553
+ }
554
+ declare const updatePageview: (options: UpdatePageviewOptions) => Promise<GetArticleCounterResponse>;
555
+ //#endregion
556
+ //#region ../api/src/recentComment.d.ts
557
+ interface GetRecentCommentOptions extends BaseAPIOptions {
558
+ /**
559
+ * 获取评论的数量
560
+ *
561
+ * Comment number to be fetched
562
+ */
563
+ count: number;
564
+ /**
565
+ * 取消请求的信号
566
+ *
567
+ * AbortSignal to cancel request
568
+ */
569
+ signal?: AbortSignal;
570
+ /**
571
+ * 用户令牌
572
+ *
573
+ * User token
574
+ */
575
+ token?: string;
576
+ }
577
+ interface RecentCommentData extends BaseWalineResponseComment {
578
+ /**
579
+ * Page url where comment locales
580
+ *
581
+ * 评论所在页面地址
582
+ */
583
+ url: string;
584
+ }
585
+ declare const getRecentComment: ({
586
+ serverURL,
587
+ lang,
588
+ count,
589
+ signal,
590
+ token
591
+ }: GetRecentCommentOptions) => Promise<RecentCommentData[]>;
592
+ //#endregion
593
+ //#region ../api/src/user.d.ts
594
+ interface GetUserListOptions extends BaseAPIOptions {
595
+ /**
596
+ * 每页个数
597
+ *
598
+ * Number per page
599
+ */
600
+ pageSize: number;
601
+ /**
602
+ * 取消请求的信号
603
+ *
604
+ * AbortSignal to cancel request
605
+ */
606
+ signal?: AbortSignal;
607
+ }
608
+ interface WalineUser extends Pick<WalineComment, 'nick' | 'link' | 'avatar' | 'label' | 'level'> {
609
+ count: number;
610
+ }
611
+ interface GetUserListResponse extends ErrorStatusResponse {
612
+ data: WalineUser[];
613
+ }
614
+ declare const getUserList: ({
615
+ serverURL,
616
+ signal,
617
+ pageSize,
618
+ lang
619
+ }: GetUserListOptions) => Promise<WalineUser[]>;
620
+ //#endregion
621
+ //#region src/typings/base.d.ts
4
622
  type WalineCommentSorting = 'latest' | 'oldest' | 'hottest';
5
623
  type WalineEmojiPresets = `//${string}` | `http://${string}` | `https://${string}`;
6
624
  interface WalineEmojiInfo {
7
- /**
8
- * 选项卡上的 Emoji 名称
9
- *
10
- * Emoji name show on tab
11
- */
12
- name: string;
13
- /**
14
- * 所在文件夹链接
15
- *
16
- * Current folder link
17
- */
18
- folder?: string;
19
- /**
20
- * Emoji 通用路径前缀
21
- *
22
- * Common prefix of Emoji icons
23
- */
24
- prefix?: string;
25
- /**
26
- * Emoji 图片的类型,会作为文件扩展名使用
27
- *
28
- * Type of Emoji icons, will be regarded as file extension
29
- */
30
- type?: string;
31
- /**
32
- * 选项卡显示的 Emoji 图标
33
- *
34
- * Emoji icon show on tab
35
- */
36
- icon: string;
37
- /**
38
- * Emoji 图片列表
39
- *
40
- * Emoji image list
41
- */
42
- items: string[];
625
+ /**
626
+ * 选项卡上的 Emoji 名称
627
+ *
628
+ * Emoji name show on tab
629
+ */
630
+ name: string;
631
+ /**
632
+ * 所在文件夹链接
633
+ *
634
+ * Current folder link
635
+ */
636
+ folder?: string;
637
+ /**
638
+ * Emoji 通用路径前缀
639
+ *
640
+ * Common prefix of Emoji icons
641
+ */
642
+ prefix?: string;
643
+ /**
644
+ * Emoji 图片的类型,会作为文件扩展名使用
645
+ *
646
+ * Type of Emoji icons, will be regarded as file extension
647
+ */
648
+ type?: string;
649
+ /**
650
+ * 选项卡显示的 Emoji 图标
651
+ *
652
+ * Emoji icon show on tab
653
+ */
654
+ icon: string;
655
+ /**
656
+ * Emoji 图片列表
657
+ *
658
+ * Emoji image list
659
+ */
660
+ items: string[];
43
661
  }
44
662
  type WalineEmojiMaps = Record<string, string>;
45
663
  type WalineLoginStatus = 'enable' | 'disable' | 'force';
46
664
  interface WalineSearchImageData extends Record<string, unknown> {
47
- /**
48
- * 图片链接
49
- *
50
- * Image link
51
- */
52
- src: string;
53
- /**
54
- * 图片标题
55
- *
56
- * @description 用于图片的 alt 属性
57
- *
58
- * Image title
59
- *
60
- * @description Used for alt attribute of image
61
- */
62
- title?: string;
63
- /**
64
- * 图片缩略图
65
- *
66
- * @description 为了更好的加载性能,我们会优先在列表中使用此缩略图
67
- *
68
- * Image preview link
69
- *
70
- * @description For better loading performance, we will use this thumbnail first in the list
71
- *
72
- * @default src
73
- */
74
- preview?: string;
665
+ /**
666
+ * 图片链接
667
+ *
668
+ * Image link
669
+ */
670
+ src: string;
671
+ /**
672
+ * 图片标题
673
+ *
674
+ * 用于图片的 alt 属性
675
+ *
676
+ * Image title
677
+ *
678
+ * Used for alt attribute of image
679
+ */
680
+ title?: string;
681
+ /**
682
+ * 图片缩略图
683
+ *
684
+ * 为了更好的加载性能,我们会优先在列表中使用此缩略图
685
+ *
686
+ * Image preview link
687
+ *
688
+ * For better loading performance, we will use this thumbnail first in the list
689
+ *
690
+ * @default src
691
+ */
692
+ preview?: string;
75
693
  }
76
694
  type WalineSearchResult = WalineSearchImageData[];
77
695
  interface WalineSearchOptions {
78
- /**
79
- * 搜索操作
80
- *
81
- * Search action
82
- */
83
- search: (word: string) => Promise<WalineSearchResult>;
84
- /**
85
- * 打开列表时展示的默认结果
86
- *
87
- * Default result when opening list
88
- *
89
- * @default () => search('')
90
- */
91
- default?: () => Promise<WalineSearchResult>;
92
- /**
93
- * 获取更多的操作
94
- *
95
- * @description 会在列表滚动到底部时触发,如果你的搜索服务支持分页功能,你应该设置此项实现无限滚动
96
- *
97
- * Fetch more action
98
- *
99
- * @description It will be triggered when the list scrolls to the bottom. If your search service supports paging, you should set this to achieve infinite scrolling
100
- *
101
- * @default (word) => search(word)
102
- */
103
- more?: (word: string, currentCount: number) => Promise<WalineSearchResult>;
696
+ /**
697
+ * 搜索操作
698
+ *
699
+ * Search action
700
+ */
701
+ search: (word: string) => Promise<WalineSearchResult>;
702
+ /**
703
+ * 打开列表时展示的默认结果
704
+ *
705
+ * Default result when opening list
706
+ *
707
+ * @default () => search('')
708
+ */
709
+ default?: () => Promise<WalineSearchResult>;
710
+ /**
711
+ * 获取更多的操作
712
+ *
713
+ * 会在列表滚动到底部时触发,如果你的搜索服务支持分页功能,你应该设置此项实现无限滚动
714
+ *
715
+ * Fetch more action
716
+ *
717
+ * It will be triggered when the list scrolls to the bottom. If your search service supports
718
+ * paging, you should set this to achieve infinite scrolling
719
+ *
720
+ * @default (word) => search(word)
721
+ */
722
+ more?: (word: string, currentCount: number) => Promise<WalineSearchResult>;
104
723
  }
105
724
  type WalineMeta = 'nick' | 'mail' | 'link';
106
725
  type WalineImageUploader = (image: File) => Promise<string>;
107
726
  type WalineHighlighter = (code: string, lang: string) => string;
108
727
  type WalineTeXRenderer = (blockMode: boolean, tex: string) => string;
109
-
728
+ //#endregion
729
+ //#region src/typings/locale.d.ts
110
730
  interface WalineDateLocale {
111
- seconds: string;
112
- minutes: string;
113
- hours: string;
114
- days: string;
115
- now: string;
731
+ seconds: string;
732
+ minutes: string;
733
+ hours: string;
734
+ days: string;
735
+ now: string;
116
736
  }
117
737
  type WalineLevelLocale = Record<`level${number}`, string>;
118
738
  interface WalineReactionLocale {
119
- reactionTitle: string;
120
- reaction0: string;
121
- reaction1: string;
122
- reaction2: string;
123
- reaction3: string;
124
- reaction4: string;
125
- reaction5: string;
126
- reaction6: string;
127
- reaction7: string;
128
- reaction8: string;
739
+ reactionTitle: string;
740
+ reaction0: string;
741
+ reaction1: string;
742
+ reaction2: string;
743
+ reaction3: string;
744
+ reaction4: string;
745
+ reaction5: string;
746
+ reaction6: string;
747
+ reaction7: string;
748
+ reaction8: string;
129
749
  }
130
750
  interface WalineLocale extends WalineDateLocale, WalineLevelLocale, WalineReactionLocale {
131
- nick: string;
132
- mail: string;
133
- link: string;
134
- optional: string;
135
- placeholder: string;
136
- sofa: string;
137
- submit: string;
138
- comment: string;
139
- refresh: string;
140
- more: string;
141
- uploading: string;
142
- login: string;
143
- admin: string;
144
- sticky: string;
145
- word: string;
146
- anonymous: string;
147
- gif: string;
148
- gifSearchPlaceholder: string;
149
- approved: string;
150
- waiting: string;
151
- spam: string;
152
- unsticky: string;
153
- oldest: string;
154
- latest: string;
155
- hottest: string;
156
- nickError: string;
157
- mailError: string;
158
- wordHint: string;
159
- like: string;
160
- cancelLike: string;
161
- reply: string;
162
- cancelReply: string;
163
- preview: string;
164
- emoji: string;
165
- uploadImage: string;
166
- profile: string;
167
- logout: string;
168
- commentUnderReview: string;
169
- subPostComment: string;
170
- subSiteComment: string;
171
- subscribeToReplies: string;
172
- }
173
-
751
+ nick: string;
752
+ mail: string;
753
+ link: string;
754
+ optional: string;
755
+ placeholder: string;
756
+ sofa: string;
757
+ submit: string;
758
+ comment: string;
759
+ refresh: string;
760
+ more: string;
761
+ uploading: string;
762
+ login: string;
763
+ admin: string;
764
+ sticky: string;
765
+ word: string;
766
+ anonymous: string;
767
+ gif: string;
768
+ gifSearchPlaceholder: string; // manage
769
+ approved: string;
770
+ waiting: string;
771
+ spam: string;
772
+ unsticky: string; // sorting
773
+ oldest: string;
774
+ latest: string;
775
+ hottest: string; // hint
776
+ nickError: string;
777
+ mailError: string;
778
+ wordHint: string; // i18n
779
+ like: string;
780
+ cancelLike: string;
781
+ reply: string;
782
+ cancelReply: string;
783
+ preview: string;
784
+ emoji: string;
785
+ uploadImage: string;
786
+ profile: string;
787
+ logout: string;
788
+ commentUnderReview: string;
789
+ subPostComment: string;
790
+ subSiteComment: string;
791
+ subscribeToReplies: string;
792
+ }
793
+ //#endregion
794
+ //#region src/typings/waline.d.ts
174
795
  interface WalineProps {
175
- /**
176
- * Waline 的服务端地址
177
- *
178
- * Waline server address url
179
- */
180
- serverURL: string;
181
- /**
182
- * 当前 _文章页_ 路径,用于区分不同的 _文章页_ ,以保证正确读取该 _文章页_ 下的评论列表
183
- *
184
- * 你可以将其设置为 `window.location.pathname`
185
- *
186
- * Article path id. Used to distinguish different _article pages_ to ensure loading the correct comment list under the _article page_.
187
- *
188
- * You can set it to `window.location.pathname`
189
- */
190
- path: string;
191
- /**
192
- * 评论者相关属性
193
- *
194
- * `Meta` 可选值: `'nick'`, `'mail'`, `'link'`
195
- *
196
- * Reviewer attributes.
197
- *
198
- * Optional values for `Meta`: `'nick'`, `'mail'`, `'link'`
199
- *
200
- * @default ['nick', 'mail', 'link']
201
- */
202
- meta?: WalineMeta[];
203
- /**
204
- * 设置**必填项**,默认昵称为匿名
205
- *
206
- * Set required fields, default anonymous with nickname
207
- *
208
- * @default []
209
- */
210
- requiredMeta?: WalineMeta[];
211
- /**
212
- * 评论字数限制。填入单个数字时为最大字数限制
213
- *
214
- * @description 设置为 `0` 时无限制
215
- *
216
- * Comment word s limit. When a single number is filled in, it 's the maximum number of comment words.
217
- *
218
- * @description No limit when set to `0`.
219
- *
220
- * @default 0
221
- */
222
- wordLimit?: number | [number, number];
223
- /**
224
- * 评论列表分页,每页条数
225
- *
226
- * number of pages per page
227
- *
228
- * @default 10
229
- */
230
- pageSize?: number;
231
- /**
232
- * Waline 显示语言
233
- *
234
- * 可选值:
235
- *
236
- * - `'zh'`
237
- * - `'zh-cn'`
238
- * - `'zh-CN'`
239
- * - `'zh-tw'`
240
- * - `'zh-TW'`
241
- * - `'en'`
242
- * - `'en-US'`
243
- * - `'en-us'`
244
- * - `'jp'`
245
- * - `'jp-jp'`
246
- * - `'jp-JP'`
247
- * - `'pt-br'`
248
- * - `'pt-BR'`
249
- * - `'ru'`
250
- * - `'ru-ru'`
251
- * - `'ru-RU'`
252
- * - `'fr-FR'`
253
- * - `'fr'`
254
- *
255
- * Display language for waline
256
- *
257
- * Optional value:
258
- *
259
- * - `'zh'`
260
- * - `'zh-cn'`
261
- * - `'zh-CN'`
262
- * - `'zh-tw'`
263
- * - `'zh-TW'`
264
- * - `'en'`
265
- * - `'en-US'`
266
- * - `'en-us'`
267
- * - `'jp'`
268
- * - `'jp-jp'`
269
- * - `'jp-JP'`
270
- * - `'pt-br'`
271
- * - `'pt-BR'`
272
- * - `'ru'`
273
- * - `'ru-ru'`
274
- * - `'ru-RU'`
275
- * - `'fr-FR'`
276
- * - `'fr'`
277
- *
278
- * @default navigator.language
279
- */
280
- lang?: string;
281
- /**
282
- * 自定义 waline 语言显示
283
- *
284
- * @see [自定义语言](https://waline.js.org/client/i18n.html)
285
- *
286
- * Custom display language in waline
287
- *
288
- * @see [I18n](https://waline.js.org/en/client/i18n.html)
289
- */
290
- locale?: Partial<WalineLocale>;
291
- /**
292
- * 评论列表排序方式
293
- *
294
- * Sorting method for comment list
295
- *
296
- * @default 'latest'
297
- */
298
- commentSorting?: WalineCommentSorting;
299
- /**
300
- * 是否启用暗黑模式适配
301
- *
302
- * @description 设置 `'auto'` 会根据设备暗黑模式自适应。填入 CSS 选择器会在对应选择器生效时启用夜间模式。
303
- *
304
- * Whether to enable darkmode support
305
- *
306
- * @description Setting `'auto'` will display darkmode due to device settings. Filling in CSS selector will enable darkmode only when the selector match waline ancestor nodes.
307
- */
308
- dark?: string | boolean;
309
- /**
310
- *
311
- * 登录模式状态,可选值:
312
- *
313
- * - `'enable'`: 启用登录 (默认)
314
- * - `'disable'`: 禁用登录,用户只能填写信息评论
315
- * - `'force'`: 强制登录,用户必须注册并登录才可发布评论
316
- *
317
- * Login mode status, optional values:
318
- *
319
- * - `'enable'`: enable login (default)
320
- * - `'disable'`: Login is disabled, users should fill in information to comment
321
- * - `'force'`: Forced login, users must login to comment
322
- *
323
- * @default 'enable'
324
- */
325
- login?: WalineLoginStatus;
326
- /**
327
- * 是否在页脚隐藏版权信息
328
- *
329
- * 为了支持 Waline,我们强烈建议你开启它
330
- *
331
- * Whether hide copyright in footer
332
- *
333
- * We strongly recommended you to keep it on to support waline
334
- *
335
- */
336
- noCopyright?: boolean;
337
- /**
338
- * 是否隐藏 RSS 订阅入口
339
- *
340
- * Whether to hide RSS subscription links
341
- *
342
- * @default false
343
- */
344
- noRss?: boolean;
345
- /**
346
- * recaptcha v3 客户端 key
347
- *
348
- * recaptcha v3 client key
349
- */
350
- recaptchaV3Key?: string;
351
- /**
352
- * turnstile 客户端 key
353
- *
354
- * turnstile client key
355
- */
356
- turnstileKey?: string;
357
- /**
358
- * 文章反应
359
- *
360
- * Article reaction
361
- *
362
- * @default false
363
- */
364
- reaction?: string[] | boolean;
365
- /**
366
- * 设置表情包
367
- *
368
- * Set Emojis
369
- *
370
- * @default ['//unpkg.com/@waline/emojis@1.1.0/weibo']
371
- */
372
- emoji?: (WalineEmojiInfo | WalineEmojiPresets)[];
373
- /**
374
- * 设置搜索功能
375
- *
376
- * Customize Search feature
377
- */
378
- search?: WalineSearchOptions;
379
- /**
380
- * 代码块高亮器
381
- *
382
- * Code fence highlighter
383
- */
384
- highlighter?: WalineHighlighter;
385
- /**
386
- * 自定义图片上传方法,方便更好的存储图片
387
- *
388
- * 方法执行时会将图片对象传入。
389
- *
390
- * Custom image upload callback to manage picture by yourself.
391
- *
392
- * We will pass a picture file object when execute it.
393
- */
394
- imageUploader?: WalineImageUploader;
395
- /**
396
- * 自定义数学公式处理方法,用于预览。
397
- *
398
- * Custom math formula parse callback for preview.
399
- */
400
- texRenderer?: WalineTeXRenderer;
401
- }
402
-
796
+ /**
797
+ * Waline 的服务端地址
798
+ *
799
+ * Waline server address url
800
+ */
801
+ serverURL: string;
802
+ /**
803
+ * 当前 _文章页_ 路径,用于区分不同的 _文章页_ ,以保证正确读取该 _文章页_ 下的评论列表
804
+ *
805
+ * 你可以将其设置为 `window.location.pathname`
806
+ *
807
+ * Article path id. Used to distinguish different _article pages_ to ensure loading the correct
808
+ * comment list under the _article page_.
809
+ *
810
+ * You can set it to `window.location.pathname`
811
+ */
812
+ path: string;
813
+ /**
814
+ * 评论者相关属性
815
+ *
816
+ * `Meta` 可选值: `'nick'`, `'mail'`, `'link'`
817
+ *
818
+ * Reviewer attributes.
819
+ *
820
+ * Optional values for `Meta`: `'nick'`, `'mail'`, `'link'`
821
+ *
822
+ * @default ['nick', 'mail', 'link']
823
+ */
824
+ meta?: WalineMeta[];
825
+ /**
826
+ * 设置**必填项**,默认昵称为匿名
827
+ *
828
+ * Set required fields, default anonymous with nickname
829
+ *
830
+ * @default [ ]
831
+ */
832
+ requiredMeta?: WalineMeta[];
833
+ /**
834
+ * 评论字数限制。填入单个数字时为最大字数限制
835
+ *
836
+ * 设置为 `0` 时无限制
837
+ *
838
+ * Comment word s limit. When a single number is filled in, it 's the maximum number of comment
839
+ * words.
840
+ *
841
+ * No limit when set to `0`.
842
+ *
843
+ * @default 0
844
+ */
845
+ wordLimit?: number | [number, number];
846
+ /**
847
+ * 评论列表分页,每页条数
848
+ *
849
+ * Number of pages per page
850
+ *
851
+ * @default 10
852
+ */
853
+ pageSize?: number;
854
+ /**
855
+ * Waline 显示语言
856
+ *
857
+ * 可选值:
858
+ *
859
+ * - `'zh'`
860
+ * - `'zh-cn'`
861
+ * - `'zh-CN'`
862
+ * - `'zh-tw'`
863
+ * - `'zh-TW'`
864
+ * - `'en'`
865
+ * - `'en-US'`
866
+ * - `'en-us'`
867
+ * - `'jp'`
868
+ * - `'jp-jp'`
869
+ * - `'jp-JP'`
870
+ * - `'pt-br'`
871
+ * - `'pt-BR'`
872
+ * - `'ru'`
873
+ * - `'ru-ru'`
874
+ * - `'ru-RU'`
875
+ * - `'fr-FR'`
876
+ * - `'fr'`
877
+ *
878
+ * Display language for waline
879
+ *
880
+ * Optional value:
881
+ *
882
+ * - `'zh'`
883
+ * - `'zh-cn'`
884
+ * - `'zh-CN'`
885
+ * - `'zh-tw'`
886
+ * - `'zh-TW'`
887
+ * - `'en'`
888
+ * - `'en-US'`
889
+ * - `'en-us'`
890
+ * - `'jp'`
891
+ * - `'jp-jp'`
892
+ * - `'jp-JP'`
893
+ * - `'pt-br'`
894
+ * - `'pt-BR'`
895
+ * - `'ru'`
896
+ * - `'ru-ru'`
897
+ * - `'ru-RU'`
898
+ * - `'fr-FR'`
899
+ * - `'fr'`
900
+ *
901
+ * @default navigator.language
902
+ */
903
+ lang?: string;
904
+ /**
905
+ * 自定义 waline 语言显示
906
+ *
907
+ * @see [自定义语言](https://waline.js.org/client/i18n.html)
908
+ *
909
+ * Custom display language in waline
910
+ * @see [I18n](https://waline.js.org/en/client/i18n.html)
911
+ */
912
+ locale?: Partial<WalineLocale>;
913
+ /**
914
+ * 评论列表排序方式
915
+ *
916
+ * Sorting method for comment list
917
+ *
918
+ * @default 'latest'
919
+ */
920
+ commentSorting?: WalineCommentSorting;
921
+ /**
922
+ * 是否启用暗黑模式适配
923
+ *
924
+ * 设置 `'auto'` 会根据设备暗黑模式自适应。填入 CSS 选择器会在对应选择器生效时启用夜间模式。
925
+ *
926
+ * Whether to enable darkmode support
927
+ *
928
+ * Setting `'auto'` will display darkmode due to device settings. Filling in CSS selector will
929
+ * enable darkmode only when the selector match waline ancestor nodes.
930
+ */
931
+ dark?: string | boolean;
932
+ /**
933
+ * 登录模式状态,可选值:
934
+ *
935
+ * - `'enable'`: 启用登录 (默认)
936
+ * - `'disable'`: 禁用登录,用户只能填写信息评论
937
+ * - `'force'`: 强制登录,用户必须注册并登录才可发布评论
938
+ *
939
+ * Login mode status, optional values:
940
+ *
941
+ * - `'enable'`: enable login (default)
942
+ * - `'disable'`: Login is disabled, users should fill in information to comment
943
+ * - `'force'`: Forced login, users must login to comment
944
+ *
945
+ * @default 'enable'
946
+ */
947
+ login?: WalineLoginStatus;
948
+ /**
949
+ * 是否在页脚隐藏版权信息
950
+ *
951
+ * 为了支持 Waline,我们强烈建议你开启它
952
+ *
953
+ * Whether hide copyright in footer
954
+ *
955
+ * We strongly recommended you to keep it on to support waline
956
+ */
957
+ noCopyright?: boolean;
958
+ /**
959
+ * 是否隐藏 RSS 订阅入口
960
+ *
961
+ * Whether to hide RSS subscription links
962
+ *
963
+ * @default false
964
+ */
965
+ noRss?: boolean;
966
+ /**
967
+ * Recaptcha v3 客户端 key
968
+ *
969
+ * Recaptcha v3 client key
970
+ */
971
+ recaptchaV3Key?: string;
972
+ /**
973
+ * Turnstile 客户端 key
974
+ *
975
+ * Turnstile client key
976
+ */
977
+ turnstileKey?: string;
978
+ /**
979
+ * 文章反应
980
+ *
981
+ * Article reaction
982
+ *
983
+ * @default false
984
+ */
985
+ reaction?: string[] | boolean;
986
+ /**
987
+ * 设置表情包
988
+ *
989
+ * Set Emojis
990
+ *
991
+ * @default ['//unpkg.com/@waline/emojis@1.1.0/weibo']
992
+ */
993
+ emoji?: (WalineEmojiInfo | WalineEmojiPresets)[];
994
+ /**
995
+ * 设置搜索功能
996
+ *
997
+ * Customize Search feature
998
+ */
999
+ search?: WalineSearchOptions | boolean;
1000
+ /**
1001
+ * 代码块高亮器
1002
+ *
1003
+ * Code fence highlighter
1004
+ */
1005
+ highlighter?: WalineHighlighter;
1006
+ /**
1007
+ * 自定义图片上传方法,方便更好的存储图片
1008
+ *
1009
+ * 方法执行时会将图片对象传入。
1010
+ *
1011
+ * Custom image upload callback to manage picture by yourself.
1012
+ *
1013
+ * We will pass a picture file object when execute it.
1014
+ */
1015
+ imageUploader?: WalineImageUploader;
1016
+ /**
1017
+ * 自定义数学公式处理方法,用于预览。
1018
+ *
1019
+ * Custom math formula parse callback for preview.
1020
+ */
1021
+ texRenderer?: WalineTeXRenderer;
1022
+ }
1023
+ //#endregion
1024
+ //#region src/typings/options.d.ts
403
1025
  interface WalineInitOptions extends Omit<WalineProps, 'path' | 'emoji' | 'search' | 'highlighter' | 'imageUploader' | 'texRenderer'> {
404
- /**
405
- * Waline 的初始化挂载器。必须是一个**有效的** CSS 选择器 或 HTML 元素
406
- *
407
- * The DOM element to be mounted on initialization. It must be a **valid** CSS selector string or HTML Element.
408
- */
409
- el?: string | HTMLElement | null;
410
- /**
411
- * 评论数统计
412
- *
413
- * Comment number support
414
- *
415
- * @default true
416
- */
417
- comment?: string | boolean;
418
- /**
419
- * 页面访问量统计
420
- *
421
- * Pageview number support
422
- *
423
- * @default true
424
- */
425
- pageview?: string | boolean;
426
- /**
427
- * 当前 _文章页_ 路径,用于区分不同的 _文章页_ ,以保证正确读取该 _文章页_ 下的评论列表
428
- *
429
- * 你可以将其设置为 `window.location.pathname`
430
- *
431
- * Article path id. Used to distinguish different _article pages_ to ensure loading the correct comment list under the _article page_.
432
- *
433
- * You can set it to `window.location.pathname`
434
- *
435
- * @default window.location.pathname
436
- */
437
- path?: string;
438
- /**
439
- * 设置表情包
440
- *
441
- * Set Emojis
442
- *
443
- * @default ['//unpkg.com/@waline/emojis@1.1.0/weibo']
444
- */
445
- emoji?: (WalineEmojiInfo | WalineEmojiPresets)[] | boolean;
446
- /**
447
- * 设置搜索功能
448
- *
449
- * Customize Search feature
450
- *
451
- * @default true
452
- */
453
- search?: WalineSearchOptions | boolean;
454
- /**
455
- * 代码高亮
456
- *
457
- * Code highlighting
458
- *
459
- * @default true
460
- */
461
- highlighter?: WalineHighlighter | boolean;
462
- /**
463
- * 自定义图片上传方法,方便更好的存储图片
464
- *
465
- * 方法执行时会将图片对象传入。
466
- *
467
- * Custom image upload callback to manage picture by yourself.
468
- *
469
- * We will pass a picture file object when execute it.
470
- *
471
- * @default true
472
- */
473
- imageUploader?: WalineImageUploader | boolean;
474
- /**
475
- * 自定义数学公式处理方法,用于预览。
476
- *
477
- * Custom math formula parse callback for preview.
478
- *
479
- * @default true
480
- */
481
- texRenderer?: WalineTeXRenderer | boolean;
1026
+ /**
1027
+ * Waline 的初始化挂载器。必须是一个**有效的** CSS 选择器 或 HTML 元素
1028
+ *
1029
+ * The DOM element to be mounted on initialization. It must be a **valid** CSS selector string or
1030
+ * HTML Element.
1031
+ */
1032
+ el?: string | HTMLElement | null;
1033
+ /**
1034
+ * 评论数统计
1035
+ *
1036
+ * Comment number support
1037
+ *
1038
+ * @default true
1039
+ */
1040
+ comment?: string | boolean;
1041
+ /**
1042
+ * 页面访问量统计
1043
+ *
1044
+ * Pageview number support
1045
+ *
1046
+ * @default true
1047
+ */
1048
+ pageview?: string | boolean;
1049
+ /**
1050
+ * 当前 _文章页_ 路径,用于区分不同的 _文章页_ ,以保证正确读取该 _文章页_ 下的评论列表
1051
+ *
1052
+ * 你可以将其设置为 `window.location.pathname`
1053
+ *
1054
+ * Article path id. Used to distinguish different _article pages_ to ensure loading the correct
1055
+ * comment list under the _article page_.
1056
+ *
1057
+ * You can set it to `window.location.pathname`
1058
+ *
1059
+ * @default window.location.pathname
1060
+ */
1061
+ path?: string;
1062
+ /**
1063
+ * 设置表情包
1064
+ *
1065
+ * Set Emojis
1066
+ *
1067
+ * @default ['//unpkg.com/@waline/emojis@1.1.0/weibo']
1068
+ */
1069
+ emoji?: (WalineEmojiInfo | WalineEmojiPresets)[] | boolean;
1070
+ /**
1071
+ * 设置搜索功能
1072
+ *
1073
+ * Customize Search feature
1074
+ *
1075
+ * @default true
1076
+ */
1077
+ search?: WalineSearchOptions | boolean;
1078
+ /**
1079
+ * 代码高亮
1080
+ *
1081
+ * Code highlighting
1082
+ *
1083
+ * @default true
1084
+ */
1085
+ highlighter?: WalineHighlighter | boolean;
1086
+ /**
1087
+ * 自定义图片上传方法,方便更好的存储图片
1088
+ *
1089
+ * 方法执行时会将图片对象传入。
1090
+ *
1091
+ * Custom image upload callback to manage picture by yourself.
1092
+ *
1093
+ * We will pass a picture file object when execute it.
1094
+ *
1095
+ * @default true
1096
+ */
1097
+ imageUploader?: WalineImageUploader | boolean;
1098
+ /**
1099
+ * 自定义数学公式处理方法,用于预览。
1100
+ *
1101
+ * Custom math formula parse callback for preview.
1102
+ *
1103
+ * @default true
1104
+ */
1105
+ texRenderer?: WalineTeXRenderer | boolean;
482
1106
  }
1107
+ // oxlint-disable-next-line typescript/explicit-module-boundary-types, typescript/no-explicit-any
483
1108
  type WalineAbort = (reason?: any) => void;
484
-
1109
+ //#endregion
1110
+ //#region src/config/i18n/index.d.ts
485
1111
  type Locales = Record<string, WalineLocale>;
486
1112
  declare const DEFAULT_LOCALES: Locales;
487
-
1113
+ //#endregion
1114
+ //#region src/comment.d.ts
488
1115
  interface WalineCommentCountOptions {
489
- /**
490
- * Waline 服务端地址
491
- *
492
- * Waline server url
493
- */
494
- serverURL: string;
495
- /**
496
- * 评论数 CSS 选择器
497
- *
498
- * Comment count CSS selector
499
- *
500
- * @default '.waline-comment-count'
501
- */
502
- selector?: string;
503
- /**
504
- * 需要获取的默认路径
505
- *
506
- * Path to be fetched by default
507
- *
508
- * @default window.location.pathname
509
- */
510
- path?: string;
511
- /**
512
- * 错误提示消息所使用的语言
513
- *
514
- * Language of error message
515
- *
516
- * @default navigator.language
517
- */
518
- lang?: string;
519
- }
520
- declare const commentCount: ({ serverURL, path, selector, lang, }: WalineCommentCountOptions) => WalineAbort;
521
-
1116
+ /**
1117
+ * Waline 服务端地址
1118
+ *
1119
+ * Waline server url
1120
+ */
1121
+ serverURL: string;
1122
+ /**
1123
+ * 评论数 CSS 选择器
1124
+ *
1125
+ * Comment count CSS selector
1126
+ *
1127
+ * @default '.waline-comment-count'
1128
+ */
1129
+ selector?: string;
1130
+ /**
1131
+ * 需要获取的默认路径
1132
+ *
1133
+ * Path to be fetched by default
1134
+ *
1135
+ * @default window.location.pathname
1136
+ */
1137
+ path?: string;
1138
+ /**
1139
+ * 错误提示消息所使用的语言
1140
+ *
1141
+ * Language of error message
1142
+ *
1143
+ * @default navigator.language
1144
+ */
1145
+ lang?: string;
1146
+ }
1147
+ declare const commentCount: ({
1148
+ serverURL,
1149
+ path,
1150
+ selector,
1151
+ lang
1152
+ }: WalineCommentCountOptions) => WalineAbort;
1153
+ //#endregion
1154
+ //#region src/init.d.ts
522
1155
  interface WalineInstance {
523
- /**
524
- * Waline 被挂载到的元素
525
- *
526
- * @description 当通过 `el: null` 初始化,值为 `null`
527
- *
528
- * Element where Waline is mounted
529
- *
530
- * @description when initialized with `el: null`, it will be `null`
531
- */
532
- el: HTMLElement | null;
533
- /**
534
- * 更新 Waline 实例
535
- *
536
- * @description 只要不设置`path` 选项,更新时它就会被重置为 `windows.location.pathname`
537
- *
538
- * Update Waline instance
539
- *
540
- * @description when not setting `path` option, it will be reset to `window.location.pathname`
541
- */
542
- update: (newOptions?: Partial<Omit<WalineInitOptions, 'el'>>) => void;
543
- /**
544
- * 取消挂载并摧毁 Waline 实例
545
- *
546
- * Unmount and destroy Waline instance
547
- */
548
- destroy: () => void;
549
- }
550
- declare const init: ({ el, path, comment, pageview, ...initProps }: WalineInitOptions) => WalineInstance | null;
551
-
1156
+ /**
1157
+ * Waline 被挂载到的元素
1158
+ *
1159
+ * 当通过 `el: null` 初始化,值为 `null` Element where Waline is mounted
1160
+ *
1161
+ * When initialized with `el: null`, it will be `null`
1162
+ */
1163
+ el: HTMLElement | null;
1164
+ /**
1165
+ * 更新 Waline 实例
1166
+ *
1167
+ * 只要不设置`path` 选项,更新时它就会被重置为 `windows.location.pathname` Update Waline instance
1168
+ *
1169
+ * When not setting `path` option, it will be reset to `window.location.pathname`
1170
+ */
1171
+ update: (newOptions?: Partial<Omit<WalineInitOptions, 'el'>>) => void;
1172
+ /**
1173
+ * 取消挂载并摧毁 Waline 实例
1174
+ *
1175
+ * Unmount and destroy Waline instance
1176
+ */
1177
+ destroy: () => void;
1178
+ }
1179
+ declare const init: ({
1180
+ el,
1181
+ path,
1182
+ comment,
1183
+ pageview,
1184
+ ...initProps
1185
+ }: WalineInitOptions) => WalineInstance | null;
1186
+ //#endregion
1187
+ //#region src/pageview.d.ts
552
1188
  interface WalinePageviewCountOptions {
553
- /**
554
- * Waline 服务端地址
555
- *
556
- * Waline server url
557
- */
558
- serverURL: string;
559
- /**
560
- * 浏览量 CSS 选择器
561
- *
562
- * Pageview CSS selector
563
- *
564
- * @default '.waline-pageview-count'
565
- */
566
- selector?: string;
567
- /**
568
- * 需要更新和获取的路径
569
- *
570
- * Path to be fetched and updated
571
- *
572
- * @default window.location.pathname
573
- */
574
- path?: string;
575
- /**
576
- * 是否在查询时更新 path 的浏览量
577
- *
578
- * Whether update pageviews when fetching path result
579
- *
580
- * @default true
581
- */
582
- update?: boolean;
583
- /**
584
- * 错误提示消息所使用的语言
585
- *
586
- * Language of error message
587
- *
588
- * @default navigator.language
589
- */
590
- lang?: string;
591
- }
592
- declare const pageviewCount: ({ serverURL, path, selector, update, lang, }: WalinePageviewCountOptions) => WalineAbort;
593
-
1189
+ /**
1190
+ * Waline 服务端地址
1191
+ *
1192
+ * Waline server url
1193
+ */
1194
+ serverURL: string;
1195
+ /**
1196
+ * 浏览量 CSS 选择器
1197
+ *
1198
+ * Pageview CSS selector
1199
+ *
1200
+ * @default '.waline-pageview-count'
1201
+ */
1202
+ selector?: string;
1203
+ /**
1204
+ * 需要更新和获取的路径
1205
+ *
1206
+ * Path to be fetched and updated
1207
+ *
1208
+ * @default window.location.pathname
1209
+ */
1210
+ path?: string;
1211
+ /**
1212
+ * 是否在查询时更新 path 的浏览量
1213
+ *
1214
+ * Whether update pageviews when fetching path result
1215
+ *
1216
+ * @default true
1217
+ */
1218
+ update?: boolean;
1219
+ /**
1220
+ * 错误提示消息所使用的语言
1221
+ *
1222
+ * Language of error message
1223
+ *
1224
+ * @default navigator.language
1225
+ */
1226
+ lang?: string;
1227
+ }
1228
+ declare const pageviewCount: ({
1229
+ serverURL,
1230
+ path,
1231
+ selector,
1232
+ update,
1233
+ lang
1234
+ }: WalinePageviewCountOptions) => WalineAbort;
1235
+ //#endregion
1236
+ //#region src/version.d.ts
594
1237
  declare const version: string;
595
-
1238
+ //#endregion
1239
+ //#region src/widgets/recentComments.d.ts
596
1240
  interface WalineRecentCommentsOptions {
597
- /**
598
- * Waline 服务端地址
599
- *
600
- * Waline serverURL
601
- */
602
- serverURL: string;
603
- /**
604
- * 获取最新评论的数量
605
- *
606
- * fetch number of latest comments
607
- */
608
- count: number;
609
- /**
610
- * 需要挂载的元素
611
- *
612
- * Element to be mounted
613
- */
614
- el?: string | HTMLElement;
615
- /**
616
- * 错误提示消息所使用的语言
617
- *
618
- * Language of error message
619
- *
620
- * @default navigator.language
621
- */
622
- lang?: string;
1241
+ /**
1242
+ * Waline 服务端地址
1243
+ *
1244
+ * Waline serverURL
1245
+ */
1246
+ serverURL: string;
1247
+ /**
1248
+ * 获取最新评论的数量
1249
+ *
1250
+ * Fetch number of latest comments
1251
+ */
1252
+ count: number;
1253
+ /**
1254
+ * 需要挂载的元素
1255
+ *
1256
+ * Element to be mounted
1257
+ */
1258
+ el?: string | HTMLElement;
1259
+ /**
1260
+ * 错误提示消息所使用的语言
1261
+ *
1262
+ * Language of error message
1263
+ *
1264
+ * @default navigator.language
1265
+ */
1266
+ lang?: string;
623
1267
  }
624
1268
  interface WalineRecentCommentsResult {
625
- /**
626
- * 评论数据
627
- *
628
- * Comment Data
629
- */
630
- comments: RecentCommentData[];
631
- /**
632
- * 取消挂载挂件
633
- *
634
- * Umount widget
635
- */
636
- destroy: () => void;
637
- }
638
- declare const RecentComments: ({ el, serverURL, count, lang, }: WalineRecentCommentsOptions) => Promise<WalineRecentCommentsResult>;
639
-
1269
+ /**
1270
+ * 评论数据
1271
+ *
1272
+ * Comment Data
1273
+ */
1274
+ comments: RecentCommentData[];
1275
+ /**
1276
+ * 取消挂载挂件
1277
+ *
1278
+ * Umount widget
1279
+ */
1280
+ destroy: () => void;
1281
+ }
1282
+ declare const RecentComments: ({
1283
+ el,
1284
+ serverURL,
1285
+ count,
1286
+ lang
1287
+ }: WalineRecentCommentsOptions) => Promise<WalineRecentCommentsResult>;
1288
+ //#endregion
1289
+ //#region src/widgets/userList.d.ts
640
1290
  interface WalineUserListOptions {
641
- /**
642
- * Waline 服务端地址
643
- *
644
- * Waline serverURL
645
- */
646
- serverURL: string;
647
- /**
648
- * 获取用户列表的数量
649
- *
650
- * fetch number of user list
651
- */
652
- count: number;
653
- /**
654
- * 需要挂载的元素
655
- *
656
- * Element to be mounted
657
- */
658
- el?: string | HTMLElement;
659
- /**
660
- * 错误提示消息所使用的语言
661
- *
662
- * Language of error message
663
- *
664
- * @default navigator.language
665
- */
666
- lang?: string;
667
- /**
668
- * 自定义 waline 语言显示
669
- *
670
- * @see [自定义语言](https://waline.js.org/client/i18n.html)
671
- *
672
- * Custom display language in waline
673
- *
674
- * @see [I18n](https://waline.js.org/en/client/i18n.html)
675
- */
676
- locale?: WalineLocale;
677
- /**
678
- * 列表模式还是头像墙模式
679
- *
680
- * list mode or avatar wall mode
681
- *
682
- * @default 'list'
683
- */
684
- mode?: 'list' | 'wall';
1291
+ /**
1292
+ * Waline 服务端地址
1293
+ *
1294
+ * Waline serverURL
1295
+ */
1296
+ serverURL: string;
1297
+ /**
1298
+ * 获取用户列表的数量
1299
+ *
1300
+ * Fetch number of user list
1301
+ */
1302
+ count: number;
1303
+ /**
1304
+ * 需要挂载的元素
1305
+ *
1306
+ * Element to be mounted
1307
+ */
1308
+ el?: string | HTMLElement;
1309
+ /**
1310
+ * 错误提示消息所使用的语言
1311
+ *
1312
+ * Language of error message
1313
+ *
1314
+ * @default navigator.language
1315
+ */
1316
+ lang?: string;
1317
+ /**
1318
+ * 自定义 waline 语言显示
1319
+ *
1320
+ * @see [自定义语言](https://waline.js.org/client/i18n.html)
1321
+ *
1322
+ * Custom display language in waline
1323
+ * @see [I18n](https://waline.js.org/en/client/i18n.html)
1324
+ */
1325
+ locale?: WalineLocale;
1326
+ /**
1327
+ * 列表模式还是头像墙模式
1328
+ *
1329
+ * List mode or avatar wall mode
1330
+ *
1331
+ * @default 'list'
1332
+ */
1333
+ mode?: 'list' | 'wall';
685
1334
  }
686
1335
  interface WalineUserListResult {
687
- /**
688
- * 用户数据
689
- *
690
- * User Data
691
- */
692
- users: WalineUser[];
693
- /**
694
- * 取消挂载挂件
695
- *
696
- * Umount widget
697
- */
698
- destroy: () => void;
699
- }
700
- declare const UserList: ({ el, serverURL, count, locale, lang, mode, }: WalineUserListOptions) => Promise<WalineUserListResult>;
701
-
702
- /**
703
- * Options for the star rating widget.
704
- */
1336
+ /**
1337
+ * 用户数据
1338
+ *
1339
+ * User Data
1340
+ */
1341
+ users: WalineUser[];
1342
+ /**
1343
+ * 取消挂载挂件
1344
+ *
1345
+ * Umount widget
1346
+ */
1347
+ destroy: () => void;
1348
+ }
1349
+ declare const UserList: ({
1350
+ el,
1351
+ serverURL,
1352
+ count,
1353
+ locale,
1354
+ lang,
1355
+ mode
1356
+ }: WalineUserListOptions) => Promise<WalineUserListResult>;
1357
+ //#endregion
1358
+ //#region src/widgets/star/index.d.ts
1359
+ /** Options for the star rating widget. */
705
1360
  interface WalineStarOptions {
706
- /**
707
- * Element or CSS selector on which to mount the widget.
708
- */
709
- el?: string | HTMLElement;
710
- /**
711
- * Path identifying the current page or article.
712
- */
713
- path: string;
714
- /**
715
- * Language code used by the widget, such as `en` or `zh-CN`.
716
- */
717
- lang?: string;
718
- /**
719
- * Waline server URL.
720
- */
721
- serverURL: string;
722
- /**
723
- * Callback invoked after the user submits a rating.
724
- *
725
- * @param score The score selected by the user.
726
- */
727
- onRate?: (score: number) => void;
728
- }
729
- /**
730
- * Star widget result.
731
- */
1361
+ /** Element or CSS selector on which to mount the widget. */
1362
+ el?: string | HTMLElement;
1363
+ /** Path identifying the current page or article. */
1364
+ path: string;
1365
+ /** Language code used by the widget, such as `en` or `zh-CN`. */
1366
+ lang?: string;
1367
+ /** Waline server URL. */
1368
+ serverURL: string;
1369
+ /**
1370
+ * Callback invoked after the user submits a rating.
1371
+ *
1372
+ * @param score The score selected by the user.
1373
+ */
1374
+ onRate?: (score: number) => void;
1375
+ }
1376
+ /** Star widget result. */
732
1377
  interface WalineStarResult {
733
- /**
734
- * Destroy star widget instance.
735
- */
736
- destroy: () => void;
737
- }
738
- declare const Star: ({ el, path, lang, serverURL, onRate, }: WalineStarOptions) => WalineStarResult;
739
-
740
- export { RecentComments, Star, UserList, commentCount, DEFAULT_LOCALES as defaultLocales, init, pageviewCount, version };
741
- export type { WalineAbort, WalineCommentCountOptions, WalineCommentSorting, WalineDateLocale, WalineEmojiInfo, WalineEmojiMaps, WalineEmojiPresets, WalineHighlighter, WalineImageUploader, WalineInitOptions, WalineInstance, WalineLevelLocale, WalineLocale, WalineLoginStatus, WalineMeta, WalinePageviewCountOptions, WalineProps, WalineReactionLocale, WalineRecentCommentsOptions, WalineRecentCommentsResult, WalineSearchImageData, WalineSearchOptions, WalineSearchResult, WalineStarOptions, WalineStarResult, WalineTeXRenderer, WalineUserListOptions, WalineUserListResult };
1378
+ /** Destroy star widget instance. */
1379
+ destroy: () => void;
1380
+ }
1381
+ declare const Star: ({
1382
+ el,
1383
+ path,
1384
+ lang,
1385
+ serverURL,
1386
+ onRate
1387
+ }: WalineStarOptions) => WalineStarResult;
1388
+ //#endregion
1389
+ export { AddCommentOptions, AddCommentResponse, type BaseWalineResponseComment, CounterFields, DeleteCommentOptions, DeleteCommentResponse, GetArticleCounterOptions, GetArticleCounterResponse, GetArticleCounterResponseItem, GetCommentCountOptions, GetCommentOptions, GetCommentResponse, GetRecentCommentOptions, GetUserListOptions, GetUserListResponse, RecentCommentData, RecentComments, Star, UpdateArticleCounterOptions, UpdateCommentOptions, UpdateCommentResponse, UpdatePageviewOptions, UserInfo, UserList, type WalineAbort, type WalineChildComment, type WalineComment, WalineCommentCountOptions, type WalineCommentData, type WalineCommentSorting, type WalineCommentStatus, type WalineDateLocale, type WalineEmojiInfo, type WalineEmojiMaps, type WalineEmojiPresets, type WalineHighlighter, type WalineImageUploader, type WalineInitOptions, WalineInstance, type WalineLevelLocale, type WalineLocale, type WalineLoginStatus, type WalineMeta, WalinePageviewCountOptions, type WalineProps, type WalineReactionLocale, WalineRecentCommentsOptions, WalineRecentCommentsResult, type WalineRootComment, type WalineSearchImageData, type WalineSearchOptions, type WalineSearchResult, WalineStarOptions, WalineStarResult, type WalineTeXRenderer, WalineUser, WalineUserListOptions, WalineUserListResult, type WalineUserType, addComment, commentCount, DEFAULT_LOCALES as defaultLocales, deleteComment, fetchCommentCount, getArticleCounter, getComment, getPageview, getRecentComment, getUserList, init, login, pageviewCount, updateArticleCounter, updateComment, updatePageview, version };
1390
+ //# sourceMappingURL=waline.d.ts.map