@waline/client 2.14.9 → 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 +8 -0
- package/dist/shim.d.mts +8 -0
- 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.map +1 -1
- package/dist/waline.d.cts +8 -0
- package/dist/waline.d.mts +8 -0
- package/dist/waline.d.ts +8 -0
- 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 +18 -27
- 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 +56 -43
- 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 +8 -7
- package/src/config/i18n/generate.ts +1 -1
- package/src/config/i18n/index.ts +7 -8
- 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 +3 -3
- 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 +10 -10
- 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/config/i18n/index.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
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
|
|
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
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,3 +1,4 @@
|
|
|
1
|
+
import { decodePath, isLinkHttp, removeEndingSplash } from './path.js';
|
|
1
2
|
import {
|
|
2
3
|
DEFAULT_EMOJI,
|
|
3
4
|
DEFAULT_LANG,
|
|
@@ -8,16 +9,13 @@ import {
|
|
|
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'>[];
|
|
@@ -84,6 +82,7 @@ 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 => ({
|
|
@@ -112,6 +111,7 @@ 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
|
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
|
/**
|