artalk 2.1.4 → 2.1.7
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/CNAME +1 -0
- package/dist/Artalk.css +1 -1
- package/dist/Artalk.es.js +303 -1248
- package/dist/Artalk.iife.js +1 -1
- package/dist/Artalk.js +1 -1
- package/index.html +143 -0
- package/package.json +8 -29
- package/postcss.config.js +5 -0
- package/src/api/index.ts +14 -0
- package/src/api/request.ts +4 -2
- package/src/artalk.ts +28 -6
- package/src/components/comment.ts +20 -3
- package/src/components/html/list.html +4 -2
- package/src/components/html/sidebar-layer.html +8 -0
- package/src/components/list.ts +60 -0
- package/src/components/sidebar-layer.ts +143 -0
- package/src/defaults.ts +1 -0
- package/src/lib/detect.js +3 -1
- package/src/lib/utils.ts +25 -0
- package/src/style/_extend.less +0 -80
- package/src/style/comment.less +6 -0
- package/src/style/list.less +66 -0
- package/src/style/main.less +1 -1
- package/src/style/sidebar-layer.less +92 -0
- package/types/artalk-config.d.ts +4 -1
- package/types/artalk-data.d.ts +3 -0
- package/vite-common.config.ts +15 -0
- package/vite-demo.config.ts +14 -0
- package/vite.config.ts +36 -0
- package/LICENSE +0 -674
- package/README.md +0 -84
- package/src/components/admin/page-list.ts +0 -194
- package/src/components/admin/site-list-floater.ts +0 -98
- package/src/components/admin/site-list.ts +0 -289
- package/src/components/html/sidebar.html +0 -22
- package/src/components/item-text-editor.ts +0 -136
- package/src/components/sidebar-view.ts +0 -26
- package/src/components/sidebar-views/comments-view.ts +0 -73
- package/src/components/sidebar-views/pages-view.ts +0 -61
- package/src/components/sidebar-views/setting-view.ts +0 -21
- package/src/components/sidebar-views/sites-view.ts +0 -36
- package/src/components/sidebar-views/transfer-view.ts +0 -218
- package/src/components/sidebar.ts +0 -293
- package/src/lib/md5.js +0 -6
- package/src/style/item-text-editor.less +0 -35
- package/src/style/page-list.less +0 -50
- package/src/style/sidebar.less +0 -420
- package/src/style/site-list.less +0 -208
package/src/lib/utils.ts
CHANGED
|
@@ -178,3 +178,28 @@ export function marked(ctx: Context, src: string): string {
|
|
|
178
178
|
|
|
179
179
|
return markedInstance.parse(src)
|
|
180
180
|
}
|
|
181
|
+
|
|
182
|
+
/** 获取修正后的 UserAgent */
|
|
183
|
+
export async function getCorrectUserAgent() {
|
|
184
|
+
const uaRaw = navigator.userAgent
|
|
185
|
+
const uaData = (navigator as any).userAgentData // @link https://web.dev/migrate-to-ua-ch/
|
|
186
|
+
if (!uaData || !uaData.getHighEntropyValues) {
|
|
187
|
+
return uaRaw
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// microsoft f******k you!!!!!
|
|
191
|
+
// @link https://docs.microsoft.com/en-us/microsoft-edge/web-platform/how-to-detect-win11
|
|
192
|
+
let uaGot: any = null
|
|
193
|
+
try {
|
|
194
|
+
uaGot = await uaData.getHighEntropyValues(["platformVersion"])
|
|
195
|
+
} catch (err) { console.error(err); return uaRaw }
|
|
196
|
+
|
|
197
|
+
if (uaData.platform !== "Windows") { return uaRaw }
|
|
198
|
+
const majorPlatformVersion = Number(uaGot.platformVersion.split('.')[0])
|
|
199
|
+
if (majorPlatformVersion >= 13) {
|
|
200
|
+
// Win11 样本:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36"
|
|
201
|
+
return uaRaw.replace(/Windows\W+NT\W+10.0/, 'Windows NT 11.0')
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return uaRaw
|
|
205
|
+
}
|
package/src/style/_extend.less
CHANGED
|
@@ -18,83 +18,3 @@
|
|
|
18
18
|
background: rgba(41,47,53,.77);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
.atk-list-text-actions() {
|
|
23
|
-
display: flex;
|
|
24
|
-
flex-direction: column;
|
|
25
|
-
flex: auto;
|
|
26
|
-
padding: 0 35px;
|
|
27
|
-
padding-top: 10px;
|
|
28
|
-
padding-bottom: 0;
|
|
29
|
-
flex-wrap: wrap;
|
|
30
|
-
align-content: flex-start;
|
|
31
|
-
|
|
32
|
-
.atk-item {
|
|
33
|
-
position: relative;
|
|
34
|
-
font-size: 17px;
|
|
35
|
-
max-width: 5em;
|
|
36
|
-
display: inline-flex;
|
|
37
|
-
margin-right: 15px;
|
|
38
|
-
margin-bottom: 6px;
|
|
39
|
-
cursor: pointer;
|
|
40
|
-
user-select: none;
|
|
41
|
-
|
|
42
|
-
&.atk-green:after {
|
|
43
|
-
position: absolute;
|
|
44
|
-
content: ' ';
|
|
45
|
-
height: 5px;
|
|
46
|
-
width: 100%;
|
|
47
|
-
left: 0;
|
|
48
|
-
bottom: 5px;
|
|
49
|
-
background: rgba(50, 199, 134, 0.39);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
&.atk-yellow:after {
|
|
53
|
-
position: absolute;
|
|
54
|
-
content: ' ';
|
|
55
|
-
height: 5px;
|
|
56
|
-
width: 100%;
|
|
57
|
-
left: 0;
|
|
58
|
-
bottom: 5px;
|
|
59
|
-
background: rgba(255, 203, 0, 39%);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.atk-list-btn-actions() {
|
|
65
|
-
display: flex;
|
|
66
|
-
flex-direction: row;
|
|
67
|
-
align-items: center;
|
|
68
|
-
padding: 0 20px;
|
|
69
|
-
|
|
70
|
-
.atk-item {
|
|
71
|
-
&:hover {
|
|
72
|
-
background: var(--at-color-bg-grey);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
&:not(:last-child) {
|
|
76
|
-
margin-right: 15px;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
cursor: pointer;
|
|
80
|
-
user-select: none;
|
|
81
|
-
display: flex;
|
|
82
|
-
width: 35px;
|
|
83
|
-
height: 35px;
|
|
84
|
-
border-radius: 2px;
|
|
85
|
-
align-items: center;
|
|
86
|
-
justify-content: center;
|
|
87
|
-
|
|
88
|
-
&.atk-item-close {
|
|
89
|
-
margin-left: 10px;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.atk-icon {
|
|
94
|
-
background-color: var(--at-color-meta);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.atk-icon-yes {
|
|
98
|
-
background-color: var(--at-color-main);
|
|
99
|
-
}
|
|
100
|
-
}
|
package/src/style/comment.less
CHANGED
package/src/style/list.less
CHANGED
|
@@ -7,6 +7,72 @@
|
|
|
7
7
|
padding: 10px 10px 5px 10px;
|
|
8
8
|
border-bottom: 1px solid var(--at-color-border);
|
|
9
9
|
|
|
10
|
+
.atk-text {
|
|
11
|
+
display: inline-block;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* 下拉选择层 */
|
|
15
|
+
.atk-dropdown-wrap {
|
|
16
|
+
position: relative;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
|
|
19
|
+
.atk-arrow-down-icon {
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
vertical-align: middle;
|
|
22
|
+
border-top: 6px solid var(--at-color-grey);
|
|
23
|
+
border-left: 4px solid transparent;
|
|
24
|
+
border-right: 4px solid transparent;
|
|
25
|
+
margin-top: -1px;
|
|
26
|
+
margin-left: 0.4rem;
|
|
27
|
+
display: inline-block;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&:hover {
|
|
31
|
+
.atk-dropdown {
|
|
32
|
+
display: block;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.atk-dropdown {
|
|
37
|
+
z-index: 888;
|
|
38
|
+
display: none;
|
|
39
|
+
height: auto !important;
|
|
40
|
+
max-height: calc(100vh - 2.7rem);
|
|
41
|
+
overflow-y: auto;
|
|
42
|
+
position: absolute;
|
|
43
|
+
top: 100%;
|
|
44
|
+
right: 0;
|
|
45
|
+
width: 100%;
|
|
46
|
+
background-color: var(--at-color-bg);
|
|
47
|
+
padding: 0.6rem 0;
|
|
48
|
+
border: 1px solid var(--at-color-border);
|
|
49
|
+
text-align: center;
|
|
50
|
+
border-radius: 0.25rem;
|
|
51
|
+
white-space: nowrap;
|
|
52
|
+
margin: 0;
|
|
53
|
+
list-style: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.atk-dropdown-item {
|
|
57
|
+
span, a {
|
|
58
|
+
display: block;
|
|
59
|
+
line-height: 2rem;
|
|
60
|
+
position: relative;
|
|
61
|
+
border-bottom: none;
|
|
62
|
+
font-weight: 400;
|
|
63
|
+
padding: 0 1.5rem;
|
|
64
|
+
|
|
65
|
+
&:hover {
|
|
66
|
+
color: var(--at-color-main);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&.active span, a {
|
|
71
|
+
color: var(--at-color-main);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
10
76
|
.atk-comment-count {
|
|
11
77
|
font-size: 15px;
|
|
12
78
|
|
package/src/style/main.less
CHANGED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
@header-height: 60px;
|
|
2
|
+
@nav-height: 40px;
|
|
3
|
+
|
|
4
|
+
.atk-sidebar-layer {
|
|
5
|
+
@width: 430px;
|
|
6
|
+
position: fixed;
|
|
7
|
+
z-index: 99999;
|
|
8
|
+
top: 0;
|
|
9
|
+
right: 0;
|
|
10
|
+
width: @width;
|
|
11
|
+
height: 100%;
|
|
12
|
+
background: var(--at-color-bg);
|
|
13
|
+
transition: transform 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms;
|
|
14
|
+
transform: translate(@width, 0px);
|
|
15
|
+
|
|
16
|
+
@media only screen and (max-width: @width) {
|
|
17
|
+
& {
|
|
18
|
+
width: 100%;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.atk-sidebar-inner {
|
|
23
|
+
position: relative;
|
|
24
|
+
height: 100%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Header
|
|
28
|
+
.atk-sidebar-header {
|
|
29
|
+
position: absolute;
|
|
30
|
+
top: 0;
|
|
31
|
+
right: 0;
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: row;
|
|
34
|
+
align-items: center;
|
|
35
|
+
z-index: 99999;
|
|
36
|
+
|
|
37
|
+
.atk-sidebar-close {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
width: @header-height;
|
|
41
|
+
height: @header-height;
|
|
42
|
+
align-items: center;
|
|
43
|
+
place-content: center;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
user-select: none;
|
|
46
|
+
margin-left: 10px;
|
|
47
|
+
|
|
48
|
+
&:hover .atk-icon-close {
|
|
49
|
+
background-color: rgba(232, 17, 35, 0.9);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.atk-sidebar-iframe-wrap {
|
|
55
|
+
height: 100%;
|
|
56
|
+
position: relative;
|
|
57
|
+
|
|
58
|
+
iframe {
|
|
59
|
+
border: 0;
|
|
60
|
+
width: 100%;
|
|
61
|
+
height: 100%;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.atk-err-alert {
|
|
65
|
+
z-index: 9999;
|
|
66
|
+
top: 50%;
|
|
67
|
+
left: 50%;
|
|
68
|
+
transform: translate(-50%, -50%);
|
|
69
|
+
position: absolute;
|
|
70
|
+
background: var(--at-color-bg);
|
|
71
|
+
padding: 40px 30px;
|
|
72
|
+
width: 80%;
|
|
73
|
+
text-align: center;
|
|
74
|
+
border-radius: 4px;
|
|
75
|
+
|
|
76
|
+
.atk-title {
|
|
77
|
+
font-size: 1.4em;
|
|
78
|
+
margin-bottom: 20px;
|
|
79
|
+
color: var(--at-color-font);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.atk-text {
|
|
83
|
+
color: var(--at-color-font);
|
|
84
|
+
|
|
85
|
+
span {
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
color: var(--at-color-main);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
package/types/artalk-config.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export default interface ArtalkConfig {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/** 内容限高 */
|
|
51
|
-
heightLimit
|
|
51
|
+
heightLimit?: {
|
|
52
52
|
/** 评论内容限高 */
|
|
53
53
|
content?: number
|
|
54
54
|
|
|
@@ -62,6 +62,9 @@ export default interface ArtalkConfig {
|
|
|
62
62
|
/** 评论投票反对按钮 */
|
|
63
63
|
voteDown?: boolean
|
|
64
64
|
|
|
65
|
+
/** PV 元素 Selector */
|
|
66
|
+
pvEl?: string
|
|
67
|
+
|
|
65
68
|
/** 暗黑模式 */
|
|
66
69
|
darkMode?: boolean
|
|
67
70
|
|
package/types/artalk-data.d.ts
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { UserConfigExport } from 'vite'
|
|
2
|
+
import { version } from './package.json'
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
define: {
|
|
6
|
+
ARTALK_VERSION: JSON.stringify(version)
|
|
7
|
+
},
|
|
8
|
+
css: {
|
|
9
|
+
preprocessorOptions: {
|
|
10
|
+
less: {
|
|
11
|
+
additionalData: `@import "./src/style/_variables.less";@import "./src/style/_extend.less";`
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
} as UserConfigExport
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import { resolve } from 'path'
|
|
3
|
+
import commonConf from './vite-common.config'
|
|
4
|
+
import tsconfigPaths from 'vite-tsconfig-paths'
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
build: {
|
|
8
|
+
target: 'esnext',
|
|
9
|
+
outDir: resolve(__dirname, "deploy"),
|
|
10
|
+
rollupOptions: {}
|
|
11
|
+
},
|
|
12
|
+
plugins: [tsconfigPaths()],
|
|
13
|
+
...commonConf
|
|
14
|
+
})
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import { resolve } from 'path'
|
|
3
|
+
import commonConf from './vite-common.config'
|
|
4
|
+
import tsconfigPaths from 'vite-tsconfig-paths'
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
build: {
|
|
8
|
+
target: 'es2015',
|
|
9
|
+
outDir: resolve(__dirname, "dist"),
|
|
10
|
+
minify: 'terser',
|
|
11
|
+
lib: {
|
|
12
|
+
entry: resolve(__dirname, 'src/main.ts'),
|
|
13
|
+
name: 'Artalk',
|
|
14
|
+
fileName: (format) => ((format == "umd") ? 'Artalk.js' : `Artalk.${format}.js`),
|
|
15
|
+
formats: ["es", "umd", "iife"]
|
|
16
|
+
},
|
|
17
|
+
rollupOptions: {
|
|
18
|
+
// 确保外部化处理那些你不想打包进库的依赖
|
|
19
|
+
external: ['vue'],
|
|
20
|
+
output: {
|
|
21
|
+
assetFileNames: assetInfo => {
|
|
22
|
+
if (/\.css$/.test(assetInfo.name)) {
|
|
23
|
+
return 'Artalk.css'
|
|
24
|
+
}
|
|
25
|
+
return "[name].[ext]"
|
|
26
|
+
},
|
|
27
|
+
// 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
|
|
28
|
+
globals: {
|
|
29
|
+
vue: 'Vue'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
plugins: [tsconfigPaths()],
|
|
35
|
+
...commonConf
|
|
36
|
+
})
|