dsh-codex-model-effort-ui 1.1.5 → 1.1.7

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.
package/README.md CHANGED
@@ -16,6 +16,7 @@
16
16
  - [推理强度面板](#推理强度面板)
17
17
  - [模型面板](#模型面板)
18
18
  - [使用](#使用)
19
+ - [实现要点](#实现要点)
19
20
  - [兼容性与已知限制](#兼容性与已知限制)
20
21
  - [开发](#开发)
21
22
  - [文件结构](#文件结构)
@@ -24,7 +25,7 @@
24
25
 
25
26
  ## 这是什么
26
27
 
27
- DSH 输入框上原本只有一枚很小的模型按钮。本插件用 `priority: -1` **接管**它,点开是一个 Codex 风格的弹层,里面是两块面板:
28
+ DSH 输入框上原本只有一枚很小的模型按钮。本插件用 `priority: -1` **接管** `conversation.input.model` 座位,点开是一个 Codex 风格的弹层,里面是两块面板:
28
29
 
29
30
  | 面板 | 内容 |
30
31
  |---|---|
@@ -42,8 +43,8 @@ dsh plugin --profile web add dsh-codex-model-effort-ui # NPM 源
42
43
  dsh plugin --profile web add github:zxclf/dsh-codex-model-effort-ui # GitHub 源
43
44
  ```
44
45
 
45
- > **DSH Desktop 需在应用内手动安装**
46
- >
46
+ > [!NOTE]
47
+ > **DSH Desktop 需在应用内手动安装**,且安装后需**重启 DSH Desktop** 才生效(客户端 bundle 在启动时注入)。
47
48
  > 安装后,输入框右侧的模型按钮会变成 Codex 风格的收起态按钮(见 [使用](#使用))。
48
49
 
49
50
  ---
@@ -99,11 +100,24 @@ dsh plugin --profile web add github:zxclf/dsh-codex-model-effort-ui # GitHub 源
99
100
 
100
101
  ---
101
102
 
103
+ ## 实现要点
104
+
105
+ 几个值得知道的实现决策(便于二次开发 / 排查):
106
+
107
+ - **浮层 portal 到 `document.body`**:宿主给输入区座位 `.composerSeat` 写了 `will-change: transform`,按规范这会让 seat 成为每个 `position: fixed` 后代的包含块,导致弹层整体平移并被 `z-index: 9` 层叠上下文压住。弹层与 tooltip 一并 portal 到 body 后,`fixed` 重新相对视口解析,`z-index` 在根上下文生效。DSH 自家浮层(StatsPills / TurnUsagePanel 等)采用同一做法。
108
+ - **强度领域纯函数独立成块**:阶梯归类、调色板、混色、滑轨指针映射、星尘/绽放生成都在 `client.effort.js`,不依赖 React/DOM,可用 Node 直接单测。
109
+ - **调色板过三道 WCAG 底线**并由测试守护:填充色 vs 未填充滑轨 `≥ 2.5`、圆钮 vs 填充色 `≥ 2.2`、标题墨色 vs 卡片 `≥ 4.5`(深浅两主题分别验证)。
110
+ - **星尘 / 绽放确定性生成**:相位用低差异序列、其余用哈希,不用 `Math.random`,重新渲染不会重新洗牌。
111
+ - **fail-open 约定**:localStorage、懒加载分块、`remote.agentTeams` 注入等全部有保护,失败只损失对应增强功能,绝不影响输入框。
112
+ - **焦点陷阱**:弹层 `role="dialog"`,打开期间拦下 `Tab` 在首/末可聚焦元素处循环,焦点始终圈在弹层内。
113
+
114
+ ---
115
+
102
116
  ## 兼容性与已知限制
103
117
 
104
118
  | 项 | 说明 |
105
119
  |---|---|
106
- | DSH | 已在 **DSH Desktop 0.2.1-rc.2(Windows)** 实机验证;`0.2.0-rc.2` 仍可用(`renderSlot` 缺失时回退) |
120
+ | DSH | 已在 **DSH Desktop 0.2.1-rc.2(Windows)** 实机验证;`0.2.0-rc.2` 仍可用(依赖 `conversation.input.model` slot 契约,官方若改动该形状则本插件静默退回、不破坏官方界面) |
107
121
  | 主题 | 跟随 DSH 主题令牌(`--dsw-*`),令牌缺失时回退到中性灰 + `#4d93f8` 蓝 |
108
122
 
109
123
  ### 已知限制
@@ -124,12 +138,11 @@ pnpm install # 安装开发依赖
124
138
  pnpm check # 运行 lint + 测试
125
139
  ```
126
140
 
127
-
128
141
  | 命令 | 作用 |
129
142
  |---|---|
130
143
  | `pnpm install` | 首次安装 ESLint 等开发依赖 |
131
144
  | `pnpm lint` | ESLint(含 react-hooks 规则) |
132
- | `pnpm test` | node:test,纯函数与 i18n 回归 |
145
+ | `pnpm test` | node:test,纯函数与 i18n 回归(11 个用例) |
133
146
  | `pnpm check` | lint + test |
134
147
 
135
148
  `pnpm-workspace.yaml` 关闭了 peer 自动安装:`@deepseek-ai/dsh` 是宿主提供的运行时依赖。
@@ -145,7 +158,7 @@ pnpm check # 运行 lint + 测试
145
158
  | `client.styles.js` | CSS 字符串与布局度量 `METRICS` |
146
159
  | `index.js` | 插件入口(`apply` 空实现) |
147
160
 
148
- 测试位于 `test/`:`effort.test.mjs` 覆盖强度领域函数与调色板对比度底线,`locale.test.mjs` 覆盖词典键集、占位符一致性和硬编码文案检查。
161
+ 测试位于 `test/`:`effort.test.mjs` 覆盖强度领域函数与调色板对比度底线,`locale.test.mjs` 覆盖词典键集、占位符一致性和硬编码文案检查,`loader.mjs` 提供最小 `window.__ModuleLoader__` 沙箱。
149
162
 
150
163
  ---
151
164
 
package/client.effort.js CHANGED
@@ -147,7 +147,7 @@ window.__ModuleLoader__.load({
147
147
  }
148
148
 
149
149
  function rank(id) {
150
- const i = EFFORT_ORDER.indexOf(String(id).toLowerCase());
150
+ const i = EFFORT_ORDER.indexOf(String(id).toLowerCase().trim());
151
151
  return i === -1 ? 50 : i;
152
152
  }
153
153
  /** 按 Codex 阶梯顺序排序模型声明的强度项。 */
@@ -157,7 +157,7 @@ window.__ModuleLoader__.load({
157
157
  /** 强度的本地化标签;无法匹配时回退到模型自身的名称。 */
158
158
  function effortLabel(effort, t) {
159
159
  if (!effort) return '';
160
- const key = EFFORT_KEY[String(effort.id).toLowerCase()];
160
+ const key = EFFORT_KEY[String(effort.id).toLowerCase().trim()];
161
161
  if (key) {
162
162
  const translated = t(key);
163
163
  // 键缺失时 locale 查找会把键名原样返回
package/client.js CHANGED
@@ -12,6 +12,7 @@ window.__ModuleLoader__.load({
12
12
  id: 'dsh-codex-model-effort-ui',
13
13
  factory(require) {
14
14
  const React = require('react');
15
+ const { createPortal } = require('react-dom');
15
16
  const h = React.createElement;
16
17
  const { useState, useEffect, useLayoutEffect, useRef, useSyncExternalStore, useMemo, lazy, Suspense } = React;
17
18
 
@@ -28,10 +29,10 @@ window.__ModuleLoader__.load({
28
29
  usage: '用量更多', visual: '(仅视觉效果)', reset: '重置为默认',
29
30
  warning: '更快消耗使用额度', model: '切换模型', back: '返回',
30
31
  loading: '正在加载模型', empty: '没有可用模型',
31
- unsupported: '此模型未提供推理强度', retry: '重试',
32
+ unsupported: '此模型未提供推理强度',
32
33
  busy: '正在切换', failed: '切换失败',
33
34
  unavailable: '此会话不能切换模型',
34
- search: '搜索模型', noMatch: '没有匹配的模型', clear: '清除搜索',
35
+ search: '搜索模型', noMatch: '没有匹配的模型',
35
36
  team: '多团队协作',
36
37
  teamDesc: '开启后由多个子代理协同完成当前会话的工作,可在任务面板查看进度',
37
38
  teamFailed: '协作开关切换失败',
@@ -48,10 +49,10 @@ window.__ModuleLoader__.load({
48
49
  usage: 'Uses more quota', visual: '(Visual only)', reset: 'Reset to default',
49
50
  warning: 'Consumes usage quota faster', model: 'Switch model', back: 'Back',
50
51
  loading: 'Loading models', empty: 'No available models',
51
- unsupported: 'This model provides no reasoning effort levels', retry: 'Retry',
52
+ unsupported: 'This model provides no reasoning effort levels',
52
53
  busy: 'Switching', failed: 'Selection failed',
53
54
  unavailable: 'Model selection unavailable',
54
- search: 'Search models', noMatch: 'No matching models', clear: 'Clear search',
55
+ search: 'Search models', noMatch: 'No matching models',
55
56
  team: 'Agent Teams',
56
57
  teamDesc: 'Let subagents work on this session together; progress appears in the task panel',
57
58
  teamFailed: 'Could not switch Agent Teams',
@@ -96,7 +97,6 @@ window.__ModuleLoader__.load({
96
97
  check: 'm20 6-11 11-5-5',
97
98
  reset: 'M3 11a9 9 0 1 1 2.6 7M3 4v7h7',
98
99
  info: 'M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18ZM12 11v5M12 7.4v.01',
99
- close: 'M6 6l12 12M18 6L6 18',
100
100
  search: 'M11 4a7 7 0 1 0 0 14 7 7 0 0 0 0-14ZM20 20l-4-4',
101
101
  model: 'M12 3 3 8l9 5 9-5-9-5ZM3 12l9 5 9-5M3 16l9 5 9-5',
102
102
  bolt: 'M14.4 2Q16 .2 15.8 2.5L15.1 8.5H20.5Q22 8.5 21 9.8L10.7 21.7Q9 23.4 9.2 21.2L10 14.2H4.2Q2.6 14.2 3.6 12.9L14.4 2Z'
@@ -109,6 +109,27 @@ window.__ModuleLoader__.load({
109
109
  }, h('path', { d: ICON[name] || ICON.chevron }));
110
110
  }
111
111
 
112
+ /* 焦点陷阱:弹层是 role="dialog",Tab 不该走出它落到背景页上。
113
+ * 在弹层打开期间拦下 Tab,在「首个 / 末个」可聚焦元素处掉头循环,
114
+ * 把焦点始终圈在弹层内。只处理 Tab,其余按键(方向键 / Enter /
115
+ * Escape)原样放行,不与滑轨、搜索框、模型列表的键盘逻辑抢事件。
116
+ * 宿主若注入了自己的陷阱,这里只是冗余兜底;未注入时补齐缺口。 */
117
+ const FOCUSABLE = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])';
118
+ function trapFocus(section, event) {
119
+ if (event.key !== 'Tab') return;
120
+ const nodes = Array.from(section.querySelectorAll(FOCUSABLE))
121
+ .filter(el => !el.closest(`.${P}-pane.hidden`) && (el.offsetWidth > 0 || el.offsetHeight > 0));
122
+ if (!nodes.length) return;
123
+ const first = nodes[0];
124
+ const last = nodes[nodes.length - 1];
125
+ const active = section.ownerDocument.activeElement;
126
+ if (event.shiftKey) {
127
+ if (active === first || !section.contains(active)) { event.preventDefault(); last.focus({ preventScroll: true }); }
128
+ } else if (active === last || !section.contains(active)) {
129
+ event.preventDefault(); first.focus({ preventScroll: true });
130
+ }
131
+ }
132
+
112
133
  /* ------------------------------------------------------------------ *
113
134
  * Fast 开关 —— 按会话持久化
114
135
  * 本插件是 fail-open 的,因此每次存储访问都有保护:失败只损失重启后
@@ -149,38 +170,24 @@ window.__ModuleLoader__.load({
149
170
  * 可复用的定位 / 状态 Hook
150
171
  * ================================================================== */
151
172
 
152
- /* 固定定位层所在的包含块,以视口坐标表示,由探针元素测量得到
153
- * (见 `probeRef`):其左上角是包含块的 padding 原点,其底边是包含块
154
- * 的底部。探针尚未挂载时,包含块就是视口。 */
155
- function containingBoxOf(probe) {
156
- if (probe) {
157
- const box = probe.getBoundingClientRect();
158
- return { left: box.left, top: box.top, bottom: box.bottom };
159
- }
160
- return {
161
- left: 0,
162
- top: 0,
163
- bottom: typeof window === 'undefined' ? 0 : window.innerHeight
164
- };
165
- }
166
-
167
- function positionAbove(anchor, tip, box, fallbackW, fallbackH) {
173
+ /* 弹层与 tooltip 都通过 createPortal 渲染到 document.body(见 render 处
174
+ * 的说明),因此它们的 position:fixed 恒相对视口解析——不必再测量包含块,
175
+ * 直接写视口坐标即可。 */
176
+ function positionAbove(anchor, tip, fallbackW, fallbackH) {
168
177
  if (!anchor || !tip) return;
169
178
  const r = anchor.getBoundingClientRect();
170
179
  const tw = tip.offsetWidth || fallbackW;
171
180
  const th = tip.offsetHeight || fallbackH;
172
181
  const left = Math.max(8, Math.min(r.left + r.width / 2 - tw / 2, window.innerWidth - tw - 8));
173
182
  const top = Math.max(8, r.top - th - 7);
174
- tip.style.left = `${left - box.left}px`;
175
- tip.style.top = `${top - box.top}px`;
183
+ tip.style.left = `${left}px`;
184
+ tip.style.top = `${top}px`;
176
185
  }
177
186
 
178
- function useAnchoredTip(shown, anchorRef, tipRef, probeRef, fallbackW, fallbackH) {
187
+ function useAnchoredTip(shown, anchorRef, tipRef, fallbackW, fallbackH) {
179
188
  useLayoutEffect(() => {
180
189
  if (!shown) return;
181
- const place = () => positionAbove(
182
- anchorRef.current, tipRef.current, containingBoxOf(probeRef.current), fallbackW, fallbackH
183
- );
190
+ const place = () => positionAbove(anchorRef.current, tipRef.current, fallbackW, fallbackH);
184
191
  place();
185
192
  window.addEventListener('resize', place);
186
193
  document.addEventListener('scroll', place, true);
@@ -188,43 +195,53 @@ window.__ModuleLoader__.load({
188
195
  window.removeEventListener('resize', place);
189
196
  document.removeEventListener('scroll', place, true);
190
197
  };
191
- }, [shown, anchorRef, tipRef, probeRef, fallbackW, fallbackH]);
198
+ }, [shown, anchorRef, tipRef, fallbackW, fallbackH]);
192
199
  }
193
200
 
194
201
  /* 弹出面板的定位、高度余量与外部关闭 / Escape。
195
202
  * 回调经 ref 读取,监听器只随 open 重绑一次,避免闭包过期。 */
196
- function usePopoverLayout({ open, rootRef, popupRef, probeRef, triggerRef, onOutside, onEscape }) {
203
+ function usePopoverLayout({ open, rootRef, popupRef, triggerRef, onOutside, onEscape }) {
197
204
  const [room, setRoom] = useState(0);
198
205
  const handlersRef = useRef({ onOutside, onEscape });
199
206
  useLayoutEffect(() => { handlersRef.current = { onOutside, onEscape }; });
200
207
 
208
+ /* 把触发按钮对齐到弹层:直接写视口 top/left,并回写高度余量。
209
+ * 只读 ref 与 window,因此是引用稳定的——既能被下面的 layout effect
210
+ * 绑定到事件上,也能被 `primeRoom` 在打开前直接调用,把首帧的
211
+ * top/left 一并预置(否则首帧会用 CSS 里的回退坐标画一帧再跳正)。 */
212
+ const align = React.useCallback(() => {
213
+ const trigger = triggerRef.current?.getBoundingClientRect();
214
+ const popup = popupRef.current;
215
+ if (!trigger || !popup || !popup.isConnected) return;
216
+ const width = Math.min(272, window.innerWidth - 24);
217
+ const left = Math.max(12, Math.min((trigger.left + trigger.right - width) / 2, window.innerWidth - width - 12));
218
+ /* 弹出面板 portal 到 body,position:fixed 恒相对视口,所以直接用
219
+ * 视口坐标:面板底边停在触发按钮上方 8px。 */
220
+ popup.style.setProperty(`--${P}-left`, `${left}px`);
221
+ popup.style.setProperty(`--${P}-top`, `${Math.max(12, trigger.top - popup.offsetHeight - 8)}px`);
222
+ /* 触发按钮上方的空间:驱动高度钳制,同时写回 state,让 render
223
+ * 不必自己读布局。 */
224
+ const roomAbove = Math.max(120, trigger.top - 20);
225
+ popup.style.setProperty(`--${P}-room`, `${roomAbove}px`);
226
+ setRoom(prev => (prev === roomAbove ? prev : roomAbove));
227
+ }, [popupRef, triggerRef]);
228
+
201
229
  useLayoutEffect(() => {
202
230
  if (!open) return;
203
231
  let frame = 0;
204
232
  function outside(event) {
205
- if (!rootRef.current?.contains(event.target)) handlersRef.current.onOutside(event);
233
+ /* 弹出面板 portal 到 body,已不在 `.cmes-root` 之内:外部点击判定
234
+ * 必须把面板与触发按钮一并视为「内部」,否则点面板自身会把它关掉。 */
235
+ const target = event.target;
236
+ if (rootRef.current?.contains(target)) return;
237
+ if (popupRef.current?.contains(target)) return;
238
+ if (target instanceof Node && triggerRef.current?.contains(target)) return;
239
+ handlersRef.current.onOutside(event);
206
240
  }
207
241
  function escape(event) {
208
242
  if (event.key !== 'Escape') return;
209
243
  handlersRef.current.onEscape(event);
210
244
  }
211
- function align() {
212
- const trigger = triggerRef.current?.getBoundingClientRect();
213
- const popup = popupRef.current;
214
- if (!trigger || !popup || !rootRef.current) return;
215
- const width = Math.min(272, window.innerWidth - 24);
216
- const left = Math.max(12, Math.min((trigger.left + trigger.right - width) / 2, window.innerWidth - width - 12));
217
- /* 弹出面板是 `position: fixed`,因此浏览器按包含块而非窗口解读
218
- * 这些数值:用测量到的包含块重新换算,视口时原点就是 0,0。 */
219
- const box = containingBoxOf(probeRef.current);
220
- rootRef.current.style.setProperty(`--${P}-left`, `${left - box.left}px`);
221
- rootRef.current.style.setProperty(`--${P}-bottom`, `${Math.max(12, box.bottom - trigger.top + 8)}px`);
222
- /* 触发按钮上方的空间:驱动高度钳制,同时写回 state,让 render
223
- * 不必自己读布局。 */
224
- const roomAbove = Math.max(120, trigger.top - 20);
225
- rootRef.current.style.setProperty(`--${P}-room`, `${roomAbove}px`);
226
- setRoom(prev => (prev === roomAbove ? prev : roomAbove));
227
- }
228
245
  function resized() {
229
246
  cancelAnimationFrame(frame);
230
247
  const until = performance.now() + 500;
@@ -235,20 +252,47 @@ window.__ModuleLoader__.load({
235
252
  document.addEventListener('keydown', escape, true);
236
253
  window.addEventListener('resize', resized);
237
254
  document.addEventListener('scroll', align, true);
255
+ /* 输入区是多行的:换行 / 贴图 / 切会话会让触发按钮在**既不产生 window
256
+ * resize、也未必冒泡出 scroll 事件**的情况下移动,而弹层的 top 是
257
+ * 打开那一刻按 trigger.top 算死的——按钮一动弹层不跟,于是相对按钮
258
+ * 上浮或下沉。用一个观察器盯住触发按钮的定位祖先(`offsetParent`,
259
+ * 正是那条 overflow:auto/hidden 的输入区链)与触发按钮本身:它们的
260
+ * 盒子尺寸一变(输入区长高、滚动条出现/消失、外框平移)就重跑
261
+ * `align`,把弹层重新锚定到当前按钮位置。观察器回调在绘制前触发,
262
+ * 因此漂移不会先画出来再纠正。
263
+ *
264
+ * 已知残留缺口:ResizeObserver 只对「盒子尺寸变化」敏感。若按钮因
265
+ * 某祖先的 CSS transform / 主动画被整体平移,而所有被观察盒子尺寸
266
+ * 都没变,观察器不会响——这类纯位移只能靠 IntersectionObserver 或
267
+ * rAF 轮询兜底,但对一个 fail-open 插件而言过重,故刻意不引入。
268
+ * scroll(capture)与 window resize 监听仍覆盖绝大多数实际场景。 */
269
+ let observer = null;
270
+ if (typeof ResizeObserver === 'function') {
271
+ observer = new ResizeObserver(() => align());
272
+ const anchor = triggerRef.current?.offsetParent;
273
+ if (anchor) observer.observe(anchor);
274
+ if (triggerRef.current) observer.observe(triggerRef.current);
275
+ /* 弹层自身也要观察:面板高度带 `.2s` 过渡,切换 pane(强度 <-> 模型列表)
276
+ * 时高度会动画变化,而 top 是按当时的 offsetHeight 算死的。只盯触发按钮
277
+ * 的话,高度一长弹层底边就往下压过触发按钮(实测 gap 变 -32px)。观察
278
+ * 弹层后,动画每一帧高度一变就重算 top,底边始终钉在按钮上方 8px。 */
279
+ if (popupRef.current) observer.observe(popupRef.current);
280
+ }
238
281
  align();
239
282
  return () => {
240
283
  document.removeEventListener('pointerdown', outside);
241
284
  document.removeEventListener('keydown', escape, true);
242
285
  window.removeEventListener('resize', resized);
243
286
  document.removeEventListener('scroll', align, true);
287
+ if (observer) observer.disconnect();
244
288
  cancelAnimationFrame(frame);
245
289
  };
246
- }, [open, rootRef, popupRef, probeRef, triggerRef]);
290
+ }, [open, align, rootRef, popupRef, triggerRef]);
247
291
 
248
- /* 打开前先量一次,首帧就有正确高度,不会先回退到视口再跳变。 */
292
+ /* 打开前先量一次:首帧就有正确的高度 **和位置**,不会先回退到 CSS 里的
293
+ * 回退坐标(left:12 / top:auto)再跳变。 */
249
294
  function primeRoom() {
250
- const rect = triggerRef.current?.getBoundingClientRect();
251
- if (rect) setRoom(Math.max(120, rect.top - 20));
295
+ align();
252
296
  }
253
297
  return { room, primeRoom };
254
298
  }
@@ -474,7 +518,12 @@ window.__ModuleLoader__.load({
474
518
  };
475
519
  }, []);
476
520
 
477
- return { dragging, hovered, setHovered, pointerDown, pointerMove, finish, cancelDrag, keyDown };
521
+ /* liveRef 在拖拽期间持有 paintLive 写入的**连续**比例(非档位吸附值)。
522
+ * React 渲染滑轨 style 时若正在拖拽就读它,使两条 --pos 写入路径
523
+ * (paintLive 的 DOM 直写 与 React 的 style prop)写出同一个连续值——
524
+ * 否则越过档位阈值的那一帧 React 会把 --pos 改写回吸附位,圆钮偏离
525
+ * 指针半个档距再弹回(与「拖动期间无吸附跟随」的设计相矛盾)。 */
526
+ return { dragging, hovered, setHovered, pointerDown, pointerMove, finish, cancelDrag, keyDown, liveRef };
478
527
  }
479
528
 
480
529
  function SelectorImpl({ directory, load, select, available, locked, t, sessionId, setTeamMode, teamMode, css, M, U }) {
@@ -484,7 +533,6 @@ window.__ModuleLoader__.load({
484
533
  );
485
534
 
486
535
  const [open, setOpen] = useState(false);
487
- const [present, setPresent] = useState(false);
488
536
  const [pane, setPane] = useState('effort');
489
537
  const [preview, setPreview] = useState(null);
490
538
  const [message, setMessage] = useState(false);
@@ -502,7 +550,6 @@ window.__ModuleLoader__.load({
502
550
  const [subProvider, setSubProvider] = useState(null);
503
551
  const rootRef = useRef(null);
504
552
  const popupRef = useRef(null);
505
- const probeRef = useRef(null);
506
553
  const railRef = useRef(null);
507
554
  const triggerRef = useRef(null);
508
555
  const searchRef = useRef(null);
@@ -540,7 +587,7 @@ window.__ModuleLoader__.load({
540
587
  const team = useTeamToggle({ teamMode, setTeamMode, available, t, onError: setError, mountedRef });
541
588
  /* 弹出面板定位 / 高度余量 / 外部关闭 / Escape。 */
542
589
  const { room, primeRoom } = usePopoverLayout({
543
- open, rootRef, popupRef, probeRef, triggerRef,
590
+ open, rootRef, popupRef, triggerRef,
544
591
  onOutside: handleOutside, onEscape: handleEscape
545
592
  });
546
593
  /* 提交串行化:结束后清掉预览值。 */
@@ -555,28 +602,24 @@ window.__ModuleLoader__.load({
555
602
  onMove: showEffort, onPick: chooseEffort,
556
603
  onCancel: cancelPreview, U
557
604
  });
558
- useAnchoredTip(tipShown, fastBtnRef, tipRef, probeRef, 120, 44);
559
- useAnchoredTip(teamTipShown, teamInfoBtnRef, teamTipRef, probeRef, 220, 60);
560
- useAnchoredTip(resetTipShown, resetRef, resetTipRef, probeRef, 140, 48);
605
+ useAnchoredTip(tipShown, fastBtnRef, tipRef, 120, 44);
606
+ useAnchoredTip(teamTipShown, teamInfoBtnRef, teamTipRef, 220, 60);
607
+ useAnchoredTip(resetTipShown, resetRef, resetTipRef, 140, 48);
561
608
 
562
609
  const sparkles = useMemo(() => U.buildSparkles(22), [U]);
563
610
  const bloomMotes = useMemo(() => U.buildBloom(U.BLOOM_COUNT), [U]);
564
611
 
565
- /* `latest` 供 Escape 处理器读取“最近一次提交”的面板状态。只在 layout
566
- * effect 里同步:render 期间写 ref 会破坏渲染的纯粹性。 */
612
+ /* `latest` 供 Escape 处理器读取「最近一次提交」的面板状态。只在 layout
613
+ * effect 里同步:render 期间写 ref 会破坏渲染的纯粹性。刻意不放
614
+ * open——Escape 监听器只在弹层打开期间绑定,这里只保留 Escape 退层
615
+ * 真正需要的 pane/view 等即时状态,避免读到关闭动画窗口内的过期值。 */
567
616
  useLayoutEffect(() => {
568
- latest.current = { open: present, fast, peak, pane, efforts, index, savedEffort, view };
617
+ latest.current = { fast, peak, pane, efforts, index, savedEffort, view };
569
618
  });
570
619
 
571
620
  /* ---------- 副作用 ---------- */
572
621
  useEffect(() => { if (available) load(); }, [available, load]);
573
622
 
574
- useLayoutEffect(() => {
575
- if (open) { setPresent(true); return; }
576
- const timer = setTimeout(() => setPresent(false), 180);
577
- return () => clearTimeout(timer);
578
- }, [open]);
579
-
580
623
  useEffect(() => {
581
624
  mountedRef.current = true;
582
625
  return () => {
@@ -603,9 +646,16 @@ window.__ModuleLoader__.load({
603
646
  if (arrived) setBloom(n => n + 1);
604
647
  }, [index, open, efforts.length]);
605
648
 
649
+ /* 统一清掉峰值提示的定时器:既 cancel 掉还没触发的,也把数组清空,
650
+ * 避免失效 id 无谓地累积(clearTimeout 对旧 id 是 no-op,但不整洁)。 */
651
+ function clearTimers() {
652
+ timersRef.current.forEach(clearTimeout);
653
+ timersRef.current = [];
654
+ }
655
+
606
656
  /* 进入峰值时的特效:先显示警告,随后落定 */
607
657
  function enterPeak() {
608
- timersRef.current.forEach(clearTimeout);
658
+ clearTimers();
609
659
  setMessage(true);
610
660
  timersRef.current = [setTimeout(() => { if (mountedRef.current) setMessage(false); }, 1800)];
611
661
  }
@@ -797,6 +847,13 @@ window.__ModuleLoader__.load({
797
847
  : (typeof window === 'undefined' ? Infinity : Math.max(120, window.innerHeight - 52));
798
848
  const cappedHeight = Math.min(menuHeight, roomAbove);
799
849
 
850
+ /* 错误提示行:原先用 bottom 锚定,会在「无推理档位」时压住
851
+ * .cmes-noeffort 文案(那块和滑轨同样占据 top:65 起、line-height 26
852
+ * 的带状区域,而 status 落在 bottom:6 正好与其重叠)。改为 top 锚定,
853
+ * 落在顶部 ⚡/重置 按钮之间的空档(y 8..50 的 modelLink 那一行),
854
+ * 那里无论有无档位、有无 team 行都恒为空,不会再与任何内容打架。 */
855
+ const statusTop = 8;
856
+
800
857
  const classes = [
801
858
  `${P}-popover`,
802
859
  !open ? 'closed' : '',
@@ -926,7 +983,7 @@ window.__ModuleLoader__.load({
926
983
  'aria-label': t('model'), title: modelName
927
984
  },
928
985
  h('span', { className: `${P}-heading` }, currentLabel || t('choose'), icon('chevron', `${P}-iconSmall`)),
929
- h('span', { className: `${P}-modelName` }, modelName)),
986
+ h('span', { className: `${P}-modelLinkName` }, modelName)),
930
987
 
931
988
  h('div', { className: `${P}-warning` }, h('span', null, t('warning'))),
932
989
 
@@ -963,8 +1020,11 @@ window.__ModuleLoader__.load({
963
1020
  /* 绽放粒子是当前档位颜色向白色提亮——对 Ultra 而言正好落在
964
1021
  * 测量得到的 #ceb0fa 左右紫色,无需第二张硬编码表 */
965
1022
  [`--${P}-mote`]: U.mixHex(U.fillFor(displayed, dark), '#ffffff', dark ? 0.30 : 0.42),
966
- /* 一个无量纲比例同时驱动圆钮和填充 */
967
- [`--${P}-pos`]: fraction
1023
+ /* 一个无量纲比例同时驱动圆钮和填充。拖拽期间改读 liveRef 里的
1024
+ * 连续比例,与 paintLive 的 DOM 直写保持同一个值——若这里仍用
1025
+ * 吸附比例 fraction,越过档位阈值的那一帧 React 会把它写回
1026
+ * 吸附位,圆钮偏离指针半个档距再弹回。 */
1027
+ [`--${P}-pos`]: rail.dragging ? (rail.liveRef.current ?? fraction) : fraction
968
1028
  },
969
1029
  role: 'slider', tabIndex: 0,
970
1030
  'aria-label': t('effort'),
@@ -1019,12 +1079,18 @@ window.__ModuleLoader__.load({
1019
1079
  type: 'button',
1020
1080
  className: `${P}-teamInfo`,
1021
1081
  ref: teamInfoBtnRef,
1022
- 'aria-label': t('teamDesc'),
1082
+ /* 可访问名只用简短的「Agent Teams」;整句说明交给
1083
+ * aria-describedby 指向的提示卡,避免把长句塞进 label。 */
1084
+ 'aria-label': t('team'),
1023
1085
  'aria-describedby': `${P}-team-tip`,
1024
1086
  onPointerEnter: () => setTeamTipOn(true),
1025
1087
  onPointerLeave: () => setTeamTipOn(false),
1026
1088
  onFocus: () => setTeamTipOn(true),
1027
1089
  onBlur: () => setTeamTipOn(false),
1090
+ /* 提示卡的显隐完全交给 hover / focus:这里若再切一刀,
1091
+ * 点击会把 hover 刚点亮的提示卡反过来关掉(指针还悬在上面,
1092
+ * 不会重新触发 enter),表现为提示卡在光标下凭空消失。
1093
+ * 点击只拦住冒泡,避免把整个弹层关掉。 */
1028
1094
  onClick: event => { event.preventDefault(); event.stopPropagation(); }
1029
1095
  }, icon('info', `${P}-teamInfoIcon`))),
1030
1096
  h('button', {
@@ -1037,40 +1103,23 @@ window.__ModuleLoader__.load({
1037
1103
  }))
1038
1104
  : null);
1039
1105
 
1040
- return h('div', { className: `${P}-root`, ref: rootRef },
1041
- h('style', null, css),
1042
- h('div', { ref: probeRef, className: `${P}-probe`, 'aria-hidden': true }),
1043
-
1044
- h('button', {
1045
- className: `${P}-trigger${U.isPeakId(savedEffort) ? ' peak' : ''}${fast ? ' fast' : ''}`,
1046
- ref: triggerRef, disabled,
1047
- 'aria-label': `${modelName} ${triggerLabel}`.trim(),
1048
- 'aria-expanded': open, 'aria-haspopup': 'dialog', 'aria-busy': busy,
1049
- style: { [`--${P}-ink`]: U.inkFor(savedEffort, dark) },
1050
- onClick: () => {
1051
- if (open) close();
1052
- else {
1053
- /* 打开前先量一次可用高度,首帧就是正确值,不会高度弹跳。 */
1054
- primeRoom();
1055
- setPane(model ? 'effort' : 'models');
1056
- setOpen(true);
1057
- load();
1058
- }
1059
- }
1060
- },
1061
- fast ? h('svg', { className: `${P}-bolt`, viewBox: '0 0 24 24', 'aria-hidden': true }, h('path', { d: ICON.bolt })) : null,
1062
- h('span', { className: `${P}-compact` }, icon('model')),
1063
- h('span', { className: `${P}-caption` },
1064
- modelName),
1065
- triggerLabel
1066
- ? h('span', { className: `${P}-triggerEffort` }, triggerLabel)
1067
- : null,
1068
- icon('down', `${P}-chev`)),
1069
-
1106
+ /* 浮层(弹出面板 + tooltip)portal 到 document.body。
1107
+ * 原因:宿主 DSH 给输入区座位 `.composerSeat` 无条件写了
1108
+ * `will-change: transform`(ConversationRoot.module.css),按规范这使
1109
+ * seat 成为它每个 `position:fixed` 后代的包含块。本插件的弹层 / tooltip
1110
+ * 过去作为 `.cmes-root` 的子节点留在 seat 里,于是 fixed 坐标被按 seat
1111
+ * 盒子而非视口解读——弹层相对触发按钮整体平移(探针 rect 变成座位原点,
1112
+ * Firefox 上实测中心 Δ≈277、间隙≈276),又被 seat 的 `z-index:9` 层叠
1113
+ * 上下文压在 DSH 元素之下而无法操作。portal 到 body 后浮层脱离 seat 的
1114
+ * 包含块与层叠上下文:fixed 重新相对视口解析,z-index 也在根上下文生效,
1115
+ * 同时不干扰 DSH 想从 `will-change` 得到的合成层。DSH 自家浮层
1116
+ * (StatsPills / TurnUsagePanel / ApprovalWarning 等)采用同一做法。 */
1117
+ const overlay = h(React.Fragment, null,
1070
1118
  h('section', {
1071
1119
  className: classes, ref: popupRef, role: 'dialog',
1072
1120
  'aria-label': pane === 'models' ? t('model') : t('effort'),
1073
- 'aria-hidden': !open, inert: !open ? '' : undefined,
1121
+ 'aria-hidden': open ? undefined : 'true', inert: !open ? '' : undefined,
1122
+ onKeyDown: open ? event => trapFocus(popupRef.current, event) : undefined,
1074
1123
  style: {
1075
1124
  [`--${P}-height`]: `${pane === 'models' ? cappedHeight : (team.supported ? M.teamPaneH : M.effortPaneH)}px`,
1076
1125
  [`--${P}-ink`]: U.inkFor(displayed, dark)
@@ -1079,7 +1128,7 @@ window.__ModuleLoader__.load({
1079
1128
  modelsView,
1080
1129
  effortView,
1081
1130
  busy ? h('div', { className: `${P}-sr`, role: 'status' }, t('busy')) : null,
1082
- status ? h('div', { className: `${P}-status`, role: 'alert', style: { position: 'absolute', left: 12, right: 12, bottom: team.supported ? 44 : 6, color: 'var(--dsw-alias-state-error-primary)' } },
1131
+ status ? h('div', { className: `${P}-status`, role: 'alert', style: { position: 'absolute', left: 12, right: 12, top: statusTop, color: 'var(--dsw-alias-state-error-primary)' } },
1083
1132
  h('span', null, status)) : null),
1084
1133
  h('span', {
1085
1134
  role: 'tooltip', id: `${P}-reset-tip`,
@@ -1103,6 +1152,38 @@ window.__ModuleLoader__.load({
1103
1152
  },
1104
1153
  h('span', { className: `${P}-tipTitle` }, t('team')),
1105
1154
  h('span', null, t('teamDesc'))));
1155
+
1156
+ return h('div', { className: `${P}-root`, ref: rootRef },
1157
+ h('style', null, css),
1158
+ h('button', {
1159
+ className: `${P}-trigger${U.isPeakId(savedEffort) ? ' peak' : ''}${fast ? ' fast' : ''}`,
1160
+ ref: triggerRef, disabled,
1161
+ 'aria-label': `${modelName} ${triggerLabel}`.trim(),
1162
+ 'aria-expanded': open, 'aria-haspopup': 'dialog', 'aria-busy': busy,
1163
+ style: { [`--${P}-ink`]: U.inkFor(savedEffort, dark) },
1164
+ onClick: () => {
1165
+ if (open) close();
1166
+ else {
1167
+ /* 打开前先量一次可用高度,首帧就是正确值,不会高度弹跳。 */
1168
+ primeRoom();
1169
+ setPane(model ? 'effort' : 'models');
1170
+ setOpen(true);
1171
+ load();
1172
+ }
1173
+ }
1174
+ },
1175
+ fast ? h('svg', { className: `${P}-bolt`, viewBox: '0 0 24 24', 'aria-hidden': true }, h('path', { d: ICON.bolt })) : null,
1176
+ h('span', { className: `${P}-compact` }, icon('model')),
1177
+ h('span', { className: `${P}-caption` },
1178
+ modelName),
1179
+ triggerLabel
1180
+ ? h('span', { className: `${P}-triggerEffort` }, triggerLabel)
1181
+ : null,
1182
+ icon('down', `${P}-chev`)),
1183
+
1184
+ /* 浮层 portal 到 body:脱离 composerSeat 的 will-change 包含块与
1185
+ * z-index:9 层叠上下文(完整说明见上方 overlay 定义处)。 */
1186
+ createPortal(overlay, document.body));
1106
1187
  }
1107
1188
 
1108
1189
  /* 懒加载样式表分块(client.styles.js)。React.lazy + Suspense 让座位
package/client.styles.js CHANGED
@@ -29,9 +29,14 @@ window.__ModuleLoader__.load({
29
29
  function css(P, M = METRICS) {
30
30
  return `
31
31
  .${P}-root{position:relative;display:inline-flex;min-width:0;font-family:var(--dsw-font-family);font-size:14px;letter-spacing:0}
32
- /* 包含块探针:一个固定在块左上角与底边的零宽不可见元素。它的矩形就是
33
- 该块本身,因此两个覆盖层都能用真实数值定位,而无需猜测祖先。 */
34
- .${P}-probe{position:fixed;left:0;top:0;bottom:0;width:0;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;z-index:-1}
32
+ /* 浮层(弹层 + tooltip)已 portal 到 document.body,脱离 .cmes-root,因此
33
+ 那条 .cmes-root * 的 box-sizing / corner-shape 和 .cmes-root button 的
34
+ 按钮重置都不再作用于它们——不补回,面板里每个 button 都会退回浏览器默认
35
+ 样式(灰色底 + 2px outset 黑框 + 13.33px 系统字号),即「元素外有黑框」。
36
+ 这里只放低特异性的重置,各按钮自己的 border:0 / background / font-size
37
+ 规则会照常覆盖。 */
38
+ .${P}-popover,.${P}-popover *,.${P}-tip,.${P}-tip *{box-sizing:border-box;corner-shape:round;font-family:var(--dsw-font-family)}
39
+ .${P}-popover button{font:inherit;cursor:pointer;border:0;color:inherit}
35
40
  .${P}-root *{box-sizing:border-box;corner-shape:round}
36
41
  .${P}-root button{font:inherit;cursor:pointer;border:0;background:transparent;color:inherit}
37
42
 
@@ -52,20 +57,22 @@ window.__ModuleLoader__.load({
52
57
  .${P}-chev{width:12px;height:12px;flex:none;color:var(--dsw-alias-label-caption);transition:transform .12s ease}
53
58
  .${P}-trigger[aria-expanded=true] .${P}-chev{transform:rotate(180deg)}
54
59
  /* ---------- Fast 提示框 ----------
55
- 此处修复的 BUG:这一层过去是 ⚡ 按钮的子节点——也就是在弹出面板内部——
56
- 仅凭 position:fixed 无法让它脱身。弹出面板绘制出厂的菜单材质
57
- backdrop-filter: var(--dsw-menu-backdrop-filter) = blur(40px) saturate(150%),
58
- 而非 none 的 backdrop-filter 会让该元素成为每个固定/绝对定位后代的包含块。
59
- 于是 positionTip 算出的视口坐标被重新按弹出面板的盒子解读(在真实浏览器中
60
- 测得:期望 top 479,实际落在 1023 = 弹出面板 top 544 + 479),随后
61
- overflow:hidden 把这一层裁掉。悬停确实把 opacity 翻到 1、visibility 翻到
62
- visible——但什么都没画出来,这正是「悬停无法显示」症状。
63
- 修复:把 tooltip 渲染为 .cmes-root 下弹出面板的兄弟节点。那个盒子没有
64
- transform / filter / backdrop-filter,因此 position:fixed 重新相对视口解析
65
- (探针验证:弹出面板内的固定盒子报告弹出面板原点,根节点内的报告 0,0)。
66
- tooltip 因此不再是按钮的后代,旧的 .cmes-fast:hover [role=tooltip] 规则也就
67
- 永远不会触发;可见性改由 pointer enter/leave + focus/blur 驱动的 .show 类控制。 */
68
- .${P}-tip{position:fixed;z-index:1400;padding:7px 12px;white-space:nowrap;background:var(--dsw-specific-menu,var(--dsw-alias-bg-layer-2));background:color-mix(in srgb,var(--dsw-specific-menu,var(--dsw-alias-bg-layer-2)) 72%,transparent);backdrop-filter:blur(20px) saturate(180%);-webkit-backdrop-filter:blur(20px) saturate(180%);box-shadow:var(--dsw-elevation-panel);border-radius:10px;font-size:12px;line-height:17px;text-align:center;color:var(--dsw-alias-label-primary);opacity:0;visibility:hidden;pointer-events:none;transform:translateY(2px);transition:opacity .12s ease,transform .12s ease,visibility 0s .12s}
60
+ 历史上的两个坑,都由「固定定位后代被祖先变成包含块」引起:
61
+ 1) 这一层过去是 ⚡ 按钮的子节点——也就是在弹出面板内部。弹出面板绘制出厂
62
+ 的菜单材质 backdrop-filter: var(--dsw-menu-backdrop-filter)
63
+ = blur(40px) saturate(150%),而非 none 的 backdrop-filter 会让该元素
64
+ 成为每个固定/绝对定位后代的包含块。于是算出的视口坐标被重新按弹出面板
65
+ 的盒子解读(实测:期望 top 479,实际落在 1023 = 弹出面板 top 544 + 479),
66
+ 随后 overflow:hidden 把这一层裁掉——悬停把 opacity/visibility 都翻过来了,
67
+ 却什么都没画出来。
68
+ 2) 后来把 tooltip 提为弹出面板的兄弟节点,但它仍留在 .cmes-root 里,而宿主
69
+ DSH 给输入区座位 .composerSeat 无条件写了 will-change: transform,这使
70
+ seat 成为每个固定定位后代的包含块,坐标整体平移(Firefox 上弹层中心
71
+ Δ≈277、间隙≈276)。
72
+ 现在的修复:tooltip 与弹出面板一起 portal 到 document.body,彻底脱离上述任何
73
+ 祖先的包含块,position:fixed 恒相对视口解析;tooltip 也不再是按钮的后代,可见
74
+ 性改由 pointer enter/leave + focus/blur 驱动的 .show 类控制。 */
75
+ .${P}-tip{position:fixed;z-index:1400;padding:7px 12px;white-space:nowrap;font-family:var(--dsw-font-family);background:var(--dsw-specific-menu,var(--dsw-alias-bg-layer-2));background:color-mix(in srgb,var(--dsw-specific-menu,var(--dsw-alias-bg-layer-2)) 72%,transparent);backdrop-filter:blur(20px) saturate(180%);-webkit-backdrop-filter:blur(20px) saturate(180%);box-shadow:var(--dsw-elevation-panel);border-radius:10px;font-size:12px;line-height:17px;text-align:center;color:var(--dsw-alias-label-primary);opacity:0;visibility:hidden;pointer-events:none;transform:translateY(2px);transition:opacity .12s ease,transform .12s ease,visibility 0s .12s}
69
76
  .${P}-tip.show{opacity:1;visibility:visible;transform:translateY(0);transition:opacity .12s ease,transform .12s ease,visibility 0s}
70
77
  /* 参考实现中的 tooltip 是两行卡片:较重的标题压在柔和副标题上。
71
78
  “仅视觉效果”的披露只留给辅助技术,因此卡片保持参考实现的两行形态。 */
@@ -79,8 +86,11 @@ window.__ModuleLoader__.load({
79
86
  .${P}-resetTip{max-width:min(240px,calc(100vw - 32px));white-space:normal;text-align:left}
80
87
 
81
88
  /* ---------- 弹出面板 ---------- */
82
- .${P}-popover{position:fixed;bottom:var(--${P}-bottom,40px);left:var(--${P}-left,12px);width:272px;max-width:calc(100vw - 24px);height:var(--${P}-height,${M.effortPaneH}px);max-height:var(--${P}-room,calc(100vh - 52px));padding:0;background:var(--dsw-specific-menu,var(--dsw-alias-bg-layer-2));border-radius:14px;box-shadow:var(--dsw-elevation-panel);backdrop-filter:var(--dsw-menu-backdrop-filter);z-index:1100;overflow:hidden;transform-origin:bottom left;transition:opacity .18s ease,transform .18s ease,height .2s cubic-bezier(.2,.8,.2,1),visibility 0s}
83
- .${P}-popover.closed{opacity:0;pointer-events:none;visibility:hidden;transform:translateY(5px) scale(.98);transition-delay:0s,0s,0s,.18s}
89
+ /* 弹出面板 portal 到 body,position:fixed 恒相对视口;定位由 align() 写入的
90
+ --top / --left 视口坐标驱动(面板底边停在触发按钮上方 8px),CSS 值只是
91
+ 首帧前的回退。 */
92
+ .${P}-popover{position:fixed;top:var(--${P}-top,auto);left:var(--${P}-left,12px);width:272px;max-width:calc(100vw - 24px);height:var(--${P}-height,${M.effortPaneH}px);max-height:var(--${P}-room,calc(100vh - 52px));padding:0;font-family:var(--dsw-font-family);font-size:14px;letter-spacing:0;background:var(--dsw-specific-menu,var(--dsw-alias-bg-layer-2));border-radius:14px;box-shadow:var(--dsw-elevation-panel);backdrop-filter:var(--dsw-menu-backdrop-filter);z-index:1100;overflow:hidden;transform-origin:top left;transition:opacity .18s ease,transform .18s ease,height .2s cubic-bezier(.2,.8,.2,1),visibility 0s}
93
+ .${P}-popover.closed{opacity:0;pointer-events:none;visibility:hidden;transform:translateY(-5px) scale(.98);transition-delay:0s,0s,0s,.18s}
84
94
  .${P}-popover.peak{--dsw-elevation-stroke-color:rgba(145,78,246,.28)}
85
95
 
86
96
  /* ---------- 面板分层 ---------- */
@@ -89,18 +99,21 @@ window.__ModuleLoader__.load({
89
99
 
90
100
  /* ---------- 强度面板 ---------- */
91
101
  .${P}-main{height:var(--${P}-main-h,${M.effortPaneH}px)}
92
- .${P}-tool{position:absolute;top:7px;width:28px;height:28px;display:flex;align-items:center;justify-content:center;padding:0;border-radius:8px;color:var(--dsw-alias-label-caption)}
102
+ .${P}-tool{position:absolute;top:7px;width:28px;height:28px;display:flex;align-items:center;justify-content:center;padding:0;border:0;border-radius:8px;background:transparent;color:var(--dsw-alias-label-caption)}
93
103
  .${P}-tool:hover{background:var(--dsw-alias-interactive-bg-hover)}
94
104
  .${P}-fast{left:7px}
95
105
  .${P}-reset{right:7px}
96
106
  .${P}-tool svg{width:16px;height:16px}
97
107
  .${P}-fast.active{color:var(--${P}-accent,#3988f6)}
98
108
  .${P}-popover.peak .${P}-fast.active{color:var(--${P}-accentPeak,#9b48eb)}
99
- .${P}-modelLink{position:absolute;left:43px;right:43px;top:8px;height:42px;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:2px 4px;border-radius:5px;transition:opacity .2s ease}
109
+ .${P}-modelLink{position:absolute;left:43px;right:43px;top:8px;height:42px;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:2px 4px;border:0;border-radius:5px;background:transparent;transition:opacity .2s ease}
100
110
  .${P}-modelLink:hover{background:var(--dsw-alias-interactive-bg-hover)}
101
111
  .${P}-heading{display:flex;gap:3px;justify-content:center;align-items:center;max-width:100%;height:20px;color:var(--${P}-ink,#3989e9);font-size:14px;line-height:20px;white-space:nowrap;transition:color .2s ease}
102
112
  .${P}-heading svg{width:10px;height:10px;color:var(--dsw-alias-label-caption)}
103
- .${P}-modelName{display:block;max-width:100%;height:18px;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
113
+ /* 强度面板中间那行的模型名:独立类名,避免与下方模型列表行的
114
+ * .${P}-modelName(display:flex 徽标布局)同名互相覆盖——两者同名时后者
115
+ * 靠后生效,会让这里的 height/font-size/ellipsis 全部失效。 */
116
+ .${P}-modelLinkName{display:block;max-width:100%;height:18px;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
104
117
  .${P}-warning{position:absolute;left:29px;right:29px;top:20px;text-align:center;line-height:18px;font-size:13px;opacity:0;pointer-events:none;transition:opacity .2s ease}
105
118
  .${P}-warning span{display:inline-block;background:linear-gradient(90deg,var(--${P}-warnHi,#a965dd) 0%,var(--${P}-warnHi,#a965dd) 42%,var(--${P}-warnLo,#653780) 50%,var(--${P}-warnHi,#a965dd) 58%,var(--${P}-warnHi,#a965dd) 100%);background-size:300% 100%;background-position:0 0;background-clip:text;-webkit-background-clip:text;color:transparent;-webkit-text-fill-color:transparent}
106
119
  .${P}-popover.message .${P}-modelLink,.${P}-popover.message .${P}-tool{opacity:0;pointer-events:none}
@@ -181,14 +194,18 @@ window.__ModuleLoader__.load({
181
194
  --dsw-radius-md,以及交互式悬停底色。 */
182
195
  .${P}-team{position:absolute;left:8px;right:8px;top:96px;display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:${M.teamRowH}px;padding:0 8px;border-radius:var(--dsw-radius-md);color:var(--dsw-alias-label-primary);font-size:13px;line-height:20px}
183
196
  .${P}-teamLabel{display:inline-flex;align-items:center;gap:4px;min-width:0}
184
- .${P}-teamInfo{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;flex:none;padding:0;color:var(--dsw-alias-label-caption);cursor:help}
197
+ .${P}-teamInfo{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;flex:none;padding:0;border:0;border-radius:0;background:transparent;color:var(--dsw-alias-label-caption);cursor:help}
185
198
  .${P}-teamInfo svg{width:11px;height:11px}
186
- .${P}-root .${P}-teamSwitch{position:relative;flex:none;width:32px;height:18px;padding:0;border:0;border-radius:999px;background:var(--dsw-alias-interactive-bg-hover-solid,#cfd1d6);cursor:pointer;transition:background .16s ease}
187
- .${P}-root .${P}-teamSwitch[aria-checked=true]{background:var(--dsw-alias-state-business-primary,#4d6bfe)}
188
- .${P}-root .${P}-teamSwitch:disabled{opacity:.45;cursor:default}
189
- .${P}-root .${P}-teamSwitch:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}
190
- .${P}-root .${P}-teamSwitch::after{content:"";position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%;background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.22);transition:transform .16s ease}
191
- .${P}-root .${P}-teamSwitch[aria-checked=true]::after{transform:translateX(14px)}
199
+ /* 开关随弹出面板 portal 到 body,不再位于 .cmes-root 之内,因此规则不能用
200
+ .cmes-root 后代选择器(否则整块失效,按钮退回浏览器默认样式:灰色底 +
201
+ 2px outset 黑框 + 直角)。改用单类选择器;并补回过去由 .cmes-root button
202
+ 提供的 font / cursor / border 重置。 */
203
+ .${P}-teamSwitch{position:relative;flex:none;width:32px;height:18px;padding:0;border:0;border-radius:999px;background:var(--dsw-alias-interactive-bg-hover-solid,#cfd1d6);color:inherit;font:inherit;cursor:pointer;box-sizing:border-box;transition:background .16s ease}
204
+ .${P}-teamSwitch[aria-checked=true]{background:var(--dsw-alias-state-business-primary,#4d6bfe)}
205
+ .${P}-teamSwitch:disabled{opacity:.45;cursor:default}
206
+ .${P}-teamSwitch:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}
207
+ .${P}-teamSwitch::after{content:"";position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%;background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.22);transition:transform .16s ease}
208
+ .${P}-teamSwitch[aria-checked=true]::after{transform:translateX(14px)}
192
209
  @media (hover:hover){.${P}-team:hover{background:var(--dsw-alias-interactive-bg-hover)}}
193
210
  @media (prefers-reduced-motion:reduce){
194
211
  .${P}-sp{animation-duration:calc(var(--dur,3s) * 2.6)}
@@ -254,6 +271,9 @@ window.__ModuleLoader__.load({
254
271
  .${P}-model.sel .${P}-ck{opacity:1}
255
272
  .${P}-empty{color:var(--dsw-alias-label-tertiary,#9aa0ab);font-size:13px;padding:14px 10px;text-align:center}
256
273
  .${P}-failure{border-radius:8px;background:var(--dsw-alias-interactive-bg-hover-danger,rgba(229,72,77,.12));color:var(--dsw-alias-state-error-primary,#e5484d);font-size:12px;line-height:1.6;padding:4px 8px;margin:0 2px 3px;word-break:break-word}
274
+ /* 错误提示行只做展示:它覆盖在 modelLink(强度面板)/ 返回+搜索(模型页)
275
+ * 之上,若不关掉命中测试,会在出错时吞掉这些控件的点击。 */
276
+ .${P}-status{position:absolute;pointer-events:none}
257
277
  .${P}-sr{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
258
278
 
259
279
  /* ---------- 深色主题 ----------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-codex-model-effort-ui",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "把 Codex 桌面版的模型选择列表与推理强度滑块 1:1 复刻进 DeepSeek Harness:同一个弹层里切换模型与推理强度。",
5
5
  "author": "zxclf",
6
6
  "license": "MIT",