dsh-desktop-enhance 0.6.9 → 0.6.11

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 +75 -4
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -7075,10 +7075,23 @@ 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"]) :is(button[data-desktop-enhance-mobile-header-action],[data-team-action] > button){position:relative;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;height:40px;min-height:40px;padding:0 4px;gap:4px;border:0;background:transparent;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums}`,
7085
+ `body.dsh-remote-portrait [data-desktop-enhance-mobile-header-count]{display:inline-flex;align-items:center;height:18px;line-height:18px;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,body.dsh-remote-portrait [data-team-action] > button > svg,body.dsh-remote-portrait [data-team-action] > button > span{display:none}`,
7088
+ `body.dsh-remote-portrait :is([data-desktop-enhance-mobile-header-action],[data-team-action] > button)::before{content:"";display:block;width:18px;height:18px;flex:none;background:currentColor;mask:var(--desktop-enhance-header-icon) center/contain no-repeat}`,
7089
+ `body.dsh-remote-portrait [data-team-action] > button{--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%3Ccircle cx='12' cy='5' r='2.5'/%3E%3Ccircle cx='5' cy='18' r='2.5'/%3E%3Ccircle cx='19' cy='18' r='2.5'/%3E%3Cpath d='M10.6 7.2 6.5 15.5M13.4 7.2l4.1 8.3M8 18h8'/%3E%3C/svg%3E")}`,
7090
+ `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%3Crect x='3' y='3' width='5' height='5' rx='1.2'/%3E%3Crect x='16' y='3' width='5' height='5' rx='1.2'/%3E%3Crect x='16' y='16' width='5' height='5' rx='1.2'/%3E%3Cpath d='M8 5.5h8M10.5 5.5v10a3 3 0 0 0 3 3H16'/%3E%3C/svg%3E")}`,
7091
+ `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")}`,
7092
+ `body.dsh-remote-portrait [data-desktop-enhance-mobile-header-action] > [class$="_activitySlot"]{display:none}`,
7093
+ `body.dsh-remote-portrait [data-desktop-enhance-mobile-header-action]:has(> [class$="_activitySlot"],> [class*="_triggerDot"])::after{content:"";position:absolute;left:18px;top:9px;width:5px;height:5px;border-radius:50%;background:var(--dsw-alias-state-business-primary);box-shadow:0 0 0 2px var(--dsw-alias-bg-module-platform);pointer-events:none;animation:desktop-enhance-connection-pulse 1.7s ease-in-out infinite}`,
7094
+ `@media(prefers-reduced-motion:reduce){body.dsh-remote-portrait [data-desktop-enhance-mobile-header-action]::after{animation:none !important}}`,
7082
7095
  `#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
7096
  `#dshRemoteWhale{translate:0 var(--desktop-enhance-viewport-top,0px)}`,
7084
7097
  `#dshRemoteWhale svg{width:20px;height:15px;display:block}`,
