@waline/client 2.15.5 → 2.15.7

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 (83) hide show
  1. package/dist/api.cjs.map +1 -1
  2. package/dist/api.d.cts +1 -1
  3. package/dist/api.d.mts +1 -1
  4. package/dist/api.d.ts +1 -1
  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.d.cts +1 -1
  9. package/dist/comment.d.mts +1 -1
  10. package/dist/comment.d.ts +1 -1
  11. package/dist/comment.js +1 -1
  12. package/dist/comment.js.map +1 -1
  13. package/dist/comment.mjs +1 -1
  14. package/dist/comment.mjs.map +1 -1
  15. package/dist/component.mjs +1 -1
  16. package/dist/component.mjs.map +1 -1
  17. package/dist/legacy.umd.d.ts +5 -5
  18. package/dist/legacy.umd.js +1 -1
  19. package/dist/legacy.umd.js.map +1 -1
  20. package/dist/pageview.cjs +1 -1
  21. package/dist/pageview.cjs.map +1 -1
  22. package/dist/pageview.d.cts +1 -1
  23. package/dist/pageview.d.mts +1 -1
  24. package/dist/pageview.d.ts +1 -1
  25. package/dist/pageview.js +1 -1
  26. package/dist/pageview.js.map +1 -1
  27. package/dist/pageview.mjs +1 -1
  28. package/dist/pageview.mjs.map +1 -1
  29. package/dist/shim.cjs +1 -1
  30. package/dist/shim.cjs.map +1 -1
  31. package/dist/shim.d.cts +3 -3
  32. package/dist/shim.d.mts +3 -3
  33. package/dist/shim.mjs +1 -1
  34. package/dist/shim.mjs.map +1 -1
  35. package/dist/waline.cjs +1 -1
  36. package/dist/waline.cjs.map +1 -1
  37. package/dist/waline.css.map +1 -1
  38. package/dist/waline.d.cts +3 -3
  39. package/dist/waline.d.mts +3 -3
  40. package/dist/waline.d.ts +3 -3
  41. package/dist/waline.js +1 -1
  42. package/dist/waline.js.map +1 -1
  43. package/dist/waline.mjs +1 -1
  44. package/dist/waline.mjs.map +1 -1
  45. package/package.json +13 -11
  46. package/src/api/articleCounter.ts +2 -2
  47. package/src/api/comment.ts +2 -2
  48. package/src/api/commentCount.ts +2 -2
  49. package/src/api/login.ts +1 -1
  50. package/src/api/pageview.ts +1 -1
  51. package/src/api/utils.ts +1 -1
  52. package/src/comment.ts +1 -1
  53. package/src/compact/convert.ts +9 -8
  54. package/src/compact/logger.ts +1 -1
  55. package/src/compact/v1.ts +3 -3
  56. package/src/compact/valine.ts +1 -1
  57. package/src/components/ArticleReaction.vue +12 -5
  58. package/src/components/CommentBox.vue +10 -11
  59. package/src/components/CommentCard.vue +6 -6
  60. package/src/components/Icons.ts +10 -10
  61. package/src/components/ImageWall.vue +5 -5
  62. package/src/components/WalineComment.vue +8 -8
  63. package/src/composables/turnstile.ts +22 -24
  64. package/src/composables/userInfo.ts +1 -1
  65. package/src/config/default.ts +6 -6
  66. package/src/config/highlighter.ts +1 -1
  67. package/src/config/i18n/generate.ts +1 -1
  68. package/src/entries/legacy.ts +4 -2
  69. package/src/pageview.ts +4 -4
  70. package/src/styles/emoji.scss +3 -1
  71. package/src/styles/gif.scss +3 -1
  72. package/src/typings/base.ts +1 -1
  73. package/src/typings/waline.ts +2 -2
  74. package/src/utils/config.ts +4 -4
  75. package/src/utils/date.ts +1 -1
  76. package/src/utils/emoji.ts +4 -4
  77. package/src/utils/getRoot.ts +1 -1
  78. package/src/utils/image.ts +1 -1
  79. package/src/utils/markdown.ts +6 -6
  80. package/src/utils/markedMathExtension.ts +3 -3
  81. package/src/utils/wordCount.ts +1 -1
  82. package/src/widgets/recentComments.ts +1 -1
  83. package/src/widgets/userList.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waline/client",
3
- "version": "2.15.5",
3
+ "version": "2.15.7",
4
4
  "description": "client for waline comment system",
