@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.
- package/dist/api.cjs.map +1 -1
- package/dist/api.d.cts +4 -0
- package/dist/api.d.mts +4 -0
- package/dist/api.d.ts +4 -0
- package/dist/api.mjs.map +1 -1
- package/dist/comment.cjs +1 -1
- package/dist/comment.cjs.map +1 -1
- package/dist/comment.js +1 -1
- package/dist/comment.js.map +1 -1
- package/dist/comment.mjs +1 -1
- package/dist/comment.mjs.map +1 -1
- package/dist/component.mjs +1 -1
- package/dist/component.mjs.map +1 -1
- package/dist/legacy.umd.d.ts +92 -88
- package/dist/legacy.umd.js +1 -1
- package/dist/legacy.umd.js.map +1 -1
- package/dist/pageview.cjs +1 -1
- package/dist/pageview.cjs.map +1 -1
- package/dist/pageview.js +1 -1
- package/dist/pageview.js.map +1 -1
- package/dist/pageview.mjs +1 -1
- package/dist/pageview.mjs.map +1 -1
- package/dist/shim.cjs +1 -1
- package/dist/shim.cjs.map +1 -1
- package/dist/shim.d.cts +10 -2
- package/dist/shim.d.mts +10 -2
- package/dist/shim.mjs +1 -1
- package/dist/shim.mjs.map +1 -1
- package/dist/waline.cjs +1 -1
- package/dist/waline.cjs.map +1 -1
- package/dist/waline.css +1 -1
- package/dist/waline.css.map +1 -1
- package/dist/waline.d.cts +10 -2
- package/dist/waline.d.mts +10 -2
- package/dist/waline.d.ts +10 -2
- package/dist/waline.js +1 -1
- package/dist/waline.js.map +1 -1
- package/dist/waline.mjs +1 -1
- package/dist/waline.mjs.map +1 -1
- package/package.json +7 -17
- package/src/api/articleCounter.ts +1 -2
- package/src/api/comment.ts +10 -3
- package/src/api/commentCount.ts +1 -1
- package/src/api/login.ts +1 -1
- package/src/api/pageview.ts +2 -2
- package/src/api/recentComment.ts +2 -2
- package/src/api/user.ts +6 -3
- package/src/comment.ts +3 -3
- package/src/compact/convert.ts +6 -7
- package/src/compact/v1.ts +5 -5
- package/src/compact/valine.ts +6 -6
- package/src/components/ArticleReaction.vue +3 -4
- package/src/components/CommentBox.vue +62 -49
- package/src/components/CommentCard.vue +8 -7
- package/src/components/Icons.ts +4 -3
- package/src/components/ImageWall.vue +1 -2
- package/src/components/WalineComment.vue +8 -7
- package/src/composables/inputs.ts +1 -2
- package/src/composables/like.ts +1 -2
- package/src/composables/reaction.ts +1 -2
- package/src/composables/recaptchaV3.ts +1 -3
- package/src/composables/turnstile.ts +79 -0
- package/src/composables/userInfo.ts +2 -2
- package/src/config/default.ts +23 -22
- package/src/config/i18n/generate.ts +1 -1
- package/src/config/i18n/index.ts +8 -9
- package/src/entries/full.ts +1 -1
- package/src/entries/init.ts +1 -1
- package/src/entries/legacy.ts +10 -10
- package/src/init.ts +4 -5
- package/src/pageview.ts +3 -4
- package/src/shims-vue.d.ts +2 -1
- package/src/styles/card.scss +16 -14
- package/src/styles/emoji.scss +0 -3
- package/src/styles/index.scss +0 -5
- package/src/typings/comment.ts +5 -0
- package/src/typings/options.ts +1 -1
- package/src/typings/waline.ts +17 -12
- package/src/utils/config.ts +19 -19
- package/src/utils/emoji.ts +3 -3
- package/src/utils/index.ts +12 -11
- package/src/utils/markdown.ts +6 -6
- package/src/utils/markedMathExtension.ts +3 -2
- package/src/utils/userAgent.ts +1 -1
- package/src/utils/wordCount.ts +1 -1
- package/src/widgets/recentComments.ts +4 -5
- package/src/widgets/userList.ts +2 -2
package/src/config/default.ts
CHANGED
|
@@ -1,21 +1,31 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type {
|
|
3
|
-
WalineEmojiPresets,
|
|
4
|
-
WalineMeta,
|
|
5
|
-
WalineSearchOptions,
|
|
6
|
-
WalineSearchResult,
|
|
7
|
-
} from '../typings';
|
|
1
|
+
import { type IGif } from '@giphy/js-types';
|
|
8
2
|
|
|
9
|
-
|
|
3
|
+
import {
|
|
4
|
+
type WalineEmojiPresets,
|
|
5
|
+
type WalineMeta,
|
|
6
|
+
type WalineSearchOptions,
|
|
7
|
+
type WalineSearchResult,
|
|
8
|
+
} from '../typings/index.js';
|
|
9
|
+
|
|
10
|
+
const AVAILABLE_META: WalineMeta[] = ['nick', 'mail', 'link'];
|
|
10
11
|
|
|
11
12
|
export const getMeta = (meta: WalineMeta[]): WalineMeta[] =>
|
|
12
|
-
meta.filter((item) =>
|
|
13
|
+
meta.filter((item) => AVAILABLE_META.includes(item));
|
|
13
14
|
|
|
14
|
-
export const
|
|
15
|
+
export const DEFAULT_EMOJI: WalineEmojiPresets[] = [
|
|
15
16
|
'//unpkg.com/@waline/emojis@1.1.0/weibo',
|
|
16
17
|
];
|
|
17
18
|
|
|
18
|
-
export const
|
|
19
|
+
export const DEFAULT_LANG = 'en-US';
|
|
20
|
+
|
|
21
|
+
export const DEFAULT_REACTION = [
|
|
22
|
+
'//unpkg.com/@waline/emojis/tieba/tieba_agree.png',
|
|
23
|
+
'//unpkg.com/@waline/emojis/tieba/tieba_look_down.png',
|
|
24
|
+
'//unpkg.com/@waline/emojis/tieba/tieba_sunglasses.png',
|
|
25
|
+
'//unpkg.com/@waline/emojis/tieba/tieba_pick_nose.png',
|
|
26
|
+
'//unpkg.com/@waline/emojis/tieba/tieba_awkward.png',
|
|
27
|
+
'//unpkg.com/@waline/emojis/tieba/tieba_sleep.png',
|
|
28
|
+
];
|
|
19
29
|
|
|
20
30
|
export const defaultUploadImage = (file: File): Promise<string> =>
|
|
21
31
|
new Promise((resolve, reject) => {
|
|
@@ -35,7 +45,7 @@ export const defaultTexRenderer = (blockMode: boolean): string =>
|
|
|
35
45
|
: '<span class="wl-tex">Tex is not available in preview</span>';
|
|
36
46
|
|
|
37
47
|
export const getDefaultSearchOptions = (lang: string): WalineSearchOptions => {
|
|
38
|
-
interface
|
|
48
|
+
interface GifResult {
|
|
39
49
|
data: IGif[];
|
|
40
50
|
meta: {
|
|
41
51
|
msg: string;
|
|
@@ -65,7 +75,7 @@ export const getDefaultSearchOptions = (lang: string): WalineSearchOptions => {
|
|
|
65
75
|
...params,
|
|
66
76
|
}).toString()}`
|
|
67
77
|
)
|
|
68
|
-
.then((resp) => <Promise<
|
|
78
|
+
.then((resp) => <Promise<GifResult>>resp.json())
|
|
69
79
|
.then(({ data }) =>
|
|
70
80
|
data.map((gif) => ({
|
|
71
81
|
title: gif.title,
|
|
@@ -81,12 +91,3 @@ export const getDefaultSearchOptions = (lang: string): WalineSearchOptions => {
|
|
|
81
91
|
fetchGiphy('search', { q: word, offset: offset.toString() }),
|
|
82
92
|
};
|
|
83
93
|
};
|
|
84
|
-
|
|
85
|
-
export const defaultReaction = [
|
|
86
|
-
'//unpkg.com/@waline/emojis/tieba/tieba_agree.png',
|
|
87
|
-
'//unpkg.com/@waline/emojis/tieba/tieba_look_down.png',
|
|
88
|
-
'//unpkg.com/@waline/emojis/tieba/tieba_sunglasses.png',
|
|
89
|
-
'//unpkg.com/@waline/emojis/tieba/tieba_pick_nose.png',
|
|
90
|
-
'//unpkg.com/@waline/emojis/tieba/tieba_awkward.png',
|
|
91
|
-
'//unpkg.com/@waline/emojis/tieba/tieba_sleep.png',
|
|
92
|
-
];
|
package/src/config/i18n/index.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
-
import en from './en';
|
|
3
|
-
import jp from './jp';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
import type { WalineLocale } from '../../typings';
|
|
2
|
+
import en from './en.js';
|
|
3
|
+
import jp from './jp.js';
|
|
4
|
+
import ptBR from './pt-BR.js';
|
|
5
|
+
import ru from './ru.js';
|
|
6
|
+
import zhCN from './zh-CN.js';
|
|
7
|
+
import zhTW from './zh-TW.js';
|
|
8
|
+
import { type WalineLocale } from '../../typings/index.js';
|
|
10
9
|
|
|
11
10
|
export type Locales = Record<string, WalineLocale>;
|
|
12
11
|
|
|
13
|
-
export const
|
|
12
|
+
export const DEFAULT_LOCALES: Locales = {
|
|
14
13
|
zh: zhCN,
|
|
15
14
|
'zh-cn': zhCN,
|
|
16
15
|
'zh-CN': zhCN,
|
package/src/entries/full.ts
CHANGED
package/src/entries/init.ts
CHANGED
package/src/entries/legacy.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from '../
|
|
8
|
-
import type
|
|
9
|
-
|
|
10
|
-
export { WalineInstance } from '../init';
|
|
1
|
+
import {
|
|
2
|
+
type DeprecatedValineOptions,
|
|
3
|
+
type DeprecatedWalineOptions,
|
|
4
|
+
covertOptions,
|
|
5
|
+
warning,
|
|
6
|
+
} from '../compact/index.js';
|
|
7
|
+
import { init, WalineInstance } from '../init.js';
|
|
8
|
+
import { type WalineInitOptions } from '../typings/index.js';
|
|
9
|
+
|
|
10
|
+
export { WalineInstance } from '../init.js';
|
|
11
11
|
|
|
12
12
|
warning(
|
|
13
13
|
' This is a legacy package compatible with Valine and Waline@v1, please switch to Waline@v2 using https://<CDN.LINK>/@waline/client/dist/waline.js instead!'
|
package/src/init.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { createApp, h, reactive, watchEffect } from 'vue';
|
|
2
2
|
|
|
3
|
+
import { commentCount } from './comment.js';
|
|
3
4
|
import Waline from './components/WalineComment.vue';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { getRoot } from './utils';
|
|
7
|
-
|
|
8
|
-
import type { WalineInitOptions } from './typings';
|
|
5
|
+
import { pageviewCount } from './pageview.js';
|
|
6
|
+
import { type WalineInitOptions } from './typings/index.js';
|
|
7
|
+
import { getRoot } from './utils/index.js';
|
|
9
8
|
|
|
10
9
|
export interface WalineInstance {
|
|
11
10
|
/**
|
package/src/pageview.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { getPageview, updatePageview } from './api';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import type { WalineAbort } from './typings';
|
|
1
|
+
import { getPageview, updatePageview } from './api/index.js';
|
|
2
|
+
import { type WalineAbort } from './typings/index.js';
|
|
3
|
+
import { errorHandler, getQuery, getServerURL } from './utils/index.js';
|
|
5
4
|
|
|
6
5
|
export interface WalinePageviewCountOptions {
|
|
7
6
|
/**
|
package/src/shims-vue.d.ts
CHANGED
package/src/styles/card.scss
CHANGED
|
@@ -49,32 +49,34 @@
|
|
|
49
49
|
margin-inline-start: 1em;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
.wl-card-item:last-child & {
|
|
52
|
+
.wl-card-item:last-child > & {
|
|
53
53
|
border-bottom: none;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
.wl-nick {
|
|
57
|
+
svg {
|
|
58
|
+
position: relative;
|
|
59
|
+
bottom: -0.125em;
|
|
60
|
+
line-height: 1;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
56
64
|
.wl-head {
|
|
57
65
|
// bfc to fix https://github.com/walinejs/waline/issues/1415
|
|
58
66
|
overflow: hidden;
|
|
59
67
|
line-height: 1.5;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.wl-nick {
|
|
63
|
-
position: relative;
|
|
64
68
|
|
|
65
|
-
|
|
69
|
+
.wl-nick {
|
|
70
|
+
position: relative;
|
|
66
71
|
|
|
67
|
-
|
|
72
|
+
display: inline-block;
|
|
68
73
|
|
|
69
|
-
|
|
70
|
-
font-size: 0.875em;
|
|
71
|
-
line-height: 1;
|
|
72
|
-
text-decoration: none;
|
|
74
|
+
margin-inline-end: 0.5em;
|
|
73
75
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
bottom: -0.125em;
|
|
76
|
+
font-weight: bold;
|
|
77
|
+
font-size: 0.875em;
|
|
77
78
|
line-height: 1;
|
|
79
|
+
text-decoration: none;
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
|
package/src/styles/emoji.scss
CHANGED
package/src/styles/index.scss
CHANGED
package/src/typings/comment.ts
CHANGED
package/src/typings/options.ts
CHANGED
package/src/typings/waline.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
WalineCommentSorting,
|
|
3
|
-
WalineHighlighter,
|
|
4
|
-
WalineEmojiInfo,
|
|
5
|
-
WalineEmojiPresets,
|
|
6
|
-
WalineImageUploader,
|
|
7
|
-
WalineLoginStatus,
|
|
8
|
-
WalineMeta,
|
|
9
|
-
WalineTexRenderer,
|
|
10
|
-
WalineSearchOptions,
|
|
11
|
-
} from './base';
|
|
12
|
-
import type
|
|
1
|
+
import {
|
|
2
|
+
type WalineCommentSorting,
|
|
3
|
+
type WalineHighlighter,
|
|
4
|
+
type WalineEmojiInfo,
|
|
5
|
+
type WalineEmojiPresets,
|
|
6
|
+
type WalineImageUploader,
|
|
7
|
+
type WalineLoginStatus,
|
|
8
|
+
type WalineMeta,
|
|
9
|
+
type WalineTexRenderer,
|
|
10
|
+
type WalineSearchOptions,
|
|
11
|
+
} from './base.js';
|
|
12
|
+
import { type WalineLocale } from './locale.js';
|
|
13
13
|
|
|
14
14
|
export interface WalineProps {
|
|
15
15
|
/**
|
|
@@ -239,6 +239,11 @@ export interface WalineProps {
|
|
|
239
239
|
*/
|
|
240
240
|
recaptchaV3Key?: string;
|
|
241
241
|
|
|
242
|
+
/**
|
|
243
|
+
* turnstile client key
|
|
244
|
+
*/
|
|
245
|
+
turnstileKey?: string;
|
|
246
|
+
|
|
242
247
|
/**
|
|
243
248
|
* reaction
|
|
244
249
|
*/
|
package/src/utils/config.ts
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
|
+
import { decodePath, isLinkHttp, removeEndingSplash } from './path.js';
|
|
1
2
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
DEFAULT_EMOJI,
|
|
4
|
+
DEFAULT_LANG,
|
|
5
|
+
DEFAULT_LOCALES,
|
|
6
|
+
DEFAULT_REACTION,
|
|
6
7
|
defaultUploadImage,
|
|
7
8
|
defaultHighlighter,
|
|
8
9
|
defaultTexRenderer,
|
|
9
10
|
getDefaultSearchOptions,
|
|
10
11
|
getMeta,
|
|
11
|
-
} from '../config';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
WalineLocale,
|
|
19
|
-
WalineProps,
|
|
20
|
-
} from '../typings';
|
|
12
|
+
} from '../config/index.js';
|
|
13
|
+
import {
|
|
14
|
+
type WalineEmojiInfo,
|
|
15
|
+
type WalineEmojiMaps,
|
|
16
|
+
type WalineLocale,
|
|
17
|
+
type WalineProps,
|
|
18
|
+
} from '../typings/index.js';
|
|
21
19
|
|
|
22
20
|
export interface WalineEmojiConfig {
|
|
23
21
|
tabs: Pick<WalineEmojiInfo, 'name' | 'icon' | 'items'>[];
|
|
@@ -70,7 +68,7 @@ export const getConfig = ({
|
|
|
70
68
|
path = location.pathname,
|
|
71
69
|
lang = typeof navigator === 'undefined' ? 'en-US' : navigator.language,
|
|
72
70
|
locale,
|
|
73
|
-
emoji =
|
|
71
|
+
emoji = DEFAULT_EMOJI,
|
|
74
72
|
meta = ['nick', 'mail', 'link'],
|
|
75
73
|
requiredMeta = [],
|
|
76
74
|
dark = false,
|
|
@@ -84,13 +82,14 @@ export const getConfig = ({
|
|
|
84
82
|
search,
|
|
85
83
|
reaction,
|
|
86
84
|
recaptchaV3Key = '',
|
|
85
|
+
turnstileKey = '',
|
|
87
86
|
commentSorting = 'latest',
|
|
88
87
|
...more
|
|
89
88
|
}: WalineProps): WalineConfig => ({
|
|
90
89
|
serverURL: getServerURL(serverURL),
|
|
91
90
|
path: decodePath(path),
|
|
92
91
|
locale: {
|
|
93
|
-
...(
|
|
92
|
+
...(DEFAULT_LOCALES[lang] || DEFAULT_LOCALES[DEFAULT_LANG]),
|
|
94
93
|
...(typeof locale === 'object' ? locale : {}),
|
|
95
94
|
} as WalineLocale,
|
|
96
95
|
wordLimit: getWordLimit(wordLimit),
|
|
@@ -99,9 +98,9 @@ export const getConfig = ({
|
|
|
99
98
|
imageUploader: fallback(imageUploader, defaultUploadImage),
|
|
100
99
|
highlighter: fallback(highlighter, defaultHighlighter),
|
|
101
100
|
texRenderer: fallback(texRenderer, defaultTexRenderer),
|
|
102
|
-
lang: Object.keys(
|
|
101
|
+
lang: Object.keys(DEFAULT_LOCALES).includes(lang) ? lang : 'en-US',
|
|
103
102
|
dark,
|
|
104
|
-
emoji: typeof emoji === 'boolean' ? (emoji ?
|
|
103
|
+
emoji: typeof emoji === 'boolean' ? (emoji ? DEFAULT_EMOJI : []) : emoji,
|
|
105
104
|
pageSize,
|
|
106
105
|
login,
|
|
107
106
|
copyright,
|
|
@@ -112,10 +111,11 @@ export const getConfig = ({
|
|
|
112
111
|
? search
|
|
113
112
|
: getDefaultSearchOptions(lang),
|
|
114
113
|
recaptchaV3Key,
|
|
114
|
+
turnstileKey,
|
|
115
115
|
reaction: Array.isArray(reaction)
|
|
116
116
|
? reaction
|
|
117
117
|
: reaction === true
|
|
118
|
-
?
|
|
118
|
+
? DEFAULT_REACTION
|
|
119
119
|
: [],
|
|
120
120
|
commentSorting,
|
|
121
121
|
...more,
|
package/src/utils/emoji.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useStorage } from '@vueuse/core';
|
|
2
|
-
import { removeEndingSplash } from './path';
|
|
3
2
|
|
|
4
|
-
import type
|
|
5
|
-
import
|
|
3
|
+
import { type WalineEmojiConfig } from './config.js';
|
|
4
|
+
import { removeEndingSplash } from './path.js';
|
|
5
|
+
import { type WalineEmojiInfo } from '../typings/index.js';
|
|
6
6
|
|
|
7
7
|
const hasVersion = (url: string): boolean =>
|
|
8
8
|
Boolean(/@[0-9]+\.[0-9]+\.[0-9]+/.test(url));
|
package/src/utils/index.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
export * from './config';
|
|
2
|
-
export * from './darkmode';
|
|
3
|
-
export * from './date';
|
|
4
|
-
export * from './emoji';
|
|
5
|
-
export * from './error';
|
|
6
|
-
export * from './getRoot';
|
|
7
|
-
export * from './image';
|
|
8
|
-
export * from './markdown';
|
|
9
|
-
export * from './path';
|
|
10
|
-
export * from './query';
|
|
11
|
-
export * from './wordCount';
|
|
1
|
+
export * from './config.js';
|
|
2
|
+
export * from './darkmode.js';
|
|
3
|
+
export * from './date.js';
|
|
4
|
+
export * from './emoji.js';
|
|
5
|
+
export * from './error.js';
|
|
6
|
+
export * from './getRoot.js';
|
|
7
|
+
export * from './image.js';
|
|
8
|
+
export * from './markdown.js';
|
|
9
|
+
export * from './path.js';
|
|
10
|
+
export * from './query.js';
|
|
11
|
+
export * from './wordCount.js';
|
|
12
|
+
export * from './userAgent.js';
|
package/src/utils/markdown.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { marked } from 'marked';
|
|
2
|
-
import { markedTexExtensions } from './markedMathExtension';
|
|
3
2
|
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import { markedTexExtensions } from './markedMathExtension.js';
|
|
4
|
+
import {
|
|
5
|
+
type WalineEmojiMaps,
|
|
6
|
+
type WalineHighlighter,
|
|
7
|
+
type WalineTexRenderer,
|
|
8
|
+
} from '../typings/index.js';
|
|
9
9
|
|
|
10
10
|
export const parseEmoji = (text = '', emojiMap: WalineEmojiMaps = {}): string =>
|
|
11
11
|
text.replace(/:(.+?):/g, (placeholder, key: string) =>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
1
|
+
import { type marked } from 'marked';
|
|
2
|
+
|
|
3
|
+
import { type WalineTexRenderer } from '../typings/index.js';
|
|
3
4
|
|
|
4
5
|
const inlineMathStart = /\$.*?\$/;
|
|
5
6
|
const inlineMathReg = /^\$(.*?)\$/;
|
package/src/utils/userAgent.ts
CHANGED
package/src/utils/wordCount.ts
CHANGED
|
@@ -26,6 +26,6 @@ export const getChinese = (content: string): RegExpMatchArray | null =>
|
|
|
26
26
|
export const getWordNumber = (content: string): number =>
|
|
27
27
|
(getWords(content)?.reduce<number>(
|
|
28
28
|
(accumulator, word) =>
|
|
29
|
-
accumulator + (word.trim() ===
|
|
29
|
+
accumulator + (word.trim() === '' ? 0 : word.trim().split(/\s+/u).length),
|
|
30
30
|
0
|
|
31
31
|
) || 0) + (getChinese(content)?.length || 0);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { getRecentComment } from '../api';
|
|
2
|
-
import { useUserInfo } from '../composables';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import type { WalineComment } from '../typings';
|
|
1
|
+
import { getRecentComment } from '../api/index.js';
|
|
2
|
+
import { useUserInfo } from '../composables/index.js';
|
|
3
|
+
import { type WalineComment } from '../typings/index.js';
|
|
4
|
+
import { getRoot } from '../utils/index.js';
|
|
6
5
|
|
|
7
6
|
export interface WalineRecentCommentsOptions {
|
|
8
7
|
/**
|
package/src/widgets/userList.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getUserList, WalineUser } from '../api';
|
|
2
|
-
import {
|
|
2
|
+
import { DEFAULT_LANG, DEFAULT_LOCALES } from '../config';
|
|
3
3
|
import { WalineLocale } from '../typings';
|
|
4
4
|
import { getRoot } from '../utils';
|
|
5
5
|
|
|
@@ -93,7 +93,7 @@ export const UserList = ({
|
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
locale = {
|
|
96
|
-
...(
|
|
96
|
+
...(DEFAULT_LOCALES[lang] || DEFAULT_LOCALES[DEFAULT_LANG]),
|
|
97
97
|
...(typeof locale === 'object' ? locale : {}),
|
|
98
98
|
} as WalineLocale;
|
|
99
99
|
|