@waline/client 2.15.2 → 2.15.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/package.json +15 -11
  2. package/src/composables/turnstile.ts +3 -0
  3. package/dist/api.cjs +0 -2
  4. package/dist/api.cjs.map +0 -1
  5. package/dist/api.d.cts +0 -445
  6. package/dist/api.d.mts +0 -445
  7. package/dist/api.d.ts +0 -445
  8. package/dist/api.mjs +0 -2
  9. package/dist/api.mjs.map +0 -1
  10. package/dist/comment.cjs +0 -2
  11. package/dist/comment.cjs.map +0 -1
  12. package/dist/comment.d.cts +0 -39
  13. package/dist/comment.d.mts +0 -39
  14. package/dist/comment.d.ts +0 -39
  15. package/dist/comment.js +0 -2
  16. package/dist/comment.js.map +0 -1
  17. package/dist/comment.mjs +0 -2
  18. package/dist/comment.mjs.map +0 -1
  19. package/dist/component.mjs +0 -2
  20. package/dist/component.mjs.map +0 -1
  21. package/dist/legacy.umd.d.ts +0 -628
  22. package/dist/legacy.umd.js +0 -2
  23. package/dist/legacy.umd.js.map +0 -1
  24. package/dist/pageview.cjs +0 -2
  25. package/dist/pageview.cjs.map +0 -1
  26. package/dist/pageview.d.cts +0 -47
  27. package/dist/pageview.d.mts +0 -47
  28. package/dist/pageview.d.ts +0 -47
  29. package/dist/pageview.js +0 -2
  30. package/dist/pageview.js.map +0 -1
  31. package/dist/pageview.mjs +0 -2
  32. package/dist/pageview.mjs.map +0 -1
  33. package/dist/shim.cjs +0 -2
  34. package/dist/shim.cjs.map +0 -1
  35. package/dist/shim.d.cts +0 -718
  36. package/dist/shim.d.mts +0 -718
  37. package/dist/shim.mjs +0 -2
  38. package/dist/shim.mjs.map +0 -1
  39. package/dist/waline-meta.css +0 -1
  40. package/dist/waline-meta.css.map +0 -1
  41. package/dist/waline.cjs +0 -2
  42. package/dist/waline.cjs.map +0 -1
  43. package/dist/waline.css +0 -1
  44. package/dist/waline.css.map +0 -1
  45. package/dist/waline.d.cts +0 -718
  46. package/dist/waline.d.mts +0 -718
  47. package/dist/waline.d.ts +0 -718
  48. package/dist/waline.js +0 -2
  49. package/dist/waline.js.map +0 -1
  50. package/dist/waline.mjs +0 -2
  51. package/dist/waline.mjs.map +0 -1
