dsh-dpharness 0.6.3 → 0.6.5

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/lib/client.js CHANGED
@@ -9,27 +9,27 @@ window.__ModuleLoader__.load({
9
9
 
10
10
  /* ------------------------------------------------------------------ styles */
11
11
  const css = [
12
- ".dph_root{display:flex;flex-direction:column;gap:12px;width:100%;max-width:1080px;margin:0 auto;padding:6px 4px 24px}",
12
+ ".dph_root{display:flex;flex-direction:column;gap:16px;width:100%;max-width:1080px;margin:0 auto;padding:8px 4px 24px}",
13
13
  ".dph_header{display:flex;align-items:center;gap:10px;flex-wrap:wrap}",
14
14
  ".dph_title{margin:0;font-size:17px;font-weight:600;color:var(--dsw-alias-label-primary)}",
15
15
  ".dph_sub{color:var(--dsw-alias-label-tertiary);font-size:12px}",
16
16
  ".dph_spacer{flex:1}",
17
- ".dph_btn{border:1px solid var(--dsw-alias-border-l2);background:transparent;color:var(--dsw-alias-label-primary);border-radius:6px;padding:4px 12px;font:inherit;font-size:12px;cursor:pointer;text-decoration:none;white-space:nowrap}",
17
+ ".dph_btn{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;height:28px;border:1px solid var(--dsw-alias-border-l2);background:transparent;color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 12px;font:inherit;font-size:12px;line-height:1;cursor:pointer;text-decoration:none;white-space:nowrap}",
18
18
  ".dph_btn:hover{background:var(--dsw-alias-interactive-bg-hover)}",
19
19
  ".dph_bar{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
20
- ".dph_input{flex:1;min-width:180px;box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);border-radius:8px;padding:7px 10px;font:inherit;font-size:13px;outline:none}",
20
+ ".dph_input{flex:1;min-width:180px;box-sizing:border-box;height:32px;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 10px;font:inherit;font-size:13px;outline:none}",
21
21
  ".dph_input:focus{border-color:var(--dsw-alias-state-business-primary)}",
22
22
  ".dph_seg{display:inline-flex;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;overflow:hidden;flex:none}",
23
- ".dph_segBtn{border:0;background:transparent;color:var(--dsw-alias-label-secondary);padding:6px 12px;font:inherit;font-size:12px;cursor:pointer;white-space:nowrap}",
23
+ ".dph_segBtn{border:0;background:transparent;color:var(--dsw-alias-label-secondary);height:30px;padding:0 12px;box-sizing:border-box;font:inherit;font-size:12px;cursor:pointer;white-space:nowrap}",
24
24
  ".dph_segBtnOn{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);font-weight:600}",
25
25
  ".dph_list{display:flex;flex-direction:column;gap:8px}",
26
- ".dph_card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);border-radius:10px;padding:12px 14px;display:flex;flex-direction:column;gap:8px}",
26
+ ".dph_card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);border-radius:10px;padding:14px;display:flex;flex-direction:column;gap:10px}",
27
27
  ".dph_cardTop{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}",
28
28
  ".dph_name{font-size:14px;font-weight:600;color:var(--dsw-alias-label-primary)}",
29
29
  ".dph_owner{font-size:12px;color:var(--dsw-alias-label-tertiary)}",
30
30
  ".dph_stars{font-size:12px;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums}",
31
31
  ".dph_tags{display:flex;gap:6px;flex-wrap:wrap}",
32
- ".dph_tag{border:1px solid var(--dsw-alias-border-l2);border-radius:999px;padding:1px 8px;font-size:11px;color:var(--dsw-alias-label-secondary);white-space:nowrap}",
32
+ ".dph_tag{display:inline-flex;align-items:center;box-sizing:border-box;height:20px;border:1px solid var(--dsw-alias-border-l2);border-radius:6px;padding:0 7px;font-size:11px;line-height:1;color:var(--dsw-alias-label-secondary);white-space:nowrap}",
33
33
  ".dph_tagOk{color:var(--dsw-alias-state-business-primary);border-color:var(--dsw-alias-state-business-primary)}",
34
34
  ".dph_tagBad{color:var(--dsw-alias-state-error-primary);border-color:var(--dsw-alias-state-error-primary)}",
35
35
  ".dph_desc{font-size:12px;line-height:1.6;color:var(--dsw-alias-label-secondary);margin:0}",
@@ -43,6 +43,24 @@ window.__ModuleLoader__.load({
43
43
  ".dph_segWrap{display:flex}",
44
44
  ".dph_segWrap .dph_seg{flex:1}",
45
45
  ".dph_segWrap .dph_segBtn{flex:1}",
46
+ /* 周榜(2026-10-20):面板从 5 个视图变 6 个,`.dph_segBtn{flex:1}` 六等分
47
+ 在 372px 可用宽里会把四字标签(严选推荐 / 分类精选 / 每日推荐 / 我的插件)
48
+ 挤到溢出裁切。这里**不改任何既有文案、也不重定义 .dph_segBtn**:
49
+ 只给多出来的这一层加横向滚动,按钮转为按内容宽度排列。
50
+ min-width:100% 保证视图少时不缩成一坨(与原来的铺满观感一致)。 */
51
+ ".dph_segWrapScroll{display:flex;overflow-x:auto;scrollbar-width:none}",
52
+ ".dph_segWrapScroll::-webkit-scrollbar{display:none}",
53
+ /* 12px→10px 内边距是为 372px 可用宽算过的:六个标签合计 360px,能整排放下;
54
+ justify-content:space-between 把余量摊回两端,不会在右侧留一条空档。
55
+ 更窄(<360px)时才真的横向滚动 —— 滚动条隐藏,但不裁字。 */
56
+ ".dph_segWrapScroll .dph_seg{flex:none;min-width:100%;justify-content:space-between}",
57
+ ".dph_segWrapScroll .dph_segBtn{flex:none;padding:6px 10px}",
58
+ /* 周榜行头:名次 + 依据(周下载 / 本周人数)。名次宽度固定,便于纵向扫读。 */
59
+ ".dph_boardHead{display:flex;align-items:baseline;gap:8px;padding:2px 2px 0}",
60
+ ".dph_boardRank{flex:none;min-width:22px;font-size:11px;font-weight:700;color:var(--dsw-alias-state-business-primary);font-variant-numeric:tabular-nums}",
61
+ ".dph_boardMetric{font-size:11px;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums}",
62
+ ".dph_boardDelta{font-size:11px;color:var(--dsw-alias-label-tertiary)}",
63
+ ".dph_boardWhy{flex:none;font-size:10px;line-height:1.5;color:var(--dsw-alias-label-tertiary);padding:2px 2px 4px}",
46
64
  /* 分类精选:大类(可折叠)→ 小类 → 条目
47
65
  ⚠️ `flex:none` 不可省(2026-09-18 实测踩到,用户截图暴露):
48
66
  `.dph_panelBody` 是 `display:flex; flex-direction:column`,而本元素有
@@ -62,14 +80,24 @@ window.__ModuleLoader__.load({
62
80
  ".dph_bestItem{display:flex;flex-direction:column;gap:4px}",
63
81
  ".dph_bestRank{font-size:10px;font-weight:700;color:var(--dsw-alias-state-business-primary)}",
64
82
  ".dph_bestReason{font-size:10px;color:var(--dsw-alias-label-tertiary);padding-left:2px}",
65
- /* 套装:槽位行 = 职责(这个位置干什么)→ 插件名 → 必要性标签 → 星标/已装。
66
- 职责用等宽小字、与名字左对齐两栏,扫一眼能看出"这套配了哪些岗位"。 */
67
- ".dph_setRow{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap;padding:2px 0}",
68
- ".dph_setRole{flex:none;min-width:74px;max-width:110px;font-size:11px;color:var(--dsw-alias-label-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
69
- ".dph_setName{font-size:12px;font-weight:600;color:var(--dsw-alias-label-primary)}",
83
+ /* 套装槽位行(2026-10-20 重排):职责 → 插件名 → 必要性 → 星标/已装。
84
+ ⚠️ 三个坑,动之前先看:
85
+ 1) **不要复用 `.dph_setRow`**:设置页那一族也叫这个名字(见下方 `.dph_set*`),
86
+ 后定义者覆盖前者 —— 实测把槽位行变成 `justify-content:space-between`,
87
+ 四段被均摊到行两端,名字/徽标的位置随星数宽度漂移(用户截图暴露);
88
+ 2) 职责列旧版写死 `max-width:110px` + nowrap,长文案被截成「免 Key 主视觉入口…」
89
+ ⇒ 现改两行 clamp,并在 title 里保留全文;
90
+ 3) 宽屏单行 flex 时行内总宽只有 450px 上下,主列却有 850px+,右侧整片空白
91
+ (用户反馈「单靠左边」)⇒ 用 auto-fit 网格,让宽度按列数吃满。 */
92
+ ".dph_slotGrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:10px 22px}",
93
+ ".dph_slotRow{display:grid;grid-template-columns:minmax(0,1fr) auto auto;column-gap:8px;row-gap:2px;align-items:baseline;min-width:0;padding:2px 0}",
94
+ ".dph_slotRole{grid-column:1/-1;min-height:16px;font-size:11px;line-height:1.45;color:var(--dsw-alias-label-tertiary);overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}",
95
+ ".dph_slotName{font-size:12px;font-weight:600;color:var(--dsw-alias-label-primary);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
96
+ ".dph_slotNeed{justify-self:end;white-space:nowrap}",
97
+ ".dph_slotTail{justify-self:end;max-width:112px;text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-variant-numeric:tabular-nums}",
70
98
  ".dph_cmdBlock{white-space:pre-wrap;word-break:break-all;max-height:132px;overflow:auto}",
71
- ".dph_cmd{flex:1;min-width:200px;box-sizing:border-box;background:var(--dsw-alias-bg-layer-3);border-radius:6px;padding:6px 10px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;color:var(--dsw-alias-label-primary);overflow-x:auto;white-space:nowrap}",
72
- ".dph_cmdMissing{font-size:12px;color:var(--dsw-alias-label-tertiary)}",
99
+ ".dph_cmd{flex:1;min-width:200px;box-sizing:border-box;display:flex;align-items:center;height:28px;background:var(--dsw-alias-bg-layer-3);border-radius:8px;padding:0 10px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;color:var(--dsw-alias-label-primary);overflow-x:auto;white-space:nowrap}",
100
+ ".dph_cmdMissing{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:12px;color:var(--dsw-alias-label-tertiary)}",
73
101
  ".dph_notice{border:1px solid var(--dsw-alias-border-l2);border-radius:10px;padding:14px;font-size:13px;color:var(--dsw-alias-label-secondary)}",
74
102
  ".dph_noticeBad{border-color:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-state-error-primary)}",
75
103
  ".dph_footer{font-size:12px;color:var(--dsw-alias-label-tertiary);line-height:1.6}",
@@ -111,7 +139,7 @@ window.__ModuleLoader__.load({
111
139
  ".dph_close{border:0;background:transparent;color:var(--dsw-alias-label-tertiary);font-size:16px;line-height:1;cursor:pointer;padding:2px 6px;border-radius:6px}",
112
140
  ".dph_close:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}",
113
141
  ".dph_cardSm{padding:10px 12px;gap:6px}",
114
- ".dph_instRow{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
142
+ ".dph_instRow{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:2px;padding-top:10px;border-top:1px solid var(--dsw-alias-border-l2)}",
115
143
  ".dph_instCol{flex-direction:column;align-items:flex-start;gap:4px}",
116
144
  ".dph_btnPrimary{border-color:var(--dsw-alias-state-business-primary);color:var(--dsw-alias-state-business-primary);font-weight:600}",
117
145
  ".dph_btn:disabled{opacity:.55;cursor:not-allowed}",
@@ -120,7 +148,7 @@ window.__ModuleLoader__.load({
120
148
  ".dph_instBad{color:var(--dsw-alias-state-error-primary)}",
121
149
  ".dph_instHint{font-size:11px;line-height:1.5;color:var(--dsw-alias-label-tertiary)}",
122
150
  ".dph_sell{display:flex;align-items:flex-start;gap:6px;font-size:12px;line-height:1.6}",
123
- ".dph_sellTag{flex:none;border:1px solid var(--dsw-alias-state-business-primary);color:var(--dsw-alias-state-business-primary);border-radius:4px;padding:0 5px;font-size:11px;line-height:16px}",
151
+ ".dph_sellTag{flex:none;display:inline-flex;align-items:center;box-sizing:border-box;height:18px;border:1px solid var(--dsw-alias-state-business-primary);color:var(--dsw-alias-state-business-primary);border-radius:6px;padding:0 5px;font-size:10px;line-height:1}",
124
152
  ".dph_sellText{color:var(--dsw-alias-label-primary);font-weight:500}",
125
153
  ".dph_raw{color:var(--dsw-alias-label-tertiary)}",
126
154
  ".dph_drag{cursor:grab;touch-action:none;user-select:none}",
@@ -189,19 +217,19 @@ window.__ModuleLoader__.load({
189
217
  不写会把 1fr 列撑破、侧栏被挤出可视区;
190
218
  2) 窄窗单列时用 display:contents 把侧栏拆成两个栅格项(今日推荐 / 其余),
191
219
  靠 order 把今日推荐提到列表之前 —— 不复制 DOM,也不存在两套渲染分支。 */
192
- ".dph_work{display:grid;grid-template-columns:minmax(0,1fr) 212px;gap:16px;align-items:start;width:100%;max-width:1080px;margin:0 auto;padding:6px 4px 20px}",
193
- ".dph_workHead{grid-column:1/-1;display:flex;align-items:center;gap:10px;flex-wrap:wrap;border-bottom:1px solid var(--dsw-alias-border-l2);padding-bottom:9px}",
194
- ".dph_tabbar{grid-column:1/-1;display:flex;gap:18px;flex-wrap:wrap;border-bottom:1px solid var(--dsw-alias-border-l2)}",
195
- ".dph_tab{border:0;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:12px;padding:2px 0 8px;cursor:pointer;white-space:nowrap}",
220
+ ".dph_work{display:grid;grid-template-columns:minmax(0,1fr) 212px;gap:20px;align-items:start;width:100%;max-width:1080px;margin:0 auto;padding:12px 4px 20px}",
221
+ ".dph_workHead{grid-column:1/-1;display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:6px 0 0;font-size:12px;font-weight:600;color:var(--dsw-alias-label-primary)}",
222
+ ".dph_tabbar{grid-column:1/-1;display:flex;gap:20px;flex-wrap:wrap;border-bottom:1px solid var(--dsw-alias-border-l2)}",
223
+ ".dph_tab{border:0;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:12px;height:32px;padding:0 0 10px;box-sizing:border-box;cursor:pointer;white-space:nowrap}",
196
224
  ".dph_tab:hover{color:var(--dsw-alias-label-primary)}",
197
225
  ".dph_tabOn{color:var(--dsw-alias-state-business-primary);font-weight:600;box-shadow:inset 0 -2px 0 var(--dsw-alias-state-business-primary)}",
198
- ".dph_mainCol{display:flex;flex-direction:column;gap:9px;min-width:0}",
226
+ ".dph_mainCol{display:flex;flex-direction:column;gap:12px;min-width:0}",
199
227
  ".dph_sectionHead{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}",
200
228
  ".dph_sectionTitle{margin:0;font-size:13px;font-weight:600;color:var(--dsw-alias-label-primary)}",
201
229
  ".dph_sectionCount{font-size:11px;color:var(--dsw-alias-label-tertiary)}",
202
- ".dph_rail{display:flex;flex-direction:column;gap:10px;min-width:0;position:sticky;top:0}",
230
+ ".dph_rail{display:flex;flex-direction:column;gap:8px;min-width:0;position:sticky;top:0}",
203
231
  ".dph_railSlot{display:flex;flex-direction:column;gap:10px;min-width:0}",
204
- ".dph_railCard{display:flex;flex-direction:column;gap:5px;min-width:0;border:1px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-alias-bg-layer-1);padding:10px 11px}",
232
+ ".dph_railCard{display:flex;flex-direction:column;gap:8px;min-width:0;border:1px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-alias-bg-layer-1);padding:12px}",
205
233
  /* 今日推荐是侧栏里唯一"当天只有一个答案"的东西,给一条强调边区分于其它信息块 */
206
234
  ".dph_railCardAccent{border-left:3px solid var(--dsw-alias-state-business-primary)}",
207
235
  ".dph_railLabel{margin:0;font-size:11px;color:var(--dsw-alias-label-tertiary)}",
@@ -219,22 +247,77 @@ window.__ModuleLoader__.load({
219
247
  ".dph_top3Num{flex:none;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums}",
220
248
  /* 宽屏卡片:左内容 + 右 84px 操作轨道。只由 renderCard 的 wide 分支产出;
221
249
  浮窗 / 今日推荐 / 分类精选仍走原来的 .dph_card,互不影响。 */
222
- ".dph_cardLg{display:grid;grid-template-columns:minmax(0,1fr) 84px;gap:12px;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);border-radius:10px;padding:11px 12px}",
223
- ".dph_cardLgMain{display:flex;flex-direction:column;gap:5px;min-width:0}",
250
+ ".dph_cardLg{display:grid;grid-template-columns:minmax(0,1fr) 88px;gap:14px;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);border-radius:10px;padding:14px}",
251
+ ".dph_cardLgMain{display:flex;flex-direction:column;gap:10px;min-width:0}",
224
252
  ".dph_opRail{display:flex;flex-direction:column;gap:5px}",
225
253
  ".dph_opRail .dph_btn{width:100%;text-align:center;padding:5px 6px}",
226
- ".dph_btnSm{padding:3px 8px;font-size:11px}",
254
+ ".dph_btnSm{height:28px;padding:0 10px;font-size:12px;border-radius:8px;box-sizing:border-box}",
227
255
  /* 命令条:复制按钮内嵌右端,不再靠 flex:1 把按钮顶到卡的另一头 */
228
- ".dph_cmdbar{display:flex;align-items:center;gap:6px;min-width:0;background:var(--dsw-alias-bg-layer-3);border-radius:6px;padding:5px 6px 5px 9px}",
256
+ /* 分享(2026-10-21):与「复制命令」同行,所以命令条必须允许换行 ——
257
+ 浮窗只有 400px,展开后 4 个动作按钮放不下,不换行就会顶出卡片右边界。 */
258
+ ".dph_shareWrap{display:inline-flex;align-items:center;flex-wrap:wrap;gap:4px;max-width:100%}",
259
+ /* 212px 侧栏里的命令条是竖排(.dph_cmdbarCol),四个动作若各占一行会把卡片拉高近一半;
260
+ 改成两列网格即可。只在展开态生效,收起态仍是一颗普通按钮。 */
261
+ ".dph_cmdbarCol .dph_shareWrapOpen{display:grid;grid-template-columns:1fr 1fr;gap:6px;width:100%}",
262
+ ".dph_cmdbarCol .dph_shareWrapOpen .dph_btn{width:100%;text-align:center}",
263
+ ".dph_cmdbar{display:flex;align-items:center;gap:6px;row-gap:4px;flex-wrap:wrap;min-width:0;background:var(--dsw-alias-bg-layer-3);border-radius:6px;padding:5px 6px 5px 9px}",
229
264
  ".dph_cmdbarCode{flex:1;min-width:0;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;color:var(--dsw-alias-label-primary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
230
265
  /* 212px 侧栏里的命令条:横向排会把命令截成「dsh plugin ----」(实测),
231
266
  改竖排 + 允许断词,命令必须完整可读 —— 它是这一块的行动依据。 */
232
- ".dph_cmdbarCol{flex-direction:column;align-items:stretch;gap:5px}",
267
+ ".dph_cmdbarCol{display:grid;grid-template-columns:1fr 1fr;align-items:center;gap:6px}",
233
268
  ".dph_cmdbarCol .dph_cmdbarCode{white-space:normal;overflow-wrap:anywhere;word-break:normal;line-height:1.5}",
234
269
  /* 侧栏里的安装行同理:包名在窄栏里必须能换行,否则会顶出卡片右边界 */
235
270
  ".dph_railCard .dph_instRow{flex-direction:column;align-items:stretch;gap:4px}",
236
271
  ".dph_railCard .dph_instHint{word-break:break-all}",
237
272
  "@media (max-width:900px){.dph_work{grid-template-columns:minmax(0,1fr)}.dph_rail{display:contents}.dph_workHead,.dph_tabbar{order:0}.dph_dailySlot{order:1}.dph_mainCol{order:2}.dph_railSlot{order:3}.dph_railCard .dph_instRow{flex-direction:row;align-items:center}.dph_cmdbarCol{flex-direction:row;align-items:center}.dph_cmdbarCol .dph_cmdbarCode{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}}",
273
+ /* ──────────────── 社群 + 订阅(2026-10-20) ────────────────
274
+ 一条通栏卡,三处共用:会话页签(宽)/ 右下浮窗(compact)/ 设置页(无外框)。
275
+ ⚠️ 二维码 84px 是站点实测的下限(64px 时 jsQR 已解不出,72px 是临界),
276
+ 这里不改小 —— 扫不出来的二维码等于没有入口。
277
+ 二维码**默认收起**:展开后高度约 +120px,页签首屏会被列表挤走,
278
+ 「入口存在但看不见」比没有入口更糟。 */
279
+ ".dph_join{flex:none;display:flex;flex-direction:column;gap:8px;border:1px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-alias-bg-layer-1);padding:12px 14px}",
280
+ ".dph_joinHead{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}",
281
+ ".dph_joinTitle{font-size:13px;font-weight:600;color:var(--dsw-alias-label-primary)}",
282
+ ".dph_joinSub{font-size:11px;line-height:1.5;color:var(--dsw-alias-label-tertiary)}",
283
+ ".dph_joinRow{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
284
+ ".dph_qrRow{display:flex;gap:16px;flex-wrap:wrap;padding:2px 0 1px}",
285
+ ".dph_qrItem{display:flex;flex-direction:column;align-items:center;gap:4px;min-width:0}",
286
+ ".dph_qrImg{display:block;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;background:#fff;padding:3px}",
287
+ ".dph_qrHint{font-size:10px;color:var(--dsw-alias-label-tertiary);text-align:center}",
288
+ ".dph_qrLink{font-size:11px;color:var(--dsw-alias-state-business-primary);text-decoration:none}",
289
+ ".dph_qrLink:hover{text-decoration:underline}",
290
+ ".dph_subForm{display:flex;align-items:center;gap:6px;flex-wrap:wrap;flex:1;min-width:0}",
291
+ ".dph_subInput{flex:1;min-width:150px;box-sizing:border-box;height:28px;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 9px;font:inherit;font-size:12px;outline:none}",
292
+ ".dph_subInput:focus{border-color:var(--dsw-alias-state-business-primary)}",
293
+ ".dph_joinMsg{font-size:11px;line-height:1.5;color:var(--dsw-alias-label-secondary)}",
294
+ ".dph_joinOk{color:var(--dsw-alias-state-business-primary)}",
295
+ ".dph_joinBad{color:var(--dsw-alias-state-error-primary)}",
296
+ ".dph_joinNote{font-size:10px;line-height:1.5;color:var(--dsw-alias-label-tertiary)}",
297
+ /* 浮窗 400px:省掉说明行,二维码与表单各占一行,不再并排 */
298
+ ".dph_joinCompact .dph_joinSub{display:none}",
299
+ /* 设置页里是「卡中卡」:去掉外框,用一条分隔线接在更新日志之后 */
300
+ ".dph_joinInSet{border:0;border-top:1px solid var(--dsw-alias-border-l2);border-radius:0;background:transparent;padding:12px 0 0}",
301
+ ".dph_workHead::before{content:\"\";width:3px;height:11px;border-radius:2px;background:var(--dsw-alias-state-business-primary)}",
302
+ ".dph_workHead .dph_sub{font-weight:400}",
303
+ /* 已安装:实底浅蓝 —— 它说的是「现在的事实」,与分类标签同形不同质 */
304
+ ".dph_tagSolid{background:var(--dsw-alias-state-business-tertiary);border-color:var(--dsw-alias-state-business-tertiary);color:var(--dsw-alias-state-business-primary)}",
305
+ /* 选中(已进对比篮):整卡描边 + 极浅主色底。
306
+ 只靠按钮变蓝在长列表里认不出「这条被选了」——用户原话是「选中之后需要加高亮」。
307
+ 第二圈用 box-shadow inset 画,不加 border 宽度:改宽度会让卡片跳 1px。 */
308
+ ".dph_cardOn{border-color:var(--dsw-alias-state-business-primary);background:var(--dsw-alias-state-business-tertiary);box-shadow:inset 0 0 0 1px var(--dsw-alias-state-business-primary)}",
309
+ /* 已收藏:只在左侧画 3px 竖条,不染色不描边 —— 收藏是跨会话的持久偏好,
310
+ 用户可能攒十几条,整卡染色会盖掉「对比选中」那个更临时的信号。
311
+ padding-left 从 14 减到 11:3px 边框 + 11px 内距 = 内容仍从 14px 起,不动版。 */
312
+ ".dph_cardFav{border-left:3px solid var(--dsw-alias-state-business-primary);padding-left:11px}",
313
+ /* 选中卡里的主按钮改回白底:浅蓝底 + 蓝描边按钮叠在一起会糊成一片 */
314
+ ".dph_cardOn .dph_btnPrimary{background:var(--dsw-alias-bg-layer-1)}",
315
+ /* 右栏命令条是两列网格:命令跨两列,复制/分享各占一格(展开态自然排成 2×2) */
316
+ ".dph_cmdbarCol .dph_cmdbarCode{grid-column:1/-1;font-size:11.5px}",
317
+ ".dph_cmdbarCol .dph_shareWrap,.dph_cmdbarCol .dph_shareWrap .dph_btn{width:100%}",
318
+ ".dph_cmdbarCol .dph_shareWrap .dph_btn{height:28px;padding:0 6px;font-size:11.5px}",
319
+ /* 响应式(2026-10-21):主列单栏时宽卡也拆单列,操作轨道转横排成一条动作行 */
320
+ "@media (max-width:900px){.dph_cardLg{grid-template-columns:minmax(0,1fr);gap:10px}.dph_opRail{flex-direction:row;flex-wrap:wrap;margin-top:2px;padding-top:10px;border-top:1px solid var(--dsw-alias-border-l2)}.dph_opRail .dph_btn{flex:1 1 0;min-width:0}.dph_rail{position:static}}",
238
321
  ].join("");
239
322
  const tagId = "dsh-dpharness/client.css";
240
323
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
@@ -250,6 +333,34 @@ window.__ModuleLoader__.load({
250
333
  /* 目录站点;改这里的同时要改 host 侧 lib/index.js 的 SITE / UPSTREAM / TRACK。 */
251
334
  const SITE = "https://dpharness.com";
252
335
  const TAKE_OPTIONS = [30, 60, 100];
336
+ /**
337
+ * 社群入口(2026-10-20)。
338
+ *
339
+ * 真源在站点 `lib/community.ts`(首页右栏 / 文章页 CTA / 全站页脚三处读它)。
340
+ * 插件是**独立 npm 包,不能 import 站点代码**,所以这里保留一份副本:
341
+ * 换群或改链接时两处都要改,否则插件里进的是旧群。
342
+ *
343
+ * 二维码不存图:站点 `app/qr/route.ts` 按 url 现生成 PNG(`/qr?url=…`),
344
+ * 换群链接后二维码自动跟着变,不存在「图没换」这种事故。
345
+ */
346
+ const COMMUNITY_GROUPS = [
347
+ {
348
+ key: "qq",
349
+ labelKey: "join.qq",
350
+ scanKey: "join.scanQq",
351
+ name: "DPharness QQ 群",
352
+ url: "https://qm.qq.com/q/CwSG74aKdi",
353
+ },
354
+ {
355
+ key: "feishu",
356
+ labelKey: "join.feishu",
357
+ scanKey: "join.scanFeishu",
358
+ name: "DPharness 飞书群",
359
+ /* applink 深链:装了飞书直接唤起飞书,没装会跳下载引导页 —— 预期行为 */
360
+ url: "https://applink.feishu.cn/client/chat/chatter/add_by_link?link_token=640sc405-cb7b-4ba8-b75d-0d21949251a6",
361
+ },
362
+ ].map((group) => Object.assign({}, group, { qr: SITE + "/qr?url=" + encodeURIComponent(group.url) }));
363
+ const NEWSLETTER_URL = SITE + "/newsletter";
253
364
  const zh = {
254
365
  "view.tab": "严选插件",
255
366
  "view.title": "dsh 严选插件",
@@ -275,6 +386,18 @@ window.__ModuleLoader__.load({
275
386
  "action.openSite": "打开站点",
276
387
  "action.copy": "复制命令",
277
388
  "action.copied": "已复制",
389
+ /* 分享(2026-10-21):入口贴近「复制命令」—— 两者同属「把这条带走」,
390
+ 所以文案也贴着这两条放,翻译时一起改,别分到两个区块去。 */
391
+ "share.action": "分享",
392
+ "share.toggle": "把这条发给同事:链接 / 文案 / 说明图",
393
+ "share.closeHint": "收起分享选项",
394
+ "share.link": "复制链接",
395
+ "share.linkHint": "复制站点详情页链接(带 dsh 来源标识,落地可在渠道追踪里看到)",
396
+ "share.text": "复制文案",
397
+ "share.textHint": "标题 + 一句话卖点 + 链接,直接贴进群里",
398
+ "share.card": "说明图",
399
+ "share.cardHint": "下载这张插件的说明图(1200×630 PNG),发群或贴文用",
400
+ "share.collapse": "收起",
278
401
  "action.open": "严选插件",
279
402
  "action.show": "显示浮窗",
280
403
  "action.close": "收起",
@@ -499,6 +622,56 @@ window.__ModuleLoader__.load({
499
622
  "need.required": "必备",
500
623
  "need.enhance": "增强",
501
624
  "need.optional": "可选",
625
+ /* 周榜(2026-10-20):站点两条榜单线搬进插件。
626
+ 两者口径不同,文案里必须各自点名依据 —— 下载量 vs 站内复制安装
627
+ 差好几个数量级,用户拿它们互相对照就会得出错误结论。 */
628
+ "board.tab": "周榜",
629
+ "board.top": "精选 Top 榜",
630
+ "board.installs": "真装机周榜",
631
+ "board.topSub": "{n} 条 · 第 {p} 期",
632
+ "board.topSubLive": "{n} 条 · 实时口径",
633
+ "board.installsSub": "{n} 条 · 近 7 天",
634
+ "board.loading": "正在取当期周榜…",
635
+ "board.empty": "本周还没有可上榜的数据",
636
+ "board.topWhy": "按 npm 全网周下载量排序,每周一采集一期;期次是当时的数据,不随现在重算。",
637
+ "board.topWhyLive": "当期快照还没回填,这里显示的是实时口径(没有期次)。",
638
+ "board.installsWhy": "按本站「复制安装」的人数排序 —— 本站实测,不是全网热度,不能和上面的下载量榜对照。",
639
+ "board.weekly": "周下载 {n}",
640
+ "board.thisWeek": "本周 {n} 人",
641
+ "board.prevWeek": "上周 {m} 人",
642
+ "board.deltaUp": "↑{n}",
643
+ "board.deltaDown": "↓{n}",
644
+ "board.deltaNew": "新增",
645
+ "board.deltaFlat": "持平",
646
+ "board.offline": "站点榜单接口暂不可用(可能还没发版),点「打开官网」看完整榜单。",
647
+ /* 大数单位(见 fmtCount):中文按万,英文按 K —— 单位跟着语言走 */
648
+ "board.scale": "10000|万",
649
+ /* 社群 + 订阅(页签 / 浮窗 / 设置页三处共用一套文案) */
650
+ "join.title": "插件交流群已开放",
651
+ "join.sub": "用法、报错、新插件,群里问更快",
652
+ "join.showQr": "查看二维码",
653
+ "join.hideQr": "收起二维码",
654
+ "join.qq": "QQ 群",
655
+ "join.feishu": "飞书群",
656
+ "join.scanQq": "手机 QQ 扫码进群",
657
+ "join.scanFeishu": "飞书扫码进群",
658
+ "join.joinGroup": "加入{label}",
659
+ "join.newsletter": "每周一封插件周报",
660
+ "join.newsletterSub": "新插件、精选评测与福利,周一早上发",
661
+ "join.email": "你的邮箱",
662
+ "join.subscribe": "订阅",
663
+ "join.sending": "发送中…",
664
+ "join.subscribeOk": "确认信已发出,请到邮箱点确认",
665
+ /* 失败文案按「错在哪一段」分开说(2026-10-20 实测踩过):
666
+ 宿主未重启时路由根本没注册,请求拿不到 2xx,旧版把所有情况压成
667
+ 「订阅失败,请稍后再试」——用户对着一个已订阅的邮箱排不出任何线索。 */
668
+ "join.failRoute": "订阅失败(HTTP {code}):插件路由未加载 —— 完全退出 dsh 再打开后重试",
669
+ "join.failHttp": "订阅失败(HTTP {code})",
670
+ "join.failUpstream": "订阅失败(HTTP {code}):站点暂不可用,稍后再试",
671
+ "join.failNetwork": "订阅失败:连不上本机插件服务 —— 确认 dsh 正在运行",
672
+ "join.needEmail": "请先填邮箱",
673
+ "join.note": "邮箱只用于周报,可随时退订。",
674
+ "join.past": "往期周报 →",
502
675
  "footer.hint": "网页无法自动安装:复制命令到终端执行,装完重启 dsh 才会生效。命令里的 --profile 已按你本机填好,别改成别的。",
503
676
  "telemetry.on": "匿名统计(不含搜索内容)",
504
677
  "install.action": "安装",
@@ -547,6 +720,16 @@ window.__ModuleLoader__.load({
547
720
  "action.openSite": "Open site",
548
721
  "action.copy": "Copy command",
549
722
  "action.copied": "Copied",
723
+ "share.action": "Share",
724
+ "share.toggle": "Send this to a teammate: link / text / card",
725
+ "share.closeHint": "Hide the share options",
726
+ "share.link": "Copy link",
727
+ "share.linkHint": "Copies the site detail-page URL with a dsh source tag (visible in channel tracking)",
728
+ "share.text": "Copy text",
729
+ "share.textHint": "Name + one-line pitch + link, ready to paste into a chat",
730
+ "share.card": "Card",
731
+ "share.cardHint": "Downloads the 1200×630 explainer card (PNG) for chats or posts",
732
+ "share.collapse": "Hide",
550
733
  "action.open": "Curated",
551
734
  "action.show": "Show the panel",
552
735
  "action.close": "Collapse",
@@ -766,6 +949,50 @@ window.__ModuleLoader__.load({
766
949
  "need.required": "Core",
767
950
  "need.enhance": "Enhance",
768
951
  "need.optional": "Optional",
952
+ /* Weekly boards: two different measurements — npm downloads vs.
953
+ in-site copy-install visitors. Never present them as comparable. */
954
+ "board.tab": "Weekly",
955
+ "board.top": "Top downloads",
956
+ "board.installs": "Real installs",
957
+ "board.topSub": "{n} items · issue {p}",
958
+ "board.topSubLive": "{n} items · live",
959
+ "board.installsSub": "{n} items · last 7 days",
960
+ "board.loading": "Loading this week's board…",
961
+ "board.empty": "No qualifying data for this week yet",
962
+ "board.topWhy": "Ranked by weekly npm downloads, captured every Monday; the issue is a snapshot, not a live re-rank.",
963
+ "board.topWhyLive": "This issue's snapshot has not been captured yet — showing a live ranking (no issue number).",
964
+ "board.installsWhy": "Ranked by unique visitors who copied an install command on this site — measured here, not a global popularity metric. Not comparable with the downloads board.",
965
+ "board.weekly": "{n}/wk",
966
+ "board.thisWeek": "{n} this week",
967
+ "board.prevWeek": "{m} last week",
968
+ "board.deltaUp": "↑{n}",
969
+ "board.deltaDown": "↓{n}",
970
+ "board.deltaNew": "new",
971
+ "board.deltaFlat": "flat",
972
+ "board.offline": "The site's board API is unavailable (probably not released yet). Use “Open site” to see the full board.",
973
+ "board.scale": "1000|K",
974
+ "join.title": "Community group is open",
975
+ "join.sub": "Usage, install errors and new plugins — asking in the group is faster",
976
+ "join.showQr": "Show QR codes",
977
+ "join.hideQr": "Hide QR codes",
978
+ "join.qq": "QQ group",
979
+ "join.feishu": "Feishu group",
980
+ "join.scanQq": "Scan with mobile QQ",
981
+ "join.scanFeishu": "Scan with Feishu",
982
+ "join.joinGroup": "Join {label}",
983
+ "join.newsletter": "Weekly plugin digest",
984
+ "join.newsletterSub": "New plugins, reviews and perks — Monday mornings",
985
+ "join.email": "Your email",
986
+ "join.subscribe": "Subscribe",
987
+ "join.sending": "Sending…",
988
+ "join.subscribeOk": "Confirmation sent — open your inbox and click the link",
989
+ "join.failRoute": "Subscribe failed (HTTP {code}): plugin route not loaded — quit dsh completely, reopen, then retry",
990
+ "join.failHttp": "Subscribe failed (HTTP {code})",
991
+ "join.failUpstream": "Subscribe failed (HTTP {code}): the site is unavailable, try again later",
992
+ "join.failNetwork": "Subscribe failed: cannot reach the local plugin service — make sure dsh is running",
993
+ "join.needEmail": "Enter your email first",
994
+ "join.note": "Used for the digest only; unsubscribe anytime.",
995
+ "join.past": "Past issues →",
769
996
  "footer.hint": "A web page cannot install plugins: copy the command into a terminal, then restart dsh. The --profile in it is already set to this machine's — leave it as is.",
770
997
  "telemetry.on": "Anonymous stats (no search text)",
771
998
  "install.action": "Install",
@@ -2361,6 +2588,68 @@ window.__ModuleLoader__.load({
2361
2588
  return { state, copiedCmd, markCopied, refresh: () => setReload((n) => n + 1) };
2362
2589
  }
2363
2590
 
2591
+ /**
2592
+ * 「周榜」取数:kind = top(npm 周下载)| installs(站内真装机)。
2593
+ *
2594
+ * 与 useBest / useSets 的三处刻意差别:
2595
+ * ① **按 kind 分别取**,切到另一个榜必须重新请求(不能拿上一条缓存充数:
2596
+ * 两个榜的字段不同,混用会让装机榜显示成下载量);
2597
+ * ② 不设「拿到一次就不再请求」的 loaded 闸 —— 装机榜的窗口是滚动的,
2598
+ * 面板开一整天还显示早上那份就会自相矛盾;真正的成本闸在 host 端
2599
+ * (top 5 分钟 / installs 60 秒);
2600
+ * ③ 卸载时 abort 在途请求:快速来回切两个榜时,晚到的旧响应会覆盖新数据。
2601
+ *
2602
+ * 出错时把「站点接口还没发版(404)」与「真的失败了」分开说 ——
2603
+ * 前者有明确的下一步(去官网看),后者才该说"失败"。
2604
+ */
2605
+ function useBoard(t, kind, enabled) {
2606
+ const [reload, setReload] = react.useState(0);
2607
+ const [state, setState] = react.useState({ loading: false, kind: null, data: null, error: null });
2608
+
2609
+ react.useEffect(() => {
2610
+ if (!enabled) return undefined;
2611
+ const controller = new AbortController();
2612
+ const timer = setTimeout(() => controller.abort(), 20000);
2613
+ /* 换榜时先把上一条数据摘掉:两榜条目字段不同,留着只会显示错东西 */
2614
+ setState((previous) => ({
2615
+ loading: true,
2616
+ kind,
2617
+ data: previous.kind === kind ? previous.data : null,
2618
+ error: null,
2619
+ }));
2620
+ readHostJson("/api/dpharness/board?kind=" + kind, controller.signal)
2621
+ .then((body) => {
2622
+ if (controller.signal.aborted) return;
2623
+ setState({ loading: false, kind, data: body, error: null });
2624
+ track("plugin_hub", { action: "board_open", kind, n: (body && body.total) || 0 });
2625
+ })
2626
+ .catch((error) => {
2627
+ if (controller.signal.aborted) return;
2628
+ const message = error && error.name === "AbortError" ? "timeout" : String((error && error.message) || error);
2629
+ setState((previous) => ({ loading: false, kind, data: previous.kind === kind ? previous.data : null, error: message }));
2630
+ })
2631
+ .finally(() => clearTimeout(timer));
2632
+ return () => {
2633
+ clearTimeout(timer);
2634
+ controller.abort();
2635
+ };
2636
+ }, [enabled, kind, reload]);
2637
+
2638
+ const [copiedCmd, setCopiedCmd] = react.useState("");
2639
+ const markCopied = react.useCallback((text) => {
2640
+ setCopiedCmd(text);
2641
+ setTimeout(() => setCopiedCmd((current) => (current === text ? "" : current)), 2000);
2642
+ }, []);
2643
+
2644
+ return {
2645
+ state,
2646
+ copiedCmd,
2647
+ markCopied,
2648
+ refresh: () => setReload((n) => n + 1),
2649
+ items: state.data && Array.isArray(state.data.items) ? state.data.items : [],
2650
+ };
2651
+ }
2652
+
2364
2653
  /**
2365
2654
  * 更新日志(本机 host 的只读接口)。
2366
2655
  *
@@ -2654,7 +2943,7 @@ window.__ModuleLoader__.load({
2654
2943
  item.rank
2655
2944
  ? h("div", { className: "dph_bestRank", key: "rank" }, "#" + item.rank)
2656
2945
  : null,
2657
- renderCard(item, copiedCmd, onCopied, true),
2946
+ renderCard(item, copiedCmd, onCopied, true, false, false, "best"),
2658
2947
  item.reason
2659
2948
  ? h("div", { className: "dph_bestReason", key: "why" }, item.reason)
2660
2949
  : null,
@@ -2718,6 +3007,72 @@ window.__ModuleLoader__.load({
2718
3007
  ]);
2719
3008
  }
2720
3009
 
3010
+ /**
3011
+ * 数字口径(周下载量这类大数)。
3012
+ *
3013
+ * 为什么单位来自词典而不是代码:中文读「万」、英文读「K/M」,
3014
+ * 写死一种语言就等于在另一种语言里输出乱码式数字("54.8 万" 出现在英文界面)。
3015
+ * 词典键 `board.scale` 形如 `10000|万` / `1000|K`。
3016
+ */
3017
+ function fmtCount(n, t) {
3018
+ const v = Math.round(Number(n) || 0);
3019
+ if (!Number.isFinite(v) || v <= 0) return "0";
3020
+ const scale = String(t("board.scale") || "1000|K").split("|");
3021
+ const div = Number(scale[0]) || 1000;
3022
+ const unit = scale[1] || "K";
3023
+ if (v < div) return String(v);
3024
+ const w = v / div;
3025
+ const num = w >= 100 ? String(Math.round(w)) : w.toFixed(1).replace(/\.0$/, "");
3026
+ return num + " " + unit;
3027
+ }
3028
+
3029
+ /**
3030
+ * 「周榜」列表:名次 + 依据 → 复用同一张插件卡。
3031
+ *
3032
+ * 为什么不新写一张卡:安装命令、已装态、汉化兜底、copy_install 埋点
3033
+ * 全在 renderCard 里,复制一份必然分叉 —— 站点侧已经为「同一个插件
3034
+ * 在两个出口给出两套命令」付过代价(lib/installCmd.ts 头部注释)。
3035
+ * 本函数只负责卡片**上面**那一行:第几名、凭什么上榜。
3036
+ *
3037
+ * 名次优先用上游给的 rank(top 是快照固化的名次,installs 侧没有),
3038
+ * 缺失时按下标补,避免出现「第 0 名」。
3039
+ */
3040
+ function renderBoard(data, kind, copiedCmd, onCopied, opts) {
3041
+ if (!data) return null;
3042
+ const items = Array.isArray(data.items) ? data.items : [];
3043
+ const wide = !!(opts && opts.wide);
3044
+ return items.map((item, index) => {
3045
+ const rank = typeof item.rank === "number" && item.rank > 0 ? item.rank : index + 1;
3046
+ const metric =
3047
+ kind === "top"
3048
+ ? format(t("board.weekly"), { n: fmtCount(item.weekly, t) })
3049
+ : format(t("board.thisWeek"), { n: item.thisUv }) + " · " + format(t("board.prevWeek"), { m: item.prevUv });
3050
+ /* 增减只在装机榜有意义:下载量榜的期次差值不在这里算(快照之间对比是另一件事) */
3051
+ const prev = Number(item.prevUv) || 0;
3052
+ const delta = Number(item.delta) || 0;
3053
+ const deltaText =
3054
+ kind !== "installs"
3055
+ ? null
3056
+ : prev === 0 && delta > 0
3057
+ ? t("board.deltaNew")
3058
+ : delta > 0
3059
+ ? format(t("board.deltaUp"), { n: delta })
3060
+ : delta < 0
3061
+ ? format(t("board.deltaDown"), { n: -delta })
3062
+ : t("board.deltaFlat");
3063
+ return h("div", { className: "dph_boardItem", key: item.fullName || "board" + index }, [
3064
+ h("div", { className: "dph_boardHead", key: "head" }, [
3065
+ h("span", { className: "dph_boardRank", key: "rank" }, "#" + rank),
3066
+ h("span", { className: "dph_boardMetric", key: "metric" }, metric),
3067
+ deltaText ? h("span", { className: "dph_boardDelta", key: "delta" }, deltaText) : null,
3068
+ h("span", { className: "dph_spacer", key: "gap" }),
3069
+ item.src === "repo" ? h("span", { className: "dph_tag", key: "src" }, t("label.repoSource")) : null,
3070
+ ]),
3071
+ renderCard(item, copiedCmd, onCopied, !wide, false, wide, "board"),
3072
+ ]);
3073
+ });
3074
+ }
3075
+
2721
3076
  /**
2722
3077
  * 「套装」视图:一整套方案(跨插件纵向组合)→ 槽位 → 批量命令。
2723
3078
  *
@@ -2752,14 +3107,17 @@ window.__ModuleLoader__.load({
2752
3107
  set.syncedMonth && set.syncedSlots ? h("span", { className: "dph_tag", key: "sync" }, format(t("sets.synced"), { m: set.syncedMonth, s: set.syncedSlots })) : null,
2753
3108
  ])
2754
3109
  : null,
2755
- h("div", { className: "dph_list", key: "list" }, (set.items || []).map((item) =>
2756
- h("div", { className: "dph_setRow", key: item.fullName }, [
2757
- h("span", { className: "dph_setRole", key: "role", title: item.slotRole || "" }, item.slotRole || ""),
2758
- h("span", { className: "dph_setName", key: "name" }, item.nameZh || item.name || item.fullName || ""),
2759
- h("span", { className: "dph_tag", key: "need" }, t("need." + (item.need || "enhance"))),
3110
+ /* 槽位行:类名**故意不复用 `.dph_setRow`**(那个名字归设置页,见样式区注释)。
3111
+ role 为空的条目(没有槽位定义的老套装)仍渲染空 span 占位:
3112
+ role 行是 `grid-column:1/-1` 的整行,缺了它这一格就少一行、与邻格错位。 */
3113
+ h("div", { className: "dph_slotGrid", key: "list" }, (set.items || []).map((item) =>
3114
+ h("div", { className: "dph_slotRow", key: item.fullName }, [
3115
+ h("span", { className: "dph_slotRole", key: "role", title: item.slotRole || "" }, item.slotRole || ""),
3116
+ h("span", { className: "dph_slotName", key: "name", title: item.nameZh || item.name || item.fullName || "" }, item.nameZh || item.name || item.fullName || ""),
3117
+ h("span", { className: "dph_tag dph_slotNeed", key: "need" }, t("need." + (item.need || "enhance"))),
2760
3118
  item.installed
2761
- ? h("span", { className: "dph_tag dph_tagOk", key: "inst" }, format(t("card.installed"), { v: item.installed }))
2762
- : h("span", { className: "dph_stars", key: "stars" }, format(t("badge.stars"), { n: item.stars })),
3119
+ ? h("span", { className: "dph_tag dph_tagOk dph_slotTail", key: "inst", title: format(t("card.installed"), { v: item.installed }) }, format(t("card.installed"), { v: item.installed }))
3120
+ : h("span", { className: "dph_stars dph_slotTail", key: "stars" }, format(t("badge.stars"), { n: item.stars })),
2763
3121
  ]),
2764
3122
  )),
2765
3123
  h("div", { className: "dph_logCmd", key: "install" }, h(SetInstallButton, { set: set })),
@@ -2869,6 +3227,138 @@ window.__ModuleLoader__.load({
2869
3227
  ]);
2870
3228
  }
2871
3229
 
3230
+ /* ------------------------------------------------------- share (2026-10-21) */
3231
+ /**
3232
+ * 把一条插件变成「能直接发出去的东西」。
3233
+ *
3234
+ * 为什么面板只给三个动作,不照搬站点 ShareButton 的 14 个平台入口:
3235
+ * · 微博 / X / QQ 的网页分享接口是给浏览器页设计的,桌面面板里跳编辑框
3236
+ * 比把文案直接贴进群多绕两步;
3237
+ * · 微信没有网页分享接口,站点用「PC 显示二维码、手机扫」绕过去 —— 这里
3238
+ * 方向正好相反:手机上装不了 dsh 插件,扫码过去只能看详情页,多一步零增量;
3239
+ * · 站点那套的价值在「网页里读完好转发」,而面板里用户是在挑插件,
3240
+ * 他要的是「这条能发给同事」的物料。
3241
+ *
3242
+ * 文案刻意**不带安装命令**:面板命令里的 --profile 是本机真实值(host 侧 PROFILE),
3243
+ * 接收方若用 web profile 就会装到别处(2026-10-12 已踩过)。只给链接,让对方在
3244
+ * 详情页拿他自己的命令 —— 详情页与验证器是同一口径。
3245
+ *
3246
+ * 说明图走站点的 /og-card(带 Content-Disposition: attachment),点一下即落盘。
3247
+ * 不走「取 PNG 再转 blob」:该接口不带 CORS 头,跨源 fetch 会被浏览器拒。
3248
+ */
3249
+ function sharePathOf(fullName) {
3250
+ return String(fullName || "").split("/").filter(Boolean).map(encodeURIComponent).join("/");
3251
+ }
3252
+
3253
+ /** 详情页 + 渠道参数。utm_source=dsh 已在站点 lib/source-glossary.ts 登记。 */
3254
+ function shareLinkOf(fullName) {
3255
+ const slug = String(fullName || "").replace(/\//g, "-");
3256
+ return SITE + "/plugin/" + sharePathOf(fullName)
3257
+ + "?utm_source=dsh&utm_medium=panel&utm_content=" + encodeURIComponent(slug);
3258
+ }
3259
+
3260
+ /** 1200×630 说明图;服务端声明 attachment,点击即下载。 */
3261
+ function shareCardOf(fullName) {
3262
+ return SITE + "/og-card/" + sharePathOf(fullName) + ".png";
3263
+ }
3264
+
3265
+ /**
3266
+ * 摘要截断:优先在句子边界收尾(与站点 ShareButton 的 clipText 同一策略)。
3267
+ * 裸 slice 会把文案切成半句话,分享出去读起来像没写完。
3268
+ * ① 句末标点(保留)② 句中停顿(去标点)③ 都没有才硬截 + 省略号。
3269
+ * ①② 的落点不得早于 max*0.6,否则回退过头、丢的信息比截断还多。
3270
+ */
3271
+ function shareClip(text, max) {
3272
+ const value = String(text || "").replace(/\s+/g, " ").trim();
3273
+ if (value.length <= max) return value;
3274
+ const head = value.slice(0, max);
3275
+ const floor = Math.floor(max * 0.6);
3276
+ const hard = Math.max(head.lastIndexOf("。"), head.lastIndexOf("!"), head.lastIndexOf("?"), head.lastIndexOf(";"));
3277
+ if (hard >= floor) return head.slice(0, hard + 1);
3278
+ const soft = Math.max(head.lastIndexOf(","), head.lastIndexOf("、"), head.lastIndexOf(":"));
3279
+ if (soft >= floor) return head.slice(0, soft);
3280
+ return head.trimEnd() + "…";
3281
+ }
3282
+
3283
+ /** 分享文案:标题行 + 一句话卖点 + 链接。可直接贴群、贴微博。 */
3284
+ function shareTextOf(item) {
3285
+ const title = item.nameZh || item.name || item.fullName || "";
3286
+ const head = title
3287
+ + (item.owner ? " @" + item.owner : "")
3288
+ + (Number(item.stars) > 0 ? " " + format(t("badge.stars"), { n: item.stars }) : "");
3289
+ const brief = shareClip(item.sell || item.descZh || "", 60);
3290
+ return (brief ? head + "\n" + brief : head) + "\n" + shareLinkOf(item.fullName);
3291
+ }
3292
+
3293
+ /**
3294
+ * 分享入口本体。**行内展开**,不是浮层:浮窗的 .dph_panelBody 是 overflow-y:auto,
3295
+ * 绝对定位弹层会被裁掉(HandoffToDesktop 踩过同类问题,那边能 portal 出去,
3296
+ * 这里 portal 出去会跟卡片脱节)。行内展开零定位风险,也与 InstallRow 的
3297
+ * 二次确认同一交互范式。
3298
+ *
3299
+ * scope = 视图名(picks / panel / daily / best / board),由 renderCard 传入,
3300
+ * 用来回答「哪个视图的人在分享」—— 卡片曝光拿不到,只能看分布与趋势。
3301
+ */
3302
+ function ShareUnit(props) {
3303
+ const item = props.item || {};
3304
+ const fullName = typeof item.fullName === "string" ? item.fullName : "";
3305
+ const scope = props.scope || "";
3306
+ const [open, setOpen] = react.useState(false);
3307
+ const [done, setDone] = react.useState("");
3308
+ /* 没有 owner/repo 就拼不出详情页(站点 /plugin/<owner>/<repo> 需要两段)——
3309
+ 宁可不渲染这个入口,也不给一个必然落到列表页的链接。hooks 已跑完,早退安全。 */
3310
+ if (fullName.indexOf("/") < 0) return null;
3311
+ const mark = (key) => {
3312
+ setDone(key);
3313
+ setTimeout(() => setDone((current) => (current === key ? "" : current)), 1800);
3314
+ };
3315
+ const copy = (kind, text) => copyText(text, () => {
3316
+ mark(kind);
3317
+ track("plugin_hub", { action: kind === "link" ? "share_link" : "share_text", scope });
3318
+ });
3319
+ const toggle = h("button", {
3320
+ className: "dph_btn" + (open ? " dph_btnPrimary" : ""),
3321
+ key: "toggle",
3322
+ type: "button",
3323
+ title: open ? t("share.closeHint") : t("share.toggle"),
3324
+ onClick: () => {
3325
+ const next = !open;
3326
+ setOpen(next);
3327
+ /* 打开与收起分开记:收起多半是误触或反悔,混进分享量会把分子放大。 */
3328
+ track("plugin_hub", { action: next ? "share_open" : "share_close", scope });
3329
+ },
3330
+ /* 展开后这个按钮自己变成「收起」—— 不再单列第四个「收起」按钮:
3331
+ 400px 浮窗里多一个按钮就多占一行,而这两个本来就是同一个开关。 */
3332
+ }, open ? t("share.collapse") : t("share.action"));
3333
+ if (!open) return h("span", { className: "dph_shareWrap", key: "share" }, [toggle]);
3334
+ return h("span", { className: "dph_shareWrap dph_shareWrapOpen", key: "share" }, [
3335
+ toggle,
3336
+ h("button", {
3337
+ className: "dph_btn dph_btnSm",
3338
+ key: "link",
3339
+ type: "button",
3340
+ title: t("share.linkHint"),
3341
+ onClick: () => copy("link", shareLinkOf(fullName)),
3342
+ }, done === "link" ? t("action.copied") : t("share.link")),
3343
+ h("button", {
3344
+ className: "dph_btn dph_btnSm",
3345
+ key: "text",
3346
+ type: "button",
3347
+ title: t("share.textHint"),
3348
+ onClick: () => copy("text", shareTextOf(item)),
3349
+ }, done === "text" ? t("action.copied") : t("share.text")),
3350
+ h("a", {
3351
+ className: "dph_btn dph_btnSm",
3352
+ key: "card",
3353
+ href: shareCardOf(fullName),
3354
+ target: "_blank",
3355
+ rel: "noopener noreferrer",
3356
+ title: t("share.cardHint"),
3357
+ onClick: () => track("plugin_hub", { action: "share_card", scope }),
3358
+ }, t("share.card")),
3359
+ ]);
3360
+ }
3361
+
2872
3362
  /**
2873
3363
  * 一张插件卡。
2874
3364
  *
@@ -2878,12 +3368,18 @@ window.__ModuleLoader__.load({
2878
3368
  * 操作轨道。原来靠 .dph_spacer 把 ★ 与 GitHub 顶到卡片两端,正文只占一半、
2879
3369
  * 右侧大片空白;挪成轨道后操作按列对齐、可纵向扫读(2026-10-19 A2)。
2880
3370
  * ⚠️ wide 必须由调用方显式传参,不能靠样式选择器自动套用 —— 本组件有 4 处复用。
3371
+ * scope 同理:只用于分享埋点的 via,缺省空串(老调用点不传也能跑)。
2881
3372
  */
2882
- function renderCard(item, copiedCmd, onCopied, compact, comparable, wide) {
3373
+ function renderCard(item, copiedCmd, onCopied, compact, comparable, wide, scope) {
2883
3374
  const title = item.nameZh || item.name || item.fullName || "";
2884
3375
  const tags = tagsOf(item);
2885
- // 卖点行:站点 tagline 经严格过滤后的结果;没有就不占位(宁可不显示,也不放英文原文或垃圾串)
2886
- const sellRow = item.sell
3376
+ /* 卖点行:站点 tagline 经严格过滤后的结果;没有就不占位(宁可不显示,也不放英文原文或垃圾串)。
3377
+ 2026-10-21:卖点与正文**开头相同**时只留正文。host 侧 slim() 在 tagline 缺失时
3378
+ 把 sell 回落到 descriptionZh,于是卡片上会出现两行几乎一样的字(真机截图里就是这样),
3379
+ 层级反而被抹平 —— 判据取前 16 字,足够区分「同一句话」与「同一主题的两种说法」。 */
3380
+ const sellEcho = item.sell && item.descZh
3381
+ && (item.descZh.startsWith(item.sell.slice(0, 16)) || item.sell.startsWith(item.descZh));
3382
+ const sellRow = item.sell && !sellEcho
2887
3383
  ? h("div", { className: "dph_sell", key: "sell" }, [
2888
3384
  h("span", { className: "dph_sellTag", key: "tag" }, t("label.sell")),
2889
3385
  h("span", { className: "dph_sellText", key: "text" }, item.sell),
@@ -2899,9 +3395,14 @@ window.__ModuleLoader__.load({
2899
3395
  ])
2900
3396
  : null;
2901
3397
  /* 已经装过就直说 —— 实测有用户对着一个早就装好的插件反复点「安装」,
2902
- 然后判定"安装不成功"(他无从知道那东西其实已经在跑了)。 */
2903
- const installedRow = item.installed
2904
- ? h("div", { className: "dph_tags", key: "installed" }, h("span", { className: "dph_tag dph_tagOk" }, format(t("card.installed"), { v: item.installed })))
3398
+ 然后判定"安装不成功"(他无从知道那东西其实已经在跑了)。
3399
+ 2026-10-21 版式:已安装并入标签行(实底浅蓝)。它和分类标签同属
3400
+ 「这条现在什么状态」,单开一行既多 20px、又让人以为是另一种层级。 */
3401
+ const installedChip = item.installed
3402
+ ? h("span", { className: "dph_tag dph_tagSolid", key: "installed" }, format(t("card.installed"), { v: item.installed }))
3403
+ : null;
3404
+ const tagRow = (tags.length || installedChip)
3405
+ ? h("div", { className: "dph_tags", key: "tags" }, installedChip ? tags.concat([installedChip]) : tags)
2905
3406
  : null;
2906
3407
  const onCopy = () => copyText(item.cmd, () => {
2907
3408
  onCopied(item.cmd);
@@ -2939,15 +3440,22 @@ window.__ModuleLoader__.load({
2939
3440
  : null;
2940
3441
 
2941
3442
  if (wide) {
2942
- /* 命令条通栏、复制按钮内嵌右端 —— 短命令不再拉出一条空白 */
3443
+ /* 命令条通栏、复制按钮内嵌右端 —— 短命令不再拉出一条空白。
3444
+ 分享与复制命令同处一条:都是「把这条带走」,分开摆要来回找。 */
3445
+ const share = h(ShareUnit, { item: item, scope: scope, key: "share" });
2943
3446
  const bar = item.cmd
2944
3447
  ? h("div", { className: "dph_cmdbar", key: "cmd" }, [
2945
3448
  h("code", { className: "dph_cmdbarCode", key: "code" }, item.cmd),
2946
3449
  h("button", { className: "dph_btn dph_btnSm", key: "copy", type: "button", onClick: onCopy },
2947
3450
  copiedCmd === item.cmd ? t("action.copied") : t("action.copy")),
3451
+ share,
2948
3452
  ])
2949
- : h("div", { className: "dph_cmdMissing", key: "cmd" }, t("cmd.missing"));
2950
- return h("div", { className: "dph_cardLg", key: item.fullName || title }, [
3453
+ : h("div", { className: "dph_cmdMissing", key: "cmd" }, [
3454
+ h("span", { key: "text" }, t("cmd.missing")),
3455
+ /* 命令缺失不等于不能分享:这条仍可发给同事,让对方自己判断 */
3456
+ share,
3457
+ ]);
3458
+ return h("div", { className: "dph_cardLg" + (comparable && inCompare(item) ? " dph_cardOn" : "") + (comparable && inFav(item) ? " dph_cardFav" : ""), key: item.fullName || title }, [
2951
3459
  h("div", { className: "dph_cardLgMain", key: "main" }, [
2952
3460
  h("div", { className: "dph_cardTop", key: "top" }, [
2953
3461
  h("span", { className: "dph_name", key: "name" }, title),
@@ -2955,8 +3463,7 @@ window.__ModuleLoader__.load({
2955
3463
  h("span", { className: "dph_stars", key: "stars" }, format(t("badge.stars"), { n: item.stars })),
2956
3464
  item.src === "repo" ? h("span", { className: "dph_tag", key: "src" }, t("label.repoSource")) : null,
2957
3465
  ]),
2958
- tags.length ? h("div", { className: "dph_tags", key: "tags" }, tags) : null,
2959
- installedRow,
3466
+ tagRow,
2960
3467
  sellRow,
2961
3468
  descRow,
2962
3469
  h(InstallRow, { item: item, key: "install" }),
@@ -2966,6 +3473,8 @@ window.__ModuleLoader__.load({
2966
3473
  ]);
2967
3474
  }
2968
3475
 
3476
+ /* 窄卡同理:分享紧挨复制按钮(.dph_cmdRow 本来就会换行,展开后自动落到第二行) */
3477
+ const shareUnit = h(ShareUnit, { item: item, scope: scope, key: "share" });
2969
3478
  const cmdRow = item.cmd
2970
3479
  ? h("div", { className: "dph_cmdWrap", key: "cmd" }, [
2971
3480
  h("div", { className: "dph_cmdRow", key: "row" }, [
@@ -2976,12 +3485,16 @@ window.__ModuleLoader__.load({
2976
3485
  h("code", { className: "dph_cmd", key: "code" }, item.cmd),
2977
3486
  h("button", { className: "dph_btn", key: "copy", type: "button", onClick: onCopy },
2978
3487
  copiedCmd === item.cmd ? t("action.copied") : t("action.copy")),
3488
+ shareUnit,
2979
3489
  ]),
2980
3490
  item.src === "repo" ? h("div", { className: "dph_instHint", key: "hint" }, t("hint.repoSource")) : null,
2981
3491
  ])
2982
- : h("div", { className: "dph_cmdMissing", key: "cmd" }, t("cmd.missing"));
3492
+ : h("div", { className: "dph_cmdMissing", key: "cmd" }, [
3493
+ h("span", { key: "text" }, t("cmd.missing")),
3494
+ shareUnit,
3495
+ ]);
2983
3496
 
2984
- return h("div", { className: "dph_card" + (compact ? " dph_cardSm" : ""), key: item.fullName || title }, [
3497
+ return h("div", { className: "dph_card" + (compact ? " dph_cardSm" : "") + (comparable && inCompare(item) ? " dph_cardOn" : "") + (comparable && inFav(item) ? " dph_cardFav" : ""), key: item.fullName || title }, [
2985
3498
  h("div", { className: "dph_cardTop", key: "top" }, [
2986
3499
  cmpBtn,
2987
3500
  favBtn,
@@ -2991,8 +3504,7 @@ window.__ModuleLoader__.load({
2991
3504
  h("span", { className: "dph_stars", key: "stars" }, format(t("badge.stars"), { n: item.stars })),
2992
3505
  linkBtn,
2993
3506
  ]),
2994
- tags.length ? h("div", { className: "dph_tags", key: "tags" }, tags) : null,
2995
- installedRow,
3507
+ tagRow,
2996
3508
  sellRow,
2997
3509
  descRow,
2998
3510
  h(InstallRow, { item: item, key: "install" }),
@@ -3043,7 +3555,7 @@ window.__ModuleLoader__.load({
3043
3555
  if (opts.collapsed) return h("div", { className: "dph_daily", key: "daily" }, [head]);
3044
3556
  return h("div", { className: "dph_daily", key: "daily" }, [
3045
3557
  head,
3046
- renderCard(picked.item, copiedCmd, onCopied, true),
3558
+ renderCard(picked.item, copiedCmd, onCopied, true, false, false, "daily"),
3047
3559
  picked.item.reason
3048
3560
  ? h("p", { className: "dph_dailyWhy", key: "why" }, t("daily.why") + ":" + picked.item.reason)
3049
3561
  : null,
@@ -3997,6 +4509,9 @@ window.__ModuleLoader__.load({
3997
4509
  switchRow("daily", "settings.daily", "settings.dailyHint", state.daily, (next) => setDaily(next, "settings")),
3998
4510
  switchRow("check", "settings.check", "settings.checkHint", state.autoCheck, (next) => setAutoCheck(next, "settings")),
3999
4511
  switchRow("tel", "settings.telemetry", "settings.about", state.telemetry, setTelemetry),
4512
+ /* 社群 + 订阅:放在开关之后、更新日志之前 —— 它属于「这个插件还能给你什么」,
4513
+ 不是「版本改了什么」。inSet 去掉外框,只留一条分隔线,避免卡中卡。 */
4514
+ h(JoinCard, { key: "join", inSet: true }),
4000
4515
  changelogSection(cl, pending),
4001
4516
  h("div", { className: "dph_setGroup", key: "reset" }, [
4002
4517
  h("div", { className: "dph_setRow", key: "row" }, [
@@ -4026,6 +4541,164 @@ window.__ModuleLoader__.load({
4026
4541
  }, option.label)));
4027
4542
  }
4028
4543
 
4544
+ /**
4545
+ * 社群 + 订阅入口(2026-10-20)。
4546
+ *
4547
+ * 三处共用:会话页签(宽)/ 右下浮窗(compact)/ 设置 → 插件(宽、无外框)。
4548
+ *
4549
+ * 两个必须守住的点:
4550
+ * 1) **订阅必须经本机 host 转发**(`/api/dpharness/subscribe`)。站点
4551
+ * `/api/subscribe` 不带 CORS 头,浏览器跨源直发不成立 —— 与 track()
4552
+ * 下面那条注释是同一个实测结论。邮箱只发给站点、只用于周报,卡内写明。
4553
+ * 2) 二维码默认收起、点开才显示,尺寸不小于 84px(站点实测:64px 时
4554
+ * jsQR 已解不出)。「入口在但看不见」和「码扫不出来」都是把入口做成摆设。
4555
+ */
4556
+ function JoinCard(props) {
4557
+ const compact = !!(props && props.compact);
4558
+ const inSet = !!(props && props.inSet);
4559
+ const [open, setOpen] = react.useState(false);
4560
+ const [email, setEmail] = react.useState("");
4561
+ const [sub, setSub] = react.useState(null);
4562
+ const busy = !!sub && sub.phase === "sending";
4563
+
4564
+ function submit(event) {
4565
+ if (event && event.preventDefault) event.preventDefault();
4566
+ if (busy) return;
4567
+ const value = String(email || "").trim();
4568
+ if (!value) {
4569
+ setSub({ phase: "bad", text: t("join.needEmail") });
4570
+ return;
4571
+ }
4572
+ setSub({ phase: "sending" });
4573
+ track("plugin_hub", { action: "subscribe_submit" });
4574
+ fetch("/api/dpharness/subscribe", {
4575
+ method: "POST",
4576
+ headers: { "content-type": "application/json" },
4577
+ body: JSON.stringify({ email: value, source: "dsh-plugin" }),
4578
+ })
4579
+ .then((response) =>
4580
+ response.json().catch(() => ({})).then((data) => ({ response, data })),
4581
+ )
4582
+ .then((pair) => {
4583
+ const response = pair.response;
4584
+ const data = pair.data || {};
4585
+ /* content-type 判断很关键:宿主没注册这个前缀时,SPA 兜底会回一份
4586
+ HTML(200),只判 response.ok 会被当成成功,界面显示空白或假成功。 */
4587
+ const jsonType = String(response.headers.get("content-type") || "").indexOf("application/json") >= 0;
4588
+ const detail = typeof data.error === "string" ? data.error : "";
4589
+ if (!response.ok || !jsonType || data.ok === false) {
4590
+ let text;
4591
+ if (response.status === 404 || !jsonType) {
4592
+ /* 路由不在(或拿回网页):只有完全重启 dsh 才会重新注册 —— 路由只在进程启动时挂一次 */
4593
+ text = format(t("join.failRoute"), { code: String(response.status) });
4594
+ } else if (response.status >= 500) {
4595
+ text = detail || format(t("join.failUpstream"), { code: String(response.status) });
4596
+ } else {
4597
+ /* 4xx:服务端给了中文人话(邮箱格式 / 频率限制)就原样透出 */
4598
+ text = detail || format(t("join.failHttp"), { code: String(response.status) });
4599
+ }
4600
+ setSub({ phase: "bad", text });
4601
+ return;
4602
+ }
4603
+ setEmail("");
4604
+ setSub({ phase: "ok", text: data.message || t("join.subscribeOk") });
4605
+ track("plugin_hub", { action: "subscribe_ok" });
4606
+ })
4607
+ .catch(() => setSub({ phase: "bad", text: t("join.failNetwork") }));
4608
+ }
4609
+
4610
+ const qrRow = open
4611
+ ? h("div", { className: "dph_qrRow", key: "qr" }, COMMUNITY_GROUPS.map((group) =>
4612
+ h("div", { className: "dph_qrItem", key: group.key }, [
4613
+ h("a", {
4614
+ key: "img",
4615
+ href: group.url,
4616
+ target: "_blank",
4617
+ rel: "noopener noreferrer",
4618
+ onClick: () => track("plugin_hub", { action: "community_join", scope: group.key }),
4619
+ }, h("img", {
4620
+ className: "dph_qrImg",
4621
+ src: group.qr,
4622
+ width: 84,
4623
+ height: 84,
4624
+ alt: group.name + " · " + t(group.scanKey),
4625
+ })),
4626
+ h("a", {
4627
+ className: "dph_qrLink",
4628
+ key: "link",
4629
+ href: group.url,
4630
+ target: "_blank",
4631
+ rel: "noopener noreferrer",
4632
+ onClick: () => track("plugin_hub", { action: "community_join", scope: group.key }),
4633
+ }, format(t("join.joinGroup"), { label: t(group.labelKey) })),
4634
+ h("span", { className: "dph_qrHint", key: "hint" }, t(group.scanKey)),
4635
+ ]),
4636
+ ))
4637
+ : null;
4638
+
4639
+ return h("div", {
4640
+ className: "dph_join" + (compact ? " dph_joinCompact" : "") + (inSet ? " dph_joinInSet" : ""),
4641
+ }, [
4642
+ h("div", { className: "dph_joinHead", key: "gh" }, [
4643
+ h("span", { className: "dph_joinTitle", key: "title" }, "💬 " + t("join.title")),
4644
+ h("span", { className: "dph_joinSub", key: "sub" }, t("join.sub")),
4645
+ h("span", { className: "dph_spacer", key: "gap" }),
4646
+ h("button", {
4647
+ className: "dph_btn dph_btnSm",
4648
+ key: "toggle",
4649
+ type: "button",
4650
+ "aria-expanded": open ? "true" : "false",
4651
+ onClick: () => {
4652
+ if (!open) track("plugin_hub", { action: "community_open" });
4653
+ setOpen(!open);
4654
+ },
4655
+ }, open ? t("join.hideQr") : t("join.showQr")),
4656
+ ]),
4657
+ qrRow,
4658
+ h("div", { className: "dph_joinHead", key: "nh" }, [
4659
+ h("span", { className: "dph_joinTitle", key: "title" }, "✉️ " + t("join.newsletter")),
4660
+ h("span", { className: "dph_joinSub", key: "sub" }, t("join.newsletterSub")),
4661
+ ]),
4662
+ h("form", { className: "dph_subForm", key: "form", onSubmit: submit }, [
4663
+ h("input", {
4664
+ className: "dph_subInput",
4665
+ key: "input",
4666
+ type: "email",
4667
+ value: email,
4668
+ placeholder: t("join.email"),
4669
+ autoComplete: "email",
4670
+ onChange: (event) => setEmail(event.target.value),
4671
+ }),
4672
+ h("button", {
4673
+ className: "dph_btn dph_btnPrimary",
4674
+ key: "go",
4675
+ type: "submit",
4676
+ disabled: busy,
4677
+ }, busy ? t("join.sending") : t("join.subscribe")),
4678
+ ]),
4679
+ sub
4680
+ ? h("div", {
4681
+ className:
4682
+ "dph_joinMsg" +
4683
+ (sub.phase === "ok" ? " dph_joinOk" : sub.phase === "bad" ? " dph_joinBad" : ""),
4684
+ key: "msg",
4685
+ role: "status",
4686
+ }, sub.text)
4687
+ : null,
4688
+ h("div", { className: "dph_joinNote", key: "note" }, [
4689
+ t("join.note") + " ",
4690
+ h("a", {
4691
+ className: "dph_qrLink",
4692
+ key: "past",
4693
+ href: NEWSLETTER_URL,
4694
+ target: "_blank",
4695
+ rel: "noopener noreferrer",
4696
+ onClick: () => track("plugin_hub", { action: "site_click", scope: "newsletter" }),
4697
+ }, t("join.past")),
4698
+ ]),
4699
+ ]);
4700
+ }
4701
+
4029
4702
  function controls(cat) {
4030
4703
  return h("div", { className: "dph_bar", key: "bar" }, [
4031
4704
  h("input", {
@@ -4133,6 +4806,9 @@ window.__ModuleLoader__.load({
4133
4806
  track("copy_install", { cmd: item.cmd, pkg: item.pkg || "" });
4134
4807
  }),
4135
4808
  }, copiedCmd === item.cmd ? t("action.copied") : t("action.copy")),
4809
+ /* 侧栏这条命令条是**自建**的(不走 renderCard),所以分享要单独接一次。
4810
+ 2026-10-21 首版漏了这一处:用户在真机截图里发现"今日推荐卡没有分享"。 */
4811
+ h(ShareUnit, { item: item, scope: "rail", key: "share" }),
4136
4812
  ])
4137
4813
  : null,
4138
4814
  item.reason ? h("p", { className: "dph_railWhy", key: "why" }, t("daily.why") + ":" + item.reason) : null,
@@ -4158,6 +4834,9 @@ window.__ModuleLoader__.load({
4158
4834
  每日推荐的显隐同样读这个 store(设置页改完这里要跟着变)。 */
4159
4835
  const state = useHub();
4160
4836
  const [mode, setMode] = react.useState("search");
4837
+ /* 周榜内部的两条线(top / installs)。默认 top:它与分类精选同属"全网热度"
4838
+ 口径,先给用户熟悉的那一半;装机榜是本站私有信号,解释成本更高。 */
4839
+ const [boardKind, setBoardKind] = react.useState("top");
4161
4840
  /* 对比表开没开 ── 每个面各自记(选择集在 hub 上共享,表格的展开状态是本面的) */
4162
4841
  const [comparing, setComparing] = react.useState(false);
4163
4842
  const dateKey = useDateKey();
@@ -4166,40 +4845,54 @@ window.__ModuleLoader__.load({
4166
4845
  不给侧栏新增任何请求 —— 全站只有这一个数据源。 */
4167
4846
  const best = useBest(t, mode === "best" || mode === "daily" || state.daily);
4168
4847
  const sets = useSets(t, mode === "sets");
4848
+ const board = useBoard(t, boardKind, mode === "board");
4169
4849
  const data = cat.state.data;
4170
4850
  const bestData = best.state.data;
4171
4851
  const setsData = sets.state.data;
4852
+ const boardData = board.state.data;
4172
4853
  const isBest = mode === "best";
4173
4854
  const isDaily = mode === "daily";
4174
4855
  const isUpdate = mode === "update";
4175
4856
  const isSets = mode === "sets";
4857
+ const isBoard = mode === "board";
4176
4858
 
4177
4859
  /* 页头副标题与区标题分工:页头说「这是什么」(固定口径),
4178
4860
  区标题说「现在看到的是哪一段 + 多少条」。
4179
4861
  两处都写"共 N 条"会让页面重复又啰嗦(原版就是这个毛病)。 */
4180
- const headSub = isSets || isBest || isDaily || isUpdate ? "" : t("view.sub");
4862
+ const headSub = isSets || isBest || isDaily || isUpdate || isBoard ? "" : t("view.sub");
4181
4863
  const sectionTitle = isUpdate
4182
4864
  ? t("section.updates")
4183
4865
  : isSets
4184
4866
  ? t("section.sets")
4185
- : isBest
4186
- ? t("section.best")
4187
- : isDaily
4188
- ? t("section.daily")
4189
- : t("section.browse");
4867
+ : isBoard
4868
+ ? t("board.tab")
4869
+ : isBest
4870
+ ? t("section.best")
4871
+ : isDaily
4872
+ ? t("section.daily")
4873
+ : t("section.browse");
4190
4874
  const sectionCount = isUpdate
4191
4875
  ? ""
4192
4876
  : isSets
4193
4877
  ? (setsData ? format(t("sets.count"), { n: setsData.total || 0 }) : "")
4194
- : isBest
4195
- ? (bestData ? format(t("best.month"), { m: bestData.month || "" }) : "")
4196
- : isDaily
4197
- ? dateKey
4198
- : countSub(data, t, cat.state.loading, "");
4878
+ : isBoard
4879
+ ? (boardData
4880
+ ? boardKind === "top"
4881
+ ? boardData.periodNo
4882
+ ? format(t("board.topSub"), { n: boardData.total || 0, p: boardData.periodNo })
4883
+ : format(t("board.topSubLive"), { n: boardData.total || 0 })
4884
+ : format(t("board.installsSub"), { n: boardData.total || 0 })
4885
+ : "")
4886
+ : isBest
4887
+ ? (bestData ? format(t("best.month"), { m: bestData.month || "" }) : "")
4888
+ : isDaily
4889
+ ? dateKey
4890
+ : countSub(data, t, cat.state.loading, "");
4199
4891
 
4200
4892
  const TABS = [
4201
4893
  { value: "search", label: t("best.recommend") },
4202
4894
  { value: "best", label: t("best.picks") },
4895
+ { value: "board", label: t("board.tab") },
4203
4896
  { value: "sets", label: t("sets.tab") },
4204
4897
  { value: "daily", label: t("daily.tab") },
4205
4898
  { value: "update", label: t("updates.tab") },
@@ -4219,6 +4912,30 @@ window.__ModuleLoader__.load({
4219
4912
  ? [
4220
4913
  h("div", { className: "dph_list", key: "dlist" }, dailyCard(best, best.copiedCmd, best.markCopied, { dateKey: dateKey })),
4221
4914
  ]
4915
+ : isBoard
4916
+ ? [
4917
+ /* 两条线用二级切换,不再拆两个顶级页签:顶级页签已经 6 个,
4918
+ 而且用户的心智是"看榜",不是"看两个榜"。 */
4919
+ h("div", { className: "dph_bar", key: "bkind" }, seg([
4920
+ { value: "top", label: t("board.top") },
4921
+ { value: "installs", label: t("board.installs") },
4922
+ ], boardKind, setBoardKind)),
4923
+ /* 口径必须常驻一行:两个榜的量级差几个数量级,不解释就会被互相对照 */
4924
+ h("p", { className: "dph_boardWhy", key: "why" },
4925
+ boardKind === "top"
4926
+ ? (boardData && boardData.live ? t("board.topWhyLive") : t("board.topWhy"))
4927
+ : t("board.installsWhy")),
4928
+ board.state.error
4929
+ ? h(Notice, {
4930
+ key: "boerror",
4931
+ kind: "bad",
4932
+ text: /404/.test(board.state.error) ? t("board.offline") : t("state.failed") + ":" + board.state.error,
4933
+ })
4934
+ : null,
4935
+ board.state.loading && !boardData ? h(Notice, { key: "boloading", text: t("board.loading") }) : null,
4936
+ !board.state.loading && boardData && (boardData.total || 0) === 0 ? h(Notice, { key: "boempty", text: t("board.empty") }) : null,
4937
+ h("div", { className: "dph_list", key: "bolist" }, renderBoard(boardData, boardKind, board.copiedCmd, board.markCopied, { wide: true })),
4938
+ ]
4222
4939
  : isBest
4223
4940
  ? [
4224
4941
  best.state.error ? h(Notice, { key: "berror", kind: "bad", text: t("state.failed") + ":" + best.state.error }) : null,
@@ -4233,7 +4950,7 @@ window.__ModuleLoader__.load({
4233
4950
  !cat.state.loading && !cat.state.error && cat.plugins.length === 0 ? h(Notice, { key: "empty", text: t("state.empty") }) : null,
4234
4951
  h(CompareBar, { key: "cmpBar", open: comparing, onToggle: () => setComparing((value) => !value) }),
4235
4952
  comparing ? h(CompareTable, { key: "cmp", copiedCmd: cat.copiedCmd, markCopied: cat.markCopied }) : null,
4236
- h("div", { className: "dph_list", key: "list" }, cat.plugins.map((item) => renderCard(item, cat.copiedCmd, cat.markCopied, false, true, true))),
4953
+ h("div", { className: "dph_list", key: "list" }, cat.plugins.map((item) => renderCard(item, cat.copiedCmd, cat.markCopied, false, true, true, "picks"))),
4237
4954
  ];
4238
4955
 
4239
4956
  /* ── 侧栏:今日推荐(「每日推荐」视图里正文已经是这条,不重复)+ 各小类冠军 + 安装须知 ── */
@@ -4283,12 +5000,14 @@ window.__ModuleLoader__.load({
4283
5000
  h("a", {
4284
5001
  className: "dph_btn",
4285
5002
  key: "site",
4286
- href: isSets ? SITE + "/sets" : isBest ? SITE + "/best" : SITE + "/plugins",
5003
+ /* 周榜按当前子榜给对应站点页:本站两个榜是**两个独立页面**,
5004
+ 点错了会看到另一套口径(/top 是下载量,/ranking/installs 是站内装机)。 */
5005
+ href: isBoard ? SITE + (boardKind === "top" ? "/top" : "/ranking/installs") : isSets ? SITE + "/sets" : isBest ? SITE + "/best" : SITE + "/plugins",
4287
5006
  target: "_blank",
4288
5007
  rel: "noopener noreferrer",
4289
- onClick: () => track("plugin_hub", { action: "site_click", scope: isDaily ? "daily" : isSets ? "sets" : isBest ? "best" : "tab" }),
5008
+ onClick: () => track("plugin_hub", { action: "site_click", scope: isBoard ? "board_" + boardKind : isDaily ? "daily" : isSets ? "sets" : isBest ? "best" : "tab" }),
4290
5009
  }, t("action.openSite")),
4291
- h("button", { className: "dph_btn", key: "refresh", type: "button", onClick: isUpdate ? () => loadUpdates(true) : isSets ? sets.refresh : (isBest || isDaily) ? best.refresh : cat.refresh }, t("action.refresh")),
5010
+ h("button", { className: "dph_btn", key: "refresh", type: "button", onClick: isUpdate ? () => loadUpdates(true) : isBoard ? board.refresh : isSets ? sets.refresh : (isBest || isDaily) ? best.refresh : cat.refresh }, t("action.refresh")),
4292
5011
  ]),
4293
5012
  /* 页签是页级导航:用下划线而不是分段按钮 —— 原来那枚 seg 与正文控件同规格,
4294
5013
  读不出"它管着下面全部内容"(用户反馈"模块分布不清晰"的一部分)。 */
@@ -4307,6 +5026,9 @@ window.__ModuleLoader__.load({
4307
5026
  ]),
4308
5027
  /* 待重启横幅挂在区标题之下、结果区之上:不跟着卡片滚走,切视图也在 */
4309
5028
  h(RestartBanner, { scope: "tab", key: "rbanner" }),
5029
+ /* 社群 + 订阅:与待重启横幅同一层(常驻、不随列表滚走)。展开二维码后
5030
+ 会把列表往下推约 120px —— 可接受,因为它是点击后的主动结果。 */
5031
+ h(JoinCard, { key: "join" }),
4310
5032
  ...body,
4311
5033
  h("div", { className: "dph_footer", key: "hint" }, t("footer.hint")),
4312
5034
  h("div", { className: "dph_footer", key: "tel" }, h("div", { className: "dph_footToggles" }, [telemetryToggle(), floatToggle()])),
@@ -4411,6 +5133,8 @@ window.__ModuleLoader__.load({
4411
5133
  * 分成多个入口只会让人不知道该点哪个。
4412
5134
  */
4413
5135
  const [mode, setMode] = react.useState("search");
5136
+ /* 周榜子线(见 CatalogView 同名状态):两处各记一份,与 comparing 同理 */
5137
+ const [boardKind, setBoardKind] = react.useState("top");
4414
5138
  /* 对比表开没开 —— 与页签各记一份(选择集共享,展开状态是本面的) */
4415
5139
  const [comparing, setComparing] = react.useState(false);
4416
5140
  const dateKey = useDateKey();
@@ -4421,6 +5145,8 @@ window.__ModuleLoader__.load({
4421
5145
  const bestData = best.state.data;
4422
5146
  const sets = useSets(t, state.open && mode === "sets");
4423
5147
  const setsData = sets.state.data;
5148
+ const board = useBoard(t, boardKind, state.open && mode === "board");
5149
+ const boardData = board.state.data;
4424
5150
 
4425
5151
  /**
4426
5152
  * 展开时按**面板实际尺寸**重新夹取位置。
@@ -4526,18 +5252,28 @@ window.__ModuleLoader__.load({
4526
5252
  ? dateKey
4527
5253
  : mode === "sets"
4528
5254
  ? (setsData ? format(t("sets.count"), { n: setsData.total || 0 }) : "")
5255
+ : mode === "board"
5256
+ ? (boardData
5257
+ ? boardKind === "top"
5258
+ ? boardData.periodNo
5259
+ ? format(t("board.topSub"), { n: boardData.total || 0, p: boardData.periodNo })
5260
+ : format(t("board.topSubLive"), { n: boardData.total || 0 })
5261
+ : format(t("board.installsSub"), { n: boardData.total || 0 })
5262
+ : "")
4529
5263
  : mode === "best"
4530
5264
  ? (bestData ? format(t("best.month"), { m: bestData.month || "" }) : "")
4531
5265
  : mode === "update"
4532
5266
  ? ""
4533
5267
  : countSub(data, t, cat.state.loading)),
4534
5268
  h("span", { className: "dph_spacer", key: "gap" }),
4535
- h("a", { className: "dph_btn", key: "site", href: mode === "sets" ? SITE + "/sets" : mode === "best" ? SITE + "/best" : SITE + "/plugins", target: "_blank", rel: "noopener noreferrer", onClick: () => track("plugin_hub", { action: "site_click", scope: mode === "daily" ? "daily" : mode === "sets" ? "sets" : mode === "best" ? "best" : "overlay" }) }, t("action.openSite")),
5269
+ h("a", { className: "dph_btn", key: "site", href: mode === "board" ? SITE + (boardKind === "top" ? "/top" : "/ranking/installs") : mode === "sets" ? SITE + "/sets" : mode === "best" ? SITE + "/best" : SITE + "/plugins", target: "_blank", rel: "noopener noreferrer", onClick: () => track("plugin_hub", { action: "site_click", scope: mode === "board" ? "board_" + boardKind : mode === "daily" ? "daily" : mode === "sets" ? "sets" : mode === "best" ? "best" : "overlay" }) }, t("action.openSite")),
4536
5270
  h("button", { className: "dph_close", key: "close", type: "button", title: t("action.close"), "aria-label": t("action.close"), onClick: () => setHub({ open: false }) }, "×"),
4537
5271
  ]),
4538
- h("div", { className: "dph_segWrap", key: "seg" }, seg([
5272
+ /* 6 个视图在 372px 可用宽里会把四字标签挤到裁切 ⇒ 换滚动层(见样式注释) */
5273
+ h("div", { className: "dph_segWrap dph_segWrapScroll", key: "seg" }, seg([
4539
5274
  { value: "search", label: t("best.recommend") },
4540
5275
  { value: "best", label: t("best.picks") },
5276
+ { value: "board", label: t("board.tab") },
4541
5277
  { value: "sets", label: t("sets.tab") },
4542
5278
  { value: "daily", label: t("daily.tab") },
4543
5279
  { value: "update", label: t("updates.tab") },
@@ -4548,6 +5284,27 @@ window.__ModuleLoader__.load({
4548
5284
  ? [
4549
5285
  h("div", { className: "dph_panelBody", key: "ubody" }, h(UpdateView, { scope: "overlay" })),
4550
5286
  ]
5287
+ : mode === "board"
5288
+ ? [
5289
+ h("div", { className: "dph_bar", key: "bkind" }, seg([
5290
+ { value: "top", label: t("board.top") },
5291
+ { value: "installs", label: t("board.installs") },
5292
+ ], boardKind, setBoardKind)),
5293
+ h("p", { className: "dph_boardWhy", key: "why" },
5294
+ boardKind === "top"
5295
+ ? (boardData && boardData.live ? t("board.topWhyLive") : t("board.topWhy"))
5296
+ : t("board.installsWhy")),
5297
+ board.state.error
5298
+ ? h(Notice, {
5299
+ key: "boerror",
5300
+ kind: "bad",
5301
+ text: /404/.test(board.state.error) ? t("board.offline") : t("state.failed") + ":" + board.state.error,
5302
+ })
5303
+ : null,
5304
+ board.state.loading && !boardData ? h(Notice, { key: "boloading", text: t("board.loading") }) : null,
5305
+ !board.state.loading && boardData && (boardData.total || 0) === 0 ? h(Notice, { key: "boempty", text: t("board.empty") }) : null,
5306
+ h("div", { className: "dph_panelBody", key: "bobody" }, renderBoard(boardData, boardKind, board.copiedCmd, board.markCopied, { wide: false })),
5307
+ ]
4551
5308
  : mode === "sets"
4552
5309
  ? [
4553
5310
  sets.state.error ? h(Notice, { key: "serror", kind: "bad", text: t("state.failed") + ":" + sets.state.error }) : null,
@@ -4568,7 +5325,7 @@ window.__ModuleLoader__.load({
4568
5325
  !cat.state.loading && !cat.state.error && cat.plugins.length === 0 ? h(Notice, { key: "empty", text: t("state.empty") }) : null,
4569
5326
  h(CompareBar, { key: "cmpBar", open: comparing, onToggle: () => setComparing((value) => !value) }),
4570
5327
  comparing ? h(CompareTable, { key: "cmp", copiedCmd: cat.copiedCmd, markCopied: cat.markCopied }) : null,
4571
- h("div", { className: "dph_panelBody", key: "body" }, cat.plugins.map((item) => renderCard(item, cat.copiedCmd, cat.markCopied, true, true))),
5328
+ h("div", { className: "dph_panelBody", key: "body" }, cat.plugins.map((item) => renderCard(item, cat.copiedCmd, cat.markCopied, true, true, false, "panel"))),
4572
5329
  ]
4573
5330
  : [
4574
5331
  best.state.error ? h(Notice, { key: "berror", kind: "bad", text: t("state.failed") + ":" + best.state.error }) : null,
@@ -4577,6 +5334,9 @@ window.__ModuleLoader__.load({
4577
5334
  h("div", { className: "dph_panelBody", key: "bbody" }, renderBest(bestData, best.copiedCmd, best.markCopied)),
4578
5335
  ]),
4579
5336
  h("div", { className: "dph_panelFoot", key: "foot" }, [
5337
+ /* 浮窗里也放一份:浮窗是曝光最高的入口,只有页签有等于大半用户看不到。
5338
+ compact 版省掉说明行,二维码默认收起(面板只有 400px 宽)。 */
5339
+ h(JoinCard, { key: "join", compact: true }),
4580
5340
  h("div", { className: "dph_footRow", key: "row" }, [
4581
5341
  telemetryToggle(),
4582
5342
  h("button", {