@mrrisega/dsh-remote 0.7.2-beta.1 → 0.7.2

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.
@@ -554,6 +554,67 @@ div.dsh-ma-menu .dsh-ma-load-warn[hidden] { display: none !important; }
554
554
  div.dsh-ma-menu .dsh-ma-load-warn .ico { flex: none; }
555
555
  div.dsh-ma-menu .dsh-ma-load-warn .txt { min-width: 0; overflow-wrap: anywhere; }
556
556
 
557
+ /* ===== 加载疑似卡住时的**可操作**底部提示条(2026-10-17 事故新增) =====
558
+ 事故现场:用户本机 ~/.dsh-remote(bridge 运行时 + 账号配对信息/设备密钥)被误删 → bridge 起不来、
559
+ 手机端镜像页第一次加载**干等 47 秒**才报错;页面上只有悬浮菜单里一行"已等 N 秒…复制给客服",
560
+ 没有任何可点的操作。这里补一条**底部轻量提示条**(不是全屏层、不遮挡主界面):
561
+ · 只在 12 秒看门狗判定 slow 之后才**懒创建**(解析期一个节点都不往页面塞);
562
+ · 只占视口底部一条、高度受限(max-height),浮层外的区域照常可点 → 用户还能继续操作;
563
+ · 三个按钮:重试 / 返回设备列表 / 复制诊断信息,外加 ✕ 关闭;关掉后本页不再弹;
564
+ · 认出官方界面后自动收起(判断错了也不会一直挂着)——失败方向仍然安全:
565
+ 最坏只是底部多一条**可关闭**的提示,而不是"永远盖住整片界面"。
566
+ 动画只在「支持 prefers-reduced-motion 且用户没要求减少动效」时挂上:
567
+ 老浏览器不认识这个媒体查询 → 不匹配 → 无动画(无需用 matchMedia 判断,也不会有兼容异常)。 */
568
+ div.dsh-ma-loadbar {
569
+ position: fixed;
570
+ left: max(10px, env(safe-area-inset-left));
571
+ right: max(10px, env(safe-area-inset-right));
572
+ bottom: calc(10px + env(safe-area-inset-bottom));
573
+ /* 低于 FAB(400) 与菜单(401):提示条不得压住"自救出口"(悬浮按钮永远点得到) */
574
+ z-index: 399;
575
+ display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
576
+ box-sizing: border-box;
577
+ width: auto;
578
+ max-height: min(38vh, 260px);
579
+ overflow-y: auto;
580
+ -webkit-overflow-scrolling: touch;
581
+ padding: 10px 12px;
582
+ border-radius: 12px;
583
+ background: var(--dsw-alias-bg-elevated, #fff);
584
+ border: .5px solid var(--dsw-alias-border-l3, rgba(127,127,127,.3));
585
+ box-shadow: 0 6px 24px rgba(0,0,0,.24);
586
+ color: var(--dsw-alias-label-primary, #111);
587
+ font: 400 13px/1.5 -apple-system, system-ui, sans-serif;
588
+ }
589
+ /* ⚠️ 必须显式写 [hidden]:UA 的 [hidden]{display:none} 会被上面的 display:flex 盖过(本仓踩过)。 */
590
+ div.dsh-ma-loadbar[hidden] { display: none !important; }
591
+ div.dsh-ma-loadbar .dsh-ma-loadbar-txt { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
592
+ div.dsh-ma-loadbar .dsh-ma-loadbar-actions { display: flex; flex-wrap: wrap; gap: 6px; }
593
+ div.dsh-ma-loadbar button {
594
+ flex: none; padding: 8px 12px; border-radius: 9px; cursor: pointer;
595
+ border: .5px solid var(--dsw-alias-border-l3, rgba(127,127,127,.35));
596
+ background: var(--dsw-alias-button-elevated-fill, rgba(127,127,127,.08));
597
+ color: var(--dsw-alias-label-primary, #111);
598
+ font: 600 13px/1 -apple-system, system-ui, sans-serif;
599
+ touch-action: manipulation; -webkit-tap-highlight-color: transparent;
600
+ }
601
+ div.dsh-ma-loadbar button:active { transform: scale(.98); }
602
+ div.dsh-ma-loadbar button.dsh-ma-loadbar-close {
603
+ padding: 6px 9px; border-color: transparent; background: transparent;
604
+ color: var(--dsw-alias-label-tertiary, #6b7280);
605
+ }
606
+ @media (prefers-reduced-motion: no-preference) {
607
+ div.dsh-ma-loadbar { animation: dsh-ma-loadbar-in .18s ease-out; }
608
+ @keyframes dsh-ma-loadbar-in {
609
+ from { opacity: 0; transform: translateY(6px); }
610
+ to { opacity: 1; transform: none; }
611
+ }
612
+ }
613
+ /* 双保险:显式要求减少动效时一律无动画(老浏览器不匹配上面的 no-preference → 天然无动画) */
614
+ @media (prefers-reduced-motion: reduce) {
615
+ div.dsh-ma-loadbar { animation: none !important; transition: none !important; }
616
+ }
617
+
557
618
  /* 会话过期引导条:镜像页在会话过期后只会"连不上",这里给一句能照做的话 + 一个出口。
558
619
  非阻塞(顶部细条),点关闭即消失;不拦截任何请求。 */
559
620
  div.dsh-ma-sessionbar {
@@ -656,21 +717,33 @@ const SCRIPT = `(() => {
656
717
  }
657
718
  })();
658
719
 
659
- /* ===== 「加载疑似没完成」看门狗(2026-09-25,替代被整块删除的首屏提示层)=====
660
- 那个提示层是全屏覆盖 + 启发式退出 —— 判断错一次就把**已经加载完**的界面永久盖住
661
- (用户实测:秒表走到 187 秒,刷新也一样)。所以这里换一条**安全的失败方向**:
720
+ /* ===== 「加载疑似没完成」看门狗(2026-09-25 起;2026-10-17 提速并改成**可操作**提示)=====
721
+ 历史:0.6.14 的首屏提示层是全屏覆盖 + 启发式退出 —— 判断错一次就把**已经加载完**的界面永久盖住
722
+ (用户实测:秒表走到 187 秒,刷新也一样)。所以 0.6.16 换了安全的失败方向:只置 slow 标记,
723
+ 在**已有的**悬浮菜单里多一行字。这个方向本身是对的,但**提示太晚、且没有操作入口**——
724
+ 2026-10-17 真实事故:用户本机 ~/.dsh-remote(运行时 + 账号配对信息/设备密钥)被误删后,
725
+ 手机端镜像页第一次加载**干等 47 秒**才报错,页面上只有一行"已等 N 秒…复制给客服",
726
+ 用户完全不知道该重新安装还是重新登录。
662
727
 
663
- · 解析期**不创建任何 DOM**(只有几个变量 + 一个定时器)—— 页面还没过主机门,
728
+ 现在(2026-10-17):
729
+ · 解析期仍然**不创建任何 DOM**(只有几个变量 + 一个定时器)—— 页面还没过主机门,
664
730
  更不该有任何覆盖层;
665
- · 25 秒后仍认不出官方界面 → 只置一个 slow 标记,**不往页面塞任何东西**;
666
- · 标记生效时,往**已有的**「远程控制」悬浮菜单里多一行字(点一下复制一句话给客服),
667
- 并建议点菜单里本来就有的「返回设备列表」重来;
668
- · 判断错了的代价 = 菜单里多一行字(用户不点开菜单完全看不到);不会再挡住任何人。
669
-
670
- ⚠️ 刻意**不**做成页面顶部/底部的固定细条:那种细条同样会盖住官方 UI 的一部分,
671
- 而且同样有"永不消失"的失败方向。菜单是被动展开的,天然没有这个问题。 */
731
+ · **12 秒**后仍认不出官方界面 → 置 slow + 显示**底部轻量提示条**(懒创建):
732
+ 文案「电脑端可能未连接 / 页面加载较慢」+ 已等待秒数;
733
+ 按钮:重试(location.reload)/ 返回设备列表(/app/)/ 复制诊断信息 / ✕ 关闭;
734
+ · 提示条**不是全屏层**:只占底部一条、高度受限、浮层外照常可点、可关闭,
735
+ 关掉后本页不再弹;认出官方界面后自动收起 —— 失败方向仍然安全;
736
+ · 菜单里那一行字**保留**(被动展开,不打扰,也仍可复制诊断话术)。
737
+
738
+ ⚠️ 12 秒是"开始提示"的阈值,不是"判定失败":限速放开后正常首屏 1~3 秒,
739
+ 12 秒既能及时帮到用户,也不至于刚打开就吓人(宁可晚一点,也别误报)。
740
+ ⚠️ 注入体是模板字符串:本段注释/文案**一律用「」**,不得出现反引号。 */
672
741
  var maLoadWatch = { startedAt: Date.now(), slow: false, wired: false, bound: false, warnEl: null, warnTxt: null,
673
- reported: false, reportMs: 0 };
742
+ reported: false, reportMs: 0,
743
+ // 2026-10-17:底部可操作提示条(barEl = 懒创建的节点;barTimer = 秒数刷新)
744
+ barEl: null, barTxt: null, barTimer: 0, dismissed: false };
745
+ /** 看门狗阈值(毫秒):12 秒仍认不出官方界面就开始提示。测试按常量断言,不要散落魔法数。 */
746
+ var MA_LOAD_WATCH_MS = 12 * 1000;
674
747
  /** 官方界面是否已经可用(只看最强信号;只用于决定"要不要多显示一行字")。 */
675
748
  function maLoadReadyNow() {
676
749
  try {
@@ -718,8 +791,8 @@ const SCRIPT = `(() => {
718
791
  * ② **全程静默**:任何异常都吞掉,失败绝不影响页面,也绝不做重试;
719
792
  * ③ 只在**已有的**同一批请求之外发这一次(一次 POST,几十字节),不是测速、不轮询。
720
793
  * body = { ms, outcome, at }:ms=耗时毫秒(截到 [0,600000],与契约一致);outcome ∈ {ok,slow}
721
- * (slow = 25 秒看门狗兜底,是"删失下限",后台只把 ok 计入 P50/P90);at=事件发生的 epoch ms。
722
- */
794
+ * (slow = 12 秒看门狗兜底,是"删失下限",后台只把 ok 计入 P50/P90);at=事件发生的 epoch ms。
795
+ * ⚠️ 2026-10-17:阈值 25s→12s,**字段与一次语义一律不变**(后台契约不动)。 */
723
796
  function maReportMirrorLoad(outcome) {
724
797
  if (maLoadWatch.reported) return;
725
798
  maLoadWatch.reported = true;
@@ -748,10 +821,140 @@ const SCRIPT = `(() => {
748
821
  try { ua = String((navigator && navigator.userAgent) || "").slice(0, 120); } catch (e) { /* 忽略 */ }
749
822
  return "dsh-remote 手机端加载疑似卡住:等待 " + maLoadWaitedSec() + " 秒后仍未出现对话界面。UA=" + ua;
750
823
  }
824
+
825
+ /* ===== 底部可操作提示条(2026-10-17,见上方看门狗注释)=====
826
+ 纪律:
827
+ · **懒创建**:只有 slow 且用户没关过时才创建节点;
828
+ · **绝不阻塞**:只占底部一条(CSS 限高),浮层外照常可点;按钮动作全部就地完成;
829
+ · **任何异常都吞掉**:提示层坏掉也绝不影响页面(每个入口都有 try/catch);
830
+ · **只提示一次**:用户点 ✕ 后 dismissed=true,本页不再弹(不骚扰)。 */
831
+ /** 提示条主文案:电脑端未连接/加载慢 + 已等待秒数(秒数由 barTimer 每秒刷新)。 */
832
+ function maLoadBarText() {
833
+ return "电脑端可能未连接 / 页面加载较慢(已等待 " + maLoadWaitedSec() + " 秒)";
834
+ }
835
+ /** 收起提示条并停掉秒数刷新(不改变 dismissed:用于"认出界面后自动收起"这类临时收起)。 */
836
+ function maLoadHideBar() {
837
+ try { if (maLoadWatch.barEl) maLoadWatch.barEl.hidden = true; } catch (e) { /* 忽略 */ }
838
+ try {
839
+ if (maLoadWatch.barTimer) { clearInterval(maLoadWatch.barTimer); maLoadWatch.barTimer = 0; }
840
+ } catch (e2) { /* 忽略 */ }
841
+ }
842
+ /** 用户点 ✕:本页不再弹(dismissed 是**本页**语义;刷新页面会重新开始一次提示机会)。 */
843
+ function maLoadDismissBar() {
844
+ try {
845
+ maLoadWatch.dismissed = true;
846
+ maLoadHideBar();
847
+ maLoadRenderWarn(); // 菜单里那一行也一起收起(关闭 = 本页只提示一次)
848
+ } catch (e) { /* 忽略 */ }
849
+ }
850
+ /** 导航(返回设备列表):assign 失败退回 href。 */
851
+ function maLoadGoto(to) {
852
+ try { window.location.assign(to); return; } catch (e) { /* 继续 */ }
853
+ try { window.location.href = to; } catch (e2) { /* 忽略 */ }
854
+ }
855
+ /** 复制诊断信息(沿用 maLoadCopyLine:含 UA 与耗时);剪贴板不可用时把整句显示在提示条上让用户截图。 */
856
+ function maLoadCopyDiag() {
857
+ var line = maLoadCopyLine();
858
+ var show = function (t) {
859
+ try { if (maLoadWatch.barTxt) maLoadWatch.barTxt.textContent = t; } catch (e) { /* 忽略 */ }
860
+ };
861
+ try {
862
+ if (navigator && navigator.clipboard && navigator.clipboard.writeText) {
863
+ var p = navigator.clipboard.writeText(line);
864
+ if (p && typeof p.then === "function") {
865
+ p.then(function () { show("已复制诊断信息(含等待时长与机型),可直接发给客服。"); },
866
+ function () { show(line); });
867
+ return;
868
+ }
869
+ }
870
+ } catch (e) { /* 落到显示 */ }
871
+ show(line);
872
+ }
873
+ /** 懒创建提示条(只在 slow 之后调用;解析期绝不碰 DOM)。 */
874
+ function maLoadMountBar() {
875
+ try {
876
+ if (maLoadWatch.barEl || maLoadWatch.dismissed) return maLoadWatch.barEl;
877
+ var body = document.body || document.documentElement;
878
+ if (!body || !body.appendChild) return null;
879
+ var bar = document.createElement("div");
880
+ bar.className = "dsh-ma-loadbar";
881
+ /* role=status + aria-live=polite:读屏软件会把"加载较慢"念出来,但不会抢焦点;
882
+ 它**不是** dialog/alert,不抢键盘、不锁滚动。 */
883
+ bar.setAttribute("role", "status");
884
+ bar.setAttribute("aria-live", "polite");
885
+ bar.innerHTML =
886
+ '<div class="dsh-ma-loadbar-txt" data-role="loadbar-txt"></div>' +
887
+ '<div class="dsh-ma-loadbar-actions">' +
888
+ '<button type="button" class="dsh-ma-loadbar-btn" data-role="loadbar-retry">重试</button>' +
889
+ '<button type="button" class="dsh-ma-loadbar-btn" data-role="loadbar-back">返回设备列表</button>' +
890
+ '<button type="button" class="dsh-ma-loadbar-btn" data-role="loadbar-copy">复制诊断信息</button>' +
891
+ '</div>' +
892
+ '<button type="button" class="dsh-ma-loadbar-close" data-role="loadbar-close" aria-label="关闭提示">✕</button>';
893
+ bar.hidden = true;
894
+ maLoadWatch.barEl = bar;
895
+ maLoadWatch.barTxt = bar.querySelector('[data-role="loadbar-txt"]');
896
+ bar.addEventListener("click", function (ev) {
897
+ // 事件委托:真实浏览器里目标可能是按钮内的文字节点;从 target 往上找到 [data-role]
898
+ try {
899
+ if (ev && typeof ev.preventDefault === "function") ev.preventDefault();
900
+ } catch (e0) { /* 忽略 */ }
901
+ try {
902
+ var t = ev && ev.target ? ev.target : null;
903
+ var role = "";
904
+ var guard = 0;
905
+ while (t && t !== bar && guard < 16 && !role) {
906
+ guard += 1;
907
+ try {
908
+ if (t.getAttribute) role = String(t.getAttribute("data-role") || "");
909
+ } catch (e1) { role = ""; }
910
+ t = t.parentNode || null;
911
+ }
912
+ if (role === "loadbar-retry") {
913
+ try { window.location.reload(); } catch (e2) { /* 忽略 */ }
914
+ } else if (role === "loadbar-back") {
915
+ maLoadGoto("/app/"); // 绝对路径:镜像页当前路径可能是 /remote/<deviceId>/…
916
+ } else if (role === "loadbar-copy") {
917
+ maLoadCopyDiag();
918
+ } else if (role === "loadbar-close") {
919
+ maLoadDismissBar();
920
+ }
921
+ } catch (e3) { /* 提示条失败绝不影响页面 */ }
922
+ });
923
+ body.appendChild(bar);
924
+ return bar;
925
+ } catch (e) { return null; }
926
+ }
927
+ /** 按当前状态渲染提示条(slow + 未关闭 → 显示;否则收起)。 */
928
+ function maLoadRenderBar() {
929
+ try {
930
+ if (!maLoadWatch.slow || maLoadWatch.dismissed) { maLoadHideBar(); return; }
931
+ var bar = maLoadWatch.barEl || maLoadMountBar();
932
+ if (!bar) return;
933
+ if (maLoadWatch.barTxt) maLoadWatch.barTxt.textContent = maLoadBarText();
934
+ bar.hidden = false;
935
+ if (!maLoadWatch.barTimer) {
936
+ // 每秒刷新「已等待 N 秒」;同时复核"是不是其实早就好了"——好了就自动收起(不长期挂着)。
937
+ maLoadWatch.barTimer = setInterval(function () {
938
+ try {
939
+ if (!maLoadWatch.slow || maLoadWatch.dismissed) { maLoadHideBar(); return; }
940
+ if (maLoadReadyNow()) {
941
+ maLoadWatch.slow = false;
942
+ maLoadHideBar();
943
+ maLoadRenderWarn(); // 菜单那一行也一起收起
944
+ return;
945
+ }
946
+ if (maLoadWatch.barTxt) maLoadWatch.barTxt.textContent = maLoadBarText();
947
+ } catch (e) { /* 忽略 */ }
948
+ }, 1000);
949
+ try { if (maLoadWatch.barTimer && maLoadWatch.barTimer.unref) maLoadWatch.barTimer.unref(); } catch (e2) { /* 忽略 */ }
950
+ }
951
+ } catch (e) { /* 提示条失败绝不影响页面 */ }
952
+ }
751
953
  function maLoadRenderWarn() {
752
954
  try {
753
955
  if (!maLoadWatch.warnEl) return;
754
- if (!maLoadWatch.slow) { maLoadWatch.warnEl.hidden = true; return; }
956
+ // 用户点过 ✕ = 本页不想再被这事打扰:菜单里那一行也一起收起("只提示一次")
957
+ if (!maLoadWatch.slow || maLoadWatch.dismissed) { maLoadWatch.warnEl.hidden = true; return; }
755
958
  if (maLoadWatch.warnTxt) {
756
959
  maLoadWatch.warnTxt.textContent = "本次页面可能没加载完整(已等 " + maLoadWaitedSec()
757
960
  + " 秒)。点这里复制一句话发给客服,或点下方「返回设备列表」重来。";
@@ -785,18 +988,18 @@ const SCRIPT = `(() => {
785
988
  }
786
989
  } catch (e) { /* 忽略 */ }
787
990
  }
788
- // 25 秒后仍认不出官方界面 → 置慢标记(**只改状态,不碰 DOM**)。
789
- // 阈值取得很宽松:宁可漏报(什么都不显示,与今天一致),也不要误报吓人。
790
- // 同一处顺手把 mirror_load 的**兜底样本**发出去(outcome="slow"):25 秒没就绪的页面上报的
791
- // 必然是"≥25 秒",这是**删失下限**而不是真实耗时,后台只把它单列,不混进 P50/P90。
991
+ // 12 秒后仍认不出官方界面 → 置慢标记 + 懒创建底部提示条(**只在这时才碰 DOM**)。
992
+ // 同一处顺手把 mirror_load 的**兜底样本**发出去(outcome="slow"):12 秒没就绪的页面上报的
993
+ // 必然是"≥12 秒",这是**删失下限**而不是真实耗时,后台只把它单列,不混进 P50/P90。
792
994
  setTimeout(function () {
793
995
  try {
794
996
  if (maLoadReadyNow()) return;
795
997
  maLoadWatch.slow = true;
796
998
  if (maLoadWatch.wired) maLoadRenderWarn();
999
+ maLoadRenderBar(); // 底部可操作提示条(重试 / 返回设备列表 / 复制诊断 / 关闭)
797
1000
  maReportMirrorLoad("slow");
798
1001
  } catch (e) { /* 忽略 */ }
799
- }, 25 * 1000);
1002
+ }, MA_LOAD_WATCH_MS);
800
1003
 
801
1004
  try {
802
1005
  const HOST_RE = new RegExp(${JSON.stringify(RUNTIME_HOST_RE.source)});
@@ -2511,13 +2714,24 @@ const SCRIPT = `(() => {
2511
2714
  maObserver = null;
2512
2715
  try { if (maInterval) clearInterval(maInterval); } catch (eD2) { /* 忽略 */ }
2513
2716
  maInterval = 0;
2717
+ // 加载提示条的秒数刷新也一起停掉(页面卸载/进 bfcache 后不留悬挂回调)
2718
+ try { if (maLoadWatch.barTimer) { clearInterval(maLoadWatch.barTimer); maLoadWatch.barTimer = 0; } } catch (eD3) { /* 忽略 */ }
2514
2719
  };
2515
2720
  try { window.addEventListener("pagehide", maTeardown); } catch (ePh) { /* 忽略 */ }
2516
2721
  try { window.addEventListener("unload", maTeardown); } catch (eUl) { /* 忽略 */ }
2517
2722
  /* 手机上"切到别的 App 再切回来"走的常是 bfcache:pagehide(persisted=true) → pageshow(persisted=true)。
2518
- DOM 原样保留但计时器/观察者已断 —— 这里重新武装,否则回到页面后看门狗就永久失灵了。 */
2723
+ DOM 原样保留但计时器/观察者已断 —— 这里重新武装,否则回到页面后看门狗就永久失灵了。
2724
+ 2026-10-17:加载提示条的秒数刷新也在 maTeardown 里停了,回到前台要按现状重新挂上
2725
+ (否则用户切回来看的是"冻结的已等待 N 秒")。 */
2519
2726
  try {
2520
- window.addEventListener("pageshow", (ev) => { try { if (ev && ev.persisted) maArm(); } catch (ePs) { /* 忽略 */ } });
2727
+ window.addEventListener("pageshow", (ev) => {
2728
+ try {
2729
+ if (ev && ev.persisted) {
2730
+ maArm();
2731
+ if (maLoadWatch.slow && !maLoadWatch.dismissed) maLoadRenderBar();
2732
+ }
2733
+ } catch (ePs) { /* 忽略 */ }
2734
+ });
2521
2735
  } catch (ePs2) { /* 忽略 */ }
2522
2736
  } catch (e) { if (window.console) console.warn("[dsh-mobile-adapter]", e && e.message); }
2523
2737
  })();`;
@@ -941,27 +941,45 @@ test("★ 护栏:解析期绝不许往页面塞东西(0.6.14 首屏提示层
941
941
  assert.ok(!/dsh-ma-boot/.test(css), "首屏提示层的样式必须已彻底删除");
942
942
  });
943
943
 
944
- test("★ 加载疑似失败时的提示:只在**已有的悬浮菜单**里多一行(不新增层、解析期不碰 DOM)", () => {
945
- // 替代被删除的首屏提示层:同样的需求(让用户知道"没加载完、该怎么办"),
946
- // 但换成安全的失败方向 —— 判断错了最多是菜单里多一行字,不会挡住任何人。
944
+ test("★ 加载疑似失败时的提示:菜单里一行 + **底部可操作提示条**(不是全屏层、解析期不碰 DOM)", () => {
945
+ // 2026-09-25:替代被删除的首屏提示层 —— 换成安全方向。
946
+ // 2026-10-17(真实事故:~/.dsh-remote 被误删 → 镜像页干等 47 秒且无操作入口):
947
+ // · 阈值 25s → 12s(25 秒提示太晚);
948
+ // · 新增底部**可操作**提示条(重试 / 返回设备列表 / 复制诊断信息 / ✕),但它的形态必须仍然是
949
+ // "轻量、可关闭、不遮挡主界面" —— 绝不能退回全屏覆盖层。
950
+ // 具体按钮行为与"关闭后不再弹"见 test/mobile-adapter-load-watch.test.mjs(那里跑真实脚本)。
947
951
  const { js: script, css } = injected();
948
952
  const gate = script.indexOf("/* —— 主机门解除");
949
953
  const preGate = script.slice(script.indexOf('"use strict";'), gate);
950
- assert.ok(!/appendChild/.test(preGate), "解析期仍不得 appendChild(看门狗只置状态)");
954
+ assert.ok(!/appendChild/.test(preGate), "解析期仍不得 appendChild(看门狗只置状态/懒创建提示条)");
951
955
 
952
956
  // 提示必须挂在菜单里(菜单是被动展开的 → 天然不会覆盖界面)
953
957
  assert.match(script, /dsh-ma-menu[\s\S]{0,600}?data-role="load-warn"/, "提示行必须放在悬浮菜单的 HTML 里");
954
958
  assert.match(css, /div\.dsh-ma-menu \.dsh-ma-load-warn/, "样式必须限定在菜单内(不得是 body 级固定层)");
955
959
  assert.ok(!/\.dsh-ma-load-warn\s*\{[^}]*position:\s*(fixed|absolute)/.test(css),
956
- "提示行不得用 fixed/absolute 定位(那就又变成覆盖层了)");
957
- assert.ok(!/\.dsh-ma-load-warn\s*\{[^}]*z-index/.test(css), "提示行不得有 z-index(压层)");
958
-
959
- // 阈值要宽松:宁可漏报,不可吓人
960
- assert.match(script, /if \(maLoadReadyNow\(\)\) return;/, "认出官方界面就不该报警");
961
- assert.match(script, /\}, 25 \* 1000\);/, "看门狗阈值应为 25 秒(宽松)");
960
+ "菜单里的提示行不得用 fixed/absolute 定位");
961
+ assert.ok(!/\.dsh-ma-load-warn\s*\{[^}]*z-index/.test(css), "菜单里的提示行不得有 z-index(压层)");
962
+
963
+ // 阈值 12 秒:25 秒太晚(用户实测干等 47 秒才看到任何东西)
964
+ assert.match(script, /if \(maLoadReadyNow\(\)\) return;/, "认出官方界面就不该提示");
965
+ assert.match(script, /var MA_LOAD_WATCH_MS = 12 \* 1000;/, "看门狗阈值常量应为 12 秒");
966
+ assert.match(script, /\}, MA_LOAD_WATCH_MS\);/, "setTimeout 必须用该常量");
967
+ assert.ok(!/25 \* 1000/.test(script), "不得残留 25 秒阈值");
962
968
  // 一句话要能直接发给客服
963
969
  assert.match(script, /dsh-remote 手机端加载疑似卡住/, "必须给一句可直接发给客服的话");
964
970
  assert.match(script, /maLoadCopyLine/, "要能复制(否则用户只能截图)");
971
+
972
+ // 底部提示条:**不是全屏层**(这是 0.6.14 永久盖住 UI 那个事故的直接教训)
973
+ const barRule = /div\.dsh-ma-loadbar\s*\{([\s\S]*?)\}/.exec(css);
974
+ assert.ok(barRule, "应有底部提示条样式");
975
+ assert.ok(!/inset:\s*0/.test(barRule[1]), "提示条不得是全屏层(inset:0)");
976
+ assert.ok(!/top:\s*0(px)?;/.test(barRule[1]), "提示条不得同时钉 top:0(那就是全屏覆盖)");
977
+ assert.match(barRule[1], /max-height:/, "提示条必须限高(不遮挡主界面)");
978
+ assert.match(barRule[1], /bottom:\s*calc\(/, "提示条应贴底部");
979
+ assert.ok(!/z-index:\s*\d{7,}/.test(css), "不得出现百万级 z-index");
980
+ // 关闭后不再弹:脚本里必须有 dismissed 闸门,且 ✕ 走它
981
+ assert.match(script, /dismissed:\s*false/, "提示条必须有「本页不再弹」的状态位");
982
+ assert.match(script, /maLoadDismissBar\(\)/, "✕ 关闭必须走 maLoadDismissBar");
965
983
  });
966
984
 
967
985
  // ══════════════════════════════════════════════════════════════════════════════
@@ -1100,7 +1118,9 @@ test("护栏:延迟角标必须是 FAB 内的子元素(不得新增 body 级
1100
1118
  // 它不是适配层注入的。原来的写法拿"白名单命中数 === body.children.length"去比,
1101
1119
  // 等于要求官方 frame 也得命中白名单 → 恒差 1(假红)。现在改成**指名道姓找漏网节点**,
1102
1120
  // 既排除了官方 frame,又比原来更严:多出来的节点会被打印出来。
1103
- const allowed = ["dsh-ma-fab", "dsh-ma-menu", "dsh-ma-scrim", "dsh-ma-hamburger", "dsh-ma-sessionbar"];
1121
+ // ⚠️ 白名单:dsh-ma-loadbar 是 2026-10-17 新增的「加载慢」底部可操作提示条(懒创建、
1122
+ // 限高、可关闭,不是全屏层;具体形态契约见 test/mobile-adapter-load-watch.test.mjs)。
1123
+ const allowed = ["dsh-ma-fab", "dsh-ma-menu", "dsh-ma-scrim", "dsh-ma-hamburger", "dsh-ma-sessionbar", "dsh-ma-loadbar"];
1104
1124
  const stray = env.body.children
1105
1125
  .filter((c) => !c._cls.has("pI_x6G_frame")) // 官方 frame 不是我们注入的
1106
1126
  .filter((c) => !allowed.some((k) => c._cls.has(k)));