@waline/client 2.14.8 → 2.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.
Files changed (87) hide show
  1. package/dist/api.cjs.map +1 -1
  2. package/dist/api.d.cts +4 -0
  3. package/dist/api.d.mts +4 -0
  4. package/dist/api.d.ts +4 -0
  5. package/dist/api.mjs.map +1 -1
  6. package/dist/comment.cjs +1 -1
  7. package/dist/comment.cjs.map +1 -1
  8. package/dist/comment.js +1 -1
  9. package/dist/comment.js.map +1 -1
  10. package/dist/comment.mjs +1 -1
  11. package/dist/comment.mjs.map +1 -1
  12. package/dist/component.mjs +1 -1
  13. package/dist/component.mjs.map +1 -1
  14. package/dist/legacy.umd.d.ts +92 -88
  15. package/dist/legacy.umd.js +1 -1
  16. package/dist/legacy.umd.js.map +1 -1
  17. package/dist/pageview.cjs +1 -1
  18. package/dist/pageview.cjs.map +1 -1
  19. package/dist/pageview.js +1 -1
  20. package/dist/pageview.js.map +1 -1
  21. package/dist/pageview.mjs +1 -1
  22. package/dist/pageview.mjs.map +1 -1
  23. package/dist/shim.cjs +1 -1
  24. package/dist/shim.cjs.map +1 -1
  25. package/dist/shim.d.cts +10 -2
  26. package/dist/shim.d.mts +10 -2
  27. package/dist/shim.mjs +1 -1
  28. package/dist/shim.mjs.map +1 -1
  29. package/dist/waline.cjs +1 -1
  30. package/dist/waline.cjs.map +1 -1
  31. package/dist/waline.css +1 -1
  32. package/dist/waline.css.map +1 -1
  33. package/dist/waline.d.cts +10 -2
  34. package/dist/waline.d.mts +10 -2
  35. package/dist/waline.d.ts +10 -2
  36. package/dist/waline.js +1 -1
  37. package/dist/waline.js.map +1 -1
  38. package/dist/waline.mjs +1 -1
  39. package/dist/waline.mjs.map +1 -1
  40. package/package.json +7 -17
  41. package/src/api/articleCounter.ts +1 -2
  42. package/src/api/comment.ts +10 -3
  43. package/src/api/commentCount.ts +1 -1
  44. package/src/api/login.ts +1 -1
  45. package/src/api/pageview.ts +2 -2
  46. package/src/api/recentComment.ts +2 -2
  47. package/src/api/user.ts +6 -3
  48. package/src/comment.ts +3 -3
  49. package/src/compact/convert.ts +6 -7
  50. package/src/compact/v1.ts +5 -5
  51. package/src/compact/valine.ts +6 -6
  52. package/src/components/ArticleReaction.vue +3 -4
  53. package/src/components/CommentBox.vue +62 -49
  54. package/src/components/CommentCard.vue +8 -7
  55. package/src/components/Icons.ts +4 -3
  56. package/src/components/ImageWall.vue +1 -2
  57. package/src/components/WalineComment.vue +8 -7
  58. package/src/composables/inputs.ts +1 -2
  59. package/src/composables/like.ts +1 -2
  60. package/src/composables/reaction.ts +1 -2
  61. package/src/composables/recaptchaV3.ts +1 -3
  62. package/src/composables/turnstile.ts +79 -0
  63. package/src/composables/userInfo.ts +2 -2
  64. package/src/config/default.ts +23 -22
  65. package/src/config/i18n/generate.ts +1 -1
  66. package/src/config/i18n/index.ts +8 -9
  67. package/src/entries/full.ts +1 -1
  68. package/src/entries/init.ts +1 -1
  69. package/src/entries/legacy.ts +10 -10
  70. package/src/init.ts +4 -5
  71. package/src/pageview.ts +3 -4
  72. package/src/shims-vue.d.ts +2 -1
  73. package/src/styles/card.scss +16 -14
  74. package/src/styles/emoji.scss +0 -3
  75. package/src/styles/index.scss +0 -5
  76. package/src/typings/comment.ts +5 -0
  77. package/src/typings/options.ts +1 -1
  78. package/src/typings/waline.ts +17 -12
  79. package/src/utils/config.ts +19 -19
  80. package/src/utils/emoji.ts +3 -3
  81. package/src/utils/index.ts +12 -11
  82. package/src/utils/markdown.ts +6 -6
  83. package/src/utils/markedMathExtension.ts +3 -2
  84. package/src/utils/userAgent.ts +1 -1
  85. package/src/utils/wordCount.ts +1 -1
  86. package/src/widgets/recentComments.ts +4 -5
  87. package/src/widgets/userList.ts +2 -2
