@waline/client 2.15.6 → 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.
- package/dist/api.cjs.map +1 -1
- package/dist/api.d.cts +1 -1
- package/dist/api.d.mts +1 -1
- package/dist/api.d.ts +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 +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 +5 -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.d.cts +1 -1
- package/dist/pageview.d.mts +1 -1
- package/dist/pageview.d.ts +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 +3 -3
- package/dist/shim.d.mts +3 -3
- 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 +3 -3
- package/dist/waline.d.mts +3 -3
- package/dist/waline.d.ts +3 -3
- 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 +11 -9
- package/src/api/articleCounter.ts +2 -2
- package/src/api/comment.ts +2 -2
- package/src/api/commentCount.ts +2 -2
- package/src/api/login.ts +1 -1
- package/src/api/pageview.ts +1 -1
- package/src/api/utils.ts +1 -1
- package/src/comment.ts +1 -1
- package/src/compact/convert.ts +9 -8
- package/src/compact/logger.ts +1 -1
- package/src/compact/v1.ts +3 -3
- package/src/compact/valine.ts +1 -1
- package/src/components/ArticleReaction.vue +12 -5
- package/src/components/CommentBox.vue +10 -11
- package/src/components/CommentCard.vue +6 -6
- package/src/components/Icons.ts +10 -10
- package/src/components/ImageWall.vue +5 -5
- package/src/components/WalineComment.vue +3 -3
- package/src/composables/turnstile.ts +1 -1
- package/src/composables/userInfo.ts +1 -1
- package/src/config/default.ts +6 -6
- package/src/config/highlighter.ts +1 -1
- package/src/config/i18n/generate.ts +1 -1
- package/src/entries/legacy.ts +4 -2
- package/src/pageview.ts +4 -4
- package/src/styles/card.scss +1 -1
- package/src/styles/emoji.scss +3 -1
- package/src/styles/gif.scss +3 -1
- package/src/styles/panel.scss +5 -5
- package/src/styles/reaction.scss +2 -2
- package/src/typings/base.ts +1 -1
- package/src/typings/waline.ts +2 -2
- package/src/utils/config.ts +4 -4
- package/src/utils/date.ts +1 -1
- package/src/utils/emoji.ts +4 -4
- package/src/utils/getRoot.ts +1 -1
- package/src/utils/image.ts +1 -1
- package/src/utils/markdown.ts +6 -6
- package/src/utils/markedMathExtension.ts +3 -3
- package/src/utils/wordCount.ts +1 -1
- package/src/widgets/recentComments.ts +1 -1
- package/src/widgets/userList.ts +1 -1
package/src/pageview.ts
CHANGED
|
@@ -49,7 +49,7 @@ export interface WalinePageviewCountOptions {
|
|
|
49
49
|
|
|
50
50
|
const renderVisitorCount = (
|
|
51
51
|
counts: number[],
|
|
52
|
-
countElements: HTMLElement[]
|
|
52
|
+
countElements: HTMLElement[],
|
|
53
53
|
): void => {
|
|
54
54
|
countElements.forEach((element, index) => {
|
|
55
55
|
element.innerText = counts[index].toString();
|
|
@@ -67,7 +67,7 @@ export const pageviewCount = ({
|
|
|
67
67
|
|
|
68
68
|
const elements = Array.from(
|
|
69
69
|
// pageview selectors
|
|
70
|
-
document.querySelectorAll<HTMLElement>(selector)
|
|
70
|
+
document.querySelectorAll<HTMLElement>(selector),
|
|
71
71
|
);
|
|
72
72
|
|
|
73
73
|
const filter = (element: HTMLElement): boolean => {
|
|
@@ -98,8 +98,8 @@ export const pageviewCount = ({
|
|
|
98
98
|
}).then((count) =>
|
|
99
99
|
renderVisitorCount(
|
|
100
100
|
new Array<number>(normalElements.length).fill(count),
|
|
101
|
-
normalElements
|
|
102
|
-
)
|
|
101
|
+
normalElements,
|
|
102
|
+
),
|
|
103
103
|
);
|
|
104
104
|
|
|
105
105
|
// if we should fetch count of other pages
|
package/src/styles/card.scss
CHANGED
package/src/styles/emoji.scss
CHANGED
package/src/styles/gif.scss
CHANGED
package/src/styles/panel.scss
CHANGED
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
border: var(--waline-border);
|
|
50
50
|
border-radius: var(--waline-avatar-radius);
|
|
51
51
|
|
|
52
|
-
@media (width
|
|
52
|
+
@media (max-width: 720px) {
|
|
53
53
|
width: var(--waline-m-avatar-size);
|
|
54
54
|
height: var(--waline-m-avatar-size);
|
|
55
55
|
}
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
border-top-left-radius: 0.75em;
|
|
93
93
|
border-top-right-radius: 0.75em;
|
|
94
94
|
|
|
95
|
-
@media (width
|
|
95
|
+
@media (max-width: 580px) {
|
|
96
96
|
display: block;
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
flex: 1;
|
|
126
126
|
|
|
127
127
|
&:not(:last-child) {
|
|
128
|
-
@media (width
|
|
128
|
+
@media (max-width: 580px) {
|
|
129
129
|
border-bottom: 2px dashed var(--waline-border-color);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
.wl-header-2 & {
|
|
138
138
|
width: 50%;
|
|
139
139
|
|
|
140
|
-
@media (width
|
|
140
|
+
@media (max-width: 580px) {
|
|
141
141
|
flex: 0;
|
|
142
142
|
width: 100%;
|
|
143
143
|
}
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
.wl-header-3 & {
|
|
147
147
|
width: 33.33%;
|
|
148
148
|
|
|
149
|
-
@media (width
|
|
149
|
+
@media (max-width: 580px) {
|
|
150
150
|
width: 100%;
|
|
151
151
|
}
|
|
152
152
|
}
|
package/src/styles/reaction.scss
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
list-style-type: none;
|
|
29
29
|
|
|
30
|
-
@media (width
|
|
30
|
+
@media (max-width: 580px) {
|
|
31
31
|
gap: 12px;
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
width: 42px;
|
|
55
55
|
height: 42px;
|
|
56
56
|
|
|
57
|
-
@media (width
|
|
57
|
+
@media (max-width: 580px) {
|
|
58
58
|
width: 32px;
|
|
59
59
|
height: 32px;
|
|
60
60
|
}
|
package/src/typings/base.ts
CHANGED
|
@@ -120,4 +120,4 @@ export type WalineImageUploader = (image: File) => Promise<string>;
|
|
|
120
120
|
|
|
121
121
|
export type WalineHighlighter = (code: string, lang: string) => string;
|
|
122
122
|
|
|
123
|
-
export type
|
|
123
|
+
export type WalineTeXRenderer = (blockMode: boolean, tex: string) => string;
|
package/src/typings/waline.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type WalineImageUploader,
|
|
7
7
|
type WalineLoginStatus,
|
|
8
8
|
type WalineMeta,
|
|
9
|
-
type
|
|
9
|
+
type WalineTeXRenderer,
|
|
10
10
|
type WalineSearchOptions,
|
|
11
11
|
} from './base.js';
|
|
12
12
|
import { type WalineLocale } from './locale.js';
|
|
@@ -201,7 +201,7 @@ export interface WalineProps {
|
|
|
201
201
|
*
|
|
202
202
|
* @default true
|
|
203
203
|
*/
|
|
204
|
-
texRenderer?:
|
|
204
|
+
texRenderer?: WalineTeXRenderer | boolean;
|
|
205
205
|
|
|
206
206
|
/**
|
|
207
207
|
*
|
package/src/utils/config.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
DEFAULT_REACTION,
|
|
7
7
|
defaultUploadImage,
|
|
8
8
|
defaultHighlighter,
|
|
9
|
-
|
|
9
|
+
defaultTeXRenderer,
|
|
10
10
|
getDefaultSearchOptions,
|
|
11
11
|
getMeta,
|
|
12
12
|
} from '../config/index.js';
|
|
@@ -52,13 +52,13 @@ export const getServerURL = (serverURL: string): string => {
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
const getWordLimit = (
|
|
55
|
-
wordLimit: WalineProps['wordLimit']
|
|
55
|
+
wordLimit: WalineProps['wordLimit'],
|
|
56
56
|
): [number, number] | false =>
|
|
57
57
|
Array.isArray(wordLimit) ? wordLimit : wordLimit ? [0, wordLimit] : false;
|
|
58
58
|
|
|
59
59
|
const fallback = <T = unknown>(
|
|
60
60
|
value: T | boolean | undefined,
|
|
61
|
-
fallback: T
|
|
61
|
+
fallback: T,
|
|
62
62
|
): T | false =>
|
|
63
63
|
typeof value === 'function' ? value : value === false ? false : fallback;
|
|
64
64
|
|
|
@@ -97,7 +97,7 @@ export const getConfig = ({
|
|
|
97
97
|
requiredMeta: getMeta(requiredMeta),
|
|
98
98
|
imageUploader: fallback(imageUploader, defaultUploadImage),
|
|
99
99
|
highlighter: fallback(highlighter, defaultHighlighter),
|
|
100
|
-
texRenderer: fallback(texRenderer,
|
|
100
|
+
texRenderer: fallback(texRenderer, defaultTeXRenderer),
|
|
101
101
|
lang: Object.keys(DEFAULT_LOCALES).includes(lang) ? lang : 'en-US',
|
|
102
102
|
dark,
|
|
103
103
|
emoji: typeof emoji === 'boolean' ? (emoji ? DEFAULT_EMOJI : []) : emoji,
|
package/src/utils/date.ts
CHANGED
package/src/utils/emoji.ts
CHANGED
|
@@ -10,7 +10,7 @@ const hasVersion = (url: string): boolean =>
|
|
|
10
10
|
const fetchEmoji = (link: string): Promise<WalineEmojiInfo> => {
|
|
11
11
|
const emojiStore = useStorage<Record<string, WalineEmojiInfo>>(
|
|
12
12
|
'WALINE_EMOJI',
|
|
13
|
-
{}
|
|
13
|
+
{},
|
|
14
14
|
);
|
|
15
15
|
|
|
16
16
|
const result = hasVersion(link);
|
|
@@ -39,14 +39,14 @@ const getLink = (name: string, folder = '', prefix = '', type = ''): string =>
|
|
|
39
39
|
`${folder ? `${folder}/` : ''}${prefix}${name}${type ? `.${type}` : ''}`;
|
|
40
40
|
|
|
41
41
|
export const getEmojis = (
|
|
42
|
-
emojis: (string | WalineEmojiInfo)[]
|
|
42
|
+
emojis: (string | WalineEmojiInfo)[],
|
|
43
43
|
): Promise<WalineEmojiConfig> =>
|
|
44
44
|
Promise.all(
|
|
45
45
|
emojis.map((emoji) =>
|
|
46
46
|
typeof emoji === 'string'
|
|
47
47
|
? fetchEmoji(removeEndingSplash(emoji))
|
|
48
|
-
: Promise.resolve(emoji)
|
|
49
|
-
)
|
|
48
|
+
: Promise.resolve(emoji),
|
|
49
|
+
),
|
|
50
50
|
).then((emojiInfos) => {
|
|
51
51
|
const emojiConfig: WalineEmojiConfig = {
|
|
52
52
|
tabs: [],
|
package/src/utils/getRoot.ts
CHANGED
package/src/utils/image.ts
CHANGED
package/src/utils/markdown.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { marked } from 'marked';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { markedTeXExtensions } from './markedMathExtension.js';
|
|
4
4
|
import {
|
|
5
5
|
type WalineEmojiMaps,
|
|
6
6
|
type WalineHighlighter,
|
|
7
|
-
type
|
|
7
|
+
type WalineTeXRenderer,
|
|
8
8
|
} from '../typings/index.js';
|
|
9
9
|
|
|
10
10
|
export const parseEmoji = (text = '', emojiMap: WalineEmojiMaps = {}): string =>
|
|
11
11
|
text.replace(/:(.+?):/g, (placeholder, key: string) =>
|
|
12
12
|
emojiMap[key]
|
|
13
13
|
? `<img class="wl-emoji" src="${emojiMap[key]}" alt="${key}">`
|
|
14
|
-
: placeholder
|
|
14
|
+
: placeholder,
|
|
15
15
|
);
|
|
16
16
|
|
|
17
17
|
export interface ParseMarkdownOptions {
|
|
18
18
|
emojiMap: WalineEmojiMaps;
|
|
19
19
|
highlighter: WalineHighlighter | false;
|
|
20
|
-
texRenderer:
|
|
20
|
+
texRenderer: WalineTeXRenderer | false;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export const parseMarkdown = (
|
|
24
24
|
content: string,
|
|
25
|
-
{ emojiMap, highlighter, texRenderer }: ParseMarkdownOptions
|
|
25
|
+
{ emojiMap, highlighter, texRenderer }: ParseMarkdownOptions,
|
|
26
26
|
): string => {
|
|
27
27
|
marked.setOptions({
|
|
28
28
|
highlight: highlighter || undefined,
|
|
@@ -32,7 +32,7 @@ export const parseMarkdown = (
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
if (texRenderer) {
|
|
35
|
-
const extensions =
|
|
35
|
+
const extensions = markedTeXExtensions(texRenderer);
|
|
36
36
|
|
|
37
37
|
marked.use({ extensions });
|
|
38
38
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { type marked } from 'marked';
|
|
2
2
|
|
|
3
|
-
import { type
|
|
3
|
+
import { type WalineTeXRenderer } from '../typings/index.js';
|
|
4
4
|
|
|
5
5
|
const inlineMathStart = /\$.*?\$/;
|
|
6
6
|
const inlineMathReg = /^\$(.*?)\$/;
|
|
7
7
|
const blockMathReg = /^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/;
|
|
8
8
|
|
|
9
|
-
export const
|
|
10
|
-
texRenderer:
|
|
9
|
+
export const markedTeXExtensions = (
|
|
10
|
+
texRenderer: WalineTeXRenderer,
|
|
11
11
|
): marked.TokenizerExtension[] => {
|
|
12
12
|
const blockMathExtension: marked.TokenizerExtension = {
|
|
13
13
|
name: 'blockMath',
|
package/src/utils/wordCount.ts
CHANGED
|
@@ -72,7 +72,7 @@ export const RecentComments = ({
|
|
|
72
72
|
root.innerHTML = `<ul class="wl-recent-list">${comments
|
|
73
73
|
.map(
|
|
74
74
|
(comment) =>
|
|
75
|
-
`<li class="wl-recent-item"><a href="${comment.url}">${comment.nick}</a>:${comment.comment}</li
|
|
75
|
+
`<li class="wl-recent-item"><a href="${comment.url}">${comment.nick}</a>:${comment.comment}</li>`,
|
|
76
76
|
)
|
|
77
77
|
.join('')}</ul>`;
|
|
78
78
|
|