artalk 2.0.4 → 2.1.1
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/README.md +7 -60
- package/dist/Artalk.css +1 -1
- package/dist/Artalk.es.js +5996 -1
- package/dist/Artalk.iife.js +266 -1
- package/dist/Artalk.js +266 -1
- package/package.json +3 -4
- package/src/api/index.ts +269 -0
- package/src/api/request.ts +125 -0
- package/src/artalk.ts +153 -0
- package/src/components/_component.ts.txt +10 -0
- package/src/components/action-btn.ts +169 -0
- package/src/components/admin/page-list.ts +194 -0
- package/src/components/admin/site-list-floater.ts +98 -0
- package/src/components/admin/site-list.ts +289 -0
- package/src/components/comment.ts +478 -0
- package/src/components/dialog.ts +63 -0
- package/src/components/editor-plugs/{_ExamplePlug.ts.txt → _example-plug.ts.txt} +0 -0
- package/src/components/editor-plugs/{EditorPlug.ts → editor-plug.ts} +3 -3
- package/src/components/editor-plugs/{EmoticonsPlug.less → emoticons-plug.less} +0 -0
- package/src/components/editor-plugs/{EmoticonsPlug.ts → emoticons-plug.ts} +9 -9
- package/src/components/editor-plugs/{PreviewPlug.less → preview-plug.less} +0 -0
- package/src/components/editor-plugs/{PreviewPlug.ts → preview-plug.ts} +10 -10
- package/src/components/{Editor.ts → editor.ts} +104 -102
- package/src/components/html/comment.html +2 -6
- package/src/components/html/list.html +0 -1
- package/src/components/html/sidebar.html +18 -4
- package/src/components/item-text-editor.ts +136 -0
- package/src/components/layer.ts +135 -0
- package/src/components/list-lite.ts +507 -0
- package/src/components/list.ts +172 -0
- package/src/components/pagination.ts +150 -0
- package/src/components/read-more-btn.ts +71 -0
- package/src/components/sidebar-view.ts +26 -0
- package/src/components/sidebar-views/comments-view.ts +66 -0
- package/src/components/sidebar-views/pages-view.ts +61 -0
- package/src/components/sidebar-views/setting-view.ts +21 -0
- package/src/components/sidebar-views/sites-view.ts +42 -0
- package/src/components/sidebar-views/transfer-view.ts +218 -0
- package/src/components/sidebar.ts +288 -0
- package/src/context.ts +42 -0
- package/src/default-conf.ts +42 -0
- package/src/lib/checker/admin-checker.ts +33 -0
- package/src/lib/checker/captcha-checker.ts +38 -0
- package/src/lib/checker/index.ts +134 -0
- package/src/lib/component.ts +3 -3
- package/src/lib/md5.js +6 -0
- package/src/lib/ui.ts +64 -74
- package/src/lib/user.ts +2 -8
- package/src/lib/utils.ts +30 -11
- package/src/main.ts +1 -1
- package/src/style/_color.less +8 -2
- package/src/style/_extend.less +81 -0
- package/src/style/_variables.less +3 -0
- package/src/style/comment.less +60 -24
- package/src/style/editor.less +3 -0
- package/src/style/item-text-editor.less +35 -0
- package/src/style/list.less +51 -32
- package/src/style/main.less +75 -1
- package/src/style/page-list.less +50 -0
- package/src/style/pagination.less +58 -0
- package/src/style/sidebar.less +274 -199
- package/src/style/site-list.less +208 -0
- package/tsconfig.json +27 -0
- package/types/artalk-config.d.ts +68 -51
- package/types/artalk-data.d.ts +38 -1
- package/types/event.d.ts +73 -0
- package/types/index.d.ts +1 -6
- package/.github/workflows/npm.yml +0 -31
- package/.github/workflows/pages.yml +0 -30
- package/dist/src/Event.d.ts +0 -59
- package/dist/types/artalk-config.d.ts +0 -79
- package/dist/types/artalk-data.d.ts +0 -153
- package/dist/types/global.d.ts +0 -1
- package/dist/types/index.d.ts +0 -8
- package/dist/types/vite-env.d.ts +0 -1
- package/example/pjax/res1.html +0 -41
- package/example/pjax/res2.html +0 -41
- package/src/Artalk.ts +0 -160
- package/src/Constant.ts +0 -6
- package/src/Context.ts +0 -34
- package/src/Event.d.ts +0 -59
- package/src/components/Comment.ts +0 -402
- package/src/components/Layer.ts +0 -138
- package/src/components/List.ts +0 -162
- package/src/components/ListLite.ts +0 -407
- package/src/components/Sidebar.ts +0 -141
- package/src/components/sidebar-views/AdminView.ts +0 -523
- package/src/components/sidebar-views/MessageView.ts +0 -48
- package/src/components/sidebar-views/SidebarView.ts +0 -24
- package/src/lib/api.ts +0 -380
- package/src/lib/checker.ts +0 -164
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
.atk-site-list {
|
|
2
|
+
& > .atk-header {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: row;
|
|
5
|
+
padding: 15px 30px;
|
|
6
|
+
align-items: center;
|
|
7
|
+
|
|
8
|
+
.atk-title {
|
|
9
|
+
flex: auto;
|
|
10
|
+
padding-right: 10px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.atk-actions {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: row;
|
|
16
|
+
|
|
17
|
+
.atk-item {
|
|
18
|
+
display: flex;
|
|
19
|
+
height: 30px;
|
|
20
|
+
width: 30px;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
align-items: center;
|
|
23
|
+
user-select: none;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
border-radius: 2px;
|
|
26
|
+
|
|
27
|
+
&:hover {
|
|
28
|
+
background: @color-bg-grey;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.atk-site-rows-wrap {
|
|
35
|
+
position: relative;
|
|
36
|
+
|
|
37
|
+
.atk-site-row {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: row;
|
|
40
|
+
padding: 10px 20px;
|
|
41
|
+
padding-bottom: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.atk-site-item {
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-basis: 25%;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
align-items: center;
|
|
49
|
+
padding-bottom: 5px;
|
|
50
|
+
user-select: none;
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
border: 1px solid transparent;
|
|
53
|
+
|
|
54
|
+
.atk-site-logo {
|
|
55
|
+
margin: 15px;
|
|
56
|
+
text-align: center;
|
|
57
|
+
font-size: 20px;
|
|
58
|
+
height: 65px;
|
|
59
|
+
width: 65px;
|
|
60
|
+
line-height: 65px;
|
|
61
|
+
background: @color-quote;
|
|
62
|
+
color: #fff;
|
|
63
|
+
border-radius: 4px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.atk-site-name {
|
|
67
|
+
text-align: center;
|
|
68
|
+
font-size: 15px;
|
|
69
|
+
color: @color-sub;
|
|
70
|
+
padding: 0 17px;
|
|
71
|
+
word-break: break-word;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&.atk-active {
|
|
75
|
+
background-color: @color-bg-grey;
|
|
76
|
+
border: 1px solid @color-border;
|
|
77
|
+
margin-top: -1px;
|
|
78
|
+
border-radius: 0 0 4px 4px;
|
|
79
|
+
|
|
80
|
+
.atk-site-name {
|
|
81
|
+
color: @color-deep;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&:hover {
|
|
86
|
+
.atk-site-name {
|
|
87
|
+
color: @color-font;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.atk-site-edit, .atk-site-add {
|
|
94
|
+
position: relative;
|
|
95
|
+
min-height: 120px;
|
|
96
|
+
width: 100%;
|
|
97
|
+
border-top: 1px solid @color-border;
|
|
98
|
+
border-bottom: 1px solid @color-border;
|
|
99
|
+
margin-bottom: -10px;
|
|
100
|
+
|
|
101
|
+
.atk-header {
|
|
102
|
+
display: flex;
|
|
103
|
+
flex-direction: row;
|
|
104
|
+
align-items: center;
|
|
105
|
+
padding: 10px 30px 0 35px;
|
|
106
|
+
justify-content: space-between;
|
|
107
|
+
|
|
108
|
+
.atk-site-info {
|
|
109
|
+
.atk-site-name {
|
|
110
|
+
cursor: pointer;
|
|
111
|
+
display: inline-block;
|
|
112
|
+
font-size: 23px;
|
|
113
|
+
position: relative;
|
|
114
|
+
|
|
115
|
+
&:after {
|
|
116
|
+
content: ' ';
|
|
117
|
+
position: absolute;
|
|
118
|
+
width: 100%;
|
|
119
|
+
height: 6px;
|
|
120
|
+
background: @color-main;
|
|
121
|
+
opacity: .4;
|
|
122
|
+
left: 0;
|
|
123
|
+
bottom: 6px;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.atk-site-urls {
|
|
128
|
+
display: flex;
|
|
129
|
+
width: 100%;
|
|
130
|
+
margin-top: 6px;
|
|
131
|
+
flex-wrap: wrap;
|
|
132
|
+
min-height: 23px;
|
|
133
|
+
|
|
134
|
+
.atk-url-item {
|
|
135
|
+
background: @color-bg-grey;
|
|
136
|
+
color: @color-font;
|
|
137
|
+
border-radius: 2px;
|
|
138
|
+
padding: 0 8px;
|
|
139
|
+
font-size: 13px;
|
|
140
|
+
margin-bottom: 3px;
|
|
141
|
+
margin-right: 3px;
|
|
142
|
+
cursor: pointer;
|
|
143
|
+
|
|
144
|
+
&:hover {
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.atk-close-btn {
|
|
151
|
+
width: 50px;
|
|
152
|
+
height: 50px;
|
|
153
|
+
display: flex;
|
|
154
|
+
justify-content: center;
|
|
155
|
+
align-items: center;
|
|
156
|
+
cursor: pointer;
|
|
157
|
+
|
|
158
|
+
&:hover i {
|
|
159
|
+
background-color: @color-red;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.atk-main {
|
|
165
|
+
position: relative;
|
|
166
|
+
display: flex;
|
|
167
|
+
flex-direction: row;
|
|
168
|
+
padding: 20px 30px 6px 35px;
|
|
169
|
+
padding-bottom: 10px;
|
|
170
|
+
|
|
171
|
+
.atk-site-text-actions {
|
|
172
|
+
.atk-list-text-actions();
|
|
173
|
+
height: 90px;
|
|
174
|
+
padding: 0;
|
|
175
|
+
padding-left: 10px;
|
|
176
|
+
|
|
177
|
+
.atk-item {
|
|
178
|
+
margin-bottom: 17px;
|
|
179
|
+
margin-right: 25px;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.atk-site-btn-actions {
|
|
184
|
+
.atk-list-btn-actions();
|
|
185
|
+
|
|
186
|
+
padding-right: 9px;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.atk-item-text-editor-layer {
|
|
190
|
+
padding: 10px 20px;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.atk-site-add {
|
|
196
|
+
position: relative;
|
|
197
|
+
|
|
198
|
+
.atk-header {
|
|
199
|
+
.atk-title {
|
|
200
|
+
font-size: 20px;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.atk-form {
|
|
205
|
+
padding: 20px 40px;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"baseUrl": ".",
|
|
4
|
+
"outDir": "dist",
|
|
5
|
+
"target": "esnext",
|
|
6
|
+
"useDefineForClassFields": true,
|
|
7
|
+
"module": "esnext",
|
|
8
|
+
"lib": ["esnext", "dom"],
|
|
9
|
+
"moduleResolution": "node",
|
|
10
|
+
"strict": true,
|
|
11
|
+
"sourceMap": true,
|
|
12
|
+
"experimentalDecorators": true,
|
|
13
|
+
"resolveJsonModule": true,
|
|
14
|
+
"esModuleInterop": true,
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
"noImplicitAny": false,
|
|
17
|
+
"allowSyntheticDefaultImports": true,
|
|
18
|
+
"noUnusedLocals": true,
|
|
19
|
+
"noUnusedParameters": true,
|
|
20
|
+
"noImplicitReturns": true,
|
|
21
|
+
"paths": {
|
|
22
|
+
"~/*": ["./*"],
|
|
23
|
+
"@/*": ["./src/*"]
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"include": ["./src", "./types"]
|
|
27
|
+
}
|
package/types/artalk-config.d.ts
CHANGED
|
@@ -1,79 +1,96 @@
|
|
|
1
|
-
export interface ArtalkConfig {
|
|
2
|
-
/**
|
|
3
|
-
* 装载元素
|
|
4
|
-
*/
|
|
1
|
+
export default interface ArtalkConfig {
|
|
2
|
+
/** 装载元素 */
|
|
5
3
|
el: string
|
|
6
4
|
|
|
7
|
-
/**
|
|
8
|
-
* 评论框占位字符
|
|
9
|
-
*/
|
|
5
|
+
/** 评论框占位字符 */
|
|
10
6
|
placeholder?: string
|
|
11
7
|
|
|
12
|
-
/**
|
|
13
|
-
* 评论为空时显示字符
|
|
14
|
-
*/
|
|
8
|
+
/** 评论为空时显示字符 */
|
|
15
9
|
noComment?: string
|
|
16
10
|
|
|
17
|
-
/**
|
|
18
|
-
* 发送按钮文字
|
|
19
|
-
*/
|
|
11
|
+
/** 发送按钮文字 */
|
|
20
12
|
sendBtn?: string
|
|
21
13
|
|
|
22
|
-
/**
|
|
23
|
-
* 默认头像(URL or Gravatar Type)
|
|
24
|
-
*/
|
|
25
|
-
defaultAvatar?: string
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* 页面唯一标识
|
|
29
|
-
*/
|
|
14
|
+
/** 页面唯一标识(完整 URL) */
|
|
30
15
|
pageKey: string
|
|
31
16
|
|
|
32
|
-
/**
|
|
33
|
-
* 页面可访问链接
|
|
34
|
-
*/
|
|
35
|
-
pageUrl?: string
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* 页面标题
|
|
39
|
-
*/
|
|
17
|
+
/** 页面标题 */
|
|
40
18
|
pageTitle?: string
|
|
41
19
|
|
|
42
|
-
/**
|
|
43
|
-
* 服务器地址
|
|
44
|
-
*/
|
|
20
|
+
/** 服务器地址 */
|
|
45
21
|
server: string
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* 站点名
|
|
49
|
-
*/
|
|
22
|
+
|
|
23
|
+
/** 站点名 */
|
|
50
24
|
site?: string
|
|
51
25
|
|
|
52
|
-
/**
|
|
53
|
-
* 表情包
|
|
54
|
-
*/
|
|
26
|
+
/** 表情包 */
|
|
55
27
|
emoticons?: object|any
|
|
56
28
|
|
|
57
|
-
/**
|
|
58
|
-
* 头像
|
|
59
|
-
*/
|
|
29
|
+
/** Gravatar 头像 */
|
|
60
30
|
gravatar?: {
|
|
61
|
-
/**
|
|
62
|
-
|
|
31
|
+
/** 镜像 */
|
|
32
|
+
mirror?: string
|
|
33
|
+
/** 默认头像(URL or Gravatar Type) */
|
|
34
|
+
default?: string
|
|
63
35
|
}
|
|
64
36
|
|
|
65
|
-
/**
|
|
66
|
-
|
|
67
|
-
*/
|
|
68
|
-
readMore?: {
|
|
37
|
+
/** 分页配置 */
|
|
38
|
+
pagination?: {
|
|
69
39
|
/** 每次请求获取数量 */
|
|
70
40
|
pageSize?: number
|
|
41
|
+
/** 阅读更多模式 */
|
|
42
|
+
readMore?: boolean
|
|
71
43
|
/** 滚动到底部自动加载 */
|
|
72
44
|
autoLoad?: boolean
|
|
73
45
|
}
|
|
74
46
|
|
|
75
|
-
/**
|
|
76
|
-
|
|
77
|
-
|
|
47
|
+
/** 内容限高 */
|
|
48
|
+
heightLimit: {
|
|
49
|
+
/** 评论内容限高 */
|
|
50
|
+
content?: number
|
|
51
|
+
|
|
52
|
+
/** 子评论区域限高 */
|
|
53
|
+
children?: number
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** 评论投票按钮 */
|
|
57
|
+
vote?: boolean
|
|
58
|
+
|
|
59
|
+
/** 评论投票反对按钮 */
|
|
60
|
+
voteDown?: boolean
|
|
61
|
+
|
|
62
|
+
/** 暗黑模式 */
|
|
78
63
|
darkMode?: boolean
|
|
64
|
+
|
|
65
|
+
/** 请求超时(单位:秒) */
|
|
66
|
+
reqTimeout?: number
|
|
67
|
+
|
|
68
|
+
/** 平铺模式 */
|
|
69
|
+
flatMode?: boolean|'auto'
|
|
70
|
+
|
|
71
|
+
/** 最大嵌套数 */
|
|
72
|
+
maxNesting?: number
|
|
73
|
+
|
|
74
|
+
/** 显示 UA 徽标 */
|
|
75
|
+
uaBadge?: boolean
|
|
76
|
+
|
|
77
|
+
/** 版本检测 */
|
|
78
|
+
versionCheck?: boolean
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface LocalUser {
|
|
82
|
+
/** 昵称 */
|
|
83
|
+
nick: string
|
|
84
|
+
|
|
85
|
+
/** 邮箱 */
|
|
86
|
+
email: string
|
|
87
|
+
|
|
88
|
+
/** 链接 */
|
|
89
|
+
link: string
|
|
90
|
+
|
|
91
|
+
/** TOKEN */
|
|
92
|
+
token: string
|
|
93
|
+
|
|
94
|
+
/** 是否为管理员 */
|
|
95
|
+
isAdmin: boolean
|
|
79
96
|
}
|
package/types/artalk-data.d.ts
CHANGED
|
@@ -76,11 +76,17 @@ export interface ListData {
|
|
|
76
76
|
/** 页面信息 */
|
|
77
77
|
page: PageData
|
|
78
78
|
|
|
79
|
+
/** 站点信息 */
|
|
80
|
+
site: SiteData
|
|
81
|
+
|
|
82
|
+
/** 未读的 Notifies */
|
|
79
83
|
unread: NotifyData[]
|
|
80
84
|
|
|
85
|
+
/** 未读计数 */
|
|
81
86
|
unread_count: number
|
|
82
87
|
|
|
83
|
-
|
|
88
|
+
/** API 版本 */
|
|
89
|
+
api_version: ApiVersionData
|
|
84
90
|
}
|
|
85
91
|
|
|
86
92
|
export interface PageData {
|
|
@@ -101,6 +107,12 @@ export interface PageData {
|
|
|
101
107
|
|
|
102
108
|
/** 站点名(用于隔离) */
|
|
103
109
|
site_name: string
|
|
110
|
+
|
|
111
|
+
/** 赞同数 */
|
|
112
|
+
vote_up: number
|
|
113
|
+
|
|
114
|
+
/** 反对数 */
|
|
115
|
+
vote_down: number
|
|
104
116
|
}
|
|
105
117
|
|
|
106
118
|
export interface SiteData {
|
|
@@ -144,10 +156,35 @@ export interface UserData {
|
|
|
144
156
|
}
|
|
145
157
|
|
|
146
158
|
export interface NotifyData {
|
|
159
|
+
/** 通知 ID */
|
|
147
160
|
id: number
|
|
161
|
+
|
|
162
|
+
/** 用户 ID */
|
|
148
163
|
user_id: number
|
|
164
|
+
|
|
165
|
+
/** 评论 ID */
|
|
149
166
|
comment_id: number
|
|
167
|
+
|
|
168
|
+
/** 是否已读 */
|
|
150
169
|
is_read: boolean
|
|
170
|
+
|
|
171
|
+
/** 是否已发送邮件通知 */
|
|
151
172
|
is_emailed: boolean
|
|
173
|
+
|
|
174
|
+
/** 标为已读地址 */
|
|
152
175
|
read_link: string
|
|
153
176
|
}
|
|
177
|
+
|
|
178
|
+
export interface ApiVersionData {
|
|
179
|
+
/** API 程序名 */
|
|
180
|
+
app: string
|
|
181
|
+
|
|
182
|
+
/** API 程序版本号 */
|
|
183
|
+
version: string
|
|
184
|
+
|
|
185
|
+
/** API 程序 CommitHash */
|
|
186
|
+
commit_hash: string
|
|
187
|
+
|
|
188
|
+
/** API 程序要求前端最小版本 */
|
|
189
|
+
fe_min_version: string
|
|
190
|
+
}
|
package/types/event.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ListData, CommentData, NotifyData } from './artalk-data'
|
|
2
|
+
import { LocalUser } from './artalk-config'
|
|
3
|
+
|
|
4
|
+
/** EventName to EventPayload Type */
|
|
5
|
+
export interface EventPayloadMap {
|
|
6
|
+
'comments-load': undefined // 评论加载时
|
|
7
|
+
'comments-loaded': undefined // 评论装载后
|
|
8
|
+
'editor-submit': undefined // 编辑器提交时
|
|
9
|
+
'editor-submitted': undefined // 编辑器提交后
|
|
10
|
+
'user-changed': LocalUser // 本地用户数据变更时
|
|
11
|
+
|
|
12
|
+
// List 操作(外部:不建议 listen,仅 trigger)
|
|
13
|
+
'list-reload': undefined // 重新加载 List
|
|
14
|
+
'list-import': CommentData[] // 评论导入
|
|
15
|
+
'list-insert': CommentData // 评论添加
|
|
16
|
+
'list-delete': CommentData // 评论删除
|
|
17
|
+
'list-update': ListUpdatePayload // 更新评论数据
|
|
18
|
+
'list-refresh-ui': undefined // 刷新 List UI
|
|
19
|
+
|
|
20
|
+
// Sidebar
|
|
21
|
+
'sidebar-show': undefined // 侧边栏显示
|
|
22
|
+
'sidebar-hide': undefined // 侧边栏隐藏
|
|
23
|
+
|
|
24
|
+
// Editor
|
|
25
|
+
'editor-open': undefined // 打开评论
|
|
26
|
+
'editor-close': undefined // 关闭评论
|
|
27
|
+
'editor-show-loading': undefined // 加载显示
|
|
28
|
+
'editor-hide-loading': undefined // 加载隐藏
|
|
29
|
+
'editor-notify': NotifyConf // 显示提示
|
|
30
|
+
'editor-reply': CommentData // 设置回复
|
|
31
|
+
|
|
32
|
+
// Notify
|
|
33
|
+
'unread-update': UnreadUpdatePayload // 未读数据更新
|
|
34
|
+
|
|
35
|
+
// Checker
|
|
36
|
+
'checker-admin': CheckerPayload // 检查管理员
|
|
37
|
+
'checker-captcha': CheckerCaptchaPayload // 检查验证码
|
|
38
|
+
'check-admin-show-el': undefined // 检查并更新仅管理员显示的元素
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface CheckerPayload {
|
|
42
|
+
onSuccess?: (inputVal: string, dialogEl?: HTMLElement) => void
|
|
43
|
+
onMount?: (dialogEl: HTMLElement) => void
|
|
44
|
+
onCancel?: () => void
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface NotifyConf {
|
|
48
|
+
msg: string
|
|
49
|
+
type: any
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface CheckerCaptchaPayload extends CheckerPayload {
|
|
53
|
+
imgData?: string
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface UnreadUpdatePayload {
|
|
57
|
+
notifies: NotifyData[]
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export type ListUpdatePayload = (data: ListData | undefined) => void
|
|
61
|
+
|
|
62
|
+
// ============================================
|
|
63
|
+
export interface Handler<P> {
|
|
64
|
+
(payload: P): void
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type EventScopeType = 'internal'|'external'
|
|
68
|
+
|
|
69
|
+
export interface Event<K extends keyof EventPayloadMap = keyof EventPayloadMap> {
|
|
70
|
+
name: keyof EventPayloadMap
|
|
71
|
+
handler: Handler<EventPayloadMap[K]>
|
|
72
|
+
scope: EventScopeType
|
|
73
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
2
|
-
name: NPM Publish
|
|
3
|
-
|
|
4
|
-
on:
|
|
5
|
-
push:
|
|
6
|
-
tags:
|
|
7
|
-
- v*
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
publish:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
steps:
|
|
13
|
-
- uses: actions/checkout@v2
|
|
14
|
-
# Setup .npmrc file to publish to npm
|
|
15
|
-
- uses: actions/setup-node@v2
|
|
16
|
-
with:
|
|
17
|
-
node-version: '12.x'
|
|
18
|
-
registry-url: 'https://registry.npmjs.org'
|
|
19
|
-
- run: yarn
|
|
20
|
-
- run: yarn build
|
|
21
|
-
- run: yarn publish --non-interactive
|
|
22
|
-
env:
|
|
23
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
24
|
-
# Setup .npmrc file to publish to GitHub Packages
|
|
25
|
-
- uses: actions/setup-node@v2
|
|
26
|
-
with:
|
|
27
|
-
registry-url: 'https://npm.pkg.github.com'
|
|
28
|
-
# Publish to GitHub Packages
|
|
29
|
-
- run: yarn publish --non-interactive
|
|
30
|
-
env:
|
|
31
|
-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
name: GitHub Pages
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- master
|
|
7
|
-
workflow_dispatch:
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
deploy:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
steps:
|
|
13
|
-
- name: Checkout
|
|
14
|
-
uses: actions/checkout@v2
|
|
15
|
-
- name: Setup
|
|
16
|
-
uses: actions/setup-node@v1
|
|
17
|
-
with:
|
|
18
|
-
node-version: '12.x'
|
|
19
|
-
- name: Install
|
|
20
|
-
run: yarn install
|
|
21
|
-
- name: Build
|
|
22
|
-
run: yarn predeploy
|
|
23
|
-
- name: Deploy
|
|
24
|
-
uses: peaceiris/actions-gh-pages@v3
|
|
25
|
-
with:
|
|
26
|
-
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
27
|
-
publish_branch: gh-pages
|
|
28
|
-
publish_dir: ./deploy
|
|
29
|
-
user_name: 'github-actions[bot]'
|
|
30
|
-
user_email: 'github-actions[bot]@users.noreply.github.com'
|
package/dist/src/Event.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { ListData, CommentData, NotifyData } from '~/types/artalk-data'
|
|
2
|
-
|
|
3
|
-
/** EventName to EventPayload Type */
|
|
4
|
-
export interface EventPayloadMap {
|
|
5
|
-
'list-loading': undefined
|
|
6
|
-
'list-clear': undefined
|
|
7
|
-
'list-refresh-ui': undefined
|
|
8
|
-
'list-import': CommentData[]
|
|
9
|
-
'list-insert': CommentData
|
|
10
|
-
'list-comment-del': CommentData
|
|
11
|
-
'list-reload': undefined
|
|
12
|
-
'list-update-data': (data: ListData | undefined) => void
|
|
13
|
-
'sidebar-show'?: SidebarShowPayload
|
|
14
|
-
'sidebar-hide': undefined
|
|
15
|
-
'check-admin-show-el': undefined
|
|
16
|
-
'editor-open-comment': undefined
|
|
17
|
-
'editor-close-comment': undefined
|
|
18
|
-
'editor-show-loading': undefined
|
|
19
|
-
'editor-hide-loading': undefined
|
|
20
|
-
'editor-notify': NotifyConf
|
|
21
|
-
'editor-reply': CommentData
|
|
22
|
-
'user-changed': undefined
|
|
23
|
-
'unread-update': UnreadUpdatePayload
|
|
24
|
-
'checker-admin': CheckerConf
|
|
25
|
-
'checker-captcha': CheckerCaptchaConf
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface CheckerConf {
|
|
29
|
-
onSuccess?: (inputVal: string, dialogEl?: HTMLElement) => void
|
|
30
|
-
onMount?: (dialogEl: HTMLElement) => void
|
|
31
|
-
onCancel?: () => void
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface NotifyConf {
|
|
35
|
-
msg: string
|
|
36
|
-
type: any
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface CheckerCaptchaConf extends CheckerConf {
|
|
40
|
-
imgData?: string
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface SidebarShowPayload {
|
|
44
|
-
viewName?: string
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface UnreadUpdatePayload {
|
|
48
|
-
notifies: NotifyData[]
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// ============================================
|
|
52
|
-
export interface Listener<P> {
|
|
53
|
-
(payload: P): void
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface Event<K extends keyof EventPayloadMap = keyof EventPayloadMap> {
|
|
57
|
-
name: keyof EventPayloadMap
|
|
58
|
-
listener: Listener<EventPayloadMap[K]>
|
|
59
|
-
}
|