dsh-folia 3.8.0 → 3.9.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.
Files changed (2) hide show
  1. package/lib/client.js +36 -0
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -25729,6 +25729,38 @@ window.__ModuleLoader__.load({
25729
25729
  try { return skinYielded === true; } catch { return false; }
25730
25730
  }
25731
25731
 
25732
+ /**
25733
+ * 让路期间把**整张插件样式表**关掉。
25734
+ *
25735
+ * 为什么必须关整张:皮肤是一套完整的外观(自己的底色、圆角、字体色、边框)。我们的
25736
+ * `styles-base.js` 给应用外壳铺透明/玻璃/自定义配色,选择器落在同一批元素上,于是皮肤
25737
+ * 的规则被我们盖掉 —— 表现就是"皮肤显示不全,关掉插件就完整"。让路态此前只关了玻璃
25738
+ * 效果族(`data-we-*` 属性门控),**样式表本体一直在**,所以这个洞一直存在。
25739
+ *
25740
+ * 用 `sheet.disabled` 而不是摘 `<style>`:摘了再插会触发整页重排;disabled 是零成本开关,
25741
+ * 退出让路时立刻原样恢复。
25742
+ */
25743
+ function syncPluginCssForSkin() {
25744
+ // ⚠️ 默认**不**整表禁用。3.9.0 试过一次"皮肤在台就关掉整张样式表",代价是:
25745
+ // 我们的面板失去可读底色,皮肤的底图直接透上来,字全糊 —— 插件等于不能用了。
25746
+ // 皮肤和壁纸是两个都在重绘整个界面的产品,CSS 层面无法各让一半:整表关掉
25747
+ // 皮肤完整但我们不可用,整表开着我们可用但皮肤被压。折中只保留"玻璃效果族
25748
+ // 退场"(它已经由 data-we-* 属性门控),样式表本体始终在 —— 保证可读性优先。
25749
+ // 需要皮肤完全接管时,用环境变量 DSH_FOLIA_YIELD_CSS=1 显式开启整表让位。
25750
+ // 前端没有 process.env(那是宿主侧的),开关放在 localStorage:
25751
+ // localStorage.setItem("folia.yieldCss", "1") → 刷新后启用整表让位
25752
+ let want = false;
25753
+ try { want = window.localStorage.getItem("folia.yieldCss") === "1"; } catch { want = false; }
25754
+ if (!want) return;
25755
+ try {
25756
+ const tag = document.querySelector('style[data-plugin-css="dsh-folia/styles-v3"]');
25757
+ if (tag === null) return;
25758
+ const off = skinYieldActive() === true;
25759
+ if (tag.sheet) tag.sheet.disabled = off;
25760
+ else tag.disabled = off;
25761
+ } catch { /* 拿不到 sheet(还在解析 / 被 CSP 拦)就跳过,不影响其它门控 */ }
25762
+ }
25763
+
25732
25764
  /** 皮肤上台 ⇒ 退场(幂等)。 */
25733
25765
  function enterSkinYield(reason) {
25734
25766
  if (skinYielded) return;
@@ -25743,6 +25775,7 @@ window.__ModuleLoader__.load({
25743
25775
  applySelection(""); // 清层:url=null ⇒ syncLayers 摘层 / 遮罩 / data-we-wallpaper
25744
25776
  persistSelection();
25745
25777
  applyEffects(); // 让路态里玻璃门控整族摘除
25778
+ syncPluginCssForSkin(); // 连同整张样式表一起让位 —— 否则皮肤被我们的外框盖住(显示不全)
25746
25779
  emit();
25747
25780
  reportClientDiag("skin-yield", "enter · " + reason + " · restore=" + (skinYieldMemory.id || "-"));
25748
25781
  }
@@ -25765,6 +25798,7 @@ window.__ModuleLoader__.load({
25765
25798
  setSetting("skinYieldRestoreRotation", false);
25766
25799
  persistSelection();
25767
25800
  applyEffects();
25801
+ syncPluginCssForSkin(); // 皮肤退场:把我们的样式表原样开回来
25768
25802
  emit();
25769
25803
  reportClientDiag("skin-yield", "exit · " + reason);
25770
25804
  }
@@ -25884,6 +25918,7 @@ window.__ModuleLoader__.load({
25884
25918
  rotationEnabled: rid ? selection.skinYieldRestoreRotation === true : selection.rotationEnabled === true,
25885
25919
  };
25886
25920
  applyEffects(); // 认领即刻摘玻璃门控(首次 applyEffects 可能已经跑过)
25921
+ syncPluginCssForSkin(); // 启动即认领时也要让出样式表:否则一开机皮肤就被外框盖着
25887
25922
  reportClientDiag("skin-yield", "adopt · install/dom");
25888
25923
  } else if (!document.documentElement.hasAttribute("data-dsh-skin") && !selection.id
25889
25924
  && String(selection.skinYieldRestoreId || "")) {
@@ -25905,6 +25940,7 @@ window.__ModuleLoader__.load({
25905
25940
  try { unsubAdopt(); } catch { /* ignore */ }
25906
25941
  skinYielded = false;
25907
25942
  skinYieldMemory = null;
25943
+ syncPluginCssForSkin(); // 清理后让路态清零 ⇒ 样式表恢复
25908
25944
  };
25909
25945
  }
25910
25946
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-folia",
3
- "version": "3.8.0",
3
+ "version": "3.9.1",
4
4
  "description": "Folia 壁纸引擎:把本机 Wallpaper Engine 壁纸搬进 DSH 界面(场景实时渲染 / 视频 / 网页),内置液态玻璃与 Folia 吉祥物,并可从自建站点拉取壁纸。单包形态(组件已合并)。",
5
5
  "type": "module",
6
6
  "engines": {