@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
@@ -1,628 +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 WalineLoginStatus = 'enable' | 'disable' | 'force';
42
- interface WalineSearchImageData extends Record<string, unknown> {
43
- /**
44
- * 图片链接
45
- *
46
- * Image link
47
- */
48
- src: string;
49
- /**
50
- * 图片标题
51
- *
52
- * @description 用于图片的 alt 属性
53
- *
54
- * Image title
55
- *
56
- * @description Used for alt attribute of image
57
- */
58
- title?: string;
59
- /**
60
- * 图片缩略图
61
- *
62
- * @description 为了更好的加载性能,我们会优先在列表中使用此缩略图
63
- *
64
- * Image preview link
65
- *
66
- * @description For better loading performance, we will use this thumbnail first in the list
67
- *
68
- * @default src
69
- */
70
- preview?: string;
71
- }
72
- type WalineSearchResult = WalineSearchImageData[];
73
- interface WalineSearchOptions {
74
- /**
75
- * 搜索操作
76
- *
77
- * Search action
78
- */
79
- search: (word: string) => Promise<WalineSearchResult>;
80
- /**
81
- * 打开列表时展示的默认结果
82
- *
83
- * Default result when opening list
84
- *
85
- * @default () => search('')
86
- */
87
- default?: () => Promise<WalineSearchResult>;
88
- /**
89
- * 获取更多的操作
90
- *
91
- * @description 会在列表滚动到底部时触发,如果你的搜索服务支持分页功能,你应该设置此项实现无限滚动
92
- *
93
- * Fetch more action
94
- *
95
- * @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
96
- *
97
- * @default (word) => search(word)
98
- */
99
- more?: (word: string, currentCount: number) => Promise<WalineSearchResult>;
100
- }
101
- type WalineMeta = 'nick' | 'mail' | 'link';
102
- type WalineImageUploader = (image: File) => Promise<string>;
103
- type WalineHighlighter = (code: string, lang: string) => string;
104
- type WalineTexRenderer = (blockMode: boolean, tex: string) => string;
105
-
106
- interface WalineDateLocale {
107
- seconds: string;
108
- minutes: string;
109
- hours: string;
110
- days: string;
111
- now: string;
112
- }
113
- type WalineLevelLocale = Record<`level${number}`, string>;
114
- interface WalineReactionLocale {
115
- reactionTitle: string;
116
- reaction0: string;
117
- reaction1: string;
118
- reaction2: string;
119
- reaction3: string;
120
- reaction4: string;
121
- reaction5: string;
122
- reaction6: string;
123
- reaction7: string;
124
- reaction8: string;
125
- }
126
- interface WalineLocale extends WalineDateLocale, WalineLevelLocale, WalineReactionLocale {
127
- nick: string;
128
- mail: string;
129
- link: string;
130
- optional: string;
131
- placeholder: string;
132
- sofa: string;
133
- submit: string;
134
- comment: string;
135
- refresh: string;
136
- more: string;
137
- uploading: string;
138
- login: string;
139
- admin: string;
140
- sticky: string;
141
- word: string;
142
- anonymous: string;
143
- gif: string;
144
- gifSearchPlaceholder: string;
145
- approved: string;
146
- waiting: string;
147
- spam: string;
148
- unsticky: string;
149
- oldest: string;
150
- latest: string;
151
- hottest: string;
152
- nickError: string;
153
- mailError: string;
154
- wordHint: string;
155
- like: string;
156
- cancelLike: string;
157
- reply: string;
158
- cancelReply: string;
159
- preview: string;
160
- emoji: string;
161
- uploadImage: string;
162
- profile: string;
163
- logout: string;
164
- }
165
-
166
- interface WalineProps {
167
- /**
168
- * Waline 的服务端地址
169
- *
170
- * Waline server address url
171
- */
172
- serverURL: string;
173
- /**
174
- * 当前 _文章页_ 路径,用于区分不同的 _文章页_ ,以保证正确读取该 _文章页_ 下的评论列表
175
- *
176
- * 你可以将其设置为 `window.location.pathname`
177
- *
178
- * Article path id. Used to distinguish different _article pages_ to ensure loading the correct comment list under the _article page_.
179
- *
180
- * You can set it to `window.location.pathname`
181
- */
182
- path: string;
183
- /**
184
- * 评论者相关属性
185
- *
186
- * `Meta` 可选值: `'nick'`, `'mail'`, `'link'`
187
- *
188
- * Reviewer attributes.
189
- *
190
- * Optional values for `Meta`: `'nick'`, `'mail'`, `'link'`
191
- *
192
- * @default ['nick', 'mail', 'link']
193
- */
194
- meta?: WalineMeta[];
195
- /**
196
- * 设置**必填项**,默认昵称为匿名
197
- *
198
- * Set required fields, default anonymous with nickname
199
- *
200
- * @default []
201
- */
202
- requiredMeta?: WalineMeta[];
203
- /**
204
- * 评论字数限制。填入单个数字时为最大字数限制
205
- *
206
- * @more 设置为 `0` 时无限制
207
- *
208
- * Comment word s limit. When a single number is filled in, it 's the maximum number of comment words.
209
- *
210
- * @more No limit when set to `0`.
211
- *
212
- * @default 0
213
- */
214
- wordLimit?: number | [number, number];
215
- /**
216
- * 评论列表分页,每页条数
217
- *
218
- * number of pages per page
219
- *
220
- * @default 10
221
- */
222
- pageSize?: number;
223
- /**
224
- * Waline 显示语言
225
- *
226
- * 可选值:
227
- *
228
- * - `'zh'`
229
- * - `'zh-cn'`
230
- * - `'zh-CN'`
231
- * - `'zh-tw'`
232
- * - `'zh-TW'`
233
- * - `'en'`
234
- * - `'en-US'`
235
- * - `'en-us'`
236
- * - `'jp'`
237
- * - `'jp-jp'`
238
- * - `'jp-JP'`
239
- * - `'pt-br'`
240
- * - `'pt-BR'`
241
- * - `'ru'`
242
- * - `'ru-ru'`
243
- * - `'ru-RU'`
244
- *
245
- * Display language for waline
246
- *
247
- * Optional value:
248
- *
249
- * - `'zh'`
250
- * - `'zh-cn'`
251
- * - `'zh-CN'`
252
- * - `'zh-tw'`
253
- * - `'zh-TW'`
254
- * - `'en'`
255
- * - `'en-US'`
256
- * - `'en-us'`
257
- * - `'jp'`
258
- * - `'jp-jp'`
259
- * - `'jp-JP'`
260
- * - `'pt-br'`
261
- * - `'pt-BR'`
262
- * - `'ru'`
263
- * - `'ru-ru'`
264
- * - `'ru-RU'`
265
- *
266
- * @default navigator.language
267
- */
268
- lang?: string;
269
- /**
270
- * 自定义 waline 语言显示
271
- *
272
- * @see [自定义语言](https://waline.js.org/client/i18n.html)
273
- *
274
- * Custom display language in waline
275
- *
276
- * @see [I18n](https://waline.js.org/en/client/i18n.html)
277
- */
278
- locale?: Partial<WalineLocale>;
279
- /**
280
- * 评论列表排序方式
281
- *
282
- * Sorting method for comment list
283
- *
284
- * @default 'latest'
285
- */
286
- commentSorting?: WalineCommentSorting;
287
- /**
288
- * 是否启用暗黑模式适配
289
- *
290
- * @more 设置 `'auto'` 会根据设备暗黑模式自适应。填入 CSS 选择器会在对应选择器生效时启用夜间模式。
291
- *
292
- * Whether to enable darkmode support
293
- *
294
- * @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.
295
- */
296
- dark?: string | boolean;
297
- /**
298
- * 设置表情包
299
- *
300
- * Set Emojis
301
- *
302
- * @default ['//unpkg.com/@waline/emojis@1.1.0/weibo']
303
- */
304
- emoji?: (WalineEmojiInfo | WalineEmojiPresets)[] | boolean;
305
- /**
306
- * 设置搜索功能
307
- *
308
- * Customize Search feature
309
- *
310
- * @default true
311
- */
312
- search?: WalineSearchOptions | boolean;
313
- /**
314
- * 代码高亮
315
- *
316
- * Code highlighting
317
- *
318
- * @default true
319
- */
320
- highlighter?: WalineHighlighter | boolean;
321
- /**
322
- * 自定义图片上传方法,方便更好的存储图片
323
- *
324
- * 方法执行时会将图片对象传入。
325
- *
326
- * Custom image upload callback to manage picture by yourself.
327
- *
328
- * We will pass a picture file object when execute it.
329
- *
330
- * @default true
331
- */
332
- imageUploader?: WalineImageUploader | boolean;
333
- /**
334
- * 自定义数学公式处理方法,用于预览。
335
- *
336
- * Custom math formula parse callback for preview.
337
- *
338
- * @default true
339
- */
340
- texRenderer?: WalineTexRenderer | boolean;
341
- /**
342
- *
343
- * 登录模式状态,可选值:
344
- *
345
- * - `'enable'`: 启用登录 (默认)
346
- * - `'disable'`: 禁用登录,用户只能填写信息评论
347
- * - `'force'`: 强制登录,用户必须注册并登录才可发布评论
348
- *
349
- * Login mode status, optional values:
350
- *
351
- * - `'enable'`: enable login (default)
352
- * - `'disable'`: Login is disabled, users should fill in information to comment
353
- * - `'force'`: Forced login, users must login to comment
354
- *
355
- * @default 'enable'
356
- */
357
- login?: WalineLoginStatus;
358
- /**
359
- * 是否在页脚展示版权信息
360
- *
361
- * 为了支持 Waline,我们强烈建议你开启它
362
- *
363
- * Whether show copyright in footer
364
- *
365
- * We strongly recommended you to keep it on to support waline
366
- *
367
- * @default true
368
- */
369
- copyright?: boolean;
370
- /**
371
- * recaptcha v3 client key
372
- */
373
- recaptchaV3Key?: string;
374
- /**
375
- * turnstile client key
376
- */
377
- turnstileKey?: string;
378
- /**
379
- * reaction
380
- */
381
- reaction?: string[] | boolean;
382
- }
383
-
384
- interface WalineInitOptions extends Omit<WalineProps, 'path'> {
385
- /**
386
- * Waline 的初始化挂载器。必须是一个**有效的** CSS 选择器 或 HTML 元素
387
- *
388
- * The DOM element to be mounted on initialization. It must be a **valid** CSS selector string or HTML Element.
389
- */
390
- el?: string | HTMLElement | null;
391
- /**
392
- * 评论数统计
393
- *
394
- * Comment number support
395
- *
396
- * @default false
397
- */
398
- comment?: string | boolean;
399
- /**
400
- * 页面访问量统计
401
- *
402
- * Pageview number support
403
- *
404
- * @default false
405
- */
406
- pageview?: string | boolean;
407
- /**
408
- * 当前 _文章页_ 路径,用于区分不同的 _文章页_ ,以保证正确读取该 _文章页_ 下的评论列表
409
- *
410
- * 你可以将其设置为 `window.location.pathname`
411
- *
412
- * Article path id. Used to distinguish different _article pages_ to ensure loading the correct comment list under the _article page_.
413
- *
414
- * You can set it to `window.location.pathname`
415
- *
416
- * @default window.location.pathname
417
- */
418
- path?: string;
419
- }
420
-
421
- interface DeprecatedWalineOptions {
422
- /**
423
- * @deprecated Please use mathjax in server, dropped in V2
424
- *
425
- * 是否注入额外的样式添加对 `<math>` 块的兼容
426
- *
427
- * Whether injecting additional styles to support math block
428
- *
429
- * @default false
430
- */
431
- mathTagSupport?: boolean;
432
- /**
433
- * @deprecated use `pageview` instead, dropped in V2
434
- *
435
- * 文章访问量统计
436
- *
437
- * Article reading statistics
438
- *
439
- * @default false
440
- */
441
- visitor?: boolean;
442
- /**
443
- * @deprecated use `highlighter` instead, dropped in V2
444
- *
445
- * 代码高亮
446
- *
447
- * Code highlighting
448
- */
449
- highlight?: WalineHighlighter | false;
450
- /**
451
- * @deprecated use `imageUploader` instead, dropped in V2
452
- *
453
- * 自定义图片上传方法,方便更好的存储图片
454
- *
455
- * 方法执行时会将图片对象传入。
456
- *
457
- * Custom image upload callback to manage picture by yourself.
458
- *
459
- * We will pass a picture file object when execute it.
460
- */
461
- uploadImage?: WalineImageUploader | false;
462
- /**
463
- * @deprecated Use `login` instead, dropped in V2
464
- *
465
- * 是否允许登录评论
466
- *
467
- * 默认情况是两者都支持,设置为 `true` 表示仅支持匿名评论,`false` 表示仅支持登录评论。
468
- *
469
- * Whether to allow login comments.
470
- *
471
- * Both supported by default, set to `true` means only support anonymous comments, `false` means only support login comments.
472
- *
473
- * @default undefined
474
- */
475
- anonymous?: boolean;
476
- /**
477
- * @deprecated Please use `AVATAR_PROXY` in server, dropped in V2
478
- *
479
- * 设置 Gravatar 头像 CDN 地址
480
- *
481
- * Gravatar CDN baseURL
482
- *
483
- * @default 'https://www.gravatar.com/avatar'
484
- */
485
- avatarCDN?: string;
486
- /**
487
- * @deprecated Use `texRenderer` instead, dropped in V2
488
- *
489
- * 自定义 Tex 处理方法,用于预览。
490
- *
491
- * Custom math formula parse callback for preview.
492
- */
493
- previewMath?: WalineTexRenderer | false;
494
- /**
495
- * @deprecated use `copyright` instead, dropped in V2
496
- *
497
- * 是否在页脚展示版权信息
498
- *
499
- * 为了支持 Waline,我们强烈建议你开启它
500
- *
501
- * Whether show copyright in footer
502
- *
503
- * We strongly recommended you to keep it on to support waline
504
- *
505
- * @default true
506
- */
507
- copyRight?: boolean;
508
- }
509
-
510
- type DeprecatedAvatar = '' | 'mp' | 'identicon' | 'monsterid' | 'wavatar' | 'retro' | 'robohash' | 'hide';
511
- type DeprecatedEmojiMaps = Record<string, string>;
512
- interface DeprecatedValineOptions {
513
- /**
514
- * @deprecated Use `locale.placeholder` instead, dropped in V2
515
- */
516
- placeholder?: string;
517
- /**
518
- * @deprecated Use `locale` instead, dropped in V2
519
- */
520
- langMode?: Partial<WalineLocale>;
521
- /**
522
- * @deprecated Use `requiredMeta` instead, dropped in V2
523
- */
524
- requiredFields?: WalineMeta[];
525
- /**
526
- * @deprecated Please use `AVATAR_PROXY` in server, dropped in V2
527
- *
528
- * [Gravatar](http://cn.gravatar.com/) 头像展示方式
529
- *
530
- * 可选值:
531
- *
532
- * - `''`
533
- * - `'mp'`
534
- * - `'identicon'`
535
- * - `'monsterid'`
536
- * - `'wavatar'`
537
- * - `'retro'`
538
- * - `'robohash'`
539
- * - `'hide'`
540
- *
541
- * [Gravatar](http://gravatar.com/) type
542
- *
543
- * Optional value:
544
- *
545
- * - `''`
546
- * - `'mp'`
547
- * - `'identicon'`
548
- * - `'monsterid'`
549
- * - `'wavatar'`
550
- * - `'retro'`
551
- * - `'robohash'`
552
- * - `'hide'`
553
- *
554
- * @default 'mp'
555
- */
556
- avatar?: DeprecatedAvatar;
557
- /**
558
- * @deprecated no longer needed, dropped in V2
559
- *
560
- * 每次访问是否**强制**拉取最新的*评论列表头像*
561
- *
562
- * Whether **force** pulling the latest avatar each time
563
- *
564
- * @default false
565
- */
566
- avatarForce?: boolean;
567
- /**
568
- * @deprecated Use `emojis` instead, dropped in V2
569
- *
570
- * 设置**表情包 CDN**
571
- *
572
- * @see [自定义表情包](https://waline.js.org/client/emoji.html)
573
- *
574
- * Set **Emoji Pack CDN**
575
- *
576
- * @see [Custom Emoji](https://waline.js.org/en/client/emoji.html)
577
- *
578
- * @default 'https://img.t.sinajs.cn/t4/appstyle/expression/ext/normal/'
579
- */
580
- emojiCDN?: string;
581
- /**
582
- * @deprecated Use `emojis` instead, dropped in V2
583
- *
584
- * 设置**表情包映射**
585
- *
586
- * @see [自定义表情](https://waline.js.org/client/emoji.html)
587
- *
588
- * Set **emoji maps**
589
- *
590
- * @see [Custom Emoji](https://waline.js.org/en/client/emoji.html)
591
- *
592
- * @default 微博表情包
593
- */
594
- emojiMaps?: DeprecatedEmojiMaps;
595
- }
596
-
597
- interface WalineInstance {
598
- /**
599
- * Waline 被挂载到的元素
600
- *
601
- * @description 当通过 `el: null` 初始化,值为 `null`
602
- *
603
- * Element where Waline is mounted
604
- *
605
- * @description when initialized with `el: null`, it will be `null`
606
- */
607
- el: HTMLElement | null;
608
- /**
609
- * 更新 Waline 实例
610
- *
611
- * @description 只要不设置`path` 选项,更新时它就会被重置为 `windows.location.pathname`
612
- *
613
- * Update Waline instance
614
- *
615
- * @description when not setting `path` option, it will be reset to `window.location.pathname`
616
- */
617
- update: (newOptions?: Partial<Omit<WalineInitOptions, 'el'>>) => void;
618
- /**
619
- * 取消挂载并摧毁 Waline 实例
620
- *
621
- * Unmount and destroy Waline instance
622
- */
623
- destroy: () => void;
624
- }
625
-
626
- declare function legacyWaline(options: WalineInitOptions & DeprecatedValineOptions & DeprecatedWalineOptions): WalineInstance | null;
627
-
628
- export { WalineInstance, legacyWaline as default };