@waline/client 2.14.8 → 2.14.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waline/client",
3
- "version": "2.14.8",
3
+ "version": "2.14.9",
4
4
  "description": "client for waline comment system",
5
5
  "keywords": [
6
6
  "valine",
@@ -93,16 +93,6 @@
93
93
  "dist",
94
94
  "src"
95
95
  ],
96
- "scripts": {
97
- "build": "pnpm rollup && pnpm style",
98
- "clean": "rimraf ./dist",
99
- "dev": "vite",
100
- "prepublishOnly": "pnpm clean && pnpm build",
101
- "rollup": "rollup -c",
102
- "style": "pnpm style:main && pnpm style:meta",
103
- "style:main": "sass ./src/styles/index.scss ./dist/waline.css --style=compressed",
104
- "style:meta": "sass ./src/styles/meta.scss ./dist/waline-meta.css --style=compressed"
105
- },
106
96
  "browserslist": {
107
97
  "production": [
108
98
  ">0.5%",
@@ -122,11 +112,10 @@
122
112
  "@vueuse/core": "^9.13.0",
123
113
  "autosize": "^6.0.1",
124
114
  "marked": "^4.2.12",
125
- "user-agent-data-types": "^0.3.1",
126
115
  "vue": "^3.2.47"
127
116
  },
128
117
  "devDependencies": {
129
- "@babel/core": "7.21.0",
118
+ "@babel/core": "7.21.3",
130
119
  "@babel/preset-env": "7.20.2",
131
120
  "@giphy/js-types": "4.4.0",
132
121
  "@rollup/plugin-babel": "6.0.3",
@@ -136,16 +125,26 @@
136
125
  "@rollup/plugin-terser": "0.4.0",
137
126
  "@types/autosize": "4.0.1",
138
127
  "@types/marked": "4.0.8",
139
- "@types/node": "18.14.2",
128
+ "@types/node": "18.15.3",
140
129
  "@vitejs/plugin-vue": "4.0.0",
141
130
  "recaptcha-v3": "1.10.0",
142
- "rollup": "3.17.3",
131
+ "rollup": "3.19.1",
143
132
  "rollup-plugin-dts": "5.2.0",
144
133
  "rollup-plugin-ts": "3.2.0",
145
134
  "typescript": "4.9.5",
135
+ "user-agent-data-types": "^0.3.1",
146
136
  "vite": "4.1.4"
147
137
  },
148
138
  "engines": {
149
139
  "node": ">=14"
140
+ },
141
+ "scripts": {
142
+ "build": "pnpm rollup && pnpm style",
143
+ "clean": "rimraf ./dist",
144
+ "dev": "vite",
145
+ "rollup": "rollup -c",
146
+ "style": "pnpm style:main && pnpm style:meta",
147
+ "style:main": "sass ./src/styles/index.scss ./dist/waline.css --style=compressed",
148
+ "style:meta": "sass ./src/styles/meta.scss ./dist/waline-meta.css --style=compressed"
150
149
  }
151
- }
150
+ }
@@ -527,14 +527,14 @@ const submitComment = async (): Promise<void> => {
527
527
  return alert(locale.value.mailError);
528
528
  }
529
529
 
530
- // check comment
531
- if (!comment.comment) {
532
- editorRef.value?.focus();
530
+ if (!comment.nick) comment.nick = locale.value.anonymous;
531
+ }
533
532
 
534
- return;
535
- }
533
+ // check comment
534
+ if (!comment.comment) {
535
+ editorRef.value?.focus();
536
536
 
537
- if (!comment.nick) comment.nick = locale.value.anonymous;
537
+ return;
538
538
  }
539
539
 
540
540
  if (!isWordNumberLegal.value)
@@ -6,16 +6,25 @@ import type {
6
6
  WalineSearchResult,
7
7
  } from '../typings';
8
8
 
9
- const availableMeta: WalineMeta[] = ['nick', 'mail', 'link'];
9
+ const AVAILABLE_META: WalineMeta[] = ['nick', 'mail', 'link'];
10
10
 
11
11
  export const getMeta = (meta: WalineMeta[]): WalineMeta[] =>
12
- meta.filter((item) => availableMeta.includes(item));
12
+ meta.filter((item) => AVAILABLE_META.includes(item));
13
13
 