5
5
  "keywords": [
6
6
  "valine",
@@ -16,7 +16,7 @@
16
16
  "author": {
17
17
  "name": "Mr.Hope",
18
18
  "email": "mister-hope@outlook.com",
19
- "url": "https://mrhope.site"
19
+ "url": "https://mister-hope.com"
20
20
  },
21
21
  "exports": {
22
22
  ".": {
@@ -31,7 +31,8 @@
31
31
  "default": "./dist/api.mjs"
32
32
  },
33
33
  "./component": {
34
- "default": "./dist/component.mjs"
34
+ "default": "./dist/component.mjs",
35
+ "types": "./dist/component.d.ts"
35
36
  },
36
37
  "./full": {
37
38
  "types": "./dist/waline.d.ts",
@@ -59,7 +60,8 @@
59
60
  "default": "./dist/api.mjs"
60
61
  },
61
62
  "./dist/component": {
62
- "default": "./dist/component.mjs"
63
+ "default": "./dist/component.mjs",
64
+ "types": "./dist/component.d.ts"
63
65
  },
64
66
  "./dist/comment": {
65
67
  "types": "./dist/comment.d.ts",
@@ -122,21 +124,21 @@
122
124
  ]
123
125
  },
124
126
  "dependencies": {
125
- "@vueuse/core": "^10.1.2",
127
+ "@vueuse/core": "^10.4.1",
126
128
  "autosize": "^6.0.1",
127
129
  "marked": "^4.3.0",
128
- "vue": "^3.3.2"
130
+ "vue": "^3.3.4"
129
131
  },
130
132
  "devDependencies": {
131
- "@babel/core": "7.21.8",
132
- "@babel/preset-env": "7.21.5",
133
+ "@babel/core": "7.22.11",
134
+ "@babel/preset-env": "7.22.10",
133
135
  "@giphy/js-types": "4.4.0",
134
136
  "@types/autosize": "4.0.1",
135
- "@types/marked": "4.3.0",
136
- "@vitejs/plugin-vue": "4.2.3",
137
+ "@types/marked": "4.3.1",
138
+ "@vitejs/plugin-vue": "4.3.3",
137
139
  "recaptcha-v3": "1.10.0",
138
140
  "user-agent-data-types": "0.3.1",
139
- "vite": "4.3.6"
141
+ "vite": "4.4.9"
140
142
  },
141
143
  "engines": {
142
144
  "node": ">=14"
@@ -38,9 +38,9 @@ export const getArticleCounter = ({
38
38
  }: GetArticleCounterOptions): Promise<GetArticleCounterResponse> =>
39
39
  fetch(
40
40
  `${serverURL}/article?path=${encodeURIComponent(
41
- paths.join(',')
41
+ paths.join(','),
42
42
  )}&type=${encodeURIComponent(type.join(','))}&lang=${lang}`,
43
- { signal }
43
+ { signal },
44
44
  ).then((resp) => <Promise<GetArticleCounterResponse>>resp.json());
45
45
 
46
46
  export interface UpdateArticleCounterOptions extends BaseAPIOptions {
@@ -106,9 +106,9 @@ export const getComment = ({
106
106
 
107
107
  return fetch(
108
108
  `${serverURL}/comment?path=${encodeURIComponent(
109
- path
109
+ path,
110
110
  )}&pageSize=${pageSize}&page=${page}&lang=${lang}&sortBy=${sortBy}`,
111
- { signal, headers }
111
+ { signal, headers },
112
112
  )
113
113
  .then((resp) => <Promise<GetCommentResponse>>resp.json())
114
114
  .then((data) => errorCheck(data, 'Get comment data'));
@@ -24,9 +24,9 @@ export const fetchCommentCount = ({
24
24
  }: GetCommentCountOptions): Promise<number[]> =>
25
25
  fetch(
26
26
  `${serverURL}/comment?type=count&url=${encodeURIComponent(
27
- paths.join(',')
27
+ paths.join(','),
28
28
  )}&lang=${lang}`,
29
- { signal }
29
+ { signal },
30
30
  )
31
31
  .then((resp) => <Promise<number | number[]>>resp.json())
32
32
  // TODO: Improve this API
package/src/api/login.ts CHANGED
@@ -72,7 +72,7 @@ export const login = ({
72
72
  const handler = window.open(
73
73
  `${serverURL}/ui/login?lng=${encodeURIComponent(lang)}`,
74
74
  '_blank',
75
- `width=${width},height=${height},left=${left},top=${top},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`
75
+ `width=${width},height=${height},left=${left},top=${top},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`,
76
76
  );
77
77
 
78
78
  handler?.postMessage({ type: 'TOKEN', data: null }, '*');
@@ -45,7 +45,7 @@ export interface UpdatePageviewOptions extends BaseAPIOptions {
45
45
  }
46
46
 
47
47
  export const updatePageview = (
48
- options: UpdatePageviewOptions
48
+ options: UpdatePageviewOptions,
49
49
  ): Promise<number> =>
50
50
  updateArticleCounter({
51
51
  ...options,
package/src/api/utils.ts CHANGED
@@ -37,7 +37,7 @@ export const JSON_HEADERS: Record<string, string> = {
37
37
 
38
38
  export const errorCheck = <T extends ErrorStatusResponse>(
39
39
  data: T,
40
- name = ''
40
+ name = '',
41
41
  ): T => {
42
42
  if (typeof data === 'object' && data.errno)
43
43
  throw new TypeError(`${name} failed with ${data.errno}: ${data.errmsg}`);
package/src/comment.ts CHANGED
@@ -53,7 +53,7 @@ export const commentCount = ({
53
53
  void fetchCommentCount({
54
54
  serverURL: getServerURL(serverURL),
55
55
  paths: Array.from(elements).map((element) =>
56
- decodePath(element.dataset.path || element.getAttribute('id') || path)
56
+ decodePath(element.dataset.path || element.getAttribute('id') || path),
57
57
  ),
58
58
  lang,
59
59
  signal: controller.signal,
@@ -4,12 +4,13 @@ import {
4
4
  } from './dropped.js';
5
5
  import { warning } from './logger.js';
6
6
  import { type DeprecatedWalineOptions } from './v1.js';
7
- import { resolveOldEmojiMap } from './valine.js';
8
- import { type DeprecatedValineOptions } from './valine.js';
7
+ import { resolveOldEmojiMap, type DeprecatedValineOptions } from './valine.js';
9
8
  import { type WalineInitOptions } from '../typings/index.js';
10
9
 
11
10
  export const covertOptions = (
12
- options: WalineInitOptions & DeprecatedValineOptions & DeprecatedWalineOptions
11
+ options: WalineInitOptions &
12
+ DeprecatedValineOptions &
13
+ DeprecatedWalineOptions,
13
14
  ): WalineInitOptions => {
14
15
  const {
15
16
  // Options which needs to be polyfilled
@@ -45,18 +46,18 @@ export const covertOptions = (
45
46
 
46
47
  // error with those which can no longer be handled
47
48
  DROPPED_OPTIONS_WHICH_CAN_NOT_BE_POLYFILLED.filter((item) =>
48
- Object.keys(options).includes(item)
49
+ Object.keys(options).includes(item),
49
50
  ).forEach((item) =>
50
- warning(`Option "${item}" is REMOVED and CAN NOT be polyfilled!`)
51
+ warning(`Option "${item}" is REMOVED and CAN NOT be polyfilled!`),
51
52
  );
52
53
 
53
54
  // warnings with those which is being polyfilled
54
55
  DROPPED_OPTIONS_WHICH_CAN_STILL_BE_POLYFILLED.filter(([oldOption]) =>
55
- Object.keys(options).includes(oldOption)
56
+ Object.keys(options).includes(oldOption),
56
57
  ).forEach(([oldOption, newOption]) =>
57
58
  warning(
58
- `Deprecated option "${oldOption}" is currently being polyfilled, Please switch to option "${newOption}" in v2!`
59
- )
59
+ `Deprecated option "${oldOption}" is currently being polyfilled, Please switch to option "${newOption}" in v2!`,
60
+ ),
60
61
  );
61
62
 
62
63
  if (placeholder) locale.placeholder = placeholder;
@@ -1,5 +1,5 @@
1
1
  export const warning = (content: string): void =>
2
2
  console.warn(
3
3
  `%c ${content}`,
4
- 'background:#ff0;color:red;font-size:36px;font-weight:bold;'
4
+ 'background:#ff0;color:red;font-size:36px;font-weight:bold;',
5
5
  );
package/src/compact/v1.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  type WalineHighlighter,
3
3
  type WalineImageUploader,
4
- type WalineTexRenderer,
4
+ type WalineTeXRenderer,
5
5
  } from '../typings/index.js';
6
6
 
7
7
  export interface DeprecatedWalineOptions {
@@ -80,11 +80,11 @@ export interface DeprecatedWalineOptions {
80
80
  /**
81
81
  * @deprecated Use `texRenderer` instead, dropped in V2
82
82
  *
83
- * 自定义 Tex 处理方法,用于预览。
83
+ * 自定义 TeX 处理方法,用于预览。
84
84
  *
85
85
  * Custom math formula parse callback for preview.
86
86
  */
87
- previewMath?: WalineTexRenderer | false;
87
+ previewMath?: WalineTeXRenderer | false;
88
88
 
89
89
  /**
90
90
  * @deprecated use `copyright` instead, dropped in V2
@@ -112,7 +112,7 @@ export interface DeprecatedValineOptions {
112
112
  // TODO: remove
113
113
  export const resolveOldEmojiMap = (
114
114
  emojiMaps: DeprecatedEmojiMaps,
115
- emojiCDN = ''
115
+ emojiCDN = '',
116
116
  ): WalineEmojiInfo[] => {
117
117
  const resolvedEmojiMaps: WalineEmojiMaps = {};
118
118
 
@@ -32,8 +32,15 @@
32
32
  </template>
33
33
 
34
34
  <script setup lang="ts">
35
- import { type ComputedRef } from 'vue';
36
- import { computed, inject, onMounted, onUnmounted, ref, watch } from 'vue';
35
+ import {
36
+ type ComputedRef,
37
+ computed,
38
+ inject,
39
+ onMounted,
40
+ onUnmounted,
41
+ ref,
42
+ watch,
43
+ } from 'vue';
37
44
 
38
45
  import { LoadingIcon } from './Icons.js';
39
46
  import { getArticleCounter, updateArticleCounter } from '../api/index.js';
@@ -89,7 +96,7 @@ const fetchReaction = async (): Promise<void> => {
89
96
  if (Array.isArray(resp) || typeof resp === 'number') return;
90
97
 
91
98
  voteNumbers.value = reaction.map(
92
- (_reaction, index) => resp[`reaction${index}`]
99
+ (_reaction, index) => resp[`reaction${index}`],
93
100
  );
94
101
  }
95
102
  };
@@ -115,7 +122,7 @@ const vote = async (index: number): Promise<void> => {
115
122
 
116
123
  voteNumbers.value[currentVoteItemIndex] = Math.max(
117
124
  voteNumbers.value[currentVoteItemIndex] - 1,
118
- 0
125
+ 0,
119
126
  );
120
127
  }
121
128
 
@@ -145,7 +152,7 @@ onMounted(() => {
145
152
  () => {
146
153
  void fetchReaction();
147
154
  },
148
- { immediate: true }
155
+ { immediate: true },
149
156
  );
150
157
  });
151
158
  onUnmounted(() => abort?.());
@@ -361,7 +361,7 @@ const props = withDefaults(
361
361
  rootId: '',
362
362
  replyId: '',
363
363
  replyUser: '',
364
- }
364
+ },
365
365
  );
366
366
 
367
367
  const emit = defineEmits<{
@@ -449,7 +449,7 @@ const uploadImage = (file: File): Promise<void> => {
449
449
  .then((url) => {
450
450
  editor.value = editor.value.replace(
451
451
  uploadText,
452
- `\r\n![${file.name}](${url})`
452
+ `\r\n![${file.name}](${url})`,
453
453
  );
454
454
  })
455
455
  .catch((err: Error) => {
@@ -549,7 +549,7 @@ const submitComment = async (): Promise<void> => {
549
549
  locale.value.wordHint
550
550
  .replace('$0', (wordLimit as [number, number])[0].toString())
551
551
  .replace('$1', (wordLimit as [number, number])[1].toString())
552
- .replace('$2', wordNumber.value.toString())
552
+ .replace('$2', wordNumber.value.toString()),
553
553
  );
554
554
 
555
555
  comment.comment = parseEmoji(comment.comment, emoji.value.map);
@@ -564,9 +564,8 @@ const submitComment = async (): Promise<void> => {
564
564
 
565
565
  try {
566
566
  if (recaptchaV3Key)
567
- comment.recaptchaV3 = await useReCaptcha(recaptchaV3Key).execute(
568
- 'social'
569
- );
567
+ comment.recaptchaV3 =
568
+ await useReCaptcha(recaptchaV3Key).execute('social');
570
569
 
571
570
  if (turnstileKey)
572
571
  comment.turnstile = await useTurnstile(turnstileKey).execute('social');
@@ -615,7 +614,7 @@ const onLogin = (event: Event): void => {
615
614
  userInfo.value = data;
616
615
  (data.remember ? localStorage : sessionStorage).setItem(
617
616
  'WALINE_USER',
618
- JSON.stringify(data)
617
+ JSON.stringify(data),
619
618
  );
620
619
  emit('log');
621
620
  });
@@ -644,7 +643,7 @@ const onProfile = (event: Event): void => {
644
643
  const handler = window.open(
645
644
  `${serverURL}/ui/profile?${query.toString()}`,
646
645
  '_blank',
647
- `width=${width},height=${height},left=${left},top=${top},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`
646
+ `width=${width},height=${height},left=${left},top=${top},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`,
648
647
  );
649
648
 
650
649
  handler?.postMessage({ type: 'TOKEN', data: userInfo.value.token }, '*');
@@ -724,7 +723,7 @@ watch(
724
723
  isWordNumberLegal.value = true;
725
724
  }
726
725
  },
727
- { immediate: true }
726
+ { immediate: true },
728
727
  );
729
728
 
730
729
  const onMessageReceive = ({
@@ -783,7 +782,7 @@ onMounted(() => {
783
782
  if (value) autosize(editorRef.value!);
784
783
  else autosize.destroy(editorRef.value!);
785
784
  },
786
- { immediate: true }
785
+ { immediate: true },
787
786
  );
788
787
 
789
788
  // watch emoji value change
@@ -793,7 +792,7 @@ onMounted(() => {
793
792
  getEmojis(emojiConfig).then((config) => {
794
793
  emoji.value = config;
795
794
  }),
796
- { immediate: true }
795
+ { immediate: true },
797
796
  );
798
797
  });
799
798
 
@@ -216,7 +216,7 @@ const props = withDefaults(
216
216
  {
217
217
  edit: null,
218
218
  reply: null,
219
- }
219
+ },
220
220
  );
221
221
 
222
222
  defineEmits<{
@@ -227,7 +227,7 @@ defineEmits<{
227
227
  (event: 'like', comment: WalineComment): void;
228
228
  (
229
229
  event: 'status',
230
- statusInfo: { status: WalineCommentStatus; comment: WalineComment }
230
+ statusInfo: { status: WalineCommentStatus; comment: WalineComment },
231
231
  ): void;
232
232
  (event: 'sticky', comment: WalineComment): void;
233
233
  (event: 'reply', comment: WalineComment | null): void;
@@ -251,21 +251,21 @@ const link = computed(() => {
251
251
  const like = computed(() => likes.value.includes(props.comment.objectId));
252
252
 
253
253
  const time = computed(() =>
254
- getTimeAgo(props.comment.insertedAt, now.value, locale.value)
254
+ getTimeAgo(props.comment.insertedAt, now.value, locale.value),
255
255
  );
256
256
 
257
257
  const isAdmin = computed(() => userInfo.value.type === 'administrator');
258
258
 
259
259
  const isOwner = computed(
260
260
  () =>
261
- props.comment.user_id && userInfo.value.objectId === props.comment.user_id
261
+ props.comment.user_id && userInfo.value.objectId === props.comment.user_id,
262
262
  );
263
263
 
264
264
  const isReplyingCurrent = computed(
265
- () => props.comment.objectId === props.reply?.objectId
265
+ () => props.comment.objectId === props.reply?.objectId,
266
266
  );
267
267
 
268
268
  const isEditingCurrent = computed(
269
- () => props.comment.objectId === props.edit?.objectId
269
+ () => props.comment.objectId === props.edit?.objectId,
270
270
  );
271
271
  </script>
@@ -18,7 +18,7 @@ export const CloseIcon: FunctionalComponent<{ size: number }> = ({ size }) =>
18
18
  d: 'm640.683 587.52-75.947-75.861 75.904-75.862a37.29 37.29 0 0 0 0-52.778 37.205 37.205 0 0 0-52.779 0l-75.946 75.818-75.862-75.946a37.419 37.419 0 0 0-52.821 0 37.419 37.419 0 0 0 0 52.821l75.947 75.947-75.776 75.733a37.29 37.29 0 1 0 52.778 52.821l75.776-75.776 75.947 75.947a37.376 37.376 0 0 0 52.779-52.821z',
19
19
  fill: '#888',
20
20
  }),
21
- ]
21
+ ],
22
22
  );
23
23
 
24
24
  export const DeleteIcon: FunctionalComponent = () =>
@@ -28,7 +28,7 @@ export const DeleteIcon: FunctionalComponent = () =>
28
28
  h('path', {
29
29
  d: 'm341.013 394.667 27.755 393.45h271.83l27.733-393.45h64.106l-28.01 397.952a64 64 0 0 1-63.83 59.498H368.768a64 64 0 0 1-63.83-59.52l-28.053-397.93h64.128zm139.307 19.818v298.667h-64V414.485h64zm117.013 0v298.667h-64V414.485h64zM181.333 288h640v64h-640v-64zm453.483-106.667v64h-256v-64h256z',
30
30
  fill: 'red',
31
- })
31
+ }),
32
32
  );
33
33
 
34
34
  export const EmojiIcon: FunctionalComponent = () =>
@@ -38,7 +38,7 @@ export const EmojiIcon: FunctionalComponent = () =>
38
38
  h('path', {
39
39
  d: 'M563.2 463.3 677 540c1.7 1.2 3.7 1.8 5.8 1.8.7 0 1.4-.1 2-.2 2.7-.5 5.1-2.1 6.6-4.4l25.3-37.8c1.5-2.3 2.1-5.1 1.6-7.8s-2.1-5.1-4.4-6.6l-73.6-49.1 73.6-49.1c2.3-1.5 3.9-3.9 4.4-6.6.5-2.7 0-5.5-1.6-7.8l-25.3-37.8a10.1 10.1 0 0 0-6.6-4.4c-.7-.1-1.3-.2-2-.2-2.1 0-4.1.6-5.8 1.8l-113.8 76.6c-9.2 6.2-14.7 16.4-14.7 27.5.1 11 5.5 21.3 14.7 27.4zM387 348.8h-45.5c-5.7 0-10.4 4.7-10.4 10.4v153.3c0 5.7 4.7 10.4 10.4 10.4H387c5.7 0 10.4-4.7 10.4-10.4V359.2c0-5.7-4.7-10.4-10.4-10.4zm333.8 241.3-41-20a10.3 10.3 0 0 0-8.1-.5c-2.6.9-4.8 2.9-5.9 5.4-30.1 64.9-93.1 109.1-164.4 115.2-5.7.5-9.9 5.5-9.5 11.2l3.9 45.5c.5 5.3 5 9.5 10.3 9.5h.9c94.8-8 178.5-66.5 218.6-152.7 2.4-5 .3-11.2-4.8-13.6zm186-186.1c-11.9-42-30.5-81.4-55.2-117.1-24.1-34.9-53.5-65.6-87.5-91.2-33.9-25.6-71.5-45.5-111.6-59.2-41.2-14-84.1-21.1-127.8-21.1h-1.2c-75.4 0-148.8 21.4-212.5 61.7-63.7 40.3-114.3 97.6-146.5 165.8-32.2 68.1-44.3 143.6-35.1 218.4 9.3 74.8 39.4 145 87.3 203.3.1.2.3.3.4.5l36.2 38.4c1.1 1.2 2.5 2.1 3.9 2.6 73.3 66.7 168.2 103.5 267.5 103.5 73.3 0 145.2-20.3 207.7-58.7 37.3-22.9 70.3-51.5 98.1-85 27.1-32.7 48.7-69.5 64.2-109.1 15.5-39.7 24.4-81.3 26.6-123.8 2.4-43.6-2.5-87-14.5-129zm-60.5 181.1c-8.3 37-22.8 72-43 104-19.7 31.1-44.3 58.6-73.1 81.7-28.8 23.1-61 41-95.7 53.4-35.6 12.7-72.9 19.1-110.9 19.1-82.6 0-161.7-30.6-222.8-86.2l-34.1-35.8c-23.9-29.3-42.4-62.2-55.1-97.7-12.4-34.7-18.8-71-19.2-107.9-.4-36.9 5.4-73.3 17.1-108.2 12-35.8 30-69.2 53.4-99.1 31.7-40.4 71.1-72 117.2-94.1 44.5-21.3 94-32.6 143.4-32.6 49.3 0 97 10.8 141.8 32 34.3 16.3 65.3 38.1 92 64.8 26.1 26 47.5 56 63.6 89.2 16.2 33.2 26.6 68.5 31 105.1 4.6 37.5 2.7 75.3-5.6 112.3z',
40
40
  fill: 'currentColor',
41
- })
41
+ }),
42
42
  );
43
43
 
44
44
  export const ImageIcon: FunctionalComponent = () =>
@@ -88,7 +88,7 @@ export const MarkdownIcon: FunctionalComponent = () =>
88
88
  h('path', {
89
89
  d: 'M14.85 3H1.15C.52 3 0 3.52 0 4.15v7.69C0 12.48.52 13 1.15 13h13.69c.64 0 1.15-.52 1.15-1.15v-7.7C16 3.52 15.48 3 14.85 3zM9 11H7V8L5.5 9.92 4 8v3H2V5h2l1.5 2L7 5h2v6zm2.99.5L9.5 8H11V5h2v3h1.5l-2.51 3.5z',
90
90
  fill: 'currentColor',
91
- })
91
+ }),
92
92
  );
93
93
 
94
94
  export const ReplyIcon: FunctionalComponent = () =>
@@ -98,7 +98,7 @@ export const ReplyIcon: FunctionalComponent = () =>
98
98
  h('path', {
99
99
  d: 'M810.667 213.333a64 64 0 0 1 64 64V704a64 64 0 0 1-64 64H478.336l-146.645 96.107a21.333 21.333 0 0 1-33.024-17.856V768h-85.334a64 64 0 0 1-64-64V277.333a64 64 0 0 1 64-64h597.334zm0 64H213.333V704h149.334v63.296L459.243 704h351.424V277.333zm-271.36 213.334v64h-176.64v-64h176.64zm122.026-128v64H362.667v-64h298.666z',
100
100
  fill: 'currentColor',
101
- })
101
+ }),
102
102
  );
103
103
 
104
104
  export const EditIcon: FunctionalComponent = () =>
@@ -108,7 +108,7 @@ export const EditIcon: FunctionalComponent = () =>
108
108
  h('path', {
109
109
  d: 'M813.039 318.772L480.53 651.278H360.718V531.463L693.227 198.961C697.904 194.284 704.027 192 710.157 192C716.302 192 722.436 194.284 727.114 198.961L813.039 284.88C817.72 289.561 820 295.684 820 301.825C820 307.95 817.72 314.093 813.039 318.772ZM710.172 261.888L420.624 551.431V591.376H460.561L750.109 301.825L710.172 261.888ZM490.517 291.845H240.906V771.09H720.156V521.479C720.156 504.947 733.559 491.529 750.109 491.529C766.653 491.529 780.063 504.947 780.063 521.479V791.059C780.063 813.118 762.18 831 740.125 831H220.937C198.882 831 181 813.118 181 791.059V271.872C181 249.817 198.882 231.935 220.937 231.935H490.517C507.06 231.935 520.47 245.352 520.47 261.888C520.47 278.424 507.06 291.845 490.517 291.845Z',
110
110
  fill: 'currentColor',
111
- })
111
+ }),
112
112
  );
113
113
 
114
114
  export const VerifiedIcon: FunctionalComponent = () =>
@@ -123,7 +123,7 @@ export const VerifiedIcon: FunctionalComponent = () =>
123
123
  h('path', {
124
124
  d: 'm894.4 461.56-54.4-63.2c-10.4-12-18.8-34.4-18.8-50.4v-68c0-42.4-34.8-77.2-77.2-77.2h-68c-15.6 0-38.4-8.4-50.4-18.8l-63.2-54.4c-27.6-23.6-72.8-23.6-100.8 0l-62.8 54.8c-12 10-34.8 18.4-50.4 18.4h-69.2c-42.4 0-77.2 34.8-77.2 77.2v68.4c0 15.6-8.4 38-18.4 50l-54 63.6c-23.2 27.6-23.2 72.4 0 100l54 63.6c10 12 18.4 34.4 18.4 50v68.4c0 42.4 34.8 77.2 77.2 77.2h69.2c15.6 0 38.4 8.4 50.4 18.8l63.2 54.4c27.6 23.6 72.8 23.6 100.8 0l63.2-54.4c12-10.4 34.4-18.8 50.4-18.8h68c42.4 0 77.2-34.8 77.2-77.2v-68c0-15.6 8.4-38.4 18.8-50.4l54.4-63.2c23.2-27.6 23.2-73.2-.4-100.8zm-216-25.2-193.2 193.2a30 30 0 0 1-42.4 0l-96.8-96.8a30.16 30.16 0 0 1 0-42.4c11.6-11.6 30.8-11.6 42.4 0l75.6 75.6 172-172c11.6-11.6 30.8-11.6 42.4 0 11.6 11.6 11.6 30.8 0 42.4z',
125
125
  fill: '#27ae60',
126
- })
126
+ }),
127
127
  );
128
128
 
129
129
  export const LoadingIcon: FunctionalComponent<{ size?: number }> = ({
@@ -156,8 +156,8 @@ export const LoadingIcon: FunctionalComponent<{ size?: number }> = ({
156
156
  dur: '1s',
157
157
  values: '0 50 50;360 50 50',
158
158
  keyTimes: '0;1',
159
- })
160
- )
159
+ }),
160
+ ),
161
161
  );
162
162
 
163
163
  export const GifIcon: FunctionalComponent = () =>
@@ -177,5 +177,5 @@ export const GifIcon: FunctionalComponent = () =>
177
177
  h('path', {
178
178
  d: 'M18.5 3H5.75C3.6875 3 2 4.6875 2 6.75V18C2 20.0625 3.6875 21.75 5.75 21.75H18.5C20.5625 21.75 22.25 20.0625 22.25 18V6.75C22.25 4.6875 20.5625 3 18.5 3ZM20.75 18C20.75 19.2375 19.7375 20.25 18.5 20.25H5.75C4.5125 20.25 3.5 19.2375 3.5 18V6.75C3.5 5.5125 4.5125 4.5 5.75 4.5H18.5C19.7375 4.5 20.75 5.5125 20.75 6.75V18Z',
179
179
  }),
180
- ]
180
+ ],
181
181
  );
@@ -82,7 +82,7 @@ const props = withDefaults(
82
82
  items: () => [] as WalineSearchResult,
83
83
  columnWidth: 300,
84
84
  gap: 0,
85
- }
85
+ },
86
86
  );
87
87
 
88
88
  defineEmits<{
@@ -99,7 +99,7 @@ const columns = ref<Column[]>([]);
99
99
  const getColumnCount = (): number => {
100
100
  const count = Math.floor(
101
101
  (wall.value!.getBoundingClientRect().width + props.gap) /
102
- (props.columnWidth + props.gap)
102
+ (props.columnWidth + props.gap),
103
103
  );
104
104
 
105
105
  return count > 0 ? count : 1;
@@ -118,7 +118,7 @@ const fillColumns = async (itemIndex: number): Promise<void> => {
118
118
  const target = columnDivs.reduce((prev, curr) =>
119
119
  curr.getBoundingClientRect().height < prev.getBoundingClientRect().height
120
120
  ? curr
121
- : prev
121
+ : prev,
122
122
  );
123
123
 
124
124
  columns.value[Number(target.dataset.index)].push(itemIndex);
@@ -155,13 +155,13 @@ onMounted(() => {
155
155
  () => {
156
156
  state.value = {};
157
157
  void redraw(true);
158
- }
158
+ },
159
159
  );
160
160
  watch(
161
161
  () => [props.columnWidth, props.gap],
162
162
  () => {
163
163
  void redraw();
164
- }
164
+ },
165
165
  );
166
166
  });
167
167
 
@@ -14,7 +14,7 @@
14
14
  <li
15
15
  v-for="item in sortingMethods"
16
16
  :key="item"
17
- :class="[item === commentSorting ? 'active' : '']"
17
+ :class="[item === commentSortingRef ? 'active' : '']"
18
18
  @click="onSortByChange(item)"
19
19
  >
20
20
  {{ i18n[item] }}
@@ -150,7 +150,7 @@ const totalPages = ref(0);
150
150
  const config = computed(() => getConfig(props as WalineProps));
151
151
 
152
152
  // eslint-disable-next-line vue/no-ref-object-destructure
153
- const commentSorting = ref(config.value.commentSorting);
153
+ const commentSortingRef = ref(config.value.commentSorting);
154
154
 
155
155
  const data = ref<WalineComment[]>([]);
156
156
  const reply = ref<WalineComment | null>(null);
@@ -177,7 +177,7 @@ const getCommentData = (pageNumber: number): void => {
177
177
  lang: config.value.lang,
178
178
  path,
179
179
  pageSize,
180
- sortBy: sortKeyMap[commentSorting.value],
180
+ sortBy: sortKeyMap[commentSortingRef.value],
181
181
  page: pageNumber,
182
182
  signal: controller.signal,
183
183
  token: userInfo.value?.token,
@@ -208,8 +208,8 @@ const refresh = (): void => {
208
208
  };
209
209
 
210
210
  const onSortByChange = (item: WalineCommentSorting): void => {
211
- if (commentSorting.value !== item) {
212
- commentSorting.value = item;
211
+ if (commentSortingRef.value !== item) {
212
+ commentSortingRef.value = item;
213
213
  refresh();
214
214
  }
215
215
  };
@@ -228,7 +228,7 @@ const onSubmit = (comment: WalineComment): void => {
228
228
  edit.value.orig = comment.orig;
229
229
  } else if (comment.rid) {
230
230
  const repliedComment = data.value.find(
231
- ({ objectId }) => objectId === comment.rid
231
+ ({ objectId }) => objectId === comment.rid,
232
232
  );
233
233
 
234
234
  if (!repliedComment) return;
@@ -303,7 +303,7 @@ const onDelete = async ({ objectId }: WalineComment): Promise<void> => {
303
303
  return item.children.some((child, childIndex) => {
304
304
  if (child.objectId === objectId) {
305
305
  data.value[index].children = item.children.filter(
306
- (_item, i) => i !== childIndex
306
+ (_item, i) => i !== childIndex,
307
307
  );
308
308
 
309
309
  return true;
@@ -346,7 +346,7 @@ onMounted(() => {
346
346
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return
347
347
  () => [props.serverURL, props.path],
348
348
  () => refresh(),
349
- { immediate: true }
349
+ { immediate: true },
350
350
  );
351
351
  });
352
352
  onUnmounted(() => abort?.());
@@ -8,6 +8,7 @@ interface TurnstileOptions {
8
8
  }
9
9
  interface TurnstileInstance {
10
10
  ready: (fn: () => void) => void;
11
+ excute: (className: string, options?: TurnstileOptions) => void;
11
12
  render: (className: string, options?: TurnstileOptions) => void;
12
13
  }
13
14
 
@@ -22,31 +23,28 @@ interface Turnstile {
22
23
  }
23
24
 
24
25
  export const useTurnstile = (key: string): Turnstile => {
25
- const execute = (action: string): Promise<string> =>
26
- new Promise((resolve) => {
27
- useScriptTag(
28
- 'https://challenges.cloudflare.com/turnstile/v0/api.js',
29
- () => {
30
- const turnstile = window?.turnstile;
31
-
32
- const options: TurnstileOptions = {
33
- sitekey: key,
34
- action,
35
- size: 'compact',
36
- callback(token: string): void {
37
- resolve(token);
38
- },
39
- };
40
-
41
- turnstile?.ready(() =>
42
- turnstile?.render('.wl-captcha-container', options)
43
- );
44
- },
45
- {
46
- async: false,
47
- }
48
- );
26
+ const execute = async (action: string): Promise<string> => {
27
+ const { load } = useScriptTag(
28
+ 'https://challenges.cloudflare.com/turnstile/v0/api.js',
29
+ undefined,
30
+ { async: false },
31
+ );
32
+
33
+ await load();
34
+
35
+ const turnstile = window?.turnstile;
36
+
37
+ return new Promise((resolve) => {
38
+ turnstile?.ready(() => {
39
+ turnstile?.render('.wl-captcha-container', {
40
+ sitekey: key,
41
+ action,
42
+ size: 'compact',
43
+ callback: resolve,
44
+ });
45
+ });
49
46
  });
47
+ };
50
48
 
51
49
  return { execute };
52
50
  };
@@ -12,5 +12,5 @@ let userInfoStorage: UserInfoRef | null = null;
12
12
  export const useUserInfo = (): UserInfoRef =>
13
13
  (userInfoStorage ??= useStorage<UserInfo | Record<string, never>>(
14
14
  USER_KEY,
15
- {}
15
+ {},
16
16
  ));