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.
Files changed (91) hide show
  1. package/README.md +7 -60
  2. package/dist/Artalk.css +1 -1
  3. package/dist/Artalk.es.js +5996 -1
  4. package/dist/Artalk.iife.js +266 -1
  5. package/dist/Artalk.js +266 -1
  6. package/package.json +3 -4
  7. package/src/api/index.ts +269 -0
  8. package/src/api/request.ts +125 -0
  9. package/src/artalk.ts +153 -0
  10. package/src/components/_component.ts.txt +10 -0
  11. package/src/components/action-btn.ts +169 -0
  12. package/src/components/admin/page-list.ts +194 -0
  13. package/src/components/admin/site-list-floater.ts +98 -0
  14. package/src/components/admin/site-list.ts +289 -0
  15. package/src/components/comment.ts +478 -0
  16. package/src/components/dialog.ts +63 -0
  17. package/src/components/editor-plugs/{_ExamplePlug.ts.txt → _example-plug.ts.txt} +0 -0
  18. package/src/components/editor-plugs/{EditorPlug.ts → editor-plug.ts} +3 -3
  19. package/src/components/editor-plugs/{EmoticonsPlug.less → emoticons-plug.less} +0 -0
  20. package/src/components/editor-plugs/{EmoticonsPlug.ts → emoticons-plug.ts} +9 -9
  21. package/src/components/editor-plugs/{PreviewPlug.less → preview-plug.less} +0 -0
  22. package/src/components/editor-plugs/{PreviewPlug.ts → preview-plug.ts} +10 -10
  23. package/src/components/{Editor.ts → editor.ts} +104 -102
  24. package/src/components/html/comment.html +2 -6
  25. package/src/components/html/list.html +0 -1
  26. package/src/components/html/sidebar.html +18 -4
  27. package/src/components/item-text-editor.ts +136 -0
  28. package/src/components/layer.ts +135 -0
  29. package/src/components/list-lite.ts +507 -0
  30. package/src/components/list.ts +172 -0
  31. package/src/components/pagination.ts +150 -0
  32. package/src/components/read-more-btn.ts +71 -0
  33. package/src/components/sidebar-view.ts +26 -0
  34. package/src/components/sidebar-views/comments-view.ts +66 -0
  35. package/src/components/sidebar-views/pages-view.ts +61 -0
  36. package/src/components/sidebar-views/setting-view.ts +21 -0
  37. package/src/components/sidebar-views/sites-view.ts +42 -0
  38. package/src/components/sidebar-views/transfer-view.ts +218 -0
  39. package/src/components/sidebar.ts +288 -0
  40. package/src/context.ts +42 -0
  41. package/src/default-conf.ts +42 -0
  42. package/src/lib/checker/admin-checker.ts +33 -0
  43. package/src/lib/checker/captcha-checker.ts +38 -0
  44. package/src/lib/checker/index.ts +134 -0
  45. package/src/lib/component.ts +3 -3
  46. package/src/lib/md5.js +6 -0
  47. package/src/lib/ui.ts +64 -74
  48. package/src/lib/user.ts +2 -8
  49. package/src/lib/utils.ts +30 -11
  50. package/src/main.ts +1 -1
  51. package/src/style/_color.less +8 -2
  52. package/src/style/_extend.less +81 -0
  53. package/src/style/_variables.less +3 -0
  54. package/src/style/comment.less +60 -24
  55. package/src/style/editor.less +3 -0
  56. package/src/style/item-text-editor.less +35 -0
  57. package/src/style/list.less +51 -32
  58. package/src/style/main.less +75 -1
  59. package/src/style/page-list.less +50 -0
  60. package/src/style/pagination.less +58 -0
  61. package/src/style/sidebar.less +274 -199
  62. package/src/style/site-list.less +208 -0
  63. package/tsconfig.json +27 -0
  64. package/types/artalk-config.d.ts +68 -51
  65. package/types/artalk-data.d.ts +38 -1
  66. package/types/event.d.ts +73 -0
  67. package/types/index.d.ts +1 -6
  68. package/.github/workflows/npm.yml +0 -31
  69. package/.github/workflows/pages.yml +0 -30
  70. package/dist/src/Event.d.ts +0 -59
  71. package/dist/types/artalk-config.d.ts +0 -79
  72. package/dist/types/artalk-data.d.ts +0 -153
  73. package/dist/types/global.d.ts +0 -1
  74. package/dist/types/index.d.ts +0 -8
  75. package/dist/types/vite-env.d.ts +0 -1
  76. package/example/pjax/res1.html +0 -41
  77. package/example/pjax/res2.html +0 -41
  78. package/src/Artalk.ts +0 -160
  79. package/src/Constant.ts +0 -6
  80. package/src/Context.ts +0 -34
  81. package/src/Event.d.ts +0 -59
  82. package/src/components/Comment.ts +0 -402
  83. package/src/components/Layer.ts +0 -138
  84. package/src/components/List.ts +0 -162
  85. package/src/components/ListLite.ts +0 -407
  86. package/src/components/Sidebar.ts +0 -141
  87. package/src/components/sidebar-views/AdminView.ts +0 -523
  88. package/src/components/sidebar-views/MessageView.ts +0 -48
  89. package/src/components/sidebar-views/SidebarView.ts +0 -24
  90. package/src/lib/api.ts +0 -380
  91. package/src/lib/checker.ts +0 -164
