@waline/client 2.14.0 → 2.14.2
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/comment.cjs +1 -1
- package/dist/comment.cjs.map +1 -1
- package/dist/comment.js +1 -68
- 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 +14 -5
- 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 -121
- 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 -6
- package/dist/shim.d.mts +15 -6
- 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 -6
- package/dist/waline.d.mts +15 -6
- package/dist/waline.d.ts +15 -6
- package/dist/waline.js +1 -6787
- package/dist/waline.js.map +1 -1
- package/dist/waline.mjs +1 -1
- package/dist/waline.mjs.map +1 -1
- package/package.json +18 -18
- package/src/comment.ts +1 -2
- package/src/components/ArticleReaction.vue +120 -117
- package/src/components/CommentBox.vue +451 -488
- package/src/components/CommentCard.vue +109 -98
- package/src/components/ImageWall.vue +132 -131
- package/src/components/WalineComment.vue +683 -0
- package/src/composables/index.ts +1 -2
- package/src/composables/reaction.ts +16 -0
- package/src/composables/recaptchaV3.ts +4 -6
- package/src/config/default.ts +5 -0
- package/src/{entrys → entries}/api.ts +0 -0
- package/src/{entrys → entries}/comment.ts +0 -0
- package/src/entries/components.ts +2 -0
- package/src/{entrys → entries}/full.ts +0 -0
- package/src/{entrys → entries}/init.ts +0 -0
- package/src/{entrys → entries}/legacy.ts +0 -0
- package/src/{entrys → entries}/pageview.ts +0 -0
- package/src/init.ts +1 -1
- package/src/styles/reaction.scss +27 -16
- package/src/typings/base.ts +5 -0
- package/src/typings/waline.ts +14 -5
- package/src/utils/config.ts +27 -5
- package/src/utils/image.ts +1 -1
- package/src/components/Waline.vue +0 -509
- package/src/composables/timeAgo.ts +0 -15
- package/src/composables/vote.ts +0 -20
- package/src/entrys/components.ts +0 -2
package/src/config/default.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IGif } from '@giphy/js-types';
|
|
2
2
|
import type {
|
|
3
|
+
WalineEmojiPresets,
|
|
3
4
|
WalineMeta,
|
|
4
5
|
WalineSearchOptions,
|
|
5
6
|
WalineSearchResult,
|
|
@@ -10,6 +11,10 @@ const availableMeta: WalineMeta[] = ['nick', 'mail', 'link'];
|
|
|
10
11
|
export const getMeta = (meta: WalineMeta[]): WalineMeta[] =>
|
|
11
12
|
meta.filter((item) => availableMeta.includes(item));
|
|
12
13
|
|
|
14
|
+
export const defaultEmoji: WalineEmojiPresets[] = [
|
|
15
|
+
'//unpkg.com/@waline/emojis@1.1.0/weibo',
|
|
16
|
+
];
|
|
17
|
+
|
|
13
18
|
export const defaultLang = 'zh-CN';
|
|
14
19
|
|
|
15
20
|
export const defaultUploadImage = (file: File): Promise<string> =>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/init.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createApp, h, reactive, watchEffect } from 'vue';
|
|
2
2
|
|
|
3
|
-
import Waline from './components/
|
|
3
|
+
import Waline from './components/WalineComment.vue';
|
|
4
4
|
import { commentCount } from './comment';
|
|
5
5
|
import { pageviewCount } from './pageview';
|
|
6
6
|
import { getRoot } from './utils';
|
package/src/styles/reaction.scss
CHANGED
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
margin-bottom: 1.75em;
|
|
3
3
|
text-align: center;
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
img {
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 100%;
|
|
8
|
+
transition: all 250ms ease-in-out;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&-list {
|
|
6
12
|
display: flex;
|
|
7
13
|
flex-direction: row;
|
|
8
14
|
gap: 16px;
|
|
@@ -13,7 +19,7 @@
|
|
|
13
19
|
list-style-type: none;
|
|
14
20
|
}
|
|
15
21
|
|
|
16
|
-
|
|
22
|
+
&-item {
|
|
17
23
|
display: flex;
|
|
18
24
|
flex-direction: column;
|
|
19
25
|
align-items: center;
|
|
@@ -23,31 +29,36 @@
|
|
|
23
29
|
&.active img {
|
|
24
30
|
transform: scale(1.15);
|
|
25
31
|
}
|
|
26
|
-
}
|
|
27
32
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
&.active .wl-reaction {
|
|
34
|
+
&-votes {
|
|
35
|
+
background: var(--waline-theme-color);
|
|
36
|
+
color: var(--waline-bgcolor);
|
|
37
|
+
}
|
|
33
38
|
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
&-text {
|
|
40
|
+
color: var(--waline-theme-color);
|
|
41
|
+
}
|
|
36
42
|
}
|
|
37
43
|
}
|
|
38
44
|
|
|
39
|
-
img {
|
|
40
|
-
width: 100%;
|
|
41
|
-
height: 100%;
|
|
42
|
-
transition: all 250ms ease-in-out;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
45
|
&-img {
|
|
46
46
|
position: relative;
|
|
47
47
|
width: 42px;
|
|
48
48
|
height: 42px;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
&-loading {
|
|
52
|
+
position: absolute;
|
|
53
|
+
top: -4px;
|
|
54
|
+
right: -5px;
|
|
55
|
+
|
|
56
|
+
width: 18px;
|
|
57
|
+
height: 18px;
|
|
58
|
+
|
|
59
|
+
color: var(--waline-theme-color);
|
|
60
|
+
}
|
|
61
|
+
|
|
51
62
|
&-votes {
|
|
52
63
|
position: absolute;
|
|
53
64
|
top: -4px;
|
package/src/typings/base.ts
CHANGED
package/src/typings/waline.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type {
|
|
|
2
2
|
WalineCommentSorting,
|
|
3
3
|
WalineHighlighter,
|
|
4
4
|
WalineEmojiInfo,
|
|
5
|
+
WalineEmojiPresets,
|
|
5
6
|
WalineImageUploader,
|
|
6
7
|
WalineLoginStatus,
|
|
7
8
|
WalineMeta,
|
|
@@ -158,22 +159,26 @@ export interface WalineProps {
|
|
|
158
159
|
*
|
|
159
160
|
* @default ['//unpkg.com/@waline/emojis@1.1.0/weibo']
|
|
160
161
|
*/
|
|
161
|
-
emoji?: (
|
|
162
|
+
emoji?: (WalineEmojiInfo | WalineEmojiPresets)[] | boolean;
|
|
162
163
|
|
|
163
164
|
/**
|
|
164
165
|
* 设置搜索功能
|
|
165
166
|
*
|
|
166
167
|
* Customize Search feature
|
|
168
|
+
*
|
|
169
|
+
* @default true
|
|
167
170
|
*/
|
|
168
|
-
search?: WalineSearchOptions |
|
|
171
|
+
search?: WalineSearchOptions | boolean;
|
|
169
172
|
|
|
170
173
|
/**
|
|
171
174
|
* 代码高亮
|
|
172
175
|
*
|
|
173
176
|
* Code highlighting
|
|
177
|
+
*
|
|
178
|
+
* @default true
|
|
174
179
|
*/
|
|
175
180
|
|
|
176
|
-
highlighter?: WalineHighlighter |
|
|
181
|
+
highlighter?: WalineHighlighter | boolean;
|
|
177
182
|
|
|
178
183
|
/**
|
|
179
184
|
* 自定义图片上传方法,方便更好的存储图片
|
|
@@ -183,16 +188,20 @@ export interface WalineProps {
|
|
|
183
188
|
* Custom image upload callback to manage picture by yourself.
|
|
184
189
|
*
|
|
185
190
|
* We will pass a picture file object when execute it.
|
|
191
|
+
*
|
|
192
|
+
* @default true
|
|
186
193
|
*/
|
|
187
194
|
|
|
188
|
-
imageUploader?: WalineImageUploader |
|
|
195
|
+
imageUploader?: WalineImageUploader | boolean;
|
|
189
196
|
|
|
190
197
|
/**
|
|
191
198
|
* 自定义数学公式处理方法,用于预览。
|
|
192
199
|
*
|
|
193
200
|
* Custom math formula parse callback for preview.
|
|
201
|
+
*
|
|
202
|
+
* @default true
|
|
194
203
|
*/
|
|
195
|
-
texRenderer?: WalineTexRenderer |
|
|
204
|
+
texRenderer?: WalineTexRenderer | boolean;
|
|
196
205
|
|
|
197
206
|
/**
|
|
198
207
|
*
|
package/src/utils/config.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
defaultEmoji,
|
|
2
3
|
defaultLang,
|
|
3
4
|
defaultLocales,
|
|
4
5
|
defaultReaction,
|
|
@@ -24,10 +25,26 @@ export interface WalineEmojiConfig {
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
export interface WalineConfig
|
|
27
|
-
extends Required<
|
|
28
|
+
extends Required<
|
|
29
|
+
Omit<
|
|
30
|
+
WalineProps,
|
|
31
|
+
| 'emoji'
|
|
32
|
+
| 'imageUploader'
|
|
33
|
+
| 'highlighter'
|
|
34
|
+
| 'texRenderer'
|
|
35
|
+
| 'wordLimit'
|
|
36
|
+
| 'reaction'
|
|
37
|
+
| 'search'
|
|
38
|
+
>
|
|
39
|
+
> {
|
|
28
40
|
locale: WalineLocale;
|
|
29
41
|
wordLimit: [number, number] | false;
|
|
30
42
|
reaction: string[];
|
|
43
|
+
emoji: Exclude<WalineProps['emoji'], boolean | undefined>;
|
|
44
|
+
highlighter: Exclude<WalineProps['highlighter'], true | undefined>;
|
|
45
|
+
imageUploader: Exclude<WalineProps['imageUploader'], true | undefined>;
|
|
46
|
+
texRenderer: Exclude<WalineProps['texRenderer'], true | undefined>;
|
|
47
|
+
search: Exclude<WalineProps['search'], true | undefined>;
|
|
31
48
|
}
|
|
32
49
|
|
|
33
50
|
export const getServerURL = (serverURL: string): string => {
|
|
@@ -42,7 +59,7 @@ const getWordLimit = (
|
|
|
42
59
|
Array.isArray(wordLimit) ? wordLimit : wordLimit ? [0, wordLimit] : false;
|
|
43
60
|
|
|
44
61
|
const fallback = <T = unknown>(
|
|
45
|
-
value: T |
|
|
62
|
+
value: T | boolean | undefined,
|
|
46
63
|
fallback: T
|
|
47
64
|
): T | false =>
|
|
48
65
|
typeof value === 'function' ? value : value === false ? false : fallback;
|
|
@@ -53,7 +70,7 @@ export const getConfig = ({
|
|
|
53
70
|
path = location.pathname,
|
|
54
71
|
lang = defaultLang,
|
|
55
72
|
locale,
|
|
56
|
-
emoji =
|
|
73
|
+
emoji = defaultEmoji,
|
|
57
74
|
meta = ['nick', 'mail', 'link'],
|
|
58
75
|
requiredMeta = [],
|
|
59
76
|
dark = false,
|
|
@@ -84,11 +101,16 @@ export const getConfig = ({
|
|
|
84
101
|
texRenderer: fallback(texRenderer, defaultTexRenderer),
|
|
85
102
|
lang,
|
|
86
103
|
dark,
|
|
87
|
-
emoji,
|
|
104
|
+
emoji: typeof emoji === 'boolean' ? (emoji ? defaultEmoji : []) : emoji,
|
|
88
105
|
pageSize,
|
|
89
106
|
login,
|
|
90
107
|
copyright,
|
|
91
|
-
search:
|
|
108
|
+
search:
|
|
109
|
+
search === false
|
|
110
|
+
? false
|
|
111
|
+
: typeof search === 'object'
|
|
112
|
+
? search
|
|
113
|
+
: getDefaultSearchOptions(lang),
|
|
92
114
|
recaptchaV3Key,
|
|
93
115
|
reaction: Array.isArray(reaction)
|
|
94
116
|
? reaction
|
package/src/utils/image.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const isImage = (item: DataTransferItem): boolean =>
|
|
2
2
|
item.type.includes('image');
|
|
3
3
|
|
|
4
|
-
export const
|
|
4
|
+
export const getImageFromDataTransfer = (
|
|
5
5
|
items: DataTransferItemList
|
|
6
6
|
): File | null => {
|
|
7
7
|
const image = Array.from(items).find(isImage);
|