dsh-desktop-enhance 0.6.7 → 0.6.9

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 +2 -2
  2. package/lib/client.js +139 -36
  3. package/package.json +12 -14
package/README.md CHANGED
@@ -112,13 +112,13 @@ Web 版(浏览器里打开的那种)键位是 **`Cmd+Shift+.`** —— `Cmd+
112
112
 
113
113
  ### 异常轮次分叉
114
114
 
115
- 已经结束、但原生 Fork 仍不可用的轮次,也能在原位置分叉,包括恢复会话、前置检查拒绝,以及正常结束却没有最终文本的情况。不按结束原因筛选;原生按钮已可用时保持不变,不增加第二个入口。没有最终答复的轮次会补齐该入口。设置页「会话能力 → 异常轮次分叉」可关闭并恢复原生行为。
115
+ 已经结束、但原生 Fork 仍不可用的轮次,也能在原位置分叉,包括恢复会话、前置检查拒绝,以及正常结束却没有最终文本的情况。不按结束原因筛选;原生按钮已可用时保持不变,不增加第二个入口。没有最终答复的轮次会补齐该入口。设置页「对话与显示 → 异常轮次分叉」可关闭并恢复原生行为。
116
116
 
117
117
  只支持已保存结束记录的轮次,不处理运行中或损坏记录。**分叉复制对话,不回滚文件和外部操作**。
118
118
 
119
119
  ### 子智能体与团队会话模型
120
120
 
121
- 在输入框原模型位置显示子智能体和团队成员最近请求实际使用的模型与推理档位,只读、不可切换;悬停可查看完整 `provider/model`。普通会话仍使用原生模型选择器。首次自身请求前显示「模型尚未记录」,不把 Fork 继承的父会话模型冒充为子会话模型。设置页「会话能力 → 子会话模型」可单独关闭,恢复原生界面。
121
+ 在输入框原模型位置显示子智能体和团队成员最近请求实际使用的模型与推理档位,只读、不可切换;悬停可查看完整 `provider/model`。普通会话仍使用原生模型选择器。首次自身请求前显示「模型尚未记录」,不把 Fork 继承的父会话模型冒充为子会话模型。设置页「对话与显示 → 子会话模型」可单独关闭,恢复原生界面。
122
122
 
123
123
  ### 会话信息
124
124
 
package/lib/client.js CHANGED
@@ -9,6 +9,7 @@ window.__ModuleLoader__.load({
9
9
  //#endregion
10
10
  //#region src/client/mobile/strings.ts
11
11
  const mobileZh = {
12
+ "mobile.settings.back": "‹ 设置",
12
13
  "mobile.connection.connecting": "正在重连",
13
14
  "mobile.connection.disconnected": "连接已断开",
14
15
  "mobile.connection.connected": "已连接",
@@ -17,6 +18,7 @@ window.__ModuleLoader__.load({
17
18
  "mobile.writeFailed": "无法保存鲸鱼位置,请检查浏览器存储权限后重试。"
18
19
  };
19
20
  const mobileEn = {
21
+ "mobile.settings.back": "‹ Settings",
20
22
  "mobile.connection.connecting": "Reconnecting",
21
23
  "mobile.connection.disconnected": "Disconnected",
22
24
  "mobile.connection.connected": "Connected",
@@ -724,7 +726,9 @@ window.__ModuleLoader__.load({
724
726
  "turnPrefix",
725
727
  "compactionRow",
726
728
  "stepDuration",
727
- "folderStatus"
729
+ "folderStatus",
730
+ "sessionModel",
731
+ "abnormalFork"
728
732
  ]
729
733
  },
730
734
  {
@@ -735,8 +739,6 @@ window.__ModuleLoader__.load({
735
739
  id: "session",
736
740
  fields: [
737
741
  "sessionInfo",
738
- "sessionModel",
739
- "abnormalFork",
740
742
  "toolsManager",
741
743
  "skillsManager"
742
744
  ]
@@ -6945,13 +6947,98 @@ window.__ModuleLoader__.load({
6945
6947
  }, t("remote.revoke"))))), status.devices.length === 0 ? h("p", { className: "de-remote-empty" }, t("remote.noDevices")) : null))) : null));
6946
6948
  }
6947
6949
  //#endregion
6950
+ //#region src/client/mobile/settings.ts
6951
+ const root = "[data-shortcut-modal=\"settings\"][role=\"dialog\"]";
6952
+ const panel = `body.dsh-remote-portrait ${root}`;
6953
+ const MOBILE_SETTINGS_CSS = [
6954
+ `${panel}{width:100%;max-width:100%;height:var(--desktop-enhance-viewport-height,100dvh);max-height:var(--desktop-enhance-viewport-height,100dvh);border-radius:0;box-shadow:none}`,
6955
+ `body.dsh-remote-portrait [role="presentation"]:has(> ${root}){top:var(--desktop-enhance-viewport-top,0px);bottom:auto;height:var(--desktop-enhance-viewport-height,100dvh)}`,
6956
+ `${panel}[data-desktop-enhance-settings-view]{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);box-sizing:border-box}`,
6957
+ `${panel}[data-desktop-enhance-settings-view] > nav,${panel}[data-desktop-enhance-settings-view] > [class$="_content"]{display:contents}`,
6958
+ `${panel}[data-desktop-enhance-settings-view] > nav > [class$="_navTitle"]{display:flex;align-items:center;grid-area:1/1;padding:0 16px;pointer-events:none;font-size:17px;font-weight:600;max-width:40%;min-width:0}`,
6959
+ `${panel}[data-desktop-enhance-settings-view] > nav > [class$="_navList"]{grid-area:2/1;display:flex;flex-direction:column;gap:4px;min-height:0;padding:12px 16px;overflow:auto;overscroll-behavior:contain}`,
6960
+ `${panel}[data-desktop-enhance-settings-view] > nav > [class$="_navList"] > button{height:auto;min-height:52px;width:100%;flex:none;padding:12px 14px;gap:12px;border-radius:10px;font-size:15px}`,
6961
+ `${panel}[data-desktop-enhance-settings-view] > nav > [class$="_navList"] > button > span{font-size:15px;white-space:normal;overflow-wrap:anywhere}`,
6962
+ `${panel}[data-desktop-enhance-settings-view] > nav > [class$="_navList"] > button::after{content:'›';margin-left:auto;font-size:22px;color:var(--dsw-alias-label-secondary)}`,
6963
+ `${panel}[data-desktop-enhance-settings-view] > [class$="_content"] > [class$="_header"]{grid-area:1/1;display:flex;justify-content:flex-end;align-items:center;gap:8px;min-height:56px;padding:6px 12px;box-sizing:border-box;border-bottom:1px solid var(--dsw-alias-border-l2)}`,
6964
+ `${panel}[data-desktop-enhance-settings-view] > [class$="_content"] > [class$="_options"]{grid-area:2/1;min-width:0;min-height:0;padding:16px;overflow:auto;overscroll-behavior:contain}`,
6965
+ `${panel}[data-desktop-enhance-settings-view="list"] > [class$="_content"] > [class$="_options"],${panel}[data-desktop-enhance-settings-view="list"] [data-desktop-enhance-settings-back]{display:none}`,
6966
+ `${panel}[data-desktop-enhance-settings-view="detail"] > nav > :is([class$="_navList"],[class$="_navTitle"]){display:none}`,
6967
+ `${panel} [data-desktop-enhance-settings-back]{border:0;background:transparent;color:var(--dsw-alias-label-primary);font:inherit;min-height:44px;padding:0 12px;margin-right:auto;cursor:pointer;white-space:nowrap}`,
6968
+ `${panel} > [class$="_content"] > [class$="_header"] button{min-height:44px;min-width:44px;flex-shrink:0;white-space:nowrap}`,
6969
+ `${panel} [class$="_rowHead"]{flex-wrap:wrap;gap:10px}`,
6970
+ `${panel} [class$="_rowHead"] > [class$="_rowIdentity"]{flex:1 1 100%;min-width:0;overflow-wrap:anywhere}`,
6971
+ `${panel} [class$="_rowActions"]{flex-wrap:wrap;gap:8px;min-width:0}`,
6972
+ `${panel} [class$="_rowActions"] button{min-height:44px;min-width:44px;padding:8px 12px;flex-shrink:0;white-space:nowrap}`,
6973
+ `${panel} :is(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),select){box-sizing:border-box;min-width:0;max-width:100%;min-height:44px;font-size:16px}`,
6974
+ `${panel} textarea{box-sizing:border-box;max-width:100%;min-height:88px;font-size:16px}`,
6975
+ `${panel} button:is([class$="_primaryButton"],[class$="_secondaryButton"],[class$="_dangerButton"]){min-height:44px;min-width:44px;flex-shrink:0;white-space:nowrap}`,
6976
+ `${panel} [class*="_field_"]{min-width:0}`,
6977
+ `${panel} [class*="_field_"] > [class*="_head_"],${panel} [class*="_form_"] > [class*="_footer_"]{flex-wrap:wrap;gap:8px}`,
6978
+ `${panel} [class*="_field_"] > input{box-sizing:border-box;width:100%;min-width:0;min-height:44px;font-size:16px}`,
6979
+ `${panel} [class*="_field_"] button,${panel} [class*="_form_"] > [class*="_footer_"] button{min-height:44px;min-width:44px;white-space:nowrap}`,
6980
+ `${panel} [data-slot="settings.general.item"] > *{flex-wrap:wrap;gap:12px;min-width:0}`,
6981
+ `${panel} [data-slot="settings.general.item"] > * > :first-child:not(button){min-width:0}`,
6982
+ `${panel} [data-slot="settings.general.item"] > * > button:not([role="switch"]){min-height:44px;max-width:100%;white-space:nowrap}`
6983
+ ];
6984
+ function mountMobileSettings(backLabel) {
6985
+ const mounted = new Map();
6986
+ function sync() {
6987
+ for (const [element, dispose] of mounted) if (!element.isConnected) {
6988
+ dispose();
6989
+ mounted.delete(element);
6990
+ }
6991
+ for (const element of globalThis.document.querySelectorAll(root)) {
6992
+ if (mounted.has(element)) continue;
6993
+ const nav = element.querySelector(":scope > nav > [class$=\"_navList\"]");
6994
+ const header = element.querySelector(":scope > [class$=\"_content\"] > [class$=\"_header\"]");
6995
+ if (!nav || !header) continue;
6996
+ const back = globalThis.document.createElement("button");
6997
+ back.type = "button";
6998
+ back.setAttribute("data-desktop-enhance-settings-back", "");
6999
+ back.textContent = backLabel();
7000
+ const showList = () => {
7001
+ element.setAttribute("data-desktop-enhance-settings-view", "list");
7002
+ nav.querySelector("[aria-current=\"true\"]")?.focus();
7003
+ };
7004
+ const select = (event) => {
7005
+ const target = event.target;
7006
+ if (!(target instanceof globalThis.Element)) return;
7007
+ const button = target.closest("button");
7008
+ if (!button || button.parentElement !== nav || button.disabled) return;
7009
+ element.setAttribute("data-desktop-enhance-settings-view", "detail");
7010
+ back.focus();
7011
+ };
7012
+ back.addEventListener("click", showList);
7013
+ nav.addEventListener("click", select);
7014
+ header.prepend(back);
7015
+ element.setAttribute("data-desktop-enhance-settings-view", "list");
7016
+ mounted.set(element, () => {
7017
+ back.removeEventListener("click", showList);
7018
+ nav.removeEventListener("click", select);
7019
+ back.remove();
7020
+ element.removeAttribute("data-desktop-enhance-settings-view");
7021
+ });
7022
+ }
7023
+ }
7024
+ const observer = new globalThis.MutationObserver(sync);
7025
+ observer.observe(globalThis.document.body, { childList: true });
7026
+ sync();
7027
+ return () => {
7028
+ observer.disconnect();
7029
+ for (const dispose of mounted.values()) dispose();
7030
+ mounted.clear();
7031
+ };
7032
+ }
7033
+ //#endregion
6948
7034
  //#region src/client/mobile/styles.ts
6949
7035
  const ADAPT_CSS = [
6950
7036
  "html:has(body.dsh-remote-portrait){overflow:hidden;overscroll-behavior:none}",
6951
- "body.dsh-remote-portrait{position:fixed;inset:0;width:100%;height:100%;overflow:hidden;overscroll-behavior:none}",
7037
+ "body.dsh-remote-portrait{position:fixed;inset:var(--desktop-enhance-viewport-top,0px) 0 auto;width:100%;height:var(--desktop-enhance-viewport-height,100%);overflow:hidden;overscroll-behavior:none}",
6952
7038
  "body.dsh-remote-portrait [class*=\"_frame\"]:has([class*=\"_centerCol\"]){width:100%;height:var(--desktop-enhance-viewport-height,100dvh);max-height:100%;overflow:hidden}",
6953
7039
  `body.dsh-remote-portrait{--dsh-content-font-size:14px !important;--dsh-content-font-size-secondary:12.5px !important;--dsh-content-font-delta:0px !important;--dsh-content-font-delta-secondary:0px !important;--dsh-code-font-size:12px !important;--dsh-code-font-delta:0px !important;--dsh-terminal-font-size:12px !important;--dsh-composer-side-clearance:10px !important;--dsw-font-markdown-base:400 14px/21px var(--dsw-font-family) !important;--dsw-font-markdown-base-font-size:14px !important;--dsw-font-markdown-base-line-height:21px !important;--dsw-font-markdown-base-strong:600 14px/21px var(--dsw-font-family) !important;--dsw-font-markdown-h1:700 16.5px/23px var(--dsw-font-family) !important;--dsw-font-markdown-h2:700 15.5px/22px var(--dsw-font-family) !important;--dsw-font-markdown-h3:600 14.5px/21px var(--dsw-font-family) !important;--dsw-font-markdown-h4:600 14px/20px var(--dsw-font-family) !important}`,
6954
7040
  "[class$=\"_railFish\"] button,[class$=\"_panelIcon\"],[class$=\"_newSession\"]{min-width:44px;min-height:44px}",
7041
+ "body.dsh-remote-portrait [data-conversation-scroll]{overflow-x:hidden}",
6955
7042
  `body.dsh-remote-portrait [class$="_scroll"]{padding:8px 12px !important}`,
6956
7043
  "[class$=\"_input\"],textarea,input{font-size:16px}",
6957
7044
  "[class$=\"_composer\"]{padding-bottom:calc(4px + env(safe-area-inset-bottom))}",
@@ -6988,7 +7075,12 @@ window.__ModuleLoader__.load({
6988
7075
  `body.dsh-remote-portrait [class$="_crumb"]{max-width:none;padding:2px 4px;font-size:13.5px}`,
6989
7076
  `body.dsh-remote-portrait header[class*="_header"] [class$="_headerActions"]{margin-left:auto;gap:4px}`,
6990
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}`,
6991
7082
  `#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
+ `#dshRemoteWhale{translate:0 var(--desktop-enhance-viewport-top,0px)}`,
6992
7084
  `#dshRemoteWhale svg{width:20px;height:15px;display:block}`,
