@waline/client 2.13.1 → 2.14.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 +1 -1
- package/dist/api.cjs.map +1 -1
- package/dist/api.d.cts +60 -34
- package/dist/api.d.mts +60 -34
- package/dist/api.d.ts +60 -34
- package/dist/api.mjs +1 -1
- package/dist/api.mjs.map +1 -1
- package/dist/comment.cjs +1 -1
- package/dist/comment.cjs.map +1 -1
- package/dist/comment.d.cts +1 -1
- package/dist/comment.d.mts +1 -1
- package/dist/comment.d.ts +1 -1
- package/dist/comment.js +40 -45
- 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 +13 -3
- 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 +44 -49
- 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 +15 -9
- package/dist/shim.d.mts +15 -9
- 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 +15 -9
- package/dist/waline.d.mts +15 -9
- package/dist/waline.d.ts +15 -9
- package/dist/waline.js +441 -449
- package/dist/waline.js.map +1 -1
- package/dist/waline.mjs +1 -1
- package/dist/waline.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/articleCounter.ts +3 -7
- package/src/api/comment.ts +60 -49
- package/src/api/commentCount.ts +0 -2
- package/src/api/pageview.ts +2 -2
- package/src/api/recentComment.ts +2 -5
- package/src/api/user.ts +2 -4
- package/src/api/utils.ts +17 -10
- package/src/comment.ts +1 -1
- package/src/compact/convert.ts +1 -1
- package/src/components/CommentBox.vue +14 -11
- package/src/components/Waline.vue +35 -34
- package/src/pageview.ts +3 -3
- package/src/styles/index.scss +2 -2
- package/src/styles/{nomalize.scss → normalize.scss} +0 -0
- package/src/styles/panel.scss +1 -1
- package/src/styles/{userlist.scss → user-list.scss} +0 -0
- package/src/typings/base.ts +5 -1
- package/src/typings/comment.ts +1 -5
- package/src/typings/waline.ts +13 -2
- package/src/utils/config.ts +2 -0
- package/src/utils/date.ts +3 -3
package/src/typings/base.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export type WalineCommentSorting = 'latest' | 'oldest' | 'hottest';
|
|
2
|
+
|
|
1
3
|
export interface WalineEmojiInfo {
|
|
2
4
|
/**
|
|
3
5
|
* 选项卡上的 Emoji 名称
|
|
@@ -39,6 +41,8 @@ export interface WalineEmojiInfo {
|
|
|
39
41
|
|
|
40
42
|
export type WalineEmojiMaps = Record<string, string>;
|
|
41
43
|
|
|
44
|
+
export type WalineLoginStatus = 'enable' | 'disable' | 'force';
|
|
45
|
+
|
|
42
46
|
export interface WalineSearchImageData extends Record<string, unknown> {
|
|
43
47
|
/**
|
|
44
48
|
* 图片链接
|
|
@@ -102,7 +106,7 @@ export interface WalineSearchOptions {
|
|
|
102
106
|
*
|
|
103
107
|
* @default (word) => search(word)
|
|
104
108
|
*/
|
|
105
|
-
more?: (word: string,
|
|
109
|
+
more?: (word: string, currentCount: number) => Promise<WalineSearchResult>;
|
|
106
110
|
}
|
|
107
111
|
|
|
108
112
|
export type WalineMeta = 'nick' | 'mail' | 'link';
|
package/src/typings/comment.ts
CHANGED
package/src/typings/waline.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
WalineCommentSorting,
|
|
2
3
|
WalineHighlighter,
|
|
3
4
|
WalineEmojiInfo,
|
|
4
5
|
WalineImageUploader,
|
|
6
|
+
WalineLoginStatus,
|
|
5
7
|
WalineMeta,
|
|
6
8
|
WalineTexRenderer,
|
|
7
9
|
WalineSearchOptions,
|
|
@@ -129,6 +131,15 @@ export interface WalineProps {
|
|
|
129
131
|
*/
|
|
130
132
|
locale?: Partial<WalineLocale>;
|
|
131
133
|
|
|
134
|
+
/**
|
|
135
|
+
* 评论列表排序方式
|
|
136
|
+
*
|
|
137
|
+
* Sorting method for comment list
|
|
138
|
+
*
|
|
139
|
+
* @default 'latest'
|
|
140
|
+
*/
|
|
141
|
+
commentSorting?: WalineCommentSorting;
|
|
142
|
+
|
|
132
143
|
/**
|
|
133
144
|
* 是否启用暗黑模式适配
|
|
134
145
|
*
|
|
@@ -194,12 +205,12 @@ export interface WalineProps {
|
|
|
194
205
|
* Login mode status, optional values:
|
|
195
206
|
*
|
|
196
207
|
* - `'enable'`: enable login (default)
|
|
197
|
-
* - `'disable'`: Login is disabled, users should fill in
|
|
208
|
+
* - `'disable'`: Login is disabled, users should fill in information to comment
|
|
198
209
|
* - `'force'`: Forced login, users must login to comment
|
|
199
210
|
*
|
|
200
211
|
* @default 'enable'
|
|
201
212
|
*/
|
|
202
|
-
login?:
|
|
213
|
+
login?: WalineLoginStatus;
|
|
203
214
|
|
|
204
215
|
/**
|
|
205
216
|
* 是否在页脚展示版权信息
|
package/src/utils/config.ts
CHANGED
|
@@ -67,6 +67,7 @@ export const getConfig = ({
|
|
|
67
67
|
search,
|
|
68
68
|
reaction,
|
|
69
69
|
recaptchaV3Key = '',
|
|
70
|
+
commentSorting = 'latest',
|
|
70
71
|
...more
|
|
71
72
|
}: WalineProps): WalineConfig => ({
|
|
72
73
|
serverURL: getServerURL(serverURL),
|
|
@@ -94,5 +95,6 @@ export const getConfig = ({
|
|
|
94
95
|
: reaction === true
|
|
95
96
|
? defaultReaction
|
|
96
97
|
: [],
|
|
98
|
+
commentSorting,
|
|
97
99
|
...more,
|
|
98
100
|
});
|
package/src/utils/date.ts
CHANGED
|
@@ -30,15 +30,15 @@ export const getTimeAgo = (
|
|
|
30
30
|
? new Date(date.indexOf(' ') !== -1 ? date.replace(/-/g, '/') : date)
|
|
31
31
|
: date;
|
|
32
32
|
|
|
33
|
-
const
|
|
33
|
+
const timePassed = now.getTime() - time.getTime();
|
|
34
34
|
|
|
35
|
-
const days = Math.floor(
|
|
35
|
+
const days = Math.floor(timePassed / (24 * 3600 * 1000));
|
|
36
36
|
|
|
37
37
|
if (days === 0) {
|
|
38
38
|
// 计算相差小时数
|
|
39
39
|
|
|
40
40
|
// 计算天数后剩余的毫秒数
|
|
41
|
-
const leave1 =
|
|
41
|
+
const leave1 = timePassed % (24 * 3600 * 1000);
|
|
42
42
|
const hours = Math.floor(leave1 / (3600 * 1000));
|
|
43
43
|
|
|
44
44
|
if (hours === 0) {
|