dsh-ws-recency 0.13.2 → 0.13.4

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 +1 -1
  2. package/client.js +39 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -135,7 +135,7 @@ dsh plugin --profile <profile> add github:chyxhtc/dsh-ws-recency
135
135
  或固定版本的预构建包:
136
136
 
137
137
  ```powershell
138
- dsh plugin --profile <profile> add https://github.com/chyxhtc/dsh-ws-recency/releases/download/v0.13.2/dsh-ws-recency-0.13.2.tgz
138
+ dsh plugin --profile <profile> add https://github.com/chyxhtc/dsh-ws-recency/releases/download/v0.13.4/dsh-ws-recency-0.13.4.tgz
139
139
  ```
140
140
 
141
141
  装完把 `dsh-ws-recency` 加进 `~/.hypers-work/profiles/<profile>/package.json` 的 `dsh.profile.bundles`,重启应用。
package/client.js CHANGED
@@ -943,9 +943,14 @@
943
943
  break;
944
944
  }
945
945
  if (template === null || typeof template.cloneNode !== "function") return;
946
+ /* The button usually sits inside a row wrapper that owns the width and the
947
+ alignment; cloning only the button loses them and the label wraps. */
948
+ var rowSource = template.parentElement !== null && template.parentElement !== undefined && template.parentElement !== container
949
+ ? template.parentElement
950
+ : template;
946
951
  var clone;
947
952
  try {
948
- clone = template.cloneNode(true);
953
+ clone = rowSource.cloneNode(true);
949
954
  } catch (error) {
950
955
  return;
951
956
  }
@@ -955,11 +960,32 @@
955
960
  var labelTemplate = clone.querySelector("span");
956
961
  if (labelTemplate !== null && typeof labelTemplate.className === "string") labelClass = labelTemplate.className;
957
962
  }
958
- while (clone.firstChild !== null) clone.removeChild(clone.firstChild);
959
- if (icon !== null) clone.appendChild(icon);
963
+ /* The wrapper may rely on inline styles from React rather than classes. */
964
+ if (typeof window !== "undefined" && typeof window.getComputedStyle === "function") {
965
+ var metrics = ["display", "width", "min-width", "align-items", "justify-content", "gap", "padding", "font-size", "font-family", "font-weight", "line-height", "color"];
966
+ for (var mi = 0; mi < metrics.length; mi += 1) {
967
+ var value = "";
968
+ try { value = window.getComputedStyle(rowSource).getPropertyValue(metrics[mi]) || ""; } catch (error) { value = ""; }
969
+ if (value !== "" && value !== "auto") clone.style[metrics[mi]] = value;
970
+ }
971
+ clone.style.whiteSpace = "nowrap";
972
+ }
973
+ /* Keep the wrapper that holds the icon (it owns the size and baseline) and
974
+ drop only the template's text. */
975
+ var iconChild = icon;
976
+ while (iconChild !== null && iconChild.parentElement !== null && iconChild.parentElement !== undefined && iconChild.parentElement !== clone) {
977
+ iconChild = iconChild.parentElement;
978
+ }
979
+ var kids = Array.prototype.slice.call(clone.children || []);
980
+ for (var k = 0; k < kids.length; k += 1) {
981
+ if (kids[k] !== iconChild) clone.removeChild(kids[k]);
982
+ }
960
983
  var label = document.createElement("span");
961
984
  if (labelClass !== "") label.className = labelClass;
962
985
  label.textContent = t("trash.title");
986
+ label.style.whiteSpace = "nowrap";
987
+ label.style.overflow = "hidden";
988
+ label.style.textOverflow = "ellipsis";
963
989
  clone.appendChild(label);
964
990
  clone.setAttribute("data-wsr-clone", "true");
965
991
  clone.setAttribute("aria-label", t("trash.title"));
@@ -967,6 +993,16 @@
967
993
  if (event !== undefined && typeof event.preventDefault === "function") event.preventDefault();
968
994
  openTrashPanel();
969
995
  });
996
+ /* Keep the template's icon box (it owns the size and the baseline) but put
997
+ our own trash glyph inside it. */
998
+ var ourSvg = typeof mine.querySelector === "function" ? mine.querySelector("svg") : null;
999
+ if (icon !== null && ourSvg !== null && icon.parentElement !== null && icon.parentElement !== undefined) {
1000
+ try {
1001
+ icon.parentElement.replaceChild(ourSvg, icon);
1002
+ } catch (error) {
1003
+ /* keep the template icon */
1004
+ }
1005
+ }
970
1006
  container.insertBefore(clone, mine);
971
1007
  mine.style.display = "none";
972
1008
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-ws-recency",
3
- "version": "0.13.2",
3
+ "version": "0.13.4",
4
4
  "description": "Sidebar session management for DeepSeek Harness: workspace groups sorted by latest activity, stale history folded, a global pinned section, follow-up marks, session delete into a recoverable trash, per-session token statistics split by tool, and moving a session to another workspace.",
5
5
  "license": "MIT",
6
6
  "author": "chyxhtc",