@waline/client 2.0.0 → 2.0.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 (50) hide show
  1. package/dist/component.js +1 -1
  2. package/dist/component.js.map +1 -1
  3. package/dist/legacy.js +1 -1
  4. package/dist/legacy.js.map +1 -1
  5. package/dist/pageview.cjs.js +1 -1
  6. package/dist/pageview.d.ts +1 -1
  7. package/dist/pageview.esm.js +1 -1
  8. package/dist/pageview.js +1 -1
  9. package/dist/shim.d.ts +30 -5
  10. package/dist/shim.esm.d.ts +30 -5
  11. package/dist/shim.esm.js +1 -1
  12. package/dist/shim.esm.js.map +1 -1
  13. package/dist/shim.js +1 -1
  14. package/dist/shim.js.map +1 -1
  15. package/dist/waline.cjs.d.ts +30 -5
  16. package/dist/waline.cjs.js +1 -1
  17. package/dist/waline.cjs.js.map +1 -1
  18. package/dist/waline.css +1 -1
  19. package/dist/waline.css.map +1 -1
  20. package/dist/waline.d.ts +30 -5
  21. package/dist/waline.esm.d.ts +30 -5
  22. package/dist/waline.esm.js +1 -1
  23. package/dist/waline.esm.js.map +1 -1
  24. package/dist/waline.js +1 -1
  25. package/dist/waline.js.map +1 -1
  26. package/package.json +15 -8
  27. package/src/comment.ts +1 -1
  28. package/src/compact/convert.ts +1 -1
  29. package/src/components/CommentBox.vue +15 -22
  30. package/src/components/CommentCard.vue +6 -3
  31. package/src/components/Waline.vue +6 -28
  32. package/src/composables/index.ts +1 -1
  33. package/src/composables/inputs.ts +9 -21
  34. package/src/composables/timeAgo.ts +61 -0
  35. package/src/composables/userInfo.ts +14 -21
  36. package/src/config/default.ts +2 -2
  37. package/src/entrys/legacy.ts +2 -2
  38. package/src/init.ts +1 -1
  39. package/src/styles/layout.scss +1 -1
  40. package/src/styles/panel.scss +0 -2
  41. package/src/typings/options.ts +1 -1
  42. package/src/utils/date.ts +17 -0
  43. package/src/utils/emoji.ts +8 -6
  44. package/src/utils/{data.ts → image.ts} +0 -0
  45. package/src/utils/index.ts +2 -3
  46. package/src/utils/markdown.ts +1 -1
  47. package/src/widgets/recentComments.ts +35 -5
  48. package/src/composables/store.ts +0 -38
  49. package/src/utils/timeAgo.ts +0 -75
  50. package/src/utils/userInfo.ts +0 -26
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waline/client",
3
- "version": "2.0.0",
3
+ "version": "2.0.3",
4
4
  "description": "client for waline comment system",
5
5
  "keywords": [
6
6
  "valine",
@@ -9,9 +9,15 @@
9
9
  "blog"
10
10
  ],
11
11
  "repository": {
12
- "url": "https://github.com/walinejs/waline"
12
+ "url": "https://github.com/walinejs/waline",
13
+ "directory": "packages/client"
13
14
  },
14
15
  "license": "MIT",
16
+ "author": {
17
+ "name": "Mr.Hope",
18
+ "email": "mister-hope@outlook.com",
19
+ "url": "https://mrhope.site"
20
+ },
15
21
  "exports": {
16
22
  ".": {
17
23
  "import": "./dist/shim.esm.js",
@@ -53,14 +59,15 @@
53
59
  ]
54
60
  },
55
61
  "dependencies": {
56
- "autosize": "5.0.1",
57
- "hanabi": "0.4.0",
58
- "marked": "4.0.14",
59
- "vue": "3.2.33"
62
+ "@vueuse/core": "^8.3.1",
63
+ "autosize": "^5.0.1",
64
+ "hanabi": "^0.4.0",
65
+ "marked": "^4.0.14",
66
+ "vue": "^3.2.33"
60
67
  },