@@ -371,6 +371,10 @@ interface WalineProps {
371
371
  * recaptcha v3 client key
372
372
  */
373
373
  recaptchaV3Key?: string;
374
+ /**
375
+ * turnstile client key
376
+ */
377
+ turnstileKey?: string;
374
378
  /**
375
379
  * reaction
376
380
  */
@@ -414,33 +418,93 @@ interface WalineInitOptions extends Omit<WalineProps, 'path'> {
414
418
  path?: string;
415
419
  }
416
420
 
417
- interface WalineInstance {
421
+ interface DeprecatedWalineOptions {
418
422
  /**
419
- * Waline 被挂载到的元素
423
+ * @deprecated Please use mathjax in server, dropped in V2
420
424
  *
421
- * @description 当通过 `el: null` 初始化,值为 `null`
425
+ * 是否注入额外的样式添加对 `<math>` 块的兼容
422
426
  *
423
- * Element where Waline is mounted
427
+ * Whether injecting additional styles to support math block
424
428
  *
425
- * @description when initialized with `el: null`, it will be `null`
429
+ * @default false
426
430
  */
427
- el: HTMLElement | null;
431
+ mathTagSupport?: boolean;
428
432
  /**
429
- * 更新 Waline 实例
433
+ * @deprecated use `pageview` instead, dropped in V2
430
434
  *
431
- * @description 只要不设置`path` 选项,更新时它就会被重置为 `windows.location.pathname`
435
+ * 文章访问量统计
432
436
  *
433
- * Update Waline instance
437
+ * Article reading statistics
434
438
  *
435
- * @description when not setting `path` option, it will be reset to `window.location.pathname`
439
+ * @default false
436
440
  */
437
- update: (newOptions?: Partial<Omit<WalineInitOptions, 'el'>>) => void;
441
+ visitor?: boolean;
438
442
  /**
439
- * 取消挂载并摧毁 Waline 实例
443
+ * @deprecated use `highlighter` instead, dropped in V2
440
444
  *
441
- * Unmount and destroy Waline instance
445
+ * 代码高亮
446
+ *
447
+ * Code highlighting
442
448
  */
443
- destroy: () => void;
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;
444
508
  }
445
509
 
446
510
  type DeprecatedAvatar = '' | 'mp' | 'identicon' | 'monsterid' | 'wavatar' | 'retro' | 'robohash' | 'hide';
@@ -530,93 +594,33 @@ interface DeprecatedValineOptions {
530
594
  emojiMaps?: DeprecatedEmojiMaps;
531
595
  }
532
596
 
533
- interface DeprecatedWalineOptions {
534
- /**
535
- * @deprecated Please use mathjax in server, dropped in V2
536
- *
537
- * 是否注入额外的样式添加对 `<math>` 块的兼容
538
- *
539
- * Whether injecting additional styles to support math block
540
- *
541
- * @default false
542
- */
543
- mathTagSupport?: boolean;
544
- /**
545
- * @deprecated use `pageview` instead, dropped in V2
546
- *
547
- * 文章访问量统计
548
- *
549
- * Article reading statistics
550
- *
551
- * @default false
552
- */
553
- visitor?: boolean;
554
- /**
555
- * @deprecated use `highlighter` instead, dropped in V2
556
- *
557
- * 代码高亮
558
- *
559
- * Code highlighting
560
- */
561
- highlight?: WalineHighlighter | false;
562
- /**
563
- * @deprecated use `imageUploader` instead, dropped in V2
564
- *
565
- * 自定义图片上传方法,方便更好的存储图片
566
- *
567
- * 方法执行时会将图片对象传入。
568
- *
569
- * Custom image upload callback to manage picture by yourself.
570
- *
571
- * We will pass a picture file object when execute it.
572
- */
573
- uploadImage?: WalineImageUploader | false;
597
+ interface WalineInstance {
574
598
  /**
575
- * @deprecated Use `login` instead, dropped in V2
576
- *
577
- * 是否允许登录评论
578
- *
579
- * 默认情况是两者都支持,设置为 `true` 表示仅支持匿名评论,`false` 表示仅支持登录评论。
599
+ * Waline 被挂载到的元素
580
600
  *
581
- * Whether to allow login comments.
601
+ * @description 当通过 `el: null` 初始化,值为 `null`
582
602
  *
583
- * Both supported by default, set to `true` means only support anonymous comments, `false` means only support login comments.
603
+ * Element where Waline is mounted
584
604
  *
585
- * @default undefined
605
+ * @description when initialized with `el: null`, it will be `null`
586
606
  */
587
- anonymous?: boolean;
607
+ el: HTMLElement | null;
588
608
  /**
589
- * @deprecated Please use `AVATAR_PROXY` in server, dropped in V2
590
- *
591
- * 设置 Gravatar 头像 CDN 地址
592
- *
593
- * Gravatar CDN baseURL
609
+ * 更新 Waline 实例
594
610
  *
595
- * @default 'https://www.gravatar.com/avatar'
596
- */
597
- avatarCDN?: string;
598
- /**
599
- * @deprecated Use `texRenderer` instead, dropped in V2
611
+ * @description 只要不设置`path` 选项,更新时它就会被重置为 `windows.location.pathname`
600
612
  *
601
- * 自定义 Tex 处理方法,用于预览。
613
+ * Update Waline instance
602
614
  *
603
- * Custom math formula parse callback for preview.
615
+ * @description when not setting `path` option, it will be reset to `window.location.pathname`
604
616
  */
605
- previewMath?: WalineTexRenderer | false;
617
+ update: (newOptions?: Partial<Omit<WalineInitOptions, 'el'>>) => void;
606
618
  /**
607
- * @deprecated use `copyright` instead, dropped in V2
608
- *
609
- * 是否在页脚展示版权信息
610
- *
611
- * 为了支持 Waline,我们强烈建议你开启它
612
- *
613
- * Whether show copyright in footer
614
- *
615
- * We strongly recommended you to keep it on to support waline
619
+ * 取消挂载并摧毁 Waline 实例
616
620
  *
617
- * @default true
621
+ * Unmount and destroy Waline instance
618
622
  */
619
- copyRight?: boolean;
623
+ destroy: () => void;
620
624
  }
621
625
 
622
626
  declare function legacyWaline(options: WalineInitOptions & DeprecatedValineOptions & DeprecatedWalineOptions): WalineInstance | null;