dsh-mpkg-wallpaper 3.16.0 → 3.16.1
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 +88 -108
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -18135,6 +18135,9 @@ html body [data-mpw-pop-bg] { background-color: var(--mpw-pop-surface) !importan
|
|
|
18135
18135
|
与其"半透明却没模糊"(真机被读成"只有白色滤镜"),不如**做实在**——表面不透明度抬到 88%,
|
|
18136
18136
|
并把 backdrop-filter 撤掉(白算一遍)。注意:只动我们自己的标记属性,宿主元素一个都不碰。 */
|
|
18137
18137
|
html body [data-mpw-pop-trunc] { background-color: color-mix(in srgb, var(--dsw-specific-sidebar-fill) 88%, transparent) !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
|
|
18138
|
+
/* ②(2026-10-05) 处在包装容器里的弹层:玻璃由**根级模糊层**提供(见 lib 里的 mpwPopGlassApply),
|
|
18139
|
+
弹层自己保持半透明表面、不再白算一次 backdrop-filter(它那层的 root 被祖先截断,算了也看不见)。 */
|
|
18140
|
+
html body [data-mpw-pop-glass] { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
|
|
18138
18141
|
html body[data-ds-dark-theme] [data-mpw-pop-bg] { background-color: var(--mpw-pop-surface-dark) !important; }
|
|
18139
18142
|
[role="menu"] [class*="card"],
|
|
18140
18143
|
[role="tooltip"] [class*="card"] {
|
|
@@ -24824,6 +24827,9 @@ body[data-mpw-modal] [role="dialog"] {
|
|
|
24824
24827
|
} catch { sblurObserver = null; }
|
|
24825
24828
|
// 窗口尺寸变化会让"近全屏"阈值与面板 rect 都变(父对话的真机判据就带视口切换)⇒ 一并重算
|
|
24826
24829
|
try { window.addEventListener("resize", recheck); } catch {}
|
|
24830
|
+
/* ②(2026-10-05) 根级模糊层是 fixed 定位、按弹层 rect 对齐的 ⇒ 滚动/缩放时必须重贴 */
|
|
24831
|
+
try { window.addEventListener("scroll", () => { try { mpwPopGlassApply() } catch (e) {} }, true); } catch {}
|
|
24832
|
+
try { window.addEventListener("resize", () => { try { mpwPopGlassApply() } catch (e) {} }); } catch {}
|
|
24827
24833
|
check();
|
|
24828
24834
|
}
|
|
24829
24835
|
|
|
@@ -25008,133 +25014,106 @@ body[data-mpw-modal] [role="dialog"] {
|
|
|
25008
25014
|
(`[data-mpw-pop-untrunc] { backdrop-filter: none !important; }`)——只在弹层开着期间生效,
|
|
25009
25015
|
弹层关闭(无已标记表面)即摘属性、撤规则元素,宿主逐字还原。代价:属性表 + 一次
|
|
25010
25016
|
querySelectorAll,挂在 prun(已 rAF 合并 + mpwHeavyGate 闸门)里,不开新观察器。 */
|
|
25011
|
-
|
|
25012
|
-
|
|
25013
|
-
|
|
25014
|
-
|
|
25015
|
-
|
|
25016
|
-
|
|
25017
|
-
|
|
25018
|
-
|
|
25019
|
-
|
|
25020
|
-
|
|
25017
|
+
/* ②(2026-10-05 设计收口) 三类弹层,三条路(宿主元素一个都不碰):
|
|
25018
|
+
A. 没有模糊祖先(典型:挂在 body 下的模型/推理选择器)⇒ 我们自己的 58% 表面 + 自己的 blur;
|
|
25019
|
+
B. 祖先里有模糊、且那个祖先是**已知包装容器**(输入框卡片一类)⇒ 弹层打 `data-mpw-pop-glass`,
|
|
25020
|
+
由 `mpwPopGlassApply()` 在**根级**垫一层对齐矩形的模糊层(backdrop root = 整页),
|
|
25021
|
+
包装容器照旧保留自己的磨砂 —— 用户明确要求"弹层要模糊、输入框的模糊也不能没";
|
|
25022
|
+
C. 祖先里有模糊、但那不是包装容器(用户正在看的面板,例如子代理展开框)⇒ 什么都不摘,
|
|
25023
|
+
给弹层打 `data-mpw-pop-trunc`(88% 实底):糊不到页面背后,就不假装是玻璃。 */
|
|
25024
|
+
/* ②(2026-10-05) 「根级模糊层」:给"处在包装容器里、自己的 backdrop 被截断"的弹层垫一层
|
|
25025
|
+
挂在 body 下的模糊层(backdrop root = 整页),位置/圆角跟着弹层走。宿主元素一个都不碰。 */
|
|
25026
|
+
const popGlassLayers = new WeakMap();
|
|
25027
|
+
const popGlassNodes = new Set(); // 需要清理(弹层已卸载/已摘标记)时按它遍历
|
|
25028
|
+
function mpwPopGlassApply() {
|
|
25029
|
+
try {
|
|
25030
|
+
const blur = (() => { try { return getComputedStyle(document.body).getPropertyValue("--mpw-pop-blur").trim() || "blur(11px)" } catch (e) { return "blur(11px)" } })();
|
|
25031
|
+
for (const el of Array.from(document.querySelectorAll("[data-mpw-pop-glass]"))) {
|
|
25032
|
+
let layer = popGlassLayers.get(el) || null;
|
|
25033
|
+
if (!layer || !layer.isConnected) {
|
|
25034
|
+
layer = document.createElement("div");
|
|
25035
|
+
layer.setAttribute("data-plugin", "dsh-mpkg-wallpaper");
|
|
25036
|
+
layer.setAttribute("data-mpw-pop-glass-layer", "");
|
|
25037
|
+
layer.style.cssText = "position:fixed;pointer-events:none;z-index:4;border-radius:12px;";
|
|
25038
|
+
(document.body || document.documentElement).appendChild(layer);
|
|
25039
|
+
popGlassLayers.set(el, layer);
|
|
25040
|
+
popGlassNodes.add(el);
|
|
25041
|
+
}
|
|
25042
|
+
const r = el.getBoundingClientRect();
|
|
25043
|
+
let radius = "12px";
|
|
25044
|
+
try { const cs = getComputedStyle(el); if (cs.borderTopLeftRadius && cs.borderTopLeftRadius !== "0px") radius = cs.borderTopLeftRadius } catch (e) {}
|
|
25045
|
+
if (r.width < 2 || r.height < 2) { layer.style.display = "none"; continue }
|
|
25046
|
+
layer.style.display = "block";
|
|
25047
|
+
layer.style.left = Math.round(r.left) + "px";
|
|
25048
|
+
layer.style.top = Math.round(r.top) + "px";
|
|
25049
|
+
layer.style.width = Math.round(r.width) + "px";
|
|
25050
|
+
layer.style.height = Math.round(r.height) + "px";
|
|
25051
|
+
layer.style.borderRadius = radius;
|
|
25052
|
+
layer.style.backdropFilter = blur;
|
|
25053
|
+
layer.style.webkitBackdropFilter = blur;
|
|
25054
|
+
}
|
|
25055
|
+
/* ②(2026-10-05) 清理要按**层自己**的账走:弹层正常关闭时元素会被 React 从 DOM 摘掉,
|
|
25056
|
+
那时 `[data-mpw-pop-bg]` 已经查不到它 —— 只按查询清理会**留层泄漏**(真机上会累积一堆
|
|
25057
|
+
隐形 fixed 层)。所以:surface 已断开 / 已不是 glass / 已摘标记 ⇒ 撤层。 */
|
|
25058
|
+
for (const el of Array.from(popGlassNodes)) {
|
|
25059
|
+
const layer = popGlassLayers.get(el);
|
|
25060
|
+
const alive = el.isConnected !== false && el.hasAttribute && el.hasAttribute("data-mpw-pop-glass") && el.hasAttribute("data-mpw-pop-bg");
|
|
25061
|
+
if (alive) continue;
|
|
25062
|
+
if (layer && layer.parentElement) { try { layer.remove() } catch (e) {} }
|
|
25063
|
+
popGlassLayers.delete(el);
|
|
25064
|
+
popGlassNodes.delete(el);
|
|
25065
|
+
}
|
|
25066
|
+
} catch (e) {}
|
|
25021
25067
|
}
|
|
25022
|
-
|
|
25068
|
+
/* 判据出口(tools/popover-glass-test.mjs 直接用) */
|
|
25069
|
+
try {
|
|
25070
|
+
globalThis.__mpwPopUntruncTest = {
|
|
25071
|
+
sync: () => mpwPopClassifySync(),
|
|
25072
|
+
/* 用 body 的子节点数(根级层就挂在 body 下)——比属性选择器更稳,桩/真机都对 */
|
|
25073
|
+
glassCount: () => Array.from(((document.body || document.documentElement).children) || []).filter((e) => e && e.hasAttribute && e.hasAttribute("data-mpw-pop-glass-layer")).length,
|
|
25074
|
+
truncCount: () => document.querySelectorAll("[data-mpw-pop-trunc]").length,
|
|
25075
|
+
};
|
|
25076
|
+
} catch (e) {}
|
|
25077
|
+
|
|
25078
|
+
function mpwPopClassifySync() {
|
|
25023
25079
|
try {
|
|
25024
25080
|
const surfaces = document.querySelectorAll("[data-mpw-pop-bg]");
|
|
25025
|
-
const
|
|
25081
|
+
const glasses = new Set();
|
|
25026
25082
|
const truncated = new Set();
|
|
25027
|
-
const markedNow = Array.from(document.querySelectorAll("[data-mpw-pop-untrunc]"));
|
|
25028
25083
|
for (let i = 0; i < surfaces.length; i++) {
|
|
25029
25084
|
const el = surfaces[i];
|
|
25030
25085
|
let cs = null;
|
|
25031
25086
|
try { cs = getComputedStyle(el) } catch (e) {}
|
|
25032
|
-
/*
|
|
25087
|
+
/* 硬前提:我们自己给了模糊才有"被截断"这回事 */
|
|
25033
25088
|
if (!cs || !cs.backdropFilter || String(cs.backdropFilter).indexOf("blur") < 0) continue;
|
|
25034
|
-
/* ②(2026-10-05 抖动修复) **已经摘过、且仍在这条祖先链上**的祖先,弹层没关就一直保持:
|
|
25035
|
-
摘掉之后它自己就没有 blur 了,若每轮都重新"找第一个带 blur 的祖先",下一轮就找不到它
|
|
25036
|
-
⇒ 属性被当陈旧标记摘掉 ⇒ blur 又回来 ⇒ 摘/还原来回抖(真机现象:同一个菜单时好时坏)。 */
|
|
25037
|
-
let kept = false;
|
|
25038
|
-
for (const mEl of markedNow) {
|
|
25039
|
-
if (mEl === el) continue;
|
|
25040
|
-
let onChain = false;
|
|
25041
|
-
/* 用 parentElement 走链(不用 contains:桩 DOM/老引擎上不一定有) */
|
|
25042
|
-
for (let q = el.parentElement, k = 0; q && k < 40; q = q.parentElement, k++) { if (q === mEl) { onChain = true; break } }
|
|
25043
|
-
if (onChain) { targets.add(mEl); kept = true; break }
|
|
25044
|
-
}
|
|
25045
|
-
if (kept) continue;
|
|
25046
|
-
let blockedByGlass = false;
|
|
25047
25089
|
for (let p = el.parentElement, n = 0; p && p !== document.body && p !== document.documentElement && n < 12; p = p.parentElement, n++) {
|
|
25048
25090
|
let acs = null;
|
|
25049
25091
|
try { acs = getComputedStyle(p) } catch (e) { break }
|
|
25050
25092
|
const ablur = acs && acs.backdropFilter && acs.backdropFilter !== "none" && String(acs.backdropFilter).indexOf("blur") >= 0;
|
|
25051
25093
|
if (!ablur) continue;
|
|
25052
|
-
|
|
25053
|
-
|
|
25054
|
-
|
|
25055
|
-
|
|
25056
|
-
|
|
25057
|
-
|
|
25058
|
-
|
|
25059
|
-
而输入框卡片 `uV2eYG_card`(有底、有 blur,但**不是**弹层表面)只是"碰巧挡在
|
|
25060
|
-
弹层前面的包装" ⇒ 摘掉它的 blur 换来弹层真模糊,代价是"菜单打开期间它自己不糊"。
|
|
25061
|
-
真机读数支持这条:四个弹层里只有 body 下的模型选择器有模糊,另三个全被卡片截断。 */
|
|
25062
|
-
/* ②(2026-10-05 复核) **不做几何相交判定**:backdrop root 的截断是 DOM/层叠性质,
|
|
25063
|
-
与两者矩形是否重叠无关 —— 祖先的模糊区不覆盖弹层时,弹层的 backdrop 是**空的**,
|
|
25064
|
-
照样"只有半透明没有模糊"(真机就是这么报的)。⇒ 只要是已知包装容器就摘。 */
|
|
25065
|
-
let ancestorIsSurface = false;
|
|
25066
|
-
try { ancestorIsSurface = p.matches(MPW_POP_TAG_SEL) } catch (e) {}
|
|
25067
|
-
if (ancestorIsSurface) { blockedByGlass = true; break }
|
|
25068
|
-
/* ②(2026-10-05 审查后收紧) **只摘"已知包装容器"的 blur**:真机定案的截断者只有一类 ——
|
|
25069
|
-
输入框卡片这类"碰巧挡在弹层前面的包装"(类名含 `_card` / `composer` / `overlayAnchor`)。
|
|
25070
|
-
其余任何带 blur 的祖先(标题栏里的子代理展开框、后台任务面板、别的宿主面板)**一律不碰**:
|
|
25071
|
-
它们是用户**正在看**的玻璃,摘掉就是"效果没了"(真机已因此报过一次)。
|
|
25072
|
-
代价:包在未知面板里的弹层保持"半透明无模糊"——这是**保守但不会破坏用户看得见的东西**的一侧。 */
|
|
25073
|
-
let strippableWrap = false;
|
|
25074
|
-
try { strippableWrap = /(_card|composer|overlayAnchor|_seat|_stack)/i.test(String(p.className || "")) } catch (e) {}
|
|
25075
|
-
if (!strippableWrap) { blockedByGlass = true; break }
|
|
25076
|
-
targets.add(p);
|
|
25094
|
+
let isSurface = false;
|
|
25095
|
+
try { isSurface = p.matches(MPW_POP_TAG_SEL) } catch (e) {}
|
|
25096
|
+
if (isSurface) { truncated.add(el); break } // C:用户正在看的面板 ⇒ 一个像素都不动
|
|
25097
|
+
let wrap = false;
|
|
25098
|
+
try { wrap = /(_card|composer|overlayAnchor|_seat|_stack)/i.test(String(p.className || "")) } catch (e) {}
|
|
25099
|
+
if (wrap) glasses.add(el); // B:已知包装容器 ⇒ 根级模糊层
|
|
25100
|
+
else truncated.add(el); // 未知祖先 ⇒ 保守:实底
|
|
25077
25101
|
break;
|
|
25078
25102
|
}
|
|
25079
|
-
if (blockedByGlass) truncated.add(el);
|
|
25080
|
-
}
|
|
25081
|
-
const stale = markedNow;
|
|
25082
|
-
for (let i = 0; i < stale.length; i++) { const el = stale[i]; if (!targets.has(el)) { try { el.removeAttribute("data-mpw-pop-untrunc") } catch (e) {} } }
|
|
25083
|
-
for (const el of targets) { if (!el.hasAttribute("data-mpw-pop-untrunc")) { try { el.setAttribute("data-mpw-pop-untrunc", "") } catch (e) {} } }
|
|
25084
|
-
/* 被"有底的玻璃祖先"挡住的那批:标记在**弹层自己**身上(绝不碰宿主元素),由 CSS 给实底 */
|
|
25085
|
-
const staleT = document.querySelectorAll("[data-mpw-pop-trunc]");
|
|
25086
|
-
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) {} } }
|
|
25087
|
-
for (const el of truncated) { if (!el.hasAttribute("data-mpw-pop-trunc")) { try { el.setAttribute("data-mpw-pop-trunc", "") } catch (e) {} } }
|
|
25088
|
-
if (targets.size) mpwPopUntruncStyle();
|
|
25089
|
-
else if (popUntruncStyleEl && popUntruncStyleEl.parentElement) {
|
|
25090
|
-
/* ②(2026-10-05 审查建议) 撤除也要**瞬时**:宿主若给这些元素写了 transition,
|
|
25091
|
-
直接撤规则会反向播一次"清晰→磨砂"的可感知跳变。先注入一条"禁过渡 + 保持 none",
|
|
25092
|
-
下一帧再真正撤掉。 */
|
|
25093
|
-
try {
|
|
25094
|
-
const kill = document.createElement("style");
|
|
25095
|
-
kill.setAttribute("data-plugin", "dsh-mpkg-wallpaper");
|
|
25096
|
-
kill.setAttribute("data-mpw-pop-untrunc-kill", "");
|
|
25097
|
-
kill.textContent = "[data-mpw-pop-untrunc]{transition:none !important;backdrop-filter:none !important;-webkit-backdrop-filter:none !important}";
|
|
25098
|
-
(document.head || document.documentElement).appendChild(kill);
|
|
25099
|
-
setTimeout(() => {
|
|
25100
|
-
try { kill.remove() } catch (e) {}
|
|
25101
|
-
try { if (popUntruncStyleEl && popUntruncStyleEl.parentElement) popUntruncStyleEl.remove() } catch (e) {}
|
|
25102
|
-
popUntruncStyleEl = null;
|
|
25103
|
-
}, 0);
|
|
25104
|
-
} catch (e) {
|
|
25105
|
-
try { popUntruncStyleEl.remove() } catch (e2) {}
|
|
25106
|
-
popUntruncStyleEl = null;
|
|
25107
|
-
}
|
|
25108
25103
|
}
|
|
25109
|
-
|
|
25104
|
+
const sync = (attr, want) => {
|
|
25105
|
+
const stale = document.querySelectorAll("[" + attr + "]");
|
|
25106
|
+
for (let i = 0; i < stale.length; i++) { const el = stale[i]; if (!want.has(el)) { try { el.removeAttribute(attr) } catch (e) {} } }
|
|
25107
|
+
for (const el of want) { if (!el.hasAttribute(attr)) { try { el.setAttribute(attr, "") } catch (e) {} } }
|
|
25108
|
+
};
|
|
25109
|
+
sync("data-mpw-pop-glass", glasses);
|
|
25110
|
+
sync("data-mpw-pop-trunc", truncated);
|
|
25111
|
+
mpwPopGlassApply();
|
|
25112
|
+
return glasses.size + truncated.size;
|
|
25110
25113
|
} catch (e) { return 0 }
|
|
25111
25114
|
}
|
|
25112
|
-
/*
|
|
25113
|
-
|
|
25114
|
-
globalThis.__mpwPopUntruncTest = {
|
|
25115
|
-
sync: () => mpwPopUntruncSync(),
|
|
25116
|
-
stylePresent: () => !!(popUntruncStyleEl && popUntruncStyleEl.parentElement),
|
|
25117
|
-
killPresent: () => !!document.querySelector("[data-mpw-pop-untrunc-kill]"),
|
|
25118
|
-
};
|
|
25119
|
-
} catch (e) {}
|
|
25120
|
-
|
|
25121
|
-
/* ②(2026-10-05) 探针/判据出口:弹层兜底底标记与"摘截断"两件事可被**手动触发并读回**——
|
|
25122
|
-
真机排障要能区分"根本没跑"(调度被饿死、observer 没接上)与"跑了但条件不满足"(宿主
|
|
25123
|
-
自己画了不透明白底/面积超阈值…)。只读+幂等,不改变任何语义。 */
|
|
25124
|
-
try {
|
|
25125
|
-
globalThis.__mpwPopTagTest = {
|
|
25126
|
-
run: () => { try { return mpwTagPopoverBg() } catch (e) { return -1 } },
|
|
25127
|
-
untrunc: () => { try { return mpwPopUntruncSync() } catch (e) { return -1 } },
|
|
25128
|
-
state: (sel) => {
|
|
25129
|
-
try {
|
|
25130
|
-
const el = document.querySelector(sel || "[data-mpw-pop-bg]");
|
|
25131
|
-
if (!el) return null;
|
|
25132
|
-
const cs = getComputedStyle(el);
|
|
25133
|
-
return { cls: String(el.className).slice(0, 60), tag: el.hasAttribute("data-mpw-pop-bg"), bg: cs.backgroundColor, bf: cs.backdropFilter, display: cs.display, vis: cs.visibility };
|
|
25134
|
-
} catch (e) { return null }
|
|
25135
|
-
},
|
|
25136
|
-
};
|
|
25137
|
-
} catch (e) {}
|
|
25115
|
+
/* 旧名保留(多处调用/探针判据在用) */
|
|
25116
|
+
function mpwPopUntruncSync() { return mpwPopClassifySync() }
|
|
25138
25117
|
|
|
25139
25118
|
function setupPopTagWatch() {
|
|
25140
25119
|
if (popTagWatch !== null) return;
|
|
@@ -25154,6 +25133,7 @@ body[data-mpw-modal] [role="dialog"] {
|
|
|
25154
25133
|
这里与弹层标记共用同一个 rAF 合并的入口(要素很少,代价可忽略)。 */
|
|
25155
25134
|
try { mpwTagSurfaceOuter(); } catch (e) {}
|
|
25156
25135
|
try { mpwSideLiftSync(); } catch (e) {}
|
|
25136
|
+
try { mpwPopGlassApply(); } catch (e) {}
|
|
25157
25137
|
/* ①(P3) 弹层开着 ⇒ 摘截断祖先的 blur;关了 ⇒ 还原(同一入口,随突变重算) */
|
|
25158
25138
|
try { mpwPopUntruncSync(); } catch (e) {}
|
|
25159
25139
|
} catch (e) {}
|
package/package.json
CHANGED