dsh-mobile-ui 0.2.5 → 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/client.js CHANGED
@@ -272,8 +272,14 @@ window.__ModuleLoader__.load({
272
272
  可用、靠左时左溢出;fixed 与容器位置无关(实测两种场景都在视口内)。
273
273
  ⚠️ hash 前缀(QsffPG_ / _1nxmc_)会随 dsh 升级漂移、失效是静默的(退回溢出),
274
274
  升级后跑 tests/live-probe.py 复核(已覆盖后台任务菜单)。 */
275
- " body.dsh-mobile-ui [class*=QsffPG_menu],body.dsh-mobile-ui [role=menu][class*=_list_1nxmc_]{position:fixed !important;left:8px !important;right:8px !important;width:auto !important;min-width:0 !important;max-width:none !important;max-height:calc(100vh - 130px) !important;overflow:auto !important;top:calc(var(--dsh-mobile-popover-top,42px) + env(safe-area-inset-top,0px)) !important}",
276
- " body.dsh-mobile-ui [role=menu][class*=_list_1nxmc_]{--dsh-mobile-popover-top:76px}",
275
+ /* ⚠️ popover 的 top 必须落在**触发按钮下方**:菜单弹出后若盖住按钮本身,
276
+ 用户再点一下(想关掉/重开)时点击落在菜单上 —— 体感就是「点了没反应」
277
+ (2026-09-14 用户报「三个点按钮点击没反应」:实测命中率只有 2/6,
278
+ 菜单 [8,76,374,42] 正好压在 tabs 行的按钮 80..106 上)。
279
+ · QsffPG:触发按钮在 header 第二行 42..70 ⇒ top 74
280
+ · _1nxmc_(「更多操作」):触发按钮在 tabs 行 80..106 ⇒ top 122 */
281
+ " body.dsh-mobile-ui [class*=QsffPG_menu],body.dsh-mobile-ui [role=menu][class*=_list_1nxmc_]{position:fixed !important;left:8px !important;right:8px !important;width:auto !important;min-width:0 !important;max-width:none !important;max-height:calc(100vh - 150px) !important;overflow:auto !important;top:calc(var(--dsh-mobile-popover-top,74px) + env(safe-area-inset-top,0px)) !important}",
282
+ " body.dsh-mobile-ui [role=menu][class*=_list_1nxmc_]{--dsh-mobile-popover-top:122px}",
277
283
  /* ── 手机端 header 瘦身 + 正文占比(2026-09-14,用户反馈「标题栏三行有点乱 / 正文显得窄」)──
278
284
  实测 390px:header 138px(titleRow 三行)+ 输入区 272px ⇒ 正文只剩 434px(占屏 51%)。
279
285
  三行里第三行是「终端打开 / 选择打开方式 / 更多操作 / 打开右侧边栏」——前两个点了是在
@@ -305,11 +311,11 @@ window.__ModuleLoader__.load({
305
311
  用户可能不知道从哪恢复;提示跟随内容,长会话滚到底才看到,不打扰阅读) */
306
312
  " body.dsh-mobile-ui.dsh-mobile-composer-hidden [class*=scrollBody]::after{content:'输入框已折叠 · 点标签行右侧 ▤ 图标展开';display:block;text-align:center;padding:14px 0 4px;font-size:11px;line-height:1.4;color:var(--dsw-alias-label-caption,rgba(255,255,255,.35))}",
307
313
  /* tabs 行做成「标签靠左 / 工具靠右」 */
308
- " body.dsh-mobile-ui [class*=wSkVaW_tabs]{align-items:center !important}",
309
- " body.dsh-mobile-ui #dsh-mobile-tab-tools{margin-left:auto !important;display:inline-flex !important;align-items:center !important;gap:6px !important;flex:0 0 auto !important}",
310
- " body.dsh-mobile-ui #dsh-mobile-tab-tools button{width:30px !important;height:26px !important;min-width:30px !important;display:inline-flex !important;align-items:center !important;justify-content:center !important;padding:0 !important;border:none !important;border-radius:8px !important;background:transparent !important;color:var(--dsw-alias-label-secondary,rgba(255,255,255,.7)) !important;cursor:pointer !important}",
314
+ " body.dsh-mobile-ui [class*=wSkVaW_tabs]{align-items:center !important;min-height:34px !important}",
315
+ " body.dsh-mobile-ui #dsh-mobile-tab-tools{margin-left:auto !important;display:inline-flex !important;align-items:center !important;gap:8px !important;flex:0 0 auto !important}",
316
+ " body.dsh-mobile-ui #dsh-mobile-tab-tools button{width:36px !important;height:34px !important;min-width:36px !important;display:inline-flex !important;align-items:center !important;justify-content:center !important;padding:0 !important;border:none !important;border-radius:8px !important;background:transparent !important;color:var(--dsw-alias-label-secondary,rgba(255,255,255,.7)) !important;cursor:pointer !important}",
311
317
  " body.dsh-mobile-ui #dsh-mobile-tab-tools button:active{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.08)) !important}",
312
- " body.dsh-mobile-ui #dsh-mobile-tab-tools svg{width:17px !important;height:17px !important;fill:none !important;stroke:currentColor !important;stroke-width:1.8 !important;stroke-linecap:round !important;stroke-linejoin:round !important}",
318
+ " body.dsh-mobile-ui #dsh-mobile-tab-tools svg{width:18px !important;height:18px !important;fill:none !important;stroke:currentColor !important;stroke-width:1.8 !important;stroke-linecap:round !important;stroke-linejoin:round !important}",
313
319
  /* ── 折叠输入区(阅读模式):省下 composerSeat 的 ~272px,全部让给正文 ──
314
320
  触发方式:tabs 行的键盘按钮(状态存 localStorage,刷新后保持)。
315
321
  ⚠️ 提问卡片(ask_user_question)就渲染在 composerSeat 里 ⇒ 折叠状态下若检测到卡片,
@@ -558,10 +564,22 @@ window.__ModuleLoader__.load({
558
564
  more.id = "dsh-mobile-more-proxy";
559
565
  more.setAttribute("aria-label", "更多操作");
560
566
  more.innerHTML = "<svg viewBox='0 0 24 24'><circle cx='5' cy='12' r='1.7'/><circle cx='12' cy='12' r='1.7'/><circle cx='19' cy='12' r='1.7'/></svg>";
567
+ /* ⚠️ 竞态:上游的「点外面就关」监听的是 **pointerdown**(document 冒泡阶段),
568
+ 而我们的转发在 **click**(按钮上)。如果菜单本来开着,一次 tap 会:
569
+ pointerdown → 上游关掉菜单 → click → 我们又叫开
570
+ 净效果「点了没反应」(2026-09-14 用户报「三个点按钮点击没反应」,
571
+ 实测命中率 2/6)。修法:在按钮上的 pointerdown(比 document 早)记下当前是否开着,
572
+ 开着就什么都不做 —— 交给上游关掉,真正的 toggle。 */
573
+ more.addEventListener("pointerdown", function () {
574
+ try {
575
+ more.__menuWasOpen = !!document.querySelector("[role=menu][class*=_list_1nxmc_]");
576
+ } catch (err) { more.__menuWasOpen = false; }
577
+ }, true);
561
578
  more.addEventListener("click", function (e) {
562
579
  try {
563
580
  e.preventDefault();
564
581
  e.stopPropagation();
582
+ if (more.__menuWasOpen) { more.__menuWasOpen = false; return; }
565
583
  var up = document.querySelector("button[class*=nL4_yW_moreButton]");
566
584
  if (up) up.click();
567
585
  } catch (err) { /* 静默 */ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mobile-ui",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Mobile UI for the DeepSeek Harness Web GUI: responsive layout, overlay session drawer, 44px touch targets, safe-area support, reading enhancements (≤768px, zero desktop impact)",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -214,6 +214,27 @@ def run(args) -> int:
214
214
  if back:
215
215
  fails.append("再次点击没能恢复输入区")
216
216
 
217
+ # ③d 工具按钮必须真的能用:⋯ 代理按钮开→关一次就翻状态
218
+ # (曾因「上游 pointerdown 先关 / 我们的 click 又开」的竞态,命中率只有 2/6 ——
219
+ # 用户报「三个点按钮点击没反应」;折叠按钮也曾因 30×26 目标过小被报「不灵敏」)
220
+ menus_js = "() => document.querySelectorAll('[role=menu][class*=_list_1nxmc_]').length"
221
+ mp = page.evaluate("""() => { const b = document.getElementById('dsh-mobile-more-proxy'); if (!b) return null;
222
+ const r = b.getBoundingClientRect(); return [r.x + r.width / 2, r.y + r.height / 2]; }""")
223
+ if mp:
224
+ seq = []
225
+ for _ in range(2):
226
+ page.touchscreen.tap(mp[0], mp[1])
227
+ page.wait_for_timeout(1000)
228
+ seq.append(page.evaluate(menus_js))
229
+ print(f" [⋯ 代理按钮] 开合序列={seq}(期望 [1,0])")
230
+ if seq != [1, 0]:
231
+ fails.append(f"「更多操作」代理按钮不能开合:{seq}(上游 pointerdown 与转发 click 的竞态又回来了?)")
232
+ # 按钮尺寸:触摸目标不得小于 32px(插件规范 44,实测 30×26 时用户报"不灵敏")
233
+ size = page.evaluate("""() => { const b = document.getElementById('dsh-mobile-more-proxy');
234
+ if (!b) return null; const r = b.getBoundingClientRect(); return [Math.round(r.width), Math.round(r.height)]; }""")
235
+ if size and (size[0] < 32 or size[1] < 30):
236
+ fails.append(f"工具按钮触摸目标过小:{size}")
237
+
217
238
  # ④ 菜单行可进入子代理(面包屑应变成两段)
218
239
  page.touchscreen.tap(sw["x"], sw["y"])
219
240
  page.wait_for_timeout(800)