@waline/client 2.1.2-test.0 → 2.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waline/client",
3
- "version": "2.1.2-test.0",
3
+ "version": "2.3.0",
4
4
  "description": "client for waline comment system",
5
5
  "keywords": [
6
6
  "valine",
@@ -29,8 +29,11 @@
29
29
  "require": "./dist/shim.js",
30
30
  "default": "./dist/shim.js"
31
31
  },
32
- "./dist/component": "./dist/component.js",
33
- "./dist/legacy": "./dist/legacy.js",
32
+ "./dist/component": {
33
+ "import": "./dist/component.esm.js",
34
+ "require": "./dist/component.js",
35
+ "default": "./dist/component.esm.js"
36
+ },
34
37
  "./dist/pageview": {
35
38
  "import": "./dist/pageview.esm.js",
36
39
  "require": "./dist/pageview.cjs.js",
@@ -42,6 +45,7 @@
42
45
  "default": "./dist/waline.js"
43
46
  },
44
47
  "./dist/waline.css": "./dist/waline.css",
48
+ "./dist/*": "./dist/*",
45
49
  "./src/*": "./src/*",
46
50
  "./package.json": "./package.json"
47
51
  },
@@ -76,7 +80,7 @@
76
80
  ]
77
81
  },
78
82
  "dependencies": {
79
- "@vueuse/core": "^8.3.1",
83
+ "@vueuse/core": "^8.4.0",
80
84
  "autosize": "^5.0.1",
81
85
  "hanabi": "^0.4.0",
82
86
  "marked": "^4.0.15",
@@ -86,7 +90,7 @@
86
90
  "@types/autosize": "^4.0.1",
87
91
  "@types/marked": "^4.0.3",
88
92
  "@vitejs/plugin-vue": "^2.3.1",
89
- "vite": "^2.9.6"
93
+ "vite": "^2.9.7"
90
94
  },
91
95
  "engines": {
92
96
  "node": ">=12.20.0"
@@ -22,10 +22,11 @@
22
22
  class="wl-badge"
23
23
  v-text="locale.admin"
24
24
  />
25
+ <span v-if="comment.label" class="wl-badge" v-text="comment.label" />
25
26
  <span v-if="comment.sticky" class="wl-badge" v-text="locale.sticky" />
26
27
  <span
27
28
  v-if="comment.level >= 0"
28
- class="wl-badge"
29
+ :class="`wl-badge level${comment.level}`"
29
30
  v-text="locale[`level${comment.level}`] || `Level ${comment.level}`"
30
31
  />
31
32
 
@@ -41,6 +42,7 @@
41
42
  </button>
42
43
  </div>
43
44
  <div class="wl-meta" aria-hidden="true">
45
+ <span v-if="comment.addr" v-text="comment.addr" />
44
46
  <span v-if="comment.browser" v-text="comment.browser" />
45
47
  <span v-if="comment.os" v-text="comment.os" />
46
48
  </div>
@@ -67,7 +67,7 @@ import CommentBox from './CommentBox.vue';
67
67
  import CommentCard from './CommentCard.vue';
68
68
  import { LoadingIcon } from './Icons';
69
69
  import { useUserInfo } from '../composables';
70
- import { locales } from '../config';
70
+ import { defaultLocales } from '../config';
71
71
  import { fetchCommentList, getConfig, getDarkStyle } from '../utils';
72
72
 
73
73
  import type { PropType } from 'vue';
@@ -135,7 +135,7 @@ export default defineComponent({
135
135
  ...(SHOULD_VALIDATE
136
136
  ? {
137
137
  validator: (value: unknown): boolean =>
138
- Object.keys(locales).includes(value as string),
138
+ Object.keys(defaultLocales).includes(value as string),
139
139
  }
140
140
  : {}),
141
141
  },
@@ -10,7 +10,7 @@ import type { WalineLocale } from '../../typings';
10
10
 
11
11
  export type Locales = Record<string, WalineLocale>;
12
12
 
13
- export const locales: Locales = {
13
+ export const defaultLocales: Locales = {
14
14
  zh: zhCN,
15
15
  'zh-cn': zhCN,
16
16
  'zh-CN': zhCN,
@@ -1,4 +1,4 @@
1
- export * from '../config';
1
+ export { 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 * from '../config';
2
+ export { defaultLocales } from '../config';
3
3
  export * from '../typings';
4
4
  export * from '../version';
package/src/init.ts CHANGED
@@ -28,7 +28,7 @@ export interface WalineInstance {
28
28
  *
29
29
  * @description when not setting `path` option, it will be reset to `window.location.pathname`
30
30
  */
31
- update: (newOptions: Partial<Omit<WalineInitOptions, 'el'>>) => void;
31
+ update: (newOptions?: Partial<Omit<WalineInitOptions, 'el'>>) => void;
32
32
 
33
33
  /**
34
34
  * 取消挂载并摧毁 Waline 实例
@@ -96,7 +96,7 @@ export const init = ({
96
96
  pageview,
97
97
  path = window.location.pathname,
98
98
  ...newProps
99
- }: Partial<Omit<WalineInitOptions, 'el'>>): void => {
99
+ }: Partial<Omit<WalineInitOptions, 'el'>> = {}): void => {
100
100
  Object.entries(newProps).forEach(([key, value]) => {
101
101
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
102
102
  // @ts-ignore
@@ -23,4 +23,6 @@ export interface WalineComment extends Exclude<WalineCommentData, 'ua'> {
23
23
  browser?: string;
24
24
  os?: string;
25
25
  level?: number;
26
+ addr?: string;
27
+ label?: string;
26
28
  }
@@ -6,7 +6,16 @@ export interface WalineDateLocale {
6
6
  now: string;
7
7
  }
8
8
 
9
- export interface WalineLocale extends WalineDateLocale {
9
+ export interface WalineLevelLocale {
10
+ level0: string;
11
+ level1: string;
12
+ level2: string;
13
+ level3: string;
14
+ level4: string;
15
+ level5: string;
16
+ }
17
+
18
+ export interface WalineLocale extends WalineDateLocale, WalineLevelLocale {
10
19
  nick: string;
11
20
  nickError: string;
12
21
  mail: string;
@@ -3,7 +3,7 @@ import {
3
3
  defaultUploadImage,
4
4
  defaultTexRenderer,
5
5
  getMeta,
6
- locales,
6
+ defaultLocales,
7
7
  } from '../config';
8
8
 
9
9
  import { decodePath, isLinkHttp, removeEndingSplash } from './path';
@@ -66,7 +66,7 @@ export const getConfig = ({
66
66
  serverURL: getServerURL(serverURL),
67
67
  path: decodePath(path),
68
68
  locale: {
69
- ...(locales[lang] || locales[defaultLang]),
69
+ ...(defaultLocales[lang] || defaultLocales[defaultLang]),
70
70
  ...(typeof locale === 'object' ? locale : {}),
71
71
  },
72
72
  wordLimit: getWordLimit(wordLimit),