dsh-pick 0.2.4 → 0.2.6
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 +3 -2
- package/package.json +1 -1
- package/plugin/client.js +79 -68
- package/web/panel.html +94 -20
- package/web/panel.js +2 -2
package/README.md
CHANGED
|
@@ -38,7 +38,8 @@ npm 官网和各类 stat 站能看数字,但看数字回答不了「我该装
|
|
|
38
38
|
dsh plugin --profile web add dsh-pick
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
装完重启 `dsh web
|
|
41
|
+
装完重启 `dsh web`,在**右侧栏**的引导页点「选插件」,就是完整的选插件面板。
|
|
42
|
+
**设置 → dsh-pick** 是精简页:版本 / 更新 / 卸载、怎么打开面板、数据口径。
|
|
42
43
|
面板顶部一行:插件名、当前版本号、更新按钮,最右侧是卸载按钮——更新和卸载都交给 DSH 自己的插件管理器,完成后重启 DSH 生效。
|
|
43
44
|
|
|
44
45
|
首次使用要先生成目录(在 dsh-pick 的安装目录下,或任意目录):
|
|
@@ -96,7 +97,7 @@ dsh-pick/
|
|
|
96
97
|
├── data/catalog.json 目录产物
|
|
97
98
|
├── plugin/
|
|
98
99
|
│ ├── index.js DSH 宿主端:挂 /api-dsh-pick/* 路由
|
|
99
|
-
│ ├── client.js
|
|
100
|
+
│ ├── client.js 右侧栏页签(iframe 复用 web/panel.html)+ 设置页精简版
|
|
100
101
|
│ └── cordis.patch.yml 插进 DSH
|
|
101
102
|
└── web/
|
|
102
103
|
├── panel.html 选插件面板(独立调试用,也是插件内嵌的同一份)
|
package/package.json
CHANGED
package/plugin/client.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// plugin/client.js — dsh-pick 的设置页
|
|
3
3
|
//
|
|
4
4
|
// 手写单文件 bundle,没有构建链:由 dsh web 客户端的 ModuleLoader 注入
|
|
5
|
-
// (写法照 dsh-model / dsh-vps-manager)。挂两处:DSH
|
|
6
|
-
// 和「设置 → dsh-pick
|
|
5
|
+
// (写法照 dsh-model / dsh-vps-manager)。挂两处:DSH 右侧栏的一个页签(完整面板),
|
|
6
|
+
// 和「设置 → dsh-pick」(精简版:版本 / 更新 / 卸载、怎么打开、数据口径)。
|
|
7
7
|
//
|
|
8
8
|
// 界面本身就是一个 iframe,指向宿主路由 /api-dsh-pick/panel —— 面板那套 UI
|
|
9
9
|
// 是独立调试过的(dsh-pick serve 直接能开),这里原样复用,不再用 React 重写一遍。
|
|
@@ -15,7 +15,7 @@ window.__ModuleLoader__.load({
|
|
|
15
15
|
const module = { exports: {} }
|
|
16
16
|
const React = require('react')
|
|
17
17
|
const h = React.createElement
|
|
18
|
-
const { useEffect,
|
|
18
|
+
const { useEffect, useState } = React
|
|
19
19
|
|
|
20
20
|
// 语言:跟着页面(dsh 只有中、英两种)
|
|
21
21
|
const isZh = () => {
|
|
@@ -30,7 +30,7 @@ window.__ModuleLoader__.load({
|
|
|
30
30
|
sub: 'var(--dsw-alias-label-secondary, #888)',
|
|
31
31
|
faint: 'var(--dsw-alias-label-tertiary, #999)',
|
|
32
32
|
border: 'var(--dsw-alias-border-l3, rgba(127,127,127,.25))',
|
|
33
|
-
accent: '#2f6bff',
|
|
33
|
+
accent: 'var(--dsw-alias-link, #2f6bff)',
|
|
34
34
|
danger: '#c94040',
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -137,83 +137,90 @@ window.__ModuleLoader__.load({
|
|
|
137
137
|
)
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
/**
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
140
|
+
/** 右侧栏里的完整面板:标题行 + 占满栏高的 iframe(iframe 自己滚动;目录信息面板里自带) */
|
|
141
|
+
function PickPanel() {
|
|
142
|
+
return h('div', {
|
|
143
|
+
style: { color: C.text, height: '100%', display: 'flex', flexDirection: 'column', padding: '10px 12px', boxSizing: 'border-box' },
|
|
144
|
+
},
|
|
145
|
+
h(HeaderBar),
|
|
146
|
+
h('iframe', {
|
|
147
|
+
src: '/api-dsh-pick/panel',
|
|
148
|
+
title: 'dsh-pick',
|
|
149
|
+
style: {
|
|
150
|
+
width: '100%',
|
|
151
|
+
flex: '1 1 0',
|
|
152
|
+
minHeight: 0,
|
|
153
|
+
border: '1px solid ' + C.border,
|
|
154
|
+
borderRadius: '10px',
|
|
155
|
+
background: 'transparent',
|
|
156
|
+
display: 'block',
|
|
157
|
+
},
|
|
158
|
+
}),
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// 数据口径说明:面板底部原来那段,现在放在设置页
|
|
163
|
+
const DATA_NOTE = () => L(
|
|
164
|
+
'排名按周下载;日常基线已扣掉版本发布日与次日的拉取虚高,比原始下载量更接近真实使用量。' +
|
|
165
|
+
'下载量含 CI / 镜像 / 爬虫流量,不等于用户数。npm 统计约滞后 5 天。',
|
|
166
|
+
'Ranks are weekly downloads; daily baseline strips the publish-day spike and is closer to real use. ' +
|
|
167
|
+
'Download counts include CI/mirror/crawler traffic, not real users. npm stats lag about 5 days.')
|
|
168
|
+
|
|
169
|
+
/** 右侧栏的服务(apply 里拿到);老版本 DSH 没有 */
|
|
170
|
+
let sidebarRightApi = null
|
|
171
|
+
|
|
172
|
+
function Section({ title, children }) {
|
|
173
|
+
return h('div', { style: { marginTop: 18 } },
|
|
174
|
+
h('div', { style: { fontSize: 13, fontWeight: 600, marginBottom: 6 } }, title),
|
|
175
|
+
h('div', { style: { fontSize: 12.5, color: C.sub, lineHeight: 1.7 } }, children))
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** 设置页:完整面板在右侧栏,这里只放管理和说明 */
|
|
179
|
+
function SettingsSection() {
|
|
146
180
|
const [meta, setMeta] = useState(null)
|
|
147
|
-
const [
|
|
181
|
+
const [openMsg, setOpenMsg] = useState('')
|
|
148
182
|
|
|
149
183
|
useEffect(() => {
|
|
150
184
|
let alive = true
|
|
151
|
-
|
|
152
|
-
.then(r => r.json())
|
|
153
|
-
.then(j => { if (alive) setMeta(j) })
|
|
154
|
-
.catch(() => {})
|
|
185
|
+
api('meta').then(j => { if (alive) setMeta(j) }).catch(() => {})
|
|
155
186
|
return () => { alive = false }
|
|
156
187
|
}, [])
|
|
157
188
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
} catch { /* 跨域就不管,保持默认高度 */ }
|
|
169
|
-
}, 1500)
|
|
170
|
-
return () => clearInterval(t)
|
|
171
|
-
}, [frameH, fill])
|
|
189
|
+
const openSidebar = () => {
|
|
190
|
+
try {
|
|
191
|
+
sidebarRightApi.openTab(SIDEBAR_KIND)
|
|
192
|
+
setOpenMsg(L('已在右侧栏打开,关闭设置就能看到', 'Opened in the right sidebar; close Settings to see it'))
|
|
193
|
+
} catch {
|
|
194
|
+
// 右侧栏是跟着对话走的:没有打开的对话时开不了
|
|
195
|
+
setOpenMsg(L('先回到一个对话,再从右侧栏打开', 'Go back to a conversation first, then open it from the right sidebar'))
|
|
196
|
+
}
|
|
197
|
+
}
|
|
172
198
|
|
|
173
|
-
const
|
|
199
|
+
const catalog = !meta
|
|
174
200
|
? L('正在读取目录…', 'Loading catalog…')
|
|
175
201
|
: meta.total
|
|
176
202
|
? L(
|
|
177
|
-
|
|
178
|
-
`${meta.total.toLocaleString()} plugins
|
|
203
|
+
`目录收录 ${meta.total.toLocaleString()} 个插件,其中 ${meta.deepCount} 个有去噪指标;数据截止 ${meta.anchor}。`,
|
|
204
|
+
`${meta.total.toLocaleString()} plugins in the catalog, ${meta.deepCount} with denoised metrics; data as of ${meta.anchor}.`)
|
|
179
205
|
: L('目录未生成:在 dsh-pick 目录跑一次 dsh-pick build', 'Catalog not built yet: run `dsh-pick build`')
|
|
180
206
|
|
|
181
|
-
return h('div', {
|
|
182
|
-
style: fill
|
|
183
|
-
? { color: C.text, height: '100%', display: 'flex', flexDirection: 'column', padding: '10px 12px', boxSizing: 'border-box' }
|
|
184
|
-
: { color: C.text },
|
|
185
|
-
},
|
|
207
|
+
return h('div', { style: { color: C.text } },
|
|
186
208
|
h(HeaderBar),
|
|
187
|
-
h('div', {
|
|
188
|
-
style: {
|
|
189
|
-
fontSize: 12, color: C.faint, margin: '2px 0 10px', lineHeight: 1.6,
|
|
190
|
-
},
|
|
191
|
-
}, tip),
|
|
192
209
|
|
|
193
|
-
h('
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
borderRadius: '10px',
|
|
204
|
-
background: 'transparent',
|
|
205
|
-
display: 'block',
|
|
206
|
-
},
|
|
207
|
-
}),
|
|
210
|
+
h(Section, { title: L('怎么打开', 'How to open') },
|
|
211
|
+
h('div', null, L(
|
|
212
|
+
'选插件面板在对话页的右侧栏:打开右侧栏,在引导页里点「选插件」。',
|
|
213
|
+
'The picker lives in the conversation\'s right sidebar: open the sidebar and choose "Pick a plugin" on its guide page.')),
|
|
214
|
+
sidebarRightApi
|
|
215
|
+
? h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, marginTop: 8, flexWrap: 'wrap' } },
|
|
216
|
+
h(Btn, { onClick: openSidebar }, L('在右侧栏打开', 'Open in right sidebar')),
|
|
217
|
+
openMsg ? h('span', { style: { fontSize: 12, color: C.faint } }, openMsg) : null)
|
|
218
|
+
: null,
|
|
219
|
+
),
|
|
208
220
|
|
|
209
|
-
h('
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
L(
|
|
213
|
-
'排名按周下载;日常基线已扣掉版本发布日与次日的拉取虚高,比原始下载量更接近真实使用量。' +
|
|
214
|
-
'下载量含 CI / 镜像 / 爬虫流量,不等于用户数。',
|
|
215
|
-
'Ranks are weekly downloads; daily baseline strips the publish-day spike. ' +
|
|
216
|
-
'Download counts include CI/mirror traffic, not real users.'),
|
|
221
|
+
h(Section, { title: L('数据口径', 'About the data') },
|
|
222
|
+
h('div', null, catalog),
|
|
223
|
+
h('div', { style: { marginTop: 4 } }, DATA_NOTE()),
|
|
217
224
|
),
|
|
218
225
|
)
|
|
219
226
|
}
|
|
@@ -221,7 +228,6 @@ window.__ModuleLoader__.load({
|
|
|
221
228
|
// 右侧栏页签(DSH 0.2 起有右侧栏;老版本没有这个服务就只在设置页里)
|
|
222
229
|
const SIDEBAR_TAB_ID = 'dsh-pick/panel'
|
|
223
230
|
const SIDEBAR_KIND = 'dsh-pick'
|
|
224
|
-
const SidebarBody = () => h(PickPanel, { fill: true })
|
|
225
231
|
|
|
226
232
|
function PickIcon({ size = 16 }) {
|
|
227
233
|
return h('svg', { width: size, height: size, viewBox: '0 0 32 32', fill: 'none' },
|
|
@@ -232,6 +238,7 @@ window.__ModuleLoader__.load({
|
|
|
232
238
|
function apply(ctx) {
|
|
233
239
|
try {
|
|
234
240
|
ctx.inject && ctx.inject(['sidebarRight', 'sidebarRightTabs'], (scope) => {
|
|
241
|
+
const right = (scope.get && scope.get('sidebarRight')) || scope.sidebarRight
|
|
235
242
|
const tabs = (scope.get && scope.get('sidebarRightTabs')) || scope.sidebarRightTabs
|
|
236
243
|
if (!tabs || typeof tabs.register !== 'function') return
|
|
237
244
|
const effect = (fn, label) => (scope.effect ? scope.effect(fn, label) : fn())
|
|
@@ -250,8 +257,12 @@ window.__ModuleLoader__.load({
|
|
|
250
257
|
}],
|
|
251
258
|
}), 'dsh-pick: sidebar type')
|
|
252
259
|
const slots = scope.slots || ctx.slots
|
|
253
|
-
const body = () => slots.register({ name: 'sidebar.right.pane.tab', key: SIDEBAR_TAB_ID },
|
|
260
|
+
const body = () => slots.register({ name: 'sidebar.right.pane.tab', key: SIDEBAR_TAB_ID }, PickPanel)
|
|
254
261
|
effect(() => (slots.inject ? slots.inject('sidebar.right.pane.tab', body) : body()), 'dsh-pick: sidebar body')
|
|
262
|
+
if (right && typeof right.openTab === 'function') {
|
|
263
|
+
sidebarRightApi = right
|
|
264
|
+
effect(() => () => { if (sidebarRightApi === right) sidebarRightApi = null }, 'dsh-pick: sidebar api')
|
|
265
|
+
}
|
|
255
266
|
})
|
|
256
267
|
} catch (error) {
|
|
257
268
|
console.warn('[dsh-pick] 右侧栏注册失败', error)
|
|
@@ -260,7 +271,7 @@ window.__ModuleLoader__.load({
|
|
|
260
271
|
ctx.slots.inject('settings.section', () =>
|
|
261
272
|
ctx.slots.register(
|
|
262
273
|
{ name: 'settings.section', id: 'dsh-pick', order: 30, label: () => 'dsh-pick' },
|
|
263
|
-
|
|
274
|
+
SettingsSection,
|
|
264
275
|
))
|
|
265
276
|
} catch (error) {
|
|
266
277
|
console.warn('[dsh-pick] 设置页注册失败', error)
|
package/web/panel.html
CHANGED
|
@@ -13,6 +13,41 @@
|
|
|
13
13
|
--ok:#0f9d58; --ok-bg:#e7f6ee;
|
|
14
14
|
--warn:#d97a06; --warn-bg:#fdf3e3;
|
|
15
15
|
--bad:#c94040; --bad-bg:#fdecec;
|
|
16
|
+
--input:#fcfcfd; --mute:#b9c2ce; --row-hover:#fafbfc; --accent-line:#c6d4f5;
|
|
17
|
+
--bar-bg:rgba(245,246,248,.92); --shadow:rgba(16,24,40,.09); --focus:rgba(47,107,255,.12);
|
|
18
|
+
--ok-text:#0b7a45; --warn-text:#a8620a; --bad-text:#a52f2f;
|
|
19
|
+
--ok-line:#bfe6d1; --warn-line:#f2ddb6; --bad-line:#f2cccc;
|
|
20
|
+
color-scheme:light;
|
|
21
|
+
}
|
|
22
|
+
/* 暗色:嵌在 DSH 里时由下面的脚本按 DSH 主题设 data-theme(并把 DSH 的颜色变量覆盖上来);
|
|
23
|
+
单独打开(dsh-pick serve)时跟随系统 */
|
|
24
|
+
:root[data-theme="dark"]{
|
|
25
|
+
--bg:#17181c; --panel:#212228; --line:rgba(255,255,255,.12); --soft:#2a2c33;
|
|
26
|
+
--text:#e9ebf0; --t2:#b3b9c4; --t3:#868d99;
|
|
27
|
+
--accent:#5b8cff; --accent-bg:rgba(91,140,255,.16);
|
|
28
|
+
--ok:#3ccf7f; --ok-bg:rgba(60,207,127,.13);
|
|
29
|
+
--warn:#f0a43a; --warn-bg:rgba(240,164,58,.13);
|
|
30
|
+
--bad:#f06b6b; --bad-bg:rgba(240,107,107,.13);
|
|
31
|
+
--input:#1b1c21; --mute:#5c626d; --row-hover:rgba(255,255,255,.04); --accent-line:rgba(91,140,255,.45);
|
|
32
|
+
--bar-bg:rgba(23,24,28,.9); --shadow:rgba(0,0,0,.4); --focus:rgba(91,140,255,.25);
|
|
33
|
+
--ok-text:#5fd99a; --warn-text:#f3b65e; --bad-text:#f58a8a;
|
|
34
|
+
--ok-line:rgba(60,207,127,.3); --warn-line:rgba(240,164,58,.3); --bad-line:rgba(240,107,107,.3);
|
|
35
|
+
color-scheme:dark;
|
|
36
|
+
}
|
|
37
|
+
@media (prefers-color-scheme: dark){
|
|
38
|
+
:root:not([data-theme="light"]){
|
|
39
|
+
--bg:#17181c; --panel:#212228; --line:rgba(255,255,255,.12); --soft:#2a2c33;
|
|
40
|
+
--text:#e9ebf0; --t2:#b3b9c4; --t3:#868d99;
|
|
41
|
+
--accent:#5b8cff; --accent-bg:rgba(91,140,255,.16);
|
|
42
|
+
--ok:#3ccf7f; --ok-bg:rgba(60,207,127,.13);
|
|
43
|
+
--warn:#f0a43a; --warn-bg:rgba(240,164,58,.13);
|
|
44
|
+
--bad:#f06b6b; --bad-bg:rgba(240,107,107,.13);
|
|
45
|
+
--input:#1b1c21; --mute:#5c626d; --row-hover:rgba(255,255,255,.04); --accent-line:rgba(91,140,255,.45);
|
|
46
|
+
--bar-bg:rgba(23,24,28,.9); --shadow:rgba(0,0,0,.4); --focus:rgba(91,140,255,.25);
|
|
47
|
+
--ok-text:#5fd99a; --warn-text:#f3b65e; --bad-text:#f58a8a;
|
|
48
|
+
--ok-line:rgba(60,207,127,.3); --warn-line:rgba(240,164,58,.3); --bad-line:rgba(240,107,107,.3);
|
|
49
|
+
color-scheme:dark;
|
|
50
|
+
}
|
|
16
51
|
}
|
|
17
52
|
*{box-sizing:border-box}
|
|
18
53
|
body{
|
|
@@ -24,7 +59,7 @@ body{
|
|
|
24
59
|
a{color:var(--accent);text-decoration:none}
|
|
25
60
|
|
|
26
61
|
/* ---------- 顶栏 ---------- */
|
|
27
|
-
.bar{position:sticky;top:0;z-index:40;background:
|
|
62
|
+
.bar{position:sticky;top:0;z-index:40;background:var(--bar-bg);backdrop-filter:blur(8px);
|
|
28
63
|
padding:16px 0 12px;border-bottom:1px solid var(--line);margin-bottom:22px}
|
|
29
64
|
.bar .top{display:flex;align-items:center;gap:14px;flex-wrap:wrap}
|
|
30
65
|
.logo{width:38px;height:38px;border-radius:10px;background:var(--accent);color:#fff;
|
|
@@ -36,7 +71,7 @@ h1{margin:0;font-size:19px;font-weight:650;letter-spacing:-.2px}
|
|
|
36
71
|
.tabs{display:flex;gap:2px;margin-top:14px;background:var(--soft);border-radius:9px;padding:3px;width:max-content}
|
|
37
72
|
.tabs button{appearance:none;border:none;background:transparent;font-family:inherit;font-size:12.5px;
|
|
38
73
|
font-weight:600;color:var(--t3);padding:7px 16px;border-radius:6px;cursor:pointer}
|
|
39
|
-
.tabs button.on{background
|
|
74
|
+
.tabs button.on{background:var(--panel);color:var(--text);box-shadow:0 1px 2px var(--shadow)}
|
|
40
75
|
|
|
41
76
|
/* ---------- 选插件 ---------- */
|
|
42
77
|
.ask{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:22px;margin-bottom:18px}
|
|
@@ -44,24 +79,24 @@ h1{margin:0;font-size:19px;font-weight:650;letter-spacing:-.2px}
|
|
|
44
79
|
.ask .row{display:flex;gap:10px}
|
|
45
80
|
.ask input{
|
|
46
81
|
flex:1;appearance:none;border:1px solid var(--line);border-radius:10px;padding:13px 16px;
|
|
47
|
-
font-size:14.5px;font-family:inherit;background
|
|
82
|
+
font-size:14.5px;font-family:inherit;background:var(--input);color:var(--text)
|
|
48
83
|
}
|
|
49
|
-
.ask input:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px
|
|
84
|
+
.ask input:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px var(--focus);background:var(--panel)}
|
|
50
85
|
.btn{appearance:none;border:1px solid var(--accent);background:var(--accent);color:#fff;font-family:inherit;
|
|
51
86
|
font-size:13.5px;font-weight:600;padding:0 22px;border-radius:10px;cursor:pointer;white-space:nowrap}
|
|
52
87
|
.btn:hover{filter:brightness(1.07)}
|
|
53
|
-
.btn.ghost{background
|
|
88
|
+
.btn.ghost{background:var(--panel);color:var(--accent)}
|
|
54
89
|
.btn.ghost:hover{background:var(--accent-bg);filter:none}
|
|
55
90
|
.btn:disabled{opacity:.5;cursor:default}
|
|
56
|
-
.cand .ok{font-size:9.5px;background:var(--ok-bg);color
|
|
57
|
-
.cand .nook{font-size:9.5px;background
|
|
91
|
+
.cand .ok{font-size:9.5px;background:var(--ok-bg);color:var(--ok-text);border-radius:20px;padding:1px 6px;font-weight:700;flex:none}
|
|
92
|
+
.cand .nook{font-size:9.5px;background:var(--soft);color:var(--t3);border-radius:20px;padding:1px 6px;flex:none}
|
|
58
93
|
.cand .rk{font-size:10.5px;color:var(--t3);margin:-2px 0 5px;font-variant-numeric:tabular-nums}
|
|
59
94
|
.cand .rk b{color:var(--t2);font-weight:700}
|
|
60
95
|
.cand .d{font-size:11.5px;color:var(--t2);margin:5px 0 8px;line-height:1.5;
|
|
61
96
|
display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
|
|
62
97
|
.links{display:flex;gap:6px;margin-top:9px;padding-top:9px;border-top:1px dashed var(--line)}
|
|
63
98
|
.lk{display:inline-flex;align-items:center;gap:5px;font-size:10.5px;color:var(--t2);text-decoration:none;
|
|
64
|
-
border:1px solid var(--line);border-radius:6px;padding:2px 8px;background
|
|
99
|
+
border:1px solid var(--line);border-radius:6px;padding:2px 8px;background:var(--panel);transition:.15s}
|
|
65
100
|
.lk:hover{border-color:var(--accent);color:var(--accent);background:var(--accent-bg)}
|
|
66
101
|
.lk svg{flex:none}
|
|
67
102
|
.examples{display:flex;gap:8px;flex-wrap:wrap;margin-top:13px}
|
|
@@ -78,12 +113,12 @@ h1{margin:0;font-size:19px;font-weight:650;letter-spacing:-.2px}
|
|
|
78
113
|
|
|
79
114
|
/* ---------- 候选卡 ---------- */
|
|
80
115
|
.cands{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(330px,100%),1fr));gap:11px}
|
|
81
|
-
.cand{border:1px solid var(--line);border-radius:11px;padding:13px 14px;background
|
|
116
|
+
.cand{border:1px solid var(--line);border-radius:11px;padding:13px 14px;background:var(--input);
|
|
82
117
|
display:flex;gap:11px;cursor:pointer;transition:border-color .15s,background .15s;position:relative}
|
|
83
|
-
.cand:hover{border-color
|
|
118
|
+
.cand:hover{border-color:var(--accent-line)}
|
|
84
119
|
.cand.on{border-color:var(--accent);background:var(--accent-bg)}
|
|
85
|
-
.cand .box{width:17px;height:17px;border:1.5px solid
|
|
86
|
-
display:flex;align-items:center;justify-content:center;font-size:11px;color:#fff;background
|
|
120
|
+
.cand .box{width:17px;height:17px;border:1.5px solid var(--mute);border-radius:5px;flex:none;margin-top:2px;
|
|
121
|
+
display:flex;align-items:center;justify-content:center;font-size:11px;color:#fff;background:var(--panel)}
|
|
87
122
|
.cand.on .box{background:var(--accent);border-color:var(--accent)}
|
|
88
123
|
.cand .body{min-width:0;flex:1}
|
|
89
124
|
.cand .nm{font-size:13.5px;font-weight:650;display:flex;align-items:center;gap:7px;flex-wrap:wrap}
|
|
@@ -106,16 +141,16 @@ table.cmp thead th i{display:inline-block;width:8px;height:8px;border-radius:2px
|
|
|
106
141
|
table.cmp tbody tr:last-child td{border-bottom:none}
|
|
107
142
|
td.best{color:var(--ok);font-weight:700}
|
|
108
143
|
td.best::after{content:' ★';font-size:9px}
|
|
109
|
-
.miss{color
|
|
144
|
+
.miss{color:var(--mute)}
|
|
110
145
|
.num{font-variant-numeric:tabular-nums}
|
|
111
146
|
|
|
112
147
|
/* ---------- 结论 ---------- */
|
|
113
148
|
.verdict{border-radius:11px;padding:14px 16px;margin-bottom:11px;border:1px solid}
|
|
114
|
-
.verdict.win{background:var(--ok-bg);border-color
|
|
115
|
-
.verdict.alt{background:var(--warn-bg);border-color
|
|
116
|
-
.verdict.no{background:var(--bad-bg);border-color
|
|
149
|
+
.verdict.win{background:var(--ok-bg);border-color:var(--ok-line)}
|
|
150
|
+
.verdict.alt{background:var(--warn-bg);border-color:var(--warn-line)}
|
|
151
|
+
.verdict.no{background:var(--bad-bg);border-color:var(--bad-line)}
|
|
117
152
|
.verdict h4{margin:0 0 6px;font-size:13px;display:flex;align-items:center;gap:7px}
|
|
118
|
-
.verdict.win h4{color
|
|
153
|
+
.verdict.win h4{color:var(--ok-text)}.verdict.alt h4{color:var(--warn-text)}.verdict.no h4{color:var(--bad-text)}
|
|
119
154
|
.verdict p{margin:0;font-size:12.5px;color:var(--t2);line-height:1.7}
|
|
120
155
|
.verdict p b{color:var(--text);font-weight:650}
|
|
121
156
|
.rule{font-size:11.5px;color:var(--t3);margin-top:12px;padding-top:11px;border-top:1px dashed var(--line);line-height:1.8}
|
|
@@ -123,11 +158,11 @@ td.best::after{content:' ★';font-size:9px}
|
|
|
123
158
|
/* ---------- 排行榜 ---------- */
|
|
124
159
|
.filters{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-bottom:14px}
|
|
125
160
|
.filters select{appearance:none;border:1px solid var(--line);border-radius:8px;padding:7px 11px;
|
|
126
|
-
font-family:inherit;font-size:12.5px;background
|
|
161
|
+
font-family:inherit;font-size:12.5px;background:var(--panel);color:var(--t2);cursor:pointer}
|
|
127
162
|
table.rank{width:100%;border-collapse:collapse;font-size:12.5px}
|
|
128
163
|
table.rank th{text-align:left;font-size:11px;color:var(--t3);font-weight:600;padding:0 10px 9px;border-bottom:1px solid var(--line)}
|
|
129
164
|
table.rank td{padding:9px 10px;border-bottom:1px solid var(--soft);color:var(--t2);font-variant-numeric:tabular-nums}
|
|
130
|
-
table.rank tbody tr:hover td{background
|
|
165
|
+
table.rank tbody tr:hover td{background:var(--row-hover)}
|
|
131
166
|
table.rank td.nm{color:var(--text);font-weight:650;font-variant-numeric:normal}
|
|
132
167
|
td.r,th.r{text-align:right}
|
|
133
168
|
td.up{color:var(--ok);font-weight:600}
|
|
@@ -147,7 +182,7 @@ td.down{color:var(--bad);font-weight:600}
|
|
|
147
182
|
.foot{font-size:11.5px;color:var(--t3);line-height:1.9;margin-top:6px}
|
|
148
183
|
.foot b{color:var(--t2);font-weight:650}
|
|
149
184
|
.spark{display:inline-flex;align-items:flex-end;gap:1px;height:16px;vertical-align:middle}
|
|
150
|
-
.spark i{width:3px;background
|
|
185
|
+
.spark i{width:3px;background:var(--mute);border-radius:1px;display:block}
|
|
151
186
|
.hidden{display:none!important}
|
|
152
187
|
@media(max-width:720px){
|
|
153
188
|
body{padding:0 12px 48px}
|
|
@@ -165,6 +200,45 @@ td.down{color:var(--bad);font-weight:600}
|
|
|
165
200
|
.section{padding:15px 13px}
|
|
166
201
|
}
|
|
167
202
|
</style>
|
|
203
|
+
<script>
|
|
204
|
+
// 嵌在 DSH 里(同源 iframe)时跟着 DSH 的主题走:
|
|
205
|
+
// DSH 暗色时在 body 上挂 data-ds-dark-theme,颜色变量(--dsw-alias-*)也写在 body 上。
|
|
206
|
+
// 这里把明暗同步过来,再把 DSH 的底色、文字、边框、链接色覆盖到面板自己的变量上;DSH 一切换就跟着重算。
|
|
207
|
+
(function () {
|
|
208
|
+
var host
|
|
209
|
+
try { host = window.parent !== window && window.parent.document && window.parent.document.body } catch (e) { host = null }
|
|
210
|
+
if (!host) return
|
|
211
|
+
var MAP = {
|
|
212
|
+
'--bg': '--dsw-alias-bg-base',
|
|
213
|
+
'--panel': '--dsw-alias-bg-layer-2',
|
|
214
|
+
'--soft': '--dsw-alias-bg-module-platform',
|
|
215
|
+
'--line': '--dsw-alias-border-l2',
|
|
216
|
+
'--text': '--dsw-alias-label-primary',
|
|
217
|
+
'--t2': '--dsw-alias-label-secondary',
|
|
218
|
+
'--t3': '--dsw-alias-label-tertiary',
|
|
219
|
+
'--accent': '--dsw-alias-link',
|
|
220
|
+
}
|
|
221
|
+
var root = document.documentElement
|
|
222
|
+
function sync() {
|
|
223
|
+
var dark = host.hasAttribute('data-ds-dark-theme')
|
|
224
|
+
root.setAttribute('data-theme', dark ? 'dark' : 'light')
|
|
225
|
+
var cs = window.parent.getComputedStyle(host)
|
|
226
|
+
for (var k in MAP) {
|
|
227
|
+
var v = cs.getPropertyValue(MAP[k]).trim()
|
|
228
|
+
if (v) root.style.setProperty(k, v)
|
|
229
|
+
else root.style.removeProperty(k)
|
|
230
|
+
}
|
|
231
|
+
// 顶栏半透明底色跟着底色走
|
|
232
|
+
var bg = cs.getPropertyValue(MAP['--bg']).trim()
|
|
233
|
+
if (bg) root.style.setProperty('--bar-bg', 'color-mix(in srgb, ' + bg + ' 92%, transparent)')
|
|
234
|
+
else root.style.removeProperty('--bar-bg')
|
|
235
|
+
}
|
|
236
|
+
sync()
|
|
237
|
+
try {
|
|
238
|
+
new window.parent.MutationObserver(sync).observe(host, { attributes: true, attributeFilter: ['data-ds-dark-theme', 'style', 'class'] })
|
|
239
|
+
} catch (e) { /* 观察不了就只在打开时同步一次 */ }
|
|
240
|
+
})()
|
|
241
|
+
</script>
|
|
168
242
|
</head>
|
|
169
243
|
<body>
|
|
170
244
|
<div class="wrap">
|
package/web/panel.js
CHANGED
|
@@ -223,7 +223,7 @@ function renderCompare() {
|
|
|
223
223
|
|
|
224
224
|
$('#cmpNote').innerHTML =
|
|
225
225
|
`健康度 = 日常基线 40% + 增速 25% + 新鲜度 20% + 版本节奏 15%,满分 100。` +
|
|
226
|
-
(missingDeep ? `<br><span style="color
|
|
226
|
+
(missingDeep ? `<br><span style="color:var(--warn-text)">其中 ${missingDeep} 个未进入深挖范围(周下载 Top 榜外),去噪指标缺失,无法参与健康度比较。</span>` : '')
|
|
227
227
|
|
|
228
228
|
sec.classList.remove('hidden')
|
|
229
229
|
renderVerdict()
|
|
@@ -375,7 +375,7 @@ function renderWatch() {
|
|
|
375
375
|
const w = Math.max(Math.log10(r.w + 1) / Math.log10(max + 1) * 100, 1.5)
|
|
376
376
|
return `<div class="hrow" style="display:grid;grid-template-columns:210px 1fr 78px;align-items:center;gap:12px;padding:6px 0">` +
|
|
377
377
|
`<div style="font-size:12px;color:var(--t2);text-align:right;white-space:nowrap;overflow:hidden;text-overflow:ellipsis"><i style="display:inline-block;width:8px;height:8px;border-radius:2px;background:${colorOf(i)};margin-right:6px"></i>${esc(r.n)} <span style="color:var(--t3);font-size:10px">#${num(r.rank)}</span></div>` +
|
|
378
|
-
`<div style="height:14px;background
|
|
378
|
+
`<div style="height:14px;background:var(--soft);border-radius:4px"><div style="height:100%;width:${w}%;background:${colorOf(i)};border-radius:4px"></div></div>` +
|
|
379
379
|
`<div style="font-size:12px;font-weight:650;text-align:right">${num(r.w)}</div></div>`
|
|
380
380
|
}).join('')
|
|
381
381
|
}
|