dsh-multipane 1.0.9 → 1.0.10

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 (3) hide show
  1. package/README.md +6 -0
  2. package/lib/client.js +36 -14
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -246,6 +246,12 @@ C:\Users\weiai\.dsh\plugin-src\_probe\sync-client.ps1 -Push # 台式机 ->
246
246
 
247
247
  ## 更新记录
248
248
 
249
+ ### 1.0.10(2026-11-10)
250
+ - **修「关掉多栏视图后侧栏样式还在」**:关闭时只清了 `data-dsv-row`,没有删除插件自己的样式表——而其中
251
+ `[data-row-key^="session:"]:not([data-dsv-row]) * { opacity: .5 }` 这条**不需要任何行标记**,
252
+ 只要样式表还在,所有会话行的文字就一直是暗的。现在关闭/卸载时把样式表、43 个 `--dsv-*` 变量、
253
+ `data-dsv-row` / `data-dsv-pulse` 标记和复用来的 `_selected` 类一起清掉;重新启用时整体恢复。
254
+
249
255
  ### 1.0.9(2026-11-10)
250
256
  - **修「最暗 / 最亮两个圆点不在滑轨上」**:滑杆的滑块被 Chromium 顶在轨道顶部(不自动居中),实测圈心比轨道中心高 5px;补 `margin-top` 并按 border-box 计算宽度。
251
257
  - **修「调悬停浓度时预览没反应」**:预览里新增一个固定的「悬停」标签,调「悬停时浓度」能实时看到那条线的变化。
package/lib/client.js CHANGED
@@ -17,7 +17,7 @@ window.__ModuleLoader__.load({
17
17
  */
18
18
  const PLUGIN_LABEL = "多栏视图";
19
19
  /* 与 package.json 的 version 必须一致(发版时两处同改;check-names.cjs 会校验)。 */
20
- const PLUGIN_VERSION = "1.0.9";
20
+ const PLUGIN_VERSION = "1.0.10";
21
21
  const NPM_LATEST_URL = "https://registry.npmjs.org/dsh-multipane/latest";
22
22
  /* 按 x.y.z 数值比较,不能用字符串比大小:字典序下 "1.0.10" < "1.0.9",
23
23
  而且降级场景(本地 1.0.10、线上 1.0.9)会被误判成「有新版本」。 */
@@ -997,6 +997,10 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
997
997
  */
998
998
  function applyLineVars() {
999
999
  try {
1000
+ /* 关掉插件后不该继续往根上写变量(连同样的变量都会让宿主看起来"没关干净")。
1001
+ 重新打开时这里会再跑一遍,样式表一并补回来。 */
1002
+ if (prefs.state.enabled !== true) return;
1003
+ installStyles();
1000
1004
  const el = document.documentElement;
1001
1005
  const state = prefs.state;
1002
1006
  const a = state.appearance ?? DEFAULT_APPEARANCE();
@@ -1083,15 +1087,36 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
1083
1087
  }
1084
1088
  }
1085
1089
 
1086
- /** 插件卸载时把留在 <html> 上的变量清掉,别给宿主留残留。 */
1087
- function clearLineVars() {
1090
+ /**
1091
+ * 把插件留在页面上的**全部**痕迹清掉(插件关掉 / 卸载时调用)。
1092
+ *
1093
+ * 三样都要清,少一样就会「关掉了但样式还在」:
1094
+ * ① 样式表本身 —— 里面有 [data-row-key^="session:"]:not([data-dsv-row]) * { opacity: .5 },
1095
+ * 这条**不需要任何行标记**,只要 style 还在,所有会话行的文字就一直是暗的;
1096
+ * ② <html> 上的 --dsv-* 变量(43 个)—— 宿主侧栏行读的就是它们;
1097
+ * ③ 行上的 data-dsv-row / data-dsv-pulse 与复用来的 _selected class。
1098
+ */
1099
+ function clearAllDsvState() {
1088
1100
  try {
1089
1101
  const el = document.documentElement;
1090
- el.style.removeProperty("--dsv-line");
1091
- el.style.removeProperty("--dsv-line-soft");
1092
- el.style.removeProperty("--dsv-line-w");
1102
+ const style = document.getElementById(STYLE_ID);
1103
+ if (style !== null) style.remove();
1104
+ const names = [];
1105
+ for (let index = 0; index < el.style.length; index += 1) {
1106
+ const name = el.style.item(index);
1107
+ if (typeof name === "string" && name.indexOf("--dsv") === 0) names.push(name);
1108
+ }
1109
+ for (const name of names) el.style.removeProperty(name);
1110
+ el.removeAttribute("data-dsv-settings");
1111
+ for (const row of document.querySelectorAll("[data-dsv-row]")) row.removeAttribute("data-dsv-row");
1112
+ for (const row of document.querySelectorAll("[data-dsv-pulse]")) row.removeAttribute("data-dsv-pulse");
1113
+ for (const row of document.querySelectorAll('[data-row-key^="session:"]')) {
1114
+ for (const cls of Array.from(row.classList)) {
1115
+ if (cls.endsWith("_selected")) row.classList.remove(cls);
1116
+ }
1117
+ }
1093
1118
  } catch {
1094
- /* 忽略 */
1119
+ /* 非浏览器环境 */
1095
1120
  }
1096
1121
  }
1097
1122
 
@@ -1248,12 +1273,9 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
1248
1273
  /* 插件关掉后必须**停手并清掉标记**,否则会话列表还带着插件的高亮,
1249
1274
  但主区域已经还给宿主了 —— 两边对不上,用户看起来就是「关不掉」。 */
1250
1275
  if (prefs.state.enabled !== true) {
1251
- for (const row of document.querySelectorAll("[data-dsv-row]")) row.removeAttribute("data-dsv-row");
1252
- for (const row of document.querySelectorAll('[data-row-key^="session:"]')) {
1253
- for (const cls of Array.from(row.classList)) {
1254
- if (cls.endsWith("_selected")) row.classList.remove(cls);
1255
- }
1256
- }
1276
+ /* 样式表还在 = 还没清过(宿主重渲染会重建行,所以每次都清也没问题:
1277
+ querySelectorAll 在没有标记时几乎零成本)。 */
1278
+ if (document.getElementById(STYLE_ID) !== null) clearAllDsvState();
1257
1279
  return;
1258
1280
  }
1259
1281
  try {
@@ -7953,7 +7975,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
7953
7975
  /* 卸载时把写在 <html> 上的线条变量清掉(应用退出 / 插件重载)。 */
7954
7976
  ctx.effect(() => {
7955
7977
  applyLineVars();
7956
- return () => clearLineVars();
7978
+ return () => clearAllDsvState();
7957
7979
  }, "dsh-split-view: line color vars");
7958
7980
 
7959
7981
  /* 拖放定向:接管宿主的 `conversation.input.attachments` 槽位。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-multipane",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "Hermes-style tabbed workspace for the DSH main area: drag sessions in, split into up to four columns, close tabs.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",