@@ -32,6 +32,10 @@
32
32
  &:hover {
33
33
  background: @color-bg-grey;
34
34
  }
35
+
36
+ .atk-comment-more-hide:after {
37
+ background: transparent !important;
38
+ }
35
39
  }
36
40
 
37
41
  &:last-child {
@@ -69,10 +73,15 @@
69
73
  align-items: center;
70
74
 
71
75
  .badge() {
76
+ color: @color-meta;
72
77
  background: @color-bg-grey;
73
78
  padding: 0 6px;
74
79
  line-height: 18px;
75
80
  border-radius: 3px;
81
+
82
+ &:not(:last-child) {
83
+ margin-right: 6px;
84
+ }
76
85
  }
77
86
 
78
87
  & > span {
@@ -84,22 +93,25 @@
84
93
  margin-right: 6px;
85
94
  }
86
95
 
87
- &.atk-nick {
96
+ &.atk-nick, &.atk-nick > a {
88
97
  font-size: 14px;
89
-
90
- & > a {
91
- color: @color-main;
92
- text-decoration: none;
93
- }
98
+ color: @color-main;
99
+ text-decoration: none;
94
100
  }
101
+ }
95
102
 
96
- &.atk-badge {
97
- .badge();
98
- background: #FF6C00;
99
- color: #FFF;
103
+ .atk-badge {
104
+ .badge();
105
+ background: #FF6C00;
106
+ color: #FFF;
107
+ }
108
+
109
+ .atk-ua-wrap {
110
+ @media only screen and (max-width: 768px) {
111
+ display: block;
100
112
  }
101
113
 
102
- &.atk-ua {
114
+ .atk-ua {
103
115
  .badge();
104
116
  }
105
117
  }
@@ -132,6 +144,10 @@
132
144
  & > *:last-child {
133
145
  margin-bottom: 0;
134
146
  }
147
+
148
+ .atk-more-hide-open-btn {
149
+ bottom: 5px;
150
+ }
135
151
  }
136
152
 
137
153
  & > .atk-pending {
@@ -148,6 +164,7 @@
148
164
  padding: 5px 15px;
149
165
  border-left: 3px solid #eee;
150
166
  margin-bottom: 10px;
167
+ position: relative;
151
168
 
152
169
  & > .atk-meta {
153
170
  font-size: 15px;
@@ -184,19 +201,6 @@
184
201
  }
185
202
  }
186
203
  }
187
-
188
- &.atk-read-more-mask:after {
189
- pointer-events: none;
190
- position: absolute;
191
- z-index: 1;
192
- display: block;
193
- overflow: hidden;
194
- width: 100%;
195
- content: " ";
196
- bottom: 0;
197
- height: 41px;
198
- background: linear-gradient(180deg, hsla(0,0%,100%,0), hsla(0,0%,100%,1));
199
- }
200
204
  }
201
205
 
202
206
  & > .atk-footer {
@@ -251,6 +255,10 @@
251
255
  width: 36px;
252
256
  height: 36px;
253
257
  }
258
+
259
+ & > .atk-comment-main {
260
+ margin-left: 47px;
261
+ }
254
262
  }
255
263
  }
256
264
 
@@ -262,4 +270,32 @@
262
270
  .comment-small-size()
263
271
  }
264
272
  }