package/dist/waline.d.mts DELETED
@@ -1,718 +0,0 @@
1
- type WalineCommentSorting = 'latest' | 'oldest' | 'hottest';
2
- type WalineEmojiPresets = `//${string}` | `http://${string}` | `https://${string}`;
3
- interface WalineEmojiInfo {
4
- /**
5
- * 选项卡上的 Emoji 名称
6
- *
7
- * Emoji name show on tab
8
- */
9
- name: string;
10
- /**
11
- * 所在文件夹链接
12
- *
13
- * Current folder link
14
- */
15
- folder?: string;
16
- /**
17
- * Emoji 通用路径前缀
18
- *
19
- * Common prefix of Emoji icons
20
- */
21
- prefix?: string;
22
- /**
23
- * Emoji 图片的类型,会作为文件扩展名使用
24
- *
25
- * Type of Emoji icons, will be regarded as file extension
26
- */
27
- type?: string;
28
- /**
29
- * 选项卡显示的 Emoji 图标
30
- *
31
- * Emoji icon show on tab
32
- */
33
- icon: string;
34
- /**
35
- * Emoji 图片列表
36
- *
37
- * Emoji image list
38
- */
39
- items: string[];
40
- }
41
- type WalineEmojiMaps = Record<string, string>;
42
- type WalineLoginStatus = 'enable' | 'disable' | 'force';
43
- interface WalineSearchImageData extends Record<string, unknown> {
44
- /**
45
- * 图片链接
46
- *
47
- * Image link
48
- */
49
- src: string;
50
- /**
51
- * 图片标题
52
- *
53
- * @description 用于图片的 alt 属性
54
- *
55
- * Image title
56
- *
57
- * @description Used for alt attribute of image
58
- */
59
- title?: string;
60
- /**
61
- * 图片缩略图
62
- *
63
- * @description 为了更好的加载性能,我们会优先在列表中使用此缩略图
64
- *
65
- * Image preview link
66
- *
67
- * @description For better loading performance, we will use this thumbnail first in the list
68
- *
69
- * @default src
70
- */
71
- preview?: string;
72
- }
73
- type WalineSearchResult = WalineSearchImageData[];
74
- interface WalineSearchOptions {
75
- /**
76
- * 搜索操作
77
- *
78
- * Search action
79
- */
80
- search: (word: string) => Promise<WalineSearchResult>;
81
- /**
82
- * 打开列表时展示的默认结果
83
- *
84
- * Default result when opening list
85
- *
86
- * @default () => search('')
87
- */
88
- default?: () => Promise<WalineSearchResult>;
89
- /**
90
- * 获取更多的操作
91
- *
92
- * @description 会在列表滚动到底部时触发,如果你的搜索服务支持分页功能,你应该设置此项实现无限滚动
93
- *
94
- * Fetch more action
95
- *
96
- * @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
97
- *
98
- * @default (word) => search(word)
99
- */
100
- more?: (word: string, currentCount: number) => Promise<WalineSearchResult>;
101
- }
102
- type WalineMeta = 'nick' | 'mail' | 'link';
103
- type WalineImageUploader = (image: File) => Promise<string>;
104
- type WalineHighlighter = (code: string, lang: string) => string;
105
- type WalineTexRenderer = (blockMode: boolean, tex: string) => string;
106
-
107
- interface WalineCommentData {
108
- /**
109
- * User Nickname
110
- */
111
- nick: string;
112
- /**
113
- * User email
114
- */
115
- mail: string;
116
- /**
117
- * User link
118
- */
119
- link?: string;
120
- /**
121
- * Content of comment
122
- */
123
- comment: string;
124
- /**
125
- * User Agent
126
- */
127
- ua: string;
128
- /**
129
- * Parent comment id
130
- */
131
- pid?: string;
132
- /**
133
- * Root comment id
134
- */
135
- rid?: string;
136
- /**
137
- * User id being at
138
- */
139
- at?: string;
140
- /**
141
- * Comment link
142
- */
143
- url: string;
144
- /**
145
- * Recaptcha Token
146
- */
147
- recaptchaV3?: string;
148
- /**
149
- * Turnstile Token
150
- */
151
- turnstile?: string;
152
- }
153
- type WalineCommentStatus = 'approved' | 'waiting' | 'spam';
154
- interface WalineComment extends Exclude<WalineCommentData, 'ua'> {
155
- /**
156
- * User avatar
157
- */
158
- avatar: string;
159
- /**
160
- * User type
161
- */
162
- type?: 'administrator' | 'guest' | `verify:${string}`;
163
- objectId: string;
164
- /**
165
- * Time ISOString when the comment is created
166
- */
167
- createdAt: string;
168
- insertedAt: string;
169
- updatedAt: string;
170
- children: WalineComment[];
171
- sticky?: boolean;
172
- browser?: string;
173
- os?: string;
174
- level?: number;
175
- addr?: string;
176
- label?: string;
177
- user_id?: string | number;
178
- status?: WalineCommentStatus;
179
- like?: number;
180
- orig?: string;
181
- }
182
-
183
- interface WalineDateLocale {
184
- seconds: string;
185
- minutes: string;
186
- hours: string;
187
- days: string;
188
- now: string;
189
- }
190
- type WalineLevelLocale = Record<`level${number}`, string>;
191
- interface WalineReactionLocale {
192
- reactionTitle: string;
193
- reaction0: string;
194
- reaction1: string;
195
- reaction2: string;
196
- reaction3: string;
197
- reaction4: string;
198
- reaction5: string;
199
- reaction6: string;
200
- reaction7: string;
201
- reaction8: string;
202
- }
203
- interface WalineLocale extends WalineDateLocale, WalineLevelLocale, WalineReactionLocale {
204
- nick: string;
205
- mail: string;
206
- link: string;
207
- optional: string;
208
- placeholder: string;
209
- sofa: string;
210
- submit: string;
211
- comment: string;
212
- refresh: string;
213
- more: string;
214
- uploading: string;
215
- login: string;
216
- admin: string;
217
- sticky: string;
218
- word: string;
219
- anonymous: string;
220
- gif: string;
221
- gifSearchPlaceholder: string;
222
- approved: string;
223
- waiting: string;
224
- spam: string;
225
- unsticky: string;
226
- oldest: string;
227
- latest: string;
228
- hottest: string;
229
- nickError: string;
230
- mailError: string;
231
- wordHint: string;
232
- like: string;
233
- cancelLike: string;
234
- reply: string;
235
- cancelReply: string;
236
- preview: string;
237
- emoji: string;
238
- uploadImage: string;
239
- profile: string;
240
- logout: string;
241
- }
242
-
243
- interface WalineProps {
244
- /**
245
- * Waline 的服务端地址
246
- *
247
- * Waline server address url
248
- */
249
- serverURL: string;
250
- /**
251
- * 当前 _文章页_ 路径,用于区分不同的 _文章页_ ,以保证正确读取该 _文章页_ 下的评论列表
252
- *
253
- * 你可以将其设置为 `window.location.pathname`
254
- *
255
- * Article path id. Used to distinguish different _article pages_ to ensure loading the correct comment list under the _article page_.
256
- *
257
- * You can set it to `window.location.pathname`
258
- */
259
- path: string;
260
- /**
261
- * 评论者相关属性
262
- *
263
- * `Meta` 可选值: `'nick'`, `'mail'`, `'link'`
264
- *
265
- * Reviewer attributes.
266
- *
267
- * Optional values for `Meta`: `'nick'`, `'mail'`, `'link'`
268
- *
269
- * @default ['nick', 'mail', 'link']
270
- */
271
- meta?: WalineMeta[];
272
- /**
273
- * 设置**必填项**,默认昵称为匿名
274
- *
275
- * Set required fields, default anonymous with nickname
276
- *
277
- * @default []
278
- */
279
- requiredMeta?: WalineMeta[];
280
- /**
281
- * 评论字数限制。填入单个数字时为最大字数限制
282
- *
283
- * @more 设置为 `0` 时无限制
284
- *
285
- * Comment word s limit. When a single number is filled in, it 's the maximum number of comment words.
286
- *
287
- * @more No limit when set to `0`.
288
- *
289
- * @default 0
290
- */
291
- wordLimit?: number | [number, number];
292
- /**
293
- * 评论列表分页,每页条数
294
- *
295
- * number of pages per page
296
- *
297
- * @default 10
298
- */
299
- pageSize?: number;
300
- /**
301
- * Waline 显示语言
302
- *
303
- * 可选值:
304
- *
305
- * - `'zh'`
306
- * - `'zh-cn'`
307
- * - `'zh-CN'`
308
- * - `'zh-tw'`
309
- * - `'zh-TW'`
310
- * - `'en'`
311
- * - `'en-US'`
312
- * - `'en-us'`
313
- * - `'jp'`
314
- * - `'jp-jp'`
315
- * - `'jp-JP'`
316
- * - `'pt-br'`
317
- * - `'pt-BR'`
318
- * - `'ru'`
319
- * - `'ru-ru'`
320
- * - `'ru-RU'`
321
- *
322
- * Display language for waline
323
- *
324
- * Optional value:
325
- *
326
- * - `'zh'`
327
- * - `'zh-cn'`
328
- * - `'zh-CN'`
329
- * - `'zh-tw'`
330
- * - `'zh-TW'`
331
- * - `'en'`
332
- * - `'en-US'`
333
- * - `'en-us'`
334
- * - `'jp'`
335
- * - `'jp-jp'`
336
- * - `'jp-JP'`
337
- * - `'pt-br'`
338
- * - `'pt-BR'`
339
- * - `'ru'`
340
- * - `'ru-ru'`
341
- * - `'ru-RU'`
342
- *
343
- * @default navigator.language
344
- */
345
- lang?: string;
346
- /**
347
- * 自定义 waline 语言显示
348
- *
349
- * @see [自定义语言](https://waline.js.org/client/i18n.html)
350
- *
351
- * Custom display language in waline
352
- *
353
- * @see [I18n](https://waline.js.org/en/client/i18n.html)
354
- */
355
- locale?: Partial<WalineLocale>;
356
- /**
357
- * 评论列表排序方式
358
- *
359
- * Sorting method for comment list
360
- *
361
- * @default 'latest'
362
- */
363
- commentSorting?: WalineCommentSorting;
364
- /**
365
- * 是否启用暗黑模式适配
366
- *
367
- * @more 设置 `'auto'` 会根据设备暗黑模式自适应。填入 CSS 选择器会在对应选择器生效时启用夜间模式。
368
- *
369
- * Whether to enable darkmode support
370
- *
371
- * @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.
372
- */
373
- dark?: string | boolean;
374
- /**
375
- * 设置表情包
376
- *
377
- * Set Emojis
378
- *
379
- * @default ['//unpkg.com/@waline/emojis@1.1.0/weibo']
380
- */
381
- emoji?: (WalineEmojiInfo | WalineEmojiPresets)[] | boolean;
382
- /**
383
- * 设置搜索功能
384
- *
385
- * Customize Search feature
386
- *
387
- * @default true
388
- */
389
- search?: WalineSearchOptions | boolean;
390
- /**
391
- * 代码高亮
392
- *
393
- * Code highlighting
394
- *
395
- * @default true
396
- */
397
- highlighter?: WalineHighlighter | boolean;
398
- /**
399
- * 自定义图片上传方法,方便更好的存储图片
400
- *
401
- * 方法执行时会将图片对象传入。
402
- *
403
- * Custom image upload callback to manage picture by yourself.
404
- *
405
- * We will pass a picture file object when execute it.
406
- *
407
- * @default true
408
- */
409
- imageUploader?: WalineImageUploader | boolean;
410
- /**
411
- * 自定义数学公式处理方法,用于预览。
412
- *
413
- * Custom math formula parse callback for preview.
414
- *
415
- * @default true
416
- */
417
- texRenderer?: WalineTexRenderer | boolean;
418
- /**
419
- *
420
- * 登录模式状态,可选值:
421
- *
422
- * - `'enable'`: 启用登录 (默认)
423
- * - `'disable'`: 禁用登录,用户只能填写信息评论
424
- * - `'force'`: 强制登录,用户必须注册并登录才可发布评论
425
- *
426
- * Login mode status, optional values:
427
- *
428
- * - `'enable'`: enable login (default)
429
- * - `'disable'`: Login is disabled, users should fill in information to comment
430
- * - `'force'`: Forced login, users must login to comment
431
- *
432
- * @default 'enable'
433
- */
434
- login?: WalineLoginStatus;
435
- /**
436
- * 是否在页脚展示版权信息
437
- *
438
- * 为了支持 Waline,我们强烈建议你开启它
439
- *
440
- * Whether show copyright in footer
441
- *
442
- * We strongly recommended you to keep it on to support waline
443
- *
444
- * @default true
445
- */
446
- copyright?: boolean;
447
- /**
448
- * recaptcha v3 client key
449
- */
450
- recaptchaV3Key?: string;
451
- /**
452
- * turnstile client key
453
- */
454
- turnstileKey?: string;
455
- /**
456
- * reaction
457
- */
458
- reaction?: string[] | boolean;
459
- }
460
-
461
- interface WalineInitOptions extends Omit<WalineProps, 'path'> {
462
- /**
463
- * Waline 的初始化挂载器。必须是一个**有效的** CSS 选择器 或 HTML 元素
464
- *
465
- * The DOM element to be mounted on initialization. It must be a **valid** CSS selector string or HTML Element.
466
- */
467
- el?: string | HTMLElement | null;
468
- /**
469
- * 评论数统计
470
- *
471
- * Comment number support
472
- *
473
- * @default false
474
- */
475
- comment?: string | boolean;
476
- /**
477
- * 页面访问量统计
478
- *
479
- * Pageview number support
480
- *
481
- * @default false
482
- */
483
- pageview?: string | boolean;
484
- /**
485
- * 当前 _文章页_ 路径,用于区分不同的 _文章页_ ,以保证正确读取该 _文章页_ 下的评论列表
486
- *
487
- * 你可以将其设置为 `window.location.pathname`
488
- *
489
- * Article path id. Used to distinguish different _article pages_ to ensure loading the correct comment list under the _article page_.
490
- *
491
- * You can set it to `window.location.pathname`
492
- *
493
- * @default window.location.pathname
494
- */
495
- path?: string;
496
- }
497
- type WalineAbort = (reason?: any) => void;
498
-
499
- type Locales = Record<string, WalineLocale>;
500
- declare const DEFAULT_LOCALES: Locales;
501
-
502
- interface WalineCommentCountOptions {
503
- /**
504
- * Waline 服务端地址
505
- *
506
- * Waline server url
507
- */
508
- serverURL: string;
509
- /**
510
- * 评论数 CSS 选择器
511
- *
512
- * Comment count CSS selector
513
- *
514
- * @default '.waline-comment-count'
515
- */
516
- selector?: string;
517
- /**
518
- * 需要获取的默认路径
519
- *
520
- * Path to be fetched by default
521
- *
522
- * @default window.location.pathname
523
- */
524
- path?: string;
525
- /**
526
- * 错误提示消息所使用的语言
527
- *
528
- * Language of error message
529
- *
530
- * @default navigator.language
531
- */
532
- lang?: string;
533
- }
534
- declare const commentCount: ({ serverURL, path, selector, lang, }: WalineCommentCountOptions) => WalineAbort;
535
-
536
- interface WalineInstance {
537
- /**
538
- * Waline 被挂载到的元素
539
- *
540
- * @description 当通过 `el: null` 初始化,值为 `null`
541
- *
542
- * Element where Waline is mounted
543
- *
544
- * @description when initialized with `el: null`, it will be `null`
545
- */
546
- el: HTMLElement | null;
547
- /**
548
- * 更新 Waline 实例
549
- *
550
- * @description 只要不设置`path` 选项,更新时它就会被重置为 `windows.location.pathname`
551
- *
552
- * Update Waline instance
553
- *
554
- * @description when not setting `path` option, it will be reset to `window.location.pathname`
555
- */
556
- update: (newOptions?: Partial<Omit<WalineInitOptions, 'el'>>) => void;
557
- /**
558
- * 取消挂载并摧毁 Waline 实例
559
- *
560
- * Unmount and destroy Waline instance
561
- */
562
- destroy: () => void;
563
- }
564
- declare const init: ({ el, path, comment, pageview, ...initProps }: WalineInitOptions) => WalineInstance | null;
565
-
566
- interface WalinePageviewCountOptions {
567
- /**
568
- * Waline 服务端地址
569
- *
570
- * Waline server url
571
- */
572
- serverURL: string;
573
- /**
574
- * 浏览量 CSS 选择器
575
- *
576
- * Pageview CSS selector
577
- *
578
- * @default '.waline-pageview-count'
579
- */
580
- selector?: string;
581
- /**
582
- * 需要更新和获取的路径
583
- *
584
- * Path to be fetched and updated
585
- *
586
- * @default window.location.pathname
587
- */
588
- path?: string;
589
- /**
590
- * 是否在查询时更新 path 的浏览量
591
- *
592
- * Whether update pageviews when fetching path result
593
- *
594
- * @default true
595
- */
596
- update?: boolean;
597
- /**
598
- * 错误提示消息所使用的语言
599
- *
600
- * Language of error message
601
- *
602
- * @default navigator.language
603
- */
604
- lang?: string;
605
- }
606
- declare const pageviewCount: ({ serverURL, path, selector, update, lang, }: WalinePageviewCountOptions) => WalineAbort;
607
-
608
- declare const version: string;
609
-
610
- interface WalineRecentCommentsOptions {
611
- /**
612
- * Waline 服务端地址
613
- *
614
- * Waline serverURL
615
- */
616
- serverURL: string;
617
- /**
618
- * 获取最新评论的数量
619
- *
620
- * fetch number of latest comments
621
- */
622
- count: number;
623
- /**
624
- * 需要挂载的元素
625
- *
626
- * Element to be mounted
627
- */
628
- el?: string | HTMLElement;
629
- /**
630
- * 错误提示消息所使用的语言
631
- *
632
- * Language of error message
633
- *
634
- * @default navigator.language
635
- */
636
- lang?: string;
637
- }
638
- interface WalineRecentCommentsResult {
639
- /**
640
- * 评论数据
641
- *
642
- * Comment Data
643
- */
644
- comments: WalineComment[];
645
- /**
646
- * 取消挂载挂件
647
- *
648
- * Umount widget
649
- */
650
- destroy: () => void;
651
- }
652
- declare const RecentComments: ({ el, serverURL, count, lang, }: WalineRecentCommentsOptions) => Promise<WalineRecentCommentsResult>;
653
-
654
- interface WalineUser extends Pick<WalineComment, 'nick' | 'link' | 'avatar' | 'label' | 'level'> {
655
- count: number;
656
- }
657
-
658
- interface WalineUserListOptions {
659
- /**
660
- * Waline 服务端地址
661
- *
662
- * Waline serverURL
663
- */
664
- serverURL: string;
665
- /**
666
- * 获取用户列表的数量
667
- *
668
- * fetch number of user list
669
- */
670
- count: number;
671
- /**
672
- * 需要挂载的元素
673
- *
674
- * Element to be mounted
675
- */
676
- el?: string | HTMLElement;
677
- /**
678
- * 错误提示消息所使用的语言
679
- *
680
- * Language of error message
681
- *
682
- * @default navigator.language
683
- */
684
- lang?: string;
685
- /**
686
- * 自定义 waline 语言显示
687
- *
688
- * @see [自定义语言](https://waline.js.org/client/i18n.html)
689
- *
690
- * Custom display language in waline
691
- *
692
- * @see [I18n](https://waline.js.org/en/client/i18n.html)
693
- */
694
- locale?: WalineLocale;
695
- /**
696
- * 列表模式还是头像墙模式
697
- *
698
- * list mode or avatar wall mode
699
- */
700
- mode: 'list' | 'wall';
701
- }
702
- interface WalineUserListResult {
703
- /**
704
- * 用户数据
705
- *
706
- * User Data
707
- */
708
- users: WalineUser[];
709
- /**
710
- * 取消挂载挂件
711
- *
712
- * Umount widget
713
- */
714
- destroy: () => void;
715
- }
716
- declare const UserList: ({ el, serverURL, count, locale, lang, mode, }: WalineUserListOptions) => Promise<WalineUserListResult>;
717
-
718
- export { RecentComments, UserList, WalineAbort, WalineComment, WalineCommentCountOptions, WalineCommentData, WalineCommentSorting, WalineCommentStatus, WalineDateLocale, WalineEmojiInfo, WalineEmojiMaps, WalineEmojiPresets, WalineHighlighter, WalineImageUploader, WalineInitOptions, WalineInstance, WalineLevelLocale, WalineLocale, WalineLoginStatus, WalineMeta, WalinePageviewCountOptions, WalineProps, WalineReactionLocale, WalineRecentCommentsOptions, WalineRecentCommentsResult, WalineSearchImageData, WalineSearchOptions, WalineSearchResult, WalineTexRenderer, WalineUserListOptions, WalineUserListResult, commentCount, DEFAULT_LOCALES as defaultLocales, init, pageviewCount, version };