14
- export const defaultEmoji: WalineEmojiPresets[] = [
14
+ export const DEFAULT_EMOJI: WalineEmojiPresets[] = [
15
15
  '//unpkg.com/@waline/emojis@1.1.0/weibo',
16
16
  ];
17
17
 
18
- export const defaultLang = 'en-US';
18
+ export const DEFAULT_LANG = 'en-US';
19
+
20
+ export const DEFAULT_REACTION = [
21
+ '//unpkg.com/@waline/emojis/tieba/tieba_agree.png',
22
+ '//unpkg.com/@waline/emojis/tieba/tieba_look_down.png',
23
+ '//unpkg.com/@waline/emojis/tieba/tieba_sunglasses.png',
24
+ '//unpkg.com/@waline/emojis/tieba/tieba_pick_nose.png',
25
+ '//unpkg.com/@waline/emojis/tieba/tieba_awkward.png',
26
+ '//unpkg.com/@waline/emojis/tieba/tieba_sleep.png',
27
+ ];
19
28
 
20
29
  export const defaultUploadImage = (file: File): Promise<string> =>
21
30
  new Promise((resolve, reject) => {
@@ -35,7 +44,7 @@ export const defaultTexRenderer = (blockMode: boolean): string =>
35
44
  : '<span class="wl-tex">Tex is not available in preview</span>';
36
45
 
37
46
  export const getDefaultSearchOptions = (lang: string): WalineSearchOptions => {
38
- interface GifsResult {
47
+ interface GifResult {
39
48
  data: IGif[];
40
49
  meta: {
41
50
  msg: string;
@@ -65,7 +74,7 @@ export const getDefaultSearchOptions = (lang: string): WalineSearchOptions => {
65
74
  ...params,
66
75
  }).toString()}`
67
76
  )
68
- .then((resp) => <Promise<GifsResult>>resp.json())
77
+ .then((resp) => <Promise<GifResult>>resp.json())
69
78
  .then(({ data }) =>
70
79
  data.map((gif) => ({
71
80
  title: gif.title,
@@ -81,12 +90,3 @@ export const getDefaultSearchOptions = (lang: string): WalineSearchOptions => {
81
90
  fetchGiphy('search', { q: word, offset: offset.toString() }),
82
91
  };
83
92
  };
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
- ];
@@ -10,7 +10,7 @@ import type { WalineLocale } from '../../typings';
10
10
 
11
11
  export type Locales = Record<string, WalineLocale>;
12
12
 
13
- export const defaultLocales: Locales = {
13
+ export const DEFAULT_LOCALES: Locales = {
14
14
  zh: zhCN,
15
15
  'zh-cn': zhCN,
16
16
  'zh-CN': zhCN,
@@ -1,4 +1,4 @@
1
- export { defaultLocales } from '../config';
1
+ export { DEFAULT_LOCALES as defaultLocales } from '../config';
2
2
  export * from '../comment';
3
3
  export * from '../init';
4
4
  export * from '../pageview';
@@ -1,4 +1,4 @@
1
1
  export * from '../init';
2
- export { defaultLocales } from '../config';
2
+ export { DEFAULT_LOCALES as defaultLocales } from '../config';
3
3
  export * from '../typings';
4
4
  export * from '../version';
@@ -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
68
 
62
- .wl-nick {
63
- position: relative;
64
-
65
- display: inline-block;
66
-
67
- margin-inline-end: 0.5em;
68
-
69
- font-weight: bold;
70
- font-size: 0.875em;
71
- line-height: 1;
72
- text-decoration: none;
73
-
74
- svg {
69
+ .wl-nick {
75
70
  position: relative;
76
- bottom: -0.125em;
71
+
72
+ display: inline-block;
73
+
74
+ margin-inline-end: 0.5em;
75
+
76
+ font-weight: bold;
77
+ font-size: 0.875em;
77
78
  line-height: 1;
79
+ text-decoration: none;
78
80
  }
79
81
  }
80
82
 
@@ -1,8 +1,8 @@
1
1
  import {
2
- defaultEmoji,
3
- defaultLang,
4
- defaultLocales,
5
- defaultReaction,
2
+ DEFAULT_EMOJI,
3
+ DEFAULT_LANG,
4
+ DEFAULT_LOCALES,
5
+ DEFAULT_REACTION,
6
6
  defaultUploadImage,
7
7
  defaultHighlighter,
8
8
  defaultTexRenderer,
@@ -70,7 +70,7 @@ export const getConfig = ({
70
70
  path = location.pathname,
71
71
  lang = typeof navigator === 'undefined' ? 'en-US' : navigator.language,
72
72
  locale,
73
- emoji = defaultEmoji,
73
+ emoji = DEFAULT_EMOJI,
74
74
  meta = ['nick', 'mail', 'link'],
75
75
  requiredMeta = [],
76
76
  dark = false,
@@ -90,7 +90,7 @@ export const getConfig = ({
90
90
  serverURL: getServerURL(serverURL),
91
91
  path: decodePath(path),
92
92
  locale: {
93
- ...(defaultLocales[lang] || defaultLocales[defaultLang]),
93
+ ...(DEFAULT_LOCALES[lang] || DEFAULT_LOCALES[DEFAULT_LANG]),
94
94
  ...(typeof locale === 'object' ? locale : {}),
95
95
  } as WalineLocale,
96
96
  wordLimit: getWordLimit(wordLimit),
@@ -99,9 +99,9 @@ export const getConfig = ({
99
99
  imageUploader: fallback(imageUploader, defaultUploadImage),
100
100
  highlighter: fallback(highlighter, defaultHighlighter),
101
101
  texRenderer: fallback(texRenderer, defaultTexRenderer),
102
- lang: Object.keys(defaultLocales).includes(lang) ? lang : 'en-US',
102
+ lang: Object.keys(DEFAULT_LOCALES).includes(lang) ? lang : 'en-US',
103
103
  dark,
104
- emoji: typeof emoji === 'boolean' ? (emoji ? defaultEmoji : []) : emoji,
104
+ emoji: typeof emoji === 'boolean' ? (emoji ? DEFAULT_EMOJI : []) : emoji,
105
105
  pageSize,
106
106
  login,
107
107
  copyright,
@@ -115,7 +115,7 @@ export const getConfig = ({
115
115
  reaction: Array.isArray(reaction)
116
116
  ? reaction
117
117
  : reaction === true
118
- ? defaultReaction
118
+ ? DEFAULT_REACTION
119
119
  : [],
120
120
  commentSorting,
121
121
  ...more,
@@ -1,5 +1,5 @@
1
1
  import { getUserList, WalineUser } from '../api';
2
- import { defaultLang, defaultLocales } from '../config';
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
- ...(defaultLocales[lang] || defaultLocales[defaultLang]),
96
+ ...(DEFAULT_LOCALES[lang] || DEFAULT_LOCALES[DEFAULT_LANG]),
97
97
  ...(typeof locale === 'object' ? locale : {}),
98
98
  } as WalineLocale;
99
99