273
+
274
+ .atk-comment-more-hide:after {
275
+ position: absolute;
276
+ z-index: 1;
277
+ display: block;
278
+ overflow: hidden;
279
+ width: 100%;
280
+ content: " ";
281
+ bottom: 0;
282
+ height: 80px;
283
+ background: @color-gradient;
284
+ }
285
+
286
+ .atk-more-hide-open-btn {
287
+ z-index: 10;
288
+ position: absolute;
289
+ left: 50%;
290
+ bottom: 10px;
291
+ transform: translateX(-50%);
292
+ cursor: pointer;
293
+ border: 1px solid @color-border;
294
+ border-radius: @block-radius;
295
+ background: @color-bg;
296
+ padding: 1px 20px;
297
+ font-size: 15px;
298
+ color: @color-meta;
299
+ user-select: none;
300
+ }
265
301
  }
@@ -20,6 +20,7 @@
20
20
  padding-bottom: 0;
21
21
 
22
22
  input {
23
+ font-size: 14px;
23
24
  border: 2px solid transparent;
24
25
  transition: color .3s ease;
25
26
  flex: 1;
@@ -38,6 +39,7 @@
38
39
 
39
40
  & > .atk-editor-textarea-wrap {
40
41
  .atk-editor-textarea {
42
+ font-size: 15px;
41
43
  color: @color-font;
42
44
  background-color: @color-bg;
43
45
  margin-top: 2px;
@@ -186,6 +188,7 @@
186
188
  transition: opacity .3s ease-in-out;
187
189
  outline: none;
188
190
  font-size: @font-size;
191
+ margin: 0;
189
192
 
190
193
  &:active {
191
194
  opacity: .9;
@@ -0,0 +1,35 @@
1
+ .atk-item-text-editor-layer {
2
+ z-index: 999;
3
+ background: @color-bg;
4
+ position: absolute;
5
+ left: 0;
6
+ top: 0;
7
+ width: 100%;
8
+ height: 100%;
9
+ display: flex;
10
+ flex-direction: row;
11
+ align-items: center;
12
+
13
+ .atk-edit-form {
14
+ flex: auto;
15
+ padding-left: 20px;
16
+
17
+ input {
18
+ font-size: 17px;
19
+ width: 100%;
20
+ padding: 3px 5px;
21
+ border: 0;
22
+ border-bottom: 1px solid @color-border;
23
+ outline: none;
24
+ background: transparent;
25
+
26
+ &.atk-invalid {}
27
+ }
28
+ }
29
+
30
+ .atk-actions {
31
+ .atk-list-btn-actions();
32
+
33
+ .atk-yes-btn.atk-disabled {}
34
+ }
35
+ }
@@ -66,16 +66,22 @@
66
66
  }
67
67
 
68
68
  & > .atk-list-footer {
69
- position: relative;
70
- overflow: hidden;
69
+ position: absolute;
70
+ bottom: 5px;
71
+ right: 0;
72
+
73
+ @media only screen and (max-width: 768px) {
74
+ position: relative;
75
+ margin-top: 10px;
76
+ text-align: center;
77
+ }
71
78
 
72
79
  .atk-copyright {
73
80
  display: block;
74
- font-size: 13px;
75
- float: right;
76
- color: @color-main;
77
- padding: 0 10px;
78
- border-radius: 2px;
81
+ font-size: 12px;
82
+ color: @color-meta;
83
+ padding-right: 15px;
84
+ margin-top: 5px;
79
85
 
80
86
  a {
81
87
  color: @color-main;
@@ -94,36 +100,49 @@
94
100
  }
95
101
 
96
102
  .atk-list-read-more {
97
- margin-bottom: 12px;
98
- cursor: pointer;
99
- user-select: none;
100
- border: 1px solid @color-border;
101
- padding: 0 20px;
102
- font-size: @font-size;
103
- border-radius: @block-radius;
104
- display: flex;
105
- height: 30px;
106
- flex-direction: row;
107
- place-content: center;
108
- align-items: center;
109
-
110
- &.atk-err > .atk-text {
111
- color: @color-red !important;
112
- }
103
+ border-top: 1px dashed @color-border;
104
+ margin-top: 20px;
105
+ padding-bottom: 20px;
113
106
 
114
- & > .atk-loading-icon {
115
- height: 15px;
116
- width: 15px;
107
+ @media only screen and (max-width: 768px) {
108
+ padding-bottom: 10px;
117
109
  }
118
110
 
119
- & > .atk-text {
120
- color: @color-meta;
121
- }
111
+ .atk-list-read-more-inner {
112
+ cursor: pointer;
113
+ user-select: none;
114
+ padding: 0 15px;
115
+ font-size: @font-size;
116
+ border-radius: @block-radius;
117
+ border: 1px solid transparent;
118
+ display: flex;
119
+ height: 30px;
120
+ flex-direction: row;
121
+ place-content: center;
122
+ align-items: center;
123
+ width: 120px;
124
+ margin: 0 auto;
125
+ margin-top: -15px;
126
+ background: @color-bg;
127
+ border-color: @color-border;
128
+
129
+ &.atk-err > .atk-text {
130
+ color: @color-red !important;
131
+ }
132
+
133
+ & > .atk-loading-icon {
134
+ height: 15px;
135
+ width: 15px;
136
+ }
122
137
 
123
- &:hover {
124
- background-color: @color-border;
125
138
  & > .atk-text {
126
- color: @color-main;
139
+ color: @color-meta;
140
+ }
141
+
142
+ &:hover {
143
+ & > .atk-text {
144
+ color: @color-main;
145
+ }
127
146
  }
128
147
  }
129
148
  }
@@ -167,6 +167,41 @@
167
167
  0% {}
168
168
  }
169
169
 
170
+ i.atk-icon {
171
+ width: 20px;
172
+ height: 20px;
173
+ background-color: @color-deep;
174
+ background-size: contain;
175
+ background-repeat: no-repeat;
176
+ mask-repeat: no-repeat;
177
+ mask-position: center;
178
+ }
179
+
180
+ .atk-icon-sync {
181
+ mask-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.99133 4.87635C2.22512 7.64257 2.22512 12.1275 4.99133 14.8937C6.04677 15.9491 7.3524 16.6019 8.71732 16.8519' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M14.4179 15.4815L15.0072 14.8922C17.7734 12.126 17.7734 7.64107 15.0072 4.87486C13.9518 3.81942 12.6461 3.16668 11.2812 2.91664' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M6.17106 4.99252L5.58181 4.40327L4.99255 3.81401H6.17106V4.99252Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M13.8299 15.0084L14.4192 15.5976L15.0084 16.1869H13.8299V15.0084Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E");
182
+ }
183
+
184
+ .atk-icon-del {
185
+ background-color: @color-red !important;
186
+ mask-image: url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.29167 5.04166L4.81251 5.04166M4.81251 5.04166L4.81251 18.3333C4.81251 18.5865 5.01771 18.7917 5.27084 18.7917L16.7292 18.7917C16.9823 18.7917 17.1875 18.5865 17.1875 18.3333V5.04166M4.81251 5.04166L7.33334 5.04166M17.1875 5.04166L19.7083 5.04166M17.1875 5.04166L14.6667 5.04166M7.33334 5.04166V3.20833L14.6667 3.20833V5.04166M7.33334 5.04166L14.6667 5.04166' stroke='%23D06565' stroke-width='2'/%3E%3Cpath d='M9.16667 8.25V15.125M12.8333 8.25V15.125' stroke='%23D06565' stroke-width='2'/%3E%3C/svg%3E");
187
+ }
188
+
189
+ .atk-icon-edit {
190
+ mask-image: url("data:image/svg+xml,%3Csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.70618 4.08515L12.6081 7.06376M1.00041 13.021L11.7376 2L14.6392 4.97861L3.90274 16H1L1.00041 13.021Z' stroke='%234E5969' stroke-width='1.5'/%3E%3C/svg%3E");
191
+ }
192
+
193
+ .atk-icon-no, .atk-icon-close {
194
+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25' fill='none'%3E%3Cpath d='M19.8657 5.13431L12.5 12.5L5.13431 19.8657' stroke='%234E5969'/%3E%3Cpath d='M5.13431 5.13432L12.5 12.5L19.8657 19.8657' stroke='%234E5969'/%3E%3C/svg%3E");
195
+ }
196
+
197
+ .atk-icon-yes {
198
+ mask-image: url("data:image/svg+xml,%3Csvg width='25' height='25' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21.7071 5.75533L9.92197 17.5404L3.29285 10.9113' stroke='%234E5969'/%3E%3C/svg%3E");
199
+ }
200
+
201
+ .atk-icon-plus {
202
+ mask-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.08331 10H17.9166' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M10 2.08334L10 17.9167' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E");
203
+ }
204
+
170
205
  /* Layer */
171
206
  .atk-error-layer {
172
207
  &:extend(.atk-full-layer);
@@ -176,9 +211,29 @@
176
211
  color: @color-red;
177
212
  }
178
213
 
214
+ .atk-warn-title {
215
+ color: @color-yellow;
216
+ }
217
+
218
+ .atk-error-title, .atk-warn-title {
219
+ display: inline-block;
220
+ padding: 0 15px;
221
+ margin-bottom: 20px;
222
+ font-size: 20px;
223
+ letter-spacing: -0.5px;
224
+ }
225
+
179
226
  .atk-error-text {
180
227
  text-align: center;
181
228
  padding: 0 20px;
229
+
230
+ * {
231
+ color: @color-deep;
232
+ }
233
+
234
+ a {
235
+ color: @color-meta;
236
+ }
182
237
  }
183
238
  }
184
239
 
@@ -216,7 +271,7 @@
216
271
  }
217
272
  }
218
273
 
219
- & > .atk-layer-dialog-action {
274
+ & > .atk-layer-dialog-actions {
220
275
  display: flex;
221
276
  flex-direction: row;
222
277
 
@@ -296,3 +351,22 @@
296
351
  height: 100%;
297
352
  }
298
353
  }
354
+
355
+ /* Common Action Btn */
356
+ .atk-common-action-btn {
357
+ &.atk-btn-confirm {
358
+ color: @color-yellow !important;
359
+ }
360
+
361
+ &.atk-btn-warn {
362
+ color: @color-yellow !important;
363
+ }
364
+
365
+ &.atk-btn-error {
366
+ color: @color-red !important;
367
+ }
368
+
369
+ &.atk-btn-success {
370
+ color: @color-green !important;
371
+ }
372
+ }
@@ -0,0 +1,50 @@
1
+ .atk-page-list {
2
+ .atk-page-item {
3
+ display: flex;
4
+ flex-direction: row;
5
+ position: relative;
6
+ min-height: 120px;
7
+ align-items: center;
8
+
9
+ &:not(:last-child) {
10
+ border-bottom: 1px solid @color-border;
11
+ }
12
+ }
13
+
14
+ .atk-page-main {
15
+ display: flex;
16
+ flex-direction: column;
17
+ flex: auto;
18
+ padding: 20px 30px;
19
+
20
+ .atk-title {
21
+ color: @color-font;
22
+ font-size: 21px;
23
+ margin-bottom: 10px;
24
+ }
25
+
26
+ .atk-sub {
27
+ color: @color-sub;
28
+ font-size: 14px;
29
+ }
30
+ }
31
+
32
+ .atk-page-main-actions {
33
+ .atk-list-text-actions();
34
+ }
35
+
36
+ .atk-page-actions {
37
+ .atk-list-btn-actions();
38
+ }
39
+
40
+ .atk-page-edit-layer {
41
+ z-index: 999;
42
+ background: @color-bg;
43
+ position: absolute;
44
+ width: 100%;
45
+ height: 100%;
46
+ display: flex;
47
+ flex-direction: row;
48
+ align-items: center;
49
+ }
50
+ }
@@ -0,0 +1,58 @@
1
+ .atk-pagination {
2
+ display: flex;
3
+ flex-direction: row;
4
+ justify-content: center;
5
+ padding: 10px 0;
6
+ position: relative;
7
+
8
+ & > .atk-btn,
9
+ & > .atk-input {
10
+ font-size: 15px;
11
+ height: 32px;
12
+ border: 1px solid @color-border;
13
+ border-radius: 3px;
14
+ padding: 0 5px;
15
+ text-align: center;
16
+ background: @color-bg;
17
+ }
18
+
19
+ & > .atk-btn {
20
+ user-select: none;
21
+ width: 70px;
22
+ cursor: pointer;
23
+ display: flex;
24
+ justify-content: center;
25
+ align-items: center;
26
+
27
+ &:hover {
28
+ background: @color-bg-grey;
29
+ }
30
+
31
+ &.atk-disabled {
32
+ color: @color-sub;
33
+
34
+ &:hover {
35
+ cursor: default;
36
+ background: initial;
37
+ }
38
+ }
39
+ }
40
+
41
+ & > .atk-input {
42
+ background: transparent;
43
+ color: @color-font;
44
+ font-size: 18px;
45
+ width: 60px;
46
+ outline: none;
47
+
48
+ &:focus {
49
+ border-color: @color-main;
50
+ }
51
+ }
52
+
53
+ & > * {
54
+ &:not(:last-child) {
55
+ margin-right: 10px;
56
+ }
57
+ }
58
+ }