@@ -7140,6 +7153,60 @@ window.__ModuleLoader__.load({
7140
7153
  ...MOBILE_SETTINGS_CSS
7141
7154
  ];
7142
7155
  //#endregion
7156
+ //#region src/client/mobile/header.ts
7157
+ const HEADER = ":is([data-slot=\"conversation.session.header.actions\"], [data-slot=\"conversation.session.header.lineage\"])";
7158
+ const ACTION = "data-desktop-enhance-mobile-header-action";
7159
+ const COUNT = "data-desktop-enhance-mobile-header-count";
7160
+ const subagentLabel = /^(?:\d+ 个子智能体(?:,正在运行)?|\d+ subagents?(?: running)?)$/;
7161
+ const jobsLabel = /^(?:\d+ 个后台任务(?:运行中)?|\d+ background jobs?(?: running)?)$/;
7162
+ function mountMobileHeader() {
7163
+ const marked = new Map();
7164
+ function clear(button, span) {
7165
+ button.removeAttribute(ACTION);
7166
+ span.removeAttribute(COUNT);
7167
+ }
7168
+ function sync() {
7169
+ const current = new Map();
7170
+ for (const button of globalThis.document.querySelectorAll(`${HEADER} button`)) {
7171
+ const label = button.getAttribute("aria-label") ?? "";
7172
+ const kind = subagentLabel.test(label) ? "subagent" : jobsLabel.test(label) ? "jobs" : null;
7173
+ if (!kind) continue;
7174
+ if (kind === "subagent" && button.getAttribute("aria-haspopup") !== "tree") continue;
7175
+ const span = button.querySelector(kind === "subagent" ? ":scope > span:not([class$=\"_activitySlot\"]):not([class$=\"_switcherTitle\"])" : ":scope > span[class$=\"_count\"]");
7176
+ const text = span?.textContent?.trim() ?? "";
7177
+ if (!span || !(kind === "subagent" ? subagentLabel : jobsLabel).test(text)) continue;
7178
+ const count = Number.parseInt(text, 10);
7179
+ const display = count > 99 ? "99+" : String(count);
7180
+ if (button.getAttribute(ACTION) !== kind) button.setAttribute(ACTION, kind);
7181
+ if (span.getAttribute(COUNT) !== display) span.setAttribute(COUNT, display);
7182
+ current.set(button, span);
7183
+ }
7184
+ for (const [button, span] of marked) if (!current.has(button)) clear(button, span);
7185
+ else if (current.get(button) !== span) span.removeAttribute(COUNT);
7186
+ marked.clear();
7187
+ for (const [button, span] of current) marked.set(button, span);
7188
+ }
7189
+ const observer = new globalThis.MutationObserver((records) => {
7190
+ if (records.some((record) => {
7191
+ if ((record.target instanceof globalThis.Element ? record.target : record.target.parentElement)?.closest(HEADER)) return true;
7192
+ return [...record.addedNodes, ...record.removedNodes].some((node) => node instanceof globalThis.Element && (node.matches(HEADER) || node.querySelector(HEADER)));
7193
+ })) sync();
7194
+ });
7195
+ observer.observe(globalThis.document.body, {
7196
+ childList: true,
7197
+ subtree: true,
7198
+ characterData: true,
7199
+ attributes: true,
7200
+ attributeFilter: ["aria-label"]
7201
+ });
7202
+ sync();
7203
+ return () => {
7204
+ observer.disconnect();
7205
+ for (const [button, span] of marked) clear(button, span);
7206
+ marked.clear();
7207
+ };
7208
+ }
7209
+ //#endregion
7143
7210
  //#region src/client/mobile/index.ts
7144
7211
  function initMobileAdapt(actions) {
7145
7212
  let disposed = false;
@@ -7200,6 +7267,7 @@ window.__ModuleLoader__.load({
7200
7267
  const surfaceText = (key, fallback) => actions.t(key) || fallback;
7201
7268
  let active = false;
7202
7269
  let disposeSettings = null;
7270
+ let disposeHeader = null;
7203
7271
  let savedViewportContent = null;
7204
7272
  let whaleEl = null;
7205
7273
  let connectionStatus = "unknown";
@@ -7272,6 +7340,7 @@ window.__ModuleLoader__.load({
7272
7340
  globalThis.document.body.classList.add(ACTIVE_CLASS);
7273
7341
  ensureAdaptStyle();
7274
7342
  disposeSettings = mountMobileSettings(() => actions.t("mobile.settings.back"));
7343
+ disposeHeader = mountMobileHeader();
7275
7344
  const meta = globalThis.document.querySelector("meta[name=viewport]");
7276
7345
  if (meta instanceof globalThis.HTMLMetaElement && meta.getAttribute("content") !== null && !(meta.getAttribute("content") ?? "").includes("viewport-fit")) {
7277
7346
  savedViewportContent = meta.getAttribute("content");
@@ -7287,6 +7356,8 @@ window.__ModuleLoader__.load({
7287
7356
  active = false;
7288
7357
  disposeSettings?.();
7289
7358
  disposeSettings = null;
7359
+ disposeHeader?.();
7360
+ disposeHeader = null;
7290
7361
  clearLongPress();
7291
7362
  cancelTimeouts();
7292
7363
  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.11",
4
4
  "description": "DSH Desktop 界面增强:页内查找(Cmd+F)、轮次编号、上下文压缩行常显、建议、每步耗时、折叠文件夹状态计数、会话信息(含上下文注入 C1 视图)、工具管理、Skill 管理、独立远程接入与手机体验。",
5
5
  "type": "module",
6
6
  "icon": "./icon.svg",