61
68
  "devDependencies": {
62
- "@types/autosize": "4.0.1",
63
- "@types/marked": "4.0.3"
69
+ "@types/autosize": "^4.0.1",
70
+ "@types/marked": "^4.0.3"
64
71
  },
65
72
  "engines": {
66
73
  "node": ">=12.20.0"
package/src/comment.ts CHANGED
@@ -40,7 +40,7 @@ WalineCommentCountOptions): WalineAbort => {
40
40
  // comment count
41
41
  const elements = document.querySelectorAll<HTMLElement>(selector);
42
42
 
43
- const { userInfo } = useUserInfo();
43
+ const userInfo = useUserInfo();
44
44
 
45
45
  if (elements.length)
46
46
  void fetchCommentCount({
@@ -51,7 +51,7 @@ export const covertOptions = (
51
51
  warning(`Option "${item}" is REMOVED and CAN NOT be polyfilled!`)
52
52
  );
53
53
 
54
- // warnings with those which can no longr be handled
54
+ // warnings with those which is being polyfilled
55
55
  DROPPED_OPTIONS_WHICH_CAN_STILL_BE_POLYFILLED.filter(([oldOption]) =>
56
56
  Object.keys(options).includes(oldOption)
57
57
  ).forEach(([oldOption, newOption]) =>
@@ -58,10 +58,8 @@
58
58
  @paste="onPaste"
59
59
  />
60
60
 
61
- <div
62
- class="wl-preview"
63
- :style="{ display: showPreview ? 'block' : 'none' }"
64
- >
61
+ <div class="wl-preview" v-show="showPreview">
62
+ <hr />
65
63
  <h4>{{ locale.preview }}:</h4>
66
64
  <div class="wl-content" v-html="previewText" />
67
65
  </div>
@@ -275,8 +273,8 @@ export default defineComponent({
275
273
  setup(props, { emit }) {
276
274
  const config = inject<ComputedRef<Config>>('config') as ComputedRef<Config>;
277
275
 
278
- const { inputs, store } = useInputs();
279
- const { userInfo, setUserInfo } = useUserInfo();
276
+ const inputs = useInputs();
277
+ const userInfo = useUserInfo();
280
278
 
281
279
  const inputRefs = ref<Record<string, HTMLInputElement>>({});
282
280
  const editorRef = ref<HTMLTextAreaElement | null>(null);
@@ -310,7 +308,7 @@ export default defineComponent({
310
308
  const endPosition = textArea.selectionEnd || 0;
311
309
  const scrollTop = textArea.scrollTop;
312
310
 
313
- inputs.editor =
311
+ inputs.value.editor =
314
312
  textArea.value.substring(0, startPosition) +
315
313
  content +
316
314
  textArea.value.substring(endPosition, textArea.value.length);
@@ -335,7 +333,7 @@ export default defineComponent({
335
333
  return Promise.resolve()
336
334
  .then(() => (config.value.imageUploader as WalineImageUploader)(file))
337
335
  .then((url) => {
338
- inputs.editor = inputs.editor.replace(
336
+ inputs.value.editor = inputs.value.editor.replace(
339
337
  uploadText,
340
338
  `\r\n![${file.name}](${url})`
341
339
  );
@@ -376,9 +374,9 @@ export default defineComponent({
376
374
 
377
375
  const comment: WalineCommentData = {
378
376
  comment: content.value,
379
- nick: inputs.nick,
380
- mail: inputs.mail,
381
- link: inputs.link,
377
+ nick: inputs.value.nick,
378
+ mail: inputs.value.mail,
379
+ link: inputs.value.link,
382
380
  ua: navigator.userAgent,
383
381
  url: config.value.path,
384
382
  };
@@ -443,18 +441,12 @@ export default defineComponent({
443
441
  .then((resp) => {
444
442
  isSubmitting.value = false;
445
443
 
446
- store.update({
447
- nick: comment.nick,
448
- link: comment.link,
449
- mail: comment.mail,
450
- });
451
-
452
444
  if (resp.errmsg) return alert(resp.errmsg);
453
445
 
454
446
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
455
447
  emit('submit', resp.data!);
456
448
 
457
- inputs.editor = '';
449
+ inputs.value.editor = '';
458
450
 
459
451
  previewText.value = '';
460
452
 
@@ -490,7 +482,7 @@ export default defineComponent({
490
482
 
491
483
  if (data.data.token) {
492
484
  handler?.close();
493
- setUserInfo(data.data);
485
+ userInfo.value = data.data;
494
486
  (data.data.remember ? localStorage : sessionStorage).setItem(
495
487
  'WALINE_USER',
496
488
  JSON.stringify(data.data)
@@ -504,7 +496,7 @@ export default defineComponent({
504
496
  };
505
497
 
506
498
  const onLogout = (): void => {
507
- setUserInfo({});
499
+ userInfo.value = {};
508
500
  localStorage.setItem('WALINE_USER', 'null');
509
501
  sessionStorage.setItem('WALINE_USER', 'null');
510
502
  };
@@ -531,7 +523,8 @@ export default defineComponent({
531
523
  const receiver = ({ data }: any): void => {
532
524
  if (!data || data.type !== 'profile') return;
533
525
 
534
- setUserInfo(Object.assign({}, userInfo.value, data));
526
+ userInfo.value = { ...userInfo.value, ...data };
527
+
535
528
  [localStorage, sessionStorage]
536
529
  .filter((store) => store.getItem('WALINE_USER'))
537
530
  .forEach((store) =>
@@ -553,7 +546,7 @@ export default defineComponent({
553
546
 
554
547
  // watch editor
555
548
  watch(
556
- () => inputs.editor,
549
+ () => inputs.value.editor,
557
550
  (value) => {
558
551
  const { highlighter, texRenderer } = config.value;
559
552
 
@@ -24,7 +24,7 @@
24
24
  />
25
25
  <span v-if="comment.sticky" class="wl-badge" v-text="locale.sticky" />
26
26
 
27
- <span class="wl-time" v-text="timeAgo(comment.insertedAt, locale)" />
27
+ <span class="wl-time" v-text="time" />
28
28
 
29
29
  <button
30
30
  class="wl-reply"
@@ -69,7 +69,8 @@
69
69
  import { computed, defineComponent, inject } from 'vue';
70
70
  import CommentBox from './CommentBox.vue';
71
71
  import { ReplyIcon, VerifiedIcon } from './Icons';
72
- import { isLinkHttp, timeAgo } from '../utils';
72
+ import { isLinkHttp } from '../utils';
73
+ import { useTimeAgo } from '../composables';
73
74
 
74
75
  import type { ComputedRef, PropType } from 'vue';
75
76
  import type { Config } from '../utils';
@@ -108,6 +109,8 @@ export default defineComponent({
108
109
  return link ? (isLinkHttp(link) ? link : `https://${link}`) : '';
109
110
  });
110
111
 
112
+ const time = useTimeAgo(props.comment.insertedAt, locale.value);
113
+
111
114
  const isReplyingCurrent = computed(
112
115
  () => props.comment.objectId === props.reply?.objectId
113
116
  );
@@ -118,7 +121,7 @@ export default defineComponent({
118
121
 
119
122
  isReplyingCurrent,
120
123
  link,
121
- timeAgo,
124
+ time,
122
125
  };
123
126
  },
124
127
  });
@@ -18,7 +18,7 @@
18
18
  />
19
19
  </div>
20
20
 
21
- <div v-if="status === 'error'" class="wl-action">
21
+ <div v-if="status === 'error'" class="wl-operation">
22
22
  <button
23
23
  type="button"
24
24
  class="wl-btn"
@@ -35,7 +35,7 @@
35
35
  <div v-else-if="!data.length" class="wl-empty" v-text="i18n.sofa" />
36
36
 
37
37
  <!-- Load more button -->
38
- <div v-else-if="page < totalPages" class="wl-more">
38
+ <div v-else-if="page < totalPages" class="wl-operation">
39
39
  <button
40
40
  type="button"
41
41
  class="wl-btn"
@@ -114,7 +114,6 @@ export default defineComponent({
114
114
 
115
115
  meta: {
116
116
  type: Array,
117
- // default: (): Meta[] => ['nick', 'mail', 'link'],
118
117
  ...(SHOULD_VALIDATE
119
118
  ? {
120
119
  validator: (value: unknown): boolean =>
@@ -126,7 +125,6 @@ export default defineComponent({
126
125
 
127
126
  requiredMeta: {
128
127
  type: Array,
129
- // default: (): Meta[] => [],
130
128
  ...(SHOULD_VALIDATE
131
129
  ? {
132
130
  validator: (value: unknown): boolean =>
@@ -138,17 +136,14 @@ export default defineComponent({
138
136
 
139
137
  visitor: {
140
138
  type: Boolean,
141
- // default: false,
142
139
  },
143
140
 
144
141
  dark: {
145
142
  type: [String, Boolean],
146
- // default: false,
147
143
  },
148
144
 
149
145
  lang: {
150
146
  type: String,
151
- // default: 'zh-CN',
152
147
  ...(SHOULD_VALIDATE
153
148
  ? {
154
149
  validator: (value: unknown): boolean =>
@@ -163,7 +158,6 @@ export default defineComponent({
163
158
 
164
159
  pageSize: {
165
160
  type: Number,
166
- // default: 10,
167
161
  },
168
162
 
169
163
  wordLimit: {
@@ -182,9 +176,6 @@ export default defineComponent({
182
176
 
183
177
  emoji: {
184
178
  type: Array as PropType<(string | WalineEmojiInfo)[]>,
185
- // default: (): string[] => [
186
- // 'https://cdn.jsdelivr.net/gh/walinejs/emojis/weibo',
187
- // ],
188
179
  ...(SHOULD_VALIDATE
189
180
  ? {
190
181
  validator: (value: unknown): boolean =>
@@ -207,38 +198,25 @@ export default defineComponent({
207
198
 
208
199
  login: {
209
200
  type: String as PropType<'enable' | 'disable' | 'force'>,
210
- // default: 'enable',
211
201
  },
212
202
 
213
203
  highlighter: {
214
204
  type: Function as PropType<WalineHighlighter>,
215
- // default: (text: string): string => text,
216
205
  },
217
206
 
218
207
  imageUploader: {
219
- type: [Function, false] as PropType<WalineImageUploader>,
220
- // default: (file: File): Promise<string> =>
221
- // new Promise((resolve, reject) => {
222
- // const reader = new FileReader();
223
- // reader.readAsDataURL(file);
224
- // reader.onload = (): void => resolve(reader.result?.toString() || '');
225
- // reader.onerror = reject;
226
- // }),
208
+ type: [Function, Boolean] as PropType<WalineImageUploader | false>,
227
209
  },
228
210
 
229
- texRender: {
230
- type: Function as PropType<WalineTexRenderer>,
231
- // default: (blockMode: boolean): string =>
232
- // blockMode === true
233
- // ? '<p class="vtex">Tex is not available in preview</p>'
234
- // : '<span class="vtex">Tex is not available in preview</span>',
211
+ texRenderer: {
212
+ type: [Function, Boolean] as PropType<WalineTexRenderer | false>,
235
213
  },
236
214
  },
237
215
 
238
216
  setup(props) {
239
217
  const config = computed(() => getConfig(props as WalineProps));
240
218
 
241
- const { userInfo } = useUserInfo();
219
+ const userInfo = useUserInfo();
242
220
 
243
221
  const status = ref<'loading' | 'success' | 'error'>('loading');
244
222
 
@@ -1,3 +1,3 @@
1
1
  export * from './inputs';
2
+ export * from './timeAgo';
2
3
  export * from './userInfo';
3
- export * from './store';
@@ -1,7 +1,5 @@
1
- import { reactive } from 'vue';
2
- import { useStore } from './store';
3
-
4
- import type { Store } from './store';
1
+ import { useStorage } from '@vueuse/core';
2
+ import type { RemovableRef } from '@vueuse/core';
5
3
 
6
4
  export interface Inputs {
7
5
  nick: string;
@@ -10,20 +8,10 @@ export interface Inputs {
10
8
  editor: string;
11
9
  }
12
10
 
13
- let store: Store;
14
- let inputs: Inputs;
15
-
16
- export const useInputs = (): { inputs: Inputs; store: Store } => {
17
- if (!inputs) {
18
- store = useStore('WALINE_USER_CACHE');
19
-
20
- inputs = reactive({
21
- nick: store.get<string>('nick') || '',
22
- mail: store.get<string>('mail') || '',
23
- link: store.get<string>('link') || '',
24
- editor: '',
25
- });
26
- }
27
-
28
- return { inputs, store };
29
- };
11
+ export const useInputs = (): RemovableRef<Inputs> =>
12
+ useStorage<Inputs>('WALINE_USER_CACHE', {
13
+ nick: '',
14
+ mail: '',
15
+ link: '',
16
+ editor: '',
17
+ });
@@ -0,0 +1,61 @@
1
+ import { useNow } from '@vueuse/core';
2
+ import { computed } from 'vue';
3
+ import { dateFormat } from '../utils';
4
+
5
+ import type { ComputedRef } from 'vue';
6
+ import type { WalineLocale } from '../typings';
7
+
8
+ export const useTimeAgo = (
9
+ date: Date | string,
10
+ locale: WalineLocale
11
+ ): ComputedRef<string> => {
12
+ const now = useNow();
13
+
14
+ return computed(() => {
15
+ if (!date) return '';
16
+
17
+ const time =
18
+ typeof date === 'string'
19
+ ? new Date(date.indexOf(' ') !== -1 ? date.replace(/-/g, '/') : date)
20
+ : date;
21
+
22
+ const timepassed = now.value.getTime() - time.getTime();
23
+
24
+ const days = Math.floor(timepassed / (24 * 3600 * 1000));
25
+
26
+ if (days === 0) {
27
+ // 计算相差小时数
28
+
29
+ // 计算天数后剩余的毫秒数
30
+ const leave1 = timepassed % (24 * 3600 * 1000);
31
+ const hours = Math.floor(leave1 / (3600 * 1000));
32
+
33
+ if (hours === 0) {
34
+ //计算相差分钟数
35
+
36
+ // 计算小时数后剩余的毫秒数
37
+ const leave2 = leave1 % (3600 * 1000);
38
+ const minutes = Math.floor(leave2 / (60 * 1000));
39
+
40
+ // 计算相差秒数
41
+ if (minutes === 0) {
42
+ // 计算分钟数后剩余的毫秒数
43
+ const leave3 = leave2 % (60 * 1000);
44
+ const seconds = Math.round(leave3 / 1000);
45
+
46
+ return `${seconds} ${locale.seconds}`;
47
+ }
48
+
49
+ return `${minutes} ${locale.minutes}`;
50
+ }
51
+
52
+ return `${hours} ${locale.hours}`;
53
+ }
54
+
55
+ if (days < 0) return locale.now;
56
+
57
+ if (days < 8) return `${days} ${locale.days}`;
58
+
59
+ return dateFormat(time);
60
+ });
61
+ };
@@ -1,27 +1,20 @@
1
- import { readonly, ref } from 'vue';
2
- import { getUserInfo } from '../utils';
1
+ import { useStorage } from '@vueuse/core';
3
2
 
4
3
  import type { Ref } from 'vue';
5
- import type { UserInfo } from '../utils';
6
4
 
7
- export type UserInfoRef = Ref<UserInfo | Record<string, never>>;
8
-
9
- const userInfo: UserInfoRef = ref({});
5
+ export interface UserInfo {
6
+ // eslint-disable-next-line @typescript-eslint/naming-convention
7
+ display_name: string;
8
+ email: string;
9
+ url: string;
10
+ token: string;
11
+ avatar: string;
12
+ mailMd5: string;
13
+ }
10
14
 
11
- export const useUserInfo = (): {
12
- userInfo: UserInfoRef;
13
- setUserInfo: (userInfo: UserInfo | Record<string, never>) => void;
14
- } => {
15
- if (!userInfo.value.token) {
16
- const info = getUserInfo();
15
+ export const USER_KEY = 'WALINE_USER';
17
16
 
18
- if (info) userInfo.value = info;
19
- }
17
+ export type UserInfoRef = Ref<UserInfo | Record<string, never>>;
20
18
 
21
- return {
22
- userInfo: readonly(userInfo),
23
- setUserInfo: (info: UserInfo | Record<string, never>): void => {
24
- userInfo.value = info;
25
- },
26
- };
27
- };
19
+ export const useUserInfo = (): UserInfoRef =>
20
+ useStorage<UserInfo | Record<string, never>>('USER_KEY', {});
@@ -17,5 +17,5 @@ export const defaultUploadImage = (file: File): Promise<string> =>
17
17
 
18
18
  export const defaultTexRenderer = (blockMode: boolean): string =>
19
19
  blockMode === true
20
- ? '<p class="vtex">Tex is not available in preview</p>'
21
- : '<span class="vtex">Tex is not available in preview</span>';
20
+ ? '<p class="wl-tex">Tex is not available in preview</p>'
21
+ : '<span class="wl-tex">Tex is not available in preview</span>';
@@ -10,7 +10,7 @@ import type { WalineInitOptions } from '../typings';
10
10
  export { WalineInstance } from '../init';
11
11
 
12
12
  warning(
13
- ' This is a legacy package compatable with Valine and Waline@v1, please switch to Waline@v2 using https://<CDN.LINK>/@waline/client@next/dist/waline.js instead!'
13
+ ' This is a legacy package compatable with Valine and Waline@v1, please switch to Waline@v2 using https://<CDN.LINK>/@waline/client/dist/waline.js instead!'
14
14
  );
15
15
 
16
16
  // inject css styles
@@ -18,7 +18,7 @@ warning(
18
18
  const link = document.createElement('link');
19
19
 
20
20
  link.rel = 'stylesheet';
21
- link.href = '//cdn.jsdelivr.net/npm/@waline/client@next/dist/waline.css';
21
+ link.href = '//cdn.jsdelivr.net/npm/@waline/client/dist/waline.css';
22
22
 
23
23
  document.head.appendChild(link);
24
24
 
package/src/init.ts CHANGED
@@ -97,7 +97,7 @@ export const init = ({
97
97
  path = window.location.pathname,
98
98
  ...newProps
99
99
  }: Partial<Omit<WalineInitOptions, 'el'>>): void => {
100
- Object.entries(newProps).map(([key, value]) => {
100
+ Object.entries(newProps).forEach(([key, value]) => {
101
101
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
102
102
  // @ts-ignore
103
103
  // eslint-disable-next-line
@@ -62,7 +62,7 @@
62
62
  text-align: center;
63
63
  }
64
64
 
65
- .wl-more {
65
+ .wl-operation {
66
66
  text-align: center;
67
67
 
68
68
  button {
@@ -196,8 +196,6 @@
196
196
  .wl-content {
197
197
  min-height: 1.25em;
198
198
  padding: 0.25em;
199
- border: var(--waline-border);
200
- border-radius: 0.25em;
201
199
 
202
200
  word-break: break-word;
203
201
  hyphens: auto;
@@ -41,4 +41,4 @@ export interface WalineInitOptions extends Omit<WalineProps, 'path'> {
41
41
  }
42
42
 
43
43
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
44
- export type WalineAbort = (reson: any) => void;
44
+ export type WalineAbort = (reason?: any) => void;
@@ -0,0 +1,17 @@
1
+ const padWithZeros = (vNumber: number, width: number): string => {
2
+ let numAsString = vNumber.toString();
3
+
4
+ while (numAsString.length < width) {
5
+ numAsString = '0' + numAsString;
6
+ }
7
+
8
+ return numAsString;
9
+ };
10
+
11
+ export const dateFormat = (date: Date): string => {
12
+ const vDay = padWithZeros(date.getDate(), 2);
13
+ const vMonth = padWithZeros(date.getMonth() + 1, 2);
14
+ const vYear = padWithZeros(date.getFullYear(), 2);
15
+
16
+ return `${vYear}-${vMonth}-${vDay}`;
17
+ };
@@ -1,21 +1,23 @@
1
- import { Store, useStore } from '../composables/store';
1
+ import { useStorage } from '@vueuse/core';
2
2
  import { removeEndingSplash } from './path';
3
3
 
4
4
  import type { EmojiConfig } from './config';
5
5
  import type { WalineEmojiInfo } from '../typings';
6
6
 
7
- let store: Store;
8
-
9
7
  const hasVersion = (url: string): boolean =>
10
8
  Boolean(/@[0-9]+\.[0-9]+\.[0-9]+/.test(url));
11
9
 
12
10
  const fetchEmoji = (link: string): Promise<WalineEmojiInfo> => {
13
- if (!store) store = useStore('WALINE_EMOJI');
11
+ const emojiStore = useStorage<Record<string, WalineEmojiInfo>>(
12
+ 'WALINE_EMOJI',
13
+ {}
14
+ );
14
15
 
15
16
  const result = hasVersion(link);
16
17
 
17
18
  if (result) {
18
- const info = store.get<WalineEmojiInfo>(link);
19
+ const info = emojiStore.value.link;
20
+
19
21
  if (info) return Promise.resolve(info);
20
22
  }
21
23
 
@@ -27,7 +29,7 @@ const fetchEmoji = (link: string): Promise<WalineEmojiInfo> => {
27
29
  ...emojiInfo,
28
30
  };
29
31
 
30
- if (result) store.set(link, info);
32
+ if (result) emojiStore.value.link = info;
31
33
 
32
34
  return info;
33
35
  });
File without changes
@@ -1,13 +1,12 @@
1
1
  export * from './config';
2
2
  export * from './darkmode';
3
- export * from './data';
3
+ export * from './date';
4
4
  export * from './emoji';
5
5
  export * from './error';
6
6
  export * from './fetch';
7
7
  export * from './getRoot';
8
+ export * from './image';
8
9
  export * from './markdown';
9
10
  export * from './path';
10
11
  export * from './query';
11
- export * from './timeAgo';
12
- export * from './userInfo';
13
12
  export * from './wordCount';
@@ -10,7 +10,7 @@ import type {
10
10
  export const parseEmoji = (text = '', emojiMap: WalineEmojiMaps = {}): string =>
11
11
  text.replace(/:(.+?):/g, (placeholder, key: string) =>
12
12
  emojiMap[key]
13
- ? `<img class="vemoji" src="${emojiMap[key]}" alt="${key}">`
13
+ ? `<img class="wl-emoji" src="${emojiMap[key]}" alt="${key}">`
14
14
  : placeholder
15
15
  );
16
16