6993
7085
  `#dshRemoteWhale:active{opacity:.72}`,
6994
7086
  `#dshRemoteWhale [data-mobile-connection-label]{position:absolute;left:calc(100% + 7px);top:50%;transform:translateY(-50%);max-width:calc(50vw - 36px);padding:5px 8px;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-primary);font-size:12px;line-height:18px;white-space:nowrap;box-shadow:0 2px 8px var(--dsw-alias-interactive-bg-hover);pointer-events:none}`,
@@ -7023,8 +7115,9 @@ window.__ModuleLoader__.load({
7023
7115
  "[class$=\"_composerSeat\"] [class$=\"_primary\"]:has(~ [class$=\"_primary\"]){right:48px}",
7024
7116
  "[class$=\"_composerSeat\"] [class$=\"_dock\"]{padding-top:2px;gap:8px}",
7025
7117
  "[class$=\"_composerSeat\"]{transform:none !important}",
7026
- `body.dsh-remote-portrait[data-mobile-bottom-sheet] [class$="_composerSeat"] [class$="_menu"],body.dsh-remote-portrait[data-mobile-bottom-sheet] > [class$="_menu"]{position:fixed !important;left:12px !important;right:12px !important;top:auto !important;bottom:calc(56px + env(safe-area-inset-bottom)) !important;width:auto !important;max-width:none !important;max-height:65dvh !important;overflow-y:auto !important;z-index:2147482000 !important}`,
7027
- `body.dsh-remote-portrait[data-mobile-bottom-sheet] [class$="_composerSeat"] [class$="_menu"] [class$="_cell"],body.dsh-remote-portrait[data-mobile-bottom-sheet] > [class$="_menu"] [class$="_cell"]{height:44px;min-height:44px;font-size:13px}`,
7118
+ `body.dsh-remote-portrait[data-mobile-bottom-sheet] [class$="_composerSeat"] [class$="_menu"]:not([data-trigger-menu]){position:fixed !important;left:12px !important;right:12px !important;top:auto !important;bottom:calc(56px + env(safe-area-inset-bottom)) !important;width:auto !important;max-width:none !important;max-height:65dvh !important;overflow-y:auto !important;z-index:2147482000 !important}`,
7119
+ "body.dsh-remote-portrait [data-composer-seat] [data-trigger-menu]{max-height:min(400px,max(0px,calc(var(--desktop-enhance-viewport-height,100dvh) - var(--dsh-composer-height,0px) - 84px))) !important}",
7120
+ `body.dsh-remote-portrait[data-mobile-bottom-sheet] [class$="_composerSeat"] [class$="_menu"] [class$="_cell"]{height:44px;min-height:44px;font-size:13px}`,
7028
7121
  `body.dsh-remote-portrait[data-mobile-bottom-sheet] .dsh-codex-quota-popover{position:fixed !important;left:12px !important;right:12px !important;top:auto !important;bottom:calc(56px + env(safe-area-inset-bottom)) !important;width:auto !important;max-width:none !important;z-index:2147482000 !important}`,
7029
7122
  "[class$=\"_composerSeat\"] [data-slot=\"conversation.composer.dock\"] [class$=\"_root\"]{font-size:10px;white-space:normal;word-break:break-word;overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-align:left;line-height:13px;letter-spacing:-0.2px;padding-left:0;padding-right:0}",
7030
7123
  "[class*=\"_bubble\"][role=\"tooltip\"]{display:none}",
@@ -7044,13 +7137,7 @@ window.__ModuleLoader__.load({
7044
7137
  `body.dsh-remote-portrait [data-dsh-plugin="pet"],`,
7045
7138
  `body.dsh-remote-portrait [data-dsh-plugin="usage"]{display:none !important}`,
7046
7139
  `body.dsh-remote-portrait [class$="_overlayLayer"] [class$="_workbench"]{display:none !important}`,
7047
- `body.dsh-remote-portrait [class$="_overlay"] [class$="_panel"]{flex-direction:column;max-height:calc(100dvh - 32px)}`,
7048
- `body.dsh-remote-portrait [class$="_overlay"] [class$="_panel"] [class$="_nav"]{flex-direction:row;gap:4px;width:100%;padding:12px 12px 0;overflow-x:auto;overflow-y:hidden}`,
7049
- `body.dsh-remote-portrait [class$="_overlay"] [class$="_panel"] [class$="_navTitle"]{display:none}`,
7050
- `body.dsh-remote-portrait [class$="_overlay"] [class$="_panel"] [class$="_navList"]{flex-direction:row;gap:4px}`,
7051
- `body.dsh-remote-portrait [class$="_overlay"] [class$="_panel"] [class$="_navCell"]{height:34px;padding:0 12px;gap:6px;flex:none;border-radius:10px}`,
7052
- `body.dsh-remote-portrait [class$="_overlay"] [class$="_panel"] [class$="_navLabel"]{font-size:13px}`,
7053
- `body.dsh-remote-portrait [class$="_overlay"] [class$="_panel"] [class$="_content"]{flex:1;min-height:0}`
7140
+ ...MOBILE_SETTINGS_CSS
7054
7141
  ];
7055
7142
  //#endregion
7056
7143
  //#region src/client/mobile/index.ts
@@ -7112,6 +7199,7 @@ window.__ModuleLoader__.load({
7112
7199
  const FISH_PATH = "M22.9168 1.43018C22.6713 1.31018 22.5658 1.53918 22.4223 1.65519C22.3733 1.69269 22.3318 1.74169 22.2903 1.78669C21.9317 2.1697 21.5127 2.42121 20.9657 2.39121C20.1657 2.34621 19.4827 2.59771 18.8787 3.20973C18.7502 2.45521 18.3236 2.0047 17.6746 1.71569C17.3351 1.56568 16.9916 1.41518 16.7536 1.08867C16.5876 0.856163 16.5421 0.597155 16.4591 0.341647C16.4061 0.187643 16.3536 0.0301382 16.1761 0.00363739C15.9836 -0.0263635 15.9081 0.135141 15.8326 0.270145C15.5306 0.822162 15.4136 1.43018 15.4251 2.0462C15.4516 3.43174 16.0366 4.53527 17.1991 5.3203C17.3311 5.4103 17.3651 5.5003 17.3236 5.63181C17.2441 5.90231 17.1501 6.16482 17.0671 6.43533C17.0141 6.60784 16.9351 6.64584 16.7501 6.57033C16.1121 6.30383 15.5611 5.90931 15.074 5.4328C14.2475 4.63328 13.5 3.75075 12.568 3.05973C12.349 2.89822 12.13 2.74822 11.9034 2.60522C10.9524 1.68169 12.028 0.923165 12.277 0.833162C12.5375 0.739159 12.3675 0.41615 11.5259 0.42015C10.6844 0.42365 9.91439 0.705658 8.93286 1.08117C8.78935 1.13767 8.63835 1.17867 8.48384 1.21267C7.59332 1.04367 6.66829 1.00617 5.70226 1.11517C3.88321 1.31768 2.43016 2.1777 1.36213 3.64575C0.0790928 5.4103 -0.222916 7.41536 0.146595 9.50642C0.535106 11.7105 1.66014 13.535 3.38869 14.9616C5.18125 16.4406 7.24581 17.1657 9.60138 17.0266C11.0319 16.9441 12.6245 16.7526 14.421 15.2321C14.874 15.4576 15.3496 15.5476 16.1381 15.6151C16.7456 15.6716 17.3306 15.5851 17.7836 15.4911C18.4931 15.3411 18.4441 14.6841 18.1876 14.5636C16.1081 13.595 16.5646 13.9891 16.1496 13.67C17.2061 12.42 18.8202 10.1979 19.3182 7.17235C19.3672 6.83834 19.4297 6.36783 19.4222 6.09732C19.4182 5.93231 19.4562 5.86831 19.6447 5.84931C20.1657 5.78931 20.6712 5.64681 21.1357 5.3913C22.4833 4.65528 23.0268 3.44624 23.1548 1.9972C23.1738 1.77569 23.1508 1.54668 22.9168 1.43018Z";
7113
7200
  const surfaceText = (key, fallback) => actions.t(key) || fallback;
7114
7201
  let active = false;
7202
+ let disposeSettings = null;
7115
7203
  let savedViewportContent = null;
7116
7204
  let whaleEl = null;
7117
7205
  let connectionStatus = "unknown";
@@ -7149,6 +7237,7 @@ window.__ModuleLoader__.load({
7149
7237
  if (viewport && viewport.scale !== 1) return;
7150
7238
  viewportHeight = viewport?.height ?? globalThis.window.innerHeight;
7151
7239
  globalThis.document.body.style.setProperty("--desktop-enhance-viewport-height", `${viewportHeight}px`);
7240
+ globalThis.document.body.style.setProperty("--desktop-enhance-viewport-top", `${viewport?.offsetTop ?? 0}px`);
7152
7241
  if (drag === null) applyWhalePos();
7153
7242
  }
7154
7243
  let whaleEvents = null;
@@ -7182,6 +7271,7 @@ window.__ModuleLoader__.load({
7182
7271
  forgetAbsentSelectors();
7183
7272
  globalThis.document.body.classList.add(ACTIVE_CLASS);
7184
7273
  ensureAdaptStyle();
7274
+ disposeSettings = mountMobileSettings(() => actions.t("mobile.settings.back"));
7185
7275
  const meta = globalThis.document.querySelector("meta[name=viewport]");
7186
7276
  if (meta instanceof globalThis.HTMLMetaElement && meta.getAttribute("content") !== null && !(meta.getAttribute("content") ?? "").includes("viewport-fit")) {
7187
7277
  savedViewportContent = meta.getAttribute("content");
@@ -7195,6 +7285,8 @@ window.__ModuleLoader__.load({
7195
7285
  function revert() {
7196
7286
  if (!active) return;
7197
7287
  active = false;
7288
+ disposeSettings?.();
7289
+ disposeSettings = null;
7198
7290
  clearLongPress();
7199
7291
  cancelTimeouts();
7200
7292
  restoreActionStyles();
@@ -7209,6 +7301,7 @@ window.__ModuleLoader__.load({
7209
7301
  restoreRowDrag();
7210
7302
  globalThis.document.body.classList.remove(ACTIVE_CLASS);
7211
7303
  globalThis.document.body.style.removeProperty("--desktop-enhance-viewport-height");
7304
+ globalThis.document.body.style.removeProperty("--desktop-enhance-viewport-top");
7212
7305
  globalThis.document.body.classList.remove(RAIL_HIDDEN_CLASS);
7213
7306
  globalThis.document.body.classList.remove(WHALE_MOVED_CLASS);
7214
7307
  globalThis.document.body.removeAttribute("data-mobile-bottom-sheet");
@@ -7484,7 +7577,10 @@ window.__ModuleLoader__.load({
7484
7577
  }
7485
7578
  listen(globalThis.window, "orientationchange", evaluate);
7486
7579
  listen(globalThis.window, "resize", evaluate);
7487
- if (globalThis.window.visualViewport) listen(globalThis.window.visualViewport, "resize", syncViewport);
7580
+ if (globalThis.window.visualViewport) {
7581
+ listen(globalThis.window.visualViewport, "resize", syncViewport);
7582
+ listen(globalThis.window.visualViewport, "scroll", syncViewport);
7583
+ }
7488
7584
  listen(globalThis.window, "pageshow", evaluate);
7489
7585
  listen(globalThis.document, "visibilitychange", () => {
7490
7586
  setWhaleTimer(globalThis.document.visibilityState !== "hidden");
@@ -7860,27 +7956,45 @@ window.__ModuleLoader__.load({
7860
7956
  const OWNED = "data-desktop-enhance-abnormal-fork-button";
7861
7957
  function takeNativeFork(root, label, run, isDisabled) {
7862
7958
  const originals = new Map();
7959
+ const restoreTooltip = (original) => {
7960
+ const saved = original.tooltip;
7961
+ if (saved && saved.node.textContent === label) saved.node.textContent = saved.text;
7962
+ delete original.tooltip;
7963
+ };
7863
7964
  const refresh = () => {
7864
- for (const [button, original] of originals) {
7965
+ for (const button of originals.keys()) {
7865
7966
  if (button.getAttribute("data-unavailable") === "true") continue;
7866
7967
  button.removeAttribute(OWNED);
7867
- if (original.title === null) button.removeAttribute("title");
7868
- else button.setAttribute("title", original.title);
7869
7968
  originals.delete(button);
7870
7969
  }
7871
7970
  const row = root.querySelector(":scope > [data-clock=\"end\"]");
7872
7971
  for (const child of Array.from(row?.children ?? [])) {
7873
7972
  if (!(child instanceof globalThis.HTMLButtonElement) || child.getAttribute("aria-label") !== label || child.getAttribute("data-unavailable") !== "true") continue;
7874
- if (!originals.has(child)) originals.set(child, {
7875
- disabled: child.getAttribute("aria-disabled"),
7876
- described: child.getAttribute("aria-describedby"),
7877
- title: child.getAttribute("title")
7878
- });
7973
+ let original = originals.get(child);
7974
+ if (!original) {
7975
+ original = {
7976
+ disabled: child.getAttribute("aria-disabled"),
7977
+ described: child.getAttribute("aria-describedby")
7978
+ };
7979
+ originals.set(child, original);
7980
+ }
7879
7981
  child.setAttribute(OWNED, "");
7880
7982
  const desired = isDisabled() ? "true" : "false";
7881
7983
  if (child.getAttribute("aria-disabled") !== desired) child.setAttribute("aria-disabled", desired);
7882
7984
  child.removeAttribute("aria-describedby");
7883
- child.setAttribute("title", label);
7985
+ const bubble = child.nextElementSibling;
7986
+ const content = bubble?.getAttribute("role") === "tooltip" ? bubble.firstElementChild : null;
7987
+ if (original.tooltip?.node !== content) {
7988
+ restoreTooltip(original);
7989
+ if (content) original.tooltip = {
7990
+ node: content,
7991
+ text: content.textContent
7992
+ };
7993
+ }
7994
+ if (content && content.textContent !== label) {
7995
+ if (original.tooltip) original.tooltip.text = content.textContent;
7996
+ content.textContent = label;
7997
+ }
7884
7998
  }
7885
7999
  };
7886
8000
  const onClick = (event) => {
@@ -7890,21 +8004,12 @@ window.__ModuleLoader__.load({
7890
8004
  event.stopPropagation();
7891
8005
  if (!isDisabled()) run();
7892
8006
  };
7893
- const suppressUnavailableTooltip = (event) => {
7894
- const target = event.target instanceof globalThis.Element ? event.target.closest("button") : null;
7895
- if (target && originals.has(target) && target.getAttribute("data-unavailable") === "true") event.stopPropagation();
7896
- };
7897
- const tooltipEvents = [
7898
- "mouseover",
7899
- "pointerover",
7900
- "focusin"
7901
- ];
7902
- for (const name of tooltipEvents) root.addEventListener(name, suppressUnavailableTooltip, true);
7903
8007
  root.addEventListener("click", onClick, true);
7904
8008
  const observer = new globalThis.MutationObserver(refresh);
7905
8009
  observer.observe(root, {
7906
8010
  childList: true,
7907
8011
  subtree: true,
8012
+ characterData: true,
7908
8013
  attributes: true,
7909
8014
  attributeFilter: [
7910
8015
  "aria-disabled",
@@ -7916,12 +8021,10 @@ window.__ModuleLoader__.load({
7916
8021
  return () => {
7917
8022
  observer.disconnect();
7918
8023
  root.removeEventListener("click", onClick, true);
7919
- for (const name of tooltipEvents) root.removeEventListener(name, suppressUnavailableTooltip, true);
7920
8024
  for (const [button, original] of originals) {
7921
8025
  button.removeAttribute(OWNED);
7922
- if (original.title === null) button.removeAttribute("title");
7923
- else button.setAttribute("title", original.title);
7924
8026
  if (button.getAttribute("data-unavailable") !== "true") continue;
8027
+ restoreTooltip(original);
7925
8028
  const attributes = [["aria-disabled", original.disabled], ["aria-describedby", original.described]];
7926
8029
  for (const [key, value] of attributes) if (value === null) button.removeAttribute(key);
7927
8030
  else button.setAttribute(key, value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-desktop-enhance",
3
- "version": "0.6.7",
3
+ "version": "0.6.9",
4
4
  "description": "DSH Desktop 界面增强:页内查找(Cmd+F)、轮次编号、上下文压缩行常显、建议、每步耗时、折叠文件夹状态计数、会话信息(含上下文注入 C1 视图)、工具管理、Skill 管理、独立远程接入与手机体验。",
5
5
  "type": "module",
6
6
  "icon": "./icon.svg",
@@ -32,18 +32,6 @@
32
32
  "icon.svg",
33
33
  "cordis.patch.yml"
34
34
  ],
35
- "scripts": {
36
- "build": "tsdown",
37
- "dev": "tsdown --watch",
38
- "typecheck": "tsc --noEmit",
39
- "test": "node --test tests/*.test.mjs",
40
- "test:isolation": "./tools/test-isolation.sh",
41
- "verify": "pnpm typecheck && pnpm build && pnpm test && pnpm test:isolation",
42
- "prepack": "pnpm build",
43
- "prepublishOnly": "pnpm verify",
44
- "release:patch": "npm version patch && pnpm publish",
45
- "release:minor": "npm version minor && pnpm publish"
46
- },
47
35
  "publishConfig": {
48
36
  "access": "public"
49
37
  },
@@ -62,5 +50,15 @@
62
50
  "@types/react": "^18.3.31",
63
51
  "tsdown": "0.23.0",
64
52
  "typescript": "5.9.3"
53
+ },
54
+ "scripts": {
55
+ "build": "tsdown",
56
+ "dev": "tsdown --watch",
57
+ "typecheck": "tsc --noEmit",
58
+ "test": "node --test tests/*.test.mjs",
59
+ "test:isolation": "./tools/test-isolation.sh",
60
+ "verify": "pnpm typecheck && pnpm build && pnpm test && pnpm test:isolation",
61
+ "release:patch": "npm version patch && pnpm publish",
62
+ "release:minor": "npm version minor && pnpm publish"
65
63
  }
66
- }
64
+ }