dsh-mpkg-wallpaper 3.15.8 → 3.15.9

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.
Files changed (2) hide show
  1. package/lib/client.js +64 -7
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -24926,6 +24926,19 @@ body[data-mpw-modal] [role="dialog"] {
24926
24926
  try {
24927
24927
  let n = 0;
24928
24928
  for (const rec of (records || [])) {
24929
+ /* ②(2026-10-05 真机仍见白帧的根因) 弹层大多是**先插入(隐藏)→ 再靠 class/style 显形**:
24930
+ 只认 addedNodes 时,元素插入那一刻还是 display:none(判定不出"浮层面积",也看不见),
24931
+ 等它显形时走的是 **attributes 突变**,而旧观察器只监听 childList ⇒ 显形那一帧没人管,
24932
+ 用户看到的就是宿主自己的不透明白底。现在把属性突变也接进同步快路(MutationObserver
24933
+ 回调是微任务,跑在**渲染之前** ⇒ 显形的那一帧就已经带上我们的表面)。 */
24934
+ if (rec.type === "attributes") {
24935
+ const t = rec.target;
24936
+ if (!t || t.nodeType !== 1) continue;
24937
+ let hit = false;
24938
+ try { hit = t.matches && t.matches(MPW_POP_TAG_SEL) } catch (e) {}
24939
+ if (hit) { if (mpwTagOnePopover(t)) n++; }
24940
+ continue;
24941
+ }
24929
24942
  for (const node of (rec.addedNodes || [])) {
24930
24943
  if (!node || node.nodeType !== 1) continue;
24931
24944
  const cands = [];
@@ -24937,7 +24950,7 @@ body[data-mpw-modal] [role="dialog"] {
24937
24950
  }
24938
24951
  }
24939
24952
  try { mpwSideLiftSync(); } catch (e) {}
24940
- if (n) { try { mpwPopUntruncSync(); } catch (e) {} }
24953
+ try { mpwPopUntruncSync(); } catch (e) {}
24941
24954
  return n;
24942
24955
  } catch (e) { return 0 }
24943
24956
  }
@@ -24948,11 +24961,15 @@ body[data-mpw-modal] [role="dialog"] {
24948
24961
  const cls = (typeof el.className === "string") ? el.className : "";
24949
24962
  if (!MPW_POP_TAG_NOT.test(cls)) {
24950
24963
  const cs = getComputedStyle(el);
24951
- if (cs && cs.display !== "none" && cs.visibility !== "hidden"
24952
- && /blur\(/.test(String(cs.backdropFilter || cs.webkitBackdropFilter || ""))) {
24964
+ const blurred = !!(cs && /blur\(/.test(String(cs.backdropFilter || cs.webkitBackdropFilter || "")));
24965
+ if (blurred) {
24953
24966
  const a = mpwColorAlpha(cs.backgroundColor);
24967
+ /* ②(2026-10-05) 两类分开判:
24968
+ · 宿主**没有底**(α<0.05)的弹层:**不要求此刻可见** —— 隐藏时打标无害,
24969
+ 等它显形时表面已经在位(这正是"先插入后显形"那条路的白帧来源);
24970
+ · 宿主画了**不透明底**的小浮层:必须量得到面积(隐藏时 rect=0 ⇒ 留给下一次触发)。 */
24954
24971
  if (a < 0.05) need = !mpwPopHasPaintedAncestor(el);
24955
- else if (a >= 0.999) need = mpwPopIsFloating(el);
24972
+ else if (a >= 0.999 && cs.display !== "none" && cs.visibility !== "hidden") need = mpwPopIsFloating(el);
24956
24973
  }
24957
24974
  }
24958
24975
  } catch (e) { need = false; }
@@ -25016,6 +25033,9 @@ body[data-mpw-modal] [role="dialog"] {
25016
25033
  }
25017
25034
  if (kept) continue;
25018
25035
  let blockedByGlass = false;
25036
+ /* ②(2026-10-05 审查建议) 只在弹层**真的压在这个祖先上面**(矩形相交)时才考虑摘:
25037
+ 菜单飘在屏幕另一头时摘它纯属白丢磨砂,还平白制造一次重绘。 */
25038
+ const ownRect = (() => { try { return el.getBoundingClientRect() } catch (e) { return null } })();
25019
25039
  for (let p = el.parentElement, n = 0; p && p !== document.body && p !== document.documentElement && n < 12; p = p.parentElement, n++) {
25020
25040
  let acs = null;
25021
25041
  try { acs = getComputedStyle(p) } catch (e) { break }
@@ -25031,9 +25051,26 @@ body[data-mpw-modal] [role="dialog"] {
25031
25051
  而输入框卡片 `uV2eYG_card`(有底、有 blur,但**不是**弹层表面)只是"碰巧挡在
25032
25052
  弹层前面的包装" ⇒ 摘掉它的 blur 换来弹层真模糊,代价是"菜单打开期间它自己不糊"。
25033
25053
  真机读数支持这条:四个弹层里只有 body 下的模型选择器有模糊,另三个全被卡片截断。 */
25054
+ try {
25055
+ if (ownRect && ownRect.width > 0 && ownRect.height > 0) {
25056
+ const pr = p.getBoundingClientRect();
25057
+ const overlap = pr.width > 0 && pr.height > 0
25058
+ && ownRect.left < pr.right && ownRect.right > pr.left
25059
+ && ownRect.top < pr.bottom && ownRect.bottom > pr.top;
25060
+ if (!overlap) continue; // 没压住它 ⇒ 不动它的 blur
25061
+ }
25062
+ } catch (e) { /* 量不到就按"压住"处理(保守:保功能) */ }
25034
25063
  let ancestorIsSurface = false;
25035
25064
  try { ancestorIsSurface = p.matches(MPW_POP_TAG_SEL) } catch (e) {}
25036
- if (mpwColorAlpha(acs.backgroundColor) >= 0.05 && ancestorIsSurface) { blockedByGlass = true; break }
25065
+ if (ancestorIsSurface) { blockedByGlass = true; break }
25066
+ /* ②(2026-10-05 审查后收紧) **只摘"已知包装容器"的 blur**:真机定案的截断者只有一类 ——
25067
+ 输入框卡片这类"碰巧挡在弹层前面的包装"(类名含 `_card` / `composer` / `overlayAnchor`)。
25068
+ 其余任何带 blur 的祖先(标题栏里的子代理展开框、后台任务面板、别的宿主面板)**一律不碰**:
25069
+ 它们是用户**正在看**的玻璃,摘掉就是"效果没了"(真机已因此报过一次)。
25070
+ 代价:包在未知面板里的弹层保持"半透明无模糊"——这是**保守但不会破坏用户看得见的东西**的一侧。 */
25071
+ let strippableWrap = false;
25072
+ try { strippableWrap = /(_card|composer|overlayAnchor|_seat|_stack)/i.test(String(p.className || "")) } catch (e) {}
25073
+ if (!strippableWrap) { blockedByGlass = true; break }
25037
25074
  targets.add(p);
25038
25075
  break;
25039
25076
  }
@@ -25047,7 +25084,26 @@ body[data-mpw-modal] [role="dialog"] {
25047
25084
  for (let i = 0; i < staleT.length; i++) { const el = staleT[i]; if (!truncated.has(el)) { try { el.removeAttribute("data-mpw-pop-trunc") } catch (e) {} } }
25048
25085
  for (const el of truncated) { if (!el.hasAttribute("data-mpw-pop-trunc")) { try { el.setAttribute("data-mpw-pop-trunc", "") } catch (e) {} } }
25049
25086
  if (targets.size) mpwPopUntruncStyle();
25050
- else if (popUntruncStyleEl && popUntruncStyleEl.parentElement) { try { popUntruncStyleEl.remove() } catch (e) {} popUntruncStyleEl = null; }
25087
+ else if (popUntruncStyleEl && popUntruncStyleEl.parentElement) {
25088
+ /* ②(2026-10-05 审查建议) 撤除也要**瞬时**:宿主若给这些元素写了 transition,
25089
+ 直接撤规则会反向播一次"清晰→磨砂"的可感知跳变。先注入一条"禁过渡 + 保持 none",
25090
+ 下一帧再真正撤掉。 */
25091
+ try {
25092
+ const kill = document.createElement("style");
25093
+ kill.setAttribute("data-plugin", "dsh-mpkg-wallpaper");
25094
+ kill.setAttribute("data-mpw-pop-untrunc-kill", "");
25095
+ kill.textContent = "[data-mpw-pop-untrunc]{transition:none !important;backdrop-filter:none !important;-webkit-backdrop-filter:none !important}";
25096
+ (document.head || document.documentElement).appendChild(kill);
25097
+ setTimeout(() => {
25098
+ try { kill.remove() } catch (e) {}
25099
+ try { if (popUntruncStyleEl && popUntruncStyleEl.parentElement) popUntruncStyleEl.remove() } catch (e) {}
25100
+ popUntruncStyleEl = null;
25101
+ }, 0);
25102
+ } catch (e) {
25103
+ try { popUntruncStyleEl.remove() } catch (e2) {}
25104
+ popUntruncStyleEl = null;
25105
+ }
25106
+ }
25051
25107
  return targets.size + truncated.size * 1000; // 千位段 = 被"有底玻璃祖先"挡住、改为实底的弹层数
25052
25108
  } catch (e) { return 0 }
25053
25109
  }
@@ -25056,6 +25112,7 @@ body[data-mpw-modal] [role="dialog"] {
25056
25112
  globalThis.__mpwPopUntruncTest = {
25057
25113
  sync: () => mpwPopUntruncSync(),
25058
25114
  stylePresent: () => !!(popUntruncStyleEl && popUntruncStyleEl.parentElement),
25115
+ killPresent: () => !!document.querySelector("[data-mpw-pop-untrunc-kill]"),
25059
25116
  };
25060
25117
  } catch (e) {}
25061
25118
 
@@ -25107,7 +25164,7 @@ body[data-mpw-modal] [role="dialog"] {
25107
25164
  try { praf = (typeof requestAnimationFrame === "function") ? requestAnimationFrame(prun) : setTimeout(prun, 16); }
25108
25165
  catch (e) { prun(); }
25109
25166
  });
25110
- popTagWatch.observe(document.body, { childList: true, subtree: true });
25167
+ popTagWatch.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ["class", "style", "data-state", "aria-expanded", "hidden"] });
25111
25168
  } catch { popTagWatch = null; }
25112
25169
  mpwTagPopoverBg();
25113
25170
  try { mpwPopUntruncSync(); } catch (e) {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mpkg-wallpaper",
3
- "version": "3.15.8",
3
+ "version": "3.15.9",
4
4
  "description": "DSH Web 壁纸引擎 Wallpaper Engine mpkg 背景插件:浏览器内直接解析 .mpkg(preview.gif 动态背景/内嵌 mp4 视频/多时段切换),整屏统一虚化/对话框/弹层/遮罩独立虚化、镜头缩放平移、时钟、冲突检测。",
5
5
  "private": false,
6
6
  "type": "module",