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
@@ -1,5 +1,8 @@
1
+ @header-height: 60px;
2
+ @nav-height: 40px;
3
+
1
4
  .atk-sidebar {
2
- @width: 450px;
5
+ @width: 430px;
3
6
  position: fixed;
4
7
  z-index: 99999;
5
8
  top: 0;
@@ -18,86 +21,247 @@
18
21
 
19
22
  .atk-sidebar-inner {
20
23
  position: relative;
24
+ }
25
+
26
+ // Header
27
+ .atk-sidebar-header {
28
+ display: flex;
29
+ flex-direction: row;
30
+ align-items: center;
31
+ border-bottom: 1px solid @color-border;
32
+
33
+ .atk-avatar {
34
+ display: flex;
35
+ width: @header-height + 5px;
36
+ height: @header-height;
37
+ align-items: center;
38
+ justify-content: center;
21
39
 
22
- .atk-sidebar-title-wrap {
23
- padding: 15px 35px 10px 20px;
40
+ img, .atk-site-logo {
41
+ @height: @header-height - 30px;
42
+ height: @height;
43
+ width: @header-height - 30px;
44
+ border-radius: 2px;
45
+ background: @color-meta;
46
+ text-align: center;
47
+ line-height: @height;
48
+ font-size: 13px;
49
+ color: @color-bg;
50
+ }
24
51
 
25
- .atk-title-item {
52
+ .atk-site-logo {
26
53
  user-select: none;
27
- font-size: 17px;
28
54
  cursor: pointer;
29
- color: var(--at-color-font);
55
+ }
56
+ }
30
57
 
31
- &.atk-active {
32
- color: var(--at-color-font) !important;
33
- font-size: 23px;
34
- cursor: initial;
35
- }
58
+ .atk-menu {
59
+ flex: auto;
60
+ text-align: center;
36
61
 
37
- &:hover {
38
- color: var(--at-color-main);
39
- }
62
+ .atk-item {
63
+ position: relative;
64
+ color: @color-sub;
65
+ font-size: 20px;
66
+ // cursor: pointer;
67
+ user-select: none;
40
68
 
41
69
  &:not(:last-child) {
42
- margin-right: 25px;
70
+ margin-right: 20px;
71
+ }
72
+
73
+ &.atk-active {
74
+ color: @color-font;
75
+
76
+ &:after {
77
+ content: ' ';
78
+ position: absolute;
79
+ bottom: 0;
80
+ left: 0;
81
+ width: 100%;
82
+ height: 6px;
83
+ background: @color-main;
84
+ opacity: .4;
85
+ }
43
86
  }
44
87
  }
45
88
  }
46
89
 
47
90
  .atk-sidebar-close {
48
- position: absolute;
49
91
  display: flex;
50
- right: 10px;
51
- top: 10px;
52
- width: 40px;
53
- height: 40px;
92
+ flex-direction: column;
93
+ width: @header-height;
94
+ height: @header-height;
54
95
  align-items: center;
55
96
  place-content: center;
56
97
  cursor: pointer;
57
98
  user-select: none;
99
+ margin-left: 10px;
58
100
 
59
- &:hover {
60
- background: rgba(232, 17, 35, 0.9);
61
- svg {
62
- fill: #fff;
63
- }
64
- }
65
-
66
- & svg {
67
- fill: @color-font;
101
+ &:hover .atk-icon-close {
102
+ background-color: rgba(232, 17, 35, 0.9);
68
103
  }
69
104
  }
70
105
  }
71
106
 
72
- .atk-sidebar-actions {
107
+ // Nav
108
+ .atk-sidebar-nav {
73
109
  display: flex;
74
110
  flex-direction: row;
75
111
  border-bottom: 1px solid @color-border;
112
+ height: @nav-height + 1px;
76
113
 
77
- .atk-action-item {
114
+ .akt-curt-view-btn {
78
115
  display: flex;
79
- flex-grow: 1;
80
- scroll-snap-align: start;
81
- place-content: center;
82
- line-height: 40px;
116
+ align-items: center;
117
+ padding: 0 20px;
118
+ border-right: 1px solid @color-border;
83
119
  cursor: pointer;
84
120
  user-select: none;
121
+ height: @nav-height;
122
+ line-height: @nav-height;
123
+ white-space: nowrap;
85
124
 
86
125
  &:hover {
87
126
  background: @color-bg-grey;
88
127
  }
89
128
 
90
- &.atk-active {
91
- color: @color-main;
92
- font-weight: bold;
129
+ .atk-icon {
130
+ width: 17px;
131
+
132
+ span {
133
+ position: relative;
134
+ display: block;
135
+ width: 14px;
136
+ height: 1px;
137
+ margin: 0 auto 4px;
138
+ background: @color-deep;
139
+ transform-origin: 20px;
140
+
141
+ &:last-child {
142
+ margin-bottom: 0;
143
+ }
144
+ }
145
+
146
+ &.atk-arrow span {
147
+ width: 8px;
148
+ opacity: 1;
149
+ transform: rotate(-45deg);
150
+ transform-origin: 7px;
151
+
152
+ &:nth-child(2) {
153
+ transform: rotate(0deg);
154
+ width: 0;
155
+ opacity: 0;
156
+ }
157
+
158
+ &:nth-child(3) {
159
+ opacity: 1;
160
+ transform: rotate(45deg);
161
+ }
162
+ }
163
+ }
164
+
165
+ .atk-text {
166
+ margin-left: 10px;
167
+ }
168
+ }
169
+
170
+ .atk-tabs {
171
+ &::-webkit-scrollbar {
172
+ width: 0;
173
+ height: 0;
174
+ background: transparent;
175
+ }
176
+
177
+ display: flex;
178
+ flex-direction: row;
179
+ overflow-y: auto;
180
+
181
+ &.atk-views .atk-active {
182
+
183
+ }
184
+
185
+ .atk-tab-item {
186
+ line-height: @nav-height;
187
+ height: @nav-height;
188
+ color: @color-sub;
189
+ cursor: pointer;
190
+ user-select: none;
191
+ padding: 0 20px;
192
+ white-space: nowrap;
193
+
194
+ &:hover {
195
+ background: @color-bg-grey;
196
+ }
197
+
198
+ &.atk-active {
199
+ color: @color-deep;
200
+ }
201
+ }
202
+ }
203
+ }
204
+
205
+ .atk-site-list-floater {
206
+ .atk-slim-scrollbar();
207
+
208
+ position: absolute;
209
+ z-index: 9999;
210
+ left: 50%;
211
+ top: 70px;
212
+ transform: translateX(-50%);
213
+ pointer-events: all;
214
+ background: @color-bg;
215
+ width: 80%;
216
+ max-height: 40%;
217
+ margin: 0 auto;
218
+ border: 1px solid @color-border;
219
+ border-radius: 4px;
220
+ overflow-y: auto;
221
+
222
+ .atk-sites {
223
+ display: flex;
224
+ flex-direction: column;
225
+ padding: 7px 0;
226
+
227
+ .atk-site-item {
228
+ display: flex;
229
+ flex-direction: row;
230
+ cursor: pointer;
231
+ align-items: center;
232
+ padding: 0 10px;
233
+ margin-bottom: 1px;
234
+
235
+ .atk-site-logo {
236
+ width: 20px;
237
+ height: 20px;
238
+ line-height: 20px;
239
+ background: @color-meta;
240
+ margin: 10px;
241
+ border-radius: 3px;
242
+ text-align: center;
243
+ color: @color-bg;
244
+ font-size: 12px;
245
+ }
246
+
247
+ .atk-site-name {
248
+ color: @color-font;
249
+ font-size: 17px;
250
+ margin-left: 7px;
251
+ }
252
+
253
+ &.atk-active, &:hover {
254
+ background: @color-bg-grey;
255
+ }
93
256
  }
94
257
  }
95
258
  }
96
259
 
97
- .atk-sidebar-content {
260
+ .atk-sidebar-view-wrap {
98
261
  position: relative;
99
262
  overflow-y: auto;
100
- height: calc(100vh - 102px);
263
+ height: calc(100vh - @header-height - @nav-height - 2px);
264
+ .atk-slim-scrollbar();
101
265
 
102
266
  .atk-sidebar-no-content {
103
267
  position: absolute;
@@ -114,232 +278,143 @@
114
278
  }
115
279
  }
116
280
 
117
- .atk-filter-bar {
118
- padding: 0 15px;
119
- font-size: 15px;
120
-
121
- & > span {
122
- display: inline-block;
123
- padding: 3px 13px;
124
- cursor: pointer;
125
- user-select: none;
126
- border-radius: 50px;
127
- margin-bottom: 5px;
128
-
129
- &:hover {
130
- color: #4285f4;
131
- background: @color-bg-grey;
132
- }
133
-
134
- &.atk-active {
135
- background: @color-bg-light;
136
- color: @color-light;
137
- }
281
+ .atk-form {
282
+ @form-height: 35px;
138
283
 
139
- &:not(:last-child) {
140
- margin-right: 5px;
141
- }
142
- }
284
+ padding: 20px 30px;
143
285
 
144
- &:not(:last-child) {
145
- padding-top: 8px;
286
+ .atk-label {
287
+ font-size: 16px;
288
+ margin-bottom: 12px;
289
+ color: @color-font;
146
290
  }
147
- }
148
291
 
149
- .atk-form-inline-wrap {
150
- display: flex;
151
- align-items: center;
152
- justify-content: center;
153
- padding: 15px 0;
154
-
155
- input, select, button {
156
- display: inline !important;
157
- min-width: initial !important;
292
+ .atk-desc {
293
+ font-size: 14px;
294
+ margin-top: 12px;
295
+ margin-left: 15px;
296
+ margin-bottom: 20px;
297
+ display: block;
298
+ color: @color-meta;
158
299
 
159
- @media only screen and (max-width: 768px) {
160
- & {
161
- width: 100%;
162
- }
300
+ a {
301
+ opacity: 0.8;
163
302
  }
164
303
  }
165
304
 
166
- button {
167
- width: 200px !important;
168
- }
169
- }
170
-
171
- .atk-form-wrap, .atk-form-inline-wrap {
172
- padding: 10px 10px;
173
-
174
- input, select {
175
- min-width: 200px;
176
- }
177
-
178
305
  input, textarea {
179
306
  display: block;
180
- line-height: 30px;
307
+ line-height: @form-height;
181
308
  padding: 0 10px;
182
- margin: 0 2px;
309
+ margin: 0;
183
310
  border: none;
184
- border-bottom: 1px solid @color-border;
311
+ border-bottom: 2px solid @color-border;
185
312
  outline: none;
186
313
  width: 100%;
314
+ margin-bottom: 25px;
315
+ background: @color-bg;
187
316
 
188
317
  &:focus {
189
- border-bottom-color: @color-main;
318
+ border-bottom-color: @color-bg-light;
190
319
  }
191
320
 
192
321
  &[type="file"] {
193
- width: 200px;
322
+ border-radius: 2px;
323
+ background: transparent;
324
+ border-bottom: 2px solid @color-border;
194
325
  cursor: pointer;
195
326
  position: relative;
196
- border: 0;
197
- margin: 17px 0;
327
+ padding: 0 15px;
328
+ margin-bottom: 30px;
198
329
  }
199
330
  }
200
331
 
201
332
  textarea {
202
- min-height: 120px;
333
+ font-size: 13px;
334
+ line-height: 20px;
335
+ min-height: 80px;
336
+ resize: vertical;
203
337
  }
204
338
 
205
339
  select {
206
340
  display: block;
207
341
  outline: none;
208
- border: none;
209
- border-bottom: 1px solid @color-border;
210
- height: 30px;
211
- padding: 0 10px;
342
+ height: @form-height;
343
+ padding: 5px 10px;
212
344
  width: 100%;
345
+ border: none;
346
+ border-bottom: 2px solid @color-border;
347
+ margin-bottom: 25px;
348
+ -webkit-appearance: none;
349
+ border-radius: 0;
350
+ background: @color-bg;
213
351
  }
214
352
 
215
353
  button {
216
354
  &:hover {
217
- color: #fff;
218
- background: @color-main;
355
+ background: @color-bg-light;
219
356
  }
220
357
 
358
+ text-align: center;
221
359
  color: @color-light;
222
- background: @color-bg-light;
223
- border: 0;
224
- line-height: 30px;
360
+ background: transparent;
361
+ border: 2px solid @color-bg-light;
362
+ line-height: @form-height;
363
+ letter-spacing: 2em;
364
+ text-indent: 2em; // center
225
365
  cursor: pointer;
226
366
  outline: none;
227
367
  padding: 0 20px;
228
- border-radius: 2px;
368
+ border-radius: 4px;
229
369
  margin: 0 5px;
230
370
  width: 100%;
231
371
  }
232
372
 
233
- .atk-desc {
234
- font-size: 14px;
235
- margin-top: 12px;
236
- margin-left: 15px;
237
- display: block;
373
+ input, select, button {
374
+ font-size: 15px;
238
375
  }
239
376
  }
240
377
 
241
- .atk-admin-setting {
378
+ .atk-log-wrap {
242
379
  .atk-log-back-btn {
243
380
  display: inline-block;
244
- padding: 5px 30px;
381
+ padding: 5px 33px;
245
382
  cursor: pointer;
246
383
  user-select: none;
384
+ border-right: 1px solid @color-border;
385
+ border-left: 1px solid transparent;
247
386
  &:hover {
248
387
  background: #f4f4f4;
249
388
  }
250
389
  }
251
390
 
391
+ .atk-log {}
392
+
252
393
  .atk-iframe {
253
394
  width: 100%;
254
395
  height: calc(100vh - 150px);
255
396
  border: 0;
256
397
  background: #f4f4f4;
257
- border: 5px solid #eee;
398
+ border: 3px solid #eee;
258
399
  }
259
400
  }
260
401
  }
261
402
 
262
- /* Sidebar Common List */
263
- .atk-sidebar .atk-sidebar-list {
264
- & > .atk-item {
265
- display: flex;
266
- align-items: flex-start;
267
- padding: 10px 20px;
268
- flex-direction: column;
269
-
270
- &:not(:last-child) {
271
- border-bottom: 1px solid @color-border;
272
- }
273
-
274
- .atk-title {
275
- font-size: 20px;
276
- display: block;
277
- cursor: pointer;
278
-
279
- &:hover {
280
- color: @color-main;
281
- }
282
- }
283
-
284
- .atk-sub {
285
- display: block;
286
- color: @color-meta;
287
- cursor: pointer;
288
-
289
- &:hover {
290
- color: @color-main;
291
- }
292
- }
293
-
294
- .atk-actions {
295
- display: flex;
296
- margin-top: 10px;
297
- flex-direction: row;
298
- flex-wrap: wrap;
299
-
300
- & > .atk-item {
301
- font-size: 14px;
302
- color: @color-meta;
303
- cursor: pointer;
304
- user-select: none;
305
-
306
- &:not(:last-child) {
307
- margin-right: 10px;
308
- padding-right: 10px;
309
- border-right: 1px solid @color-border;
310
- }
311
-
312
- &:hover {
313
- color: @color-main;
314
- }
315
- }
316
- }
317
- }
318
- }
319
-
320
- .atk-sidebar .atk-setting {
321
- .atk-group {
322
- padding: 15px 25px;
323
-
324
- &:not(:last-child) {
325
- border-bottom: 1px solid @color-border;
326
- }
327
- }
328
-
329
- .atk-title {
330
- font-size: 20px;
331
- margin-bottom: 10px;
332
- }
333
-
334
- .atk-label {
335
- font-size: 16px;
336
- margin-top: 10px;
337
- margin-bottom: 2px;
338
- color: @color-meta;
403
+ .atk-view-name-pages, .atk-view-name-comments {
404
+ padding-bottom: 55px;
405
+
406
+ .atk-pagination-wrap {
407
+ z-index: 200;
408
+ position: fixed;
409
+ width: 100%;
410
+ bottom: 0;
411
+ left: 0;
412
+ background: @color-bg;
413
+ border-top: 1px solid @color-border;
339
414
  }
340
415
 
341
- .atk-btn {
342
- padding: 4px 25px;
343
- margin-top: 20px;
416
+ .atk-list-read-more {
417
+ margin-top: 30px;
418
+ margin-bottom: -40px;
344
419
  }
345
420
  }