dsh-desktop-enhance 0.6.9 → 0.6.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 (2) hide show
  1. package/lib/client.js +72 -4
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -7075,10 +7075,20 @@ window.__ModuleLoader__.load({
7075
7075
  `body.dsh-remote-portrait [class$="_crumb"]{max-width:none;padding:2px 4px;font-size:13.5px}`,
7076
7076
  `body.dsh-remote-portrait header[class*="_header"] [class$="_headerActions"]{margin-left:auto;gap:4px}`,
7077
7077
  `body.dsh-remote-portrait header[class*="_header"] [class$="_headerActions"] button{height:24px;min-height:24px;font-size:11px;padding:0 6px}`,
7078
- `body.dsh-remote-portrait header:has([data-slot="conversation.session.header"]) [class$="_titleCluster"]{flex-wrap:wrap;row-gap:4px;align-items:flex-start}`,
7079
- `body.dsh-remote-portrait header:has([data-slot="conversation.session.header"]) [class$="_crumbs"]{flex:1 1 140px;min-width:min(140px,100%);max-width:100%}`,
7080
- `body.dsh-remote-portrait header:has([data-slot="conversation.session.header"]) [class$="_headerActions"]{margin-left:0;max-width:100%;flex-wrap:wrap;row-gap:4px}`,
7081
- `body.dsh-remote-portrait header:has([data-slot="conversation.session.header"]) [class$="_titleRow"]{align-items:flex-start}`,
7078
+ `body.dsh-remote-portrait header:has([data-slot="conversation.session.header"]){padding-top:0 !important}`,
7079
+ `body.dsh-remote-portrait header:has([data-slot="conversation.session.header"]) [class$="_titleRow"]{height:40px;min-height:40px;align-items:center;gap:4px}`,
7080
+ `body.dsh-remote-portrait header:has([data-slot="conversation.session.header"]) [class$="_titleCluster"]{flex:1;min-width:0;flex-wrap:nowrap;gap:4px;align-items:center}`,
7081
+ `body.dsh-remote-portrait header:has([data-slot="conversation.session.header"]) [class$="_crumbs"]{flex:1;min-width:0;max-width:100%}`,
7082
+ `body.dsh-remote-portrait header:has([data-slot="conversation.session.header"]) [class$="_headerActions"]{flex:none;margin-left:0;flex-wrap:nowrap;gap:0}`,
7083
+ `body.dsh-remote-portrait header:has([data-slot="conversation.session.header"]) [class$="_tabs"]{height:28px;box-sizing:border-box;margin-top:0}`,
7084
+ `body.dsh-remote-portrait header:has([data-slot="conversation.session.header"]) button[data-desktop-enhance-mobile-header-action]{position:relative;height:40px;min-height:40px;padding:0 4px;gap:4px;border:0;background:transparent;font-variant-numeric:tabular-nums}`,
7085
+ `body.dsh-remote-portrait [data-desktop-enhance-mobile-header-count]{font-size:0 !important;margin:0}`,
7086
+ `body.dsh-remote-portrait [data-desktop-enhance-mobile-header-count]::after{content:attr(data-desktop-enhance-mobile-header-count);font-size:12px}`,
7087
+ `body.dsh-remote-portrait [data-desktop-enhance-mobile-header-action] > svg{display:none}`,
7088
+ `body.dsh-remote-portrait [data-desktop-enhance-mobile-header-action]::before{content:"";width:17px;height:17px;flex:none;background:currentColor;mask:var(--desktop-enhance-header-icon) center/contain no-repeat}`,
7089
+ `body.dsh-remote-portrait [data-desktop-enhance-mobile-header-action="subagent"]{--desktop-enhance-header-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.65' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 20v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M16 3a4 4 0 0 1 0 8M22 20v-2a4 4 0 0 0-3-3.87'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3C/svg%3E")}`,
7090
+ `body.dsh-remote-portrait [data-desktop-enhance-mobile-header-action="jobs"]{--desktop-enhance-header-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.65' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='5' width='16' height='15' rx='3'/%3E%3Cpath d='M9 5V3h6v2M9 10l3 3-3 3M15 16h2'/%3E%3C/svg%3E")}`,
7091
+ `body.dsh-remote-portrait [data-desktop-enhance-mobile-header-action] > [class$="_activitySlot"],body.dsh-remote-portrait [data-desktop-enhance-mobile-header-action] > [class$="_triggerDot"]{position:absolute;left:17px;top:8px;transform:scale(.7);transform-origin:center}`,
7082
7092
  `#dshRemoteWhale{position:fixed;top:calc(4px + env(safe-area-inset-top));left:calc(8px + env(safe-area-inset-left));z-index:2147482999;width:34px;height:34px;min-width:34px;padding:0;border-radius:10px;background:var(--dsw-alias-bg-module-platform);border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-primary);display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 1px 6px rgba(0,0,0,.25);touch-action:none}`,
7083
7093
  `#dshRemoteWhale{translate:0 var(--desktop-enhance-viewport-top,0px)}`,
7084
7094
  `#dshRemoteWhale svg{width:20px;height:15px;display:block}`,
@@ -7140,6 +7150,60 @@ window.__ModuleLoader__.load({
7140
7150
  ...MOBILE_SETTINGS_CSS
7141
7151
  ];
7142
7152
  //#endregion
7153
+ //#region src/client/mobile/header.ts
7154
+ const HEADER = ":is([data-slot=\"conversation.session.header.actions\"], [data-slot=\"conversation.session.header.lineage\"])";
7155
+ const ACTION = "data-desktop-enhance-mobile-header-action";
7156
+ const COUNT = "data-desktop-enhance-mobile-header-count";
7157
+ const subagentLabel = /^(?:\d+ 个子智能体(?:,正在运行)?|\d+ subagents?(?: running)?)$/;
7158
+ const jobsLabel = /^(?:\d+ 个后台任务(?:运行中)?|\d+ background jobs?(?: running)?)$/;
7159
+ function mountMobileHeader() {
7160
+ const marked = new Map();
7161
+ function clear(button, span) {
7162
+ button.removeAttribute(ACTION);
7163
+ span.removeAttribute(COUNT);
7164
+ }
7165
+ function sync() {
7166
+ const current = new Map();
7167
+ for (const button of globalThis.document.querySelectorAll(`${HEADER} button`)) {
7168
+ const label = button.getAttribute("aria-label") ?? "";
7169
+ const kind = subagentLabel.test(label) ? "subagent" : jobsLabel.test(label) ? "jobs" : null;
7170
+ if (!kind) continue;
7171
+ if (kind === "subagent" && button.getAttribute("aria-haspopup") !== "tree") continue;
7172
+ const span = button.querySelector(kind === "subagent" ? ":scope > span:not([class$=\"_activitySlot\"]):not([class$=\"_switcherTitle\"])" : ":scope > span[class$=\"_count\"]");
7173
+ const text = span?.textContent?.trim() ?? "";
7174
+ if (!span || !(kind === "subagent" ? subagentLabel : jobsLabel).test(text)) continue;
7175
+ const count = Number.parseInt(text, 10);
7176
+ const display = count > 99 ? "99+" : String(count);
7177
+ if (button.getAttribute(ACTION) !== kind) button.setAttribute(ACTION, kind);
7178
+ if (span.getAttribute(COUNT) !== display) span.setAttribute(COUNT, display);
7179
+ current.set(button, span);
7180
+ }
7181
+ for (const [button, span] of marked) if (!current.has(button)) clear(button, span);
7182
+ else if (current.get(button) !== span) span.removeAttribute(COUNT);
7183
+ marked.clear();
7184
+ for (const [button, span] of current) marked.set(button, span);
7185
+ }
7186
+ const observer = new globalThis.MutationObserver((records) => {
7187
+ if (records.some((record) => {
7188
+ if ((record.target instanceof globalThis.Element ? record.target : record.target.parentElement)?.closest(HEADER)) return true;
7189
+ return [...record.addedNodes, ...record.removedNodes].some((node) => node instanceof globalThis.Element && (node.matches(HEADER) || node.querySelector(HEADER)));
7190
+ })) sync();
7191
+ });
7192
+ observer.observe(globalThis.document.body, {
7193
+ childList: true,
7194
+ subtree: true,
7195
+ characterData: true,
7196
+ attributes: true,
7197
+ attributeFilter: ["aria-label"]
7198
+ });
7199
+ sync();
7200
+ return () => {
7201
+ observer.disconnect();
7202
+ for (const [button, span] of marked) clear(button, span);
7203
+ marked.clear();
7204
+ };
7205
+ }
7206
+ //#endregion
7143
7207
  //#region src/client/mobile/index.ts
7144
7208
  function initMobileAdapt(actions) {
7145
7209
  let disposed = false;
@@ -7200,6 +7264,7 @@ window.__ModuleLoader__.load({
7200
7264
  const surfaceText = (key, fallback) => actions.t(key) || fallback;
7201
7265
  let active = false;
7202
7266
  let disposeSettings = null;
7267
+ let disposeHeader = null;
7203
7268
  let savedViewportContent = null;
7204
7269
  let whaleEl = null;
7205
7270
  let connectionStatus = "unknown";
@@ -7272,6 +7337,7 @@ window.__ModuleLoader__.load({
7272
7337
  globalThis.document.body.classList.add(ACTIVE_CLASS);
7273
7338
  ensureAdaptStyle();
7274
7339
  disposeSettings = mountMobileSettings(() => actions.t("mobile.settings.back"));
7340
+ disposeHeader = mountMobileHeader();
7275
7341
  const meta = globalThis.document.querySelector("meta[name=viewport]");
7276
7342
  if (meta instanceof globalThis.HTMLMetaElement && meta.getAttribute("content") !== null && !(meta.getAttribute("content") ?? "").includes("viewport-fit")) {
7277
7343
  savedViewportContent = meta.getAttribute("content");
@@ -7287,6 +7353,8 @@ window.__ModuleLoader__.load({
7287
7353
  active = false;
7288
7354
  disposeSettings?.();
7289
7355
  disposeSettings = null;
7356
+ disposeHeader?.();
7357
+ disposeHeader = null;
7290
7358
  clearLongPress();
7291
7359
  cancelTimeouts();
7292
7360
  restoreActionStyles();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-desktop-enhance",
3
- "version": "0.6.9",
3
+ "version": "0.6.10",
4
4
  "description": "DSH Desktop 界面增强:页内查找(Cmd+F)、轮次编号、上下文压缩行常显、建议、每步耗时、折叠文件夹状态计数、会话信息(含上下文注入 C1 视图)、工具管理、Skill 管理、独立远程接入与手机体验。",
5
5
  "type": "module",
6
6
  "icon": "./icon.svg",