@michengai/dsh-codex-ui 2.4.5 → 2.4.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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.4.7] - 2026-11-25
4
+
5
+ - **Custom Input Width Restored After Restart and Maximize (Issue #115)**:
6
+ - After you set a custom message/input width, restarting the app and maximizing the window now applies that width immediately; switching to another page and back is no longer required;
7
+ - The new-conversation width handles keep working, including on hosts that publish the saved width directly on the message column.
8
+ - **Floating Conversation Header Follows Your Width**:
9
+ - With the mica floating cards turned on, the conversation header now follows the message column when you drag the input area wider or narrower, and keeps matching it after maximizing the window, switching sessions or returning from a full-page view.
10
+
11
+ ## [2.4.6] - 2026-11-25
12
+
13
+ - **Adaptive Auto-Hiding for Unused Default Workspace Section (Issue #114)**:
14
+ - In the plain flat view (no pinned projects and no custom sections), all built-in "Pinned" and "Projects" headers hide themselves so the sidebar falls back to the host's native flat list;
15
+ - In section mode, the default "Projects" header hides when it has no workspaces, freeing the vertical space it used to take up.
16
+ - **Isolate Floating Mica Theme Styles from Third-Party Cards and Action Tooltips (Issue #113)**:
17
+ - Prevented conversation header styles from spilling over into inline plugin headers (such as squad and fleet status cards), avoiding layout distortion or layering conflicts;
18
+ - Restored high-contrast dark backgrounds and crisp white text for conversation action tooltips (copy, branch, etc.), ensuring legibility against glass backgrounds.
19
+
3
20
  ## [2.4.5] - 2026-11-25
4
21
 
5
22
  - **Improve Workspace Section Recovery and Real-Time Synchronization**:
@@ -1,5 +1,22 @@
1
1
  # 更新日志
2
2
 
3
+ ## [2.4.7] - 2026-11-25
4
+
5
+ - **修复自定义输入宽度在重启并最大化后需要切页才恢复的问题(Issue #115)**:
6
+ - 设置过自定义消息/输入宽度后,重启应用并最大化窗口会立即按保存的宽度显示,不再需要切到其他页面再切回;
7
+ - 新建页的宽度拖拽保持可用,包括宿主直接把保存宽度发布到正文节点上的新版本。
8
+ - **浮动会话顶栏跟随输入宽度**:
9
+ - 开启云母悬浮卡片后,拖宽或收窄输入区时会话顶栏会同步跟随;最大化窗口、切换会话或从整页视图返回后仍保持与正文一致。
10
+
11
+ ## [2.4.6] - 2026-11-25
12
+
13
+ - **优化工作区分区展示与自适应隐身逻辑(Issue #114)**:
14
+ - 纯平铺模式(既没有置顶项目、也没有自定义分区)下,内置的「置顶」「项目」标题行全部隐身,工作区列表直接按宿主原生平铺展示;
15
+ - 分区模式下,未添加项目的默认「项目」分区标题行自动隐身,不再白占侧栏顶部空间;
16
+ - **修复云母毛玻璃主题下的第三方插件卡片与操作提示样式冲突(Issue #113)**:
17
+ - 修复第三方编队等插件的内容流顶栏卡片被误套用浮动顶栏样式导致的排版变形与层级遮挡问题;
18
+ - 修复会话底部操作栏(复制、分支等)鼠标悬停提示气泡背景色透明导致的文字看不清问题,恢复清晰统一的深色悬浮提示效果。
19
+
3
20
  ## [2.4.5] - 2026-11-25
4
21
 
5
22
  - **工作区分区恢复与实时同步体验优化**:
package/README.md CHANGED
@@ -192,7 +192,7 @@ dsh --profile web --dump-config
192
192
  | **调节输入框宽度** | 悬停至输入框左右边缘,拖拽蓝色手柄即可自定义最舒适的编写宽度。 |
193
193
  | **切换主题与质感** | 打开「设置 → Codex UI」,在「界面外观与换肤」卡片单选 14 款主题,直选原版/云母模式与材质预设。 |
194
194
  | **调整侧栏图标顺序** | 鼠标按住展开侧栏中的任意插件条目拖拽上下移动,蓝线指示放置位置,支持拖入/拖出「更多」手风琴。 |
195
- | **从分区直接添加工作区** | 悬停或键盘聚焦到任意侧栏分区(「置顶」、「项目」或自定义分区)标题,点击右侧 `···` 旁的「添加工作区」图标(随宿主目录选择能力显隐),新建的工作区会自动归入该分区并展开。 |
195
+ | **从分区直接添加工作区** | 在分区模式下,悬停或键盘聚焦到任意侧栏分区(「置顶」、「项目」或自定义分区)标题,点击右侧 `···` 旁的「添加工作区」图标(随宿主目录选择能力显隐),新建的工作区会自动归入该分区并展开。 |
196
196
  | **在欢迎页搜索并切换项目** | 点击新建会话页的工作区胶囊即可直接输入,按项目名或路径即时过滤;`↑` / `↓` 移动、`Enter` 选中、`Esc` 关闭。当前项目行尾带对勾,同名项目附带最短区分路径;底部「新建项目」只在宿主提供系统目录对话框时出现(远程连接 / SSH 启动的宿主会自动隐藏)。 |
197
197
  | **折叠/收起侧边栏** | 点击侧栏顶部折叠按钮;收缩后自动切换为 56px 原生导轨,单手盲点所有功能图标。 |
198
198
  | **生态插件批量更新** | 在「设置 → Codex UI」底部「配套管理插件」卡片,点击「全部更新」自动安装最新配套依赖。 |
package/README.zh-CN.md CHANGED
@@ -192,7 +192,7 @@ dsh --profile web --dump-config
192
192
  | **调节输入框宽度** | 悬停至输入框左右边缘,拖拽蓝色手柄即可自定义最舒适的编写宽度。 |
193
193
  | **切换主题与质感** | 打开「设置 → Codex UI」,在「界面外观与换肤」卡片单选 14 款主题,直选原版/云母模式与材质预设。 |
194
194
  | **调整侧栏图标顺序** | 鼠标按住展开侧栏中的任意插件条目拖拽上下移动,蓝线指示放置位置,支持拖入/拖出「更多」手风琴。 |
195
- | **从分区直接添加工作区** | 悬停或键盘聚焦到任意侧栏分区(「置顶」、「项目」或自定义分区)标题,点击右侧 `···` 旁的「添加工作区」图标(随宿主目录选择能力显隐),新建的工作区会自动归入该分区并展开。 |
195
+ | **从分区直接添加工作区** | 在分区模式下,悬停或键盘聚焦到任意侧栏分区(「置顶」、「项目」或自定义分区)标题,点击右侧 `···` 旁的「添加工作区」图标(随宿主目录选择能力显隐),新建的工作区会自动归入该分区并展开。 |
196
196
  | **在欢迎页搜索并切换项目** | 点击新建会话页的工作区胶囊即可直接输入,按项目名或路径即时过滤;`↑` / `↓` 移动、`Enter` 选中、`Esc` 关闭。当前项目行尾带对勾,同名项目附带最短区分路径;底部「新建项目」只在宿主提供系统目录对话框时出现(远程连接 / SSH 启动的宿主会自动隐藏)。 |
197
197
  | **折叠/收起侧边栏** | 点击侧栏顶部折叠按钮;收缩后自动切换为 56px 原生导轨,单手盲点所有功能图标。 |
198
198
  | **生态插件批量更新** | 在「设置 → Codex UI」底部「配套管理插件」卡片,点击「全部更新」自动安装最新配套依赖。 |
package/lib/client.js CHANGED
@@ -417,6 +417,92 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
417
417
  };
418
418
  }
419
419
  //#endregion
420
+ //#region src/client/theme/header-width.ts
421
+ /**
422
+ * 云母浮动顶栏的宽度跟随。
423
+ *
424
+ * 宿主会按保存的偏好与窗口尺寸算出聊天内容宽度,并把结果发布成 CSS 变量:
425
+ * `0.2.2-rc.5` 发布到会话根节点,`0.2.3-alpha.2` 起改成只发布到正文节点,且把相关变量注册为
426
+ * `inherits: false`。浮动顶栏与正文互为兄弟,挂在顶栏上的规则因此拿不到这个值,只能退回到
427
+ * 按列宽估算的兜底宽度 —— 表现就是「拖宽输入区,顶栏不变」。
428
+ *
429
+ * 这里把正文节点上已经解析好的内容宽度提升到会话根节点,命名空间用插件自己的
430
+ * `--dcu-chat-content-width`,绝不改写宿主变量;正文消失或值还不是绝对长度时删除该变量,
431
+ * 让顶栏回到上游兜底规则。
432
+ */
433
+ const HOST_CONTENT_WIDTH = "--dsh-chat-content-width";
434
+ const HEADER_WIDTH = "--dcu-chat-content-width";
435
+ const ROOT_SELECTOR = "[data-dsh-glass-frame] [data-phase]";
436
+ const BODY_SELECTOR = "[data-conversation-content]";
437
+ /** 只接受宿主已解析成绝对长度的值;`clamp(...)`、`var(...)` 这类未解析文本交给上游兜底。 */
438
+ const ABSOLUTE_LENGTH = /^\d+(\.\d+)?px$/;
439
+ /**
440
+ * 用宏任务合并同一批突变触发,而不是 requestAnimationFrame:
441
+ * Electron 窗口在后台或被遮挡时 rAF 会被暂停,宿主却照常重排(最大化、切换会话都会触发),
442
+ * 依赖 rAF 会让顶栏钉在旧宽度上,正是要修的现象。
443
+ */
444
+ const nextFrame = (callback) => setTimeout(callback, 0);
445
+ const cancelFrame = (id) => clearTimeout(id);
446
+ function readContentWidth(body) {
447
+ const value = getComputedStyle(body).getPropertyValue(HOST_CONTENT_WIDTH).trim();
448
+ return ABSOLUTE_LENGTH.test(value) ? value : "";
449
+ }
450
+ /**
451
+ * 跟随宿主内容宽度,把结果写到会话根节点。
452
+ *
453
+ * @returns 注销函数:断开全部观察器并清掉插件变量。
454
+ */
455
+ function startGlassHeaderWidthTracker() {
456
+ if (typeof document === "undefined") return () => {};
457
+ const observed = /* @__PURE__ */ new Set();
458
+ const resizeObserver = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(() => schedule());
459
+ let frame;
460
+ let disposed = false;
461
+ const track = (body) => {
462
+ if (resizeObserver === void 0 || observed.has(body)) return;
463
+ observed.add(body);
464
+ resizeObserver.observe(body);
465
+ };
466
+ const sync = () => {
467
+ frame = void 0;
468
+ if (disposed) return;
469
+ for (const root of document.querySelectorAll(ROOT_SELECTOR)) {
470
+ const bodies = Array.from(root.querySelectorAll(BODY_SELECTOR));
471
+ for (const body of bodies) track(body);
472
+ const visible = bodies.map((body) => ({
473
+ body,
474
+ width: body.getBoundingClientRect().width
475
+ })).sort((left, right) => right.width - left.width)[0];
476
+ const width = visible === void 0 ? "" : readContentWidth(visible.body);
477
+ if (width === "") root.style.removeProperty(HEADER_WIDTH);
478
+ else root.style.setProperty(HEADER_WIDTH, width);
479
+ }
480
+ };
481
+ function schedule() {
482
+ if (disposed || frame !== void 0) return;
483
+ frame = nextFrame(sync);
484
+ }
485
+ const observer = new MutationObserver(schedule);
486
+ observer.observe(document.documentElement, {
487
+ childList: true,
488
+ subtree: true,
489
+ attributes: true,
490
+ attributeFilter: ["data-phase", "style"]
491
+ });
492
+ window.addEventListener("resize", schedule);
493
+ sync();
494
+ return () => {
495
+ disposed = true;
496
+ observer.disconnect();
497
+ resizeObserver?.disconnect();
498
+ observed.clear();
499
+ window.removeEventListener("resize", schedule);
500
+ if (frame !== void 0) cancelFrame(frame);
501
+ frame = void 0;
502
+ for (const root of document.querySelectorAll(ROOT_SELECTOR)) root.style.removeProperty(HEADER_WIDTH);
503
+ };
504
+ }
505
+ //#endregion
420
506
  //#region src/client/theme/glass.ts
421
507
  /**
422
508
  * 玻璃质感(Glassmorphism)与云母模式(Mica)生命周期管理
@@ -443,7 +529,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
443
529
  const GLASS_FLOAT_ATTRIBUTE = "data-dsh-glass-float";
444
530
  const GLASS_COMPAT_ATTRIBUTE = "data-dsh-glass-compat";
445
531
  const STYLE_TAG_ID = "dsh-codex-ui-glass-style";
446
- const GLASS_COMPOSER_CSS = GLASS_CSS_TEXT.replaceAll("[data-dsh-glass-float] [data-composer-card]:before", "[data-dsh-glass-float] [data-composer-card] > [data-dcu-glass-composer-surface]").replaceAll("[data-dsh-glass-compat] [data-composer-card]:before", "[data-dsh-glass-compat] [data-composer-card] > [data-dcu-glass-composer-surface]");
532
+ const GLASS_COMPOSER_CSS = GLASS_CSS_TEXT.replaceAll("[data-dsh-glass-float] [data-composer-card]:before", "[data-dsh-glass-float] [data-composer-card] > [data-dcu-glass-composer-surface]").replaceAll("[data-dsh-glass-compat] [data-composer-card]:before", "[data-dsh-glass-compat] [data-composer-card] > [data-dcu-glass-composer-surface]").replaceAll("[data-dsh-glass-float] [data-phase=active] header", "[data-dsh-glass-float] [data-phase=active] header:not(.lc-pulse-header):not([class*=\"lc-\"])").replaceAll("[data-dsh-glass-float] [data-phase] header:not([class*=headerBlank])", "[data-dsh-glass-float] [data-phase] header:not([class*=headerBlank]):not(.lc-pulse-header):not([class*=\"lc-\"])").replaceAll("[data-dsh-glass-frame][data-sidebar-collapsed] [data-phase] header:not([class*=headerBlank])", "[data-dsh-glass-frame][data-sidebar-collapsed] [data-phase] header:not([class*=headerBlank]):not(.lc-pulse-header):not([class*=\"lc-\"])").replaceAll("[data-dsh-glass-float] [data-conversation-scroll] [class*=bubble]", "[data-dsh-glass-float] [data-conversation-scroll] [class*=bubble]:not([role=tooltip]):not([class*=tooltip])");
447
533
  /** 玻璃层追加样式(拼在生成 CSS 之后,同特异性下后者胜出);导出以便契约测试断言 */
448
534
  const GLASS_EXTRA_CSS = `
449
535
  /* 插件页顶栏色差彻底消除:静止与滚动吸顶均保持底板透明,与全局背景底色与渐变自然融为一体;吸顶时呈现纯净磨砂与细线悬浮效果 */
@@ -497,11 +583,63 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
497
583
  这正是「还是透」的真因:兜底模糊一直在,只是被 mask 变成惰性。
498
584
  因此顶部遮挡改为与对标插件一致的做法:不给滚动容器加遮罩,只把顶栏自己的磨砂设为下限值,
499
585
  让从顶栏背后穿过的正文被磨砂化开。 */
500
- [data-dsh-glass-float] [data-phase] header:not([class*="headerBlank"]) {
586
+ [data-dsh-glass-float] [data-phase] header:not([class*="headerBlank"]):not(.lc-pulse-header):not([class*="lc-"]) {
501
587
  backdrop-filter: blur(max(var(--dsh-glass-blur, 12px), 12px)) !important;
502
588
  -webkit-backdrop-filter: blur(max(var(--dsh-glass-blur, 12px), 12px)) !important;
503
589
  }
504
590
 
591
+ /* 浮动顶栏宽度跟随正文:新宿主(0.2.3 起)把内容宽度注册为不继承、只写在正文节点上,
592
+ 顶栏与正文互为兄弟读不到,只能退回按列宽估算的兜底宽度(拖宽输入区时顶栏不变)。
593
+ 这里优先读由 header-width 追踪器提升到会话根的绝对宽度,读不到时保持上游兜底不变。
594
+ 必须带上 [data-dsh-glass-float] 门控:平铺(compat)模式没有浮动顶栏卡片,这条只改 max-width
595
+ 会把宿主原生顶栏夹成内容宽+32 且不居中。折叠侧栏有自己的通栏规则,同样排除。 */
596
+ [data-dsh-glass-float] [data-dsh-glass-frame]:not([data-sidebar-collapsed]) [data-phase] header:not([class*="headerBlank"]):not(.lc-pulse-header):not([class*="lc-"]) {
597
+ max-width: min(calc(var(--dcu-chat-content-width, var(--dsh-chat-user-width, clamp(680px, calc(var(--dsh-conversation-column-width, 1500px) * 0.64), 920px))) + 32px), calc(100% - 32px));
598
+ }
599
+
600
+ /* 防御 dsh-context 编队卡片样式污染(Issue #113):
601
+ .lc-pulse-header 属于编队内容流内部卡片,严禁继承宿主会话顶栏的浮动排版
602
+ (100% 宽 + 居中最大宽 + 卡片描边 + 20px 圆角 + z-index:8 的高层级定位)。
603
+ 这里只把浮动顶栏注入的「定位与尺寸」回正为卡片自己的流式布局,让它在向上滚动时
604
+ 从真正的宿主顶栏下方平滑穿过;圆角、背景、边框、阴影等第三方视觉属性一律不碰。
605
+ 实测依据(dsh-context 已装产物):该插件内部只有这一个 <header>(class=lc-pulse-header),
606
+ 顶栏规则原本会同时套上 width:100% / 居中 max-width / 卡片描边 / 20px 圆角 / z-index:8;
607
+ 它还用自己的 ::after 画一条 2px 渐变底线,所以「header:after{display:none}」那条兄弟规则
608
+ 也必须一起排除(当前靠目标串子串重叠顺带命中,用例已锁死,别改成更精确的写法)。
609
+ 注 1:lc- 是 dsh-context 插件的类名前缀契约;第三条选择器用子串匹配覆盖
610
+ 「外层包了一层 lc- 卡片、header 在里面」的嵌套形状。当前 dsh-context 只有上面那一个
611
+ header,所以它今天与第一条选择器命中同一个节点,属于结构变化时的兜底;
612
+ 代价是它也会命中任何 lc- 容器内的 header,改动前先与 dsh-context 的实际 DOM 对一遍。
613
+ 注 2:此重置仅限定在云母浮动模式([data-dsh-glass-float]),平铺(compat)模式下
614
+ 不存在这些顶栏规则,绝不越界。 */
615
+ [data-dsh-glass-float] header.lc-pulse-header,
616
+ [data-dsh-glass-float] header[class*="lc-pulse-"],
617
+ [data-dsh-glass-float] [class*="lc-"] header {
618
+ position: relative !important;
619
+ z-index: 1 !important;
620
+ width: auto !important;
621
+ max-width: none !important;
622
+ margin: 0 !important;
623
+ }
624
+
625
+ /* 防御会话操作栏 Tooltip 气泡样式污染(Issue #113):
626
+ 对话下方功能控件(复制、分支等)的 Tooltip 气泡挂载在会话滚动流内部,
627
+ 严禁被 [class*=bubble] 污染为亮色透明背景导致的白底白字;
628
+ 严格维持宿主规范的深色底板、纯白文字与统一 8px 圆角(对齐基线预设,仅限浮动模式)。 */
629
+ [data-dsh-glass-float] [role="tooltip"],
630
+ [data-dsh-glass-float] [class*="bubble"][role="tooltip"] {
631
+ background: var(--dsw-alias-tooltip-bg, #1e1e24) !important;
632
+ color: var(--dsw-alias-tooltip-label, #ffffff) !important;
633
+ border: none !important;
634
+ border-radius: var(--dsw-radius-md, 8px) !important;
635
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
636
+ backdrop-filter: none !important;
637
+ -webkit-backdrop-filter: none !important;
638
+ }
639
+ [data-dsh-glass-float] [role="tooltip"] * {
640
+ color: inherit !important;
641
+ }
642
+
505
643
  /* 对齐平铺风格(Compat)防漏字规范:将云母输入框卡片底色提升为高遮蔽度的 card-raised,
506
644
  并锁定至少 12px 高斯磨砂,将底层滚动的历史文字彻底化开为淡淡的柔和色块,杜绝锐利笔画穿透叠字 */
507
645
  [data-dsh-glass-float] [data-composer-card] > [data-dcu-glass-composer-surface] {
@@ -544,6 +682,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
544
682
  `;
545
683
  let styleTag = null;
546
684
  let seamDisposer;
685
+ let headerWidthDisposer;
547
686
  /**
548
687
  * 应用玻璃质感、排版模式与材质预设
549
688
  */
@@ -579,6 +718,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
579
718
  for (const [prop, val] of Object.entries(knobs)) root.style.setProperty(prop, val);
580
719
  if (document.body) for (const [prop, val] of Object.entries(knobs)) document.body.style.setProperty(prop, val);
581
720
  if (!seamDisposer) seamDisposer = startGlassSeamStamper();
721
+ if (!headerWidthDisposer) headerWidthDisposer = startGlassHeaderWidthTracker();
582
722
  ensureGlassFade(!isCompat);
583
723
  }
584
724
  const FADE_ATTRIBUTE = "data-dsh-glass-fade";
@@ -621,6 +761,10 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
621
761
  seamDisposer();
622
762
  seamDisposer = void 0;
623
763
  }
764
+ if (headerWidthDisposer) {
765
+ headerWidthDisposer();
766
+ headerWidthDisposer = void 0;
767
+ }
624
768
  if (styleTag && styleTag.parentNode) {
625
769
  styleTag.remove();
626
770
  styleTag = null;
@@ -10763,6 +10907,16 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
10763
10907
  @keyframes dcu-wsp-spin{to{transform:rotate(360deg)}}
10764
10908
  @media(prefers-reduced-motion:reduce){.dcu-wsp-spin{animation-duration:2.4s}}
10765
10909
  `;
10910
+ /**
10911
+ * 新建页拖柄唯一允许写入的变量。
10912
+ *
10913
+ * 宿主宽度变量(`--dsh-chat-user-width` / `--dsh-chat-content-width`)由 DSH 自己发布:0.2.2-rc.5 发布到
10914
+ * 会话根节点,0.2.3-alpha.2 改为只发布到正文节点并注册为不继承。插件若把值写进这两个变量,行内样式会
10915
+ * 盖住宿主之后的重算;宿主也不会再改写它,于是正文停在旧宽度,直到正文节点重挂(切页)才恢复(Issue #115)。
10916
+ * 因此这里只写插件私有变量,再由新建页样式映射给宿主变量,且映射规则限定在 `[data-phase=hero]` 内 ——
10917
+ * 离开新建页即自动失效,不需要清理时序配合。
10918
+ */
10919
+ const HERO_WIDTH_VAR = "--dcu-hero-chat-width";
10766
10920
  /** 按用户要求用最窄宽度替代宿主自适应默认;已有有效偏好不重置,拖拽起点沿用宿主存储。 */
10767
10921
  function initializeComposerWidth(storage) {
10768
10922
  const key = "dsh.conversation.contentWidth";
@@ -10778,7 +10932,7 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
10778
10932
  function observeHeroWidthHandles(label) {
10779
10933
  const mounted = /* @__PURE__ */ new Map();
10780
10934
  const style = document.createElement("style");
10781
- style.textContent = `[data-phase=hero]:has([data-conversation-scroll]){position:relative}[data-dcu-width-handle]{position:absolute;top:0;bottom:0;width:32px;padding:0;border:0;background:transparent;cursor:col-resize;touch-action:none;z-index:100;outline-offset:-5px}[data-dcu-width-handle=left]{right:calc(50% + var(--dsh-chat-content-width, var(--dsh-chat-user-width, 640px)) / 2 + 16px)}[data-dcu-width-handle=right]{left:calc(50% + var(--dsh-chat-content-width, var(--dsh-chat-user-width, 640px)) / 2 + 16px)}[data-dcu-width-handle]::after{content:'';position:absolute;top:calc(var(--dcu-pointer-y,50%) - 50px);height:100px;width:3px;left:14px;border-radius:3px;background:linear-gradient(transparent,var(--dsw-alias-scrollbar-hover-l1,#888),transparent);opacity:0}[data-dcu-width-handle]:hover::after,[data-dcu-width-handle]:focus-visible::after,[data-dcu-width-handle][data-dragging]::after{opacity:1}[data-phase=hero]:has([data-conversation-composer-overlay]) [data-dcu-width-handle]{display:none}`;
10935
+ style.textContent = `[data-phase=hero]:has([data-conversation-scroll]){position:relative}[data-dcu-width-handle]{position:absolute;top:0;bottom:0;width:32px;padding:0;border:0;background:transparent;cursor:col-resize;touch-action:none;z-index:100;outline-offset:-5px}[data-dcu-width-handle=left]{right:calc(50% + var(--dcu-hero-chat-width, 640px) / 2 + 16px)}[data-dcu-width-handle=right]{left:calc(50% + var(--dcu-hero-chat-width, 640px) / 2 + 16px)}[data-dcu-width-handle]::after{content:'';position:absolute;top:calc(var(--dcu-pointer-y,50%) - 50px);height:100px;width:3px;left:14px;border-radius:3px;background:linear-gradient(transparent,var(--dsw-alias-scrollbar-hover-l1,#888),transparent);opacity:0}[data-dcu-width-handle]:hover::after,[data-dcu-width-handle]:focus-visible::after,[data-dcu-width-handle][data-dragging]::after{opacity:1}[data-phase=hero]:has([data-conversation-composer-overlay]) [data-dcu-width-handle]{display:none}`;
10782
10936
  document.head.append(style);
10783
10937
  const sync = () => {
10784
10938
  for (const [root, dispose] of mounted) if (!root.isConnected || root.dataset.phase !== "hero") {
@@ -10789,25 +10943,30 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
10789
10943
  if (mounted.has(root) || !root.querySelector("[data-conversation-scroll]")) continue;
10790
10944
  const body = root.querySelector("[class*=\"_body\"]:has([data-conversation-scroll])") ?? root.querySelector("[class*=\"_body\"]");
10791
10945
  const clamp = (value) => Math.min(Math.max(640, value), Math.max(640, root.clientWidth - 176));
10946
+ const stored = () => {
10947
+ try {
10948
+ return localStorage.getItem("dsh.conversation.contentWidth") ?? void 0;
10949
+ } catch {
10950
+ return;
10951
+ }
10952
+ };
10792
10953
  const current = () => {
10793
- const raw = body?.style.getPropertyValue("--dsh-chat-user-width") || getComputedStyle(root).getPropertyValue("--dsh-chat-user-width") || getComputedStyle(root).getPropertyValue("--dsh-chat-content-width");
10794
- return clamp(parseFloat(raw) || 640);
10954
+ const own = root.style.getPropertyValue(HERO_WIDTH_VAR);
10955
+ const raw = (root.hasAttribute("data-dcu-hero-width") ? "" : body?.style.getPropertyValue("--dsh-chat-user-width") || getComputedStyle(root).getPropertyValue("--dsh-chat-user-width") || getComputedStyle(root).getPropertyValue("--dsh-chat-content-width")) || own || stored();
10956
+ return clamp(Number.parseFloat(raw ?? "") || 640);
10795
10957
  };
10796
10958
  const publish = (width, save) => {
10797
10959
  const value = clamp(width);
10798
- body?.style.setProperty("--dsh-chat-user-width", `${value}px`);
10799
- root.style.setProperty("--dsh-chat-user-width", `${value}px`);
10800
- root.style.setProperty("--dsh-chat-content-width", `${value}px`);
10960
+ root.style.setProperty(HERO_WIDTH_VAR, `${value}px`);
10961
+ root.dataset.dcuHeroWidth = "";
10801
10962
  if (save) try {
10802
10963
  localStorage.setItem("dsh.conversation.contentWidth", String(value));
10803
10964
  } catch (error) {
10804
10965
  console.warn("[codex-ui] 无法保存输入区宽度。", error);
10805
10966
  }
10806
10967
  };
10807
- const initialWidth = current();
10808
- body?.style.setProperty("--dsh-chat-user-width", `${initialWidth}px`);
10809
- root.style.setProperty("--dsh-chat-user-width", `${initialWidth}px`);
10810
- root.style.setProperty("--dsh-chat-content-width", `${initialWidth}px`);
10968
+ publish(current(), false);
10969
+ const abortDrags = [];
10811
10970
  const handles = ["left", "right"].map((side) => {
10812
10971
  const handle = document.createElement("button");
10813
10972
  handle.type = "button";
@@ -10816,30 +10975,56 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
10816
10975
  let origin = 0;
10817
10976
  let initial = 640;
10818
10977
  let dragging = false;
10978
+ let pointerId;
10979
+ let last = 640;
10980
+ const delta = (event) => initial + (event.clientX - origin) * (side === "right" ? 2 : -2);
10981
+ const onWindowMove = (event) => {
10982
+ if (!dragging || event.pointerId !== pointerId) return;
10983
+ if (event.buttons === 0) {
10984
+ publish(last, true);
10985
+ finish();
10986
+ return;
10987
+ }
10988
+ last = delta(event);
10989
+ publish(last, false);
10990
+ };
10991
+ const onWindowEnd = (event) => {
10992
+ if (!dragging || event.pointerId !== pointerId) return;
10993
+ publish(delta(event), true);
10994
+ finish();
10995
+ };
10996
+ const finish = () => {
10997
+ dragging = false;
10998
+ pointerId = void 0;
10999
+ delete handle.dataset.dragging;
11000
+ window.removeEventListener("pointermove", onWindowMove);
11001
+ window.removeEventListener("pointerup", onWindowEnd);
11002
+ window.removeEventListener("pointercancel", finish);
11003
+ };
11004
+ abortDrags.push(finish);
10819
11005
  handle.addEventListener("pointerdown", (event) => {
10820
11006
  if (event.button !== 0) return;
10821
11007
  event.preventDefault();
10822
11008
  origin = event.clientX;
10823
11009
  initial = current();
11010
+ last = initial;
10824
11011
  dragging = true;
11012
+ pointerId = event.pointerId;
10825
11013
  handle.dataset.dragging = "";
10826
- handle.setPointerCapture(event.pointerId);
11014
+ try {
11015
+ handle.setPointerCapture(event.pointerId);
11016
+ } catch {}
11017
+ window.addEventListener("pointermove", onWindowMove);
11018
+ window.addEventListener("pointerup", onWindowEnd);
11019
+ window.addEventListener("pointercancel", finish);
10827
11020
  });
10828
11021
  handle.addEventListener("pointermove", (event) => {
10829
11022
  handle.style.setProperty("--dcu-pointer-y", `${event.clientY - handle.getBoundingClientRect().top}px`);
10830
- if (dragging) publish(initial + (event.clientX - origin) * (side === "right" ? 2 : -2), false);
10831
- });
10832
- handle.addEventListener("pointerup", (event) => {
10833
- if (!dragging) return;
10834
- publish(initial + (event.clientX - origin) * (side === "right" ? 2 : -2), true);
10835
- dragging = false;
10836
- delete handle.dataset.dragging;
10837
- handle.releasePointerCapture(event.pointerId);
10838
11023
  });
10839
- handle.addEventListener("lostpointercapture", () => {
10840
- if (dragging) publish(initial, false);
10841
- dragging = false;
10842
- delete handle.dataset.dragging;
11024
+ handle.addEventListener("lostpointercapture", (event) => {
11025
+ if (!dragging || event.pointerId !== pointerId) return;
11026
+ publish(last, true);
11027
+ finish();
10843
11028
  });
10844
11029
  handle.addEventListener("keydown", (event) => {
10845
11030
  if (![
@@ -10855,7 +11040,10 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
10855
11040
  return handle;
10856
11041
  });
10857
11042
  mounted.set(root, () => {
11043
+ abortDrags.forEach((stop) => stop());
10858
11044
  handles.forEach((handle) => handle.remove());
11045
+ root.style.removeProperty(HERO_WIDTH_VAR);
11046
+ delete root.dataset.dcuHeroWidth;
10859
11047
  });
10860
11048
  }
10861
11049
  };
@@ -11767,6 +11955,10 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
11767
11955
  const NEW_CONVERSATION_STYLE = `
11768
11956
  [data-phase=hero]:has([data-conversation-scroll]){container:dcu-new-conversation / inline-size}
11769
11957
  [data-phase=hero] [class*="_body"]{--dsh-chat-user-width:inherit}
11958
+ /* 必须 !important:0.2.3 宿主在新建页也会把偏好行内发布到正文节点(--dsh-chat-user-width),
11959
+ 普通作者规则压不过行内声明,映射会变成死代码(拖了没反应)。important 只在「新建页 + 插件已接管宽度」
11960
+ 时生效,离开相位或注销时标记被移除,行内发布重新接管。 */
11961
+ [data-dcu-hero-width][data-phase=hero] [class*="_body"]{--dsh-chat-user-width:var(--dcu-hero-chat-width)!important}
11770
11962
  [data-phase=hero] [data-conversation-scroll][class]{--dsh-composer-side-clearance:16px;justify-content:flex-start;scrollbar-gutter:stable both-edges}
11771
11963
  [data-phase=hero] [data-composer-seat]{flex:1 0 auto;min-height:100%}
11772
11964
  [data-phase=hero] [data-composer-seat]>:has([class*="_composerHero"]){display:flex;flex:1;flex-direction:column}
@@ -14607,13 +14799,15 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
14607
14799
  /** 把标题按分区顺序放到各自第一个分组块前面;空分区贴着下一个分区显示。 */
14608
14800
  function placeHeaders(blocks, layoutState = state) {
14609
14801
  if (blocks.length === 0) {
14610
- const stalePinned = headers.get(PINNED_SECTION_ID);
14611
- if (stalePinned !== void 0) {
14612
- stalePinned.remove();
14613
- headers.delete(PINNED_SECTION_ID);
14614
- if (collapsed["pinned"] === true) {
14615
- delete collapsed[PINNED_SECTION_ID];
14616
- persistCollapsed();
14802
+ for (const builtinId of [PINNED_SECTION_ID, DEFAULT_SECTION_ID]) {
14803
+ const stale = headers.get(builtinId);
14804
+ if (stale !== void 0) {
14805
+ stale.remove();
14806
+ headers.delete(builtinId);
14807
+ if (collapsed[builtinId] === true) {
14808
+ delete collapsed[builtinId];
14809
+ persistCollapsed();
14810
+ }
14617
14811
  }
14618
14812
  }
14619
14813
  return;
@@ -14624,6 +14818,9 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
14624
14818
  const ungrouped = Array.from(list?.querySelectorAll("[data-row-key=\"workspace:\"]") ?? []).map((row) => row instanceof HTMLElement ? blockOf(row, list) : null).find((block) => block !== null);
14625
14819
  const byId = new Map(blocks.map((item) => [item.workspaceId, item.block]));
14626
14820
  const visibleById = relocatingIds.size === 0 ? byId : new Map(blocks.filter((item) => !relocatingIds.has(item.workspaceId)).map((item) => [item.workspaceId, item.block]));
14821
+ const hasCustomSections = layoutState.sections.some((s) => !isBuiltinSection(s.id));
14822
+ const hasPinnedItems = (layoutState.sections.find((s) => s.id === "pinned")?.ids.length ?? 0) > 0;
14823
+ const isPartitioned = hasCustomSections || hasPinnedItems;
14627
14824
  let reference = ungrouped ?? null;
14628
14825
  for (let index = layoutState.sections.length - 1; index >= 0; index -= 1) {
14629
14826
  const section = layoutState.sections[index];
@@ -14641,6 +14838,18 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
14641
14838
  }
14642
14839
  continue;
14643
14840
  }
14841
+ if (section.id === "default" && (!isPartitioned || section.ids.length === 0)) {
14842
+ const stale = headers.get(DEFAULT_SECTION_ID);
14843
+ if (stale !== void 0) {
14844
+ stale.remove();
14845
+ headers.delete(DEFAULT_SECTION_ID);
14846
+ if (collapsed["default"] === true) {
14847
+ delete collapsed[DEFAULT_SECTION_ID];
14848
+ persistCollapsed();
14849
+ }
14850
+ }
14851
+ continue;
14852
+ }
14644
14853
  const header = ensureHeader(section.id, section.name);
14645
14854
  if (header.parentElement !== target || nextStructuralSibling(header) !== reference) target.insertBefore(header, reference);
14646
14855
  reference = header;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michengai/dsh-codex-ui",
3
- "version": "2.4.5",
3
+ "version": "2.4.7",
4
4
  "description": "DSH Codex UI — 为 DeepSeek Harness 提供极速历史召回、全屏设置皮肤、原生物理毛玻璃换肤、模块化侧栏与桌面原生窗口菜单 · Input enhancement, settings skin, native glass theme, modular sidebar, and desktop titlebar menu for DSH",
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {